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
src/main/fragment/mos6502-common/_deref_pwsz1_eq_0_then_la1.asm
jbrandwood/kickc
2
24850
ldy #0 lda ({z1}),y iny ora ({z1}),y beq {la1}
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_341.asm
ljhsiun2/medusa
9
83029
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x4908, %r14 clflush (%r14) nop nop nop nop xor $49705, %r13 movb (%r14), %r8b nop nop add %rbp, %rbp lea addresses_A_ht+0xd998, %rsi lea addresses_A_ht+0xac8c, %rdi clflush (%rdi) nop nop nop nop sub %r13, %r13 mov $17, %rcx rep movsb nop add $37052, %r14 lea addresses_D_ht+0x11b08, %rsi lea addresses_WC_ht+0xfb5f, %rdi nop nop nop nop nop add $41193, %r14 mov $51, %rcx rep movsw nop nop xor %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r8 push %rax push %rbx push %rcx push %rdx // Load lea addresses_PSE+0x11066, %r15 xor %rbx, %rbx mov (%r15), %edx nop nop nop nop inc %rdx // Store lea addresses_D+0x10588, %r13 nop nop nop cmp $14964, %rax movw $0x5152, (%r13) nop nop nop sub %rdx, %rdx // Store lea addresses_WC+0xb4e8, %rdx nop nop nop nop inc %rbx movw $0x5152, (%rdx) nop nop nop xor %rdx, %rdx // Faulty Load lea addresses_PSE+0x9388, %rcx nop nop nop add $26785, %r8 movups (%rcx), %xmm2 vpextrq $1, %xmm2, %r13 lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rdx pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
oeis/087/A087208.asm
neoneye/loda-programs
11
6873
<filename>oeis/087/A087208.asm<gh_stars>10-100 ; A087208: Expansion of e.g.f.: exp(x)/(1-x^2). ; Submitted by <NAME>(s2.) ; 1,1,3,7,37,141,1111,5923,62217,426457,5599531,46910271,739138093,7318002277,134523132927,1536780478171,32285551902481,418004290062513,9879378882159187,142957467201379447,3754163975220491061,60042136224579367741,1734423756551866870183,30381320929637160076947,957401913616630512341017,18228792557782296046168201,622311243850809833021661051,12796612375563171824410077103,470467300351212233764375754557,10390849248957295521420982607637,409306551305554643375006906464591 mov $1,1 lpb $0 mul $1,$0 sub $0,1 mul $1,$0 sub $0,1 add $2,$1 lpe mov $0,$2 add $0,1
Practica11/Practica11/Practica11_BRAu.asm
Pedejeca135/ELECTRONICA-B_UASLP
1
178389
<reponame>Pedejeca135/ELECTRONICA-B_UASLP /* * Practica11_BRAu.asm * * Created: 6/1/2020 10:16:17 AM * Author: pjco9 */ .def config = r16 .def puertoB = r17 .def puertoC = r18 .def puertoD = r19 .org 0x00 jmp reset .org 0x0024 jmp USART_RX .org 0x100 reset: //USART/ ldi config,0b1001_0000 sts UCSR0B,config ldi config,0b00_00_0110 sts UCSR0C,config /*Baudios*/ ldi config,0b0110_0111 sts 0xC4,config ldi config,0b00000000 sts 0xC5,config /* I/O Ports*/ ldi config, 0xFF out ddrb, config out ddrc, config mov puertoD,config sei jmp main .org 0x500 main: jmp main delay: ldi r21, 41 ldi r22, 150 ldi r23, 128 L1: dec r23 brne L1 dec r22 brne L1 dec r21 brne L1 ret .org 0x700 USART_RX: lds puertoD,0xC6 cpi puertoD,0b0011_0000//0 lds config, 0x5F sbic 16,1 ldi puertoD, 0x3F cpi puertoD,0b0011_0001//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x86 cpi puertoD,0b0011_0010//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x5B cpi puertoD,0b0011_0011//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xCF cpi puertoD,0b0011_0100//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x66 cpi puertoD,0b0011_0101//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xED cpi puertoD,0b0011_0110//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x7D cpi puertoD,0b0011_0111//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x87 cpi puertoD,0b0011_1000//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x7F cpi puertoD,0b0011_1001//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xE7 cpi puertoD,0b0100_0001//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x77 cpi puertoD,0b0100_0010//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xFC cpi puertoD,0b0100_0011//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x39 cpi puertoD,0b0100_0100//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xDE cpi puertoD,0b0100_0101//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0x79 cpi puertoD,0b0100_0110//1 lds config, 0x5F sbic 16,1 ldi puertoD, 0xF1 mov puertoB,puertoD andi puertoB,0x0F mov puertoC,puertoD ror puertoC ror puertoC ror puertoC ror puertoC andi puertoC,0x0F out portb,puertoB out portc,puertoC call delay call delay call delay reti
oeis/313/A313053.asm
neoneye/loda-programs
11
161470
<filename>oeis/313/A313053.asm ; A313053: Coordination sequence Gal.5.114.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME>(s2.) ; 1,4,9,14,18,23,28,32,37,42,46,50,55,60,64,69,74,78,83,88,92,96,101,106,110,115,120,124,129,134,138,142,147,152,156,161,166,170,175,180,184,188,193,198,202,207,212,216,221,226 mov $1,1 mov $4,$0 mul $4,3 mov $5,$0 lpb $0 mov $0,2 mul $0,$4 mov $2,$4 mod $2,10 add $0,$2 div $0,10 mov $1,$0 lpe mov $3,$5 mul $3,4 add $1,$3 mov $0,$1
src/Data/ByteString/Primitive.agda
semenov-vladyslav/bytes-agda
0
4835
<filename>src/Data/ByteString/Primitive.agda {-# OPTIONS --without-K #-} module Data.ByteString.Primitive where open import Data.Word8.Primitive using (Word8) open import Data.Nat using (ℕ; _<_) open import Data.Colist using (Colist) open import Data.List using (List; length) open import Agda.Builtin.String using (String) open import Agda.Builtin.Bool using (Bool) open import Agda.Builtin.IO using (IO) open import Data.Tuple.Base using (Pair) open import Relation.Binary.PropositionalEquality using (_≡_) open import Relation.Binary.PropositionalEquality.TrustMe using (trustMe) {-# FOREIGN GHC import qualified Data.ByteString.Lazy #-} open import Data.ByteString.Primitive.Int open import Data.ByteString.Primitive.Lazy open import Data.ByteString.Primitive.Strict -- properties module _ where List→Strict→List : (l : List Word8) → List←Strict (List→Strict l) ≡ l List→Strict→List l = trustMe Strict→List→Strict : (bs : ByteStringStrict) → List→Strict (List←Strict bs) ≡ bs Strict→List→Strict bs = trustMe ∣Strict∣≡∣List∣ : (bs : ByteStringStrict) → IntToℕ (lengthStrict bs) ≡ length (List←Strict bs) ∣Strict∣≡∣List∣ bs = trustMe 2³¹ = 2147483648 ∣List∣≡∣Strict∣ : (l : List Word8) → (l-small : length l < 2³¹) → IntToℕ (lengthStrict (List→Strict l)) ≡ length l ∣List∣≡∣Strict∣ l l-small = trustMe postulate toLazy : ByteStringStrict → ByteStringLazy toStrict : ByteStringLazy → ByteStringStrict lazy≟lazy : ByteStringLazy → ByteStringLazy → Bool strict≟strict : ByteStringStrict → ByteStringStrict → Bool {-# COMPILE GHC toLazy = (Data.ByteString.Lazy.fromStrict) #-} {-# COMPILE GHC toStrict = (Data.ByteString.Lazy.toStrict) #-} {-# COMPILE GHC lazy≟lazy = (==) #-} {-# COMPILE GHC strict≟strict = (==) #-} lazy≟strict : ByteStringLazy → ByteStringStrict → Bool lazy≟strict l s = lazy≟lazy l (toLazy s) strict≟lazy : ByteStringStrict → ByteStringLazy → Bool strict≟lazy s l = lazy≟lazy (toLazy s) l postulate fromChunks : List ByteStringStrict → ByteStringLazy toChunks : ByteStringLazy → List ByteStringStrict {-# COMPILE GHC fromChunks = (Data.ByteString.Lazy.fromChunks) #-} {-# COMPILE GHC toChunks = (Data.ByteString.Lazy.toChunks) #-}
ch15/ch15-core-ex02.asm
Sunrisepeak/x86-Assembly-Real-To-Protected_Mode
1
176445
<gh_stars>1-10 ;代码清单15-1 ;文件名:c15_core.asm ;文件说明:保护模式微型核心程序 ;创建日期:2011-11-19 21:40 ;以下常量定义部分。内核的大部分内容都应当固定 user_app_address equ 0x08 ; logic-sector core_code_seg_sel equ 0x38 ;内核代码段选择子 core_data_seg_sel equ 0x30 ;内核数据段选择子 sys_routine_seg_sel equ 0x28 ;系统公共例程代码段的选择子 video_ram_seg_sel equ 0x20 ;视频显示缓冲区的段选择子 core_stack_seg_sel equ 0x18 ;内核堆栈段选择子 mem_0_4_gb_seg_sel equ 0x08 ;整个0-4GB内存的段的选择子 ;------------------------------------------------------------------------------- ;以下是系统核心的头部,用于加载核心程序 core_length dd core_end ;核心程序总长度#00 sys_routine_seg dd section.sys_routine.start ;系统公用例程段位置#04 core_data_seg dd section.core_data.start ;核心数据段位置#08 core_code_seg dd section.core_code.start ;核心代码段位置#0c core_entry dd start ;核心代码段入口点#10 dw core_code_seg_sel ;=============================================================================== [bits 32] ;=============================================================================== SECTION sys_routine vstart=0 ;系统公共例程代码段 ;------------------------------------------------------------------------------- ;字符串显示例程 put_string: ;显示0终止的字符串并移动光标 ;输入:DS:EBX=串地址 push ecx .getc: mov cl,[ebx] or cl,cl jz .exit call put_char inc ebx jmp .getc .exit: pop ecx retf ;段间返回 ;------------------------------------------------------------------------------- put_char: ;在当前光标处显示一个字符,并推进 ;光标。仅用于段内调用 ;输入:CL=字符ASCII码 pushad ;以下取当前光标位置 mov dx,0x3d4 mov al,0x0e out dx,al inc dx ;0x3d5 in al,dx ;高字 mov ah,al dec dx ;0x3d4 mov al,0x0f out dx,al inc dx ;0x3d5 in al,dx ;低字 mov bx,ax ;BX=代表光标位置的16位数 cmp cl,0x0d ;回车符? jnz .put_0a mov ax,bx mov bl,80 div bl mul bl mov bx,ax jmp .set_cursor .put_0a: cmp cl,0x0a ;换行符? jnz .put_other add bx,80 jmp .roll_screen .put_other: ;正常显示字符 push es mov eax,video_ram_seg_sel ;0xb8000段的选择子 mov es,eax shl bx,1 mov [es:bx],cl pop es ;以下将光标位置推进一个字符 shr bx,1 inc bx .roll_screen: cmp bx,2000 ;光标超出屏幕?滚屏 jl .set_cursor push ds push es mov eax,video_ram_seg_sel mov ds,eax mov es,eax cld mov esi,0xa0 ;小心!32位模式下movsb/w/d mov edi,0x00 ;使用的是esi/edi/ecx mov ecx,1920 rep movsd mov bx,3840 ;清除屏幕最底一行 mov ecx,80 ;32位程序应该使用ECX .cls: mov word[es:bx],0x0720 add bx,2 loop .cls pop es pop ds mov bx,1920 .set_cursor: mov dx,0x3d4 mov al,0x0e out dx,al inc dx ;0x3d5 mov al,bh out dx,al dec dx ;0x3d4 mov al,0x0f out dx,al inc dx ;0x3d5 mov al,bl out dx,al popad ret ;------------------------------------------------------------------------------- read_hard_disk_0: ;从硬盘读取一个逻辑扇区 ;EAX=逻辑扇区号 ;DS:EBX=目标缓冲区地址 ;返回:EBX=EBX+512 push eax push ecx push edx push eax mov dx,0x1f2 mov al,1 out dx,al ;读取的扇区数 inc dx ;0x1f3 pop eax out dx,al ;LBA地址7~0 inc dx ;0x1f4 mov cl,8 shr eax,cl out dx,al ;LBA地址15~8 inc dx ;0x1f5 shr eax,cl out dx,al ;LBA地址23~16 inc dx ;0x1f6 shr eax,cl or al,0xe0 ;第一硬盘 LBA地址27~24 out dx,al inc dx ;0x1f7 mov al,0x20 ;读命令 out dx,al .waits: in al,dx and al,0x88 cmp al,0x08 jnz .waits ;不忙,且硬盘已准备好数据传输 mov ecx,256 ;总共要读取的字数 mov dx,0x1f0 .readw: in ax,dx mov [ebx],ax add ebx,2 loop .readw pop edx pop ecx pop eax retf ;段间返回 ;------------------------------------------------------------------------------- ;汇编语言程序是极难一次成功,而且调试非常困难。这个例程可以提供帮助 put_hex_dword: ;在当前光标处以十六进制形式显示 ;一个双字并推进光标 ;输入:EDX=要转换并显示的数字 ;输出:无 pushad push ds mov ax,core_data_seg_sel ;切换到核心数据段 mov ds,ax mov ebx,bin_hex ;指向核心数据段内的转换表 mov ecx,8 .xlt: rol edx,4 mov eax,edx and eax,0x0000000f xlat push ecx mov cl,al call put_char pop ecx loop .xlt pop ds popad retf ;------------------------------------------------------------------------------- allocate_memory: ;分配内存 ;输入:ECX=希望分配的字节数 ;输出:ECX=起始线性地址 push ds push eax push ebx mov eax,core_data_seg_sel mov ds,eax mov eax,[ram_alloc] add eax,ecx ;下一次分配时的起始地址 ;这里应当有检测可用内存数量的指令 mov ecx,[ram_alloc] ;返回分配的起始地址 mov ebx,eax and ebx,0xfffffffc add ebx,4 ;强制对齐 test eax,0x00000003 ;下次分配的起始地址最好是4字节对齐 cmovnz eax,ebx ;如果没有对齐,则强制对齐 mov [ram_alloc],eax ;下次从该地址分配内存 ;cmovcc指令可以避免控制转移 pop ebx pop eax pop ds retf ;------------------------------------------------------------------------------- set_up_gdt_descriptor: ;在GDT内安装一个新的描述符 ;输入:EDX:EAX=描述符 ;输出:CX=描述符的选择子 push eax push ebx push edx push ds push es mov ebx,core_data_seg_sel ;切换到核心数据段 mov ds,ebx sgdt [pgdt] ;以便开始处理GDT mov ebx,mem_0_4_gb_seg_sel mov es,ebx movzx ebx,word [pgdt] ;GDT界限 inc bx ;GDT总字节数,也是下一个描述符偏移 add ebx,[pgdt+2] ;下一个描述符的线性地址 mov [es:ebx],eax mov [es:ebx+4],edx add word [pgdt],8 ;增加一个描述符的大小 lgdt [pgdt] ;对GDT的更改生效 mov ax,[pgdt] ;得到GDT界限值 xor dx,dx mov bx,8 div bx ;除以8,去掉余数 mov cx,ax shl cx,3 ;将索引号移到正确位置 pop es pop ds pop edx pop ebx pop eax retf ;------------------------------------------------------------------------------- make_seg_descriptor: ;构造存储器和系统的段描述符 ;输入:EAX=线性基地址 ; EBX=段界限 ; ECX=属性。各属性位都在原始 ; 位置,无关的位清零 ;返回:EDX:EAX=描述符 mov edx,eax shl eax,16 or ax,bx ;描述符前32位(EAX)构造完毕 and edx,0xffff0000 ;清除基地址中无关的位 rol edx,8 bswap edx ;装配基址的31~24和23~16 (80486+) xor bx,bx or edx,ebx ;装配段界限的高4位 or edx,ecx ;装配属性 retf ;------------------------------------------------------------------------------- make_gate_descriptor: ;构造门的描述符(调用门等) ;输入:EAX=门代码在段内偏移地址 ; BX=门代码所在段的选择子 ; CX=段类型及属性等(各属 ; 性位都在原始位置) ;返回:EDX:EAX=完整的描述符 push ebx push ecx mov edx,eax and edx,0xffff0000 ;得到偏移地址高16位 or dx,cx ;组装属性部分到EDX and eax,0x0000ffff ;得到偏移地址低16位 shl ebx,16 or eax,ebx ;组装段选择子部分 pop ecx pop ebx retf ;------------------------------------------------------------------------------- terminate_current_task: ;终止当前任务 ;注意,执行此例程时,当前任务仍在 ;运行中。此例程其实也是当前任务的 ;一部分 pushfd mov edx,[esp] ;获得EFLAGS寄存器内容 add esp,4 ;恢复堆栈指针 mov eax,core_data_seg_sel mov ds,eax test dx,0100_0000_0000_0000B ;测试NT位 jnz .b1 ;当前任务是嵌套的,到.b1执行iretd mov ebx,core_msg1 ;当前任务不是嵌套的,直接切换到 call sys_routine_seg_sel:put_string jmp far [prgman_tss] ;程序管理器任务 .b1: mov ebx,core_msg0 call sys_routine_seg_sel:put_string iretd ;-------------------------------------ch15 ex02 start----------------------------------- next_task: pushad push ds push es mov ecx, mem_0_4_gb_seg_sel mov es, ecx ; get 0 ~ 4G Memory space mov ecx, core_data_seg_sel mov ds, ecx ; get core data seg-select mov eax, [es : eax] ; get tcb_base of next task cmp eax, 0 jz .over ; exist next task ? mov ebx, switch_info call sys_routine_seg_sel : put_string jmp far [es : eax + 0x14] ; switch to next task by TSS-select[Task-Gate] .over: pop es pop ds popad retf ;-------------------------------------ch15 ex02 end----------------------------------- sys_routine_end: ;=============================================================================== SECTION core_data vstart=0 ;系统核心的数据段 ;------------------------------------------------------------------------------- pgdt dw 0 ;用于设置和修改GDT dd 0 ram_alloc dd 0x00100000 ;下次分配内存时的起始地址 ;符号地址检索表 salt: salt_1 db '@PrintString' times 256-($-salt_1) db 0 dd put_string dw sys_routine_seg_sel salt_2 db '@ReadDiskData' times 256-($-salt_2) db 0 dd read_hard_disk_0 dw sys_routine_seg_sel salt_3 db '@PrintDwordAsHexString' times 256-($-salt_3) db 0 dd put_hex_dword dw sys_routine_seg_sel salt_4 db '@TerminateProgram' times 256-($-salt_4) db 0 dd terminate_current_task dw sys_routine_seg_sel ;----------------------------------ch15 ex02 start---------------------------- salt_5 db '@nextTask' times 256-($-salt_5) db 0 dd next_task dw sys_routine_seg_sel salt_item_len equ $-salt_5 ;----------------------------------ch15 ex02 start---------------------------- salt_items equ ($-salt)/salt_item_len message_1 db ' If you seen this message,that means we ' db 'are now in protect mode,and the system ' db 'core is loaded,and the video display ' db 'routine works perfectly.',0x0d,0x0a,0 message_2 db ' System wide CALL-GATE mounted.',0x0d,0x0a,0 bin_hex db '0123456789ABCDEF' ;put_hex_dword子过程用的查找表 core_buf times 2048 db 0 ;内核用的缓冲区 cpu_brnd0 db 0x0d,0x0a,' ',0 cpu_brand times 52 db 0 cpu_brnd1 db 0x0d,0x0a,0x0d,0x0a,0 ;任务控制块链 tcb_chain dd 0 ;程序管理器的任务信息 prgman_tss dd 0 ;程序管理器的TSS基地址 dw 0 ;程序管理器的TSS描述符选择子 prgman_msg1 db 0x0d,0x0a db '[PROGRAM MANAGER]: Hello! I am Program Manager,' db 'run at CPL=0.Now,create user task and switch ' db 'to it by the CALL instruction...',0x0d,0x0a,0 prgman_msg2 db 0x0d,0x0a db '[PROGRAM MANAGER]: Creating Task 1...' db 0x0d,0x0a,0 prgman_msg22 db 0x0d,0x0a db '[PROGRAM MANAGER]: Creating Task 2...' db 0x0d,0x0a,0 prgman_msg3 db 0x0d,0x0a db '[PROGRAM MANAGER]: I am gain control again,' db 'HALT...',0 core_msg0 db 0x0d,0x0a db '[SYSTEM CORE]: Uh...This task initiated with ' db 'CALL instruction or an exeception/ interrupt,' db 'should use IRETD instruction to switch back...' db 0x0d,0x0a,0 core_msg1 db 0x0d,0x0a db '[SYSTEM CORE]: Uh...This task initiated with ' db 'JMP instruction, should switch to Program ' db 'Manager directly by the JMP instruction...' db 0x0d,0x0a,0 switch_info db 0x0d, 0x0a db 'switch to next task -->' db 0x0d, 0x0a,0 core_data_end: ;=============================================================================== SECTION core_code vstart=0 ;------------------------------------------------------------------------------- fill_descriptor_in_ldt: ;在LDT内安装一个新的描述符 ;输入:EDX:EAX=描述符 ; EBX=TCB基地址 ;输出:CX=描述符的选择子 push eax push edx push edi push ds mov ecx,mem_0_4_gb_seg_sel mov ds,ecx mov edi,[ebx+0x0c] ;获得LDT基地址 xor ecx,ecx mov cx,[ebx+0x0a] ;获得LDT界限 inc cx ;LDT的总字节数,即新描述符偏移地址 mov [edi+ecx+0x00],eax mov [edi+ecx+0x04],edx ;安装描述符 add cx,8 dec cx ;得到新的LDT界限值 mov [ebx+0x0a],cx ;更新LDT界限值到TCB mov ax,cx xor dx,dx mov cx,8 div cx mov cx,ax shl cx,3 ;左移3位,并且 or cx,0000_0000_0000_0100B ;使TI位=1,指向LDT,最后使RPL=00 pop ds pop edi pop edx pop eax ret ;------------------------------------------------------------------------------- load_relocate_program: ;加载并重定位用户程序 ;输入: PUSH 逻辑扇区号 ; PUSH 任务控制块基地址 ;输出:无 pushad push ds push es mov ebp,esp ;为访问通过堆栈传递的参数做准备 mov ecx,mem_0_4_gb_seg_sel mov es,ecx mov esi,[ebp+11*4] ;从堆栈中取得TCB的基地址 ;以下申请创建LDT所需要的内存 mov ecx,160 ;允许安装20个LDT描述符 call sys_routine_seg_sel:allocate_memory mov [es:esi+0x0c],ecx ;登记LDT基地址到TCB中 mov word [es:esi+0x0a],0xffff ;登记LDT初始的界限到TCB中 ;以下开始加载用户程序 mov eax,core_data_seg_sel mov ds,eax ;切换DS到内核数据段 mov eax,[ebp+12*4] ;从堆栈中取出用户程序起始扇区号 mov ebx,core_buf ;读取程序头部数据 call sys_routine_seg_sel:read_hard_disk_0 ;以下判断整个程序有多大 mov eax,[core_buf] ;程序尺寸 mov ebx,eax and ebx,0xfffffe00 ;使之512字节对齐(能被512整除的数低 add ebx,512 ;9位都为0 test eax,0x000001ff ;程序的大小正好是512的倍数吗? cmovnz eax,ebx ;不是。使用凑整的结果 mov ecx,eax ;实际需要申请的内存数量 call sys_routine_seg_sel:allocate_memory mov [es:esi+0x06],ecx ;登记程序加载基地址到TCB中 mov ebx,ecx ;ebx -> 申请到的内存首地址 xor edx,edx mov ecx,512 div ecx mov ecx,eax ;总扇区数 mov eax,mem_0_4_gb_seg_sel ;切换DS到0-4GB的段 mov ds,eax mov eax,[ebp+12*4] ;起始扇区号 .b1: call sys_routine_seg_sel:read_hard_disk_0 inc eax loop .b1 ;循环读,直到读完整个用户程序 mov edi,[es:esi+0x06] ;获得程序加载基地址 ;建立程序头部段描述符 mov eax,edi ;程序头部起始线性地址 mov ebx,[edi+0x04] ;段长度 dec ebx ;段界限 mov ecx,0x0040f200 ;字节粒度的数据段描述符,特权级3 call sys_routine_seg_sel:make_seg_descriptor ;安装头部段描述符到LDT中 mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0011B ;设置选择子的特权级为3 mov [es:esi+0x44],cx ;登记程序头部段选择子到TCB mov [edi+0x04],cx ;和头部内 ;建立程序代码段描述符 mov eax,edi add eax,[edi+0x14] ;代码起始线性地址 mov ebx,[edi+0x18] ;段长度 dec ebx ;段界限 mov ecx,0x0040f800 ;字节粒度的代码段描述符,特权级3 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0011B ;设置选择子的特权级为3 mov [edi+0x14],cx ;登记代码段选择子到头部 ;建立程序数据段描述符 mov eax,edi add eax,[edi+0x1c] ;数据段起始线性地址 mov ebx,[edi+0x20] ;段长度 dec ebx ;段界限 mov ecx,0x0040f200 ;字节粒度的数据段描述符,特权级3 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0011B ;设置选择子的特权级为3 mov [edi+0x1c],cx ;登记数据段选择子到头部 ;建立程序堆栈段描述符 mov ecx,[edi+0x0c] ;4KB的倍率 mov ebx,0x000fffff sub ebx,ecx ;得到段界限 mov eax,4096 mul ecx mov ecx,eax ;准备为堆栈分配内存 call sys_routine_seg_sel:allocate_memory add eax,ecx ;得到堆栈的高端物理地址 mov ecx,0x00c0f600 ;字节粒度的堆栈段描述符,特权级3 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0011B ;设置选择子的特权级为3 mov [edi+0x08],cx ;登记堆栈段选择子到头部 ;重定位SALT mov eax,mem_0_4_gb_seg_sel ;这里和前一章不同,头部段描述符 mov es,eax ;已安装,但还没有生效,故只能通 ;过4GB段访问用户程序头部 mov eax,core_data_seg_sel mov ds,eax cld ;------------------------------------ch15 ex02 start------------------------------------- mov [es : edi + 0x24], esi ; save tcb_base AD mov ecx,[es:edi+0x28] ;U-SALT条目数(通过访问4GB段取得) add edi,0x2c ;U-SALT在4GB段内的偏移 ;------------------------------------ch15 ex02 end--------------------------------------- .b2: push ecx push edi mov ecx,salt_items mov esi,salt .b3: push edi push esi push ecx mov ecx,64 ;检索表中,每条目的比较次数 repe cmpsd ;每次比较4字节 jnz .b4 mov eax,[esi] ;若匹配,则esi恰好指向其后的地址 mov [es:edi-256],eax ;将字符串改写成偏移地址 mov ax,[esi+4] or ax,0000000000000011B ;以用户程序自己的特权级使用调用门 ;故RPL=3 mov [es:edi-252],ax ;回填调用门选择子 .b4: pop ecx pop esi add esi,salt_item_len pop edi ;从头比较 loop .b3 pop edi add edi,256 pop ecx loop .b2 mov esi,[ebp+11*4] ;从堆栈中取得TCB的基地址 ;创建0特权级堆栈 mov ecx,4096 mov eax,ecx ;为生成堆栈高端地址做准备 mov [es:esi+0x1a],ecx shr dword [es:esi+0x1a],12 ;登记0特权级堆栈尺寸到TCB call sys_routine_seg_sel:allocate_memory add eax,ecx ;堆栈必须使用高端地址为基地址 mov [es:esi+0x1e],eax ;登记0特权级堆栈基地址到TCB mov ebx,0xffffe ;段长度(界限) mov ecx,0x00c09600 ;4KB粒度,读写,特权级0 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt ;or cx,0000_0000_0000_0000 ;设置选择子的特权级为0 mov [es:esi+0x22],cx ;登记0特权级堆栈选择子到TCB mov dword [es:esi+0x24],0 ;登记0特权级堆栈初始ESP到TCB ;创建1特权级堆栈 mov ecx,4096 mov eax,ecx ;为生成堆栈高端地址做准备 mov [es:esi+0x28],ecx shr dword [es:esi+0x28],12 ;登记1特权级堆栈尺寸到TCB call sys_routine_seg_sel:allocate_memory add eax,ecx ;堆栈必须使用高端地址为基地址 mov [es:esi+0x2c],eax ;登记1特权级堆栈基地址到TCB mov ebx,0xffffe ;段长度(界限) mov ecx,0x00c0b600 ;4KB粒度,读写,特权级1 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0001 ;设置选择子的特权级为1 mov [es:esi+0x30],cx ;登记1特权级堆栈选择子到TCB mov dword [es:esi+0x32],0 ;登记1特权级堆栈初始ESP到TCB ;创建2特权级堆栈 mov ecx,4096 mov eax,ecx ;为生成堆栈高端地址做准备 mov [es:esi+0x36],ecx shr dword [es:esi+0x36],12 ;登记2特权级堆栈尺寸到TCB call sys_routine_seg_sel:allocate_memory add eax,ecx ;堆栈必须使用高端地址为基地址 mov [es:esi+0x3a],ecx ;登记2特权级堆栈基地址到TCB mov ebx,0xffffe ;段长度(界限) mov ecx,0x00c0d600 ;4KB粒度,读写,特权级2 call sys_routine_seg_sel:make_seg_descriptor mov ebx,esi ;TCB的基地址 call fill_descriptor_in_ldt or cx,0000_0000_0000_0010 ;设置选择子的特权级为2 mov [es:esi+0x3e],cx ;登记2特权级堆栈选择子到TCB mov dword [es:esi+0x40],0 ;登记2特权级堆栈初始ESP到TCB ;在GDT中登记LDT描述符 mov eax,[es:esi+0x0c] ;LDT的起始线性地址 movzx ebx,word [es:esi+0x0a] ;LDT段界限 mov ecx,0x00408200 ;LDT描述符,特权级0 call sys_routine_seg_sel:make_seg_descriptor call sys_routine_seg_sel:set_up_gdt_descriptor mov [es:esi+0x10],cx ;登记LDT选择子到TCB中 ;创建用户程序的TSS mov ecx,104 ;tss的基本尺寸 mov [es:esi+0x12],cx dec word [es:esi+0x12] ;登记TSS界限值到TCB call sys_routine_seg_sel:allocate_memory mov [es:esi+0x14],ecx ;登记TSS基地址到TCB ;登记基本的TSS表格内容 mov word [es:ecx+0],0 ;反向链=0 mov edx,[es:esi+0x24] ;登记0特权级堆栈初始ESP mov [es:ecx+4],edx ;到TSS中 mov dx,[es:esi+0x22] ;登记0特权级堆栈段选择子 mov [es:ecx+8],dx ;到TSS中 mov edx,[es:esi+0x32] ;登记1特权级堆栈初始ESP mov [es:ecx+12],edx ;到TSS中 mov dx,[es:esi+0x30] ;登记1特权级堆栈段选择子 mov [es:ecx+16],dx ;到TSS中 mov edx,[es:esi+0x40] ;登记2特权级堆栈初始ESP mov [es:ecx+20],edx ;到TSS中 mov dx,[es:esi+0x3e] ;登记2特权级堆栈段选择子 mov [es:ecx+24],dx ;到TSS中 mov dx,[es:esi+0x10] ;登记任务的LDT选择子 mov [es:ecx+96],dx ;到TSS中 mov dx,[es:esi+0x12] ;登记任务的I/O位图偏移 mov [es:ecx+102],dx ;到TSS中 mov word [es:ecx+100],0 ;T=0 mov dword [es:ecx+28],0 ;登记CR3(PDBR) ;访问用户程序头部,获取数据填充TSS mov ebx,[ebp+11*4] ;从堆栈中取得TCB的基地址 mov edi,[es:ebx+0x06] ;用户程序加载的基地址 mov edx,[es:edi+0x10] ;登记程序入口点(EIP) mov [es:ecx+32],edx ;到TSS mov dx,[es:edi+0x14] ;登记程序代码段(CS)选择子 mov [es:ecx+76],dx ;到TSS中 mov dx,[es:edi+0x08] ;登记程序堆栈段(SS)选择子 mov [es:ecx+80],dx ;到TSS中 mov dx,[es:edi+0x04] ;登记程序数据段(DS)选择子 mov word [es:ecx+84],dx ;到TSS中。注意,它指向程序头部段 mov word [es:ecx+72],0 ;TSS中的ES=0 mov word [es:ecx+88],0 ;TSS中的FS=0 mov word [es:ecx+92],0 ;TSS中的GS=0 pushfd pop edx mov dword [es:ecx+36],edx ;EFLAGS ;在GDT中登记TSS描述符 mov eax,[es:esi+0x14] ;TSS的起始线性地址 movzx ebx,word [es:esi+0x12] ;段长度(界限) mov ecx,0x00408900 ;TSS描述符,特权级0 call sys_routine_seg_sel:make_seg_descriptor call sys_routine_seg_sel:set_up_gdt_descriptor mov [es:esi+0x18],cx ;登记TSS选择子到TCB pop es ;恢复到调用此过程前的es段 pop ds ;恢复到调用此过程前的ds段 popad ret 8 ;丢弃调用本过程前压入的参数 ;------------------------------------------------------------------------------- append_to_tcb_link: ;在TCB链上追加任务控制块 ;输入:ECX=TCB线性基地址 push eax push edx push ds push es mov eax,core_data_seg_sel ;令DS指向内核数据段 mov ds,eax mov eax,mem_0_4_gb_seg_sel ;令ES指向0..4GB段 mov es,eax mov dword [es: ecx+0x00],0 ;当前TCB指针域清零,以指示这是最 ;后一个TCB mov eax,[tcb_chain] ;TCB表头指针 or eax,eax ;链表为空? jz .notcb .searc: mov edx,eax mov eax,[es: edx+0x00] or eax,eax jnz .searc mov [es: edx+0x00],ecx jmp .retpc .notcb: mov [tcb_chain],ecx ;若为空表,直接令表头指针指向TCB .retpc: pop es pop ds pop edx pop eax ret ;------------------------------------------------------------------------------- start: mov ecx,core_data_seg_sel ;令DS指向核心数据段 mov ds,ecx mov ecx,mem_0_4_gb_seg_sel ;令ES指向4GB数据段 mov es,ecx mov ebx,message_1 call sys_routine_seg_sel:put_string ;显示处理器品牌信息 mov eax,0x80000002 cpuid mov [cpu_brand + 0x00],eax mov [cpu_brand + 0x04],ebx mov [cpu_brand + 0x08],ecx mov [cpu_brand + 0x0c],edx mov eax,0x80000003 cpuid mov [cpu_brand + 0x10],eax mov [cpu_brand + 0x14],ebx mov [cpu_brand + 0x18],ecx mov [cpu_brand + 0x1c],edx mov eax,0x80000004 cpuid mov [cpu_brand + 0x20],eax mov [cpu_brand + 0x24],ebx mov [cpu_brand + 0x28],ecx mov [cpu_brand + 0x2c],edx mov ebx,cpu_brnd0 ;显示处理器品牌信息 call sys_routine_seg_sel:put_string mov ebx,cpu_brand call sys_routine_seg_sel:put_string mov ebx,cpu_brnd1 call sys_routine_seg_sel:put_string ;以下开始安装为整个系统服务的调用门。特权级之间的控制转移必须使用门 mov edi,salt ;C-SALT表的起始位置 mov ecx,salt_items ;C-SALT表的条目数量 .b3: push ecx mov eax,[edi+256] ;该条目入口点的32位偏移地址 mov bx,[edi+260] ;该条目入口点的段选择子 mov cx,1_11_0_1100_000_00000B ;特权级3的调用门(3以上的特权级才 ;允许访问),0个参数(因为用寄存器 ;传递参数,而没有用栈) call sys_routine_seg_sel:make_gate_descriptor call sys_routine_seg_sel:set_up_gdt_descriptor mov [edi+260],cx ;将返回的门描述符选择子回填 add edi,salt_item_len ;指向下一个C-SALT条目 pop ecx loop .b3 ;对门进行测试 mov ebx,message_2 call far [salt_1+256] ;通过门显示信息(偏移量将被忽略) ;为程序管理器的TSS分配内存空间 mov ecx,104 ;为该任务的TSS分配内存 call sys_routine_seg_sel:allocate_memory mov [prgman_tss+0x00],ecx ;保存程序管理器的TSS基地址 ;在程序管理器的TSS中设置必要的项目 mov word [es:ecx+96],0 ;没有LDT。处理器允许没有LDT的任务。 mov word [es:ecx+102],103 ;没有I/O位图。0特权级事实上不需要。 mov word [es:ecx+0],0 ;反向链=0 mov dword [es:ecx+28],0 ;登记CR3(PDBR) mov word [es:ecx+100],0 ;T=0 ;不需要0、1、2特权级堆栈。0特级不 ;会向低特权级转移控制。 ;创建TSS描述符,并安装到GDT中 mov eax,ecx ;TSS的起始线性地址 mov ebx,103 ;段长度(界限) mov ecx,0x00408900 ;TSS描述符,特权级0 call sys_routine_seg_sel:make_seg_descriptor call sys_routine_seg_sel:set_up_gdt_descriptor mov [prgman_tss+0x04],cx ;保存程序管理器的TSS描述符选择子 ;任务寄存器TR中的内容是任务存在的标志,该内容也决定了当前任务是谁。 ;下面的指令为当前正在执行的0特权级任务“程序管理器”后补手续(TSS)。 ltr cx ;现在可认为“程序管理器”任务正执行中 mov ebx,prgman_msg1 call sys_routine_seg_sel:put_string ;---------------------------------ch15 ex02 start----------------------------------- ; Create Task 1 mov ebx, prgman_msg2 call sys_routine_seg_sel:put_string mov ecx,0x46 call sys_routine_seg_sel:allocate_memory call append_to_tcb_link ;将此TCB添加到TCB链中 push dword user_app_address ;用户程序位于逻辑de扇区` push ecx ;压入任务控制块起始线性地址 call load_relocate_program push ecx ; save tcb_base of task 1 ; Create Task 2 mov ebx, prgman_msg22 call sys_routine_seg_sel:put_string mov ecx,0x46 call sys_routine_seg_sel:allocate_memory call append_to_tcb_link ;将此TCB添加到TCB链中 push dword user_app_address ;用户程序位于逻辑50扇区 push ecx ;压入任务控制块起始线性地址 call load_relocate_program pop ecx ; get tcb_base of task 1 jmp far [es:ecx+0x14] ; cann't call far, becase of have lead set B=1(effect B->core) ;---------------------------------ch15 ex02 end------------------------------------- mov ebx,prgman_msg3 call sys_routine_seg_sel:put_string hlt core_code_end: ;------------------------------------------------------------------------------- SECTION core_trail ;------------------------------------------------------------------------------- core_end:
obj/main.asm
wojciech-graj/GB-Solitaire
4
171323
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.0 #12072 (Linux) ;-------------------------------------------------------- .module main .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _draw_bkg_leaderboard .globl _rand .globl _initrand .globl _font_set .globl _font_load .globl _font_init .globl _set_sprite_data .globl _set_bkg_tile_xy .globl _set_bkg_tiles .globl _set_bkg_data .globl _wait_vbl_done .globl _joypad .globl _cursor .globl _dynamic_metasprite .globl _selected_leaderboard .globl _score .globl _num_folded_piles .globl _settings .globl _scroll .globl _flags .globl _top_card_idx .globl _piles .globl _deck .globl _setting_pile_heights .globl _menu_card_tiles .globl _animation_speeds .globl _clear_bkg_2x1 .globl _draw_card_top .globl _draw_card_bottom .globl _draw_card .globl _draw_sequential_card .globl _clear_bkg .globl _draw_bkg_game .globl _draw_bkg_splash_screen .globl _draw_bkg_settings .globl _metasprite_2x3_hide .globl _set_metasprite_card .globl _draw_setting_frame_metasprites .globl _dynamic_metasprite_end_animation .globl _dynamic_metasprite_splash_screen_callback .globl _dynamic_metasprite_splash_screen .globl _dynamic_metasprite_fold_pile .globl _dynamic_metasprite_unfold_callback .globl _dynamic_metasprite_move_stack_callback .globl _dynamic_metasprite_fold_callback .globl _dynamic_metasprite_fold .globl _dynamic_metasprite_deal_callback .globl _dynamic_metasprite_deal .globl _dynamic_metasprite_process .globl _cursor_adjust_height .globl _cursor_grab_stack .globl _cursor_place_stack .globl _set_cursor_setting .globl _change_cursor_height .globl _cursor_process .globl _init_deck .globl _is_stack_coherent .globl _deal .globl _pile_append_cursor_stack .globl _start_game .globl _start_settings .globl _start_splash_screen .globl _start_leaderboard .globl _add_leaderboard .globl _nvram_check .globl _inc_letter .globl _input_process .globl _main ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA _deck:: .ds 312 _piles:: .ds 50 _top_card_idx:: .ds 1 _flags:: .ds 1 _scroll:: .ds 1 _settings:: .ds 1 _num_folded_piles:: .ds 1 _score:: .ds 2 _selected_leaderboard:: .ds 2 _dynamic_metasprite:: .ds 21 _cursor:: .ds 10 _input_process_prev_input_65536_387: .ds 1 _main_prev_input_327681_450: .ds 1 ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;src/main.c:1163: static UINT8 prev_input = 0; ld hl, #_input_process_prev_input_65536_387 ld (hl), #0x00 ;src/main.c:1163: static UINT8 prev_input = 0; ld hl, #_main_prev_input_327681_450 ld (hl), #0x00 ;src/main.c:172: UINT8 flags = 0; ld hl, #_flags ld (hl), #0x00 ;src/main.c:173: UINT8 scroll = 0; ld hl, #_scroll ld (hl), #0x00 ;src/main.c:174: UINT8 settings = SETTING_ONE_SUIT | BITMASK_SETTING_MUSIC; ld hl, #_settings ld (hl), #0x10 ;src/main.c:175: UINT8 num_folded_piles = 0; ld hl, #_num_folded_piles ld (hl), #0x00 ;src/main.c:176: UINT16 score = START_SCORE; ld hl, #_score ld (hl), #0xf4 inc hl ld (hl), #0x01 ;src/main.c:177: LeaderBoard *selected_leaderboard = NULL; ld hl, #_selected_leaderboard ld (hl), #0x00 inc hl ld (hl), #0x00 ;src/main.c:179: struct DynamicMetaSprite dynamic_metasprite = { ld hl, #(_dynamic_metasprite + 0x0008) ld (hl), #0xff ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:184: struct Cursor cursor = { ld hl, #_cursor xor a, a ld (hl+), a ld (hl), a ld hl, #(_cursor + 0x0002) xor a, a ld (hl+), a ld (hl), a ld hl, #(_cursor + 0x0005) ld (hl), #0x00 ld hl, #(_cursor + 0x0006) ld (hl), #0x0a ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ld hl, #(_cursor + 0x0008) ld (hl), #0x00 ld hl, #(_cursor + 0x0009) ld (hl), #0x00 ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE ;src/main.c:348: inline void clear_bkg_2x1(const UINT8 x, const UINT8 y) ; --------------------------------- ; Function clear_bkg_2x1 ; --------------------------------- _clear_bkg_2x1:: ;src/main.c:350: set_bkg_tile_xy(x, y, OFFSET_BKG_NONE); xor a, a push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:351: set_bkg_tile_xy(x + 1u, y, OFFSET_BKG_NONE); ldhl sp, #2 ld a, (hl) inc a ld h, #0x00 push hl inc sp ldhl sp, #4 ld h, (hl) push hl inc sp push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:352: } ret _animation_speeds: .db #0x10 ; 16 .db #0x20 ; 32 .db #0x08 ; 8 .db #0x10 ; 16 .db #0x04 ; 4 .db #0x08 ; 8 _menu_card_tiles: .db #0xc1 ; 193 .db #0xbd ; 189 .db #0x28 ; 40 .db #0x29 ; 41 .db #0xc5 ; 197 .db #0xc6 ; 198 .db #0xc1 ; 193 .db #0xbd ; 189 .db #0x2a ; 42 .db #0x2b ; 43 .db #0xdc ; 220 .db #0xc6 ; 198 .db #0x26 ; 38 .db #0xbd ; 189 .db #0x2c ; 44 .db #0x2d ; 45 .db #0xdc ; 220 .db #0x27 ; 39 .db #0x2e ; 46 .db #0x2f ; 47 .db #0x30 ; 48 '0' .db #0x31 ; 49 '1' .db #0x32 ; 50 '2' .db #0x33 ; 51 '3' .db #0x2e ; 46 .db #0x34 ; 52 '4' .db #0x30 ; 48 '0' .db #0x35 ; 53 '5' .db #0x32 ; 50 '2' .db #0x36 ; 54 '6' .db #0xc1 ; 193 .db #0xc2 ; 194 .db #0x37 ; 55 '7' .db #0x38 ; 56 '8' .db #0xc5 ; 197 .db #0xc6 ; 198 .db #0xc1 ; 193 .db #0xc2 ; 194 .db #0x39 ; 57 '9' .db #0x3a ; 58 .db #0xc5 ; 197 .db #0xc6 ; 198 .db #0xc1 ; 193 .db #0xc2 ; 194 .db #0x3b ; 59 .db #0x3c ; 60 .db #0xc5 ; 197 .db #0xc6 ; 198 _setting_pile_heights: .db #0x03 ; 3 .db #0x02 ; 2 .db #0x03 ; 3 .db #0x01 ; 1 ;src/main.c:354: void draw_card_top(const UINT8 x, const UINT8 y, const UINT8 card_data) ; --------------------------------- ; Function draw_card_top ; --------------------------------- _draw_card_top:: ;src/main.c:356: if (VISIBLE(card_data)) { ldhl sp, #4 ;src/main.c:358: set_bkg_tile_xy(x + 1u, y, SUIT(card_data) + OFFSET_BKG_CARD + OFFSET_CARD_SUIT); ld a, (hl-) ld c, a dec hl ld b, (hl) inc b ;src/main.c:356: if (VISIBLE(card_data)) { bit 6, c jr Z, 00102$ ;src/main.c:357: set_bkg_tile_xy(x, y, RANK(card_data) + OFFSET_BKG_CARD + OFFSET_CARD_RANK); ld a, c and a, #0x0f add a, #0xb0 push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:358: set_bkg_tile_xy(x + 1u, y, SUIT(card_data) + OFFSET_BKG_CARD + OFFSET_CARD_SUIT); ld a, c ld c, #0x00 and a, #0x30 ld e, a ld d, #0x00 srl d rr e srl d rr e srl d rr e srl d rr e ld a, e add a, #0xbd push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp push bc inc sp call _set_bkg_tile_xy add sp, #3 ret 00102$: ;src/main.c:360: set_bkg_tile_xy(x, y, OFFSET_BKG_CARD + OFFSET_CARD_BACK); ld a, #0xc7 push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:361: set_bkg_tile_xy(x + 1u, y, OFFSET_BKG_CARD + OFFSET_CARD_BACK + 1u); ld a, #0xc8 push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp push bc inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:363: } ret ;src/main.c:365: void draw_card_bottom(const UINT8 x, const UINT8 y, const UINT8 card_data) ; --------------------------------- ; Function draw_card_bottom ; --------------------------------- _draw_card_bottom:: ;src/main.c:367: set_bkg_tile_xy(x, y, OFFSET_BKG_CARD + OFFSET_CARD_BLANK + 2u); ld a, #0xc3 push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:368: set_bkg_tile_xy(x + 1u, y, OFFSET_BKG_CARD + OFFSET_CARD_BLANK + 3u); ldhl sp, #2 ld c, (hl) inc c ld a, #0xc4 push af inc sp inc hl ld b, (hl) push bc call _set_bkg_tile_xy add sp, #3 ;src/main.c:369: set_bkg_tile_xy(x, y+ 1u, SUIT(card_data) + OFFSET_BKG_CARD + OFFSET_CARD_SUIT_ROT); ldhl sp, #4 ld a, (hl) and a, #0x30 ld e, a ld d, #0x00 srl d rr e srl d rr e srl d rr e srl d rr e ld a, e add a, #0xda dec hl ld b, (hl) inc b push af inc sp push bc inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:370: set_bkg_tile_xy(x + 1u, y+ 1u, RANK(card_data) + OFFSET_BKG_CARD + OFFSET_CARD_RANK_ROT); ldhl sp, #4 ld a, (hl) and a, #0x0f add a, #0xcd push af inc sp push bc call _set_bkg_tile_xy add sp, #3 ;src/main.c:371: } ret ;src/main.c:373: inline void draw_card(const UINT8 x, const UINT8 y, const UINT8 card_data) ; --------------------------------- ; Function draw_card ; --------------------------------- _draw_card:: ;src/main.c:375: draw_card_top(x, y, card_data); ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _draw_card_top add sp, #3 ;src/main.c:376: draw_card_bottom(x, y + 1u, card_data); ldhl sp, #3 ld a, (hl) inc a inc hl ld h, (hl) push hl inc sp push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp call _draw_card_bottom add sp, #3 ;src/main.c:377: } ret ;src/main.c:379: void draw_sequential_card(const UINT8 x, const UINT8 y, const UINT8 bkg_offset) ; --------------------------------- ; Function draw_sequential_card ; --------------------------------- _draw_sequential_card:: ;src/main.c:381: set_bkg_tile_xy(x, y, bkg_offset); ldhl sp, #4 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:382: set_bkg_tile_xy(x + 1u, y, bkg_offset + 1u); ldhl sp, #4 ld a, (hl) inc a dec hl dec hl ld c, (hl) inc c push af inc sp inc hl ld b, (hl) push bc call _set_bkg_tile_xy add sp, #3 ;src/main.c:383: set_bkg_tile_xy(x, y + 1u, bkg_offset + 2u); ldhl sp, #4 ld a, (hl) inc a inc a dec hl ld b, (hl) inc b push af inc sp push bc inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:384: set_bkg_tile_xy(x + 1u, y + 1u, bkg_offset + 3u); ldhl sp, #4 ld a, (hl) inc a inc a inc a push af inc sp push bc inc sp ld a, c push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:385: set_bkg_tile_xy(x, y + 2u, bkg_offset + 4u); ldhl sp, #4 ld a, (hl) inc a inc a inc a inc a dec hl ld b, (hl) inc b inc b push af inc sp push bc inc sp dec hl ld a, (hl) push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:386: set_bkg_tile_xy(x + 1u, y + 2u, bkg_offset + 5u); ldhl sp, #4 ld a, (hl) add a, #0x05 push af inc sp push bc call _set_bkg_tile_xy add sp, #3 ;src/main.c:387: } ret ;src/main.c:390: void clear_bkg(void) ; --------------------------------- ; Function clear_bkg ; --------------------------------- _clear_bkg:: ;src/main.c:393: for (x = 0; x < 32u; x++) ld c, #0x00 ;src/main.c:394: for (y = 0; y < 32u; y++) 00109$: ld b, #0x00 00103$: ;src/main.c:395: set_bkg_tile_xy(x, y, 0); xor a, a push af inc sp push bc inc sp ld a, c push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:394: for (y = 0; y < 32u; y++) inc b ld a, b sub a, #0x20 jr C, 00103$ ;src/main.c:393: for (x = 0; x < 32u; x++) inc c ld a, c sub a, #0x20 jr C, 00109$ ;src/main.c:396: } ret ;src/main.c:398: void draw_bkg_game(void) ; --------------------------------- ; Function draw_bkg_game ; --------------------------------- _draw_bkg_game:: add sp, #-7 ;src/main.c:401: Pile *pile = IDX_PTR(piles, 0); ld bc, #_piles+0 ;src/main.c:402: for (x = 0; x < 20u; x += 2) { xor a, a ldhl sp, #0 ld (hl), a 00106$: ;src/main.c:403: Card *card = pile->base; ld e, c ld d, b ld a, (de) ldhl sp, #5 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:405: while (card->next_card) { ldhl sp, #1 ld (hl), #0x03 00101$: ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ldhl sp, #2 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:406: draw_card_top(x, y, card->data); ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) inc de inc de ;src/main.c:407: y++; ldhl sp, #1 ld a, (hl) inc a ldhl sp, #4 ld (hl), a ;src/main.c:406: draw_card_top(x, y, card->data); ld a, (de) ld d, a ;src/main.c:405: while (card->next_card) { dec hl ld a, (hl-) or a, (hl) jr Z, 00103$ ;src/main.c:406: draw_card_top(x, y, card->data); push bc push de inc sp dec hl ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _draw_card_top add sp, #3 pop bc ;src/main.c:407: y++; ldhl sp, #4 ld a, (hl) ldhl sp, #1 ld (hl), a ;src/main.c:408: card = card->next_card; ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) dec hl ld (hl+), a inc de ld a, (de) ld (hl), a jr 00101$ 00103$: ;src/main.c:410: draw_card(x, y, card->data); ;src/main.c:375: draw_card_top(x, y, card_data); push bc push de push de inc sp ldhl sp, #6 ld a, (hl) push af inc sp dec hl ld a, (hl) push af inc sp call _draw_card_top add sp, #3 inc sp ldhl sp, #7 ld a, (hl) push af inc sp ldhl sp, #4 ld a, (hl) push af inc sp call _draw_card_bottom add sp, #3 pop bc ;src/main.c:411: pile++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:402: for (x = 0; x < 20u; x += 2) { ldhl sp, #0 ld a, (hl) add a, #0x02 ld (hl), a sub a, #0x14 jp C, 00106$ ;src/main.c:413: draw_sequential_card(0, 0, OFFSET_BKG_CARD + OFFSET_CARD_BACK); ld a, #0xc7 push af inc sp xor a, a push af inc sp xor a, a push af inc sp call _draw_sequential_card add sp, #3 ;src/main.c:414: } add sp, #7 ret ;src/main.c:416: void draw_bkg_splash_screen(void) ; --------------------------------- ; Function draw_bkg_splash_screen ; --------------------------------- _draw_bkg_splash_screen:: ;src/main.c:418: set_bkg_tile_xy(2u, 9u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_SYMBOL); ld de, #0x3d09 push de ld a, #0x02 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:419: set_bkg_tile_xy(3u, 9u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_START); ld de, #0x3e09 push de ld a, #0x03 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:420: set_bkg_tile_xy(4u, 9u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_START + 1u); ld de, #0x3f09 push de ld a, #0x04 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:421: set_bkg_tile_xy(5u, 9u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_START + 2u); ld de, #0x4009 push de ld a, #0x05 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:422: set_bkg_tiles(7u, 9u, START_TEXT_LEN, 1u, start_text); ld hl, #_start_text push hl ld de, #0x0105 push de ld de, #0x0907 push de call _set_bkg_tiles add sp, #6 ;src/main.c:424: set_bkg_tile_xy(2u, 10u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_SYMBOL); ld de, #0x3d0a push de ld a, #0x02 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:425: set_bkg_tile_xy(3u, 10u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_SELECT); ld de, #0x410a push de ld a, #0x03 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:426: set_bkg_tile_xy(4u, 10u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_SELECT + 1u); ld de, #0x420a push de ld a, #0x04 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:427: set_bkg_tile_xy(5u, 10u, OFFSET_BKG_BUTTON + OFFSET_BUTTON_SELECT + 2u); ld de, #0x430a push de ld a, #0x05 push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:428: set_bkg_tiles(7u, 10u, LEADERBOARD_TEXT_LEN, 1u, leaderboard_text); ld hl, #_leaderboard_text push hl ld de, #0x010b push de ld de, #0x0a07 push de call _set_bkg_tiles add sp, #6 ;src/main.c:430: set_bkg_tiles(0, 15u, COPYRIGHT_TEXT_LEN, 1u, copyright_text); ld hl, #_copyright_text push hl ld de, #0x0114 push de ld a, #0x0f push af inc sp xor a, a push af inc sp call _set_bkg_tiles add sp, #6 ;src/main.c:431: } ret ;src/main.c:433: void draw_bkg_settings(void) ; --------------------------------- ; Function draw_bkg_settings ; --------------------------------- _draw_bkg_settings:: ;src/main.c:435: set_bkg_tiles(SETTINGS_SPLIT_X - SUITS_TEXT_LEN, SETTINGS_PAD_Y + 1u, SUITS_TEXT_LEN, 1u, suits_text); ld hl, #_suits_text push hl ld de, #0x0105 push de ld de, #0x0205 push de call _set_bkg_tiles add sp, #6 ;src/main.c:436: set_bkg_tiles(SETTINGS_SPLIT_X, SETTINGS_PAD_Y, 2u, 3u, menu_card_tiles[MENU_CARD_ONE_SUIT]); ld hl, #_menu_card_tiles push hl ld de, #0x0302 push de ld de, #0x010a push de call _set_bkg_tiles add sp, #6 ;src/main.c:437: set_bkg_tiles(SETTINGS_SPLIT_X + 2u, SETTINGS_PAD_Y, 2u, 3u, menu_card_tiles[MENU_CARD_TWO_SUIT]); ld hl, #(_menu_card_tiles + 0x0006) push hl ld de, #0x0302 push de ld de, #0x010c push de call _set_bkg_tiles add sp, #6 ;src/main.c:438: set_bkg_tiles(SETTINGS_SPLIT_X + 4u, SETTINGS_PAD_Y, 2u, 3u, menu_card_tiles[MENU_CARD_FOUR_SUIT]); ld hl, #(_menu_card_tiles + 0x000c) push hl ld de, #0x0302 push de ld de, #0x010e push de call _set_bkg_tiles add sp, #6 ;src/main.c:440: set_bkg_tiles(SETTINGS_SPLIT_X - MUSIC_TEXT_LEN, SETTINGS_PAD_Y + 5u, MUSIC_TEXT_LEN, 1u, music_text); ld hl, #_music_text push hl ld de, #0x0105 push de ld de, #0x0605 push de call _set_bkg_tiles add sp, #6 ;src/main.c:441: set_bkg_tiles(SETTINGS_SPLIT_X, SETTINGS_PAD_Y + 4u, 2u, 3u, menu_card_tiles[MENU_CARD_MUSIC]); ld hl, #(_menu_card_tiles + 0x0012) push hl ld de, #0x0302 push de ld de, #0x050a push de call _set_bkg_tiles add sp, #6 ;src/main.c:442: set_bkg_tiles(SETTINGS_SPLIT_X + 2u, SETTINGS_PAD_Y + 4u, 2u, 3u, menu_card_tiles[MENU_CARD_NO_MUSIC]); ld hl, #(_menu_card_tiles + 0x0018) push hl ld de, #0x0302 push de ld de, #0x050c push de call _set_bkg_tiles add sp, #6 ;src/main.c:444: set_bkg_tiles(SETTINGS_SPLIT_X - SPEED_TEXT_LEN, SETTINGS_PAD_Y + 9u, SPEED_TEXT_LEN, 1u, speed_text); ld hl, #_speed_text push hl ld de, #0x0105 push de ld de, #0x0a05 push de call _set_bkg_tiles add sp, #6 ;src/main.c:445: set_bkg_tiles(SETTINGS_SPLIT_X, SETTINGS_PAD_Y + 8u, 2u, 3u, menu_card_tiles[MENU_CARD_ANIMATION_SLOW]); ld hl, #(_menu_card_tiles + 0x001e) push hl ld de, #0x0302 push de ld de, #0x090a push de call _set_bkg_tiles add sp, #6 ;src/main.c:446: set_bkg_tiles(SETTINGS_SPLIT_X + 2u, SETTINGS_PAD_Y + 8u, 2u, 3u, menu_card_tiles[MENU_CARD_ANIMATION_MEDIUM]); ld hl, #(_menu_card_tiles + 0x0024) push hl ld de, #0x0302 push de ld de, #0x090c push de call _set_bkg_tiles add sp, #6 ;src/main.c:447: set_bkg_tiles(SETTINGS_SPLIT_X + 4u, SETTINGS_PAD_Y + 8u, 2u, 3u, menu_card_tiles[MENU_CARD_ANIMATION_FAST]); ld hl, #(_menu_card_tiles + 0x002a) push hl ld de, #0x0302 push de ld de, #0x090e push de call _set_bkg_tiles add sp, #6 ;src/main.c:449: set_bkg_tiles(SETTINGS_SPLIT_X - START_TEXT_LEN, SETTINGS_PAD_Y + 13u, START_TEXT_LEN, 1u, start_text); ld hl, #_start_text push hl ld de, #0x0105 push de ld de, #0x0e05 push de call _set_bkg_tiles add sp, #6 ;src/main.c:450: draw_sequential_card(SETTINGS_SPLIT_X, SETTINGS_PAD_Y + 12u, OFFSET_BKG_CARD + OFFSET_CARD_BACK); ld de, #0xc70d push de ld a, #0x0a push af inc sp call _draw_sequential_card add sp, #3 ;src/main.c:451: } ret ;src/main.c:464: void draw_bkg_leaderboard(void) ; --------------------------------- ; Function draw_bkg_leaderboard ; --------------------------------- _draw_bkg_leaderboard:: add sp, #-13 ;src/main.c:466: set_bkg_tiles(4u, 1u, LEADERBOARD_TEXT_LEN, 1u, leaderboard_text); ld hl, #_leaderboard_text push hl ld de, #0x010b push de ld de, #0x0104 push de call _set_bkg_tiles add sp, #6 ;src/main.c:468: set_bkg_tiles(LEADERBOARD_CARD_X, LEADERBOARD_PAD_Y, 2u, 3u, menu_card_tiles[MENU_CARD_ONE_SUIT]); ld hl, #_menu_card_tiles push hl ld de, #0x0302 push de ld de, #0x0404 push de call _set_bkg_tiles add sp, #6 ;src/main.c:469: set_bkg_tiles(LEADERBOARD_CARD_X, LEADERBOARD_PAD_Y + 4u, 2u, 3u, menu_card_tiles[MENU_CARD_TWO_SUIT]); ld hl, #(_menu_card_tiles + 0x0006) push hl ld de, #0x0302 push de ld de, #0x0804 push de call _set_bkg_tiles add sp, #6 ;src/main.c:470: set_bkg_tiles(LEADERBOARD_CARD_X, LEADERBOARD_PAD_Y + 8u, 2u, 3u, menu_card_tiles[MENU_CARD_FOUR_SUIT]); ld hl, #(_menu_card_tiles + 0x000c) push hl ld de, #0x0302 push de ld de, #0x0c04 push de call _set_bkg_tiles add sp, #6 ;src/main.c:472: LeaderBoard *iter = IDX_PTR(leaderboard[0], 0); ld bc, #_leaderboard+0 ;src/main.c:474: for (i = 0; i < 3; i++) { xor a, a ldhl sp, #11 ld (hl), a ;src/main.c:475: for (j = 0; j < 3; j++) { 00110$: ldhl sp, #11 ld a, (hl) add a, a add a, a add a, #0x04 ldhl sp, #3 ld (hl), a xor a, a ldhl sp, #12 ld (hl), a 00104$: ;src/main.c:476: UINT8 y = LEADERBOARD_PAD_Y + i * 4u + j; ldhl sp, #3 ld a, (hl) ldhl sp, #12 add a, (hl) ldhl sp, #4 ld (hl), a ;src/main.c:477: set_bkg_tiles(LEADERBOARD_NAME_X, y, 3u, 1u, iter->name); push bc ld de, #0x0103 push de ld d, (hl) ld e,#0x08 push de call _set_bkg_tiles add sp, #6 ;src/main.c:478: draw_bkg_leaderboard_score(LEADERBOARD_SCORE_X, y, iter->score); ld l, c ld h, b inc hl inc hl inc hl ld e, l ld d, h ld a, (de) ldhl sp, #5 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:455: UINT8 score_tiles[3] = { ldhl sp, #0 ld a, l ld d, h ldhl sp, #7 ld (hl+), a ld (hl), d push bc ld hl, #0x0064 push hl ldhl sp, #9 ld a, (hl+) ld h, (hl) ld l, a push hl call __divuint add sp, #4 pop bc ld a, e inc a ldhl sp, #7 push af ld a, (hl+) ld h, (hl) ld l, a pop af ld (hl), a ;c ldhl sp,#7 ld a, (hl+) ld e, a ld d, (hl) ld l, e ld h, d inc hl push hl ld a, l ldhl sp, #11 ld (hl), a pop hl ld a, h ldhl sp, #10 ld (hl), a push bc ld hl, #0x0064 push hl ldhl sp, #9 ld a, (hl+) ld h, (hl) ld l, a push hl call __moduint add sp, #4 ld hl, #0x000a push hl push de call __divuint add sp, #4 pop bc ld a, e inc a ldhl sp, #9 push af ld a, (hl+) ld h, (hl) ld l, a pop af ld (hl), a ldhl sp,#7 ld a, (hl+) ld e, a ld d, (hl) inc de inc de push bc push de ld hl, #0x000a push hl ldhl sp, #11 ld a, (hl+) ld h, (hl) ld l, a push hl call __moduint add sp, #4 push hl ldhl sp, #15 ld (hl), e ldhl sp, #16 ld (hl), d pop hl pop de pop bc ldhl sp, #9 ld a, (hl) inc a ld (de), a ;src/main.c:460: set_bkg_tiles(x, y, 3u, 1u, score_tiles); dec hl dec hl ld a, (hl+) ld e, a ld d, (hl) push de ld de, #0x0103 push de ldhl sp, #8 ld d, (hl) ld e,#0x0c push de call _set_bkg_tiles add sp, #6 ;src/main.c:479: iter++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:475: for (j = 0; j < 3; j++) { ldhl sp, #12 inc (hl) ld a, (hl) sub a, #0x03 jp C, 00104$ ;src/main.c:474: for (i = 0; i < 3; i++) { dec hl inc (hl) ld a, (hl) sub a, #0x03 jp C, 00110$ ;src/main.c:482: } add sp, #13 ret ;src/main.c:488: void metasprite_2x3_hide(const UINT8 sprite) ; --------------------------------- ; Function metasprite_2x3_hide ; --------------------------------- _metasprite_2x3_hide:: ;src/main.c:495: ); ldhl sp, #2 ld b, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_same_2x3) inc hl ld (hl), #>(_metasprite_same_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x00 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); xor a, a push af inc sp xor a, a push af inc sp push bc inc sp call ___move_metasprite add sp, #3 ;src/main.c:495: ); ;src/main.c:496: } ret ;src/main.c:498: void set_metasprite_card(const UINT8 card_data) ; --------------------------------- ; Function set_metasprite_card ; --------------------------------- _set_metasprite_card:: ;src/main.c:500: metasprite_t *iter = IDX_PTR(metasprite_custom_2x3, 0); ;src/main.c:501: (iter++)->dtile = OFFSET_CARD_RANK + RANK(card_data); ldhl sp, #2 ld b, (hl) ld a, b and a, #0x0f ld c, a ld hl, #(_metasprite_custom_2x3 + 0x0002) ld (hl), c ;src/main.c:502: (iter++)->dtile = OFFSET_CARD_SUIT + SUIT(card_data); ld de, #(_metasprite_custom_2x3 + 0x0004) + 2 ld a, b and a, #0x30 ld l, a ld h, #0x00 srl h rr l srl h rr l srl h rr l srl h rr l ld b, l ld a, b add a, #0x0d ld (de), a ;src/main.c:503: (iter++)->dtile = OFFSET_CARD_BLANK + 2u; ld hl, #(_metasprite_custom_2x3 + 0x000a) ld (hl), #0x13 ;src/main.c:504: (iter++)->dtile = OFFSET_CARD_BLANK + 3u; ld hl, #(_metasprite_custom_2x3 + 0x000e) ld (hl), #0x14 ;src/main.c:505: (iter++)->dtile = OFFSET_CARD_SUIT_ROT + SUIT(card_data); ld de, #(_metasprite_custom_2x3 + 0x0010) + 2 ld a, b add a, #0x2a ld (de), a ;src/main.c:506: (iter++)->dtile = OFFSET_CARD_RANK_ROT + RANK(card_data); ld de, #(_metasprite_custom_2x3 + 0x0014) + 2 ld a, c add a, #0x1d ld (de), a ;src/main.c:507: } ret ;src/main.c:509: void draw_setting_frame_metasprites(void) ; --------------------------------- ; Function draw_setting_frame_metasprites ; --------------------------------- _draw_setting_frame_metasprites:: ;src/main.c:514: NUM_SUITS(settings) * 16u + SETTINGS_SPLIT_X * 8u, ld a, (#_settings) and a, #0x03 swap a and a, #0xf0 add a, #0x50 ld b, a ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0xe4 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld a, #0x08 push af inc sp ld c, #0x12 push bc call ___move_metasprite add sp, #3 ;src/main.c:520: !MUSIC(settings) * 16u + SETTINGS_SPLIT_X * 8u, ld a, (#_settings) and a, #0x10 or a,#0x00 sub a,#0x01 ld a, #0x00 rla swap a and a, #0xf0 add a, #0x50 ld b, a ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0xe4 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld a, #0x28 push af inc sp ld c, #0x18 push bc call ___move_metasprite add sp, #3 ;src/main.c:526: ANIMATION_SPEED(settings) * 16u + SETTINGS_SPLIT_X * 8u, ld a, (#_settings) and a, #0x0c ld c, a ld b, #0x00 srl b rr c srl b rr c ld a, c swap a and a, #0xf0 add a, #0x50 ld b, a ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0xe4 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld a, #0x48 push af inc sp ld c, #0x1e push bc call ___move_metasprite add sp, #3 ;src/main.c:528: ); ;src/main.c:529: } ret ;src/main.c:544: void dynamic_metasprite_end_animation(void) ; --------------------------------- ; Function dynamic_metasprite_end_animation ; --------------------------------- _dynamic_metasprite_end_animation:: ;src/main.c:546: metasprite_2x3_hide(SPRITE_DYNAMIC); xor a, a push af inc sp call _metasprite_2x3_hide inc sp ;src/main.c:547: flags &= ~FLAG_PLAYING_ANIMATION; ld hl, #_flags ld a, (hl) and a, #0xfb ld (hl), a ;src/main.c:548: dynamic_metasprite.target_frames = -1; ld hl, #(_dynamic_metasprite + 0x0008) ld (hl), #0xff ;src/main.c:549: } ret ;src/main.c:551: void dynamic_metasprite_splash_screen_callback(void) ; --------------------------------- ; Function dynamic_metasprite_splash_screen_callback ; --------------------------------- _dynamic_metasprite_splash_screen_callback:: add sp, #-14 ;src/main.c:553: const UINT8 offsets[] = { ldhl sp, #0 ld c, l ld b, h xor a, a ld (bc), a ld l, c ld h, b inc hl ld (hl), #0x06 ld l, c ld h, b inc hl inc hl ld (hl), #0x0c ld l, c ld h, b inc hl inc hl inc hl ld (hl), #0x12 ld hl, #0x0004 add hl, bc ld (hl), #0x18 ld hl, #0x0005 add hl, bc ld (hl), #0x1e ld hl, #0x0006 add hl, bc ld (hl), #0x12 ld hl, #0x0007 add hl, bc ld (hl), #0x24 ld hl, #0x0008 add hl, bc ld (hl), #0x2a ;src/main.c:564: draw_sequential_card(1u + dynamic_metasprite.data[0] * 2u, 2u, OFFSET_BKG_TITLE + offsets[dynamic_metasprite.data[0]]); ld hl, #(_dynamic_metasprite + 0x000d) ld l, (hl) ld a, c add a, l ld e, a ld a, b adc a, #0x00 ld d, a ld a, (de) add a, #0x80 add hl, hl inc l push bc ld d,a ld e,#0x02 push de ld a, l push af inc sp call _draw_sequential_card add sp, #3 pop bc ;src/main.c:565: if (dynamic_metasprite.data[0] == 8u) { ld a, (#(_dynamic_metasprite + 0x000d) + 0) cp a, #0x08 jr NZ, 00102$ ;src/main.c:566: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation ;src/main.c:567: return; jr 00103$ 00102$: ;src/main.c:569: dynamic_metasprite.data[0]++; inc a ldhl sp, #9 ld (hl), a ld de, #(_dynamic_metasprite + 0x000d) ld a, (hl) ld (de), a ;src/main.c:570: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:571: dynamic_metasprite.dist[0] += 16; ld de, #(_dynamic_metasprite + 0x0004) ld a, (de) ldhl sp, #10 ld (hl+), a inc de ld a, (de) ;c ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0010 add hl, de push hl ld a, l ldhl sp, #14 ld (hl), a pop hl ld a, h ldhl sp, #13 ld (hl), a ld de, #(_dynamic_metasprite + 0x0004) dec hl ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a ;src/main.c:572: dynamic_metasprite.metasprite_offset = OFFSET_SPRITE_TITLE + offsets[dynamic_metasprite.data[0]]; ldhl sp, #9 ld l, (hl) ld h, #0x00 add hl, bc ld c, l ld b, h ld a, (bc) add a, #0x80 ld (#(_dynamic_metasprite + 0x000c)),a 00103$: ;src/main.c:573: } add sp, #14 ret ;src/main.c:575: inline void dynamic_metasprite_splash_screen(void) ; --------------------------------- ; Function dynamic_metasprite_splash_screen ; --------------------------------- _dynamic_metasprite_splash_screen:: ;src/main.c:577: dynamic_metasprite.src[0] = 72; ld hl, #_dynamic_metasprite ld (hl), #0x48 inc hl ld (hl), #0x00 ;src/main.c:578: dynamic_metasprite.src[1] = -24; ld hl, #(_dynamic_metasprite + 0x0002) ld (hl), #0xe8 inc hl ld (hl), #0xff ;src/main.c:579: dynamic_metasprite.dist[0] = -64; ld hl, #(_dynamic_metasprite + 0x0004) ld (hl), #0xc0 inc hl ld (hl), #0xff ;src/main.c:580: dynamic_metasprite.dist[1] = 40; ld hl, #(_dynamic_metasprite + 0x0006) ld (hl), #0x28 inc hl ld (hl), #0x00 ;src/main.c:581: dynamic_metasprite.target_frames = TARGET_FRAMES_SPLASH_SCREEN; ld hl, #(_dynamic_metasprite + 0x0008) ld (hl), #0x20 ;src/main.c:582: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:583: dynamic_metasprite.metasprite = metasprite_sequential_2x3; ld hl, #(_dynamic_metasprite + 0x000a) ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;src/main.c:584: dynamic_metasprite.metasprite_offset = OFFSET_SPRITE_TITLE + OFFSET_TITLE_S; ld hl, #(_dynamic_metasprite + 0x000c) ld (hl), #0x80 ;src/main.c:585: dynamic_metasprite.data[0] = 0; ld hl, #(_dynamic_metasprite + 0x000d) ld (hl), #0x00 ;src/main.c:586: dynamic_metasprite.callback = &dynamic_metasprite_splash_screen_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_splash_screen_callback) inc hl ld (hl), #>(_dynamic_metasprite_splash_screen_callback) ;src/main.c:587: flags |= FLAG_PLAYING_ANIMATION; ld hl, #_flags ld a, (hl) or a, #0x04 ld (hl), a ;src/main.c:588: } ret ;src/main.c:590: void dynamic_metasprite_fold_pile(void) ; --------------------------------- ; Function dynamic_metasprite_fold_pile ; --------------------------------- _dynamic_metasprite_fold_pile:: add sp, #-6 ;src/main.c:592: UINT8 pile_idx = dynamic_metasprite.data[3] & 0xF; ld a, (#(_dynamic_metasprite + 0x0010) + 0) and a, #0x0f ;src/main.c:593: if (!pile_idx) { ld c, a or a, a jr NZ, 00104$ ;src/main.c:594: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation ;src/main.c:595: if (num_folded_piles == 8u) {//NOTE: THIS IS WHERE GAME ENDS ld a, (#_num_folded_piles) sub a, #0x08 jp NZ,00106$ ;src/main.c:596: metasprite_2x3_hide(SPRITE_FRAME); ld a, #0x0c push af inc sp call _metasprite_2x3_hide inc sp ;/home/wojtek/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y; ld a, #0x00 ldh (_SCX_REG+0),a ld a, #0x00 ldh (_SCY_REG+0),a ;src/main.c:598: scroll = 0u; ld hl, #_scroll ld (hl), #0x00 ;src/main.c:599: add_leaderboard(); call _add_leaderboard ;src/main.c:600: start_leaderboard(); call _start_leaderboard ;src/main.c:601: score = START_SCORE; ld hl, #_score ld a, #0xf4 ld (hl+), a ld (hl), #0x01 ;src/main.c:603: return; jr 00106$ 00104$: ;src/main.c:606: num_folded_piles++; ld hl, #_num_folded_piles inc (hl) ;src/main.c:608: Pile *pile = IDX_PTR(piles, pile_idx); ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld a, #<(_piles) add a, l ld b, a ld a, #>(_piles) adc a, h ldhl sp, #0 ld (hl), b inc hl ld (hl), a ;src/main.c:609: UINT8 x = pile_idx * 16u; ld a, c swap a and a, #0xf0 inc hl ld (hl), a ;src/main.c:618: dynamic_metasprite.data[3] >> 4u ld a, (#(_dynamic_metasprite + 0x0010) + 0) swap a and a, #0x0f inc hl ld (hl), a ;src/main.c:616: pile->base, pop de push de ld a, (de) inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:610: dynamic_metasprite_fold(pile->top->data, pop bc push bc inc bc inc bc ld l, c ld h, b ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld d, (hl) push bc ldhl sp, #5 ld a, (hl) push af inc sp xor a, a push af inc sp inc hl ld a, (hl+) ld h, (hl) ld l, a push hl ld a, #0x0d push af inc sp xor a, a push af inc sp ldhl sp, #10 ld b, (hl) ld c, #0x78 push bc ld a, (hl) push af inc sp push de inc sp call _dynamic_metasprite_fold add sp, #10 pop bc ;src/main.c:620: pile->base = NULL; pop hl push hl xor a, a ld (hl+), a ld (hl), a ;src/main.c:621: pile->top = NULL; xor a, a ld (bc), a inc bc ld (bc), a ;src/main.c:622: pile->height = 0; ;c pop de push de ld hl, #0x0004 add hl, de ld c, l ld b, h xor a, a ld (bc), a ;src/main.c:623: cursor_adjust_height(); call _cursor_adjust_height 00106$: ;src/main.c:624: } add sp, #6 ret ;src/main.c:626: void dynamic_metasprite_unfold_callback(void) ; --------------------------------- ; Function dynamic_metasprite_unfold_callback ; --------------------------------- _dynamic_metasprite_unfold_callback:: add sp, #-4 ;src/main.c:628: Card const *card = dynamic_metasprite.data_ptr; ld hl, #(_dynamic_metasprite + 0x0011) ld a, (hl+) ld c, a ld b, (hl) ;src/main.c:629: if (!card->next_card) { ld e, c ld d, b ld a, (de) ldhl sp, #0 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:630: draw_card(dynamic_metasprite.data[1] / 8u, (UINT8)dynamic_metasprite.src[1] / 8u + 1u, card->data); inc bc inc bc inc hl ld a, c ld (hl+), a ;src/main.c:629: if (!card->next_card) { ld a, b ld (hl-), a dec hl ld a, (hl-) or a, (hl) jr NZ, 00102$ ;src/main.c:630: draw_card(dynamic_metasprite.data[1] / 8u, (UINT8)dynamic_metasprite.src[1] / 8u + 1u, card->data); ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ldhl sp, #0 ld (hl), a ld a, (#(_dynamic_metasprite + 0x0002) + 0) ldhl sp, #3 ld (hl), a ldhl sp, #3 ld a, (hl-) ld (hl), a xor a, a inc hl ld (hl), a srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) ld a, (hl+) ld (hl), a inc a dec hl dec hl ld (hl), a ld a, (#(_dynamic_metasprite + 0x000e) + 0) ldhl sp, #3 ld (hl), a ldhl sp, #3 ld a, (hl-) ld (hl), a xor a, a inc hl ld (hl), a srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) ld b, (hl) ;src/main.c:375: draw_card_top(x, y, card_data); push bc dec hl dec hl ld a, (hl) push af inc sp inc hl ld a, (hl) push af inc sp push bc inc sp call _draw_card_top add sp, #3 pop bc ;src/main.c:376: draw_card_bottom(x, y + 1u, card_data); ldhl sp, #1 ld a, (hl) inc a dec hl ld h, (hl) push hl inc sp push af inc sp push bc inc sp call _draw_card_bottom add sp, #3 ;src/main.c:631: dynamic_metasprite_fold_pile(); call _dynamic_metasprite_fold_pile ;src/main.c:632: return; jr 00104$ 00102$: ;src/main.c:634: dynamic_metasprite.data_ptr = card->next_card; pop bc push bc ld hl, #(_dynamic_metasprite + 0x0011) ld a, c ld (hl+), a ld (hl), b ;src/main.c:635: dynamic_metasprite.src[1] += 8; ld hl, #(_dynamic_metasprite + 0x0002) ld a, (hl+) ld c, a ld b, (hl) ld hl, #0x0008 add hl, bc ld c, l ld b, h ld hl, #(_dynamic_metasprite + 0x0002) ld a, c ld (hl+), a ld (hl), b ;src/main.c:636: draw_card_top(dynamic_metasprite.data[1] / 8u, dynamic_metasprite.src[1] / 8u, card->data); ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld (hl), a srl b rr c srl b rr c srl b rr c ld a, (#(_dynamic_metasprite + 0x000e) + 0) ld e, a ld d, #0x00 srl d rr e srl d rr e srl d rr e ld a, (hl) push af inc sp ld d, c push de call _draw_card_top add sp, #3 ;src/main.c:637: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 00104$: ;src/main.c:638: } add sp, #4 ret ;src/main.c:640: void dynamic_metasprite_move_stack_callback(void) ; --------------------------------- ; Function dynamic_metasprite_move_stack_callback ; --------------------------------- _dynamic_metasprite_move_stack_callback:: ;src/main.c:642: if (dynamic_metasprite.data[0] & BITMASK_DYNAMIC_METASPRITE_UNFOLD) { ld a, (#(_dynamic_metasprite + 0x000d) + 0) rlca jp NC,_dynamic_metasprite_fold_pile ;src/main.c:643: dynamic_metasprite.src[0] = dynamic_metasprite.data[1]; ld a, (#(_dynamic_metasprite + 0x000e) + 0) ld c, a ld b, #0x00 ld hl, #_dynamic_metasprite ld a, c ld (hl+), a ;src/main.c:644: dynamic_metasprite.src[1] = dynamic_metasprite.data[2] - 8u; ld a, b ld (hl+), a ld bc, #_dynamic_metasprite + 15 ld a, (bc) ld c, a ld b, #0x00 ld a, c add a, #0xf8 ld c, a ld a, b adc a, #0xff ld (hl), c inc hl ld (hl), a ;src/main.c:645: dynamic_metasprite.dist[0] = 0; ld hl, #(_dynamic_metasprite + 0x0004) xor a, a ld (hl+), a ld (hl), a ;src/main.c:646: dynamic_metasprite.dist[1] = 8; ld hl, #(_dynamic_metasprite + 0x0006) ld a, #0x08 ld (hl+), a ld (hl), #0x00 ;src/main.c:647: dynamic_metasprite.target_frames = animation_speeds[ANIMATION_SPEED(settings)].fold_target_frames; ld bc, #_dynamic_metasprite + 8 ld a, (#_settings) and a, #0x0c ld l, a ld h, #0x00 srl h rr l srl h rr l add hl, hl ld de, #_animation_speeds add hl, de ld a, (hl) ld (bc), a ;src/main.c:648: dynamic_metasprite.callback = &dynamic_metasprite_unfold_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_unfold_callback) inc hl ld (hl), #>(_dynamic_metasprite_unfold_callback) ;src/main.c:649: dynamic_metasprite_unfold_callback(); ;src/main.c:651: dynamic_metasprite_fold_pile(); ;src/main.c:653: } jp _dynamic_metasprite_unfold_callback ;src/main.c:655: void dynamic_metasprite_fold_callback(void) ; --------------------------------- ; Function dynamic_metasprite_fold_callback ; --------------------------------- _dynamic_metasprite_fold_callback:: add sp, #-4 ;src/main.c:657: dynamic_metasprite.src[1] -= 8; ld hl, #(_dynamic_metasprite + 0x0002) ld a, (hl+) ld c, a ld b, (hl) ld a, c add a, #0xf8 ld c, a ld a, b adc a, #0xff ld b, a ld hl, #(_dynamic_metasprite + 0x0002) ld a, c ld (hl+), a ld (hl), b ;src/main.c:658: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:659: clear_bkg_2x1((UINT8)dynamic_metasprite.src[0] / 8u, (UINT8)dynamic_metasprite.src[1] / 8u + 2u); ld a, (#(_dynamic_metasprite + 0x0002) + 0) ld c, a ld b, #0x00 srl b rr c srl b rr c srl b rr c inc c inc c ld a, (#_dynamic_metasprite + 0) ld e, a ld d, #0x00 srl d rr e srl d rr e srl d rr e ld b, e ;src/main.c:350: set_bkg_tile_xy(x, y, OFFSET_BKG_NONE); xor a, a push af inc sp ld a, c push af inc sp push bc inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:351: set_bkg_tile_xy(x + 1u, y, OFFSET_BKG_NONE); inc b xor a, a push af inc sp ld a, c push af inc sp push bc inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:660: if (dynamic_metasprite.data[0] & ~BITMASK_DYNAMIC_METASPRITE_UNFOLD) { ld bc, #_dynamic_metasprite + 13 ld a, (bc) ld e, a and a, #0x7f jr Z, 00105$ ;src/main.c:661: dynamic_metasprite.data[0]--; ld a, e dec a ld (bc), a jp 00109$ 00105$: ;src/main.c:663: if (cursor.card_to_show) { ld hl, #(_cursor + 0x0002) ld a, (hl+) ld c, a ld b, (hl) ;src/main.c:659: clear_bkg_2x1((UINT8)dynamic_metasprite.src[0] / 8u, (UINT8)dynamic_metasprite.src[1] / 8u + 2u); ld de, #(_dynamic_metasprite + 0x0002) ld a, (de) ldhl sp, #2 ld (hl+), a inc de ld a, (de) ld (hl), a ld de, #_dynamic_metasprite ld a, (de) ldhl sp, #0 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:664: draw_card(dynamic_metasprite.src[0] / 8u, dynamic_metasprite.src[1] / 8u - 1u, cursor.card_to_show->data); pop de push de inc hl inc hl srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) inc hl srl (hl) dec hl rr (hl) srl d rr e srl d rr e srl d rr e ld l, (hl) ;src/main.c:663: if (cursor.card_to_show) { ld a, b or a, c jr Z, 00102$ ;src/main.c:664: draw_card(dynamic_metasprite.src[0] / 8u, dynamic_metasprite.src[1] / 8u - 1u, cursor.card_to_show->data); inc bc inc bc ld a, (bc) ld b, a ld d, l dec d ;src/main.c:375: draw_card_top(x, y, card_data); push bc push de ld c, d push bc ld a, e push af inc sp call _draw_card_top add sp, #3 pop de pop bc ;src/main.c:376: draw_card_bottom(x, y + 1u, card_data); ld a, d inc a push bc inc sp ld d,a push de call _draw_card_bottom add sp, #3 ;src/main.c:665: cursor.card_to_show = NULL; ld hl, #(_cursor + 0x0002) xor a, a ld (hl+), a ld (hl), a jr 00103$ 00102$: ;src/main.c:667: draw_sequential_card(dynamic_metasprite.src[0] / 8u, dynamic_metasprite.src[1] / 8u, OFFSET_BKG_CARD + OFFSET_CARD_OUTLINE); ld a, #0xde push af ld a, l inc sp ld d,a push de call _draw_sequential_card add sp, #3 00103$: ;src/main.c:669: dynamic_metasprite.dist[0] = (INT16)dynamic_metasprite.data[1] - dynamic_metasprite.src[0]; ld a, (#(_dynamic_metasprite + 0x000e) + 0) ld c, a ld b, #0x00 ld hl, #_dynamic_metasprite ld a, (hl+) ld h, (hl) ld l, a ld a, c sub a, l ld c, a ld a, b sbc a, h ld b, a ld hl, #(_dynamic_metasprite + 0x0004) ld a, c ld (hl+), a ld (hl), b ;src/main.c:670: dynamic_metasprite.dist[1] = (INT16)dynamic_metasprite.data[2] - dynamic_metasprite.src[1]; ld a, (#(_dynamic_metasprite + 0x000f) + 0) ld c, a ld b, #0x00 ld hl, #(_dynamic_metasprite + 0x0002) ld a, (hl+) ld h, (hl) ld l, a ld a, c sub a, l ld c, a ld a, b sbc a, h ld b, a ld hl, #(_dynamic_metasprite + 0x0006) ld a, c ld (hl+), a ld (hl), b ;src/main.c:671: dynamic_metasprite.target_frames = animation_speeds[ANIMATION_SPEED(settings)].move_target_frames; ld bc, #_dynamic_metasprite + 8 ld a, (#_settings) and a, #0x0c ld l, a ld h, #0x00 srl h rr l srl h rr l add hl, hl ld de, #_animation_speeds add hl, de inc hl ld a, (hl) ld (bc), a ;src/main.c:672: dynamic_metasprite.callback = &dynamic_metasprite_move_stack_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_move_stack_callback) inc hl ld (hl), #>(_dynamic_metasprite_move_stack_callback) 00109$: ;src/main.c:675: } add sp, #4 ret ;src/main.c:677: void dynamic_metasprite_fold(const UINT8 top_card_data, const UINT8 src_x, const UINT8 src_y, const UINT8 dest_x, const UINT8 dest_y, const UINT8 stack_height, const Card *base_card, const UINT8 unfold, const UINT8 piles_to_clear) ; --------------------------------- ; Function dynamic_metasprite_fold ; --------------------------------- _dynamic_metasprite_fold:: ;src/main.c:679: set_metasprite_card(top_card_data); ldhl sp, #2 ld a, (hl) push af inc sp call _set_metasprite_card inc sp ;src/main.c:681: dynamic_metasprite.metasprite = metasprite_custom_2x3; ld hl, #(_dynamic_metasprite + 0x000a) ld (hl), #<(_metasprite_custom_2x3) inc hl ld (hl), #>(_metasprite_custom_2x3) ;src/main.c:682: dynamic_metasprite.metasprite_offset = OFFSET_SPRITE_CARD; ld hl, #(_dynamic_metasprite + 0x000c) ld (hl), #0xb0 ;src/main.c:684: dynamic_metasprite.data[0] = (stack_height - 1u) | unfold; ld bc, #_dynamic_metasprite + 13 ldhl sp, #7 ld a, (hl) dec a ldhl sp, #10 or a, (hl) ld (bc), a ;src/main.c:685: dynamic_metasprite.data[1] = dest_x; ld de, #(_dynamic_metasprite + 0x000e) ldhl sp, #5 ld a, (hl) ld (de), a ;src/main.c:686: dynamic_metasprite.data[2] = dest_y; ld de, #(_dynamic_metasprite + 0x000f) inc hl ld a, (hl) ld (de), a ;src/main.c:687: dynamic_metasprite.data[3] = piles_to_clear; ld de, #(_dynamic_metasprite + 0x0010) ldhl sp, #11 ld a, (hl) ld (de), a ;src/main.c:688: dynamic_metasprite.data_ptr = base_card; dec hl dec hl dec hl ld a, (hl+) ld c, a ld b, (hl) ld hl, #(_dynamic_metasprite + 0x0011) ld a, c ld (hl+), a ld (hl), b ;src/main.c:690: dynamic_metasprite.src[0] = src_x; ldhl sp, #3 ld c, (hl) ld b, #0x00 ld hl, #_dynamic_metasprite ld a, c ld (hl+), a ld (hl), b ;src/main.c:691: dynamic_metasprite.src[1] = src_y + 8u; ldhl sp, #4 ld c, (hl) ld b, #0x00 ld a, c add a, #0x08 ld c, a jr NC, 00110$ inc b 00110$: ld hl, #(_dynamic_metasprite + 0x0002) ld a, c ld (hl+), a ld (hl), b ;src/main.c:693: flags |= FLAG_PLAYING_ANIMATION; ld hl, #_flags ld a, (hl) or a, #0x04 ld (hl), a ;src/main.c:695: if (stack_height > 1) { ld a, #0x01 ldhl sp, #7 sub a, (hl) jp NC,_dynamic_metasprite_fold_callback ;src/main.c:696: dynamic_metasprite.dist[0] = 0; ld hl, #(_dynamic_metasprite + 0x0004) xor a, a ld (hl+), a ld (hl), a ;src/main.c:697: dynamic_metasprite.dist[1] = -8; ld hl, #(_dynamic_metasprite + 0x0006) ld a, #0xf8 ld (hl+), a ld (hl), #0xff ;src/main.c:698: dynamic_metasprite.target_frames = animation_speeds[ANIMATION_SPEED(settings)].fold_target_frames; ld bc, #_dynamic_metasprite + 8 ld a, (#_settings) and a, #0x0c ld l, a ld h, #0x00 srl h rr l srl h rr l add hl, hl ld de, #_animation_speeds add hl, de ld a, (hl) ld (bc), a ;src/main.c:699: dynamic_metasprite.callback = &dynamic_metasprite_fold_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_fold_callback) inc hl ld (hl), #>(_dynamic_metasprite_fold_callback) ;src/main.c:701: dynamic_metasprite_fold_callback(); ;src/main.c:702: } jp _dynamic_metasprite_fold_callback ;src/main.c:704: void dynamic_metasprite_deal_callback(void) ; --------------------------------- ; Function dynamic_metasprite_deal_callback ; --------------------------------- _dynamic_metasprite_deal_callback:: add sp, #-4 ;src/main.c:706: Pile *pile = IDX_PTR(piles, dynamic_metasprite.data[0]); ld hl, #(_dynamic_metasprite + 0x000d) ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld a, #<(_piles) add a, l ld b, a ld a, #>(_piles) adc a, h ldhl sp, #0 ld (hl), b inc hl ld (hl), a ;src/main.c:707: draw_card(dynamic_metasprite.data[0] * 2u, 2u + pile->height, pile->top->data); pop hl push hl inc hl inc hl ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld b, (hl) ;c pop de push de ld hl, #0x0004 add hl, de ld e, l ld d, h ld a, (de) add a, #0x02 ld d, a sla c ;src/main.c:375: draw_card_top(x, y, card_data); push bc push de push bc inc sp ld e, c push de call _draw_card_top add sp, #3 pop de pop bc ;src/main.c:376: draw_card_bottom(x, y + 1u, card_data); inc d push bc inc sp ld e, c push de call _draw_card_bottom add sp, #3 ;src/main.c:708: if (dynamic_metasprite.data[0] == 9u) { ld hl, #(_dynamic_metasprite + 0x000d) ld c, (hl) ld a, c sub a, #0x09 jr NZ, 00104$ ;src/main.c:709: if (top_card_idx == 104u) ld a, (#_top_card_idx) sub a, #0x68 jr NZ, 00102$ ;src/main.c:710: draw_sequential_card(0, 0, OFFSET_BKG_CARD + OFFSET_CARD_OUTLINE); ld a, #0xde push af inc sp xor a, a push af inc sp xor a, a push af inc sp call _draw_sequential_card add sp, #3 00102$: ;src/main.c:711: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation ;src/main.c:712: return; jr 00106$ 00104$: ;src/main.c:714: pile++; ;c pop de push de ld hl, #0x0005 add hl, de push hl ld a, l ldhl sp, #4 ld (hl), a pop hl ld a, h ldhl sp, #3 ld (hl), a ;src/main.c:715: dynamic_metasprite.data[0]++; inc c ld hl, #(_dynamic_metasprite + 0x000d) ld (hl), c ;src/main.c:716: dynamic_metasprite.dist[0] += 16; ld hl, #(_dynamic_metasprite + 0x0004) ld a, (hl+) ld c, a ld b, (hl) ld hl, #0x0010 add hl, bc ld c, l ld b, h ld hl, #(_dynamic_metasprite + 0x0004) ld a, c ld (hl+), a ld (hl), b ;src/main.c:717: dynamic_metasprite.dist[1] = (INT16)(2u + pile->height) * 8; ;c ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld c, l ld b, h ld a, (bc) ld l, a ld h, #0x00 inc hl inc hl add hl, hl add hl, hl add hl, hl ld c, l ld b, h ld hl, #(_dynamic_metasprite + 0x0006) ld a, c ld (hl+), a ld (hl), b ;src/main.c:718: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 00106$: ;src/main.c:719: } add sp, #4 ret ;src/main.c:721: void dynamic_metasprite_deal(void) ; --------------------------------- ; Function dynamic_metasprite_deal ; --------------------------------- _dynamic_metasprite_deal:: ;src/main.c:723: Pile *pile = IDX_PTR(piles, 0); ;src/main.c:724: dynamic_metasprite.src[0] = 0; ld hl, #_dynamic_metasprite xor a, a ld (hl+), a ld (hl), a ;src/main.c:725: dynamic_metasprite.src[1] = 0; ld hl, #(_dynamic_metasprite + 0x0002) xor a, a ld (hl+), a ld (hl), a ;src/main.c:726: dynamic_metasprite.dist[0] = 0; ld hl, #(_dynamic_metasprite + 0x0004) xor a, a ld (hl+), a ld (hl), a ;src/main.c:727: dynamic_metasprite.dist[1] = (INT16)(2u + pile->height) * 8; ld a, (#(_piles + 0x0004) + 0) ld h, #0x00 ld l, a inc hl inc hl add hl, hl add hl, hl add hl, hl ld c, l ld b, h ld hl, #(_dynamic_metasprite + 0x0006) ld a, c ld (hl+), a ld (hl), b ;src/main.c:728: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:729: dynamic_metasprite.target_frames = animation_speeds[ANIMATION_SPEED(settings)].move_target_frames; ld a, (#_settings) ld c, #0x00 and a, #0x0c ld l, a ld h, #0x00 srl h rr l srl h rr l add hl, hl ld de, #_animation_speeds add hl, de inc hl ld a, (hl) ld (#(_dynamic_metasprite + 0x0008)),a ;src/main.c:730: dynamic_metasprite.metasprite = metasprite_sequential_2x3; ld hl, #(_dynamic_metasprite + 0x000a) ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;src/main.c:731: dynamic_metasprite.metasprite_offset = OFFSET_SPRITE_CARD + OFFSET_CARD_BACK; ld hl, #(_dynamic_metasprite + 0x000c) ld (hl), #0xc7 ;src/main.c:732: dynamic_metasprite.data[0] = 0; ld hl, #(_dynamic_metasprite + 0x000d) ld (hl), #0x00 ;src/main.c:733: dynamic_metasprite.callback = &dynamic_metasprite_deal_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_deal_callback) inc hl ld (hl), #>(_dynamic_metasprite_deal_callback) ;src/main.c:734: flags |= FLAG_PLAYING_ANIMATION; ld hl, #_flags ld a, (hl) or a, #0x04 ld (hl), a ;src/main.c:735: } ret ;src/main.c:737: inline void dynamic_metasprite_process(void) ; --------------------------------- ; Function dynamic_metasprite_process ; --------------------------------- _dynamic_metasprite_process:: add sp, #-5 ;src/main.c:739: if (dynamic_metasprite.elapsed_frames >= dynamic_metasprite.target_frames) ld hl, #(_dynamic_metasprite + 0x0009) ld c, (hl) ld hl, #(_dynamic_metasprite + 0x0008) ld b, (hl) ld e, b ld a,c ld d,a sub a, b bit 7, e jr Z, 00124$ bit 7, d jr NZ, 00125$ cp a, a jr 00125$ 00124$: bit 7, d jr Z, 00125$ scf 00125$: ;src/main.c:740: return; jp NC,00107$ ;src/main.c:742: dynamic_metasprite.elapsed_frames++; inc c ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), c ;src/main.c:747: (INT16)scroll * -8 + dynamic_metasprite.src[1] + (dynamic_metasprite.dist[1] * dynamic_metasprite.elapsed_frames / dynamic_metasprite.target_frames) ld a, (#_scroll) ld e, a add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, a add a, a ld hl, #_dynamic_metasprite + 2 ld b, (hl) add a, b ldhl sp, #0 ld (hl), a ld hl, #(_dynamic_metasprite + 0x0006) ld a, (hl+) ld h, (hl) ld l, a ld a, c rla sbc a, a ld b, a push bc push bc push hl call __mulint add sp, #4 push hl ldhl sp, #7 ld (hl), e ldhl sp, #8 ld (hl), d pop hl pop bc ld a, (#(_dynamic_metasprite + 0x0008) + 0) ldhl sp, #1 ld (hl), a rla sbc a, a inc hl ld (hl), a push bc dec hl ld a, (hl+) ld h, (hl) ld l, a push hl ldhl sp, #7 ld a, (hl+) ld h, (hl) ld l, a push hl call __divsint add sp, #4 pop bc ld a, e ldhl sp, #0 add a, (hl) ldhl sp, #3 ld (hl), a ;src/main.c:746: dynamic_metasprite.src[0] + (dynamic_metasprite.dist[0] * dynamic_metasprite.elapsed_frames / dynamic_metasprite.target_frames), ld a, (#_dynamic_metasprite + 0) ldhl sp, #4 ld (hl), a ld hl, #(_dynamic_metasprite + 0x0004) ld a, (hl+) ld h, (hl) ld l, a push bc push hl call __mulint add sp, #4 ldhl sp, #1 ld a, (hl+) ld h, (hl) ld l, a push hl push de call __divsint add sp, #4 ld a, e ldhl sp, #4 add a, (hl) ld b, a ;src/main.c:744: dynamic_metasprite.metasprite_offset, ld a, (#(_dynamic_metasprite + 0x000c) + 0) ld (#___current_base_tile),a ;src/main.c:743: move_metasprite(dynamic_metasprite.metasprite, ld hl, #(_dynamic_metasprite + 0x000a) ld a, (hl+) ld h, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld (___current_metasprite), a ld a, h ld (___current_metasprite + 1), a ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ldhl sp, #3 ld a, (hl) push af inc sp push bc inc sp xor a, a push af inc sp call ___move_metasprite add sp, #3 ;src/main.c:749: if (dynamic_metasprite.elapsed_frames == dynamic_metasprite.target_frames ld a, (#(_dynamic_metasprite + 0x0009) + 0) ld hl, #(_dynamic_metasprite + 0x0008) ld c, (hl) sub a, c jr NZ, 00107$ ;src/main.c:750: && dynamic_metasprite.callback) ld hl, #(_dynamic_metasprite + 0x0013) ld a, (hl+) ld c, a ld h, (hl) ld a, h or a, c jr Z, 00107$ ;src/main.c:751: dynamic_metasprite.callback(); ld l, c call ___sdcc_call_hl 00107$: ;src/main.c:752: } add sp, #5 ret ;src/main.c:759: void cursor_adjust_height(void) ; --------------------------------- ; Function cursor_adjust_height ; --------------------------------- _cursor_adjust_height:: ;src/main.c:761: Pile *pile = IDX_PTR(piles, cursor.pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0006) + 0) ld e, a ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ;src/main.c:762: if (cursor.height >= pile->height) ld bc, #_cursor + 7 ld a, (bc) ld d, a inc hl inc hl inc hl inc hl ld e, (hl) ld a, d sub a, e ret C ;src/main.c:763: cursor.height = pile->height - !!pile->height; ld a, e sub a,#0x01 ld a, #0x00 rla xor a, #0x01 ld d, a ld a, e sub a, d ld (bc), a ;src/main.c:764: } ret ;src/main.c:766: inline void cursor_grab_stack(void) ; --------------------------------- ; Function cursor_grab_stack ; --------------------------------- _cursor_grab_stack:: add sp, #-7 ;src/main.c:769: Pile *pile = IDX_PTR(piles, cursor.pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0006) + 0) ld e, a ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ld c, l ld a, h ldhl sp, #2 ld (hl), c inc hl ;src/main.c:770: Card *top = pile->base; ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) inc hl inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) ld b, #0x01 00109$: ld hl, #(_cursor + 0x0007) ld c, (hl) ld a, b sub a, c jr NC, 00101$ ;src/main.c:772: top = top->next_card; ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) dec hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) inc b jr 00109$ 00101$: ;src/main.c:773: Card *stack = cursor.height ? top->next_card : top; ld a, c or a, a jr Z, 00113$ ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ldhl sp, #0 ld (hl+), a inc de ld a, (de) ld (hl), a jr 00114$ 00113$: ldhl sp, #5 ld a, (hl+) ld e, (hl) ldhl sp, #0 ld (hl+), a ld (hl), e 00114$: pop bc push bc ;src/main.c:774: if (!(VISIBLE(stack->data) && is_stack_coherent(stack))) ld e, c ld d, b inc de inc de ld a, (de) bit 6, a jr Z, 00111$ push bc push bc call _is_stack_coherent add sp, #2 ld a, e pop bc or a, a ;src/main.c:775: return; jr Z, 00111$ ;src/main.c:777: cursor.held_card = stack; ld hl, #_cursor ld a, c ld (hl+), a ld (hl), b ;src/main.c:778: cursor.hand_pile_idx = cursor.pile_idx; ld bc, #_cursor + 5 ld a, (#(_cursor + 0x0006) + 0) ld (bc), a ;src/main.c:779: cursor.held_stack_size = pile->height - cursor.height; ;c ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld c, l ld b, h ld a, (bc) ld hl, #(_cursor + 0x0007) ld l, (hl) sub a, l ld (#(_cursor + 0x0004)),a ;src/main.c:780: pile->height = cursor.height; ld a, (#(_cursor + 0x0007) + 0) ld (bc), a ;src/main.c:781: flags |= FLAG_REDRAW_HAND; ld hl, #_flags ld a, (hl) or a, #0x02 ld (hl), a ;src/main.c:782: if (cursor.height) { ld a, (#(_cursor + 0x0007) + 0) ldhl sp, #4 ld (hl), a ;src/main.c:783: pile->top = top; ldhl sp,#2 ld a, (hl+) ld c, a ld b, (hl) inc bc inc bc ;src/main.c:785: cursor.card_to_show = top; ;src/main.c:782: if (cursor.height) { inc hl ld a, (hl) or a, a jr Z, 00106$ ;src/main.c:783: pile->top = top; inc hl ld a, (hl+) ld (bc), a inc bc ld a, (hl) ld (bc), a ;src/main.c:784: top->next_card = NULL; dec hl ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:785: cursor.card_to_show = top; ld de, #(_cursor + 0x0002) ldhl sp, #5 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a jr 00111$ 00106$: ;src/main.c:787: pile->base = NULL; ldhl sp, #2 ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:788: pile->top = NULL; xor a, a ld (bc), a inc bc ld (bc), a ;src/main.c:789: cursor.card_to_show = NULL; ld hl, #(_cursor + 0x0002) xor a, a ld (hl+), a ld (hl), a 00111$: ;src/main.c:791: } add sp, #7 ret ;src/main.c:793: inline void cursor_place_stack(void) ; --------------------------------- ; Function cursor_place_stack ; --------------------------------- _cursor_place_stack:: add sp, #-2 ;src/main.c:795: Pile *pile = IDX_PTR(piles, cursor.hand_pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0005) + 0) ldhl sp, #1 ld (hl), a ldhl sp, #1 ld e, (hl) ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ld c, l ld b, h ;src/main.c:796: if (cursor.hand_pile_idx == cursor.pile_idx) { ld hl, #_cursor + 6 ld e, (hl) ldhl sp, #1 ld a, (hl) sub a, e jr NZ, 00105$ ;src/main.c:797: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 jr 00107$ 00105$: ;src/main.c:798: } else if (!pile->height ld hl, #0x0004 add hl, bc ld a, (hl) or a, a jr Z, 00101$ ;src/main.c:799: || RANK(pile->top->data) == RANK(cursor.held_card->data) + 1u) { ld l, c ld h, b inc hl inc hl ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ldhl sp, #0 ld (hl), a xor a, a inc hl ld (hl), a ld hl, #_cursor ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ld d, #0x00 ld e, a inc de ldhl sp, #0 ld a, (hl) sub a, e jr NZ, 00107$ inc hl ld a, (hl) sub a, d jr NZ, 00107$ 00101$: ;src/main.c:800: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 ;src/main.c:801: score--; ld hl, #_score + 1 dec hl ld a, (hl+) ld e, a ld d, (hl) dec de dec hl ld a, e ld (hl+), a ld (hl), d 00107$: ;src/main.c:803: } add sp, #2 ret ;src/main.c:805: void set_cursor_setting(void) ; --------------------------------- ; Function set_cursor_setting ; --------------------------------- _set_cursor_setting:: ;src/main.c:807: switch (cursor.pile_idx) { ld hl, #_cursor + 6 ld c, (hl) ;src/main.c:810: settings |= cursor.height; ld de, #_cursor + 7 ;src/main.c:807: switch (cursor.pile_idx) { ld a, c or a, a jr Z, 00101$ ld a, c dec a jr Z, 00102$ ld a,c cp a,#0x02 jr Z, 00103$ sub a, #0x03 jp Z,_start_game ret ;src/main.c:808: case 0u: 00101$: ;src/main.c:809: settings &= ~BITMASK_SETTING_NUM_SUITS; ld hl, #_settings ld a, (hl) and a, #0xfc ld (hl), a ;src/main.c:810: settings |= cursor.height; ld a, (de) or a, (hl) ld (hl), a ;src/main.c:811: draw_setting_frame_metasprites(); ;src/main.c:812: break; jp _draw_setting_frame_metasprites ;src/main.c:813: case 1u: 00102$: ;src/main.c:814: settings &= ~BITMASK_SETTING_MUSIC; ld hl, #_settings ld a, (hl) and a, #0xef ld (hl), a ;src/main.c:815: settings |= !cursor.height << BIT_OFFSET_SETTING_MUSIC; ld a, (de) sub a,#0x01 ld a, #0x00 rla swap a and a, #0xf0 or a, (hl) ld (hl), a ;src/main.c:816: draw_setting_frame_metasprites(); ;src/main.c:817: break; jp _draw_setting_frame_metasprites ;src/main.c:818: case 2u: 00103$: ;src/main.c:819: settings &= ~BITMASK_SETTING_ANIMATION_SPEED; ld hl, #_settings ld a, (hl) and a, #0xf3 ld (hl), a ;src/main.c:820: settings |= cursor.height << BIT_OFFSET_SETTING_ANIMATION_SPEED; ld a, (de) add a, a add a, a or a, (hl) ld (hl), a ;src/main.c:821: draw_setting_frame_metasprites(); ;src/main.c:822: break; ;src/main.c:823: case 3u: ;src/main.c:824: start_game(); ;src/main.c:826: } ;src/main.c:827: } jp _draw_setting_frame_metasprites ;src/main.c:829: void change_cursor_height(const INT8 inc) ; --------------------------------- ; Function change_cursor_height ; --------------------------------- _change_cursor_height:: ;src/main.c:831: cursor.height = (INT8)cursor.height + inc; ld bc, #_cursor+7 ld a, (bc) ldhl sp, #2 add a, (hl) ld (bc), a ;src/main.c:832: if (cursor.height < scroll) { ld a, (bc) ld c, a ld hl, #_scroll sub a, (hl) jr NC, 00104$ ;src/main.c:833: scroll = cursor.height; ld (hl), c ;src/main.c:834: move_bkg(0, scroll * 8u); ld a, (hl) add a, a add a, a add a, a ld c, a ;/home/wojtek/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y; ld a, #0x00 ldh (_SCX_REG+0),a ld a, c ldh (_SCY_REG+0),a ;src/main.c:834: move_bkg(0, scroll * 8u); ret 00104$: ;src/main.c:835: } else if (cursor.height > scroll + 9u) { ld hl, #_scroll ld e, (hl) ld d, #0x00 ld hl, #0x0009 add hl, de ld b, c ld e, #0x00 ld a, l sub a, b ld a, h sbc a, e ret NC ;src/main.c:836: scroll = cursor.height - 9u; ld a, c add a, #0xf7 ld hl, #_scroll ld (hl), a ;src/main.c:837: move_bkg(0, scroll * 8u); ld a, (hl) add a, a add a, a add a, a ld c, a ;/home/wojtek/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y; ld a, #0x00 ldh (_SCX_REG+0),a ld a, c ldh (_SCY_REG+0),a ;src/main.c:837: move_bkg(0, scroll * 8u); ;src/main.c:839: } ret ;src/main.c:841: inline void cursor_process(void) ; --------------------------------- ; Function cursor_process ; --------------------------------- _cursor_process:: dec sp ;src/main.c:843: switch (flags & FLAG_GAME_STATE) { ld a, (#_flags) and a, #0x18 ld c, a ld b, #0x00 ld a, c or a, a or a, b jp Z,00127$ ;src/main.c:845: return; jr 00102$ ;src/main.c:846: } 00102$: ;src/main.c:847: cursor.anim_ctr++; ld hl, #_cursor + 8 ld b, (hl) inc b ld (hl), b ;src/main.c:848: cursor.anim_ctr &= (1u << (CURSOR_PERIOD_LOGSCALE + 1u)) - 1u; res 7, b ld (hl), b ;src/main.c:849: UINT8 prev_anim_frame = cursor.anim_frame; ld hl, #(_cursor + 0x0009) ld c, (hl) ;src/main.c:850: cursor.anim_frame = cursor.anim_ctr >> CURSOR_PERIOD_LOGSCALE; ld a, b rlca rlca and a, #0x03 ld (#(_cursor + 0x0009)),a ;src/main.c:851: if (cursor.anim_frame != prev_anim_frame) sub a, c jr Z, 00104$ ;src/main.c:852: flags |= FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) or a, #0x01 ld (hl), a 00104$: ;src/main.c:854: if (flags & FLAG_REDRAW_CURSOR) { ld a, (#_flags) rrca jp NC,00115$ ;src/main.c:855: flags &= ~FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) and a, #0xfe ld (hl), a ;src/main.c:856: switch (flags & FLAG_GAME_STATE) { ld a, (hl) and a, #0x18 ld e, a ld d, #0x00 ld a, e sub a, #0x08 or a, d jr Z, 00106$ ;src/main.c:862: SETTINGS_PAD_Y * 8u + cursor.pile_idx * 32u ld hl, #_cursor + 6 ;src/main.c:861: cursor.height * 16u + SETTINGS_SPLIT_X * 8u, ld bc, #_cursor + 7 ;src/main.c:856: switch (flags & FLAG_GAME_STATE) { ld a, e sub a, #0x10 or a, d jr Z, 00109$ ld a, e sub a, #0x18 or a, d jp NZ,00115$ ;src/main.c:862: SETTINGS_PAD_Y * 8u + cursor.pile_idx * 32u ld a, (hl) swap a rlca and a, #0xe0 add a, #0x08 ldhl sp, #0 ld (hl), a ;src/main.c:861: cursor.height * 16u + SETTINGS_SPLIT_X * 8u, ld a, (bc) swap a and a, #0xf0 add a, #0x50 ld c, a ;src/main.c:858: move_metasprite(cursor_metasprites[cursor.anim_frame], ld a, (#(_cursor + 0x0009) + 0) ld h, #0x00 ld l, a add hl, hl ld de, #_cursor_metasprites add hl, de ld a, (hl+) ld h, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld (___current_metasprite), a ld a, h ld (___current_metasprite + 1), a ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ldhl sp, #0 ld a, (hl) push af inc sp ld d, c ld e,#0x0c push de call ___move_metasprite add sp, #3 ;src/main.c:864: break; jp 00115$ ;src/main.c:865: case FLAG_GAME_STATE_LEADERBOARD: 00106$: ;src/main.c:866: if (selected_leaderboard) { ld hl, #_selected_leaderboard + 1 ld a, (hl-) or a, (hl) jp Z, 00115$ ;src/main.c:867: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_CURSOR + OFFSET_CURSOR_UNDERLINE + cursor.anim_frame); ld a, (#(_cursor + 0x0009) + 0) add a, #0x09 ld c, a ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), c ;src/main.c:868: move_sprite(SPRITE_FRAME, (LEADERBOARD_NAME_X + 1u) * 8u + cursor.pile_idx * 8u, 16u + cursor.height * 8u); ld a, (#(_cursor + 0x0007) + 0) add a, a add a, a add a, a add a, #0x10 ld c, a ld a, (#(_cursor + 0x0006) + 0) add a, a add a, a add a, a add a, #0x48 ld e, a ;/home/wojtek/gbdk/include/gb/gb.h:1218: OAM_item_t * itm = &shadow_OAM[nb]; ld hl, #(_shadow_OAM + 0x0030) ;/home/wojtek/gbdk/include/gb/gb.h:1219: itm->y=y, itm->x=x; ld a, c ld (hl+), a ld (hl), e ;src/main.c:870: break; jr 00115$ ;src/main.c:871: case FLAG_GAME_STATE_INGAME: 00109$: ;src/main.c:872: if (cursor.pile_idx == PILE_IDX_DECK) ld a, (hl) ldhl sp, #0 ld (hl), a ;src/main.c:849: UINT8 prev_anim_frame = cursor.anim_frame; ld a, (#(_cursor + 0x0009) + 0) ;src/main.c:873: move_metasprite(cursor_metasprites[cursor.anim_frame], ld l, a ld h, #0x00 add hl, hl ld e, l ld d, h ;src/main.c:872: if (cursor.pile_idx == PILE_IDX_DECK) ldhl sp, #0 ld a, (hl) sub a, #0x0a jr NZ, 00111$ ;src/main.c:873: move_metasprite(cursor_metasprites[cursor.anim_frame], ld hl, #_cursor_metasprites add hl, de ld a, (hl+) ld c, a ld b, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld a, c ld (hl+), a ld (hl), b ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); xor a, a push af inc sp xor a, a ld d,a ld e,#0x0c push de call ___move_metasprite add sp, #3 ;src/main.c:878: ); jr 00115$ 00111$: ;src/main.c:884: (cursor.height + 3u - scroll) * 8u ld a, (bc) add a, #0x03 ld hl, #_scroll sub a, (hl) add a, a add a, a add a, a ld c, a ;src/main.c:883: cursor.pile_idx * 16u, ldhl sp, #0 ld a, (hl) swap a and a, #0xf0 ld b, a ;src/main.c:880: move_metasprite(cursor_metasprites[cursor.anim_frame], ld hl, #_cursor_metasprites add hl, de ld a, (hl+) ld h, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld (___current_metasprite), a ld a, h ld (___current_metasprite + 1), a ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld a, c push af inc sp ld c, #0x0c push bc call ___move_metasprite add sp, #3 ;src/main.c:887: } 00115$: ;src/main.c:890: if (flags & FLAG_REDRAW_HAND) { ld a, (#_flags) bit 1, a jr Z, 00127$ ;src/main.c:891: flags &= ~FLAG_REDRAW_HAND; ld hl, #_flags ld a, (hl) and a, #0xfd ld (hl), a ;src/main.c:892: if (cursor.held_card) { ld hl, #_cursor ld a, (hl+) or a,(hl) jr Z, 00117$ ;src/main.c:893: UINT8 height = piles[cursor.hand_pile_idx].height; ld hl, #(_cursor + 0x0005) ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld de, #_piles add hl, de inc hl inc hl inc hl inc hl ld e, (hl) ;src/main.c:898: (height + !height + 2u - scroll) * 8u ld a, e sub a,#0x01 ld a, #0x00 rla add a, e add a, #0x02 ld hl, #_scroll ld b, (hl) sub a, b add a, a add a, a add a, a ld b, a ;src/main.c:897: cursor.hand_pile_idx * 16u, ld a, c swap a and a, #0xf0 ld d, a ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x03 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld c, d push bc ld a, #0x06 push af inc sp call ___move_metasprite add sp, #3 ;src/main.c:899: ); jr 00127$ 00117$: ;src/main.c:901: metasprite_2x3_hide(SPRITE_HAND); ld a, #0x06 push af inc sp call _metasprite_2x3_hide inc sp 00127$: ;src/main.c:904: } inc sp ret ;src/main.c:910: void init_deck(void) ; --------------------------------- ; Function init_deck ; --------------------------------- _init_deck:: add sp, #-16 ;src/main.c:912: Card *card = IDX_PTR(deck, 0); ld bc, #_deck ;src/main.c:918: UINT8 suit_increment = 4u >> NUM_SUITS(settings); ld a, (#_settings) and a, #0x03 ld l, a ld de, #0x0004 inc l jr 00210$ 00209$: srl d rr e 00210$: dec l jr NZ, 00209$ ldhl sp, #5 ld (hl), e ;src/main.c:919: UINT8 i_max = suit_increment * 2u; ld a, (hl) add a, a inc hl ld (hl), a ;src/main.c:920: for (suit = 0; suit < 4u; suit += suit_increment) { xor a, a ldhl sp, #11 ld (hl), a ;src/main.c:921: for (rank = 0; rank < 13u; rank++) { 00131$: ldhl sp, #11 ld a, (hl) swap a and a, #0xf0 ldhl sp, #7 ld (hl), a xor a, a ldhl sp, #12 ld (hl), a ;src/main.c:922: for (i = 0; i < i_max; i++) { 00130$: ldhl sp, #12 ld a, (hl) ldhl sp, #7 or a, (hl) inc hl ld (hl), a ldhl sp, #13 ld a, c ld (hl+), a ld (hl), b xor a, a inc hl ld (hl), a 00112$: ldhl sp, #15 ld a, (hl) ldhl sp, #6 sub a, (hl) jr NC, 00143$ ;src/main.c:923: card->data = rank | (suit << BIT_OFFSET_CARD_SUIT); ;c ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0002 add hl, de push hl ld a, l ldhl sp, #11 ld (hl), a pop hl ld a, h ldhl sp, #10 ld (hl-), a ld a, (hl+) ld e, a ld a, (hl-) ld d, a dec hl ld a, (hl) ld (de), a ;src/main.c:924: card++; ;c ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0003 add hl, de push hl ld a, l ldhl sp, #15 ld (hl), a pop hl ld a, h ldhl sp, #14 ;src/main.c:922: for (i = 0; i < i_max; i++) { ld (hl+), a inc (hl) jr 00112$ 00143$: ldhl sp,#13 ld a, (hl+) ld c, a ;src/main.c:921: for (rank = 0; rank < 13u; rank++) { ld a, (hl-) ld b, a dec hl inc (hl) ld a, (hl) sub a, #0x0d jr C, 00130$ ;src/main.c:920: for (suit = 0; suit < 4u; suit += suit_increment) { dec hl ld a, (hl) ldhl sp, #5 add a, (hl) ldhl sp, #11 ld (hl), a sub a, #0x04 jr C, 00131$ ;src/main.c:930: card = IDX_PTR(deck, 103u); inc hl inc hl ld a, #<((_deck + 0x0135)) ld (hl+), a ld (hl), #>((_deck + 0x0135)) ;src/main.c:931: for (i = 103u; i; i--) { ldhl sp, #2 ld a, l ld d, h ldhl sp, #7 ld (hl+), a ld a, d ld (hl-), a ld a, (hl+) ld e, (hl) inc hl ld (hl+), a ld (hl), e ldhl sp, #15 ld (hl), #0x67 00118$: ;src/main.c:932: Card *swap = IDX_PTR(deck, (UINT8)rand() % i); call _rand ld a, e ldhl sp, #15 ld h, (hl) push hl inc sp push af inc sp call __moduchar add sp, #2 ld c, e ld b, #0x00 ld l, c ld h, b add hl, hl add hl, bc ld a, l add a, #<(_deck) ld c, a ld a, h adc a, #>(_deck) ld b, a ldhl sp, #11 ld a, c ld (hl+), a ;src/main.c:934: temp = *card; ld a, b ld (hl+), a ld a, (hl+) ld e, a ld d, (hl) ldhl sp,#7 ld a, (hl+) ld c, a ld b, (hl) ld hl, #0x0003 push hl push de push bc call ___memcpy add sp, #6 ;src/main.c:935: *card = *swap; ldhl sp,#11 ld a, (hl+) ld e, a ld a, (hl+) ld d, a ld a, (hl+) ld c, a ld b, (hl) ld hl, #0x0003 push hl push de push bc call ___memcpy add sp, #6 ;src/main.c:936: *swap = temp; ldhl sp,#9 ld a, (hl+) ld e, a ld a, (hl+) ld d, a ld a, (hl+) ld c, a ld b, (hl) ld hl, #0x0003 push hl push de push bc call ___memcpy add sp, #6 ;src/main.c:937: card--; ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0003 ld a, e sub a, l ld e, a ld a, d sbc a, h ldhl sp, #14 ld (hl-), a ;src/main.c:931: for (i = 103u; i; i--) { ld a, e ld (hl+), a inc hl dec (hl) jr NZ, 00118$ ;src/main.c:941: card = IDX_PTR(deck, 0); ld bc, #_deck ;src/main.c:942: for (i = 0; i < 44u; i++) { xor a, a ld (hl), a 00120$: ;src/main.c:943: card->next_card = IDX_PTR(deck, i + 10u); ldhl sp, #15 ld e, (hl) ld d, #0x00 ld l, e ld h, d add hl, hl add hl, de ld de, #_deck add hl, de ld de, #0x001e add hl, de ld e, l ld d, h ld l, c ld h, b ld a, e ld (hl+), a ld (hl), d ;src/main.c:944: card++; inc bc inc bc inc bc ;src/main.c:942: for (i = 0; i < 44u; i++) { ldhl sp, #15 inc (hl) ld a, (hl) sub a, #0x2c jr C, 00120$ ld e, (hl) 00123$: ;src/main.c:946: for (; i < 104u; i++) { ld a, e sub a, #0x68 jr NC, 00106$ ;src/main.c:947: card->data |= BITMASK_CARD_VISIBLE; ld l, c ld h, b inc hl inc hl set 6, (hl) ;src/main.c:948: card->next_card = NULL; ld l, c ld h, b xor a, a ld (hl+), a ld (hl), a ;src/main.c:949: card++; inc bc inc bc inc bc ;src/main.c:946: for (; i < 104u; i++) { inc e jr 00123$ 00106$: ;src/main.c:952: card = IDX_PTR(deck, 0); ldhl sp, #11 ld a, #<(_deck) ld (hl+), a ;src/main.c:953: Pile *pile = IDX_PTR(piles, 0); ld a, #>(_deck) ld (hl+), a ld a, #<(_piles) ld (hl+), a ld (hl), #>(_piles) ;src/main.c:954: for (i = 0; i < 10; i++) { xor a, a inc hl ld (hl), a 00125$: ;src/main.c:955: pile->base = card; ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ldhl sp, #11 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a ;src/main.c:957: pile->top = IDX_PTR(deck, 50u + i); ;c inc hl ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0002 add hl, de push hl ld a, l ldhl sp, #7 ld (hl), a pop hl ld a, h ldhl sp, #6 ld (hl), a ldhl sp, #15 ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, bc inc sp inc sp push hl ;src/main.c:958: pile->height = 6u; ;c ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de push hl ld a, l ldhl sp, #9 ld (hl), a pop hl ld a, h ldhl sp, #8 ld (hl), a ;src/main.c:956: if (i < 4u) { ldhl sp, #15 ld a, (hl) sub a, #0x04 jr NC, 00108$ ;src/main.c:957: pile->top = IDX_PTR(deck, 50u + i); ;c pop de push de ld hl, #(_deck + 0x0096) add hl, de push hl ld a, l ldhl sp, #11 ld (hl), a pop hl ld a, h ldhl sp, #10 ld (hl), a ldhl sp,#5 ld a, (hl+) ld e, a ld d, (hl) ldhl sp, #9 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a ;src/main.c:958: pile->height = 6u; ldhl sp, #7 ld a, (hl+) ld h, (hl) ld l, a ld (hl), #0x06 jr 00109$ 00108$: ;src/main.c:960: pile->top = IDX_PTR(deck, 40u + i); ;c ld de, #(_deck + 0x0078) pop hl push hl add hl, de ld c, l ld b, h ldhl sp, #5 ld a, (hl+) ld h, (hl) ld l, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:961: pile->height = 5u; ldhl sp, #7 ld a, (hl+) ld h, (hl) ld l, a ld (hl), #0x05 00109$: ;src/main.c:964: card++; ;c ldhl sp,#11 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0003 add hl, de push hl ld a, l ldhl sp, #13 ld (hl), a pop hl ld a, h ldhl sp, #12 ;src/main.c:965: pile++; ;c ld (hl+), a ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0005 add hl, de push hl ld a, l ldhl sp, #15 ld (hl), a pop hl ld a, h ldhl sp, #14 ;src/main.c:954: for (i = 0; i < 10; i++) { ld (hl+), a inc (hl) ld a, (hl) sub a, #0x0a jp C, 00125$ ;src/main.c:968: top_card_idx = 54u; ld hl, #_top_card_idx ld (hl), #0x36 ;src/main.c:969: } add sp, #16 ret ;src/main.c:971: UINT8 is_stack_coherent(Card *card) ; --------------------------------- ; Function is_stack_coherent ; --------------------------------- _is_stack_coherent:: add sp, #-2 ;src/main.c:973: while (card->next_card) { 00103$: ldhl sp,#4 ld a, (hl+) ld c, a ld b, (hl) ld e, c ld d, b ld a, (de) ldhl sp, #0 ld (hl+), a inc de ld a, (de) ld (hl), a ld a, (hl-) or a, (hl) jr Z, 00105$ ;src/main.c:974: UINT8 prev_data = card->data; inc bc inc bc ld a, b ld l, c ld h, a ld c, (hl) ;src/main.c:975: card = card->next_card; ldhl sp, #0 ld a, (hl+) ld e, (hl) ldhl sp, #4 ld (hl+), a ;src/main.c:976: if (prev_data != card->data + 1u) ld a, e ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) inc de inc de ld a, (de) ld e, a ld d, #0x00 inc de ld b, #0x00 ld a, c sub a, e jr NZ, 00123$ ld a, b sub a, d jr Z, 00103$ 00123$: ;src/main.c:977: return 0u; ld e, #0x00 jr 00106$ 00105$: ;src/main.c:979: return 1u; ld e, #0x01 00106$: ;src/main.c:980: } add sp, #2 ret ;src/main.c:982: inline void deal(void) ; --------------------------------- ; Function deal ; --------------------------------- _deal:: add sp, #-5 ;src/main.c:985: Pile *pile = IDX_PTR(piles, 0); ld bc, #_piles ;src/main.c:988: for (i = 0; i < 10u; i++) { ld e, #0x00 00105$: ;src/main.c:989: if (!pile->height) ld hl, #0x0004 add hl, bc ld a, (hl) or a, a ;src/main.c:990: return; jr Z, 00110$ ;src/main.c:991: pile++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:988: for (i = 0; i < 10u; i++) { inc e ld a, e sub a, #0x0a jr C, 00105$ ;src/main.c:994: pile = IDX_PTR(piles, 0); ldhl sp, #2 ld a, #<(_piles) ld (hl+), a ld (hl), #>(_piles) ;src/main.c:995: Card *deck_top = IDX_PTR(deck, top_card_idx); ld hl, #_top_card_idx ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, bc ld bc,#_deck add hl,bc ld c, l ld b, h ;src/main.c:996: top_card_idx += 10u; ld hl, #_top_card_idx ld a, (hl) add a, #0x0a ld (hl), a ;src/main.c:999: for (i = 0; i < 10u; i++) { ldhl sp, #4 ld (hl), #0x0a 00109$: ;src/main.c:1000: pile->top->next_card = deck_top; ;c ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0002 add hl, de inc sp inc sp ld e, l ld d, h push de ld a, (de) ld l, a inc de ld a, (de) ld h, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:1001: pile->top = deck_top; pop hl push hl ld a, c ld (hl+), a ld (hl), b ;src/main.c:1002: pile->height++; ;c ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld e, l ld d, h ld a, (de) inc a ld (de), a ;src/main.c:1003: deck_top++; inc bc inc bc inc bc ;src/main.c:1004: pile++; ;c ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0005 add hl, de push hl ld a, l ldhl sp, #4 ld (hl), a pop hl ld a, h ldhl sp, #3 ld (hl+), a ;src/main.c:999: for (i = 0; i < 10u; i++) { dec (hl) jr NZ, 00109$ ;src/main.c:1007: dynamic_metasprite_deal(); call _dynamic_metasprite_deal 00110$: ;src/main.c:1008: } add sp, #5 ret ;src/main.c:1010: void pile_append_cursor_stack(Pile *pile) ; --------------------------------- ; Function pile_append_cursor_stack ; --------------------------------- _pile_append_cursor_stack:: add sp, #-13 ;src/main.c:1012: if (pile->height) ldhl sp, #15 ld a, (hl+) ld e, (hl) ldhl sp, #0 ld (hl+), a ld (hl), e ;c pop de push de ld hl, #0x0004 add hl, de push hl ld a, l ldhl sp, #4 ld (hl), a pop hl ld a, h ldhl sp, #3 ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ldhl sp, #12 ld (hl), a ;src/main.c:1013: pile->top->next_card = cursor.held_card; ;c pop de push de ld hl, #0x0002 add hl, de push hl ld a, l ldhl sp, #6 ld (hl), a pop hl ld a, h ldhl sp, #5 ld (hl), a ;src/main.c:1012: if (pile->height) ldhl sp, #12 ld a, (hl) or a, a jr Z, 00102$ ;src/main.c:1013: pile->top->next_card = cursor.held_card; ldhl sp,#4 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ldhl sp, #11 ld (hl+), a inc de ld a, (de) ld (hl), a ld hl, #_cursor ld a, (hl+) ld c, a ld b, (hl) ldhl sp, #11 ld a, (hl+) ld h, (hl) ld l, a ld a, c ld (hl+), a ld (hl), b jr 00103$ 00102$: ;src/main.c:1015: pile->base = cursor.held_card; ld de, #_cursor ld a, (de) ldhl sp, #11 ld (hl+), a inc de ld a, (de) ld (hl), a pop de push de dec hl ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a 00103$: ;src/main.c:1017: Pile *src_pile = IDX_PTR(piles, cursor.pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0006) + 0) ld e, a ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ld c, l ld a, h ldhl sp, #6 ld (hl), c inc hl ld (hl), a ;src/main.c:1018: Card *top_card = cursor.held_card; ld de, #_cursor ld a, (de) inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:1019: while (top_card->next_card) 00104$: ldhl sp,#8 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) inc hl inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ld a, (hl-) or a, (hl) jr Z, 00106$ ;src/main.c:1020: top_card = top_card->next_card; ld a, (hl+) ld e, (hl) ldhl sp, #8 ld (hl+), a ld (hl), e jr 00104$ 00106$: ;src/main.c:1021: pile->top = top_card; ldhl sp,#4 ld a, (hl+) ld e, a ld d, (hl) ldhl sp, #8 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a ;src/main.c:1022: cursor.height = pile->height - !!pile->height; ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld b, a sub a,#0x01 ld a, #0x00 rla xor a, #0x01 ld c, a ld a, b sub a, c ld (#(_cursor + 0x0007)),a ;src/main.c:1023: pile->height += cursor.held_stack_size; ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld c, a ld a, (#(_cursor + 0x0004) + 0) add a, c ld c, a dec hl ld a, (hl+) ld h, (hl) ld l, a ld (hl), c ;src/main.c:1024: if (cursor.hand_pile_idx != cursor.pile_idx) { ld a, (#(_cursor + 0x0005) + 0) ld hl, #(_cursor + 0x0006) ld c, (hl) sub a, c jp Z,00116$ ;src/main.c:1025: UINT8 piles_to_clear = 0; xor a, a ldhl sp, #12 ld (hl), a ;src/main.c:1026: if (src_pile->height == 13u && is_stack_coherent(src_pile->base)) { ;c ldhl sp,#6 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de push hl ld a, l ldhl sp, #12 ld (hl), a pop hl ld a, h ldhl sp, #11 ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) sub a, #0x0d jr NZ, 00108$ ldhl sp,#6 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld c, a inc de ld a, (de) ld b, a push bc call _is_stack_coherent add sp, #2 ld a, e or a, a jr Z, 00108$ ;src/main.c:1027: piles_to_clear = cursor.pile_idx; ld a, (#(_cursor + 0x0006) + 0) ldhl sp, #12 ld (hl), a 00108$: ;src/main.c:1029: if (pile->height == 13u && is_stack_coherent(pile->base)) { ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) sub a, #0x0d jr NZ, 00111$ pop de push de ld a, (de) ld c, a inc de ld a, (de) ld b, a push bc call _is_stack_coherent add sp, #2 ld a, e or a, a jr Z, 00111$ ;src/main.c:1030: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ;src/main.c:1024: if (cursor.hand_pile_idx != cursor.pile_idx) { ld a, (#(_cursor + 0x0005) + 0) ldhl sp, #7 ld (hl), a ;src/main.c:1031: piles_to_clear |= piles_to_clear ? cursor.hand_pile_idx << 4u : cursor.hand_pile_idx; ldhl sp, #12 ld a, (hl) or a, a jr Z, 00119$ ldhl sp, #7 ld a, (hl) swap a and a, #0xf0 jr 00120$ 00119$: ldhl sp, #7 ld a, (hl) 00120$: ldhl sp, #12 or a, (hl) ld (hl), a 00111$: ;src/main.c:1034: if (cursor.card_to_show) ld de, #(_cursor + 0x0002) ld a, (de) ldhl sp, #6 ld (hl+), a inc de ld a, (de) ld (hl), a ld a, (hl-) or a, (hl) jr Z, 00114$ ;src/main.c:1035: cursor.card_to_show->data |= BITMASK_CARD_VISIBLE; ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl set 6, (hl) 00114$: ;src/main.c:1041: cursor.held_card, ld de, #_cursor ld a, (de) ldhl sp, #6 ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:1040: cursor.held_stack_size, ld hl, #(_cursor + 0x0004) ld c, (hl) ;src/main.c:1039: (pile->height + 3u - cursor.held_stack_size) * 8u, ldhl sp,#2 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) add a, #0x03 sub a, c add a, a add a, a add a, a inc hl ld (hl), a ;src/main.c:1038: (src_pile->height + 2u + cursor.held_stack_size) * 8u, cursor.hand_pile_idx * 16u, ld a, (#(_cursor + 0x0005) + 0) swap a and a, #0xf0 inc hl ld (hl), a ldhl sp,#10 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) add a, #0x02 add a, c add a, a add a, a add a, a ld (hl), a ;src/main.c:1037: cursor.pile_idx * 16u, ld a, (#(_cursor + 0x0006) + 0) swap a and a, #0xf0 ;src/main.c:1036: dynamic_metasprite_fold(top_card->data, ldhl sp, #8 push af ld a, (hl+) ld h, (hl) ld l, a pop af inc hl inc hl ld e, (hl) ldhl sp, #12 ld h, (hl) push hl inc sp ld h, #0x80 push hl inc sp ldhl sp, #8 push af ld a, (hl+) ld h, (hl) ld l, a pop af push hl ld h, c push hl inc sp ldhl sp, #9 ld h, (hl) push hl inc sp ldhl sp, #11 ld h, (hl) push hl inc sp ldhl sp, #18 ld h, (hl) push hl inc sp ld d,a push de call _dynamic_metasprite_fold add sp, #10 00116$: ;src/main.c:1047: cursor.held_card = NULL; ld hl, #_cursor xor a, a ld (hl+), a ld (hl), a ;src/main.c:1048: cursor.pile_idx = cursor.hand_pile_idx; ld a, (#(_cursor + 0x0005) + 0) ld (#(_cursor + 0x0006)),a ;src/main.c:1049: flags |= FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) or a, #0x01 ld (hl), a ;src/main.c:1050: } add sp, #13 ret ;src/main.c:1056: void start_game(void) ; --------------------------------- ; Function start_game ; --------------------------------- _start_game:: ;src/main.c:1058: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ;src/main.c:1059: flags |= FLAG_GAME_STATE_INGAME | FLAG_REDRAW_CURSOR; ld (hl), a or a, #0x11 ld (hl), a ;src/main.c:1060: cursor.pile_idx = 0; ld hl, #(_cursor + 0x0006) ld (hl), #0x00 ;src/main.c:1061: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ;src/main.c:1062: metasprite_2x3_hide(SPRITE_FRAME_1); ld a, #0x12 push af inc sp call _metasprite_2x3_hide inc sp ;src/main.c:1063: metasprite_2x3_hide(SPRITE_FRAME_2); ld a, #0x18 push af inc sp call _metasprite_2x3_hide inc sp ;src/main.c:1064: metasprite_2x3_hide(SPRITE_FRAME_3); ld a, #0x1e push af inc sp call _metasprite_2x3_hide inc sp ;src/main.c:1065: init_deck(); call _init_deck ;src/main.c:1066: clear_bkg(); call _clear_bkg ;src/main.c:1067: draw_bkg_game(); ;src/main.c:1068: } jp _draw_bkg_game ;src/main.c:1070: inline void start_settings(void) ; --------------------------------- ; Function start_settings ; --------------------------------- _start_settings:: ;src/main.c:1072: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ;src/main.c:1073: flags |= FLAG_GAME_STATE_SETTINGS | FLAG_REDRAW_CURSOR; ld (hl), a or a, #0x19 ld (hl), a ;src/main.c:1074: cursor.pile_idx = 0; ld hl, #(_cursor + 0x0006) ld (hl), #0x00 ;src/main.c:1075: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ;src/main.c:1076: draw_setting_frame_metasprites(); call _draw_setting_frame_metasprites ;src/main.c:1077: clear_bkg(); call _clear_bkg ;src/main.c:1078: draw_bkg_settings(); ;src/main.c:1079: } jp _draw_bkg_settings ;src/main.c:1081: void start_splash_screen(void) ; --------------------------------- ; Function start_splash_screen ; --------------------------------- _start_splash_screen:: ;src/main.c:1083: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ld (hl), a ;src/main.c:1084: flags |= FLAG_GAME_STATE_SPLASH; ;src/main.c:1085: clear_bkg(); call _clear_bkg ;src/main.c:1086: draw_bkg_splash_screen(); call _draw_bkg_splash_screen ;src/main.c:577: dynamic_metasprite.src[0] = 72; ld hl, #_dynamic_metasprite ld (hl), #0x48 inc hl ld (hl), #0x00 ;src/main.c:578: dynamic_metasprite.src[1] = -24; ld hl, #(_dynamic_metasprite + 0x0002) ld (hl), #0xe8 inc hl ld (hl), #0xff ;src/main.c:579: dynamic_metasprite.dist[0] = -64; ld hl, #(_dynamic_metasprite + 0x0004) ld (hl), #0xc0 inc hl ld (hl), #0xff ;src/main.c:580: dynamic_metasprite.dist[1] = 40; ld hl, #(_dynamic_metasprite + 0x0006) ld (hl), #0x28 inc hl ld (hl), #0x00 ;src/main.c:581: dynamic_metasprite.target_frames = TARGET_FRAMES_SPLASH_SCREEN; ld hl, #(_dynamic_metasprite + 0x0008) ld (hl), #0x20 ;src/main.c:582: dynamic_metasprite.elapsed_frames = 0; ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), #0x00 ;src/main.c:583: dynamic_metasprite.metasprite = metasprite_sequential_2x3; ld hl, #(_dynamic_metasprite + 0x000a) ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;src/main.c:584: dynamic_metasprite.metasprite_offset = OFFSET_SPRITE_TITLE + OFFSET_TITLE_S; ld hl, #(_dynamic_metasprite + 0x000c) ld (hl), #0x80 ;src/main.c:585: dynamic_metasprite.data[0] = 0; ld hl, #(_dynamic_metasprite + 0x000d) ld (hl), #0x00 ;src/main.c:586: dynamic_metasprite.callback = &dynamic_metasprite_splash_screen_callback; ld hl, #(_dynamic_metasprite + 0x0013) ld (hl), #<(_dynamic_metasprite_splash_screen_callback) inc hl ld (hl), #>(_dynamic_metasprite_splash_screen_callback) ;src/main.c:587: flags |= FLAG_PLAYING_ANIMATION; ld hl, #_flags ld a, (hl) or a, #0x04 ld (hl), a ;src/main.c:1087: dynamic_metasprite_splash_screen(); ;src/main.c:1088: } ret ;src/main.c:1090: void start_leaderboard(void) ; --------------------------------- ; Function start_leaderboard ; --------------------------------- _start_leaderboard:: ;src/main.c:1092: ENABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x0a ;src/main.c:1093: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ;src/main.c:1094: flags |= FLAG_GAME_STATE_LEADERBOARD; ld (hl), a or a, #0x08 ld (hl), a ;src/main.c:1095: cursor.pile_idx = 0; ld hl, #(_cursor + 0x0006) ld (hl), #0x00 ;src/main.c:1096: clear_bkg(); call _clear_bkg ;src/main.c:1097: draw_bkg_leaderboard(); call _draw_bkg_leaderboard ;src/main.c:1098: DISABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x00 ;src/main.c:1099: } ret ;src/main.c:1101: void add_leaderboard(void) ; --------------------------------- ; Function add_leaderboard ; --------------------------------- _add_leaderboard:: add sp, #-3 ;src/main.c:1103: ENABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x0a ;src/main.c:1104: LeaderBoard *iter = leaderboard[NUM_SUITS(settings)]; ld bc, #_leaderboard+0 ld a, (#_settings) and a, #0x03 ld l, a ld h, #0x00 ld e, l ld d, h add hl, hl add hl, de add hl, hl add hl, de add hl, hl add hl, de add hl, bc ld c, l ld b, h ;src/main.c:1106: for (i = 0; i < 3u; i++) { xor a, a ldhl sp, #2 ld (hl), a 00106$: ;src/main.c:1107: if (score > iter->score) ld l, c ld h, b inc hl inc hl inc hl ld e, l ld d, h ld a, (de) ldhl sp, #0 ld (hl+), a inc de ld a, (de) ld (hl), a ldhl sp, #0 ld e, l ld d, h ld hl, #_score ld a, (de) sub a, (hl) inc hl inc de ld a, (de) sbc a, (hl) jr C, 00103$ ;src/main.c:1109: iter++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:1106: for (i = 0; i < 3u; i++) { ldhl sp, #2 inc (hl) ld a, (hl) sub a, #0x03 jr C, 00106$ 00103$: ;src/main.c:1111: if (i == 3u) ldhl sp, #2 ld a, (hl) sub a, #0x03 jr Z, 00108$ ;src/main.c:1112: return; jr 00105$ 00105$: ;src/main.c:1113: iter->score = score; ld e, c ld d, b inc de inc de inc de ld hl, #_score ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a ;src/main.c:1114: iter->name[0] = 0x0B; ld a, #0x0b ld (bc), a ;src/main.c:1115: iter->name[1] = 0x0B; ld l, c ld h, b inc hl ld (hl), #0x0b ;src/main.c:1116: iter->name[2] = 0x0B; ld l, c ld h, b inc hl inc hl ld (hl), #0x0b ;src/main.c:1117: selected_leaderboard = iter; ld hl, #_selected_leaderboard ld a, c ld (hl+), a ld (hl), b ;src/main.c:1118: cursor.height = LEADERBOARD_PAD_Y + NUM_SUITS(settings) * 4u + i; ld a, (#_settings) and a, #0x03 add a, a add a, a add a, #0x04 ldhl sp, #2 add a, (hl) ld (#(_cursor + 0x0007)),a ;src/main.c:1119: flags |= FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) or a, #0x01 ld (hl), a ;src/main.c:1120: DISABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x00 00108$: ;src/main.c:1121: } add sp, #3 ret ;src/main.c:1123: void nvram_check(void) ; --------------------------------- ; Function nvram_check ; --------------------------------- _nvram_check:: add sp, #-5 ;src/main.c:1125: ENABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x0a ;src/main.c:1126: if (nvram_check_data != NVRAM_SET) { ld hl, #_nvram_check_data ld a, (hl) sub a, #0x37 jr NZ, 00134$ inc hl ld a, (hl) dec a jr NZ, 00134$ inc hl ld a, (hl) sub a, #0x3e jr NZ, 00134$ inc hl ld a, (hl) sub a, #0xcd jp Z,00104$ 00134$: ;src/main.c:1127: nvram_check_data = NVRAM_SET; ld hl, #_nvram_check_data ld (hl), #0x37 inc hl ld (hl), #0x01 inc hl ld (hl), #0x3e inc hl ld (hl), #0xcd ;src/main.c:1128: LeaderBoard *iter = IDX_PTR(leaderboard[0], 0u); ldhl sp, #0 ld (hl), #<(_leaderboard) inc hl ld (hl), #>(_leaderboard) ;src/main.c:1130: for (i = 0; i < 3; i++) { xor a, a ldhl sp, #4 ld (hl), a 00108$: ;src/main.c:1131: iter->score = 400u - 100u * (UINT16)i; pop bc push bc inc bc inc bc inc bc ldhl sp, #4 ld a, (hl-) dec hl ld (hl), a xor a, a inc hl ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld l, e ld h, d add hl, hl add hl, de add hl, hl add hl, hl add hl, hl add hl, de add hl, hl add hl, hl ld a, #0x90 sub a, l ld e, a ld a, #0x01 sbc a, h ld d, a ld a, e ld (bc), a inc bc ld a, d ld (bc), a ;src/main.c:1132: iter->name[0] = 0x21u; pop hl push hl ld (hl), #0x21 ;src/main.c:1133: iter->name[1] = 0x19u; pop hl push hl inc hl ld (hl), #0x19 ;src/main.c:1134: iter->name[2] = 0x14u; pop hl push hl inc hl inc hl ld (hl), #0x14 ;src/main.c:1135: iter++; ;c pop de push de ld hl, #0x0005 add hl, de ld c, l ld b, h ;src/main.c:1136: for (j = 0; j < 2; j++) { ld e, #0x02 00107$: ;src/main.c:1137: iter->score = 0u; ld l, c ld h, b inc hl inc hl inc hl xor a, a ld (hl+), a ld (hl), a ;src/main.c:1138: iter->name[0] = 0u; xor a, a ld (bc), a ;src/main.c:1139: iter->name[1] = 0u; ld l, c ld h, b inc hl ld (hl), #0x00 ;src/main.c:1140: iter->name[2] = 0u; ld l, c ld h, b inc hl inc hl ld (hl), #0x00 ;src/main.c:1141: iter++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:1136: for (j = 0; j < 2; j++) { dec e jr NZ, 00107$ ;src/main.c:1130: for (i = 0; i < 3; i++) { inc sp inc sp push bc ldhl sp, #4 inc (hl) ld a, (hl) sub a, #0x03 jr C, 00108$ 00104$: ;src/main.c:1145: DISABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x00 ;src/main.c:1146: } add sp, #5 ret ;src/main.c:1148: void inc_letter(const INT8 inc) ; --------------------------------- ; Function inc_letter ; --------------------------------- _inc_letter:: ;src/main.c:1150: ENABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x0a ;src/main.c:1151: UINT8 *letter = &selected_leaderboard->name[cursor.pile_idx]; ld hl, #_selected_leaderboard + 1 dec hl ld a, (hl+) ld c, a ld b, (hl) ld a, (#(_cursor + 0x0006) + 0) add a, c ld c, a ld a, #0x00 adc a, b ld b, a ;src/main.c:1152: *letter = (INT8)*letter + inc; ld a, (bc) ldhl sp, #2 add a, (hl) ;src/main.c:1153: if (*letter < 0x0Bu) ld (bc), a ld e, a sub a, #0x0b jr NC, 00104$ ;src/main.c:1154: *letter = 0x24u; ld a, #0x24 ld (bc), a jr 00105$ 00104$: ;src/main.c:1155: else if (*letter > 0x24u) ld a, #0x24 sub a, e jr NC, 00105$ ;src/main.c:1156: *letter = 0x0Bu; ld a, #0x0b ld (bc), a 00105$: ;src/main.c:1157: set_bkg_tile_xy(LEADERBOARD_NAME_X + cursor.pile_idx, cursor.height, *letter); ld a, (bc) ld c, a ld hl, #(_cursor + 0x0007) ld b, (hl) ld a, (#(_cursor + 0x0006) + 0) add a, #0x08 ld h, c ld l, b push hl push af inc sp call _set_bkg_tile_xy add sp, #3 ;src/main.c:1158: DISABLE_RAM_MBC1; ld hl, #0x0000 ld (hl), #0x00 ;src/main.c:1159: } ret ;src/main.c:1161: inline void input_process(void) ; --------------------------------- ; Function input_process ; --------------------------------- _input_process:: add sp, #-15 ;src/main.c:1164: UINT8 input = joypad(); call _joypad ldhl sp, #0 ld (hl), e ;src/main.c:1165: UINT8 new_input = input & ~prev_input; ld a, (#_input_process_prev_input_65536_387) cpl ldhl sp, #0 and a, (hl) ;src/main.c:1166: if (new_input) { ld c, a or a, a jp Z, 00206$ ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, (#_flags) and a, #0x18 ld b, a ld e, #0x00 ;src/main.c:1169: if (new_input & J_START) { ld a, c and a, #0x80 ldhl sp, #1 ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1171: if (flags & FLAG_PLAYING_ANIMATION) ld a, (#_flags) ldhl sp, #3 ld (hl), a ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, b or a, a or a, e jr Z, 00101$ ;src/main.c:1187: } else if (new_input & J_A) { ld a, c and a, #0x10 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1195: && cursor.pile_idx < 2u) { ld a, c and a, #0x01 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1198: && cursor.pile_idx) { ld a, c and a, #0x02 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1200: } else if (new_input & J_UP) { ld a, c and a, #0x04 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1202: } else if (new_input & J_DOWN) { ld a, c and a, #0x08 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1181: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #3 ld a, (hl) or a, #0x01 ldhl sp, #14 ld (hl), a ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, b sub a, #0x08 or a, e jr Z, 00111$ ld a, b sub a, #0x10 or a, e jp Z,00161$ ld a, b sub a, #0x18 or a, e jp Z,00140$ jp 00206$ ;src/main.c:1168: case FLAG_GAME_STATE_SPLASH: 00101$: ;src/main.c:1169: if (new_input & J_START) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00109$ ;src/main.c:1170: initrand(DIV_REG); ldh a, (_DIV_REG+0) ld c, a ld b, #0x00 push bc call _initrand add sp, #2 ;src/main.c:1171: if (flags & FLAG_PLAYING_ANIMATION) ld a, (#_flags) bit 2, a jr Z, 00103$ ;src/main.c:1172: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation 00103$: ;src/main.c:1072: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ld (hl), a ;src/main.c:1073: flags |= FLAG_GAME_STATE_SETTINGS | FLAG_REDRAW_CURSOR; ld a, (hl) or a, #0x19 ld (hl), a ;src/main.c:1074: cursor.pile_idx = 0; ld hl, #(_cursor + 0x0006) ld (hl), #0x00 ;src/main.c:1075: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ;src/main.c:1076: draw_setting_frame_metasprites(); call _draw_setting_frame_metasprites ;src/main.c:1077: clear_bkg(); call _clear_bkg ;src/main.c:1078: draw_bkg_settings(); call _draw_bkg_settings ;src/main.c:1173: start_settings(); jp 00206$ 00109$: ;src/main.c:1174: } else if (new_input & J_SELECT) { bit 6, c jp Z,00206$ ;src/main.c:1175: if (flags & FLAG_PLAYING_ANIMATION) ldhl sp, #3 bit 2, (hl) jr Z, 00105$ ;src/main.c:1176: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation 00105$: ;src/main.c:1177: start_leaderboard(); call _start_leaderboard ;src/main.c:1179: break; jp 00206$ ;src/main.c:1180: case FLAG_GAME_STATE_LEADERBOARD: 00111$: ;src/main.c:1181: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1182: if (selected_leaderboard) { ld hl, #_selected_leaderboard + 1 ld a, (hl-) or a, (hl) jp Z, 00138$ ;src/main.c:1184: && cursor.pile_idx == 2u) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00132$ ld a, (#(_cursor + 0x0006) + 0) sub a, #0x02 jr NZ, 00132$ ;src/main.c:1185: selected_leaderboard = NULL; ld hl, #_selected_leaderboard ld a, #0x00 ld (hl+), a ld (hl), #0x00 ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), #0x00 ;src/main.c:1186: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_NONE); jp 00206$ 00132$: ;src/main.c:1187: } else if (new_input & J_A) { ldhl sp, #5 ld a, (hl-) or a, (hl) jr Z, 00129$ ;src/main.c:1188: if (cursor.pile_idx == 2u) { ld bc, #_cursor+6 ld a, (bc) cp a, #0x02 jr NZ, 00113$ ;src/main.c:1189: selected_leaderboard = NULL; ld hl, #_selected_leaderboard ld a, #0x00 ld (hl+), a ld (hl), #0x00 ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), #0x00 ;src/main.c:1190: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_NONE); jp 00206$ 00113$: ;src/main.c:1192: cursor.pile_idx++; inc a ld (bc), a jp 00206$ 00129$: ;src/main.c:1195: && cursor.pile_idx < 2u) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00125$ ld bc, #_cursor+6 ld a, (bc) cp a, #0x02 jr NC, 00125$ ;src/main.c:1196: cursor.pile_idx++; inc a ld (bc), a jp 00206$ 00125$: ;src/main.c:1198: && cursor.pile_idx) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00121$ ld bc, #_cursor+6 ld a, (bc) or a, a jr Z, 00121$ ;src/main.c:1199: cursor.pile_idx--; dec a ld (bc), a jp 00206$ 00121$: ;src/main.c:1200: } else if (new_input & J_UP) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00118$ ;src/main.c:1201: inc_letter(1); ld a, #0x01 push af inc sp call _inc_letter inc sp jp 00206$ 00118$: ;src/main.c:1202: } else if (new_input & J_DOWN) { ldhl sp, #13 ld a, (hl-) or a, (hl) jp Z, 00206$ ;src/main.c:1203: inc_letter(-1); ld a, #0xff push af inc sp call _inc_letter inc sp jp 00206$ 00138$: ;src/main.c:1205: } else if (new_input & (J_START | J_SELECT | J_A | J_B)) { ld a, c and a, #0xf0 jp Z,00206$ ;src/main.c:1206: start_splash_screen(); call _start_splash_screen ;src/main.c:1208: break; jp 00206$ ;src/main.c:1209: case FLAG_GAME_STATE_SETTINGS: 00140$: ;src/main.c:1210: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1211: if (new_input & J_START) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00157$ ;src/main.c:1212: start_game(); call _start_game jr 00158$ 00157$: ;src/main.c:1214: && cursor.height) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00153$ ld bc, #_cursor+7 ld a, (bc) or a, a jr Z, 00153$ ;src/main.c:1215: cursor.height--; dec a ld (bc), a jr 00158$ 00153$: ;src/main.c:1217: && cursor.height + 1u < setting_pile_heights[cursor.pile_idx]) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00149$ ld hl, #(_cursor + 0x0007) ld c, (hl) ld e, c ld d, #0x00 inc de ld a, (#_cursor + 6) add a, #<(_setting_pile_heights) ld l, a ld a, #0x00 adc a, #>(_setting_pile_heights) ld h, a ld l, (hl) ld b, #0x00 ld a, e sub a, l ld a, d sbc a, b jr NC, 00149$ ;src/main.c:1218: cursor.height++; inc c ld hl, #(_cursor + 0x0007) ld (hl), c jr 00158$ 00149$: ;src/main.c:1220: && cursor.pile_idx) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00145$ ld bc, #_cursor + 6 ld a, (bc) or a, a jr Z, 00145$ ;src/main.c:1221: cursor.pile_idx--; dec a ld (bc), a ;src/main.c:1222: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 jr 00158$ 00145$: ;src/main.c:1224: && cursor.pile_idx < NUM_SETTING_PILES - 1u) { ldhl sp, #13 ld a, (hl-) or a, (hl) jr Z, 00158$ ld bc, #_cursor + 6 ld a, (bc) cp a, #0x03 jr NC, 00158$ ;src/main.c:1225: cursor.pile_idx++; inc a ld (bc), a ;src/main.c:1226: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 00158$: ;src/main.c:1228: if (new_input & J_A) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00206$ ;src/main.c:1229: set_cursor_setting(); call _set_cursor_setting ;src/main.c:1231: break; jp 00206$ ;src/main.c:1232: case FLAG_GAME_STATE_INGAME: 00161$: ;src/main.c:1233: if (cursor.held_card) { ld hl, #_cursor ld a, (hl+) or a,(hl) jp Z, 00202$ ;src/main.c:1234: flags |= FLAG_REDRAW_HAND; ldhl sp, #3 ld a, (hl) or a, #0x02 ld (#_flags),a ;src/main.c:1236: && cursor.hand_pile_idx != 0) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00166$ ld bc, #_cursor+5 ld a, (bc) or a, a jr Z, 00166$ ;src/main.c:1237: cursor.hand_pile_idx--; dec a ld (bc), a jr 00167$ 00166$: ;src/main.c:1239: && cursor.hand_pile_idx < 9) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00167$ ld bc, #_cursor+5 ld a, (bc) cp a, #0x09 jr NC, 00167$ ;src/main.c:1240: cursor.hand_pile_idx++; inc a ld (bc), a 00167$: ;src/main.c:1243: && ~flags & FLAG_PLAYING_ANIMATION) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00206$ ld a, (#_flags) ld b, #0x00 cpl ld c, a ld a, b cpl bit 2, c jp Z,00206$ ;src/main.c:795: Pile *pile = IDX_PTR(piles, cursor.hand_pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0005) + 0) ldhl sp, #14 ld (hl), a ldhl sp, #14 ld e, (hl) ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ld c, l ld b, h ;src/main.c:796: if (cursor.hand_pile_idx == cursor.pile_idx) { ld hl, #_cursor + 6 ld e, (hl) ldhl sp, #14 ld a, (hl) sub a, e jr NZ, 00214$ ;src/main.c:797: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 jp 00206$ 00214$: ;src/main.c:798: } else if (!pile->height ld hl, #0x0004 add hl, bc ld a, (hl) or a, a jr Z, 00212$ ;src/main.c:799: || RANK(pile->top->data) == RANK(cursor.held_card->data) + 1u) { ld l, c ld h, b inc hl inc hl ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ldhl sp, #13 ld (hl), a xor a, a inc hl ld (hl), a ld hl, #_cursor ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ld e, a ld d, #0x00 inc de ldhl sp, #13 ld a, (hl) sub a, e jp NZ,00206$ inc hl ld a, (hl) sub a, d jp NZ,00206$ 00212$: ;src/main.c:800: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 ;src/main.c:801: score--; ld hl, #_score + 1 dec hl ld a, (hl+) ld e, a ld d, (hl) dec de dec hl ld a, e ld (hl+), a ld (hl), d ;src/main.c:1244: cursor_place_stack(); jp 00206$ 00202$: ;src/main.c:1247: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1248: if (new_input & J_DOWN) { ldhl sp, #13 ld a, (hl-) or a, (hl) jr Z, 00192$ ;src/main.c:1249: if (cursor.pile_idx == PILE_IDX_DECK) ld hl, #_cursor + 6 ld c, (hl) ld a, c ;src/main.c:1250: cursor.pile_idx = 0; sub a,#0x0a jr NZ, 00175$ ld (hl),a jr 00193$ 00175$: ;src/main.c:1251: else if (cursor.height + 1u < piles[cursor.pile_idx].height) ld a, (#(_cursor + 0x0007) + 0) ld d, #0x00 ld e, a inc de ldhl sp, #13 ld a, e ld (hl+), a ld (hl), d ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld de, #_piles add hl, de ld bc, #0x0004 add hl, bc ld c, (hl) ld b, #0x00 ldhl sp, #13 ld a, (hl) sub a, c inc hl ld a, (hl) sbc a, b jr NC, 00193$ ;src/main.c:1252: change_cursor_height(1); ld a, #0x01 push af inc sp call _change_cursor_height inc sp jr 00193$ 00192$: ;src/main.c:1253: } else if (new_input & J_UP) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00189$ ;src/main.c:1254: if (cursor.height == 0) ld a, (#(_cursor + 0x0007) + 0) or a, a jr NZ, 00178$ ;src/main.c:1255: cursor.pile_idx = PILE_IDX_DECK; ld hl, #(_cursor + 0x0006) ld (hl), #0x0a jr 00193$ 00178$: ;src/main.c:1257: change_cursor_height(-1); ld a, #0xff push af inc sp call _change_cursor_height inc sp jr 00193$ 00189$: ;src/main.c:1259: && cursor.pile_idx != 0 ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00184$ ld bc, #_cursor+6 ld a, (bc) or a, a jr Z, 00184$ ;src/main.c:1260: && cursor.pile_idx != PILE_IDX_DECK) { cp a, #0x0a jr Z, 00184$ ;src/main.c:1261: cursor.pile_idx--; dec a ld (bc), a ;src/main.c:1262: cursor_adjust_height(); call _cursor_adjust_height jr 00193$ 00184$: ;src/main.c:1264: && cursor.pile_idx < PILE_IDX_DECK - 1u) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00193$ ld bc, #_cursor+6 ld a, (bc) cp a, #0x09 jr NC, 00193$ ;src/main.c:1265: cursor.pile_idx++; inc a ld (bc), a ;src/main.c:1266: cursor_adjust_height(); call _cursor_adjust_height 00193$: ;src/main.c:1269: && ~flags & FLAG_PLAYING_ANIMATION) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00206$ ld a, (#_flags) ld b, #0x00 cpl ld c, a ld a, b cpl bit 2, c jp Z,00206$ ;src/main.c:1270: if (cursor.pile_idx == PILE_IDX_DECK && top_card_idx != 104u) ld hl, #(_cursor + 0x0006) ld c, (hl) ld a, c sub a, #0x0a jp NZ,00195$ ld a, (#_top_card_idx) sub a, #0x68 jp Z,00195$ ;src/main.c:985: Pile *pile = IDX_PTR(piles, 0); ld bc, #_piles ;src/main.c:988: for (i = 0; i < 10u; i++) { ld e, #0x00 00230$: ;src/main.c:989: if (!pile->height) ld hl, #0x0004 add hl, bc ld a, (hl) or a, a jp Z, 00206$ ;src/main.c:991: pile++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:988: for (i = 0; i < 10u; i++) { inc e ld a, e sub a, #0x0a jr C, 00230$ ;src/main.c:994: pile = IDX_PTR(piles, 0); ldhl sp, #12 ld a, #<(_piles) ld (hl+), a ld (hl), #>(_piles) ;src/main.c:995: Card *deck_top = IDX_PTR(deck, top_card_idx); ld hl, #_top_card_idx ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, bc ld bc,#_deck add hl,bc ld c, l ld b, h ;src/main.c:996: top_card_idx += 10u; ld hl, #_top_card_idx ld a, (hl) add a, #0x0a ld (hl), a ;src/main.c:999: for (i = 0; i < 10u; i++) { ldhl sp, #14 ld (hl), #0x0a 00234$: ;src/main.c:1000: pile->top->next_card = deck_top; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0002 add hl, de push hl ld a, l ldhl sp, #12 ld (hl), a pop hl ld a, h ldhl sp, #11 ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld l, a inc de ld a, (de) ld h, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:1001: pile->top = deck_top; ldhl sp, #10 ld a, (hl+) ld h, (hl) ld l, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:1002: pile->height++; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld e, l ld d, h ld a, (de) inc a ld (de), a ;src/main.c:1003: deck_top++; inc bc inc bc inc bc ;src/main.c:1004: pile++; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0005 add hl, de push hl ld a, l ldhl sp, #14 ld (hl), a pop hl ld a, h ldhl sp, #13 ld (hl+), a ;src/main.c:999: for (i = 0; i < 10u; i++) { dec (hl) ld a, (hl) jr NZ, 00234$ ;src/main.c:1007: dynamic_metasprite_deal(); call _dynamic_metasprite_deal ;src/main.c:1271: deal(); jp 00206$ 00195$: ;src/main.c:769: Pile *pile = IDX_PTR(piles, cursor.pile_idx); ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld a, #<(_piles) add a, l ld c, a ld a, #>(_piles) adc a, h ld b, a ldhl sp, #10 ld a, c ld (hl+), a ;src/main.c:770: Card *top = pile->base; ld a, b ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) inc hl inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) ld b, #0x01 00236$: ld hl, #(_cursor + 0x0007) ld c, (hl) ld a, b sub a, c jr NC, 00222$ ;src/main.c:772: top = top->next_card; ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) dec hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) inc b jr 00236$ 00222$: ;src/main.c:773: Card *stack = cursor.height ? top->next_card : top; ld a, c or a, a jr Z, 00240$ ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld c, a inc de ld a, (de) ld b, a jr 00241$ 00240$: ldhl sp,#13 ld a, (hl+) ld c, a ld b, (hl) 00241$: ;src/main.c:774: if (!(VISIBLE(stack->data) && is_stack_coherent(stack))) ld e, c ld d, b inc de inc de ld a, (de) bit 6, a jr Z, 00206$ push bc push bc call _is_stack_coherent add sp, #2 ld a, e pop bc or a, a jr Z, 00206$ ;src/main.c:777: cursor.held_card = stack; ld hl, #_cursor ld a, c ld (hl+), a ld (hl), b ;src/main.c:778: cursor.hand_pile_idx = cursor.pile_idx; ld a, (#(_cursor + 0x0006) + 0) ld (#(_cursor + 0x0005)),a ;src/main.c:779: cursor.held_stack_size = pile->height - cursor.height; ;c ldhl sp,#10 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld c, l ld b, h ld a, (bc) ld hl, #(_cursor + 0x0007) ld l, (hl) sub a, l ld (#(_cursor + 0x0004)),a ;src/main.c:780: pile->height = cursor.height; ld a, (#(_cursor + 0x0007) + 0) ld (bc), a ;src/main.c:781: flags |= FLAG_REDRAW_HAND; ld hl, #_flags ld a, (hl) or a, #0x02 ld (hl), a ;src/main.c:782: if (cursor.height) { ld a, (#(_cursor + 0x0007) + 0) ldhl sp, #12 ld (hl), a ;src/main.c:783: pile->top = top; ldhl sp,#10 ld a, (hl+) ld c, a ld b, (hl) inc bc inc bc ;src/main.c:785: cursor.card_to_show = top; ;src/main.c:782: if (cursor.height) { inc hl ld a, (hl) or a, a jr Z, 00227$ ;src/main.c:783: pile->top = top; inc hl ld a, (hl+) ld (bc), a inc bc ld a, (hl) ld (bc), a ;src/main.c:784: top->next_card = NULL; dec hl ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:785: cursor.card_to_show = top; ld de, #(_cursor + 0x0002) ldhl sp, #13 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a jr 00206$ 00227$: ;src/main.c:787: pile->base = NULL; ldhl sp, #10 ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:788: pile->top = NULL; xor a, a ld (bc), a inc bc ld (bc), a ;src/main.c:789: cursor.card_to_show = NULL; ld hl, #(_cursor + 0x0002) xor a, a ld (hl+), a ld (hl), a ;src/main.c:1277: } 00206$: ;src/main.c:1279: prev_input = input; ldhl sp, #0 ld a, (hl) ld (#_input_process_prev_input_65536_387),a ;src/main.c:1280: } add sp, #15 ret ;src/main.c:1282: void main(void) ; --------------------------------- ; Function main ; --------------------------------- _main:: add sp, #-15 ;src/main.c:1284: font_init(); call _font_init ;src/main.c:1285: font_t font = font_load(font_min); ld hl, #_font_min push hl call _font_load add sp, #2 ;src/main.c:1286: font_set(font); push de call _font_set add sp, #2 ;src/main.c:1287: set_bkg_data(OFFSET_BKG_FONT_ADDON, N_FONT_ADDON, font_addon); ld hl, #_font_addon push hl ld de, #0x0125 push de call _set_bkg_data add sp, #4 ;src/main.c:1289: set_bkg_data(OFFSET_BKG_TITLE, N_TITLE, title_textures); ld hl, #_title_textures push hl ld de, #0x3080 push de call _set_bkg_data add sp, #4 ;src/main.c:1290: set_bkg_data(OFFSET_BKG_CARD, N_CARD, card_textures); ld hl, #_card_textures push hl ld de, #0x3ab0 push de call _set_bkg_data add sp, #4 ;src/main.c:1291: set_bkg_data(OFFSET_BKG_CARD_ADDON, N_CARD_ADDON, card_addon); ld hl, #_card_addon push hl ld de, #0x1726 push de call _set_bkg_data add sp, #4 ;src/main.c:1292: set_bkg_data(OFFSET_BKG_BUTTON, N_BUTTON, button_textures); ld hl, #_button_textures push hl ld de, #0x073d push de call _set_bkg_data add sp, #4 ;src/main.c:1293: set_sprite_data(OFFSET_SPRITE_CURSOR, N_CURSOR, cursor_textures); ld hl, #_cursor_textures push hl ld de, #0x0a01 push de call _set_sprite_data add sp, #4 ;src/main.c:1295: nvram_check(); call _nvram_check ;src/main.c:1297: start_splash_screen(); call _start_splash_screen ;src/main.c:1299: SHOW_BKG; ldh a, (_LCDC_REG+0) or a, #0x01 ldh (_LCDC_REG+0),a ;src/main.c:1300: SHOW_SPRITES; ldh a, (_LCDC_REG+0) or a, #0x02 ldh (_LCDC_REG+0),a ;src/main.c:1301: DISPLAY_ON; ldh a, (_LCDC_REG+0) or a, #0x80 ldh (_LCDC_REG+0),a ;src/main.c:1303: while (1) { 00102$: ;src/main.c:1164: UINT8 input = joypad(); call _joypad ldhl sp, #0 ld (hl), e ;src/main.c:1165: UINT8 new_input = input & ~prev_input; ld a, (#_main_prev_input_327681_450) cpl ldhl sp, #0 and a, (hl) ;src/main.c:1166: if (new_input) { ld c, a or a, a jp Z, 00232$ ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, (#_flags) and a, #0x18 ld b, a ld e, #0x00 ;src/main.c:1169: if (new_input & J_START) { ld a, c and a, #0x80 ldhl sp, #1 ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1171: if (flags & FLAG_PLAYING_ANIMATION) ld a, (#_flags) ldhl sp, #3 ld (hl), a ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, b or a, a or a, e jr Z, 00114$ ;src/main.c:1187: } else if (new_input & J_A) { ld a, c and a, #0x10 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1195: && cursor.pile_idx < 2u) { ld a, c and a, #0x01 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1198: && cursor.pile_idx) { ld a, c and a, #0x02 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1200: } else if (new_input & J_UP) { ld a, c and a, #0x04 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1202: } else if (new_input & J_DOWN) { ld a, c and a, #0x08 inc hl ld (hl), a xor a, a inc hl ld (hl), a ;src/main.c:1181: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #3 ld a, (hl) or a, #0x01 ldhl sp, #14 ld (hl), a ;src/main.c:1167: switch (flags & FLAG_GAME_STATE) { ld a, b sub a, #0x08 or a, e jr Z, 00115$ ld a, b sub a, #0x10 or a, e jp Z,00229$ ld a, b sub a, #0x18 or a, e jp Z,00146$ jp 00232$ ;src/main.c:1168: case FLAG_GAME_STATE_SPLASH: 00114$: ;src/main.c:1169: if (new_input & J_START) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00112$ ;src/main.c:1170: initrand(DIV_REG); ldh a, (_DIV_REG+0) ld c, a ld b, #0x00 push bc call _initrand add sp, #2 ;src/main.c:1171: if (flags & FLAG_PLAYING_ANIMATION) ld a, (#_flags) bit 2, a jr Z, 00105$ ;src/main.c:1172: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation 00105$: ;src/main.c:1072: flags &= ~FLAG_GAME_STATE; ld hl, #_flags ld a, (hl) and a, #0xe7 ld (hl), a ;src/main.c:1073: flags |= FLAG_GAME_STATE_SETTINGS | FLAG_REDRAW_CURSOR; ld a, (hl) or a, #0x19 ld (hl), a ;src/main.c:1074: cursor.pile_idx = 0; ld hl, #(_cursor + 0x0006) ld (hl), #0x00 ;src/main.c:1075: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 ;src/main.c:1076: draw_setting_frame_metasprites(); call _draw_setting_frame_metasprites ;src/main.c:1077: clear_bkg(); call _clear_bkg ;src/main.c:1078: draw_bkg_settings(); call _draw_bkg_settings ;src/main.c:1173: start_settings(); jp 00232$ 00112$: ;src/main.c:1174: } else if (new_input & J_SELECT) { bit 6, c jp Z,00232$ ;src/main.c:1175: if (flags & FLAG_PLAYING_ANIMATION) ldhl sp, #3 bit 2, (hl) jr Z, 00109$ ;src/main.c:1176: dynamic_metasprite_end_animation(); call _dynamic_metasprite_end_animation 00109$: ;src/main.c:1177: start_leaderboard(); call _start_leaderboard ;src/main.c:1179: break; jp 00232$ ;src/main.c:1180: case FLAG_GAME_STATE_LEADERBOARD: 00115$: ;src/main.c:1181: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1182: if (selected_leaderboard) { ld hl, #_selected_leaderboard + 1 ld a, (hl-) or a, (hl) jp Z, 00144$ ;src/main.c:1184: && cursor.pile_idx == 2u) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00139$ ld a, (#(_cursor + 0x0006) + 0) sub a, #0x02 jr NZ, 00139$ ;src/main.c:1185: selected_leaderboard = NULL; ld hl, #_selected_leaderboard ld a, #0x00 ld (hl+), a ld (hl), #0x00 ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), #0x00 ;src/main.c:1186: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_NONE); jp 00232$ 00139$: ;src/main.c:1187: } else if (new_input & J_A) { ldhl sp, #5 ld a, (hl-) or a, (hl) jr Z, 00137$ ;src/main.c:1188: if (cursor.pile_idx == 2u) { ld bc, #_cursor+6 ld a, (bc) cp a, #0x02 jr NZ, 00121$ ;src/main.c:1189: selected_leaderboard = NULL; ld hl, #_selected_leaderboard ld a, #0x00 ld (hl+), a ld (hl), #0x00 ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), #0x00 ;src/main.c:1190: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_NONE); jp 00232$ 00121$: ;src/main.c:1192: cursor.pile_idx++; inc a ld (bc), a jp 00232$ 00137$: ;src/main.c:1195: && cursor.pile_idx < 2u) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00135$ ld bc, #_cursor+6 ld a, (bc) cp a, #0x02 jr NC, 00135$ ;src/main.c:1196: cursor.pile_idx++; inc a ld (bc), a jp 00232$ 00135$: ;src/main.c:1198: && cursor.pile_idx) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00133$ ld bc, #_cursor+6 ld a, (bc) or a, a jr Z, 00133$ ;src/main.c:1199: cursor.pile_idx--; dec a ld (bc), a jp 00232$ 00133$: ;src/main.c:1200: } else if (new_input & J_UP) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00131$ ;src/main.c:1201: inc_letter(1); ld a, #0x01 push af inc sp call _inc_letter inc sp jp 00232$ 00131$: ;src/main.c:1202: } else if (new_input & J_DOWN) { ldhl sp, #13 ld a, (hl-) or a, (hl) jp Z, 00232$ ;src/main.c:1203: inc_letter(-1); ld a, #0xff push af inc sp call _inc_letter inc sp jp 00232$ 00144$: ;src/main.c:1205: } else if (new_input & (J_START | J_SELECT | J_A | J_B)) { ld a, c and a, #0xf0 jp Z,00232$ ;src/main.c:1206: start_splash_screen(); call _start_splash_screen ;src/main.c:1208: break; jp 00232$ ;src/main.c:1209: case FLAG_GAME_STATE_SETTINGS: 00146$: ;src/main.c:1210: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1211: if (new_input & J_START) { ldhl sp, #2 ld a, (hl-) or a, (hl) jr Z, 00163$ ;src/main.c:1212: start_game(); call _start_game jr 00164$ 00163$: ;src/main.c:1214: && cursor.height) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00161$ ld bc, #_cursor+7 ld a, (bc) or a, a jr Z, 00161$ ;src/main.c:1215: cursor.height--; dec a ld (bc), a jr 00164$ 00161$: ;src/main.c:1217: && cursor.height + 1u < setting_pile_heights[cursor.pile_idx]) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00159$ ld hl, #(_cursor + 0x0007) ld c, (hl) ld e, c ld d, #0x00 inc de ld a, (#_cursor + 6) add a, #<(_setting_pile_heights) ld l, a ld a, #0x00 adc a, #>(_setting_pile_heights) ld h, a ld l, (hl) ld b, #0x00 ld a, e sub a, l ld a, d sbc a, b jr NC, 00159$ ;src/main.c:1218: cursor.height++; inc c ld hl, #(_cursor + 0x0007) ld (hl), c jr 00164$ 00159$: ;src/main.c:1220: && cursor.pile_idx) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00157$ ld bc, #_cursor + 6 ld a, (bc) or a, a jr Z, 00157$ ;src/main.c:1221: cursor.pile_idx--; dec a ld (bc), a ;src/main.c:1222: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 jr 00164$ 00157$: ;src/main.c:1224: && cursor.pile_idx < NUM_SETTING_PILES - 1u) { ldhl sp, #13 ld a, (hl-) or a, (hl) jr Z, 00164$ ld bc, #_cursor + 6 ld a, (bc) cp a, #0x03 jr NC, 00164$ ;src/main.c:1225: cursor.pile_idx++; inc a ld (bc), a ;src/main.c:1226: cursor.height = 0; ld hl, #(_cursor + 0x0007) ld (hl), #0x00 00164$: ;src/main.c:1228: if (new_input & J_A) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00232$ ;src/main.c:1229: set_cursor_setting(); call _set_cursor_setting ;src/main.c:1231: break; jp 00232$ ;src/main.c:1232: case FLAG_GAME_STATE_INGAME: 00229$: ;src/main.c:1233: if (cursor.held_card) { ld hl, #_cursor ld a, (hl+) or a,(hl) jp Z, 00227$ ;src/main.c:1234: flags |= FLAG_REDRAW_HAND; ldhl sp, #3 ld a, (hl) or a, #0x02 ld (#_flags),a ;src/main.c:1236: && cursor.hand_pile_idx != 0) { ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00172$ ld bc, #_cursor+5 ld a, (bc) or a, a jr Z, 00172$ ;src/main.c:1237: cursor.hand_pile_idx--; dec a ld (bc), a jr 00173$ 00172$: ;src/main.c:1239: && cursor.hand_pile_idx < 9) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00173$ ld bc, #_cursor+5 ld a, (bc) cp a, #0x09 jr NC, 00173$ ;src/main.c:1240: cursor.hand_pile_idx++; inc a ld (bc), a 00173$: ;src/main.c:1243: && ~flags & FLAG_PLAYING_ANIMATION) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00232$ ld a, (#_flags) ld b, #0x00 cpl ld c, a ld a, b cpl bit 2, c jp Z,00232$ ;src/main.c:795: Pile *pile = IDX_PTR(piles, cursor.hand_pile_idx); ld bc, #_piles+0 ld a, (#(_cursor + 0x0005) + 0) ldhl sp, #14 ld (hl), a ldhl sp, #14 ld e, (hl) ld d, #0x00 ld l, e ld h, d add hl, hl add hl, hl add hl, de add hl, bc ld c, l ld b, h ;src/main.c:796: if (cursor.hand_pile_idx == cursor.pile_idx) { ld hl, #_cursor + 6 ld e, (hl) ldhl sp, #14 ld a, (hl) sub a, e jr NZ, 00179$ ;src/main.c:797: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 jp 00232$ 00179$: ;src/main.c:798: } else if (!pile->height ld hl, #0x0004 add hl, bc ld a, (hl) or a, a jr Z, 00177$ ;src/main.c:799: || RANK(pile->top->data) == RANK(cursor.held_card->data) + 1u) { ld l, c ld h, b inc hl inc hl ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ldhl sp, #13 ld (hl), a xor a, a inc hl ld (hl), a ld hl, #_cursor ld a, (hl+) ld h, (hl) ld l, a inc hl inc hl ld a, (hl) and a, #0x0f ld e, a ld d, #0x00 inc de ldhl sp, #13 ld a, (hl) sub a, e jp NZ,00232$ inc hl ld a, (hl) sub a, d jp NZ,00232$ 00177$: ;src/main.c:800: pile_append_cursor_stack(pile); push bc call _pile_append_cursor_stack add sp, #2 ;src/main.c:801: score--; ld hl, #_score + 1 dec hl ld a, (hl+) ld e, a ld d, (hl) dec de dec hl ld a, e ld (hl+), a ld (hl), d ;src/main.c:1244: cursor_place_stack(); jp 00232$ 00227$: ;src/main.c:1247: flags |= FLAG_REDRAW_CURSOR; ldhl sp, #14 ld a, (hl) ld (#_flags),a ;src/main.c:1248: if (new_input & J_DOWN) { ldhl sp, #13 ld a, (hl-) or a, (hl) jr Z, 00205$ ;src/main.c:1249: if (cursor.pile_idx == PILE_IDX_DECK) ld hl, #_cursor + 6 ld c, (hl) ld a, c ;src/main.c:1250: cursor.pile_idx = 0; sub a,#0x0a jr NZ, 00188$ ld (hl),a jr 00206$ 00188$: ;src/main.c:1251: else if (cursor.height + 1u < piles[cursor.pile_idx].height) ld a, (#(_cursor + 0x0007) + 0) ld d, #0x00 ld e, a inc de ldhl sp, #13 ld a, e ld (hl+), a ld (hl), d ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld de, #_piles add hl, de ld bc, #0x0004 add hl, bc ld c, (hl) ld b, #0x00 ldhl sp, #13 ld a, (hl) sub a, c inc hl ld a, (hl) sbc a, b jr NC, 00206$ ;src/main.c:1252: change_cursor_height(1); ld a, #0x01 push af inc sp call _change_cursor_height inc sp jr 00206$ 00205$: ;src/main.c:1253: } else if (new_input & J_UP) { ldhl sp, #11 ld a, (hl-) or a, (hl) jr Z, 00203$ ;src/main.c:1254: if (cursor.height == 0) ld a, (#(_cursor + 0x0007) + 0) or a, a jr NZ, 00192$ ;src/main.c:1255: cursor.pile_idx = PILE_IDX_DECK; ld hl, #(_cursor + 0x0006) ld (hl), #0x0a jr 00206$ 00192$: ;src/main.c:1257: change_cursor_height(-1); ld a, #0xff push af inc sp call _change_cursor_height inc sp jr 00206$ 00203$: ;src/main.c:1259: && cursor.pile_idx != 0 ldhl sp, #9 ld a, (hl-) or a, (hl) jr Z, 00201$ ld bc, #_cursor+6 ld a, (bc) or a, a jr Z, 00201$ ;src/main.c:1260: && cursor.pile_idx != PILE_IDX_DECK) { cp a, #0x0a jr Z, 00201$ ;src/main.c:1261: cursor.pile_idx--; dec a ld (bc), a ;src/main.c:1262: cursor_adjust_height(); call _cursor_adjust_height jr 00206$ 00201$: ;src/main.c:1264: && cursor.pile_idx < PILE_IDX_DECK - 1u) { ldhl sp, #7 ld a, (hl-) or a, (hl) jr Z, 00206$ ld bc, #_cursor+6 ld a, (bc) cp a, #0x09 jr NC, 00206$ ;src/main.c:1265: cursor.pile_idx++; inc a ld (bc), a ;src/main.c:1266: cursor_adjust_height(); call _cursor_adjust_height 00206$: ;src/main.c:1269: && ~flags & FLAG_PLAYING_ANIMATION) { ldhl sp, #5 ld a, (hl-) or a, (hl) jp Z, 00232$ ld a, (#_flags) ld b, #0x00 cpl ld c, a ld a, b cpl bit 2, c jp Z,00232$ ;src/main.c:1270: if (cursor.pile_idx == PILE_IDX_DECK && top_card_idx != 104u) ld hl, #(_cursor + 0x0006) ld c, (hl) ld a, c sub a, #0x0a jp NZ,00223$ ld a, (#_top_card_idx) sub a, #0x68 jp Z,00223$ ;src/main.c:985: Pile *pile = IDX_PTR(piles, 0); ld bc, #_piles ;src/main.c:988: for (i = 0; i < 10u; i++) { ld e, #0x00 00268$: ;src/main.c:989: if (!pile->height) ld hl, #0x0004 add hl, bc ld a, (hl) or a, a jp Z, 00232$ ;src/main.c:991: pile++; inc bc inc bc inc bc inc bc inc bc ;src/main.c:988: for (i = 0; i < 10u; i++) { inc e ld a, e sub a, #0x0a jr C, 00268$ ;src/main.c:994: pile = IDX_PTR(piles, 0); ldhl sp, #12 ld a, #<(_piles) ld (hl+), a ld (hl), #>(_piles) ;src/main.c:995: Card *deck_top = IDX_PTR(deck, top_card_idx); ld hl, #_top_card_idx ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, bc ld bc,#_deck add hl,bc ld c, l ld b, h ;src/main.c:996: top_card_idx += 10u; ld hl, #_top_card_idx ld a, (hl) add a, #0x0a ld (hl), a ;src/main.c:999: for (i = 0; i < 10u; i++) { ldhl sp, #14 ld (hl), #0x0a 00272$: ;src/main.c:1000: pile->top->next_card = deck_top; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0002 add hl, de push hl ld a, l ldhl sp, #12 ld (hl), a pop hl ld a, h ldhl sp, #11 ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld l, a inc de ld a, (de) ld h, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:1001: pile->top = deck_top; ldhl sp, #10 ld a, (hl+) ld h, (hl) ld l, a ld a, c ld (hl+), a ld (hl), b ;src/main.c:1002: pile->height++; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld e, l ld d, h ld a, (de) inc a ld (de), a ;src/main.c:1003: deck_top++; inc bc inc bc inc bc ;src/main.c:1004: pile++; ;c ldhl sp,#12 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0005 add hl, de push hl ld a, l ldhl sp, #14 ld (hl), a pop hl ld a, h ldhl sp, #13 ld (hl+), a ;src/main.c:999: for (i = 0; i < 10u; i++) { dec (hl) ld a, (hl) jr NZ, 00272$ ;src/main.c:1007: dynamic_metasprite_deal(); call _dynamic_metasprite_deal ;src/main.c:1271: deal(); jp 00232$ 00223$: ;src/main.c:769: Pile *pile = IDX_PTR(piles, cursor.pile_idx); ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld a, #<(_piles) add a, l ld c, a ld a, #>(_piles) adc a, h ld b, a ldhl sp, #10 ld a, c ld (hl+), a ;src/main.c:770: Card *top = pile->base; ld a, b ld (hl-), a ld a, (hl+) ld e, a ld d, (hl) ld a, (de) inc hl inc hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) ld b, #0x01 00274$: ld hl, #(_cursor + 0x0007) ld c, (hl) ld a, b sub a, c jr NC, 00215$ ;src/main.c:772: top = top->next_card; ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) dec hl ld (hl+), a inc de ld a, (de) ld (hl), a ;src/main.c:771: for (i = 1; i < cursor.height; i++) inc b jr 00274$ 00215$: ;src/main.c:773: Card *stack = cursor.height ? top->next_card : top; ld a, c or a, a jr Z, 00278$ ldhl sp,#13 ld a, (hl+) ld e, a ld d, (hl) ld a, (de) ld c, a inc de ld a, (de) ld b, a jr 00279$ 00278$: ldhl sp,#13 ld a, (hl+) ld c, a ld b, (hl) 00279$: ;src/main.c:774: if (!(VISIBLE(stack->data) && is_stack_coherent(stack))) ld e, c ld d, b inc de inc de ld a, (de) bit 6, a jr Z, 00232$ push bc push bc call _is_stack_coherent add sp, #2 ld a, e pop bc or a, a jr Z, 00232$ ;src/main.c:777: cursor.held_card = stack; ld hl, #_cursor ld a, c ld (hl+), a ld (hl), b ;src/main.c:778: cursor.hand_pile_idx = cursor.pile_idx; ld a, (#(_cursor + 0x0006) + 0) ld (#(_cursor + 0x0005)),a ;src/main.c:779: cursor.held_stack_size = pile->height - cursor.height; ;c ldhl sp,#10 ld a, (hl+) ld e, a ld d, (hl) ld hl, #0x0004 add hl, de ld c, l ld b, h ld a, (bc) ld hl, #(_cursor + 0x0007) ld l, (hl) sub a, l ld (#(_cursor + 0x0004)),a ;src/main.c:780: pile->height = cursor.height; ld a, (#(_cursor + 0x0007) + 0) ld (bc), a ;src/main.c:781: flags |= FLAG_REDRAW_HAND; ld hl, #_flags ld a, (hl) or a, #0x02 ld (hl), a ;src/main.c:782: if (cursor.height) { ld a, (#(_cursor + 0x0007) + 0) ldhl sp, #12 ld (hl), a ;src/main.c:783: pile->top = top; ldhl sp,#10 ld a, (hl+) ld c, a ld b, (hl) inc bc inc bc ;src/main.c:785: cursor.card_to_show = top; ;src/main.c:782: if (cursor.height) { inc hl ld a, (hl) or a, a jr Z, 00220$ ;src/main.c:783: pile->top = top; inc hl ld a, (hl+) ld (bc), a inc bc ld a, (hl) ld (bc), a ;src/main.c:784: top->next_card = NULL; dec hl ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:785: cursor.card_to_show = top; ld de, #(_cursor + 0x0002) ldhl sp, #13 ld a, (hl) ld (de), a inc de inc hl ld a, (hl) ld (de), a jr 00232$ 00220$: ;src/main.c:787: pile->base = NULL; ldhl sp, #10 ld a, (hl+) ld h, (hl) ld l, a xor a, a ld (hl+), a ld (hl), a ;src/main.c:788: pile->top = NULL; xor a, a ld (bc), a inc bc ld (bc), a ;src/main.c:789: cursor.card_to_show = NULL; ld hl, #(_cursor + 0x0002) xor a, a ld (hl+), a ld (hl), a ;src/main.c:1277: } 00232$: ;src/main.c:1279: prev_input = input; ldhl sp, #0 ld a, (hl) ld (#_main_prev_input_327681_450),a ;src/main.c:843: switch (flags & FLAG_GAME_STATE) { ld a, (#_flags) and a, #0x18 ld b, a ld c, #0x00 ld a, b or a, a or a, c jp Z,00260$ ;src/main.c:847: cursor.anim_ctr++; ld hl, #_cursor + 8 ld d, (hl) inc d ld (hl), d ;src/main.c:848: cursor.anim_ctr &= (1u << (CURSOR_PERIOD_LOGSCALE + 1u)) - 1u; res 7, d ld (hl), d ;src/main.c:849: UINT8 prev_anim_frame = cursor.anim_frame; ld bc, #_cursor + 9 ld a, (bc) ld e, a ;src/main.c:850: cursor.anim_frame = cursor.anim_ctr >> CURSOR_PERIOD_LOGSCALE; ld a, d rlca rlca and a, #0x03 ld (bc), a ;src/main.c:851: if (cursor.anim_frame != prev_anim_frame) sub a, e jr Z, 00237$ ;src/main.c:852: flags |= FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) or a, #0x01 ld (hl), a 00237$: ;src/main.c:854: if (flags & FLAG_REDRAW_CURSOR) { ld a, (#_flags) rrca jp NC,00253$ ;src/main.c:855: flags &= ~FLAG_REDRAW_CURSOR; ld hl, #_flags ld a, (hl) and a, #0xfe ld (hl), a ;src/main.c:856: switch (flags & FLAG_GAME_STATE) { ld a, (hl) and a, #0x18 ld l, a ld h, #0x00 ld a, l sub a, #0x08 or a, h jr Z, 00244$ ;src/main.c:862: SETTINGS_PAD_Y * 8u + cursor.pile_idx * 32u ld de, #_cursor + 6 ;src/main.c:861: cursor.height * 16u + SETTINGS_SPLIT_X * 8u, ;src/main.c:856: switch (flags & FLAG_GAME_STATE) { ld a, l sub a, #0x10 or a, h jr Z, 00250$ ld a, l sub a, #0x18 or a, h jp NZ,00253$ ;src/main.c:862: SETTINGS_PAD_Y * 8u + cursor.pile_idx * 32u ld a, (de) swap a rlca and a, #0xe0 add a, #0x08 ldhl sp, #13 ld (hl), a ;src/main.c:861: cursor.height * 16u + SETTINGS_SPLIT_X * 8u, ld a, (#(_cursor + 0x0007) + 0) swap a and a, #0xf0 add a, #0x50 inc hl ld (hl), a ;src/main.c:858: move_metasprite(cursor_metasprites[cursor.anim_frame], ld de, #_cursor_metasprites+0 ld a, (bc) ld l, a ld h, #0x00 add hl, hl add hl, de ld a, (hl+) ld c, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl+), a ld (hl), c ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ldhl sp, #13 ld a, (hl) push af inc sp inc hl ld d, (hl) ld e,#0x0c push de call ___move_metasprite add sp, #3 ;src/main.c:864: break; jp 00253$ ;src/main.c:865: case FLAG_GAME_STATE_LEADERBOARD: 00244$: ;src/main.c:866: if (selected_leaderboard) { ld hl, #_selected_leaderboard + 1 ld a, (hl-) or a, (hl) jp Z, 00253$ ;src/main.c:867: set_sprite_tile(SPRITE_FRAME, OFFSET_SPRITE_CURSOR + OFFSET_CURSOR_UNDERLINE + cursor.anim_frame); ld a, (bc) add a, #0x09 ld c, a ;/home/wojtek/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 0x0032) ld (hl), c ;src/main.c:868: move_sprite(SPRITE_FRAME, (LEADERBOARD_NAME_X + 1u) * 8u + cursor.pile_idx * 8u, 16u + cursor.height * 8u); ld a, (#(_cursor + 0x0007) + 0) add a, a add a, a add a, a add a, #0x10 ld c, a ld a, (#(_cursor + 0x0006) + 0) add a, a add a, a add a, a add a, #0x48 ld e, a ;/home/wojtek/gbdk/include/gb/gb.h:1218: OAM_item_t * itm = &shadow_OAM[nb]; ld hl, #(_shadow_OAM + 0x0030) ;/home/wojtek/gbdk/include/gb/gb.h:1219: itm->y=y, itm->x=x; ld a, c ld (hl+), a ld (hl), e ;src/main.c:870: break; jr 00253$ ;src/main.c:871: case FLAG_GAME_STATE_INGAME: 00250$: ;src/main.c:872: if (cursor.pile_idx == PILE_IDX_DECK) ld a, (de) ldhl sp, #14 ld (hl), a ;src/main.c:849: UINT8 prev_anim_frame = cursor.anim_frame; ld a, (bc) ;src/main.c:873: move_metasprite(cursor_metasprites[cursor.anim_frame], ld l, a ld h, #0x00 add hl, hl ld c, l ld b, h ;src/main.c:872: if (cursor.pile_idx == PILE_IDX_DECK) ldhl sp, #14 ld a, (hl) sub a, #0x0a jr NZ, 00248$ ;src/main.c:873: move_metasprite(cursor_metasprites[cursor.anim_frame], ld hl, #_cursor_metasprites add hl, bc ld a, (hl+) ld c, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl+), a ld (hl), c ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); xor a, a push af inc sp xor a, a ld d,a ld e,#0x0c push de call ___move_metasprite add sp, #3 ;src/main.c:878: ); jr 00253$ 00248$: ;src/main.c:884: (cursor.height + 3u - scroll) * 8u ld a, (#(_cursor + 0x0007) + 0) add a, #0x03 ld hl, #_scroll sub a, (hl) add a, a add a, a add a, a ldhl sp, #13 ;src/main.c:883: cursor.pile_idx * 16u, ld (hl+), a ld a, (hl) swap a and a, #0xf0 ld (hl), a ;src/main.c:880: move_metasprite(cursor_metasprites[cursor.anim_frame], ld hl, #_cursor_metasprites add hl, bc ld a, (hl+) ld c, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl+), a ld (hl), c ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x01 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ldhl sp, #13 ld a, (hl) push af inc sp inc hl ld d, (hl) ld e,#0x0c push de call ___move_metasprite add sp, #3 ;src/main.c:887: } 00253$: ;src/main.c:890: if (flags & FLAG_REDRAW_HAND) { ld a, (#_flags) bit 1, a jr Z, 00260$ ;src/main.c:891: flags &= ~FLAG_REDRAW_HAND; ld hl, #_flags ld a, (hl) and a, #0xfd ld (hl), a ;src/main.c:892: if (cursor.held_card) { ld hl, #_cursor ld a, (hl+) or a,(hl) jr Z, 00256$ ;src/main.c:893: UINT8 height = piles[cursor.hand_pile_idx].height; ld hl, #_cursor + 5 ld c, (hl) ld b, #0x00 ld l, c ld h, b add hl, hl add hl, hl add hl, bc ld de, #_piles add hl, de inc hl inc hl inc hl inc hl ld b, (hl) ;src/main.c:898: (height + !height + 2u - scroll) * 8u ld a, b sub a,#0x01 ld a, #0x00 rla add a, b add a, #0x02 ld hl, #_scroll ld b, (hl) sub a, b add a, a add a, a add a, a ld d, a ;src/main.c:897: cursor.hand_pile_idx * 16u, ld a, c swap a and a, #0xf0 ld b, a ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl), #<(_metasprite_sequential_2x3) inc hl ld (hl), #>(_metasprite_sequential_2x3) ;/home/wojtek/gbdk/include/gb/metasprites.h:80: __current_base_tile = base_tile; ld hl, #___current_base_tile ld (hl), #0x03 ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ld e, b push de ld a, #0x06 push af inc sp call ___move_metasprite add sp, #3 ;src/main.c:899: ); jr 00260$ 00256$: ;src/main.c:901: metasprite_2x3_hide(SPRITE_HAND); ld a, #0x06 push af inc sp call _metasprite_2x3_hide inc sp ;src/main.c:1306: cursor_process(); 00260$: ;src/main.c:739: if (dynamic_metasprite.elapsed_frames >= dynamic_metasprite.target_frames) ld hl, #(_dynamic_metasprite + 0x0009) ld c, (hl) ld hl, #(_dynamic_metasprite + 0x0008) ld b, (hl) ld e, b ld a,c ld d,a sub a, b bit 7, e jr Z, 00712$ bit 7, d jr NZ, 00713$ cp a, a jr 00713$ 00712$: bit 7, d jr Z, 00713$ scf 00713$: jp NC, 00267$ ;src/main.c:742: dynamic_metasprite.elapsed_frames++; inc c ld hl, #(_dynamic_metasprite + 0x0009) ld (hl), c ;src/main.c:747: (INT16)scroll * -8 + dynamic_metasprite.src[1] + (dynamic_metasprite.dist[1] * dynamic_metasprite.elapsed_frames / dynamic_metasprite.target_frames) ld a, (#_scroll) ld e, a add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, e add a, a add a, a add a, a ld hl, #_dynamic_metasprite + 2 ld e, (hl) add a, e ldhl sp, #10 ld (hl), a ld hl, #_dynamic_metasprite + 6 ld a, (hl+) ld h, (hl) ld l, a ld a, c rla sbc a, a ld b, a push bc push bc push hl call __mulint add sp, #4 push hl ldhl sp, #17 ld (hl), e ldhl sp, #18 ld (hl), d pop hl pop bc ld a, (#(_dynamic_metasprite + 0x0008) + 0) ldhl sp, #11 ld (hl), a rla sbc a, a inc hl ld (hl), a push bc dec hl ld a, (hl+) ld h, (hl) ld l, a push hl ldhl sp, #17 ld a, (hl+) ld h, (hl) ld l, a push hl call __divsint add sp, #4 pop bc ld a, e ldhl sp, #10 add a, (hl) ldhl sp, #13 ld (hl), a ;src/main.c:746: dynamic_metasprite.src[0] + (dynamic_metasprite.dist[0] * dynamic_metasprite.elapsed_frames / dynamic_metasprite.target_frames), ld a, (#_dynamic_metasprite + 0) ldhl sp, #14 ld (hl), a ld hl, #(_dynamic_metasprite + 0x0004) ld a, (hl+) ld h, (hl) ld l, a push bc push hl call __mulint add sp, #4 ldhl sp, #11 ld a, (hl+) ld h, (hl) ld l, a push hl push de call __divsint add sp, #4 ld a, e ldhl sp, #14 add a, (hl) ld c, a ;src/main.c:744: dynamic_metasprite.metasprite_offset, ld a, (#(_dynamic_metasprite + 0x000c) + 0) ld (#___current_base_tile),a ;src/main.c:743: move_metasprite(dynamic_metasprite.metasprite, ld hl, #_dynamic_metasprite + 10 ld a, (hl+) ld b, (hl) ;/home/wojtek/gbdk/include/gb/metasprites.h:79: __current_metasprite = metasprite; ld hl, #___current_metasprite ld (hl+), a ld (hl), b ;/home/wojtek/gbdk/include/gb/metasprites.h:81: return __move_metasprite(base_sprite, x, y); ldhl sp, #13 ld b, (hl) push bc xor a, a push af inc sp call ___move_metasprite add sp, #3 ;src/main.c:749: if (dynamic_metasprite.elapsed_frames == dynamic_metasprite.target_frames ld a, (#(_dynamic_metasprite + 0x0009) + 0) ld hl, #(_dynamic_metasprite + 0x0008) ld c, (hl) sub a, c jr NZ, 00267$ ;src/main.c:750: && dynamic_metasprite.callback) ld hl, #_dynamic_metasprite + 19 ld a, (hl+) ld c, a ld h, (hl) ld a, h or a, c jr Z, 00267$ ;src/main.c:751: dynamic_metasprite.callback(); ld l, c call ___sdcc_call_hl ;src/main.c:1308: dynamic_metasprite_process(); 00267$: ;src/main.c:1310: wait_vbl_done(); call _wait_vbl_done jp 00102$ ;src/main.c:1312: } add sp, #15 ret .area _CODE .area _CABS (ABS)
programs/oeis/274/A274682.asm
neoneye/loda
22
29252
; A274682: Numbers n such that 8*n-1 is a triangular number. ; 2,7,29,44,88,113,179,214,302,347,457,512,644,709,863,938,1114,1199,1397,1492,1712,1817,2059,2174,2438,2563,2849,2984,3292,3437,3767,3922,4274,4439,4813,4988,5384,5569,5987,6182,6622,6827,7289,7504,7988,8213,8719,8954,9482,9727,10277,10532,11104,11369,11963,12238,12854,13139,13777,14072,14732,15037,15719,16034,16738,17063,17789,18124,18872,19217,19987,20342,21134,21499,22313,22688,23524,23909,24767,25162,26042,26447,27349,27764,28688,29113,30059,30494,31462,31907,32897,33352,34364,34829,35863,36338,37394,37879,38957,39452 mov $3,$0 mov $7,$0 add $0,1 lpb $0 add $4,$0 trn $0,2 mov $1,$4 add $1,$3 mov $5,$3 mov $3,4 add $3,$5 add $3,6 mov $4,$1 lpe add $1,1 add $1,$7 mov $6,$7 mul $6,$7 mov $2,$6 mul $2,2 add $1,$2 mov $0,$1
programs/oeis/227/A227625.asm
neoneye/loda
22
171246
<reponame>neoneye/loda<filename>programs/oeis/227/A227625.asm ; A227625: Indicator sequence of primes p > 3: k = p mod 6, if k = 5 then a(n) = -1, if k = 1 then a(n) = 1 else a(n) = 0, a(2) = -1, a(3) = 1. ; 0,-1,1,0,-1,0,1,0,0,0,-1,0,1,0,0,0,-1,0,1,0,0,0,-1,0,0,0,0,0,-1,0,1,0,0,0,0,0,1,0,0,0,-1,0,1,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,-1,0,1,0,0,0,0,0,1,0,0,0,-1,0,1,0,0,0,0,0,1,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0 mov $2,$0 seq $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $2,1 mod $2,3 sub $2,1 mov $3,$2 cmp $3,0 add $2,$3 div $0,$2
alloy4fun_models/trashltl/models/5/FzLAE8oSNLgrCEgKK.als
Kaixi26/org.alloytools.alloy
0
197
open main pred idFzLAE8oSNLgrCEgKK_prop6 { always ((some File) implies (always File in File)) } pred __repair { idFzLAE8oSNLgrCEgKK_prop6 } check __repair { idFzLAE8oSNLgrCEgKK_prop6 <=> prop6o }
programs/oeis/248/A248076.asm
neoneye/loda
22
27825
<reponame>neoneye/loda ; A248076: Partial sums of the sum of the 5th powers of the divisors of n: Sum_{i=1..n} sigma_5(i). ; 1,34,278,1335,4461,12513,29321,63146,122439,225597,386649,644557,1015851,1570515,2333259,3415660,4835518,6792187,9268287,12572469,16673621,21988337,28424681,36677981,46446732,58699434,73107634,90873690,111384840,136555392,165184544,199821377,239118065,285973379,338515187,401187888,470531846,552243146,642838882,748575832,864432034,999770050,1146778494,1317010458,1502360376,1714759728,1944104736,2208210580,2490702637,2813071420,3159516772,3551974530,3970170024,4445640624,4949089176,5517619776,6121788176,6798656126,7513580426,8319800834,9164397136,10109159152,11105755896,12214134553,13374799597,14671590301,16021715409,17522505315,19092973251,20826852915,22631082267,24636667992,26709739586,28998090200,31381665444,33998903144,36705865160,39695524448,42772580848,46156166374,49657358975,53480613641,57419654285,61754571949,66193048057,71044326709,76049047309,81496631209,87080690659,93197237953,99437947505,106241163113,113226676201,120795061465,128535350065,136986737317,145574077575,154896315456,164445571692,174771141499 lpb $0 mov $2,$0 sub $0,1 seq $2,1160 ; sigma_5(n), the sum of the 5th powers of the divisors of n. add $1,$2 lpe add $1,1 mov $0,$1
libsrc/_DEVELOPMENT/math/float/math48/z80/am48_dconst_inf.asm
meesokim/z88dk
0
167266
SECTION code_fp_math48 PUBLIC am48_dconst_inf, am48_dconst_pinf, am48_dconst_minf am48_dconst_inf: ; set AC = +-inf depending on sign bit 7,b jr nz, am48_dconst_minf am48_dconst_pinf: ; set AC = +inf ld bc,$7fff join: ld e,c ld d,c ld h,c ld l,c ret am48_dconst_minf: ; set AC = -inf ld bc,$ffff jr join
findNote.applescript
hadret/alfred-search-notes-app
0
24
#!/usr/bin/osascript on alfred_script(argv) tell application "Notes" set noteRefs to a reference to every note in default account repeat with noteRef in noteRefs if name of noteRef contains argv then show noteRef activate exit repeat end if end repeat end tell end alfred_script
programs/oeis/198/A198796.asm
neoneye/loda
22
101537
; A198796: 3*6^n-1. ; 2,17,107,647,3887,23327,139967,839807,5038847,30233087,181398527,1088391167,6530347007,39182082047,235092492287,1410554953727,8463329722367,50779978334207,304679870005247,1828079220031487,10968475320188927,65810851921133567,394865111526801407,2369190669160808447,14215144014964850687,85290864089789104127,511745184538734624767,3070471107232407748607,18422826643394446491647,110536959860366678949887,663221759162200073699327,3979330554973200442195967,23875983329839202653175807,143255899979035215919054847,859535399874211295514329087,5157212399245267773085974527,30943274395471606638515847167,185659646372829639831095083007,1113957878236977838986570498047,6683747269421867033919422988287,40102483616531202203516537929727,240614901699187213221099227578367,1443689410195123279326595365470207,8662136461170739675959572192821247,51972818767024438055757433156927487,311836912602146628334544598941564927 mov $1,6 pow $1,$0 mul $1,3 sub $1,1 mov $0,$1
compareWalkers.asm
arturosalazar/xv6-public
0
14404
<filename>compareWalkers.asm _compareWalkers: file format elf32-i386 Disassembly of section .text: 00000000 <main>: 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: 51 push %ecx e: 83 ec 10 sub $0x10,%esp directoryWalkerComparison("/"); 11: 68 40 0c 00 00 push $0xc40 16: e8 c5 02 00 00 call 2e0 <directoryWalkerComparison> inodeTBWalkerComparison(); 1b: e8 10 00 00 00 call 30 <inodeTBWalkerComparison> exit(); 20: e8 7d 07 00 00 call 7a2 <exit> 25: 66 90 xchg %ax,%ax 27: 66 90 xchg %ax,%ax 29: 66 90 xchg %ax,%ax 2b: 66 90 xchg %ax,%ax 2d: 66 90 xchg %ax,%ax 2f: 90 nop 00000030 <inodeTBWalkerComparison>: }; struct dirSummary dirWalker[4000]; int dirWalkerSize = 0; void inodeTBWalkerComparison(){ 30: 55 push %ebp 31: 89 e5 mov %esp,%ebp 33: 57 push %edi 34: 56 push %esi 35: 53 push %ebx 36: 81 ec 54 02 00 00 sub $0x254,%esp struct stat st; int fd; struct superblock sb; uchar dataBuffer[BSIZE]; if((fd = open("/", 0)) < 0){ 3c: 6a 00 push $0x0 3e: 68 40 0c 00 00 push $0xc40 43: e8 9a 07 00 00 call 7e2 <open> 48: 83 c4 10 add $0x10,%esp 4b: 85 c0 test %eax,%eax 4d: 0f 88 e2 01 00 00 js 235 <inodeTBWalkerComparison+0x205> 53: 89 c3 mov %eax,%ebx printf(2, "ls: cannot open %s\n", "/"); return; } if(fstat(fd, &st) < 0){ 55: 8d 85 b8 fd ff ff lea -0x248(%ebp),%eax 5b: 83 ec 08 sub $0x8,%esp 5e: 50 push %eax 5f: 53 push %ebx 60: e8 95 07 00 00 call 7fa <fstat> 65: 83 c4 10 add $0x10,%esp 68: 85 c0 test %eax,%eax 6a: 0f 88 e4 01 00 00 js 254 <inodeTBWalkerComparison+0x224> printf(2, "ls: cannot stat %s\n", "/"); close(fd); return; } callSBRead(st.dev, &sb); 70: 8d 85 cc fd ff ff lea -0x234(%ebp),%eax 76: 83 ec 08 sub $0x8,%esp 79: 50 push %eax 7a: ff b5 bc fd ff ff pushl -0x244(%ebp) 80: e8 dd 07 00 00 call 862 <callSBRead> printf(1, "Contents of sb: inodes - %d, size - %d, nblocks - %d, inodestart - %d\n", 85: 5a pop %edx 86: 59 pop %ecx 87: ff b5 e0 fd ff ff pushl -0x220(%ebp) 8d: ff b5 d0 fd ff ff pushl -0x230(%ebp) 93: ff b5 cc fd ff ff pushl -0x234(%ebp) 99: ff b5 d4 fd ff ff pushl -0x22c(%ebp) 9f: 68 bc 0c 00 00 push $0xcbc a4: 6a 01 push $0x1 a6: e8 75 08 00 00 call 920 <printf> sb.ninodes, sb.size, sb.nblocks, sb.inodestart); for(int numB = 0; numB < sb.ninodes / IPB; numB++){ ab: 8b 85 d4 fd ff ff mov -0x22c(%ebp),%eax b1: 83 c4 20 add $0x20,%esp b4: c7 85 b0 fd ff ff 00 movl $0x0,-0x250(%ebp) bb: 00 00 00 be: c1 e8 03 shr $0x3,%eax c1: 85 c0 test %eax,%eax c3: 0f 84 3e 01 00 00 je 207 <inodeTBWalkerComparison+0x1d7> callBRead(st.dev, (numB + sb.inodestart), dataBuffer); c9: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax cf: 83 ec 04 sub $0x4,%esp d2: 8b bd b0 fd ff ff mov -0x250(%ebp),%edi d8: 50 push %eax d9: 8b 85 e0 fd ff ff mov -0x220(%ebp),%eax df: 01 f8 add %edi,%eax e1: 50 push %eax e2: ff b5 bc fd ff ff pushl -0x244(%ebp) e8: e8 6d 07 00 00 call 85a <callBRead> ed: 89 f8 mov %edi,%eax ef: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi f5: 83 c4 10 add $0x10,%esp f8: c1 e0 03 shl $0x3,%eax fb: 90 nop fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi struct dinode* dinodePtr = (struct dinode*) dataBuffer; for(int i = 0; i < IPB; i++){ int tbWalkerInodeNum = i + (numB * IPB); //printf(1, "type: %d,major: %d,minor: %d,nlink: %d,size: %d,size: %d\n", //dinodePtr->type, dinodePtr->major, dinodePtr->minor, dinodePtr->nlink, dinodePtr->size); printf(1, "DIRWALKERSIZE: %d, inode ith: %d\n\n", dirWalkerSize, tbWalkerInodeNum); 100: 50 push %eax 101: ff 35 80 11 00 00 pushl 0x1180 107: 68 04 0d 00 00 push $0xd04 10c: 6a 01 push $0x1 10e: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) 114: e8 07 08 00 00 call 920 <printf> for(int j = 0; j < dirWalkerSize; j++){ 119: a1 80 11 00 00 mov 0x1180,%eax 11e: 83 c4 10 add $0x10,%esp 121: 85 c0 test %eax,%eax 123: 8b 85 b4 fd ff ff mov -0x24c(%ebp),%eax 129: 0f 8e a9 00 00 00 jle 1d8 <inodeTBWalkerComparison+0x1a8> 12f: bb a0 11 00 00 mov $0x11a0,%ebx 134: 31 f6 xor %esi,%esi 136: eb 1a jmp 152 <inodeTBWalkerComparison+0x122> 138: 90 nop 139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 140: 83 c6 01 add $0x1,%esi 143: 83 c3 10 add $0x10,%ebx 146: 39 35 80 11 00 00 cmp %esi,0x1180 14c: 0f 8e 86 00 00 00 jle 1d8 <inodeTBWalkerComparison+0x1a8> if(dirWalker[j].inode == tbWalkerInodeNum){ 152: 3b 03 cmp (%ebx),%eax 154: 75 ea jne 140 <inodeTBWalkerComparison+0x110> printf(1, "dirWalker jth %d\n\n", j); 156: 83 ec 04 sub $0x4,%esp 159: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) 15f: 56 push %esi 160: 68 6a 0c 00 00 push $0xc6a 165: 6a 01 push $0x1 167: e8 b4 07 00 00 call 920 <printf> if(dirWalker[j].inodesCount != dinodePtr->nlink){ 16c: 0f bf 4f 06 movswl 0x6(%edi),%ecx 170: 8b 53 04 mov 0x4(%ebx),%edx 173: 83 c4 10 add $0x10,%esp 176: 8b 85 b4 fd ff ff mov -0x24c(%ebp),%eax 17c: 39 ca cmp %ecx,%edx 17e: 0f 84 8c 00 00 00 je 210 <inodeTBWalkerComparison+0x1e0> printf(1, "DIFFERENCE for inode %d ---- DirectoryWalker Count: %d, inodeTBWalker Count: %d\n\n", 184: 83 ec 0c sub $0xc,%esp int tbWalkerInodeNum = i + (numB * IPB); //printf(1, "type: %d,major: %d,minor: %d,nlink: %d,size: %d,size: %d\n", //dinodePtr->type, dinodePtr->major, dinodePtr->minor, dinodePtr->nlink, dinodePtr->size); printf(1, "DIRWALKERSIZE: %d, inode ith: %d\n\n", dirWalkerSize, tbWalkerInodeNum); for(int j = 0; j < dirWalkerSize; j++){ 187: 83 c6 01 add $0x1,%esi 18a: 83 c3 10 add $0x10,%ebx if(dirWalker[j].inode == tbWalkerInodeNum){ printf(1, "dirWalker jth %d\n\n", j); if(dirWalker[j].inodesCount != dinodePtr->nlink){ printf(1, "DIFFERENCE for inode %d ---- DirectoryWalker Count: %d, inodeTBWalker Count: %d\n\n", 18d: 51 push %ecx 18e: 52 push %edx 18f: 50 push %eax 190: 68 28 0d 00 00 push $0xd28 195: 6a 01 push $0x1 197: e8 84 07 00 00 call 920 <printf> tbWalkerInodeNum, dirWalker[j].inodesCount, dinodePtr->nlink); printf(1, "inode SUMMARY --- type: %d,major: %d,minor: %d,nlink: %d,size: %d,size: %d\n\n\n\n", 19c: 83 c4 1c add $0x1c,%esp 19f: ff 77 08 pushl 0x8(%edi) 1a2: 0f bf 57 06 movswl 0x6(%edi),%edx 1a6: 52 push %edx 1a7: 0f bf 57 04 movswl 0x4(%edi),%edx 1ab: 52 push %edx 1ac: 0f bf 57 02 movswl 0x2(%edi),%edx 1b0: 52 push %edx 1b1: 0f bf 17 movswl (%edi),%edx 1b4: 52 push %edx 1b5: 68 7c 0d 00 00 push $0xd7c 1ba: 6a 01 push $0x1 1bc: e8 5f 07 00 00 call 920 <printf> 1c1: 83 c4 20 add $0x20,%esp int tbWalkerInodeNum = i + (numB * IPB); //printf(1, "type: %d,major: %d,minor: %d,nlink: %d,size: %d,size: %d\n", //dinodePtr->type, dinodePtr->major, dinodePtr->minor, dinodePtr->nlink, dinodePtr->size); printf(1, "DIRWALKERSIZE: %d, inode ith: %d\n\n", dirWalkerSize, tbWalkerInodeNum); for(int j = 0; j < dirWalkerSize; j++){ 1c4: 39 35 80 11 00 00 cmp %esi,0x1180 1ca: 8b 85 b4 fd ff ff mov -0x24c(%ebp),%eax 1d0: 7f 80 jg 152 <inodeTBWalkerComparison+0x122> 1d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(1, "Contents of sb: inodes - %d, size - %d, nblocks - %d, inodestart - %d\n", sb.ninodes, sb.size, sb.nblocks, sb.inodestart); for(int numB = 0; numB < sb.ninodes / IPB; numB++){ callBRead(st.dev, (numB + sb.inodestart), dataBuffer); struct dinode* dinodePtr = (struct dinode*) dataBuffer; for(int i = 0; i < IPB; i++){ 1d8: 8d 4d e8 lea -0x18(%ebp),%ecx for(int i = 0; i < NDIRECT+1; i++){ //printf(1, "%d, ", dinodePtr->addrs[i]); } dinodePtr++; 1db: 83 c7 40 add $0x40,%edi 1de: 83 c0 01 add $0x1,%eax printf(1, "Contents of sb: inodes - %d, size - %d, nblocks - %d, inodestart - %d\n", sb.ninodes, sb.size, sb.nblocks, sb.inodestart); for(int numB = 0; numB < sb.ninodes / IPB; numB++){ callBRead(st.dev, (numB + sb.inodestart), dataBuffer); struct dinode* dinodePtr = (struct dinode*) dataBuffer; for(int i = 0; i < IPB; i++){ 1e1: 39 cf cmp %ecx,%edi 1e3: 0f 85 17 ff ff ff jne 100 <inodeTBWalkerComparison+0xd0> callSBRead(st.dev, &sb); printf(1, "Contents of sb: inodes - %d, size - %d, nblocks - %d, inodestart - %d\n", sb.ninodes, sb.size, sb.nblocks, sb.inodestart); for(int numB = 0; numB < sb.ninodes / IPB; numB++){ 1e9: 83 85 b0 fd ff ff 01 addl $0x1,-0x250(%ebp) 1f0: 8b 85 d4 fd ff ff mov -0x22c(%ebp),%eax 1f6: 8b 8d b0 fd ff ff mov -0x250(%ebp),%ecx 1fc: c1 e8 03 shr $0x3,%eax 1ff: 39 c8 cmp %ecx,%eax 201: 0f 87 c2 fe ff ff ja c9 <inodeTBWalkerComparison+0x99> } } 207: 8d 65 f4 lea -0xc(%ebp),%esp 20a: 5b pop %ebx 20b: 5e pop %esi 20c: 5f pop %edi 20d: 5d pop %ebp 20e: c3 ret 20f: 90 nop tbWalkerInodeNum, dirWalker[j].inodesCount, dinodePtr->nlink); printf(1, "inode SUMMARY --- type: %d,major: %d,minor: %d,nlink: %d,size: %d,size: %d\n\n\n\n", dinodePtr->type, dinodePtr->major, dinodePtr->minor, dinodePtr->nlink, dinodePtr->size); } else { printf(1, "inode %d count matches, verified\n\n\n\n", dirWalker[j].inode); 210: 83 ec 04 sub $0x4,%esp 213: ff 33 pushl (%ebx) 215: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp) 21b: 68 cc 0d 00 00 push $0xdcc 220: 6a 01 push $0x1 222: e8 f9 06 00 00 call 920 <printf> 227: 83 c4 10 add $0x10,%esp 22a: 8b 85 b4 fd ff ff mov -0x24c(%ebp),%eax 230: e9 0b ff ff ff jmp 140 <inodeTBWalkerComparison+0x110> int fd; struct superblock sb; uchar dataBuffer[BSIZE]; if((fd = open("/", 0)) < 0){ printf(2, "ls: cannot open %s\n", "/"); 235: 83 ec 04 sub $0x4,%esp 238: 68 40 0c 00 00 push $0xc40 23d: 68 42 0c 00 00 push $0xc42 242: 6a 02 push $0x2 244: e8 d7 06 00 00 call 920 <printf> return; 249: 83 c4 10 add $0x10,%esp } } 24c: 8d 65 f4 lea -0xc(%ebp),%esp 24f: 5b pop %ebx 250: 5e pop %esi 251: 5f pop %edi 252: 5d pop %ebp 253: c3 ret printf(2, "ls: cannot open %s\n", "/"); return; } if(fstat(fd, &st) < 0){ printf(2, "ls: cannot stat %s\n", "/"); 254: 83 ec 04 sub $0x4,%esp 257: 68 40 0c 00 00 push $0xc40 25c: 68 56 0c 00 00 push $0xc56 261: 6a 02 push $0x2 263: e8 b8 06 00 00 call 920 <printf> close(fd); 268: 89 1c 24 mov %ebx,(%esp) 26b: e8 5a 05 00 00 call 7ca <close> return; 270: 83 c4 10 add $0x10,%esp } } 273: 8d 65 f4 lea -0xc(%ebp),%esp 276: 5b pop %ebx 277: 5e pop %esi 278: 5f pop %edi 279: 5d pop %ebp 27a: c3 ret 27b: 90 nop 27c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000280 <incrementRefCount>: int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ 280: 55 push %ebp 281: 89 e5 mov %esp,%ebp 283: 57 push %edi 284: 56 push %esi 285: 8b 45 0c mov 0xc(%ebp),%eax 288: 53 push %ebx 289: 8b 7d 08 mov 0x8(%ebp),%edi 28c: 0f b7 5d 10 movzwl 0x10(%ebp),%ebx for(int i = 0; i < dirWalkerSize; i++){ 290: 85 c0 test %eax,%eax 292: 7e 1d jle 2b1 <incrementRefCount+0x31> if(dirWalker[i].inode == de.inum){ 294: 31 c9 xor %ecx,%ecx 296: 3b 1f cmp (%edi),%ebx 298: 8d 57 10 lea 0x10(%edi),%edx 29b: 75 0d jne 2aa <incrementRefCount+0x2a> 29d: eb 2a jmp 2c9 <incrementRefCount+0x49> 29f: 90 nop 2a0: 89 d6 mov %edx,%esi 2a2: 83 c2 10 add $0x10,%edx 2a5: 39 5a f0 cmp %ebx,-0x10(%edx) 2a8: 74 21 je 2cb <incrementRefCount+0x4b> } int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ for(int i = 0; i < dirWalkerSize; i++){ 2aa: 83 c1 01 add $0x1,%ecx 2ad: 39 c8 cmp %ecx,%eax 2af: 75 ef jne 2a0 <incrementRefCount+0x20> return dirWalkerSize; } } //cprintf("didn't find it %d\n", key); dirWalker[dirWalkerSize].inode = de.inum; 2b1: 89 c2 mov %eax,%edx dirWalker[dirWalkerSize].inodesCount = 1; return dirWalkerSize + 1; 2b3: 83 c0 01 add $0x1,%eax return dirWalkerSize; } } //cprintf("didn't find it %d\n", key); dirWalker[dirWalkerSize].inode = de.inum; 2b6: c1 e2 04 shl $0x4,%edx 2b9: 01 d7 add %edx,%edi 2bb: 89 1f mov %ebx,(%edi) dirWalker[dirWalkerSize].inodesCount = 1; 2bd: c7 47 04 01 00 00 00 movl $0x1,0x4(%edi) return dirWalkerSize + 1; } 2c4: 5b pop %ebx 2c5: 5e pop %esi 2c6: 5f pop %edi 2c7: 5d pop %ebp 2c8: c3 ret } int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ for(int i = 0; i < dirWalkerSize; i++){ if(dirWalker[i].inode == de.inum){ 2c9: 89 fe mov %edi,%esi dirWalker[i].inodesCount++; 2cb: 83 46 04 01 addl $0x1,0x4(%esi) //cprintf("didn't find it %d\n", key); dirWalker[dirWalkerSize].inode = de.inum; dirWalker[dirWalkerSize].inodesCount = 1; return dirWalkerSize + 1; } 2cf: 5b pop %ebx 2d0: 5e pop %esi 2d1: 5f pop %edi 2d2: 5d pop %ebp 2d3: c3 ret 2d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 2da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000002e0 <directoryWalkerComparison>: void directoryWalkerComparison(char* path){ 2e0: 55 push %ebp char buf[512] = {0}; 2e1: 31 c0 xor %eax,%eax 2e3: b9 80 00 00 00 mov $0x80,%ecx dirWalker[dirWalkerSize].inode = de.inum; dirWalker[dirWalkerSize].inodesCount = 1; return dirWalkerSize + 1; } void directoryWalkerComparison(char* path){ 2e8: 89 e5 mov %esp,%ebp 2ea: 57 push %edi 2eb: 56 push %esi 2ec: 53 push %ebx char buf[512] = {0}; 2ed: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi dirWalker[dirWalkerSize].inode = de.inum; dirWalker[dirWalkerSize].inodesCount = 1; return dirWalkerSize + 1; } void directoryWalkerComparison(char* path){ 2f3: 81 ec 60 02 00 00 sub $0x260,%esp 2f9: 8b 75 08 mov 0x8(%ebp),%esi char buf[512] = {0}; 2fc: f3 ab rep stos %eax,%es:(%edi) int fd; struct dirent de; struct stat st; printf(1, "DEBUG PATH: %s\n", path); 2fe: 56 push %esi 2ff: 68 7d 0c 00 00 push $0xc7d 304: 6a 01 push $0x1 306: e8 15 06 00 00 call 920 <printf> if((fd = open(path, 0)) < 0){ 30b: 58 pop %eax 30c: 5a pop %edx 30d: 6a 00 push $0x0 30f: 56 push %esi 310: e8 cd 04 00 00 call 7e2 <open> 315: 83 c4 10 add $0x10,%esp 318: 85 c0 test %eax,%eax 31a: 78 54 js 370 <directoryWalkerComparison+0x90> 31c: 89 c3 mov %eax,%ebx printf(2, "ls: cannot open %s\n", path); return; } if(fstat(fd, &st) < 0){ 31e: 8d 85 b4 fd ff ff lea -0x24c(%ebp),%eax 324: 83 ec 08 sub $0x8,%esp 327: 50 push %eax 328: 53 push %ebx 329: e8 cc 04 00 00 call 7fa <fstat> 32e: 83 c4 10 add $0x10,%esp 331: 85 c0 test %eax,%eax 333: 0f 88 e7 01 00 00 js 520 <directoryWalkerComparison+0x240> printf(2, "ls: cannot stat %s\n", path); close(fd); return; } if(st.type != T_DIR){ 339: 66 83 bd b4 fd ff ff cmpw $0x1,-0x24c(%ebp) 340: 01 341: 74 4d je 390 <directoryWalkerComparison+0xb0> printf(1, "Filename: %s \n inode number: %d\n", path, st.ino); 343: ff b5 bc fd ff ff pushl -0x244(%ebp) 349: 56 push %esi 34a: 68 f4 0d 00 00 push $0xdf4 34f: 6a 01 push $0x1 351: e8 ca 05 00 00 call 920 <printf> close(fd); 356: 89 1c 24 mov %ebx,(%esp) 359: e8 6c 04 00 00 call 7ca <close> return; 35e: 83 c4 10 add $0x10,%esp directoryWalkerComparison(buf); p[DIRSIZ] = 0; printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); } } 361: 8d 65 f4 lea -0xc(%ebp),%esp 364: 5b pop %ebx 365: 5e pop %esi 366: 5f pop %edi 367: 5d pop %ebp 368: c3 ret 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "DEBUG PATH: %s\n", path); if((fd = open(path, 0)) < 0){ printf(2, "ls: cannot open %s\n", path); 370: 83 ec 04 sub $0x4,%esp 373: 56 push %esi 374: 68 42 0c 00 00 push $0xc42 379: 6a 02 push $0x2 37b: e8 a0 05 00 00 call 920 <printf> return; 380: 83 c4 10 add $0x10,%esp directoryWalkerComparison(buf); p[DIRSIZ] = 0; printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); } } 383: 8d 65 f4 lea -0xc(%ebp),%esp 386: 5b pop %ebx 387: 5e pop %esi 388: 5f pop %edi 389: 5d pop %ebp 38a: c3 ret 38b: 90 nop 38c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return; } if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ 390: 83 ec 0c sub $0xc,%esp 393: 56 push %esi 394: e8 47 02 00 00 call 5e0 <strlen> 399: 83 c0 20 add $0x20,%eax 39c: 83 c4 10 add $0x10,%esp 39f: 3d 00 02 00 00 cmp $0x200,%eax 3a4: 0f 87 96 01 00 00 ja 540 <directoryWalkerComparison+0x260> printf(1, "ls: path too long\n"); } strcpy(buf, path); 3aa: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax 3b0: 83 ec 08 sub $0x8,%esp p = buf+strlen(buf); 3b3: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ printf(1, "ls: path too long\n"); } strcpy(buf, path); 3b9: 56 push %esi 3ba: 50 push %eax 3bb: e8 a0 01 00 00 call 560 <strcpy> p = buf+strlen(buf); 3c0: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax 3c6: 89 04 24 mov %eax,(%esp) 3c9: e8 12 02 00 00 call 5e0 <strlen> 3ce: 01 c7 add %eax,%edi *p++ = '/'; 3d0: 8d 84 05 e9 fd ff ff lea -0x217(%ebp,%eax,1),%eax while(read(fd, &de, sizeof(de)) == sizeof(de)){ 3d7: 83 c4 10 add $0x10,%esp if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ printf(1, "ls: path too long\n"); } strcpy(buf, path); p = buf+strlen(buf); 3da: 89 bd a4 fd ff ff mov %edi,-0x25c(%ebp) *p++ = '/'; 3e0: c6 07 2f movb $0x2f,(%edi) 3e3: 89 85 a0 fd ff ff mov %eax,-0x260(%ebp) 3e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi while(read(fd, &de, sizeof(de)) == sizeof(de)){ 3f0: 8d 85 c8 fd ff ff lea -0x238(%ebp),%eax 3f6: 83 ec 04 sub $0x4,%esp 3f9: 6a 20 push $0x20 3fb: 50 push %eax 3fc: 53 push %ebx 3fd: e8 b8 03 00 00 call 7ba <read> 402: 83 c4 10 add $0x10,%esp 405: 83 f8 20 cmp $0x20,%eax 408: 0f 85 53 ff ff ff jne 361 <directoryWalkerComparison+0x81> if(de.inum == 0) 40e: 0f b7 8d c8 fd ff ff movzwl -0x238(%ebp),%ecx 415: 66 85 c9 test %cx,%cx 418: 74 d6 je 3f0 <directoryWalkerComparison+0x110> continue; dirWalkerSize = incrementRefCount(dirWalker, dirWalkerSize, de); 41a: 8b 35 80 11 00 00 mov 0x1180,%esi } int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ for(int i = 0; i < dirWalkerSize; i++){ 420: 85 f6 test %esi,%esi 422: 7e 31 jle 455 <directoryWalkerComparison+0x175> if(dirWalker[i].inode == de.inum){ 424: 31 d2 xor %edx,%edx 426: 3b 0d a0 11 00 00 cmp 0x11a0,%ecx 42c: b8 b0 11 00 00 mov $0x11b0,%eax 431: 75 1b jne 44e <directoryWalkerComparison+0x16e> 433: e9 cb 00 00 00 jmp 503 <directoryWalkerComparison+0x223> 438: 90 nop 439: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 440: 89 c7 mov %eax,%edi 442: 83 c0 10 add $0x10,%eax 445: 39 48 f0 cmp %ecx,-0x10(%eax) 448: 0f 84 c2 00 00 00 je 510 <directoryWalkerComparison+0x230> } int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ for(int i = 0; i < dirWalkerSize; i++){ 44e: 83 c2 01 add $0x1,%edx 451: 39 d6 cmp %edx,%esi 453: 75 eb jne 440 <directoryWalkerComparison+0x160> return dirWalkerSize; } } //cprintf("didn't find it %d\n", key); dirWalker[dirWalkerSize].inode = de.inum; 455: 89 f0 mov %esi,%eax dirWalker[dirWalkerSize].inodesCount = 1; return dirWalkerSize + 1; 457: 83 c6 01 add $0x1,%esi return dirWalkerSize; } } //cprintf("didn't find it %d\n", key); dirWalker[dirWalkerSize].inode = de.inum; 45a: c1 e0 04 shl $0x4,%eax 45d: 89 88 a0 11 00 00 mov %ecx,0x11a0(%eax) dirWalker[dirWalkerSize].inodesCount = 1; 463: c7 80 a4 11 00 00 01 movl $0x1,0x11a4(%eax) 46a: 00 00 00 dirWalkerSize = incrementRefCount(dirWalker, dirWalkerSize, de); if(strcmp(de.name, ".") == 0 || strcmp(de.name, "..") == 0) continue; 46d: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 473: 83 ec 08 sub $0x8,%esp while(read(fd, &de, sizeof(de)) == sizeof(de)){ if(de.inum == 0) continue; dirWalkerSize = incrementRefCount(dirWalker, dirWalkerSize, de); 476: 89 35 80 11 00 00 mov %esi,0x1180 if(strcmp(de.name, ".") == 0 || strcmp(de.name, "..") == 0) continue; 47c: 68 a1 0c 00 00 push $0xca1 481: 50 push %eax 482: e8 09 01 00 00 call 590 <strcmp> 487: 83 c4 10 add $0x10,%esp 48a: 85 c0 test %eax,%eax 48c: 0f 84 5e ff ff ff je 3f0 <directoryWalkerComparison+0x110> 492: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 498: 83 ec 08 sub $0x8,%esp 49b: 68 a0 0c 00 00 push $0xca0 4a0: 50 push %eax 4a1: e8 ea 00 00 00 call 590 <strcmp> 4a6: 83 c4 10 add $0x10,%esp 4a9: 85 c0 test %eax,%eax 4ab: 0f 84 3f ff ff ff je 3f0 <directoryWalkerComparison+0x110> memmove(p, de.name, DIRSIZ); 4b1: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 4b7: 83 ec 04 sub $0x4,%esp 4ba: 6a 1e push $0x1e 4bc: 50 push %eax 4bd: ff b5 a0 fd ff ff pushl -0x260(%ebp) 4c3: e8 a8 02 00 00 call 770 <memmove> directoryWalkerComparison(buf); 4c8: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax 4ce: 89 04 24 mov %eax,(%esp) 4d1: e8 0a fe ff ff call 2e0 <directoryWalkerComparison> p[DIRSIZ] = 0; 4d6: 8b 85 a4 fd ff ff mov -0x25c(%ebp),%eax 4dc: c6 40 1f 00 movb $0x0,0x1f(%eax) printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); 4e0: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax 4e6: 50 push %eax 4e7: 0f b7 85 c8 fd ff ff movzwl -0x238(%ebp),%eax 4ee: 50 push %eax 4ef: 68 a3 0c 00 00 push $0xca3 4f4: 6a 01 push $0x1 4f6: e8 25 04 00 00 call 920 <printf> 4fb: 83 c4 20 add $0x20,%esp 4fe: e9 ed fe ff ff jmp 3f0 <directoryWalkerComparison+0x110> } int incrementRefCount(struct dirSummary *dirWalker, int dirWalkerSize, struct dirent de){ for(int i = 0; i < dirWalkerSize; i++){ if(dirWalker[i].inode == de.inum){ 503: bf a0 11 00 00 mov $0x11a0,%edi 508: 90 nop 509: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi dirWalker[i].inodesCount++; 510: 83 47 04 01 addl $0x1,0x4(%edi) 514: e9 54 ff ff ff jmp 46d <directoryWalkerComparison+0x18d> 519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi printf(2, "ls: cannot open %s\n", path); return; } if(fstat(fd, &st) < 0){ printf(2, "ls: cannot stat %s\n", path); 520: 83 ec 04 sub $0x4,%esp 523: 56 push %esi 524: 68 56 0c 00 00 push $0xc56 529: 6a 02 push $0x2 52b: e8 f0 03 00 00 call 920 <printf> close(fd); 530: 89 1c 24 mov %ebx,(%esp) 533: e8 92 02 00 00 call 7ca <close> return; 538: 83 c4 10 add $0x10,%esp 53b: e9 21 fe ff ff jmp 361 <directoryWalkerComparison+0x81> } if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ printf(1, "ls: path too long\n"); 540: 83 ec 08 sub $0x8,%esp 543: 68 8d 0c 00 00 push $0xc8d 548: 6a 01 push $0x1 54a: e8 d1 03 00 00 call 920 <printf> 54f: 83 c4 10 add $0x10,%esp 552: e9 53 fe ff ff jmp 3aa <directoryWalkerComparison+0xca> 557: 66 90 xchg %ax,%ax 559: 66 90 xchg %ax,%ax 55b: 66 90 xchg %ax,%ax 55d: 66 90 xchg %ax,%ax 55f: 90 nop 00000560 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 560: 55 push %ebp 561: 89 e5 mov %esp,%ebp 563: 53 push %ebx 564: 8b 45 08 mov 0x8(%ebp),%eax 567: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 56a: 89 c2 mov %eax,%edx 56c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 570: 83 c1 01 add $0x1,%ecx 573: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 577: 83 c2 01 add $0x1,%edx 57a: 84 db test %bl,%bl 57c: 88 5a ff mov %bl,-0x1(%edx) 57f: 75 ef jne 570 <strcpy+0x10> ; return os; } 581: 5b pop %ebx 582: 5d pop %ebp 583: c3 ret 584: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 58a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000590 <strcmp>: int strcmp(const char *p, const char *q) { 590: 55 push %ebp 591: 89 e5 mov %esp,%ebp 593: 56 push %esi 594: 53 push %ebx 595: 8b 55 08 mov 0x8(%ebp),%edx 598: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 59b: 0f b6 02 movzbl (%edx),%eax 59e: 0f b6 19 movzbl (%ecx),%ebx 5a1: 84 c0 test %al,%al 5a3: 75 1e jne 5c3 <strcmp+0x33> 5a5: eb 29 jmp 5d0 <strcmp+0x40> 5a7: 89 f6 mov %esi,%esi 5a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 5b0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 5b3: 0f b6 02 movzbl (%edx),%eax p++, q++; 5b6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 5b9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 5bd: 84 c0 test %al,%al 5bf: 74 0f je 5d0 <strcmp+0x40> 5c1: 89 f1 mov %esi,%ecx 5c3: 38 d8 cmp %bl,%al 5c5: 74 e9 je 5b0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 5c7: 29 d8 sub %ebx,%eax } 5c9: 5b pop %ebx 5ca: 5e pop %esi 5cb: 5d pop %ebp 5cc: c3 ret 5cd: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 5d0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 5d2: 29 d8 sub %ebx,%eax } 5d4: 5b pop %ebx 5d5: 5e pop %esi 5d6: 5d pop %ebp 5d7: c3 ret 5d8: 90 nop 5d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000005e0 <strlen>: uint strlen(const char *s) { 5e0: 55 push %ebp 5e1: 89 e5 mov %esp,%ebp 5e3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 5e6: 80 39 00 cmpb $0x0,(%ecx) 5e9: 74 12 je 5fd <strlen+0x1d> 5eb: 31 d2 xor %edx,%edx 5ed: 8d 76 00 lea 0x0(%esi),%esi 5f0: 83 c2 01 add $0x1,%edx 5f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 5f7: 89 d0 mov %edx,%eax 5f9: 75 f5 jne 5f0 <strlen+0x10> ; return n; } 5fb: 5d pop %ebp 5fc: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 5fd: 31 c0 xor %eax,%eax ; return n; } 5ff: 5d pop %ebp 600: c3 ret 601: eb 0d jmp 610 <memset> 603: 90 nop 604: 90 nop 605: 90 nop 606: 90 nop 607: 90 nop 608: 90 nop 609: 90 nop 60a: 90 nop 60b: 90 nop 60c: 90 nop 60d: 90 nop 60e: 90 nop 60f: 90 nop 00000610 <memset>: void* memset(void *dst, int c, uint n) { 610: 55 push %ebp 611: 89 e5 mov %esp,%ebp 613: 57 push %edi 614: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 617: 8b 4d 10 mov 0x10(%ebp),%ecx 61a: 8b 45 0c mov 0xc(%ebp),%eax 61d: 89 d7 mov %edx,%edi 61f: fc cld 620: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 622: 89 d0 mov %edx,%eax 624: 5f pop %edi 625: 5d pop %ebp 626: c3 ret 627: 89 f6 mov %esi,%esi 629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000630 <strchr>: char* strchr(const char *s, char c) { 630: 55 push %ebp 631: 89 e5 mov %esp,%ebp 633: 53 push %ebx 634: 8b 45 08 mov 0x8(%ebp),%eax 637: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 63a: 0f b6 10 movzbl (%eax),%edx 63d: 84 d2 test %dl,%dl 63f: 74 1d je 65e <strchr+0x2e> if(*s == c) 641: 38 d3 cmp %dl,%bl 643: 89 d9 mov %ebx,%ecx 645: 75 0d jne 654 <strchr+0x24> 647: eb 17 jmp 660 <strchr+0x30> 649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 650: 38 ca cmp %cl,%dl 652: 74 0c je 660 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 654: 83 c0 01 add $0x1,%eax 657: 0f b6 10 movzbl (%eax),%edx 65a: 84 d2 test %dl,%dl 65c: 75 f2 jne 650 <strchr+0x20> if(*s == c) return (char*)s; return 0; 65e: 31 c0 xor %eax,%eax } 660: 5b pop %ebx 661: 5d pop %ebp 662: c3 ret 663: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000670 <gets>: char* gets(char *buf, int max) { 670: 55 push %ebp 671: 89 e5 mov %esp,%ebp 673: 57 push %edi 674: 56 push %esi 675: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 676: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 678: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 67b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 67e: eb 29 jmp 6a9 <gets+0x39> cc = read(0, &c, 1); 680: 83 ec 04 sub $0x4,%esp 683: 6a 01 push $0x1 685: 57 push %edi 686: 6a 00 push $0x0 688: e8 2d 01 00 00 call 7ba <read> if(cc < 1) 68d: 83 c4 10 add $0x10,%esp 690: 85 c0 test %eax,%eax 692: 7e 1d jle 6b1 <gets+0x41> break; buf[i++] = c; 694: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 698: 8b 55 08 mov 0x8(%ebp),%edx 69b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 69d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 69f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 6a3: 74 1b je 6c0 <gets+0x50> 6a5: 3c 0d cmp $0xd,%al 6a7: 74 17 je 6c0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 6a9: 8d 5e 01 lea 0x1(%esi),%ebx 6ac: 3b 5d 0c cmp 0xc(%ebp),%ebx 6af: 7c cf jl 680 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 6b1: 8b 45 08 mov 0x8(%ebp),%eax 6b4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 6b8: 8d 65 f4 lea -0xc(%ebp),%esp 6bb: 5b pop %ebx 6bc: 5e pop %esi 6bd: 5f pop %edi 6be: 5d pop %ebp 6bf: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 6c0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 6c3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 6c5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 6c9: 8d 65 f4 lea -0xc(%ebp),%esp 6cc: 5b pop %ebx 6cd: 5e pop %esi 6ce: 5f pop %edi 6cf: 5d pop %ebp 6d0: c3 ret 6d1: eb 0d jmp 6e0 <stat> 6d3: 90 nop 6d4: 90 nop 6d5: 90 nop 6d6: 90 nop 6d7: 90 nop 6d8: 90 nop 6d9: 90 nop 6da: 90 nop 6db: 90 nop 6dc: 90 nop 6dd: 90 nop 6de: 90 nop 6df: 90 nop 000006e0 <stat>: int stat(const char *n, struct stat *st) { 6e0: 55 push %ebp 6e1: 89 e5 mov %esp,%ebp 6e3: 56 push %esi 6e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 6e5: 83 ec 08 sub $0x8,%esp 6e8: 6a 00 push $0x0 6ea: ff 75 08 pushl 0x8(%ebp) 6ed: e8 f0 00 00 00 call 7e2 <open> if(fd < 0) 6f2: 83 c4 10 add $0x10,%esp 6f5: 85 c0 test %eax,%eax 6f7: 78 27 js 720 <stat+0x40> return -1; r = fstat(fd, st); 6f9: 83 ec 08 sub $0x8,%esp 6fc: ff 75 0c pushl 0xc(%ebp) 6ff: 89 c3 mov %eax,%ebx 701: 50 push %eax 702: e8 f3 00 00 00 call 7fa <fstat> 707: 89 c6 mov %eax,%esi close(fd); 709: 89 1c 24 mov %ebx,(%esp) 70c: e8 b9 00 00 00 call 7ca <close> return r; 711: 83 c4 10 add $0x10,%esp 714: 89 f0 mov %esi,%eax } 716: 8d 65 f8 lea -0x8(%ebp),%esp 719: 5b pop %ebx 71a: 5e pop %esi 71b: 5d pop %ebp 71c: c3 ret 71d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 720: b8 ff ff ff ff mov $0xffffffff,%eax 725: eb ef jmp 716 <stat+0x36> 727: 89 f6 mov %esi,%esi 729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000730 <atoi>: return r; } int atoi(const char *s) { 730: 55 push %ebp 731: 89 e5 mov %esp,%ebp 733: 53 push %ebx 734: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 737: 0f be 11 movsbl (%ecx),%edx 73a: 8d 42 d0 lea -0x30(%edx),%eax 73d: 3c 09 cmp $0x9,%al 73f: b8 00 00 00 00 mov $0x0,%eax 744: 77 1f ja 765 <atoi+0x35> 746: 8d 76 00 lea 0x0(%esi),%esi 749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 750: 8d 04 80 lea (%eax,%eax,4),%eax 753: 83 c1 01 add $0x1,%ecx 756: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 75a: 0f be 11 movsbl (%ecx),%edx 75d: 8d 5a d0 lea -0x30(%edx),%ebx 760: 80 fb 09 cmp $0x9,%bl 763: 76 eb jbe 750 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 765: 5b pop %ebx 766: 5d pop %ebp 767: c3 ret 768: 90 nop 769: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000770 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 770: 55 push %ebp 771: 89 e5 mov %esp,%ebp 773: 56 push %esi 774: 53 push %ebx 775: 8b 5d 10 mov 0x10(%ebp),%ebx 778: 8b 45 08 mov 0x8(%ebp),%eax 77b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 77e: 85 db test %ebx,%ebx 780: 7e 14 jle 796 <memmove+0x26> 782: 31 d2 xor %edx,%edx 784: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 788: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 78c: 88 0c 10 mov %cl,(%eax,%edx,1) 78f: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 792: 39 da cmp %ebx,%edx 794: 75 f2 jne 788 <memmove+0x18> *dst++ = *src++; return vdst; } 796: 5b pop %ebx 797: 5e pop %esi 798: 5d pop %ebp 799: c3 ret 0000079a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 79a: b8 01 00 00 00 mov $0x1,%eax 79f: cd 40 int $0x40 7a1: c3 ret 000007a2 <exit>: SYSCALL(exit) 7a2: b8 02 00 00 00 mov $0x2,%eax 7a7: cd 40 int $0x40 7a9: c3 ret 000007aa <wait>: SYSCALL(wait) 7aa: b8 03 00 00 00 mov $0x3,%eax 7af: cd 40 int $0x40 7b1: c3 ret 000007b2 <pipe>: SYSCALL(pipe) 7b2: b8 04 00 00 00 mov $0x4,%eax 7b7: cd 40 int $0x40 7b9: c3 ret 000007ba <read>: SYSCALL(read) 7ba: b8 05 00 00 00 mov $0x5,%eax 7bf: cd 40 int $0x40 7c1: c3 ret 000007c2 <write>: SYSCALL(write) 7c2: b8 10 00 00 00 mov $0x10,%eax 7c7: cd 40 int $0x40 7c9: c3 ret 000007ca <close>: SYSCALL(close) 7ca: b8 15 00 00 00 mov $0x15,%eax 7cf: cd 40 int $0x40 7d1: c3 ret 000007d2 <kill>: SYSCALL(kill) 7d2: b8 06 00 00 00 mov $0x6,%eax 7d7: cd 40 int $0x40 7d9: c3 ret 000007da <exec>: SYSCALL(exec) 7da: b8 07 00 00 00 mov $0x7,%eax 7df: cd 40 int $0x40 7e1: c3 ret 000007e2 <open>: SYSCALL(open) 7e2: b8 0f 00 00 00 mov $0xf,%eax 7e7: cd 40 int $0x40 7e9: c3 ret 000007ea <mknod>: SYSCALL(mknod) 7ea: b8 11 00 00 00 mov $0x11,%eax 7ef: cd 40 int $0x40 7f1: c3 ret 000007f2 <unlink>: SYSCALL(unlink) 7f2: b8 12 00 00 00 mov $0x12,%eax 7f7: cd 40 int $0x40 7f9: c3 ret 000007fa <fstat>: SYSCALL(fstat) 7fa: b8 08 00 00 00 mov $0x8,%eax 7ff: cd 40 int $0x40 801: c3 ret 00000802 <link>: SYSCALL(link) 802: b8 13 00 00 00 mov $0x13,%eax 807: cd 40 int $0x40 809: c3 ret 0000080a <mkdir>: SYSCALL(mkdir) 80a: b8 14 00 00 00 mov $0x14,%eax 80f: cd 40 int $0x40 811: c3 ret 00000812 <chdir>: SYSCALL(chdir) 812: b8 09 00 00 00 mov $0x9,%eax 817: cd 40 int $0x40 819: c3 ret 0000081a <dup>: SYSCALL(dup) 81a: b8 0a 00 00 00 mov $0xa,%eax 81f: cd 40 int $0x40 821: c3 ret 00000822 <getpid>: SYSCALL(getpid) 822: b8 0b 00 00 00 mov $0xb,%eax 827: cd 40 int $0x40 829: c3 ret 0000082a <sbrk>: SYSCALL(sbrk) 82a: b8 0c 00 00 00 mov $0xc,%eax 82f: cd 40 int $0x40 831: c3 ret 00000832 <sleep>: SYSCALL(sleep) 832: b8 0d 00 00 00 mov $0xd,%eax 837: cd 40 int $0x40 839: c3 ret 0000083a <uptime>: SYSCALL(uptime) 83a: b8 0e 00 00 00 mov $0xe,%eax 83f: cd 40 int $0x40 841: c3 ret 00000842 <countTrap>: SYSCALL(countTrap) 842: b8 16 00 00 00 mov $0x16,%eax 847: cd 40 int $0x40 849: c3 ret 0000084a <getSharedPage>: SYSCALL(getSharedPage) 84a: b8 17 00 00 00 mov $0x17,%eax 84f: cd 40 int $0x40 851: c3 ret 00000852 <freeSharedPage>: SYSCALL(freeSharedPage) 852: b8 18 00 00 00 mov $0x18,%eax 857: cd 40 int $0x40 859: c3 ret 0000085a <callBRead>: SYSCALL(callBRead) 85a: b8 19 00 00 00 mov $0x19,%eax 85f: cd 40 int $0x40 861: c3 ret 00000862 <callSBRead>: SYSCALL(callSBRead) 862: b8 1a 00 00 00 mov $0x1a,%eax 867: cd 40 int $0x40 869: c3 ret 0000086a <seek>: SYSCALL(seek) 86a: b8 1b 00 00 00 mov $0x1b,%eax 86f: cd 40 int $0x40 871: c3 ret 00000872 <callBWrite>: 872: b8 1c 00 00 00 mov $0x1c,%eax 877: cd 40 int $0x40 879: c3 ret 87a: 66 90 xchg %ax,%ax 87c: 66 90 xchg %ax,%ax 87e: 66 90 xchg %ax,%ax 00000880 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 880: 55 push %ebp 881: 89 e5 mov %esp,%ebp 883: 57 push %edi 884: 56 push %esi 885: 53 push %ebx 886: 89 c6 mov %eax,%esi 888: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 88b: 8b 5d 08 mov 0x8(%ebp),%ebx 88e: 85 db test %ebx,%ebx 890: 74 7e je 910 <printint+0x90> 892: 89 d0 mov %edx,%eax 894: c1 e8 1f shr $0x1f,%eax 897: 84 c0 test %al,%al 899: 74 75 je 910 <printint+0x90> neg = 1; x = -xx; 89b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 89d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 8a4: f7 d8 neg %eax 8a6: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 8a9: 31 ff xor %edi,%edi 8ab: 8d 5d d7 lea -0x29(%ebp),%ebx 8ae: 89 ce mov %ecx,%esi 8b0: eb 08 jmp 8ba <printint+0x3a> 8b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 8b8: 89 cf mov %ecx,%edi 8ba: 31 d2 xor %edx,%edx 8bc: 8d 4f 01 lea 0x1(%edi),%ecx 8bf: f7 f6 div %esi 8c1: 0f b6 92 20 0e 00 00 movzbl 0xe20(%edx),%edx }while((x /= base) != 0); 8c8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 8ca: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 8cd: 75 e9 jne 8b8 <printint+0x38> if(neg) 8cf: 8b 45 c4 mov -0x3c(%ebp),%eax 8d2: 8b 75 c0 mov -0x40(%ebp),%esi 8d5: 85 c0 test %eax,%eax 8d7: 74 08 je 8e1 <printint+0x61> buf[i++] = '-'; 8d9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 8de: 8d 4f 02 lea 0x2(%edi),%ecx 8e1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 8e5: 8d 76 00 lea 0x0(%esi),%esi 8e8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 8eb: 83 ec 04 sub $0x4,%esp 8ee: 83 ef 01 sub $0x1,%edi 8f1: 6a 01 push $0x1 8f3: 53 push %ebx 8f4: 56 push %esi 8f5: 88 45 d7 mov %al,-0x29(%ebp) 8f8: e8 c5 fe ff ff call 7c2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 8fd: 83 c4 10 add $0x10,%esp 900: 39 df cmp %ebx,%edi 902: 75 e4 jne 8e8 <printint+0x68> putc(fd, buf[i]); } 904: 8d 65 f4 lea -0xc(%ebp),%esp 907: 5b pop %ebx 908: 5e pop %esi 909: 5f pop %edi 90a: 5d pop %ebp 90b: c3 ret 90c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 910: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 912: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 919: eb 8b jmp 8a6 <printint+0x26> 91b: 90 nop 91c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000920 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 920: 55 push %ebp 921: 89 e5 mov %esp,%ebp 923: 57 push %edi 924: 56 push %esi 925: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 926: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 929: 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++){ 92c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 92f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 932: 89 45 d0 mov %eax,-0x30(%ebp) 935: 0f b6 1e movzbl (%esi),%ebx 938: 83 c6 01 add $0x1,%esi 93b: 84 db test %bl,%bl 93d: 0f 84 b0 00 00 00 je 9f3 <printf+0xd3> 943: 31 d2 xor %edx,%edx 945: eb 39 jmp 980 <printf+0x60> 947: 89 f6 mov %esi,%esi 949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 950: 83 f8 25 cmp $0x25,%eax 953: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 956: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 95b: 74 18 je 975 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 95d: 8d 45 e2 lea -0x1e(%ebp),%eax 960: 83 ec 04 sub $0x4,%esp 963: 88 5d e2 mov %bl,-0x1e(%ebp) 966: 6a 01 push $0x1 968: 50 push %eax 969: 57 push %edi 96a: e8 53 fe ff ff call 7c2 <write> 96f: 8b 55 d4 mov -0x2c(%ebp),%edx 972: 83 c4 10 add $0x10,%esp 975: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 978: 0f b6 5e ff movzbl -0x1(%esi),%ebx 97c: 84 db test %bl,%bl 97e: 74 73 je 9f3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 980: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 982: 0f be cb movsbl %bl,%ecx 985: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 988: 74 c6 je 950 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 98a: 83 fa 25 cmp $0x25,%edx 98d: 75 e6 jne 975 <printf+0x55> if(c == 'd'){ 98f: 83 f8 64 cmp $0x64,%eax 992: 0f 84 f8 00 00 00 je a90 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 998: 81 e1 f7 00 00 00 and $0xf7,%ecx 99e: 83 f9 70 cmp $0x70,%ecx 9a1: 74 5d je a00 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 9a3: 83 f8 73 cmp $0x73,%eax 9a6: 0f 84 84 00 00 00 je a30 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 9ac: 83 f8 63 cmp $0x63,%eax 9af: 0f 84 ea 00 00 00 je a9f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 9b5: 83 f8 25 cmp $0x25,%eax 9b8: 0f 84 c2 00 00 00 je a80 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 9be: 8d 45 e7 lea -0x19(%ebp),%eax 9c1: 83 ec 04 sub $0x4,%esp 9c4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 9c8: 6a 01 push $0x1 9ca: 50 push %eax 9cb: 57 push %edi 9cc: e8 f1 fd ff ff call 7c2 <write> 9d1: 83 c4 0c add $0xc,%esp 9d4: 8d 45 e6 lea -0x1a(%ebp),%eax 9d7: 88 5d e6 mov %bl,-0x1a(%ebp) 9da: 6a 01 push $0x1 9dc: 50 push %eax 9dd: 57 push %edi 9de: 83 c6 01 add $0x1,%esi 9e1: e8 dc fd ff ff call 7c2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 9e6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 9ea: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 9ed: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 9ef: 84 db test %bl,%bl 9f1: 75 8d jne 980 <printf+0x60> putc(fd, c); } state = 0; } } } 9f3: 8d 65 f4 lea -0xc(%ebp),%esp 9f6: 5b pop %ebx 9f7: 5e pop %esi 9f8: 5f pop %edi 9f9: 5d pop %ebp 9fa: c3 ret 9fb: 90 nop 9fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); a00: 83 ec 0c sub $0xc,%esp a03: b9 10 00 00 00 mov $0x10,%ecx a08: 6a 00 push $0x0 a0a: 8b 5d d0 mov -0x30(%ebp),%ebx a0d: 89 f8 mov %edi,%eax a0f: 8b 13 mov (%ebx),%edx a11: e8 6a fe ff ff call 880 <printint> ap++; a16: 89 d8 mov %ebx,%eax a18: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; a1b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; a1d: 83 c0 04 add $0x4,%eax a20: 89 45 d0 mov %eax,-0x30(%ebp) a23: e9 4d ff ff ff jmp 975 <printf+0x55> a28: 90 nop a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; a30: 8b 45 d0 mov -0x30(%ebp),%eax a33: 8b 18 mov (%eax),%ebx ap++; a35: 83 c0 04 add $0x4,%eax a38: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; a3b: b8 18 0e 00 00 mov $0xe18,%eax a40: 85 db test %ebx,%ebx a42: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ a45: 0f b6 03 movzbl (%ebx),%eax a48: 84 c0 test %al,%al a4a: 74 23 je a6f <printf+0x14f> a4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi a50: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); a53: 8d 45 e3 lea -0x1d(%ebp),%eax a56: 83 ec 04 sub $0x4,%esp a59: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; a5b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); a5e: 50 push %eax a5f: 57 push %edi a60: e8 5d fd ff ff call 7c2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ a65: 0f b6 03 movzbl (%ebx),%eax a68: 83 c4 10 add $0x10,%esp a6b: 84 c0 test %al,%al a6d: 75 e1 jne a50 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; a6f: 31 d2 xor %edx,%edx a71: e9 ff fe ff ff jmp 975 <printf+0x55> a76: 8d 76 00 lea 0x0(%esi),%esi a79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); a80: 83 ec 04 sub $0x4,%esp a83: 88 5d e5 mov %bl,-0x1b(%ebp) a86: 8d 45 e5 lea -0x1b(%ebp),%eax a89: 6a 01 push $0x1 a8b: e9 4c ff ff ff jmp 9dc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); a90: 83 ec 0c sub $0xc,%esp a93: b9 0a 00 00 00 mov $0xa,%ecx a98: 6a 01 push $0x1 a9a: e9 6b ff ff ff jmp a0a <printf+0xea> a9f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); aa2: 83 ec 04 sub $0x4,%esp aa5: 8b 03 mov (%ebx),%eax aa7: 6a 01 push $0x1 aa9: 88 45 e4 mov %al,-0x1c(%ebp) aac: 8d 45 e4 lea -0x1c(%ebp),%eax aaf: 50 push %eax ab0: 57 push %edi ab1: e8 0c fd ff ff call 7c2 <write> ab6: e9 5b ff ff ff jmp a16 <printf+0xf6> abb: 66 90 xchg %ax,%ax abd: 66 90 xchg %ax,%ax abf: 90 nop 00000ac0 <free>: static Header base; static Header *freep; void free(void *ap) { ac0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) ac1: a1 84 11 00 00 mov 0x1184,%eax static Header base; static Header *freep; void free(void *ap) { ac6: 89 e5 mov %esp,%ebp ac8: 57 push %edi ac9: 56 push %esi aca: 53 push %ebx acb: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) ace: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; ad0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) ad3: 39 c8 cmp %ecx,%eax ad5: 73 19 jae af0 <free+0x30> ad7: 89 f6 mov %esi,%esi ad9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ae0: 39 d1 cmp %edx,%ecx ae2: 72 1c jb b00 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) ae4: 39 d0 cmp %edx,%eax ae6: 73 18 jae b00 <free+0x40> static Header base; static Header *freep; void free(void *ap) { ae8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) aea: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) aec: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) aee: 72 f0 jb ae0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) af0: 39 d0 cmp %edx,%eax af2: 72 f4 jb ae8 <free+0x28> af4: 39 d1 cmp %edx,%ecx af6: 73 f0 jae ae8 <free+0x28> af8: 90 nop af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ b00: 8b 73 fc mov -0x4(%ebx),%esi b03: 8d 3c f1 lea (%ecx,%esi,8),%edi b06: 39 d7 cmp %edx,%edi b08: 74 19 je b23 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 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: 74 23 je b3a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; b17: 89 08 mov %ecx,(%eax) freep = p; b19: a3 84 11 00 00 mov %eax,0x1184 } b1e: 5b pop %ebx b1f: 5e pop %esi b20: 5f pop %edi b21: 5d pop %ebp b22: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; b23: 03 72 04 add 0x4(%edx),%esi b26: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; b29: 8b 10 mov (%eax),%edx b2b: 8b 12 mov (%edx),%edx b2d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ b30: 8b 50 04 mov 0x4(%eax),%edx b33: 8d 34 d0 lea (%eax,%edx,8),%esi b36: 39 f1 cmp %esi,%ecx b38: 75 dd jne b17 <free+0x57> p->s.size += bp->s.size; b3a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; b3d: a3 84 11 00 00 mov %eax,0x1184 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; b42: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; b45: 8b 53 f8 mov -0x8(%ebx),%edx b48: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } b4a: 5b pop %ebx b4b: 5e pop %esi b4c: 5f pop %edi b4d: 5d pop %ebp b4e: c3 ret b4f: 90 nop 00000b50 <malloc>: return freep; } void* malloc(uint nbytes) { b50: 55 push %ebp b51: 89 e5 mov %esp,%ebp b53: 57 push %edi b54: 56 push %esi b55: 53 push %ebx b56: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; b59: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ b5c: 8b 15 84 11 00 00 mov 0x1184,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; b62: 8d 78 07 lea 0x7(%eax),%edi b65: c1 ef 03 shr $0x3,%edi b68: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ b6b: 85 d2 test %edx,%edx b6d: 0f 84 a3 00 00 00 je c16 <malloc+0xc6> b73: 8b 02 mov (%edx),%eax b75: 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){ b78: 39 cf cmp %ecx,%edi b7a: 76 74 jbe bf0 <malloc+0xa0> b7c: 81 ff 00 10 00 00 cmp $0x1000,%edi b82: be 00 10 00 00 mov $0x1000,%esi b87: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx b8e: 0f 43 f7 cmovae %edi,%esi b91: ba 00 80 00 00 mov $0x8000,%edx b96: 81 ff ff 0f 00 00 cmp $0xfff,%edi b9c: 0f 46 da cmovbe %edx,%ebx b9f: eb 10 jmp bb1 <malloc+0x61> ba1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ ba8: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ baa: 8b 48 04 mov 0x4(%eax),%ecx bad: 39 cf cmp %ecx,%edi baf: 76 3f jbe bf0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) bb1: 39 05 84 11 00 00 cmp %eax,0x1184 bb7: 89 c2 mov %eax,%edx bb9: 75 ed jne ba8 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); bbb: 83 ec 0c sub $0xc,%esp bbe: 53 push %ebx bbf: e8 66 fc ff ff call 82a <sbrk> if(p == (char*)-1) bc4: 83 c4 10 add $0x10,%esp bc7: 83 f8 ff cmp $0xffffffff,%eax bca: 74 1c je be8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; bcc: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); bcf: 83 ec 0c sub $0xc,%esp bd2: 83 c0 08 add $0x8,%eax bd5: 50 push %eax bd6: e8 e5 fe ff ff call ac0 <free> return freep; bdb: 8b 15 84 11 00 00 mov 0x1184,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) be1: 83 c4 10 add $0x10,%esp be4: 85 d2 test %edx,%edx be6: 75 c0 jne ba8 <malloc+0x58> return 0; be8: 31 c0 xor %eax,%eax bea: eb 1c jmp c08 <malloc+0xb8> bec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) bf0: 39 cf cmp %ecx,%edi bf2: 74 1c je c10 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; bf4: 29 f9 sub %edi,%ecx bf6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; bf9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; bfc: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; bff: 89 15 84 11 00 00 mov %edx,0x1184 return (void*)(p + 1); c05: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } c08: 8d 65 f4 lea -0xc(%ebp),%esp c0b: 5b pop %ebx c0c: 5e pop %esi c0d: 5f pop %edi c0e: 5d pop %ebp c0f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; c10: 8b 08 mov (%eax),%ecx c12: 89 0a mov %ecx,(%edx) c14: eb e9 jmp bff <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; c16: c7 05 84 11 00 00 88 movl $0x1188,0x1184 c1d: 11 00 00 c20: c7 05 88 11 00 00 88 movl $0x1188,0x1188 c27: 11 00 00 base.s.size = 0; c2a: b8 88 11 00 00 mov $0x1188,%eax c2f: c7 05 8c 11 00 00 00 movl $0x0,0x118c c36: 00 00 00 c39: e9 3e ff ff ff jmp b7c <malloc+0x2c>
tools/xml2ayacc/encoding/encodings-read.ads
faelys/gela-asis
4
28477
-------------------------------------------------------- -- E n c o d i n g s -- -- -- -- Tools for convertion strings between Unicode and -- -- national/vendor character sets. -- -- - - - - - - - - - -- -- Read copyright and license at the end of this file -- -------------------------------------------------------- with Encodings.Maps; package Encodings.Read is type Mapping (Start : Character; Ranges_Count : Maps.Range_Count; Char_Count : Maps.Backward_Index) is record Forward : Maps.Forward_Map (Start .. Character'Last); Ranges : Maps.Wide_Ranges (1 .. Ranges_Count); Backward : Maps.Backward_Map (1 .. Char_Count); end record; function Table (File_Name : String) return Mapping; end Encodings.Read; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * 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 <NAME>, 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 OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
programs/oeis/267/A267938.asm
neoneye/loda
22
17982
; A267938: Decimal representation of the n-th iteration of the "Rule 251" elementary cellular automaton starting with a single ON (black) cell. ; 1,5,31,127,511,2047,8191,32767,131071,524287,2097151,8388607,33554431,134217727,536870911,2147483647,8589934591,34359738367,137438953471,549755813887,2199023255551,8796093022207,35184372088831,140737488355327,562949953421311,2251799813685247,9007199254740991,36028797018963967,144115188075855871,576460752303423487,2305843009213693951,9223372036854775807,36893488147419103231,147573952589676412927,590295810358705651711,2361183241434822606847,9444732965739290427391,37778931862957161709567,151115727451828646838271,604462909807314587353087,2417851639229258349412351,9671406556917033397649407,38685626227668133590597631,154742504910672534362390527,618970019642690137449562111,2475880078570760549798248447,9903520314283042199192993791,39614081257132168796771975167,158456325028528675187087900671,633825300114114700748351602687,2535301200456458802993406410751,10141204801825835211973625643007,40564819207303340847894502572031,162259276829213363391578010288127,649037107316853453566312041152511,2596148429267413814265248164610047,10384593717069655257060992658440191,41538374868278621028243970633760767,166153499473114484112975882535043071,664613997892457936451903530140172287 mov $1,4 pow $1,$0 mov $2,7 div $2,$1 sub $1,1 trn $1,$2 mul $1,2 add $1,1 mov $0,$1
test/Succeed/Issue2814.agda
cagix/agda
1,989
8049
<reponame>cagix/agda<filename>test/Succeed/Issue2814.agda -- Issue #2814 reported by tomjack on 2017-10-18 {-# OPTIONS --cubical --rewriting --confluence-check #-} -- prelude stolen from Saizan/cubical-demo open import Agda.Primitive.Cubical public open import Agda.Builtin.Cubical.Path Path = _≡_ refl : ∀ {ℓ} {A : Set ℓ} {x : A} → x ≡ x refl {x = x} = λ _ → x postulate Rewrite : ∀ {ℓ} {A : Set ℓ} → A → A → Set {-# BUILTIN REWRITE Rewrite #-} module Good where postulate Unit : Set unit : Unit module UnitElim (P : Unit → Set) (unit* : P unit) where postulate Unit-elim : (x : Unit) → P x unit-β : Rewrite (Unit-elim unit) unit* open UnitElim public {-# REWRITE unit-β #-} test₁ : {C : Set} {c₀ : C} → Path {A = C} (Unit-elim (λ _ → C) c₀ unit) c₀ test₁ = refl test₂ : {C : Set} {c₀ : C} → Path {A = Path c₀ c₀} (λ j → Unit-elim (λ _ → C) c₀ unit) refl test₂ = refl -- same code, but with a dummy module parameter module Bad (Dummy : Set) where postulate Unit : Set unit : Unit module UnitElim (P : Unit → Set) (unit* : P unit) where postulate Unit-elim : (x : Unit) → P x unit-β : Rewrite (Unit-elim unit) unit* open UnitElim public {-# REWRITE unit-β #-} test₁ : {C : Set} {c₀ : C} → Path {A = C} (Unit-elim (λ _ → C) c₀ unit) c₀ test₁ = refl test₂ : {C : Set} {c₀ : C} → Path {A = Path c₀ c₀} (λ j → Unit-elim (λ _ → C) c₀ unit) refl test₂ = refl -- WAS: -- Unit-elim (λ _ → .C) .c₀ unit != .c₀ of type .C -- when checking that the expression refl has type -- Path (λ j → Unit-elim (λ _ → .C) .c₀ unit) refl -- SHOULD: succeed
src/rename_utf8.template.applescript
hyperbora/mac-renaming-file
1
3691
on adding folder items to theAttachedFolder after receiving theNewItems tell application "Finder" set all_files to every item of theNewItems as list repeat with index from 1 to the count of all_files set this_file to item index of all_files set this_file_name to name of (info for this_file) set this_file_ext to name extension of (info for this_file) set ignore_ext to "part download" if (ignore_ext does not contain this_file_ext) then -- 쉘 스크립트 경로 수정 (/path/to/rename_utf8.sh) set new_file_name to do shell script "/path/to/rename_utf8.sh \"" & this_file_name & "\"" if (this_file_name is not new_file_name) then if exists file (theAttachedFolder & new_file_name as string) then set i to 1 repeat while i > 0 set temp_file_name to i & "_" & new_file_name as string if exists file (theAttachedFolder & temp_file_name as string) then set i to i + 1 else set the name of this_file to temp_file_name exit repeat end if end repeat else set the name of this_file to new_file_name end if end if end if end repeat end tell end adding folder items to
Userland/SampleCodeModule/asm/mainLib.asm
JuanOriana/TPE_ARQUI
0
81684
GLOBAL reader GLOBAL writer GLOBAL scClear GLOBAL timeInfo GLOBAL chFont GLOBAL drawFig GLOBAL getMem GLOBAL getRegs GLOBAL writeAtPos GLOBAL timer GLOBAL opCodeExc GLOBAL keyBinder GLOBAL pureMalloc GLOBAL pureFree GLOBAL pureMemDump ; read - lee de un fd determinado ; IN- RDI - FD ; RSI - Buffer ; RDX - size reader: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;len en rdx mov rdx, rsi ;buff en rdx mov rsi,rdi ; fd en rsi mov rdi,0 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret ; write - escribe en un fd determinado ;IN- RDI - FD ; RSI - Buffer ; RDX - size writer: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;len en rdx mov rdx, rsi ;buff en rdx mov rsi,rdi ; fd en rsi mov rdi,1 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret ; write - escribe en un fd determinado ;IN- RDI - FD ; RSI - fig drawFig: push rbp mov rbp,rsp; push rdi push rsi push rdx mov rdx, rsi ;fig en rdx mov rsi,rdi ; fd en rsi mov rdi,7 ; id int int 80h pop rdx pop rsi pop rdi leave ret ;scClear - Limpia la pantalla scClear: push rbp mov rbp,rsp push rdi push rsi mov rdi, 2 int 80h pop rsi pop rdi leave ret ;chColor - cambia el color de escritura ;IN - RDI - color chFont: push rbp mov rbp,rsp push rdi push rsi mov rsi,rdi mov rdi, 3 int 80h pop rsi pop rdi leave ret ;timeInfo - obtiene info del tiempo ;IN - RDI selector de data timeInfo: push rbp mov rbp,rsp push rdi push rsi mov rsi,rdi mov rdi, 6 int 80h pop rsi pop rdi leave ret ; getMem - recibe el valor de memoria en un vecctor ;IN- RDI - buffer ; RSI - address ; RDX - bytes getMem: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;bytes en rdx mov rdx, rsi ;address en rdx mov rsi,rdi ; buff en rsi mov rdi,4 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret ; write - escribe en un fd determinado ;IN- RDI - FD ; RSI - Buffer ; RDX - size ; RCX - x ; R8 - y writeAtPos: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx push r8 push r9 mov r9, r8 ;y en r9 mov r8, rcx ;x en r8 mov rcx ,rdx ;size en rdx mov rdx, rsi ;buff en rdx mov rsi,rdi ; fd en rsi mov rdi,8 ; id int int 80h pop r9 pop r8 pop rcx pop rdx pop rsi pop rdi leave ret ;getRegs - abtiene el valor de los 15 registros ;IN - RDI buffer getRegs: push rbp mov rbp,rsp push rdi push rsi mov rsi,rdi mov rdi, 5 int 80h pop rsi pop rdi leave ret ;timer: inicia o para un timer de funcion f ;IN- RDI - flag de inicio o stop ; RSI - intervalo de tiempo ; RDX - funcion timer: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;function en rcx mov rdx, rsi ;intervalo en rdx mov rsi,rdi ; flag en rsi mov rdi,9 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret ;keyBinder: bindea una tecla de funcion (F1 o F2) a una funcion ;IN- RDI - flag de bind o unbind ; RSI - tecla a bindear ; RDX - funcion keyBinder: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;function en rcx mov rdx, rsi ;tecla en rdx mov rsi,rdi ; flag en rsi mov rdi,10 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret opCodeExc: UD2 ret pureMalloc: push rbp mov rbp,rsp; push rdi push rsi mov rsi,rdi ; size en rsi mov rdi,11 ; id int int 80h pop rsi pop rdi leave ret pureFree: push rbp mov rbp,rsp; push rdi push rsi mov rsi,rdi ; memDirec en rsi mov rdi,12 ; id int int 80h pop rsi pop rdi leave ret pureMemDump: push rbp mov rbp,rsp; push rdi push rsi push rdx push rcx mov rcx ,rdx ;puntero a memoria total en rcx mov rdx, rsi ;puntero a memoria libre en rdx mov rsi,rdi ; puntero a base en rsi mov rdi,13 ; id int int 80h pop rcx pop rdx pop rsi pop rdi leave ret
src/derive.agda
shinji-kono/automaton-in-agda
0
1523
{-# OPTIONS --allow-unsolved-metas #-} open import Relation.Binary.PropositionalEquality hiding ( [_] ) open import Relation.Nullary using (¬_; Dec; yes; no) open import Data.List hiding ( [_] ) open import finiteSet module derive ( Σ : Set) ( fin : FiniteSet Σ ) ( eq? : (x y : Σ) → Dec (x ≡ y)) where -- open import nfa open import Data.Nat -- open import Data.Nat hiding ( _<_ ; _>_ ) -- open import Data.Fin hiding ( _<_ ) open import finiteSetUtil open import automaton open import logic open import regex open FiniteSet -- whether a regex accepts empty input -- empty? : Regex Σ → Bool empty? ε = true empty? φ = false empty? (x *) = true empty? (x & y) = empty? x /\ empty? y empty? (x || y) = empty? x \/ empty? y empty? < x > = false derivative : Regex Σ → Σ → Regex Σ derivative ε s = φ derivative φ s = φ derivative (x *) s with derivative x s ... | ε = x * ... | φ = φ ... | t = t & (x *) derivative (x & y) s with empty? x ... | true with derivative x s | derivative y s ... | ε | φ = φ ... | ε | t = y || t ... | φ | t = t ... | x1 | φ = x1 & y ... | x1 | y1 = (x1 & y) || y1 derivative (x & y) s | false with derivative x s ... | ε = y ... | φ = φ ... | t = t & y derivative (x || y) s with derivative x s | derivative y s ... | φ | y1 = y1 ... | x1 | φ = x1 ... | x1 | y1 = x1 || y1 derivative < x > s with eq? x s ... | yes _ = ε ... | no _ = φ data regex-states (x : Regex Σ ) : Regex Σ → Set where unit : regex-states x x derive : { y : Regex Σ } → regex-states x y → (s : Σ) → regex-states x ( derivative y s ) record Derivative (x : Regex Σ ) : Set where field state : Regex Σ is-derived : regex-states x state open Derivative open import Data.Fin hiding (_<_) -- derivative generates (x & y) || ... form. y and x part is a substerm of original regex -- since subterm is finite, only finite number of state is generated for each operator -- this does not work, becuase it depends on input sequences -- finite-derivative : (r : Regex Σ) → FiniteSet Σ → FiniteSet (Derivative r) -- order : Regex Σ → ℕ -- decline-derive : (x : Regex Σ ) (i : Σ ) → 0 < order x → order (derivative x i) < order x -- is not so easy -- in case of automaton, number of derivative is limited by iteration of input length, so it is finite. -- so we cannot say derived automaton is finite i.e. regex-match is regular language now regex→automaton : (r : Regex Σ) → Automaton (Derivative r) Σ regex→automaton r = record { δ = λ d s → record { state = derivative (state d) s ; is-derived = derive-step d s} ; aend = λ d → empty? (state d) } where derive-step : (d0 : Derivative r) → (s : Σ) → regex-states r (derivative (state d0) s) derive-step d0 s = derive (is-derived d0) s regex-match : (r : Regex Σ) → (List Σ) → Bool regex-match ex is = accept ( regex→automaton ex ) record { state = ex ; is-derived = unit } is open import Relation.Binary.Definitions cmp-regex : (x y : Regex Σ) → Dec ( x ≡ y ) cmp-regex ε ε = yes refl cmp-regex ε φ = no (λ ()) cmp-regex ε (y *) = no (λ ()) cmp-regex ε (y & y₁) = no (λ ()) cmp-regex ε (y || y₁) = no (λ ()) cmp-regex ε < x > = no (λ ()) cmp-regex φ ε = no (λ ()) cmp-regex φ φ = yes refl cmp-regex φ (y *) = no (λ ()) cmp-regex φ (y & y₁) = no (λ ()) cmp-regex φ (y || y₁) = no (λ ()) cmp-regex φ < x > = no (λ ()) cmp-regex (x *) ε = no (λ ()) cmp-regex (x *) φ = no (λ ()) cmp-regex (x *) (y *) with cmp-regex x y ... | yes refl = yes refl ... | no ne = no (λ x → ne (cmp1 x)) where cmp1 : (x *) ≡ (y *) → x ≡ y cmp1 refl = refl cmp-regex (x *) (y & y₁) = no (λ ()) cmp-regex (x *) (y || y₁) = no (λ ()) cmp-regex (x *) < x₁ > = no (λ ()) cmp-regex (x & x₁) ε = no (λ ()) cmp-regex (x & x₁) φ = no (λ ()) cmp-regex (x & x₁) (y *) = no (λ ()) cmp-regex (x & x₁) (y & y₁) with cmp-regex x y | cmp-regex x₁ y₁ ... | yes refl | yes refl = yes refl ... | no ne | _ = no (λ x → ne (cmp1 x)) where cmp1 : x & x₁ ≡ y & y₁ → x ≡ y cmp1 refl = refl ... | _ | no ne = no (λ x → ne (cmp1 x)) where cmp1 : x & x₁ ≡ y & y₁ → x₁ ≡ y₁ cmp1 refl = refl cmp-regex (x & x₁) (y || y₁) = no (λ ()) cmp-regex (x & x₁) < x₂ > = no (λ ()) cmp-regex (x || x₁) ε = no (λ ()) cmp-regex (x || x₁) φ = no (λ ()) cmp-regex (x || x₁) (y *) = no (λ ()) cmp-regex (x || x₁) (y & y₁) = no (λ ()) cmp-regex (x || x₁) (y || y₁) with cmp-regex x y | cmp-regex x₁ y₁ ... | yes refl | yes refl = yes refl ... | no ne | _ = no (λ x → ne (cmp1 x)) where cmp1 : x || x₁ ≡ y || y₁ → x ≡ y cmp1 refl = refl ... | _ | no ne = no (λ x → ne (cmp1 x)) where cmp1 : x || x₁ ≡ y || y₁ → x₁ ≡ y₁ cmp1 refl = refl cmp-regex (x || x₁) < x₂ > = no (λ ()) cmp-regex < x > ε = no (λ ()) cmp-regex < x > φ = no (λ ()) cmp-regex < x > (y *) = no (λ ()) cmp-regex < x > (y & y₁) = no (λ ()) cmp-regex < x > (y || y₁) = no (λ ()) cmp-regex < x > < x₁ > with equal? fin x x₁ | inspect ( equal? fin x ) x₁ ... | false | record { eq = eq } = no (λ x → ¬-bool eq (cmp1 x)) where cmp1 : < x > ≡ < x₁ > → equal? fin x x₁ ≡ true cmp1 refl = equal?-refl fin ... | true | record { eq = eq } with equal→refl fin eq ... | refl = yes refl insert : List (Regex Σ) → (Regex Σ) → List (Regex Σ) insert [] k = k ∷ [] insert (x ∷ t) k with cmp-regex k x ... | no n = x ∷ (insert t k) ... | yes y = x ∷ t regex-derive : List (Regex Σ) → List (Regex Σ) regex-derive t = regex-derive0 t t where regex-derive1 : Regex Σ → List Σ → List (Regex Σ) → List (Regex Σ) regex-derive1 x [] t = t regex-derive1 x (i ∷ t) r = regex-derive1 x t (insert r (derivative x i)) regex-derive0 : List (Regex Σ) → List (Regex Σ) → List (Regex Σ) regex-derive0 [] t = t regex-derive0 (x ∷ r) t = regex-derive0 r (regex-derive1 x (to-list fin (λ _ → true)) t) -- -- if (Derivative r is finite, regex→automaton is finite -- drive-is-finite : (r : Regex Σ) → FiniteSet (Derivative r) drive-is-finite ε = {!!} drive-is-finite φ = {!!} drive-is-finite (r *) = {!!} where d1 : FiniteSet (Derivative r ) d1 = drive-is-finite r drive-is-finite (r & r₁) = {!!} drive-is-finite (r || r₁) = {!!} drive-is-finite < x > = {!!}
oeis/053/A053203.asm
neoneye/loda-programs
11
244169
; A053203: Pascal's triangle (excluding first, last three elements of each row) read by rows, row n read mod n. ; Submitted by <NAME> ; 2,0,0,0,6,0,3,0,0,3,0,0,2,0,0,0,0,0,0,0,0,4,3,0,0,0,3,4,0,0,0,0,0,0,0,0,0,7,0,7,2,7,0,7,0,5,0,3,10,0,0,10,3,0,5,0,12,0,8,0,6,0,8,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,0,0,2,0,0,6,0,0,6,0,0,0,0,0,0,0,0,0 lpb $0 add $2,1 sub $0,$2 lpe add $0,3 add $2,6 mov $1,$2 bin $2,$0 mod $2,$1 mov $0,$2
oeis/037/A037698.asm
neoneye/loda-programs
11
105384
<filename>oeis/037/A037698.asm ; A037698: Base 7 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,3,0. ; Submitted by <NAME> ; 1,9,66,462,3235,22647,158532,1109724,7768069,54376485,380635398,2664447786,18651134503,130557941523,913905590664,6397339134648,44781373942537,313469617597761,2194287323184330,15360011262290310,107520078836032171,752640551852225199,5268483862965576396,36879387040759034772,258155709285313243405,1807089964997192703837,12649629754980348926862,88547408284862442488034,619831857994037097416239,4338823005958259681913675,30371761041707817773395728,212602327291954724413770096,1488216291043683070896390673 mov $2,1 lpb $0 sub $0,1 add $1,$2 mul $1,7 add $2,21 mod $2,4 lpe add $1,$2 mov $0,$1
barrier.adb
philipbjorge/Parallel-Elliptic-Partial-Differential-Equation-Solver
1
30684
<reponame>philipbjorge/Parallel-Elliptic-Partial-Differential-Equation-Solver -- <NAME> -- Simple barrier using protected types that -- waits on a certain number of entrants package body Barrier is protected body Barrier_Type is entry Here when not leave is begin count := count + 1; if count < wait_for then requeue Wait; else count := count - 1; if count /= 0 then leave := True; end if; end if; end; entry Wait when leave is begin count := count - 1; if count = 0 then leave := False; end if; end; end Barrier_Type; end Barrier;
programs/oeis/186/A186157.asm
neoneye/loda
22
26591
; A186157: Rank of 2n^2 when {i^3: i>=1} and {2j^2: j>=1} are jointly ranked with i^3 before 2j^2 when i^3=2j^2. Complement of A186156. ; 2,4,5,7,8,10,11,13,14,15,17,18,19,21,22,24,25,26,27,29,30,31,33,34,35,37,38,39,40,42,43,44,45,47,48,49,50,52,53,54,55,57,58,59,60,62,63,64,65,67,68,69,70,72,73,74,75,76,78,79,80,81,82,84,85,86,87,88,90,91,92,93,95,96,97,98,99,101,102,103,104,105,106,108,109,110,111,112,114,115,116,117,118,120,121,122,123,124,125,127 mov $2,$0 add $0,1 pow $0,2 mul $0,2 seq $0,48766 ; Integer part of cube root of n. Or, number of cubes <= n. Or, n appears 3n^2 + 3n + 1 times. add $0,1 add $0,$2
set up finder windows.applescript
AlexanderGalen/applescripts
3
140
<reponame>AlexanderGalen/applescripts set path1 to "HOM_Shortrun:~HOM Archive Jobs:" as alias set path2 to "HOM_Shortrun:~HOM Active Jobs:" as alias set path3 to "Macintosh HD:Users:Maggie:Documents:Temp PDFs:" as alias set path4 to "ART DEPARTMENT-NEW:Proofs-Shortrun:" as alias set window1 to "" set window2 to "" set window3 to "" set window4 to "" to NewWindow(WindowName, PathName, PositionValue, BoundsValue) tell application "Finder" set WindowName to make new Finder window set properties of WindowName to {target:PathName, position:PositionValue, bounds:BoundsValue, current view:column view, sidebar width:205} end tell end NewWindow NewWindow(window1, path1, {-1280, 78}, {-1280, 78, -645, 568}) NewWindow(window2, path2, {-635, 78}, {-635, 78, 0, 568}) NewWindow(window3, path3, {-1280, 602}, {-1280, 602, -645, 1080}) NewWindow(window4, path4, {-635, 602}, {-635, 602, 0, 1079}) tell application "Finder" set properties of Finder window 1 to {current view:list view} end tell
examples/src/rtreq.adb
sonneveld/adazmq
0
25824
<gh_stars>0 -- ROUTER-to-REQ example with Ada.Command_Line; with Ada.Real_Time; with Ada.Text_IO; with GNAT.Formatted_String; with ZMQ; with ZHelper; use type GNAT.Formatted_String.Formatted_String; use type Ada.Real_Time.Time_Span; procedure RTReq is Nbr_Workers : constant := 10; Work_Time_Span : constant := 5; task type Worker_Task_Type is entry Start; end Worker_Task_Type; task body Worker_Task_Type is begin accept Start; declare Context : ZMQ.Context_Type := ZMQ.New_Context; Worker : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_REQ); Total : Natural := 0; begin ZHelper.Set_Id (Worker); -- Set a printable identity. Worker.Connect ("tcp://localhost:5671"); Work_Loop : loop -- Tell the broker we're ready for work Worker.Send ("Hi Boss"); -- Get workload from broker, until finished declare Workload : constant String := Worker.Recv; begin exit Work_Loop when Workload = "Fired!"; end; -- Do some random work delay Duration (ZHelper.Rand_Of (0.001, 0.5)); Total := Total + 1; end loop Work_Loop; Ada.Text_IO.Put_Line (-(+"Completed: %d tasks"&Total)); Worker.Close; Context.Term; end; end Worker_Task_Type; -- While this example runs in a single process, that is only to make -- it easier to start and stop the example. Each thread has its own -- context and conceptually acts as a separate process. function Main return Ada.Command_Line.Exit_Status is Context : ZMQ.Context_Type := ZMQ.New_Context; Broker : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_ROUTER); begin Broker.Bind ("tcp://*:5671"); declare Start_Time : constant Ada.Real_Time.Time := Ada.Real_Time.Clock; Tasks : array (1 .. Nbr_Workers) of Worker_Task_Type; Workers_Fired : Integer := 0; begin for T of Tasks loop T.Start; end loop; -- Run for five seconds and then tell workers to end Monitor_Loop : loop -- Next message gives us least recently used worker declare Identity : constant String := Broker.Recv; Unused_Delimiter : constant String := Broker.Recv; -- Envelope delimiter Unused_Response : constant String := Broker.Recv; -- Response from worker begin Broker.Send (Identity, Send_More => True); Broker.Send ("", Send_More => True); -- Encourage workers until it's time to fire them if (Ada.Real_Time.Clock - Start_Time) < Ada.Real_Time.Seconds (Work_Time_Span) then Broker.Send ("Work harder"); else Broker.Send ("Fired!"); Workers_Fired := Workers_Fired + 1; end if; exit Monitor_Loop when Workers_Fired >= Nbr_Workers; end; end loop Monitor_Loop; end; Broker.Close; Context.Term; return 0; end Main; begin Ada.Command_Line.Set_Exit_Status (Main); end RTReq;
src/portscan-ops.adb
Qrbaker/synth
263
22433
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Numerics.Discrete_Random; with GNAT.String_Split; with PortScan.Buildcycle.Pkgsrc; with PortScan.Buildcycle.Ports; with Replicant.Platform; with Signals; with Unix; package body PortScan.Ops is package GSS renames GNAT.String_Split; package CYC renames PortScan.Buildcycle; package FPC renames PortScan.Buildcycle.Ports; package NPS renames PortScan.Buildcycle.Pkgsrc; package REP renames Replicant; package SIG renames Signals; -------------------------- -- initialize_display -- -------------------------- procedure initialize_display (num_builders : builders) is begin if PM.configuration.avec_ncurses then curses_support := DPY.launch_monitor (num_builders); end if; end initialize_display; ------------------------- -- parallel_bulk_run -- ------------------------- procedure parallel_bulk_run (num_builders : builders; logs : dim_handlers) is subtype cycle_count is Natural range 1 .. 9; subtype refresh_count is Natural range 1 .. 4; subtype www_count is Natural range 1 .. 3; subtype alert_count is Natural range 1 .. 200; instructions : dim_instruction := (others => port_match_failed); builder_states : dim_builder_state := (others => idle); cntcycle : cycle_count := cycle_count'First; cntrefresh : refresh_count := refresh_count'First; cntalert : alert_count := alert_count'First; cntwww : www_count := www_count'First; run_complete : Boolean := False; available : Positive := Integer (num_builders); target : port_id; all_idle : Boolean; cntskip : Natural; sumdata : DPY.summary_rec; task type build (builder : builders); task body build is type Rand_Draw is range 1 .. 20; package Rand20 is new Ada.Numerics.Discrete_Random (Rand_Draw); seed : Rand20.Generator; build_result : Boolean; opts : REP.slave_options; begin if builder <= num_builders then if not curses_support then TIO.Put_Line (CYC.elapsed_now & " => [" & JT.zeropad (Integer (builder), 2) & "] Builder launched"); end if; loop exit when builder_states (builder) = shutdown; if builder_states (builder) = tasked then builder_states (builder) := busy; opts.need_procfs := all_ports (instructions (builder)).use_procfs; opts.need_linprocfs := all_ports (instructions (builder)).use_linprocfs; REP.launch_slave (id => builder, opts => opts); case software_framework is when ports_collection => build_result := FPC.build_package (builder, instructions (builder)); when pkgsrc => if not REP.Platform.standalone_pkg8_install (builder) then build_result := False; else build_result := NPS.build_package (builder, instructions (builder)); end if; end case; REP.destroy_slave (id => builder, opts => opts); if build_result then builder_states (builder) := done_success; else builder_states (builder) := done_failure; end if; else -- idle or done-(failure|success), just wait a bit delay 0.1; end if; end loop; if not curses_support then TIO.Put_Line (CYC.elapsed_now & " => [" & JT.zeropad (Integer (builder), 2) & "] Shutting down"); end if; end if; end build; builder_01 : build (builder => 1); builder_02 : build (builder => 2); builder_03 : build (builder => 3); builder_04 : build (builder => 4); builder_05 : build (builder => 5); builder_06 : build (builder => 6); builder_07 : build (builder => 7); builder_08 : build (builder => 8); builder_09 : build (builder => 9); builder_10 : build (builder => 10); builder_11 : build (builder => 11); builder_12 : build (builder => 12); builder_13 : build (builder => 13); builder_14 : build (builder => 14); builder_15 : build (builder => 15); builder_16 : build (builder => 16); builder_17 : build (builder => 17); builder_18 : build (builder => 18); builder_19 : build (builder => 19); builder_20 : build (builder => 20); builder_21 : build (builder => 21); builder_22 : build (builder => 22); builder_23 : build (builder => 23); builder_24 : build (builder => 24); builder_25 : build (builder => 25); builder_26 : build (builder => 26); builder_27 : build (builder => 27); builder_28 : build (builder => 28); builder_29 : build (builder => 29); builder_30 : build (builder => 30); builder_31 : build (builder => 31); builder_32 : build (builder => 32); builder_33 : build (builder => 33); builder_34 : build (builder => 34); builder_35 : build (builder => 35); builder_36 : build (builder => 36); builder_37 : build (builder => 37); builder_38 : build (builder => 38); builder_39 : build (builder => 39); builder_40 : build (builder => 40); builder_41 : build (builder => 41); builder_42 : build (builder => 42); builder_43 : build (builder => 43); builder_44 : build (builder => 44); builder_45 : build (builder => 45); builder_46 : build (builder => 46); builder_47 : build (builder => 47); builder_48 : build (builder => 48); builder_49 : build (builder => 49); builder_50 : build (builder => 50); builder_51 : build (builder => 51); builder_52 : build (builder => 52); builder_53 : build (builder => 53); builder_54 : build (builder => 54); builder_55 : build (builder => 55); builder_56 : build (builder => 56); builder_57 : build (builder => 57); builder_58 : build (builder => 58); builder_59 : build (builder => 59); builder_60 : build (builder => 60); builder_61 : build (builder => 61); builder_62 : build (builder => 62); builder_63 : build (builder => 63); builder_64 : build (builder => 64); -- Expansion of cpu_range from 32 to 64 means 128 possible builders builder_65 : build (builder => 65); builder_66 : build (builder => 66); builder_67 : build (builder => 67); builder_68 : build (builder => 68); builder_69 : build (builder => 69); builder_70 : build (builder => 70); builder_71 : build (builder => 71); builder_72 : build (builder => 72); builder_73 : build (builder => 73); builder_74 : build (builder => 74); builder_75 : build (builder => 75); builder_76 : build (builder => 76); builder_77 : build (builder => 77); builder_78 : build (builder => 78); builder_79 : build (builder => 79); builder_80 : build (builder => 80); builder_81 : build (builder => 81); builder_82 : build (builder => 82); builder_83 : build (builder => 83); builder_84 : build (builder => 84); builder_85 : build (builder => 85); builder_86 : build (builder => 86); builder_87 : build (builder => 87); builder_88 : build (builder => 88); builder_89 : build (builder => 89); builder_90 : build (builder => 90); builder_91 : build (builder => 91); builder_92 : build (builder => 92); builder_93 : build (builder => 93); builder_94 : build (builder => 94); builder_95 : build (builder => 95); builder_96 : build (builder => 96); builder_97 : build (builder => 97); builder_98 : build (builder => 98); builder_99 : build (builder => 99); builder_100 : build (builder => 100); builder_101 : build (builder => 101); builder_102 : build (builder => 102); builder_103 : build (builder => 103); builder_104 : build (builder => 104); builder_105 : build (builder => 105); builder_106 : build (builder => 106); builder_107 : build (builder => 107); builder_108 : build (builder => 108); builder_109 : build (builder => 109); builder_110 : build (builder => 110); builder_111 : build (builder => 111); builder_112 : build (builder => 112); builder_113 : build (builder => 113); builder_114 : build (builder => 114); builder_115 : build (builder => 115); builder_116 : build (builder => 116); builder_117 : build (builder => 117); builder_118 : build (builder => 118); builder_119 : build (builder => 119); builder_120 : build (builder => 120); builder_121 : build (builder => 121); builder_122 : build (builder => 122); builder_123 : build (builder => 123); builder_124 : build (builder => 124); builder_125 : build (builder => 125); builder_126 : build (builder => 126); builder_127 : build (builder => 127); builder_128 : build (builder => 128); begin loop all_idle := True; for slave in 1 .. num_builders loop declare begin case builder_states (slave) is when busy | tasked => all_idle := False; when shutdown => null; when idle => if run_complete then builder_states (slave) := shutdown; else target := top_buildable_port; if target = port_match_failed then if SIG.graceful_shutdown_requested or else nothing_left (num_builders) then run_complete := True; builder_states (slave) := shutdown; DPY.insert_history (assemble_HR (slave, 0, DPY.action_shutdown)); else if shutdown_recommended (available) then builder_states (slave) := shutdown; DPY.insert_history (assemble_HR (slave, 0, DPY.action_shutdown)); available := available - 1; end if; end if; else lock_package (target); instructions (slave) := target; builder_states (slave) := tasked; TIO.Put_Line (logs (total), CYC.elapsed_now & " [" & JT.zeropad (Integer (slave), 2) & "] => " & port_name (instructions (slave))); if not curses_support then TIO.Put_Line (CYC.elapsed_now & " => [" & JT.zeropad (Integer (slave), 2) & "] Kickoff " & port_name (instructions (slave))); end if; end if; end if; when done_success | done_failure => all_idle := False; if builder_states (slave) = done_success then if curses_support then DPY.insert_history (assemble_HR (slave, instructions (slave), DPY.action_success)); else TIO.Put_Line (CYC.elapsed_now & " => [" & JT.zeropad (Integer (slave), 2) & "] " & CYC.elapsed_build (slave) & " Success " & port_name (instructions (slave))); end if; record_history_built (elapsed => CYC.elapsed_now, slave_id => slave, origin => port_name (instructions (slave)), duration => CYC.elapsed_build (slave)); run_package_hook (pkg_success, instructions (slave)); cascade_successful_build (instructions (slave)); bld_counter (success) := bld_counter (success) + 1; TIO.Put_Line (logs (success), CYC.elapsed_now & " " & port_name (instructions (slave))); TIO.Put_Line (logs (total), CYC.elapsed_now & " " & port_name (instructions (slave)) & " success"); else TIO.Put_Line (logs (total), CYC.elapsed_now & " " & port_name (instructions (slave)) & " FAILED!"); cascade_failed_build (instructions (slave), cntskip, logs); bld_counter (skipped) := bld_counter (skipped) + cntskip; bld_counter (failure) := bld_counter (failure) + 1; TIO.Put_Line (logs (total), CYC.elapsed_now & " " & port_name (instructions (slave)) & " failure skips:" & JT.int2str (cntskip)); TIO.Put_Line (logs (failure), CYC.elapsed_now & " " & port_name (instructions (slave)) & " (skipped" & cntskip'Img & ")"); if curses_support then DPY.insert_history (assemble_HR (slave, instructions (slave), DPY.action_failure)); else TIO.Put_Line (CYC.elapsed_now & " => [" & JT.zeropad (Integer (slave), 2) & "] " & CYC.elapsed_build (slave) & " Failure " & port_name (instructions (slave))); end if; case software_framework is when ports_collection => record_history_failed (elapsed => CYC.elapsed_now, slave_id => slave, origin => port_name (instructions (slave)), duration => CYC.elapsed_build (slave), die_phase => FPC.last_build_phase (slave), skips => cntskip); when pkgsrc => record_history_failed (elapsed => CYC.elapsed_now, slave_id => slave, origin => port_name (instructions (slave)), duration => CYC.elapsed_build (slave), die_phase => NPS.last_build_phase (slave), skips => cntskip); end case; run_package_hook (pkg_failure, instructions (slave)); end if; instructions (slave) := port_match_failed; if run_complete then builder_states (slave) := shutdown; DPY.insert_history (assemble_HR (slave, 0, DPY.action_shutdown)); else builder_states (slave) := idle; end if; end case; exception when earthquake : others => TIO.Put_Line (logs (total), CYC.elapsed_now & " UNHANDLED EXCEPTION: " & EX.Exception_Information (earthquake)); end; end loop; exit when run_complete and all_idle; if cntcycle = cycle_count'Last then cntcycle := cycle_count'First; TIO.Flush (logs (success)); TIO.Flush (logs (failure)); TIO.Flush (logs (skipped)); TIO.Flush (logs (total)); if curses_support then if cntrefresh = refresh_count'Last then cntrefresh := refresh_count'First; DPY.set_full_redraw_next_update; else cntrefresh := cntrefresh + 1; end if; sumdata.Initially := bld_counter (total); sumdata.Built := bld_counter (success); sumdata.Failed := bld_counter (failure); sumdata.Ignored := bld_counter (ignored); sumdata.Skipped := bld_counter (skipped); sumdata.elapsed := CYC.elapsed_now; sumdata.swap := get_swap_status; sumdata.load := REP.Platform.get_instant_load; sumdata.pkg_hour := hourly_build_rate; sumdata.impulse := impulse_rate; DPY.summarize (sumdata); for b in builders'First .. num_builders loop case software_framework is when ports_collection => if builder_states (b) = shutdown then DPY.update_builder (FPC.builder_status (b, True, False)); elsif builder_states (b) = idle then DPY.update_builder (FPC.builder_status (b, False, True)); else CYC.set_log_lines (b); DPY.update_builder (FPC.builder_status (b)); end if; when pkgsrc => if builder_states (b) = shutdown then DPY.update_builder (NPS.builder_status (b, True, False)); elsif builder_states (b) = idle then DPY.update_builder (NPS.builder_status (b, False, True)); else CYC.set_log_lines (b); DPY.update_builder (NPS.builder_status (b)); end if; end case; end loop; DPY.refresh_builder_window; DPY.refresh_history_window; else -- text mode support, periodic status reports if cntalert = alert_count'Last then cntalert := alert_count'First; declare Remaining : constant Integer := bld_counter (total) - bld_counter (success) - bld_counter (failure) - bld_counter (ignored) - bld_counter (skipped); begin TIO.Put_Line (CYC.elapsed_now & " => " & " Left:" & Remaining'Img & " Succ:" & bld_counter (success)'Img & " Fail:" & bld_counter (failure)'Img & " Skip:" & bld_counter (skipped)'Img & " Ign:" & bld_counter (ignored)'Img); end; else cntalert := cntalert + 1; end if; -- Update log lines every 4 seconds for the watchdog if cntrefresh = refresh_count'Last then cntrefresh := refresh_count'First; for b in builders'First .. num_builders loop if builder_states (b) /= shutdown and then builder_states (b) /= idle then CYC.set_log_lines (b); end if; end loop; else cntrefresh := cntrefresh + 1; end if; end if; -- Generate latest history file every 3 seconds. -- With a poll period of 6 seconds, we need twice that frequency to avoid aliasing -- Note that in text mode, the logs are updated every 4 seconds, so in this mode -- the log lines will often be identical for a cycle. if cntwww = www_count'Last then cntwww := www_count'First; write_history_json; write_summary_json (active => True, states => builder_states, num_builders => num_builders, num_history_files => history.segment); else cntwww := cntwww + 1; end if; else cntcycle := cntcycle + 1; end if; delay 0.10; end loop; if PM.configuration.avec_ncurses and then curses_support then DPY.terminate_monitor; end if; write_history_json; write_summary_json (active => False, states => builder_states, num_builders => num_builders, num_history_files => history.segment); run_hook (run_end, "PORTS_BUILT=" & JT.int2str (bld_counter (success)) & " PORTS_FAILED=" & JT.int2str (bld_counter (failure)) & " PORTS_IGNORED=" & JT.int2str (bld_counter (ignored)) & " PORTS_SKIPPED=" & JT.int2str (bld_counter (skipped))); end parallel_bulk_run; -------------------- -- lock_package -- -------------------- procedure lock_package (id : port_id) is begin if id /= port_match_failed then all_ports (id).work_locked := True; end if; end lock_package; ---------------------------- -- cascade_failed_build -- ---------------------------- procedure cascade_failed_build (id : port_id; numskipped : out Natural; logs : dim_handlers) is purged : PortScan.port_id; culprit : constant String := port_name (id); begin numskipped := 0; loop purged := skip_next_reverse_dependency (id); exit when purged = port_match_failed; if skip_verified (purged) then numskipped := numskipped + 1; TIO.Put_Line (logs (total), " Skipped: " & port_name (purged)); TIO.Put_Line (logs (skipped), port_name (purged) & " by " & culprit); DPY.insert_history (assemble_HR (1, purged, DPY.action_skipped)); record_history_skipped (elapsed => CYC.elapsed_now, origin => port_name (purged), reason => culprit); run_package_hook (pkg_skipped, purged); end if; end loop; unlist_port (id); end cascade_failed_build; -------------------------------- -- cascade_successful_build -- -------------------------------- procedure cascade_successful_build (id : port_id) is procedure cycle (cursor : block_crate.Cursor); procedure cycle (cursor : block_crate.Cursor) is target : constant port_index := block_crate.Element (cursor); begin if all_ports (target).blocked_by.Contains (Key => id) then all_ports (target).blocked_by.Delete (Key => id); else raise seek_failure with port_name (target) & " was expected to be blocked by " & port_name (id); end if; end cycle; begin all_ports (id).blocks.Iterate (cycle'Access); delete_rank (id); end cascade_successful_build; -------------------------- -- top_buildable_port -- -------------------------- function top_buildable_port return port_id is list_len : constant Integer := Integer (rank_queue.Length); cursor : ranking_crate.Cursor; QR : queue_record; result : port_id := port_match_failed; begin if list_len = 0 then return result; end if; cursor := rank_queue.First; for k in 1 .. list_len loop QR := ranking_crate.Element (Position => cursor); if not all_ports (QR.ap_index).work_locked and then all_ports (QR.ap_index).blocked_by.Is_Empty then result := QR.ap_index; exit; end if; cursor := ranking_crate.Next (Position => cursor); end loop; if SIG.graceful_shutdown_requested then return port_match_failed; end if; return result; end top_buildable_port; ---------------------------- -- shutdown_recommended -- ---------------------------- function shutdown_recommended (active_builders : Positive) return Boolean is list_len : constant Natural := Integer (rank_queue.Length); list_max : constant Positive := 2 * active_builders; num_wait : Natural := 0; cursor : ranking_crate.Cursor; QR : queue_record; begin if list_len = 0 or else list_len >= list_max then return False; end if; cursor := rank_queue.First; for k in 1 .. list_len loop QR := ranking_crate.Element (Position => cursor); if not all_ports (QR.ap_index).work_locked then num_wait := num_wait + 1; if num_wait >= active_builders then return False; end if; end if; cursor := ranking_crate.Next (Position => cursor); end loop; return True; end shutdown_recommended; -------------------- -- nothing_left -- -------------------- function nothing_left (num_builders : builders) return Boolean is list_len : constant Integer := Integer (rank_queue.Length); begin return list_len = 0; end nothing_left; ------------------ -- rank_arrow -- ------------------ function rank_arrow (id : port_id) return ranking_crate.Cursor is rscore : constant port_index := all_ports (id).reverse_score; seek_target : constant queue_record := (ap_index => id, reverse_score => rscore); begin return rank_queue.Find (seek_target); end rank_arrow; ------------------- -- delete_rank -- ------------------- procedure delete_rank (id : port_id) is rank_cursor : ranking_crate.Cursor := rank_arrow (id); use type ranking_crate.Cursor; begin if rank_cursor /= ranking_crate.No_Element then rank_queue.Delete (Position => rank_cursor); end if; end delete_rank; -------------------- -- still_ranked -- -------------------- function still_ranked (id : port_id) return Boolean is rank_cursor : ranking_crate.Cursor := rank_arrow (id); use type ranking_crate.Cursor; begin return rank_cursor /= ranking_crate.No_Element; end still_ranked; ------------------------ -- integrity_intact -- ------------------------ function integrity_intact return Boolean is procedure check_dep (cursor : block_crate.Cursor); procedure check_rank (cursor : ranking_crate.Cursor); intact : Boolean := True; procedure check_dep (cursor : block_crate.Cursor) is did : constant port_index := block_crate.Element (cursor); begin if not still_ranked (did) then intact := False; end if; end check_dep; procedure check_rank (cursor : ranking_crate.Cursor) is QR : constant queue_record := ranking_crate.Element (cursor); begin if intact then all_ports (QR.ap_index).blocked_by.Iterate (check_dep'Access); end if; end check_rank; begin rank_queue.Iterate (check_rank'Access); return intact; end integrity_intact; --------------------- -- skip_verified -- --------------------- function skip_verified (id : port_id) return Boolean is begin if id = port_match_failed then return False; end if; return not all_ports (id).unlist_failed; end skip_verified; -------------------- -- queue_length -- -------------------- function queue_length return Integer is begin return Integer (rank_queue.Length); end queue_length; ------------------- -- unlist_port -- ------------------- procedure unlist_port (id : port_id) is begin if id = port_match_failed then return; end if; if still_ranked (id) then delete_rank (id); else -- don't raise exception. Since we don't prune all_reverse as -- we go, there's no guarantee the reverse dependency hasn't already -- been removed (e.g. when it is a common reverse dep) all_ports (id).unlist_failed := True; end if; end unlist_port; ------------------------------------ -- skip_next_reverse_dependency -- ------------------------------------ function skip_next_reverse_dependency (pinnacle : port_id) return port_id is rev_cursor : block_crate.Cursor; next_dep : port_index; begin if all_ports (pinnacle).all_reverse.Is_Empty then return port_match_failed; end if; rev_cursor := all_ports (pinnacle).all_reverse.First; next_dep := block_crate.Element (rev_cursor); unlist_port (id => next_dep); all_ports (pinnacle).all_reverse.Delete (rev_cursor); return next_dep; end skip_next_reverse_dependency; --------------------- -- ignore_reason -- --------------------- function ignore_reason (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "Invalid port ID"; end if; return JT.USS (all_ports (id).ignore_reason); end ignore_reason; ------------------------- -- next_ignored_port -- ------------------------- function next_ignored_port return port_id is list_len : constant Integer := Integer (rank_queue.Length); cursor : ranking_crate.Cursor; QR : queue_record; result : port_id := port_match_failed; begin if list_len = 0 then return result; end if; cursor := rank_queue.First; for k in 1 .. list_len loop QR := ranking_crate.Element (Position => cursor); if all_ports (QR.ap_index).ignored then result := QR.ap_index; DPY.insert_history (assemble_HR (1, QR.ap_index, DPY.action_ignored)); run_package_hook (pkg_ignored, QR.ap_index); exit; end if; cursor := ranking_crate.Next (Position => cursor); end loop; return result; end next_ignored_port; ----------------- -- port_name -- ----------------- function port_name (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "Invalid port ID"; end if; return get_catport (all_ports (id)); end port_name; ----------------------- -- get_swap_status -- ----------------------- function get_swap_status return Float is type memtype is mod 2**64; command : String := REP.Platform.swapinfo_command; status : Integer; comres : JT.Text; blocks_total : memtype := 0; blocks_used : memtype := 0; begin comres := Unix.piped_command (command, status); if status /= 0 then return 200.0; -- [ERROR] Signal to set swap display to "N/A" end if; -- Throw first line away, e.g "Device 1K-blocks Used Avail ..." -- Distinguishes platforms though: -- Net/Free/Dragon start with "Device" -- Linux starts with "NAME" -- Solaris starts with "swapfile" -- On FreeBSD (DragonFly too?), when multiple swap used, ignore line starting "Total" declare command_result : String := JT.USS (comres); markers : JT.Line_Markers; line_present : Boolean; begin JT.initialize_markers (command_result, markers); -- Throw first line away (valid for all platforms line_present := JT.next_line_present (command_result, markers); if line_present then declare line : String := JT.extract_line (command_result, markers); begin null; end; else return 200.0; -- [ERROR] Signal to set swap display to "N/A" end if; loop exit when not JT.next_line_present (command_result, markers); declare line : constant String := JT.strip_excessive_spaces (JT.extract_line (command_result, markers)); begin if JT.specific_field (line, 1) /= "Total" then blocks_total := blocks_total + memtype'Value (JT.specific_field (line, 2)); blocks_used := blocks_used + memtype'Value (JT.specific_field (line, 3)); end if; exception when Constraint_Error => return 200.0; -- [ERROR] Signal to set swap display to "N/A" end; end loop; end; if blocks_total = 0 then return 200.0; -- Signal to set swap display to "N/A" else return 100.0 * Float (blocks_used) / Float (blocks_total); end if; end get_swap_status; ------------------------- -- hourly_build_rate -- ------------------------- function hourly_build_rate return Natural is pkg_that_count : constant Natural := bld_counter (success) + bld_counter (failure); begin return CYC.get_packages_per_hour (pkg_that_count, start_time); end hourly_build_rate; -------------------- -- impulse_rate -- -------------------- function impulse_rate return Natural is pkg_that_count : constant Natural := bld_counter (success) + bld_counter (failure); pkg_diff : Natural; result : Natural; begin if impulse_counter = impulse_range'Last then impulse_counter := impulse_range'First; else impulse_counter := impulse_counter + 1; end if; if impulse_data (impulse_counter).virgin then impulse_data (impulse_counter).hack := CAL.Clock; impulse_data (impulse_counter).packages := pkg_that_count; impulse_data (impulse_counter).virgin := False; return CYC.get_packages_per_hour (pkg_that_count, start_time); end if; pkg_diff := pkg_that_count - impulse_data (impulse_counter).packages; result := CYC.get_packages_per_hour (packages_done => pkg_diff, from_when => impulse_data (impulse_counter).hack); impulse_data (impulse_counter).hack := CAL.Clock; impulse_data (impulse_counter).packages := pkg_that_count; return result; exception when others => return 0; end impulse_rate; ------------------- -- assemble_HR -- ------------------- function assemble_HR (slave : builders; pid : port_id; action : DPY.history_action) return DPY.history_rec is HR : DPY.history_rec; HOLast : constant Natural := DPY.history_origin'Last; catport : String := port_name (pid); hyphens : constant DPY.history_elapsed := "--:--:--"; begin HR.id := slave; HR.slavid := JT.zeropad (Integer (slave), 2); HR.established := True; HR.action := action; HR.origin := (others => ' '); HR.run_elapsed := CYC.elapsed_now; if action = DPY.action_shutdown then HR.pkg_elapsed := hyphens; else if action = DPY.action_skipped or else action = DPY.action_ignored then HR.pkg_elapsed := hyphens; else HR.pkg_elapsed := CYC.elapsed_build (slave); end if; if catport'Last > HOLast then HR.origin (1 .. HOLast - 1) := catport (1 .. HOLast - 1); HR.origin (HOLast) := LAT.Asterisk; else HR.origin (1 .. catport'Last) := catport; end if; end if; return HR; end assemble_HR; ------------------------ -- initialize_hooks -- ------------------------ procedure initialize_hooks is begin for hook in hook_type'Range loop declare script : constant String := JT.USS (hook_location (hook)); begin active_hook (hook) := AD.Exists (script) and then REP.Platform.file_is_executable (script); end; end loop; end initialize_hooks; ---------------------- -- run_start_hook -- ---------------------- procedure run_start_hook is begin run_hook (run_start, "PORTS_QUEUED=" & JT.int2str (queue_length) & " "); end run_start_hook; ---------------- -- run_hook -- ---------------- procedure run_hook (hook : hook_type; envvar_list : String) is function nvpair (name : String; value : JT.Text) return String; function nvpair (name : String; value : JT.Text) return String is begin return name & LAT.Equals_Sign & LAT.Quotation & JT.USS (value) & LAT.Quotation & LAT.Space; end nvpair; common_env : constant String := nvpair ("PROFILE", PM.configuration.profile) & nvpair ("DIR_PACKAGES", PM.configuration.dir_packages) & nvpair ("DIR_REPOSITORY", PM.configuration.dir_repository) & nvpair ("DIR_PORTS", PM.configuration.dir_portsdir) & nvpair ("DIR_OPTIONS", PM.configuration.dir_options) & nvpair ("DIR_DISTFILES", PM.configuration.dir_distfiles) & nvpair ("DIR_LOGS", PM.configuration.dir_logs) & nvpair ("DIR_BUILDBASE", PM.configuration.dir_buildbase); -- The follow command works on every platform command : constant String := "/usr/bin/env -i " & common_env & envvar_list & " " & JT.USS (hook_location (hook)); begin if not active_hook (hook) then return; end if; if Unix.external_command (command) then null; end if; end run_hook; ------------------------ -- run_package_hook -- ------------------------ procedure run_package_hook (hook : hook_type; id : port_id) is pn : constant String := port_name (id); tail : String := " ORIGIN=" & JT.part_1 (pn, "@") & " FLAVOR=" & JT.part_2 (pn, "@") & " PKGNAME=" & package_name (id) & " "; begin case hook is when pkg_success => run_hook (hook, "RESULT=success" & tail); when pkg_failure => run_hook (hook, "RESULT=failure" & tail); when pkg_ignored => run_hook (hook, "RESULT=ignored" & tail); when pkg_skipped => run_hook (hook, "RESULT=skipped" & tail); when others => null; end case; end run_package_hook; ---------------------------- -- run_hook_after_build -- ---------------------------- procedure run_hook_after_build (built : Boolean; id : port_id) is begin if built then run_package_hook (pkg_success, id); else run_package_hook (pkg_failure, id); end if; end run_hook_after_build; -------------------- -- package_name -- -------------------- function package_name (id : port_id) return String is begin if id = port_match_failed or else id > last_port then return "Invalid port ID"; end if; declare fullname : constant String := JT.USS (all_ports (id).package_name); begin return fullname (1 .. fullname'Length - 4); end; end package_name; ----------------------------- -- initialize_web_report -- ----------------------------- procedure initialize_web_report (num_builders : builders) is idle_slaves : constant dim_builder_state := (others => idle); reportdir : constant String := JT.USS (PM.configuration.dir_logs) & "/Report"; sharedir : constant String := host_localbase & "/share/synth"; begin AD.Create_Path (reportdir); AD.Copy_File (sharedir & "/synth.png", reportdir & "/synth.png"); AD.Copy_File (sharedir & "/favicon.png", reportdir & "/favicon.png"); AD.Copy_File (sharedir & "/progress.js", reportdir & "/progress.js"); AD.Copy_File (sharedir & "/progress.css", reportdir & "/progress.css"); AD.Copy_File (sharedir & "/progress.html", reportdir & "/index.html"); write_summary_json (active => True, states => idle_slaves, num_builders => num_builders, num_history_files => 0); end initialize_web_report; ----------------------------------------- -- delete_existing_web_history_files -- ----------------------------------------- procedure delete_existing_web_history_files is search : AD.Search_Type; dirent : AD.Directory_Entry_Type; pattern : constant String := "*_history.json"; filter : constant AD.Filter_Type := (AD.Ordinary_File => True, others => False); reportdir : constant String := JT.USS (PM.configuration.dir_logs) & "/Report"; begin if not AD.Exists (reportdir) then return; end if; AD.Start_Search (Search => search, Directory => reportdir, Pattern => pattern, Filter => filter); while AD.More_Entries (search) loop AD.Get_Next_Entry (search, dirent); AD.Delete_File (reportdir & "/" & AD.Simple_Name (dirent)); end loop; exception when AD.Name_Error => null; end delete_existing_web_history_files; ----------------------- -- nv (2 versions) -- ----------------------- function nv (name, value : String) return String is begin return ASCII.Quotation & name & ASCII.Quotation & ASCII.Colon & ASCII.Quotation & value & ASCII.Quotation; end nv; function nv (name : String; value : Integer) return String is begin return ASCII.Quotation & name & ASCII.Quotation & ASCII.Colon & JT.int2str (value); end nv; -------------------------- -- write_summary_json -- -------------------------- procedure write_summary_json (active : Boolean; states : dim_builder_state; num_builders : builders; num_history_files : Natural) is function TF (value : Boolean) return Natural; function TF (value : Boolean) return Natural is begin if value then return 1; else return 0; end if; end TF; jsonfile : TIO.File_Type; filename : constant String := JT.USS (PM.configuration.dir_logs) & "/Report/summary.json"; leftover : constant Integer := bld_counter (total) - bld_counter (success) - bld_counter (failure) - bld_counter (ignored) - bld_counter (skipped); slave : DPY.builder_rec; begin -- Try to defend malicious symlink: https://en.wikipedia.org/wiki/Symlink_race if AD.Exists (filename) then AD.Delete_File (filename); end if; TIO.Create (File => jsonfile, Mode => TIO.Out_File, Name => filename); TIO.Put (jsonfile, "{" & ASCII.LF & " " & nv ("profile", JT.USS (PM.configuration.profile)) & ASCII.LF); TIO.Put (jsonfile, " ," & nv ("kickoff", timestamp (start_time, True)) & ASCII.LF & " ," & nv ("kfiles", num_history_files) & ASCII.LF & " ," & nv ("active", TF (active)) & ASCII.LF & " ," & ASCII.Quotation & "stats" & ASCII.Quotation & ASCII.Colon & "{" & ASCII.LF); TIO.Put (jsonfile, " " & nv ("queued", bld_counter (total)) & ASCII.LF & " ," & nv ("built", bld_counter (success)) & ASCII.LF & " ," & nv ("failed", bld_counter (failure)) & ASCII.LF & " ," & nv ("ignored", bld_counter (ignored)) & ASCII.LF & " ," & nv ("skipped", bld_counter (skipped)) & ASCII.LF & " ," & nv ("remains", leftover) & ASCII.LF & " ," & nv ("elapsed", CYC.elapsed_now) & ASCII.LF & " ," & nv ("pkghour", hourly_build_rate) & ASCII.LF & " ," & nv ("impulse", impulse_rate) & ASCII.LF & " ," & nv ("swapinfo", DPY.fmtpc (get_swap_status, True)) & ASCII.LF & " ," & nv ("load", DPY.fmtload (REP.Platform.get_instant_load)) & ASCII.LF & " }" & ASCII.LF & " ," & ASCII.Quotation & "builders" & ASCII.Quotation & ASCII.Colon & "[" & ASCII.LF); for b in builders'First .. num_builders loop case software_framework is when ports_collection => if states (b) = shutdown then slave := FPC.builder_status (b, True, False); elsif states (b) = idle then slave := FPC.builder_status (b, False, True); else slave := FPC.builder_status (b); end if; when pkgsrc => if states (b) = shutdown then slave := NPS.builder_status (b, True, False); elsif states (b) = idle then slave := NPS.builder_status (b, False, True); else slave := NPS.builder_status (b); end if; end case; if b = builders'First then TIO.Put (jsonfile, " {" & ASCII.LF); else TIO.Put (jsonfile, " ,{" & ASCII.LF); end if; TIO.Put (jsonfile, " " & nv ("ID", slave.slavid) & ASCII.LF & " ," & nv ("elapsed", JT.trim (slave.Elapsed)) & ASCII.LF & " ," & nv ("phase", JT.trim (slave.phase)) & ASCII.LF & " ," & nv ("origin", JT.trim (slave.origin)) & ASCII.LF & " ," & nv ("lines", JT.trim (slave.LLines)) & ASCII.LF & " }" & ASCII.LF); end loop; TIO.Put (jsonfile, " ]" & ASCII.LF & "}" & ASCII.LF); TIO.Close (jsonfile); exception when others => if TIO.Is_Open (jsonfile) then TIO.Close (jsonfile); end if; end write_summary_json; ---------------------------- -- write_history_json -- ---------------------------- procedure write_history_json is jsonfile : TIO.File_Type; filename : constant String := JT.USS (PM.configuration.dir_logs) & "/Report/" & JT.zeropad (history.segment, 2) & "_history.json"; begin if history.segment_count = 0 then return; end if; if history.last_written = history.last_index then return; end if; TIO.Create (File => jsonfile, Mode => TIO.Out_File, Name => filename); TIO.Put (jsonfile, history.content (1 .. history.last_index)); TIO.Put (jsonfile, "]"); TIO.Close (jsonfile); history.last_written := history.last_index; exception when others => if TIO.Is_Open (jsonfile) then TIO.Close (jsonfile); end if; end write_history_json; ---------------------------- -- assimulate_substring -- ---------------------------- procedure assimulate_substring (history : in out progress_history; substring : String) is first : constant Positive := history.last_index + 1; last : constant Positive := history.last_index + substring'Length; begin -- silently fail (this shouldn't be practically possible) if last < kfile_content'Last then history.content (first .. last) := substring; end if; history.last_index := last; end assimulate_substring; ---------------------------- -- record_history_built -- ---------------------------- procedure handle_first_history_entry is begin if history.segment_count = 1 then assimulate_substring (history, "[" & ASCII.LF & " {" & ASCII.LF); else assimulate_substring (history, " ,{" & ASCII.LF); end if; end handle_first_history_entry; ---------------------------- -- record_history_built -- ---------------------------- procedure record_history_built (elapsed : String; slave_id : builders; origin : String; duration : String) is ID : constant String := JT.zeropad (Integer (slave_id), 2); begin history.log_entry := history.log_entry + 1; history.segment_count := history.segment_count + 1; handle_first_history_entry; assimulate_substring (history, " " & nv ("entry", history.log_entry) & ASCII.LF); assimulate_substring (history, " ," & nv ("elapsed", elapsed) & ASCII.LF); assimulate_substring (history, " ," & nv ("ID", ID) & ASCII.LF); assimulate_substring (history, " ," & nv ("result", "built") & ASCII.LF); assimulate_substring (history, " ," & nv ("origin", origin) & ASCII.LF); assimulate_substring (history, " ," & nv ("info", "") & ASCII.LF); assimulate_substring (history, " ," & nv ("duration", duration) & ASCII.LF); assimulate_substring (history, " }" & ASCII.LF); check_history_segment_capacity; end record_history_built; ----------------------------- -- record_history_failed -- ----------------------------- procedure record_history_failed (elapsed : String; slave_id : builders; origin : String; duration : String; die_phase : String; skips : Natural) is info : constant String := die_phase & ":" & JT.int2str (skips); ID : constant String := JT.zeropad (Integer (slave_id), 2); begin history.log_entry := history.log_entry + 1; history.segment_count := history.segment_count + 1; handle_first_history_entry; assimulate_substring (history, " " & nv ("entry", history.log_entry) & ASCII.LF); assimulate_substring (history, " ," & nv ("elapsed", elapsed) & ASCII.LF); assimulate_substring (history, " ," & nv ("ID", ID) & ASCII.LF); assimulate_substring (history, " ," & nv ("result", "failed") & ASCII.LF); assimulate_substring (history, " ," & nv ("origin", origin) & ASCII.LF); assimulate_substring (history, " ," & nv ("info", info) & ASCII.LF); assimulate_substring (history, " ," & nv ("duration", duration) & ASCII.LF); assimulate_substring (history, " }" & ASCII.LF); check_history_segment_capacity; end record_history_failed; ------------------------------ -- record_history_ignored -- ------------------------------ procedure record_history_ignored (elapsed : String; origin : String; reason : String; skips : Natural) is cleantxt : constant String := JT.strip_control (reason); info : constant String := JT.replace_char (JT.replace_char (cleantxt, ASCII.Quotation, "&nbsp;"), ASCII.Back_Slash, "&#92;") & ":|:" & JT.int2str (skips); begin history.log_entry := history.log_entry + 1; history.segment_count := history.segment_count + 1; handle_first_history_entry; assimulate_substring (history, " " & nv ("entry", history.log_entry) & ASCII.LF); assimulate_substring (history, " ," & nv ("elapsed", elapsed) & ASCII.LF); assimulate_substring (history, " ," & nv ("ID", "--") & ASCII.LF); assimulate_substring (history, " ," & nv ("result", "ignored") & ASCII.LF); assimulate_substring (history, " ," & nv ("origin", origin) & ASCII.LF); assimulate_substring (history, " ," & nv ("info", info) & ASCII.LF); assimulate_substring (history, " ," & nv ("duration", "--:--:--") & ASCII.LF); assimulate_substring (history, " }" & ASCII.LF); check_history_segment_capacity; end record_history_ignored; ------------------------------ -- record_history_skipped -- ------------------------------ procedure record_history_skipped (elapsed : String; origin : String; reason : String) is begin history.log_entry := history.log_entry + 1; history.segment_count := history.segment_count + 1; handle_first_history_entry; assimulate_substring (history, " " & nv ("entry", history.log_entry) & ASCII.LF); assimulate_substring (history, " ," & nv ("elapsed", elapsed) & ASCII.LF); assimulate_substring (history, " ," & nv ("ID", "--") & ASCII.LF); assimulate_substring (history, " ," & nv ("result", "skipped") & ASCII.LF); assimulate_substring (history, " ," & nv ("origin", origin) & ASCII.LF); assimulate_substring (history, " ," & nv ("info", reason) & ASCII.LF); assimulate_substring (history, " ," & nv ("duration", "--:--:--") & ASCII.LF); assimulate_substring (history, " }" & ASCII.LF); check_history_segment_capacity; end record_history_skipped; -------------------------------------- -- check_history_segment_capacity -- -------------------------------------- procedure check_history_segment_capacity is begin if history.segment_count = 1 then history.segment := history.segment + 1; return; end if; if history.segment_count < kfile_units_limit then return; end if; write_history_json; history.last_index := 0; history.last_written := 0; history.segment_count := 0; end check_history_segment_capacity; end PortScan.Ops;
smsq/qpc/mouse.asm
olifink/smsqe
0
27418
; QPC Mouse Routines v1.01  2006 <NAME> ; ; 2006-03-08 1.01 Does horizontal wheel scroll if CTRL is pressed (MK) section driver xdef mouse_init xref pt_button3 xref ioq_pbyt include 'dev8_smsq_qpc_keys' include 'dev8_keys_con' include 'dev8_keys_iod' include 'dev8_keys_sys' include 'dev8_keys_qdos_sms' include 'dev8_smsq_kbd_keys' include 'dev8_smsq_smsq_base_keys' include 'dev8_mac_assert' mouse_init moveq #sms.xtop,d0 trap #do.sms2 move.l sys_klnk(a6),a3 ; keyboard linkage move.l iod_plad(a3),kb_extlk(a3) ; save keyboard polling routine lea mse_poll,a5 move.l a5,iod_plad(a3) ; insert mouse before moveq #0,d0 rts ;--- mouse polling routine mse_poll move.l sys_clnk(a6),d0 ; pointer linkage beq mse_done move.l d0,a4 move.l qpc_mpos,d1 cmp.l qpc_mops,d1 beq.s mse_nopcmove move.l d1,d2 sub.w qpc_moyp,d2 bpl.s mse_yc neg.w d2 mse_yc move.w d2,d0 swap d2 sub.w qpc_moxp,d2 bpl.s mse_xc neg.w d2 mse_xc add.w d2,d0 move.l d1,pt_npos(a4) move.l d1,qpc_mops add.w pt_xicnt(a4),d0 ; total so far lsr.w #1,d0 ; reduced add.b pt_wake(a4),d0 ; wake up speed lsr.w #1,d0 addq.w #1,d0 ; make sure that there is a move move.w d0,pt_xicnt(a4) ; update count bra.s mse_buttons mse_nopcmove cmp.l pt_npos(a4),d1 beq.s mse_buttons move.l pt_npos(a4),d1 move.l d1,qpc_mpos move.l d1,qpc_mops dc.w qpc.smpos+1 ;;; bra.s mse_buttons ; Old mouse routine (QPC1 compatible). Currently not used ;;; move.w qpc_movx,d1 ; x increment ;;; sub.w d1,qpc_movx ;;; move.w qpc_movy,d2 ; y increment ;;; sub.w d2,qpc_movy ;;; move.w d1,d0 ; supposed count ;;; bpl.s mse_ycount ; ... its positive ;;; neg.w d0 ;;;mse_ycount ;;; move.w d2,d3 ; other supposed cont ;;; bge.s mse_addinc ; ... its positive ;;; neg.w d3 ;;;mse_addinc ;;; add.w d3,d0 ; total count ;;; beq.s mse_setinc ; ... none ;;; add.w pt_xicnt(a4),d0 ; total so far ;;; lsr.w #1,d0 ; reduced ;;; add.b pt_wake(a4),d0 ; wake up speed ;;; lsr.w #1,d0 ;;; addq.w #1,d0 ; make sure that there is a move ;;; move.w d0,d0 ; ... spare for patch ;;;mse_setinc ;;; move.w d0,pt_xicnt(a4) ; update count ;;; add.w d1,pt_xinc(a4) ;;; add.w d2,pt_yinc(a4) ; and distance moved mse_buttons moveq #7,d0 and.b qpc_mbut,d0 move.b mse_but(pc,d0.w),d3 ; set the button number bmi.l pt_button3 ; ... do centre button mse_button move.b d3,pt_bpoll(a4) ; this is new button ; beq.s mse_done ; ... none clr.b pt_lstuf(a4) ; it isn't a stuff move.w qpc_mwhl,d3 ; any wheel activity? beq.s mse_done ; nope move.w #$D9D1,d1 ; ALT+up/ALT+down btst #kb..ctrl,kb_stat(a3) ; CTRL pressed? beq.s mse_dowheel ; ...no btst #1,d0 ; ct move.w #$C9C1,d1 ; ALT+left/ALT+right mse_dowheel tst.w d3 bgt.s mse_wheelup ror.w #8,d1 ; other key neg.w d3 mse_wheelup subq.w #1,d3 clr.w qpc_mwhl movem.l a1-a3,-(sp) move.l sms.sysb,a3 move.l sys_clnk(a3),d0 beq.s mse_wheeldone move.l sys_ckyq(a3),a2 move.l d0,a3 mse_wheelloop jsr ioq_pbyt dbf d3,mse_wheelloop mse_wheeldone movem.l (sp)+,a1-a3 mse_done move.l kb_extlk(a3),a4 jmp (a4) ; continue keyboard polling routine mse_but dc.b 0,1,2,-1,-1,-1,-1,-1 ; button decode end
oeis/042/A042387.asm
neoneye/loda-programs
11
28471
; A042387: Denominators of continued fraction convergents to sqrt(720). ; Submitted by <NAME> ; 1,1,5,6,317,323,1609,1932,102073,104005,518093,622098,32867189,33489287,166824337,200313624,10583132785,10783446409,53716918421,64500364830,3407735889581,3472236254411,17296680907225,20768917161636,1097280373312297,1118049290473933,5569477535208029,6687526825681962,353320872470670053,360008399296352015,1793354469656078113,2153362868952430128,113768223655182444769,115921586524134874897,577454569751721944357,693376156275856819254,36633014696096276545565,37326390852372133364819 seq $0,41333 ; Denominators of continued fraction convergents to sqrt(180). dif $0,2
bb-runtimes/runtimes/zfp-stm32g474/gnat/s-maccod.ads
JCGobbi/Nucleo-STM32G474RE
0
28772
<filename>bb-runtimes/runtimes/zfp-stm32g474/gnat/s-maccod.ads ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . M A C H I N E _ C O D E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides machine code support, both for intrinsic machine -- operations, and also for machine code statements. See GNAT documentation -- for full details. package System.Machine_Code is pragma No_Elaboration_Code_All; pragma Pure; -- All identifiers in this unit are implementation defined pragma Implementation_Defined; type Asm_Input_Operand is private; type Asm_Output_Operand is private; -- These types are never used directly, they are declared only so that -- the calls to Asm are type correct according to Ada semantic rules. No_Input_Operands : constant Asm_Input_Operand; No_Output_Operands : constant Asm_Output_Operand; type Asm_Input_Operand_List is array (Integer range <>) of Asm_Input_Operand; type Asm_Output_Operand_List is array (Integer range <>) of Asm_Output_Operand; type Asm_Insn is private; -- This type is not used directly. It is declared only so that the -- aggregates used in code statements are type correct by Ada rules. procedure Asm ( Template : String; Outputs : Asm_Output_Operand_List; Inputs : Asm_Input_Operand_List; Clobber : String := ""; Volatile : Boolean := False); procedure Asm ( Template : String; Outputs : Asm_Output_Operand := No_Output_Operands; Inputs : Asm_Input_Operand_List; Clobber : String := ""; Volatile : Boolean := False); procedure Asm ( Template : String; Outputs : Asm_Output_Operand_List; Inputs : Asm_Input_Operand := No_Input_Operands; Clobber : String := ""; Volatile : Boolean := False); procedure Asm ( Template : String; Outputs : Asm_Output_Operand := No_Output_Operands; Inputs : Asm_Input_Operand := No_Input_Operands; Clobber : String := ""; Volatile : Boolean := False); function Asm ( Template : String; Outputs : Asm_Output_Operand_List; Inputs : Asm_Input_Operand_List; Clobber : String := ""; Volatile : Boolean := False) return Asm_Insn; function Asm ( Template : String; Outputs : Asm_Output_Operand := No_Output_Operands; Inputs : Asm_Input_Operand_List; Clobber : String := ""; Volatile : Boolean := False) return Asm_Insn; function Asm ( Template : String; Outputs : Asm_Output_Operand_List; Inputs : Asm_Input_Operand := No_Input_Operands; Clobber : String := ""; Volatile : Boolean := False) return Asm_Insn; function Asm ( Template : String; Outputs : Asm_Output_Operand := No_Output_Operands; Inputs : Asm_Input_Operand := No_Input_Operands; Clobber : String := ""; Volatile : Boolean := False) return Asm_Insn; pragma Import (Intrinsic, Asm); private type Asm_Input_Operand is new Integer; type Asm_Output_Operand is new Integer; type Asm_Insn is new Integer; -- All three of these types are dummy types, to meet the requirements of -- type consistency. No values of these types are ever referenced. No_Input_Operands : constant Asm_Input_Operand := 0; No_Output_Operands : constant Asm_Output_Operand := 0; end System.Machine_Code;
tools/druss-commands-devices.adb
stcarrez/bbox-ada-api
2
30137
<gh_stars>1-10 ----------------------------------------------------------------------- -- druss-commands-devices -- Print information about the devices -- Copyright (C) 2017, 2018, 2019, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Properties; with Bbox.API; with Druss.Gateways; package body Druss.Commands.Devices is -- ------------------------------ -- Execute the wifi 'status' command to print the Wifi current status. -- ------------------------------ procedure Do_List (Command : in Command_Type; Args : in Argument_List'Class; Selector : in Device_Selector_Type; Context : in out Context_Type) is pragma Unreferenced (Command, Args); procedure Box_Status (Gateway : in out Druss.Gateways.Gateway_Type); Console : constant Druss.Commands.Consoles.Console_Access := Context.Console; procedure Box_Status (Gateway : in out Druss.Gateways.Gateway_Type) is procedure Print_Device (Manager : in Util.Properties.Manager; Name : in String); procedure Print_Device (Manager : in Util.Properties.Manager; Name : in String) is Link : constant String := Manager.Get (Name & ".link", ""); Kind : constant String := Manager.Get (Name & ".devicetype", ""); begin case Selector is when DEVICE_ALL => null; when DEVICE_ACTIVE => if Manager.Get (Name & ".active", "") = "0" then return; end if; when DEVICE_INACTIVE => if Manager.Get (Name & ".active", "") = "1" then return; end if; end case; Console.Start_Row; Console.Print_Field (F_BBOX_IP_ADDR, Gateway.Ip); Console.Print_Field (F_IP_ADDR, Manager.Get (Name & ".ipaddress", "")); Console.Print_Field (F_ETHERNET, Manager.Get (Name & ".macaddress", "")); Console.Print_Field (F_HOSTNAME, Manager.Get (Name & ".hostname", "")); -- Console.Print_Field (F_ACTIVE, Manager.Get (Name & ".active", "")); Console.Print_Field (F_DEVTYPE, (if Kind = "STB" then "STB" else "")); if Link = "Ethernet" then Console.Print_Field (F_LINK, Link & " port " & Manager.Get (Name & ".ethernet.logicalport", "")); else Console.Print_Field (F_LINK, Link & " RSSI " & Manager.Get (Name & ".wireless.rssi0", "")); end if; Console.End_Row; end Print_Device; begin Gateway.Refresh; Bbox.API.Iterate (Gateway.Hosts, "hosts.list", Print_Device'Access); end Box_Status; begin Console.Start_Title; Console.Print_Title (F_BBOX_IP_ADDR, "Bbox IP", 16); Console.Print_Title (F_IP_ADDR, "Device IP", 16); Console.Print_Title (F_ETHERNET, "Ethernet", 20); Console.Print_Title (F_HOSTNAME, "Hostname", 28); Console.Print_Title (F_DEVTYPE, "Type", 6); -- Console.Print_Title (F_ACTIVE, "Active", 8); Console.Print_Title (F_LINK, "Link", 18); Console.End_Title; Druss.Gateways.Iterate (Context.Gateways, Gateways.ITER_ENABLE, Box_Status'Access); end Do_List; -- ------------------------------ -- Execute a status command to report information about the Bbox. -- ------------------------------ overriding procedure Execute (Command : in out Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type) is pragma Unreferenced (Name); begin if Args.Get_Count > 1 then Context.Console.Notice (N_USAGE, "Too many arguments to the command"); Druss.Commands.Driver.Usage (Args, Context); elsif Args.Get_Count = 0 then Command.Do_List (Args, DEVICE_ACTIVE, Context); elsif Args.Get_Argument (1) = "all" then Command.Do_List (Args, DEVICE_ALL, Context); elsif Args.Get_Argument (1) = "active" then Command.Do_List (Args, DEVICE_ACTIVE, Context); elsif Args.Get_Argument (1) = "inactive" then Command.Do_List (Args, DEVICE_INACTIVE, Context); else Context.Console.Notice (N_USAGE, "Invalid argument: " & Args.Get_Argument (1)); Druss.Commands.Driver.Usage (Args, Context); end if; end Execute; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type) is pragma Unreferenced (Command); Console : constant Druss.Commands.Consoles.Console_Access := Context.Console; begin Console.Notice (N_HELP, "devices: Print information about the devices"); Console.Notice (N_HELP, "Usage: devices [all | active | inactive]"); Console.Notice (N_HELP, ""); Console.Notice (N_HELP, " List the devices that are known by the Bbox."); Console.Notice (N_HELP, ""); Console.Notice (N_HELP, " all List all the devices"); Console.Notice (N_HELP, " active List the active devices (the default)"); Console.Notice (N_HELP, " inative List the inactive devices"); end Help; end Druss.Commands.Devices;
alloy4fun_models/trashltl/models/11/j7Ywt3tqwHMTowXWt.als
Kaixi26/org.alloytools.alloy
0
17
<reponame>Kaixi26/org.alloytools.alloy open main pred idj7Ywt3tqwHMTowXWt_prop12 { some f: File | eventually f in Trash and after always f in Trash } pred __repair { idj7Ywt3tqwHMTowXWt_prop12 } check __repair { idj7Ywt3tqwHMTowXWt_prop12 <=> prop12o }
agc/agc.g4
augustand/grammars-v4
0
2639
/* BSD License Copyright (c) 2013, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Tom Everett 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. */ /* http://www.ibiblio.org/apollo/ */ /* thtp://www.ibiblio.org/apollo/hrst/archive/1689.pdf */ /* http://www.ibiblio.org/apollo/assembly_language_manual.html */ grammar agc; prog : line+ ; line : comment_line | blank_line | instruction_line | erase_line | assignment_line ; blank_line : label? eol ; comment_line : ws? comment eol ; // an instruction "line" can span many lines in the file, and can have comment lines in the middle of it instruction_line : label? ws opcodes (eol comment_line)? argument (eol argument)* eol ; // erase can be specified with no variable erase_line : variable? ws 'ERASE' (ws? expression)* (ws comment)? eol ; // assignment with no RHS is legal assignment_line : variable ws? ('=' | 'EQUALS') (ws? expression)* (ws comment)? eol ; opcodes : opcode (ws opcode)? ; argument : (ws expression)* (ws comment)? ; ws : WS ; eol : WS? EOL ; comment : COMMENT ; label : LABEL ; variable : LABEL | (LPAREN LABEL RPAREN) ; expression : multiplyingExpression ((PLUS|MINUS) multiplyingExpression)* ; multiplyingExpression : atom ((TIMES|DIV) atom)* ; atom : inte | decimal | variable | label | register ; inte : INTE ; decimal : ('+' | '-')? DECIMAL ; register :'A' | 'L' | 'Q' | 'EB' | 'FB' | 'Z' | 'BB' | 'ARUPT' | 'LRUPT' | 'QRUPT' | 'QRUPT' | 'BBRUPT' | 'BRUPT' | 'CYR' | 'SR' | 'CYL' | 'EDOP' | 'TIME2' | 'TIME1' | 'TIME3' | 'TIME4' | 'TIME5' | 'TIME6' | 'CDUX' | 'CDUY' | 'CDUZ' | 'OPTY' | 'OPTX' | 'PIPAX' | 'PIPAY' | 'PIPAZ' | 'Q-RHCCTR' | 'RHCP' | 'P-RHCCTR' | 'RHCY' | 'R-RHCCTR' | 'RHCR' | 'INLINK' | 'RNRAD' | 'GYROCTR' | 'GYROCMD' | 'CDUXCMD' | 'CDUYCMD' | 'CDUZCMD' | 'OPTYCMD' | 'OPTXCMD' | 'THRUST' | 'LEMONM' | 'OUTLINK' | 'ALTM' ; opcode : standard_opcode | pseudo_opcode | axt_opcode ; // Address to Index axt_opcode : 'AXT,1' | 'AXT,2' ; pseudo_opcode : '1DNADR' | '2DNADR' | '3DNADR' | '4DNADR' | '5DNADR' | '6DNADR' | 'DNCHAN' | 'DNPTR' | '-1DNADR' | '-2DNADR' | '-3DNADR' | '-4DNADR' | '-5DNADR' | '-6DNADR' | '-DNCHAN' | '-DNPTR' | '2DEC' | '2DEC*' | '2DNADR' | '-2DNADR' | '2FCADR' // embed a double-word constant | '3DNADR' | '-3DNADR' | '4DNADR' | '-4DNADR' | '5DNADR' | '-5DNADR' | '6DNADR' | '-6DNADR' | 'BANK' | 'BLOCK' | 'BNKSUM' | 'COUNT' | 'COUNT*' | 'DEC' // embed a single-precision (SP) constant | '2DEC' // embed a double precision constant | '2FCADR' // embed a double-word constant, to be used later by the DTCF instruction | 'OCT' // embed an octal constant | 'SETLOC' | 'SUBRO' ; standard_opcode : 'TC' // transfer control | 'TCR' // transfer control | 'CCS' // Count, Compare, and Skip | 'TCF' // Transfer Control to Fixed | 'DAS' // Double Add to Storage | 'LXCH' // Exchange L and K | 'INCR' // Increment | 'AD' // add to accumulator | 'ADS' // Add to Storage | 'CA' // Clear and Add | 'CS' // Clear and Subtract | 'INDEX' // Index | 'DXCH' // double exchange | 'TS' // Transfer to Storage | 'XCH' // Exchange A and K | 'AD' // AD | 'MASK' // Mask A by K | 'MSK' // Mask A by K | 'READ' // Read Channel KC | 'WRITE' // Write Channel KC | 'RAND' // Read and Mask | 'WAND' // Write and Mask | 'ROR' // Read and Superimpose | 'WOR' // Write and Superimpose | 'RXOR' // Read and Invert | 'EDRUPT' // for machine checkout only | 'BZF' // Branch Zero to Fixed | 'MSU' // Modular Subtract | 'QXCH' // Exchange Q and K | 'AUG' // augment | 'DIM' // diminish | 'DCA' // Double Clear and Add | 'DCS' // Double Clear and Subtract | 'SU' // subtract | 'BZMF' // Branch Zero or Minus to Fixed | 'MP' // Multiply | 'XXALQ' // Execute Extracode Using A, L, and Q | 'XLQ' // Execute Using L and Q | 'RETURN' // Return from Subroutine | 'RELINT' // Enable Interrupts | 'INHINT' // Disable Interrupts | 'EXTEND' // extend | 'NOOP' // No-operation | 'DDOUBL' // Double Precision Double | 'DTCF' // Double Transfer Control, Switching F Bank | 'COM' // Complement the Contents of A | 'ZL' // Zero L | 'RESUME' // Resume Interrupted Program | 'DTCB' // Double Transfer Control, Switching Both Banks | 'OVSK' // Overflow Skip | 'TCAA' // Transfer Control to Address in A | 'DOUBLE' // Double the Contents of A | 'ZQ' // Zero Q | 'DCOM' // Double Complement | 'SQUARE' // Square the Contents of A | 'PINC' // Add +1 in 1's-complement fashion to a counter | 'PCDU' // Add +1 in 2's-complement fashion to a counter. | 'MINC' // Add -1 in 1's-complement fashion to a counter. | 'MCDU' // Add -1 in 2's-complement fashion to a counter. | 'DINC' // look at the docs | 'SHINC' // look at the docs | 'SHANC' // look at the docs | 'INOTRD' // look at the docs | 'INOTLD' // look at the docs | 'FETCH' // look at the docs | 'STORE' // look at the docs | 'GOJ' // Jump to location 04000 octal. | 'TCSAJ' // look at the docs | 'CAF' // Clear and Add Fixed | 'CAE' // Clear and Add Erasable | 'CADR' | 'DMOVE' | 'VMOVE' | 'SMOVE' | 'DSU' | 'RTB' | 'ITC' | 'NOLOD' | 'EXIT' | 'BPL' | 'SIN' | 'COS' | 'CAD' | 'TEST' | 'VXSC' | 'ITC' | 'DAD' | 'VXV' | 'VAD' | 'DAD' | 'BPL' | 'DMP' | 'BOV' | 'VXV' | 'VAD' | 'UNIT' | 'OCTAL' | 'ADRES' | 'ABVAL' | 'COMP' | 'DV' // Divide | 'NDX' // INDEX (alternative syntax) | 'POUT' // look at the docs | 'MOUT' // look at the docs | 'ZOUT' // look at the docs | 'LODON' // this is used in a couple places in a "2-opcodes on a line" format | 'TSLT' // this is used in a couple places in a "2-opcodes on a line" format ; // // labels can begin with + or -, letters or digits // // labels can contain "&" as well as math symbols "+-*/" and "." // LABEL : [a-zA-Z0-9_.+\\-/*=&]+ ; INTE : [0-9]+ ('DEC' | 'D') ; DECIMAL : ([0-9]+ ('.' [0-9]+)?) | ('.' [0-9]+) ; COMMENT : '#' ~[\r\n]* ; PLUS : '+' ; MINUS : '-' ; TIMES : '*' ; DIV : '/' ; COMMA : ',' ; LPAREN : '(' ; RPAREN : ')' ; EOL : [\r\n]+ ; WS : [ \t]+ ;
src/compiling/ANTLR/grammar/Strings.g4
jecassis/VSCode-SystemVerilog
75
5343
<reponame>jecassis/VSCode-SystemVerilog grammar Strings; import Attributes; string_literal : STRING_LITERAL ;
tools-src/gnu/gcc/gcc/ada/5vinterr.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
18961
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . I N T E R R U P T S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-2000 Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is an OpenVMS/Alpha version of this package. -- Invariants: -- Once we associate a Server_Task with an interrupt, the task never -- goes away, and we never remove the association. -- There is no more than one interrupt per Server_Task and no more than -- one Server_Task per interrupt. -- Within this package, the lock L is used to protect the various status -- tables. If there is a Server_Task associated with an interrupt, we use -- the per-task lock of the Server_Task instead so that we protect the -- status between Interrupt_Manager and Server_Task. Protection among -- service requests are done using User Request to Interrupt_Manager -- rendezvous. with Ada.Task_Identification; -- used for Task_ID type with Ada.Exceptions; -- used for Raise_Exception with System.Task_Primitives; -- used for RTS_Lock -- Self with System.Interrupt_Management; -- used for Reserve -- Interrupt_ID -- Interrupt_Mask -- Abort_Task_Interrupt with System.Interrupt_Management.Operations; -- used for Thread_Block_Interrupt -- Thread_Unblock_Interrupt -- Install_Default_Action -- Install_Ignore_Action -- Copy_Interrupt_Mask -- Set_Interrupt_Mask -- Empty_Interrupt_Mask -- Fill_Interrupt_Mask -- Add_To_Interrupt_Mask -- Delete_From_Interrupt_Mask -- Interrupt_Wait -- Interrupt_Self_Process -- Get_Interrupt_Mask -- Set_Interrupt_Mask -- IS_Member -- Environment_Mask -- All_Tasks_Mask pragma Elaborate_All (System.Interrupt_Management.Operations); with System.Error_Reporting; pragma Warnings (Off, System.Error_Reporting); -- used for Shutdown with System.Task_Primitives.Operations; -- used for Write_Lock -- Unlock -- Abort -- Wakeup_Task -- Sleep -- Initialize_Lock with System.Task_Primitives.Interrupt_Operations; -- used for Set_Interrupt_ID with System.Storage_Elements; -- used for To_Address -- To_Integer -- Integer_Address with System.Tasking; -- used for Task_ID -- Task_Entry_Index -- Null_Task -- Self -- Interrupt_Manager_ID with System.Tasking.Utilities; -- used for Make_Independent with System.Tasking.Rendezvous; -- used for Call_Simple pragma Elaborate_All (System.Tasking.Rendezvous); with System.Tasking.Initialization; -- used for Defer_Abort -- Undefer_Abort with Unchecked_Conversion; package body System.Interrupts is use Tasking; use System.Error_Reporting; use Ada.Exceptions; package PRI renames System.Task_Primitives; package POP renames System.Task_Primitives.Operations; package PIO renames System.Task_Primitives.Interrupt_Operations; package IMNG renames System.Interrupt_Management; package IMOP renames System.Interrupt_Management.Operations; function To_System is new Unchecked_Conversion (Ada.Task_Identification.Task_Id, Task_ID); ----------------- -- Local Tasks -- ----------------- -- WARNING: System.Tasking.Utilities performs calls to this task -- with low-level constructs. Do not change this spec without synchro- -- nizing it. task Interrupt_Manager is entry Initialize (Mask : IMNG.Interrupt_Mask); entry Attach_Handler (New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean; Restoration : in Boolean := False); entry Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean); entry Detach_Handler (Interrupt : in Interrupt_ID; Static : in Boolean); entry Bind_Interrupt_To_Entry (T : Task_ID; E : Task_Entry_Index; Interrupt : Interrupt_ID); entry Detach_Interrupt_Entries (T : Task_ID); entry Block_Interrupt (Interrupt : Interrupt_ID); entry Unblock_Interrupt (Interrupt : Interrupt_ID); entry Ignore_Interrupt (Interrupt : Interrupt_ID); entry Unignore_Interrupt (Interrupt : Interrupt_ID); pragma Interrupt_Priority (System.Interrupt_Priority'Last); end Interrupt_Manager; task type Server_Task (Interrupt : Interrupt_ID) is pragma Priority (System.Interrupt_Priority'Last); end Server_Task; type Server_Task_Access is access Server_Task; -------------------------------- -- Local Types and Variables -- -------------------------------- type Entry_Assoc is record T : Task_ID; E : Task_Entry_Index; end record; type Handler_Assoc is record H : Parameterless_Handler; Static : Boolean; -- Indicates static binding; end record; User_Handler : array (Interrupt_ID'Range) of Handler_Assoc := (others => (null, Static => False)); pragma Volatile_Components (User_Handler); -- Holds the protected procedure handler (if any) and its Static -- information for each interrupt. A handler is a Static one if -- it is specified through the pragma Attach_Handler. -- Attach_Handler. Otherwise, not static) User_Entry : array (Interrupt_ID'Range) of Entry_Assoc := (others => (T => Null_Task, E => Null_Task_Entry)); pragma Volatile_Components (User_Entry); -- Holds the task and entry index (if any) for each interrupt Blocked : array (Interrupt_ID'Range) of Boolean := (others => False); pragma Volatile_Components (Blocked); -- True iff the corresponding interrupt is blocked in the process level Ignored : array (Interrupt_ID'Range) of Boolean := (others => False); pragma Volatile_Components (Ignored); -- True iff the corresponding interrupt is blocked in the process level Last_Unblocker : array (Interrupt_ID'Range) of Task_ID := (others => Null_Task); pragma Volatile_Components (Last_Unblocker); -- Holds the ID of the last Task which Unblocked this Interrupt. -- It contains Null_Task if no tasks have ever requested the -- Unblocking operation or the Interrupt is currently Blocked. Server_ID : array (Interrupt_ID'Range) of Task_ID := (others => Null_Task); pragma Atomic_Components (Server_ID); -- Holds the Task_ID of the Server_Task for each interrupt. -- Task_ID is needed to accomplish locking per Interrupt base. Also -- is needed to decide whether to create a new Server_Task. -- Type and Head, Tail of the list containing Registered Interrupt -- Handlers. These definitions are used to register the handlers -- specified by the pragma Interrupt_Handler. type Registered_Handler; type R_Link is access all Registered_Handler; type Registered_Handler is record H : System.Address := System.Null_Address; Next : R_Link := null; end record; Registered_Handler_Head : R_Link := null; Registered_Handler_Tail : R_Link := null; Access_Hold : Server_Task_Access; -- variable used to allocate Server_Task using "new". L : aliased PRI.RTS_Lock; -- L protects contents in tables above corresponding to interrupts -- for which Server_ID (T) = null. -- -- If Server_ID (T) /= null then protection is via -- per-task (TCB) lock of Server_ID (T). -- -- For deadlock prevention, L should not be locked after -- any other lock is held. Task_Lock : array (Interrupt_ID'Range) of Boolean := (others => False); -- Boolean flags to give matching Locking and Unlocking. See the comments -- in Lock_Interrupt. ----------------------- -- Local Subprograms -- ----------------------- procedure Lock_Interrupt (Self_ID : Task_ID; Interrupt : Interrupt_ID); -- protect the tables using L or per-task lock. Set the Boolean -- value Task_Lock if the lock is made using per-task lock. -- This information is needed so that Unlock_Interrupt -- performs unlocking on the same lock. The situation we are preventing -- is, for example, when Attach_Handler is called for the first time -- we lock L and create an Server_Task. For a matching unlocking, if we -- rely on the fact that there is a Server_Task, we will unlock the -- per-task lock. procedure Unlock_Interrupt (Self_ID : Task_ID; Interrupt : Interrupt_ID); function Is_Registered (Handler : Parameterless_Handler) return Boolean; -------------------- -- Lock_Interrupt -- -------------------- -- ????? -- This package has been modified several times. -- Do we still need this fancy locking scheme, now that more operations -- are entries of the interrupt manager task? -- ????? -- More likely, we will need to convert one or more entry calls to -- protected operations, because presently we are violating locking order -- rules by calling a task entry from within the runtime system. procedure Lock_Interrupt (Self_ID : Task_ID; Interrupt : Interrupt_ID) is begin Initialization.Defer_Abort (Self_ID); POP.Write_Lock (L'Access); if Task_Lock (Interrupt) then -- We need to use per-task lock. POP.Unlock (L'Access); POP.Write_Lock (Server_ID (Interrupt)); -- Rely on the fact that once Server_ID is set to a non-null -- value it will never be set back to null. elsif Server_ID (Interrupt) /= Null_Task then -- We need to use per-task lock. Task_Lock (Interrupt) := True; POP.Unlock (L'Access); POP.Write_Lock (Server_ID (Interrupt)); end if; end Lock_Interrupt; ---------------------- -- Unlock_Interrupt -- ---------------------- procedure Unlock_Interrupt (Self_ID : Task_ID; Interrupt : Interrupt_ID) is begin if Task_Lock (Interrupt) then POP.Unlock (Server_ID (Interrupt)); else POP.Unlock (L'Access); end if; Initialization.Undefer_Abort (Self_ID); end Unlock_Interrupt; ---------------------------------- -- Register_Interrupt_Handler -- ---------------------------------- procedure Register_Interrupt_Handler (Handler_Addr : System.Address) is New_Node_Ptr : R_Link; begin -- This routine registers the Handler as usable for Dynamic -- Interrupt Handler. Routines attaching and detaching Handler -- dynamically should first consult if the Handler is rgistered. -- A Program Error should be raised if it is not registered. -- The pragma Interrupt_Handler can only appear in the library -- level PO definition and instantiation. Therefore, we do not need -- to implement Unregistering operation. Neither we need to -- protect the queue structure using a Lock. pragma Assert (Handler_Addr /= System.Null_Address); New_Node_Ptr := new Registered_Handler; New_Node_Ptr.H := Handler_Addr; if Registered_Handler_Head = null then Registered_Handler_Head := New_Node_Ptr; Registered_Handler_Tail := New_Node_Ptr; else Registered_Handler_Tail.Next := New_Node_Ptr; Registered_Handler_Tail := New_Node_Ptr; end if; end Register_Interrupt_Handler; ------------------- -- Is_Registered -- ------------------- -- See if the Handler has been "pragma"ed using Interrupt_Handler. -- Always consider a null handler as registered. function Is_Registered (Handler : Parameterless_Handler) return Boolean is type Fat_Ptr is record Object_Addr : System.Address; Handler_Addr : System.Address; end record; function To_Fat_Ptr is new Unchecked_Conversion (Parameterless_Handler, Fat_Ptr); Ptr : R_Link; Fat : Fat_Ptr; begin if Handler = null then return True; end if; Fat := To_Fat_Ptr (Handler); Ptr := Registered_Handler_Head; while (Ptr /= null) loop if Ptr.H = Fat.Handler_Addr then return True; end if; Ptr := Ptr.Next; end loop; return False; end Is_Registered; ----------------- -- Is_Reserved -- ----------------- function Is_Reserved (Interrupt : Interrupt_ID) return Boolean is begin return IMNG.Reserve (IMNG.Interrupt_ID (Interrupt)); end Is_Reserved; ----------------------- -- Is_Entry_Attached -- ----------------------- function Is_Entry_Attached (Interrupt : Interrupt_ID) return Boolean is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return User_Entry (Interrupt).T /= Null_Task; end Is_Entry_Attached; ------------------------- -- Is_Handler_Attached -- ------------------------- function Is_Handler_Attached (Interrupt : Interrupt_ID) return Boolean is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return User_Handler (Interrupt).H /= null; end Is_Handler_Attached; ---------------- -- Is_Blocked -- ---------------- function Is_Blocked (Interrupt : Interrupt_ID) return Boolean is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return Blocked (Interrupt); end Is_Blocked; ---------------- -- Is_Ignored -- ---------------- function Is_Ignored (Interrupt : Interrupt_ID) return Boolean is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return Ignored (Interrupt); end Is_Ignored; --------------------- -- Current_Handler -- --------------------- function Current_Handler (Interrupt : Interrupt_ID) return Parameterless_Handler is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; -- ??? Since Parameterless_Handler is not Atomic, the -- current implementation is wrong. We need a new service in -- Interrupt_Manager to ensure atomicity. return User_Handler (Interrupt).H; end Current_Handler; -------------------- -- Attach_Handler -- -------------------- -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the -- previous handler's binding status (ie. do not care if it is a -- dynamic or static handler). -- This option is needed so that during the finalization of a PO, we -- can detach handlers attached through pragma Attach_Handler. procedure Attach_Handler (New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean := False) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Attach_Handler (New_Handler, Interrupt, Static); end Attach_Handler; ---------------------- -- Exchange_Handler -- ---------------------- -- Calling this procedure with New_Handler = null and Static = True -- means we want to detach the current handler regardless of the -- previous handler's binding status (ie. do not care if it is a -- dynamic or static handler). -- This option is needed so that during the finalization of a PO, we -- can detach handlers attached through pragma Attach_Handler. procedure Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean := False) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static); end Exchange_Handler; -------------------- -- Detach_Handler -- -------------------- -- Calling this procedure with Static = True means we want to Detach the -- current handler regardless of the previous handler's binding status -- (i.e. do not care if it is a dynamic or static handler). -- This option is needed so that during the finalization of a PO, we can -- detach handlers attached through pragma Attach_Handler. procedure Detach_Handler (Interrupt : in Interrupt_ID; Static : in Boolean := False) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Detach_Handler (Interrupt, Static); end Detach_Handler; --------------- -- Reference -- --------------- function Reference (Interrupt : Interrupt_ID) return System.Address is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return Storage_Elements.To_Address (Storage_Elements.Integer_Address (Interrupt)); end Reference; ----------------------------- -- Bind_Interrupt_To_Entry -- ----------------------------- -- This procedure raises a Program_Error if it tries to -- bind an interrupt to which an Entry or a Procedure is -- already bound. procedure Bind_Interrupt_To_Entry (T : Task_ID; E : Task_Entry_Index; Int_Ref : System.Address) is Interrupt : constant Interrupt_ID := Interrupt_ID (Storage_Elements.To_Integer (Int_Ref)); begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Bind_Interrupt_To_Entry (T, E, Interrupt); end Bind_Interrupt_To_Entry; ------------------------------ -- Detach_Interrupt_Entries -- ------------------------------ procedure Detach_Interrupt_Entries (T : Task_ID) is begin Interrupt_Manager.Detach_Interrupt_Entries (T); end Detach_Interrupt_Entries; --------------------- -- Block_Interrupt -- --------------------- procedure Block_Interrupt (Interrupt : Interrupt_ID) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Block_Interrupt (Interrupt); end Block_Interrupt; ----------------------- -- Unblock_Interrupt -- ----------------------- procedure Unblock_Interrupt (Interrupt : Interrupt_ID) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Unblock_Interrupt (Interrupt); end Unblock_Interrupt; ------------------ -- Unblocked_By -- ------------------ function Unblocked_By (Interrupt : Interrupt_ID) return System.Tasking.Task_ID is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; return Last_Unblocker (Interrupt); end Unblocked_By; ---------------------- -- Ignore_Interrupt -- ---------------------- procedure Ignore_Interrupt (Interrupt : Interrupt_ID) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Ignore_Interrupt (Interrupt); end Ignore_Interrupt; ------------------------ -- Unignore_Interrupt -- ------------------------ procedure Unignore_Interrupt (Interrupt : Interrupt_ID) is begin if Is_Reserved (Interrupt) then Raise_Exception (Program_Error'Identity, "Interrupt" & Interrupt_ID'Image (Interrupt) & " is reserved"); end if; Interrupt_Manager.Unignore_Interrupt (Interrupt); end Unignore_Interrupt; ----------------------- -- Interrupt_Manager -- ----------------------- task body Interrupt_Manager is ---------------------- -- Local Variables -- ---------------------- Intwait_Mask : aliased IMNG.Interrupt_Mask; Ret_Interrupt : Interrupt_ID; Old_Mask : aliased IMNG.Interrupt_Mask; Self_ID : Task_ID := POP.Self; --------------------- -- Local Routines -- --------------------- procedure Unprotected_Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean; Restoration : in Boolean := False); procedure Unprotected_Detach_Handler (Interrupt : in Interrupt_ID; Static : in Boolean); ---------------------------------- -- Unprotected_Exchange_Handler -- ---------------------------------- procedure Unprotected_Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean; Restoration : in Boolean := False) is begin if User_Entry (Interrupt).T /= Null_Task then -- In case we have an Interrupt Entry already installed. -- raise a program error. (propagate it to the caller). Unlock_Interrupt (Self_ID, Interrupt); Raise_Exception (Program_Error'Identity, "An interrupt is already installed"); end if; -- Note : A null handler with Static = True will -- pass the following check. That is the case when we want to -- Detach a handler regardless of the Static status -- of the current_Handler. -- We don't check anything if Restoration is True, since we -- may be detaching a static handler to restore a dynamic one. if not Restoration and then not Static -- Tries to overwrite a static Interrupt Handler with a -- dynamic Handler and then (User_Handler (Interrupt).Static -- The new handler is not specified as an -- Interrupt Handler by a pragma. or else not Is_Registered (New_Handler)) then Unlock_Interrupt (Self_ID, Interrupt); Raise_Exception (Program_Error'Identity, "Trying to overwrite a static Interrupt Handler with a " & "dynamic Handler"); end if; -- The interrupt should no longer be ingnored if -- it was ever ignored. Ignored (Interrupt) := False; -- Save the old handler Old_Handler := User_Handler (Interrupt).H; -- The new handler User_Handler (Interrupt).H := New_Handler; if New_Handler = null then -- The null handler means we are detaching the handler. User_Handler (Interrupt).Static := False; else User_Handler (Interrupt).Static := Static; end if; -- Invoke a corresponding Server_Task if not yet created. -- Place Task_ID info in Server_ID array. if Server_ID (Interrupt) = Null_Task then Access_Hold := new Server_Task (Interrupt); Server_ID (Interrupt) := To_System (Access_Hold.all'Identity); else POP.Wakeup (Server_ID (Interrupt), Interrupt_Server_Idle_Sleep); end if; end Unprotected_Exchange_Handler; -------------------------------- -- Unprotected_Detach_Handler -- -------------------------------- procedure Unprotected_Detach_Handler (Interrupt : in Interrupt_ID; Static : in Boolean) is Old_Handler : Parameterless_Handler; begin if User_Entry (Interrupt).T /= Null_Task then -- In case we have an Interrupt Entry installed. -- raise a program error. (propagate it to the caller). Unlock_Interrupt (Self_ID, Interrupt); Raise_Exception (Program_Error'Identity, "An interrupt entry is already installed"); end if; -- Note : Static = True will pass the following check. That is the -- case when we want to detach a handler regardless of the static -- status of the current_Handler. if not Static and then User_Handler (Interrupt).Static then -- Tries to detach a static Interrupt Handler. -- raise a program error. Unlock_Interrupt (Self_ID, Interrupt); Raise_Exception (Program_Error'Identity, "Trying to detach a static Interrupt Handler"); end if; -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (Interrupt) := False; Old_Handler := User_Handler (Interrupt).H; -- The new handler User_Handler (Interrupt).H := null; User_Handler (Interrupt).Static := False; IMOP.Interrupt_Self_Process (IMNG.Interrupt_ID (Interrupt)); end Unprotected_Detach_Handler; -- Start of processing for Interrupt_Manager begin -- By making this task independent of master, when the process -- goes away, the Interrupt_Manager will terminate gracefully. System.Tasking.Utilities.Make_Independent; -- Environmen task gets its own interrupt mask, saves it, -- and then masks all interrupts except the Keep_Unmasked set. -- During rendezvous, the Interrupt_Manager receives the old -- interrupt mask of the environment task, and sets its own -- interrupt mask to that value. -- The environment task will call the entry of Interrupt_Manager some -- during elaboration of the body of this package. accept Initialize (Mask : IMNG.Interrupt_Mask) do null; end Initialize; -- Note: All tasks in RTS will have all the Reserve Interrupts -- being masked (except the Interrupt_Manager) and Keep_Unmasked -- unmasked when created. -- Abort_Task_Interrupt is one of the Interrupt unmasked -- in all tasks. We mask the Interrupt in this particular task -- so that "sigwait" is possible to catch an explicitly sent -- Abort_Task_Interrupt from the Server_Tasks. -- This sigwaiting is needed so that we make sure a Server_Task is -- out of its own sigwait state. This extra synchronization is -- necessary to prevent following senarios. -- 1) Interrupt_Manager sends an Abort_Task_Interrupt to the -- Server_Task then changes its own interrupt mask (OS level). -- If an interrupt (corresponding to the Server_Task) arrives -- in the nean time we have the Interrupt_Manager umnasked and -- the Server_Task waiting on sigwait. -- 2) For unbinding handler, we install a default action in the -- Interrupt_Manager. POSIX.1c states that the result of using -- "sigwait" and "sigaction" simaltaneously on the same interrupt -- is undefined. Therefore, we need to be informed from the -- Server_Task of the fact that the Server_Task is out of its -- sigwait stage. loop -- A block is needed to absorb Program_Error exception declare Old_Handler : Parameterless_Handler; begin select accept Attach_Handler (New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean; Restoration : in Boolean := False) do Lock_Interrupt (Self_ID, Interrupt); Unprotected_Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static, Restoration); Unlock_Interrupt (Self_ID, Interrupt); end Attach_Handler; or accept Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID; Static : in Boolean) do Lock_Interrupt (Self_ID, Interrupt); Unprotected_Exchange_Handler (Old_Handler, New_Handler, Interrupt, Static); Unlock_Interrupt (Self_ID, Interrupt); end Exchange_Handler; or accept Detach_Handler (Interrupt : in Interrupt_ID; Static : in Boolean) do Lock_Interrupt (Self_ID, Interrupt); Unprotected_Detach_Handler (Interrupt, Static); Unlock_Interrupt (Self_ID, Interrupt); end Detach_Handler; or accept Bind_Interrupt_To_Entry (T : Task_ID; E : Task_Entry_Index; Interrupt : Interrupt_ID) do Lock_Interrupt (Self_ID, Interrupt); -- if there is a binding already (either a procedure or an -- entry), raise Program_Error (propagate it to the caller). if User_Handler (Interrupt).H /= null or else User_Entry (Interrupt).T /= Null_Task then Unlock_Interrupt (Self_ID, Interrupt); Raise_Exception (Program_Error'Identity, "A binding for this interrupt is already present"); end if; -- The interrupt should no longer be ingnored if -- it was ever ignored. Ignored (Interrupt) := False; User_Entry (Interrupt) := Entry_Assoc' (T => T, E => E); -- Indicate the attachment of Interrupt Entry in ATCB. -- This is need so that when an Interrupt Entry task -- terminates the binding can be cleaned. -- The call to unbinding must be -- make by the task before it terminates. T.Interrupt_Entry := True; -- Invoke a corresponding Server_Task if not yet created. -- Place Task_ID info in Server_ID array. if Server_ID (Interrupt) = Null_Task then Access_Hold := new Server_Task (Interrupt); Server_ID (Interrupt) := To_System (Access_Hold.all'Identity); else POP.Wakeup (Server_ID (Interrupt), Interrupt_Server_Idle_Sleep); end if; Unlock_Interrupt (Self_ID, Interrupt); end Bind_Interrupt_To_Entry; or accept Detach_Interrupt_Entries (T : Task_ID) do for I in Interrupt_ID'Range loop if not Is_Reserved (I) then Lock_Interrupt (Self_ID, I); if User_Entry (I).T = T then -- The interrupt should no longer be ignored if -- it was ever ignored. Ignored (I) := False; User_Entry (I) := Entry_Assoc' (T => Null_Task, E => Null_Task_Entry); IMOP.Interrupt_Self_Process (IMNG.Interrupt_ID (I)); end if; Unlock_Interrupt (Self_ID, I); end if; end loop; -- Indicate in ATCB that no Interrupt Entries are attached. T.Interrupt_Entry := False; end Detach_Interrupt_Entries; or accept Block_Interrupt (Interrupt : Interrupt_ID) do raise Program_Error; end Block_Interrupt; or accept Unblock_Interrupt (Interrupt : Interrupt_ID) do raise Program_Error; end Unblock_Interrupt; or accept Ignore_Interrupt (Interrupt : Interrupt_ID) do raise Program_Error; end Ignore_Interrupt; or accept Unignore_Interrupt (Interrupt : Interrupt_ID) do raise Program_Error; end Unignore_Interrupt; end select; exception -- If there is a program error we just want to propagate it -- to the caller and do not want to stop this task. when Program_Error => null; when others => pragma Assert (Shutdown ("Interrupt_Manager---exception not expected")); null; end; end loop; pragma Assert (Shutdown ("Interrupt_Manager---should not get here")); end Interrupt_Manager; ----------------- -- Server_Task -- ----------------- task body Server_Task is Self_ID : Task_ID := Self; Tmp_Handler : Parameterless_Handler; Tmp_ID : Task_ID; Tmp_Entry_Index : Task_Entry_Index; Intwait_Mask : aliased IMNG.Interrupt_Mask; Ret_Interrupt : IMNG.Interrupt_ID; begin -- By making this task independent of master, when the process -- goes away, the Server_Task will terminate gracefully. System.Tasking.Utilities.Make_Independent; -- Install default action in system level. IMOP.Install_Default_Action (IMNG.Interrupt_ID (Interrupt)); -- Set up the mask (also clears the event flag) IMOP.Empty_Interrupt_Mask (Intwait_Mask'Access); IMOP.Add_To_Interrupt_Mask (Intwait_Mask'Access, IMNG.Interrupt_ID (Interrupt)); -- Remember the Interrupt_ID for Abort_Task. PIO.Set_Interrupt_ID (IMNG.Interrupt_ID (Interrupt), Self_ID); -- Note: All tasks in RTS will have all the Reserve Interrupts -- being masked (except the Interrupt_Manager) and Keep_Unmasked -- unmasked when created. loop System.Tasking.Initialization.Defer_Abort (Self_ID); -- A Handler or an Entry is installed. At this point all tasks -- mask for the Interrupt is masked. Catch the Interrupt using -- sigwait. -- This task may wake up from sigwait by receiving an interrupt -- (Abort_Task_Interrupt) from the Interrupt_Manager for unbinding -- a Procedure Handler or an Entry. Or it could be a wake up -- from status change (Unblocked -> Blocked). If that is not -- the case, we should exceute the attached Procedure or Entry. POP.Write_Lock (Self_ID); if User_Handler (Interrupt).H = null and then User_Entry (Interrupt).T = Null_Task then -- No Interrupt binding. If there is an interrupt, -- Interrupt_Manager will take default action. Self_ID.Common.State := Interrupt_Server_Idle_Sleep; POP.Sleep (Self_ID, Interrupt_Server_Idle_Sleep); Self_ID.Common.State := Runnable; else Self_ID.Common.State := Interrupt_Server_Blocked_On_Event_Flag; Ret_Interrupt := IMOP.Interrupt_Wait (Intwait_Mask'Access); Self_ID.Common.State := Runnable; if not (Self_ID.Deferral_Level = 0 and then Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level) then if User_Handler (Interrupt).H /= null then Tmp_Handler := User_Handler (Interrupt).H; -- RTS calls should not be made with self being locked. POP.Unlock (Self_ID); Tmp_Handler.all; POP.Write_Lock (Self_ID); elsif User_Entry (Interrupt).T /= Null_Task then Tmp_ID := User_Entry (Interrupt).T; Tmp_Entry_Index := User_Entry (Interrupt).E; -- RTS calls should not be made with self being locked. POP.Unlock (Self_ID); System.Tasking.Rendezvous.Call_Simple (Tmp_ID, Tmp_Entry_Index, System.Null_Address); POP.Write_Lock (Self_ID); end if; end if; end if; POP.Unlock (Self_ID); System.Tasking.Initialization.Undefer_Abort (Self_ID); -- Undefer abort here to allow a window for this task -- to be aborted at the time of system shutdown. end loop; pragma Assert (Shutdown ("Server_Task---should not get here")); end Server_Task; ------------------------------------- -- Has_Interrupt_Or_Attach_Handler -- ------------------------------------- function Has_Interrupt_Or_Attach_Handler (Object : access Dynamic_Interrupt_Protection) return Boolean is begin return True; end Has_Interrupt_Or_Attach_Handler; ---------------- -- Finalize -- ---------------- procedure Finalize (Object : in out Static_Interrupt_Protection) is begin -- ??? loop to be executed only when we're not doing library level -- finalization, since in this case all interrupt tasks are gone. if not Interrupt_Manager'Terminated then for N in reverse Object.Previous_Handlers'Range loop Interrupt_Manager.Attach_Handler (New_Handler => Object.Previous_Handlers (N).Handler, Interrupt => Object.Previous_Handlers (N).Interrupt, Static => Object.Previous_Handlers (N).Static, Restoration => True); end loop; end if; Tasking.Protected_Objects.Entries.Finalize (Tasking.Protected_Objects.Entries.Protection_Entries (Object)); end Finalize; ------------------------------------- -- Has_Interrupt_Or_Attach_Handler -- ------------------------------------- function Has_Interrupt_Or_Attach_Handler (Object : access Static_Interrupt_Protection) return Boolean is begin return True; end Has_Interrupt_Or_Attach_Handler; ---------------------- -- Install_Handlers -- ---------------------- procedure Install_Handlers (Object : access Static_Interrupt_Protection; New_Handlers : in New_Handler_Array) is begin for N in New_Handlers'Range loop -- We need a lock around this ??? Object.Previous_Handlers (N).Interrupt := New_Handlers (N).Interrupt; Object.Previous_Handlers (N).Static := User_Handler (New_Handlers (N).Interrupt).Static; -- We call Exchange_Handler and not directly Interrupt_Manager. -- Exchange_Handler so we get the Is_Reserved check. Exchange_Handler (Old_Handler => Object.Previous_Handlers (N).Handler, New_Handler => New_Handlers (N).Handler, Interrupt => New_Handlers (N).Interrupt, Static => True); end loop; end Install_Handlers; -- Elaboration code for package System.Interrupts begin -- Get Interrupt_Manager's ID so that Abort_Interrupt can be sent. Interrupt_Manager_ID := To_System (Interrupt_Manager'Identity); -- Initialize the lock L. Initialization.Defer_Abort (Self); POP.Initialize_Lock (L'Access, POP.ATCB_Level); Initialization.Undefer_Abort (Self); -- During the elaboration of this package body we want RTS to -- inherit the interrupt mask from the Environment Task. -- The Environment Task should have gotten its mask from -- the enclosing process during the RTS start up. (See -- in s-inmaop.adb). Pass the Interrupt_Mask of the Environment -- task to the Interrupt_Manager. -- Note : At this point we know that all tasks (including -- RTS internal servers) are masked for non-reserved signals -- (see s-taprop.adb). Only the Interrupt_Manager will have -- masks set up differently inheriting the original Environment -- Task's mask. Interrupt_Manager.Initialize (IMOP.Environment_Mask); end System.Interrupts;
source/league/ucd/matreshka-internals-unicode-ucd-core_016b.ads
svn2github/matreshka
24
21422
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2015, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Restrictions (No_Elaboration_Code); -- GNAT: enforce generation of preinitialized data section instead of -- generation of elaboration code. package Matreshka.Internals.Unicode.Ucd.Core_016B is pragma Preelaborate; Group_016B : aliased constant Core_Second_Stage := (16#00# .. 16#2F# => -- 016B00 .. 016B2F (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#30# .. 16#36# => -- 016B30 .. 016B36 (Nonspacing_Mark, Neutral, Extend, Extend, Extend, Combining_Mark, (Other_Alphabetic | Alphabetic | Case_Ignorable | Grapheme_Extend | ID_Continue | XID_Continue => True, others => False)), 16#37# .. 16#38# => -- 016B37 .. 016B38 (Other_Punctuation, Neutral, Other, Other, S_Term, Break_After, (STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#39# => -- 016B39 (Other_Punctuation, Neutral, Other, Other, Other, Break_After, (Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#3A# .. 16#3B# => -- 016B3A .. 016B3B (Other_Punctuation, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#3C# .. 16#3F# => -- 016B3C .. 016B3F (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#40# .. 16#41# => -- 016B40 .. 016B41 (Modifier_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Case_Ignorable | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#42# .. 16#43# => -- 016B42 .. 016B43 (Modifier_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Extender | Alphabetic | Case_Ignorable | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#44# => -- 016B44 (Other_Punctuation, Neutral, Other, Other, S_Term, Break_After, (STerm | Terminal_Punctuation | Grapheme_Base => True, others => False)), 16#45# => -- 016B45 (Other_Symbol, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#50# .. 16#59# => -- 016B50 .. 016B59 (Decimal_Number, Neutral, Other, Numeric, Numeric, Numeric, (Grapheme_Base | ID_Continue | XID_Continue => True, others => False)), 16#5B# .. 16#61# => -- 016B5B .. 016B61 (Other_Number, Neutral, Other, Other, Other, Alphabetic, (Grapheme_Base => True, others => False)), 16#63# .. 16#77# => -- 016B63 .. 016B77 (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), 16#7D# .. 16#8F# => -- 016B7D .. 016B8F (Other_Letter, Neutral, Other, A_Letter, O_Letter, Alphabetic, (Alphabetic | Grapheme_Base | ID_Continue | ID_Start | XID_Continue | XID_Start => True, others => False)), others => (Unassigned, Neutral, Other, Other, Other, Unknown, (others => False))); end Matreshka.Internals.Unicode.Ucd.Core_016B;
rtas/examples/example1.ads
erlingrj/ktc
0
22826
package Example1 is procedure Sense ; procedure Handle_Deadline; end Example1;
sound/musicasm/Competition Menu.asm
NatsumiFox/Sonic-3-93-Nov-03
7
1966
CompetitionMenu_Header: sHeaderInit ; Z80 offset is $CCB8 sHeaderPatch CompetitionMenu_Patches sHeaderCh $06, $03 sHeaderTempo $01, $25 sHeaderDAC CompetitionMenu_DAC sHeaderFM CompetitionMenu_FM1, $18, $12 sHeaderFM CompetitionMenu_FM2, $0C, $19 sHeaderFM CompetitionMenu_FM3, $0C, $19 sHeaderFM CompetitionMenu_FM4, $0C, $19 sHeaderFM CompetitionMenu_FM5, $0C, $19 sHeaderPSG CompetitionMenu_PSG1, $F4, $04, $00, v0C sHeaderPSG CompetitionMenu_PSG2, $F4, $04, $00, v0C sHeaderPSG CompetitionMenu_PSG3, $00, $04, $00, v0C dc.b $F2, $F2 ; Unused CompetitionMenu_DAC: dc.b nRst, $30, dSnare, $02, dSnare, dSnare, dSnare, $06 dc.b dSnare, dSnare, dSnare, dSnare, dSnare, dSnare CompetitionMenu_Jump7: dc.b dKick, $18, dSnare, $06, dSnare, $0C, dSnare, $12 dc.b dKick, $0C, dSnare, $06, dKick, $12, dKick, $18 dc.b dSnare, $06, dSnare, $0C, dSnare, $12, dKick, $0C dc.b dSnare, $06, dKick, $12, dKick, $18, dSnare, $06 dc.b dSnare, $0C, dSnare, $12, dKick, $0C, dSnare, $06 dc.b dKick, $12, dKick, $18, dSnare, $06, dSnare, $0C dc.b dSnare, $12, dKick, $0C, dSnare, $06, dKick, dSnare dc.b dSnare, dKick, $18, dSnare, $24, dKick, $0C, dSnare dc.b $06, dKick, $12, dKick, $18, dSnare, $24, dKick dc.b $0C, dSnare, $06, dKick, $12, dKick, $18, dSnare dc.b $24, dKick, $0C, dSnare, $06, dKick, $12, dKick dc.b $18, dSnare, $24, dKick, $0C, dSnare, $06, dKick dc.b dSnare, $0C, dKick, $18, dSnare, $24, dKick, $0C dc.b dSnare, $06, dKick, $12, dKick, $18, dSnare, $24 dc.b dKick, $0C, dSnare, $06, dKick, $12, dKick, $18 dc.b dSnare, $24, dKick, $0C, dSnare, $06, dKick, $12 dc.b dKick, $18, dSnare, $1E, dSnare, $06, dKick, dSnare dc.b dSnare, dKick, dSnare, dSnare, dKick, $18, dSnare, $24 dc.b dKick, $0C, dSnare, $06, dKick, $12, dKick, $18 dc.b dSnare, $24, dKick, $0C, dSnare, $06, dKick, $12 dc.b dKick, $18, dSnare, $24, dKick, $0C, dSnare, $06 dc.b dKick, $12, dKick, $18, dSnare, $24, dKick, $06 dc.b dSnare, dSnare, dSnare, dSnare, dSnare, dKick, dKick, dKick dc.b dKick, dSnare, $24, dKick, $06, dKick, dSnare, dKick dc.b $12, dKick, $06, dKick, dKick, dKick, dSnare, $24 dc.b dKick, $06, dKick, dSnare, dKick, dSnare, $0C, dKick dc.b $06, dKick, dKick, dKick, dSnare, $24, dKick, $06 dc.b dKick, dSnare, dKick, $12, dKick, $06, dKick, dKick dc.b dKick, dSnare, $24, dKick, $06, dKick, dSnare, dKick dc.b dSnare, $0C, dKick, $06, dKick, dKick, dKick, dSnare dc.b $24, dKick, $06, dKick, dSnare, dKick, $12, dKick dc.b $06, dKick, dKick, dKick, dSnare, $24, dKick, $06 dc.b dKick, dSnare, dKick, dSnare, $0C, dKick, $06, dKick dc.b dKick, dKick, dSnare, $24, dKick, $06, dKick, dSnare dc.b dKick, $12, dSnare, $06, dSnare, dSnare, dSnare, $26 dc.b dSnare, $02, dSnare, dSnare, $06, dSnare, dSnare, dSnare dc.b dSnare, dSnare sJump CompetitionMenu_Jump7 dc.b $F2 ; Unused CompetitionMenu_FM1: sPatFM $15 ssDetune $00 ssModZ80 $0F, $01, $06, $06 dc.b nRst, $60 CompetitionMenu_Jump1: dc.b nC1, $06, nRst, $12, nC2, nG1, $06, nRst dc.b nBb1, $04, nRst, $02, nC2, $04, nRst, $08 dc.b nBb1, $06, nG1, $12, nF1, $06, nFs1, nG1 dc.b nF1, nEb1, nC1, $0C, nEb1, $04, nRst, $08 dc.b nFs1, $04, nRst, $02, nF1, $0C, nEb1, $06 dc.b nBb0, $0E, nRst, $04, nC1, $06, nRst, $12 dc.b nC2, nG1, $06, nRst, nBb1, $04, nRst, $02 dc.b nC2, $04, nRst, $08, nBb1, $06, nG1, $12 dc.b nF1, $06, nFs1, nG1, nF1, nEb1, nC1, $0C dc.b nEb1, $04, nRst, $08, nFs1, $04, nRst, $02 dc.b nF1, $0C, nEb1, $06, nBb0, $0E, nRst, $04 dc.b nC1, $06, nRst, $12, nC2, nG1, $06, nBb1 dc.b $04, nRst, $08, nC2, $04, nRst, $08, nBb1 dc.b $06, nG1, $12, nF1, $06, nFs1, nG1, nF1 dc.b nEb1, nC1, $0C, nEb1, $06, nRst, $0C, nF1 dc.b $04, nRst, $08, nEb1, $06, nBb0, $0E, nRst dc.b $04, nC1, $06, nRst, $12, nC2, nG1, $06 dc.b nBb1, $04, nRst, $08, nC2, $04, nRst, $08 dc.b nBb1, $06, nG1, $12, nF1, $06, nFs1, nG1 dc.b nF1, nEb1, nC1, $0C, nEb1, $06, nRst, $0C dc.b nF1, $04, nRst, $08, nEb1, $06, nBb0, $0E dc.b nRst, $04, nF1, $06, nRst, $12, nF2, nC2 dc.b $06, nEb2, $04, nRst, $08, nF2, $04, nRst dc.b $08, nEb2, $06, nC2, $12, nBb1, $06, nB1 dc.b nC2, nBb1, nAb1, nF1, $0C, nAb1, $06, nRst dc.b $0C, nBb1, $04, nRst, $08, nAb1, $06, nF1 dc.b $0E, nRst, $04, nC1, $06, nRst, $12, nC2 dc.b nG1, $06, nBb1, $04, nRst, $08, nC2, $04 dc.b nRst, $08, nBb1, $06, nG1, $12, nF1, $06 dc.b nFs1, nG1, nF1, nEb1, nC1, $0C, nEb1, $06 dc.b nRst, $0C, nF1, $04, nRst, $08, nEb1, $06 dc.b nBb0, $0E, nRst, $04, nAb0, $06, nRst, $12 dc.b nAb1, $0E, nRst, $04, nAb1, $06, nG1, $04 dc.b nRst, $08, nF1, $04, nRst, $08, nEb1, $06 dc.b nF1, $10, nRst, $02, nC1, $06, nRst, $12 dc.b nC2, $10, nRst, $02, nC2, $04, nRst, $02 dc.b nBb1, $04, nRst, $08, nG1, $04, nRst, $08 dc.b nF1, $04, nRst, $02, nG1, $0E, nRst, $04 dc.b nAb0, $06, nRst, $12, nAb1, $0E, nRst, $04 dc.b nAb1, $06, nG1, $04, nRst, $08, nF1, $04 dc.b nRst, $08, nEb1, $06, nF1, $10, nRst, $02 dc.b nC1, $06, nRst, $12, nC2, $10, nRst, $02 dc.b nC2, $04, nRst, $02, nBb1, $04, nRst, $08 dc.b nG1, $04, nRst, $08, nF1, $04, nRst, $02 dc.b nG1, $0E, nRst, $04, nAb0, $06, nRst, $12 dc.b nAb1, $0E, nRst, $04, nAb1, $06, nG1, $04 dc.b nRst, $08, nF1, $04, nRst, $08, nEb1, $06 dc.b nF1, $10, nRst, $02, nC1, $06, nRst, $12 dc.b nC2, $10, nRst, $02, nC2, $04, nRst, $02 dc.b nBb1, $04, nRst, $08, nG1, $04, nRst, $08 dc.b nF1, $04, nRst, $02, nG1, $0E, nRst, $04 dc.b nAb0, $06, nRst, $12, nAb1, $0E, nRst, $04 dc.b nAb1, $06, nG1, $04, nRst, $08, nF1, $04 dc.b nRst, $08, nEb1, $06, nF1, $10, nRst, $02 dc.b nC1, $06, nRst, $12, nC2, $10, nRst, $02 dc.b nC2, $04, nRst, $02, nBb1, $04, nRst, $08 dc.b nG1, $04, nRst, $08, nF1, $04, nRst, $02 dc.b nG1, $0E, nRst, $04, nAb0, $06, nRst, $12 dc.b nAb1, $0E, nRst, $04, nAb1, $06, nG1, $04 dc.b nRst, $08, nF1, $04, nRst, $08, nEb1, $06 dc.b nF1, $10, nRst, $02, nC1, $06, nRst, $12 dc.b nC2, $10, nRst, $02, nC2, $04, nRst, $02 dc.b nBb1, $04, nRst, $08, nG1, $04, nRst, $08 dc.b nF1, $04, nRst, $02, nG1, $0E, nRst, $04 dc.b nCs1, $06, nRst, $12, nCs2, $0E, nRst, $04 dc.b nCs2, $06, nB1, $04, nRst, $08, nAb1, $04 dc.b nRst, $08, nFs1, $06, nAb1, $10, nRst, $02 dc.b nG1, $06, nRst, $12, nG2, $10, nRst, $02 dc.b nG2, $04, nRst, $02, nF2, $04, nRst, $08 dc.b nD2, $04, nRst, $08, nC2, $04, nRst, $02 dc.b nD2, $0E, nRst, $04 sJump CompetitionMenu_Jump1 dc.b $F2 ; Unused CompetitionMenu_FM5: dc.b nRst, $03 sJump CompetitionMenu_FM2 dc.b $F2 ; Unused CompetitionMenu_FM2: sPatFM $0D ssDetune $03 ssModZ80 $0F, $01, $06, $06 dc.b nRst, $60 CompetitionMenu_Jump2: dc.b nRst, $1E, nBb4, $0A, nRst, $02, nA4, $04 dc.b nRst, $50, nA4, $0A, nRst, $02, nBb4, $04 dc.b nRst, $50, nBb4, $0A, nRst, $02, nA4, $04 dc.b nRst, $50, nA4, $0A, nRst, $02, nBb4, $04 dc.b nRst, $32 sPatFM $17 ssDetune $03 ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $04, nRst, $08, nD4, $04, nRst, $08 dc.b nC4, $0C, nBb3, $06, nC4, $1C, nRst, $08 dc.b nF3, $02, nFs3, nRst, nG3, $06, nBb3, nEb4 dc.b $04, nRst, $08, nD4, $04, nRst, $08, nC4 dc.b $06, nBb3, $12, nC4, $0C, nBb3, $06, nFs3 dc.b $02, nG3, $06, nRst, $04, nF3, nRst, $02 dc.b nG3, $06, nBb3, nEb4, $04, nRst, $08, nD4 dc.b $04, nRst, $08, nC4, $0C, nBb3, $04, nRst dc.b $02, nC4, $20, nRst, $04, nF3, nRst, $02 dc.b nG3, $06, nBb3, nEb4, $04, nRst, $08, nD4 dc.b $04, nRst, $08, nC4, $06, nBb3, $12, nC4 dc.b $0C, nBb3, $06, nG3, $08, nRst, $16, nF2 dc.b $06, nF3, nEb3, $04, nRst, $02, nC3, $06 dc.b nEb3, nF3, $04, nRst, $08, nFs3, $12, nF3 dc.b $06, nC3, nEb3, nF3, nRst, nBb3, $12, nG3 dc.b $06, nF3, $04, nRst, $02, nG3, $06, nF3 dc.b nEb3, nC3, nEb3, $04, nRst, $08, nF3, $06 dc.b nEb3, $08, nRst, $04, nF3, nRst, $02, nG3 dc.b $06, nBb3, nEb4, $04, nRst, $08, nD4, $04 dc.b nRst, $08, nC4, $0C, nBb3, $06, nC4, $0C dc.b nD4, $06, nC4, $20, nRst, $04, nF4, $0E dc.b nRst, $04, nF4, $12, nEb4, $2E, nRst, $0E dc.b nD4, nRst, $04, nD4, $12, nC4, $3C, nBb3 dc.b $0C, nRst, $06, nBb3, $12, nG3, $38, nRst dc.b $04, nF3, $0E, nRst, $04, nF3, $12, nEb3 dc.b $18, nF3, $0C, nG3, $08, nRst, $04, nBb3 dc.b $0A, nRst, $02, nEb3, $12, nD3, $04, nRst dc.b $0E, nEb3, $18 sPatFM $0E ssDetune $00 ssModZ80 $0F, $01, $06, $06 dc.b nC3, $06, nEb3, nF3, nFs3, nG3, nBb3, nC4 dc.b $0C, nBb3, $04, nRst, $02, nC4, $06, nEb4 dc.b nF4, nRst, nF4, $02, nF4, nFs4, nF4, $0C dc.b nEb4, $06, nC4, nEb4, nF4, $10, nRst, $02 dc.b nFs4, nG4, $0A, nBb4, $06, nG4, nBb4, nC5 dc.b nRst, nD5, $02, nEb5, $0A, nD5, $04, nRst dc.b $02, nC5, $06, nBb4, nC5, $0C, nBb4, $02 dc.b nG4, nF4, nEb4, nC4, nBb3 sPatFM $0E ssDetune $00 ssModZ80 $0F, $01, $06, $06 dc.b nEb5, $06, nF5, $0A, nRst, $02, nEb5, $06 dc.b nFs5, $0C, nEb5, $06, nA5, $02, nBb5, $0A dc.b nF5, $06, nEb5, nC5, nEb5, nC5, nBb4, nC5 dc.b nBb4, nG4, nBb4, nG4, nF4, nG4, nF4, nEb4 dc.b nF4, nEb4, nC4, nEb4, $12, nC4, $02, nBb3 dc.b nG3, nF3, nEb3, nC3 sPatFM $0E ssDetune $00 ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $12, nFs4, nF4, $28, nRst, $14, nFs4 dc.b $02, nG4, $10, nBb4, $12, nG4, $06, nBb4 dc.b nA4, $12, nFs4, $02, nG4, $14, nRst, $08 sPatFM $0E ssDetune $00 ssModZ80 $0F, $01, $06, $06 dc.b nBb4, $12, nEb5, $1E, nB4, $12, nE5, $1E dc.b nF5, $08, nRst, $10, nF5, $30, nRst, $06 dc.b nF3, nG3, nBb3 sJump CompetitionMenu_Jump2 dc.b $F2 ; Unused CompetitionMenu_FM3: sPatFM $18 dc.b nRst, $60 CompetitionMenu_Jump3: dc.b nF3, $04, nRst, $08, nEb3, $06, nF3, $04 dc.b nRst, $26, nG3, $04, nRst, $08, nF3, $04 dc.b nRst, $02, nG3, $12, nF3, $04, nRst, $08 dc.b nEb3, $06, nF3, $04, nRst, $26, nBb3, $04 dc.b nRst, $0E, nBb3, $0A, nRst, $08, nF3, $04 dc.b nRst, $08, nEb3, $06, nF3, $04, nRst, $26 dc.b nG3, $04, nRst, $08, nF3, $04, nRst, $02 dc.b nG3, $12, nF3, $04, nRst, $08, nEb3, $06 dc.b nF3, $04, nRst, $26, nBb3, $04, nRst, $0E dc.b nBb3, $0A, nRst, $08, nG3, $04, nRst, $14 dc.b nA3, $10, nRst, $02, nG3, $04, nRst, $3E dc.b nBb4, $04, nRst, $0E, nBb4, $04, nRst, $0E dc.b nA4, $02, nBb4, $10, nA4, $04, nRst, $1A dc.b nG3, $04, nRst, $14, nA3, $10, nRst, $02 dc.b nG3, $04, nRst, $3E, nBb4, $04, nRst, $0E dc.b nBb4, $04, nRst, $0E, nA4, $02, nBb4, $10 dc.b nA4, $04, nRst, $1A, nEb3, $04, nRst, $14 dc.b nFs3, $02, nG3, $0E, nRst, $02, nEb3, $04 dc.b nRst, $3E, nEb4, $04, nRst, $0E, nEb4, $04 dc.b nRst, $0E, nF4, $02, nFs4, $0E, nRst, $02 dc.b nEb4, $04, nRst, $1A, nG3, $04, nRst, $14 dc.b nA3, $10, nRst, $02, nG3, $04, nRst, $32 dc.b nD4, $10, nRst, $02, nD4, $04, nRst, $0E dc.b nBb3, $10, nRst, $2C, nBb3, $10, nRst, $02 dc.b nBb3, $04, nRst, $0E, nG3, $10, nRst, $02 dc.b nEb4, $04, nRst, $02, nG4, $04, nRst, $08 dc.b nF4, $04, nRst, $02, nEb4, $0E, nRst, $04 dc.b nG3, $10, nRst, $02, nG3, $04, nRst, $0E dc.b nEb3, $10, nRst, $02, nC4, $04, nRst, $02 dc.b nEb4, $04, nRst, $08, nD4, $06, nC4, $12 dc.b nD3, $10, nRst, $02, nD3, $04, nRst, $0E dc.b nC3, $10, nRst, $02, nF4, $04, nRst, $02 dc.b nBb4, $04, nRst, $08, nAb4, $04, nRst, $02 dc.b nG4, $10, nRst, $02, nBb2, $10, nRst, $02 dc.b nBb2, $04, nRst, $0E, nBb2, $10, nRst, $02 dc.b nBb3, $04, nRst, $02, nF4, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nC4, $0C, nRst, $06 dc.b nAb3, $04, nRst, $02, nAb3, $04, nRst, $02 dc.b nEb3, $04, nRst, $02, nAb3, $04, nRst, $1A dc.b nBb4, $02, nC5, $0A, nAb3, $04, nRst, $02 dc.b nAb3, $04, nRst, $02, nEb3, $04, nRst, $02 dc.b nAb3, $0A, nRst, $08, nC4, $04, nRst, $02 dc.b nC4, $04, nRst, $02, nBb3, $04, nRst, $02 dc.b nC4, $04, nRst, $1A, nEb5, $0C, nC4, $04 dc.b nRst, $02, nC4, $04, nRst, $02, nBb3, $04 dc.b nRst, $02, nC4, $0A, nRst, $08, nAb3, $04 dc.b nRst, $02, nAb3, $04, nRst, $02, nEb3, $04 dc.b nRst, $02, nAb3, $04, nRst, $1A, nF5, $02 dc.b nFs5, $0A, nAb3, $04, nRst, $02, nAb3, $04 dc.b nRst, $02, nEb3, $04, nRst, $02, nAb3, $0A dc.b nRst, $08, nC4, $04, nRst, $02, nC4, $04 dc.b nRst, $02, nBb3, $04, nRst, $02, nC4, $04 dc.b nRst, $1A, nEb5, $0C, nC4, $04, nRst, $02 dc.b nC4, $04, nRst, $02, nBb3, $04, nRst, $02 dc.b nC4, $0A, nRst, $08, nAb3, $04, nRst, $02 dc.b nAb3, $04, nRst, $02, nEb3, $04, nRst, $02 dc.b nAb3, $04, nRst, $1A, nBb4, $02, nC5, $0A dc.b nAb3, $04, nRst, $02, nAb3, $04, nRst, $02 dc.b nEb3, $04, nRst, $02, nAb3, $0A, nRst, $08 dc.b nC4, $04, nRst, $02, nC4, $04, nRst, $02 dc.b nBb3, $04, nRst, $02, nC4, $04, nRst, $1A dc.b nF5, $0C, nC4, $04, nRst, $02, nC4, $04 dc.b nRst, $02, nBb3, $04, nRst, $02, nC4, $0A dc.b nRst, $08, nAb3, $04, nRst, $02, nAb3, $04 dc.b nRst, $02, nEb3, $04, nRst, $02, nAb3, $04 dc.b nRst, $1A, nEb5, $02, nF5, $0A, nAb3, $04 dc.b nRst, $02, nAb3, $04, nRst, $02, nEb3, $04 dc.b nRst, $02, nAb3, $0A, nRst, $08, nD4, $04 dc.b nRst, $02, nD4, $04, nRst, $02, nD4, $04 dc.b nRst, $02, nD4, $04, nRst, $26, nD4, $04 dc.b nRst, $02, nD4, $04, nRst, $02, nD4, $04 dc.b nRst, $02, nD4, $04, nRst, $0E sJump CompetitionMenu_Jump3 dc.b $F2 ; Unused CompetitionMenu_FM4: sPatFM $19 dc.b nRst, $60 CompetitionMenu_Jump4: dc.b nD3, $04, nRst, $08, nC3, $06, nD3, $04 dc.b nRst, $08 sPatFM $0D ssDetune $FD ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $0A, nRst, $02, nEb4, $04, nRst, $0E sPatFM $19 dc.b nEb3, $02, nRst, $0A, nD3, $04, nRst, $02 dc.b nEb3, $12, nD3, $04, nRst, $08, nC3, $06 dc.b nD3, $04, nRst, $08 sPatFM $0D ssDetune $FD ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $0A, nRst, $02, nEb4, $04, nRst, $0E sPatFM $19 dc.b nG3, $02, nRst, $10, nG3, $0A, nRst, $08 dc.b nD3, $04, nRst, $08, nC3, $06, nD3, $04 dc.b nRst, $08 sPatFM $0D ssDetune $FD ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $0A, nRst, $02, nEb4, $04, nRst, $0E sPatFM $19 dc.b nEb3, $02, nRst, $0A, nD3, $04, nRst, $02 dc.b nEb3, $12, nD3, $04, nRst, $08, nC3, $06 dc.b nD3, $04, nRst, $08 sPatFM $0D ssDetune $FD ssModZ80 $0F, $01, $06, $06 dc.b nEb4, $0A, nRst, $02, nEb4, $04, nRst, $0E sPatFM $19 dc.b nG3, $02, nRst, $10, nG3, $0A, nRst, $08 dc.b nEb3, $04, nRst, $14, nF3, $10, nRst, $02 dc.b nEb3, $04, nRst, $3E, nG4, $04, nRst, $0E dc.b nG4, $04, nRst, $0E, nG4, $10, nRst, $02 dc.b nF4, $04, nRst, $1A, nEb3, $04, nRst, $14 dc.b nF3, $10, nRst, $02, nEb3, $04, nRst, $3E dc.b nG4, $04, nRst, $0E, nG4, $04, nRst, $0E dc.b nG4, $10, nRst, $02, nF4, $04, nRst, $1A dc.b nC3, $04, nRst, $14, nEb3, $10, nRst, $02 dc.b nC3, $04, nRst, $3E, nC4, $04, nRst, $0E dc.b nC4, $04, nRst, $0E, nEb4, $10, nRst, $02 dc.b nC4, $04, nRst, $1A, nEb3, $04, nRst, $14 dc.b nF3, $10, nRst, $02, nEb3, $04, nRst, $32 dc.b nBb3, $10, nRst, $02, nBb3, $04, nRst, $0E dc.b nG3, $10, nRst, $02, nG4, $06, nBb4, nD5 dc.b nBb4, nG4, nEb4, nBb3, nF3, $10, nRst, $02 dc.b nF3, $04, nRst, $0E, nEb3, $10, nRst, $02 dc.b nBb3, $04, nRst, $02, nEb4, $04, nRst, $08 dc.b nD4, $04, nRst, $02, nC4, $0E, nRst, $04 dc.b nEb3, $10, nRst, $02, nEb3, $04, nRst, $0E dc.b nBb2, $10, nRst, $02, nG3, $04, nRst, $02 dc.b nC4, $04, nRst, $08, nBb3, $06, nEb3, $12 dc.b nBb2, $10, nRst, $02, nBb2, $04, nRst, $0E dc.b nG2, $10, nRst, $02, nBb3, $04, nRst, $02 dc.b nD4, $04, nRst, $08, nC4, $04, nRst, $02 dc.b nEb4, $10, nRst, $02, nG2, $10, nRst, $02 dc.b nF2, $04, nRst, $0E, nG2, $10, nRst, $02 dc.b nG3, $04, nRst, $02, nD4, $04, nRst, $08 dc.b nC4, $04, nRst, $02, nEb3, $0C, nRst, $06 dc.b nEb3, $04, nRst, $02, nEb3, $04, nRst, $02 dc.b nBb2, $04, nRst, $02, nEb3, $04, nRst, $1A dc.b nFs4, $0C, nEb3, $04, nRst, $02, nEb3, $04 dc.b nRst, $02, nBb2, $04, nRst, $02, nEb3, $0A dc.b nFs3, $02, nF3, nEb3, nC3, nG3, $04, nRst dc.b $02, nG3, $04, nRst, $02, nF3, $04, nRst dc.b $02, nG3, $04, nRst, $1A, nBb4, $0C, nG3 dc.b $04, nRst, $02, nG3, $04, nRst, $02, nF3 dc.b $04, nRst, $02, nG3, $0A, nBb3, $02, nG3 dc.b nF3, nEb3, nEb3, $04, nRst, $02, nEb3, $04 dc.b nRst, $02, nBb2, $04, nRst, $02, nEb3, $04 dc.b nRst, $1A, nC5, $0C, nEb3, $04, nRst, $02 dc.b nEb3, $04, nRst, $02, nBb2, $04, nRst, $02 dc.b nEb3, $0A, nFs3, $02, nF3, nEb3, nC3, nG3 dc.b $04, nRst, $02, nG3, $04, nRst, $02, nF3 dc.b $04, nRst, $02, nG3, $04, nRst, $1A, nBb4 dc.b $0C, nG3, $04, nRst, $02, nG3, $04, nRst dc.b $02, nF3, $04, nRst, $02, nG3, $0A, nBb3 dc.b $02, nG3, nF3, nEb3, nEb3, $04, nRst, $02 dc.b nEb3, $04, nRst, $02, nBb2, $04, nRst, $02 dc.b nEb3, $04, nRst, $1A, nFs4, $0C, nEb3, $04 dc.b nRst, $02, nEb3, $04, nRst, $02, nBb2, $04 dc.b nRst, $02, nEb3, $0A, nFs3, $02, nF3, nEb3 dc.b nC3, nG3, $04, nRst, $02, nG3, $04, nRst dc.b $02, nF3, $04, nRst, $02, nG3, $04, nRst dc.b $1A, nC5, $0C, nG3, $04, nRst, $02, nG3 dc.b $04, nRst, $02, nF3, $04, nRst, $02, nG3 dc.b $0A, nBb3, $02, nG3, nF3, nEb3, nCs3, $04 dc.b nRst, $02, nCs3, $04, nRst, $02, nBb2, $04 dc.b nRst, $02, nCs3, $04, nRst, $1A, nB4, $0C dc.b nCs3, $04, nRst, $02, nCs3, $04, nRst, $02 dc.b nBb2, $04, nRst, $02, nCs3, $0A, nFs3, $02 dc.b nF3, nEb3, nC3, nG3, $04, nRst, $02, nG3 dc.b $04, nRst, $02, nG3, $04, nRst, $02, nG3 dc.b $04, nRst, $02, nB3, $24, nG3, $04, nRst dc.b $02, nG3, $04, nRst, $02, nG3, $04, nRst dc.b $02, nG3, $04, nRst, $0E sJump CompetitionMenu_Jump4 dc.b $F2 ; Unused CompetitionMenu_PSG1: dc.b nRst, $60 CompetitionMenu_Jump5: dc.b nC4, $06, nRst, nC5, nC4, nRst, $1E, nC4 dc.b $06, nRst, nC5, nC4, $0C, nC5, nC4, $06 dc.b nRst, nC5, nC4, nRst, $1E, nC4, $06, nRst dc.b nC5, nC4, $0C, nC5, nC4, $06, nRst, nC5 dc.b nC4, nRst, $1E, nC4, $06, nRst, nC5, nC4 dc.b $0C, nC5, nC4, $06, nRst, nC5, nC4, nRst dc.b $1E, nC4, $06, nRst, nC5, nC4, $0C, nC5 dc.b nC5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $02 dc.b nEb5, $04, nRst, $08, nC5, $04, nRst, $02 dc.b nD5, $04, nRst, $08, nEb5, $04, nRst, $08 dc.b nD5, $04, nRst, $08, nC5, $04, nRst, $08 dc.b nEb5, $04, nRst, $0E, nEb5, $04, nRst, $02 dc.b nD5, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nC5, $04, nRst, $02, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nC5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $02 dc.b nEb5, $04, nRst, $08, nC5, $04, nRst, $02 dc.b nD5, $04, nRst, $08, nEb5, $04, nRst, $08 dc.b nD5, $04, nRst, $08, nC5, $04, nRst, $08 dc.b nEb5, $04, nRst, $0E, nEb5, $04, nRst, $02 dc.b nD5, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nC5, $04, nRst, $02, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nC5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $02 dc.b nEb5, $04, nRst, $08, nC5, $04, nRst, $02 dc.b nD5, $04, nRst, $08, nEb5, $04, nRst, $08 dc.b nD5, $04, nRst, $08, nC5, $04, nRst, $08 dc.b nEb5, $04, nRst, $0E, nEb5, $04, nRst, $02 dc.b nD5, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nC5, $04, nRst, $02, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nC5, $04, nRst, $08, nD5, $04, nRst, $08 dc.b nEb5, $04, nRst, $08, nD5, $04, nRst, $02 dc.b nEb5, $04, nRst, $08, nC5, $04, nRst, $02 dc.b nD5, $04, nRst, $08, nEb5, $04, nRst, $08 dc.b nD5, $04, nRst, $3E, nG4, $06, nBb4, nD5 dc.b nBb4, nG4, nEb4, nBb3, nBb4, $10, nRst, $02 dc.b nBb4, $04, nRst, $0E, nG4, $10, nRst, $02 dc.b nEb5, $04, nRst, $02, nG5, $04, nRst, $08 dc.b nF5, $04, nRst, $02, nEb5, $0E, nRst, $04 dc.b nG4, $10, nRst, $02, nG4, $04, nRst, $0E dc.b nEb4, $10, nRst, $02, nC5, $04, nRst, $02 dc.b nEb5, $04, nRst, $08, nD5, $06, nC5, $12 dc.b nD4, $10, nRst, $02, nD4, $04, nRst, $0E dc.b nC4, $10, nRst, $02, nF5, $04, nRst, $02 dc.b nBb5, $04, nRst, $08, nAb5, $04, nRst, $02 dc.b nG5, $10, nRst, $02, nBb3, $10, nRst, $02 dc.b nBb3, $04, nRst, $0E, nBb3, $10, nRst, $02 dc.b nBb4, $04, nRst, $02, nF5, $04, nRst, $08 dc.b nEb5, $04, nRst, $02, nC5, $0C, nRst, $06 dc.b nEb4, $04, nRst, $08, nEb4, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb4, $04, nRst, $02 dc.b nEb5, $04, nRst, $02, nG4, $04, nRst, $08 dc.b nG4, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG4, $04, nRst, $02, nG5, $04, nRst, $02 dc.b nEb4, $04, nRst, $08, nEb4, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb4, $04, nRst, $02 dc.b nEb5, $04, nRst, $02, nG4, $04, nRst, $08 dc.b nG4, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG4, $04, nRst, $02, nG5, $04, nRst, $02 dc.b nEb4, $04, nRst, $08, nEb4, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb5, $04, nRst, $08 dc.b nEb4, $04, nRst, $02, nEb4, $04, nRst, $02 dc.b nEb5, $04, nRst, $02, nG4, $04, nRst, $08 dc.b nG4, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG4, $04, nRst, $02, nG5, $04, nRst, $02 dc.b nF4, $04, nRst, $08, nF4, $04, nRst, $08 dc.b nF4, $04, nRst, $02, nF5, $04, nRst, $08 dc.b nF4, $04, nRst, $02, nF5, $04, nRst, $08 dc.b nF4, $04, nRst, $02, nF5, $04, nRst, $08 dc.b nF4, $04, nRst, $02, nF4, $04, nRst, $02 dc.b nF5, $04, nRst, $02, nG4, $04, nRst, $08 dc.b nG4, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG5, $04, nRst, $08, nG4, $04, nRst, $02 dc.b nG4, $04, nRst, $02, nG5, $04, nRst, $02 sJump CompetitionMenu_Jump5 dc.b $F2 ; Unused CompetitionMenu_PSG2: dc.b nRst, $7F, nRst, nRst, nRst, nRst, nRst, nRst dc.b nRst, nRst, nRst, nRst, nRst, nRst, nRst, nRst dc.b nRst, nRst, nRst, nRst, $72 sJump CompetitionMenu_Jump5 dc.b $F2 ; Unused CompetitionMenu_PSG3: sVolEnvPSG v02 sNoisePSG $E7 dc.b nRst, $60 CompetitionMenu_Jump6: dc.b nBb6, $06, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, $04, nBb6, nBb6, nBb6, $06, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, $04, nBb6, nBb6 dc.b nBb6, $06, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b $04, nBb6, nBb6, nBb6, $06, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, $04, nBb6, nBb6, nBb6, $06 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, $04, nBb6 dc.b nBb6, nBb6, $06, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, $04, nBb6, nBb6, nBb6, $06, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6, nBb6 dc.b nBb6, nBb6, nBb6, nRst, $60 sJump CompetitionMenu_Jump6 dc.b $F2 ; Unused CompetitionMenu_Patches: ; Patch $00 ; $3C ; $01, $00, $00, $00, $1F, $1F, $15, $1F ; $11, $0D, $12, $05, $07, $04, $09, $02 ; $55, $3A, $25, $1A, $1A, $80, $07, $80 spAlgorithm $04 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $00, $00, $00 spRateScale $00, $00, $00, $00 spAttackRt $1F, $15, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $11, $12, $0D, $05 spSustainLv $05, $02, $03, $01 spDecayRt $07, $09, $04, $02 spReleaseRt $05, $05, $0A, $0A spTotalLv $1A, $07, $00, $00 ; Patch $01 ; $3D ; $01, $01, $01, $01, $94, $19, $19, $19 ; $0F, $0D, $0D, $0D, $07, $04, $04, $04 ; $25, $1A, $1A, $1A, $15, $80, $80, $80 spAlgorithm $05 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $01, $01, $01 spRateScale $02, $00, $00, $00 spAttackRt $14, $19, $19, $19 spAmpMod $00, $00, $00, $00 spSustainRt $0F, $0D, $0D, $0D spSustainLv $02, $01, $01, $01 spDecayRt $07, $04, $04, $04 spReleaseRt $05, $0A, $0A, $0A spTotalLv $15, $00, $00, $00 ; Patch $02 ; $03 ; $00, $D7, $33, $02, $5F, $9F, $5F, $1F ; $13, $0F, $0A, $0A, $10, $0F, $02, $09 ; $35, $15, $25, $1A, $13, $16, $15, $80 spAlgorithm $03 spFeedback $00 spDetune $00, $03, $0D, $00 spMultiple $00, $03, $07, $02 spRateScale $01, $01, $02, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $13, $0A, $0F, $0A spSustainLv $03, $02, $01, $01 spDecayRt $10, $02, $0F, $09 spReleaseRt $05, $05, $05, $0A spTotalLv $13, $15, $16, $00 ; Patch $03 ; $34 ; $70, $72, $31, $31, $1F, $1F, $1F, $1F ; $10, $06, $06, $06, $01, $06, $06, $06 ; $35, $1A, $15, $1A, $10, $80, $18, $80 spAlgorithm $04 spFeedback $06 spDetune $07, $03, $07, $03 spMultiple $00, $01, $02, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $10, $06, $06, $06 spSustainLv $03, $01, $01, $01 spDecayRt $01, $06, $06, $06 spReleaseRt $05, $05, $0A, $0A spTotalLv $10, $18, $00, $00 ; Patch $04 ; $3E ; $77, $71, $32, $31, $1F, $1F, $1F, $1F ; $0D, $06, $00, $00, $08, $06, $00, $00 ; $15, $0A, $0A, $0A, $1B, $80, $80, $80 spAlgorithm $06 spFeedback $07 spDetune $07, $03, $07, $03 spMultiple $07, $02, $01, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0D, $00, $06, $00 spSustainLv $01, $00, $00, $00 spDecayRt $08, $00, $06, $00 spReleaseRt $05, $0A, $0A, $0A spTotalLv $1B, $00, $00, $00 ; Patch $05 ; $20 ; $36, $35, $30, $31, $DF, $DF, $9F, $9F ; $07, $06, $09, $06, $07, $06, $06, $08 ; $20, $10, $10, $F8, $19, $37, $13, $80 spAlgorithm $00 spFeedback $04 spDetune $03, $03, $03, $03 spMultiple $06, $00, $05, $01 spRateScale $03, $02, $03, $02 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $07, $09, $06, $06 spSustainLv $02, $01, $01, $0F spDecayRt $07, $06, $06, $08 spReleaseRt $00, $00, $00, $08 spTotalLv $19, $13, $37, $00 ; Patch $06 ; $3A ; $01, $07, $01, $01, $8E, $8E, $8D, $53 ; $0E, $0E, $0E, $03, $00, $00, $00, $07 ; $1F, $FF, $1F, $0F, $18, $28, $27, $80 spAlgorithm $02 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $01, $07, $01 spRateScale $02, $02, $02, $01 spAttackRt $0E, $0D, $0E, $13 spAmpMod $00, $00, $00, $00 spSustainRt $0E, $0E, $0E, $03 spSustainLv $01, $01, $0F, $00 spDecayRt $00, $00, $00, $07 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $18, $27, $28, $00 ; Patch $07 ; $03 ; $00, $D7, $33, $02, $5F, $9F, $5F, $1F ; $13, $0F, $0A, $0A, $10, $0F, $02, $09 ; $35, $15, $25, $1A, $13, $16, $15, $80 spAlgorithm $03 spFeedback $00 spDetune $00, $03, $0D, $00 spMultiple $00, $03, $07, $02 spRateScale $01, $01, $02, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $13, $0A, $0F, $0A spSustainLv $03, $02, $01, $01 spDecayRt $10, $02, $0F, $09 spReleaseRt $05, $05, $05, $0A spTotalLv $13, $15, $16, $00 ; Patch $08 ; $3C ; $71, $72, $3F, $34, $8D, $52, $9F, $1F ; $09, $00, $00, $0D, $00, $00, $00, $00 ; $23, $08, $02, $F7, $15, $80, $1D, $87 spAlgorithm $04 spFeedback $07 spDetune $07, $03, $07, $03 spMultiple $01, $0F, $02, $04 spRateScale $02, $02, $01, $00 spAttackRt $0D, $1F, $12, $1F spAmpMod $00, $00, $00, $00 spSustainRt $09, $00, $00, $0D spSustainLv $02, $00, $00, $0F spDecayRt $00, $00, $00, $00 spReleaseRt $03, $02, $08, $07 spTotalLv $15, $1D, $00, $07 ; Patch $09 ; $3D ; $01, $01, $00, $00, $8E, $52, $14, $4C ; $08, $08, $0E, $03, $00, $00, $00, $00 ; $1F, $1F, $1F, $1F, $1B, $80, $80, $9B spAlgorithm $05 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $00, $01, $00 spRateScale $02, $00, $01, $01 spAttackRt $0E, $14, $12, $0C spAmpMod $00, $00, $00, $00 spSustainRt $08, $0E, $08, $03 spSustainLv $01, $01, $01, $01 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1B, $00, $00, $1B ; Patch $0A ; $3A ; $01, $01, $01, $02, $8D, $07, $07, $52 ; $09, $00, $00, $03, $01, $02, $02, $00 ; $52, $02, $02, $28, $18, $22, $18, $80 spAlgorithm $02 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $01, $01, $02 spRateScale $02, $00, $00, $01 spAttackRt $0D, $07, $07, $12 spAmpMod $00, $00, $00, $00 spSustainRt $09, $00, $00, $03 spSustainLv $05, $00, $00, $02 spDecayRt $01, $02, $02, $00 spReleaseRt $02, $02, $02, $08 spTotalLv $18, $18, $22, $00 ; Patch $0B ; $3C ; $36, $31, $76, $71, $94, $9F, $96, $9F ; $12, $00, $14, $0F, $04, $0A, $04, $0D ; $2F, $0F, $4F, $2F, $33, $80, $1A, $80 spAlgorithm $04 spFeedback $07 spDetune $03, $07, $03, $07 spMultiple $06, $06, $01, $01 spRateScale $02, $02, $02, $02 spAttackRt $14, $16, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $12, $14, $00, $0F spSustainLv $02, $04, $00, $02 spDecayRt $04, $04, $0A, $0D spReleaseRt $0F, $0F, $0F, $0F spTotalLv $33, $1A, $00, $00 ; Patch $0C ; $1C ; $7C, $37, $3E, $37, $94, $99, $94, $99 ; $08, $0A, $08, $0A, $00, $05, $00, $05 ; $3F, $4F, $3F, $4F, $2B, $80, $1B, $80 spAlgorithm $04 spFeedback $03 spDetune $07, $03, $03, $03 spMultiple $0C, $0E, $07, $07 spRateScale $02, $02, $02, $02 spAttackRt $14, $14, $19, $19 spAmpMod $00, $00, $00, $00 spSustainRt $08, $08, $0A, $0A spSustainLv $03, $03, $04, $04 spDecayRt $00, $00, $05, $05 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $2B, $1B, $00, $00 ; Patch $0D ; $3A ; $01, $07, $01, $01, $8E, $8E, $8D, $53 ; $0E, $0E, $0E, $03, $00, $00, $00, $07 ; $1F, $FF, $1F, $0F, $18, $28, $27, $80 spAlgorithm $02 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $01, $07, $01 spRateScale $02, $02, $02, $01 spAttackRt $0E, $0D, $0E, $13 spAmpMod $00, $00, $00, $00 spSustainRt $0E, $0E, $0E, $03 spSustainLv $01, $01, $0F, $00 spDecayRt $00, $00, $00, $07 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $18, $27, $28, $00 ; Patch $0E ; $3A ; $31, $25, $73, $41, $5F, $1F, $1F, $9C ; $08, $05, $04, $1E, $03, $04, $02, $06 ; $2F, $2F, $1F, $0F, $29, $27, $1F, $80 spAlgorithm $02 spFeedback $07 spDetune $03, $07, $02, $04 spMultiple $01, $03, $05, $01 spRateScale $01, $00, $00, $02 spAttackRt $1F, $1F, $1F, $1C spAmpMod $00, $00, $00, $00 spSustainRt $08, $04, $05, $1E spSustainLv $02, $01, $02, $00 spDecayRt $03, $02, $04, $06 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $29, $1F, $27, $00 ; Patch $0F ; $14 ; $71, $72, $31, $31, $0F, $0F, $0F, $0F ; $00, $0F, $00, $00, $00, $00, $00, $00 ; $0F, $AF, $0F, $0F, $32, $80, $28, $80 spAlgorithm $04 spFeedback $02 spDetune $07, $03, $07, $03 spMultiple $01, $01, $02, $01 spRateScale $00, $00, $00, $00 spAttackRt $0F, $0F, $0F, $0F spAmpMod $00, $00, $00, $00 spSustainRt $00, $00, $0F, $00 spSustainLv $00, $00, $0A, $00 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $32, $28, $00, $00 ; Patch $10 ; $14 ; $75, $72, $35, $32, $9F, $9F, $9F, $9F ; $05, $05, $00, $0A, $05, $05, $07, $05 ; $2F, $FF, $0F, $2F, $1E, $80, $14, $80 spAlgorithm $04 spFeedback $02 spDetune $07, $03, $07, $03 spMultiple $05, $05, $02, $02 spRateScale $02, $02, $02, $02 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $05, $00, $05, $0A spSustainLv $02, $00, $0F, $02 spDecayRt $05, $07, $05, $05 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1E, $14, $00, $00 ; Patch $11 ; $3D ; $01, $00, $01, $02, $12, $1F, $1F, $14 ; $07, $02, $02, $0A, $05, $05, $05, $05 ; $2F, $2F, $2F, $AF, $1C, $80, $82, $80 spAlgorithm $05 spFeedback $07 spDetune $00, $00, $00, $00 spMultiple $01, $01, $00, $02 spRateScale $00, $00, $00, $00 spAttackRt $12, $1F, $1F, $14 spAmpMod $00, $00, $00, $00 spSustainRt $07, $02, $02, $0A spSustainLv $02, $02, $02, $0A spDecayRt $05, $05, $05, $05 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1C, $02, $00, $00 ; Patch $12 ; $1C ; $73, $72, $33, $32, $94, $99, $94, $99 ; $08, $0A, $08, $0A, $00, $05, $00, $05 ; $3F, $4F, $3F, $4F, $1E, $80, $19, $80 spAlgorithm $04 spFeedback $03 spDetune $07, $03, $07, $03 spMultiple $03, $03, $02, $02 spRateScale $02, $02, $02, $02 spAttackRt $14, $14, $19, $19 spAmpMod $00, $00, $00, $00 spSustainRt $08, $08, $0A, $0A spSustainLv $03, $03, $04, $04 spDecayRt $00, $00, $05, $05 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1E, $19, $00, $00 ; Patch $13 ; $31 ; $33, $01, $00, $00, $9F, $1F, $1F, $1F ; $0D, $0A, $0A, $0A, $0A, $07, $07, $07 ; $FF, $AF, $AF, $AF, $1E, $1E, $1E, $80 spAlgorithm $01 spFeedback $06 spDetune $03, $00, $00, $00 spMultiple $03, $00, $01, $00 spRateScale $02, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0D, $0A, $0A, $0A spSustainLv $0F, $0A, $0A, $0A spDecayRt $0A, $07, $07, $07 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1E, $1E, $1E, $00 ; Patch $14 ; $3A ; $70, $76, $30, $71, $1F, $95, $1F, $1F ; $0E, $0F, $05, $0C, $07, $06, $06, $07 ; $2F, $4F, $1F, $5F, $21, $12, $28, $80 spAlgorithm $02 spFeedback $07 spDetune $07, $03, $07, $07 spMultiple $00, $00, $06, $01 spRateScale $00, $00, $02, $00 spAttackRt $1F, $1F, $15, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0E, $05, $0F, $0C spSustainLv $02, $01, $04, $05 spDecayRt $07, $06, $06, $07 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $21, $28, $12, $00 ; Patch $15 ; $28 ; $71, $00, $30, $01, $1F, $1F, $1D, $1F ; $06, $06, $06, $05, $05, $05, $02, $05 ; $4F, $4F, $2F, $3F, $1E, $28, $1E, $80 spAlgorithm $00 spFeedback $05 spDetune $07, $03, $00, $00 spMultiple $01, $00, $00, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1D, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $06, $06, $06, $05 spSustainLv $04, $02, $04, $03 spDecayRt $05, $02, $05, $05 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1E, $1E, $28, $00 ; Patch $16 ; $3E ; $38, $01, $7A, $34, $59, $D9, $5F, $9C ; $0F, $04, $0F, $0A, $02, $02, $05, $05 ; $AF, $AF, $66, $66, $28, $80, $A3, $80 spAlgorithm $06 spFeedback $07 spDetune $03, $07, $00, $03 spMultiple $08, $0A, $01, $04 spRateScale $01, $01, $03, $02 spAttackRt $19, $1F, $19, $1C spAmpMod $00, $00, $00, $00 spSustainRt $0F, $0F, $04, $0A spSustainLv $0A, $06, $0A, $06 spDecayRt $02, $05, $02, $05 spReleaseRt $0F, $06, $0F, $06 spTotalLv $28, $23, $00, $00 ; Patch $17 ; $39 ; $32, $31, $72, $71, $1F, $1F, $1F, $1F ; $00, $00, $00, $00, $00, $00, $00, $00 ; $0F, $0F, $0F, $0F, $1B, $32, $28, $80 spAlgorithm $01 spFeedback $07 spDetune $03, $07, $03, $07 spMultiple $02, $02, $01, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $00, $00, $00, $00 spSustainLv $00, $00, $00, $00 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $1B, $28, $32, $00 ; Patch $18 ; $07 ; $34, $74, $32, $71, $1F, $1F, $1F, $1F ; $0A, $0A, $05, $03, $00, $00, $00, $00 ; $3F, $3F, $2F, $2F, $8A, $8A, $80, $80 spAlgorithm $07 spFeedback $00 spDetune $03, $03, $07, $07 spMultiple $04, $02, $04, $01 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $0A, $05, $0A, $03 spSustainLv $03, $02, $03, $02 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $0A, $00, $0A, $00 ; Patch $19 ; $3A ; $31, $37, $31, $31, $8D, $8D, $8E, $53 ; $0E, $0E, $0E, $03, $00, $00, $00, $00 ; $1F, $FF, $1F, $0F, $17, $28, $26, $80 spAlgorithm $02 spFeedback $07 spDetune $03, $03, $03, $03 spMultiple $01, $01, $07, $01 spRateScale $02, $02, $02, $01 spAttackRt $0D, $0E, $0D, $13 spAmpMod $00, $00, $00, $00 spSustainRt $0E, $0E, $0E, $03 spSustainLv $01, $01, $0F, $00 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $17, $26, $28, $00 ; Patch $1A ; $3B ; $3A, $31, $71, $74, $DF, $1F, $1F, $DF ; $00, $0A, $0A, $05, $00, $05, $05, $03 ; $0F, $5F, $1F, $5F, $32, $1E, $0F, $80 spAlgorithm $03 spFeedback $07 spDetune $03, $07, $03, $07 spMultiple $0A, $01, $01, $04 spRateScale $03, $00, $00, $03 spAttackRt $1F, $1F, $1F, $1F spAmpMod $00, $00, $00, $00 spSustainRt $00, $0A, $0A, $05 spSustainLv $00, $01, $05, $05 spDecayRt $00, $05, $05, $03 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $32, $0F, $1E, $00 ; Patch $1B ; $3A ; $32, $56, $32, $42, $8D, $4F, $15, $52 ; $06, $08, $07, $04, $02, $00, $00, $00 ; $1F, $1F, $2F, $2F, $19, $20, $2A, $80 spAlgorithm $02 spFeedback $07 spDetune $03, $03, $05, $04 spMultiple $02, $02, $06, $02 spRateScale $02, $00, $01, $01 spAttackRt $0D, $15, $0F, $12 spAmpMod $00, $00, $00, $00 spSustainRt $06, $07, $08, $04 spSustainLv $01, $02, $01, $02 spDecayRt $02, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $19, $2A, $20, $00 ; Patch $1C ; $2C ; $71, $74, $32, $32, $1F, $12, $1F, $12 ; $00, $0A, $00, $0A, $00, $00, $00, $00 ; $0F, $1F, $0F, $1F, $16, $80, $17, $80 spAlgorithm $04 spFeedback $05 spDetune $07, $03, $07, $03 spMultiple $01, $02, $04, $02 spRateScale $00, $00, $00, $00 spAttackRt $1F, $1F, $12, $12 spAmpMod $00, $00, $00, $00 spSustainRt $00, $00, $0A, $0A spSustainLv $00, $00, $01, $01 spDecayRt $00, $00, $00, $00 spReleaseRt $0F, $0F, $0F, $0F spTotalLv $16, $17, $00, $00
programs/oeis/212/A212972.asm
neoneye/loda
22
2667
; A212972: Number of (w,x,y) with all terms in {0,...,n} and w<floor((x+y)/3)). ; 1,8,24,53,100,168,261,384,540,733,968,1248,1577,1960,2400,2901,3468,4104,4813,5600,6468,7421,8464,9600,10833,12168,13608,15157,16820,18600,20501,22528,24684,26973,29400,31968,34681,37544,40560,43733 add $0,2 mov $1,$0 sub $0,1 bin $1,2 mul $0,$1 mul $0,8 div $0,6
oeis/094/A094649.asm
neoneye/loda-programs
11
17431
; A094649: An accelerator sequence for Catalan's constant. ; Submitted by <NAME>(s4) ; 4,1,7,4,19,16,58,64,187,247,622,925,2110,3394,7252,12289,25147,44116,87727,157492,307294,560200,1079371,1987891,3798310,7043041,13382818,24927430,47191492,88165105,166501903,311686804,587670811,1101562312,2074699234,3892357744,7325660011,13751772463,25869337774,48580977397,91359785782,171612269962,322660334740,606196595665,1139593274179,2141250121732,4024976418199,7563343639372,14216179376326,26715007336312,50211881768347,94361201385259,177350652641350,333295485924121,626413159309306 mov $1,1 lpb $0 sub $0,1 add $2,$1 sub $3,1 sub $3,$1 add $3,1 add $1,$3 add $1,$3 add $1,$3 add $1,2 add $3,$2 lpe mov $0,$1 mul $0,3 add $0,1
programs/oeis/017/A017137.asm
karttu/loda
1
169691
; A017137: a(n) = 8*n+6. ; 6,14,22,30,38,46,54,62,70,78,86,94,102,110,118,126,134,142,150,158,166,174,182,190,198,206,214,222,230,238,246,254,262,270,278,286,294,302,310,318,326,334,342,350,358,366,374,382,390,398,406,414,422,430,438,446,454,462,470,478,486,494,502,510,518,526,534,542,550,558,566,574,582,590,598,606,614,622,630,638,646,654,662,670,678,686,694,702,710,718,726,734,742,750,758,766,774,782,790,798,806,814,822,830,838,846,854,862,870,878,886,894,902,910,918,926,934,942,950,958,966,974,982,990,998,1006,1014,1022,1030,1038,1046,1054,1062,1070,1078,1086,1094,1102,1110,1118,1126,1134,1142,1150,1158,1166,1174,1182,1190,1198,1206,1214,1222,1230,1238,1246,1254,1262,1270,1278,1286,1294,1302,1310,1318,1326,1334,1342,1350,1358,1366,1374,1382,1390,1398,1406,1414,1422,1430,1438,1446,1454,1462,1470,1478,1486,1494,1502,1510,1518,1526,1534,1542,1550,1558,1566,1574,1582,1590,1598,1606,1614,1622,1630,1638,1646,1654,1662,1670,1678,1686,1694,1702,1710,1718,1726,1734,1742,1750,1758,1766,1774,1782,1790,1798,1806,1814,1822,1830,1838,1846,1854,1862,1870,1878,1886,1894,1902,1910,1918,1926,1934,1942,1950,1958,1966,1974,1982,1990,1998 mov $1,$0 mul $1,8 add $1,6
test/Succeed/Issue1431.agda
cruhland/agda
1,989
6311
<gh_stars>1000+ postulate A : Set P : A → Set a : A T : Set → Set proj : (X : Set) → T X → X t : T (∀ {x} → P x) -- Checking target types first would prematurely solve the underscore -- with `P a` instead of the correct `∀ {x} → P x` fail : P a fail = proj _ t
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_1_326.asm
ljhsiun2/medusa
9
9064
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %rbx push %rcx lea addresses_normal_ht+0x15085, %r11 nop nop nop nop add $4601, %r15 movb $0x61, (%r11) xor $2836, %rbx pop %rcx pop %rbx pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rax push %rbp push %rbx push %rdx push %rsi // Store lea addresses_WC+0x114a5, %rax clflush (%rax) sub $21545, %rsi mov $0x5152535455565758, %rdx movq %rdx, (%rax) nop nop nop and $4914, %r12 // Store lea addresses_WT+0x1c6a5, %rsi nop add %rbx, %rbx movw $0x5152, (%rsi) inc %rbp // Store lea addresses_RW+0x1545, %rbp sub %r12, %r12 movw $0x5152, (%rbp) nop xor %r12, %r12 // Store mov $0x18d5bc00000004a5, %rdx clflush (%rdx) nop cmp %r15, %r15 movb $0x51, (%rdx) nop nop nop nop dec %r12 // Store mov $0x16af120000000025, %rsi and $31895, %rbp movb $0x51, (%rsi) nop nop dec %rbx // Store lea addresses_normal+0xc4af, %rax nop nop nop nop nop sub $52254, %rbp movl $0x51525354, (%rax) nop cmp $47320, %rbx // Store mov $0xa85, %r15 nop nop sub %r12, %r12 movb $0x51, (%r15) cmp %rax, %rax // Load lea addresses_UC+0x11e15, %r12 nop nop nop nop nop add $46708, %rbp mov (%r12), %rsi add %r12, %r12 // Store lea addresses_WT+0x98a5, %rax cmp %rbp, %rbp movl $0x51525354, (%rax) nop nop nop xor $31752, %rbx // Faulty Load mov $0x18d5bc00000004a5, %rdx nop nop nop xor $29554, %r15 vmovups (%rdx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rbp lea oracles, %rdx and $0xff, %rbp shlq $12, %rbp mov (%rdx,%rbp,1), %rbp pop %rsi pop %rdx pop %rbx pop %rbp pop %rax pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}} {'00': 1} 00 */
programs/oeis/268/A268581.asm
karttu/loda
1
179190
<reponame>karttu/loda<gh_stars>1-10 ; A268581: a(n) = 2*n^2 + 8*n + 5. ; 5,15,29,47,69,95,125,159,197,239,285,335,389,447,509,575,645,719,797,879,965,1055,1149,1247,1349,1455,1565,1679,1797,1919,2045,2175,2309,2447,2589,2735,2885,3039,3197,3359,3525,3695,3869,4047,4229,4415,4605 mov $1,$0 add $1,2 pow $1,2 mul $1,2 sub $1,3
oeis/135/A135984.asm
neoneye/loda-programs
11
883
; A135984: a(n) = 24(prime(n))+7. ; Submitted by <NAME> ; 55,79,127,175,271,319,415,463,559,703,751,895,991,1039,1135,1279,1423,1471,1615,1711,1759,1903,1999,2143,2335,2431,2479,2575,2623,2719,3055,3151,3295,3343,3583,3631,3775,3919,4015,4159,4303,4351,4591,4639,4735 mul $0,2 trn $0,1 seq $0,173919 ; Numbers that are prime or one less than a prime. mul $0,24 add $0,31
programs/oeis/176/A176805.asm
neoneye/loda
22
177969
; A176805: a(n) = 3^n + 3*n + 1. ; 2,7,16,37,94,259,748,2209,6586,19711,59080,177181,531478,1594363,4783012,14348953,43046770,129140215,387420544,1162261525,3486784462,10460353267,31381059676,94143178897,282429536554,847288609519,2541865828408,7625597485069,22876792455046,68630377364971,205891132094740,617673396284041,1853020188851938,5559060566555623,16677181699666672,50031545098999813,150094635296999230,450283905890997475,1350851717672992204,4052555153018976385,12157665459056928922,36472996377170786527,109418989131512359336,328256967394537077757,984770902183611233014,2954312706550833698779,8862938119652501096068,26588814358957503287929,79766443076872509863506,239299329230617529590231,717897987691852588770400,2153693963075557766310901,6461081889226673298932398,19383245667680019896796883,58149737003040059690390332,174449211009120179071170673,523347633027360537213511690,1570042899082081611640534735,4710128697246244834921603864,14130386091738734504764811245,42391158275216203514294433382,127173474825648610542883299787,381520424476945831628649898996,1144561273430837494885949696617,3433683820292512484657849089474,10301051460877537453973547268039,30903154382632612361920641803728,92709463147897837085761925410789,278128389443693511257285776231966,834385168331080533771857328695491,2503155504993241601315571986086060,7509466514979724803946715958257761,22528399544939174411840147874772858,67585198634817523235520443624318143,202755595904452569706561330872953992,608266787713357709119683992618861533 mov $1,3 pow $1,$0 mov $2,$0 mul $2,3 add $1,$2 add $1,1 mov $0,$1
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gsttask_h.ads
persan/A-gst
1
17021
<filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gsttask_h.ads pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with System; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; with glib; with glib.Values; with System; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h; -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttask_h is -- unsupported macro: GST_TYPE_TASK (gst_task_get_type ()) -- arg-macro: function GST_TASK (task) -- return G_TYPE_CHECK_INSTANCE_CAST ((task), GST_TYPE_TASK, GstTask); -- arg-macro: function GST_IS_TASK (task) -- return G_TYPE_CHECK_INSTANCE_TYPE ((task), GST_TYPE_TASK); -- arg-macro: function GST_TASK_CLASS (tclass) -- return G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TASK, GstTaskClass); -- arg-macro: function GST_IS_TASK_CLASS (tclass) -- return G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TASK); -- arg-macro: function GST_TASK_GET_CLASS (task) -- return G_TYPE_INSTANCE_GET_CLASS ((task), GST_TYPE_TASK, GstTaskClass); -- arg-macro: function GST_TASK_CAST (task) -- return (GstTask*)(task); -- arg-macro: function GST_TASK_STATE (task) -- return GST_TASK_CAST(task).state; -- arg-macro: function GST_TASK_GET_COND (task) -- return GST_TASK_CAST(task).cond; -- arg-macro: procedure GST_TASK_WAIT (task) -- g_cond_wait(GST_TASK_GET_COND (task), GST_OBJECT_GET_LOCK (task)) -- arg-macro: procedure GST_TASK_SIGNAL (task) -- g_cond_signal(GST_TASK_GET_COND (task)) -- arg-macro: procedure GST_TASK_BROADCAST (task) -- g_cond_broadcast(GST_TASK_GET_COND (task)) -- arg-macro: function GST_TASK_GET_LOCK (task) -- return GST_TASK_CAST(task).lock; -- GStreamer -- * Copyright (C) <1999> <NAME> <<EMAIL>> -- * <2005> <NAME> <<EMAIL>> -- * -- * gsttask.h: Streaming tasks -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- --* -- * GstTaskFunction: -- * @data: user data passed to the function -- * -- * A function that will repeatedly be called in the thread created by -- * a #GstTask. -- type GstTaskFunction is access procedure (arg1 : System.Address); pragma Convention (C, GstTaskFunction); -- gst/gsttask.h:38 -- --- standard type macros --- type GstTask; type anon_192; type anon_193 is record thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/gsttask.h:160 end record; pragma Convention (C_Pass_By_Copy, anon_193); type u_GstTask_u_gst_reserved_array is array (0 .. 2) of System.Address; type anon_192 (discr : unsigned := 0) is record case discr is when 0 => ABI : aliased anon_193; -- gst/gsttask.h:161 when others => u_gst_reserved : u_GstTask_u_gst_reserved_array; -- gst/gsttask.h:162 end case; end record; pragma Convention (C_Pass_By_Copy, anon_192); pragma Unchecked_Union (anon_192);--subtype GstTask is u_GstTask; -- gst/gsttask.h:49 type GstTaskClass; type u_GstTaskClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstTaskClass is u_GstTaskClass; -- gst/gsttask.h:50 -- skipped empty struct u_GstTaskPrivate -- skipped empty struct GstTaskPrivate --* -- * GstTaskState: -- * @GST_TASK_STARTED: the task is started and running -- * @GST_TASK_STOPPED: the task is stopped -- * @GST_TASK_PAUSED: the task is paused -- * -- * The different states a task can be in -- type GstTaskState is (GST_TASK_STARTED, GST_TASK_STOPPED, GST_TASK_PAUSED); pragma Convention (C, GstTaskState); -- gst/gsttask.h:65 --* -- * GST_TASK_STATE: -- * @task: Task to get the state of -- * -- * Get access to the state of the task. -- --* -- * GST_TASK_GET_COND: -- * @task: Task to get the cond of -- * -- * Get access to the cond of the task. -- --* -- * GST_TASK_WAIT: -- * @task: Task to wait for -- * -- * Wait for the task cond to be signalled -- --* -- * GST_TASK_SIGNAL: -- * @task: Task to signal -- * -- * Signal the task cond -- --* -- * GST_TASK_BROADCAST: -- * @task: Task to broadcast -- * -- * Send a broadcast signal to all waiting task conds -- --* -- * GST_TASK_GET_LOCK: -- * @task: Task to get the lock of -- * -- * Get access to the task lock. -- --* -- * GstTaskThreadCallbacks: -- * @enter_thread: a thread is entered, this callback is called when the new -- * thread enters its function. -- * @leave_thread: a thread is exiting, this is called when the thread is about -- * to leave its function -- * -- * Custom GstTask thread callback functions that can be installed. -- * -- * Since: 0.10.24 -- -- manage the lifetime of the thread type GstTaskThreadCallbacks_u_gst_reserved_array is array (0 .. 3) of System.Address; type GstTaskThreadCallbacks is record enter_thread : access procedure (arg1 : access GstTask; arg2 : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; arg3 : System.Address); -- gst/gsttask.h:125 leave_thread : access procedure (arg1 : access GstTask; arg2 : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; arg3 : System.Address); -- gst/gsttask.h:126 u_gst_reserved : GstTaskThreadCallbacks_u_gst_reserved_array; -- gst/gsttask.h:128 end record; pragma Convention (C_Pass_By_Copy, GstTaskThreadCallbacks); -- gst/gsttask.h:129 -- skipped anonymous struct anon_191 --< private > --* -- * GstTask: -- * @state: the state of the task -- * @cond: used to pause/resume the task -- * @lock: The lock taken when iterating the task function -- * @func: the function executed by this task -- * @data: data passed to the task function -- * @running: a flag indicating that the task is running -- * -- * The #GstTask object. -- type GstTask is record object : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; -- gst/gsttask.h:143 state : aliased GstTaskState; -- gst/gsttask.h:146 cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/gsttask.h:147 lock : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/gsttask.h:149 func : GstTaskFunction; -- gst/gsttask.h:151 data : System.Address; -- gst/gsttask.h:152 running : aliased GLIB.gboolean; -- gst/gsttask.h:154 abidata : aliased anon_192; -- gst/gsttask.h:163 priv : System.Address; -- gst/gsttask.h:165 end record; pragma Convention (C_Pass_By_Copy, GstTask); -- gst/gsttask.h:142 --< public > -- with LOCK --< private > -- thread this task is currently running in type GstTaskClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObjectClass; -- gst/gsttask.h:169 pool : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool; -- gst/gsttask.h:172 u_gst_reserved : u_GstTaskClass_u_gst_reserved_array; -- gst/gsttask.h:175 end record; pragma Convention (C_Pass_By_Copy, GstTaskClass); -- gst/gsttask.h:168 --< private > --< private > procedure gst_task_cleanup_all; -- gst/gsttask.h:178 pragma Import (C, gst_task_cleanup_all, "gst_task_cleanup_all"); function gst_task_get_type return GLIB.GType; -- gst/gsttask.h:180 pragma Import (C, gst_task_get_type, "gst_task_get_type"); function gst_task_create (func : GstTaskFunction; data : System.Address) return access GstTask; -- gst/gsttask.h:182 pragma Import (C, gst_task_create, "gst_task_create"); procedure gst_task_set_lock (c_task : access GstTask; mutex : access GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex); -- gst/gsttask.h:183 pragma Import (C, gst_task_set_lock, "gst_task_set_lock"); procedure gst_task_set_priority (c_task : access GstTask; priority : GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GThreadPriority); -- gst/gsttask.h:184 pragma Import (C, gst_task_set_priority, "gst_task_set_priority"); function gst_task_get_pool (c_task : access GstTask) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool; -- gst/gsttask.h:186 pragma Import (C, gst_task_get_pool, "gst_task_get_pool"); procedure gst_task_set_pool (c_task : access GstTask; pool : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaskpool_h.GstTaskPool); -- gst/gsttask.h:187 pragma Import (C, gst_task_set_pool, "gst_task_set_pool"); procedure gst_task_set_thread_callbacks (c_task : access GstTask; callbacks : access GstTaskThreadCallbacks; user_data : System.Address; notify : GStreamer.GST_Low_Level.glib_2_0_glib_gtypes_h.GDestroyNotify); -- gst/gsttask.h:189 pragma Import (C, gst_task_set_thread_callbacks, "gst_task_set_thread_callbacks"); function gst_task_get_state (c_task : access GstTask) return GstTaskState; -- gst/gsttask.h:194 pragma Import (C, gst_task_get_state, "gst_task_get_state"); function gst_task_set_state (c_task : access GstTask; state : GstTaskState) return GLIB.gboolean; -- gst/gsttask.h:195 pragma Import (C, gst_task_set_state, "gst_task_set_state"); function gst_task_start (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:197 pragma Import (C, gst_task_start, "gst_task_start"); function gst_task_stop (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:198 pragma Import (C, gst_task_stop, "gst_task_stop"); function gst_task_pause (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:199 pragma Import (C, gst_task_pause, "gst_task_pause"); function gst_task_join (c_task : access GstTask) return GLIB.gboolean; -- gst/gsttask.h:201 pragma Import (C, gst_task_join, "gst_task_join"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttask_h;
Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i7-7700_9_0x48.log_21829_735.asm
ljhsiun2/medusa
9
179357
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1435, %rsi nop nop xor $13419, %r11 mov (%rsi), %r12 nop nop nop nop nop cmp $24094, %r13 lea addresses_normal_ht+0x16335, %rsi lea addresses_normal_ht+0xaab8, %rdi nop nop cmp %rax, %rax mov $124, %rcx rep movsb xor %r12, %r12 lea addresses_UC_ht+0x25b5, %rcx nop sub %r13, %r13 mov $0x6162636465666768, %rdi movq %rdi, (%rcx) nop nop nop nop add $34854, %r12 lea addresses_normal_ht+0x1925, %r11 nop inc %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm0 movups %xmm0, (%r11) xor %rcx, %rcx lea addresses_WT_ht+0xc935, %rax nop nop nop nop nop sub $10266, %r11 movl $0x61626364, (%rax) dec %rdi lea addresses_WT_ht+0x80b5, %rsi lea addresses_UC_ht+0x178d5, %rdi clflush (%rsi) clflush (%rdi) nop nop add $22518, %r11 mov $68, %rcx rep movsb nop nop nop nop nop cmp %rdi, %rdi lea addresses_D_ht+0x20b5, %rsi lea addresses_D_ht+0x9cf5, %rdi nop nop sub $6527, %rbx mov $65, %rcx rep movsw nop nop nop dec %r13 lea addresses_A_ht+0x11cb5, %rcx nop nop nop xor $17238, %rax mov $0x6162636465666768, %r12 movq %r12, %xmm2 movups %xmm2, (%rcx) nop nop nop nop nop xor %rcx, %rcx lea addresses_WC_ht+0xc5d5, %rcx xor %rdi, %rdi movw $0x6162, (%rcx) nop nop nop nop nop cmp $49170, %rbx lea addresses_WT_ht+0x12d55, %rsi lea addresses_A_ht+0x1e8ab, %rdi nop nop nop xor %rax, %rax mov $7, %rcx rep movsq xor $541, %rax lea addresses_WT_ht+0x1a8b5, %rsi lea addresses_normal_ht+0x64b5, %rdi nop nop nop nop nop and $40991, %rbx mov $94, %rcx rep movsw nop nop nop cmp $12295, %r12 lea addresses_UC_ht+0xe4b5, %rdi cmp %rcx, %rcx movups (%rdi), %xmm6 vpextrq $1, %xmm6, %r12 nop nop nop nop nop add $2052, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r15 push %r8 push %rdi // Store lea addresses_UC+0x5c35, %r13 nop nop nop cmp $53789, %rdi movl $0x51525354, (%r13) nop nop sub $65477, %r14 // Load lea addresses_RW+0xde25, %r11 clflush (%r11) sub %r8, %r8 movb (%r11), %r10b nop nop nop nop nop xor %r13, %r13 // Store lea addresses_UC+0x1dbec, %r10 nop nop nop nop nop cmp %r13, %r13 movb $0x51, (%r10) nop nop dec %r10 // Store lea addresses_normal+0x4705, %r8 nop and %r11, %r11 movw $0x5152, (%r8) nop nop nop add $45439, %r13 // Store lea addresses_WC+0x20bd, %r11 nop nop nop nop nop xor $46583, %r15 movl $0x51525354, (%r11) nop nop dec %r11 // Store lea addresses_UC+0x12cb5, %r15 cmp %rdi, %rdi mov $0x5152535455565758, %r11 movq %r11, %xmm2 vmovups %ymm2, (%r15) nop nop nop nop dec %r8 // Faulty Load mov $0x5945170000000cb5, %r14 nop inc %r15 mov (%r14), %edi lea oracles, %r13 and $0xff, %rdi shlq $12, %rdi mov (%r13,%rdi,1), %rdi pop %rdi pop %r8 pop %r15 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': True, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'2a': 2, 'ae': 1, '3c': 2, '4e': 1, '94': 1, '44': 2, '82': 1, '92': 1, '06': 1, '02': 2, '6a': 1, '66': 1, 'a8': 4, 'e4': 1, 'e8': 3, '8e': 1, '1e': 1, '04': 2, 'e0': 1, '4c': 1, '64': 1, 'f6': 2, 'ca': 1, 'f0': 1, 'f4': 3, '6c': 3, '80': 2, '50': 2, '00': 249, '38': 1, 'd2': 2, '9c': 2, '8a': 1, 'da': 1, '48': 1, '2c': 1, 'b2': 2, '14': 1, '88': 2, 'be': 2, '5c': 2, 'c4': 1, '28': 1, 'bc': 1, '12': 1, '3a': 1, '20': 2, 'e2': 2, '72': 1, '36': 1, 'b4': 3, '40': 2, 'a6': 1, 'fa': 2, '6e': 1, 'fc': 1, 'c2': 2, '30': 3, 'ec': 3, '54': 2, '68': 1, '58': 21443, 'd0': 1, '98': 1, '22': 2, '32': 1, 'b6': 1, 'a2': 1, 'b0': 2, 'f2': 1, '78': 1, 'd4': 1, 'd6': 1, '18': 4, '0e': 1, '62': 1, 'a4': 1, '0c': 1, '56': 2, '7e': 3, 'c8': 3, '26': 3, '90': 3, '46': 1, '96': 1, '34': 1, '76': 1, '10': 1, 'fe': 1, '1c': 1} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 36 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 18 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 02 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 30 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 50 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 c2 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 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/flac-crc.adb
HeisenbugLtd/flac-ada
5
19075
------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); package body Flac.CRC with SPARK_Mode => On, Refined_State => (Constant_State => (CRC_8_Table, CRC_16_Table)) is CRC_8_Table : array (Ada.Streams.Stream_Element) of Checksum_8 with Constant_After_Elaboration => True; CRC_16_Table : array (Ada.Streams.Stream_Element) of Checksum_16 with Constant_After_Elaboration => True; --------------------------------------------------------------------------- -- CRC8 --------------------------------------------------------------------------- procedure CRC8 (CRC : in out Checksum_8; Data : in Ada.Streams.Stream_Element_Array) is use type Ada.Streams.Stream_Element; begin for Byte of Data loop CRC := CRC_8_Table (Ada.Streams.Stream_Element (CRC) xor Byte); end loop; end CRC8; --------------------------------------------------------------------------- -- CRC16 --------------------------------------------------------------------------- procedure CRC16 (CRC : in out Checksum_16; Data : in Ada.Streams.Stream_Element_Array) is use type Ada.Streams.Stream_Element; begin for Byte of Data loop CRC := CRC_16_Table (Ada.Streams.Stream_Element (CRC and 16#00FF#) xor Byte); end loop; end CRC16; begin for Byte in CRC_8_Table'Range loop declare CRC : Checksum_8 := Checksum_8 (Byte); begin for Bit in 0 .. 7 loop if (CRC and 2#1000_0000#) /= 0 then CRC := Shift_Left (Value => CRC, Amount => 1) xor 16#07#; else CRC := Shift_Left (Value => CRC, Amount => 1); end if; end loop; CRC_8_Table (Byte) := CRC; end; end loop; for Byte in CRC_16_Table'Range loop declare CRC : Checksum_16 := Checksum_16 (Byte); begin for Bit in 0 .. 15 loop if (CRC and 2#1000_0000_0000_0000#) /= 0 then CRC := Shift_Left (Value => CRC, Amount => 1) xor 2#1000_0000_0000_0101#; else CRC := Shift_Left (Value => CRC, Amount => 1); end if; end loop; CRC_16_Table (Byte) := CRC; end; end loop; end Flac.CRC;
oeis/140/A140529.asm
neoneye/loda-programs
11
94768
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A140529: a(n) = 6*4^n - 1. ; 5,23,95,383,1535,6143,24575,98303,393215,1572863,6291455,25165823,100663295,402653183,1610612735,6442450943,25769803775,103079215103,412316860415,1649267441663,6597069766655,26388279066623,105553116266495,422212465065983,1688849860263935,6755399441055743,27021597764222975,108086391056891903,432345564227567615,1729382256910270463,6917529027641081855,27670116110564327423,110680464442257309695,442721857769029238783,1770887431076116955135,7083549724304467820543,28334198897217871282175 mov $1,4 pow $1,$0 mul $1,6 sub $1,1 mov $0,$1
Scripts Pack Source Items/Scripts Pack/Finder/Finder Animations.applescript
Phorofor/ScriptsPack.macOS
1
1164
<reponame>Phorofor/ScriptsPack.macOS # Scripts Pack - Tweak various preference variables in macOS # <Phorofor, https://github.com/Phorofor/> -- Finder Animations -- Preference Identifier: com.apple.Finder -- Preference Keys: DisableAllAnimations -- Preference location: ~/Library/Preferences/com.apple.finder.plist -- Default value (string): NO set toggleBut to "Disable Animations" set sTz to "YES" set tZ to "disable" set bT to "You've decided to disable the Finder's animations." try set prValue to do shell script "defaults read com.apple.finder DisableAllAnimations" if prValue = "YES" then set prValue to "The Finder animations is enabled." set toggleBut to "Enable Animations" set tZ to "enable" set sTz to "NO" set bT to "You've decided to enable the Finder's animations." else set prValue to "The Finder animations is enabled." end if on error set prValue to "The Finder animations are enabled by default." end try display alert "Would you like to " & tZ & " the Finder's animations?" message "Disabling the animations for Finder is helpful for slower computers. It will disable most of the animations for Finder. Animations such as the snap to grid one, will not disable it." & return & return & prValue buttons {"Cancel", "Clear", toggleBut} default button 3 cancel button 1 if the button returned of the result is toggleBut then do shell script "defaults write com.apple.finder DisableAllAnimations -bool " & sTz else do shell script "defaults delete com.apple.finder DisableAllAnimations" end if tell application "System Events" to (name of every process) if the result contains "Finder" then tell application "Finder" display alert "Finder - Restart to see changes" message bT & " In order to see your changes, the Finder needs to be restarted. Would you like to do that now?" buttons ["Restart Later", "Restart Finder"] cancel button 1 end tell do shell script "killall Finder" else display alert "Finder - Your changes have been saved" message bT & " The next time you open Finder, you'll be able to see the changes you've made." buttons ["Cancel", "Open Finder"] cancel button 1 default button 2 tell application "Finder" to run end if
programs/oeis/093/A093149.asm
neoneye/loda
22
3351
<reponame>neoneye/loda ; A093149: a(1) = 4; a(n) = (n^(n+1)+2*n-3)/(n-1) for n > 1. ; 4,9,42,343,3908,55989,960802,19173963,435848052,11111111113,313842837674,9726655034463,328114698808276,11966776581370173,469172025408063618,19676527011956855059,878942778254232811940,41660902667961039785745,2088331858752553232964202 add $0,1 mov $2,$0 lpb $0 sub $0,1 add $1,2 mul $1,$2 lpe div $1,2 add $1,3 mov $0,$1
libsrc/input/spectrum/in_GetKey.asm
andydansby/z88dk-mk2
1
177958
<filename>libsrc/input/spectrum/in_GetKey.asm ; uint in_GetKey(void) ; 09.2005 aralbrec ; Scans the keyboard and returns an ascii code representing a ; single keypress. Operates as a state machine. First ; it debounces a key by ignoring it until a minimum time ; "_in_KeyDebounce" (byte) has passed. The key will be registered ; and then it will wait until the key has been pressed for a period ; "_in_KeyStartRepeat" (byte). The key will again be registered and ; then repeated thereafter with period "_in_KeyRepeatPeriod" (byte). ; If more than one key is pressed, no key is registered and the ; state machine returns to the debounce state. Time intervals ; depend on how often GetKey is called. XLIB in_GetKey LIB in_Inkey, in_GetKeyReset XREF _in_KeyDebounce, _in_KeyStartRepeat, _in_KeyRepeatPeriod XREF _in_KbdState ; exit : carry = no key registered (and HL=0) ; else HL = ascii code of key pressed ; uses : AF,BC,DE,HL .in_GetKey call in_Inkey ; hl = ascii code & carry if no key jp c, in_GetKeyReset ld a,(_in_KbdState) dec a jr nz, nokey ld a,(_in_KbdState + 1) dec a jp m, debounce jp z, startrepeat .repeat ld a,(_in_KeyRepeatPeriod) ld (_in_KbdState),a ret .debounce ld a,(_in_KeyStartRepeat) ld e,a ld d,1 ld (_in_KbdState),de ret .startrepeat ld a,(_in_KeyRepeatPeriod) ld e,a ld d,2 ld (_in_KbdState),de ret .nokey ld (_in_KbdState),a ld hl,0 scf ret
alloy4fun_models/trainstlt/models/5/Ej2yvyaxQvK2tkNYB.als
Kaixi26/org.alloytools.alloy
0
3417
<gh_stars>0 open main pred idEj2yvyaxQvK2tkNYB_prop6 { all s : Signal | always s != s' } pred __repair { idEj2yvyaxQvK2tkNYB_prop6 } check __repair { idEj2yvyaxQvK2tkNYB_prop6 <=> prop6o }
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt9_pkg.ads
best08618/asylo
7
768
package Opt9_Pkg is N : integer := 15; end Opt9_Pkg;
src/ada/src/uxas-comms-lmcp_object_message_sender_pipes.adb
pat-rogers/OpenUxAS
0
6241
<gh_stars>0 -- see OpenUxAS\src\Communications\LmcpObjectMessageSenderPipe.cpp with UxAS.Comms.Transport.ZeroMQ_Socket_Configurations; with UxAS.Common.String_Constant.Lmcp_Network_Socket_Address; use UxAS.Common.String_Constant.Lmcp_Network_Socket_Address; with UxAS.Common.String_Constant.Content_Type; with UxAS.Comms.Transport.Network_Name; with AVTAS.LMCP.Factory; with AVTAS.LMCP.ByteBuffers; use AVTAS.LMCP.ByteBuffers; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package body UxAS.Comms.LMCP_Object_Message_Sender_Pipes is ------------------------ -- Initialize_Publish -- ------------------------ procedure Initialize_Publish (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32) is begin -- initializeZmqSocket(sourceGroup, entityId, serviceId, ZMQ_PUB, -- uxas::common::LmcpNetworkSocketAddress::strGetInProc_FromMessageHub(), true); This.Initialize_Zmq_Socket (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, Zmq_SocketType => ZMQ.Sockets.PUB, Socket_Address => To_String (InProc_From_MessageHub), Is_Server => True); end Initialize_Publish; ------------------------------ -- Initialize_External_Push -- ------------------------------ procedure Initialize_External_Push (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32; External_Socket_Address : String; Is_Server : Boolean) is begin -- initializeZmqSocket(sourceGroup, entityId, serviceId, ZMQ_PUSH, externalSocketAddress, isServer); This.Initialize_Zmq_Socket (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, Zmq_SocketType => ZMQ.Sockets.PUSH, Socket_Address => External_Socket_Address, Is_Server => Is_Server); end Initialize_External_Push; ----------------------------- -- Initialize_External_Pub -- ----------------------------- procedure Initialize_External_Pub (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32; External_Socket_Address : String; Is_Server : Boolean) is begin -- initializeZmqSocket(sourceGroup, entityId, serviceId, ZMQ_PUB, externalSocketAddress, isServer); This.Initialize_Zmq_Socket (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, Zmq_SocketType => ZMQ.Sockets.PUB, Socket_Address => External_Socket_Address, Is_Server => Is_Server); end Initialize_External_Pub; --------------------- -- Initialize_Push -- --------------------- procedure Initialize_Push (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32) is begin -- initializeZmqSocket(sourceGroup, entityId, serviceId, ZMQ_PUSH, -- uxas::common::LmcpNetworkSocketAddress::strGetInProc_ToMessageHub(), false); This.Initialize_Zmq_Socket (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, Zmq_SocketType => ZMQ.Sockets.PUSH, Socket_Address => To_String (InProc_To_MessageHub), Is_Server => False); end Initialize_Push; ----------------------- -- Initialize_Stream -- ----------------------- procedure Initialize_Stream (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32; Socket_Address : String; Is_Server : Boolean) is begin -- initializeZmqSocket(sourceGroup, entityId, serviceId, ZMQ_STREAM, socketAddress, isServer); This.Initialize_Zmq_Socket (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, Zmq_SocketType => ZMQ.Sockets.STREAM, Socket_Address => Socket_Address, Is_Server => Is_Server); end Initialize_Stream; ---------------------------- -- Send_Broadcast_Message -- ---------------------------- procedure Send_Broadcast_Message (This : in out LMCP_Object_Message_Sender_Pipe; Message : AVTAS.LMCP.Object.Object_Any) is begin -- std::string fullLmcpObjectTypeName = lmcpObject->getFullLmcpTypeName(); -- sendLimitedCastMessage(fullLmcpObjectTypeName, std::move(lmcpObject)); This.Send_LimitedCast_Message (Message.getFullLmcpTypeName, Message); end Send_Broadcast_Message; ------------------------------ -- Send_LimitedCast_Message -- ------------------------------ -- void -- sendLimitedCastMessage(const std::string& castAddress, std::unique_ptr<avtas::lmcp::Object> lmcpObject); procedure Send_LimitedCast_Message (This : in out LMCP_Object_Message_Sender_Pipe; Cast_Address : String; Message : AVTAS.LMCP.Object.Object_Any) is -- avtas::lmcp::ByteBuffer* lmcpByteBuffer = avtas::lmcp::Factory::packMessage(lmcpObject.get(), true); Buffer : constant ByteBuffer := AVTAS.LMCP.Factory.PackMessage (Message, EnableChecksum => True); -- std::string serializedPayload = std::string(reinterpret_cast<char*>(lmcpByteBuffer->array()), lmcpByteBuffer->capacity()); Payload : constant String := Buffer.Raw_Bytes; begin -- m_transportSender->sendMessage -- (castAddress, -- uxas::common::ContentType::lmcp(), -- lmcpObject->getFullLmcpTypeName(), -- std::move(serializedPayload)); This.Sender.Send_Message (Address => Cast_Address, Content_Type => UxAS.Common.String_Constant.Content_Type.Lmcp, Descriptor => Message.getFullLmcpTypeName, Payload => Payload); end Send_LimitedCast_Message; ----------------------------- -- Send_Serialized_Message -- ----------------------------- procedure Send_Serialized_Message (This : in out LMCP_Object_Message_Sender_Pipe; Message : Addressed_Attributed_Message_Ref) is begin -- m_transportSender->sendAddressedAttributedMessage(std::move(serializedLmcpObject)); This.Sender.Send_Addressed_Attributed_Message (Message); end Send_Serialized_Message; ----------------------------------- -- Send_Shared_Broadcast_Message -- ----------------------------------- procedure Send_Shared_Broadcast_Message (This : in out LMCP_Object_Message_Sender_Pipe; Message : AVTAS.LMCP.Object.Object_Any) is begin -- sendSharedLimitedCastMessage(lmcpObject->getFullLmcpTypeName(), lmcpObject); This.Send_Shared_LimitedCast_Message (Message.getFullLmcpTypeName, Message); end Send_Shared_Broadcast_Message; ------------------------------------- -- Send_Shared_LimitedCast_Message -- ------------------------------------- procedure Send_Shared_LimitedCast_Message (This : in out LMCP_Object_Message_Sender_Pipe; Cast_Address : String; Message : AVTAS.LMCP.Object.Object_Any) is -- avtas::lmcp::ByteBuffer* lmcpByteBuffer = avtas::lmcp::Factory::packMessage(lmcpObject.get(), true); Buffer : constant ByteBuffer := AVTAS.LMCP.Factory.PackMessage (Message, EnableChecksum => True); -- std::string serializedPayload = std::string(reinterpret_cast<char*>(lmcpByteBuffer->array()), lmcpByteBuffer->capacity()); Payload : constant String := Buffer.Raw_Bytes; begin -- Note: this body is identical to the body of Send_LimitedCast_Message, per the C++ implementation -- TODO: see why -- m_transportSender->sendMessage -- (castAddress, -- uxas::common::ContentType::lmcp(), -- lmcpObject->getFullLmcpTypeName(), -- std::move(serializedPayload)); This.Sender.Send_Message (Address => Cast_Address, Content_Type => UxAS.Common.String_Constant.Content_Type.Lmcp, Descriptor => Message.getFullLmcpTypeName, Payload => Payload); end Send_Shared_LimitedCast_Message; --------------- -- Entity_Id -- --------------- function Entity_Id (This : LMCP_Object_Message_Sender_Pipe) return UInt32 is (This.Entity_Id); ---------------- -- Service_Id -- ---------------- function Service_Id (This : LMCP_Object_Message_Sender_Pipe) return UInt32 is (This.Service_Id); ------------------- -- Set_Entity_Id -- ------------------- procedure Set_Entity_Id (This : in out LMCP_Object_Message_Sender_Pipe; Value : UInt32) is begin This.Entity_Id := Value; end Set_Entity_Id; -------------------- -- Set_Service_Id -- -------------------- procedure Set_Service_Id (This : in out LMCP_Object_Message_Sender_Pipe; Value : UInt32) is begin This.Service_Id := Value; end Set_Service_Id; --------------------------- -- Initialize_Zmq_Socket -- --------------------------- procedure Initialize_Zmq_Socket (This : in out LMCP_Object_Message_Sender_Pipe; Source_Group : String; Entity_Id : UInt32; Service_Id : UInt32; Zmq_SocketType : ZMQ.Sockets.Socket_Type; Socket_Address : String; Is_Server : Boolean) is use UxAS.Comms.Transport.ZeroMQ_Socket_Configurations; -- int32_t zmqhighWaterMark{100000}; Zmq_High_Water_Mark : constant := 100_000; zmqLmcpNetworkSendSocket : ZeroMq_Socket_Configuration; begin -- m_entityId = entityId; -- m_serviceId = serviceId; This.Entity_Id := Entity_Id; This.Service_Id := Service_Id; -- uxas::communications::transport::ZeroMqSocketConfiguration -- zmqLmcpNetworkSendSocket(uxas::communications::transport::NETWORK_NAME::zmqLmcpNetwork(), -- socketAddress, -- zmqSocketType, -- isServer, -- false, -- zmqhighWaterMark, -- zmqhighWaterMark); ZmqLmcpNetworkSendSocket := Make (Network_Name => UxAS.Comms.Transport.Network_Name.ZmqLmcpNetwork, Socket_Address => Socket_Address, Is_Receive => False, Zmq_Socket_Type => Zmq_SocketType, Number_of_IO_Threads => 1, Is_Server_Bind => Is_Server, Receive_High_Water_Mark => Zmq_High_Water_Mark, Send_High_Water_Mark => Zmq_High_Water_Mark); -- m_transportSender = uxas::stduxas::make_unique<uxas::communications::transport::ZeroMqAddressedAttributedMessageSender>( -- (zmqSocketType == ZMQ_STREAM ? true : false)); This.Sender := new ZeroMq_Addressed_Attributed_Message_Sender (Zmq_SocketType); -- we just pass the actual socket type and let the sender do the test -- m_transportSender->initialize(sourceGroup, m_entityId, m_serviceId, zmqLmcpNetworkSendSocket); This.Sender.Initialize (Source_Group => Source_Group, Entity_Id => Entity_Id, Service_Id => Service_Id, SocketConfig => zmqLmcpNetworkSendSocket); end Initialize_Zmq_Socket; end UxAS.Comms.LMCP_Object_Message_Sender_Pipes;
oeis/187/A187327.asm
neoneye/loda-programs
11
92739
<gh_stars>10-100 ; A187327: Floor(n/5)+floor(2n/5)+floor(3n/5). ; Submitted by <NAME>(s3) ; 0,0,1,2,3,6,6,7,8,9,12,12,13,14,15,18,18,19,20,21,24,24,25,26,27,30,30,31,32,33,36,36,37,38,39,42,42,43,44,45,48,48,49,50,51,54,54,55,56,57,60,60,61,62,63,66,66,67,68,69,72,72,73,74,75,78,78,79,80,81,84,84,85,86,87,90,90,91,92,93,96,96,97,98,99,102,102,103,104,105,108,108,109,110,111,114,114,115,116,117 add $0,20639 mov $1,$0 mov $2,$0 add $0,1 div $0,5 div $1,$0 sub $2,$1 add $0,$2 sub $0,24763
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca.log_21318_1406.asm
ljhsiun2/medusa
9
99242
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r15 push %r8 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1de7, %r8 nop nop nop nop nop inc %r11 mov (%r8), %r9d nop nop nop nop add %r10, %r10 lea addresses_A_ht+0x1e45f, %rcx nop sub %r15, %r15 movb (%rcx), %bl nop xor %rcx, %rcx lea addresses_D_ht+0x1745f, %r11 nop nop cmp $13931, %rbx and $0xffffffffffffffc0, %r11 vmovaps (%r11), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %r9 nop add $28333, %r11 lea addresses_normal_ht+0x18e1f, %rsi lea addresses_normal_ht+0x1a15f, %rdi dec %r11 mov $27, %rcx rep movsq nop nop inc %rcx lea addresses_D_ht+0x7c5f, %rsi lea addresses_WT_ht+0x3a5f, %rdi clflush (%rdi) nop xor %rbx, %rbx mov $77, %rcx rep movsl nop nop sub $15083, %rcx lea addresses_D_ht+0xfbb7, %rsi lea addresses_normal_ht+0x1c5f, %rdi nop nop nop add %r10, %r10 mov $63, %rcx rep movsq nop nop nop nop xor %r10, %r10 lea addresses_WT_ht+0x13def, %rsi lea addresses_WC_ht+0x14e5f, %rdi nop nop nop nop and %r8, %r8 mov $102, %rcx rep movsq nop nop nop nop nop add $57960, %rdi lea addresses_UC_ht+0x31df, %rsi nop nop sub $45564, %r8 mov (%rsi), %bx nop add %r9, %r9 lea addresses_A_ht+0x1284b, %r10 cmp $24414, %rbx mov (%r10), %cx nop nop nop nop cmp %rsi, %rsi lea addresses_normal_ht+0x1a45f, %rcx nop nop nop nop nop and %r8, %r8 mov $0x6162636465666768, %rbx movq %rbx, %xmm3 movups %xmm3, (%rcx) nop nop nop nop nop and %r8, %r8 lea addresses_A_ht+0x1b135, %rcx nop nop nop nop inc %rdi mov $0x6162636465666768, %r11 movq %r11, %xmm3 vmovups %ymm3, (%rcx) nop nop add %r9, %r9 lea addresses_WC_ht+0x3e5f, %rdi nop nop nop nop sub %r11, %r11 mov $0x6162636465666768, %r10 movq %r10, %xmm2 and $0xffffffffffffffc0, %rdi movntdq %xmm2, (%rdi) sub %r15, %r15 lea addresses_WC_ht+0x18a11, %rcx and %r11, %r11 movb $0x61, (%rcx) nop cmp $36135, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r15 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r15 push %r8 push %rbx // Store lea addresses_A+0xde27, %r10 nop nop nop add $7134, %r15 mov $0x5152535455565758, %r13 movq %r13, %xmm6 vmovaps %ymm6, (%r10) nop nop cmp $40258, %r11 // Store lea addresses_WT+0x6c5f, %r15 inc %rbx movl $0x51525354, (%r15) nop nop nop nop add %r13, %r13 // Store lea addresses_D+0x1345f, %r15 nop nop nop nop nop add %r12, %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm3 vmovaps %ymm3, (%r15) nop dec %r12 // Load lea addresses_WT+0x6c5f, %r11 dec %r12 mov (%r11), %r10w nop nop nop nop and $9618, %r11 // Load lea addresses_WT+0x885f, %r10 and $30174, %r12 mov (%r10), %r15 nop add %r12, %r12 // Load lea addresses_PSE+0x19c48, %r8 nop nop nop and $34084, %r13 movups (%r8), %xmm3 vpextrq $0, %xmm3, %r10 nop nop nop sub %r10, %r10 // Store lea addresses_A+0x19f, %r12 add %r10, %r10 mov $0x5152535455565758, %r15 movq %r15, %xmm6 movups %xmm6, (%r12) nop cmp $27422, %rbx // Store lea addresses_WT+0x929f, %r15 sub %rbx, %rbx movw $0x5152, (%r15) nop nop nop nop dec %rbx // Faulty Load lea addresses_WT+0x6c5f, %r8 nop nop and %r13, %r13 mov (%r8), %r10d lea oracles, %r8 and $0xff, %r10 shlq $12, %r10 mov (%r8,%r10,1), %r10 pop %rbx pop %r8 pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_WT'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': True, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_D'}} {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'src': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}} {'54': 21318} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
TotalParserCombinators/Simplification.agda
nad/parser-combinators
1
2746
------------------------------------------------------------------------ -- Simplification of parsers ------------------------------------------------------------------------ module TotalParserCombinators.Simplification where open import Algebra open import Codata.Musical.Notation open import Data.List using (List; []) import Data.List.Relation.Binary.BagAndSetEquality as BSEq open import Data.Maybe using (Maybe); open Data.Maybe.Maybe open import Data.Nat open import Data.Product open import Data.Vec.Recursive hiding ([]) open import Function open import Relation.Binary.PropositionalEquality as P using (_≡_; refl; [_]) open import Relation.Binary.HeterogeneousEquality using (refl) renaming (_≅_ to _≅H_) private module BSMonoid {k} {A : Set} = CommutativeMonoid (BSEq.commutativeMonoid k A) open import TotalParserCombinators.Congruence hiding (return; fail; token) renaming (_∣_ to _∣′_) import TotalParserCombinators.Congruence.Sound as C import TotalParserCombinators.InitialBag as I open import TotalParserCombinators.Laws open import TotalParserCombinators.Parser ------------------------------------------------------------------------ -- Simplification of a single "layer" -- The result type used for single-layer simplification. record Simplify₁ {Tok R xs} (p : Parser Tok R xs) : Set₁ where constructor result field {bag} : List R parser : Parser Tok R bag correct : p ≅P parser -- The function simplify₁ simplifies the first "layer" of a parser, -- down to the first occurrences of ♯_. The following simplifications -- are applied in a bottom-up manner (in relevant cases also for -- delayed arguments): -- -- f <$> fail → fail -- f <$> return x → return (f x) -- fail ∣ p → p -- p ∣ fail → p -- token >>= p₁ ∣ token >>= p₂ → token >>= λ t → -- ♯ (♭? (p₁ t) ∣ ♭? (p₂ t)) -- fail ⊛ p → fail -- p ⊛ fail → fail -- return f ⊛ return x → return (f x) -- fail >>= p → fail -- return x >>= p → p x -- nonempty fail → fail -- nonempty (return x) → fail -- cast eq p → p -- -- Some ♯_'s may be removed, but care is taken to ensure that -- non-simplified parsers in the result are delayed. mutual simplify₁ : ∀ {Tok R xs} (p : Parser Tok R xs) → Simplify₁ p -- • return: simplify₁ (return x) = result _ (return x ∎) -- • fail: simplify₁ fail = result _ (fail ∎) -- • token: simplify₁ token = result _ (token ∎) -- • _<$>_: simplify₁ (f <$> p) with simplify₁ p ... | result fail p≅∅ = result _ ( f <$> p ≅⟨ (λ _ → refl) <$> p≅∅ ⟩ f <$> fail ≅⟨ <$>.zero ⟩ fail ∎) ... | result (return x) p≅ε = result _ ( f <$> p ≅⟨ (λ x → refl {x = f x}) <$> p≅ε ⟩ f <$> return x ≅⟨ <$>.homomorphism f ⟩ return (f x) ∎) ... | result p′ p≅p′ = result _ ( f <$> p ≅⟨ (λ _ → refl) <$> p≅p′ ⟩ f <$> p′ ∎) -- • _∣_: simplify₁ (p₁ ∣ p₂) with simplify₁ p₁ | simplify₁ p₂ ... | result fail p₁≅∅ | result p₂′ p₂≅p₂′ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅∅ ∣′ p₂≅p₂′ ⟩ fail ∣ p₂′ ≅⟨ AdditiveMonoid.left-identity p₂′ ⟩ p₂′ ∎) ... | result p₁′ p₁≅p₁′ | result fail p₂≅∅ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅p₁′ ∣′ p₂≅∅ ⟩ p₁′ ∣ fail ≅⟨ AdditiveMonoid.right-identity p₁′ ⟩ p₁′ ∎) ... | result (p₁₁ >>= p₁₂) p₁≅… | result (p₂₁ >>= p₂₂) p₂≅… = let h = helper p₁₁ refl p₁₂ p₂₁ refl p₂₂ in result _ ( p₁ ∣ p₂ ≅⟨ p₁≅… ∣′ p₂≅… ⟩ p₁₁ >>= p₁₂ ∣ p₂₁ >>= p₂₂ ≅⟨ Simplify₁.correct h ⟩ Simplify₁.parser h ∎) where helper : ∀ {Tok R₁ R₂ R xs₁ xs₁′ xs₂ xs₂′ f₁ f₂} (p₁₁ : ∞⟨ f₁ ⟩Parser Tok R₁ xs₁′) (eq₁ : xs₁′ ≡ flatten xs₁) (p₁₂ : (x : R₁) → ∞⟨ xs₁ ⟩Parser Tok R (apply f₁ x)) (p₂₁ : ∞⟨ f₂ ⟩Parser Tok R₂ xs₂′) (eq₂ : xs₂′ ≡ flatten xs₂) (p₂₂ : (x : R₂) → ∞⟨ xs₂ ⟩Parser Tok R (apply f₂ x)) → Simplify₁ (P.subst (∞⟨ f₁ ⟩Parser Tok R₁) eq₁ p₁₁ >>= p₁₂ ∣ P.subst (∞⟨ f₂ ⟩Parser Tok R₂) eq₂ p₂₁ >>= p₂₂) helper p₁₁ eq₁ p₁₂ p₂₁ eq₂ p₂₂ with ♭? p₁₁ | P.inspect ♭? p₁₁ | ♭? p₂₁ | P.inspect ♭? p₂₁ helper {Tok} {f₁ = f₁} {f₂} p₁₁ eq₁ p₁₂ p₂₁ eq₂ p₂₂ | token | [ eq₁′ ] | token | [ eq₂′ ] = result _ ( cast₁ p₁₁ >>= p₁₂ ∣ cast₂ p₂₁ >>= p₂₂ ≅⟨ [ forced? p₁₁ - ○ - forced?′ p₁₂ - ○ ] Subst.correct∞ eq₁ p₁₁ >>= (λ t → ♭? (p₁₂ t) ∎) ∣′ [ forced? p₂₁ - ○ - forced?′ p₂₂ - ○ ] Subst.correct∞ eq₂ p₂₁ >>= (λ t → ♭? (p₂₂ t) ∎) ⟩ ♭? p₁₁ >>= (♭? ∘ p₁₂) ∣ ♭? p₂₁ >>= (♭? ∘ p₂₂) ≅⟨ [ ○ - ○ - ○ - ○ ] P.subst (λ p → p ≅P token) (P.sym eq₁′) (token ∎) >>= (λ t → ♭? (p₁₂ t) ∎) ∣′ [ ○ - ○ - ○ - ○ ] P.subst (λ p → p ≅P token) (P.sym eq₂′) (token ∎) >>= (λ t → ♭? (p₂₂ t) ∎) ⟩ token >>= (♭? ∘ p₁₂) ∣ token >>= (♭? ∘ p₂₂) ≅⟨ sym $ Monad.left-distributive token (♭? ∘ p₁₂) (♭? ∘ p₂₂) ⟩ token >>= (λ t → ♭? (p₁₂ t) ∣ ♭? (p₂₂ t)) ≅⟨ [ ○ - ○ - ○ - ◌ ] token ∎ >>= (λ t → ♭? (p₁₂ t) ∣ ♭? (p₂₂ t) ∎) ⟩ token >>= (λ t → ♯ (♭? (p₁₂ t) ∣ ♭? (p₂₂ t))) ∎) where cast₁ = P.subst (∞⟨ f₁ ⟩Parser Tok Tok) eq₁ cast₂ = P.subst (∞⟨ f₂ ⟩Parser Tok Tok) eq₂ helper _ _ _ _ _ _ | _ | _ | _ | _ = result _ (_ ∎) simplify₁ (p₁ ∣ p₂) | result p₁′ p₁≅p₁′ | result p₂′ p₂≅p₂′ = result _ ( p₁ ∣ p₂ ≅⟨ p₁≅p₁′ ∣′ p₂≅p₂′ ⟩ p₁′ ∣ p₂′ ∎) -- • _⊛_: simplify₁ (p₁ ⊛ p₂) = helper _ _ p₁ p₂ (simplify₁∞ p₁) (simplify₁∞ p₂) refl refl where -- token ⊛ token is never type correct, but Agda's case-splitting -- machinery cannot see this, so instead of a with clause the -- following ugly machinery is used. cast₁ : ∀ {Tok R R₁ R₁′ xs xs′} {ys : Maybe (List R)} → (R≡ : R₁ ≡ R₁′) → xs ≅H xs′ → ∞⟨ ys ⟩Parser Tok R₁′ (flatten xs′) → ∞⟨ ys ⟩Parser Tok R₁ (flatten xs) cast₁ refl refl p = p helper : ∀ {Tok R₁ R₁′ R₂} fs xs {xs′} (p₁ : ∞⟨ xs ⟩Parser Tok (R₁ → R₂) (flatten fs)) (p₂ : ∞⟨ fs ⟩Parser Tok R₁′ (flatten xs′)) → Simplify₁ (♭? p₁) → Simplify₁ (♭? p₂) → (R≡ : R₁ ≡ R₁′) (xs≅ : xs ≅H xs′) → Simplify₁ (p₁ ⊛ cast₁ R≡ xs≅ p₂) helper fs xs p₁ p₂ (result fail p₁≅∅) _ refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] p₁≅∅ ⊛ (♭? p₂ ∎) ⟩ fail ⊛ ♭? p₂ ≅⟨ ApplicativeFunctor.left-zero (♭? p₂) ⟩ fail ∎) helper fs xs p₁ p₂ _ (result fail p₂≅∅) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] ♭? p₁ ∎ ⊛ p₂≅∅ ⟩ ♭? p₁ ⊛ fail ≅⟨ ApplicativeFunctor.right-zero (♭? p₁) ⟩ fail ∎) helper fs xs p₁ p₂ (result (return f) p₁≅ε) (result (return x) p₂≅ε) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ xs - ○ - fs - ○ ] p₁≅ε ⊛ p₂≅ε ⟩ return f ⊛ return x ≅⟨ ApplicativeFunctor.homomorphism f x ⟩ return (f x) ∎) helper fs xs p₁ p₂ p₁′ p₂′ R≡ xs≅ = helper′ fs xs p₁ p₂ p₁′ p₂′ R≡ xs≅ where helper′ : ∀ {Tok R₁ R₁′ R₂} fs xs {xs′} (p₁ : ∞⟨ xs ⟩Parser Tok (R₁ → R₂) (flatten fs)) (p₂ : ∞⟨ fs ⟩Parser Tok R₁′ (flatten xs′)) → Simplify₁ (♭? p₁) → Simplify₁ (♭? p₂) → (R≡ : R₁ ≡ R₁′) (xs≅ : xs ≅H xs′) → Simplify₁ (p₁ ⊛ cast₁ R≡ xs≅ p₂) helper′ nothing nothing p₁ p₂ _ _ refl refl = result _ ( p₁ ⊛ p₂ ∎) helper′ (just fs) nothing p₁ p₂ _ (result p₂′ p₂≅p₂′) refl refl with BSEq.empty-unique $ I.cong $ C.sound $ sym p₂≅p₂′ helper′ (just fs) nothing p₁ p₂ _ (result p₂′ p₂≅p₂′) refl refl | refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ◌ - ◌ - ○ - ○ ] ♭ p₁ ∎ ⊛ p₂≅p₂′ ⟩ p₁ ⊛ p₂′ ∎) helper′ nothing (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) _ refl refl with BSEq.empty-unique $ I.cong $ C.sound $ sym p₁≅p₁′ helper′ nothing (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) _ refl refl | refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ○ - ○ - ◌ - ◌ ] p₁≅p₁′ ⊛ (♭ p₂ ∎) ⟩ p₁′ ⊛ p₂ ∎) helper′ (just fs) (just xs) p₁ p₂ (result p₁′ p₁≅p₁′) (result p₂′ p₂≅p₂′) refl refl = result _ ( p₁ ⊛ p₂ ≅⟨ [ ○ - ○ - ○ - ○ ] p₁≅p₁′ ⊛ p₂≅p₂′ ⟩ p₁′ ⊛ p₂′ ∎) -- • _>>=_: simplify₁ (_>>=_ {xs = xs} {f = f} p₁ p₂) with simplify₁∞ p₁ ... | result fail p₁≅∅ = result _ ( p₁ >>= p₂ ≅⟨ [ f - ○ - xs - ○ ] p₁≅∅ >>= (λ x → ♭? (p₂ x) ∎) ⟩ fail >>= (♭? ∘ p₂) ≅⟨ Monad.left-zero (♭? ∘ p₂) ⟩ fail ∎) ... | result (return x) p₁≅ε with simplify₁∞ (p₂ x) ... | result p₂x′ p₂x≅p₂x′ = result _ ( p₁ >>= p₂ ≅⟨ [ f - ○ - xs - ○ ] p₁≅ε >>= (λ x → ♭? (p₂ x) ∎) ⟩ return x >>= (♭? ∘ p₂) ≅⟨ Monad.left-identity x (♭? ∘ p₂) ⟩ ♭? (p₂ x) ≅⟨ p₂x≅p₂x′ ⟩ p₂x′ ∎) simplify₁ (p₁ >>= p₂) | result p₁′ p₁≅p₁′ with forced? p₁ | forced?′ p₂ ... | nothing | just xs = result _ ( p₁ >>= p₂ ≅⟨ [ ◌ - ◌ - ○ - ○ ] ♭ p₁ ∎ >>= (λ x → simplify₁-[]-correct (p₂ x)) ⟩ p₁ >>= (λ x → simplify₁-[] (p₂ x)) ∎) ... | just f | just xs = result _ ( p₁ >>= p₂ ≅⟨ [ ○ - ○ - ○ - ○ ] p₁≅p₁′ >>= (λ x → Simplify₁.correct (simplify₁ (p₂ x))) ⟩ p₁′ >>= (λ x → Simplify₁.parser $ simplify₁ (p₂ x)) ∎) ... | nothing | nothing = result _ ( p₁ >>= p₂ ∎) ... | just f | nothing = result _ ( p₁ >>= p₂ ≅⟨ [ ○ - ○ - ◌ - ○ ] p₁≅p₁′ >>= (λ x → ♭ (p₂ x) ∎) ⟩ p₁′ >>= (♭ ∘ p₂) ≅⟨ [ ○ - ○ - ○ - ◌ ] sym (Subst.correct lemma) >>= (λ x → ♭ (p₂ x) ∎) ⟩ cast-[] p₁′ >>= p₂ ∎) where lemma = BSEq.empty-unique $ I.cong $ C.sound $ sym p₁≅p₁′ cast-[] = P.subst (Parser _ _) lemma -- • nonempty: simplify₁ (nonempty p) with simplify₁ p ... | result fail p≅∅ = result _ ( nonempty p ≅⟨ nonempty p≅∅ ⟩ nonempty fail ≅⟨ Nonempty.zero ⟩ fail ∎) ... | result (return x) p≅ε = result _ ( nonempty p ≅⟨ nonempty p≅ε ⟩ nonempty (return x) ≅⟨ Nonempty.nonempty-return ⟩ fail ∎) ... | result p′ p≅p′ = result _ ( nonempty p ≅⟨ nonempty p≅p′ ⟩ nonempty p′ ∎) -- • cast: simplify₁ (cast xs₁≈xs₂ p) with simplify₁ p ... | result p′ p≅p′ = result _ ( cast xs₁≈xs₂ p ≅⟨ Cast.correct ⟩ p ≅⟨ p≅p′ ⟩ p′ ∎) private -- Note that if an argument parser is delayed, then simplification -- is not applied recursively (because this could lead to -- non-termination). simplify₁∞ : ∀ {Tok R R′ xs} {m : Maybe R′} (p : ∞⟨ m ⟩Parser Tok R xs) → Simplify₁ (♭? p) simplify₁∞ {m = nothing} p = result _ (♭ p ∎) simplify₁∞ {m = just _} p = simplify₁ p simplify₁-[] : ∀ {Tok R} → Parser Tok R [] → Parser Tok R [] simplify₁-[] p = P.subst (Parser _ _) ([]-lemma p) $ Simplify₁.parser $ simplify₁ p simplify₁-[]-correct : ∀ {Tok R} (p : Parser Tok R []) → p ≅P simplify₁-[] p simplify₁-[]-correct p = p ≅⟨ Simplify₁.correct (simplify₁ p) ⟩ Simplify₁.parser (simplify₁ p) ≅⟨ sym $ Subst.correct ([]-lemma p) ⟩ simplify₁-[] p ∎ []-lemma : ∀ {Tok R} (p : Parser Tok R []) → Simplify₁.bag (simplify₁ p) ≡ [] []-lemma p = BSEq.empty-unique $ I.cong $ C.sound $ sym $ Simplify₁.correct $ simplify₁ p ------------------------------------------------------------------------ -- Deep simplification -- The function simplify simplifies the first layer, then it traverses -- the result and simplifies the following layers, and so on. The -- extra traversals have been implemented to satisfy Agda's -- termination checker; they could perhaps be avoided. -- -- Note that simplifications in an upper layer do not get to take -- advantage of simplifications performed in lower layers. Consider -- ♯ p ⊛ token, for instance. If p can be simplified to fail, then one -- might believe that ♯ p ⊛ token is simplified to fail as well. -- However, this is only the case if p actually /computes/ to fail. -- -- If simplification of the upper layer were dependent on complete -- simplification of lower layers, then simplification could fail to -- terminate. This does not mean that one cannot propagate /any/ -- information from lower layers to upper layers, though: one could -- for instance perform partial simplification of lower layers, up to -- a certain depth, before an upper layer is simplified. mutual simplify : ∀ {Tok R xs} (p : Parser Tok R xs) → Parser Tok R (Simplify₁.bag $ simplify₁ p) simplify p = simplify↓ (Simplify₁.parser (simplify₁ p)) private simplify↓ : ∀ {Tok R xs} → Parser Tok R xs → Parser Tok R xs simplify↓ (return x) = return x simplify↓ fail = fail simplify↓ token = token simplify↓ (p₁ ∣ p₂) = simplify↓ p₁ ∣ simplify↓ p₂ simplify↓ (f <$> p) = f <$> simplify↓ p simplify↓ (nonempty p) = nonempty (simplify↓ p) simplify↓ (cast xs₁≈xs₂ p) = cast xs₁≈xs₂ (simplify↓ p) simplify↓ (p₁ ⊛ p₂) with forced? p₁ | forced? p₂ ... | just xs | just fs = simplify↓ p₁ ⊛ simplify↓ p₂ ... | just xs | nothing = simplify↓ p₁ ⊛ ♯ simplify (♭ p₂) ... | nothing | just fs = ♯ simplify (♭ p₁) ⊛ simplify↓ p₂ ... | nothing | nothing = ♯ simplify-[] (♭ p₁) ⊛ ♯ simplify-[] (♭ p₂) simplify↓ (p₁ >>= p₂) with forced? p₁ | forced?′ p₂ ... | just f | just xs = simplify↓ p₁ >>= λ x → simplify↓ (p₂ x) ... | just f | nothing = simplify↓ p₁ >>= λ x → ♯ simplify (♭ (p₂ x)) ... | nothing | just xs = ♯ simplify (♭ p₁) >>= λ x → simplify↓ (p₂ x) ... | nothing | nothing = ♯ simplify-[] (♭ p₁) >>= λ x → ♯ simplify-[] (♭ (p₂ x)) simplify-[] : ∀ {Tok R} → Parser Tok R [] → Parser Tok R [] simplify-[] p = simplify↓ (simplify₁-[] p) -- The simplifier is correct. mutual correct : ∀ {Tok R xs} (p : Parser Tok R xs) → simplify p ≅P p correct p = simplify↓ (Simplify₁.parser $ simplify₁ p) ≅⟨ correct↓ (Simplify₁.parser $ simplify₁ p) ⟩ Simplify₁.parser (simplify₁ p) ≅⟨ sym $ Simplify₁.correct $ simplify₁ p ⟩ p ∎ private correct↓ : ∀ {Tok R xs} (p : Parser Tok R xs) → simplify↓ p ≅P p correct↓ (return x) = return x ∎ correct↓ fail = fail ∎ correct↓ token = token ∎ correct↓ (p₁ ∣ p₂) = correct↓ p₁ ∣′ correct↓ p₂ correct↓ (f <$> p) = (λ _ → refl) <$> correct↓ p correct↓ (nonempty p) = nonempty (correct↓ p) correct↓ (cast xs₁≈xs₂ p) = cast (correct↓ p) correct↓ (p₁ ⊛ p₂) with forced? p₁ | forced? p₂ ... | just xs | just fs = [ just (○ , ○) - just (○ , ○) ] correct↓ p₁ ⊛ correct↓ p₂ ... | just xs | nothing = [ just (○ , ○) - nothing ] correct↓ p₁ ⊛ ♯ correct (♭ p₂) ... | nothing | just fs = [ nothing - just (○ , ○) ] ♯ correct (♭ p₁) ⊛ correct↓ p₂ ... | nothing | nothing = [ nothing - nothing ] ♯ correct-[] (♭ p₁) ⊛ ♯ correct-[] (♭ p₂) correct↓ (p₁ >>= p₂) with forced? p₁ | forced?′ p₂ ... | just f | just xs = [ just (○ , ○) - just (○ , ○) ] correct↓ p₁ >>= λ x → correct↓ (p₂ x) ... | just f | nothing = [ just (○ , ○) - nothing ] correct↓ p₁ >>= λ x → ♯ correct (♭ (p₂ x)) ... | nothing | just xs = [ nothing - just (○ , ○) ] ♯ correct (♭ p₁) >>= λ x → correct↓ (p₂ x) ... | nothing | nothing = [ nothing - nothing ] ♯ correct-[] (♭ p₁) >>= λ x → ♯ correct-[] (♭ (p₂ x)) correct-[] : ∀ {Tok R} (p : Parser Tok R []) → simplify-[] p ≅P p correct-[] p = simplify-[] p ≅⟨ correct↓ (simplify₁-[] p) ⟩ simplify₁-[] p ≅⟨ sym $ simplify₁-[]-correct p ⟩ p ∎
examples/ada/Sum.adb
Jack840517/CompilerExplorer
2
14391
-- This pragma will remove the warning produced by the default -- CE filename and the procedure name differing, -- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName -- pragma Source_File_Name (Sum, Body_File_Name => "example.adb"); procedure Sum is type Integer_Array is array(Natural range <>) of Integer; function Sum(input : in Integer_Array) return Natural is sum : Natural := 0; begin for i in input'range loop sum := sum + input(i); end loop; return sum; end Sum; begin null; end Sum;
src/TemporalOps/Linear.agda
DimaSamoz/temporal-type-systems
4
15914
<reponame>DimaSamoz/temporal-type-systems<filename>src/TemporalOps/Linear.agda {-# OPTIONS --allow-unsolved-metas #-} module TemporalOps.Linear where open import CategoryTheory.Instances.Reactive open import CategoryTheory.Functor open import CategoryTheory.CartesianStrength open import CategoryTheory.NatTrans open import CategoryTheory.Monad open import CategoryTheory.Linear open import TemporalOps.Next open import TemporalOps.Delay open import TemporalOps.Diamond open import TemporalOps.OtherOps open import TemporalOps.Common.Other open import TemporalOps.Common.Compare open import TemporalOps.Common.Rewriting open import Data.Product open import Data.Product.Properties open import Data.Sum open import Data.Nat hiding (_*_) open import Data.Nat.Properties using (+-identityʳ ; +-comm ; +-suc ; +-assoc) open import Relation.Binary.PropositionalEquality hiding (inspect) open import Holes.Term using (⌞_⌟) open import Holes.Cong.Propositional open ≡-Reasoning open L ℝeactive-BCCC M-◇ public ℝeactive-linear : Linear ℝeactive-BCCC M-◇ ℝeactive-linear = record { linprod = λ A B → record { ⟪_,_⟫ = prod-◇ ; *π₁-comm = λ {C} {l₁} {l₂} {n} {a} → *π₁-comm-◇ {A}{B}{C} {l₁} {l₂} {n} {a} ; *π₂-comm = {! !} ; ⊛-unique = {! !} } } where open Functor F-▹ open Functor F-◇ renaming (fmap to ◇-f) private module ▹ᵏ-F k = Functor (F-delay k) private module ▹ᵏ-◇ k = _⟹_ (▹ᵏ-to-◇ k) private module ▹ᵏ-C k = CartesianFunctor (F-cart-delay k) open Monad M-◇ open CartesianFunctor F-cart-▹ renaming (m to m-▹) pair-delay-◇₁ : ∀{A B : τ} -> (k l : ℕ) -> (delay A by suc (k + l) ⊗ delay B by k) ⇴ delay (◇ A ⊗ B) by k pair-delay-◇₁ zero l n (dA , dB) = (suc l , dA) , dB pair-delay-◇₁ {A}{B} (suc k) l n p = fmap (pair-delay-◇₁ k l) n (m-▹ (delay A by suc (k + l)) (delay B by k) n p) pair-delay-◇₂ : ∀{A B : τ} -> (k l : ℕ) -> (delay A by k ⊗ delay B by suc (k + l)) ⇴ delay (A ⊗ ◇ B) by k pair-delay-◇₂ zero l n (dA , dB) = dA , (suc l , dB) pair-delay-◇₂ {A}{B} (suc k) l n p = fmap (pair-delay-◇₂ k l) n (m-▹ (delay A by k) (delay B by suc (k + l)) n p) prod-◇-compare : ∀{A B : τ} -> (k₁ k₂ n : ℕ) -> (a₁ : delay A by k₁ at n)(a₂ : delay B by k₂ at n) -> Ordering k₁ k₂ -> ◇ (A ⊛ B) at n prod-◇-compare {A} {B} k₁ .(suc (k₁ + l)) n a₁ a₂ (less .k₁ l) = k₁ , ▹ᵏ-F.fmap k₁ ι₁ n (▹ᵏ-F.fmap k₁ ι₁ n (pair-delay-◇₂ k₁ l n (a₁ , a₂))) prod-◇-compare {A} {B} .(suc (k₂ + l)) k₂ n a₁ a₂ (greater .k₂ l) = k₂ , ▹ᵏ-F.fmap k₂ ι₁ n (▹ᵏ-F.fmap k₂ ι₂ n (pair-delay-◇₁ k₂ l n (a₁ , a₂))) prod-◇-compare {A} {B} k₁ .k₁ n a₁ a₂ (equal .k₁) = k₁ , ▹ᵏ-F.fmap k₁ ι₂ n (▹ᵏ-C.m k₁ A B n (a₁ , a₂)) ◇-select : ∀{A B : τ} -> (◇ A ⊗ ◇ B) ⇴ ◇ (A ⊛ B) ◇-select {A}{B} n ((k₁ , a₁) , (k₂ , a₂)) = prod-◇-compare {A}{B} k₁ k₂ n a₁ a₂ (compare k₁ k₂) prod-◇ : ∀{A B L : τ} -> (L ⇴ ◇ A) -> (L ⇴ ◇ B) -> (L ⇴ ◇ (A ⊛ B)) prod-◇ fa fb n lp = ◇-select n (fa n lp , fb n lp) *π₁-comm-◇ : ∀{A B L} -> {l₁ : L ⇴ ◇ A} {l₂ : L ⇴ ◇ B} -> (μ.at A ∘ ◇-f *π₁) ∘ (prod-◇ l₁ l₂) ≈ l₁ *π₁-comm-◇ {A}{B}{L}{l₁}{l₂} {n} {a} with inspect (l₁ n a , l₂ n a) *π₁-comm-◇ | ((k₁ , a₁) , (k₂ , a₂)) with≡ pf with inspect (compare k₁ k₂) *π₁-comm-◇ {A}{B}{L}{l₁}{l₂}{n}{a} | ((k₁ , a₁) , .(suc (k₁ + l)) , a₂) with≡ pf | less .k₁ l with≡ cpf = begin (μ.at A n (◇-f *π₁ n (◇-select n ⌞ (l₁ n a , l₂ n a) ⌟))) ≡⟨ cong! pf ⟩ μ.at A n (◇-f *π₁ n (prod-◇-compare k₁ (suc (k₁ + l)) n a₁ a₂ (⌞ compare k₁ (suc (k₁ + l)) ⌟))) ≡⟨ cong! cpf ⟩ μ.at A n (◇-f *π₁ n (prod-◇-compare k₁ (suc (k₁ + l)) n a₁ a₂ (less k₁ l))) ≡⟨⟩ μ.at A n (k₁ , ▹ᵏ-F.fmap k₁ *π₁ n ⌞ (▹ᵏ-F.fmap k₁ ι₁ n (▹ᵏ-F.fmap k₁ ι₁ n (pair-delay-◇₂ k₁ l n (a₁ , a₂)))) ⌟) ≡⟨ cong! (▹ᵏ-F.fmap-∘ k₁ {g = ι₁ {A ⊗ ◇ B ⊕ ◇ A ⊗ B} {A ⊗ B}} {ι₁ {A ⊗ ◇ B} {◇ A ⊗ B}}{n} {pair-delay-◇₂ k₁ l n (a₁ , a₂)}) ⟩ μ.at A n (k₁ , ⌞ ▹ᵏ-F.fmap k₁ *π₁ n (▹ᵏ-F.fmap k₁ (ι₁ ∘ ι₁) n (pair-delay-◇₂ k₁ l n (a₁ , a₂))) ⌟) ≡⟨ cong! (▹ᵏ-F.fmap-∘ k₁ {g = *π₁} {ι₁ ∘ ι₁} {n} {pair-delay-◇₂ k₁ l n (a₁ , a₂)}) ⟩ μ.at A n (k₁ , ▹ᵏ-F.fmap k₁ ([ η.at A ∘ π₁ ⁏ π₁ {B = L} ⁏ η.at A ∘ π₁ {B = L} ] ∘ ι₁ ∘ ι₁) n (pair-delay-◇₂ k₁ l n (a₁ , a₂))) ≡⟨⟩ μ.at A n (k₁ , ⌞ ▹ᵏ-F.fmap k₁ (η.at A ∘ π₁) n (pair-delay-◇₂ k₁ l n (a₁ , a₂)) ⌟) ≡⟨ cong! (▹ᵏ-F.fmap-∘ k₁) ⟩ μ.at A n (k₁ , ▹ᵏ-F.fmap k₁ (η.at A) n ⌞ ▹ᵏ-F.fmap k₁ π₁ n (pair-delay-◇₂ k₁ l n (a₁ , a₂)) ⌟) ≡⟨ cong! (lemma k₁ l {n} {a₁ , a₂}) ⟩ μ.at A n (k₁ , ▹ᵏ-F.fmap k₁ (η.at A) n a₁) ≡⟨ η-unit2 ⟩ k₁ , a₁ ≡⟨ sym (,-injectiveˡ pf) ⟩ l₁ n a ∎ where lemma : ∀ (k l : ℕ) -> ▹ᵏ-F.fmap k π₁ ∘ pair-delay-◇₂ k l ≈ π₁ lemma zero l = refl lemma (suc k) l {zero} = refl lemma (suc k) l {suc n} = lemma k l {n} *π₁-comm-◇ {A}{B}{L}{l₁}{l₂}{n}{a} | ((.(suc (k₂ + l)) , a₁) , k₂ , a₂) with≡ pf | greater .k₂ l with≡ cpf = begin (μ.at A n (◇-f *π₁ n (◇-select n ⌞ (l₁ n a , l₂ n a) ⌟))) ≡⟨ cong! pf ⟩ μ.at A n (◇-f *π₁ n (prod-◇-compare (suc (k₂ + l)) k₂ n a₁ a₂ (⌞ compare (suc (k₂ + l)) k₂ ⌟))) ≡⟨ cong! cpf ⟩ μ.at A n (◇-f *π₁ n (prod-◇-compare (suc (k₂ + l)) k₂ n a₁ a₂ (greater k₂ l))) ≡⟨⟩ μ.at A n (k₂ , ▹ᵏ-F.fmap k₂ *π₁ n ⌞ (▹ᵏ-F.fmap k₂ ι₁ n (▹ᵏ-F.fmap k₂ ι₂ n (pair-delay-◇₁ k₂ l n (a₁ , a₂)))) ⌟) ≡⟨ cong! (▹ᵏ-F.fmap-∘ k₂ {g = ι₁ {A ⊗ ◇ B ⊕ ◇ A ⊗ B} {A ⊗ B}} {ι₂ {A ⊗ ◇ B} {◇ A ⊗ B}}{n} {pair-delay-◇₁ k₂ l n (a₁ , a₂)}) ⟩ μ.at A n (k₂ , ⌞ ▹ᵏ-F.fmap k₂ *π₁ n (▹ᵏ-F.fmap k₂ (ι₁ ∘ ι₂) n (pair-delay-◇₁ k₂ l n (a₁ , a₂))) ⌟) ≡⟨ cong! (▹ᵏ-F.fmap-∘ k₂ {g = *π₁} {ι₁ ∘ ι₂} {n} {pair-delay-◇₁ k₂ l n (a₁ , a₂)}) ⟩ μ.at A n (k₂ , ▹ᵏ-F.fmap k₂ ([ η.at A ∘ π₁ {B = L} ⁏ π₁ {B = B} ⁏ η.at A ∘ π₁ {B = L} ] ∘ ι₁ ∘ ι₂) n (pair-delay-◇₁ k₂ l n (a₁ , a₂))) ≡⟨⟩ μ.at A n (k₂ , ⌞ ▹ᵏ-F.fmap k₂ π₁ n (pair-delay-◇₁ k₂ l n (a₁ , a₂)) ⌟) ≡⟨ refl ⟩ μ.at A n (◇-f π₁ n (k₂ , pair-delay-◇₁ k₂ l n (a₁ , a₂))) ≡⟨ {! !} ⟩ -- ≡⟨ cong! (lemma k₂ l {n} {a₁ , a₂}) ⟩ -- μ.at A n (k₂ , ▹ᵏ-F.fmap k₂ (▹ᵏ-◇.at (suc l) A) n (split-▹ᵏ k₂ l n a₁)) suc (k₂ + l) , a₁ ≡⟨ sym (,-injectiveˡ pf) ⟩ l₁ n a ∎ where split-▹ᵏ : ∀ {A} k l -> delay A by suc (k + l) ⇴ delay (delay A by suc l) by k split-▹ᵏ zero l n a = a split-▹ᵏ (suc k) l zero a = top.tt split-▹ᵏ (suc k) l (suc n) a = split-▹ᵏ k l n a lemma : ∀ {A B} (k l : ℕ) -> ▹ᵏ-F.fmap k (π₁ {B = B}) ∘ pair-delay-◇₁ {A} k l ≈ ▹ᵏ-F.fmap k (▹ᵏ-◇.at (suc l) A) ∘ split-▹ᵏ k l ∘ π₁ lemma zero l {n} = refl lemma (suc k) l {zero} = refl lemma (suc k) l {suc n} = lemma k l lemma2 : ∀ {A B} k l n (a₁ : delay A by suc (k + l) at n) (a₂ : delay B by k at n) -> μ.at A n (◇-f π₁ n (k , pair-delay-◇₁ k l n (a₁ , a₂))) ≡ (suc (k + l) , a₁) lemma2 zero l n a₁ a₂ = refl lemma2 (suc k) l zero a₁ a₂ = {! !} lemma2 (suc k) l (suc n) a₁ a₂ = {! !} *π₁-comm-◇ {l₁ = l₁} {l₂} {n} {a} | ((k₁ , a₁) , .k₁ , a₂) with≡ pf | equal .k₁ with≡ cpf = {! !} open Linear ℝeactive-linear public -- Handle a linear product with three continuations handle : ∀ {A B C D : τ} -> (A ⊗ B ⊗ ◇ C ⇴ ◇ D) -> (A ⊗ ◇ B ⊗ C ⇴ ◇ D) -> (A ⊗ B ⊗ C ⇴ ◇ D) -> A ⊗ (B ⊛ C) ⇴ ◇ D handle a b c = [ a ∘ assoc-left ⁏ b ∘ assoc-left ⁏ c ∘ assoc-left ] ∘ dist2
alloy4fun_models/trashltl/models/5/Xaoqew7CohLW55CQL.als
Kaixi26/org.alloytools.alloy
0
4976
open main pred idXaoqew7CohLW55CQL_prop6 { no Trash or all f : File | (f in Trash) since (f in Trash) } pred __repair { idXaoqew7CohLW55CQL_prop6 } check __repair { idXaoqew7CohLW55CQL_prop6 <=> prop6o }
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_25_1506.asm
ljhsiun2/medusa
9
29390
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x1b56e, %rsi lea addresses_WT_ht+0xa2da, %rdi nop nop nop cmp %r11, %r11 mov $14, %rcx rep movsw nop nop add %rdi, %rdi lea addresses_D_ht+0x276e, %r11 nop and $22130, %rcx movw $0x6162, (%r11) nop nop sub $45954, %r11 lea addresses_normal_ht+0x1748a, %r11 nop nop nop nop add $8807, %r12 movl $0x61626364, (%r11) nop nop nop sub $60560, %rdi lea addresses_WC_ht+0x1ce56, %rdx nop nop nop sub $9408, %r12 mov (%rdx), %rsi nop cmp $35053, %rdx lea addresses_WT_ht+0x19b3c, %r12 nop nop nop sub %r15, %r15 mov $0x6162636465666768, %rdi movq %rdi, (%r12) dec %rdi lea addresses_D_ht+0xff6e, %rdi nop nop nop nop nop add %r15, %r15 and $0xffffffffffffffc0, %rdi movaps (%rdi), %xmm6 vpextrq $0, %xmm6, %r11 nop nop nop nop nop cmp $58407, %r12 lea addresses_A_ht+0x10cde, %r15 nop nop nop nop nop and %r11, %r11 mov (%r15), %ecx nop nop lfence lea addresses_D_ht+0x1e36e, %r15 nop cmp $25293, %rcx movups (%r15), %xmm1 vpextrq $1, %xmm1, %r12 nop nop and %rdi, %rdi lea addresses_A_ht+0x1365e, %rdi nop nop sub %rsi, %rsi movl $0x61626364, (%rdi) xor $23896, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r8 push %rbx push %rcx push %rdi push %rsi // Store mov $0x289fb60000000d16, %rsi and $45440, %rbx mov $0x5152535455565758, %r8 movq %r8, (%rsi) nop nop and %rcx, %rcx // Store lea addresses_RW+0x1f6e, %rcx clflush (%rcx) sub $20468, %rdi mov $0x5152535455565758, %r8 movq %r8, (%rcx) nop nop nop nop dec %r11 // Store lea addresses_A+0x139ee, %rcx clflush (%rcx) nop nop xor $4036, %r8 movl $0x51525354, (%rcx) nop nop nop cmp $41964, %rbx // Faulty Load lea addresses_RW+0x1f6e, %rcx nop inc %r8 mov (%rcx), %r14w lea oracles, %rsi and $0xff, %r14 shlq $12, %r14 mov (%rsi,%r14,1), %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'58': 25} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
memsim-master/src/memory-cache.adb
strenkml/EE368
0
18012
with Ada.Unchecked_Deallocation; with Ada.Assertions; use Ada.Assertions; with Device; use Device; with BRAM; with CACTI; with Random_Enum; package body Memory.Cache is MIN_LINE_COUNT : constant := 16; procedure Free is new Ada.Unchecked_Deallocation(Cache_Data, Cache_Data_Pointer); function Create_Cache(mem : access Memory_Type'Class; line_count : Positive := 1; line_size : Positive := 8; associativity : Positive := 1; latency : Time_Type := 1; policy : Policy_Type := LRU; write_back : Boolean := True) return Cache_Pointer is result : constant Cache_Pointer := new Cache_Type; begin Set_Memory(result.all, mem); result.line_size := line_size; result.line_count := line_count; result.associativity := associativity; result.latency := latency; result.policy := policy; result.write_back := write_back; result.data.Set_Length(Count_Type(result.line_count)); for i in 0 .. result.line_count - 1 loop result.data.Replace_Element(i, new Cache_Data); end loop; return result; end Create_Cache; function Random_Policy is new Random_Enum(Policy_Type); function Random_Boolean is new Random_Enum(Boolean); -- Set the latency based on associativity. procedure Update_Latency(mem : in out Cache_Type'Class) is begin if Get_Device = ASIC then mem.latency := CACTI.Get_Time(mem); else case mem.policy is when PLRU => mem.latency := 3 + Time_Type(mem.associativity) / 8; when others => mem.latency := 3 + Time_Type(mem.associativity) / 4; end case; end if; end Update_Latency; function Random_Cache(next : access Memory_Type'Class; generator : Distribution_Type; max_cost : Cost_Type) return Memory_Pointer is result : Cache_Pointer := new Cache_Type; begin -- Start with everything set to the minimum. Set_Memory(result.all, next); result.line_size := Get_Word_Size(next.all); result.line_count := MIN_LINE_COUNT; result.associativity := 1; result.policy := LRU; result.write_back := True; -- If even the minimum cache is too costly, return null. if Get_Cost(result.all) > max_cost then Set_Memory(result.all, null); Destroy(Memory_Pointer(result)); return Memory_Pointer(next); end if; -- Randomly increase parameters, reverting them if we exceed the cost. loop -- Line size. declare line_size : constant Positive := result.line_size; begin if Random_Boolean(Random(generator)) then result.line_size := line_size * 2; if Get_Cost(result.all) > max_cost then result.line_size := line_size; exit; end if; end if; end; -- Line count. declare line_count : constant Positive := result.line_count; begin if Random_Boolean(Random(generator)) then result.line_count := 2 * line_count; if Get_Cost(result.all) > max_cost then result.line_count := line_count; exit; end if; end if; end; -- Associativity. declare associativity : constant Positive := result.associativity; begin if Random_Boolean(Random(generator)) then result.associativity := result.associativity * 2; if result.associativity > result.line_count or else Get_Cost(result.all) > max_cost then result.associativity := associativity; exit; end if; end if; end; -- Policy. declare policy : constant Policy_Type := result.policy; begin result.policy := Random_Policy(Random(generator)); if Get_Cost(result.all) > max_cost then result.policy := policy; exit; end if; end; -- Type. declare write_back : constant Boolean := result.write_back; begin result.write_back := Random_Boolean(Random(generator)); if Get_Cost(result.all) > max_cost then result.write_back := write_back; exit; end if; end; end loop; Update_Latency(result.all); result.data.Set_Length(Count_Type(result.line_count)); for i in 0 .. result.line_count - 1 loop result.data.Replace_Element(i, new Cache_Data); end loop; return Memory_Pointer(result); end Random_Cache; function Clone(mem : Cache_Type) return Memory_Pointer is result : constant Cache_Pointer := new Cache_Type'(mem); begin return Memory_Pointer(result); end Clone; procedure Permute(mem : in out Cache_Type; generator : in Distribution_Type; max_cost : in Cost_Type) is param_count : constant Natural := 8; param : Natural := Random(generator) mod param_count; line_size : constant Positive := mem.line_size; line_count : constant Positive := mem.line_count; associativity : constant Positive := mem.associativity; policy : constant Policy_Type := mem.policy; write_back : constant Boolean := mem.write_back; begin -- Loop until we either change a parameter or we are unable to -- change any parameter. for i in 1 .. param_count loop case param is when 0 => -- Increase line size mem.line_size := line_size * 2; exit when Get_Cost(mem) <= max_cost; mem.line_size := line_size; when 1 => -- Decrease line size if line_size > Get_Word_Size(Get_Memory(mem).all) then mem.line_size := line_size / 2; exit when Get_Cost(mem) <= max_cost; mem.line_size := line_size; end if; when 2 => -- Increase line count mem.line_count := line_count * 2; exit when Get_Cost(mem) <= max_cost; mem.line_count := line_count; when 3 => -- Decrease line count if line_count > MIN_LINE_COUNT and line_count > associativity then mem.line_count := line_count / 2; exit when Get_Cost(mem) <= max_cost; mem.line_count := line_count; end if; when 4 => -- Increase associativity if associativity < line_count then mem.associativity := associativity * 2; exit when Get_Cost(mem) <= max_cost; mem.associativity := associativity; end if; when 5 => -- Decrease associativity if associativity > 1 then mem.associativity := associativity / 2; exit when Get_Cost(mem) <= max_cost; mem.associativity := associativity; end if; when 6 => -- Change policy mem.policy := Random_Policy(Random(generator)); exit when Get_Cost(mem) <= max_cost; mem.policy := policy; when others => -- Change type mem.write_back := Random_Boolean(Random(generator)); exit when Get_Cost(mem) <= max_cost; mem.write_back := write_back; end case; param := (param + 1) mod param_count; end loop; Update_Latency(mem); for i in mem.line_count .. mem.data.Last_Index loop declare dp : Cache_Data_Pointer := mem.data.Element(i); begin Free(dp); end; end loop; mem.data.Set_Length(Count_Type(mem.line_count)); for i in line_count .. mem.line_count - 1 loop mem.data.Replace_Element(i, new Cache_Data); end loop; Assert(Get_Cost(mem) <= max_cost, "Invalid cache permutation"); end Permute; procedure Get_Data(mem : in out Cache_Type; address : in Address_Type; size : in Positive; is_read : in Boolean) is data : Cache_Data_Pointer; mask : constant Address_Type := Address_Type(mem.line_size - 1); tag : constant Address_Type := address and not mask; set_count : constant Natural := mem.line_count / mem.associativity; line_size : constant Address_Type := Address_Type(mem.line_size); word_addr : constant Address_Type := address / line_size; first : constant Natural := Natural(word_addr mod Address_Type(set_count)); line : Natural; to_replace : Natural := 0; age : Long_Integer; age_sum : Natural; begin Advance(mem, mem.latency); -- Update the age of all items in this set. age_sum := 0; for i in 0 .. mem.associativity - 1 loop line := first + i * set_count; data := mem.data.Element(line); if mem.policy = PLRU then age_sum := age_sum + Natural(data.age); else data.age := data.age + 1; Assert(data.age > 0, "invalid age"); end if; end loop; -- First check if this address is already in the cache. -- Here we also keep track of the line to be replaced. if mem.policy = MRU then age := Long_Integer'Last; else age := Long_Integer'First; end if; for i in 0 .. mem.associativity - 1 loop line := first + i * set_count; data := mem.data.Element(line); if tag = data.address then -- Cache hit. if mem.policy = PLRU then -- Reset ages to 0 if we marked all of them. if age_sum + 1 = mem.associativity then for j in 0 .. mem.associativity - 1 loop declare temp : Cache_Data_Pointer; begin temp := mem.data.Element(first + j * set_count); temp.age := 0; end; end loop; end if; -- Make this age most recently used. data.age := 1; elsif mem.policy /= FIFO then -- Other policies reset the age to 0. data.age := 0; end if; if is_read or mem.write_back then data.dirty := data.dirty or not is_read; else Write(Container_Type(mem), tag, mem.line_size); end if; return; elsif mem.policy = MRU then if data.age < age then to_replace := line; age := data.age; end if; elsif mem.policy = PLRU then if data.age = 0 then to_replace := line; age := data.age; end if; else if data.age > age then to_replace := line; age := data.age; end if; end if; end loop; -- If we got here, the item is not in the cache. if is_read or mem.write_back then -- Look up the line to replace. data := mem.data.Element(to_replace); -- Evict the oldest entry. -- On write-through caches, the dirty flag will never be set. if data.dirty then Write(Container_Type(mem), data.address, mem.line_size); data.dirty := False; end if; data.address := tag; data.dirty := not is_read; -- Update the age. if mem.policy = PLRU then if age_sum + 1 = mem.associativity then for j in 0 .. mem.associativity - 1 loop declare temp : Cache_Data_Pointer; begin temp := mem.data.Element(first + j * set_count); temp.age := 0; end; end loop; end if; data.age := 1; else data.age := 0; end if; -- Read the new entry. -- We skip this if this was a write that wrote the entire line. if is_read or size /= mem.line_size then Read(Container_Type(mem), tag, mem.line_size); end if; else -- A write on a write-through cache, forward the write. Write(Container_Type(mem), address, size); end if; end Get_Data; procedure Reset(mem : in out Cache_Type; context : in Natural) is data : Cache_Data_Pointer; begin Reset(Container_Type(mem), context); for i in 0 .. mem.line_count - 1 loop data := mem.data.Element(i); data.address := Address_Type'Last; data.age := 0; data.dirty := False; end loop; end Reset; procedure Read(mem : in out Cache_Type; address : in Address_Type; size : in Positive) is extra : constant Natural := size / mem.line_size; abits : constant Positive := Get_Address_Bits; mask : constant Address_Type := Address_Type(2) ** abits - 1; temp : Address_Type := address; begin for i in 1 .. extra loop Get_Data(mem, temp, mem.line_size, True); temp := (temp + Address_Type(mem.line_size)) and mask; end loop; if size > extra * mem.line_size then Get_Data(mem, temp, size - extra * mem.line_size, True); end if; end Read; procedure Write(mem : in out Cache_Type; address : in Address_Type; size : in Positive) is extra : constant Natural := size / mem.line_size; abits : constant Positive := Get_Address_Bits; mask : constant Address_Type := Address_Type(2) ** abits - 1; temp : Address_Type := address; begin for i in 1 .. extra loop Get_Data(mem, temp, mem.line_size, False); temp := (temp + Address_Type(mem.line_size)) and mask; end loop; if size > extra * mem.line_size then Get_Data(mem, temp, size - extra * mem.line_size, False); end if; end Write; function To_String(mem : Cache_Type) return Unbounded_String is result : Unbounded_String; begin Append(result, "(cache "); Append(result, "(line_size" & Positive'Image(mem.line_size) & ")"); Append(result, "(line_count" & Positive'Image(mem.line_count) & ")"); Append(result, "(associativity" & Positive'Image(mem.associativity) & ")"); Append(result, "(latency" & Time_Type'Image(mem.latency) & ")"); if mem.associativity > 1 then Append(result, "(policy "); case mem.policy is when LRU => Append(result, "lru"); when MRU => Append(result, "mru"); when FIFO => Append(result, "fifo"); when PLRU => Append(result, "plru"); end case; Append(result, ")"); end if; if mem.write_back then Append(result, "(write_back true)"); else Append(result, "(write_back false)"); end if; Append(result, "(memory "); Append(result, To_String(Container_Type(mem))); Append(result, "))"); return result; end To_String; function Get_Cost(mem : Cache_Type) return Cost_Type is -- Bits per line for storing data. lines : constant Natural := mem.line_count; lsize : constant Natural := mem.line_size; line_bits : constant Natural := lsize * 8; -- Bits to store a tag. addr_bits : constant Positive := Get_Address_Bits; wsize : constant Positive := Get_Word_Size(mem); index_bits : constant Natural := Log2(lines - 1); line_words : constant Natural := (lsize + wsize - 1) / wsize; ls_bits : constant Natural := Log2(line_words - 1); tag_bits : constant Natural := addr_bits - index_bits - ls_bits; -- Bits to store the age. assoc : constant Positive := mem.associativity; -- Bits used for storing valid and dirty. valid_bits : constant Natural := 1; dirty_bits : constant Natural := 1; -- Bits per way. This is the width of the memory. width : Natural := valid_bits + line_bits + tag_bits; result : Cost_Type; begin -- Use CACTI to determine the cost for ASICs. if Get_Device = ASIC then result := Get_Cost(Container_Type(mem)); result := result + CACTI.Get_Area(mem); return result; end if; -- Determine the number of age bits. if assoc > 1 then case mem.policy is when PLRU => width := width + 1; when others => width := width + Log2(assoc - 1); end case; end if; -- If this cache is a write-back cache, we need to track a dirty -- bit for each cache line. if mem.write_back then width := width + dirty_bits; end if; -- The memory must be wide enough to allow access to each way. width := width * assoc; -- Given the width and depth of the cache, determine the number -- of BRAMs required. result := Cost_Type(BRAM.Get_Count(width, lines / assoc)); -- Add the cost of the contained memory. result := result + Get_Cost(Container_Type(mem)); return result; end Get_Cost; procedure Generate(mem : in Cache_Type; sigs : in out Unbounded_String; code : in out Unbounded_String) is other : constant Memory_Pointer := Get_Memory(mem); word_bits: constant Natural := 8 * Get_Word_Size(mem); name : constant String := "m" & To_String(Get_ID(mem)); oname : constant String := "m" & To_String(Get_ID(other.all)); lsize : constant Positive := 8 * mem.line_size / word_bits; lcount : constant Positive := mem.line_count; assoc : constant Natural := mem.associativity; begin Generate(other.all, sigs, code); Declare_Signals(sigs, name, word_bits); Line(code, name & "_inst : entity work.cache"); Line(code, " generic map ("); Line(code, " ADDR_WIDTH => ADDR_WIDTH,"); Line(code, " WORD_WIDTH => " & To_String(word_bits) & ","); Line(code, " LINE_SIZE_BITS => " & To_String(Log2(lsize - 1)) & ","); Line(code, " LINE_COUNT_BITS => " & To_String(Log2(lcount / assoc - 1)) & ","); Line(code, " ASSOC_BITS => " & To_String(Log2(assoc - 1)) & ","); case mem.policy is when LRU => Line(code, " REPLACEMENT => 0,"); when MRU => Line(code, " REPLACEMENT => 1,"); when FIFO => Line(code, " REPLACEMENT => 2,"); when PLRU => Line(code, " REPLACEMENT => 3,"); end case; if mem.write_back then Line(code, " WRITE_POLICY => 0"); else Line(code, " WRITE_POLICY => 1"); end if; Line(code, " )"); Line(code, " port map ("); Line(code, " clk => clk,"); Line(code, " rst => rst,"); Line(code, " addr => " & name & "_addr,"); Line(code, " din => " & name & "_din,"); Line(code, " dout => " & name & "_dout,"); Line(code, " re => " & name & "_re,"); Line(code, " we => " & name & "_we,"); Line(code, " mask => " & name & "_mask,"); Line(code, " ready => " & name & "_ready,"); Line(code, " maddr => " & oname & "_addr,"); Line(code, " min => " & oname & "_dout,"); Line(code, " mout => " & oname & "_din,"); Line(code, " mre => " & oname & "_re,"); Line(code, " mwe => " & oname & "_we,"); Line(code, " mmask => " & oname & "_mask,"); Line(code, " mready => " & oname & "_ready"); Line(code, " );"); end Generate; procedure Adjust(mem : in out Cache_Type) is ptr : Cache_Data_Pointer; begin Adjust(Container_Type(mem)); for i in mem.data.First_Index .. mem.data.Last_Index loop ptr := new Cache_Data'(mem.data.Element(i).all); mem.data.Replace_Element(i, ptr); end loop; end Adjust; procedure Finalize(mem : in out Cache_Type) is begin Finalize(Container_Type(mem)); for i in mem.data.First_Index .. mem.data.Last_Index loop declare ptr : Cache_Data_Pointer := mem.data.Element(i); begin Free(ptr); end; end loop; end Finalize; function Get_Line_Size(mem : Cache_Type) return Positive is begin return mem.line_size; end Get_Line_Size; function Get_Line_Count(mem : Cache_Type) return Positive is begin return mem.line_count; end Get_Line_Count; function Get_Associativity(mem : Cache_Type) return Positive is begin return mem.associativity; end Get_Associativity; function Get_Policy(mem : Cache_Type) return Policy_Type is begin return mem.policy; end Get_Policy; end Memory.Cache;
reference_asm/battle_escape.asm
tashiww/maten_tools
1
100520
; ######################################################################################## ; # Generated by the active disassembly feature of the Exodus emulation platform ; ; # escape from battle routine ; ; # Creation Date: 2021-1-5 19:29:40 ; # Analysis Region: 0x0000BED2 - 0x0000C0xx ; ######################################################################################## org $0000BED2 MOVE.w $00FFDAC4, D0 ; it's after ram ptrs for enemy and player, not sure.. always $0? BTST.l #0, D0 ; maybe boss flag for inescapable battles BNE.w EscapeFail BTST.l #$0E, D0 BNE.w loc_0000BF9C MOVEA.l $00FFDAB8, A5 MOVEQ #5, D6 ; loop through full party CLR.w D5 ; starting with first member MOVEQ #-1, D4 ; max speed in party CLR.w D7 GetPartySpeed: TST.w (A5,D5.w) ; check if member present BEQ.b SetupForEnemyCheck MOVE.w $14(A5,D5.w), D3 ; speed TST.w $2(A5,D5.w) ; check current hp (dead lol) BEQ.b HalveDeadSpeed MOVE.w $16(A5,D5.w), D0 ; status debuffs ANDI.w #$30A6, D0 ; stone, paralyze, hold i think BEQ.b PlayerNotDisabled HalveDeadSpeed: LSR.w #1, D3 ; BRA.b CheckHighestSpeed ; PlayerNotDisabled: MOVEQ #-1, D7 ; autofail if this isn't set CheckHighestSpeed: CMP.w D3, D4 BCS.b NextMember MOVE.w D3, D4 NextMember: ADDI.w #$0030, D5 DBF D6, GetPartySpeed SetupForEnemyCheck: TST.w D7 BEQ.w EscapeFail MOVEA.l $00FFDAB4, A5 MOVEQ #8, D6 ; can there be 8 enemies???? CLR.w D5 MOVEQ #1, D3 CLR.w D7 GetEnemySpeed: TST.w (A5,D5.w) ; check if present BEQ.b NextEnemy TST.w $2(A5,D5.w) ; curent hp BEQ.b NextEnemy MOVE.w $16(A5,D5.w), D0 ; debuffs ANDI.w #$3066, D0 ; adds sleep and fear i think? BNE.b NextEnemy MOVEQ #-1, D7 ; valid enemy CMP.w $14(A5,D5.w), D3 ; check against max speed so far BCC.b NextEnemy MOVE.w $14(A5,D5.w), D3 ; set as highest speed NextEnemy: ADDI.w #$0030, D5 ; data for enemies is $30 bytes DBF D6, GetEnemySpeed EscapeOdds equr d5 TST.w D7 BEQ.w loc_0000BF9C ; if no valid enemy speeds MOVEQ #7, EscapeOdds CMP.w D3, D4 BCS.b PlayerSlower LSR.w #1, D4 ; CMP.w D3, D4 ; BCS.b EscapeRNG ; MOVEQ #$0000000B, EscapeOdds ; if player 2x faster LSR.w #1, D4 ; CMP.w D3, D4 ; BCS.b EscapeRNG ; MOVEQ #$0000000F, EscapeOdds ; if player 4x faster BRA.b EscapeRNG ; PlayerSlower: MOVEQ #2, EscapeOdds LSR.w #1, D3 CMP.w D3, D4 BCC.b EscapeRNG BRA.w EscapeFail ;Predicted (Code-scan) EscapeRNG: JSR $00001F9C ; rng routine ANDI.w #$000F, D0 CMP.w D0, EscapeOdds BCS.w EscapeFail loc_0000BF9C: MOVE.w #$00FD, D0 JSR $00002376 MOVEA.l $00FFDAB8, A5 MOVEQ #5, D7 CLR.w D6 BattleWrapup: CLR.w D2 MOVE.b (A5), D2 BEQ.b loc_0000C01A BSR.w $E23A MOVE.w $2(A5), $2(A0) ; update hp (copy battle status to game status) MOVE.w $6(A5), $6(A0) ; update mp MOVE.w $16(A5), D0 ; debuffs ANDI.w #7, D0 MOVE.b D0, $19(A0) MOVE.w $24(A5), $40(A0) MOVE.w $26(A5), $42(A0) MOVE.w $2E(A5), $4E(A0) MOVE.w $00FFDAC4, D0 BTST.l #$0C, D0 BEQ.b loc_0000C00E CMPI.b #1, (A0) ;Predicted (Code-scan) BEQ.b loc_0000C002 ;Predicted (Code-scan) CMPI.b #2, (A0) ;Predicted (Code-scan) BEQ.b loc_0000C002 ;Predicted (Code-scan) CMPI.b #9, (A0) ;Predicted (Code-scan) BNE.b loc_0000C00E ;Predicted (Code-scan) loc_0000C002: TST.w $2(A0) ;Predicted (Code-scan) BNE.b loc_0000C00E ;Predicted (Code-scan) MOVE.w #1, $2(A0) ; gives 1 hp to dead people? loc_0000C00E: ADDQ.w #1, D6 ADDA.l #$00000030, A5 DBF D7, BattleWrapup loc_0000C01A: JSR $0000B184 MOVE.w #1, $00FF0004 TRAP #5 ORI.b #$FA, D1 ;Predicted (Code-scan) EscapeFail: MOVEQ #6, D0 LEA $CD48, A0 ; asm68k might mangle this JSR $00003850 JSR $0000382E TRAP #5
4.8.ReverseString.asm
souzaitor/Assembly
0
961
TITLE Reverse String ;-------------------- ; Autor: <NAME> ; Data: 15/07/2021 ; ; Capítulo 4 Exercício 8 ; Descrição: Este programa usa a instrução LOOP com endereçamento indireto que copia uma string de ; origem para destino, invertendo a ordem dos caracteres no processo ;-------------------- INCLUDE Irvine32.inc .data SOURCE BYTE "This is the source string", 0 TARGET BYTE SIZEOF source DUP('#') .code main PROC mov ecx, SIZEOF SOURCE - 1 mov esi, OFFSET SOURCE + (SIZEOF SOURCE) - 2 mov edi, OFFSET TARGET l1: mov al, [esi] mov [edi], al dec esi inc edi loop l1 mov esi,OFFSET target ; offset of variable mov ebx,1 ; byte format mov ecx,SIZEOF target-1 ; counter call DumpMem exit main ENDP END main
asm/kernel/basic/exec.asm
majacQ/retroputer
58
160725
.segment __current__ kmemmap.basic.code-start .append { # # EXEC is responsible for evaluating the line at D,X # # @param [D, X]: PTR to crunched line (either direct or run mode works) # @returns DL: 0 if no error, or an error number if one occurred # ####################################################################### exec: { enter 0x00 push x push a push y push c _main: y := 0 do { in dl, 0x38 # Check for CTRL+C and dl, 0b0000_1000 cmp dl, 0 if !z { # Got CTRL in dl, 0x3A and dl, 0b0000_0100 cmp dl, 0 if !z { # Got C dl := 0 # HALT! [bdata.execution-mode] := dl dl := brodata.STOPPED_ERROR # with appropriate error br _out } } call gettok c := dl cmp c, 128 if n { # not an executable token cmp c, 0 if z { dl := 0 brs _out } dl := brodata.SYNTAX_ERROR brs _out } clr c sub c, 128 shl c, 1 x := c call [statement-handlers, x] cmp dl, constants.NO_STMT_TERM_NEEDED if z { continue # probably had a THEN or ELSE... } cmp dl, 0 brs !z _out # an error occurred, get us out call gettok cmp dl, 0 if z { brs _out } else { cmp dl, brodata.TOK_END_OF_STMT if z { continue } else { dl := brodata.SYNTAX_ERROR brs _out } } } while z _out: cmp dl, constants.EXIT_EARLY if z { dl := 0 # Early exit is not an ERROR condition } pop c pop y pop a pop x exit 0x00 ret } }
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_8751_344.asm
ljhsiun2/medusa
9
171430
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %rcx push %rdi push %rsi lea addresses_UC_ht+0xbc63, %rsi lea addresses_normal_ht+0xce3, %rdi nop sub $52380, %r12 mov $117, %rcx rep movsq nop add $44669, %r10 lea addresses_normal_ht+0x1063, %rsi lea addresses_normal_ht+0x13d5, %rdi nop sub %r13, %r13 mov $38, %rcx rep movsl sub %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r8 push %rax push %rbx push %rdi push %rdx // Load lea addresses_US+0xd5a3, %r13 clflush (%r13) nop nop and $58200, %rbx mov (%r13), %rax nop nop dec %r13 // Store lea addresses_A+0x12463, %rdx nop nop xor $40756, %rbx movl $0x51525354, (%rdx) nop nop sub %r8, %r8 // Faulty Load lea addresses_UC+0x17c63, %rbx nop nop cmp $1447, %rdi movb (%rbx), %r13b lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rdx pop %rdi pop %rbx pop %rax pop %r8 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'00': 8751} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
test/Fail/Issue2650.agda
shlevy/agda
1,989
15408
<filename>test/Fail/Issue2650.agda {-# OPTIONS --cubical #-} module _ where module _ where open import Agda.Primitive.Cubical public open import Agda.Builtin.Cubical.Path public refl : ∀ {a} {A : Set a} {x : A} → x ≡ x refl {x = x} = \ _ → x -- Here there's no solution for H, pattern unification will try -- H := \ i -> b, but the equality constraints from -- H : Path b a should rule out that assignment. testPath : ∀ {A : Set} {b a : A} (let H : b ≡ a; H = _) → ∀ i → H i ≡ b testPath i = refl
programs/oeis/089/A089361.asm
neoneye/loda
22
21250
; A089361: Numbers of pairs (i, j), i, j > 1, such that i^j <= n. ; 0,0,0,1,1,1,1,2,3,3,3,3,3,3,3,5,5,5,5,5,5,5,5,5,6,6,7,7,7,7,7,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16 mov $1,261241 sub $1,$0 seq $0,342871 ; a(n) = Sum_{k=1..n} floor(n^(1/k)), n >= 1. mul $1,2 mov $2,$0 add $2,1 add $1,$2 sub $1,522484 mov $0,$1
programs/oeis/233/A233775.asm
neoneye/loda
22
9875
<filename>programs/oeis/233/A233775.asm ; A233775: Number of vertices in the n-th row of the Sierpinski gasket (cf. A047999). ; 1,2,3,4,5,4,6,8,9,4,6,8,10,8,12,16,17,4,6,8,10,8,12,16,18,8,12,16,20,16,24,32,33,4,6,8,10,8,12,16,18,8,12,16,20,16,24,32,34,8,12,16,20,16,24,32,36,16,24,32,40,32,48,64,65,4,6,8,10,8,12,16,18,8,12,16,20,16,24,32,34,8,12,16,20,16,24,32,36,16,24,32,40,32,48,64,66,8,12,16 mov $2,$0 mov $4,2 lpb $4 mov $0,$2 sub $4,1 add $0,$4 sub $0,1 mul $0,2 max $0,0 seq $0,267700 ; "Tree" sequence in a 90 degree sector of the cellular automaton of A160720. mov $3,$0 mov $5,$4 mul $5,$0 add $1,$5 lpe min $2,1 mul $2,$3 sub $1,$2 div $1,2 add $1,1 mov $0,$1
source/oasis/program-elements-protected_body_declarations.ads
optikos/oasis
0
20807
<reponame>optikos/oasis -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Declarations; with Program.Lexical_Elements; with Program.Elements.Defining_Identifiers; with Program.Elements.Aspect_Specifications; with Program.Element_Vectors; with Program.Elements.Identifiers; package Program.Elements.Protected_Body_Declarations is pragma Pure (Program.Elements.Protected_Body_Declarations); type Protected_Body_Declaration is limited interface and Program.Elements.Declarations.Declaration; type Protected_Body_Declaration_Access is access all Protected_Body_Declaration'Class with Storage_Size => 0; not overriding function Name (Self : Protected_Body_Declaration) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is abstract; not overriding function Aspects (Self : Protected_Body_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is abstract; not overriding function Protected_Operations (Self : Protected_Body_Declaration) return not null Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function End_Name (Self : Protected_Body_Declaration) return Program.Elements.Identifiers.Identifier_Access is abstract; type Protected_Body_Declaration_Text is limited interface; type Protected_Body_Declaration_Text_Access is access all Protected_Body_Declaration_Text'Class with Storage_Size => 0; not overriding function To_Protected_Body_Declaration_Text (Self : aliased in out Protected_Body_Declaration) return Protected_Body_Declaration_Text_Access is abstract; not overriding function Protected_Token (Self : Protected_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Body_Token (Self : Protected_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function With_Token (Self : Protected_Body_Declaration_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Is_Token (Self : Protected_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function End_Token (Self : Protected_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Protected_Body_Declaration_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Protected_Body_Declarations;
Codes/Chapter06/P10/P06-10.asm
ar-ekt/Dandamudi-Assembly-Solutions
8
1527
global _start extern ExitProcess %INCLUDE "lib.h" %macro geti 0 fgets buffer, 15 a2i 15, buffer %endmacro %macro puti 1 i2a DWORD %1, buffer puts buffer %endmacro section .data MAX_ROW EQU 12 MAX_COL EQU 15 NEWLINE db 10, 0 TAB db 9, 0 MSG_ROW_INPUT db "Enter matrix number of rows: ", 0 MSG_COL_INPUT db "Enter matrix number of columns: ", 0 MSG_CELL_INPUT1 db "matrix[", 0 MSG_CELL_INPUT2 db "][", 0 MSG_CELL_INPUT3 db "] = ", 0 MSG_CYCLEN_INPUT db "Enter number of cycles(0<=): ", 0 RESULT db "Result: ", 10, 0 section .bss buffer resb 100 matrix resd (MAX_COL*MAX_ROW)+1 result resd (MAX_COL*MAX_ROW)+1 section .code _start: push DWORD 0 push DWORD 0 push matrix call matrixInput pop ECX pop EBX puts NEWLINE cycleN_input_loop: puts MSG_CYCLEN_INPUT geti cmp EAX, 0 jl cycleN_input_loop push EAX push EBX push ECX push result push matrix call matrixCyclicPermutation push EBX push ECX push result call matrixPrint _end: push DWORD 0 call ExitProcess matrixInput: %define matrix DWORD [EBP+8] %define numCol DWORD [EBP+12] %define numRow DWORD [EBP+16] enter 0, 0 pushad matRowInput: puts MSG_ROW_INPUT geti cmp EAX, MAX_ROW jg matRowInput cmp EAX, 1 jl matRowInput mov numRow, EAX matColInput: puts MSG_COL_INPUT geti cmp EAX, MAX_COL jg matColInput cmp EAX, 1 jl matColInput mov numCol, EAX cellsInput: mov ESI, matrix mov ECX, 0-1 rowsInput: inc ECX cmp ECX, numRow jge matrixInput_done mov EDX, 0-1 columnsInput: inc EDX cmp EDX, numCol jge rowsInput puts MSG_CELL_INPUT1 puti ECX puts MSG_CELL_INPUT2 puti EDX puts MSG_CELL_INPUT3 geti mov [ESI], EAX add ESI, 4 jmp columnsInput matrixInput_done: popad leave ret 12-8 matrixCyclicPermutation: %define matrix DWORD [EBP+8] %define result DWORD [EBP+12] %define numCol DWORD [EBP+16] %define numRow DWORD [EBP+20] %define cycleN DWORD [EBP+24] %define colMinusCycle DWORD [EBP-4] enter 4, 0 pushad mov EAX, cycleN cmp EAX, numCol jl permute cycleLoop: sub EAX, numCol cmp EAX, numCol jnl cycleLoop permute: mov cycleN, EAX mov EAX, numCol sub EAX, cycleN mov colMinusCycle, EAX mov ECX, 0-1 rowLoop: inc ECX cmp ECX, numRow je matrixCyclicPermutation_end mov EBX, cycleN colLoop1: mov EAX, ECX mul numCol add EAX, EBX shl EAX, 2 add EAX, matrix mov EDI, [EAX] mov EAX, ECX mul numCol add EAX, EBX sub EAX, cycleN shl EAX, 2 add EAX, result mov [EAX], EDI inc EBX cmp EBX, numCol jne colLoop1 mov EBX, 0-1 colLoop2: inc EBX cmp EBX, cycleN je rowLoop mov EAX, ECX mul numCol add EAX, EBX shl EAX, 2 add EAX, matrix mov EDI, [EAX] mov EAX, ECX mul numCol add EAX, EBX add EAX, numCol sub EAx, cycleN shl EAX, 2 add EAX, result mov [EAX], EDI jmp colLoop2 matrixCyclicPermutation_end: popad leave ret 20-0 matrixPrint: %define matrix DWORD [EBP+8] %define numCol DWORD [EBP+12] %define numRow DWORD [EBP+16] enter 0, 0 push ESI push EDX push ECX puts NEWLINE puts RESULT mov ESI, matrix mov ECX, numRow rowsPrint: mov EDX, numCol colsPrint: puti [ESI] add ESI, 4 puts TAB sub EDX, 1 ja colsPrint cols_done: puts NEWLINE sub ECX, 1 ja rowsPrint matrixPrint_end: pop ECX pop EDX pop ESI leave ret 12
src/main/antlr/Graphql.g4
Sparow199/graphql-java
5,355
7326
<gh_stars>1000+ grammar Graphql; import GraphqlSDL, GraphqlOperation, GraphqlCommon; @header { package graphql.parser.antlr; } @lexer::members { public boolean isDigit(int c) { return c >= '0' && c <= '9'; } public boolean isNameStart(int c) { return '_' == c || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); } public boolean isDot(int c) { return '.' == c; } } document : definition+; definition: operationDefinition | fragmentDefinition | typeSystemDefinition | typeSystemExtension ;
models/tests/test25.als
transclosure/Amalgam
4
3002
module tests/test // Bugpost by <NAME> // The correct behavior // is to generate an error message (saying recursion not supported). sig S {} pred p { p } run p
src/fsmaker-target-littlefs.adb
Fabien-Chouteau/fsmaker
0
12912
<filename>src/fsmaker-target-littlefs.adb with Ada.Unchecked_Deallocation; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with GNAT.Source_Info; with System; with Interfaces; use Interfaces; with Interfaces.C; use Interfaces.C; with Simple_Logging; with Littlefs; use Littlefs; package body FSmaker.Target.LittleFS is function ftruncate (FS : int; Length : Long_Integer) return int; pragma Import (C, ftruncate, "ftruncate"); function fsync (FS : int) return int; pragma Import (C, fsync, "fsync"); procedure Free is new Ada.Unchecked_Deallocation (LFS_Config, LFS_Config_Access); package FD_Backend is function Create (FD : aliased GNAT.OS_Lib.File_Descriptor) return LFS_Config_Access; end FD_Backend; package body FD_Backend is function Read (C : access constant LFS_Config; Block : LFS_Block; Off : LFS_Offset; Buffer : System.Address; Size : LFS_Size) return int with Convention => C; function Prog (C : access constant LFS_Config; Block : LFS_Block; Off : LFS_Offset; Buffer : System.Address; Size : LFS_Size) return int with Convention => C; function Erase (C : access constant LFS_Config; Block : LFS_Block) return int with Convention => C; function Sync (C : access constant LFS_Config) return int with Convention => C; ---------- -- Read -- ---------- function Read (C : access constant LFS_Config; Block : LFS_Block; Off : LFS_Offset; Buffer : System.Address; Size : LFS_Size) return int is Offset : constant LFS_Offset := Off + C.Block_Size * LFS_Size (Block); FD : GNAT.OS_Lib.File_Descriptor with Address => C.Context; begin GNAT.OS_Lib.Lseek (FD => FD, offset => Long_Integer (Offset), origin => GNAT.OS_Lib.Seek_Set); if GNAT.OS_Lib.Read (FD, Buffer, Integer (Size)) = Integer (Size) then return 0; else Simple_Logging.Error (GNAT.Source_Info.Enclosing_Entity & ": " & GNAT.OS_Lib.Errno_Message); return LFS_ERR_IO; end if; end Read; ---------- -- Prog -- ---------- function Prog (C : access constant LFS_Config; Block : LFS_Block; Off : LFS_Offset; Buffer : System.Address; Size : LFS_Size) return int is Offset : constant LFS_Offset := Off + C.Block_Size * LFS_Size (Block); FD : GNAT.OS_Lib.File_Descriptor with Address => C.Context; begin GNAT.OS_Lib.Lseek (FD => FD, offset => Long_Integer (Offset), origin => GNAT.OS_Lib.Seek_Set); if GNAT.OS_Lib.Write (FD, Buffer, Integer (Size)) = Integer (Size) then return 0; else Simple_Logging.Error (GNAT.Source_Info.Enclosing_Entity & ": " & GNAT.OS_Lib.Errno_Message); return LFS_ERR_IO; end if; end Prog; ----------- -- Erase -- ----------- function Erase (C : access constant LFS_Config; Block : LFS_Block) return int is Offset : constant LFS_Offset := C.Block_Size * LFS_Size (Block); FD : GNAT.OS_Lib.File_Descriptor with Address => C.Context; Zeros : constant array (1 .. C.Block_Size) of Unsigned_8 := (others => 0); Size : constant Integer := Integer (C.Block_Size); begin GNAT.OS_Lib.Lseek (FD => FD, offset => Long_Integer (Offset), origin => GNAT.OS_Lib.Seek_Set); if GNAT.OS_Lib.Write (FD, Zeros'Address, Size) = Size then return 0; else Simple_Logging.Error (GNAT.Source_Info.Enclosing_Entity & ": " & GNAT.OS_Lib.Errno_Message); return LFS_ERR_IO; end if; end Erase; ---------- -- Sync -- ---------- function Sync (C : access constant LFS_Config) return int is pragma Unreferenced (C); begin return 0; end Sync; ------------ -- Create -- ------------ function Create (FD : aliased GNAT.OS_Lib.File_Descriptor) return LFS_Config_Access is Ret : constant LFS_Config_Access := new LFS_Config; begin Ret.Context := FD'Address; Ret.Read := Read'Access; Ret.Prog := Prog'Access; Ret.Erase := Erase'Access; Ret.Sync := Sync'Access; Ret.Read_Size := 2048; Ret.Prog_Size := 2048; Ret.Block_Size := 2048; Simple_Logging.Debug ("Create FD backend -> File size: " & GNAT.OS_Lib.File_Length (FD)'Img); Ret.Block_Count := LFS_Size (GNAT.OS_Lib.File_Length (FD)) / Ret.Block_Size; Ret.Block_Cycles := 700; Ret.Cache_Size := Ret.Block_Size; Ret.Lookahead_Size := Ret.Block_Size; Ret.Read_Buffer := System.Null_Address; Ret.Prog_Buffer := System.Null_Address; Ret.Lookahead_Buffer := System.Null_Address; Ret.Name_Max := 0; Ret.File_Max := 0; Ret.Attr_Max := 0; return Ret; end Create; end FD_Backend; --------------- -- Error_Img -- --------------- function Error_Img (Err : int) return String is (case Err is when LFS_ERR_OK => "No error", when LFS_ERR_IO => "Error during device operation", when LFS_ERR_CORRUPT => "Corrupted", when LFS_ERR_NOENT => "No directory entry", when LFS_ERR_EXIST => "Entry already exists", when LFS_ERR_NOTDIR => "Entry is not a dir", when LFS_ERR_ISDIR => "Entry is a dir", when LFS_ERR_NOTEMPTY => "Dir is not empty", when LFS_ERR_BADF => "Bad file number", when LFS_ERR_FBIG => "File too large", when LFS_ERR_INVAL => "Invalid parameter", when LFS_ERR_NOSPC => "No space left on device", when LFS_ERR_NOMEM => "No more memory available", when LFS_ERR_NOATTR => "No data/attr available", when LFS_ERR_NAMETOOLONG => "File name too long", when others => "Unknown LFS error (" & Err'Img & ")"); ------------ -- Format -- ------------ overriding procedure Format (This : in out Instance; FD : GNAT.OS_Lib.File_Descriptor; Size : Natural) is use GNAT.OS_Lib; Unused : Integer; Err : int; Config : LFS_Config_Access; FD_Aliased : aliased constant File_Descriptor := FD; begin Simple_Logging.Always ("File size: " & GNAT.OS_Lib.File_Length (FD)'Img); if GNAT.OS_Lib.File_Length (FD) /= Long_Integer (Size) then raise Program_Error with "File size different than expected"; end if; Config := FD_Backend.Create (FD_Aliased); Err := Format (This.LFS, Config.all); Free (Config); if Err /= 0 then raise Program_Error with "format: " & Error_Img (Err); end if; end Format; ----------- -- Mount -- ----------- overriding procedure Mount (This : in out Instance; FD : GNAT.OS_Lib.File_Descriptor) is Err : int; begin This.FD := FD; This.Config := FD_Backend.Create (This.FD); Err := Mount (This.LFS, This.Config.all); if Err /= 0 then raise Program_Error with "mount: " & Error_Img (Err); end if; end Mount; -------------- -- Make_Dir -- -------------- overriding procedure Make_Dir (This : in out Instance; Path : Target_Path) is Err : int; Full_Path : Ada.Strings.Unbounded.Unbounded_String; begin for Dir of Path loop Full_Path := Full_Path & "/" & Dir; Simple_Logging.Always ("LFS: Making dir: '" & To_String (Full_Path) & "'"); Err := Mkdir (This.LFS, To_String (Full_Path)); if Err not in LFS_ERR_OK | LFS_ERR_EXIST then raise Program_Error with "mkdir: " & Error_Img (Err); end if; end loop; end Make_Dir; ---------- -- Tree -- ---------- overriding function Tree (This : in out Instance; Path : Target_Path) return Directory_Tree is function Tree_Rec (Dir_Path : String) return Directory_Tree is Dir : aliased LFS_Dir; Err : int; Info : aliased Entry_Info; Res : Node_Vectors.Vector; begin Simple_Logging.Always ("Listing path: '" & Dir_Path & "'"); Err := Open (This.LFS, Dir, Dir_Path); if Err /= LFS_ERR_OK then raise Program_Error with "tree: " & Error_Img (Err); end if; loop Err := Read (This.LFS, Dir, Info); case Err is when LFS_ERR_OK => exit; -- End of directory when int'First .. -1 => raise Program_Error with "tree: " & Error_Img (Err); when 1 .. int'Last => declare Name : constant String := Standard.Littlefs.Name (Info); begin if Name /= "." and then Name /= ".." then case Kind (Info) is when Register => Res.Append (new Node'(Kind => File, Name => To_Unbounded_String (Name))); when Directory => Res.Append (new Node'(Kind => FSmaker.Dir, Name => To_Unbounded_String (Name), Entries => Tree_Rec (Dir_Path & Name & "/"))); end case; end if; end; end case; end loop; Err := Close (This.LFS, Dir); if Err /= LFS_ERR_OK then raise Program_Error with "tree: " & Error_Img (Err); end if; return Res; end Tree_Rec; Full_Path : constant String := "/" & Path.Flatten ("/") & "/"; begin return Tree_Rec (Full_Path); end Tree; ------------ -- Import -- ------------ procedure Import (This : in out Instance; Path : Target_Path; Src : in out Source.Instance) is Err : int; File : aliased LFS_File; Full_Path : constant String := "/" & Path.Flatten ("/"); Dir_Path : Target_Path := Path; begin -- Remove filename from the path Dir_Path.Delete_Last; -- Make sure the directory hierarchy exists This.Make_Dir (Dir_Path); Err := Open (This.LFS, File, Full_Path, LFS_O_CREAT or LFS_O_WRONLY); if Err /= LFS_ERR_OK then raise Program_Error with "import: " & Error_Img (Err); end if; declare Buffer : array (1 .. 4046) of Unsigned_8; Read_Len : Natural; Write_Len : Integer_32; begin loop Read_Len := Src.Read (Buffer'Address, Buffer'Length); exit when Read_Len = 0; Write_Len := Write (This.LFS, File, Buffer'Address, Unsigned_32 (Read_Len)); if Write_Len < 0 then raise Program_Error with "import: " & Error_Img (int (Write_Len)); end if; exit when Write_Len /= Integer_32 (Read_Len); end loop; end; Err := Close (This.LFS, File); if Err /= LFS_ERR_OK then raise Program_Error with "import: " & Error_Img (Err); end if; Src.Close; end Import; --------- -- Cat -- --------- procedure Cat (This : in out Instance; Path : Target_Path; Dst : in out FSmaker.Sink.Class) is Err : int; File : aliased LFS_File; Full_Path : constant String := "/" & Path.Flatten ("/"); begin Err := Open (This.LFS, File, Full_Path, LFS_O_RDONLY); if Err /= LFS_ERR_OK then raise Program_Error with "cat: " & Error_Img (Err); end if; loop declare Buffer : array (1 .. 4096) of Unsigned_8; Read_Len : Integer_32; Write_Len : Natural; begin Read_Len := Read (This.LFS, File, Buffer'Address, Buffer'Length); exit when Read_Len = 0; if Read_Len < 0 then raise Program_Error with "cat: " & Error_Img (int (Err)); end if; Write_Len := Dst.Write (Buffer'Address, Integer (Read_Len)); if Write_Len < 0 then raise Program_Error with "cat: GNAT.OS_Lib.Write: " & GNAT.OS_Lib.Errno_Message; end if; exit when Read_Len /= Buffer'Length; end; end loop; Dst.Close; end Cat; end FSmaker.Target.LittleFS;
agda/Syntax.agda
ryanakca/strong-normalization
32
11252
<gh_stars>10-100 -- Syntax: Types, terms and contexts. module Syntax where open import Library infixr 6 _⇒_ infixr 4 _,_ -- Types and contexts. data Ty : Set where ★ : Ty _⇒_ : (a b : Ty) → Ty data Cxt : Set where ε : Cxt _,_ : (Γ : Cxt) (a : Ty) → Cxt -- Variables and terms. data Var : (Γ : Cxt) (a : Ty) → Set where zero : ∀ {Γ a} → Var (Γ , a) a suc : ∀ {Γ a b} (x : Var Γ a) → Var (Γ , b) a data Tm (Γ : Cxt) : (a : Ty) → Set where var : ∀ {a} (x : Var Γ a) → Tm Γ a abs : ∀ {a b} (t : Tm (Γ , a) b) → Tm Γ (a ⇒ b) app : ∀ {a b} (t : Tm Γ (a ⇒ b)) (u : Tm Γ a) → Tm Γ b -- Generalized neutral terms. data GNe (Arg : Cxt → Ty → Set) (Γ : Cxt) : Ty → Set where var : ∀{a} (x : Var Γ a) → GNe Arg Γ a app : ∀{a b} (n : GNe Arg Γ (a ⇒ b)) (o : Arg Γ a) → GNe Arg Γ b -- βη-normal forms. mutual Ne = GNe Nf data Nf (Γ : Cxt) : Ty → Set where abs : ∀{a b} (o : Nf (Γ , a) b) → Nf Γ (a ⇒ b) ne : (n : Ne Γ ★) → Nf Γ ★ mutual embNe : ∀{Γ a} → Ne Γ a → Tm Γ a embNe (var x) = var x embNe (app t u) = app (embNe t) (embNf u) embNf : ∀{Γ a} → Nf Γ a → Tm Γ a embNf (ne t) = embNe t embNf (abs t) = abs (embNf t)
Src/Ant32/Tests/ant32/arith/shr.asm
geoffthorpe/ant-architecture
0
82941
<gh_stars>0 #@tests shr
agda-stdlib-0.9/src/Data/List/Properties.agda
qwe2/try-agda
1
2474
------------------------------------------------------------------------ -- The Agda standard library -- -- List-related properties ------------------------------------------------------------------------ -- Note that the lemmas below could be generalised to work with other -- equalities than _≡_. module Data.List.Properties where open import Algebra import Algebra.Monoid-solver open import Category.Monad open import Data.Bool open import Data.List as List open import Data.List.All using (All; []; _∷_) open import Data.Maybe using (Maybe; just; nothing) open import Data.Nat open import Data.Nat.Properties open import Data.Product as Prod hiding (map) open import Function import Algebra.FunctionProperties import Relation.Binary.EqReasoning as EqR open import Relation.Binary.PropositionalEquality as P using (_≡_; _≢_; _≗_; refl) open import Relation.Nullary using (yes; no) open import Relation.Nullary.Decidable using (⌊_⌋) open import Relation.Unary using (Decidable) private open module FP {a} {A : Set a} = Algebra.FunctionProperties (_≡_ {A = A}) open module LMP {ℓ} = RawMonadPlus (List.monadPlus {ℓ = ℓ}) module LM {a} {A : Set a} = Monoid (List.monoid A) module List-solver {a} {A : Set a} = Algebra.Monoid-solver (monoid A) renaming (id to nil) ∷-injective : ∀ {a} {A : Set a} {x y : A} {xs ys} → x ∷ xs ≡ y List.∷ ys → x ≡ y × xs ≡ ys ∷-injective refl = (refl , refl) ∷ʳ-injective : ∀ {a} {A : Set a} {x y : A} xs ys → xs ∷ʳ x ≡ ys ∷ʳ y → xs ≡ ys × x ≡ y ∷ʳ-injective [] [] refl = (refl , refl) ∷ʳ-injective (x ∷ xs) (y ∷ ys) eq with ∷-injective eq ∷ʳ-injective (x ∷ xs) (.x ∷ ys) eq | (refl , eq′) = Prod.map (P.cong (_∷_ x)) id $ ∷ʳ-injective xs ys eq′ ∷ʳ-injective [] (_ ∷ []) () ∷ʳ-injective [] (_ ∷ _ ∷ _) () ∷ʳ-injective (_ ∷ []) [] () ∷ʳ-injective (_ ∷ _ ∷ _) [] () right-identity-unique : ∀ {a} {A : Set a} (xs : List A) {ys} → xs ≡ xs ++ ys → ys ≡ [] right-identity-unique [] refl = refl right-identity-unique (x ∷ xs) eq = right-identity-unique xs (proj₂ (∷-injective eq)) left-identity-unique : ∀ {a} {A : Set a} {xs} (ys : List A) → xs ≡ ys ++ xs → ys ≡ [] left-identity-unique [] _ = refl left-identity-unique {xs = []} (y ∷ ys) () left-identity-unique {xs = x ∷ xs} (y ∷ ys) eq with left-identity-unique (ys ++ [ x ]) (begin xs ≡⟨ proj₂ (∷-injective eq) ⟩ ys ++ x ∷ xs ≡⟨ P.sym (LM.assoc ys [ x ] xs) ⟩ (ys ++ [ x ]) ++ xs ∎) where open P.≡-Reasoning left-identity-unique {xs = x ∷ xs} (y ∷ [] ) eq | () left-identity-unique {xs = x ∷ xs} (y ∷ _ ∷ _) eq | () -- Map, sum, and append. map-++-commute : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) xs ys → map f (xs ++ ys) ≡ map f xs ++ map f ys map-++-commute f [] ys = refl map-++-commute f (x ∷ xs) ys = P.cong (_∷_ (f x)) (map-++-commute f xs ys) sum-++-commute : ∀ xs ys → sum (xs ++ ys) ≡ sum xs + sum ys sum-++-commute [] ys = refl sum-++-commute (x ∷ xs) ys = begin x + sum (xs ++ ys) ≡⟨ P.cong (_+_ x) (sum-++-commute xs ys) ⟩ x + (sum xs + sum ys) ≡⟨ P.sym $ +-assoc x _ _ ⟩ (x + sum xs) + sum ys ∎ where open CommutativeSemiring commutativeSemiring hiding (_+_) open P.≡-Reasoning -- Various properties about folds. foldr-universal : ∀ {a b} {A : Set a} {B : Set b} (h : List A → B) f e → (h [] ≡ e) → (∀ x xs → h (x ∷ xs) ≡ f x (h xs)) → h ≗ foldr f e foldr-universal h f e base step [] = base foldr-universal h f e base step (x ∷ xs) = begin h (x ∷ xs) ≡⟨ step x xs ⟩ f x (h xs) ≡⟨ P.cong (f x) (foldr-universal h f e base step xs) ⟩ f x (foldr f e xs) ∎ where open P.≡-Reasoning foldr-fusion : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} (h : B → C) {f : A → B → B} {g : A → C → C} (e : B) → (∀ x y → h (f x y) ≡ g x (h y)) → h ∘ foldr f e ≗ foldr g (h e) foldr-fusion h {f} {g} e fuse = foldr-universal (h ∘ foldr f e) g (h e) refl (λ x xs → fuse x (foldr f e xs)) idIsFold : ∀ {a} {A : Set a} → id {A = List A} ≗ foldr _∷_ [] idIsFold = foldr-universal id _∷_ [] refl (λ _ _ → refl) ++IsFold : ∀ {a} {A : Set a} (xs ys : List A) → xs ++ ys ≡ foldr _∷_ ys xs ++IsFold xs ys = begin xs ++ ys ≡⟨ P.cong (λ xs → xs ++ ys) (idIsFold xs) ⟩ foldr _∷_ [] xs ++ ys ≡⟨ foldr-fusion (λ xs → xs ++ ys) [] (λ _ _ → refl) xs ⟩ foldr _∷_ ([] ++ ys) xs ≡⟨ refl ⟩ foldr _∷_ ys xs ∎ where open P.≡-Reasoning mapIsFold : ∀ {a b} {A : Set a} {B : Set b} {f : A → B} → map f ≗ foldr (λ x ys → f x ∷ ys) [] mapIsFold {f = f} = begin map f ≈⟨ P.cong (map f) ∘ idIsFold ⟩ map f ∘ foldr _∷_ [] ≈⟨ foldr-fusion (map f) [] (λ _ _ → refl) ⟩ foldr (λ x ys → f x ∷ ys) [] ∎ where open EqR (P._→-setoid_ _ _) concat-map : ∀ {a b} {A : Set a} {B : Set b} {f : A → B} → concat ∘ map (map f) ≗ map f ∘ concat concat-map {b = b} {f = f} = begin concat ∘ map (map f) ≈⟨ P.cong concat ∘ mapIsFold {b = b} ⟩ concat ∘ foldr (λ xs ys → map f xs ∷ ys) [] ≈⟨ foldr-fusion {b = b} concat [] (λ _ _ → refl) ⟩ foldr (λ ys zs → map f ys ++ zs) [] ≈⟨ P.sym ∘ foldr-fusion (map f) [] (λ ys zs → map-++-commute f ys zs) ⟩ map f ∘ concat ∎ where open EqR (P._→-setoid_ _ _) map-id : ∀ {a} {A : Set a} → map id ≗ id {A = List A} map-id {A = A} = begin map id ≈⟨ mapIsFold ⟩ foldr _∷_ [] ≈⟨ P.sym ∘ idIsFold {A = A} ⟩ id ∎ where open EqR (P._→-setoid_ _ _) map-compose : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} {g : B → C} {f : A → B} → map (g ∘ f) ≗ map g ∘ map f map-compose {A = A} {B} {g = g} {f} = begin map (g ∘ f) ≈⟨ P.cong (map (g ∘ f)) ∘ idIsFold ⟩ map (g ∘ f) ∘ foldr _∷_ [] ≈⟨ foldr-fusion (map (g ∘ f)) [] (λ _ _ → refl) ⟩ foldr (λ a y → g (f a) ∷ y) [] ≈⟨ P.sym ∘ foldr-fusion (map g) [] (λ _ _ → refl) ⟩ map g ∘ foldr (λ a y → f a ∷ y) [] ≈⟨ P.cong (map g) ∘ P.sym ∘ mapIsFold {A = A} {B = B} ⟩ map g ∘ map f ∎ where open EqR (P._→-setoid_ _ _) foldr-cong : ∀ {a b} {A : Set a} {B : Set b} {f₁ f₂ : A → B → B} {e₁ e₂ : B} → (∀ x y → f₁ x y ≡ f₂ x y) → e₁ ≡ e₂ → foldr f₁ e₁ ≗ foldr f₂ e₂ foldr-cong {f₁ = f₁} {f₂} {e} f₁≗₂f₂ refl = begin foldr f₁ e ≈⟨ P.cong (foldr f₁ e) ∘ idIsFold ⟩ foldr f₁ e ∘ foldr _∷_ [] ≈⟨ foldr-fusion (foldr f₁ e) [] (λ x xs → f₁≗₂f₂ x (foldr f₁ e xs)) ⟩ foldr f₂ e ∎ where open EqR (P._→-setoid_ _ _) map-cong : ∀ {a b} {A : Set a} {B : Set b} {f g : A → B} → f ≗ g → map f ≗ map g map-cong {A = A} {B} {f} {g} f≗g = begin map f ≈⟨ mapIsFold ⟩ foldr (λ x ys → f x ∷ ys) [] ≈⟨ foldr-cong (λ x ys → P.cong₂ _∷_ (f≗g x) refl) refl ⟩ foldr (λ x ys → g x ∷ ys) [] ≈⟨ P.sym ∘ mapIsFold {A = A} {B = B} ⟩ map g ∎ where open EqR (P._→-setoid_ _ _) -- Take, drop, and splitAt. take++drop : ∀ {a} {A : Set a} n (xs : List A) → take n xs ++ drop n xs ≡ xs take++drop zero xs = refl take++drop (suc n) [] = refl take++drop (suc n) (x ∷ xs) = P.cong (λ xs → x ∷ xs) (take++drop n xs) splitAt-defn : ∀ {a} {A : Set a} n → splitAt {A = A} n ≗ < take n , drop n > splitAt-defn zero xs = refl splitAt-defn (suc n) [] = refl splitAt-defn (suc n) (x ∷ xs) with splitAt n xs | splitAt-defn n xs ... | (ys , zs) | ih = P.cong (Prod.map (_∷_ x) id) ih -- TakeWhile, dropWhile, and span. takeWhile++dropWhile : ∀ {a} {A : Set a} (p : A → Bool) (xs : List A) → takeWhile p xs ++ dropWhile p xs ≡ xs takeWhile++dropWhile p [] = refl takeWhile++dropWhile p (x ∷ xs) with p x ... | true = P.cong (_∷_ x) (takeWhile++dropWhile p xs) ... | false = refl span-defn : ∀ {a} {A : Set a} (p : A → Bool) → span p ≗ < takeWhile p , dropWhile p > span-defn p [] = refl span-defn p (x ∷ xs) with p x ... | true = P.cong (Prod.map (_∷_ x) id) (span-defn p xs) ... | false = refl -- Partition, filter. partition-defn : ∀ {a} {A : Set a} (p : A → Bool) → partition p ≗ < filter p , filter (not ∘ p) > partition-defn p [] = refl partition-defn p (x ∷ xs) with p x | partition p xs | partition-defn p xs ... | true | (ys , zs) | eq = P.cong (Prod.map (_∷_ x) id) eq ... | false | (ys , zs) | eq = P.cong (Prod.map id (_∷_ x)) eq filter-filters : ∀ {a p} {A : Set a} → (P : A → Set p) (dec : Decidable P) (xs : List A) → All P (filter (⌊_⌋ ∘ dec) xs) filter-filters P dec [] = [] filter-filters P dec (x ∷ xs) with dec x filter-filters P dec (x ∷ xs) | yes px = px ∷ filter-filters P dec xs filter-filters P dec (x ∷ xs) | no ¬px = filter-filters P dec xs -- Inits, tails, and scanr. scanr-defn : ∀ {a b} {A : Set a} {B : Set b} (f : A → B → B) (e : B) → scanr f e ≗ map (foldr f e) ∘ tails scanr-defn f e [] = refl scanr-defn f e (x ∷ []) = refl scanr-defn f e (x₁ ∷ x₂ ∷ xs) with scanr f e (x₂ ∷ xs) | scanr-defn f e (x₂ ∷ xs) ... | [] | () ... | y ∷ ys | eq with ∷-injective eq ... | y≡fx₂⦇f⦈xs , _ = P.cong₂ (λ z zs → f x₁ z ∷ zs) y≡fx₂⦇f⦈xs eq scanl-defn : ∀ {a b} {A : Set a} {B : Set b} (f : A → B → A) (e : A) → scanl f e ≗ map (foldl f e) ∘ inits scanl-defn f e [] = refl scanl-defn f e (x ∷ xs) = P.cong (_∷_ e) (begin scanl f (f e x) xs ≡⟨ scanl-defn f (f e x) xs ⟩ map (foldl f (f e x)) (inits xs) ≡⟨ refl ⟩ map (foldl f e ∘ (_∷_ x)) (inits xs) ≡⟨ map-compose (inits xs) ⟩ map (foldl f e) (map (_∷_ x) (inits xs)) ∎) where open P.≡-Reasoning -- Length. length-map : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) xs → length (map f xs) ≡ length xs length-map f [] = refl length-map f (x ∷ xs) = P.cong suc (length-map f xs) length-++ : ∀ {a} {A : Set a} (xs : List A) {ys} → length (xs ++ ys) ≡ length xs + length ys length-++ [] = refl length-++ (x ∷ xs) = P.cong suc (length-++ xs) length-replicate : ∀ {a} {A : Set a} n {x : A} → length (replicate n x) ≡ n length-replicate zero = refl length-replicate (suc n) = P.cong suc (length-replicate n) length-gfilter : ∀ {a b} {A : Set a} {B : Set b} (p : A → Maybe B) xs → length (gfilter p xs) ≤ length xs length-gfilter p [] = z≤n length-gfilter p (x ∷ xs) with p x length-gfilter p (x ∷ xs) | just y = s≤s (length-gfilter p xs) length-gfilter p (x ∷ xs) | nothing = ≤-step (length-gfilter p xs) -- Reverse. unfold-reverse : ∀ {a} {A : Set a} (x : A) (xs : List A) → reverse (x ∷ xs) ≡ reverse xs ∷ʳ x unfold-reverse x xs = begin foldl (flip _∷_) [ x ] xs ≡⟨ helper [ x ] xs ⟩ reverse xs ∷ʳ x ∎ where open P.≡-Reasoning helper : ∀ {a} {A : Set a} (xs ys : List A) → foldl (flip _∷_) xs ys ≡ reverse ys ++ xs helper xs [] = P.refl helper xs (y ∷ ys) = begin foldl (flip _∷_) (y ∷ xs) ys ≡⟨ helper (y ∷ xs) ys ⟩ reverse ys ++ y ∷ xs ≡⟨ P.sym $ LM.assoc (reverse ys) _ _ ⟩ (reverse ys ∷ʳ y) ++ xs ≡⟨ P.sym $ P.cong (λ zs → zs ++ xs) (unfold-reverse y ys) ⟩ reverse (y ∷ ys) ++ xs ∎ reverse-++-commute : ∀ {a} {A : Set a} (xs ys : List A) → reverse (xs ++ ys) ≡ reverse ys ++ reverse xs reverse-++-commute {a} [] ys = begin reverse ys ≡⟨ P.sym $ proj₂ {a = a} {b = a} LM.identity _ ⟩ reverse ys ++ [] ≡⟨ P.refl ⟩ reverse ys ++ reverse [] ∎ where open P.≡-Reasoning reverse-++-commute (x ∷ xs) ys = begin reverse (x ∷ xs ++ ys) ≡⟨ unfold-reverse x (xs ++ ys) ⟩ reverse (xs ++ ys) ++ [ x ] ≡⟨ P.cong (λ zs → zs ++ [ x ]) (reverse-++-commute xs ys) ⟩ (reverse ys ++ reverse xs) ++ [ x ] ≡⟨ LM.assoc (reverse ys) _ _ ⟩ reverse ys ++ (reverse xs ++ [ x ]) ≡⟨ P.sym $ P.cong (λ zs → reverse ys ++ zs) (unfold-reverse x xs) ⟩ reverse ys ++ reverse (x ∷ xs) ∎ where open P.≡-Reasoning reverse-map-commute : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) → (xs : List A) → map f (reverse xs) ≡ reverse (map f xs) reverse-map-commute f [] = refl reverse-map-commute f (x ∷ xs) = begin map f (reverse (x ∷ xs)) ≡⟨ P.cong (map f) $ unfold-reverse x xs ⟩ map f (reverse xs ∷ʳ x) ≡⟨ map-++-commute f (reverse xs) ([ x ]) ⟩ map f (reverse xs) ∷ʳ f x ≡⟨ P.cong (λ y → y ∷ʳ f x) $ reverse-map-commute f xs ⟩ reverse (map f xs) ∷ʳ f x ≡⟨ P.sym $ unfold-reverse (f x) (map f xs) ⟩ reverse (map f (x ∷ xs)) ∎ where open P.≡-Reasoning reverse-involutive : ∀ {a} {A : Set a} → Involutive (reverse {A = A}) reverse-involutive [] = refl reverse-involutive (x ∷ xs) = begin reverse (reverse (x ∷ xs)) ≡⟨ P.cong reverse $ unfold-reverse x xs ⟩ reverse (reverse xs ∷ʳ x) ≡⟨ reverse-++-commute (reverse xs) ([ x ]) ⟩ x ∷ reverse (reverse (xs)) ≡⟨ P.cong (λ y → x ∷ y) $ reverse-involutive xs ⟩ x ∷ xs ∎ where open P.≡-Reasoning -- The list monad. module Monad where left-zero : ∀ {ℓ} {A B : Set ℓ} (f : A → List B) → (∅ >>= f) ≡ ∅ left-zero f = refl right-zero : ∀ {ℓ} {A B : Set ℓ} (xs : List A) → (xs >>= const ∅) ≡ ∅ {A = B} right-zero [] = refl right-zero (x ∷ xs) = right-zero xs private not-left-distributive : let xs = true ∷ false ∷ []; f = return; g = return in (xs >>= λ x → f x ∣ g x) ≢ ((xs >>= f) ∣ (xs >>= g)) not-left-distributive () right-distributive : ∀ {ℓ} {A B : Set ℓ} (xs ys : List A) (f : A → List B) → (xs ∣ ys >>= f) ≡ ((xs >>= f) ∣ (ys >>= f)) right-distributive [] ys f = refl right-distributive (x ∷ xs) ys f = begin f x ∣ (xs ∣ ys >>= f) ≡⟨ P.cong (_∣_ (f x)) $ right-distributive xs ys f ⟩ f x ∣ ((xs >>= f) ∣ (ys >>= f)) ≡⟨ P.sym $ LM.assoc (f x) _ _ ⟩ (f x ∣ (xs >>= f)) ∣ (ys >>= f) ∎ where open P.≡-Reasoning left-identity : ∀ {ℓ} {A B : Set ℓ} (x : A) (f : A → List B) → (return x >>= f) ≡ f x left-identity {ℓ} x f = proj₂ (LM.identity {a = ℓ}) (f x) right-identity : ∀ {a} {A : Set a} (xs : List A) → (xs >>= return) ≡ xs right-identity [] = refl right-identity (x ∷ xs) = P.cong (_∷_ x) (right-identity xs) associative : ∀ {ℓ} {A B C : Set ℓ} (xs : List A) (f : A → List B) (g : B → List C) → (xs >>= λ x → f x >>= g) ≡ (xs >>= f >>= g) associative [] f g = refl associative (x ∷ xs) f g = begin (f x >>= g) ∣ (xs >>= λ x → f x >>= g) ≡⟨ P.cong (_∣_ (f x >>= g)) $ associative xs f g ⟩ (f x >>= g) ∣ (xs >>= f >>= g) ≡⟨ P.sym $ right-distributive (f x) (xs >>= f) g ⟩ (f x ∣ (xs >>= f) >>= g) ∎ where open P.≡-Reasoning cong : ∀ {ℓ} {A B : Set ℓ} {xs₁ xs₂} {f₁ f₂ : A → List B} → xs₁ ≡ xs₂ → f₁ ≗ f₂ → (xs₁ >>= f₁) ≡ (xs₂ >>= f₂) cong {xs₁ = xs} refl f₁≗f₂ = P.cong concat (map-cong f₁≗f₂ xs) -- The applicative functor derived from the list monad. -- Note that these proofs (almost) show that RawIMonad.rawIApplicative -- is correctly defined. The proofs can be reused if proof components -- are ever added to RawIMonad and RawIApplicative. module Applicative where open P.≡-Reasoning private -- A variant of flip map. pam : ∀ {ℓ} {A B : Set ℓ} → List A → (A → B) → List B pam xs f = xs >>= return ∘ f -- ∅ is a left zero for _⊛_. left-zero : ∀ {ℓ} {A B : Set ℓ} (xs : List A) → ∅ ⊛ xs ≡ ∅ {A = B} left-zero xs = begin ∅ ⊛ xs ≡⟨ refl ⟩ (∅ >>= pam xs) ≡⟨ Monad.left-zero (pam xs) ⟩ ∅ ∎ -- ∅ is a right zero for _⊛_. right-zero : ∀ {ℓ} {A B : Set ℓ} (fs : List (A → B)) → fs ⊛ ∅ ≡ ∅ right-zero {ℓ} fs = begin fs ⊛ ∅ ≡⟨ refl ⟩ (fs >>= pam ∅) ≡⟨ (Monad.cong (refl {x = fs}) λ f → Monad.left-zero (return {ℓ = ℓ} ∘ f)) ⟩ (fs >>= λ _ → ∅) ≡⟨ Monad.right-zero fs ⟩ ∅ ∎ -- _⊛_ distributes over _∣_ from the right. right-distributive : ∀ {ℓ} {A B : Set ℓ} (fs₁ fs₂ : List (A → B)) xs → (fs₁ ∣ fs₂) ⊛ xs ≡ (fs₁ ⊛ xs ∣ fs₂ ⊛ xs) right-distributive fs₁ fs₂ xs = begin (fs₁ ∣ fs₂) ⊛ xs ≡⟨ refl ⟩ (fs₁ ∣ fs₂ >>= pam xs) ≡⟨ Monad.right-distributive fs₁ fs₂ (pam xs) ⟩ (fs₁ >>= pam xs) ∣ (fs₂ >>= pam xs) ≡⟨ refl ⟩ fs₁ ⊛ xs ∣ fs₂ ⊛ xs ∎ -- _⊛_ does not distribute over _∣_ from the left. private not-left-distributive : let fs = id ∷ id ∷ []; xs₁ = true ∷ []; xs₂ = true ∷ false ∷ [] in fs ⊛ (xs₁ ∣ xs₂) ≢ (fs ⊛ xs₁ ∣ fs ⊛ xs₂) not-left-distributive () -- Applicative functor laws. identity : ∀ {a} {A : Set a} (xs : List A) → return id ⊛ xs ≡ xs identity xs = begin return id ⊛ xs ≡⟨ refl ⟩ (return id >>= pam xs) ≡⟨ Monad.left-identity id (pam xs) ⟩ (xs >>= return) ≡⟨ Monad.right-identity xs ⟩ xs ∎ private pam-lemma : ∀ {ℓ} {A B C : Set ℓ} (xs : List A) (f : A → B) (fs : B → List C) → (pam xs f >>= fs) ≡ (xs >>= λ x → fs (f x)) pam-lemma xs f fs = begin (pam xs f >>= fs) ≡⟨ P.sym $ Monad.associative xs (return ∘ f) fs ⟩ (xs >>= λ x → return (f x) >>= fs) ≡⟨ Monad.cong (refl {x = xs}) (λ x → Monad.left-identity (f x) fs) ⟩ (xs >>= λ x → fs (f x)) ∎ composition : ∀ {ℓ} {A B C : Set ℓ} (fs : List (B → C)) (gs : List (A → B)) xs → return _∘′_ ⊛ fs ⊛ gs ⊛ xs ≡ fs ⊛ (gs ⊛ xs) composition {ℓ} fs gs xs = begin return _∘′_ ⊛ fs ⊛ gs ⊛ xs ≡⟨ refl ⟩ (return _∘′_ >>= pam fs >>= pam gs >>= pam xs) ≡⟨ Monad.cong (Monad.cong (Monad.left-identity _∘′_ (pam fs)) (λ f → refl {x = pam gs f})) (λ fg → refl {x = pam xs fg}) ⟩ (pam fs _∘′_ >>= pam gs >>= pam xs) ≡⟨ Monad.cong (pam-lemma fs _∘′_ (pam gs)) (λ _ → refl) ⟩ ((fs >>= λ f → pam gs (_∘′_ f)) >>= pam xs) ≡⟨ P.sym $ Monad.associative fs (λ f → pam gs (_∘′_ f)) (pam xs) ⟩ (fs >>= λ f → pam gs (_∘′_ f) >>= pam xs) ≡⟨ (Monad.cong (refl {x = fs}) λ f → pam-lemma gs (_∘′_ f) (pam xs)) ⟩ (fs >>= λ f → gs >>= λ g → pam xs (f ∘′ g)) ≡⟨ (Monad.cong (refl {x = fs}) λ f → Monad.cong (refl {x = gs}) λ g → P.sym $ pam-lemma xs g (return ∘ f)) ⟩ (fs >>= λ f → gs >>= λ g → pam (pam xs g) f) ≡⟨ (Monad.cong (refl {x = fs}) λ f → Monad.associative gs (pam xs) (return ∘ f)) ⟩ (fs >>= pam (gs >>= pam xs)) ≡⟨ refl ⟩ fs ⊛ (gs ⊛ xs) ∎ homomorphism : ∀ {ℓ} {A B : Set ℓ} (f : A → B) x → return f ⊛ return x ≡ return (f x) homomorphism f x = begin return f ⊛ return x ≡⟨ refl ⟩ (return f >>= pam (return x)) ≡⟨ Monad.left-identity f (pam (return x)) ⟩ pam (return x) f ≡⟨ Monad.left-identity x (return ∘ f) ⟩ return (f x) ∎ interchange : ∀ {ℓ} {A B : Set ℓ} (fs : List (A → B)) {x} → fs ⊛ return x ≡ return (λ f → f x) ⊛ fs interchange fs {x} = begin fs ⊛ return x ≡⟨ refl ⟩ (fs >>= pam (return x)) ≡⟨ (Monad.cong (refl {x = fs}) λ f → Monad.left-identity x (return ∘ f)) ⟩ (fs >>= λ f → return (f x)) ≡⟨ refl ⟩ (pam fs (λ f → f x)) ≡⟨ P.sym $ Monad.left-identity (λ f → f x) (pam fs) ⟩ (return (λ f → f x) >>= pam fs) ≡⟨ refl ⟩ return (λ f → f x) ⊛ fs ∎
src/ada/src/afrl-impact-impactautomationrequest-spark_boundary.adb
pat-rogers/OpenUxAS
0
4168
<reponame>pat-rogers/OpenUxAS<filename>src/ada/src/afrl-impact-impactautomationrequest-spark_boundary.adb package body afrl.impact.ImpactAutomationRequest.SPARK_Boundary with SPARK_Mode => Off is -------------------------------------- -- Get_EntityList_From_TrialRequest -- -------------------------------------- function Get_EntityList_From_TrialRequest (Request : ImpactAutomationRequest) return Int64_Vect is L : constant Vect_Int64_Acc := Request.getTrialRequest.getEntityList; begin return R : Int64_Vect do for E of L.all loop Int64_Vects.Append (R, E); end loop; end return; end Get_EntityList_From_TrialRequest; ---------------------------------------------- -- Get_OperatingRegion_From_TrialRequest -- ---------------------------------------------- function Get_OperatingRegion_From_TrialRequest (Request : ImpactAutomationRequest) return Int64 is (Request.getTrialRequest.getOperatingRegion); ------------------------------------ -- Get_TaskList_From_TrialRequest -- ------------------------------------ function Get_TaskList_From_TrialRequest (Request : ImpactAutomationRequest) return Int64_Vect is L : constant Vect_Int64_Acc := Request.getTrialRequest.getTaskList; begin return R : Int64_Vect do for E of L.all loop Int64_Vects.Append (R, E); end loop; end return; end Get_TaskList_From_TrialRequest; end afrl.impact.ImpactAutomationRequest.SPARK_Boundary;
alloy4fun_models/trashltl/models/4/yzRDXBSyYFmEYwtrq.als
Kaixi26/org.alloytools.alloy
0
4310
<filename>alloy4fun_models/trashltl/models/4/yzRDXBSyYFmEYwtrq.als open main pred idyzRDXBSyYFmEYwtrq_prop5 { some f: File | eventually always f not in File since f in Trash } pred __repair { idyzRDXBSyYFmEYwtrq_prop5 } check __repair { idyzRDXBSyYFmEYwtrq_prop5 <=> prop5o }
atari_st/scale.asm
michaelcmartin/bumbershoot
20
174120
<reponame>michaelcmartin/bumbershoot text hz_200 equ $04ba ;; Save original sound state in d6. move.w #7,-(sp) clr.w -(sp) move.w #28,-(sp) trap #14 addq.l #6,sp move.l d0,d6 move.w #16,d0 ; Channel A uses envelope move.w #8,d1 bsr sndreg move.w #18,d0 ; 4 second decay period move.w #11,d1 bsr sndreg move.w #122,d0 move.w #12,d1 bsr sndreg lea scale,a3 moveq #7,d3 loop: move.w (a3)+,d0 ; Load and set frequency clr.w d1 bsr sndreg lsr.w #8,d0 moveq #1,d1 bsr sndreg move.w #62,d0 ; Enable channel A moveq #7,d1 bsr sndreg clr.w d0 ; Gate envelope w/ decay pattern move.w #13,d1 bsr sndreg move.l #90,-(sp) ; Hold note for 450 ms bsr delay addq.l #4,sp tst.w d3 ; Is this the last note? beq next move.w #63,d0 ; If not, cut note for 50 ms moveq #7,d1 bsr sndreg move.l #10,-(sp) bsr delay addq.l #4,sp next: dbra d3,loop move.l #810,-(sp) ; Hold final note for 4.5s total bsr delay addq.l #4,sp clr.w d0 ; Channel A volume to 0 moveq #8,d1 bsr sndreg move.b d6,d0 ; Restore original channel config moveq #7,d1 bsr sndreg clr.w -(sp) ; End program trap #1 ;;; Write the byte value in d0 to the sound register in d1. ;;; Preserves all registers! sndreg: movem.l d0-d2/a0-a2,-(sp) and.w #15,d1 or.w #128,d1 move.w d1,-(sp) and.w #255,d0 move.w d0,-(sp) move.w #28,-(sp) trap #14 addq.l #6,sp movem.l (sp)+,d0-d2/a0-a2 rts ;;; delay (longword ticks) ;;; Delay for 'ticks' of the 200hz system clock. Multiply d0 by 5 ;;; to get the delay time in milliseconds. ;;; Trashes d0-d2,a0-a2. delay: clr.l -(sp) ; Enter supervisor mode move.w #32,-(sp) ; Super() trap #1 ; GEMDOS. User stack in d0. move.l d0,2(sp) ; Set up stack for restoring user mode move.w #32,(sp) move.l 10(sp),d0 ; d0 = target duration add.l hz_200,d0 ; d0 = target time .buzz: cmp.l hz_200,d0 ; Wait until timer hits target bhi.s .buzz trap #1 ; Restore user mode addq.l #6,sp ; Restore stack rts data scale: dc.w 478,426,379,358,319,284,253,239
01-Tooling/01-simple-script.applescript
Rolias/discover-applescript
0
1111
tell application "System Preferences" activate set the current pane to pane "Displays" end tell
Code/game-demo/brik.asm
ElectronicsTinkerer/PIC16-VIDEO
1
80841
<gh_stars>1-10 ; ; PIC16F84A VIDEO Flappy Block Game ; <NAME> 2021 ; processor 16F84A ; Define processor #include <xc.inc> ; CONFIG CONFIG FOSC = HS ; Oscillator Selection bits (HS oscillator) CONFIG WDTE = OFF ; Watchdog Timer (WDT disabled) CONFIG PWRTE = OFF ; Power-up Timer Enable bit (Power-up Timer is disabled) CONFIG CP = OFF ; Code Protection bit (Code protection disabled) ; Destination bits #define W 0 #define F 1 ; Register bits #define C 0 ; Carry flag (STATUS) #define Z 2 ; Zero flag (STATUS) #define RP0 5 ; Register bank select (STATUS) #define T0IF 2 ; Timer 0 IRQ status (INTCON) #define T0IE 5 ; Timer 0 IRQ enable (INTCON) #define GIE 7 ; Global IRQ enable (INTCON) ; Misc vars (Leading '_' indicates define, not memory location) #define _NUM_PILLARS 4 #define _PLAYER_ACCEL 0x01 #define _PLAYER_JMP_VEL 0x0B ; Player Jump Velocity ; Game States #define _GAMES_TITLE 0 #define _GAMES_ACTIVE 1 #define _GAMES_DEAD 2 ; Timing vars #define _DEBOUNCE_TIMEOUT 15 ; Timeout between DEAD and ACTIVE states (# OF FRAMES) ; ------------------------------------------------------------------------------ ; ; RAM VARIABLES ; ; ------------------------------------------------------------------------------ ; RAM objects, BANK 0 PSECT MainData,global,class=RAM,space=1,delta=1,noexec ; Vars for sync generation LINE_L: DS 1 ; Current Line Low LINE_H: DS 1 ; Current Line High ; 0..1 - High part of line counter ; 2..6 - Unused ; 7 - Active video region if high, low for display blanking FRAME: DS 1 ; Stores frame number FRAME_SFT: DS 1 ; Stores the frame used for line shifting OBS_POS: DS _NUM_PILLARS ; Obstacle positions ; [0..2] - Pixel location ; [3..4] - H-byte position ; [5..7] - Hole location TEMP_PTRN: DS 1 ; Temporary storage for pattern calculation CNT_PTRN: DS 1 ; Count for pattern calculation PTRN_BUF: DS 4 ; Pattern buffer for next 7 lines PRAND: DS 1 ; Pseudo-random numbers PLAYER_POS: DS 1 ; Player y-coord PLAYER_VEL: DS 1 ; Player y-velocity GAME_STATE: DS 1 ; Game State (_GAMES_xx defines) DBNCE_TMOT: DS 1 ; Debounce timeout for going from DEAD to ACTIVE states PILLAR_CNT: DS 1 ; Number of currently active pillars in the game SCORE_L: DS 1 ; Low byte of score counter SCORE_H: DS 1 ; High byte of score counter ; ------------------------------------------------------------------------------ ; ; Reset vector ; ; ------------------------------------------------------------------------------ ; -pRESET_VEC=0h PSECT RESET_VEC,global,class=CODE,reloc=2 GLOBAL RESET_VEC RESET_VEC: GOTO INIT ; Jump to initialization ; ------------------------------------------------------------------------------ ; ; Interrupt vector ; Must be in BANK 0 when this is called! ; Does not preserve W register! ; ; ------------------------------------------------------------------------------ ; Take a look at the following for PAL programming/timing info: ; http://www.nailed-barnacle.co.uk/avr/video.html ; https://www.avrfreaks.net/forum/ntsc-vsync-confusion ; http://blog.retroleum.co.uk/electronics-articles/previous/z80-project-the-early-years/ ; -pISR_VEC=4h PSECT ISR_VEC,global,class=CODE,delta=2 GLOBAL ISR_VEC ISR_VEC: CLRF PORTA ; Start sync period MOVLW (0xFF - 0x9F) ; Active video and back porch combined MOVWF TMR0 ; Start counter MOVLW 0x7F ; Clear active video region flag ANDWF LINE_H BTFSS LINE_H, 1 ; If line high == 2, check line number GOTO ISR_CHECK_BLANK1 ; If not, just output standard 4.8uS sync MOVLW (0x39 - 2) ; "First" 2+1 lines are VSYNC SUBWF LINE_L, W ; Are we doing VSYNC? BTFSC STATUS, C GOTO ISR_UPDATE_LINE ; Yes, don't turn back on the sync GOTO ISR_CHECK_BLANK ; No, use normal 4.8uS sync ISR_CHECK_BLANK1: ; This affects h-hold for the following 2 lines NOP ; after LINE_H goes from 2 to 1 NOP ; (A.K.A.: you need this (potentially)) NOP NOP ISR_CHECK_BLANK: ; Check if we are in active frame area BTFSS LINE_H, 1 GOTO ISR_END_SYNC_EOF MOVLW (0x39 - 55) ; Ignore first 55 lines SUBWF LINE_L, W BTFSS STATUS, C ; If in active video region, set the flag GOTO ISR_END_SYNC_AVR GOTO ISR_END_SYNC ISR_END_SYNC_EOF: ; EOF: (Towards) End Of Frame MOVLW 18 ; Ignore last 18 lines SUBWF LINE_L, W BTFSC STATUS, C ; Should the screen blank? GOTO ISR_END_SYNC_AVR ; No GOTO ISR_END_SYNC ; Yes ISR_END_SYNC_AVR: ; AVR: Active Video Region (What, did you think I BSF LINE_H, 7 ; meant an Arduino or something? ;) ISR_END_SYNC: NOP MOVLW 0X14 ; End sync period MOVWF PORTA ISR_UPDATE_LINE: DECFSZ LINE_L ; Next Line GOTO ISR_RESET_SYNC1 ; If not 0, don't bother with high byte DECF LINE_H ; High byte of line MOVF LINE_H, W ANDLW 0x03 ; Mask off status bits BTFSS STATUS, Z GOTO ISR_RESET_SYNC ; If not 0, no need for ending of frame ; End of frame MOVLW 0x39 ; Load the low count value to row counter MOVWF LINE_L ; There are ~312.5 lines per frame in PAL MOVLW 0x02 ; Reset the high byte of line counter MOVWF LINE_H INCF FRAME ; Next frame GOTO ISR_RESET_SYNC ISR_RESET_SYNC1: MOVLW 0xFF ; If LINE_L is 0xFF, it means that the above code XORWF LINE_L, W ; improperly set the "Active video region" flag, BTFSC STATUS, Z ; so set it here. BSF LINE_H, 7 NOP NOP ISR_RESET_SYNC: BCF INTCON, T0IF ; Clear interrupt BTFSS LINE_H, 7 ; Only display video in AVR GOTO IVR_SERVICE ; Do stuff in non-active video region ; ----------------------------------------------------- ; The following is for generating scanlines ; ----------------------------------------------------- DISPLAY_LINE: MOVLW 0X07 ANDWF LINE_L, W BTFSC STATUS, Z ; Skip every 8th line to calculate the next 7 GOTO CALC_NEXT_LINE ; PUT YOUR DRAWING CODE HERE --------------------------- ; Check game mode MOVLW (1 << _GAMES_ACTIVE) | (1 << _GAMES_DEAD) ANDWF GAME_STATE, W BTFSS STATUS, Z GOTO DISPLAY_ACTIVE NOP ; Move non-active regions over a (few) bits NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP GOTO LINE_BITS ; Go draw that line DISPLAY_ACTIVE: MOVF PLAYER_POS, W ; Check and make sure that the line number ; ANDLW 0xE0 ; Is "close" to the location of the PLAYER SUBWF LINE_L, W ; ANDLW 0xE0 BTFSS STATUS, C GOTO ISR_NORM_LINE_OFFSET ; No Hole SUBLW 0x08 ; Defines height of player BTFSS STATUS, C GOTO ISR_NORM_LINE ; No Hole NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP ; Move player to column 1 so collisions NOP ; are displayed in the right place NOP NOP NOP NOP NOP NOP MOVLW 0x1C MOVWF PORTA NOP NOP MOVLW 0x14 MOVWF PORTA CALL LINE_DELAY GOTO ISR_PLAYER_LINE_ENTRY ISR_NORM_LINE_OFFSET: NOP NOP NOP ISR_NORM_LINE: NOP CALL LINE_DELAY LINE_BITS: MOVLW 0X14 ; Byte 0 BTFSC PTRN_BUF, 7 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 6 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 5 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP ISR_PLAYER_LINE_ENTRY: MOVLW 0X14 BTFSC PTRN_BUF, 4 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 3 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 2 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 1 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF, 0 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 ; Byte 1 BTFSC PTRN_BUF+1, 7 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 6 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 5 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 4 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 3 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 2 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 1 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+1, 0 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 ; Byte 2 BTFSC PTRN_BUF+2, 7 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 6 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 5 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 4 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 3 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 2 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 1 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+2, 0 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 ; Byte 3 BTFSC PTRN_BUF+3, 7 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 6 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 5 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 4 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 3 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 2 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 1 IORLW 0x08 MOVWF PORTA, F NOP NOP NOP NOP MOVLW 0X14 BTFSC PTRN_BUF+3, 0 IORLW 0x08 MOVWF PORTA, F ; END YOUR DRAWING CODE HERE RETFIE ; Done with line ; ------------------------------------------------------------------------------ ; ; Executed during vertical blanking time ; This handles updating game variables and checking for user input ; ; ------------------------------------------------------------------------------ IVR_SERVICE: ; Only run when we get a timeout MOVF DBNCE_TMOT BTFSC STATUS, Z ; Only update game stuff when timer is 0 GOTO IVR_STATE_CHECK MOVLW 0x01 ; Once per frame, update the timeout count SUBWF LINE_L, W ; this has to happen after all updates BTFSS STATUS, Z ; occurring during the blanking period RETFIE ; otherwise the pillar spacing will be incorrect DECFSZ DBNCE_TMOT RETFIE CLRF FRAME ; Reset frame counter (needed for pillar placement) RETFIE IVR_STATE_CHECK: ; Check the game state BTFSC GAME_STATE, _GAMES_TITLE GOTO IVR_TITLE BTFSC GAME_STATE, _GAMES_ACTIVE GOTO IVR_ACTIVE BTFSC GAME_STATE, _GAMES_DEAD GOTO IVR_DEAD RETFIE ; default: break; ; ----------------- TITLE ---------------------- IVR_TITLE: BTFSC PORTB, 0 ; Check for new game RETFIE MOVLW 1 << _GAMES_ACTIVE ; If user pushed button, start active state MOVWF GAME_STATE CLRF FRAME ; Reset frame counter (needed for pillar placement) RETFIE ; ----------------- ACTIVE --------------------- IVR_ACTIVE: MOVF FRAME, W ; Copy the frame to the frame shift var MOVWF FRAME_SFT MOVLW 0x37 ; Check for collisions on line 0x137 SUBWF LINE_L, W BTFSC STATUS, Z GOTO IVR_CHECK_COLLISION MOVLW 0x01 ; Every 2 frames, update player movement ANDWF FRAME, W BTFSS STATUS, Z GOTO IVR_CHECK_FRAME MOVLW 0x35 ; Only move player once per frame SUBWF LINE_L, W BTFSC STATUS, Z GOTO IVR_MOVE_PLAYER IVR_CHECK_FRAME: MOVLW 0x07 ; Every 8 frames, move the pillars ANDWF FRAME, W BTFSS STATUS, Z RETFIE MOVLW 0x36 ; Only move pillars once per frame SUBWF LINE_L, W BTFSS STATUS, Z RETFIE ; Don't move pillars MOVLW 0x3F ; Every 64 frames, add a new pillar ANDWF FRAME, W BTFSS STATUS, Z GOTO IVR_MOVE_PILLARS ; Add a pillar MOVLW _NUM_PILLARS ; See if we have all the pillars SUBWF PILLAR_CNT, W BTFSC STATUS, Z GOTO IVR_MOVE_PILLARS ; We have all of them, don't add any more ; Don't have all of them, add one INCF PILLAR_CNT IVR_MOVE_PILLARS: MOVF PILLAR_CNT, W ; Setup pillar update loop MOVWF CNT_PTRN IVR_PILLAR_MOVE_LOOP: MOVF CNT_PTRN, W ADDLW OBS_POS-1 MOVWF FSR MOVF INDF, W ANDLW 0x1F ;3F BTFSS STATUS, Z ; Is this the end of the line? GOTO IVR_PILLAR_MOVE_LOOP_CONT ; No, don't change hole position ; Yes, CALL PRAND_GEN ; Move hole INCF PRAND ; Seed next number ADDLW 0x20 MOVWF INDF ; Save hole location INCF SCORE_L ; Update score (counting in BCD) MOVLW 0x0F ANDWF SCORE_L, W SUBLW 0x09 BTFSC STATUS, C ; Check for overflow GOTO IVR_PILLAR_MOVE_LOOP_CONT ; No overflow MOVLW 0xF0 ; Carry ANDWF SCORE_L MOVLW 0x10 ADDWF SCORE_L BTFSS STATUS, C ; Check for overflow GOTO IVR_PILLAR_MOVE_LOOP_CONT ; No overflow INCF SCORE_H ; Carry MOVLW 0x0F ANDWF SCORE_H, W SUBLW 0x09 BTFSC STATUS, C ; Check for overflow GOTO IVR_PILLAR_MOVE_LOOP_CONT ; No overflow MOVLW 0xF0 ; Carry ANDWF SCORE_H MOVLW 0x10 ADDWF SCORE_H IVR_PILLAR_MOVE_LOOP_CONT: DECF INDF ; Move pillar left DECF CNT_PTRN ; Are we done with the pillar updates? BTFSS STATUS, Z GOTO IVR_PILLAR_MOVE_LOOP ; No RETFIE ; Yes IVR_MOVE_PLAYER: MOVLW _PLAYER_JMP_VEL BTFSS PORTB, 0 ; If the player has pressed the button, "flap" MOVWF PLAYER_VEL MOVLW _PLAYER_ACCEL SUBWF PLAYER_VEL MOVLW 0xF0 ; Limit player velocity SUBWF PLAYER_VEL, W BTFSC STATUS, C GOTO IVR_MOD_POS BTFSS PLAYER_VEL, 7 ; Bit 7 indicates a negative if set GOTO IVR_MOD_POS ; So only limit player velocity in negative dir MOVLW 0xF0 MOVWF PLAYER_VEL IVR_MOD_POS: RLF PLAYER_VEL, W ; Save velocity sign bit RRF PLAYER_VEL, W ; Divide velocity by 2 ADDWF PLAYER_POS ; Update player position ; Keep player within bounds MOVLW 0xFF - _PLAYER_JMP_VEL ; To prevent tunneling, use max vel as compare val SUBWF PLAYER_POS, W BTFSC STATUS, C GOTO IVR_UPPER_LIMIT ; Upper limit on position, cap it MOVLW 0x10 ; Bottom position on screen SUBWF PLAYER_POS, W BTFSC STATUS, C RETFIE ; No need to bound the player position MOVLW 0x10 ; Bound player at bottom of screen MOVWF PLAYER_POS RETFIE IVR_UPPER_LIMIT: MOVLW 0xFF - _PLAYER_JMP_VEL ; Set player to max y position MOVWF PLAYER_POS CLRF PLAYER_VEL ; Also reset velocity so player starts falling RETFIE ; as soon as they release the button IVR_CHECK_COLLISION: ; BTFSC PORTB, 0 ; Debug, disable collision checking ; RETFIE ; until button is pressed MOVF PILLAR_CNT, W MOVWF CNT_PTRN IVR_COLLISION_LOOP: MOVF CNT_PTRN, W ; Get the current count ADDLW OBS_POS-1 ; Add it to the Object Position array base MOVWF FSR ; Set this as the FSR location MOVLW 0x1F ; Only want h-pos attribute ANDWF INDF, W ; Get the object position BTFSS STATUS, Z ; Only check for collisions if it is on the GOTO IVR_COLLISION_LOOP_CONT ; same column as the player MOVF INDF, W ANDLW 0xE0 ; Top of hole SUBWF PLAYER_POS, W ; Check and if that the player pos BTFSS STATUS, C ; Is "close" to the location of the hole GOTO IVR_HANDLE_COLLISION ; Collision SUBLW 0x20 ; Height of hole (top to bottom) BTFSC STATUS, C ; Sets the bottom location of the hole GOTO IVR_COLLISION_LOOP_CONT ; No collision ; Collision IVR_HANDLE_COLLISION: MOVLW 1 << _GAMES_DEAD ; Set game state to dead MOVWF GAME_STATE MOVLW _DEBOUNCE_TIMEOUT ; Wait a bit before accepting new clicks MOVWF DBNCE_TMOT RETFIE ; Repeat for each pillar IVR_COLLISION_LOOP_CONT: DECF CNT_PTRN BTFSS STATUS, Z GOTO IVR_COLLISION_LOOP RETFIE ; ----------------- DEAD ----------------------- IVR_DEAD: BTFSC PORTB, 0 ; Check to see if player restarts game RETFIE ; No button press ; Restart game CALL INIT_GAME MOVLW 1 << _GAMES_ACTIVE ; Go to active gameplay MOVWF GAME_STATE MOVLW _DEBOUNCE_TIMEOUT ; Set timeout MOVWF DBNCE_TMOT RETFIE ; ------------------------------------------------------------------------------ ; ; Calculates the next (7) lines of display ; Stores the result in PTRN_BUF ; ; ------------------------------------------------------------------------------ CALC_NEXT_LINE: ; Clear the pattern buffer CLRF PTRN_BUF CLRF PTRN_BUF+1 CLRF PTRN_BUF+2 CLRF PTRN_BUF+3 BTFSC GAME_STATE, _GAMES_TITLE GOTO CALC_TITLE BTFSC GAME_STATE, _GAMES_ACTIVE CALL CALC_ACTIVE BTFSC GAME_STATE, _GAMES_DEAD GOTO CALC_DEAD RETFIE ; ----------------- TITLE ---------------------- CALC_TITLE: MOVLW 0xD0 - 0x38 ; Check if we are two lines below the logo SUBWF LINE_L, W BTFSS STATUS, Z GOTO CALC_TITLE_TOP ; GOTO CALC_TITLE_BAR CALC_TITLE_TOP: MOVLW 0xD0 + 0x08 ; Check if we are two lines above the logo SUBWF LINE_L, W BTFSS STATUS, Z GOTO CALC_TITLE_LOGO ; If not, check if we need to draw the logo CALC_TITLE_BAR: MOVLW 0xFF ; If we are, draw a line below the text MOVWF PTRN_BUF+1 ADDLW 0xFF ; I won't admit that the logo is only 15 bits wide MOVWF PTRN_BUF+2 RETFIE CALC_TITLE_LOGO: MOVLW 0xD0 ; Top of title position SUBWF LINE_L, W ; Are we there yet? BTFSC STATUS, C RETFIE ; No ; Yes, check bottom bound BCF STATUS, C MOVLW 0xD0 - 0x28 ; Title is 5 lines tall SUBWF LINE_L, W ; Still within bounds? BTFSS STATUS, C RETFIE ; No, exit ; Yes, draw line of title BCF STATUS, C RRF LINE_L, W ; Get the line we are on, divide it by 3 MOVWF TEMP_PTRN ; In this case, we only care about bits [3..5] RRF TEMP_PTRN ; So shift those to the bottom ; RRF TEMP_PTRN MOVLW ((0xA0 + 0x08) >> 2) - 1 SUBWF TEMP_PTRN MOVLW 0x0E ANDWF TEMP_PTRN MOVF TEMP_PTRN, W CALL TITLE_BITMAP MOVWF PTRN_BUF+1 INCF TEMP_PTRN, W CALL TITLE_BITMAP MOVWF PTRN_BUF+2 RETFIE ; ----------------- ACTIVE --------------------- ; NOTE: this returns with the "RETURN" instruction, NOT "RETFIE" CALC_ACTIVE: BTFSC LINE_H, 1 ; If still above line 0xFF, don't display RETFIE ; Then take each OBS_POS and use it as an offset from the base of the pattern ; buffer. Shift in a 1 for the position of the pillar MOVF PILLAR_CNT, W MOVWF CNT_PTRN CALC_NEXT_LINE_LOOP: MOVF CNT_PTRN, W ; Get the current count ADDLW OBS_POS-1 ; Add it to the Object Position array base MOVWF FSR ; Set this as the FSR location RRF INDF, W ; Get the object's position MOVWF TEMP_PTRN ; In this case, we only care about bits [3..5] RRF TEMP_PTRN ; So shift those to the bottom RRF TEMP_PTRN MOVF TEMP_PTRN, W ; Get now add those bits as an offset to the ANDLW 0x03 ;7 ; pattern buffer base address to set the ADDLW PTRN_BUF ; byte in which to store the bit for the MOVWF TEMP_PTRN ; pillar. MOVF INDF, W ; Check and make sure that the line number ANDLW 0xE0 ; Is "close" to the location of the hole SUBWF LINE_L, W ; ANDLW 0xE0 BTFSS STATUS, C GOTO CALC_NEXT_LINE_DISP ; No Hole SUBLW 0x20 ; Height of hole (multiple of 8) BTFSC STATUS, C GOTO CALC_NEXT_LINE_LOOP_CONT ; Hole ; No Hole CALC_NEXT_LINE_DISP: ; Find the bit location of the pillar in the display byte MOVLW 0x07 ANDWF INDF, W CALL SHIFT_BIT XORWF TEMP_PTRN, W ; Swap W and F XORWF TEMP_PTRN XORWF TEMP_PTRN, W MOVWF FSR MOVF TEMP_PTRN, W IORWF INDF ; Save the pillar's bit pattern ; Repeat for each pillar CALC_NEXT_LINE_LOOP_CONT: DECF CNT_PTRN BTFSS STATUS, Z GOTO CALC_NEXT_LINE_LOOP RETURN ; ----------------- DEAD ----------------------- CALC_DEAD: CALL CALC_ACTIVE ; Display the position of the player at impact ; If we need to display the "DEAD" text, overlay that: MOVLW 0xD0 - 0x38 - 0x30 ; Check if we are two lines below the score SUBWF LINE_L, W BTFSS STATUS, Z GOTO CALC_DEAD_TOP ; GOTO CALC_DEAD_BAR CALC_DEAD_TOP: MOVLW 0xD0 + 0x08 ; Check if we are two lines above the logo SUBWF LINE_L, W BTFSS STATUS, Z GOTO CALC_DEAD_BLANK ; If not, check if we need to draw the logo CALC_DEAD_BAR: MOVLW 0xFF ; If we are, draw a line below the text MOVWF PTRN_BUF+1 ADDLW 0xFF ; I won't admit that the logo is only 15 bits wide MOVWF PTRN_BUF+2 RETFIE ; Check to see if we need to blank the line above or below the "DEAD" text CALC_DEAD_BLANK: MOVLW 0xD0 - 0x30 - 0x30 ; Check if we are one line below the score SUBWF LINE_L, W BTFSC STATUS, Z GOTO CALC_DEAD_BLANK_BAR MOVLW 0xD0 ; Check if we are one line above the logo SUBWF LINE_L, W BTFSC STATUS, Z GOTO CALC_DEAD_BLANK_BAR MOVLW 0xD0 - 0x30 ; Check for blank line between "DEAD" and score SUBWF LINE_L, W BTFSS STATUS, Z GOTO CALC_DEAD_SCORE ; If not, check if we need to draw the logo CALC_DEAD_BLANK_BAR: MOVLW 0x00 ; If we are, clear the line below the text MOVWF PTRN_BUF+1 MOVWF PTRN_BUF+2 RETFIE CALC_DEAD_SCORE: MOVLW 0xD0 - 0x30 ; Are we in the range of the score text? SUBWF LINE_L, W BTFSC STATUS, C GOTO CALC_DEAD_LOGO ; No MOVLW 0xD0 - 0x30 - 0x30 ; Text is 5 lines tall SUBWF LINE_L, W BTFSS STATUS, C ; Bottom of range GOTO CALC_DEAD_LOGO ; No MOVLW 0xD0 - 0x30 - 0x28 ; Sets up the line of the number bitmap SUBWF LINE_L, W ANDLW 0x38 MOVWF CNT_PTRN BCF STATUS, C RLF CNT_PTRN SWAPF SCORE_L, W ; 10s place ANDLW 0x0F IORWF CNT_PTRN, W CALL NUM_BITMAP MOVWF PTRN_BUF+2 MOVF SCORE_L, W ; 1s place ANDLW 0x0F IORWF CNT_PTRN, W CALL NUM_BITMAP SWAPF PTRN_BUF+2 IORWF PTRN_BUF+2 SWAPF SCORE_H, W ; 1000s place ANDLW 0x0F IORWF CNT_PTRN, W CALL NUM_BITMAP MOVWF PTRN_BUF+1 MOVF SCORE_H, W ; 100s place ANDLW 0x0F IORWF CNT_PTRN, W CALL NUM_BITMAP SWAPF PTRN_BUF+1 IORWF PTRN_BUF+1 RETFIE ; Display the "DEAD" text CALC_DEAD_LOGO: MOVLW 0xD0 ; Top of title position SUBWF LINE_L, W ; Are we there yet? BTFSC STATUS, C RETFIE ; No ; Yes, check bottom bound MOVLW 0xD0 - 0x28 ; Title is 5 lines tall SUBWF LINE_L, W ; Still within bounds? BTFSS STATUS, C RETFIE ; No, exit ; Yes, draw line of title BCF STATUS, C RRF LINE_L, W ; Get the line we are on, divide it by 3 MOVWF TEMP_PTRN ; In this case, we only care about bits [3..5] RRF TEMP_PTRN ; So shift those to the bottom ; RRF TEMP_PTRN MOVLW ((0xA0 + 0x08) >> 2) - 1 SUBWF TEMP_PTRN MOVLW 0x0E ANDWF TEMP_PTRN MOVF TEMP_PTRN, W ; Store the character patterns in the pattern buffer CALL DEAD_BITMAP MOVWF PTRN_BUF+1 INCF TEMP_PTRN, W CALL DEAD_BITMAP MOVWF PTRN_BUF+2 RETFIE ; ------------------------------------------------------------------------------ ; ; Initialization ; ; ------------------------------------------------------------------------------ ;PSECT code INIT: ; PORT A setup BSF STATUS, RP0 ; BANK 1 MOVLW 0x03 ; PA[0..1] are inputs ; PA[2..4] are outputs MOVWF TRISA ; Store directions into direction register ; Port B setup MOVLW 0x01 ; PB[0] are inputs ; PB[1..7] are outputs MOVWF TRISB MOVWF PORTB ; Enable pullups ; Setup Timer 0 MOVLW 0x50 ; Use internal CLKOUT and prescaler ; set to /2 for Timer 0 ; Also, PORTB has pullups enabled MOVWF OPTION_REG ; Set options for timer MOVLW 0x01 ; Initialize line counter MOVWF LINE_L MOVWF LINE_H ; Also clears status bits BCF STATUS, RP0 ; BANK 0 CLRF PORTA ; Clear output data latches for A MOVWF TMR0 ; Initialize Timer 0 to a known value BSF INTCON, T0IE ; Enable Timer 0 IRQ BSF INTCON, GIE ; Global interrupt enable MOVLW 0x03 MOVWF PCLATH ; For lookup tables CALL INIT_GAME ; Initialize game vars MOVLW 1 << _GAMES_TITLE ; Start on the title screen MOVWF GAME_STATE ; Main loop MAIN: ; Wait around for next line, maybe get some tea... GOTO MAIN ; ------------------------------------------------------------------------------ ; ; Initializes the game variables (mostly, see below) ; Initializes: ; the number of pillars active, ; the score ; the debounce timer to 1 ; the player velocity ; the player position ; ; DOES NOT initialize: ; the gamestate ; the frame counter (either one) ; ; ------------------------------------------------------------------------------ INIT_GAME: ; Does not set game state CLRF PLAYER_VEL MOVLW 0x80 MOVWF PLAYER_POS CLRF SCORE_L CLRF SCORE_H MOVLW 0x01 MOVWF DBNCE_TMOT MOVWF PILLAR_CNT ; Reset to 1 visible pillar MOVLW _NUM_PILLARS ; Init Pillar locations MOVWF CNT_PTRN INIT_PIL_LOOP: MOVF CNT_PTRN, W ADDLW OBS_POS-1 MOVWF FSR CALL PRAND_GEN ADDLW PRAND ; Seed next number IORLW 0x1F MOVWF INDF INIT_PIL_LOOP_CONT: DECF CNT_PTRN ; Are we done with the updates? BTFSS STATUS, Z GOTO INIT_PIL_LOOP ; No DECF OBS_POS ; Correct spacing for the first pillar RETURN ; ------------------------------------------------------------------------------ ; ; Delays for a set number of machine cycles, as determined by the value in W[0..2] ; ; NOTE: this also includes a 4-cycle overhead for delay calculation ; ; ------------------------------------------------------------------------------ ; -pLINE_DELAY=300h PSECT LINE_DELAY,global,class=CODE,delta=2 LINE_DELAY: MOVF FRAME_SFT, W ANDLW 0x07 ; The pattern repeats ADDLW LINE_foo & 0xFF ; Add jump offset MOVWF PCL ; Jump to proper delay LINE_foo: NOP NOP NOP NOP NOP NOP NOP RETURN ; ------------------------------------------------------------------------------ ; ; Delays for a inverted number of machine cycles, as determined by the ; value in W[0..2] ; Useful for resyncing the h-position of elements on the screen after ; LINE_DELAY has been called ; ; NOTE: this also includes a 5-cycle overhead for delay calculation ; ; ------------------------------------------------------------------------------ LINE_ANTI_DELAY: MOVF FRAME_SFT, W XORLW 0x07 ; Opposite count direction ANDLW 0x07 ; The pattern repeats ADDLW LINE_foo2 & 0xFF ; Add jump offset MOVWF PCL ; Jump to proper delay LINE_foo2: NOP NOP NOP NOP NOP NOP NOP RETURN ; ------------------------------------------------------------------------------ ; ; Shift a bit. Returns with the bit set corresponding to the inverted value of ; W[0..2] ; ; NOTE: There is no sanity check, so do not call with a value greater than ; 0x07 in W otherwise bad things might happen ; ; ------------------------------------------------------------------------------ SHIFT_BIT: ADDLW SHIFT_BIT_LUT & 0xFF MOVWF PCL SHIFT_BIT_LUT: RETLW 0x80 RETLW 0x40 RETLW 0x20 RETLW 0x10 RETLW 0x08 RETLW 0x04 RETLW 0x02 RETLW 0x01 ; ------------------------------------------------------------------------------ ; ; Pseudo-random number "loopup table" - Very random :) ; Call to get a number ; W affects the value returned ; Be sure to re-seed the number in PRAND after calling, or you will always get ; the same number for a given W ; ; ------------------------------------------------------------------------------ PRAND_GEN: ADDWF PRAND, W ANDLW 0x1F ADDLW PRAND_GEN_LUT & 0xFF MOVWF PCL PRAND_GEN_LUT: ; Random.org RETLW 6 << 5 RETLW 4 << 5 RETLW 6 << 5 RETLW 5 << 5 RETLW 6 << 5 RETLW 5 << 5 RETLW 5 << 5 RETLW 3 << 5 RETLW 4 << 5 RETLW 5 << 5 RETLW 4 << 5 RETLW 3 << 5 RETLW 6 << 5 RETLW 4 << 5 RETLW 5 << 5 RETLW 6 << 5 RETLW 2 << 5 RETLW 5 << 5 RETLW 4 << 5 RETLW 6 << 5 RETLW 4 << 5 RETLW 5 << 5 RETLW 2 << 5 RETLW 2 << 5 RETLW 2 << 5 RETLW 6 << 5 RETLW 2 << 5 RETLW 6 << 5 RETLW 3 << 5 RETLW 5 << 5 RETLW 3 << 5 RETLW 5 << 5 ; ------------------------------------------------------------------------------ ; ; Returns the bit patterns for displaying the title "BRIK" logo. ; ; Odd values of W return the bit patterns for "IK" and even for "BR" ; ; ------------------------------------------------------------------------------ ; Call this initially with W holding 0xff TITLE_BITMAP: ANDLW 0x0F ; Sanity check ADDLW TITLE_BITMAP_LUT & 0xFF MOVWF PCL TITLE_BITMAP_LUT: RETLW 0b11001010 RETLW 0b11101010 RETLW 0b10101100 RETLW 0b01001010 RETLW 0b11001010 RETLW 0b01001100 RETLW 0b10101010 RETLW 0b01001010 RETLW 0b11001100 RETLW 0b11101000 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; ------------------------------------------------------------------------------ ; ; Returns the bit patterns for displaying the "SCOR" text. ; ; Odd values of W return the bit patterns for "OR" and even for "SC" ; ; ------------------------------------------------------------------------------ DEAD_BITMAP: ANDLW 0x0F ; Sanity check ADDLW DEAD_BITMAP_LUT & 0xFF MOVWF PCL DEAD_BITMAP_LUT: RETLW 0b11101110 RETLW 0b11101010 RETLW 0b00101000 RETLW 0b10101100 RETLW 0b11101000 RETLW 0b10101010 RETLW 0b10001000 RETLW 0b10101010 RETLW 0b11101110 RETLW 0b11101100 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; ------------------------------------------------------------------------------ ; ; Returns the bit pattern for displaying numbers 0 through 9 ; Bit patterns are returned in W[0..3] ; ; W[0..3] - Number to display ; W[4..6] - Bitmap line number ; W[7] - Unused ; ; ------------------------------------------------------------------------------ NUM_BITMAP: ANDLW 0x7F ADDLW NUM_BITMAP_LUT & 0xFF MOVWF PCL NUM_BITMAP_LUT: ; Line 4 RETLW 0b1110 ;0 RETLW 0b1110 ;1 RETLW 0b1110 ;2 RETLW 0b1110 ;3 RETLW 0b0010 ;4 RETLW 0b1110 ;5 RETLW 0b1110 ;6 RETLW 0b0100 ;7 RETLW 0b1110 ;8 RETLW 0b0010 ;9 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; Line 3 RETLW 0b1010 ;0 RETLW 0b0100 ;1 RETLW 0b1000 ;2 RETLW 0b0010 ;3 RETLW 0b0010 ;4 RETLW 0b0010 ;5 RETLW 0b1010 ;6 RETLW 0b0100 ;7 RETLW 0b1010 ;8 RETLW 0b0010 ;9 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; Line 2 RETLW 0b1010 ;0 RETLW 0b0100 ;1 RETLW 0b0100 ;2 RETLW 0b0110 ;3 RETLW 0b1110 ;4 RETLW 0b1110 ;5 RETLW 0b1110 ;6 RETLW 0b0010 ;7 RETLW 0b1110 ;8 RETLW 0b1110 ;9 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; Line 1 RETLW 0b1010 ;0 RETLW 0b1100 ;1 RETLW 0b0010 ;2 RETLW 0b0010 ;3 RETLW 0b1010 ;4 RETLW 0b1000 ;5 RETLW 0b1000 ;6 RETLW 0b0010 ;7 RETLW 0b1010 ;8 RETLW 0b1010 ;9 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 ; Line 0 RETLW 0b1110 ;0 RETLW 0b0100 ;1 RETLW 0b1110 ;2 RETLW 0b1110 ;3 RETLW 0b1010 ;4 RETLW 0b1110 ;5 RETLW 0b1110 ;6 RETLW 0b1110 ;7 RETLW 0b1110 ;8 RETLW 0b1110 ;9 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 RETLW 0x00 end
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-alleve__hard.ads
djamal2727/Main-Bearing-Analytical-Model
0
61
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . A L T I V E C . L O W _ L E V E L _ V E C T O R S -- -- -- -- S p e c -- -- (Hard Binding Version) -- -- -- -- Copyright (C) 2004-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This unit exposes the low level vector support for the Hard binding, -- intended for AltiVec capable targets. See Altivec.Design for a description -- of what is expected to be exposed. package GNAT.Altivec.Low_Level_Vectors is pragma Elaborate_Body; ---------------------------------------- -- Low-level Vector Type Declarations -- ---------------------------------------- type LL_VUC is private; type LL_VSC is private; type LL_VBC is private; type LL_VUS is private; type LL_VSS is private; type LL_VBS is private; type LL_VUI is private; type LL_VSI is private; type LL_VBI is private; type LL_VF is private; type LL_VP is private; ------------------------------------ -- Low-level Functional Interface -- ------------------------------------ function abs_v16qi (A : LL_VSC) return LL_VSC; function abs_v8hi (A : LL_VSS) return LL_VSS; function abs_v4si (A : LL_VSI) return LL_VSI; function abs_v4sf (A : LL_VF) return LL_VF; function abss_v16qi (A : LL_VSC) return LL_VSC; function abss_v8hi (A : LL_VSS) return LL_VSS; function abss_v4si (A : LL_VSI) return LL_VSI; function vaddubm (A : LL_VSC; B : LL_VSC) return LL_VSC; function vadduhm (A : LL_VSS; B : LL_VSS) return LL_VSS; function vadduwm (A : LL_VSI; B : LL_VSI) return LL_VSI; function vaddfp (A : LL_VF; B : LL_VF) return LL_VF; function vaddcuw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vaddubs (A : LL_VSC; B : LL_VSC) return LL_VSC; function vaddsbs (A : LL_VSC; B : LL_VSC) return LL_VSC; function vadduhs (A : LL_VSS; B : LL_VSS) return LL_VSS; function vaddshs (A : LL_VSS; B : LL_VSS) return LL_VSS; function vadduws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vaddsws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vand (A : LL_VSI; B : LL_VSI) return LL_VSI; function vandc (A : LL_VSI; B : LL_VSI) return LL_VSI; function vavgub (A : LL_VSC; B : LL_VSC) return LL_VSC; function vavgsb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vavguh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vavgsh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vavguw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vavgsw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vcmpbfp (A : LL_VF; B : LL_VF) return LL_VSI; function vcmpequb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vcmpequh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vcmpequw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vcmpeqfp (A : LL_VF; B : LL_VF) return LL_VF; function vcmpgefp (A : LL_VF; B : LL_VF) return LL_VF; function vcmpgtub (A : LL_VSC; B : LL_VSC) return LL_VSC; function vcmpgtsb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vcmpgtuh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vcmpgtsh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vcmpgtuw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vcmpgtsw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vcmpgtfp (A : LL_VF; B : LL_VF) return LL_VF; function vcfux (A : LL_VUI; B : c_int) return LL_VF; function vcfsx (A : LL_VSI; B : c_int) return LL_VF; function vctsxs (A : LL_VF; B : c_int) return LL_VSI; function vctuxs (A : LL_VF; B : c_int) return LL_VUI; procedure dss (A : c_int); procedure dssall; procedure dst (A : c_ptr; B : c_int; C : c_int); procedure dstst (A : c_ptr; B : c_int; C : c_int); procedure dststt (A : c_ptr; B : c_int; C : c_int); procedure dstt (A : c_ptr; B : c_int; C : c_int); function vexptefp (A : LL_VF) return LL_VF; function vrfim (A : LL_VF) return LL_VF; function lvx (A : c_long; B : c_ptr) return LL_VSI; function lvebx (A : c_long; B : c_ptr) return LL_VSC; function lvehx (A : c_long; B : c_ptr) return LL_VSS; function lvewx (A : c_long; B : c_ptr) return LL_VSI; function lvxl (A : c_long; B : c_ptr) return LL_VSI; function vlogefp (A : LL_VF) return LL_VF; function lvsl (A : c_long; B : c_ptr) return LL_VSC; function lvsr (A : c_long; B : c_ptr) return LL_VSC; function vmaddfp (A : LL_VF; B : LL_VF; C : LL_VF) return LL_VF; function vmhaddshs (A : LL_VSS; B : LL_VSS; C : LL_VSS) return LL_VSS; function vmaxub (A : LL_VSC; B : LL_VSC) return LL_VSC; function vmaxsb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vmaxuh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vmaxsh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vmaxuw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vmaxsw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vmaxfp (A : LL_VF; B : LL_VF) return LL_VF; function vmrghb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vmrghh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vmrghw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vmrglb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vmrglh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vmrglw (A : LL_VSI; B : LL_VSI) return LL_VSI; function mfvscr return LL_VSS; function vminfp (A : LL_VF; B : LL_VF) return LL_VF; function vminsb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vminsh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vminsw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vminub (A : LL_VSC; B : LL_VSC) return LL_VSC; function vminuh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vminuw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vmladduhm (A : LL_VSS; B : LL_VSS; C : LL_VSS) return LL_VSS; function vmhraddshs (A : LL_VSS; B : LL_VSS; C : LL_VSS) return LL_VSS; function vmsumubm (A : LL_VSC; B : LL_VSC; C : LL_VSI) return LL_VSI; function vmsummbm (A : LL_VSC; B : LL_VSC; C : LL_VSI) return LL_VSI; function vmsumuhm (A : LL_VSS; B : LL_VSS; C : LL_VSI) return LL_VSI; function vmsumshm (A : LL_VSS; B : LL_VSS; C : LL_VSI) return LL_VSI; function vmsumuhs (A : LL_VSS; B : LL_VSS; C : LL_VSI) return LL_VSI; function vmsumshs (A : LL_VSS; B : LL_VSS; C : LL_VSI) return LL_VSI; procedure mtvscr (A : LL_VSI); function vmuleub (A : LL_VSC; B : LL_VSC) return LL_VSS; function vmuleuh (A : LL_VSS; B : LL_VSS) return LL_VSI; function vmulesb (A : LL_VSC; B : LL_VSC) return LL_VSS; function vmulesh (A : LL_VSS; B : LL_VSS) return LL_VSI; function vmulosb (A : LL_VSC; B : LL_VSC) return LL_VSS; function vmulosh (A : LL_VSS; B : LL_VSS) return LL_VSI; function vmuloub (A : LL_VSC; B : LL_VSC) return LL_VSS; function vmulouh (A : LL_VSS; B : LL_VSS) return LL_VSI; function vnmsubfp (A : LL_VF; B : LL_VF; C : LL_VF) return LL_VF; function vxor (A : LL_VSI; B : LL_VSI) return LL_VSI; function vnor (A : LL_VSI; B : LL_VSI) return LL_VSI; function vor (A : LL_VSI; B : LL_VSI) return LL_VSI; function vpkuhum (A : LL_VSS; B : LL_VSS) return LL_VSC; function vpkuwum (A : LL_VSI; B : LL_VSI) return LL_VSS; function vpkpx (A : LL_VSI; B : LL_VSI) return LL_VSS; function vpkuhus (A : LL_VSS; B : LL_VSS) return LL_VSC; function vpkuwus (A : LL_VSI; B : LL_VSI) return LL_VSS; function vpkshss (A : LL_VSS; B : LL_VSS) return LL_VSC; function vpkswss (A : LL_VSI; B : LL_VSI) return LL_VSS; function vpkshus (A : LL_VSS; B : LL_VSS) return LL_VSC; function vpkswus (A : LL_VSI; B : LL_VSI) return LL_VSS; function vperm_4si (A : LL_VSI; B : LL_VSI; C : LL_VSC) return LL_VSI; function vrefp (A : LL_VF) return LL_VF; function vrlb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vrlh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vrlw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vrfin (A : LL_VF) return LL_VF; function vrfip (A : LL_VF) return LL_VF; function vrfiz (A : LL_VF) return LL_VF; function vrsqrtefp (A : LL_VF) return LL_VF; function vsel_4si (A : LL_VSI; B : LL_VSI; C : LL_VSI) return LL_VSI; function vslb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vslh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vslw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsldoi_4si (A : LL_VSI; B : LL_VSI; C : c_int) return LL_VSI; function vsldoi_8hi (A : LL_VSS; B : LL_VSS; C : c_int) return LL_VSS; function vsldoi_16qi (A : LL_VSC; B : LL_VSC; C : c_int) return LL_VSC; function vsldoi_4sf (A : LL_VF; B : LL_VF; C : c_int) return LL_VF; function vsl (A : LL_VSI; B : LL_VSI) return LL_VSI; function vslo (A : LL_VSI; B : LL_VSI) return LL_VSI; function vspltb (A : LL_VSC; B : c_int) return LL_VSC; function vsplth (A : LL_VSS; B : c_int) return LL_VSS; function vspltw (A : LL_VSI; B : c_int) return LL_VSI; function vspltisb (A : c_int) return LL_VSC; function vspltish (A : c_int) return LL_VSS; function vspltisw (A : c_int) return LL_VSI; function vsrb (A : LL_VSC; B : LL_VSC) return LL_VSC; function vsrh (A : LL_VSS; B : LL_VSS) return LL_VSS; function vsrw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsrab (A : LL_VSC; B : LL_VSC) return LL_VSC; function vsrah (A : LL_VSS; B : LL_VSS) return LL_VSS; function vsraw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsr (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsro (A : LL_VSI; B : LL_VSI) return LL_VSI; procedure stvx (A : LL_VSI; B : c_int; C : c_ptr); procedure stvebx (A : LL_VSC; B : c_int; C : c_ptr); procedure stvehx (A : LL_VSS; B : c_int; C : c_ptr); procedure stvewx (A : LL_VSI; B : c_int; C : c_ptr); procedure stvxl (A : LL_VSI; B : c_int; C : c_ptr); function vsububm (A : LL_VSC; B : LL_VSC) return LL_VSC; function vsubuhm (A : LL_VSS; B : LL_VSS) return LL_VSS; function vsubuwm (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsubfp (A : LL_VF; B : LL_VF) return LL_VF; function vsubcuw (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsububs (A : LL_VSC; B : LL_VSC) return LL_VSC; function vsubsbs (A : LL_VSC; B : LL_VSC) return LL_VSC; function vsubuhs (A : LL_VSS; B : LL_VSS) return LL_VSS; function vsubshs (A : LL_VSS; B : LL_VSS) return LL_VSS; function vsubuws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsubsws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsum4ubs (A : LL_VSC; B : LL_VSI) return LL_VSI; function vsum4sbs (A : LL_VSC; B : LL_VSI) return LL_VSI; function vsum4shs (A : LL_VSS; B : LL_VSI) return LL_VSI; function vsum2sws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vsumsws (A : LL_VSI; B : LL_VSI) return LL_VSI; function vupkhsb (A : LL_VSC) return LL_VSS; function vupkhsh (A : LL_VSS) return LL_VSI; function vupkhpx (A : LL_VSS) return LL_VSI; function vupklsb (A : LL_VSC) return LL_VSS; function vupklsh (A : LL_VSS) return LL_VSI; function vupklpx (A : LL_VSS) return LL_VSI; function vcmpequb_p (A : c_int; B : LL_VSC; C : LL_VSC) return c_int; function vcmpequh_p (A : c_int; B : LL_VSS; C : LL_VSS) return c_int; function vcmpequw_p (A : c_int; B : LL_VSI; C : LL_VSI) return c_int; function vcmpeqfp_p (A : c_int; B : LL_VF; C : LL_VF) return c_int; function vcmpgtub_p (A : c_int; B : LL_VSC; C : LL_VSC) return c_int; function vcmpgtuh_p (A : c_int; B : LL_VSS; C : LL_VSS) return c_int; function vcmpgtuw_p (A : c_int; B : LL_VSI; C : LL_VSI) return c_int; function vcmpgtsb_p (A : c_int; B : LL_VSC; C : LL_VSC) return c_int; function vcmpgtsh_p (A : c_int; B : LL_VSS; C : LL_VSS) return c_int; function vcmpgtsw_p (A : c_int; B : LL_VSI; C : LL_VSI) return c_int; function vcmpgtfp_p (A : c_int; B : LL_VF; C : LL_VF) return c_int; function vcmpgefp_p (A : c_int; B : LL_VF; C : LL_VF) return c_int; function vcmpbfp_p (A : c_int; B : LL_VF; C : LL_VF) return c_int; private --------------------------------------- -- Low-level Vector Type Definitions -- --------------------------------------- -- [PIM-2.3.3 Alignment of aggregate and unions containing vector types]: -- "Aggregates (structures and arrays) and unions containing vector -- types must be aligned on 16-byte boundaries and their internal -- organization padded, if necessary, so that each internal vector -- type is aligned on a 16-byte boundary. This is an extension to -- all ABIs (AIX, Apple, SVR4, and EABI). -------------------------- -- char Core Components -- -------------------------- type LL_VUC is array (1 .. 16) of unsigned_char; for LL_VUC'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VUC, "vector_type"); pragma Suppress (All_Checks, LL_VUC); type LL_VSC is array (1 .. 16) of signed_char; for LL_VSC'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VSC, "vector_type"); pragma Suppress (All_Checks, LL_VSC); type LL_VBC is array (1 .. 16) of unsigned_char; for LL_VBC'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VBC, "vector_type"); pragma Suppress (All_Checks, LL_VBC); --------------------------- -- short Core Components -- --------------------------- type LL_VUS is array (1 .. 8) of unsigned_short; for LL_VUS'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VUS, "vector_type"); pragma Suppress (All_Checks, LL_VUS); type LL_VSS is array (1 .. 8) of signed_short; for LL_VSS'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VSS, "vector_type"); pragma Suppress (All_Checks, LL_VSS); type LL_VBS is array (1 .. 8) of unsigned_short; for LL_VBS'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VBS, "vector_type"); pragma Suppress (All_Checks, LL_VBS); ------------------------- -- int Core Components -- ------------------------- type LL_VUI is array (1 .. 4) of unsigned_int; for LL_VUI'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VUI, "vector_type"); pragma Suppress (All_Checks, LL_VUI); type LL_VSI is array (1 .. 4) of signed_int; for LL_VSI'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VSI, "vector_type"); pragma Suppress (All_Checks, LL_VSI); type LL_VBI is array (1 .. 4) of unsigned_int; for LL_VBI'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VBI, "vector_type"); pragma Suppress (All_Checks, LL_VBI); --------------------------- -- Float Core Components -- --------------------------- type LL_VF is array (1 .. 4) of Float; for LL_VF'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VF, "vector_type"); pragma Suppress (All_Checks, LL_VF); --------------------------- -- pixel Core Components -- --------------------------- type LL_VP is array (1 .. 8) of pixel; for LL_VP'Alignment use VECTOR_ALIGNMENT; pragma Machine_Attribute (LL_VP, "vector_type"); pragma Suppress (All_Checks, LL_VP); ------------------------------------ -- Low-level Functional Interface -- ------------------------------------ -- The functions we have to expose here are exactly those for which -- GCC builtins are available. Calls to these functions will be turned -- into real AltiVec instructions by the GCC back-end. pragma Convention_Identifier (LL_Altivec, Intrinsic); pragma Import (LL_Altivec, dss, "__builtin_altivec_dss"); pragma Import (LL_Altivec, dssall, "__builtin_altivec_dssall"); pragma Import (LL_Altivec, dst, "__builtin_altivec_dst"); pragma Import (LL_Altivec, dstst, "__builtin_altivec_dstst"); pragma Import (LL_Altivec, dststt, "__builtin_altivec_dststt"); pragma Import (LL_Altivec, dstt, "__builtin_altivec_dstt"); pragma Import (LL_Altivec, mtvscr, "__builtin_altivec_mtvscr"); pragma Import (LL_Altivec, mfvscr, "__builtin_altivec_mfvscr"); pragma Import (LL_Altivec, stvebx, "__builtin_altivec_stvebx"); pragma Import (LL_Altivec, stvehx, "__builtin_altivec_stvehx"); pragma Import (LL_Altivec, stvewx, "__builtin_altivec_stvewx"); pragma Import (LL_Altivec, stvx, "__builtin_altivec_stvx"); pragma Import (LL_Altivec, stvxl, "__builtin_altivec_stvxl"); pragma Import (LL_Altivec, lvebx, "__builtin_altivec_lvebx"); pragma Import (LL_Altivec, lvehx, "__builtin_altivec_lvehx"); pragma Import (LL_Altivec, lvewx, "__builtin_altivec_lvewx"); pragma Import (LL_Altivec, lvx, "__builtin_altivec_lvx"); pragma Import (LL_Altivec, lvxl, "__builtin_altivec_lvxl"); pragma Import (LL_Altivec, lvsl, "__builtin_altivec_lvsl"); pragma Import (LL_Altivec, lvsr, "__builtin_altivec_lvsr"); pragma Import (LL_Altivec, abs_v16qi, "__builtin_altivec_abs_v16qi"); pragma Import (LL_Altivec, abs_v8hi, "__builtin_altivec_abs_v8hi"); pragma Import (LL_Altivec, abs_v4si, "__builtin_altivec_abs_v4si"); pragma Import (LL_Altivec, abs_v4sf, "__builtin_altivec_abs_v4sf"); pragma Import (LL_Altivec, abss_v16qi, "__builtin_altivec_abss_v16qi"); pragma Import (LL_Altivec, abss_v8hi, "__builtin_altivec_abss_v8hi"); pragma Import (LL_Altivec, abss_v4si, "__builtin_altivec_abss_v4si"); pragma Import (LL_Altivec, vaddcuw, "__builtin_altivec_vaddcuw"); pragma Import (LL_Altivec, vaddfp, "__builtin_altivec_vaddfp"); pragma Import (LL_Altivec, vaddsbs, "__builtin_altivec_vaddsbs"); pragma Import (LL_Altivec, vaddshs, "__builtin_altivec_vaddshs"); pragma Import (LL_Altivec, vaddsws, "__builtin_altivec_vaddsws"); pragma Import (LL_Altivec, vaddubm, "__builtin_altivec_vaddubm"); pragma Import (LL_Altivec, vaddubs, "__builtin_altivec_vaddubs"); pragma Import (LL_Altivec, vadduhm, "__builtin_altivec_vadduhm"); pragma Import (LL_Altivec, vadduhs, "__builtin_altivec_vadduhs"); pragma Import (LL_Altivec, vadduwm, "__builtin_altivec_vadduwm"); pragma Import (LL_Altivec, vadduws, "__builtin_altivec_vadduws"); pragma Import (LL_Altivec, vand, "__builtin_altivec_vand"); pragma Import (LL_Altivec, vandc, "__builtin_altivec_vandc"); pragma Import (LL_Altivec, vavgsb, "__builtin_altivec_vavgsb"); pragma Import (LL_Altivec, vavgsh, "__builtin_altivec_vavgsh"); pragma Import (LL_Altivec, vavgsw, "__builtin_altivec_vavgsw"); pragma Import (LL_Altivec, vavgub, "__builtin_altivec_vavgub"); pragma Import (LL_Altivec, vavguh, "__builtin_altivec_vavguh"); pragma Import (LL_Altivec, vavguw, "__builtin_altivec_vavguw"); pragma Import (LL_Altivec, vcfsx, "__builtin_altivec_vcfsx"); pragma Import (LL_Altivec, vcfux, "__builtin_altivec_vcfux"); pragma Import (LL_Altivec, vcmpbfp, "__builtin_altivec_vcmpbfp"); pragma Import (LL_Altivec, vcmpeqfp, "__builtin_altivec_vcmpeqfp"); pragma Import (LL_Altivec, vcmpequb, "__builtin_altivec_vcmpequb"); pragma Import (LL_Altivec, vcmpequh, "__builtin_altivec_vcmpequh"); pragma Import (LL_Altivec, vcmpequw, "__builtin_altivec_vcmpequw"); pragma Import (LL_Altivec, vcmpgefp, "__builtin_altivec_vcmpgefp"); pragma Import (LL_Altivec, vcmpgtfp, "__builtin_altivec_vcmpgtfp"); pragma Import (LL_Altivec, vcmpgtsb, "__builtin_altivec_vcmpgtsb"); pragma Import (LL_Altivec, vcmpgtsh, "__builtin_altivec_vcmpgtsh"); pragma Import (LL_Altivec, vcmpgtsw, "__builtin_altivec_vcmpgtsw"); pragma Import (LL_Altivec, vcmpgtub, "__builtin_altivec_vcmpgtub"); pragma Import (LL_Altivec, vcmpgtuh, "__builtin_altivec_vcmpgtuh"); pragma Import (LL_Altivec, vcmpgtuw, "__builtin_altivec_vcmpgtuw"); pragma Import (LL_Altivec, vctsxs, "__builtin_altivec_vctsxs"); pragma Import (LL_Altivec, vctuxs, "__builtin_altivec_vctuxs"); pragma Import (LL_Altivec, vexptefp, "__builtin_altivec_vexptefp"); pragma Import (LL_Altivec, vlogefp, "__builtin_altivec_vlogefp"); pragma Import (LL_Altivec, vmaddfp, "__builtin_altivec_vmaddfp"); pragma Import (LL_Altivec, vmaxfp, "__builtin_altivec_vmaxfp"); pragma Import (LL_Altivec, vmaxsb, "__builtin_altivec_vmaxsb"); pragma Import (LL_Altivec, vmaxsh, "__builtin_altivec_vmaxsh"); pragma Import (LL_Altivec, vmaxsw, "__builtin_altivec_vmaxsw"); pragma Import (LL_Altivec, vmaxub, "__builtin_altivec_vmaxub"); pragma Import (LL_Altivec, vmaxuh, "__builtin_altivec_vmaxuh"); pragma Import (LL_Altivec, vmaxuw, "__builtin_altivec_vmaxuw"); pragma Import (LL_Altivec, vmhaddshs, "__builtin_altivec_vmhaddshs"); pragma Import (LL_Altivec, vmhraddshs, "__builtin_altivec_vmhraddshs"); pragma Import (LL_Altivec, vminfp, "__builtin_altivec_vminfp"); pragma Import (LL_Altivec, vminsb, "__builtin_altivec_vminsb"); pragma Import (LL_Altivec, vminsh, "__builtin_altivec_vminsh"); pragma Import (LL_Altivec, vminsw, "__builtin_altivec_vminsw"); pragma Import (LL_Altivec, vminub, "__builtin_altivec_vminub"); pragma Import (LL_Altivec, vminuh, "__builtin_altivec_vminuh"); pragma Import (LL_Altivec, vminuw, "__builtin_altivec_vminuw"); pragma Import (LL_Altivec, vmladduhm, "__builtin_altivec_vmladduhm"); pragma Import (LL_Altivec, vmrghb, "__builtin_altivec_vmrghb"); pragma Import (LL_Altivec, vmrghh, "__builtin_altivec_vmrghh"); pragma Import (LL_Altivec, vmrghw, "__builtin_altivec_vmrghw"); pragma Import (LL_Altivec, vmrglb, "__builtin_altivec_vmrglb"); pragma Import (LL_Altivec, vmrglh, "__builtin_altivec_vmrglh"); pragma Import (LL_Altivec, vmrglw, "__builtin_altivec_vmrglw"); pragma Import (LL_Altivec, vmsummbm, "__builtin_altivec_vmsummbm"); pragma Import (LL_Altivec, vmsumshm, "__builtin_altivec_vmsumshm"); pragma Import (LL_Altivec, vmsumshs, "__builtin_altivec_vmsumshs"); pragma Import (LL_Altivec, vmsumubm, "__builtin_altivec_vmsumubm"); pragma Import (LL_Altivec, vmsumuhm, "__builtin_altivec_vmsumuhm"); pragma Import (LL_Altivec, vmsumuhs, "__builtin_altivec_vmsumuhs"); pragma Import (LL_Altivec, vmulesb, "__builtin_altivec_vmulesb"); pragma Import (LL_Altivec, vmulesh, "__builtin_altivec_vmulesh"); pragma Import (LL_Altivec, vmuleub, "__builtin_altivec_vmuleub"); pragma Import (LL_Altivec, vmuleuh, "__builtin_altivec_vmuleuh"); pragma Import (LL_Altivec, vmulosb, "__builtin_altivec_vmulosb"); pragma Import (LL_Altivec, vmulosh, "__builtin_altivec_vmulosh"); pragma Import (LL_Altivec, vmuloub, "__builtin_altivec_vmuloub"); pragma Import (LL_Altivec, vmulouh, "__builtin_altivec_vmulouh"); pragma Import (LL_Altivec, vnmsubfp, "__builtin_altivec_vnmsubfp"); pragma Import (LL_Altivec, vnor, "__builtin_altivec_vnor"); pragma Import (LL_Altivec, vxor, "__builtin_altivec_vxor"); pragma Import (LL_Altivec, vor, "__builtin_altivec_vor"); pragma Import (LL_Altivec, vperm_4si, "__builtin_altivec_vperm_4si"); pragma Import (LL_Altivec, vpkpx, "__builtin_altivec_vpkpx"); pragma Import (LL_Altivec, vpkshss, "__builtin_altivec_vpkshss"); pragma Import (LL_Altivec, vpkshus, "__builtin_altivec_vpkshus"); pragma Import (LL_Altivec, vpkswss, "__builtin_altivec_vpkswss"); pragma Import (LL_Altivec, vpkswus, "__builtin_altivec_vpkswus"); pragma Import (LL_Altivec, vpkuhum, "__builtin_altivec_vpkuhum"); pragma Import (LL_Altivec, vpkuhus, "__builtin_altivec_vpkuhus"); pragma Import (LL_Altivec, vpkuwum, "__builtin_altivec_vpkuwum"); pragma Import (LL_Altivec, vpkuwus, "__builtin_altivec_vpkuwus"); pragma Import (LL_Altivec, vrefp, "__builtin_altivec_vrefp"); pragma Import (LL_Altivec, vrfim, "__builtin_altivec_vrfim"); pragma Import (LL_Altivec, vrfin, "__builtin_altivec_vrfin"); pragma Import (LL_Altivec, vrfip, "__builtin_altivec_vrfip"); pragma Import (LL_Altivec, vrfiz, "__builtin_altivec_vrfiz"); pragma Import (LL_Altivec, vrlb, "__builtin_altivec_vrlb"); pragma Import (LL_Altivec, vrlh, "__builtin_altivec_vrlh"); pragma Import (LL_Altivec, vrlw, "__builtin_altivec_vrlw"); pragma Import (LL_Altivec, vrsqrtefp, "__builtin_altivec_vrsqrtefp"); pragma Import (LL_Altivec, vsel_4si, "__builtin_altivec_vsel_4si"); pragma Import (LL_Altivec, vsldoi_4si, "__builtin_altivec_vsldoi_4si"); pragma Import (LL_Altivec, vsldoi_8hi, "__builtin_altivec_vsldoi_8hi"); pragma Import (LL_Altivec, vsldoi_16qi, "__builtin_altivec_vsldoi_16qi"); pragma Import (LL_Altivec, vsldoi_4sf, "__builtin_altivec_vsldoi_4sf"); pragma Import (LL_Altivec, vsl, "__builtin_altivec_vsl"); pragma Import (LL_Altivec, vslb, "__builtin_altivec_vslb"); pragma Import (LL_Altivec, vslh, "__builtin_altivec_vslh"); pragma Import (LL_Altivec, vslo, "__builtin_altivec_vslo"); pragma Import (LL_Altivec, vslw, "__builtin_altivec_vslw"); pragma Import (LL_Altivec, vspltb, "__builtin_altivec_vspltb"); pragma Import (LL_Altivec, vsplth, "__builtin_altivec_vsplth"); pragma Import (LL_Altivec, vspltisb, "__builtin_altivec_vspltisb"); pragma Import (LL_Altivec, vspltish, "__builtin_altivec_vspltish"); pragma Import (LL_Altivec, vspltisw, "__builtin_altivec_vspltisw"); pragma Import (LL_Altivec, vspltw, "__builtin_altivec_vspltw"); pragma Import (LL_Altivec, vsr, "__builtin_altivec_vsr"); pragma Import (LL_Altivec, vsrab, "__builtin_altivec_vsrab"); pragma Import (LL_Altivec, vsrah, "__builtin_altivec_vsrah"); pragma Import (LL_Altivec, vsraw, "__builtin_altivec_vsraw"); pragma Import (LL_Altivec, vsrb, "__builtin_altivec_vsrb"); pragma Import (LL_Altivec, vsrh, "__builtin_altivec_vsrh"); pragma Import (LL_Altivec, vsro, "__builtin_altivec_vsro"); pragma Import (LL_Altivec, vsrw, "__builtin_altivec_vsrw"); pragma Import (LL_Altivec, vsubcuw, "__builtin_altivec_vsubcuw"); pragma Import (LL_Altivec, vsubfp, "__builtin_altivec_vsubfp"); pragma Import (LL_Altivec, vsubsbs, "__builtin_altivec_vsubsbs"); pragma Import (LL_Altivec, vsubshs, "__builtin_altivec_vsubshs"); pragma Import (LL_Altivec, vsubsws, "__builtin_altivec_vsubsws"); pragma Import (LL_Altivec, vsububm, "__builtin_altivec_vsububm"); pragma Import (LL_Altivec, vsububs, "__builtin_altivec_vsububs"); pragma Import (LL_Altivec, vsubuhm, "__builtin_altivec_vsubuhm"); pragma Import (LL_Altivec, vsubuhs, "__builtin_altivec_vsubuhs"); pragma Import (LL_Altivec, vsubuwm, "__builtin_altivec_vsubuwm"); pragma Import (LL_Altivec, vsubuws, "__builtin_altivec_vsubuws"); pragma Import (LL_Altivec, vsum2sws, "__builtin_altivec_vsum2sws"); pragma Import (LL_Altivec, vsum4sbs, "__builtin_altivec_vsum4sbs"); pragma Import (LL_Altivec, vsum4shs, "__builtin_altivec_vsum4shs"); pragma Import (LL_Altivec, vsum4ubs, "__builtin_altivec_vsum4ubs"); pragma Import (LL_Altivec, vsumsws, "__builtin_altivec_vsumsws"); pragma Import (LL_Altivec, vupkhpx, "__builtin_altivec_vupkhpx"); pragma Import (LL_Altivec, vupkhsb, "__builtin_altivec_vupkhsb"); pragma Import (LL_Altivec, vupkhsh, "__builtin_altivec_vupkhsh"); pragma Import (LL_Altivec, vupklpx, "__builtin_altivec_vupklpx"); pragma Import (LL_Altivec, vupklsb, "__builtin_altivec_vupklsb"); pragma Import (LL_Altivec, vupklsh, "__builtin_altivec_vupklsh"); pragma Import (LL_Altivec, vcmpbfp_p, "__builtin_altivec_vcmpbfp_p"); pragma Import (LL_Altivec, vcmpeqfp_p, "__builtin_altivec_vcmpeqfp_p"); pragma Import (LL_Altivec, vcmpgefp_p, "__builtin_altivec_vcmpgefp_p"); pragma Import (LL_Altivec, vcmpgtfp_p, "__builtin_altivec_vcmpgtfp_p"); pragma Import (LL_Altivec, vcmpequw_p, "__builtin_altivec_vcmpequw_p"); pragma Import (LL_Altivec, vcmpgtsw_p, "__builtin_altivec_vcmpgtsw_p"); pragma Import (LL_Altivec, vcmpgtuw_p, "__builtin_altivec_vcmpgtuw_p"); pragma Import (LL_Altivec, vcmpgtuh_p, "__builtin_altivec_vcmpgtuh_p"); pragma Import (LL_Altivec, vcmpgtsh_p, "__builtin_altivec_vcmpgtsh_p"); pragma Import (LL_Altivec, vcmpequh_p, "__builtin_altivec_vcmpequh_p"); pragma Import (LL_Altivec, vcmpequb_p, "__builtin_altivec_vcmpequb_p"); pragma Import (LL_Altivec, vcmpgtsb_p, "__builtin_altivec_vcmpgtsb_p"); pragma Import (LL_Altivec, vcmpgtub_p, "__builtin_altivec_vcmpgtub_p"); end GNAT.Altivec.Low_Level_Vectors;
3-mid/impact/source/3d/math/impact-d3-transform.ads
charlie5/lace
20
17050
<reponame>charlie5/lace package impact.d3.Transform -- -- The impact.d3.Transform class supports rigid transforms with only translation and rotation and no scaling/shear. -- -- It can be used in combination with impact.d3.Vector, impact.d3.Quaternion and impact.d3.Matrix linear algebra classes. -- is use Math; function to_Transform (q : in Quaternion; -- 'q' Rotation from quaternion. c : in math.Vector_3 := math.Origin_3d) return Transform_3d; -- 'c' Translation from Vector. -- -- Constructor from impact.d3.Quaternion (with optional impact.d3.Vector offset). function to_Transform (m : in math.Matrix_3x3; -- 'm' Rotation matrix. c : in math.Vector_3 := math.Origin_3d) return Transform_3d; -- 'c' Translation from Vector. -- -- Constructor from a rotatin matrix and an optional Vector offset. procedure mult (Self : out Transform_3d; t1, -- 't1' Transform 1 t2 : in Transform_3d); -- 't2' Transform 2 -- -- Set the current transform as the value of the product of two transforms -- -- Self = t1 * t2 function transformed (Self : in Transform_3d; x : in math.Vector_3) return math.Vector_3; -- -- Return the transform of the vector. -- function "*" (Left : in Transform_3d; Right : in math.Vector_3) return math.Vector_3; -- -- -- -- Same as 'transformed' above. function "*" (Left : in Transform_3d; Right : in Quaternion) return Quaternion; -- -- Return the transform of the Quaternion. function getRotation (Self : in Transform_3d) return Quaternion; -- -- Return a quaternion representing the rotation. function getBasis (Self : in Transform_3d) return math.Matrix_3x3; function getBasis (Self : access Transform_3d) return access Matrix_3x3; function getOrigin (Self : in Transform_3d) return math.Vector_3; function getOrigin (Self : access Transform_3d) return access math.Vector_3; procedure setFromOpenGLMatrix (Self : in out Transform_3d; m : access math.Real); -- 'm' A pointer to a 15 element array ( 12 rotation (row major padded on the right by 1), -- and 3 translation. -- Set from an array. procedure getOpenGLMatrix (Self : in Transform_3d; m : access math.Real); -- 'm' As above. -- -- Fill an array representation. procedure setOrigin (Self : in out Transform_3d; origin : in math.Vector_3); -- -- Set the translational element. procedure setBasis (Self : in out Transform_3d; basis : in math.Matrix_3x3); -- -- Set the rotational element by impact.d3.Matrix. procedure setRotation (Self : in out Transform_3d; q : in Quaternion); -- -- Set the rotational element by impact.d3.Quaternion. procedure setIdentity (Self : in out Transform_3d); -- -- Set this transformation to the identity. -- function "*" (Left : in Transform_3d; Right : in Transform_3d) return Transform_3d; function inverse (Self : in Transform_3d) return Transform_3d; function getIdentity return Transform_3d; function inverseTimes (Self : in Transform_3d; t : in Transform_3d) return Transform_3d; -- Return the inverse of this transform times the other transform function invXform (Self : in Transform_3d; inVec : in math.Vector_3) return math.Vector_3; private function "*" (Left : in Transform_3d; Right : in math.Vector_3) return math.Vector_3 renames transformed; end impact.d3.Transform; -- class impact.d3.Transform { -- -- SIMD_FORCE_INLINE impact.d3.Vector invXform(const impact.d3.Vector& inVec) const; -- /**@brief Return the inverse of this transform times the other transform -- * @param t The other transform -- * return this.inverse() * the other */ -- impact.d3.Transform inverseTimes(const impact.d3.Transform& t) const; -- }; -- -- SIMD_FORCE_INLINE impact.d3.Vector -- impact.d3.Transform::invXform(const impact.d3.Vector& inVec) const -- { -- impact.d3.Vector v = inVec - m_origin; -- return (m_basis.transpose() * v); -- } -- SIMD_FORCE_INLINE impact.d3.Transform -- impact.d3.Transform::inverseTimes(const impact.d3.Transform& t) const -- { -- impact.d3.Vector v = t.getOrigin() - m_origin; -- return impact.d3.Transform(m_basis.transposeTimes(t.m_basis), -- v * m_basis); -- }
tools-src/gnu/gcc/gcc/ada/g-dirope.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
15891
<reponame>enfoTek/tomato.linksys.e2000.nvram-mod<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . D I R E C T O R Y _ O P E R A T I O N S -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1998-2001 Ada Core Technologies, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Strings.Fixed; with Ada.Strings.Maps; with Unchecked_Deallocation; with Unchecked_Conversion; with System; use System; with GNAT.OS_Lib; package body GNAT.Directory_Operations is use Ada; type Dir_Type_Value is new System.Address; -- This is the low-level address directory structure as returned by the C -- opendir routine. procedure Free is new Unchecked_Deallocation (Dir_Type_Value, Dir_Type); --------------- -- Base_Name -- --------------- function Base_Name (Path : Path_Name; Suffix : String := "") return String is function Get_File_Names_Case_Sensitive return Integer; pragma Import (C, Get_File_Names_Case_Sensitive, "__gnat_get_file_names_case_sensitive"); Case_Sensitive_File_Name : constant Boolean := Get_File_Names_Case_Sensitive = 1; function Basename (Path : Path_Name; Suffix : String := "") return String; -- This function does the job. The only difference between Basename -- and Base_Name (the parent function) is that the former is case -- sensitive, while the latter is not. Path and Suffix are adjusted -- appropriately before calling Basename under platforms where the -- file system is not case sensitive. -------------- -- Basename -- -------------- function Basename (Path : Path_Name; Suffix : String := "") return String is Cut_Start : Natural := Strings.Fixed.Index (Path, Dir_Seps, Going => Strings.Backward); Cut_End : Natural; begin -- Cut_Start point to the first basename character if Cut_Start = 0 then Cut_Start := Path'First; else Cut_Start := Cut_Start + 1; end if; -- Cut_End point to the last basename character. Cut_End := Path'Last; -- If basename ends with Suffix, adjust Cut_End. if Suffix /= "" and then Path (Path'Last - Suffix'Length + 1 .. Cut_End) = Suffix then Cut_End := Path'Last - Suffix'Length; end if; Check_For_Standard_Dirs : declare Offset : constant Integer := Path'First - Base_Name.Path'First; BN : constant String := Base_Name.Path (Cut_Start - Offset .. Cut_End - Offset); -- Here we use Base_Name.Path to keep the original casing begin if BN = "." or else BN = ".." then return ""; elsif BN'Length > 2 and then Characters.Handling.Is_Letter (BN (BN'First)) and then BN (BN'First + 1) = ':' then -- We have a DOS drive letter prefix, remove it return BN (BN'First + 2 .. BN'Last); else return BN; end if; end Check_For_Standard_Dirs; end Basename; -- Start processing for Base_Name begin if Case_Sensitive_File_Name then return Basename (Path, Suffix); else return Basename (Characters.Handling.To_Lower (Path), Characters.Handling.To_Lower (Suffix)); end if; end Base_Name; ---------------- -- Change_Dir -- ---------------- procedure Change_Dir (Dir_Name : Dir_Name_Str) is C_Dir_Name : String := Dir_Name & ASCII.NUL; function chdir (Dir_Name : String) return Integer; pragma Import (C, chdir, "chdir"); begin if chdir (C_Dir_Name) /= 0 then raise Directory_Error; end if; end Change_Dir; ----------- -- Close -- ----------- procedure Close (Dir : in out Dir_Type) is function closedir (Directory : System.Address) return Integer; pragma Import (C, closedir, "closedir"); Discard : Integer; begin if not Is_Open (Dir) then raise Directory_Error; end if; Discard := closedir (System.Address (Dir.all)); Free (Dir); end Close; -------------- -- Dir_Name -- -------------- function Dir_Name (Path : Path_Name) return Dir_Name_Str is Last_DS : constant Natural := Strings.Fixed.Index (Path, Dir_Seps, Going => Strings.Backward); begin if Last_DS = 0 then -- There is no directory separator, returns current working directory return "." & Dir_Separator; else return Path (Path'First .. Last_DS); end if; end Dir_Name; ----------------- -- Expand_Path -- ----------------- function Expand_Path (Path : Path_Name) return String is Result : OS_Lib.String_Access := new String (1 .. 200); Result_Last : Natural := 0; procedure Append (C : Character); procedure Append (S : String); -- Append to Result procedure Double_Result_Size; -- Reallocate Result, doubling its size procedure Read (K : in out Positive); -- Update Result while reading current Path starting at position K. If -- a variable is found, call Var below. procedure Var (K : in out Positive); -- Translate variable name starting at position K with the associated -- environment value. ------------ -- Append -- ------------ procedure Append (C : Character) is begin if Result_Last = Result'Last then Double_Result_Size; end if; Result_Last := Result_Last + 1; Result (Result_Last) := C; end Append; procedure Append (S : String) is begin while Result_Last + S'Length - 1 > Result'Last loop Double_Result_Size; end loop; Result (Result_Last + 1 .. Result_Last + S'Length) := S; Result_Last := Result_Last + S'Length; end Append; ------------------------ -- Double_Result_Size -- ------------------------ procedure Double_Result_Size is New_Result : constant OS_Lib.String_Access := new String (1 .. 2 * Result'Last); begin New_Result (1 .. Result_Last) := Result (1 .. Result_Last); OS_Lib.Free (Result); Result := New_Result; end Double_Result_Size; ---------- -- Read -- ---------- procedure Read (K : in out Positive) is begin For_All_Characters : loop if Path (K) = '$' then -- Could be a variable if K < Path'Last then if Path (K + 1) = '$' then -- Not a variable after all, this is a double $, just -- insert one in the result string. Append ('$'); K := K + 1; else -- Let's parse the variable K := K + 1; Var (K); end if; else -- We have an ending $ sign Append ('$'); end if; else -- This is a standard character, just add it to the result Append (Path (K)); end if; -- Skip to next character K := K + 1; exit For_All_Characters when K > Path'Last; end loop For_All_Characters; end Read; --------- -- Var -- --------- procedure Var (K : in out Positive) is E : Positive; begin if Path (K) = '{' then -- Look for closing } (curly bracket). E := K; loop E := E + 1; exit when Path (E) = '}' or else E = Path'Last; end loop; if Path (E) = '}' then -- OK found, translate with environment value declare Env : OS_Lib.String_Access := OS_Lib.Getenv (Path (K + 1 .. E - 1)); begin Append (Env.all); OS_Lib.Free (Env); end; else -- No closing curly bracket, not a variable after all or a -- syntax error, ignore it, insert string as-is. Append ('$'); Append (Path (K .. E)); end if; else -- The variable name is everything from current position to first -- non letter/digit character. E := K; -- Check that first chartacter is a letter if Characters.Handling.Is_Letter (Path (E)) then E := E + 1; Var_Name : loop exit Var_Name when E > Path'Last; if Characters.Handling.Is_Letter (Path (E)) or else Characters.Handling.Is_Digit (Path (E)) then E := E + 1; else exit Var_Name; end if; end loop Var_Name; E := E - 1; declare Env : OS_Lib.String_Access := OS_Lib.Getenv (Path (K .. E)); begin Append (Env.all); OS_Lib.Free (Env); end; else -- This is not a variable after all Append ('$'); Append (Path (E)); end if; end if; K := E; end Var; -- Start of processing for Expand_Path begin declare K : Positive := Path'First; begin Read (K); declare Returned_Value : constant String := Result (1 .. Result_Last); begin OS_Lib.Free (Result); return Returned_Value; end; end; end Expand_Path; -------------------- -- File_Extension -- -------------------- function File_Extension (Path : Path_Name) return String is First : Natural := Strings.Fixed.Index (Path, Dir_Seps, Going => Strings.Backward); Dot : Natural; begin if First = 0 then First := Path'First; end if; Dot := Strings.Fixed.Index (Path (First .. Path'Last), ".", Going => Strings.Backward); if Dot = 0 or else Dot = Path'Last then return ""; else return Path (Dot .. Path'Last); end if; end File_Extension; --------------- -- File_Name -- --------------- function File_Name (Path : Path_Name) return String is begin return Base_Name (Path); end File_Name; --------------------- -- Get_Current_Dir -- --------------------- Max_Path : Integer; pragma Import (C, Max_Path, "max_path_len"); function Get_Current_Dir return Dir_Name_Str is Current_Dir : String (1 .. Max_Path + 1); Last : Natural; begin Get_Current_Dir (Current_Dir, Last); return Current_Dir (1 .. Last); end Get_Current_Dir; procedure Get_Current_Dir (Dir : out Dir_Name_Str; Last : out Natural) is Path_Len : Natural := Max_Path; Buffer : String (Dir'First .. Dir'First + Max_Path + 1); procedure Local_Get_Current_Dir (Dir : System.Address; Length : System.Address); pragma Import (C, Local_Get_Current_Dir, "__gnat_get_current_dir"); begin Local_Get_Current_Dir (Buffer'Address, Path_Len'Address); if Dir'Length > Path_Len then Last := Dir'First + Path_Len - 1; else Last := Dir'Last; end if; Dir (Buffer'First .. Last) := Buffer (Buffer'First .. Last); end Get_Current_Dir; ------------- -- Is_Open -- ------------- function Is_Open (Dir : Dir_Type) return Boolean is begin return Dir /= Null_Dir and then System.Address (Dir.all) /= System.Null_Address; end Is_Open; -------------- -- Make_Dir -- -------------- procedure Make_Dir (Dir_Name : Dir_Name_Str) is C_Dir_Name : String := Dir_Name & ASCII.NUL; function mkdir (Dir_Name : String) return Integer; pragma Import (C, mkdir, "__gnat_mkdir"); begin if mkdir (C_Dir_Name) /= 0 then raise Directory_Error; end if; end Make_Dir; ------------------------ -- Normalize_Pathname -- ------------------------ function Normalize_Pathname (Path : Path_Name; Style : Path_Style := System_Default) return String is N_Path : String := Path; K : Positive := N_Path'First; Prev_Dirsep : Boolean := False; begin for J in Path'Range loop if Strings.Maps.Is_In (Path (J), Dir_Seps) then if not Prev_Dirsep then case Style is when UNIX => N_Path (K) := '/'; when DOS => N_Path (K) := '\'; when System_Default => N_Path (K) := Dir_Separator; end case; K := K + 1; end if; Prev_Dirsep := True; else N_Path (K) := Path (J); K := K + 1; Prev_Dirsep := False; end if; end loop; return N_Path (N_Path'First .. K - 1); end Normalize_Pathname; ---------- -- Open -- ---------- procedure Open (Dir : out Dir_Type; Dir_Name : Dir_Name_Str) is C_File_Name : String := Dir_Name & ASCII.NUL; function opendir (File_Name : String) return Dir_Type_Value; pragma Import (C, opendir, "opendir"); begin Dir := new Dir_Type_Value'(opendir (C_File_Name)); if not Is_Open (Dir) then Free (Dir); Dir := Null_Dir; raise Directory_Error; end if; end Open; ---------- -- Read -- ---------- procedure Read (Dir : in out Dir_Type; Str : out String; Last : out Natural) is Filename_Addr : Address; Filename_Len : Integer; Buffer : array (0 .. 1024) of Character; -- 1024 is the value of FILENAME_MAX in stdio.h function readdir_gnat (Directory : System.Address; Buffer : System.Address) return System.Address; pragma Import (C, readdir_gnat, "__gnat_readdir"); function strlen (S : Address) return Integer; pragma Import (C, strlen, "strlen"); begin if not Is_Open (Dir) then raise Directory_Error; end if; Filename_Addr := readdir_gnat (System.Address (Dir.all), Buffer'Address); if Filename_Addr = System.Null_Address then Last := 0; return; end if; Filename_Len := strlen (Filename_Addr); if Str'Length > Filename_Len then Last := Str'First + Filename_Len - 1; else Last := Str'Last; end if; declare subtype Path_String is String (1 .. Filename_Len); type Path_String_Access is access Path_String; function Address_To_Access is new Unchecked_Conversion (Source => Address, Target => Path_String_Access); Path_Access : Path_String_Access := Address_To_Access (Filename_Addr); begin for J in Str'First .. Last loop Str (J) := Path_Access (J - Str'First + 1); end loop; end; end Read; ------------------------- -- Read_Is_Thread_Sage -- ------------------------- function Read_Is_Thread_Safe return Boolean is function readdir_is_thread_safe return Integer; pragma Import (C, readdir_is_thread_safe, "__gnat_readdir_is_thread_safe"); begin return (readdir_is_thread_safe /= 0); end Read_Is_Thread_Safe; ---------------- -- Remove_Dir -- ---------------- procedure Remove_Dir (Dir_Name : Dir_Name_Str) is C_Dir_Name : String := Dir_Name & ASCII.NUL; procedure rmdir (Dir_Name : String); pragma Import (C, rmdir, "rmdir"); begin rmdir (C_Dir_Name); end Remove_Dir; end GNAT.Directory_Operations;
programs/oeis/026/A026337.asm
neoneye/loda
22
247100
; A026337: a(n) = 4^n*(4^n - 1)/2. ; 0,6,120,2016,32640,523776,8386560,134209536,2147450880,34359607296,549755289600,8796090925056,140737479966720,2251799780130816,36028796884746240,576460751766552576,9223372034707292160,147573952581086478336,2361183241400462868480,37778931862819722756096,604462909806764831539200,9671406556914834374393856,154742504910663738269368320,2475880078570725365426159616,39614081257132028059283619840,633825300114114137798398181376,10141204801825832960173811957760,162259276829213354384378755547136,2596148429267413778236451145646080,41538374868278620884128782557904896,664613997892457935875442777836748800 mov $1,4 pow $1,$0 bin $1,2 mov $0,$1
dropin/src/yaml-destination-c_handler.ads
robdaemon/AdaYaml
32
772
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with System; with Yaml.C; package Yaml.Destination.C_Handler is type Instance is new Destination.Instance with private; function As_Destination (Handler : Yaml.C.Write_Handler; Data : System.Address) return Pointer; overriding procedure Write_Data (Object : in out Instance; Buffer : String); private type Instance is new Destination.Instance with record Handler : Yaml.C.Write_Handler; Data : System.Address; end record; end Yaml.Destination.C_Handler;
ccc_filter.scpt
ericbjones/alfredchimeflows
5
2752
set q to "{query}" on convertListToString(theList, theDelimiter) set AppleScript's text item delimiters to theDelimiter set theString to theList as string set AppleScript's text item delimiters to "" return theString end convertListToString tell application "System Events" tell application process "Amazon Chime" set allRowNames to get name of first UI element of every row of table 1 of scroll area 1 of splitter group 1 of window "Amazon Chime" end tell end tell set channels to my convertListToString(allRowNames, " ") set fzfMatch to do shell script "echo " & quoted form of channels & "| /usr/local/bin/fzf -f " & quoted form of q set allMatches to paragraphs of fzfMatch set json to "{ \"items\":[ " repeat with eachMatch in allMatches set json to json & " { \"title\": " & "\"" & eachMatch & "\", " & "\"arg\": \"" & eachMatch & "\", " & "\"icon\": {\"path\": \"chime.png\"} }, " end repeat set json to text 1 thru -3 of json set json to json & "]}" return json
CP/Session3.agda
banacorn/bidirectional
2
1094
<reponame>banacorn/bidirectional open import Relation.Binary using (Decidable; Setoid; DecSetoid) open import Level module CP.Session3 {a} {b} (ChanDecSetoid : DecSetoid zero a) (TypeDecSetoid : DecSetoid zero b) where module TS = DecSetoid TypeDecSetoid Type : Set Type = DecSetoid.Carrier TypeDecSetoid open DecSetoid ChanDecSetoid Chan : Set Chan = Carrier module _ where -- type of infix 6 _∶_ data TypeOf : Set a where _∶_ : (x : Chan) → (A : Type) → TypeOf chanOf : TypeOf → Chan chanOf (x ∶ _) = x import Relation.Binary.Construct.On as On decSetoid : DecSetoid _ _ decSetoid = On.decSetoid ChanDecSetoid chanOf open import Data.List.Relation.Binary.Subset.DecSetoid decSetoid open import Data.List Session : Set a Session = List TypeOf open import Relation.Nullary open import Relation.Nullary.Decidable open import Data.Product open import Data.Maybe seperate : (Γ : Session) → (x : Chan) → Maybe (∃[ Δ ] ∃[ A ] (Γ ≋ x ∶ A ∷ Δ)) seperate [] x = nothing seperate (y ∶ A ∷ Γ) x with y ≟ x ... | yes P = just (Γ , A , ∷-cong P ≋-refl) ... | no ¬P with seperate Γ x ... | just (Δ , B , eq) = just (y ∶ A ∷ Δ , B , reasoning) where open EqReasoning reasoning : y ∶ A ∷ Γ ≋ x ∶ B ∷ y ∶ A ∷ Δ reasoning = begin y ∶ A ∷ Γ ≈⟨ ∷-cong refl eq ⟩ y ∶ A ∷ x ∶ B ∷ Δ ≈⟨ ≋-swap ⟩ x ∶ B ∷ y ∶ A ∷ Δ ∎ ... | nothing = nothing -- insertion infixl 5 _#_ _#_ : Session → TypeOf → Session Γ # (x ∶ A) with seperate Γ x ... | nothing = x ∶ A ∷ Γ ... | just (Δ , _ , _) = x ∶ A ∷ Δ insert-idempotent : ∀ Γ x A → Γ # x ∶ A # x ∶ A ≋ Γ # x ∶ A insert-idempotent Γ x A with seperate Γ x insert-idempotent Γ x A | nothing with seperate (x ∶ A ∷ Γ) x ... | nothing = {! !} ... | just x₁ = {! !} insert-idempotent Γ x A | just x₁ = {! !}
programs/oeis/172/A172416.asm
neoneye/loda
22
86058
; A172416: a(n) = 5*2^n/9 + 1/4 + (-1)^n*(n/6 + 7/36). ; 1,1,3,4,10,17,37,70,144,283,571,1136,2278,4549,9105,18202,36412,72815,145639,291268,582546,1165081,2330173,4660334,9320680,18641347,37282707,74565400,149130814,298261613,596523241,1193046466,2386092948,4772185879,9544371775,19088743532,38177487082,76354974145,152709948309,305419896598,610839793216,1221679586411,2443359172843,4886718345664,9773436691350,19546873382677,39093746765377,78187493530730,156374987061484,312749974122943,625499948245911,1250999896491796,2501999792983618,5003999585967209,10007999171934445,20015998343868862,40031996687737752,80063993375475475,160127986750950979,320255973501901928,640511947003803886,1281023894007607741,2562047788015215513,5124095576030430994,10248191152060862020,20496382304121724007,40992764608243448047,81985529216486896060,163971058432973792154,327942116865947584273,655884233731895168581,1311768467463790337126,2623536934927580674288,5247073869855161348539,10494147739710322697115,20988295479420645394192,41976590958841290788422,83953181917682581576805,167906363835365163153649,335812727670730326307258,671625455341460652614556,1343250910682921305229071,2686501821365842610458183,5373003642731685220916324,10746007285463370441832690,21492014570926740883665337,42984029141853481767330717,85968058283706963534661390,171936116567413927069322824,343872233134827854138645603,687744466269655708277291251,1375488932539311416554582456,2750977865078622833109164958,5501955730157245666218329869,11003911460314491332436659785,22007822920628982664873319522,44015645841257965329746639092,88031291682515930659493278135,176062583365031861318986556319,352125166730063722637973112588 sub $0,1 lpb $0 mov $2,$0 trn $0,2 max $2,0 seq $2,115102 ; a(0)=2, a(1)=8, a(n)=a(n-1)+2*a(n-2). add $1,$2 lpe div $1,4 add $1,1 mov $0,$1
hdes-dialect/hdes-ast/src/main/antlr4/imports/DecisionTableParser.g4
the-wrench-io/hdes-parent
1
2378
parser grammar DecisionTableParser; options { tokenVocab = HdesLexer; } import TypeDefParser, ExpressionParser; decisionTableUnit: simpleTypeName headers '{' hitPolicy '}'; hitPolicy: matchingPolicy | mappingPolicy; matchingPolicy: (FIND_FIRST | FIND_ALL) '(' '{' whenThenRules* '}' ')'; whenThenRules: WHEN whenRules '.'? ADD '(' thenRules ')'; mappingPolicy: MAP '(' mappingFrom ')' '.'? TO '(' mappingTo ')' '.'? WHEN whenRules mappingRows; mappingFrom: scalarType; mappingTo: scalarType; mappingRows: mappingRow*; mappingRow: '.'? simpleTypeName '(' thenRules ')'; thenRules: '{' (ruleLiteral (',' ruleLiteral)*)? '}'; whenRules: '(' (ruleExpression (',' ruleExpression)*)? ')'; ruleLiteral: literal; ruleExpression: ruleUndefinedValue | expressionUnit; ruleUndefinedValue: '?';
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-osinte__vxworks.adb
djamal2727/Main-Bearing-Analytical-Model
0
11565
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-osinte__vxworks.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1997-2020, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the VxWorks version -- This package encapsulates all direct interfaces to OS services that are -- needed by children of System. package body System.OS_Interface is use type Interfaces.C.int; Low_Priority : constant := 255; -- VxWorks native (default) lowest scheduling priority ----------------- -- To_Duration -- ----------------- function To_Duration (TS : timespec) return Duration is begin return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9; end To_Duration; ----------------- -- To_Timespec -- ----------------- function To_Timespec (D : Duration) return timespec is S : time_t; F : Duration; begin S := time_t (Long_Long_Integer (D)); F := D - Duration (S); -- If F is negative due to a round-up, adjust for positive F value if F < 0.0 then S := S - 1; F := F + 1.0; end if; return timespec'(ts_sec => S, ts_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; ------------------------- -- To_VxWorks_Priority -- ------------------------- function To_VxWorks_Priority (Priority : int) return int is begin return Low_Priority - Priority; end To_VxWorks_Priority; -------------------- -- To_Clock_Ticks -- -------------------- -- ??? - For now, we'll always get the system clock rate since it is -- allowed to be changed during run-time in VxWorks. A better method would -- be to provide an operation to set it that so we can always know its -- value. -- Another thing we should probably allow for is a resultant tick count -- greater than int'Last. This should probably be a procedure with two -- output parameters, one in the range 0 .. int'Last, and another -- representing the overflow count. function To_Clock_Ticks (D : Duration) return int is Ticks : Long_Long_Integer; Rate_Duration : Duration; Ticks_Duration : Duration; begin if D < 0.0 then return ERROR; end if; -- Ensure that the duration can be converted to ticks -- at the current clock tick rate without overflowing. Rate_Duration := Duration (sysClkRateGet); if D > (Duration'Last / Rate_Duration) then Ticks := Long_Long_Integer (int'Last); else Ticks_Duration := D * Rate_Duration; Ticks := Long_Long_Integer (Ticks_Duration); if Ticks_Duration > Duration (Ticks) then Ticks := Ticks + 1; end if; if Ticks > Long_Long_Integer (int'Last) then Ticks := Long_Long_Integer (int'Last); end if; end if; return int (Ticks); end To_Clock_Ticks; ----------------------------- -- Binary_Semaphore_Create -- ----------------------------- function Binary_Semaphore_Create return Binary_Semaphore_Id is begin return Binary_Semaphore_Id (semBCreate (SEM_Q_FIFO, SEM_EMPTY)); end Binary_Semaphore_Create; ----------------------------- -- Binary_Semaphore_Delete -- ----------------------------- function Binary_Semaphore_Delete (ID : Binary_Semaphore_Id) return int is begin return semDelete (SEM_ID (ID)); end Binary_Semaphore_Delete; ----------------------------- -- Binary_Semaphore_Obtain -- ----------------------------- function Binary_Semaphore_Obtain (ID : Binary_Semaphore_Id) return int is begin return semTake (SEM_ID (ID), WAIT_FOREVER); end Binary_Semaphore_Obtain; ------------------------------ -- Binary_Semaphore_Release -- ------------------------------ function Binary_Semaphore_Release (ID : Binary_Semaphore_Id) return int is begin return semGive (SEM_ID (ID)); end Binary_Semaphore_Release; ---------------------------- -- Binary_Semaphore_Flush -- ---------------------------- function Binary_Semaphore_Flush (ID : Binary_Semaphore_Id) return int is begin return semFlush (SEM_ID (ID)); end Binary_Semaphore_Flush; ---------- -- kill -- ---------- function kill (pid : t_id; sig : Signal) return int is begin return System.VxWorks.Ext.kill (pid, int (sig)); end kill; ----------------------- -- Interrupt_Connect -- ----------------------- function Interrupt_Connect (Vector : Interrupt_Vector; Handler : Interrupt_Handler; Parameter : System.Address := System.Null_Address) return int is begin return System.VxWorks.Ext.Interrupt_Connect (System.VxWorks.Ext.Interrupt_Vector (Vector), System.VxWorks.Ext.Interrupt_Handler (Handler), Parameter); end Interrupt_Connect; ----------------------- -- Interrupt_Context -- ----------------------- function Interrupt_Context return int is begin return System.VxWorks.Ext.Interrupt_Context; end Interrupt_Context; -------------------------------- -- Interrupt_Number_To_Vector -- -------------------------------- function Interrupt_Number_To_Vector (intNum : int) return Interrupt_Vector is begin return Interrupt_Vector (System.VxWorks.Ext.Interrupt_Number_To_Vector (intNum)); end Interrupt_Number_To_Vector; ----------------- -- Current_CPU -- ----------------- function Current_CPU return Multiprocessors.CPU is begin -- ??? Should use vxworks multiprocessor interface return Multiprocessors.CPU'First; end Current_CPU; end System.OS_Interface;
alloy4fun_models/trashltl/models/11/feAqeidonnHemeEiG.als
Kaixi26/org.alloytools.alloy
0
3341
open main pred idfeAqeidonnHemeEiG_prop12 { eventually always all f:File | f in Trash implies always f in Trash' } pred __repair { idfeAqeidonnHemeEiG_prop12 } check __repair { idfeAqeidonnHemeEiG_prop12 <=> prop12o }
lib/target/z88/classic/init_far.asm
jpoikela/z88dk
640
174916
<filename>lib/target/z88/classic/init_far.asm ; Startup code for far memory model ; 31/3/00 GWL ; 21/5/00 Modified for more flexible CF-compatible structure arrangement ; init_far: IF DEFINED_far_mmset ld a,MM_S1+MM_FIX ELSE ld a,MM_S1 ENDIF ld (farmemspec),a ; initialise farmemspec ld hl,1+(farheapsz/256) ld (farpages),hl ; initialise farpages add hl,hl ld b,h ld c,l ld hl,actual_malloc_table ld (malloc_table),hl ; initialise malloc_table ld d,h ld e,l inc de ld (hl),0 dec bc ldir ; clear malloc_table ld hl,pool_table ld de,pool_table+1 ld bc,223 ld (hl),0 ldir ; clear pool_table ret
grammar/Guarded.g4
slmtnm/guarded
0
4044
grammar Guarded; // Tokens SEP: ';'; WHITESPACE: [ \r\n\t]+ -> skip; NUMBER : [0-9]+('.'[0-9]*)?; TRUE: 'True'; FALSE: 'False'; LOCAL_VARIABLE: 'local'; ID : [a-zA-Z_][0-9a-zA-Z_]*; MUL: '*'; DIV: '/'; ADD: '+'; SUB: '-'; GT: '>'; LT: '<'; GE: '>='; LE: '<='; EQ: '=='; NEQ: '!='; AND: '&&'; OR: '||'; NEG: '~'; IMPL: '>>'; EQUIV: '<=>'; LOWER_BOUND_DELIMITER: '|'; expression : ID '(' actualParameters ')' # ExprMacroCall | SUB expression # UnarySub | NEG expression # Negate | '(' expression ')' # Brackets | expression op=('*'|'/') expression # MulDiv | expression op=('+'|'-') expression # AddSub | expression op=('>'|'<'|'>='|'<='|'=='|'!=') expression # Logic | expression AND expression # And | expression OR expression # Or | expression IMPL expression # Impl | expression EQUIV expression # Equiv | '[' (expression LOWER_BOUND_DELIMITER)? (expression (',' expression)*)? ']' # ArrayLiteral | NUMBER # Number | ID # Identifier | TRUE # True | FALSE # False | arrayLowerBound # ExprArrayLowerBound | arrayUpperBound # ExprArrayUpperBound | arraySize # ExprArraySize | arrayElement # ExprArrayElement | arrayLowerElement # ExprArrayLowerElement | arrayUpperElement # ExprArrayUpperElement ; // Program is an operator or multiple operators (or expression for repl) start : expression | initialAssignments? operatorList condition? macroOperatorDefinition* EOF ; operatorList: (operator (SEP operator)*)?; // Operators operator : skipOperator | abortOperator | assignOperator | macroExpressionDefinition | ifOperator | doOperator | macroCall | arraySet | arraySwap | arrayPopUp | arrayPopDown | arrayDelUp | arrayDelDown | arrayPushUp | arrayPushDown | arrayShift | printOperator ; skipOperator: 'skip'; abortOperator: 'abort'; printOperator: 'print' expression; // assign operator assignOperator: (LOCAL_VARIABLE)? ID (',' ID)* ':=' expression (',' expression)*; // Guarded comm ands commandList: command ('|' command)*; command: expression '->' operatorList; ifOperator: 'if' commandList 'fi'; doOperator: condition? 'do' commandList 'od'; condition: '{' expression '}'; // macro operators macroCall: ID '(' actualParameters ')'; macroOperatorDefinition: ID '(' formalParameters ')' '{' operatorList '}'; macroExpressionDefinition: ID '(' formalParameters ')' ':=' expression; formalParameters: (ID (',' ID)* )?; actualParameters: (expression (',' expression)* )?; initialAssignments: '[' assignOperator (';' assignOperator)* ']'; // arrays arrayLowerBound: ID '.lowb'; arrayUpperBound: ID '.upb'; arraySize: ID '.size'; arrayElement: ID '[' expression ']'; arrayLowerElement: ID '.lower'; arrayUpperElement: ID '.upper'; arrayShift: ID ':shift' '(' expression ')'; arrayPushUp: ID ':pushup' '(' expression ')'; arrayPushDown: ID ':pushdown' '(' expression ')'; arrayDelUp: ID ':delup'; arrayDelDown: ID ':deldown'; arrayPopUp: ID ',' ID ':popup'; arrayPopDown: ID ',' ID ':popdown'; arraySwap: ID ':swap' '(' expression ',' expression ')'; arraySet: ID ':' '[' expression ']' '=' expression; // arrayLiteral: '(' expression (',' expression)* ')'; // comments LINE_COMMENT : '#' ~[\r\n]* -> skip ;
hal/gdt.asm
flex1988/bingos
6
240838
<filename>hal/gdt.asm [GLOBAL gdt_flush] gdt_flush: mov eax, [esp+4] lgdt [eax] mov ax,0x10 mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ss,ax jmp 0x08:.flush .flush: ret [GLOBAL idt_flush] idt_flush: mov eax, [esp+4] lidt [eax] ret [GLOBAL tss_flush] tss_flush: mov ax, 0x2B ltr ax ret