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
Homework1-Tests/count.asm
berk94/Mylang-Compiler
0
243297
<reponame>berk94/Mylang-Compiler code segment call myread ; read a mov va,cx ; labl1: ; while begin push 100d ; push va ; pop cx ; pop ax ; sub ax,cx ; push ax ; pop ax ; cmp ax,0 ; jz labl2 ; push va ; pop ax ; call myprint ; push offset va ; push va ; push 1 ; pop cx ; pop ax ; add ax,cx ; push ax ; pop ax ; pop bp ; mov [bp],ax ; jmp labl1 ; jump to while beginnning labl2: ; int 20h ; exit to dos ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;reads a nonnegative integer and puts ;it in cx register ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; myread: MOV CX,0 morechar: mov ah,01h int 21H mov dx,0 mov dl,al mov ax,cx cmp dl,0D je myret sub dx,48d mov bp,dx mov ax,cx mov cx,10d mul cx add ax,bp mov cx,ax jmp morechar myret: ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; number in AX register is printed ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; myprint: mov si,10d xor dx,dx push ' ' ; push newline mov cx,1d nonzero: div si add dx,48d push dx inc cx xor dx,dx cmp ax,0h jne nonzero writeloop: pop dx mov ah,02h int 21h dec cx jnz writeloop ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Variables are put in this area ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; va dw ? ; variable a code ends
programs/oeis/127/A127701.asm
neoneye/loda
22
87093
; A127701: Infinite lower triangular matrix with (1, 2, 3, ...) in the main diagonal, (1, 1, 1, ...) in the subdiagonal and the rest zeros. ; 1,1,2,0,1,3,0,0,1,4,0,0,0,1,5,0,0,0,0,1,6,0,0,0,0,0,1,7,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,1,9,0,0,0,0,0,0,0,0,1,10,0,0,0,0,0,0,0,0,0,1,11,0,0,0,0,0,0,0,0,0,0,1,12,0,0,0,0,0,0,0,0,0,0,0,1,13,0,0,0,0,0,0,0,0,0 lpb $0 mov $1,$0 sub $0,1 add $2,1 trn $0,$2 lpe bin $1,$2 mov $0,$1
programs/oeis/334/A334413.asm
neoneye/loda
22
99999
<reponame>neoneye/loda<gh_stars>10-100 ; A334413: First differences of A101803. ; 1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1 mov $4,2 mov $7,$0 lpb $4 mov $0,$7 mov $2,0 sub $4,1 add $0,$4 sub $0,1 mov $5,$0 lpb $0 mul $0,21 add $0,4 mov $2,$0 mov $0,1 div $2,34 lpe mov $3,$4 mov $6,$2 add $6,2 add $6,$5 lpb $3 mov $1,$6 sub $3,1 lpe lpe lpb $7 sub $1,$6 mov $7,0 lpe sub $1,1 mov $0,$1
kernel/base/a64/gdt.asm
Tiihala/Dancy
11
4604
<reponame>Tiihala/Dancy ;; ;; Copyright (c) 2021 <NAME> ;; ;; Permission to use, copy, modify, and/or distribute this software for any ;; purpose with or without fee is hereby granted, provided that the above ;; copyright notice and this permission notice appear in all copies. ;; ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;; ;; base/a64/gdt.asm ;; Global Descriptor Table ;; bits 64 section .text global gdt_load global gdt_load_cs global gdt_load_es global gdt_load_ss global gdt_load_ds global gdt_load_fs global gdt_load_gs global gdt_load_tss global gdt_read_segment align 16 ; void gdt_load(const void *gdt_ptr) gdt_load: lgdt [rcx] ; load global descriptor table xor ecx, ecx ; ecx = 0 (segment selector) lldt cx ; load local descriptor table ret align 16 ; void gdt_load_cs(int sel) gdt_load_cs: push rbx ; save register rbx mov eax, gdt_load_cs_end ; eax = address of gdt_load_cs_end sub rsp, 8 ; decrement stack pointer mov rbx, rsp ; rbx = stack pointer mov [rbx+0], eax ; offset mov [rbx+4], ecx ; selector db 0xFF, 0x2B ; jmp far [rbx] (32-bit) gdt_load_cs_end: add rsp, 8 ; restore stack pointer pop rbx ; restore register rbx ret align 16 ; void gdt_load_es(int sel) gdt_load_es: mov es, ecx ; set segment register es ret align 16 ; void gdt_load_ss(int sel) gdt_load_ss: mov ss, ecx ; set segment register ss ret align 16 ; void gdt_load_ds(int sel) gdt_load_ds: mov ds, ecx ; set segment register ds ret align 16 ; void gdt_load_fs(int sel) gdt_load_fs: mov fs, ecx ; set segment register fs ret align 16 ; void gdt_load_gs(int sel) gdt_load_gs: mov gs, ecx ; set segment register gs ret align 16 ; void gdt_load_tss(int sel) gdt_load_tss: ltr cx ; load task register ret align 16 ; uint32_t gdt_read_segment(int sel, size_t offset) ; ; Interrupts should be disabled before calling this function. gdt_read_segment: push fs ; save segment register fs mov fs, ecx ; set segment register fs mov eax, [fs:rdx] ; eax = return value pop fs ; restore segment register fs ret
grammar/g4files/SPECTREParser.g4
sydelity-net/EDACurry
0
3876
<filename>grammar/g4files/SPECTREParser.g4 // ---------------------------------------------------------------------------- // Author : <NAME> // Date : 04/02/2018 // ---------------------------------------------------------------------------- parser grammar SPECTREParser; options { tokenVocab = SPECTRELexer; } // ============================================================================ netlist : netlist_title? (NL* | EOF) netlist_entity+ (NL* | EOF); // ============================================================================ netlist_title : ID+ (NL* | EOF); // ============================================================================ netlist_entity : include | library | subckt | analysis | global | model | global_declarations | control | component | lang | section | analogmodel | statistics ; // ============================================================================ // Include File (include) // Syntax: // include "<file>" section=<name> // include : standard_include | cpp_include | ahdl_include ; standard_include : INCLUDE filepath parameter_assign? (NL* | EOF); cpp_include : CPP_INCLUDE filepath (NL* | EOF); ahdl_include : AHDL_INCLUDE filepath MINUS? ID? (NL* | EOF); // ============================================================================ // Language Modes // Syntax: // simulator lang=<mode> [insensitive=yes] // lang : SIMULATOR LANGUAGE EQUAL SPICE (NL* | EOF) | SIMULATOR LANGUAGE EQUAL SPECTRE (INSENSITIVE EQUAL ID)? (NL* | EOF); // ============================================================================ // Library Definition // Syntax: // library <name> // statements // library [<name>] // library : library_header library_content+ library_footer; library_header : LIBRARY ID (NL* | EOF); library_content : netlist_entity; library_footer : LIBRARY_END ID? (NL* | EOF); // ============================================================================ // Section Definition // Syntax: // section <name> // statements // endsection [<name>] // section : section_header section_content+ section_footer; section_header : SECTION ID (NL* | EOF); section_content : netlist_entity; section_footer : SECTION_END ID? (NL* | EOF); // ============================================================================ // Analog Model // Syntax: // name [(]<node> ... <node>[)] analogmodel modelname=mastername [<param>=<value> ...] // analogmodel : ID node_list ANALOGMODEL parameter_list?; // ============================================================================ // Sub-circuit definition // Syntax: // [inline] subckt <name> (<node> ... <node>) // [parameters <param>=<value> ...] // statements // ends [<name>] // subckt : subckt_header subckt_content+ subckt_footer; subckt_header : (INLINE_SUBCKT | SUBCKT) ID node_list? NL+; subckt_content : netlist_entity; subckt_footer : SUBCKT_END ID? (NL* | EOF); // ============================================================================ // Structural if-statement (if) // Syntax: // if <condition> { <statement> } [ else { <statement> } ] // if_statement : IF expression if_body if_alternative?; if_alternative : ELSE if_body; if_body : (NL* OPEN_CURLY NL*)? (component | analysis | control | if_statement | NL)+ (NL* CLOSE_CURLY)? (NL* | EOF); // ============================================================================ // Analysis Statements // analysis : ac | acmatch | dc | dcmatch | envlp | sp | stb | sweep | tdr | tran | xf | pac | pdisto | pnoise | psp | pss | pxf | pz | qpac | qpnoise | qpsp | qpss | qpxf | sens | montecarlo | noise | checklimit | reliability; // ------------------------------------ // AC Analysis (ac) // Syntax: // Name ac <param>=<value> ... // ac : ID AC parameter_list? (NL* | EOF); // ------------------------------------ // ACMatch Analysis // Syntax: // Name ([node1] [node2]) acmatch <param>=<value> ... // acmatch : ID ACMATCH node_list? parameter_list? (NL* | EOF); // ------------------------------------ // DC Analysis // Syntax: // Name dc parameter=value ... // dc : ID DC parameter_list? (NL* | EOF); // ------------------------------------ // DC Device Matching Analysis // Syntax: // Name [<node> <node>] dcmatch parameter=value ... // dcmatch : ID node_list? DCMATCH parameter_list? (NL* | EOF); // ------------------------------------ // Envelope Following Analysis // Syntax: // Name [<node> <node>] envlp parameter=value ... // envlp : ID node_list? ENVLP parameter_list? (NL* | EOF); // ------------------------------------ // S-Parameter Analysis // Syntax: // Name sp parameter=value ... // sp : ID SP parameter_list? (NL* | EOF); // ------------------------------------ // Stability Analysis // Syntax: // Name stb parameter=value ... // stb : ID STB parameter_list? (NL* | EOF); // ------------------------------------ // Sweep Analysis // Syntax: // Name sweep [param=value ...] { // <statements // } // sweep : sweep_header sweep_content+ sweep_footer; sweep_header : ID SWEEP NL* parameter_list* OPEN_CURLY (NL* | EOF); sweep_content : netlist_entity; sweep_footer : CLOSE_CURLY (NL* | EOF); // ------------------------------------ // Time-Domain Reflectometer Analysis (tdr) // Syntax: // Name tdr parameter=value ... // tdr : ID TDR parameter_list? (NL* | EOF); // ------------------------------------ // Transient Analysis (tran) // Syntax: // Name tran parameter=value ... // tran : ID TRAN parameter_list? (NL* | EOF); // ------------------------------------ // Transfer Function Analysis (xf) // Syntax: // Name [<node> <node>] xf parameter=value ... // xf : ID node_list? XF parameter_list? (NL* | EOF); // ------------------------------------ // Periodic AC Analysis (pac) // Syntax: // Name [<node> <node>] pac parameter=value ... // pac : ID node_list? PAC parameter_list? (NL* | EOF); // ------------------------------------ // Periodic Distortion Analysis (pdisto) // Syntax: // Name [<node> <node>] pac parameter=value ... // pdisto : ID node_list? PDISTO parameter_list? (NL* | EOF); // ------------------------------------ // Periodic Noise Analysis (pnoise) // Syntax: // Name [<node> <node>] ... pnoise parameter=value ... // pnoise : ID node_list? PNOISE parameter_list? (NL* | EOF); // ------------------------------------ // Periodic S-Parameter Analysis (psp) // Syntax: // Name psp parameter=value ... // psp : ID PSP parameter_list? (NL* | EOF); // ------------------------------------ // Periodic Steady-State Analysis (pss) // Syntax: // Name [<node> <node>] pss parameter=value ... // pss : ID node_list? PSS parameter_list? (NL* | EOF); // ------------------------------------ // Periodic Transfer Function Analysis (pxf) // Syntax: // Name [<node> <node>] ... pxf parameter=value ... // pxf : ID node_list? PXF parameter_list? (NL* | EOF); // ------------------------------------ // PZ Analysis (pz) // Syntax: // Name ... pz parameter=value ... // pz : ID node_list? PZ parameter_list? (NL* | EOF); // ------------------------------------ // Quasi-Periodic AC Analysis (qpac) // Syntax: // Name qpac parameter=value ... // qpac : ID QPAC parameter_list? (NL* | EOF); // ------------------------------------ // Quasi-Periodic Noise Analysis (qpnoise) // Syntax: // Name [<node> <node>] qpnoise parameter=value ... // qpnoise : ID node_list? QPNOISE parameter_list? (NL* | EOF); // ------------------------------------ // Quasi-Periodic S-Parameter Analysis (qpsp) // Syntax: // Name qpsp parameter=value ... // qpsp : ID QPSP parameter_list? (NL* | EOF); // ------------------------------------ // Quasi-Periodic Steady State Analysis (qpss) // Syntax: // Name (<node> <node>) ... qpss parameter=value ... // qpss : ID node_list? QPSS parameter_list? (NL* | EOF); // ------------------------------------ // Quasi-Periodic Transfer Function Analysis (qpxf) // Syntax: // Name [<node> <node>] qpxf parameter=value ... // qpxf : ID node_list? QPXF parameter_list? (NL* | EOF); // ------------------------------------ // Sensitivity Analyses (sens) // Syntax: // sens [(output_variables_list)] [ to (design_parameters_list) ] [ for ( analyses_list ) ] // sens : SENS sens_output_variables_list? (ID sens_design_parameters_list)? (ID sens_design_parameters_list)? (NL* | EOF); sens_output_variables_list : OPEN_ROUND node_list+ CLOSE_ROUND; sens_design_parameters_list : OPEN_ROUND node_list+ CLOSE_ROUND; sens_analyses_list : OPEN_ROUND node_list+ CLOSE_ROUND; // ------------------------------------ // Monte Carlo Analysis (montecarlo) // Syntax: // Name montecarlo parameter=value ... { // analysis statements ... // export statements ... // } // montecarlo : montecarlo_header montecarlo_content+ montecarlo_export montecarlo_footer; montecarlo_header : ID MONTECARLO NL* parameter_list* OPEN_CURLY (NL* | EOF); montecarlo_content : netlist_entity; montecarlo_export : EXPORT parameter_list (NL* | EOF); montecarlo_footer : CLOSE_CURLY (NL* | EOF); // ------------------------------------ // Noise Analysis (noise) // Syntax: // Name [<node> <node>] noise parameter=value ... // noise : ID node_list? NOISE parameter_list? (NL* | EOF); // ------------------------------------ // Checklimit Analysis (checklimit) // Syntax: // Name checklimit parameter=value ... // checklimit : ID CHECKLIMIT parameter_list? (NL* | EOF); // ============================================================================ // Global Nodes (global) // Syntax: // global <ground> <node> ... // ---------------------------------------------------------------------------- global : GLOBAL node_list (NL* | EOF); // ============================================================================ // Model Statements // Syntax: // model name master [[param1=value1] ... [param2=value2 ]] // ---------------------------------------------------------------------------- model : MODEL model_name model_master parameter_list? (NL* | EOF); model_name : ID; model_master : ID | component_type; // ============================================================================ control : alter | altergroup | assert_statement | check_statement | save | option | set | shell | info | nodeset | ic ; // ------------------------------------ // Alter a Circuit, Component, or Netlist Parameter (alter) // Syntax: // Name alter <param>=<value> ... // alter : ID ALTER parameter_list? (NL* | EOF); // ------------------------------------ // Alter Group (altergroup) // Syntax: // Name altergroup <param>=<value> { // {parameters=value} // <altergroup content> // } // altergroup : altergroup_header global_declarations altergroup_content+ altergroup_footer; altergroup_header : ID ALTERGROUP NL* OPEN_CURLY (NL* | EOF); altergroup_content : netlist_entity; altergroup_footer : CLOSE_CURLY (NL* | EOF); // ------------------------------------ // Assert Statement // Syntax: // Name assert sub=subcircuit_master // { dev=instance | mod=model | primitive=primitive } // { param=parameter_name | modelparam=parameter } // [ min=value ] [ max=value ] // [ duration=independentvar_limit ] // [ message=”message”][level= notice | warning | error ] // [ info= yes | no ] // assert_statement : ID ASSERT parameter_assign parameter_list? (NL* | EOF); // ------------------------------------ // Check Statement // Syntax: // Name check <param>=<value> ... // check_statement : ID CHECK parameter_assign (NL* | EOF); // ------------------------------------ // Output Selections (save) // Syntax: // save <node|component|subckt> // ex: save 7 out OpAmp1.comp M1:currents D3:oppoint L1:1 R4:pwr save : SAVE ID parameter_list? (NL* | EOF); // ------------------------------------ // Immediate Set Options (options) // Syntax: // Name options <param>=<value> ... option : ID OPTIONS parameter_list? (NL* | EOF); // ------------------------------------ // Deferred Set Options (set) // Syntax: // Name set <param>=<value> ... set : ID SET parameter_list? (NL* | EOF); // ------------------------------------ // Shell Command (shell) // Syntax: // Name shell <param>=<value> ... shell : ID SHELL parameter_list? (NL* | EOF); // ------------------------------------ // Circuit Information (info) // Syntax: // Name info <param>=<value> ... info : ID INFO parameter_list? (NL* | EOF); // ------------------------------------ // Node Sets (nodeset) // Syntax: // nodeset <node | component | subcircuit>[:param]=value nodeset : NODESET parameter_access? EQUAL expression (NL* | EOF); // ------------------------------------ // Initial conditions // Syntax: // ic signalName=value … ic : IC parameter_list? (NL* | EOF); // ============================================================================ // Statistics block // Syntax: // statistics { <statements> } // process { <statements> } // mismatch { <statements> } // correlate param=[list of parameters] cc=<value> // correlate dev=[list of subcircuit instances] {param=[list of parameters]} cc=<value> // truncate tr=<value> // vary <parameter_name> dist=<type> {std=<value> | N=<value>} {percent=yes|no} statistics : statistics_header statistics_content+ statistics_footer; statistics_header : STATISTICS NL* OPEN_CURLY NL*; statistics_content : process | mismatch | vary | correlate | truncate; statistics_footer : CLOSE_CURLY (NL* | EOF); process : PROCESS NL* OPEN_CURLY NL* statistics_content+ CLOSE_CURLY (NL* | EOF); mismatch : MISMATCH NL* OPEN_CURLY NL* statistics_content+ CLOSE_CURLY (NL* | EOF); correlate : CORRELATE ID EQUAL OPEN_SQUARE parameter_id+ CLOSE_SQUARE (NL* | EOF) | CORRELATE (ID EQUAL OPEN_SQUARE parameter_id+ CLOSE_SQUARE)+ parameter_assign (NL* | EOF); truncate : TRUNCATE parameter_assign (NL* | EOF); vary : VARY ID parameter_list? (NL* | EOF); // ============================================================================ // Reliability Analysis (reliability) // Syntax: // name reliability <global options> { // <reliability control statements> ... // <stress simulation statements> ... // <aging testbench statements> ... // <aging/post-stress simulation statements> ... // } reliability : reliability_header reliability_content+ reliability_footer; reliability_header : ID RELIABILITY parameter_list? NL* OPEN_CURLY NL*; reliability_content : reliability_control | netlist_entity; reliability_footer : CLOSE_CURLY (NL* | EOF); reliability_control : ID parameter_list (NL* | EOF); // ============================================================================ global_declarations : GLOBAL_PARAMETERS OPEN_ROUND parameter_list_item+ CLOSE_ROUND (NL* | EOF) | GLOBAL_PARAMETERS parameter_list_item+ (NL* | EOF); // ============================================================================ // COMPONENTS // ============================================================================ component : component_id node_list? component_master component_attribute* (NL* | EOF); component_id : ID; component_master : ID | component_type; component_attribute : component_value | component_value_list | component_analysis | parameter_assign; component_value : OPEN_CURLY? (STRING | expression) CLOSE_CURLY?; component_value_list : ( PWL | SIN | SFFM | PULSE | WAVE | COEFFS ) EQUAL? OPEN_ROUND (time_pair+ | expression+) CLOSE_ROUND | ( PWL | SIN | SFFM | PULSE | WAVE | COEFFS ) EQUAL? OPEN_SQUARE (time_pair+ | expression+) CLOSE_SQUARE | ( PWL | SIN | SFFM | PULSE | WAVE | COEFFS ) EQUAL? OPEN_CURLY (time_pair+ | expression+) OPEN_CURLY; component_analysis : (AC | DC) OPEN_CURLY expression? CLOSE_CURLY | (AC | DC) expression?; // ============================================================================ node_list : node_list_item+ | OPEN_ROUND node_list_item+ CLOSE_ROUND; node_list_item : node | node_mapping | node_branch; node_mapping : node EQUAL node; node_pair : node COMMA node; node_branch : node COLON node; node : (ID | NUMBER) (DOT node)?; // ============================================================================ expression : expression_unary | expression_function_call | expression_scope | expression_atom | expression_pair | expression expression_operator expression? | expression QUESTION_MARK expression COLON expression; expression_unary : (PLUS | MINUS) expression; expression_function_call : ID OPEN_ROUND (expression COMMA?)+ CLOSE_ROUND; expression_pair : expression_atom COMMA expression_atom; expression_scope : (OPEN_ROUND | OPEN_CURLY | APEX | OPEN_SQUARE) (expression COMMA?)+ (CLOSE_ROUND | CLOSE_CURLY | APEX | CLOSE_SQUARE); expression_operator : EQUAL | PLUS | MINUS | STAR | SLASH | LOGIC_AND | LOGIC_BITWISE_AND | LOGIC_OR | LOGIC_BITWISE_OR | LOGIC_EQUAL | LOGIC_NOT_EQUAL | LOGIC_XOR | LESS_THAN | LESS_THAN_EQUAL | GREATER_THAN | GREATER_THAN_EQUAL | EXCLAMATION_MARK | BITWISE_SHIFT_LEFT | BITWISE_SHIFT_RIGHT | POWER_OPERATOR | CARET | PERCENT; expression_atom : NUMBER | ID | STRING | PERCENTAGE | STRING | keyword | analysis_type | component_type; // ============================================================================ parameter_list : PARAMETERS? OPEN_ROUND? parameter_list_item+ CLOSE_ROUND?; parameter_list_item : parameter_assign | parameter_id; parameter_assign : parameter_id EQUAL expression | parameter_id EQUAL filepath; parameter_id : (ID | SECTION | DC) expression_scope?; parameter_access : COLON (ID | NUMBER); // ============================================================================ // Access the value of a node or an expression. // Example: V(P1) value_access : ID? OPEN_ROUND (expression | node_pair | node) CLOSE_ROUND; value_access_assign : value_access EQUAL expression; // ============================================================================ time_pair : time_point expression | time_point OPEN_CURLY expression CLOSE_CURLY; time_point : expression; // ============================================================================ filepath : filepath_element; filepath_element : ID | STRING | ID filepath_element | APEX filepath_element APEX | SLASH filepath_element | DOT filepath_element | MINUS filepath_element | DOLLAR filepath_element ; /* // ---------------------------------------------------------------------------- // Start with the parser. // ---------------------------------------------------------------------------- netlist : netlist_title? lang_any? ( netlist_entity | (NL* | EOF) )+ EOF; netlist_title : ID+ (NL* | EOF); netlist_entity : | parameter_list //TODO | analogmodel | if_statement | component ; //keyword eldo ? // ---------------------------------------------------------------------------- // .VERILOG // ---------------------------------------------------------------------------- //verilog // : VERILOG verilog_option? filepath; //verilog_option // : OPT_WORK ID; // ---------------------------------------------------------------------------- // Parameters // ---------------------------------------------------------------------------- // param // : (PARAM | PARAMS) parameter_list?; // ---------------------------------------------------------------------------- // Plot // ---------------------------------------------------------------------------- //plot // : PLOT plot_analysis? (display_option)+; //plot_analysis // : DC | KEY_AC | KEY_TRAN | KEY_NOISE; // ---------------------------------------------------------------------------- // FFILE // ---------------------------------------------------------------------------- //ffile // : FFILE ffile_tabulation filepath ffile_unit? ffile_storage_format?; //ffile_tabulation // : ID; //ffile_unit // : ID;//FREQUENCY; //ffile_storage_format // : ID; // ---------------------------------------------------------------------------- // .PROBE // Writes simulation results of specified signals to binary output files (.wdb). // ---------------------------------------------------------------------------- //probe // : PROBE probe_analysis? (probe_probed_values)*; //probe_analysis // : DC | AC | TRAN | NOISE; //probe_probed_values // : ID // | ID OPEN_ROUND (node_pair | node) CLOSE_ROUND; // ---------------------------------------------------------------------------- // Option // ---------------------------------------------------------------------------- //option // : OPTION (ID | parameter_assign)+; // ---------------------------------------------------------------------------- // Extract // ---------------------------------------------------------------------------- //extract // : EXTRACT (expression | parameter_assign)+; // ---------------------------------------------------------------------------- // Defwave // ---------------------------------------------------------------------------- //defwave // : DEFWAVE (ID | parameter_assign)+; // ---------------------------------------------------------------------------- // Checkpoint // ---------------------------------------------------------------------------- //checkpoint // : CHECKPOINT;// TODO // ---------------------------------------------------------------------------- // IF // ---------------------------------------------------------------------------- //if // : IF;// TODO // ---------------------------------------------------------------------------- // OP Operating Points // ---------------------------------------------------------------------------- //op // : OP time_point+; // ---------------------------------------------------------------------------- // Display option // ---------------------------------------------------------------------------- //display_option // : ID OPEN_ROUND (node_pair | node) CLOSE_ROUND; // ---------------------------------------------------------------------------- // User defined functions // ---------------------------------------------------------------------------- user_function : REAL ID OPEN_ROUND (user_function_args)? CLOSE_ROUND NL* OPEN_CURLY NL* (user_function_body)? NL* CLOSE_CURLY; user_function_args : REAL ID | user_function_args COMMA user_function_args ; user_function_body : RETURN expression SEMICOLON? ; */ keyword : ALTER | ALTERGROUP | OPTIONS | SET | SHELL | INFO | NODESET | IC | ASSERT | CHECK | LANGUAGE | PORTS | WAVE | PWL | SIN | SFFM | PULSE | COEFFS | INSENSITIVE | IF | ELSE | PARAMETERS | ANALOGMODEL | CHECKPOINT | SPECTRE | SPICE | STATISTICS | PROCESS | CORRELATE | TRUNCATE | MISMATCH | VARY | RELIABILITY ; analysis_type : AC | ACMATCH | DC | DCMATCH | ENVLP | SP | STB | SWEEP | TDR | TRAN | XF | PAC | PDISTO | PNOISE | PSP | PSS | PXF | PZ | QPAC | QPNOISE | QPSP | QPSS | QPXF | SENS | MONTECARLO | NOISE | CHECKLIMIT; component_type : A2D | B3SOIPD | BJT | BJT301 | BJT500 | BJT503 | BJT504 | BJT504T | BSIM1 | BSIM2 | BSIM3 | BSIM3V3 | BSIM4 | BSIMSOI | BTASOI | CAPACITOR | CCCS | CCVS | CKTROM | CORE | D2A | DELAY | DIO500 | DIODE | EKV | FOURIER | GAAS | HBT | HISIM | HVMOS | INDUCTOR | INTCAP | IPROBE | ISOURCE | JFET | JUNCAP | MISNAN | MOS0 | MOS1 | MOS1000 | MOS1100 | MOS11010 | MOS11011 | MOS15 | MOS2 | MOS3 | MOS30 | MOS3002 | MOS3100 | MOS40 | MOS705 | MOS902 | MOS903 | MSLINE | MTLINE | MUTUAL_INDUCTOR | NODCAP | NODE | NPORT | PARAMTEST | PCCCS | PCCVS | PHY_RES | PORT | PSITFT | PVCCS | PVCVS | QUANTITY | RDIFF | RELAY | RESISTOR | SCCCS | SCCVS | SVCCS | SVCVS | SWITCH | TLINE | TOM2 | TOM3 | TRANSFORMER | VBIC | VCCS | VCVS | VSOURCE | WINDING | ZCCCS | ZCCVS | ZVCCS | ZVCVS | BSOURCE ;
oeis/164/A164316.asm
neoneye/loda-programs
11
243343
<filename>oeis/164/A164316.asm ; A164316: Number of binary strings of length n with no substrings equal to 000, 001, or 010. ; Submitted by <NAME>(w4) ; 1,2,4,5,7,11,16,23,34,50,73,107,157,230,337,494,724,1061,1555,2279,3340,4895,7174,10514,15409,22583,33097,48506,71089,104186,152692,223781,327967,480659,704440,1032407,1513066,2217506,3249913,4762979,6980485,10230398,14993377,21973862,32204260,47197637,69171499,101375759,148573396,217744895,319120654,467694050,685438945,1004559599,1472253649,2157692594,3162252193,4634505842,6792198436,9954450629,14588956471,21381154907,31335605536,45924562007,67305716914,98641322450,144565884457,211871601371 mov $2,1 lpb $0 sub $0,1 mov $4,1 add $4,$3 mov $3,$2 mov $2,$1 add $1,$4 lpe mov $0,$1 add $0,1
Appl/Games/Pyramid/pyramid.asm
steakknife/pcgeos
504
94080
<gh_stars>100-1000 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% (c) Copyright GeoWorks 1991-1995. All Rights Reserved. GEOWORKS CONFIDENTIAL PROJECT: GEOS MODULE: Pyramid FILE: pyramid.asm AUTHOR: <NAME>, Jan 17, 1991 ROUTINES: Name Description ---- ----------- MTD MSG_GEN_PROCESS_OPEN_APPLICATION Sends the game object a MSG_GAME_SETUP_STUFF which readies everything for an exciting session of pyramid! INT PyramidCheckIfGameIsOpen Will check if the varData ATTR_PYRAMID_GAME_OPEN exists for MyPlayingTable INT PyramidMarkGameOpen Will add the varData ATTR_PYRAMID_GAME_OPEN to MyPlayingTable INT PyramidSetViewBackgroundColor Set the background color of the view to green if on a color display and white if on a black and white display MTD MSG_GEN_PROCESS_CLOSE_APPLICATION Misc shutdown stuff. INT PyramidUpdateOptions Get options from INI file and update UI. INT PyramidIgnoreAcceptInput Ignore or accept input. REVISION HISTORY: Name Date Description ---- ---- ----------- Jon 1/7/91 Initial version jacob 6/15/95 initial Jedi version stevey 8/8/95 added Undo feature (+comments :) DESCRIPTION: Some terminology: _/\_ _/ \_ _/ \_ _/ \_ _/ \_ _/ \_ _/ Cards \_ _/ (aka Tableau Elements) \_ _/ = decks 4-31 \_ _/ (or A1-G7) \_ / \ +------------------------------------------+ +--------+ +--------+ +--------+ | | | | | | | | | TopOf- | | My- | | MyHand | | MyHand | | Talon | | | | | | | |(deck 1)| |(deck 2)| |(deck 3)| | | | | | | +--------+ +--------+ +--------+ There's also a MyDiscard deck sitting around that you can't see. $Id: pyramid.asm,v 1.1 97/04/04 15:15:07 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;------------------------------------------------------------------------------ ; Common GEODE stuff ;------------------------------------------------------------------------------ _Application = 1 include stdapp.def include initfile.def include assert.def ;----------------------------------------------------------------------------- ; Product shme ;----------------------------------------------------------------------------- _JEDI equ FALSE ;------------------------------------------------------------------------------ ; Libraries used ;------------------------------------------------------------------------------ UseLib cards.def ;------------------------------------------------------------------------------ ; Resources ;------------------------------------------------------------------------------ include myMacros.def include sizes.def include pyramid.def include pyramid.rdef include pyramidGame.asm include pyramidDeck.asm CommonCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidOpenApplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends the game object a MSG_GAME_SETUP_STUFF which readies everything for an exciting session of pyramid! CALLED BY: MSG_GEN_PROCESS_OPEN_APPLICATION PASS: cx - AppAttachFlags dx - Handle of AppLaunchBlock, or 0 if none. This block contains the name of any document file passed into the application on invocation. Block is freed by caller. bp - Handle of extra state block, or 0 if none. This is the same block as returned from MSG_GEN_PROCESS_CLOSE_APPLICATION, in some previous MSG_META_DETACH. Block is freed by caller. RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 11/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidOpenApplication method dynamic PyramidProcessClass, MSG_GEN_PROCESS_OPEN_APPLICATION .enter call PyramidSetViewBackgroundColor call PyramidCheckIfGameIsOpen ; check for the Lazaurs case jnc gameNotOpen ; the game isn't open gameAlreadyOpen:: mov di, segment PyramidProcessClass mov es, di mov di, offset PyramidProcessClass mov ax, MSG_GEN_PROCESS_OPEN_APPLICATION call ObjCallSuperNoLock jmp done gameNotOpen: test cx, mask AAF_RESTORING_FROM_STATE jz startingUp ; ; We're restoring from state! Restore card bitmaps. ; push cx, dx, bp ; save passed values mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov ax, MSG_GAME_RESTORE_BITMAPS mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx, bp ; restore passed values mov di, segment PyramidProcessClass mov es, di mov di, offset PyramidProcessClass mov ax, MSG_GEN_PROCESS_OPEN_APPLICATION call ObjCallSuperNoLock jmp markGameOpen startingUp: ; ; Startup up for 1st time. ; push cx, dx, bp ; save passed values mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov ax, MSG_GAME_SETUP_STUFF mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx, bp ; restore passed values mov di, segment PyramidProcessClass mov es, di mov di, offset PyramidProcessClass mov ax, MSG_GEN_PROCESS_OPEN_APPLICATION call ObjCallSuperNoLock ; ; We're not restoring from state, so we need to create a full ; deck and start a new game here ; CallObject MyHand, MSG_HAND_MAKE_FULL_HAND, MF_FIXUP_DS CallObject MyPlayingTable, MSG_PYRAMID_NEW_GAME, MF_FORCE_QUEUE ; ; Update options from INI file. ; call PyramidUpdateOptions markGameOpen: ; ; Mark game as "open" for avoiding Lazarus bugs. ; call PyramidMarkGameOpen done: .leave ret PyramidOpenApplication endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidCheckIfGameIsOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will check if the varData ATTR_PYRAMID_GAME_OPEN exists for MyPlayingTable CALLED BY: PyramidOpenApplication PASS: nothing RETURN: carry set if vardata found carry clear if not found DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 7/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidCheckIfGameIsOpen proc near uses ax,bx,cx,dx,si,di,bp .enter sub sp, size GetVarDataParams mov bp, sp mov ss:[bp].GVDP_dataType, \ ATTR_PYRAMID_GAME_OPEN mov {word} ss:[bp].GVDP_bufferSize, 0 mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov ax, MSG_META_GET_VAR_DATA mov dx, size GetVarDataParams mov di, mask MF_CALL or mask MF_STACK call ObjMessage add sp, size GetVarDataParams cmp ax, -1 ; check if not found stc jne varDataFound clc varDataFound: .leave ret PyramidCheckIfGameIsOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidMarkGameOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Will add the varData ATTR_PYRAMID_GAME_OPEN to MyPlayingTable CALLED BY: PyramidOpenApplication PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PW 7/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidMarkGameOpen proc near uses ax,bx,cx,dx,si,di,bp .enter sub sp, size AddVarDataParams mov bp, sp mov ss:[bp].AVDP_dataType, \ ATTR_PYRAMID_GAME_OPEN mov {word} ss:[bp].AVDP_dataSize, size byte clrdw ss:[bp].AVDP_data mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov ax, MSG_META_ADD_VAR_DATA mov dx, size AddVarDataParams mov di, mask MF_CALL or mask MF_STACK call ObjMessage add sp, size AddVarDataParams .leave ret PyramidMarkGameOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidSetViewBackgroundColor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the background color of the view to green if on a color display and white if on a black and white display CALLED BY: PyramidOpenApplication PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: - get the display mode - if color, set view color to green - of monochrome, set to white REVISION HISTORY: Name Date Description ---- ---- ----------- srs 6/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidSetViewBackgroundColor proc near uses ax,bx,cx,dx,di,si,bp .enter ; ; Use VUP_QUERY to field to avoid building GenApp object. ; mov bx, segment GenFieldClass mov si, offset GenFieldClass mov ax, MSG_VIS_VUP_QUERY mov cx, VUQ_DISPLAY_SCHEME ; get display scheme mov di, mask MF_RECORD call ObjMessage ; di = event handle mov cx, di ; cx = event handle mov bx, handle PyramidApp mov si, offset PyramidApp mov ax, MSG_GEN_CALL_PARENT mov di,mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; ah = display type, bp = ptsize ; ; Assume color display. ; mov cx, ((CF_INDEX or (CMT_DITHER shl offset CMM_MAP_TYPE)) \ shl 8) or C_GREEN and ah, mask DT_DISP_CLASS cmp ah, DC_GRAY_1 shl offset DT_DISP_CLASS jne setColor mov cx, ((CF_INDEX or (CMT_DITHER shl offset CMM_MAP_TYPE)) \ shl 8) or C_WHITE setColor: mov bx, handle PyramidView mov si, offset PyramidView mov di, mask MF_FIXUP_DS mov ax, MSG_GEN_VIEW_SET_COLOR call ObjMessage .leave ret PyramidSetViewBackgroundColor endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidCloseApplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Misc shutdown stuff. CALLED BY: MSG_GEN_PROCESS_CLOSE_APPLICATION PASS: es = segment of PyramidProcessClass RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 1/ 3/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidCloseApplication method dynamic PyramidProcessClass, MSG_GEN_PROCESS_CLOSE_APPLICATION uses ax, cx, dx, bp, si .enter mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov di, mask MF_FIXUP_DS or mask MF_CALL mov ax, MSG_GAME_SHUTDOWN call ObjMessage .leave mov di, offset PyramidProcessClass GOTO ObjCallSuperNoLock PyramidCloseApplication endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidSaveOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine saves the current settings of the options menu to the .ini file. CALLED BY: MSG_META_SAVE_OPTIONS PASS: nothing RETURN: nothing DESTROYED: ax, cx, cx, bp PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 1/ 3/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidSaveOptions method PyramidProcessClass, MSG_META_SAVE_OPTIONS ; ; Save which back ; mov ax, MSG_GAME_GET_WHICH_BACK mov bx, handle MyPlayingTable mov si, offset MyPlayingTable mov di, mask MF_CALL call ObjMessage ; cx <- starting level mov bp, cx ; bp <- value mov cx, cs mov ds, cx mov si, offset pyramidCategoryString mov dx, offset pyramidWhichBackString call InitFileWriteInteger ; ; Save the number of cards to flip each time ; mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION mov bx, handle SumToList mov si, offset SumToList mov di, mask MF_CALL call ObjMessage ; ax <- starting level mov_tr bp, ax ; bp <- value mov cx, ds mov si, offset pyramidCategoryString mov dx, offset pyramidSumString call InitFileWriteInteger ; ; Save fade mode. ; mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS mov bx, handle GameOptions mov si, offset GameOptions mov di, mask MF_CALL call ObjMessage ;LES_ACTUAL_EXCL set if on... ; and ax, 1 ;filter through fade bit ???? jfh mov bp, ax ; get bools info to integer mov cx, ds mov si, offset pyramidCategoryString mov dx, offset pyramidOptionsString call InitFileWriteInteger call InitFileCommit ret PyramidSaveOptions endm pyramidCategoryString char "pyramid",0 pyramidWhichBackString char "whichBack",0 pyramidSumString char "sumTo",0 pyramidOptionsString char "options",0 pyramidStatusBarString char "statusBar",0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidUpdateOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get options from INI file and update UI. CALLED BY: PyramidOpenApplication PASS: nothing RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 8/ 8/95 broke out of PyramidOpenApplication %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidUpdateOptions proc near uses ax,bx,cx,dx,si,di,bp .enter ; ; Get which card back we're using. ; mov cx, cs mov ds, cx ;DS:SI <- ptr to category string mov si, offset pyramidCategoryString mov dx, offset pyramidWhichBackString call InitFileReadInteger jc sumTo mov_trash cx, ax ;cx <- which back mov ax, MSG_GAME_SET_WHICH_BACK mov bx, handle MyPlayingTable mov si, offset MyPlayingTable clr di call ObjMessage sumTo: ; ; Get the sum-to number. ; mov cx, cs mov ds, cx mov si, offset pyramidCategoryString mov dx, offset pyramidSumString call InitFileReadInteger jc hide mov_tr cx, ax ;cx <- which back clr dx ; not indeterminate mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION mov bx, handle SumToList mov si, offset SumToList clr di call ObjMessage hide: ; ; Get options & update UI. ; mov cx, cs mov ds, cx mov si, offset pyramidCategoryString ; category mov dx, offset pyramidOptionsString ; key call InitFileReadInteger jc statusBar mov_tr cx, ax clr dx mov bx, handle GameOptions mov si, offset GameOptions mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE clr di call ObjMessage statusBar: ; ; Set usable or not the "Status Bar" ; clr ax ; assume FALSE mov cx, cs mov ds, cx mov si, offset pyramidCategoryString ;category mov dx, offset pyramidStatusBarString ;key call InitFileReadBoolean ;look into the .ini file tst ax jz done ; if not present, do nothing mov ax, MSG_GEN_SET_USABLE mov bx, handle StatusBar mov si, offset StatusBar mov dl, VUM_DELAYED_VIA_UI_QUEUE clr di call ObjMessage done: .leave ret PyramidUpdateOptions endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PyramidIgnoreAcceptInput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Ignore or accept input. CALLED BY: UTILITY PASS: ax = MSG_GEN_APPLICATION_ACCEPT_INPUT, MSG_GEN_APPLICATION_IGNORE_INPUT, MSG_GEN_APPLICATION_MARK_BUSY, or MSG_GEN_APPLICATION_MARK_NOT_BUSY RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 8/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PyramidIgnoreAcceptInput proc near uses ax,bx,cx,dx,si,di,bp .enter mov bx, handle PyramidApp mov si, offset PyramidApp mov di, mask MF_CALL call ObjMessage .leave ret PyramidIgnoreAcceptInput endp CommonCode ends
src/data/print.asm
natiiix/Nebula
1
8803
<reponame>natiiix/Nebula SECTION .data ; VGA cursor position xpos db 0 ypos db 0 ; String used for printing hexadecimal numbers. hexstr db "00000000" ; Null terminator character of the hexstr. hexstr_end db 0 ; Pointer into the hexstr used for printing hexadecimal numbers. hexaddr dd 0 SECTION .rodata ; Conversion table from 4-bit value to hexadecimal digit. hextab db "0123456789ABCDEF" ; Prefix used when printing hexadecimal values. hexpre db "0x", 0
oeis/135/A135918.asm
neoneye/loda-programs
11
164712
<gh_stars>10-100 ; A135918: Genus of stage-n Menger sponge. ; Submitted by <NAME> ; 0,5,81,1409,26433,514625,10180161,202704449,4046898753,80880453185,1617148888641,32339296372289,646756476241473,12934893915194945,258695993426822721,5173904789519844929,103477975158264022593,2069558538108217443905,41391163041707844814401,827823199070504863778369,16556463487300881015490113,331129265793143890229184065,6622585284239887963938735681,132451705431813840553615148609,2649034106612405461271026452033,52980682116057138427010316879425,1059613642191615002152924640298561 mov $1,2 mov $2,1 lpb $0 sub $0,1 mul $1,8 mul $2,20 add $2,2 lpe add $2,$1 mov $0,$2 div $0,7
project 07/StackArithmetic/StackTest/StackTest.asm
jack-zheng/nand2tetris
0
166914
<reponame>jack-zheng/nand2tetris // push constant 17 @17 D=A @SP A=M M=D @SP M=M+1 // push constant 17 @17 D=A @SP A=M M=D @SP M=M+1 // eq @SP AM=M-1 D=M A=A-1 D=D-M @EQ0 D,JEQ @SP A=M-1 M=0 @END0 0,JMP (EQ0) @SP A=M-1 M=-1 (END0) // push constant 17 @17 D=A @SP A=M M=D @SP M=M+1 // push constant 16 @16 D=A @SP A=M M=D @SP M=M+1 // eq @SP AM=M-1 D=M A=A-1 D=D-M @EQ1 D,JEQ @SP A=M-1 M=0 @END1 0,JMP (EQ1) @SP A=M-1 M=-1 (END1) // push constant 16 @16 D=A @SP A=M M=D @SP M=M+1 // push constant 17 @17 D=A @SP A=M M=D @SP M=M+1 // eq @SP AM=M-1 D=M A=A-1 D=D-M @EQ2 D,JEQ @SP A=M-1 M=0 @END2 0,JMP (EQ2) @SP A=M-1 M=-1 (END2) // push constant 892 @892 D=A @SP A=M M=D @SP M=M+1 // push constant 891 @891 D=A @SP A=M M=D @SP M=M+1 // lt @SP AM=M-1 D=M A=A-1 D=D-M @GT3 D,JGT @SP A=M-1 M=0 @END3 0,JMP (GT3) @SP A=M-1 M=-1 (END3) // push constant 891 @891 D=A @SP A=M M=D @SP M=M+1 // push constant 892 @892 D=A @SP A=M M=D @SP M=M+1 // lt @SP AM=M-1 D=M A=A-1 D=D-M @GT4 D,JGT @SP A=M-1 M=0 @END4 0,JMP (GT4) @SP A=M-1 M=-1 (END4) // push constant 891 @891 D=A @SP A=M M=D @SP M=M+1 // push constant 891 @891 D=A @SP A=M M=D @SP M=M+1 // lt @SP AM=M-1 D=M A=A-1 D=D-M @GT5 D,JGT @SP A=M-1 M=0 @END5 0,JMP (GT5) @SP A=M-1 M=-1 (END5) // push constant 32767 @32767 D=A @SP A=M M=D @SP M=M+1 // push constant 32766 @32766 D=A @SP A=M M=D @SP M=M+1 // gt @SP AM=M-1 D=M A=A-1 D=D-M @LT6 D,JLT @SP A=M-1 M=0 @END6 0,JMP (LT6) @SP A=M-1 M=-1 (END6) // push constant 32766 @32766 D=A @SP A=M M=D @SP M=M+1 // push constant 32767 @32767 D=A @SP A=M M=D @SP M=M+1 // gt @SP AM=M-1 D=M A=A-1 D=D-M @LT7 D,JLT @SP A=M-1 M=0 @END7 0,JMP (LT7) @SP A=M-1 M=-1 (END7) // push constant 32766 @32766 D=A @SP A=M M=D @SP M=M+1 // push constant 32766 @32766 D=A @SP A=M M=D @SP M=M+1 // gt @SP AM=M-1 D=M A=A-1 D=D-M @LT8 D,JLT @SP A=M-1 M=0 @END8 0,JMP (LT8) @SP A=M-1 M=-1 (END8) // push constant 57 @57 D=A @SP A=M M=D @SP M=M+1 // push constant 31 @31 D=A @SP A=M M=D @SP M=M+1 // push constant 53 @53 D=A @SP A=M M=D @SP M=M+1 // add @SP AM=M-1 D=M A=A-1 M=D+M // push constant 112 @112 D=A @SP A=M M=D @SP M=M+1 // sub @SP AM=M-1 D=M A=A-1 M=M-D // neg @SP A=M-1 M=-M // and @SP AM=M-1 D=M A=A-1 M=D&M // push constant 82 @82 D=A @SP A=M M=D @SP M=M+1 // or @SP AM=M-1 D=M A=A-1 M=D|M // not @SP A=M-1 M=!M
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1611.asm
ljhsiun2/medusa
9
167784
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %r9 push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1adcf, %rsi lea addresses_UC_ht+0xe297, %rdi sub %r15, %r15 mov $100, %rcx rep movsb nop nop add $17030, %r11 lea addresses_WC_ht+0x1c357, %rsi lea addresses_UC_ht+0x1d697, %rdi nop nop nop and $23276, %r15 mov $55, %rcx rep movsb nop nop nop nop xor $8715, %rcx lea addresses_WT_ht+0xe497, %rsi lea addresses_WT_ht+0x7d97, %rdi nop nop nop sub $10094, %r15 mov $42, %rcx rep movsq nop nop dec %rsi lea addresses_normal_ht+0x1b46f, %r11 nop nop nop nop inc %rdi mov (%r11), %cx nop nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0x9297, %r12 and %r9, %r9 mov (%r12), %si nop dec %r12 lea addresses_WC_ht+0x126d7, %r11 clflush (%r11) sub $51805, %r15 movl $0x61626364, (%r11) add %r11, %r11 lea addresses_A_ht+0x4457, %r15 clflush (%r15) nop cmp $125, %rcx movb (%r15), %r9b nop nop nop nop cmp %r12, %r12 pop %rsi pop %rdi pop %rcx pop %r9 pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r9 push %rax push %rcx push %rdi push %rsi // REPMOV lea addresses_PSE+0x1cc57, %rsi mov $0xe03, %rdi nop nop nop and $45248, %rax mov $76, %rcx rep movsb nop nop cmp $56316, %rsi // Faulty Load lea addresses_normal+0x10a97, %rcx nop cmp $638, %rsi vmovups (%rcx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r9 lea oracles, %rax and $0xff, %r9 shlq $12, %r9 mov (%rax,%r9,1), %r9 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_PSE', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_P', 'congruent': 2, 'same': False}, 'OP': 'REPM'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': True, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, '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 */
tools/asmx2/test/jerry.asm
retro16/blastsdk
10
18986
<reponame>retro16/blastsdk ADD R1,R2 ; 0 0022 ADDC R1,R2 ; 1 0422 ADDQ 1,R2 ; 2 0822 ADDQT 1,R2 ; 3 0C22 SUB R1,R2 ; 4 1022 SUBC R1,R2 ; 5 1422 SUBQ 1,R2 ; 6 1822 SUBQT 1,R2 ; 7 1C22 NEG R2 ; 8 2002 AND R1,R2 ; 9 2422 OR R1,R2 ; 10 2822 XOR R1,R2 ; 11 2C22 NOT R2 ; 12 3002 BTST 1,R2 ; 13 3422 BSET 1,R2 ; 14 3822 BCLR 1,R2 ; 15 3C22 MULT R1,R2 ; 16 4022 IMULT R1,R2 ; 17 4422 IMULTN R1,R2 ; 18 4822 RESMAC R2 ; 19 4C02 IMACN R1,R2 ; 20 5022 DIV R1,R2 ; 21 5422 ABS R2 ; 22 5802 SH R1,R2 ; 23 5C22 SHLQ 31,R2 ; 24 6022 SHRQ 31,R2 ; 25 6422 SHA R1,R2 ; 26 6822 SHARQ 31,R2 ; 27 6C22 ROR R1,R2 ; 28 7022 RORQ 1,R2 ; 29 7422 ROLQ 31,R2 ; 29 7422 CMP R1,R2 ; 30 7822 CMPQ 1,R2 ; 31 7C22 SAT8 R2 ; 32 T 8002 SUBQMOD 1,R2 ; 32 J 8022 SAT16 R2 ; 33 T 8402 SAT16S R2 ; 33 J 8402 MOVE R1,R2 ; 34 8822 MOVEQ 1,R2 ; 35 8C22 MOVETA R1,R2 ; 36 9022 MOVEFA R1,R2 ; 37 9422 MOVEI $12345678,R2 ; 38 9802 56781234 LOADB (R1),R2 ; 39 9C22 LOADW (R1),R2 ; 40 A022 LOAD (R1),R2 ; 41 A422 LOADP (R1),R2 ; 42 T A822 SAT32S R2 ; 42 J A802 LOAD (R14+1),R2 ; 43 AC22 LOAD (R15+1),R2 ; 44 B022 STOREB R1,(R2) ; 45 B422 STOREW R1,(R2) ; 46 B822 STORE R1,(R2) ; 47 BC22 STOREP R1,(R2) ; 48 T C022 MIRROR R2 ; 48 J C002 STORE R1,(R14+2) ; 49 C422 STORE R1,(R15+2) ; 50 C822 MOVE PC,R2 ; 51 CC02 JUMP $02,(R1) ; 52 D022 JR $02,*+2 ; 53 D422 MMULT R1,R2 ; 54 D822 MTOI R1,R2 ; 55 DC22 NORMI R1,R2 ; 56 E022 NOP ; 57 E400 LOAD (R14+R1),R2 ; 58 E822 LOAD (R15+R1),R2 ; 59 EC22 STORE R1,(R14+R2) ; 60 F022 STORE R1,(R15+R2) ; 61 F422 SAT24 R2 ; 62 J F802 UNPACK R2 ; 63 T FC02 PACK R2 ; 63 T FC22 ADDQMOD 1,R2 ; 63 J FC22
programs/oeis/253/A253710.asm
neoneye/loda
22
90988
<reponame>neoneye/loda ; A253710: Second partial sums of tenth powers (A008454). ; 1,1026,61100,1169750,12044025,83384476,437200176,1864757700,6779099625,21693441550,62545208076,165314338826,405941961425,935824239000,2042356907200,4248401203176,8470439399601,16262944822650,30186516503500,54350088184350,95193540843401,162596916293876,271426802958000,443660070587500 lpb $0 add $0,1 mov $2,$0 sub $0,2 seq $2,23002 ; Sum of 10th powers. add $1,$2 lpe add $1,1 mov $0,$1
SOURCE ASM FILES/FPSHack_16_SlowJ3DFrameCtrl_CheckPass.asm
Meowmaritus/Wind-Waker-60FPS-Hack
14
5885
<gh_stars>10-100 #To be inserted at 802ef614 ######################################### ##FPSHack_16_SlowJ3DFrameCtrl_CheckPass## ######################################### lis r17, 0x817F lfs f17, 0x0004 (r17) fmuls f0, f0, f17 #Slow the frame delta thing? fadds f3, f0, f2 #Vanilla
ada/gui/demo/agar_ada_demo.adb
auzkok/libagar
286
16766
<reponame>auzkok/libagar<gh_stars>100-1000 ------------------------------------------ -- agar_ada_demo.adb: Agar-GUI Ada demo -- ------------------------------------------ with Agar.Init; with Agar.Error; with Agar.Data_Source; with Agar.Event; with Agar.Timer; with Agar.Object; with Agar.Init_GUI; with Agar.Surface; use Agar.Surface; with Agar.Text; --with Agar.Widget; with Interfaces; use Interfaces; with System; with Ada.Characters.Latin_1; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; procedure agar_ada_demo is package T_IO renames Ada.Text_IO; package RT renames Ada.Real_Time; package LAT1 renames Ada.Characters.Latin_1; Epoch : constant RT.Time := RT.Clock; Major, Minor, Patch : Natural; begin -- -- Initialize the Agar-Core library. -- if not Agar.Init.Init_Core ("agar_ada_demo") then raise program_error with Agar.Error.Get_Error; end if; -- -- Initialize the Agar-GUI library and auto-select the driver backend. -- if not Agar.Init_GUI.Init_Graphics ("") then raise program_error with Agar.Error.Get_Error; end if; -- -- Print Agar version and memory model. -- declare begin Agar.Init.Get_Version(Major, Minor, Patch); T_IO.Put_Line(" _ _ _ ___ _ ___ _"); T_IO.Put_Line(" / _ \ / _ \ / _ \ | _ \ / _ \ | _ \ / _ \"); T_IO.Put_Line(" | |_| | | (_| | | |_| | | |_) | - | |_| | | |_) | | |_| |"); T_IO.Put_Line(" |_| |_| \__, | |_| |_| |_| |_| |_| |_| |___ / |_| |_|"); T_IO.Put_Line(" |___/ "); T_IO.Put_Line (Integer'Image(Major) & "." & Integer'Image(Minor) & "." & Integer'Image(Patch)); #if AG_MODEL = AG_SMALL T_IO.Put_Line("Memory model: SMALL"); elsif AG_MODEL = AG_MEDIUM T_IO.Put_Line("Memory model: MEDIUM"); #elsif AG_MODEL = AG_LARGE T_IO.Put_Line("Memory model: LARGE"); #end if; T_IO.Put_Line("Agar was initialized in" & Duration'Image(RT.To_Duration(RT.Clock - Epoch)) & "s"); end; -- -- Check that the ada object sizes match the definitions in agar.def -- (which is generated by a configure test which invokes the C API). -- declare procedure Check_Sizeof (Name : String; Size : Natural; D_Size : Natural) is Size_Bytes : constant Natural := Size / System.Storage_Unit; begin if (Size_Bytes /= D_Size) then raise Program_Error with "Size of " & Name & " (" & Natural'Image(Size_Bytes) & ") " & "differs from C API (" & Natural'Image(D_Size) & "). Need to recompile?"; else T_IO.Put_Line("Size of " & Name & " =" & Natural'Image(Size_Bytes) & " OK"); end if; end; begin -- Core -- Check_Sizeof("AG_Object", Agar.Object.Object'Size, $SIZEOF_AG_OBJECT); Check_Sizeof("AG_ObjectClass", Agar.Object.Class'Size, $SIZEOF_AG_OBJECTCLASS); Check_Sizeof("AG_DataSource", Agar.Data_Source.Data_Source'Size, $SIZEOF_AG_DATASOURCE); Check_Sizeof("AG_Event", Agar.Event.Event'Size, $SIZEOF_AG_EVENT); Check_Sizeof("AG_TimerPvt", Agar.Timer.Timer_Private'Size, $SIZEOF_AG_TIMERPVT); Check_Sizeof("AG_Timer", Agar.Timer.Timer'Size, $SIZEOF_AG_TIMER); -- GUI -- Check_Sizeof("AG_Color", Agar.Surface.AG_Color'Size, $SIZEOF_AG_COLOR); Check_Sizeof("AG_FontSpec", Agar.Text.AG_Font_Spec'Size, $SIZEOF_AG_FONTSPEC); Check_Sizeof("AG_Font", Agar.Text.AG_Font'Size, $SIZEOF_AG_FONT); Check_Sizeof("AG_Glyph", Agar.Text.AG_Glyph'Size, $SIZEOF_AG_GLYPH); Check_Sizeof("AG_TextState", Agar.Text.AG_Text_State'Size, $SIZEOF_AG_TEXTSTATE); Check_Sizeof("AG_TextMetrics", Agar.Text.AG_Text_Metrics'Size, $SIZEOF_AG_TEXTMETRICS); Check_Sizeof("AG_Rect", Agar.Surface.AG_Rect'Size, $SIZEOF_AG_RECT); Check_Sizeof("AG_PixelFormat", Agar.Surface.Pixel_Format'Size, $SIZEOF_AG_PIXELFORMAT); Check_Sizeof("AG_Surface", Agar.Surface.Surface'Size, $SIZEOF_AG_SURFACE); end; -- -- Create a surface of pixels. -- declare W : constant Natural := 640; H : constant Natural := 480; Surf : constant Surface_Access := New_Surface(W,H); Blue : aliased AG_Color := Color_8(0,0,200,255); Border_W : constant Natural := 20; begin if Surf = null then raise Program_Error with Agar.Error.Get_Error; end if; -- -- Fill the background with a given color. -- Here are different ways of specifying colors: -- Fill_Rect (Surface => Surf, Color => Color_8(200,0,0)); -- 8-bit RGB components Fill_Rect (Surface => Surf, Color => Color_16(51400,0,0)); -- 16-bit RGB components Fill_Rect (Surface => Surf, Color => Color_HSV(0.9, 1.0, 1.0, 1.0)); -- Hue, Saturation & Value Fill_Rect (Surface => Surf, Color => Blue); -- An AG_Color argument -- Fill_Rect -- (Surface => Surf, -- Color => Blue'Unchecked_Access); -- An AG_Color access -- -- Use Put_Pixel to create a gradient. -- T_IO.Put_Line("Creating gradient"); for Y in Border_W .. H-Border_W loop if Y rem 4 = 0 then Blue.B := Blue.B - Component_Offset_8(1); end if; Blue.G := 0; for X in Border_W .. W-Border_W loop if X rem 8 = 0 then Blue.G := Blue.G + Component_Offset_8(1); end if; Put_Pixel (Surface => Surf, X => X, Y => Y, Pixel => Map_Pixel(Surf, Blue), Clipping => false); end loop; end loop; -- -- Generate a 2-bit indexed surface and initialize its 4-color palette. -- declare Bitmap : Surface_Access; begin T_IO.Put_Line("Generating a 2-bpp (4-color) indexed surface"); Bitmap := New_Surface (Mode => INDEXED, Bits_per_Pixel => 2, W => 128, H => 128); -- R G B -- Set_Color(Bitmap, 0, Color_8(0, 0, 0)); Set_Color(Bitmap, 1, Color_8(0, 100,0)); Set_Color(Bitmap, 2, Color_8(150,0, 0)); Set_Color(Bitmap, 3, Color_8(200,200,0)); for Y in 0 .. Bitmap.H loop for X in 0 .. Bitmap.W loop if Natural(X) rem 16 = 0 then Put_Pixel (Surface => Bitmap, X => Integer(X), Y => Integer(Y), Pixel => 1); else if Natural(Y) rem 8 = 0 then Put_Pixel (Surface => Bitmap, X => Integer(X), Y => Integer(Y), Pixel => 1); elsif Sqrt(Float(X)*Float(X) + Float(Y)*Float(Y)) < 50.0 then Put_Pixel (Surface => Bitmap, X => Integer(X), Y => Integer(Y), Pixel => 2); elsif Sqrt(Float(X)*Float(X) + Float(Y)*Float(Y)) > 150.0 then Put_Pixel (Surface => Bitmap, X => Integer(X), Y => Integer(Y), Pixel => 3); else Put_Pixel (Surface => Bitmap, X => Integer(X), Y => Integer(Y), Pixel => 0); end if; end if; end loop; end loop; -- -- Export our 2bpp bitmap to a PNG file. -- T_IO.Put_Line("Writing 2bpp bitmap to output-index.png"); if not Export_PNG(Bitmap, "output-index.png") then T_IO.Put_Line ("output-index.png: " & Agar.Error.Get_Error); end if; -- -- Blit our 2bpp bitmap to Surf. -- T_IO.Put_Line("Blitting 2bpp bitmap, converting"); Blit_Surface (Source => Bitmap, Target => Surf, Dst_X => 32, Dst_Y => 32); -- Blit again with a different palette. Set_Color(Bitmap, 0, Color_8(255,255,255)); Set_Color(Bitmap, 1, Color_8(100,100,180)); Set_Color(Bitmap, 2, Color_8(120,0,0)); Set_Color(Bitmap, 3, Color_8(0,0,150)); Blit_Surface (Source => Bitmap, Target => Surf, Dst_X => 200, Dst_Y => 32); Free_Surface (Bitmap); end; -- -- Test the font engine by rendering text to a surface. -- T_IO.Put_Line("Testing Agar's font engine"); declare Hello_Label : Surface_Access; Text_W, Text_H : Natural; Line_Count : Natural; begin -- Push rendering attributes onto the stack. Agar.Text.Push_Text_State; -- Set the text color. Agar.Text.Text_Set_Color_8(16#73fa00ff#); -- Render some text. Hello_Label := Agar.Text.Text_Render("Hello, world!"); T_IO.Put_Line("Rendered `Hello' is: " & C.unsigned'Image(Hello_Label.W) & "x" & C.unsigned'Image(Hello_Label.H) & "x" & C.int'Image(Hello_Label.Format.Bits_per_Pixel) & "bpp"); Blit_Surface (Source => Hello_Label, Target => Surf, Dst_X => 0, Dst_Y => 0); Free_Surface(Hello_Label); -- Change some attributes and render text again. Agar.Text.Text_Set_BG_Color_8(16#00ee00ff#); Agar.Text.Text_Set_Color_8(16#000000ff#); Agar.Text.Text_Set_Font (Family => "courier-prime", Size => Agar.Text.AG_Font_Points(18), Bold => True); Hello_Label := Agar.Text.Text_Render("Hello, world!"); Blit_Surface (Source => Hello_Label, Target => Surf, Dst_X => 100, Dst_Y => 0); Free_Surface(Hello_Label); -- Set to 150% of the current font size and dark green BG. Agar.Text.Text_Set_Font (Percent => 150); Agar.Text.Text_Set_Color_8(255,150,150); Agar.Text.Text_Set_BG_Color_8(16#005500ff#); Hello_Label := Agar.Text.Text_Render ("Agar v" & Integer'Image(Major) & "." & Integer'Image(Minor) & "." & Integer'Image(Patch)); Blit_Surface (Source => Hello_Label, Target => Surf, Dst_X => 360, Dst_Y => 420); Free_Surface(Hello_Label); -- Calculate how large a surface needs to be to fit rendered text. Agar.Text.Size_Text (Text => "Agar version " & Integer'Image(Major) & "." & Integer'Image(Minor) & "." & Integer'Image(Patch), W => Text_W, H => Text_H); T_IO.Put_Line("Font engine says `Hello' should take" & Natural'Image(Text_W) & " x " & Natural'Image(Text_H) & " pixels"); Agar.Text.Size_Text (Text => "Hello, one" & LAT1.CR & LAT1.LF & "two" & LAT1.CR & LAT1.LF & "and three", W => Text_W, H => Text_H, Line_Count => Line_Count); T_IO.Put_Line("Font engine says three lines should take" & Natural'Image(Text_W) & " x" & Natural'Image(Text_H) & " pixels and" & Natural'Image(Line_Count) & " lines"); -- -- Calculate offsets needed to justify and align text in a given area. -- declare X,Y : Integer; begin Agar.Text.Text_Align (W_Area => 320, H_Area => 240, W_Text => Text_W, H_Text => Text_H, X => X, Y => Y); T_IO.Put_Line("To center it in 320x240, offsets would be X:" & Natural'Image(X) & ", Y:" & Natural'Image(Y)); end; -- Pop rendering attributes off the stack. Agar.Text.Pop_Text_State; end; -- -- Set a clipping rectangle. -- Set_Clipping_Rect (Surface => Surf, X => 55, Y => 220, W => 640-(55*2), H => 200); -- -- Show the extent of the clipping rectangle. -- T_IO.Put_Line("Testing clipping rectangles"); declare White : constant AG_Pixel := Map_Pixel(Surf, Color_8(255,255,255)); Clip_X : constant Integer := Integer(Surf.Clip_Rect.X); Clip_Y : constant Integer := Integer(Surf.Clip_Rect.Y); Clip_W : constant Integer := Integer(Surf.Clip_Rect.W); Clip_H : constant Integer := Integer(Surf.Clip_Rect.H); procedure Put_Crosshairs (Surface : Surface_Access; X,Y : Natural; Pixel : AG_Pixel) is begin for Z in 1 .. 3 loop Put_Pixel (Surface, X+Z,Y, Pixel, Clipping => false); Put_Pixel (Surface, X-Z,Y, Pixel, Clipping => false); Put_Pixel (Surface, X,Y+Z, Pixel, Clipping => false); Put_Pixel (Surface, X,Y-Z, Pixel, Clipping => false); end loop; end; begin Put_Crosshairs (Surf, Clip_X, Clip_Y, White); Put_Crosshairs (Surf, Clip_X+Clip_W, Clip_Y, White); Put_Crosshairs (Surf, Clip_X+Clip_W, Clip_Y+Clip_H, White); Put_Crosshairs (Surf, Clip_X, Clip_Y+Clip_H, White); end; T_IO.Put_Line ("Surf W:" & C.unsigned'Image(Surf.W) & " H:" & C.unsigned'Image(Surf.H) & " Pitch:" & C.unsigned'Image(Surf.Pitch) & " Clip_X:" & C.int'Image(Surf.Clip_Rect.X) & " Clip_Y:" & C.int'Image(Surf.Clip_Rect.Y) & " Clip_W:" & C.int'Image(Surf.Clip_Rect.W) & " Clip_H:" & C.int'Image(Surf.Clip_Rect.H) & " Padding:" & C.unsigned'Image(Surf.Padding)); -- -- Load a surface from a PNG file and blit it onto Surf. Transparency is -- expressed by colorkey, or by an alpha component of 0 (in packed RGBA). -- T_IO.Put_Line("Testing transparency"); declare Denis : constant Surface_Access := New_Surface("axe.png"); Degs : Float := 0.0; Alpha : AG_Component := 0; begin if Denis /= null then T_IO.Put_Line ("Denis W:" & C.unsigned'Image(Denis.W) & " H:" & C.unsigned'Image(Denis.H) & " Pitch:" & C.unsigned'Image(Denis.Pitch) & " Clip_X:" & C.int'Image(Denis.Clip_Rect.X) & " Clip_Y:" & C.int'Image(Denis.Clip_Rect.Y) & " Clip_W:" & C.int'Image(Denis.Clip_Rect.W) & " Clip_H:" & C.int'Image(Denis.Clip_Rect.H) & " Padding:" & C.unsigned'Image(Denis.Padding)); for Y in 1 .. 50 loop Degs := Degs + 30.0; Set_Alpha (Surface => Denis, Alpha => Alpha); -- Per-surface alpha Alpha := Alpha + 12; -- Render to target coordinates under Surf. for Z in 1 .. 3 loop Blit_Surface (Source => Denis, Target => Surf, Dst_X => Y*25, Dst_Y => H/2 + Z*40 - Natural(Denis.H)/2 - Integer(50.0 * Sin(Degs,360.0))); end loop; end loop; else T_IO.Put_Line (Agar.Error.Get_Error); end if; end; T_IO.Put_Line("Testing export to PNG"); if not Export_PNG(Surf, "output.png") then raise program_error with Agar.Error.Get_Error; end if; T_IO.Put_Line ("Surface saved to output.png"); Free_Surface(Surf); end; T_IO.Put_Line ("Exiting after" & Duration'Image(RT.To_Duration(RT.Clock - Epoch)) & "s"); Agar.Init.Quit; end agar_ada_demo;
BunchFinder.scpt
dotjay/BunchFinder
2
964
<reponame>dotjay/BunchFinder #!/usr/bin/osascript -l AppleScript on run args set bunchName to system attribute "BUNCH" set bunchDir to system attribute "BUNCH_DIR" set bunchPhase to system attribute "BUNCH_PHASE" if bunchPhase is "CLOSE" then return end if if character -1 of bunchDir is not "/" then set bunchDir to bunchDir & "/" end if -- Set up source file path set bunchFinderFileName to bunchName & ".bunchfinder" set bunchFinderFilePath to bunchDir & bunchFinderFileName -- Try to read source file try set bunchFinderFileHandle to (open for access POSIX file bunchFinderFilePath) set bunchFinderFileContent to read bunchFinderFileHandle on error display dialog "Create the file: " & bunchFinderFileName return end try -- Read the file content for paths and open in a new Finder window set startNewWindow to true repeat with i from 1 to count of paragraph in bunchFinderFileContent -- Trim the line to avoid issues with whitespace set bunchFinderLine to trim(paragraph i of bunchFinderFileContent) if bunchFinderLine is "" then -- Any blank lines indicate that a new Finder window should be opened set startNewWindow to true else if (character 1 of bunchFinderLine) is not "#" then -- This is not a comment, so it could be a folder path set folderPath to bunchFinderLine as string -- Handle Home directory shorthand "~" if folderPath starts with "~" then set folderPath to POSIX path of (path to home folder) & text 3 thru -1 of (get folderPath) -- Only open directories that exist if isDirectory(folderPath) then tell application "Finder" if startNewWindow then set bunchFinderWindow to make new Finder window set startNewWindow to false else my makeNewFinderTab() set bunchFinderWindow to front window end if set target of bunchFinderWindow to (folderPath as POSIX file) end tell end if end if end repeat end run on isDirectory(thePath) try set thisPath to POSIX file thePath as alias tell application "System Events" if thisPath is package folder or kind of thisPath is "Folder" or kind of thisPath is "Volume" then return true end if end tell return false on error return false end try end isDirectory on makeNewFinderTab() tell application "System Events" to tell application process "Finder" set frontmost to true tell front menu bar to tell menu "File" to tell menu item "New Tab" perform action "AXPress" end tell end tell end makeNewFinderTab on trim(theText) return (do shell script "echo \"" & theText & "\" | xargs") end trim
Asm4Kids/3printname.asm
jacmoe/c64adventures
17
165539
; prints 'jacob' on the screen ; 10 SYS (49152) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28, $34, $39, $31, $35, $32, $29, $00, $00, $00 *=$c000 jsr $e544 lda #74 ; j jsr $e716 lda #65 ; a jsr $e716 lda #67 ; c jsr $e716 lda #79 ; o jsr $e716 lda #66 ; b jsr $e716 rts
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/discr1_pkg.ads
best08618/asylo
7
24535
package Discr1_Pkg is Maximum_Length : Natural := 80 ; subtype String_Length is Natural range 0 .. Maximum_Length; type Variable_String (Length : String_Length := 0) is record S : String (1 .. Length); end record; type Variable_String_Array is array (Natural range <>) of Variable_String; end Discr1_Pkg;
programs/oeis/082/A082691.asm
neoneye/loda
22
9581
<filename>programs/oeis/082/A082691.asm<gh_stars>10-100 ; A082691: a(1)=1, a(2)=2, then if 3*2^k-1 first terms are a(1),a(2),.........,a(3*2^k - 1) we have the 3*2^(k+1)-1 first terms as : a(1),a(2),.........,a(3*2^k - 1),a(1),a(2),.........,a(3*2^k - 1),a(3*2^k-1)+1. ; 1,2,1,2,3,1,2,1,2,3,4,1,2,1,2,3,1,2,1,2,3,4,5,1,2,1,2,3,1,2,1,2,3,4,1,2,1,2,3,1,2,1,2,3,4,5,6,1,2,1,2,3,1,2,1,2,3,4,1,2,1,2,3,1,2,1,2,3,4,5,1,2,1,2,3,1,2,1,2,3,4,1,2,1,2,3,1,2,1,2,3,4,5,6,7,1,2,1,2,3 lpb $0 mov $2,$0 add $2,1 seq $2,288932 ; Fixed point of the mapping 00->1000, 10->10101, starting with 00. sub $0,$2 add $3,$2 mov $1,$3 lpe add $1,1 mov $0,$1
test/succeed/Issue292-23.agda
asr/agda-kanso
1
2830
<filename>test/succeed/Issue292-23.agda -- Andreas, 2011-09-21, reported by Nisse -- {-# OPTIONS -v tc.lhs.unify:25 #-} module Issue292-23 where data ⊤ : Set where tt : ⊤ data D : (A : Set) → A → Set₁ where d : (A : Set) (x : A) → D A x data P : (x : ⊤) → D ⊤ x → Set₁ where p : (x : ⊤) → P x (d ⊤ x) Foo : P tt (d ⊤ tt) → Set₁ Foo (p .tt) = Set -- should work -- bug was caused by a use of ureduce instead of reduce
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt41.adb
best08618/asylo
7
29069
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt41.adb -- { dg-do run } -- { dg-options "-Os" } with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Opt41_Pkg; use Opt41_Pkg; procedure Opt41 is R : Rec := (Five, To_Unbounded_String ("CONFIG")); SP : String_Access := new String'(To_String (Rec_Write (R))); RP : Rec_Ptr := new Rec'(Rec_Read (SP)); begin if RP.D /= R.D then raise Program_Error; end if; end;
Muzyka/sounds.asm
arhneu/gruniozerca
23
638
;this file for FamiTone2 libary generated by nsf2data tool sounds: .dw @sfx_ntsc_0,@sfx_ntsc_0 .dw @sfx_ntsc_1,@sfx_ntsc_1 .dw @sfx_ntsc_2,@sfx_ntsc_2 .dw @sfx_ntsc_3,@sfx_ntsc_3 @sfx_ntsc_0: .db $89,$3d,$8a,$07,$01,$89,$3c,$8a,$03,$01,$8a,$00,$01,$89,$3a,$8a .db $0b,$01,$89,$38,$8a,$07,$01,$89,$37,$8a,$03,$01,$89,$3d,$8a,$09 .db $01,$89,$3c,$8a,$05,$01,$8a,$02,$01,$89,$3a,$8a,$0d,$01,$89,$38 .db $8a,$09,$01,$89,$37,$8a,$05,$01,$89,$36,$8a,$02,$01,$89,$35,$8a .db $0d,$01,$89,$34,$8a,$09,$01,$89,$33,$8a,$05,$01,$8a,$02,$01,$89 .db $32,$8a,$0d,$01,$89,$30,$00 @sfx_ntsc_1: .db $80,$79,$81,$ab,$82,$01,$02,$80,$78,$02,$80,$77,$02,$80,$79,$81 .db $52,$02,$80,$78,$02,$80,$77,$02,$80,$79,$81,$ab,$02,$80,$78,$02 .db $80,$77,$02,$80,$79,$81,$52,$02,$80,$78,$02,$80,$77,$02,$80,$76 .db $02,$80,$75,$02,$80,$74,$02,$80,$73,$02,$80,$72,$02,$80,$71,$02 .db $80,$30,$00 @sfx_ntsc_2: .db $80,$79,$81,$ab,$82,$01,$02,$80,$78,$02,$80,$77,$02,$80,$79,$81 .db $7c,$02,$80,$78,$02,$80,$77,$02,$80,$79,$81,$52,$02,$80,$78,$02 .db $80,$77,$02,$80,$79,$81,$3f,$02,$80,$78,$02,$80,$77,$02,$80,$76 .db $02,$80,$75,$02,$80,$74,$02,$80,$73,$02,$80,$72,$02,$80,$71,$02 .db $80,$30,$00 @sfx_ntsc_3: .db $80,$79,$81,$c9,$82,$00,$02,$80,$78,$02,$80,$77,$02,$80,$76,$02 .db $80,$75,$02,$80,$74,$02,$80,$79,$02,$80,$78,$02,$80,$77,$02,$80 .db $79,$81,$bd,$02,$80,$78,$02,$80,$77,$02,$80,$79,$81,$c9,$02,$80 .db $78,$02,$80,$77,$02,$80,$76,$02,$80,$75,$02,$80,$74,$02,$80,$79 .db $02,$80,$78,$02,$80,$77,$02,$80,$79,$81,$bd,$02,$80,$78,$02,$80 .db $77,$02,$80,$79,$81,$c9,$02,$80,$78,$02,$80,$77,$02,$80,$76,$02 .db $80,$75,$02,$80,$74,$02,$80,$73,$02,$80,$72,$02,$80,$71,$00
programs/oeis/288/A288604.asm
karttu/loda
1
171524
; A288604: a(n) = (n^9 - n)/10. ; 0,51,1968,26214,195312,1007769,4035360,13421772,38742048,99999999,235794768,515978034,1060449936,2066104677,3844335936,6871947672,11858787648,19835929035,32268769776,51199999998,79428004656,120726921777,180115266144,264180754020,381469726560,542950367895,762559748496,1057845595338,1450714597584,1968299999997,2643962216064,3518437208880,4641148440192,6071699276643,7881563867184,10155995666838,12996173979504,16521610126281,20872836115872,26214399999996,32738193439392,40667138384943,50259261193680,61812183950946,75668064257808,92219016266901,111913047310272,135260546059464,162841359791040,195312499999995,233416517309040,277990588363566,329976359180208,390430591231329,460536658398432,541616944814484,635146195538400,742765873964487,866299581865488,1007769599999994,1169414609283408,1353708654626349,1563381415685376,1801439850948192,2071191283789056,2376268001379987,2720653439629488,3108710029642950,3545208783557616,4035360699999993,4584850071844896,5199869781422892,5887158670826784,6654041077507935,7508468627929680,8459064384657810 mov $1,1 add $1,$0 pow $1,9 sub $1,$0 div $1,30 mul $1,3
oeis/233/A233831.asm
neoneye/loda-programs
11
89601
; A233831: a(n) = -2*a(n-1) -2*a(n-2) + a(n-3). a(0) = -1, a(1) = 1, a(2) = 1. ; Submitted by <NAME> ; -1,1,1,-5,9,-7,-9,41,-71,51,81,-335,559,-367,-719,2731,-4391,2601,6311,-22215,34409,-18077,-54879,180321,-268961,122401,473441,-1460645,2096809,-798887,-4056489,11807561,-16301031,4930451,34548721,-95259375,126351759,-27636047,-292690799,767005451,-976265351,125829001,2467878151,-6163679655,7517432009,-239626557,-20719290559,49435266241,-57671577921,-4246667199,173271756481,-395721756485,440653332809,83408603833,-1443845629769,3161527384681,-3351954905991,-1062990587149,11991418370961 add $0,1 mov $2,-1 mov $3,1 lpb $0 sub $0,1 add $1,$3 sub $3,$1 add $1,$3 add $2,$3 add $1,$2 sub $2,$1 add $3,$2 lpe mov $0,$3
mgblib/src/print/PrintString.asm
jbshelton/CGB_APU_Tester
2
20071
IF !DEF(INC_PrintString) INC_PrintString = 1 INCLUDE "src/print/PrintCharacter.asm" ; Print a NUL terminated string ; ; @param de address of string to print ; @destroys all PrintString:: .loop: ld a, [de] or a ret z call PrintCharacter inc de jr .loop ; Macro to print a string literal. ; NUL terminator is appended automatically. ; ; @param \1 the string to print ; @destroys all print_string_literal: MACRO ld de, .string\@ call PrintString jr .end\@ .string\@: DB \1, $00 .end\@: ENDM ENDC
antlr-plugin/src/test/resources/org/nemesis/antlrformatting/grammarfile/golden/TestThree-0-golden.g4
timboudreau/ANTLR4-Plugins-for-NetBeans
1
6838
lexer grammar TestThree; Word : CHARS+; fragment CHARS : [a-zA-Z];
programs/oeis/082/A082296.asm
neoneye/loda
22
246141
; A082296: Solutions to 13^x+17^x == 19 mod 23. ; 12,20,34,42,56,64,78,86,100,108,122,130,144,152,166,174,188,196,210,218,232,240,254,262,276,284,298,306,320,328,342,350,364,372,386,394,408,416,430,438,452,460,474,482,496,504,518,526,540,548,562,570,584,592,606,614,628,636,650,658,672,680,694,702,716,724,738,746,760,768,782,790,804,812,826,834,848,856,870,878,892,900,914,922,936,944,958,966,980,988,1002,1010,1024,1032,1046,1054,1068,1076,1090,1098 mov $3,$0 mod $0,2 pow $1,$0 mul $1,3 add $1,9 mov $2,$3 mul $2,11 add $1,$2 mov $0,$1
agda-stdlib/src/Data/Nat/Binary/Properties.agda
DreamLinuxer/popl21-artifact
5
10698
<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Basic properties of ℕᵇ ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Nat.Binary.Properties where open import Algebra.Bundles open import Algebra.Morphism.Structures import Algebra.Morphism.MonoidMonomorphism as MonoidMonomorphism open import Algebra.Consequences.Propositional open import Data.Nat.Binary.Base open import Data.Nat as ℕ using (ℕ; z≤n; s≤s) import Data.Nat.Properties as ℕₚ open import Data.Nat.Solver open import Data.Product using (_,_; proj₁; proj₂; ∃) open import Data.Sum.Base using (_⊎_; inj₁; inj₂) open import Function using (_∘_; _$_; id) open import Function.Definitions using (Injective) open import Function.Definitions.Core2 using (Surjective) open import Level using (0ℓ) open import Relation.Binary open import Relation.Binary.Consequences open import Relation.Binary.Morphism import Relation.Binary.Morphism.OrderMonomorphism as OrderMonomorphism open import Relation.Binary.PropositionalEquality import Relation.Binary.Reasoning.Base.Triple as InequalityReasoning open import Relation.Nullary using (¬_; yes; no) import Relation.Nullary.Decidable as Dec open import Relation.Nullary.Negation using (contradiction) open import Algebra.Definitions {A = ℕᵇ} _≡_ open import Algebra.Structures {A = ℕᵇ} _≡_ import Algebra.Properties.CommutativeSemigroup ℕₚ.+-commutativeSemigroup as ℕ-+-semigroupProperties import Relation.Binary.Construct.StrictToNonStrict _≡_ _<_ as StrictToNonStrict open +-*-Solver ------------------------------------------------------------------------ -- Properties of _≡_ ------------------------------------------------------------------------ 2[1+x]≢0 : ∀ {x} → 2[1+ x ] ≢ 0ᵇ 2[1+x]≢0 () 1+[2x]≢0 : ∀ {x} → 1+[2 x ] ≢ 0ᵇ 1+[2x]≢0 () 2[1+_]-injective : Injective _≡_ _≡_ 2[1+_] 2[1+_]-injective refl = refl 1+[2_]-injective : Injective _≡_ _≡_ 1+[2_] 1+[2_]-injective refl = refl _≟_ : Decidable {A = ℕᵇ} _≡_ zero ≟ zero = yes refl zero ≟ 2[1+ _ ] = no λ() zero ≟ 1+[2 _ ] = no λ() 2[1+ _ ] ≟ zero = no λ() 2[1+ x ] ≟ 2[1+ y ] = Dec.map′ (cong 2[1+_]) 2[1+_]-injective (x ≟ y) 2[1+ _ ] ≟ 1+[2 _ ] = no λ() 1+[2 _ ] ≟ zero = no λ() 1+[2 _ ] ≟ 2[1+ _ ] = no λ() 1+[2 x ] ≟ 1+[2 y ] = Dec.map′ (cong 1+[2_]) 1+[2_]-injective (x ≟ y) ≡-isDecEquivalence : IsDecEquivalence {A = ℕᵇ} _≡_ ≡-isDecEquivalence = isDecEquivalence _≟_ ≡-setoid : Setoid 0ℓ 0ℓ ≡-setoid = setoid ℕᵇ ≡-decSetoid : DecSetoid 0ℓ 0ℓ ≡-decSetoid = decSetoid _≟_ ------------------------------------------------------------------------ -- Properties of toℕ & fromℕ ------------------------------------------------------------------------ toℕ-double : ∀ x → toℕ (double x) ≡ 2 ℕ.* (toℕ x) toℕ-double zero = refl toℕ-double 1+[2 x ] = cong ((2 ℕ.*_) ∘ ℕ.suc) (toℕ-double x) toℕ-double 2[1+ x ] = cong (2 ℕ.*_) (sym (ℕₚ.*-distribˡ-+ 2 1 (toℕ x))) toℕ-suc : ∀ x → toℕ (suc x) ≡ ℕ.suc (toℕ x) toℕ-suc zero = refl toℕ-suc 2[1+ x ] = cong (ℕ.suc ∘ (2 ℕ.*_)) (toℕ-suc x) toℕ-suc 1+[2 x ] = ℕₚ.*-distribˡ-+ 2 1 (toℕ x) toℕ-pred : ∀ x → toℕ (pred x) ≡ ℕ.pred (toℕ x) toℕ-pred zero = refl toℕ-pred 2[1+ x ] = cong ℕ.pred $ sym $ ℕₚ.*-distribˡ-+ 2 1 (toℕ x) toℕ-pred 1+[2 x ] = toℕ-double x toℕ-fromℕ : toℕ ∘ fromℕ ≗ id toℕ-fromℕ 0 = refl toℕ-fromℕ (ℕ.suc n) = begin toℕ (fromℕ (ℕ.suc n)) ≡⟨⟩ toℕ (suc (fromℕ n)) ≡⟨ toℕ-suc (fromℕ n) ⟩ ℕ.suc (toℕ (fromℕ n)) ≡⟨ cong ℕ.suc (toℕ-fromℕ n) ⟩ ℕ.suc n ∎ where open ≡-Reasoning toℕ-injective : Injective _≡_ _≡_ toℕ toℕ-injective {zero} {zero} _ = refl toℕ-injective {2[1+ x ]} {2[1+ y ]} 2[1+xN]≡2[1+yN] = cong 2[1+_] x≡y where 1+xN≡1+yN = ℕₚ.*-cancelˡ-≡ {ℕ.suc _} {ℕ.suc _} 1 2[1+xN]≡2[1+yN] xN≡yN = cong ℕ.pred 1+xN≡1+yN x≡y = toℕ-injective xN≡yN toℕ-injective {2[1+ x ]} {1+[2 y ]} 2[1+xN]≡1+2yN = contradiction 2[1+xN]≡1+2yN (ℕₚ.even≢odd (ℕ.suc (toℕ x)) (toℕ y)) toℕ-injective {1+[2 x ]} {2[1+ y ]} 1+2xN≡2[1+yN] = contradiction (sym 1+2xN≡2[1+yN]) (ℕₚ.even≢odd (ℕ.suc (toℕ y)) (toℕ x)) toℕ-injective {1+[2 x ]} {1+[2 y ]} 1+2xN≡1+2yN = cong 1+[2_] x≡y where 2xN≡2yN = cong ℕ.pred 1+2xN≡1+2yN xN≡yN = ℕₚ.*-cancelˡ-≡ 1 2xN≡2yN x≡y = toℕ-injective xN≡yN toℕ-surjective : Surjective _≡_ toℕ toℕ-surjective n = (fromℕ n , toℕ-fromℕ n) toℕ-isRelHomomorphism : IsRelHomomorphism _≡_ _≡_ toℕ toℕ-isRelHomomorphism = record { cong = cong toℕ } fromℕ-injective : Injective _≡_ _≡_ fromℕ fromℕ-injective {x} {y} f[x]≡f[y] = begin x ≡⟨ sym (toℕ-fromℕ x) ⟩ toℕ (fromℕ x) ≡⟨ cong toℕ f[x]≡f[y] ⟩ toℕ (fromℕ y) ≡⟨ toℕ-fromℕ y ⟩ y ∎ where open ≡-Reasoning fromℕ-toℕ : fromℕ ∘ toℕ ≗ id fromℕ-toℕ = toℕ-injective ∘ toℕ-fromℕ ∘ toℕ fromℕ-pred : ∀ n → fromℕ (ℕ.pred n) ≡ pred (fromℕ n) fromℕ-pred n = begin fromℕ (ℕ.pred n) ≡⟨ cong (fromℕ ∘ ℕ.pred) (sym (toℕ-fromℕ n)) ⟩ fromℕ (ℕ.pred (toℕ x)) ≡⟨ cong fromℕ (sym (toℕ-pred x)) ⟩ fromℕ (toℕ (pred x)) ≡⟨ fromℕ-toℕ (pred x) ⟩ pred x ≡⟨ refl ⟩ pred (fromℕ n) ∎ where open ≡-Reasoning; x = fromℕ n x≡0⇒toℕ[x]≡0 : ∀ {x} → x ≡ zero → toℕ x ≡ 0 x≡0⇒toℕ[x]≡0 {zero} _ = refl toℕ[x]≡0⇒x≡0 : ∀ {x} → toℕ x ≡ 0 → x ≡ zero toℕ[x]≡0⇒x≡0 {zero} _ = refl ------------------------------------------------------------------------ -- Properties of _<_ ------------------------------------------------------------------------ -- Basic properties x≮0 : ∀ {x} → x ≮ zero x≮0 () x≢0⇒x>0 : ∀ {x} → x ≢ zero → x > zero x≢0⇒x>0 {zero} 0≢0 = contradiction refl 0≢0 x≢0⇒x>0 {2[1+ _ ]} _ = 0<even x≢0⇒x>0 {1+[2 _ ]} _ = 0<odd 1+[2x]<2[1+x] : ∀ x → 1+[2 x ] < 2[1+ x ] 1+[2x]<2[1+x] x = odd<even (inj₂ refl) <⇒≢ : _<_ ⇒ _≢_ <⇒≢ (even<even x<x) refl = <⇒≢ x<x refl <⇒≢ (odd<odd x<x) refl = <⇒≢ x<x refl >⇒≢ : _>_ ⇒ _≢_ >⇒≢ y<x = ≢-sym (<⇒≢ y<x) ≡⇒≮ : _≡_ ⇒ _≮_ ≡⇒≮ x≡y x<y = <⇒≢ x<y x≡y ≡⇒≯ : _≡_ ⇒ _≯_ ≡⇒≯ x≡y x>y = >⇒≢ x>y x≡y <⇒≯ : _<_ ⇒ _≯_ <⇒≯ (even<even x<y) (even<even y<x) = <⇒≯ x<y y<x <⇒≯ (even<odd x<y) (odd<even (inj₁ y<x)) = <⇒≯ x<y y<x <⇒≯ (even<odd x<y) (odd<even (inj₂ refl)) = <⇒≢ x<y refl <⇒≯ (odd<even (inj₁ x<y)) (even<odd y<x) = <⇒≯ x<y y<x <⇒≯ (odd<even (inj₂ refl)) (even<odd y<x) = <⇒≢ y<x refl <⇒≯ (odd<odd x<y) (odd<odd y<x) = <⇒≯ x<y y<x >⇒≮ : _>_ ⇒ _≮_ >⇒≮ y<x = <⇒≯ y<x <⇒≤ : _<_ ⇒ _≤_ <⇒≤ = inj₁ ------------------------------------------------------------------------------ -- Properties of _<_ and toℕ & fromℕ. toℕ-mono-< : toℕ Preserves _<_ ⟶ ℕ._<_ toℕ-mono-< {zero} {2[1+ _ ]} _ = ℕₚ.0<1+n toℕ-mono-< {zero} {1+[2 _ ]} _ = ℕₚ.0<1+n toℕ-mono-< {2[1+ x ]} {2[1+ y ]} (even<even x<y) = begin ℕ.suc (2 ℕ.* (ℕ.suc xN)) ≤⟨ ℕₚ.+-monoʳ-≤ 1 (ℕₚ.*-monoʳ-≤ 2 xN<yN) ⟩ ℕ.suc (2 ℕ.* yN) ≤⟨ ℕₚ.≤-step ℕₚ.≤-refl ⟩ 2 ℕ.+ (2 ℕ.* yN) ≡⟨ sym (ℕₚ.*-distribˡ-+ 2 1 yN) ⟩ 2 ℕ.* (ℕ.suc yN) ∎ where open ℕₚ.≤-Reasoning; xN = toℕ x; yN = toℕ y; xN<yN = toℕ-mono-< x<y toℕ-mono-< {2[1+ x ]} {1+[2 y ]} (even<odd x<y) = ℕₚ.+-monoʳ-≤ 1 (ℕₚ.*-monoʳ-≤ 2 (toℕ-mono-< x<y)) toℕ-mono-< {1+[2 x ]} {2[1+ y ]} (odd<even (inj₁ x<y)) = begin ℕ.suc (ℕ.suc (2 ℕ.* xN)) ≡⟨⟩ 2 ℕ.+ (2 ℕ.* xN) ≡⟨ sym (ℕₚ.*-distribˡ-+ 2 1 xN) ⟩ 2 ℕ.* (ℕ.suc xN) ≤⟨ ℕₚ.*-monoʳ-≤ 2 xN<yN ⟩ 2 ℕ.* yN ≤⟨ ℕₚ.*-monoʳ-≤ 2 (ℕₚ.≤-step ℕₚ.≤-refl) ⟩ 2 ℕ.* (ℕ.suc yN) ∎ where open ℕₚ.≤-Reasoning; xN = toℕ x; yN = toℕ y; xN<yN = toℕ-mono-< x<y toℕ-mono-< {1+[2 x ]} {2[1+ .x ]} (odd<even (inj₂ refl)) = ℕₚ.≤-reflexive (sym (ℕₚ.*-distribˡ-+ 2 1 (toℕ x))) toℕ-mono-< {1+[2 x ]} {1+[2 y ]} (odd<odd x<y) = ℕₚ.+-monoʳ-< 1 (ℕₚ.*-monoʳ-< 1 xN<yN) where xN = toℕ x; yN = toℕ y; xN<yN = toℕ-mono-< x<y toℕ-cancel-< : ∀ {x y} → toℕ x ℕ.< toℕ y → x < y toℕ-cancel-< {zero} {2[1+ y ]} x<y = 0<even toℕ-cancel-< {zero} {1+[2 y ]} x<y = 0<odd toℕ-cancel-< {2[1+ x ]} {2[1+ y ]} x<y = even<even (toℕ-cancel-< (ℕ.≤-pred (ℕₚ.*-cancelˡ-< 2 x<y))) toℕ-cancel-< {2[1+ x ]} {1+[2 y ]} x<y rewrite ℕₚ.*-distribˡ-+ 2 1 (toℕ x) = even<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 (ℕₚ.≤-trans (s≤s (ℕₚ.n≤1+n _)) (ℕₚ.≤-pred x<y)))) toℕ-cancel-< {1+[2 x ]} {2[1+ y ]} x<y with toℕ x ℕₚ.≟ toℕ y ... | yes x≡y = odd<even (inj₂ (toℕ-injective x≡y)) ... | no x≢y rewrite ℕₚ.+-suc (toℕ y) (toℕ y ℕ.+ 0) = odd<even (inj₁ (toℕ-cancel-< (ℕₚ.≤∧≢⇒< (ℕₚ.*-cancelˡ-≤ 1 (ℕₚ.+-cancelˡ-≤ 2 x<y)) x≢y))) toℕ-cancel-< {1+[2 x ]} {1+[2 y ]} x<y = odd<odd (toℕ-cancel-< (ℕₚ.*-cancelˡ-< 2 (ℕ.≤-pred x<y))) fromℕ-cancel-< : ∀ {x y} → fromℕ x < fromℕ y → x ℕ.< y fromℕ-cancel-< = subst₂ ℕ._<_ (toℕ-fromℕ _) (toℕ-fromℕ _) ∘ toℕ-mono-< fromℕ-mono-< : fromℕ Preserves ℕ._<_ ⟶ _<_ fromℕ-mono-< = toℕ-cancel-< ∘ subst₂ ℕ._<_ (sym (toℕ-fromℕ _)) (sym (toℕ-fromℕ _)) toℕ-isHomomorphism-< : IsOrderHomomorphism _≡_ _≡_ _<_ ℕ._<_ toℕ toℕ-isHomomorphism-< = record { cong = cong toℕ ; mono = toℕ-mono-< } toℕ-isMonomorphism-< : IsOrderMonomorphism _≡_ _≡_ _<_ ℕ._<_ toℕ toℕ-isMonomorphism-< = record { isOrderHomomorphism = toℕ-isHomomorphism-< ; injective = toℕ-injective ; cancel = toℕ-cancel-< } ------------------------------------------------------------------------------ -- Relational properties of _<_ <-irrefl : Irreflexive _≡_ _<_ <-irrefl refl (even<even x<x) = <-irrefl refl x<x <-irrefl refl (odd<odd x<x) = <-irrefl refl x<x <-trans : Transitive _<_ <-trans {zero} {_} {2[1+ _ ]} _ _ = 0<even <-trans {zero} {_} {1+[2 _ ]} _ _ = 0<odd <-trans (even<even x<y) (even<even y<z) = even<even (<-trans x<y y<z) <-trans (even<even x<y) (even<odd y<z) = even<odd (<-trans x<y y<z) <-trans (even<odd x<y) (odd<even (inj₁ y<z)) = even<even (<-trans x<y y<z) <-trans (even<odd x<y) (odd<even (inj₂ refl)) = even<even x<y <-trans (even<odd x<y) (odd<odd y<z) = even<odd (<-trans x<y y<z) <-trans (odd<even (inj₁ x<y)) (even<even y<z) = odd<even (inj₁ (<-trans x<y y<z)) <-trans (odd<even (inj₂ refl)) (even<even x<z) = odd<even (inj₁ x<z) <-trans (odd<even (inj₁ x<y)) (even<odd y<z) = odd<odd (<-trans x<y y<z) <-trans (odd<even (inj₂ refl)) (even<odd x<z) = odd<odd x<z <-trans (odd<odd x<y) (odd<even (inj₁ y<z)) = odd<even (inj₁ (<-trans x<y y<z)) <-trans (odd<odd x<y) (odd<even (inj₂ refl)) = odd<even (inj₁ x<y) <-trans (odd<odd x<y) (odd<odd y<z) = odd<odd (<-trans x<y y<z) -- Should not be implemented via the morphism `toℕ` in order to -- preserve O(log n) time requirement. <-cmp : Trichotomous _≡_ _<_ <-cmp zero zero = tri≈ x≮0 refl x≮0 <-cmp zero 2[1+ _ ] = tri< 0<even (λ()) x≮0 <-cmp zero 1+[2 _ ] = tri< 0<odd (λ()) x≮0 <-cmp 2[1+ _ ] zero = tri> (λ()) (λ()) 0<even <-cmp 2[1+ x ] 2[1+ y ] with <-cmp x y ... | tri< x<y _ _ = tri< lt (<⇒≢ lt) (<⇒≯ lt) where lt = even<even x<y ... | tri≈ _ refl _ = tri≈ (<-irrefl refl) refl (<-irrefl refl) ... | tri> _ _ x>y = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = even<even x>y <-cmp 2[1+ x ] 1+[2 y ] with <-cmp x y ... | tri< x<y _ _ = tri< lt (<⇒≢ lt) (<⇒≯ lt) where lt = even<odd x<y ... | tri≈ _ refl _ = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = subst (_< 2[1+ x ]) refl (1+[2x]<2[1+x] x) ... | tri> _ _ y<x = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = odd<even (inj₁ y<x) <-cmp 1+[2 _ ] zero = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = 0<odd <-cmp 1+[2 x ] 2[1+ y ] with <-cmp x y ... | tri< x<y _ _ = tri< lt (<⇒≢ lt) (<⇒≯ lt) where lt = odd<even (inj₁ x<y) ... | tri≈ _ x≡y _ = tri< lt (<⇒≢ lt) (<⇒≯ lt) where lt = odd<even (inj₂ x≡y) ... | tri> _ _ x>y = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = even<odd x>y <-cmp 1+[2 x ] 1+[2 y ] with <-cmp x y ... | tri< x<y _ _ = tri< lt (<⇒≢ lt) (<⇒≯ lt) where lt = odd<odd x<y ... | tri≈ _ refl _ = tri≈ (≡⇒≮ refl) refl (≡⇒≯ refl) ... | tri> _ _ x>y = tri> (>⇒≮ gt) (>⇒≢ gt) gt where gt = odd<odd x>y _<?_ : Decidable _<_ _<?_ = tri⟶dec< <-cmp ------------------------------------------------------------------------------ -- Structures for _<_ <-isStrictPartialOrder : IsStrictPartialOrder _≡_ _<_ <-isStrictPartialOrder = record { isEquivalence = isEquivalence ; irrefl = <-irrefl ; trans = <-trans ; <-resp-≈ = resp₂ _<_ } <-isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_ <-isStrictTotalOrder = record { isEquivalence = isEquivalence ; trans = <-trans ; compare = <-cmp } ------------------------------------------------------------------------------ -- Bundles for _<_ <-strictPartialOrder : StrictPartialOrder _ _ _ <-strictPartialOrder = record { isStrictPartialOrder = <-isStrictPartialOrder } <-strictTotalOrder : StrictTotalOrder _ _ _ <-strictTotalOrder = record { isStrictTotalOrder = <-isStrictTotalOrder } ------------------------------------------------------------------------------ -- Other properties of _<_ x<2[1+x] : ∀ x → x < 2[1+ x ] x<1+[2x] : ∀ x → x < 1+[2 x ] x<2[1+x] zero = 0<even x<2[1+x] 2[1+ x ] = even<even (x<2[1+x] x) x<2[1+x] 1+[2 x ] = odd<even (inj₁ (x<1+[2x] x)) x<1+[2x] zero = 0<odd x<1+[2x] 2[1+ x ] = even<odd (x<2[1+x] x) x<1+[2x] 1+[2 x ] = odd<odd (x<1+[2x] x) ------------------------------------------------------------------------------ -- Properties of _≤_ ------------------------------------------------------------------------------ -- Basic properties <⇒≱ : _<_ ⇒ _≱_ <⇒≱ x<y (inj₁ y<x) = contradiction y<x (<⇒≯ x<y) <⇒≱ x<y (inj₂ y≡x) = contradiction (sym y≡x) (<⇒≢ x<y) ≤⇒≯ : _≤_ ⇒ _≯_ ≤⇒≯ x≤y x>y = <⇒≱ x>y x≤y ≮⇒≥ : _≮_ ⇒ _≥_ ≮⇒≥ {x} {y} x≮y with <-cmp x y ... | tri< lt _ _ = contradiction lt x≮y ... | tri≈ _ eq _ = inj₂ (sym eq) ... | tri> _ _ y<x = <⇒≤ y<x ≰⇒> : _≰_ ⇒ _>_ ≰⇒> {x} {y} x≰y with <-cmp x y ... | tri< lt _ _ = contradiction (<⇒≤ lt) x≰y ... | tri≈ _ eq _ = contradiction (inj₂ eq) x≰y ... | tri> _ _ x>y = x>y ≤∧≢⇒< : ∀ {x y} → x ≤ y → x ≢ y → x < y ≤∧≢⇒< (inj₁ x<y) _ = x<y ≤∧≢⇒< (inj₂ x≡y) x≢y = contradiction x≡y x≢y 0≤x : ∀ x → zero ≤ x 0≤x zero = inj₂ refl 0≤x 2[1+ _ ] = inj₁ 0<even 0≤x 1+[2 x ] = inj₁ 0<odd x≤0⇒x≡0 : ∀ {x} → x ≤ zero → x ≡ zero x≤0⇒x≡0 (inj₂ x≡0) = x≡0 ------------------------------------------------------------------------------ -- Properties of _<_ and toℕ & fromℕ. fromℕ-mono-≤ : fromℕ Preserves ℕ._≤_ ⟶ _≤_ fromℕ-mono-≤ m≤n with ℕₚ.m≤n⇒m<n∨m≡n m≤n ... | inj₁ m<n = inj₁ (fromℕ-mono-< m<n) ... | inj₂ m≡n = inj₂ (cong fromℕ m≡n) toℕ-mono-≤ : toℕ Preserves _≤_ ⟶ ℕ._≤_ toℕ-mono-≤ (inj₁ x<y) = ℕₚ.<⇒≤ (toℕ-mono-< x<y) toℕ-mono-≤ (inj₂ refl) = ℕₚ.≤-reflexive refl toℕ-cancel-≤ : ∀ {x y} → toℕ x ℕ.≤ toℕ y → x ≤ y toℕ-cancel-≤ = subst₂ _≤_ (fromℕ-toℕ _) (fromℕ-toℕ _) ∘ fromℕ-mono-≤ fromℕ-cancel-≤ : ∀ {x y} → fromℕ x ≤ fromℕ y → x ℕ.≤ y fromℕ-cancel-≤ = subst₂ ℕ._≤_ (toℕ-fromℕ _) (toℕ-fromℕ _) ∘ toℕ-mono-≤ toℕ-isHomomorphism-≤ : IsOrderHomomorphism _≡_ _≡_ _≤_ ℕ._≤_ toℕ toℕ-isHomomorphism-≤ = record { cong = cong toℕ ; mono = toℕ-mono-≤ } toℕ-isMonomorphism-≤ : IsOrderMonomorphism _≡_ _≡_ _≤_ ℕ._≤_ toℕ toℕ-isMonomorphism-≤ = record { isOrderHomomorphism = toℕ-isHomomorphism-≤ ; injective = toℕ-injective ; cancel = toℕ-cancel-≤ } ------------------------------------------------------------------------------ -- Relational properties of _≤_ ≤-refl : Reflexive _≤_ ≤-refl = inj₂ refl ≤-reflexive : _≡_ ⇒ _≤_ ≤-reflexive {x} {_} refl = ≤-refl {x} ≤-trans : Transitive _≤_ ≤-trans = StrictToNonStrict.trans isEquivalence (resp₂ _<_) <-trans <-≤-trans : ∀ {x y z} → x < y → y ≤ z → x < z <-≤-trans x<y (inj₁ y<z) = <-trans x<y y<z <-≤-trans x<y (inj₂ refl) = x<y ≤-<-trans : ∀ {x y z} → x ≤ y → y < z → x < z ≤-<-trans (inj₁ x<y) y<z = <-trans x<y y<z ≤-<-trans (inj₂ refl) y<z = y<z ≤-antisym : Antisymmetric _≡_ _≤_ ≤-antisym = StrictToNonStrict.antisym isEquivalence <-trans <-irrefl ≤-total : Total _≤_ ≤-total x y with <-cmp x y ... | tri< x<y _ _ = inj₁ (<⇒≤ x<y) ... | tri≈ _ x≡y _ = inj₁ (≤-reflexive x≡y) ... | tri> _ _ y<x = inj₂ (<⇒≤ y<x) -- Should not be implemented via the morphism `toℕ` in order to -- preserve O(log n) time requirement. _≤?_ : Decidable _≤_ x ≤? y with <-cmp x y ... | tri< x<y _ _ = yes (<⇒≤ x<y) ... | tri≈ _ x≡y _ = yes (≤-reflexive x≡y) ... | tri> _ _ y<x = no (<⇒≱ y<x) ------------------------------------------------------------------------------ -- Structures ≤-isPreorder : IsPreorder _≡_ _≤_ ≤-isPreorder = record { isEquivalence = isEquivalence ; reflexive = ≤-reflexive ; trans = ≤-trans } ≤-isPartialOrder : IsPartialOrder _≡_ _≤_ ≤-isPartialOrder = record { isPreorder = ≤-isPreorder ; antisym = ≤-antisym } ≤-isTotalOrder : IsTotalOrder _≡_ _≤_ ≤-isTotalOrder = record { isPartialOrder = ≤-isPartialOrder ; total = ≤-total } ≤-isDecTotalOrder : IsDecTotalOrder _≡_ _≤_ ≤-isDecTotalOrder = record { isTotalOrder = ≤-isTotalOrder ; _≟_ = _≟_ ; _≤?_ = _≤?_ } ------------------------------------------------------------------------------ -- Bundles ≤-preorder : Preorder 0ℓ 0ℓ 0ℓ ≤-preorder = record { isPreorder = ≤-isPreorder } ≤-partialOrder : Poset 0ℓ 0ℓ 0ℓ ≤-partialOrder = record { isPartialOrder = ≤-isPartialOrder } ≤-totalOrder : TotalOrder 0ℓ 0ℓ 0ℓ ≤-totalOrder = record { isTotalOrder = ≤-isTotalOrder } ≤-decTotalOrder : DecTotalOrder 0ℓ 0ℓ 0ℓ ≤-decTotalOrder = record { isDecTotalOrder = ≤-isDecTotalOrder } ------------------------------------------------------------------------------ -- Equational reasoning for _≤_ and _<_ module ≤-Reasoning = InequalityReasoning ≤-isPreorder <-trans (resp₂ _<_) <⇒≤ <-≤-trans ≤-<-trans hiding (step-≈; step-≈˘) ------------------------------------------------------------------------------ -- Properties of _<ℕ_ ------------------------------------------------------------------------------ <⇒<ℕ : ∀ {x y} → x < y → x <ℕ y <⇒<ℕ x<y = toℕ-mono-< x<y <ℕ⇒< : ∀ {x y} → x <ℕ y → x < y <ℕ⇒< {x} {y} t[x]<t[y] = begin-strict x ≡⟨ sym (fromℕ-toℕ x) ⟩ fromℕ (toℕ x) <⟨ fromℕ-mono-< t[x]<t[y] ⟩ fromℕ (toℕ y) ≡⟨ fromℕ-toℕ y ⟩ y ∎ where open ≤-Reasoning ------------------------------------------------------------------------ -- Properties of _+_ ------------------------------------------------------------------------ ------------------------------------------------------------------------ -- Raw bundles for _+_ +-rawMagma : RawMagma 0ℓ 0ℓ +-rawMagma = record { _≈_ = _≡_ ; _∙_ = _+_ } +-0-rawMonoid : RawMonoid 0ℓ 0ℓ +-0-rawMonoid = record { _≈_ = _≡_ ; _∙_ = _+_ ; ε = 0ᵇ } ------------------------------------------------------------------------ -- toℕ/fromℕ are homomorphisms for _+_ toℕ-homo-+ : ∀ x y → toℕ (x + y) ≡ toℕ x ℕ.+ toℕ y toℕ-homo-+ zero _ = refl toℕ-homo-+ 2[1+ x ] zero = cong ℕ.suc (sym (ℕₚ.+-identityʳ _)) toℕ-homo-+ 1+[2 x ] zero = cong ℕ.suc (sym (ℕₚ.+-identityʳ _)) toℕ-homo-+ 2[1+ x ] 2[1+ y ] = begin toℕ (2[1+ x ] + 2[1+ y ]) ≡⟨⟩ toℕ 2[1+ (suc (x + y)) ] ≡⟨⟩ 2 ℕ.* (1 ℕ.+ (toℕ (suc (x + y)))) ≡⟨ cong ((2 ℕ.*_) ∘ ℕ.suc) (toℕ-suc (x + y)) ⟩ 2 ℕ.* (2 ℕ.+ toℕ (x + y)) ≡⟨ cong ((2 ℕ.*_) ∘ (2 ℕ.+_)) (toℕ-homo-+ x y) ⟩ 2 ℕ.* (2 ℕ.+ (toℕ x ℕ.+ toℕ y)) ≡⟨ solve 2 (λ m n → con 2 :* (con 2 :+ (m :+ n)) := con 2 :* (con 1 :+ m) :+ con 2 :* (con 1 :+ n)) refl (toℕ x) (toℕ y) ⟩ toℕ 2[1+ x ] ℕ.+ toℕ 2[1+ y ] ∎ where open ≡-Reasoning toℕ-homo-+ 2[1+ x ] 1+[2 y ] = begin toℕ (2[1+ x ] + 1+[2 y ]) ≡⟨⟩ toℕ (suc 2[1+ (x + y) ]) ≡⟨ toℕ-suc 2[1+ (x + y) ] ⟩ ℕ.suc (toℕ 2[1+ (x + y) ]) ≡⟨⟩ ℕ.suc (2 ℕ.* (ℕ.suc (toℕ (x + y)))) ≡⟨ cong (λ v → ℕ.suc (2 ℕ.* ℕ.suc v)) (toℕ-homo-+ x y) ⟩ ℕ.suc (2 ℕ.* (ℕ.suc (m ℕ.+ n))) ≡⟨ solve 2 (λ m n → con 1 :+ (con 2 :* (con 1 :+ (m :+ n))) := con 2 :* (con 1 :+ m) :+ (con 1 :+ (con 2 :* n))) refl m n ⟩ (2 ℕ.* ℕ.suc m) ℕ.+ (ℕ.suc (2 ℕ.* n)) ≡⟨⟩ toℕ 2[1+ x ] ℕ.+ toℕ 1+[2 y ] ∎ where open ≡-Reasoning; m = toℕ x; n = toℕ y toℕ-homo-+ 1+[2 x ] 2[1+ y ] = begin toℕ (1+[2 x ] + 2[1+ y ]) ≡⟨⟩ toℕ (suc 2[1+ (x + y) ]) ≡⟨ toℕ-suc 2[1+ (x + y) ] ⟩ ℕ.suc (toℕ 2[1+ (x + y) ]) ≡⟨⟩ ℕ.suc (2 ℕ.* (ℕ.suc (toℕ (x + y)))) ≡⟨ cong (ℕ.suc ∘ (2 ℕ.*_) ∘ ℕ.suc) (toℕ-homo-+ x y) ⟩ ℕ.suc (2 ℕ.* (ℕ.suc (m ℕ.+ n))) ≡⟨ solve 2 (λ m n → con 1 :+ (con 2 :* (con 1 :+ (m :+ n))) := (con 1 :+ (con 2 :* m)) :+ (con 2 :* (con 1 :+ n))) refl m n ⟩ (ℕ.suc (2 ℕ.* m)) ℕ.+ (2 ℕ.* (ℕ.suc n)) ≡⟨⟩ toℕ 1+[2 x ] ℕ.+ toℕ 2[1+ y ] ∎ where open ≡-Reasoning; m = toℕ x; n = toℕ y toℕ-homo-+ 1+[2 x ] 1+[2 y ] = begin toℕ (1+[2 x ] + 1+[2 y ]) ≡⟨⟩ toℕ (suc 1+[2 (x + y) ]) ≡⟨ toℕ-suc 1+[2 (x + y) ] ⟩ ℕ.suc (toℕ 1+[2 (x + y) ]) ≡⟨⟩ ℕ.suc (ℕ.suc (2 ℕ.* (toℕ (x + y)))) ≡⟨ cong (ℕ.suc ∘ ℕ.suc ∘ (2 ℕ.*_)) (toℕ-homo-+ x y) ⟩ ℕ.suc (ℕ.suc (2 ℕ.* (m ℕ.+ n))) ≡⟨ solve 2 (λ m n → con 1 :+ (con 1 :+ (con 2 :* (m :+ n))) := (con 1 :+ (con 2 :* m)) :+ (con 1 :+ (con 2 :* n))) refl m n ⟩ (ℕ.suc (2 ℕ.* m)) ℕ.+ (ℕ.suc (2 ℕ.* n)) ≡⟨⟩ toℕ 1+[2 x ] ℕ.+ toℕ 1+[2 y ] ∎ where open ≡-Reasoning; m = toℕ x; n = toℕ y toℕ-isMagmaHomomorphism-+ : IsMagmaHomomorphism +-rawMagma ℕₚ.+-rawMagma toℕ toℕ-isMagmaHomomorphism-+ = record { isRelHomomorphism = toℕ-isRelHomomorphism ; homo = toℕ-homo-+ } toℕ-isMonoidHomomorphism-+ : IsMonoidHomomorphism +-0-rawMonoid ℕₚ.+-0-rawMonoid toℕ toℕ-isMonoidHomomorphism-+ = record { isMagmaHomomorphism = toℕ-isMagmaHomomorphism-+ ; ε-homo = refl } toℕ-isMonoidMonomorphism-+ : IsMonoidMonomorphism +-0-rawMonoid ℕₚ.+-0-rawMonoid toℕ toℕ-isMonoidMonomorphism-+ = record { isMonoidHomomorphism = toℕ-isMonoidHomomorphism-+ ; injective = toℕ-injective } suc≗1+ : suc ≗ 1ᵇ +_ suc≗1+ zero = refl suc≗1+ 2[1+ _ ] = refl suc≗1+ 1+[2 _ ] = refl suc-+ : ∀ x y → suc x + y ≡ suc (x + y) suc-+ zero y = sym (suc≗1+ y) suc-+ 2[1+ x ] zero = refl suc-+ 1+[2 x ] zero = refl suc-+ 2[1+ x ] 2[1+ y ] = cong (suc ∘ 2[1+_]) (suc-+ x y) suc-+ 2[1+ x ] 1+[2 y ] = cong (suc ∘ 1+[2_]) (suc-+ x y) suc-+ 1+[2 x ] 2[1+ y ] = refl suc-+ 1+[2 x ] 1+[2 y ] = refl 1+≗suc : (1ᵇ +_) ≗ suc 1+≗suc = suc-+ zero fromℕ-homo-+ : ∀ m n → fromℕ (m ℕ.+ n) ≡ fromℕ m + fromℕ n fromℕ-homo-+ 0 _ = refl fromℕ-homo-+ (ℕ.suc m) n = begin fromℕ ((ℕ.suc m) ℕ.+ n) ≡⟨⟩ suc (fromℕ (m ℕ.+ n)) ≡⟨ cong suc (fromℕ-homo-+ m n) ⟩ suc (a + b) ≡⟨ sym (suc-+ a b) ⟩ (suc a) + b ≡⟨⟩ (fromℕ (ℕ.suc m)) + (fromℕ n) ∎ where open ≡-Reasoning; a = fromℕ m; b = fromℕ n ------------------------------------------------------------------------ -- Algebraic properties of _+_ -- Mostly proved by using the isomorphism between `ℕ` and `ℕᵇ` provided -- by `toℕ`/`fromℕ`. private module +-Monomorphism = MonoidMonomorphism toℕ-isMonoidMonomorphism-+ +-assoc : Associative _+_ +-assoc = +-Monomorphism.assoc ℕₚ.+-isMagma ℕₚ.+-assoc +-comm : Commutative _+_ +-comm = +-Monomorphism.comm ℕₚ.+-isMagma ℕₚ.+-comm +-identityˡ : LeftIdentity zero _+_ +-identityˡ _ = refl +-identityʳ : RightIdentity zero _+_ +-identityʳ = +-Monomorphism.identityʳ ℕₚ.+-isMagma ℕₚ.+-identityʳ +-identity : Identity zero _+_ +-identity = +-identityˡ , +-identityʳ +-cancelˡ-≡ : LeftCancellative _+_ +-cancelˡ-≡ = +-Monomorphism.cancelˡ ℕₚ.+-isMagma ℕₚ.+-cancelˡ-≡ +-cancelʳ-≡ : RightCancellative _+_ +-cancelʳ-≡ = +-Monomorphism.cancelʳ ℕₚ.+-isMagma ℕₚ.+-cancelʳ-≡ ------------------------------------------------------------------------ -- Structures for _+_ +-isMagma : IsMagma _+_ +-isMagma = isMagma _+_ +-isSemigroup : IsSemigroup _+_ +-isSemigroup = +-Monomorphism.isSemigroup ℕₚ.+-isSemigroup +-0-isMonoid : IsMonoid _+_ 0ᵇ +-0-isMonoid = +-Monomorphism.isMonoid ℕₚ.+-0-isMonoid +-0-isCommutativeMonoid : IsCommutativeMonoid _+_ 0ᵇ +-0-isCommutativeMonoid = +-Monomorphism.isCommutativeMonoid ℕₚ.+-0-isCommutativeMonoid ------------------------------------------------------------------------ -- Bundles for _+_ +-magma : Magma 0ℓ 0ℓ +-magma = magma _+_ +-semigroup : Semigroup 0ℓ 0ℓ +-semigroup = record { isSemigroup = +-isSemigroup } +-0-monoid : Monoid 0ℓ 0ℓ +-0-monoid = record { ε = zero ; isMonoid = +-0-isMonoid } +-0-commutativeMonoid : CommutativeMonoid 0ℓ 0ℓ +-0-commutativeMonoid = record { isCommutativeMonoid = +-0-isCommutativeMonoid } ------------------------------------------------------------------------------ -- Properties of _+_ and _≤_ +-mono-≤ : _+_ Preserves₂ _≤_ ⟶ _≤_ ⟶ _≤_ +-mono-≤ {x} {x'} {y} {y'} x≤x' y≤y' = begin x + y ≡⟨ sym $ cong₂ _+_ (fromℕ-toℕ x) (fromℕ-toℕ y) ⟩ fromℕ m + fromℕ n ≡⟨ sym (fromℕ-homo-+ m n) ⟩ fromℕ (m ℕ.+ n) ≤⟨ fromℕ-mono-≤ (ℕₚ.+-mono-≤ m≤m' n≤n') ⟩ fromℕ (m' ℕ.+ n') ≡⟨ fromℕ-homo-+ m' n' ⟩ fromℕ m' + fromℕ n' ≡⟨ cong₂ _+_ (fromℕ-toℕ x') (fromℕ-toℕ y') ⟩ x' + y' ∎ where open ≤-Reasoning m = toℕ x; m' = toℕ x' n = toℕ y; n' = toℕ y' m≤m' = toℕ-mono-≤ x≤x'; n≤n' = toℕ-mono-≤ y≤y' +-monoˡ-≤ : ∀ x → (_+ x) Preserves _≤_ ⟶ _≤_ +-monoˡ-≤ x y≤z = +-mono-≤ y≤z (≤-refl {x}) +-monoʳ-≤ : ∀ x → (x +_) Preserves _≤_ ⟶ _≤_ +-monoʳ-≤ x y≤z = +-mono-≤ (≤-refl {x}) y≤z +-mono-<-≤ : _+_ Preserves₂ _<_ ⟶ _≤_ ⟶ _<_ +-mono-<-≤ {x} {x'} {y} {y'} x<x' y≤y' = begin-strict x + y ≡⟨ sym $ cong₂ _+_ (fromℕ-toℕ x) (fromℕ-toℕ y) ⟩ fromℕ m + fromℕ n ≡⟨ sym (fromℕ-homo-+ m n) ⟩ fromℕ (m ℕ.+ n) <⟨ fromℕ-mono-< (ℕₚ.+-mono-<-≤ m<m' n≤n') ⟩ fromℕ (m' ℕ.+ n') ≡⟨ fromℕ-homo-+ m' n' ⟩ fromℕ m' + fromℕ n' ≡⟨ cong₂ _+_ (fromℕ-toℕ x') (fromℕ-toℕ y') ⟩ x' + y' ∎ where open ≤-Reasoning m = toℕ x; n = toℕ y m' = toℕ x'; n' = toℕ y' m<m' = toℕ-mono-< x<x'; n≤n' = toℕ-mono-≤ y≤y' +-mono-≤-< : _+_ Preserves₂ _≤_ ⟶ _<_ ⟶ _<_ +-mono-≤-< {x} {x'} {y} {y'} x≤x' y<y' = subst₂ _<_ (+-comm y x) (+-comm y' x') y+x<y'+x' where y+x<y'+x' = +-mono-<-≤ y<y' x≤x' +-monoˡ-< : ∀ x → (_+ x) Preserves _<_ ⟶ _<_ +-monoˡ-< x y<z = +-mono-<-≤ y<z (≤-refl {x}) +-monoʳ-< : ∀ x → (x +_) Preserves _<_ ⟶ _<_ +-monoʳ-< x y<z = +-mono-≤-< (≤-refl {x}) y<z x≤y+x : ∀ x y → x ≤ y + x x≤y+x x y = begin x ≡⟨ sym (+-identityˡ x) ⟩ 0ᵇ + x ≤⟨ +-monoˡ-≤ x (0≤x y) ⟩ y + x ∎ where open ≤-Reasoning x≤x+y : ∀ x y → x ≤ x + y x≤x+y x y = begin x ≤⟨ x≤y+x x y ⟩ y + x ≡⟨ +-comm y x ⟩ x + y ∎ where open ≤-Reasoning x<x+y : ∀ x {y} → y > 0ᵇ → x < x + y x<x+y x {y} y>0 = begin-strict x ≡⟨ sym (fromℕ-toℕ x) ⟩ fromℕ (toℕ x) <⟨ fromℕ-mono-< (ℕₚ.m<m+n (toℕ x) (toℕ-mono-< y>0)) ⟩ fromℕ (toℕ x ℕ.+ toℕ y) ≡⟨ fromℕ-homo-+ (toℕ x) (toℕ y) ⟩ fromℕ (toℕ x) + fromℕ (toℕ y) ≡⟨ cong₂ _+_ (fromℕ-toℕ x) (fromℕ-toℕ y) ⟩ x + y ∎ where open ≤-Reasoning x<x+1 : ∀ x → x < x + 1ᵇ x<x+1 x = x<x+y x 0<odd x<1+x : ∀ x → x < 1ᵇ + x x<1+x x rewrite +-comm 1ᵇ x = x<x+1 x x<1⇒x≡0 : ∀ {x} → x < 1ᵇ → x ≡ zero x<1⇒x≡0 0<odd = refl ------------------------------------------------------------------------ -- Other properties x≢0⇒x+y≢0 : ∀ {x} (y : ℕᵇ) → x ≢ zero → x + y ≢ zero x≢0⇒x+y≢0 {2[1+ _ ]} zero _ = λ() x≢0⇒x+y≢0 {zero} _ 0≢0 = contradiction refl 0≢0 ------------------------------------------------------------------------ -- Properties of _*_ ------------------------------------------------------------------------ ------------------------------------------------------------------------ -- Raw bundles for _*_ *-rawMagma : RawMagma 0ℓ 0ℓ *-rawMagma = record { _≈_ = _≡_ ; _∙_ = _*_ } *-1-rawMonoid : RawMonoid 0ℓ 0ℓ *-1-rawMonoid = record { _≈_ = _≡_ ; _∙_ = _*_ ; ε = 1ᵇ } ------------------------------------------------------------------------ -- toℕ/fromℕ are homomorphisms for _*_ private 2*ₙ2*ₙ = (2 ℕ.*_) ∘ (2 ℕ.*_) toℕ-homo-* : ∀ x y → toℕ (x * y) ≡ toℕ x ℕ.* toℕ y toℕ-homo-* x y = aux x y (size x ℕ.+ size y) ℕₚ.≤-refl where aux : (x y : ℕᵇ) → (cnt : ℕ) → (size x ℕ.+ size y ℕ.≤ cnt) → toℕ (x * y) ≡ toℕ x ℕ.* toℕ y aux zero _ _ _ = refl aux 2[1+ x ] zero _ _ = sym (ℕₚ.*-zeroʳ (toℕ x ℕ.+ (ℕ.suc (toℕ x ℕ.+ 0)))) aux 1+[2 x ] zero _ _ = sym (ℕₚ.*-zeroʳ (toℕ x ℕ.+ (toℕ x ℕ.+ 0))) aux 2[1+ x ] 2[1+ y ] (ℕ.suc cnt) (s≤s |x|+1+|y|≤cnt) = begin toℕ (2[1+ x ] * 2[1+ y ]) ≡⟨⟩ toℕ (double 2[1+ (x + (y + xy)) ]) ≡⟨ toℕ-double 2[1+ (x + (y + xy)) ] ⟩ 2 ℕ.* (toℕ 2[1+ (x + (y + xy)) ]) ≡⟨⟩ 2*ₙ2*ₙ (ℕ.suc (toℕ (x + (y + xy)))) ≡⟨ cong (2*ₙ2*ₙ ∘ ℕ.suc) (toℕ-homo-+ x (y + xy)) ⟩ 2*ₙ2*ₙ (ℕ.suc (m ℕ.+ (toℕ (y + xy)))) ≡⟨ cong (2*ₙ2*ₙ ∘ ℕ.suc ∘ (m ℕ.+_)) (toℕ-homo-+ y xy) ⟩ 2*ₙ2*ₙ (ℕ.suc (m ℕ.+ (n ℕ.+ toℕ xy))) ≡⟨ cong (2*ₙ2*ₙ ∘ ℕ.suc ∘ (m ℕ.+_) ∘ (n ℕ.+_)) (aux x y cnt |x|+|y|≤cnt) ⟩ 2*ₙ2*ₙ (ℕ.suc (m ℕ.+ (n ℕ.+ (m ℕ.* n)))) ≡⟨ solve 2 (λ m n → con 2 :* (con 2 :* (con 1 :+ (m :+ (n :+ m :* n)))) := (con 2 :* (con 1 :+ m)) :* (con 2 :* (con 1 :+ n))) refl m n ⟩ (2 ℕ.* (1 ℕ.+ m)) ℕ.* (2 ℕ.* (1 ℕ.+ n)) ≡⟨⟩ toℕ 2[1+ x ] ℕ.* toℕ 2[1+ y ] ∎ where open ≡-Reasoning; m = toℕ x; n = toℕ y; xy = x * y |x|+|y|≤cnt = ℕₚ.≤-trans (ℕₚ.+-monoʳ-≤ (size x) (ℕₚ.n≤1+n (size y))) |x|+1+|y|≤cnt aux 2[1+ x ] 1+[2 y ] (ℕ.suc cnt) (s≤s |x|+1+|y|≤cnt) = begin toℕ (2[1+ x ] * 1+[2 y ]) ≡⟨⟩ toℕ (2[1+ (x + y * 2[1+ x ]) ]) ≡⟨⟩ 2 ℕ.* (ℕ.suc (toℕ (x + y * 2[1+ x ]))) ≡⟨ cong ((2 ℕ.*_) ∘ ℕ.suc) (toℕ-homo-+ x _) ⟩ 2 ℕ.* (ℕ.suc (m ℕ.+ (toℕ (y * 2[1+ x ])))) ≡⟨ cong ((2 ℕ.*_) ∘ ℕ.suc ∘ (m ℕ.+_)) (aux y 2[1+ x ] cnt |y|+1+|x|≤cnt) ⟩ 2 ℕ.* (1+m ℕ.+ (n ℕ.* (toℕ 2[1+ x ]))) ≡⟨⟩ 2 ℕ.* (1+m ℕ.+ (n ℕ.* 2[1+m])) ≡⟨ solve 2 (λ m n → con 2 :* ((con 1 :+ m) :+ (n :* (con 2 :* (con 1 :+ m)))) := (con 2 :* (con 1 :+ m)) :* (con 1 :+ con 2 :* n)) refl m n ⟩ 2[1+m] ℕ.* (ℕ.suc (2 ℕ.* n)) ≡⟨⟩ toℕ 2[1+ x ] ℕ.* toℕ 1+[2 y ] ∎ where open ≡-Reasoning; m = toℕ x; n = toℕ y; 1+m = ℕ.suc m; 2[1+m] = 2 ℕ.* (ℕ.suc m) eq : size x ℕ.+ (ℕ.suc (size y)) ≡ size y ℕ.+ (ℕ.suc (size x)) eq = ℕ-+-semigroupProperties.x∙yz≈z∙yx (size x) 1 _ |y|+1+|x|≤cnt = subst (ℕ._≤ cnt) eq |x|+1+|y|≤cnt aux 1+[2 x ] 2[1+ y ] (ℕ.suc cnt) (s≤s |x|+1+|y|≤cnt) = begin toℕ (1+[2 x ] * 2[1+ y ]) ≡⟨⟩ toℕ 2[1+ (y + x * 2[1+ y ]) ] ≡⟨⟩ 2 ℕ.* (ℕ.suc (toℕ (y + x * 2[1+ y ]))) ≡⟨ cong ((2 ℕ.*_) ∘ ℕ.suc) (toℕ-homo-+ y (x * 2[1+ y ])) ⟩ 2 ℕ.* (ℕ.suc (n ℕ.+ (toℕ (x * 2[1+ y ])))) ≡⟨ cong ((2 ℕ.*_) ∘ ℕ.suc ∘ (n ℕ.+_)) (aux x 2[1+ y ] cnt |x|+1+|y|≤cnt) ⟩ 2 ℕ.* (1+n ℕ.+ (m ℕ.* toℕ 2[1+ y ])) ≡⟨⟩ 2 ℕ.* (1+n ℕ.+ (m ℕ.* 2[1+n])) ≡⟨ solve 2 (λ m n → con 2 :* ((con 1 :+ n) :+ (m :* (con 2 :* (con 1 :+ n)))) := (con 1 :+ (con 2 :* m)) :* (con 2 :* (con 1 :+ n))) refl m n ⟩ (ℕ.suc 2m) ℕ.* 2[1+n] ≡⟨⟩ toℕ 1+[2 x ] ℕ.* toℕ 2[1+ y ] ∎ where open ≡-Reasoning m = toℕ x; n = toℕ y; 1+n = ℕ.suc n 2m = 2 ℕ.* m; 2[1+n] = 2 ℕ.* (ℕ.suc n) aux 1+[2 x ] 1+[2 y ] (ℕ.suc cnt) (s≤s |x|+1+|y|≤cnt) = begin toℕ (1+[2 x ] * 1+[2 y ]) ≡⟨⟩ toℕ 1+[2 (x + y * 1+2x) ] ≡⟨⟩ ℕ.suc (2 ℕ.* (toℕ (x + y * 1+2x))) ≡⟨ cong (ℕ.suc ∘ (2 ℕ.*_)) (toℕ-homo-+ x (y * 1+2x)) ⟩ ℕ.suc (2 ℕ.* (m ℕ.+ (toℕ (y * 1+2x)))) ≡⟨ cong (ℕ.suc ∘ (2 ℕ.*_) ∘ (m ℕ.+_)) (aux y 1+2x cnt |y|+1+|x|≤cnt) ⟩ ℕ.suc (2 ℕ.* (m ℕ.+ (n ℕ.* [1+2x]'))) ≡⟨ cong ℕ.suc $ ℕₚ.*-distribˡ-+ 2 m (n ℕ.* [1+2x]') ⟩ ℕ.suc (2m ℕ.+ (2 ℕ.* (n ℕ.* [1+2x]'))) ≡⟨ cong (ℕ.suc ∘ (2m ℕ.+_)) (sym (ℕₚ.*-assoc 2 n _)) ⟩ (ℕ.suc 2m) ℕ.+ 2n ℕ.* [1+2x]' ≡⟨⟩ [1+2x]' ℕ.+ 2n ℕ.* [1+2x]' ≡⟨ cong (ℕ._+ (2n ℕ.* [1+2x]')) $ sym (ℕₚ.*-identityˡ [1+2x]') ⟩ 1 ℕ.* [1+2x]' ℕ.+ 2n ℕ.* [1+2x]' ≡⟨ sym (ℕₚ.*-distribʳ-+ [1+2x]' 1 2n) ⟩ (ℕ.suc 2n) ℕ.* [1+2x]' ≡⟨ ℕₚ.*-comm (ℕ.suc 2n) [1+2x]' ⟩ toℕ 1+[2 x ] ℕ.* toℕ 1+[2 y ] ∎ where open ≡-Reasoning m = toℕ x; n = toℕ y; 2m = 2 ℕ.* m; 2n = 2 ℕ.* n 1+2x = 1+[2 x ]; [1+2x]' = toℕ 1+2x eq : size x ℕ.+ (ℕ.suc (size y)) ≡ size y ℕ.+ (ℕ.suc (size x)) eq = ℕ-+-semigroupProperties.x∙yz≈z∙yx (size x) 1 _ |y|+1+|x|≤cnt = subst (ℕ._≤ cnt) eq |x|+1+|y|≤cnt toℕ-isMagmaHomomorphism-* : IsMagmaHomomorphism *-rawMagma ℕₚ.*-rawMagma toℕ toℕ-isMagmaHomomorphism-* = record { isRelHomomorphism = toℕ-isRelHomomorphism ; homo = toℕ-homo-* } toℕ-isMonoidHomomorphism-* : IsMonoidHomomorphism *-1-rawMonoid ℕₚ.*-1-rawMonoid toℕ toℕ-isMonoidHomomorphism-* = record { isMagmaHomomorphism = toℕ-isMagmaHomomorphism-* ; ε-homo = refl } toℕ-isMonoidMonomorphism-* : IsMonoidMonomorphism *-1-rawMonoid ℕₚ.*-1-rawMonoid toℕ toℕ-isMonoidMonomorphism-* = record { isMonoidHomomorphism = toℕ-isMonoidHomomorphism-* ; injective = toℕ-injective } fromℕ-homo-* : ∀ m n → fromℕ (m ℕ.* n) ≡ fromℕ m * fromℕ n fromℕ-homo-* m n = begin fromℕ (m ℕ.* n) ≡⟨ cong fromℕ (cong₂ ℕ._*_ m≡aN n≡bN) ⟩ fromℕ (toℕ a ℕ.* toℕ b) ≡⟨ cong fromℕ (sym (toℕ-homo-* a b)) ⟩ fromℕ (toℕ (a * b)) ≡⟨ fromℕ-toℕ (a * b) ⟩ a * b ∎ where open ≡-Reasoning a = fromℕ m; b = fromℕ n m≡aN = sym (toℕ-fromℕ m); n≡bN = sym (toℕ-fromℕ n) private module *-Monomorphism = MonoidMonomorphism toℕ-isMonoidMonomorphism-* ------------------------------------------------------------------------ -- Algebraic properties of _*_ -- Mostly proved by using the isomorphism between `ℕ` and `ℕᵇ` provided -- by `toℕ`/`fromℕ`. *-assoc : Associative _*_ *-assoc = *-Monomorphism.assoc ℕₚ.*-isMagma ℕₚ.*-assoc *-comm : Commutative _*_ *-comm = *-Monomorphism.comm ℕₚ.*-isMagma ℕₚ.*-comm *-identityˡ : LeftIdentity 1ᵇ _*_ *-identityˡ = *-Monomorphism.identityˡ ℕₚ.*-isMagma ℕₚ.*-identityˡ *-identityʳ : RightIdentity 1ᵇ _*_ *-identityʳ x = trans (*-comm x 1ᵇ) (*-identityˡ x) *-identity : Identity 1ᵇ _*_ *-identity = (*-identityˡ , *-identityʳ) *-zeroˡ : LeftZero zero _*_ *-zeroˡ _ = refl *-zeroʳ : RightZero zero _*_ *-zeroʳ zero = refl *-zeroʳ 2[1+ _ ] = refl *-zeroʳ 1+[2 _ ] = refl *-zero : Zero zero _*_ *-zero = *-zeroˡ , *-zeroʳ *-distribˡ-+ : _*_ DistributesOverˡ _+_ *-distribˡ-+ a b c = begin a * (b + c) ≡⟨ sym (fromℕ-toℕ (a * (b + c))) ⟩ fromℕ (toℕ (a * (b + c))) ≡⟨ cong fromℕ (toℕ-homo-* a (b + c)) ⟩ fromℕ (k ℕ.* (toℕ (b + c))) ≡⟨ cong (fromℕ ∘ (k ℕ.*_)) (toℕ-homo-+ b c) ⟩ fromℕ (k ℕ.* (m ℕ.+ n)) ≡⟨ cong fromℕ (ℕₚ.*-distribˡ-+ k m n) ⟩ fromℕ (k ℕ.* m ℕ.+ k ℕ.* n) ≡⟨ cong fromℕ $ sym $ cong₂ ℕ._+_ (toℕ-homo-* a b) (toℕ-homo-* a c) ⟩ fromℕ (toℕ (a * b) ℕ.+ toℕ (a * c)) ≡⟨ cong fromℕ (sym (toℕ-homo-+ (a * b) (a * c))) ⟩ fromℕ (toℕ (a * b + a * c)) ≡⟨ fromℕ-toℕ (a * b + a * c) ⟩ a * b + a * c ∎ where open ≡-Reasoning; k = toℕ a; m = toℕ b; n = toℕ c *-distribʳ-+ : _*_ DistributesOverʳ _+_ *-distribʳ-+ = comm+distrˡ⇒distrʳ *-comm *-distribˡ-+ *-distrib-+ : _*_ DistributesOver _+_ *-distrib-+ = *-distribˡ-+ , *-distribʳ-+ ------------------------------------------------------------------------ -- Structures *-isMagma : IsMagma _*_ *-isMagma = isMagma _*_ *-isSemigroup : IsSemigroup _*_ *-isSemigroup = *-Monomorphism.isSemigroup ℕₚ.*-isSemigroup *-1-isMonoid : IsMonoid _*_ 1ᵇ *-1-isMonoid = *-Monomorphism.isMonoid ℕₚ.*-1-isMonoid *-1-isCommutativeMonoid : IsCommutativeMonoid _*_ 1ᵇ *-1-isCommutativeMonoid = *-Monomorphism.isCommutativeMonoid ℕₚ.*-1-isCommutativeMonoid *-+-isSemiringWithoutAnnihilatingZero : IsSemiringWithoutAnnihilatingZero _+_ _*_ zero 1ᵇ *-+-isSemiringWithoutAnnihilatingZero = record { +-isCommutativeMonoid = +-0-isCommutativeMonoid ; *-isMonoid = *-1-isMonoid ; distrib = *-distrib-+ } *-+-isSemiring : IsSemiring _+_ _*_ zero 1ᵇ *-+-isSemiring = record { isSemiringWithoutAnnihilatingZero = *-+-isSemiringWithoutAnnihilatingZero ; zero = *-zero } *-+-isCommutativeSemiring : IsCommutativeSemiring _+_ _*_ zero 1ᵇ *-+-isCommutativeSemiring = record { isSemiring = *-+-isSemiring ; *-comm = *-comm } ------------------------------------------------------------------------ -- Bundles *-magma : Magma 0ℓ 0ℓ *-magma = record { isMagma = *-isMagma } *-semigroup : Semigroup 0ℓ 0ℓ *-semigroup = record { isSemigroup = *-isSemigroup } *-1-monoid : Monoid 0ℓ 0ℓ *-1-monoid = record { isMonoid = *-1-isMonoid } *-1-commutativeMonoid : CommutativeMonoid 0ℓ 0ℓ *-1-commutativeMonoid = record { isCommutativeMonoid = *-1-isCommutativeMonoid } *-+-semiring : Semiring 0ℓ 0ℓ *-+-semiring = record { isSemiring = *-+-isSemiring } *-+-commutativeSemiring : CommutativeSemiring 0ℓ 0ℓ *-+-commutativeSemiring = record { isCommutativeSemiring = *-+-isCommutativeSemiring } ------------------------------------------------------------------------ -- Properties of _*_ and _≤_ & _<_ *-mono-≤ : _*_ Preserves₂ _≤_ ⟶ _≤_ ⟶ _≤_ *-mono-≤ {x} {u} {y} {v} x≤u y≤v = toℕ-cancel-≤ (begin toℕ (x * y) ≡⟨ toℕ-homo-* x y ⟩ toℕ x ℕ.* toℕ y ≤⟨ ℕₚ.*-mono-≤ (toℕ-mono-≤ x≤u) (toℕ-mono-≤ y≤v) ⟩ toℕ u ℕ.* toℕ v ≡⟨ sym (toℕ-homo-* u v) ⟩ toℕ (u * v) ∎) where open ℕₚ.≤-Reasoning *-monoʳ-≤ : ∀ x → (x *_) Preserves _≤_ ⟶ _≤_ *-monoʳ-≤ x y≤y' = *-mono-≤ (≤-refl {x}) y≤y' *-monoˡ-≤ : ∀ x → (_* x) Preserves _≤_ ⟶ _≤_ *-monoˡ-≤ x y≤y' = *-mono-≤ y≤y' (≤-refl {x}) *-mono-< : _*_ Preserves₂ _<_ ⟶ _<_ ⟶ _<_ *-mono-< {x} {u} {y} {v} x<u y<v = toℕ-cancel-< (begin-strict toℕ (x * y) ≡⟨ toℕ-homo-* x y ⟩ toℕ x ℕ.* toℕ y <⟨ ℕₚ.*-mono-< (toℕ-mono-< x<u) (toℕ-mono-< y<v) ⟩ toℕ u ℕ.* toℕ v ≡⟨ sym (toℕ-homo-* u v) ⟩ toℕ (u * v) ∎) where open ℕₚ.≤-Reasoning *-monoʳ-< : ∀ x → ((1ᵇ + x) *_) Preserves _<_ ⟶ _<_ *-monoʳ-< x {y} {z} y<z = begin-strict (1ᵇ + x) * y ≡⟨ *-distribʳ-+ y 1ᵇ x ⟩ 1ᵇ * y + x * y ≡⟨ cong (_+ x * y) (*-identityˡ y) ⟩ y + x * y <⟨ +-mono-<-≤ y<z (*-monoʳ-≤ x (<⇒≤ y<z)) ⟩ z + x * z ≡⟨ cong (_+ x * z) (sym (*-identityˡ z)) ⟩ 1ᵇ * z + x * z ≡⟨ sym (*-distribʳ-+ z 1ᵇ x) ⟩ (1ᵇ + x) * z ∎ where open ≤-Reasoning *-monoˡ-< : ∀ x → (_* (1ᵇ + x)) Preserves _<_ ⟶ _<_ *-monoˡ-< x {y} {z} y<z = begin-strict y * (1ᵇ + x) ≡⟨ *-comm y (1ᵇ + x) ⟩ (1ᵇ + x) * y <⟨ *-monoʳ-< x y<z ⟩ (1ᵇ + x) * z ≡⟨ *-comm (1ᵇ + x) z ⟩ z * (1ᵇ + x) ∎ where open ≤-Reasoning ------------------------------------------------------------------------ -- Other properties of _*_ x*y≡0⇒x≡0∨y≡0 : ∀ x {y} → x * y ≡ zero → x ≡ zero ⊎ y ≡ zero x*y≡0⇒x≡0∨y≡0 zero {_} _ = inj₁ refl x*y≡0⇒x≡0∨y≡0 _ {zero} _ = inj₂ refl x≢0∧y≢0⇒x*y≢0 : ∀ {x y} → x ≢ zero → y ≢ zero → x * y ≢ zero x≢0∧y≢0⇒x*y≢0 {x} {_} x≢0 y≢0 xy≡0 with x*y≡0⇒x≡0∨y≡0 x xy≡0 ... | inj₁ x≡0 = x≢0 x≡0 ... | inj₂ y≡0 = y≢0 y≡0 2*x≡x+x : ∀ x → 2ᵇ * x ≡ x + x 2*x≡x+x x = begin 2ᵇ * x ≡⟨⟩ (1ᵇ + 1ᵇ) * x ≡⟨ *-distribʳ-+ x 1ᵇ 1ᵇ ⟩ 1ᵇ * x + 1ᵇ * x ≡⟨ cong₂ _+_ (*-identityˡ x) (*-identityˡ x) ⟩ x + x ∎ where open ≡-Reasoning 1+-* : ∀ x y → (1ᵇ + x) * y ≡ y + x * y 1+-* x y = begin (1ᵇ + x) * y ≡⟨ *-distribʳ-+ y 1ᵇ x ⟩ 1ᵇ * y + x * y ≡⟨ cong (_+ x * y) (*-identityˡ y) ⟩ y + x * y ∎ where open ≡-Reasoning *-1+ : ∀ x y → y * (1ᵇ + x) ≡ y + y * x *-1+ x y = begin y * (1ᵇ + x) ≡⟨ *-distribˡ-+ y 1ᵇ x ⟩ y * 1ᵇ + y * x ≡⟨ cong (_+ y * x) (*-identityʳ y) ⟩ y + y * x ∎ where open ≡-Reasoning ------------------------------------------------------------------------ -- Properties of double ------------------------------------------------------------------------ double[x]≡0⇒x≡0 : ∀ {x} → double x ≡ zero → x ≡ zero double[x]≡0⇒x≡0 {zero} _ = refl x≢0⇒double[x]≢0 : ∀ {x} → x ≢ zero → double x ≢ zero x≢0⇒double[x]≢0 x≢0 = x≢0 ∘ double[x]≡0⇒x≡0 double≢1 : ∀ {x} → double x ≢ 1ᵇ double≢1 {zero} () double≗2* : double ≗ 2ᵇ *_ double≗2* x = toℕ-injective $ begin toℕ (double x) ≡⟨ toℕ-double x ⟩ 2 ℕ.* (toℕ x) ≡⟨ sym (toℕ-homo-* 2ᵇ x) ⟩ toℕ (2ᵇ * x) ∎ where open ≡-Reasoning double-*-assoc : ∀ x y → (double x) * y ≡ double (x * y) double-*-assoc x y = begin (double x) * y ≡⟨ cong (_* y) (double≗2* x) ⟩ (2ᵇ * x) * y ≡⟨ *-assoc 2ᵇ x y ⟩ 2ᵇ * (x * y) ≡⟨ sym (double≗2* (x * y)) ⟩ double (x * y) ∎ where open ≡-Reasoning double[x]≡x+x : ∀ x → double x ≡ x + x double[x]≡x+x x = trans (double≗2* x) (2*x≡x+x x) double-distrib-+ : ∀ x y → double (x + y) ≡ double x + double y double-distrib-+ x y = begin double (x + y) ≡⟨ double≗2* (x + y) ⟩ 2ᵇ * (x + y) ≡⟨ *-distribˡ-+ 2ᵇ x y ⟩ (2ᵇ * x) + (2ᵇ * y) ≡⟨ sym (cong₂ _+_ (double≗2* x) (double≗2* y)) ⟩ double x + double y ∎ where open ≡-Reasoning double-mono-≤ : double Preserves _≤_ ⟶ _≤_ double-mono-≤ {x} {y} x≤y = begin double x ≡⟨ double≗2* x ⟩ 2ᵇ * x ≤⟨ *-monoʳ-≤ 2ᵇ x≤y ⟩ 2ᵇ * y ≡⟨ sym (double≗2* y) ⟩ double y ∎ where open ≤-Reasoning double-mono-< : double Preserves _<_ ⟶ _<_ double-mono-< {x} {y} x<y = begin-strict double x ≡⟨ double≗2* x ⟩ 2ᵇ * x <⟨ *-monoʳ-< 1ᵇ x<y ⟩ 2ᵇ * y ≡⟨ sym (double≗2* y) ⟩ double y ∎ where open ≤-Reasoning double-cancel-≤ : ∀ {x y} → double x ≤ double y → x ≤ y double-cancel-≤ {x} {y} 2x≤2y with <-cmp x y ... | tri< x<y _ _ = <⇒≤ x<y ... | tri≈ _ x≡y _ = ≤-reflexive x≡y ... | tri> _ _ x>y = contradiction 2x≤2y (<⇒≱ (double-mono-< x>y)) double-cancel-< : ∀ {x y} → double x < double y → x < y double-cancel-< {x} {y} 2x<2y with <-cmp x y ... | tri< x<y _ _ = x<y ... | tri≈ _ refl _ = contradiction 2x<2y (<-irrefl refl) ... | tri> _ _ x>y = contradiction (double-mono-< x>y) (<⇒≯ 2x<2y) x<double[x] : ∀ x → x ≢ zero → x < double x x<double[x] x x≢0 = begin-strict x <⟨ x<x+y x (x≢0⇒x>0 x≢0) ⟩ x + x ≡⟨ sym (double[x]≡x+x x) ⟩ double x ∎ where open ≤-Reasoning x≤double[x] : ∀ x → x ≤ double x x≤double[x] x = begin x ≤⟨ x≤x+y x x ⟩ x + x ≡⟨ sym (double[x]≡x+x x) ⟩ double x ∎ where open ≤-Reasoning ------------------------------------------------------------------------ -- Properties of suc ------------------------------------------------------------------------ 2[1+_]-double-suc : 2[1+_] ≗ double ∘ suc 2[1+_]-double-suc zero = refl 2[1+_]-double-suc 2[1+ x ] = cong 2[1+_] (2[1+_]-double-suc x) 2[1+_]-double-suc 1+[2 x ] = refl 1+[2_]-suc-double : 1+[2_] ≗ suc ∘ double 1+[2_]-suc-double zero = refl 1+[2_]-suc-double 2[1+ x ] = refl 1+[2_]-suc-double 1+[2 x ] = begin 1+[2 1+[2 x ] ] ≡⟨ cong 1+[2_] (1+[2_]-suc-double x) ⟩ 1+[2 (suc 2x) ] ≡⟨⟩ suc 2[1+ 2x ] ≡⟨ cong suc (2[1+_]-double-suc 2x) ⟩ suc (double (suc 2x)) ≡⟨ cong (suc ∘ double) (sym (1+[2_]-suc-double x)) ⟩ suc (double 1+[2 x ]) ∎ where open ≡-Reasoning; 2x = double x suc≢0 : ∀ {x} → suc x ≢ zero suc≢0 {zero} () suc≢0 {2[1+ _ ]} () suc≢0 {1+[2 _ ]} () 0<suc : ∀ x → zero < suc x 0<suc x = x≢0⇒x>0 (suc≢0 {x}) x<suc[x] : ∀ x → x < suc x x<suc[x] x = begin-strict x <⟨ x<1+x x ⟩ 1ᵇ + x ≡⟨ sym (suc≗1+ x) ⟩ suc x ∎ where open ≤-Reasoning x≤suc[x] : ∀ x → x ≤ suc x x≤suc[x] x = <⇒≤ (x<suc[x] x) x≢suc[x] : ∀ x → x ≢ suc x x≢suc[x] x = <⇒≢ (x<suc[x] x) suc-mono-≤ : suc Preserves _≤_ ⟶ _≤_ suc-mono-≤ {x} {y} x≤y = begin suc x ≡⟨ suc≗1+ x ⟩ 1ᵇ + x ≤⟨ +-monoʳ-≤ 1ᵇ x≤y ⟩ 1ᵇ + y ≡⟨ sym (suc≗1+ y) ⟩ suc y ∎ where open ≤-Reasoning suc[x]≤y⇒x<y : ∀ {x y} → suc x ≤ y → x < y suc[x]≤y⇒x<y {x} (inj₁ sx<y) = <-trans (x<suc[x] x) sx<y suc[x]≤y⇒x<y {x} (inj₂ refl) = x<suc[x] x x<y⇒suc[x]≤y : ∀ {x y} → x < y → suc x ≤ y x<y⇒suc[x]≤y {x} {y} x<y = begin suc x ≡⟨ sym (fromℕ-toℕ (suc x)) ⟩ fromℕ (toℕ (suc x)) ≡⟨ cong fromℕ (toℕ-suc x) ⟩ fromℕ (ℕ.suc (toℕ x)) ≤⟨ fromℕ-mono-≤ (toℕ-mono-< x<y) ⟩ fromℕ (toℕ y) ≡⟨ fromℕ-toℕ y ⟩ y ∎ where open ≤-Reasoning suc-* : ∀ x y → suc x * y ≡ y + x * y suc-* x y = begin suc x * y ≡⟨ cong (_* y) (suc≗1+ x) ⟩ (1ᵇ + x) * y ≡⟨ 1+-* x y ⟩ y + x * y ∎ where open ≡-Reasoning *-suc : ∀ x y → x * suc y ≡ x + x * y *-suc x y = begin x * suc y ≡⟨ cong (x *_) (suc≗1+ y) ⟩ x * (1ᵇ + y) ≡⟨ *-1+ y x ⟩ x + x * y ∎ where open ≡-Reasoning x≤suc[y]*x : ∀ x y → x ≤ (suc y) * x x≤suc[y]*x x y = begin x ≤⟨ x≤x+y x (y * x) ⟩ x + y * x ≡⟨ sym (suc-* y x) ⟩ (suc y) * x ∎ where open ≤-Reasoning suc[x]≤double[x] : ∀ x → x ≢ zero → suc x ≤ double x suc[x]≤double[x] x = x<y⇒suc[x]≤y {x} {double x} ∘ x<double[x] x suc[x]<2[1+x] : ∀ x → suc x < 2[1+ x ] suc[x]<2[1+x] x = begin-strict suc x <⟨ x<double[x] (suc x) suc≢0 ⟩ double (suc x) ≡⟨ sym (2[1+_]-double-suc x) ⟩ 2[1+ x ] ∎ where open ≤-Reasoning double[x]<1+[2x] : ∀ x → double x < 1+[2 x ] double[x]<1+[2x] x = begin-strict double x <⟨ x<suc[x] (double x) ⟩ suc (double x) ≡⟨ sym (1+[2_]-suc-double x) ⟩ 1+[2 x ] ∎ where open ≤-Reasoning ------------------------------------------------------------------------ -- Properties of pred ------------------------------------------------------------------------ pred-suc : pred ∘ suc ≗ id pred-suc zero = refl pred-suc 2[1+ x ] = sym (2[1+_]-double-suc x) pred-suc 1+[2 x ] = refl suc-pred : ∀ {x} → x ≢ zero → suc (pred x) ≡ x suc-pred {zero} 0≢0 = contradiction refl 0≢0 suc-pred {2[1+ _ ]} _ = refl suc-pred {1+[2 x ]} _ = sym (1+[2_]-suc-double x) pred-mono-≤ : pred Preserves _≤_ ⟶ _≤_ pred-mono-≤ {x} {y} x≤y = begin pred x ≡⟨ cong pred (sym (fromℕ-toℕ x)) ⟩ pred (fromℕ m) ≡⟨ sym (fromℕ-pred m) ⟩ fromℕ (ℕ.pred m) ≤⟨ fromℕ-mono-≤ (ℕₚ.pred-mono (toℕ-mono-≤ x≤y)) ⟩ fromℕ (ℕ.pred n) ≡⟨ fromℕ-pred n ⟩ pred (fromℕ n) ≡⟨ cong pred (fromℕ-toℕ y) ⟩ pred y ∎ where open ≤-Reasoning; m = toℕ x; n = toℕ y pred[x]<x : ∀ {x} → x ≢ zero → pred x < x pred[x]<x {x} x≢0 = begin-strict pred x <⟨ x<suc[x] (pred x) ⟩ suc (pred x) ≡⟨ suc-pred x≢0 ⟩ x ∎ where open ≤-Reasoning ------------------------------------------------------------------------ -- Properties of size ------------------------------------------------------------------------ |x|≡0⇒x≡0 : ∀ {x} → size x ≡ 0 → x ≡ 0ᵇ |x|≡0⇒x≡0 {zero} refl = refl
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_cy2aaddr_fastcall.asm
jpoikela/z88dk
640
175282
<gh_stars>100-1000 ; void *tshc_cy2aaddr(uchar row) SECTION code_clib SECTION code_arch PUBLIC _tshc_cy2aaddr_fastcall EXTERN asm_tshc_cy2aaddr defc _tshc_cy2aaddr_fastcall = asm_tshc_cy2aaddr
projects/batfish/src/main/antlr4/org/batfish/grammar/f5_bigip_structured/F5BigipStructuredLexer.g4
nickgian/batfish
0
3318
lexer grammar F5BigipStructuredLexer; options { superClass = 'org.batfish.grammar.BatfishLexer'; } @members { // Java code to end up in F5BigipStructuredLexer.java goes here private int lastTokenType = -1; @Override public void emit(Token token) { super.emit(token); if (token.getChannel() != HIDDEN) { lastTokenType = token.getType(); } } } // Keywords ACTION : 'action' ; ACTIVATE : 'activate' ; ADDRESS : 'address' ; ADDRESS_FAMILY : 'address-family' ; ALL : 'all' ; ALLOW_SERVICE : 'allow-service' ; ALWAYS : 'always' ; ANY : 'any' ; ARP : 'arp' ; BGP : 'bgp' ; BUNDLE : 'bundle' ; BUNDLE_SPEED : 'bundle-speed' ; CLIENT_SSL : 'client-ssl' ; COMMUNITY : 'community' ; DEFAULT : 'default' ; DEFAULTS_FROM : 'defaults-from' ; DENY : 'deny' ; DESCRIPTION : 'description' ; DESTINATION : 'destination' ; DISABLED : 'disabled' ; EBGP_MULTIHOP : 'ebgp-multihop' ; ENABLED : 'enabled' ; ENTRIES : 'entries' ; FORTY_G : '40G' ; GLOBAL_SETTINGS : 'global-settings' ; GW : 'gw' ; HOSTNAME : 'hostname' ; HTTP : 'http' ; HTTPS : 'https' ; ICMP_ECHO : 'icmp-echo' ; IF : 'if' ; INTERFACE : 'interface' ; INTERFACES : 'interfaces' ; IP_FORWARD : 'ip-forward' ; IP_PROTOCOL : 'ip-protocol' ; IPV4 : 'ipv4' ; IPV6 : 'ipv6' ; KERNEL : 'kernel' ; LACP : 'lacp' ; LOCAL_AS : 'local-as' ; LTM : 'ltm' ; MASK : 'mask' ; MATCH : 'match' ; MEMBERS : 'members' ; MONITOR : 'monitor' ; NEIGHBOR : 'neighbor' ; NET : 'net' ; NETWORK : 'network' ; NODE : 'node' ; NTP : 'ntp' ; OCSP_STAPLING_PARAMS : 'ocsp-stapling-params' ; ONE_CONNECT : 'one-connect' ; ONE_HUNDRED_G : '100G' ; ORIGINS : 'origins' ; OUT : 'out' ; PERMIT : 'permit' ; PERSIST : 'persist' ; PERSISTENCE : 'persistence' ; POOL : 'pool' ; PREFIX : 'prefix' ; PREFIX_LEN_RANGE : 'prefix-len-range' ; PREFIX_LIST : 'prefix-list' ; PROFILE : 'profile' ; PROFILES : 'profiles' ; REDISTRIBUTE : 'redistribute' ; REJECT : 'reject' ; REMOTE_AS : 'remote-as' ; ROUTE : 'route' ; ROUTE_ADVERTISEMENT : 'route-advertisement' ; ROUTE_DOMAIN : 'route-domain' ; ROUTE_MAP : 'route-map' ; ROUTER_ID : 'router-id' ; ROUTING : 'routing' ; RULE : 'rule' ; RULES : 'rules' ; SELECTIVE : 'selective' ; SELF : 'self' ; SERVER_SSL : 'server-ssl' ; SERVERS : 'servers' ; SET : 'set' ; SNAT : 'snat' ; SNAT_TRANSLATION : 'snat-translation' ; SNATPOOL : 'snatpool' ; SOURCE : 'source' ; SOURCE_ADDR : 'source-addr' ; SOURCE_ADDRESS_TRANSLATION : 'source-address-translation' ; SSL : 'ssl' ; SSL_PROFILE : 'ssl-profile' ; SYS : 'sys' ; TAG : 'tag' ; TCP : 'tcp' ; TRAFFIC_GROUP : 'traffic-group' ; TRANSLATE_ADDRESS : 'translate-address' ; TRANSLATE_PORT : 'translate-port' ; TRUNK : 'trunk' ; TYPE : 'type' ; UDP : 'udp' ; UPDATE_SOURCE : 'update-source' ; VALUE : 'value' ; VIRTUAL : 'virtual' ; VIRTUAL_ADDRESS : 'virtual-address' ; VLAN : 'vlan' ; VLANS : 'vlans' ; VLANS_DISABLED : 'vlans-disabled' ; VLANS_ENABLED : 'vlans-enabled' ; // Complex tokens BRACE_LEFT : '{' ; BRACE_RIGHT : '}' ; BRACKET_LEFT : '[' ; BRACKET_RIGHT : ']' ; COMMENT_LINE : ( F_Whitespace )* '#' {lastTokenType == NEWLINE || lastTokenType == -1}? F_NonNewlineChar* F_Newline+ -> channel ( HIDDEN ) ; COMMENT_TAIL : '#' F_NonNewlineChar* -> channel ( HIDDEN ) ; VLAN_ID : F_VlanId ; UINT16 : F_Uint16 ; UINT32 : F_Uint32 ; DEC : F_Digit+ ; DOUBLE_QUOTED_STRING : '"' ~'"'* '"' ; IMISH_CHUNK : '!' {lastTokenType == NEWLINE}? F_NonNewlineChar* F_Newline+ F_Anything* ; IP_ADDRESS : F_IpAddress ; IP_ADDRESS_PORT : F_IpAddressPort ; IP_PREFIX : F_IpPrefix ; IPV6_ADDRESS : F_Ipv6Address ; IPV6_ADDRESS_PORT : F_Ipv6AddressPort ; IPV6_PREFIX : F_Ipv6Prefix ; NEWLINE : F_Newline+ ; PARTITION : F_Partition ; SEMICOLON : ';' -> channel ( HIDDEN ) ; STANDARD_COMMUNITY : F_StandardCommunity ; WORD_PORT : F_WordPort ; WORD_ID : F_WordId ; WORD : F_Word ; WS : F_Whitespace+ -> channel ( HIDDEN ) // parser never sees tokens on hidden channel ; // Fragments fragment F_Anything : . ; fragment F_DecByte : F_Digit | F_PositiveDigit F_Digit | '1' F_Digit F_Digit | '2' [0-4] F_Digit | '25' [0-5] ; fragment F_Digit : [0-9] ; fragment F_HexDigit : [0-9A-Fa-f] ; fragment F_HexWord : F_HexDigit F_HexDigit? F_HexDigit? F_HexDigit? ; fragment F_HexWord2 : F_HexWord ':' F_HexWord ; fragment F_HexWord3 : F_HexWord2 ':' F_HexWord ; fragment F_HexWord4 : F_HexWord3 ':' F_HexWord ; fragment F_HexWord5 : F_HexWord4 ':' F_HexWord ; fragment F_HexWord6 : F_HexWord5 ':' F_HexWord ; fragment F_HexWord7 : F_HexWord6 ':' F_HexWord ; fragment F_HexWord8 : F_HexWord6 ':' F_HexWordFinal2 ; fragment F_HexWordFinal2 : F_HexWord2 | F_IpAddress ; fragment F_HexWordFinal3 : F_HexWord ':' F_HexWordFinal2 ; fragment F_HexWordFinal4 : F_HexWord ':' F_HexWordFinal3 ; fragment F_HexWordFinal5 : F_HexWord ':' F_HexWordFinal4 ; fragment F_HexWordFinal6 : F_HexWord ':' F_HexWordFinal5 ; fragment F_HexWordFinal7 : F_HexWord ':' F_HexWordFinal6 ; fragment F_HexWordLE1 : F_HexWord? ; fragment F_HexWordLE2 : F_HexWordLE1 | F_HexWordFinal2 ; fragment F_HexWordLE3 : F_HexWordLE2 | F_HexWordFinal3 ; fragment F_HexWordLE4 : F_HexWordLE3 | F_HexWordFinal4 ; fragment F_HexWordLE5 : F_HexWordLE4 | F_HexWordFinal5 ; fragment F_HexWordLE6 : F_HexWordLE5 | F_HexWordFinal6 ; fragment F_HexWordLE7 : F_HexWordLE6 | F_HexWordFinal7 ; fragment F_IpAddress : F_DecByte '.' F_DecByte '.' F_DecByte '.' F_DecByte ; fragment F_IpAddressPort : F_IpAddress ':' F_Uint16 ; fragment F_IpPrefix : F_IpAddress '/' F_IpPrefixLength ; fragment F_IpPrefixLength : F_Digit | [12] F_Digit | [3] [012] ; fragment F_Ipv6Address : '::' F_HexWordLE7 | F_HexWord '::' F_HexWordLE6 | F_HexWord2 '::' F_HexWordLE5 | F_HexWord3 '::' F_HexWordLE4 | F_HexWord4 '::' F_HexWordLE3 | F_HexWord5 '::' F_HexWordLE2 | F_HexWord6 '::' F_HexWordLE1 | F_HexWord7 '::' | F_HexWord8 ; fragment F_Ipv6AddressPort : F_Ipv6Address '.' F_Uint16 ; fragment F_Ipv6Prefix : F_Ipv6Address '/' F_Ipv6PrefixLength ; fragment F_Ipv6PrefixLength : F_Digit | F_PositiveDigit F_Digit | '1' [01] F_Digit | '12' [0-8] ; fragment F_Newline : [\r\n] // carriage return or line feed ; fragment F_NonNewlineChar : ~[\r\n] // carriage return or line feed ; fragment F_Partition : '/' ( F_PartitionChar+ '/' )* ; fragment F_PartitionChar : F_WordCharCommon | [:] ; fragment F_PositiveDigit : '1' .. '9' ; fragment F_StandardCommunity : F_Uint16 ':' F_Uint16 ; fragment F_Uint16 : // 0-65535 F_Digit | F_PositiveDigit F_Digit F_Digit? F_Digit? | [1-5] F_Digit F_Digit F_Digit F_Digit | '6' [0-4] F_Digit F_Digit F_Digit | '65' [0-4] F_Digit F_Digit | '655' [0-2] F_Digit | '6553' [0-5] ; fragment F_Uint32 : // 0-4294967295 F_Digit | F_PositiveDigit F_Digit F_Digit? F_Digit? F_Digit? F_Digit? F_Digit? F_Digit? F_Digit? | [1-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit | '4' [0-1] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit | '42' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit | '429' [0-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit | '4294' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit | '42949' [0-5] F_Digit F_Digit F_Digit F_Digit | '429496' [0-6] F_Digit F_Digit F_Digit | '4294967' [0-1] F_Digit F_Digit | '42949672' [0-8] F_Digit | '429496729' [0-5] ; fragment F_VlanId : // 1-4094 F_PositiveDigit F_Digit? F_Digit? | [1-3] F_Digit F_Digit F_Digit | '40' [0-8] F_Digit | '409' [0-4] ; fragment F_Whitespace : [ \t\u000C] // tab or space or unicode 0x000C ; fragment F_Word : F_WordCharCommon ( F_WordChar* F_WordCharCommon )? ; fragment F_WordCharCommon : ~[ \t\n\r{}[\]/:] ; fragment F_WordChar : F_WordCharCommon | [:/] ; fragment F_WordPort : F_WordId ':' F_Uint16 ; fragment F_WordId : F_WordCharCommon+ ;
fiat-amd64/73.94_ratio13149_seed704989933151320_mul_p224.asm
dderjoel/fiat-crypto
491
176779
SECTION .text GLOBAL mul_p224 mul_p224: sub rsp, 0xb8 ; last 0x30 (6) for Caller - save regs mov [ rsp + 0x88 ], rbx; saving to stack mov [ rsp + 0x90 ], rbp; saving to stack mov [ rsp + 0x98 ], r12; saving to stack mov [ rsp + 0xa0 ], r13; saving to stack mov [ rsp + 0xa8 ], r14; saving to stack mov [ rsp + 0xb0 ], r15; saving to stack mov rax, [ rsi + 0x0 ]; load m64 x4 to register64 mov r10, rdx; preserving value of arg2 into a new reg mov rdx, [ rdx + 0x0 ]; saving arg2[0] in rdx. mulx r11, rbx, rax; x12, x11<- x4 * arg2[0] mov rbp, 0xffffffffffffffff ; moving imm to reg mov rdx, rbp; 0xffffffffffffffff to rdx mulx rbp, r12, rbx; _, x20<- x11 * 0xffffffffffffffff mov rbp, rdx; preserving value of 0xffffffffffffffff into a new reg mov rdx, [ r10 + 0x8 ]; saving arg2[1] in rdx. mulx r13, r14, rax; x10, x9<- x4 * arg2[1] mov r15, 0xffffffff00000000 ; moving imm to reg mov rdx, r12; x20 to rdx mulx r12, rcx, r15; x27, x26<- x20 * 0xffffffff00000000 mov r8, rdx; _, copying x20 here, cause x20 is needed in a reg for other than _, namely all: , x22--x23, x24--x25, _--x34, size: 3 add r8, rbx; could be done better, if r0 has been u8 as well mov r8, -0x2 ; moving imm to reg inc r8; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1) adox r14, r11 adcx rcx, r14 mov r9, [ rsi + 0x8 ]; load m64 x1 to register64 mov r11, rdx; preserving value of x20 into a new reg mov rdx, [ r10 + 0x0 ]; saving arg2[0] in rdx. mulx rbx, r14, r9; x50, x49<- x1 * arg2[0] setc r8b; spill CF x36 to reg (r8) clc; adcx r14, rcx mov rdx, rbp; 0xffffffffffffffff to rdx mulx rbp, rcx, r14; _, x68<- x58 * 0xffffffffffffffff mulx rbp, r15, rcx; x73, x72<- x68 * 0xffffffffffffffff mov rdx, 0xffffffff00000000 ; moving imm to reg mov [ rsp + 0x0 ], rdi; spilling out1 to mem mov [ rsp + 0x8 ], rbx; spilling x50 to mem mulx rdi, rbx, rcx; x75, x74<- x68 * 0xffffffff00000000 mov rdx, 0xffffffff ; moving imm to reg mov [ rsp + 0x10 ], rbx; spilling x74 to mem mov byte [ rsp + 0x18 ], r8b; spilling byte x36 to mem mulx rbx, r8, rcx; x71, x70<- x68 * 0xffffffff setc dl; spill CF x59 to reg (rdx) clc; adcx r15, rdi adcx r8, rbp mov rbp, 0x0 ; moving imm to reg adcx rbx, rbp mov dil, dl; preserving value of x59 into a new reg mov rdx, [ r10 + 0x8 ]; saving arg2[1] in rdx. mov [ rsp + 0x20 ], rbx; spilling x80 to mem mulx rbp, rbx, r9; x48, x47<- x1 * arg2[1] clc; adcx rcx, r14 mov rdx, [ r10 + 0x10 ]; arg2[2] to rdx mulx rcx, r14, rax; x8, x7<- x4 * arg2[2] mov [ rsp + 0x28 ], r8; spilling x78 to mem mov r8, 0xffffffffffffffff ; moving imm to reg mov rdx, r11; x20 to rdx mov [ rsp + 0x30 ], r15; spilling x76 to mem mulx r11, r15, r8; x25, x24<- x20 * 0xffffffffffffffff setc r8b; spill CF x82 to reg (r8) clc; adcx r15, r12 adox r14, r13 setc r13b; spill CF x29 to reg (r13) movzx r12, byte [ rsp + 0x18 ]; load byte memx36 to register64 clc; mov [ rsp + 0x38 ], rbp; spilling x48 to mem mov rbp, -0x1 ; moving imm to reg adcx r12, rbp; loading flag adcx r14, r15 setc r12b; spill CF x38 to reg (r12) clc; adcx rbx, [ rsp + 0x8 ] setc r15b; spill CF x52 to reg (r15) clc; movzx rdi, dil adcx rdi, rbp; loading flag adcx r14, rbx mov rdi, 0xffffffff ; moving imm to reg mulx rdx, rbx, rdi; x23, x22<- x20 * 0xffffffff setc bpl; spill CF x61 to reg (rbp) clc; mov rdi, -0x1 ; moving imm to reg movzx r8, r8b adcx r8, rdi; loading flag adcx r14, [ rsp + 0x10 ] setc r8b; spill CF x84 to reg (r8) clc; movzx r13, r13b adcx r13, rdi; loading flag adcx r11, rbx mov r13, rdx; preserving value of x23 into a new reg mov rdx, [ r10 + 0x18 ]; saving arg2[3] in rdx. mulx rax, rbx, rax; x6, x5<- x4 * arg2[3] mov rdx, r9; x1 to rdx mulx r9, rdi, [ r10 + 0x18 ]; x44, x43<- x1 * arg2[3] mov [ rsp + 0x40 ], r14; spilling x83 to mem mov r14, [ rsi + 0x18 ]; load m64 x3 to register64 adox rbx, rcx mulx rdx, rcx, [ r10 + 0x10 ]; x46, x45<- x1 * arg2[2] mov byte [ rsp + 0x48 ], r8b; spilling byte x84 to mem mov r8, 0x0 ; moving imm to reg adcx r13, r8 adox rax, r8 add r15b, 0xFF; load flag from rm/8 into CF, clears other flag. NODE, if operand1 is not a byte reg, this fails. setc r15b; since that has deps, resore it whereever it was adcx rcx, [ rsp + 0x38 ] adcx rdi, rdx mov rdx, [ r10 + 0x0 ]; arg2[0] to rdx mulx r15, r8, r14; x148, x147<- x3 * arg2[0] adc r9, 0x0 add r12b, 0xFF; load flag from rm/8 into CF, clears other flag. NODE, if operand1 is not a byte reg, this fails. setc r12b; since that has deps, resore it whereever it was adcx rbx, r11 mov r12, -0x1 ; moving imm to reg movzx rbp, bpl adox rbp, r12; loading flag adox rbx, rcx adcx r13, rax adox rdi, r13 mov rbp, [ rsi + 0x10 ]; load m64 x2 to register64 seto r11b; spill OF x65 to reg (r11) movzx rax, byte [ rsp + 0x48 ]; load byte memx84 to register64 inc r12; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov rcx, -0x1 ; moving imm to reg adox rax, rcx; loading flag adox rbx, [ rsp + 0x30 ] mov rax, [ rsp + 0x28 ]; x87, copying x78 here, cause x78 is needed in a reg for other than x87, namely all: , x87--x88, size: 1 adox rax, rdi movzx r13, r11b; x66, copying x65 here, cause x65 is needed in a reg for other than x66, namely all: , x66--x67, size: 1 adcx r13, r9 mov r9, [ rsp + 0x20 ]; x89, copying x80 here, cause x80 is needed in a reg for other than x89, namely all: , x89--x90, size: 1 adox r9, r13 seto r11b; spill OF x91 to reg (r11) adc r11b, 0x0 movzx r11, r11b mov rdx, [ r10 + 0x0 ]; arg2[0] to rdx mulx rdi, r13, rbp; x99, x98<- x2 * arg2[0] adox r13, [ rsp + 0x40 ] mov rdx, [ r10 + 0x8 ]; arg2[1] to rdx mulx r12, rcx, r14; x146, x145<- x3 * arg2[1] adcx rcx, r15 mov rdx, [ r10 + 0x10 ]; arg2[2] to rdx mov [ rsp + 0x50 ], rcx; spilling x149 to mem mulx r15, rcx, r14; x144, x143<- x3 * arg2[2] adcx rcx, r12 mov rdx, [ r10 + 0x18 ]; arg2[3] to rdx mulx r14, r12, r14; x142, x141<- x3 * arg2[3] adcx r12, r15 mov r15, 0xffffffffffffffff ; moving imm to reg mov rdx, r15; 0xffffffffffffffff to rdx mov [ rsp + 0x58 ], r12; spilling x153 to mem mulx r15, r12, r13; _, x117<- x107 * 0xffffffffffffffff mov [ rsp + 0x60 ], rcx; spilling x151 to mem mulx r15, rcx, r12; x122, x121<- x117 * 0xffffffffffffffff mov rdx, 0xffffffff ; moving imm to reg mov [ rsp + 0x68 ], r8; spilling x147 to mem mov byte [ rsp + 0x70 ], r11b; spilling byte x91 to mem mulx r8, r11, r12; x120, x119<- x117 * 0xffffffff mov rdx, 0x0 ; moving imm to reg adcx r14, rdx mov rdx, 0xffffffff00000000 ; moving imm to reg mov [ rsp + 0x78 ], r14; spilling x155 to mem mov [ rsp + 0x80 ], r9; spilling x89 to mem mulx r14, r9, r12; x124, x123<- x117 * 0xffffffff00000000 clc; adcx rcx, r14 adcx r11, r15 mov r15, 0x0 ; moving imm to reg adcx r8, r15 xchg rdx, rbp; x2, swapping with 0xffffffff00000000, which is currently in rdx mulx r14, r15, [ r10 + 0x8 ]; x97, x96<- x2 * arg2[1] clc; adcx r12, r13 setc r12b; spill CF x131 to reg (r12) clc; adcx r15, rdi adox r15, rbx mulx rbx, rdi, [ r10 + 0x10 ]; x95, x94<- x2 * arg2[2] adcx rdi, r14 mulx rdx, r13, [ r10 + 0x18 ]; x93, x92<- x2 * arg2[3] adox rdi, rax adcx r13, rbx mov rax, 0x0 ; moving imm to reg adcx rdx, rax clc; mov r14, -0x1 ; moving imm to reg movzx r12, r12b adcx r12, r14; loading flag adcx r15, r9 adcx rcx, rdi mov r9, [ rsp + 0x80 ]; x113, copying x89 here, cause x89 is needed in a reg for other than x113, namely all: , x113--x114, size: 1 adox r9, r13 adcx r11, r9 movzx r12, byte [ rsp + 0x70 ]; x115, copying x91 here, cause x91 is needed in a reg for other than x115, namely all: , x115--x116, size: 1 adox r12, rdx adcx r8, r12 setc bl; spill CF x139 to reg (rbx) clc; adcx r15, [ rsp + 0x68 ] mov rdi, 0xffffffffffffffff ; moving imm to reg mov rdx, r15; x156 to rdx mulx r15, r13, rdi; _, x166<- x156 * 0xffffffffffffffff xchg rdx, r13; x166, swapping with x156, which is currently in rdx mulx r15, r9, rdi; x171, x170<- x166 * 0xffffffffffffffff movzx r12, bl; x140, copying x139 here, cause x139 is needed in a reg for other than x140, namely all: , x140, size: 1 adox r12, rax mov rbx, rdx; _, copying x166 here, cause x166 is needed in a reg for other than _, namely all: , x172--x173, x168--x169, _--x180, size: 3 mov r14, -0x3 ; moving imm to reg inc r14; OF<-0x0, preserve CF (debug 7; load -3, increase it, save it as -2). #last resort adox rbx, r13 mov rbx, [ rsp + 0x50 ]; x158, copying x149 here, cause x149 is needed in a reg for other than x158, namely all: , x158--x159, size: 1 adcx rbx, rcx mov rcx, [ rsp + 0x60 ]; x160, copying x151 here, cause x151 is needed in a reg for other than x160, namely all: , x160--x161, size: 1 adcx rcx, r11 mulx r11, r13, rbp; x173, x172<- x166 * 0xffffffff00000000 setc r14b; spill CF x161 to reg (r14) clc; adcx r9, r11 adox r13, rbx mov rbx, 0xffffffff ; moving imm to reg mulx rdx, r11, rbx; x169, x168<- x166 * 0xffffffff adox r9, rcx adcx r11, r15 adcx rdx, rax seto r15b; spill OF x184 to reg (r15) mov rcx, r13; x190, copying x181 here, cause x181 is needed in a reg for other than x190, namely all: , x200, x190--x191, size: 2 sub rcx, 0x00000001 mov rax, r9; x192, copying x183 here, cause x183 is needed in a reg for other than x192, namely all: , x192--x193, x201, size: 2 sbb rax, rbp mov rbp, 0x0 ; moving imm to reg dec rbp; OF<-0x0, preserve CF (debug: state 4 (thanks Paul)) movzx r14, r14b adox r14, rbp; loading flag adox r8, [ rsp + 0x58 ] mov r14, [ rsp + 0x78 ]; x164, copying x155 here, cause x155 is needed in a reg for other than x164, namely all: , x164--x165, size: 1 adox r14, r12 seto r12b; spill OF x165 to reg (r12) inc rbp; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov rbp, -0x1 ; moving imm to reg movzx r15, r15b adox r15, rbp; loading flag adox r8, r11 adox rdx, r14 movzx r15, r12b; x189, copying x165 here, cause x165 is needed in a reg for other than x189, namely all: , x189, size: 1 mov r11, 0x0 ; moving imm to reg adox r15, r11 mov r12, r8; x194, copying x185 here, cause x185 is needed in a reg for other than x194, namely all: , x202, x194--x195, size: 2 sbb r12, rdi mov r14, rdx; x196, copying x187 here, cause x187 is needed in a reg for other than x196, namely all: , x196--x197, x203, size: 2 sbb r14, rbx sbb r15, 0x00000000 cmovc r12, r8; if CF, x202<- x185 (nzVar) cmovc r14, rdx; if CF, x203<- x187 (nzVar) mov r15, [ rsp + 0x0 ]; load m64 out1 to register64 mov [ r15 + 0x18 ], r14; out1[3] = x203 cmovc rcx, r13; if CF, x200<- x181 (nzVar) cmovc rax, r9; if CF, x201<- x183 (nzVar) mov [ r15 + 0x0 ], rcx; out1[0] = x200 mov [ r15 + 0x10 ], r12; out1[2] = x202 mov [ r15 + 0x8 ], rax; out1[1] = x201 mov rbx, [ rsp + 0x88 ]; restoring from stack mov rbp, [ rsp + 0x90 ]; restoring from stack mov r12, [ rsp + 0x98 ]; restoring from stack mov r13, [ rsp + 0xa0 ]; restoring from stack mov r14, [ rsp + 0xa8 ]; restoring from stack mov r15, [ rsp + 0xb0 ]; restoring from stack add rsp, 0xb8 ret ; cpu Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz ; clocked at 4769 MHz ; first cyclecount 91.085, best 72.13592233009709, lastGood 73.94059405940594 ; seed 704989933151320 ; CC / CFLAGS clang / -march=native -mtune=native -O3 ; time needed: 749020 ms / 60000 runs=> 12.483666666666666ms/run ; Time spent for assembling and measureing (initial batch_size=101, initial num_batches=101): 105000 ms ; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.14018317267896718 ; number reverted permutation/ tried permutation: 23128 / 29977 =77.152% ; number reverted decision/ tried decision: 22668 / 30024 =75.500%
parse/mvsrcfil.asm
DigitalMars/optlink
28
29253
TITLE MVSRCFIL - Copyright (c) SLR Systems 1994 INCLUDE MACROS INCLUDE IO_STRUC PUBLIC MOVE_SRCPRIM_TO_EAX_CLEAN,MOVE_SRCPRIM_TO_EAX,MOVE_ECXPRIM_TO_EAX .DATA EXTERNDEF SRCNAM:NFN_STRUCT .CODE FILEPARSE_TEXT MOVE_SRCPRIM_TO_EAX_CLEAN LABEL PROC ASSUME EAX:PTR NFN_STRUCT XOR ECX,ECX MOV [EAX].NFN_PRIMLEN,ECX MOV [EAX].NFN_PATHLEN,ECX MOV [EAX].NFN_EXTLEN,ECX MOV [EAX].NFN_TOTAL_LENGTH,ECX MOVE_SRCPRIM_TO_EAX PROC ; ;MOVE PRIMARY PART OF SRCNAM TO FILNAM ; MOV ECX,OFF SRCNAM ASSUME ECX:PTR NFN_STRUCT MOVE_ECXPRIM_TO_EAX LABEL PROC ; ;FIRST DELETE ANY EXISTING PRIMARY NAME ; PUSH EDI MOV EDX,ECX ASSUME ECX:NOTHING,EDX:PTR NFN_STRUCT MOV ECX,[EAX].NFN_PRIMLEN PUSH ESI OR ECX,ECX LEA ESI,[EAX].NFN_TEXT JZ L1$ ADD ESI,[EAX].NFN_PATHLEN SUB [EAX].NFN_TOTAL_LENGTH,ECX MOV EDI,ESI ADD ESI,ECX MOV ECX,[EAX].NFN_EXTLEN REP MOVSB L1$: ; ;NEXT MOVE EXTENT DOWN PRIMLEN BYTES ; LEA ESI,[EAX].NFN_TEXT-1 MOV ECX,[EAX].NFN_EXTLEN ADD ESI,[EAX].NFN_TOTAL_LENGTH MOV EDI,ESI STD ADD EDI,[EDX].NFN_PRIMLEN REP MOVSB CLD INC EDI ; ;NOW MOVE PRIMARY FROM SRCNAM ; LEA ESI,[EDX].NFN_TEXT MOV ECX,[EDX].NFN_PRIMLEN ADD ESI,[EDX].NFN_PATHLEN MOV [EAX].NFN_PRIMLEN,ECX ADD [EAX].NFN_TOTAL_LENGTH,ECX SUB EDI,ECX MOV EDX,[EAX].NFN_TOTAL_LENGTH REP MOVSB MOV DPTR [EDX+EAX].NFN_TEXT,ECX POPM ESI,EDI RET MOVE_SRCPRIM_TO_EAX ENDP END
windows/i386/vmcs.asm
sduverger/haxm
0
171999
<gh_stars>0 ; ; Copyright (c) 2011 Intel Corporation ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, ; this list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; ; 3. Neither the name of the copyright holder nor the names of its ; contributors may be used to endorse or promote products derived from ; this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE ; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ; POSSIBILITY OF SUCH DAMAGE. ; .686p .mmx .xmm .model flat, stdcall option casemap:none QWORD_STRUCT STRUCT _low DWORD ? _high DWORD ? QWORD_STRUCT ENDS VCPU_STATE_32 STRUCT _eax DWORD ? _pad0 DWORD ? _ecx DWORD ? _pad1 DWORD ? _edx DWORD ? _pad2 DWORD ? _ebx DWORD ? _pad3 DWORD ? _esp DWORD ? _pad4 DWORD ? _ebp DWORD ? _pad5 DWORD ? _esi DWORD ? _pad6 DWORD ? _edi DWORD ? _pad7 DWORD ? VCPU_STATE_32 ENDS INVEPT_DESC_32 STRUCT eptp DWORD ? pad1 DWORD 0 rsvd DWORD 0 pad2 DWORD 0 INVEPT_DESC_32 ENDS .data vmx_fail_mask word 41h ; .code start: __vmxon PROC public x:qword xor eax, eax vmxon x pushf pop ax and ax, vmx_fail_mask ret __vmxon ENDP __vmxoff PROC public xor eax, eax vmxoff pushf pop ax and ax, vmx_fail_mask ret __vmxoff ENDP __vmclear PROC public x:qword xor eax, eax vmclear x pushf pop ax and ax, vmx_fail_mask ret __vmclear ENDP __vmptrld PROC public x:qword xor eax, eax vmptrld x pushf pop ax and ax, vmx_fail_mask ret __vmptrld ENDP asm_vmptrst PROC public USES EAX x:ptr qword xor eax, eax mov eax, x vmptrst qword ptr [eax] pushf pop ax ret asm_vmptrst ENDP ia32_asm_vmread PROC public USES EBX x:dword xor eax, eax xor ebx, ebx mov ebx, x vmread eax, ebx ret ia32_asm_vmread ENDP ia32_asm_vmwrite PROC public USES EAX EBX x:dword, y:dword xor eax, eax xor ebx, ebx mov eax, x mov ebx, y vmwrite eax, ebx ret ia32_asm_vmwrite ENDP __vmx_run PROC public x:ptr VCPU_STATE_32, y:word pushfd push ecx push edx push esi push edi push ebp push eax push ebx ; write host rsp mov ebx, 6c14h mov eax, esp sub eax, 4h vmwrite ebx, eax pop ebx pop eax push eax push ebx ; push the state mov eax, x mov dx, y push eax cmp dx, 1h mov ecx, [eax].VCPU_STATE_32._ecx mov edx, [eax].VCPU_STATE_32._edx mov ebx, [eax].VCPU_STATE_32._ebx mov ebp, [eax].VCPU_STATE_32._ebp mov esi, [eax].VCPU_STATE_32._esi mov edi, [eax].VCPU_STATE_32._edi mov eax, [eax].VCPU_STATE_32._eax je RESUME vmlaunch jmp EXIT_ENTRY_FAIL RESUME: vmresume jmp EXIT_ENTRY_FAIL EXIT_ENTRY:: push edi mov edi, [esp+4] mov [edi].VCPU_STATE_32._eax, eax mov [edi].VCPU_STATE_32._ecx, ecx mov [edi].VCPU_STATE_32._edx, edx pop ecx mov [edi].VCPU_STATE_32._ebx, ebx mov [edi].VCPU_STATE_32._ebp, ebp mov [edi].VCPU_STATE_32._esi, esi mov [edi].VCPU_STATE_32._edi, ecx EXIT_ENTRY_FAIL: ; pop the state pop eax pop ebx pop eax pop ebp pop edi pop esi pop edx pop ecx pushfd pop eax popfd ret __vmx_run ENDP get_rip PROC public xor eax, eax lea eax, EXIT_ENTRY ret get_rip ENDP ; Unimplemented __invept PROC PUBLIC x:dword, y:ptr INVEPT_DESC_32 ; Just return an error or ax, vmx_fail_mask ret __invept ENDP end
oeis/135/A135732.asm
neoneye/loda-programs
11
175445
; A135732: Distances to next prime associated with A135731. ; Submitted by <NAME>(s4) ; 2,1,3,1,3,1,3,5,1,5,3,1,3,5,5,1,5,3,1,5,3,5,7,3,1,3,1,3,13,3,5,1,9,1,5,5,3,5,5,1,9,1,3,1,11,11,3,1,3,5,1,9,5,5,5,1,5,3,1,9,13,3,1,3,13,5,9,1,3,5,7,5,5,3,5,7,3,7,9,1,9,1,5,3,5,7,3,1,3,11,7,3,7,3,5,11 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 trn $0,1 seq $0,173064 ; a(n) = prime(n) - 5. add $0,3 mov $2,$3 mul $2,$0 add $1,$2 mov $4,$0 lpe min $5,1 mul $5,$4 sub $1,$5 mov $0,$1 sub $0,1
programs/oeis/126/A126281.asm
karttu/loda
0
25222
; A126281: a(n) is the least m to satisfy the requirements of A052130. ; 1,2,5,8,10,13,16,18,21,24,27,29,32,35,37,40,43,46,48,51,54,56,59,62,65,67,70,73 mov $2,$0 add $0,1 add $0,$2 mov $1,$2 add $1,$0 lpb $0,1 sub $0,6 trn $0,1 sub $1,1 lpe trn $1,2 add $1,1
FormalAnalyzer/models/meta/cap_thermostatFanMode.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
5164
// filename: cap_thermostatFanMode.als module cap_thermostatFanMode open IoTBottomUp one sig cap_thermostatFanMode extends Capability {} { attributes = cap_thermostatFanMode_attr } abstract sig cap_thermostatFanMode_attr extends Attribute {} one sig cap_thermostatFanMode_attr_thermostatFanMode extends cap_thermostatFanMode_attr {} { values = cap_thermostatFanMode_attr_thermostatFanMode_val } abstract sig cap_thermostatFanMode_attr_thermostatFanMode_val extends AttrValue {} one sig cap_thermostatFanMode_attr_thermostatFanMode_val_auto extends cap_thermostatFanMode_attr_thermostatFanMode_val {} one sig cap_thermostatFanMode_attr_thermostatFanMode_val_circulate extends cap_thermostatFanMode_attr_thermostatFanMode_val {} one sig cap_thermostatFanMode_attr_thermostatFanMode_val_followschedule extends cap_thermostatFanMode_attr_thermostatFanMode_val {} one sig cap_thermostatFanMode_attr_thermostatFanMode_val_on extends cap_thermostatFanMode_attr_thermostatFanMode_val {} one sig cap_thermostatFanMode_attr_supportedThermostatFanModes extends cap_thermostatFanMode_attr {} { values = cap_thermostatFanMode_attr_supportedThermostatFanModes_val } abstract sig cap_thermostatFanMode_attr_supportedThermostatFanModes_val extends AttrValue {}
Applications/TextEdit/windows/test.applescript
looking-for-a-job/applescript-examples
1
3738
#!/usr/bin/osascript tell application "TextEdit" repeat with w in windows w end repeat end tell
test/CPIR.asm
takamin/mz700-js
18
15183
ORG 1200H TESTCPIR: ENT LD HL,1400H LD BC,0010H LD A, 0FH CPIR LD A, 10H CP L JR Z,HLINCMATCH LD A, 0EH ;=='N' JR SHOWRESULT HLINCMATCH: ENT LD A, 19H ;=='Y' SHOWRESULT: ENT LD (D000H), A HALT ORG 1400H SEARCH: ENT DEFB 00H DEFB 01H DEFB 02H DEFB 03H DEFB 04H DEFB 05H DEFB 06H DEFB 07H DEFB 08H DEFB 09H DEFB 0AH DEFB 0BH DEFB 0CH DEFB 0DH DEFB 0EH DEFB 0FH
programs/oeis/084/A084505.asm
jmorken/loda
1
88490
; A084505: Partial sums of A084506. ; 0,1,3,5,8,11,14,17,20,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,124,129,134,139,144,149,154,159,164,169,174,179,184,189,194,199,204,209,214,219,224,229,234,239,244,249,254,259,264,269,274,279,284,289,294,299,304,309,314,319,324,329,334,339,344,349,354,359,364,369,374,379,384,389,394,399,404,409,414,419,424,429,434,439,444,449,454,459,464,469,474,479,484,489,494,499,504,509,514,519,524,529,534,539,544,549,554,559,564,569,574,579,584,589,594,599,605,611,617,623,629,635,641,647,653,659,665,671,677,683,689,695,701,707,713,719,725,731,737,743,749,755,761,767,773,779,785,791,797,803,809,815,821,827,833,839,845,851,857,863,869,875,881,887,893,899,905,911,917,923,929,935,941,947,953,959,965,971,977,983,989,995,1001,1007,1013,1019,1025,1031,1037,1043,1049,1055,1061,1067,1073,1079,1085,1091,1097,1103,1109,1115,1121,1127,1133,1139,1145,1151,1157,1163,1169,1175,1181,1187,1193,1199,1205,1211,1217,1223,1229,1235,1241,1247,1253,1259,1265,1271,1277,1283,1289,1295,1301,1307,1313,1319 mov $5,$0 mov $7,$0 lpb $7 mov $0,$5 sub $7,1 sub $0,$7 lpb $0 sub $0,1 trn $0,1 add $2,1 add $0,$2 log $0,4 mov $6,1 add $6,$0 bin $0,$4 mov $3,$6 lpe add $3,1 add $1,$3 lpe
src/coreclr/vm/arm64/crthelpers.asm
berkansasmaz/runtime
8
90828
<reponame>berkansasmaz/runtime ; Licensed to the .NET Foundation under one or more agreements. ; The .NET Foundation licenses this file to you under the MIT license. #include "ksarm64.h" #include "asmconstants.h" #include "asmmacros.h" IMPORT memset IMPORT memmove ; JIT_MemSet/JIT_MemCpy ; ; It is IMPORTANT that the exception handling code is able to find these guys ; on the stack, but on windows platforms we can just defer to the platform ; implementation. ; ; void JIT_MemSet(void* dest, int c, size_t count) ; ; Purpose: ; Sets the first "count" bytes of the block of memory pointed byte ; "dest" to the specified value (interpreted as an unsigned char). ; ; Entry: ; RCX: void* dest - Pointer to the block of memory to fill. ; RDX: int c - Value to be set. ; R8: size_t count - Number of bytes to be set to the value. ; ; Exit: ; ; Uses: ; ; Exceptions: ; TEXTAREA LEAF_ENTRY JIT_MemSet cbz x2, JIT_MemSet_ret ; check if count is zero, no bytes to set ldrb wzr, [x0] ; check dest for null b memset ; forward to the CRT implementation JIT_MemSet_ret ret lr LEAF_END_MARKED JIT_MemSet ; void JIT_MemCpy(void* dest, const void* src, size_t count) ; ; Purpose: ; Copies the values of "count" bytes from the location pointed to ; by "src" to the memory block pointed by "dest". ; ; Entry: ; RCX: void* dest - Pointer to the destination array where content is to be copied. ; RDX: const void* src - Pointer to the source of the data to be copied. ; R8: size_t count - Number of bytes to copy. ; ; Exit: ; ; Uses: ; ; Exceptions: ; LEAF_ENTRY JIT_MemCpy cbz x2, JIT_MemCpy_ret ; check if count is zero, no bytes to set ldrb wzr, [x0] ; check dest for null ldrb wzr, [x1] ; check src for null b memmove ; forward to the CRT implementation JIT_MemCpy_ret ret lr LEAF_END_MARKED JIT_MemCpy ; Must be at very end of file END
programs/oeis/138/A138183.asm
neoneye/loda
22
90089
<gh_stars>10-100 ; A138183: Smallest Fibonacci number not less than the n-th prime. ; 2,3,5,8,13,13,21,21,34,34,34,55,55,55,55,55,89,89,89,89,89,89,89,89,144,144,144,144,144,144,144,144,144,144,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,377,377 seq $0,40 ; The prime numbers. sub $0,2 seq $0,246104 ; Least m > 0 for which (s(m), ..., s(n+m-1) = (s(0), ..., s(n)), the first n+1 terms of the infinite Fibonacci word A003849.
programs/oeis/134/A134918.asm
neoneye/loda
22
174157
; A134918: Ceiling(n^(5/3)). ; 1,4,7,11,15,20,26,32,39,47,55,63,72,82,92,102,113,124,136,148,160,173,187,200,214,229,243,259,274,290,306,323,340,357,375,393,411,430,449,468,488,508,528,549,570,591,613,634,657,679,702,725,748,772,796,820,845,870,895,920,946,972,998,1024,1051,1078,1106,1133,1161,1189,1218,1247,1276,1305,1334,1364,1394,1424,1455,1486,1517,1548,1580,1612,1644,1676,1709,1742,1775,1808,1842,1875,1909,1944,1978,2013,2048,2084,2119,2155 add $0,1 pow $0,5 sub $0,1 seq $0,48766 ; Integer part of cube root of n. Or, number of cubes <= n. Or, n appears 3n^2 + 3n + 1 times. add $0,1
src/firmware/Platform/Flash.asm
pete-restall/Cluck2Sesame-Prototype
1
98568
<reponame>pete-restall/Cluck2Sesame-Prototype #include "Platform.inc" radix decimal Flash code global readFlashWordAsPairOfSevenBitBytes global readFlashWord readFlashWordAsPairOfSevenBitBytes: call readFlashWord .safelySetBankFor EEDAT rlf EEDAT, W rlf EEDATH, W bcf EEDAT, 7 return readFlashWord: .safelySetBankFor EECON1 bsf EECON1, EEPGD bsf EECON1, RD nop nop return end
Data/List/Kleene/Relation/Unary/All.agda
oisdk/agda-kleene-lists
0
2558
<reponame>oisdk/agda-kleene-lists module Data.List.Kleene.Relation.Unary.All where open import Data.List.Kleene.Base open import Relation.Unary open import Relation.Nullary open import Level using (_⊔_) open import Function mutual record All⁺ {a p} {A : Set a} (P : Pred A p) (xs : A ⁺) : Set (a ⊔ p) where constructor P⟨_&_⟩ inductive field P⟨head⟩ : P (head xs) P⟨tail⟩ : All⋆ P (tail xs) data All⋆ {a p} {A : Set a} (P : Pred A p) : Pred (A ⋆) (a ⊔ p) where P⟨[]⟩ : All⋆ P [] P⟨∹_⟩ : ∀ {xs} → All⁺ P xs → All⋆ P (∹ xs) open All⁺ public module _ {a p} {A : Set a} {P : Pred A p} where mutual all⋆ : Decidable P → Decidable (All⋆ P) all⋆ p? [] = yes P⟨[]⟩ all⋆ p? (∹ xs) with all⁺ p? xs all⋆ p? (∹ xs) | yes p = yes P⟨∹ p ⟩ all⋆ p? (∹ xs) | no ¬p = no λ { P⟨∹ x ⟩ → ¬p x } all⁺ : Decidable P → Decidable (All⁺ P) all⁺ p? xs with p? (head xs) | all⋆ p? (tail xs) all⁺ p? xs | no ¬p | ys = no (¬p ∘ P⟨head⟩) all⁺ p? xs | yes p | yes ps = yes P⟨ p & ps ⟩ all⁺ p? xs | yes p | no ¬p = no (¬p ∘ P⟨tail⟩)
Miscellaneous/Chip16-Emulator/roms/Sources/SongOfStorms.asm
ghivert/Student-Projects
2
6283
<gh_stars>1-10 ; Attempt at playing the Song Of Storms (LoZ:OoT) ; ; Melody: http://wiki.answers.com/Q/Piano_notes_for_legend_of_Zelda_song_of_storms ; Note frequencies: http://www.phy.mtu.edu/~suits/notefreqs.html ; ; tykel, 2012 S_WAIT equ 12 M_WAIT equ 20 L_WAIT equ 30 start: sng 0x64, 0x4246 ; Pulse, ADSR and volume loop: ldi r0, notes snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, L_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait addi r0, 2 snp r0, 0 ldi r1, S_WAIT call wait ldi r1, 45 call wait jmp loop wait: wait_loop: cmpi r1, 0 jz wait_end vblnk subi r1, 1 jmp wait_loop wait_end: snd0 ret ; Will be used when refchip16 works properly! notes: db 146,0, 174,0, 0x25,1, 146,0, 174,0, 0x25,1, 0x49,1, 0x5D,1, db 0x49,1, 0x5D,1, 0x49,1, 0x05,1, 220,0, 220,0, 146,0, 146,0, db 174,0, 220,0, 220,0, 146,0, 174,0, 196,0, 164,0
data/jpred4/jp_batch_1613899824__5qO6JIv/jp_batch_1613899824__5qO6JIv.als
jonriege/predict-protein-structure
0
5318
SILENT_MODE BLOCK_FILE jp_batch_1613899824__5qO6JIv.concise.blc MAX_NSEQ 70 MAX_INPUT_LEN 72 OUTPUT_FILE jp_batch_1613899824__5qO6JIv.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 46 59 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 60 46 69 H SPACE SUB_CHARS 1 60 46 69 E SPACE SUB_CHARS 1 60 46 69 - SPACE STRAND 13 63 16 COLOUR_TEXT_REGION 13 63 16 63 51 STRAND 33 63 34 COLOUR_TEXT_REGION 33 63 34 63 51 HELIX 9 63 12 COLOUR_TEXT_REGION 9 63 12 63 50 HELIX 23 63 28 COLOUR_TEXT_REGION 23 63 28 63 50 STRAND 13 68 17 COLOUR_TEXT_REGION 13 68 17 68 51 STRAND 33 68 34 COLOUR_TEXT_REGION 33 68 34 68 51 HELIX 7 68 12 COLOUR_TEXT_REGION 7 68 12 68 50 HELIX 23 68 29 COLOUR_TEXT_REGION 23 68 29 68 50 STRAND 33 69 35 COLOUR_TEXT_REGION 33 69 35 69 51 HELIX 10 69 15 COLOUR_TEXT_REGION 10 69 15 69 50 HELIX 23 69 27 COLOUR_TEXT_REGION 23 69 27 69 50
alloy4fun_models/trainstlt/models/8/6EXDDSXFeh7EzRhc9.als
Kaixi26/org.alloytools.alloy
0
355
open main pred id6EXDDSXFeh7EzRhc9_prop9 { always (all t:Train| eventually (no t.pos and after one t.pos:>Entry)) } pred __repair { id6EXDDSXFeh7EzRhc9_prop9 } check __repair { id6EXDDSXFeh7EzRhc9_prop9 <=> prop9o }
Named.agda
banacorn/lambda-calculus
0
11863
<filename>Named.agda module Named where open import Data.String open import Data.Nat hiding (_≟_) open import Data.Bool using (T; not) open import Data.Product open import Data.Sum -- open import Data.Nat.Properties using (strictTotalOrder) -- open import Relation.Binary using (StrictTotalOrder) -- open import Relation.Binary.Core open import Function using (id) open import Function.Equivalence using (_⇔_; equivalence) open import Relation.Nullary open import Relation.Unary open import Relation.Nullary.Negation open import Data.Unit using (⊤) open import Function using (_∘_) -- open import Level renaming (zero to Lzero) open import Relation.Binary.PropositionalEquality -- open ≡-Reasoning -- open ≡-Reasoning -- renaming (begin_ to beginEq_; _≡⟨_⟩_ to _≡Eq⟨_⟩_; _∎ to _∎Eq) open import Data.Collection open import Data.Collection.Properties open import Data.Collection.Equivalence open import Data.Collection.Inclusion open import Relation.Binary.PartialOrderReasoning ⊆-Poset Variable = String data PreTerm : Set where Var : (w : Variable) → PreTerm App : (P : PreTerm) → (Q : PreTerm) → PreTerm Abs : (w : Variable) → (Q : PreTerm) → PreTerm showPreTerm : PreTerm → String showPreTerm (Var x) = x showPreTerm (App P Q) = "(" ++ showPreTerm P ++ " " ++ showPreTerm Q ++ ")" showPreTerm (Abs x M) = "(λ" ++ x ++ "." ++ showPreTerm M ++ ")" I : PreTerm I = Abs "x" (Var "x") S : PreTerm S = Abs "x" (App (Var "y") (Var "x")) FV : PreTerm → Collection FV (Var x ) = singleton x FV (App f x) = union (FV f) (FV x) FV (Abs x m) = delete x (FV m) -- a = singleton "x" ∋ (elem "x" ∪ elem "y") -- b = C[ singleton "x" ] ∩ C[ singleton "x" ] -- M = FV S -- neither∈ : ∀ {x A B} → x ∉ C[ A union B ] → _[_≔_] : PreTerm → Variable → PreTerm → PreTerm Var x [ v ≔ N ] with x ≟ v Var x [ v ≔ N ] | yes p = N Var x [ v ≔ N ] | no ¬p = Var x App P Q [ v ≔ N ] = App (P [ v ≔ N ]) (Q [ v ≔ N ]) Abs x P [ v ≔ N ] with x ≟ v Abs x P [ v ≔ N ] | yes p = Abs v P Abs x P [ v ≔ N ] | no ¬p = Abs x (P [ v ≔ N ]) -- If v ∉ FV(M) then M[v≔N] is defined and M[v≔N] ≡ M lem-1-2-5-a : ∀ M N v → v ∉ c[ FV M ] → M [ v ≔ N ] ≡ M lem-1-2-5-a (Var x) N v v∉M with x ≟ v lem-1-2-5-a (Var x) N .x v∉M | yes refl = contradiction here v∉M lem-1-2-5-a (Var x) N v v∉M | no ¬p = refl lem-1-2-5-a (App P Q) N v v∉M = cong₂ App (lem-1-2-5-a P N v (not-in-left-union (FV P) (FV Q) v∉M)) (lem-1-2-5-a Q N v (not-in-right-union (FV P) (FV Q) v∉M)) lem-1-2-5-a (Abs x M) N v v∉M with x ≟ v lem-1-2-5-a (Abs x M) N v v∉M | yes p = cong (λ z → Abs z M) (sym p) lem-1-2-5-a (Abs x M) N v v∉M | no ¬p = cong (Abs x) (lem-1-2-5-a M N v (still-∉-after-recovered x (FV M) ¬p v∉M)) -- begin -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ∎ -- begin -- {! !} -- ≤⟨ {! !} ⟩ -- {! !} -- ≤⟨ {! !} ⟩ -- {! !} -- ∎ -- If M[v≔N] is defined, v ≠ x and x ∈ FV(M) iff x ∈ FV(M[v≔N]) lem-1-2-5-b-i : ∀ {v N} M → c[ FV M ] ≋[ _≢_ v ] c[ FV (M [ v ≔ N ]) ] lem-1-2-5-b-i {v} {N} M v≢x = equivalence (to M v≢x) (from M v≢x) where to : ∀ {v N} M → c[ FV M ] ⊆[ _≢_ v ] c[ FV (M [ v ≔ N ]) ] to {v} (Var w) v≢x ∈FV-M with w ≟ v to (Var w) v≢x ∈FV-M | yes p = contradiction (sym (trans (nach singleton-≡ ∈FV-M) p)) v≢x to (Var w) v≢x ∈FV-M | no ¬p = ∈FV-M to {v} {N} (App P Q) v≢x = begin c[ union (FV P) (FV Q) ] ≤⟨ union-monotone {! !} {! !} {! !} ⟩ {! !} ≤⟨ {! !} ⟩ {! !} ≤⟨ {! !} ⟩ {! !} ≤⟨ {! !} ⟩ {! !} ≤⟨ {! !} ⟩ c[ union (FV (P [ v ≔ N ])) (FV (Q [ v ≔ N ])) ] ∎ to (Abs w M) v≢x ∈FV-M = {! !} -- to (Var w) ∈FV-M with w ≟ v -- to (Var w) ∈FV-M | yes p = contradiction (sym (trans (nach singleton-≡ ∈FV-M) p)) v≢x -- to (Var w) ∈FV-M | no ¬p = ∈FV-M -- to (App P Q) = begin -- c[ union (FV P) (FV Q) ] -- ≤⟨ union-monotone {! !} {! !} {! !} ⟩ -- {! !} -- ≤⟨ {! !} ⟩ -- {! !} -- ≤⟨ {! !} ⟩ -- c[ union (FV (P [ v ≔ N ])) (FV (Q [ v ≔ N ])) ] -- ∎ -- to (Abs w M) ∈FV-M = {! !} from : ∀ {v N} M → c[ FV (M [ v ≔ N ]) ] ⊆[ _≢_ v ] c[ FV M ] from M = {! !} -- lem-1-2-5-b-i : ∀ {x v N} M → v ≢ x → x ∈ c[ FV M ] ⇔ x ∈ c[ FV (M [ v ≔ N ]) ] -- lem-1-2-5-b-i {x} {v} {N} (Var w) v≢x with w ≟ v -- x ≡ w -- lem-1-2-5-b-i {x} {v} {N} (Var w) v≢x | yes p = -- equivalence -- (λ ∈[w] → contradiction (sym (trans (nach singleton-≡ ∈[w]) p)) v≢x) -- from -- where to : x ∈ c[ w ∷ [] ] → x ∈ c[ FV N ] -- to ∈[w] = {! !} -- from : x ∈ c[ FV N ] → x ∈ c[ w ∷ [] ] -- x ∈ c[ FV (N [ v ≔ N ]) ] -- from ∈FV-N = {! !} -- lem-1-2-5-b-i {x} {v} {N} (Var w) v≢x | no ¬p = equivalence id id -- lem-1-2-5-b-i {x} {v} {N} (App P Q) v≢x = equivalence to {! !} -- where to : c[ union (FV P) (FV Q) ] ⊆ c[ union (FV (P [ v ≔ N ])) (FV (Q [ v ≔ N ])) ] -- to = map-⊆-union {FV P} {FV Q} {FV (P [ v ≔ N ])} {FV (Q [ v ≔ N ])} (_≢_ v) {! !} {! !} {! !} -- -- -- lem-1-2-5-b-i (Abs w M) v≢x = {! !} -- lem-1-2-5-b-i : ∀ {x v N} M → v ≢ x → (x ∈ FV M) ⇔ (x ∈ FV (M [ v ≔ N ])) -- lem-1-2-5-b-i : ∀ {x v N} M → v ≢ x → (x ∈ FV M) ≡ (x ∈ FV (M [ v ≔ N ])) -- lem-1-2-5-b-i : ∀ {x v N} M → v ≢ x → (x ∈ c[ FV M ]) ≡ (x ∈ c[ FV (M [ v ≔ N ]) ]) -- lem-1-2-5-b-i {v = v} (Var w) v≢x with w ≟ v -- lem-1-2-5-b-i (Var v) v≢x | yes refl = {! !} -- lem-1-2-5-b-i {x} (Var w) v≢x | no ¬p = refl -- cong (_∈_ x) refl -- lem-1-2-5-b-i {x} {v} {N} (App P Q) v≢x = -- begin -- x ∈ c[ union (FV P) (FV Q) ] -- ≡⟨ sym {! ∪-union !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- x ∈ c[ union (FV (P [ v ≔ N ])) (FV (Q [ v ≔ N ])) ] -- ∎ -- lem-1-2-5-b-i (Abs w P) v≢x = {! !} -- lem-1-2-5-b-i {v = v} (Var w) v≢x x∈FV-M with w ≟ v -- lem-1-2-5-b-i (Var w) v≢x x∈FV-M | yes p = ? -- contradiction (trans (singleton-≡ x∈FV-M) p) (v≢x ∘ sym) -- lem-1-2-5-b-i (Var w) v≢x x∈FV-M | no ¬p = ? -- x∈FV-M -- lem-1-2-5-b-i (App P Q) v≢x x∈FV-M = ? -- ∈-respects-≡ {! !} x∈FV-M -- lem-1-2-5-b-i (App P Q) v≢x x∈FV-M = ∈-respects-≡ (cong₂ union (cong FV {! !}) (cong FV {! !})) x∈FV-M -- lem-1-2-5-b-i (App P Q) v≢x x∈FV-M = ∈-respects-≡ (cong₂ union ({! !}) {! !}) x∈FV-M -- lem-1-2-5-b-i (Abs w P) v≢x x∈FV-M = {! !} -- If M[v≔N] is defined then y ∈ FV(M[v≔N]) iff either y ∈ FV(M) and v ≠ y -- or y ∈ FV(N) and x ∈ FV(M) -- lem-1-2-5-b-i : ∀ {x y N} M v → y ∈ FV (M [ v ≔ N ]) → y ∈ FV M × x ≢ y ⊎ y ∈ FV N × x ∈ FV M -- lem-1-2-5-b⇒ (Var w) v y∈Applied with w ≟ v -- lem-1-2-5-b⇒ (Var w) v y∈Applied | yes p = {! !} -- lem-1-2-5-b⇒ (Var w) v y∈Applied | no ¬p = inj₁ (y∈Applied , {! singleton-≡ ∈ !}) -- lem-1-2-5-b⇒ (App P Q) v y∈Applied = {! !} -- lem-1-2-5-b⇒ (Abs w P) v y∈Applied = {! !} -- -- lem-1-2-5-b⇐ : ∀ {x y v M N} → y ∈ FV M × x ≢ y ⊎ y ∈ FV N × x ∈ FV M → y ∈ FV (M [ v ≔ N ]) -- lem-1-2-5-b⇐ = {! !} lem-1-2-5-c : (M : PreTerm) → (x : Variable) → M [ x ≔ Var x ] ≡ M lem-1-2-5-c (Var x ) y with x ≟ y lem-1-2-5-c (Var x ) y | yes p = sym (cong Var p) lem-1-2-5-c (Var x ) y | no ¬p = refl lem-1-2-5-c (App P Q) y = cong₂ App (lem-1-2-5-c P y) (lem-1-2-5-c Q y) lem-1-2-5-c (Abs x M) y with x ≟ y lem-1-2-5-c (Abs x M) y | yes p = cong (λ w → Abs w M) (sym p) lem-1-2-5-c (Abs x M) y | no ¬p = cong (Abs x) (lem-1-2-5-c M y) length : PreTerm → ℕ length (Var x) = 1 length (App P Q) = length P + length Q length (Abs x M) = 1 + length M -- lem-1-2-5-c : (M : PreTerm) → (x : Variable) → (N : PreTerm) → T (not (x ∈? FV M)) → M [ x ≔ N ] ≡ M -- lem-1-2-5-c (Var x') x N x∉M with x' ≟ x -- lem-1-2-5-c (Var x') x N x∉M | yes p = -- begin -- N -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- Var x' -- ∎ -- lem-1-2-5-c (Var x') x N x∉M | no ¬p = {! !} -- lem-1-2-5-c (App P Q) x N x∉M = -- begin -- App (P [ x ≔ N ]) (Q [ x ≔ N ]) -- ≡⟨ refl ⟩ -- App P Q [ x ≔ N ] -- ≡⟨ {! !} ⟩ -- App P Q -- ∎ -- lem-1-2-5-c (Abs x' M) x N x∉M = {! !} -- begin -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ∎
src/tileSheet_dialog_7x8.asm
dma-homebrew/dhgr
4
101656
;----------------------------------------------------------------------------- ; <NAME> - 2021 ;----------------------------------------------------------------------------- ; Example 7x8 DHGR Tile Sheet ;----------------------------------------------------------------------------- .align 256 tileSheet_7x8: ; FAT FONT (Inverse) ; @ (dot) .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$6A,$55,$7F,$7F,$6A,$55,$7F .byte $7F,$6A,$55,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; A .byte $7F,$70,$07,$7F,$3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78 .byte $0F,$00,$00,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$7F,$7F,$7F,$7F ; B .byte $0F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E,$7F,$7F,$7F,$7F ; C .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F .byte $0F,$7F,$60,$7F,$0F,$03,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; D .byte $0F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78 .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E,$7F,$7F,$7F,$7F ; E .byte $0F,$00,$00,$78,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$40,$00,$7F .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$00,$00,$78,$7F,$7F,$7F,$7F ; F .byte $0F,$00,$00,$78,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$40,$00,$7F .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$7F,$7F,$7F,$7F ; G .byte $3F,$00,$00,$7E,$0F,$3F,$60,$78,$0F,$7F,$60,$7F,$0F,$03,$60,$78 .byte $0F,$3F,$60,$78,$0F,$3F,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; H .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$78 .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$7F,$7F,$7F,$7F ; I .byte $3F,$00,$00,$7E,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; J .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$03,$7F,$78 .byte $0F,$03,$60,$78,$0F,$00,$00,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; K .byte $0F,$0F,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E,$0F,$40,$00,$7F .byte $0F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$0F,$60,$78,$7F,$7F,$7F,$7F ; L .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$00,$00,$78,$7F,$7F,$7F,$7F ; M .byte $0F,$0F,$78,$78,$0F,$03,$60,$78,$0F,$00,$00,$78,$0F,$00,$00,$78 .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$7F,$7F,$7F,$7F ; N .byte $0F,$03,$78,$78,$0F,$03,$60,$78,$0F,$03,$00,$78,$0F,$00,$00,$78 .byte $0F,$00,$60,$78,$0F,$03,$60,$78,$0F,$0F,$60,$78,$7F,$7F,$7F,$7F ; O .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$0F,$78,$78,$0F,$0F,$78,$78 .byte $0F,$0F,$78,$78,$0F,$03,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; P .byte $0F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$7F,$7F,$7F,$7F ; Q .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$0F,$78,$78,$0F,$0F,$78,$78 .byte $0F,$0F,$78,$78,$0F,$43,$60,$7F,$3F,$3C,$00,$78,$7F,$7F,$7F,$7F ; R .byte $0F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$7E .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$7F,$7F,$7F,$7F ; S .byte $3F,$00,$00,$78,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$3F,$00,$00,$7E .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$0F,$00,$00,$7E,$7F,$7F,$7F,$7F ; T .byte $0F,$00,$00,$78,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; U .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78 .byte $0F,$03,$60,$78,$0F,$00,$00,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; V .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78 .byte $3F,$00,$00,$7E,$7F,$70,$07,$7F,$7F,$7C,$1F,$7F,$7F,$7F,$7F,$7F ; W .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$78 .byte $0F,$00,$00,$78,$0F,$03,$60,$78,$0F,$0F,$78,$78,$7F,$7F,$7F,$7F ; X .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$03,$60,$7E,$7F,$70,$07,$7F .byte $3F,$03,$60,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$7F,$7F,$7F,$7F ; Y .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$03,$60,$7E,$3F,$00,$00,$7E .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; Z .byte $0F,$00,$00,$78,$7F,$0F,$7F,$78,$7F,$00,$7F,$7E,$7F,$70,$07,$7F .byte $3F,$7F,$00,$7F,$0F,$7F,$78,$7F,$0F,$00,$00,$78,$7F,$7F,$7F,$7F ; [ .byte $0F,$40,$00,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$40,$00,$7F,$7F,$7F,$7F,$7F ; \ .byte $0F,$7F,$60,$7F,$3F,$7F,$00,$7F,$7F,$7C,$01,$7F,$7F,$70,$07,$7F .byte $7F,$40,$1F,$7F,$7F,$00,$7F,$7E,$7F,$03,$7F,$78,$7F,$7F,$7F,$7F ; ] .byte $0F,$40,$00,$7F,$7F,$40,$1F,$7F,$7F,$40,$1F,$7F,$7F,$40,$1F,$7F .byte $7F,$40,$1F,$7F,$7F,$40,$1F,$7F,$0F,$40,$00,$7F,$7F,$7F,$7F,$7F ; ^ .byte $7F,$7F,$7F,$7F,$7F,$7C,$1F,$7F,$7F,$70,$07,$7F,$7F,$43,$61,$7F .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; _ .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$0F,$00,$00,$78,$7F,$7F,$7F,$7F ; sp .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; ! .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F .byte $7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; " .byte $7F,$43,$61,$7F,$7F,$43,$61,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; # .byte $7F,$7F,$7F,$7F,$7F,$43,$61,$7F,$0F,$00,$00,$78,$7F,$43,$61,$7F .byte $0F,$00,$00,$78,$7F,$43,$61,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; $ .byte $7F,$7C,$1F,$7F,$3F,$00,$00,$7E,$0F,$7C,$1E,$7F,$3F,$00,$00,$7E .byte $7F,$3C,$1F,$78,$3F,$00,$00,$7E,$7F,$7C,$1F,$7F,$7F,$7F,$7F,$7F ; % .byte $0F,$03,$7E,$78,$0F,$00,$7E,$7E,$7F,$40,$1F,$7F,$7F,$70,$07,$7F .byte $7F,$7C,$01,$7F,$3F,$3F,$00,$78,$0F,$3F,$60,$78,$7F,$7F,$7F,$7F ; & .byte $7F,$7C,$1F,$7F,$7F,$43,$61,$7F,$7F,$43,$61,$7F,$0F,$7C,$1E,$7F .byte $0F,$43,$7E,$7F,$0F,$03,$7E,$7E,$7F,$3C,$01,$78,$7F,$7F,$7F,$7F ; ' .byte $7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; ( .byte $7F,$70,$07,$7F,$7F,$7C,$01,$7F,$7F,$7C,$01,$7F,$7F,$7C,$01,$7F .byte $7F,$7C,$01,$7F,$7F,$7C,$01,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; ) .byte $7F,$70,$07,$7F,$7F,$40,$1F,$7F,$7F,$40,$1F,$7F,$7F,$40,$1F,$7F .byte $7F,$40,$1F,$7F,$7F,$40,$1F,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; * .byte $7F,$7F,$7F,$7F,$0F,$3C,$1E,$78,$7F,$40,$01,$7F,$0F,$00,$00,$78 .byte $7F,$40,$01,$7F,$0F,$3C,$1E,$78,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; + .byte $7F,$7F,$7F,$7F,$7F,$7C,$1F,$7F,$7F,$7C,$1F,$7F,$3F,$00,$00,$7E .byte $7F,$7C,$1F,$7F,$7F,$7C,$1F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; , .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$70,$1F,$7F,$7F,$7C,$07,$7F,$7F,$7F,$7F,$7F ; - .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$3F,$00,$00,$7E .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; . .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F .byte $7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; / .byte $7F,$03,$7F,$78,$7F,$00,$7F,$7E,$7F,$40,$1F,$7F,$7F,$70,$07,$7F .byte $7F,$7C,$01,$7F,$3F,$7F,$00,$7F,$0F,$7F,$60,$7F,$7F,$7F,$7F,$7F ; 0 .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78 .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 1 .byte $7F,$70,$07,$7F,$7F,$70,$01,$7F,$3F,$70,$00,$7F,$7F,$70,$07,$7F .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 2 .byte $0F,$00,$00,$7E,$7F,$03,$7F,$78,$7F,$03,$7F,$78,$3F,$00,$00,$7E .byte $0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$00,$00,$78,$7F,$7F,$7F,$7F ; 3 .byte $0F,$00,$00,$7E,$7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$00,$01,$7E .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$0F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 4 .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$03,$60,$78,$0F,$00,$00,$78 .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$7F,$7F,$7F ; 5 .byte $0F,$00,$00,$78,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$00,$00,$7E .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$0F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 6 .byte $3F,$00,$00,$7E,$0F,$7F,$60,$7F,$0F,$7F,$60,$7F,$0F,$00,$00,$7E .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 7 .byte $0F,$00,$00,$78,$7F,$03,$7F,$78,$7F,$03,$7F,$78,$7F,$00,$7F,$7E .byte $7F,$40,$1F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F ; 8 .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$00,$00,$7E .byte $0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; 9 .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$0F,$03,$60,$78,$3F,$00,$00,$78 .byte $7F,$03,$7F,$78,$7F,$03,$7F,$78,$3F,$00,$00,$7E,$7F,$7F,$7F,$7F ; : .byte $7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; ; .byte $7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F .byte $7F,$70,$07,$7F,$7F,$70,$07,$7F,$7F,$7C,$01,$7F,$7F,$7F,$7F,$7F ; < .byte $7F,$40,$1F,$7F,$7F,$70,$07,$7F,$7F,$7C,$01,$7F,$3F,$7F,$00,$7F .byte $7F,$7C,$01,$7F,$7F,$70,$07,$7F,$7F,$40,$1F,$7F,$7F,$7F,$7F,$7F ; = .byte $7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$40,$01,$7F,$7F,$7F,$7F,$7F .byte $7F,$40,$01,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F,$7F ; > .byte $7F,$7C,$01,$7F,$7F,$70,$07,$7F,$7F,$40,$1F,$7F,$7F,$00,$7F,$7E .byte $7F,$40,$1F,$7F,$7F,$70,$07,$7F,$7F,$7C,$01,$7F,$7F,$7F,$7F,$7F ; ? .byte $3F,$00,$00,$7E,$0F,$03,$60,$78,$7F,$00,$7F,$7E,$7F,$40,$1F,$7F .byte $7F,$70,$07,$7F,$7F,$7F,$7F,$7F,$7F,$70,$07,$7F,$7F,$7F,$7F,$7F
regtests/asf-lifecycles-tests.ads
jquorning/ada-asf
12
26095
----------------------------------------------------------------------- -- asf-lifecycles-tests - Tests for ASF lifecycles -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with ASF.Events.Phases; package ASF.Lifecycles.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Initialize the test application overriding procedure Set_Up (T : in out Test); -- Test a GET request and the lifecycles that this implies. procedure Test_Get_Lifecycle (T : in out Test); -- Test a GET+POST request with submitted values and an action method called on the bean. procedure Test_Post_Lifecycle (T : in out Test); type Phase_Counters is array (ASF.Events.Phases.Phase_Type) of Natural; type Phase_Counters_Array is access all Phase_Counters; -- A phase listener used to count the number of calls made to Before/After phase -- in various configurations. The phase listener is a readonly instance because it is -- shared by multiple concurrent requests. For the test, we have to use indirect -- access to update the counters. type Test_Phase_Listener is new Ada.Finalization.Limited_Controlled and ASF.Events.Phases.Phase_Listener with record Before_Count : Phase_Counters_Array := null; After_Count : Phase_Counters_Array := null; Phase : ASF.Events.Phases.Phase_Type := ASF.Events.Phases.ANY_PHASE; end record; -- Check that the RESTORE_VIEW and RENDER_RESPONSE counters have the given value. procedure Check_Get_Counters (Listener : in Test_Phase_Listener; T : in out Test'Class; Value : in Natural); -- Check that the APPLY_REQUESTS .. INVOKE_APPLICATION counters have the given value. procedure Check_Post_Counters (Listener : in Test_Phase_Listener; T : in out Test'Class; Value : in Natural); -- Notifies that the lifecycle phase described by the event is about to begin. overriding procedure Before_Phase (Listener : in Test_Phase_Listener; Event : in ASF.Events.Phases.Phase_Event'Class); -- Notifies that the lifecycle phase described by the event has finished. overriding procedure After_Phase (Listener : in Test_Phase_Listener; Event : in ASF.Events.Phases.Phase_Event'Class); -- Return the phase that this listener is interested in processing the <b>Phase_Event</b> -- events. If the listener is interested by several events, it should return <b>ANY_PHASE</b>. overriding function Get_Phase (Listener : in Test_Phase_Listener) return ASF.Events.Phases.Phase_Type; overriding procedure Initialize (Listener : in out Test_Phase_Listener); overriding procedure Finalize (Listener : in out Test_Phase_Listener); end ASF.Lifecycles.Tests;
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-swmwco.ads
orb-zhuchen/Orb
0
27188
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . W I D E _ M A P S . W I D E _ C O N S T A N T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Wide_Latin_1; package Ada.Strings.Wide_Maps.Wide_Constants is pragma Preelaborate; Control_Set : constant Wide_Maps.Wide_Character_Set; Graphic_Set : constant Wide_Maps.Wide_Character_Set; Letter_Set : constant Wide_Maps.Wide_Character_Set; Lower_Set : constant Wide_Maps.Wide_Character_Set; Upper_Set : constant Wide_Maps.Wide_Character_Set; Basic_Set : constant Wide_Maps.Wide_Character_Set; Decimal_Digit_Set : constant Wide_Maps.Wide_Character_Set; Hexadecimal_Digit_Set : constant Wide_Maps.Wide_Character_Set; Alphanumeric_Set : constant Wide_Maps.Wide_Character_Set; Special_Graphic_Set : constant Wide_Maps.Wide_Character_Set; ISO_646_Set : constant Wide_Maps.Wide_Character_Set; Character_Set : constant Wide_Maps.Wide_Character_Set; Lower_Case_Map : constant Wide_Maps.Wide_Character_Mapping; -- Maps to lower case for letters, else identity Upper_Case_Map : constant Wide_Maps.Wide_Character_Mapping; -- Maps to upper case for letters, else identity Basic_Map : constant Wide_Maps.Wide_Character_Mapping; -- Maps to basic letter for letters, else identity private package W renames Ada.Characters.Wide_Latin_1; subtype WC is Wide_Character; Control_Ranges : aliased constant Wide_Character_Ranges := ((W.NUL, W.US), (W.DEL, W.APC)); Control_Set : constant Wide_Character_Set := (AF.Controlled with Control_Ranges'Unrestricted_Access); Graphic_Ranges : aliased constant Wide_Character_Ranges := ((W.Space, W.Tilde), (WC'Val (256), WC'Last)); Graphic_Set : constant Wide_Character_Set := (AF.Controlled with Graphic_Ranges'Unrestricted_Access); Letter_Ranges : aliased constant Wide_Character_Ranges := (('A', 'Z'), (W.LC_A, W.LC_Z), (W.UC_A_Grave, W.UC_O_Diaeresis), (W.UC_O_Oblique_Stroke, W.LC_O_Diaeresis), (W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis)); Letter_Set : constant Wide_Character_Set := (AF.Controlled with Letter_Ranges'Unrestricted_Access); Lower_Ranges : aliased constant Wide_Character_Ranges := (1 => (W.LC_A, W.LC_Z), 2 => (W.LC_German_Sharp_S, W.LC_O_Diaeresis), 3 => (W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis)); Lower_Set : constant Wide_Character_Set := (AF.Controlled with Lower_Ranges'Unrestricted_Access); Upper_Ranges : aliased constant Wide_Character_Ranges := (1 => ('A', 'Z'), 2 => (W.UC_A_Grave, W.UC_O_Diaeresis), 3 => (W.UC_O_Oblique_Stroke, W.UC_Icelandic_Thorn)); Upper_Set : constant Wide_Character_Set := (AF.Controlled with Upper_Ranges'Unrestricted_Access); Basic_Ranges : aliased constant Wide_Character_Ranges := (1 => ('A', 'Z'), 2 => (W.LC_A, W.LC_Z), 3 => (W.UC_AE_Diphthong, W.UC_AE_Diphthong), 4 => (W.LC_AE_Diphthong, W.LC_AE_Diphthong), 5 => (W.LC_German_Sharp_S, W.LC_German_Sharp_S), 6 => (W.UC_Icelandic_Thorn, W.UC_Icelandic_Thorn), 7 => (W.LC_Icelandic_Thorn, W.LC_Icelandic_Thorn), 8 => (W.UC_Icelandic_Eth, W.UC_Icelandic_Eth), 9 => (W.LC_Icelandic_Eth, W.LC_Icelandic_Eth)); Basic_Set : constant Wide_Character_Set := (AF.Controlled with Basic_Ranges'Unrestricted_Access); Decimal_Digit_Ranges : aliased constant Wide_Character_Ranges := (1 => ('0', '9')); Decimal_Digit_Set : constant Wide_Character_Set := (AF.Controlled with Decimal_Digit_Ranges'Unrestricted_Access); Hexadecimal_Digit_Ranges : aliased constant Wide_Character_Ranges := (1 => ('0', '9'), 2 => ('A', 'F'), 3 => (W.LC_A, W.LC_F)); Hexadecimal_Digit_Set : constant Wide_Character_Set := (AF.Controlled with Hexadecimal_Digit_Ranges'Unrestricted_Access); Alphanumeric_Ranges : aliased constant Wide_Character_Ranges := (1 => ('0', '9'), 2 => ('A', 'Z'), 3 => (W.LC_A, W.LC_Z), 4 => (W.UC_A_Grave, W.UC_O_Diaeresis), 5 => (W.UC_O_Oblique_Stroke, W.LC_O_Diaeresis), 6 => (W.LC_O_Oblique_Stroke, W.LC_Y_Diaeresis)); Alphanumeric_Set : constant Wide_Character_Set := (AF.Controlled with Alphanumeric_Ranges'Unrestricted_Access); Special_Graphic_Ranges : aliased constant Wide_Character_Ranges := (1 => (Wide_Space, W.Solidus), 2 => (W.Colon, W.Commercial_At), 3 => (W.Left_Square_Bracket, W.Grave), 4 => (W.Left_Curly_Bracket, W.Tilde), 5 => (W.No_Break_Space, W.Inverted_Question), 6 => (W.Multiplication_Sign, W.Multiplication_Sign), 7 => (W.Division_Sign, W.Division_Sign)); Special_Graphic_Set : constant Wide_Character_Set := (AF.Controlled with Special_Graphic_Ranges'Unrestricted_Access); ISO_646_Ranges : aliased constant Wide_Character_Ranges := (1 => (W.NUL, W.DEL)); ISO_646_Set : constant Wide_Character_Set := (AF.Controlled with ISO_646_Ranges'Unrestricted_Access); Character_Ranges : aliased constant Wide_Character_Ranges := (1 => (W.NUL, WC'Val (255))); Character_Set : constant Wide_Character_Set := (AF.Controlled with Character_Ranges'Unrestricted_Access); Lower_Case_Mapping : aliased constant Wide_Character_Mapping_Values := (Length => 56, Domain => "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & W.UC_A_Grave & W.UC_A_Acute & W.UC_A_Circumflex & W.UC_A_Tilde & W.UC_A_Diaeresis & W.UC_A_Ring & W.UC_AE_Diphthong & W.UC_C_Cedilla & W.UC_E_Grave & W.UC_E_Acute & W.UC_E_Circumflex & W.UC_E_Diaeresis & W.UC_I_Grave & W.UC_I_Acute & W.UC_I_Circumflex & W.UC_I_Diaeresis & W.UC_Icelandic_Eth & W.UC_N_Tilde & W.UC_O_Grave & W.UC_O_Acute & W.UC_O_Circumflex & W.UC_O_Tilde & W.UC_O_Diaeresis & W.UC_O_Oblique_Stroke & W.UC_U_Grave & W.UC_U_Acute & W.UC_U_Circumflex & W.UC_U_Diaeresis & W.UC_Y_Acute & W.UC_Icelandic_Thorn, Rangev => "abcdefghijklmnopqrstuvwxyz" & W.LC_A_Grave & W.LC_A_Acute & W.LC_A_Circumflex & W.LC_A_Tilde & W.LC_A_Diaeresis & W.LC_A_Ring & W.LC_AE_Diphthong & W.LC_C_Cedilla & W.LC_E_Grave & W.LC_E_Acute & W.LC_E_Circumflex & W.LC_E_Diaeresis & W.LC_I_Grave & W.LC_I_Acute & W.LC_I_Circumflex & W.LC_I_Diaeresis & W.LC_Icelandic_Eth & W.LC_N_Tilde & W.LC_O_Grave & W.LC_O_Acute & W.LC_O_Circumflex & W.LC_O_Tilde & W.LC_O_Diaeresis & W.LC_O_Oblique_Stroke & W.LC_U_Grave & W.LC_U_Acute & W.LC_U_Circumflex & W.LC_U_Diaeresis & W.LC_Y_Acute & W.LC_Icelandic_Thorn); Lower_Case_Map : constant Wide_Character_Mapping := (AF.Controlled with Map => Lower_Case_Mapping'Unrestricted_Access); Upper_Case_Mapping : aliased constant Wide_Character_Mapping_Values := (Length => 56, Domain => "abcdefghijklmnopqrstuvwxyz" & W.LC_A_Grave & W.LC_A_Acute & W.LC_A_Circumflex & W.LC_A_Tilde & W.LC_A_Diaeresis & W.LC_A_Ring & W.LC_AE_Diphthong & W.LC_C_Cedilla & W.LC_E_Grave & W.LC_E_Acute & W.LC_E_Circumflex & W.LC_E_Diaeresis & W.LC_I_Grave & W.LC_I_Acute & W.LC_I_Circumflex & W.LC_I_Diaeresis & W.LC_Icelandic_Eth & W.LC_N_Tilde & W.LC_O_Grave & W.LC_O_Acute & W.LC_O_Circumflex & W.LC_O_Tilde & W.LC_O_Diaeresis & W.LC_O_Oblique_Stroke & W.LC_U_Grave & W.LC_U_Acute & W.LC_U_Circumflex & W.LC_U_Diaeresis & W.LC_Y_Acute & W.LC_Icelandic_Thorn, Rangev => "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & W.UC_A_Grave & W.UC_A_Acute & W.UC_A_Circumflex & W.UC_A_Tilde & W.UC_A_Diaeresis & W.UC_A_Ring & W.UC_AE_Diphthong & W.UC_C_Cedilla & W.UC_E_Grave & W.UC_E_Acute & W.UC_E_Circumflex & W.UC_E_Diaeresis & W.UC_I_Grave & W.UC_I_Acute & W.UC_I_Circumflex & W.UC_I_Diaeresis & W.UC_Icelandic_Eth & W.UC_N_Tilde & W.UC_O_Grave & W.UC_O_Acute & W.UC_O_Circumflex & W.UC_O_Tilde & W.UC_O_Diaeresis & W.UC_O_Oblique_Stroke & W.UC_U_Grave & W.UC_U_Acute & W.UC_U_Circumflex & W.UC_U_Diaeresis & W.UC_Y_Acute & W.UC_Icelandic_Thorn); Upper_Case_Map : constant Wide_Character_Mapping := (AF.Controlled with Upper_Case_Mapping'Unrestricted_Access); Basic_Mapping : aliased constant Wide_Character_Mapping_Values := (Length => 55, Domain => W.UC_A_Grave & W.UC_A_Acute & W.UC_A_Circumflex & W.UC_A_Tilde & W.UC_A_Diaeresis & W.UC_A_Ring & W.UC_C_Cedilla & W.UC_E_Grave & W.UC_E_Acute & W.UC_E_Circumflex & W.UC_E_Diaeresis & W.UC_I_Grave & W.UC_I_Acute & W.UC_I_Circumflex & W.UC_I_Diaeresis & W.UC_N_Tilde & W.UC_O_Grave & W.UC_O_Acute & W.UC_O_Circumflex & W.UC_O_Tilde & W.UC_O_Diaeresis & W.UC_O_Oblique_Stroke & W.UC_U_Grave & W.UC_U_Acute & W.UC_U_Circumflex & W.UC_U_Diaeresis & W.UC_Y_Acute & W.LC_A_Grave & W.LC_A_Acute & W.LC_A_Circumflex & W.LC_A_Tilde & W.LC_A_Diaeresis & W.LC_A_Ring & W.LC_C_Cedilla & W.LC_E_Grave & W.LC_E_Acute & W.LC_E_Circumflex & W.LC_E_Diaeresis & W.LC_I_Grave & W.LC_I_Acute & W.LC_I_Circumflex & W.LC_I_Diaeresis & W.LC_N_Tilde & W.LC_O_Grave & W.LC_O_Acute & W.LC_O_Circumflex & W.LC_O_Tilde & W.LC_O_Diaeresis & W.LC_O_Oblique_Stroke & W.LC_U_Grave & W.LC_U_Acute & W.LC_U_Circumflex & W.LC_U_Diaeresis & W.LC_Y_Acute & W.LC_Y_Diaeresis, Rangev => 'A' & -- UC_A_Grave 'A' & -- UC_A_Acute 'A' & -- UC_A_Circumflex 'A' & -- UC_A_Tilde 'A' & -- UC_A_Diaeresis 'A' & -- UC_A_Ring 'C' & -- UC_C_Cedilla 'E' & -- UC_E_Grave 'E' & -- UC_E_Acute 'E' & -- UC_E_Circumflex 'E' & -- UC_E_Diaeresis 'I' & -- UC_I_Grave 'I' & -- UC_I_Acute 'I' & -- UC_I_Circumflex 'I' & -- UC_I_Diaeresis 'N' & -- UC_N_Tilde 'O' & -- UC_O_Grave 'O' & -- UC_O_Acute 'O' & -- UC_O_Circumflex 'O' & -- UC_O_Tilde 'O' & -- UC_O_Diaeresis 'O' & -- UC_O_Oblique_Stroke 'U' & -- UC_U_Grave 'U' & -- UC_U_Acute 'U' & -- UC_U_Circumflex 'U' & -- UC_U_Diaeresis 'Y' & -- UC_Y_Acute 'a' & -- LC_A_Grave 'a' & -- LC_A_Acute 'a' & -- LC_A_Circumflex 'a' & -- LC_A_Tilde 'a' & -- LC_A_Diaeresis 'a' & -- LC_A_Ring 'c' & -- LC_C_Cedilla 'e' & -- LC_E_Grave 'e' & -- LC_E_Acute 'e' & -- LC_E_Circumflex 'e' & -- LC_E_Diaeresis 'i' & -- LC_I_Grave 'i' & -- LC_I_Acute 'i' & -- LC_I_Circumflex 'i' & -- LC_I_Diaeresis 'n' & -- LC_N_Tilde 'o' & -- LC_O_Grave 'o' & -- LC_O_Acute 'o' & -- LC_O_Circumflex 'o' & -- LC_O_Tilde 'o' & -- LC_O_Diaeresis 'o' & -- LC_O_Oblique_Stroke 'u' & -- LC_U_Grave 'u' & -- LC_U_Acute 'u' & -- LC_U_Circumflex 'u' & -- LC_U_Diaeresis 'y' & -- LC_Y_Acute 'y'); -- LC_Y_Diaeresis Basic_Map : constant Wide_Character_Mapping := (AF.Controlled with Basic_Mapping'Unrestricted_Access); end Ada.Strings.Wide_Maps.Wide_Constants;
test/interaction/Issue373.agda
redfish64/autonomic-agda
0
6943
module Issue373 where data ⊤ : Set where tt : ⊤ {-# COMPILED_DATA ⊤ () () #-} data ℕ : Set where zero : ℕ suc : (n : ℕ) → ℕ {-# BUILTIN NATURAL ℕ #-} {-# IMPORT Imports.Nat #-} data List (A : Set) : Set where [] : List A _∷_ : A → List A → List A {-# BUILTIN LIST List #-} {-# BUILTIN NIL [] #-} {-# BUILTIN CONS _∷_ #-} {-# COMPILED_DATA List [] [] (:) #-} postulate String : Set {-# BUILTIN STRING String #-} postulate IO : Set → Set {-# BUILTIN IO IO #-} {-# COMPILED_TYPE IO IO #-} infixl 1 _>>=_ postulate _>>=_ : ∀ {A B} → IO A → (A → IO B) → IO B {-# COMPILED _>>=_ (\_ _ -> (>>=) :: IO a -> (a -> IO b) -> IO b) #-} {-# IMPORT Data.Text.IO #-} postulate putStrLn : String → IO ⊤ {-# COMPILED putStrLn Data.Text.IO.putStrLn #-} f : ℕ → String f zero = "bad" f _ = "ok" -- Works: -- main = putStrLn (f (suc zero)) -- Compiles, but when the program is run we (used to) get the output -- "bad": main = putStrLn (f 1)
MP/LAB_001_Opt/ver_enesima_potencia.adb
usainzg/EHU
0
12281
<reponame>usainzg/EHU<gh_stars>0 with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Ver_Enesima_Potencia is -- entrada: 2 natural -- salida: 4 naturales y 1 natural, Pot (SE) -- post: Los cuatro naturales corresponden a 4 de casos de prueba -- pre: { True } function Potencia (M: Natural; N: Natural) return Natural is -- EJERCICIO 1 (Opcional)- ESPECIFICA E IMPLEMENTA recursivamente el subprograma -- Potencia que calcula la n-�sima potencia de M. begin -- Completar if N = 0 then return 1; end if; if N > 0 then return M * Potencia(M, N-1); end if; return 0; end Potencia; -- post: { M^N == Potencia(M, N) } begin ---------- PRUEBAS EXPL�CITAS A PROBAR Put_Line ("--------------------------------"); Put(" CASO1: 2^0= "); put(2**0, 0); put(", y con tu programa es --> "); Put (Potencia(2, 0), 0); Put_Line("."); New_Line;New_Line; Put_Line ("--------------------------------"); Put(" CASO2: 3^1= "); put(3**1, 0); put(", y con tu programa es --> "); Put (Potencia(3, 1), 0); Put_Line("."); New_Line;New_Line; Put_Line ("--------------------------------"); Put(" CASO3: 5^5= "); put(5**5, 0); put(", y con tu programa es --> "); Put (Potencia(5, 5), 0); Put_Line("."); New_Line;New_Line; Put_Line ("--------------------------------"); Put(" CASO4: 4^15= "); put(4**15, 0); put(", y con tu programa es --> "); Put (Potencia(4, 15), 0); put_line("."); New_Line;New_Line; Put_Line ("--------------------------------"); Put_Line ("--------------------------------"); end Ver_Enesima_Potencia;
programs/oeis/072/A072376.asm
karttu/loda
0
508
; A072376: a(n) = a(floor(n/2)) + a(floor(n/4)) + a(floor(n/8)) + ... starting with a(0)=0 and a(1)=1. ; 0,1,1,1,2,2,2,2,4,4,4,4,4,4,4,4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64 mov $2,1 mov $3,2 lpb $0,2 trn $0,$2 mov $1,$3 mov $3,$2 mul $2,2 lpe
openal-buffer.ads
io7m/coreland-openal-ada
1
28261
with OpenAL.Types; package OpenAL.Buffer is -- -- Types -- type Buffer_t is private; type Buffer_Array_t is array (Positive range <>) of Buffer_t; No_Buffer : constant Buffer_t; -- -- API -- -- proc_map : alGenBuffers procedure Generate_Buffers (Buffers : in out Buffer_Array_t); -- proc_map : alDeleteBuffers procedure Delete_Buffers (Buffers : in Buffer_Array_t); -- proc_map : alIsBuffer function Is_Valid (Buffer : in Buffer_t) return Boolean; -- -- Frequency -- -- proc_map : alGetBuffer procedure Get_Frequency (Buffer : in Buffer_t; Frequency : out Types.Frequency_t); -- -- Size -- type Sample_Size_t is range 1 .. Types.Size_t'Last; -- proc_map : alGetBuffer procedure Get_Size (Buffer : in Buffer_t; Size : out Sample_Size_t); -- -- Bits -- type Sample_Bits_t is range 8 .. 16; -- proc_map : alGetBuffer procedure Get_Bits (Buffer : in Buffer_t; Bits : out Sample_Bits_t); -- -- Channels -- type Sample_Channels_t is range 1 .. 2; -- proc_map : alGetBuffer procedure Get_Channels (Buffer : in Buffer_t; Channels : out Sample_Channels_t); -- -- Data -- type Sample_16_t is range -32768 .. 32767; for Sample_16_t'Size use 16; type Sample_8_t is range 0 .. 255; for Sample_8_t'Size use 8; type Sample_Array_16_t is array (Sample_Size_t range <>) of aliased Sample_16_t; type Sample_Array_8_t is array (Sample_Size_t range <>) of aliased Sample_8_t; -- proc_map : alBufferData procedure Set_Data_Mono_8 (Buffer : in Buffer_t; Data : in Sample_Array_8_t; Frequency : in Types.Frequency_t); -- proc_map : alBufferData procedure Set_Data_Stereo_8 (Buffer : in Buffer_t; Data : in Sample_Array_8_t; Frequency : in Types.Frequency_t); -- proc_map : alBufferData procedure Set_Data_Mono_16 (Buffer : in Buffer_t; Data : in Sample_Array_16_t; Frequency : in Types.Frequency_t); -- proc_map : alBufferData procedure Set_Data_Stereo_16 (Buffer : in Buffer_t; Data : in Sample_Array_16_t; Frequency : in Types.Frequency_t); -- -- -- function To_Integer (Buffer : Buffer_t) return Types.Unsigned_Integer_t; function From_Integer (Buffer : Types.Unsigned_Integer_t) return Buffer_t; private type Buffer_t is new Types.Unsigned_Integer_t; No_Buffer : constant Buffer_t := 0; end OpenAL.Buffer;
libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/dtog.asm
jpoikela/z88dk
640
26323
<reponame>jpoikela/z88dk ; size_t dtog(double x, char *buf, uint16_t prec, uint16_t flag) SECTION code_clib SECTION code_stdlib PUBLIC _dtog EXTERN d2mlib, asm_dtog _dtog: pop af pop de pop hl exx pop hl pop de pop bc push bc push de push hl exx push hl push de push af call d2mlib jp asm_dtog
oeis/258/A258807.asm
neoneye/loda-programs
11
2046
<gh_stars>10-100 ; A258807: a(n) = n^5 - 1. ; 0,31,242,1023,3124,7775,16806,32767,59048,99999,161050,248831,371292,537823,759374,1048575,1419856,1889567,2476098,3199999,4084100,5153631,6436342,7962623,9765624,11881375,14348906,17210367,20511148,24299999,28629150,33554431,39135392,45435423,52521874,60466175,69343956,79235167,90224198,102399999,115856200,130691231,147008442,164916223,184528124,205962975,229345006,254803967,282475248,312499999,345025250,380204031,418195492,459165023,503284374,550731775,601692056,656356767,714924298,777599999 add $0,1 pow $0,5 sub $0,1
oeis/147/A147958.asm
neoneye/loda-programs
11
168128
; A147958: a(n) = ((7 + sqrt(2))^n + (7 - sqrt(2))^n)/2. ; Submitted by <NAME> ; 1,7,51,385,2993,23807,192627,1577849,13036417,108350935,904201491,7566326929,63431106929,532418131343,4472591813139,37592633210825,316085049734017,2658336935367463,22360719757645683,188108240644768801,1582561540417416113,13314774255539691935,112026447177937129779,942575870480754295961,7930819169367515043841,66730402458549758703607,561477133459423414789971,4724350952880089147990065,39751488067728347576732273,334476338162832676118718767,2814348795096425129555645907,23680495237696816036199260649 mov $1,1 mov $3,1 lpb $0 sub $0,1 mov $2,$3 mul $3,6 add $3,$1 mul $1,8 add $1,$2 lpe mov $0,$3
cmd/edlin/edlparse.asm
minblock/msdos
0
162820
page 60,132; title EDLPARSE for EDLIN ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;******************* START OF SPECIFICATIONS ***************************** ; ; MODULE NAME: EDLPARSE.SAL ; ; DESCRIPTIVE NAME: PARSES THE EXTERNAL COMMAND LINE FOR EDLIN ; ; FUNCTION: THIS ROUTINE PROVIDES PARSING CAPABILITIES FOR THE ; EXTERNAL COMMAND LINE OF EDLIN. IT PARSES FOR THE PRESENCE ; OF A REQUIRED FILESPEC AND AN OPTIONAL SWITCH (/B). ; ; ENTRY POINT: PARSER_COMMAND ; ; INPUT: DOS COMMAND LINE ; ; EXIT NORMAL: AX = 0FFH - VALID SWITCH AND FILESPEC SPECIFIED ; ; EXIT ERROR: AX NOT= 0FFH - INVALID SWITCH OR NO FILESPEC SPECIFIED ; ; INTERNAL REFERENCES ; ; ROUTINE: PARSER_COMMAND - THIS ROUTINE PARSES FOR THE PRESENCE ; OF THE /B SWITCH AND A FILESPEC. THE ; FILEPSEC IS REQUIRED, WHILE THE SWITCH ; IS OPTIONAL. ; ; EXTERNAL REFERENCES: ; ; ROUTINE: PARSE.ASM - THIS IS THE PARSER CODE. ; ; NOTES: THIS MODULE IS TO BE PREPPED BY SALUT WITH THE "PR" OPTIONS. ; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE ; ; REVISION HISTORY: ; ; AN000 VERSION 4.00 - IMPLEMENTS THE SYSTEM PARSER (SYSPARSE) ; ; COPYRIGHT: "THE IBM PERSONAL COMPUTER EDLIN UTILITY" ; "VERSION 4.00 (C) COPYRIGHT 1988" ; "LICENSED MATERIAL - PROPERTY OF Microsoft" ; ; ;******************** END OF SPECIFICATIONS ****************************** ;======================= equates for edlparse ============================ parse_ok equ 0 ;an000;good parse return parse_command equ 081h ;an000;offset of command line nul equ 0 ;an000;nul fs_flag equ 05h ;an000;filespec found sw_flag equ 03h ;an000;switch found true equ 0ffffh ;an000;true false equ 00h ;an000;false too_many equ 01h ;an000;too many parms ;======================= end equates ===================================== CODE SEGMENT PUBLIC BYTE CODE ENDS CONST SEGMENT PUBLIC BYTE CONST ENDS cstack segment stack cstack ends DATA SEGMENT PUBLIC BYTE extrn path_name:byte extrn org_ds:word ;an000; dms; public parse_switch_b ;an000;parse switch result public parse_switch_? ; parse switch result public filespec ;an000;actual filespec ;======================= input parameters control blocks ================= ; these control blocks are used by sysparse and must be pointed to by ; es:di on invocation. public parms ;an000;share parms parms label byte ;an000;parms control block dw dg:parmsx ;an000;point to parms structure db 00h ;an000;no additional delims. parmsx label byte ;an000;parameter types db 1,1 ;an000;must have filespec dw dg:fs_pos ;an000;filespec control block db 2 ;an000;max. number of switches dw dg:sw_b ;an000;/b switch control block dw dg:sw_? ;an000;/? switch control block db 00h ;an000;no keywords ;======================= filespec positional tables ====================== fs_pos label byte ;an000;filespec positional dw 0200h ;an000;filespec/not optional dw 0001h ;an000;cap dw dg:filespec_res ;an000;filespec result table dw dg:noval ;an000;value list/none db 0 ;an000;no keyword/switch syns. filespec_res label byte ;an000;filespec result table parse_fs_res db ? ;an000;must be filespec (05) parse_fs_tag db ? ;an000;item tag parse_fs_syn dw ? ;an000;synonym pointer parse_fs_off dw ? ;an000;offset to filespec parse_fs_seg dw ? ;an000;segment of filespec ;======================= switch tables /b ================================ sw_b label byte ;an000;/b switch dw 0000h ;an000;no match flags dw 0000h ;an000;no cap dw dg:switch_res ;an000;result buffer dw dg:noval ;an000;value list/none db 1 ;an000;1 switch sw_b_switch db "/B",0 ;an000;/B means ignore CTL-Z sw_? label byte ;an000;/b switch dw 0000h ;an000;no match flags dw 0000h ;an000;no cap dw dg:switch_res ;an000;result buffer dw dg:noval ;an000;value list/none db 1 ;an000;1 switch sw_?_switch db "/?",0 ;an000;/B means ignore CTL-Z PUBLIC sw_?_switch switch_res label byte ;an000;switch result table parse_sw_res db ? ;an000;must be string (03) parse_sw_tag db ? ;an000;item tag parse_sw_syn dw ? ;an000;synonym pointer parse_sw_ptr dd ? ;an000;pointer to result noval label byte ;an000;value table db 0 ;an000;no values ;======================= end input parameter control blocks ============== filespec db 128 dup (0) ;an000;holds filespec parse_switch_b db false ;an000;hold boolean result ; of /b parse parse_switch_? db false ; true if /? found parse_sw_b db "/B" ;an000;comparison switch DATA ENDS DG GROUP CODE,CONST,cstack,DATA code segment public byte ;an000;code segment assume cs:dg,ds:dg,es:dg,ss:CStack ;an000; public parser_command ;an000;share this routine ;======================= begin main routine ============================== .xlist include version.inc ; parse.asm include psdata.inc which needs defs from here include parse.asm ;an000;parser .list parser_command proc near ;an000;parse routine push es ;an000;save registers push ds ;an000; push di ;an000; push si ;an000; mov dg:parse_switch_b,false ;an000;init. to false xor cx,cx ;an000;set cx to 0 xor dx,dx ;an000;set dx to 0 mov di,offset dg:parms ;an000;point to parms mov si,parse_command ;an000;point to ds:81h mov ds,dg:org_ds ;an000;get ds at entry assume ds:nothing ;an000; parse_continue: ;an000;loop return point call sysparse ;an000;invoke parser cmp ax,parse_ok ;an000;is it a good parse jne parse_end ;an000;continue on good parse push si mov si,dx cmp byte ptr es:[si],fs_flag ;an000;do we have a filespec ; $if e ;an000;yes we do JNE $$IF1 call build_fs ;an000;save filespec ; $else ;an000; JMP SHORT $$EN1 $$IF1: ; A switch was found. ; See which one it was. call val_sw ;an000;see which switch ; $endif ;an000; $$EN1: pop si jmp parse_continue ;an000;continue parsing parse_end: ;an000;end parse routine pop si ;an000;restore registers pop di ;an000; for return to caller pop ds ;an000; assume ds:dg ;an000; pop es ;an000; ret ;an000;return to caller parser_command endp ;an000;end parser_command ;======================= subroutine area ================================= ;========================================================================= ; build_fs: This routine saves the filespec for use by the calling program. ;========================================================================= build_fs proc near ;an000;save filespec push ax ;an000;save affected regs. push di ;an000; push si ;an000; push ds ;an000; push es ;an000; mov di,offset dg:filespec ;an000;point to filespec buffer lds si,dword ptr es:parse_fs_off ;an000;get offset build_cont: ;an000;continue routine lodsb ;an000;mov ds:si to al cmp al,nul ;an000;is it end of filespec ; $if nz ;an000;if not JZ $$IF7 stosb ;an000;move byte to filespec jmp build_cont ;an000;continue buffer fill ; $endif ;an000; $$IF7: stosb ;an000;save nul pop es ;an000;restore regs pop ds ;an000; pop si ;an000; pop di ;an000; pop ax ;an000; ret ;an000;return to caller build_fs endp ;an000;end proc ;========================================================================= ; val_sw : determines which switch we have. ;========================================================================= val_sw proc near ;an000;switch determination ; Check for /B cmp es:[parse_sw_syn], offset es:sw_b_switch jne ValSwitchBDone cmp es:[parse_switch_b], true ; see if already given jne ValSwitchBOkay ; jump if not mov ax, too_many ; set error level jmp parse_end ; and exit parser ValSwitchBOkay: mov es:[parse_switch_b], true ; set the flag on jmp short ValSwitchExit ; and done ValSwitchBDone: ; Check for /? cmp es:[parse_sw_syn], offset es:sw_?_switch jne ValSwitch?Done mov es:[parse_switch_?], true ; set the flag on jmp short ValSwitchExit ; and done ValSwitch?Done: ValSwitchExit: ret ;an000;return to caller val_sw endp ;an000;end proc code ends ;an000;end segment end ;an000; 
daily-standup.applescript
craig-davis/tyme2-standup
8
3329
#!/usr/bin/osascript ################################################################################ # Tyme2 Daily Standup # # Read daily task items from Tyme2 application and print them to stdout for a # morning report of the previous days activities. On Monday, this will scan for # work accomplished over the weekend. # # This is intented to be run with `| pbcopy` so that the content is placed into # the clipboard, but it could also be run quietly and piped to a text file. # # Author: <NAME> <<EMAIL>> # License: MIT # Copyright: <NAME> 2016 # ################################################################################ ########################################################################## # Variables ########################################################################## # string Newline for formatting set nl to " " # string Program output set standup to "" # string Name of day set today to (weekday of (current date)) # integer Seconds since midnight set secondsToday to (time of (current date)) # integer Timestamp of last second of yesterday set yesterdayNight to (current date) - secondsToday # integer Timestamp of first second of yesterday set yesterdayMorning to yesterdayNight - (24 * 60 * 60) ########################################################################## # Weekend Reporting ########################################################################## # integer Timestamp of last second of Friday set fridayNight to 0 # integer Timestamp of first second of Friday set fridayMorning to 0 # Calculate the weekend timestamps if needed if today is Monday then set fridayNight to (current date) - secondsToday - (48 * 60 * 60) set fridayMorning to fridayNight - (24 * 60 * 60) end if ########################################################################## # Methods ########################################################################## ## # Trim whitespaces from a string # # http://applescript.bratis-lover.net/library/string/#trimEnd # # @param string aString String to be trimmed # # @return string Trimmed of both spaces and newlines at both ends on trimEnd(str) local str, whiteSpace try set str to str as string set whiteSpace to {character id 10, return, space, tab} try repeat while str's last character is in whiteSpace set str to str's text 1 thru -2 end repeat return str on error number -1728 return "" end try on error eMsg number eNum error "Can't trimEnd: " & eMsg number eNum end try end trimEnd ## # Fetch the tasks for a time period # # @param integer startTime Epoch timestamp for start of period # @param integer endTime Epoch timestamp for end of period # @param string nl Newline character for each line item # # @return string Tasks for time period on FetchTasks(startTime, endTime, nl) tell application "Tyme2" GetTaskRecordIDs startDate startTime endDate endTime set standup to "" set fetchedRecords to fetchedTaskRecordIDs as list repeat with recordID in fetchedRecords GetRecordWithID recordID set recordNote to note of lastFetchedTaskRecord set recordTaskID to relatedTaskID of lastFetchedTaskRecord set tsk to the first item of (every task of every project whose id = recordTaskID) set tskName to name of tsk if recordNote is not "" then set standup to standup & "- " & tskName & ": " & my trimEnd(recordNote) & nl end if end repeat if standup is "" then set standup to standup & "- None" & nl end if end tell return standup end FetchTasks ########################################################################## # Application Procedural ########################################################################## # Record Tasks from the preceeding time period if today is Monday then # Fetch tasks from Friday during the day set standup to standup & "*Friday*" & nl set standup to standup & FetchTasks(fridayMorning, fridayNight, nl) # Fetch tasks from last second of Friday until last night set weekend to FetchTasks(fridayNight, yesterdayNight, nl) if trimEnd(weekend) is not "- None" then set standup to standup & "*Weekend*" & nl & weekend end if else # Simple poll of yesterdays tasks set standup to standup & "*Yesterday*" & nl set standup to standup & FetchTasks(yesterdayMorning, yesterdayNight, nl) end if # Collect the tasks for today set standup to standup & "*Today*" & nl # Prompt the user for anything they want to accomplish today set tskToday to the text returned of (display dialog "What are your goals today? (empty to exit):" default answer "") set hasDailyTask to false repeat while tskToday is not "" set standup to standup & "- " & tskToday & nl set tskToday to the text returned of (display dialog "What are your goals today?:" default answer "") set hasDailyTask to true end repeat # Account for taking a day off today if hasDailyTask is not true then set standup to standup & "- No tasks today" & nl end if # Record any blockers set standup to standup & "*Blockers*" & nl set tskBlockers to the text returned of (display dialog "What are you blocked by?:" default answer "") # No newlines on this end of the text if tskBlockers is not "" then set standup to standup & "- " & tskBlockers & nl else set standup to standup & "- None" & nl end if # Record any upcoming QA work set standup to standup & "*Upcoming for QA*" & nl set tskQA to the text returned of (display dialog "Anything upcoming for QA?:" default answer "") # No newlines on this end of the text if tskQA is not "" then set standup to standup & "- " & tskQA else set standup to standup & "- None" end if # Output to the terminal as long as we're running via `osascript` log standup
oeis/160/A160374.asm
neoneye/loda-programs
11
177655
<reponame>neoneye/loda-programs ; A160374: Numerator of Hermite(n, 7/32). ; Submitted by <NAME> ; 1,7,-463,-10409,638305,25785767,-1453560431,-89388799241,4583838990017,398223394621255,-18334766303649551,-2167247144586372457,88090673810049664033,13932201173009020024039,-488806116668627423635375,-103287660824809047497759177 mov $1,1 mov $2,-1 lpb $0 sub $0,1 mul $1,8 sub $1,$2 add $2,$1 div $2,4 sub $1,$2 mul $2,$0 mul $2,256 sub $2,$1 lpe mov $0,$1
oeis/028/A028186.asm
neoneye/loda-programs
11
27871
; A028186: Expansion of 1/((1-5x)(1-7x)(1-9x)(1-12x)). ; Submitted by <NAME> ; 1,33,694,11898,181747,2582715,34981048,458355876,5866720453,73835049717,917894484442,11308397377134,138391574753719,1685252212876239,20446364918965276,247382964478976472 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 trn $2,1 sub $0,$2 seq $0,20972 ; Expansion of 1/((1-7*x)*(1-9*x)*(1-12*x)). sub $0,$1 mul $1,6 add $1,$0 lpe mov $0,$1
Vectors/VectorSpace.agda
Smaug123/agdaproofs
4
12329
{-# OPTIONS --safe --warning=error --without-K #-} open import Groups.Definition open import Groups.Abelian.Definition open import Setoids.Setoids open import Rings.Definition open import Modules.Definition open import Fields.Fields open import Agda.Primitive using (Level; lzero; lsuc; _⊔_) module Vectors.VectorSpace {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+R_ : A → A → A} {_*_ : A → A → A} (R : Ring S _+R_ _*_) {m n : _} {M : Set m} {T : Setoid {m} {n} M} {_+_ : M → M → M} {G' : Group T _+_} (G : AbelianGroup G') (_·_ : A → M → M) where record VectorSpace : Set (lsuc a ⊔ b ⊔ m ⊔ n) where field isModule : Module R G _·_ isField : Field R
openbsd.ads
gpicchiarelli/openbsd-ada
3
12899
<filename>openbsd.ads -- OpenBSD - Provide high-level Ada interfaces to OpenBSD's pledge and unveil. -- Written in 2019 by <NAME> <EMAIL> . -- To the extent possible under law, the author(s) have dedicated all copyright and related and -- neighboring rights to this software to the public domain worldwide. -- This software is distributed without any warranty. -- You should have received a copy of the CC0 Public Domain Dedication along with this software. -- If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. -- This is consistent with OpenBSD 6.5. package OpenBSD is type Allowing is (Allowed, Disallowed); type Promise is (Stdio, Rpath, Wpath, Cpath, Dpath, Tmppath, Inet, Mcast, Fattr, Chown, Flock, Unix, Dns, Getpw, Sendfd, Recvfd, Tape, Tty, Proc, Exec, Prot_Exec, Settime, Ps, Vminfo, Id, Pf, Audio, Video, Bpf, Unveil, Error); type Promise_Array is array (Promise) of Allowing; Pledge_Error : exception; procedure Pledge (Promises : in Promise_Array); type Permission is (Read, Write, Execute, Create); type Permission_Array is array (Permission) of Allowing; Unveil_Error : exception; procedure Unveil (Path : in String; Permissions : in Permission_Array); -- Perhaps I should also have a Disable_Unveil or is Pledge sufficient for all such cases? end OpenBSD;
game-projects/day-of-the-tentacle/object/background1/background1.asm
wide-dot/thomson-to8-game-engine
11
19790
; --------------------------------------------------------------------------- ; Object - background ; ; input REG : [u] pointer to Object Status Table (OST) ; --------- ; ; Animated full screen Background ; ; --------------------------------------------------------------------------- INCLUDE "./Engine/Macros.asm" Backgrnd lda routine,u asla ldx #Backgrnd_Routines jmp [a,x] Backgrnd_Routines fdb Backgrnd_Back1 fdb Backgrnd_Back2 fdb Backgrnd_Init fdb Backgrnd_Main Backgrnd_Back1 ldb #3 stb priority,u lda render_flags,u ora #render_overlay_mask sta render_flags,u ldd #$807F std xy_pixel,u ldd #Img_back1 std image_set,u inc routine,u jmp DisplaySprite Backgrnd_Back2 ldd #Img_back2 std image_set,u inc routine,u jmp DisplaySprite Backgrnd_Init ldd #Ani_bck_up std anim,u inc routine,u Backgrnd_Main jsr AnimateSprite jmp DisplaySprite
test/Succeed/fol-theorems/NonTopLevelModuleName.agda
asr/apia
10
13480
<filename>test/Succeed/fol-theorems/NonTopLevelModuleName.agda ------------------------------------------------------------------------------ -- Testing anonymous module ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- No top-level module postulate D : Set _≡_ : D → D → Set postulate foo : ∀ t → t ≡ t {-# ATP prove foo #-}
generated/natools-static_maps-web-fallback_render-commands.adb
faelys/natools-web
1
84
<reponame>faelys/natools-web<filename>generated/natools-static_maps-web-fallback_render-commands.adb<gh_stars>1-10 with Interfaces; use Interfaces; package body Natools.Static_Maps.Web.Fallback_Render.Commands is P : constant array (0 .. 4) of Natural := (1, 4, 9, 13, 16); T1 : constant array (0 .. 4) of Unsigned_8 := (34, 66, 52, 35, 47); T2 : constant array (0 .. 4) of Unsigned_8 := (5, 26, 36, 26, 50); G : constant array (0 .. 66) of Unsigned_8 := (0, 11, 0, 0, 2, 21, 0, 28, 16, 0, 0, 0, 0, 15, 0, 5, 0, 0, 12, 30, 0, 8, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 19, 0, 0, 27, 0, 17, 11, 0, 13, 0, 4, 18, 23, 20, 9, 0, 0, 27, 0, 14, 0, 0, 30, 6, 25, 25, 0, 4, 5, 0, 2, 14, 0); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 67; F2 := (F2 + Natural (T2 (K)) * J) mod 67; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 33; end Hash; end Natools.Static_Maps.Web.Fallback_Render.Commands;
programs/oeis/064/A064724.asm
jmorken/loda
1
240276
; A064724: A Beatty sequence for 2^sqrt(2). ; 1,3,4,6,8,9,11,12,14,16,17,19,20,22,24,25,27,28,30,32,33,35,36,38,40,41,43,44,46,48,49,51,52,54,56,57,59,60,62,64,65,67,68,70,72,73,75,76,78,80,81,83,84,86,88,89,91,92,94,96,97,99,100,102,104,105,107,108,110,112,113,115,116,118,120,121,123,124,126,128,129,131,132,134,136,137,139,140,142,144,145,147,148,150,152,153,155,156,158,160,161,163,164,166,168,169,171,172,174,176,177,179,180,182,184,185,187,188,190,192,193,195,196,198,200,201,203,204,206,208,209,211,212,214,216,217,219,220,222,224,225,227,228,230,232,233,235,236,238,240,241,243,244,246,248,249,251,252,254,256,257,259,260,262,264,265,267,268,270,272,273,275,276,278,280,281,283,284,286,288,289,291,292,294,296,297,299,300,302,304,305,307,308,310,312,313,315,316,318,320,321,323,324,326,328,329,331,332,334,336,337,339,340,342,344,345,347,348,350,352,353,355,356,358,360,361,363,364,366,368,369,371,372,374,376,377,379,380,382,384,385,387,388,390,392,393,395,396,398,400 mov $6,$0 mov $8,$0 add $8,1 lpb $8 clr $0,6 mov $0,$6 sub $8,1 sub $0,$8 lpb $0 mov $2,$0 cal $2,316832 ; In A316831, replace 2's and 3's with 0's. mov $1,$0 trn $0,5 add $3,$2 mul $3,2 mov $4,$2 min $4,1 add $5,$4 lpe mov $1,$2 add $1,1 add $7,$1 lpe mov $1,$7
engine/menu/link_menu.asm
adhi-thirumala/EvoYellow
16
176757
<reponame>adhi-thirumala/EvoYellow Func_f531b:: ld c,$14 call DelayFrames ld a,$1 ld [wBuffer],a xor a ld [wUnknownSerialFlag_d499],a coord hl, 0,0 lb bc, 4, 5 call TextBoxBorder ld de,Text_f5791 coord hl, 1,2 call PlaceString coord hl, 8,0 lb bc, 8, 10 call TextBoxBorder coord hl, 10,2 ld de,Text_f579c call PlaceString coord hl, 0,10 lb bc, 6, 18 call TextBoxBorder call UpdateSprites xor a ld [wUnusedCD37],a ld [wd72d],a ld [wd11e],a ld hl,wTopMenuItemY ld a,$2 ld [hli],a ld a,$9 ld [hli],a xor a ld [hli],a inc hl ld a,$3 ld [hli],a ld a,$3 ld [hli],a xor a ld [hl],a .asm_f5377 call Func_f56bd call HandleMenuInput and $3 add a add a ld b,a ld a,[wCurrentMenuItem] cp $3 jr nz,.asm_f5390 bit 2,b jr z,.asm_f5390 dec a ld b,$8 .asm_f5390 add b add $c0 ld [wLinkMenuSelectionSendBuffer],a ld [wLinkMenuSelectionSendBuffer+1],a .asm_f5399 ld hl,wLinkMenuSelectionSendBuffer ld a,[hl] ld [hSerialSendData],a call Serial_ExchangeByte push af ld hl,wLinkMenuSelectionSendBuffer ld a,[hl] ld [hSerialSendData],a call Serial_ExchangeByte pop bc cp b jr nz,.asm_f5399 and $f0 cp $c0 jr nz,.asm_f5399 ld a,b and $c jr nz,.asm_f53c4 ld a,[wLinkMenuSelectionSendBuffer] and $c jr z,.asm_f5377 jr .asm_f53df .asm_f53c4 ld a,[wLinkMenuSelectionSendBuffer] and $c jr z,.asm_f53d1 ld a,[hSerialConnectionStatus] cp $2 jr z,.asm_f53df .asm_f53d1 ld a,$1 ld [wd11e],a ld a,b ld [wLinkMenuSelectionSendBuffer],a and $3 ld [wCurrentMenuItem],a .asm_f53df call DelayFrame call DelayFrame ld hl,wLinkMenuSelectionSendBuffer ld a,[hl] ld [hSerialSendData],a call Serial_ExchangeByte call Serial_ExchangeByte ld b,$14 .loop call DelayFrame call Serial_SendZeroByte dec b jr nz,.loop ld b,$7f ld c,$7f ld d,$7f ld e,$ec ld a,[wLinkMenuSelectionSendBuffer] bit 3,a jr nz,.asm_f541a ld b,e ld e,c ld a,[wCurrentMenuItem] and a jr z,.asm_f541a ld c,b ld b,d dec a jr z,.asm_f541a ld d,c ld c,b .asm_f541a ld a,b Coorda 9,2 ld a,c Coorda 9,4 ld a,d Coorda 9,6 ld a,e Coorda 9,8 ld c,40 call DelayFrames ld a,[wLinkMenuSelectionSendBuffer] bit 3,a jr nz,asm_f547f ld a,[wCurrentMenuItem] cp $3 jr z,asm_f547f inc a ld [wUnknownSerialFlag_d499],a ld a,[wCurrentMenuItem] ld hl,PointerTable_f5488 ld c,a ld b,$0 add hl,bc add hl,bc ld a,[hli] ld h,[hl] ld l,a ld de,.returnaddress push de jp hl .returnaddress ld [wLinkMenuSelectionSendBuffer],a xor a ld [wUnknownSerialCounter],a ld [wUnknownSerialCounter+1],a call Serial_SyncAndExchangeNybble ld a,[wLinkMenuSelectionSendBuffer] and a jr nz,asm_f547c ld a, [wLinkMenuSelectionReceiveBuffer] and a jr nz, Func_f5476 xor a ld [wUnknownSerialCounter],a ld [wUnknownSerialCounter+1],a and a ret Func_f5476:: ld hl,ColosseumIneligibleText call PrintText asm_f547c:: jp Func_f531b asm_f547f:: xor a ld [wUnknownSerialCounter],a ld [wUnknownSerialCounter+1],a scf ret PointerTable_f5488:: dw PokeCup dw PikaCup dw PetitCup PokeCup:: ld hl,wPartyCount ld a,[hli] cp $3 jp nz,NotThreeMonsInParty ld b,$3 .loop ld a,[hli] cp MEW jp z,MewInParty dec b jr nz,.loop dec hl dec hl cp [hl] ; is third mon second mon? jp z,DuplicateSpecies dec hl ; wPartySpecies cp [hl] ; is third mon first mon? jp z,DuplicateSpecies ld a,[hli] cp [hl] ; is first mon second mon? jp z,DuplicateSpecies ld a,[wPartyMon1Level] cp 56 jp nc,LevelAbove55 cp 50 jp c,LevelUnder50 ld b,a ld a,[wPartyMon2Level] cp 56 jp nc,LevelAbove55 cp 50 jp c,LevelUnder50 ld c,a ld a,[wPartyMon3Level] cp 56 jp nc,LevelAbove55 cp 50 jp c,LevelUnder50 add b add c cp 156 jp nc,CombinedLevelsGreaterThan155 xor a ret PikaCup:: ld hl,wPartyCount ld a,[hli] cp $3 jp nz,NotThreeMonsInParty ld b,$3 .loop ld a,[hli] ; wPartySpecies cp MEW jp z,MewInParty dec b jr nz,.loop dec hl dec hl cp [hl] ; is third mon second mon? jp z,DuplicateSpecies dec hl ; wPartySpecies cp [hl] ; is third mon first mon? jp z,DuplicateSpecies ld a,[hli] cp [hl] ; is first mon second mon? jp z,DuplicateSpecies ld a,[wPartyMon1Level] cp 21 jp nc,LevelAbove20 cp 15 jp c,LevelUnder15 ld b,a ld a,[wPartyMon2Level] cp 21 jp nc,LevelAbove20 cp 15 jp c,LevelUnder15 ld c,a ld a,[wPartyMon3Level] cp 21 jp nc,LevelAbove20 cp 15 jp c,LevelUnder15 add b add c cp 51 jp nc,CombinedLevelsAbove50 xor a ret PetitCup:: ld hl,wPartyCount ld a,[hli] cp $3 jp nz,NotThreeMonsInParty ld b,$3 .loop ld a,[hli] cp MEW jp z,MewInParty dec b jr nz,.loop dec hl dec hl cp [hl] ; is third mon second mon? jp z,DuplicateSpecies dec hl ; wPartySpecies cp [hl] ; is third mon first mon? jp z,DuplicateSpecies ld a,[hli] cp [hl] ; is first mon second mon? jp z,DuplicateSpecies dec hl ld a,[hl] ld [wcf91],a push hl callab Func_3b10f pop hl jp c,asm_f56ad inc hl ld a,[hl] ld [wcf91],a push hl callab Func_3b10f pop hl jp c,asm_f56ad inc hl ld a,[hl] ld [wcf91],a push hl callab Func_3b10f pop hl jp c,asm_f56ad dec hl dec hl ld b,$3 .bigloop ld a,[hli] push hl push bc push af dec a ld c,a ld b,$0 ld hl,PokedexEntryPointers add hl,bc add hl,bc ld de,wcd6d ld bc,$2 ld a,BANK(PokedexEntryPointers) call FarCopyData ld hl,wcd6d ld a,[hli] ld h,[hl] ld l,a ld de,wcd6d ld bc,$14 ld a,BANK(PokedexEntryPointers) call FarCopyData ld hl,wcd6d .loop2 ld a,[hli] cp "@" jr nz,.loop2 ld a,[hli] cp $7 jp nc,asm_f5689 add a add a ld b,a add a add b ld b,a ld a,[hli] add b cp $51 jp nc,asm_f5689 ld a,[hli] sub $b9 ld a,[hl] sbc $1 jp nc,asm_f569b pop af pop bc pop hl dec b jr nz,.bigloop ld a,[wPartyMon1Level] cp 31 jp nc,LevelAbove30 cp 25 jp c,LevelUnder25 ld b,a ld a,[wPartyMon2Level] cp 31 jp nc,LevelAbove30 cp 25 jp c,LevelUnder25 ld c,a ld a,[wPartyMon3Level] cp 31 jp nc,LevelAbove30 cp 25 jp c,LevelUnder25 add b add c cp 81 jp nc,CombinedLevelsAbove80 xor a ret NotThreeMonsInParty:: ld hl,Colosseum3MonsText call PrintText ld a,$1 ret MewInParty:: ld hl,ColosseumMewText call PrintText ld a,$2 ret DuplicateSpecies:: ld hl,ColosseumDifferentMonsText call PrintText ld a,$3 ret LevelAbove55:: ld hl,ColosseumMaxL55Text call PrintText ld a,$4 ret LevelUnder50:: ld hl,ColosseumMinL50Text call PrintText ld a,$5 ret CombinedLevelsGreaterThan155:: ld hl,ColosseumTotalL155Text call PrintText ld a,$6 ret LevelAbove30:: ld hl,ColosseumMaxL30Text call PrintText ld a,$7 ret LevelUnder25:: ld hl,ColosseumMinL25Text call PrintText ld a,$8 ret CombinedLevelsAbove80:: ld hl,ColosseumTotalL80Text call PrintText ld a,$9 ret LevelAbove20:: ld hl,ColosseumMaxL20Text call PrintText ld a,$a ret LevelUnder15:: ld hl,ColosseumMinL15Text call PrintText ld a,$b ret CombinedLevelsAbove50:: ld hl,ColosseumTotalL50Text call PrintText ld a,$c ret asm_f5689:: pop af pop bc pop hl ld [wd11e],a call GetMonName ld hl,ColosseumHeightText call PrintText ld a,$d ret asm_f569b:: pop af pop bc pop hl ld [wd11e],a call GetMonName ld hl,ColosseumWeightText call PrintText ld a,$e ret asm_f56ad:: ld a,[hl] ld [wd11e],a call GetMonName ld hl,ColosseumEvolvedText call PrintText ld a,$f ret Func_f56bd:: xor a ld [H_AUTOBGTRANSFERENABLED],a coord hl, 1,11 lb bc, 6, 18 call ClearScreenArea ld a,[wCurrentMenuItem] cp $3 jr nc,.asm_f56e6 ld hl,PointerTable_f56ee ld a,[wCurrentMenuItem] ld c,a ld b,$0 add hl,bc add hl,bc ld a,[hli] ld h,[hl] ld l,a ld d,h ld e,l coord hl, 1,12 call PlaceString .asm_f56e6 call Delay3 ld a,$1 ld [H_AUTOBGTRANSFERENABLED],a ret PointerTable_f56ee:: dw Text_f56f4 dw Text_f5728 dw Text_f575b Text_f56f4:: db "LVs of 3<pkmn>:50-55" next "Sum of LVs:155 MAX" next "MEW can't attend.@" Text_f5728:: db "LVs of 3<pkmn>:15-20" next "Sum of LVs:50 MAX" next "MEW can't attend.@" Text_f575b:: db "3 Basic <pkmn>.LV25-30" next "Sum of LVs:80 MAX" next "6′8″ and 44lb MAX@" Text_f5791:: db "View" next "Rules@" Text_f579c:: db "# Cup" next "Pika Cup" next "Petit Cup" next "CANCEL@" Colosseum3MonsText:: TX_FAR _Colosseum3MonsText ; a0a2b db "@" ColosseumMewText:: TX_FAR _ColosseumMewText ; a0a46 db "@" ColosseumDifferentMonsText:: TX_FAR _ColosseumDifferentMonsText ; a0a5f db "@" ColosseumMaxL55Text:: TX_FAR _ColosseumMaxL55Text ; a0a81 db "@" ColosseumMinL50Text:: TX_FAR _ColosseumMinL50Text ; a0a9a db "@" ColosseumTotalL155Text:: TX_FAR _ColosseumTotalL155Text ; a0aba db "@" ColosseumMaxL30Text:: TX_FAR _ColosseumMaxL30Text ; a0ad9 db "@" ColosseumMinL25Text:: TX_FAR _ColosseumMinL25Text ; a0af2 db "@" ColosseumTotalL80Text:: TX_FAR _ColosseumTotalL80Text ; a0b12 db "@" ColosseumMaxL20Text:: TX_FAR _ColosseumMaxL20Text ; a0b30 db "@" ColosseumMinL15Text:: TX_FAR _ColosseumMinL15Text ; a0b49 db "@" ColosseumTotalL50Text:: TX_FAR _ColosseumTotalL50Text ; a0b69 db "@" ColosseumHeightText:: TX_FAR _ColosseumHeightText ; a0b87 db "@" ColosseumWeightText:: TX_FAR _ColosseumWeightText ; a0b9f db "@" ColosseumEvolvedText:: TX_FAR _ColosseumEvolvedText ; a0bbb db "@" ColosseumIneligibleText:: TX_FAR _ColosseumIneligibleText ; a0bd4 db "@" LinkMenu: xor a ld [wLetterPrintingDelayFlags], a ld hl, wd72e set 6, [hl] ld hl, TextTerminator_f5a16 call PrintText call SaveScreenTilesToBuffer1 ld hl, ColosseumWhereToText call PrintText coord hl, 5, 3 lb bc, 8, 13 call TextBoxBorder call UpdateSprites coord hl, 7, 5 ld de, TradeCenterText call PlaceString xor a ld [wUnusedCD37], a ld [wd72d], a ld [wd11e], a ld hl, wTopMenuItemY ld a, $5 ld [hli], a ld a, $6 ld [hli], a xor a ld [hli], a inc hl ld a, $3 ld [hli], a ld [hli], a xor a ld [hl], a .waitForInputLoop call HandleMenuInput and A_BUTTON | B_BUTTON add a add a ld b, a ld a, [wCurrentMenuItem] cp $3 jr nz,.asm_f586b bit 2,b jr z,.asm_f586b dec a ld b,$8 .asm_f586b add b add $d0 ld [wLinkMenuSelectionSendBuffer], a ld [wLinkMenuSelectionSendBuffer + 1], a .exchangeMenuSelectionLoop call Serial_ExchangeLinkMenuSelection ld a, [wLinkMenuSelectionReceiveBuffer] ld b, a and $f0 cp $d0 jr z, .asm_f5c7d ld a, [wLinkMenuSelectionReceiveBuffer + 1] ld b, a and $f0 cp $d0 jr nz, .exchangeMenuSelectionLoop .asm_f5c7d ld a, b and $c ; did the enemy press A or B? jr nz, .enemyPressedAOrB ; the enemy didn't press A or B ld a, [wLinkMenuSelectionSendBuffer] and $c ; did the player press A or B? jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection .enemyPressedAOrB ld a, [wLinkMenuSelectionSendBuffer] and $c ; did the player press A or B? jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection ; the enemy and the player both pressed A or B ; The gameboy that is clocking the connection wins. ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .doneChoosingMenuSelection .useEnemyMenuSelection ld a, $1 ld [wd11e], a ld a, b ld [wLinkMenuSelectionSendBuffer], a and $3 ld [wCurrentMenuItem], a ; wCurrentMenuItem .doneChoosingMenuSelection ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr nz, .skipStartingTransfer call DelayFrame call DelayFrame ld a, START_TRANSFER_INTERNAL_CLOCK ld [rSC], a .skipStartingTransfer ld b, " " ld c, " " ld d, " " ld e, "▷" ld a, [wLinkMenuSelectionSendBuffer] and (B_BUTTON << 2) ; was B button pressed? jr nz, .updateCursorPosition ; A button was pressed ld a, [wCurrentMenuItem] cp $2 jp z, .asm_f5963 ld b, e ld e, c ld a, [wCurrentMenuItem] and a jr z, .updateCursorPosition ld c, b ld b, d dec a jr z, .updateCursorPosition ld d, c ld c, b .updateCursorPosition call Func_f59ec call LoadScreenTilesFromBuffer1 ld a, [wLinkMenuSelectionSendBuffer] and (B_BUTTON << 2) ; was B button pressed? jr nz, .choseCancel ; cancel if B pressed ld a, [wCurrentMenuItem] cp $2 jr z, .choseCancel xor a ld [wWalkBikeSurfState], a ; start walking ld a, [wCurrentMenuItem] and a ld a, COLOSSEUM jr nz, .next ld a, TRADE_CENTER .next ld [wd72d], a ld hl, ColosseumPleaseWaitText call PrintText ld c, 50 call DelayFrames ld hl, wd732 res 1, [hl] ld a, [wDefaultMap] ld [wDestinationMap], a callab SpecialWarpIn ld c, 20 call DelayFrames xor a ld [wMenuJoypadPollCount], a ld [wSerialExchangeNybbleSendData], a inc a ; LINK_STATE_IN_CABLE_CLUB ld [wLinkState], a ld [wEnteringCableClub], a jpab SpecialEnterMap .choseCancel xor a ld [wMenuJoypadPollCount], a call Delay3 callab CloseLinkConnection ld hl, ColosseumCanceledText call PrintText ld hl, wd72e res 6, [hl] ret .asm_f5963 ld a,[wd11e] and a jr nz,.asm_f5974 ld b," " ld c," " ld d,"▷" ld e," " call Func_f59ec .asm_f5974 xor a ld [wBuffer], a ld a,$ff ld [wSerialExchangeNybbleReceiveData],a ld a, $b ld [wLinkMenuSelectionSendBuffer], a ld b,$78 .loop ld a,[hSerialConnectionStatus] cp $2 call z,DelayFrame dec b jr z,.asm_f59b2 call Serial_ExchangeNybble call DelayFrame ld a,[wSerialExchangeNybbleReceiveData] inc a jr z,.loop ld b,$f .loop2 call DelayFrame call Serial_ExchangeNybble dec b jr nz,.loop2 ld b,$f .loop3 call DelayFrame call Serial_SendZeroByte dec b jr nz,.loop3 jr .asm_f59d6 .asm_f59b2 xor a ld [wUnknownSerialCounter],a ld [wUnknownSerialCounter+1],a ld a,[wd11e] and a jr z,.asm_f59cd ld b," " ld c," " ld d," " ld e,"▷" call Func_f59ec jp .choseCancel .asm_f59cd ld hl,ColosseumVersionText call PrintText jp .choseCancel .asm_f59d6 ld b," " ld c," " ld d,"▷" ld e," " call Func_f59ec call Func_f531b jp c,.choseCancel ld a,$f0 jp .next Func_f59ec:: ld a, b Coorda 6, 5 ld a, c Coorda 6, 7 ld a, d Coorda 6, 9 ld a, e Coorda 6, 11 ld c, 40 call DelayFrames ret ColosseumWhereToText: TX_FAR _ColosseumWhereToText db "@" ColosseumPleaseWaitText: TX_FAR _ColosseumPleaseWaitText db "@" ColosseumCanceledText: TX_FAR _ColosseumCanceledText db "@" ColosseumVersionText: TX_FAR _ColosseumVersionText ; 28:4c47 db "@" TextTerminator_f5a16: db "@" TradeCenterText: db "TRADE CENTER" next "COLOSSEUM" next "COLOSSEUM2" next "CANCEL@"
llvm-gcc-4.2-2.9/gcc/ada/i-vxwork.ads
vidkidz/crossbridge
1
4567
<filename>llvm-gcc-4.2-2.9/gcc/ada/i-vxwork.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- I N T E R F A C E S . V X W O R K S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2005, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a limited binding to the VxWorks API -- In particular, it interfaces with the VxWorks hardware interrupt -- facilities, allowing the use of low-latency direct-vectored -- interrupt handlers. Note that such handlers have a variety of -- restrictions regarding system calls and language constructs. In particular, -- the use of exception handlers and functions returning variable-length -- objects cannot be used. Less restrictive, but higher-latency handlers can -- be written using Ada protected procedures, Ada 83 style interrupt entries, -- or by signalling an Ada task from within an interrupt handler using a -- binary semaphore as described in the VxWorks Programmer's Manual. -- -- For complete documentation of the operations in this package, please -- consult the VxWorks Programmer's Manual and VxWorks Reference Manual. with System.VxWorks; package Interfaces.VxWorks is pragma Preelaborate; ------------------------------------------------------------------------ -- Here is a complete example that shows how to handle the Interrupt 0x14 -- with a direct-vectored interrupt handler in Ada using this package: -- with Interfaces.VxWorks; use Interfaces.VxWorks; -- with System; -- -- package P is -- -- Count : Integer; -- pragma Atomic (Count); -- -- Level : constant := 1; -- -- Interrupt level used by this example -- -- procedure Handler (parameter : System.Address); -- -- end P; -- -- package body P is -- -- procedure Handler (parameter : System.Address) is -- S : STATUS; -- begin -- Count := Count + 1; -- logMsg ("received an interrupt" & ASCII.LF & ASCII.Nul); -- -- -- Acknowledge VME interrupt -- S := sysBusIntAck (intLevel => Level); -- end Handler; -- end P; -- -- with Interfaces.VxWorks; use Interfaces.VxWorks; -- with Ada.Text_IO; use Ada.Text_IO; -- -- with P; use P; -- procedure Useint is -- -- Be sure to use a reasonable interrupt number for the target -- -- board! -- -- This one is the unused VME graphics interrupt on the PPC MV2604 -- Interrupt : constant := 16#14#; -- -- task T; -- -- S : STATUS; -- -- task body T is -- begin -- loop -- Put_Line ("Generating an interrupt..."); -- delay 1.0; -- -- -- Generate VME interrupt, using interrupt number -- S := sysBusIntGen (1, Interrupt); -- end loop; -- end T; -- -- begin -- S := sysIntEnable (intLevel => Level); -- S := intConnect (INUM_TO_IVEC (Interrupt), handler'Access); -- -- loop -- delay 2.0; -- Put_Line ("value of count:" & P.Count'Img); -- end loop; -- end Useint; ------------------------------------- subtype int is Integer; type STATUS is new int; -- Equivalent of the C type STATUS OK : constant STATUS := 0; ERROR : constant STATUS := -1; type VOIDFUNCPTR is access procedure (parameter : System.Address); type Interrupt_Vector is new System.Address; type Exception_Vector is new System.Address; function intConnect (vector : Interrupt_Vector; handler : VOIDFUNCPTR; parameter : System.Address := System.Null_Address) return STATUS; -- Binding to the C routine intConnect. Use this to set up an -- user handler. The routine generates a wrapper around the user -- handler to save and restore context function intContext return int; -- Binding to the C routine intContext. This function returns 1 only -- if the current execution state is in interrupt context. function intVecGet (Vector : Interrupt_Vector) return VOIDFUNCPTR; -- Binding to the C routine intVecGet. Use this to get the -- existing handler for later restoral procedure intVecSet (Vector : Interrupt_Vector; Handler : VOIDFUNCPTR); -- Binding to the C routine intVecSet. Use this to restore a -- handler obtained using intVecGet function INUM_TO_IVEC (intNum : int) return Interrupt_Vector; -- Equivalent to the C macro INUM_TO_IVEC used to convert an interrupt -- number to an interrupt vector function sysIntEnable (intLevel : int) return STATUS; -- Binding to the C routine sysIntEnable function sysIntDisable (intLevel : int) return STATUS; -- Binding to the C routine sysIntDisable function sysBusIntAck (intLevel : int) return STATUS; -- Binding to the C routine sysBusIntAck function sysBusIntGen (intLevel : int; Intnum : int) return STATUS; -- Binding to the C routine sysBusIntGen. Note that the T2 -- documentation implies that a vector address is the proper -- argument - it's not. The interrupt number in the range -- 0 .. 255 (for 68K and PPC) is the correct agument. procedure logMsg (fmt : String; arg1, arg2, arg3, arg4, arg5, arg6 : int := 0); -- Binding to the C routine logMsg. Note that it is the caller's -- responsibility to ensure that fmt is a null-terminated string -- (e.g logMsg ("Interrupt" & ASCII.NUL)) type FP_CONTEXT is private; -- Floating point context save and restore. Handlers using floating -- point must be bracketed with these calls. The pFpContext parameter -- should be an object of type FP_CONTEXT that is -- declared local to the handler. procedure fppRestore (pFpContext : in out FP_CONTEXT); -- Restore floating point context procedure fppSave (pFpContext : in out FP_CONTEXT); -- Save floating point context private type FP_CONTEXT is new System.VxWorks.FP_CONTEXT; -- Target-dependent floating point context type pragma Import (C, intConnect, "intConnect"); pragma Import (C, intContext, "intContext"); pragma Import (C, intVecGet, "intVecGet"); pragma Import (C, intVecSet, "intVecSet"); pragma Import (C, INUM_TO_IVEC, "__gnat_inum_to_ivec"); pragma Import (C, sysIntEnable, "sysIntEnable"); pragma Import (C, sysIntDisable, "sysIntDisable"); pragma Import (C, sysBusIntAck, "sysBusIntAck"); pragma Import (C, sysBusIntGen, "sysBusIntGen"); pragma Import (C, logMsg, "logMsg"); pragma Import (C, fppRestore, "fppRestore"); pragma Import (C, fppSave, "fppSave"); end Interfaces.VxWorks;
src/main/antlr/SLK.g4
Cokemonkey11/wc3libs
22
5721
// Define a grammar called SLK grammar SLK; options { language = Java; } @header { package net.moonlightflower.wc3libs.antlr; } RECORD_PART: (STRING_UNQUOTED STRING_QUOTED?) | STRING_QUOTED; fragment STRING_UNQUOTED: ( EscapeSequence | ~('"'|'\r'|'\n'|';') )+; fragment STRING_QUOTED: '"' ( EscapeSequence | ~('"'|'\r'|'\n') | NEW_LINE )* '"'; fragment EscapeSequence: '\\' [abfnrtvz"'\\]; SEP: ';'; NEW_LINE: ('\r\n' | '\n' | '\r')+ ; WS: (' ' | '\t')+ -> skip ; root: records+=record (NEW_LINE+ records+=record)* NEW_LINE* ; record: type=RECORD_PART (SEP recordPart?)*; recordPart: RECORD_PART;
agda-stdlib/src/Relation/Binary/Reasoning/PartialSetoid.agda
DreamLinuxer/popl21-artifact
5
13209
<reponame>DreamLinuxer/popl21-artifact ------------------------------------------------------------------------ -- The Agda standard library -- -- Convenient syntax for reasoning with a partial setoid ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} open import Relation.Binary module Relation.Binary.Reasoning.PartialSetoid {s₁ s₂} (S : PartialSetoid s₁ s₂) where open PartialSetoid S import Relation.Binary.Reasoning.Base.Partial _≈_ trans as Base ------------------------------------------------------------------------ -- Re-export the contents of the base module open Base public hiding (step-∼) ------------------------------------------------------------------------ -- Additional reasoning combinators infixr 2 step-≈ step-≈˘ -- A step using an equality step-≈ = Base.step-∼ syntax step-≈ x y≈z x≈y = x ≈⟨ x≈y ⟩ y≈z -- A step using a symmetric equality step-≈˘ : ∀ x {y z} → y IsRelatedTo z → y ≈ x → x IsRelatedTo z step-≈˘ x y∼z y≈x = x ≈⟨ sym y≈x ⟩ y∼z syntax step-≈˘ x y≈z y≈x = x ≈˘⟨ y≈x ⟩ y≈z
1541/64tass/erproc.asm
silverdr/assembly
23
11369
<filename>1541/64tass/erproc.asm ; error processing ; controller errors ; 0 (1) no error ; 20 (2) can't find block header ; 21 (3) no synch character ; 22 (4) data block not present ; 23 (5) checksum error in data ; 24 (16) byte decoding error ; 25 (7) write-verify error ; 26 (8) write w/ write protect on ; 27 (9) checksum error in header ; 28 (10) data extends into next block ; 29 (11) disk i.d. mismatch ; command errors ; 30 general syntax ; 31 invalid command ; 32 long line ; 33 invalid filname ; 34 no file given ; 39 command file not found ; 50 record not present ; 51 overflow in record ; 52 file too large ; 60 file open for write ; 61 file not open ; 62 file not found ; 63 file exists ; 64 file type mismatch ; 65 no block ; 66 illegal track or sector ; 67 illegal system t or s ; 70 no channels available ; 71 directory error ; 72 disk full ; 73 cbm dos v2.6 ; 74 drive not ready ; 1 files scratched response badsyn =$30 badcmd =$31 longln =$32 badfn =$33 nofile =$34 nocfil =$39 norec =$50 recovf =$51 bigfil =$52 filopn =$60 filnop =$61 flntfd =$62 flexst =$63 mistyp =$64 noblk =$65 badts =$66 systs =$67 nochnl =$70 direrr =$71 dskful =$72 cbmv2 =$73 nodriv =$74 ; error message table ; leading errror numbers, ; text with 1st & last chars ; or'ed with $80, ; tokens for key words are ; less than $10 (and'ed w/ $80) errtab ; " OK" .text 0,$a0,'O',$cb ;"read error" .text $20,$21,$22,$23,$24,$27 .text $d2,'EAD',$89 ;" file too large" .text $52,$83,' TOO LARG',$c5 ;" record not present" .text $50,$8b,6,' PRESEN',$d4 ;"overflow in record" .text $51,$cf,'VERFLOW ' .text 'IN',$8b ;" write error" .text $25,$28,$8a,$89 ;" write protect on" .text $26,$8a,' PROTECT O',$ce ;" disk id mismatch" .text $29,$88,' ID',$85 ;"syntax error" .text $30,$31,$32,$33,$34 .text $d3,'YNTAX',$89 ;" write file open" .text $60,$8a,3,$84 ;" file exists" .text $63,$83,' EXIST',$d3 ;" file type mismatch" .text $64,$83,' TYPE',$85 ;"no block" .text $65,$ce,'O BLOC',$cb ;"illegal track or sector" .text $66,$67,$c9,'LLEGAL TRACK' .text ' OR SECTO',$d2 ;" file not open" .text $61,$83,6,$84 ;" file not found" .text $39,$62,$83,6,$87 ;" files scratched" .text 1,$83,'S SCRATCHE',$c4 ;"no channel" .text $70,$ce,'O CHANNE',$cc ;"dir error" .text $71,$c4,'IR',$89 ;" disk full" .text $72,$88,' FUL',$cc ;"cbm dos v2.6 1541" .text $73,$c3,'BM DOS V2.6 154',$b1 ;"drive not ready" .text $74,$c4,'RIVE',6,' READ',$d9 ; error token key words ; words used more than once ;"error" .text 9,$c5,'RRO',$d2 ;"write" .text $a,$d7,'RIT',$c5 ;"file" .text 3,$c6,'IL',$c5 ;"open" .text 4,$cf,'PE',$ce ;"mismatch" .text 5,$cd,'ISMATC',$c8 ;"not" .text 6,$ce,'O',$d4 ;"found" .text 7,$c6,'OUN',$c4 ;"disk" .text 8,$c4,'IS',$cb ;"record" .text $b,$d2,'ECOR',$c4 etend =* ; controller error entry ; .a= error # ; .x= job # error pha stx jobnum rtch46 txa asl a tax lda hdrs,x ; 4/12********* track,sector sta track lda hdrs+1,x ; 4/12********* sta sector pla and #$f ; convert controller... beq err1 ; ...errors to dos errors cmp #$f ; check nodrive error bne err2 lda #nodriv bne err3 ; bra err1 lda #6 ; code=16-->14 err2 ora #$20 tax dex dex txa err3 pha lda cmdnum cmp #val bne err4 lda #$ff sta cmdnum pla jsr errmsg jsr initdr ; init for validate jmp cmder3 err4 pla cmder2 jsr errmsg cmder3 jsr clrcb ; clear cmdbuf lda #0 sta wbam ; clear after error jsr erron ; set error led jsr freich ; free internal channel lda #0 ; clear pointers sta buftab+cbptr ldx #topwrt txs ; purge stack lda orgsa and #$f sta sa cmp #$f beq err10 sei lda lsnact bne lsnerr lda tlkact bne tlkerr ldx sa lda lintab,x cmp #$ff beq err10 and #$f sta lindx jmp tlerr ; talker error recovery ; if command channel, release dav ; if data channel, force not ready ; and release channel tlkerr jsr fndrch ; jsr iterr ; *** rom - 05 fix 8/18/83 *** .byte $ea,$ea,$ea ; fill in 'jsr' bne tlerr ; finish ; listener error recovery ; if command channel, release rfd ; if data channel, force not ready ; and release channel lsnerr jsr fndwch ; jsr ilerr ; *** rom - 05 fix 8/18/83 *** .byte $ea,$ea,$ea ; fill in 'jsr' tlerr jsr typfil cmp #reltyp bcs err10 jsr frechn err10 jmp idle ; convert hex to bcd hexdec tax ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><> jmp ptch67 ; *** rom ds 05/15/86 *** ; lda #0 ; sed hex0 cpx #0 beq hex5 clc adc #1 dex jmp hex0 ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><> hex5 cld ; convert bcd to ascii dec ; return bcd in .x ; store ascii in (temp),y bcddec tax lsr a lsr a lsr a lsr a jsr bcd2 txa bcd2 and #$f ora #$30 sta (cb+2),y iny rts ; transfer error message to ; error buffer okerr jsr erroff lda #0 errts0 ldy #0 sty track sty sector errmsg ldy #0 ldx #<errbuf stx cb+2 ldx #>errbuf stx cb+3 jsr bcddec ; convert error # lda #',' sta (cb+2),y iny lda errbuf sta chndat+errchn txa ; error # in .x jsr ermove ; move message ermsg2 lda #',' sta (cb+2),y iny lda track jsr hexdec ; convert track # lda #',' sta (cb+2),y iny lda sector ; convert sector # jsr hexdec dey tya clc adc #<errbuf ; set last char sta lstchr+errchn inc cb+2 lda #rdytlk sta chnrdy+errchn rts ;**********************************; ;* ermove - move error message *; ;* from errtab to errbuf. *; ;* fully recursive for token *; ;* word prosessing. *; ;* input: .a= bcd error number *; ;**********************************; ermove tax ; save .a lda r0 ; save r0,r0+1 pha lda r0+1 pha lda #<errtab ; set pointer to table sta r0 lda #>errtab sta r0+1 txa ; restore .a ldx #0 ; .x=0 for indirect e10 cmp (r0,x) ; ?error # = table entry? beq e50 ; yes, send message pha ; save error # jsr eadv2 ; check & advance ptr bcc e30 ; more #'s to check e20 jsr eadv2 ; advance past this message bcc e20 e30 lda r0+1 ; check ptr cmp #>etend bcc e40 ; <, continue bne e45 ; >, quit lda #<etend cmp r0 bcc e45 ; past end of table e40 pla ; restore error # jmp e10 ; check next entry e45 pla ; pop error # jmp e90 ; go quit e50 ; the number has been located jsr eadv1 bcc e50 ; advance past other #'s e55 jsr e60 jsr eadv1 bcc e55 jsr e60 ; check for token or last word e90 pla ; all finished sta r0+1 ; restore r0 pla sta r0 rts e60 cmp #$20 ; (max token #)+1 bcs e70 ; not a token tax lda #$20 ; implied leading space sta (cb+2),y iny txa ; restore token # jsr ermove ; add token word to message rts e70 sta (cb+2),y ; put char in message iny rts ;error advance & check eadv1 ; pre-increment inc r0 ; advance ptr bne ea10 inc r0+1 ea10 lda (r0,x) ; get current entry asl a ; .c=1 is end or beginning lda (r0,x) and #$7f ; mask off bit7 rts eadv2 ; post-increment jsr ea10 ; check table entry inc r0 bne ea20 inc r0+1 ea20 rts
src/nrf24l01.ads
JeremyGrosser/sensors
1
13731
-- -- Copyright (C) 2022 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- -- nRF24L01+ 2.4 GHz GFSK modem -- -- This driver disables the Enhanced ShockBurst™ acknowledgement and checksum -- features and just acts like a dumb GFSK modem. You will need to add your -- own checksum, error correction codes, and acknowledgement protocol as -- needed. -- -- Think of the NRF_Address as more of a preamble than a way of ensuring that -- frames get to the right place. Add a header to your data if this is -- important to your application. -- -- Frequency hopping, data whitening and parity are good ideas. -- with Ada.Unchecked_Conversion; with HAL.SPI; use HAL.SPI; with HAL; use HAL; with HAL.GPIO; package NRF24L01 is type Device (Port : HAL.SPI.Any_SPI_Port; CS : HAL.GPIO.Any_GPIO_Point; CE : HAL.GPIO.Any_GPIO_Point) is tagged private; subtype NRF_Address_Width is Positive range 3 .. 5; type NRF_Address (Width : NRF_Address_Width) is record Addr : UInt8_Array (1 .. Width); end record; type NRF_Channel is range 2_400 .. 2_527; -- MHz, default 2_476 type NRF_Payload_Length is range 1 .. 32; type NRF_Transmit_Power is (Low_Power, -- -18 dBm Medium_Power, -- -12 dBm High_Power, -- -6 dBm Max_Power); -- 0 dBm (default) type NRF_Data_Rate is (Low_Rate, -- 125 Kbps Medium_Rate, -- 1 Mbps High_Rate); -- 2 Mbps (default) procedure Initialize (This : in out Device); procedure Interrupt (This : in out Device); -- Interrupt must be called upon the falling edge of the IRQ pin. Failure -- to do so will make Receive stop working and Transmit may keep the -- amplifier turned on for too long and and damage your chip. procedure Set_Channel (This : in out Device; MHz : NRF_Channel); procedure Set_Data_Rate (This : in out Device; Rate : NRF_Data_Rate); function Is_Transmitting (This : Device) return Boolean; procedure Transmit (This : in out Device; Addr : NRF_Address; Data : UInt8_Array; Power : NRF_Transmit_Power := Max_Power) with Pre => not This.Is_Transmitting; procedure Listen (This : in out Device; Addr : NRF_Address; Length : NRF_Payload_Length); procedure Receive (This : in out Device; Data : out UInt8_Array); procedure Power_Down (This : in out Device); function Data_Ready (This : in out Device) return Natural; -- Number of frames waiting in the receive FIFO. -- Don't call Receive if Data_Ready = 0 procedure Poll (This : in out Device); private type NRF_Mode is (Idle, Transmitting, Receiving); type Device (Port : HAL.SPI.Any_SPI_Port; CS : HAL.GPIO.Any_GPIO_Point; CE : HAL.GPIO.Any_GPIO_Point) is tagged record Mode : NRF_Mode := Idle; RX_DR : Natural with Atomic; Rate_Low : Boolean; Rate_High : Boolean; end record; type Register is (CONFIG, EN_AA, EN_RXADDR, SETUP_AW, SETUP_RETR, RF_CH, RF_SETUP, STATUS, OBSERVE_TX, RPD, RX_ADDR_P0, RX_ADDR_P1, RX_ADDR_P2, RX_ADDR_P3, RX_ADDR_P4, RX_ADDR_P5, TX_ADDR, RX_PW_P0, RX_PW_P1, RX_PW_P2, RX_PW_P3, RX_PW_P4, RX_PW_P5, FIFO_STATUS, DYNPD, FEATURE); for Register use (CONFIG => 16#00#, EN_AA => 16#01#, EN_RXADDR => 16#02#, SETUP_AW => 16#03#, SETUP_RETR => 16#04#, RF_CH => 16#05#, RF_SETUP => 16#06#, STATUS => 16#07#, OBSERVE_TX => 16#08#, RPD => 16#09#, RX_ADDR_P0 => 16#0A#, RX_ADDR_P1 => 16#0B#, RX_ADDR_P2 => 16#0C#, RX_ADDR_P3 => 16#0D#, RX_ADDR_P4 => 16#0E#, RX_ADDR_P5 => 16#0F#, TX_ADDR => 16#10#, RX_PW_P0 => 16#11#, RX_PW_P1 => 16#12#, RX_PW_P2 => 16#13#, RX_PW_P3 => 16#14#, RX_PW_P4 => 16#15#, RX_PW_P5 => 16#16#, FIFO_STATUS => 16#17#, DYNPD => 16#1C#, FEATURE => 16#1D#); type STATUS_Register is record RX_DR : Boolean := False; TX_DS : Boolean := False; MAX_RT : Boolean := False; RX_P_NO : UInt3 := 0; TX_FULL : Boolean := False; end record with Size => 8; for STATUS_Register use record RX_DR at 0 range 6 .. 6; TX_DS at 0 range 5 .. 5; MAX_RT at 0 range 4 .. 4; RX_P_NO at 0 range 1 .. 3; TX_FULL at 0 range 0 .. 0; end record; function To_STATUS_Register is new Ada.Unchecked_Conversion (Source => UInt8, Target => STATUS_Register); type CONFIG_PRIM_RX_Field is (PTX, PRX) with Size => 1; type CONFIG_Register is record MASK_RX_DR : Boolean := False; MASK_TX_DS : Boolean := False; MASK_MAX_RT : Boolean := False; EN_CRC : Boolean := True; CRCO : Boolean := False; PWR_UP : Boolean := False; PRIM_RX : CONFIG_PRIM_RX_Field := PTX; end record with Size => 8; for CONFIG_Register use record MASK_RX_DR at 0 range 6 .. 6; MASK_TX_DS at 0 range 5 .. 5; MASK_MAX_RT at 0 range 4 .. 4; EN_CRC at 0 range 3 .. 3; CRCO at 0 range 2 .. 2; PWR_UP at 0 range 1 .. 1; PRIM_RX at 0 range 0 .. 0; end record; function To_UInt8 is new Ada.Unchecked_Conversion (Source => CONFIG_Register, Target => UInt8); type RF_SETUP_Register is record CONT_WAVE : Boolean := False; RF_DR_LOW : Boolean := False; PLL_LOCK : Boolean := False; RF_DR_HIGH : Boolean := True; RF_PWR : UInt2 := 2#11#; end record with Size => 8; for RF_SETUP_Register use record CONT_WAVE at 0 range 7 .. 7; RF_DR_LOW at 0 range 5 .. 5; PLL_LOCK at 0 range 4 .. 4; RF_DR_HIGH at 0 range 3 .. 3; RF_PWR at 0 range 1 .. 2; end record; function To_UInt8 is new Ada.Unchecked_Conversion (Source => RF_SETUP_Register, Target => UInt8); procedure SPI_Transfer (This : in out Device; Data : in out SPI_Data_8b); procedure W_REGISTER (This : in out Device; Reg : Register; Data : UInt8_Array); procedure W_REGISTER (This : in out Device; Reg : Register; Data : UInt8); procedure R_REGISTER (This : in out Device; Reg : Register; Data : out UInt8); procedure FLUSH_TX (This : in out Device); procedure FLUSH_RX (This : in out Device); procedure W_TX_PAYLOAD (This : in out Device; Data : UInt8_Array); procedure R_RX_PAYLOAD (This : in out Device; Data : out UInt8_Array); procedure NOP (This : in out Device; Status : out STATUS_Register); procedure Clear_Status (This : in out Device); procedure Set_Transmit_Address (This : in out Device; Addr : NRF_Address); procedure Set_Receive_Address (This : in out Device; Addr : NRF_Address); end NRF24L01;
menu/test menu click.applescript
kinshuk4/evernote-automation
4
63
repeat 5 times --delay 0.1 menu_click({"Evernote", "Format", "Style", "Bigger"}) --keystroke "+" using command down end repeat tell application "System Events" keystroke "b" using command down end tell -- `menu_click`, by <NAME>, September 2006 -- -- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}` -- Execute the specified menu item. In this case, assuming the Finder -- is the active application, arranging the frontmost folder by date. on menu_click(mList) local appName, topMenu, r -- Validate our input if mList's length < 3 then error "Menu list is not long enough" -- Set these variables for clarity and brevity later on set {appName, topMenu} to (items 1 through 2 of mList) set r to (items 3 through (mList's length) of mList) -- This overly-long line calls the menu_recurse function with -- two arguments: r, and a reference to the top-level menu tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬ (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu))) end menu_click on menu_click_recurse(mList, parentObject) local f, r -- `f` = first item, `r` = rest of items set f to item 1 of mList if mList's length > 1 then set r to (items 2 through (mList's length) of mList) -- either actually click the menu item, or recurse again tell application "System Events" if mList's length is 1 then click parentObject's menu item f else my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f))) end if end tell end menu_click_recurse
Working Disassembly/General/Blue Sphere/Map - Results Emerald.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
104421
<gh_stars>1-10 Map_4E316: dc.w word_4E324-Map_4E316 dc.w word_4E32C-Map_4E316 dc.w word_4E334-Map_4E316 dc.w word_4E33C-Map_4E316 dc.w word_4E344-Map_4E316 dc.w word_4E34C-Map_4E316 dc.w word_4E354-Map_4E316 word_4E324: dc.w 1 dc.b $F8, 5, $40, $4C, $FF, $F8 word_4E32C: dc.w 1 dc.b $F8, 5, $40, $48, $FF, $F8 word_4E334: dc.w 1 dc.b $F8, 5, $40, $50, $FF, $F8 word_4E33C: dc.w 1 dc.b $F8, 5, $20, $48, $FF, $F8 word_4E344: dc.w 1 dc.b $F8, 5, 0, $58, $FF, $F8 word_4E34C: dc.w 1 dc.b $F8, 5, 0, $54, $FF, $F8 word_4E354: dc.w 1 dc.b $F8, 5, $20, $4C, $FF, $F8
source/textio/a-llctio.ads
ytomino/drake
33
30926
pragma License (Unrestricted); with Ada.Numerics.Long_Long_Complex_Types; with Ada.Text_IO.Complex_IO; package Ada.Long_Long_Complex_Text_IO is new Text_IO.Complex_IO (Numerics.Long_Long_Complex_Types);
misc/Lib/wait_till_network_available.applescript
kinshuk4/evernote-automation
4
416
<filename>misc/Lib/wait_till_network_available.applescript repeat with i from 1 to 15 try do shell script "ping -o baidu.com" exit repeat on error if i = 15 then return false delay 0.33 end try end repeat return true
annealing/src/simulated_annealing.ads
kochab/simulatedannealing-ada
0
17695
<reponame>kochab/simulatedannealing-ada -- @summary -- Simulated annealing metaheuristic library. -- -- @description -- This package provides routines for the minimization of black-box -- functions using simulated annealing. package Simulated_Annealing is -- Annealing scheduler. type Scheduler is private; function Exponential (N : Positive; T0 : Float) return Scheduler; -- Create a new exponential (geometric) annealing scheduler. -- @param N The number of cooling steps. -- @param T0 The starting temperature. -- @return The geometric annealing scheduler. procedure Step (S : in out Scheduler); -- Perform a cool-down step. -- @param S The annealing scheduler. function Temperature (S : in Scheduler) return Float; -- Return the current temperature. -- @param S The annealing scheduler. -- @return The annealing schedule's current temperature. -- @summary -- Simulated annealing minimizer. -- -- @description -- Provides an implementation of a simulated annealing -- minimization algorithm. generic -- State type. type State is private; -- State energy function. with function Energy (S : in State) return Float; -- State perturbation function. with function Perturb (S : in out State) return State; package Optimization is -- Minimization progress record. type Minimization is private; function Minimize (S0 : in State) return Minimization; -- Create a new minimizer. -- @param S0 The initial state. -- @return The minimization progress record. function Step (M : in out Minimization; S : in out Scheduler; Improved : out Boolean) return Boolean; -- Perform a minimization iteration. -- @param M The minimization progress record. -- @param S The annealing scheduler to use. -- @param Improved True if a new local minimum was found, false otherwise. -- @return True if the annealing process is unfinished, false otherwise. function Minimum (M : in Minimization) return State; -- Return the best minimum found so far. -- @param M The minimization progress record. -- @return The best-so-far minimum state found. private type Minimization is record S_I : State; S_Min : State; end record; end Optimization; private type Scheduler is record T0 : Float; Decay : Float; I : Natural; end record; end Simulated_Annealing;
hacks/images/m6502/santa.asm
MBrassey/xscreensaver_BlueMatrix
2
81160
<filename>hacks/images/m6502/santa.asm start: ldx #0 cs: lda $2000,x sta $500,x dex bne cs stx $20 loop: inc $20 lda $20 and #$7f tay and #$1f tax lda sinus,x tax d: lda #0 sta $1e0,x sta $2e0,x lda $1000,y sta $200,x lda $1080,y sta $220,x lda $1100,y sta $240,x lda $1180,y sta $260,x lda $1200,y sta $280,x lda $1280,y sta $2a0,x lda $1300,y sta $2c0,x lda $1380,y sta $2c0,x inx iny txa and #$1f bne d jmp loop ; 32 ($20) long sinus: dcb 0,0,0,0,$20,$20,$20 dcb $40,$40,$60,$80,$a0,$a0,$c0,$c0,$c0 dcb $e0,$e0,$e0,$e0,$c0,$c0,$c0 dcb $a0,$a0,$80,$60,$40,$40,$20,$20,$20 *=$1000 santa: dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,$a,$a,0,0,0,0,0,0 dcb 0,0,0,0,0,$a,$a,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,2,2,2,1,0,0,0,0,$9,$9,$9,$9,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,$a,$a,$a,0,0,0,0,0 dcb 0,0,0,0,0,$a,$a,$a,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,$9,$9,0,0,0,0,0,0,0,0 dcb 0,1,1,2,2,0,$9,$9,$9,$9,$9,$9,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,$a,$a,$a,$a,$a,$a,0,0,0,0 dcb 0,0,0,$a,$a,$a,$a,$a,$a,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,$9,$9,$9,0,0,0,0,0,0 dcb 0,1,2,2,$9,$9,$9,$9,$9,$9,$9,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,$a,$a,$a,$a,$a,$a,$b dcb $b,$b,$b,$b,$b,$b,$a,$a,$a,$a,$a,$a,$b,$b,$b,$b dcb $b,$b,$b,$b,$b,$9,$9,$9,$9,$9,$9,$9,$9,$9,$9,$9 dcb $9,2,2,$9,$9,$9,$9,$9,$9,$9,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,$a,$a,$a,$a,$a,$a,$a dcb $a,0,0,0,0,0,$a,$a,$a,$a,$a,$a,$a,$a,0,0 dcb 0,0,0,0,0,0,0,$9,$9,$9,$9,$9,$9,$9,$9,$9 dcb 2,2,$9,$9,$9,$9,$9,$9,$9,$9,$9,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,$a,$a,$a,$a,$a,$a,0 dcb $a,$a,0,0,0,0,$a,$a,$a,$a,$a,$a,0,$a,$a,0 dcb 0,0,0,0,0,$a,$a,0,0,$9,$a,$9,$9,$9,$9,$9 dcb $9,$9,$a,$9,$9,$9,$9,$9,$9,$9,$9,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,$a,0,$a,0,0,$a,0 dcb 0,$a,0,0,0,0,$a,0,$a,0,0,$a,0,0,$a,0 dcb 0,0,0,0,0,$a,0,0,0,$a,0,0,0,0,0,0 dcb 0,$a,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,$a,$a,0,$a,0,0,$a,$a dcb 0,$a,$a,0,0,$a,$a,0,$a,0,0,$a,$a,0,$a,$a dcb 0,0,0,0,0,0,$a,$a,$a,$a,$a,$a,$a,$a,$a,$a dcb $a,$a,$a,$a,$a,$a,$a,$a,$a,$a,$a,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 *=$2000 dcb 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0 dcb 0,0,0,0,0,0,0,0,0,0,0,0,$c,1,1,1 dcb 0,0,0,0,0,0,0,0,0,0,0,1,1,1,$a,$a dcb 0,0,0,0,0,0,0,0,0,0,$c,1,1,1,1,1 dcb 1,1,$c,0,0,0,0,0,0,0,0,0,1,1,0,0 dcb 0,0,0,0,0,0,0,0,$c,1,1,1,1,1,1,1 dcb 1,1,1,1,1,$c,0,0,0,0,0,1,1,1,1,0 dcb 0,0,0,0,0,0,$c,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,$c,0,0,0,0,1,1,1,1,0 dcb 0,0,0,0,0,$c,1,1,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,1,1,$c,0,0,1,1,0,0 dcb 0,0,$c,1,1,1,1,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 dcb 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
src/lone.asm
tautology0/sagarework
0
83260
<filename>src/lone.asm GRAPHICS=0 ADAMS=1 EXITCOL=134 OBJCOL=131 MESSCOL=131 SYSCOL=135 TEXTCOL=39 INPUTCOL=134 include "engine.asm" include "samessages.asm" .objsep equb ".",0 .end save "ENGINE",start,end ; add game files - disk1 putfile "lonesurvivor\lone","G.LONE",datastart putbasic "lonesurvivor\LOAD.txt","LOAD" puttext "lonesurvivor\boot","!BOOT",0
programs/oeis/175/A175822.asm
karttu/loda
0
15673
; A175822: Partial sums of ceiling(n^2/7). ; 0,1,2,4,7,11,17,24,34,46,61,79,100,125,153,186,223,265,312,364,422,485,555,631,714,804,901,1006,1118,1239,1368,1506,1653,1809,1975,2150,2336,2532,2739,2957,3186,3427,3679,3944,4221,4511,4814,5130,5460,5803,6161,6533,6920,7322,7739,8172,8620,9085,9566,10064,10579,11111,11661,12228,12814,13418,14041,14683,15344,16025,16725,17446,18187,18949,19732,20536,21362,22209,23079,23971,24886,25824,26785,27770,28778,29811,30868,31950,33057,34189,35347,36530,37740,38976,40239,41529,42846,44191,45563,46964,48393,49851,51338,52854,54400,55975,57581,59217,60884,62582,64311,66072,67864,69689,71546,73436,75359,77315,79305,81328,83386,85478,87605,89767,91964,94197,96465,98770,101111,103489,105904,108356,110846,113373,115939,118543,121186,123868,126589,129350,132150,134991,137872,140794,143757,146761,149807,152894,156024,159196,162411,165669,168970,172315,175703,179136,182613,186135,189702,193314,196972,200675,204425,208221,212064,215954,219891,223876,227908,231989,236118,240296,244523,248799,253125,257500,261926,266402,270929,275507,280136,284817,289549,294334,299171,304061,309004,314000,319050,324153,329311,334523,339790,345112,350489,355922,361410,366955,372556,378214,383929,389701,395531,401418,407364,413368,419431,425553,431734,437975,444275,450636,457057,463539,470082,476686,483352,490079,496869,503721,510636,517614,524655,531760,538928,546161,553458,560820,568247,575739,583297,590920,598610,606366,614189,622079,630036,638061,646153,654314,662543,670841,679208,687644,696150,704725,713371,722087,730874,739732 mov $2,$0 mov $3,$0 lpb $2,1 mov $0,$3 sub $2,1 sub $0,$2 mov $5,$0 pow $5,2 mov $4,$5 add $4,6 div $4,7 add $1,$4 lpe
src/aco-protocols-service_data-servers.adb
jonashaggstrom/ada-canopen
6
9863
<reponame>jonashaggstrom/ada-canopen<gh_stars>1-10 package body ACO.Protocols.Service_Data.Servers is overriding procedure Handle_Message (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; use type ACO.SDO_Sessions.Services; Service : constant ACO.SDO_Sessions.Services := This.Sessions.Service (Endpoint.Id); State_Error : Boolean := False; begin case Get_CS (Msg) is when Download_Initiate_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Initiate"); if Service = ACO.SDO_Sessions.None then This.Download_Init (Msg, Endpoint); else State_Error := True; end if; when Download_Segment_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Segment"); if Service = ACO.SDO_Sessions.Download then This.Download_Segment (Msg, Endpoint); else State_Error := True; end if; when Upload_Initiate_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Initiate"); if Service = ACO.SDO_Sessions.None then This.Upload_Init (Msg, Endpoint); else State_Error := True; end if; when Upload_Segment_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Segment"); if Service = ACO.SDO_Sessions.Upload then This.Upload_Segment (Msg, Endpoint); else State_Error := True; end if; when Abort_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Abort"); This.Abort_All (Msg, Endpoint); when others => null; end case; if State_Error then This.Send_Abort (Endpoint => Endpoint, Error => Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control); end if; end Handle_Message; procedure Upload_Init (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg); Error : Error_Type := Nothing; Session : ACO.SDO_Sessions.SDO_Session; begin if not This.Od.Entry_Exist (Index.Object, Index.Sub) then Error := Object_Does_Not_Exist_In_The_Object_Dictionary; elsif not This.Od.Is_Entry_Readable (Index) then Error := Attempt_To_Read_A_Write_Only_Object; end if; Session := ACO.SDO_Sessions.Create_Upload (Endpoint, Index); if Error /= Nothing then This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; declare Ety : constant ACO.OD_Types.Entry_Base'Class := This.Od.Get_Entry (Index.Object, Index.Sub); Size : Natural; Resp : Upload_Initiate_Resp; begin Size := Ety.Data_Length; if Size > ACO.Configuration.Max_SDO_Transfer_Size then This.Send_Abort (Endpoint, General_Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; if Size <= Expedited_Data'Length then Resp := Create (Index, ACO.Messages.Data_Array (Ety.Read)); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else Resp := Create (Index, Size); This.Sessions.Clear_Buffer (Endpoint.Id); This.Sessions.Put_Buffer (Endpoint.Id, ACO.Messages.Data_Array (Ety.Read)); This.Start_Alarm (Endpoint.Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; This.Send_SDO (Endpoint, Resp.Raw); end; end Upload_Init; procedure Upload_Segment (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Upload_Segment_Cmd := Convert (Msg); Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id; Bytes_Remain : constant Natural := This.Sessions.Length_Buffer (Id); Session : ACO.SDO_Sessions.SDO_Session; Error : Error_Type := Nothing; begin Session := This.Sessions.Get (Id); if Cmd.Toggle /= Session.Toggle then Error := Toggle_Bit_Not_Altered; elsif Bytes_Remain = 0 then Error := General_Error; end if; if Error /= Nothing then This.Send_Abort (Endpoint => Endpoint, Error => Error, Index => Session.Index); This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; declare Bytes_To_Send : constant Positive := Natural'Min (Bytes_Remain, Segment_Data'Length); Data : ACO.Messages.Data_Array (0 .. Bytes_To_Send - 1); Resp : Upload_Segment_Resp; Is_Complete : constant Boolean := (Bytes_To_Send = Bytes_Remain); begin This.Sessions.Get_Buffer (Endpoint.Id, Data); Resp := Create (Toggle => Session.Toggle, Is_Complete => Is_Complete, Data => Data); This.Send_SDO (Endpoint => Endpoint, Raw_Data => Resp.Raw); This.SDO_Log (ACO.Log.Debug, "Server: Sent data of length" & Bytes_To_Send'Img); if Is_Complete then This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else Session.Toggle := not Session.Toggle; This.Start_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end; end Upload_Segment; procedure Download_Init (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Download_Initiate_Cmd := Convert (Msg); Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg); Error : Error_Type := Nothing; Session : ACO.SDO_Sessions.SDO_Session; Resp : Download_Initiate_Resp; begin if not This.Od.Entry_Exist (Index.Object, Index.Sub) then Error := Object_Does_Not_Exist_In_The_Object_Dictionary; elsif not This.Od.Is_Entry_Writable (Index) then Error := Attempt_To_Write_A_Read_Only_Object; elsif not Cmd.Is_Size_Indicated then Error := Command_Specifier_Not_Valid_Or_Unknown; elsif Get_Data_Size (Cmd) > ACO.Configuration.Max_SDO_Transfer_Size then Error := General_Error; end if; Session := ACO.SDO_Sessions.Create_Download (Endpoint, Index); if Error /= Nothing then This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; if Cmd.Is_Expedited then This.Write (Index => Index, Data => Cmd.Data (0 .. 3 - Natural (Cmd.Nof_No_Data)), Error => Error); if Error = Nothing then Resp := Create (Index); This.Send_SDO (Endpoint, Resp.Raw); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); end if; else Resp := Create (Index); This.Send_SDO (Endpoint, Resp.Raw); This.Start_Alarm (Endpoint.Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end Download_Init; procedure Download_Segment (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Download_Segment_Cmd := Convert (Msg); Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id; Session : ACO.SDO_Sessions. SDO_Session := This.Sessions.Get (Id); Error : Error_Type := Nothing; Resp : Download_Segment_Resp; begin if Cmd.Toggle /= Session.Toggle then This.Send_Abort (Endpoint => Endpoint, Error => Toggle_Bit_Not_Altered, Index => Session.Index); This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; This.Sessions.Put_Buffer (Id => Id, Data => Cmd.Data (0 .. 6 - Natural (Cmd.Nof_No_Data))); Session.Toggle := not Session.Toggle; if Cmd.Is_Complete then This.Write (Index => Session.Index, Data => This.Sessions.Peek_Buffer (Id), Error => Error); This.Stop_Alarm (Id); if Error = Nothing then Resp := Create (Cmd.Toggle); This.Send_SDO (Endpoint, Resp.Raw); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else This.Send_Abort (Endpoint => Endpoint, Error => Failed_To_Transfer_Or_Store_Data, Index => Session.Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); end if; else This.Start_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end Download_Segment; end ACO.Protocols.Service_Data.Servers;
boot/boot_sect.asm
vitaminac/miniboot
10
27936
; A boot sector that boots from 16-bits mode into 32-bit protected mode and load a C kernel ; When we reboot our computer, it doesn't have any notion of an operating system. ; Luckily, we do have the Basic Input/Output Software (BIOS), ; a collection of software routines that are initially loaded from a chip into memory ; and initialised when the computer is switched on. ; BIOS load the boot sector to the address 0x7c00 ; org directive tell the assembler where you expect the code will be loaded ; assembler will precalculate label address with this offset [org 0x7c00] ; Typical lower memory layout afer boot ; ----------------------------- ; Free Memory ; ----------0x100000----------- ; BIOS (256 KB) ; ----------0xC0000------------ ; Video Memory (128 KB) ; ----------0xA0000------------ ; Extended BIOS Data Area (639 KB) ; ----------0x9fc00------------ ; Free (638 KB) ; ----------0x7e00------------- ; Loaded Boot Sector (512 Bytes) ; ----------0x7c00------------- ; Nothing ; ----------0x500-------------- ; BIOS Data Area (256 Bytes) ; ----------0x400-------------- ; Interrupt Vector Table (1 KB) ; ----------0x0---------------- ; This is the memory offset to which we will load our kernel KERNEL_OFFSET equ 0x1000 ; When the CPU runs in its intial 16-bit real mode, ; the maximum size of the registers is 16 bits, ; which means that the highest address ; we can reference in an instruction is 0xffff (64 KB = 65536 bytes) ; the CPU designers added a few more special registers, ; cs, ds, ss, and es, called segment registers ; We can imagine main memory as being divided into segments ; that are indexed by the segment registers ; the CPU will offset our address from ; the segment register appropriate for the context of our instruction ; To calculate the absolute address the CPU multiplies the value ; in the segment register by 16 and then adds your offset address [bits 16] Boot: ; BIOS stores our boot drive in DL, ; so it's best to remember this for later. mov [BOOT_DRIVE], dl ; Announce that we are starting ; booting from 16-bit real mode mov bx, MSG_REAL_MODE ; At the CPU level a function is nothing more than ; a jump to the address of a useful routine ; then a jump back again to the instruction ; immediately following the first jump ; the caller and callee must have some agreement ; on where and how many parameters will be passed ; the caller code could store the correct return address ; in some well-known location, ; then the called code could jump back to that stored address. ; The CPU keeps track of the current instruction ; being executed in the special register ip ; the CPU provides a pair of instructions, call and ret, ; call behaves like jmp but additionally, ; before actually jumping, pushes the return address on to the stack; ; ret then pops the return address off the stack and jumps to it call print_string ; Load our kernel load_kernel: ; Print a message to say we are loading the kernel mov bx, MSG_LOAD_KERNEL call print_string ; we load the first 40 sectors that (excluding the boot sector) ; we must increment this value when kernel size go over 20kb mov dh, 40; ; read from the boot disk mov dl, [BOOT_DRIVE] ; set the address that we'd like BIOS to read the sectors to mov bx, KERNEL_OFFSET ; load kernel code call disk_load ; switch to 32-bits protected mode call switch_to_pm ; Includes our useful routines %include "print_string.asm" %include "disk_load.asm" %include "switch_to_pm.asm" ; db = declare bytes of data which tells the assembler ; to write the subsequent bytes directly to the binary output file ; we often use a label to mark the start of our data ; Global Variables BOOT_DRIVE: db 0 ; drive 0 (first floppy drive) ; 10 is ascii code for line change and 0 is null character MSG_REAL_MODE: db "Booting from 16-bit Real Mode", 10, 0 MSG_LOAD_KERNEL db "Loading kernel into memory", 10, 0 ; >>>>>>>>>>> Bootsector padding and magic number <<<<<<<<<< ; When compiled, our program must fit into 512 bytes, ; with the last two bytes being the magic number, ; so here, tell our assembly compiler to pad out our ; program with enough zero bytes (db 0) to bring us to the ; 510 th byte. ; $ is the address of the current position before emitting the bytes ; $$ evaluates to the beginning of the current section ; so ($−$$) tell you how far into the section ; db #value# just the byte #value# times 510 - ($ - $$) db 0 ; Last two bytes ( one word ) make up the magic number, ; so BIOS knows we are a boot sector. ; dw #value# just the word #value# dw 0xaa55
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sccz80/wa_priority_queue_data.asm
meesokim/z88dk
0
82216
<gh_stars>0 ; void *wa_priority_queue_data(wa_priority_queue_t *q) SECTION code_adt_wa_priority_queue PUBLIC wa_priority_queue_data defc wa_priority_queue_data = asm_wa_priority_queue_data INCLUDE "adt/wa_priority_queue/z80/asm_wa_priority_queue_data.asm"
alloy4fun_models/trainstlt/models/8/8328DHReHSmEiXRQR.als
Kaixi26/org.alloytools.alloy
0
4291
<reponame>Kaixi26/org.alloytools.alloy open main pred id8328DHReHSmEiXRQR_prop9 { always ( all t:Train | eventually (t.pos in Entry)) } pred __repair { id8328DHReHSmEiXRQR_prop9 } check __repair { id8328DHReHSmEiXRQR_prop9 <=> prop9o }
ada/examples/regression/regression.ads
carter-e-veldhuizen/RACK
4
6270
<filename>ada/examples/regression/regression.ads with Regression_Library; package Regression is function "&" (Left, Right : String) return String; package Outer is function OuterFun (Input : Boolean) return Boolean; procedure OuterProc (Input : in Boolean); package Nested is procedure NestedProc (Input : in Boolean); type FunctionType is access function(Input : Integer) return Boolean; function NestedFun (Input : in Boolean; InputFun : FunctionType) return Boolean; end Nested; end Outer; end Regression;
src/main/ada/2019/day04.adb
wooky/aoc.kt
0
11617
<filename>src/main/ada/2019/day04.adb with Ada.Text_IO; with Ada.Strings.Fixed; -- remove me procedure Day04 is use Ada.Text_IO; type Password is new String (1..6); Start : constant Password := "<PASSWORD>"; Finish : constant Password := "<PASSWORD>"; Combinations : Natural := 0; procedure Increment_Combinations (From, To, Amount : Natural; Prefix : String) is begin if Amount = 3 then declare Before : Natural := Combinations; Add : Natural := To - From; Subtract : Natural := 10 - To; begin Combinations := Combinations + (Add*(Add+1)*(Add+2) - Subtract*(Subtract+1)*(Subtract+2)) / 6; Put_Line (String (Prefix) & "XXX ->" & Natural'Image (Combinations - Before)); end; else for I in From .. To-1 loop Increment_Combinations (I, 10, Amount-1, String (Prefix) & Ada.Strings.Fixed.Trim (I'Image, Ada.Strings.Left)); end loop; end if; end Increment_Combinations; begin declare Start_Increasing_Digits : Natural := Start'First; begin while Start (Start_Increasing_Digits) <= Start (Start_Increasing_Digits + 1) loop Start_Increasing_Digits := Start_Increasing_Digits + 1; end loop; Increment_Combinations (Character'Pos (Start (Start_Increasing_Digits)) - 48, 10, Start'Length - Start_Increasing_Digits, String (Start (Start'First .. Start_Increasing_Digits))); for I in Start'First+1 .. Start_Increasing_Digits loop Increment_Combinations (Character'Pos (Start (I)) - 47, 10, Start'Length - I + Start'First, String (Start (Start'First .. I-1))); end loop; end; for I in Character'Pos (Start (Start'First))-47 .. Character'Pos (Finish (Finish'First))-49 loop Increment_Combinations (I, 10, Password'Length - 1, Ada.Strings.Fixed.Trim(I'Image, Ada.Strings.Left)); end loop; declare Finish_Increasing_Digits : Natural := Finish'First; begin while Finish (Finish_Increasing_Digits) <= Finish (Finish_Increasing_Digits + 1) loop Increment_Combinations (Character'Pos (Finish (Finish_Increasing_Digits)) - 48, Character'Pos (Finish (Finish_Increasing_Digits+1)) - 48, Finish'Length - Finish_Increasing_Digits + Finish'First - 1, String (Finish (Finish'First .. Finish_Increasing_Digits))); Finish_Increasing_Digits := Finish_Increasing_Digits + 1; end loop; end; Put_Line (Combinations'Image); end Day04;
data/g++_prime_alt.asm
cr-marcstevens/hashtable_mystery
0
173686
./test_prime: file format elf64-x86-64 Disassembly of section .init: Disassembly of section .plt: Disassembly of section .text: 0000000000405e80 <hash_table_alt>: 405e80: f3 0f 1e fa endbr64 405e84: 41 57 push %r15 405e86: be ff 00 00 00 mov $0xff,%esi 405e8b: b8 06 00 00 00 mov $0x6,%eax 405e90: 41 56 push %r14 405e92: 41 55 push %r13 405e94: 41 54 push %r12 405e96: 55 push %rbp 405e97: 53 push %rbx 405e98: 48 83 ec 18 sub $0x18,%rsp 405e9c: 48 8b 3d 3d 07 1d 00 mov 0x1d073d(%rip),%rdi # 5d65e0 <table_alt> 405ea3: c4 e2 f9 f7 15 8c e2 shlx %rax,0x1ce28c(%rip),%rdx # 5d4138 <table_size> 405eaa: 1c 00 405eac: e8 ef b1 ff ff callq 4010a0 <.plt+0x80> 405eb1: 48 c7 05 14 07 1d 00 movq $0x0,0x1d0714(%rip) # 5d65d0 <table_count> 405eb8: 00 00 00 00 405ebc: e8 3f 94 00 00 callq 40f300 <_ZNSt6chrono3_V212steady_clock3nowEv> 405ec1: 48 8b 35 78 07 1d 00 mov 0x1d0778(%rip),%rsi # 5d6640 <random_numbers> 405ec8: 4c 8b 0d 79 07 1d 00 mov 0x1d0779(%rip),%r9 # 5d6648 <random_numbers+0x8> 405ecf: 48 89 c3 mov %rax,%rbx 405ed2: 49 39 f1 cmp %rsi,%r9 405ed5: 0f 84 b1 00 00 00 je 405f8c <hash_table_alt+0x10c> 405edb: 4c 8b 2d 86 07 1d 00 mov 0x1d0786(%rip),%r13 # 5d6668 <hash_prime+0x8> 405ee2: 44 8b 25 87 07 1d 00 mov 0x1d0787(%rip),%r12d # 5d6670 <hash_prime+0x10> 405ee9: 48 8b 2d 70 07 1d 00 mov 0x1d0770(%rip),%rbp # 5d6660 <hash_prime> 405ef0: 4c 8b 1d e9 06 1d 00 mov 0x1d06e9(%rip),%r11 # 5d65e0 <table_alt> 405ef7: 45 31 d2 xor %r10d,%r10d 405efa: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 405f00: 4c 8b 06 mov (%rsi),%r8 405f03: 4c 8b 35 26 e2 1c 00 mov 0x1ce226(%rip),%r14 # 5d4130 <empty_key> 405f0a: 4c 89 c2 mov %r8,%rdx 405f0d: c4 c2 fb f6 d5 mulx %r13,%rax,%rdx 405f12: 4c 89 c7 mov %r8,%rdi 405f15: 4c 8b 3d 1c e2 1c 00 mov 0x1ce21c(%rip),%r15 # 5d4138 <table_size> 405f1c: c4 e2 9b f7 c2 shrx %r12,%rdx,%rax 405f21: 48 0f af c5 imul %rbp,%rax 405f25: 48 29 c7 sub %rax,%rdi 405f28: 48 89 f8 mov %rdi,%rax 405f2b: bf 00 04 00 00 mov $0x400,%edi 405f30: eb 15 jmp 405f47 <hash_table_alt+0xc7> 405f32: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 405f38: 48 ff c0 inc %rax 405f3b: 4c 39 f8 cmp %r15,%rax 405f3e: 49 0f 44 c2 cmove %r10,%rax 405f42: 48 ff cf dec %rdi 405f45: 74 38 je 405f7f <hash_table_alt+0xff> 405f47: 48 89 c1 mov %rax,%rcx 405f4a: 48 c1 e1 06 shl $0x6,%rcx 405f4e: 4c 01 d9 add %r11,%rcx 405f51: 4c 39 71 30 cmp %r14,0x30(%rcx) 405f55: 75 e1 jne 405f38 <hash_table_alt+0xb8> 405f57: 31 d2 xor %edx,%edx 405f59: eb 0e jmp 405f69 <hash_table_alt+0xe9> 405f5b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 405f60: 48 ff c2 inc %rdx 405f63: 48 83 fa 07 cmp $0x7,%rdx 405f67: 74 cf je 405f38 <hash_table_alt+0xb8> 405f69: 4c 3b 34 d1 cmp (%rcx,%rdx,8),%r14 405f6d: 75 f1 jne 405f60 <hash_table_alt+0xe0> 405f6f: 4c 89 04 d1 mov %r8,(%rcx,%rdx,8) 405f73: c6 44 11 38 01 movb $0x1,0x38(%rcx,%rdx,1) 405f78: 48 ff 05 51 06 1d 00 incq 0x1d0651(%rip) # 5d65d0 <table_count> 405f7f: 48 83 c6 08 add $0x8,%rsi 405f83: 49 39 f1 cmp %rsi,%r9 405f86: 0f 85 74 ff ff ff jne 405f00 <hash_table_alt+0x80> 405f8c: e8 6f 93 00 00 callq 40f300 <_ZNSt6chrono3_V212steady_clock3nowEv> 405f91: 48 29 d8 sub %rbx,%rax 405f94: 48 ba db 34 b6 d7 82 movabs $0x431bde82d7b634db,%rdx 405f9b: de 1b 43 405f9e: 48 89 c1 mov %rax,%rcx 405fa1: 48 f7 ea imul %rdx 405fa4: 48 c1 f9 3f sar $0x3f,%rcx 405fa8: c5 f8 57 c0 vxorps %xmm0,%xmm0,%xmm0 405fac: 48 c1 fa 12 sar $0x12,%rdx 405fb0: 48 29 ca sub %rcx,%rdx 405fb3: c4 e1 fb 2a c2 vcvtsi2sd %rdx,%xmm0,%xmm0 405fb8: 48 8d 35 c0 f0 16 00 lea 0x16f0c0(%rip),%rsi # 57507f <_IO_stdin_used+0x7f> 405fbf: ba 13 00 00 00 mov $0x13,%edx 405fc4: 48 8d 3d 15 16 1d 00 lea 0x1d1615(%rip),%rdi # 5d75e0 <_ZSt4cout> 405fcb: c5 fb 11 44 24 08 vmovsd %xmm0,0x8(%rsp) 405fd1: e8 ea a4 06 00 callq 4704c0 <_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l> 405fd6: c5 fb 10 44 24 08 vmovsd 0x8(%rsp),%xmm0 405fdc: 48 8d 3d fd 15 1d 00 lea 0x1d15fd(%rip),%rdi # 5d75e0 <_ZSt4cout> 405fe3: e8 58 b5 06 00 callq 471540 <_ZNSo9_M_insertIdEERSoT_> 405fe8: 48 89 c5 mov %rax,%rbp 405feb: ba 02 00 00 00 mov $0x2,%edx 405ff0: 48 8d 35 27 f0 16 00 lea 0x16f027(%rip),%rsi # 57501e <_IO_stdin_used+0x1e> 405ff7: 48 89 c7 mov %rax,%rdi 405ffa: e8 c1 a4 06 00 callq 4704c0 <_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l> 405fff: 48 8b 45 00 mov 0x0(%rbp),%rax 406003: 48 8b 40 e8 mov -0x18(%rax),%rax 406007: 4c 8b a4 05 f0 00 00 mov 0xf0(%rbp,%rax,1),%r12 40600e: 00 40600f: 4d 85 e4 test %r12,%r12 406012: 74 57 je 40606b <hash_table_alt+0x1eb> 406014: 41 80 7c 24 38 00 cmpb $0x0,0x38(%r12) 40601a: 74 24 je 406040 <hash_table_alt+0x1c0> 40601c: 41 0f be 74 24 43 movsbl 0x43(%r12),%esi 406022: 48 89 ef mov %rbp,%rdi 406025: e8 16 a0 06 00 callq 470040 <_ZNSo3putEc> 40602a: 48 83 c4 18 add $0x18,%rsp 40602e: 5b pop %rbx 40602f: 5d pop %rbp 406030: 41 5c pop %r12 406032: 41 5d pop %r13 406034: 41 5e pop %r14 406036: 48 89 c7 mov %rax,%rdi 406039: 41 5f pop %r15 40603b: e9 80 95 06 00 jmpq 46f5c0 <_ZNSo5flushEv> 406040: 4c 89 e7 mov %r12,%rdi 406043: e8 b8 81 01 00 callq 41e200 <_ZNKSt5ctypeIcE13_M_widen_initEv> 406048: 49 8b 04 24 mov (%r12),%rax 40604c: 48 8d 15 2d 00 00 00 lea 0x2d(%rip),%rdx # 406080 <_ZNKSt5ctypeIcE8do_widenEc> 406053: 48 8b 40 30 mov 0x30(%rax),%rax 406057: be 0a 00 00 00 mov $0xa,%esi 40605c: 48 39 d0 cmp %rdx,%rax 40605f: 74 c1 je 406022 <hash_table_alt+0x1a2> 406061: 4c 89 e7 mov %r12,%rdi 406064: ff d0 callq *%rax 406066: 0f be f0 movsbl %al,%esi 406069: eb b7 jmp 406022 <hash_table_alt+0x1a2> 40606b: e8 ba c7 ff ff callq 40282a <_ZSt16__throw_bad_castv> Disassembly of section __libc_freeres_fn: Disassembly of section .fini:
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_ix/esx_f_read_callee.asm
jpoikela/z88dk
640
243871
<reponame>jpoikela/z88dk ; uint16_t esx_f_read(unsigned char handle, void *dst, size_t nbytes) SECTION code_esxdos PUBLIC _esx_f_read_callee PUBLIC l0_esx_f_read_callee EXTERN asm_esx_f_read _esx_f_read_callee: pop de dec sp pop af pop hl pop bc push de l0_esx_f_read_callee: push ix call asm_esx_f_read pop ix ret
firmware/coreboot/3rdparty/libgfxinit/common/hw-gfx-gma-pch-fdi.adb
fabiojna02/OpenCellular
1
4592
<reponame>fabiojna02/OpenCellular<gh_stars>1-10 -- -- Copyright (C) 2015-2016 secunet Security Networks AG -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with HW.Time; with HW.GFX.GMA.Config; with HW.GFX.GMA.Registers; package body HW.GFX.GMA.PCH.FDI is FDI_RX_CTL_FDI_RX_ENABLE : constant := 1 * 2 ** 31; FDI_RX_CTL_FS_ERROR_CORRECTION_ENABLE : constant := 1 * 2 ** 27; FDI_RX_CTL_FE_ERROR_CORRECTION_ENABLE : constant := 1 * 2 ** 26; FDI_RX_CTL_PORT_WIDTH_SEL_SHIFT : constant := 19; FDI_RX_CTL_FDI_PLL_ENABLE : constant := 1 * 2 ** 13; FDI_RX_CTL_COMPOSITE_SYNC_SELECT : constant := 1 * 2 ** 11; FDI_RX_CTL_FDI_AUTO_TRAIN : constant := 1 * 2 ** 10; FDI_RX_CTL_ENHANCED_FRAMING_ENABLE : constant := 1 * 2 ** 6; FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_MASK : constant := 1 * 2 ** 4; FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_RAWCLK : constant := 0 * 2 ** 4; FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_PCDCLK : constant := 1 * 2 ** 4; TP_SHIFT : constant := (if Config.CPU = Ironlake then 28 else 8); FDI_RX_CTL_TRAINING_PATTERN_MASK : constant := 3 * 2 ** TP_SHIFT; type TP_Array is array (Training_Pattern) of Word32; FDI_RX_CTL_TRAINING_PATTERN : constant TP_Array := (TP_1 => 0 * 2 ** TP_SHIFT, TP_2 => 1 * 2 ** TP_SHIFT, TP_Idle => 2 * 2 ** TP_SHIFT, TP_None => 3 * 2 ** TP_SHIFT); function FDI_RX_CTL_PORT_WIDTH_SEL (Lane_Count : DP_Lane_Count) return Word32 is begin return Shift_Left (Word32 (Lane_Count_As_Integer (Lane_Count)) - 1, FDI_RX_CTL_PORT_WIDTH_SEL_SHIFT); end FDI_RX_CTL_PORT_WIDTH_SEL; function FDI_RX_CTL_BPC (BPC : BPC_Type) return Word32 with Pre => True is begin return (case BPC is when 6 => 2 * 2 ** 16, when 10 => 1 * 2 ** 16, when 12 => 3 * 2 ** 16, when others => 0 * 2 ** 16); end FDI_RX_CTL_BPC; FDI_RX_MISC_FDI_RX_PWRDN_LANE1_SHIFT : constant := 26; FDI_RX_MISC_FDI_RX_PWRDN_LANE1_MASK : constant := 3 * 2 ** 26; FDI_RX_MISC_FDI_RX_PWRDN_LANE0_SHIFT : constant := 24; FDI_RX_MISC_FDI_RX_PWRDN_LANE0_MASK : constant := 3 * 2 ** 24; FDI_RX_MISC_TP1_TO_TP2_TIME_48 : constant := 2 * 2 ** 20; FDI_RX_MISC_FDI_DELAY_90 : constant := 16#90# * 2 ** 0; function FDI_RX_MISC_FDI_RX_PWRDN_LANE1 (Value : Word32) return Word32 with Pre => True is begin return Shift_Left (Value, FDI_RX_MISC_FDI_RX_PWRDN_LANE1_SHIFT); end FDI_RX_MISC_FDI_RX_PWRDN_LANE1; function FDI_RX_MISC_FDI_RX_PWRDN_LANE0 (Value : Word32) return Word32 with Pre => True is begin return Shift_Left (Value, FDI_RX_MISC_FDI_RX_PWRDN_LANE0_SHIFT); end FDI_RX_MISC_FDI_RX_PWRDN_LANE0; FDI_RX_TUSIZE_SHIFT : constant := 25; function FDI_RX_TUSIZE (Value : Word32) return Word32 is begin return Shift_Left (Value - 1, FDI_RX_TUSIZE_SHIFT); end FDI_RX_TUSIZE; FDI_RX_INTERLANE_ALIGNMENT : constant := 1 * 2 ** 10; FDI_RX_SYMBOL_LOCK : constant := 1 * 2 ** 9; FDI_RX_BIT_LOCK : constant := 1 * 2 ** 8; ---------------------------------------------------------------------------- type FDI_Registers is record RX_CTL : Registers.Registers_Index; RX_MISC : Registers.Registers_Index; RX_TUSIZE : Registers.Registers_Index; RX_IMR : Registers.Registers_Index; RX_IIR : Registers.Registers_Index; end record; type FDI_Registers_Array is array (PCH.FDI_Port_Type) of FDI_Registers; FDI_Regs : constant FDI_Registers_Array := FDI_Registers_Array' (PCH.FDI_A => FDI_Registers' (RX_CTL => Registers.FDI_RXA_CTL, RX_MISC => Registers.FDI_RX_MISC_A, RX_TUSIZE => Registers.FDI_RXA_TUSIZE1, RX_IMR => Registers.FDI_RXA_IMR, RX_IIR => Registers.FDI_RXA_IIR), PCH.FDI_B => FDI_Registers' (RX_CTL => Registers.FDI_RXB_CTL, RX_MISC => Registers.FDI_RX_MISC_B, RX_TUSIZE => Registers.FDI_RXB_TUSIZE1, RX_IMR => Registers.FDI_RXB_IMR, RX_IIR => Registers.FDI_RXB_IIR), PCH.FDI_C => FDI_Registers' (RX_CTL => Registers.FDI_RXC_CTL, RX_MISC => Registers.FDI_RX_MISC_C, RX_TUSIZE => Registers.FDI_RXC_TUSIZE1, RX_IMR => Registers.FDI_RXC_IMR, RX_IIR => Registers.FDI_RXC_IIR)); ---------------------------------------------------------------------------- procedure Pre_Train (Port : PCH.FDI_Port_Type; Port_Cfg : Port_Config) is Power_Down_Lane_Bits : constant Word32 := (if Config.Has_FDI_RX_Power_Down then FDI_RX_MISC_FDI_RX_PWRDN_LANE1 (2) or FDI_RX_MISC_FDI_RX_PWRDN_LANE0 (2) else 0); RX_CTL_Settings : constant Word32 := FDI_RX_CTL_PORT_WIDTH_SEL (Port_Cfg.FDI.Lane_Count) or (if Config.Has_FDI_BPC then FDI_RX_CTL_BPC (Port_Cfg.Mode.BPC) else 0) or (if Config.Has_FDI_Composite_Sel then FDI_RX_CTL_COMPOSITE_SYNC_SELECT else 0) or (if Port_Cfg.FDI.Enhanced_Framing then FDI_RX_CTL_ENHANCED_FRAMING_ENABLE else 0); begin -- TODO: HSW: check DISPIO_CR_TX_BMU_CR4, seems Linux doesn't know it Registers.Write (Register => FDI_Regs (Port).RX_MISC, Value => Power_Down_Lane_Bits or FDI_RX_MISC_TP1_TO_TP2_TIME_48 or FDI_RX_MISC_FDI_DELAY_90); Registers.Write (Register => FDI_Regs (Port).RX_TUSIZE, Value => FDI_RX_TUSIZE (64)); Registers.Unset_Mask (Register => FDI_Regs (Port).RX_IMR, Mask => FDI_RX_INTERLANE_ALIGNMENT or FDI_RX_SYMBOL_LOCK or FDI_RX_BIT_LOCK); Registers.Posting_Read (FDI_Regs (Port).RX_IMR); -- clear stale lock bits Registers.Write (Register => FDI_Regs (Port).RX_IIR, Value => FDI_RX_INTERLANE_ALIGNMENT or FDI_RX_SYMBOL_LOCK or FDI_RX_BIT_LOCK); Registers.Write (Register => FDI_Regs (Port).RX_CTL, Value => FDI_RX_CTL_FDI_PLL_ENABLE or RX_CTL_Settings); Registers.Posting_Read (FDI_Regs (Port).RX_CTL); Time.U_Delay (220); Registers.Set_Mask (Register => FDI_Regs (Port).RX_CTL, Mask => FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_PCDCLK); end Pre_Train; procedure Train (Port : in PCH.FDI_Port_Type; TP : in Training_Pattern; Success : out Boolean) is Lock_Bit : constant Word32 := (if TP = TP_1 then FDI_RX_BIT_LOCK else FDI_RX_SYMBOL_LOCK); procedure Check_Lock (Lock_Bit : Word32) is begin for I in 1 .. 5 loop Registers.Is_Set_Mask (Register => FDI_Regs (Port).RX_IIR, Mask => Lock_Bit, Result => Success); if Success then -- clear the lock bit Registers.Write (Register => FDI_Regs (Port).RX_IIR, Value => Lock_Bit); end if; exit when Success; Time.U_Delay (1); end loop; end Check_Lock; begin Registers.Unset_And_Set_Mask (Register => FDI_Regs (Port).RX_CTL, Mask_Unset => FDI_RX_CTL_TRAINING_PATTERN_MASK, Mask_Set => FDI_RX_CTL_FDI_RX_ENABLE or FDI_RX_CTL_TRAINING_PATTERN (TP)); Registers.Posting_Read (FDI_Regs (Port).RX_CTL); if TP <= TP_2 then Time.U_Delay (1); if TP = TP_1 then Check_Lock (FDI_RX_BIT_LOCK); else Check_Lock (FDI_RX_SYMBOL_LOCK); if Success then Check_Lock (FDI_RX_INTERLANE_ALIGNMENT); end if; end if; else Time.U_Delay (31); Success := True; end if; end Train; procedure Auto_Train (Port : PCH.FDI_Port_Type) is begin Registers.Set_Mask (Register => FDI_Regs (Port).RX_CTL, Mask => FDI_RX_CTL_FDI_RX_ENABLE or FDI_RX_CTL_FDI_AUTO_TRAIN); Registers.Posting_Read (FDI_Regs (Port).RX_CTL); if Config.Has_FDI_RX_Power_Down then Time.U_Delay (30); Registers.Unset_And_Set_Mask (Register => FDI_Regs (Port).RX_MISC, Mask_Unset => FDI_RX_MISC_FDI_RX_PWRDN_LANE1_MASK or FDI_RX_MISC_FDI_RX_PWRDN_LANE0_MASK, Mask_Set => FDI_RX_MISC_FDI_RX_PWRDN_LANE1 (0) or FDI_RX_MISC_FDI_RX_PWRDN_LANE0 (0)); Registers.Posting_Read (FDI_Regs (Port).RX_MISC); end if; Time.U_Delay (5); end Auto_Train; procedure Enable_EC (Port : PCH.FDI_Port_Type) is begin Registers.Set_Mask (Register => FDI_Regs (Port).RX_CTL, Mask => FDI_RX_CTL_FS_ERROR_CORRECTION_ENABLE or FDI_RX_CTL_FE_ERROR_CORRECTION_ENABLE); end Enable_EC; ---------------------------------------------------------------------------- procedure Off (Port : PCH.FDI_Port_Type; OT : Off_Type) is begin Registers.Unset_Mask (Register => FDI_Regs (Port).RX_CTL, Mask => FDI_RX_CTL_FDI_RX_ENABLE or FDI_RX_CTL_FDI_AUTO_TRAIN); if Config.Has_FDI_RX_Power_Down and then OT >= Lanes_Off then Registers.Unset_And_Set_Mask (Register => FDI_Regs (Port).RX_MISC, Mask_Unset => FDI_RX_MISC_FDI_RX_PWRDN_LANE1_MASK or FDI_RX_MISC_FDI_RX_PWRDN_LANE0_MASK, Mask_Set => FDI_RX_MISC_FDI_RX_PWRDN_LANE1 (2) or FDI_RX_MISC_FDI_RX_PWRDN_LANE0 (2)); Registers.Posting_Read (FDI_Regs (Port).RX_MISC); end if; if OT >= Clock_Off then Registers.Unset_And_Set_Mask (Register => FDI_Regs (Port).RX_CTL, Mask_Unset => FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_MASK, Mask_Set => FDI_RX_CTL_RAWCLK_TO_PCDCLK_SEL_RAWCLK); Registers.Unset_Mask (Register => FDI_Regs (Port).RX_CTL, Mask => FDI_RX_CTL_FDI_PLL_ENABLE); end if; end Off; end HW.GFX.GMA.PCH.FDI;
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_setBGPaletteColor.asm
jpoikela/z88dk
640
178507
; void SMS_setBGPaletteColor(unsigned char entry,unsigned char color) SECTION code_clib SECTION code_SMSlib PUBLIC _SMS_setBGPaletteColor EXTERN asm_SMSlib_setBGPaletteColor _SMS_setBGPaletteColor: pop af pop hl push hl push af ld a,h jp asm_SMSlib_setBGPaletteColor
guarded-recursion/embedding.agda
np/guarded-recursion
1
725
-- Axiomatic embedding of guarded recursion in Agda module guarded-recursion.embedding where open import guarded-recursion.prelude renaming (O to zero; S to suc) open Coe module M (▹_ : ∀ {a} → Type_ a → Type_ a) (▸ : ∀ {a} → ▹ (Type_ a) → Type_ a) (next : ∀ {a} {A : Type_ a} → A → ▹ A) (▸-rule : ∀ {a} {A : Type_ a} → ▸ (next A) ≡ ▹ A) (fix : ∀ {a} {A : Type_ a} → (▹ A → A) → A) (fix-rule : ∀ {a} {A : Type_ a} {f : ▹ A → A} → fix f ≡ f (next (fix f))) (_⊛′_ : ∀ {a b} {A : Type_ a} {B : Type_ b} → ▹ (A → B) → ▹ A → ▹ B) (_⊛_ : ∀ {a b} {A : Type_ a} {B : A → Type_ b} → ▹ ((x : A) → B x) → (x : ▹ A) → ▸ (next B ⊛′ x)) (fix-uniq : ∀ {a} {A : Type_ a} (u : A) f → u ≡ f (next u) → u ≡ fix f) (next⊛next : ∀ {a b} {A : Type_ a} {B : Type_ b} (f : A → B) (x : A) → next f ⊛′ next x ≡ next (f x)) where roll▸ : ∀ {a} {A : Type_ a} → ▹ A → ▸ (next A) roll▸ = coe! ▸-rule un▸ : ∀ {a} {A : Type_ a} → ▸ (next A) → ▹ A un▸ = coe ▸-rule ▹Fix : ∀ {a} → Type_ a → Type_ a ▹Fix X = (▹ X → X) → X ▹Endo : ∀ {a} → Type_ a → Type_ a ▹Endo X = ▹ X → X μ : ∀ {a} → Fix (Type_ a) μ F = fix (F ∘ ▸) un : ∀ {a f} → fix {A = Type_ a} f → f (next (fix f)) un = coe fix-rule unμ : ∀ {a} f → μ {a} f → f (▹ μ f) unμ {a} f x rewrite ! (▸-rule {A = μ f}) = un x roll : ∀ {a f} → f (next (fix f)) → fix {A = Type_ a} f roll = coe! fix-rule μ-rule : ∀ {a} f → μ {a} f ≡ f (▹ μ f) μ-rule f = fix-rule ∙ ap f (▸-rule {A = μ f}) rollμ : ∀ {a} f → f (▹ μ f) → μ {a} f rollμ f = coe! (μ-rule f) un₁ : ∀ {a b} {A : Type_ a} {f x} → fix {A = A → Type_ b} f x → f (next (fix f)) x un₁ = coe₁ fix-rule roll₁ : ∀ {a b} {A : Type_ a} {f x} → f (next (fix f)) x → fix {A = A → Type_ b} f x roll₁ = coe₁! fix-rule un₂ : ∀ {a b} {A : Type_ a} {B : Type_ b} {c f x y} → fix {A = A → B → Type_ c} f x y → f (next (fix f)) x y un₂ = coe₂ fix-rule roll₂ : ∀ {a b} {A : Type_ a} {B : Type_ b} {c f x y} → f (next (fix f)) x y → fix {A = A → B → Type_ c} f x y roll₂ = coe₂! fix-rule map▹ : ∀ {a b} {A : Type_ a} {B : Type_ b} → (A → B) → ▹ A → ▹ B map▹ f ▹x = next f ⊛′ ▹x {- alternatively _⊛′′_ : ∀ {a b} {A : Type_ a} {B : A → Type_ b} → ▹ ((x : A) → B x) → (x : A) → ▹ (B x) ▹f ⊛′′ x = map▹ (λ f → f x) ▹f -} {- alternatively _$_ : ∀ {a b} {A : Type_ a} (B : A → Type_ b) → ▹ A → ▹ (Type_ b) f $ ▹x = map▹ f ▹x -} ▹^ : ∀ {a} → ℕ → Type_ a → Type_ a ▹^ zero A = A ▹^ (suc n) A = ▹ ▹^ n A next^ : ∀ {a} {A : Type_ a} n → A → ▹^ n A next^ zero x = x next^ (suc n) x = next (next^ n x) map▹^ : ∀ {a b} {A : Type_ a} {B : Type_ b} n → (A → B) → ▹^ n A → ▹^ n B map▹^ zero f = f map▹^ (suc n) f = map▹ (map▹^ n f) module SimpleStream where F : Type → Type → Type F A X = A × X S : Type → Type S A = μ (F A) μ₁F' : ∀ {a} {A : Type_ a} → ((A → ▹ Type) → A → Type) → (▹(A → Type) → A → Type) μ₁F' F self = F (λ x → (self ⊛′ next x)) μ₁F : ∀ {a} {A : Type_ a} → ((A → Type) → A → Type) → (▹(A → Type) → A → Type) μ₁F F self = F (λ x → ▸ (self ⊛′ next x)) μ₁ : ∀ {a} {A : Type_ a} → ((A → Type) → A → Type) → A → Type μ₁ F = fix (μ₁F F) module μId where μid : Type μid = μ id μid-rule : μid ≡ ▹ μid μid-rule = fix-rule ∙ ▸-rule {A = μ id} ω : μid ω = fix (rollμ id) module CoNat where Coℕ : Type Coℕ = μ Maybe rollNat : Maybe (▹ Coℕ) → Coℕ rollNat = rollμ Maybe ze : Coℕ ze = rollNat nothing su : ▹ Coℕ → Coℕ su x = rollNat (just x) su′ : Coℕ → Coℕ su′ = su ∘ next ω : Coℕ ω = fix su module Neg where {- data X : Type where rollX : Fix X : (X → X) → X -} X : Type X = μ Endo rollX : Endo (▹ X) → X -- : (▹ X → ▹ X) → X rollX = rollμ Endo rollX′ : ▹(Endo X) → X -- : ▹(X → X) → X rollX′ = rollX ∘ _⊛′_ unX : X → Endo (▹ X) unX = unμ Endo -- δ = λ x → x x δ : X → ▹ X δ = λ x → (unX x) (next x) module Neg' where {- data X : Type where c : Fix X : ((X → X) → X) → X -} X : Type X = μ Fix rollX : Fix (▹ X) → X rollX = rollμ Fix unX : X → Fix (▹ X) unX = unμ Fix module μ₁Id where -- μ₁id = ▹∘▹∘…∘▹ -- μ₁id A = ▹ (▹ … (▹ A)) μ₁id : Type → Type μ₁id = μ₁ id betterfix₁ : ∀ {a} {A : Type_ a} {x : A} (F : Endo (A → Type)) → (▹ μ₁ F x → μ₁F F (next (μ₁ F)) x) → μ₁ F x betterfix₁ {a} {A} {x} F f = fix helper where helper : _ → _ helper self = roll₁ (f self) ▹ω-inh' : ∀ {A : Type} {x : A} (F : Endo (A → Type)) → (▸ (next (μ₁ F) ⊛′ next x) → μ₁F F (next (μ₁ F)) x) → μ₁ F x ▹ω-inh' {A} {x} F f = fix helper where helper : _ → _ helper self = roll₁ (f (coe! (ap ▸ (next⊛next (μ₁ F) x)) (roll▸ self))) ▹ω-inh : ∀ {A} → μ₁id A -- ▹ω-inh {A} = fix λ self → roll₁ (coe! (ap ▸ (next⊛next μ₁id A)) (roll▸ self)) ▹ω-inh {A} = betterfix₁ id (λ self → coe! (ap ▸ (next⊛next μ₁id A)) (roll▸ self)) -- ▹ω-inh {A} = fix λ self → {!!} -- (coe! (ap ▸ (next⊛next μ₁idω A)) (roll▸ self)) fix2 : ∀ {a} {A : Type_ a} → (▹ A → A) → A fix2 f = fix (f ∘ next ∘ f) fix≡fix2 : ∀ {a} {A : Type_ a} (f : ▹ A → A) → fix f ≡ fix2 f fix≡fix2 f = fix-uniq (fix f) (f ∘ next ∘ f) (fix-rule ∙ ap (f ∘ next) fix-rule) module Streams where F : Type → Type → Type F A X = A × X -- S : Type → Type -- S A = μ (F A) F^ : ℕ → Type → Type → Type F^ n A X = A × ▹^ n X S^ : ℕ → Type → Type S^ n A = μ (F^ n A) S : Type → Type S = S^ 0 S₂ = S^ 1 unS : ∀ {A} → S A → F A (▹ S A) unS = unμ (F _) rollS : ∀ {A} → F A (▹ S A) → S A rollS = rollμ (F _) unS^ : ∀ {A} n → S^ n A → F^ n A (▹ S^ n A) unS^ n = unμ (F^ n _) rollS^ : ∀ {A} n → F^ n A (▹ S^ n A) → S^ n A rollS^ n = rollμ (F^ n _) hd : ∀ {A} → S A → A hd = fst ∘ unS tl : ∀ {A} → S A → ▹ S A tl = snd ∘ unS cons : ∀ {A} n → A → ▹^ n (▹ (S^ n A)) → S^ n A cons n x xs = rollS^ n (x , xs) infixr 4 _∷_ _∷_ : ∀ {A} → A → ▹ (S A) → S A _∷_ = cons 0 infixr 4 _∷₂_ _∷₂_ : ∀ {A} → A → ▹^ 2 (S₂ A) → S₂ A x ∷₂ xs = roll (x , map▹ roll▸ xs) repeatS : ∀ {A} → A → S A repeatS x = fix λ x… → x ∷ x… module MapS {A B : Type} (f : A → B) where mapSf : ▹(S A → S B) → S A → S B mapSf self s = f (hd s) ∷ self ⊛′ tl s mapS : S A → S B mapS = fix mapSf mapS2f : ▹(S A → S B) → S A → S B mapS2f self s = f (hd s) ∷ map▹ (λ s' → f (hd s') ∷ self ⊛′ tl s') (tl s) mapS2f' : ▹(S A → S B) → S A → S B mapS2f' self = mapSf (next (mapSf self)) mapS2f≡mapS2f' : mapS2f ≡ mapS2f' mapS2f≡mapS2f' = idp mapS2 : S A → S B mapS2 = fix mapS2f mapS2' : S A → S B mapS2' = fix mapS2f' mapS2≡mapS2' : mapS2 ≡ mapS2' mapS2≡mapS2' = idp mapS2'' : S A → S B mapS2'' = fix2 mapSf mapS2≡mapS2'' : mapS2 ≡ mapS2'' mapS2≡mapS2'' = idp mapS≡mapS2 : mapS ≡ mapS2 mapS≡mapS2 = fix≡fix2 mapSf open MapS group2 : S ℕ → ▹ S₂ ℕ² group2 = fix λ self s → map▹ (λ tls → (hd s , hd tls) ∷₂ self ⊛′ tl tls) (tl s) ‼ : ∀ {A} → (n : ℕ) → S A → ▹^ n A ‼ zero = hd ‼ (suc n) = map▹ (‼ n) ∘ tl toFun : ∀ {A} → S A → (n : ℕ) → ▹^ n A toFun s n = ‼ n s fromFun : ∀ {A} → (ℕ → A) → S A fromFun {A} = fix λ self (f : ℕ → A) → f 0 ∷ self ⊛′ next (f ∘ suc) nats : S ℕ nats = fix λ self → 0 ∷ map▹ (mapS suc) self nats2 : S ℕ nats2 = fix λ self → 0 ∷ map▹ (mapS2 suc) self nats≡nats2 : nats ≡ nats2 nats≡nats2 rewrite mapS≡mapS2 suc = idp arrow : ▹ ℕ arrow = ‼ 1 nats module Sim {A : Type} (ℛ : A → A → Type) (ℛ-refl : Reflexive ℛ) where ≈F : ▹(S A × S A → Type) → S A × S A → Type ≈F X (xs , ys) = ℛ (hd xs) (hd ys) × ▸ ((map▹ curry X ⊛′ (tl xs)) ⊛′ tl ys) _≈_ : S A × S A → Type _≈_ = fix ≈F ≈-tail : ∀ {xs ys : S A} → _≈_ (xs , ys) → ▸ ((map▹ curry (next _≈_) ⊛′ tl xs) ⊛′ tl ys) ≈-tail pf = snd (un₁ pf) {- Does not work yet ≈-refl : Reflexive (curry _≈_) ≈-refl {x} = (fix λ pf x → roll₁ {f = ≈F} (ℛ-refl , helper pf x)) x where helper' : _ → _ → _ helper' pf x = map▹ (λ f → f x) pf helper : _ → _ → _ helper pf x = let r = helper' pf x in {!roll▸ r!} -} module DelayedStreams where data F (A : Type) (X : Type) : Type where done : F A X skip : X → F A X yield : A → X → F A X mapF : ∀ {A B X Y} → (A → B) → (X → Y) → F A X → F B Y mapF f g done = done mapF f g (skip x) = skip (g x) mapF f g (yield a x) = yield (f a) (g x) S : Type → Type S A = μ (F A) unS : ∀ {A} → S A → F A (▹ S A) unS = mapF id un▸ ∘ un rollS : ∀ {A} → F A (▹ S A) → S A rollS = roll ∘ mapF id roll▸ unfoldS : ∀ {A X} → (X → F A (▹ X)) → X → S A unfoldS coalg = fix λ self x → rollS (mapF id (λ x′ → self ⊛′ x′) (coalg x)) repeatS : ∀ {A} → A → S A repeatS x = fix λ self → rollS (yield x self) neverS : ∀ {A} → S A neverS = fix λ self → rollS (skip self) -- Co-algebra style... mapS : ∀ {A B} → (A → B) → S A → S B mapS {A} {B} f = unfoldS (mapF f id ∘ unS) filterF : ∀ {A X} → (A → 𝟚) → F A X → F A X filterF f done = done filterF f (skip xs) = skip xs filterF f (yield x xs) = if f x then yield x xs else skip xs filterS : ∀ {A} → (A → 𝟚) → S A → S A filterS f = unfoldS (filterF f ∘ unS) module FuelBased where fix : ∀ {a} {A : Type_ a} → ℕ → (A → A) → A fix zero f = STUCK where postulate STUCK : _ fix (suc n) f = f (fix n f) fix-rule : ∀ {a} {A : Type_ a} (n : ℕ) {f : A → A} → fix n f ≡ f (fix n f) fix-rule zero = ThisIsUnsafeButPlease.trustMe fix-rule (suc n) {f} = ap f (fix-rule n) fix-uniq : ∀ {a} {A : Type_ a} (n : ℕ) (u : A) f → u ≡ f u → u ≡ fix n f fix-uniq zero u f pf = ThisIsUnsafeButPlease.trustMe fix-uniq (suc n) u f pf = pf ∙ ap f (fix-uniq n u f pf) module I (n : ℕ) = M id id id idp (fix n) (fix-rule n) id id (fix-uniq n) (λ _ _ → idp) module HiddenFix {a} {A : Type_ a} (f : A → A) where -- This definition is not intended to termination-check. -- Use with care it's really easy to make the type-checker loop. {-# TERMINATING #-} fix : Hidden A fix = hide f (reveal fix) fix-rule : reveal fix ≡ f (reveal fix) fix-rule = idp {a} {A} {reveal fix} -- This definition is not intended to termination-check. -- Use with care it's really easy to make the type-checker loop. {-# TERMINATING #-} fix-uniq : (u : A) → u ≡ f u → u ≡ reveal fix fix-uniq u pf = pf ∙ ap f (fix-uniq u pf) ∙ ! fix-rule module Test where open HiddenFix open M id id id idp (reveal ∘ fix) (λ {_} {_} {f} → fix-rule f) id id (λ {_} {_} u f → fix-uniq f u) (λ _ _ → idp) public open Streams two : map▹ hd (tl nats) ≡ 1 two = idp -- -} -- -} -- -}
test/mat/vulkan-math-mat2x4-test.adb
zrmyers/VulkanAda
1
19115
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2021 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 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. -------------------------------------------------------------------------------- with Ada.Text_IO; with Ada.Characters.Latin_1; with Vulkan.Math.GenFMatrix; with Vulkan.Math.Mat2x2; with Vulkan.Math.Mat2x4; with Vulkan.Math.GenFType; with Vulkan.Math.Vec2; with Vulkan.Math.Vec4; with Vulkan.Math.Operators; with Vulkan.Test.Framework; use Ada.Text_IO; use Ada.Characters.Latin_1; use Vulkan.Math.Mat2x2; use Vulkan.Math.Mat2x4; use Vulkan.Math.GenFType; use Vulkan.Math.Vec2; use Vulkan.Math.Vec4; use Vulkan.Test.Framework; -------------------------------------------------------------------------------- --< @group Vulkan Math Basic Types -------------------------------------------------------------------------------- --< @summary --< This package provides tests for single precision floating point mat2x4. -------------------------------------------------------------------------------- package body Vulkan.Math.Mat2x4.Test is -- Test Mat2x4 procedure Test_Mat2x4 is vec1 : Vkm_Vec2 := Make_Vec2(1.0, 2.0); vec2 : Vkm_Vec4 := Make_Vec4(1.0, 2.0, 3.0, 4.0); mat1 : Vkm_Mat2x4 := Make_Mat2x4; mat2 : Vkm_Mat2x4 := Make_Mat2x4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); mat3 : Vkm_Mat2x4 := Make_Mat2x4(vec2, - vec2); mat4 : Vkm_Mat2x4 := Make_Mat2x4(mat2); mat5 : Vkm_Mat2x2 := Make_Mat2x2(5.0); mat6 : Vkm_Mat2x4 := Make_Mat2x4(mat5); begin Put_Line(LF & "Testing Mat2x4 Constructors..."); Put_Line("mat1 " & mat1.Image); Assert_Mat2x4_Equals(mat1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); Put_Line("mat2 " & mat2.Image); Assert_Mat2x4_Equals(mat2, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("mat3 " & mat3.Image); Assert_Mat2x4_Equals(mat3, 1.0, 2.0, 3.0, 4.0, -1.0, -2.0, -3.0, -4.0); Put_Line("mat4 " & mat4.Image); Assert_Mat2x4_Equals(mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("mat6 " & mat6.Image); Assert_Mat2x4_Equals(mat6, 5.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 0.0); Put_Line("Testing '=' operator..."); Put_Line(" mat2 != mat3"); Assert_Vkm_Bool_Equals(mat2 = mat3, False); Put_Line(" mat4 != mat5"); Assert_Vkm_Bool_Equals(mat4 = mat5, False); Put_Line(" mat4 = mat2"); Assert_Vkm_Bool_Equals(mat4 = mat2, True); Put_Line(" Testing unary '+/-' operator"); Put_Line(" + mat4 = " & Image(+ mat4)); Assert_Mat2x4_Equals(+mat4, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line(" - mat4 = " & Image(- mat4)); Assert_Mat2x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0); Put_Line("+(- mat4) = " & Image(+(- mat4))); Assert_Mat2x4_Equals(-mat4, -0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0); Put_Line("Testing 'abs' operator..."); Put_Line(" abs(- mat4) = " & Image(abs(-mat4))); Assert_Mat2x4_Equals(abs(-mat4), 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0); Put_Line("Testing '+' operator..."); Put_Line(" mat4 + mat3 = " & Image(mat4 + mat3)); Assert_Mat2x4_Equals(mat4 + mat3, 1.0, 3.0, 5.0, 7.0, 3.0, 3.0, 3.0, 3.0); Put_Line("Testing '-' operator..."); Put_Line(" mat4 - mat3 = " & Image(mat4 -mat3)); Assert_Mat2x4_Equals(mat4 - mat3, -1.0, -1.0, -1.0, -1.0, 5.0, 7.0, 9.0, 11.0); Put_Line("Testing '*' operator..."); Put_Line(" mat5 * mat4 = " & Image(mat5 * mat4)); Assert_Mat2x4_Equals(mat5 * mat4, 0.0 , 5.0 , 10.0, 15.0, 20.0, 25.0, 30.0, 35.0); Put_Line(" mat4 * vec2 = " & Image(mat4 * vec2)); Assert_Vec2_Equals(mat4 * vec2, 20.0, 60.0); Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4)); Assert_Vec4_Equals(vec1 * mat4, 8.0, 11.0, 14.0, 17.0); end Test_Mat2x4; end Vulkan.Math.Mat2x4.Test;
oeis/047/A047857.asm
neoneye/loda-programs
11
24872
<gh_stars>10-100 ; A047857: a(n) = T(0,n) + T(1,n-1) + ... + T(n,0), array T given by A047848. ; Submitted by <NAME> ; 1,3,8,23,73,251,920,3573,14695,64047,295792,1445659,7460349,40539363,231303192,1381924345,8623569739,56078184471,379232618512,2662012084719,19362915524849,145719545817995,1133022996552664 mov $6,$0 add $6,1 mov $9,$0 lpb $6 mov $0,$9 mov $1,0 sub $6,1 sub $0,$6 add $0,1 mov $2,$0 mov $8,0 lpb $0 mov $3,$2 sub $2,1 dif $3,$0 mov $4,$0 sub $0,1 cmp $3,$2 sub $3,$2 cmp $4,0 mov $5,$4 add $5,1 sub $5,$3 add $8,1 pow $5,$8 add $1,$5 lpe add $7,$1 lpe mov $0,$7
programs/oeis/185/A185712.asm
neoneye/loda
22
102405
; A185712: a(n) = number of primes <= n that end in 3. ; 0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 lpb $0 mov $2,$0 sub $0,1 seq $2,185706 ; Characteristic function of positive numbers that are primes ending in 3. add $1,$2 lpe mov $0,$1
programs/oeis/067/A067726.asm
karttu/loda
1
9929
<reponame>karttu/loda ; A067726: a(n) = 6*n^2 + 12*n. ; 18,48,90,144,210,288,378,480,594,720,858,1008,1170,1344,1530,1728,1938,2160,2394,2640,2898,3168,3450,3744,4050,4368,4698,5040,5394,5760,6138,6528,6930,7344,7770,8208,8658,9120,9594,10080,10578,11088,11610,12144,12690,13248,13818,14400,14994,15600,16218,16848,17490,18144,18810,19488,20178,20880,21594,22320,23058,23808,24570,25344,26130,26928,27738,28560,29394,30240,31098,31968,32850,33744,34650,35568,36498,37440,38394,39360,40338,41328,42330,43344,44370,45408,46458,47520,48594,49680,50778,51888,53010,54144,55290,56448,57618,58800,59994,61200,62418,63648,64890,66144,67410,68688,69978,71280,72594,73920,75258,76608,77970,79344,80730,82128,83538,84960,86394,87840,89298,90768,92250,93744,95250,96768,98298,99840,101394,102960,104538,106128,107730,109344,110970,112608,114258,115920,117594,119280,120978,122688,124410,126144,127890,129648,131418,133200,134994,136800,138618,140448,142290,144144,146010,147888,149778,151680,153594,155520,157458,159408,161370,163344,165330,167328,169338,171360,173394,175440,177498,179568,181650,183744,185850,187968,190098,192240,194394,196560,198738,200928,203130,205344,207570,209808,212058,214320,216594,218880,221178,223488,225810,228144,230490,232848,235218,237600,239994,242400,244818,247248,249690,252144,254610,257088,259578,262080,264594,267120,269658,272208,274770,277344,279930,282528,285138,287760,290394,293040,295698,298368,301050,303744,306450,309168,311898,314640,317394,320160,322938,325728,328530,331344,334170,337008,339858,342720,345594,348480,351378,354288,357210,360144,363090,366048,369018,372000,374994,378000 mov $1,4 add $1,$0 mul $1,$0 mul $1,6 add $1,18
if-statement.asm
migg1012/Assembly-Tutorials
0
101030
;**************************************************************************** ; Author: <NAME> ; No warranty. Use at your own risk. ;**************************************************************************** ; ; IF statement in C: ; if ( a < b ) { ; temp = a; ; a = b; ; b = temp; ; } ; mov rax, [a] mov rbx, [b] cmp rax, rbx jge failedif mov [temp], rax mov [a], rbx mov [b], rax failedif:
programs/oeis/093/A093960.asm
karttu/loda
0
15619
; A093960: a(1) = 1, a(2) = 2, a(n + 1) = n*a(1) + (n-1)*a(2) + ...(n-r)*a(r + 1) + ... + a(n). ; 1,2,4,11,29,76,199,521,1364,3571,9349,24476,64079,167761,439204,1149851,3010349,7881196,20633239,54018521,141422324,370248451,969323029,2537720636,6643838879,17393796001,45537549124,119218851371,312119004989,817138163596,2139295485799,5600748293801,14662949395604,38388099893011,100501350283429,263115950957276,688846502588399,1803423556807921,4721424167835364 mul $0,2 sub $0,1 mov $1,1 lpb $0,1 sub $0,1 mov $2,1 trn $4,$1 add $2,$4 add $3,$1 add $1,$2 mov $4,$3 lpe
alloy4fun_models/trashltl/models/1/Wk7CYQX4wKg5rPcGs.als
Kaixi26/org.alloytools.alloy
0
4283
<gh_stars>0 open main pred idWk7CYQX4wKg5rPcGs_prop2 { (historically no File) until (some File) } pred __repair { idWk7CYQX4wKg5rPcGs_prop2 } check __repair { idWk7CYQX4wKg5rPcGs_prop2 <=> prop2o }