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 |
|---|---|---|---|---|
programs/oeis/224/A224668.asm | karttu/loda | 0 | 91866 | <reponame>karttu/loda
; A224668: Number of 6 X 6 0..n matrices with each 2 X 2 subblock idempotent.
; 428,542,668,806,956,1118,1292,1478,1676,1886,2108,2342,2588,2846,3116,3398,3692,3998,4316,4646,4988,5342,5708,6086,6476,6878,7292,7718,8156,8606,9068,9542,10028,10526,11036,11558,12092,12638,13196,13766,14348,14942,15548,16166,16796,17438,18092,18758,19436,20126,20828,21542,22268,23006,23756,24518,25292,26078,26876,27686,28508,29342,30188,31046,31916,32798,33692,34598,35516,36446,37388,38342,39308,40286,41276,42278,43292,44318,45356,46406,47468,48542,49628,50726,51836,52958,54092,55238,56396,57566,58748,59942,61148,62366,63596,64838,66092,67358,68636,69926,71228,72542,73868,75206,76556,77918,79292,80678,82076,83486,84908,86342,87788,89246,90716,92198,93692,95198,96716,98246,99788,101342,102908,104486,106076,107678,109292,110918,112556,114206,115868,117542,119228,120926,122636,124358,126092,127838,129596,131366,133148,134942,136748,138566,140396,142238,144092,145958,147836,149726,151628,153542,155468,157406,159356,161318,163292,165278,167276,169286,171308,173342,175388,177446,179516,181598,183692,185798,187916,190046,192188,194342,196508,198686,200876,203078,205292,207518,209756,212006,214268,216542,218828,221126,223436,225758,228092,230438,232796,235166,237548,239942,242348,244766,247196,249638,252092,254558,257036,259526,262028,264542,267068,269606,272156,274718,277292,279878,282476,285086
mov $1,$0
add $0,18
mul $1,$0
mul $1,6
add $1,428
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_133.asm | ljhsiun2/medusa | 9 | 88862 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1b88d, %rax
and $57550, %rdx
vmovups (%rax), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rbx
nop
nop
nop
nop
nop
dec %r9
lea addresses_WC_ht+0x5f11, %r13
nop
nop
nop
xor $63347, %r11
mov $0x6162636465666768, %rdi
movq %rdi, (%r13)
nop
sub $19587, %r11
lea addresses_A_ht+0x3a1d, %r11
nop
sub $52860, %rdi
movups (%r11), %xmm2
vpextrq $0, %xmm2, %rbx
nop
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_WC_ht+0x29c5, %rsi
lea addresses_UC_ht+0xfe0d, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $79, %rcx
rep movsb
mfence
lea addresses_UC_ht+0x4b6d, %rdi
nop
nop
nop
add $29170, %rax
movl $0x61626364, (%rdi)
nop
nop
and $25515, %rbx
lea addresses_D_ht+0xcb7d, %rsi
nop
nop
nop
dec %rdi
mov (%rsi), %r9d
nop
nop
nop
cmp $65529, %rdx
lea addresses_normal_ht+0x1948d, %rsi
lea addresses_A_ht+0x18e3d, %rdi
and %rbx, %rbx
mov $0, %rcx
rep movsb
nop
xor $22724, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r9
push %rsi
// Faulty Load
lea addresses_normal+0xc48d, %r10
xor %r13, %r13
movups (%r10), %xmm5
vpextrq $1, %xmm5, %r9
lea oracles, %rsi
and $0xff, %r9
shlq $12, %r9
mov (%rsi,%r9,1), %r9
pop %rsi
pop %r9
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'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
*/
|
programs/oeis/109/A109720.asm | neoneye/loda | 22 | 7125 | <filename>programs/oeis/109/A109720.asm
; A109720: Periodic sequence {0,1,1,1,1,1,1} or n^6 mod 7.
; 0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1
pow $0,6
mod $0,7
|
src/main/java/ReaderParser.g4 | pavponn/parser-generator | 0 | 5699 | <reponame>pavponn/parser-generator<gh_stars>0
grammar ReaderParser;
@header {
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
}
@members {
public static String termName = "TERM";
public int cnt = 0;
public grammar.NonTerminal start;
public Map<String, grammar.NonTerminal> nonTerminals = new HashMap<>();
public Map<String, grammar.Terminal> terminals = new HashMap<>();
static String removeBraces(String codeBlock) {
return codeBlock.substring(1, codeBlock.length() - 1).trim();
}
}
start returns [String title, String header, String members]
: GRAMMAR t=(RULE|TOKEN) SEMICOLON (HEADER h=CODE)? (MEMBERS m=CODE)? parseInput {
$title = ($t.text == null) ? "" : $t.text;
$header = ($h.text == null) ? "" : removeBraces($h.text);
$members = ($m.text == null) ? "" : removeBraces($m.text);
}
;
parseInput
: nt=nonTerminalName (inh[$nt.elem])? (RETURNS synth[$nt.elem])? (init[$nt.elem])?
COLON cases[$nt.elem] SEMICOLON parseInput
| t=terminalName COLON terminalDescription[$t.elem] SEMICOLON parseInput
| EOF
;
inh[grammar.Element elem]
: OBRACKET
v=varDescription { $elem.addInherited($v.type, $v.name); }
(COMMA v=varDescription { $elem.addInherited($v.type, $v.name); })*?
CBRACKET
;
synth[grammar.Element elem]
: OBRACKET v=varDescription { $elem.setSynthesizedAttribute($v.type, $v.name); } CBRACKET
;
varDescription returns [String type, String name]
: t=(TOKEN|RULE) n=(TOKEN|RULE) {
$type = $t.text;
$name = $n.text;
}
;
init[grammar.NonTerminal nt]
: INIT code=CODE {
if ($code.text == null) {
nt.setInit("");
} else {
nt.setInit(removeBraces($code.text));
}
}
;
nonTerminalName returns [grammar.NonTerminal elem]
: ruleName=RULE {
String name = $ruleName.text;
if (!nonTerminals.containsKey(name)) {
nonTerminals.put(name, new grammar.NonTerminal(name));
if (nonTerminals.size() == 1) start = nonTerminals.get(name);
}
$elem = nonTerminals.get(name);
}
;
terminalName returns [grammar.Terminal elem]
: token=TOKEN {
String name = $token.text;
if (!terminals.containsKey(name)) {
terminals.put(name, new grammar.Terminal(name));
}
$elem = terminals.get(name);
}
;
terminalDescription[grammar.Terminal elem]
: desc=ANY (VBAR tds=terminalDescription[$elem]) ? {
$elem.addStr(removeBraces($desc.text));
}
| desc=REGEXP (VBAR tds=terminalDescription[$elem])? {
$elem.addRegex($desc.text);
}
| desc=TOKEN (VBAR tds=terminalDescription[$elem])? {
if (terminals.containsKey($desc.text)) {
grammar.Terminal t = terminals.get($desc.text);
$elem.addAll(t.str);
$elem.addAllRegex(t.regex);
}
}
;
cases[grammar.NonTerminal elem]
:exprs[$elem, new grammar.Rule()] (VBAR cases[$elem])?
;
exprs[grammar.NonTerminal elem, grammar.Rule rule]
: expr[rule] exprs[$elem, $rule]
| expr[rule] {
$elem.addRule(rule);
}
;
expr[grammar.Rule rule]
: nt=nonTerminalName OBRACKET vs=variableNames CBRACKET (code=CODE)? {
$rule.add($nt.elem, $vs.args, $code.text == null ? null : removeBraces($code.text));
}
| nt=nonTerminalName (code=CODE)? {
$rule.add($nt.elem, null, $code.text == null ? null : removeBraces($code.text));
}
| t=terminal (code=CODE)? {
$rule.add($t.elem, null, $code.text == null ? null : removeBraces($code.text));
}
;
variableNames returns[List<String> args]
@init {
$args = new ArrayList<>();
}
:v=variableName COMMA vs=variableNames {
$args.add($v.name);
$args.addAll($vs.args);
}
| v=variableName {
$args.add($v.name);
}
;
variableName returns [String name]
: n=(TOKEN|RULE) {
$name = $n.text;
}
|n=CODE {
$name = removeBraces($n.text);
}
;
terminal returns [grammar.Terminal elem]
: name=terminalName {
$elem = $name.elem;
}
| t=REGEXP {
String name = termName.concat(Integer.toString(cnt++));
$elem = new grammar.Terminal(name);
$elem.addRegex($t.text);
terminals.put(name, $elem);
}
| t=ANY {
String name = termName.concat(Integer.toString(cnt++));
$elem = new grammar.Terminal(name);
$elem.addStr(removeBraces($t.text));
terminals.put(name, $elem);
}
;
VBAR : '|';
COLON : ':';
SEMICOLON : ';';
OPAREN : '(';
CPAREN : ')';
OBRACKET : '[';
CBRACKET : ']';
QUESTION : '?';
PLUS : '+';
STAR : '*';
COMMA : ',';
GRAMMAR : 'grammar';
HEADER : '@header';
MEMBERS : '@members';
INIT : '@init';
RETURNS : 'returns';
RULE : [a-z_][a-zA-Z0-9_]* ;
TOKEN : [A-Z][a-zA-Z0-9_]* ;
WSPACE : [\r\n\t ]+ -> skip;
REGEXP : '/'.+?'/';
ANY : '\''.+?'\'';
CODE : '{'.+?'}'; |
lib/avx/mb_mgr_zuc_submit_flush_avx.asm | dongbinghua/intel-ipsec-mb | 174 | 102581 | ;;
;; Copyright (c) 2019-2021, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "include/os.asm"
%include "include/imb_job.asm"
%include "include/mb_mgr_datastruct.asm"
%include "include/cet.inc"
%include "include/reg_sizes.asm"
%include "include/const.inc"
%define SUBMIT_JOB_ZUC128_EEA3 submit_job_zuc_eea3_avx
%define FLUSH_JOB_ZUC128_EEA3 flush_job_zuc_eea3_avx
%define SUBMIT_JOB_ZUC256_EEA3 submit_job_zuc256_eea3_avx
%define FLUSH_JOB_ZUC256_EEA3 flush_job_zuc256_eea3_avx
%define SUBMIT_JOB_ZUC128_EIA3 submit_job_zuc_eia3_avx
%define FLUSH_JOB_ZUC128_EIA3 flush_job_zuc_eia3_avx
%define SUBMIT_JOB_ZUC256_EIA3 submit_job_zuc256_eia3_avx
%define FLUSH_JOB_ZUC256_EIA3 flush_job_zuc256_eia3_avx
mksection .rodata
default rel
align 16
broadcast_word:
db 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01
db 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01
align 16
all_ffs_top_64bits:
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
db 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
clear_lane_mask_tab:
dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
clear_lane_mask_tab_start:
dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
align 16
bitmask_to_dword_tab:
dd 0x00000000, 0x00000000, 0x00000000, 0x00000000
dd 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000
dd 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000
dd 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000
dd 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000
dd 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000
dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000
dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000
dd 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF
dd 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF
dd 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF
dd 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF
dd 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF
dd 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF
dd 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
dd 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
select_bits_mask:
dq 0x3f
dq 0xfc0
dq 0x3f000
dq 0xfc0000
dq 0x3f000000
dq 0xfc0000000
dq 0x3f000000000
dq 0xfc0000000000
extern zuc_eia3_4_buffer_job_avx
extern zuc256_eia3_4_buffer_job_avx
extern asm_ZucInitialization_4_avx
extern asm_Zuc256Initialization_4_avx
extern asm_ZucCipher_4_avx
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define arg3 rdx
%define arg4 rcx
%define arg5 r8
%define arg6 r9
%else
%define arg1 rcx
%define arg2 rdx
%define arg3 r8
%define arg4 r9
%define arg5 [rsp + 32]
%define arg6 [rsp + 40]
%endif
%define state arg1
%define job arg2
%define job_rax rax
; This routine and its callee clobbers all GPRs
struc STACK
_state_save resq 2*(16+2) ; Space for ZUC LFSR + R1-2
_gpr_save: resq 10
_null_len_save: resq 1
_rsp_save: resq 1
endstruc
mksection .text
%define APPEND(a,b) a %+ b
%define APPEND3(a,b,c) a %+ b %+ c
;; Clear state for multiple lanes in the OOO managers
%macro CLEAR_ZUC_STATE 5
%define %%STATE %1 ;; [in] ZUC OOO manager pointer
%define %%LANE_MASK %2 ;; [in/clobbered] bitmask with lanes to clear
%define %%TMP %3 ;; [clobbered] Temporary GP register
%define %%XTMP1 %4 ;; [clobbered] Temporary XMM register
%define %%XTMP2 %5 ;; [clobbered] Temporary XMM register
lea %%TMP, [rel bitmask_to_dword_tab]
shl %%LANE_MASK, 4 ; Multiply by 16 to move through the table
vmovdqa %%XTMP1, [%%TMP + %%LANE_MASK]
;; Clear state for lanes
%assign I 0
%rep (16 + 6)
vpandn %%XTMP2, %%XTMP1, [%%STATE + _zuc_state + I*16]
vmovdqa [%%STATE + _zuc_state + I*16], %%XTMP2
%assign I (I + 1)
%endrep
%endmacro
;; Clear state for a specified lane in the OOO manager
%macro CLEAR_ZUC_LANE_STATE 5
%define %%STATE %1 ;; [in] ZUC OOO manager pointer
%define %%LANE %2 ;; [in/clobbered] lane index
%define %%TMP %3 ;; [clobbered] Temporary GP register
%define %%XTMP1 %4 ;; [clobbered] Temporary YMM register
%define %%XTMP2 %5 ;; [clobbered] Temporary YMM register
shl %%LANE, 2
lea %%TMP, [rel clear_lane_mask_tab_start]
sub %%TMP, %%LANE
vmovdqu %%XTMP1, [%%TMP]
%assign I 0
%rep (16 + 6)
vmovdqa %%XTMP2, [%%STATE + _zuc_state + I*16]
vpand %%XTMP2, %%XTMP1
vmovdqa [%%STATE + _zuc_state + I*16], %%XTMP2
%assign I (I + 1)
%endrep
%endmacro
;; Read 8x6 bits and store them as 8 partial bytes
;; (using 6 least significant bits)
%macro EXPAND_FROM_6_TO_8_BYTES 3
%define %%IN_OUT %1 ; [in/out] Input/output GP register
%define %%INPUT_COPY %2 ; [clobbered] Temporary GP register
%define %%TMP %3 ; [clobbered] Temporary GP register
mov %%INPUT_COPY, %%IN_OUT
mov %%TMP, %%INPUT_COPY
; Read bits [5:0] from input
and %%TMP, [rel select_bits_mask]
; Store bits [7:0] in output
mov %%IN_OUT, %%TMP
%assign %%i 1
%rep 7
mov %%TMP, %%INPUT_COPY
; Read bits [6*i + 5 : 6*i] from input
and %%TMP, [rel select_bits_mask + 8*%%i]
; Store bits [8*i + 7 : 8*i] in output
shl %%TMP, (2*%%i)
or %%IN_OUT, %%TMP
%assign %%i (%%i + 1)
%endrep
%endmacro
%macro SUBMIT_JOB_ZUC_EEA3 1
%define %%KEY_SIZE %1 ; [constant] Key size (128 or 256)
; idx needs to be in rbp
%define len rbp
%define idx rbp
%define lane r8
%define unused_lanes rbx
%define tmp r11
%define tmp2 r13
%define tmp3 r14
%define min_len r15
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _gpr_save + 8*8], state
mov [rsp + _gpr_save + 8*9], job
mov [rsp + _rsp_save], rax ; original SP
mov unused_lanes, [state + _zuc_unused_lanes]
movzx lane, BYTE(unused_lanes)
shr unused_lanes, 8
mov tmp, [job + _iv]
shl lane, 5
%if %%KEY_SIZE == 128
; Read first 16 bytes of IV
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
%else ;; %%KEY_SIZE == 256
cmp qword [job + _iv_len_in_bytes], 25
je %%_iv_size_25
%%_iv_size_23:
; Read 23 bytes of IV and expand to 25 bytes
; then expand the last 6 bytes to 8 bytes
; Read and write first 16 bytes
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
; Read and write next byte
mov al, [tmp + 16]
mov [state + _zuc_args_IV + lane + 16], al
; Read next 6 bytes and write as 8 bytes
movzx DWORD(tmp2), word [tmp + 17]
mov DWORD(tmp3), [tmp + 19]
shl tmp2, 32
or tmp2, tmp3
EXPAND_FROM_6_TO_8_BYTES tmp2, tmp, tmp3
mov [state + _zuc_args_IV + lane + 17], tmp2
jmp %%_iv_read
%%_iv_size_25:
; Read 25 bytes of IV
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
vmovq xmm0, [tmp + 16]
vpinsrb xmm0, [tmp + 24], 8
vmovdqa [state + _zuc_args_IV + lane + 16], xmm0
%%_iv_read:
%endif
shr lane, 5
mov [state + _zuc_unused_lanes], unused_lanes
mov [state + _zuc_job_in_lane + lane*8], job
; New job that needs init (update bit in zuc_init_not_done bitmask)
SHIFT_GP 1, lane, tmp, tmp2, left
or [state + _zuc_init_not_done], BYTE(tmp)
not tmp
and [state + _zuc_unused_lane_bitmask], BYTE(tmp)
mov tmp, [job + _src]
add tmp, [job + _cipher_start_src_offset_in_bytes]
mov [state + _zuc_args_in + lane*8], tmp
mov tmp, [job + _enc_keys]
mov [state + _zuc_args_keys + lane*8], tmp
mov tmp, [job + _dst]
mov [state + _zuc_args_out + lane*8], tmp
;; insert len into proper lane
mov len, [job + _msg_len_to_cipher_in_bytes]
vmovq xmm0, [state + _zuc_lens]
XVPINSRW xmm0, xmm1, tmp, lane, len, scale_x16
vmovq [state + _zuc_lens], xmm0
cmp unused_lanes, 0xff
jne %%return_null_submit_eea3
; Set all ffs in top 64 bits to invalid them
vpor xmm0, [rel all_ffs_top_64bits]
; Find minimum length (searching for zero length,
; to retrieve already encrypted buffers)
vphminposuw xmm1, xmm0
vpextrw min_len, xmm1, 0 ; min value
vpextrw idx, xmm1, 1 ; min index (0...3)
cmp min_len, 0
je %%len_is_0_submit_eea3
; Move state into r12, as register for state will be used
; to pass parameter to next function
mov r12, state
%assign I 0
%rep (16 + 2)
vmovdqa xmm0, [r12 + _zuc_state + 16*I]
vmovdqa [rsp + _state_save + 16*I], xmm0
%assign I (I + 1)
%endrep
;; If Windows, reserve memory in stack for parameter transferring
%ifndef LINUX
;; 24 bytes for 3 parameters
sub rsp, 24
%endif
lea arg1, [r12 + _zuc_args_keys]
lea arg2, [r12 + _zuc_args_IV]
lea arg3, [r12 + _zuc_state]
%if %%KEY_SIZE == 256
;; Setting "tag size" to 2 in case of ciphering
;; (dummy size, just for constant selecion at Initialization)
mov arg4, 2
%endif
%if %%KEY_SIZE == 128
call asm_ZucInitialization_4_avx
%else
call asm_Zuc256Initialization_4_avx
%endif
%ifndef LINUX
add rsp, 24
%endif
cmp byte [r12 + _zuc_init_not_done], 0x0f ; Init done for all lanes
je %%skip_submit_restoring_state
;; Load mask containing FF's in lanes which init has just been done
movzx DWORD(tmp3), byte [r12 + _zuc_init_not_done]
lea tmp2, [rel bitmask_to_dword_tab]
shl tmp3, 4 ; Multiply by 16 to move through the table
vmovdqa xmm2, [tmp3 + tmp2]
;; Restore state from stack for lanes that did not need init
%assign I 0
%rep (16 + 2)
vmovdqa xmm0, [rsp + _state_save + 16*I] ; State before init
vmovdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init
; Zero out lanes that need to be restored in current state
vpand xmm1, xmm2
; Zero out lanes that do not need to be restored in saved state
vpandn xmm0, xmm2, xmm0
vpor xmm1, xmm0
vmovdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state
%assign I (I + 1)
%endrep
%%skip_submit_restoring_state:
%ifdef SAFE_DATA
;; Clear stack containing state info
vpxor xmm0, xmm0
%assign I 0
%rep (16 + 2)
vmovdqa [rsp + _state_save + 16*I], xmm0
%assign I (I + 1)
%endrep
%endif
mov byte [r12 + _zuc_init_not_done], 0 ; Init done for all lanes
;; If Windows, reserve memory in stack for parameter transferring
%ifndef LINUX
;; 40 bytes for 5 parameters
sub rsp, 40
%endif
lea arg1, [r12 + _zuc_state]
lea arg2, [r12 + _zuc_args_in]
lea arg3, [r12 + _zuc_args_out]
lea arg4, [r12 + _zuc_lens]
mov arg5, min_len
call asm_ZucCipher_4_avx
%ifndef LINUX
add rsp, 40
%endif
mov state, [rsp + _gpr_save + 8*8]
mov job, [rsp + _gpr_save + 8*9]
%%len_is_0_submit_eea3:
; process completed job "idx"
mov job_rax, [state + _zuc_job_in_lane + idx*8]
mov unused_lanes, [state + _zuc_unused_lanes]
mov qword [state + _zuc_job_in_lane + idx*8], 0
or dword [job_rax + _status], IMB_STATUS_COMPLETED_CIPHER
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _zuc_unused_lanes], unused_lanes
SHIFT_GP 1, idx, tmp, tmp2, left
or [state + _zuc_unused_lane_bitmask], BYTE(tmp)
%ifdef SAFE_DATA
; Clear ZUC state of the lane that is returned
CLEAR_ZUC_LANE_STATE state, idx, tmp, xmm0, xmm1
%endif
%%return_submit_eea3:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%%return_null_submit_eea3:
xor job_rax, job_rax
jmp %%return_submit_eea3
%endmacro
%macro FLUSH_JOB_ZUC_EEA3 1
%define %%KEY_SIZE %1 ; [constant] Key size (128 or 256)
%define unused_lanes rbx
%define tmp1 rbx
%define tmp2 rax
; idx needs to be in rbp
%define tmp rbp
%define idx rbp
%define tmp3 r8
%define tmp4 r9
%define tmp5 r10
%define min_len r14 ; Will be maintained after function calls
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _gpr_save + 8*8], state
mov [rsp + _rsp_save], rax ; original SP
; check for empty
mov unused_lanes, [state + _zuc_unused_lanes]
bt unused_lanes, 32+7
jc %%return_null_flush_eea3
; Set length = 0xFFFF in NULL jobs
vmovq xmm0, [state + _zuc_lens]
mov DWORD(tmp3), 0xffff
%assign I 0
%rep 4
cmp qword [state + _zuc_job_in_lane + I*8], 0
jne APPEND(%%skip_copy_ffs_,I)
vpinsrw xmm0, DWORD(tmp3), I
APPEND(%%skip_copy_ffs_,I):
%assign I (I+1)
%endrep
vmovq [state + _zuc_lens], xmm0
; Set all ffs in top 64 bits to invalid them
vpor xmm0, [rel all_ffs_top_64bits]
; Find minimum length (searching for zero length,
; to retrieve already encrypted buffers)
vphminposuw xmm1, xmm0
vpextrw min_len, xmm1, 0 ; min value
vpextrw idx, xmm1, 1 ; min index (0...3)
cmp min_len, 0
je %%len_is_0_flush_eea3
; copy good_lane to empty lanes
mov tmp1, [state + _zuc_args_in + idx*8]
mov tmp2, [state + _zuc_args_out + idx*8]
mov tmp3, [state + _zuc_args_keys + idx*8]
%assign I 0
%rep 4
cmp qword [state + _zuc_job_in_lane + I*8], 0
jne APPEND(%%skip_eea3_,I)
mov [state + _zuc_args_in + I*8], tmp1
mov [state + _zuc_args_out + I*8], tmp2
mov [state + _zuc_args_keys + I*8], tmp3
APPEND(%%skip_eea3_,I):
%assign I (I+1)
%endrep
; Move state into r12, as register for state will be used
; to pass parameter to next function
mov r12, state
cmp word [r12 + _zuc_init_not_done], 0
je %%skip_flush_init
%assign I 0
%rep (16 + 2)
vmovdqa xmm0, [r12 + _zuc_state + 16*I]
vmovdqa [rsp + _state_save + 16*I], xmm0
%assign I (I + 1)
%endrep
;; If Windows, reserve memory in stack for parameter transferring
%ifndef LINUX
;; 24 bytes for 3 parameters
sub rsp, 24
%endif
lea arg1, [r12 + _zuc_args_keys]
lea arg2, [r12 + _zuc_args_IV]
lea arg3, [r12 + _zuc_state]
%if %%KEY_SIZE == 256
;; Setting "tag size" to 2 in case of ciphering
;; (dummy size, just for constant selecion at Initialization)
mov arg4, 2
%endif
%if %%KEY_SIZE == 128
call asm_ZucInitialization_4_avx
%else
call asm_Zuc256Initialization_4_avx
%endif
%ifndef LINUX
add rsp, 24
%endif
cmp word [r12 + _zuc_init_not_done], 0x0f ; Init done for all lanes
je %%skip_flush_restoring_state
;; Load mask containing FF's in lanes which init has just been done
movzx DWORD(tmp3), byte [r12 + _zuc_init_not_done]
lea tmp2, [rel bitmask_to_dword_tab]
shl tmp3, 4 ; Multiply by 16 to move through the table
vmovdqa xmm2, [tmp3 + tmp2]
;; Restore state from stack for lanes that did not need init
%assign I 0
%rep (16 + 2)
vmovdqa xmm0, [rsp + _state_save + 16*I] ; State before init
vmovdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init
; Zero out lanes that need to be restored in current state
vpand xmm1, xmm2
; Zero out lanes that do not need to be restored in saved state
vpandn xmm0, xmm2, xmm0
vpor xmm1, xmm0
vmovdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state
%assign I (I + 1)
%endrep
%%skip_flush_restoring_state:
%ifdef SAFE_DATA
;; Clear stack containing state info
vpxor xmm0, xmm0
%assign I 0
%rep (16 + 2)
vmovdqa [rsp + _state_save + 16*I], xmm0
%assign I (I + 1)
%endrep
%endif
mov word [r12 + _zuc_init_not_done], 0 ; Init done for all lanes
%%skip_flush_init:
;; Copy state from good lane to NULL lanes
%assign I 0
%rep (16 + 2)
; Read dword from good lane and broadcast to NULL lanes
mov r13d, [r12 + _zuc_state + 16*I + idx*4]
vmovdqa xmm1, [r12 + _zuc_state + 16*I] ; State after init
%assign J 0
%rep 4
cmp qword [r12 + _zuc_job_in_lane + J*8], 0
jne APPEND3(%%skip_eea3_copy_,I,J)
vpinsrd xmm1, r13d, J
APPEND3(%%skip_eea3_copy_,I,J):
%assign J (J+1)
%endrep
vmovdqa [r12 + _zuc_state + 16*I], xmm1 ; Save new state
%assign I (I+1)
%endrep
;; If Windows, reserve memory in stack for parameter transferring
%ifndef LINUX
;; 40 bytes for 5 parameters
sub rsp, 40
%endif
lea arg1, [r12 + _zuc_state]
lea arg2, [r12 + _zuc_args_in]
lea arg3, [r12 + _zuc_args_out]
lea arg4, [r12 + _zuc_lens]
mov arg5, min_len
call asm_ZucCipher_4_avx
%ifndef LINUX
add rsp, 40
%endif
mov state, [rsp + _gpr_save + 8*8]
; Clear ZUC state of the lane that is returned and NULL lanes
%ifdef SAFE_DATA
SHIFT_GP 1, idx, tmp1, tmp2, left
movzx DWORD(tmp3), byte [state + _zuc_unused_lane_bitmask]
or tmp3, tmp1 ;; bitmask with NULL lanes and job to return
CLEAR_ZUC_STATE state, tmp3, tmp2, xmm0, xmm1
jmp %%skip_flush_clear_state
%endif
%%len_is_0_flush_eea3:
%ifdef SAFE_DATA
; Clear ZUC state of the lane that is returned
mov tmp2, idx
CLEAR_ZUC_LANE_STATE state, tmp2, tmp3, xmm0, xmm1
%%skip_flush_clear_state:
%endif
; process completed job "idx"
mov job_rax, [state + _zuc_job_in_lane + idx*8]
mov unused_lanes, [state + _zuc_unused_lanes]
mov qword [state + _zuc_job_in_lane + idx*8], 0
or dword [job_rax + _status], IMB_STATUS_COMPLETED_CIPHER
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _zuc_unused_lanes], unused_lanes
SHIFT_GP 1, idx, tmp3, tmp4, left
or [state + _zuc_unused_lane_bitmask], BYTE(tmp3)
%%return_flush_eea3:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%%return_null_flush_eea3:
xor job_rax, job_rax
jmp %%return_flush_eea3
%endmacro
; JOB* SUBMIT_JOB_ZUC128_EEA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job)
; arg 1 : state
; arg 2 : job
MKGLOBAL(SUBMIT_JOB_ZUC128_EEA3,function,internal)
SUBMIT_JOB_ZUC128_EEA3:
SUBMIT_JOB_ZUC_EEA3 128
; JOB* SUBMIT_JOB_ZUC256_EEA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job)
; arg 1 : state
; arg 2 : job
MKGLOBAL(SUBMIT_JOB_ZUC256_EEA3,function,internal)
SUBMIT_JOB_ZUC256_EEA3:
SUBMIT_JOB_ZUC_EEA3 256
; JOB* FLUSH_JOB_ZUC128_EEA3(MB_MGR_ZUC_OOO *state)
; arg 1 : state
MKGLOBAL(FLUSH_JOB_ZUC128_EEA3,function,internal)
FLUSH_JOB_ZUC128_EEA3:
FLUSH_JOB_ZUC_EEA3 128
; JOB* FLUSH_JOB_ZUC256_EEA3(MB_MGR_ZUC_OOO *state)
; arg 1 : state
MKGLOBAL(FLUSH_JOB_ZUC256_EEA3,function,internal)
FLUSH_JOB_ZUC256_EEA3:
FLUSH_JOB_ZUC_EEA3 256
%macro SUBMIT_JOB_ZUC_EIA3 1
%define %%KEY_SIZE %1 ; [constant] Key size (128 or 256)
; idx needs to be in rbp
%define len rbp
%define idx rbp
%define tmp rbp
%define tmp2 r14
%define tmp3 r15
%define lane r8
%define unused_lanes rbx
%define len2 r13
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _gpr_save + 8*8], state
mov [rsp + _gpr_save + 8*9], job
mov [rsp + _rsp_save], rax ; original SP
mov unused_lanes, [state + _zuc_unused_lanes]
movzx lane, BYTE(unused_lanes)
shr unused_lanes, 8
mov tmp, [job + _zuc_eia3_iv]
shl lane, 5
%if %%KEY_SIZE == 128
; Read first 16 bytes of IV
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
%else ;; %%KEY_SIZE == 256
or tmp, tmp
jnz %%_iv_size_25
%%_iv_size_23:
; Read 23 bytes of IV and expand to 25 bytes
; then expand the last 6 bytes to 8 bytes
mov tmp, [job + _zuc_eia3_iv23]
; Read and write first 16 bytes
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
; Read and write next byte
mov al, [tmp + 16]
mov [state + _zuc_args_IV + lane + 16], al
; Read next 6 bytes and write as 8 bytes
movzx DWORD(tmp2), word [tmp + 17]
mov DWORD(tmp3), [tmp + 19]
shl tmp2, 32
or tmp2, tmp3
EXPAND_FROM_6_TO_8_BYTES tmp2, tmp, tmp3
mov [state + _zuc_args_IV + lane + 17], tmp2
jmp %%_iv_read
%%_iv_size_25:
; Read 25 bytes of IV
vmovdqu xmm0, [tmp]
vmovdqa [state + _zuc_args_IV + lane], xmm0
vmovq xmm0, [tmp + 16]
vpinsrb xmm0, [tmp + 24], 8
vmovdqa [state + _zuc_args_IV + lane + 16], xmm0
%%_iv_read:
%endif
shr lane, 5
mov [state + _zuc_unused_lanes], unused_lanes
mov [state + _zuc_job_in_lane + lane*8], job
mov tmp, [job + _src]
add tmp, [job + _hash_start_src_offset_in_bytes]
mov [state + _zuc_args_in + lane*8], tmp
mov tmp, [job + _zuc_eia3_key]
mov [state + _zuc_args_keys + lane*8], tmp
mov tmp, [job + _auth_tag_output]
mov [state + _zuc_args_out + lane*8], tmp
;; insert len into proper lane
mov len, [job + _msg_len_to_hash_in_bits]
vmovdqa xmm0, [state + _zuc_lens]
XVPINSRW xmm0, xmm1, tmp, lane, len, scale_x16
vmovdqa [state + _zuc_lens], xmm0
cmp unused_lanes, 0xff
jne %%return_null_submit_eia3
; Find minimum length (searching for zero length,
; to retrieve already encrypted buffers)
vphminposuw xmm1, xmm0
vpextrw len2, xmm1, 0 ; min value
vpextrw idx, xmm1, 1 ; min index (0...3)
cmp len2, 0
je %%len_is_0_submit_eia3
; Move state into r11, as register for state will be used
; to pass parameter to next function
mov r11, state
;; If Windows, reserve memory in stack for parameter transferring
%ifndef LINUX
;; 48 bytes for 6 parameters (already aligned to 16 bytes)
sub rsp, 48
%endif
lea arg1, [r11 + _zuc_args_keys]
lea arg2, [r11 + _zuc_args_IV]
lea arg3, [r11 + _zuc_args_in]
lea arg4, [r11 + _zuc_args_out]
%ifdef LINUX
lea arg5, [r11 + _zuc_lens]
lea arg6, [r11 + _zuc_job_in_lane]
%else
lea r12, [r11 + _zuc_lens]
mov arg5, r12
lea r12, [r11 + _zuc_job_in_lane]
mov arg6, r12
%endif
%if %%KEY_SIZE == 128
call zuc_eia3_4_buffer_job_avx
%else
call zuc256_eia3_4_buffer_job_avx
%endif
%ifndef LINUX
add rsp, 48
%endif
mov state, [rsp + _gpr_save + 8*8]
mov job, [rsp + _gpr_save + 8*9]
;; Clear all lengths (function will authenticate all buffers)
mov qword [state + _zuc_lens], 0
%%len_is_0_submit_eia3:
; process completed job "idx"
mov job_rax, [state + _zuc_job_in_lane + idx*8]
mov unused_lanes, [state + _zuc_unused_lanes]
mov qword [state + _zuc_job_in_lane + idx*8], 0
or dword [job_rax + _status], IMB_STATUS_COMPLETED_AUTH
;; TODO: fix double store (above setting the length to 0 and now setting to FFFFF)
mov word [state + _zuc_lens + idx*2], 0xFFFF
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _zuc_unused_lanes], unused_lanes
%%return_submit_eia3:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%%return_null_submit_eia3:
xor job_rax, job_rax
jmp %%return_submit_eia3
%endmacro
%macro FLUSH_JOB_ZUC_EIA3 1
%define %%KEY_SIZE %1 ; [constant] Key size (128 or 256)
%define unused_lanes rbx
%define tmp1 rbx
%define tmp2 rax
; idx needs to be in rbp
%define tmp rbp
%define idx rbp
%define tmp3 r8
%define tmp4 r9
%define tmp5 r10
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _gpr_save + 8*8], state
mov [rsp + _rsp_save], rax ; original SP
; check for empty
mov unused_lanes, [state + _zuc_unused_lanes]
bt unused_lanes, 32+7
jc %%return_null_flush_eia3
; Find minimum length (searching for zero length,
; to retrieve already authenticated buffers)
vmovdqa xmm0, [state + _zuc_lens]
vphminposuw xmm1, xmm0
vpextrw len2, xmm1, 0 ; min value
vpextrw idx, xmm1, 1 ; min index (0...3)
cmp len2, 0
je %%len_is_0_flush_eia3
; copy good_lane to empty lanes
mov tmp1, [state + _zuc_args_in + idx*8]
mov tmp2, [state + _zuc_args_out + idx*8]
mov tmp3, [state + _zuc_args_keys + idx*8]
mov WORD(tmp5), [state + _zuc_lens + idx*2]
; Set valid length in NULL jobs
vmovd xmm0, DWORD(tmp5)
vpshufb xmm0, xmm0, [rel broadcast_word]
vmovdqa xmm1, [state + _zuc_lens]
vpcmpeqw xmm2, xmm2 ;; Get all ff's in XMM register
vpcmpeqw xmm3, xmm1, xmm2 ;; Mask with FFFF in NULL jobs
vmovq tmp5, xmm3
mov [rsp + _null_len_save], tmp5 ;; Save lengths with FFFF in NULL jobs
vpand xmm4, xmm3, xmm0 ;; Length of valid job in all NULL jobs
vpxor xmm2, xmm3 ;; Mask with 0000 in NULL jobs
vpand xmm1, xmm2 ;; Zero out lengths of NULL jobs
vpor xmm1, xmm4
vmovq tmp5, xmm1
mov [state + _zuc_lens], tmp5
%assign I 0
%rep 4
cmp qword [state + _zuc_job_in_lane + I*8], 0
jne APPEND(%%skip_eia3_,I)
mov [state + _zuc_args_in + I*8], tmp1
mov [state + _zuc_args_out + I*8], tmp2
mov [state + _zuc_args_keys + I*8], tmp3
APPEND(%%skip_eia3_,I):
%assign I (I+1)
%endrep
; Move state into r11, as register for state will be used
; to pass parameter to next function
mov r11, state
%ifndef LINUX
;; 48 bytes for 6 parameters (already aligned to 16 bytes)
sub rsp, 48
%endif
lea arg1, [r11 + _zuc_args_keys]
lea arg2, [r11 + _zuc_args_IV]
lea arg3, [r11 + _zuc_args_in]
lea arg4, [r11 + _zuc_args_out]
%ifdef LINUX
lea arg5, [r11 + _zuc_lens]
lea arg6, [r11 + _zuc_job_in_lane]
%else
lea r12, [r11 + _zuc_lens]
mov arg5, r12
lea r12, [r11 + _zuc_job_in_lane]
mov arg6, r12
%endif
%if %%KEY_SIZE == 128
call zuc_eia3_4_buffer_job_avx
%else
call zuc256_eia3_4_buffer_job_avx
%endif
%ifndef LINUX
add rsp, 48
%endif
mov tmp5, [rsp + _null_len_save]
mov state, [rsp + _gpr_save + 8*8]
;; Clear all lengths of valid jobs and set to FFFF to NULL jobs
mov qword [state + _zuc_lens], tmp5
%%len_is_0_flush_eia3:
; process completed job "idx"
mov job_rax, [state + _zuc_job_in_lane + idx*8]
mov unused_lanes, [state + _zuc_unused_lanes]
mov qword [state + _zuc_job_in_lane + idx*8], 0
or dword [job_rax + _status], IMB_STATUS_COMPLETED_AUTH
;; TODO: fix double store (above setting the length to 0 and now setting to FFFFF)
mov word [state + _zuc_lens + idx*2], 0xFFFF
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _zuc_unused_lanes], unused_lanes
%%return_flush_eia3:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%%return_null_flush_eia3:
xor job_rax, job_rax
jmp %%return_flush_eia3
%endmacro
; JOB* SUBMIT_JOB_ZUC128_EIA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job)
; arg 1 : state
; arg 2 : job
MKGLOBAL(SUBMIT_JOB_ZUC128_EIA3,function,internal)
SUBMIT_JOB_ZUC128_EIA3:
SUBMIT_JOB_ZUC_EIA3 128
; JOB* SUBMIT_JOB_ZUC256_EIA3(MB_MGR_ZUC_OOO *state, IMB_JOB *job)
; arg 1 : state
; arg 2 : job
MKGLOBAL(SUBMIT_JOB_ZUC256_EIA3,function,internal)
SUBMIT_JOB_ZUC256_EIA3:
SUBMIT_JOB_ZUC_EIA3 256
; JOB* FLUSH_JOB_ZUC128_EIA3(MB_MGR_ZUC_OOO *state)
; arg 1 : state
MKGLOBAL(FLUSH_JOB_ZUC128_EIA3,function,internal)
FLUSH_JOB_ZUC128_EIA3:
FLUSH_JOB_ZUC_EIA3 128
; JOB* FLUSH_JOB_ZUC256_EIA3(MB_MGR_ZUC_OOO *state)
; arg 1 : state
MKGLOBAL(FLUSH_JOB_ZUC256_EIA3,function,internal)
FLUSH_JOB_ZUC256_EIA3:
FLUSH_JOB_ZUC_EIA3 256
mksection stack-noexec
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1353.asm | ljhsiun2/medusa | 9 | 243388 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1b99d, %r9
nop
nop
nop
nop
nop
cmp $17883, %r12
mov $0x6162636465666768, %r15
movq %r15, (%r9)
nop
nop
nop
add %r15, %r15
lea addresses_WC_ht+0x14f9, %rdi
clflush (%rdi)
nop
nop
and $51585, %rdx
movw $0x6162, (%rdi)
nop
xor $32605, %rdx
lea addresses_A_ht+0x8c9d, %r9
nop
nop
nop
nop
nop
add %rbp, %rbp
mov (%r9), %r12w
nop
nop
nop
nop
nop
cmp $62761, %r8
lea addresses_UC_ht+0x759d, %rbp
nop
and $7478, %r12
vmovups (%rbp), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdx
nop
nop
nop
nop
cmp $48108, %r9
lea addresses_D_ht+0x1bf9d, %rsi
lea addresses_D_ht+0x13a2d, %rdi
nop
nop
add $32168, %r12
mov $66, %rcx
rep movsq
nop
add %r12, %r12
lea addresses_normal_ht+0x1dd9d, %r9
nop
nop
nop
xor %rdx, %rdx
movups (%r9), %xmm2
vpextrq $1, %xmm2, %rbp
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x479d, %r9
nop
nop
nop
nop
lfence
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
and $0xffffffffffffffc0, %r9
movntdq %xmm7, (%r9)
nop
nop
nop
nop
nop
add %rbp, %rbp
lea addresses_WT_ht+0x1c39d, %r8
nop
nop
add $25652, %rbp
mov (%r8), %r9w
nop
nop
nop
xor $59425, %rsi
lea addresses_normal_ht+0x6ad5, %r8
nop
nop
nop
nop
sub $33438, %rsi
mov (%r8), %di
nop
add %rdi, %rdi
lea addresses_normal_ht+0x421d, %rbp
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %r9
movq %r9, (%rbp)
nop
nop
nop
nop
nop
add $3537, %r8
lea addresses_WC_ht+0x4381, %rdi
nop
sub %r12, %r12
movb (%rdi), %r8b
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_WC_ht+0x18f3d, %rcx
nop
nop
inc %r15
mov (%rcx), %si
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_WT_ht+0xad9d, %r12
nop
nop
nop
nop
and $30124, %rdx
movl $0x61626364, (%r12)
sub %rdx, %rdx
lea addresses_WT_ht+0x8c85, %r9
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
movups %xmm7, (%r9)
nop
nop
nop
nop
and $46045, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rax
push %rdi
push %rdx
push %rsi
// Store
lea addresses_RW+0x2d9d, %rax
and %rsi, %rsi
mov $0x5152535455565758, %r10
movq %r10, (%rax)
nop
nop
nop
nop
cmp $28802, %rax
// Store
lea addresses_normal+0x481d, %r13
nop
nop
nop
add $64511, %r8
mov $0x5152535455565758, %r10
movq %r10, (%r13)
nop
nop
add $5411, %rsi
// Faulty Load
lea addresses_RW+0x2d9d, %r13
nop
nop
nop
nop
nop
sub $469, %r10
mov (%r13), %rdi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
util/dummy/posn.asm | olifink/smsqe | 0 | 83787 | <gh_stars>0
; Dummies for QP_IPOS and QP_POSP
section dummy
xdef qp_fxps
xdef qp_posn
qp_fxps dc.b 0
qp_posn dc.l 0
end
|
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_asinh.asm | jpoikela/z88dk | 640 | 162423 | <reponame>jpoikela/z88dk<filename>libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_asinh.asm
SECTION code_clib
SECTION code_fp_math48
PUBLIC asm_asinh
EXTERN am48_asinh
defc asm_asinh = am48_asinh
|
src/audio.asm | howprice/specnext-invaders | 17 | 84651 | <filename>src/audio.asm<gh_stars>10-100
InitAudio:
; Set AY mono mode to avoid sound effects and music being randomly ABC panned (This doesn't currently work on CSpect)
; n.b. Read current nextreg value,to preserve the user's bits 2:0 (silence HDMI audio and scanline weight)
ld bc,PORT_NEXTREG_REGISTER_SELECT
ld a,NEXTREG_PERIPHERAL_4
out (c),a ; select NextReg
inc b ; BC = TBBLUE_REGISTER_ACCESS_P_253B
in a,(c) ; A <- NextReg value
or %111'00'00'0 ; mask on bits 7:5 to enable mono mode for AY chips 2:0
and %111'00'11'1 ; mask off bit 4 "Sprite id lockstep" n.b. read bit 3 always returns 0 so doesn't matter
nextreg NEXTREG_PERIPHERAL_4,a ; NextReg <- A
call InitMusic
ld hl,pAyfxSoundEffectsBank
call AyfxInit
ret
|
src/interface/yaml-dom-node.ads | robdaemon/AdaYaml | 32 | 23674 | -- part of AdaYaml, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
with Yaml.Dom.Sequence_Data;
with Yaml.Dom.Mapping_Data;
package Yaml.Dom.Node is
type Instance (Kind : Node_Kind) is record
Tag : Text.Reference;
case Kind is
when Scalar =>
Scalar_Style : Scalar_Style_Type;
Content : Text.Reference;
when Sequence =>
Sequence_Style : Collection_Style_Type;
Items : Sequence_Data.Instance;
when Mapping =>
Mapping_Style : Collection_Style_Type;
Pairs : Mapping_Data.Instance;
end case;
end record;
function "=" (Left, Right : Instance) return Boolean;
function Hash (Object : Instance) return Ada.Containers.Hash_Type;
end Yaml.Dom.Node;
|
test/sgadd.asm | kspalaiologos/asmbf | 67 | 162301 |
mov r1, $(signed(-3))
mov r2, $(signed(-2))
s07 r1, r2
eq r1, $(0xB)
add r1, .0
out r1
mov r1, $(signed(-3))
mov r2, $(signed(2))
s07 r1, r2
eq r1, $(0x3)
add r1, .0
out r1
mov r1, $(signed(3))
mov r2, $(signed(-2))
s07 r1, r2
eq r1, $(0x2)
add r1, .0
out r1
mov r1, $(signed(3))
mov r2, $(signed(2))
s07 r1, r2
eq r1, $(0xA)
add r1, .0
out r1
mov r1, $(signed(-2))
mov r2, $(signed(-3))
s07 r1, r2
eq r1, $(0xB)
add r1, .0
out r1
mov r1, $(signed(2))
mov r2, $(signed(3))
s07 r1, r2
eq r1, $(0xA)
add r1, .0
out r1
|
agda/sn-calculus-confluence/rec.agda | florence/esterel-calculus | 3 | 9988 | module sn-calculus-confluence.rec where
open import Data.Nat using (_+_)
open import Function using (_∋_ ; _∘_)
open import Data.Nat.Properties.Simple using ( +-comm ; +-assoc )
open import utility
open import Esterel.Lang
open import Esterel.Lang.Properties
open import Esterel.Environment as Env
open import Esterel.Context
open import Data.Product
open import Data.Sum
open import Data.Bool
open import Data.List
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Empty
open import sn-calculus
open import context-properties
open import Esterel.Lang.Binding
open import Data.Maybe using ( just )
open import Data.List.Any
open import Data.List.Any.Properties
open import Data.FiniteMap
import Data.OrderedListMap as OMap
open import Data.Nat as Nat using (ℕ)
open import Esterel.Variable.Signal as Signal
using (Signal)
open import Esterel.Variable.Shared as SharedVar
using (SharedVar)
open import Esterel.Variable.Sequential as SeqVar
open import sn-calculus-confluence.helper
open import sn-calculus-confluence.recrec
ρ-conf-rec : ∀{θ El Er ql qr i oli ori qro qlo FV BV θl θr A Al Ar}
→ CorrectBinding (ρ⟨ θ , A ⟩· i) FV BV
→ (ieql : i ≐ El ⟦ ql ⟧e)
→ (ieqr : i ≐ Er ⟦ qr ⟧e)
→ El a~ Er
→ (rl : (ρ⟨ θ , A ⟩· i) sn⟶₁ (ρ⟨ θl , Al ⟩· oli))
→ (rr : (ρ⟨ θ , A ⟩· i) sn⟶₁ (ρ⟨ θr , Ar ⟩· ori))
→ (olieq : oli ≐ El ⟦ qlo ⟧e)
→ (orieq : ori ≐ Er ⟦ qro ⟧e)
→ (->E-view rl ieql olieq)
→ (->E-view rr ieqr orieq)
→ (
Σ[ θo ∈ Env ]
Σ[ Ao ∈ Ctrl ]
Σ[ si ∈ Term ]
Σ[ Elo ∈ EvaluationContext ]
Σ[ Ero ∈ EvaluationContext ]
Σ[ oorieq ∈ ori ≐ Elo ⟦ ql ⟧e ]
Σ[ oolieq ∈ oli ≐ Ero ⟦ qr ⟧e ]
Σ[ sireq ∈ (si ≐ Elo ⟦ qlo ⟧e ) ]
Σ[ sileq ∈ (si ≐ Ero ⟦ qro ⟧e ) ]
Σ[ redl ∈ ((ρ⟨ θl , Al ⟩· oli) sn⟶₁ (ρ⟨ θo , Ao ⟩· si )) ]
Σ[ redr ∈ ((ρ⟨ θr , Ar ⟩· ori) sn⟶₁ (ρ⟨ θo , Ao ⟩· si )) ]
((->E-view redl oolieq sileq) × (->E-view redr oorieq sireq)))
ρ-conf-rec {p₂} {El = El@.(epar₂ _ ∷ _)} {Er@.(epar₁ _ ∷ _)} {i = .(_ ∥ _)} cb (depar₂ ieqr) (depar₁ ieql) par redl redr olieq orieq viewl viewr with ρ-conf-rec2{El = El}{Er} cb (depar₂ ieqr) (depar₁ ieql) par redl redr olieq orieq viewl viewr refl refl
... | (θo , Ao , whatever , Erl , Ero , thig , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro , _) = θo , Ao , whatever , Erl , Ero , thig , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro
ρ-conf-rec {p₂} {El = (epar₁ q ∷ El)} {(epar₂ p ∷ Er)} {i = .(_ ∥ _)}{oli = (olp ∥ .q)}{ori = (.p ∥ orq)} cb@(CBρ (CBpar cbl cbr a b c d)) (depar₁ ieql) (depar₂ ieqr) par2 redl redr (depar₁ olieq) (depar₂ orieq) viewl viewr
with unwrap-rho redl (depar₁ ieql) (depar₁ olieq) ieql olieq viewl | unwrap-rho redr (depar₂ ieqr) (depar₂ orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with wrap-rho redli ieql olieq viewli (epar₂ q) (depar₂ ieql) (depar₂ olieq) | wrap-rho redri ieqr orieq viewri (epar₁ p) (depar₁ ieqr) (depar₁ orieq)
... | (redl2 , viewl2) | (redr2 , viewr2) with ρ-conf-rec2{El = epar₂ q ∷ El}{epar₁ p ∷ Er}{oli = oli2}{ori = ori2} (CBρ (CBpar cbr cbl (distinct-sym a) (distinct-sym c) (distinct-sym b) (distinct'-sym d))) (depar₂ ieql) (depar₁ ieqr) par redl2 redr2 (depar₂ olieq) (depar₁ orieq) viewl2 viewr2 refl refl
where
oli2 = Term ∋ (q ∥ olp)
ori2 = orq ∥ p
... | (θo , Ao , (sil@.orq ∥ sir@.olp) , (epar₂ _ ∷ Erl) , (epar₁ _ ∷ Ero) , (depar₂ oorieq) , (depar₁ oolieq) , (depar₂ sireq) , (depar₁ sileq) , rlout , rrout , viewlo , viewro , ((.Erl , .Ero , _ , _) , refl , refl))
with unwrap-rho rlout (depar₁ oolieq) (depar₁ sileq) oolieq sileq viewlo | unwrap-rho rrout (depar₂ oorieq) (depar₂ sireq) oorieq sireq viewro
... | (roli , roliview) | (rori , roriview)
with wrap-rho roli oolieq sileq roliview (epar₂ sir) (depar₂ oolieq) (depar₂ sileq) | wrap-rho rori oorieq sireq roriview (epar₁ sil) (depar₁ oorieq) (depar₁ sireq)
... | (rolo , roloview) | (roro , roroview) = θo , Ao , sir ∥ sil , epar₁ orq ∷ Erl ,
epar₂ olp ∷ Ero ,
depar₁ oorieq ,
depar₂ oolieq ,
depar₁ sireq , depar₂ sileq , rolo , roro , roloview , roroview -- _ , _ , _ , _ , _ , rolo , roro , roloview , roroview -- {! !}
ρ-conf-rec {El = epar₁ q ∷ El} {epar₁ .q ∷ Er} {ql} {qr} {.(_ ∥ q)} (CBρ (CBpar cb cb₁ x x₁ x₂ x₃)) (depar₁ ieql) (depar₁ ieqr) (parr a~~) redl redr (depar₁ olieq) (depar₁ orieq) viewl viewr
with unwrap-rho redl (depar₁ ieql) (depar₁ olieq) ieql olieq viewl | unwrap-rho redr (depar₁ ieqr) (depar₁ orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (epar₁ q) (depar₁ oolieq) (depar₁ sileq) | wrap-rho rrout oorieq sireq viewro (epar₁ q) (depar₁ oorieq) (depar₁ sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , si ∥ q , (epar₁ q) ∷ Elo , (epar₁ q) ∷ Ero , depar₁ oorieq ,
depar₁ oolieq , depar₁ sireq , depar₁ sileq , rol , ror , rolview , rorview
ρ-conf-rec {El = (epar₂ p ∷ El)} {(epar₂ .p ∷ Er)} {i = .(_ ∥ _)} (CBρ (CBpar cb₁ cb x x₁ x₂ x₃)) (depar₂ ieql) (depar₂ ieqr) (parl a~~) redl redr (depar₂ olieq) (depar₂ orieq) viewl viewr
with unwrap-rho redl (depar₂ ieql) (depar₂ olieq) ieql olieq viewl | unwrap-rho redr (depar₂ ieqr) (depar₂ orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (epar₂ p) (depar₂ oolieq) (depar₂ sileq) | wrap-rho rrout oorieq sireq viewro (epar₂ p) (depar₂ oorieq) (depar₂ sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , p ∥ si , (epar₂ p) ∷ Elo , (epar₂ p) ∷ Ero , depar₂ oorieq ,
depar₂ oolieq , depar₂ sireq , depar₂ sileq , rol , ror , rolview , rorview
ρ-conf-rec {El = (eseq q ∷ El)} {(eseq .q ∷ Er)} {i = .(_ >> q)} (CBρ (CBseq cb cb₁ x)) (deseq ieql) (deseq ieqr) (seq a~~) redl redr (deseq olieq) (deseq orieq) viewl viewr
with unwrap-rho redl (deseq ieql) (deseq olieq) ieql olieq viewl | unwrap-rho redr (deseq ieqr) (deseq orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (eseq q) (deseq oolieq) (deseq sileq) | wrap-rho rrout oorieq sireq viewro (eseq q) (deseq oorieq) (deseq sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , (si >> q) , (eseq q) ∷ Elo , (eseq q) ∷ Ero , deseq oorieq ,
deseq oolieq , deseq sireq , deseq sileq , rol , ror , rolview , rorview
ρ-conf-rec {El = (eloopˢ q ∷ El)} {(eloopˢ .q ∷ Er)} {i = .(loopˢ _ q)} (CBρ (CBloopˢ cb cb₁ x _)) (deloopˢ ieql) (deloopˢ ieqr) (loopˢ a~~) redl redr (deloopˢ olieq) (deloopˢ orieq) viewl viewr
with unwrap-rho redl (deloopˢ ieql) (deloopˢ olieq) ieql olieq viewl | unwrap-rho redr (deloopˢ ieqr) (deloopˢ orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (eloopˢ q) (deloopˢ oolieq) (deloopˢ sileq) | wrap-rho rrout oorieq sireq viewro (eloopˢ q) (deloopˢ oorieq) (deloopˢ sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , (loopˢ si q) , (eloopˢ q) ∷ Elo , (eloopˢ q) ∷ Ero , deloopˢ oorieq ,
deloopˢ oolieq , deloopˢ sireq , deloopˢ sileq , rol , ror , rolview , rorview
ρ-conf-rec {El = (esuspend S ∷ El)} {(esuspend .S ∷ Er)} {i = .(suspend _ _)} (CBρ (CBsusp cb x)) (desuspend ieql) (desuspend ieqr) (susp a~~) redl redr (desuspend olieq) (desuspend orieq) viewl viewr
with unwrap-rho redl (desuspend ieql) (desuspend olieq) ieql olieq viewl | unwrap-rho redr (desuspend ieqr) (desuspend orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (esuspend S) (desuspend oolieq) (desuspend sileq) | wrap-rho rrout oorieq sireq viewro (esuspend S) (desuspend oorieq) (desuspend sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , (suspend si S) , (esuspend S) ∷ Elo , (esuspend S) ∷ Ero , desuspend oorieq ,
desuspend oolieq , desuspend sireq , desuspend sileq , rol , ror , rolview , rorview
ρ-conf-rec {El = (etrap ∷ El)} {(etrap ∷ Er)} {i = .(trap _)} (CBρ (CBtrap cb)) (detrap ieql) (detrap ieqr) (trp a~~) redl redr (detrap olieq) (detrap orieq) viewl viewr
with unwrap-rho redl (detrap ieql) (detrap olieq) ieql olieq viewl | unwrap-rho redr (detrap ieqr) (detrap orieq) ieqr orieq viewr
... | (redli , viewli) | (redri , viewri) with ρ-conf-rec (CBρ cb) ieql ieqr a~~ redli redri olieq orieq viewli viewri
... | ( θo , Ao , si , Elo , Ero , oorieq , oolieq , sireq , sileq , rlout , rrout , viewlo , viewro )
with wrap-rho rlout oolieq sileq viewlo (etrap) (detrap oolieq) (detrap sileq) | wrap-rho rrout oorieq sireq viewro (etrap) (detrap oorieq) (detrap sireq)
... | (rol , rolview) | (ror , rorview) = θo , Ao , (trap si) , (etrap) ∷ Elo , (etrap) ∷ Ero , detrap oorieq ,
detrap oolieq , detrap sireq , detrap sileq , rol , ror , rolview , rorview
|
Alpha/Parser2.g4 | jdamador/Alpha-Compiler | 0 | 6956 | <reponame>jdamador/Alpha-Compiler<filename>Alpha/Parser2.g4<gh_stars>0
parser grammar Parser2;
options {
tokenVocab = Scanner;
}
program : singleCommand EOF #programAST;
command : singleCommand (PyCOMA singleCommand)* #commandAST;
singleCommand : ID ASSIGN expression #assignSCAST
| ID PIZQ expression PDER #callSCAST
| IF expression THEN singleCommand
ELSE singleCommand #ifSCAST
| WHILE expression DO singleCommand #whileSCAST
| LET declaration IN singleCommand #letSCAST
| BEGIN command END #beginSCAST
| PRINT PIZQ expression PDER #printSCAST;
declaration : singleDeclaration (PyCOMA singleDeclaration)* #declarationAST;
singleDeclaration : CONST ID VIR expression #constSTAST
| VAR ID DOSPUN typeDenoter #varAST;
typeDenoter: ID #typeDenoterAST;
expression : primaryExpression (operator primaryExpression)* #expressionAST;
primaryExpression : NUM #numPrimaryExpAST
| BOOL #boolPrimaryExpAST
| ID #idPrimaryExpAST
| (STRING | SPECIAL_STRING) #stringPrimaryExpAST
| PIZQ expression PDER #groupPEAST;
operator : SUM | SUB | MUL | DIV | SMALLER | BIGGER | SMALEQ | BIGEQ | EQUAL | AND | OR #operatorAST;
|
programs/oeis/204/A204688.asm | karttu/loda | 1 | 81234 | <gh_stars>1-10
; A204688: a(n) = n^n (mod 3).
; 1,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1,0,1,2,0,1,1
trn $0,2
mov $2,$0
mul $0,2
gcd $0,12
div $0,6
mod $2,6
mov $1,$2
trn $1,$0
add $0,7
mod $1,3
add $1,$0
sub $1,8
|
src/are-utils.ads | stcarrez/resource-embedder | 7 | 108 | <filename>src/are-utils.ads
-----------------------------------------------------------------------
-- are-utils -- Utilities for model generator
-- Copyright (C) 2010, 2011, 2012, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Containers.Ordered_Sets;
with DOM.Core;
with Util.Strings.Vectors;
package Are.Utils is
-- Generic procedure to iterate over the DOM nodes children of <b>node</b>
-- and having the entity name <b>name</b>.
generic
type T (<>) is limited private;
with procedure Process (Closure : in out T;
Node : DOM.Core.Node);
procedure Iterate_Nodes (Closure : in out T;
Node : in DOM.Core.Node;
Name : in String;
Recurse : in Boolean := True);
-- Get the first DOM child from the given entity tag
function Get_Child (Node : in DOM.Core.Node;
Name : in String) return DOM.Core.Node;
-- Get the content of the node
function Get_Data_Content (Node : in DOM.Core.Node) return String;
-- Get the content of the node identified by <b>Name</b> under the given DOM node.
function Get_Data_Content (Node : in DOM.Core.Node;
Name : in String) return String;
-- Get a boolean attribute
function Get_Attribute (Node : in DOM.Core.Node;
Name : in String;
Default : in Boolean := False) return Boolean;
-- Get a string attribute
function Get_Attribute (Node : in DOM.Core.Node;
Name : in String;
Default : in String := "") return String;
use Ada.Strings.Unbounded;
package String_Set is
new Ada.Containers.Ordered_Sets (Element_Type => Ada.Strings.Unbounded.Unbounded_String,
"<" => Ada.Strings.Unbounded."<",
"=" => Ada.Strings.Unbounded."=");
package String_List renames Util.Strings.Vectors;
-- Returns True if the file name must be ignored (.svn, CVS, .git, are ignored).
function Is_File_Ignored (Name : in String) return Boolean;
-- Get a string attribute
function Get_Attribute (Node : in DOM.Core.Node;
Name : in String;
Default : in String := "")
return Ada.Strings.Unbounded.Unbounded_String;
end Are.Utils;
|
target/cos_117/disasm/iop_overlay1/DSTAT0.asm | jrrk2/cray-sim | 49 | 89977 | <gh_stars>10-100
0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x291B- f:00024 d: 283 | OR[283] = A
0x0002 (0x000004) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0003 (0x000006) 0x291C- f:00024 d: 284 | OR[284] = A
0x0004 (0x000008) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0005 (0x00000A) 0x291D- f:00024 d: 285 | OR[285] = A
0x0006 (0x00000C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0007 (0x00000E) 0x291E- f:00024 d: 286 | OR[286] = A
0x0008 (0x000010) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0009 (0x000012) 0x291F- f:00024 d: 287 | OR[287] = A
0x000A (0x000014) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x000B (0x000016) 0x2926- f:00024 d: 294 | OR[294] = A
0x000C (0x000018) 0x103C- f:00010 d: 60 | A = 60 (0x003C)
0x000D (0x00001A) 0x2927- f:00024 d: 295 | OR[295] = A
0x000E (0x00001C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000F (0x00001E) 0x2928- f:00024 d: 296 | OR[296] = A
0x0010 (0x000020) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0011 (0x000022) 0x2929- f:00024 d: 297 | OR[297] = A
0x0012 (0x000024) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0013 (0x000026) 0x292A- f:00024 d: 298 | OR[298] = A
0x0014 (0x000028) 0x111C- f:00010 d: 284 | A = 284 (0x011C)
0x0015 (0x00002A) 0x292B- f:00024 d: 299 | OR[299] = A
0x0016 (0x00002C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0017 (0x00002E) 0x5800- f:00054 d: 0 | B = A
0x0018 (0x000030) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0019 (0x000032) 0x7C09- f:00076 d: 9 | R = OR[9]
0x001A (0x000034) 0x8602- f:00103 d: 2 | P = P + 2 (0x001C), A # 0
0x001B (0x000036) 0x700B- f:00070 d: 11 | P = P + 11 (0x0026)
0x001C (0x000038) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x001D (0x00003A) 0x2926- f:00024 d: 294 | OR[294] = A
0x001E (0x00003C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x001F (0x00003E) 0x2927- f:00024 d: 295 | OR[295] = A
0x0020 (0x000040) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0021 (0x000042) 0x5800- f:00054 d: 0 | B = A
0x0022 (0x000044) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0024 (0x000048) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0025 (0x00004A) 0x721B- f:00071 d: 27 | P = P - 27 (0x000A)
0x0026 (0x00004C) 0x2118- f:00020 d: 280 | A = OR[280]
0x0027 (0x00004E) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0028 (0x000050) 0x2908- f:00024 d: 264 | OR[264] = A
0x0029 (0x000052) 0x3108- f:00030 d: 264 | A = (OR[264])
0x002A (0x000054) 0x2920- f:00024 d: 288 | OR[288] = A
0x002B (0x000056) 0x2120- f:00020 d: 288 | A = OR[288]
0x002C (0x000058) 0x290D- f:00024 d: 269 | OR[269] = A
0x002D (0x00005A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x002E (0x00005C) 0x290E- f:00024 d: 270 | OR[270] = A
0x002F (0x00005E) 0x2006- f:00020 d: 6 | A = OR[6]
0x0030 (0x000060) 0x2910- f:00024 d: 272 | OR[272] = A
0x0031 (0x000062) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0032 (0x000064) 0x2926- f:00024 d: 294 | OR[294] = A
0x0033 (0x000066) 0x1800-0x00A9 f:00014 d: 0 | A = 169 (0x00A9)
0x0035 (0x00006A) 0x2927- f:00024 d: 295 | OR[295] = A
0x0036 (0x00006C) 0x1800-0x444B f:00014 d: 0 | A = 17483 (0x444B)
0x0038 (0x000070) 0x2928- f:00024 d: 296 | OR[296] = A
0x0039 (0x000072) 0x210D- f:00020 d: 269 | A = OR[269]
0x003A (0x000074) 0x2929- f:00024 d: 297 | OR[297] = A
0x003B (0x000076) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x003C (0x000078) 0x292A- f:00024 d: 298 | OR[298] = A
0x003D (0x00007A) 0x210E- f:00020 d: 270 | A = OR[270]
0x003E (0x00007C) 0x292B- f:00024 d: 299 | OR[299] = A
0x003F (0x00007E) 0x210F- f:00020 d: 271 | A = OR[271]
0x0040 (0x000080) 0x292C- f:00024 d: 300 | OR[300] = A
0x0041 (0x000082) 0x2110- f:00020 d: 272 | A = OR[272]
0x0042 (0x000084) 0x292D- f:00024 d: 301 | OR[301] = A
0x0043 (0x000086) 0x1011- f:00010 d: 17 | A = 17 (0x0011)
0x0044 (0x000088) 0x292E- f:00024 d: 302 | OR[302] = A
0x0045 (0x00008A) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0046 (0x00008C) 0x5800- f:00054 d: 0 | B = A
0x0047 (0x00008E) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0049 (0x000092) 0x7C09- f:00076 d: 9 | R = OR[9]
0x004A (0x000094) 0x291B- f:00024 d: 283 | OR[283] = A
0x004B (0x000096) 0x211B- f:00020 d: 283 | A = OR[283]
0x004C (0x000098) 0x8602- f:00103 d: 2 | P = P + 2 (0x004E), A # 0
0x004D (0x00009A) 0x7002- f:00070 d: 2 | P = P + 2 (0x004F)
0x004E (0x00009C) 0x7099- f:00070 d: 153 | P = P + 153 (0x00E7)
0x004F (0x00009E) 0x211A- f:00020 d: 282 | A = OR[282]
0x0050 (0x0000A0) 0x8402- f:00102 d: 2 | P = P + 2 (0x0052), A = 0
0x0051 (0x0000A2) 0x7016- f:00070 d: 22 | P = P + 22 (0x0067)
0x0052 (0x0000A4) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0053 (0x0000A6) 0x2926- f:00024 d: 294 | OR[294] = A
0x0054 (0x0000A8) 0x1800-0x00EB f:00014 d: 0 | A = 235 (0x00EB)
0x0056 (0x0000AC) 0x2927- f:00024 d: 295 | OR[295] = A
0x0057 (0x0000AE) 0x211D- f:00020 d: 285 | A = OR[285]
0x0058 (0x0000B0) 0x2928- f:00024 d: 296 | OR[296] = A
0x0059 (0x0000B2) 0x2119- f:00020 d: 281 | A = OR[281]
0x005A (0x0000B4) 0x2929- f:00024 d: 297 | OR[297] = A
0x005B (0x0000B6) 0x100E- f:00010 d: 14 | A = 14 (0x000E)
0x005C (0x0000B8) 0x292A- f:00024 d: 298 | OR[298] = A
0x005D (0x0000BA) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x005E (0x0000BC) 0x5800- f:00054 d: 0 | B = A
0x005F (0x0000BE) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0061 (0x0000C2) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0062 (0x0000C4) 0x291B- f:00024 d: 283 | OR[283] = A
0x0063 (0x0000C6) 0x211B- f:00020 d: 283 | A = OR[283]
0x0064 (0x0000C8) 0x8602- f:00103 d: 2 | P = P + 2 (0x0066), A # 0
0x0065 (0x0000CA) 0x7002- f:00070 d: 2 | P = P + 2 (0x0067)
0x0066 (0x0000CC) 0x7081- f:00070 d: 129 | P = P + 129 (0x00E7)
0x0067 (0x0000CE) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0068 (0x0000D0) 0x2926- f:00024 d: 294 | OR[294] = A
0x0069 (0x0000D2) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x006B (0x0000D6) 0x2927- f:00024 d: 295 | OR[295] = A
0x006C (0x0000D8) 0x1800-0x0628 f:00014 d: 0 | A = 1576 (0x0628)
0x006E (0x0000DC) 0x2928- f:00024 d: 296 | OR[296] = A
0x006F (0x0000DE) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0070 (0x0000E0) 0x5800- f:00054 d: 0 | B = A
0x0071 (0x0000E2) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0073 (0x0000E6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0074 (0x0000E8) 0x2119- f:00020 d: 281 | A = OR[281]
0x0075 (0x0000EA) 0x2922- f:00024 d: 290 | OR[290] = A
0x0076 (0x0000EC) 0x211A- f:00020 d: 282 | A = OR[282]
0x0077 (0x0000EE) 0x8431- f:00102 d: 49 | P = P + 49 (0x00A8), A = 0
0x0078 (0x0000F0) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0079 (0x0000F2) 0x2926- f:00024 d: 294 | OR[294] = A
0x007A (0x0000F4) 0x1800-0x00EC f:00014 d: 0 | A = 236 (0x00EC)
0x007C (0x0000F8) 0x2927- f:00024 d: 295 | OR[295] = A
0x007D (0x0000FA) 0x211D- f:00020 d: 285 | A = OR[285]
0x007E (0x0000FC) 0x2928- f:00024 d: 296 | OR[296] = A
0x007F (0x0000FE) 0x2122- f:00020 d: 290 | A = OR[290]
0x0080 (0x000100) 0x2929- f:00024 d: 297 | OR[297] = A
0x0081 (0x000102) 0x211C- f:00020 d: 284 | A = OR[284]
0x0082 (0x000104) 0x292A- f:00024 d: 298 | OR[298] = A
0x0083 (0x000106) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0084 (0x000108) 0x5800- f:00054 d: 0 | B = A
0x0085 (0x00010A) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0087 (0x00010E) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0088 (0x000110) 0x291B- f:00024 d: 283 | OR[283] = A
0x0089 (0x000112) 0x211B- f:00020 d: 283 | A = OR[283]
0x008A (0x000114) 0x8402- f:00102 d: 2 | P = P + 2 (0x008C), A = 0
0x008B (0x000116) 0x7003- f:00070 d: 3 | P = P + 3 (0x008E)
0x008C (0x000118) 0x7486- f:00072 d: 134 | R = P + 134 (0x0112)
0x008D (0x00011A) 0x7017- f:00070 d: 23 | P = P + 23 (0x00A4)
0x008E (0x00011C) 0x211B- f:00020 d: 283 | A = OR[283]
0x008F (0x00011E) 0x1E00-0x0443 f:00017 d: 0 | A = A - 1091 (0x0443)
0x0091 (0x000122) 0x8402- f:00102 d: 2 | P = P + 2 (0x0093), A = 0
0x0092 (0x000124) 0x7011- f:00070 d: 17 | P = P + 17 (0x00A3)
0x0093 (0x000126) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0094 (0x000128) 0x2926- f:00024 d: 294 | OR[294] = A
0x0095 (0x00012A) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x0097 (0x00012E) 0x2927- f:00024 d: 295 | OR[295] = A
0x0098 (0x000130) 0x1800-0x062A f:00014 d: 0 | A = 1578 (0x062A)
0x009A (0x000134) 0x2928- f:00024 d: 296 | OR[296] = A
0x009B (0x000136) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x009C (0x000138) 0x5800- f:00054 d: 0 | B = A
0x009D (0x00013A) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x009F (0x00013E) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00A0 (0x000140) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00A1 (0x000142) 0x291B- f:00024 d: 283 | OR[283] = A
0x00A2 (0x000144) 0x7002- f:00070 d: 2 | P = P + 2 (0x00A4)
0x00A3 (0x000146) 0x7044- f:00070 d: 68 | P = P + 68 (0x00E7)
0x00A4 (0x000148) 0x1008- f:00010 d: 8 | A = 8 (0x0008)
0x00A5 (0x00014A) 0x2B22- f:00025 d: 290 | OR[290] = A + OR[290]
0x00A6 (0x00014C) 0x2F1A- f:00027 d: 282 | OR[282] = OR[282] - 1
0x00A7 (0x00014E) 0x7231- f:00071 d: 49 | P = P - 49 (0x0076)
0x00A8 (0x000150) 0x211E- f:00020 d: 286 | A = OR[286]
0x00A9 (0x000152) 0x8604- f:00103 d: 4 | P = P + 4 (0x00AD), A # 0
0x00AA (0x000154) 0x211F- f:00020 d: 287 | A = OR[287]
0x00AB (0x000156) 0x8602- f:00103 d: 2 | P = P + 2 (0x00AD), A # 0
0x00AC (0x000158) 0x7012- f:00070 d: 18 | P = P + 18 (0x00BE)
0x00AD (0x00015A) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00AE (0x00015C) 0x2926- f:00024 d: 294 | OR[294] = A
0x00AF (0x00015E) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x00B1 (0x000162) 0x2927- f:00024 d: 295 | OR[295] = A
0x00B2 (0x000164) 0x1800-0x062B f:00014 d: 0 | A = 1579 (0x062B)
0x00B4 (0x000168) 0x2928- f:00024 d: 296 | OR[296] = A
0x00B5 (0x00016A) 0x211E- f:00020 d: 286 | A = OR[286]
0x00B6 (0x00016C) 0x2929- f:00024 d: 297 | OR[297] = A
0x00B7 (0x00016E) 0x211F- f:00020 d: 287 | A = OR[287]
0x00B8 (0x000170) 0x292A- f:00024 d: 298 | OR[298] = A
0x00B9 (0x000172) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00BA (0x000174) 0x5800- f:00054 d: 0 | B = A
0x00BB (0x000176) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00BD (0x00017A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00BE (0x00017C) 0x211D- f:00020 d: 285 | A = OR[285]
0x00BF (0x00017E) 0x8602- f:00103 d: 2 | P = P + 2 (0x00C1), A # 0
0x00C0 (0x000180) 0x7011- f:00070 d: 17 | P = P + 17 (0x00D1)
0x00C1 (0x000182) 0x1006- f:00010 d: 6 | A = 6 (0x0006)
0x00C2 (0x000184) 0x290D- f:00024 d: 269 | OR[269] = A
0x00C3 (0x000186) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00C4 (0x000188) 0x2926- f:00024 d: 294 | OR[294] = A
0x00C5 (0x00018A) 0x1800-0x00A5 f:00014 d: 0 | A = 165 (0x00A5)
0x00C7 (0x00018E) 0x2927- f:00024 d: 295 | OR[295] = A
0x00C8 (0x000190) 0x211D- f:00020 d: 285 | A = OR[285]
0x00C9 (0x000192) 0x2928- f:00024 d: 296 | OR[296] = A
0x00CA (0x000194) 0x210D- f:00020 d: 269 | A = OR[269]
0x00CB (0x000196) 0x2929- f:00024 d: 297 | OR[297] = A
0x00CC (0x000198) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00CD (0x00019A) 0x5800- f:00054 d: 0 | B = A
0x00CE (0x00019C) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00D0 (0x0001A0) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00D1 (0x0001A2) 0x211C- f:00020 d: 284 | A = OR[284]
0x00D2 (0x0001A4) 0x8602- f:00103 d: 2 | P = P + 2 (0x00D4), A # 0
0x00D3 (0x0001A6) 0x7009- f:00070 d: 9 | P = P + 9 (0x00DC)
0x00D4 (0x0001A8) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x00D5 (0x0001AA) 0x2926- f:00024 d: 294 | OR[294] = A
0x00D6 (0x0001AC) 0x211C- f:00020 d: 284 | A = OR[284]
0x00D7 (0x0001AE) 0x2927- f:00024 d: 295 | OR[295] = A
0x00D8 (0x0001B0) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00D9 (0x0001B2) 0x5800- f:00054 d: 0 | B = A
0x00DA (0x0001B4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00DB (0x0001B6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00DC (0x0001B8) 0x2005- f:00020 d: 5 | A = OR[5]
0x00DD (0x0001BA) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x00DE (0x0001BC) 0x2908- f:00024 d: 264 | OR[264] = A
0x00DF (0x0001BE) 0x211B- f:00020 d: 283 | A = OR[283]
0x00E0 (0x0001C0) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00E1 (0x0001C2) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x00E2 (0x0001C4) 0x2926- f:00024 d: 294 | OR[294] = A
0x00E3 (0x0001C6) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00E4 (0x0001C8) 0x5800- f:00054 d: 0 | B = A
0x00E5 (0x0001CA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00E6 (0x0001CC) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00E7 (0x0001CE) 0x211B- f:00020 d: 283 | A = OR[283]
0x00E8 (0x0001D0) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x00E9 (0x0001D2) 0x8402- f:00102 d: 2 | P = P + 2 (0x00EB), A = 0
0x00EA (0x0001D4) 0x7005- f:00070 d: 5 | P = P + 5 (0x00EF)
0x00EB (0x0001D6) 0x1800-0x0646 f:00014 d: 0 | A = 1606 (0x0646)
0x00ED (0x0001DA) 0x291B- f:00024 d: 283 | OR[283] = A
0x00EE (0x0001DC) 0x7023- f:00070 d: 35 | P = P + 35 (0x0111)
0x00EF (0x0001DE) 0x211B- f:00020 d: 283 | A = OR[283]
0x00F0 (0x0001E0) 0x160A- f:00013 d: 10 | A = A - 10 (0x000A)
0x00F1 (0x0001E2) 0x8402- f:00102 d: 2 | P = P + 2 (0x00F3), A = 0
0x00F2 (0x0001E4) 0x7005- f:00070 d: 5 | P = P + 5 (0x00F7)
0x00F3 (0x0001E6) 0x1800-0x064E f:00014 d: 0 | A = 1614 (0x064E)
0x00F5 (0x0001EA) 0x291B- f:00024 d: 283 | OR[283] = A
0x00F6 (0x0001EC) 0x701B- f:00070 d: 27 | P = P + 27 (0x0111)
0x00F7 (0x0001EE) 0x211B- f:00020 d: 283 | A = OR[283]
0x00F8 (0x0001F0) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x00F9 (0x0001F2) 0x8402- f:00102 d: 2 | P = P + 2 (0x00FB), A = 0
0x00FA (0x0001F4) 0x7005- f:00070 d: 5 | P = P + 5 (0x00FF)
0x00FB (0x0001F6) 0x1800-0x0649 f:00014 d: 0 | A = 1609 (0x0649)
0x00FD (0x0001FA) 0x291B- f:00024 d: 283 | OR[283] = A
0x00FE (0x0001FC) 0x7013- f:00070 d: 19 | P = P + 19 (0x0111)
0x00FF (0x0001FE) 0x211B- f:00020 d: 283 | A = OR[283]
0x0100 (0x000200) 0x1609- f:00013 d: 9 | A = A - 9 (0x0009)
0x0101 (0x000202) 0x8402- f:00102 d: 2 | P = P + 2 (0x0103), A = 0
0x0102 (0x000204) 0x7005- f:00070 d: 5 | P = P + 5 (0x0107)
0x0103 (0x000206) 0x1800-0x064D f:00014 d: 0 | A = 1613 (0x064D)
0x0105 (0x00020A) 0x291B- f:00024 d: 283 | OR[283] = A
0x0106 (0x00020C) 0x700B- f:00070 d: 11 | P = P + 11 (0x0111)
0x0107 (0x00020E) 0x211B- f:00020 d: 283 | A = OR[283]
0x0108 (0x000210) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x0109 (0x000212) 0x8405- f:00102 d: 5 | P = P + 5 (0x010E), A = 0
0x010A (0x000214) 0x211B- f:00020 d: 283 | A = OR[283]
0x010B (0x000216) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003)
0x010C (0x000218) 0x8402- f:00102 d: 2 | P = P + 2 (0x010E), A = 0
0x010D (0x00021A) 0x7004- f:00070 d: 4 | P = P + 4 (0x0111)
0x010E (0x00021C) 0x1800-0x064C f:00014 d: 0 | A = 1612 (0x064C)
0x0110 (0x000220) 0x291B- f:00024 d: 283 | OR[283] = A
0x0111 (0x000222) 0x7253- f:00071 d: 83 | P = P - 83 (0x00BE)
0x0112 (0x000224) 0x211C- f:00020 d: 284 | A = OR[284]
0x0113 (0x000226) 0x1411- f:00012 d: 17 | A = A + 17 (0x0011)
0x0114 (0x000228) 0x2923- f:00024 d: 291 | OR[291] = A
0x0115 (0x00022A) 0x211C- f:00020 d: 284 | A = OR[284]
0x0116 (0x00022C) 0x1419- f:00012 d: 25 | A = A + 25 (0x0019)
0x0117 (0x00022E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0118 (0x000230) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0119 (0x000232) 0x2924- f:00024 d: 292 | OR[292] = A
0x011A (0x000234) 0x211C- f:00020 d: 284 | A = OR[284]
0x011B (0x000236) 0x141A- f:00012 d: 26 | A = A + 26 (0x001A)
0x011C (0x000238) 0x2908- f:00024 d: 264 | OR[264] = A
0x011D (0x00023A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x011E (0x00023C) 0x2925- f:00024 d: 293 | OR[293] = A
0x011F (0x00023E) 0x211E- f:00020 d: 286 | A = OR[286]
0x0120 (0x000240) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x0121 (0x000242) 0x291E- f:00024 d: 286 | OR[286] = A
0x0122 (0x000244) 0x211F- f:00020 d: 287 | A = OR[287]
0x0123 (0x000246) 0x2525- f:00022 d: 293 | A = A + OR[293]
0x0124 (0x000248) 0x291F- f:00024 d: 287 | OR[287] = A
0x0125 (0x00024A) 0x8002- f:00100 d: 2 | P = P + 2 (0x0127), C = 0
0x0126 (0x00024C) 0x2D1E- f:00026 d: 286 | OR[286] = OR[286] + 1
0x0127 (0x00024E) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0128 (0x000250) 0x2926- f:00024 d: 294 | OR[294] = A
0x0129 (0x000252) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x012B (0x000256) 0x2927- f:00024 d: 295 | OR[295] = A
0x012C (0x000258) 0x1800-0x0629 f:00014 d: 0 | A = 1577 (0x0629)
0x012E (0x00025C) 0x2928- f:00024 d: 296 | OR[296] = A
0x012F (0x00025E) 0x2122- f:00020 d: 290 | A = OR[290]
0x0130 (0x000260) 0x2929- f:00024 d: 297 | OR[297] = A
0x0131 (0x000262) 0x2123- f:00020 d: 291 | A = OR[291]
0x0132 (0x000264) 0x292A- f:00024 d: 298 | OR[298] = A
0x0133 (0x000266) 0x2124- f:00020 d: 292 | A = OR[292]
0x0134 (0x000268) 0x292B- f:00024 d: 299 | OR[299] = A
0x0135 (0x00026A) 0x2125- f:00020 d: 293 | A = OR[293]
0x0136 (0x00026C) 0x292C- f:00024 d: 300 | OR[300] = A
0x0137 (0x00026E) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0138 (0x000270) 0x5800- f:00054 d: 0 | B = A
0x0139 (0x000272) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x013B (0x000276) 0x7C09- f:00076 d: 9 | R = OR[9]
0x013C (0x000278) 0x0200- f:00001 d: 0 | EXIT
0x013D (0x00027A) 0x0000- f:00000 d: 0 | PASS
0x013E (0x00027C) 0x0000- f:00000 d: 0 | PASS
0x013F (0x00027E) 0x0000- f:00000 d: 0 | PASS
|
Working Disassembly/General/Ending/Map - Ending Egg Robo Eyecatch.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 20450 | Map_6096E: dc.w word_6097C-Map_6096E
dc.w word_609AE-Map_6096E
dc.w word_609D4-Map_6096E
dc.w word_609DC-Map_6096E
dc.w word_609E4-Map_6096E
dc.w word_60A0A-Map_6096E
dc.w word_60A12-Map_6096E
word_6097C: dc.w 8
dc.b $E4, 4, 0, 0, $FF, $F0
dc.b $EC, 8, 0, 2, $FF, $E8
dc.b $F4, $B, 0, 5, $FF, $E8
dc.b $14, 4, 0, $11, $FF, $F0
dc.b $E4, 4, 8, 0, 0, 0
dc.b $EC, 8, 8, 2, 0, 0
dc.b $F4, $B, 8, 5, 0, 0
dc.b $14, 4, 8, $11, 0, 0
word_609AE: dc.w 6
dc.b $E4, 5, 0, $13, $FF, $F0
dc.b $F4, $B, 0, $17, $FF, $E8
dc.b $14, 4, 0, $23, $FF, $F0
dc.b $E4, 5, 8, $13, 0, 0
dc.b $F4, $B, 8, $17, 0, 0
dc.b $14, 4, 8, $23, 0, 0
word_609D4: dc.w 1
dc.b $FC, 4, 0, $25, $FF, $F8
word_609DC: dc.w 1
dc.b $FC, 4, 0, $27, $FF, $F8
word_609E4: dc.w 6
dc.b $FC, 1, 0, $29, $FF, $CC
dc.b $F4, $E, 0, $2B, $FF, $D4
dc.b $F4, 0, 0, $37, $FF, $F4
dc.b $FC, $D, 0, $38, $FF, $F4
dc.b $F4, 8, 0, $40, 0, $14
dc.b $FC, $D, 0, $43, 0, $14
word_60A0A: dc.w 1
dc.b $FC, 0, 0, $4B, $FF, $FC
word_60A12: dc.w 0
|
programs/oeis/140/A140253.asm | neoneye/loda | 22 | 177454 | ; A140253: a(2*n) = 2*(2*4^(n-1)-1) and a(2*n-1) = 2*4^(n-1)-1.
; -1,1,2,7,14,31,62,127,254,511,1022,2047,4094,8191,16382,32767,65534,131071,262142,524287,1048574,2097151,4194302,8388607,16777214,33554431,67108862,134217727,268435454,536870911,1073741822,2147483647,4294967294,8589934591,17179869182,34359738367,68719476734,137438953471,274877906942,549755813887,1099511627774,2199023255551,4398046511102,8796093022207,17592186044414,35184372088831,70368744177662,140737488355327,281474976710654,562949953421311,1125899906842622,2251799813685247,4503599627370494,9007199254740991,18014398509481982,36028797018963967,72057594037927934,144115188075855871,288230376151711742,576460752303423487,1152921504606846974,2305843009213693951,4611686018427387902,9223372036854775807,18446744073709551614,36893488147419103231,73786976294838206462,147573952589676412927,295147905179352825854,590295810358705651711,1180591620717411303422,2361183241434822606847,4722366482869645213694,9444732965739290427391,18889465931478580854782,37778931862957161709567,75557863725914323419134,151115727451828646838271,302231454903657293676542,604462909807314587353087,1208925819614629174706174,2417851639229258349412351,4835703278458516698824702,9671406556917033397649407,19342813113834066795298814,38685626227668133590597631,77371252455336267181195262,154742504910672534362390527,309485009821345068724781054,618970019642690137449562111,1237940039285380274899124222,2475880078570760549798248447,4951760157141521099596496894,9903520314283042199192993791,19807040628566084398385987582,39614081257132168796771975167,79228162514264337593543950334,158456325028528675187087900671,316912650057057350374175801342,633825300114114700748351602687
mov $1,2
pow $1,$0
mov $2,-2
gcd $2,$0
sub $1,$2
mov $0,$1
|
HoTT-UF.agda | howsiyu/hott-notes | 0 | 9867 | <reponame>howsiyu/hott-notes
-- self-contained notes following https://www.cs.bham.ac.uk/~mhe/HoTT-UF-in-Agda-Lecture-Notes/HoTT-UF-Agda.html and relevant parts of HoTT book
open import Agda.Primitive public
using (Level ; _⊔_)
renaming (Set to Type ; lzero to 𝓾₀ ; lsuc to _⁺)
variable
𝓁 𝓂 𝓃 : Level
Π : {X : Type 𝓁} (A : X → Type 𝓂) → Type (𝓁 ⊔ 𝓂)
Π A = (x : _) → A x
id : {X : Type 𝓁} → X → X
id x = x
_∘_ : {X : Type 𝓁} {Y : Type 𝓂} {Z : Y → Type 𝓃}
→ ((y : Y) → Z y) → (f : X → Y) → (x : X) → Z (f x)
g ∘ f = λ x → g (f x)
{-# INLINE _∘_ #-}
infixr 50 _∘_
data ⊥ : Type where
⊥-induction : (A : ⊥ → Type 𝓁) → Π A
⊥-induction A ()
data ⊤ : Type where
⋆ : ⊤
⊤-induction : (A : ⊤ → Type 𝓁) → A ⋆ → Π A
⊤-induction A a ⋆ = a
data _+_ (X : Type 𝓁) (Y : Type 𝓂) : Type (𝓁 ⊔ 𝓂) where
inl : X → X + Y
inr : Y → X + Y
+-induction : {X : Type 𝓁} {Y : Type 𝓂} (A : X + Y → Type 𝓃)
→ ((x : X) → A (inl x))
→ ((y : Y) → A (inr y))
→ Π A
+-induction A f g (inl x) = f x
+-induction A f g (inr y) = g y
𝟚 : Type
𝟚 = ⊤ + ⊤
pattern ₀ = inl ⋆
pattern ₁ = inr ⋆
record Σ {X : Type 𝓁} (Y : X → Type 𝓂) : Type (𝓁 ⊔ 𝓂) where
constructor _,_
field
fst : X
snd : Y fst
open Σ
Σ-induction : {X : Type 𝓁} {Y : X → Type 𝓂} (A : Σ Y → Type 𝓃)
→ ((x : X) (y : Y x) → A (x , y))
→ Π A
Σ-induction A f (x , y) = f x y
_×_ : Type 𝓁 → Type 𝓂 → Type (𝓁 ⊔ 𝓂)
X × Y = Σ (λ (_ : X) → Y)
data Id (X : Type 𝓁) (x : X) : X → Type 𝓁 where
refl : Id X x x
Id-induction : {X : Type 𝓁} {x : X} (A : (y : X) → Id X x y → Type 𝓂)
→ A x refl
→ (y : X) (p : Id X x y) → A y p
Id-induction A σ _ refl = σ
data Id2 (X : Type 𝓁) : X → X → Type 𝓁 where
refl2 : (x : X) → Id2 X x x
Id2-induction : {X : Type 𝓁} (A : (x y : X) → Id2 X x y → Type 𝓂)
→ ((x : X) → A x x (refl2 x))
→ (x y : X) (p : Id2 X x y) → A x y p
Id2-induction A σ x x (refl2 x) = σ x
Id→Id2 : {X : Type 𝓁} → (x y : X) → Id X x y → Id2 X x y
Id→Id2 x x refl = refl2 x
Id2→Id : {X : Type 𝓁} → (x y : X) → Id2 X x y → Id X x y
Id2→Id x x (refl2 x) = refl
_≡_ : {X : Type 𝓁} (x y : X) → Type 𝓁
x ≡ y = Id _ x y
infix 1 _≡_
sym : {X : Type 𝓁} {x y : X} → x ≡ y → y ≡ x
sym refl = refl
_∙_ : {X : Type 𝓁} {x y z : X} → x ≡ y → y ≡ z → x ≡ z
refl ∙ refl = refl
_∙∙_∙∙_ : {X : Type 𝓁} {x y z t : X} → x ≡ y → y ≡ z → z ≡ t → x ≡ t
refl ∙∙ refl ∙∙ refl = refl
_≡⟨_⟩_ : {X : Type 𝓁 } (x : X) {y z : X} → x ≡ y → y ≡ z → x ≡ z
x ≡⟨ p ⟩ q = p ∙ q
infixr 0 _≡⟨_⟩_
_∎ : {X : Type 𝓁} (x : X) → x ≡ x
x ∎ = refl
infix 1 _∎
transport : {X Y : Type 𝓁} → X ≡ Y → X → Y
transport refl x = x
subst : {X : Type 𝓁} (A : X → Type 𝓂) {x y : X} → x ≡ y → A x → A y
subst A refl ax = ax
module _ {X : Type 𝓁} {x : X} where
refl-left : {y : X} (p : x ≡ y) → refl ∙ p ≡ p
refl-left refl = refl
refl-right : {y : X} (p : x ≡ y) → p ∙ refl ≡ p
refl-right refl = refl
∙-assoc : {y z t : X} (p : x ≡ y) (q : y ≡ z) (r : z ≡ t)
→ (p ∙ q) ∙ r ≡ p ∙ (q ∙ r)
∙-assoc refl refl refl = refl
sym-left : {y : X} (p : x ≡ y) → sym p ∙ p ≡ refl
sym-left refl = refl
sym-right : {y : X} (p : x ≡ y) → p ∙ sym p ≡ refl
sym-right refl = refl
sym-involutive : {y : X} (p : x ≡ y) → sym (sym p) ≡ p
sym-involutive refl = refl
∙-cancel-left : {X : Type 𝓁} {x y z : X} {p : x ≡ y} {q r : y ≡ z}
→ p ∙ q ≡ p ∙ r → q ≡ r
∙-cancel-left {p = refl} {q = q} {r = r} s =
sym (refl-left q) ∙∙ s ∙∙ refl-left r
∙-cancel-right : {X : Type 𝓁} {x y z : X} {p q : x ≡ y} {r : y ≡ z}
→ p ∙ r ≡ q ∙ r → p ≡ q
∙-cancel-right {p = p} {q = q} {r = refl} s =
sym (refl-right p) ∙∙ s ∙∙ refl-right q
module _ {X : Type 𝓁} {Y : Type 𝓂} (f : X → Y) where
cong : {x y : X} → x ≡ y → f x ≡ f y
cong refl = refl
cong-refl : (x : X) → cong (refl {x = x}) ≡ refl
cong-refl x = refl
cong-sym : {x y : X} → (p : x ≡ y) → cong (sym p) ≡ sym (cong p)
cong-sym refl = refl
cong-∙ : {x y z : X} (p : x ≡ y) (q : y ≡ z)
→ cong (p ∙ q) ≡ cong p ∙ cong q
cong-∙ refl refl = refl
cong-id : {X : Type 𝓁} {x y : X} (p : x ≡ y) → cong id p ≡ p
cong-id refl = refl
cong-∘ : {X : Type 𝓁} {Y : Type 𝓂} {Z : Type 𝓃}
(f : X → Y) (g : Y → Z) {x y : X} (p : x ≡ y)
→ cong (g ∘ f) p ≡ cong g (cong f p)
cong-∘ f g refl = refl
congd : {X : Type 𝓁} {Y : X → Type 𝓂} (f : Π Y) {x y : X} (p : x ≡ y)
→ subst Y p (f x) ≡ f y
congd f refl = refl
cong₂ : {X : Type 𝓁} {Y : Type 𝓂} {Z : Type 𝓃} (f : X → Y → Z)
{x x' : X} → x ≡ x' → {y y' : Y} → y ≡ y' → f x y ≡ f x' y'
cong₂ f refl refl = refl
¬_ : Type 𝓁 → Type 𝓁
¬ A = A → ⊥
contrapositive : {X : Type 𝓁} {Y : Type 𝓂} → (X → Y) → ¬ Y → ¬ X
contrapositive f p x = p (f x)
decidable : Type 𝓁 → Type 𝓁
decidable A = A + (¬ A)
onAllPaths : (Type 𝓁 → Type 𝓁) → Type 𝓁 → Type 𝓁
onAllPaths A X = (x y : X) → A (x ≡ y)
discrete : Type 𝓁 → Type 𝓁
discrete = onAllPaths decidable
₁≢₀ : ¬ (₁ ≡ ₀)
₁≢₀ p = subst (λ { ₀ → ⊥ ; ₁ → ⊤ }) p ⋆
𝟚-is-discrete : discrete 𝟚
𝟚-is-discrete ₀ ₀ = inl refl
𝟚-is-discrete ₀ ₁ = inr (contrapositive sym ₁≢₀)
𝟚-is-discrete ₁ ₀ = inr ₁≢₀
𝟚-is-discrete ₁ ₁ = inl refl
isCenter : (X : Type 𝓁) → X → Type 𝓁
isCenter X x = (y : X) → x ≡ y
isContr : (X : Type 𝓁) → Type 𝓁
isContr X = Σ (isCenter X)
⊤-is-contr : isContr ⊤
⊤-is-contr = ⋆ , λ { ⋆ → refl }
surrounding : {X : Type 𝓁} (x : X) → Type 𝓁
surrounding x = Σ λ y → x ≡ y
surrounding-is-contr : {X : Type 𝓁} (x : X) → isContr (surrounding x)
surrounding-is-contr x = (x , refl) , λ { (.x , refl) → refl }
isProp : (X : Type 𝓁) → Type 𝓁
isProp X = Π (isCenter X)
⊥-is-prop : isProp ⊥
⊥-is-prop ()
⊤-is-prop : isProp ⊤
⊤-is-prop ⋆ ⋆ = refl
isContr→isProp : {X : Type 𝓁} → isContr X → isProp X
isContr→isProp (c , φ) x y = sym (φ x) ∙ φ y
no-unicorns : (X : Type 𝓁) → isProp X → ¬ (isContr X) → ¬ ¬ X → ⊥
no-unicorns X φ ns ne = ne empty where
empty : ¬ X
empty x = ns (x , φ x)
isSet : (X : Type 𝓁) → Type 𝓁
isSet = onAllPaths isProp
⊥-is-set : isSet ⊥
⊥-is-set ()
⊤-is-set : isSet ⊤
⊤-is-set ⋆ ⋆ refl refl = refl
⊤-is-set' : isSet ⊤
⊤-is-set' =
⊤-induction
(λ x → (z : ⊤) → isProp (x ≡ z))
(Id-induction
(λ y → isCenter (⋆ ≡ y))
(Id-induction
refl-eq
refl
⋆))
where
refl-eq : (x : ⊤) → ⋆ ≡ x → Type
refl-eq =
⊤-induction
(λ x → ⋆ ≡ x → Type)
(Id (⋆ ≡ ⋆) refl)
wconstant : {X : Type 𝓁} {Y : Type 𝓂} → (X → Y) → Type (𝓁 ⊔ 𝓂)
wconstant {X = X} f = (x y : X) → f x ≡ f y
endo : Type 𝓁 → Type 𝓁
endo X = X → X
wconstant-endo : Type 𝓁 → Type 𝓁
wconstant-endo X = Σ λ (f : endo X) → wconstant f
Hedberg : {X : Type 𝓁} (x : X)
→ ((y : X) → wconstant-endo (x ≡ y))
→ (y : X) → isProp (x ≡ y)
Hedberg {X = X} x c y p q =
p
≡⟨ sym (a y p) ⟩
sym (f x refl) ∙ f y p
≡⟨ cong (λ r → sym (f x refl) ∙ r) (c y .snd p q) ⟩
sym (f x refl) ∙ f y q
≡⟨ a y q ⟩
q ∎
where
f : (z : X) → endo (x ≡ z)
f z = c z .fst
a : (z : X) (r : x ≡ z) → sym (f x refl) ∙ f z r ≡ r
a x refl = sym-left (f x refl)
isProp→wconstant-endos : {X : Type 𝓁}
→ isProp X → onAllPaths wconstant-endo X
isProp→wconstant-endos φ x y = (λ _ → φ x y) , (λ _ _ → refl)
isSet→wconstant-endos : {X : Type 𝓁}
→ isSet X → onAllPaths wconstant-endo X
isSet→wconstant-endos φ x y = id , φ x y
wconstant-endos→isSet : {X : Type 𝓁}
→ onAllPaths wconstant-endo X → isSet X
wconstant-endos→isSet c x = Hedberg x (c x)
isProp→isSet : {X : Type 𝓁} → isProp X → isSet X
isProp→isSet = wconstant-endos→isSet ∘ isProp→wconstant-endos
pointed→wconstant-endo : {X : Type 𝓁} → X → wconstant-endo X
pointed→wconstant-endo x = (λ _ → x) , (λ _ _ → refl)
empty→wconstant-endo : {X : Type 𝓁} → ¬ X → wconstant-endo X
empty→wconstant-endo e = id , λ x → ⊥-induction _ (e x)
decidable→wconstant-endo : {X : Type 𝓁} → decidable X → wconstant-endo X
decidable→wconstant-endo (inl x) = pointed→wconstant-endo x
decidable→wconstant-endo (inr e) = empty→wconstant-endo e
discrete→wconstant-endos : {X : Type 𝓁}
→ discrete X → onAllPaths wconstant-endo X
discrete→wconstant-endos φ x y = decidable→wconstant-endo (φ x y)
discrete→isSet : {X : Type 𝓁} → discrete X → isSet X
discrete→isSet = wconstant-endos→isSet ∘ discrete→wconstant-endos
isContrΣ : {X : Type 𝓁} {Y : X → Type 𝓂}
→ isContr X → ((x : X) → isContr (Y x))
→ isContr (Σ Y)
isContrΣ {X = X} {Y = Y} (x₀ , c) cy =
(x₀ , cy x₀ .fst) , λ { (x , y) → f (c x) (cy x .snd y) }
where
f : {x : X} {y : Y x} → x₀ ≡ x → cy x .fst ≡ y → (x₀ , cy x₀ .fst) ≡ (x , y)
f refl refl = refl
isPropΣ : {X : Type 𝓁} {Y : X → Type 𝓂}
→ isProp X → ((x : X) → isProp (Y x))
→ isProp (Σ Y)
isPropΣ {X = X} {Y = Y} φ ψ (x₀ , y₀) (x₁ , y₁) =
f (φ x₀ x₁) (ψ x₁ (subst Y (φ x₀ x₁) y₀) y₁)
where
f : {x : X} {y : Y x} → (p : x₀ ≡ x) → subst Y p y₀ ≡ y → (x₀ , y₀) ≡ (x , y)
f refl refl = refl
_∼_ : {X : Type 𝓁} {Y : X → Type 𝓂} (f g : Π Y) → Type (𝓁 ⊔ 𝓂)
f ∼ g = (x : _) → f x ≡ g x
infix 2 _∼_
deformation-induces-natural-iso : {X : Type 𝓁}
{f : X → X} (H : f ∼ id)
{x y : X} (p : x ≡ y)
→ H x ∙ p ≡ cong f p ∙ H y
deformation-induces-natural-iso H {x = x} refl =
refl-right (H x) ∙ sym (refl-left (H x))
deformation-induces-iso : {X : Type 𝓁} (f : X → X) (H : f ∼ id)
(x : X) → H (f x) ≡ cong f (H x)
deformation-induces-iso f H x =
∙-cancel-right (deformation-induces-natural-iso H (H x))
retraction : {X : Type 𝓁} {Y : Type 𝓂} → (X → Y) → Type (𝓁 ⊔ 𝓂)
retraction f = Σ λ g → g ∘ f ∼ id
section : {X : Type 𝓁} {Y : Type 𝓂} → (X → Y) → Type (𝓁 ⊔ 𝓂)
section f = Σ λ h → f ∘ h ∼ id
_◁_ : Type 𝓁 → Type 𝓂 → Type (𝓁 ⊔ 𝓂)
X ◁ Y = Σ λ (r : Y → X) → section r
isContrRetract : {X : Type 𝓁} {Y : Type 𝓂}
→ Y ◁ X → isContr X → isContr Y
isContrRetract {Y = Y} (r , (s , η)) (c , φ) = r c , d
where
d : isCenter Y (r c)
d y = r c ≡⟨ cong r (φ (s y)) ⟩ r (s y) ≡⟨ η y ⟩ y ∎
isPropRetract : {X : Type 𝓁} {Y : Type 𝓂}
→ Y ◁ X → isProp X → isProp Y
isPropRetract {Y = Y} (r , (s , η)) φ y₀ y₁ =
y₀
≡⟨ sym (η y₀) ⟩
r (s y₀)
≡⟨ cong r (φ (s y₀) (s y₁)) ⟩
r (s y₁)
≡⟨ η y₁ ⟩
y₁ ∎
Σ-retract : {X : Type 𝓁} (A : X → Type 𝓂) (B : X → Type 𝓃)
→ ((x : X) → A x ◁ B x) → Σ A ◁ Σ B
Σ-retract A B ρ = r , (s , η)
where
r : Σ B → Σ A
r (x , b) = x , (ρ x .fst b)
s : Σ A → Σ B
s (x , a) = x , ρ x .snd .fst a
η : r ∘ s ∼ id
η (x , a) = cong (_,_ x) (ρ x .snd .snd a)
subst-is-retraction : {X : Type 𝓁} (A : X → Type 𝓂) {x y : X} (p : x ≡ y)
→ subst A p ∘ subst A (sym p) ∼ id
subst-is-retraction A refl ay = refl
subst-is-section : {X : Type 𝓁} (A : X → Type 𝓂) {x y : X} (p : x ≡ y)
→ subst A (sym p) ∘ subst A p ∼ id
subst-is-section A refl ax = refl
module _ {X : Type 𝓁} {A : X → Type 𝓃} where
to-Σ≡ : {σ τ : Σ A}
→ Σ (λ (p : σ .fst ≡ τ .fst) → subst A p (σ .snd) ≡ τ .snd)
→ σ ≡ τ
to-Σ≡ (refl , refl) = refl
from-Σ≡ : {σ τ : Σ A}
→ σ ≡ τ
→ Σ (λ (p : σ .fst ≡ τ .fst) → subst A p (σ .snd) ≡ τ .snd)
from-Σ≡ refl = (refl , refl)
to-Σ≡-is-retraction : {σ τ : Σ A} → to-Σ≡ {σ} {τ} ∘ from-Σ≡ {σ} {τ} ∼ id
to-Σ≡-is-retraction refl = refl
to-Σ≡-is-section : {σ τ : Σ A} → from-Σ≡ {σ} {τ} ∘ to-Σ≡ {σ} {τ} ∼ id
to-Σ≡-is-section (refl , refl) = refl
isSetΣ : isSet X → ((x : X) → isSet (A x)) → isSet (Σ A)
isSetΣ φ ψ (x₀ , y₀) (x₁ , y₁) =
isPropRetract
(to-Σ≡ , (from-Σ≡ , to-Σ≡-is-retraction))
(isPropΣ (φ x₀ x₁) (λ x → ψ x₁ (subst A x y₀) y₁))
Σ-reindexing-retract : {X : Type 𝓁} {Y : Type 𝓂} (A : X → Type 𝓃) (r : Y → X)
→ section r
→ Σ A ◁ Σ (A ∘ r)
Σ-reindexing-retract A r (s , η) = r' , (s' , η')
where
r' : Σ (A ∘ r) → Σ A
r' (y , a) = r y , a
s' : Σ A → Σ (A ∘ r)
s' (x , a) = s x , subst A (sym (η x)) a
η' : r' ∘ s' ∼ id
η' (x , a) = to-Σ≡ (η x , subst-is-retraction A (η x) a)
module Equiv {X : Type 𝓁} {Y : Type 𝓂} (f : X → Y) where
fiber : Y → Type (𝓁 ⊔ 𝓂)
fiber y = Σ λ x → f x ≡ y
isEquiv : Type (𝓁 ⊔ 𝓂)
isEquiv = (y : Y) → isContr (fiber y)
inverse : isEquiv → Y → X
inverse eq y = eq y .fst .fst
inverse-is-section : (eq : isEquiv) → f ∘ inverse eq ∼ id
inverse-is-section eq y = eq y .fst .snd
inverse-is-retraction : (eq : isEquiv) → inverse eq ∘ f ∼ id
inverse-is-retraction eq x = cong fst p where
p : Id (fiber (f x)) (eq (f x) .fst) (x , refl)
p = eq (f x) .snd (x , refl)
isInvertible : Type (𝓁 ⊔ 𝓂)
isInvertible = retraction f × section f
isEquiv→isInvertible : isEquiv → isInvertible
isEquiv→isInvertible eq =
(inverse eq , inverse-is-retraction eq)
, (inverse eq , inverse-is-section eq)
toFiberEq : {y : Y} {σ : fiber y} (τ : fiber y)
→ Σ (λ (γ : σ .fst ≡ τ .fst) → (cong f γ ∙ τ .snd ≡ σ .snd))
→ σ ≡ τ
toFiberEq τ (refl , refl) = cong (λ p → (τ .fst , p)) (refl-left (τ .snd))
record isHAEquiv : Type (𝓁 ⊔ 𝓂) where
field
g : Y → X
η : g ∘ f ∼ id
ε : f ∘ g ∼ id
ha : (x : X) → cong f (η x) ≡ ε (f x)
open isHAEquiv
isHAEquiv→isInvertible : isHAEquiv → isInvertible
isHAEquiv→isInvertible eq = (eq .g , eq .η) , (eq .g , eq .ε)
isInvertible→isHAEquiv : isInvertible → isHAEquiv
isInvertible→isHAEquiv ((g₀ , η₀) , (h₀ , ε₀)) = record {
g = g₀
; η = η₀
; ε = ε₂
; ha = λ x → sym (ha₀ x)
} where
ε₁ : f ∘ g₀ ∼ id
ε₁ y = sym (cong (f ∘ g₀) (ε₀ y)) ∙ (cong f (η₀ (h₀ y)) ∙ ε₀ y)
ε₂ : f ∘ g₀ ∼ id
ε₂ y = sym (ε₁ (f (g₀ y))) ∙ (cong f (η₀ (g₀ y)) ∙ ε₁ y)
ha₀ : (x : X) → ε₂ (f x) ≡ cong f (η₀ x)
ha₀ x =
sym (ε₁ (f (g₀ (f x)))) ∙ (cong f (η₀ (g₀ (f x))) ∙ ε₁ (f x))
≡⟨ cong (λ p → sym (ε₁ (f (g₀ (f x)))) ∙ p)
(
cong f (η₀ (g₀ (f x))) ∙ ε₁ (f x)
≡⟨ cong (λ p → cong f p ∙ ε₁ (f x))
(deformation-induces-iso (g₀ ∘ f) η₀ x) ⟩
cong f (cong (g₀ ∘ f) (η₀ x)) ∙ ε₁ (f x)
≡⟨ cong (λ p → p ∙ ε₁ (f x))
(
cong f (cong (g₀ ∘ f) (η₀ x))
≡⟨ sym (cong-∘ (g₀ ∘ f) f (η₀ x)) ⟩
cong (f ∘ g₀ ∘ f) (η₀ x)
≡⟨ cong-∘ f (f ∘ g₀) (η₀ x) ⟩
cong (f ∘ g₀) (cong f (η₀ x)) ∎ ) ⟩
cong (f ∘ g₀) (cong f (η₀ x)) ∙ ε₁ (f x)
≡⟨ sym (deformation-induces-natural-iso ε₁ (cong f (η₀ x))) ⟩
ε₁ (f (g₀ (f x))) ∙ cong f (η₀ x) ∎ )
⟩
sym (ε₁ (f (g₀ (f x)))) ∙ (ε₁ (f (g₀ (f x))) ∙ cong f (η₀ x))
≡⟨ sym (∙-assoc _ _ _) ⟩
(sym (ε₁ (f (g₀ (f x)))) ∙ ε₁ (f (g₀ (f x)))) ∙ cong f (η₀ x)
≡⟨ cong (λ p → p ∙ cong f (η₀ x)) (sym-left _) ⟩
refl ∙ cong f (η₀ x)
≡⟨ refl-left _ ⟩
cong f (η₀ x) ∎
isHAEquiv→isEquiv : isHAEquiv → isEquiv
isHAEquiv→isEquiv eq y =
(eq .g y , eq .ε y)
, λ τ → toFiberEq τ (γ τ , lem τ)
where
γ : (τ : fiber y) → eq .g y ≡ τ .fst
γ (x , p) = cong (eq .g) (sym p) ∙ eq .η x
natural : {h : Y → Y} (e : h ∼ id) {z z' : Y} (q : z ≡ z')
→ (sym (cong h q) ∙ e z) ∙ q ≡ e z'
natural e {z = z} refl = refl-right (refl ∙ e z) ∙ refl-left (e z)
lem : (τ : fiber y) → cong f (γ τ) ∙ τ .snd ≡ eq .ε y
lem (x , p) =
cong f (cong (eq .g) (sym p) ∙ eq .η x) ∙ p
≡⟨ cong (λ q → q ∙ p)
(
cong f (cong (eq .g) (sym p) ∙ eq .η x)
≡⟨ cong-∙ f (cong (eq .g) (sym p)) (eq .η x) ⟩
cong f (cong (eq .g) (sym p)) ∙ cong f (eq .η x)
≡⟨ cong₂ _∙_
(sym (cong-∘ (eq .g) f (sym p)) ∙ cong-sym (f ∘ eq .g) p)
(eq .ha x) ⟩
sym (cong (f ∘ eq .g) p) ∙ eq .ε (f x) ∎ ) ⟩
(sym (cong (f ∘ eq .g) p) ∙ eq .ε (f x)) ∙ p
≡⟨ natural (eq .ε) p ⟩
eq .ε y ∎
open Equiv
open isHAEquiv
_≃_ : Type 𝓁 → Type 𝓂 → Type (𝓁 ⊔ 𝓂)
X ≃ Y = Σ λ (f : (X → Y)) → isHAEquiv f
idIsHAEquiv : (X : Type 𝓁) → isHAEquiv (id {X = X})
idIsHAEquiv X = record {
g = id
; η = λ x → refl
; ε = λ x → refl
; ha = λ x → refl }
id-≃ : (X : Type 𝓁) → X ≃ X
id-≃ X = (id , idIsHAEquiv X)
∘-≃ : {X : Type 𝓁} {Y : Type 𝓂} {Z : Type 𝓃} → X ≃ Y → Y ≃ Z → X ≃ Z
∘-≃ {X = X} {Y = Y} {Z = Z} (f , eqf) (h , eqh) =
(h ∘ f)
, record { g = g₀ ; η = η₀ ; ε = ε₀ ; ha = ha₀ }
where
g₀ : Z → X
g₀ = eqf .g ∘ eqh .g
η₀ : g₀ ∘ (h ∘ f) ∼ id
η₀ x = cong (eqf .g) (eqh .η (f x)) ∙ eqf .η x
ε₀ : (h ∘ f) ∘ g₀ ∼ id
ε₀ z = cong h (eqf .ε (eqh .g z)) ∙ eqh .ε z
ha₀ : (x : X) → cong (h ∘ f) (η₀ x) ≡ ε₀ (h (f x))
ha₀ x =
cong (h ∘ f) (cong (eqf .g) (eqh .η (f x)) ∙ eqf .η x)
≡⟨ cong-∙ (h ∘ f) _ _ ⟩
cong (h ∘ f) (cong (eqf .g) (eqh .η (f x))) ∙ cong (h ∘ f) (eqf .η x)
≡⟨ cong₂ _∙_
(sym (cong-∘ (eqf .g) (h ∘ f) (eqh .η (f x))))
(cong-∘ f h (eqf .η x)) ⟩
cong (h ∘ f ∘ eqf .g) (eqh .η (f x)) ∙ cong h (cong f (eqf .η x))
≡⟨ cong₂ _∙_
(cong-∘ (f ∘ eqf .g) h (eqh .η (f x)))
(cong (cong h) (eqf .ha x)) ⟩
cong h (cong (f ∘ eqf .g) (eqh .η (f x))) ∙ cong h (eqf .ε (f x))
≡⟨ sym (cong-∙ h _ _) ⟩
cong h (cong (f ∘ eqf .g) (eqh .η (f x)) ∙ eqf .ε (f x))
≡⟨ cong (cong h) (sym (deformation-induces-natural-iso (eqf .ε) (eqh .η (f x)))) ⟩
cong h (eqf .ε (eqh .g (h (f x))) ∙ eqh .η (f x))
≡⟨ cong-∙ h _ _ ⟩
cong h (eqf .ε (eqh .g (h (f x)))) ∙ cong h (eqh .η (f x))
≡⟨ cong (λ p → _ ∙ p) (eqh .ha (f x)) ⟩
cong h (eqf .ε (eqh .g (h (f x)))) ∙ eqh .ε (h (f x)) ∎
sym-≃ : {X : Type 𝓁} {Y : Type 𝓂} → X ≃ Y → Y ≃ X
sym-≃ {X = X} {Y = Y} (f , eq) =
eq .g , record { g = f ; η = eq .ε ; ε = eq .η ; ha = ha₀ }
where
p : (y : Y)
→ cong (eq .g ∘ f ∘ eq .g) (eq .ε y) ∙ eq .η (eq .g y)
≡ cong (eq .g ∘ f ∘ eq .g) (eq .ε y) ∙ cong (eq .g) (eq .ε y)
p y =
cong (eq .g ∘ f ∘ eq .g) (eq .ε y) ∙ eq .η (eq .g y)
≡⟨ cong (λ p → p ∙ _) (cong-∘ (eq .g) (eq .g ∘ f) (eq .ε y)) ⟩
cong (eq .g ∘ f) (cong (eq .g) (eq .ε y)) ∙ eq .η (eq .g y)
≡⟨ sym (deformation-induces-natural-iso (eq .η) (cong (eq .g) (eq .ε y))) ⟩
eq .η (eq .g (f (eq .g y))) ∙ cong (eq .g) (eq .ε y)
≡⟨ cong (λ p → p ∙ _) (deformation-induces-iso (eq .g ∘ f) (eq .η) (eq .g y)) ⟩
cong (eq .g ∘ f) (eq .η (eq .g y)) ∙ cong (eq .g) (eq .ε y)
≡⟨ cong (λ p → p ∙ cong (eq .g) (eq .ε y)) (cong-∘ f (eq .g) (eq .η (eq .g y))) ⟩
cong (eq .g) (cong f (eq .η (eq .g y))) ∙ cong (eq .g) (eq .ε y)
≡⟨ cong (λ p → cong (eq .g) p ∙ cong (eq .g) (eq .ε y)) (eq .ha (eq .g y)) ⟩
cong (eq .g) (eq .ε (f (eq .g y))) ∙ cong (eq .g) (eq .ε y)
≡⟨ sym (cong-∙ (eq .g) (eq .ε (f (eq .g y))) (eq .ε y)) ⟩
cong (eq .g) (eq .ε (f (eq .g y)) ∙ eq .ε y)
≡⟨ cong (cong (eq .g)) (deformation-induces-natural-iso (eq .ε) (eq .ε y)) ⟩
cong (eq .g) (cong (f ∘ eq .g) (eq .ε y) ∙ eq .ε y)
≡⟨ cong-∙ (eq .g) (cong (f ∘ eq .g) (eq .ε y)) (eq .ε y) ⟩
cong (eq .g) (cong (f ∘ eq .g) (eq .ε y)) ∙ cong (eq .g) (eq .ε y)
≡⟨ cong (λ p → p ∙ cong (eq .g) (eq .ε y)) (sym (cong-∘ (f ∘ eq .g) (eq .g) (eq .ε y))) ⟩
cong (eq .g ∘ f ∘ eq .g) (eq .ε y) ∙ cong (eq .g) (eq .ε y) ∎
ha₀ : (y : Y) → cong (eq .g) (eq .ε y) ≡ eq .η (eq .g y)
ha₀ y = ∙-cancel-left (sym (p y))
cong-const : {X : Type 𝓁} {Y : Type 𝓂} (y : Y) {x x' : X} {p : x ≡ x'}
→ cong (λ _ → y) p ≡ refl
cong-const y {p = refl} = refl
contr-fiber : {X : Type 𝓁} (A : X → Type 𝓂) → ((x : X) → isContr (A x))
→ isHAEquiv (λ (a : Σ A) → a .fst)
contr-fiber {X = X} A c = record { g = g₀ ; η = η₀ ; ε = ε₀ ; ha = ha₀ }
where
g₀ : X → Σ A
g₀ x = x , c x .fst
η₀ : g₀ ∘ fst ∼ id
η₀ (x , a) = cong (_,_ x) (c x .snd a)
ε₀ : fst ∘ g₀ ∼ id
ε₀ x = refl
ha₀ : (a : Σ A) → cong fst (η₀ a) ≡ ε₀ (fst a)
ha₀ (x , a) = cong fst (cong (_,_ x) (c x .snd a))
≡⟨ sym (cong-∘ (_,_ x) fst (c x .snd a)) ⟩
cong (λ _ → x) (c x .snd a)
≡⟨ cong-const x ⟩
refl
≡⟨ refl ⟩
ε₀ x ∎
Id→Eq : (X Y : Type 𝓁) → X ≡ Y → X ≃ Y
Id→Eq X X refl = id-≃ X
isUnivalent : (𝓁 : Level) → Type (𝓁 ⁺)
isUnivalent 𝓁 = (X Y : Type 𝓁) → isHAEquiv (Id→Eq X Y)
|
programs/oeis/152/A152785.asm | karttu/loda | 0 | 175544 | <filename>programs/oeis/152/A152785.asm
; A152785: a(n)=Floor[(n^2)/Catalan].
; 0,1,4,9,17,27,39,53,69,88,109,132,157,184,213,245,279,315,353,394,436,481,528,577,628,682,738,795,855,918,982,1049,1117,1188,1262,1337,1414,1494,1576,1660,1746,1835,1925,2018,2113,2210,2310,2411,2515,2621,2729
mov $4,$0
mul $0,3
pow $0,2
mov $2,6
sub $2,$0
lpb $0,1
mov $3,$2
mov $2,$0
mov $0,$6
mul $2,2
add $3,7
sub $3,$2
mul $3,2
sub $5,$3
add $7,$5
div $7,14
lpe
div $7,42
mov $1,$7
mov $8,$4
mul $8,$4
add $1,$8
|
src/002/b.adb | xeenta/learning-ada | 0 | 6776 | with Person;
with Ada.Text_IO; use Ada.Text_IO;
package body B is
procedure Print_Modify is
package I is new Ada.Text_IO.Integer_IO (Integer);
begin
I.Put (Person.Unit_Age); New_Line;
Person.Unit_Age := 20;
end Print_Modify;
end B;
|
libsrc/stdio/ansi/zx81/f_ansi_char.asm | meesokim/z88dk | 0 | 16955 | <reponame>meesokim/z88dk<gh_stars>0
;
; Spectrum C Library
;
; ANSI Video handling for ZX Spectrum
;
; Handles colors referring to current PAPER/INK/etc. settings
;
; ** alternate (smaller) 4bit font capability:
; ** use the -DPACKEDFONT flag
; ** ROM font -DROMFONT
;
; set it up with:
; .text_cols = max columns
; .text_rows = max rows
; .DOTS+1 = char size
; .font = font file
;
; Display a char in location (ansi_ROW),(ansi_COLUMN)
; A=char to display
;
;
; $Id: f_ansi_char.asm,v 1.11 2015/01/23 07:07:31 stefano Exp $
;
PUBLIC ansi_CHAR
IF ROMFONT
LIB asctozx81
ENDIF
EXTERN base_graphics
EXTERN ansi_ROW
EXTERN ansi_COLUMN
PUBLIC text_cols
IF G007
PUBLIC text_rows
ENDIF
IF MTHRG
PUBLIC text_rows
ENDIF
; Dirty thing for self modifying code
PUBLIC INVRS
PUBLIC BOLD
IF A136COL
.text_cols defb 136
ENDIF
IF A128COL
.text_cols defb 128
ENDIF
IF A124COL
.text_cols defb 124
ENDIF
IF A80COL
.text_cols defb 80
ENDIF
IF A82COL
.text_cols defb 82
ENDIF
IF A85COL
.text_cols defb 85
ENDIF
IF A90COL
.text_cols defb 90
ENDIF
IF A64COL
.text_cols defb 64
ENDIF
IF A62COL
.text_cols defb 62
ENDIF
IF A68COL
.text_cols defb 68
ENDIF
IF A51COL
.text_cols defb 51
ENDIF
IF A49COL
.text_cols defb 49
ENDIF
IF A54COL
.text_cols defb 54
ENDIF
IF A42COL
.text_cols defb 42
ENDIF
IF A41COL
.text_cols defb 41
ENDIF
IF A40COL
.text_cols defb 40
ENDIF
IF A45COL
.text_cols defb 45
ENDIF
IF A36COL
.text_cols defb 36
ENDIF
IF B32COL
.text_cols defb 32
ENDIF
IF A35COL
.text_cols defb 35
ENDIF
IF A38COL
.text_cols defb 38
ENDIF
IF A32COL
.text_cols defb 32
ENDIF
IF A31COL
.text_cols defb 31
ENDIF
IF A34COL
.text_cols defb 34
ENDIF
IF A28COL
.text_cols defb 28
ENDIF
IF A24COL
.text_cols defb 24
ENDIF
IF A27COL
.text_cols defb 27
ENDIF
IF G007
.text_rows defb 23
ENDIF
IF MTHRG
.text_rows defb 24
ENDIF
.ansi_CHAR
; --- TO USE ROM FONT WE NEED TO MAP TO THE ASCII CODES ---
IF ROMFONT
ld hl,char+1
ld (hl),a
call asctozx81
ENDIF
; --- END OF ROM FONT ADAPTER ---
ld (char+1),a
ld a,(ansi_ROW) ; Line text position
IF G007
ld h,0
ld e,a
add a
add a
add a ; *8
ld l,a
ld a,e
add hl,hl ; *16
add h
ld h,a ; *272
ld de,(base_graphics)
add hl,de
ld de,9
add hl,de
ELSE
IF MTHRG
ld h,a ; *256
add a
add a
add a ; *8 -> * 264
ld l,a
inc hl
inc hl
;ld de,($407B)
ld de,(base_graphics)
add hl,de
ELSE
; ld d,a
; ld e,0
ld hl,(base_graphics)
add h
ld h,a
; add hl,de
ENDIF
ENDIF
ld (RIGA+1),hl
; xor a
ld hl,DOTS+1
ld b,(hl)
ld hl,0
ld a,(ansi_COLUMN) ; Column text position
ld e,a
ld d,0
or d
jr z,ZCL
.LP
add hl,de
djnz LP
srl h
rr l
rra
srl h
rr l
rra
srl h
rr l
rra
IF ARX816
add hl,hl
add hl,hl
add hl,hl
ENDIF
srl a
srl a
srl a
srl a
srl a
; ld b,5
;.RGTA
; srl a
; djnz RGTA
.ZCL
ld (PRE+1),a
ld e,a
ld a,(DOTS+1)
add a,e
ld e,a
ld a,16
sub e
.NOC
ld (POST+1),a
.RIGA ; Location on screen
ld de,16384
add hl,de
push hl
pop ix
.char
ld b,'A' ; Put here the character to be printed
IF ROMFONT
ld hl,$1e00
xor a
add b
jr z,NOLFONT
ELSE
IF PACKEDFONT
xor a
rr b
jr c,even
ld a,4
.even
ld (ROLL+1),a
ld hl,font-128
ELSE
ld hl,font-256
ENDIF
ENDIF
ld de,8
.LFONT
add hl,de
djnz LFONT
.NOLFONT
IF !ARX816
IF G007
ld de,34 ; next row
ELSE
IF MTHRG
ld de,33 ; next row
ELSE
ld de,32 ; next row
ENDIF
ENDIF
ENDIF
ld c,8
.PRE
ld b,4
IF ARX816
rl (ix+8)
ELSE
rl (ix+1)
ENDIF
rl (ix+0)
inc b
dec b
jr z,DTS
.L1
IF ARX816
rl (ix+8)
ELSE
rl (ix+1)
ENDIF
rl (ix+0)
djnz L1
.DTS
ld a,(hl)
.BOLD
nop ; rla
nop ; or (hl)
IF ROMFONT
; nothing here !
ELSE
IF PACKEDFONT
.ROLL
jr INVRS
rla
rla
rla
rla
ENDIF
ENDIF
.INVRS
; cpl ; Set to NOP to disable INVERSE
nop
; Underlined text handling
dec c
; jr nz,UNDRL ; Set to JR UNDRL to disable underlined text (loc. INVRS+2)
jr UNDRL
ld a,255
.UNDRL
inc c
; end of underlined text handling
.DOTS
IF A136COL
ld b,2
ENDIF
IF A128COL
ld b,2
ENDIF
IF A124COL
ld b,2
ENDIF
IF A80COL
ld b,3
ENDIF
IF A82COL
ld b,3
ENDIF
IF A85COL
ld b,3
ENDIF
IF A90COL
ld b,3
ENDIF
IF A64COL
ld b,4
ENDIF
IF A62COL
ld b,4
ENDIF
IF A68COL
ld b,4
ENDIF
IF A51COL
ld b,5
ENDIF
IF A49COL
ld b,5
ENDIF
IF A54COL
ld b,5
ENDIF
IF A42COL
ld b,6
ENDIF
IF A41COL
ld b,6
ENDIF
IF A45COL
ld b,6
ENDIF
IF A40COL
ld b,6
ENDIF
IF A36COL
ld b,7
ENDIF
IF A35COL
ld b,7
ENDIF
IF B32COL
ld b,7
ENDIF
IF A38COL
ld b,7
ENDIF
IF A32COL
ld b,8
ENDIF
IF A31COL
ld b,8
ENDIF
IF A34COL
ld b,8
ENDIF
IF A28COL
ld b,8
ENDIF
IF A24COL
ld b,9
ENDIF
IF A27COL
ld b,9
ENDIF
.L2
rla
IF ARX816
rl (ix+8)
ELSE
rl (ix+1)
ENDIF
rl (ix+0)
djnz L2
.POST
ld b,6
inc b
dec b
jr z,NEXT
.L3
IF ARX816
rl (ix+8)
ELSE
rl (ix+1)
ENDIF
rl (ix+0)
djnz L3
.NEXT
IF ARX816
inc ix
ELSE
add ix,de
ENDIF
inc hl
dec c
jr nz,PRE
ret
; The font
; 9 dots: MAX 28 columns
; 8 dots: MAX 32 columns
; 7 dots: MAX 36 columns
; 6 dots: MAX 42 columns
; 5 dots: MAX 51 columns
; 4 dots: MAX 64 columns
; 3 dots: MAX 85 columns Just readable!
; 2 dots: MAX 128 columns (useful for ANSI graphics only.. maybe)
; No file for ROM Font
.font
IF ROMFONT
; nothing here !
ELSE
IF PACKEDFONT
BINARY "stdio/ansi/F4PACK.BIN"
ELSE
IF A136COL
BINARY "stdio/ansi/F3.BIN"
ENDIF
IF A128COL
BINARY "stdio/ansi/F3.BIN"
ENDIF
IF A124COL
BINARY "stdio/ansi/F3.BIN"
ENDIF
IF A80COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A82COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A85COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A90COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A64COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A62COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A68COL
BINARY "stdio/ansi/F4.BIN"
ENDIF
IF A51COL
BINARY "stdio/ansi/F5.BIN"
ENDIF
IF A49COL
BINARY "stdio/ansi/F5.BIN"
ENDIF
IF A54COL
BINARY "stdio/ansi/F5.BIN"
ENDIF
IF A42COL
BINARY "stdio/ansi/F6.BIN"
ENDIF
IF A41COL
BINARY "stdio/ansi/F6.BIN"
ENDIF
IF A45COL
BINARY "stdio/ansi/F6.BIN"
ENDIF
IF A40COL
BINARY "stdio/ansi/F6.BIN"
ENDIF
IF A36COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF B32COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A35COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A38COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A32COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A31COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A34COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A28COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A24COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
IF A27COL
BINARY "stdio/ansi/F8.BIN"
ENDIF
ENDIF
ENDIF
|
cse341/fib.asm | cosmicray001/academic | 2 | 24228 | .MODEL SMALL
.STACK 100H
.DATA
ANS DW ?
TEMP DW ?
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV BX, 0
MOV DX, 1
MOV CX, 0
MOV AX, 1
START:
CMP CX, 5
JE SHOW
INC CX
MOV TEMP, DX
ADD DX, BX
ADD AX, DX
MOV BX, TEMP
JMP START
SHOW:
MOV ANS, AX
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
|
programs/oeis/010/A010764.asm | karttu/loda | 1 | 18766 | ; A010764: a(n) = floor(n/2) mod floor(n/3).
; 0,0,0,1,1,0,1,2,2,2,2,3,2,3,3,3,3,4,3,4,4,4,4,5,4,5,5,5,5,6,5,6,6,6,6,7,6,7,7,7,7,8,7,8,8,8,8,9,8,9,9,9,9,10,9,10,10,10,10,11,10,11,11,11,11,12,11,12,12,12,12,13,12,13,13,13,13,14,13,14,14,14,14,15,14,15,15,15,15,16,15,16,16,16,16,17,16,17,17,17,17,18,17,18,18,18,18,19,18,19,19,19,19,20,19,20,20,20,20,21,20,21,21,21,21,22,21,22,22,22,22,23,22,23,23,23,23,24,23,24,24,24,24,25,24,25,25,25,25,26,25,26,26,26,26,27,26,27,27,27,27,28,27,28,28,28,28,29,28,29,29,29,29,30,29,30,30,30,30,31,30,31,31,31,31,32,31,32,32,32,32,33,32,33,33,33,33,34,33,34,34,34,34,35,34,35,35,35,35,36,35,36,36,36,36,37,36,37,37,37,37,38,37,38,38,38,38,39,38,39,39,39,39,40,39,40,40,40,40,41,40,41,41,41,41,42,41,42,42,42
mov $3,$0
sub $3,3
mov $5,$0
sub $0,$3
sub $0,3
mov $1,4
add $1,$5
pow $4,$0
sub $4,$1
sub $4,1
add $1,$4
add $4,1
sub $2,$4
div $2,3
div $4,2
sub $1,$4
mod $1,$2
|
Verilog/P5 - 副本 (2)/test/test_2.asm | JJLeo/BUAA-CO-2020 | 9 | 105330 | <filename>Verilog/P5 - 副本 (2)/test/test_2.asm
subu $28 $28 $28
nop
nop
nop
nop
subu $29 $29 $29
nop
nop
nop
nop
sw $14 56($0)
nop
nop
nop
nop
lw $15 56($0)
nop
nop
nop
nop
sw $15 60($0)
nop
nop
nop
nop
lw $16 60($0)
nop
nop
nop
nop
sw $16 64($0)
nop
nop
nop
nop
lw $17 64($0)
nop
nop
nop
nop
sw $17 68($0)
nop
nop
nop
nop
lw $18 68($0)
nop
nop
nop
nop
sw $18 72($0)
nop
nop
nop
nop
lw $19 72($0)
nop
nop
nop
nop
sw $19 76($0)
nop
nop
nop
nop
lw $20 76($0)
nop
nop
nop
nop
sw $20 80($0)
nop
nop
nop
nop
lw $21 80($0)
nop
nop
nop
nop
sw $21 84($0)
nop
nop
nop
nop
lw $22 84($0)
nop
nop
nop
nop
sw $22 88($0)
nop
nop
nop
nop
lw $23 88($0)
nop
nop
nop
nop
sw $23 92($0)
nop
nop
nop
nop
lw $24 92($0)
nop
nop
nop
nop
sw $24 96($0)
nop
nop
nop
nop
lw $25 96($0)
nop
nop
nop
nop
sw $25 100($0)
nop
nop
nop
nop
lw $26 100($0)
nop
nop
nop
nop
sw $26 104($0)
nop
nop
nop
nop
lw $27 104($0)
nop
nop
nop
nop
sw $27 108($0)
nop
nop
nop
nop
lw $28 108($0)
nop
nop
nop
nop
sw $28 112($0)
nop
nop
nop
nop
lw $29 112($0)
nop
nop
nop
nop
sw $29 116($0)
nop
nop
nop
nop
lw $30 116($0)
nop
nop
nop
nop
sw $30 120($0)
nop
nop
nop
nop
lw $31 120($0)
nop
nop
nop
nop
sw $31 124($0)
nop
nop
nop
nop
lui $1 234
nop
nop
nop
nop
lui $2 234
nop
nop
nop
nop
lui $3 234
nop
nop
nop
nop
lui $4 234
nop
nop
nop
nop
lui $5 234
nop
nop
nop
nop
lui $6 234
nop
nop
nop
nop
lui $7 234
nop
nop
nop
nop
lui $8 234
nop
nop
nop
nop
lui $9 234
nop
nop
nop
nop
lui $10 234
nop
nop
nop
nop
lui $11 234
nop
nop
nop
nop
lui $12 234
nop
nop
nop
nop
lui $13 234
nop
nop
nop
nop
lui $14 234
nop
nop
nop
nop
lui $15 234
nop
nop
nop
nop
jal con
nop
nop
nop
nop
lui $1 222
nop
nop
nop
nop
subu $16 $16 $1
nop
nop
nop
nop
subu $17 $17 $1
nop
nop
nop
nop
subu $18 $18 $1
nop
nop
nop
nop
subu $19 $19 $1
nop
nop
nop
nop
subu $20 $20 $1
nop
nop
nop
nop
subu $21 $21 $1
nop
nop
nop
nop
subu $22 $22 $1
nop
nop
nop
nop
subu $23 $23 $1
nop
nop
nop
nop
subu $24 $24 $1
nop
nop
nop
nop
subu $25 $25 $1
nop
nop
nop
nop
subu $26 $26 $1
nop
nop
nop
nop
subu $27 $27 $1
nop
nop
nop
nop
subu $28 $28 $1
nop
nop
nop
nop
subu $29 $29 $1
nop
nop
nop
nop
subu $30 $30 $1
nop
nop
nop
nop
jal end
nop
nop
nop
nop
con:
nop
nop
nop
nop
addu $16 $16 $1
nop
nop
nop
nop
addu $17 $17 $2
nop
nop
nop
nop
addu $18 $18 $3
nop
nop
nop
nop
addu $19 $19 $4
nop
nop
nop
nop
addu $20 $20 $5
nop
nop
nop
nop
addu $21 $21 $6
nop
nop
nop
nop
addu $22 $22 $7
nop
nop
nop
nop
addu $23 $23 $8
nop
nop
nop
nop
addu $24 $24 $9
nop
nop
nop
nop
addu $25 $25 $10
nop
nop
nop
nop
addu $26 $26 $11
nop
nop
nop
nop
addu $27 $27 $12
nop
nop
nop
nop
addu $28 $28 $13
nop
nop
nop
nop
addu $29 $29 $14
nop
nop
nop
nop
addu $30 $30 $15
nop
nop
nop
nop
jr $31
nop
nop
nop
nop
end:
nop
nop
nop
nop
ori $1 $0 1
nop
nop
nop
nop
ori $2 $0 2
nop
nop
nop
nop
beq $1 $2 beq1
nop
nop
nop
nop
addu $1 $1 $1
nop
nop
nop
nop
beq1:
nop
nop
nop
nop
ori $12 $0 1
nop
nop
nop
nop
ori $13 $0 1
nop
nop
nop
nop
beq $12 $13 beq2
nop
nop
nop
nop
addu $2 $2 $2
nop
nop
nop
nop
beq2:
nop
nop
nop
nop
jal con2
nop
nop
nop
nop
jal end2
nop
nop
nop
nop
addu $6 $6 $6
nop
nop
nop
nop
jal end2
nop
nop
nop
nop
con2:
nop
nop
nop
nop
addu $15 $0 $31
nop
nop
nop
nop
ori $5 $0 4
nop
nop
nop
nop
addu $31 $31 $5
nop
nop
nop
nop
jr $15
nop
nop
nop
nop
addu $1 $1 $1
nop
nop
nop
nop
end2:
nop
nop
nop
nop
|
src/kvflyweights/kvflyweights-refcounted_ptrs.adb | jhumphry/auto_counters | 5 | 1899 | <reponame>jhumphry/auto_counters
-- kvflyweights-refcounted_ptrs.adb
-- A package of reference-counting generalised references which point to
-- resources inside a KVFlyweight. Resources are associated with a key that can
-- be used to create them if they have not already been created.
-- Copyright (c) 2016, <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.
pragma Profile (No_Implementation_Extensions);
with Ada.Unchecked_Conversion;
package body KVFlyweights.Refcounted_Ptrs is
type Access_Value is access all Value;
function Access_Value_To_Value_Access is
new Ada.Unchecked_Conversion(Source => Access_Value,
Target => Value_Access);
subtype Hash_Type is Ada.Containers.Hash_Type;
use type Ada.Containers.Hash_Type;
--------------------------
-- Refcounted_Value_Ptr --
--------------------------
function P (P : Refcounted_Value_Ptr) return V_Ref is
(V_Ref'(V => P.V));
function Get (P : Refcounted_Value_Ptr) return Value_Access is
(P.V);
function Make_Ref (P : Refcounted_Value_Ptr'Class)
return Refcounted_Value_Ref is
begin
KVFlyweight_Hashtables.Increment(F => P.Containing_KVFlyweight.all,
Bucket => P.Containing_Bucket,
Key_Ptr => P.K);
return Refcounted_Value_Ref'(Ada.Finalization.Controlled
with V => P.V,
K => P.K,
Containing_KVFlyweight => P.Containing_KVFlyweight,
Containing_Bucket => P.Containing_Bucket);
end Make_Ref;
function Insert_Ptr (F : aliased in out KVFlyweight_Hashtables.KVFlyweight;
K : in Key) return Refcounted_Value_Ptr is
Bucket : Hash_Type;
Key_Ptr : Key_Access;
Value_Ptr : Value_Access;
begin
KVFlyweight_Hashtables.Insert (F => F,
Bucket => Bucket,
K => K,
Key_Ptr => Key_Ptr,
Value_Ptr => Value_Ptr);
return Refcounted_Value_Ptr'(Ada.Finalization.Controlled
with V => Value_Ptr,
K => Key_Ptr,
Containing_KVFlyweight => F'Access,
Containing_Bucket => Bucket);
end Insert_Ptr;
overriding procedure Adjust (Object : in out Refcounted_Value_Ptr) is
begin
if Object.V /= null and Object.Containing_KVFlyweight /= null then
KVFlyweight_Hashtables.Increment(F => Object.Containing_KVFlyweight.all,
Bucket => Object.Containing_Bucket,
Key_Ptr => Object.K);
end if;
end Adjust;
overriding procedure Finalize (Object : in out Refcounted_Value_Ptr) is
begin
if Object.V /= null and Object.Containing_KVFlyweight /= null then
KVFlyweight_Hashtables.Remove(F => Object.Containing_KVFlyweight.all,
Bucket => Object.Containing_Bucket,
Key_Ptr => Object.K);
Object.Containing_KVFlyweight := null;
end if;
end Finalize;
--------------------------
-- Refcounted_Value_Ref --
--------------------------
function Make_Ptr (R : Refcounted_Value_Ref'Class)
return Refcounted_Value_Ptr is
begin
KVFlyweight_Hashtables.Increment(F => R.Containing_KVFlyweight.all,
Bucket => R.Containing_Bucket,
Key_Ptr => R.K);
return Refcounted_Value_Ptr'(Ada.Finalization.Controlled
with V => Access_Value_To_Value_Access(R.V),
K => R.K,
Containing_KVFlyweight => R.Containing_KVFlyweight,
Containing_Bucket => R.Containing_Bucket);
end Make_Ptr;
function Get (P : Refcounted_Value_Ref) return Value_Access is
(Access_Value_To_Value_Access(P.V));
function Insert_Ref (F : aliased in out KVFlyweight_Hashtables.KVFlyweight;
K : in Key) return Refcounted_Value_Ref is
Bucket : Hash_Type;
Key_Ptr : Key_Access;
Value_Ptr : Value_Access;
begin
KVFlyweight_Hashtables.Insert (F => F,
Bucket => Bucket,
K => K,
Key_Ptr => Key_Ptr,
Value_Ptr => Value_Ptr);
return Refcounted_Value_Ref'(Ada.Finalization.Controlled
with V => Value_Ptr,
K => Key_Ptr,
Containing_KVFlyweight => F'Access,
Containing_Bucket => Bucket);
end Insert_Ref;
overriding procedure Initialize (Object : in out Refcounted_Value_Ref) is
begin
raise Program_Error
with "Refcounted_Value_Ref should not be created outside the package";
end Initialize;
overriding procedure Adjust (Object : in out Refcounted_Value_Ref) is
begin
if Object.Containing_KVFlyweight /= null then
KVFlyweight_Hashtables.Increment(F => Object.Containing_KVFlyweight.all,
Bucket => Object.Containing_Bucket,
Key_Ptr => Object.K);
end if;
end Adjust;
overriding procedure Finalize (Object : in out Refcounted_Value_Ref) is
begin
if Object.Containing_KVFlyweight /= null then
KVFlyweight_Hashtables.Remove(F => Object.Containing_KVFlyweight.all,
Bucket => Object.Containing_Bucket,
Key_Ptr => Object.K);
Object.Containing_KVFlyweight := null;
end if;
end Finalize;
end KVFlyweights.Refcounted_Ptrs;
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_base_gstbytewriter_h.ads | persan/A-gst | 1 | 21203 | <filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_base_gstbytewriter_h.ads
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbytereader_h;
with glib;
with glib.Values;
with System;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbytewriter_h is
-- arg-macro: function GST_BYTE_WRITER (writer)
-- return (GstByteWriter *) (writer);
-- arg-macro: procedure gst_byte_writer_put_string (writer, data)
-- gst_byte_writer_put_string_utf8(writer, data)
-- arg-macro: procedure gst_byte_writer_ensure_free_space (writer, size)
-- G_LIKELY (_gst_byte_writer_ensure_free_space_inline (writer, size))
-- arg-macro: procedure gst_byte_writer_put_uint8 (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint8_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int8 (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int8_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint16_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint16_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint16_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint16_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int16_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int16_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int16_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int16_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint24_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint24_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint24_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint24_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int24_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int24_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int24_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int24_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint32_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint32_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint32_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint32_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int32_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int32_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int32_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int32_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint64_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint64_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_uint64_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_uint64_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int64_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int64_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_int64_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_int64_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_float32_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_float32_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_float32_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_float32_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_float64_be (writer, val)
-- G_LIKELY (_gst_byte_writer_put_float64_be_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_float64_le (writer, val)
-- G_LIKELY (_gst_byte_writer_put_float64_le_inline (writer, val))
-- arg-macro: procedure gst_byte_writer_put_data (writer, data, size)
-- G_LIKELY (_gst_byte_writer_put_data_inline (writer, data, size))
-- arg-macro: procedure gst_byte_writer_fill (writer, val, size)
-- G_LIKELY (_gst_byte_writer_fill_inline (writer, val, size))
-- GStreamer byte writer
-- *
-- * Copyright (C) 2009 <NAME> <<EMAIL>>.
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
--*
-- * GstByteWriter:
-- * @parent: #GstByteReader parent
-- * @alloc_size: Allocation size of the data
-- * @fixed: If %TRUE no reallocations are allowed
-- * @owned: If %FALSE no reallocations are allowed and copies of data are returned
-- *
-- * A byte writer instance.
--
type GstByteWriter is record
parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbytereader_h.GstByteReader; -- gst/base/gstbytewriter.h:43
alloc_size : aliased GLIB.guint; -- gst/base/gstbytewriter.h:45
fixed : aliased GLIB.gboolean; -- gst/base/gstbytewriter.h:47
owned : aliased GLIB.gboolean; -- gst/base/gstbytewriter.h:48
end record;
pragma Convention (C_Pass_By_Copy, GstByteWriter); -- gst/base/gstbytewriter.h:49
-- skipped anonymous struct anon_310
function gst_byte_writer_new return access GstByteWriter; -- gst/base/gstbytewriter.h:51
pragma Import (C, gst_byte_writer_new, "gst_byte_writer_new");
function gst_byte_writer_new_with_size (size : GLIB.guint; fixed : GLIB.gboolean) return access GstByteWriter; -- gst/base/gstbytewriter.h:52
pragma Import (C, gst_byte_writer_new_with_size, "gst_byte_writer_new_with_size");
function gst_byte_writer_new_with_data
(data : access GLIB.guint8;
size : GLIB.guint;
initialized : GLIB.gboolean) return access GstByteWriter; -- gst/base/gstbytewriter.h:53
pragma Import (C, gst_byte_writer_new_with_data, "gst_byte_writer_new_with_data");
function gst_byte_writer_new_with_buffer (buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; initialized : GLIB.gboolean) return access GstByteWriter; -- gst/base/gstbytewriter.h:54
pragma Import (C, gst_byte_writer_new_with_buffer, "gst_byte_writer_new_with_buffer");
procedure gst_byte_writer_init (writer : access GstByteWriter); -- gst/base/gstbytewriter.h:56
pragma Import (C, gst_byte_writer_init, "gst_byte_writer_init");
procedure gst_byte_writer_init_with_size
(writer : access GstByteWriter;
size : GLIB.guint;
fixed : GLIB.gboolean); -- gst/base/gstbytewriter.h:57
pragma Import (C, gst_byte_writer_init_with_size, "gst_byte_writer_init_with_size");
procedure gst_byte_writer_init_with_data
(writer : access GstByteWriter;
data : access GLIB.guint8;
size : GLIB.guint;
initialized : GLIB.gboolean); -- gst/base/gstbytewriter.h:58
pragma Import (C, gst_byte_writer_init_with_data, "gst_byte_writer_init_with_data");
procedure gst_byte_writer_init_with_buffer
(writer : access GstByteWriter;
buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer;
initialized : GLIB.gboolean); -- gst/base/gstbytewriter.h:59
pragma Import (C, gst_byte_writer_init_with_buffer, "gst_byte_writer_init_with_buffer");
procedure gst_byte_writer_free (writer : access GstByteWriter); -- gst/base/gstbytewriter.h:61
pragma Import (C, gst_byte_writer_free, "gst_byte_writer_free");
function gst_byte_writer_free_and_get_data (writer : access GstByteWriter) return access GLIB.guint8; -- gst/base/gstbytewriter.h:62
pragma Import (C, gst_byte_writer_free_and_get_data, "gst_byte_writer_free_and_get_data");
function gst_byte_writer_free_and_get_buffer (writer : access GstByteWriter) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/base/gstbytewriter.h:63
pragma Import (C, gst_byte_writer_free_and_get_buffer, "gst_byte_writer_free_and_get_buffer");
procedure gst_byte_writer_reset (writer : access GstByteWriter); -- gst/base/gstbytewriter.h:65
pragma Import (C, gst_byte_writer_reset, "gst_byte_writer_reset");
function gst_byte_writer_reset_and_get_data (writer : access GstByteWriter) return access GLIB.guint8; -- gst/base/gstbytewriter.h:66
pragma Import (C, gst_byte_writer_reset_and_get_data, "gst_byte_writer_reset_and_get_data");
function gst_byte_writer_reset_and_get_buffer (writer : access GstByteWriter) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/base/gstbytewriter.h:67
pragma Import (C, gst_byte_writer_reset_and_get_buffer, "gst_byte_writer_reset_and_get_buffer");
--*
-- * gst_byte_writer_get_pos:
-- * @writer: #GstByteWriter instance
-- *
-- * Returns: The current position of the read/write cursor
-- *
-- * Since: 0.10.26
--
--*
-- * gst_byte_writer_set_pos:
-- * @writer: #GstByteWriter instance
-- * @pos: new position
-- *
-- * Sets the current read/write cursor of @writer. The new position
-- * can only be between 0 and the current size.
-- *
-- * Returns: %TRUE if the new position could be set
-- *
-- * Since: 0.10.26
--
--*
-- * gst_byte_writer_get_size:
-- * @writer: #GstByteWriter instance
-- *
-- * Returns: The current, initialized size of the data
-- *
-- * Since: 0.10.26
--
function gst_byte_writer_get_pos (writer : access constant GstByteWriter) return GLIB.guint; -- gst/base/gstbytewriter.h:103
pragma Import (C, gst_byte_writer_get_pos, "gst_byte_writer_get_pos");
function gst_byte_writer_set_pos (writer : access GstByteWriter; pos : GLIB.guint) return GLIB.gboolean; -- gst/base/gstbytewriter.h:109
pragma Import (C, gst_byte_writer_set_pos, "gst_byte_writer_set_pos");
function gst_byte_writer_get_size (writer : access constant GstByteWriter) return GLIB.guint; -- gst/base/gstbytewriter.h:115
pragma Import (C, gst_byte_writer_get_size, "gst_byte_writer_get_size");
function gst_byte_writer_get_remaining (writer : access constant GstByteWriter) return GLIB.guint; -- gst/base/gstbytewriter.h:121
pragma Import (C, gst_byte_writer_get_remaining, "gst_byte_writer_get_remaining");
function gst_byte_writer_ensure_free_space (writer : access GstByteWriter; size : GLIB.guint) return GLIB.gboolean; -- gst/base/gstbytewriter.h:122
pragma Import (C, gst_byte_writer_ensure_free_space, "gst_byte_writer_ensure_free_space");
function gst_byte_writer_put_uint8 (writer : access GstByteWriter; val : GLIB.guint8) return GLIB.gboolean; -- gst/base/gstbytewriter.h:124
pragma Import (C, gst_byte_writer_put_uint8, "gst_byte_writer_put_uint8");
function gst_byte_writer_put_int8 (writer : access GstByteWriter; val : GLIB.gint8) return GLIB.gboolean; -- gst/base/gstbytewriter.h:125
pragma Import (C, gst_byte_writer_put_int8, "gst_byte_writer_put_int8");
function gst_byte_writer_put_uint16_be (writer : access GstByteWriter; val : GLIB.guint16) return GLIB.gboolean; -- gst/base/gstbytewriter.h:126
pragma Import (C, gst_byte_writer_put_uint16_be, "gst_byte_writer_put_uint16_be");
function gst_byte_writer_put_uint16_le (writer : access GstByteWriter; val : GLIB.guint16) return GLIB.gboolean; -- gst/base/gstbytewriter.h:127
pragma Import (C, gst_byte_writer_put_uint16_le, "gst_byte_writer_put_uint16_le");
function gst_byte_writer_put_int16_be (writer : access GstByteWriter; val : GLIB.gint16) return GLIB.gboolean; -- gst/base/gstbytewriter.h:128
pragma Import (C, gst_byte_writer_put_int16_be, "gst_byte_writer_put_int16_be");
function gst_byte_writer_put_int16_le (writer : access GstByteWriter; val : GLIB.gint16) return GLIB.gboolean; -- gst/base/gstbytewriter.h:129
pragma Import (C, gst_byte_writer_put_int16_le, "gst_byte_writer_put_int16_le");
function gst_byte_writer_put_uint24_be (writer : access GstByteWriter; val : GLIB.guint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:130
pragma Import (C, gst_byte_writer_put_uint24_be, "gst_byte_writer_put_uint24_be");
function gst_byte_writer_put_uint24_le (writer : access GstByteWriter; val : GLIB.guint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:131
pragma Import (C, gst_byte_writer_put_uint24_le, "gst_byte_writer_put_uint24_le");
function gst_byte_writer_put_int24_be (writer : access GstByteWriter; val : GLIB.gint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:132
pragma Import (C, gst_byte_writer_put_int24_be, "gst_byte_writer_put_int24_be");
function gst_byte_writer_put_int24_le (writer : access GstByteWriter; val : GLIB.gint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:133
pragma Import (C, gst_byte_writer_put_int24_le, "gst_byte_writer_put_int24_le");
function gst_byte_writer_put_uint32_be (writer : access GstByteWriter; val : GLIB.guint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:134
pragma Import (C, gst_byte_writer_put_uint32_be, "gst_byte_writer_put_uint32_be");
function gst_byte_writer_put_uint32_le (writer : access GstByteWriter; val : GLIB.guint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:135
pragma Import (C, gst_byte_writer_put_uint32_le, "gst_byte_writer_put_uint32_le");
function gst_byte_writer_put_int32_be (writer : access GstByteWriter; val : GLIB.gint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:136
pragma Import (C, gst_byte_writer_put_int32_be, "gst_byte_writer_put_int32_be");
function gst_byte_writer_put_int32_le (writer : access GstByteWriter; val : GLIB.gint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:137
pragma Import (C, gst_byte_writer_put_int32_le, "gst_byte_writer_put_int32_le");
function gst_byte_writer_put_uint64_be (writer : access GstByteWriter; val : GLIB.guint64) return GLIB.gboolean; -- gst/base/gstbytewriter.h:138
pragma Import (C, gst_byte_writer_put_uint64_be, "gst_byte_writer_put_uint64_be");
function gst_byte_writer_put_uint64_le (writer : access GstByteWriter; val : GLIB.guint64) return GLIB.gboolean; -- gst/base/gstbytewriter.h:139
pragma Import (C, gst_byte_writer_put_uint64_le, "gst_byte_writer_put_uint64_le");
function gst_byte_writer_put_int64_be (writer : access GstByteWriter; val : GLIB.gint64) return GLIB.gboolean; -- gst/base/gstbytewriter.h:140
pragma Import (C, gst_byte_writer_put_int64_be, "gst_byte_writer_put_int64_be");
function gst_byte_writer_put_int64_le (writer : access GstByteWriter; val : GLIB.gint64) return GLIB.gboolean; -- gst/base/gstbytewriter.h:141
pragma Import (C, gst_byte_writer_put_int64_le, "gst_byte_writer_put_int64_le");
function gst_byte_writer_put_float32_be (writer : access GstByteWriter; val : GLIB.gfloat) return GLIB.gboolean; -- gst/base/gstbytewriter.h:143
pragma Import (C, gst_byte_writer_put_float32_be, "gst_byte_writer_put_float32_be");
function gst_byte_writer_put_float32_le (writer : access GstByteWriter; val : GLIB.gfloat) return GLIB.gboolean; -- gst/base/gstbytewriter.h:144
pragma Import (C, gst_byte_writer_put_float32_le, "gst_byte_writer_put_float32_le");
function gst_byte_writer_put_float64_be (writer : access GstByteWriter; val : GLIB.gdouble) return GLIB.gboolean; -- gst/base/gstbytewriter.h:145
pragma Import (C, gst_byte_writer_put_float64_be, "gst_byte_writer_put_float64_be");
function gst_byte_writer_put_float64_le (writer : access GstByteWriter; val : GLIB.gdouble) return GLIB.gboolean; -- gst/base/gstbytewriter.h:146
pragma Import (C, gst_byte_writer_put_float64_le, "gst_byte_writer_put_float64_le");
function gst_byte_writer_put_data
(writer : access GstByteWriter;
data : access GLIB.guint8;
size : GLIB.guint) return GLIB.gboolean; -- gst/base/gstbytewriter.h:148
pragma Import (C, gst_byte_writer_put_data, "gst_byte_writer_put_data");
function gst_byte_writer_fill
(writer : access GstByteWriter;
value : GLIB.guint8;
size : GLIB.guint) return GLIB.gboolean; -- gst/base/gstbytewriter.h:149
pragma Import (C, gst_byte_writer_fill, "gst_byte_writer_fill");
function gst_byte_writer_put_string_utf8 (writer : access GstByteWriter; data : access GLIB.gchar) return GLIB.gboolean; -- gst/base/gstbytewriter.h:150
pragma Import (C, gst_byte_writer_put_string_utf8, "gst_byte_writer_put_string_utf8");
function gst_byte_writer_put_string_utf16 (writer : access GstByteWriter; data : access GLIB.guint16) return GLIB.gboolean; -- gst/base/gstbytewriter.h:151
pragma Import (C, gst_byte_writer_put_string_utf16, "gst_byte_writer_put_string_utf16");
function gst_byte_writer_put_string_utf32 (writer : access GstByteWriter; data : access GLIB.guint32) return GLIB.gboolean; -- gst/base/gstbytewriter.h:152
pragma Import (C, gst_byte_writer_put_string_utf32, "gst_byte_writer_put_string_utf32");
--*
-- * gst_byte_writer_put_string:
-- * @writer: #GstByteWriter instance
-- * @data: (in) (array zero-terminated=1): Null terminated string
-- *
-- * Write a NUL-terminated string to @writer (including the terminator). The
-- * string is assumed to be in an 8-bit encoding (e.g. ASCII,UTF-8 or
-- * ISO-8859-1).
-- *
-- * Returns: %TRUE if the string could be written
-- *
-- * Since: 0.10.26
--
-- skipped func _gst_byte_writer_next_pow2
-- We start with 16, smaller allocations make no sense
-- skipped func _gst_byte_writer_ensure_free_space_inline
-- skipped func _gst_byte_writer_put_uint8_inline
procedure gst_byte_writer_put_uint8_unchecked (writer : access GstByteWriter; val : GLIB.guint8); -- gst/base/gstbytewriter.h:230
pragma Import (C, gst_byte_writer_put_uint8_unchecked, "gst_byte_writer_put_uint8_unchecked");
-- skipped func _gst_byte_writer_put_int8_inline
procedure gst_byte_writer_put_int8_unchecked (writer : access GstByteWriter; val : GLIB.gint8); -- gst/base/gstbytewriter.h:231
pragma Import (C, gst_byte_writer_put_int8_unchecked, "gst_byte_writer_put_int8_unchecked");
-- skipped func _gst_byte_writer_put_uint16_le_inline
procedure gst_byte_writer_put_uint16_le_unchecked (writer : access GstByteWriter; val : GLIB.guint16); -- gst/base/gstbytewriter.h:232
pragma Import (C, gst_byte_writer_put_uint16_le_unchecked, "gst_byte_writer_put_uint16_le_unchecked");
-- skipped func _gst_byte_writer_put_uint16_be_inline
procedure gst_byte_writer_put_uint16_be_unchecked (writer : access GstByteWriter; val : GLIB.guint16); -- gst/base/gstbytewriter.h:233
pragma Import (C, gst_byte_writer_put_uint16_be_unchecked, "gst_byte_writer_put_uint16_be_unchecked");
-- skipped func _gst_byte_writer_put_int16_le_inline
procedure gst_byte_writer_put_int16_le_unchecked (writer : access GstByteWriter; val : GLIB.gint16); -- gst/base/gstbytewriter.h:234
pragma Import (C, gst_byte_writer_put_int16_le_unchecked, "gst_byte_writer_put_int16_le_unchecked");
-- skipped func _gst_byte_writer_put_int16_be_inline
procedure gst_byte_writer_put_int16_be_unchecked (writer : access GstByteWriter; val : GLIB.gint16); -- gst/base/gstbytewriter.h:235
pragma Import (C, gst_byte_writer_put_int16_be_unchecked, "gst_byte_writer_put_int16_be_unchecked");
-- skipped func _gst_byte_writer_put_uint24_le_inline
procedure gst_byte_writer_put_uint24_le_unchecked (writer : access GstByteWriter; val : GLIB.guint32); -- gst/base/gstbytewriter.h:236
pragma Import (C, gst_byte_writer_put_uint24_le_unchecked, "gst_byte_writer_put_uint24_le_unchecked");
-- skipped func _gst_byte_writer_put_uint24_be_inline
procedure gst_byte_writer_put_uint24_be_unchecked (writer : access GstByteWriter; val : GLIB.guint32); -- gst/base/gstbytewriter.h:237
pragma Import (C, gst_byte_writer_put_uint24_be_unchecked, "gst_byte_writer_put_uint24_be_unchecked");
-- skipped func _gst_byte_writer_put_int24_le_inline
procedure gst_byte_writer_put_int24_le_unchecked (writer : access GstByteWriter; val : GLIB.gint32); -- gst/base/gstbytewriter.h:238
pragma Import (C, gst_byte_writer_put_int24_le_unchecked, "gst_byte_writer_put_int24_le_unchecked");
-- skipped func _gst_byte_writer_put_int24_be_inline
procedure gst_byte_writer_put_int24_be_unchecked (writer : access GstByteWriter; val : GLIB.gint32); -- gst/base/gstbytewriter.h:239
pragma Import (C, gst_byte_writer_put_int24_be_unchecked, "gst_byte_writer_put_int24_be_unchecked");
-- skipped func _gst_byte_writer_put_uint32_le_inline
procedure gst_byte_writer_put_uint32_le_unchecked (writer : access GstByteWriter; val : GLIB.guint32); -- gst/base/gstbytewriter.h:240
pragma Import (C, gst_byte_writer_put_uint32_le_unchecked, "gst_byte_writer_put_uint32_le_unchecked");
-- skipped func _gst_byte_writer_put_uint32_be_inline
procedure gst_byte_writer_put_uint32_be_unchecked (writer : access GstByteWriter; val : GLIB.guint32); -- gst/base/gstbytewriter.h:241
pragma Import (C, gst_byte_writer_put_uint32_be_unchecked, "gst_byte_writer_put_uint32_be_unchecked");
-- skipped func _gst_byte_writer_put_int32_le_inline
procedure gst_byte_writer_put_int32_le_unchecked (writer : access GstByteWriter; val : GLIB.gint32); -- gst/base/gstbytewriter.h:242
pragma Import (C, gst_byte_writer_put_int32_le_unchecked, "gst_byte_writer_put_int32_le_unchecked");
-- skipped func _gst_byte_writer_put_int32_be_inline
procedure gst_byte_writer_put_int32_be_unchecked (writer : access GstByteWriter; val : GLIB.gint32); -- gst/base/gstbytewriter.h:243
pragma Import (C, gst_byte_writer_put_int32_be_unchecked, "gst_byte_writer_put_int32_be_unchecked");
-- skipped func _gst_byte_writer_put_uint64_le_inline
procedure gst_byte_writer_put_uint64_le_unchecked (writer : access GstByteWriter; val : GLIB.guint64); -- gst/base/gstbytewriter.h:244
pragma Import (C, gst_byte_writer_put_uint64_le_unchecked, "gst_byte_writer_put_uint64_le_unchecked");
-- skipped func _gst_byte_writer_put_uint64_be_inline
procedure gst_byte_writer_put_uint64_be_unchecked (writer : access GstByteWriter; val : GLIB.guint64); -- gst/base/gstbytewriter.h:245
pragma Import (C, gst_byte_writer_put_uint64_be_unchecked, "gst_byte_writer_put_uint64_be_unchecked");
-- skipped func _gst_byte_writer_put_int64_le_inline
procedure gst_byte_writer_put_int64_le_unchecked (writer : access GstByteWriter; val : GLIB.gint64); -- gst/base/gstbytewriter.h:246
pragma Import (C, gst_byte_writer_put_int64_le_unchecked, "gst_byte_writer_put_int64_le_unchecked");
-- skipped func _gst_byte_writer_put_int64_be_inline
procedure gst_byte_writer_put_int64_be_unchecked (writer : access GstByteWriter; val : GLIB.gint64); -- gst/base/gstbytewriter.h:247
pragma Import (C, gst_byte_writer_put_int64_be_unchecked, "gst_byte_writer_put_int64_be_unchecked");
-- skipped func _gst_byte_writer_put_float32_be_inline
procedure gst_byte_writer_put_float32_be_unchecked (writer : access GstByteWriter; val : GLIB.gfloat); -- gst/base/gstbytewriter.h:249
pragma Import (C, gst_byte_writer_put_float32_be_unchecked, "gst_byte_writer_put_float32_be_unchecked");
-- skipped func _gst_byte_writer_put_float32_le_inline
procedure gst_byte_writer_put_float32_le_unchecked (writer : access GstByteWriter; val : GLIB.gfloat); -- gst/base/gstbytewriter.h:250
pragma Import (C, gst_byte_writer_put_float32_le_unchecked, "gst_byte_writer_put_float32_le_unchecked");
-- skipped func _gst_byte_writer_put_float64_be_inline
procedure gst_byte_writer_put_float64_be_unchecked (writer : access GstByteWriter; val : GLIB.gdouble); -- gst/base/gstbytewriter.h:251
pragma Import (C, gst_byte_writer_put_float64_be_unchecked, "gst_byte_writer_put_float64_be_unchecked");
-- skipped func _gst_byte_writer_put_float64_le_inline
procedure gst_byte_writer_put_float64_le_unchecked (writer : access GstByteWriter; val : GLIB.gdouble); -- gst/base/gstbytewriter.h:252
pragma Import (C, gst_byte_writer_put_float64_le_unchecked, "gst_byte_writer_put_float64_le_unchecked");
procedure gst_byte_writer_put_data_unchecked
(writer : access GstByteWriter;
data : access GLIB.guint8;
size : GLIB.guint); -- gst/base/gstbytewriter.h:257
pragma Import (C, gst_byte_writer_put_data_unchecked, "gst_byte_writer_put_data_unchecked");
-- skipped func _gst_byte_writer_put_data_inline
procedure gst_byte_writer_fill_unchecked
(writer : access GstByteWriter;
value : GLIB.guint8;
size : GLIB.guint); -- gst/base/gstbytewriter.h:280
pragma Import (C, gst_byte_writer_fill_unchecked, "gst_byte_writer_fill_unchecked");
-- skipped func _gst_byte_writer_fill_inline
-- we use defines here so we can add the G_LIKELY()
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbytewriter_h;
|
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_m_tapeout_trunc.asm | jpoikela/z88dk | 640 | 101202 | <filename>libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_m_tapeout_trunc.asm
; unsigned char esx_m_tapeout_trunc(unsigned char *filename)
SECTION code_esxdos
PUBLIC _esx_m_tapeout_trunc
EXTERN _esx_m_tapeout_trunc_fastcall
_esx_m_tapeout_trunc:
pop af
pop hl
push hl
push af
jp _esx_m_tapeout_trunc_fastcall
|
Cubical/Structures/Ring.agda | cmester0/cubical | 1 | 7915 | {-# OPTIONS --cubical --safe #-}
module Cubical.Structures.Ring where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Data.Sigma
open import Cubical.Foundations.SIP renaming (SNS-PathP to SNS)
open import Cubical.Structures.NAryOp
open import Cubical.Structures.Monoid hiding (⟨_⟩)
open import Cubical.Structures.AbGroup hiding (⟨_⟩)
open import Cubical.Structures.Pointed
private
variable
ℓ ℓ' : Level
raw-ring-structure : Type ℓ → Type ℓ
raw-ring-structure X = (X → X → X) × X × (X → X → X)
-- Maybe this is not the best way? (Suggestions welcome, maybe having raw-monoid-iso defined?)
raw-ring-is-SNS : SNS {ℓ} raw-ring-structure _
raw-ring-is-SNS = join-SNS (nAryFunIso 2) (nAryFunSNS 2)
(join-iso pointed-iso (nAryFunIso 2))
(join-SNS pointed-iso pointed-is-SNS (nAryFunIso 2) (nAryFunSNS 2))
ring-axioms : (X : Type ℓ) (s : raw-ring-structure X) → Type ℓ
ring-axioms X (_+_ , ₁ , _·_) = abelian-group-axioms X _+_ ×
monoid-axioms X (₁ , _·_) ×
((x y z : X) → x · (y + z) ≡ (x · y) + (x · z)) ×
((x y z : X) → (x + y) · z ≡ (x · z) + (y · z))
ring-structure : Type ℓ → Type ℓ
ring-structure = add-to-structure raw-ring-structure ring-axioms
Ring : Type (ℓ-suc ℓ)
Ring {ℓ} = TypeWithStr ℓ ring-structure
ring-iso : StrIso ring-structure ℓ
ring-iso = add-to-iso (join-iso (nAryFunIso 2) (join-iso pointed-iso (nAryFunIso 2))) ring-axioms
ring-axioms-isProp : (X : Type ℓ) (s : raw-ring-structure X) → isProp (ring-axioms X s)
ring-axioms-isProp X (_+_ , ₁ , _·_) = isPropΣ (abelian-group-axioms-isProp X _+_)
λ _ → isPropΣ (monoid-axioms-are-Props X (₁ , _·_))
λ { (isSetX , _) → isPropΣ (isPropΠ3 (λ _ _ _ → isSetX _ _))
λ _ → isPropΠ3 (λ _ _ _ → isSetX _ _)}
ring-is-SNS : SNS {ℓ} ring-structure ring-iso
ring-is-SNS = add-axioms-SNS _ ring-axioms-isProp raw-ring-is-SNS
RingPath : (M N : Ring {ℓ}) → (M ≃[ ring-iso ] N) ≃ (M ≡ N)
RingPath = SIP ring-is-SNS
-- Rings have an abelian group
Ring→AbGroup : Ring {ℓ} → AbGroup {ℓ}
Ring→AbGroup (R , (_+_ , _) , +AbGroup , _) = R , _+_ , +AbGroup
-- Rings have a monoid
Ring→Monoid : Ring {ℓ} → Monoid {ℓ}
Ring→Monoid (R , (_ , ₁ , _·_) , _ , ·Monoid , _) = R , (₁ , _·_) , ·Monoid
-- Ring extractors
⟨_⟩ : Ring {ℓ} → Type ℓ
⟨ R , _ ⟩ = R
module _ (R : Ring {ℓ}) where
ring+-operation = abgroup-operation (Ring→AbGroup R)
ring-is-set = abgroup-is-set (Ring→AbGroup R)
ring+-assoc = abgroup-assoc (Ring→AbGroup R)
ring+-id = abgroup-id (Ring→AbGroup R)
ring+-rid = abgroup-rid (Ring→AbGroup R)
ring+-lid = abgroup-lid (Ring→AbGroup R)
ring+-inv = abgroup-inv (Ring→AbGroup R)
ring+-rinv = abgroup-rinv (Ring→AbGroup R)
ring+-linv = abgroup-linv (Ring→AbGroup R)
ring+-comm = abgroup-comm (Ring→AbGroup R)
ring·-operation = monoid-operation (Ring→Monoid R)
ring·-assoc = monoid-assoc (Ring→Monoid R)
ring·-id = monoid-id (Ring→Monoid R)
ring·-rid = monoid-rid (Ring→Monoid R)
ring·-lid = monoid-lid (Ring→Monoid R)
module ring-syntax where
ring+-operation-syntax : (R : Ring {ℓ}) → ⟨ R ⟩ → ⟨ R ⟩ → ⟨ R ⟩
ring+-operation-syntax R = ring+-operation R
infixr 14 ring+-operation-syntax
syntax ring+-operation-syntax R x y = x +⟨ R ⟩ y
ring·-operation-syntax : (R : Ring {ℓ}) → ⟨ R ⟩ → ⟨ R ⟩ → ⟨ R ⟩
ring·-operation-syntax R = ring·-operation R
infixr 18 ring·-operation-syntax
syntax ring·-operation-syntax R x y = x ·⟨ R ⟩ y
open ring-syntax
ring-rdist : (R : Ring {ℓ}) (x y z : ⟨ R ⟩) → x ·⟨ R ⟩ (y +⟨ R ⟩ z) ≡ (x ·⟨ R ⟩ y) +⟨ R ⟩ (x ·⟨ R ⟩ z)
ring-rdist (_ , _ , _ , _ , P , _) = P
ring-ldist : (R : Ring {ℓ}) (x y z : ⟨ R ⟩) → (x +⟨ R ⟩ y) ·⟨ R ⟩ z ≡ (x ·⟨ R ⟩ z) +⟨ R ⟩ (y ·⟨ R ⟩ z)
ring-ldist (_ , _ , _ , _ , _ , P) = P
-- Ring ·syntax
module ring-·syntax (R : Ring {ℓ}) where
infixr 14 _+_
infixr 18 _·_
infix 15 -_
_+_ = ring+-operation R
_·_ = ring·-operation R
₀ = ring+-id R
₁ = ring·-id R
-_ = ring+-inv R
|
extern/gnat_sdl/gnat_sdl/src/sdl_sdl_h.ads | AdaCore/training_material | 15 | 21518 | <filename>extern/gnat_sdl/gnat_sdl/src/sdl_sdl_h.ads<gh_stars>10-100
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_SDL_stdinc_h;
package SDL_SDL_h is
SDL_INIT_TIMER : constant := 16#00000001#; -- ../include/SDL/SDL.h:61
SDL_INIT_AUDIO : constant := 16#00000010#; -- ../include/SDL/SDL.h:62
SDL_INIT_VIDEO : constant := 16#00000020#; -- ../include/SDL/SDL.h:63
SDL_INIT_CDROM : constant := 16#00000100#; -- ../include/SDL/SDL.h:64
SDL_INIT_JOYSTICK : constant := 16#00000200#; -- ../include/SDL/SDL.h:65
SDL_INIT_NOPARACHUTE : constant := 16#00100000#; -- ../include/SDL/SDL.h:66
SDL_INIT_EVENTTHREAD : constant := 16#01000000#; -- ../include/SDL/SDL.h:67
SDL_INIT_EVERYTHING : constant := 16#0000FFFF#; -- ../include/SDL/SDL.h:68
function SDL_Init (flags : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL.h:76
pragma Import (C, SDL_Init, "SDL_Init");
function SDL_InitSubSystem (flags : SDL_SDL_stdinc_h.Uint32) return int; -- ../include/SDL/SDL.h:79
pragma Import (C, SDL_InitSubSystem, "SDL_InitSubSystem");
procedure SDL_QuitSubSystem (flags : SDL_SDL_stdinc_h.Uint32); -- ../include/SDL/SDL.h:82
pragma Import (C, SDL_QuitSubSystem, "SDL_QuitSubSystem");
function SDL_WasInit (flags : SDL_SDL_stdinc_h.Uint32) return SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL.h:88
pragma Import (C, SDL_WasInit, "SDL_WasInit");
procedure SDL_Quit; -- ../include/SDL/SDL.h:93
pragma Import (C, SDL_Quit, "SDL_Quit");
end SDL_SDL_h;
|
program.asm | faxad/rc-car-remote | 0 | 166796 | include irvine16.inc
.data
message db "RC car control",0
.code
main PROC
mov ax,@data
mov ds,ax
mov es,ax
mov cx,1
push cx ; stores value of cx in stack
stop:
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(red shl 4) OR blue ; red = color of the block and blue = color of the text
mov cx,050AH ; '050A' 0A horizontal value and 05 vertical value
mov dx,0940H ; same as above
int 10h
mov ah,2 ; for text allignment of title bar
mov dx,0720H ; sets the position of the screen
mov bh,0
int 10h
mov dx,offset message ; offset of the array which contains the string
call writestring ; writes string stored in the array
; LEFT BUTTON
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(blue shl 4) OR red ; blue = color of the block and red = color of the text
mov cx,0e10H ; sets the position of the block
mov dx,0f13H ; sets the position of the block
int 10h
; BACK BUTTON
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(blue shl 4) OR red ; blue = color of the block and red = color of the text
mov cx,0e15H ; sets the position of the block
mov dx,0f33H ; sets the position of the block
int 10h
;RIGHT BUTTON
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(blue shl 4) OR red ; blue = color of the block and red = color of the text
mov cx,0e35H ; sets the position of the block
mov dx,0f38H ; sets the position of the block
int 10h
; FWD BUTTON
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(blue shl 4) OR red ; blue = color of the block and red = color of the text
mov cx,0b21H ; sets the position of the block
mov dx,0d26H ; sets the position of the block
int 10h
mov ebx,12000 ; sets the delay
pop cx ; restores the value of cx
mov ah,01h ; service for taking the input
int 21h
cmp al,'8' ; if key pressed is 8
je forward ; transfer control to forward
cmp al,'6' ; if key pressed is 6
je right_forward ; transfer control to right forward
cmp al,'4' ; if key pressed is 4
je left_forward ; transfer control to left forward
cmp al,'5' ; if key pressed is 5
je reverse ; transfer control to reverse
jmp l5 ; transfer control to l5 which will stop the car
forward:
pushad ; push all registers into stack
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(red shl 4) OR red ; red = color of the block and red = color of the text
mov cx,0b21H ; sets the position of the block
mov dx,0d26H ; sets the position of the block
int 10h
popad ; pop all registers from the stack
mov ax,1 ; sets the bit ON which will move the car
mov dx,378h ; 378 is the address of the LPT port
out dx,ax ; transfer the the bytes stored in ax to the port 378
dec ebx ; decrement the counter for delay
cmp ebx,0 ; if the value of counter is 0 thn
jg forward ; if value is greater than 0 than move forward
jmp l5 ; else jump to stop
reverse:
pushad ; push all registers into stack
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(red shl 4) OR red ; red = color of the block and red = color of the text
mov cx,0e15H ; sets the position of the block
mov dx,0f33H ; sets the position of the block
int 10h
popad ; pop all registers from the stack
mov ax,00000100b ; sets the bit ON which will move the car
mov dx,378h ; 378 is the address of the LPT port
out dx,ax ; transfer the the bytes stored in ax to the port 378
dec ebx ; decrement the counter for delay
cmp ebx,0 ; if the value of counter is 0 thn
jg reverse ; if value is greater than 0 than move REVERSE
jmp l5 ; else jump to stop
left_forward:
pushad ; push all registers into stack
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(red shl 4) OR red ; red = color of the block and red = color of the text
mov cx,0e10H ; sets the position of the block
mov dx,0f13H ; sets the position of the block
int 10h
popad ; pop all registers from the stack
mov ax,00000011b ; sets the bit ON which will move the car
mov dx,378h ; 378 is the address of the LPT port
out dx,ax ; transfer the the bytes stored in ax to the port 378
dec ebx ; decrement the counter for delay
cmp ebx,0 ; if the value of counter is 0 thn
jg left_forward ; if value is greater than 0 than move left forward
jmp l5 ; else jump to stop
right_forward:
pushad ; push all registers into stack
mov ah,0
mov ax,0600h ; service for creating a block which can have text in it
mov bh,(red shl 4) OR red ; red = color of the block and red = color of the text
mov cx,0e35H ; sets the position of the block
mov dx,0f38H ; sets the position of the block
int 10h
popad ; pop all registers from the stack
mov ax,00001001b ; sets the bit ON which will move the car
mov dx,378h ; 378 is the address of the LPT port
out dx,ax ; transfer the the bytes stored in ax to the port 378
dec ebx ; decrement the counter for delay
cmp ebx,0 ; if the value of counter is 0 thn
jg right_forward ; if value is greater than 0 than move left right forward
jmp l5 ; else jump to stop
L5:
mov ax,0 ; sets the bit ON which will move the car
mov dx,378h ; 378 is the address of the LPT port
out dx,ax ; transfer the the bytes stored in ax to the port 378
mov ebx,12000 ; again set the counter for delay
jmp stop ; loop back to jump
exit
main ENDP
END main
|
spec/render_results_spec.asm | andrzejsliwa/64spec | 53 | 5731 | <reponame>andrzejsliwa/64spec<gh_stars>10-100
.import source "64spec.asm"
.import source "64core/kernal.asm"
.import source "64core/memory.asm"
.const COLOR_RAM = $d800
.eval config_64spec("change_character_set", false)
// TODO: try printing on a different screen to not screw up test results.
sfspec: :init_spec()
with_default_settings:
// TODO: capture and restore default settings
render_result_prints_success_message_in_green_when_all_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #5: #5
:set_column_and_row #0: #0
:render_results()
:restore_column_and_row
:restore_assertions_count
.var expected_default_success_text_length = expected_default_success_text_end - expected_default_success_text
:assert_bytes_equal #expected_default_success_text_length: expected_default_success_text: $0400 + 40*1 + 0
:copy(expected_default_success_text_length, COLOR_RAM + 40*1 + 0, colors)
ldy #GREEN
ldx #expected_default_success_text_length
!loop:
lda colors - 1, X
and #%00001111
sta colors - 1, X
tya
sta expected_colors - 1, X
dex
bne !loop-
:assert_bytes_equal #expected_default_success_text_length: colors: expected_colors
render_result_changes_border_color_to_green_when_all_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #5: #5
:set_column_and_row #0: #0
:render_results()
lda $d020
and #%00001111
sta border_color
:restore_column_and_row
:restore_assertions_count
:assert_equal #GREEN: border_color
render_result_prints_partial_success_message_in_red_when_some_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #2304: #2313
:set_column_and_row #0: #0
:render_results()
:restore_column_and_row
:restore_assertions_count
.var expected_default_partial_success_text_length = expected_default_partial_success_text_end - expected_default_partial_success_text
:assert_bytes_equal #expected_default_partial_success_text_length: expected_default_partial_success_text: #$0400 + 40*1 + 0
:copy(expected_default_partial_success_text_length, COLOR_RAM + 40*1 + 0, colors)
ldy #RED
ldx #expected_default_partial_success_text_length
!loop:
lda colors - 1, X
and #%00001111
sta colors - 1, X
tya
sta expected_colors - 1, X
dex
bne !loop-
:assert_bytes_equal #expected_default_partial_success_text_length: colors: expected_colors
render_result_changes_border_color_to_red_when_some_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #5: #10
:set_column_and_row #0: #0
:render_results()
lda $d020
and #%00001111
sta border_color
:restore_column_and_row
:restore_assertions_count
:assert_equal #RED: border_color
render_result_prints_failure_message_in_red_when_no_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #0: #65280
:set_column_and_row #0: #0
:render_results()
:restore_column_and_row
:restore_assertions_count
.var expected_default_failure_text_length = expected_default_failure_text_end - expected_default_failure_text
:assert_bytes_equal #expected_default_failure_text_length: expected_default_failure_text: #$0400 + 40*1 + 0
:copy(expected_default_failure_text_length, COLOR_RAM + 40*1 + 0, colors)
ldy #RED
ldx #expected_default_failure_text_length
!loop:
lda colors - 1, X
and #%00001111
sta colors - 1, X
tya
sta expected_colors - 1, X
dex
bne !loop-
:assert_bytes_equal #expected_default_failure_text_length: colors: expected_colors
render_result_changes_border_color_to_red_when_no_tests_passed:
:store_assertions_count
:store_column_and_row
:set_assertions_count #0: #$00ff
:set_column_and_row #0: #0
:render_results()
lda $d020
and #%00001111
sta border_color
:restore_column_and_row
:restore_assertions_count
:assert_equal #RED: border_color
:finish_spec()
.pc = * "Data"
column:
.byte 0
row:
.byte 0
passed_assertions_count:
.word 0
total_assertions_count:
.word 0
border_color:
.byte 0
background_color:
.byte 0
expected_default_success_text:
.text "all tests passed: (5/5)"
expected_default_success_text_end:
expected_default_partial_success_text:
.text "some tests passed: (2304/2313)"
expected_default_partial_success_text_end:
expected_default_failure_text:
.text "all tests failed: (0/65280)"
expected_default_failure_text_end:
colors:
.fill 50, 0
expected_colors:
.fill 50, 0
.pseudocommand store_column_and_row {
:kernal_plot_get column: row
}
.pseudocommand set_column_and_row column: row {
:kernal_plot_set column: row
}
.pseudocommand restore_column_and_row {
:kernal_plot_set column: row
}
.pseudocommand store_assertions_count {
:poke16 passed_assertions_count: sfspec._passed_assertions_count
:poke16 total_assertions_count: sfspec._total_assertions_count
}
.pseudocommand set_assertions_count passed: total {
:poke16 sfspec._passed_assertions_count: passed
:poke16 sfspec._total_assertions_count: total
}
.pseudocommand restore_assertions_count {
:poke16 sfspec._passed_assertions_count: passed_assertions_count
:poke16 sfspec._total_assertions_count: total_assertions_count
}
|
Linux/reboot.asm | EgeBalci/Shellcode | 2 | 167183 | Linux/x86 Reboot - 28Bytes
#Greetz : Bomberman(Leader)
#Author : B3mB4m
#Tested ON : Ubuntu 14.04
08048060 <.text>:
8048060: 31 c0 xor %eax,%eax
8048062: 50 push %eax
8048063: 68 62 6f 6f 74 push $0x746f6f62
8048068: 68 6e 2f 72 65 push $0x65722f6e
804806d: 68 2f 73 62 69 push $0x6962732f
8048072: 89 e3 mov %esp,%ebx
8048074: 50 push %eax
8048075: 53 push %ebx
8048076: 89 e1 mov %esp,%ecx
8048078: b0 0b mov $0xb,%al
804807a: cd 80 int $0x80
#include <stdio.h>
#include <string.h>
char *shellcode = "\x31\xc0\x50\x68\x62\x6f\x6f\x74\x68\x6e\x2f\x72\x65"
"\x68\x2f\x73\x62\x69\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80";
int main(void){
fprintf(stdout,"Length: %d\n",strlen(shellcode));
(*(void(*)()) shellcode)();
}
|
source/oasis/program-elements-access_types.ads | optikos/oasis | 0 | 9495 | -- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Type_Definitions;
package Program.Elements.Access_Types is
pragma Pure (Program.Elements.Access_Types);
type Access_Type is
limited interface and Program.Elements.Type_Definitions.Type_Definition;
type Access_Type_Access is access all Access_Type'Class
with Storage_Size => 0;
end Program.Elements.Access_Types;
|
unittests/ASM/REP/F3_C2.asm | cobalt2727/FEX | 628 | 170550 | %ifdef CONFIG
{
"RegData": {
"XMM0": ["0x51525354FFFFFFFF", "0x5152535440000000"],
"XMM1": ["0x5152535400000000", "0x5152535440000000"],
"XMM2": ["0x51525354FFFFFFFF", "0x5152535440000000"],
"XMM3": ["0x0000000000000000", "0x7FC000007FC00000"],
"XMM4": ["0x5152535400000000", "0x5152535440000000"],
"XMM5": ["0x51525354FFFFFFFF", "0x5152535440000000"],
"XMM6": ["0x5152535400000000", "0x5152535440000000"],
"XMM7": ["0x00000000FFFFFFFF", "0x7FC000007FC00000"]
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rdx, 0xe0000000
mov rax, 0x515253543f800000
mov [rdx + 8 * 0], rax
mov rax, 0x5152535440000000
mov [rdx + 8 * 1], rax
mov rax, 0x515253543f800000
mov [rdx + 8 * 2], rax
mov rax, 0x5152535440800000
mov [rdx + 8 * 3], rax
movapd xmm0, [rdx + 8 * 0]
movapd xmm1, [rdx + 8 * 0]
movapd xmm2, [rdx + 8 * 0]
movapd xmm4, [rdx + 8 * 0]
movapd xmm5, [rdx + 8 * 0]
movapd xmm6, [rdx + 8 * 0]
movapd xmm7, [rdx + 8 * 0]
movapd xmm8, [rdx + 8 * 2]
cmpss xmm0, xmm8, 0x00 ; EQ
cmpss xmm1, xmm8, 0x01 ; LT
cmpss xmm2, xmm8, 0x02 ; LTE
cmpss xmm4, xmm8, 0x04 ; NEQ
cmpss xmm5, xmm8, 0x05 ; NLT
cmpss xmm6, xmm8, 0x06 ; NLTE
; Unordered and Ordered tests need to be special cased
mov rax, 0x0000000000000000
mov [rdx + 8 * 0], rax
mov rax, 0x7FC000007FC00000
mov [rdx + 8 * 1], rax
mov rax, 0x7FC0000000000000
mov [rdx + 8 * 2], rax
mov rax, 0x7FC0000000000000
mov [rdx + 8 * 3], rax
movapd xmm3, [rdx + 8 * 0]
movapd xmm7, [rdx + 8 * 0]
movapd xmm8, [rdx + 8 * 2]
; Unordered will return true when either input is nan
; [0.0, 0.0, nan, nan] unord [0.0, nan, 0.0, nan] = [0, 1, 1, 1]
cmpss xmm3, xmm8, 0x03 ; Unordered
; Ordered will return true when both inputs are NOT nan
; [0.0, 0.0, nan, nan] ord [0.0, nan, 0.0, nan] = [1, 0, 0, 0]
cmpss xmm7, xmm8, 0x07 ; Ordered
hlt
|
chomp.asm | hwreverse/PC-G850V | 7 | 101699 | <reponame>hwreverse/PC-G850V<filename>chomp.asm
10 ORG 100H
20 JP MAIN
30GPF EQU 0BFD0H
40MAIN: LD HL,L0
50 LD B,96
60 LD DE,0
70 CALL GPF
80 LD HL,L1
90 LD B,96
100 LD DE,0100H
110 CALL GPF
120 LD HL,L2
130 LD B,96
140 LD DE,0200H
150 CALL GPF
160 LD HL,L3
170 LD B,96
180 LD DE,0300H
190 CALL GPF
200 LD HL,L4
210 LD B,96
220 LD DE,0400H
230 CALL GPF
240 LD HL,L5
250 LD B,96
260 LD DE,0500H
270 CALL GPF
280 CALL WAIT
290 LD HL,L6
300 LD B,96
310 LD DE,0000H
320 CALL GPF
330 LD HL,L7
340 LD B,96
350 LD DE,0100H
360 CALL GPF
370 LD HL,L8
380 LD B,96
390 LD DE,0200H
400 CALL GPF
410 LD HL,L9
420 LD B,96
430 LD DE,0300H
440 CALL GPF
450 LD HL,L10
460 LD B,96
470 LD DE,0400H
480 CALL GPF
490 LD HL,L11
500 LD B,96
510 LD DE,0500H
520 CALL GPF
530 CALL WAIT
540 IN A,(1FH)
550 RLCA
560 RET C
570 JP MAIN
580 RET
590WAIT: LD BC,500
600WLOOP: DEC BC
610 LD A,B
620 OR C
630 JR NZ,WLOOP
640 RET
650L0: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
660 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
670 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
680 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
690 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 80H, 0C0H, 0E0H
700 DB 0E0H, 0F0H, 78H, 78H, 0BCH, 0BCH, 0BCH, 0BEH, 0BEH, 3EH, 0FEH, 0FEH
710 DB 0FEH, 0FFH, 0FEH, 0FFH, 0FEH, 0FEH, 0FEH, 0FEH, 0FEH, 0FEH, 0FCH, 0FCH
720 DB 0F8H, 0F8H, 0F0H, 0F0H, 0E0H, 0C0H, 80H, 00H, 00H, 00H, 00H, 00H
730L1: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
740 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
750 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
760 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
770 DB 00H, 00H, 00H, 00H, 0C0H, 0F0H, 0F8H, 0FEH, 5FH, 07H, 0BH, 07H
780 DB 11H, 60H, 0C6H, 0CFH, 0DEH, 0DEH, 0EFH, 0EFH, 0F7H, 0F0H, 0FFH, 0FFH
790 DB 0FFH, 0FFH, 0FFH, 0FFH, 7FH, 0FFH, 0FFH, 0FFH, 0FFH, 0EFH, 5FH, 0A7H
800 DB 0DBH, 27H, 0DBH, 25H, 0FBH, 0FEH, 0FFH, 0FBH, 0F0H, 0C0H, 00H, 00H
810L2: DB 00H, 80H, 0C0H, 0C0H, 0C0H, 80H, 80H, 80H, 00H, 00H, 00H, 00H
820 DB 00H, 80H, 0E0H, 0E0H, 0F0H, 0E0H, 0E0H, 0C0H, 0C0H, 80H, 00H, 00H
830 DB 80H, 0C0H, 60H, 7CH, 0FEH, 7CH, 66H, 0E6H, 66H, 0C6H, 7EH, 0FEH
840 DB 0FEH, 0FEH, 0E0H, 80H, 00H, 00H, 00H, 80H, 0C0H, 0C0H, 0E0H, 0A0H
850 DB 0C0H, 0E8H, 0FCH, 0FEH, 0FFH, 0FFH, 0FFH, 0FFH, 0FEH, 0FCH, 0FCH, 0F4H
860 DB 0FCH, 0FAH, 0FEH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0EFH, 0FFH
870 DB 0E7H, 0CBH, 0F5H, 8AH, 0F5H, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 7FH, 3FH
880 DB 1EH, 1FH, 3EH, 3DH, 1FH, 1FH, 00H, 01H, 03H, 07H, 0FH, 08H
890L3: DB 03H, 0FH, 0FH, 1CH, 19H, 39H, 3BH, 33H, 77H, 7FH, 3EH, 1EH
900 DB 0FH, 0FH, 06H, 07H, 07H, 0EH, 1CH, 1CH, 3FH, 3FH, 3FH, 1FH
910 DB 0FH, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
920 DB 03H, 0FH, 3FH, 0FFH, 0FFH, 0FFH, 73H, 31H, 31H, 19H, 1DH, 0FH
930 DB 07H, 0FH, 0FH, 7FH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH
940 DB 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FBH, 0FFH, 0F7H, 97H, 6FH, 0BFH, 0FFH
950 DB 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 7FH, 0FFH, 0FFH
960 DB 0F2H, 0EEH, 40H, 00H, 80H, 00H, 80H, 0E0H, 50H, 00H, 00H, 00H
970L4: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
980 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
990 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1000 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1010 DB 00H, 00H, 00H, 00H, 03H, 0FH, 3FH, 7FH, 0FFH, 0FFH, 0FFH, 0FFH
1020 DB 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH
1030 DB 0FFH, 0FFH, 0F7H, 0EBH, 0C5H, 0A9H, 42H, 08H, 22H, 00H, 0DBH, 0FFH
1040 DB 0FFH, 0FFH, 0FFH, 7DH, 0BAH, 5EH, 2FH, 17H, 06H, 01H, 00H, 00H
1050L5: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1060 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1070 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1080 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1090 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 01H, 03H, 07H
1100 DB 0FH, 0FH, 1FH, 3FH, 3FH, 7FH, 7FH, 7FH, 7FH, 0FFH, 0FFH, 0FFH
1110 DB 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 0FFH, 7FH, 7EH, 7EH, 3CH, 3DH
1120 DB 3DH, 1AH, 0CH, 0CH, 07H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1130L6: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1140 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1150 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1160 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1170 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1180 DB 00H, 00H, 00H, 00H, 00H, 00H, 90H, 80H, 08H, 14H, 28H, 9AH
1190 DB 0F4H, 58H, 0ACH, 0F4H, 0D8H, 0B6H, 0F8H, 0ACH, 0F0H, 0B8H, 0E8H, 0B0H
1200 DB 0E8H, 0D0H, 60H, 0C0H, 40H, 80H, 80H, 00H, 00H, 00H, 00H, 00H
1210L7: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1220 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1230 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1240 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1250 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1260 DB 00H, 00H, 00H, 0FH, 04H, 88H, 09H, 0C7H, 40H, 0B0H, 0D8H, 76H
1270 DB 0AAH, 0DDH, 77H, 5AH, 2FH, 1AH, 0CFH, 8AH, 87H, 02H, 03H, 00H
1280 DB 01H, 00H, 00H, 00H, 00H, 00H, 31H, 40H, 00H, 00H, 00H, 00H
1290L8: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1300 DB 00H, 00H, 80H, 40H, 0A0H, 20H, 40H, 00H, 00H, 00H, 00H, 00H
1310 DB 00H, 80H, 40H, 20H, 10H, 4CH, 00H, 00H, 00H, 00H, 00H, 08H
1320 DB 10H, 0A8H, 40H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 80H
1330 DB 00H, 00H, 00H, 0A0H, 0D8H, 0B4H, 60H, 80H, 0E0H, 00H, 0C0H, 40H
1340 DB 0A0H, 40H, 0A0H, 0D0H, 68H, 0B4H, 0EAH, 0BDH, 0EAH, 0CFH, 0C2H, 81H
1350 DB 81H, 80H, 00H, 00H, 00H, 0F8H, 0AFH, 0F6H, 0BDH, 2BH, 2EH, 14H
1360 DB 08H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1370L9: DB 00H, 01H, 00H, 08H, 00H, 00H, 00H, 20H, 20H, 00H, 12H, 02H
1380 DB 00H, 01H, 00H, 02H, 00H, 04H, 04H, 00H, 18H, 24H, 30H, 0BH
1390 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1400 DB 00H, 00H, 1BH, 74H, 5CH, 40H, 41H, 20H, 00H, 10H, 00H, 02H
1410 DB 02H, 00H, 02H, 09H, 06H, 5DH, 0B7H, 0EAH, 5DH, 0B7H, 0EAH, 0BDH
1420 DB 0EFH, 0D5H, 0BBH, 0EEH, 0DDH, 0B3H, 0C3H, 43H, 87H, 03H, 0FH, 7FH
1430 DB 0FFH, 0DBH, 0FFH, 7FH, 0D7H, 0FDH, 0AFH, 76H, 3DH, 2BH, 54H, 0A8H
1440 DB 40H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1450L10: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1460 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1470 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1480 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1490 DB 00H, 00H, 00H, 00H, 00H, 04H, 01H, 16H, 2DH, 97H, 7AH, 0AFH
1500 DB 0FAH, 0AFH, 0FAH, 0DFH, 0F6H, 0BDH, 0EFH, 0FDH, 0BBH, 0EEH, 0FCH, 0A8H
1510 DB 0F3H, 0A1H, 0C1H, 81H, 80H, 00H, 00H, 00H, 00H, 00H, 00H, 2CH
1520 DB 45H, 12H, 10H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1530L11: DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1540 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1550 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1560 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
1570 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H, 01H, 02H, 05H
1580 DB 02H, 0BH, 06H, 0BH, 16H, 0DH, 17H, 0AH, 1FH, 16H, 1BH, 2EH
1590 DB 97H, 0BAH, 8FH, 0BAH, 2EH, 0DH, 1AH, 54H, 4CH, 30H, 2CH, 20H
1600 DB 10H, 18H, 08H, 04H, 06H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/t5.adb | best08618/asylo | 7 | 25299 | -- { dg-do run }
with Init5; use Init5;
with Text_IO; use Text_IO;
with Dump;
procedure T5 is
Local_R1 : R1;
Local_R2 : R2;
begin
Local_R1.I := My_R1.I + 1;
Local_R1.A(1) := My_R1.A(1) + 1;
Local_R1.A(2) := My_R1.A(2) + 1;
Local_R1.A(3) := My_R1.A(3) + 1;
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00.*\n" }
Local_R2.I := My_R2.I + 1;
Local_R2.A(1) := My_R2.A(1) + 1;
Local_R2.A(2) := My_R2.A(2) + 1;
Local_R2.A(3) := My_R2.A(3) + 1;
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57.*\n" }
Local_R1 := (I => 16#12345678#,
A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Local_R2 := (I => 16#12345678#,
A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Local_R1.I := Local_R1.I + 1;
Local_R1.A(1) := Local_R1.A(1) + 1;
Local_R1.A(2) := Local_R1.A(2) + 1;
Local_R1.A(3) := Local_R1.A(3) + 1;
Put ("Local_R1 :");
Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00.*\n" }
Local_R2.I := Local_R2.I + 1;
Local_R2.A(1) := Local_R2.A(1) + 1;
Local_R2.A(2) := Local_R2.A(2) + 1;
Local_R2.A(3) := Local_R2.A(3) + 1;
Put ("Local_R2 :");
Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57.*\n" }
end;
|
programs/oeis/208/A208882.asm | neoneye/loda | 22 | 165537 | ; A208882: Number of representations of square of prime(n) as a^2 + b^2 + c^2 with 0 < a <= b <= c.
; 0,1,0,1,2,1,2,3,3,3,4,4,5,6,6,6,8,7,9,9,9,10,11,11,12,12,13,14,13,14,16,17,17,18,18,19,19,21,21,21,23,22,24,24,24,25,27,28,29,28,29,30,30,32,32,33,33,34,34,35,36,36,39,39,39,39,42,42,44,43,44
seq $0,6005 ; The odd prime numbers together with 1.
max $1,$0
mod $1,4
mov $2,$0
lpb $2
add $1,2
trn $2,8
lpe
sub $1,3
div $1,2
mov $0,$1
|
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud2/Eclipse/_ff_dkud2_Eclipse.asm | meesokim/z88dk | 0 | 18840 |
SECTION rodata_font_fzx
PUBLIC _ff_dkud2_Eclipse
_ff_dkud2_Eclipse:
BINARY "font/fzx/fonts/dkud2/Eclipse/eclipse.fzx"
|
lua-util.ads | jhumphry/aLua | 0 | 13309 | <gh_stars>0
-- Lua.Util
-- Utility routines to go with the Ada 2012 Lua interface
-- Copyright (c) 2015, <NAME> - see LICENSE for terms
package Lua.Util is
-- Print the stack out to the console
procedure Print_Stack(L : in Lua_State'Class);
end Lua.Util;
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_1243_1564.asm | ljhsiun2/medusa | 9 | 179761 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_1243_1564.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %r8
push %r9
lea addresses_WC_ht+0x643e, %r14
cmp %r15, %r15
mov $0x6162636465666768, %r9
movq %r9, %xmm0
and $0xffffffffffffffc0, %r14
movntdq %xmm0, (%r14)
nop
nop
dec %r15
lea addresses_D_ht+0x1acbe, %r10
nop
nop
nop
cmp $56104, %r8
vmovups (%r10), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r11
nop
nop
nop
nop
xor $58742, %r9
lea addresses_UC_ht+0x6bb8, %r8
nop
nop
nop
nop
cmp %r15, %r15
vmovups (%r8), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r10
nop
nop
nop
and %r10, %r10
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x1c2de, %r11
inc %r9
mov $0x5152535455565758, %rsi
movq %rsi, %xmm1
movups %xmm1, (%r11)
nop
nop
nop
nop
inc %r14
// Faulty Load
lea addresses_A+0x1453e, %r14
nop
nop
nop
nop
nop
and $49659, %rdi
mov (%r14), %ecx
lea oracles, %r15
and $0xff, %rcx
shlq $12, %rcx
mov (%r15,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'00': 1243}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
gfx/tilesets/underground_palette_map.asm | TastySnax12/pokecrystal16-493-plus | 2 | 4154 | tilepal 0, GRAY, GRAY, RED, WATER, WATER, WATER, WATER, RED
tilepal 0, RED, GRAY, WATER, WATER, WATER, WATER, GRAY, GRAY
tilepal 0, GRAY, RED, RED, WATER, WATER, WATER, WATER, RED
tilepal 0, RED, GRAY, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN
tilepal 0, BROWN, BROWN, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GREEN, GREEN
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN
tilepal 0, GRAY, GRAY, GRAY, BROWN, BROWN, BROWN, BROWN, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 0, GRAY, GRAY, GRAY, BROWN, BROWN, BROWN, BROWN, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
rept 32
db $ff
endr
tilepal 1, GRAY, GRAY, RED, WATER, WATER, WATER, WATER, RED
tilepal 1, RED, GRAY, WATER, WATER, WATER, WATER, GRAY, GRAY
tilepal 1, GRAY, RED, RED, WATER, WATER, WATER, WATER, RED
tilepal 1, RED, GRAY, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN
tilepal 1, BROWN, BROWN, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GREEN, GREEN
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN
tilepal 1, GRAY, GRAY, GRAY, BROWN, BROWN, YELLOW, YELLOW, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
tilepal 1, GRAY, GRAY, GRAY, BROWN, BROWN, YELLOW, YELLOW, GRAY
tilepal 1, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY
|
ejerciciosdeclase/02-pila-C/ej2/suma.asm | ignaciolebrero/Orga2 | 0 | 90499 | global suma
section .text ;inicio de codigo ejecutable
suma:
;armando el STACK FRAME(super util)
push RBP
mov RBP, RSP
push RBX
push R12
push R13
push R14
push R15
;MI CODIGO
addss XMM0, XMM1 ; XMM0 = XMM0 + XMM1
;desarmo el STACK FRAME(mas util todavia)
pop R15
pop R14
pop R13
pop R12
pop RBX
pop RBP
ret |
Palmtree.Math.Core.Implements/vs_build/x64_Debug/pmc_clone.asm | rougemeilland/Palmtree.Math.Core.Implements | 0 | 95993 | <reponame>rougemeilland/Palmtree.Math.Core.Implements
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
include listing.inc
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
msvcjmc SEGMENT
__7B7A869E_ctype@h DB 01H
__457DD326_basetsd@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__1887E595_winnt@h DB 01H
__9FC7C64B_processthreadsapi@h DB 01H
__FA470AEC_memoryapi@h DB 01H
__F37DAFF1_winerror@h DB 01H
__7A450CCC_winbase@h DB 01H
__B4B40122_winioctl@h DB 01H
__86261D59_stralign@h DB 01H
__7B8DBFC3_pmc_uint_internal@h DB 01H
__15109A3D_pmc_clone@c DB 01H
msvcjmc ENDS
PUBLIC Initialize_Clone
PUBLIC PMC_Clone_X
PUBLIC __JustMyCode_Default
EXTRN CheckNumber:PROC
EXTRN DuplicateNumber:PROC
EXTRN _RTC_CheckStackVars:PROC
EXTRN _RTC_InitBase:PROC
EXTRN _RTC_Shutdown:PROC
EXTRN __CheckForDebuggerJustMyCode:PROC
EXTRN number_zero:BYTE
; COMDAT pdata
pdata SEGMENT
$pdata$Initialize_Clone DD imagerel $LN3
DD imagerel $LN3+66
DD imagerel $unwind$Initialize_Clone
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$PMC_Clone_X DD imagerel $LN10
DD imagerel $LN10+266
DD imagerel $unwind$PMC_Clone_X
pdata ENDS
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
_RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
_RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase
rtc$IMZ ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$PMC_Clone_X DD 025052f01H
DD 01132318H
DD 0700c0029H
DD 0500bH
xdata ENDS
; COMDAT CONST
CONST SEGMENT
PMC_Clone_X$rtcName$0 DB 06eH
DB 06fH
DB 00H
ORG $+13
PMC_Clone_X$rtcVarDesc DD 068H
DD 08H
DQ FLAT:PMC_Clone_X$rtcName$0
ORG $+48
PMC_Clone_X$rtcFrameData DD 01H
DD 00H
DQ FLAT:PMC_Clone_X$rtcVarDesc
CONST ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$Initialize_Clone DD 025052a01H
DD 010e2313H
DD 07007001dH
DD 05006H
xdata ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_clone.c
; COMDAT PMC_Clone_X
_TEXT SEGMENT
nx$ = 8
result$ = 36
no$ = 72
x$ = 320
o$ = 328
PMC_Clone_X PROC ; COMDAT
; 38 : {
$LN10:
mov QWORD PTR [rsp+16], rdx
mov QWORD PTR [rsp+8], rcx
push rbp
push rdi
sub rsp, 328 ; 00000148H
lea rbp, QWORD PTR [rsp+32]
mov rdi, rsp
mov ecx, 82 ; 00000052H
mov eax, -858993460 ; ccccccccH
rep stosd
mov rcx, QWORD PTR [rsp+360]
lea rcx, OFFSET FLAT:__15109A3D_pmc_clone@c
call __CheckForDebuggerJustMyCode
; 39 : if (x == NULL)
cmp QWORD PTR x$[rbp], 0
jne SHORT $LN2@PMC_Clone_
; 40 : return (PMC_STATUS_ARGUMENT_ERROR);
mov eax, -1
jmp $LN1@PMC_Clone_
$LN2@PMC_Clone_:
; 41 : if (o == NULL)
cmp QWORD PTR o$[rbp], 0
jne SHORT $LN3@PMC_Clone_
; 42 : return (PMC_STATUS_ARGUMENT_ERROR);
mov eax, -1
jmp $LN1@PMC_Clone_
$LN3@PMC_Clone_:
; 43 : NUMBER_HEADER* nx = (NUMBER_HEADER*)x;
mov rax, QWORD PTR x$[rbp]
mov QWORD PTR nx$[rbp], rax
; 44 : PMC_STATUS_CODE result;
; 45 : if ((result = CheckNumber(nx)) != PMC_STATUS_OK)
mov rcx, QWORD PTR nx$[rbp]
call CheckNumber
mov DWORD PTR result$[rbp], eax
cmp DWORD PTR result$[rbp], 0
je SHORT $LN4@PMC_Clone_
; 46 : return (result);
mov eax, DWORD PTR result$[rbp]
jmp SHORT $LN1@PMC_Clone_
$LN4@PMC_Clone_:
; 47 : NUMBER_HEADER* no;
; 48 : if (nx->IS_ZERO)
mov rax, QWORD PTR nx$[rbp]
mov eax, DWORD PTR [rax+40]
shr eax, 1
and eax, 1
test eax, eax
je SHORT $LN5@PMC_Clone_
; 49 : no = &number_zero;
lea rax, OFFSET FLAT:number_zero
mov QWORD PTR no$[rbp], rax
jmp SHORT $LN6@PMC_Clone_
$LN5@PMC_Clone_:
; 50 : else
; 51 : {
; 52 : if ((result = DuplicateNumber(nx, &no)) != PMC_STATUS_OK)
lea rdx, QWORD PTR no$[rbp]
mov rcx, QWORD PTR nx$[rbp]
call DuplicateNumber
mov DWORD PTR result$[rbp], eax
cmp DWORD PTR result$[rbp], 0
je SHORT $LN7@PMC_Clone_
; 53 : return (result);
mov eax, DWORD PTR result$[rbp]
jmp SHORT $LN1@PMC_Clone_
$LN7@PMC_Clone_:
$LN6@PMC_Clone_:
; 54 : }
; 55 : *o = no;
mov rax, QWORD PTR o$[rbp]
mov rcx, QWORD PTR no$[rbp]
mov QWORD PTR [rax], rcx
; 56 : #ifdef _DEBUG
; 57 : if ((result = CheckNumber(*o)) != PMC_STATUS_OK)
mov rax, QWORD PTR o$[rbp]
mov rcx, QWORD PTR [rax]
call CheckNumber
mov DWORD PTR result$[rbp], eax
cmp DWORD PTR result$[rbp], 0
je SHORT $LN8@PMC_Clone_
; 58 : return (result);
mov eax, DWORD PTR result$[rbp]
jmp SHORT $LN1@PMC_Clone_
$LN8@PMC_Clone_:
; 59 : #endif
; 60 : return (PMC_STATUS_OK);
xor eax, eax
$LN1@PMC_Clone_:
; 61 : }
mov rdi, rax
lea rcx, QWORD PTR [rbp-32]
lea rdx, OFFSET FLAT:PMC_Clone_X$rtcFrameData
call _RTC_CheckStackVars
mov rax, rdi
lea rsp, QWORD PTR [rbp+296]
pop rdi
pop rbp
ret 0
PMC_Clone_X ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_clone.c
; COMDAT Initialize_Clone
_TEXT SEGMENT
feature$ = 224
Initialize_Clone PROC ; COMDAT
; 64 : {
$LN3:
mov QWORD PTR [rsp+8], rcx
push rbp
push rdi
sub rsp, 232 ; 000000e8H
lea rbp, QWORD PTR [rsp+32]
mov rdi, rsp
mov ecx, 58 ; 0000003aH
mov eax, -858993460 ; ccccccccH
rep stosd
mov rcx, QWORD PTR [rsp+264]
lea rcx, OFFSET FLAT:__15109A3D_pmc_clone@c
call __CheckForDebuggerJustMyCode
; 65 : return (PMC_STATUS_OK);
xor eax, eax
; 66 : }
lea rsp, QWORD PTR [rbp+200]
pop rdi
pop rbp
ret 0
Initialize_Clone ENDP
_TEXT ENDS
END
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/remquo.asm | meesokim/z88dk | 0 | 242792 | <reponame>meesokim/z88dk
SECTION code_fp_math48
PUBLIC _remquo
EXTERN cm48_sdcciy_remquo
defc _remquo = cm48_sdcciy_remquo
|
oeis/288/A288311.asm | neoneye/loda-programs | 11 | 167543 | ; A288311: Number of steps, reduced mod n, to reach 1 in the Collatz 3x+1 problem, or -1 if 1 is never reached.
; Submitted by <NAME>
; 0,1,1,2,0,2,2,3,1,6,3,9,9,3,2,4,12,2,1,7,7,15,15,10,23,10,3,18,18,18,13,5,26,13,13,21,21,21,34,8,27,8,29,16,16,16,10,11,24,24,24,11,11,4,2,19,32,19,32,19,19,45,44,6,27,27,27,14,14,14,31,22
mov $2,$0
seq $0,6577 ; Number of halving and tripling steps to reach 1 in '3x+1' problem, or -1 if 1 is never reached.
add $2,1
mod $0,$2
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tpobmu.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 30800 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S . --
-- M U L T I P R O C E S S O R S --
-- B o d y --
-- --
-- Copyright (C) 2010-2020, 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 3, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
package body System.Tasking.Protected_Objects.Multiprocessors is
------------
-- Served --
------------
procedure Served (Entry_Call : Entry_Call_Link) is
pragma Unreferenced (Entry_Call);
begin
pragma Assert (False, "Invalid operation");
end Served;
-------------------------
-- Wakeup_Served_Entry --
-------------------------
procedure Wakeup_Served_Entry is
begin
pragma Assert (False, "Invalid operation");
end Wakeup_Served_Entry;
end System.Tasking.Protected_Objects.Multiprocessors;
|
alloy4fun_models/trashltl/models/7/5SscT9prQa65j4HjX.als | Kaixi26/org.alloytools.alloy | 0 | 523 | open main
pred id5SscT9prQa65j4HjX_prop8 {
some link implies eventually link.File in Trash
}
pred __repair { id5SscT9prQa65j4HjX_prop8 }
check __repair { id5SscT9prQa65j4HjX_prop8 <=> prop8o } |
programs/oeis/045/A045767.asm | neoneye/loda | 22 | 96999 | ; A045767: Number of prime factors of triple factorials n!!! (A007661), with multiplicity.
; 0,1,1,2,2,3,3,5,5,5,6,8,6,8,10,10,9,13,11,12,15,13,13,19,15,15,22,18,16,25,19,21,27,21,23,31,22,25,33,26,26,36,27,29,39,29,30,44,31,33,46,34,34,50,36,38,52,38,39,56,39,41,59,45,43,62,46,46,64,49,47,69,50,49,72,53,51,75,54,56,79,56,57,83,58,59,85,62,60,89,64,63,91,66,65,97,67,68,100,71
lpb $0
mov $2,$0
trn $0,3
seq $2,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)).
add $1,$2
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_430.asm | ljhsiun2/medusa | 9 | 17178 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_430.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x11f17, %rsi
lea addresses_WT_ht+0xca97, %rdi
nop
nop
sub %r9, %r9
mov $47, %rcx
rep movsw
nop
xor %r14, %r14
lea addresses_WT_ht+0xf1cc, %rsi
lea addresses_WT_ht+0x14517, %rdi
inc %r9
mov $13, %rcx
rep movsb
nop
nop
nop
sub $44045, %rcx
lea addresses_normal_ht+0x4517, %rsi
lea addresses_A_ht+0x6117, %rdi
nop
nop
xor $3074, %r13
mov $13, %rcx
rep movsb
nop
cmp %r9, %r9
lea addresses_WT_ht+0x13497, %rsi
lea addresses_WT_ht+0x1917, %rdi
nop
sub $37798, %r10
mov $52, %rcx
rep movsw
nop
sub %r14, %r14
lea addresses_A_ht+0x1ce27, %r14
clflush (%r14)
nop
nop
nop
xor %r13, %r13
movw $0x6162, (%r14)
nop
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %r9
push %rbx
push %rdx
// Store
lea addresses_normal+0x32f9, %r14
nop
dec %r10
mov $0x5152535455565758, %rbx
movq %rbx, (%r14)
nop
nop
xor %r10, %r10
// Faulty Load
lea addresses_PSE+0x10517, %r12
dec %r11
vmovups (%r12), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r9
lea oracles, %r10
and $0xff, %r9
shlq $12, %r9
mov (%r10,%r9,1), %r9
pop %rdx
pop %rbx
pop %r9
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
programs/oeis/189/A189573.asm | jmorken/loda | 1 | 5365 | <reponame>jmorken/loda<gh_stars>1-10
; A189573: Positions of 0 in A189572; complement of A080652 (conjectured).
; 1,3,4,6,8,10,11,13,15,16,18,20,21,23,25,27,28,30,32,33,35,37,39,40,42,44,45,47,49,51,52,54,56,57,59,61,62,64,66,68,69,71,73,74,76,78,80,81,83,85,86,88,90,91,93,95,97,98,100,102,103,105,107,109,110,112,114,115,117
mov $1,$0
mov $2,$0
mov $5,$0
lpb $2
lpb $0
sub $0,1
add $4,$5
lpe
lpb $4
add $1,1
mov $2,$0
add $3,4
trn $4,$3
lpe
lpe
add $1,1
|
demos/os/ucosii/stm32f10x/ucosii/uC-CPU/ARM-Cortex-M3/IAR/cpu_a.asm | linghu0060/CmBacktrace | 1,081 | 240439 | ;********************************************************************************************************
; uC/CPU
; CPU CONFIGURATION & PORT LAYER
;
; (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL
;
; All rights reserved. Protected by international copyright laws.
;
; uC/CPU is provided in source form to registered licensees ONLY. It is
; illegal to distribute this source code to any third party unless you receive
; written permission by an authorized Micrium representative. Knowledge of
; the source code may NOT be used to develop a similar product.
;
; Please help us continue to provide the Embedded community with the finest
; software available. Your honesty is greatly appreciated.
;
; You can contact us at www.micrium.com.
;********************************************************************************************************
;********************************************************************************************************
;
; CPU PORT FILE
;
; ARM-Cortex-M3
; IAR C Compiler
;
; Filename : cpu_a.asm
; Version : V1.29.01.00
; Programmer(s) : JJL
;********************************************************************************************************
;********************************************************************************************************
; PUBLIC FUNCTIONS
;********************************************************************************************************
PUBLIC CPU_IntDis
PUBLIC CPU_IntEn
PUBLIC CPU_SR_Save
PUBLIC CPU_SR_Restore
PUBLIC CPU_WaitForInt
PUBLIC CPU_WaitForExcept
PUBLIC CPU_CntLeadZeros
PUBLIC CPU_CntTrailZeros
PUBLIC CPU_RevBits
;********************************************************************************************************
; CODE GENERATION DIRECTIVES
;********************************************************************************************************
RSEG CODE:CODE:NOROOT(2)
THUMB
;$PAGE
;********************************************************************************************************
; DISABLE and ENABLE INTERRUPTS
;
; Description : Disable/Enable interrupts.
;
; Prototypes : void CPU_IntDis(void);
; void CPU_IntEn (void);
;********************************************************************************************************
CPU_IntDis
CPSID I
BX LR
CPU_IntEn
CPSIE I
BX LR
;********************************************************************************************************
; CRITICAL SECTION FUNCTIONS
;
; Description : Disable/Enable interrupts by preserving the state of interrupts. Generally speaking, the
; state of the interrupt disable flag is stored in the local variable 'cpu_sr' & interrupts
; are then disabled ('cpu_sr' is allocated in all functions that need to disable interrupts).
; The previous interrupt state is restored by copying 'cpu_sr' into the CPU's status register.
;
; Prototypes : CPU_SR CPU_SR_Save (void);
; void CPU_SR_Restore(CPU_SR cpu_sr);
;
; Note(s) : (1) These functions are used in general like this :
;
; void Task (void *p_arg)
; {
; CPU_SR_ALLOC(); /* Allocate storage for CPU status register */
; :
; :
; CPU_CRITICAL_ENTER(); /* cpu_sr = CPU_SR_Save(); */
; :
; :
; CPU_CRITICAL_EXIT(); /* CPU_SR_Restore(cpu_sr); */
; :
; }
;********************************************************************************************************
CPU_SR_Save
MRS R0, PRIMASK ; Set prio int mask to mask all (except faults)
CPSID I
BX LR
CPU_SR_Restore ; See Note #2.
MSR PRIMASK, R0
BX LR
;$PAGE
;********************************************************************************************************
; WAIT FOR INTERRUPT
;
; Description : Enters sleep state, which will be exited when an interrupt is received.
;
; Prototypes : void CPU_WaitForInt (void)
;
; Argument(s) : none.
;********************************************************************************************************
CPU_WaitForInt
WFI ; Wait for interrupt
BX LR
;********************************************************************************************************
; WAIT FOR EXCEPTION
;
; Description : Enters sleep state, which will be exited when an exception is received.
;
; Prototypes : void CPU_WaitForExcept (void)
;
; Argument(s) : none.
;********************************************************************************************************
CPU_WaitForExcept
WFE ; Wait for exception
BX LR
;$PAGE
;********************************************************************************************************
; CPU_CntLeadZeros()
; COUNT LEADING ZEROS
;
; Description : Counts the number of contiguous, most-significant, leading zero bits before the
; first binary one bit in a data value.
;
; Prototype : CPU_DATA CPU_CntLeadZeros(CPU_DATA val);
;
; Argument(s) : val Data value to count leading zero bits.
;
; Return(s) : Number of contiguous, most-significant, leading zero bits in 'val'.
;
; Caller(s) : Application.
;
; This function is an INTERNAL CPU module function but MAY be called by application
; function(s).
;
; Note(s) : (1) (a) Supports 32-bit data value size as configured by 'CPU_DATA' (see 'cpu.h
; CPU WORD CONFIGURATION Note #1').
;
; (b) For 32-bit values :
;
; b31 b30 b29 ... b04 b03 b02 b01 b00 # Leading Zeros
; --- --- --- --- --- --- --- --- ---------------
; 1 x x x x x x x 0
; 0 1 x x x x x x 1
; 0 0 1 x x x x x 2
; : : : : : : : : :
; : : : : : : : : :
; 0 0 0 1 x x x x 27
; 0 0 0 0 1 x x x 28
; 0 0 0 0 0 1 x x 29
; 0 0 0 0 0 0 1 x 30
; 0 0 0 0 0 0 0 1 31
; 0 0 0 0 0 0 0 0 32
;
;
; (2) MUST be defined in 'cpu_a.asm' (or 'cpu_c.c') if CPU_CFG_LEAD_ZEROS_ASM_PRESENT is
; #define'd in 'cpu_cfg.h' or 'cpu.h'.
;********************************************************************************************************
CPU_CntLeadZeros
CLZ R0, R0 ; Count leading zeros
BX LR
;$PAGE
;********************************************************************************************************
; CPU_CntTrailZeros()
; COUNT TRAILING ZEROS
;
; Description : Counts the number of contiguous, least-significant, trailing zero bits before the
; first binary one bit in a data value.
;
; Prototype : CPU_DATA CPU_CntTrailZeros(CPU_DATA val);
;
; Argument(s) : val Data value to count trailing zero bits.
;
; Return(s) : Number of contiguous, least-significant, trailing zero bits in 'val'.
;
; Caller(s) : Application.
;
; This function is an INTERNAL CPU module function but MAY be called by application
; function(s).
;
; Note(s) : (1) (a) Supports 32-bit data value size as configured by 'CPU_DATA' (see 'cpu.h
; CPU WORD CONFIGURATION Note #1').
;
; (b) For 32-bit values :
;
; b31 b30 b29 b28 b27 ... b02 b01 b00 # Trailing Zeros
; --- --- --- --- --- --- --- --- ----------------
; x x x x x x x 1 0
; x x x x x x 1 0 1
; x x x x x 1 0 0 2
; : : : : : : : : :
; : : : : : : : : :
; x x x x 1 0 0 0 27
; x x x 1 0 0 0 0 28
; x x 1 0 0 0 0 0 29
; x 1 0 0 0 0 0 0 30
; 1 0 0 0 0 0 0 0 31
; 0 0 0 0 0 0 0 0 32
;
;
; (2) MUST be defined in 'cpu_a.asm' (or 'cpu_c.c') if CPU_CFG_TRAIL_ZEROS_ASM_PRESENT is
; #define'd in 'cpu_cfg.h' or 'cpu.h'.
;********************************************************************************************************
CPU_CntTrailZeros
RBIT R0, R0 ; Reverse bits
CLZ R0, R0 ; Count trailing zeros
BX LR
;$PAGE
;********************************************************************************************************
; CPU_RevBits()
; REVERSE BITS
;
; Description : Reverses the bits in a data value.
;
; Prototypes : CPU_DATA CPU_RevBits(CPU_DATA val);
;
; Argument(s) : val Data value to reverse bits.
;
; Return(s) : Value with all bits in 'val' reversed (see Note #1).
;
; Caller(s) : Application.
;
; This function is an INTERNAL CPU module function but MAY be called by application function(s).
;
; Note(s) : (1) The final, reversed data value for 'val' is such that :
;
; 'val's final bit 0 = 'val's original bit N
; 'val's final bit 1 = 'val's original bit (N - 1)
; 'val's final bit 2 = 'val's original bit (N - 2)
;
; ... ...
;
; 'val's final bit (N - 2) = 'val's original bit 2
; 'val's final bit (N - 1) = 'val's original bit 1
; 'val's final bit N = 'val's original bit 0
;********************************************************************************************************
CPU_RevBits
RBIT R0, R0 ; Reverse bits
BX LR
;$PAGE
;********************************************************************************************************
; CPU ASSEMBLY PORT FILE END
;********************************************************************************************************
END
|
programs/oeis/158/A158326.asm | karttu/loda | 1 | 16102 | <filename>programs/oeis/158/A158326.asm
; A158326: 484n + 1.
; 485,969,1453,1937,2421,2905,3389,3873,4357,4841,5325,5809,6293,6777,7261,7745,8229,8713,9197,9681,10165,10649,11133,11617,12101,12585,13069,13553,14037,14521,15005,15489,15973,16457,16941,17425,17909,18393,18877,19361,19845,20329,20813,21297,21781,22265,22749,23233,23717,24201,24685,25169,25653,26137,26621,27105,27589,28073,28557,29041,29525,30009,30493,30977,31461,31945,32429,32913,33397,33881,34365,34849,35333,35817,36301,36785,37269,37753,38237,38721,39205,39689,40173,40657,41141,41625,42109,42593,43077,43561,44045,44529,45013,45497,45981,46465,46949,47433,47917,48401,48885,49369,49853,50337,50821,51305,51789,52273,52757,53241,53725,54209,54693,55177,55661,56145,56629,57113,57597,58081,58565,59049,59533,60017,60501,60985,61469,61953,62437,62921,63405,63889,64373,64857,65341,65825,66309,66793,67277,67761,68245,68729,69213,69697,70181,70665,71149,71633,72117,72601,73085,73569,74053,74537,75021,75505,75989,76473,76957,77441,77925,78409,78893,79377,79861,80345,80829,81313,81797,82281,82765,83249,83733,84217,84701,85185,85669,86153,86637,87121,87605,88089,88573,89057,89541,90025,90509,90993,91477,91961,92445,92929,93413,93897,94381,94865,95349,95833,96317,96801,97285,97769,98253,98737,99221,99705,100189,100673,101157,101641,102125,102609,103093,103577,104061,104545,105029,105513,105997,106481,106965,107449,107933,108417,108901,109385,109869,110353,110837,111321,111805,112289,112773,113257,113741,114225,114709,115193,115677,116161,116645,117129,117613,118097,118581,119065,119549,120033,120517,121001
mov $1,$0
mul $1,484
add $1,485
|
test/fail/ATPBadConjecture2.agda | asr/eagda | 1 | 13192 | <gh_stars>1-10
-- An ATP conjecture must be used with postulates.
-- This error is detected by TypeChecking.Rules.Decl.
module ATPBadConjecture2 where
data Bool : Set where
false true : Bool
{-# ATP prove Bool #-}
|
test/js/TestList.agda | redfish64/autonomic-agda | 0 | 2372 | open import Common.Prelude
open import TestHarness
open import TestBool using ( not; _∧_ ; _↔_ )
module TestList where
_++_ : ∀ {X} → List X → List X → List X
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
revApp : ∀ {X} → List X → List X → List X
revApp [] ys = ys
revApp (x ∷ xs) ys = revApp xs (x ∷ ys)
reverse : ∀ {X} → List X → List X
reverse xs = revApp xs []
_≟_ : List Bool → List Bool → Bool
[] ≟ [] = true
(x ∷ xs) ≟ (y ∷ ys) = (x ↔ y) ∧ (xs ≟ ys)
_ ≟ - = false
[tt] = true ∷ []
[ff] = false ∷ []
[tt,ff] = true ∷ [ff]
[ff,tt] = false ∷ [tt]
[ff,tt,ff] = false ∷ [tt,ff]
tests : Tests
tests _ = (
assert ([] ≟ []) "[]=[]" ,
assert (not ([tt] ≟ [ff])) "[tt]≠[ff]" ,
assert (([] ++ [tt]) ≟ [tt]) "[]++[tt]=[tt]" ,
assert (([tt] ++ []) ≟ [tt]) "[tt]++[]=[tt]" ,
assert (([tt] ++ [ff]) ≟ [tt,ff]) "[tt]++[ff]=[tt,ff]" ,
assert (([ff,tt] ++ [ff]) ≟ [ff,tt,ff]) "[ff,tt]++[ff]=[ff,tt,ff]" ,
assert (not (([ff] ++ [tt]) ≟ [tt,ff])) "[ff]++[tt]≠[tt,ff]" ,
assert (not (([tt] ++ [tt]) ≟ [tt,ff])) "[tt]++[tt]≠[tt,ff]" ,
assert (reverse [tt,ff] ≟ [ff,tt]) "rev[tt,ff]=[ff,tt]" ,
assert (reverse (reverse [tt,ff]) ≟ [tt,ff]) "rev(rev[tt,ff])=[tt,ff]" ,
assert (not (reverse [tt,ff] ≟ [tt,ff])) "rev[tt,ff]≠[tt,ff]"
)
|
src/nso-types-report_objects.ads | SSOCsoft/Log_Reporter | 0 | 13290 | With
NSO.JSON,
Ada.Finalization,
Ada.Characters.Latin_1,
Ada.Containers.Ordered_Maps,
Ada.Calendar,
Gnoga.Gui.Base,
Gnoga.Gui.Element.Form,
Gnoga.Gui.Element.Common;
Limited with
Report_Form;
Package NSO.Types.Report_Objects is
Function Debug_Action_Event return Gnoga.Gui.Base.Action_Event;
-- The base report-type for NSO reports.
Type Abstract_Report is abstract new Gnoga.Gui.Element.Common.DIV_Type
with record
Drag_Start,
Drag : Gnoga.Gui.Base.Action_Event := Debug_Action_Event;
end record;
-- We *could* use the drag and drag-start callbacks as class-wide functions,
-- but this would mean we would lose the ability to have custom callbacks,
-- as might be used for debugging, and instead treating everything uniformly.
-- Function Get_Drag_Start_Handler(Input : Abstract_Report'Class) return Action_Event;
-- Function Get_Drag_Handler (Input : Abstract_Report'Class) return Action_Event;
-- Class-wide; calls Add_Self, which populates the form-elements to be sent.
procedure Add_to_Form(
Self : in Abstract_Report'Class;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
);
-- Adds the data for the report to the form for submission.
procedure Add_Self(
Self : in Abstract_Report;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
) is abstract;
Function Get_Name(
Self : in Abstract_Report
) return String is abstract with Inline;
-- Generic_Create adds a draggable DIV to the Parent, complete with a
-- standard styling; Populate_DiV is the method which contains the
-- report-speciffic construction.
Generic
Type UI_Report_Div(<>) is new Abstract_Report with private;
with Procedure Populate_Div(
Object : in out UI_Report_Div;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
);
Name : String;
Procedure Generic_Create(Report : in out UI_Report_Div;
Parent : in out Gnoga.Gui.Base.Base_Type'Class;
Content : in String := "";
ID : in String := ""
);
-- Given an Input, presumed to be a JSON Object-type, Object_Filter will
-- return the result analogous to Input[Name]; raises PROGRAM_ERROR when the
-- Input parameter is not an instance of JSON.Object_Object.
Generic
Name : String;
Function Object_Filter(Input : JSON.Instance'Class)
return JSON.Instance'Class;
Generic
Type Element(<>) is private;
with Package Date_Time_Map is new Ada.Containers.Indefinite_Ordered_Maps(
Key_Type => Ada.Calendar.Time,
Element_Type => Element,
others => <>
);
Default : in Element;
Current : in out Date_Time_Map.Cursor;
Result : in out Date_Time_Map.Map;
Report_Name : in String := "";
with Procedure On_Null is null;
with Procedure On_Boolean( Value : in Boolean ) is null;
with Procedure On_String ( Value : in String ) is null;
with Procedure On_Number ( Value : in JSON.Number ) is null;
with procedure On_Array ( Index : Natural; Value : in JSON.Instance'Class ) is null;
with procedure On_Object ( Key : String; Value : in JSON.Instance'Class ) is null;
Function Process_Date_Time(Data : JSON.Instance'Class) return Date_Time_Map.Map;
Package Date_Time_Indexed_Report is
-----------------------------
-- TIME/DATE SUBPROGRAMS --
-----------------------------
Function Time_String(Time : Ada.Calendar.Time:= Ada.Calendar.Clock) return String;
Function Date_String(Time : Ada.Calendar.Time:= Ada.Calendar.Clock) return String;
Type Date_Time_Report is abstract new Abstract_Report with record
Date : Gnoga.Gui.Element.Form.Date_Type;
Time : Gnoga.Gui.Element.Form.Time_Type;
end record;
Procedure Date_Time_Div(
Object : in out Date_Time_Report'Class;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class
);
End Date_Time_Indexed_Report;
Private
-- The Abstract_Form_Entry type is the DIV that is added to the HTML-Form to
-- be submitted to the system; as such, it is tied to the Report-type that
-- generates the data to place in the form for submission.
Type Abstract_Form_Entry(For_Report : not null access constant Abstract_Report'Class)
is abstract new Gnoga.Gui.Element.Common.DIV_Type
with null record;
-- Generic_Form_Entry creates a non-abstract instance of Abstract_Form_Entry
-- from the Report_type/Report, it also has an Index function for wrapping
-- a name in brackets, and a Name function for aiding in uniform naming,
-- lastly
Generic
Type Report_Type is new Abstract_Report with private;
Report : in access constant Report_Type;
Form : in out Gnoga.Gui.Element.Form.Form_Type'Class;
Label : in String;
Package Generic_Form_Entry is
Use Gnoga.Gui.Element.Common;
Type Instance is new Abstract_Form_Entry(For_Report => Report)
with null record;
-- Finalize will add the instance to the Form.
Overriding
Procedure Finalize (Object : in out Instance);
-- -- IA is the access-type of the singlton element Form_Entry.
-- Type IA is Access all Instance;
-- Returns '[' & Input & ']'.
-- Intended for use working with form-parameters.
Function Index( Input : String ) return String with Inline;
-- This function returns the concatenation of:
-- GET_NAME, Indicies, and Index(Input).
-- Example given Indices of "[Date][Time]", an Input of "Item" and a
-- Report.Get_Name of "Steve", the String returned is:
-- "Steve[Date][Time][Item]".
Generic
Indices : String;
Function Name( Input : String ) return String with Inline;
-- This object *IS* the DIV which holds the form-elements to submit.
Form_Entry : Instance;
-- Every entry should have a "trash icon" to allow deletion of the record.
Trash : Constant IMG_Access := new IMG_Type;
-- Components is a generic for facilitating the creation of a set of
-- HTML-Form elements which hold the datum of the record for submitting.
Generic
Type T is new Gnoga.Gui.Element.Form.Form_Element_Type with private;
--Gnoga.Gui.Element.Element_Type with private;
Type A is Access All T;
Length : Positive;
Package Components is
Tuple : Constant Array(1..Length) of A:= (Others => new T);
Procedure Place_Items;
Procedure Set_Attributes;
End Components;
Private
Package Latin_1 renames Ada.Characters.Latin_1;
Left_Bracket : Character renames Latin_1.Left_Square_Bracket; -- [
Right_Bracket : Character renames Latin_1.Right_Square_Bracket; -- ]
Bracket_Divide : Constant String := Right_Bracket & Left_Bracket; -- ][
End Generic_Form_Entry;
-- This Name-Binder ensures that the report's string-value of the name is
-- uniform across the report-package; this is useful for ensuring that the
-- value is consistent across related-but-disconnected items like the
-- form submission parameters.
Generic
Name : String;
Type Report_Type(<>) is new Abstract_Report with private;
Package Name_Binder is
Report_Name : Constant String := Name;
Function Get_Name(Self: Report_Type) return String is
(Report_Name) with Inline;
End Name_Binder;
End NSO.Types.Report_Objects;
|
sk/sfx/B8.asm | Cancer52/flamedriver | 9 | 102013 | <gh_stars>1-10
Sound_B8_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Sound_B8_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cPSG2, Sound_B8_PSG2, $00, $00
; PSG2 Data
Sound_B8_PSG2:
smpsPSGvoice sTone_03
Sound_B8_Loop00:
dc.b nD5, $04, nE5, nFs5
smpsPSGAlterVol $01
smpsAlterPitch $FF
smpsLoop $00, $05, Sound_B8_Loop00
Sound_B8_Loop01:
dc.b nD5, $04, nE5, nFs5
smpsPSGAlterVol $01
smpsAlterPitch $01
smpsLoop $00, $07, Sound_B8_Loop01
smpsStop
; Song seems to not use any FM voices
Sound_B8_Voices:
|
Cubical/HITs/EilenbergMacLane1/Base.agda | Schippmunk/cubical | 0 | 7307 | <reponame>Schippmunk/cubical<gh_stars>0
{-
This file contains:
- The first Eilenberg–Mac Lane type as a HIT
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.EilenbergMacLane1.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.Group.Base
private
variable ℓ : Level
module _ (G : Group {ℓ}) where
open Group G
data EM₁ : Type ℓ where
embase : EM₁
emloop : Carrier → embase ≡ embase
emcomp : (g h : Carrier)
→ PathP (λ j → embase ≡ emloop h j) (emloop g) (emloop (g + h))
-- emsquash : ∀ (x y : EM₁) (p q : x ≡ y) (r s : p ≡ q) → r ≡ s
emsquash : isGroupoid EM₁
{- The comp// constructor fills the square:
emloop (g + h)
[a]— — — >[c]
‖ ^
‖ | emloop h ^
‖ | j |
[a]— — — >[b] ∙ — >
emloop g i
We use this to give another constructor-like construction:
-}
emloop-comp : (g h : Carrier) → emloop (g + h) ≡ emloop g ∙ emloop h
emloop-comp g h i = compPath-unique refl (emloop g) (emloop h)
(emloop (g + h) , emcomp g h)
(emloop g ∙ emloop h , compPath-filler (emloop g) (emloop h)) i .fst
|
programs/oeis/158/A158374.asm | neoneye/loda | 22 | 166752 | <reponame>neoneye/loda
; A158374: 625n - 1.
; 624,1249,1874,2499,3124,3749,4374,4999,5624,6249,6874,7499,8124,8749,9374,9999,10624,11249,11874,12499,13124,13749,14374,14999,15624,16249,16874,17499,18124,18749,19374,19999,20624,21249,21874,22499,23124,23749,24374,24999,25624,26249,26874,27499,28124,28749,29374,29999,30624,31249,31874,32499,33124,33749,34374,34999,35624,36249,36874,37499,38124,38749,39374,39999,40624,41249,41874,42499,43124,43749,44374,44999,45624,46249,46874,47499,48124,48749,49374,49999,50624,51249,51874,52499,53124,53749,54374,54999,55624,56249,56874,57499,58124,58749,59374,59999,60624,61249,61874,62499
mul $0,625
add $0,624
|
branch8_test/branch8_mem_a_test.asm | nealvis/nv_c64_util_test | 0 | 83087 | //////////////////////////////////////////////////////////////////////////////
// branch8_mem_a_test.asm
// Copyright(c) 2021 <NAME>.
// License: MIT. See LICENSE file in root directory.
//////////////////////////////////////////////////////////////////////////////
// This program demonstrates and tests the 8bit branch operations
// in nv_branch8_macs.asm that use a mem addr and accum as operands
// import all nv_c64_util macros and data. The data
// will go in default place
#import "../../nv_c64_util/nv_c64_util_macs_and_data.asm"
//#import "../../nv_c64_util/nv_screen_macs.asm"
//#import "../../nv_c64_util/nv_keyboard_macs.asm"
*=$0800 "BASIC Start"
.byte 0 // first byte should be 0
// location to put a 1 line basic program so we can just
// type run to execute the assembled program.
// will just call assembled program at correct location
// 10 SYS (4096)
// These bytes are a one line basic program that will
// do a sys call to assembly language portion of
// of the program which will be at $1000 or 4096 decimal
// basic line is:
// 10 SYS (4096)
.byte $0E, $08 // Forward address to next basic line
.byte $0A, $00 // this will be line 10 ($0A)
.byte $9E // basic token for SYS
.byte $20, $28, $34, $30, $39, $36, $29 // is " (4096)"
// .byte $20, $28, $32, $33, $38, $34, $29 // is " (2384)" aka $0950
.byte $00, $00, $00 // end of basic program (addr $080E from above)
*=$0820 "Vars"
.const dollar_sign = $24
// program variables
equal_str: .text@" = \$00"
not_equal_str: .text@" != \$00"
greater_equal_str: .text@" >= \$00"
less_than_str: .text@" < \$00"
greater_than_str: .text@" > \$00"
less_equal_str: .text@" <= \$00"
title_str: .text @"BRANCH8 ACCUM\$00" // null terminated string to print
// via the BASIC routine
title_beq8_a_str: .text @"TEST BEQ8 A\$00"
title_beq8_a_far_str: .text @"TEST BEQ8 A FAR\$00"
title_blt8_a_str: .text @"TEST BLT8 A\$00"
title_blt8_a_far_str: .text @"TEST BLT8 A FAR\$00"
title_ble8_a_str: .text @"TEST BLE8 A\$00"
title_ble8_a_far_str: .text @"TEST BLE8 A FAR\$00"
title_bgt8_a_str: .text @"TEST BGT8 A\$00"
title_bgt8_a_far_str: .text @"TEST BGT8 A FAR\$00"
title_bge8_a_str: .text @"TEST BGE8 A\$00"
title_bge8_a_far_str: .text @"TEST BGE8 A FAR\$00"
title_bne8_a_str: .text @"TEST BNE8 A\$00"
title_bne8_a_far_str: .text @"TEST BNE8 A FAR\$00"
opSmall: .byte $05
opBig: .byte $58
opBE: .byte $be
opEF: .byte $ef
opZero: .byte $00
opMax: .byte $ff
opOne: .byte $01
opTwo: .byte $02
opHighOnes: .byte $F0
opLowOnes: .byte $0F
*=$1000 "Main Start"
.var row = 0
nv_screen_print_str(normal_control_str)
nv_screen_clear()
nv_screen_plot_cursor(row++, 22)
nv_screen_print_str(title_str)
.var use_far = false
test_beq8_a(0, use_far)
.eval use_far = true
test_beq8_a(0, use_far)
.eval use_far = false
test_bne8_a(0, use_far)
.eval use_far = true
test_bne8_a(0, use_far)
.eval use_far = false
test_blt8_a(0, use_far)
.eval use_far = true
test_blt8_a(0, use_far)
.eval use_far = false
test_ble8_a(0, use_far)
.eval use_far = true
test_ble8_a(0, use_far)
.eval use_far = false
test_bgt8_a(0, use_far)
.eval use_far = true
test_bgt8_a(0, use_far)
.eval use_far = false
test_bge8_a(0, use_far)
.eval use_far = true
test_bge8_a(0, use_far)
rts
//////////////////////////////////////////////////////////////////////////////
//
.macro test_beq8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_beq8_a_far_str)
}
else
{
nv_screen_print_str(title_beq8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opSmall, opBig, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opBig, opSmall, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opSmall, opSmall, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opTwo, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opOne, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opOne, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opZero, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opZero, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opMax, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opMax, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opMax, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opOne, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opZero, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opHighOnes, opLowOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opLowOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opHighOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_beq8_a(opLowOnes, opLowOnes, use_far, true)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
//
.macro test_bne8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_bne8_a_far_str)
}
else
{
nv_screen_print_str(title_bne8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opSmall, opBig, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opBig, opSmall, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opSmall, opSmall, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opTwo, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opOne, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opOne, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opZero, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opZero, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opMax, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opMax, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opMax, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opOne, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opZero, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opHighOnes, opLowOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opLowOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opHighOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bne8_a(opLowOnes, opLowOnes, use_far, false)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
//
.macro test_blt8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_blt8_a_far_str)
}
else
{
nv_screen_print_str(title_blt8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opSmall, opBig, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opBig, opSmall, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opSmall, opSmall, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opTwo, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opOne, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opOne, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opZero, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opZero, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opMax, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opMax, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opMax, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opOne, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opZero, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opHighOnes, opLowOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opLowOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opHighOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_blt8_a(opLowOnes, opLowOnes, use_far, false)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
//
.macro test_ble8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_ble8_a_far_str)
}
else
{
nv_screen_print_str(title_ble8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opSmall, opBig, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opBig, opSmall, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opSmall, opSmall, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opTwo, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opOne, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opOne, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opZero, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opZero, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opMax, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opMax, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opMax, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opOne, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opZero, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opHighOnes, opLowOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opLowOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opHighOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_ble8_a(opLowOnes, opLowOnes, use_far, true)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
//
.macro test_bgt8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_bgt8_a_far_str)
}
else
{
nv_screen_print_str(title_bgt8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opSmall, opBig, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opBig, opSmall, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opSmall, opSmall, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opTwo, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opOne, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opOne, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opZero, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opZero, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opMax, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opMax, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opMax, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opOne, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opZero, opZero, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opHighOnes, opLowOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opLowOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opHighOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bgt8_a(opLowOnes, opLowOnes, use_far, false)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
//
.macro test_bge8_a(init_row, use_far)
{
.var row = init_row
//////////////////////////////////////////////////////////////////////////
nv_screen_plot_cursor(row++, 0)
.if (use_far)
{
nv_screen_print_str(title_bge8_a_far_str)
}
else
{
nv_screen_print_str(title_bge8_a_str)
}
//////////////////////////////////////////////////////////////////////////
.eval row++
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opSmall, opBig, use_far, false)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opBig, opSmall, use_far, true)
/////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opSmall, opSmall, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opTwo, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opOne, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opOne, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opZero, opMax, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opZero, opOne, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opMax, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opMax, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opMax, opMax, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opOne, opOne, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opZero, opZero, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opHighOnes, opLowOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opLowOnes, opHighOnes, use_far, false)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opHighOnes, opHighOnes, use_far, true)
////////////////////////////
nv_screen_plot_cursor(row++, 0)
print_bge8_a(opLowOnes, opLowOnes, use_far, true)
wait_and_clear_at_row(row, title_str)
}
//////////////////////////////////////////////////////////////////////////////
// Print macros
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either = or != )
// for the relationship of the two butes in memorys. Use nv_beq8_a to do it.
// addr1: is the address of one byte
// addr2: is the address of another byte
.macro print_beq8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_beq8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_beq8_a(addr1, BranchTarget)
}
nv_screen_print_str(not_equal_str)
.if (expect_to_branch)
{ // expected to branch, but didn't branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
nv_screen_print_str(equal_str)
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either != or = )
// for the relationship of the two bytes in memorys. Use nv_bne8 or
// nv_bne8_far to do it.
// addr1: is the address byte1
// addr2: is the address byte2
.macro print_bne8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_bne8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_bne8_a(addr1, BranchTarget)
}
nv_screen_print_str(equal_str)
.if (expect_to_branch)
{ // expected to branch, but didn't branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
nv_screen_print_str(not_equal_str)
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either < or >= )
// for the relationship of the two bytes in memory. Use nv_blt8_a or
// nv_blt8_a_far to do it.
// macro params
// addr1: is the address of byte1
// addr2: is the address of byte2
// use_far: pass true to use the var version of nv_blt
// expect_to_branch: pass true if the expected outcome is
// to branch or false if not. pass/fail
// based on this.
.macro print_blt8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_blt8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_blt8_a(addr1, BranchTarget)
}
nv_screen_print_str(greater_equal_str)
.if (expect_to_branch == true)
{ // expected to branch, but did not branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
nv_screen_print_str(less_than_str)
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either <= or > )
// for the relationship of the two bytes in memory. Use nv_ble8_a or
// nv_ble8_a_far to do it.
// macro params
// addr1: is the address of byte12
// use_far: pass true to use the var version of nv_blt
// expect_to_branch: pass true if the expected outcome is
// to branch or false if not. pass/fail
// based on this.
.macro print_ble8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_ble8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_ble8_a(addr1, BranchTarget)
}
nv_screen_print_str(greater_than_str)
.if (expect_to_branch == true)
{ // expected to branch, but did not branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
nv_screen_print_str(less_equal_str)
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either >= or < )
// for the relationship of the two bytes in memory. Use nv_bge8_a or
// nv_bge8_a_far to do it.
// macro params
// addr1: is the address of byte1
// addr2: is the address of byte2
// use_far: pass true to use the var version of nv_blt
// expect_to_branch: pass true if the expected outcome is
// to branch or false if not. pass/fail
// based on this.
.macro print_bge8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_bge8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_bge8_a(addr1, BranchTarget)
}
nv_screen_print_str(less_than_str)
.if (expect_to_branch == true)
{ // expected to branch, but did not branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
nv_screen_print_str(greater_equal_str)
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
//////////////////////////////////////////////////////////////////////////////
// Print to current screen location the expression (either > or <= )
// for the relationship of the two bytes in memory. Use nv_bgt8 or
// nv_bgt8_far to do it.
// macro params
// addr1: is the address of byte1
// addr2: is the address of byte2
// use_far: pass true to use the var version of nv_blt
// expect_to_branch: pass true if the expected outcome is
// to branch or false if not. pass/fail
// based on this.
.macro print_bgt8_a(addr1, addr2, use_far, expect_to_branch)
{
lda #1
sta passed
lda addr1
jsr PrintHexByteAccum
.if (use_far)
{
lda addr2
nv_bgt8_a_far(addr1, BranchTarget)
}
else
{
lda addr2
nv_bgt8_a(addr1, BranchTarget)
}
nv_screen_print_str(less_equal_str)
.if (expect_to_branch == true)
{ // expected to branch, but did not branch
lda #$00
sta passed
}
jmp Done
.if (use_far)
{
// nops to make sure more than 128 bytes between branch and target label
.var index = 0
.for(index = 0; index < 124; index = index + 1) {nop}
}
BranchTarget:
.if (expect_to_branch == false)
{ // didn't expect to branch, but did branch
lda #$00
sta passed
}
nv_screen_print_str(greater_than_str)
Done:
lda addr2
jsr PrintHexByteAccum
jsr PrintPassed
}
#import "../test_util/test_util_code.asm"
|
alloy4fun_models/trashltl/models/4/GSEWDH6ou9Lur3pNE.als | Kaixi26/org.alloytools.alloy | 0 | 4560 | open main
pred idGSEWDH6ou9Lur3pNE_prop5 {
always eventually #File' < #File || #File' = #File
}
pred __repair { idGSEWDH6ou9Lur3pNE_prop5 }
check __repair { idGSEWDH6ou9Lur3pNE_prop5 <=> prop5o } |
Homework Submission/Homework 5/2.asm | asad-n/CSE331L_Section_7_Summer_2020_NSU | 0 | 88569 | .MODEL SMALL
.STACK 100H
.DATA
DIGIT1 DB 0AH, 0DH, "ENTER FIRST DIGIT: $"
DIGIT2 DB 0AH, 0DH, "ENTER SECOND DIGIT: $"
RESULT DB 0AH, 0DH, "RESULT IS $"
.CODE
MAIN:
MOV AX, @DATA
MOV DS, AX
LEA DX, DIGIT1
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
SUB AL, 30H
MOV BH, AL
MOV AH, 01H
INT 21H
SUB AL, 30H
MOV BL, AL ; BH:BL FIRST NUMBER
LEA DX, DIGIT2
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
SUB AL, 30H
MOV CH, AL
MOV AH, 01H
INT 21H
SUB AL, 30H
MOV CL, AL ; CH:CL SECOND NUMBER
ADD BL, CL
MOV AL, BL
MOV AH, 00H
AAA
MOV CL, AL ; LAST DIGIT OF ANSWER
MOV BL, AH
ADD BL, BH
ADD BL, CH
MOV AL, BL
MOV AH, 00H
AAA
MOV BX, AX
;MOV BH, AH
;MOV BL, AL
MOV DX, OFFSET RESULT
MOV AH, 09H
INT 21H
MOV DL, BH
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, BL
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, CL
ADD DL, 30H
MOV AH, 02H
INT 21H
EXIT:
MOV AH, 04CH
INT 21H
END MAIN |
libsrc/stdio/ansi/z88/f_ansi_cls.asm | grancier/z180 | 0 | 168882 | ;
; f_ansi_cls
;
; Clear the screen
;
; djm 6/6/2000
;
;
; $Id: f_ansi_cls.asm,v 1.6 2016/07/02 10:24:35 dom Exp $
;
SECTION code_clib
PUBLIC ansi_cls
INCLUDE "stdio.def"
.ansi_cls
ld a,$0c
call_oz(os_out)
ret
IF Blah
ld hl,clstxt
call_oz(gn_sop)
ret
.clstxt
defb 1,'3','@',32,32,1,'2','C',254,0
ENDIF
|
programs/oeis/219/A219113.asm | neoneye/loda | 22 | 240546 | ; A219113: Sequence of integers which are simultaneously a sum of consecutive squares and a difference of consecutive cubes.
; 1,61,5941,582121,57041881,5589522181,547716131821,53670591396241,5259170240699761,515345012997180301,50498552103482969701,4948342761128333850361,484887092038473234365641,47513986677009248633982421,4655885807254867892895911581
seq $0,138288 ; a(n) = A054320(n) - A001078(n).
pow $0,2
div $0,80
mul $0,60
add $0,1
|
oeis/081/A081209.asm | neoneye/loda-programs | 11 | 80765 | <gh_stars>10-100
; A081209: a(n) = Sum_{k=0..n} (-1)^(n-k)*n^k.
; 1,0,3,20,205,2604,39991,720600,14913081,348678440,9090909091,261535698060,8230246567621,281241170407092,10371206370520815,410525522232055664,17361641481138401521,781282469559318055056,37275544492386193492507,1879498672877297909667780,99864380952380952380952381,5577014881186619679500164220,326583187044036098379401213863,20010448499854249032923573205960,1280386345776272759471118213930025,85401771125012041571048589853140024,5928115151310595928915315981422418451
mov $1,$0
add $1,1
pow $0,$1
div $0,$1
mod $1,2
add $0,$1
|
Library/Chart/Legend/legendManager.asm | steakknife/pcgeos | 504 | 18339 | <filename>Library/Chart/Legend/legendManager.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: legendManager.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 6/10/92 Initial version.
DESCRIPTION:
$Id: legendManager.asm,v 1.1 97/04/04 17:46:31 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include chartGeode.def
ChartClassStructures segment resource
LegendClass
LegendPairClass
LegendItemClass
method LegendItemRealize, LegendItemClass, MSG_CHART_OBJECT_REALIZE
method LegendRealize, LegendClass, MSG_CHART_OBJECT_REALIZE
ChartClassStructures ends
ChartMiscCode segment resource
include legendAttrs.asm
include legendBuild.asm
include legendGeometry.asm
include legendSelect.asm
include legendPair.asm
include legendItem.asm
ChartMiscCode ends
|
projects/08/ProgramFlow/BasicLoop/BasicLoop.asm | l-const/nand2tetris | 0 | 28843 |
//push constant 0
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
//pop local 0
@0
D=A
@1
A=D+M
D=A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
//label LOOP_START
(BasicLoop.$LOOP_START)
//push argument 0
@0
D=A
@2
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
//push local 0
@0
D=A
@1
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
//add
@SP
AM=M-1
D=M
A=A-1
M=M+D
//pop local 0
@0
D=A
@1
A=D+M
D=A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
//push argument 0
@0
D=A
@2
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
//push constant 1
@1
D=A
@SP
A=M
M=D
@SP
M=M+1
//sub
@SP
AM=M-1
D=M
A=A-1
M=M-D
//pop argument 0
@0
D=A
@2
A=D+M
D=A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
//push argument 0
@0
D=A
@2
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1
//if-goto LOOP_START
@SP
AM=M-1
D=M
@BasicLoop.$LOOP_START
D;JNE
//push local 0
@0
D=A
@1
A=D+M
D=M
@SP
A=M
M=D
@SP
M=M+1 |
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_580.asm | ljhsiun2/medusa | 9 | 177248 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %rax
push %rbx
push %rdi
push %rsi
// Store
lea addresses_UC+0xc42a, %rsi
clflush (%rsi)
nop
cmp $53634, %rdi
mov $0x5152535455565758, %rbx
movq %rbx, (%rsi)
nop
nop
nop
nop
cmp $50545, %rdi
// Load
mov $0x4fe8cd000000074a, %r10
nop
nop
nop
nop
xor $62627, %rbx
mov (%r10), %esi
nop
nop
add $52404, %rdi
// Store
mov $0x408, %rsi
nop
nop
and %rbx, %rbx
movw $0x5152, (%rsi)
and %r11, %r11
// Store
lea addresses_A+0x602a, %rdi
nop
nop
add $5477, %rax
mov $0x5152535455565758, %rsi
movq %rsi, (%rdi)
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_D+0x5c2a, %rsi
nop
nop
nop
nop
nop
sub %rdi, %rdi
mov (%rsi), %r10d
lea oracles, %rdi
and $0xff, %r10
shlq $12, %r10
mov (%rdi,%r10,1), %r10
pop %rsi
pop %rdi
pop %rbx
pop %rax
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': True, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
projects/batfish/src/main/antlr4/org/batfish/grammar/flatvyos/FlatVyosLexer.g4 | jeffkala/batfish | 0 | 667 | lexer grammar FlatVyosLexer;
options {
superClass = 'org.batfish.grammar.BatfishLexer';
}
@members {
boolean enableIPV6_ADDRESS = true;
boolean enableIP_ADDRESS = true;
boolean enableDEC = true;
@Override
public String printStateVariables() {
StringBuilder sb = new StringBuilder();
sb.append("enableIPV6_ADDRESS: " + enableIPV6_ADDRESS + "\n");
sb.append("enableIP_ADDRESS: " + enableIP_ADDRESS + "\n");
sb.append("enableDEC: " + enableDEC + "\n");
return sb.toString();
}
}
tokens {
DESCRIPTION_TEXT,
ISO_ADDRESS,
PIPE
}
// Keywords
ACCEPT: 'accept';
ACCEPT_DATA: 'accept-data';
ACCESS: 'access';
ACCESS_PROFILE: 'access-profile';
ACCOUNTING: 'accounting';
ACTION: 'action';
ACTIVE: 'active';
ADD: 'add';
ADD_PATH: 'add-path';
ADDRESS: 'address';
ADDRESS_BOOK: 'address-book';
ADDRESS_MASK: 'address-mask';
ADDRESS_SET: 'address-set';
ADVERTISE_INACTIVE: 'advertise-inactive';
ADVERTISE_INTERVAL: 'advertise-interval';
ADVERTISE_PEER_AS: 'advertise-peer-as';
AES128: 'aes128';
AES256: 'aes256';
AFS: 'afs';
AGGREGATE: 'aggregate';
AGGREGATED_ETHER_OPTIONS: 'aggregated-ether-options';
AGGRESSIVE: 'aggressive';
AES_128_CBC: 'aes-128-cbc';
AES_192_CBC: 'aes-192-cbc';
AES_256_CBC: 'aes-256-cbc';
AH: 'ah';
ALG: 'alg';
ALIAS: 'alias';
ALL: 'all';
ALLOW: 'allow';
ALWAYS_COMPARE_MED: 'always-compare-med';
ALWAYS_SEND: 'always-send';
ANY: 'any';
ANY_IPV4: 'any-ipv4';
ANY_IPV6: 'any-ipv6';
ANY_REMOTE_HOST: 'any-remote-host';
ANY_SERVICE: 'any-service';
APPLICATION: 'application';
APPLICATION_PROTOCOL: 'application-protocol';
APPLICATION_TRACKING: 'application-tracking';
APPLICATIONS: 'applications';
AREA: 'area';
AREA_RANGE: 'area-range';
ARP: 'arp';
ARP_RESP: 'arp-resp';
AS_OVERRIDE: 'as-override';
AS_PATH: 'as-path';
AS_PATH_EXPAND: 'as-path-expand';
AS_PATH_PREPEND: 'as-path-prepend';
ASCII_TEXT: 'ascii-text';
AUTHENTICATION: 'authentication';
AUTHENTICATION_ALGORITHM: 'authentication-algorithm';
AUTHENTICATION_KEY: 'authentication-key';
AUTHENTICATION_METHOD: 'authentication-method';
AUTHENTICATION_ORDER: 'authentication-order';
AUTO_UPDATE: 'auto-update';
AUTONOMOUS_SYSTEM: 'autonomous-system';
AUTHENTICATION_TYPE: 'authentication-type';
AUTO: 'auto';
AUTO_EXPORT: 'auto-export';
AUTO_NEGOTIATION: 'auto-negotiation';
BACKUP_ROUTER: 'backup-router';
BANDWIDTH: 'bandwidth';
BASIC: 'basic';
BFD: 'bfd';
BFD_LIVENESS_DETECTION: 'bfd-liveness-detection';
BGP: 'bgp';
BIFF: 'biff';
BIND: 'bind';
BLACKHOLE: 'blackhole';
BMP: 'bmp';
BONDING: 'bonding';
BOOTPC: 'bootpc';
BOOTPS: 'bootps';
BRIDGE: 'bridge';
BRIDGE_DOMAINS: 'bridge-domains';
CCC: 'ccc';
CERTIFICATES: 'certificates';
CHASSIS: 'chassis';
CLASS: 'class';
CLASS_OF_SERVICE: 'class-of-service';
CLEAR: 'clear';
CLUSTER: 'cluster';
CMD: 'cmd';
COLOR: 'color';
COLOR2: 'color2';
COMMIT: 'commit';
COMMUNITY
:
'community'
{
enableIPV6_ADDRESS = false;
}
;
COMPATIBLE: 'compatible';
COMPRESSION: 'compression';
CONFIG_MANAGEMENT: 'config-management';
CONDITION: 'condition';
CONNECTION_TYPE: 'connection-type';
CONNECTIONS: 'connections';
CONNECTIONS_LIMIT: 'connections-limit';
CONSOLE: 'console';
COS_NEXT_HOP_MAP: 'cos-next-hop-map';
COUNT: 'count';
CREDIBILITY_PROTOCOL_PREFERENCE: 'credibility-protocol-preference';
CVSPSERVER: 'cvspserver';
DAMPING: 'damping';
DDOS_PROTECTION: 'ddos-protection';
DEACTIVATE: 'deactivate';
DEAD_INTERVAL: 'dead-interval';
DEAD_PEER_DETECTION: 'dead-peer-detection';
DEFAULT_ACTION: 'default-action';
DEFAULT_ADDRESS_SELECTION: 'default-address-selection';
DEFAULT_LSA: 'default-lsa';
DEFAULT_METRIC: 'default-metric';
DEFAULT_POLICY: 'default-policy';
DEFAULTS: 'defaults';
DELETE: 'delete';
DENY: 'deny';
DENY_ALL: 'deny-all';
DES_CBC: 'des-cbc';
DESCRIPTION
:
'description' -> pushMode ( M_Description )
;
DESTINATION_ADDRESS: 'destination-address';
DESTINATION_HOST_UNKNOWN: 'destination-host-unknown';
DESTINATION_IP: 'destination-ip';
DESTINATION_NETWORK_UNKNOWN: 'destination-network-unknown';
DESTINATION_PORT: 'destination-port';
DESTINATION_PORT_EXCEPT: 'destination-port-except';
DESTINATION_PREFIX_LIST: 'destination-prefix-list';
DESTINATION_UNREACHABLE: 'destination-unreachable';
DF_BIT: 'df-bit';
DH_GROUP: 'dh-group';
DH_GROUP2: 'dh-group2';
DH_GROUP5: 'dh-group5';
DH_GROUP14: 'dh-group14';
DH_GROUP15: 'dh-group15';
DH_GROUP16: 'dh-group16';
DH_GROUP17: 'dh-group17';
DH_GROUP18: 'dh-group18';
DH_GROUP19: 'dh-group19';
DH_GROUP20: 'dh-group20';
DH_GROUP21: 'dh-group21';
DH_GROUP22: 'dh-group22';
DH_GROUP23: 'dh-group23';
DH_GROUP24: 'dh-group24';
DH_GROUP25: 'dh-group25';
DH_GROUP26: 'dh-group26';
DHCP: 'dhcp';
DIRECT: 'direct';
DISABLE: 'disable';
DISABLE_4BYTE_AS: 'disable-4byte-as';
DISCARD: 'discard';
DISTANCE: 'distance';
DNS: 'dns';
DOMAIN: 'domain';
DOMAIN_NAME: 'domain-name';
DOMAIN_SEARCH: 'domain-search';
DSA_SIGNATURES: 'dsa-signatures';
DSCP: 'dscp';
DSTOPTS: 'dstopts';
DUMMY: 'dummy';
DUMPONPANIC: 'dump-on-panic';
DUPLEX: 'duplex';
DVMRP: 'dvmrp';
DYNAMIC: 'dynamic';
ECHO_REPLY: 'echo-reply';
ECHO_REQUEST: 'echo-request';
EGP: 'egp';
EIGHT02_3AD
:
'802.3ad'
;
EKLOGIN: 'eklogin';
EKSHELL: 'ekshell';
ENABLE: 'enable';
ENCAPSULATION: 'encapsulation';
ENCRYPTION: 'encryption';
ENCRYPTION_ALGORITHM: 'encryption-algorithm';
ESP: 'esp';
ESP_GROUP: 'esp-group';
ESTABLISH_TUNNELS: 'establish-tunnels';
ETHER_OPTIONS: 'ether-options';
ETHERNET: 'ethernet';
ETHERNET_SWITCHING: 'ethernet-switching';
ETHERNET_SWITCHING_OPTIONS: 'ethernet-switching-options';
EVENT_OPTIONS: 'event-options';
EXACT: 'exact';
EXCEPT: 'except';
EXEC: 'exec';
EXP: 'exp';
EXPORT: 'export';
EXPORT_RIB: 'export-rib';
EXPRESSION: 'expression';
EXTERNAL: 'external';
EXTERNAL_PREFERENCE: 'external-preference';
FABRIC_OPTIONS: 'fabric-options';
FAIL_FILTER: 'fail-filter';
FAMILY: 'family';
FASTETHER_OPTIONS: 'fastether-options';
FILE: 'file';
FILTER: 'filter';
FINGER: 'finger';
FIREWALL: 'firewall';
FIRST_FRAGMENT: 'first-fragment';
FLEXIBLE_VLAN_TAGGING: 'flexible-vlan-tagging';
FLOW: 'flow';
FLOW_ACCOUNTING: 'flow-accounting';
FLOW_CONTROL: 'flow-control';
FORWARDING: 'forwarding';
FORWARDING_CLASS: 'forwarding-class';
FORWARDING_OPTIONS: 'forwarding-options';
FORWARDING_TABLE: 'forwarding-table';
FRAGMENT: 'fragment';
FRAGMENTATION_NEEDED: 'fragmentation-needed';
FRAMING: 'framing';
FROM: 'from';
FROM_ZONE: 'from-zone';
FTP: 'ftp';
FTP_DATA: 'ftp-data';
FULL_DUPLEX: 'full-duplex';
G: 'g';
GATEWAY: 'gateway';
GE: 'ge';
GENERATE: 'generate';
GIGETHER_OPTIONS: 'gigether-options';
GRACEFUL_RESTART: 'graceful-restart';
GRE: 'gre';
GROUP: 'group';
GROUP_IKE_ID: 'group-ike-id';
GROUP1: 'group1';
GROUP14: 'group14';
GROUP2: 'group2';
GROUP5: 'group5';
GROUPS: 'groups';
HASH: 'hash';
HELLO_AUTHENTICATION_KEY: 'hello-authentication-key';
HELLO_AUTHENTICATION_TYPE: 'hello-authentication-type';
HELLO_INTERVAL: 'hello-interval';
HELLO_PADDING: 'hello-padding';
HIGH: 'high';
HMAC_MD5_96: 'hmac-md5-96';
HMAC_SHA1_96: 'hmac-sha1-96';
HOLD_TIME: 'hold-time';
HOP_BY_HOP: 'hop-by-hop';
HOST: 'host';
HOST_INBOUND_TRAFFIC: 'host-inbound-traffic';
HOST_NAME: 'host-name';
HOST_UNREACHABLE: 'host-unreachable';
HOSTNAME: 'hostname';
HTTP: 'http';
HTTPS: 'https';
HW_ID: 'hw-id';
ICMP: 'icmp';
ICMP_CODE: 'icmp-code';
ICMP_TYPE: 'icmp-type';
ICMP6: 'icmp6';
ICMP6_CODE: 'icmp6-code';
ICMP6_TYPE: 'icmp6-type';
ICMPV6: 'icmpv6';
ID: 'id';
IDENT: 'ident';
IDENT_RESET: 'ident-reset';
IGMP: 'igmp';
IGMP_SNOOPING: 'igmp-snooping';
IGNORE: 'ignore';
IGNORE_L3_INCOMPLETES: 'ignore-l3-incompletes';
IGP: 'igp';
IKE: 'ike';
IKE_ESP_NAT: 'ike-esp-nat';
IKE_GROUP: 'ike-group';
IKE_POLICY: 'ike-policy';
IKE_USER_TYPE: 'ike-user-type';
IKEV1: 'ikev1';
IKEV2: 'ikev2';
IKEV2_REAUTH: 'ikev2-reauth';
IMAP: 'imap';
IMMEDIATELY: 'immediately';
IMPORT: 'import';
IMPORT_POLICY: 'import-policy';
IMPORT_RIB: 'import-rib';
INACTIVE: 'inactive';
INACTIVITY_TIMEOUT: 'inactivity-timeout';
INCLUDE_MP_NEXT_HOP: 'include-mp-next-hop';
INCOMPLETE: 'incomplete';
INET: 'inet';
INET6: 'inet6';
INET_MDT: 'inet-mdt';
INET_MVPN: 'inet-mvpn';
INET_VPN: 'inet-vpn';
INET6_VPN: 'inet6-vpn';
INITIATE: 'initiate';
INNER: 'inner';
INPUT: 'input';
INPUT_LIST: 'input-list';
INPUT_VLAN_MAP: 'input-vlan-map';
INSTALL: 'install';
INSTALL_NEXTHOP: 'install-nexthop';
INSTANCE: 'instance';
INSTANCE_TYPE: 'instance-type';
INTERFACE: 'interface';
INTERFACE_MODE: 'interface-mode';
INTERFACE_SPECIFIC: 'interface-specific';
INTERFACE_SWITCH: 'interface-switch';
INTERFACE_TRANSMIT_STATISTICS: 'interface-transmit-statistics';
INTERFACES: 'interfaces';
INTERFACE_ROUTES: 'interface-routes';
INTERFACE_TYPE: 'interface-type';
INTERNAL: 'internal';
INTERNET_OPTIONS: 'internet-options';
IP: 'ip';
IP_OPTIONS: 'ip-options';
IPIP: 'ipip';
IPSEC: 'ipsec';
IPSEC_INTERFACES: 'ipsec-interfaces';
IPSEC_POLICY: 'ipsec-policy';
IPSEC_VPN: 'ipsec-vpn';
IPV6: 'ipv6';
IS_FRAGMENT: 'is-fragment';
ISIS: 'isis';
ISO
:
'iso' -> pushMode ( M_ISO )
;
KEEP: 'keep';
KERBEROS_SEC: 'kerberos-sec';
KEY_EXCHANGE: 'key-exchange';
KEYS: 'keys';
KLOGIN: 'klogin';
KPASSWD: '<PASSWORD>';
KRB_PROP: 'krb-prop';
KRBUPDATE: 'krbupdate';
KSHELL: 'kshell';
L: 'L';
L2CIRCUIT: 'l2circuit';
L2TPV3: 'l2tpv3';
L2VPN: 'l2vpn';
L3_INTERFACE: 'l3-interface';
LABEL_SWITCHED_PATH: 'label-switched-path';
LABELED_UNICAST: 'labeled-unicast';
LACP: 'lacp';
LAN: 'lan';
LAST_AS: 'last-as';
LDP_SYNCHRONIZATION: 'ldp-synchronization';
LICENSE: 'license';
LINK_MODE: 'link-mode';
LDAP: 'ldap';
LDP: 'ldp';
LE: 'le';
LEARN_VLAN_1P_PRIORITY: 'learn-vlan-1p-priority';
LEVEL: 'level';
LIFETIME: 'lifetime';
LIFETIME_KILOBYTES: 'lifetime-kilobytes';
LIFETIME_SECONDS: 'lifetime-seconds';
LINK_PROTECTION: 'link-protection';
LLDP: 'lldp';
LLDP_MED: 'lldp-med';
LOAD_BALANCE: 'load-balance';
LOCAL: 'local';
LOCAL_ADDRESS: 'local-address';
LOCAL_AS: 'local-as';
LOCAL_IDENTITY: 'local-identity';
LOCAL_PREFERENCE: 'local-preference';
LOCATION: 'location';
LOG: 'log';
LOG_UPDOWN: 'log-updown';
LOGICAL_SYSTEMS: 'logical-systems';
LOGIN: 'login';
LONGER: 'longer';
LOOPBACK: 'loopback';
LOOPS: 'loops';
LOSS_PRIORITY: 'loss-priority';
LOW: 'low';
LSP: 'lsp';
LSP_EQUAL_COST: 'lsp-equal-cost';
LSP_INTERVAL: 'lsp-interval';
LSP_LIFETIME: 'lsp-lifetime';
LSPING: 'lsping';
M: 'm';
MAC
:
'mac' -> pushMode ( M_MacAddress )
;
MAIN: 'main';
MAPPED_PORT: 'mapped-port';
MARTIANS: 'martians';
MASTER_ONLY: 'master-only';
MATCH: 'match';
MAX_CONFIGURATIONS_ON_FLASH: 'max-configurations-on-flash';
MAX_CONFIGURATION_ROLLBACKS: 'max-configuration-rollbacks';
MAX_SESSION_NUMBER: 'max-session-number';
MAXIMUM_LABELS: 'maximum-labels';
MD5: 'md5';
MEDIUM_HIGH: 'medium-high';
MEDIUM_LOW: 'medium-low';
MEMBERS: 'members';
METRIC: 'metric';
METRIC2: 'metric2';
METRIC_OUT: 'metric-out';
METRIC_TYPE: 'metric-type';
MGCP_CA: 'mgcp-ca';
MGCP_UA: 'mgcp-ua';
MS_RPC: 'ms-rpc';
MLD: 'mld';
MOBILEIP_AGENT: 'mobileip-agent';
MOBILIP_MN: 'mobilip-mn';
MODE: 'mode';
MPLS: 'mpls';
MSDP: 'msdp';
MSTP: 'mstp';
MTU: 'mtu';
MTU_DISCOVERY: 'mtu-discovery';
MULTICAST: 'multicast';
MULTICAST_MAC
:
'multicast-mac' -> pushMode ( M_MacAddress )
;
MULTIHOP: 'multihop';
MULTIPATH: 'multipath';
MULTIPLE_AS: 'multiple-as';
MULTIPLIER: 'multiplier';
MULTISERVICE_OPTIONS: 'multiservice-options';
MVPN: 'mvpn';
NAME_RESOLUTION: 'name-resolution';
NAME_SERVER: 'name-server';
NAT: 'nat';
NATIVE_VLAN_ID: 'native-vlan-id';
NEIGHBOR: 'neighbor';
NEIGHBOR_ADVERTISEMENT: 'neighbor-advertisement';
NEIGHBOR_DISCOVERY: 'neighbor-discovery';
NEIGHBOR_SOLICIT: 'neighbor-solicit';
NETBIOS_DGM: 'netbios-dgm';
NETBIOS_NS: 'netbios-ns';
NETBIOS_SSN: 'netbios-ssn';
NETCONF: 'netconf';
NETWORK_SUMMARY_EXPORT: 'network-summary-export';
NETWORK_UNREACHABLE: 'network-unreachable';
NEVER: 'never';
NEXT: 'next';
NEXT_HEADER: 'next-header';
NEXT_HOP: 'next-hop';
NEXT_TABLE: 'next-table';
NEXTHOP_SELF: 'nexthop-self';
NFSD: 'nfsd';
NHRP: 'nhrp';
NNTP: 'nntp';
NTALK: 'ntalk';
NO_ACTIVE_BACKBONE: 'no-active-backbone';
NO_ADVERTISE: 'no-advertise';
NO_ANTI_REPLAY: 'no-anti-replay';
NO_AUTO_NEGOTIATION: 'no-auto-negotiation';
NO_CLIENT_REFLECT: 'no-client-reflect';
NO_EXPORT: 'no-export';
NO_FLOW_CONTROL: 'no-flow-control';
NO_INSTALL: 'no-install';
NO_IPV4_ROUTING: 'no-ipv4-routing';
NO_NAT_TRAVERSAL: 'no-nat-traversal';
NO_NEIGHBOR_DOWN_NOTIFICATION: 'no-neighbor-down-notification';
NO_NEXTHOP_CHANGE: 'no-nexthop-change';
NO_READVERTISE: 'no-readvertise';
NO_REDIRECTS: 'no-redirects';
NO_RESOLVE: 'no-resolve';
NO_RETAIN: 'no-retain';
NO_NEIGHBOR_LEARN: 'no-neighbor-learn';
NO_TRAPS: 'no-traps';
NONSTOP_ROUTING: 'nonstop-routing';
NSSA: 'nssa';
NTP: 'ntp';
OFF: 'off';
OFFSET: 'offset';
OPENVPN: 'openvpn';
OPTIONS: 'options';
ORIGIN: 'origin';
ORLONGER: 'orlonger';
OSPF: 'ospf';
OSPF3: 'ospf3';
OUT_DELAY: 'out-delay';
OUTPUT: 'output';
OUTPUT_LIST: 'output-list';
OUTPUT_VLAN_MAP: 'output-vlan-map';
OUTER: 'outer';
OVERLOAD: 'overload';
P2P: 'p2p';
PACKAGE: 'package';
PACKET_TOO_BIG: 'packet-too-big';
PARAMETER_PROBLEM: 'parameter-problem';
PASSIVE: 'passive';
PATH: 'path';
PATH_COUNT: 'path-count';
PATH_SELECTION: 'path-selection';
PEER: 'peer';
PEER_ADDRESS: 'peer-address';
PEER_AS: 'peer-as';
PEER_UNIT: 'peer-unit';
PER_PACKET: 'per-packet';
PER__UNIT_SCHEDULER: 'per-unit-scheduler';
PERFECT_FORWARD_SECRECY: 'perfect-forward-secrecy';
PERMIT: 'permit';
PERMIT_ALL: 'permit-all';
PERSISTENT_NAT: 'persistent-nat';
PFS: 'pfs';
PGM: 'pgm';
PIM: 'pim';
PING: 'ping';
POE: 'poe';
POINT_TO_POINT: 'point-to-point';
POLICER: 'policer';
POLICIES: 'policies';
POLICY: 'policy';
POLICY_OPTIONS: 'policy-options';
POLICY_STATEMENT: 'policy-statement';
POLL_INTERVAL: 'poll-interval';
POOL: 'pool';
POP3: 'pop3';
PORT: 'port';
PORTS: 'ports';
PORT_MIRROR: 'port-mirror';
PORT_MODE: 'port-mode';
PORT_OVERLOADING: 'port-overloading';
PORT_OVERLOADING_FACTOR: 'port-overloading-factor';
PORT_RANDOMIZATION: 'port-randomization';
PORT_UNREACHABLE: 'port-unreachable';
PPM: 'ppm';
PPTP: 'pptp';
PRE_SHARED_KEY: 'pre-shared-key';
PRE_SHARED_KEYS: 'pre-shared-keys';
PRE_SHARED_SECRET: 'pre-shared-secret';
PRECEDENCE: 'precedence';
PRECISION_TIMERS: 'precision-timers';
PREEMPT: 'preempt';
PREFERENCE: 'preference';
PREFERRED: 'preferred';
PREFIX: 'prefix';
PREFIX_EXPORT_LIMIT: 'prefix-export-limit';
PREFIX_LENGTH_RANGE: 'prefix-length-range';
PREFIX_LIMIT: 'prefix-limit';
PREFIX_LIST: 'prefix-list';
PREFIX_LIST_FILTER: 'prefix-list-filter';
PREFIX_POLICY: 'prefix-policy';
PRIMARY: 'primary';
PRINTER: 'printer';
PRIORITY: 'priority';
PRIORITY_COST: 'priority-cost';
PRIVATE: 'private';
PROCESSES: 'processes';
PROPOSAL: 'proposal';
PROPOSAL_SET: 'proposal-set';
PROPOSALS: 'proposals';
PROTOCOL: 'protocol';
PROTOCOLS: 'protocols';
PROVIDER_TUNNEL: 'provider-tunnel';
PROXY_ARP: 'proxy-arp';
PROXY_IDENTITY: 'proxy-identity';
PSEUDO_ETHERNET: 'pseudo-ethernet';
Q931: 'q931';
QUALIFIED_NEXT_HOP: 'qualified-next-hop';
R2CP: 'r2cp';
RADACCT: 'radacct';
RADIUS: 'radius';
RADIUS_OPTIONS: 'radius-options';
RADIUS_SERVER: 'radius-server';
RAS: 'ras';
REALAUDIO: 'realaudio';
READVERTISE: 'readvertise';
RECEIVE: 'receive';
REDUNDANCY_GROUP: 'redundancy-group';
REDUNDANT_ETHER_OPTIONS: 'redundant-ether-options';
REDUNDANT_PARENT: 'redundant-parent';
REFERENCE_BANDWIDTH: 'reference-bandwidth';
REJECT: 'reject';
REMOTE: 'remote';
REMOTE_AS: 'remote-as';
REMOTE_ID: 'remote-id';
REMOVE_PRIVATE: 'remove-private';
REMOVED: 'Removed';
RESOLUTION: 'resolution';
RESOLVE: 'resolve';
RESPOND: 'respond';
RESTRICT: 'restrict';
RETAIN: 'retain';
REVERSE_SSH: 'reverse-ssh';
REVERSE_TELNET: 'reverse-telnet';
RIB: 'rib';
RIB_GROUP: 'rib-group';
RIB_GROUPS: 'rib-groups';
RIP: 'rip';
RIPNG: 'ripng';
RKINIT: 'rkinit';
RLOGIN: 'rlogin';
ROOT_AUTHENTICATION: 'root-authentication';
ROUTE: 'route';
ROUTE_DISTINGUISHER: 'route-distinguisher';
ROUTE_FILTER: 'route-filter';
ROUTE_MAP: 'route-map';
ROUTE_TYPE: 'route-type';
ROUTER_ADVERTISEMENT: 'router-advertisement';
ROUTER_DISCOVERY: 'router-discovery';
ROUTER_ID: 'router-id';
ROUTING_INSTANCE: 'routing-instance';
ROUTING_INSTANCES: 'routing-instances';
ROUTING_OPTIONS: 'routing-options';
RPC_PROGRAM_NUMBER: 'rpc-program-number';
RPF_CHECK: 'rpf-check';
RPM: 'rpm';
RSA: 'rsa';
RSA_SIGNATURES: 'rsa-signatures';
RSH: 'rsh';
RSTP: 'rstp';
RSVP: 'rsvp';
RTSP: 'rtsp';
RULE: 'rule';
RULE_SET: 'rule-set';
SAMPLE: 'sample';
SAMPLING: 'sampling';
SAP: 'sap';
SCCP: 'sccp';
SCREEN: 'screen';
SCRIPTS: 'scripts';
SCTP: 'sctp';
SECURITY: 'security';
SECURITY_ZONE: 'security-zone';
SERVICE: 'service';
SERVICE_FILTER: 'service-filter';
SERVICES: 'services';
SELF: 'self';
SEND: 'send';
SET: 'set';
SFLOW: 'sflow';
SHA1: 'sha1';
SHA256: 'sha256';
SHA384: 'sha384';
SHA512: 'sha512';
SHARED_IKE_ID: 'shared-ike-id';
SHORTCUTS: 'shortcuts';
SIMPLE: 'simple';
SMP_AFFINITY: 'smp_affinity';
SIP: 'sip';
SITE_TO_SITE: 'site-to-site';
SQLNET_V2: 'sqlnet-v2';
SRLG: 'srlg';
SRLG_COST: 'srlg-cost';
SRLG_VALUE: 'srlg-value';
SMTP: 'smtp';
SNMP: 'snmp';
SNMP_TRAP: 'snmp-trap';
SNMPTRAP: 'snmptrap';
SNPP: 'snpp';
SOCKS: 'socks';
SOFT_RECONFIGURATION: 'soft-reconfiguration';
SONET_OPTIONS: 'sonet-options';
SOURCE: 'source';
SOURCE_ADDRESS: 'source-address';
SOURCE_ADDRESS_FILTER: 'source-address-filter';
SOURCE_IDENTITY: 'source-identity';
SOURCE_INTERFACE: 'source-interface';
SOURCE_NAT: 'source-nat';
SOURCE_PORT: 'source-port';
SOURCE_PREFIX_LIST: 'source-prefix-list';
SOURCE_QUENCH: 'source-quench';
SPEED
:
'speed' -> pushMode ( M_Speed )
;
SPF_OPTIONS: 'spf-options';
SSH: 'ssh';
STANDARD: 'standard';
STATIC: 'static';
STATIC_NAT: 'static-nat';
STATION_ADDRESS: 'station-address';
STATION_PORT: 'station-port';
STP: 'stp';
SUBTRACT: 'subtract';
SUN_RPC: 'sun-rpc';
SUNRPC: 'sunrpc';
SWITCH_OPTIONS: 'switch-options';
SYSLOG: 'syslog';
SYSTEM: 'system';
SYSTEM_SERVICES: 'system-services';
TACACS: 'tacacs';
TACACS_DS: 'tacacs-ds';
TACPLUS_SERVER: 'tacplus-server';
TAG: 'tag';
TALK: 'talk';
TARGET: 'target';
TARGET_HOST: 'target-host';
TARGET_HOST_PORT: 'target-host-port';
TARGETED_BROADCAST: 'targeted-broadcast';
TASK_SCHEDULER: 'task-scheduler';
TCP: 'tcp';
TCP_ESTABLISHED: 'tcp-established';
TCP_FLAGS: 'tcp-flags';
TCP_INITIAL: 'tcp-initial';
TCP_MSS: 'tcp-mss';
TCP_RST: 'tcp-rst';
TE_METRIC: 'te-metric';
TELNET: 'telnet';
TERM: 'term';
TFTP: 'tftp';
THEN: 'then';
THREEDES: '3des';
THREEDES_CBC: '3des-cbc';
THROUGH: 'through';
TIME_EXCEEDED: 'time-exceeded';
TIME_ZONE: 'time-zone';
TIMED: 'timed';
TIMERS: 'timers';
TO: 'to';
TO_ZONE: 'to-zone';
TRACEOPTIONS: 'traceoptions';
TRACEROUTE: 'traceroute';
TRACK: 'track';
TRAFFIC_ENGINEERING: 'traffic-engineering';
TRANSPORT: 'transport';
TRAPS: 'traps';
TRUNK: 'trunk';
TRUST: 'trust';
TTL: 'ttl';
TUNNEL: 'tunnel';
TYPE: 'type';
TYPE_7: 'type-7';
UDP: 'udp';
UNICAST: 'unicast';
UNIT: 'unit';
UNREACHABLE: 'unreachable';
UNTRUST: 'untrust';
UNTRUST_SCREEN: 'untrust-screen';
UPTO: 'upto';
URPF_LOGGING: 'urpf-logging';
USER: 'user';
UUID: 'uuid';
V1_ONLY: 'v1-only';
VERSION: 'version';
VIRTUAL_ADDRESS: 'virtual-address';
VIRTUAL_CHASSIS: 'virtual-chassis';
VIRTUAL_SWITCH: 'virtual-switch';
VLAN: 'vlan';
VLANS: 'vlans';
VLAN_ID: 'vlan-id';
VLAN_ID_LIST: 'vlan-id-list';
VLAN_TAGS: 'vlan-tags';
VLAN_TAGGING: 'vlan-tagging';
VPLS: 'vpls';
VPN: 'vpn';
VPN_MONITOR: 'vpn-monitor';
VRF: 'vrf';
VRF_EXPORT: 'vrf-export';
VRF_IMPORT: 'vrf-import';
VRF_TABLE_LABEL: 'vrf-table-label';
VRF_TARGET: 'vrf-target';
VRRP: 'vrrp';
VRRP_GROUP: 'vrrp-group';
VSTP: 'vstp';
VTI: 'vti';
VXLAN: 'vxlan';
WHO: 'who';
WIDE_METRICS_ONLY: 'wide-metrics-only';
WIRELESS: 'wireless';
WIRELESSMODEM: 'wirelessmodem';
X509: 'x509';
XAUTH: 'xauth';
XDMCP: 'xdmcp';
XNM_CLEAR_TEXT: 'xnm-clear-text';
XNM_SSL: 'xnm-ssl';
ZONE: 'zone';
ZONES: 'zones';
// Complex tokens
STANDARD_COMMUNITY
:
F_StandardCommunity {!enableIPV6_ADDRESS}?
;
VARIABLE
:
(
(
(
F_Variable_RequiredVarChar
{!enableIPV6_ADDRESS}?
F_Variable_VarChar*
)
|
(
F_Variable_RequiredVarChar_Ipv6
{enableIPV6_ADDRESS}?
F_Variable_VarChar_Ipv6*
)
)
|
(
(
F_Variable_LeadingVarChar
{!enableIPV6_ADDRESS}?
F_Variable_VarChar* F_Variable_RequiredVarChar F_Variable_VarChar*
)
|
(
F_Variable_LeadingVarChar_Ipv6
{enableIPV6_ADDRESS}?
F_Variable_VarChar_Ipv6* F_Variable_RequiredVarChar_Ipv6
F_Variable_VarChar_Ipv6*
)
)
)
;
AMPERSAND
:
'&'
;
ASTERISK
:
'*'
;
CARAT
:
'^'
;
CLOSE_BRACE
:
'}'
;
CLOSE_BRACKET
:
']'
;
CLOSE_PAREN
:
')'
;
COLON
:
':'
;
COMMA
:
','
;
DASH: '-';
DEC
:
'0'
| F_PositiveDigit F_Digit*
;
DOLLAR
:
'$'
;
DOUBLE_AMPERSAND
:
'&&'
;
DOUBLE_PIPE
:
'||'
;
DOUBLE_QUOTED_STRING
:
'"' ~'"'* '"'
;
FLOAT
:
F_PositiveDigit F_Digit* '.'
(
'0'
| F_PositiveDigit F_Digit*
)
;
FORWARD_SLASH
:
'/'
;
GREATER_THAN
:
'>'
;
HEX
:
'0x' F_HexDigit+
;
IP_ADDRESS
:
F_IpAddress {enableIP_ADDRESS}?
;
IP_PREFIX
:
F_IpPrefix {enableIP_ADDRESS}?
;
IPV6_ADDRESS
:
F_Ipv6Address {enableIPV6_ADDRESS}?
;
IPV6_PREFIX
:
F_Ipv6Prefix {enableIPV6_ADDRESS}?
;
LINE_COMMENT
:
'#' F_NonNewlineChar* F_NewlineChar+
{enableIPV6_ADDRESS = true;}
-> channel ( HIDDEN )
;
MULTILINE_COMMENT
:
'/*' .*? '*/' -> channel ( HIDDEN )
;
NEWLINE
:
F_NewlineChar+
{
enableIPV6_ADDRESS = true;
}
;
OPEN_BRACE
:
'{'
;
OPEN_PAREN
:
'('
;
PERIOD
:
'.'
;
PLUS
:
'+'
;
SEMICOLON
:
';'
;
SINGLE_QUOTE
:
'\''
;
UNDERSCORE: '_';
WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
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_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_Ipv6Prefix
:
F_Ipv6Address '/' F_Ipv6PrefixLength
;
fragment
F_Ipv6PrefixLength
:
F_Digit
| F_PositiveDigit F_Digit
| '1' [01] F_Digit
| '12' [0-8]
;
fragment
F_Letter
:
[A-Za-z]
;
fragment
F_NewlineChar
:
[\r\n]
;
fragment
F_NonNewlineChar
:
~[\r\n]
;
fragment
F_NonWhitespaceChar
:
~[ \t\u000C\r\n]
;
fragment
F_PositiveDigit
:
[1-9]
;
fragment
F_StandardCommunity
:
F_Uint16 ':' F_Uint16
;
fragment
F_Uint16
:
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_Variable_RequiredVarChar
:
~[ 0-9\t\n\r/.,\-;{}<>[\]&|()"']
;
fragment
F_Variable_RequiredVarChar_Ipv6
:
~[ 0-9\t\n\r/.,\-:;{}<>[\]&|()"']
;
fragment
F_Variable_InterfaceVarChar
:
~[ \t\n\r.,:;{}<>[\]&|()"']
;
fragment
F_Variable_LeadingVarChar
:
~[ \t\n\r:;{}<>[\]&|()"']
;
fragment
F_Variable_LeadingVarChar_Ipv6
:
~[ \t\n\r:;{}<>[\]&|()"']
;
fragment
F_Variable_VarChar
:
~[ \t\n\r;{}[\]&|()"']
;
fragment
F_Variable_VarChar_Ipv6
:
~[ \t\n\r:;{}[\]&|()"']
;
fragment
F_WhitespaceChar
:
[ \t\u000C]
;
mode M_Description;
M_Description_DESCRIPTION_TEXT
:
F_NonWhitespaceChar F_NonNewlineChar* -> type ( DESCRIPTION_TEXT )
;
M_Description_NEWLINE
:
F_NewlineChar+
{enableIPV6_ADDRESS = true;}
-> type ( NEWLINE ) , popMode
;
M_Description_WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
mode M_ISO;
M_ISO_ADDRESS
:
'address' -> type ( ADDRESS ) , mode ( M_ISO_Address )
;
M_ISO_MTU
:
'mtu' -> type ( MTU ) , popMode
;
M_ISO_Newline
:
F_NewlineChar+
{enableIPV6_ADDRESS = true;}
-> type ( NEWLINE ) , popMode
;
M_ISO_WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
mode M_ISO_Address;
M_ISO_Address_ISO_ADDRESS
:
F_HexDigit+
(
'.' F_HexDigit+
)+ -> type ( ISO_ADDRESS ) , popMode
;
M_ISO_Address_WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
mode M_MacAddress;
MAC_ADDRESS
:
F_HexDigit F_HexDigit ':' F_HexDigit F_HexDigit ':' F_HexDigit F_HexDigit
':' F_HexDigit F_HexDigit ':' F_HexDigit F_HexDigit ':' F_HexDigit
F_HexDigit -> popMode
;
M_MacAddress_WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
mode M_Speed;
M_Speed_AUTO
:
'auto' -> type ( AUTO ) , popMode
;
M_Speed_DEC
:
F_Digit+ -> type ( DEC )
;
M_Speed_G
:
'g' -> type ( G ) , popMode
;
M_Speed_M
:
'm' -> type ( M ) , popMode
;
M_Speed_NEWLINE
:
F_NewlineChar+ -> type ( NEWLINE ) , popMode
;
M_Speed_WS
:
F_WhitespaceChar+ -> channel ( HIDDEN )
;
|
programs/oeis/048/A048050.asm | neoneye/loda | 22 | 29771 | <reponame>neoneye/loda
; A048050: Chowla's function: sum of divisors of n except 1 and n.
; 0,0,0,2,0,5,0,6,3,7,0,15,0,9,8,14,0,20,0,21,10,13,0,35,5,15,12,27,0,41,0,30,14,19,12,54,0,21,16,49,0,53,0,39,32,25,0,75,7,42,20,45,0,65,16,63,22,31,0,107,0,33,40,62,18,77,0,57,26,73,0,122,0,39,48,63,18,89,0,105,39,43,0,139,22,45,32,91,0,143,20,75,34,49,24,155,0,72,56,116
mov $2,$0
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
sub $0,$2
trn $0,2
|
sk/music/Miniboss.asm | Cancer52/flamedriver | 9 | 16485 | Snd_Minib_SK_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Snd_Minib_SK_Voices
smpsHeaderChan $06, $03
smpsHeaderTempo $01, $00
smpsHeaderDAC Snd_Minib_SK_DAC, $00, $0C
smpsHeaderFM Snd_Minib_SK_FM1, $00, $0C
smpsHeaderFM Snd_Minib_SK_FM2, $00, $0C
smpsHeaderFM Snd_Minib_SK_FM3, $00, $0C
smpsHeaderFM Snd_Minib_SK_FM4, $00, $0C
smpsHeaderFM Snd_Minib_SK_FM5, $00, $0E
smpsHeaderPSG Snd_Minib_SK_PSG1, $E8, $02, $00, $00
smpsHeaderPSG Snd_Minib_SK_PSG2, $E8, $02, $00, $00
smpsHeaderPSG Snd_Minib_SK_PSG3, $E8, $02, $00, $00
; FM1 Data
Snd_Minib_SK_FM1:
smpsSetvoice $00
smpsModSet $0D, $01, $02, $06
smpsPan panCenter, $00
dc.b nE5, $06, nE5, nE5, nRst, $12, nE5, $06, nE5, nE5, nRst, $2A
Snd_Minib_SK_Loop0E:
smpsSetvoice $00
dc.b nE5, $54, nF5, $60, nFs5, nF5, $6C
smpsLoop $00, $02, Snd_Minib_SK_Loop0E
smpsSetvoice $03
dc.b nRst, $18, nA4, nG5, nF5, $0C, nE5, $24, nD5, $18, nF5, nE5
dc.b $0C, nC5, $3C, nRst, $0C, nD5, nC5, nE5, $6C, nRst, $18, nA4
dc.b nG5, nF5, $0C, nE5, $24, nD5, $18, nF5, nE5, $0C, nC5, $60
dc.b nA5, $54, nRst, $18
smpsJump Snd_Minib_SK_Loop0E
; Unreachable
smpsStop
; FM2 Data
Snd_Minib_SK_FM2:
smpsSetvoice $01
smpsModSet $0D, $01, $02, $06
smpsPan panCenter, $00
dc.b nE2, $06, nE2, nE2, $0C, nRst, nE2, $06, nE2, nE2, $0C, nRst
dc.b $24
Snd_Minib_SK_Loop0D:
smpsSetvoice $01
dc.b nA2, $06, nA2, nA3, nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA3
dc.b nA3, nA2, nA2, nA3, nA3
smpsLoop $00, $08, Snd_Minib_SK_Loop0D
dc.b nF2, $06, nF2, nF3, nF3, nF2, nF2, nF3, nF3, nF2, nF2, nF3
dc.b nF3, nF2, nF2, nF3, nF3, nG2, nG2, nG3, nG3, nG2, nG2, nG3
dc.b nG3, nG2, nG2, nG3, nG3, nG2, nG2, nG3, nG3, nA2, nA2, nA3
dc.b nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA3
dc.b nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA3, nA3, nG2, nG2, nG3
dc.b nG3, nG2, nG2, nG3, nG3, nF2, nF2, nF3, nF3, nF2, nF2, nF3
dc.b nF3, nF2, nF2, nF3, nF3, nF2, nF2, nF3, nF3, nG2, nG2, nG3
dc.b nG3, nG2, nG2, nG3, nG3, nG2, nG2, nG3, nG3, nG2, nG2, nG3
dc.b nG3, nA2, nA2, nA3, nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA3
dc.b nA3, nA2, nA2, nA3, nA3, nA2, nA2, nA2, $0C, nRst, nA2, $06
dc.b nA2, nA2, $0C, nRst, $24
smpsJump Snd_Minib_SK_Loop0D
; Unreachable
smpsStop
; FM3 Data
Snd_Minib_SK_FM3:
smpsSetvoice $00
smpsModSet $0D, $01, $02, $06
smpsPan panRight, $00
dc.b nB4, $06, nB4, nB4, nRst, $12, nB4, $06, nB4, nB4, nRst, $2A
Snd_Minib_SK_Loop0C:
smpsSetvoice $00
dc.b nC5, $54, nC5, $60, nC5, nC5, $6C
smpsLoop $00, $02, Snd_Minib_SK_Loop0C
smpsSetvoice $04
dc.b nC5, $54, nB4, $3C, nD5, $24, nE5, $7F, smpsNoAttack, nE5, $1D, nD5
dc.b $30, nC5, $54, nB4, $3C, nD5, $24, nE5, $6C, nRst, $60
smpsJump Snd_Minib_SK_Loop0C
; Unreachable
smpsStop
; FM4 Data
Snd_Minib_SK_FM4:
smpsModSet $0D, $01, $02, $06
smpsPan panLeft, $00
dc.b nRst, $60
Snd_Minib_SK_Loop04:
smpsSetvoice $02
dc.b nA4, $06, nC5, nE5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop04
Snd_Minib_SK_Loop05:
dc.b nA4, $06, nC5, nF5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop05
Snd_Minib_SK_Loop06:
dc.b nA4, $06, nC5, nFs5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop06
Snd_Minib_SK_Loop07:
dc.b nA4, $06, nC5, nF5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop07
Snd_Minib_SK_Loop08:
dc.b nA4, $06, nC5, nE5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop08
Snd_Minib_SK_Loop09:
dc.b nA4, $06, nC5, nF5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop09
Snd_Minib_SK_Loop0A:
dc.b nA4, $06, nC5, nFs5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop0A
Snd_Minib_SK_Loop0B:
dc.b nA4, $06, nC5, nF5, nC5
smpsLoop $00, $04, Snd_Minib_SK_Loop0B
dc.b nF4, $0C, nA4, nC5, nF5, $3C, nG4, $0C, nB4, nD5, nG5, $3C
dc.b nA4, $0C, nC5, nE5, nA5, $3C, nA4, $0C, nC5, nE5, nA5, nG4
dc.b nB4, nD5, nG5, nF4, nA4, nC5, nF5, $3C, nG4, $0C, nB4, nD5
dc.b nG5, $3C, nA4, $0C, nC5, nE5, nA5, $3C, nRst, $60
smpsJump Snd_Minib_SK_Loop04
; Unreachable
smpsStop
; FM5 Data
Snd_Minib_SK_FM5:
dc.b nRst, $10
smpsSetvoice $00
smpsModSet $0D, $01, $02, $06
smpsPan panCenter, $00
smpsFMAlterVol $0C
dc.b nE5, $06, nE5, nE5, nRst, $12, nE5, $06, nE5, nE5, nRst, $2A
smpsFMAlterVol $F4
Snd_Minib_SK_Loop03:
smpsSetvoice $00
dc.b nE5, $54, nF5, $60, nFs5, nF5, $6C
smpsLoop $00, $02, Snd_Minib_SK_Loop03
smpsSetvoice $03
dc.b nRst, $18, nA4, nG5, nF5, $0C, nE5, $24, nD5, $18, nF5, nE5
dc.b $0C, nC5, $3C, nRst, $0C, nD5, nC5, nE5, $6C, nRst, $18, nA4
dc.b nG5, nF5, $0C, nE5, $24, nD5, $18, nF5, nE5, $0C, nC5, $60
dc.b nA5, $54, nRst, $18
smpsJump Snd_Minib_SK_Loop03
; Unreachable
smpsStop
; DAC Data
Snd_Minib_SK_DAC:
dc.b dSnareS3, $06, dSnareS3, dSnareS3, $18, dSnareS3, $06, dSnareS3, dSnareS3, $18, dSnareS3, $06
dc.b dSnareS3, dSnareS3, dSnareS3
Snd_Minib_SK_Loop00:
dc.b dKickS3, $18, dKickS3, dKickS3, dKickS3
smpsLoop $00, $07, Snd_Minib_SK_Loop00
Snd_Minib_SK_Loop01:
dc.b dKickS3, $18, dKickS3, dKickS3, $0C, dSnareS3, dSnareS3, $06, dSnareS3, dSnareS3, $0C
smpsLoop $00, $03, Snd_Minib_SK_Loop01
Snd_Minib_SK_Loop02:
dc.b dKickS3, $0C, dKickS3, dSnareS3, dKickS3, dKickS3, $06, dKickS3, dKickS3, $0C, dSnareS3, dKickS3
smpsLoop $00, $04, Snd_Minib_SK_Loop02
dc.b dKickS3, $0C, dKickS3, dSnareS3, dKickS3, dKickS3, $06, dKickS3, dKickS3, $0C, dSnareS3, $06
dc.b dSnareS3, dSnareS3, dSnareS3, dSnareS3, dSnareS3, dSnareS3, $18, dSnareS3, $06, dSnareS3, dSnareS3, $18
dc.b dSnareS3, $06, dSnareS3, dSnareS3, dSnareS3
smpsJump Snd_Minib_SK_Loop00
; Unreachable
smpsStop
; PSG1 Data
Snd_Minib_SK_PSG1:
smpsStop
; PSG2 Data
Snd_Minib_SK_PSG2:
smpsStop
; Unreachable
smpsStop
; PSG3 Data
Snd_Minib_SK_PSG3:
smpsStop
Snd_Minib_SK_Voices:
; Voice $00
; $3D
; $41, $10, $72, $61, $0F, $14, $53, $14, $04, $06, $06, $03
; $00, $0F, $00, $00, $1F, $3F, $5F, $1F, $1A, $8A, $8A, $8A
smpsVcAlgorithm $05
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $06, $07, $01, $04
smpsVcCoarseFreq $01, $02, $00, $01
smpsVcRateScale $00, $01, $00, $00
smpsVcAttackRate $14, $13, $14, $0F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $03, $06, $06, $04
smpsVcDecayRate2 $00, $00, $0F, $00
smpsVcDecayLevel $01, $05, $03, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $0A, $0A, $0A, $1A
; Voice $01
; $08
; $07, $70, $30, $00, $9F, $9F, $9F, $9F, $12, $0E, $0A, $0A
; $00, $04, $04, $03, $28, $25, $25, $25, $1F, $2B, $11, $81
smpsVcAlgorithm $00
smpsVcFeedback $01
smpsVcUnusedBits $00
smpsVcDetune $00, $03, $07, $00
smpsVcCoarseFreq $00, $00, $00, $07
smpsVcRateScale $02, $02, $02, $02
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0A, $0A, $0E, $12
smpsVcDecayRate2 $03, $04, $04, $00
smpsVcDecayLevel $02, $02, $02, $02
smpsVcReleaseRate $05, $05, $05, $08
smpsVcTotalLevel $01, $11, $2B, $1F
; Voice $02
; $04
; $75, $11, $31, $71, $1F, $1F, $1F, $1F, $08, $05, $0C, $09
; $00, $00, $00, $00, $FF, $FF, $FF, $FF, $1E, $86, $22, $8D
smpsVcAlgorithm $04
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $07, $03, $01, $07
smpsVcCoarseFreq $01, $01, $01, $05
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $09, $0C, $05, $08
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $0D, $22, $06, $1E
; Voice $03
; $29
; $20, $31, $51, $71, $0E, $11, $12, $17, $00, $00, $00, $00
; $08, $00, $09, $00, $89, $F8, $F9, $F8, $20, $20, $10, $88
smpsVcAlgorithm $01
smpsVcFeedback $05
smpsVcUnusedBits $00
smpsVcDetune $07, $05, $03, $02
smpsVcCoarseFreq $01, $01, $01, $00
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $17, $12, $11, $0E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $00, $00
smpsVcDecayRate2 $00, $09, $00, $08
smpsVcDecayLevel $0F, $0F, $0F, $08
smpsVcReleaseRate $08, $09, $08, $09
smpsVcTotalLevel $08, $10, $20, $20
; Voice $04
; $3D
; $31, $50, $21, $41, $0D, $13, $13, $14, $03, $01, $06, $05
; $05, $01, $05, $01, $FF, $FF, $FF, $FF, $1D, $8A, $88, $87
smpsVcAlgorithm $05
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $04, $02, $05, $03
smpsVcCoarseFreq $01, $01, $00, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $14, $13, $13, $0D
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $05, $06, $01, $03
smpsVcDecayRate2 $01, $05, $01, $05
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $07, $08, $0A, $1D
|
programs/oeis/258/A258589.asm | neoneye/loda | 22 | 163374 | ; A258589: Minimal most likely sum for a roll of n 12-sided dice.
; 1,13,19,26,32,39,45,52,58,65,71,78,84,91,97,104,110,117,123,130,136,143,149,156,162,169,175,182,188,195,201,208,214,221,227,234,240,247,253,260,266,273,279,286,292,299,305,312,318,325,331,338,344,351,357,364,370,377,383,390,396,403,409,416,422,429,435,442,448,455,461,468,474,481,487,494,500,507,513,520,526,533,539,546,552,559,565,572,578,585,591,598,604,611,617,624,630,637,643,650
mov $1,3
add $1,$0
mov $2,3
mov $5,6
mul $5,$0
mul $0,4
add $2,$5
mov $3,$2
sub $3,4
mov $4,$2
mov $5,2
lpb $0
trn $0,$4
add $0,1
div $1,2
add $3,$0
add $3,3
add $1,$3
pow $5,2
add $1,$5
lpe
sub $1,2
mov $0,$1
|
nine/ines_header.asm | sgadrat/nine-gine | 6 | 9609 | <reponame>sgadrat/nine-gine
.asc "NES", $1A ; iNES magic
.byt 2 ; PRG section occupies 2*16KiB memory
.byt 1 ; CHR section occupies 1* 8KiB memory
.byt %00000000 ; Flags 6 - mapper 0, horizontal mirroring, no trainer, no persistent memory
.byt 0 ; Flags 7 - mapper 0, not NES 2.0, not PlayChoice10, not VS unisystem
.byt 0 ; Size of PRG-RAM
.byt %00000001 ; Flags 9 - PAL
.byt 0 ;
.byt 0 ;
.byt 0 ; Unused in iNES
.byt 0 ;
.byt 0 ;
.byt 0 ;
|
src/connections/adabase-connection-base-postgresql.adb | jrmarino/AdaBase | 30 | 21254 | <gh_stars>10-100
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with Ada.Characters.Handling;
package body AdaBase.Connection.Base.PostgreSQL is
package ACH renames Ada.Characters.Handling;
---------------------
-- setCompressed --
---------------------
overriding
procedure setCompressed (conn : out PostgreSQL_Connection; compressed : Boolean)
is
begin
raise UNSUPPORTED_BY_PGSQL;
end setCompressed;
------------------
-- compressed --
------------------
overriding
function compressed (conn : PostgreSQL_Connection) return Boolean is
begin
return False;
end compressed;
--------------------
-- setUseBuffer --
--------------------
overriding
procedure setUseBuffer (conn : out PostgreSQL_Connection;
buffered : Boolean) is
begin
raise UNSUPPORTED_BY_PGSQL;
end setUseBuffer;
-----------------
-- useBuffer --
-----------------
overriding
function useBuffer (conn : PostgreSQL_Connection) return Boolean is
begin
return False;
end useBuffer;
--------------------------------
-- driverMessage (interface) --
--------------------------------
overriding
function driverMessage (conn : PostgreSQL_Connection) return String
is
result : BND.ICS.chars_ptr := BND.PQerrorMessage (conn.handle);
begin
return BND.ICS.Value (result);
end driverMessage;
-----------------------
-- driverMessage #2 --
-----------------------
function driverMessage (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return String
is
result : BND.ICS.chars_ptr := BND.PQresultErrorMessage (res);
begin
return BND.ICS.Value (result);
end driverMessage;
------------------------------
-- driverCode (interface) --
------------------------------
overriding
function driverCode (conn : PostgreSQL_Connection) return Driver_Codes is
begin
if conn.cmd_sql_state = stateless or else
conn.cmd_sql_state = "00000"
then
return 0;
end if;
if conn.cmd_sql_state (1 .. 2) = "01" then
return 1;
end if;
return 2;
end driverCode;
---------------------
-- driverCode #2 --
---------------------
function driverCode (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return Driver_Codes
is
SS : constant SQL_State := conn.SqlState (res);
begin
if SS = stateless or else SS = "00000" then
return 0;
end if;
if SS (1 .. 2) = "01" then
return 1;
end if;
return 2;
end driverCode;
----------------------------
-- SqlState (interface) --
----------------------------
overriding
function SqlState (conn : PostgreSQL_Connection) return SQL_State is
begin
return conn.cmd_sql_state;
end SqlState;
-------------------
-- SqlState #2 --
-------------------
function SqlState (conn : PostgreSQL_Connection; res : BND.PGresult_Access)
return SQL_State
is
use type BND.ICS.chars_ptr;
fieldcode : constant BND.IC.int := BND.PG_DIAG_SQLSTATE;
detail : BND.ICS.chars_ptr;
begin
detail := BND.PQresultErrorField (res, fieldcode);
if detail = BND.ICS.Null_Ptr then
return stateless;
end if;
declare
SS : String := BND.ICS.Value (detail);
begin
return SQL_State (SS);
end;
end SqlState;
-------------------
-- description --
-------------------
overriding
function description (conn : PostgreSQL_Connection) return String
is
begin
return conn.info_description;
end description;
-------------------------
-- helper_get_row_id --
-------------------------
function returned_id (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return Trax_ID
is
begin
if conn.field_is_null (res, 0, 0) then
return 0;
end if;
declare
field : constant String := conn.field_string (res, 0, 0);
begin
return Trax_ID (Integer'Value (field));
exception
when others => return 0;
end;
end returned_id;
-----------------------
-- private_execute --
-----------------------
procedure private_execute (conn : out PostgreSQL_Connection; sql : String)
is
use type BND.ExecStatusType;
pgres : BND.PGresult_Access;
query : BND.ICS.chars_ptr := BND.ICS.New_String (Str => sql);
success : Boolean;
msg : CT.Text;
ins_cmd : Boolean := False;
begin
if sql'Length > 12 and then
ACH.To_Upper (sql (sql'First .. sql'First + 6)) = "INSERT "
then
ins_cmd := True;
end if;
pgres := BND.PQexec (conn => conn.handle, command => query);
BND.ICS.Free (query);
case conn.examine_result (pgres) is
when executed =>
success := True;
conn.cmd_insert_return := False;
when returned_data =>
success := True;
conn.cmd_insert_return := ins_cmd;
when failed =>
success := False;
msg := CT.SUS (conn.driverMessage (pgres));
end case;
conn.cmd_sql_state := conn.SqlState (pgres);
if success then
conn.cmd_rows_impact := conn.rows_impacted (pgres);
else
conn.cmd_rows_impact := 0;
end if;
if conn.cmd_insert_return then
conn.insert_return_val := conn.returned_id (pgres);
else
conn.insert_return_val := 0;
end if;
BND.PQclear (pgres);
if not success then
raise QUERY_FAIL with CT.USS (msg);
end if;
end private_execute;
----------------------
-- private_select --
----------------------
function private_select (conn : PostgreSQL_Connection; sql : String)
return BND.PGresult_Access
is
use type BND.ExecStatusType;
pgres : BND.PGresult_Access;
query : BND.ICS.chars_ptr := BND.ICS.New_String (Str => sql);
selcmd : Boolean := True;
success : Boolean;
msg : CT.Text;
begin
pgres := BND.PQexec (conn => conn.handle, command => query);
BND.ICS.Free (query);
case conn.examine_result (pgres) is
when executed =>
success := False;
selcmd := False;
when returned_data =>
success := True;
when failed =>
success := False;
msg := CT.SUS (conn.driverMessage (pgres));
end case;
if not success then
if selcmd then
raise QUERY_FAIL with CT.USS (msg);
else
raise QUERY_FAIL with "Not a SELECT query: " & sql;
end if;
end if;
return pgres;
end private_select;
----------------------------------------------
-- rows_affected_by_execution (interface) --
----------------------------------------------
overriding
function rows_affected_by_execution (conn : PostgreSQL_Connection)
return Affected_Rows is
begin
return conn.cmd_rows_impact;
end rows_affected_by_execution;
----------------------
-- rows_in_result --
----------------------
function rows_in_result (conn : PostgreSQL_Connection;
res : BND.PGresult_Access)
return Affected_Rows
is
use type BND.IC.int;
result : BND.IC.int := BND.PQntuples (res);
begin
if result < 0 then
-- overflowed (e.g. > 2 ** 31 on 32-bit system)
return Affected_Rows'Last;
end if;
return Affected_Rows (result);
end rows_in_result;
---------------------
-- rows_impacted --
---------------------
function rows_impacted (conn : PostgreSQL_Connection;
res : BND.PGresult_Access)
return Affected_Rows
is
result : BND.ICS.chars_ptr := BND.PQcmdTuples (res);
resstr : constant String := BND.ICS.Value (result);
begin
if CT.IsBlank (resstr) then
return 0;
end if;
begin
return Affected_Rows (Integer'Value (resstr));
exception
when others => return 0;
end;
end rows_impacted;
-------------------------
-- begin_transaction --
-------------------------
procedure begin_transaction (conn : out PostgreSQL_Connection) is
begin
conn.private_execute ("BEGIN");
conn.dummy := True;
exception
when E : QUERY_FAIL =>
raise TRAX_BEGIN_FAIL with EX.Exception_Message (E);
end begin_transaction;
--------------
-- commit --
--------------
overriding
procedure commit (conn : out PostgreSQL_Connection)
is
procedure deallocate_prep_statement (Position : stmt_vector.Cursor);
procedure deallocate_prep_statement (Position : stmt_vector.Cursor)
is
identifier : constant Trax_ID := stmt_vector.Element (Position);
stmt_name : constant String := "AdaBase_" & CT.trim (identifier'Img);
begin
if conn.destroy_statement (stmt_name) then
null;
end if;
end deallocate_prep_statement;
begin
begin
conn.private_execute ("COMMIT");
conn.stmts_to_destroy.Iterate (deallocate_prep_statement'Access);
conn.stmts_to_destroy.Clear;
exception
when E : QUERY_FAIL =>
raise COMMIT_FAIL with EX.Exception_Message (E);
end;
if not conn.autoCommit then
conn.begin_transaction;
end if;
end commit;
----------------
-- rollback --
----------------
overriding
procedure rollback (conn : out PostgreSQL_Connection)
is
procedure deallocate_prep_statement (Position : stmt_vector.Cursor);
procedure deallocate_prep_statement (Position : stmt_vector.Cursor)
is
identifier : constant Trax_ID := stmt_vector.Element (Position);
stmt_name : constant String := "AdaBase_" & CT.trim (identifier'Img);
begin
if conn.destroy_statement (stmt_name) then
null;
end if;
end deallocate_prep_statement;
begin
begin
conn.private_execute ("ROLLBACK");
conn.stmts_to_destroy.Iterate (deallocate_prep_statement'Access);
conn.stmts_to_destroy.Clear;
exception
when E : QUERY_FAIL =>
raise ROLLBACK_FAIL with EX.Exception_Message (E);
end;
if not conn.autoCommit then
conn.begin_transaction;
end if;
end rollback;
---------------------
-- setAutoCommit --
---------------------
overriding
procedure setAutoCommit (conn : out PostgreSQL_Connection; auto : Boolean)
is
-- PGSQL server has no setting to disable autocommit. Only issuing
-- a BEGIN transaction command will inhibit autocommit (and commit/
-- rollback enables it again). Thus autocommit has to be handled at
-- the adabase level. A "BEGIN" command is issued immediately after
-- connection, COMMIT and ROLLBACK to ensure we're always in a
-- transaction when autocommit is off.
previous_state : Boolean := conn.prop_auto_commit;
begin
conn.prop_auto_commit := auto;
if conn.prop_active then
if auto /= previous_state then
if conn.within_transaction then
if auto then
conn.commit;
end if;
else
if not auto then
conn.begin_transaction;
end if;
end if;
end if;
end if;
end setAutoCommit;
------------------
-- disconnect --
------------------
overriding
procedure disconnect (conn : out PostgreSQL_Connection)
is
use type BND.PGconn_Access;
begin
if conn.handle /= null then
BND.PQfinish (conn => conn.handle);
conn.handle := null;
end if;
conn.tables.Clear;
conn.data_types.Clear;
conn.prop_active := False;
end disconnect;
--------------------
-- fields_count --
--------------------
function fields_count (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return Natural
is
result : BND.IC.int := BND.PQnfields (res);
begin
return Natural (result);
end fields_count;
---------------------
-- field_is_null --
---------------------
function field_is_null (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
row_number : Natural;
column_number : Natural) return Boolean
is
use type BND.IC.int;
rownum : constant BND.IC.int := BND.IC.int (row_number);
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : constant BND.IC.int := BND.PQgetisnull (res, rownum, colnum);
begin
return (result = 1);
end field_is_null;
--------------------
-- field_length --
--------------------
function field_length (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
row_number : Natural;
column_number : Natural) return Natural
is
rownum : constant BND.IC.int := BND.IC.int (row_number);
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : constant BND.IC.int := BND.PQgetlength (res, rownum, colnum);
begin
return Natural (result);
end field_length;
------------------------
-- discard_pgresult --
------------------------
procedure discard_pgresult (conn : PostgreSQL_Connection;
res : out BND.PGresult_Access)
is
use type BND.PGresult_Access;
begin
if res /= null then
BND.PQclear (res);
end if;
res := null;
end discard_pgresult;
----------------------------
-- field_data_is_binary --
----------------------------
function field_data_is_binary (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
column_number : Natural) return Boolean
is
use type BND.IC.int;
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : constant BND.IC.int := BND.PQfformat (res, colnum);
begin
return (result = 1);
end field_data_is_binary;
----------------
-- finalize --
----------------
overriding
procedure finalize (conn : in out PostgreSQL_Connection) is
begin
conn.disconnect;
end finalize;
---------------------
-- setMultiQuery --
---------------------
overriding
procedure setMultiQuery (conn : out PostgreSQL_Connection;
multiple : Boolean)
is
-- Applicable only to driver.execute and implemented manually there
-- (in order to use parameter execute rather than pgexec function
begin
conn.prop_multiquery := multiple;
end setMultiQuery;
------------------
-- multiquery --
------------------
overriding
function multiquery (conn : PostgreSQL_Connection) return Boolean is
begin
return conn.prop_multiquery;
end multiquery;
-------------------------------
-- setTransactionIsolation --
-------------------------------
overriding
procedure setTransactionIsolation (conn : out PostgreSQL_Connection;
isolation : Trax_Isolation)
is
use type Trax_Isolation;
sql : constant String :=
"SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL " &
ISO_Keywords (isolation);
begin
if conn.prop_active then
conn.private_execute (sql);
end if;
conn.prop_trax_isolation := isolation;
exception
when QUERY_FAIL =>
raise TRAXISOL_FAIL with sql;
end setTransactionIsolation;
------------------------------------
-- connection_attempt_succeeded --
------------------------------------
function connection_attempt_succeeded (conn : PostgreSQL_Connection)
return Boolean
is
use type BND.ConnStatusType;
status : constant BND.ConnStatusType := BND.PQstatus (conn.handle);
begin
return (status = BND.CONNECTION_OK);
end connection_attempt_succeeded;
-----------------------
-- convert_version --
-----------------------
function convert_version (pgsql_version : Natural) return CT.Text
is
six : String (1 .. 6) := (others => '0');
raw : constant String := CT.int2str (pgsql_version);
len : constant Natural := raw'Length;
begin
six (7 - len .. 6) := raw;
if six (1) = '0' then
return CT.SUS (six (2) & '.' & six (3 .. 4) & '.' & six (5 .. 6));
else
return CT.SUS
(six (1 .. 2) & '.' & six (3 .. 4) & '.' & six (5 .. 6));
end if;
end convert_version;
--------------------------
-- get_server_version --
--------------------------
function get_server_version (conn : PostgreSQL_Connection) return Natural
is
use type BND.IC.int;
version : BND.IC.int := BND.PQserverVersion (conn.handle);
begin
return Natural (version);
end get_server_version;
---------------------------
-- get_library_version --
---------------------------
function get_library_version return Natural
is
use type BND.IC.int;
version : BND.IC.int := BND.PQlibVersion;
begin
return Natural (version);
end get_library_version;
-----------------------
-- get_server_info --
-----------------------
function get_server_info (conn : PostgreSQL_Connection) return CT.Text
is
use type BND.IC.int;
protocol : BND.IC.int := BND.PQprotocolVersion (conn.handle);
begin
return CT.SUS ("Protocol " & CT.int2str (Integer (protocol)) & ".0");
end get_server_info;
-----------------------
-- is_ipv4_or_ipv6 --
-----------------------
function is_ipv4_or_ipv6 (teststr : String) return Boolean
is
function is_byte (segment : String) return Boolean;
function is_byte (segment : String) return Boolean is
begin
if segment'Length > 3 then
return False;
end if;
for x in segment'Range loop
case segment (x) is
when '0' .. '9' => null;
when others => return False;
end case;
end loop;
return (Integer'Value (segment) < 256);
end is_byte;
num_dots : constant Natural := CT.count_char (teststr, '.');
dot : constant String := ".";
begin
if num_dots = 3 then
declare
P1A : String := CT.part_1 (teststr, dot);
P1B : String := CT.part_2 (teststr, dot);
begin
if is_byte (P1A) then
declare
P2A : String := CT.part_1 (P1B, dot);
P2B : String := CT.part_2 (P1B, dot);
begin
if is_byte (P2A) then
declare
P3A : String := CT.part_1 (P2B, dot);
P3B : String := CT.part_2 (P2B, dot);
begin
if is_byte (P3A) and then is_byte (P3B) then
return True;
end if;
end;
end if;
end;
end if;
end;
end if;
for x in teststr'Range loop
case teststr (x) is
when ':' | '0' .. '9' | 'A' .. 'F' | 'a' .. 'f' => null;
when others => return False;
end case;
end loop;
return True;
end is_ipv4_or_ipv6;
--------------------------
-- within_transaction --
--------------------------
function within_transaction (conn : PostgreSQL_Connection) return Boolean
is
use type BND.PGTransactionStatusType;
status : BND.PGTransactionStatusType;
begin
status := BND.PQtransactionStatus (conn.handle);
return (status /= BND.PQTRANS_IDLE);
end within_transaction;
---------------
-- connect --
---------------
overriding
procedure connect (conn : out PostgreSQL_Connection;
database : String;
username : String := blankstring;
password : String := blankstring;
hostname : String := blankstring;
socket : String := blankstring;
port : Posix_Port := portless)
is
constr : CT.Text := CT.SUS ("dbname=" & database);
begin
if conn.prop_active then
raise NOT_WHILE_CONNECTED;
end if;
if not CT.IsBlank (username) then
CT.SU.Append (constr, " user=" & username);
end if;
if not CT.IsBlank (password) then
CT.SU.Append (constr, " password=" & password);
end if;
if not CT.IsBlank (hostname) then
if is_ipv4_or_ipv6 (hostname) then
CT.SU.Append (constr, " hostaddr=" & hostname);
else
CT.SU.Append (constr, " host=" & hostname);
end if;
else
if not CT.IsBlank (socket) then
CT.SU.Append (constr, " host=" & socket);
end if;
end if;
if port /= portless then
CT.SU.Append (constr, " port=" & CT.int2str (port));
end if;
declare
use type BND.PGconn_Access;
conninfo : BND.ICS.chars_ptr := BND.ICS.New_String (CT.USS (constr));
begin
conn.tables.Clear;
conn.handle := BND.PQconnectdb (conninfo);
BND.ICS.Free (conninfo);
if not conn.connection_attempt_succeeded then
raise CONNECT_FAILED;
end if;
end;
conn.prop_active := True;
conn.info_server_version := convert_version (conn.get_server_version);
conn.info_server := conn.get_server_info;
conn.establish_uniform_encoding;
conn.retrieve_uniform_encoding;
conn.setTransactionIsolation (conn.prop_trax_isolation);
if not conn.prop_auto_commit then
conn.begin_transaction;
end if;
-- dump all tables and data types
conn.cache_table_names;
conn.cache_data_types;
exception
when NOT_WHILE_CONNECTED =>
raise NOT_WHILE_CONNECTED with
"Reconnection attempted during an active connection";
when CONNECT_FAILED =>
declare
msg : String := "connection failure: " & conn.driverMessage;
begin
conn.disconnect;
raise CONNECT_FAILED with msg;
end;
when rest : others =>
conn.disconnect;
EX.Reraise_Occurrence (rest);
end connect;
------------------
-- Initialize --
------------------
overriding
procedure Initialize (conn : in out PostgreSQL_Connection) is
begin
conn.info_client_version := convert_version (get_library_version);
conn.info_client := conn.info_client_version;
end Initialize;
------------------
-- field_name --
------------------
function field_name (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
column_number : Natural) return String
is
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : BND.ICS.chars_ptr := BND.PQfname (res, colnum);
begin
return BND.ICS.Value (result);
end field_name;
--------------------
-- field_string --
--------------------
function field_string (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
row_number : Natural;
column_number : Natural) return String
is
rownum : constant BND.IC.int := BND.IC.int (row_number);
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : BND.ICS.chars_ptr := BND.PQgetvalue (res, rownum, colnum);
begin
return BND.ICS.Value (result);
end field_string;
--------------------
-- lastInsertID --
--------------------
overriding
function lastInsertID (conn : PostgreSQL_Connection) return Trax_ID
is
-- PostgreSQL has a non-standard extension to INSERT INTO called
-- RETURNING that is the most reliably method to get the last insert
-- ID on the primary key. We use it (determined in private_execute)
-- if RETURNING was part of the INSERT query, otherwise we fall back
-- to the less reliable lastval() method.
begin
if conn.cmd_insert_return then
return conn.insert_return_val;
else
return conn.select_last_val;
end if;
end lastInsertID;
-----------------------
-- select_last_val --
-----------------------
function select_last_val (conn : PostgreSQL_Connection) return Trax_ID
is
pgres : BND.PGresult_Access;
product : Trax_ID := 0;
begin
-- private_select can raise exception, but don't catch it
-- For lastval(), exceptions should not be thrown so don't mask it
pgres := conn.private_select ("SELECT lastval()");
if conn.field_is_null (pgres, 0, 0) then
BND.PQclear (pgres);
return 0;
end if;
declare
field : constant String := conn.field_string (pgres, 0, 0);
begin
product := Trax_ID (Integer'Value (field));
exception
when others => null;
end;
BND.PQclear (pgres);
return product;
end select_last_val;
---------------
-- execute --
---------------
overriding
procedure execute (conn : out PostgreSQL_Connection; sql : String) is
begin
conn.private_execute (sql => sql);
end execute;
-------------------------
-- cache_table_names --
-------------------------
procedure cache_table_names (conn : out PostgreSQL_Connection)
is
pgres : BND.PGresult_Access;
nrows : Affected_Rows;
sql : constant String :=
"SELECT oid, relname FROM pg_class " &
"WHERE relkind = 'r' and relname !~ '^(pg|sql)_' " &
"ORDER BY oid";
begin
pgres := conn.private_select (sql);
nrows := conn.rows_in_result (pgres);
for x in Natural range 0 .. Natural (nrows) - 1 loop
declare
s_oid : constant String := conn.field_string (pgres, x, 0);
s_table : constant String := conn.field_string (pgres, x, 1);
payload : table_cell := (column_1 => CT.SUS (s_table));
begin
conn.tables.Insert (Key => Integer'Value (s_oid),
New_Item => payload);
end;
end loop;
BND.PQclear (pgres);
end cache_table_names;
-------------------
-- field_table --
-------------------
function field_table (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
column_number : Natural) return String
is
use type BND.Oid;
colnum : constant BND.IC.int := BND.IC.int (column_number);
pg_oid : BND.Oid := BND.PQftable (res, colnum);
pg_key : Integer := Integer (pg_oid);
begin
if pg_oid = BND.InvalidOid then
return "INVALID COLUMN";
end if;
pg_key := Positive (pg_oid);
if conn.tables.Contains (Key => pg_key) then
return CT.USS (conn.tables.Element (pg_key).column_1);
else
return "INVALID OID" & pg_key'Img;
end if;
end field_table;
------------------
-- field_type --
------------------
function field_type (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
column_number : Natural) return field_types
is
colnum : constant BND.IC.int := BND.IC.int (column_number);
pg_oid : BND.Oid := BND.PQftype (res, colnum);
pg_key : Positive := Positive (pg_oid);
begin
if conn.data_types.Contains (Key => pg_key) then
return conn.data_types.Element (pg_key).data_type;
else
-- Not in container, fall back to text tupe
return ft_textual;
end if;
end field_type;
-------------------------
-- prepare_statement --
-------------------------
function prepare_statement (conn : PostgreSQL_Connection;
stmt : aliased out BND.PGresult_Access;
name : String;
sql : String) return Boolean
is
use type BND.ExecStatusType;
c_stmt_name : BND.ICS.chars_ptr := BND.ICS.New_String (name);
c_query : BND.ICS.chars_ptr := BND.ICS.New_String (sql);
begin
stmt := BND.PQprepare (conn => conn.handle,
stmtName => c_stmt_name,
query => c_query,
nParams => 0,
paramTypes => null);
BND.ICS.Free (c_stmt_name);
BND.ICS.Free (c_query);
return (BND.PQresultStatus (stmt) = BND.PGRES_COMMAND_OK);
end prepare_statement;
------------------------
-- prepare_metadata --
------------------------
function prepare_metadata (conn : PostgreSQL_Connection;
meta : aliased out BND.PGresult_Access;
name : String) return Boolean
is
use type BND.ExecStatusType;
c_stmt_name : BND.ICS.chars_ptr := BND.ICS.New_String (name);
begin
meta := BND.PQdescribePrepared (conn => conn.handle,
stmtName => c_stmt_name);
BND.ICS.Free (c_stmt_name);
return (BND.PQresultStatus (meta) = BND.PGRES_COMMAND_OK);
end prepare_metadata;
----------------------
-- examine_result --
----------------------
function examine_result (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return postexec_status
is
begin
case BND.PQresultStatus (res) is
when BND.PGRES_COMMAND_OK =>
return executed;
when BND.PGRES_TUPLES_OK =>
return returned_data;
when others =>
return failed;
end case;
end examine_result;
------------------------
-- direst_stmt_exec --
------------------------
function direct_stmt_exec (conn : out PostgreSQL_Connection;
stmt : aliased out BND.PGresult_Access;
sql : String) return Boolean
is
use type BND.ExecStatusType;
query : BND.ICS.chars_ptr := BND.ICS.New_String (Str => sql);
success : Boolean;
msg : CT.Text;
ins_cmd : Boolean := False;
begin
if sql'Length > 12 and then
ACH.To_Upper (sql (sql'First .. sql'First + 6)) = "INSERT "
then
ins_cmd := True;
end if;
stmt := BND.PQexec (conn => conn.handle, command => query);
BND.ICS.Free (query);
case conn.examine_result (stmt) is
when executed =>
success := True;
conn.cmd_insert_return := False;
when returned_data =>
success := True;
conn.cmd_insert_return := ins_cmd;
when failed =>
success := False;
msg := CT.SUS (conn.driverMessage (stmt));
end case;
conn.insert_return_val := 0;
conn.cmd_sql_state := conn.SqlState (stmt);
if success then
conn.cmd_rows_impact := conn.rows_impacted (stmt);
else
conn.cmd_rows_impact := 0;
end if;
if conn.cmd_insert_return then
if not conn.field_is_null (stmt, 0, 0) then
declare
field : constant String := conn.field_string (stmt, 0, 0);
begin
conn.insert_return_val := Trax_ID (Integer'Value (field));
exception
when others => null;
end;
end if;
end if;
return success;
end direct_stmt_exec;
--------------------
-- piped_tables --
--------------------
function piped_tables (conn : PostgreSQL_Connection) return String
is
result : CT.Text := CT.blank;
procedure add (position : table_map.Cursor);
procedure add (position : table_map.Cursor) is
begin
if not CT.IsBlank (result) then
CT.SU.Append (result, '|');
end if;
CT.SU.Append (result, table_map.Element (position).column_1);
end add;
begin
conn.tables.Iterate (Process => add'Access);
return CT.USS (result);
end piped_tables;
-------------------------
-- refined_byte_type --
-------------------------
function refined_byte_type (byteX : field_types; constraint : String)
return field_types
is
-- This routine is not used!
-- by policy, byteX is ft_byte2, ft_byte3, ft_byte4 or ft_byte8
subtype max_range is Positive range 1 .. 4;
zero_required : constant String := "(VALUE >= 0)";
max_size : max_range;
begin
if CT.IsBlank (constraint) then
return byteX;
end if;
if not CT.contains (S => constraint, fragment => zero_required) then
return byteX;
end if;
case byteX is
when ft_byte8 => max_size := 4; -- NByte4
when ft_byte4 => max_size := 3; -- NByte3
when ft_byte3 => max_size := 2; -- NByte2
when others => max_size := 1; -- NByte1;
end case;
for x in max_range loop
declare
bits : constant Positive := x * 8;
limit1 : constant Positive := 2 ** bits;
limit2 : constant Positive := limit1 - 1;
check1 : constant String := "(VALUE <" & limit1'Img & ")";
check2 : constant String := "(VALUE <=" & limit2'Img & ")";
begin
if x <= max_size then
if CT.contains (S => constraint, fragment => check1) or else
CT.contains (S => constraint, fragment => check2)
then
case x is
when 1 => return ft_nbyte1;
when 2 => return ft_nbyte2;
when 3 => return ft_nbyte3;
when 4 => return ft_nbyte4;
end case;
end if;
end if;
end;
end loop;
return byteX;
end refined_byte_type;
-------------------------
-- convert_data_type --
-------------------------
function convert_data_type (pg_type : String; category : Character;
typelen : Integer; encoded_utf8 : Boolean)
return field_types
is
-- Code Category (typcategory)
-- A Array types
-- B Boolean types
-- C Composite types
-- D Date/time types
-- E Enum types
-- G Geometric types
-- I Network address types
-- N Numeric types
-- P Pseudo-types
-- S String types
-- T Timespan types
-- U User-defined types
-- V Bit-string types
-- X unknown type
desc : constant String := pg_type & " (" & category & ")";
string_type : field_types := ft_textual;
begin
-- One User-defined type, bytea, is a chain. Check for this one first
-- and treat the reast as strings
if pg_type = "bytea" then
return ft_chain;
end if;
if encoded_utf8 then
string_type := ft_utf8;
end if;
case category is
when 'A' => return ft_textual; -- No support for arrays yet
when 'B' => return ft_nbyte0;
when 'C' => return ft_textual; -- No support for composites yet
when 'D' => return ft_timestamp;
when 'E' => return ft_enumtype;
when 'G' => return ft_textual; -- unsupp native geom, not postgis!
when 'I' => return ft_textual;
when 'N' => null; -- Let numerics fall through
when 'S' => return string_type;
when 'T' => return ft_textual; -- Huge, 4/12/16 bytes
when 'U' =>
if pg_type = "geometry" then
-- PostGIS
return ft_geometry;
else
return ft_textual;
end if;
when 'V' => return ft_bits; -- String of 1/0 for now
when 'X' => raise METADATA_FAIL
with "Unknown type encountered: " & desc;
when 'P' => raise METADATA_FAIL
with "Pseudo-type encountered: " & desc;
when others => null;
end case;
-- Pick out standard float/double types from the remaining (numerics)
if pg_type = "real" then
return ft_real9;
elsif pg_type = "float4" then
return ft_real9;
elsif pg_type = "float8" then
return ft_real18;
elsif pg_type = "money" then
return ft_real18;
elsif pg_type = "decimal" then
return ft_real18;
elsif pg_type = "numeric" then
return ft_real18;
elsif pg_type = "double precision" then
return ft_real18;
elsif typelen = -1 then
return ft_real18;
end if;
if typelen = 1 then
return ft_byte1;
elsif typelen = 2 then
return ft_byte2;
elsif typelen = 3 then
return ft_byte3;
elsif typelen = 4 then
return ft_byte4;
elsif typelen = 8 then
return ft_byte8;
else
raise METADATA_FAIL
with "Unknown numeric type encountered: " & desc;
end if;
end convert_data_type;
------------------------
-- cache_data_types --
------------------------
procedure cache_data_types (conn : out PostgreSQL_Connection)
is
pgres : BND.PGresult_Access;
nrows : Affected_Rows;
tables : constant String := conn.piped_tables;
sql : constant String :=
"SELECT DISTINCT a.atttypid,t.typname,t.typlen,t.typcategory " &
"FROM pg_class c, pg_attribute a, pg_type t " &
"WHERE c.relname ~ '^(" & tables & ")$' " &
"AND a.attnum > 0 AND a.attrelid = c.oid " &
"AND a.atttypid = t.oid " &
"ORDER BY a.atttypid";
begin
pgres := conn.private_select (sql);
nrows := conn.rows_in_result (pgres);
for x in Natural range 0 .. Natural (nrows) - 1 loop
declare
s_oid : constant String := conn.field_string (pgres, x, 0);
s_name : constant String := conn.field_string (pgres, x, 1);
s_tlen : constant String := conn.field_string (pgres, x, 2);
s_cat : constant String := conn.field_string (pgres, x, 3);
s_cons : constant String := "";
typcat : constant Character := s_cat (s_cat'First);
typelen : constant Integer := Integer'Value (s_tlen);
payload : data_type_rec :=
(data_type => convert_data_type
(s_name, typcat, typelen, conn.encoding_is_utf8));
begin
conn.data_types.Insert (Key => Integer'Value (s_oid),
New_Item => payload);
end;
end loop;
BND.PQclear (pgres);
end cache_data_types;
--------------------
-- field_binary --
--------------------
function field_binary (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
row_number : Natural;
column_number : Natural;
max_length : Natural) return String
is
rownum : constant BND.IC.int := BND.IC.int (row_number);
colnum : constant BND.IC.int := BND.IC.int (column_number);
result : BND.ICS.chars_ptr := BND.PQgetvalue (res, rownum, colnum);
len : Natural := conn.field_length (res, row_number, column_number);
begin
declare
bufmax : constant BND.IC.size_t := BND.IC.size_t (max_length);
subtype data_buffer is BND.IC.char_array (1 .. bufmax);
type db_access is access all data_buffer;
buffer : aliased data_buffer;
function db_convert (dba : db_access; size : Natural) return String;
function db_convert (dba : db_access; size : Natural) return String
is
max : Natural := size;
begin
if max > max_length then
max := max_length;
end if;
declare
result : String (1 .. max);
begin
for x in result'Range loop
result (x) := Character (dba.all (BND.IC.size_t (x)));
end loop;
return result;
end;
end db_convert;
begin
return db_convert (buffer'Access, len);
end;
end field_binary;
--------------------
-- field_chain --
--------------------
function field_chain (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
row_number : Natural;
column_number : Natural;
max_length : Natural) return String
is
-- raw expected in format "/x[hex-byte][hex-byte]...[hex-byte]"
raw : String := conn.field_string (res, row_number, column_number);
maxlen : Natural := raw'Length / 2;
staged : String (1 .. maxlen) := (others => '_');
arrow : Natural := raw'First;
terminus : Natural := raw'Last;
marker : Natural := 0;
begin
if CT.len (raw) < 4 then
return "";
end if;
arrow := arrow + 2; -- skip past "/x"
loop
marker := marker + 1;
if arrow + 1 > terminus then
-- format error! Odd length should never happen
-- replace with zero and eject
staged (marker) := Character'Val (0);
exit;
end if;
declare
hex : constant hexbyte := raw (arrow .. arrow + 1);
begin
staged (marker) := convert_hexbyte_to_char (hex);
arrow := arrow + 2;
end;
exit when arrow > terminus;
exit when marker = max_length;
end loop;
return staged (1 .. marker);
end field_chain;
---------------------
-- markers_found --
---------------------
function markers_found (conn : PostgreSQL_Connection;
res : BND.PGresult_Access) return Natural
is
result : constant BND.IC.int := BND.PQnparams (res);
begin
return (Natural (result));
end markers_found;
-------------------------
-- destroy_statement --
-------------------------
function destroy_statement (conn : out PostgreSQL_Connection;
name : String) return Boolean
is
sql : constant String := "DEALLOCATE " & name;
begin
if conn.prop_active then
conn.private_execute (sql);
end if;
return True;
exception
when QUERY_FAIL =>
return False;
end destroy_statement;
--------------------------------
-- execute_prepared_stmt #1 --
--------------------------------
function execute_prepared_stmt (conn : PostgreSQL_Connection;
name : String;
data : parameter_block)
return BND.PGresult_Access
is
subtype param_range is Positive range 1 .. data'Length;
nParams : constant BND.IC.int := BND.IC.int (data'Length);
resultFormat : constant BND.IC.int := 0; -- specify text results
stmtName : BND.ICS.chars_ptr := BND.ICS.New_String (name);
paramValues : BND.Param_Val_Array (param_range);
paramLengths : BND.Param_Int_Array (param_range);
paramFormats : BND.Param_Int_Array (param_range);
need_free : array (param_range) of Boolean;
pgres : BND.PGresult_Access;
datalen : Natural;
begin
for x in paramLengths'Range loop
datalen := CT.len (data (x).payload);
paramLengths (x) := BND.IC.int (datalen);
if data (x).binary then
paramFormats (x) := BND.IC.int (1);
if data (x).is_null then
need_free (x) := False;
paramValues (x).buffer := null;
else
need_free (x) := True;
declare
Str : constant String := CT.USS (data (x).payload);
bsz : BND.IC.size_t := BND.IC.size_t (datalen);
begin
paramValues (x).buffer := new BND.IC.char_array (1 .. bsz);
paramValues (x).buffer.all := BND.IC.To_C (Str, False);
end;
end if;
else
paramFormats (x) := BND.IC.int (0);
if data (x).is_null then
need_free (x) := False;
paramValues (x).buffer := null;
else
declare
use type BND.IC.size_t;
Str : constant String := CT.USS (data (x).payload);
bsz : BND.IC.size_t := BND.IC.size_t (datalen) + 1;
begin
paramValues (x).buffer := new BND.IC.char_array (1 .. bsz);
paramValues (x).buffer.all := BND.IC.To_C (Str, True);
end;
end if;
end if;
end loop;
pgres := BND.PQexecPrepared
(conn => conn.handle,
stmtName => stmtName,
nParams => nParams,
paramValues => paramValues (1)'Unchecked_Access,
paramLengths => paramLengths (1)'Unchecked_Access,
paramFormats => paramFormats (1)'Unchecked_Access,
resultFormat => resultFormat);
BND.ICS.Free (stmtName);
for x in need_free'Range loop
if need_free (x) then
free_binary (paramValues (x).buffer);
end if;
end loop;
-- Let the caller check the state of pgres, just return it as is
return pgres;
end execute_prepared_stmt;
--------------------------------
-- execute_prepared_stmt #2 --
--------------------------------
function execute_prepared_stmt (conn : PostgreSQL_Connection;
name : String) return BND.PGresult_Access
is
resultFormat : constant BND.IC.int := 0; -- specify text results
stmtName : BND.ICS.chars_ptr := BND.ICS.New_String (name);
pgres : BND.PGresult_Access;
begin
pgres := BND.PQexecPrepared
(conn => conn.handle,
stmtName => stmtName,
nParams => 0,
paramValues => null,
paramLengths => null,
paramFormats => null,
resultFormat => resultFormat);
BND.ICS.Free (stmtName);
-- Let the caller check the state of pgres, just return it as is
return pgres;
end execute_prepared_stmt;
---------------------
-- destroy_later --
---------------------
procedure destroy_later (conn : out PostgreSQL_Connection;
identifier : Trax_ID) is
begin
conn.stmts_to_destroy.Append (New_Item => identifier);
end destroy_later;
-----------------------
-- holds_refcursor --
------------------------
function holds_refcursor (conn : PostgreSQL_Connection;
res : BND.PGresult_Access;
column_number : Natural) return Boolean
is
use type BND.Oid;
colnum : constant BND.IC.int := BND.IC.int (column_number);
pg_oid : BND.Oid := BND.PQftype (res, colnum);
begin
return (pg_oid = BND.PG_TYPE_refcursor);
end holds_refcursor;
-----------------------------
-- convert_octet_to_char --
-----------------------------
function convert_octet_to_char (before : octet) return Character
is
function digit (raw : Character) return Natural;
-- This convert function does no error checking, it expects to receive
-- valid octal numbers. It will no throw an error if illegal
-- characters are found, but rather it will return something value.
function digit (raw : Character) return Natural is
begin
case raw is
when '0' .. '7' => return Character'Pos (raw) - 48;
when others => return 0;
end case;
end digit;
begin
return Character'Val (digit (before (3)) +
digit (before (2)) * 8 +
digit (before (1)) * 64);
end convert_octet_to_char;
-------------------------------
-- convert_hexbyte_to_char --
-------------------------------
function convert_hexbyte_to_char (before : hexbyte) return Character
is
function digit (raw : Character) return Natural;
-- This convert function does no error checking, it expects to receive
-- valid octal numbers. It will no throw an error if illegal
-- characters are found, but rather it will return something value.
function digit (raw : Character) return Natural is
begin
case raw is
when '0' .. '9' => return Character'Pos (raw) -
Character'Pos ('0');
when 'A' .. 'F' => return Character'Pos (raw) + 10 -
Character'Pos ('A');
when 'a' .. 'f' => return Character'Pos (raw) + 10 -
Character'Pos ('a');
when others => return 0;
end case;
end digit;
begin
return Character'Val (digit (before (2)) +
digit (before (1)) * 16);
end convert_hexbyte_to_char;
----------------------------------
-- establish_uniform_encoding --
----------------------------------
procedure establish_uniform_encoding (conn : out PostgreSQL_Connection)
is
sql : constant String := "SET CLIENT_ENCODING TO '" &
CT.USS (conn.character_set) & "'";
begin
if conn.prop_active then
if not CT.IsBlank (conn.character_set) then
execute (conn => conn, sql => sql);
end if;
end if;
exception
when QUERY_FAIL =>
raise CHARSET_FAIL with sql;
end establish_uniform_encoding;
-------------------------
-- set_character_set --
-------------------------
overriding
procedure set_character_set (conn : out PostgreSQL_Connection;
charset : String) is
begin
if conn.prop_active then
raise NOT_WHILE_CONNECTED
with "You may only alter the character set prior to connection";
end if;
conn.character_set := CT.SUS (charset);
end set_character_set;
---------------------
-- character_set --
---------------------
overriding
function character_set (conn : out PostgreSQL_Connection) return String is
begin
if conn.prop_active then
conn.dummy := True;
declare
pgres : BND.PGresult_Access;
begin
-- private_select can raise exception, but don't catch it
pgres := conn.private_select ("SHOW CLIENT_ENCODING");
if conn.field_is_null (pgres, 0, 0) then
-- This should never happen
BND.PQclear (pgres);
return "UNEXPECTED: encoding not set";
end if;
declare
field : constant String := conn.field_string (pgres, 0, 0);
begin
BND.PQclear (pgres);
return field;
end;
end;
else
return CT.USS (conn.character_set);
end if;
end character_set;
---------------------------------
-- retrieve_uniform_encoding --
---------------------------------
procedure retrieve_uniform_encoding (conn : out PostgreSQL_Connection)
is
charset : String := character_set (conn => conn);
charsetuc : String := ACH.To_Upper (charset);
begin
conn.encoding_is_utf8 := (charsetuc = "UTF8");
conn.character_set := CT.SUS (charset);
end retrieve_uniform_encoding;
end AdaBase.Connection.Base.PostgreSQL;
|
oeis/002/A002971.asm | neoneye/loda-programs | 11 | 21538 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A002971: Numbers k such that 4*k^2 + 25 is prime.
; Submitted by <NAME>
; 1,2,3,4,8,9,11,12,13,14,16,17,18,21,23,26,29,34,36,37,38,47,48,49,51,53,54,56,62,63,66,67,68,69,73,74,77,79,82,83,91,99,101,102,103,107,108,114,116,118,122,131,134,141,142,147,148,151,154,156,157,158,159,164,167,168,169,171,172,178,179,183,184,187,191,192,193,196,198,199,206,208,209,212,213,216,218,221,222,223,226,229,238,239,242,251,252,257,258,264
mov $2,332203
mov $5,24
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $5,$1
add $1,4
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
mov $6,$5
lpe
mov $0,$1
div $0,4
|
source/oasis/program-element_vectors.ads | optikos/oasis | 0 | 21508 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Iterator_Interfaces;
with Program.Elements;
with Program.Lexical_Elements;
package Program.Element_Vectors is
pragma Pure (Program.Element_Vectors);
type Element_Vector is limited interface;
-- Vector of elements
type Element_Vector_Access is access all Element_Vector'Class
with Storage_Size => 0;
not overriding function Get_Length (Self : Element_Vector)
return Positive is abstract;
-- Number of elements in the vector. Not null vector has at least one item.
function Length (Self : access Element_Vector'Class)
return Natural is (if Self = null then 0 else Self.Get_Length);
-- Return number of elements in the vector
function Is_Empty (Self : access Element_Vector'Class)
return Boolean is (Self = null);
-- Check if the vector is empty
not overriding function Element
(Self : Element_Vector;
Index : Positive)
return not null Program.Elements.Element_Access is abstract;
-- Return an element of the vector
not overriding function Delimiter
(Self : Element_Vector;
Index : Positive)
return Program.Lexical_Elements.Lexical_Element_Access is abstract
with Post'Class =>
(if Index = Self.Get_Length then Delimiter'Result in null);
-- Return a delimiter token after an element of the vector
type Element_Cursor is record
Element : Program.Elements.Element_Access;
-- An element of the vector for given cursor
Delimiter : Program.Lexical_Elements.Lexical_Element_Access;
-- A delimiter after the element pointed by the cursor
Index : Natural;
-- Position in the vector, starting from one
Is_Last : Boolean;
-- Set if the cursor points to the last element in the list
end record;
function Has_Element (Self : Element_Cursor) return Boolean
is (Self.Element.Assigned);
-- Check if the cursor points an element
package Iterators is new Ada.Iterator_Interfaces
(Element_Cursor, Has_Element);
type Iterator is new Iterators.Reversible_Iterator with private;
overriding function First
(Self : Iterator) return Program.Element_Vectors.Element_Cursor;
overriding function Next
(Self : Iterator;
Cursor : Program.Element_Vectors.Element_Cursor)
return Program.Element_Vectors.Element_Cursor;
overriding function Last
(Self : Iterator) return Program.Element_Vectors.Element_Cursor;
overriding function Previous
(Self : Iterator;
Cursor : Program.Element_Vectors.Element_Cursor)
return Program.Element_Vectors.Element_Cursor;
type Element_Checker is access
function (Self : Program.Elements.Element'Class) return Boolean;
function Each_Element
(Self : access Element_Vector'Class;
When_Element : Element_Checker := null) return Iterator;
-- Return an iterator to enumerate elements in the Vector which satisfy
-- given condition, if provided
private
type Iterator is new Iterators.Reversible_Iterator with record
Vector : access constant Element_Vector'Class;
Condition : Element_Checker;
end record;
end Program.Element_Vectors;
|
oeis/204/A204002.asm | neoneye/loda-programs | 11 | 85518 | ; A204002: Symmetric matrix based on f(i,j)=min{2i+j,i+2j}, by antidiagonals.
; Submitted by <NAME>(s4)
; 3,4,4,5,6,5,6,7,7,6,7,8,9,8,7,8,9,10,10,9,8,9,10,11,12,11,10,9,10,11,12,13,13,12,11,10,11,12,13,14,15,14,13,12,11,12,13,14,15,16,16,15,14,13,12,13,14,15,16,17,18,17,16,15,14,13,14,15,16,17,18,19,19
lpb $0
add $2,1
sub $0,$2
mov $1,$2
sub $1,$0
lpe
min $1,$0
add $2,$1
mov $0,$2
add $0,3
|
test/golang/bug-901.output.asm | johnmcfarlane/compiler-explorer | 2 | 22470 | .file 1 "test.go"
.loc 1 3 0
text "".Fun(SB), NOSPLIT, $0-0
funcdata $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
funcdata $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
xorl AX, AX
.loc 1 4 0
jmp 7
incq AX
cmpq AX, $10
jlt 4
ret |
src/game/over.asm | danielg0/yatzy-gb | 0 | 2120 | <gh_stars>0
INCLUDE "hardware.inc"
INCLUDE "macros.inc"
SECTION "Over", ROM0
; draw game over message
; draw's over the game roll and held columns, whilst preserving the scored
; categories, their values as well as the score and highscore columns
DrawGameOver::
; copying of string to screen is inlined to save cycles
AT _SCRN0, 1, 1
DEF I = 0
REPT 18
; strings in rgbds are one-indexed
DEF I = I + 1
; take a single character from LINE1
ld a, STRSUB("GAME A - NEW GAME", I, 1)
; draw to screen
ldi [hl], a
ENDR
AT _SCRN0, 1, 2
DEF I = 0
REPT 14
DEF I = I + 1
ld a, STRSUB("OVER B - MENU", I, 1)
ldi [hl], a
ENDR
ret
; cleanup game over message
CleanupGameOver::
xor a ; ld a, $00
AT _SCRN0, 1, 1
REPT 18
ld [hl], a
inc hl
ENDR
AT _SCRN0, 1, 2
REPT 18
ld [hl], a
inc hl
ENDR
ret
|
MIPS/projects/Project 2/utils.asm | Enkrona/CompOrg44-345 | 0 | 93419 | <reponame>Enkrona/CompOrg44-345
# File: utils.asm
# Purpose: To define utilities which will be used in MIPS programs.
# Author: <NAME>
#
# Instructors are granted permission to make copies of this file
# for use by # students in their courses. Title to and ownership
# of all intellectual property rights
# in this file are the exclusive property of
# <NAME>, Gettysburg, Pa.
#
# Subprograms Index:
# Exit - Call syscall with a server 10 to exit the program
# NewLine - Print a new line character (\n) to the console
# PrintInt - Print a string with an integer to the console
# PrintString - Print a string to the console
# PromptInt - Prompt the user to enter an integer, and return
# it to the calling program.
#
# Modification History
# 12/27/2014 - Initial release
# subprogram: PrintNewLine
# author: <NAME>
# purpose: to output a new line to the user console
# input: None
# output: None
# side effects: A new line character is printed to the
# user's console
.text
PrintNewLine:
li $v0, 4
la $a0, __PNL_newline
syscall
jr $ra
.data
__PNL_newline: .asciiz "\n"
# subprogram: PrintInt
# author: <NAME>
# purpose: To print a string to the console
# input: $a0 - The address of the string to print.
# $a1 - The value of the int to print
# returns: None
# side effects: The String is printed followed by the integer value.
.text
PrintInt:
# Print string. The string address is already in $a0
li $v0, 4
syscall
# Print integer. The integer value is in $a1, and must
# be first moved to $a0.
move $a0, $a1
li $v0, 1
syscall
#return
jr $ra
# subprogram: PromptInt
# author: <NAME>
# purpose: To print the user for an integer input, and
# to return that input value to the caller.
# input: $a0 - The address of the string to print.
# returns: $v0 - The value the user entered
# side effects: The String is printed followed by the integer value.
.text
PromptInt:
# Print the prompt, which is already in $a0
li $v0, 4
syscall
# Read the integer value. Note that at the end of the
# syscall the value is already in $v0, so there is no
# need to move it anywhere.
move $a0, $a1
li $v0, 5
syscall
#return
jr $ra
# subprogram: PrintString
# author: <NAME>
# purpose: To print a string to the console
# input: $a0 - The address of the string to print.
# returns: None
# side effects: The String is printed to the console.
.text
PrintString:
addi $v0, $zero, 4
syscall
jr $ra
# subprogram: PromptStringIn
# author: <NAME>
# purpose: To take input after printing a string (basically once a prompt has been printed it will take in the next input from user)
# input: $a0 - The address of the string to print.
# returns: $input, - The value the user entered
# side effects: The String is printed to the console, and user input stored in $v0
PromptStringIn:
li $v0, 4 # Printing the String that is input
syscall
li $v0, 8 # Storing result in "input" and max of $a1 size
la $a0, input
lw $a1, inputMax
syscall
# returning to where it came from
jr $ra
# subprogram: NAND
# author: <NAME>
# purpose: to NAND two values that are input
# inputs: $t0, $t1 used for each num to NAND
# outputs: $t3
# returns the value of the NAND operation
# which in this case is an AND, then a NOR
.text
NAND:
and $t4, $t0, $t1 # combines the nums
nor $t3, $t4, $t4 # nors the numbers serving as a NAND
jr $ra
# subprogram: Multiplyby10
# author: <NAME>
# purpose: to multiply a num by 10
# inputs: $t0
# outputs: $t1
# returns: the value of the input times 10
.text
multiplyby10:
add $t1, $t0, $t0 # num times 2 (x2)
add $t1, $t1, $t0 # double num + num (x3)
add $t1, $t1, $t0 # triple num + num (x4)
add $t1, $t1, $t0 # quadruple num + num (x5)
add $t1, $t1, $t1 # quintuple num + quintuple num (x10 effect)
jr $ra
# subprogram: equationSolve
# author: <NAME>
# purpose: to solve an equation
# inputs: $a0-$a3
# outputs: $v0
# returns: the value of the inputs when solving the equation
.text
equationSolve:
mul $t7, $a3, $a3 # squares x ($a3) and stores in $t7
mul $t7, $t0, $t7 # multiplies x^2($t7) and a ($a0) and stores in $t7
mul $t6, $a1, $a3 # multiplies b ($a1) and x ($a3) and stores in $t6
add $t7, $t7, $t6 # adds a*x^2 ($t7) and bx ($t6) stores back in $t7
add $t0, $t7, $a2 # adds ax^2 + bx and c and stores in $v0
move $v0, $t0 # stores result of equation in $v0 for printing
jr $ra
# subprogram: average
# author: <NAME>
# purpose: to find average value of 4 nums
# inputs: $a0-$a3
# outputs: $v0
# returns the average value of the numbers input
#
.text
average:
li $t7, 4 # loads value of 4
add $t5, $a0, $a1 # adding nums 1,2
add $t6, $a2, $a3 # adding nums 3,4 to (1+2)
add $t5, $t5, $t6 # adding (1+2) + (3+4) stores in $t5
div $t5, $t7 # dividing by 4 and storing value in $v0 for output
mflo $v0 # putting result in $v0
# returning to main
jr $ra
# subprogram: Exit
# author: <NAME>
# purpose: to use syscall service 10 to exit a program
# input: None
# output: None
# side effects: The program is exited
.text
Exit:
li $v0, 10
syscall
|
library/src/main/antlr4/net/alagris/UNIXGrammar.g4 | aleksander-mendoza/SolomonoffLib | 6 | 2900 | <reponame>aleksander-mendoza/SolomonoffLib<gh_stars>1-10
grammar UNIXGrammar;
regExp : branch ( '|' branch )* ;
branch : piece* ;
piece : atom quantifier? ;
quantifier : Quantifiers | '{'quantity'}' ;
quantity : quantRange | quantMin | quantExact ;
quantRange : quantExact ',' quantExact ;
quantMin : quantExact ',' ;
atom : normalChar | '(' regExp ')' ;
normalChar : NormalChar | Digit ;
quantExact : Digit+ ;
Digit : [0-9] ;
NormalChar : ~[.\\?*+{}()|[\]] ;
Quantifiers : [?*+] ; |
src/ewok-perm.ads | vdh-anssi/ewok-kernel | 65 | 29439 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - Arnauld Michelizza
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with config.applications; use config.applications;
with ewok.perm_auto;
with ewok.tasks_shared; use ewoK.tasks_shared;
package ewok.perm
with spark_mode => on
is
---------------
-- Types --
---------------
type t_perm_name is
(PERM_RES_DEV_DMA,
PERM_RES_DEV_CRYPTO_USR,
PERM_RES_DEV_CRYPTO_CFG,
PERM_RES_DEV_CRYPTO_FULL,
PERM_RES_DEV_BUSES,
PERM_RES_DEV_EXTI,
PERM_RES_DEV_TIM,
PERM_RES_TIM_GETMILLI,
PERM_RES_TIM_GETMICRO,
PERM_RES_TIM_GETCYCLE,
PERM_RES_TSK_FISR,
PERM_RES_TSK_FIPC,
PERM_RES_TSK_RESET,
PERM_RES_TSK_UPGRADE,
PERM_RES_TSK_RNG,
PERM_RES_MEM_DYNAMIC_MAP);
---------------
-- Functions --
---------------
pragma assertion_policy (pre => IGNORE, post => IGNORE, assert => IGNORE);
-- Test if a task is allowed to share a DMA SHM with another task
function dmashm_is_granted
(from : in t_real_task_id;
to : in t_real_task_id)
return boolean
with
Global => null, -- com_dmashm_perm is a constant, not a variable
Post => (if (from = to) then dmashm_is_granted'Result = false),
Contract_Cases => (ewok.perm_auto.com_dmashm_perm(from,to) => dmashm_is_granted'Result,
others => not dmashm_is_granted'Result);
-- Test if a task is allowed to send an IPC to another task
function ipc_is_granted
(from : in t_real_task_id;
to : in t_real_task_id)
return boolean
with
Global => null, -- com_ipc_perm is a constant, not a variable
Post => (if (from = to) then ipc_is_granted'Result = false),
Contract_Cases => (ewok.perm_auto.com_ipc_perm(from,to) => ipc_is_granted'Result,
others => not ipc_is_granted'Result);
#if CONFIG_KERNEL_DOMAIN
function is_same_domain
(from : in t_real_task_id;
to : in t_real_task_id)
return boolean
with
Global => null,
Post => (if (from = to) then is_same_domain'Result = false);
#end if;
-- Test if a task is allowed to use a resource
function ressource_is_granted
(perm_name : in t_perm_name;
task_id : in config.applications.t_real_task_id)
return boolean
with Global => null;
end ewok.perm;
|
programs/oeis/217/A217367.asm | karttu/loda | 0 | 101821 | <reponame>karttu/loda
; A217367: a(n) = ((n+7) / gcd(n+7,4)) * (n / gcd(n,4)).
; 0,2,9,15,11,15,39,49,30,36,85,99,57,65,147,165,92,102,225,247,135,147,319,345,186,200,429,459,245,261,555,589,312,330,697,735,387,407,855,897,470,492,1029,1075,561,585,1219,1269,660,686,1425,1479,767,795,1647,1705,882,912,1885,1947,1005,1037,2139,2205,1136,1170,2409,2479,1275,1311,2695,2769,1422,1460,2997,3075,1577,1617,3315,3397,1740,1782,3649,3735,1911,1955,3999,4089,2090,2136,4365,4459,2277,2325,4747,4845,2472,2522,5145,5247,2675,2727,5559,5665,2886,2940,5989,6099,3105,3161,6435,6549,3332,3390,6897,7015,3567,3627,7375,7497,3810,3872,7869,7995,4061,4125,8379,8509,4320,4386,8905,9039,4587,4655,9447,9585,4862,4932,10005,10147,5145,5217,10579,10725,5436,5510,11169,11319,5735,5811,11775,11929,6042,6120,12397,12555,6357,6437,13035,13197,6680,6762,13689,13855,7011,7095,14359,14529,7350,7436,15045,15219,7697,7785,15747,15925,8052,8142,16465,16647,8415,8507,17199,17385,8786,8880,17949,18139,9165,9261,18715,18909,9552,9650,19497,19695,9947,10047,20295,20497,10350,10452,21109,21315,10761,10865,21939,22149,11180,11286,22785,22999,11607,11715,23647,23865,12042,12152,24525,24747,12485,12597,25419,25645,12936,13050,26329,26559,13395,13511,27255,27489,13862,13980,28197,28435,14337,14457,29155,29397,14820,14942,30129,30375,15311,15435,31119,31369,15810,15936
mov $2,6
add $2,$0
mov $5,$0
add $0,2
add $2,1
mul $2,$5
mov $3,-45
mov $4,$2
mov $6,-47
lpb $0,1
pow $0,$3
sub $0,1
div $4,2
mov $3,$4
lpe
mov $0,$3
sub $0,$6
sub $0,1
mov $1,$0
sub $1,46
|
programs/oeis/304/A304614.asm | karttu/loda | 1 | 92820 | <reponame>karttu/loda
; A304614: a(n) = 420*2^n - 222.
; 198,618,1458,3138,6498,13218,26658,53538,107298,214818,429858,859938,1720098,3440418,6881058,13762338,27524898,55050018,110100258,220200738,440401698,880803618,1761607458,3523215138,7046430498,14092861218,28185722658,56371445538,112742891298,225485782818,450971565858,901943131938,1803886264098,3607772528418,7215545057058,14431090114338,28862180228898,57724360458018,115448720916258,230897441832738,461794883665698,923589767331618,1847179534663458,3694359069327138,7388718138654498
mov $1,2
pow $1,$0
sub $1,1
mul $1,420
add $1,198
|
libs/cppExtensions/tests/mac/cppextensions_quicktests.applescript | jurocha-ms/Mso | 38 | 2868 | property XLib : missing value
property APITestlib : missing value
property title : "cppextensions liblet quick tests" --Name of the test
property targets : {""}
property testCaseID : 0
on PreTest()
set my APITestlib to XLib's LoadLibrary("APITestLib.scpt")
APITestlib's initLib(XLib)
return true
end PreTest
on mainTest()
-- specify the test DLL Name containing tests to be executed
APITestlib's setTestDLLName("cppextensionsTest_mac.dylib")
-- Set the execution mode to whole group
APITestlib's setTestMode("Test")
APITestlib's executeTests()
APITestlib's clearSpecificGroups()
end mainTest
on run
set XLibPath to do shell script "defaults read com.microsoft.macbu.automation XLibPath"
set my XLib to load script POSIX file XLibPath
my XLib's ExecuteScript(me)
end run |
src/response_helpers.adb | psyomn/ash | 11 | 8540 | -- Copyright 2019 <NAME> (psyomn)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Calendar;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with GNAT.Calendar.Time_IO;
with Common_Utils; use Common_Utils;
package body Response_Helpers is
function Headers (Status : HTTP_Status.Code) return String is
Content_Type : constant String :=
"Content-Type: text/html; charset=iso-8859-1";
begin
return
First_Header_Line (Status) &
Response_Date & CRLF &
"Server: ash" & CRLF &
Content_Type & CRLF &
"Content-Length: ";
end Headers;
function Response_Date return String is
package ac renames Ada.Calendar;
package gct renames GNAT.Calendar.Time_IO;
Current_Time : constant ac.Time := ac.Clock;
Format : constant gct.Picture_String :=
"%a, %d %B %Y %H:%M:%S EST";
Field_Name : constant String := "Date: ";
Result : constant String :=
Field_Name & gct.Image (Current_Time, Format);
begin
return Result;
end Response_Date;
function Make_Response
(Status : HTTP_Status.Code; S : String) return String is
Length : constant Positive := S'Length;
Length_Str : constant String := Trim (
Source => Positive'Image (Length),
Side => Both
);
begin
return
Headers (Status) & Length_Str &
CRLF &
CRLF &
S;
end Make_Response;
function First_Header_Line (Status : HTTP_Status.Code) return String is
use HTTP_Status;
Status_Str : constant String :=
Integer_To_Trimmed_String (Integer (Status));
Message : constant String := Message_Of_Code (Status);
HTTP_Version : constant String := "1.0";
Result : constant String :=
"HTTP/" & HTTP_Version & " " & Status_Str & " " & Message & CRLF;
begin
return Result;
end First_Header_Line;
end Response_Helpers;
|
programs/oeis/141/A141960.asm | neoneye/loda | 22 | 2020 | ; A141960: Primes congruent to 19 mod 27.
; 19,73,127,181,397,613,829,883,937,991,1153,1423,1531,1693,1747,1801,2017,2179,2287,2341,2503,2557,2719,3259,3313,3529,3583,3637,3691,3853,3907,4177,4231,4339,4447,4663,4933,4987,5419,5527,5581,5689,5743,5851,6067,6121,6229,6337,6553,6607,6661,6823,7039,7309,7417,7687,7741,8011,8389,8443,8713,8821,8929,9091,9199,9631,9739,9901,10009,10333,10657,10711,11197,11251,11467,11953,12007,12277,12547,12601,12763,12979,13033,13249,13411,13627,13681,13789,14221,14437,14653,14869,14923,15031,15139,15193,15679,15733,15787,16057
mov $2,$0
add $2,1
pow $2,2
lpb $2
add $1,18
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,9
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
sub $1,22
mul $1,2
add $1,37
mov $0,$1
|
agda-stdlib/src/Relation/Nullary/Product.agda | DreamLinuxer/popl21-artifact | 5 | 1968 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Products of nullary relations
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Relation.Nullary.Product where
open import Data.Bool.Base
open import Data.Product
open import Function
open import Level
open import Relation.Nullary.Reflects
open import Relation.Nullary
private
variable
p q : Level
P : Set p
Q : Set q
------------------------------------------------------------------------
-- Some properties which are preserved by _×_.
infixr 2 _×-reflects_ _×-dec_
_×-reflects_ : ∀ {bp bq} → Reflects P bp → Reflects Q bq →
Reflects (P × Q) (bp ∧ bq)
ofʸ p ×-reflects ofʸ q = ofʸ (p , q)
ofʸ p ×-reflects ofⁿ ¬q = ofⁿ (¬q ∘ proj₂)
ofⁿ ¬p ×-reflects _ = ofⁿ (¬p ∘ proj₁)
_×-dec_ : Dec P → Dec Q → Dec (P × Q)
does (p? ×-dec q?) = does p? ∧ does q?
proof (p? ×-dec q?) = proof p? ×-reflects proof q?
|
src/test/resources/dummy/TestGrammarParser.g4 | mcpeluz/antlr4test-maven-plugin | 14 | 1030 | parser grammar TestGrammarParser;
options {
tokenVocab = TestGrammarLexer;
}
attrib_list
: attrib+ EOF
;
attrib
:
variable_name EQUAL function OPEN_PAREN variable_name? CLOSE_PAREN
;
variable_name
:
ID
;
function
: FA
| FB
| FC
| FD
; |
source/xml/sax/xml-sax-readers.ads | svn2github/matreshka | 24 | 2097 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2014, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- Abstract interface of XML reader.
------------------------------------------------------------------------------
with League.Strings;
with XML.SAX.Content_Handlers;
with XML.SAX.Declaration_Handlers;
with XML.SAX.DTD_Handlers;
with XML.SAX.Entity_Resolvers;
with XML.SAX.Error_Handlers;
with XML.SAX.Lexical_Handlers;
package XML.SAX.Readers is
pragma Preelaborate;
type SAX_Content_Handler_Access is
access all XML.SAX.Content_Handlers.SAX_Content_Handler'Class;
type SAX_Declaration_Handler_Access is
access all XML.SAX.Declaration_Handlers.SAX_Declaration_Handler'Class;
type SAX_DTD_Handler_Access is
access all XML.SAX.DTD_Handlers.SAX_DTD_Handler'Class;
type SAX_Error_Handler_Access is
access all XML.SAX.Error_Handlers.SAX_Error_Handler'Class;
type SAX_Lexical_Handler_Access is
access all XML.SAX.Lexical_Handlers.SAX_Lexical_Handler'Class;
type SAX_Entity_Resolver_Access is
access all XML.SAX.Entity_Resolvers.SAX_Entity_Resolver'Class;
type SAX_Reader is limited interface;
not overriding function Content_Handler
(Self : SAX_Reader) return SAX_Content_Handler_Access is abstract;
-- Returns the current content handler, or null if none has been
-- registered.
not overriding function Declaration_Handler
(Self : SAX_Reader) return SAX_Declaration_Handler_Access is abstract;
-- Returns the current declaration handler, or null if has not been
-- registered.
not overriding function DTD_Handler
(Self : SAX_Reader) return SAX_DTD_Handler_Access is abstract;
-- Returns the current DTD handler, or null if none has been registered.
not overriding function Entity_Resolver
(Self : SAX_Reader) return SAX_Entity_Resolver_Access is abstract;
-- Returns the current entity resolver, or null if none has been
-- registered.
not overriding function Error_Handler
(Self : SAX_Reader) return SAX_Error_Handler_Access is abstract;
-- Returns the current error handler, or null if none has been registered.
not overriding function Feature
(Self : SAX_Reader;
Name : League.Strings.Universal_String) return Boolean is abstract;
-- Look up the value of a feature flag. Returns value of the feature or
-- false if feature is not recognized or not acceptable at this time.
--
-- The feature name is any fully-qualified URI. It is possible for an
-- XMLReader to recognize a feature name but temporarily be unable to
-- return its value. Some feature values may be available only in specific
-- contexts, such as before, during, or after a parse. Also, some feature
-- values may not be programmatically accessible.
--
-- All Readers are required to recognize the
-- http://xml.org/sax/features/namespaces and the
-- http://xml.org/sax/features/namespace-prefixes feature names.
not overriding function Has_Feature
(Self : SAX_Reader;
Name : League.Strings.Universal_String) return Boolean is abstract;
-- Returns True if the reader has the feature called Name; otherwise
-- returns False.
not overriding function Lexical_Handler
(Self : SAX_Reader) return SAX_Lexical_Handler_Access is abstract;
-- Returns the current lexical handler, or null if none has been
-- registered.
not overriding procedure Set_Content_Handler
(Self : in out SAX_Reader;
Handler : SAX_Content_Handler_Access) is abstract;
not overriding procedure Set_Declaration_Handler
(Self : in out SAX_Reader;
Handler : SAX_Declaration_Handler_Access) is abstract;
not overriding procedure Set_DTD_Handler
(Self : in out SAX_Reader;
Handler : SAX_DTD_Handler_Access) is abstract;
not overriding procedure Set_Entity_Resolver
(Self : in out SAX_Reader;
Resolver : SAX_Entity_Resolver_Access) is abstract;
not overriding procedure Set_Error_Handler
(Self : in out SAX_Reader;
Handler : SAX_Error_Handler_Access) is abstract;
not overriding procedure Set_Feature
(Self : in out SAX_Reader;
Name : League.Strings.Universal_String;
Value : Boolean) is abstract;
-- Set the value of a feature flag.
--
-- The feature name is any fully-qualified URI. It is possible for an
-- XMLReader to expose a feature value but to be unable to change the
-- current value. Some feature values may be immutable or mutable only in
-- specific contexts, such as before, during, or after a parse.
--
-- All XMLReaders are required to support setting
-- http://xml.org/sax/features/namespaces to true and
-- http://xml.org/sax/features/namespace-prefixes to false.
not overriding procedure Set_Lexical_Handler
(Self : in out SAX_Reader;
Handler : SAX_Lexical_Handler_Access) is abstract;
end XML.SAX.Readers;
|
src/interface/cl-queueing.ads | flyx/OpenCLAda | 8 | 11461 | <gh_stars>1-10
--------------------------------------------------------------------------------
-- Copyright (c) 2013, <NAME> <<EMAIL>>
--
-- 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.
--------------------------------------------------------------------------------
with CL.Command_Queues;
with CL.Events;
with CL.Kernels;
private with CL.Helpers;
package CL.Queueing is
subtype Kernel_Dimension is UInt range 1 .. 3;
type Map_Flags is record
Read : Boolean;
Write : Boolean;
end record;
function Execute_Kernel (Target_Queue : Command_Queues.Queue'Class;
Kernel : Kernels.Kernel'Class;
Dimension : Kernel_Dimension;
Global_Work_Size : access constant Size_List;
Local_Work_Size : access constant Size_List;
Wait_For : access Events.Event_List)
return Events.Event;
function Execute_Task (Target_Queue : Command_Queues.Queue'Class;
Kernel : Kernels.Kernel'Class;
Wait_For : access Events.Event_List)
return Events.Event;
function Marker (Target_Queue : Command_Queues.Queue'Class)
return Events.Event;
procedure Wait_For_Events (Target_Queue : Command_Queues.Queue'Class;
Event_List : Events.Event_List);
procedure Barrier (Target_Queue : Command_Queues.Queue'Class);
private
for Map_Flags use record
Read at 0 range 0 .. 0;
Write at 0 range 1 .. 1;
end record;
pragma Warnings (Off);
for Map_Flags'Size use Bitfield'Size;
pragma Warnings (On);
pragma Convention (C_Pass_By_Copy, Map_Flags);
function Raw_Event_List is new Helpers.Raw_List_From_Polymorphic
(Element_T => Events.Event, Element_List_T => Events.Event_List);
end CL.Queueing;
|
Univalence/PiWithLevels/Pi1.agda | JacquesCarette/pi-dual | 14 | 16519 | {-# OPTIONS --without-K #-}
module Pi1 where
open import Data.List
open import Data.Nat
open import Data.Empty
open import Data.Unit
open import Data.Sum
open import Data.Product
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
open import Groupoid
infix 2 _□
infixr 2 _⟷⟨_⟩_
infix 2 _▤
infixr 2 _⇔⟨_⟩_
infixr 10 _◎_
infix 30 _⟷_
infix 4 _∼_ -- homotopy between two paths
infix 4 _≃_ -- type of equivalences
-- Work on ch. on sets and n-levels and n=-2 and n=-1
-- then work on ch. on equivalences
-- then go back to functions are functors; type families are fibrations
-- then work on int construction
-- then work on example from popl
------------------------------------------------------------------------------
-- Level 0:
-- Types at this level are just plain sets with no interesting path structure.
-- The path structure is defined at levels 1 and beyond.
data U : Set where
ZERO : U
ONE : U
PLUS : U → U → U
TIMES : U → U → U
⟦_⟧ : U → Set
⟦ ZERO ⟧ = ⊥
⟦ ONE ⟧ = ⊤
⟦ PLUS t₁ t₂ ⟧ = ⟦ t₁ ⟧ ⊎ ⟦ t₂ ⟧
⟦ TIMES t₁ t₂ ⟧ = ⟦ t₁ ⟧ × ⟦ t₂ ⟧
-- Programs
-- We use pointed types; programs are "fibers" from functions that map a
-- pointed type to another. In other words, each program takes one particular
-- value to another; if we want to work on another value, we generally use
-- another program.
--
-- We can recover a regular function by collecting all the fibers that
-- compose to the identity permutation.
record U• : Set where
constructor •[_,_]
field
∣_∣ : U
• : ⟦ ∣_∣ ⟧
open U•
-- examples of plain types, values, and pointed types
ZERO• : {absurd : ⟦ ZERO ⟧} → U•
ZERO• {absurd} = •[ ZERO , absurd ]
ONE• : U•
ONE• = •[ ONE , tt ]
BOOL : U
BOOL = PLUS ONE ONE
BOOL² : U
BOOL² = TIMES BOOL BOOL
TRUE : ⟦ BOOL ⟧
TRUE = inj₁ tt
FALSE : ⟦ BOOL ⟧
FALSE = inj₂ tt
BOOL•F : U•
BOOL•F = •[ BOOL , FALSE ]
BOOL•T : U•
BOOL•T = •[ BOOL , TRUE ]
-- The actual programs are the commutative semiring isomorphisms between
-- pointed types.
data _⟷_ : U• → U• → Set where
unite₊ : ∀ {t v} → •[ PLUS ZERO t , inj₂ v ] ⟷ •[ t , v ]
uniti₊ : ∀ {t v} → •[ t , v ] ⟷ •[ PLUS ZERO t , inj₂ v ]
swap1₊ : ∀ {t₁ t₂ v₁} →
•[ PLUS t₁ t₂ , inj₁ v₁ ] ⟷ •[ PLUS t₂ t₁ , inj₂ v₁ ]
swap2₊ : ∀ {t₁ t₂ v₂} →
•[ PLUS t₁ t₂ , inj₂ v₂ ] ⟷ •[ PLUS t₂ t₁ , inj₁ v₂ ]
assocl1₊ : ∀ {t₁ t₂ t₃ v₁} →
•[ PLUS t₁ (PLUS t₂ t₃) , inj₁ v₁ ] ⟷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ]
assocl2₊ : ∀ {t₁ t₂ t₃ v₂} →
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ] ⟷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ]
assocl3₊ : ∀ {t₁ t₂ t₃ v₃} →
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ] ⟷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ]
assocr1₊ : ∀ {t₁ t₂ t₃ v₁} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₁ v₁ ]
assocr2₊ : ∀ {t₁ t₂ t₃ v₂} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ]
assocr3₊ : ∀ {t₁ t₂ t₃ v₃} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ]
unite⋆ : ∀ {t v} → •[ TIMES ONE t , (tt , v) ] ⟷ •[ t , v ]
uniti⋆ : ∀ {t v} → •[ t , v ] ⟷ •[ TIMES ONE t , (tt , v) ]
swap⋆ : ∀ {t₁ t₂ v₁ v₂} → •[ TIMES t₁ t₂ , (v₁ , v₂) ] ⟷
•[ TIMES t₂ t₁ , (v₂ , v₁) ]
assocl⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ] ⟷
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ]
assocr⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ] ⟷
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ]
distz : ∀ {t v absurd} →
•[ TIMES ZERO t , (absurd , v) ] ⟷ •[ ZERO , absurd ]
factorz : ∀ {t v absurd} →
•[ ZERO , absurd ] ⟷ •[ TIMES ZERO t , (absurd , v) ]
dist1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ] ⟷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ]
dist2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ] ⟷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ]
factor1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ] ⟷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ]
factor2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ] ⟷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ]
id⟷ : ∀ {t v} → •[ t , v ] ⟷ •[ t , v ]
_◎_ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
(•[ t₁ , v₁ ] ⟷ •[ t₂ , v₂ ]) →
(•[ t₂ , v₂ ] ⟷ •[ t₃ , v₃ ]) →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ])
⊕1 : ∀ {t₁ t₂ t₃ t₄ v₁ v₃} →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ]) →
(•[ PLUS t₁ t₂ , inj₁ v₁ ] ⟷ •[ PLUS t₃ t₄ , inj₁ v₃ ])
⊕2 : ∀ {t₁ t₂ t₃ t₄ v₂ v₄} →
(•[ t₂ , v₂ ] ⟷ •[ t₄ , v₄ ]) →
(•[ PLUS t₁ t₂ , inj₂ v₂ ] ⟷ •[ PLUS t₃ t₄ , inj₂ v₄ ])
_⊗_ : ∀ {t₁ t₂ t₃ t₄ v₁ v₂ v₃ v₄} →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ]) →
(•[ t₂ , v₂ ] ⟷ •[ t₄ , v₄ ]) →
(•[ TIMES t₁ t₂ , (v₁ , v₂) ] ⟷ •[ TIMES t₃ t₄ , (v₃ , v₄) ])
-- Nicer syntax that shows intermediate values instead of point-free
-- combinators
_⟷⟨_⟩_ : (t₁ : U•) {t₂ : U•} {t₃ : U•} →
(t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃)
_ ⟷⟨ α ⟩ β = α ◎ β
_□ : (t : U•) → {t : U•} → (t ⟷ t)
_□ t = id⟷
-- trace
-- first every combinator (t + t1) <-> (t + t2) can be decomposed into
-- four relations (or injective partial functions):
-- r11 : t1 -> t2
-- r12 : t1 -> t
-- r21 : t -> t2
-- r22 : t -> t
-- c = r11 ∪ (r12 ◎ r22⋆ ◎ r21)
eval : ∀ {t₁ t₂ v₁ v₂} → (•[ t₁ , v₁ ] ⟷ •[ t₂ , v₂ ]) → List U•
eval {t₁ = ZERO} {v₁ = ()} _
eval {t₂ = ZERO} {v₂ = ()} _
eval {t} {PLUS .ZERO .t} {v} {inj₂ .v} uniti₊ =
•[ t , v ] ∷ •[ PLUS ZERO t , inj₂ v ] ∷ []
eval {PLUS .ZERO .t} {t} {inj₂ .v} {v} unite₊ =
•[ PLUS ZERO t , inj₂ v ] ∷ •[ t , v ] ∷ []
eval {PLUS t₁ t₂} {PLUS .t₂ .t₁} {inj₁ v₁} {inj₂ .v₁} swap1₊ =
•[ PLUS t₁ t₂ , inj₁ v₁ ] ∷ •[ PLUS t₂ t₁ , inj₂ v₁ ] ∷ []
eval {PLUS t₁ t₂} {PLUS .t₂ .t₁} {inj₂ v₂} {inj₁ .v₂} swap2₊ =
•[ PLUS t₁ t₂ , inj₂ v₂ ] ∷ •[ PLUS t₂ t₁ , inj₁ v₂ ] ∷ []
eval {PLUS t₁ (PLUS t₂ t₃)} {PLUS (PLUS .t₁ .t₂) .t₃}
{inj₁ v₁} {inj₁ (inj₁ .v₁)} assocl1₊ =
•[ PLUS t₁ (PLUS t₂ t₃) , inj₁ v₁ ] ∷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ] ∷ []
eval {PLUS t₁ (PLUS t₂ t₃)} {PLUS (PLUS .t₁ .t₂) .t₃}
{inj₂ (inj₁ v₂)} {inj₁ (inj₂ .v₂)} assocl2₊ =
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ] ∷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ] ∷ []
eval {PLUS t₁ (PLUS t₂ t₃)} {PLUS (PLUS .t₁ .t₂) .t₃}
{inj₂ (inj₂ v₃)} {inj₂ .v₃} assocl3₊ =
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ] ∷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ] ∷ []
eval {PLUS (PLUS .t₁ .t₂) .t₃} {PLUS t₁ (PLUS t₂ t₃)}
{inj₁ (inj₁ .v₁)} {inj₁ v₁} assocr1₊ =
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ] ∷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₁ v₁ ] ∷ []
eval {PLUS (PLUS .t₁ .t₂) .t₃} {PLUS t₁ (PLUS t₂ t₃)}
{inj₁ (inj₂ .v₂)} {inj₂ (inj₁ v₂)} assocr2₊ =
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ] ∷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ] ∷ []
eval {PLUS (PLUS .t₁ .t₂) .t₃} {PLUS t₁ (PLUS t₂ t₃)}
{inj₂ .v₃} {inj₂ (inj₂ v₃)} assocr3₊ =
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ] ∷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ] ∷ []
eval {t} {TIMES .ONE .t} {v} {(tt , .v)} uniti⋆ =
•[ t , v ] ∷ •[ TIMES ONE t , (tt , v) ] ∷ []
eval {TIMES .ONE .t} {t} {(tt , .v)} {v} unite⋆ =
•[ TIMES ONE t , (tt , v) ] ∷ •[ t , v ] ∷ []
eval {TIMES t₁ t₂} {TIMES .t₂ .t₁} {(v₁ , v₂)} {(.v₂ , .v₁)} swap⋆ =
•[ TIMES t₁ t₂ , (v₁ , v₂) ] ∷ •[ TIMES t₂ t₁ , (v₂ , v₁) ] ∷ []
eval {TIMES t₁ (TIMES t₂ t₃)} {TIMES (TIMES .t₁ .t₂) .t₃}
{(v₁ , (v₂ , v₃))} {((.v₁ , .v₂) , .v₃)} assocl⋆ =
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ] ∷
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ] ∷ []
eval {TIMES (TIMES .t₁ .t₂) .t₃} {TIMES t₁ (TIMES t₂ t₃)}
{((.v₁ , .v₂) , .v₃)} {(v₁ , (v₂ , v₃))} assocr⋆ =
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ] ∷
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ] ∷ []
eval {TIMES (PLUS t₁ t₂) t₃} {PLUS (TIMES .t₁ .t₃) (TIMES .t₂ .t₃)}
{(inj₁ v₁ , v₃)} {inj₁ (.v₁ , .v₃)} dist1 =
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ] ∷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ] ∷ []
eval {TIMES (PLUS t₁ t₂) t₃} {PLUS (TIMES .t₁ .t₃) (TIMES .t₂ .t₃)}
{(inj₂ v₂ , v₃)} {inj₂ (.v₂ , .v₃)} dist2 =
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ] ∷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ] ∷ []
eval {PLUS (TIMES .t₁ .t₃) (TIMES .t₂ .t₃)} {TIMES (PLUS t₁ t₂) t₃}
{inj₁ (.v₁ , .v₃)} {(inj₁ v₁ , v₃)} factor1 =
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ] ∷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ] ∷ []
eval {PLUS (TIMES .t₁ .t₃) (TIMES .t₂ .t₃)} {TIMES (PLUS t₁ t₂) t₃}
{inj₂ (.v₂ , .v₃)} {(inj₂ v₂ , v₃)} factor2 =
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ] ∷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ] ∷ []
eval {t} {.t} {v} {.v} id⟷ = •[ t , v ] ∷ •[ t , v ] ∷ []
eval {t₁} {t₃} {v₁} {v₃} (_◎_ {t₂ = t₂} {v₂ = v₂} c₁ c₂) =
eval {t₁} {t₂} {v₁} {v₂} c₁ ++ eval {t₂} {t₃} {v₂} {v₃} c₂
eval {PLUS t₁ t₂} {PLUS t₃ t₄} {inj₁ v₁} {inj₁ v₃} (⊕1 c) =
eval {t₁} {t₃} {v₁} {v₃} c -- tag
eval {PLUS t₁ t₂} {PLUS t₃ t₄} {inj₂ v₂} {inj₂ v₄} (⊕2 c) =
eval {t₂} {t₄} {v₂} {v₄} c -- tag
eval {TIMES t₁ t₂} {TIMES t₃ t₄} {(v₁ , v₂)} {(v₃ , v₄)} (c₁ ⊗ c₂) =
(eval {t₁} {t₃} {v₁} {v₃} c₁) ++ (eval {t₂} {t₄} {v₂} {v₄} c₂)
-- zip
test = eval (•[ BOOL² , (TRUE , TRUE) ]
⟷⟨ dist1 ⟩
•[ PLUS (TIMES ONE BOOL) (TIMES ONE BOOL) , inj₁ (tt , TRUE) ]
⟷⟨ ⊕1 (id⟷ ⊗ swap1₊)⟩
•[ PLUS (TIMES ONE BOOL) (TIMES ONE BOOL) , inj₁ (tt , FALSE) ]
⟷⟨ factor1 ⟩
•[ BOOL² , (TRUE , FALSE) ] □)
-- The above are "fibers". We collect the fibers into functions.
data SWAP₊ {t₁ t₂ v₁ v₂} :
(•[ PLUS t₁ t₂ , inj₁ v₁ ] ⟷ •[ PLUS t₂ t₁ , inj₂ v₁ ]) →
(•[ PLUS t₁ t₂ , inj₂ v₂ ] ⟷ •[ PLUS t₂ t₁ , inj₁ v₂ ]) →
Set where
swap₊ : SWAP₊ swap1₊ swap2₊
Fun : (t₁ t₂ : U) → Set
Fun t₁ t₂ = (v₁ : ⟦ t₁ ⟧) → Σ[ v₂ ∈ ⟦ t₂ ⟧ ] (•[ t₁ , v₁ ] ⟷ •[ t₂ , v₂ ])
NOT : Fun BOOL BOOL
NOT (inj₁ tt) = (FALSE , swap1₊)
NOT (inj₂ tt) = (TRUE , swap2₊)
-- Note that functions are not reversible!!
Squash : Fun BOOL BOOL
Squash (inj₁ x) = inj₂ x , swap1₊
Squash (inj₂ y) = inj₂ y , id⟷
CNOT : Fun BOOL² BOOL²
CNOT (inj₂ tt , b) =
((FALSE , b) , dist2 ◎ (⊕2 id⟷) ◎ factor2)
CNOT (inj₁ tt , inj₂ tt) =
((TRUE , TRUE) , dist1 ◎ (⊕1 (id⟷ ⊗ swap2₊)) ◎ factor1)
CNOT (inj₁ tt , inj₁ tt) =
((TRUE , FALSE) ,
(•[ BOOL² , (TRUE , TRUE) ]
⟷⟨ dist1 ⟩
•[ PLUS (TIMES ONE BOOL) (TIMES ONE BOOL) , inj₁ (tt , TRUE) ]
⟷⟨ ⊕1 (id⟷ ⊗ swap1₊)⟩
•[ PLUS (TIMES ONE BOOL) (TIMES ONE BOOL) , inj₁ (tt , FALSE) ]
⟷⟨ factor1 ⟩
•[ BOOL² , (TRUE , FALSE) ] □))
-- The universe of types is a groupoid. The objects of this groupoid are the
-- pointed types; the morphisms are the programs; and the equivalence of
-- programs is the degenerate observational equivalence that equates every
-- two programs that are extensionally equivalent.
! : {t₁ t₂ : U•} → (t₁ ⟷ t₂) → (t₂ ⟷ t₁)
! unite₊ = uniti₊
! uniti₊ = unite₊
! swap1₊ = swap2₊
! swap2₊ = swap1₊
! assocl1₊ = assocr1₊
! assocl2₊ = assocr2₊
! assocl3₊ = assocr3₊
! assocr1₊ = assocl1₊
! assocr2₊ = assocl2₊
! assocr3₊ = assocl3₊
! unite⋆ = uniti⋆
! uniti⋆ = unite⋆
! swap⋆ = swap⋆
! assocl⋆ = assocr⋆
! assocr⋆ = assocl⋆
! distz = factorz
! factorz = distz
! dist1 = factor1
! dist2 = factor2
! factor1 = dist1
! factor2 = dist2
! id⟷ = id⟷
! (c₁ ◎ c₂) = ! c₂ ◎ ! c₁
! (⊕1 c₁) = ⊕1 (! c₁)
! (⊕2 c₂) = ⊕2 (! c₂)
! (c₁ ⊗ c₂) = ! c₁ ⊗ ! c₂
_obs≅_ : {t₁ t₂ : U•} → (c₁ c₂ : t₁ ⟷ t₂) → Set
c₁ obs≅ c₂ = ⊤
UG : 1Groupoid
UG = record
{ set = U•
; _↝_ = _⟷_
; _≈_ = _obs≅_
; id = id⟷
; _∘_ = λ y⟷z x⟷y → x⟷y ◎ y⟷z
; _⁻¹ = !
; lneutr = λ _ → tt
; rneutr = λ _ → tt
; assoc = λ _ _ _ → tt
; equiv = record { refl = tt
; sym = λ _ → tt
; trans = λ _ _ → tt
}
; linv = λ _ → tt
; rinv = λ _ → tt
; ∘-resp-≈ = λ _ _ → tt
}
-- Now let us talk about homotopies and equivalences
-- Two paths starting at the same point are homotopic if they map that point
-- to related points (of course, related by another path)
_∼_ : {t₁ t₂ t₂' : U•} → (p : t₁ ⟷ t₂) → (q : t₁ ⟷ t₂') → Set
_∼_ {t₁} {t₂} {t₂'} p q = (t₂ ⟷ t₂')
refl∼ : {t₁ t₂ : U•} → (p : t₁ ⟷ t₂) → (p ∼ p)
refl∼ {t₁} {t₂} p = id⟷
sym∼ : {t₁ t₂ t₂' : U•} {p : t₁ ⟷ t₂} {q : t₁ ⟷ t₂'} → (p ∼ q) → (q ∼ p)
sym∼ p∼q = ! p∼q
trans∼ : {t₁ t₂ t₂' t₂'' : U•} {p : t₁ ⟷ t₂} {q : t₁ ⟷ t₂'} {r : t₁ ⟷ t₂''} →
(p ∼ q) → (q ∼ r) → (p ∼ r)
trans∼ p∼q q∼r = p∼q ◎ q∼r
module T where
-- Note that paths mapping a point FALSE and TRUE can be homotopic
p : •[ BOOL , FALSE ] ⟷ •[ BOOL , FALSE ]
p = id⟷
q : •[ BOOL , FALSE ] ⟷ •[ BOOL , TRUE ]
q = swap2₊
p∼q : p ∼ q
p∼q = swap2₊
-- equivalences
-- the following makes no sense because I can use id⟷ for α and β
record qinv {t₁ t₂ : U•} (p : t₁ ⟷ t₂) : Set where
constructor mkqinv
field
q : t₂ ⟷ t₁
α : (p ◎ q) ∼ id⟷
β : (q ◎ p) ∼ id⟷
idqinv : {t : U•} → qinv {t} {t} id⟷
idqinv = record {
q = id⟷ ;
α = id⟷ ;
β = id⟷
}
record isequiv {t₁ t₂ : U•} (p : t₁ ⟷ t₂) : Set where
constructor mkisequiv
field
q : t₂ ⟷ t₁
α : (p ◎ q) ∼ id⟷
r : t₂ ⟷ t₁
β : (r ◎ p) ∼ id⟷
equiv₁ : {t₁ t₂ : U•} {p : t₁ ⟷ t₂} → qinv p → isequiv p
equiv₁ (mkqinv iq iα iβ) = mkisequiv iq iα iq iβ
_≃_ : (t₁ t₂ : U•) → Set
t₁ ≃ t₂ = Σ[ p ∈ t₁ ⟷ t₂ ] (isequiv p)
id≃ : {t : U•} → t ≃ t
id≃ = (id⟷ , equiv₁ idqinv)
------------------------------------------------------------------------------
-- Level 1:
-- Types are sets of paths. The paths are defined at level 0. At level 1,
-- there is no interesting 2path structure. From the perspective of level 0,
-- we have points with non-trivial paths between them, i.e., we have a
-- groupoid. The paths cross type boundaries, i.e., we have heterogeneous
-- equality
-- types
data 1U : Set where
1ZERO : 1U -- empty set of paths
1ONE : 1U -- a trivial path
1PLUS : 1U → 1U → 1U -- disjoint union of paths
1TIMES : 1U → 1U → 1U -- pairs of paths
PATH : (t₁ t₂ : U•) → 1U -- level 0 paths between values
-- values
data Path (t₁ t₂ : U•) : Set where
path : (c : t₁ ⟷ t₂) → Path t₁ t₂
1⟦_⟧ : 1U → Set
1⟦ 1ZERO ⟧ = ⊥
1⟦ 1ONE ⟧ = ⊤
1⟦ 1PLUS t₁ t₂ ⟧ = 1⟦ t₁ ⟧ ⊎ 1⟦ t₂ ⟧
1⟦ 1TIMES t₁ t₂ ⟧ = 1⟦ t₁ ⟧ × 1⟦ t₂ ⟧
1⟦ PATH t₁ t₂ ⟧ = Path t₁ t₂
-- examples
T⟷F : Set
T⟷F = Path BOOL•T BOOL•F
F⟷T : Set
F⟷T = Path BOOL•F BOOL•T
p₁ p₂ p₃ p₄ p₅ : T⟷F
p₁ = path swap1₊
p₂ = path (id⟷ ◎ swap1₊)
p₃ = path (swap1₊ ◎ swap2₊ ◎ swap1₊)
p₄ = path (swap1₊ ◎ id⟷)
p₅ = path (uniti⋆ ◎ swap⋆ ◎ (swap1₊ ⊗ id⟷) ◎ swap⋆ ◎ unite⋆)
p₆ : (T⟷F × T⟷F) ⊎ F⟷T
p₆ = inj₁ (p₁ , p₂)
-- Programs map paths to paths. We also use pointed types.
record 1U• : Set where
constructor 1•[_,_]
field
1∣_∣ : 1U
1• : 1⟦ 1∣_∣ ⟧
open 1U•
data _⇔_ : 1U• → 1U• → Set where
unite₊ : ∀ {t v} → 1•[ 1PLUS 1ZERO t , inj₂ v ] ⇔ 1•[ t , v ]
uniti₊ : ∀ {t v} → 1•[ t , v ] ⇔ 1•[ 1PLUS 1ZERO t , inj₂ v ]
swap1₊ : ∀ {t₁ t₂ v₁} →
1•[ 1PLUS t₁ t₂ , inj₁ v₁ ] ⇔ 1•[ 1PLUS t₂ t₁ , inj₂ v₁ ]
swap2₊ : ∀ {t₁ t₂ v₂} →
1•[ 1PLUS t₁ t₂ , inj₂ v₂ ] ⇔ 1•[ 1PLUS t₂ t₁ , inj₁ v₂ ]
assocl1₊ : ∀ {t₁ t₂ t₃ v₁} →
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₁ v₁ ] ⇔
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ]
assocl2₊ : ∀ {t₁ t₂ t₃ v₂} →
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₂ (inj₁ v₂) ] ⇔
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ]
assocl3₊ : ∀ {t₁ t₂ t₃ v₃} →
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₂ (inj₂ v₃) ] ⇔
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₂ v₃ ]
assocr1₊ : ∀ {t₁ t₂ t₃ v₁} →
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ] ⇔
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₁ v₁ ]
assocr2₊ : ∀ {t₁ t₂ t₃ v₂} →
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ] ⇔
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₂ (inj₁ v₂) ]
assocr3₊ : ∀ {t₁ t₂ t₃ v₃} →
1•[ 1PLUS (1PLUS t₁ t₂) t₃ , inj₂ v₃ ] ⇔
1•[ 1PLUS t₁ (1PLUS t₂ t₃) , inj₂ (inj₂ v₃) ]
unite⋆ : ∀ {t v} → 1•[ 1TIMES 1ONE t , (tt , v) ] ⇔ 1•[ t , v ]
uniti⋆ : ∀ {t v} → 1•[ t , v ] ⇔ 1•[ 1TIMES 1ONE t , (tt , v) ]
swap⋆ : ∀ {t₁ t₂ v₁ v₂} →
1•[ 1TIMES t₁ t₂ , (v₁ , v₂) ] ⇔ 1•[ 1TIMES t₂ t₁ , (v₂ , v₁) ]
assocl⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
1•[ 1TIMES t₁ (1TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ] ⇔
1•[ 1TIMES (1TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ]
assocr⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
1•[ 1TIMES (1TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ] ⇔
1•[ 1TIMES t₁ (1TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ]
distz : ∀ {t v absurd} →
1•[ 1TIMES 1ZERO t , (absurd , v) ] ⇔ 1•[ 1ZERO , absurd ]
factorz : ∀ {t v absurd} →
1•[ 1ZERO , absurd ] ⇔ 1•[ 1TIMES 1ZERO t , (absurd , v) ]
dist1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
1•[ 1TIMES (1PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ] ⇔
1•[ 1PLUS (1TIMES t₁ t₃) (1TIMES t₂ t₃) , inj₁ (v₁ , v₃) ]
dist2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
1•[ 1TIMES (1PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ] ⇔
1•[ 1PLUS (1TIMES t₁ t₃) (1TIMES t₂ t₃) , inj₂ (v₂ , v₃) ]
factor1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
1•[ 1PLUS (1TIMES t₁ t₃) (1TIMES t₂ t₃) , inj₁ (v₁ , v₃) ] ⇔
1•[ 1TIMES (1PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ]
factor2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
1•[ 1PLUS (1TIMES t₁ t₃) (1TIMES t₂ t₃) , inj₂ (v₂ , v₃) ] ⇔
1•[ 1TIMES (1PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ]
id⇔ : ∀ {t v} → 1•[ t , v ] ⇔ 1•[ t , v ]
_◎_ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} → (1•[ t₁ , v₁ ] ⇔ 1•[ t₂ , v₂ ]) →
(1•[ t₂ , v₂ ] ⇔ 1•[ t₃ , v₃ ]) →
(1•[ t₁ , v₁ ] ⇔ 1•[ t₃ , v₃ ])
⊕1 : ∀ {t₁ t₂ t₃ t₄ v₁ v₃} →
(1•[ t₁ , v₁ ] ⇔ 1•[ t₃ , v₃ ]) →
(1•[ 1PLUS t₁ t₂ , inj₁ v₁ ] ⇔ 1•[ 1PLUS t₃ t₄ , inj₁ v₃ ])
⊕2 : ∀ {t₁ t₂ t₃ t₄ v₂ v₄} →
(1•[ t₂ , v₂ ] ⇔ 1•[ t₄ , v₄ ]) →
(1•[ 1PLUS t₁ t₂ , inj₂ v₂ ] ⇔ 1•[ 1PLUS t₃ t₄ , inj₂ v₄ ])
_⊗_ : ∀ {t₁ t₂ t₃ t₄ v₁ v₂ v₃ v₄} →
(1•[ t₁ , v₁ ] ⇔ 1•[ t₃ , v₃ ]) → (1•[ t₂ , v₂ ] ⇔ 1•[ t₄ , v₄ ]) →
(1•[ 1TIMES t₁ t₂ , (v₁ , v₂) ] ⇔ 1•[ 1TIMES t₃ t₄ , (v₃ , v₄) ])
lidl : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂} →
1•[ PATH t₁ t₂ , path (id⟷ ◎ c) ] ⇔ 1•[ PATH t₁ t₂ , path c ]
lidr : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂} →
1•[ PATH t₁ t₂ , path c ] ⇔ 1•[ PATH t₁ t₂ , path (id⟷ ◎ c) ]
ridl : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂} →
1•[ PATH t₁ t₂ , path (c ◎ id⟷) ] ⇔ 1•[ PATH t₁ t₂ , path c ]
ridr : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂} →
1•[ PATH t₁ t₂ , path c ] ⇔ 1•[ PATH t₁ t₂ , path (c ◎ id⟷) ]
assocl : ∀ {t₁ t₂ t₃ t₄} →
{c₁ : t₁ ⟷ t₂} {c₂ : t₂ ⟷ t₃} {c₃ : t₃ ⟷ t₄} →
1•[ PATH t₁ t₄ , path (c₁ ◎ (c₂ ◎ c₃)) ] ⇔
1•[ PATH t₁ t₄ , path ((c₁ ◎ c₂) ◎ c₃) ]
assocr : ∀ {t₁ t₂ t₃ t₄} →
{c₁ : t₁ ⟷ t₂} {c₂ : t₂ ⟷ t₃} {c₃ : t₃ ⟷ t₄} →
1•[ PATH t₁ t₄ , path ((c₁ ◎ c₂) ◎ c₃) ] ⇔
1•[ PATH t₁ t₄ , path (c₁ ◎ (c₂ ◎ c₃)) ]
linv◎l : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂ } →
1•[ PATH t₁ t₁ , path (c ◎ ! c)] ⇔
1•[ PATH t₁ t₁ , path id⟷ ]
linv◎r : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂ } →
1•[ PATH t₁ t₁ , path id⟷ ] ⇔
1•[ PATH t₁ t₁ , path (c ◎ ! c) ]
rinv◎l : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂ } →
1•[ PATH t₂ t₂ , path (! c ◎ c)] ⇔
1•[ PATH t₂ t₂ , path id⟷ ]
rinv◎r : ∀ {t₁ t₂} → {c : t₁ ⟷ t₂ } →
1•[ PATH t₂ t₂ , path id⟷ ] ⇔
1•[ PATH t₂ t₂ , path (! c ◎ c) ]
resp◎ : ∀ {t₁ t₂ t₃} →
{c₁ : t₁ ⟷ t₂} {c₂ : t₂ ⟷ t₃} {c₃ : t₁ ⟷ t₂} {c₄ : t₂ ⟷ t₃} →
(1•[ PATH t₁ t₂ , path c₁ ] ⇔ 1•[ PATH t₁ t₂ , path c₃ ]) →
(1•[ PATH t₂ t₃ , path c₂ ] ⇔ 1•[ PATH t₂ t₃ , path c₄ ]) →
1•[ PATH t₁ t₃ , path (c₁ ◎ c₂) ] ⇔ 1•[ PATH t₁ t₃ , path (c₃ ◎ c₄) ]
1! : {t₁ t₂ : 1U•} → (t₁ ⇔ t₂) → (t₂ ⇔ t₁)
1! unite₊ = uniti₊
1! uniti₊ = unite₊
1! swap1₊ = swap2₊
1! swap2₊ = swap1₊
1! assocl1₊ = assocr1₊
1! assocl2₊ = assocr2₊
1! assocl3₊ = assocr3₊
1! assocr1₊ = assocl1₊
1! assocr2₊ = assocl2₊
1! assocr3₊ = assocl3₊
1! unite⋆ = uniti⋆
1! uniti⋆ = unite⋆
1! swap⋆ = swap⋆
1! assocl⋆ = assocr⋆
1! assocr⋆ = assocl⋆
1! distz = factorz
1! factorz = distz
1! dist1 = factor1
1! dist2 = factor2
1! factor1 = dist1
1! factor2 = dist2
1! id⇔ = id⇔
1! (c₁ ◎ c₂) = 1! c₂ ◎ 1! c₁
1! (⊕1 c₁) = ⊕1 (1! c₁)
1! (⊕2 c₂) = ⊕2 (1! c₂)
1! (c₁ ⊗ c₂) = 1! c₁ ⊗ 1! c₂
1! (resp◎ c₁ c₂) = resp◎ (1! c₁) (1! c₂)
1! ridl = ridr
1! ridr = ridl
1! lidl = lidr
1! lidr = lidl
1! assocl = assocr
1! assocr = assocl
1! linv◎l = linv◎r
1! linv◎r = linv◎l
1! rinv◎l = rinv◎r
1! rinv◎r = rinv◎l
1!≡ : {t₁ t₂ : 1U•} → (c : t₁ ⇔ t₂) → 1! (1! c) ≡ c
1!≡ unite₊ = refl
1!≡ uniti₊ = refl
1!≡ swap1₊ = refl
1!≡ swap2₊ = refl
1!≡ assocl1₊ = refl
1!≡ assocl2₊ = refl
1!≡ assocl3₊ = refl
1!≡ assocr1₊ = refl
1!≡ assocr2₊ = refl
1!≡ assocr3₊ = refl
1!≡ unite⋆ = refl
1!≡ uniti⋆ = refl
1!≡ swap⋆ = refl
1!≡ assocl⋆ = refl
1!≡ assocr⋆ = refl
1!≡ distz = refl
1!≡ factorz = refl
1!≡ dist1 = refl
1!≡ dist2 = refl
1!≡ factor1 = refl
1!≡ factor2 = refl
1!≡ id⇔ = refl
1!≡ (c₁ ◎ c₂) = cong₂ (λ c₁ c₂ → c₁ ◎ c₂) (1!≡ c₁) (1!≡ c₂)
1!≡ (⊕1 c₁) = cong (λ c₁ → ⊕1 c₁) (1!≡ c₁)
1!≡ (⊕2 c₂) = cong (λ c₂ → ⊕2 c₂) (1!≡ c₂)
1!≡ (c₁ ⊗ c₂) = cong₂ (λ c₁ c₂ → c₁ ⊗ c₂) (1!≡ c₁) (1!≡ c₂)
1!≡ lidl = refl
1!≡ lidr = refl
1!≡ ridl = refl
1!≡ ridr = refl
1!≡ (resp◎ c₁ c₂) = cong₂ (λ c₁ c₂ → resp◎ c₁ c₂) (1!≡ c₁) (1!≡ c₂)
1!≡ assocl = refl
1!≡ assocr = refl
1!≡ linv◎l = refl
1!≡ linv◎r = refl
1!≡ rinv◎l = refl
1!≡ rinv◎r = refl
-- better syntax for writing 2paths
_⇔⟨_⟩_ : {t₁ t₂ : U•} (c₁ : t₁ ⟷ t₂) {c₂ : t₁ ⟷ t₂} {c₃ : t₁ ⟷ t₂} →
(1•[ PATH t₁ t₂ , path c₁ ] ⇔ 1•[ PATH t₁ t₂ , path c₂ ]) →
(1•[ PATH t₁ t₂ , path c₂ ] ⇔ 1•[ PATH t₁ t₂ , path c₃ ]) →
(1•[ PATH t₁ t₂ , path c₁ ] ⇔ 1•[ PATH t₁ t₂ , path c₃ ])
_ ⇔⟨ α ⟩ β = α ◎ β
_▤ : {t₁ t₂ : U•} → (c : t₁ ⟷ t₂) →
1•[ PATH t₁ t₂ , path c ] ⇔ 1•[ PATH t₁ t₂ , path c ]
_▤ c = id⇔
α₁ : 1•[ PATH BOOL•T BOOL•F , p₁ ] ⇔ 1•[ PATH BOOL•T BOOL•F , p₁ ]
α₁ = id⇔
α₂ : 1•[ PATH BOOL•T BOOL•F , p₁ ] ⇔ 1•[ PATH BOOL•T BOOL•F , p₂ ]
α₂ = lidr
-- level 0 is a groupoid with a non-trivial path equivalence the various inv*
-- rules are not justified by the groupoid proof; they are justified by the
-- need for computational rules. So it is important to have not just a
-- groupoid structure but a groupoid structure that we can compute with. So
-- if we say that we want p ◎ p⁻¹ to be id, we must have computational rules
-- that allow us to derive this for any path p, and similarly for all the
-- other groupoid rules. (cf. The canonicity for 2D type theory by Licata and
-- Harper)
G : 1Groupoid
G = record
{ set = U•
; _↝_ = _⟷_
; _≈_ = λ {t₁} {t₂} c₀ c₁ →
1•[ PATH t₁ t₂ , path c₀ ] ⇔ 1•[ PATH t₁ t₂ , path c₁ ]
; id = id⟷
; _∘_ = λ c₀ c₁ → c₁ ◎ c₀
; _⁻¹ = !
; lneutr = λ _ → ridl
; rneutr = λ _ → lidl
; assoc = λ _ _ _ → assocl
; equiv = record { refl = id⇔
; sym = λ c → 1! c
; trans = λ c₀ c₁ → c₀ ◎ c₁ }
; linv = λ {t₁} {t₂} c → linv◎l
; rinv = λ {t₁} {t₂} c → rinv◎l
; ∘-resp-≈ = λ f⟷h g⟷i → resp◎ g⟷i f⟷h
}
-- We can now ask whether a given space is a set (Def. 3.1.1)
isSet : U → Set
isSet t = (v v' : ⟦ t ⟧) → (p q : •[ t , v ] ⟷ •[ t , v' ]) →
(1•[ PATH •[ t , v ] •[ t , v' ] , path p ] ⇔
1•[ PATH •[ t , v ] •[ t , v' ] , path q ])
0isSet : isSet ZERO
0isSet ()
1isSet : isSet ONE
1isSet tt tt id⟷ id⟷ = id⇔
1isSet tt tt id⟷ (uniti₊ ◎ unite₊) =
id⟷
⇔⟨ rinv◎r ⟩
uniti₊ ◎ unite₊ ▤
1isSet tt tt id⟷ (uniti₊ ◎ (q₂ ◎ q₃)) =
id⟷
⇔⟨ {!!} ⟩
(uniti₊ ◎ (q₂ ◎ q₃)) ▤
1isSet tt tt id⟷ (uniti⋆ ◎ unite⋆) = {!!}
1isSet tt tt id⟷ (uniti⋆ ◎ (q₂ ◎ q₃)) = {!!}
1isSet tt tt id⟷ (id⟷ ◎ id⟷) = {!!}
1isSet tt tt id⟷ (id⟷ ◎ (q₂ ◎ q₃)) = {!!}
1isSet tt tt id⟷ ((q₁ ◎ q₂) ◎ unite₊) = {!!}
1isSet tt tt id⟷ ((q₁ ◎ q₂) ◎ unite⋆) = {!!}
1isSet tt tt id⟷ ((q₁ ◎ q₂) ◎ id⟷) = {!!}
1isSet tt tt id⟷ ((q₁ ◎ q₂) ◎ (q₃ ◎ q₄)) = {!!}
1isSet tt tt (p₁ ◎ p₂) id⟷ = {!!}
1isSet tt tt (p₁ ◎ p₂) (q₁ ◎ q₂) = {!!}
------------------------------------------------------------------------------
-- Level 2 etc.
data 2U : Set where
2ZERO : 2U
2ONE : 2U
2PLUS : 2U → 2U → 2U
2TIMES : 2U → 2U → 2U
1PATH : (t₁ t₂ : 1U•) → 2U
data 1Path (t₁ t₂ : 1U•) : Set where
1path : (c : t₁ ⇔ t₂) → 1Path t₁ t₂
2⟦_⟧ : 2U → Set
2⟦ 2ZERO ⟧ = ⊥
2⟦ 2ONE ⟧ = ⊤
2⟦ 2PLUS t₁ t₂ ⟧ = 2⟦ t₁ ⟧ ⊎ 2⟦ t₂ ⟧
2⟦ 2TIMES t₁ t₂ ⟧ = 2⟦ t₁ ⟧ × 2⟦ t₂ ⟧
2⟦ 1PATH t₁ t₂ ⟧ = 1Path t₁ t₂
record 2U• : Set where
constructor 2•[_,_]
field
2∣_∣ : 2U
2• : 2⟦ 2∣_∣ ⟧
data _2⇔_ : 2U• → 2U• → Set where
id2⇔ : ∀ {t v} → 2•[ t , v ] 2⇔ 2•[ t , v ]
-- and all the remaining combinators...
-- Eckmann-Hilton
Ω : (t : U) → {v : ⟦ t ⟧} → 1U•
Ω t {v} = 1•[ PATH t• t• , path id⟷ ]
where t• = •[ t , v ]
Ω² : (t : U) → {v : ⟦ t ⟧} → 2U•
Ω² t {v} = 2•[ 1PATH t• t• , 1path id⇔ ]
where t• = Ω t {v}
eckmann-hilton : {t : U} {v : ⟦ t ⟧} (α β : (Ω t {v}) ⇔ (Ω t {v})) →
(2•[ 1PATH (Ω t {v}) (Ω t {v}) , 1path (α ◎ β) ] 2⇔
2•[ 1PATH (Ω t {v}) (Ω t {v}) , 1path (β ◎ α) ])
eckmann-hilton {t} {v} α β = {!!}
------------------------------------------------------------------------------
-- Int construction
-- Types are of the form t - t'
record Uℤ : Set where
constructor _-_
field
pos : U
neg : U
open Uℤ
ZEROℤ ONEℤ : Uℤ
ZEROℤ = ZERO - ZERO
ONEℤ = ONE - ZERO
PLUSℤ : Uℤ → Uℤ → Uℤ
PLUSℤ (pos₁ - neg₁) (pos₂ - neg₂) = PLUS pos₁ pos₂ - PLUS neg₁ neg₂
TIMESℤ : Uℤ → Uℤ → Uℤ
TIMESℤ (pos₁ - neg₁) (pos₂ - neg₂) =
PLUS (TIMES pos₁ pos₂) (TIMES neg₁ neg₂) -
PLUS (TIMES pos₁ neg₂) (TIMES neg₁ pos₂)
FLIPℤ : Uℤ → Uℤ
FLIPℤ (pos - neg) = neg - pos
LOLLIℤ : Uℤ → Uℤ → Uℤ
LOLLIℤ (pos₁ - neg₁) (pos₂ - neg₂) = PLUS neg₁ pos₂ - PLUS pos₁ neg₂
-- Pointed types
data Uℤ• : Set where
pos• : (t : Uℤ) → ⟦ pos t ⟧ → Uℤ•
neg• : (t : Uℤ) → ⟦ neg t ⟧ → Uℤ•
ZEROℤ+• : {t : U} {v : ⟦ t ⟧} → Uℤ•
ZEROℤ+• {t} {v} = pos• (t - t) v
ZEROℤ-• : {t : U} {v : ⟦ t ⟧} → Uℤ•
ZEROℤ-• {t} {v} = neg• (t - t) v
PLUS1ℤ• : Uℤ• → Uℤ → Uℤ•
PLUS1ℤ• (pos• t₁ v₁) t₂ = pos• (PLUSℤ t₁ t₂) (inj₁ v₁)
PLUS1ℤ• (neg• t₁ v₁) t₂ = neg• (PLUSℤ t₁ t₂) (inj₁ v₁)
PLUS2ℤ• : Uℤ → Uℤ• → Uℤ•
PLUS2ℤ• t₁ (pos• t₂ v₂) = pos• (PLUSℤ t₁ t₂) (inj₂ v₂)
PLUS2ℤ• t₁ (neg• t₂ v₂) = neg• (PLUSℤ t₁ t₂) (inj₂ v₂)
-- Combinators on pointed types
data _⇄_ : Uℤ• → Uℤ• → Set where
Fwd : ∀ {t₁ t₂ t₃ t₄ v₁ v₃} →
•[ PLUS t₁ t₄ , inj₁ v₁ ] ⟷ •[ PLUS t₂ t₃ , inj₂ v₃ ] →
pos• (t₁ - t₂) v₁ ⇄ pos• (t₃ - t₄) v₃
Bck : ∀ {t₁ t₂ t₃ t₄ v₂ v₄} →
•[ PLUS t₁ t₄ , inj₂ v₄ ] ⟷ •[ PLUS t₂ t₃ , inj₁ v₂ ] →
neg• (t₁ - t₂) v₂ ⇄ neg• (t₃ - t₄) v₄
B2F : ∀ {t v} → neg• (t - t) v ⇄ pos• (t - t) v
F2B : ∀ {t v} → pos• (t - t) v ⇄ neg• (t - t) v
unite₊⇄ : {t : Uℤ•} → PLUS2ℤ• ZEROℤ t ⇄ t
unite₊⇄ {pos• t v} =
Fwd (•[ PLUS (PLUS ZERO (pos t)) (neg t) , inj₁ (inj₂ v) ]
⟷⟨ assocr2₊ ⟩
•[ PLUS ZERO (PLUS (pos t) (neg t)) , inj₂ (inj₁ v) ]
⟷⟨ unite₊ ◎ swap1₊ ⟩
•[ PLUS (neg t) (pos t) , inj₂ v ]
⟷⟨ uniti₊ ⟩
•[ PLUS ZERO (PLUS (neg t) (pos t)) , inj₂ (inj₂ v) ]
⟷⟨ assocl3₊ ⟩
•[ PLUS (PLUS ZERO (neg t)) (pos t) , inj₂ v ] □)
unite₊⇄ {neg• t v} =
Bck (•[ PLUS (PLUS ZERO (pos t)) (neg t) , inj₂ v ]
⟷⟨ assocr3₊ ⟩
•[ PLUS ZERO (PLUS (pos t) (neg t)) , inj₂ (inj₂ v) ]
⟷⟨ unite₊ ◎ swap2₊ ◎ uniti₊ ⟩
•[ PLUS ZERO (PLUS (neg t) (pos t)) , inj₂ (inj₁ v) ]
⟷⟨ assocl2₊ ⟩
•[ PLUS (PLUS ZERO (neg t)) (pos t) , inj₁ (inj₂ v) ] □)
uniti₊⇄ : {t : Uℤ•} → t ⇄ PLUS2ℤ• ZEROℤ t
uniti₊⇄ {pos• t v} =
Fwd (•[ PLUS (pos t) (PLUS ZERO (neg t)) , inj₁ v ]
⟷⟨ assocl1₊ ⟩
•[ PLUS (PLUS (pos t) ZERO) (neg t) , inj₁ (inj₁ v) ]
⟷⟨ swap1₊ ⟩
•[ PLUS (neg t) (PLUS (pos t) ZERO) , inj₂ (inj₁ v) ]
⟷⟨ ⊕2 swap1₊ ⟩
•[ PLUS (neg t) (PLUS ZERO (pos t)) , inj₂ (inj₂ v) ] □)
uniti₊⇄ {neg• t v} =
Bck (•[ PLUS (pos t) (PLUS ZERO (neg t)) , inj₂ (inj₂ v) ]
⟷⟨ ⊕2 swap2₊ ⟩
•[ PLUS (pos t) (PLUS (neg t) ZERO) , inj₂ (inj₁ v) ]
⟷⟨ swap2₊ ⟩
•[ PLUS (PLUS (neg t) ZERO) (pos t) , inj₁ (inj₁ v) ]
⟷⟨ assocr1₊ ⟩
•[ PLUS (neg t) (PLUS ZERO (pos t)) , inj₁ v ] □)
swap1₊⇄ : {t₁ : Uℤ•} {t₂ : Uℤ} → PLUS1ℤ• t₁ t₂ ⇄ PLUS2ℤ• t₂ t₁
swap1₊⇄ {pos• t₁ v₁} {t₂} =
Fwd (•[ PLUS (PLUS (pos t₁) (pos t₂)) (PLUS (neg t₂) (neg t₁)) ,
inj₁ (inj₁ v₁) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg t₂)) (PLUS (pos t₂) (pos t₁)) ,
inj₂ (inj₂ v₁) ] □)
swap1₊⇄ {neg• t₁ v₁} {t₂} =
Bck (•[ PLUS (PLUS (pos t₁) (pos t₂)) (PLUS (neg t₂) (neg t₁)) ,
inj₂ (inj₂ v₁) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg t₂)) (PLUS (pos t₂) (pos t₁)) ,
inj₁ (inj₁ v₁) ] □)
swap2₊⇄ : {t₁ : Uℤ} {t₂ : Uℤ•} → PLUS2ℤ• t₁ t₂ ⇄ PLUS1ℤ• t₂ t₁
swap2₊⇄ {t₁} {pos• t₂ v₂} =
Fwd (•[ PLUS (PLUS (pos t₁) (pos t₂)) (PLUS (neg t₂) (neg t₁)) ,
inj₁ (inj₂ v₂) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg t₂)) (PLUS (pos t₂) (pos t₁)) ,
inj₂ (inj₁ v₂) ] □)
swap2₊⇄ {t₁} {neg• t₂ v₂} =
Bck (•[ PLUS (PLUS (pos t₁) (pos t₂)) (PLUS (neg t₂) (neg t₁)) ,
inj₂ (inj₁ v₂) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg t₂)) (PLUS (pos t₂) (pos t₁)) ,
inj₁ (inj₂ v₂) ] □)
assocl1₊⇄ : {t₁ : Uℤ•} {t₂ t₃ : Uℤ} →
PLUS1ℤ• t₁ (PLUSℤ t₂ t₃) ⇄ PLUS1ℤ• (PLUS1ℤ• t₁ t₂) t₃
assocl1₊⇄ {pos• t₁ v₁} {t₂} {t₃} =
Fwd (•[ PLUS (PLUS (pos t₁) (pos (PLUSℤ t₂ t₃)))
(PLUS (neg (PLUSℤ t₁ t₂)) (neg t₃)) ,
inj₁ (inj₁ v₁) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg (PLUSℤ t₂ t₃)))
(PLUS (pos (PLUSℤ t₁ t₂)) (pos t₃)) ,
inj₂ (inj₁ (inj₁ v₁)) ] □)
assocl1₊⇄ {neg• t₁ v₁} {t₂} {t₃} =
Bck (•[ PLUS (PLUS (pos t₁) (pos (PLUSℤ t₂ t₃)))
(PLUS (neg (PLUSℤ t₁ t₂)) (neg t₃)) ,
inj₂ (inj₁ (inj₁ v₁)) ]
⟷⟨ {!!} ⟩
•[ PLUS (PLUS (neg t₁) (neg (PLUSℤ t₂ t₃)))
(PLUS (pos (PLUSℤ t₁ t₂)) (pos t₃)) ,
inj₁ (inj₁ v₁) ] □)
{--
assocl2₊ : ∀ {t₁ t₂ t₃ v₂} →
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ] ⟷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ]
assocl3₊ : ∀ {t₁ t₂ t₃ v₃} →
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ] ⟷
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ]
assocr1₊ : ∀ {t₁ t₂ t₃ v₁} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₁ v₁) ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₁ v₁ ]
assocr2₊ : ∀ {t₁ t₂ t₃ v₂} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₁ (inj₂ v₂) ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₁ v₂) ]
assocr3₊ : ∀ {t₁ t₂ t₃ v₃} →
•[ PLUS (PLUS t₁ t₂) t₃ , inj₂ v₃ ] ⟷
•[ PLUS t₁ (PLUS t₂ t₃) , inj₂ (inj₂ v₃) ]
unite⋆ : ∀ {t v} → •[ TIMES ONE t , (tt , v) ] ⟷ •[ t , v ]
uniti⋆ : ∀ {t v} → •[ t , v ] ⟷ •[ TIMES ONE t , (tt , v) ]
swap⋆ : ∀ {t₁ t₂ v₁ v₂} →
•[ TIMES t₁ t₂ , (v₁ , v₂) ] ⟷ •[ TIMES t₂ t₁ , (v₂ , v₁) ]
assocl⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ] ⟷
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ]
assocr⋆ : ∀ {t₁ t₂ t₃ v₁ v₂ v₃} →
•[ TIMES (TIMES t₁ t₂) t₃ , ((v₁ , v₂) , v₃) ] ⟷
•[ TIMES t₁ (TIMES t₂ t₃) , (v₁ , (v₂ , v₃)) ]
distz : ∀ {t v absurd} →
•[ TIMES ZERO t , (absurd , v) ] ⟷ •[ ZERO , absurd ]
factorz : ∀ {t v absurd} →
•[ ZERO , absurd ] ⟷ •[ TIMES ZERO t , (absurd , v) ]
dist1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ] ⟷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ]
dist2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ] ⟷
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ]
factor1 : ∀ {t₁ t₂ t₃ v₁ v₃} →
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₁ (v₁ , v₃) ] ⟷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₁ v₁ , v₃) ]
factor2 : ∀ {t₁ t₂ t₃ v₂ v₃} →
•[ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) , inj₂ (v₂ , v₃) ] ⟷
•[ TIMES (PLUS t₁ t₂) t₃ , (inj₂ v₂ , v₃) ]
--}
id⇄ : {t : Uℤ•} → t ⇄ t
id⇄ {pos• t p} = Fwd swap1₊
id⇄ {neg• t n} = Bck swap2₊
{--
_◎⇄_ : {t₁ t₂ t₃ : Uℤ•} → (t₁ ⇄ t₂) → (t₂ ⇄ t₃) → (t₁ ⇄ t₃)
_◎⇄_ {pos• t₁ v₁} {pos• t₂ v₂} {pos• t₃ v₃} (Fwd c₁) (Fwd c₂) =
Fwd (•[ PLUS (pos t₁) (neg t₃) , inj₁ v₁ ]
⟷⟨ {!!} ⟩
•[ PLUS (neg t₁) (pos t₃) , inj₂ v₃ ] □)
-- c₁ : •[ PLUS (pos t₁) (neg t₂) , inj₁ v₁ ] ⟷
-- •[ PLUS (neg t₁) (pos t₂) , inj₂ v₂ ]
-- c₂ : •[ PLUS (pos t₂) (neg t₃) , inj₁ v₂ ] ⟷
-- •[ PLUS (neg t₂) (pos t₃) , inj₂ v₃ ]
_◎⇄_ {pos• (t₁ - t₂) v₁} {pos• (t₃ - .t₃) v₃} {neg• (.t₃ - .t₃) .v₃}
(Fwd c) F2B = {!!}
-- ?7 : pos• (t₁ - t₂) v₁ ⇄ neg• (t₃ - t₃) v₃
Bck c₁ ◎⇄ Bck c₂ = Bck {!!}
Bck c ◎⇄ B2F = {!!}
B2F ◎⇄ Fwd c = {!!}
B2F ◎⇄ F2B = id⇄
F2B ◎⇄ Bck c = {!!}
F2B ◎⇄ B2F = id⇄
--}
{--
_⊕1_ : ∀ {t₁ t₂ t₃ t₄ v₁ v₂ v₃ v₄} →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ]) → (•[ t₂ , v₂ ] ⟷ •[ t₄ , v₄ ]) →
(•[ PLUS t₁ t₂ , inj₁ v₁ ] ⟷ •[ PLUS t₃ t₄ , inj₁ v₃ ])
_⊕2_ : ∀ {t₁ t₂ t₃ t₄ v₁ v₂ v₃ v₄} →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ]) → (•[ t₂ , v₂ ] ⟷ •[ t₄ , v₄ ]) →
(•[ PLUS t₁ t₂ , inj₂ v₂ ] ⟷ •[ PLUS t₃ t₄ , inj₂ v₄ ])
_⊗_ : ∀ {t₁ t₂ t₃ t₄ v₁ v₂ v₃ v₄} →
(•[ t₁ , v₁ ] ⟷ •[ t₃ , v₃ ]) → (•[ t₂ , v₂ ] ⟷ •[ t₄ , v₄ ]) →
(•[ TIMES t₁ t₂ , (v₁ , v₂) ] ⟷ •[ TIMES t₃ t₄ , (v₃ , v₄) ])
--}
-- trace
η : ∀ {t v} → ZEROℤ+• {t} {v} ⇄ ZEROℤ-• {t} {v}
η = F2B
ε : ∀ {t v} → ZEROℤ-• {t} {v} ⇄ ZEROℤ+• {t} {v}
ε = B2F
------------------------------------------------------------------------------
|
assembly_code/chp5_08.asm | Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions | 104 | 21207 | <filename>assembly_code/chp5_08.asm
[org 0x0100]
jmp start
arr: dw 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
start: mov ax, 13
sub sp,2
push ax
call myalloc
pop ax
push ax ;Index
push 13 ;Bits
call myfree
end: mov ax, 0x4c00
int 21h
;------------------------------------------------------------------
myalloc: push bp
mov bp,sp
sub sp,4 ;creating space for two local variables
;bp - 2 will be used to store the index temporarily
;bp - 4 will be used to hold the status of zeroes whether they
; are currently being checked or not.
pusha
mov ax, 0
mov bx, 0
mov cx, 0
mov word [bp - 2], -1 ;index is -1 by default
mov si, [bp + 4] ;No. of zeroes to be checked
cmp si, 0 ;If no. zero bits to be checked is 0, then do nothing
jz dreturn
mov dx, 1000000000000000b ;mask for testing bits
mov word [bp - 4], 0 ;Currently we don't have a zero at hand
loop1: test byte [arr + bx] , dh
jnz reset
cmp word [bp - 4],1 ;If some zeroes are at hand then don't store a new index
jz loop2
zeroFound: mov word [bp - 2], cx ;Storing the index of the first zero found
mov word [bp - 4], 1 ;Currently a zero is found .
loop2: inc ax ;No. of zeroes currently checked
cmp ax,si
jz changeto1
l1: inc cx
cmp cx, 0x400 ;0x400bits is equivalent to 1024 bits
jz return ;Means you are at the end of the arr
shr dh,1
cmp dh,0
jz update
jmp loop1
update: mov dx, 1000000000000000b
add bx, 1
jmp loop1
reset: mov ax, 0
mov word [bp - 2], -1
mov word [bp - 4], 0
jmp l1
dreturn: jmp return ;Used because of short range jump issue at line 53
; After finding that many consecutive zero bits in the array , making them one
changeto1: mov ax,0
mov bx,0
mov cx,0
mov dx,8
mov ax, [bp - 2] ;starting bit (index)
div dl
mov dx, 0
mov dl,al
mov bx,dx ;Now bx contains the byte number which contains the starting index
mov dx,1000000000000000b
cmp ah,0
jnz scenario1
scenario0: ;Desired Byte doesn't split into two bytes
loop3: or byte [arr + bx], dh
inc cl
cmp cl, [bp + 4]
jz return
shr dh,1
cmp dh,0
jz update1
jmp loop3
;Desired Byte splits into two bytes
scenario1: mov cl, ah
shr dx, cl
jmp loop3
update1: mov dx,1000000000000000b
add bx,1
jmp loop3
return: mov ax, [bp - 2]
mov [bp + 6], ax
popa
add sp, 4
pop bp
ret 2
;--------------------------------------------------------------
myfree: push bp
mov bp,sp
pusha
mov ax,0
mov bx,0
mov cx,0
mov dx,8
mov ax, [bp + 6]
div dl
mov dx, 0
mov dl,al
mov bx,dx ;Now bx contains the byte number which contains the starting index
mov dx,0111111111111111b
cmp ah,0
jnz _scenario1
_scenario0: ;Desired Byte doesn't split into two bytes
_loop3: and byte [arr + bx], dh
inc cl
cmp cl, [bp + 4]
jz _return
shr dh,1
cmp dh,0
jz _update1
jmp _loop3
;Desired Byte splits into two bytes
_scenario1: mov cl, ah
shr dx, cl
jmp _loop3
_update1: mov dx,0111111111111111b
add bx,1
jmp _loop3
_return: popa
pop bp
ret 4
;-------------------------------------------------------------
|
grammars/DICLexer.g4 | Sylvan-Materials/cifio | 0 | 7772 | <filename>grammars/DICLexer.g4
lexer grammar DICLexer;
USdatablock_p_id : '_datablock.id';
USdatablock_p_description : '_datablock.description';
USdictionary_p_title : '_dictionary.title';
USdictionary_p_version : '_dictionary.version';
USdictionary_p_datablock_id : '_dictionary.datablock_id';
USdictionary_history_p_version : '_dictionary_history.version';
USdictionary_history_p_update : '_dictionary_history.update';
USdictionary_history_p_revision : '_dictionary_history.revision';
UScategory_p_description : '_category.description';
UScategory_p_id : '_category.id';
UScategory_p_mandatory_code : '_category.mandatory_code';
UScategory_key_p_name : '_category_key.name';
USsub_category_p_id : '_sub_category.id';
USsub_category_p_description : '_sub_category.description';
UScategory_group_list_p_id : '_category_group_list.id';
UScategory_group_list_p_parent_id : '_category_group_list.parent_id';
UScategory_group_list_p_description : '_category_group_list.description';
UScategory_examples_p_detail : '_category_examples.detail';
USitem_p_name : '_item.name';
USitem_p_category_id : '_item.category_id';
USitem_p_mandatory_code : '_item.mandatory_code';
USitem_type_list_p_code : '_item_type_list.code';
USitem_type_list_p_primitive_code : '_item_type_list.primitive_code';
USitem_type_list_p_construct : '_item_type_list.construct';
USitem_type_list_p_detail : '_item_type_list.detail';
USitem_units_list_p_code : '_item_units_list.code';
USitem_units_list_p_detail : '_item_units_list.detail';
USitem_units_conversion_p_from_code : '_item_units_conversion.from_code';
USitem_units_conversion_p_to_code : '_item_units_conversion.to_code';
USitem_units_conversion_p_operator : '_item_units_conversion.operator';
USitem_units_conversion_p_factor : '_item_units_conversion.factor';
DATA_ : [Dd] [Aa] [Tt] [Aa] Underscore ->pushMode(BlockHeadingMode);
LOOP_ : Eol Space* [Ll] [Oo] [Oo] [Pp] Underscore ;
SAVE_ : Eol Space* [Ss] [Aa] [Vv] [Ee] Underscore ->pushMode(SaveHeadingMode);
Comments : Pound (OrdinaryChar|WhiteSpace|Dash|Double_Quote | Pound | Underscore | Single_Quote | Semi | LBracket | RBracket)*;
SingleQuotedString : Single_Quote ( '\\\'' | . )*? Single_Quote;//(OrdinaryChar|WhiteSpace|Space|Tab|Dash|Numeric|Period|Digit|'\\\'')+ Single_Quote;
DoubleQuotedString : Double_Quote ( '\\"' | . )*? Double_Quote;//(OrdinaryChar|Space|Tab|'\\"')* Double_Quote;
SemiColonTextField : Eol Semi ( Semi | . )*? Eol Semi;//Eol (WhiteSpace? (OrdinaryChar (OrdinaryChar|Space|Tab|Dash|Period|Underscore|Double_Quote|Single_Quote|Numeric)*)* Eol)* Semi ;
Value : (Period | Questionmark | (OrdinaryChar|LBracket)(OrdinaryChar | LBracket | RBracket |Numeric|Period|Dash)* | Numeric);
//WhiteSpace : (TokenizedComments | Space+ | Tab)+ ;
WhiteSpace : ((Space+ | Tab+ | Eol)+ Comments?)+;
Numeric : (Number | Number '(' UnsignedInteger ')' );
Number : (Float | Integer );
Float : ( ( (Plus|Dash) ? ( (Digit) * Period UnsignedInteger ) |
(Digit) + Period ) | Integer Exponent ) (Exponent) ? ;
fragment
Exponent : (('e' | 'E' ) | ('e' | 'E' )( Plus | Dash )) UnsignedInteger;
Integer : ( Plus | Dash )? UnsignedInteger;
UnsignedInteger : ( Digit )+;
Eol : '\n\r'|'\n'|'\r';
Semi : ';';
Pound : '#';
//Dollar : '$';
Underscore : '_';
Period : '.';
Questionmark : '?';
fragment
LBracket : '[';
fragment
RBracket : ']';
Plus : '+';
Dash : '-';
Space : ' ';
Tab : '\t';
Double_Quote : '"';
Single_Quote : '\'';
OrdinaryChar : ( [a-z] | [A-Z] | '!' | '%' | '&' | '(' | ')' | '*' | Plus | ',' | Dash | Period | '/' | Digit | ':' | '<' | '=' | '>' | Questionmark | '@' | '\\' | '^' | '`' | '{' | '|' | '}' | '~' | '$' ) ;
fragment
Digit : '0'..'9';
//mode ANY;
mode BlockHeadingMode;
BHText : (OrdinaryChar|Dash|Underscore|Numeric|Double_Quote | Pound | Single_Quote | Semi | LBracket | RBracket)+ ->popMode;
mode SaveHeadingMode;
SHText : (OrdinaryChar|Dash|Underscore|Numeric|Double_Quote | Pound | Single_Quote | Semi | LBracket | RBracket)+ ->popMode;
|
oeis/285/A285957.asm | neoneye/loda-programs | 11 | 85177 | ; A285957: {01->0}-transform of the Thue-Morse word A010060.
; Submitted by <NAME>
; 0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0
mul $0,2
add $0,1
seq $0,171947 ; P-positions for game of UpMark.
div $0,2
sub $0,1
mod $0,2
|
components/src/touch_panel/ft6x06/ft6x06.ads | rocher/Ada_Drivers_Library | 192 | 7164 | <reponame>rocher/Ada_Drivers_Library<gh_stars>100-1000
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- 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 STMicroelectronics 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 --UInt8
-- 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. --
-- --
------------------------------------------------------------------------------
-- Driver package for the FT6x06 touch screen panel
-- Based on the ft6x06 driver from MCD Application Team
with HAL; use HAL;
with HAL.I2C; use HAL.I2C;
with HAL.Touch_Panel;
package FT6x06 is
type FT6x06_Device (Port : not null Any_I2C_Port;
I2C_Addr : I2C_Address) is
limited new HAL.Touch_Panel.Touch_Panel_Device with private;
function Check_Id (This : in out FT6x06_Device) return Boolean;
-- Check the device Id: returns true on a FT5336 touch panel, False is
-- none is found.
procedure TP_Set_Use_Interrupts (This : in out FT6x06_Device;
Enabled : Boolean);
-- Whether the touch panel uses interrupts of polling to process touch
-- information
overriding
procedure Set_Bounds (This : in out FT6x06_Device;
Width : Natural;
Height : Natural;
Swap : HAL.Touch_Panel.Swap_State);
-- Set screen bounds. Touch_State must should stay within screen bounds
overriding
function Active_Touch_Points (This : in out FT6x06_Device)
return HAL.Touch_Panel.Touch_Identifier;
-- Retrieve the number of active touch points
overriding
function Get_Touch_Point (This : in out FT6x06_Device;
Touch_Id : HAL.Touch_Panel.Touch_Identifier)
return HAL.Touch_Panel.TP_Touch_State;
-- Retrieves the position and pressure information of the specified
-- touch
overriding
function Get_All_Touch_Points
(This : in out FT6x06_Device)
return HAL.Touch_Panel.TP_State;
-- Retrieves the position and pressure information of every active touch
-- points
private
type FT6x06_Device (Port : not null Any_I2C_Port;
I2C_Addr : I2C_Address) is
limited new HAL.Touch_Panel.Touch_Panel_Device with record
LCD_Natural_Width : Natural := 0;
LCD_Natural_Height : Natural := 0;
Swap : HAL.Touch_Panel.Swap_State := 0;
end record;
function I2C_Read (This : in out FT6x06_Device;
Reg : UInt8;
Status : out Boolean)
return UInt8;
procedure I2C_Write (This : in out FT6x06_Device;
Reg : UInt8;
Data : UInt8;
Status : out Boolean);
------------------------------------------------------------
-- Definitions for FT6206 I2C register addresses on 8 bit --
------------------------------------------------------------
-- Current mode register of the FT6206 (R/W)
FT6206_DEV_MODE_REG : constant UInt8 := 16#00#;
-- Possible values of FT6206_DEV_MODE_REG
FT6206_DEV_MODE_WORKING : constant UInt8 := 16#00#;
FT6206_DEV_MODE_FACTORY : constant UInt8 := 16#04#;
FT6206_DEV_MODE_MASK : constant UInt8 := 16#07#;
FT6206_DEV_MODE_SHIFT : constant UInt8 := 16#04#;
-- Gesture ID register
FT6206_GEST_ID_REG : constant UInt8 := 16#01#;
-- Possible values of FT6206_GEST_ID_REG
FT6206_GEST_ID_NO_GESTURE : constant UInt8 := 16#00#;
FT6206_GEST_ID_MOVE_UP : constant UInt8 := 16#10#;
FT6206_GEST_ID_MOVE_RIGHT : constant UInt8 := 16#14#;
FT6206_GEST_ID_MOVE_DOWN : constant UInt8 := 16#18#;
FT6206_GEST_ID_MOVE_LEFT : constant UInt8 := 16#1C#;
FT6206_GEST_ID_ZOOM_IN : constant UInt8 := 16#40#;
FT6206_GEST_ID_ZOOM_OUT : constant UInt8 := 16#49#;
-- Touch Data Status register : gives number of active touch points (0..5)
FT6206_TD_STAT_REG : constant UInt8 := 16#02#;
-- Values related to FT6206_TD_STAT_REG
FT6206_TD_STAT_MASK : constant UInt8 := 16#0F#;
FT6206_TD_STAT_SHIFT : constant UInt8 := 16#00#;
-- Values Pn_XH and Pn_YH related
FT6206_TOUCH_EVT_FLAG_PRESS_DOWN : constant UInt8 := 16#00#;
FT6206_TOUCH_EVT_FLAG_LIFT_UP : constant UInt8 := 16#01#;
FT6206_TOUCH_EVT_FLAG_CONTACT : constant UInt8 := 16#02#;
FT6206_TOUCH_EVT_FLAG_NO_EVENT : constant UInt8 := 16#03#;
FT6206_TOUCH_EVT_FLAG_SHIFT : constant UInt8 := 16#06#;
FT6206_TOUCH_EVT_FLAG_MASK : constant UInt8 := 2#1100_0000#;
FT6206_TOUCH_POS_MSB_MASK : constant UInt8 := 16#0F#;
FT6206_TOUCH_POS_MSB_SHIFT : constant UInt8 := 16#00#;
-- Values Pn_XL and Pn_YL related
FT6206_TOUCH_POS_LSB_MASK : constant UInt8 := 16#FF#;
FT6206_TOUCH_POS_LSB_SHIFT : constant UInt8 := 16#00#;
-- Values Pn_WEIGHT related
FT6206_TOUCH_WEIGHT_MASK : constant UInt8 := 16#FF#;
FT6206_TOUCH_WEIGHT_SHIFT : constant UInt8 := 16#00#;
-- Values related to FT6206_Pn_MISC_REG
FT6206_TOUCH_AREA_MASK : constant UInt8 := 2#0100_0000#;
FT6206_TOUCH_AREA_SHIFT : constant UInt8 := 16#04#;
type FT6206_Pressure_Registers is record
XH_Reg : UInt8;
XL_Reg : UInt8;
YH_Reg : UInt8;
YL_Reg : UInt8;
-- Touch Pressure register value (R)
Weight_Reg : UInt8;
-- Touch area register
Misc_Reg : UInt8;
end record;
FT6206_Px_Regs : constant array (Positive range <>)
of FT6206_Pressure_Registers :=
(1 => (XH_Reg => 16#03#,
XL_Reg => 16#04#,
YH_Reg => 16#05#,
YL_Reg => 16#06#,
Weight_Reg => 16#07#,
Misc_Reg => 16#08#),
2 => (XH_Reg => 16#09#,
XL_Reg => 16#0A#,
YH_Reg => 16#0B#,
YL_Reg => 16#0C#,
Weight_Reg => 16#0D#,
Misc_Reg => 16#0E#));
-- Threshold for touch detection
FT6206_TH_GROUP_REG : constant UInt8 := 16#80#;
-- Values FT6206_TH_GROUP_REG : threshold related
FT6206_THRESHOLD_MASK : constant UInt8 := 16#FF#;
FT6206_THRESHOLD_SHIFT : constant UInt8 := 16#00#;
-- Filter function coefficients
FT6206_TH_DIFF_REG : constant UInt8 := 16#85#;
-- Control register
FT6206_CTRL_REG : constant UInt8 := 16#86#;
-- Values related to FT6206_CTRL_REG
-- Will keep the Active mode when there is no touching
FT6206_CTRL_KEEP_ACTIVE_MODE : constant UInt8 := 16#00#;
-- Switching from Active mode to Monitor mode automatically when there
-- is no touching
FT6206_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE : constant UInt8 := 16#01#;
-- The time period of switching from Active mode to Monitor mode when
-- there is no touching
FT6206_TIMEENTERMONITOR_REG : constant UInt8 := 16#87#;
-- Report rate in Active mode
FT6206_PERIODACTIVE_REG : constant UInt8 := 16#88#;
-- Report rate in Monitor mode
FT6206_PERIODMONITOR_REG : constant UInt8 := 16#89#;
-- The value of the minimum allowed angle while Rotating gesture mode
FT6206_RADIAN_VALUE_REG : constant UInt8 := 16#91#;
-- Maximum offset while Moving Left and Moving Right gesture
FT6206_OFFSET_LEFT_RIGHT_REG : constant UInt8 := 16#92#;
-- Maximum offset while Moving Up and Moving Down gesture
FT6206_OFFSET_UP_DOWN_REG : constant UInt8 := 16#93#;
-- Minimum distance while Moving Left and Moving Right gesture
FT6206_DISTANCE_LEFT_RIGHT_REG : constant UInt8 := 16#94#;
-- Minimum distance while Moving Up and Moving Down gesture
FT6206_DISTANCE_UP_DOWN_REG : constant UInt8 := 16#95#;
-- Maximum distance while Zoom In and Zoom Out gesture
FT6206_DISTANCE_ZOOM_REG : constant UInt8 := 16#96#;
-- High 8-bit of LIB Version info
FT6206_LIB_VER_H_REG : constant UInt8 := 16#A1#;
-- Low 8-bit of LIB Version info
FT6206_LIB_VER_L_REG : constant UInt8 := 16#A2#;
-- Chip Selecting
FT6206_CIPHER_REG : constant UInt8 := 16#A3#;
-- Interrupt mode register (used when in interrupt mode)
FT6206_GMODE_REG : constant UInt8 := 16#A4#;
FT6206_G_MODE_INTERRUPT_MASK : constant UInt8 := 16#03#;
-- Possible values of FT6206_GMODE_REG
FT6206_G_MODE_INTERRUPT_POLLING : constant UInt8 := 16#00#;
FT6206_G_MODE_INTERRUPT_TRIGGER : constant UInt8 := 16#01#;
-- Current power mode the FT6206 system is in (R)
FT6206_PWR_MODE_REG : constant UInt8 := 16#A5#;
-- FT6206 firmware version
FT6206_FIRMID_REG : constant UInt8 := 16#A6#;
-- FT6206 Chip identification register
FT6206_CHIP_ID_REG : constant UInt8 := 16#A8#;
-- Possible values of FT6206_CHIP_ID_REG
FT6206_ID_VALUE : constant UInt8 := 16#11#;
-- Release code version
FT6206_RELEASE_CODE_ID_REG : constant UInt8 := 16#AF#;
-- Current operating mode the FT6206 system is in (R)
FT6206_STATE_REG : constant UInt8 := 16#BC#;
end FT6x06;
|
babysteps/fuck.asm | ilya101010/asm_studies | 1 | 387 | Use16
org 0x7C00
start:
cli ; disabling interrupts
mov ax, cs ; segment registers' init
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00 ; stack backwards => ok
mov ax, 0xB800
mov gs, ax ; Использовал для вывода текста прямой доступ к видеопамяти
mov cx, 24
call clrscr
lp0:
mov si, state
call k_puts
call shift_string
loop lp0
jmp $ ; И уходим в бесконечный цикл
iterate:
mov si, state
call eval ; magic; si = refferals; di = output
mov si, newstate
call clr_str
ret
eval: ; the idea is to pass one byte through all of the string => 78 iterations (check: 0M000000, where M is the magic)
pusha
mov si, state
call shift_string
mov si, tmp
call clr_str
mov di, newstate
mov si, state
call strcpy
popa
ret
magic:
pusha
lodsb
and al, 7 ; first 3 bits
mov cl, al
mov dl, 126 ; example rule
shl dl, cl
and dl, 1
test dl, dl
jz pal0
jnz pal1
bk1:
stosb
popa
ret
shift_string: ; RIGHT direction! include si
push di
push si
mov di, tmp
pushad
mov cx, 10
mov dx, 0
add si, 10
add di, 10
push 0
in4:
lodsw
sub si, 4
shr ax, 1
pop dx
pushf
shl dx, 15 ; carry flag from %111 stays in stack
or ax, dx
popf
jc push1
jnc push0
back1:
stosw
sub di, 4
loop in4
pop dx ; bit from first word
add si, 8
add di, 8
lodsw
shl dx, 15
test dx, dx
or ax, dx
stosw
popad
xchg si, di
call strcpy
pop si
pop di
ret
; >>>>>>>>>> Util
put_hash:
push ax
mov al, 0x23
mov ah, 0x0E
int 0x10
pop ax
ret
put_space:
push ax
mov al, 0x20
mov ah, 0x0E
int 0x10
pop ax
ret
ps:
call put_space
jmp back0
ph:
call put_hash
jmp back0
strcpy: ; just for 80 bits
pusha
mov cx, 5
rep movsw
popa
ret
push1:
push 1
jmp back1
push0:
push 0
jmp back1
clr_str:
pusha
mov cx, 5
mov di, si
clrl:
lodsw
mov ax, 0
stosw
loop clrl
popa
ret
pal0:
pushf
and al, 253
popf
jmp bk1
pal1:
pushf
or al, 2
popf
jmp back1
clrscr:
pusha
mov dx, 0 ; set cursor to top left-most corner of screen
mov bh, 0 ; page
mov ah, 0x2 ; ah = 2 => set cursor
int 0x10 ; moving cursor
mov cx, 2000 ; print 2000 = 80*45 chars
mov bh, 0
mov bl, 0xF0 ; gray bg/white fg
mov al, 0x20 ; blank char
mov ah, 0x9
int 0x10
popa
ret
k_puts: ; important: we _are_ outputing bits from the smallest => biggest
pusha
mov cx, 10
in1: ; 10 bytes
mov dl, 1; mask
lodsb ; 8 bits => AL
in2: ; passing through bits
test al, dl
jz ps
jnz ph
back0:
shl dl, 1
jnc in2 ; carry != 1 => NOT overflow in dl => NOT finish (8 bits in dl)
loop in1
popa
ret
; >>>>>>>>>> vars in memory
state dw 0x3, 0,0,0,0x8000 ; 2 hex symbols => 8 binary states
newstate dw 0,0,0,0,0 ; place to copy; how to dup?!
tmp dw 0,0,0,0,0 ; place to copy; how to dup?!
rule db 126
; >>>>>>>>>> boot sector stuff
times 510-($-$$) db 0
db 0x55, 0xaa |
Labs/Lab 3/Watkins_William_Lab3.asm | williamcwatkins/ASEN-5018-Microavionics | 0 | 83494 | ;;;;;;; Lab 3 Original Template for ASEN 4067/5067 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Author: YOUR NAME HERE
; Date: DATE HERE
; Target: PIC18F87K22
;
; REFERENCES: <NAME>, <NAME>
; Using as reference also: main.s by Dan1138
; lab3_orig.asm by <NAME>, <NAME>, <NAME> and <NAME>
; Date (Original): 2021-06-5
;
; Compiler: pic-as(v2.32)
; IDE: MPLABX v5.50
; !!!!!!!!!!!!!!!IMPORTANT!!!!!!!!
; Compiler Notes:
; Add this line to the Compiler flags i.e
; Right click on project name -> Properties -> pic-as Global Options ->
; Additional options:
; -Wl,-presetVec=0h,-pHiPriISR_Vec=0008h,-pLoPriISR_Vec=0018h
; Description:
; On power up execute the following sequence:
; RD5 ON for ~1 second then OFF
; RD6 ON for ~1 second then OFF
; RD7 ON for ~1 second then OFF
; LOOP on the following forever:
; Blink "Alive" LED (RD4) ON for ~1sec then OFF for ~1sec
; Read input from RPG (at least every 2ms) connected to pins
; RD0 and RD1 and mirror the output onto pins RJ2 and RJ3
; ASEN5067 ONLY: Read input from baseboard RD3 button and toggle the value
; of RD2 such that the switch being pressed and RELEASED causes
; RD2 to change state from ON to OFF or OFF to ON
; NOTE: ~1 second means +/- 100msec
;;;;;;;;;;;;;;;;;;;;;;;;;;;; Program hierarchy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Mainline
; Loop
; Initial - Initialize ports and perform LED sequence
; WaitXXXms - Subroutine to wait XXXms
; Wait1sec - Subroutine to wait 1 sec
; Check_SW - Subroutine to check the status of RD3 button and change RD2 (ASEN5067 ONLY)
; Check_RPG - Read the values of the RPG from RD0 and RD1 and display on RJ2 and RJ3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hardware notes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; RPG-A port/pin is RJ2
; RPG-B port/pin is RJ3
// <editor-fold defaultstate="collapsed" desc="Pin Mapping">
/*
Pin | Pin Name/Register Name
1 | RH2/AN21/A18
2 | RH3/AN20/A19
3 | RE1/P2C/WR/AD9
4 | RE0/P2D/RD/AD8
5 | RG0/ECCP3/P3A
6 | RG1/TX2/CK2/AN19/C3OUT
7 | RG2/RX2/DT2/AN18/C3INA
8 | RG3/CCP4/AN17/P3D/C3INB
9 | MCLR/RG5
10 | RG4/RTCC/T7CKI(Note:2)/T5G/CCP5/AN16/P1D/C3INC
11 | VSS
12 | VDDCORE/VCAP
13 | RF7/AN5/SS1
14 | RF6/AN11/C1INA
15 | RF5/AN10/C1INB
16 | RF4/AN9/C2INA
17 | RF3/AN8/C2INB/CTMUI
18 | RF2/AN7/C1OUT
19 | RH7/CCP6(Note:3)/P1B/AN15
20 | RH6/CCP7(Note:3)/P1C/AN14/C1INC
21 | RH5/CCP8(Note:3)/P3B/AN13/C2IND
22 | RH4/CCP9(Note:2,3)/P3C/AN12/C2INC
23 | RF1/AN6/C2OUT/CTDIN
24 | ENVREG
25 | AVDD
26 | AVSS
27 | RA3/AN3/VREF+
28 | RA2/AN2/VREF-
29 | RA1/AN1
30 | RA0/AN0/ULPWU
31 | VSS
32 | VDD
33 | RA5/AN4/T1CKI/T3G/HLVDIN
34 | RA4/T0CKI
35 | RC1/SOSC/ECCP2/P2A
36 | RC0/SOSCO/SCKLI
37 | RC6/TX1/CK1
38 | RC7/RX1/DT1
39 | RJ4/BA0
40 | RJ5/CE
41 | RJ6/LB
42 | RJ7/UB
43 | RC2/ECCP1/P1A
44 | RC3/SCK1/SCL1
45 | RC4/SDI1/SDA1
46 | RC5/SDO1
47 | RB7/KBI3/PGD
48 | VDD
49 | OSC1/CLKI/RA7
50 | OSC2/CLKO/RA6
51 | VSS
52 | RB6/KBI2/PGC
53 | RB5/KBI1/T3CKI/T1G
54 | RB4/KBI0
55 | RB3/INT3/CTED2/ECCP2(Note:1)/P2A
56 | RB2/INT2/CTED1
57 | RB1/INT1
58 | RB0/INT0/FLT0
59 | RJ3/WRH
60 | RJ2/WRL
61 | RJ1/OE
62 | RJ0/ALE
63 | RD7/SS2/PSP7/AD7
64 | RD6/SCK2/SCL2/PSP6/AD6
65 | RD5/SDI2/SDA2/PSP5/AD5
66 | RD4/SDO2/PSP4/AD4
67 | RD3/PSP3/AD3
68 | RD2/PSP2/AD2
69 | RD1/T5CKI/T7G/PSP1/AD1
70 | VSS
71 | VDD
72 | RD0/PSP0/CTPLS/AD0
73 | RE7/ECCP2/P2A/AD15
74 | RE6/P1B/CCP6(Note:3)/AD14
75 | RE5/P1C/CCP7(Note:3)/AD13
76 | RE4/P3B/CCP8(Note:3)/AD12
77 | RE3/P3C/CCP9(Note:2,3)/REF0/AD11
78 | RE2/P2B/CCP10(Note:2)/CS/AD10
79 | RH0/AN23/A16
80 | RH1/AN22/A17
Note (1) The ECCP2 pin placement depends on the CCP2MX Configuration bit
setting and whether the device is in Microcontroller or Extended
Microcontroller mode.
(2) Not available on the PIC18F65K22 and PIC18F85K22 devices.
(3) The CC6, CCP7, CCP8 and CCP9 pin placement depends on the
setting of the ECCPMX Configuration bit (CONFIG3H<1>).
*/
// </editor-fold>
;;;;;;;;;;;;;;;;;;;;;;;;;; Assembler Directives ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Processor Definition
PROCESSOR 18F87K22
; Radix Definition
RADIX DEC
; List Definition
; C: Set the page (i.e., Column) width
; N: Set the page length
; X: Turn MACRO expansion on or off
; LIST C = 160, N = 0, X = OFF
; Include File:
#include <xc.inc>
; PIC18F87K22 Configuration Bit Settings
// <editor-fold defaultstate="collapsed" desc="CONFIG Definitions">
; CONFIG1L
CONFIG RETEN = ON ; VREG Sleep Enable bit (Enabled)
CONFIG INTOSCSEL = HIGH ; LF-INTOSC Low-power Enable bit (LF-INTOSC in
; High-power mode during Sleep)
CONFIG SOSCSEL = HIGH ; SOSC Power Selection and mode Configuration bits
; (High Power SOSC circuit selected)
CONFIG XINST = OFF ; Extended Instruction Set (Disabled)
; CONFIG1H
CONFIG FOSC = HS1 ; Oscillator (HS oscillator
; (Medium power, 4 MHz - 16 MHz))
CONFIG PLLCFG = OFF
; PLL x4 Enable bit (Disabled)
CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor (Disabled)
CONFIG IESO = OFF ; Internal External Oscillator Switch Over Mode
; (Disabled)
; CONFIG2L
CONFIG PWRTEN = ON ; Power Up Timer (Enabled)
CONFIG BOREN = ON ; Brown Out Detect (Controlled with SBOREN bit)
CONFIG BORV = 1 ; Brown-out Reset Voltage bits (2.7V)
CONFIG BORPWR = ZPBORMV ; BORMV Power level (ZPBORMV instead of BORMV
; is selected)
; CONFIG2H
CONFIG WDTEN = OFF ; Watchdog Timer (WDT disabled in hardware;
; SWDTEN bit disabled)
CONFIG WDTPS = 1048576 ; Watchdog Postscaler (1:1048576)
; CONFIG3L
CONFIG RTCOSC = SOSCREF ; RTCC Clock Select (RTCC uses SOSC)
CONFIG EASHFT = ON ; External Address Shift bit (Address Shifting
; enabled)
CONFIG ABW = MM ; Address Bus Width Select bits (8-bit
; address bus)
CONFIG BW = 16 ; Data Bus Width (16-bit external bus mode)
CONFIG WAIT = OFF ; External Bus Wait (Disabled)
; CONFIG3H
CONFIG CCP2MX = PORTC ; CCP2 Mux (RC1)
CONFIG ECCPMX = PORTE ; ECCP Mux (Enhanced CCP1/3 [P1B/P1C/P3B/P3C]
; muxed with RE6/RE5/RE4/RE3)
; CONFIG MSSPMSK = MSK7 ; MSSP address masking (7 Bit address masking
; mode)
CONFIG MCLRE = ON ; Master Clear Enable (MCLR Enabled, RG5 Disabled)
; CONFIG4L
CONFIG STVREN = ON ; Stack Overflow Reset (Enabled)
CONFIG BBSIZ = BB2K ; Boot Block Size (2K word Boot Block size)
; CONFIG5L
CONFIG CP0 = OFF ; Code Protect 00800-03FFF (Disabled)
CONFIG CP1 = OFF ; Code Protect 04000-07FFF (Disabled)
CONFIG CP2 = OFF ; Code Protect 08000-0BFFF (Disabled)
CONFIG CP3 = OFF ; Code Protect 0C000-0FFFF (Disabled)
CONFIG CP4 = OFF ; Code Protect 10000-13FFF (Disabled)
CONFIG CP5 = OFF ; Code Protect 14000-17FFF (Disabled)
CONFIG CP6 = OFF ; Code Protect 18000-1BFFF (Disabled)
CONFIG CP7 = OFF ; Code Protect 1C000-1FFFF (Disabled)
; CONFIG5H
CONFIG CPB = OFF ; Code Protect Boot (Disabled)
CONFIG CPD = OFF ; Data EE Read Protect (Disabled)
; CONFIG6L
CONFIG WRT0 = OFF ; Table Write Protect 00800-03FFF (Disabled)
CONFIG WRT1 = OFF ; Table Write Protect 04000-07FFF (Disabled)
CONFIG WRT2 = OFF ; Table Write Protect 08000-0BFFF (Disabled)
CONFIG WRT3 = OFF ; Table Write Protect 0C000-0FFFF (Disabled)
CONFIG WRT4 = OFF ; Table Write Protect 10000-13FFF (Disabled)
CONFIG WRT5 = OFF ; Table Write Protect 14000-17FFF (Disabled)
CONFIG WRT6 = OFF ; Table Write Protect 18000-1BFFF (Disabled)
CONFIG WRT7 = OFF ; Table Write Protect 1C000-1FFFF (Disabled)
; CONFIG6H
CONFIG WRTC = OFF ; Config. Write Protect (Disabled)
CONFIG WRTB = OFF ; Table Write Protect Boot (Disabled)
CONFIG WRTD = OFF ; Data EE Write Protect (Disabled)
; CONFIG7L
CONFIG EBRT0 = OFF ; Table Read Protect 00800-03FFF (Disabled)
CONFIG EBRT1 = OFF ; Table Read Protect 04000-07FFF (Disabled)
CONFIG EBRT2 = OFF ; Table Read Protect 08000-0BFFF (Disabled)
CONFIG EBRT3 = OFF ; Table Read Protect 0C000-0FFFF (Disabled)
CONFIG EBRT4 = OFF ; Table Read Protect 10000-13FFF (Disabled)
CONFIG EBRT5 = OFF ; Table Read Protect 14000-17FFF (Disabled)
CONFIG EBRT6 = OFF ; Table Read Protect 18000-1BFFF (Disabled)
CONFIG EBRT7 = OFF ; Table Read Protect 1C000-1FFFF (Disabled)
; CONFIG7H
CONFIG EBRTB = OFF ; Table Read Protect Boot (Disabled)
// </editor-fold>
;;;;;;;;;;;;;;;;;;;;;;;;; MACRO Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MACRO Definitions:
; MOVLF
; Description:
; Move literal value to given register.
; Input:
; lit: literal value
; dest: destination
; access: Access bank or not. Possible values are 'a' for access bank or
; 'b' for banked memory.
MOVLF MACRO lit, dest, access
MOVLW lit ; Move literal into WREG
BANKSEL (dest) ; Select Bank for next file instruction
MOVWF BANKMASK(dest), access ; Move WREG into destination file
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Objects to be defined in Access Bank for Variables.
; Examples:
PSECT udata_acs
CNT1: DS 1 ; Reserve 1 byte for CNT in access bank at 0x000 (literal or file location)
CNT2: DS 1
VAL1: DS 1 ; Reserve 1 byte for VAL1 in access bank at 0x001 (literal or file location)
GLOBAL L1
L1: DS 1
GLOBAL L2
L2: DS 1
GLOBAL L3
L3: DS 1
GLOBAL L1A
L1A: DS 1
GLOBAL L2A
L2A: DS 1
GLOBAL L3A
L3A: DS 1
GLOBAL tmp1
tmp1: DS 1
GLOBAL press
press: DS 1
GLOBAL release
release: DS 1
; Objects to be defined in Bank 1
PSECT udata_bank1
; not used
;;;;;;;;;;;;;;;;;;;;;; Power-On-Reset entry point ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PSECT resetVec, class = CODE, reloc = 2
resetVec:
NOP ; No Operation, give time for reset to occur
goto main ; Go to main after reset
;;;;;;;;;;;;;;;;;;; Interrupt Service Routine Vectors ;;;;;;;;;;;;;;;;;;;;;;;;;;
; High Priority ISR Vector Definition:
PSECT HiPriISR_Vec, class = CODE, reloc = 2
HiPriISR_Vec:
GOTO $ ; Return to current Program Counter (For Now - no code here yet)
; Low Priority ISR Vector Definition:
PSECT LoPriISR_Vec, class = CODE, reloc = 2
LoPriISR_Vec:
GOTO $ ; Return to current Program Counter (For Now - no code here yet)
; Program Section: All Code Starts here
PSECT code
;;;;;;;;;;;;;;;;;;;;;;;;;;;; Mainline Code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
main:
RCALL Initial ; Call to Initial Routine
loop:
BTG LATD, 0x4, A
Call Wait1secloop
BRA loop
;;;;;;;;;;;;;;;;;;;;;; Initialization Routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Initial:
; Initialization
BCF STATUS, 0, A
BCF STATUS, 1, A
BCF STATUS, 2, A
MOVLW 0x19
ADDLW 0xE7
MOVLF 0x0B, TRISD, A ; Set TRISD
MOVLF 0xF3, TRISJ, A ; Set TRISJ
MOVLF 0xFE, TRISA, A ; Set TRISA for timing wait subroutine
MOVLF 0x00, LATA, A
MOVLF 0x00, LATJ, A
MOVLF 0x00, LATD, A ; Turn off all LEDS
RCALL Wait1secInit ; call subroutine to wait 1 second
BSF LATD, 0x5, A ; Turn ON RD5
RCALL Wait1secInit ; call subroutine to wait 1 second
BCF LATD, 0x5, A ; Turn OFF RD5
BSF LATD, 0x6, A ; Turn ON RD6
RCALL Wait1secInit ; call subroutine to wait 1 second
BCF LATD, 0x6, A ; Turn OFF RD6
BSF LATD, 0x7, A ; Turn ON RD7
RCALL Wait1secInit ; call subroutine to wait 1 second
BCF LATD, 0x7, A ; Turn OFF RD7
RETURN ; Return to Mainline code
;;;;;;; Wait2ms subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Subroutine to wait 2 ms
; NOTE - STUDENTS replace XXX with some value of your choosing
; Choose a suitable value to decrement a counter in a loop structure and
; not using an excessive amount of program memory - i.e. don't use 100 nop's
Wait2ms:
BSF LATA, 0x0, A ; Set LED0 on LATA for timing; Add code here
MOVLF 0x28, CNT1, A
MOVLF 0x83, CNT2, A
loop1:
CALL loop2, 1
BCF STATUS, 0x2, A
DECF CNT1, F, A
BNZ loop1
BCF LATA, 0x0, A
RETURN
loop2:
DECF CNT2, F, A
BNZ loop2
RETURN 1
;;;;;;; Wait1secloop subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Subroutine to wait 1 sec for the main loop based on calling
Wait1secloop:
MOVLF 0x0A, L2A, A ; Set length of second loop (2 cycles)
MOVLF 0x32, L3A, A ; Set length of third loop (2 cycles)
loop1s2l:
CALL loop1s3l, 1
DECF L2A, F, A
BNZ loop1s2l
RETURN 1
loop1s3l: ; calls the 2ms subroutine, ends up being approx 100 ms
CALL Check_SW1, 1
CALL Check_RPG, 1
CALL Wait2ms, 1
DECF L3A, F, A
BNZ loop1s3l
RETURN 1
;;;;;;; Wait1secInit subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Subroutine to wait 1 sec based on calling WaitXXXms YYY times or up to 3 nested loops
Wait1secInit:
MOVLF 0x20, L1, A ; Set length of first loop (2 cycles)
MOVLF 0xF8, L2, A ; Set length of second loop (2 cycles)
MOVLF 0xA6, L3, A ; Set length of third loop (2 cycles)
loop1s1:
CALL loop1s2, 1 ; Call second loop (L1*loop2 cycles + L1*5 cycles)
BCF STATUS, 0x2, A
DECF L1, F, A ; Decrement L1 (1 cycle)
BNZ loop1s1 ; branch back to the start of loop until L1=0
RETURN 1
loop1s2:
DECF L2, F, A ;
CALL loop1s3, 1
BNZ loop1s2
NOP ; Set Zero bit to 0 in STATUS register
RETURN 1
loop1s3:
DECF L3, F, A
BNZ loop1s3
RETURN 1
;;;;;;; Check_SW1 subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Subroutine to check the status of RD3 button and change RD2 (ASEN5067 ONLY)
Check_SW1:
BTFSC PORTD, 0x3, A ; Add code here
BRA pressedbr
NOP ; NOP to make both pressed and non pressed cycles the same length
BTFSS press, 0x3, A
RETURN 1
MOVLF 0x05, VAL1, A
debouncelp:
CALL Wait2ms
DECF VAL1, F, A
BNZ debouncelp
BTFSC PORTD, 0x3, A
BRA pressedbr
BTG LATD, 0x2, A
MOVLF 0x00, press, A
RETURN 1
pressedbr:
MOVLF 0x08, press, A
RETURN 1
;;;;;;; Check_RPG subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Subroutine to read the values of the RPG and display on RJ2 and RJ3
Check_RPG:
MOVF PORTD, W, A
RLNCF WREG, W, A
RLNCF WREG, W, A
MOVWF LATJ, A ; Add code here
NOP
RETURN 1
END resetVec ; End program, return to reset vector ;;;;;;; ASEN 4-5067 Lab3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
src/glfw/v3/glfw-monitors.adb | Roldak/OpenGLAda | 79 | 860 | -- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with Interfaces.C.Strings;
with Glfw.API;
package body Glfw.Monitors is
function Monitors return Monitor_List is
use type API.Address_List_Pointers.Pointer;
Count : aliased Interfaces.C.int;
Raw : constant API.Address_List_Pointers.Pointer :=
API.Get_Monitors (Count'Access);
begin
if Raw /= null then
declare
List : constant API.Address_List := API.Address_List_Pointers.Value
(Raw, Interfaces.C.ptrdiff_t (Count));
Ret : Monitor_List (List'Range);
begin
for I in List'Range loop
Ret (I).Handle := List (I);
end loop;
return Ret;
end;
else
raise Operation_Exception;
end if;
end Monitors;
function Primary_Monitor return Monitor is
use type System.Address;
Raw : constant System.Address := API.Get_Primary_Monitor;
begin
if Raw /= System.Null_Address then
return Monitor'(Handle => Raw);
else
raise Operation_Exception;
end if;
end Primary_Monitor;
procedure Get_Position (Object : Monitor; X, Y : out Integer) is
X_Raw, Y_Raw : Interfaces.C.int;
begin
API.Get_Monitor_Pos (Object.Handle, X_Raw, Y_Raw);
X := Integer (X_Raw);
Y := Integer (Y_Raw);
end Get_Position;
procedure Get_Physical_Size (Object : Monitor;
Width, Height : out Integer) is
Width_Raw, Height_Raw : Interfaces.C.int;
begin
API.Get_Monitor_Physical_Size (Object.Handle, Width_Raw, Height_Raw);
Width := Integer (Width_Raw);
Height := Integer (Height_Raw);
end Get_Physical_Size;
function Name (Object : Monitor) return String is
begin
return Interfaces.C.Strings.Value (API.Get_Monitor_Name (Object.Handle));
end Name;
function Video_Modes (Object : Monitor) return Video_Mode_List is
use type API.VMode_List_Pointers.Pointer;
Count : aliased Interfaces.C.int;
Raw : constant API.VMode_List_Pointers.Pointer
:= API.Get_Video_Modes (Object.Handle, Count'Access);
begin
if Raw /= null then
return API.VMode_List_Pointers.Value (Raw,
Interfaces.C.ptrdiff_t (Count));
else
raise Operation_Exception;
end if;
end Video_Modes;
function Current_Video_Mode (Object : Monitor) return Video_Mode is
begin
return API.Get_Video_Mode (Object.Handle).all;
end Current_Video_Mode;
procedure Set_Gamma (Object : Monitor; Gamma : Float) is
begin
API.Set_Gamma (Object.Handle, Interfaces.C.C_float (Gamma));
end Set_Gamma;
function Current_Gamma_Ramp (Object : Monitor) return Gamma_Ramp is
Raw : constant access constant API.Raw_Gamma_Ramp
:= API.Get_Gamma_Ramp (Object.Handle);
procedure UShort_To_Gamma_List (Source : API.Unsigned_Short_List;
Target : in out Gamma_Value_Array) is
begin
for I in Source'Range loop
Target (I) := Source (I);
end loop;
end UShort_To_Gamma_List;
begin
return Ret : Gamma_Ramp (Integer (Raw.Size)) do
UShort_To_Gamma_List (API.Unsigned_Short_List_Pointers.Value
(Raw.Red, Interfaces.C.ptrdiff_t (Raw.Size)),
Ret.Red);
UShort_To_Gamma_List (API.Unsigned_Short_List_Pointers.Value
(Raw.Green, Interfaces.C.ptrdiff_t (Raw.Size)),
Ret.Green);
UShort_To_Gamma_List (API.Unsigned_Short_List_Pointers.Value
(Raw.Blue, Interfaces.C.ptrdiff_t (Raw.Size)),
Ret.Blue);
end return;
end Current_Gamma_Ramp;
procedure Set_Gamma_Ramp (Object : Monitor; Value : Gamma_Ramp) is
Raw : aliased API.Raw_Gamma_Ramp;
begin
Raw.Size := Interfaces.C.unsigned (Value.Size);
Raw.Red := Value.Red (1)'Unrestricted_Access;
Raw.Green := Value.Green (1)'Unrestricted_Access;
Raw.Blue := Value.Blue (1)'Unrestricted_Access;
API.Set_Gamma_Ramp (Object.Handle, Raw'Access);
end Set_Gamma_Ramp;
function Raw_Pointer (Object : Monitor) return System.Address is
begin
return Object.Handle;
end Raw_Pointer;
end Glfw.Monitors;
|
Automaton/Deterministic/FormalLanguage.agda | Lolirofle/stuff-in-agda | 6 | 4876 | <filename>Automaton/Deterministic/FormalLanguage.agda
{-# OPTIONS --sized-types #-}
module Automaton.Deterministic.FormalLanguage where
open import Automaton.Deterministic.Finite
open import Automaton.Deterministic
open import Data.Boolean
import Data.Boolean.Operators
open Data.Boolean.Operators.Programming
open import Data.List renaming (∅ to [])
open import Functional
import Lvl
open import Type
open import Type.Size.Finite
private variable ℓ ℓ₁ ℓ₂ ℓₚ : Lvl.Level
private variable Q Q₁ Q₂ State : Type{ℓ}
private variable Σ Σ₁ Σ₂ Alphabet : Type{ℓ}
module Language where
open import Logic.Propositional
open import Logic.Predicate
open import FormalLanguage
open import FormalLanguage.Equals
open import Relator.Equals
open import Relator.Equals.Proofs
import Type.Dependent as Type
-- The language accepted by a DFA.
-- This is a linguistic interpretation of an automaton, that it is a grammar of the language.
-- A language accepts the empty word when the start state is a final state.
-- The language of a suffix is the transition function applied to the start state.
𝔏 : ∀{s} → DFA{ℓₚ = ℓₚ}(Q)(Σ) → Language(Σ){s}
Language.accepts-ε (𝔏(d)) = DFA.isFinal d (DFA.start d)
Language.suffix-lang (𝔏(d)) c = 𝔏(DFA.transitionedAutomaton d c)
RegularLanguage : ∀{s}{ℓₚ ℓₑ₁} → Language(Σ) → Type
RegularLanguage{Σ = Σ}{s = s}{ℓₚ = ℓₚ}{ℓₑ₁ = ℓₑ₁} L = ∃{Obj = Type.Σ(Type{ℓₑ₁})(Q ↦ DFA{ℓₚ = ℓₚ}(Q)(Σ))}(\(Type.intro _ auto) → (𝔏(auto) ≅[ s ]≅ L))
module Proofs where
open Language
open import Logic.Propositional
open import Relator.Equals
open import Relator.Equals.Proofs
open import FormalLanguage
open FormalLanguage.Oper hiding (∁_)
open import Syntax.Transitivity
-- TODO: Is this wrong?
-- step-isWordAccepted : ∀{Q}{Σ} → (auto : DFA(Q)(Σ)) → ∀{c}{w} → DFA.isWordAccepted(auto)(c ⊰ w) ≡ DFA.isWordAccepted(Dfa (DFA.δ auto) (DFA.δ(auto)(DFA.q₀(auto))(c)) (DFA.F auto))(w)
-- step-isWordAccepted auto {c}{[]} = [≡]-intro
-- step-isWordAccepted auto {c}{w} = congruence₁(DFA.F(auto)) [≡]-intro
Language-isWordAccepted : ∀{Q}{Σ} → (auto : DFA(Q)(Σ)) → ∀{w} → ({!DFA.isWordAccepted auto w!} ≡ (w ∈? 𝔏(auto)))
{-
Language-isWordAccepted : ∀{Q}{Σ} → (auto : DFA(Q)(Σ)) → ∀{w} → (DFA.isWordAccepted(auto)(w) ≡ w ∈? 𝔏(auto))
Language-isWordAccepted auto {[]} = [≡]-intro
Language-isWordAccepted auto {x ⊰ w} =
DFA.isWordAccepted(auto)(x ⊰ w) 🝖[ _≡_ ]-[]
δ̂(q₀)(x ⊰ w) ∈ F 🝖[ _≡_ ]-[]
δ̂(δ(q₀) x) w ∈ F 🝖[ _≡_ ]-[ {!Language-isWordAccepted (transitionedAutomaton auto x) {w}!} ]
DFA.isWordAccepted(transitionedAutomaton auto x) w 🝖[ _≡_ ]-[ Language-isWordAccepted (transitionedAutomaton auto x) {w} ]
w ∈? Language.suffix-lang(𝔏(auto))(x) 🝖[ _≡_ ]-[]
(x ⊰ w) ∈? 𝔏(auto) 🝖-end
where
open DFA(auto)
open LetterNotation
-- [≡]-with {!DFA.F(auto)!} (Language-isWordAccepted {Σ = Σ} auto {w})
-}
-- Language-isWordAccepted (_) {[]} = [≡]-intro
-- Language-isWordAccepted (Dfa δ q₀ F) {c ⊰ w} = test(Dfa δ q₀ F){c ⊰ w} -- Language-isWordAccepted (Dfa δ (δ(q₀)(c)) F) {w}
-- DFA.isWordAccepted(auto)(c ⊰ w)
-- DFA.isWordAccepted(Dfa δ q₀ F)(c ⊰ w)
-- F(δ̂(q₀)(c ⊰ w))
-- F(δ̂(δ(q₀)(c))(w))
-- (c ⊰ w) ∈? (𝔏(auto))
-- (c ⊰ w) ∈? (𝔏(Dfa δ q₀ F))
-- w ∈? (Language.suffix-lang(𝔏(Dfa δ q₀ F))(c))
-- w ∈? (𝔏(Dfa δ (δ(q₀)(c)) F))
{-
module _ (auto : Deterministic(Q)(Σ)) where
δ̂-with-[++] : ∀{q : Q}{w₁ w₂ : Word(Σ)} → Deterministic.δ̂(auto)(q)(w₁ ++ w₂) ≡ DFA.δ̂(auto)(DFA.δ̂(auto)(q)(w₁))(w₂)
δ̂-with-[++] {_}{[]} = [≡]-intro
δ̂-with-[++] {q}{a ⊰ w₁}{w₂} = δ̂-with-[++] {Deterministic.δ(auto)(q)(a)}{w₁}{w₂}
[∁]-δ̂ : ∀{q : Q}{w : Word(Σ)} → DFA.δ̂(∁ auto)(q)(w) ≡ DFA.δ̂(auto)(q)(w)
[∁]-δ̂ {_}{[]} = [≡]-intro
[∁]-δ̂ {q}{a ⊰ w} = [∁]-δ̂ {DFA.δ(∁ auto)(q)(a)}{w}
[∁]-isWordAccepted : ∀{w} → DFA.isWordAccepted(∁ auto)(w) ≡ !(DFA.isWordAccepted(auto)(w))
[∁]-isWordAccepted {w} = [≡]-with(x ↦ !(DFA.F(auto)(x))) ([∁]-δ̂{DFA.q₀(auto)}{w})
-- TODO: Prove ∁ postulates regarding languages before accepting them, because the definition of ∁ for languages might be wrong.
-- [∁]-language : 𝔏(∁ auto) ≡ Oper.∁(𝔏(auto))
-- [∁]-language = proof(auto) where
-- proof : (auto : DFA(Q)(Σ)) → 𝔏(∁ auto) ≡ Oper.∁(𝔏(auto))
-- proof(Dfa δ q₀ F) = [≡]-substitutionₗ {Lvl.𝟎}{Lvl.𝐒(Lvl.𝟎)} [∁]-language {expr ↦ Lang (! F(q₀)) (c ↦ expr(c))} ([≡]-intro {Lvl.𝟎}{Lvl.𝐒(Lvl.𝟎)})
-- [≡]-substitution-fnₗ : ∀{T₁ T₂}{x y : T₁ → T₂} → ((c : T₁) → (x(c) ≡ y(c))) → ∀{f : (T₁ → T₂) → TypeN{ℓ₃}} → f(x) ← f(y)
-- [≡]-substitution-fnₗ [≡]-intro = id?
-- 𝔏(∁(Dfa δ q₀ F))
-- = 𝔏(Dfa δ q₀ ((!_) ∘ F))
-- = Lang ((!_) ∘ F)(q₀)) (c ↦ 𝔏(Dfa δ (δ(q₀)(c)) ((!_) ∘ F)))
-- Oper.∁(𝔏(Dfa δ q₀ F))
-- = Lang (! F(q₀)) (c ↦ ∁(𝔏(Dfa δ (δ(q₀)(c)) F)))
-- = ?
-- testtt : ∀{auto} → Language.accepts-ε(𝔏{Q}{Σ}(∁ auto)) ≡ ! Language.accepts-ε(𝔏(auto))
-- testtt : ∀{auto} → Language.accepts-ε(𝔏{Q}{Σ}(∁ auto)) ≡ Language.accepts-ε(Oper.∁ 𝔏(auto))
-- testtt {_} = [≡]-intro
-- testtt2 : ∀{auto}{c} → Language.suffix-lang(𝔏(∁ auto))(c) ≡ Oper.∁(Language.suffix-lang(𝔏(auto))(c))
-- testtt2 : ∀{auto}{c} → Language.suffix-lang(𝔏(∁ auto))(c) ≡ Language.suffix-lang(Oper.∁(𝔏(auto)))(c)
-- testtt2 : ∀{auto}{c} → Language.suffix-lang(Oper.∁(𝔏{Q}{Σ}(auto)))(c) ≡ Oper.∁(Language.suffix-lang(𝔏(auto))(c))
-- testtt2 {Dfa δ q₀ F}{_} = [≡]-intro
module _ (auto : DFA(Q₁)(Σ)) (auto₂ : DFA(Q₂)(Σ)) where
[⨯]-δ̂ : ∀{q₁ : Q₁}{q₂ : Q₂}{w : Word(Σ)} → DFA.δ̂(auto ⨯ auto₂)(q₁ , q₂)(w) ≡ (DFA.δ̂(auto)(q₁)(w) , DFA.δ̂(auto₂)(q₂)(w))
[⨯]-δ̂ {_}{_}{[]} = [≡]-intro
[⨯]-δ̂ {q₁}{q₂}{a ⊰ w} = [⨯]-δ̂ {DFA.δ(auto)(q₁)(a)}{DFA.δ(auto₂)(q₂)(a)}{w}
[+]-δ̂ : ∀{q₁ : Q₁}{q₂ : Q₂}{w : Word(Σ)} → DFA.δ̂(auto + auto₂)(q₁ , q₂)(w) ≡ (DFA.δ̂(auto)(q₁)(w) , DFA.δ̂(auto₂)(q₂)(w))
[+]-δ̂ {_}{_}{[]} = [≡]-intro
[+]-δ̂ {q₁}{q₂}{a ⊰ w} = [+]-δ̂ {DFA.δ(auto)(q₁)(a)}{DFA.δ(auto₂)(q₂)(a)}{w}
-- TODO: δ̂-on-[𝁼]
[⨯]-isWordAccepted : ∀{w} → DFA.isWordAccepted(auto ⨯ auto₂)(w) ≡ DFA.isWordAccepted(auto)(w) && DFA.isWordAccepted(auto₂)(w)
[⨯]-isWordAccepted {w} = [≡]-with(DFA.F(auto ⨯ auto₂)) ([⨯]-δ̂{DFA.q₀(auto)}{DFA.q₀(auto₂)}{w})
[+]-isWordAccepted : ∀{w} → DFA.isWordAccepted(auto + auto₂)(w) ≡ DFA.isWordAccepted(auto)(w) || DFA.isWordAccepted(auto₂)(w)
[+]-isWordAccepted {w} = [≡]-with(DFA.F(auto + auto₂)) ([+]-δ̂{DFA.q₀(auto)}{DFA.q₀(auto₂)}{w})
-- TODO: Prove postulates
postulate [⨯]-language : 𝔏(auto ⨯ auto₂) ≡ 𝔏(auto) ∩ 𝔏(auto₂)
postulate [+]-language : 𝔏(auto + auto₂) ≡ 𝔏(auto) ∪ 𝔏(auto₂)
-}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.