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
source/tools/IArg/iarg_explicit_memory_ea_app_asm_intel64.asm
ganboing/pintool
1
22090
<reponame>ganboing/pintool ; BEGIN_LEGAL ; Intel Open Source License ; ; Copyright (c) 2002-2016 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 ; the 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 INTEL OR ; ITS 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. ; END_LEGAL PUBLIC DoExplicitMemoryOps .code extern globalVar:qword extern dynVar:qword extern lblPtr:qword extern autoVarPtr:qword DoExplicitMemoryOps PROC push rbp mov rbp, rsp sub rsp, 16 lbl1: lea rax, globalVar lbl2: lea rax, [rsp + 8] ; <-- this will be autoVar mov rbx, [dynVar] lbl3: lea rax, [rbx] mov rax, 0cafebabeH lbl4: lea rax, [rax] lbl5: lea rax, [0deadbeeH] lbl6: mov rax, globalVar lbl7: mov [rsp + 8], rax lea rax, [rsp + 8] mov [autoVarPtr], rax lbl8: lea rax, fs:[-8] mov rax, 0deadbeefH lbl9: lea rax, fs:[rax] mov rbx, [lblPtr] mov rax, offset lbl1 mov [rbx], rax mov rax, offset lbl2 mov [rbx+8], rax mov rax, offset lbl3 mov [rbx+16], rax mov rax, offset lbl4 mov [rbx+24], rax mov rax, offset lbl5 mov [rbx+32], rax mov rax, offset lbl6 mov [rbx+40], rax mov rax, offset lbl7 mov [rbx+48], rax mov rax, offset lbl8 mov [rbx+56], rax mov rax, offset lbl9 mov [rbx+64], rax mov rsp, rbp pop rbp ret DoExplicitMemoryOps ENDP end
library/text parsing/listSubtract.applescript
NYHTC/applescript-fm-helper
1
540
<reponame>NYHTC/applescript-fm-helper -- listSubtract(originalList, subtractionList) -- <NAME>, NYHTC -- Subtracts items in subtractionList from originalList (if an item occurs in originalList multiple times, ALL occurrences removed). (* HISTORY: 1.0 - 2021-02-26 ( dshockley ): first created. TODO: REQUIRES: *) on run listSubtract({"a", "b", "c", "d", "d", "d", "e", "f"}, {"a", "d", "f"}) end run -------------------- -- START OF CODE -------------------- on listSubtract(originalList, subtractionList) -- version 1.0, <NAME> set newList to {} repeat with oneItem in originalList set oneItem to contents of oneItem if subtractionList does not contain oneItem then set end of newList to oneItem end repeat return newList end listSubtract -------------------- -- END OF CODE --------------------
oeis/292/A292616.asm
neoneye/loda-programs
11
101693
; A292616: a(n) = 3*a(n-2) - a(n-4) for n > 3, with a(0)=4, a(1)=3, a(2)=a(3)=6, a sequence related to bisections of Fibonacci numbers. ; Submitted by <NAME> ; 4,3,6,6,14,15,36,39,94,102,246,267,644,699,1686,1830,4414,4791,11556,12543,30254,32838,79206,85971,207364,225075,542886,589254,1421294,1542687,3720996,4038807,9741694,10573734,25504086,27682395,66770564,72473451,174807606,189737958 mov $1,2 mov $4,-1 lpb $0 sub $0,1 add $2,$1 add $3,$4 add $1,$3 add $4,$2 add $2,2 add $3,$4 sub $4,$3 add $3,$4 add $3,$4 lpe mov $0,$1 add $0,2
Library/Resolver/resolverActions.asm
steakknife/pcgeos
504
80629
<filename>Library/Resolver/resolverActions.asm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COPYRIGHT (C) GEOWORKS 1994 -- ALL RIGHTS RESERVED PROJECT: SOCKET PROJECT MODULE: RESOLVER FILE: RESOLVERACTIONS.ASM AUTHOR: <NAME>, DEC 14, 1994 REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 12/14/94 INITIAL REVISION ED 06/13/00 Removed DHCP call DESCRIPTION: INTERNAL OPERATIONS OF RESOLVER SUCH AS CACHED DOMAIN NAME TREE, REQUEST COORDINATION, ETC. $Id: resolverActions.asm,v 1.20 97/10/20 14:49:11 jang Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResolverActionCode segment resource ; ============================================================================ ; ; REQUEST ; ; ============================================================================ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestCreate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CREATE A QUERY REQUEST CALLED BY: ResovlerEventQueryInfo PASS: ES:DI = DOMAIN NAME WE ARE SEARCHING FOR( DNS FORMAT ) [ SHOULD NOT BE IN RESOLVERREQUESTBLOCK SINCE THIS BLOCK WILL MOVE THE BLCOK AND INVALIDATE THIS FPTR] RETURN: DS:SI = REQUEST NODE( ResolverRequestBlock locked ) [ ONLY DOMAIN NAME AND NODE COMMON PART IS INITIALIZED; BUT NOT ADDED TO TREE YET ] DS:*BP = THE SAME AS DS:SI CARRY SET IF MEMORY ERROR, NOTHING CHANGED DESTROYED: ES,DI IF ES WAS SEGMENT OF ResolverRequestBlock SINCE A NEW NODE NEEDS TO BE ALLOCATED IN ResolverRequestBlock REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 6/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestCreate proc near uses ax,bx,cx,es,di .enter ; ; ALLOCATE A REQUEST NODE ; mov bx, handle ResolverRequestBlock call MemLock mov ds, ax clr al if DBCS_PCGEOS ; always SBCS string push di clr al mov cx, -1 repne scasb not cx pop di add cx, size RequestNode ; INCLUDES NULL else call LocalStringLength ; CX = DOMAIN NAME LENGTH add cx, size RequestNode +1 ; INCLUDE NULL endif call LMemAlloc ; AX = NEW CHUNK JC memError ; ; COPY DOMAIN NAME ; sub cx, size RequestNode ; LENGHT OF THE STRING mov_tr bp, ax mov si, ds:[bp] ; DS:SI = REQUESTNODE mov ds:[si].RN_nameLen, cx add si, offset RN_name xchg di, si segxchg es, ds EC < CheckMovsbIntoChunk bp ; *es:bp = chunk handle > rep movsb ; COPY DOMAIN NAME segmov ds, es, ax mov si, ds:[bp] ; DS:SI/*BP = NEW REQUEST NODE ; ; INITIALIZE NODECOMMON PART ; clr ds:[si].NC_flags mov ds:[si].NC_child, bp ; CHILD POINTS TO ITSELF done: .leave ret memError: call MemUnlock jmp done RequestCreate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestExit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: FREES A REQUEST NODE CALLED BY: ResolverEventEndRequest PASS: CX = UNBLOCK to unblock client thread DO_NOT_UNBLOCK not to unblock client thread DS:*BP = node to deallocate [ node must have been removed from its parent ] RETURN: BP = destroyed DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 6/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestExit proc near uses ax,bx,si,di .enter ; ; if this request is initial request, V block sem ; mov si, ds:[bp] test ds:[si].NC_flags, mask NF_INIT_REQUEST jz freeChunk ; ; if cx = UNBLOCK, V blockSem ; cmp cx, UNBLOCK jne freeChunk mov bx, ds:[si].RN_blockSem call ThreadVSem freeChunk: ; ; Stop query timer if any ; tst ds:[si].RN_queryTimer.low jz skipStop movdw axbx, ds:[si].RN_queryTimer call TimerStop skipStop: ; ; Destroy all the children first ; call RequestDestroyChildren mov si, ds:[si].RN_slist tst si jz skip ; slist was never allocated call SlistDestroy skip: mov ax, bp call LMemFree .leave ret RequestExit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestDestroyChildren %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Destroy all the children of a request node CALLED BY: RequestExit PASS: ds:si = parent node RETURN: bp = chunk handle to parent node DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/24/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestDestroyChildren proc near uses ax,di .enter call TreeGotoChild jc done destroyLoop: ; ; Destroy all children ; ds:di = parent node ; ds:si/*bp = first child to destroy ; call RequestDestroyChildren mov ax, bp call TreeGotoNext pushf ; ; Destroy current child ; ds:di/*ax = current child node to remove ; ds:si/*bp = next sibling ; push si mov si, ds:[di].RN_slist tst si jz skip call SlistDestroy ; destroy slist skip: call LMemFree ; destroy RequestNode pop si popf jnc destroyLoop ; destroy the next sibling ; ; should have come back to parent ; done: .leave ret RequestDestroyChildren endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestAllocId %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: allocate an id to use for a request CALLED BY: ResolverGetHostInfo PASS: nothing RETURN: carry clr if success DX = unique request Id carry set if failed we have too many simultaneous queries DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 6/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestAllocId proc far uses ax,bx,si,ds .enter GetDgroup ds, bx cmp ds:validId, 1111111111111111b ; all IDs are in use je doneC mov bx, handle ResolverRequestBlock call MemLock mov ds, ax reassign: inc ds:RBH_curId mov dx, ds:RBH_curId tst dx ; 0 is root jz reassign call IdValidate ; carry set if id is already jc reassign ; in use, so to speak call MemUnlock done: .leave ret doneC: stc jmp done RequestAllocId endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestChangeSname %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CHANGE THE NAME WE ARE SEARCHING FOR CALLED BY: RESOLVEREVENTRESPONSE PASS: ES:DX = CNAME ES:DI = PACKET DS:SI/*BP = REQUESTNODE RETURN: DS:SI ADJUSTED TO POINT TO THE RIGHT OFFSET FOR THE NODE DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 6/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestChangeSname proc near uses ax,bx,cx,dx,di .enter ; ; Skip Question part ; mov di, dx ; ; es:di = CNAME in packet ; Realloc RequestNode ; mov di, dx if DBCS_PCGEOS ; always SBCS string push di clr al mov cx, -1 repne scasb not cx pop di mov ax, bp add cx, size RequestNode ; INCLUDES NULL else call LocalStringLength mov ax, bp add cx, size RequestNode + 1 ; INCLUDE NULL endif call LMemReAlloc ; REQUESTNODE DATA UNCHANGED jc done mov si, ds:[bp] ; RE-DEREFERENCE SI segxchg ds, es xchg si, di ; DS:SI = NAME TO COPY sub cx, size RequestNode mov es:[di].RN_nameLen, cx push di add di, offset RN_name ; ES:DI = NAME FIELD EC < CheckMovsbIntoChunk bp ; *es:bp = chunk handle > rep movsb pop si segxchg ds, es done: .leave ret RequestChangeSname endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RequestRestart %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: RESTART A REQUEST; THIS HAPPENS WHEN A NEW SNAME WAS ASSIGNED OR A FOREIGN NAME SERVER RETURNED DELEGATION TO BETTER NAME SERVERS. CALLED BY: RESOLVEREVENTRESPONSE PASS: ds:si/*bp = RequestNode bx = RequestRestartReason RETURN: NOTHING DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 9/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RequestRestart proc near uses ax,bx,cx,si,es,di .enter ; ; RECONSTRUCT SLIST ; segmov es, ds, ax mov di, si add di, offset RN_name call SlistInitialize ; AX = NEW SLIST; CX = MATCH COUNT jc done ; ; Dereference RequestNode ; push bx mov bx, handle ResolverRequestBlock call MemDerefDS EC < mov si, NULL_SEGMENT > EC < mov es, si > mov si, ds:[bp] pop bx ; ; Check match count ; cmp bx, RRR_SNAME_CHANGED je skipMatchCountCheck cmp bx, RRR_DHCP_EXPIRED je skipMatchCountCheck ; ; Match count must be lower ; - actually this is remaining number of labels to match, so the lower ; the match count, the more labels have been matched already. ; cmp cx, ds:[si].RN_matchCount jge destroyNewSlist skipMatchCountCheck: mov ds:[si].RN_matchCount, cx xchg ax, ds:[si].RN_slist xchg ax, si ; *DS:SI = OLD SLIST TO GET RID OF call SlistDestroy ; destroy old list mov_tr si, ax ; DS:SI = REQUESTNODE ; ; POST QUERY NAME SERVER EVENT FOR CURRENT REQUEST ; cmp bx, RRR_DHCP_EXPIRED je done mov dx, ds:[si].RN_id mov ax, RE_QUERY_NAME_SERVERS ResolverPostEvent_NullESDS done: .leave ret destroyNewSlist: mov_tr si, ax call SlistDestroy jmp done RequestRestart endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConstructAnswer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: FILL IN THE ANSWER CHUNK ARRAY IN REQUESTNODE WITH THE RESOURCE RECORDS FOUND IN THE CACHE CALLED BY: RESOLVEREVENTQUERYINFO PASS: ES:DI = REQUESTNODE DS:SI = FIRST RESOURCERECORD FOUND DX = RESOURCERECORDTYPE RETURN: carry set if error else RESOURCERECORD IN DS:SI UNLOCKED NOTHING( CHUNK ARRAY IN RN_ANSWER IS READY TO BE RETURNED ) DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 9/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConstructAnswer proc near uses ax,bx,cx,dx,si,di,bp,es .enter movdw cxbp, dssi ; BXBP = FIRST RR mov bx, es:[di].RN_answer.high call MemLockExcl mov ds, ax mov si, es:[di].RN_answer.low addLoop: ; ; BX = MEM HANDLE OF ANSWER CHUNK ARRAY ; DS:*SI = ANSWER CHUNK ARRAY ; CX:BP = RESOURCERECORD ; DX = RESOURCERECORDTYPE FOR ANSWER ; call GetResourceRecordSize ; AX = SIZE OF RR sub ax, size ResourceRecordCommon - \ size ResolverAnswerSection call ChunkArrayAppend ; DS:DI = NEW ELT jc errorDone push bx ; SAVE CHUNK ARRAY MEM HANDLE segmov es, ds, ax ; ES:DI = RESOLVERANSWERSECTION mov ds, cx xchg si, bp ; DS:SI = RESOURCERECORD segmov es:[di].RAS_type, ds:[si].RR_common.RRC_type, ax mov cx, ds:[si].RR_common.RRC_dataLen ; ; COPY DATA SECTION ; push si add si, offset RR_data add di, offset RAS_data EC < CheckMovsbIntoChunk bp ; *es:bp = chunk handle > rep movsb pop si ; DS:SI = RESOURCERECORD movdw axsi, ds:[si].RR_next mov bx, ds:LMBH_handle ; UNLOCK LAST RESOURCERECORD call HugeLMemUnlock ; mov bx, ax ; ^LBX:SI = NEXT RR call RecordFindNext ; DS:SI = RESOURCERECORD pop bx ; BX = MEM HANDLE OF ANSWER jc noMore mov cx, ds xchg bp, si ; CX:BP = NEXT RESOURCERECORD segmov ds, es, ax ; *DS:SI= ANSWER CHUNK ARRAY jmp addLoop noMore: ; ; *es:bp = answer chunk array ; bx = answer block ; segmov ds, es, ax mov si, ds:[bp] ; ds:si = answer chunk array mov ds:[si].RAH_error, REC_NO_ERROR unlockBlock: call MemUnlockShared ; call MemUnlock .leave ret errorDone: ; ; DS:*SI = ANSWER CHUNK ARRAY ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; ( RETURN ERROR ) ; mov si, ds:[si] mov ds:[si].RAH_error, REC_INTERNAL_ERROR mov bx, ds:LMBH_handle jmp unlockBlock ConstructAnswer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetResourceRecordSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: RETURN THE SIZE OF A RESOURCERECORD CALLED BY: CONSTRUCTANSWER PASS: CX:BP = FPTR TO RESOURCERECORDCOMMON + DATA RETURN: AX = SIZE OF THE RR DESTROYED: NOTHING REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/10/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetResourceRecordSize proc near uses ds, si .enter movdw dssi, cxbp mov ax, ds:[si].RR_common.RRC_dataLen add ax, size ResourceRecord .leave ret GetResourceRecordSize endp ; ============================================================================ ; ; RESPONSE ; ; ============================================================================ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseCheckError %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CHECK FOR ERRORS IN RESPONSE PACKET CALLED BY: RESOLVEREVENTREPONSE PASS: ^LBX:CX = PACKET ES:DI = PACKET DS:SI/*BP = REQUESTNODE RETURN: CARRY CLEAR IF NO ERROR ax = destroyed CARRY SET IF ERROR AX = RESPONSEERRORCODE 0 MEANS CORRUPTED PACKET DESTROYED: ax REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 9/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseCheckError proc near uses cx,dx,si,di .enter ; ; CHECK HEADER ; mov ax, es:[di].RM_flags test ax, mask RMF_QR jz strange mov cx, ax and cx, mask RMF_OPCODE tst cx jnz strange ; ; test ax, mask RMF_RD ; sometimes we want to handle ; jz strange ; delegation ourselves ; test ax, mask RMF_Z jnz strange ; ; CHECK QUESTION SECTION ; add di, offset RM_data push si ; save RequestNode offset add si, offset RN_name ; name in request node call DomainNameCompare ; CX = LENGTH OF STRINGS pop si TESTP < WARNING_NE RESPONSE_NAME_MISMATCH > jne strange add di, cx ; ; check defined error ; and ax, mask RMF_RCODE mov cl, offset RMF_RCODE shr ax, cl tst ax jnz error ; ; CHECK QTYPE AND QCLASS ; ES:DI = QTYPE ; mov ax, es:[di] cmp ax, ds:[si].RN_stype jne strange checkClass:: add di, size word mov ax, ds:[si].RN_sclass cmp ax, es:[di] jne strange done: .leave ret strange: clr ax stc jmp done error: ; ; Return all kinds of errors ; ; cmp ax, REC_NAME_ERROR ; jne strange ; test es:[di].RM_flags, mask RMF_AA ; jz strange ; stc jmp done ; return error code in ax ResponseCheckError endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseHandleError %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Dispose of a request if necessary( according to error code ) CALLED BY: ResolverEventResponse PASS: ax = ResolverError dx = request ID ds:si = RequestNode RETURN: nothing DESTROYED: ax REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/24/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseHandleError proc near uses bx,bp,es,di .enter cmp ax, RE_NO_ERROR je done ; ; Record error code in answer chunk array if I am the initial request; ; otherwise I just free myself and tell the parent request node. ; test ds:[si].NC_flags, mask NF_INIT_REQUEST jz endRequest mov bx, ds:[si].RN_answer.high push ax ; push error code call MemLockShared mov es, ax mov bp, ds:[si].RN_answer.low mov bp, es:[bp] pop es:[bp].RAH_error call MemUnlockShared endRequest: ; ; Terminate the request ; mov ax, RE_END_REQUEST ResolverPostEvent_NullESDS done: .leave ret ResponseHandleError endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseCheckCname %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check if the response packet contains CNAME CALLED BY: ResolverEventReponse PASS: es:di = packet RETURN: es:dx = CNAME found DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseCheckCname proc near uses ax,bx,cx,di .enter ; ; Get number of answer entries ; mov cx, es:[di].RM_anCount jcxz noCname ; ; Skip header and question part ; mov_tr bx, cx mov cx, MAX_HOST_NAME_SIZE add di, offset RM_data clr al repne scasb ; skip domain name mov_tr cx, bx add di, size word + size word; skip QTYPE and QCLASS findLoop: ; ; Skip name ; mov dx, di mov_tr bx, cx mov cx, MAX_HOST_NAME_SIZE repne scasb mov_tr cx, bx cmp es:[di].RRC_type, RRT_CNAME je found add di, es:[di].RRC_dataLen add di, size ResourceRecordCommon loop findLoop jmp noCname found: mov dx, di add dx, size ResourceRecordCommon clc done: .leave ret noCname: stc jmp done ResponseCheckCname endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseCheckAnswer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check if the packet contains an answer CALLED BY: ResolverEventResponse PASS: es:di = packet RETURN: carry clear if there is an answer carry set if no answer DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseCheckAnswer proc near .enter tst es:[di].RM_anCount jz noAnswer clc done: .leave ret noAnswer: stc jmp done ResponseCheckAnswer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseCheckDelegation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: See if there is delegation CALLED BY: ResolverEventResponse PASS: es:di = packet RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseCheckDelegation proc near .enter tst es:[di].RM_anCount jnz noDelegation tst es:[di].RM_nsCount jz noDelegation clc done: .leave ret noDelegation: stc jmp done ResponseCheckDelegation endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseCacheData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Cache all the resource record contained in packet CALLED BY: ResolverEventResponse PASS: es:di = packet RETURN: nothing DESTROYED: nothing WARNING: ResolverCacheBlock may move and every fptr into ResolverCacheBlcok must be considered 'destroyed.' REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseCacheData proc near uses bx,dx,ds,si,bp .enter mov dx, segment CacheResourceRecordCallback mov si, offset CacheResourceRecordCallback clr bp ; no valid owner name yet call ResponsePacketEnum ; carry set if mem error ; ; ds ; PacketEnum with CacheResourceRecordCallback may move ; ResolverCacheBlock. But no one should have this block locked ; at this point anyway. ; .leave ret ResponseCacheData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ResponseReturnAnswer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the answer to a query in case the query is the initial request; in case the query is a child request, update request tree and resend queries CALLED BY: ResolverEventResponse PASS: ds:si/*bp = RequestNode RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponseReturnAnswer proc near uses cx,dx,si,bp,es,di .enter ; ; Check whether this is the init request or child request ; test ds:[si].NC_flags, mask NF_INIT_REQUEST jz childRequest ; ; Construct answer( answer should have been cached by now ) ; push ds, si segmov es, ds, dx mov di, si add di, offset RN_name mov dx, ds:[si].RN_stype call RecordFind ; ds:si = ResourceRecord pop es, di ; es:di = RequestNode jc done ; this is a bizare case call ConstructAnswer ; ds:si unlocked segmov ds, es ; mov si, di ; ds:si = RequestNode exitRequest: ; ; Exit request ; ds:si = request node ; mov dx, ds:[si].RN_id mov ax, RE_END_REQUEST mov cx, UNBLOCK ResolverPostEvent_NullESDS done: .leave ret childRequest: ; ; Resend queries for parent node ; call TreeGotoParent ; ds:si = parent mov dx, ds:[si].RN_id mov ax, RE_QUERY_NAME_SERVERS ResolverPostEvent_NullESDS mov si, ds:[bp] ; ds:si = node to remove jmp exitRequest ResponseReturnAnswer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RESPONSEPACKETENUM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: LOOP THROUGH ALL THE RESOURCE RECORDS IN A RESPONSE PACKET CALLING THE CALL BACK ROUTINE CALLED BY: UTILITY PASS: ES:DI = PACKET DX:SI = CALLBACK ROUTINE RETURN: AX,BX,CX,BP,DS RETURNED FROM CALLBACK DESTROYED: NOTHING CALLBACK ROUTINE: PASS: ES:DI = CURRENT RESOURCE RECORD IN THE PACKET AX,BX,BP,DS PASSED IN FROM CALLER RETURN: CARRY SET TO ABORT CARRY CLEAR AND AX,BX,BP,DS DESTROYED: CAN DESTROY DI, SI, DX REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 9/95 INITIAL VERSION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ResponsePacketEnum proc near uses cx,dx,si,di .enter ; ; we don't need to do this checking ; ; cmp es:[di].RM_qdCount, 1 ; we only use 1 question in ; jne done ; each packet ; mov cx, es:[di].RM_anCount add cx, es:[di].RM_nsCount add cx, es:[di].RM_arCount jcxz done ; ; skip and question part ; tst es:[di].RM_qdCount pushf add di, offset RM_data ; ; if question part is missing, jump over skipping question part ; popf jz callbackLoop push cx, ax clr al mov cx, MAX_HOST_NAME_SIZE repne scasb pop cx, ax add di, size word + size word ; skip QTYPE and QCLASS callbackLoop: push di, si, dx, cx pushdw dxsi call PROCCALLFIXEDORMOVABLE_PASCAL pop di, si, dx, cx jc done ; ; Go to next resource record ; 1. skip resource record ; push cx, ax mov cx, MAX_HOST_NAME_SIZE clr al repne scasb pop cx, ax dec cx jz done add di, es:[di].RRC_dataLen add di, size ResourceRecordCommon jmp callbackLoop done: .leave ret ResponsePacketEnum endp ; ============================================================================ ; ; SLIST ; ; ============================================================================ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistInitialize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: initialize slist CALLED BY: utility PASS: es:di = target domain name fptr ds:si = current request node RETURN: ax = chunk handle of slist cx = # of unmatched labels( as in TreeSearchDomainName ) carry set if mem error or trouble getting name server addr DESTROYED: es,ds,si,di REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- SJ 1/ 5/95 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistInitialize proc near slist local nptr lastNode local dword accessId local word uses bx,dx,bp .enter ; ; Initialize ; mov dx, ds:[si].RN_accessId ; dx = access id mov bx, size SlistElement clr si, cx call ChunkArrayCreate ; *ds:si = slist LONG jc done ; ; *ds:si = chunk array for slist ; es:di = domain name to query ; dx = access id ; mov slist, si ; slist = chunk array mov accessId, dx ; ; examine cache for name servers( cache block is locked here ) ; call TreeSearchDomainName ; ds:si = best match restart: ; cx= # labels to match movdw lastNode, dssi mov dx, RRT_NS movdw bxsi, ds:[si].RRN_resource call RecordFindNext ; ds:si= ResourceRecord LONG jnc found movdw dssi, lastNode ; ; examine shorter path ; inc cx ; increment # of labels ; to match call TreeGotoParent ; ds:si= parent jnc restart dec cx ; go to parent failed unlockCacheUseSbelt: ; ; unlock cache block ; mov bx, handle ResolverCacheBlock call MemUnlock ; ; read information from sbelt ; mov bx, handle ResolverRequestBlock call MemDerefDS mov si, slist ; *ds:si = slist mov dx, accessId call SlistUseAccessPoint LONG jc done ; must be memory ; see if we have any stored DNS servers from DHCP mov bx, handle dgroup call MemDerefES tstdw es:[dhcpDns1] LONG jz noServersFromDhcp ; First check if the server is already in the list call ChunkArrayGetCount clr ax call ChunkArrayElementToPtr checkNext1: cmpdw ds:[di].SE_address, es:[dhcpDns1], ax je checkServer2 add di, size SlistElement loopne checkNext1 ; *ds:si = ChunkArray, ax = element size ; return: ds:di = block call ChunkArrayAppend jc noServersFromDhcp ; If these errors occur, ChunkArrayAppend didn't zero init the ; memory like it's supposed to. Allen says it zero inits, Dave says ; it doesn't, hence why this EC code is here. -Ed EC < tst ds:[di].SE_flags > EC < ERROR_NZ RFE_GENERAL_FAILURE > EC < tst ds:[di].SE_nameLen > EC < ERROR_NZ RFE_GENERAL_FAILURE > EC < tst ds:[di].SE_serverName > EC < ERROR_NZ RFE_GENERAL_FAILURE > ; clr ax ; mov ds:[di].SE_flags, ax ; mov ds:[di].SE_nameLen, ax ; mov ds:[di].SE_serverName, ax movdw ds:[di].SE_address, es:[dhcpDns1], ax checkServer2: tstdw es:[dhcpDns2] jz noServersFromDhcp ; First check if the server is already in the list call ChunkArrayGetCount clr ax call ChunkArrayElementToPtr checkNext2: cmpdw ds:[di].SE_address, es:[dhcpDns1], ax je noServersFromDhcp add di, size SlistElement loopne checkNext2 call ChunkArrayAppend jc noServersFromDhcp EC < tst ds:[di].SE_flags > EC < ERROR_NZ RFE_GENERAL_FAILURE > EC < tst ds:[di].SE_nameLen > EC < ERROR_NZ RFE_GENERAL_FAILURE > EC < tst ds:[di].SE_serverName > EC < ERROR_NZ RFE_GENERAL_FAILURE > ; mov ds:[di].SE_flags, ax ; mov ds:[di].SE_nameLen, ax ; mov ds:[di].SE_serverName, ax movdw ds:[di].SE_address, es:[dhcpDns2], ax noServersFromDhcp: ; ; check if sbelt contains any DNS address ; *ds:si = sbelt chunk array ; push cx call ChunkArrayGetCount ; cx = # of elt in array jcxz doneFree ; was jcxz useDhcp pop cx if 0 doneClr: endif mov ax, slist clc done: .leave ret unlockError: ; ; unlock cacheBlock ; mov bx, handle ResolverCacheBlock call MemUnlock stc jmp done found: ; ; some NS information found in cache ; ds:si = ResourceRecord ; segmov es, ds, di mov di, si ; es:di= ResourceRecord mov bx, handle ResolverRequestBlock call MemDerefDS mov si, slist ; *ds:si= slist ch arry call SlistAppendElt pushf movdw axsi, es:[di].RR_next mov bx, es:LMBH_handle call HugeLMemUnlock mov_tr bx, ax ; ^lbx:si = RR_next popf jc unlockError ; ; Is there any more NS resource information? ; mov dx, RRT_NS call RecordFindNext LONG jc unlockCacheUseSbelt jmp found ; ds:si = next NS RR if 0 useDhcp: ; ; *ds:si = slist chunk array ; pop cx ; ; Use DHCP to figure out a valid name server ; mov dx, accessId call RunDHCP jc doneFree ; ; Try again ; call SlistUseAccessPoint jc done call ChunkArrayGetCount ; cx = # of elt in array jcxz doneFree mov cx, -1 jmp doneClr endif doneFree: ; ; Free the chunk array handle for slist ; add sp, 2 ; get the old cx off the stack mov ax, slist call LMemFree stc jmp done SlistInitialize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistAppendElt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Append a name server to slist CALLED BY: SlistInitialize PASS: es:di = ResourceRecord to use ( must be RRT_NS type ) *ds:si = slist RETURN: carry set if error DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistAppendElt proc near uses ax,cx,si,di,es,dx .enter mov bx, di ; es:bx = ResourceRecord clr al mov cx, es:[bx].RR_common.RRC_dataLen call LMemAlloc ; ax = handle jc done call ChunkArrayAppend ; ds:di = new SlistElement jc doneFree mov ds:[di].SE_flags, 0 mov ds:[di].SE_address.high, 0 mov ds:[di].SE_address.low, 0 mov ds:[di].SE_nameLen, cx mov ds:[di].SE_serverName, ax segxchg ds, es mov si, bx ; ds:si = ResourceRecord add si, offset RR_data ; ds:si = name to add mov di, ax mov di, es:[di] ; es:di = buffer for name EC < CheckMovsbIntoChunk ax ; *es:dx = chunk > rep movsb segxchg es, ds done: .leave ret doneFree: call LMemFree stc jmp done SlistAppendElt endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistUseAccessPoint %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Instantiate slist using access point library services. CALLED BY: SlistInitialize PASS: dx = accessId ds = ResolverRequestBlock segment( locked ) *ds:si = slist chunk array RETURN: new addresses added to *ds:si slist carry set if mem error REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 10/ 6/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ dnsEntry word \ (APSP_AUTOMATIC or APSP_DNS1), (APSP_AUTOMATIC or APSP_DNS2), APSP_DNS1, APSP_DNS2 SlistUseAccessPoint proc near uses ax,bx,cx,dx,si,di,es,bp .enter ; ; *ds:si = chunk array for slist ; initialize loop variables ; mov_tr ax, dx mov bx, offset dnsEntry mov bp, MAX_ADDR_STRING_PROPERTY_SIZE segmov es, ss, di sub sp, MAX_ADDR_STRING_PROPERTY_SIZE + size dword mov di, sp repeatRead: ; ; ax = access id ; bx = index to dnsEntry table ; bp = MAX_ADDR_STRING_PROPERTY_SIZE ; es:di = buffer allocated on stack ; *ds:si = chunk array allocated for sbelt ; ; ax = access point ID ; bx = index to dnsEntry table ; ; if bx reached the end of dnsEntry table, jump to exit ; cmp bx, offset dnsEntry + size dnsEntry jae exit ; ; read a DNS address from access point DB ; clr cx mov dx, {word}cs:[bx] push bx call AccessPointGetStringProperty ; cx = string length pop bx pushf ; ; advance index to dnsEntry table ; add bx, size word popf jc repeatRead ; ; parse address string and store the address in sbelt - *ds:si ; ax = access point id ; bx = index to dnsEntry table ; bp = MAX_ADDR_STRING_PROPERTY_SIZE ; es:di = address string ; ds:*si = sbelt chunk array ; call SlistAppendDnsEntry jc exit jmp repeatRead exit: ; ; return the stack space we used ; add sp, MAX_ADDR_STRING_PROPERTY_SIZE + size dword error:: .leave ret SlistUseAccessPoint endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistAppendDnsEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Append address of a name server to SBELT CALLED BY: SlistUseAccessPoint PASS: es = stack segment es:di = address string ( ex "123.132.344.5",0 ) es:di+MAX_ADDR_STRING_PROPERTY_SIZE = buffer for dword *ds:si = sbelt chunk array RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jang 9/17/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistAppendDnsEntry proc near uses ax, cx, di, bp .enter ; ; parse address ; push ds, si segmov ds, es, si mov si, di ; ds:si = addr string add di, MAX_ADDR_STRING_PROPERTY_SIZE; es:di = dword buffer mov cx, size dword ; IP addr = dword parseLoop: call ParseAndStoreIPAddress jc errorPop loop parseLoop pop ds, si sub di, size dword ; move the ptr back to ; the start of IP addr mov bp, di ; es:bp = IP addr ; ; es:di = IP addr ; *ds:si = chunk array for SBELT ; call ChunkArrayAppend jc done clr ax mov ds:[di].SE_flags, ax mov ds:[di].SE_nameLen, ax mov ds:[di].SE_serverName, ax segmov ds:[di].SE_address.high, es:[bp].high, ax segmov ds:[di].SE_address.low, es:[bp].low, ax done: .leave ret errorPop: pop ds, si jmp done SlistAppendDnsEntry endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ParseAndStoreIPAddress %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Parses a part of IP address string and stores the result into the location passed in. CALLED BY: SbeltSetupCallback PASS: ds:si = IP address string es:di = location of parsed byte to store RETURN: si,di = adjusted to the next byte carry set if IP address is corrupted DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 2/15/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ParseAndStoreIPAddress proc far uses ax,bx,cx,dx .enter clr bx cmp {TCHAR}ds:[si], '.' ; if first char is '.' -> error je doneC parseLoop: LocalGetChar ax, dssi ; al = char read; si adjusted LocalCmpChar ax, '0' jb checkDot LocalCmpChar ax, '9' ja checkDot ; ; This is a numeric digit ; SBCS < clr ah > sub al, '0' ; al = 0 - 9 xchg ax, bx ; ax = curr result; bx = curr digit mov cx, 10 mul cx add ax, bx mov_tr bx, ax jmp parseLoop finish: mov al, bl stosb ; di adjusted clc done: .leave ret checkDot: LocalCmpChar ax, '.' ; if char is '.' -> finish je finish LocalCmpChar ax, 0 ; if char is 0, -> finish je finish LocalCmpChar ax, ' ' ; if char is " ", -> finish EC < WARNING_E RW_BAD_IP_ADDRESS > je finish doneC: stc jmp done ParseAndStoreIPAddress endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistDestroy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Destroy slist CALLED BY: Utility PASS: ds:*si = slist RETURN: nothing DESTROYED: si REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistDestroy proc near uses ax,bx,di .enter ; ; Free all the name chunks ; mov bx, segment FreeNameChunkCallback mov di, offset FreeNameChunkCallback call ChunkArrayEnum ; ax destroyed ; ; Free chunk array ; mov ax, si call LMemFree .leave ret SlistDestroy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LMemCopyChunk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy a chunk in LMem CALLED BY: Utility PASS: ds:*si = chunk to copy RETURN: carry set if mem error, ax destroyed otherwise ds:*ax = duplicate of ds:*si es:*ax = the same as ds:*ax DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 6/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LMemCopyChunk proc far NEC < uses cx, si, di > EC < uses cx, si, di, bx > .enter ChunkSizeHandle ds, si, cx call LMemAlloc ; ax = new chunk jc done EC < mov bx, ax > mov si, ds:[si] segmov es, ds, di mov di, ax mov di, es:[di] EC < CheckMovsbIntoChunk bx ; ds:*bx = new chunk > rep movsb clc done: .leave ret LMemCopyChunk endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RunDHCP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Run DHCP to figure out a name server for the current host CALLED BY: SlistInitialize PASS: dx = access point id RETURN: carry set on error DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jang 9/18/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 RunDHCP proc far uses ax,bx,cx,dx,si,di,bp,ds,es .enter ; ; Try auto configuration ; 1. query socket name on our local side ; 2. use DHCP to configure name server address for the access point ; 3. try to use access point after that ; push dx ; save accessId(dx) ; ; Get medium and unit for tcpip domain ; GetDgroup ds, di mov di, offset socketAddress call SocketGetAddressMedium ; cxdx = MediumType jc failPop ; bl = MediumUnitType ; bp = MediumUnit ; ; allocate MediumAndUnit on stack ; sub sp, size MediumAndUnitAligned mov bp, sp movdw ss:[bp].MU_medium, cxdx mov ss:[bp].MU_unitType, bl mov ss:[bp].MU_unit, bp mov dx, ss mov ax, bp ; dx:ax = MediumAndUnit mov si, offset socketDomain ; ds:si = domain name GetDgroup es, di mov di, offset ipAddress ; es:di = buffer for address mov cx, IP_ADDR_SIZE call SocketGetMediumAddress lahf add sp, size MediumAndUnitAligned sahf movdw dxax, es:[di] ; dxax = IP address pop bx ; bx = access point id jc done contDhcp:: ; ; local IP address = dxax ; access point ID = bx ; call DHCPConfigure ; carry set on error done: .leave ret failPop: pop bx stc jmp done RunDHCP endp endif ; ============================================================================ ; ; RESOURCE RECORD ; ; ============================================================================ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordConvertTTL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Convert TTL value into day unit CALLED BY: RecordAppend PASS: es:[di].RRC_ttl = TTL value in seconds RETURN: es:[di].RRC_ttl = TTL value in days DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 10/24/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordConvertTTL proc far uses ax,bx,dx .enter ; ; If TTL is larger than 7 days, we just make it 7 days ; (MAX_CACHE_ENTRY_LIFE) ; movdw bxax, es:[di].RRC_ttl cmpdw bxax, MAX_CACHE_ENTRY_LIFE_IN_SEC ja maxLife ; ; Devide by days in sec( we do this by looping ) ; mov dx, 1 ; at least it lives 1 day divLoop: cmpdw bxax, SECONDS_IN_A_DAY jbe exitLoop subdw bxax, SECONDS_IN_A_DAY inc dx jmp divLoop exitLoop: clr bx mov ax, dx jmp store maxLife: clr bx mov ax, MAX_CACHE_ENTRY_LIFE store: movdw es:[di].RRC_ttl, bxax .leave ret RecordConvertTTL endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordFindDuplicate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find a duplicate record in a node CALLED BY: CacheResourceRecordCallback PASS: ds:si = ResourceRecordNode es:di = ResourceRecordCommon + data to add RETURN: if found, carry clear ds:si = ResourceRecord entry found otherwise carry set ds:si = unchanged DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 2/10/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordFindDuplicate proc far rrNodeFptr local fptr uses bx,cx,dx,bp .enter ; ; Set things up for search ; movdw rrNodeFptr, dssi mov dx, es:[di].RRC_type mov bx, ds:[si].RRN_resource.high mov si, ds:[si].RRN_resource.low ; ; search for duplicate ; searchNext: tst bx jz notFound call RecordFindNext jc notFound ; ; compare the data portion ; mov cx, ds:[si].RR_common.RRC_dataLen cmp cx, es:[di].RRC_dataLen jne searchNextSetup push di, si add di, size ResourceRecordCommon add si, offset RR_data repe cmpsb pop di, si je done ; duplicate found : carry clear searchNextSetup: mov bx, ds:[si].RR_next.high mov si, ds:[si].RR_next.low mov cx, ds ;cx = seg of ResourceRecord call MemSegmentToHandle ;^hcx = current ResourceRecord xchg bx, cx ;^hbx = current ResourceRecord call HugeLMemUnlock mov bx, cx ;^hbx = new ResourceRecord jmp searchNext notFound: movdw dssi, rrNodeFptr stc done: .leave ret RecordFindDuplicate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordAppend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Append an RR to RR node CALLED BY: utility PASS: ds:si = ResourceRecordNode to append to es:di = ResourceRecordCommon followed by RDATA RETURN: carry set if memory error carry clear otherwise DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordAppend proc far newRR local dword NEC < uses ax,bx,cx,si,di,es,ds > EC < uses ax,bx,cx,si,di,es,ds,dx > .enter ; ; Verify we don't add a CNAME RR that points to itself, thus ; causing infinite loops for badly misconfigured name servers ; cmp es:[di].RRC_type, RRT_CNAME jne notCNAME push di add di, size ResourceRecordCommon call RecursiveCompareRRNWithString ; carry -> set ; if new RR points to itself pop di cmc LONG jnc done notCNAME: ; ; Allocate an HugeLMem block to store the new RR ; push ds, si push es, di GetDgroup ds, bx mov ax, es:[di].RRC_dataLen add ax, size ResourceRecord mov bx, ds:hugeLMem mov cx, NO_WAIT call HugeLMemAllocLock ; ^lax:cx / ds:di = new chunk LONG jc memError ; ; copy RR data ; movdw newRR, axcx EC < mov dx, cx ; bx = new chunk handle > segmov es, ds, si ; es:di = new RR add di, offset RR_common pop ds, si ; ds:si = RR to store mov cx, ds:[si].RRC_dataLen add cx, size ResourceRecordCommon EC < CheckMovsbIntoChunk dx ; *es:dx= new RR chunk > rep movsb mov di, newRR.offset mov di, es:[di] ; es:di = new RR pop ds, si ; ds:si = RR node to add this rr to ; ; Verify optr ; EC < push ax, bx > EC < movdw axbx, ds:[si].RRN_resource > EC < tst ax > EC < jz skipAssert > EC < Assert optr, axbx > EC < skipAssert: > EC < pop ax, bx > movdw es:[di].RR_next, ds:[si].RRN_resource, ax movdw ds:[si].RRN_resource, newRR, ax ; ; Adjust TTL ; add di, offset RR_common call RecordConvertTTL ; ; Unlock new RR appended ; mov bx, es:LMBH_handle call HugeLMemUnlock ; ; Adjust global variable for cache size ; GetDgroup es, ax mov ax, es:cacheSize inc ax mov es:cacheSize, ax cmp ax, es:cacheSizeAllowed ja reduceCache clc done: .leave ret memError: pop es, di pop ds, si jmp done reduceCache: ; ; cache is over the limit, reduce cache size next time we get ; the chance ; mov ax, RE_REDUCE_CACHE ResolverPostEvent_NullESDS jmp done RecordAppend endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecursiveCompareRRNWithString %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Compare the data in the passed RRN with the hostname portion in passed string. Repeating this process until we reach the top level RRN. CALLED BY: RecordAppend RecursiveCompareRRNWithString PASS: ds:si = ResourceRecordNode es:di = hostname string to compare against prepended by length in bytes RETURN: carry set if complete node name matches string carry clear otherwise DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: 1. compare node with string REVISION HISTORY: Name Date Description ---- ---- ----------- reza 3/19/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecursiveCompareRRNWithString proc near uses si, dx, cx, ax, di .enter ; ; See if the 2 parts match ; mov al, es:[di] ; al = size of host component inc di ; es:di = start of hostname mov dx, si ; dx = saved offset of RRN add si, offset RRN_name mov cl, ds:[si] ; cl = size of node component inc si ; ds:si = start of nodename cmp cl, al ; components must be jne noMatch ; equal size clr ch ; cx = string length push di, cx repe cmpsb pop di, cx jne noMatch mov si, dx ; ds:si = RRN ; ; Get our the node level ; mov ax, ds:[si].RRN_tree.NC_flags andnf ax, mask NF_LEVEL ; ax = level ; ; See if we've come to the end of the hostname ; add di, cx ; es:di = rest of hostname ; after 1st component cmp {byte} es:[di], 0 jz checkTopLevel ; end of hostname? ; ; Get the parent node ; cmp ax, 1 ; if we're at the top je noMatch ; level we can't match anymore call TreeGotoParent ; carry -> set if this ; is root ; ds:si = parent node EC < ERROR_C RFE_TREE_BUG > NEC < jc noMatch > call RecursiveCompareRRNWithString jmp done ; ; Check if the node is the top level ; checkTopLevel: cmp ax, 1 jne noMatch stc jmp done noMatch: clc done: .leave ret RecursiveCompareRRNWithString endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordFind %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find a specific type of RR in our cache CALLED BY: Utility PASS: es:di = domain name dx = ResourceRecordType RETURN: carry set if not found ds:si = destroyed carry clear if found, ds:si = ResourceRecord structure (HugeLMemLock'ed) DESTROYED: ds, si REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordFindFar proc far call RecordFind ret RecordFindFar endp RecordFind proc near uses ax,bx,cx .enter call TreeSearchDomainName ; ds:si = best match jcxz nodeFound mov bx, ds:LMBH_handle call MemUnlock notFound:: stc done: .leave ret nodeFound: ; ; ds:si = ResourceRecordNode ; movdw axsi, ds:[si].RRN_resource mov bx, ds:LMBH_handle call MemUnlock mov_tr bx, ax call RecordFindNext ; ds:si = ResourceRecord if success jmp done RecordFind endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordFindNext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the next ResourceRecord structure CALLED BY: Utility PASS: ^lbx:si = next resource record to search( bx = 0 if no RR ) dx = ResourceRecordType RETURN: carry clear if found, ds:si = ResourceRecord found (HugeLMem Locked) carry set if not ds:si = destroyed DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordFindNext proc near uses ax,bx,cx .enter tst bx jz notFound restart: call HugeLMemLock mov ds, ax mov si, ds:[si] cmp dx, ds:[si].RR_common.RRC_type je found ; ; If the record is a cname, redirect our search to canonical name ; cmp ds:[si].RR_common.RRC_type, RRT_CNAME je redirect movdw cxsi, ds:[si].RR_next call HugeLMemUnlock jcxz notFound mov_tr bx, cx jmp restart found: clc done: .leave ret notFound: stc jmp done redirect: ; ; ds:si = ResourceRecord containing a CNAME ; find the ResourceRecordNode indicated by CNAME data and start search ; there. ; push es, di segmov es, ds, di mov di, si add di, offset RR_data ; es:di = canonical domain name call TreeSearchDomainName ; ds:si = best match mov bx, es:LMBH_handle pop es, di ; ; Now unlock CNAME RR block ; call HugeLMemUnlock ; ; If alias node was not found, record cannot be found ; tst cx stc jnz notFoundUnlock ; ; ds:si = canonical ResourceRecordNode ; movdw bxsi, ds:[si].RRN_resource call RecordFindNext notFoundUnlock: mov bx, handle ResolverCacheBlock call MemUnlock jmp done RecordFindNext endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordCloseOrSaveAll %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a chain of resource records after saving them into a file if file handle is given CALLED BY: CacheRRCloseCB PASS: ^lbx:dx = resource record optr ( bx = 0 if none ) ax = file handle RETURN: carry set on file error( out of diskspace ) DESTROYED: ax, bx, cx, dx REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 10/18/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordCloseOrSaveAll proc near uses ds, di, bp, es .enter mov_tr bp, ax GetDgroup es, ax ; ; if bx = 0, nothing to deallocate ; tst bx ; CF = 0 jz done repeat: ; ; ^lbx:dx = chain to deallocate ; bp = file handle ; call HugeLMemLock mov ds, ax mov di, dx mov di, ds:[di] movdw axcx, ds:[di].RR_next ; ; Save ResourceRecord if file is open ; ds:di = ResourceRecord ; ax:cx = optr to next record ; bp = file handle ( 0 if nothing to save ) ; tst bp ; carry clear jz skipSave save:: ; ; Save current node ; call RecordSaveToFile; carry set if file write error skipSave: call HugeLMemUnlock jc done ; exit with file error( disk full ) xchgdw axcx, bxdx ; exchange cur and next ; ; Free HugeLMem chunk if file handle = 0 ; not ax:cx = record to be deleted ; tst bp jnz skipDelete call HugeLMemFree dec es:cacheSize skipDelete: ; ; Continue if bx is non zero ; tst bx ; CF = 0 jnz repeat done: .leave ret RecordCloseOrSaveAll endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordSaveToFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Save a resource record entry to a file CALLED BY: RecordCloseOrSaveAll PASS: ds:di = ResourceRecord to save bp = file handle( 0 if nothing to save ) RETURN: carry set if out of disk space DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 10/18/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordSaveToFile proc near uses ax,bx,cx,dx .enter tst bp jz done ; ; Find out how many bytes we need to write ; clr al ; we want error to be returned mov bx, bp mov cx, ds:[di].RR_common.RRC_dataLen add cx, size ResourceRecord mov dx, di call FileWrite EC < jc error > done: .leave ret EC < error: > EC < cmp ax, ERROR_SHORT_READ_WRITE > EC < WARNING_NE RW_FILE_WRITE_ERROR > EC < stc > EC < jmp done > RecordSaveToFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordSaveNodeToFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Save the current node to a file CALLED BY: CacheRRCloseCB PASS: ax = file handle ds:si = node to save RETURN: carry set if out of disk space DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 10/23/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordSaveNodeToFile proc near uses ax,bx,cx,dx .enter EC < tst ax > EC < ERROR_Z RFE_SAVE_ERROR > ; ; Write the node into the file ; mov bx, ax clr al mov cx, size ResourceRecordNode + 1 clr dh mov dl, {byte}ds:[si].RRN_name add cx, dx mov dx, si call FileWrite EC < jc error > done:: .leave ret EC < error: > EC < cmp ax, ERROR_SHORT_READ_WRITE > EC < WARNING_NE RW_FILE_WRITE_ERROR > EC < stc > EC < jmp done > RecordSaveNodeToFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RecordDeleteOld %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete all the records older than TTL limit updating delete- Count. If deleteCount reaches 0, stop. CALLED BY: CacheRRUpdateCB PASS: ax = TTL limit( number of days to live ) bxdx = optr to the first resource record in RR chain es:deleteCount = number of RR to delete es:cacheSize = total number of cache entries RETURN: bxdx = optr to new first resource record of RR chain bxdx = 0 if list is now empty es:deleteCount adjusted es:cacheSize adjusted carry set if deleteCount reached 0 DESTROYED: nothing PSEUDO CODE/STRATEGY: head = first; previous = 0; current = first; (*) if (current == 0) { quit } next = current.next; if (current.value > cx) { delete current; cacheSize--; deleteSize--; if (deleteSize == 0) { quit } } else { previous = current; } current = next; jmp (*) quit: return head REVISION HISTORY: Name Date Description ---- ---- ----------- kho 10/24/95 Initial version kho 5/24/96 Mostly rewritten %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RecordDeleteOld proc near uses ax, cx head local optr previous local optr current local optr nextNode local optr currentValue local word .enter mov_tr cx, ax ; cx <- value ; ; head = first; ; previous = 0; ; current = first; ; movdw head, bxdx movdw current, bxdx clr ax movdw previous, axax start: ; ; if (current == 0) { quit } ; movdw bxdx, current tst bx ; CF = 0 jz quit ; ; nextNode = current.next; ; currentValue = current.value; ; call FindNodeValueAndNext ; nextNode/currentValue ; filled in ; ; if (current.value > cx) { ; ... ; } cmp currentValue, cx jb freeNode ; ; else { ; previous = current; ; } ; movdw previous, current, ax goNext: ; ; current = nextNode; ; movdw current, nextNode, ax ; ; jmp loop ; jmp start freeNode: ; ; /* bxdx is current */ ; delete current ; call DeleteCurrentNode ; head, previous.next ; updated if needed ; ; cacheSize--; deleteSize--; ; Assert dgroup, es dec es:[cacheSize] dec es:[deleteCount] ; ; if (deleteCount == 0) { quit } ; stc jnz goNext quit: ; ; return head ; movdw bxdx, head .leave ret RecordDeleteOld endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FindNodeValueAndNext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the value and next fields of "current", and fill in the local variable CALLED BY: RecordDeleteOld PASS: bx:dx = current node optr RETURN: nothing DESTROYED: nothing SIDE EFFECTS: locals filled PSEUDO CODE/STRATEGY: lock block, fill in locals, unlock block REVISION HISTORY: Name Date Description ---- ---- ----------- kho 5/24/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FindNodeValueAndNext proc near uses ax, ds, si .enter inherit RecordDeleteOld Assert optr, bxdx ; ; Lock block ; call LockLMemBlockAndDeref ; ds:si - ptr ; ; Fill in locals ; movdw nextNode, ds:[si].RR_next, ax mov ax, ds:[si].RR_common.RRC_ttl.low mov currentValue, ax ; ; Check that nextNode is valid ; EC < tst nextNode.handle > EC < jz skipAssert > Assert optr, nextNode EC < skipAssert: > ; ; Unlock block ; call HugeLMemUnlock .leave ret FindNodeValueAndNext endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeleteCurrentNode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete current node, and adjust "head" or the previous linkage if necessary. CALLED BY: RecordDeleteOld PASS: bx:dx = current RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: if (head == current) { head = nextNode; } if (previous != 0) { previous.next = nextNode; } free current REVISION HISTORY: Name Date Description ---- ---- ----------- kho 5/24/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeleteCurrentNode proc near uses ax, cx, ds, si .enter inherit RecordDeleteOld Assert optr, bxdx ; ; if (head == current) { ; head = nextNode ; } ; cmpdw head, bxdx jne continue movdw head, nextNode, ax continue: ; ; if (previous != 0) { ; previous.next = nextNode; ; } ; tstdw previous jz freeNode ; ; Lock down previous node ; push bx, dx movdw bxdx, previous call LockLMemBlockAndDeref ; ds:si - ptr ; ; Assert previous.next == current ; EC < push ax, cx > EC < movdw axcx, current > EC < Assert e, ds:[si].RR_next.handle, ax > EC < Assert e, ds:[si].RR_next.chunk, cx > EC < pop ax, cx > ; ; previous.next = nextNode; ; movdw ds:[si].RR_next, nextNode, ax call HugeLMemUnlock pop bx, dx freeNode: movdw axcx, bxdx call HugeLMemFree ; cx <- size .leave ret DeleteCurrentNode endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LockLMemBlockAndDeref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Lock lmem block and deref PASS: bx:dx = optr RETURN: ds:si = ptr DESTROYED: nothing SIDE EFFECTS: Block is locked, and must be unlocked later %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LockLMemBlockAndDeref proc near uses ax .enter Assert optr, bxdx call HugeLMemLock mov_tr ds, ax mov si, dx mov si, ds:[si] .leave ret LockLMemBlockAndDeref endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FindBestAddress %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the best address for a RR node CALLED BY: Utility PASS: ds:si = first address RR( RR node unlocked ) RETURN: axdx = IP address DESTROYED: ds, si REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/11/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FindBestAddress proc far uses bx .enter mov dx, {word}ds:[si].RR_data mov ax, {word}ds:[si+2].RR_data mov bx, ds:LMBH_handle call HugeLMemUnlock .leave ret FindBestAddress endp ResolverActionCode ends ResolverResidentCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FreeNameChunkCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Free domain name of a name server in SlistElement CALLED BY: ChunkArrayEnum in SlistDestroy PASS: ds:di = current element RETURN: nothing DESTROYED: ax REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 6/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FreeNameChunkCallback proc far mov ax, ds:[di].SE_serverName tst ax jz done call LMemFree done: clc ret FreeNameChunkCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CacheResourceRecordCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Cache the resource record passed in CALLED BY: ResponsePacketEnum PASS: es:di = a resource record in response packet es:bp = ptr to last valid owner name RETURN: carry set if memory error es:bp = ptr to last valid owner name DESTROYED: ds,si REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CacheResourceRecordCallback proc far uses ax,bx .enter ; ; Find or allocate ResourceRecordNode to add this record to ; ; If the owner name at es:di is null, try using the last valid ; owner name. If there is no last valid owner name, don't cache ; this record. ; mov ax, di ; save di tst {byte}es:[di] ; owner name non-null? jnz addName ; Branch if so mov di, bp ; Try last valid owner name tst di ; There is one, right? jz done ; Branch if not addName: call TreeAddDomainName ; ds:si = last visited node jc done mov bp, di ; es:bp = valid owner name mov di, ax ; restore original di ; ; es:di = resource record in a packet ; skip ResourceRecord name ; mov_tr bx, cx mov cx, MAX_HOST_NAME_SIZE clr al repne scasb mov_tr cx, bx ; es:di = ResourceRecordCommon ; ; followed by RDATA ; ds:si = ResourceRecordNode ; es:di = ResourceRecordCommon + data to add ; call RecordFindDuplicate ; ds:si = ResourceRecord found jnc updateTTL ; ; ds:si = ResourceRecordNode ; EC < push ax, bx > EC < movdw axbx, ds:[si].RRN_resource > EC < tst ax > EC < jz skipAssert > EC < Assert optr, axbx > EC < skipAssert: > EC < pop ax, bx > call RecordAppend ; buffer allocated in hugelmem unlockExit: ; ; Unlock ResourceRecordNode ; mov bx, handle ResolverCacheBlock call MemUnlock done: .leave ret updateTTL: ; ; Update TTL of the existing record ; es:di = ResourceRecordCommon + data to add ; ds:si = resource record found ; call RecordConvertTTL ; convert TTL in the packet movdw bxax, es:[di].RRC_ttl movdw ds:[si].RR_common.RRC_ttl, bxax mov bx, ds:LMBH_handle call HugeLMemUnlock jmp unlockExit CacheResourceRecordCallback endp ResolverResidentCode ends ; ************************************************************************** ; ; CODE THAT WAS REMOVED ; ; ************************************************************************** if 0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistSetupSbelt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Construct sbelt CALLED BY: ResolverInit PASS: nothing RETURN: carry set if SBELT format in .ini file is bad DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistSetupSbelt proc far uses ax,bx,cx,dx,si,di,bp .enter ; ; Do a enum on list of strings in .init file ; mov bx, handle ResolverRequestBlock call MemLock mov ds, ax mov bx, size SlistElement clr si, cx call ChunkArrayCreate ; *ds:si = chunk array mov ds:RBH_sbelt, si mov cx, ds mov si, offset resSbeltKwd mov dx, ds:[si] ; cx:dx = keyword mov si, offset resCategory mov si, ds:[si] ; ds:si = category mov bp, mask IFRF_FIRST_ONLY mov di, segment SbeltSetupCallback mov ax, offset SbeltSetupCallback call InitFileEnumStringSection jc unlockDone unlockDone: mov bx, handle ResolverRequestBlock call MemUnlock .leave ret SlistSetupSbelt endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SlistUseSbelt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy Sbelt and return CALLED BY: SlistInitialize PASS: nothing RETURN: carry set if mem error, ax = destroyed otherwise ax = chunk handle to a duplicate of sbelt cx = -1 (match count) DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SlistUseSbelt proc near uses bx,ds,si,bp .enter mov bx, handle ResolverRequestBlock call MemLock mov ds, ax mov si, ds:RBH_sbelt ; ds:*si = sbelt call LMemCopyChunk ; ds:*ax = copy of sbelt jc done ; ; Now copy all the name chunks ; clr cx ; index starts at 0 mov si, ax ; ds:*si = new slist mov bx, segment ReplaceNameChunkWithCopyCallback mov di, offset ReplaceNameChunkWithCopyCallback call ChunkArrayEnum ; ax,bx,cx,bp = destroyed EC < WARNING_C RW_MEMORY_ERROR > jc done ; mem error mov_tr ax, si mov cx, -1 done: mov bx, handle ResolverRequestBlock call MemUnlock .leave ret SlistUseSbelt endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReplaceNameChunkWithCopyCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Duplicate the name chunk in SlistElement CALLED BY: ChunkArrayEnum via SlistUseSbelt PASS: ds:di = slist element cx = element index RETURN: nothing DESTROYED: ax, si REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 1/ 6/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ReplaceNameChunkWithCopyCallback proc far mov bx, ds push si mov si, ds:[di].SE_serverName call LMemCopyChunk ; ax = new copy pop si jc done ; error case mov bp, ds cmp bp, bx je noChange ; block did not move ; ; dereference SlistElement again since the block moved ; *ds:si = slist chunk array ; push ax, cx mov ax, cx call ChunkArrayElementToPtr ; ds:di = SlistElement pop ax, cx noChange: mov ds:[di].SE_serverName, ax inc cx done: ret ReplaceNameChunkWithCopyCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SbeltSetupCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Build sbelt by reading strings from .ini file CALLED BY: SlistSetupSbelt ( via InitFileEnumStringSection ) PASS: ds:si = string section RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 2/15/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SbeltSetupCallback proc far uses bx, ds .enter ; ; Allocate a dummy domain name string: ".",0 ; mov bx, handle ResolverRequestBlock mov dx, ds ; save string seg in dx mov bp, si ; dx:bp = string fptr call MemDerefDS mov cx, 2 call LMemAlloc ; ax = new chunk jc done ; memory error mov di, ax mov di, ds:[di] mov {byte}ds:[di], '.' mov {byte}ds:[di+1], 0 ; ".",0 mov si, ds:RBH_sbelt call ChunkArrayAppend ; ds:di = new element jc done ; memory error segmov es, ds, bx mov es:[di].SE_flags, 0 mov es:[di].SE_serverName, ax mov es:[di].SE_nameLen, 1 ; this doesn't matter add di, offset SE_address ; ; Now loop around the string section parsing address ; mov cx, 4 ; IP address has 4 parts movdw dssi, dxbp parseLoop: ; ; ds:si = next digit to parse ; es:di = byte location to store the parsed result ; call ParseAndStoreIPAddress ; si, di adjusted jc done loop parseLoop done: .leave ret SbeltSetupCallback endp endif
test/dsc.asm
kspalaiologos/asmbf
67
18995
psh 0 psh 1 psh 2 psh 3 psh 4 psh 5 pop r1 dsc dsc pop r2 dsc pop r3 add r1, .0 add r2, .0 add r3, .0 out r1 out r2 out r3
alloy4fun_models/trashltl/models/4/y7gGcThTeEGc7zRdr.als
Kaixi26/org.alloytools.alloy
0
1699
open main pred idy7gGcThTeEGc7zRdr_prop5 { some f: File | f not in Trash until f in Trash } pred __repair { idy7gGcThTeEGc7zRdr_prop5 } check __repair { idy7gGcThTeEGc7zRdr_prop5 <=> prop5o }
src/tom/library/sl/ada/abstractstrategycombinatorpackage.ads
rewriting/tom
36
12368
<filename>src/tom/library/sl/ada/abstractstrategycombinatorpackage.ads with ObjectPack, AbstractStrategyPackage, StrategyPackage, VisitablePackage; use ObjectPack, AbstractStrategyPackage, StrategyPackage, VisitablePackage; package AbstractStrategyCombinatorPackage is type AbstractStrategyCombinator is abstract new AbstractStrategy and Object with record arguments : ObjectPtrArrayPtr := null; --contains only StrategyPtr end record; ---------------------------------------------------------------------------- -- Visitable implementation ---------------------------------------------------------------------------- function setChildren(v: access AbstractStrategyCombinator ; children : ObjectPtrArrayPtr) return VisitablePtr; function getChildren(v: access AbstractStrategyCombinator) return ObjectPtrArrayPtr; function getChildAt(v: access AbstractStrategyCombinator; i : Integer) return VisitablePtr; function setChildAt(v: access AbstractStrategyCombinator; i: in Integer; child: in VisitablePtr) return VisitablePtr; function getChildCount(v: access AbstractStrategyCombinator) return Integer; ---------------------------------------------------------------------------- procedure initSubterm(sc : in out AbstractStrategyCombinator); procedure initSubterm(sc : in out AbstractStrategyCombinator; str : StrategyPtr); procedure initSubterm(sc : in out AbstractStrategyCombinator; str1,str2 : StrategyPtr); procedure initSubterm(sc : in out AbstractStrategyCombinator; str1,str2,str3 : StrategyPtr); procedure initSubterm(sc : in out AbstractStrategyCombinator; str : ObjectPtrArray); function getVisitors(sc: AbstractStrategyCombinator) return ObjectPtrArray; ---------------------------------------------------------------------------- end AbstractStrategyCombinatorPackage;
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/ツール/tool/sfxdos/sccdrv.asm
prismotizm/gigaleak
0
99221
Name: sccdrv.asm Type: file Size: 22054 Last-Modified: '2016-05-13T04:52:55Z' SHA-1: D911D2CA8090B2ADA1B46459AE28111BB5C073EC Description: null
Cubical/Papers/ZCohomology.agda
dan-iel-lee/cubical
0
8662
{- Please do not move this file. Changes should only be made if necessary. This file contains pointers to the code examples and main results from the paper: Synthetic Cohomology Theory in Cubical Agda -} -- The "--safe" flag ensures that there are no postulates or -- unfinished goals {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Papers.ZCohomology where -- Misc. open import Cubical.Data.Int hiding (_+_) open import Cubical.Data.Nat open import Cubical.Foundations.Everything open import Cubical.HITs.S1 open import Cubical.Data.Sum open import Cubical.Data.Sigma -- II import Cubical.Foundations.Prelude as Prelude import Cubical.Foundations.GroupoidLaws as GroupoidLaws import Cubical.Foundations.Path as Path open import Cubical.HITs.S1 as S1 open import Cubical.HITs.Susp as Suspension open import Cubical.HITs.Sn as Sn open import Cubical.Homotopy.Loopspace as Loop open import Cubical.Foundations.HLevels as n-types open import Cubical.HITs.Truncation as Trunc open import Cubical.Homotopy.Connected as Connected import Cubical.HITs.Pushout as Push import Cubical.HITs.Wedge as ⋁ import Cubical.Foundations.Univalence as Unival import Cubical.Foundations.SIP as StructIdPrinc import Cubical.Algebra.Group as Gr -- III import Cubical.ZCohomology.Base as coHom renaming (coHomK to K) import Cubical.HITs.Sn.Properties as S import Cubical.ZCohomology.GroupStructure as GroupStructure import Cubical.ZCohomology.Properties as Properties renaming (Kn→ΩKn+1 to σ ; ΩKn+1→Kn to σ⁻¹) import Cubical.Experiments.ZCohomologyOld.Properties as oldCohom -- IV import Cubical.Homotopy.EilenbergSteenrod as ES-axioms import Cubical.ZCohomology.EilenbergSteenrodZ as satisfies-ES-axioms renaming (coHomFunctor to H^~ ; coHomFunctor' to Ĥ) import Cubical.ZCohomology.MayerVietorisUnreduced as MayerVietoris -- V import Cubical.ZCohomology.Groups.Sn as HⁿSⁿ renaming (Hⁿ-Sᵐ≅0 to Hⁿ-Sᵐ≅1) import Cubical.ZCohomology.Groups.Torus as HⁿT² import Cubical.ZCohomology.Groups.Wedge as Hⁿ-wedge import Cubical.ZCohomology.Groups.KleinBottle as Hⁿ𝕂² import Cubical.ZCohomology.Groups.RP2 as HⁿℝP² renaming (H¹-RP²≅0 to H¹-RP²≅1) ----- II. HOMOTOPY TYPE THEORY IN CUBICAL AGDA ----- -- II.A Important notions in Cubical Agda open Prelude using ( PathP ; _≡_ ; refl ; cong ; funExt) open GroupoidLaws using (_⁻¹) open Prelude using ( transport ; subst ; hcomp) --- II.B Important concepts from HoTT/UF in Cubical Agda -- The circle, 𝕊¹ open S1 using (S¹) -- Suspensions open Suspension using (Susp) -- n-spheres, 𝕊ⁿ open Sn using (S₊) -- Loop spaces open Loop using (Ω^_) -- Eckmann-Hilton argument open Loop using (Eckmann-Hilton) -- n-types Note that we start indexing from 0 in the Cubical Library -- (so (-2)-types as referred to as 0-types, (-1) as 1-types, and so -- on) open n-types using (isOfHLevel) -- truncations open Trunc using (hLevelTrunc) -- elimination principle open Trunc using (elim) -- elimination principle for paths truncPathElim : ∀ {ℓ ℓ'} {A : Type ℓ} {x y : A} (n : ℕ) → {B : Path (hLevelTrunc (suc n) A) ∣ x ∣ ∣ y ∣ → Type ℓ'} → ((q : _) → isOfHLevel n (B q)) → ((p : x ≡ y) → B (cong ∣_∣ p)) → (q : _) → B q truncPathElim zero hlev ind q = hlev q .fst truncPathElim (suc n) {B = B} hlev ind q = subst B (Iso.leftInv (Trunc.PathIdTruncIso _) q) (help (ΩTrunc.encode-fun ∣ _ ∣ ∣ _ ∣ q)) where help : (q : _) → B (ΩTrunc.decode-fun ∣ _ ∣ ∣ _ ∣ q) help = Trunc.elim (λ _ → hlev _) ind -- Connectedness open Connected using (isConnected) -- Pushouts open Push using (Pushout) -- Wedge sum open ⋁ using (_⋁_) -- III.C Univalence -- Univalence and the ua function respectively open Unival using (univalence ; ua) -- The structure identity principle and the sip function -- respectively open StructIdPrinc using (SIP ; sip) -- Groups open Gr using (Group) ----- III. ℤ-COHOMOLOGY IN CUBICAL AGDA ----- -- III.A Eilenberg-MacLane spaces -- Eilenberg-MacLane spaces Kₙ open coHom using (K) -- Proposition 1 open S using (sphereConnected) -- Lemma 1 open S using (wedgeConSn) -- restated to match the formulation in the paper wedgeConSn' : ∀ {ℓ} (n m : ℕ) {A : (S₊ (suc n)) → (S₊ (suc m)) → Type ℓ} → ((x : S₊ (suc n)) (y : S₊ (suc m)) → isOfHLevel ((suc n) + (suc m)) (A x y)) → (fₗ : (x : _) → A x (ptSn (suc m))) → (fᵣ : (x : _) → A (ptSn (suc n)) x) → (p : fₗ (ptSn (suc n)) ≡ fᵣ (ptSn (suc m))) → Σ[ F ∈ ((x : S₊ (suc n)) (y : S₊ (suc m)) → A x y) ] (Σ[ (left , right) ∈ ((x : S₊ (suc n)) → fₗ x ≡ F x (ptSn (suc m))) × ((x : S₊ (suc m)) → fᵣ x ≡ F (ptSn (suc n)) x) ] p ≡ left (ptSn (suc n)) ∙ (right (ptSn (suc m))) ⁻¹) wedgeConSn' zero zero hlev fₗ fᵣ p = (wedgeConSn 0 0 hlev fᵣ fₗ p .fst) , ((λ x → sym (wedgeConSn 0 0 hlev fᵣ fₗ p .snd .snd x)) , λ _ → refl) -- right holds by refl , rUnit _ wedgeConSn' zero (suc m) hlev fₗ fᵣ p = (wedgeConSn 0 (suc m) hlev fᵣ fₗ p .fst) , ((λ _ → refl) -- left holds by refl , (λ x → sym (wedgeConSn 0 (suc m) hlev fᵣ fₗ p .snd .fst x))) , lUnit _ wedgeConSn' (suc n) m hlev fₗ fᵣ p = (wedgeConSn (suc n) m hlev fᵣ fₗ p .fst) , ((λ x → sym (wedgeConSn (suc n) m hlev fᵣ fₗ p .snd .snd x)) , λ _ → refl) -- right holds by refl , rUnit _ -- +ₖ (addition), -ₖ and 0ₖ open GroupStructure using (_+ₖ_ ; -ₖ_ ; 0ₖ) -- Group laws for +ₖ open GroupStructure using ( rUnitₖ ; lUnitₖ ; rCancelₖ ; lCancelₖ ; commₖ ; assocₖ) -- All group laws are equal to refl at 0ₖ -- rUnitₖ (definitional) 0-rUnit≡refl : rUnitₖ 0 (0ₖ 0) ≡ refl 1-rUnit≡refl : rUnitₖ 1 (0ₖ 1) ≡ refl 0-rUnit≡refl = refl 1-rUnit≡refl = refl n≥2-rUnit≡refl : {n : ℕ} → rUnitₖ (2 + n) (0ₖ (2 + n)) ≡ refl n≥2-rUnit≡refl = refl -- rUnitₖ (definitional) 0-lUnit≡refl : lUnitₖ 0 (0ₖ 0) ≡ refl 1-lUnit≡refl : lUnitₖ 1 (0ₖ 1) ≡ refl n≥2-lUnit≡refl : {n : ℕ} → lUnitₖ (2 + n) (0ₖ (2 + n)) ≡ refl 0-lUnit≡refl = refl 1-lUnit≡refl = refl n≥2-lUnit≡refl = refl -- assocₖ (definitional) 0-assoc≡refl : assocₖ 0 (0ₖ 0) (0ₖ 0) (0ₖ 0) ≡ refl 1-assoc≡refl : assocₖ 1 (0ₖ 1) (0ₖ 1) (0ₖ 1) ≡ refl n≥2-assoc≡refl : {n : ℕ} → assocₖ (2 + n) (0ₖ (2 + n)) (0ₖ (2 + n)) (0ₖ (2 + n)) ≡ refl 0-assoc≡refl = refl 1-assoc≡refl = refl n≥2-assoc≡refl = refl -- commₖ (≡ refl ∙ refl for n ≥ 2) 0-comm≡refl : commₖ 0 (0ₖ 0) (0ₖ 0) ≡ refl 1-comm≡refl : commₖ 1 (0ₖ 1) (0ₖ 1) ≡ refl n≥2-comm≡refl : {n : ℕ} → commₖ (2 + n) (0ₖ (2 + n)) (0ₖ (2 + n)) ≡ refl 0-comm≡refl = refl 1-comm≡refl = refl n≥2-comm≡refl = sym (rUnit refl) -- lCancelₖ (≡ refl ∙ transport refl refl for n = 1 -- and transport refl refl ∙ transport refl refl for n ≥ 2) 0-lCancel≡refl : lCancelₖ 0 (0ₖ 0) ≡ refl 1-lCancel≡refl : lCancelₖ 1 (0ₖ 1) ≡ refl n≥2-lCancel≡refl : {n : ℕ} → lCancelₖ (2 + n) (0ₖ (2 + n)) ≡ refl 0-lCancel≡refl = refl 1-lCancel≡refl = sym (lUnit _) ∙ transportRefl refl n≥2-lCancel≡refl = rCancel _ -- rCancelₖ (≡ transport refl refl for n ≥ 1) 0-rCancel≡refl : rCancelₖ 0 (0ₖ 0) ≡ refl 1-rCancel≡refl : rCancelₖ 1 (0ₖ 1) ≡ refl n≥2-rCancel≡refl : {n : ℕ} → rCancelₖ (2 + n) (0ₖ (2 + n)) ≡ refl 0-rCancel≡refl = refl 1-rCancel≡refl = transportRefl refl n≥2-rCancel≡refl = transportRefl refl -- Proof that there is a unique h-structure on Kₙ -- +ₖ defines an h-Structure on Kₙ open GroupStructure using (_+ₖ_ ; 0ₖ ; rUnitₖ ; lUnitₖ ; lUnitₖ≡rUnitₖ) -- and so does Brunerie's addition open oldCohom using (_+ₖ_ ; 0ₖ ; rUnitₖ ; lUnitₖ ; rUnitlUnit0) -- consequently both additions agree open GroupStructure using (+ₖ-unique) open oldCohom using (addLemma) additionsAgree : (n : ℕ) → GroupStructure._+ₖ_ {n = n} ≡ oldCohom._+ₖ_ {n = n} additionsAgree zero i x y = oldCohom.addLemma x y (~ i) additionsAgree (suc n) i x y = +ₖ-unique n (GroupStructure._+ₖ_) (oldCohom._+ₖ_) (GroupStructure.rUnitₖ (suc n)) (GroupStructure.lUnitₖ (suc n)) (oldCohom.rUnitₖ (suc n)) (oldCohom.lUnitₖ (suc n)) (sym (lUnitₖ≡rUnitₖ (suc n))) (rUnitlUnit0 (suc n)) x y i -- The function σ : Kₙ → ΩKₙ₊₁ open Properties using (σ) -- Theorem 1 (Kₙ ≃ ΩKₙ₊₁) open Properties using (Kn≃ΩKn+1) -- σ and σ⁻¹ are morphisms -- (for σ⁻¹ this is proved directly without using the fact that σ is a morphism) open Properties using (Kn→ΩKn+1-hom ; ΩKn+1→Kn-hom) -- Lemma 2 (p ∙ q ≡ cong²₊(p,q)) for n = 1 and n ≥ 2 respectively open GroupStructure using (∙≡+₁ ; ∙≡+₂) -- Lemma 3 (cong²₊ is commutative) and Theorem 2 respectively open GroupStructure using (cong+ₖ-comm ; isCommΩK) -- III.B Group structure on Hⁿ(A) -- +ₕ (addition), -ₕ and 0ₕ open GroupStructure using (_+ₕ_ ; -ₕ_ ; 0ₕ) -- Cohomology group structure open GroupStructure using ( rUnitₕ ; lUnitₕ ; rCancelₕ ; lCancelₕ ; commₕ ; assocₕ) -- Reduced cohomology, group structure open GroupStructure using (coHomRedGroupDir) -- Equality of unreduced and reduced cohmology open Properties using (coHomGroup≡coHomRedGroup) ----- IV. THE EILENBERG-STEENROD AXIOMS ----- -- IV.A The axioms in HoTT/UF -- The axioms are defined as a record type open ES-axioms.coHomTheory -- Proof of the claim that the alternative reduced cohomology functor -- Ĥ is the same as the usual reduced cohomology functor _ : ∀ {ℓ} → satisfies-ES-axioms.H^~ {ℓ} ≡ satisfies-ES-axioms.Ĥ _ = satisfies-ES-axioms.coHomFunctor≡coHomFunctor' -- IV.B Verifying the axioms -- Propositions 2 and 3. _ : ∀ {ℓ} → ES-axioms.coHomTheory {ℓ} satisfies-ES-axioms.H^~ _ = satisfies-ES-axioms.isCohomTheoryZ -- III.C Characterizing Z-cohomology groups using the axioms -- Theorem 3 open MayerVietoris.MV using ( Ker-i⊂Im-d ; Im-d⊂Ker-i ; Ker-Δ⊂Im-i ; Im-i⊂Ker-Δ ; Ker-d⊂Im-Δ ; Im-Δ⊂Ker-d) ----- V. CHARACTERIZING COHOMOLOGY GROUPS DIRECTLY ----- -- V.A -- Proposition 4 and 5 respectively open HⁿSⁿ using (Hⁿ-Sⁿ≅ℤ ; Hⁿ-Sᵐ≅1) -- V.B -- Proposition 6 and 7 respectively open HⁿT² using (H¹-T²≅ℤ×ℤ ; H²-T²≅ℤ) -- V.C -- Proposition 8 and 9 respectively (Hⁿ(𝕂²)) -- ℤ/2ℤ is represented by Bool with the unique group structure open Hⁿ𝕂² using (H¹-𝕂²≅ℤ ; H²-𝕂²≅Bool) -- First and second cohomology groups of ℝP² respectively open HⁿℝP² using (H¹-RP²≅1 ; H²-RP²≅Bool) ----- VI. COMPUTING WITH THE COHOMOLOGY GROUPS ----- import Cubical.Experiments.ZCohomology.Benchmarks
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_343.asm
ljhsiun2/medusa
9
18404
<filename>Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_343.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xff7, %r15 nop inc %rdx movl $0x61626364, (%r15) nop xor %r10, %r10 lea addresses_D_ht+0xb9da, %rbp inc %rdi movups (%rbp), %xmm0 vpextrq $0, %xmm0, %rax inc %rdi lea addresses_WT_ht+0x14d60, %r10 clflush (%r10) nop inc %rdi movl $0x61626364, (%r10) nop nop nop nop add $17006, %rbp lea addresses_D_ht+0x1bac2, %r10 nop and $38271, %r14 movb (%r10), %al nop nop inc %rbp lea addresses_UC_ht+0x12842, %rbp inc %rdi movw $0x6162, (%rbp) nop nop nop nop nop inc %r10 lea addresses_WC_ht+0x1d42, %rdx nop nop nop add %rax, %rax vmovups (%rdx), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %r10 nop nop nop inc %r10 lea addresses_UC_ht+0x15482, %rdi nop nop add $3967, %rdx mov (%rdi), %bp add %rdx, %rdx lea addresses_D_ht+0xc842, %rsi lea addresses_WT_ht+0x1c776, %rdi nop xor $21306, %rdx mov $30, %rcx rep movsb nop nop nop nop and %r14, %r14 lea addresses_UC_ht+0x9042, %r15 nop nop dec %rcx movw $0x6162, (%r15) nop nop nop nop inc %r15 lea addresses_UC_ht+0x1e82, %rsi lea addresses_WT_ht+0xa2b8, %rdi nop nop nop nop nop xor $5655, %r10 mov $36, %rcx rep movsw nop add %rdi, %rdi lea addresses_UC_ht+0x12d42, %rbp nop cmp %rax, %rax mov (%rbp), %rdi nop cmp $36939, %rbp lea addresses_WT_ht+0x59d9, %rdx nop nop nop nop cmp %r15, %r15 mov $0x6162636465666768, %rbp movq %rbp, %xmm6 vmovups %ymm6, (%rdx) nop nop nop nop and %rcx, %rcx lea addresses_UC_ht+0x1bc42, %rsi nop add $12958, %r15 movb $0x61, (%rsi) nop nop cmp %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rbp push %rcx // Faulty Load lea addresses_UC+0x13042, %rbp nop nop sub %r10, %r10 mov (%rbp), %cx lea oracles, %r10 and $0xff, %rcx shlq $12, %rcx mov (%r10,%rcx,1), %rcx pop %rcx pop %rbp pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 6}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'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 */
Application/AssemblyCode/working_and_tmp_asm_files/testInitLevelandLetters.asm
t0ddpar0dy/Handmade_Pacman
0
173861
<reponame>t0ddpar0dy/Handmade_Pacman LUI 55 r0 # Make the address for where init function starts ORI 182 r0 JAL r1 initlevel LUI 61 r0 ORI 255 r0 SUBI 53 r0 SUBI 53 r0 SUBI 31 r0 MOVI 0 r3 MOVI 0 r1 loopa: CMPI 37 r1 BEQ 14 #endloopa MOVI 0 r2 loopb: CMPI 17 r2 BEQ 9 #endloopb MOV r1 r4 MULI 53 r4 ADD r2 r4 MULI -1 r4 ADD r0 r4 STOR r3 r4 ADDI 1 r3 ADDI 1 r2 endloopb: ADDI 1 r1 BUC -11 endloopa: BUC 0 initlevel: MOV r0 r3 # r3 current address of where we are reading from memory LUI 63 r1 # make address for writting location in frame buffer ORI 255 r1 SUBI 53 r1 # Offset by one row SUBI 1 r1 # Offset by one column MOVI 0 r6 loopi: CMPI 31 r6 BEQ 16 #this should support labels, jump endloopi MOVI 0 r7 loopj: CMPI 28 r7 BEQ 11 #jump to endloopj MOV r6 r4 MULI 53 r4 ADD r7 r4 MULI -1 r4 ADD r1 r4 LOAD r5 r3 STOR r5 r4 SUBI 1 r3 ADDI 1 r7 BUC -11 endloopj: ADDI 1 r6 BUC -16 endloopi: RETX ra
rom_writer/MicroCode3.asm
clpl/proteus-CPU
5
176788
ORG 0000H DB 00011110B ORG 0001H DB 00000010B ORG 0002H DB 00000011B ORG 0003H DB 00000000B ORG 0004H DB 00000101B ORG 0005H DB 00000110B ORG 0006H DB 00000000B ORG 0008H DB 00001001B ORG 0009H DB 00000000B ORG 000aH DB 00001011B ORG 000bH DB 00001100B ORG 000cH DB 00001101B ORG 000dH DB 00000000B ORG 000eH DB 00000000B ORG 000fH DB 00000000B ORG 0010H DB 00010001B ORG 0011H DB 00010010B ORG 0012H DB 00010011B ORG 0013H DB 00010100B ORG 0014H DB 00000000B ORG 0015H DB 00010110B ORG 0016H DB 00010111B ORG 0017H DB 00011000B ORG 0018H DB 00011001B ORG 0019H DB 00000000B ORG 001aH DB 00000000B ORG 001eH DB 01011111B ORG 001fH DB 00100000B ORG 0020H DB 00100001B ORG 0021H DB 00000000B ORG 0022H DB 10001110B ORG 0030H DB 00110001B ORG 0031H DB 00110010B ORG 0032H DB 00000000B ORG 0034H DB 00110101B ORG 0035H DB 00110110B ORG 0036H DB 00000000B ORG 0038H DB 00111001B ORG 0039H DB 00111010B ORG 003aH DB 00000000B ORG 003cH DB 00111101B ORG 003dH DB 00111110B ORG 003eH DB 00000000B END
src/util/util-concurrent-counters.adb
jquorning/ada-wiki
18
13151
<filename>src/util/util-concurrent-counters.adb<gh_stars>10-100 ----------------------------------------------------------------------- -- Util.Concurrent -- Concurrent Counters -- Copyright (C) 2009, 2010, 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Concurrent.Counters is function Sync_Sub_And_Fetch (Ptr : access Interfaces.Unsigned_32; Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; pragma Import (Intrinsic, Sync_Sub_And_Fetch, External_Name => "__sync_sub_and_fetch_4"); function Sync_Fetch_And_Add (Ptr : access Interfaces.Unsigned_32; Value : in Interfaces.Unsigned_32) return Interfaces.Unsigned_32; pragma Import (Intrinsic, Sync_Fetch_And_Add, External_Name => "__sync_fetch_and_add_4"); procedure Sync_Add (Ptr : access Interfaces.Unsigned_32; Value : in Interfaces.Unsigned_32); pragma Import (Intrinsic, Sync_Add, External_Name => "__sync_add_and_fetch_4"); procedure Sync_Sub (Ptr : access Interfaces.Unsigned_32; Value : in Interfaces.Unsigned_32); pragma Import (Intrinsic, Sync_Sub, External_Name => "__sync_sub_and_fetch_4"); -- ------------------------------ -- Increment the counter atomically. -- ------------------------------ procedure Increment (C : in out Counter) is begin Sync_Add (C.Value'Unrestricted_Access, 1); end Increment; -- ------------------------------ -- Increment the counter atomically and return the value before increment. -- ------------------------------ procedure Increment (C : in out Counter; Value : out Integer) is begin Value := Integer (Sync_Fetch_And_Add (C.Value'Unrestricted_Access, 1)); end Increment; -- ------------------------------ -- Decrement the counter atomically. -- ------------------------------ procedure Decrement (C : in out Counter) is use type Interfaces.Unsigned_32; begin Sync_Sub (C.Value'Unrestricted_Access, 1); end Decrement; -- ------------------------------ -- Decrement the counter atomically and return a status. -- ------------------------------ procedure Decrement (C : in out Counter; Is_Zero : out Boolean) is use type Interfaces.Unsigned_32; Value : Interfaces.Unsigned_32; begin Value := Sync_Sub_And_Fetch (C.Value'Unrestricted_Access, 1); Is_Zero := Value = 0; end Decrement; -- ------------------------------ -- Get the counter value -- ------------------------------ function Value (C : in Counter) return Integer is begin return Integer (C.Value); end Value; end Util.Concurrent.Counters;
programs/oeis/092/A092942.asm
jmorken/loda
1
166631
; A092942: A Fibonacci sequence with "corrections" at every third step: -++-++-++-++-++..., i.e., at every 3rd step there is a subtraction instead of an addition. ; 0,1,1,2,3,1,4,5,1,6,7,1,8,9,1,10,11,1,12,13,1,14,15,1,16,17,1,18,19,1,20,21,1,22,23,1,24,25,1,26,27,1,28,29,1,30,31,1,32,33,1,34,35,1,36,37,1,38,39,1,40,41,1,42,43,1,44,45,1,46,47,1,48,49,1,50,51,1,52,53,1,54,55,1,56,57,1,58,59,1,60,61,1,62,63,1,64,65,1,66,67,1,68,69,1,70,71,1,72,73,1,74,75,1,76,77,1,78,79,1,80,81,1,82,83,1,84,85,1,86,87,1,88,89,1,90,91,1,92,93,1,94,95,1,96,97,1,98,99,1,100,101,1,102,103,1,104,105,1,106,107,1,108,109,1,110,111,1,112,113,1,114,115,1,116,117,1,118,119,1,120,121,1,122,123,1,124,125,1,126,127,1,128,129,1,130,131,1,132,133,1,134,135,1,136,137,1,138,139,1,140,141,1,142,143,1,144,145,1,146,147,1,148,149,1,150,151,1,152,153,1,154,155,1,156,157,1,158,159,1,160,161,1,162,163,1,164,165,1,166 mul $0,2 lpb $0 mov $1,$0 mul $0,2 mod $0,3 lpe add $1,$0 div $1,3
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_loadTiles_callee.asm
jpoikela/z88dk
640
166985
<filename>libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_loadTiles_callee.asm ; void SMS_loadTiles(void *src, unsigned int tilefrom, unsigned int size) SECTION code_clib SECTION code_SMSlib PUBLIC _SMS_loadTiles_callee EXTERN asm_SMSlib_loadTiles _SMS_loadTiles_callee: pop af pop de pop hl pop bc push af jp asm_SMSlib_loadTiles
oeis/335/A335608.asm
neoneye/loda-programs
11
7899
<filename>oeis/335/A335608.asm<gh_stars>10-100 ; A335608: Number of sets (in the Hausdorff metric geometry) at each location between two sets defined by a complete bipartite graph K(3,n) (with n at least 2) missing one edge. ; 8,104,896,6800,49208,349304,2459696,17261600,120962408,847130504,5931094496,41521204400,290659059608,2034645303704,14242612785296,99698576475200,697890896260808,4885238856628904,34196679744812096,239376781458914000,1675637539948086008 add $0,1 mov $1,3 pow $1,$0 mov $2,7 pow $2,$0 add $1,$2 div $1,8 mul $1,5 add $1,1 mov $3,$2 sub $3,$1 mov $0,$3 mul $0,8
src/base/beans/util-beans-objects-vectors.adb
RREE/ada-util
60
5889
<filename>src/base/beans/util-beans-objects-vectors.adb ----------------------------------------------------------------------- -- util-beans-vectors -- Object vectors -- Copyright (C) 2011, 2017, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Beans.Objects.Vectors is -- ------------------------------ -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. -- ------------------------------ function Get_Value (From : in Vector_Bean; Name : in String) return Object is begin if Name = "count" then return To_Object (Natural (From.Length)); else return Null_Object; end if; end Get_Value; -- ------------------------------ -- Get the number of elements in the list. -- ------------------------------ overriding function Get_Count (From : in Vector_Bean) return Natural is begin return Natural (From.Length); end Get_Count; -- ------------------------------ -- Get the element at the given position. -- ------------------------------ overriding function Get_Row (From : in Vector_Bean; Position : in Natural) return Util.Beans.Objects.Object is begin return From.Element (Position); end Get_Row; -- ----------------------- -- Create an object that contains a <tt>Vector_Bean</tt> instance. -- ----------------------- function Create return Object is M : constant Vector_Bean_Access := new Vector_Bean; begin return To_Object (Value => M, Storage => DYNAMIC); end Create; end Util.Beans.Objects.Vectors;
programs/oeis/023/A023535.asm
neoneye/loda
22
4387
<filename>programs/oeis/023/A023535.asm ; A023535: Convolution of natural numbers with A023531. ; 0,1,2,3,5,7,9,11,14,17,20,23,26,30,34,38,42,46,50,55,60,65,70,75,80,85,91,97,103,109,115,121,127,133,140,147,154,161,168,175,182,189,196,204,212,220,228,236,244,252,260,268,276,285,294,303,312 mov $2,2 lpb $0 add $1,$0 add $2,1 trn $0,$2 lpe mov $0,$1
programs/oeis/170/A170063.asm
neoneye/loda
22
81773
; A170063: Number of reduced words of length n in Coxeter group on 6 generators S_i with relations (S_i)^2 = (S_i S_j)^37 = I. ; 1,6,30,150,750,3750,18750,93750,468750,2343750,11718750,58593750,292968750,1464843750,7324218750,36621093750,183105468750,915527343750,4577636718750,22888183593750,114440917968750,572204589843750 mov $1,5 pow $1,$0 mul $1,6 div $1,5 mov $0,$1
test/Succeed/absurddo.agda
cruhland/agda
1,989
11199
<filename>test/Succeed/absurddo.agda data ⊥ : Set where postulate M : Set → Set A : Set _>>=_ : ∀ {A B} → M A → (A → M B) → M B ma : M A f : A → M ⊥ pure : ∀ {A} → A → M A absurd-do : ∀ {A} → M A absurd-do = do x ← ma () ← f x atabsurd-do : ∀ {A} → M A atabsurd-do = do x ← ma (y@()) ← f x -- I don't know why you would do that but we can support it
oeis/330/A330045.asm
neoneye/loda-programs
11
25294
<gh_stars>10-100 ; A330045: Expansion of e.g.f. exp(x) / (1 - x^4). ; Submitted by <NAME> ; 1,1,1,1,25,121,361,841,42001,365905,1819441,6660721,498971881,6278929801,43710250585,218205219961,21795091762081,358652470233121,3210080802962401,20298322381652065,2534333270094778681,51516840824285500441,563561785768079119561 mov $2,$0 add $0,1 lpb $0 sub $0,1 mov $3,$2 sub $3,$0 mul $1,$3 mov $5,$0 mov $7,3 mov $8,3 lpb $7 mov $6,$5 mod $6,2 add $4,$6 div $5,2 div $8,2 mov $7,$8 lpe cmp $4,0 add $1,$4 lpe mov $0,$1
Library/Mailbox/Inbox/inboxManager.asm
steakknife/pcgeos
504
242427
<reponame>steakknife/pcgeos COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1994 -- All Rights Reserved PROJECT: Clavin MODULE: Inbox-Specific Functions FILE: inboxManager.asm AUTHOR: <NAME>, May 9, 1994 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 5/9/94 Initial revision DESCRIPTION: $Id: inboxManager.asm,v 1.1 97/04/05 01:20:50 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include mailboxGeode.def include Internal/geodeStr.def include thread.def include file.def include fileEnum.def include Objects/vTextC.def include system.def include initfile.def include timer.def include inboxConstant.def include inboxVariable.def include inboxApplicationList.asm include inboxAppToken.asm include inboxControlPanel.asm include inboxDetails.asm include inboxInit.asm include inboxMessageList.asm include inboxRegister.asm include inboxFetch.asm include inboxTransWin.asm include inboxUtils.asm
programs/oeis/213/A213840.asm
jmorken/loda
1
1046
<reponame>jmorken/loda ; A213840: a(n) = n*(1 + n)*(3 - 4*n + 4*n^2)/6. ; 1,11,54,170,415,861,1596,2724,4365,6655,9746,13806,19019,25585,33720,43656,55641,69939,86830,106610,129591,156101,186484,221100,260325,304551,354186,409654,471395,539865,615536,698896,790449,890715,1000230,1119546,1249231 mov $13,$0 mov $15,$0 add $15,1 lpb $15 clr $0,13 mov $0,$13 sub $15,1 sub $0,$15 mov $12,$0 add $12,1 lpb $12 mov $0,$10 sub $12,1 sub $0,$12 pow $0,2 mov $1,8 mul $1,$0 add $1,1 add $11,$1 lpe add $14,$11 lpe mov $1,$14
oeis/233/A233908.asm
neoneye/loda-programs
11
169731
; A233908: 10*binomial(7*n+10,n)/(7*n+10). ; Submitted by <NAME> ; 1,10,115,1450,19425,271502,3915100,57821940,870238200,13298907050,205811513765,3218995093860,50802419972395,808016193159000,12938696992921000,208419656266988904,3374960506795660365,54907659530154222000,897060906625956765000,14711500799506081410000,242094196621251134660577,3996418709883785895359650,66160792312072124214857400,1098175329140737316090661000,18272337926026468776802771500,304711174303730765259980626062,5091943292706181636293853533795,85254286651015110258315141905680 mov $2,$0 add $2,1 mul $2,5 add $2,2 add $2,$0 add $2,2 add $0,$2 bin $0,$2 mul $0,120 mov $1,$2 add $1,1 div $0,$1 div $0,12
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca.log_21829_1231.asm
ljhsiun2/medusa
9
81446
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x3697, %rcx nop sub $37889, %rbp movl $0x61626364, (%rcx) nop dec %rdx lea addresses_D_ht+0x7157, %r12 nop nop nop mfence mov $0x6162636465666768, %rcx movq %rcx, %xmm4 movups %xmm4, (%r12) nop nop nop nop add %rax, %rax lea addresses_A_ht+0x4fa7, %r12 nop nop nop nop and $15209, %rdi mov $0x6162636465666768, %rax movq %rax, %xmm0 vmovups %ymm0, (%r12) sub %r9, %r9 lea addresses_WT_ht+0x1cf87, %r9 nop nop nop nop cmp %rdx, %rdx movb $0x61, (%r9) nop nop nop xor $36052, %rdx lea addresses_normal_ht+0x7f7, %rsi lea addresses_WC_ht+0x1c093, %rdi nop nop nop nop inc %r12 mov $50, %rcx rep movsl nop nop nop inc %r9 lea addresses_A_ht+0x60a7, %rsi lea addresses_WT_ht+0x2157, %rdi nop xor $13637, %r9 mov $1, %rcx rep movsl nop nop nop nop and %r9, %r9 lea addresses_WC_ht+0x11217, %rcx nop nop nop sub %rbp, %rbp movb (%rcx), %r9b dec %rax lea addresses_D_ht+0xbdbb, %rdx nop nop nop sub %rdi, %rdi movups (%rdx), %xmm6 vpextrq $1, %xmm6, %rcx nop xor %r12, %r12 lea addresses_UC_ht+0x9893, %rax and $64210, %rdx mov $0x6162636465666768, %rcx movq %rcx, (%rax) nop nop dec %rcx lea addresses_D_ht+0x1cd57, %rcx nop cmp $20193, %rsi mov (%rcx), %r12w nop nop nop and %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r9 push %rax push %rbx push %rdx // Store lea addresses_PSE+0xb157, %r15 nop dec %rdx mov $0x5152535455565758, %r9 movq %r9, %xmm3 vmovntdq %ymm3, (%r15) nop cmp %rbx, %rbx // Store lea addresses_PSE+0xb157, %r9 nop nop nop add %r12, %r12 mov $0x5152535455565758, %r13 movq %r13, (%r9) nop nop nop nop inc %r13 // Load lea addresses_PSE+0x50d7, %r13 nop nop nop nop sub $58247, %rax mov (%r13), %bx nop nop nop nop nop dec %r9 // Store lea addresses_PSE+0x919f, %rax nop nop nop nop inc %r13 movl $0x51525354, (%rax) nop nop nop sub $35780, %r15 // Faulty Load lea addresses_PSE+0xb157, %r15 nop nop nop nop nop cmp %r13, %r13 mov (%r15), %rdx lea oracles, %rbx and $0xff, %rdx shlq $12, %rdx mov (%rbx,%rdx,1), %rdx pop %rdx pop %rbx pop %rax pop %r9 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': True, 'type': 'addresses_PSE'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_PSE'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 5, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}, '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 */
programs/oeis/302/A302254.asm
jmorken/loda
1
11343
; A302254: Exponent of the group of the Gaussian integers in a reduced system modulo (1+i)^n. ; 1,1,2,4,4,4,4,4,8,8,16,16,32,32,64,64,128,128,256,256,512,512,1024,1024,2048,2048,4096,4096,8192,8192,16384,16384,32768,32768,65536,65536,131072,131072,262144,262144,524288,524288,1048576,1048576,2097152,2097152,4194304,4194304,8388608,8388608 trn $0,1 mov $1,1 mov $2,5 trn $2,$0 mov $3,3 lpb $0 mul $1,2 trn $3,$2 sub $0,$3 trn $0,1 mov $3,1 lpe
src/main/antlr4/io/fixprotocol/md/antlr/MarkdownParser.g4
FIXTradingCommunity/md-grammar
0
522
/* Grammar for a subset of markdown */ parser grammar MarkdownParser; options { tokenVocab=MarkdownLexer; } @header { /* * Copyright 2021 FIX Protocol Ltd * * 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. * */ } document : block+ EOF ; block : heading | paragraph | list | blockquote | fencedcodeblock | table | NEWLINE ; heading : NEWLINE* HEADINGLINE NEWLINE ; paragraph : NEWLINE* paragraphline+ ; paragraphline : PARAGRAPHLINE ( NEWLINE | EOF ) ; list : NEWLINE* listline+ ; listline : LISTLINE ( NEWLINE | EOF ) ; blockquote : NEWLINE* quoteline+ ; quoteline : QUOTELINE ( NEWLINE | EOF ) ; fencedcodeblock : OPEN_FENCE infostring? FENCED_IGNORE_WS? importspec? FENCED_NEWLINE textline* CLOSE_FENCE ; textline : TEXTLINE ; infostring : WORD ; importspec : IMPORT FENCED_IGNORE_WS? path FENCED_IGNORE_WS? (start FENCED_IGNORE_WS? end?)? ; path : WORD | STRING ; start : FROM? FENCED_IGNORE_WS? location ; end : TO FENCED_IGNORE_WS? location ; location : LINENUMBER | STRING ; table : NEWLINE* tableheading tabledelimiterrow tablerow+ ; tableheading : tablerow ; tablerow : cell+ PIPE? ( NEWLINE | EOF ) ; cell : CELLTEXT ; tabledelimiterrow : TABLEDELIMINATORCELL+ PIPE? NEWLINE ;
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/z11_title.asm
prismotizm/gigaleak
0
8573
<filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/z11_title.asm<gh_stars>0 Name: z11_title.asm Type: file Size: 165637 Last-Modified: '2016-05-13T04:23:03Z' SHA-1: 4BFEB4269245FAD0B31AE930F051C540BC64A8DB Description: null
MASM/Number.asm
secana/Assembler-Examples
8
9544
;============================================================== .386 .model flat,stdcall option casemap:none ;============================================================== include \masm32\include\windows.inc include \masm32\include\masm32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data szLine db 80 DUP("="),0 szCaption db "My first console program:",10,0 szInput db "Please enter a number:",0 szOutput db "Your number is:",0 number db 20 DUP(0) .code start: push offset szLine call StdOut push offset szCaption call StdOut push offset szLine call StdOut push offset szInput call StdOut push 20 push offset number call StdIn push offset szOutput call StdOut push offset number call StdOut push 0 call ExitProcess end start
programs/oeis/014/A014025.asm
neoneye/loda
22
2948
; A014025: Expansion of the inverse of the 16th cyclotomic polynomial. ; 1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,0 dif $0,2 seq $0,14017 ; Inverse of 8th cyclotomic polynomial.
programs/oeis/178/A178489.asm
karttu/loda
0
29105
<reponame>karttu/loda<filename>programs/oeis/178/A178489.asm ; A178489: a(n) = floor(n^(1/6)): integer part of sixth root of n. ; 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 mul $0,2 lpb $0,1 div $0,128 add $1,108 lpe div $1,108
freenet-config.applescript
rinchen/fesc
0
1689
<reponame>rinchen/fesc<filename>freenet-config.applescript (* ==== Properties ==== *) property panelWIndow : missing value (* ==== Event Handlers ==== *) --- subroutines on assignvalue(theLine) set theValue to "" repeat with j from ((offset of "=" in theLine) + 1) to (length of theLine) set theValue to theValue & (character j of theLine) end repeat if theValue = "true" then set theValue to true else if theValue = "false" then set theValue to false end if return theValue end assignvalue on clicked theObject -- Read in the preferences set theLocation to call method "defaultObjectForKey:" with parameter "location" -- read config file try set read_success to true set theFile to alias (theLocation & "freenet.conf") set fref to (open for access theFile) -- need to use unix \n instead of \r set configdata to read fref using delimiter " " as string -- close access fref set len to (length of configdata) repeat with i from 1 to len set theLine to item i of configdata if theLine contains "=" then --assign variables considering case -- otherwise we can't distinguish bandwidth variables if theLine contains "ipAddress" then set ipAddress to assignvalue(theLine) set ipAddress_line to i else if theLine contains "listenPort" then set listenPort to assignvalue(theLine) set listenPort_line to i else if theLine contains "adminPassword" then set adminPassword to assignvalue(theLine) set adminPassword_line to i else if theLine contains "adminPeer" then set adminPeer to assignvalue(theLine) set adminPeer_line to i else if theLine contains "transient" then set transient to assignvalue(theLine) set transient_line to i else if theLine contains "bandwidthLimit=" then set bandwidthlimit to assignvalue(theLine) set bandwidthlimit_line to i else if theLine contains "maxNodeConnections" then set maxNodeConnections to assignvalue(theLine) set maxNodeConnections_line to i else if theLine contains "maximumThreads" then set maximumThreads to assignvalue(theLine) set maximumThreads_line to i else if theLine contains "maxHopsToLive" then set maxHopsToLive to assignvalue(theLine) set maxHopsToLive_line to i else if theLine contains "announcementHTL" then set announcementHTL to assignvalue(theLine) set announcementHTL_line to i else if theLine contains "initialRequestHTL" then set initialRequestHTL to assignvalue(theLine) set initialRequestHTL_line to i else if theLine contains "mainport.port" then set mainportport to assignvalue(theLine) set mainportport_line to i else if theLine contains "mainport.allowedHosts" then set mainportallowedHosts to assignvalue(theLine) set mainportallowedHosts_line to i else if theLine contains "logLevel" then set logLevel to assignvalue(theLine) set logLevel_line to i else if theLine contains "logInboundContacts" then set logInboundContacts to assignvalue(theLine) set logInboundContacts_line to i else if theLine contains "logOutboundContacts" then set logOutboundContacts to assignvalue(theLine) set logOutboundContacts_line to i else if theLine contains "logInboundRequests" then set logInboundRequests to assignvalue(theLine) set logInboundRequests_line to i else if theLine contains "logOutboundRequests" then set logOutboundRequests to assignvalue(theLine) set logOutboundRequests_line to i else if theLine contains "logInboundInsertRequestDist" then set logInboundInsertRequestDist to assignvalue(theLine) set logInboundInsertRequestDist_line to i else if theLine contains "logSuccessfulInsertRequestDist" then set logSuccessfulInsertRequestDist to assignvalue(theLine) set logSuccessfulInsertRequestDist_line to i end if end considering end if end repeat on error display dialog "Error: Encountered problem reading Freenet.conf" set read_success to false end try -- if good read then display panel if read_success then -- Load the panel. We do this by loading the nib that contains the panel window, and then setting our property to the loaded window. Only do this once, as every time the nib is loaded, it will create new copies of all of the top level objects in the nib. try if not (exists panelWIndow) then load nib "ConfigPanel" set panelWIndow to window "Config" end if -- Set the state of the items in the panel tell panelWIndow set contents of text field "ipAddress" to ipAddress set contents of text field "listenPort" to listenPort set contents of text field "adminPassword" to <PASSWORD> set contents of text field "adminPeer" to adminPeer set contents of button "transient" to transient set contents of text field "bandwidthLimit" to bandwidthlimit set contents of text field "maxNodeConnections" to maxNodeConnections set contents of text field "maximumThreads" to maximumThreads set contents of text field "maxHopsToLive" to maxHopsToLive set contents of text field "announcementHTL" to announcementHTL set contents of text field "initialRequestHTL" to initialRequestHTL set contents of text field "mainportport" to mainportport set contents of text field "mainportallowedHosts" to mainportallowedHosts set contents of text field "logLevel" to logLevel set contents of button "logOutboundContacts" to logOutboundContacts set contents of button "logInboundContacts" to logInboundContacts set contents of button "logOutboundRequests" to logOutboundRequests set contents of button "logInboundRequests" to logInboundRequests set contents of button "logInboundInsertRequestDist" to logInboundInsertRequestDist set contents of button "logSuccessfulInsertRequestDist" to logSuccessfulInsertRequestDist end tell -- display panel try --sets theResult to the parameter we pass in config-buttons set theResult to (display panel panelWIndow) if theResult is 1 then -- we hit the save button -- Set the new state of the items from the panel tell panelWIndow set ipAddress to contents of text field "ipAddress" set listenPort to contents of text field "listenPort" set adminPassword to contents of text field "<PASSWORD>" set adminPeer to contents of text field "adminPeer" set transient to contents of button "transient" as string set bandwidthlimit to contents of text field "bandwidthLimit" set maxNodeConnections to contents of text field "maxNodeConnections" set maximumThreads to contents of text field "maximumThreads" set maxHopsToLive to contents of text field "maxHopsToLive" set announcementHTL to contents of text field "announcementHTL" set initialRequestHTL to contents of text field "initialRequestHTL" set mainportport to contents of text field "mainportport" set mainportallowedHosts to contents of text field "mainportallowedHosts" set logLevel to contents of text field "logLevel" set logOutboundContacts to contents of button "logOutboundContacts" as string set logInboundContacts to contents of button "logInboundContacts" as string set logOutboundRequests to contents of button "logOutboundRequests" as string set logInboundRequests to contents of button "logInboundRequests" as string set logInboundInsertRequestDist to contents of button "logInboundInsertRequestDist" as string set logSuccessfulInsertRequestDist to contents of button "logSuccessfulInsertRequestDist" as string end tell -- Set new contents of each line set item ipAddress_line of configdata to "ipAddress=" & ipAddress set item listenPort_line of configdata to "listenPort=" & listenPort set item adminPassword_line of configdata to "adminPassword=" & <PASSWORD>Password set item adminPeer_line of configdata to "adminPeer=" & adminPeer set item transient_line of configdata to "transient=" & transient set item bandwidthlimit_line of configdata to "bandwidthLimit=" & bandwidthlimit set item maxNodeConnections_line of configdata to "maxNodeConnections=" & maxNodeConnections set item maximumThreads_line of configdata to "maximumThreads=" & maximumThreads set item maxHopsToLive_line of configdata to "maxHopsToLive=" & maxHopsToLive set item announcementHTL_line of configdata to "announcementHTL=" & announcementHTL set item initialRequestHTL_line of configdata to "initialRequestHTL=" & initialRequestHTL set item mainportport_line of configdata to "mainport.port=" & mainportport set item mainportallowedHosts_line of configdata to "mainport.allowedHosts=" & mainportallowedHosts set item logLevel_line of configdata to "logLevel=" & logLevel set item logOutboundContacts_line of configdata to "logOutboundContacts=" & logOutboundContacts set item logInboundContacts_line of configdata to "logInboundContacts=" & logInboundContacts set item logOutboundRequests_line of configdata to "logOutboundRequests=" & logOutboundRequests set item logInboundRequests_line of configdata to "logInboundRequests=" & logInboundRequests set item logInboundInsertRequestDist_line of configdata to "logInboundInsertRequestDist=" & logInboundInsertRequestDist set item logSuccessfulInsertRequestDist_line of configdata to "logSuccessfulInsertRequestDist=" & logSuccessfulInsertRequestDist -- write out new file try set fref to (open for access theFile with write permission) repeat with i from 1 to len write item i of configdata to fref -- need to use unix \n instead of \r write " " to fref end repeat close access fref try -- so cancel doesn't error out display dialog "New Settings Saved! You must restart Freenet for the settings to take affect." end try on error display dialog "Error: Encountered problem writing Freenet.conf. Please check the file and verify that it is not corrupt. Normally the last few lines with contain errors." end try -- no else since else means we pressed the cancel button end if -- theResult is 1 on error display dialog "Error displaying configuration panel (try)" end try -- display panel on error display dialog "Error loading nib configuration panel (try)" end try -- load panel end if -- read success end clicked
a51test/(25)ADD_A_d.a51
Aimini/51cpu
0
99743
<reponame>Aimini/51cpu<filename>a51test/(25)ADD_A_d.a51 MOV 0x00,#1 ADD A,0x00 ;0x10 Cy=0 OV = 0 AC=1 MOV 0x41,#0x0F ADD A,0x41 ;0x1F Cy=0 OV = 0 AC=0 MOV 0x22,#0x0F ADD A,0x22 ;0x44 Cy=0 OV = 0 AC=1 MOV 0x7F,#0x25 ADD A,0x7F ;0x33 Cy=1 OV = 0 AC=1 MOV 0xF0,#0xEF ADD A, 0xF0 ;0x85 Cy=0 OV = 1 AC = 0 MOV 0x5F,#0x52 ADD A, 0x5F ;0x84 Cy=1 OV = 0 AC = 1 MOV 0x60,#0xFF ADD A, 0x60
programs/memedit.asm
mynameispyo/InpyoOS
0
163233
; ------------------------------------------------------------------ ; MichalOS Memory Editor ; ------------------------------------------------------------------ BITS 16 %INCLUDE "osdev.inc" ORG 100h start: call .draw_background mov dl, 10 mov dh, 4 call os_move_cursor mov al, 0 .hexcharsloop1: call os_print_2hex call os_print_space inc al cmp al, 16 jl .hexcharsloop1 call os_print_space mov al, 0 .hexcharsloop2: call os_print_1hex inc al cmp al, 16 jl .hexcharsloop2 ; call os_print_string .loop: call .draw lodsb cmp al, 'Q' ; 'Q' typed? je near .exit cmp al, 'A' je near .inputaddress cmp al, 'D' je near .inputdata cmp al, 'R' je near .runcode cmp al, 'H' je near .help cmp al, 'S' je near .save cmp al, 'L' je near .load jmp .loop .save: lodsb cmp al, 'D' je near .savedecimal cmp al, 'H' je near .savehexadecimal jmp .loop .savedecimal: sub si, 2 call os_string_parse add ax, 2 mov si, ax call os_string_to_int jmp .copy .savehexadecimal: sub si, 2 call os_string_parse add ax, 2 mov si, ax call os_string_to_hex .copy: push bx ; Store the filename mov cx, ax push cx ; Store the file size mov esi, [.address] sub esi, 65536 mov edi, 20000h - 65536 .copy_loop: mov al, [esi] mov [edi], al inc esi inc edi dec cx cmp cx, 0 jne .copy_loop ; Save the file mov bx, 0 pop cx pop ax push es mov dx, 2000h mov es, dx call os_write_file pop es jc .error jmp .loop .load: mov ax, si push es push ax mov ax, 2000h mov es, ax pop ax mov cx, 0 call os_load_file pop es jc .error mov cx, bx mov edi, [.address] sub edi, 65536 mov esi, 10000h .load_loop: mov al, [esi] mov [edi], al inc esi inc edi dec cx cmp cx, 0 jne .load_loop jmp .loop .help: mov ax, .help_msg0 mov bx, .help_title0 mov cx, .help_title1 call os_list_dialog jmp start .inputaddress: lodsb cmp al, 'D' je near .addressdecimal cmp al, 'H' je near .addresshexadecimal jmp .loop .addressdecimal: call os_string_to_32int mov [.address], eax jmp .loop .addresshexadecimal: call os_string_to_hex mov [.address], eax jmp .loop .inputdata: lodsb cmp al, 'D' je near .datadecimal cmp al, 'H' je near .datahexadecimal jmp .loop .datadecimal: mov byte [.data_mode], 1 call .draw mov byte [.data_mode], 0 cmp byte [si], 'Q' je .loop call os_string_to_32int mov esi, [.address] mov [esi-65536], al inc dword [.address] jmp .datadecimal .datahexadecimal: mov byte [.data_mode], 1 call .draw mov byte [.data_mode], 0 cmp byte [si], 'Q' je .loop call os_string_to_hex mov esi, [.address] mov [esi-65536], al inc dword [.address] jmp .datahexadecimal .runcode: lodsb inc si cmp al, 'D' je near .codedecimal cmp al, 'H' je near .codehexadecimal jmp .loop .codedecimal: call os_string_to_32int jmp .long_call .codehexadecimal: call os_string_to_hex jmp .long_call .draw: call .bardraw call .datadraw call .asciidraw mov dl, 0 ; Print the input label mov dh, 2 call os_move_cursor cmp byte [.data_mode], 0 je .normal_label mov si, .data_label call os_print_string jmp .finish_label .normal_label: mov si, .input_label call os_print_string .finish_label: mov ah, 09h ; Clear the screen for the next input mov al, ' ' mov bh, 0 mov bl, [57000] mov cx, 60 int 10h mov dl, 40 mov dh, 2 call os_move_cursor mov eax, [.address] call os_print_8hex mov dl, 2 mov dh, 2 call os_move_cursor call os_show_cursor ; Get a command from the user mov ax, .input_buffer call os_input_string mov si, .input_buffer ; Decode the command call os_string_uppercase ret .asciidraw: pusha mov dl, 59 mov dh, 6 call os_move_cursor mov esi, [.address] and esi, 0FFFFFFF0h ; Mask off the lowest 4 bits (divide by 16) .asciiloop: mov al, [esi-65536-40h] inc esi cmp al, 32 jge near .asciichar mov al, '.' .asciichar: mov ah, 0Eh mov bh, 0 int 10h call os_get_cursor_pos cmp dl, 75 jl .asciiloop mov dl, 59 inc dh call os_move_cursor cmp dh, 22 jl .asciiloop popa ret .datadraw: pusha mov dl, 10 mov dh, 6 call os_move_cursor mov esi, [.address] and esi, 0FFFFFFF0h ; Mask off the lowest 4 bits (divide by 16) .dataloop: mov al, [esi-65536-40h] inc esi call os_print_2hex call os_print_space call os_get_cursor_pos cmp dl, 58 jl .dataloop mov dl, 10 inc dh call os_move_cursor cmp dh, 22 jl .dataloop popa ret .exit: call os_clear_screen ret .draw_background: mov ax, .title_msg mov bx, .footer_msg mov cx, [57000] call os_draw_background ret .bardraw: mov dl, 0 mov dh, 6 call os_move_cursor mov eax, [.address] and eax, 0FFFFFFF0h sub eax, 40h mov cl, 0 .barloop: call os_print_space call os_print_8hex call os_print_newline add eax, 16 inc cl cmp cl, 16 jne .barloop ret .error: mov ax, .error_msg mov bx, 0 mov cx, 0 mov dx, 0 call os_dialog_box jmp start .long_call: mov [.call_address], ax shr eax, 4 and ax, 0F000h ; Make it a segment mov [.call_segment], ax .call_instruction db 9Ah .call_address dw 0 .call_segment dw 0 jmp start ; I don't think we'll actually get here... ; DAAAAAAATAAAAAAA! .title_msg db 'InpyoOS Memory Editor', 0 .footer_msg db '[h], [Enter] = Command list', 0 .input_label db ' >', 0 .data_label db 'D>', 0 .data_mode db 0 .address dd 0 .help_title0 db 'Command list:', 0 .help_title1 db 0 .help_msg0 db 'q = Quit,' .help_msg1 db 'ad/ahXXXXXXXX = Choose a 32-bit address (dec/hex),' .help_msg2 db 'dd/dh = Enter the data write mode (dec/hex),' .help_msg3 db 'rd/rhXXXXX = Run code on a 20-bit address,' .help_msg4 db 'sd/shXXXX ABC.XYZ = Save a file (XXXX bytes; filename ABC.XYZ),' .help_msg5 db 'lABC.XYZ = Load a file (filename ABC.XYZ)', 0 .error_msg db 'File access error!', 0 .input_buffer db 0 ; Has to be on the end! ; ------------------------------------------------------------------
alloy4fun_models/trashltl/models/11/ceMFNm5EKwDmJMsb2.als
Kaixi26/org.alloytools.alloy
0
2016
<reponame>Kaixi26/org.alloytools.alloy open main pred idceMFNm5EKwDmJMsb2_prop12 { always all f : File | eventually f in Trash always all f : Trash | f in Trash' } pred __repair { idceMFNm5EKwDmJMsb2_prop12 } check __repair { idceMFNm5EKwDmJMsb2_prop12 <=> prop12o }
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_483.asm
ljhsiun2/medusa
9
85235
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x3070, %r9 cmp $51939, %rbx mov (%r9), %r15d nop nop xor $44216, %rdx lea addresses_normal_ht+0xd45a, %r9 nop nop inc %r14 vmovups (%r9), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdi nop inc %r9 lea addresses_A_ht+0x81a, %rsi lea addresses_normal_ht+0x1a81a, %rdi nop nop and $43237, %rbx mov $93, %rcx rep movsw nop nop nop sub $16446, %rcx lea addresses_D_ht+0xbd1a, %r9 nop xor $38932, %r15 mov (%r9), %r14 nop nop nop nop nop inc %r14 lea addresses_normal_ht+0x1381a, %rdi nop sub $24287, %rbx mov $0x6162636465666768, %rdx movq %rdx, %xmm0 vmovups %ymm0, (%rdi) cmp %rdi, %rdi lea addresses_WC_ht+0x1600a, %rsi xor %rdx, %rdx movups (%rsi), %xmm7 vpextrq $1, %xmm7, %rdi nop nop nop nop nop xor $10428, %r14 lea addresses_A_ht+0x1bfcf, %rsi lea addresses_normal_ht+0x1001a, %rdi inc %r14 mov $87, %rcx rep movsw nop nop nop nop nop dec %rsi lea addresses_WT_ht+0x10282, %r14 dec %r9 vmovups (%r14), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r15 nop sub $52812, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %rbx push %rcx // Faulty Load lea addresses_UC+0xe01a, %r11 nop nop sub $34596, %rcx movups (%r11), %xmm7 vpextrq $0, %xmm7, %r14 lea oracles, %rbx and $0xff, %r14 shlq $12, %r14 mov (%rbx,%r14,1), %r14 pop %rcx pop %rbx pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': True, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 0}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'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 */
tools-src/gnu/binutils/gas/testsuite/gasp/repeat.asm
enfoTek/tomato.linksys.e2000.nvram-mod
80
91526
.AREPEAT 10 TEN .AREPEAT 2 TWENTY .AENDR .AENDR .AREPEAT 3 ROTCL R2 DIV1 R0,R1 .AENDR .END
osx huc/huc-macosx-dist/include/pce/huc_gfx.asm
langel/pce-dev-kit
1
93225
<reponame>langel/pce-dev-kit ; ; HUC_GFX.ASM - HuC Graphic Library ; ; ---- ; local variables .zp __spr_ptr .ds 2 __spr_max .ds 1 __spr_flag .ds 1 .bss _font_base .ds 2 _font_color .ds 2 _satb .ds 512 ; the local SATB _gfx_pal .ds 1 _line_currx .ds 2 _line_curry .ds 2 _line_deltax .ds 2 _line_deltay .ds 2 _line_error .ds 2 _line_adjust .ds 2 _line_xdir .ds 1 _line_color .ds 1 ; ---- ; library code .code ; cls(int val [dx]) ; ---- _cls: stw _font_base,<_dx _cls.1: setvwaddr $0 ; -- ldy bat_height .l2: ldx bat_width ; -- .l3: stw <_dx,video_data dex bne .l3 dey bne .l2 rts ; set_font_pal(int pal) ; ---- _set_font_pal: txa asl A asl A asl A asl A sta <__temp lda _font_base+1 and #$0F ora <__temp sta _font_base+1 rts ; set_font_color(char color, char bg) ; ---- _set_font_color.2: txa and #$F sta _font_color+1 lda <_al and #$F sta _font_color rts ; set_font_addr(int addr) ; ---- _set_font_addr: ; -- stx _font_base lsr A ror _font_base lsr A ror _font_base lsr A ror _font_base lsr A ror _font_base sta <_al ; -- lda _font_base+1 and #$F0 ora <_al sta _font_base+1 rts ; get_font_pal() ; ---- _get_font_pal: lda _font_base+1 lsr A lsr A lsr A lsr A clx sax rts ; get_font_addr() ; ---- _get_font_addr: ; -- lda _font_base+1 sta <_al lda _font_base asl A rol <_al asl A rol <_al asl A rol <_al asl A rol <_al ldx <_al sax rts ; load_default_font(char num [dl], int addr [di]) ; ---- _load_default_font: ; -- stz <_dl _load_default_font.1: ; -- ldx #$FF lda #$FF jsr calc_vram_addr incw <_di _load_default_font.2: ; -- lda <_di ora <_di+1 bne .l1 jsr _get_font_addr __stw <_di bra .l2 ; -- .l1: __ldw <_di jsr _set_font_addr ; -- .l2: stb #FONT_BANK+_bank_base,<_bl stb #96,<_cl stb _font_color+1,<_ah lda _font_color bne .l3 inc A .l3: sta <_al lda <_dl and #$03 asl A tax lda font_table,X sta <_si inx lda font_table,X sta <_si+1 jmp load_font ; load_font(farptr font [bl:si], char nb [cl], int addr [di]) ; ---- _load_font.2: ; -- ldx #$FF lda #$FF jsr calc_vram_addr incw <_di _load_font.3: ; -- lda <_di ora <_di+1 bne .l1 jsr _get_font_addr __stw <_di bra .l2 ; -- .l1: __ldw <_di jsr _set_font_addr ; -- .l2: lda <_cl stz <_ch asl A rol <_ch asl A rol <_ch asl A rol <_ch asl A rol <_ch sta <_cl jmp load_vram ; put_digit(char digit, int offset) ; put_digit(char digit, char x, char y) ; ---- _put_digit.3: ldy <__arg_idx __plb jsr _put.xy bra _put_digit.main _put_digit.2: ldy <__arg_idx jsr _put.vram _put_digit.main: __plb sty <__arg_idx _put_digit.sub: cmp #10 blo .l1 add #$07 .l1: adc #$10 adc _font_base sta video_data_l cla adc _font_base+1 sta video_data_h rts _put.xy: sax jsr calc_vram_addr jmp set_write _put.vram: stz <vdc_reg stz video_reg stx video_data_l sta video_data_h vreg #$02 rts ; put_char(char character, int offset) ; put_char(char character, char x, char y) ; ---- _put_char.3: ldy <__arg_idx __plb jsr _put.xy bra _put_char.main _put_char.2: ldy <__arg_idx jsr _put.vram _put_char.main: __plb sty <__arg_idx ; -- cmp #32 bhs .l1 lda #32 sec .l1: sbc #32 add _font_base sta video_data_l cla adc _font_base+1 sta video_data_h rts ; put_raw(int character, int offset) ; put_raw(int character, char x, char y) ; ---- _put_raw.3: ldy <__arg_idx __plb jsr _put.xy bra _put_raw.main _put_raw.2: ldy <__arg_idx jsr _put.vram _put_raw.main: __plb sta video_data_l __plb sta video_data_h sty <__arg_idx rts ; put_number(int number, char n, int offset) ; put_number(int number, char n, char x, char y) ; ---- _put_number.3: maplibfunc lib2_put_number.3 rts _put_number.4: maplibfunc lib2_put_number.4 rts ; put_hex(int number, char n, int offset) ; put_hex(int number, char n, char x, char y) ; ---- _put_hex.4: ldy <__arg_idx __plb jsr _put.xy bra _put_hex.main _put_hex.3: ldy <__arg_idx jsr _put.vram _put_hex.main: __plb <_cl,1 __plw <_dx sty <__arg_idx ; -- txa beq .l3 .l1: cpx #5 blo .l2 cla jsr _put_digit.sub dex bra .l1 ; -- .l2: txa dec A asl A tax jmp [.tbl,X] .l3: rts ; -- .tbl: .dw .h1,.h2,.h3,.h4 ; -- .h4: lda <_dh lsr A lsr A lsr A lsr A jsr _put_digit.sub ; -- .h3: lda <_dh and #$0F jsr _put_digit.sub ; -- .h2: lda <_dl lsr A lsr A lsr A lsr A jsr _put_digit.sub ; -- .h1: lda <_dl and #$0F jmp _put_digit.sub ; put_string(char *string, int offset) ; put_string(char *string, char x, char y) ; ---- _put_string.3: ldy <__arg_idx __plb jsr _put.xy bra _put_string.main _put_string.2: ldy <__arg_idx jsr _put.vram _put_string.main: __plw <_si sty <__arg_idx bra .l3 ; -- .l1: cmp #32 bhs .l2 lda #32 sec .l2: sbc #32 add _font_base sta video_data_l cla adc _font_base+1 sta video_data_h incw <_si .l3: lda [_si] bne .l1 rts ; vsync(char nb_frame) ; ---- _vsync: txa cpy #0 bne .l1 cla .l1: jmp wait_vsync ; vreg(char reg) ; ---- _vreg: cpy #2 bne .l1 jmp setvdc .l1: stx <vdc_reg stx video_reg rts ; vram_addr(char x [al], char y) ; ---- _vram_addr.2: lda <_al sax jsr calc_vram_addr __ldw <_di rts ; scan_map_table(int *tbl [si], int *x [ax], int *y [cx]) ; ---- ; tbl, ; x, ; y, ; ---- _scan_map_table.3: ldy #1 lda [_ax] sta <_bl lda [_ax],Y sta <_bh lda [_cx] sta <_dl lda [_cx],Y sta <_dh ; -- addw #4,<_si ; ---- ; check bounds ; ; -- bottom .l1: ldy #7 lda [_si],Y cmp <_dh blo .x1 bne .l2 dey lda [_si],Y cmp <_dl blo .x1 ; -- top .l2: ldy #3 lda <_dh cmp [_si],Y blo .x1 bne .l3 dey lda <_dl cmp [_si],Y blo .x1 ; -- right .l3: ldy #5 lda [_si],Y cmp <_bh blo .x1 bne .l4 dey lda [_si],Y cmp <_bl blo .x1 ; -- left .l4: ldy #1 lda <_bh cmp [_si],Y blo .x1 bne .x2 lda <_bl cmp [_si] bhs .x2 ; ---- ; next ; .x1: addw #12,<_si ldy #1 lda [_si] and [_si],Y cmp #$FF bne .l1 ; ---- ; didn't find map... ; clx cla rts ; ---- ; found map! ; .x2: ldy #1 lda <_bl sub [_si] sta [_ax] lda <_bh sbc [_si],Y sta [_ax],Y ; -- iny lda <_dl sub [_si],Y sta [_cx] iny lda <_dh sbc [_si],Y ldy #1 sta [_cx],Y ; -- __ldw <_si rts ; set_map_data(int *ptr) ; set_map_data(char *map [bl:si], int w [ax], int h) ; set_map_data(char *map [bl:si], int w [ax], int h [dx], char wrap) ; ---- ; map, map base address ; w, map width ; h, map height ; wrap, wrap flag (1 = wrap, 0 = do not wrap) ; ---- _set_map_data.1: __stw <_si ora <_si beq .l1 ; -- calculate width lda [_si].4 sub [_si] sta mapwidth lda [_si].5 sbc [_si].1 sta mapwidth+1 incw mapwidth ; -- calculate height lda [_si].6 sub [_si].2 sta mapheight lda [_si].7 sbc [_si].3 sta mapheight+1 incw mapheight ; -- get map bank lda [_si].8 sta mapbank ; -- get map addr lda [_si].10 sta mapaddr iny lda [_si] sta mapaddr+1 ; -- no wrap stz mapwrap rts ; -- null pointer .l1: stwz mapwidth stwz mapheight stz mapbank stwz mapaddr stz mapwrap rts _set_map_data.4: stx mapwrap __ldw <_dx bra _set_map_data.main _set_map_data.3: stz mapwrap inc mapwrap _set_map_data.main: __stw mapheight stw <_ax,mapwidth stb <_bl,mapbank stw <_si,mapaddr rts ; get_map_width() ; ---- _get_map_width: __ldw mapwidth rts ; get_map_height() ; ---- _get_map_height: __ldw mapheight rts ; set_tile_data(char *tile_ex [di]) ; set_tile_data(char *tile [bl:si], int nb_tile [cx], char *ptable [al:dx]) ; ---- ; tile, tile base index ; nb_tile, number of tile ; ptable, tile palette table address ; ---- _set_tile_data.1: cly lda [_di],Y++ sta mapnbtile lda [_di],Y++ sta mapnbtile+1 lda [_di],Y++ sta maptiletype iny lda [_di],Y++ sta maptilebank iny lda [_di],Y++ sta maptileaddr lda [_di],Y++ sta maptileaddr+1 lda #(CONST_BANK+_bank_base) sta mapctablebank lda [_di],Y++ sta mapctable lda [_di],Y sta mapctable+1 rts _set_tile_data.3: stb <_bl,maptilebank stw <_si,maptileaddr stw <_cx,mapnbtile stb <_al,mapctablebank stw <_dx,mapctable ; -- ldy <_bl ; get tile format (8x8 or 16x16) lda <_si+1 and #$1F tax lda <_si bne .l2 cpx #$0 bne .l1 dey ldx #$20 .l1: dex .l2: dec A txa ora #$60 sta <_si+1 tya tam #3 lda [_si] sta maptiletype rts ; load_tile(int addr) ; ---- _load_tile: __stw <_di stx <_al lsr A ror <_al lsr A ror <_al lsr A ror <_al lsr A ror <_al sta maptilebase+1 stb <_al,maptilebase ; -- stw mapnbtile,<_cx ldx #4 lda maptiletype cmp #8 beq .l1 ldx #6 .l1: asl <_cl rol <_ch dex bne .l1 ; -- stb maptilebank,<_bl stw maptileaddr,<_si jmp load_vram ; load_map(char x [al], char y [ah], int mx, int my, char w [dl], char h [dh]) ; ---- _load_map.6: tstw mapwidth lbeq .l6 tstw mapheight lbeq .l6 ; ---- ; adjust map y coordinate ; ldy <__arg_idx __plw <_bx bmi .l2 .l1: cmpw mapheight,<_bx blo .l3 subw mapheight,<_bx bra .l1 ; -- .l2: lda <_bh bpl .l3 addw mapheight,<_bx bra .l2 ; ---- ; adjust map x coordinate ; .l3: stb <_bl,<_ch __plw <_bx sty <__arg_idx bmi .l5 .l4: cmpw mapwidth,<_bx blo .l7 subw mapwidth,<_bx bra .l4 ; -- .l5: lda <_bh bpl .l7 addw mapwidth,<_bx bra .l5 ; ---- ; exit ; .l6: sub #4,<__arg_idx rts ; ---- ; ok ; .l7: stb <_bl,<_cl jmp load_map ; spr_set(char num) ; ---- ; load SI with the offset of the sprite to change ; SI = satb + 8 * sprite_number ; ---- _spr_set: cpx #64 bhs .l2 txa inx cpx <__spr_max blo .l1 stx <__spr_max ; -- .l1: stz <__spr_ptr+1 asl A asl A asl A rol <__spr_ptr+1 adc #low(_satb) sta <__spr_ptr lda <__spr_ptr+1 adc #high(_satb) sta <__spr_ptr+1 .l2: rts ; spr_hide(char num) ; ---- _spr_hide: cpy #0 beq .l2 ; -- hide sprite number # cpx #64 bhs .l1 jsr _spr_hide.sub lda [__ptr],Y ora #$02 sta [__ptr],Y .l1: rts ; -- hide current sprite .l2: ldy #1 lda [__spr_ptr],Y ora #$02 sta [__spr_ptr],Y rts ; -- calc satb ptr _spr_hide.sub: txa stz <__ptr+1 asl A asl A asl A rol <__ptr+1 adc #low(_satb) sta <__ptr lda <__ptr+1 adc #high(_satb) sta <__ptr+1 ldy #1 rts ; spr_show(char num) ; ---- _spr_show: cpy #0 beq .l2 ; -- hide sprite number # cpx #64 bhs .l1 jsr _spr_hide.sub lda [__ptr],Y and #$01 sta [__ptr],Y .l1: rts ; -- hide current sprite .l2: ldy #1 lda [__spr_ptr],Y and #$01 sta [__spr_ptr],Y rts ; spr_x(int value) ; ---- _spr_x: ldy #2 sax add #32 sta [__spr_ptr],Y sax adc #0 iny sta [__spr_ptr],Y rts _spr_get_x: ldy #2 lda [__spr_ptr],Y sub #32 tax iny lda [__spr_ptr],Y sbc #0 rts ; spr_y(int value) ; ---- _spr_y: sax add #64 sta [__spr_ptr] sax adc #0 and #$01 ldy #1 sta [__spr_ptr],Y rts _spr_get_y: lda [__spr_ptr] sub #64 tax ldy #1 lda [__spr_ptr],Y sbc #0 rts ; spr_pattern(int vaddr) ; ---- _spr_pattern: sta <__temp txa asl A rol <__temp rol A rol <__temp rol A rol <__temp rol A and #$7 ldy #5 sta [__spr_ptr],Y lda <__temp dey sta [__spr_ptr],Y rts _spr_get_pattern: ldy #4 lda [__spr_ptr],Y sta <__temp iny lda [__spr_ptr],Y lsr A ror <__temp ror A ror <__temp ror A ror <__temp ror A and #$E0 tax lda <__temp rts ; spr_ctrl(char mask [al], char value) ; ---- _spr_ctrl.2: txa and <_al sta <__temp lda <_al eor #$FF ldy #7 and [__spr_ptr],Y ora <__temp sta [__spr_ptr],Y rts ; spr_pal(char pal) ; ---- _spr_pal: txa and #$0F sta <__temp ldy #6 lda [__spr_ptr],Y and #$F0 ora <__temp sta [__spr_ptr],Y rts _spr_get_pal: ldy #6 lda [__spr_ptr],Y and #$0F tax cla rts ; spr_pri(char pri) ; ---- _spr_pri: ldy #6 lda [__spr_ptr],Y and #$7F cpx #$00 beq .l1 ora #$80 .l1: sta [__spr_ptr],Y rts ; satb_update() ; ---- _satb_update: lda <__spr_flag beq .l1 stz <__spr_flag ldx #64 bra .l3 ; -- .l1: cpy #1 beq .l2 ldx <__spr_max .l2: cpx #0 beq .l4 ; -- .l3: stx <_al ; number of sprites txa dec A ; round up to the next group of 4 sprites lsr A lsr A inc A sta <_cl ; Use TIA, but BLiT 16 words at a time (32 bytes) ; Because interrupt must not deferred too much ; stw #32, _ram_hdwr_tia_size stw #video_data, _ram_hdwr_tia_dest stw #_satb, <_si stw #$7F00, <_di jsr set_write .l3a: stw <_si, _ram_hdwr_tia_src jsr _ram_hdwr_tia addw #32,<_si dec <_cl bne .l3a ;.l3: stx <_al ; stw #_satb,<_si ; stb #BANK(_satb),<_bl ; stw #$7F00,<_di ; txa ; stz <_ch ; asl A ; asl A ; rol <_ch ; sta <_cl ; jsr load_vram ; -- ldx <_al .l4: cla rts ; init_satb() ; reset_satb() ; ---- _reset_satb: _init_satb: clx cla .l1: stz _satb,X stz _satb+256,X inx bne .l1 ; -- ldy #1 sty <__spr_flag stz <__spr_max rts ; get_color(int index [color_reg]) ; ---- ; index: index in the palette (0-511) ; ---- _get_color.1: ldx color_data_l lda color_data_h and #$01 rts ; set_color(int index [color_reg], int color [color_data]) ; ---- ; set one palette entry to the specified color ; ---- ; index: index in the palette (0-511) ; color: color value, GREEN: bit 6-8 ; RED: bit 3-5 ; BLUE: bit 0-2 ; ---- ; NOTE : inlined ; ---- ; fade_color(int color [ax], char level) ; fade_color(int index [color_reg], int color [ax], char level) ; ---- ; set one palette entry to the specified color ; ---- ; index: index in the palette (0-511) ; color: color value, GREEN: bit 6-8 ; RED: bit 3-5 ; BLUE: bit 0-2 ; level: level of fading (0 = black, 8 = full) ; ---- _fade_color.2: _fade_color.3: cpx #0 beq .l4 cpx #8 bhs .l5 ; -- fading ldy #3 stx <_bl stwz <_dx .l1: lsr <_bl bcc .l2 addw <_ax,<_dx .l2: aslw <_ax dey bne .l1 lda <_dh lsr A ror <_dl lsr A ror <_dl lsr A ror <_dl ; -- set color ldx <_dl .l3: stx color_data_l sta color_data_h rts ; -- black .l4: cla bra .l3 ; -- full .l5: ldx <_al lda <_ah bra .l3 ; set_color_rgb(int index [color_reg], char r [al], char g [ah], char b) ; ---- ; set one palette entry to the specified color ; ---- ; index: index in the palette (0-511) ; r: red RED: bit 3-5 ; g: green GREEN: bit 6-8 ; b: blue BLUE: bit 0-2 ; ---- _set_color_rgb.4: txa and #$7 sta <__temp lda <_al asl A asl A asl A ora <__temp asl A asl A sta <__temp lda <_ah lsr A ror <__temp lsr A ror <__temp ldx <__temp stx color_data_l sta color_data_h rts ; put_tile(int tile_num [dx], int position) ; put_tile(int tile_num [dx], char x [al], char y) ; ---- ; draw a single 8x8 or 16x16 tile at a given position ; ---- ; pattern: vram address of the tile pattern ; position: position on screen where to put the tile ; ---- _put_tile.3: lda <_al ldy maptiletype cpy #8 beq .l1 ; -- asl A sax asl A jsr calc_vram_addr bra _put_tile_16 ; -- .l1: sax jsr calc_vram_addr bra _put_tile_8 _put_tile.2: __stw <_di ldy maptiletype cpy #8 bne _put_tile_16 _put_tile_8: jsr set_write ; -- calculate tile vram address stw mapctable,<_bx lda <_dl tay add maptilebase tax cla adc maptilebase+1 adc [_bx],Y ; -- copy tile stx video_data_l sta video_data_h rts _put_tile_16: jsr set_write ; -- calculate tile vram address stw mapctable,<_bx stz <_dh lda <_dl tay asl A rol <_dh asl A rol <_dh add maptilebase sta <_dl lda <_dh adc maptilebase+1 adc [_bx],Y sta <_dh ; -- copy tile stw <_dx,video_data incw <_dx stw <_dx,video_data incw <_dx vreg #0 addw bat_width,<_di,video_data vreg #2 stw <_dx,video_data incw <_dx stw <_dx,video_data rts ; map_get_tile(char x [dl], char y) ; map_put_tile(char x [dl], char y [dh], char tile) ; ---- _map_get_tile.2: stx <_dh jsr _map_calc_tile_addr ; -- lda [_cx] tax cla rts _map_put_tile.3: phx jsr _map_calc_tile_addr pla sta [_cx] rts ; map_calc_tile_addr(char x [dl], char y [dh]) ; ---- _map_calc_tile_addr: ldx <_dh lda mapwidth+1 beq .l1 stx <_ch lda <_dl sta <_cl bra .l2 ; -- .l1: stx <_al lda mapwidth sta <_bl jsr mulu8 ; -- lda <_cl add <_dl bcc .l2 inc <_ch ; -- .l2: add mapaddr sta <_cl lda mapaddr+1 and #$1F adc <_ch tax ; -- ; rol A ; rol A ; rol A ; rol A lsr A lsr A lsr A lsr A lsr A and #$0F add mapbank tam #3 ; -- txa and #$1F ora #$60 sta <_ch ldx <_cl rts ; scroll(char num, int x, int y, char top, char bottom, char disp) ; ---- ; set screen scrolling ; ---- _scroll: ldy #8 lda [__sp],Y and #$03 ; -- sax and #$C0 ora #$01 sta scroll_cr,X lda [__sp] inc A sta scroll_bottom,X ldy #2 lda [__sp],Y sta scroll_top,X ldy #4 lda [__sp],Y sta scroll_yl,X iny lda [__sp],Y sta scroll_yh,X iny lda [__sp],Y sta scroll_xl,X iny lda [__sp],Y sta scroll_xh,X addw #10,<__sp rts ; scroll_disable(char num) ; ---- ; disable screen scrolling for a scroll region ; ---- _scroll_disable: lda scroll_cr,X and #$fe sta scroll_cr,X rts ; set_screen_size(char size) ; ---- ; set screen virtual size ; ---- _set_screen_size: txa jmp set_bat_size ; set_xres(int xres) ; ---- ; set horizontal display resolution ; ---- _set_xres.1: lda #XRES_SOFT sta <_cl _set_xres.2: jsr set_xres ldx <_al lda <_ah rts ; ------------------------ ; Graphics functions ; ------------------------ ; readvram ; ---- ; leftover from asm library ; needed for 'a = vram[n]' ; semantic ; ---- readvram: ldy #1 sty <vdc_reg sty video_reg stx video_data_l sta video_data_h vreg #$02 ldx video_data_l lda video_data_h rts ; writevram ; ---- ; leftover from asm library ; needed for 'vram[n] = a' ; semantic ; ---- writevram: tay stz <vdc_reg stz video_reg lda [__sp] sta video_data_l incw <__sp lda [__sp] sta video_data_h incw <__sp vreg #2 stx video_data_l sty video_data_h rts ; gfx_setbgpal(char pal) ; ---- ; set default major palette for gfx_* func's ; ---- _gfx_setbgpal: txa asl A asl A asl A asl A sta _gfx_pal rts ; gfx_init(int start_vram_addr) ; ---- ; initialize graphics mode ; - points graphics map to tiles at start_vram_addr ; ---- _gfx_init: __stw <_dx ; vram addr lsrw <_dx ; shift address to make char pattern lsrw <_dx lsrw <_dx lsrw <_dx lda <_dx+1 and #$0f ora _gfx_pal ; and add major palette info sta <_dx+1 setvwaddr $0 ; -- ldy bat_height .l2: ldx bat_width ; -- .l3: stw <_dx,video_data incw <_dx dex bne .l3 dey bne .l2 rts ; gfx_clear(int start_vram_addr) ; ---- ; Clear the values in the graphics tiles ; - places zeroes in graphics tiles at start_vram_addr ; ---- _gfx_clear: __stw <_di ; start_vram_addr jsr set_write ; setup VRAM addr for writing lda bat_height sta <_bl ; loop for all lines .l2: ldx bat_width ; loop for all characters .l3: ldy #8 ; loop for 16 words .l4: stw #0,video_data ; unrolled a bit (8 iterations stw #0,video_data ; @ 2 words each iteration) dey bne .l4 dex bne .l3 dec <_bl bne .l2 rts ; gfx_plot(int x [bx] int y [cx] char color [reg acc]) ; ---- ; Plot a point at location (x,y) in color ; ---- _gfx_plot.3: maplibfunc lib2_gfx_plot.3 rts ; gfx_point(int x [bx], int y [cx]) ; ---- ; Returns color of point at location (x,y) ; ---- _gfx_point.2: maplibfunc lib2_gfx_point.2 rts ; gfx_line(int x1 [bx], int y1 [cx], int x2 [si], int y2 [bp], char color [reg acc]) ; ---- ; Plot a line from location (x1,y1) to location (x2,y2) in color ; ---- _gfx_line.5: maplibfunc lib2_gfx_line.5 rts ;--------------------------------- ; ; Change to context LIB2_BANK for these functions ; because they are larger than LIB1_BANK functions ; should be ; .bank LIB2_BANK ; put_number(int number, char n, int offset) ; put_number(int number, char n, char x, char y) ; ---- lib2_put_number.4: ldy <__arg_idx __plb jsr _put.xy bra putnum.main lib2_put_number.3: ldy <__arg_idx jsr _put.vram putnum.main: __plb <_cl,1 __plw <_dx sty <__arg_idx ; -- stz <_al ; sign flag dex cpx #16 bhs .l5 ; -- lda <_dh ; check sign bpl .l1 negw <_dx ; negate lda #1 sta <_al ; -- .l1: jsr divu10 ora #$10 pha dex bmi .l3 tstw <_dx bne .l1 ; -- lda <_al beq .l2 lda #$0D pha dex bmi .l3 ; -- cla .l2: pha dex bpl .l2 ; -- .l3: ldx <_cl .l4: pla add _font_base sta video_data_l cla adc _font_base+1 sta video_data_h dex bne .l4 .l5: rts ; gfx_line(int x1 [bx], int y1 [cx], int x2 [si], int y2 [bp], char color [reg acc]) ; ---- ; Plot a line from location (x1,y1) to locations (x2,y2) in color ; ---- lib2_gfx_line.5: ; Bresenham line drawing algorithm stx _line_color cmpw <_cx,<_bp ; make y always ascending by swapping bhs .l1 ; co-ordinates ; jump over swap if _bp > _cx stw <_bp,_line_curry ; swap coordinates stw <_cx,<_bp stw <_si,_line_currx stw <_bx,<_si bra .l2 .l1: stw <_bx,_line_currx stw <_cx,_line_curry ; now: ; line_currx and line_curry are start point ; <_si and <_bp are end point ; <_bx and <_cx are 'dont care' .l2: lda LOW_BYTE <_bp sub LOW_BYTE _line_curry sta LOW_BYTE _line_deltay lda HIGH_BYTE <_bp sbc HIGH_BYTE _line_curry sta HIGH_BYTE _line_deltay lda LOW_BYTE <_si sub LOW_BYTE _line_currx sta LOW_BYTE _line_deltax lda HIGH_BYTE <_si sbc HIGH_BYTE _line_currx sta HIGH_BYTE _line_deltax stz _line_xdir ; 0 = positive lda HIGH_BYTE _line_deltax bpl .l3 lda #1 sta _line_xdir ; 1 = negative negw _line_deltax ; now: ; line_deltay is difference from end to start (positive) ; line_deltax is difference from end to start (positive) ; line_xdir shows whether to apply deltax positive or negative .l3: cmpw _line_deltax,_line_deltay lbhs .ybiglp ; jump if deltay > |deltax| .xbiglp: __ldw _line_deltay __aslw __stw _line_adjust __stw _line_error subw _line_deltax,_line_adjust subw _line_deltax,_line_adjust subw _line_deltax,_line_error incw _line_deltax ; used as counter - get both endpoints .xlp1: stw _line_currx,<_bx ; draw pixel stw _line_curry,<_cx ldx _line_color cla jsr lib2_gfx_plot.3 decw _line_deltax ; dec counter tstw _line_deltax lbeq .out lda _line_xdir ; adjust currx beq .xlppos decw _line_currx bra .xlp2 .xlppos: incw _line_currx .xlp2: lda HIGH_BYTE _line_error bmi .xlp3 addw _line_adjust,_line_error incw _line_curry bra .xlp1 .xlp3: addw _line_deltay,_line_error addw _line_deltay,_line_error jmp .xlp1 .ybiglp: __ldw _line_deltax __aslw __stw _line_adjust __stw _line_error subw _line_deltay,_line_adjust subw _line_deltay,_line_adjust subw _line_deltay,_line_error incw _line_deltay ; used as counter - get both endpoints .ylp1: stw _line_currx,<_bx ; draw pixel stw _line_curry,<_cx ldx _line_color cla jsr lib2_gfx_plot.3 decw _line_deltay ; dec counter tstw _line_deltay beq .out incw _line_curry lda HIGH_BYTE _line_error bmi .ylp2 addw _line_adjust,_line_error lda _line_xdir beq .ylppos decw _line_currx bra .ylp1 .ylppos: incw _line_currx bra .ylp1 .ylp2: addw _line_deltax,_line_error addw _line_deltax,_line_error jmp .ylp1 .out: rts ; gfx_plot(int x [bx], int y [cx], char color [reg acc]) ; ---- ; Plot a point at location (x,y) in color ; ---- lib2_gfx_plot.3: stx <_dl ; color jsr gfx_getaddr ; same as vm_rawread - save 21 cycles by inlining ; vreg #1 ; video read register stw <_cx,video_data ; VRAM address vreg #2 ; set R/W memory mode __ldw video_data ; ; end inline ldy <_al ; bit offset bbr1 <_dl,.l1 ora gfx_bittbl,Y ; set bit bra .l1a .l1: and gfx_bittbl2,Y ; else mask bit .l1a: sax bbr0 <_dl,.l2 ora gfx_bittbl,Y ; set bit bra .l2a .l2: and gfx_bittbl2,Y ; else mask bit .l2a: ; same as vm_rawwrite - save >14 cycles by inlining ; phx tax vreg #0 ; video write register stw <_cx,video_data ; VRAM address vreg #2 ; set R/W memory mode pla __stw video_data ; write ; ; end inline addw #8,<_cx ; other half of pixel ; same as vm_rawread - save 21 cycles by inlining ; vreg #1 ; video read register stw <_cx,video_data ; VRAM address vreg #2 ; set R/W memory mode __ldw video_data ; ; end inline ldy <_al ; bit offset bbr3 <_dl,.l3 ora gfx_bittbl,Y ; set bit bra .l3a .l3: and gfx_bittbl2,Y ; else mask bit .l3a: sax bbr2 <_dl,.l4 ora gfx_bittbl,Y ; set bit bra .l4a .l4: and gfx_bittbl2,Y ; mask bit .l4a: ; same as vm_rawwrite - save >14 cycles by inlining ; phx tax vreg #0 ; video write register stw <_cx,video_data ; VRAM address vreg #2 ; set R/W memory mode pla __stw video_data ; write ; ; end inline rts ; gfx_point(int x [bx], int y [cx]) ; ---- ; Returns color of point at location (x,y) ; ---- lib2_gfx_point.2: jsr gfx_getaddr stz <_ah ; will be color __ldw <_cx ; VRAM address jsr readvram ldy <_al ; bit offset and gfx_bittbl,Y beq .l1 smb1 <_ah .l1: txa and gfx_bittbl,Y beq .l2 smb0 <_ah .l2: addw #8,<_cx __ldw <_cx ; VRAM address part 2 jsr readvram ldy <_al and gfx_bittbl,Y beq .l3 smb3 <_ah .l3: txa and gfx_bittbl,Y beq .l4 smb2 <_ah .l4: ldx <_ah cla rts gfx_bittbl: .db $80,$40,$20,$10,$08,$04,$02,$01 gfx_bittbl2: .db $7f,$bf,$df,$ef,$f7,$fb,$fd,$fe ; gfx_getaddr ; ---- ; Utility routine to switch x/y pixel ; co-ordinates into VRAM addr and bit # ; ---- gfx_getaddr: lda <_cl and #7 sta <_al ; al = lines from tile base lda <_bl and #7 pha ; = bit offset __ldw <_bx __lsrw ; should be only 2 bits in MSB are possible __lsrw ; but we'll shift 3 times anyway __lsrw phx ; X = character column __ldw <_cx __lsrw ; should be only 2 bits in MSB are possible __lsrw ; but we'll shift 3 times anyway __lsrw txa ; A = character row plx jsr calc_vram_addr __ldw <_di ; to get BAT addr jsr readvram ; read BAT value __aslw ; change into VRAM tile addr __aslw __aslw __aslw ; cx = VRAM addr start of tile sax clc ; add row within tile adc <_al sax adc #0 __stw <_cx pla sta <_al ; al = bit offset rts ; Change back to original LIB1_BANK context .bank LIB1_BANK
libsrc/target/x1/x1/asm_load_pcg.asm
Frodevan/z88dk
640
167134
SECTION code_clib PUBLIC asm_load_charset PUBLIC asm_load_pcg EXTERN __x1_mode EXTERN asm_z80_delay_tstate ; Load a series of characters - only works in mode0 ; Entry: hl = bitmap to load from ; c = starting character ; b = number of characters asm_load_charset: push bc push bc ld e,c ld d,$20 xor a ld bc,$33e0 loop: out (c),e res 4,b out (c),d set 4,b inc bc dec a jr nz,loop pop bc ld c,0 call asm_load_pcg pop bc inc c djnz asm_load_charset ret ; Load monochrome character into PCG data ; - we set the colour to white so the attributes define the colour ; ; Entry: hl = data to load ; c = pcg character to load asm_load_pcg: ld b,$15 ;PCG memory is $1500 -> $17ff push hl call load_plane pop hl inc b ;red plane push hl call load_plane pop hl inc b ;green plane call load_plane ret load_plane: di push bc ld e,8 exx ld bc, 0x1A01 ;wait for start of VBLANK _vbl1: in a, (c) jp p, _vbl1 _vbl2: in a, (c) jp m, _vbl2 exx load_pcg_1: ld a,(hl) ; 7 out (c),a IF 0 nop inc hl inc bc ld a,$0e loop_2: dec a jp nz,loop_2 dec e jp nz,load_pcg_1 ELSE ; We need to delay 250 - 22 - 10 - 4 - 4 - 7 -6 cycles exx ;4 ld hl,197 ;10 call asm_z80_delay_tstate ;taken care by callee exx ;4 inc hl ;6 inc bc dec e ;4 jp nz,load_pcg_1 ;12 ENDIF pop bc ei ret
source/interfaces/i-cstrin.ads
ytomino/drake
33
30473
pragma License (Unrestricted); with Interfaces.C.Char_Pointers; with Interfaces.C.Generic_Strings; package Interfaces.C.Strings is new Generic_Strings ( Character_Type => Character, String_Type => String, Element => char, Element_Array => char_array, Pointers => Char_Pointers, To_C => To_char_array, To_Ada => To_String); pragma Preelaborate (Interfaces.C.Strings);
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-pers-e.asm
prismotizm/gigaleak
0
3704
<gh_stars>0 Name: kart-pers-e.asm Type: file Size: 15102 Last-Modified: '1992-08-06T07:17:24Z' SHA-1: 67E883330CF810A74FBB9A463FCBD4D5052C44E2 Description: null
extern/gnat_sdl/gnat_sdl2/src/umingw_h.ads
AdaCore/training_material
15
28076
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Extensions; package umingw_h is USE_u_u_UUIDOF : constant := 0; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:79 WINVER : constant := 16#0502#; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:225 -- unsupported macro: UNALIGNED __unaligned --* -- * This file has no copyright assigned and is placed in the Public Domain. -- * This file is part of the mingw-w64 runtime package. -- * No warranty is given; refer to the file DISCLAIMER.PD within this package. -- -- Include _cygwin.h if we're building a Cygwin application. -- Target specific macro replacement for type "long". In the Windows API, -- the type long is always 32 bit, even if the target is 64 bit (LLP64). -- On 64 bit Cygwin, the type long is 64 bit (LP64). So, to get the right -- sized definitions and declarations, all usage of type long in the Windows -- headers have to be replaced by the below defined macro __LONG32. -- C/C++ specific language defines. -- Note the extern. This is needed to work around GCC's --limitations in handling dllimport attribute. -- Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's -- variadiac macro facility, because variadic macros cause syntax -- errors with --traditional-cpp. -- High byte is the major version, low byte is the minor. -- other headers depend on this include -- We have to define _DLL for gcc based mingw version. This define is set -- by VC, when DLL-based runtime is used. So, gcc based runtime just have -- DLL-base runtime, therefore this define has to be set. -- As our headers are possibly used by windows compiler having a static -- C-runtime, we make this definition gnu compiler specific here. subtype ssize_t is Long_Long_Integer; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:387 subtype intptr_t is Long_Long_Integer; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:399 subtype uintptr_t is Extensions.unsigned_long_long; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:412 subtype wint_t is unsigned_short; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:443 subtype wctype_t is unsigned_short; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:444 subtype errno_t is int; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:463 subtype uu_time32_t is long; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:468 subtype uu_time64_t is Long_Long_Integer; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:473 subtype time_t is uu_time64_t; -- d:\install\gpl2018\x86_64-pc-mingw32\include\_mingw.h:481 -- MSVC defines _NATIVE_NULLPTR_SUPPORTED when nullptr is supported. We emulate it here for GCC. -- We are activating __USE_MINGW_ANSI_STDIO for various define indicators. -- Note that we enable it also for _GNU_SOURCE in C++, but not for C case. -- Enable __USE_MINGW_ANSI_STDIO if _POSIX defined -- * and If user did _not_ specify it explicitly... -- _dowildcard is an int that controls the globbing of the command line. -- * The MinGW32 (mingw.org) runtime calls it _CRT_glob, so we are adding -- * a compatibility definition here: you can use either of _CRT_glob or -- * _dowildcard . -- * If _dowildcard is non-zero, the command line will be globbed: *.* -- * will be expanded to be all files in the startup directory. -- * In the mingw-w64 library a _dowildcard variable is defined as being -- * 0, therefore command line globbing is DISABLED by default. To turn it -- * on and to leave wildcard command line processing MS's globbing code, -- * include a line in one of your source modules defining _dowildcard and -- * setting it to -1, like so: -- * int _dowildcard = -1; -- -- Macros for __uuidof template-based emulation -- skipped func __debugbreak -- mingw-w64 specific functions: -- skipped func __mingw_get_crt_info end umingw_h;
cmd/command/cparse.asm
minblock/msdos
0
87700
page ,132 ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ; SCCSID = @(#)cparse.asm 1.1 85/05/14 ; SCCSID = @(#)cparse.asm 1.1 85/05/14 INCLUDE comsw.asm .xlist .xcref INCLUDE DOSSYM.INC INCLUDE DEVSYM.INC INCLUDE comseg.asm INCLUDE comequ.asm .list .cref TRANDATA SEGMENT PUBLIC BYTE ;AC000; EXTRN BADCD_PTR:WORD ;AC022; EXTRN BADCPMES_ptr:word ;AC000; TRANDATA ENDS TRANSPACE SEGMENT PUBLIC BYTE ;AC000; EXTRN comma:byte EXTRN cpyflag:byte EXTRN CURDRV:BYTE EXTRN ELCNT:BYTE EXTRN ELPOS:BYTE EXTRN EXPAND_STAR:BYTE EXTRN SKPDEL:BYTE EXTRN STARTEL:WORD EXTRN SWITCHAR:BYTE EXTRN switch_list:byte EXTRN TPA:WORD TRANSPACE ENDS TRANCODE SEGMENT PUBLIC BYTE ASSUME CS:TRANGROUP,DS:TRANGROUP,ES:TRANGROUP,SS:NOTHING EXTRN CERROR:NEAR PUBLIC BADCDERR ;AC022; PUBLIC CPARSE SWCOUNT EQU 6 ; Must agree with length of switch_list ;-----------------------------------------------------------------------; ; ENTRY: ; ; DS:SI Points input buffer ; ; ES:DI Points to the token buffer ; ; BL Special delimiter for this call ; ; Always checked last ; ; set it to space if there is no special delimiter ; ; EXIT: ; ; DS:SI Points to next char in the input buffer ; ; ES:DI Points to the token buffer ; ; [STARTEL] Points to start of last element of path in token ; ; points to a NUL for no element strings 'd:' 'd:/' ; ; CX Character count ; ; BH Condition Code ; ; Bit 1H of BH set if switch character ; ; Token buffer contains char after ; ; switch character ; ; BP has switch bits set (ORing only) ; ; Bit 2H of BH set if ? or * in token ; ; if * found element ? filled ; ; Bit 4H of BH set if path sep in token ; ; Bit 80H of BH set if the special delimiter ; ; was skipped at the start of this token ; ; Token buffer always starts d: for non switch tokens ; ; CARRY SET ; ; if CR on input ; ; token buffer not altered ; ; ; ; DOES NOT RETURN ON BAD PATH, OR TRAILING SWITCH CHAR ERROR ; ; MODIFIES: ; ; CX, SI, AX, BH, DX and the Carry Flag ; ; ; ; ; -----------------------------------------------------------------------; ;--------------- ; Modifications to cparse: recognition of right and left parentheses ; as integral tokens, and removal of automatic upper-case conversion code. ; ; Both modifications were installed in the course of adding a coherent ; command-line parser to COMMAND.COM which builds a UNIX-style argv[]/argc ; structure for command-line arguments. This parser relies on cparse to ; recognize individual tokens. ; ; To process for-loops correctly, parentheses must therefore be ; recognized as tokens. The upper-case conversion code was removed so ; that commands (such as for and echo) would be able to use the "original" ; text of the command line. ; ; Note also the modification to prevent the automatic conversion of colons ; into spaces WITHIN THE SOURCE TEXT! ; ; Also note that BP is also clobbered if cparse recognizes any switches ; on the command line. ; ; <NAME>, OS/MSDOS 14 August 1983 ;--------------- CPARSE: ASSUME DS:TRANGROUP,ES:TRANGROUP xor ax,ax mov [STARTEL],DI ; No path element (Is DI correct?) mov [ELPOS],al ; Start in 8 char prefix mov [SKPDEL],al ; No skip delimiter yet mov bh,al ; Init nothing pushf ; save flags push di ; save the token buffer addrss xor cx,cx ; no chars in token buffer mov comma,cl ;g reset comma flag moredelim: LODSB INVOKE DELIM JNZ SCANCDONE CMP AL,' ' JZ moredelim CMP AL,9 JZ moredelim xchg al,[SKPDEL] or al,al jz moredelim ; One non space/tab delimiter allowed test bh,080h ;g has a special char been found? jz no_comma ;g no - just exit mov comma,1 ;g set comma flag no_comma: JMP x_done ; Nul argument SCANCDONE: ;;;; IFNDEF DBCS 3/3/KK ;--------------- ; Mod to avoid upper-case conversion. ; cmp cpyflag,1 3/3/KK ; jnz cpcont1 3/3/KK ; invoke UPCONV 3/3/KK cpcont1: ;--------------- ;;;; ENDIF 3/3/KK cmp al,bl ; Special delimiter? jnz nospec or bh,80H jmp short moredelim nospec: cmp al,0DH ; a CR? jne ncperror jmp cperror ncperror: cmp al,[SWITCHAR] ; is the char the switch char? jne na_switch ; yes, process... jmp a_switch na_switch: mov dl,':' cmp byte ptr [si],dl jne anum_chard ; Drive not specified ;;;; IFDEF DBCS 3/3/KK ;--------------- ; Mod to avoid upper-case conversion. cmp cpyflag,1 jnz cpcont2 invoke UPCONV cpcont2: ;--------------- ;;;; ENDIF 3/3/KK call move_char lodsb ; Get the ':' call move_char mov [STARTEL],di mov [ELCNT],0 jmp anum_test anum_chard: mov [STARTEL],di mov [ELCNT],0 ; Store of this char sets it to one cmp cpyflag,1 ; Was CPARSE called from COPY? jnz anum_char ; No, don't add drive spec. invoke PATHCHRCMP ; Starts with a pathchar? jnz anum_char ; no push ax mov al,[CURDRV] ; Insert drive spec add al,capital_A call move_char mov al,':' call move_char pop ax mov [STARTEL],di mov [ELCNT],0 anum_char: ;;;; IFDEF DBCS 3/3/KK invoke TESTKANJ jz NOTKANJ ;AC048; call move_char lodsb jmp short notspecial NOTKANJ: ;AN048; If not kanji cmp cpyflag,1 ;AN048; and if we're in COPY jnz testdot ;AN048; invoke upconv ;AN048; upper case the char TESTDOT: ;;;; ENDIF 3/3/KK cmp al,dot_chr jnz testquest inc [ELPOS] ; flag in extension mov [ELCNT],0FFH ; Store of the '.' resets it to 0 testquest: cmp al,'?' jnz testsplat or bh,2 testsplat: cmp al,star jnz testpath or bh,2 cmp byte ptr [expand_star],0 jnz expand_filename jmp SHORT testpath badperr2j: jmp short badperr2 expand_filename: mov ah,7 cmp [ELPOS],0 jz gotelcnt mov ah,2 gotelcnt: mov al,'?' sub ah,[ELCNT] jc badperr2j xchg ah,cl jcxz testpathx qmove: xchg ah,cl call move_char xchg ah,cl loop qmove testpathx: xchg ah,cl testpath: invoke PATHCHRCMP jnz notspecial or bh,4 cmp byte ptr [expand_star],0 jz no_err_check test bh,2 ; If just hit a '/', cannot have ? or * yet jnz badperr no_err_check: mov [STARTEL],di ; New element INC [STARTEL] ; Point to char after / mov [ELCNT],0FFH ; Store of '/' sets it to 0 mov [ELPOS],0 notspecial: call move_char ; just an alphanum string anum_test: lodsb ;;;; IFNDEF DBCS 3/3/KK ;--------------- ; Mod to avoid upper-case conversion. ; cmp cpyflag,1 3/3/KK ; jnz cpcont3 3/3/KK ; invoke UPCONV 3/3/KK cpcont3: ;--------------- ;;;; ENDIF 3/3/KK INVOKE DELIM je x_done cmp al,0DH je x_done cmp al,[SWITCHAR] je x_done cmp al,bl je x_done cmp al,':' ; ':' allowed as trailer because ; of devices ;;;; IFDEF DBCS 3/3/KK je FOO15 jmp anum_char FOO15: ;;; ELSE 3/3/KK ;;; jne anum_charj 3/3/KK ;;; ENDIF 3/3/KK ;--------------- ; Modification made for parseline. ; Why would it be necessary to change colons to spaces? In this ; case, EVERY colon is changed to a space; e.g., 'f:' yields 'f ', ; but so does 'echo foo:bar' yield 'echo foo bar'. ;--------------- cmp cpyflag,2 ; Is CPARSE parsing the 1st token from ; from PARSELINE? jnz cpcont4 ; No, continue call move_char ; Yes, save the ':' and go get another jmp anum_test ; character. cpcont4: inc si ;Skip the ':' jmp short x_done anum_charj: jmp anum_char badperr2: mov dx,offset trangroup:BADCPMES_ptr jmp CERROR badperr: BADCDERR: ;AC022; Issue "Invalid Directory" MOV DX,OFFSET TRANGROUP:BADCD_ptr ;AC022; message JMP CERROR ;AC022; cperror: dec si ; adjust the pointer pop di ; retrive token buffer address popf ; restore flags stc ; set the carry bit return x_done: dec si ; adjust for next round ;--------------- ; Mod to recognize right and left parens as integral tokens. x_done2: ;--------------- jmp short out_token a_switch: OR BH,1 ; Indicate switch OR BP,fSwitch INVOKE SCANOFF INC SI invoke testkanj ;AN057; See if DBCS lead byte jz a_switch_notkanj ;AN057; no - continue processing call move_char ;AN057; DBCS - store first byte lodsb ;AN057; get second byte call move_char ;AN057; store second byte or bp,fBadSwitch ;AN057; DBCS switch is invalid jmp short out_token ;AN057; don't bother checking switch a_switch_notkanj: ;AN057; cmp al,0DH jne Store_swt mov al,0 stosb ; null at the end OR BP,fBadSwitch jmp cperror ; Trailing switch character error ; BP = fSwitch but no switch ; bit is set (unknown switch) Store_swt: call move_char ; store the character ; ;--------------- ; This upconv call must stay. It is used to identify copy-switches ; on the command line, and won't store anything into the output buffer. invoke UPCONV ;--------------- ; PUSH ES PUSH DI PUSH CX PUSH CS POP ES ASSUME ES:TRANGROUP MOV DI,OFFSET TRANGROUP:switch_list MOV CX,SWCOUNT OR BP,fBadSwitch REPNE SCASB JNZ out_tokenp AND BP,NOT fBadSwitch MOV AX,1 SHL AX,CL OR BP,AX out_tokenp: POP CX POP DI POP ES ASSUME ES:NOTHING out_token: mov al,0 stosb ; null at the end pop di ; restore token buffer pointer popf clc ; clear carry flag return move_char: stosb ; store char in token buffer inc cx ; increment char count inc [ELCNT] ; increment element count for * substi return TRANCODE ENDS END 
programs/oeis/128/A128960.asm
neoneye/loda
22
15707
; A128960: a(n) = (n^3 - n)*2^n. ; 0,24,192,960,3840,13440,43008,129024,368640,1013760,2703360,7028736,17891328,44728320,110100480,267386880,641728512,1524105216,3586129920,8367636480,19377684480,44568674304,101871255552,231525580800,523449139200,1177760563200,2638183661568,5885178937344,13078175416320,28958816993280,63909113364480,140600049401856,308413011591168,674653462855680,1471971191685120,3203702005432320,6956610068938752,15072655149367296,32589524647280640,70324763712552960,151468721842421760,325657751961206784,698972735916736512,1497798719821578240,3204592609850818560,6846175121044930560,14605173591562518528,31115369825502756864,66202914522346291200,140681193359985868800,298588655294663884800,633007949224687435776,1340487421887573393408,2835646469377559101440,5992309520194087157760,12650431209298628444160,26680909459611652718592,56220487789895982514176,118358921662938910556160,248961869704802535997440,523241895650771431587840,1098807980866620006334464,2305695435261104275587072,4834522686837799287521280,10129476105755388983377920,21208590596425345683947520,44374897247905338661797888,92783876063802071747395584,193876755954213284248289280,404860284492621858283192320,844925811115036921634488320,1762273834611362722266218496,3673472218626502575991554048,7653067122138547033315737600,15935153459795330809095782400,33162346389303796548658790400,68977680489751896821210284032,143400967333957890759884537856,297976036018613798981578260480,618873305577120967115585617920,1284749647020858716543747358720,2665855517568281836828275769344,5529181814215695661569757151232,11462937907520344664229984337920,23754521928837340749970569953280,49205795424020205839224752046080,101884941113265367384747721883648,210878133932107388307966215061504,436299587445739424085447341506560,902346874035506536176720638115840,1865526121601496659061984240599040,3855420651309759762061434097238016,7965044862046536651291753959129088,16449549171617847432015578828636160,33960359580114265666096678872023040,70088401686618803608752720225239040,144603439269234584287531928043651072,298244593492796330093034601590030336,614937306170714082666050724927897600 add $0,2 mov $2,2 pow $2,$0 bin $0,3 mul $0,$2 div $0,8 mul $0,24
functions.agda
heades/AUGL
0
4728
<gh_stars>0 module functions where open import level open import eq open import product {- Note that the Agda standard library has an interesting generalization of the following basic composition operator, with more dependent typing. -} _∘_ : ∀{ℓ ℓ' ℓ''}{A : Set ℓ}{B : Set ℓ'}{C : Set ℓ''} → (B → C) → (A → B) → (A → C) f ∘ g = λ x → f (g x) ∘-assoc : ∀{ℓ ℓ' ℓ'' ℓ'''}{A : Set ℓ}{B : Set ℓ'}{C : Set ℓ''}{D : Set ℓ'''} (f : C → D)(g : B → C)(h : A → B) → (f ∘ g) ∘ h ≡ f ∘ (g ∘ h) ∘-assoc f g h = refl id : ∀{ℓ}{A : Set ℓ} → A → A id x = x ∘-id : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}(f : A → B) → f ∘ id ≡ f ∘-id f = refl id-∘ : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}(f : A → B) → id ∘ f ≡ f id-∘ f = refl extensionality : {ℓ₁ ℓ₂ : Level} → Set (lsuc ℓ₁ ⊔ lsuc ℓ₂) extensionality {ℓ₁}{ℓ₂} = ∀{A : Set ℓ₁}{B : Set ℓ₂}{f g : A → B} → (∀{a : A} → f a ≡ g a) → f ≡ g record Iso {ℓ₁ ℓ₂ : Level} (A : Set ℓ₁) (B : Set ℓ₂) : Set (ℓ₁ ⊔ ℓ₂) where constructor isIso field l-inv : A → B r-inv : B → A l-cancel : r-inv ∘ l-inv ≡ id r-cancel : l-inv ∘ r-inv ≡ id curry : ∀{ℓ₁ ℓ₂ ℓ₃}{A : Set ℓ₁}{B : Set ℓ₂}{C : Set ℓ₃} → ((A × B) → C) → (A → B → C) curry f x y = f (x , y) uncurry : ∀{ℓ₁ ℓ₂ ℓ₃}{A : Set ℓ₁}{B : Set ℓ₂}{C : Set ℓ₃} → (A → B → C) → ((A × B) → C) uncurry f (x , y) = f x y compose-cong : ∀{ℓ}{A : Set ℓ}{B : Set ℓ}{C : Set ℓ}{f f' : A → B}{g g' : B → C} → f ≡ f' → g ≡ g' → g ∘ f ≡ g' ∘ f' compose-cong refl refl = refl
onnxruntime/core/mlas/lib/arm64/QgemmS8S8KernelNeon.asm
lchang20/onnxruntime
669
29469
<reponame>lchang20/onnxruntime /*++ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. Module Name: QgemmS8S8KernelNeon.asm Abstract: This module implements the kernels for the quantized integer matrix/matrix multiply operation (QGEMM). --*/ #include "kxarm64.h" // // Stack frame layout for the S8S8 kernel. // #define GemmS8S8KernelFrame_SavedNeonRegisters (8 * 8) #define GemmS8S8KernelFrame_SavedRegisters GemmS8S8KernelFrame_SavedNeonRegisters #define GemmS8S8KernelFrame_ColumnSumBuffer 0 + GemmS8S8KernelFrame_SavedRegisters #define GemmS8S8KernelFrame_ZeroPointB 8 + GemmS8S8KernelFrame_SavedRegisters #define GemmS8S8KernelFrame_ZeroMode 16 + GemmS8S8KernelFrame_SavedRegisters TEXTAREA /*++ Routine Description: This routine is an inner kernel to compute matrix multiplication for a set of rows. Arguments: A (x0) - Supplies the address of matrix A. The matrix data has been packed using MlasGemmQuantCopyPackA<MLAS_GEMM_X8S8_KERNEL_NEON>. B (x1) - Supplies the address of matrix B. The matrix data has been packed using MlasGemmQuantCopyPackB<MLAS_GEMM_X8S8_KERNEL_NEON>. C (x2) - Supplies the address of matrix C. PackedCountK (x3) - Supplies the number of packed columns from matrix A and the number of packed rows from matrix B to iterate over. CountM (x4) - Supplies the maximum number of rows that can be processed for matrix A and matrix C. The actual number of rows handled for this invocation depends on the kernel implementation. CountN (x5) - Supplies the number of columns from matrix B and matrix C to iterate over. ldc (x6) - Supplies the first dimension of matrix C. RowSumBuffer (x7) - Supplies the sum of each row from matrix A. These values have been pre-scaled by the zero point offset of matrix B if the offset is per-tensor (ZeroPointB is nullptr). Otherwise, these values must be scaled by the per-column zero point offsets of matrix B. These values are accumulated into every row of matrix C. ColumnSumBuffer - Supplies the sum of each column from matrix B multiplied by the zero point offset of matrix A. These values are accumulated into every column of matrix C. ZeroPointB - Optionally supplies the per-column zero point offsets of matrix B, else nullptr if the matrix B is using per-tensor quantization. ZeroMode - Supplies true if the output matrix must be zero initialized, else false if the output matrix is accumulated into. Return Value: Returns the number of rows handled. --*/ NESTED_ENTRY MlasGemmS8S8KernelNeon PROLOG_SAVE_REG_PAIR d8,d9,#-64! PROLOG_SAVE_REG_PAIR d10,d11,#16 PROLOG_SAVE_REG_PAIR d12,d13,#32 PROLOG_SAVE_REG_PAIR d14,d15,#48 ldr x8,[sp,#GemmS8S8KernelFrame_ColumnSumBuffer] ldr x9,[sp,#GemmS8S8KernelFrame_ZeroPointB] ldrb w13,[sp,#GemmS8S8KernelFrame_ZeroMode] mov x14,x0 mov x15,x3 cmp x4,#1 // CountM == 1? beq GemmS8S8_M1_ProcessLoop cmp x4,#4 // CountM < 4? blo GemmS8S8_M2_ProcessLoop // // Process 4 rows of the matrices. // // B 16x4 // /--------------------------------------\ // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v8.b[0] v9.b[0] v10.b[0] v11.b[0]| // | ... ... ... ... | // |v8.b[7] v9.b[7] v10.b[7] v11.b[7]| // A 4x16 \--------------------------------------/ // /---------------------------------\ /--------------------------------------\ // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v20.4s v21.4s v22.4s v23.4s | // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v24.4s v25.4s v26.4s v27.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v28.4s v29.4s v30.4s v31.4s | // \---------------------------------/ \--------------------------------------/ // // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) GemmS8S8_M4_ProcessNextColumnLoop mov x0,x14 // reload matrix A mov x3,x15 // reload PackedCountK ldp d0,d2,[x0],#64 // A0 movi v16.4s,#0 movi v17.4s,#0 ldp d4,d8,[x1],#64 // B movi v18.4s,#0 movi v19.4s,#0 ldp d5,d9,[x1,#-48] movi v20.4s,#0 movi v21.4s,#0 ldp d6,d10,[x1,#-32] movi v22.4s,#0 movi v23.4s,#0 ldp d7,d11,[x1,#-16] movi v24.4s,#0 movi v25.4s,#0 ldp d1,d3,[x0,#-48] movi v26.4s,#0 movi v27.4s,#0 movi v28.4s,#0 movi v29.4s,#0 movi v30.4s,#0 movi v31.4s,#0 GemmS8S8_M4_ComputeBlockLoop smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ldp d0,d2,[x0,#-32] sadalp v16.4s,v12.8h sadalp v17.4s,v13.8h sadalp v18.4s,v14.8h sadalp v19.4s,v15.8h sub x3,x3,#1 smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b smlal v13.8h,v3.8b,v9.8b smlal v14.8h,v3.8b,v10.8b smlal v15.8h,v3.8b,v11.8b ldp d1,d3,[x0,#-16] sadalp v20.4s,v12.8h sadalp v21.4s,v13.8h sadalp v22.4s,v14.8h sadalp v23.4s,v15.8h cbz x3,GemmS8S8_M4_ComputeBlockLoopFinish smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ldp d0,d2,[x0],#64 sadalp v24.4s,v12.8h sadalp v25.4s,v13.8h sadalp v26.4s,v14.8h sadalp v27.4s,v15.8h smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b ldp d4,d8,[x1],#64 // B smlal v13.8h,v3.8b,v9.8b ldp d5,d9,[x1,#-48] smlal v14.8h,v3.8b,v10.8b ldp d6,d10,[x1,#-32] smlal v15.8h,v3.8b,v11.8b ldp d7,d11,[x1,#-16] sadalp v28.4s,v12.8h ldp d1,d3,[x0,#-48] sadalp v29.4s,v13.8h sadalp v30.4s,v14.8h sadalp v31.4s,v15.8h b GemmS8S8_M4_ComputeBlockLoop GemmS8S8_M4_ComputeBlockLoopFinish smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b ld1 {v0.4s},[x7] smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ld1 {v2.4s},[x8],#16 // load ColumnSumBuffer[0] sadalp v24.4s,v12.8h sadalp v25.4s,v13.8h sadalp v26.4s,v14.8h sadalp v27.4s,v15.8h smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b smlal v13.8h,v3.8b,v9.8b smlal v14.8h,v3.8b,v10.8b smlal v15.8h,v3.8b,v11.8b sadalp v28.4s,v12.8h sadalp v29.4s,v13.8h sadalp v30.4s,v14.8h sadalp v31.4s,v15.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v20.4s,v20.4s,v21.4s addp v22.4s,v22.4s,v23.4s addp v24.4s,v24.4s,v25.4s addp v26.4s,v26.4s,v27.4s addp v28.4s,v28.4s,v29.4s addp v30.4s,v30.4s,v31.4s addp v16.4s,v16.4s,v18.4s addp v20.4s,v20.4s,v22.4s addp v24.4s,v24.4s,v26.4s addp v28.4s,v28.4s,v30.4s dup v8.4s,v0.s[0] // broadcast row fixups dup v9.4s,v0.s[1] dup v10.4s,v0.s[2] dup v11.4s,v0.s[3] cbz x9,GemmS8S8_M4_SkipScaleByZeroPointB // accumulator = zero point B * row sum A + column sum B ld1 {v30.4s},[x9],#16 // load ZeroPointB mul v17.4s,v30.4s,v8.4s mul v21.4s,v30.4s,v9.4s mul v25.4s,v30.4s,v10.4s mul v29.4s,v30.4s,v11.4s add v16.4s,v16.4s,v17.4s add v20.4s,v20.4s,v21.4s add v24.4s,v24.4s,v25.4s add v28.4s,v28.4s,v29.4s add v16.4s,v16.4s,v2.4s add v20.4s,v20.4s,v2.4s add v24.4s,v24.4s,v2.4s add v28.4s,v28.4s,v2.4s b GemmS8S8_M4_StoreOutput GemmS8S8_M4_SkipScaleByZeroPointB // accumulator = row sum A + column sum B add v16.4s,v16.4s,v8.4s add v20.4s,v20.4s,v9.4s add v24.4s,v24.4s,v10.4s add v28.4s,v28.4s,v11.4s add v16.4s,v16.4s,v2.4s add v20.4s,v20.4s,v2.4s add v24.4s,v24.4s,v2.4s add v28.4s,v28.4s,v2.4s GemmS8S8_M4_StoreOutput add x10,x2,x6,lsl #2 add x11,x10,x6,lsl #2 add x12,x11,x6,lsl #2 subs x5,x5,#4 // adjust CountN remaining blo GemmS8S8_M4_StoreOutputPartial cbnz x13,GemmS8S8_M4_SkipAccumulateOutput ld1 {v0.4s},[x2] ld1 {v1.4s},[x10] ld1 {v2.4s},[x11] ld1 {v3.4s},[x12] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v1.4s add v24.4s,v24.4s,v2.4s add v28.4s,v28.4s,v3.4s GemmS8S8_M4_SkipAccumulateOutput st1 {v16.4s},[x2],#16 st1 {v20.4s},[x10] st1 {v24.4s},[x11] st1 {v28.4s},[x12] cbnz x5,GemmS8S8_M4_ProcessNextColumnLoop GemmS8S8_M4_ExitKernel mov x0,#4 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN GemmS8S8_M4_StoreOutputPartial cbz x13,GemmS8S8_M4_StoreOutputPartial_AddMode GemmS8S8_M4_StoreOutputPartial_ZeroMode tbz x5,#1,GemmS8S8_M4_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] st1 {v24.2s},[x11],#8 dup v24.4s,v24.s[2] st1 {v28.2s},[x12],#8 dup v28.4s,v28.s[2] GemmS8S8_M4_StoreOutputPartial1_ZeroMode tbz x5,#0,GemmS8S8_M4_ExitKernel st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] st1 {v24.s}[0],[x11] st1 {v28.s}[0],[x12] b GemmS8S8_M4_ExitKernel GemmS8S8_M4_StoreOutputPartial_AddMode tbz x5,#1,GemmS8S8_M4_StoreOutputPartial1_AddMode ld1 {v0.2s},[x2] ld1 {v1.2s},[x10] ld1 {v2.2s},[x11] ld1 {v3.2s},[x12] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v1.4s st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] add v24.4s,v24.4s,v2.4s add v28.4s,v28.4s,v3.4s st1 {v24.2s},[x11],#8 dup v24.4s,v24.s[2] st1 {v28.2s},[x12],#8 dup v28.4s,v28.s[2] GemmS8S8_M4_StoreOutputPartial1_AddMode tbz x5,#0,GemmS8S8_M4_ExitKernel ld1 {v0.s}[0],[x2] ld1 {v1.s}[0],[x10] add v16.4s,v16.4s,v0.4s ld1 {v2.s}[0],[x11] add v20.4s,v20.4s,v1.4s ld1 {v3.s}[0],[x12] add v24.4s,v24.4s,v2.4s st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] add v28.4s,v28.4s,v3.4s st1 {v24.s}[0],[x11] st1 {v28.s}[0],[x12] b GemmS8S8_M4_ExitKernel // // Process 2 rows of the matrices. // // Column Sum v2.s[0] v2.s[4] // Each row sum replicated to all 4 elements of a vector register // v30 v31 // B 16x4 // /--------------------------------------\ // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v24.b[0] v25.b[0] v26.b[0] v27.b[0]| // | ... ... ... ... | // |v24.b[7] v25.b[7] v26.b[7] v27.b[7]| // A 2x16 \--------------------------------------/ // /---------------------------------\ /--------------------------------------\ // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v20.4s v21.4s v22.4s v23.4s | // \---------------------------------/ \--------------------------------------/ // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) // GemmS8S8_M2_ProcessLoop GemmS8S8_M2_ProcessNextColumnLoop ldp d4,d24,[x1],#16 // B mov x0,x14 // reload matrix A mov x3,x15 // reload PackedCountK ldp d0,d2,[x0],#16 // A0 movi v16.4s,#0 movi v17.4s,#0 ldp d5,d25,[x1],#16 movi v18.4s,#0 movi v19.4s,#0 ldp d6,d26,[x1],#16 movi v20.4s,#0 movi v21.4s,#0 ldp d7,d27,[x1],#16 movi v22.4s,#0 movi v23.4s,#0 ldp d1,d3,[x0],#16 // A1 GemmS8S8_M2_ComputeBlockLoop sub x3,x3,#1 smull v28.8h,v0.8b,v4.8b smull v29.8h,v0.8b,v5.8b smull v30.8h,v0.8b,v6.8b smull v31.8h,v0.8b,v7.8b cbz x3,GemmS8S8_M2_ComputeBlockLoopFinish smlal v28.8h,v2.8b,v24.8b smlal v29.8h,v2.8b,v25.8b smlal v30.8h,v2.8b,v26.8b smlal v31.8h,v2.8b,v27.8b ldp d0,d2,[x0],#16 // A0 sadalp v16.4s,v28.8h sadalp v17.4s,v29.8h sadalp v18.4s,v30.8h sadalp v19.4s,v31.8h smull v28.8h,v1.8b,v4.8b smull v29.8h,v1.8b,v5.8b smull v30.8h,v1.8b,v6.8b smull v31.8h,v1.8b,v7.8b smlal v28.8h,v3.8b,v24.8b ldp d4,d24,[x1],#16 // B smlal v29.8h,v3.8b,v25.8b ldp d5,d25,[x1],#16 smlal v30.8h,v3.8b,v26.8b ldp d6,d26,[x1],#16 smlal v31.8h,v3.8b,v27.8b ldp d7,d27,[x1],#16 sadalp v20.4s,v28.8h ldp d1,d3,[x0],#16 // A1 sadalp v21.4s,v29.8h sadalp v22.4s,v30.8h sadalp v23.4s,v31.8h b GemmS8S8_M2_ComputeBlockLoop GemmS8S8_M2_ComputeBlockLoopFinish ld1 {v0.4s},[x8],#16 // load ColumnSumBuffer[0] smlal v28.8h,v2.8b,v24.8b smlal v29.8h,v2.8b,v25.8b smlal v30.8h,v2.8b,v26.8b smlal v31.8h,v2.8b,v27.8b ldr d2,[x7] // load row sums sadalp v16.4s,v28.8h sadalp v17.4s,v29.8h sadalp v18.4s,v30.8h sadalp v19.4s,v31.8h smull v28.8h,v1.8b,v4.8b smull v29.8h,v1.8b,v5.8b smull v30.8h,v1.8b,v6.8b smull v31.8h,v1.8b,v7.8b smlal v28.8h,v3.8b,v24.8b smlal v29.8h,v3.8b,v25.8b smlal v30.8h,v3.8b,v26.8b smlal v31.8h,v3.8b,v27.8b sadalp v20.4s,v28.8h sadalp v21.4s,v29.8h sadalp v22.4s,v30.8h sadalp v23.4s,v31.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v20.4s,v20.4s,v21.4s addp v22.4s,v22.4s,v23.4s dup v30.4s,v2.s[0] // broadcast row fixups dup v31.4s,v2.s[1] // broadcast row fixups addp v16.4s,v16.4s,v18.4s addp v20.4s,v20.4s,v22.4s cbz x9,GemmS8S8_M2_SkipScaleByZeroPointB // accumulator = zero point B * row sum A + column sum B ld1 {v18.4s},[x9],#16 // load ZeroPointB[0] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v0.4s mul v17.4s,v18.4s,v30.4s mul v21.4s,v18.4s,v31.4s add v16.4s,v16.4s,v17.4s add v20.4s,v20.4s,v21.4s b GemmS8S8_M2_StoreOutput GemmS8S8_M2_SkipScaleByZeroPointB // accumulator = row sum A + column sum B add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v0.4s add v16.4s,v16.4s,v30.4s add v20.4s,v20.4s,v31.4s GemmS8S8_M2_StoreOutput add x10,x2,x6,lsl #2 subs x5,x5,#4 // adjust CountN remaining blo GemmS8S8_M2_StoreOutputPartial cbnz x13,GemmS8S8_M2_SkipAccumulateOutput ld1 {v0.4s},[x2] ld1 {v1.4s},[x10] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v1.4s GemmS8S8_M2_SkipAccumulateOutput st1 {v16.4s},[x2],#16 st1 {v20.4s},[x10] cbnz x5,GemmS8S8_M2_ProcessNextColumnLoop GemmS8S8_M2_ExitKernel mov x0,#2 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN GemmS8S8_M2_StoreOutputPartial cbz x13,GemmS8S8_M2_StoreOutputPartial_AddMode GemmS8S8_M2_StoreOutputPartial_ZeroMode tbz x5,#1,GemmS8S8_M2_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] GemmS8S8_M2_StoreOutputPartial1_ZeroMode tbz x5,#0,GemmS8S8_M2_ExitKernel st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] b GemmS8S8_M2_ExitKernel GemmS8S8_M2_StoreOutputPartial_AddMode tbz x5,#1,GemmS8S8_M2_StoreOutputPartial1_AddMode ld1 {v0.2s},[x2] ld1 {v1.2s},[x10] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v1.4s st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] GemmS8S8_M2_StoreOutputPartial1_AddMode tbz x5,#0,GemmS8S8_M2_ExitKernel ld1 {v0.s}[0],[x2] ld1 {v1.s}[0],[x10] add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v1.4s st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] b GemmS8S8_M2_ExitKernel // // Process 1 row of the matrices. // // Column Sum v2.s[0] v2.s[4] // row sum replicated to all 4 elements of a vector register // v31 // B 16x4 // /--------------------------------------\ // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v24.b[0] v25.b[0] v26.b[0] v27.b[0]| // | ... ... ... ... | // |v24.b[7] v25.b[7] v26.b[7] v27.b[7]| // A 1x16 \--------------------------------------/ // /---------------------------------\ /--------------------------------------\ // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // \---------------------------------/ \--------------------------------------/ // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) // GemmS8S8_M1_ProcessLoop ldr d31,[x7] dup v31.4s,v31.s[0] // broadcast row fixups GemmS8S8_M1_ProcessNextColumnLoop ldp d4,d24,[x1],#16 // B ldp d5,d25,[x1],#16 ldp d6,d26,[x1],#16 ldp d7,d27,[x1],#16 mov x0,x14 // reload matrix A mov x3,x15 // reload PackedCountK ldp d0,d2,[x0],#16 // A0 movi v16.4s,#0 movi v17.4s,#0 movi v18.4s,#0 movi v19.4s,#0 GemmS8S8_M1_ComputeBlockLoop sub x3,x3,#1 smull v20.8h,v0.8b,v4.8b smull v21.8h,v0.8b,v5.8b cbz x3,GemmS8S8_M1_ComputeBlockLoopFinish smull v22.8h,v0.8b,v6.8b smull v23.8h,v0.8b,v7.8b smlal v20.8h,v2.8b,v24.8b ldp d4,d24,[x1],#16 // B smlal v21.8h,v2.8b,v25.8b ldp d5,d25,[x1],#16 smlal v22.8h,v2.8b,v26.8b ldp d6,d26,[x1],#16 smlal v23.8h,v2.8b,v27.8b ldp d0,d2,[x0],#16 // A0 sadalp v16.4s,v20.8h sadalp v17.4s,v21.8h ldp d7,d27,[x1],#16 sadalp v18.4s,v22.8h sadalp v19.4s,v23.8h b GemmS8S8_M1_ComputeBlockLoop GemmS8S8_M1_ComputeBlockLoopFinish ld1 {v4.4s},[x8],#16 // load ColumnSumBuffer[0] smull v22.8h,v0.8b,v6.8b smull v23.8h,v0.8b,v7.8b smlal v20.8h,v2.8b,v24.8b smlal v21.8h,v2.8b,v25.8b smlal v22.8h,v2.8b,v26.8b smlal v23.8h,v2.8b,v27.8b sadalp v16.4s,v20.8h sadalp v17.4s,v21.8h sadalp v18.4s,v22.8h sadalp v19.4s,v23.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v16.4s,v16.4s,v18.4s cbz x9,GemmS8S8_M1_SkipScaleByZeroPointB // accumulator = zero point B * row sum A + column sum B ld1 {v30.4s},[x9],#16 // load ZeroPointB[0] mul v17.4s,v30.4s,v31.4s add v16.4s,v16.4s,v17.4s add v16.4s,v16.4s,v4.4s b GemmS8S8_M1_StoreOutput GemmS8S8_M1_SkipScaleByZeroPointB // accumulator = row sum A + column sum B add v16.4s,v16.4s,v31.4s add v16.4s,v16.4s,v4.4s GemmS8S8_M1_StoreOutput subs x5,x5,#4 // adjust CountN remaining blo GemmS8S8_M1_StoreOutputPartial cbnz x13,GemmS8S8_M1_SkipAccumulateOutput ld1 {v0.4s},[x2] add v16.4s,v16.4s,v0.4s GemmS8S8_M1_SkipAccumulateOutput st1 {v16.4s},[x2],#16 cbnz x5,GemmS8S8_M1_ProcessNextColumnLoop GemmS8S8_M1_ExitKernel mov x0,#1 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN GemmS8S8_M1_StoreOutputPartial cbz x13,GemmS8S8_M1_StoreOutputPartial_AddMode GemmS8S8_M1_StoreOutputPartial_ZeroMode: tbz x5,#1,GemmS8S8_M1_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down GemmS8S8_M1_StoreOutputPartial1_ZeroMode tbz x5,#0,GemmS8S8_M1_ExitKernel st1 {v16.s}[0],[x2] b GemmS8S8_M1_ExitKernel GemmS8S8_M1_StoreOutputPartial_AddMode tbz x5,#1,GemmS8S8_M1_StoreOutputPartial1_AddMode ld1 {v0.2s},[x2] add v16.4s,v16.4s,v0.4s st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down GemmS8S8_M1_StoreOutputPartial1_AddMode tbz x5,#0,GemmS8S8_M1_ExitKernel ld1 {v0.s}[0],[x2] add v16.4s,v16.4s,v0.4s st1 {v16.s}[0],[x2] b GemmS8S8_M1_ExitKernel NESTED_END MlasGemmS8S8KernelNeon END
scheduling-execute_image.adb
annexi-strayline/AURA
13
20450
<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. -- -- -- ------------------------------------------------------------------------------ -- This is the POSIX (execve) implementation with Interfaces.C.Strings; separate (Scheduling) procedure Execute_Image is use Interfaces.C; use Interfaces.C.Strings; Image_Path: constant String := UBS.To_String (Parameters.Executable); path : constant char_array := To_C (Image_Path); arg_1: aliased char_array := To_C (Ada.Directories.Simple_Name (Image_Path)); argv : constant chars_ptr_array := (0 => To_Chars_Ptr (arg_1'Unchecked_Access), 1 => Null_Ptr); environ: access constant chars_ptr_array with Convention => C, Import => True, External_Name => "environ"; -- environ(7) function execve (path: char_array; argv, envp: chars_ptr_array) return int with Convention => C, Import => True, External_Name => "execve"; -- execve(2) Discard: int; begin UI.Put_Info_Tag; Put_Line (" Running compiled program . . ."); New_Line; UI.Put_Divider; Discard := execve (path => To_C (Image_Path), argv => argv, envp => environ.all); -- execve only returns if it failed pragma Assert (Discard = -1); raise Process_Failed with "execve failed for image at path: " & Image_Path; end Execute_Image;
core/lib/groups/HomotopyGroup.agda
cmknapp/HoTT-Agda
0
16754
<reponame>cmknapp/HoTT-Agda<gh_stars>0 {-# OPTIONS --without-K #-} open import lib.Basics open import lib.NType2 open import lib.types.Nat open import lib.types.TLevel open import lib.types.Empty open import lib.types.Pi open import lib.types.Sigma open import lib.types.Truncation open import lib.types.Pointed open import lib.types.Group open import lib.types.LoopSpace open import lib.groups.TruncationGroup open import lib.groups.GroupProduct open import lib.groups.Homomorphisms open import lib.groups.Unit module lib.groups.HomotopyGroup where {- Higher homotopy groups -} module _ {i} where πS : (n : ℕ) (X : Ptd i) → Group i πS n X = Trunc-group (Ω^S-group-structure n X) fundamental-group : (X : Ptd i) → Group i fundamental-group X = πS 0 X {- π_(n+1) of a space is π_n of its loop space -} abstract πS-inner-iso : ∀ {i} (n : ℕ) (X : Ptd i) → πS (S n) X == πS n (⊙Ω X) πS-inner-iso n X = group-ua (record { f = Trunc-fmap (Ω^-inner-out (S n) X); pres-comp = Trunc-elim (λ _ → Π-level (λ _ → =-preserves-level _ Trunc-level)) (λ p → Trunc-elim (λ _ → =-preserves-level _ Trunc-level) (λ q → ap [_] (Ω^S-inner-out-conc^S n X p q)))} , is-equiv-Trunc 0 (Ω^-inner-out (S n) X) (Ω^-inner-is-equiv (S n) X)) {- We can shift the truncation inside the loop in the definition of π -} module _ {i} where private record Ω^STs-PreIso (m : ℕ₋₂) (n : ℕ) (k : ℕ₋₂) (X : Ptd i) : Type i where field F : fst (⊙Ω^ (S n) (⊙Trunc k X) ⊙→ ⊙Trunc m (⊙Ω^ (S n) X)) pres-comp : ∀ (p q : Ω^ (S n) (⊙Trunc k X)) → fst F (conc^S n p q) == Trunc-fmap2 (conc^S n) (fst F p) (fst F q) e : is-equiv (fst F) Ω^S-Trunc-shift-preiso : (n : ℕ) (m : ℕ₋₂) (X : Ptd i) → Ω^STs-PreIso m n (⟨ S n ⟩₋₂ +2+ m) X Ω^S-Trunc-shift-preiso O m X = record { F = (–> (Trunc=-equiv [ snd X ] [ snd X ]) , idp); pres-comp = Trunc=-∙-comm; e = snd (Trunc=-equiv [ snd X ] [ snd X ]) } Ω^S-Trunc-shift-preiso (S n) m X = let r : Ω^STs-PreIso (S m) n (⟨ S n ⟩₋₂ +2+ S m) X r = Ω^S-Trunc-shift-preiso n (S m) X H = (–> (Trunc=-equiv [ idp^ (S n) ] [ idp^ (S n) ]) , idp) G = ap^ 1 (Ω^STs-PreIso.F r) in transport (λ k → Ω^STs-PreIso m (S n) k X) (+2+-βr ⟨ S n ⟩₋₂ m) (record { F = H ⊙∘ G; pres-comp = λ p q → ap (fst H) (ap^S-conc^S 0 (Ω^STs-PreIso.F r) p q) ∙ (Trunc=-∙-comm (fst G p) (fst G q)); e = snd (Trunc=-equiv [ idp^ (S n) ] [ idp^ (S n) ] ∘e equiv-ap^ 1 (Ω^STs-PreIso.F r) (Ω^STs-PreIso.e r))}) πS-Trunc-shift-iso : (n : ℕ) (X : Ptd i) → Ω^S-group n (⊙Trunc ⟨ S n ⟩ X) Trunc-level == πS n X πS-Trunc-shift-iso n X = group-ua (group-hom (fst F) pres-comp , e) where n-eq : ∀ (n : ℕ) → ⟨ n ⟩₋₂ +2+ 0 == ⟨ n ⟩ n-eq O = idp n-eq (S n) = ap S (n-eq n) r = transport (λ k → Ω^STs-PreIso 0 n k X) (n-eq (S n)) (Ω^S-Trunc-shift-preiso n 0 X) open Ω^STs-PreIso r abstract πS-below-trunc : ∀ {i} (n : ℕ) (m : ℕ₋₂) (X : Ptd i) → (⟨ S n ⟩ ≤T m) → πS n (⊙Trunc m X) == πS n X πS-below-trunc n m X lte = πS n (⊙Trunc m X) =⟨ ! (πS-Trunc-shift-iso n (⊙Trunc m X)) ⟩ Ω^S-group n (⊙Trunc ⟨ S n ⟩ (⊙Trunc m X)) Trunc-level =⟨ lemma ⟩ Ω^S-group n (⊙Trunc ⟨ S n ⟩ X) Trunc-level =⟨ πS-Trunc-shift-iso n X ⟩ πS n X ∎ where lemma : Ω^S-group n (⊙Trunc ⟨ S n ⟩ (⊙Trunc m X)) Trunc-level == Ω^S-group n (⊙Trunc ⟨ S n ⟩ X) Trunc-level lemma = ap (uncurry $ Ω^S-group n) $ pair= (⊙ua (⊙≃-in (fuse-Trunc (fst X) ⟨ S n ⟩ m) idp) ∙ ap (λ k → ⊙Trunc k X) (minT-out-l lte)) (prop-has-all-paths-↓ has-level-is-prop) πS-above-trunc : ∀ {i} (n : ℕ) (m : ℕ₋₂) (X : Ptd i) → (m <T ⟨ S n ⟩) → πS n (⊙Trunc m X) == 0ᴳ πS-above-trunc n m X lt = πS n (⊙Trunc m X) =⟨ ! (πS-Trunc-shift-iso n (⊙Trunc m X)) ⟩ Ω^S-group n (⊙Trunc ⟨ S n ⟩ (⊙Trunc m X)) Trunc-level =⟨ contr-is-0ᴳ _ $ inhab-prop-is-contr (Group.ident (Ω^S-group n (⊙Trunc ⟨ S n ⟩ (⊙Trunc m X)) Trunc-level)) (Ω^-level-in -1 (S n) _ $ Trunc-preserves-level ⟨ S n ⟩ $ raise-level-≤T (transport (λ k → m ≤T k) (+2+-comm -1 ⟨ S n ⟩₋₂) (<T-to-≤T lt)) (Trunc-level {n = m})) ⟩ 0ᴳ ∎ πS-above-level : ∀ {i} (n : ℕ) (m : ℕ₋₂) (X : Ptd i) → (m <T ⟨ S n ⟩) → has-level m (fst X) → πS n X == 0ᴳ πS-above-level n m X lt pX = ap (πS n) (! (⊙ua (⊙≃-in (unTrunc-equiv _ pX) idp))) ∙ πS-above-trunc n m X lt {- πₙ(X × Y) == πₙ(X) × πₙ(Y) -} module _ {i j} (n : ℕ) (X : Ptd i) (Y : Ptd j) where πS-× : πS n (X ⊙× Y) == πS n X ×ᴳ πS n Y πS-× = group-ua (Trunc-group-iso f pres-comp (is-eq f g f-g g-f)) ∙ Trunc-group-× _ _ where f : Ω^ (S n) (X ⊙× Y) → Ω^ (S n) X × Ω^ (S n) Y f r = (fst (ap^ (S n) ⊙fst) r , fst (ap^ (S n) ⊙snd) r) g : Ω^ (S n) X × Ω^ (S n) Y → Ω^ (S n) (X ⊙× Y) g = fst (ap2^ (S n) (⊙idf _)) f-g : (s : Ω^ (S n) X × Ω^ (S n) Y) → f (g s) == s f-g (p , q) = pair×= (app= (ap fst (ap^-ap2^ (S n) ⊙fst (⊙idf _) ∙ ap2^-fst (S n))) (p , q)) (app= (ap fst (ap^-ap2^ (S n) ⊙snd (⊙idf _) ∙ ap2^-snd (S n))) (p , q)) g-f : (r : Ω^ (S n) (X ⊙× Y)) → g (f r) == r g-f = app= $ ap fst $ ap (λ h → h ⊙∘ ⊙diag) (ap2^-ap^ (S n) (⊙idf _) ⊙fst ⊙snd) ∙ ap2^-diag (S n) (⊙idf _ ⊙∘ pair⊙→ ⊙fst ⊙snd) ∙ ap^-idf (S n) pres-comp : (p q : Ω^ (S n) (X ⊙× Y)) → f (conc^S n p q) == (conc^S n (fst (f p)) (fst (f q)) , conc^S n (snd (f p)) (snd (f q))) pres-comp p q = pair×= (ap^S-conc^S n ⊙fst p q) (ap^S-conc^S n ⊙snd p q) module _ {i j} (n : ℕ) {X : Ptd i} {Y : Ptd j} (f : fst (X ⊙→ Y)) where πS-fmap : πS n X →ᴳ πS n Y πS-fmap = Trunc-group-hom (fst (ap^ (S n) f)) (ap^S-conc^S n f)
programs/oeis/275/A275202.asm
neoneye/loda
22
93424
; A275202: Subword complexity (number of distinct blocks of length n) of the period doubling sequence A096268. ; 2,3,5,6,8,10,11,12,14,16,18,20,21,22,23,24,26,28,30,32,34,36,38,40,41,42,43,44,45,46,47,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,161,162,163,164 mov $1,$0 seq $1,6165 ; a(1) = a(2) = 1; thereafter a(2n+1) = a(n+1) + a(n), a(2n) = 2a(n). add $0,$1 add $0,1
tests/music/main.adb
Fabien-Chouteau/ASFML
0
14509
<filename>tests/music/main.adb with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Sf.System.Sleep; use Sf, Sf.System, Sf.System.Sleep; with Sf.System.Time; use Sf.System.Time; with Sf.Audio.Music; use Sf.Audio, Sf.Audio.Music; with Sf.Audio.SoundStatus; use Sf.Audio.SoundStatus; with Ada.Command_Line; procedure Main is Music : sfMusic_Ptr; Duration : sfTime; ChCount : sfUint32; SampRate : sfUint32; begin Music := createFromFile (Ada.Command_Line.Argument (1)); if Music = null then Put_Line ("Music file not found!"); return; end if; setLoop (Music, sfFalse); setPitch (Music, 1.0); setVolume (Music, 100.0); Duration := getDuration (Music); ChCount := getChannelCount (Music); SampRate := getSampleRate (Music); Put ("Duration : "); Put (Integer (asMilliseconds (Duration))); Put (" milliseconds"); New_Line; Put ("Channels count : "); Put (Integer (ChCount), 0); Put (" channels"); New_Line; Put ("Sample rate : "); Put (Integer (SampRate), 0); Put (" channels/second"); New_Line; play (Music); Put ("Playing... "); while getStatus (Music) = sfPlaying loop -- Display the playing position Put (Integer (asMilliseconds (getPlayingOffset(Music)))); Put (" "); delay 0.1; end loop; destroy (Music); end Main;
oeis/141/A141620.asm
neoneye/loda-programs
11
26866
; A141620: First differences of A120070. ; Submitted by <NAME> ; 5,-3,10,-3,-5,17,-3,-5,-7,26,-3,-5,-7,-9,37,-3,-5,-7,-9,-11,50,-3,-5,-7,-9,-11,-13,65,-3,-5,-7,-9,-11,-13,-15,82,-3,-5,-7,-9,-11,-13,-15,-17,101,-3,-5,-7,-9,-11,-13,-15,-17,-19,122,-3,-5,-7,-9,-11,-13,-15,-17,-19,-21 mov $3,2 mov $4,$0 lpb $3 mov $0,$4 div $3,2 add $0,$3 seq $0,120070 ; Triangle of numbers used to compute the frequencies of the spectral lines of the hydrogen atom. mov $2,$3 mul $2,$0 add $1,$2 mov $5,$0 lpe sub $1,$5 mov $0,$1
alloy4fun_models/trashltl/models/13/6vw72bG6JCNhxeDcR.als
Kaixi26/org.alloytools.alloy
0
2297
<gh_stars>0 open main pred id6vw72bG6JCNhxeDcR_prop14 { always (Protected in Trash implies Protected' not in Trash') } pred __repair { id6vw72bG6JCNhxeDcR_prop14 } check __repair { id6vw72bG6JCNhxeDcR_prop14 <=> prop14o }
exercises/08-chameleons.als
xbreu/formal-methods
0
5147
<filename>exercises/08-chameleons.als /// Model of a community of chameleons, where there's a fixed number of /// chameleons, but their colours can change according to the following rules: /// - The possible colours are: green, blue and yellow; /// - If two chameleons with different colours meet, both change to the other /// colour; /// - The colours can only change in the event above. // ---------------------------------------------------------------------------- // Definitions // ---------------------------------------------------------------------------- sig Chameleon { var colour : one Colour } abstract sig Colour {} one sig Green, Blue, Yellow extends Colour {} // ---------------------------------------------------------------------------- // Properties // ---------------------------------------------------------------------------- // If the chameleons all have the same color, they will never change again. assert Stability { always ( one (Chameleon . colour) => always colour' = colour ) } // If initially there is one green chameleon and no blue one, then, it is not // possible for the community to be all yellow. assert NoConvergence { one (colour . Green) and no (colour . Blue) => always Chameleon . colour != Yellow } check Stability for 5 check NoConvergence for 5 // ---------------------------------------------------------------------------- // Operations // ---------------------------------------------------------------------------- pred nop { colour' = colour } pred encounter[x, y : Chameleon] { // Guards x.colour != y.colour // Effects x.colour' = Colour - x.colour - y.colour y.colour' = x.colour' // Frame conditions all c : Chameleon - x - y | c.colour' = c.colour } fact Behaviour { always ( nop or some x, y : Chameleon | encounter[x, y] ) } // ---------------------------------------------------------------------------- // Scenarios // ---------------------------------------------------------------------------- fun GreenChameleon : set Chameleon { colour . Green } fun BlueChameleon : set Chameleon { colour . Blue } fun YellowChameleon : set Chameleon { colour . Yellow } // A scenario where there is a chameleon that does not stop changing color, // repeatedly taking on all of the possible colors. run Example { some c : Chameleon | all x : Colour | always eventually c.colour in x }
gcc-gcc-7_3_0-release/gcc/ada/s-linux-alpha.ads
best08618/asylo
7
27544
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . L I N U X -- -- -- -- S p e c -- -- -- -- Copyright (C) 2009-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- ------------------------------------------------------------------------------ -- This is the alpha version of this package -- This package encapsulates cpu specific differences between implementations -- of GNU/Linux, in order to share s-osinte-linux.ads. -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Interfaces.C; package System.Linux is pragma Preelaborate; ---------- -- Time -- ---------- subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; subtype time_t is Interfaces.C.long; subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; tv_nsec : long; end record; pragma Convention (C, timespec); type timeval is record tv_sec : time_t; tv_usec : suseconds_t; end record; pragma Convention (C, timeval); ----------- -- Errno -- ----------- EAGAIN : constant := 35; EINTR : constant := 4; EINVAL : constant := 22; ENOMEM : constant := 12; EPERM : constant := 1; ETIMEDOUT : constant := 60; ------------- -- Signals -- ------------- SIGHUP : constant := 1; -- hangup SIGINT : constant := 2; -- interrupt (rubout) SIGQUIT : constant := 3; -- quit (ASCD FS) SIGILL : constant := 4; -- illegal instruction (not reset) SIGTRAP : constant := 5; -- trace trap (not reset) SIGIOT : constant := 6; -- IOT instruction SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future SIGFPE : constant := 8; -- floating point exception SIGKILL : constant := 9; -- kill (cannot be caught or ignored) SIGBUS : constant := 10; -- bus error SIGSEGV : constant := 11; -- segmentation violation SIGPIPE : constant := 13; -- write on a pipe with no one to read it SIGALRM : constant := 14; -- alarm clock SIGTERM : constant := 15; -- software termination signal from kill SIGURG : constant := 16; -- urgent condition on IO channel SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) SIGTSTP : constant := 18; -- user stop requested from tty SIGCONT : constant := 19; -- stopped process has been continued SIGCLD : constant := 20; -- alias for SIGCHLD SIGCHLD : constant := 20; -- child status change SIGTTIN : constant := 21; -- background tty read attempted SIGTTOU : constant := 22; -- background tty write attempted SIGIO : constant := 23; -- I/O now possible (4.2 BSD) SIGPOLL : constant := 23; -- pollable event occurred SIGXCPU : constant := 24; -- CPU time limit exceeded SIGXFSZ : constant := 25; -- filesize limit exceeded SIGVTALRM : constant := 26; -- virtual timer expired SIGPROF : constant := 27; -- profiling timer expired SIGWINCH : constant := 28; -- window size change SIGPWR : constant := 29; -- power-fail restart SIGUSR1 : constant := 30; -- user defined signal 1 SIGUSR2 : constant := 31; -- user defined signal 2 SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal SIGADAABORT : constant := SIGABRT; -- Change this if you want to use another signal for task abort. -- SIGTERM might be a good one. SIGUNUSED : constant := 0; SIGSTKFLT : constant := 0; SIGLOST : constant := 0; -- These don't exist for Linux/Alpha. The constants are present -- so that we can continue to use a-intnam-linux.ads. -- struct_sigaction offsets sa_handler_pos : constant := 0; sa_mask_pos : constant := Standard'Address_Size / 8; sa_flags_pos : constant := 128 + sa_mask_pos; SA_SIGINFO : constant := 16#40#; SA_ONSTACK : constant := 16#01#; end System.Linux;
ga_lib/src/e3ga.ads
rogermc2/GA_Ada
3
12673
<gh_stars>1-10 with GL.Types; with GA_Maths; use GA_Maths; with Multivectors; use Multivectors; package E3GA is type Array_19F is array (1 .. 19) of float; -- subtype M_Vector is GA_Maths.Coords_Continuous_Array (1 .. 3); -- m_c[3] coordinate storage subtype E3_Vector is GL.Types.Singles.Vector3; -- m_c[3] coordinate storage -- types type G2_Type is (MVT_None, MVT_E1_T, MVT_E2_T, MVT_E3_T, MVT_Scalar, MVT_Vector_2D, MVT_Vector, MVT_Bivector, MVT_Trivector, MVT_Rotor, MVT_E1_CT, MVT_E2_CT, MVT_E3_CT, MVT_I3_CT, MVT_I3I_CT, MVT_MV, MVT_Last); -- Outermorphism types type OM_Type is (OMT_None, OMT_OM, OMT_Last); -- type Rotor_Coordinates_Type is (Rotor_Scalar_e1e2_e2e3_e3e1); -- type Scalar is private; -- type Bivector is private; type Outermorphism is private; type Syn_SMultivector is private; -- type Rotor is private; -- type Trivector is private; -- M_Vector corresponds to e3ga.Vector coordinate storage float m_c[3] -- type M_Vector is private; type MV_Coordinate_Array is new GA_Maths.Coords_Continuous_Array (1 .. 8); -- type Multivector (Grade_Use : Grade_Usage) is record -- Coordinates : MV_Coordinate_Array := (others => 0.0); -- m_c[8] -- end record; -- Joinable grade definitions Grade_0 : constant integer := 1; Grade_1 : constant integer := 2; Grade_2 : constant integer := 4; Grade_3 : constant integer := 8; -- function "=" (V1, V2 : M_Vector) return Boolean; function "+" (V1, V2 : E3_Vector) return E3_Vector; function "-" (V : E3_Vector) return E3_Vector; -- function "-" (VL, VR : E3_Vector) return E3_Vector; function "*" (Weight : float; V : E3_Vector) return E3_Vector; -- function "*" (Weight : float; BV : Bivector) return Bivector; function "*" (R1, R2 : Rotor) return Rotor; -- function "*" (R : Rotor; V : M_Vector) return Rotor; -- function "*" (V : M_Vector; R : Rotor) return Rotor; function "/" (R : Rotor; S : float) return Rotor; -- function "+" (W : float; BV : BiVector) return Rotor; function "+" (W : float; R : Rotor) return Rotor; function "-" (W : float; R : Rotor) return Rotor; -- function e1 (V : E2GA.M_Vector) return float; -- function e2 (V : E2GA.M_Vector) return float; -- function e1 return M_Vector; -- function e2 return M_Vector; -- function e3 return M_Vector; function e1 return Multivectors.M_Vector; function e2 return Multivectors.M_Vector; function e3 return Multivectors.M_Vector; function e1 (MV : Multivector) return float; function e2 (MV : Multivector) return float; function e3 (MV : Multivector) return float; function e1_e2 (MV : Multivector) return float; function e1_e3 (MV : Multivector) return float; function e2_e3 (MV : Multivector) return float; function e3_e1 (MV : Multivector) return float; function e1_e2_e3 (MV : Multivector) return float; -- -- function e1e2 (R : Rotor) return float; -- function e2e3 (R : Rotor) return float; -- function e3e1 (R : Rotor) return float; -- function R_Scalar (R : Rotor) return float; -- function Apply_Outermorphism (OM : Outermorphism; BV : Bivector) return Bivector; -- function Apply_Outermorphism (OM : Outermorphism; V : M_Vector) return M_Vector; function Dot_Product (R1, R2 : Rotor) return float; -- function Dot_Product (V1, V2 : M_Vector) return float; -- function Get_Coord (S : Scalar) return float; -- function Get_Coords (BV : Bivector) return Array_3D; function Get_Coords (MV : Multivector) return MV_Coordinate_Array; function Get_Coords (R : Rotor) return Float_4D; -- function Get_Coord_1 (V : M_Vector) return float; -- function Get_Coord_2 (V : M_Vector) return float; -- function Get_Coord_3 (V : M_Vector) return float; function Get_Coords (Vec : Multivectors.M_Vector) return E3_Vector; -- function Get_Coords (SMV : Syn_SMultivector) return Array_4D; function Get_Outermorphism (OM : Outermorphism) return Array_19F; -- function Get_Size (MV : Multivector) return Integer; -- function Geometric_Product (BV : Bivector; R : Rotor) return Rotor; -- function Geometric_Product (R : Rotor; BV : Bivector) return Rotor; -- function Geometric_Product (V : M_Vector; R : Rotor) return Syn_SMultivector; -- function Geometric_Product (R : Rotor; MV : Syn_SMultivector) return Syn_SMultivector; -- function Geometric_Product (V : M_Vector; MV : Syn_SMultivector) return Rotor; -- function Geometric_Product (R : Rotor; V : M_Vector) return Syn_SMultivector; -- function Geometric_Product (R1, R2 : Rotor) return Rotor; -- function Geometric_Product (V1, V2 : M_Vector) return Rotor; -- function Grade_Use (BV : Bivector) return GA_Maths.Unsigned_32; -- function Grade_Use (MV : Multivector) return GA_Maths.Unsigned_32; -- function Inverse (aRotor : Rotor) return Rotor; -- function Inverse (V : M_Vector) return M_Vector; function Is_Zero (V : E3_Vector) return Boolean; -- function Left_Contraction (BV1, BV2 : Bivector) return Scalar; -- function Left_Contraction (MV1, MV2 : Multivector) return Multivector; -- function Left_Contraction (V : M_Vector; BV : Bivector) return M_Vector; -- function Left_Contraction (V1 : M_Vector; V2 : M_Vector) return Scalar; -- function Magnitude (V : M_Vector) return float; -- function MV_String (MV : Multivector; Text : String := "") -- return Ada.Strings.Unbounded.Unbounded_String; function Outer_Product (V1, V2 : E3_Vector) return E3_Vector; -- function Norm_E2 (BV : Bivector) return Scalar; -- function Norm_E2 (V : M_Vector) return Scalar; -- function Norm_E2 (MV : E2GA.Multivector) return Scalar; -- function Norm_E2 (R : Rotor) return Scalar; -- function Norm_E2 (TV : Trivector) return Scalar; -- procedure Set_Coords (V : out M_Vector; C1, C2, C3 : float); procedure Set_Coords (MV : out Multivector; C1, C2, C3 : float); -- function Scalar_Product (V1, V2 : M_Vector) return Scalar; -- procedure Set_Bivector (BV : out Bivector; C1, C2, C3 : float); -- procedure Set_Rotor (X : out Rotor; C_Scalar, C2, C3, C4 : float); -- procedure Set_Rotor (X : out Rotor; C_Scalar : float); -- procedure Set_Rotor (X : out Rotor; MV : Multivector); -- procedure Set_Rotor (X : out Rotor; BV : Bivector); -- procedure Set_Rotor (X : out Rotor; C_Scalar : float; BV : Bivector); -- procedure Set_Scalar (S : out Scalar; Value : float); -- function To_Unsigned (V : M_Vector) return Vector_Unsigned; -- function To_2D (V : M_Vector) return E2GA.M_Vector; -- function To_3D (V : E2GA.M_Vector) return M_Vector; -- function To_Vector (MV : Syn_SMultivector) return M_Vector; function To_MV_Vector (V : E3_Vector) return Multivectors.M_Vector; -- Unit_e normalizes rotor R -- function Unit_e (R : Rotor) return Rotor; -- Unit_e normalizes M_Vector X function Unit_E (X : E3_Vector) return E3_Vector; private -- M_Vector corresponds to e3ga.M_Vector coordinate storage float m_c[3] -- type M_Vector is record -- Coordinates : Vector_Coords_3D := (0.0, 0.0, 0.0); -- m_c[3] -- end record; -- -- type Bivector is record -- Grade_Use : Grade_Usage := 7; -- 2^2 + 2^1 +2^0 -- C1_e1e2 : float := 0.0; -- C2_e2e3 : float := 0.0; -- C3_e3e1 : float := 0.0; -- end record; type Outermorphism is new Array_19F; -- type Rotor is record -- -- Coords_Type : Rotor_Coordinates_Type := Rotor_Scalar_e1e2_e2e3_e3e1; -- C1_Scalar : float := 0.0; -- C2_e1e2 : float := 0.0; -- C3_e2e3 : float := 0.0; -- C4_e3e1 : float := 0.0; -- end record; type Syn_SMultivector is record C1_e1 : float := 0.0; C2_e2 : float := 0.0; C3_e3 : float := 0.0; C4_e1e2e3 : float := 0.0; end record; end E3GA;
Value.agda
kztk-m/sparcl-agda
0
8815
{-# OPTIONS --without-K #-} open import Level renaming (zero to lzero ; suc to lsuc) open import Syntax open import Data.List using (length ; [] ; _∷_ ) renaming ( _++_ to _++L_ ) open import Data.Vec using ([] ; _∷_ ) renaming ( _++_ to _++V_ ) open import Data.Vec.Relation.Unary.All using (All ; [] ; _∷_) open import Data.Nat open import Data.Product open import Function using () renaming (case_of_ to case*_of_) open import Size open import Relation.Binary.PropositionalEquality -- Sets indexed by invertible environments (that is, Θ and Ξ). This -- actually is our semantic domain. Dom : ∀ ℓ -> Set (lsuc ℓ) Dom ℓ = (Θ : TyEnv) -> (Ξ : MultEnv (length Θ)) -> Set ℓ -- A pairing operator, inspired by the Day convolution in category theory. data _⊛_ {ℓ : Level} (F : Dom ℓ) (G : Dom ℓ) (Θ : TyEnv) (Ξ : MultEnv (length Θ)) : Set ℓ where tup : ∀ Ξ₁ Ξ₂ -> (spΞ : Ξ₁ +ₘ Ξ₂ ≡ Ξ) -> (fst : F Θ Ξ₁) -> (snd : G Θ Ξ₂) -> (F ⊛ G) Θ Ξ -- mult is used for representing entries in value environments that are aware of multiplicities. data mult {ℓ : Level} (F : Dom ℓ) : (m : Multiplicity₀) -> Dom ℓ where -- An entry corresponds to multiplicity zero, i.e., nothing. mult-zero : ∀ {Θ Ξ} -> (eq : Ξ ≡ ∅) -> mult F zero Θ Ξ -- An entry corresponds to multiplicity one, a value must be used linearly. mult-one : ∀ {Θ Ξ} -> (v : F Θ Ξ) -> mult F one Θ Ξ -- An entry corresponds to multiplicity omega; such values must be indexed by the empty invertible environment. mult-omega : ∀ {Θ Ξ} -> (v : F Θ ∅) -> (eq : Ξ ≡ ∅) -> mult F omega Θ Ξ -- Values (Value), residuals (Residual) and value environments -- (ValEnv) are mutually defined. -- -- The sized types are used for termination checking with the presence -- of --without-K, which weakens termination analysis for -- with-abstractions that the original definitions used to have. data Value (Θ : TyEnv) : MultEnv (length Θ) -> Ty zero -> {i : Size} -> Set data Residual (Θ : TyEnv) : MultEnv (length Θ) -> Ty zero -> {i : Size} -> Set ValEnv : (Γ : TyEnv) -> (Δ : MultEnv (length Γ)) -> {i : Size} -> (Θ : TyEnv) -> MultEnv (length Θ) -> Set -- ValEnv Γ Δ : Dom 0 represents value environments conforms to Γ Δ. -- Intuitively, (Θ , Ξ) of ValEnv Γ Δ Θ Ξ represents typed resources contained in -- value environments. ValEnv [] Δ {i} = λ Θ Ξ -> Ξ ≡ ∅ ValEnv (A ∷ Γ) (m ∷ Δ) {i} = mult (V A) m ⊛ ValEnv Γ Δ {i} where V : Ty zero -> Dom 0ℓ V A Θ Ξ = Value Θ Ξ A {i} -- Values data Value Θ where clo : ∀ {Ξ Ξ' Γ' Δ' A B Ξₜ i} -> (m : Multiplicity) -> (spΞ : Ξ' +ₘ Ξₜ ≡ Ξ) -> (θ : ValEnv Γ' Δ' {i} Θ Ξ' ) -> (t : Term (A ∷ Γ') (M→M₀ m ∷ Δ') Θ Ξₜ B) -> Value Θ Ξ (A # m ~> B) {↑ i} unit : ∀ {Ξ i} -> (eq : ∅ ≡ Ξ) -> Value Θ Ξ tunit {↑ i} pair : ∀ {Ξ Ξ₁ Ξ₂ A B i} -> (spΞ : Ξ₁ +ₘ Ξ₂ ≡ Ξ) -> Value Θ Ξ₁ A {i} -> Value Θ Ξ₂ B {i} -> Value Θ Ξ (A ⊗ B) {↑ i} many : ∀ {Ξ Ξ₀ A i} -> (m : Multiplicity) -> (spΞ : m ×ₘ Ξ₀ ≡ Ξ) -> Value Θ Ξ₀ A {i} -> Value Θ Ξ (Many m A) {↑ i} inl : ∀ {Ξ} {A B i} -> Value Θ Ξ A {i} -> Value Θ Ξ (A ⊕ B) {↑ i} inr : ∀ {Ξ} {A B i} -> Value Θ Ξ B {i} -> Value Θ Ξ (A ⊕ B) {↑ i} roll : ∀ {Ξ F i} -> Value Θ Ξ (substTy F (μ F)) {i} -> Value Θ Ξ (μ F) {↑ i} inj : ∀ {Ξ A B i} -> (eq : ∅ ≡ Ξ) -> (r : Residual (A ∷ []) (one ∷ ∅) (B ●) {i}) -> Value Θ Ξ (A ↔ B) {↑ i} red : ∀ {Ξ A i} -> Residual Θ Ξ (A ●) {i} -> Value Θ Ξ (A ●) {↑ i} -- Residuals data Residual Θ where unit● : ∀ {i} -> Residual Θ ∅ (tunit ●) {↑ i} letunit● : ∀ {Ξ₀ Ξ A i} -> Residual Θ Ξ₀ (tunit ●) {i} -> Residual Θ Ξ (A ●) {i} -> Residual Θ (Ξ₀ +ₘ Ξ) (A ●) {↑ i} pair● : ∀ {Ξ₁ Ξ₂ A B i} -> Residual Θ Ξ₁ (A ●) {i} -> Residual Θ Ξ₂ (B ●) {i} -> Residual Θ (Ξ₁ +ₘ Ξ₂) ((A ⊗ B) ●) {↑ i} letpair● : ∀ {Ξ₀ Ξ A B C i} -> Residual Θ Ξ₀ ((A ⊗ B) ●) {i} -> Residual (A ∷ B ∷ Θ) (one ∷ one ∷ Ξ) (C ●) {i} -> Residual Θ (Ξ₀ +ₘ Ξ) (C ●) {↑ i} inl● : ∀ {Ξ} {A B} {i} -> Residual Θ Ξ (A ●) {i} -> Residual Θ Ξ ((A ⊕ B) ●) {↑ i} inr● : ∀ {Ξ} {A B} {i} -> Residual Θ Ξ (B ●) {i} -> Residual Θ Ξ ((A ⊕ B) ●) {↑ i} case● : ∀ {Ξ₀ Ξ Ξₑ Ξₜ Γ₁ Γ₂ Δ₁ Δ₂ A B C i} -> Residual Θ Ξ₀ ((A ⊕ B) ●) {i} -> (spΞ : Ξₑ +ₘ Ξₜ ≡ Ξ) -> (θ₁ : ValEnv Γ₁ Δ₁ {i} Θ Ξₑ) -> (t₁ : Term Γ₁ Δ₁ (A ∷ Θ) (one ∷ Ξₜ) (C ●)) -> (θ₂ : ValEnv Γ₂ Δ₂ {i} Θ Ξₑ) -> (t₂ : Term Γ₂ Δ₂ (B ∷ Θ) (one ∷ Ξₜ) (C ●)) -> (v : Value [] ∅ (C # omega ~> tbool) {i}) -> Residual Θ (Ξ₀ +ₘ Ξ) (C ●) {↑ i} var● : ∀ {Ξ A i} -> (x : Θ ∋ A) -> (ok : varOk● Θ x Ξ) -> Residual Θ Ξ (A ●) {↑ i} pin : ∀ {Ξ₁ Ξ₂ A B i} -> Residual Θ Ξ₁ (A ●) {i} -> (v : Value Θ Ξ₂ (A # omega ~> B ●) {i}) -> Residual Θ (Ξ₁ +ₘ Ξ₂) ((A ⊗ B) ●) {↑ i} open ≡-Reasoning -- A property on value environments that says discardable value environments cannot contain any resources. discardable-has-no-resources : ∀ {Γ Δ Θ Ξ} -> ValEnv Γ Δ Θ Ξ -> All discardable Δ -> Ξ ≡ ∅ discardable-has-no-resources {[]} {Δ} θ ad = θ discardable-has-no-resources {A ∷ Γ} {.omega ∷ Δ} (tup .∅ Ξ₂ spΞ (mult-omega v refl) snd) (omega ∷ ad) = begin _ ≡⟨ sym spΞ ⟩ ∅ +ₘ Ξ₂ ≡⟨ ∅-lid Ξ₂ ⟩ Ξ₂ ≡⟨ discardable-has-no-resources {Γ} {Δ} snd ad ⟩ ∅ ∎ discardable-has-no-resources {A ∷ Γ} {.zero ∷ Δ} (tup .∅ Ξ₂ spΞ (mult-zero refl) snd) (zero ∷ ad) = begin _ ≡⟨ sym spΞ ⟩ ∅ +ₘ Ξ₂ ≡⟨ ∅-lid Ξ₂ ⟩ Ξ₂ ≡⟨ discardable-has-no-resources {Γ} {Δ} snd ad ⟩ ∅ ∎ -- Looking up variables in an environment. Unlike the usual variable looking-up functions, this version -- takes varOk Γ x Δ instead of x to ensure that the variable can be looked up. Notice -- for example that we cannot look up variables with multiplicity zero. Also, the fact that the -- return type is Value Θ Ξ A means that the value environment cannot contain other resources. lookupVar : ∀ {Γ Δ Θ Ξ A} {x : Γ ∋ A} -> ValEnv Γ Δ Θ Ξ -> varOk Γ x Δ -> Value Θ Ξ A lookupVar (tup .(∅) Ξ₂ spΞ (mult-omega v refl) snd) (there omega ok) with (trans (sym (∅-lid _)) spΞ) ... | refl = lookupVar snd ok lookupVar (tup .∅ Ξ₂ spΞ (mult-zero refl) snd) (there zero ok) with (trans (sym (∅-lid _)) spΞ) ... | refl = lookupVar snd ok lookupVar {Γ = A ∷ Γ} {Δ = m ∷ Δ} (tup Ξ₁ Ξ₂ spΞ fst snd) (here u ad) with discardable-has-no-resources {Γ} {Δ} snd ad ... | refl with trans (sym (∅-rid _)) spΞ lookupVar {A ∷ Γ} {.omega ∷ Δ} (tup .∅ .∅ spΞ (mult-omega v refl) snd) (here omega ad) | refl | refl = v lookupVar {A ∷ Γ} {.one ∷ Δ} (tup Ξ₁ .∅ spΞ (mult-one v) snd) (here one ad) | refl | refl = v -- separateEnv separates value environments according to separation of -- (unidirectional) type environments. separateEnv : ∀ {Γ Θ Ξ} -> ∀ Δ₁ Δ₂ -> ValEnv Γ (Δ₁ +ₘ Δ₂) Θ Ξ -> (ValEnv Γ Δ₁ ⊛ ValEnv Γ Δ₂) Θ Ξ separateEnv {[]} Δ₁ Δ₂ refl = tup ∅ ∅ (∅-lid ∅) refl refl separateEnv {A ∷ Γ} (m₁ ∷ Δ₁) (m₂ ∷ Δ₂) (tup Ξ₁ Ξ₂ spΞ fst snd) with separateEnv {Γ} Δ₁ Δ₂ snd separateEnv {A ∷ Γ} {Θ = Θ} {Ξ = Ξ} (zero ∷ Δ₁) (m₂ ∷ Δ₂) (tup Ξ₁ Ξ₂ spΞ fst snd) | tup Ξ₁' Ξ₂' spΞ₂ θ₁ θ₂ = tup Ξ₁' (Ξ₁ +ₘ Ξ₂') lemma (tup ∅ Ξ₁' (∅-lid _) (mult-zero refl) θ₁) (tup Ξ₁ Ξ₂' refl fst θ₂) where open import Algebra.Solver.CommutativeMonoid (+ₘ-commutativeMonoid (length Θ)) renaming (_⊕_ to _⊞_) lemma : Ξ₁' +ₘ (Ξ₁ +ₘ Ξ₂') ≡ Ξ lemma = begin Ξ₁' +ₘ (Ξ₁ +ₘ Ξ₂') ≡⟨ solve 3 (λ x y z -> x ⊞ (y ⊞ z) ⊜ y ⊞ (x ⊞ z)) refl Ξ₁' Ξ₁ Ξ₂' ⟩ Ξ₁ +ₘ (Ξ₁' +ₘ Ξ₂') ≡⟨ cong (_ +ₘ_) spΞ₂ ⟩ Ξ₁ +ₘ Ξ₂ ≡⟨ spΞ ⟩ Ξ ∎ separateEnv {A ∷ Γ} {Ξ = Ξ} (one ∷ Δ₁) (zero ∷ Δ₂) (tup Ξ₁ Ξ₂ spΞ fst snd) | tup Ξ₁' Ξ₂' spΞ₂ θ₁ θ₂ = tup (Ξ₁ +ₘ Ξ₁') Ξ₂' lemma (tup Ξ₁ Ξ₁' refl fst θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-zero refl) θ₂) where lemma : Ξ₁ +ₘ Ξ₁' +ₘ Ξ₂' ≡ Ξ lemma = begin Ξ₁ +ₘ Ξ₁' +ₘ Ξ₂' ≡⟨ +ₘ-assoc Ξ₁ Ξ₁' _ ⟩ Ξ₁ +ₘ (Ξ₁' +ₘ Ξ₂') ≡⟨ cong (_ +ₘ_) spΞ₂ ⟩ Ξ₁ +ₘ Ξ₂ ≡⟨ spΞ ⟩ Ξ ∎ separateEnv {A ∷ Γ} (one ∷ Δ₁) (one ∷ Δ₂) (tup .(∅) .(Ξ₁' +ₘ Ξ₂') refl (mult-omega v refl) snd) | tup Ξ₁' Ξ₂' refl θ₁ θ₂ = tup Ξ₁' Ξ₂' (sym (∅-lid _)) (tup ∅ Ξ₁' (∅-lid _) (mult-one v) θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-one v) θ₂) separateEnv {A ∷ Γ} (one ∷ Δ₁) (omega ∷ Δ₂) (tup .(∅) .(Ξ₁' +ₘ Ξ₂') refl (mult-omega v refl) snd) | tup Ξ₁' Ξ₂' refl θ₁ θ₂ = tup Ξ₁' Ξ₂' (sym (∅-lid _)) (tup ∅ Ξ₁' (∅-lid _) (mult-one v) θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-omega v refl) θ₂) separateEnv {A ∷ Γ} (omega ∷ Δ₁) (zero ∷ Δ₂) (tup .(∅) .(Ξ₁' +ₘ Ξ₂') refl (mult-omega v refl) snd) | tup Ξ₁' Ξ₂' refl θ₁ θ₂ = tup Ξ₁' Ξ₂' (sym (∅-lid _)) (tup ∅ Ξ₁' (∅-lid _) (mult-omega v refl) θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-zero refl) θ₂) separateEnv {A ∷ Γ} (omega ∷ Δ₁) (one ∷ Δ₂) (tup .(∅) .(Ξ₁' +ₘ Ξ₂') refl (mult-omega v refl) snd) | tup Ξ₁' Ξ₂' refl θ₁ θ₂ = tup Ξ₁' Ξ₂' (sym (∅-lid _)) (tup ∅ Ξ₁' (∅-lid _) (mult-omega v refl) θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-one v) θ₂) separateEnv {A ∷ Γ} (omega ∷ Δ₁) (omega ∷ Δ₂) (tup .(∅) .(Ξ₁' +ₘ Ξ₂') refl (mult-omega v refl) snd) | tup Ξ₁' Ξ₂' refl θ₁ θ₂ = tup Ξ₁' Ξ₂' (sym (∅-lid _)) (tup ∅ Ξ₁' (∅-lid _) (mult-omega v refl) θ₁) (tup ∅ Ξ₂' (∅-lid _) (mult-omega v refl) θ₂) -- un×ₘ-valEnv is a counter of separateEnv for ×ₘ. un×ₘ-valEnv : ∀ Γ {m Δ Θ Ξ} -> ValEnv Γ (m ×ₘ Δ) Θ Ξ -> ∃[ Ξ' ] (ValEnv Γ Δ Θ Ξ' × m ×ₘ Ξ' ≡ Ξ) un×ₘ-valEnv [] {m} θ = ∅ , refl , trans (×ₘ∅ m) (sym θ) un×ₘ-valEnv (_ ∷ Γ) {Δ = mₓ ∷ Δ} (tup Ξ₁ Ξ₂ refl fst snd) with un×ₘ-valEnv Γ snd un×ₘ-valEnv (_ ∷ Γ) {one} {mₓ ∷ Δ} (tup Ξ₁ .(Data.Vec.map (λ y → y) Ξ') refl fst snd) | Ξ' , θ' , refl = Ξ₁ +ₘ Ξ' , tup Ξ₁ Ξ' refl fst θ' , lemma where open import Data.Vec.Properties using (map-id) lemma : Data.Vec.map (λ x -> x) (Ξ₁ +ₘ Ξ') ≡ Ξ₁ +ₘ Data.Vec.map (λ x -> x) Ξ' lemma = begin Data.Vec.map (λ x -> x) (Ξ₁ +ₘ Ξ') ≡⟨ map-id _ ⟩ Ξ₁ +ₘ Ξ' ≡⟨ cong (_ +ₘ_) (sym (map-id _)) ⟩ Ξ₁ +ₘ Data.Vec.map (λ x -> x) Ξ' ∎ un×ₘ-valEnv (_ ∷ Γ) {omega} {zero ∷ Δ} (tup .(∅) .(Data.Vec.map (mul₀ omega) Ξ') refl (mult-zero refl) snd) | Ξ' , θ' , refl = Ξ' , tup ∅ Ξ' (∅-lid _) (mult-zero refl) θ' , sym (∅-lid _) un×ₘ-valEnv (_ ∷ Γ) {omega} {one ∷ Δ} (tup .(∅) .(Data.Vec.map (mul₀ omega) Ξ') refl (mult-omega v refl) snd) | Ξ' , θ' , refl = Ξ' , tup ∅ Ξ' (∅-lid _) (mult-one v) θ' , sym (∅-lid _) un×ₘ-valEnv (_ ∷ Γ) {omega} {omega ∷ Δ} (tup .(∅) .(Data.Vec.map (mul₀ omega) Ξ') refl (mult-omega v refl) snd) | Ξ' , θ' , refl = Ξ' , tup ∅ Ξ' (∅-lid _) (mult-omega v refl) θ' , sym (∅-lid _) -- weakenΘ-value and weakenΘ-residual are counterparts of -- weakenΘ-term for values and residuals. weakenΘ-value : ∀ {Θ Ξ Θ' Ξ' A i} -> compatΘ Θ Ξ Θ' Ξ' -> Value Θ Ξ A {i} -> Value Θ' Ξ' A weakenΘ-residual : ∀ {Θ Ξ Θ' Ξ' A i} -> compatΘ Θ Ξ Θ' Ξ' -> Residual Θ Ξ A {i} -> Residual Θ' Ξ' A weakenΘ-valEnv : ∀ Γ {Δ Θ Ξ Θ' Ξ' i} -> compatΘ Θ Ξ Θ' Ξ' -> ValEnv Γ Δ {i} Θ Ξ -> ValEnv Γ Δ Θ' Ξ' weakenΘ-mult : ∀ {Θ Ξ Θ' Ξ' m A i} -> compatΘ Θ Ξ Θ' Ξ' -> mult (λ Θ Ξ -> Value Θ Ξ A {i}) m Θ Ξ -> mult (λ Θ Ξ -> Value Θ Ξ A) m Θ' Ξ' weakenΘ-value ext (clo {Γ' = Γ'} m refl θ t) = case* compatΘ-split ext of λ { (_ , _ , ext₁ , ext₂ , refl) -> clo m refl (weakenΘ-valEnv Γ' ext₁ θ) (weakenΘ-term ext₂ t) } weakenΘ-value ext (unit refl) = case* compatΘ-∅ ext of λ where refl -> unit refl weakenΘ-value ext (pair refl v₁ v₂) = case* compatΘ-split ext of λ where (_ , _ , ext₁ , ext₂ , refl) -> pair refl (weakenΘ-value ext₁ v₁) (weakenΘ-value ext₂ v₂) weakenΘ-value ext (many m refl v) = case* compatΘ-×ₘ ext of λ where (_ , ext' , refl) -> many m refl (weakenΘ-value ext' v) weakenΘ-value ext (inl v) = inl (weakenΘ-value ext v) weakenΘ-value ext (inr v) = inr (weakenΘ-value ext v) weakenΘ-value ext (roll v) = roll (weakenΘ-value ext v) weakenΘ-value ext (red x) = red (weakenΘ-residual ext x) weakenΘ-value ext (inj refl r) = case* compatΘ-∅ ext of λ { refl -> inj refl (weakenΘ-residual ext-id r) } weakenΘ-mult ext (mult-zero refl) = case* compatΘ-∅ ext of λ { refl -> mult-zero refl } weakenΘ-mult ext (mult-one v) = mult-one (weakenΘ-value ext v) weakenΘ-mult ext (mult-omega v refl) = case* compatΘ-∅ ext of λ { refl -> mult-omega (weakenΘ-value ext v) refl } weakenΘ-valEnv [] ext refl = case* compatΘ-∅ ext of λ { refl -> refl } weakenΘ-valEnv (_ ∷ Γ) {_ ∷ Δ} ext (tup Ξ₁ Ξ₂ refl mv θ) = case* compatΘ-split ext of λ { (Ξ₁' , Ξ₂' , ext₁ , ext₂ , refl) -> tup Ξ₁' Ξ₂' refl (weakenΘ-mult ext₁ mv) (weakenΘ-valEnv Γ ext₂ θ) } weakenΘ-residual ext unit● = case* compatΘ-∅ ext of λ { refl -> unit● } weakenΘ-residual ext (letunit● r₁ r₂) = case* compatΘ-split ext of λ { (_ , _ , ext₁ , ext₂ , refl) -> letunit● (weakenΘ-residual ext₁ r₁) (weakenΘ-residual ext₂ r₂) } weakenΘ-residual ext (pair● r₁ r₂) = case* compatΘ-split ext of λ { (_ , _ , ext₁ , ext₂ , refl) -> pair● (weakenΘ-residual ext₁ r₁) (weakenΘ-residual ext₂ r₂) } weakenΘ-residual ext (letpair● r₁ r₂) = case* compatΘ-split ext of λ { (_ , _ , ext₁ , ext₂ , refl) -> letpair● (weakenΘ-residual ext₁ r₁) (weakenΘ-residual (compat-skip (compat-skip ext₂)) r₂) } weakenΘ-residual ext (inl● r) = inl● (weakenΘ-residual ext r) weakenΘ-residual ext (inr● r) = inr● (weakenΘ-residual ext r) weakenΘ-residual ext (case● {Γ₁ = Γ₁} {Γ₂} r refl θ₁ t₁ θ₂ t₂ v) with compatΘ-split ext ... | _ , _ , ext₁ , ext₂ , refl with compatΘ-split ext₂ ... | _ , _ , extₑ , extₜ , refl = case● (weakenΘ-residual ext₁ r) refl (weakenΘ-valEnv Γ₁ extₑ θ₁) (weakenΘ-term (compat-skip extₜ) t₁) (weakenΘ-valEnv Γ₂ extₑ θ₂) (weakenΘ-term (compat-skip extₜ) t₂) (weakenΘ-value adjust∅Θ v) weakenΘ-residual ext (var● x ok) = case* compatΘ-preserves-varOk● ext ok of λ { (x' , ok') -> var● x' ok' } weakenΘ-residual ext (pin r v) = case* compatΘ-split ext of λ { (_ , _ , ext₁ , ext₂ , refl) -> pin (weakenΘ-residual ext₁ r) (weakenΘ-value ext₂ v) } -- Converting a value (of multiplicty m) into an entry to be inserted to a value environment. value-to-multM : ∀ {Θ m Ξ A} -> all-no-omega (m ×ₘ Ξ) -> Value Θ Ξ A -> mult (λ Θ' Ξ' -> Value Θ' Ξ' A) (M→M₀ m) Θ (m ×ₘ Ξ) value-to-multM {Θ} {one} ano v = mult-one (subst (λ x -> Value Θ x _) (sym (one×ₘ _)) v ) value-to-multM {Θ} {omega} {Ξ} ano v with all-no-omega-omega×ₘ Ξ ano ... | refl = mult-omega v (×ₘ∅ _) -- Some specialized versions of subst. substV : ∀ {Θ Ξ Ξ' A} -> Ξ ≡ Ξ' -> Value Θ Ξ A -> Value Θ Ξ' A substV refl v = v substR : ∀ {Θ Ξ Ξ' A} -> Ξ ≡ Ξ' -> Residual Θ Ξ A -> Residual Θ Ξ' A substR refl E = E
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_push_front.asm
meesokim/z88dk
0
245695
<reponame>meesokim/z88dk ; void p_forward_list_alt_push_front(p_forward_list_alt_t *list, void *item) SECTION code_adt_p_forward_list_alt PUBLIC _p_forward_list_alt_push_front EXTERN asm_p_forward_list_alt_push_front _p_forward_list_alt_push_front: pop af pop bc pop de push de push bc push af jp asm_p_forward_list_alt_push_front
examples/stm32f0/rfm69_moter/sensor/peripherals.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
10860
<reponame>ekoeppen/STM32_Generic_Ada_Drivers with STM32GD.Board; with Drivers.Si7006; with Drivers.Text_IO; package Peripherals is subtype Millivolts is Natural range 0..4095; package Si7006 is new Drivers.Si7006 (I2C => STM32GD.Board.I2C); procedure Init; procedure Power_Down; procedure Power_Up; procedure Enable_Stop_Mode (Low_Power : Boolean); procedure Enter_Stop_Mode; procedure Disable_Stop_Mode; function Supply_Voltage return Millivolts; end Peripherals;
asm/scratch/bin/common_utilities/itoaconv.asm
sachamasry/universal-translator
0
166828
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; SOURCE NAME: source_name.asm ; CREATED ON: yyyymmdd ; LAST UPDATED ON: yyyymmdd ; VERSION: 0.01 ; AUTHOR: Author ; CREATED BY: DevilRay ; OTHER: Assembly program source ; FASM assembler ; Intel assembly syntax ; i386 platform, 32-bit ; Pentium III-level instruction set ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;-------------------------------------------------------------------- ; ; License: BSD License ; ; Copyright (c) 2010, DevilRay (dev<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. ; ; - Redistribution 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 DevilRay 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. ; ;-------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; PROGRAM SUMMARY: ; ; Summary description of program, its purpose and functioning ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;--------------------------------------------------------------------- ; ; ASSEMBLER PREPROCESSOR DIRECTIVES ; ; Define executable format and mode ; ; Include external files/macros/static definitions ; ; Define specific macros and static definitions ; ; Define procedures to be made publically available as well as ; any external procedures required ; ;--------------------------------------------------------------------- format elf use32 ; Include symbolic constant definitions ;include '%DEV_INCLUDE_DEFS%/<name_of_include_file>.inc' ; Include externally defined macros ;include '%DEV_INCLUDE_MACROS%/<name_of_include_file>.inc' include '%DEV_INCLUDE_MACROS%/portability/os/%OS%/system.inc' include '%DEV_INCLUDE_MACROS%/stdio_macros.inc' ; Define local symbolic constants ; <const> equ 0 ; Define local macros ; macro <name_of_macro> {} ; Define publically-available local procedures ; public name_of_procedure as 'alias_for_procedure' ; Define externally required procedures ; extrn 'name_of_external_procedure' as alias_for_procedure ; Start of the text (code) section section '.text' executable align 4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; PROGRAM: ; ; name_of_program ; ; ; PURPOSE: ; ; Synopsis of program and its purpose ; ; ; PROGRAM DESCRIPTION: ; ; Detailed program description. ; ; ; ALGORITHM DESCRIPTION: ; ; Detailed algorithm description. ; ; ; INPUT PARAMETERS: ; ; Input description stack/register input_type ; input configuration file(s) ; ; ; OUTPUT PARAMETERS: ; ; Output description stack/register output_type ; exit statuses ; output file(s) ; ; ; (ADDITIONAL) REGISTERS USED WITHIN PROGRAM: ; ; Register data description ; ; ; MEMORY AREAS DEFINED WITHIN PROGRAM: ; ; Name of definition data description ; ; ; COMMENTS: ; ; Additional program comments, pitfalls to avoid and ; requirements to follow. ; ; ; ERROR CONDITIONS, VALIDATION AND RECOVERY: ; ; List of known error conditions, boundary (or edge) problems, ; out-of-bounds value, unexpected value or unexpected data type, ; malicious parameter passing, etc. ; ; Validation rules and techniques for the above. ; ; Recovery from the above. ; ; ; EXTERNAL CALLS: ; ; List of external calls made, or none if no calls required. ; ; ; EXTERNAL MACROS USED: ; ; List of external macros used, their containing include files, and ; documentation outlining the use of the macro. ; ; macro => include file ; Synopsis of macro ; ; terminate_program => program_control.inc ; Cleanly terminate runing program ; ; ; EXTERNAL DEFINITION FILES USED: ; ; List definition files externally referenced through include ; statements. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public _start _start: ; Keep as breakpoint for debugging in gdb nop call ascii_gen recycle: ; automatically feed data ;rdtsc ; manually feed data mov edx, 0000008fh mov eax, 966f3f3ch mov edx, 0 ;mov eax, 0fh mov eax, [number_to_convert] mov [bignum_hex], edx mov [bignum_hex+4], eax xor edx, edx xor eax, eax call bignum_divisor ; bignum processing first mov edx, [bignum_hex] mov eax, [bignum_hex+4] ; divide and store remainder div ebx push eax ; clear edx and concentrate on the first remainder mov eax, edx xor edx, edx mov ebx, 10 mov edi, bignum_ascii mov ecx, 20 call div_by_base pop eax test eax,eax jz skip xor edx, edx dec ecx call div_by_base skip: xor edx, edx lea esi, [bignum_ascii+ecx-1] or edx, esi and edx, 2h mov eax, esi sub eax, edx mov eax, [eax] mov ebx, [number_to_convert] mov edx,[receiver+ebx*4] and eax, 0ffffh and edx, 0ffffh cmp eax,edx je skip_over exit_program ebx skip_over: mov [receiver], eax write_stdout esi,20 write_newline ; loop conversion ;mov ecx,0ffh ;jmp recycle ; < instruction code here > .end: ; Terminate program and return to the OS exit_program ebx ascii_gen: ; Start ascii number generation xor eax, eax xor ebx, ebx mov ecx, 20 lea edi, [receiver] loop_gen: mov edx, eax or edx, 030303030h bswap edx mov [edi+ebx*4],edx ; lea esi, [edi+ebx*4] ;pusha ;write_stdout esi,4 ;write_space ;popa inc ebx inc eax aaa loop loop_gen ;write_newline ;lea edi, [receiver] ;write_stdout edi,80 ;write_newline ret bignum_divisor: ; divisor ^ 9 xor edx,edx mov eax,10 mov ebx,10 mul ebx mul ebx mul ebx mul ebx mul ebx mul ebx mul ebx mul ebx mov ebx, eax ret div_by_base: div ebx add dx, 30h mov byte [edi+ecx-1], dl test eax, eax je done xor edx, edx loop div_by_base done: ret ;--------------------------------------------------------------------- ; ; SECTION HEADER ; ; Define all required sections along with their attributes ; ;--------------------------------------------------------------------- ; Start of the data section section '.data' writeable align 4 ; <--- initialised data here ---> bignum_hex: db '0' dup 8 number_to_convert: db 0fh ; Start of the read-only data section section '.rodata' align 4 ; <--- initialised read-only data here ---> ; Start of the bss section section '.bss' writeable align 4 ; <--- uninitialised data here ---> bignum_ascii: db 100 dup '0' receiver: db 100 dup ' '
main.asm
Kenneth-Sweet/GameBoyCProj
0
244896
<filename>main.asm<gh_stars>0 ;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.6 #12539 (MINGW32) ;-------------------------------------------------------- .module main .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _main .globl _set_sprite_data .globl _delay .globl _SampleSmile ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _INITIALIZED _SampleSmile:: .ds 32 ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE ;main.c:5: void main(){ ; --------------------------------- ; Function main ; --------------------------------- _main:: ;main.c:7: UINT8 currentSpriteIndex = 0; ld c, #0x00 ;main.c:8: set_sprite_data(0,2, SampleSmile); ld de, #_SampleSmile push de ld hl, #0x200 push hl call _set_sprite_data add sp, #4 ;c:/gbdk/include/gb/gb.h:1447: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 2) ld (hl), #0x00 ;c:/gbdk/include/gb/gb.h:1520: OAM_item_t * itm = &shadow_OAM[nb]; ld hl, #_shadow_OAM ;c:/gbdk/include/gb/gb.h:1521: itm->y=y, itm->x=x; ld a, #0x4e ld (hl+), a ld (hl), #0x58 ;main.c:11: SHOW_SPRITES; ldh a, (_LCDC_REG + 0) or a, #0x02 ldh (_LCDC_REG + 0), a ;main.c:12: while(1){ 00105$: ;main.c:13: if(currentSpriteIndex==0){ ld a, c or a, a ;main.c:14: currentSpriteIndex=1; ;main.c:17: currentSpriteIndex = 0; ld c, #0x01 jr Z, 00103$ ld c, #0x00 00103$: ;c:/gbdk/include/gb/gb.h:1447: shadow_OAM[nb].tile=tile; ld hl, #(_shadow_OAM + 2) ld (hl), c ;main.c:20: delay(1000); push bc ld de, #0x03e8 push de call _delay pop hl pop bc ;c:/gbdk/include/gb/gb.h:1536: OAM_item_t * itm = &shadow_OAM[nb]; ld de, #_shadow_OAM+0 ;c:/gbdk/include/gb/gb.h:1537: itm->y+=y, itm->x+=x; ld a, (de) ld (de), a inc de ld a, (de) add a, #0x0a ld (de), a ;main.c:21: scroll_sprite(0,10,0); ;main.c:23: } jr 00105$ .area _CODE .area _INITIALIZER __xinit__SampleSmile: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x77 ; 119 'w' .db #0x77 ; 119 'w' .db #0x77 ; 119 'w' .db #0x55 ; 85 'U' .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x63 ; 99 'c' .db #0x41 ; 65 'A' .db #0x7f ; 127 .db #0x7f ; 127 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x77 ; 119 'w' .db #0x77 ; 119 'w' .db #0x77 ; 119 'w' .db #0x55 ; 85 'U' .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x7f ; 127 .db #0x7f ; 127 .db #0x7f ; 127 .db #0x41 ; 65 'A' .db #0x00 ; 0 .db #0x00 ; 0 .area _CABS (ABS)
1A/S5/PIM/tps/tp6/afficher_un_entier.adb
MOUDDENEHamza/ENSEEIHT
4
13581
<filename>1A/S5/PIM/tps/tp6/afficher_un_entier.adb with Ada.Integer_Text_IO; package body Afficher_Un_Entier is procedure Afficher (N: in Integer) is begin Ada.Integer_Text_IO.Put (N, 1); end; end Afficher_Un_Entier;
src/main/antlr4/org/mcvoid/json/parser/Json.g4
mcvoid/jsonParser
0
3870
grammar Json; // These are our non-terminal rules // Each of these will be a node on the parse tree // and a method in the visitor. json: value; obj: '{' pair (',' pair)* '}' | '{' '}' ; pair: STRING ':' value; array: '[' value (',' value)* ']' | '[' ']'; value: STRING | NUMBER | obj | array | 'true' | 'false' | 'null'; // These are our terminal rules. The lexer uses these. STRING: '"' (ESC | ~ ["\\])* '"'; fragment ESC: '\\' (["\\/bfnrt] | UNICODE); fragment UNICODE: 'u' HEX HEX HEX HEX; fragment HEX: [0-9a-fA-F]; NUMBER: '-'? INT '.' [0-9] + EXP? | '-'? INT EXP | '-'? INT; fragment INT: '0' | [1-9] [0-9]*; fragment EXP: [Ee] [+\-]? INT; WS: [ \t\n\r]+ -> skip;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_368.asm
ljhsiun2/medusa
9
25618
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_368.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x18e00, %r12 nop nop xor %rcx, %rcx movb (%r12), %r9b sub $39011, %rdi lea addresses_D_ht+0xea60, %r15 nop nop nop cmp $50534, %rdx mov $0x6162636465666768, %rsi movq %rsi, (%r15) nop nop nop nop nop cmp $25826, %r9 lea addresses_WT_ht+0x360, %r15 nop and %r12, %r12 mov (%r15), %esi nop nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0x16920, %r15 nop nop nop nop nop add $41171, %rdx movb $0x61, (%r15) nop nop sub %r15, %r15 lea addresses_UC_ht+0x17f86, %rsi lea addresses_A_ht+0x1ae60, %rdi nop nop nop nop nop add $28900, %r12 mov $94, %rcx rep movsb nop nop nop sub %r15, %r15 lea addresses_D_ht+0x8260, %r9 cmp %rdi, %rdi movl $0x61626364, (%r9) inc %r15 lea addresses_D_ht+0x86c0, %rsi lea addresses_UC_ht+0x17e90, %rdi nop nop xor %r14, %r14 mov $67, %rcx rep movsq nop add $60404, %r12 lea addresses_normal_ht+0x1e530, %r15 nop nop nop sub %rdi, %rdi mov (%r15), %r9 nop sub %rdx, %rdx lea addresses_WT_ht+0x15360, %rsi nop nop nop nop nop dec %rdi mov (%rsi), %r15d nop nop nop nop nop and %rcx, %rcx lea addresses_UC_ht+0xfa48, %rsi lea addresses_normal_ht+0x1a360, %rdi nop nop nop nop nop mfence mov $45, %rcx rep movsw nop nop nop dec %rdx lea addresses_WT_ht+0x2740, %r12 nop nop and $33401, %r14 and $0xffffffffffffffc0, %r12 vmovaps (%r12), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r15 inc %r14 lea addresses_D_ht+0x1b60, %rsi nop nop nop nop nop inc %rcx mov (%rsi), %r12 nop sub %r9, %r9 lea addresses_WC_ht+0xfa60, %rsi clflush (%rsi) nop nop nop nop nop and %rcx, %rcx mov (%rsi), %r14w nop nop add %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r8 push %rcx push %rdi // Store lea addresses_normal+0x8af0, %rdi sub $433, %r10 mov $0x5152535455565758, %rcx movq %rcx, %xmm5 movups %xmm5, (%rdi) nop nop nop nop nop add $62875, %r8 // Faulty Load lea addresses_RW+0x18a60, %r8 nop nop nop nop add $31962, %r12 mov (%r8), %r10w lea oracles, %rcx and $0xff, %r10 shlq $12, %r10 mov (%rcx,%r10,1), %r10 pop %rdi pop %rcx pop %r8 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'dst': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
test/Fail/Issue3056.agda
shlevy/agda
1,989
5157
<reponame>shlevy/agda open import Agda.Builtin.Unit open import Agda.Builtin.Bool open import Agda.Builtin.Sigma data ⊥ : Set where type : Bool → Set type true = ⊤ type false = ⊥ record Bad : Set where constructor b field .f : Σ Bool type test : Bad → Bool test (b (x , y)) = x
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/task_with_body.ads
ouankou/rose
488
20774
package Task_With_Body is task type The_Task_Type; end Task_With_Body;
test/Succeed/Issue233.agda
shlevy/agda
3
9010
<reponame>shlevy/agda -- Bug: With abstraction depended on bound variable names! module Issue233 where postulate T : (Set → Set) → Set mkT : (F : Set → Set) → T F foo : T (λ A → A) foo with λ (B : Set) → B ... | F = mkT F
alloy4fun_models/trashltl/models/1/82n9q9WQoT2KfdLDg.als
Kaixi26/org.alloytools.alloy
0
616
<reponame>Kaixi26/org.alloytools.alloy open main pred id82n9q9WQoT2KfdLDg_prop2 { before no File } pred __repair { id82n9q9WQoT2KfdLDg_prop2 } check __repair { id82n9q9WQoT2KfdLDg_prop2 <=> prop2o }
Chapter03/procedure.nasm
firebitsbr/Penetration-Testing-with-Shellcode
30
162389
global _start section .text addition: add bl,al ret _start: mov al, 0x1 mov bl, 0x3 call addition mov r8,0x4 mov r9, 0x2 call addition mov rax, 60 mov rdi, 1 syscall section .data
source/machine-pc-freebsd/s-unwmap.adb
ytomino/drake
33
27639
<filename>source/machine-pc-freebsd/s-unwmap.adb with Ada.Unchecked_Conversion; with System.Address_To_Constant_Access_Conversions; with System.Address_To_Named_Access_Conversions; with System.Stack; with System.Unwind.Raising; with System.Unwind.Standard; with C.string; with C.sys.ucontext; package body System.Unwind.Mapping is pragma Suppress (All_Checks); use type C.signed_int; use type C.signed_long; use type C.unsigned_int; use type C.unsigned_long; function strlen (s : not null access constant C.char) return C.size_t with Import, Convention => Intrinsic, External_Name => "__builtin_strlen"; package char_ptr_Conv is new Address_To_Named_Access_Conversions (C.char, C.char_ptr); procedure sigaction_Handler ( Signal_Number : C.signed_int; Info : access C.signal.siginfo_t; Context : C.void_ptr) with Convention => C; pragma No_Return (sigaction_Handler); procedure sigaction_Handler ( Signal_Number : C.signed_int; Info : access C.signal.siginfo_t; Context : C.void_ptr) is -- allow to inspect the parameters with debugger. type ucontext_t_ptr is access constant C.sys.ucontext.ucontext_t with Convention => C; for ucontext_t_ptr'Storage_Size use 0; package ucontext_t_ptr_Conv is new Address_To_Constant_Access_Conversions ( C.sys.ucontext.ucontext_t, ucontext_t_ptr); uap : constant ucontext_t_ptr := ucontext_t_ptr_Conv.To_Pointer (Address (Context)); pragma Inspection_Point (Signal_Number); pragma Inspection_Point (Info); pragma Inspection_Point (uap); -- space for overflow detection, decided for CB1010C Stack_Overflow_Space : constant := (Standard'Address_Size / Standard'Storage_Unit) * 8 * 1024 * 1024; -- the components of the exception. Message : constant C.char_ptr := C.string.strsignal (Signal_Number); Message_Length : constant C.size_t := strlen (Message); Eexception_Id : Exception_Data_Access; Stack_Guard : Address := Null_Address; begin case Signal_Number is when C.signal.SIGFPE => Eexception_Id := Standard.Constraint_Error'Access; when C.signal.SIGBUS | C.signal.SIGSEGV => declare Top, Bottom : Address; Fault : Address; begin Stack.Get (Top => Top, Bottom => Bottom); Stack.Fake_Return_From_Signal_Handler; if Info /= null then Fault := Stack.Fault_Address (Info.all); else Fault := Null_Address; end if; if Fault /= Null_Address and then Fault >= Top - Stack_Overflow_Space and then Fault < Bottom then -- stack overflow Stack_Guard := Top + C.signal.MINSIGSTKSZ; Eexception_Id := Standard.Storage_Error'Access; else Eexception_Id := Standard.Program_Error'Access; end if; end; when others => Eexception_Id := Standard.Program_Error'Access; end case; declare Message_All : String (1 .. Integer (Message_Length)); for Message_All'Address use char_ptr_Conv.To_Address (Message); begin Raising.Raise_From_Signal_Handler ( Eexception_Id, Message => Message_All, Stack_Guard => Stack_Guard); end; end sigaction_Handler; procedure Set_Signal_Stack (S : access Signal_Stack_Type); procedure Set_Signal_Stack (S : access Signal_Stack_Type) is function Cast is new Ada.Unchecked_Conversion (C.char_ptr, C.void_ptr); -- OSX function Cast is new Ada.Unchecked_Conversion (C.char_ptr, C.char_ptr); -- FreeBSD pragma Warnings (Off, Cast); stack : aliased C.signal.stack_t := ( ss_sp => Cast (S (S'First)'Access), ss_size => Signal_Stack_Type'Size / Standard'Storage_Unit, ss_flags => 0); Dummy : C.signed_int; begin Dummy := C.signal.sigaltstack (stack'Access, null); end Set_Signal_Stack; Signal_Stack : aliased Signal_Stack_Type; -- implementation procedure Install_Exception_Handler (SEH : Address) is pragma Unreferenced (SEH); act : aliased C.signal.struct_sigaction := ( (Unchecked_Tag => 1, sa_sigaction => sigaction_Handler'Access), others => <>); Dummy : C.signed_int; begin act.sa_flags := C.signed_int ( C.unsigned_int'(C.signal.SA_NODEFER or C.signal.SA_SIGINFO)); Dummy := C.signal.sigemptyset (act.sa_mask'Access); -- illegal instruction Dummy := C.signal.sigaction (C.signal.SIGILL, act'Access, null); -- floating-point exception Dummy := C.signal.sigaction (C.signal.SIGFPE, act'Access, null); -- bus error Set_Signal_Stack (Signal_Stack'Access); act.sa_flags := C.signed_int (C.unsigned_int (act.sa_flags) or C.signal.SA_ONSTACK); Dummy := C.signal.sigaction (C.signal.SIGBUS, act'Access, null); -- segmentation violation Dummy := C.signal.sigaction (C.signal.SIGSEGV, act'Access, null); end Install_Exception_Handler; procedure Install_Task_Exception_Handler ( SEH : Address; Signal_Stack : not null access Signal_Stack_Type) is pragma Unreferenced (SEH); begin -- sigaction setting would be inherited from environment task. Set_Signal_Stack (Signal_Stack); end Install_Task_Exception_Handler; end System.Unwind.Mapping;
examples/SymbOS_nslookup/Cmd-NsLookUp-sj.asm
fengjixuchui/sjasmplus
220
166020
; define substitutions for directives which have different name in WinAPE DEFINE write OUTPUT DEFINE READ INCLUDE DEFINE nolist OPT listoff ; reconfigure the sjasmplus to a bit stricter syntax with extra warnings ; and enable directives at the beginning of the line (--dirbol) OPT --syntax=abfw --dirbol ; include original "head" file which will produce the com file INCLUDE "src/Cmd-NsLookUp-head.asm"
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_erase_block_callee.asm
meesokim/z88dk
0
93047
<filename>libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_erase_block_callee.asm ; size_t b_vector_erase_block(b_vector_t *v, size_t idx, size_t n) SECTION code_adt_b_vector PUBLIC b_vector_erase_block_callee EXTERN b_array_erase_block_callee defc b_vector_erase_block_callee = b_array_erase_block_callee INCLUDE "adt/b_vector/z80/asm_b_vector_erase_block.asm"
PRG/levels/Sky/5-4End.asm
narfman0/smb3_pp1
0
102062
; Original address was $AB38 ; 5-8 end .word $0000 ; Alternate level layout .word $0000 ; Alternate object layout .byte LEVEL1_SIZE_02 | LEVEL1_YSTART_170 .byte LEVEL2_BGPAL_02 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_00 | LEVEL3_VSCROLL_LOCKED .byte LEVEL4_BGBANK_INDEX(13) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_ATHLETIC | LEVEL5_TIME_300 .byte $00, $00, $03, $40, $09, $09, $79, $00, $11, $1F, $57, $00, $22, $FF
test-suite/programs/unit/jgt_0x1C.asm
ocus/TinyASM_Haskell
0
243298
<reponame>ocus/TinyASM_Haskell MOV [0] 43 MOV [1] 66 MOV [2] 25 MOV [3] 22 MOV [4] 29 JGT [3] [0] [2] DPRINT 157 HALT JGT [4] [0] [1] DPRINT 869 HALT DPRINT 532 HALT
src/visuals/rtch-visuals-canvases.adb
Lucretia/raytracer_challenge
4
27432
package body RTCH.Visuals.Canvases with Preelaborate is function Make_Canvas (Width, Height : in Positive) return Canvas_Access is begin return new Canvas (1 .. Width, 1 .. Height); end Make_Canvas; procedure Set_Pixel (C : in out Canvas; X, Y : in Positive; Colour : in Colours.Colour) is begin C (X, Y) := Colour; end Set_Pixel; -- type Canvas (Width, Height : Positive) is record -- Pixels : Pixel_Array (1 .. Width, 1 .. Height) := ((others => (others => Make_Colour (0.0, 0.0, 0.0)))); -- end record; end RTCH.Visuals.Canvases;
source/amf/uml/amf-uml-classifiers.ads
svn2github/matreshka
24
2060
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A classifier is a classification of instances - it describes a set of -- instances that have features in common. A classifier can specify a -- generalization hierarchy by referencing its general classifiers. -- -- A classifier has the capability to own collaboration uses. These -- collaboration uses link a collaboration with the classifier to give a -- description of the workings of the classifier. -- -- Classifier is defined to be a kind of templateable element so that a -- classifier can be parameterized. It is also defined to be a kind of -- parameterable element so that a classifier can be a formal template -- parameter. -- -- A classifier has the capability to own use cases. Although the owning -- classifier typically represents the subject to which the owned use cases -- apply, this is not necessarily the case. In principle, the same use case -- can be applied to multiple subjects, as identified by the subject -- association role of a use case. ------------------------------------------------------------------------------ limited with AMF.UML.Classifier_Template_Parameters; limited with AMF.UML.Classifiers.Collections; limited with AMF.UML.Collaboration_Uses.Collections; limited with AMF.UML.Features.Collections; limited with AMF.UML.Generalization_Sets.Collections; limited with AMF.UML.Generalizations.Collections; limited with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces; limited with AMF.UML.Properties.Collections; with AMF.UML.Redefinable_Elements; limited with AMF.UML.Redefinable_Template_Signatures; limited with AMF.UML.Substitutions.Collections; with AMF.UML.Templateable_Elements; with AMF.UML.Types; limited with AMF.UML.Use_Cases.Collections; package AMF.UML.Classifiers is pragma Preelaborate; type UML_Classifier is limited interface and AMF.UML.Namespaces.UML_Namespace and AMF.UML.Types.UML_Type and AMF.UML.Templateable_Elements.UML_Templateable_Element and AMF.UML.Redefinable_Elements.UML_Redefinable_Element; type UML_Classifier_Access is access all UML_Classifier'Class; for UML_Classifier_Access'Storage_Size use 0; not overriding function Get_Attribute (Self : not null access constant UML_Classifier) return AMF.UML.Properties.Collections.Set_Of_UML_Property is abstract; -- Getter of Classifier::attribute. -- -- Refers to all of the Properties that are direct (i.e. not inherited or -- imported) attributes of the classifier. not overriding function Get_Collaboration_Use (Self : not null access constant UML_Classifier) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is abstract; -- Getter of Classifier::collaborationUse. -- -- References the collaboration uses owned by the classifier. not overriding function Get_Feature (Self : not null access constant UML_Classifier) return AMF.UML.Features.Collections.Set_Of_UML_Feature is abstract; -- Getter of Classifier::feature. -- -- Specifies each feature defined in the classifier. -- Note that there may be members of the Classifier that are of the type -- Feature but are not included in this association, e.g. inherited -- features. not overriding function Get_General (Self : not null access constant UML_Classifier) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of Classifier::general. -- -- Specifies the general Classifiers for this Classifier. -- References the general classifier in the Generalization relationship. not overriding function Get_Generalization (Self : not null access constant UML_Classifier) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is abstract; -- Getter of Classifier::generalization. -- -- Specifies the Generalization relationships for this Classifier. These -- Generalizations navigaten to more general classifiers in the -- generalization hierarchy. not overriding function Get_Inherited_Member (Self : not null access constant UML_Classifier) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Getter of Classifier::inheritedMember. -- -- Specifies all elements inherited by this classifier from the general -- classifiers. not overriding function Get_Is_Abstract (Self : not null access constant UML_Classifier) return Boolean is abstract; -- Getter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. not overriding procedure Set_Is_Abstract (Self : not null access UML_Classifier; To : Boolean) is abstract; -- Setter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. not overriding function Get_Is_Final_Specialization (Self : not null access constant UML_Classifier) return Boolean is abstract; -- Getter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. not overriding procedure Set_Is_Final_Specialization (Self : not null access UML_Classifier; To : Boolean) is abstract; -- Setter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. not overriding function Get_Owned_Template_Signature (Self : not null access constant UML_Classifier) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is abstract; -- Getter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. not overriding procedure Set_Owned_Template_Signature (Self : not null access UML_Classifier; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is abstract; -- Setter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. not overriding function Get_Owned_Use_Case (Self : not null access constant UML_Classifier) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is abstract; -- Getter of Classifier::ownedUseCase. -- -- References the use cases owned by this classifier. not overriding function Get_Powertype_Extent (Self : not null access constant UML_Classifier) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is abstract; -- Getter of Classifier::powertypeExtent. -- -- Designates the GeneralizationSet of which the associated Classifier is -- a power type. not overriding function Get_Redefined_Classifier (Self : not null access constant UML_Classifier) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Getter of Classifier::redefinedClassifier. -- -- References the Classifiers that are redefined by this Classifier. not overriding function Get_Representation (Self : not null access constant UML_Classifier) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is abstract; -- Getter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. not overriding procedure Set_Representation (Self : not null access UML_Classifier; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is abstract; -- Setter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. not overriding function Get_Substitution (Self : not null access constant UML_Classifier) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is abstract; -- Getter of Classifier::substitution. -- -- References the substitutions that are owned by this Classifier. not overriding function Get_Template_Parameter (Self : not null access constant UML_Classifier) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is abstract; -- Getter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. not overriding procedure Set_Template_Parameter (Self : not null access UML_Classifier; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is abstract; -- Setter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. not overriding function Get_Use_Case (Self : not null access constant UML_Classifier) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is abstract; -- Getter of Classifier::useCase. -- -- The set of use cases for which this Classifier is the subject. not overriding function All_Features (Self : not null access constant UML_Classifier) return AMF.UML.Features.Collections.Set_Of_UML_Feature is abstract; -- Operation Classifier::allFeatures. -- -- The query allFeatures() gives all of the features in the namespace of -- the classifier. In general, through mechanisms such as inheritance, -- this will be a larger set than feature. not overriding function All_Parents (Self : not null access constant UML_Classifier) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Operation Classifier::allParents. -- -- The query allParents() gives all of the direct and indirect ancestors -- of a generalized Classifier. not overriding function Conforms_To (Self : not null access constant UML_Classifier; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is abstract; -- Operation Classifier::conformsTo. -- -- The query conformsTo() gives true for a classifier that defines a type -- that conforms to another. This is used, for example, in the -- specification of signature conformance for operations. not overriding function General (Self : not null access constant UML_Classifier) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Operation Classifier::general. -- -- The general classifiers are the classifiers referenced by the -- generalization relationships. not overriding function Has_Visibility_Of (Self : not null access constant UML_Classifier; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is abstract; -- Operation Classifier::hasVisibilityOf. -- -- The query hasVisibilityOf() determines whether a named element is -- visible in the classifier. By default all are visible. It is only -- called when the argument is something owned by a parent. not overriding function Inherit (Self : not null access constant UML_Classifier; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Operation Classifier::inherit. -- -- The query inherit() defines how to inherit a set of elements. Here the -- operation is defined to inherit them all. It is intended to be -- redefined in circumstances where inheritance is affected by -- redefinition. -- The inherit operation is overridden to exclude redefined properties. not overriding function Inheritable_Members (Self : not null access constant UML_Classifier; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Operation Classifier::inheritableMembers. -- -- The query inheritableMembers() gives all of the members of a classifier -- that may be inherited in one of its descendants, subject to whatever -- visibility restrictions apply. not overriding function Inherited_Member (Self : not null access constant UML_Classifier) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is abstract; -- Operation Classifier::inheritedMember. -- -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. overriding function Is_Template (Self : not null access constant UML_Classifier) return Boolean is abstract; -- Operation Classifier::isTemplate. -- -- The query isTemplate() returns whether this templateable element is -- actually a template. not overriding function May_Specialize_Type (Self : not null access constant UML_Classifier; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean is abstract; -- Operation Classifier::maySpecializeType. -- -- The query maySpecializeType() determines whether this classifier may -- have a generalization relationship to classifiers of the specified -- type. By default a classifier may specialize classifiers of the same or -- a more general type. It is intended to be redefined by classifiers that -- have different specialization constraints. not overriding function Parents (Self : not null access constant UML_Classifier) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is abstract; -- Operation Classifier::parents. -- -- The query parents() gives all of the immediate ancestors of a -- generalized Classifier. end AMF.UML.Classifiers;
programs/oeis/047/A047497.asm
karttu/loda
1
85716
; A047497: Numbers that are congruent to {1, 2, 4, 5, 7} mod 8. ; 1,2,4,5,7,9,10,12,13,15,17,18,20,21,23,25,26,28,29,31,33,34,36,37,39,41,42,44,45,47,49,50,52,53,55,57,58,60,61,63,65,66,68,69,71,73,74,76,77,79,81,82,84,85,87,89,90,92,93,95,97,98,100,101,103,105,106,108,109,111,113,114,116,117,119,121,122,124,125,127,129,130,132,133,135,137,138,140,141,143,145,146,148,149,151,153,154,156,157,159,161,162,164,165,167,169,170,172,173,175,177,178,180,181,183,185,186,188,189,191,193,194,196,197,199,201,202,204,205,207,209,210,212,213,215,217,218,220,221,223,225,226,228,229,231,233,234,236,237,239,241,242,244,245,247,249,250,252,253,255,257,258,260,261,263,265,266,268,269,271,273,274,276,277,279,281,282,284,285,287,289,290,292,293,295,297,298,300,301,303,305,306,308,309,311,313,314,316,317,319,321,322,324,325,327,329,330,332,333,335,337,338,340,341,343,345,346,348,349,351,353,354,356,357,359,361,362,364,365,367,369,370,372,373,375,377,378,380,381,383,385,386,388,389,391,393,394,396,397,399 mov $1,$0 mul $1,8 div $1,5 add $1,1
src/main/gov/nasa/jpf/abstraction/grammar/Interpolants.g4
d3sformal/panda
0
3555
grammar Interpolants; @header { import java.util.AbstractMap; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import gov.nasa.jpf.vm.ElementInfo; import gov.nasa.jpf.vm.ThreadInfo; import gov.nasa.jpf.abstraction.PandaConfig; import gov.nasa.jpf.abstraction.PredicateAbstraction; import gov.nasa.jpf.abstraction.common.*; import gov.nasa.jpf.abstraction.common.impl.*; import gov.nasa.jpf.abstraction.common.access.*; import gov.nasa.jpf.abstraction.common.access.impl.*; import gov.nasa.jpf.abstraction.common.access.meta.*; import gov.nasa.jpf.abstraction.common.access.meta.impl.*; import gov.nasa.jpf.abstraction.concrete.*; import gov.nasa.jpf.abstraction.smt.*; import gov.nasa.jpf.abstraction.state.universe.*; import gov.nasa.jpf.abstraction.util.*; } @members{ } predicates returns [Predicate[] val] : '(' p=predicatelist ')' { $ctx.val = $p.val; } ; predicatelist returns [Predicate[] val] : /* EMPTY */ { $ctx.val = new Predicate[0]; } | ps=predicatelist p=predicate { $ctx.val = new Predicate[$ps.val.length + 1]; for (int i = 0; i < $ps.val.length; ++i) { $ctx.val[i] = $ps.val[i]; } $ctx.val[$ps.val.length] = $p.val; } ; letpair returns [Map.Entry<String, Object> val] : '(' '.' v=ID_TOKEN e=expression ')' { $ctx.val = new AbstractMap.SimpleEntry<String, Object>($v.text, $e.val); } | '(' v=ID_TOKEN '!' n=CONSTANT_TOKEN e=expression ')' { $ctx.val = new AbstractMap.SimpleEntry<String, Object>($v.text + '!' + Integer.parseInt($n.text), $e.val); } | '(' '.' v=ID_TOKEN p=predicate ')' { $ctx.val = new AbstractMap.SimpleEntry<String, Object>($v.text, $p.val); } | '(' v=ID_TOKEN '!' n=CONSTANT_TOKEN p=predicate ')' { $ctx.val = new AbstractMap.SimpleEntry<String, Object>($v.text + '!' + Integer.parseInt($n.text), $p.val); } ; standalonepredicate returns [Predicate val] : p=predicate { $ctx.val = $p.val; } ; qvar returns [String val] : '%' {$ctx.val = "%";} n=CONSTANT_TOKEN {$ctx.val += $n.text;} ( '!' {$ctx.val += "!";} m=CONSTANT_TOKEN {$ctx.val += $m.text;} )* ; predicate returns [Predicate val] locals [static ScopedDefineMap let = new ScopedDefineMap(); Predicate acc;] : '.' id=ID_TOKEN { $ctx.val = (Predicate) PredicateContext.let.get($id.text); } | id=ID_TOKEN '!' n=CONSTANT_TOKEN { $ctx.val = (Predicate) PredicateContext.let.get($id.text + '!' + Integer.parseInt($n.text)); } | '(' LET_TOKEN {PredicateContext.let.enterNested();} '(' (l=letpair {PredicateContext.let.put($l.val.getKey(), $l.val.getValue());})* ')' p=predicate ')' { PredicateContext.let.exitNested(); $ctx.val = $p.val; } | TRUE_TOKEN { $ctx.val = Tautology.create(); } | FALSE_TOKEN { $ctx.val = Contradiction.create(); } | '(' AND_TOKEN ((p=predicate {$ctx.acc = $p.val;}) | (qv=qvar {$ctx.acc = (Predicate) PredicateContext.let.get($qv.val);})) ((q=predicate {$ctx.acc = Conjunction.create($ctx.acc, $q.val);}) | ( qv=qvar {$ctx.acc = Conjunction.create($ctx.acc, (Predicate) PredicateContext.let.get($qvar.val));} ))+ ')' { $ctx.val = $ctx.acc; } | '(' OR_TOKEN ((p=predicate {$ctx.acc = $p.val;}) | (qv=qvar {$ctx.acc = (Predicate) PredicateContext.let.get($qv.val);})) ((q=predicate {$ctx.acc = Disjunction.create($ctx.acc, $q.val);}) | ( qv=qvar {$ctx.acc = Disjunction.create($ctx.acc, (Predicate) PredicateContext.let.get($qvar.val));} ))+ ')' { $ctx.val = $ctx.acc; } | '(' NOT_TOKEN p=predicate ')' { $ctx.val = Negation.create($p.val); } | '(' ITE_TOKEN p=predicate q=predicate r=predicate ')' { $ctx.val = Disjunction.create(Conjunction.create($p.val, $q.val), Conjunction.create(Negation.create($p.val), $r.val)); } | '(' FORALL_TOKEN {PredicateContext.let.enterNested(); String vars = "";} '(' ( '(' qv=qvar TYPE_TOKEN ')' {vars += " " + $qvar.val; PredicateContext.let.put($qvar.val, DefaultRoot.create($qvar.val));} )+ ')' '(' '!' p=predicate ( ':pattern' '(' expression+ ')' )* ':qid' 'itp' ')' ')' { PredicateContext.let.exitNested(); if (PandaConfig.getInstance().enabledVerbose(this.getClass())) { InterpolantExtractor.println("[WARNING] Omitting quantifier in FOR ALL" + vars + ": " + $p.val); } // Collect values that the quantified variables may possess Map<Root, Set<Expression>> eqOptions = new HashMap<Root, Set<Expression>>(); InterpolantExtractor.collectQuantifiedVarValues($p.val, eqOptions); Predicate p = InterpolantExtractor.expandQuantifiedVars($p.val, eqOptions); if (PandaConfig.getInstance().enabledVerbose(this.getClass())) { InterpolantExtractor.println("[WARNING] Expanding quantified formula FOR ALL" + vars + " using " + eqOptions + ": "); System.out.print("[WARNING] \t\t"); InterpolantExtractor.println(p.toString()); } $ctx.val = p; } | '(' EXISTS_TOKEN {PredicateContext.let.enterNested(); String vars = "";} '(' ( '(' qv=qvar TYPE_TOKEN ')' {vars += " " + $qvar.val; PredicateContext.let.put($qvar.val, DefaultRoot.create($qvar.val));} )+ ')' '(' '!' p=predicate ( ':pattern' '(' expression+ ')' )* ':qid' 'itp' ')' ')' { PredicateContext.let.exitNested(); if (PandaConfig.getInstance().enabledVerbose(this.getClass())) { InterpolantExtractor.println("[WARNING] Omitting quantifier in EXISTS " + vars + ": " + $p.val); } // Collect values that the quantified variables may possess Map<Root, Set<Expression>> eqOptions = new HashMap<Root, Set<Expression>>(); InterpolantExtractor.collectQuantifiedVarValues($p.val, eqOptions); Predicate p = InterpolantExtractor.expandQuantifiedVars($p.val, eqOptions); if (PandaConfig.getInstance().enabledVerbose(this.getClass())) { InterpolantExtractor.println("[WARNING] Expanding quantified formula EXISTS" + vars + " using " + eqOptions + ": "); System.out.print("[WARNING] \t\t"); InterpolantExtractor.println(p.toString()); } $ctx.val = p; } | '(=>' p=predicate q=predicate ')' { $ctx.val = Disjunction.create(Negation.create($p.val), $q.val); } | '(=' '.' id1=ID_TOKEN '.' id2=ID_TOKEN ')' { Object o1 = PredicateContext.let.get($id1.text); Object o2 = PredicateContext.let.get($id2.text); if (o1 instanceof Predicate && o2 instanceof Predicate) { Predicate p = (Predicate) o1; Predicate q = (Predicate) o2; $ctx.val = Disjunction.create(Conjunction.create(p, q), Conjunction.create(Negation.create(p), Negation.create(q))); } if (o1 instanceof Expression && o2 instanceof Expression) { Expression a = (Expression) o1; Expression b = (Expression) o2; $ctx.val = InterpolantExtractor.eq(a, b); } } | '(=' id1=ID_TOKEN '!' n1=CONSTANT_TOKEN id2=ID_TOKEN '!' n2=CONSTANT_TOKEN ')' { Object o1 = PredicateContext.let.get($id1.text + '!' + Integer.parseInt($n1.text)); Object o2 = PredicateContext.let.get($id2.text + '!' + Integer.parseInt($n2.text)); if (o1 instanceof Predicate && o2 instanceof Predicate) { Predicate p = (Predicate) o1; Predicate q = (Predicate) o2; $ctx.val = Disjunction.create(Conjunction.create(p, q), Conjunction.create(Negation.create(p), Negation.create(q))); } if (o1 instanceof Expression && o2 instanceof Expression) { Expression a = (Expression) o1; Expression b = (Expression) o2; $ctx.val = InterpolantExtractor.eq(a, b); } } | '(=' p=predicate q=predicate ')' { $ctx.val = Disjunction.create(Conjunction.create($p.val, $q.val), Conjunction.create(Negation.create($p.val), Negation.create($q.val))); } | '(' DISTINCT_TOKEN a=expression b=expression ')' { $ctx.val = Negation.create(InterpolantExtractor.eq($a.val, $b.val)); } | '(=' a=expression b=expression ')' { $ctx.val = InterpolantExtractor.eq($a.val, $b.val); } | '(=' arr=ARR_TOKEN b=expression ')' { $ctx.val = InterpolantExtractor.eq(DefaultArrays.create(), $b.val); } | '(=' a=expression arr=ARR_TOKEN ')' { $ctx.val = InterpolantExtractor.eq(DefaultArrays.create(), $a.val); } | '(=' a=expression NULL_TOKEN ')' { $ctx.val = InterpolantExtractor.eq($a.val, NullExpression.create()); } | '(=' NULL_TOKEN b=expression ')' { $ctx.val = InterpolantExtractor.eq(NullExpression.create(), $b.val); } | NULL_TOKEN '=' NULL_TOKEN { $ctx.val = Tautology.create(); } | '(<' a=expression b=expression ')' { $ctx.val = InterpolantExtractor.lt($a.val, $b.val); } | '(>' a=expression b=expression ')' { $ctx.val = InterpolantExtractor.lt($b.val, $a.val); } | '(<=' a=expression b=expression ')' { $ctx.val = InterpolantExtractor.lt($b.val, $a.val); } | '(>=' a=expression b=expression ')' { $ctx.val = InterpolantExtractor.lt($a.val, $b.val); } | '(=' ARRLEN_TOKEN ARRLEN_TOKEN ')' { $ctx.val = Tautology.create(); } ; expression returns [Expression val] locals [Expression acc] : t=term { $ctx.val = $t.val; } | '(+' a=term {$ctx.acc = $a.val;} (b=term {$ctx.acc = Add.create($ctx.acc, $b.val);})+ ')' { $ctx.val = $ctx.acc; } | '(-' a=term b=term ')' { $ctx.val = Subtract.create($a.val, $b.val); } ; term returns [Expression val] : f=factor { $ctx.val = $f.val; } | '(*' a=factor {Expression e = $a.val;} (b=factor {e = Multiply.create(e, $b.val);})+ ')' { $ctx.val = e; } | '(/' a=factor b=factor ')' { $ctx.val = Divide.create($a.val, $b.val); } ; factor returns [Expression val] : '.' id=ID_TOKEN { $ctx.val = (Expression) PredicateContext.let.get($id.text); } | id=ID_TOKEN '!' n=CONSTANT_TOKEN { $ctx.val = (Expression) PredicateContext.let.get($id.text + '!' + Integer.parseInt($n.text)); } | qv=qvar { $ctx.val = (Expression) PredicateContext.let.get($qvar.val); } | CONSTANT_TOKEN { $ctx.val = Constant.create(Integer.parseInt($CONSTANT_TOKEN.text)); } | '(' SELECT_TOKEN ARRLEN_TOKEN p=path ')' { $ctx.val = DefaultArrayLengthRead.create($p.val); } | '(' SELECT_TOKEN ARRLEN_TOKEN qv=qvar ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($qvar.val); $ctx.val = DefaultArrayLengthRead.create(ae); } | p=path { $ctx.val = $p.val; } | '(' ITE_TOKEN pCond=predicate e1=expression e2=expression ')' { $ctx.val = IfThenElse.create($pCond.val, $e1.val, $e2.val); } | '(' ITE_TOKEN eCond=expression e1=expression e2=expression ')' { $ctx.val = IfThenElse.create($eCond.val, $e1.val, $e2.val); } | '(' REF_TOKEN p=path ')' { if ($p.val instanceof AnonymousObject) { AnonymousObject ao = (AnonymousObject) $p.val; $ctx.val = Constant.create(ao.getReference().getReferenceNumber()); } else { $ctx.val = $p.val; } } | '(' e=expression ')' { $ctx.val = $e.val; } | '(-' e=expression ')' { $ctx.val = Subtract.create(Constant.create(0), $e.val); } ; path returns [DefaultAccessExpression val] : f=FRESH_TOKEN { int refId = Integer.parseInt($f.text.replaceAll("^fresh_", "")); ElementInfo ei = ThreadInfo.getCurrentThread().getElementInfo(refId); Reference ref = new Reference(ei); Universe u = PredicateAbstraction.getInstance().getSymbolTable().getUniverse(); StructuredValue v = u.get(ref); if (v instanceof UniverseArray) { UniverseArray a = (UniverseArray) v; $ctx.val = AnonymousArray.create(ref, Constant.create(a.getLength())); } else { $ctx.val = AnonymousObject.create(new Reference(ei)); } } | f=RETURN_TOKEN { String r = $f.text.replaceAll("var_ssa_[0-9]+_frame_[0-9]+_", ""); if (r.equals("return")) { $ctx.val = DefaultReturnValue.create(); } else { $ctx.val = DefaultReturnValue.create(r); } } | f=CLASS_TOKEN { $ctx.val = DefaultPackageAndClass.create($f.text.substring("class_".length()).replaceAll("_", ".")); } | f=ID_TOKEN { $ctx.val = DefaultRoot.create($f.text.replaceAll("var_ssa_[0-9]+_frame_[0-9]+_", "")); } | '(' SELECT_TOKEN '.' id=ID_TOKEN e=expression ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($id.text); $ctx.val = Select.create(ae, $e.val); } | '(' SELECT_TOKEN id=ID_TOKEN '!' n=CONSTANT_TOKEN e=expression ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($id.text + '!' + Integer.parseInt($n.text)); $ctx.val = Select.create(ae, $e.val); } | '(' SELECT_TOKEN a=ARR_TOKEN id=ID_TOKEN '!' n=CONSTANT_TOKEN ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($id.text + '!' + Integer.parseInt($n.text)); $ctx.val = Select.create(ae); } | '(' SELECT_TOKEN a=ARR_TOKEN '.' id=ID_TOKEN ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($id.text); $ctx.val = Select.create(ae); } | '(' SELECT_TOKEN a=ARR_TOKEN p=path ')' { $ctx.val = Select.create($p.val); } | '(' SELECT_TOKEN a=ARR_TOKEN qv=qvar ')' { AccessExpression ae = (AccessExpression) PredicateContext.let.get($qvar.val); $ctx.val = Select.create(ae); } | '(' SELECT_TOKEN p=path e=expression ')' { $ctx.val = Select.create($p.val, $e.val); } | '(' STORE_TOKEN p=path e1=expression e2=expression ')' { $ctx.val = Store.create($p.val, $e1.val, $e2.val); } | '(' STORE_TOKEN a=ARR_TOKEN p1=path p2=path ')' { $ctx.val = Store.create($p1.val, $p2.val); } | '(' STORE_TOKEN a=ARR_TOKEN p1=path '.' id=ID_TOKEN ')' { AccessExpression e = (DefaultAccessExpression) PredicateContext.let.get($id.text); $ctx.val = Store.create($p1.val, e); } | '(' STORE_TOKEN a=ARR_TOKEN p1=path id=ID_TOKEN '!' n=CONSTANT_TOKEN ')' { AccessExpression e = (DefaultAccessExpression) PredicateContext.let.get($id.text + '!' + Integer.parseInt($n.text)); $ctx.val = Store.create($p1.val, e); } | '(' STORE_TOKEN f=ID_TOKEN p=path e=expression ')' { $ctx.val = DefaultObjectFieldWrite.create($p.val, $f.text.replaceAll("field_ssa_[0-9]+_", ""), $e.val); } ; AND_TOKEN : 'and'; ARR_TOKEN : 'ssa_'[0-9]+'_arr'; ARRLEN_TOKEN : 'arr<PASSWORD>'; CLASS_TOKEN : 'class_'[a-zA-Z0-9_$]+; DISTINCT_TOKEN : 'distinct'; EXISTS_TOKEN : 'exists'; FALSE_TOKEN : 'false'; //FIELD_TOKEN : 'field_ssa_'[0-9]+'_'[a-zA-Z$_][a-zA-Z0-9$_]*; // FIELD_TOKEN could appear in equalities and we don't have the machinery for that FORALL_TOKEN : 'forall'; FRESH_TOKEN : 'fresh_'[0-9]+; INIT_TOKEN : '<init>'; ITE_TOKEN : 'ite'; LET_TOKEN : 'let'; NOT_TOKEN : 'not'; NULL_TOKEN : 'null'; OR_TOKEN : 'or'; REF_TOKEN : 'ref'; RETURN_TOKEN : 'var_ssa_'[0-9]+'_frame_'[0-9]+'_return'('_pc'[0-9]+)?; SELECT_TOKEN : 'select'; STORE_TOKEN : 'store'; TRUE_TOKEN : 'true'; TYPE_TOKEN : 'Int'; CONSTANT_TOKEN : [-+]?'0'('.'[0-9]+)? | [-+]?[1-9][0-9]*('.'[0-9]+)? ; ID_TOKEN : [a-zA-Z$_][a-zA-Z0-9$_]* ; WS_TOKEN : ([ \t\n\r])+ -> channel(HIDDEN) ;
alloy4fun_models/trashltl/models/7/GAFXr9NPRpEvWCWot.als
Kaixi26/org.alloytools.alloy
0
940
<gh_stars>0 open main pred idGAFXr9NPRpEvWCWot_prop8 { always (some f : link.File | eventually f in Trash) } pred __repair { idGAFXr9NPRpEvWCWot_prop8 } check __repair { idGAFXr9NPRpEvWCWot_prop8 <=> prop8o }
libsrc/sms/aplib_depack.asm
meesokim/z88dk
0
25335
<filename>libsrc/sms/aplib_depack.asm PUBLIC aplib_depack EXTERN aPLibMemory_bits EXTERN aPLibMemory_byte EXTERN aPLibMemory_LWM EXTERN aPLibMemory_R0 ;============================================================== ; aplib_depack(unsigned char *src, unsigned char *dest) ;============================================================== ; Uncompresses data previously compressed with apLib ;============================================================== .aplib_depack ld hl, 2 add hl, sp ld e, (hl) ; Destination address inc hl ld d, (hl) inc hl ld a, (hl) ; Source address inc hl ld h, (hl) ld l, a jp depack ; Usage: ; ; .include this file in your code ; somewhere after that, an aPLibMemoryStruct called aPLibMemory must be defined somewhere in RAM ; ie. "aPLibMemory instanceof aPLibMemoryStruct" inside a .ramsection or .enum ; ; Then do ; ; ld hl,<source address> ; ld de,<destination address> ; call depack ; ; In my tests, depack() used a maximum of 12 bytes of stack, but this may vary with different data. ; This file is using WLA-DX syntax quite heavily, you'd better use it too... ;.struct aPLibMemoryStruct ;bits db ;byte db ; not directly referenced, assumed to come after bits ;LWM db ;R0 dw ;.endst ; Reader's note: ; The structure of the code has been arranged such that the entry point is in the middle - ; this is so it can use jr to branch out to the various subsections to save a few bytes, ; but it makes it somewhat harder to read. "depack" is the entry point and "aploop" is ; the main loop. ; Subsections which are only referenced by calls are defined in separate .sections to enable ; better code packing in the output (more finely divided blobs). ; More optimisations may be possible; in general, size optimisations are favoured over speed. .ap_getbit push bc ld bc,(aPLibMemory_bits) rrc c jr nc,ap_getbit_continue ld b,(hl) inc hl .ap_getbit_continue ld a,c and b ld (aPLibMemory_bits),bc pop bc ret .ap_getbitbc ;doubles BC and adds the read bit sla c rl b call ap_getbit ret z inc bc ret .ap_getgamma ld bc,1 .ap_getgammaloop call ap_getbitbc call ap_getbit jr nz,ap_getgammaloop ret .apbranch2 ;use a gamma code * 256 for offset, another gamma code for length call ap_getgamma dec bc dec bc ld a,(aPLibMemory_LWM) or a jr nz,ap_not_LWM ;bc = 2? ; Maxim: I think he means 0 ld a,b or c jr nz,ap_not_zero_gamma ;if gamma code is 2, use old R0 offset, and a new gamma code for length call ap_getgamma push hl ld h,d ld l,e push bc ld bc,(aPLibMemory_R0) sbc hl,bc pop bc ldir pop hl jr ap_finishup .ap_not_zero_gamma dec bc .ap_not_LWM ;do I even need this code? ; Maxim: seems so, it's broken without it ;bc=bc*256+(hl), lazy 16bit way ld b,c ld c,(hl) inc hl ld (aPLibMemory_R0),bc push bc call ap_getgamma ex (sp),hl ;bc = len, hl=offs push de ex de,hl ;some comparison junk for some reason ; Maxim: optimised to use add instead of sbc ld hl,-32000 add hl,de jr nc,skip1 inc bc .skip1 ld hl,-1280 add hl,de jr nc,skip2 inc bc .skip2 ld hl,-128 add hl,de jr c,skip3 inc bc inc bc .skip3 ;bc = len, de = offs, hl=junk pop hl push hl or a sbc hl,de pop de ;hl=dest-offs, bc=len, de = dest ldir pop hl .ap_finishup ld a,1 ld (aPLibMemory_LWM),a jr aploop .apbranch1 ; Maxim: moved this one closer to where it's jumped from to allow jr to work and save 2 bytes ldi xor a ld (aPLibMemory_LWM),a jr aploop .depack ;hl = source ;de = dest ldi xor a ld (aPLibMemory_LWM),a inc a ld (aPLibMemory_bits),a .aploop call ap_getbit jr z, apbranch1 call ap_getbit jr z, apbranch2 call ap_getbit jr z, apbranch3 ;LWM = 0 xor a ld (aPLibMemory_LWM),a ;get an offset ld bc,0 call ap_getbitbc call ap_getbitbc call ap_getbitbc call ap_getbitbc ld a,b or c jr nz,apbranch4 ; xor a ;write a 0 ; Maxim: a is zero already (just failed nz test), optimise this line away ld (de),a inc de jr aploop .apbranch4 ex de,hl ;write a previous bit (1-15 away from dest) push hl sbc hl,bc ld a,(hl) pop hl ld (hl),a inc hl ex de,hl jr aploop .apbranch3 ;use 7 bit offset, length = 2 or 3 ;if a zero is encountered here, it's EOF ld c,(hl) inc hl rr c ret z ld b,2 jr nc,ap_dont_inc_b inc b .ap_dont_inc_b ;LWM = 1 ld a,1 ld (aPLibMemory_LWM),a push hl ld a,b ld b,0 ;R0 = c ld (aPLibMemory_R0),bc ld h,d ld l,e or a sbc hl,bc ld c,a ldir pop hl jr aploop
source/amf/uml/amf-uml-expansion_regions-collections.ads
svn2github/matreshka
24
24321
<filename>source/amf/uml/amf-uml-expansion_regions-collections.ads ------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.UML.Expansion_Regions.Collections is pragma Preelaborate; package UML_Expansion_Region_Collections is new AMF.Generic_Collections (UML_Expansion_Region, UML_Expansion_Region_Access); type Set_Of_UML_Expansion_Region is new UML_Expansion_Region_Collections.Set with null record; Empty_Set_Of_UML_Expansion_Region : constant Set_Of_UML_Expansion_Region; type Ordered_Set_Of_UML_Expansion_Region is new UML_Expansion_Region_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_UML_Expansion_Region : constant Ordered_Set_Of_UML_Expansion_Region; type Bag_Of_UML_Expansion_Region is new UML_Expansion_Region_Collections.Bag with null record; Empty_Bag_Of_UML_Expansion_Region : constant Bag_Of_UML_Expansion_Region; type Sequence_Of_UML_Expansion_Region is new UML_Expansion_Region_Collections.Sequence with null record; Empty_Sequence_Of_UML_Expansion_Region : constant Sequence_Of_UML_Expansion_Region; private Empty_Set_Of_UML_Expansion_Region : constant Set_Of_UML_Expansion_Region := (UML_Expansion_Region_Collections.Set with null record); Empty_Ordered_Set_Of_UML_Expansion_Region : constant Ordered_Set_Of_UML_Expansion_Region := (UML_Expansion_Region_Collections.Ordered_Set with null record); Empty_Bag_Of_UML_Expansion_Region : constant Bag_Of_UML_Expansion_Region := (UML_Expansion_Region_Collections.Bag with null record); Empty_Sequence_Of_UML_Expansion_Region : constant Sequence_Of_UML_Expansion_Region := (UML_Expansion_Region_Collections.Sequence with null record); end AMF.UML.Expansion_Regions.Collections;
kernel32.asm
satadriver/LiunuxOS_t
0
175693
<reponame>satadriver/LiunuxOS_t .686p include kutils.asm include kdevice32.asm include kintr.asm include kpower.asm include kvideo.asm include kmemory.asm include kdloader.asm Kernel Segment public para use32 assume cs:Kernel __kernel32Entry proc mov ax,rwData32Seg mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ss,ax mov eax,0 mov ecx,0 mov edx,0 mov ebx,0 mov esi,0 mov edi,0 mov esp,(KERNEL_TASK_STACK_BASE + KERNEL_TASK_STACK_SIZE - STACK_TOP_DUMMY) mov ebp,esp mov ebx,kernelData shl ebx,4 ;enable v86 vm db 0fh,20h,0e0h ;mov eax,cr4 or eax,1 ;vme or eax,10h or eax,2 ;or eax,40600h ;OSFXSR(bit9) and OSXMMEXCPT(bit10) and OSXSAVE(bit18) or eax,40600h db 0fh,22h,0e0h ;mov cr4,eax ;如果启动分页机制,在tss中必须传递cr3 call __startPage ;call __initCmosTimerTss ;call __initSysTimerTss CALL __initV86Tss ;注意类型定义和变量定义寻址的不同,类型定义的成员寻址是相对于定义的偏移,变量成员的寻址是变量的实际地址加上成员的偏移地址 mov ecx,SYSTEM_TSS_SIZE mov edi,CURRENT_TASK_TSS_BASE mov al,0 cld rep stosb mov word ptr ds:[CURRENT_TASK_TSS_BASE + TASKSTATESEG.mIomap],136 mov byte ptr ds:[CURRENT_TASK_TSS_BASE + TASKSTATESEG.mIomapEnd + 32 + 8192],0ffh MOV dword ptr ds:[CURRENT_TASK_TSS_BASE + TASKSTATESEG.mEsp0],TASKS_STACK0_BASE + TASK_STACK0_SIZE - STACK_TOP_DUMMY MOV dword ptr ds:[CURRENT_TASK_TSS_BASE + TASKSTATESEG.mSS0],rwData32Seg ;stackTssSeg mov dword ptr ds:[CURRENT_TASK_TSS_BASE + TASKSTATESEG.mCr3],PDE_ENTRY_VALUE mov eax,CURRENT_TASK_TSS_BASE mov word ptr ds:[ebx + kTssDescriptor + 2],ax shr eax,16 mov byte ptr ds:[ebx + kTssDescriptor + 4],al mov byte ptr ds:[ebx + kTssDescriptor + 7],ah mov word ptr ds:[ebx + kTssDescriptor ],SYSTEM_TSS_SIZE - 1 mov ax,kTssSelector ltr ax mov ax,ldtSelector lldt ax ;在P6以后的内核中,将紧跟着TSS正文的32字节解释为V86模式下的中断重定向位, ;如果存在IO映射表,那么紧跟着IO映射表的那个字节的位应全部为1,如果没有IO映射表,那么紧跟着中断重定向表的那个字节的位应全部为1,并将TSS偏移第65H处的字节置零 cmp word ptr ds:[ebx + _videoMode],VIDEO_MODE_3 jz _useKernelTextMode ;call __setDesktopBackground ;call __setTaskbarColor ;call __setTimerBackground ;call __mouseInit ;int 255 ;mov ax,kTssV86Selector ;call ax _useKernelTextMode: ;push dword ptr USER_TASK_DATA_BASE ;push dword ptr VSMAINDLL_LOAD_ADDRESS ;call __vsDllLoader ;add esp,8 ;cmp eax,0 ;jz _noDllEntryFunction push dword ptr KERNEL_DLL_BASE push dword ptr VSKDLL_LOAD_ADDRESS call __vsDllLoader ;mov ds:[ebx + _dllLoadAddr],eax add esp,8 cmp eax,0 jz _noDllEntryFunction mov eax,ebx add eax,offset _kernelDllEntryFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kernelDllEntry],eax mov eax,ebx add eax,offset _kTaskScheduleFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kTaskSchedule],eax mov eax,ebx add eax,offset _kDebuggerFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kDebugger],eax mov eax,ebx add eax,offset _kBreakPointFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kBreakPoint],eax mov eax,ebx add eax,offset _kSoundCardIntFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kSoundCardInt],eax mov eax,ebx add eax,offset _kPrintScreenFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kPrintScreen],eax mov eax,ebx add eax,offset _kscreenProtectFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kscreenProtect],eax mov eax,ebx add eax,offset _kCmosAlarmProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCmosAlarmProc],eax mov eax,ebx add eax,offset _kCom1ProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCom1Proc],eax mov eax,ebx add eax,offset _kCom2ProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCom2Proc],eax mov eax,ebx add eax,offset _kMouseProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kMouseProc],eax mov eax,ebx add eax,offset _kExceptionFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kException],eax mov eax,ebx add eax,offset _kCmosTimerFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCmosTimer],eax mov eax,ebx add eax,offset _kKbdProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kKbdProc],eax mov eax,ebx add eax,offset _kServicesProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kServicesProc],eax mov eax,ebx add eax,offset _kFloppyIntrProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kFloppyIntrProc],eax mov eax,ebx add eax,offset _kCoprocessorFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCoprocessor],eax mov eax,ebx add eax,offset _kCallGateProcFz push eax push dword ptr KERNEL_DLL_BASE call __getProcAddress add esp,8 mov ds:[ebx + _kCallGateProc],eax cmp dword ptr ds:[ebx + _kernelDllEntry],0 jz _noDllEntryFunction ;why not use push offset __V86ParamsProc? ;1 lea可以处理局部变量而 offset 则不能 ;2 假设要bx+10h->bx但又不想影响flag那就只能用lea bx,[bx+10h]了 mov eax,kernelData shl eax,4 add eax,offset _tssTimer push eax mov eax,Kernel shl eax,4 push eax mov eax,Kernel16 shl eax,4 push eax mov eax,kernelData shl eax,4 push eax mov eax,Kernel16 shl eax,4 add eax,offset __v86VMLeave push eax mov eax,Kernel16 shl eax,4 add eax,offset __v86VMIntrProc push eax push dword ptr ds:[ebx + _graphCharBase] mov eax,ebx add eax,offset _videoInfo push eax mov eax,ds:[ebx + _kernelDllEntry] call eax add esp,36 _noDllEntryFunction: sti _waitVsDll: hlt jmp _waitVsDll _kernel32MainLoop: ;中断(包括NMI和SMI),debug exception,BINIT# signal,INIT# signal,或者RESET# signal ;CPU的HALT状态,在APCI规范中,对应于CPU的C1状态,属于CPU睡眠状态中的最低级别,即最浅的睡眠 ;hlt will execute the next instructions after waked by interruptions hlt mov eax,KBD_SERVICE_PRINT int 80h cmp eax,0 jz _kernel32MainLoop cmp word ptr ds:[ebx + _videoMode],VIDEO_MODE_3 jz __kernelShowText ;ss 跟ds,es相同,ss:[esp] == ds:[esp] == es:[esp],所以不必担心数据找不到的问题 push dword ptr 0 push eax mov esi,esp push dword ptr VIDEOMODE_FONTCOLOR_NORMAL push esi call __vesaGraphStr add esp, 16 jmp _kernel32MainLoop __kernelShowText: push eax mov esi,esp push dword ptr TEXTMODE_FONTCOLOR_NORMAL push esi call __textModeShow32 add esp ,12 jmp _kernel32MainLoop __kernel32Entry endp __tmp32Entry proc db 0eah __kernel32EntryOffset dd 0 __kernel32EntrySelector dw reCode32Seg __tmp32Entry endp __kernel32Exit proc cli db 0eah dd offset _pmCode16Entry dw reCode16Seg __kernel32Exit endp __initSysTimerTss proc push ebp mov ebp,esp push ecx push edx push ebx push esi push edi sub esp,40h mov ebx,kernel shl ebx,4 mov eax,ebx add eax,offset __iSystemTimerProc mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEip],eax mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mCs],reCode32Seg ;任务的代码数据段可以相同,堆栈选择子也可以相同 MOV dword ptr DS:[TIMER_TSS_BASE + TASKSTATESEG.mEsp0],TSSTIMER_STACK0_TOP MOV dword ptr DS:[TIMER_TSS_BASE + TASKSTATESEG.mEsp],TSSTIMER_STACK_TOP MOV dword ptr DS:[TIMER_TSS_BASE + TASKSTATESEG.mEbp],TSSTIMER_STACK_TOP mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mSs0],rwData32Seg ;stackTimerSeg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mSs],rwData32Seg ;stackTimerSeg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mDs],rwData32Seg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEs],rwData32Seg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mFs],rwData32Seg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mGs],rwData32Seg mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEax],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEcx],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEdx],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEbx],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEsi],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEdi],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mPrev],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mEflags],0 mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mCr3],PDE_ENTRY_VALUE mov dword ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mLdt],0 mov word ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mTrap],0 mov word ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mIomap],104 mov byte ptr ds:[TIMER_TSS_BASE + TASKSTATESEG.mIomapEnd],0ffh mov ebx,kernelData shl ebx,2 mov eax,TIMER_TSS_BASE mov word ptr ds:[ebx + kTssTimerDescriptor + 2],ax shr eax,16 mov byte ptr ds:[ebx + kTssTimerDescriptor + 4],al mov byte ptr ds:[ebx + kTssTimerDescriptor + 7],ah mov word ptr ds:[ebx + kTssTimerDescriptor],sizeof TASKSTATESEG -1 mov ax,ktssTimerSelector mov word ptr ds:[ebx + iSysTimerEntry + 2],ax add esp,40h pop edi pop esi pop ebx pop edx pop ecx mov esp,ebp pop ebp ret __initSysTimerTss endp __initCmosTimerTss proc push ebp mov ebp,esp push ecx push edx push ebx push esi push edi sub esp,40h mov ebx,kernel shl ebx,4 mov eax,ebx add eax,offset __iCmosTimerProc mov ds:[CMOS_TSS_BASE + TASKSTATESEG.mEip],eax mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mCs],reCode32Seg MOV dword ptr DS:[CMOS_TSS_BASE + TASKSTATESEG.mEsp0],TSSCMOS_STACK0_TOP MOV dword ptr DS:[CMOS_TSS_BASE + TASKSTATESEG.mEsp],TSSCMOS_STACK_TOP MOV dword ptr DS:[CMOS_TSS_BASE + TASKSTATESEG.mEbp],TSSCMOS_STACK_TOP mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mSs0],rwData32Seg;stackCmosSeg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mSs],rwData32Seg;stackCmosSeg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mDs],rwData32Seg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEs],rwData32Seg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mFs],rwData32Seg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mGs],rwData32Seg mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEax],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEcx],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEdx],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEbx],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEsi],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEdi],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mPrev],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mEflags],0 mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mCr3],PDE_ENTRY_VALUE mov dword ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mLdt],0 mov word ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mTrap],0 mov word ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mIomap],104 mov byte ptr ds:[CMOS_TSS_BASE + TASKSTATESEG.mIomapEnd],0ffh mov ebx,kernelData shl ebx,2 mov eax,CMOS_TSS_BASE mov word ptr ds:[ebx + kTssCmosDescriptor + 2],ax shr eax,16 mov byte ptr ds:[ebx + kTssCmosDescriptor + 4],al mov byte ptr ds:[ebx + kTssCmosDescriptor + 7],ah mov word ptr ds:[ebx + kTssCmosDescriptor],sizeof TASKSTATESEG -1 mov ax,ktssCmosSelector mov word ptr ds:[ebx + iCMOSEntry + 2],ax add esp,40h pop edi pop esi pop ebx pop edx pop ecx mov esp,ebp pop ebp ret __initCmosTimerTss endp kernel ends ;tss descriptor G位== 0 说明长度可以大于等于104,D位无效,type中bit1代表是否busy,只能是89h或者8bh ;任务门描述符可以放在GDT,LDT和IDT中。任务门描述符中的TSS段选择符字段指向GDT中的TSS描述符。 ;在任务切换过程中,任务门描述符中DPL字段控制访问TSS描述符。当程序通过任务门调用和跳转到一个任务时,CPL和门选择符的RPL字段必须小于等于任务门描述符中的DPL。 ;中断和call引起的任务切换都可以通过iret指令返回。中断和call引起的任务切换都是所谓“嵌套式”任务切换。 ;从旧任务切换到新任务时,旧任务以TSS选择子的方式反向链接在新任务的TSS中,且新任务EFLAG中的NT(Nested Flag)位被置1。 ;同时,虽然CPU已经从旧任务切换到新任务,但是旧任务TSS中的B(Busy)位依然保持为1。 ;相比之下,jmp所引起的任务切换则“更像”是任务切换,它并不导致嵌套关系的发生。旧任务的B位清零,新任务EFLAG中的NT位被清零 ;目标任务的入口点由目标任务 TSS 内的 CS 和 EIP 字段所规定的指针确定 ;对于任务门所指向的 TSS 描述符的 DPL 不进行特权级检查 ;堆栈段使用的是 TSS 中的 SS和 SP 字段的值,而不是使用内层栈保存区中的指针,即使发生了向内层特权级的变换。这与任务内的通过调用门的转移不同 ;这条的意思是中断发生后,ss esp切换为tss中设置的ss esp而不是esp0,esp1,esp2或者ss0,ss1,ss2这三者中的任意一者 ;在执行 IRET 指令时引起任务切换,那么实施解链。要求目标任务是忙的任务。在切换过程中把原任务置为“可用”,目标任务仍保持“忙” ;在段间转移指令 JMP 引起任务切换时,不实施链接,不导致任务的嵌套。它要求目标任务是可用任务。切换过程中把原任务置为“可用”,目标任务置为“忙”。 ;在段间调用指令 CALL 引起任务切换时,实施链接,导致任务的嵌套。它要求目标任务是可用的任务。 ;在切换过程中把目标任务置为“忙”,原任务仍保持“忙”;标志寄存器 EFLAGS 中的 NT ;位被置为 1,表示任务是嵌套任务 ;TSS 的 busy 状态主要用来支持任务的嵌套。TSS descriptor 为 busy 状态时是不可进入执行的。同时防止 TSS 进程切换机制出现递归现象。 ;而使用 iret 指令,processor 将对 eflags.NT 进行检查 ;当任务创建时会创建静态字段,静态字段可读,不可写: ;(1)LDT段选择符字段 ;(2)CR3控制寄存器字段—包含任务使用的页目录的物理基地址。CR3也被称为page directory base register(PDBR)页目录基址寄存器。 ;(3)特权级0,1,2栈指针字段 ;(4)T标志(调试陷阱,100字节,位0)—如果设置,当切换任务时,会引起调试异常。 ;(5)I/O映射基址字段—是16位的偏移,包含从I/O权限位图和中断导向表中TSS的基地址。 ;在任务切换时,处理器并不自动保存协处理器的上下文,而是会设置TS标志。 ;这个标志会使得处理器在执行新任务指令流的任何时候遇到一条协处理器指令时产生设备不存在异常。 ;设备不存在异常的处理程序可使用CLTS指令清除TS标志,并且保存协处理器的上下文。
src/Categories/Category/Groupoid.agda
MirceaS/agda-categories
0
2649
{-# OPTIONS --without-K --safe #-} module Categories.Category.Groupoid where open import Level using (Level; suc; _⊔_) open import Categories.Category using (Category) import Categories.Morphism record IsGroupoid {o ℓ e} (C : Category o ℓ e) : Set (o ⊔ ℓ ⊔ e) where open Category C public open Categories.Morphism C infix 10 _⁻¹ field _⁻¹ : ∀ {A B} → A ⇒ B → B ⇒ A iso : ∀ {A B} {f : A ⇒ B} → Iso f (f ⁻¹) module iso {A B f} = Iso (iso {A} {B} {f}) equiv-obj : ∀ {A B} → A ⇒ B → A ≅ B equiv-obj f = record { from = f ; to = _ ; iso = iso } -- this definition doesn't seem to 'carry its weight' equiv-obj-sym : ∀ {A B} → A ⇒ B → B ≅ A equiv-obj-sym f = ≅.sym (equiv-obj f) -- A groupoid is a category that has a groupoid structure record Groupoid (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where field category : Category o ℓ e isGroupoid : IsGroupoid category open IsGroupoid isGroupoid public
Source/HBIOS/dskyng.asm
b1ackmai1er/RomWBW
1
26076
<filename>Source/HBIOS/dskyng.asm<gh_stars>1-10 ; ;================================================================================================== ; DSKYNG (DISPLAY AND KEYBOARD NEXT GENERATION) ROUTINES ;================================================================================================== ; ; A DSKYNG CAN SHARE A PPI BUS WITH EITHER A PPIDE OR PPISD. ; SEE PPI_BUS.TXT FOR MORE INFORMATION. ; ; LED SEGMENTS (BIT VALUES) ; ; +--01--+ ; 20 02 ; +--40--+ ; 10 04 ; +--08--+ 80 ; ; KEY CODE MAP (KEY CODES) CSCCCRRR ; |||||||| ; |||||+++-- ROW ; ||+++----- COL ; |+-------- SHIFT ; +--------- CONTROL ; ; 00 08 10 18 23 ; 01 09 11 19 22 ; 02 0A 12 1A 21 ; 03 0B 13 1B 20 ; 04 0C 14 1C SHIFT ; 05 0D 15 1D CTRL ; ; LED BIT MAP (BIT VALUES) ; ; $08 $09 $0A $0B $0C $0D $0E $0F ; --- --- --- --- --- --- --- --- ; 01 01 01 01 01 ; 02 02 02 02 02 ; 04 04 04 04 04 ; 08 08 08 08 08 ; 10 10 10 10 10 ; 20 20 20 20 20 L1 L2 BUZZ ; PPIA .EQU DSKYPPIBASE + 0 ; PORT A PPIB .EQU DSKYPPIBASE + 1 ; PORT B PPIC .EQU DSKYPPIBASE + 2 ; PORT C PPIX .EQU DSKYPPIBASE + 3 ; PPI CONTROL PORT ; DSKY_PPIX_RD: .EQU %10010010 ; PPIX VALUE FOR READS DSKY_PPIX_WR: .EQU %10000010 ; PPIX VALUE FOR WRITES ; ; PIO CHANNEL C: ; ; 7 6 5 4 3 2 1 0 ; RES 0 0 CS CS /RD /WR A0 ; ; SETTING BITS 3 & 4 WILL ASSERT /CS ON 3279 ; CLEAR BITS 1 OR 2 TO ASSERT READ/WRITE ; DSKY_PPI_IDLE: .EQU %00000110 ; DSKY_CMD_CLR: .EQU %11011111 ; CLEAR (ALL OFF) DSKY_CMD_CLRX: .EQU %11010011 ; CLEAR (ALL ON) DSKY_CMD_WDSP: .EQU %10010000 ; WRITE DISPLAY RAM DSKY_CMD_RDSP: .EQU %01110000 ; READ DISPLAY RAM DSKY_CMD_CLK: .EQU %00100000 ; SET CLK PRESCALE DSKY_CMD_FIFO: .EQU %01000000 ; READ FIFO ; DSKY_PRESCL: .EQU DSKYOSC/100000 ; PRESCALER ; ;__DSKY_PREINIT______________________________________________________________________________________ ; ; CONFIGURE PARALLEL PORT AND INITIALIZE 8279 ;____________________________________________________________________________________________________ ; ; ; HARDWARE RESET 8279 BY PULSING RESET LINE ; DSKY_PREINIT: ; CHECK FOR PPI CALL DSKY_PPIDETECT ; TEST FOR PPI HARDWARE RET NZ ; BAIL OUT IF NOT THERE ; SETUP PPI TO DEFAULT MODE CALL DSKY_PPIRD ; INIT 8279 VALUES TO IDLE STATE LD A,DSKY_PPI_IDLE OUT (PPIC),A ; PULSE RESET SIGNAL ON 8279 SET 7,A OUT (PPIC),A RES 7,A OUT (PPIC),A ; INITIALIZE 8279 CALL DSKY_REINIT ; NOW SEE IF A DSKYNG IS REALLY THERE... LD A,$A5 LD (DSKY_BUF),A LD HL,DSKY_BUF LD C,0 LD B,1 CALL DSKY_PUTSTR LD HL,DSKY_BUF LD C,0 LD B,1 CALL DSKY_GETSTR LD A,(DSKY_BUF) CP $A5 RET NZ ; BAIL OUT IF MISCOMPARE LD A,$FF LD (DSKY_PRESENT),A RET ; DSKY_REINIT: CALL DSKY_PPIIDLE ; SET CLOCK SCALER TO 20 LD A,DSKY_CMD_CLK | DSKY_PRESCL CALL DSKY_CMD ; FALL THRU ; DSKY_RESET: ; RESET DSKY -- CLEAR RAM AND FIFO LD A,DSKY_CMD_CLR CALL DSKY_CMD ; ; 8259 TAKES ~160US TO CLEAR RAM DURING WHICH TIME WRITES TO ; DISPLAY RAM ARE INHIBITED. HIGH BIT OF STATUS BYTE IS SET ; DURING THIS WINDOW. TO PREVENT A DEADLOCK, A LOOP COUNTER ; IS USED TO IMPLEMENT A TIMEOUT. LD B,0 ; TIMEOUT LOOP COUNTER DSKY_RESET1: PUSH BC ; SAVE COUNTER CALL DSKY_ST ; GET STATUS BYTE POP BC ; RECOVER COUNTER BIT 7,A ; BIT 7 IS DISPLAY RAM BUSY JR Z,DSKY_RESET2 ; MOVE ON IF DONE DJNZ DSKY_RESET1 ; LOOP TILL TIMEOUT ; DSKY_RESET2: RET ; ;__DSKY_INIT_________________________________________________________________________________________ ; ; DISPLAY DSKY INFO ;____________________________________________________________________________________________________ ; #IFDEF HBIOS ; DSKY_INIT: CALL NEWLINE ; FORMATTING PRTS("DSKY:$") ; FORMATTING ; PRTS(" IO=0x$") ; FORMATTING LD A,DSKYPPIBASE ; GET BASE PORT CALL PRTHEXBYTE ; PRINT BASE PORT PRTS(" MODE=$") ; FORMATTING PRTS("NG$") ; PRINT DSKY TYPE ; LD A,(DSKY_PRESENT) ; PRESENT? OR A ; SET FLAGS RET NZ ; YES, ALL DONE PRTS(" NOT PRESENT$") ; NOT PRESENT RET ; DONE ; #ENDIF ; ;__DSKY_PPIDETECT____________________________________________________________________________________ ; ; PROBE FOR PPI HARDWARE ;____________________________________________________________________________________________________ ; DSKY_PPIDETECT: ; ; TEST FOR PPI EXISTENCE ; WE SETUP THE PPI TO WRITE, THEN WRITE A VALUE OF ZERO ; TO PORT A (DATALO), THEN READ IT BACK. IF THE PPI IS THERE ; THEN THE BUS HOLD CIRCUITRY WILL READ BACK THE ZERO. SINCE ; WE ARE IN WRITE MODE, AN IDE CONTROLLER WILL NOT BE ABLE TO ; INTERFERE WITH THE VALUE BEING READ. CALL DSKY_PPIWR ; LD C,PPIA ; PPI PORT A XOR A ; VALUE ZERO OUT (C),A ; PUSH VALUE TO PORT IN A,(C) ; GET PORT VALUE OR A ; SET FLAGS RET ; AND RETURN ; #IFDEF DSKY_KBD ; KY_0 .EQU $00 KY_1 .EQU $01 KY_2 .EQU $02 KY_3 .EQU $03 KY_4 .EQU $04 KY_5 .EQU $05 KY_6 .EQU $06 KY_7 .EQU $07 KY_8 .EQU $08 KY_9 .EQU $09 KY_A .EQU $0A KY_B .EQU $0B KY_C .EQU $0C KY_D .EQU $0D KY_E .EQU $0E KY_F .EQU $0F KY_FW .EQU $10 ; FORWARD KY_BK .EQU $11 ; BACKWARD KY_CL .EQU $12 ; CLEAR KY_EN .EQU $13 ; ENTER KY_DE .EQU $14 ; DEPOSIT KY_EX .EQU $15 ; EXAMINE KY_GO .EQU $16 ; GO KY_BO .EQU $17 ; BOOT KY_F4 .EQU $18 ; F4 KY_F3 .EQU $19 ; F3 KY_F2 .EQU $20 ; F2 KY_F1 .EQU $21 ; F1 ; ;__DSKY_STAT_________________________________________________________________________________________ ; ; CHECK FOR KEY PRESS, SAVE RAW VALUE, RETURN STATUS ;____________________________________________________________________________________________________ ; DSKY_STAT: LD A,(DSKY_PRESENT) ; DOES IT EXIST? OR A ; SET FLAGS RET Z ; ABORT WITH A=0 IF NOT THERE CALL DSKY_ST AND $0F ; ISOLATE THE CUR FIFO LEN RET ; ;__DSKY_GETKEY_____________________________________________________________________________________ ; ; WAIT FOR A DSKY KEYPRESS AND RETURN ;____________________________________________________________________________________________________ ; DSKY_GETKEY: LD A,(DSKY_PRESENT) ; DOES IT EXIST? OR A ; SET FLAGS JR Z,DSKY_GETKEY1A ; ABORT IF NOT PRESENT CALL DSKY_STAT JR Z,DSKY_GETKEY ; LOOP IF NOTHING THERE LD A,DSKY_CMD_FIFO CALL DSKY_CMD CALL DSKY_DIN XOR %11000000 ; FLIP POLARITY OF SHIFT/CTL BITS PUSH AF ; SAVE VALUE AND $3F ; STRIP SHIFT/CTL BITS FOR LOOKUP LD B,28 ; SIZE OF DECODE TABLE LD C,0 ; INDEX LD HL,DSKY_KEYMAP ; POINT TO BEGINNING OF TABLE DSKY_GETKEY1: CP (HL) ; MATCH? JR Z,DSKY_GETKEY2 ; FOUND, DONE INC HL INC C ; BUMP INDEX DJNZ DSKY_GETKEY1 ; LOOP UNTIL EOT POP AF ; FIX STACK DSKY_GETKEY1A: LD A,$FF ; NOT FOUND ERR, RETURN $FF RET DSKY_GETKEY2: ; RETURN THE INDEX POSITION WHERE THE SCAN CODE WAS FOUND ; THE ORIGINAL SHIFT/CTRL BITS ARE RESTORED POP AF ; RESTORE RAW VALUE AND %11000000 ; ISOLATE SHIFT/CTRL BITS OR C ; COMBINE WITH INDEX VALUE RET ; ;_KEYMAP_TABLE_____________________________________________________________________________________________________________ ; DSKY_KEYMAP: ; POS $00 $01 $02 $03 $04 $05 $06 $07 ; KEY [0] [1] [2] [3] [4] [5] [6] [7] .DB $0D, $04, $0C, $14, $03, $0B, $13, $02 ; ; POS $08 $09 $0A $0B $0C $0D $0E $0F ; KEY [8] [9] [A] [B] [C] [D] [E] [F] .DB $0A, $12, $01, $09, $11, $00, $08, $10 ; ; POS $10 $11 $12 $13 $14 $15 $16 $17 ; KEY [FW] [BK] [CL] [EN] [DE] [EX] [GO] [BO] .DB $05, $15, $1D, $1C, $1B, $1A, $19, $18 ; POS $18 $19 $20 $21 ; KEY [F4] [F3] [F2] [F1] .DB $23, $22, $21, $20 ; #ENDIF ; DSKY_KBD ; ;================================================================================================== ; CONVERT 32 BIT BINARY TO 8 BYTE HEX SEGMENT DISPLAY ;================================================================================================== ; ; HL: ADR OF 32 BIT BINARY ; DE: ADR OF DEST LED SEGMENT DISPLAY BUFFER (8 BYTES) ; DSKY_BIN2SEG: PUSH HL PUSH DE LD B,4 ; 4 BYTES OF INPUT EX DE,HL DSKY_BIN2SEG1: LD A,(DE) ; FIRST NIBBLE SRL A SRL A SRL A SRL A PUSH HL LD HL,DSKY_HEXMAP CALL DSKY_ADDHLA LD A,(HL) POP HL LD (HL),A INC HL LD A,(DE) ; SECOND NIBBLE AND 0FH PUSH HL LD HL,DSKY_HEXMAP CALL DSKY_ADDHLA LD A,(HL) POP HL LD (HL),A INC HL INC DE ; NEXT BYTE DJNZ DSKY_BIN2SEG1 POP DE POP HL RET ; ;================================================================================================== ; DSKY SHOW BUFFER ; HL: ADDRESS OF BUFFER ;================================================================================================== ; DSKY_SHOW: LD C,0 ; STARTING DISPLAY POSITION LD B,DSKY_BUFLEN ; NUMBER OF CHARS JP DSKY_PUTSTR ; ;================================================================================================== ; DSKYNG OUTPUT ROUTINES ;================================================================================================== ; ; SEND DSKY COMMAND BYTE IN REGISTER A ; TRASHES BC ; DSKY_CMD: LD B,$01 JR DSKY_DOUT2 ; ; SEND DSKY DATA BYTE IN REGISTER A ; TRASHES BC ; DSKY_DOUT: LD B,$00 ; DSKY_DOUT2: ; ; SAVE INCOMING DATA BYTE PUSH AF ; ; SET PPI LINE CONFIG TO WRITE MODE CALL DSKY_PPIWR ; ; SETUP LD C,PPIC ; ; SET ADDRESS FIRST LD A,DSKY_PPI_IDLE OR B OUT (C),A ; ; ASSERT 8279 /CS SET 3,A SET 4,A OUT (C),A ; ; PPIC WORKING VALUE TO REG B NOW LD B,A ; ; ASSERT DATA BYTE VALUE POP AF OUT (PPIA),A ; ; PULSE /WR RES 1,B OUT (C),B NOP ; MAY NOT BE NEEDED SET 1,B OUT (C),B ; ; DEASSERT /CS RES 3,B RES 4,B OUT (C),B ; ; CLEAR ADDRESS BIT RES 0,B OUT (C),B ; ; DONE CALL DSKY_PPIIDLE RET ; ;================================================================================================== ; DSKYNG OUTPUT ROUTINES ;================================================================================================== ; ; RETURN DSKY STATUS VALUE IN A ; TRASHES BC ; DSKY_ST: LD B,$01 JR DSKY_DIN2 ; ; RETURN NEXT DATA VALUE IN A ; TRASHES BC ; DSKY_DIN: LD B,$00 ; DSKY_DIN2: ; SET PPI LINE CONFIG TO READ MODE CALL DSKY_PPIRD ; ; SETUP LD C,PPIC ; ; SET ADDRESS FIRST LD A,DSKY_PPI_IDLE OR B OUT (C),A ; ; ASSERT 8279 /CS SET 3,A SET 4,A OUT (C),A ; ; PPIC WORKING VALUE TO REG B NOW LD B,A ; ; ASSERT /RD RES 2,B OUT (C),B ; ; GET VALUE IN A,(PPIA) ; ; DEASSERT /RD SET 2,B OUT (C),B ; ; DEASSERT /CS RES 3,B RES 4,B OUT (C),B ; ; CLEAR ADDRESS BIT RES 0,B OUT (C),B ; ; DONE CALL DSKY_PPIIDLE RET ; ;================================================================================================== ; DSKYNG UTILITY ROUTINES ;================================================================================================== ; ; BLANK DSKYNG DISPLAY (WITHOUT USING CLEAR) ; DSKY_BLANK: LD A,DSKY_CMD_WDSP CALL DSKY_CMD LD B,16 DSKY_BLANK1: PUSH BC LD A,$FF CALL DSKY_DOUT POP BC DJNZ DSKY_BLANK1 RET ; ; WRITE A RAW BYTE VALUE TO DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, VALUE IN A. ; DSKY_PUTBYTE: PUSH BC PUSH AF LD A,C ADD A,DSKY_CMD_WDSP CALL DSKY_CMD POP AF XOR $FF CALL DSKY_DOUT POP BC RET ; ; READ A RAW BYTE VALUE FROM DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, VALUE RETURNED IN A ; DSKY_GETBYTE: PUSH BC LD A,C ADD A,DSKY_CMD_RDSP CALL DSKY_CMD CALL DSKY_DIN XOR $FF POP BC RET ; ; WRITE A STRING OF RAW BYTE VALUES TO DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. ; DSKY_PUTSTR: PUSH BC LD A,C ADD A,DSKY_CMD_WDSP CALL DSKY_CMD POP BC ; DSKY_PUTSTR1: LD A,(HL) XOR $FF INC HL PUSH BC CALL DSKY_DOUT POP BC DJNZ DSKY_PUTSTR1 RET ; ; READ A STRING OF RAW BYTE VALUES FROM DSKY DISPLAY RAM ; AT LOCATION IN REGISTER C, LENGTH IN B, ADDRESS IN HL. ; DSKY_GETSTR: PUSH BC LD A,C ADD A,DSKY_CMD_RDSP CALL DSKY_CMD POP BC ; DSKY_GETSTR1: PUSH BC CALL DSKY_DIN POP BC XOR $FF LD (HL),A INC HL DJNZ DSKY_GETSTR1 RET ; ; This function is intended to update the LEDs. It expects 8 bytes ; following the call, and updates the entire matrix. ; ; EXAMPLE: ; CALL DSKY_PUTLED ; .DB $00,$00,$00,$00,$00,$00,$00,$00 ; DSKY_PUTLED: EX (SP),HL PUSH AF PUSH BC LD C,8 DSKY_PUTLED_1: LD A,(HL) PUSH BC CALL DSKY_PUTBYTE POP BC INC C INC HL LD A,C CP $10 JP NZ,DSKY_PUTLED_1 POP BC POP AF EX (SP),HL RET ; ; This function is intended to beep the speaker on the DSKY ; DSKY_BEEP: PUSH AF PUSH BC LD C,$0F CALL DSKY_GETBYTE OR $20 LD C,$0F CALL DSKY_PUTBYTE ;;; timer . . . PUSH HL LD hl,$8FFF DSKY_BEEP1: DEC HL LD A,H CP 0 JP NZ,DSKY_BEEP1 POP HL LD C,$0F CALL DSKY_GETBYTE AND $DF LD C,$0F CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn on DSKY L1 ; DSKY_L1ON: PUSH AF PUSH BC LD C,$0D CALL DSKY_GETBYTE OR $20 LD C,$0D CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn on DSKY L2 ; DSKY_L2ON: PUSH AF PUSH BC LD C,$0E CALL DSKY_GETBYTE OR $20 LD C,$0E CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn off DSKY L1 ; DSKY_L1OFF: PUSH AF PUSH BC LD C,$0D CALL DSKY_GETBYTE AND $DF LD C,$0D CALL DSKY_PUTBYTE POP BC POP AF RET ; ; This function is intended to turn off DSKY L2 ; DSKY_L2OFF: PUSH AF PUSH BC LD C,$0E CALL DSKY_GETBYTE AND $DF LD C,$0E CALL DSKY_PUTBYTE POP BC POP AF RET ; ;================================================================================================== ; DSKYNG LINE CONTROL ROUTINES ;================================================================================================== ; ; SETUP PPI FOR WRITING: PUT PPI PORT A IN OUTPUT MODE ; AVOID REWRTING PPIX IF ALREADY IN OUTPUT MODE ; DSKY_PPIWR: PUSH AF ; ; CHECK FOR WRITE MODE LD A,(DSKY_PPIX_VAL) CP DSKY_PPIX_WR JR Z,DSKY_PPIWR1 ; ; SET PPI TO WRITE MODE LD A,DSKY_PPIX_WR OUT (PPIX),A LD (DSKY_PPIX_VAL),A ; ; RESTORE PORT C (MAY NOT BE NEEDED) LD A,DSKY_PPI_IDLE OUT (PPIC),A ; DSKY_PPIWR1: ; POP AF RET ; ; SETUP PPI FOR READING: PUT PPI PORT A IN INPUT MODE ; AVOID REWRTING PPIX IF ALREADY IN INPUT MODE ; DSKY_PPIRD: PUSH AF ; ; CHECK FOR READ MODE LD A,(DSKY_PPIX_VAL) CP DSKY_PPIX_RD JR Z,DSKY_PPIRD1 ; ; SET PPI TO READ MODE LD A,DSKY_PPIX_RD OUT (PPIX),A LD (DSKY_PPIX_VAL),A ; DSKY_PPIRD1: POP AF RET ; ; RELEASE USE OF PPI ; DSKY_PPIIDLE: JR DSKY_PPIRD ; SAME AS READ MODE ; ;================================================================================================== ; UTILTITY FUNCTIONS ;================================================================================================== ; DSKY_ADDHLA: ADD A,L LD L,A RET NC INC H RET ; ;================================================================================================== ; STORAGE ;================================================================================================== ; ; CODES FOR NUMERICS ; HIGH BIT ALWAYS CLEAR TO SUPPRESS DECIMAL POINT ; SET HIGH BIT TO SHOW DECIMAL POINT ; DSKY_HEXMAP: .DB $3F ; 0 .DB $06 ; 1 .DB $5B ; 2 .DB $4F ; 3 .DB $66 ; 4 .DB $6D ; 5 .DB $7D ; 6 .DB $07 ; 7 .DB $7F ; 8 .DB $67 ; 9 .DB $77 ; A .DB $7C ; B .DB $39 ; C .DB $5E ; D .DB $79 ; E .DB $71 ; F ; DSKY_PPIX_VAL: .DB 0 DSKY_PRESENT: .DB 0 ; ; SEG DISPLAY WORKING STORAGE ; DSKY_BUF .FILL 8,0 DSKY_BUFLEN .EQU $ - DSKY_BUF DSKY_HEXBUF .FILL 4,0 DSKY_HEXBUFLEN .EQU $ - DSKY_HEXBUF
ada/original_2008/ada-gui/agar-gui-text.ads
auzkok/libagar
286
28832
<gh_stars>100-1000 with agar.core.event; with agar.core.object; with agar.core.slist; with agar.core.types; with agar.gui.surface; with interfaces.c.strings; package agar.gui.text is package cs renames interfaces.c.strings; type glyph_t; type glyph_access_t is access all glyph_t; pragma convention (c, glyph_access_t); type font_t; type font_access_t is access all font_t; pragma convention (c, font_access_t); package glyph_slist is new agar.core.slist (entry_type => glyph_access_t); package font_slist is new agar.core.slist (entry_type => font_access_t); -- -- types -- type font_type_t is (VECTOR, BITMAP); for font_type_t use (VECTOR => 0, BITMAP => 1); for font_type_t'size use c.unsigned'size; pragma convention (c, font_type_t); type justify_t is (LEFT, CENTER, RIGHT); for justify_t use (LEFT => 0, CENTER => 1, RIGHT => 2); for justify_t'size use c.unsigned'size; pragma convention (c, justify_t); type valign_t is (TOP, MIDDLE, BOTTOM); for valign_t use (TOP => 0, MIDDLE => 1, BOTTOM => 2); for valign_t'size use c.unsigned'size; pragma convention (c, valign_t); type msg_title_t is (ERROR, WARNING, INFO); for msg_title_t use (ERROR => 0, WARNING => 1, INFO => 2); for msg_title_t'size use c.unsigned'size; pragma convention (c, msg_title_t); type font_name_t is array (1 .. agar.core.object.object_name_max) of aliased c.char; pragma convention (c, font_name_t); subtype flags_t is c.unsigned; FONT_BOLD : constant flags_t := 16#01#; FONT_ITALIC : constant flags_t := 16#02#; FONT_UNDERLINE : constant flags_t := 16#04#; FONT_UPPERCASE : constant flags_t := 16#08#; type spec_t is array (1 .. 32) of aliased c.char; pragma convention (c, spec_t); type font_t is record object : agar.core.object.object_t; font_type : font_type_t; size : c.int; flags : flags_t; height : c.int; ascent : c.int; descent : c.int; lineskip : c.int; ttf : agar.core.types.void_ptr_t; bspec : spec_t; bglyphs : access agar.gui.surface.surface_access_t; nglyphs : c.unsigned; c0 : agar.core.types.uint32_t; c1 : agar.core.types.uint32_t; fonts : font_slist.entry_t; end record; pragma convention (c, font_t); type state_t is record font : font_access_t; color : agar.core.types.uint32_t; color_bg : agar.core.types.uint32_t; justify : justify_t; valign : valign_t; end record; type state_access_t is access all state_t; pragma convention (c, state_t); pragma convention (c, state_access_t); type static_font_t is record name : cs.chars_ptr; font_type : font_type_t; size : agar.core.types.uint32_t; data : access agar.core.types.uint8_t; font : font_access_t; end record; type static_font_access_t is access all font_t; pragma convention (c, static_font_t); pragma convention (c, static_font_access_t); type metrics_t is record width : c.int; height : c.int; wlines : access c.unsigned; nlines : c.unsigned; end record; type metrics_access_t is access all metrics_t; pragma convention (c, metrics_t); pragma convention (c, metrics_access_t); -- openGL array types type texcoord_t is array (1 .. 4) of c.c_float; -- glyph type type glyph_t is record fontname : font_name_t; fontsize : c.int; color : agar.core.types.uint32_t; ch : agar.core.types.uint32_t; nrefs : agar.core.types.uint32_t; last_ref : agar.core.types.uint32_t; surface : agar.gui.surface.surface_access_t; advance : c.int; -- openGL texture : c.unsigned; texcoord : texcoord_t; glyphs : glyph_slist.entry_t; end record; pragma convention (c, glyph_t); -- -- API -- procedure push_state; pragma import (c, push_state, "AG_PushTextState"); procedure pop_state; pragma import (c, pop_state, "AG_PopTextState"); procedure font (font : font_access_t); pragma import (c, font, "agar_gui_text_font"); procedure justify (mode : justify_t); pragma import (c, justify, "agar_gui_text_justify"); procedure color_video32 (pixel : agar.core.types.uint32_t); pragma import (c, color_video32, "AG_TextColorVideo32"); procedure color_32 (pixel : agar.core.types.uint32_t); pragma import (c, color_32, "AG_TextColor32"); procedure color_rgb (r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t); pragma import (c, color_rgb, "AG_TextColorRGB"); procedure color_rgba (r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t; a : agar.core.types.uint8_t); pragma import (c, color_rgba, "AG_TextColorRGBA"); procedure bg_color_video32 (pixel : agar.core.types.uint32_t); pragma import (c, bg_color_video32, "AG_TextBGColorVideo32"); procedure bg_color_32 (pixel : agar.core.types.uint32_t); pragma import (c, bg_color_32, "AG_TextBGColor32"); procedure bg_color_rgb (r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t); pragma import (c, bg_color_rgb, "AG_TextBGColorRGB"); procedure bg_color_rgba (r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t; a : agar.core.types.uint8_t); pragma import (c, bg_color_rgba, "AG_TextBGColorRGBA"); -- render function render (text : string) return agar.gui.surface.surface_access_t; pragma inline (render); function render_ucs4 (text : access c.char32_t) return agar.gui.surface.surface_access_t; pragma import (c, render_ucs4, "AG_TextRenderUCS4"); function render_ucs4 (text : wide_wide_string) return agar.gui.surface.surface_access_t; pragma inline (render_ucs4); function render_glyph (glyph : agar.core.types.uint32_t) return agar.gui.surface.surface_access_t; pragma import (c, render_glyph, "AG_TextRenderGlyph"); procedure size (text : string; width : out positive; height : out positive); pragma inline (size); procedure size_ucs4 (text : access c.char32_t; width : access c.int; height : access c.int); pragma import (c, size_ucs4, "AG_TextSizeUCS4"); procedure size_ucs4 (text : wide_wide_string; width : out positive; height : out positive); pragma inline (size_ucs4); -- missing: AG_TextSizeMulti, AG_TextSizeMultiUCS4 - unsure how to bind this procedure msg (title : msg_title_t; text : string); pragma inline (msg); procedure msg_from_error; pragma import (c, msg_from_error); procedure warning (disable_key : string; text : string); pragma inline (warning); procedure info (disable_key : string; text : string); pragma inline (info); procedure timed_message (title : msg_title_t; expire : agar.core.types.uint32_t; text : string); pragma inline (timed_message); -- missing: AG_TextEditFloat - unknown 'text_edit_float' enum type -- missing: AG_TextEditString - unsure how to bind procedure prompt_string (prompt : string; ok_func : access procedure (event : agar.core.event.event_access_t); text : string); pragma inline (prompt_string); procedure parse_font_spec (spec : string); pragma inline (parse_font_spec); end agar.gui.text;
Resources/All Scripts/Sandbox Exceptions/Scripts/qt.scpt
bathtub/IRC.app
2
3266
<reponame>bathtub/IRC.app<filename>Resources/All Scripts/Sandbox Exceptions/Scripts/qt.scpt -- Copyright © 2013 <NAME> on irccmd(inputData, destinationChannel) if destinationChannel is equal to "" then return "/debug Invalid destination channel." end if tell application "System Events" tell application "System Events" to set is_running to exists (processes where name is "QuickTime Player") end tell if is_running then tell application "QuickTime Player" set wTitle to name of window 1 return "/sme " & destinationChannel & " is watching \"" & noExt(wTitle) of me & "\" in QuickTime" end tell else return "/echo You are not running QuickTime." end if end irccmd on noExt(filename) if filename contains "." then set filename to ¬ (the reverse of every character of filename) as string set x to the offset of "." in filename set filename to (characters (x + 1) thru -1 of filename) as string set filename to (the reverse of every character of filename) as string end if return filename end noExt
examples/simple-lib/Lib/Fin.agda
asr/agda-kanso
1
3893
module Lib.Fin where open import Lib.Nat open import Lib.Bool open import Lib.Id data Fin : Nat -> Set where zero : {n : Nat} -> Fin (suc n) suc : {n : Nat} -> Fin n -> Fin (suc n) fromNat : (n : Nat) -> Fin (suc n) fromNat zero = zero fromNat (suc n) = suc (fromNat n) toNat : {n : Nat} -> Fin n -> Nat toNat zero = zero toNat (suc n) = suc (toNat n) weaken : {n : Nat} -> Fin n -> Fin (suc n) weaken zero = zero weaken (suc n) = suc (weaken n) lem-toNat-weaken : forall {n} (i : Fin n) -> toNat i ≡ toNat (weaken i) lem-toNat-weaken zero = refl lem-toNat-weaken (suc i) with toNat i | lem-toNat-weaken i ... | .(toNat (weaken i)) | refl = refl lem-toNat-fromNat : (n : Nat) -> toNat (fromNat n) ≡ n lem-toNat-fromNat zero = refl lem-toNat-fromNat (suc n) with toNat (fromNat n) | lem-toNat-fromNat n ... | .n | refl = refl finEq : {n : Nat} -> Fin n -> Fin n -> Bool finEq zero zero = true finEq zero (suc _) = false finEq (suc _) zero = false finEq (suc i) (suc j) = finEq i j -- A view telling you if a given element is the maximal one. data MaxView {n : Nat} : Fin (suc n) -> Set where theMax : MaxView (fromNat n) notMax : (i : Fin n) -> MaxView (weaken i) maxView : {n : Nat}(i : Fin (suc n)) -> MaxView i maxView {zero} zero = theMax maxView {zero} (suc ()) maxView {suc n} zero = notMax zero maxView {suc n} (suc i) with maxView i maxView {suc n} (suc .(fromNat n)) | theMax = theMax maxView {suc n} (suc .(weaken i)) | notMax i = notMax (suc i) -- The non zero view data NonEmptyView : {n : Nat} -> Fin n -> Set where ne : {n : Nat}{i : Fin (suc n)} -> NonEmptyView i nonEmpty : {n : Nat}(i : Fin n) -> NonEmptyView i nonEmpty zero = ne nonEmpty (suc _) = ne -- The thinning view thin : {n : Nat} -> Fin (suc n) -> Fin n -> Fin (suc n) thin zero j = suc j thin (suc i) zero = zero thin (suc i) (suc j) = suc (thin i j) data EqView : {n : Nat} -> Fin n -> Fin n -> Set where equal : {n : Nat}{i : Fin n} -> EqView i i notequal : {n : Nat}{i : Fin (suc n)}(j : Fin n) -> EqView i (thin i j) compare : {n : Nat}(i j : Fin n) -> EqView i j compare zero zero = equal compare zero (suc j) = notequal j compare (suc i) zero with nonEmpty i ... | ne = notequal zero compare (suc i) (suc j) with compare i j compare (suc i) (suc .i) | equal = equal compare (suc i) (suc .(thin i j)) | notequal j = notequal (suc j)
programs/oeis/166/A166314.asm
karttu/loda
0
88152
<filename>programs/oeis/166/A166314.asm<gh_stars>0 ; A166314: Number of 1's in binary expansion of A000124(n). ; 1,1,1,3,3,1,3,4,3,4,3,3,5,4,4,5,3,4,4,7,5,4,7,4,5,4,3,7,6,5,5,6,3,4,4,7,6,3,6,5,6,7,4,7,9,3,5,5,5,5,7,7,6,5,7,4,7,7,5,8,7,6,6,7,3,4,4,7,6,5,7,9,5,6,6,6,9,8,4,6,6,8,6,9,9,5,8,9,8,8,1,6,7,4,6,6,5,5,7,8,9,3,5,8,7 mov $2,$0 pow $2,2 add $0,$2 add $0,1 mov $1,$0 add $1,1 mov $0,$1 add $0,1 mov $1,$0 lpb $0,1 div $0,2 sub $1,$0 lpe sub $1,1
oeis/135/A135065.asm
neoneye/loda-programs
11
98468
<filename>oeis/135/A135065.asm ; A135065: A127733 * A007318 as infinite lower triangular matrices. ; Submitted by <NAME>(s4) ; 1,4,4,9,18,9,16,48,48,16,25,100,150,100,25,36,180,360,360,180,36,49,294,735,980,735,294,49,64,448,1344,2240,2240,1344,448,64,81,648,2268,4536,5670,4536,2268,648,81,100,900,3600,8400,12600,12600,8400,3600,900,100,121,1210,5445,14520,25410,30492,25410,14520,5445,1210,121,144,1584,7920,23760,47520,66528,66528,47520,23760,7920,1584,144,169,2028,11154,37180,83655,133848,156156,133848,83655,37180,11154,2028,169,196,2548,15288,56056,140140,252252,336336,336336,252252 mov $2,1 mov $3,1 lpb $0 sub $0,$3 mov $2,$3 bin $2,$0 add $3,1 mul $2,$3 lpe mul $3,$2 mov $0,$3
tests/src/main.adb
Ada-bindings-project/a-ioctl
0
18612
with Ada.Command_Line; with Ada.Text_IO; with Interfaces.C; with Ioctl; procedure Main is use all type Interfaces.C.Unsigned; function TestIOC return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOC"; function TestIO return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIO"; function TestIOW return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOW"; function TestIOR return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOR"; function TestIOWR return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOWR"; function TestIOR_BAD return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOR_BAD"; function TestIOW_BAD return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIOW_BAD"; function TestIO_DIR return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIO_DIR"; function TestIO_TYPE return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIO_TYPE"; function TestIO_SIZE return Interfaces.C.Unsigned with Import => True, Convention => C, Link_Name => "testIO_SIZE"; begin if (Ioctl.IOC (16#01#, 16#02#, 16#04#, 16#08#) /= TestIOC) or (Ioctl.IO (16#01#, 16#02#) /= TestIO)or (Ioctl.IOR (16#01#, 16#02#, 16#04#) /= TestIOR) or (Ioctl.IOW (16#01#, 16#02#, 16#04#) /= TestIOW) or (Ioctl.IOWR (16#01#, 16#02#, 16#04#) /= TestIOWR) or (Ioctl.IO_DIR (16#012345678#) /= TestIO_DIR) or (Ioctl.IO_TYPE (16#0123456#) /= TestIO_TYPE) or (Ioctl.IO_SIZE (16#0123456#) /= TestIO_SIZE) then Ada.Text_IO.Put_Line ("IOC: " & Ioctl.IOC (16#01#, 16#02#, 16#04#, 16#08#)'Img & " = " & TestIOC'Img); Ada.Text_IO.Put_Line ("IO: " & Ioctl.IO (16#01#, 16#02#)'Img & " = " & TestIO'Img); Ada.Text_IO.Put_Line ("IOR: " & Ioctl.IOR (16#01#, 16#02#, 16#04#)'Img & " = " & TestIOR'Img); Ada.Text_IO.Put_Line ("IOW: " & Ioctl.IOW (16#01#, 16#02#, 16#04#)'Img & " = " & TestIOW'Img); Ada.Text_IO.Put_Line ("IOWR: " & Ioctl.IOWR (16#01#, 16#02#, 16#04#)'Img & " = " & TestIOWR'Img); Ada.Text_IO.Put_Line ("IO_DIR: " & Ioctl.IO_DIR (16#012345678#)'Img & " = " & TestIO_DIR'Img); Ada.Text_IO.Put_Line ("IO_TYPE: " & Ioctl.IO_TYPE (16#0123456#)'Img & " = " & TestIO_TYPE'Img); Ada.Text_IO.Put_Line ("IO_SIZE: " & Ioctl.IO_SIZE (16#0123456#)'Img & " = " & TestIO_SIZE'Img); Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); end if; end Main;
programs/oeis/273/A273309.asm
neoneye/loda
22
19416
<filename>programs/oeis/273/A273309.asm ; A273309: Number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 641", based on the 5-celled von Neumann neighborhood. ; 1,4,17,40,73,112,161,216,281,352,433,520,617,720,833,952,1081,1216,1361,1512,1673,1840,2017,2200,2393,2592,2801,3016,3241,3472,3713,3960,4217,4480,4753,5032,5321,5616,5921,6232,6553,6880,7217,7560,7913,8272,8641,9016,9401,9792,10193,10600,11017,11440,11873,12312,12761,13216,13681,14152,14633,15120,15617,16120,16633,17152,17681,18216,18761,19312,19873,20440,21017,21600,22193,22792,23401,24016,24641,25272,25913,26560,27217,27880,28553,29232,29921,30616,31321,32032,32753,33480,34217,34960,35713,36472,37241,38016,38801,39592 mov $1,$0 add $1,1 mov $4,3 mov $6,$0 lpb $1 add $0,$4 add $0,2 sub $1,1 mov $2,$4 mov $4,2 trn $4,$2 lpe sub $0,3 trn $0,4 mov $2,2 sub $2,$0 sub $0,1 trn $0,4 trn $2,1 add $0,$2 mov $5,$6 mov $7,$6 lpb $5 sub $5,1 add $8,$7 lpe mov $3,4 mov $7,$8 lpb $3 add $0,$7 sub $3,1 lpe
src/Projects/eu_projects-nodes-action_nodes-wps.ads
fintatarta/eugen
0
1147
<reponame>fintatarta/eugen<filename>src/Projects/eu_projects-nodes-action_nodes-wps.ads with Ada.Containers.Vectors; with Ada.Iterator_Interfaces; with EU_Projects.Nodes.Action_Nodes; with EU_Projects.Nodes.Timed_Nodes.Deliverables; with EU_Projects.Nodes.Action_Nodes.Tasks; with EU_Projects.Nodes.Partners; with EU_Projects.Node_Tables; package EU_Projects.Nodes.Action_Nodes.WPs is type Project_WP is new Action_Node -- and Searchable_Nodes.Searchable_Node with private; type Project_WP_Access is access all Project_WP; subtype WP_Index is Node_Index; No_WP : constant Extended_Node_Index := No_Index; type WP_Label is new Node_Label; function Create (Label : WP_Label; Name : String; Short_Name : String; Leader : Partners.Partner_Label; Objectives : String; Description : String; Active_When : Action_Time; Depends_On : Node_Label_Lists.Vector; Node_Dir : in out Node_Tables.Node_Table) return Project_WP_Access with Post => Create'Result.Index = No_WP; procedure Set_Index (WP : in out Project_WP; Idx : WP_Index) with Pre => Wp.Index = No_WP, Post => Wp.Index = Idx; overriding function Full_Index (Item : Project_WP; Prefixed : Boolean) return String; overriding function Dependency_List (Item : Project_WP) return Node_Label_Lists.Vector; -- As many other "add" procedures, this procedure is in charge of assigning -- an index to the new task, unless the task has already an index (which -- must not be already present). New indexes are assigned incrementally. -- -- This, basically, is the plain english "translation" of -- the pre/postconditions... procedure Add_Task (WP : in out Project_WP; Tsk : Tasks.Project_Task_Access) with Post => ( (Tsk.Index /= Tasks.No_Task) and (WP.Contains (Tsk.Index)) and Correctly_Updated (Old_Index => Tsk.Index'Old, New_Index => Tsk.Index, Old_Max => WP.Max_Task_Index'Old, New_Max => WP.Max_Task_Index) ), Pre => (Tsk.Index = Tasks.No_Task); -- Return the maximum of the indexes of the tasks currently included -- in the WP. It is here since it is necessary for the post condition of -- Add_Task. function Max_Task_Index (WP : Project_WP) return Extended_Node_Index; procedure Add_Deliverable (WP : in out Project_WP; Item : Timed_Nodes.Deliverables.Deliverable_Access) with Pre => not Item.Is_Clone and Item.Index = Timed_Nodes.Deliverables.No_Deliverable, Post => Item.Index /= Timed_Nodes.Deliverables.No_Deliverable; function Contains (WP : Project_WP; Idx : Tasks.Task_Index) return Boolean; type Task_Cursor is private; function Has_Element (X : Task_Cursor) return Boolean; package Task_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor => Task_Cursor, Has_Element => Has_Element); type Task_Iterator is new Task_Iterator_Interfaces.Forward_Iterator with private; overriding function First (Object : Task_Iterator) return Task_Cursor; overriding function Next (Object : Task_Iterator; Position : Task_Cursor) return Task_Cursor; function All_Tasks (Item : Project_WP) return Task_Iterator_Interfaces.Forward_Iterator'Class; function Element (Index : Task_Cursor) return Tasks.Project_Task_Access; function Task_List (Item : Project_WP) return Node_Label_Lists.Vector; --------------------------- -- Deliverable Iterators -- --------------------------- type Deliverable_Cursor is private; function Has_Element (X : Deliverable_Cursor) return Boolean; package Deliverable_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor => Deliverable_Cursor, Has_Element => Has_Element); type Deliverable_Iterator is new Deliverable_Iterator_Interfaces.Forward_Iterator with private; overriding function First (Object : Deliverable_Iterator) return Deliverable_Cursor; overriding function Next (Object : Deliverable_Iterator; Position : Deliverable_Cursor) return Deliverable_Cursor; function All_Deliverables (Item : Project_WP) return Deliverable_Iterator_Interfaces.Forward_Iterator'Class; function Element (Index : Deliverable_Cursor) return Nodes.Timed_Nodes.Deliverables.Deliverable_Access; overriding procedure Parse_Raw_Expressions (Item : in out Project_WP; Vars : Times.Time_Expressions.Parsing.Symbol_Table); private use Tasks; use type Timed_Nodes.Deliverables.Deliverable_Access; package WP_Index_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => WP_Index); package Deliverable_Vectors is new Ada.Containers.Vectors (Index_Type => Timed_Nodes.Deliverables.Deliverable_Index, Element_Type => Timed_Nodes.Deliverables.Deliverable_Access); --------------------- -- Task iteration -- --------------------- package Task_Vectors is new Ada.Containers.Vectors (Index_Type => Tasks.Task_Index, Element_Type => Tasks.Project_Task_Access); type Task_Cursor is new Task_Vectors.Cursor; type Task_Iterator is new Task_Iterator_Interfaces.Forward_Iterator with record Start : Task_Vectors.Cursor; end record; overriding function First (Object : Task_Iterator) return Task_Cursor is (Task_Cursor (Object.Start)); overriding function Next (Object : Task_Iterator; Position : Task_Cursor) return Task_Cursor is (Task_Cursor (Task_Vectors.Next (Task_Vectors.Cursor (Position)))); function Element (Index : Task_Cursor) return Tasks.Project_Task_Access is (Task_Vectors.Element (Task_Vectors.Cursor (Index))); function Has_Element (X : Task_Cursor) return Boolean is (Task_Vectors.Has_Element (Task_Vectors.Cursor (X))); ---------------- -- Finally... -- ---------------- type Project_WP is new Nodes.Action_Nodes.Action_Node with record Objectives : Unbounded_String; Depend_On : Node_Label_Lists.Vector; WP_Tasks : Task_Vectors.Vector; Deliverables : Deliverable_Vectors.Vector; end record; -- -- function Index (WP : Project_WP) return Extended_Node_Index -- is (WP_Index (WP.Index)); function Contains (WP : Project_WP; Idx : Tasks.Task_Index) return Boolean is ((Idx >= WP.WP_Tasks.First_Index and Idx <= WP.WP_Tasks.Last_Index) and then (WP.WP_Tasks (Idx) /= null)); ---------------------------- -- Deliverable iteration -- ---------------------------- type Deliverable_Cursor is record Top_Level : Deliverable_Vectors.Cursor; Clone : Natural; end record; type Deliverable_Iterator is new Deliverable_Iterator_Interfaces.Forward_Iterator with record Start : Deliverable_Vectors.Cursor; end record; overriding function First (Object : Deliverable_Iterator) return Deliverable_Cursor is (Deliverable_Cursor'(Top_Level => Object.Start, Clone => 0)); function Has_Element (X : Deliverable_Cursor) return Boolean is (Deliverable_Vectors.Has_Element (X.Top_Level)); function All_Deliverables (Item : Project_WP) return Deliverable_Iterator_Interfaces.Forward_Iterator'Class is (Deliverable_Iterator'(Start => Item.Deliverables.First)); overriding function Full_Index (Item : Project_WP; Prefixed : Boolean) return String is ((if Prefixed then "WP" else "") & Chop (Node_Index'Image (Item.Index))); function Max_Task_Index (WP : Project_WP) return Extended_Node_Index is (WP.WP_Tasks.Last_Index); function All_Tasks (Item : Project_WP) return Task_Iterator_Interfaces.Forward_Iterator'Class is (Task_Iterator'(Start => Item.WP_Tasks.First)); -- function All_Deliverables -- (Item : Project_WP) -- return Deliverable_Iterator_Interfaces.Forward_Iterator'Class -- is (Deliverable_Iterator'(Start => Item.WP_Deliverables.First)); -- -- -- function All_Milestones -- (Item : Project_WP) -- return Milestone_Iterator_Interfaces.Forward_Iterator'Class -- is (Milestone_Iterator'(Start => Item.WP_Milestones.First)); end EU_Projects.Nodes.Action_Nodes.WPs; -- procedure Add_Deliverable (WP : in out Project_WP; -- Deliverable : Timed_Nodes.Deliverables.Deliverable_Access); -- -- procedure Add_Dependence (WP : in out Project_WP; -- Label : Identifiers.Identifier); -- -- procedure Summarize_Tasks (WP : in out Project_WP); -- function Find (Where : Project_WP; -- Label : Identifiers.Identifier) -- return Searchable_Nodes.Child_Value; -- -- Search for a child with the given name and return it -- -- Return No_Child if the child does not exist -- -- function Exists (Where : Project_WP; -- Label : Identifiers.Identifier) -- return Searchable_Nodes.Child_Class;
oeis/063/A063487.asm
neoneye/loda-programs
11
15627
; A063487: Number of distinct prime divisors of 2^(2^n)-1 (A051179). ; Submitted by <NAME> ; 0,1,2,3,4,5,7,9,11,13,16,20,25 mov $1,$0 lpb $1 sub $1,1 trn $1,4 add $0,$1 trn $1,2 mul $1,2 lpe
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm
KaoTuz/edk2-stable202108
9
20898
<reponame>KaoTuz/edk2-stable202108<filename>UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm<gh_stars>1-10 ;------------------------------------------------------------------------------ ; ; Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; SmmInit.nasm ; ; Abstract: ; ; Functions for relocating SMBASE's for all processors ; ;------------------------------------------------------------------------------- %include "StuffRsbNasm.inc" extern ASM_PFX(SmmInitHandler) extern ASM_PFX(mRebasedFlag) extern ASM_PFX(mSmmRelocationOriginalAddress) global ASM_PFX(gPatchSmmCr3) global ASM_PFX(gPatchSmmCr4) global ASM_PFX(gPatchSmmCr0) global ASM_PFX(gPatchSmmInitStack) global ASM_PFX(gcSmiInitGdtr) global ASM_PFX(gcSmmInitSize) global ASM_PFX(gcSmmInitTemplate) %define PROTECT_MODE_CS 0x8 %define PROTECT_MODE_DS 0x20 SECTION .text ASM_PFX(gcSmiInitGdtr): DW 0 DQ 0 global ASM_PFX(SmmStartup) BITS 16 ASM_PFX(SmmStartup): mov eax, 0x80000001 ; read capability cpuid mov ebx, edx ; rdmsr will change edx. keep it in ebx. and ebx, BIT20 ; extract NX capability bit shr ebx, 9 ; shift bit to IA32_EFER.NXE[BIT11] position mov eax, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmmCr3): mov cr3, eax o32 lgdt [cs:ebp + (ASM_PFX(gcSmiInitGdtr) - ASM_PFX(SmmStartup))] mov eax, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmmCr4): mov cr4, eax mov ecx, 0xc0000080 ; IA32_EFER MSR rdmsr or eax, ebx ; set NXE bit if NX is available wrmsr mov eax, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmmCr0): mov di, PROTECT_MODE_DS mov cr0, eax jmp PROTECT_MODE_CS : dword @32bit BITS 32 @32bit: mov ds, edi mov es, edi mov fs, edi mov gs, edi mov ss, edi mov esp, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmmInitStack): call ASM_PFX(SmmInitHandler) StuffRsb32 rsm BITS 16 ASM_PFX(gcSmmInitTemplate): mov ebp, ASM_PFX(SmmStartup) sub ebp, 0x30000 jmp ebp ASM_PFX(gcSmmInitSize): DW $ - ASM_PFX(gcSmmInitTemplate) BITS 32 global ASM_PFX(SmmRelocationSemaphoreComplete) ASM_PFX(SmmRelocationSemaphoreComplete): push eax mov eax, [ASM_PFX(mRebasedFlag)] mov byte [eax], 1 pop eax jmp [ASM_PFX(mSmmRelocationOriginalAddress)] global ASM_PFX(PiSmmCpuSmmInitFixupAddress) ASM_PFX(PiSmmCpuSmmInitFixupAddress): ret
MacOS_x86/squasher2.asm
codecop/Conways-Squasher-Coroutine
2
15372
bits 32 %define NULL dword 0 card_len equ 80 section .bss %macro coro 2 mov ebx, %%_cnt mov [route_%1], ebx jmp %2 %%_cnt: nop %endmacro route_SQUASHER: resd 1 ; storage of IP, module global data for SQUASHER route_WRITE: resd 1 ; storage of IP, module global data for WRITE i: resd 1 ; module global data for RDCRD and SQUASHER card: resb card_len ; module global data for RDCRD and SQUASHER t1: resd 1 ; module global data for SQUASHER t2: resd 1 ; module global data for SQUASHER out: resd 1 ; module global data for SQUASHER, WRITE section .text ; -------------------------------------------------------------------------------- SYS_READ equ 3 STDIN equ 0 RDCRD: mov eax, [i] cmp eax, card_len jne .exit mov [i], NULL ; read card into card[1:80] push dword card_len ; maximum number of bytes to read push dword card ; buffer to read into push dword STDIN ; file descriptor sub esp, 4 ; OS X (and BSD) system calls needs "extra space" on stack mov eax, SYS_READ int 0x80 add esp, 16 .exit: ret ; -------------------------------------------------------------------------------- ; router SQUASHER: jmp [route_SQUASHER] ; coroutine SQUASHER_CORO: ; label 1 call RDCRD mov esi, [i] xor eax, eax mov al, [card + esi] mov [t1], eax inc esi mov [i], esi mov eax, [t1] ; redundant, value still in register cmp eax, '*' jne .not_equal_ast .equal_ast: call RDCRD mov esi, [i] ; redundant, value still in register xor eax, eax mov al, [card + esi] mov [t2], eax inc esi mov [i], esi mov eax, [t2] ; redundant, value still in register cmp eax, '*' jne .not_equal_second_ast .equal_second_ast: mov [t1], dword '^' jmp .not_equal_ast .not_equal_second_ast: mov eax, [t1] mov [out], eax coro SQUASHER, WRITE mov eax, [t2] mov [out], eax coro SQUASHER, WRITE jmp SQUASHER_CORO .not_equal_ast: ; label 2 mov eax, [t1] mov [out], eax coro SQUASHER, WRITE jmp SQUASHER_CORO ; -------------------------------------------------------------------------------- SYS_WRITE equ 4 STDOUT equ 1 printEbx: push dword 1 ; message length push ebx ; message to write push dword STDOUT ; file descriptor sub esp, 4 ; OS X (and BSD) system calls needs "extra space" on stack mov eax, SYS_WRITE int 0x80 add esp, 16 ret ; -------------------------------------------------------------------------------- ; router WRITE: jmp [route_WRITE] ; coroutine WRITE_CORO: .loop: coro WRITE, SQUASHER ; out is output area of SQUASHER and only holds a single byte, ; so it can only return a single read element. The look ahead ; reads a second element and thus needs a switch to return the ; looked "ahead" element on next call. mov ebx, out call printEbx mov eax, [i] cmp eax, card_len jne .loop ret ; -------------------------------------------------------------------------------- SYS_EXIT equ 1 _exitProgram: mov eax, SYS_EXIT mov ebx, 0 ; return code = 0 int 0x80 ; -------------------------------------------------------------------------------- global _main _main: ; set up coroutine routers mov ebx, SQUASHER_CORO mov [route_SQUASHER], ebx mov ebx, WRITE_CORO mov [route_WRITE], ebx ; set up global data mov [i], dword card_len call WRITE .finished: jmp _exitProgram
test/testcases/asm/fn_call_42.0.asm
arthurchaloin/koak
0
25049
; ModuleID = 'main' source_filename = "<string>" define double @fnNoArgs42_0() { entry: ret double 4.200000e+01 } define double @main() { entry: %0 = call double @fnNoArgs42_0() ret double %0 }
Testing Scripts/Audio Test/Source/Audio Test.applescript
freegeek-pdx/macOS-Testing-and-Deployment-Scripts
0
4070
-- By: <NAME> -- For: MacLand @ Free Geek -- -- MIT License -- -- Copyright (c) 2021 Free Geek -- -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- Version: 2022.4.8-1 -- App Icon is “Loudspeaker” from Twemoji (https://twemoji.twitter.com/) by Twitter (https://twitter.com) -- Licensed under CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/) use AppleScript version "2.7" use scripting additions repeat -- dialogs timeout when screen is asleep or locked (just in case) set isAwake to true try set isAwake to ((do shell script ("bash -c " & (quoted form of "/usr/libexec/PlistBuddy -c 'Print :0:IOPowerManagement:CurrentPowerState' /dev/stdin <<< \"$(ioreg -arc IODisplayWrangler -k IOPowerManagement -d 1)\""))) is equal to "4") end try set isUnlocked to true try set isUnlocked to ((do shell script ("bash -c " & (quoted form of "/usr/libexec/PlistBuddy -c 'Print :IOConsoleUsers:0:CGSSessionScreenIsLocked' /dev/stdin <<< \"$(ioreg -ac IORegistryEntry -k IOConsoleUsers -d 1)\""))) is not equal to "true") end try if (isAwake and isUnlocked) then exit repeat else delay 1 end if end repeat try set infoPlistPath to ((POSIX path of (path to me)) & "Contents/Info.plist") ((infoPlistPath as POSIX file) as alias) set intendedAppName to "Audio Test" -- Hardcode intended App name because Name or Bundle Identifier changes should not be done lightly or accidentally. try do shell script ("/usr/libexec/PlistBuddy -c 'Print :FGBuiltByMacLandScriptBuilder' " & (quoted form of infoPlistPath)) ((((POSIX path of (path to me)) & "Contents/MacOS/" & intendedAppName) as POSIX file) as alias) on error try activate end try display alert " “" & (name of me) & "” must be built by the “MacLand Script Builder” script." buttons {"Quit"} default button 1 as critical quit delay 10 end try set AppleScript's text item delimiters to "-" set intendedBundleIdentifier to ("org.freegeek." & ((words of intendedAppName) as string)) set currentBundleIdentifier to ((do shell script ("/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' " & (quoted form of infoPlistPath))) as string) if (currentBundleIdentifier is not equal to intendedBundleIdentifier) then error "“" & (name of me) & "” does not have the correct Bundle Identifier. Current Bundle Identifier: " & currentBundleIdentifier & " Intended Bundle Identifier: " & intendedBundleIdentifier on error checkInfoPlistError if (checkInfoPlistError does not start with "Can’t make file") then try activate end try display alert checkInfoPlistError buttons {"Quit"} default button 1 as critical quit delay 10 end if end try try set mainScptPath to ((POSIX path of (path to me)) & "Contents/Resources/Scripts/main.scpt") ((mainScptPath as POSIX file) as alias) do shell script "osadecompile " & (quoted form of mainScptPath) error " “" & (name of me) & "” must be exported as a Run-Only Script." on error checkReadOnlyErrorMessage if ((checkReadOnlyErrorMessage does not contain "errOSASourceNotAvailable") and (checkReadOnlyErrorMessage does not start with "Can’t make file")) then activate display alert checkReadOnlyErrorMessage buttons {"Quit"} default button 1 as critical quit delay 10 end if end try set dialogIconName to "applet" try ((((POSIX path of (path to me)) & "Contents/Resources/" & (name of me) & ".icns") as POSIX file) as alias) set dialogIconName to (name of me) end try set systemVersion to (system version of (system info)) considering numeric strings set isMojaveOrNewer to (systemVersion ≥ "10.14") set isCatalinaOrNewer to (systemVersion ≥ "10.15") end considering if (isMojaveOrNewer) then try tell application "System Events" to every window -- To prompt for Automation access on Mojave on error automationAccessErrorMessage number automationAccessErrorNumber if (automationAccessErrorNumber is equal to -1743) then tell application "System Preferences" try activate end try reveal ((anchor "Privacy") of (pane id "com.apple.preference.security")) end tell try activate end try try display dialog "“" & (name of me) & "” must be allowed to control and perform actions in “System Events” to be able to function. USE THE FOLLOWING STEPS TO FIX THIS ISSUE: • Open the “System Preferences” application. • Click the “Security & Privacy” preference pane. • Select the “Privacy” tab. • Select “Automation” in the source list on the left. • Find “" & (name of me) & "” in the list on the right and turn on the “System Events” checkbox underneath it. • Relaunch “" & (name of me) & "” (using the button below)." buttons {"Quit", "Relaunch “" & (name of me) & "”"} cancel button 1 default button 2 with title (name of me) with icon dialogIconName try do shell script "osascript -e 'delay 0.5' -e 'repeat while (application \"" & (POSIX path of (path to me)) & "\" is running)' -e 'delay 0.5' -e 'end repeat' -e 'do shell script \"open -n -a \\\"" & (POSIX path of (path to me)) & "\\\"\"' > /dev/null 2>&1 &" end try end try quit delay 10 end if end try end if try tell application "System Events" to tell application process "Finder" to (get windows) on error (assistiveAccessTestErrorMessage) if ((offset of "not allowed assistive" in assistiveAccessTestErrorMessage) > 0) then try tell application "Finder" to reveal (path to me) end try try tell application "System Preferences" try activate end try reveal ((anchor "Privacy_Accessibility") of (pane id "com.apple.preference.security")) end tell end try try activate end try try display dialog "“" & (name of me) & "” must be allowed to control this computer using Accessibility Features to be able to function. USE THE FOLLOWING STEPS TO FIX THIS ISSUE: • Open the “System Preferences” application. • Click the “Security & Privacy” preference pane. • Select the “Privacy” tab. • Select “Accessibility” in the source list on the left. • Click the Lock icon at the bottom left of the window, enter the administrator username and password, and then click Unlock. • Find “" & (name of me) & "” in the list on the right and turn on the checkbox next to it. If “" & (name of me) & "” IS NOT in the list, drag-and-drop the app icon from Finder into the list. • Relaunch “" & (name of me) & "” (using the button below)." buttons {"Quit", "Relaunch “" & (name of me) & "”"} cancel button 1 default button 2 with title (name of me) with icon dialogIconName try do shell script "osascript -e 'delay 0.5' -e 'repeat while (application \"" & (POSIX path of (path to me)) & "\" is running)' -e 'delay 0.5' -e 'end repeat' -e 'do shell script \"open -n -a \\\"" & (POSIX path of (path to me)) & "\\\"\"' > /dev/null 2>&1 &" end try end try quit delay 10 end if end try set adminUsername to "Staff" if (isCatalinaOrNewer) then set adminUsername to "staff" set adminPassword to "[<PASSWORD> O<PASSWORD>]" set buildInfoPath to ((POSIX path of (path to shared documents folder)) & "Build Info/") try (((buildInfoPath & ".fgSetupSkipped") as POSIX file) as alias) try do shell script ("mkdir " & (quoted form of buildInfoPath)) end try try set AppleScript's text item delimiters to "-" do shell script ("touch " & (quoted form of (buildInfoPath & ".fgLaunchAfterSetup-org.freegeek." & ((words of (name of me)) as string)))) user name adminUsername password <PASSWORD> with administrator privileges end try try -- For some reason, on Big Sur, apps are not opening unless we specify "-n" to "Open a new instance of the application(s) even if one is already running." All scripts have LSMultipleInstancesProhibited to this will not actually ever open a new instance. do shell script "open -n -a '/Applications/Test Boot Setup.app'" end try quit delay 10 end try set testInternalSpeakersCount to 0 set testHeadphonesCount to 0 try repeat set audioTestButtons to {"Quit", "Test Audio Output"} if ((testInternalSpeakersCount > 0) and (testHeadphonesCount > 0)) then set audioTestButtons to {"Test Audio Output Again", "Done"} set internalSpeakerTestCountNote to "" set headphoneTestCountNote to "" if (testInternalSpeakersCount > 0) then set internalSpeakerTestCountNote to " Number of Internal Speaker Tests Run: " & testInternalSpeakersCount if (testHeadphonesCount > 0) then set headphoneTestCountNote to " Number of Headphone Port Tests Run: " & testHeadphonesCount set shouldTestAudio to false try activate end try try display dialog " 🔊 First, run this Audio Test through the built-in speakers. 🎧 Then, run this Audio Test again with headphones plugged in to test the headphone port. ✅ AUDIO TEST PASSED IF: You hear the phrases “Left speaker”, “Right speaker”, and “Both speakers” (or just “Single speaker”) crisply and clearly out of the correct speakers with both the built-in speakers as well as the headphones. ❌ AUDIO TEST FAILED IF: You do not hear each phrase out of the correct speakers or they don't sound crisp and clear for either the built-in speakers or the headphones. 👉 CONSULT INSTRUCTOR IF AUDIO TEST FAILS ‼️ " & internalSpeakerTestCountNote & headphoneTestCountNote buttons audioTestButtons cancel button 1 default button 2 with title "Audio Test" if ((last text item of audioTestButtons) is equal to "Test Audio Output") then set shouldTestAudio to true on error if ((first text item of audioTestButtons) is equal to "Test Audio Output Again") then set shouldTestAudio to true end try if (shouldTestAudio) then repeat with thisAudioTest in {{0, "Left speaker"}, {1, "Right speaker"}, {0.5, "Both speakers"}} tell application "System Preferences" try activate end try reveal anchor "output" of pane id "com.apple.preference.sound" end tell delay 0.5 set isTestingHeadphones to false try tell application "System Events" to tell application process "System Preferences" set allAudioOutputRows to (every row of table 1 of scroll area 1 of tab group 1 of window 1) set didSelectAudioOutputRow to false repeat with thisAudioOutputRow in allAudioOutputRows set thisAudioOutputType to ((value of text field 2 of thisAudioOutputRow) as string) if ((thisAudioOutputType is equal to "Built-In") or (thisAudioOutputType is equal to "Headphone port")) then select thisAudioOutputRow set didSelectAudioOutputRow to true if (thisAudioOutputType is equal to "Headphone port") then set isTestingHeadphones to true exit repeat end if end repeat if (not didSelectAudioOutputRow) then select (row 1 of table 1 of scroll area 1 of tab group 1 of window 1) end tell delay 0.25 end try if (isTestingHeadphones) then try set volume output volume 25 without output muted end try else try set volume output volume 75 without output muted end try end if try set volume alert volume 100 end try try tell application "System Events" to tell application process "System Preferences" tell (slider 1 of group 1 of tab group 1 of window 1) to set value to ((first item of thisAudioTest) as number) end tell delay 0.25 say ((last item of thisAudioTest) as string) delay 0.25 on error say "Single speaker" delay 0.25 exit repeat end try end repeat try tell application "System Events" to tell application process "System Preferences" set allAudioOutputRows to (every row of table 1 of scroll area 1 of tab group 1 of window 1) repeat with thisAudioOutputRow in allAudioOutputRows if (selected of thisAudioOutputRow) then set thisAudioOutputType to ((value of text field 2 of thisAudioOutputRow) as string) if (thisAudioOutputType is equal to "Built-In") then set testInternalSpeakersCount to (testInternalSpeakersCount + 1) else if (thisAudioOutputType is equal to "Headphone port") then set testHeadphonesCount to (testHeadphonesCount + 1) end if exit repeat end if end repeat end tell end try try with timeout of 1 second tell application "System Preferences" to quit end timeout end try else exit repeat end if end repeat end try if ((testInternalSpeakersCount > 0) and (testHeadphonesCount > 0)) then set shortModelName to "Unknown Model" try set shortModelName to (do shell script ("bash -c " & (quoted form of "/usr/libexec/PlistBuddy -c 'Print :0:_items:0:machine_name' /dev/stdin <<< \"$(system_profiler -xml SPHardwareDataType)\""))) end try if ((shortModelName is not equal to "Mac Pro") and (shortModelName is not equal to "Mac mini") and (shortModelName is not equal to "Mac Studio")) then try (("/Applications/Microphone Test.app" as POSIX file) as alias) if (application ("Microphone" & " Test") is not running) then try activate end try display alert " Would you like to launch “Microphone Test”?" buttons {"No", "Yes"} cancel button 1 default button 2 giving up after 15 do shell script "open -n -a '/Applications/Microphone Test.app'" end if end try else try activate end try display alert " The next test is manually testing this Macs Ports and Disc Drive." end if end if
lab06/8-divide/divide.asm
adinasm/iocla-demos
0
22884
%include "../utils/printf32.asm" ; https://en.wikibooks.org/wiki/X86_Assembly/Arithmetic section .data string_quotient db "Quotient: ", 0 string_remainder db "Remainder: ", 0 dividend1 db 91 divisor1 db 27 dividend2 dd 67254 divisor2 dw 1349 dividend3 dq 69094148 divisor3 dd 87621 section .text extern printf global main main: push ebp mov ebp, esp xor eax, eax mov al, byte [dividend1] mov bl, byte [divisor1] div bl PRINTF32 `%s\x0`, string_quotient xor ebx, ebx mov bl, al PRINTF32 `%hhu\n\x0`, ebx xor ebx, ebx mov bl, ah PRINTF32 `%s\x0`, string_remainder PRINTF32 `%hhu\n\x0`, ebx ; TODO: Calculate quotient and remainder for 67254 / 1349. ; TODO: Calculate quotient and remainder for 69094148 / 87621. leave ret
gfx/pokemon/metapod/anim.asm
Dev727/ancientplatinum
28
162174
<gh_stars>10-100 frame 1, 12 frame 2, 24 frame 1, 12 endanim
scripts/checkmate/checkmate.als
eskang/alloy-maxsat-benchmark
0
665
<reponame>eskang/alloy-maxsat-benchmark module checkmate ///////////////////////////////////////////////////////////////////////////////////// // Candidate Executions module ///////////////////////////////////////////////////////////////////////////////////// sig Core { } abstract sig Process { } one sig Attacker extends Process { } one sig Victim extends Process { } abstract sig Address { } abstract sig Cacheability { } one sig Cacheable extends Cacheability { } lone sig NonCacheable extends Cacheability { } sig CacheIndexL1 { } sig VirtualAddress extends Address { indexL1: one CacheIndexL1, map: one PhysicalAddress, cacheability: one Cacheability } sig PhysicalAddress extends Address { readers: set Process, writers: set Process, region: one Process} abstract sig Event { po: lone Event, NodeRel: set Location, process: one Process, coh: set Event, core: one Core, sub_uhb: set Location->Event->Location, urf : set Location->Event->Location, uco : set Location->Event->Location, ufr : set Location->Event->Location, ustb_flush: set Location->Event->Location, udep : set Location->Event->Location, uhb_spec : set Location->Event->Location, ucoh_inter : set Location->Event->Location, ucoh_intra : set Location->Event->Location, ustb: set Location->Event->Location, uvicl: set Location->Event->Location, ucci: set Location->Event->Location, usquash: set Location->Event->Location, ufence: set Location->Event->Location, uflush: set Location->Event->Location, uhb_inter: set Location->Event->Location, uhb_intra: set Location->Event->Location, uhb_proc: set Location->Event->Location } abstract sig MemoryEvent extends Event { address: one VirtualAddress } sig Read extends MemoryEvent { dep : set { MemoryEvent + CacheFlush } } sig Write extends MemoryEvent { rf: set Read, co: set Write, } abstract sig Fence extends Event { } sig FenceSC extends Fence { sc: set FenceSC } sig CacheFlush extends Event { flush_addr : one VirtualAddress } sig Branch extends Event { outcome : one Outcome, prediction : one Outcome } abstract sig Outcome { } one sig Taken extends Outcome { } one sig NotTaken extends Outcome { } //po fact po_acyclic { acyclic[po] } fact po_prior { all e: Event | lone e.~po } fun po_loc : MemoryEvent->MemoryEvent { ^po & (address.map).~(address.map) } //dep fact dep_in_po { dep in ^po } //com fun com : MemoryEvent->MemoryEvent { rf + fr + co } fact com_in_same_addr { com in (address.map).~(address.map) } //writes fact co_transitive { transitive[co] } fact co_total { all a: Address | total[co, a.~(address.map) & Write] } //reads fact lone_source_write { rf.~rf in iden } fun fr : Read->Write { ~rf.co + ((Read - (Write.rf)) <: ((address.map).~(address.map)) :> Write) } //rmws //fact rmw_adjacent { rmw in po & address.~address } // dep & address.~address } //fences fact sc_total { total[sc, FenceSC] } fun fence_sc : MemoryEvent->MemoryEvent { (MemoryEvent <: *po :> FenceSC).(FenceSC <: *po :> MemoryEvent) } ///////////////////////////////////////////////////////////////////////////////////// // Check module ///////////////////////////////////////////////////////////////////////////////////// abstract sig Location { } sig Node { event: one Event, loc: one Location, uhb: set Node } fact { all e, e' : Event | all l, l' : Location | e->l->e'->l' in sub_uhb => ( e->l in NodeRel and e'->l' in NodeRel ) } // uhb is the union of all u* relations fact { { urf + uco + ufr + udep + uhb_spec + ucoh_inter + ucoh_intra + ustb + ustb_flush + uvicl + ucci + usquash + uflush + uhb_inter + uhb_intra + uhb_proc } = sub_uhb } // no iden in uhb fact { all e, e' : Event | all l, l' : Location | e->e' in iden and l->l' in iden => not e->l->e'->l' in sub_uhb } // node mapping fact { all e : Event | all l : Location | e->l in NodeRel => one n : Node | n.event = e and n.loc = l } fact { all n : Node | n.event->n.loc in NodeRel } fact { all n, n' : Node | n->n' in uhb <=> n.event->n.loc->n'.event->n'.loc in sub_uhb } // uhb_intra only relates the same event to different locations fact { all e, e' : Event | all l, l' : Location | EdgeExists[e, l, e', l', uhb_intra] => SameEvent[e, e'] } // uhb_inter only relates different events on the same core fact { all e, e' : Event | all l, l' : Location | EdgeExists[e, l, e', l', uhb_inter] => not SameEvent[e, e'] } fact { all e, e' : Event | all l, l' : Location | EdgeExists[e, l, e', l', uhb_inter] => SameThread[e, e'] } pred ucheck { acyclic[uhb] } // ucheck is a predicate that requires acyclicity ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // =Alloy shortcuts= fun optional[f: univ->univ] : univ->univ { iden + f } pred transitive[rel: Event->Event] { rel.rel in rel } pred irreflexive[rel: Event->Event] { no iden & rel } pred irreflexive[rel: Node->Node] { no iden & rel } pred acyclic[rel: Event->Event] { irreflexive[^rel] } pred acyclic[rel: Node->Node] { irreflexive[^rel] } pred total[rel: Event->Event, bag: Event] { all disj e, e': bag | e->e' in rel + ~rel acyclic[rel] } pred u_irreflexive[node_rel: Event->Location->Event->Location] { no node_rel or ( all e, e': Event | all l, l': Location | e->l->e'->l' in node_rel => not ( (e->e') in iden and (l->l') in iden ) ) } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // =Alloy Check predicates and functions= fun CoreOf[e: Event] : Event { ( (Event - (Event.po)) & e ) + ( (Event - (Event.po)) & (^po.e) ) } fun CacheableRead : Read { Read <: address.cacheability.Cacheable } fun NonCacheableRead : Read { Read <: address.cacheability.NonCacheable } fun CacheableWrite : Write { Write <: address.cacheability.Cacheable } fun NonCacheableWrite : Write { Write <: address.cacheability.NonCacheable } fun CacheableEvent : MemoryEvent { MemoryEvent <: address.cacheability.Cacheable } fun NonCacheableEvent : MemoryEvent { MemoryEvent <: address.cacheability.NonCacheable } fun AttackerEvent : Event { process.Attacker } fun VictimEvent : Event { process.Victim } fun AttackerRead : Event { Read <: process.Attacker } fun AttackerWrite : Event { Write <: process.Attacker } fun VictimRead : Event { Read <: process.Victim } fun VictimWrite : Event { Write <: process.Victim } fun PhysicalAddress[e: Event] : PhysicalAddress { e.address.map + e.flush_addr.map } fun VirtualAddress[e: Event] : VirtualAddress { e.address + e.flush_addr } fun PredictedBranch : Branch { ((outcome.~prediction) & iden).Branch } fun MispredictedBranch : Branch { Branch - ((outcome.~prediction) & iden).Branch } pred NodeExists[e: Event, l: Location] { e->l in NodeRel } pred EdgeExists[e: Event, l: Location, e': Event, l': Location, node_rel: Event->Location->Event->Location] { e->l->e'->l' in node_rel } pred DataFromInitialStateAtPA[r: Read] { r in {Read - Write.rf} } pred HasDependency[r: Event, e: Event] { r->e in dep} pred IsAnyMemory[e: Event] { e in MemoryEvent} pred IsAnyRead[e: Event] { e in Read } pred IsAnyWrite[e: Event] { e in Write } pred IsAnyFence[e: Event] { e in Fence } pred IsAnyBranch[e: Event] { e in Fence } pred IsCacheFlush[e: Event] { e in CacheFlush } pred SameProcess[e: Event, e': Event] { e->e' in process.~process } pred SameCore[e: Event, e': Event] { e->e' in core.~core } pred SameThread[e: Event, e': Event] { e->e' in ^po + ^~po } pred SameLocation[l: Location, l': Location] { l->l' in iden } pred SameEvent[e: Event, e': Event] { e->e' in iden } pred ProgramOrder[e: Event, e': Event] { e->e' in ^po } pred IsCacheable[e: MemoryEvent] { (e.address).cacheability = Cacheable } pred IsIllegalRead[e: MemoryEvent] { (IsAnyRead[e] or IsCacheFlush[e]) and (not (e.process in PhysicalAddress[e].readers)) } pred IsIllegalWrite[e: MemoryEvent] { IsAnyWrite[e] and (not (e.process in PhysicalAddress[e].writers)) } pred DependsOnIllegal[e : MemoryEvent] { some r: Read | r->e in dep and IsIllegalRead[r] } pred ReadsFromIllegal[e : MemoryEvent] { IsAnyRead[e] and (some w: Write | w->e in rf and IsIllegalWrite[w]) } pred SameIndexL1 [e: Event, e': Event] { (e.address).indexL1 = (e'.address).indexL1 } pred NumProcessThreads[i: Int, P: Process] { #((Event - (Event.po)) & process.P)=i } pred NumThreads[i: Int] { #(Event - (Event.po))=i } pred SamePhysicalAddress[e: Event, e': Event] { e->e' in (address.map).~(address.map) or e->e' in (flush_addr.map).~(address.map) or e->e' in (address.map).~(flush_addr.map) or e->e' in (flush_addr.map).~(flush_addr.map) } pred SameVirtualAddress[e: Event, e': Event] { e->e' in address.~address or e->e' in flush_addr.~address or e->e' in address.~flush_addr or e->e' in flush_addr.~flush_addr } pred SameSourcingWrite[r: Read, r': Read] { not SameEvent[r, r'] and ( DataFromInitialStateAtPA[r] and DataFromInitialStateAtPA[r'] or // sourced by the same initial value r->r' in ~rf.rf ) }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1752.asm
ljhsiun2/medusa
9
179058
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_WT_ht+0x1d315, %r8 clflush (%r8) xor $8446, %r14 movb $0x61, (%r8) and %r12, %r12 lea addresses_A_ht+0x1be55, %r11 nop nop nop xor %r8, %r8 movb $0x61, (%r11) xor $28752, %r14 lea addresses_normal_ht+0x51d5, %r15 nop nop nop nop nop add $56575, %r11 movl $0x61626364, (%r15) nop nop nop nop nop dec %r8 lea addresses_A_ht+0xf1d5, %rsi lea addresses_normal_ht+0x10809, %rdi clflush (%rsi) nop nop sub $63522, %r8 mov $127, %rcx rep movsw nop and $58140, %rsi lea addresses_WT_ht+0x9f55, %r14 nop nop nop nop nop xor %rsi, %rsi mov $0x6162636465666768, %rdi movq %rdi, (%r14) inc %r15 pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r9 push %rbp push %rbx push %rsi // Store lea addresses_UC+0x16dd5, %r11 nop nop nop nop sub $28400, %rbp mov $0x5152535455565758, %r12 movq %r12, (%r11) nop nop nop nop sub $45838, %r9 // Faulty Load lea addresses_normal+0x149d5, %rbx nop nop and %rsi, %rsi mov (%rbx), %r13w lea oracles, %rbp and $0xff, %r13 shlq $12, %r13 mov (%rbp,%r13,1), %r13 pop %rsi pop %rbx pop %rbp pop %r9 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': True, 'AVXalign': True, 'size': 1, 'congruent': 6, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */