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/amf/uml/amf-uml-regions.ads
svn2github/matreshka
24
14865
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- 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 region is an orthogonal part of either a composite state or a state -- machine. It contains states and transitions. ------------------------------------------------------------------------------ limited with AMF.UML.Classifiers; with AMF.UML.Namespaces; with AMF.UML.Redefinable_Elements; limited with AMF.UML.State_Machines; limited with AMF.UML.States; limited with AMF.UML.Transitions.Collections; limited with AMF.UML.Vertexs.Collections; package AMF.UML.Regions is pragma Preelaborate; type UML_Region is limited interface and AMF.UML.Namespaces.UML_Namespace and AMF.UML.Redefinable_Elements.UML_Redefinable_Element; type UML_Region_Access is access all UML_Region'Class; for UML_Region_Access'Storage_Size use 0; not overriding function Get_Extended_Region (Self : not null access constant UML_Region) return AMF.UML.Regions.UML_Region_Access is abstract; -- Getter of Region::extendedRegion. -- -- The region of which this region is an extension. not overriding procedure Set_Extended_Region (Self : not null access UML_Region; To : AMF.UML.Regions.UML_Region_Access) is abstract; -- Setter of Region::extendedRegion. -- -- The region of which this region is an extension. not overriding function Get_Redefinition_Context (Self : not null access constant UML_Region) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Getter of Region::redefinitionContext. -- -- References the classifier in which context this element may be -- redefined. not overriding function Get_State (Self : not null access constant UML_Region) return AMF.UML.States.UML_State_Access is abstract; -- Getter of Region::state. -- -- The State that owns the Region. If a Region is owned by a State, then -- it cannot also be owned by a StateMachine. not overriding procedure Set_State (Self : not null access UML_Region; To : AMF.UML.States.UML_State_Access) is abstract; -- Setter of Region::state. -- -- The State that owns the Region. If a Region is owned by a State, then -- it cannot also be owned by a StateMachine. not overriding function Get_State_Machine (Self : not null access constant UML_Region) return AMF.UML.State_Machines.UML_State_Machine_Access is abstract; -- Getter of Region::stateMachine. -- -- The StateMachine that owns the Region. If a Region is owned by a -- StateMachine, then it cannot also be owned by a State. not overriding procedure Set_State_Machine (Self : not null access UML_Region; To : AMF.UML.State_Machines.UML_State_Machine_Access) is abstract; -- Setter of Region::stateMachine. -- -- The StateMachine that owns the Region. If a Region is owned by a -- StateMachine, then it cannot also be owned by a State. not overriding function Get_Subvertex (Self : not null access constant UML_Region) return AMF.UML.Vertexs.Collections.Set_Of_UML_Vertex is abstract; -- Getter of Region::subvertex. -- -- The set of vertices that are owned by this region. not overriding function Get_Transition (Self : not null access constant UML_Region) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is abstract; -- Getter of Region::transition. -- -- The set of transitions owned by the region. not overriding function Belongs_To_PSM (Self : not null access constant UML_Region) return Boolean is abstract; -- Operation Region::belongsToPSM. -- -- The operation belongsToPSM () checks if the region belongs to a -- protocol state machine not overriding function Containing_State_Machine (Self : not null access constant UML_Region) return AMF.UML.State_Machines.UML_State_Machine_Access is abstract; -- Operation Region::containingStateMachine. -- -- The operation containingStateMachine() returns the sate machine in -- which this Region is defined overriding function Is_Consistent_With (Self : not null access constant UML_Region; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is abstract; -- Operation Region::isConsistentWith. -- -- The query isConsistentWith() specifies that a redefining region is -- consistent with a redefined region provided that the redefining region -- is an extension of the redefined region, i.e. it adds vertices and -- transitions and it redefines states and transitions of the redefined -- region. not overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Region; Redefined : AMF.UML.Regions.UML_Region_Access) return Boolean is abstract; -- Operation Region::isRedefinitionContextValid. -- -- The query isRedefinitionContextValid() specifies whether the -- redefinition contexts of a region are properly related to the -- redefinition contexts of the specified region to allow this element to -- redefine the other. The containing statemachine/state of a redefining -- region must redefine the containing statemachine/state of the redefined -- region. not overriding function Redefinition_Context (Self : not null access constant UML_Region) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Operation Region::redefinitionContext. -- -- The redefinition context of a region is the nearest containing -- statemachine end AMF.UML.Regions;
kernel/gdt.asm
iocoder/upcr
0
98480
;############################################################################### ;# FILE NAME: KERNEL/GDT.ASM ;# DESCRIPTION: KERNEL GLOBAL DESCRIPTOR TABLE ;# AUTHOR: <NAME>. ;############################################################################### ;# ;# UPCR OPERATING SYSTEM FOR X86_64 ARCHITECTURE ;# COPYRIGHT (C) 2021 <NAME>. ;# ;# PERMISSION IS HEREBY GRANTED, FREE OF CHARGE, TO ANY PERSON OBTAINING A COPY ;# OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE "SOFTWARE"), TO DEAL ;# IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS ;# TO USE, COPY, MODIFY, MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL ;# COPIES OF THE SOFTWARE, AND TO PERMIT PERSONS TO WHOM THE SOFTWARE IS ;# FURNISHED TO DO SO, SUBJECT TO THE FOLLOWING CONDITIONS: ;# ;# THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL ;# COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. ;# ;############################################################################### ;# ;# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ;# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ;# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ;# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ;# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ;# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ;# SOFTWARE. ;# ;############################################################################### ;############################################################################### ;# INCLUDES # ;############################################################################### ;# COMMON DEFINITIONS USED BY KERNEL INCLUDE "kernel/macro.inc" ;############################################################################### ;# GLOBALS # ;############################################################################### ;# GLOBAL SYMBOLS PUBLIC KGDTINIT ;############################################################################### ;# TEXT SECTION # ;############################################################################### ;# TEXT SECTION SEGMENT ".text" ;#-----------------------------------------------------------------------------# ;# KGDTINIT() # ;#-----------------------------------------------------------------------------# KGDTINIT: ;# PRINT INIT MSG LEA RDI, [RIP+KGDTNAME] CALL KCONMOD LEA RDI, [RIP+KGDTMSG] CALL KCONSTR MOV RDI, '\n' CALL KCONCHR ;# COPY THE GDTR DESCRIPTOR TO LOWER MEMORY MOV RDI, MEM_GDTR MOV RAX, [RIP+KGDTDESC] MOV [RDI], RAX ;# COPY THE GDT TABLE TO LOWER MEMORY MOV RDI, MEM_GDT_TABLE LEA RSI, [RIP+KGDTSTART] LEA RCX, [RIP+KGDTDESC] SUB RCX, RSI ;# COPY LOOP 1: MOV AL, [RSI] MOV [RDI], AL INC RSI INC RDI LOOP 1b ;# LOAD GDTR DESCRIPTOR LGDT [MEM_GDTR] ;# MAKE A FAR JUMP TO RELOAD CS USING LONG-MODE LRETQ MOV RAX, 0x20 PUSH RAX LEA RAX, [RIP+2f] PUSH RAX LRETQ ;# RELOAD OTHER SEGMENT REGISTERS 2: MOV AX, 0x28 MOV DS, AX MOV ES, AX MOV FS, AX MOV GS, AX MOV SS, AX ;# DONE XOR RAX, RAX RET ;############################################################################### ;# DATA SECTION # ;############################################################################### ;# DATA SECTION SEGMENT ".data" ;############################################################################### ;# MODULE DATA # ;############################################################################### KGDTSTART: ;# GDT TABLE FOR PROTECTED AND LONG MODE DQ 0x0000000000000000 ;# 0x00 DQ 0x0000000000000000 ;# 0x00 DQ 0x00CF9A000000FFFF ;# 0x10 (KERN CODE 32-bit) DQ 0x00CF92000000FFFF ;# 0x18 (KERN DATA 32-bit) DQ 0x00AF9A000000FFFF ;# 0x20 (KERN CODE 64-bit) DQ 0x00AF92000000FFFF ;# 0x28 (KERN DATA 64-bit) DQ 0x00AFFA000000FFFF ;# 0x30 (USER CODE 64-bit) DQ 0x00AFF2000000FFFF ;# 0x38 (USER DATA 64-bit) KGDTDESC: ;# GDTR DESCRIPTOR DW 0xFFF DD MEM_GDT_TABLE DW 0 ;############################################################################### ;# LOGGING STRINGS # ;############################################################################### ;# GDT HEADING AND ASCII STRINGS KGDTNAME: DB "KERNEL GDT\0" KGDTMSG: DB "INITIALIZING GDT MODULE...\0"
install/lib/hdisk/partboot.asm
minblock/msdos
0
18544
;======================================================== COMMENT # PARTBOOT.ASM Copyright (c) 1991 - Microsoft Corp. All rights reserved. Microsoft Confidential ================================================= Reads in the first sector (boot record) of a hard disk partition. int ReadPartBootRec( struct Part *PartEntry, void *Buffer, int DrvNum ); ARGUMENTS: PartEntry - Partition table entry structure Buffer - Ptr to read buffer of 512 bytes DrvNum - Physical hard disk number RETURNS: int - 0 if successful - !0 if error ================================================= STRATEGY: Does an int 13h function 2 which reads a disk sector based on the following register settings which are taken from the passed parameters. AL = Number of sectors to read CH = Low 8 bits of max cylinder num CL = Bits 6&7 high order bytes of max cylinder num Bits 0-5 max sector num DH = Max head num DL = Number of drives (ignored) ES:BX = Ptr to buffer in memory ================================================= johnhe - 02/07/99 END COMMENT # ; ======================================================= PartitionInfo struc BootSig db ? StartHead db ? StartSector db ? StartCyl db ? PartType db ? EndHead db ? EndSec db ? EndCyl db ? RelativeSec dd ? TotalSecs dd ? PartitionInfo ends ; ======================================================= INCLUDE model.inc ; ======================================================= .CODE ; ======================================================= IF @DataSize ReadPartBootRec PROC USES DS ES, PartEntry:PTR, Buffer:PTR, DrvNum:BYTE ELSe ReadPartBootRec PROC PartEntry:PTR, Buffer:PTR, DrvNum:BYTE ENDIF ; lds BX,PartEntry ; DS:BX -> partition table entry LoadPtr DS, BX, PartEntry ; DS:BX -> partition table entry mov DH,[BX].StartHead ; DH == Disk head number mov CX,WORD PTR [BX].StartSector ; CH == Cylinder, CL == Sector mov DL,DrvNum ; DL == Physical disk number ; les BX,Buffer ; ES:BX -> Sector buffer LoadPtr ES, BX, Buffer ; ES:BX -> Sector buffer mov AX,0201h ; AH == Disk read, AL = 1 sector int 13h ; ROM BIOS disk access mov AX,-1 ; Setup for possible error jc ReadBootRecExit ; Error check xor AX,AX ; Signal no error ReadBootRecExit: ret ReadPartBootRec ENDP ; ======================================================= IF @DataSize WritePartBootRec PROC USES DS ES, PartEntry:PTR, Buffer:PTR, DrvNum:BYTE ELSE WritePartBootRec PROC PartEntry:PTR, Buffer:PTR, DrvNum:BYTE ENDIF ; lds BX,PartEntry ; DS:BX -> partition table entry LoadPtr DS, BX, PartEntry ; DS:BX -> partition table entry mov DH,[BX].StartHead ; DH == Disk head number mov CX,WORD PTR [BX].StartSector ; CH == Cylinder, CL == Sector mov DL,DrvNum ; DL == Physical disk number ; les BX,Buffer ; ES:BX -> Sector buffer LoadPtr ES, BX, Buffer ; ES:BX -> Sector buffer mov AX,0301h ; AH == Disk read, AL = 1 sector int 13h ; ROM BIOS disk access mov AX,-1 ; Setup for possible error jc WriteBootRecExit ; Error check xor AX,AX ; Signal no error WriteBootRecExit: ret WritePartBootRec ENDP ; ======================================================= END 
VirtualMachine/Win32/UnitTests/Conditionals/test6_and_Boolean.asm
ObjectPascalInterpreter/BookPart_3
8
23149
# Test6 - AND Test pushb true pushb false and halt
agda/BBHeap/Subtyping.agda
bgbianchi/sorting
6
4159
<filename>agda/BBHeap/Subtyping.agda open import Relation.Binary.Core module BBHeap.Subtyping {A : Set} (_≤_ : A → A → Set) (trans≤ : Transitive _≤_) where open import BBHeap _≤_ open import Bound.Lower A open import Bound.Lower.Order _≤_ open import Bound.Lower.Order.Properties _≤_ trans≤ subtyping : {b b' : Bound} → LeB b' b → BBHeap b → BBHeap b' subtyping _ leaf = leaf subtyping b'≤b (left b≤x l⋘r) = left (transLeB b'≤b b≤x) l⋘r subtyping b'≤b (right b≤x l⋙r) = right (transLeB b'≤b b≤x) l⋙r
oeis/084/A084472.asm
neoneye/loda-programs
11
93238
<reponame>neoneye/loda-programs ; A084472: Write n in binary and replace 0 with 00. ; Submitted by <NAME> ; 1,100,11,10000,1001,1100,111,1000000,100001,100100,10011,110000,11001,11100,1111,100000000,10000001,10000100,1000011,10010000,1001001,1001100,100111,11000000,1100001,1100100,110011,1110000 seq $0,84471 ; Change 0 to 00 in binary representation of n. seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
examples/substr.asm
mossx-dev/Mycore
0
161267
;; Author: <NAME> ;; Date: 20-Oct-21 %include "std/sys.asm" %include "std/args.asm" %include "std/str.asm" global _start section .data arg1: db "<string> <split start> <split end>", 0 section .text _start: mov r15, rsp call main mov eax, esi ; exit code call sys~exit ; call exit main: mov rax, 3 push arg1 call args~require pop rax mov rax, 2 call args~get mov r8, rsi mov rax, r8 call cstr~println mov rax, 3 call args~get mov rax, rsi call str#new_cs mov r9, rsi mov rax, r9 call str~to_int mov r10, rsi mov rax, 4 call args~get mov rax, rsi call str#new_cs mov r11, rsi mov rax, r11 call str~to_int mov r12, rsi mov rax, r8 call str#new_cs mov r13, rsi mov rax, r13 mov rbx, r10 mov rcx, r12 call str~substr mov rax, rsi call str~println .return: mov rsi, 0 ret
repl/libmarkab/strings.nasm
samblenny/markab-lab
0
164876
; Copyright (c) 2022 <NAME> ; SPDX-License-Identifier: MIT ; ; MarkabForth string words (meant to be included in ../libmarkab.nasm) ; This include path is relative to the working directory that will be in effect ; when running the Makefile in the parent directory of this file. So the ; include path is relative to ../Makefile, which is confusing. %include "libmarkab/common_macros.nasm" %include "libmarkab/generated_macros.nasm" extern mByteFetch extern mCompileU16 extern mCompileU8 extern mDrop extern mDup extern Mem extern mErr15HeapFull extern mErr23BadBufferPointer extern mErr4NoQuote extern mOnePlus extern mPush extern mRPopW extern mStrPut.RdiRsi extern mStrPut.W extern mToR extern mWordFetch global mDotQuoteC global mDotQuoteI global mSpace global mCR global mEmit global mEmit.W global mPrintDPStr mDotQuoteC: ; Print string literal to stdout (token compiled) movzx ecx, word [Mem+ebp] ; get length of string in bytes (to adjust I) add ecx, 2 ; add 2 for length word lea W, [Mem+ebp] ; I (ebp) should be pointing to {length, chars} add ebp, ecx ; adjust I past string jmp mStrPut.W ; Print a string literal from the input stream to stdout (interpret mode) ; input bytes come from [IBPtr] using [IBLen] and [IN] mDotQuoteI: movzx edi, word [Mem+IBPtr] ; Fetch input buffer pointer (index to Mem) cmp edi, BuffersStart ; Stop if buffer pointer is out of range jb .doneErr cmp edi, BuffersEnd jnb .doneErr lea edi, [Mem+edi] ; Resolve buffer pointer to address movzx esi, word [Mem+IBLen] ; Load and range check buffer's available bytes cmp esi, _1KB jnb .doneErr movzx ecx, word [Mem+IN] ; ecx = IN (index to next available byte of TIB) cmp esi, ecx ; stop looking if TIB_LEN <= IN (ran out of bytes) jna mErr4NoQuote ;------------------------ .forScanQuote: ; Find a double quote (") character mov WB, [rdi+rcx] ; check if current byte is '"' cmp WB, '"' jz .finish ; if so, stop looking inc ecx ; otherwise, advance the index cmp esi, ecx ; loop if there are more bytes jnz .forScanQuote jmp mErr4NoQuote ; reaching end of TIB without a quote is an error ;------------------------ .finish: movzx W, word [Mem+IN] mov esi, ecx ; ecx-[IN] is count of bytes copied to Pad sub esi, W add edi, W ; edi = [TIB] + (ecx-[IN]) (old edi was [TIB]) inc ecx ; store new IN (skip string and closing '"') mov word [Mem+IN], cx ;------------------------ test VMFlags, VMCompile ; check if compiled version if compile mode active jz mStrPut.RdiRsi ; nope: do mStrPut.RdiRsi(rdi: *buf, rsi: count) ;------------------------ .compileMode: cmp esi, 0 ; stop now if string is empty (optimize it out) jle .end sub edi, Mem ; convert edi back to virtual address space fPush edi, .end ; -> {T: *src} (string source pointer) fPush esi, .end ; -> {S: *src, T: count} (loop count: string length) fPush tDotQuoteC, .end ; -> {*src, S: count, T: tDotQuoteC} fDo CompileU8, .end ; -> {S: *src, T: count} (compile DotQuote token) fDo Dup, .end ; -> {*src, S: count, T: count} fDo CompileU16, .end ; -> {S: *src, T: count} (compile string length) ;------------------------ fDo ToR, .end ; -> {T: *src}, {R: count} (move loop count to R) .forCopy: fDo Dup, .end ; -> {S: *src, T: *src}, {R: count} fDo ByteFetch, .end ; -> {S: *src, T: [*src]}, {R: count} (get src byte) fDo CompileU8, .end ; -> {T: *src}, {R: count} (compile src byte) fDo OnePlus, .end ; -> {T: *src++}, {R: count} (increment source ptr) dec R ; -> {T: *src}, {R: count--} (decrement loop count) jnz .forCopy ; keep looping if R is non-zero fDo Drop, .end ; -> {}, {R: count) (discard source ptr from T) fDo RPopW, .end ; -> {}, {} (discard loop count from R) ;------------------------ .end: ret ;------------------------ .doneErr: jmp mErr23BadBufferPointer mSpace: ; Print a space to stdout mov W, ' ' jmp mEmit.W mCR: ; Print a CR (newline) to stdout mov W, 10 jmp mEmit.W mEmit: ; Print low byte of T as ascii char to stdout mov W, T push WQ call mDrop pop WQ .W: ; Print low byte of W as ascii char to stdout movzx esi, WB ; store WB in [edi: EmitBuf] lea edi, [Mem+EmitBuf] mov [edi], esi xor esi, esi ; esi = 1 (count of bytes in *edi) inc esi jmp mStrPut.RdiRsi mPrintDPStr: ; Print string from [DP] push rbp fPush DP, .end ; -> {T: DP (pointer to end of dictionary)} fDo WordFetch, .end ; -> {T: address (end of dictionary)} fDo Dup, .end ; -> {S: addr, T: addr} fDo ByteFetch, .end ; -> {S: addr, T: string length count} mov ebp, T ; ebp: count fDo Drop, .end ; -> {T: addr} fDo OnePlus, .end ; -> {T: addr+1} lea edi, [Mem+T] ; edi: *buf mov esi, ebp ; esi: count call mStrPut.RdiRsi ; print the string at [DP] fDo Drop, .end ; drop -> {} .end: pop rbp ret
src/interface/cl-events.ads
flyx/OpenCLAda
8
713
<reponame>flyx/OpenCLAda<filename>src/interface/cl-events.ads -------------------------------------------------------------------------------- -- Copyright (c) 2013, <NAME> <<EMAIL>> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- with CL.Command_Queues; package CL.Events is type Event is new Runtime_Object with null record; type Event_List is array (Integer range <>) of access constant Event'Class; type Command_Type is (NDRange_Kernel, C_Task, Native_Kernel, Read_Buffer, Write_Buffer, Copy_Buffer, Read_Image, Write_Image, Copy_Image, Copy_Image_To_Buffer, Copy_Buffer_To_Image, Map_Buffer, Map_Image, Unmap_Mem_Object, Marker, Acquire_GL_Objects, Release_GL_Objects, Read_Buffer_Rect, Write_Buffer_Rect, Copy_Buffer_Rect, User); type Execution_Status is (Complete, Running, Submitted, Queued); overriding procedure Adjust (Object : in out Event); overriding procedure Finalize (Object : in out Event); procedure Wait_For (Subject : Event); procedure Wait_For (Subjects : Event_List); function Command_Queue (Source : Event) return Command_Queues.Queue; function Kind (Source : Event) return Command_Type; function Reference_Count (Source : Event) return UInt; function Status (Source : Event) return Execution_Status; -- these values are only available if profiling is enabled for the -- Command_Queue the event belongs to function Queued_At (Source : Event) return ULong; function Submitted_At (Source : Event) return ULong; function Started_At (Source : Event) return ULong; function Ended_At (Source : Event) return ULong; No_Events : constant Event_List (1 .. 0) := (others => <>); private for Command_Type use (NDRange_Kernel => 16#11F0#, C_Task => 16#11F1#, Native_Kernel => 16#11F2#, Read_Buffer => 16#11F3#, Write_Buffer => 16#11F4#, Copy_Buffer => 16#11F5#, Read_Image => 16#11F6#, Write_Image => 16#11F7#, Copy_Image => 16#11F8#, Copy_Image_To_Buffer => 16#11F9#, Copy_Buffer_To_Image => 16#11FA#, Map_Buffer => 16#11FB#, Map_Image => 16#11FC#, Unmap_Mem_Object => 16#11FD#, Marker => 16#11FE#, Acquire_GL_Objects => 16#11FF#, Release_GL_Objects => 16#1200#, Read_Buffer_Rect => 16#1201#, Write_Buffer_Rect => 16#1202#, Copy_Buffer_Rect => 16#1203#, User => 16#1204#); for Command_Type'Size use UInt'Size; for Execution_Status use (Complete => 16#0#, Running => 16#1#, Submitted => 16#2#, Queued => 16#3#); for Execution_Status'Size use UInt'Size; end CL.Events;
DiceScript2.0/DiceScript20Lexer.g4
wiredwiz/Edgerunner.Dice
0
7194
<reponame>wiredwiz/Edgerunner.Dice<gh_stars>0 lexer grammar DiceScript20Lexer; channels { COMMENTS_CHANNEL } /* * Lexer Rules */ SINGLE_LINE_COMMENT : '//' INPUT_CHARACTER* -> channel(COMMENTS_CHANNEL); DELIMITED_COMMENT : '/*' .*? '*/' -> channel(COMMENTS_CHANNEL); WS : [ \t\r\n] -> channel(HIDDEN) ; COMMA : ','; EXPLODE : '!'; COMPOUND : '!!'; PENETRATION : '!' P; LEFT_BRACKET : '['; RIGHT_BRACKET : ']'; VALUE : '@{' -> pushMode(SUBSTITUTION); LEFT_CURLY_BRACE : '{'; RIGHT_CURLY_BRACE : '}'; LEFT_PARENTHESIS : '('; RIGHT_PARENTHESIS : ')'; INLINE_START : '[['; INLINE_STOP : ']]'; PLUS : '+'; MINUS : '-'; MULTIPLY : '*'; DIVIDE : '/'; EXPONENTIATION : '**'; MODULUS : '%'; EQUAL : '='; POUND : '#'; QMARK : '?'; AMPERSAND : '&'; COLON : ':'; SEMI : ';'; MAX : M A X; OP_SUM_TARGET : '+#'; OP_SUM_GREATER_THAN : '+>'; OP_SUM_LESS_THAN : '+<'; OP_LESS_THAN : '<'; OP_GREATER_THAN : '>'; UNDERSCORE : '_'; REROLL : R; REROLL_ONCE : R O; FAILURE : F; CRITICAL_SUCCESS : C S; CRITICAL_FAILURE : C F; FATE_DIE_CODE : D F; BASIC_DIE_CODE : D; SPECIALTY_DIE_CODE : D '-' (LETTER | DIGIT) (LETTER | DIGIT | UNDERSCORE)*; OP_DROP_LOW : D L; OP_DROP_HIGH : D H; OP_KEEP_LOW : K L; OP_KEEP_HIGH : K H; OP_MATCH : M; OP_MATCH_TRANSFORM : M T; OPTIONS : O P T I O N S; CRITICAL_SUCCESS_MULTIPLIER : C X; BOTCH : B O T C H; ALL_CRITICAL_FAILURES : A L L C R I T F A I L U R E S; NET_CRITICAL_FAILURES : N E T C R I T F A I L U R E S; SUBTRACT_CRITICAL_FAILURES_FROM_SUCCESSES : S U B T R A C T C R I T I C A L F A I L U R E S F R O M S U C C E S S E S; NUMBER : DIGIT+; FLOAT : DIGIT+ [.] DIGIT+ (EXPONENTNOTATION EXPONENTSIGN DIGIT+)? | DIGIT+ EXPONENTNOTATION EXPONENTSIGN DIGIT+ ; IDENTIFIER : (LETTER | UNDERSCORE) (LETTER | DIGIT | UNDERSCORE)* {_input.La(1) == '('}? ; LETTER : LOWERCASE | UPPERCASE ; /* * Lexer mode for handling substitution values */ mode SUBSTITUTION; CLOSE_VALUE : '}' -> popMode; IDENTIFIER2 : (LETTER2 | UNDERSCORE) (LETTER2 | DIGIT | '_')* -> type(IDENTIFIER) ; LETTER2 : (LOWERCASE | UPPERCASE) -> type(LETTER) ; /* * fragments */ fragment LOWERCASE : [a-z] ; fragment UPPERCASE : [A-Z] ; fragment EXPONENTNOTATION : ('E' | 'e'); fragment EXPONENTSIGN : ('-' | '+'); fragment DIGIT : [0-9] ; fragment ESC : '\\"' | '\\\\' ; fragment INPUT_CHARACTER : ~[\r\n\u0085\u2028\u2029]; fragment A : [aA]; fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ];
src/pql/Query.g4
Hexaae/picotorrent
0
782
<reponame>Hexaae/picotorrent<filename>src/pql/Query.g4 grammar Query; AND : 'and'; OR : 'or'; // comparison operators EQ : '='; CONTAINS : '~'; GT : '>'; GTE : '>='; LT : '<'; LTE : '<='; WS : [ \t\r\n]+ -> skip ; INT : '-'? [0-9]+ ; FLOAT : '-'? [0-9]+'.'[0-9]+ ; STRING : '"' .*? '"' ; SIZE_SUFFIX : 'kb'|'mb'|'gb' | 'kbps' | 'mbps' | 'gbps'; ID : [a-zA-Z_] [a-zA-Z_0-9.]*; filter : expression ; expression : expression AND expression #AndExpression | expression OR expression #OrExpression | predicate #PredicateExpression ; reference: ID; predicate : reference oper value #OperatorPredicate ; oper : EQ | CONTAINS | GT | GTE | LT | LTE ; value : INT SIZE_SUFFIX? | FLOAT | STRING ;
programs/oeis/085/A085405.asm
jmorken/loda
1
13719
; A085405: Common residues of binomial(3n+2,n+1)/(3n+2) modulo 2. ; 1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mul $0,2 add $0,1 cal $0,324964 ; a(n) = A000139(n) mod 2; Characteristic function of odd fibbinary numbers (A022341). mov $1,$0
oeis/080/A080957.asm
neoneye/loda-programs
11
5450
; A080957: Expansion of (5 - 9*x + 6*x^2)/(1-x)^4. ; 5,11,20,34,55,85,126,180,249,335,440,566,715,889,1090,1320,1581,1875,2204,2570,2975,3421,3910,4444,5025,5655,6336,7070,7859,8705,9610,10576,11605,12699,13860,15090,16391,17765,19214,20740,22345,24031,25800,27654,29595,31625,33746,35960,38269,40675,43180,45786,48495,51309,54230,57260,60401,63655,67024,70510,74115,77841,81690,85664,89765,93995,98356,102850,107479,112245,117150,122196,127385,132719,138200,143830,149611,155545,161634,167880,174285,180851,187580,194474,201535,208765,216166,223740 mov $2,5 lpb $0 add $2,$0 sub $0,1 add $1,$2 lpe add $1,5 mov $0,$1
programs/oeis/061/A061249.asm
neoneye/loda
22
83843
; A061249: Smallest number with digit sum = Fibonacci(n). ; 0,1,1,2,3,5,8,49,399,7999,1999999,8999999999,9999999999999999,89999999999999999999999999 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. seq $0,51885 ; Smallest number whose sum of digits is n.
GIOVANNI/gambatte/test/hwtests/halt/lycirq_scy_during_m3_2.asm
ReallyEvilFish/1234
9
16196
.size 8000 .text@100 jp lbegin .text@150 lbegin: ld c, 44 ld b, 90 lbegin_waitvblank: ldff a, (c) cmp a, b jrnz lbegin_waitvblank ld hl, 8010 ld a, ff ld(hl++), a ld(hl++), a ld a, 01 ld b, 32 ld hl, 9a40 lbegin_settilemap: ld(hl++), a dec b jrnz lbegin_settilemap ld a, c0 ldff(47), a ld c, 41 ld b, 03 lbegin_waitm3: ldff a, (c) and a, b cmp a, b jrnz lbegin_waitm3 xor a, a ldff(45), a ld a, 40 ldff(c), a ld a, 02 ldff(ff), a ld c, 42 ld b, 90 lwait_lycirq: halt xor a, a ldff(0f), a jp llycint .text@1000 llycint: nop nop nop nop ldff a, (44) ld d, a ld a, b sub a, d ldff(c), a xor a, a .text@102f ldff(c), a ld a, d inc a cmp a, b jrnz llycint_waitlya xor a, a llycint_waitlya: ldff(45), a jp lwait_lycirq
test/Succeed/Issue1544.agda
cruhland/agda
1,989
7092
-- Andreas, 2015-07-16 issue reported by G.Allais -- This ought to pass, ideally, but the lack of positivity polymorphism -- does not allow for a precise analysis of the composition operator. -- -- Subsequently, the positivity analysis for tabulate returns no -- positivity info for all arguments, leading to a rejection of -- Command₃. -- {-# OPTIONS -v tc.pos:10 #-} open import Common.Product open import Common.List record ⊤ {a} : Set a where _∘_ : ∀ {a b c} {A : Set a} {B : A → Set b} {C : {x : A} → B x → Set c} → (∀ {x} (y : B x) → C y) → (g : (x : A) → B x) → ((x : A) → C (g x)) f ∘ g = λ x → f (g x) postulate String : Set USL = List String data _∈_ a : USL → Set where z : ∀ {xs} → a ∈ (a ∷ xs) s : ∀ {b xs} → a ∈ xs → a ∈ (b ∷ xs) [Fields] : (args : USL) → Set₁ [Fields] [] = ⊤ [Fields] (_ ∷ args) = Set × [Fields] args [tabulate] : (args : USL) (ρ : {arg : _} (pr : arg ∈ args) → Set) → [Fields] args [tabulate] [] ρ = _ [tabulate] (arg ∷ args) ρ = ρ z , [tabulate] args (λ x → ρ (s x)) [Record] : (args : USL) (f : [Fields] args) → Set [Record] [] _ = ⊤ [Record] (hd ∷ args) (f , fs) = f × [Record] args fs record Fields (args : USL) : Set₁ where constructor mkFields field fields : [Fields] args open Fields public record Record (args : USL) (f : Fields args) : Set where constructor mkRecord field content : [Record] args (fields f) open Record public module WORKS where tabulate : {args : USL} (ρ : {arg : _} (pr : arg ∈ args) → Set) → Fields args tabulate {args = args} ρ = mkFields ([tabulate] args ρ) -- WORKS -- tabulate {args = args} = mkFields ∘ [tabulate] args -- FAILS mutual data Command₁ : Set where mkCommand : (modifierNames : USL) → Record modifierNames (tabulate (λ {s} _ → Modifier s)) → Command₁ record Command₂ : Set where inductive field modifierNames : USL modifiers : [Record] modifierNames ([tabulate] _ (λ {s} _ → Modifier s)) record Command₃ : Set where inductive field modifierNames : USL modifiers : Record modifierNames (tabulate (λ {s} _ → Modifier s)) data Modifier (name : String) : Set where command₁ : Command₁ → Modifier name command₂ : Command₂ → Modifier name command₃ : Command₃ → Modifier name module FAILS where tabulate : {args : USL} (ρ : {arg : _} (pr : arg ∈ args) → Set) → Fields args -- tabulate {args = args} ρ = mkFields ([tabulate] args ρ) -- WORKS tabulate {args = args} = mkFields ∘ [tabulate] args -- FAILS mutual data Command₁ : Set where mkCommand : (modifierNames : USL) → Record modifierNames (tabulate (λ {s} _ → Modifier s)) → Command₁ record Command₂ : Set where inductive field modifierNames : USL modifiers : [Record] modifierNames ([tabulate] _ (λ {s} _ → Modifier s)) record Command₃ : Set where inductive field modifierNames : USL modifiers : Record modifierNames (tabulate (λ {s} _ → Modifier s)) data Modifier (name : String) : Set where command₁ : Command₁ → Modifier name command₂ : Command₂ → Modifier name command₃ : Command₃ → Modifier name
programs/oeis/064/A064437.asm
karttu/loda
0
175337
<filename>programs/oeis/064/A064437.asm ; A064437: a(1)=1, a(n)=a(n-1)+3 if n is already in the sequence, a(n)=a(n-1)+2 otherwise. ; 1,3,6,8,10,13,15,18,20,23,25,27,30,32,35,37,39,42,44,47,49,51,54,56,59,61,64,66,68,71,73,76,78,80,83,85,88,90,93,95,97,100,102,105,107,109,112,114,117,119,122,124,126,129,131,134,136,138,141,143,146,148,150,153,155,158,160,163,165,167,170,172,175,177,179,182,184,187,189,192,194,196,199,201,204,206,208,211,213,216,218,220,223,225,228,230,233,235,237,240,242,245,247,249,252,254,257,259,262,264,266,269,271,274,276,278,281,283,286,288,290,293,295,298,300,303,305,307,310,312,315,317,319,322,324,327,329,332,334,336,339,341,344,346,348,351,353,356,358,361,363,365,368,370,373,375,377,380,382,385,387,389,392,394,397,399,402,404,406,409,411,414,416,418,421,423,426,428,431,433,435,438,440,443,445,447,450,452,455,457,459,462,464,467,469,472,474,476,479,481,484,486,488,491,493,496,498,501,503,505,508,510,513,515,517,520,522,525,527,530,532,534,537,539,542,544,546,549,551,554,556,558,561,563,566,568,571,573,575,578,580,583,585,587,590,592,595,597,600,602 mov $13,$0 mov $15,$0 add $15,1 lpb $15,1 mov $0,$13 sub $15,1 sub $0,$15 mov $9,$0 mov $11,2 lpb $11,1 clr $0,9 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mov $2,$0 lpb $2,1 mov $3,$2 sub $3,1 mov $5,2 mov $6,$2 mul $6,$0 lpb $6,1 sub $6,$3 add $3,1 trn $6,$3 lpe trn $2,461 mul $3,$5 lpe mov $1,$3 mov $12,$11 lpb $12,1 mov $10,$1 sub $12,1 lpe lpe lpb $9,1 mov $9,0 sub $10,$1 lpe mov $1,$10 div $1,2 add $1,1 add $14,$1 lpe mov $1,$14
Sources/Globe_3d/objects/globe_3d-sprite.ads
ForYouEyesOnly/Space-Convoy
1
16590
------------------------------------------------------------------------- -- GLOBE_3D - GL - based, real - time, 3D engine -- -- Copyright (c) <NAME>/<NAME> 2007 -- CH - 8810 Horgen -- SWITZERLAND -- Permission granted to use this software, without any warranty, -- for any purpose, provided this copyright note remains attached -- and unmodified if sources are distributed further. ------------------------------------------------------------------------- pragma Warnings (Off); pragma Style_Checks (Off); with GL, GL.Geometry, GL.Skins, GL.skinned_Geometry; package GLOBE_3D.Sprite is -- a 'Visual' which consists of multiple GL.skinned_Geometrys type Sprite (max_Geometrys : Positive) is new Visual with record skinned_Geometrys : GL.skinned_geometry.skinned_Geometrys (1 .. max_Geometrys); skinned_geometry_Count : Natural := 0; -- private: is_Transparent : Boolean := False; face_Count : Natural := 0; Bounds : GL.geometry.Bounds_record; end record; type p_Sprite is access all Sprite'Class; type p_sprite_Grid is array (Positive range <>, Positive range <>) of p_Sprite; procedure destroy (o : in out Sprite); procedure set_Alpha (o : in out Sprite; Alpha : in GL.Double); function is_Transparent (o : in Sprite) return Boolean; function skinned_Geometrys (o : in Sprite) return GL.skinned_geometry.skinned_Geometrys; procedure add (o : in out Sprite; Geometry : access GL.geometry.Geometry_t'Class; Skin : access GL.skins.Skin'Class); procedure Pre_calculate (o : in out Sprite); procedure Display ( o : in out Sprite; clip : in Clipping_data ); function face_Count (o : in Sprite) return Natural; function Bounds (o : in Sprite) return GL.geometry.Bounds_record; end GLOBE_3D.Sprite;
programs/oeis/231/A231677.asm
karttu/loda
0
94165
; A231677: a(n) = Sum_{i=0..n} digsum_7(i)^2, where digsum_7(i) = A053828(i). ; 0,1,5,14,30,55,91,92,96,105,121,146,182,231,235,244,260,285,321,370,434,443,459,484,520,569,633,714,730,755,791,840,904,985,1085,1110,1146,1195,1259,1340,1440,1561,1597,1646,1710,1791,1891,2012,2156,2157,2161,2170,2186,2211,2247,2296,2300,2309,2325,2350,2386,2435,2499,2508,2524,2549,2585,2634,2698,2779 mov $4,$0 mov $6,$0 lpb $4,1 mov $0,$6 sub $4,1 sub $0,$4 add $3,1 lpb $3,1 add $2,1 sub $3,1 lpb $2,1 sub $2,1 cal $0,53828 ; Sum of digits of (n written in base 7). mul $0,2 mov $5,$0 pow $5,2 mul $5,2 lpe lpe div $5,8 add $1,$5 lpe
source/amf/uml/amf-factories-uml_factories.ads
svn2github/matreshka
24
18048
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.UML.Abstractions; with AMF.UML.Accept_Call_Actions; with AMF.UML.Accept_Event_Actions; with AMF.UML.Action_Execution_Specifications; with AMF.UML.Action_Input_Pins; with AMF.UML.Activities; with AMF.UML.Activity_Final_Nodes; with AMF.UML.Activity_Parameter_Nodes; with AMF.UML.Activity_Partitions; with AMF.UML.Actors; with AMF.UML.Add_Structural_Feature_Value_Actions; with AMF.UML.Add_Variable_Value_Actions; with AMF.UML.Any_Receive_Events; with AMF.UML.Artifacts; with AMF.UML.Association_Classes; with AMF.UML.Associations; with AMF.UML.Behavior_Execution_Specifications; with AMF.UML.Broadcast_Signal_Actions; with AMF.UML.Call_Behavior_Actions; with AMF.UML.Call_Events; with AMF.UML.Call_Operation_Actions; with AMF.UML.Central_Buffer_Nodes; with AMF.UML.Change_Events; with AMF.UML.Classes; with AMF.UML.Classifier_Template_Parameters; with AMF.UML.Clauses; with AMF.UML.Clear_Association_Actions; with AMF.UML.Clear_Structural_Feature_Actions; with AMF.UML.Clear_Variable_Actions; with AMF.UML.Collaboration_Uses; with AMF.UML.Collaborations; with AMF.UML.Combined_Fragments; with AMF.UML.Comments; with AMF.UML.Communication_Paths; with AMF.UML.Component_Realizations; with AMF.UML.Components; with AMF.UML.Conditional_Nodes; with AMF.UML.Connectable_Element_Template_Parameters; with AMF.UML.Connection_Point_References; with AMF.UML.Connector_Ends; with AMF.UML.Connectors; with AMF.UML.Consider_Ignore_Fragments; with AMF.UML.Constraints; with AMF.UML.Continuations; with AMF.UML.Control_Flows; with AMF.UML.Create_Link_Actions; with AMF.UML.Create_Link_Object_Actions; with AMF.UML.Create_Object_Actions; with AMF.UML.Data_Store_Nodes; with AMF.UML.Data_Types; with AMF.UML.Decision_Nodes; with AMF.UML.Dependencies; with AMF.UML.Deployment_Specifications; with AMF.UML.Deployments; with AMF.UML.Destroy_Link_Actions; with AMF.UML.Destroy_Object_Actions; with AMF.UML.Destruction_Occurrence_Specifications; with AMF.UML.Devices; with AMF.UML.Duration_Constraints; with AMF.UML.Duration_Intervals; with AMF.UML.Duration_Observations; with AMF.UML.Durations; with AMF.UML.Element_Imports; with AMF.UML.Enumeration_Literals; with AMF.UML.Enumerations; with AMF.UML.Exception_Handlers; with AMF.UML.Execution_Environments; with AMF.UML.Execution_Occurrence_Specifications; with AMF.UML.Expansion_Nodes; with AMF.UML.Expansion_Regions; with AMF.UML.Expressions; with AMF.UML.Extends; with AMF.UML.Extension_Ends; with AMF.UML.Extension_Points; with AMF.UML.Extensions; with AMF.UML.Final_States; with AMF.UML.Flow_Final_Nodes; with AMF.UML.Fork_Nodes; with AMF.UML.Function_Behaviors; with AMF.UML.Gates; with AMF.UML.General_Orderings; with AMF.UML.Generalization_Sets; with AMF.UML.Generalizations; with AMF.UML.Images; with AMF.UML.Includes; with AMF.UML.Information_Flows; with AMF.UML.Information_Items; with AMF.UML.Initial_Nodes; with AMF.UML.Input_Pins; with AMF.UML.Instance_Specifications; with AMF.UML.Instance_Values; with AMF.UML.Interaction_Constraints; with AMF.UML.Interaction_Operands; with AMF.UML.Interaction_Uses; with AMF.UML.Interactions; with AMF.UML.Interface_Realizations; with AMF.UML.Interfaces; with AMF.UML.Interruptible_Activity_Regions; with AMF.UML.Interval_Constraints; with AMF.UML.Intervals; with AMF.UML.Join_Nodes; with AMF.UML.Lifelines; with AMF.UML.Link_End_Creation_Datas; with AMF.UML.Link_End_Datas; with AMF.UML.Link_End_Destruction_Datas; with AMF.UML.Literal_Booleans; with AMF.UML.Literal_Integers; with AMF.UML.Literal_Nulls; with AMF.UML.Literal_Reals; with AMF.UML.Literal_Strings; with AMF.UML.Literal_Unlimited_Naturals; with AMF.UML.Loop_Nodes; with AMF.UML.Manifestations; with AMF.UML.Merge_Nodes; with AMF.UML.Message_Occurrence_Specifications; with AMF.UML.Messages; with AMF.UML.Models; with AMF.UML.Nodes; with AMF.UML.Object_Flows; with AMF.UML.Occurrence_Specifications; with AMF.UML.Opaque_Actions; with AMF.UML.Opaque_Behaviors; with AMF.UML.Opaque_Expressions; with AMF.UML.Operation_Template_Parameters; with AMF.UML.Operations; with AMF.UML.Output_Pins; with AMF.UML.Package_Imports; with AMF.UML.Package_Merges; with AMF.UML.Packages; with AMF.UML.Parameter_Sets; with AMF.UML.Parameters; with AMF.UML.Part_Decompositions; with AMF.UML.Ports; with AMF.UML.Primitive_Types; with AMF.UML.Profile_Applications; with AMF.UML.Profiles; with AMF.UML.Properties; with AMF.UML.Protocol_Conformances; with AMF.UML.Protocol_State_Machines; with AMF.UML.Protocol_Transitions; with AMF.UML.Pseudostates; with AMF.UML.Qualifier_Values; with AMF.UML.Raise_Exception_Actions; with AMF.UML.Read_Extent_Actions; with AMF.UML.Read_Is_Classified_Object_Actions; with AMF.UML.Read_Link_Actions; with AMF.UML.Read_Link_Object_End_Actions; with AMF.UML.Read_Link_Object_End_Qualifier_Actions; with AMF.UML.Read_Self_Actions; with AMF.UML.Read_Structural_Feature_Actions; with AMF.UML.Read_Variable_Actions; with AMF.UML.Realizations; with AMF.UML.Receptions; with AMF.UML.Reclassify_Object_Actions; with AMF.UML.Redefinable_Template_Signatures; with AMF.UML.Reduce_Actions; with AMF.UML.Regions; with AMF.UML.Remove_Structural_Feature_Value_Actions; with AMF.UML.Remove_Variable_Value_Actions; with AMF.UML.Reply_Actions; with AMF.UML.Send_Object_Actions; with AMF.UML.Send_Signal_Actions; with AMF.UML.Sequence_Nodes; with AMF.UML.Signal_Events; with AMF.UML.Signals; with AMF.UML.Slots; with AMF.UML.Start_Classifier_Behavior_Actions; with AMF.UML.Start_Object_Behavior_Actions; with AMF.UML.State_Invariants; with AMF.UML.State_Machines; with AMF.UML.States; with AMF.UML.Stereotypes; with AMF.UML.String_Expressions; with AMF.UML.Structured_Activity_Nodes; with AMF.UML.Substitutions; with AMF.UML.Template_Bindings; with AMF.UML.Template_Parameter_Substitutions; with AMF.UML.Template_Parameters; with AMF.UML.Template_Signatures; with AMF.UML.Test_Identity_Actions; with AMF.UML.Time_Constraints; with AMF.UML.Time_Events; with AMF.UML.Time_Expressions; with AMF.UML.Time_Intervals; with AMF.UML.Time_Observations; with AMF.UML.Transitions; with AMF.UML.Triggers; with AMF.UML.Unmarshall_Actions; with AMF.UML.Usages; with AMF.UML.Use_Cases; with AMF.UML.Value_Pins; with AMF.UML.Value_Specification_Actions; with AMF.UML.Variables; package AMF.Factories.UML_Factories is pragma Preelaborate; type UML_Factory is limited interface and AMF.Factories.Factory; type UML_Factory_Access is access all UML_Factory'Class; for UML_Factory_Access'Storage_Size use 0; not overriding function Create_Abstraction (Self : not null access UML_Factory) return AMF.UML.Abstractions.UML_Abstraction_Access is abstract; not overriding function Create_Accept_Call_Action (Self : not null access UML_Factory) return AMF.UML.Accept_Call_Actions.UML_Accept_Call_Action_Access is abstract; not overriding function Create_Accept_Event_Action (Self : not null access UML_Factory) return AMF.UML.Accept_Event_Actions.UML_Accept_Event_Action_Access is abstract; not overriding function Create_Action_Execution_Specification (Self : not null access UML_Factory) return AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification_Access is abstract; not overriding function Create_Action_Input_Pin (Self : not null access UML_Factory) return AMF.UML.Action_Input_Pins.UML_Action_Input_Pin_Access is abstract; not overriding function Create_Activity (Self : not null access UML_Factory) return AMF.UML.Activities.UML_Activity_Access is abstract; not overriding function Create_Activity_Final_Node (Self : not null access UML_Factory) return AMF.UML.Activity_Final_Nodes.UML_Activity_Final_Node_Access is abstract; not overriding function Create_Activity_Parameter_Node (Self : not null access UML_Factory) return AMF.UML.Activity_Parameter_Nodes.UML_Activity_Parameter_Node_Access is abstract; not overriding function Create_Activity_Partition (Self : not null access UML_Factory) return AMF.UML.Activity_Partitions.UML_Activity_Partition_Access is abstract; not overriding function Create_Actor (Self : not null access UML_Factory) return AMF.UML.Actors.UML_Actor_Access is abstract; not overriding function Create_Add_Structural_Feature_Value_Action (Self : not null access UML_Factory) return AMF.UML.Add_Structural_Feature_Value_Actions.UML_Add_Structural_Feature_Value_Action_Access is abstract; not overriding function Create_Add_Variable_Value_Action (Self : not null access UML_Factory) return AMF.UML.Add_Variable_Value_Actions.UML_Add_Variable_Value_Action_Access is abstract; not overriding function Create_Any_Receive_Event (Self : not null access UML_Factory) return AMF.UML.Any_Receive_Events.UML_Any_Receive_Event_Access is abstract; not overriding function Create_Artifact (Self : not null access UML_Factory) return AMF.UML.Artifacts.UML_Artifact_Access is abstract; not overriding function Create_Association (Self : not null access UML_Factory) return AMF.UML.Associations.UML_Association_Access is abstract; not overriding function Create_Association_Class (Self : not null access UML_Factory) return AMF.UML.Association_Classes.UML_Association_Class_Access is abstract; not overriding function Create_Behavior_Execution_Specification (Self : not null access UML_Factory) return AMF.UML.Behavior_Execution_Specifications.UML_Behavior_Execution_Specification_Access is abstract; not overriding function Create_Broadcast_Signal_Action (Self : not null access UML_Factory) return AMF.UML.Broadcast_Signal_Actions.UML_Broadcast_Signal_Action_Access is abstract; not overriding function Create_Call_Behavior_Action (Self : not null access UML_Factory) return AMF.UML.Call_Behavior_Actions.UML_Call_Behavior_Action_Access is abstract; not overriding function Create_Call_Event (Self : not null access UML_Factory) return AMF.UML.Call_Events.UML_Call_Event_Access is abstract; not overriding function Create_Call_Operation_Action (Self : not null access UML_Factory) return AMF.UML.Call_Operation_Actions.UML_Call_Operation_Action_Access is abstract; not overriding function Create_Central_Buffer_Node (Self : not null access UML_Factory) return AMF.UML.Central_Buffer_Nodes.UML_Central_Buffer_Node_Access is abstract; not overriding function Create_Change_Event (Self : not null access UML_Factory) return AMF.UML.Change_Events.UML_Change_Event_Access is abstract; not overriding function Create_Class (Self : not null access UML_Factory) return AMF.UML.Classes.UML_Class_Access is abstract; not overriding function Create_Classifier_Template_Parameter (Self : not null access UML_Factory) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is abstract; not overriding function Create_Clause (Self : not null access UML_Factory) return AMF.UML.Clauses.UML_Clause_Access is abstract; not overriding function Create_Clear_Association_Action (Self : not null access UML_Factory) return AMF.UML.Clear_Association_Actions.UML_Clear_Association_Action_Access is abstract; not overriding function Create_Clear_Structural_Feature_Action (Self : not null access UML_Factory) return AMF.UML.Clear_Structural_Feature_Actions.UML_Clear_Structural_Feature_Action_Access is abstract; not overriding function Create_Clear_Variable_Action (Self : not null access UML_Factory) return AMF.UML.Clear_Variable_Actions.UML_Clear_Variable_Action_Access is abstract; not overriding function Create_Collaboration (Self : not null access UML_Factory) return AMF.UML.Collaborations.UML_Collaboration_Access is abstract; not overriding function Create_Collaboration_Use (Self : not null access UML_Factory) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is abstract; not overriding function Create_Combined_Fragment (Self : not null access UML_Factory) return AMF.UML.Combined_Fragments.UML_Combined_Fragment_Access is abstract; not overriding function Create_Comment (Self : not null access UML_Factory) return AMF.UML.Comments.UML_Comment_Access is abstract; not overriding function Create_Communication_Path (Self : not null access UML_Factory) return AMF.UML.Communication_Paths.UML_Communication_Path_Access is abstract; not overriding function Create_Component (Self : not null access UML_Factory) return AMF.UML.Components.UML_Component_Access is abstract; not overriding function Create_Component_Realization (Self : not null access UML_Factory) return AMF.UML.Component_Realizations.UML_Component_Realization_Access is abstract; not overriding function Create_Conditional_Node (Self : not null access UML_Factory) return AMF.UML.Conditional_Nodes.UML_Conditional_Node_Access is abstract; not overriding function Create_Connectable_Element_Template_Parameter (Self : not null access UML_Factory) return AMF.UML.Connectable_Element_Template_Parameters.UML_Connectable_Element_Template_Parameter_Access is abstract; not overriding function Create_Connection_Point_Reference (Self : not null access UML_Factory) return AMF.UML.Connection_Point_References.UML_Connection_Point_Reference_Access is abstract; not overriding function Create_Connector (Self : not null access UML_Factory) return AMF.UML.Connectors.UML_Connector_Access is abstract; not overriding function Create_Connector_End (Self : not null access UML_Factory) return AMF.UML.Connector_Ends.UML_Connector_End_Access is abstract; not overriding function Create_Consider_Ignore_Fragment (Self : not null access UML_Factory) return AMF.UML.Consider_Ignore_Fragments.UML_Consider_Ignore_Fragment_Access is abstract; not overriding function Create_Constraint (Self : not null access UML_Factory) return AMF.UML.Constraints.UML_Constraint_Access is abstract; not overriding function Create_Continuation (Self : not null access UML_Factory) return AMF.UML.Continuations.UML_Continuation_Access is abstract; not overriding function Create_Control_Flow (Self : not null access UML_Factory) return AMF.UML.Control_Flows.UML_Control_Flow_Access is abstract; not overriding function Create_Create_Link_Action (Self : not null access UML_Factory) return AMF.UML.Create_Link_Actions.UML_Create_Link_Action_Access is abstract; not overriding function Create_Create_Link_Object_Action (Self : not null access UML_Factory) return AMF.UML.Create_Link_Object_Actions.UML_Create_Link_Object_Action_Access is abstract; not overriding function Create_Create_Object_Action (Self : not null access UML_Factory) return AMF.UML.Create_Object_Actions.UML_Create_Object_Action_Access is abstract; not overriding function Create_Data_Store_Node (Self : not null access UML_Factory) return AMF.UML.Data_Store_Nodes.UML_Data_Store_Node_Access is abstract; not overriding function Create_Data_Type (Self : not null access UML_Factory) return AMF.UML.Data_Types.UML_Data_Type_Access is abstract; not overriding function Create_Decision_Node (Self : not null access UML_Factory) return AMF.UML.Decision_Nodes.UML_Decision_Node_Access is abstract; not overriding function Create_Dependency (Self : not null access UML_Factory) return AMF.UML.Dependencies.UML_Dependency_Access is abstract; not overriding function Create_Deployment (Self : not null access UML_Factory) return AMF.UML.Deployments.UML_Deployment_Access is abstract; not overriding function Create_Deployment_Specification (Self : not null access UML_Factory) return AMF.UML.Deployment_Specifications.UML_Deployment_Specification_Access is abstract; not overriding function Create_Destroy_Link_Action (Self : not null access UML_Factory) return AMF.UML.Destroy_Link_Actions.UML_Destroy_Link_Action_Access is abstract; not overriding function Create_Destroy_Object_Action (Self : not null access UML_Factory) return AMF.UML.Destroy_Object_Actions.UML_Destroy_Object_Action_Access is abstract; not overriding function Create_Destruction_Occurrence_Specification (Self : not null access UML_Factory) return AMF.UML.Destruction_Occurrence_Specifications.UML_Destruction_Occurrence_Specification_Access is abstract; not overriding function Create_Device (Self : not null access UML_Factory) return AMF.UML.Devices.UML_Device_Access is abstract; not overriding function Create_Duration (Self : not null access UML_Factory) return AMF.UML.Durations.UML_Duration_Access is abstract; not overriding function Create_Duration_Constraint (Self : not null access UML_Factory) return AMF.UML.Duration_Constraints.UML_Duration_Constraint_Access is abstract; not overriding function Create_Duration_Interval (Self : not null access UML_Factory) return AMF.UML.Duration_Intervals.UML_Duration_Interval_Access is abstract; not overriding function Create_Duration_Observation (Self : not null access UML_Factory) return AMF.UML.Duration_Observations.UML_Duration_Observation_Access is abstract; not overriding function Create_Element_Import (Self : not null access UML_Factory) return AMF.UML.Element_Imports.UML_Element_Import_Access is abstract; not overriding function Create_Enumeration (Self : not null access UML_Factory) return AMF.UML.Enumerations.UML_Enumeration_Access is abstract; not overriding function Create_Enumeration_Literal (Self : not null access UML_Factory) return AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access is abstract; not overriding function Create_Exception_Handler (Self : not null access UML_Factory) return AMF.UML.Exception_Handlers.UML_Exception_Handler_Access is abstract; not overriding function Create_Execution_Environment (Self : not null access UML_Factory) return AMF.UML.Execution_Environments.UML_Execution_Environment_Access is abstract; not overriding function Create_Execution_Occurrence_Specification (Self : not null access UML_Factory) return AMF.UML.Execution_Occurrence_Specifications.UML_Execution_Occurrence_Specification_Access is abstract; not overriding function Create_Expansion_Node (Self : not null access UML_Factory) return AMF.UML.Expansion_Nodes.UML_Expansion_Node_Access is abstract; not overriding function Create_Expansion_Region (Self : not null access UML_Factory) return AMF.UML.Expansion_Regions.UML_Expansion_Region_Access is abstract; not overriding function Create_Expression (Self : not null access UML_Factory) return AMF.UML.Expressions.UML_Expression_Access is abstract; not overriding function Create_Extend (Self : not null access UML_Factory) return AMF.UML.Extends.UML_Extend_Access is abstract; not overriding function Create_Extension (Self : not null access UML_Factory) return AMF.UML.Extensions.UML_Extension_Access is abstract; not overriding function Create_Extension_End (Self : not null access UML_Factory) return AMF.UML.Extension_Ends.UML_Extension_End_Access is abstract; not overriding function Create_Extension_Point (Self : not null access UML_Factory) return AMF.UML.Extension_Points.UML_Extension_Point_Access is abstract; not overriding function Create_Final_State (Self : not null access UML_Factory) return AMF.UML.Final_States.UML_Final_State_Access is abstract; not overriding function Create_Flow_Final_Node (Self : not null access UML_Factory) return AMF.UML.Flow_Final_Nodes.UML_Flow_Final_Node_Access is abstract; not overriding function Create_Fork_Node (Self : not null access UML_Factory) return AMF.UML.Fork_Nodes.UML_Fork_Node_Access is abstract; not overriding function Create_Function_Behavior (Self : not null access UML_Factory) return AMF.UML.Function_Behaviors.UML_Function_Behavior_Access is abstract; not overriding function Create_Gate (Self : not null access UML_Factory) return AMF.UML.Gates.UML_Gate_Access is abstract; not overriding function Create_General_Ordering (Self : not null access UML_Factory) return AMF.UML.General_Orderings.UML_General_Ordering_Access is abstract; not overriding function Create_Generalization (Self : not null access UML_Factory) return AMF.UML.Generalizations.UML_Generalization_Access is abstract; not overriding function Create_Generalization_Set (Self : not null access UML_Factory) return AMF.UML.Generalization_Sets.UML_Generalization_Set_Access is abstract; not overriding function Create_Image (Self : not null access UML_Factory) return AMF.UML.Images.UML_Image_Access is abstract; not overriding function Create_Include (Self : not null access UML_Factory) return AMF.UML.Includes.UML_Include_Access is abstract; not overriding function Create_Information_Flow (Self : not null access UML_Factory) return AMF.UML.Information_Flows.UML_Information_Flow_Access is abstract; not overriding function Create_Information_Item (Self : not null access UML_Factory) return AMF.UML.Information_Items.UML_Information_Item_Access is abstract; not overriding function Create_Initial_Node (Self : not null access UML_Factory) return AMF.UML.Initial_Nodes.UML_Initial_Node_Access is abstract; not overriding function Create_Input_Pin (Self : not null access UML_Factory) return AMF.UML.Input_Pins.UML_Input_Pin_Access is abstract; not overriding function Create_Instance_Specification (Self : not null access UML_Factory) return AMF.UML.Instance_Specifications.UML_Instance_Specification_Access is abstract; not overriding function Create_Instance_Value (Self : not null access UML_Factory) return AMF.UML.Instance_Values.UML_Instance_Value_Access is abstract; not overriding function Create_Interaction (Self : not null access UML_Factory) return AMF.UML.Interactions.UML_Interaction_Access is abstract; not overriding function Create_Interaction_Constraint (Self : not null access UML_Factory) return AMF.UML.Interaction_Constraints.UML_Interaction_Constraint_Access is abstract; not overriding function Create_Interaction_Operand (Self : not null access UML_Factory) return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is abstract; not overriding function Create_Interaction_Use (Self : not null access UML_Factory) return AMF.UML.Interaction_Uses.UML_Interaction_Use_Access is abstract; not overriding function Create_Interface (Self : not null access UML_Factory) return AMF.UML.Interfaces.UML_Interface_Access is abstract; not overriding function Create_Interface_Realization (Self : not null access UML_Factory) return AMF.UML.Interface_Realizations.UML_Interface_Realization_Access is abstract; not overriding function Create_Interruptible_Activity_Region (Self : not null access UML_Factory) return AMF.UML.Interruptible_Activity_Regions.UML_Interruptible_Activity_Region_Access is abstract; not overriding function Create_Interval (Self : not null access UML_Factory) return AMF.UML.Intervals.UML_Interval_Access is abstract; not overriding function Create_Interval_Constraint (Self : not null access UML_Factory) return AMF.UML.Interval_Constraints.UML_Interval_Constraint_Access is abstract; not overriding function Create_Join_Node (Self : not null access UML_Factory) return AMF.UML.Join_Nodes.UML_Join_Node_Access is abstract; not overriding function Create_Lifeline (Self : not null access UML_Factory) return AMF.UML.Lifelines.UML_Lifeline_Access is abstract; not overriding function Create_Link_End_Creation_Data (Self : not null access UML_Factory) return AMF.UML.Link_End_Creation_Datas.UML_Link_End_Creation_Data_Access is abstract; not overriding function Create_Link_End_Data (Self : not null access UML_Factory) return AMF.UML.Link_End_Datas.UML_Link_End_Data_Access is abstract; not overriding function Create_Link_End_Destruction_Data (Self : not null access UML_Factory) return AMF.UML.Link_End_Destruction_Datas.UML_Link_End_Destruction_Data_Access is abstract; not overriding function Create_Literal_Boolean (Self : not null access UML_Factory) return AMF.UML.Literal_Booleans.UML_Literal_Boolean_Access is abstract; not overriding function Create_Literal_Integer (Self : not null access UML_Factory) return AMF.UML.Literal_Integers.UML_Literal_Integer_Access is abstract; not overriding function Create_Literal_Null (Self : not null access UML_Factory) return AMF.UML.Literal_Nulls.UML_Literal_Null_Access is abstract; not overriding function Create_Literal_Real (Self : not null access UML_Factory) return AMF.UML.Literal_Reals.UML_Literal_Real_Access is abstract; not overriding function Create_Literal_String (Self : not null access UML_Factory) return AMF.UML.Literal_Strings.UML_Literal_String_Access is abstract; not overriding function Create_Literal_Unlimited_Natural (Self : not null access UML_Factory) return AMF.UML.Literal_Unlimited_Naturals.UML_Literal_Unlimited_Natural_Access is abstract; not overriding function Create_Loop_Node (Self : not null access UML_Factory) return AMF.UML.Loop_Nodes.UML_Loop_Node_Access is abstract; not overriding function Create_Manifestation (Self : not null access UML_Factory) return AMF.UML.Manifestations.UML_Manifestation_Access is abstract; not overriding function Create_Merge_Node (Self : not null access UML_Factory) return AMF.UML.Merge_Nodes.UML_Merge_Node_Access is abstract; not overriding function Create_Message (Self : not null access UML_Factory) return AMF.UML.Messages.UML_Message_Access is abstract; not overriding function Create_Message_Occurrence_Specification (Self : not null access UML_Factory) return AMF.UML.Message_Occurrence_Specifications.UML_Message_Occurrence_Specification_Access is abstract; not overriding function Create_Model (Self : not null access UML_Factory) return AMF.UML.Models.UML_Model_Access is abstract; not overriding function Create_Node (Self : not null access UML_Factory) return AMF.UML.Nodes.UML_Node_Access is abstract; not overriding function Create_Object_Flow (Self : not null access UML_Factory) return AMF.UML.Object_Flows.UML_Object_Flow_Access is abstract; not overriding function Create_Occurrence_Specification (Self : not null access UML_Factory) return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is abstract; not overriding function Create_Opaque_Action (Self : not null access UML_Factory) return AMF.UML.Opaque_Actions.UML_Opaque_Action_Access is abstract; not overriding function Create_Opaque_Behavior (Self : not null access UML_Factory) return AMF.UML.Opaque_Behaviors.UML_Opaque_Behavior_Access is abstract; not overriding function Create_Opaque_Expression (Self : not null access UML_Factory) return AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access is abstract; not overriding function Create_Operation (Self : not null access UML_Factory) return AMF.UML.Operations.UML_Operation_Access is abstract; not overriding function Create_Operation_Template_Parameter (Self : not null access UML_Factory) return AMF.UML.Operation_Template_Parameters.UML_Operation_Template_Parameter_Access is abstract; not overriding function Create_Output_Pin (Self : not null access UML_Factory) return AMF.UML.Output_Pins.UML_Output_Pin_Access is abstract; not overriding function Create_Package (Self : not null access UML_Factory) return AMF.UML.Packages.UML_Package_Access is abstract; not overriding function Create_Package_Import (Self : not null access UML_Factory) return AMF.UML.Package_Imports.UML_Package_Import_Access is abstract; not overriding function Create_Package_Merge (Self : not null access UML_Factory) return AMF.UML.Package_Merges.UML_Package_Merge_Access is abstract; not overriding function Create_Parameter (Self : not null access UML_Factory) return AMF.UML.Parameters.UML_Parameter_Access is abstract; not overriding function Create_Parameter_Set (Self : not null access UML_Factory) return AMF.UML.Parameter_Sets.UML_Parameter_Set_Access is abstract; not overriding function Create_Part_Decomposition (Self : not null access UML_Factory) return AMF.UML.Part_Decompositions.UML_Part_Decomposition_Access is abstract; not overriding function Create_Port (Self : not null access UML_Factory) return AMF.UML.Ports.UML_Port_Access is abstract; not overriding function Create_Primitive_Type (Self : not null access UML_Factory) return AMF.UML.Primitive_Types.UML_Primitive_Type_Access is abstract; not overriding function Create_Profile (Self : not null access UML_Factory) return AMF.UML.Profiles.UML_Profile_Access is abstract; not overriding function Create_Profile_Application (Self : not null access UML_Factory) return AMF.UML.Profile_Applications.UML_Profile_Application_Access is abstract; not overriding function Create_Property (Self : not null access UML_Factory) return AMF.UML.Properties.UML_Property_Access is abstract; not overriding function Create_Protocol_Conformance (Self : not null access UML_Factory) return AMF.UML.Protocol_Conformances.UML_Protocol_Conformance_Access is abstract; not overriding function Create_Protocol_State_Machine (Self : not null access UML_Factory) return AMF.UML.Protocol_State_Machines.UML_Protocol_State_Machine_Access is abstract; not overriding function Create_Protocol_Transition (Self : not null access UML_Factory) return AMF.UML.Protocol_Transitions.UML_Protocol_Transition_Access is abstract; not overriding function Create_Pseudostate (Self : not null access UML_Factory) return AMF.UML.Pseudostates.UML_Pseudostate_Access is abstract; not overriding function Create_Qualifier_Value (Self : not null access UML_Factory) return AMF.UML.Qualifier_Values.UML_Qualifier_Value_Access is abstract; not overriding function Create_Raise_Exception_Action (Self : not null access UML_Factory) return AMF.UML.Raise_Exception_Actions.UML_Raise_Exception_Action_Access is abstract; not overriding function Create_Read_Extent_Action (Self : not null access UML_Factory) return AMF.UML.Read_Extent_Actions.UML_Read_Extent_Action_Access is abstract; not overriding function Create_Read_Is_Classified_Object_Action (Self : not null access UML_Factory) return AMF.UML.Read_Is_Classified_Object_Actions.UML_Read_Is_Classified_Object_Action_Access is abstract; not overriding function Create_Read_Link_Action (Self : not null access UML_Factory) return AMF.UML.Read_Link_Actions.UML_Read_Link_Action_Access is abstract; not overriding function Create_Read_Link_Object_End_Action (Self : not null access UML_Factory) return AMF.UML.Read_Link_Object_End_Actions.UML_Read_Link_Object_End_Action_Access is abstract; not overriding function Create_Read_Link_Object_End_Qualifier_Action (Self : not null access UML_Factory) return AMF.UML.Read_Link_Object_End_Qualifier_Actions.UML_Read_Link_Object_End_Qualifier_Action_Access is abstract; not overriding function Create_Read_Self_Action (Self : not null access UML_Factory) return AMF.UML.Read_Self_Actions.UML_Read_Self_Action_Access is abstract; not overriding function Create_Read_Structural_Feature_Action (Self : not null access UML_Factory) return AMF.UML.Read_Structural_Feature_Actions.UML_Read_Structural_Feature_Action_Access is abstract; not overriding function Create_Read_Variable_Action (Self : not null access UML_Factory) return AMF.UML.Read_Variable_Actions.UML_Read_Variable_Action_Access is abstract; not overriding function Create_Realization (Self : not null access UML_Factory) return AMF.UML.Realizations.UML_Realization_Access is abstract; not overriding function Create_Reception (Self : not null access UML_Factory) return AMF.UML.Receptions.UML_Reception_Access is abstract; not overriding function Create_Reclassify_Object_Action (Self : not null access UML_Factory) return AMF.UML.Reclassify_Object_Actions.UML_Reclassify_Object_Action_Access is abstract; not overriding function Create_Redefinable_Template_Signature (Self : not null access UML_Factory) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is abstract; not overriding function Create_Reduce_Action (Self : not null access UML_Factory) return AMF.UML.Reduce_Actions.UML_Reduce_Action_Access is abstract; not overriding function Create_Region (Self : not null access UML_Factory) return AMF.UML.Regions.UML_Region_Access is abstract; not overriding function Create_Remove_Structural_Feature_Value_Action (Self : not null access UML_Factory) return AMF.UML.Remove_Structural_Feature_Value_Actions.UML_Remove_Structural_Feature_Value_Action_Access is abstract; not overriding function Create_Remove_Variable_Value_Action (Self : not null access UML_Factory) return AMF.UML.Remove_Variable_Value_Actions.UML_Remove_Variable_Value_Action_Access is abstract; not overriding function Create_Reply_Action (Self : not null access UML_Factory) return AMF.UML.Reply_Actions.UML_Reply_Action_Access is abstract; not overriding function Create_Send_Object_Action (Self : not null access UML_Factory) return AMF.UML.Send_Object_Actions.UML_Send_Object_Action_Access is abstract; not overriding function Create_Send_Signal_Action (Self : not null access UML_Factory) return AMF.UML.Send_Signal_Actions.UML_Send_Signal_Action_Access is abstract; not overriding function Create_Sequence_Node (Self : not null access UML_Factory) return AMF.UML.Sequence_Nodes.UML_Sequence_Node_Access is abstract; not overriding function Create_Signal (Self : not null access UML_Factory) return AMF.UML.Signals.UML_Signal_Access is abstract; not overriding function Create_Signal_Event (Self : not null access UML_Factory) return AMF.UML.Signal_Events.UML_Signal_Event_Access is abstract; not overriding function Create_Slot (Self : not null access UML_Factory) return AMF.UML.Slots.UML_Slot_Access is abstract; not overriding function Create_Start_Classifier_Behavior_Action (Self : not null access UML_Factory) return AMF.UML.Start_Classifier_Behavior_Actions.UML_Start_Classifier_Behavior_Action_Access is abstract; not overriding function Create_Start_Object_Behavior_Action (Self : not null access UML_Factory) return AMF.UML.Start_Object_Behavior_Actions.UML_Start_Object_Behavior_Action_Access is abstract; not overriding function Create_State (Self : not null access UML_Factory) return AMF.UML.States.UML_State_Access is abstract; not overriding function Create_State_Invariant (Self : not null access UML_Factory) return AMF.UML.State_Invariants.UML_State_Invariant_Access is abstract; not overriding function Create_State_Machine (Self : not null access UML_Factory) return AMF.UML.State_Machines.UML_State_Machine_Access is abstract; not overriding function Create_Stereotype (Self : not null access UML_Factory) return AMF.UML.Stereotypes.UML_Stereotype_Access is abstract; not overriding function Create_String_Expression (Self : not null access UML_Factory) return AMF.UML.String_Expressions.UML_String_Expression_Access is abstract; not overriding function Create_Structured_Activity_Node (Self : not null access UML_Factory) return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is abstract; not overriding function Create_Substitution (Self : not null access UML_Factory) return AMF.UML.Substitutions.UML_Substitution_Access is abstract; not overriding function Create_Template_Binding (Self : not null access UML_Factory) return AMF.UML.Template_Bindings.UML_Template_Binding_Access is abstract; not overriding function Create_Template_Parameter (Self : not null access UML_Factory) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is abstract; not overriding function Create_Template_Parameter_Substitution (Self : not null access UML_Factory) return AMF.UML.Template_Parameter_Substitutions.UML_Template_Parameter_Substitution_Access is abstract; not overriding function Create_Template_Signature (Self : not null access UML_Factory) return AMF.UML.Template_Signatures.UML_Template_Signature_Access is abstract; not overriding function Create_Test_Identity_Action (Self : not null access UML_Factory) return AMF.UML.Test_Identity_Actions.UML_Test_Identity_Action_Access is abstract; not overriding function Create_Time_Constraint (Self : not null access UML_Factory) return AMF.UML.Time_Constraints.UML_Time_Constraint_Access is abstract; not overriding function Create_Time_Event (Self : not null access UML_Factory) return AMF.UML.Time_Events.UML_Time_Event_Access is abstract; not overriding function Create_Time_Expression (Self : not null access UML_Factory) return AMF.UML.Time_Expressions.UML_Time_Expression_Access is abstract; not overriding function Create_Time_Interval (Self : not null access UML_Factory) return AMF.UML.Time_Intervals.UML_Time_Interval_Access is abstract; not overriding function Create_Time_Observation (Self : not null access UML_Factory) return AMF.UML.Time_Observations.UML_Time_Observation_Access is abstract; not overriding function Create_Transition (Self : not null access UML_Factory) return AMF.UML.Transitions.UML_Transition_Access is abstract; not overriding function Create_Trigger (Self : not null access UML_Factory) return AMF.UML.Triggers.UML_Trigger_Access is abstract; not overriding function Create_Unmarshall_Action (Self : not null access UML_Factory) return AMF.UML.Unmarshall_Actions.UML_Unmarshall_Action_Access is abstract; not overriding function Create_Usage (Self : not null access UML_Factory) return AMF.UML.Usages.UML_Usage_Access is abstract; not overriding function Create_Use_Case (Self : not null access UML_Factory) return AMF.UML.Use_Cases.UML_Use_Case_Access is abstract; not overriding function Create_Value_Pin (Self : not null access UML_Factory) return AMF.UML.Value_Pins.UML_Value_Pin_Access is abstract; not overriding function Create_Value_Specification_Action (Self : not null access UML_Factory) return AMF.UML.Value_Specification_Actions.UML_Value_Specification_Action_Access is abstract; not overriding function Create_Variable (Self : not null access UML_Factory) return AMF.UML.Variables.UML_Variable_Access is abstract; end AMF.Factories.UML_Factories;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37211d.ada
best08618/asylo
7
9758
-- C37211D.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS RAISED BY A DISCRIMINANT CONSTRAINT -- IF A VALUE SPECIFIED FOR A DISCRIMINANT DOES NOT LIE IN THE RANGE -- OF THE DISCRIMINANT. THIS TEST CONTAINS CHECKS FOR SUBTYPE -- INDICATIONS WHERE THE TYPE MARK DENOTES AN INCOMPLETE TYPE. -- R.WILLIAMS 8/28/86 -- EDS 7/14/98 AVOID OPTIMIZATION WITH REPORT; USE REPORT; PROCEDURE C37211D IS GLOBAL : BOOLEAN; TYPE DAY IS (SUN, MON, TUE, WED, THU, FRI, SAT); SUBTYPE WEEKDAY IS DAY RANGE MON .. FRI; FUNCTION SWITCH (B : BOOLEAN) RETURN BOOLEAN IS BEGIN GLOBAL := B; RETURN B; END SWITCH; FUNCTION IDENT (D : DAY) RETURN DAY IS BEGIN RETURN DAY'VAL (IDENT_INT (DAY'POS (D))); END IDENT; BEGIN TEST ( "C37211D", "CHECK THAT CONSTRAINT_ERROR IS RAISED BY " & "A DISCRIMINANT CONSTRAINT IF A VALUE " & "SPECIFIED FOR A DISCRIMINANT DOES NOT LIE " & "IN THE RANGE OF THE DISCRIMINANT WHERE THE " & "TYPE MARK DENOTES AN INCOMPLETE TYPE" ); BEGIN DECLARE B1 : BOOLEAN := SWITCH (TRUE); TYPE REC (D : WEEKDAY); TYPE ACCREC IS ACCESS REC (IDENT (SUN)); B2 : BOOLEAN := SWITCH (FALSE); TYPE REC (D : WEEKDAY) IS RECORD NULL; END RECORD; BEGIN DECLARE AC : ACCREC; BEGIN FAILED ( "NO EXCEPTION RAISED AT THE " & "ELABORATION OF TYPE ACCREC " & DAY'IMAGE(AC.D)); END; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED AT DECLARATION OF " & "OBJECT AC" ); END; EXCEPTION WHEN CONSTRAINT_ERROR => IF GLOBAL THEN NULL; ELSE FAILED ( "EXCEPTION RAISED AT ELABORATION OF " & "FULL TYPE REC NOT TYPE ACCREC" ); END IF; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED AT ELABORATION OF " & "TYPE ACCREC" ); END; RESULT; END C37211D;
programs/oeis/108/A108976.asm
neoneye/loda
22
21874
; A108976: Numbers n such that 17*n + 19 is prime. ; 0,2,12,14,20,26,32,36,42,54,56,60,74,84,86,90,92,102,104,110,126,134,140,144,156,170,176,180,186,212,216,222,230,240,242,246,254,264,272,282,296,300,302,312,324,344,354,362,372,384,386,414,420,422,440,450 seq $0,142072 ; Primes congruent to 19 mod 34. div $0,34 mul $0,2
source/features/keyboard.asm
feliposz/FelipOS
0
82840
<reponame>feliposz/FelipOS ; os_wait_for_key -- Waits for keypress and returns key ; IN: Nothing ; OUT: AX = key pressed, other regs preserved os_wait_for_key: mov ah, 11h ; check key buffer int 16h jnz .keypress hlt ; no key press, wait for interrupt and loop jmp os_wait_for_key .keypress: mov ah, 10h ; get key scan code int 16h ret ; os_check_for_key -- Scans keyboard for input, but doesn't wait ; IN: Nothing ; OUT: AX = 0 if no key pressed, otherwise scan code os_check_for_key: mov ah, 11h ; check key buffer int 16h jnz .keypress xor ax, ax ; no keypress, return zero ret .keypress: mov ah, 10h ; get key scan code int 16h ret
src/main/antlr/cymbol/CymbolCFG.g4
courses-at-nju-by-hfwei/compilers-antlr
7
617
grammar CymbolCFG; prog : prog decl | decl ; decl : varDecl | funcDecl ; varDecl : ' ' ; // just for placeholder funcDecl : ' ' ; // just for placeholder
oeis/303/A303991.asm
neoneye/loda-programs
11
166977
<filename>oeis/303/A303991.asm<gh_stars>10-100 ; A303991: Row sums of triangle A303990. ; Submitted by <NAME>(s4) ; 1,18,804,70980,10436805,2303750526,712510404592,294018013725192,156070751204023425,103597044789173411410,84072367255899882570876,81892130447332894817380044,94289343231845338982163322837,126676207083751543195799431746150,196394200592428254386554058525461440 add $0,1 mov $2,$0 lpb $2 mov $3,$2 pow $3,$0 add $1,$3 mul $1,$0 sub $2,1 lpe mov $0,$1
Cubical/Relation/Binary/Reasoning/PartialEquivalence.agda
bijan2005/univalent-foundations
0
14333
------------------------------------------------------------------------ -- The Agda standard library -- -- Convenient syntax for reasoning with a partial setoid ------------------------------------------------------------------------ {-# OPTIONS --cubical --no-import-sorts --safe #-} open import Cubical.Core.Everything open import Cubical.Relation.Binary.Raw module Cubical.Relation.Binary.Reasoning.PartialEquivalence {c ℓ} {A : Type c} (E : PartialEquivalence A ℓ) where open PartialEquivalence E import Cubical.Relation.Binary.Reasoning.Base.Partial _≈_ transitive as Base ------------------------------------------------------------------------ -- Re-export the contents of the base module open Base public renaming (_∼⟨_⟩_ to _≈⟨_⟩_) ------------------------------------------------------------------------ -- Additional reasoning combinators infixr 1 _≈˘⟨_⟩_ _≈˘⟨_⟩_ : ∀ x {y z} → y ≈ x → y IsRelatedTo z → x IsRelatedTo z x ≈˘⟨ y≈x ⟩ y∼z = x ≈⟨ symmetric y≈x ⟩ y∼z
src/norx.adb
jhumphry/SPARK_NORX
9
21624
-- NORX -- an Ada implementation of the NORX Authenticated Encryption Algorithm -- created by <NAME>, <NAME> and <NAME> -- Copyright (c) 2016-2017, <NAME> - see LICENSE file for details pragma Restrictions(No_Implementation_Attributes, No_Implementation_Units, No_Obsolescent_Features); with NORX.Compare_Tags; package body NORX is -- *** -- Constants and types used internally -- *** p : constant Positive := 1; -- This implementation only supports parallelism -- of degree 1 i.e. only serial NORX Bytes : constant Storage_Offset := Storage_Offset(w / 8); Rate_Bytes_SO : constant Storage_Offset := Storage_Offset(r / 8); Rate_Words : constant Integer := r / w; Key_Words : constant Integer := k / w; Tag_Words : constant Integer := t / w; Nonce_Words : constant Integer := n / w; type Domains is (Header, Payload, Trailer, Tag, Branching, Merging); Domain_Separation : constant array (Domains range <>) of Word := (Header => 16#01#, Payload => 16#02#, Trailer => 16#03#, Tag => 16#04#, Branching => 16#10#, Merging => 16#20#); subtype Rate_Storage_Array is Storage_Array(1..Rate_Bytes_SO); -- The initialisation constants u : State with Constant_After_Elaboration; -- *** -- Implementation of the the permutation F^{l} as described in Figure 2.4 -- of the NORX specification -- *** procedure G (a, b, c, d : in out Word) with Inline is function H (x, y : in Word) return Word is ((x xor y) xor (Shift_Left((x and y), 1))) with Inline; begin a := H(a, b); d := Rotate_Right(a xor d, rot(0)); c := H(c, d); b := Rotate_Right(b xor c, rot(1)); a := H(a, b); d := Rotate_Right(a xor d, rot(2)); c := H(c, d); b := Rotate_Right(b xor c, rot(3)); end G; procedure F_l (S : in out State) with Inline is begin for I in 1..l loop -- Column G(S(0), S(4), S(8), S(12)); G(S(1), S(5), S(9), S(13)); G(S(2), S(6), S(10), S(14)); G(S(3), S(7), S(11), S(15)); -- Diagonal G(S(0), S(5), S(10), S(15)); G(S(1), S(6), S(11), S(12)); G(S(2), S(7), S(8), S(13)); G(S(3), S(4), S(9), S(14)); end loop; end F_l; procedure F_2 (S : in out State) is -- The initialisation constants are set up by two rounds of the diffusion -- regardless of the number of rounds l begin for I in 1..2 loop -- Column G(S(0), S(4), S(8), S(12)); G(S(1), S(5), S(9), S(13)); G(S(2), S(6), S(10), S(14)); G(S(3), S(7), S(11), S(15)); -- Diagonal G(S(0), S(5), S(10), S(15)); G(S(1), S(6), S(11), S(12)); G(S(2), S(7), S(8), S(13)); G(S(3), S(4), S(9), S(14)); end loop; end F_2; -- *** -- Internal use routines -- *** function Valid_Paddable (X : in Storage_Array) return Boolean is ( -- First check that the array can be padded without exceeding the range -- of a Storage_Array X'Last < Storage_Offset'Last - Rate_Bytes_SO and ( -- now check X'Length < Rate_Bytes_I else padding is not needed... -- but in a way that doesn't overflow given Storage_Offset can hold -- a range greater than Long_Long_Integer if X'Last < X'First then True elsif X'First < 0 then ( (Long_Long_Integer (X'Last) < Long_Long_Integer'Last + Long_Long_Integer (X'First)) and then X'Last - X'First < Rate_Bytes_SO - 1) else X'Last - X'First < Rate_Bytes_SO - 1 ) ) with Ghost; function Pad_r (X : in Storage_Array) return Rate_Storage_Array with Inline, Pre=> Valid_Paddable(X) is Result : Rate_Storage_Array; Padding : constant Storage_Array(1 .. Rate_Bytes_SO - Storage_Offset(X'Length + 1)) := (others => 0); begin Result := X & 16#01# & Padding; Result(Result'Last) := Result(Result'Last) or 16#80#; return Result; end Pad_r; function Compare_Tags_Constant_Time is new NORX.Compare_Tags; -- *** -- Low-level API (mainly) as described in Figure 2.6 of the NORX -- specification -- *** function Make_State return State is (State'(others => 0)); function Get_Initialisation_Constants return State is (u); function Initialise (Key : in Key_Type; Nonce : in Nonce_Type) return State is S : State := u; begin for I in 0..Nonce_Words-1 loop S(I) := Storage_Array_To_Word(Nonce(Storage_Offset(I)*Bytes .. Storage_Offset(I+1)*Bytes-1)); end loop; for I in 0..Key_Words-1 loop S(I + Key_Position) := Storage_Array_To_Word(Key(Storage_Offset(I)*Bytes .. Storage_Offset(I+1)*Bytes-1)); end loop; S(12) := S(12) xor Word(w); S(13) := S(13) xor Word(l); S(14) := S(14) xor Word(p); S(15) := S(15) xor Word(t); F_l(S); for I in 0..Key_Words-1 loop S(16-Key_Words+I) := S(16-Key_Words+I) xor Storage_Array_To_Word(Key(Storage_Offset(I)*Bytes .. Storage_Offset(I+1)*Bytes-1)); end loop; return S; end Initialise; procedure Absorb_Block (S : in out State; X : in Rate_Storage_Array; v : in Word) with Inline is X_Index : Storage_Offset := X'First; begin S(15) := S(15) xor v; F_l(S); for I in 0..Rate_Words - 1 loop pragma Loop_Invariant (X_Index = X'First + Storage_Offset(I) * Bytes); S(I) := S(I) xor Storage_Array_To_Word(X(X_Index .. X_Index + Bytes - 1)); X_Index := X_Index + Bytes; end loop; pragma Assert (X_Index = X'Last + 1); end Absorb_Block; procedure Absorb (S : in out State; X : in Storage_Array; v : in Word) is Number_Full_Blocks : constant Storage_Offset := X'Length / Rate_Bytes_SO; X_Index : Storage_Offset := X'First; begin pragma Assert (X'Last < Storage_Offset'Last - Storage_Offset(r/8)); if X'Length > 0 then for I in 1..Number_Full_Blocks loop pragma Loop_Invariant (X_Index = X'First + (I-1) * Rate_Bytes_SO); Absorb_Block(S, X(X_Index .. X_Index + Rate_Bytes_SO-1), v); X_Index := X_Index + Rate_Bytes_SO; end loop; Absorb_Block(S, Pad_r(X(X_Index..X'Last)), v); end if; end Absorb; procedure Encrypt_Block (S : in out State; M : in Rate_Storage_Array; C : out Rate_Storage_Array; v : in Word) with Inline is M_Index : Storage_Offset := M'First; C_Index : Storage_Offset := C'First; begin S(15) := S(15) xor v; F_l(S); for I in 0..Rate_Words - 1 loop pragma Loop_Invariant(M_Index = M'First + Storage_Offset(I) * Bytes); pragma Loop_Invariant(C_Index = C'First + Storage_Offset(I) * Bytes); S(I) := S(I) xor Storage_Array_To_Word(M(M_Index .. M_Index + Bytes - 1)); C(C_Index .. C_Index + Bytes - 1) := Word_To_Storage_Array(S(I)); M_Index := M_Index + Bytes; C_Index := C_Index + Bytes; end loop; pragma Assert (M_Index = M'Last + 1); pragma Assert (C_Index = C'Last + 1); end Encrypt_Block; procedure Encrypt (S : in out State; M : in Storage_Array; C : out Storage_Array; v : in Word) is Number_Full_Blocks : constant Storage_Offset := M'Length / Rate_Bytes_SO; M_Index : Storage_Offset := M'First; C_Index : Storage_Offset := C'First; begin if M'Length > 0 then for I in 1..Number_Full_Blocks loop pragma Loop_Invariant(M_Index = M'First + (I-1) * Rate_Bytes_SO); pragma Loop_Invariant(C_Index = C'First + (I-1) * Rate_Bytes_SO); Encrypt_Block(S => S, M => M(M_Index..M_Index+Rate_Bytes_SO-1), C => C(C_Index..C_Index+Rate_Bytes_SO-1), v => v); M_Index := M_Index + Rate_Bytes_SO; C_Index := C_Index + Rate_Bytes_SO; end loop; declare Last_M: constant Storage_Array := Pad_r(M(M_Index..M'Last)); Last_C : Storage_Array(1..Rate_Bytes_SO); begin Encrypt_Block(S => S, M => Last_M, C => Last_C, v => v); C(C_Index..C'Last) := Last_C(1..(C'Last - C_Index)+1); end; end if; end Encrypt; pragma Annotate (GNATprove, False_Positive, """C"" might not be initialized", "The loop initialises C from C'First to C_Index-1 and the second block of code initialises C_Index to C'Last"); procedure Decrypt_Block (S : in out State; C : in Rate_Storage_Array; M : out Rate_Storage_Array; v : in Word) with Inline is C_i : Word; M_Index : Storage_Offset := M'First; C_Index : Storage_Offset := C'First; begin S(15) := S(15) xor v; F_l(S); for I in 0..Rate_Words - 1 loop pragma Loop_Invariant(M_Index = M'First + Storage_Offset(I) * Bytes); pragma Loop_Invariant(C_Index = C'First + Storage_Offset(I) * Bytes); C_i := Storage_Array_To_Word(C(C_Index .. C_Index + Bytes - 1)); M(M_Index .. M_Index + Bytes - 1) := Word_To_Storage_Array(S(I) xor C_i); S(I) := C_i; M_Index := M_Index + Bytes; C_Index := C_Index + Bytes; end loop; pragma Assert (M_Index = M'Last + 1); pragma Assert (C_Index = C'Last + 1); end Decrypt_Block; function Valid_Last_Ciphertext_Block (X : in Storage_Array) return Boolean is ( if X'Last < X'First then True elsif X'First < 0 then ( (Long_Long_Integer (X'Last) < Long_Long_Integer'Last + Long_Long_Integer (X'First)) and then X'Last - X'First < Rate_Bytes_SO - 1) else X'Last - X'First < Rate_Bytes_SO - 1 ) with Ghost; procedure Decrypt_Last_Block (S : in out State; C : in Storage_Array; M : out Storage_Array; v : in Word) with Inline, Pre => ( (Valid_Storage_Array_Parameter(M'First, M'Last) and Valid_Last_Ciphertext_Block(C) ) and then M'Length = C'Length ) is Last_Block : Storage_Array(1..Rate_Bytes_SO); C_i : Word; Index : Storage_Offset := Last_Block'First; begin S(15) := S(15) xor v; F_l(S); for I in 0..Rate_Words-1 loop pragma Loop_Invariant (Index = Last_Block'First + Storage_Offset(I) * Bytes); Last_Block(Index .. Index + Bytes-1) := Word_To_Storage_Array(S(I)); Index := Index + Bytes; end loop; Last_Block(1..C'Length) := C; Last_Block(C'Length+1) := Last_Block(C'Length+1) xor 16#01#; Last_Block(Last_Block'Last) := Last_Block(Last_Block'Last) xor 16#80#; Index := Last_Block'First; for I in 0..Rate_Words - 1 loop pragma Loop_Invariant (Index = Last_Block'First + Storage_Offset(I) * Bytes); C_i := Storage_Array_To_Word(Last_Block(Index .. Index + Bytes - 1)); Last_Block(Index .. Index + Bytes - 1) := Word_To_Storage_Array(S(I) xor C_i); S(I) := C_i; Index := Index + Bytes; end loop; pragma Assert (Index = Last_Block'Last + 1); M := Last_Block(1..C'Length); end Decrypt_Last_Block; pragma Annotate (GNATprove, False_Positive, """Last_Block"" might not be initialized", "Initialisation and assertion demonstrate that Index is incremented over every element of Last_Block"); procedure Decrypt (S : in out State; C : in Storage_Array; M : out Storage_Array; v : in Word) is Number_Full_Blocks : constant Storage_Offset := C'Length / Rate_Bytes_SO; M_Index : Storage_Offset := M'First; C_Index : Storage_Offset := C'First; begin if M'Length > 0 then for I in 1..Number_Full_Blocks loop pragma Loop_Invariant(M_Index = M'First + (I-1) * Rate_Bytes_SO); pragma Loop_Invariant(C_Index = C'First + (I-1) * Rate_Bytes_SO); Decrypt_Block(S => S, C => C(C_Index..C_Index+Rate_Bytes_SO-1), M => M(M_Index..M_Index+Rate_Bytes_SO-1), v => v); M_Index := M_Index + Rate_Bytes_SO; C_Index := C_Index + Rate_Bytes_SO; end loop; Decrypt_Last_Block(S => S, C => C(C_Index..C'Last), M => M(M_Index..M'Last), v => v); end if; end Decrypt; pragma Annotate (GNATprove, False_Positive, """M"" might not be initialized", "The loop initialises M from M'First to M_Index-1 and the call to Decrypt_Last_Block initialises M_Index to M'Last"); procedure Finalise (S : in out State; Key : in Key_Type; Tag : out Tag_Type; v : in Word) is Tag_Index : Storage_Offset := Tag'First; begin S(15) := S(15) xor v; F_l(S); for I in 0..Key_Words-1 loop S(16-Key_Words+I) := S(16-Key_Words+I) xor Storage_Array_To_Word(Key(Storage_Offset(I)*Bytes .. Storage_Offset(I+1)*Bytes-1)); end loop; F_l(S); for I in 0..Key_Words-1 loop S(16-Key_Words+I) := S(16-Key_Words+I) xor Storage_Array_To_Word(Key(Storage_Offset(I)*Bytes .. Storage_Offset(I+1)*Bytes-1)); end loop; for I in 0..Tag_Words-1 loop pragma Loop_Invariant (Tag_Index = Tag'First + Storage_Offset(I) * Bytes); Tag(Tag_Index..Tag_Index+Bytes-1) := Word_To_Storage_Array(S(16-Tag_Words+I)); Tag_Index := Tag_Index + Bytes; end loop; pragma Assert (Tag_Index = Tag'Last + 1); end Finalise; pragma Annotate (GNATprove, False_Positive, """Tag"" might not be initialized", "Initialisation and assertion demonstrate that Tag_Index is incremented over every element of Tag"); -- *** -- High-level API as described in Figure 2.5 of the NORX specification -- *** procedure AEADEnc(K : in Key_Type; N : in Nonce_Type; A : in Storage_Array; M : in Storage_Array; Z : in Storage_Array; C : out Storage_Array; T : out Tag_Type) is S : State := Initialise(K, N); begin Absorb(S, A, Domain_Separation(Header)); Encrypt(S, M, C, Domain_Separation(Payload)); Absorb(S, Z, Domain_Separation(Trailer)); Finalise(S, K, T, Domain_Separation(Tag)); pragma Unreferenced (S); end AEADEnc; procedure AEADDec(K : in Key_Type; N : in Nonce_Type; A : in Storage_Array; C : in Storage_Array; Z : in Storage_Array; T : in Tag_Type; M : out Storage_Array; Valid : out Boolean) is S : State := Initialise(K, N); T2 : Tag_Type; begin Absorb(S, A, Domain_Separation(Header)); Decrypt(S, C, M, Domain_Separation(Payload)); Absorb(S, Z, Domain_Separation(Trailer)); Finalise(S, K, T2, Domain_Separation(Tag)); pragma Unreferenced (S); if Compare_Tags_Constant_Time(T, T2) then Valid := True; else -- Section 2.5 of the specification requires that the decrypted data -- not be returned to the caller if verification fails, to try to -- prevent callers from forgetting to check the validity of the result. M := (others => 0); Valid := False; end if; end AEADDec; begin -- Initialisation constants set up as in 2.5.2 of the specification u := ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); F_2(u); end NORX;
src/ada-libc/src/libc-sys-types.ads
mstewartgallus/linted
0
26615
-- Copyright 2015 <NAME> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied. See the License for the specific language governing -- permissions and limitations under the License. with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; package Libc.Sys.Types is pragma Preelaborate; subtype quad_t is long; -- /usr/include/sys/types.h:37 type uu_fsid_t_uu_val_array is array (0 .. 1) of aliased int; type fsid_t is record uu_val : aliased uu_fsid_t_uu_val_array; -- /usr/include/bits/types.h:134 end record; pragma Convention (C_Pass_By_Copy, fsid_t); -- /usr/include/bits/types.h:134 subtype loff_t is long; -- /usr/include/sys/types.h:44 subtype ino_t is unsigned_long; -- /usr/include/sys/types.h:48 subtype ino64_t is unsigned_long; -- /usr/include/sys/types.h:55 subtype dev_t is unsigned_long; -- /usr/include/sys/types.h:60 subtype gid_t is unsigned; -- /usr/include/sys/types.h:65 subtype mode_t is unsigned; -- /usr/include/sys/types.h:70 subtype nlink_t is unsigned_long; -- /usr/include/sys/types.h:75 subtype uid_t is unsigned; -- /usr/include/sys/types.h:80 subtype off_t is long; -- /usr/include/sys/types.h:86 subtype off64_t is long; -- /usr/include/sys/types.h:93 subtype pid_t is int; -- /usr/include/sys/types.h:98 subtype id_t is unsigned; -- /usr/include/sys/types.h:104 subtype ssize_t is long; -- /usr/include/sys/types.h:109 subtype daddr_t is int; -- /usr/include/sys/types.h:115 subtype caddr_t is Interfaces.C.Strings.chars_ptr; -- /usr/include/sys/types.h:116 subtype key_t is int; -- /usr/include/sys/types.h:122 subtype useconds_t is unsigned; -- /usr/include/sys/types.h:136 subtype suseconds_t is long; -- /usr/include/sys/types.h:140 subtype ulong is unsigned_long; -- /usr/include/sys/types.h:150 subtype ushort is unsigned_short; -- /usr/include/sys/types.h:151 subtype uint is unsigned; -- /usr/include/sys/types.h:152 subtype int8_t is signed_char; -- /usr/include/sys/types.h:194 subtype int16_t is short; -- /usr/include/sys/types.h:195 subtype int32_t is int; -- /usr/include/sys/types.h:196 subtype int64_t is long; -- /usr/include/sys/types.h:197 subtype u_int8_t is unsigned_char; -- /usr/include/sys/types.h:200 subtype u_int16_t is unsigned_short; -- /usr/include/sys/types.h:201 subtype u_int32_t is unsigned; -- /usr/include/sys/types.h:202 subtype u_int64_t is unsigned_long; -- /usr/include/sys/types.h:203 subtype register_t is long; -- /usr/include/sys/types.h:205 subtype blksize_t is long; -- /usr/include/sys/types.h:228 subtype blkcnt_t is long; -- /usr/include/sys/types.h:235 subtype fsblkcnt_t is unsigned_long; -- /usr/include/sys/types.h:239 subtype fsfilcnt_t is unsigned_long; -- /usr/include/sys/types.h:243 subtype blkcnt64_t is long; -- /usr/include/sys/types.h:262 subtype fsblkcnt64_t is unsigned_long; -- /usr/include/sys/types.h:263 subtype fsfilcnt64_t is unsigned_long; -- /usr/include/sys/types.h:264 end Libc.Sys.Types;
src/asf-servlets-measures.ads
jquorning/ada-asf
12
8398
----------------------------------------------------------------------- -- asf-servlets-measures -- Performance measurement servlet -- Copyright (C) 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Servlet.Core.Measures; package ASF.Servlets.Measures renames Servlet.Core.Measures; pragma Obsolescent ("use the 'Servlet.Core.Measures' package");
LAB_4.asm
skinan/Assembly-Basics-8086
0
179168
<gh_stars>0 .MODEL SMALL .STACK .DATA .CODE MOV AX, 10 MOV BX, 4 MOV CX, 6 MOV DX, 4 XOR AX, BX AND BX, CX OR CX, DX HLT ; HAULT
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2.log_1_1350.asm
ljhsiun2/medusa
9
28451
<filename>Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2.log_1_1350.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x452f, %rsi lea addresses_UC_ht+0xaf5, %rdi nop cmp $48711, %r11 mov $107, %rcx rep movsb nop add %r14, %r14 lea addresses_normal_ht+0x152b5, %r9 cmp %rbx, %rbx movb $0x61, (%r9) nop nop nop nop sub %r11, %r11 lea addresses_WC_ht+0x1e575, %r14 clflush (%r14) nop inc %rbx movw $0x6162, (%r14) nop nop nop nop nop xor %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %r9 push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_WC+0x1b301, %rsi lea addresses_US+0x42b5, %rdi nop nop nop add $40387, %r15 mov $56, %rcx rep movsw nop nop nop nop nop sub %rsi, %rsi // Store lea addresses_US+0x42b5, %rdi nop nop nop sub $54920, %r9 movw $0x5152, (%rdi) nop nop nop nop nop add %r9, %r9 // Faulty Load lea addresses_US+0x42b5, %r15 nop nop nop nop nop xor $44545, %rsi vmovups (%r15), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi lea oracles, %rbx and $0xff, %rdi shlq $12, %rdi mov (%rbx,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_US', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'00': 1} 00 */
programs/oeis/077/A077259.asm
jmorken/loda
1
12186
<reponame>jmorken/loda ; A077259: First member of the Diophantine pair (m,k) that satisfies 5*(m^2 + m) = k^2 + k; a(n) = m. ; 0,2,6,44,116,798,2090,14328,37512,257114,673134,4613732,12078908,82790070,216747218,1485607536,3889371024,26658145586,69791931222,478361013020,1252365390980,8583840088782,22472785106426,154030760585064,403257766524696,2763969850442378,7236167012338110 add $0,1 mov $1,$0 add $1,$0 div $1,4 add $0,$1 mov $1,55 mov $2,1 lpb $0 sub $0,1 sub $1,1 add $1,$2 add $2,$1 lpe div $1,220 mul $1,2
src/dsp-generic_functions.adb
fintatarta/generic-dsp
0
12044
<filename>src/dsp-generic_functions.adb pragma Ada_2012; with Ada.Numerics.Elementary_Functions; package body DSP.Generic_Functions is function Complexify (X : Real_Filters.Coefficient_Array) return Complex_Filters.Coefficient_Array is Result : Complex_Filters.Coefficient_Array (X'Range); begin for K in X'Range loop Result (K) := (X (K), 0.0); end loop; return Result; end Complexify; function Notch_Specs (Freq : Normalized_Frequency; Pole_Radius : Stable_Radius; Class : Notch_Type := Stopband) return Complex_IIR_Spec is Tmp : constant Real_IIR_Spec := Notch_Specs (Freq, Pole_Radius, Class); begin return Complex_IIR_Spec'(Num_Deg => Tmp.Num_Deg, Den_Deg => Tmp.Den_Deg, Numerator => Complexify (Tmp.Numerator), Denominator => Complexify (Tmp.Denominator)); end Notch_Specs; function Notch_Specs (Freq : Normalized_Frequency; Pole_Radius : Stable_Radius; Class : Notch_Type := Stopband) return Real_IIR_Spec is use Ada.Numerics; use Ada.Numerics.Elementary_Functions; C : constant Scalar_Type := Scalar_Type (2.0 * Cos (2.0 * Pi * Freq)); R : constant Scalar_Type := Scalar_Type (Pole_Radius); begin case Class is when Stopband => return Real_IIR_Spec'(Num_Deg => 2, Den_Deg => 2, Numerator => (0 => 1.0, 1 => -C, 2 => 1.0), Denominator => (1 => -R * C, 2 => R ** 2)); when Passband => return Real_IIR_Spec'(Num_Deg => 1, Den_Deg => 2, Numerator => (0 => C * (1.0 - R), 1 => R ** 2 - 1.0), Denominator => (1 => -R * C, 2 => R ** 2)); end case; end Notch_Specs; end DSP.Generic_Functions;
boot/paging.asm
theaarushgupta/smolOS
1
25926
<filename>boot/paging.asm global setupPageTables, enablePaging, stackTop section .text bits 32 setupPageTables: mov eax, pageTableL3 or eax, 0b11 ; writeable entries mov [pageTableL4], eax ; move flags to first entry in L4 mov eax, pageTableL2 or eax, 0b11 mov [pageTableL3], eax mov ecx, 0 ; counter .loop: mov eax, 0x200000 ; map 2MB to each entry mul ecx or eax, 0b10000011 ; writable entries in large page mov [pageTableL2 + ecx * 8], eax inc ecx ; increment counter cmp ecx, 512 ; check if reached to 512 (whole table is mapped) jne .loop ; continue ret enablePaging: ; pass page table location to CPU mov eax, pageTableL4 mov cr3, eax ; enable the physical address extension (PAE) mov eax, cr4 or eax, 1 << 5 mov cr4, eax ; enable long mode mov ecx, 0xC0000080 rdmsr or eax, 1 << 8 wrmsr ; write back into model ; enable paging mov eax, cr0 or eax, 1 << 31 mov cr0, eax ret section .bss align 4096 ; align page tables to 4KB pageTableL4: resb 4096 pageTableL3: resb 4096 pageTableL2: resb 4096 stackBottom: resb 4096 * 4 ; reserve 16KB of memory stackTop:
scripts/generate_coverage.applescript
Son-Le-Goog/nimbus
2,787
3911
<gh_stars>1000+ on run argv tell application "/Applications/CoverStory.app" quit activate set x to open (item 1 of argv) tell x to export to HTML in (item 2 of argv) quit end tell return item 1 of argv & "|" & item 2 of argv end run
programs/oeis/014/A014983.asm
neoneye/loda
22
178817
; A014983: a(n) = (1 - (-3)^n)/4. ; 0,1,-2,7,-20,61,-182,547,-1640,4921,-14762,44287,-132860,398581,-1195742,3587227,-10761680,32285041,-96855122,290565367,-871696100,2615088301,-7845264902,23535794707,-70607384120,211822152361,-635466457082,1906399371247,-5719198113740,17157594341221,-51472783023662,154418349070987,-463255047212960,1389765141638881,-4169295424916642,12507886274749927,-37523658824249780,112570976472749341,-337712929418248022,1013138788254744067,-3039416364764232200,9118249094292696601,-27354747282878089802,82064241848634269407,-246192725545902808220,738578176637708424661,-2215734529913125273982,6647203589739375821947,-19941610769218127465840,59824832307654382397521,-179474496922963147192562,538423490768889441577687,-1615270472306668324733060,4845811416920004974199181,-14537434250760014922597542,43612302752280044767792627,-130836908256840134303377880,392510724770520402910133641,-1177532174311561208730400922,3532596522934683626191202767,-10597789568804050878573608300,31793368706412152635720824901,-95380106119236457907162474702,286140318357709373721487424107,-858420955073128121164462272320,2575262865219384363493386816961,-7725788595658153090480160450882,23177365786974459271440481352647,-69532097360923377814321444057940,208596292082770133442964332173821,-625788876248310400328892996521462,1877366628744931200986678989564387,-5632099886234793602960036968693160,16896299658704380808880110906079481,-50688898976113142426640332718238442,152066696928339427279920998154715327,-456200090785018281839762994464145980 add $0,1 mov $1,-3 pow $1,$0 add $1,3 div $1,12 mov $0,$1
programs/oeis/256/A256077.asm
jmorken/loda
1
241844
<reponame>jmorken/loda ; A256077: Repeat 2^d times the repunit A002275(d); d = 1, 2, 3... ; 1,1,11,11,11,11,111,111,111,111,111,111,111,111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,11111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111,1111111 mov $1,3 lpb $0 div $0,2 sub $0,1 mul $1,10 lpe div $1,27 mul $1,10 add $1,1
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_qos.g4
adiapel/batfish
0
1902
parser grammar CiscoXr_qos; import CiscoXr_common; options { tokenVocab = CiscoXrLexer; } cm_end_class_map : END_CLASS_MAP NEWLINE ; cm_match : num = uint_legacy? MATCH NOT? ( cmm_access_group | cmm_access_list | cmm_activated_service_template | cmm_any | cmm_authorization_status | cmm_class_map | cmm_cos | cmm_default_inspection_traffic | cmm_dscp | cmm_exception | cmm_method | cmm_mpls | cmm_non_client_nrt | cmm_port | cmm_precedence | cmm_protocol | cmm_qos_group | cmm_redirect | cmm_result_type | cmm_service_template ) ; cmm_access_group : ( IP | IPV6 )? ACCESS_GROUP ( IP | IPV6 | IPV4 )? ( num = uint_legacy | ( NAME name = variable ) | ( name = variable color_setter? ) ) NEWLINE ; cmm_access_list : ACCESS_LIST name = variable NEWLINE ; cmm_activated_service_template : ACTIVATED_SERVICE_TEMPLATE name = variable NEWLINE ; cmm_any : ANY NEWLINE ; cmm_authorization_status : AUTHORIZATION_STATUS ( AUTHORIZED | UNAUTHORIZED ) NEWLINE ; cmm_class_map : CLASS_MAP name = variable NEWLINE ; cmm_cos : COS ( uint_legacy+ | range ) NEWLINE ; cmm_default_inspection_traffic : DEFAULT_INSPECTION_TRAFFIC NEWLINE ; cmm_dscp : IP? DSCP IPV4? ( ( dscp_types += dscp_type )+ | ( dscp_range = range ) ) NEWLINE ; cmm_exception : EXCEPTION ~NEWLINE+ NEWLINE ; cmm_method : METHOD ( DOT1X | MAB | WEBAUTH ) NEWLINE ; cmm_mpls : MPLS null_rest_of_line ; cmm_non_client_nrt : NON_CLIENT_NRT NEWLINE ; cmm_port : PORT ( TCP | UDP ) port_specifier NEWLINE ; cmm_precedence : IP? PRECEDENCE IPV4? ( uint_legacy+ | name = variable ) NEWLINE ; cmm_protocol : PROTOCOL null_rest_of_line ; cmm_qos_group : QOS_GROUP uint_legacy NEWLINE ; cmm_redirect : REDIRECT ~NEWLINE NEWLINE ; cmm_result_type : RESULT_TYPE ( METHOD ( DOT1X | MAB | WEBAUTH ) )? variable NEWLINE ; cmm_service_template : SERVICE_TEMPLATE name = variable NEWLINE ; color_setter : SET_COLOR ( RED | YELLOW | GREEN ) ; inspect_protocol : HTTP | HTTPS | ICMP | TCP | TFTP | UDP ; match_semantics : MATCH_ALL | MATCH_ANY ; og_network : NETWORK name = variable_permissive NEWLINE ( ogn_description | ogn_group_object | ogn_host_ip | ogn_ip_with_mask | ogn_network_object )* ; ogn_description : description_line ; ogn_group_object : GROUP_OBJECT name = variable_permissive NEWLINE ; ogn_host_ip : HOST ip = IP_ADDRESS NEWLINE ; ogn_ip_with_mask : ip = IP_ADDRESS mask = IP_ADDRESS NEWLINE ; ogn_network_object : NETWORK_OBJECT ( HOST ( address = IP_ADDRESS | address6 = IPV6_ADDRESS // Do not reorder: variable_permissive captures all tokens in line | host = variable_permissive ) | wildcard_address = IP_ADDRESS wildcard_mask = IP_ADDRESS | prefix = IP_PREFIX | prefix6 = IPV6_PREFIX | OBJECT name = variable_permissive // Do not reorder: variable_permissive captures all tokens in line | host = variable_permissive ) NEWLINE ; on_group : GROUP_OBJECT name = variable_permissive NEWLINE ; pm_end_policy_map : END_POLICY_MAP NEWLINE ; pm_type_accounting : TYPE ACCOUNTING mapname = variable NEWLINE pm_type_null_tail* ; pm_type_null_tail : ( CLASS | DESCRIPTION ) null_rest_of_line ; pm_type_control_subscriber : TYPE CONTROL SUBSCRIBER mapname = variable NEWLINE ( pmtcs_event | pm_type_null_tail )* ; pm_type_pbr : TYPE PBR mapname = variable NEWLINE pm_type_null_tail* ; pm_type_performance_traffic : TYPE PERFORMANCE_TRAFFIC mapname = variable NEWLINE pm_type_null_tail* ; pm_type_qos : (TYPE QOS)? mapname = variable NEWLINE pm_type_null_tail* ; pm_type_redirect : TYPE REDIRECT mapname = variable NEWLINE pm_type_null_tail* ; pm_type_traffic : TYPE TRAFFIC mapname = variable NEWLINE pm_type_null_tail* ; pmtcs_event : EVENT null_rest_of_line ( pmtcse_class )* ; pmtcse_class : CLASS ( CLASS_DEFAULT | TYPE CONTROL SUBSCRIBER classname = variable ) pmtcsec_do? NEWLINE pmtcsec_tail* ; pmtcsec_do : DO_ALL | DO_UNTIL_FAILURE | DO_UNTIL_SUCCESS ; pmtcsec_tail : uint_legacy ( pmtcsec_activate | pmtcsec_null ) ; pmtcsec_activate : ACTIVATE DYNAMIC_TEMPLATE dtname = variable NEWLINE ; pmtcsec_null : ( AUTHENTICATE | AUTHORIZE | DEACTIVATE | DISCONNECT | MONITOR | SET_TIMER | STOP_TIMER ) null_rest_of_line ; s_class_map : CLASS_MAP ( TYPE ( CONTROL SUBSCRIBER | CONTROL_PLANE | NETWORK_QOS | PBR | QOS | QUEUING ) )? ( MATCH_ALL | MATCH_ANY | MATCH_NONE )? name = variable NEWLINE ( DESCRIPTION ~NEWLINE+ NEWLINE )? ( cm_end_class_map | cm_match )* ; s_object_group : OBJECT_GROUP ( og_network )* ; s_policy_map : POLICY_MAP ( pm_type_accounting | pm_type_control_subscriber | pm_type_pbr | pm_type_performance_traffic | pm_type_qos | pm_type_redirect | pm_type_traffic ) pm_end_policy_map? ; variable_policy_map_header : ~( TYPE | NEWLINE ) ;
lib/random.asm
alastairhm/beebasm
1
26901
<gh_stars>1-10 lda seed+1 tay lsr A lsr A lsr A sta seed+1 lsr A eor seed+1 lsr A eor seed+1 eor seed+0 sta seed+1 tya sta seed+0 asl A eor seed+0 asl A eor seed+0 asl A asl A asl A eor seed+0 sta seed+0 rts
oeis/094/A094874.asm
neoneye/loda-programs
11
240260
; A094874: Decimal expansion of (5-sqrt(5))/2. ; 1,3,8,1,9,6,6,0,1,1,2,5,0,1,0,5,1,5,1,7,9,5,4,1,3,1,6,5,6,3,4,3,6,1,8,8,2,2,7,9,6,9,0,8,2,0,1,9,4,2,3,7,1,3,7,8,6,4,5,5,1,3,7,7,2,9,4,7,3,9,5,3,7,1,8,1,0,9,7,5,5,0,2,9,2,7,9,2,7,9,5,8,1,0,6,0,8,8,6,2 mov $2,1 lpb $0 mov $2,$0 seq $2,109866 ; 9's complement of the digits of the golden ratio phi (A001622): 9.999999999999... - 1.6180339887... = 8.3819660112501051517954131656334... cmp $3,0 add $4,$3 mod $0,$4 lpe mov $0,$2
engine/events/kurt.asm
AtmaBuster/pokeplat-gen2
6
12387
<reponame>AtmaBuster/pokeplat-gen2 Kurt_PrintTextWhichApricorn: ld hl, .Text call PrintText ret .Text: ; Which APRICORN should I use? text_far _WhichApricornText text_end Kurt_PrintTextHowMany: ld hl, .Text call PrintText ret .Text: ; How many should I make? text_far _HowManyShouldIMakeText text_end SelectApricornForKurt: call LoadStandardMenuHeader ld c, $1 xor a ld [wMenuScrollPosition], a ld [wKurtApricornQuantity], a .loop push bc call Kurt_PrintTextWhichApricorn pop bc ld a, c ld [wMenuSelection], a call Kurt_SelectApricorn ld a, c ld [wScriptVar], a and a jr z, .done ld [wCurItem], a ld a, [wMenuCursorY] ld c, a push bc call Kurt_PrintTextHowMany call Kurt_SelectQuantity pop bc jr nc, .loop ld a, [wItemQuantityChangeBuffer] ld [wKurtApricornQuantity], a call Kurt_GiveUpSelectedQuantityOfSelectedApricorn .done call ExitMenu ret Kurt_SelectApricorn: farcall FindApricornsInBag jr c, .nope ld hl, .MenuHeader call CopyMenuHeader ld a, [wMenuSelection] ld [wMenuCursorBuffer], a xor a ldh [hBGMapMode], a call InitScrollingMenu call UpdateSprites call ScrollingMenu ld a, [wMenuJoypad] cp B_BUTTON jr z, .nope ld a, [wMenuSelection] cp -1 jr nz, .done .nope xor a ; FALSE .done ld c, a ret .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 1, 1, 13, 10 dw .MenuData db 1 ; default option db 0 ; XXX .MenuData: db SCROLLINGMENU_DISPLAY_ARROWS ; flags db 4, 7 ; rows, columns db SCROLLINGMENU_ITEMS_NORMAL ; item format dbw 0, wBuffer1 dba .Name dba .Quantity dba NULL .Name: ld a, [wMenuSelection] and a ret z farcall PlaceMenuItemName ret .Quantity: ld a, [wMenuSelection] ld [wCurItem], a call Kurt_GetQuantityOfApricorn ret z ld a, [wItemQuantityChangeBuffer] ld [wMenuSelectionQuantity], a farcall PlaceMenuItemQuantity ret Kurt_SelectQuantity: ld a, [wCurItem] ld [wMenuSelection], a call Kurt_GetQuantityOfApricorn jr z, .done ld a, [wItemQuantityChangeBuffer] ld [wItemQuantityBuffer], a ld a, $1 ld [wItemQuantityChangeBuffer], a ld hl, .MenuHeader call LoadMenuHeader .loop xor a ldh [hBGMapMode], a call MenuBox call UpdateSprites call .PlaceApricornName call PlaceApricornQuantity call ApplyTilemap farcall Kurt_SelectQuantity_InterpretJoypad jr nc, .loop push bc call PlayClickSFX pop bc ld a, b cp -1 jr z, .done ld a, [wItemQuantityChangeBuffer] ld [wItemQuantityChangeBuffer], a ; What is the point of this operation? scf .done call CloseWindow ret .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 9, SCREEN_WIDTH - 1, 12 dw NULL db -1 ; default option db 0 .PlaceApricornName: call MenuBoxCoord2Tile ld de, SCREEN_WIDTH + 1 add hl, de ld d, h ld e, l farcall PlaceMenuItemName ret PlaceApricornQuantity: call MenuBoxCoord2Tile ld de, 2 * SCREEN_WIDTH + 10 add hl, de ld [hl], "×" inc hl ld de, wItemQuantityChangeBuffer lb bc, PRINTNUM_LEADINGZEROS | 1, 2 jp PrintNum Kurt_GetQuantityOfApricorn: push bc ld hl, wNumBerries ld a, [wCurItem] ld c, a ld b, $0 .loop inc hl ld a, [hli] cp -1 jr z, .done cp c jr nz, .loop ld a, [hl] add b ld b, a jr nc, .loop ld b, -1 .done ld a, b sub 99 jr c, .done2 ld b, 99 .done2 ld a, b ld [wItemQuantityChangeBuffer], a and a pop bc ret Kurt_GiveUpSelectedQuantityOfSelectedApricorn: ; Get the quantity of Apricorns of type [wCurItem] ; in the bag. Compatible with multiple stacks. ; Initialize the search. push de push bc ld hl, wNumBerries ld a, [wCurItem] ld c, a ld e, $0 xor a ld [wCurItemQuantity], a ld a, -1 ld [wApricorns], a ; Search for [wCurItem] in the bag. .loop1 ; Increase the total count. ld a, [wCurItemQuantity] inc a ld [wCurItemQuantity], a ; Get the index of the next item. inc hl ld a, [hli] ; If we've reached the end of the pocket, break. cp -1 jr z, .okay1 ; If we haven't found what we're looking for, continue. cp c jr nz, .loop1 ; Increment the result counter and store the bag index of the match. ld d, $0 push hl ld hl, wApricorns add hl, de inc e ld a, [wCurItemQuantity] dec a ld [hli], a ld a, -1 ld [hl], a pop hl jr .loop1 .okay1 ; How many stacks have we found? ld a, e and a jr z, .done dec a jr z, .OnlyOne ld hl, wApricorns .loop2 ld a, [hl] ld c, a push hl .loop3 inc hl ld a, [hl] cp -1 jr z, .okay2 ld b, a ld a, c call Kurt_GetAddressOfApricornQuantity ld e, a ld a, b call Kurt_GetAddressOfApricornQuantity sub e jr z, .equal jr c, .less jr .loop3 .equal ld a, c sub b jr nc, .loop3 .less ld a, c ld c, b ld [hl], a ld a, c pop hl ld [hl], a push hl jr .loop3 .okay2 pop hl inc hl ld a, [hl] cp -1 jr nz, .loop2 .OnlyOne: ld hl, wApricorns .loop4 ld a, [hl] cp -1 jr z, .done push hl ld [wCurItemQuantity], a call Kurt_GetRidOfItem pop hl ld a, [wItemQuantityChangeBuffer] and a jr z, .done push hl ld a, [hli] ld c, a .loop5 ld a, [hli] cp -1 jr z, .okay3 cp c jr c, .loop5 dec a dec hl ld [hli], a jr .loop5 .okay3 pop hl inc hl jr .loop4 .done ld a, [wItemQuantityChangeBuffer] and a pop bc pop de ret Kurt_GetAddressOfApricornQuantity: push hl push bc ld hl, wNumBerries inc hl ld c, a ld b, $0 add hl, bc add hl, bc inc hl ld a, [hl] pop bc pop hl ret Kurt_GetRidOfItem: push bc ld hl, wNumBerries ld a, [wCurItemQuantity] ld c, a ld b, $0 inc hl add hl, bc add hl, bc ld a, [wCurItem] ld c, a ld a, [hli] cp -1 jr z, .done cp c jr nz, .done ld a, [wItemQuantityChangeBuffer] ld c, a ld a, [hl] sub c ld b, c jr nc, .okay add c ld b, a .okay push bc ld hl, wNumBerries ld a, b ld [wItemQuantityChangeBuffer], a call TossItem pop bc ld a, c sub b .done ld [wItemQuantityChangeBuffer], a pop bc ret
asm/ooe_fix_lighthouse_other_entrances.asm
Iemnur/DSVEdit
70
172514
<reponame>Iemnur/DSVEdit .nds .relativeinclude on .erroronwarning on ; If the player enters the lighthouse from one of the top doors while Brachyura is still alive, they would normally get softlocked. ; This patch teleports the player to the bottom of the room in that case so they can fight Brachyura as normal. ; Also, if the player enters it from the bottom right door the wall there would softlock the player and prevent them from entering, so that wall is removed. @Overlay86Start equ 0x022EB1A0 @FreeSpace equ @Overlay86Start .open "ftc/overlay9_53", 022C1FE0h .org 0x022C3A68 ; Code that runs if misc flag 0 is not set, before initializing the breakable ceilings. b @TeleportPlayerIfAtTop .org 0x022C331C ; Code that calls GetEntitySlot to create the right wall. mov r0, 0h ; Don't create the right wall. .close .open "ftc/overlay9_86", @Overlay86Start ; Free space overlay .org @FreeSpace @TeleportPlayerIfAtTop: ldr r0, =02109850h ldr r1, [r0, 4h] ; Load player's Y cmp r1, 9C0h*1000h movlt r2, 0A70h*1000h strlt r2, [r0, 4h] ; If the player's Y is < 9C0 teleport them to the bottom of the room. This is in case they entered from one of the top doors. movlt r2, 80h*1000h strlt r2, [r0] ; Also change the player's X to be in the middle of the room. ldr r0, =022CD3F4h ; Replaces the line of code we overwrote to jump to free space b 022C3A6Ch ; Return .pool .close
programs/oeis/021/A021180.asm
karttu/loda
0
29306
<reponame>karttu/loda ; A021180: Decimal expansion of 1/176. ; 0,0,5,6,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8 mov $3,2 mov $9,$0 lpb $3,1 mov $0,$9 sub $3,1 add $0,$3 sub $0,1 mov $5,$0 mov $7,2 lpb $7,1 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $10,2 mul $10,$0 add $10,$0 mov $0,24 mov $4,$10 div $4,2 lpb $0,1 mul $0,2 div $0,15 trn $10,$4 sub $4,1 add $10,2 mul $4,$10 sub $4,$0 lpe trn $4,2 mov $8,$7 mov $10,$4 lpb $8,1 mov $6,$10 sub $8,1 lpe lpe lpb $5,1 mov $5,0 sub $6,$10 lpe mov $2,$3 mov $10,$6 lpb $2,1 mov $1,$10 sub $2,1 lpe lpe lpb $9,1 sub $1,$10 mov $9,0 lpe div $1,2
programs/oeis/001/A001737.asm
karttu/loda
0
97369
; A001737: Squares written in base 2. ; 0,1,100,1001,10000,11001,100100,110001,1000000,1010001,1100100,1111001,10010000,10101001,11000100,11100001,100000000,100100001,101000100,101101001,110010000,110111001,111100100,1000010001,1001000000,1001110001,1010100100,1011011001,1100010000,1101001001,1110000100,1111000001,10000000000,10001000001,10010000100,10011001001,10100010000,10101011001,10110100100,10111110001,11001000000,11010010001,11011100100,11100111001,11110010000,11111101001,100001000100,100010100001,100100000000,100101100001,100111000100,101000101001,101010010000,101011111001,101101100100,101111010001,110001000000,110010110001,110100100100,110110011001,111000010000,111010001001,111100000100,111110000001,1000000000000,1000010000001,1000100000100,1000110001001,1001000010000,1001010011001,1001100100100,1001110110001,1010001000000,1010011010001,1010101100100,1010111111001,1011010010000,1011100101001,1011111000100,1100001100001,1100100000000,1100110100001,1101001000100,1101011101001,1101110010000,1110000111001,1110011100100,1110110010001,1111001000000,1111011110001,1111110100100,10000001011001,10000100010000,10000111001001,10001010000100,10001101000001,10010000000000,10010011000001,10010110000100,10011001001001,10011100010000,10011111011001,10100010100100,10100101110001,10101001000000,10101100010001,10101111100100,10110010111001,10110110010000,10111001101001,10111101000100,11000000100001,11000100000000,11000111100001,11001011000100,11001110101001,11010010010000,11010101111001,11011001100100,11011101010001,11100001000000,11100100110001,11101000100100,11101100011001,11110000010000,11110100001001,11111000000100,11111100000001,100000000000000,100000100000001,100001000000100,100001100001001,100010000010000,100010100011001,100011000100100,100011100110001,100100001000000,100100101010001,100101001100100,100101101111001,100110010010000,100110110101001,100111011000100,100111111100001,101000100000000,101001000100001,101001101000100,101010001101001,101010110010000,101011010111001,101011111100100,101100100010001,101101001000000,101101101110001,101110010100100,101110111011001,101111100010000,110000001001001,110000110000100,110001011000001,110010000000000,110010101000001,110011010000100,110011111001001,110100100010000,110101001011001,110101110100100,110110011110001,110111001000000,110111110010001,111000011100100,111001000111001,111001110010000,111010011101001,111011001000100,111011110100001,111100100000000,111101001100001,111101111000100,111110100101001,111111010010000,111111111111001,1000000101100100,1000001011010001,1000010001000000,1000010110110001,1000011100100100,1000100010011001,1000101000010000,1000101110001001,1000110100000100,1000111010000001,1001000000000000,1001000110000001,1001001100000100,1001010010001001,1001011000010000,1001011110011001,1001100100100100,1001101010110001,1001110001000000,1001110111010001,1001111101100100,1010000011111001,1010001010010000,1010010000101001,1010010111000100,1010011101100001,1010100100000000,1010101010100001,1010110001000100,1010110111101001,1010111110010000,1011000100111001,1011001011100100,1011010010010001,1011011001000000,1011011111110001,1011100110100100,1011101101011001,1011110100010000,1011111011001001,1100000010000100,1100001001000001,1100010000000000,1100010111000001,1100011110000100,1100100101001001,1100101100010000,1100110011011001,1100111010100100,1101000001110001,1101001001000000,1101010000010001,1101010111100100,1101011110111001,1101100110010000,1101101101101001,1101110101000100,1101111100100001,1110000100000000,1110001011100001,1110010011000100,1110011010101001,1110100010010000,1110101001111001,1110110001100100,1110111001010001,1111000001000000,1111001000110001 pow $0,2 sub $2,$0 lpb $0,1 mov $1,$0 mul $0,2 add $2,$0 cal $1,228071 ; Write n in binary and interpret as a decimal number; a(n) is this quantity minus n. mov $0,0 add $2,$1 lpe sub $1,$1 add $1,$2
Pad Printfiles.applescript
AlexanderGalen/applescripts
3
2482
<reponame>AlexanderGalen/applescripts<filename>Pad Printfiles.applescript --checks to make sure quark is open and a document is open and something is selected and provides user feedback set documentOpen to false set validSelection to false set quarkRunning to false on is_running(appName) tell application "System Events" to (name of processes) contains appName end is_running set quarkRunning to is_running("QuarkXPress") if quarkRunning then tell application "QuarkXPress" try get document 1 set documentOpen to true if selection is not null then set validSelection to true end try end tell end if if not (documentOpen and validSelection) then tell application "QuarkXPress" activate display alert "For this script to work, Quark must be running, have a document open, and have area which you would like to make a printfile with selected." end tell return end if tell application "QuarkXPress" tell document 1 set missingImages to missing of every image set modifiedImages to modified of every image if (missingImages contains true or modifiedImages contains true) then display dialog "Document contains Images that are either unlinked or modified, please update them, then try running this script again." end if end tell set activeJobs to "HOM_Shortrun:~HOM Active Jobs:" set docName to name of document 1 as string set AppleScript's text item delimiters to "." set splitName to text items of docName set docName to items 1 thru ((length of splitName) - 2) of splitName as string set AppleScript's text item delimiters to {""} -- get path to job folder from document, or ask for it if document has no file on disk set jobPath to file path of document 1 if jobPath is null then set jobNumber to text returned of (display dialog "Input job number please" default answer "") set docName to jobNumber set jobPath to activeJobs & jobNumber & ":" & jobNumber & ".HOM.qxp" else set jobPath to jobPath as string end if -- get the parent folder to save into from jobPath set AppleScript's text item delimiters to ":" set splitPath to text items of jobPath set parentFolder to items 1 thru ((length of splitPath) - 1) of splitPath as string set AppleScript's text item delimiters to {""} -- check if job folder exists, and create it if not tell application "Finder" set folderExists to exists of parentFolder if not folderExists then set AppleScript's text item delimiters to ":" set splitPath to text items of parentFolder set parentParentFolder to items 1 thru ((length of splitPath) - 1) of splitPath as string set parentFolderName to item (length of splitPath) as string set AppleScript's text item delimiters to {""} make new folder at parentParentFolder with properties {name:parentFolderName} end if end tell set thisPrintFile to parentFolder & ":" & docName & ".printfile.pdf" set thisDestinationFile to parentFolder & ":" & docName set theSelection to selection if class of theSelection is group box then set grouped of theSelection to true set isGroupBox to true else set isGroupBox to false end if copy theSelection set {y1, x1, y2, x2} to bounds of theSelection as list set x1 to (coerce x1 to real) set x2 to (coerce x2 to real) set y1 to (coerce y1 to real) set y2 to (coerce y2 to real) set theWidth to x2 - x1 set theHeight to y2 - y1 if theWidth is not 4 and theWidth is not 3.75 then display dialog "Sizing is neither a CCCP or CHCP." return end if close document 1 without saving set newDocProperties to {page height:theHeight, page width:theWidth} make new document with properties newDocProperties tell document 1 activate paste if isGroupBox then set bounds of group box 1 to {0, 0, theHeight, theWidth} else set bounds of picture box 1 to {0, 0, theHeight, theWidth} end if end tell export layout space 1 of project 1 in thisPrintFile as "PDF" PDF output style "No Compression" close document 1 without saving end tell if theWidth is 4 then set shape to "CACH" else set shape to "CACC" end if set thisPosixPrintFile to quoted form of POSIX path of thisPrintFile set thisPosixDestinationFile to quoted form of POSIX path of (thisDestinationFile & "." & shape & ".pdf") log thisPosixDestinationFile --set nodeScript to quoted form of "/Volumes/RESOURCE/Scripting/AAASpectacularAlex Scripts/Impose Calendar Pads.js" set nodeScript to quoted form of "/Users/Alex/Scripts/Impose Calendar Pads.js" do shell script "/usr/local/bin/node " & nodeScript & " " & thisPosixPrintFile & " " & thisPosixDestinationFile & " " & shape
kartnamereferencelist.asm
szymbar15/Mario-Kart-DS-ASM-hacks-from-YouTube-Videos
1
12079
;0x21532DC KartNameReferenceList: dcd 0x6, 0x7, 0x8, 0x15, 0x16, 0x17, 0x12, 0x13, 0x14, 0x1B,\ 0x1C, 0x1D, 0xC, 0xD, 0xE, 0x18, 0x19, 0x1A, 0xF, 0x10,\ 0x11, 0x9, 0xA, 0xB, 0x21, 0x22, 0x23, 0x1E, 0x1F, 0x20,\ 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,\ 0x2A
lambda/lambda.g4
mooseman/miniHope
1
7130
grammar lambda; import lambdaTokens; stmt : LPAREN lambda_stmt arrow expr RPAREN ; LPAREN : '(' ; lambda_stmt : (BACKSLASH || LETTER) ( LETTER )* ; BACKSLASH : '\\' ; RPAREN : ')' ; arrow : '->' ; expr : LETTER | NUMBER | expr OP expr ; OP : '+' | '-' | '*' | '/' | '^' ;
spc.asm
KScl/z3rasm
26
176608
MSUCode = $00277E ;@ pushpc ; Change track 15 (unused) to point to 13 (Death Mountain) so dark woods can be track 15 ; Bank 1 org $1A9F15 ; PC 0x0D1F15 ; SPC $D01C dw $2B00 ; Set track 15 pointer to track 13's data pullpc ;--------------------------------------------------------------------------------------------------- arch spc700 ;@ pushpc ;@ pushbase org $19FE41 ; SPC 0A73 JMP MSUCode ; Hijack unreachable SFX data for globally available code org $1A9B2E base MSUCode SpecialCommand_Mute: CMP A,#$F0 ; The thing we overwrote BNE + JMP $0A81 ; SilenceSong + CMP A,#$FA ; New mute command $FA BNE + MOV $F4,A MOV A,#$00 MOV $0A4A,A ; $0A49: MOV A,#$70 -> MOV A,#$00 MOV $0AF3,A ; $0AF2: MOV $059,#$C0 -> MOV $059,#$00 MOV $0C32,A ; $0C32: MOVW $058,YA -> NOP #2 MOV $0C33,A MOV A,#$C4 ; $0D19: MOVW $058,YA -> MOV A,$058 MOV $0D19,A MOV A,#$58 MOV $0D1A,A BRA +++ + CMP A,#$FB ; New unmute command $FB BEQ + JMP $0A9D ; NewSongInput + MOV $F4,A MOV A,#$70 MOV $0A4A,A ; $0A49: MOV A,#$70 MOV A,#$C0 MOV $0AF3,A ; $0AF2: MOV $059,#$C0 MOV A,#$DA MOV $0C32,A ; $0C32: MOVW $058,YA MOV $0D19,A ; $0D19: MOVW $058,YA MOV A,#$58 MOV $0C33,A MOV $0D1A,A +++ CALL $0A81 ; SilenceSong - MOV A,$F4 BNE - CMP A,$F4 BNE - MOV $F4,$00 RET warnpc $1A9B91 ;@ pullbase ;@ pullpc arch 65816
runtime/ravenscar-sfp-stm32f427/gnarl-common/a-sytaco.ads
TUM-EI-RCS/StratoX
12
18282
<reponame>TUM-EI-RCS/StratoX<filename>runtime/ravenscar-sfp-stm32f427/gnarl-common/a-sytaco.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S Y N C H R O N O U S _ T A S K _ C O N T R O L -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the generic bare board version of this package with System.Tasking; with Ada.Task_Identification; package Ada.Synchronous_Task_Control with SPARK_Mode is pragma Preelaborate; -- In accordance with Ada 2005 AI-362 type Suspension_Object is limited private; -- There was a 'Default_Initial_Condition' but it is removed as it resulted -- in an undefined symbol. procedure Set_True (S : in out Suspension_Object) with Global => null, Depends => (S => null, null => S); procedure Set_False (S : in out Suspension_Object) with Global => null, Depends => (S => null, null => S); function Current_State (S : Suspension_Object) return Boolean with Volatile_Function, Global => Ada.Task_Identification.Tasking_State; procedure Suspend_Until_True (S : in out Suspension_Object) with Global => null, Depends => (S => null, null => S); private pragma SPARK_Mode (Off); -- Using a protected object may seem overkill, but assuming the -- appropriate restrictions (such as those imposed by the Ravenscar -- profile) protected operations are very efficient. Moreover, this -- allows for a generic implementation that is not dependent on the -- underlying operating system. protected type Suspension_Object is entry Wait; procedure Set_False; procedure Set_True; function Get_Open return Boolean; pragma Interrupt_Priority; private Open : Boolean := False; -- Status end Suspension_Object; end Ada.Synchronous_Task_Control;
programs/oeis/315/A315511.asm
karttu/loda
0
179495
<reponame>karttu/loda ; A315511: Coordination sequence Gal.4.139.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,6,11,17,21,27,32,38,44,49,55,59,65,70,76,82,87,93,97,103,108,114,120,125,131,135,141,146,152,158,163,169,173,179,184,190,196,201,207,211,217,222,228,234,239,245,249,255,260,266 mov $3,$0 lpb $0,1 add $1,$0 lpb $0,1 sub $0,7 sub $1,1 lpe mod $0,2 add $1,$0 div $1,2 sub $1,1 lpe add $1,1 mov $2,$3 mul $2,5 add $1,$2
programs/oeis/081/A081674.asm
neoneye/loda
22
171428
; A081674: Generalized Poly-Bernoulli numbers. ; 0,1,6,29,130,561,2366,9829,40410,164921,669526,2707629,10919090,43942081,176565486,708653429,2841788170,11388676041,45619274246,182670807229,731264359650,2926800830801,11712433499806,46865424529029,187508769705530,750176293590361,3001128818666166,12005786207578829,48026957629057810,192119268912458721,768511390838517326,3074148508920116629,12296902872378608490,49188537999608859881,196756931528718717286,787036064705724702429,3148169274595448309570,12592752145699441737841,50371233724750712450046,201485610324861686296229,805944467577023254673050,3223783949140822547156601,12895154033061478774019606,51580670841740480852258029,206322847495445620677570930,825291882367233574515900161,3301169006625287573480449966,13204680457970210120172347829,52818735126288019959441035210,211274980388373618274019072521,845100041203159088404841085126,3380400523761630199545658725629,13521603171893502335961518057890,54086415918114953957182721697681,216345673364082649668740835189086,865382722531199100194993185951429,3461530977349401905340062279390970,13846124171071424135040517724319641,55384497469307146081202876717545846,221537992232292932947933924330985229,886151975994364777661102949706346450 mov $1,4 mov $2,3 mov $3,$0 add $3,1 pow $1,$3 pow $2,$3 sub $1,$2 div $1,6 mov $0,$1
programs/oeis/332/A332161.asm
neoneye/loda
22
246525
; A332161: a(n) = 6*(10^(2*n+1)-1)/9 - 5*10^n. ; 1,616,66166,6661666,666616666,66666166666,6666661666666,666666616666666,66666666166666666,6666666661666666666,666666666616666666666,66666666666166666666666,6666666666661666666666666,666666666666616666666666666,66666666666666166666666666666,6666666666666661666666666666666 seq $0,177108 ; a(n) = 4*(10^n-3). add $1,$0 sub $0,2 sub $1,4 mul $1,$0 mul $1,2 sub $1,1248 div $1,480 add $1,1 mov $0,$1
oeis/022/A022781.asm
neoneye/loda-programs
11
164150
; A022781: Place where n-th 1 occurs in A023119. ; Submitted by <NAME>(s2) ; 1,4,10,18,29,43,59,78,100,124,151,181,213,248,286,326,369,414,462,513,566,622,681,742,806,873,942,1014,1089,1166,1246,1329,1414,1502,1592,1685,1781,1879,1980,2084,2190,2299,2411,2525,2642,2762,2884 lpb $0 mov $2,$0 sub $0,1 seq $2,198084 ; Ceiling(n*sqrt(7)). add $1,$2 lpe mov $0,$1 add $0,1
test/Fail/AmbiguousModule.agda
cruhland/agda
1,989
4478
module AmbiguousModule where module A where module B where module A where open B open A
alloy4fun_models/trashltl/models/5/BjYi8Wi3xBi2pvPAR.als
Kaixi26/org.alloytools.alloy
0
4587
open main pred idBjYi8Wi3xBi2pvPAR_prop6 { eventually some f:File | f not in File' and always f not in File' } pred __repair { idBjYi8Wi3xBi2pvPAR_prop6 } check __repair { idBjYi8Wi3xBi2pvPAR_prop6 <=> prop6o }
oeis/062/A062800.asm
neoneye/loda-programs
11
92651
<reponame>neoneye/loda-programs ; A062800: Primes of form 100k + 1. ; Submitted by <NAME> ; 101,401,601,701,1201,1301,1601,1801,1901,2801,3001,3301,3701,4001,4201,4801,5101,5501,5701,5801,6101,6301,6701,7001,7901,8101,8501,9001,9601,9901,10301,10501,10601,11701,11801,12101,12301,12401,12601,13001,13901,14401,15101,15401,15601,15901,16001,16301,16901,17401,18301,18401,18701,19001,19301,19501,19801,20101,20201,21001,21101,21401,21601,21701,22501,22901,23201,23801,24001,25301,25601,25801,26501,26701,26801,27701,27901,28001,28201,28901,29101,29201,29401,29501,31601,32401,32801,33301,33601 mov $2,$0 add $2,2 pow $2,2 lpb $2 mov $3,$1 add $1,26 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,74 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe add $1,1 mov $0,$1
src/metadslx.soal.runtime/src/generated/resources/SoalLexer.g4
balazssimon/soal-java
0
6747
lexer grammar SoalLexer; KNamespace : 'namespace'; KEnum : 'enum'; KException : 'exception'; KStruct : 'struct'; KInterface : 'interface'; KThrows : 'throws'; KOneway : 'oneway'; KReturn : 'return'; KBinding : 'binding'; KTransport : 'transport'; KEncoding : 'encoding'; KProtocol : 'protocol'; KEndpoint : 'endpoint'; KAddress : 'address'; KDatabase : 'database'; KEntity : 'entity'; KAbstract : 'abstract'; KComponent : 'component'; KComposite : 'composite'; KReference : 'reference'; KService : 'service'; KWire : 'wire'; KTo : 'to'; KImplementation : 'implementation'; KLanguage : 'language'; KAssembly : 'assembly'; KDeployment : 'deployment'; KEnvironment : 'environment'; KRuntime : 'runtime'; KNull : 'null'; KTrue : 'true'; KFalse : 'false'; KObject : 'object'; KString : 'string'; KInt : 'int'; KLong : 'long'; KFloat : 'float'; KDouble : 'double'; KByte : 'byte'; KBool : 'bool'; KAny : 'any'; KVoid : 'void'; KTypeof : 'typeof'; TSemicolon : ';'; TColon : ':'; TDot : '.'; TComma : ','; TAssign : '='; TOpenParen : '('; TCloseParen : ')'; TOpenBracket : '['; TCloseBracket : ']'; TOpenBrace : '{'; TCloseBrace : '}'; TLessThan : '<'; TGreaterThan : '>'; TQuestion : '?'; TQuestionQuestion : '??'; TAmpersand : '&'; THat : '^'; TBar : '|'; TAndAlso : '&&'; TOrElse : '||'; TPlusPlus : '++'; TMinusMinus : '--'; TPlus : '+'; TMinus : '-'; TTilde : '~'; TExclamation : '!'; TSlash : '/'; TAsterisk : '*'; TPercent : '%'; TLessThanOrEqual : '<='; TGreaterThanOrEqual : '>='; TEqual : '=='; TNotEqual : '!='; TAsteriskAssign : '*='; TSlashAssign : '/='; TPercentAssign : '%='; TPlusAssign : '+='; TMinusAssign : '-='; TLeftShiftAssign : '<<='; TRightShiftAssign : '>>='; TAmpersandAssign : '&='; THatAssign : '^='; TBarAssign : '|='; IDate : 'Date'; ITime : 'Time'; IDateTime : 'DateTime'; ITimeSpan : 'TimeSpan'; IVersion : 'Version'; IStyle : 'Style'; IMTOM : 'MTOM'; ISSL : 'SSL'; IHTTP : 'HTTP'; IREST : 'REST'; IWebSocket : 'WebSocket'; ISOAP : 'SOAP'; IXML : 'XML'; IJSON : 'JSON'; IClientAuthentication : 'ClientAuthentication'; IdentifierNormal : IdentifierBegin IdentifierCharacter*; IdentifierVerbatim : '@' IdentifierBegin IdentifierCharacter*; fragment IdentifierBegin : [a-zA-Z_]; fragment IdentifierCharacter : [a-zA-Z0-9_]; fragment IdentifierVerbatimCharacter : ~[\]] | IdentifierVerbatimEscape; fragment IdentifierVerbatimEscape : '\\\\' | '\\]'; fragment IdentifierGeneralBegin : [a-zA-Z_]; fragment IdentifierGeneralCharacter : [a-zA-Z0-9_]; IntegerLiteral : DecimalDigits | Hexadecimal; DecimalLiteral : DecimalDigit+ '.' DecimalDigit+; ScientificLiteral : DecimalLiteral [eE] Sign? DecimalDigit+; fragment DecimalDigits : DecimalDigit+; fragment DecimalDigit : [0-9]; fragment Sign : '+' | '-'; fragment Hexadecimal : ('0x'|'0X') HexDigit*; fragment HexDigit : [0-9a-fA-F]; DateTimeOffsetLiteral : DateLiteral 'T' TimeLiteral TimeZone; DateTimeLiteral : DateLiteral 'T' TimeLiteral; DateLiteral : Sign? DateYear '-' DateMonth '-' DateDay; TimeLiteral : TimeHourMinute ':' TimeSecond; fragment DateDay : '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29' | '30' | '31'; fragment DateMonth : '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12'; fragment DateYear : DecimalDigit DecimalDigit DecimalDigit DecimalDigit; fragment TimeZone: Sign OffsetTimeHourMinute | 'Z'; fragment OffsetTimeHour : '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14'; fragment OffsetTimeHourMinute: OffsetTimeHour ':' TimeMinute; fragment TimeHour : '00' | '01' | '02' | '03' | '04' | '05' | '06' | '07' | '08' | '09' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | '23'; fragment TimeHourMinute: TimeHour ':' TimeMinute; fragment TimeMinute: ['0'-'5'] DecimalDigit; fragment TimeSecond: ['0'-'5'] DecimalDigit TimeSecondDecimalPart?; fragment TimeSecondDecimalPart: '.' DecimalDigits; RegularStringLiteral : '"' DoubleQuoteTextCharacter* '"' | '\'' SingleQuoteTextCharacter* '\''; DoubleQuoteVerbatimStringLiteralStart : '@"' -> more, mode(DOUBLEQUOTE_VERBATIM_STRING); SingleQuoteVerbatimStringLiteralStart : '@''' -> more, mode(SINGLEQUOTE_VERBATIM_STRING); fragment SingleQuoteTextCharacter : SingleQuoteTextSimple | CharacterEscapeSimple | CharacterEscapeUnicode; fragment SingleQuoteTextSimple : ~('\'' | '\\' | '\u000A' | '\u000D' | '\u0085' | '\u2028' | '\u2029'); fragment SingleQuoteTextVerbatimCharacter : ~['\''] | SingleQuoteTextVerbatimCharacterEscape; fragment SingleQuoteTextVerbatimCharacterEscape : '\'' '\''; fragment SingleQuoteTextVerbatimCharacters : SingleQuoteTextVerbatimCharacter+; fragment DoubleQuoteTextCharacter : DoubleQuoteTextSimple | CharacterEscapeSimple | CharacterEscapeUnicode; fragment DoubleQuoteTextSimple : ~('"' | '\\' | '\u000A' | '\u000D' | '\u0085' | '\u2028' | '\u2029'); fragment DoubleQuoteTextVerbatimCharacter : ~['"'] | DoubleQuoteTextVerbatimCharacterEscape; fragment DoubleQuoteTextVerbatimCharacterEscape : '"' '"'; fragment DoubleQuoteTextVerbatimCharacters : DoubleQuoteTextVerbatimCharacter+; fragment CharacterEscapeSimple : '\\' CharacterEscapeSimpleCharacter; fragment CharacterEscapeSimpleCharacter : '\'' | '"' | '\\' | '0' | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v'; fragment CharacterEscapeUnicode : '\\u' HexDigit HexDigit HexDigit HexDigit | '\\U' HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit; GuidLiteral : '#[' HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit '-' HexDigit HexDigit HexDigit HexDigit '-' HexDigit HexDigit HexDigit HexDigit '-' HexDigit HexDigit HexDigit HexDigit '-' HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit ']'; // Whitespace and comments UTF8BOM : [\u00EF][\u00BB][\u00BF] -> channel(WHITESPACE); WHITESPACE : [\u0020\u0009\u000B\u000C\u00A0\u001A]+ -> channel(WHITESPACE); CRLF : '\r'? '\n' -> channel(WHITESPACE); LINEBREAK : [\u0085\u2028\u2029] -> channel(WHITESPACE); LINE_COMMENT : '//' ~[\r\n]* -> channel(COMMENT); COMMENT_START : '/*' -> more, mode(MULTILINE_COMMENT), channel(COMMENT); mode MULTILINE_COMMENT; COMMENT_CRLF : '\r'? '\n' -> more, channel(COMMENT); COMMENT_LINEBREAK : [\u0085\u2028\u2029] -> more, channel(COMMENT); COMMENT_TEXT : ~[\*\r\n\u0085\u2028\u2029]+ -> more, channel(COMMENT); COMMENT : '*/' -> mode(DEFAULT_MODE), channel(COMMENT); COMMENT_STAR : '*' -> more, channel(COMMENT); mode DOUBLEQUOTE_VERBATIM_STRING; DoubleQuoteVerbatimStringText : DoubleQuoteTextVerbatimCharacter -> more; DoubleQuoteVerbatimStringLiteral : '"' -> mode(DEFAULT_MODE); mode SINGLEQUOTE_VERBATIM_STRING; SingleQuoteVerbatimStringText : SingleQuoteTextVerbatimCharacter -> more; SingleQuoteVerbatimStringLiteral : '"' -> mode(DEFAULT_MODE);
alloy4fun_models/trainstlt/models/3/L88LDZm4e6LjvixXd.als
Kaixi26/org.alloytools.alloy
0
42
<filename>alloy4fun_models/trainstlt/models/3/L88LDZm4e6LjvixXd.als open main pred idL88LDZm4e6LjvixXd_prop4 { all disj s1, s2 : (Signal-(Entry+Exit)) | always s1.pos != s2.pos } pred __repair { idL88LDZm4e6LjvixXd_prop4 } check __repair { idL88LDZm4e6LjvixXd_prop4 <=> prop4o }
ffight/lcs/boss/62.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
175413
copyright zengfr site:http://github.com/zengfr/romhack 006222 move.b ($b,A3), ($62,A4) [boss+36, container+36, enemy+36] 006228 move.b ($c,A3), ($60,A4) copyright zengfr site:http://github.com/zengfr/romhack
Cubical/ZCohomology/Groups/Wedge.agda
ayberkt/cubical
0
12888
{-# OPTIONS --cubical --no-import-sorts --safe --experimental-lossy-unification #-} module Cubical.ZCohomology.Groups.Wedge where open import Cubical.ZCohomology.Base open import Cubical.ZCohomology.Properties open import Cubical.ZCohomology.MayerVietorisUnreduced open import Cubical.Foundations.HLevels open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Function open import Cubical.HITs.Wedge open import Cubical.HITs.SetTruncation renaming (rec to sRec ; rec2 to pRec2 ; elim to sElim ; elim2 to sElim2 ; map to sMap) open import Cubical.HITs.PropositionalTruncation renaming (rec to pRec ; ∣_∣ to ∣_∣₁) open import Cubical.HITs.Truncation renaming (elim to trElim ; rec to trRec ; elim2 to trElim2) open import Cubical.Data.Nat open import Cubical.Algebra.Group open import Cubical.ZCohomology.Groups.Unit open import Cubical.ZCohomology.Groups.Sn open import Cubical.HITs.Pushout open import Cubical.Data.Sigma open import Cubical.Foundations.Isomorphism open import Cubical.Homotopy.Connected open import Cubical.HITs.Susp open import Cubical.HITs.S1 open import Cubical.HITs.Sn open import Cubical.Foundations.Equiv module _ {ℓ ℓ'} (A : Pointed ℓ) (B : Pointed ℓ') where module I = MV (typ A) (typ B) Unit (λ _ → pt A) (λ _ → pt B) Hⁿ-⋁ : (n : ℕ) → GroupIso (coHomGr (suc n) (A ⋁ B)) (×coHomGr (suc n) (typ A) (typ B)) Hⁿ-⋁ zero = BijectionIsoToGroupIso bijIso where surj-helper : (x : coHom 0 Unit) → isInIm _ _ (I.Δ 0) x surj-helper = sElim (λ _ → isOfHLevelSuc 1 propTruncIsProp) λ f → ∣ (∣ (λ _ → f tt) ∣₂ , 0ₕ 0) , cong ∣_∣₂ (funExt λ _ → -rUnitₖ 0 (f tt)) ∣₁ helper : (x : coHom 1 (A ⋁ B)) → isInIm _ _ (I.d 0) x → x ≡ 0ₕ 1 helper x inim = pRec (setTruncIsSet _ _) (λ p → sym (snd p) ∙ MV.Im-Δ⊂Ker-d _ _ Unit (λ _ → pt A) (λ _ → pt B) 0 (fst p) (surj-helper (fst p))) inim bijIso : BijectionIso (coHomGr 1 (A ⋁ B)) (×coHomGr 1 (typ A) (typ B)) BijectionIso.map' bijIso = I.i 1 BijectionIso.inj bijIso = sElim (λ _ → isSetΠ λ _ → isProp→isSet (setTruncIsSet _ _)) λ f inker → helper ∣ f ∣₂ (I.Ker-i⊂Im-d 0 ∣ f ∣₂ inker) BijectionIso.surj bijIso p = I.Ker-Δ⊂Im-i 1 p (isContr→isProp (isContrHⁿ-Unit 0) _ _) Hⁿ-⋁ (suc n) = Iso+Hom→GrIso mainIso (sElim2 (λ _ _ → isOfHLevelPath 2 (isOfHLevel× 2 setTruncIsSet setTruncIsSet) _ _) λ _ _ → refl) where helpIso : ∀ {ℓ'''} {C : Type ℓ'''} → Iso (A ⋁ B → C) (Σ[ f ∈ (typ A → C) × (typ B → C) ] (fst f) (pt A) ≡ (snd f) (pt B)) Iso.fun helpIso f = ((λ x → f (inl x)) , λ x → f (inr x)) , cong f (push tt) Iso.inv helpIso ((f , g) , p) (inl x) = f x Iso.inv helpIso ((f , g) , p) (inr x) = g x Iso.inv helpIso ((f , g) , p) (push a i) = p i Iso.rightInv helpIso ((f , g) , p) = ΣPathP (ΣPathP (refl , refl) , refl) Iso.leftInv helpIso f = funExt λ {(inl a) → refl ; (inr a) → refl ; (push a i) → refl} mainIso : Iso (coHom (2 + n) (A ⋁ B)) (coHom (2 + n) (typ A) × coHom (2 + n) (typ B)) mainIso = compIso (setTruncIso helpIso) (compIso theIso setTruncOfProdIso) where forget : ∥ (Σ[ f ∈ (typ A → coHomK (2 + n)) × (typ B → coHomK (2 + n)) ] (fst f) (pt A) ≡ (snd f) (pt B)) ∥₂ → ∥ (typ A → coHomK (2 + n)) × (typ B → coHomK (2 + n)) ∥₂ forget = sMap (λ {((f , g) , _) → f , g}) isEq : (f : ∥ (typ A → coHomK (2 + n)) × (typ B → coHomK (2 + n)) ∥₂) → isContr (fiber forget f) isEq = sElim (λ _ → isOfHLevelSuc 1 isPropIsContr) (uncurry λ f g → helper f g (f (pt A)) (g (pt B)) refl refl) where helper : (f : (typ A → coHomK (2 + n))) (g : (typ B → coHomK (2 + n))) (x y : coHomK (2 + n)) → f (pt A) ≡ x → g (pt B) ≡ y → isContr (fiber forget ∣ f , g ∣₂) helper f g = trElim2 (λ _ _ → isProp→isOfHLevelSuc (3 + n) (isPropΠ2 λ _ _ → isPropIsContr)) (suspToPropElim2 (ptSn (suc n)) (λ _ _ → isPropΠ2 λ _ _ → isPropIsContr) λ p q → (∣ (f , g) , (p ∙ sym q) ∣₂ , refl) , uncurry (sElim (λ _ → isSetΠ λ _ → isOfHLevelPath 2 (isOfHLevelΣ 2 setTruncIsSet λ _ → isOfHLevelPath 2 setTruncIsSet _ _) _ _) λ { ((f' , g') , id1) y → Σ≡Prop (λ _ → setTruncIsSet _ _) (pRec (setTruncIsSet _ _) (λ id2 → trRec (setTruncIsSet _ _) (λ pathp → cong ∣_∣₂ (ΣPathP ((sym id2) , pathp))) (isConnectedPathP 1 {A = λ i → (fst (id2 (~ i)) (pt A) ≡ snd (id2 (~ i)) (pt B))} (isConnectedPath 2 (isConnectedSubtr 3 n (subst (λ m → isConnected m (coHomK (2 + n))) (+-comm 3 n) (isConnectedKn (suc n)))) _ _) (p ∙ sym q) id1 .fst)) (Iso.fun PathIdTrunc₀Iso y))})) theIso : Iso ∥ (Σ[ f ∈ (typ A → coHomK (2 + n)) × (typ B → coHomK (2 + n)) ] (fst f) (pt A) ≡ (snd f) (pt B)) ∥₂ ∥ (typ A → coHomK (2 + n)) × (typ B → coHomK (2 + n)) ∥₂ theIso = equivToIso (forget , record { equiv-proof = isEq }) {- Alternative, less direct proof : vSES→GroupIso _ _ (ses (isOfHLevelSuc 0 (isContrHⁿ-Unit n)) (isOfHLevelSuc 0 (isContrHⁿ-Unit (suc n))) (I.d (suc n)) (I.Δ (suc (suc n))) (I.i (suc (suc n))) (I.Ker-i⊂Im-d (suc n)) (I.Ker-Δ⊂Im-i (suc (suc n)))) -} wedgeConnected : ((x : typ A) → ∥ pt A ≡ x ∥) → ((x : typ B) → ∥ pt B ≡ x ∥) → (x : A ⋁ B) → ∥ inl (pt A) ≡ x ∥ wedgeConnected conA conB = PushoutToProp (λ _ → propTruncIsProp) (λ a → pRec propTruncIsProp (λ p → ∣ cong inl p ∣₁) (conA a)) λ b → pRec propTruncIsProp (λ p → ∣ push tt ∙ cong inr p ∣₁) (conB b)
test/Succeed/Issue1038.agda
shlevy/agda
1,989
10022
{-# OPTIONS --copatterns --sized-types #-} open import Common.Size module Issue1038 (A : Set) where record S (i : Size) : Set where field force : ∀ (j : Size< i) → A head : ∀ i → S i → (j : Size< i) → A head i s j = S.force s _ -- Problem was: -- Cannot solve size constraints -- (↑ _9 A i s j) =< (_i_8 A i s j) : Size -- (_i_8 A i s j) =< i : Size -- when checking the definition of head -- Works now.
School Directory Project/test_data/ann.asm
AriaPahlavan/Fall-2014-EE-306-Projects-Assembly-Binary
1
247393
<gh_stars>1-10 .ORIG x4300 .STRINGZ "ANN" .END
test/sas/scc-self.asm
mras0/scc
87
22554
<filename>test/sas/scc-self.asm cpu 8086 org 0x100 Start: XOR BP, BP MOV WORD [_HeapStart], ProgramEnd MOV AX, 0x81 PUSH AX MOV AL, [0x80] PUSH AX PUSH AX JMP _CallMain _DosCall: PUSH BP MOV BP, SP MOV BX, [BP+4] MOV AX, [BX] MOV BX, [BP+6] MOV CX, [BP+8] MOV DX, [BP+10] INT 0x21 MOV BX, [BP+4] MOV [BX], AX MOV AX, 0 SBB AX, AX POP BP RET _OutFile: DW 0 _LineBuf: DW 0 _TempBuf: DW 0 _InFile: DW 0 _InBuf: DW 0 _InBufCnt: DW 0 _InBufSize: DW 0 _UngottenChar: DW 0 _Line: DW 1 _TokenType: DW 0 _TokenNumVal: DW 0 _IdBuffer: DW 0 _IdBufferIndex: DW 0 _IdOffset: DW 0 _IdCount: DW 0 _VarDeclId: DW 0 _VarDeclType: DW 0 _VarDeclOffset: DW 0 _Scopes: DW 0 _ScopesCount: DW 0 _LocalOffset: DW 0 _LocalLabelCounter: DW 0 _ReturnLabel: DW 0 _BCStackLevel: DW 0 _BreakLabel: DW 0 _ContinueLabel: DW 0 _CurrentType: DW 0 _CurrentVal: DW 0 _ReturnUsed: DW 0 _PendingPushAx: DW 0 _IsDeadCode: DW 0 _IsDigit: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 48 JNL .L1 MOV AX, 0 JMP .L2 .L1: MOV AX, [BP+4] CMP AX, 57 MOV AX, 1 JNG .L3 DEC AL .L3: .L2: JMP .L0 .L0: POP BP RET _IsAlpha: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 65 JNL .L1 MOV AX, 0 JMP .L2 .L1: MOV AX, [BP+4] CMP AX, 90 MOV AX, 1 JNG .L3 DEC AL .L3: .L2: AND AX, AX JZ .L4 JMP .L5 .L4: MOV AX, [BP+4] CMP AX, 97 JNL .L6 MOV AX, 0 JMP .L7 .L6: MOV AX, [BP+4] CMP AX, 122 MOV AX, 1 JNG .L8 DEC AL .L8: .L7: .L5: JMP .L0 .L0: POP BP RET _PutStr: PUSH BP MOV BP, SP .L1: MOV AX, [BP+4] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L2 JMP .L3 .L2: ADD SP, -8 MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX MOV BX, AX MOV AL, [BX] CBW MOV [BP-8], AX CALL _putchar ADD SP, 8 JMP .L1 .L3: .L0: POP BP RET _CopyStr: PUSH BP MOV BP, SP .L1: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX PUSH AX MOV AX, [BP+6] PUSH AX INC AX MOV [BP+6], AX POP AX MOV BX, AX MOV AL, [BX] CBW POP BX MOV [BX], AL JMP .L1 .L3: MOV AX, [BP+4] JMP .L0 .L0: POP BP RET _StrLen: PUSH BP MOV BP, SP MOV AX, 0 PUSH AX ; [BP-2] = l .L1: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AX, [BP-2] INC AX MOV [BP-2], AX JMP .L1 .L3: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _OutputStr: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [_OutFile] MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX ADD SP, -8 MOV AX, [BP+4] MOV [BP-16], AX CALL _StrLen ADD SP, 8 MOV [BP-4], AX CALL _write ADD SP, 8 .L0: POP BP RET _VSPrintf: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch .L1: MOV AX, [BP+6] PUSH AX INC AX MOV [BP+6], AX POP AX MOV BX, AX MOV AL, [BX] CBW MOV [BP-2], AL AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AL, [BP-2] CBW CMP AX, 37 JNZ .L4 JMP .L5 .L4: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX PUSH AX MOV AL, [BP-2] CBW POP BX MOV [BX], AL JMP .L1 .L5: .L6: MOV AX, [BP+6] PUSH AX INC AX MOV [BP+6], AX POP AX MOV BX, AX MOV AL, [BX] CBW MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 115 JZ .L7 JMP .L8 .L7: ADD SP, -8 MOV AX, [BP+4] MOV [BP-10], AX MOV AX, [BP+8] ADD AX, 2 MOV [BP+8], AX MOV BX, AX MOV AX, [BX] MOV [BP-8], AX CALL _CopyStr ADD SP, 8 MOV [BP+4], AX JMP .L9 .L8: MOV AL, [BP-2] CBW CMP AX, 99 JZ .L10 JMP .L11 .L10: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX PUSH AX MOV AX, [BP+8] ADD AX, 2 MOV [BP+8], AX MOV BX, AX MOV AX, [BX] POP BX MOV [BX], AL JMP .L12 .L11: MOV AL, [BP-2] CBW CMP AX, 43 JZ .L16 MOV AX, 0 JMP .L17 .L16: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW CMP AX, 100 MOV AX, 1 JZ .L18 DEC AL .L18: .L17: AND AX, AX JZ .L19 JMP .L20 .L19: MOV AL, [BP-2] CBW CMP AX, 100 MOV AX, 1 JZ .L21 DEC AL .L21: .L20: AND AX, AX JNZ .L13 JMP .L14 .L13: PUSH AX ; [BP-4] = buf PUSH AX ; [BP-6] = n PUSH AX ; [BP-8] = s PUSH AX ; [BP-10] = always MOV AL, [BP-2] CBW CMP AX, 43 JZ .L22 JMP .L23 .L22: MOV AX, [BP+6] INC AX MOV [BP+6], AX MOV WORD [BP-10], 1 JMP .L24 .L23: MOV WORD [BP-10], 0 .L24: MOV AX, [BP+8] ADD AX, 2 MOV [BP+8], AX MOV BX, AX MOV AX, [BX] MOV [BP-6], AX MOV WORD [BP-8], 0 MOV AX, [BP-6] CMP AX, 0 JL .L25 JMP .L26 .L25: MOV WORD [BP-8], 1 MOV AX, [BP-6] NEG AX MOV [BP-6], AX JMP .L27 .L26: .L27: MOV AX, [_TempBuf] ADD AX, 32 MOV [BP-4], AX MOV AX, [BP-4] DEC AX MOV [BP-4], AX MOV BX, AX MOV BYTE [BX], 0 .L28: JMP .L29 .L29: MOV AX, [BP-4] DEC AX MOV [BP-4], AX PUSH AX MOV AX, [BP-6] MOV CX, 10 CWD IDIV CX MOV AX, DX ADD AX, 48 POP BX MOV [BX], AL MOV AX, [BP-6] MOV CX, 10 CWD IDIV CX MOV [BP-6], AX MOV AX, [BP-6] AND AX, AX JZ .L31 JMP .L32 .L31: JMP .L30 .L32: .L33: JMP .L28 .L30: MOV AX, [BP-8] AND AX, AX JNZ .L35 JMP .L36 .L35: MOV AX, [BP-4] DEC AX MOV [BP-4], AX MOV BX, AX MOV BYTE [BX], 45 JMP .L37 .L36: MOV AX, [BP-10] AND AX, AX JNZ .L38 JMP .L39 .L38: MOV AX, [BP-4] DEC AX MOV [BP-4], AX MOV BX, AX MOV BYTE [BX], 43 JMP .L40 .L39: .L40: .L37: ADD SP, -8 MOV AX, [BP+4] MOV [BP-18], AX MOV AX, [BP-4] MOV [BP-16], AX CALL _CopyStr ADD SP, 8 MOV [BP+4], AX ADD SP, 8 JMP .L15 .L14: JMP .L42 .L41: DB 'Invalid format string', 0 .L42: ADD SP, -8 MOV AX, .L41 MOV [BP-10], AX CALL _PutStr ADD SP, 8 ADD SP, -8 MOV WORD [BP-10], 1 CALL _exit ADD SP, 8 .L15: .L12: .L9: JMP .L1 .L3: MOV AX, [BP+4] MOV BX, AX MOV BYTE [BX], 0 MOV AX, [BP+4] JMP .L0 .L0: MOV SP, BP POP BP RET _Printf: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = vl LEA AX, [BP+4] MOV [BP-2], AX ADD SP, -8 MOV AX, [_LineBuf] MOV [BP-10], AX MOV AX, [BP+4] MOV [BP-8], AX MOV AX, [BP-2] MOV [BP-6], AX CALL _VSPrintf ADD SP, 8 ADD SP, -8 MOV AX, [_LineBuf] MOV [BP-10], AX CALL _PutStr ADD SP, 8 ADD SP, 2 .L0: POP BP RET _StrEqual: PUSH BP MOV BP, SP .L1: MOV AX, [BP+4] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L4 JMP .L5 .L4: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW .L5: AND AX, AX JNZ .L6 JMP .L7 .L6: MOV AX, [BP+4] MOV BX, AX MOV AL, [BX] CBW PUSH AX MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW POP CX XCHG AX, CX CMP AX, CX MOV AX, 1 JZ .L8 DEC AL .L8: .L7: AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AX, [BP+4] INC AX MOV [BP+4], AX MOV AX, [BP+6] INC AX MOV [BP+6], AX JMP .L1 .L3: MOV AX, [BP+4] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JZ .L10 MOV AX, 0 JMP .L11 .L10: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX MOV AX, 1 JZ .L13 DEC AL .L13: .L11: JMP .L0 .L0: POP BP RET _Fatal: PUSH BP MOV BP, SP JMP .L2 .L1: DB 'In line %d: %s', 10, 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX MOV AX, [_Line] MOV [BP-6], AX MOV AX, [BP+4] MOV [BP-4], AX CALL _Printf ADD SP, 8 ADD SP, -8 MOV WORD [BP-8], 1 CALL _exit ADD SP, 8 .L0: POP BP RET _Check: PUSH BP MOV BP, SP MOV AX, [BP+4] AND AX, AX JZ .L1 JMP .L2 .L1: JMP .L6 .L5: DB 'Check failed', 0 .L6: ADD SP, -8 MOV AX, .L5 MOV [BP-8], AX CALL _Fatal ADD SP, 8 JMP .L3 .L2: .L3: .L0: POP BP RET _IdText: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [BP+4] CMP AX, 0 JNL .L1 MOV AX, 0 JMP .L2 .L1: MOV AX, [BP+4] PUSH AX MOV AX, [_IdCount] POP CX XCHG AX, CX CMP AX, CX MOV AX, 1 JL .L3 DEC AL .L3: .L2: MOV [BP-8], AX CALL _Check ADD SP, 8 MOV AX, [_IdBuffer] PUSH AX MOV AX, [_IdOffset] PUSH AX MOV AX, [BP+4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] POP CX ADD AX, CX JMP .L0 .L0: POP BP RET _RawEmit: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [_PendingPushAx] AND AX, AX MOV AX, 1 JZ .L2 DEC AL .L2: MOV [BP-8], AX CALL _Check ADD SP, 8 PUSH AX ; [BP-2] = vl LEA AX, [BP+4] MOV [BP-2], AX ADD SP, -8 MOV AX, [_LineBuf] MOV [BP-10], AX MOV AX, [BP+4] MOV [BP-8], AX MOV AX, [BP-2] MOV [BP-6], AX CALL _VSPrintf ADD SP, 8 ADD SP, -8 MOV AX, [_LineBuf] MOV [BP-10], AX CALL _OutputStr ADD SP, 8 ADD SP, 2 .L0: POP BP RET _Emit: PUSH BP MOV BP, SP MOV AX, [_IsDeadCode] AND AX, AX JNZ .L1 JMP .L2 .L1: JMP .L0 .L2: .L3: MOV AX, [_PendingPushAx] AND AX, AX JNZ .L4 JMP .L5 .L4: JMP .L8 .L7: DB 9, 'PUSH', 9, 'AX', 10, 0 .L8: ADD SP, -8 MOV AX, .L7 MOV [BP-8], AX CALL _OutputStr ADD SP, 8 MOV WORD [_PendingPushAx], 0 JMP .L6 .L5: .L6: PUSH AX ; [BP-2] = vl PUSH AX ; [BP-4] = dest MOV AX, [_LineBuf] MOV [BP-4], AX MOV AX, [BP-4] PUSH AX INC AX MOV [BP-4], AX POP AX MOV BX, AX MOV BYTE [BX], 9 LEA AX, [BP+4] MOV [BP-2], AX ADD SP, -8 MOV AX, [BP-4] MOV [BP-12], AX MOV AX, [BP+4] MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX CALL _VSPrintf ADD SP, 8 MOV [BP-4], AX MOV AX, [BP-4] PUSH AX INC AX MOV [BP-4], AX POP AX MOV BX, AX MOV BYTE [BX], 10 MOV AX, [BP-4] PUSH AX INC AX MOV [BP-4], AX POP AX MOV BX, AX MOV BYTE [BX], 0 ADD SP, -8 MOV AX, [_LineBuf] MOV [BP-12], AX CALL _OutputStr ADD SP, 8 ADD SP, 4 .L0: POP BP RET _EmitLocalLabel: PUSH BP MOV BP, SP JMP .L2 .L1: DB '.L%d:', 10, 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _RawEmit ADD SP, 8 MOV WORD [_IsDeadCode], 0 .L0: POP BP RET _EmitGlobalLabel: PUSH BP MOV BP, SP JMP .L2 .L1: DB '_%s:', 10, 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX ADD SP, -8 MOV AX, [BP+4] MOV [BP-16], AX CALL _IdText ADD SP, 8 MOV [BP-6], AX CALL _RawEmit ADD SP, 8 MOV WORD [_IsDeadCode], 0 .L0: POP BP RET _EmitJmp: PUSH BP MOV BP, SP MOV WORD [_PendingPushAx], 0 MOV AX, [_IsDeadCode] AND AX, AX JNZ .L1 JMP .L2 .L1: JMP .L0 .L2: .L3: JMP .L5 .L4: DB 'JMP', 9, '.L%d', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Emit ADD SP, 8 MOV WORD [_IsDeadCode], 1 .L0: POP BP RET _EmitLoadAx: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 1 JZ .L1 JMP .L2 .L1: MOV WORD [BP+4], 76 JMP .L3 .L2: MOV WORD [BP+4], 88 .L3: MOV AX, [BP+6] CMP AX, 128 JZ .L4 JMP .L5 .L4: JMP .L8 .L7: DB 'MOV', 9, 'A%c, [BP%+d]', 0 .L8: ADD SP, -8 MOV AX, .L7 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX MOV AX, [BP+8] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L6 .L5: MOV AX, [BP+6] CMP AX, 192 JZ .L9 JMP .L10 .L9: JMP .L13 .L12: DB 'MOV', 9, 'A%c, [_%s]', 0 .L13: ADD SP, -8 MOV AX, .L12 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX ADD SP, -8 MOV AX, [BP+8] MOV [BP-16], AX CALL _IdText ADD SP, 8 MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L11 .L10: JMP .L15 .L14: DB 'MOV', 9, 'A%c, [BX]', 0 .L15: ADD SP, -8 MOV AX, .L14 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L11: .L6: MOV AX, [BP+4] CMP AX, 76 JZ .L16 JMP .L17 .L16: JMP .L20 .L19: DB 'CBW', 0 .L20: ADD SP, -8 MOV AX, .L19 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L18 .L17: .L18: .L0: POP BP RET _EmitStoreAx: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 1 JZ .L1 JMP .L2 .L1: MOV WORD [BP+4], 76 JMP .L3 .L2: MOV WORD [BP+4], 88 .L3: MOV AX, [BP+6] CMP AX, 128 JZ .L4 JMP .L5 .L4: JMP .L8 .L7: DB 'MOV', 9, '[BP%+d], A%c', 0 .L8: ADD SP, -8 MOV AX, .L7 MOV [BP-8], AX MOV AX, [BP+8] MOV [BP-6], AX MOV AX, [BP+4] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L6 .L5: MOV AX, [BP+6] CMP AX, 192 JZ .L9 JMP .L10 .L9: JMP .L13 .L12: DB 'MOV', 9, '[_%s], A%c', 0 .L13: ADD SP, -8 MOV AX, .L12 MOV [BP-8], AX ADD SP, -8 MOV AX, [BP+8] MOV [BP-16], AX CALL _IdText ADD SP, 8 MOV [BP-6], AX MOV AX, [BP+4] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L11 .L10: ADD SP, -8 MOV AX, [BP+6] AND AX, AX MOV AX, 1 JZ .L15 DEC AL .L15: MOV [BP-8], AX CALL _Check ADD SP, 8 JMP .L17 .L16: DB 'MOV', 9, '[BX], A%c', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L11: .L6: .L0: POP BP RET _EmitStoreConst: PUSH BP MOV BP, SP JMP .L2 .L1: DB 'WORD', 0 .L2: MOV AX, .L1 PUSH AX ; [BP-2] = SizeText MOV AX, [BP+4] CMP AX, 1 JZ .L3 JMP .L4 .L3: JMP .L7 .L6: DB 'BYTE', 0 .L7: MOV AX, .L6 MOV [BP-2], AX JMP .L5 .L4: .L5: MOV AX, [BP+6] CMP AX, 128 JZ .L8 JMP .L9 .L8: JMP .L12 .L11: DB 'MOV', 9, '%s [BP%+d], %d', 0 .L12: ADD SP, -8 MOV AX, .L11 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX MOV AX, [BP+8] MOV [BP-6], AX MOV AX, [_CurrentVal] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L10 .L9: MOV AX, [BP+6] CMP AX, 192 JZ .L13 JMP .L14 .L13: JMP .L17 .L16: DB 'MOV', 9, '%s [_%s], %d', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX ADD SP, -8 MOV AX, [BP+8] MOV [BP-18], AX CALL _IdText ADD SP, 8 MOV [BP-6], AX MOV AX, [_CurrentVal] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L15 .L14: ADD SP, -8 MOV AX, [BP+6] AND AX, AX MOV AX, 1 JZ .L19 DEC AL .L19: MOV [BP-10], AX CALL _Check ADD SP, 8 JMP .L21 .L20: DB 'MOV', 9, '%s [BX], %d', 0 .L21: ADD SP, -8 MOV AX, .L20 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX MOV AX, [_CurrentVal] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L15: .L10: ADD SP, 2 .L0: POP BP RET _EmitAdjSp: PUSH BP MOV BP, SP JMP .L2 .L1: DB 'ADD', 9, 'SP, %d', 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L0: POP BP RET _GetChar: PUSH BP MOV BP, SP MOV AL, [_UngottenChar] CBW AND AX, AX JNZ .L1 JMP .L2 .L1: PUSH AX ; [BP-2] = ch MOV AL, [_UngottenChar] CBW MOV [BP-2], AL MOV BYTE [_UngottenChar], 0 MOV AL, [BP-2] CBW JMP .L0 .L2: .L3: MOV AX, [_InBufCnt] PUSH AX MOV AX, [_InBufSize] POP CX XCHG AX, CX CMP AX, CX JZ .L4 JMP .L5 .L4: MOV WORD [_InBufCnt], 0 ADD SP, -8 MOV AX, [_InFile] MOV [BP-8], AX MOV AX, [_InBuf] MOV [BP-6], AX MOV WORD [BP-4], 1024 CALL _read ADD SP, 8 MOV [_InBufSize], AX MOV AX, [_InBufSize] AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, 0 JMP .L0 .L8: .L9: JMP .L6 .L5: .L6: MOV AX, [_InBuf] PUSH AX MOV AX, [_InBufCnt] PUSH AX INC AX MOV [_InBufCnt], AX POP AX POP CX ADD AX, CX MOV BX, AX MOV AL, [BX] CBW JMP .L0 .L0: MOV SP, BP POP BP RET _UnGetChar: PUSH BP MOV BP, SP MOV AL, [BP+4] CBW MOV [_UngottenChar], AL .L0: POP BP RET _TryGetChar: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch2 CALL _GetChar MOV [BP-2], AL PUSH AX MOV AL, [BP+4] CBW POP CX CMP AX, CX JNZ .L1 JMP .L2 .L1: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-10], AX CALL _UnGetChar ADD SP, 8 MOV AX, 0 JMP .L0 .L2: .L3: MOV AX, 1 JMP .L0 .L0: MOV SP, BP POP BP RET _SkipLine: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch .L1: CALL _GetChar MOV [BP-2], AX CMP AX, 10 JNZ .L4 MOV AX, 0 JMP .L5 .L4: MOV AX, [BP-2] .L5: AND AX, AX JNZ .L2 JMP .L3 .L2: JMP .L1 .L3: MOV AX, [_Line] INC AX MOV [_Line], AX ADD SP, 2 .L0: POP BP RET _SkipWhitespace: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch .L1: CALL _GetChar MOV [BP-2], AL CMP AX, 32 JNG .L2 JMP .L3 .L2: MOV AL, [BP-2] CBW AND AX, AX JZ .L4 JMP .L5 .L4: JMP .L0 .L5: .L6: MOV AL, [BP-2] CBW CMP AX, 10 JZ .L8 JMP .L9 .L8: MOV AX, [_Line] INC AX MOV [_Line], AX JMP .L10 .L9: .L10: JMP .L1 .L3: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-10], AX CALL _UnGetChar ADD SP, 8 ADD SP, 2 .L0: MOV SP, BP POP BP RET _Unescape: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch CALL _GetChar MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 110 JZ .L1 JMP .L2 .L1: MOV AX, 10 JMP .L0 .L2: MOV AL, [BP-2] CBW CMP AX, 114 JZ .L4 JMP .L5 .L4: MOV AX, 13 JMP .L0 .L5: MOV AL, [BP-2] CBW CMP AX, 116 JZ .L7 JMP .L8 .L7: MOV AX, 9 JMP .L0 .L8: MOV AL, [BP-2] CBW CMP AX, 39 JZ .L10 JMP .L11 .L10: MOV AX, 39 JMP .L0 .L11: MOV AL, [BP-2] CBW CMP AX, 34 JZ .L13 JMP .L14 .L13: MOV AX, 34 JMP .L0 .L14: MOV AL, [BP-2] CBW CMP AX, 92 JZ .L16 JMP .L17 .L16: MOV AX, 92 JMP .L0 .L17: JMP .L20 .L19: DB 'TODO: Escaped character literal \%c', 10, 0 .L20: ADD SP, -8 MOV AX, .L19 MOV [BP-10], AX MOV AL, [BP-2] CBW MOV [BP-8], AX CALL _Printf ADD SP, 8 JMP .L22 .L21: DB 'Unsupported character literal', 0 .L22: ADD SP, -8 MOV AX, .L21 MOV [BP-10], AX CALL _Fatal ADD SP, 8 .L18: .L15: .L12: .L9: .L6: .L3: ADD SP, 2 .L0: MOV SP, BP POP BP RET _GetStringLiteral: PUSH BP MOV BP, SP MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [_TokenNumVal], AX MOV AX, [_IsDeadCode] PUSH AX ; [BP-2] = WasDeadCode MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-4] = JL ADD SP, -8 MOV AX, [BP-4] MOV [BP-12], AX CALL _EmitJmp ADD SP, 8 JMP .L2 .L1: DB '.L%d:', 9, 'DB ', 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-12], AX MOV AX, [_TokenNumVal] MOV [BP-10], AX CALL _RawEmit ADD SP, 8 MOV AX, [BP-2] MOV [_IsDeadCode], AX PUSH AX ; [BP-6] = ch MOV AX, 0 PUSH AX ; [BP-8] = open .L3: JMP .L4 .L4: .L6: CALL _GetChar MOV [BP-6], AL CMP AX, 34 JNZ .L7 JMP .L8 .L7: MOV AL, [BP-6] CBW CMP AX, 92 JZ .L9 JMP .L10 .L9: CALL _Unescape MOV [BP-6], AL JMP .L11 .L10: .L11: MOV AL, [BP-6] CBW AND AX, AX JZ .L12 JMP .L13 .L12: JMP .L17 .L16: DB 'Unterminated string literal', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-16], AX CALL _Fatal ADD SP, 8 JMP .L14 .L13: .L14: MOV AL, [BP-6] CBW CMP AX, 32 JNL .L21 MOV AX, 1 JMP .L22 .L21: MOV AL, [BP-6] CBW CMP AX, 39 MOV AX, 1 JZ .L23 DEC AL .L23: .L22: AND AX, AX JNZ .L18 JMP .L19 .L18: MOV AX, [BP-8] AND AX, AX JNZ .L24 JMP .L25 .L24: JMP .L28 .L27: DB 39, ', ', 0 .L28: ADD SP, -8 MOV AX, .L27 MOV [BP-16], AX CALL _RawEmit ADD SP, 8 MOV WORD [BP-8], 0 JMP .L26 .L25: .L26: JMP .L30 .L29: DB '%d, ', 0 .L30: ADD SP, -8 MOV AX, .L29 MOV [BP-16], AX MOV AL, [BP-6] CBW MOV [BP-14], AX CALL _RawEmit ADD SP, 8 JMP .L20 .L19: MOV AX, [BP-8] AND AX, AX JZ .L31 JMP .L32 .L31: MOV WORD [BP-8], 1 JMP .L36 .L35: DB 39, 0 .L36: ADD SP, -8 MOV AX, .L35 MOV [BP-16], AX CALL _RawEmit ADD SP, 8 JMP .L33 .L32: .L33: JMP .L38 .L37: DB '%c', 0 .L38: ADD SP, -8 MOV AX, .L37 MOV [BP-16], AX MOV AL, [BP-6] CBW MOV [BP-14], AX CALL _RawEmit ADD SP, 8 .L20: JMP .L6 .L8: CALL _SkipWhitespace CALL _GetChar MOV [BP-6], AL MOV AL, [BP-6] CBW CMP AX, 34 JNZ .L39 JMP .L40 .L39: ADD SP, -8 MOV AL, [BP-6] CBW MOV [BP-16], AX CALL _UnGetChar ADD SP, 8 JMP .L5 .L40: .L41: JMP .L3 .L5: MOV AX, [BP-8] AND AX, AX JNZ .L42 JMP .L43 .L42: JMP .L46 .L45: DB 39, ', ', 0 .L46: ADD SP, -8 MOV AX, .L45 MOV [BP-16], AX CALL _RawEmit ADD SP, 8 JMP .L44 .L43: .L44: JMP .L48 .L47: DB '0', 10, 0 .L48: ADD SP, -8 MOV AX, .L47 MOV [BP-16], AX CALL _RawEmit ADD SP, 8 JMP .L50 .L49: DB '.L%d:', 10, 0 .L50: ADD SP, -8 MOV AX, .L49 MOV [BP-16], AX MOV AX, [BP-4] MOV [BP-14], AX CALL _RawEmit ADD SP, 8 ADD SP, 8 .L0: POP BP RET _GetToken: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch CALL _SkipWhitespace CALL _GetChar MOV [BP-2], AL MOV AL, [BP-2] CBW AND AX, AX JZ .L1 JMP .L2 .L1: MOV WORD [_TokenType], 0 JMP .L0 .L2: .L3: MOV AL, [BP-2] CBW CMP AX, 35 JZ .L5 JMP .L6 .L5: CALL _SkipLine CALL _GetToken JMP .L0 .L6: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-10], AX CALL _IsDigit ADD SP, 8 AND AX, AX JNZ .L8 JMP .L9 .L8: MOV WORD [_TokenNumVal], 0 MOV AX, 10 PUSH AX ; [BP-4] = base MOV AL, [BP-2] CBW CMP AX, 48 JZ .L11 JMP .L12 .L11: MOV WORD [BP-4], 8 CALL _GetChar MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 120 JNZ .L17 MOV AX, 1 JMP .L18 .L17: MOV AL, [BP-2] CBW CMP AX, 88 MOV AX, 1 JZ .L19 DEC AL .L19: .L18: AND AX, AX JNZ .L14 JMP .L15 .L14: MOV WORD [BP-4], 16 CALL _GetChar MOV [BP-2], AL JMP .L16 .L15: .L16: JMP .L13 .L12: .L13: .L20: JMP .L21 .L21: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-12], AX CALL _IsDigit ADD SP, 8 AND AX, AX JNZ .L23 JMP .L24 .L23: MOV AX, [BP-2] SUB AX, 48 MOV [BP-2], AL JMP .L25 .L24: MOV AL, [BP-2] CBW CMP AX, 65 JNL .L29 MOV AX, 0 JMP .L30 .L29: MOV AL, [BP-2] CBW CMP AX, 70 MOV AX, 1 JNG .L31 DEC AL .L31: .L30: AND AX, AX JNZ .L26 JMP .L27 .L26: MOV AX, [BP-2] SUB AX, 55 MOV [BP-2], AL JMP .L28 .L27: MOV AL, [BP-2] CBW CMP AX, 97 JNL .L35 MOV AX, 0 JMP .L36 .L35: MOV AL, [BP-2] CBW CMP AX, 102 MOV AX, 1 JNG .L37 DEC AL .L37: .L36: AND AX, AX JNZ .L32 JMP .L33 .L32: MOV AX, [BP-2] SUB AX, 87 MOV [BP-2], AL JMP .L34 .L33: .L34: .L28: .L25: MOV AL, [BP-2] CBW CMP AX, 0 JNL .L41 MOV AX, 1 JMP .L42 .L41: MOV AL, [BP-2] CBW PUSH AX MOV AX, [BP-4] POP CX XCHG AX, CX CMP AX, CX MOV AX, 1 JNL .L43 DEC AL .L43: .L42: AND AX, AX JNZ .L38 JMP .L39 .L38: JMP .L22 .L39: .L40: MOV AX, [_TokenNumVal] PUSH AX MOV AX, [BP-4] POP CX IMUL CX PUSH AX MOV AL, [BP-2] CBW POP CX ADD AX, CX MOV [_TokenNumVal], AX CALL _GetChar MOV [BP-2], AL JMP .L20 .L22: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-12], AX CALL _UnGetChar ADD SP, 8 MOV WORD [_TokenType], 1 ADD SP, 2 JMP .L10 .L9: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-10], AX CALL _IsAlpha ADD SP, 8 AND AX, AX JZ .L47 JMP .L48 .L47: MOV AL, [BP-2] CBW CMP AX, 95 MOV AX, 1 JZ .L49 DEC AL .L49: .L48: AND AX, AX JNZ .L44 JMP .L45 .L44: PUSH AX ; [BP-4] = id PUSH AX ; [BP-6] = pc PUSH AX ; [BP-8] = start MOV AX, [_IdBuffer] PUSH AX MOV AX, [_IdBufferIndex] POP CX ADD AX, CX MOV [BP-6], AX MOV [BP-8], AX MOV AX, [BP-6] PUSH AX INC AX MOV [BP-6], AX POP AX PUSH AX MOV AL, [BP-2] CBW POP BX MOV [BX], AL .L50: JMP .L51 .L51: CALL _GetChar MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 95 JNZ .L56 MOV AX, 0 JMP .L57 .L56: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-16], AX CALL _IsDigit ADD SP, 8 AND AX, AX MOV AX, 1 JZ .L59 DEC AL .L59: .L57: AND AX, AX JNZ .L60 JMP .L61 .L60: ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-16], AX CALL _IsAlpha ADD SP, 8 AND AX, AX MOV AX, 1 JZ .L63 DEC AL .L63: .L61: AND AX, AX JNZ .L53 JMP .L54 .L53: JMP .L52 .L54: .L55: MOV AX, [BP-6] PUSH AX INC AX MOV [BP-6], AX POP AX PUSH AX MOV AL, [BP-2] CBW POP BX MOV [BX], AL JMP .L50 .L52: MOV AX, [BP-6] PUSH AX INC AX MOV [BP-6], AX POP AX MOV BX, AX MOV BYTE [BX], 0 ADD SP, -8 MOV AL, [BP-2] CBW MOV [BP-16], AX CALL _UnGetChar ADD SP, 8 MOV WORD [_TokenType], -1 MOV WORD [BP-4], 0 .L64: MOV AX, [BP-4] PUSH AX MOV AX, [_IdCount] POP CX XCHG AX, CX CMP AX, CX JL .L65 JMP .L66 .L67: MOV AX, [BP-4] INC AX MOV [BP-4], AX JMP .L64 .L65: ADD SP, -8 ADD SP, -8 MOV AX, [BP-4] MOV [BP-24], AX CALL _IdText ADD SP, 8 MOV [BP-16], AX MOV AX, [BP-8] MOV [BP-14], AX CALL _StrEqual ADD SP, 8 AND AX, AX JNZ .L68 JMP .L69 .L68: MOV AX, [BP-4] MOV [_TokenType], AX JMP .L66 .L69: .L70: JMP .L67 .L66: MOV AX, [_TokenType] CMP AX, 0 JL .L71 JMP .L72 .L71: ADD SP, -8 MOV AX, [_IdCount] CMP AX, 350 MOV AX, 1 JL .L74 DEC AL .L74: MOV [BP-16], AX CALL _Check ADD SP, 8 MOV AX, [_IdCount] PUSH AX INC AX MOV [_IdCount], AX POP AX MOV [_TokenType], AX MOV AX, [_IdOffset] PUSH AX MOV AX, [_TokenType] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [_IdBufferIndex] POP BX MOV [BX], AX MOV AX, [BP-6] PUSH AX MOV AX, [BP-8] POP CX XCHG AX, CX SUB AX, CX MOV CX, AX MOV AX, [_IdBufferIndex] ADD AX, CX MOV [_IdBufferIndex], AX JMP .L73 .L72: .L73: MOV AX, [_TokenType] ADD AX, 46 MOV [_TokenType], AX ADD SP, 6 JMP .L46 .L45: MOV AL, [BP-2] CBW CMP AX, 39 JZ .L75 JMP .L76 .L75: CALL _GetChar MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 92 JZ .L78 JMP .L79 .L78: CALL _Unescape MOV [_TokenNumVal], AX JMP .L80 .L79: MOV AL, [BP-2] CBW MOV [_TokenNumVal], AX .L80: CALL _GetChar CMP AX, 39 JNZ .L81 JMP .L82 .L81: JMP .L85 .L84: DB 'Invalid character literal', 0 .L85: ADD SP, -8 MOV AX, .L84 MOV [BP-10], AX CALL _Fatal ADD SP, 8 JMP .L83 .L82: .L83: MOV WORD [_TokenType], 1 JMP .L77 .L76: MOV AL, [BP-2] CBW CMP AX, 34 JZ .L86 JMP .L87 .L86: CALL _GetStringLiteral MOV WORD [_TokenType], 2 JMP .L88 .L87: MOV AL, [BP-2] CBW CMP AX, 40 JZ .L89 JMP .L90 .L89: MOV WORD [_TokenType], 3 JMP .L91 .L90: MOV AL, [BP-2] CBW CMP AX, 41 JZ .L92 JMP .L93 .L92: MOV WORD [_TokenType], 4 JMP .L94 .L93: MOV AL, [BP-2] CBW CMP AX, 123 JZ .L95 JMP .L96 .L95: MOV WORD [_TokenType], 5 JMP .L97 .L96: MOV AL, [BP-2] CBW CMP AX, 125 JZ .L98 JMP .L99 .L98: MOV WORD [_TokenType], 6 JMP .L100 .L99: MOV AL, [BP-2] CBW CMP AX, 91 JZ .L101 JMP .L102 .L101: MOV WORD [_TokenType], 7 JMP .L103 .L102: MOV AL, [BP-2] CBW CMP AX, 93 JZ .L104 JMP .L105 .L104: MOV WORD [_TokenType], 8 JMP .L106 .L105: MOV AL, [BP-2] CBW CMP AX, 44 JZ .L107 JMP .L108 .L107: MOV WORD [_TokenType], 9 JMP .L109 .L108: MOV AL, [BP-2] CBW CMP AX, 59 JZ .L110 JMP .L111 .L110: MOV WORD [_TokenType], 10 JMP .L112 .L111: MOV AL, [BP-2] CBW CMP AX, 126 JZ .L113 JMP .L114 .L113: MOV WORD [_TokenType], 43 JMP .L115 .L114: MOV AL, [BP-2] CBW CMP AX, 61 JZ .L116 JMP .L117 .L116: MOV WORD [_TokenType], 11 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L119 JMP .L120 .L119: MOV WORD [_TokenType], 12 JMP .L121 .L120: .L121: JMP .L118 .L117: MOV AL, [BP-2] CBW CMP AX, 33 JZ .L122 JMP .L123 .L122: MOV WORD [_TokenType], 13 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L125 JMP .L126 .L125: MOV WORD [_TokenType], 14 JMP .L127 .L126: .L127: JMP .L124 .L123: MOV AL, [BP-2] CBW CMP AX, 60 JZ .L128 JMP .L129 .L128: MOV WORD [_TokenType], 15 ADD SP, -8 MOV WORD [BP-10], 60 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L131 JMP .L132 .L131: MOV WORD [_TokenType], 31 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L134 JMP .L135 .L134: MOV WORD [_TokenType], 38 JMP .L136 .L135: .L136: JMP .L133 .L132: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L137 JMP .L138 .L137: MOV WORD [_TokenType], 16 JMP .L139 .L138: .L139: .L133: JMP .L130 .L129: MOV AL, [BP-2] CBW CMP AX, 62 JZ .L140 JMP .L141 .L140: MOV WORD [_TokenType], 17 ADD SP, -8 MOV WORD [BP-10], 62 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L143 JMP .L144 .L143: MOV WORD [_TokenType], 32 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L146 JMP .L147 .L146: MOV WORD [_TokenType], 39 JMP .L148 .L147: .L148: JMP .L145 .L144: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L149 JMP .L150 .L149: MOV WORD [_TokenType], 18 JMP .L151 .L150: .L151: .L145: JMP .L142 .L141: MOV AL, [BP-2] CBW CMP AX, 38 JZ .L152 JMP .L153 .L152: MOV WORD [_TokenType], 26 ADD SP, -8 MOV WORD [BP-10], 38 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L155 JMP .L156 .L155: MOV WORD [_TokenType], 29 JMP .L157 .L156: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L158 JMP .L159 .L158: MOV WORD [_TokenType], 40 JMP .L160 .L159: .L160: .L157: JMP .L154 .L153: MOV AL, [BP-2] CBW CMP AX, 124 JZ .L161 JMP .L162 .L161: MOV WORD [_TokenType], 28 ADD SP, -8 MOV WORD [BP-10], 124 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L164 JMP .L165 .L164: MOV WORD [_TokenType], 30 JMP .L166 .L165: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L167 JMP .L168 .L167: MOV WORD [_TokenType], 42 JMP .L169 .L168: .L169: .L166: JMP .L163 .L162: MOV AL, [BP-2] CBW CMP AX, 94 JZ .L170 JMP .L171 .L170: MOV WORD [_TokenType], 27 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L173 JMP .L174 .L173: MOV WORD [_TokenType], 41 JMP .L175 .L174: .L175: JMP .L172 .L171: MOV AL, [BP-2] CBW CMP AX, 43 JZ .L176 JMP .L177 .L176: MOV WORD [_TokenType], 19 ADD SP, -8 MOV WORD [BP-10], 43 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L179 JMP .L180 .L179: MOV WORD [_TokenType], 20 JMP .L181 .L180: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L182 JMP .L183 .L182: MOV WORD [_TokenType], 33 JMP .L184 .L183: .L184: .L181: JMP .L178 .L177: MOV AL, [BP-2] CBW CMP AX, 45 JZ .L185 JMP .L186 .L185: MOV WORD [_TokenType], 21 ADD SP, -8 MOV WORD [BP-10], 45 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L188 JMP .L189 .L188: MOV WORD [_TokenType], 22 JMP .L190 .L189: ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L191 JMP .L192 .L191: MOV WORD [_TokenType], 34 JMP .L193 .L192: .L193: .L190: JMP .L187 .L186: MOV AL, [BP-2] CBW CMP AX, 42 JZ .L194 JMP .L195 .L194: MOV WORD [_TokenType], 23 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L197 JMP .L198 .L197: MOV WORD [_TokenType], 35 JMP .L199 .L198: .L199: JMP .L196 .L195: MOV AL, [BP-2] CBW CMP AX, 47 JZ .L200 JMP .L201 .L200: ADD SP, -8 MOV WORD [BP-10], 47 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L203 JMP .L204 .L203: CALL _SkipLine CALL _GetToken JMP .L0 .L204: .L205: MOV WORD [_TokenType], 24 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L206 JMP .L207 .L206: MOV WORD [_TokenType], 36 JMP .L208 .L207: .L208: JMP .L202 .L201: MOV AL, [BP-2] CBW CMP AX, 37 JZ .L209 JMP .L210 .L209: MOV WORD [_TokenType], 25 ADD SP, -8 MOV WORD [BP-10], 61 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L212 JMP .L213 .L212: MOV WORD [_TokenType], 37 JMP .L214 .L213: .L214: JMP .L211 .L210: MOV AL, [BP-2] CBW CMP AX, 46 JZ .L215 JMP .L216 .L215: MOV WORD [_TokenType], 44 ADD SP, -8 MOV WORD [BP-10], 46 CALL _TryGetChar ADD SP, 8 AND AX, AX JNZ .L218 JMP .L219 .L218: ADD SP, -8 MOV WORD [BP-10], 46 CALL _TryGetChar ADD SP, 8 AND AX, AX JZ .L221 JMP .L222 .L221: JMP .L226 .L225: DB 'Invalid token ..', 0 .L226: ADD SP, -8 MOV AX, .L225 MOV [BP-10], AX CALL _Fatal ADD SP, 8 JMP .L223 .L222: .L223: MOV WORD [_TokenType], 45 JMP .L220 .L219: .L220: JMP .L217 .L216: JMP .L228 .L227: DB 'Unknown token start ', 39, '%c', 39, ' (%d)', 10, 0 .L228: ADD SP, -8 MOV AX, .L227 MOV [BP-10], AX MOV AL, [BP-2] CBW MOV [BP-8], AX MOV AL, [BP-2] CBW MOV [BP-6], AX CALL _Printf ADD SP, 8 JMP .L230 .L229: DB 'Unknown token encountered', 0 .L230: ADD SP, -8 MOV AX, .L229 MOV [BP-10], AX CALL _Fatal ADD SP, 8 .L217: .L211: .L202: .L196: .L187: .L178: .L172: .L163: .L154: .L142: .L130: .L124: .L118: .L115: .L112: .L109: .L106: .L103: .L100: .L97: .L94: .L91: .L88: .L77: .L46: .L10: .L7: ADD SP, 2 .L0: MOV SP, BP POP BP RET _OperatorPrecedence: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 23 JNZ .L4 MOV AX, 1 JMP .L5 .L4: MOV AX, [BP+4] CMP AX, 24 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [BP+4] CMP AX, 25 MOV AX, 1 JZ .L9 DEC AL .L9: .L8: AND AX, AX JNZ .L1 JMP .L2 .L1: MOV AX, 3 JMP .L0 .L2: MOV AX, [BP+4] CMP AX, 19 JNZ .L13 MOV AX, 1 JMP .L14 .L13: MOV AX, [BP+4] CMP AX, 21 MOV AX, 1 JZ .L15 DEC AL .L15: .L14: AND AX, AX JNZ .L10 JMP .L11 .L10: MOV AX, 4 JMP .L0 .L11: MOV AX, [BP+4] CMP AX, 31 JNZ .L19 MOV AX, 1 JMP .L20 .L19: MOV AX, [BP+4] CMP AX, 32 MOV AX, 1 JZ .L21 DEC AL .L21: .L20: AND AX, AX JNZ .L16 JMP .L17 .L16: MOV AX, 5 JMP .L0 .L17: MOV AX, [BP+4] CMP AX, 15 JNZ .L25 MOV AX, 1 JMP .L26 .L25: MOV AX, [BP+4] CMP AX, 16 MOV AX, 1 JZ .L27 DEC AL .L27: .L26: AND AX, AX JZ .L28 JMP .L29 .L28: MOV AX, [BP+4] CMP AX, 17 MOV AX, 1 JZ .L30 DEC AL .L30: .L29: AND AX, AX JZ .L31 JMP .L32 .L31: MOV AX, [BP+4] CMP AX, 18 MOV AX, 1 JZ .L33 DEC AL .L33: .L32: AND AX, AX JNZ .L22 JMP .L23 .L22: MOV AX, 6 JMP .L0 .L23: MOV AX, [BP+4] CMP AX, 12 JNZ .L37 MOV AX, 1 JMP .L38 .L37: MOV AX, [BP+4] CMP AX, 14 MOV AX, 1 JZ .L39 DEC AL .L39: .L38: AND AX, AX JNZ .L34 JMP .L35 .L34: MOV AX, 7 JMP .L0 .L35: MOV AX, [BP+4] CMP AX, 26 JZ .L40 JMP .L41 .L40: MOV AX, 8 JMP .L0 .L41: MOV AX, [BP+4] CMP AX, 27 JZ .L43 JMP .L44 .L43: MOV AX, 9 JMP .L0 .L44: MOV AX, [BP+4] CMP AX, 28 JZ .L46 JMP .L47 .L46: MOV AX, 10 JMP .L0 .L47: MOV AX, [BP+4] CMP AX, 29 JZ .L49 JMP .L50 .L49: MOV AX, 11 JMP .L0 .L50: MOV AX, [BP+4] CMP AX, 30 JZ .L52 JMP .L53 .L52: MOV AX, 12 JMP .L0 .L53: MOV AX, [BP+4] CMP AX, 11 JNZ .L58 MOV AX, 1 JMP .L59 .L58: MOV AX, [BP+4] CMP AX, 33 MOV AX, 1 JZ .L60 DEC AL .L60: .L59: AND AX, AX JZ .L61 JMP .L62 .L61: MOV AX, [BP+4] CMP AX, 34 MOV AX, 1 JZ .L63 DEC AL .L63: .L62: AND AX, AX JZ .L64 JMP .L65 .L64: MOV AX, [BP+4] CMP AX, 35 MOV AX, 1 JZ .L66 DEC AL .L66: .L65: AND AX, AX JZ .L67 JMP .L68 .L67: MOV AX, [BP+4] CMP AX, 36 MOV AX, 1 JZ .L69 DEC AL .L69: .L68: AND AX, AX JZ .L70 JMP .L71 .L70: MOV AX, [BP+4] CMP AX, 37 MOV AX, 1 JZ .L72 DEC AL .L72: .L71: AND AX, AX JZ .L73 JMP .L74 .L73: MOV AX, [BP+4] CMP AX, 38 MOV AX, 1 JZ .L75 DEC AL .L75: .L74: AND AX, AX JZ .L76 JMP .L77 .L76: MOV AX, [BP+4] CMP AX, 39 MOV AX, 1 JZ .L78 DEC AL .L78: .L77: AND AX, AX JZ .L79 JMP .L80 .L79: MOV AX, [BP+4] CMP AX, 40 MOV AX, 1 JZ .L81 DEC AL .L81: .L80: AND AX, AX JZ .L82 JMP .L83 .L82: MOV AX, [BP+4] CMP AX, 41 MOV AX, 1 JZ .L84 DEC AL .L84: .L83: AND AX, AX JZ .L85 JMP .L86 .L85: MOV AX, [BP+4] CMP AX, 42 MOV AX, 1 JZ .L87 DEC AL .L87: .L86: AND AX, AX JNZ .L55 JMP .L56 .L55: MOV AX, 14 JMP .L0 .L56: MOV AX, [BP+4] CMP AX, 9 JZ .L88 JMP .L89 .L88: MOV AX, 15 JMP .L0 .L89: MOV AX, 100 JMP .L0 .L90: .L57: .L54: .L51: .L48: .L45: .L42: .L36: .L24: .L18: .L12: .L3: .L0: POP BP RET _Unexpected: PUSH BP MOV BP, SP JMP .L2 .L1: DB 'token type %d', 10, 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX MOV AX, [_TokenType] MOV [BP-6], AX CALL _Printf ADD SP, 8 JMP .L4 .L3: DB 'Unexpected token', 0 .L4: ADD SP, -8 MOV AX, .L3 MOV [BP-8], AX CALL _Fatal ADD SP, 8 .L0: POP BP RET _Accept: PUSH BP MOV BP, SP MOV AX, [_TokenType] PUSH AX MOV AX, [BP+4] POP CX XCHG AX, CX CMP AX, CX JZ .L1 JMP .L2 .L1: CALL _GetToken MOV AX, 1 JMP .L0 .L2: .L3: MOV AX, 0 JMP .L0 .L0: POP BP RET _Expect: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _Accept ADD SP, 8 AND AX, AX JZ .L1 JMP .L2 .L1: JMP .L6 .L5: DB 'Token type %d expected got ', 0 .L6: ADD SP, -8 MOV AX, .L5 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Printf ADD SP, 8 CALL _Unexpected JMP .L3 .L2: .L3: .L0: POP BP RET _ExpectId: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = id MOV AX, [_TokenType] MOV [BP-2], AX MOV AX, [BP-2] CMP AX, 63 JNL .L1 JMP .L2 .L1: CALL _GetToken MOV AX, [BP-2] SUB AX, 46 JMP .L0 .L2: .L3: JMP .L5 .L4: DB 'Expected identifier got ', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-10], AX CALL _Printf ADD SP, 8 CALL _Unexpected ADD SP, 2 .L0: MOV SP, BP POP BP RET _IsTypeStart: PUSH BP MOV BP, SP MOV AX, [_TokenType] CMP AX, 48 JNZ .L1 MOV AX, 1 JMP .L2 .L1: MOV AX, [_TokenType] CMP AX, 57 MOV AX, 1 JZ .L3 DEC AL .L3: .L2: AND AX, AX JZ .L4 JMP .L5 .L4: MOV AX, [_TokenType] CMP AX, 47 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [_TokenType] CMP AX, 54 MOV AX, 1 JZ .L9 DEC AL .L9: .L8: AND AX, AX JZ .L10 JMP .L11 .L10: MOV AX, [_TokenType] CMP AX, 59 MOV AX, 1 JZ .L12 DEC AL .L12: .L11: JMP .L0 .L0: POP BP RET _LvalToRval: PUSH BP MOV BP, SP MOV AX, [_CurrentType] AND AX, 4 AND AX, AX JNZ .L1 JMP .L2 .L1: MOV AX, [_CurrentType] AND AX, 192 PUSH AX ; [BP-2] = loc MOV AX, [_CurrentType] AND AX, -197 MOV [_CurrentType], AX MOV AX, 2 PUSH AX ; [BP-4] = sz MOV AX, [_CurrentType] CMP AX, 2 JZ .L4 JMP .L5 .L4: MOV WORD [BP-4], 1 MOV WORD [_CurrentType], 3 JMP .L6 .L5: .L6: MOV AX, [BP-2] AND AX, AX JZ .L7 JMP .L8 .L7: JMP .L12 .L11: DB 'MOV', 9, 'BX, AX', 0 .L12: ADD SP, -8 MOV AX, .L11 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L9 .L8: .L9: ADD SP, -8 MOV AX, [BP-4] MOV [BP-12], AX MOV AX, [BP-2] MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _EmitLoadAx ADD SP, 8 ADD SP, 4 JMP .L3 .L2: .L3: .L0: POP BP RET _DoIncDec: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = Amm MOV AX, [_CurrentType] CMP AX, 2 JNZ .L4 MOV AX, 1 JMP .L5 .L4: MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [_CurrentType] CMP AX, 18 MOV AX, 1 JZ .L9 DEC AL .L9: .L8: AND AX, AX JNZ .L1 JMP .L2 .L1: MOV WORD [BP-2], 1 JMP .L3 .L2: MOV WORD [BP-2], 2 .L3: MOV AX, [BP+4] CMP AX, 20 JZ .L10 JMP .L11 .L10: MOV AX, [BP-2] CMP AX, 1 JZ .L13 JMP .L14 .L13: JMP .L17 .L16: DB 'INC', 9, 'AX', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-10], AX CALL _Emit ADD SP, 8 JMP .L15 .L14: JMP .L19 .L18: DB 'ADD', 9, 'AX, %d', 0 .L19: ADD SP, -8 MOV AX, .L18 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX CALL _Emit ADD SP, 8 .L15: JMP .L12 .L11: ADD SP, -8 MOV AX, [BP+4] CMP AX, 22 MOV AX, 1 JZ .L20 DEC AL .L20: MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [BP-2] CMP AX, 1 JZ .L21 JMP .L22 .L21: JMP .L25 .L24: DB 'DEC', 9, 'AX', 0 .L25: ADD SP, -8 MOV AX, .L24 MOV [BP-10], AX CALL _Emit ADD SP, 8 JMP .L23 .L22: JMP .L27 .L26: DB 'SUB', 9, 'AX, %d', 0 .L27: ADD SP, -8 MOV AX, .L26 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX CALL _Emit ADD SP, 8 .L23: .L12: ADD SP, 2 .L0: POP BP RET _DoIncDecOp: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [_CurrentType] AND AX, 4 MOV [BP-8], AX CALL _Check ADD SP, 8 MOV AX, [_CurrentType] AND AX, -5 MOV [_CurrentType], AX MOV AX, [_CurrentType] AND AX, 192 PUSH AX ; [BP-2] = loc MOV AX, [BP-2] AND AX, AX JNZ .L1 JMP .L2 .L1: MOV AX, [_CurrentType] AND AX, -193 MOV [_CurrentType], AX JMP .L3 .L2: JMP .L5 .L4: DB 'MOV', 9, 'BX, AX', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-10], AX CALL _Emit ADD SP, 8 .L3: MOV AX, 2 PUSH AX ; [BP-4] = Sz MOV AX, [_CurrentType] CMP AX, 2 JZ .L6 JMP .L7 .L6: MOV BYTE [BP-4], 1 JMP .L8 .L7: .L8: ADD SP, -8 MOV AL, [BP-4] CBW MOV [BP-12], AX MOV AX, [BP-2] MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _EmitLoadAx ADD SP, 8 MOV AX, [BP+6] AND AX, AX JNZ .L9 JMP .L10 .L9: JMP .L13 .L12: DB 'PUSH', 9, 'AX', 0 .L13: ADD SP, -8 MOV AX, .L12 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L11 .L10: .L11: ADD SP, -8 MOV AX, [BP+4] MOV [BP-12], AX CALL _DoIncDec ADD SP, 8 ADD SP, -8 MOV AL, [BP-4] CBW MOV [BP-12], AX MOV AX, [BP-2] MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _EmitStoreAx ADD SP, 8 MOV AL, [BP-4] CBW CMP AX, 1 JZ .L14 JMP .L15 .L14: MOV WORD [_CurrentType], 3 JMP .L16 .L15: .L16: MOV AX, [BP+6] AND AX, AX JNZ .L17 JMP .L18 .L17: JMP .L21 .L20: DB 'POP', 9, 'AX', 0 .L21: ADD SP, -8 MOV AX, .L20 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L19 .L18: .L19: ADD SP, 4 .L0: POP BP RET _Lookup: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = vd ADD SP, -8 MOV AX, [_ScopesCount] MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [_Scopes] PUSH AX MOV AX, [_ScopesCount] SUB AX, 1 ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-2], AX .L1: MOV AX, [BP-2] CMP AX, 0 JNL .L2 JMP .L3 .L4: MOV AX, [BP-2] PUSH AX DEC AX MOV [BP-2], AX POP AX JMP .L1 .L2: MOV AX, [_VarDeclId] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] PUSH AX MOV AX, [BP+4] POP CX XCHG AX, CX CMP AX, CX JZ .L5 JMP .L6 .L5: JMP .L3 .L6: .L7: JMP .L4 .L3: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _ParsePrimaryExpression: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = id PUSH AX ; [BP-4] = vd MOV AX, [_TokenType] CMP AX, 3 JZ .L1 JMP .L2 .L1: CALL _GetToken CALL _ParseExpr ADD SP, -8 MOV WORD [BP-12], 4 CALL _Expect ADD SP, 8 JMP .L3 .L2: MOV AX, [_TokenType] CMP AX, 1 JZ .L4 JMP .L5 .L4: MOV WORD [_CurrentType], 67 MOV AX, [_TokenNumVal] MOV [_CurrentVal], AX CALL _GetToken JMP .L6 .L5: MOV AX, [_TokenType] CMP AX, 2 JZ .L7 JMP .L8 .L7: JMP .L11 .L10: DB 'MOV', 9, 'AX, .L%d', 0 .L11: ADD SP, -8 MOV AX, .L10 MOV [BP-12], AX MOV AX, [_TokenNumVal] MOV [BP-10], AX CALL _Emit ADD SP, 8 MOV WORD [_CurrentType], 18 CALL _GetToken JMP .L9 .L8: MOV AX, [_TokenType] CMP AX, 60 JNZ .L15 MOV AX, 1 JMP .L16 .L15: MOV AX, [_TokenType] CMP AX, 61 MOV AX, 1 JZ .L17 DEC AL .L17: .L16: AND AX, AX JZ .L18 JMP .L19 .L18: MOV AX, [_TokenType] CMP AX, 62 MOV AX, 1 JZ .L20 DEC AL .L20: .L19: AND AX, AX JNZ .L12 JMP .L13 .L12: MOV AX, [_TokenType] PUSH AX ; [BP-6] = func CALL _GetToken ADD SP, -8 MOV WORD [BP-14], 3 CALL _Expect ADD SP, 8 CALL _ExpectId MOV [BP-2], AX ADD SP, -8 MOV AX, [BP-2] MOV [BP-14], AX CALL _Lookup ADD SP, 8 MOV [BP-4], AX MOV AX, [BP-4] CMP AX, 0 JNL .L24 MOV AX, 1 JMP .L25 .L24: MOV AX, [_VarDeclType] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] CMP AX, 18 MOV AX, 1 JNZ .L26 DEC AL .L26: .L25: AND AX, AX JNZ .L21 JMP .L22 .L21: JMP .L28 .L27: DB 'Invalid va_list', 0 .L28: ADD SP, -8 MOV AX, .L27 MOV [BP-14], AX CALL _Fatal ADD SP, 8 JMP .L23 .L22: .L23: MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] PUSH AX ; [BP-8] = offset MOV AX, [BP-6] CMP AX, 60 JZ .L29 JMP .L30 .L29: ADD SP, -8 MOV WORD [BP-16], 9 CALL _Expect ADD SP, 8 CALL _ExpectId MOV [BP-2], AX ADD SP, -8 MOV AX, [BP-2] MOV [BP-16], AX CALL _Lookup ADD SP, 8 MOV [BP-4], AX MOV AX, [BP-4] CMP AX, 0 JNL .L35 MOV AX, 1 JMP .L36 .L35: MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] AND AX, AX MOV AX, 1 JZ .L38 DEC AL .L38: .L36: AND AX, AX JNZ .L32 JMP .L33 .L32: JMP .L40 .L39: DB 'Invalid argument to va_start', 0 .L40: ADD SP, -8 MOV AX, .L39 MOV [BP-16], AX CALL _Fatal ADD SP, 8 JMP .L34 .L33: .L34: JMP .L42 .L41: DB 'LEA', 9, 'AX, [BP%+d]', 0 .L42: ADD SP, -8 MOV AX, .L41 MOV [BP-16], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-14], AX CALL _Emit ADD SP, 8 ADD SP, -8 MOV WORD [BP-16], 2 MOV WORD [BP-14], 128 MOV AX, [BP-8] MOV [BP-12], AX CALL _EmitStoreAx ADD SP, 8 MOV WORD [_CurrentType], 0 JMP .L31 .L30: MOV AX, [BP-6] CMP AX, 61 JZ .L43 JMP .L44 .L43: MOV WORD [_CurrentType], 0 JMP .L45 .L44: MOV AX, [BP-6] CMP AX, 62 JZ .L46 JMP .L47 .L46: ADD SP, -8 MOV WORD [BP-16], 9 CALL _Expect ADD SP, 8 ADD SP, -8 MOV WORD [BP-16], 2 MOV WORD [BP-14], 128 MOV AX, [BP-8] MOV [BP-12], AX CALL _EmitLoadAx ADD SP, 8 JMP .L50 .L49: DB 'ADD', 9, 'AX, 2', 0 .L50: ADD SP, -8 MOV AX, .L49 MOV [BP-16], AX CALL _Emit ADD SP, 8 ADD SP, -8 MOV WORD [BP-16], 2 MOV WORD [BP-14], 128 MOV AX, [BP-8] MOV [BP-12], AX CALL _EmitStoreAx ADD SP, 8 CALL _ParseDeclSpecs OR AX, 4 MOV [_CurrentType], AX JMP .L48 .L47: .L48: .L45: .L31: ADD SP, -8 MOV WORD [BP-16], 4 CALL _Expect ADD SP, 8 ADD SP, 4 JMP .L14 .L13: CALL _ExpectId MOV [BP-2], AX ADD SP, -8 MOV AX, [BP-2] MOV [BP-12], AX CALL _Lookup ADD SP, 8 MOV [BP-4], AX MOV AX, [BP-4] CMP AX, 0 JL .L51 JMP .L52 .L51: MOV WORD [_CurrentType], 75 MOV AX, [BP-2] MOV [_CurrentVal], AX JMP .L53 .L52: MOV AX, [_VarDeclType] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [_CurrentType], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [_CurrentVal], AX MOV AX, [_CurrentType] AND AX, 192 AND AX, AX JNZ .L54 JMP .L55 .L54: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L57 DEC AL .L57: MOV [BP-12], AX CALL _Check ADD SP, 8 JMP .L0 .L55: .L56: MOV AX, [_CurrentType] OR AX, 4 MOV [_CurrentType], AX MOV AX, [_CurrentVal] AND AX, AX JNZ .L58 JMP .L59 .L58: MOV AX, [_CurrentType] OR AX, 128 MOV [_CurrentType], AX JMP .L60 .L59: MOV AX, [BP-2] MOV [_CurrentVal], AX MOV AX, [_CurrentType] AND AX, 8 AND AX, AX JNZ .L61 JMP .L62 .L61: MOV AX, [_CurrentType] AND AX, -5 OR AX, 64 MOV [_CurrentType], AX JMP .L63 .L62: MOV AX, [_CurrentType] OR AX, 192 MOV [_CurrentType], AX .L63: .L60: .L53: .L14: .L9: .L6: .L3: ADD SP, 4 .L0: MOV SP, BP POP BP RET _GetJcc: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 4 JZ .L1 JMP .L2 .L1: JMP .L5 .L4: DB 'JZ', 0 .L5: MOV AX, .L4 JMP .L0 .L2: .L3: MOV AX, [BP+4] CMP AX, 5 JZ .L6 JMP .L7 .L6: JMP .L10 .L9: DB 'JNZ', 0 .L10: MOV AX, .L9 JMP .L0 .L7: .L8: MOV AX, [BP+4] CMP AX, 12 JZ .L11 JMP .L12 .L11: JMP .L15 .L14: DB 'JL', 0 .L15: MOV AX, .L14 JMP .L0 .L12: .L13: MOV AX, [BP+4] CMP AX, 13 JZ .L16 JMP .L17 .L16: JMP .L20 .L19: DB 'JNL', 0 .L20: MOV AX, .L19 JMP .L0 .L17: .L18: MOV AX, [BP+4] CMP AX, 14 JZ .L21 JMP .L22 .L21: JMP .L25 .L24: DB 'JNG', 0 .L25: MOV AX, .L24 JMP .L0 .L22: .L23: MOV AX, [BP+4] CMP AX, 15 JZ .L26 JMP .L27 .L26: JMP .L30 .L29: DB 'JG', 0 .L30: MOV AX, .L29 JMP .L0 .L27: .L28: JMP .L32 .L31: DB 'Not implemented', 0 .L32: ADD SP, -8 MOV AX, .L31 MOV [BP-8], AX CALL _Fatal ADD SP, 8 .L0: POP BP RET _GetVal: PUSH BP MOV BP, SP MOV AX, [_CurrentType] CMP AX, 1 JZ .L1 JMP .L2 .L1: PUSH AX ; [BP-2] = Lab MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [BP-2], AX JMP .L5 .L4: DB 'MOV', 9, 'AX, 1', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-10], AX CALL _Emit ADD SP, 8 JMP .L7 .L6: DB '%s', 9, '.L%d', 0 .L7: ADD SP, -8 MOV AX, .L6 MOV [BP-10], AX ADD SP, -8 MOV AX, [_CurrentVal] MOV [BP-18], AX CALL _GetJcc ADD SP, 8 MOV [BP-8], AX MOV AX, [BP-2] MOV [BP-6], AX CALL _Emit ADD SP, 8 JMP .L9 .L8: DB 'DEC', 9, 'AL', 0 .L9: ADD SP, -8 MOV AX, .L8 MOV [BP-10], AX CALL _Emit ADD SP, 8 ADD SP, -8 MOV AX, [BP-2] MOV [BP-10], AX CALL _EmitLocalLabel ADD SP, 8 MOV WORD [_CurrentType], 3 JMP .L0 .L2: .L3: MOV AX, [_CurrentType] AND AX, 192 PUSH AX ; [BP-2] = loc MOV AX, [BP-2] AND AX, AX JNZ .L10 JMP .L11 .L10: ADD SP, -8 MOV AX, [BP-2] CMP AX, 64 MOV AX, 1 JZ .L13 DEC AL .L13: MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [_CurrentType] AND AX, -193 MOV [_CurrentType], AX JMP .L15 .L14: DB 'MOV', 9, 'AX, %d', 0 .L15: ADD SP, -8 MOV AX, .L14 MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L12 .L11: .L12: ADD SP, 2 .L0: MOV SP, BP POP BP RET _ParsePostfixExpression: PUSH BP MOV BP, SP .L1: JMP .L2 .L2: ADD SP, -8 MOV WORD [BP-8], 3 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L4 JMP .L5 .L4: MOV AX, [_CurrentType] AND AX, 8 AND AX, AX JZ .L7 JMP .L8 .L7: JMP .L12 .L11: DB 'Not a function', 0 .L12: ADD SP, -8 MOV AX, .L11 MOV [BP-8], AX CALL _Fatal ADD SP, 8 JMP .L9 .L8: .L9: ADD SP, -8 MOV AX, [_CurrentType] AND AX, 192 CMP AX, 64 MOV AX, 1 JZ .L13 DEC AL .L13: MOV [BP-8], AX CALL _Check ADD SP, 8 MOV AX, [_CurrentVal] PUSH AX ; [BP-2] = FuncId MOV AX, [_CurrentType] AND AX, -201 PUSH AX ; [BP-4] = RetType MOV AX, 0 PUSH AX ; [BP-6] = NumArgs .L14: MOV AX, [_TokenType] CMP AX, 4 JNZ .L15 JMP .L16 .L15: MOV AX, [BP-6] AND AX, AX JZ .L17 JMP .L18 .L17: ADD SP, -8 MOV WORD [BP-14], -8 CALL _EmitAdjSp ADD SP, 8 MOV AX, [_LocalOffset] SUB AX, 8 MOV [_LocalOffset], AX JMP .L19 .L18: .L19: ADD SP, -8 MOV AX, [BP-6] CMP AX, 4 MOV AX, 1 JL .L21 DEC AL .L21: MOV [BP-14], AX CALL _Check ADD SP, 8 CALL _ParseAssignmentExpression CALL _LvalToRval MOV AX, [_LocalOffset] PUSH AX MOV AX, [BP-6] ADD AX, AX POP CX ADD AX, CX PUSH AX ; [BP-8] = off MOV AX, [_CurrentType] AND AX, 192 AND AX, AX JNZ .L22 JMP .L23 .L22: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L25 DEC AL .L25: MOV [BP-16], AX CALL _Check ADD SP, 8 ADD SP, -8 MOV WORD [BP-16], 2 MOV WORD [BP-14], 128 MOV AX, [BP-8] MOV [BP-12], AX CALL _EmitStoreConst ADD SP, 8 JMP .L24 .L23: CALL _GetVal ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 JNZ .L26 MOV AX, 1 JMP .L27 .L26: MOV AX, [_CurrentType] AND AX, 48 .L27: MOV [BP-16], AX CALL _Check ADD SP, 8 ADD SP, -8 MOV WORD [BP-16], 2 MOV WORD [BP-14], 128 MOV AX, [BP-8] MOV [BP-12], AX CALL _EmitStoreAx ADD SP, 8 .L24: MOV AX, [BP-6] INC AX MOV [BP-6], AX ADD SP, -8 MOV WORD [BP-16], 9 CALL _Accept ADD SP, 8 AND AX, AX JZ .L28 JMP .L29 .L28: ADD SP, 2 JMP .L16 .L29: .L30: ADD SP, 2 JMP .L14 .L16: ADD SP, -8 MOV WORD [BP-14], 4 CALL _Expect ADD SP, 8 JMP .L33 .L32: DB 'CALL', 9, '_%s', 0 .L33: ADD SP, -8 MOV AX, .L32 MOV [BP-14], AX ADD SP, -8 MOV AX, [BP-2] MOV [BP-22], AX CALL _IdText ADD SP, 8 MOV [BP-12], AX CALL _Emit ADD SP, 8 MOV AX, [BP-6] AND AX, AX JNZ .L34 JMP .L35 .L34: ADD SP, -8 MOV WORD [BP-14], 8 CALL _EmitAdjSp ADD SP, 8 MOV AX, [_LocalOffset] ADD AX, 8 MOV [_LocalOffset], AX JMP .L36 .L35: .L36: MOV AX, [BP-4] MOV [_CurrentType], AX MOV AX, [_CurrentType] CMP AX, 2 JZ .L37 JMP .L38 .L37: MOV WORD [_CurrentType], 3 JMP .L39 .L38: .L39: ADD SP, 6 JMP .L6 .L5: ADD SP, -8 MOV WORD [BP-8], 7 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L40 JMP .L41 .L40: CALL _LvalToRval MOV AX, [_CurrentType] AND AX, 48 AND AX, AX JZ .L43 JMP .L44 .L43: JMP .L48 .L47: DB 'Expected pointer', 0 .L48: ADD SP, -8 MOV AX, .L47 MOV [BP-8], AX CALL _Fatal ADD SP, 8 JMP .L45 .L44: .L45: MOV AX, [_CurrentType] SUB AX, 16 PUSH AX ; [BP-2] = AType MOV AX, 0 PUSH AX ; [BP-4] = Double MOV AX, [BP-2] CMP AX, 2 JNZ .L49 JMP .L50 .L49: ADD SP, -8 MOV AX, [BP-2] CMP AX, 3 JNZ .L52 MOV AX, 1 JMP .L53 .L52: MOV AX, [BP-2] AND AX, 48 .L53: MOV [BP-12], AX CALL _Check ADD SP, 8 MOV WORD [BP-4], 1 JMP .L51 .L50: .L51: JMP .L55 .L54: DB 'PUSH', 9, 'AX', 0 .L55: ADD SP, -8 MOV AX, .L54 MOV [BP-12], AX CALL _Emit ADD SP, 8 CALL _ParseExpr ADD SP, -8 MOV WORD [BP-12], 8 CALL _Expect ADD SP, 8 MOV AX, [_CurrentType] CMP AX, 67 JZ .L56 JMP .L57 .L56: MOV AX, [BP-4] AND AX, AX JNZ .L59 JMP .L60 .L59: MOV AX, [_CurrentVal] MOV CX, 1 SHL AX, CL MOV [_CurrentVal], AX JMP .L61 .L60: .L61: JMP .L63 .L62: DB 'POP', 9, 'AX', 0 .L63: ADD SP, -8 MOV AX, .L62 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L65 .L64: DB 'ADD', 9, 'AX, %d', 0 .L65: ADD SP, -8 MOV AX, .L64 MOV [BP-12], AX MOV AX, [_CurrentVal] MOV [BP-10], AX CALL _Emit ADD SP, 8 JMP .L58 .L57: CALL _LvalToRval ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L66 DEC AL .L66: MOV [BP-12], AX CALL _Check ADD SP, 8 MOV AX, [BP-4] AND AX, AX JNZ .L67 JMP .L68 .L67: JMP .L71 .L70: DB 'ADD', 9, 'AX, AX', 0 .L71: ADD SP, -8 MOV AX, .L70 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L69 .L68: .L69: JMP .L73 .L72: DB 'POP', 9, 'CX', 0 .L73: ADD SP, -8 MOV AX, .L72 MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L75 .L74: DB 'ADD', 9, 'AX, CX', 0 .L75: ADD SP, -8 MOV AX, .L74 MOV [BP-12], AX CALL _Emit ADD SP, 8 .L58: MOV AX, [BP-2] OR AX, 4 MOV [_CurrentType], AX ADD SP, 4 JMP .L42 .L41: MOV AX, [_TokenType] PUSH AX ; [BP-2] = Op MOV AX, [BP-2] CMP AX, 20 JNZ .L79 MOV AX, 0 JMP .L80 .L79: MOV AX, [BP-2] CMP AX, 22 MOV AX, 1 JNZ .L81 DEC AL .L81: .L80: AND AX, AX JNZ .L76 JMP .L77 .L76: ADD SP, 2 JMP .L3 .L77: .L78: CALL _GetToken ADD SP, -8 MOV AX, [BP-2] MOV [BP-10], AX MOV WORD [BP-8], 1 CALL _DoIncDecOp ADD SP, 8 ADD SP, 2 .L42: .L6: JMP .L1 .L3: .L0: POP BP RET _ParseUnaryExpression: PUSH BP MOV BP, SP MOV AX, [_TokenType] PUSH AX ; [BP-2] = Op MOV AX, 0 PUSH AX ; [BP-4] = IsConst MOV AX, [BP-2] CMP AX, 20 JNZ .L4 MOV AX, 1 JMP .L5 .L4: MOV AX, [BP-2] CMP AX, 22 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JNZ .L1 JMP .L2 .L1: CALL _GetToken CALL _ParseUnaryExpression ADD SP, -8 MOV AX, [BP-2] MOV [BP-12], AX MOV WORD [BP-10], 0 CALL _DoIncDecOp ADD SP, 8 JMP .L3 .L2: MOV AX, [BP-2] CMP AX, 26 JNZ .L10 MOV AX, 1 JMP .L11 .L10: MOV AX, [BP-2] CMP AX, 23 MOV AX, 1 JZ .L12 DEC AL .L12: .L11: AND AX, AX JZ .L13 JMP .L14 .L13: MOV AX, [BP-2] CMP AX, 19 MOV AX, 1 JZ .L15 DEC AL .L15: .L14: AND AX, AX JZ .L16 JMP .L17 .L16: MOV AX, [BP-2] CMP AX, 21 MOV AX, 1 JZ .L18 DEC AL .L18: .L17: AND AX, AX JZ .L19 JMP .L20 .L19: MOV AX, [BP-2] CMP AX, 43 MOV AX, 1 JZ .L21 DEC AL .L21: .L20: AND AX, AX JZ .L22 JMP .L23 .L22: MOV AX, [BP-2] CMP AX, 13 MOV AX, 1 JZ .L24 DEC AL .L24: .L23: AND AX, AX JNZ .L7 JMP .L8 .L7: CALL _GetToken CALL _ParseCastExpression MOV AX, [_CurrentType] AND AX, 192 CMP AX, 64 JZ .L25 JMP .L26 .L25: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L28 DEC AL .L28: MOV [BP-12], AX CALL _Check ADD SP, 8 MOV WORD [BP-4], 1 JMP .L27 .L26: MOV AX, [BP-2] CMP AX, 26 JNZ .L29 JMP .L30 .L29: CALL _LvalToRval JMP .L31 .L30: .L31: .L27: MOV AX, [BP-2] CMP AX, 26 JZ .L32 JMP .L33 .L32: MOV AX, [_CurrentType] AND AX, 4 AND AX, AX JZ .L35 JMP .L36 .L35: JMP .L40 .L39: DB 'Lvalue required for address-of operator', 0 .L40: ADD SP, -8 MOV AX, .L39 MOV [BP-12], AX CALL _Fatal ADD SP, 8 JMP .L37 .L36: .L37: MOV AX, [_CurrentType] AND AX, 192 PUSH AX ; [BP-6] = loc MOV AX, [BP-6] AND AX, AX JNZ .L41 JMP .L42 .L41: MOV AX, [BP-6] CMP AX, 128 JZ .L44 JMP .L45 .L44: JMP .L48 .L47: DB 'LEA', 9, 'AX, [BP%+d]', 0 .L48: ADD SP, -8 MOV AX, .L47 MOV [BP-14], AX MOV AX, [_CurrentVal] MOV [BP-12], AX CALL _Emit ADD SP, 8 JMP .L46 .L45: ADD SP, -8 MOV WORD [BP-14], 0 CALL _Check ADD SP, 8 .L46: MOV AX, [_CurrentType] AND AX, -193 MOV [_CurrentType], AX JMP .L43 .L42: .L43: MOV AX, [_CurrentType] AND AX, -5 ADD AX, 16 MOV [_CurrentType], AX ADD SP, 2 JMP .L34 .L33: MOV AX, [BP-2] CMP AX, 23 JZ .L49 JMP .L50 .L49: MOV AX, [_CurrentType] AND AX, 48 AND AX, AX JZ .L52 JMP .L53 .L52: JMP .L57 .L56: DB 'Pointer required for dereference', 0 .L57: ADD SP, -8 MOV AX, .L56 MOV [BP-12], AX CALL _Fatal ADD SP, 8 JMP .L54 .L53: .L54: MOV AX, [_CurrentType] SUB AX, 16 OR AX, 4 MOV [_CurrentType], AX JMP .L51 .L50: MOV AX, [BP-2] CMP AX, 19 JZ .L58 JMP .L59 .L58: ADD SP, -8 MOV AX, [BP-4] AND AX, AX JZ .L61 JMP .L62 .L61: MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L63 DEC AL .L63: .L62: MOV [BP-12], AX CALL _Check ADD SP, 8 JMP .L60 .L59: MOV AX, [BP-2] CMP AX, 21 JZ .L64 JMP .L65 .L64: MOV AX, [BP-4] AND AX, AX JNZ .L67 JMP .L68 .L67: MOV AX, [_CurrentVal] NEG AX MOV [_CurrentVal], AX JMP .L69 .L68: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L70 DEC AL .L70: MOV [BP-12], AX CALL _Check ADD SP, 8 JMP .L72 .L71: DB 'NEG', 9, 'AX', 0 .L72: ADD SP, -8 MOV AX, .L71 MOV [BP-12], AX CALL _Emit ADD SP, 8 .L69: JMP .L66 .L65: MOV AX, [BP-2] CMP AX, 43 JZ .L73 JMP .L74 .L73: MOV AX, [BP-4] AND AX, AX JNZ .L76 JMP .L77 .L76: MOV AX, [_CurrentVal] NOT AX MOV [_CurrentVal], AX JMP .L78 .L77: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L79 DEC AL .L79: MOV [BP-12], AX CALL _Check ADD SP, 8 JMP .L81 .L80: DB 'NOT', 9, 'AX', 0 .L81: ADD SP, -8 MOV AX, .L80 MOV [BP-12], AX CALL _Emit ADD SP, 8 .L78: JMP .L75 .L74: MOV AX, [BP-2] CMP AX, 13 JZ .L82 JMP .L83 .L82: MOV AX, [BP-4] AND AX, AX JNZ .L85 JMP .L86 .L85: MOV AX, [_CurrentVal] AND AX, AX MOV AX, 1 JZ .L89 DEC AL .L89: MOV [_CurrentVal], AX JMP .L87 .L86: PUSH AX ; [BP-6] = Lab MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [BP-6], AX ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 JNZ .L90 MOV AX, 1 JMP .L91 .L90: MOV AX, [_CurrentType] AND AX, 48 .L91: MOV [BP-14], AX CALL _Check ADD SP, 8 JMP .L93 .L92: DB 'AND', 9, 'AX, AX', 0 .L93: ADD SP, -8 MOV AX, .L92 MOV [BP-14], AX CALL _Emit ADD SP, 8 MOV WORD [_CurrentType], 1 MOV WORD [_CurrentVal], 4 ADD SP, 2 .L87: JMP .L84 .L83: CALL _Unexpected .L84: .L75: .L66: .L60: .L51: .L34: JMP .L9 .L8: MOV AX, [BP-2] CMP AX, 56 JZ .L94 JMP .L95 .L94: CALL _GetToken ADD SP, -8 MOV WORD [BP-12], 3 CALL _Expect ADD SP, 8 ADD SP, -8 MOV WORD [BP-12], 47 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L97 JMP .L98 .L97: MOV WORD [_CurrentVal], 1 JMP .L99 .L98: ADD SP, -8 MOV WORD [BP-12], 54 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L100 JMP .L101 .L100: MOV WORD [_CurrentVal], 2 JMP .L102 .L101: JMP .L104 .L103: DB 'sizeof not implemented for this type', 0 .L104: ADD SP, -8 MOV AX, .L103 MOV [BP-12], AX CALL _Fatal ADD SP, 8 .L102: .L99: .L105: ADD SP, -8 MOV WORD [BP-12], 23 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L106 JMP .L107 .L106: MOV WORD [_CurrentVal], 2 JMP .L105 .L107: ADD SP, -8 MOV WORD [BP-12], 4 CALL _Expect ADD SP, 8 MOV WORD [_CurrentType], 67 JMP .L96 .L95: CALL _ParsePrimaryExpression CALL _ParsePostfixExpression .L96: .L9: .L3: ADD SP, 4 .L0: POP BP RET _ParseCastExpression: PUSH BP MOV BP, SP CALL _ParseUnaryExpression .L0: POP BP RET _RelOpToCC: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 15 JZ .L1 JMP .L2 .L1: MOV AX, 12 JMP .L0 .L2: MOV AX, [BP+4] CMP AX, 16 JZ .L4 JMP .L5 .L4: MOV AX, 14 JMP .L0 .L5: MOV AX, [BP+4] CMP AX, 17 JZ .L7 JMP .L8 .L7: MOV AX, 15 JMP .L0 .L8: MOV AX, [BP+4] CMP AX, 18 JZ .L10 JMP .L11 .L10: MOV AX, 13 JMP .L0 .L11: MOV AX, [BP+4] CMP AX, 12 JZ .L13 JMP .L14 .L13: MOV AX, 4 JMP .L0 .L14: MOV AX, [BP+4] CMP AX, 14 JZ .L16 JMP .L17 .L16: MOV AX, 5 JMP .L0 .L17: .L18: .L15: .L12: .L9: .L6: .L3: JMP .L20 .L19: DB 'Not implemented', 0 .L20: ADD SP, -8 MOV AX, .L19 MOV [BP-8], AX CALL _Fatal ADD SP, 8 .L0: POP BP RET _IsRelOp: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 15 JNZ .L1 MOV AX, 1 JMP .L2 .L1: MOV AX, [BP+4] CMP AX, 16 MOV AX, 1 JZ .L3 DEC AL .L3: .L2: AND AX, AX JZ .L4 JMP .L5 .L4: MOV AX, [BP+4] CMP AX, 17 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [BP+4] CMP AX, 18 MOV AX, 1 JZ .L9 DEC AL .L9: .L8: AND AX, AX JZ .L10 JMP .L11 .L10: MOV AX, [BP+4] CMP AX, 12 MOV AX, 1 JZ .L12 DEC AL .L12: .L11: AND AX, AX JZ .L13 JMP .L14 .L13: MOV AX, [BP+4] CMP AX, 14 MOV AX, 1 JZ .L15 DEC AL .L15: .L14: JMP .L0 .L0: POP BP RET _RemoveAssign: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 33 JZ .L1 JMP .L2 .L1: MOV AX, 19 JMP .L0 .L2: .L3: MOV AX, [BP+4] CMP AX, 34 JZ .L4 JMP .L5 .L4: MOV AX, 21 JMP .L0 .L5: .L6: MOV AX, [BP+4] CMP AX, 35 JZ .L7 JMP .L8 .L7: MOV AX, 23 JMP .L0 .L8: .L9: MOV AX, [BP+4] CMP AX, 36 JZ .L10 JMP .L11 .L10: MOV AX, 24 JMP .L0 .L11: .L12: MOV AX, [BP+4] CMP AX, 37 JZ .L13 JMP .L14 .L13: MOV AX, 25 JMP .L0 .L14: .L15: MOV AX, [BP+4] CMP AX, 38 JZ .L16 JMP .L17 .L16: MOV AX, 31 JMP .L0 .L17: .L18: MOV AX, [BP+4] CMP AX, 39 JZ .L19 JMP .L20 .L19: MOV AX, 32 JMP .L0 .L20: .L21: MOV AX, [BP+4] CMP AX, 40 JZ .L22 JMP .L23 .L22: MOV AX, 26 JMP .L0 .L23: .L24: MOV AX, [BP+4] CMP AX, 41 JZ .L25 JMP .L26 .L25: MOV AX, 27 JMP .L0 .L26: .L27: MOV AX, [BP+4] CMP AX, 42 JZ .L28 JMP .L29 .L28: MOV AX, 28 JMP .L0 .L29: .L30: ADD SP, -8 MOV WORD [BP-8], 0 CALL _Check ADD SP, 8 .L0: POP BP RET _DoBinOp: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _IsRelOp ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: JMP .L5 .L4: DB 'CMP', 9, 'AX, CX', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-8], AX CALL _Emit ADD SP, 8 MOV WORD [_CurrentType], 1 ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _RelOpToCC ADD SP, 8 MOV [_CurrentVal], AX JMP .L0 .L2: .L3: MOV AX, [BP+4] CMP AX, 19 JZ .L6 JMP .L7 .L6: JMP .L10 .L9: DB 'ADD', 9, 'AX, CX', 0 .L10: ADD SP, -8 MOV AX, .L9 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L8 .L7: MOV AX, [BP+4] CMP AX, 21 JZ .L11 JMP .L12 .L11: JMP .L15 .L14: DB 'SUB', 9, 'AX, CX', 0 .L15: ADD SP, -8 MOV AX, .L14 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L13 .L12: MOV AX, [BP+4] CMP AX, 23 JZ .L16 JMP .L17 .L16: JMP .L20 .L19: DB 'IMUL', 9, 'CX', 0 .L20: ADD SP, -8 MOV AX, .L19 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L18 .L17: MOV AX, [BP+4] CMP AX, 24 JNZ .L24 MOV AX, 1 JMP .L25 .L24: MOV AX, [BP+4] CMP AX, 25 MOV AX, 1 JZ .L26 DEC AL .L26: .L25: AND AX, AX JNZ .L21 JMP .L22 .L21: JMP .L28 .L27: DB 'CWD', 0 .L28: ADD SP, -8 MOV AX, .L27 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L30 .L29: DB 'IDIV', 9, 'CX', 0 .L30: ADD SP, -8 MOV AX, .L29 MOV [BP-8], AX CALL _Emit ADD SP, 8 MOV AX, [BP+4] CMP AX, 25 JZ .L31 JMP .L32 .L31: JMP .L35 .L34: DB 'MOV', 9, 'AX, DX', 0 .L35: ADD SP, -8 MOV AX, .L34 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L33 .L32: .L33: JMP .L23 .L22: MOV AX, [BP+4] CMP AX, 26 JZ .L36 JMP .L37 .L36: JMP .L40 .L39: DB 'AND', 9, 'AX, CX', 0 .L40: ADD SP, -8 MOV AX, .L39 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L38 .L37: MOV AX, [BP+4] CMP AX, 27 JZ .L41 JMP .L42 .L41: JMP .L45 .L44: DB 'XOR', 9, 'AX, CX', 0 .L45: ADD SP, -8 MOV AX, .L44 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L43 .L42: MOV AX, [BP+4] CMP AX, 28 JZ .L46 JMP .L47 .L46: JMP .L50 .L49: DB 'OR', 9, 'AX, CX', 0 .L50: ADD SP, -8 MOV AX, .L49 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L48 .L47: MOV AX, [BP+4] CMP AX, 31 JZ .L51 JMP .L52 .L51: JMP .L55 .L54: DB 'SHL', 9, 'AX, CL', 0 .L55: ADD SP, -8 MOV AX, .L54 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L53 .L52: MOV AX, [BP+4] CMP AX, 32 JZ .L56 JMP .L57 .L56: JMP .L60 .L59: DB 'SAR', 9, 'AX, CL', 0 .L60: ADD SP, -8 MOV AX, .L59 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L58 .L57: ADD SP, -8 MOV WORD [BP-8], 0 CALL _Check ADD SP, 8 .L58: .L53: .L48: .L43: .L38: .L23: .L18: .L13: .L8: .L0: POP BP RET _DoRhsConstBinOp: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _IsRelOp ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: JMP .L5 .L4: DB 'CMP', 9, 'AX, %d', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-8], AX MOV AX, [_CurrentVal] MOV [BP-6], AX CALL _Emit ADD SP, 8 MOV WORD [_CurrentType], 1 ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _RelOpToCC ADD SP, 8 MOV [_CurrentVal], AX JMP .L0 .L2: .L3: MOV AX, [BP+4] CMP AX, 23 JZ .L9 MOV AX, 0 JMP .L10 .L9: MOV AX, [_CurrentVal] CMP AX, 2 MOV AX, 1 JZ .L11 DEC AL .L11: .L10: AND AX, AX JNZ .L6 JMP .L7 .L6: JMP .L13 .L12: DB 'ADD', 9, 'AX, AX', 0 .L13: ADD SP, -8 MOV AX, .L12 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L0 .L7: .L8: MOV AX, 0 PUSH AX ; [BP-2] = Inst MOV AX, [BP+4] CMP AX, 19 JZ .L14 JMP .L15 .L14: JMP .L18 .L17: DB 'ADD', 0 .L18: MOV AX, .L17 MOV [BP-2], AX JMP .L16 .L15: MOV AX, [BP+4] CMP AX, 21 JZ .L19 JMP .L20 .L19: JMP .L23 .L22: DB 'SUB', 0 .L23: MOV AX, .L22 MOV [BP-2], AX JMP .L21 .L20: MOV AX, [BP+4] CMP AX, 26 JZ .L24 JMP .L25 .L24: JMP .L28 .L27: DB 'AND', 0 .L28: MOV AX, .L27 MOV [BP-2], AX JMP .L26 .L25: MOV AX, [BP+4] CMP AX, 27 JZ .L29 JMP .L30 .L29: JMP .L33 .L32: DB 'XOR', 0 .L33: MOV AX, .L32 MOV [BP-2], AX JMP .L31 .L30: MOV AX, [BP+4] CMP AX, 28 JZ .L34 JMP .L35 .L34: JMP .L38 .L37: DB 'OR', 0 .L38: MOV AX, .L37 MOV [BP-2], AX JMP .L36 .L35: JMP .L40 .L39: DB 'MOV', 9, 'CX, %d', 0 .L40: ADD SP, -8 MOV AX, .L39 MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _Emit ADD SP, 8 ADD SP, -8 MOV AX, [BP+4] MOV [BP-10], AX CALL _DoBinOp ADD SP, 8 JMP .L0 .L36: .L31: .L26: .L21: .L16: JMP .L42 .L41: DB '%s', 9, 'AX, %d', 0 .L42: ADD SP, -8 MOV AX, .L41 MOV [BP-10], AX MOV AX, [BP-2] MOV [BP-8], AX MOV AX, [_CurrentVal] MOV [BP-6], AX CALL _Emit ADD SP, 8 ADD SP, 2 .L0: MOV SP, BP POP BP RET _DoConstBinOp: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 19 JZ .L1 JMP .L2 .L1: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX ADD AX, CX JMP .L0 .L2: .L3: MOV AX, [BP+4] CMP AX, 21 JZ .L4 JMP .L5 .L4: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XCHG AX, CX SUB AX, CX JMP .L0 .L5: .L6: MOV AX, [BP+4] CMP AX, 23 JZ .L7 JMP .L8 .L7: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX IMUL CX JMP .L0 .L8: .L9: MOV AX, [BP+4] CMP AX, 24 JZ .L10 JMP .L11 .L10: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XCHG AX, CX CWD IDIV CX JMP .L0 .L11: .L12: MOV AX, [BP+4] CMP AX, 25 JZ .L13 JMP .L14 .L13: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XCHG AX, CX CWD IDIV CX MOV AX, DX JMP .L0 .L14: .L15: MOV AX, [BP+4] CMP AX, 26 JZ .L16 JMP .L17 .L16: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX AND AX, CX JMP .L0 .L17: .L18: MOV AX, [BP+4] CMP AX, 27 JZ .L19 JMP .L20 .L19: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XOR AX, CX JMP .L0 .L20: .L21: MOV AX, [BP+4] CMP AX, 28 JZ .L22 JMP .L23 .L22: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX OR AX, CX JMP .L0 .L23: .L24: MOV AX, [BP+4] CMP AX, 31 JZ .L25 JMP .L26 .L25: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XCHG AX, CX SHL AX, CL JMP .L0 .L26: .L27: MOV AX, [BP+4] CMP AX, 32 JZ .L28 JMP .L29 .L28: MOV AX, [BP+6] PUSH AX MOV AX, [BP+8] POP CX XCHG AX, CX SAR AX, CL JMP .L0 .L29: .L30: ADD SP, -8 MOV WORD [BP-8], 0 CALL _Check ADD SP, 8 .L0: POP BP RET _OpCommutes: PUSH BP MOV BP, SP MOV AX, [BP+4] CMP AX, 19 JNZ .L1 MOV AX, 1 JMP .L2 .L1: MOV AX, [BP+4] CMP AX, 23 MOV AX, 1 JZ .L3 DEC AL .L3: .L2: AND AX, AX JZ .L4 JMP .L5 .L4: MOV AX, [BP+4] CMP AX, 11 MOV AX, 1 JZ .L6 DEC AL .L6: .L5: AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [BP+4] CMP AX, 14 MOV AX, 1 JZ .L9 DEC AL .L9: .L8: AND AX, AX JZ .L10 JMP .L11 .L10: MOV AX, [BP+4] CMP AX, 26 MOV AX, 1 JZ .L12 DEC AL .L12: .L11: AND AX, AX JZ .L13 JMP .L14 .L13: MOV AX, [BP+4] CMP AX, 27 MOV AX, 1 JZ .L15 DEC AL .L15: .L14: AND AX, AX JZ .L16 JMP .L17 .L16: MOV AX, [BP+4] CMP AX, 28 MOV AX, 1 JZ .L18 DEC AL .L18: .L17: JMP .L0 .L0: POP BP RET _ParseExpr1: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = LEnd PUSH AX ; [BP-4] = Temp PUSH AX ; [BP-6] = Op PUSH AX ; [BP-8] = Prec PUSH AX ; [BP-10] = IsAssign PUSH AX ; [BP-12] = LhsType PUSH AX ; [BP-14] = LhsVal PUSH AX ; [BP-16] = LhsLoc .L1: JMP .L2 .L2: MOV AX, [_TokenType] MOV [BP-6], AX ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _OperatorPrecedence ADD SP, 8 MOV [BP-8], AX MOV AX, [BP-8] PUSH AX MOV AX, [BP+4] POP CX XCHG AX, CX CMP AX, CX JG .L4 JMP .L5 .L4: JMP .L3 .L5: .L6: CALL _GetToken MOV AX, [BP-8] CMP AX, 14 MOV AX, 1 JZ .L7 DEC AL .L7: MOV [BP-10], AX MOV AX, [BP-10] AND AX, AX JNZ .L8 JMP .L9 .L8: MOV AX, [_CurrentType] AND AX, 4 AND AX, AX JZ .L11 JMP .L12 .L11: JMP .L16 .L15: DB 'L-value required', 0 .L16: ADD SP, -8 MOV AX, .L15 MOV [BP-24], AX CALL _Fatal ADD SP, 8 JMP .L13 .L12: .L13: MOV AX, [BP-6] CMP AX, 11 JNZ .L17 JMP .L18 .L17: ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _RemoveAssign ADD SP, 8 MOV [BP-6], AX JMP .L19 .L18: .L19: MOV AX, [_CurrentType] AND AX, -5 MOV [_CurrentType], AX JMP .L10 .L9: CALL _LvalToRval .L10: MOV AX, [_CurrentType] MOV [BP-12], AX MOV AX, [_CurrentVal] MOV [BP-14], AX MOV AX, [BP-6] CMP AX, 29 JNZ .L23 MOV AX, 1 JMP .L24 .L23: MOV AX, [BP-6] CMP AX, 30 MOV AX, 1 JZ .L25 DEC AL .L25: .L24: AND AX, AX JNZ .L20 JMP .L21 .L20: PUSH AX ; [BP-18] = JText MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [BP-4], AX MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [BP-2], AX MOV AX, [_CurrentType] CMP AX, 1 JZ .L26 JMP .L27 .L26: MOV AX, [BP-6] CMP AX, 29 JNZ .L29 JMP .L30 .L29: MOV AX, [_CurrentVal] XOR AX, 1 MOV [_CurrentVal], AX JMP .L31 .L30: .L31: JMP .L33 .L32: DB '%s', 9, '.L%d', 0 .L33: ADD SP, -8 MOV AX, .L32 MOV [BP-26], AX ADD SP, -8 MOV AX, [_CurrentVal] MOV [BP-34], AX CALL _GetJcc ADD SP, 8 MOV [BP-24], AX MOV AX, [BP-4] MOV [BP-22], AX CALL _Emit ADD SP, 8 JMP .L35 .L34: DB 'MOV', 9, 'AX, %d', 0 .L35: ADD SP, -8 MOV AX, .L34 MOV [BP-26], AX MOV AX, [BP-6] CMP AX, 29 MOV AX, 1 JNZ .L36 DEC AL .L36: MOV [BP-24], AX CALL _Emit ADD SP, 8 JMP .L28 .L27: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L37 DEC AL .L37: MOV [BP-26], AX CALL _Check ADD SP, 8 JMP .L39 .L38: DB 'AND', 9, 'AX, AX', 0 .L39: ADD SP, -8 MOV AX, .L38 MOV [BP-26], AX CALL _Emit ADD SP, 8 MOV AX, [BP-6] CMP AX, 29 JZ .L40 JMP .L41 .L40: JMP .L44 .L43: DB 'JNZ', 0 .L44: MOV AX, .L43 MOV [BP-18], AX JMP .L42 .L41: JMP .L46 .L45: DB 'JZ', 0 .L46: MOV AX, .L45 MOV [BP-18], AX .L42: JMP .L48 .L47: DB '%s', 9, '.L%d', 0 .L48: ADD SP, -8 MOV AX, .L47 MOV [BP-26], AX MOV AX, [BP-18] MOV [BP-24], AX MOV AX, [BP-4] MOV [BP-22], AX CALL _Emit ADD SP, 8 .L28: ADD SP, -8 MOV AX, [BP-2] MOV [BP-26], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV AX, [BP-4] MOV [BP-26], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, 2 JMP .L22 .L21: MOV WORD [BP-2], -1 MOV AX, [BP-12] AND AX, 192 AND AX, AX JZ .L49 JMP .L50 .L49: ADD SP, -8 MOV AX, [_PendingPushAx] AND AX, AX MOV AX, 1 JZ .L54 DEC AL .L54: MOV [BP-24], AX CALL _Check ADD SP, 8 MOV WORD [_PendingPushAx], 1 JMP .L51 .L50: .L51: .L22: CALL _ParseCastExpression .L55: JMP .L56 .L56: MOV AX, [_TokenType] PUSH AX ; [BP-18] = LookAheadOp ADD SP, -8 MOV AX, [BP-18] MOV [BP-26], AX CALL _OperatorPrecedence ADD SP, 8 PUSH AX ; [BP-20] = LookAheadPrecedence MOV AX, [BP-20] PUSH AX MOV AX, [BP-8] POP CX XCHG AX, CX CMP AX, CX JNG .L61 MOV AX, 1 JMP .L62 .L61: MOV AX, [BP-20] PUSH AX MOV AX, [BP-8] POP CX XCHG AX, CX CMP AX, CX JZ .L63 MOV AX, 0 JMP .L64 .L63: MOV AX, [BP-20] CMP AX, 14 MOV AX, 1 JL .L65 DEC AL .L65: .L64: .L62: AND AX, AX JNZ .L58 JMP .L59 .L58: ADD SP, 4 JMP .L57 .L59: .L60: ADD SP, -8 MOV AX, [BP-20] MOV [BP-28], AX CALL _ParseExpr1 ADD SP, 8 ADD SP, 4 JMP .L55 .L57: CALL _LvalToRval MOV AX, [BP-12] AND AX, 192 MOV [BP-16], AX MOV AX, [BP-12] AND AX, -193 MOV [BP-12], AX MOV AX, [BP-16] CMP AX, 64 JZ .L69 MOV AX, 0 JMP .L70 .L69: MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L71 DEC AL .L71: .L70: AND AX, AX JNZ .L66 JMP .L67 .L66: ADD SP, -8 MOV AX, [BP-12] CMP AX, 3 MOV AX, 1 JZ .L72 DEC AL .L72: MOV [BP-24], AX CALL _Check ADD SP, 8 ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX MOV AX, [BP-14] MOV [BP-22], AX MOV AX, [_CurrentVal] MOV [BP-20], AX CALL _DoConstBinOp ADD SP, 8 MOV [_CurrentVal], AX JMP .L1 .L67: .L68: MOV AX, [BP-2] CMP AX, 0 JNL .L73 JMP .L74 .L73: CALL _GetVal ADD SP, -8 MOV AX, [BP-2] MOV [BP-24], AX CALL _EmitLocalLabel ADD SP, 8 JMP .L75 .L74: MOV AX, [BP-10] AND AX, AX JNZ .L76 JMP .L77 .L76: MOV AX, 2 PUSH AX ; [BP-18] = Size MOV AX, [BP-12] CMP AX, 2 JZ .L79 JMP .L80 .L79: MOV WORD [BP-18], 1 JMP .L81 .L80: ADD SP, -8 MOV AX, [BP-12] CMP AX, 3 JNZ .L82 MOV AX, 1 JMP .L83 .L82: MOV AX, [BP-12] AND AX, 48 .L83: MOV [BP-26], AX CALL _Check ADD SP, 8 .L81: MOV AX, [BP-16] AND AX, AX JZ .L84 JMP .L85 .L84: MOV AX, [_PendingPushAx] AND AX, AX JNZ .L88 JMP .L89 .L88: MOV WORD [_PendingPushAx], 0 JMP .L92 .L91: DB 'MOV', 9, 'BX, AX', 0 .L92: ADD SP, -8 MOV AX, .L91 MOV [BP-26], AX CALL _Emit ADD SP, 8 JMP .L90 .L89: JMP .L94 .L93: DB 'POP', 9, 'BX', 0 .L94: ADD SP, -8 MOV AX, .L93 MOV [BP-26], AX CALL _Emit ADD SP, 8 .L90: JMP .L86 .L85: ADD SP, -8 MOV AX, [BP-16] CMP AX, 128 JNZ .L95 MOV AX, 1 JMP .L96 .L95: MOV AX, [BP-16] CMP AX, 192 MOV AX, 1 JZ .L97 DEC AL .L97: .L96: MOV [BP-26], AX CALL _Check ADD SP, 8 .L86: MOV AX, [BP-6] CMP AX, 11 JNZ .L98 JMP .L99 .L98: ADD SP, -8 MOV AX, [BP-12] CMP AX, 3 JNZ .L101 MOV AX, 1 JMP .L102 .L101: MOV AX, [BP-12] AND AX, 18 .L102: MOV [BP-26], AX CALL _Check ADD SP, 8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L103 DEC AL .L103: MOV [BP-4], AX MOV AX, [BP-4] AND AX, AX JZ .L104 JMP .L105 .L104: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L108 DEC AL .L108: MOV [BP-26], AX CALL _Check ADD SP, 8 JMP .L110 .L109: DB 'MOV', 9, 'CX, AX', 0 .L110: ADD SP, -8 MOV AX, .L109 MOV [BP-26], AX CALL _Emit ADD SP, 8 JMP .L106 .L105: .L106: ADD SP, -8 MOV WORD [BP-26], 2 MOV AX, [BP-16] MOV [BP-24], AX MOV AX, [BP-14] MOV [BP-22], AX CALL _EmitLoadAx ADD SP, 8 MOV AX, [BP-4] AND AX, AX JNZ .L111 JMP .L112 .L111: ADD SP, -8 MOV AX, [BP-6] MOV [BP-26], AX CALL _DoRhsConstBinOp ADD SP, 8 JMP .L113 .L112: ADD SP, -8 MOV AX, [BP-6] MOV [BP-26], AX CALL _DoBinOp ADD SP, 8 .L113: JMP .L100 .L99: MOV AX, [_CurrentType] CMP AX, 67 JZ .L114 JMP .L115 .L114: ADD SP, -8 MOV AX, [BP-18] MOV [BP-26], AX MOV AX, [BP-16] MOV [BP-24], AX MOV AX, [BP-14] MOV [BP-22], AX CALL _EmitStoreConst ADD SP, 8 ADD SP, 2 JMP .L1 .L115: CALL _GetVal .L116: .L100: ADD SP, -8 MOV AX, [BP-18] MOV [BP-26], AX MOV AX, [BP-16] MOV [BP-24], AX MOV AX, [BP-14] MOV [BP-22], AX CALL _EmitStoreAx ADD SP, 8 ADD SP, 2 JMP .L78 .L77: MOV AX, [_CurrentType] CMP AX, 67 JZ .L117 JMP .L118 .L117: ADD SP, -8 MOV AX, [_PendingPushAx] MOV [BP-24], AX CALL _Check ADD SP, 8 MOV WORD [_PendingPushAx], 0 MOV WORD [_CurrentType], 3 ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _DoRhsConstBinOp ADD SP, 8 JMP .L119 .L118: ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 JNZ .L120 MOV AX, 1 JMP .L121 .L120: MOV AX, [BP-6] CMP AX, 21 JZ .L122 MOV AX, 0 JMP .L123 .L122: MOV AX, [_CurrentType] AND AX, 48 .L123: .L121: MOV [BP-24], AX CALL _Check ADD SP, 8 MOV AX, [BP-6] CMP AX, 19 JZ .L127 MOV AX, 0 JMP .L128 .L127: MOV AX, [BP-12] AND AX, 48 .L128: AND AX, AX JNZ .L129 JMP .L130 .L129: MOV AX, [BP-12] CMP AX, 18 MOV AX, 1 JNZ .L131 DEC AL .L131: .L130: AND AX, AX JNZ .L124 JMP .L125 .L124: JMP .L133 .L132: DB 'ADD', 9, 'AX, AX', 0 .L133: ADD SP, -8 MOV AX, .L132 MOV [BP-24], AX CALL _Emit ADD SP, 8 JMP .L126 .L125: .L126: ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _OpCommutes ADD SP, 8 MOV [BP-4], AX MOV AX, [BP-16] CMP AX, 64 JZ .L134 JMP .L135 .L134: ADD SP, -8 MOV AX, [BP-12] CMP AX, 3 MOV AX, 1 JZ .L137 DEC AL .L137: MOV [BP-24], AX CALL _Check ADD SP, 8 MOV AX, [BP-4] AND AX, AX JNZ .L138 JMP .L139 .L138: MOV AX, [BP-14] MOV [_CurrentVal], AX ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _DoRhsConstBinOp ADD SP, 8 JMP .L1 .L139: JMP .L142 .L141: DB 'MOV', 9, 'CX, %d', 0 .L142: ADD SP, -8 MOV AX, .L141 MOV [BP-24], AX MOV AX, [BP-14] MOV [BP-22], AX CALL _Emit ADD SP, 8 .L140: JMP .L136 .L135: ADD SP, -8 MOV AX, [BP-12] CMP AX, 3 JNZ .L143 MOV AX, 1 JMP .L144 .L143: MOV AX, [BP-12] AND AX, 48 .L144: MOV [BP-24], AX CALL _Check ADD SP, 8 JMP .L146 .L145: DB 'POP', 9, 'CX', 0 .L146: ADD SP, -8 MOV AX, .L145 MOV [BP-24], AX CALL _Emit ADD SP, 8 .L136: MOV AX, [BP-4] AND AX, AX JZ .L147 JMP .L148 .L147: JMP .L152 .L151: DB 'XCHG', 9, 'AX, CX', 0 .L152: ADD SP, -8 MOV AX, .L151 MOV [BP-24], AX CALL _Emit ADD SP, 8 JMP .L149 .L148: .L149: ADD SP, -8 MOV AX, [BP-6] MOV [BP-24], AX CALL _DoBinOp ADD SP, 8 .L119: MOV AX, [BP-6] CMP AX, 21 JZ .L156 MOV AX, 0 JMP .L157 .L156: MOV AX, [BP-12] AND AX, 48 .L157: AND AX, AX JNZ .L153 JMP .L154 .L153: MOV AX, [BP-12] CMP AX, 18 JNZ .L158 JMP .L159 .L158: JMP .L162 .L161: DB 'SAR', 9, 'AX, 1', 0 .L162: ADD SP, -8 MOV AX, .L161 MOV [BP-24], AX CALL _Emit ADD SP, 8 JMP .L160 .L159: .L160: MOV WORD [_CurrentType], 3 JMP .L155 .L154: .L155: .L78: .L75: JMP .L1 .L3: ADD SP, 16 .L0: POP BP RET _ParseExpr0: PUSH BP MOV BP, SP CALL _ParseCastExpression ADD SP, -8 MOV AX, [BP+4] MOV [BP-8], AX CALL _ParseExpr1 ADD SP, 8 .L0: POP BP RET _ParseExpr: PUSH BP MOV BP, SP ADD SP, -8 MOV WORD [BP-8], 15 CALL _ParseExpr0 ADD SP, 8 .L0: POP BP RET _ParseAssignmentExpression: PUSH BP MOV BP, SP ADD SP, -8 MOV WORD [BP-8], 14 CALL _ParseExpr0 ADD SP, 8 .L0: POP BP RET _ParseDeclSpecs: PUSH BP MOV BP, SP ADD SP, -8 CALL _IsTypeStart MOV [BP-8], AX CALL _Check ADD SP, 8 MOV AX, [_TokenType] CMP AX, 48 JZ .L1 JMP .L2 .L1: CALL _GetToken ADD SP, -8 CALL _IsTypeStart MOV [BP-8], AX CALL _Check ADD SP, 8 JMP .L3 .L2: .L3: PUSH AX ; [BP-2] = t MOV AX, [_TokenType] CMP AX, 57 JZ .L4 JMP .L5 .L4: MOV WORD [BP-2], 0 JMP .L6 .L5: MOV AX, [_TokenType] CMP AX, 47 JZ .L7 JMP .L8 .L7: MOV WORD [BP-2], 2 JMP .L9 .L8: MOV AX, [_TokenType] CMP AX, 54 JZ .L10 JMP .L11 .L10: MOV WORD [BP-2], 3 JMP .L12 .L11: MOV AX, [_TokenType] CMP AX, 59 JZ .L13 JMP .L14 .L13: CALL _GetToken MOV AX, 18 JMP .L0 .L14: CALL _Unexpected .L15: .L12: .L9: .L6: CALL _GetToken .L16: MOV AX, [_TokenType] CMP AX, 23 JZ .L17 JMP .L18 .L17: MOV AX, [BP-2] ADD AX, 16 MOV [BP-2], AX CALL _GetToken JMP .L16 .L18: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _AddVarDecl: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = vd ADD SP, -8 MOV AX, [_ScopesCount] MOV [BP-10], AX CALL _Check ADD SP, 8 ADD SP, -8 MOV AX, [_Scopes] PUSH AX MOV AX, [_ScopesCount] SUB AX, 1 ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] CMP AX, 249 MOV AX, 1 JL .L1 DEC AL .L1: MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [_Scopes] PUSH AX MOV AX, [_ScopesCount] SUB AX, 1 ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] INC AX MOV [BX], AX MOV [BP-2], AX MOV AX, [_VarDeclType] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP+4] POP BX MOV [BX], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV WORD [BX], 0 MOV AX, [_VarDeclId] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP+6] POP BX MOV [BX], AX MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _ParseDecl: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = Type PUSH AX ; [BP-4] = Id CALL _ParseDeclSpecs MOV [BP-2], AX CALL _ExpectId MOV [BP-4], AX ADD SP, -8 MOV AX, [BP-2] MOV [BP-12], AX MOV AX, [BP-4] MOV [BP-10], AX CALL _AddVarDecl ADD SP, 8 JMP .L0 .L0: MOV SP, BP POP BP RET _PushScope: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = End ADD SP, -8 MOV AX, [_ScopesCount] CMP AX, 10 MOV AX, 1 JL .L1 DEC AL .L1: MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [_ScopesCount] AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AX, [_Scopes] PUSH AX MOV AX, [_ScopesCount] SUB AX, 1 ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-2], AX JMP .L4 .L3: MOV WORD [BP-2], -1 .L4: MOV AX, [_Scopes] PUSH AX MOV AX, [_ScopesCount] PUSH AX INC AX MOV [_ScopesCount], AX POP AX ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP-2] POP BX MOV [BX], AX ADD SP, 2 .L0: POP BP RET _PopScope: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [_ScopesCount] MOV [BP-8], AX CALL _Check ADD SP, 8 MOV AX, [_ScopesCount] DEC AX MOV [_ScopesCount], AX .L0: POP BP RET _DoCond: PUSH BP MOV BP, SP CALL _ParseExpr CALL _LvalToRval MOV AX, [_CurrentType] CMP AX, 1 JZ .L1 JMP .L2 .L1: JMP .L5 .L4: DB '%s', 9, '.L%d', 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-8], AX ADD SP, -8 MOV AX, [_CurrentVal] MOV [BP-16], AX CALL _GetJcc ADD SP, 8 MOV [BP-6], AX MOV AX, [BP+4] MOV [BP-4], AX CALL _Emit ADD SP, 8 JMP .L3 .L2: CALL _GetVal ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 3 MOV AX, 1 JZ .L6 DEC AL .L6: MOV [BP-8], AX CALL _Check ADD SP, 8 JMP .L8 .L7: DB 'AND', 9, 'AX, AX', 0 .L8: ADD SP, -8 MOV AX, .L7 MOV [BP-8], AX CALL _Emit ADD SP, 8 JMP .L10 .L9: DB 'JNZ', 9, '.L%d', 0 .L10: ADD SP, -8 MOV AX, .L9 MOV [BP-8], AX MOV AX, [BP+4] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L3: ADD SP, -8 MOV AX, [BP+6] MOV [BP-8], AX CALL _EmitJmp ADD SP, 8 .L0: POP BP RET _ParseStatement: PUSH BP MOV BP, SP MOV AX, [_BreakLabel] PUSH AX ; [BP-2] = OldBreak MOV AX, [_ContinueLabel] PUSH AX ; [BP-4] = OldContinue ADD SP, -8 MOV WORD [BP-12], 10 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: JMP .L3 .L2: MOV AX, [_TokenType] CMP AX, 5 JZ .L4 JMP .L5 .L4: CALL _ParseCompoundStatement JMP .L6 .L5: CALL _IsTypeStart AND AX, AX JNZ .L7 JMP .L8 .L7: PUSH AX ; [BP-6] = vd CALL _ParseDecl MOV [BP-6], AX ADD SP, -8 MOV WORD [BP-14], 11 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L10 JMP .L11 .L10: CALL _ParseAssignmentExpression CALL _LvalToRval CALL _GetVal MOV AX, [_CurrentType] CMP AX, 2 JZ .L13 JMP .L14 .L13: JMP .L17 .L16: DB 'CBW', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-14], AX CALL _Emit ADD SP, 8 JMP .L15 .L14: .L15: JMP .L12 .L11: .L12: MOV AX, [_LocalOffset] SUB AX, 2 MOV [_LocalOffset], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-6] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [_LocalOffset] POP BX MOV [BX], AX JMP .L19 .L18: DB 'PUSH', 9, 'AX', 9, '; [BP%+d] = %s', 0 .L19: ADD SP, -8 MOV AX, .L18 MOV [BP-14], AX MOV AX, [_LocalOffset] MOV [BP-12], AX ADD SP, -8 MOV AX, [_VarDeclId] PUSH AX MOV AX, [BP-6] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-22], AX CALL _IdText ADD SP, 8 MOV [BP-10], AX CALL _Emit ADD SP, 8 ADD SP, -8 MOV WORD [BP-14], 10 CALL _Expect ADD SP, 8 ADD SP, 2 JMP .L9 .L8: ADD SP, -8 MOV WORD [BP-12], 52 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L20 JMP .L21 .L20: MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-6] = CondLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-8] = BodyLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-10] = EndLabel MOV AX, [BP-6] PUSH AX ; [BP-12] = IterLabel ADD SP, -8 MOV WORD [BP-20], 3 CALL _Expect ADD SP, 8 MOV AX, [_TokenType] CMP AX, 10 JNZ .L23 JMP .L24 .L23: CALL _ParseExpr JMP .L25 .L24: .L25: ADD SP, -8 MOV WORD [BP-20], 10 CALL _Expect ADD SP, 8 ADD SP, -8 MOV AX, [BP-6] MOV [BP-20], AX CALL _EmitLocalLabel ADD SP, 8 MOV AX, [_TokenType] CMP AX, 10 JNZ .L26 JMP .L27 .L26: ADD SP, -8 MOV AX, [BP-8] MOV [BP-20], AX MOV AX, [BP-10] MOV [BP-18], AX CALL _DoCond ADD SP, 8 JMP .L28 .L27: ADD SP, -8 MOV AX, [BP-8] MOV [BP-20], AX CALL _EmitJmp ADD SP, 8 .L28: ADD SP, -8 MOV WORD [BP-20], 10 CALL _Expect ADD SP, 8 MOV AX, [_TokenType] CMP AX, 4 JNZ .L29 JMP .L30 .L29: MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [BP-12], AX ADD SP, -8 MOV AX, [BP-12] MOV [BP-20], AX CALL _EmitLocalLabel ADD SP, 8 CALL _ParseExpr ADD SP, -8 MOV AX, [BP-6] MOV [BP-20], AX CALL _EmitJmp ADD SP, 8 JMP .L31 .L30: .L31: ADD SP, -8 MOV WORD [BP-20], 4 CALL _Expect ADD SP, 8 ADD SP, -8 MOV AX, [BP-8] MOV [BP-20], AX CALL _EmitLocalLabel ADD SP, 8 MOV AX, [BP-10] MOV [_BreakLabel], AX MOV AX, [BP-12] MOV [_ContinueLabel], AX MOV AX, [_BCStackLevel] PUSH AX ; [BP-14] = OldBCStack MOV AX, [_LocalOffset] MOV [_BCStackLevel], AX CALL _ParseStatement MOV AX, [BP-14] MOV [_BCStackLevel], AX ADD SP, -8 MOV AX, [BP-12] MOV [BP-22], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV AX, [BP-10] MOV [BP-22], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, 10 JMP .L22 .L21: ADD SP, -8 MOV WORD [BP-12], 53 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L32 JMP .L33 .L32: MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-6] = IfLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-8] = ElseLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-10] = EndLabel ADD SP, -8 MOV WORD [BP-18], 3 CALL _Accept ADD SP, 8 ADD SP, -8 MOV AX, [BP-6] MOV [BP-18], AX MOV AX, [BP-8] MOV [BP-16], AX CALL _DoCond ADD SP, 8 ADD SP, -8 MOV WORD [BP-18], 4 CALL _Accept ADD SP, 8 ADD SP, -8 MOV AX, [BP-6] MOV [BP-18], AX CALL _EmitLocalLabel ADD SP, 8 CALL _ParseStatement ADD SP, -8 MOV AX, [BP-10] MOV [BP-18], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV AX, [BP-8] MOV [BP-18], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, -8 MOV WORD [BP-18], 50 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L35 JMP .L36 .L35: CALL _ParseStatement JMP .L37 .L36: .L37: ADD SP, -8 MOV AX, [BP-10] MOV [BP-18], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, 6 JMP .L34 .L33: ADD SP, -8 MOV WORD [BP-12], 55 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L38 JMP .L39 .L38: MOV AX, [_TokenType] CMP AX, 10 JNZ .L41 JMP .L42 .L41: CALL _ParseExpr CALL _LvalToRval CALL _GetVal JMP .L43 .L42: .L43: MOV AX, [_LocalOffset] AND AX, AX JNZ .L44 JMP .L45 .L44: MOV WORD [_ReturnUsed], 1 JMP .L46 .L45: .L46: ADD SP, -8 MOV AX, [_ReturnLabel] MOV [BP-12], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV WORD [BP-12], 10 CALL _Expect ADD SP, 8 JMP .L40 .L39: ADD SP, -8 MOV WORD [BP-12], 58 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L47 JMP .L48 .L47: MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-6] = StartLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-8] = BodyLabel MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX PUSH AX ; [BP-10] = EndLabel ADD SP, -8 MOV AX, [BP-6] MOV [BP-18], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, -8 MOV WORD [BP-18], 3 CALL _Expect ADD SP, 8 ADD SP, -8 MOV AX, [BP-8] MOV [BP-18], AX MOV AX, [BP-10] MOV [BP-16], AX CALL _DoCond ADD SP, 8 ADD SP, -8 MOV WORD [BP-18], 4 CALL _Expect ADD SP, 8 ADD SP, -8 MOV AX, [BP-8] MOV [BP-18], AX CALL _EmitLocalLabel ADD SP, 8 MOV AX, [BP-10] MOV [_BreakLabel], AX MOV AX, [BP-6] MOV [_ContinueLabel], AX MOV AX, [_BCStackLevel] PUSH AX ; [BP-12] = OldBCStack MOV AX, [_LocalOffset] MOV [_BCStackLevel], AX CALL _ParseStatement MOV AX, [BP-12] MOV [_BCStackLevel], AX ADD SP, -8 MOV AX, [BP-6] MOV [BP-20], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV AX, [BP-10] MOV [BP-20], AX CALL _EmitLocalLabel ADD SP, 8 ADD SP, 8 JMP .L49 .L48: ADD SP, -8 MOV WORD [BP-12], 46 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L50 JMP .L51 .L50: ADD SP, -8 MOV AX, [_BreakLabel] CMP AX, 0 MOV AX, 1 JNL .L53 DEC AL .L53: MOV [BP-12], AX CALL _Check ADD SP, 8 MOV AX, [_LocalOffset] PUSH AX MOV AX, [_BCStackLevel] POP CX CMP AX, CX JNZ .L54 JMP .L55 .L54: ADD SP, -8 MOV AX, [_BCStackLevel] PUSH AX MOV AX, [_LocalOffset] POP CX XCHG AX, CX SUB AX, CX MOV [BP-12], AX CALL _EmitAdjSp ADD SP, 8 JMP .L56 .L55: .L56: ADD SP, -8 MOV AX, [_BreakLabel] MOV [BP-12], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV WORD [BP-12], 10 CALL _Expect ADD SP, 8 JMP .L52 .L51: ADD SP, -8 MOV WORD [BP-12], 49 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L57 JMP .L58 .L57: ADD SP, -8 MOV AX, [_ContinueLabel] CMP AX, 0 MOV AX, 1 JNL .L60 DEC AL .L60: MOV [BP-12], AX CALL _Check ADD SP, 8 MOV AX, [_LocalOffset] PUSH AX MOV AX, [_BCStackLevel] POP CX CMP AX, CX JNZ .L61 JMP .L62 .L61: ADD SP, -8 MOV AX, [_BCStackLevel] PUSH AX MOV AX, [_LocalOffset] POP CX XCHG AX, CX SUB AX, CX MOV [BP-12], AX CALL _EmitAdjSp ADD SP, 8 JMP .L63 .L62: .L63: ADD SP, -8 MOV AX, [_ContinueLabel] MOV [BP-12], AX CALL _EmitJmp ADD SP, 8 ADD SP, -8 MOV WORD [BP-12], 10 CALL _Expect ADD SP, 8 JMP .L59 .L58: CALL _ParseExpr ADD SP, -8 MOV WORD [BP-12], 10 CALL _Expect ADD SP, 8 .L59: .L52: .L49: .L40: .L34: .L22: .L9: .L6: .L3: MOV AX, [BP-2] MOV [_BreakLabel], AX MOV AX, [BP-4] MOV [_ContinueLabel], AX ADD SP, 4 .L0: POP BP RET _ParseCompoundStatement: PUSH BP MOV BP, SP MOV AX, [_LocalOffset] PUSH AX ; [BP-2] = InitialOffset CALL _PushScope ADD SP, -8 MOV WORD [BP-10], 5 CALL _Expect ADD SP, 8 .L1: ADD SP, -8 MOV WORD [BP-10], 6 CALL _Accept ADD SP, 8 AND AX, AX JZ .L2 JMP .L3 .L2: CALL _ParseStatement JMP .L1 .L3: CALL _PopScope MOV AX, [BP-2] PUSH AX MOV AX, [_LocalOffset] POP CX CMP AX, CX JNZ .L5 JMP .L6 .L5: ADD SP, -8 MOV AX, [BP-2] PUSH AX MOV AX, [_LocalOffset] POP CX XCHG AX, CX SUB AX, CX MOV [BP-10], AX CALL _EmitAdjSp ADD SP, 8 MOV AX, [BP-2] MOV [_LocalOffset], AX JMP .L7 .L6: .L7: ADD SP, 2 .L0: POP BP RET _EmitGlobal: PUSH BP MOV BP, SP ADD SP, -8 MOV AX, [_VarDeclId] PUSH AX MOV AX, [BP+4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-8], AX CALL _EmitGlobalLabel ADD SP, 8 JMP .L2 .L1: DB 'DW', 9, '%d', 0 .L2: ADD SP, -8 MOV AX, .L1 MOV [BP-8], AX MOV AX, [BP+6] MOV [BP-6], AX CALL _Emit ADD SP, 8 .L0: POP BP RET _ParseExternalDefition: PUSH BP MOV BP, SP ADD SP, -8 MOV WORD [BP-8], 51 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: PUSH AX ; [BP-2] = id PUSH AX ; [BP-4] = vd ADD SP, -8 MOV WORD [BP-12], 5 CALL _Expect ADD SP, 8 MOV AX, 0 PUSH AX ; [BP-6] = EnumVal .L4: MOV AX, [_TokenType] CMP AX, 6 JNZ .L5 JMP .L6 .L5: CALL _ExpectId MOV [BP-2], AX ADD SP, -8 MOV WORD [BP-14], 11 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L7 JMP .L8 .L7: CALL _ParseAssignmentExpression ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L10 DEC AL .L10: MOV [BP-14], AX CALL _Check ADD SP, 8 MOV AX, [_CurrentVal] MOV [BP-6], AX JMP .L9 .L8: .L9: ADD SP, -8 MOV WORD [BP-14], 67 MOV AX, [BP-2] MOV [BP-12], AX CALL _AddVarDecl ADD SP, 8 MOV [BP-4], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP-6] POP BX MOV [BX], AX ADD SP, -8 MOV WORD [BP-14], 9 CALL _Accept ADD SP, 8 AND AX, AX JZ .L11 JMP .L12 .L11: JMP .L6 .L12: .L13: MOV AX, [BP-6] INC AX MOV [BP-6], AX JMP .L4 .L6: ADD SP, -8 MOV WORD [BP-14], 6 CALL _Expect ADD SP, 8 ADD SP, -8 MOV WORD [BP-14], 10 CALL _Expect ADD SP, 8 JMP .L0 .L2: .L3: CALL _ParseDecl PUSH AX ; [BP-2] = fd ADD SP, -8 MOV WORD [BP-10], 11 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L15 JMP .L16 .L15: CALL _ParseAssignmentExpression ADD SP, -8 MOV AX, [_CurrentType] CMP AX, 67 MOV AX, 1 JZ .L18 DEC AL .L18: MOV [BP-10], AX CALL _Check ADD SP, 8 ADD SP, -8 MOV AX, [BP-2] MOV [BP-10], AX MOV AX, [_CurrentVal] MOV [BP-8], AX CALL _EmitGlobal ADD SP, 8 ADD SP, -8 MOV WORD [BP-10], 10 CALL _Expect ADD SP, 8 JMP .L0 .L16: ADD SP, -8 MOV WORD [BP-10], 10 CALL _Accept ADD SP, 8 AND AX, AX JNZ .L19 JMP .L20 .L19: ADD SP, -8 MOV AX, [BP-2] MOV [BP-10], AX MOV WORD [BP-8], 0 CALL _EmitGlobal ADD SP, 8 JMP .L0 .L20: .L21: .L17: ADD SP, -8 MOV WORD [BP-10], 3 CALL _Expect ADD SP, 8 MOV AX, [_VarDeclType] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] OR AX, 8 MOV [BX], AX CALL _PushScope PUSH AX ; [BP-4] = ArgOffset PUSH AX ; [BP-6] = vd MOV WORD [BP-4], 4 .L22: MOV AX, [_TokenType] CMP AX, 4 JNZ .L23 JMP .L24 .L23: ADD SP, -8 MOV WORD [BP-14], 57 CALL _Accept ADD SP, 8 AND AX, AX JZ .L28 JMP .L29 .L28: ADD SP, -8 MOV WORD [BP-14], 45 CALL _Accept ADD SP, 8 .L29: AND AX, AX JNZ .L25 JMP .L26 .L25: JMP .L24 .L26: .L27: CALL _ParseDecl MOV [BP-6], AX MOV AX, [_VarDeclOffset] PUSH AX MOV AX, [BP-6] ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP-4] POP BX MOV [BX], AX MOV AX, [BP-4] ADD AX, 2 MOV [BP-4], AX ADD SP, -8 MOV WORD [BP-14], 9 CALL _Accept ADD SP, 8 AND AX, AX JZ .L30 JMP .L31 .L30: JMP .L24 .L31: .L32: JMP .L22 .L24: ADD SP, -8 MOV WORD [BP-14], 4 CALL _Expect ADD SP, 8 ADD SP, -8 MOV WORD [BP-14], 10 CALL _Accept ADD SP, 8 AND AX, AX JZ .L34 JMP .L35 .L34: MOV WORD [_LocalOffset], 0 MOV WORD [_ReturnUsed], 0 MOV WORD [_LocalLabelCounter], 0 MOV AX, [_LocalLabelCounter] PUSH AX INC AX MOV [_LocalLabelCounter], AX POP AX MOV [_ReturnLabel], AX MOV WORD [_ContinueLabel], -1 MOV WORD [_BreakLabel], -1 ADD SP, -8 MOV AX, [_VarDeclId] PUSH AX MOV AX, [BP-2] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV AX, [BX] MOV [BP-14], AX CALL _EmitGlobalLabel ADD SP, 8 JMP .L39 .L38: DB 'PUSH', 9, 'BP', 0 .L39: ADD SP, -8 MOV AX, .L38 MOV [BP-14], AX CALL _Emit ADD SP, 8 JMP .L41 .L40: DB 'MOV', 9, 'BP, SP', 0 .L41: ADD SP, -8 MOV AX, .L40 MOV [BP-14], AX CALL _Emit ADD SP, 8 CALL _ParseCompoundStatement ADD SP, -8 MOV AX, [_ReturnLabel] MOV [BP-14], AX CALL _EmitLocalLabel ADD SP, 8 MOV AX, [_ReturnUsed] AND AX, AX JNZ .L42 JMP .L43 .L42: JMP .L46 .L45: DB 'MOV', 9, 'SP, BP', 0 .L46: ADD SP, -8 MOV AX, .L45 MOV [BP-14], AX CALL _Emit ADD SP, 8 JMP .L44 .L43: .L44: JMP .L48 .L47: DB 'POP', 9, 'BP', 0 .L48: ADD SP, -8 MOV AX, .L47 MOV [BP-14], AX CALL _Emit ADD SP, 8 JMP .L50 .L49: DB 'RET', 0 .L50: ADD SP, -8 MOV AX, .L49 MOV [BP-14], AX CALL _Emit ADD SP, 8 JMP .L36 .L35: .L36: CALL _PopScope ADD SP, 6 .L0: MOV SP, BP POP BP RET _HeapStart: DW 0 _malloc: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ret MOV AX, [_HeapStart] MOV [BP-2], AX MOV AX, [BP+4] MOV CX, AX MOV AX, [_HeapStart] ADD AX, CX MOV [_HeapStart], AX ADD SP, -8 MOV AX, [_HeapStart] CMP AX, 32767 MOV AX, 1 JL .L1 DEC AL .L1: MOV [BP-10], AX CALL _Check ADD SP, 8 MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _exit: PUSH BP MOV BP, SP MOV AX, [BP+4] AND AX, 255 OR AX, 19456 MOV [BP+4], AX ADD SP, -8 LEA AX, [BP+4] MOV [BP-8], AX MOV WORD [BP-6], 0 MOV WORD [BP-4], 0 MOV WORD [BP-2], 0 CALL _DosCall ADD SP, 8 .L0: POP BP RET _putchar: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ax MOV WORD [BP-2], 512 ADD SP, -8 LEA AX, [BP-2] MOV [BP-10], AX MOV WORD [BP-8], 0 MOV WORD [BP-6], 0 MOV AX, [BP+4] MOV [BP-4], AX CALL _DosCall ADD SP, 8 ADD SP, 2 .L0: POP BP RET _open: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ax MOV AX, [BP+6] AND AX, AX JNZ .L1 JMP .L2 .L1: MOV WORD [BP-2], 15360 JMP .L3 .L2: MOV WORD [BP-2], 15616 .L3: ADD SP, -8 LEA AX, [BP-2] MOV [BP-10], AX MOV WORD [BP-8], 0 MOV WORD [BP-6], 0 MOV AX, [BP+4] MOV [BP-4], AX CALL _DosCall ADD SP, 8 AND AX, AX JNZ .L4 JMP .L5 .L4: MOV AX, -1 JMP .L0 .L5: .L6: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _close: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ax MOV WORD [BP-2], 15872 ADD SP, -8 LEA AX, [BP-2] MOV [BP-10], AX MOV AX, [BP+4] MOV [BP-8], AX MOV WORD [BP-6], 0 MOV WORD [BP-4], 0 CALL _DosCall ADD SP, 8 ADD SP, 2 .L0: POP BP RET _read: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ax MOV WORD [BP-2], 16128 ADD SP, -8 LEA AX, [BP-2] MOV [BP-10], AX MOV AX, [BP+4] MOV [BP-8], AX MOV AX, [BP+8] MOV [BP-6], AX MOV AX, [BP+6] MOV [BP-4], AX CALL _DosCall ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: MOV AX, 0 JMP .L0 .L2: .L3: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _write: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ax MOV WORD [BP-2], 16384 ADD SP, -8 LEA AX, [BP-2] MOV [BP-10], AX MOV AX, [BP+4] MOV [BP-8], AX MOV AX, [BP+8] MOV [BP-6], AX MOV AX, [BP+6] MOV [BP-4], AX CALL _DosCall ADD SP, 8 AND AX, AX JNZ .L1 JMP .L2 .L1: MOV AX, 0 JMP .L0 .L2: .L3: MOV AX, [BP-2] JMP .L0 .L0: MOV SP, BP POP BP RET _CallMain: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = Args PUSH AX ; [BP-4] = NumArgs MOV AX, [BP+6] PUSH AX MOV AX, [BP+4] POP CX ADD AX, CX MOV BX, AX MOV BYTE [BX], 0 ADD SP, -8 MOV WORD [BP-12], 20 CALL _malloc ADD SP, 8 MOV [BP-2], AX MOV AX, [BP-2] PUSH AX POP AX ADD AX, 0 JMP .L2 .L1: DB 'scc', 0 .L2: PUSH AX MOV AX, .L1 POP BX MOV [BX], AX MOV WORD [BP-4], 1 .L3: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L4 JMP .L5 .L4: .L6: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L9 JMP .L10 .L9: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW CMP AX, 32 MOV AX, 1 JNG .L11 DEC AL .L11: .L10: AND AX, AX JNZ .L7 JMP .L8 .L7: MOV AX, [BP+6] INC AX MOV [BP+6], AX JMP .L6 .L8: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JZ .L12 JMP .L13 .L12: JMP .L5 .L13: .L14: MOV AX, [BP-2] PUSH AX MOV AX, [BP-4] PUSH AX INC AX MOV [BP-4], AX POP AX ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [BP+6] POP BX MOV [BX], AX .L16: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L19 JMP .L20 .L19: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW CMP AX, 32 MOV AX, 1 JG .L21 DEC AL .L21: .L20: AND AX, AX JNZ .L17 JMP .L18 .L17: MOV AX, [BP+6] INC AX MOV [BP+6], AX JMP .L16 .L18: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JZ .L22 JMP .L23 .L22: JMP .L5 .L23: .L24: MOV AX, [BP+6] PUSH AX INC AX MOV [BP+6], AX POP AX MOV BX, AX MOV BYTE [BX], 0 JMP .L3 .L5: MOV AX, [BP-2] PUSH AX MOV AX, [BP-4] ADD AX, AX POP CX ADD AX, CX MOV BX, AX MOV WORD [BX], 0 ADD SP, -8 ADD SP, -8 MOV AX, [BP-4] MOV [BP-20], AX MOV AX, [BP-2] MOV [BP-18], AX CALL _main ADD SP, 8 MOV [BP-12], AX CALL _exit ADD SP, 8 ADD SP, 4 .L0: POP BP RET _MakeOutputFilename: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = LastDot MOV WORD [BP-2], 0 .L1: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW AND AX, AX JNZ .L2 JMP .L3 .L2: MOV AX, [BP+6] MOV BX, AX MOV AL, [BX] CBW CMP AX, 46 JZ .L4 JMP .L5 .L4: MOV AX, [BP+4] MOV [BP-2], AX JMP .L6 .L5: .L6: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX PUSH AX MOV AX, [BP+6] PUSH AX INC AX MOV [BP+6], AX POP AX MOV BX, AX MOV AL, [BX] CBW POP BX MOV [BX], AL JMP .L1 .L3: MOV AX, [BP-2] AND AX, AX JZ .L7 JMP .L8 .L7: MOV AX, [BP+4] MOV [BP-2], AX JMP .L9 .L8: .L9: ADD SP, -8 MOV AX, [BP-2] MOV [BP-10], AX JMP .L12 .L11: DB '.asm', 0 .L12: MOV AX, .L11 MOV [BP-8], AX CALL _CopyStr ADD SP, 8 MOV BX, AX MOV BYTE [BX], 0 ADD SP, 2 .L0: POP BP RET _AddBuiltins: PUSH BP MOV BP, SP PUSH AX ; [BP-2] = ch MOV AX, [_IdOffset] PUSH AX POP AX ADD AX, 0 MOV BX, AX MOV WORD [BX], 0 .L1: JMP .L2 .L2: MOV AX, [BP+4] PUSH AX INC AX MOV [BP+4], AX POP AX MOV BX, AX MOV AL, [BX] CBW MOV [BP-2], AL MOV AL, [BP-2] CBW CMP AX, 32 JNG .L4 JMP .L5 .L4: MOV AX, [_IdBuffer] PUSH AX MOV AX, [_IdBufferIndex] PUSH AX INC AX MOV [_IdBufferIndex], AX POP AX POP CX ADD AX, CX MOV BX, AX MOV BYTE [BX], 0 MOV AX, [_IdOffset] PUSH AX MOV AX, [_IdCount] INC AX MOV [_IdCount], AX ADD AX, AX POP CX ADD AX, CX PUSH AX MOV AX, [_IdBufferIndex] POP BX MOV [BX], AX MOV AL, [BP-2] CBW AND AX, AX JZ .L7 JMP .L8 .L7: JMP .L3 .L8: .L9: JMP .L6 .L5: MOV AX, [_IdBuffer] PUSH AX MOV AX, [_IdBufferIndex] PUSH AX INC AX MOV [_IdBufferIndex], AX POP AX POP CX ADD AX, CX PUSH AX MOV AL, [BP-2] CBW POP BX MOV [BX], AL .L6: JMP .L1 .L3: ADD SP, -8 MOV AX, [_IdCount] ADD AX, 46 SUB AX, 1 CMP AX, 62 MOV AX, 1 JZ .L11 DEC AL .L11: MOV [BP-10], AX CALL _Check ADD SP, 8 ADD SP, 2 .L0: POP BP RET _main: PUSH BP MOV BP, SP ADD SP, -8 MOV WORD [BP-8], 100 CALL _malloc ADD SP, 8 MOV [_LineBuf], AX ADD SP, -8 MOV WORD [BP-8], 32 CALL _malloc ADD SP, 8 MOV [_TempBuf], AX ADD SP, -8 MOV WORD [BP-8], 1024 CALL _malloc ADD SP, 8 MOV [_InBuf], AX ADD SP, -8 MOV WORD [BP-8], 4096 CALL _malloc ADD SP, 8 MOV [_IdBuffer], AX ADD SP, -8 MOV WORD [BP-8], 700 CALL _malloc ADD SP, 8 MOV [_IdOffset], AX ADD SP, -8 MOV WORD [BP-8], 500 CALL _malloc ADD SP, 8 MOV [_VarDeclId], AX ADD SP, -8 MOV WORD [BP-8], 500 CALL _malloc ADD SP, 8 MOV [_VarDeclType], AX ADD SP, -8 MOV WORD [BP-8], 500 CALL _malloc ADD SP, 8 MOV [_VarDeclOffset], AX ADD SP, -8 MOV WORD [BP-8], 20 CALL _malloc ADD SP, 8 MOV [_Scopes], AX MOV AX, [BP+4] CMP AX, 2 JL .L1 JMP .L2 .L1: JMP .L5 .L4: DB 'Usage: %s input-file', 10, 0 .L5: ADD SP, -8 MOV AX, .L4 MOV [BP-8], AX MOV AX, [BP+6] PUSH AX POP AX ADD AX, 0 MOV BX, AX MOV AX, [BX] MOV [BP-6], AX CALL _Printf ADD SP, 8 MOV AX, 1 JMP .L0 .L2: .L3: ADD SP, -8 MOV AX, [BP+6] PUSH AX POP AX ADD AX, 2 MOV BX, AX MOV AX, [BX] MOV [BP-8], AX MOV WORD [BP-6], 0 CALL _open ADD SP, 8 MOV [_InFile], AX MOV AX, [_InFile] CMP AX, 0 JL .L6 JMP .L7 .L6: JMP .L10 .L9: DB 'Error opening input file', 0 .L10: ADD SP, -8 MOV AX, .L9 MOV [BP-8], AX CALL _Fatal ADD SP, 8 JMP .L8 .L7: .L8: ADD SP, -8 MOV AX, [_IdBuffer] MOV [BP-8], AX MOV AX, [BP+6] PUSH AX POP AX ADD AX, 2 MOV BX, AX MOV AX, [BX] MOV [BP-6], AX CALL _MakeOutputFilename ADD SP, 8 ADD SP, -8 MOV AX, [_IdBuffer] MOV [BP-8], AX MOV WORD [BP-6], 1 MOV WORD [BP-4], 384 CALL _open ADD SP, 8 MOV [_OutFile], AX MOV AX, [_OutFile] CMP AX, 0 JL .L11 JMP .L12 .L11: JMP .L15 .L14: DB 'Error creating output file', 0 .L15: ADD SP, -8 MOV AX, .L14 MOV [BP-8], AX CALL _Fatal ADD SP, 8 JMP .L13 .L12: .L13: JMP .L17 .L16: DB 'break char const continue else enum for if int return sizeof void while va_list va_start va_end va_arg', 0 .L17: ADD SP, -8 MOV AX, .L16 MOV [BP-8], AX CALL _AddBuiltins ADD SP, 8 JMP .L19 .L18: DB 9, 'cpu 8086', 10, 9, 'org 0x100', 10, 'Start:', 10, 9, 'XOR', 9, 'BP, BP', 10, 9, 'MOV', 9, 'WORD [_HeapStart], ProgramEnd', 10, 9, 'MOV', 9, 'AX, 0x81', 10, 9, 'PUSH', 9, 'AX', 10, 9, 'MOV', 9, 'AL, [0x80]', 10, 9, 'PUSH', 9, 'AX', 10, 9, 'PUSH', 9, 'AX', 10, 9, 'JMP', 9, '_CallMain', 10, 10, '_DosCall:', 10, 9, 'PUSH', 9, 'BP', 10, 9, 'MOV', 9, 'BP, SP', 10, 9, 'MOV', 9, 'BX, [BP+4]', 10, 9, 'MOV', 9, 'AX, [BX]', 10, 9, 'MOV', 9, 'BX, [BP+6]', 10, 9, 'MOV', 9, 'CX, [BP+8]', 10, 9, 'MOV', 9, 'DX, [BP+10]', 10, 9, 'INT', 9, '0x21', 10, 9, 'MOV', 9, 'BX, [BP+4]', 10, 9, 'MOV', 9, '[BX], AX', 10, 9, 'MOV', 9, 'AX, 0', 10, 9, 'SBB', 9, 'AX, AX', 10, 9, 'POP', 9, 'BP', 10, 9, 'RET', 10, 10, 0 .L19: ADD SP, -8 MOV AX, .L18 MOV [BP-8], AX CALL _OutputStr ADD SP, 8 CALL _PushScope CALL _GetToken .L20: MOV AX, [_TokenType] CMP AX, 0 JNZ .L21 JMP .L22 .L21: CALL _ParseExternalDefition JMP .L20 .L22: CALL _PopScope JMP .L24 .L23: DB 10, 'ProgramEnd:', 10, 0 .L24: ADD SP, -8 MOV AX, .L23 MOV [BP-8], AX CALL _OutputStr ADD SP, 8 ADD SP, -8 MOV AX, [_InFile] MOV [BP-8], AX CALL _close ADD SP, 8 ADD SP, -8 MOV AX, [_OutFile] MOV [BP-8], AX CALL _close ADD SP, 8 MOV AX, 0 JMP .L0 .L0: POP BP RET ProgramEnd:
Task/Doubly-linked-list-Element-definition/Ada/doubly-linked-list-element-definition-2.ada
LaudateCorpus1/RosettaCodeData
1
13528
generic type Element_Type is private; package Linked_List is type List_Type is limited private; ... private type List_Element; type List_Element_Ptr is access list_element; type List_Element is record Prev : List_Element_Ptr; Data : Element_Type; Next : List_Element_Ptr; end record; type List_Type is record Head : List_Element_Ptr; -- Pointer to first element. Tail : List_Element_Ptr; -- Pointer to last element. Cursor : List_Element_Ptr; -- Pointer to cursor element. Count : Natural := 0; -- Number of items in list. Traversing : Boolean := False; -- True when in a traversal. end record; end Linked_List;
Cores/Mednafen/mednafen/tests/apple2/decimal/decimal.asm
ianclawson/Provenance
3,459
24913
; ; xa -o decimal.bin decimal.asm && ../bintodsk decimal.bin decimal.dsk ; PRBYTE = $FDDA HOME = $FC58 CROUT = $FD8E * = $800 .byte $10 entry: jsr HOME instr_loop: jsr init_crc ; ; ; instridx: ldx #$01 lda instrtab, X sta instr+0 lda #$07 sta flags+1 flags_loop: arg_loop: accum_loop: flags: ldx #$00 lda flagstab, X pha accum: lda #$00 plp instr: adc #$00 php jsr update_crc pla jsr update_crc inc accum+1 bne accum_loop inc instr+1 bne arg_loop dec flags+1 bpl flags_loop cld jsr print_crc dec instridx+1 bpl instr_loop end: jmp end #include "../crc.inc" instrtab: .byte $E9, $69 flagstab: .byt $00, $01, $08, $09, $f6, $f7, $fe, $ff
libsrc/_DEVELOPMENT/adt/p_list/c/sdcc_iy/p_list_prev_fastcall.asm
meesokim/z88dk
0
89670
; void *p_list_prev_fastcall(void *item) SECTION code_adt_p_list PUBLIC _p_list_prev_fastcall _p_list_prev_fastcall: INCLUDE "adt/p_list/z80/asm_p_list_prev.asm"
libsrc/_DEVELOPMENT/stdlib/c/sccz80/at_quick_exit.asm
jpoikela/z88dk
640
241351
; int at_quick_exit(void (*func)(void)) SECTION code_clib SECTION code_stdlib PUBLIC at_quick_exit EXTERN asm_at_quick_exit defc at_quick_exit = asm_at_quick_exit
formalization/agda/Spire/Hybrid.agda
spire/spire
43
4976
<filename>formalization/agda/Spire/Hybrid.agda open import Spire.Type module Spire.Hybrid where ---------------------------------------------------------------------- data Context : Set₁ Environment : Context → Set ScopedType : Context → Set₁ ScopedType Γ = Environment Γ → Set data Context where ∅ : Context _,_ : (Γ : Context) (A : ScopedType Γ) → Context Environment ∅ = ⊤ Environment (Γ , A) = Σ (Environment Γ) A data Var : (Γ : Context) (A : ScopedType Γ) → Set₁ where here : ∀{Γ A} → Var (Γ , A) (λ vs → A (proj₁ vs)) there : ∀{Γ A} {B : ScopedType Γ} → Var Γ A → Var (Γ , B) (λ vs → A (proj₁ vs)) lookup : ∀{Γ A} → Var Γ A → (vs : Environment Γ) → A vs lookup here (vs , v) = v lookup (there i) (vs , v) = lookup i vs ScopedType₂ : (Γ : Context) → ScopedType Γ → Set₁ ScopedType₂ Γ A = (vs : Environment Γ) → A vs → Set ---------------------------------------------------------------------- data Term (Γ : Context) : ScopedType Γ → Set₁ eval : ∀{Γ A} → Term Γ A → (vs : Environment Γ) → A vs -- ---------------------------------------------------------------------- data Term Γ where {- Type introduction -} `⊥ `⊤ `Bool `ℕ `Type : ∀{ℓ} → Term Γ (const (Type ℓ)) `Π `Σ : ∀{ℓ} (A : Term Γ (const (Type ℓ))) (B : Term (Γ , λ vs → ⟦ ℓ ∣ eval A vs ⟧) (const (Type ℓ))) → Term Γ (λ _ → Type ℓ) `⟦_⟧ : ∀{ℓ} (A : Term Γ (const (Type ℓ))) → Term Γ (const (Type (suc ℓ))) {- Value introduction -} `tt : Term Γ (const ⊤) `true `false : Term Γ (const Bool) `zero : Term Γ (const ℕ) `suc : Term Γ (const ℕ) → Term Γ (const ℕ) `λ : ∀{A} {B : ScopedType₂ Γ A} (f : Term (Γ , A) (λ vs → B (proj₁ vs) (proj₂ vs))) → Term Γ (λ vs → (v : A vs) → (B vs v)) _`,_ : ∀{A} {B : ScopedType₂ Γ A} (a : Term Γ A) (b : Term Γ (λ vs → B vs (eval a vs))) → Term Γ (λ vs → Σ (A vs) (λ v → B vs v)) {- Value elimination -} `var : ∀{A} (a : Var Γ A) → Term Γ A `elim⊥ : ∀{A ℓ} (P : Term Γ (const (Type ℓ))) (x : Term Γ (const ⊥)) → Term Γ A `elimBool : ∀{ℓ} (P : Term (Γ , const Bool) (const (Type ℓ))) (pt : Term Γ (λ vs → ⟦ ℓ ∣ eval P (vs , true) ⟧)) (pf : Term Γ (λ vs → ⟦ ℓ ∣ eval P (vs , false) ⟧)) (b : Term Γ (const Bool)) → Term Γ (λ vs → ⟦ ℓ ∣ eval P (vs , eval b vs) ⟧) `elimℕ : ∀{ℓ} (P : Term (Γ , (const ℕ)) (const (Type ℓ))) (pz : Term Γ (λ vs → ⟦ ℓ ∣ eval P (vs , zero) ⟧)) (ps : Term ((Γ , const ℕ) , (λ { (vs , n) → ⟦ ℓ ∣ eval P (vs , n) ⟧ })) (λ { ((vs , n) , p) → ⟦ ℓ ∣ eval P (vs , suc n) ⟧ })) (n : Term Γ (const ℕ)) → Term Γ (λ vs → ⟦ ℓ ∣ eval P (vs , eval n vs) ⟧) _`$_ : ∀{A} {B : ScopedType₂ Γ A} (f : Term Γ (λ vs → (v : A vs) → (B vs v))) (a : Term Γ A) → Term Γ (λ vs → B vs (eval a vs)) `proj₁ : ∀{A} {B : ScopedType₂ Γ A} (ab : Term Γ (λ vs → Σ (A vs) (B vs))) → Term Γ A `proj₂ : ∀{A} {B : ScopedType₂ Γ A} (ab : Term Γ (λ vs → Σ (A vs) (B vs))) → Term Γ (λ vs → B vs (proj₁ (eval ab vs))) ---------------------------------------------------------------------- {- Type introduction -} eval `⊥ vs = `⊥ eval `⊤ vs = `⊤ eval `Bool vs = `Bool eval `ℕ vs = `ℕ eval `Type vs = `Type eval (`Π A B) vs = `Π (eval A vs) λ v → eval B (vs , v) eval (`Σ A B) vs = `Σ (eval A vs) λ v → eval B (vs , v) eval `⟦ A ⟧ vs = `⟦ eval A vs ⟧ {- Value introduction -} eval `tt vs = tt eval `true vs = true eval `false vs = false eval `zero vs = zero eval (`suc n) vs = suc (eval n vs) eval (`λ f) vs = λ v → eval f (vs , v) eval (a `, b) vs = eval a vs , eval b vs {- Value elimination -} eval (`var i) vs = lookup i vs eval (`elim⊥ P x) vs = elim⊥ (eval x vs) eval (`elimBool {ℓ} P pt pf b) vs = elimBool (λ v → ⟦ ℓ ∣ eval P (vs , v) ⟧) (eval pt vs) (eval pf vs) (eval b vs) eval (`elimℕ {ℓ} P pz ps n) vs = elimℕ (λ v → ⟦ ℓ ∣ eval P (vs , v) ⟧) (eval pz vs) (λ n rec → eval ps ((vs , n) , rec)) (eval n vs) eval (f `$ a) vs = (eval f vs) (eval a vs) eval (`proj₁ ab) vs = proj₁ (eval ab vs) eval (`proj₂ ab) vs = proj₂ (eval ab vs) ----------------------------------------------------------------------
programs/oeis/083/A083423.asm
neoneye/loda
22
164473
<reponame>neoneye/loda<gh_stars>10-100 ; A083423: a(n) = (5*3^n + (-3)^n)/6. ; 1,2,9,18,81,162,729,1458,6561,13122,59049,118098,531441,1062882,4782969,9565938,43046721,86093442,387420489,774840978,3486784401,6973568802,31381059609,62762119218,282429536481,564859072962 mov $1,1 sub $1,$0 gcd $1,2 lpb $0 sub $0,2 mul $1,9 lpe mov $0,$1
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c37312a.ada
best08618/asylo
7
21105
-- C37312A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A DISCRIMINANT CAN HAVE A GENERIC FORMAL DISCRETE -- TYPE WHEN IT DOES NOT GOVERN A VARIANT PART AND THAT AN -- OBJECT OF A GENERIC FORMAL TYPE CAN CONSTRAIN A COMPONENT -- IN A VARIANT PART. -- HISTORY: -- AH 08/22/86 CREATED ORIGINAL TEST. -- JET 08/13/87 REVISED FROM CLASS 'A' TO CLASS 'C' TEST. WITH REPORT; USE REPORT; PROCEDURE C37312A IS BEGIN TEST ("C37312A", "DISCRIMINANT TYPE IS GENERIC FORMAL TYPE"); DECLARE TYPE T IS RANGE 1 ..5; GENERIC TYPE G1 IS RANGE <>; PACKAGE P IS TYPE G2 (D1 : G1) IS RECORD R1 : G1; R2 : BOOLEAN; END RECORD; TYPE STR IS ARRAY(G1 RANGE <>) OF INTEGER; TYPE G3 (D : G1; E : INTEGER) IS RECORD CASE E IS WHEN 1 => S1 : STR(G1'FIRST..D); WHEN OTHERS => S2 : INTEGER; END CASE; END RECORD; END P; PACKAGE PKG IS NEW P (G1 => T); USE PKG; A2: G2(1) := (1, 5, FALSE); A3: G3(5, 1) := (5, 1, (1, 2, 3, 4, 5)); BEGIN A2.R2 := IDENT_BOOL (TRUE); A3.S1(1) := IDENT_INT (6); IF A2 /= (1, 5, TRUE) THEN FAILED ("INVALID CONTENTS OF RECORD A2"); END IF; IF A3 /= (5, 1, (6, 2, 3, 4, 5)) THEN FAILED ("INVALID CONTENTS OF RECORD A3"); END IF; END; RESULT; END C37312A;
oMiser/mockups/antlr4/Miser.g4
rnd0101/miser
1
7426
grammar Miser; program : ob '.'; ob : i | '(' ob ')' | pair | enclosure; pair : '(' ob C ob ')'; enclosure : D ob; i : individual | primitive | lindy | evbinop | evunop | evref; individual : I; primitive : P; evref : EVREF; evbinop : EVBINOP; evunop : EVUNOP; EVBINOP : 'C' | 'D'; EVUNOP : 'EV'; EVREF : 'SELF' | 'ARG' ; I : [a-z]+; P : 'NIL' | 'A' | 'B' | 'E' ; D : '`'; C : '::'; lindy : LINDY; LINDY : '"' [a-zA-Z0-9_]+ '"'; WS : [ \t\r\n]+ -> skip ;
src/main/antlr4/imports/mysql_literal_tokens.g4
HieuMinh0609/kafka-maxwell
0
5450
<reponame>HieuMinh0609/kafka-maxwell // This file is automatically generated by src/main/antlr4/imports/generate_tokens.rb grammar mysql_literal_tokens; tokens_available_for_names: (ACTION | AFTER | ALGORITHM | AUTO_INCREMENT | AVG_ROW_LENGTH | BEGIN | BIT | BOOL | BOOLEAN | BTREE | CHARSET | CHECKSUM | COLUMN_FORMAT | COMMENT | COMPACT | COMPRESSED | CONNECTION | COPY | DATA | DATE | DATETIME | DEFINER | DELAY_KEY_WRITE | DIRECTORY | DISABLE | DISK | DYNAMIC | ENABLE | ENGINE | ENUM | EXCLUSIVE | FIRST | FIXED | FULL | HASH | INPLACE | INSERT_METHOD | INVOKER | KEY_BLOCK_SIZE | LAST | MAX_ROWS | MEMORY | MERGE | MIN_ROWS | MODIFY | NAME | NO | NONE | NOW | OFFLINE | ONLINE | PACK_KEYS | PARSER | PARTIAL | PASSWORD | REDUNDANT | ROW_FORMAT | SECURITY | SHARED | SIMPLE | STORAGE | TABLESPACE | TEMPORARY | TEMPTABLE | TEXT | TIME | TIMESTAMP | UNDEFINED | UPGRADE | VIEW | YEAR); INT1: I N T '1'; INT2: I N T '2'; INT3: I N T '3'; INT4: I N T '4'; INT8: I N T '8'; ACTION: A C T I O N; ADD: A D D; AFTER: A F T E R; ALGORITHM: A L G O R I T H M; ALTER: A L T E R; AS: A S; ASC: A S C; AUTO_INCREMENT: A U T O '_' I N C R E M E N T; AVG_ROW_LENGTH: A V G '_' R O W '_' L E N G T H; BEGIN: B E G I N; BIGINT: B I G I N T; BINARY: B I N A R Y; BIT: B I T; BLOB: B L O B; BOOL: B O O L; BOOLEAN: B O O L E A N; BTREE: B T R E E; BY: B Y; CASCADE: C A S C A D E; CHANGE: C H A N G E; CHAR: C H A R; CHARACTER: C H A R A C T E R; CHARSET: C H A R S E T; CHECKSUM: C H E C K S U M; COLLATE: C O L L A T E; COLUMN: C O L U M N; COLUMN_FORMAT: C O L U M N '_' F O R M A T; COMMENT: C O M M E N T; COMPACT: C O M P A C T; COMPRESSED: C O M P R E S S E D; CONNECTION: C O N N E C T I O N; CONSTRAINT: C O N S T R A I N T; CONVERT: C O N V E R T; COPY: C O P Y; CREATE: C R E A T E; CURRENT_TIMESTAMP: C U R R E N T '_' T I M E S T A M P; CURRENT_USER: C U R R E N T '_' U S E R; DATA: D A T A; DATABASE: D A T A B A S E; DATE: D A T E; DATETIME: D A T E T I M E; DECIMAL: D E C I M A L; DEFAULT: D E F A U L T; DEFINER: D E F I N E R; DELAY_KEY_WRITE: D E L A Y '_' K E Y '_' W R I T E; DELETE: D E L E T E; DESC: D E S C; DIRECTORY: D I R E C T O R Y; DISABLE: D I S A B L E; DISK: D I S K; DOUBLE: D O U B L E; DROP: D R O P; DYNAMIC: D Y N A M I C; ENABLE: E N A B L E; ENGINE: E N G I N E; ENUM: E N U M; EXCLUSIVE: E X C L U S I V E; EXISTS: E X I S T S; FALSE: F A L S E; FIRST: F I R S T; FIXED: F I X E D; FLOAT: F L O A T; FOREIGN: F O R E I G N; FULL: F U L L; FULLTEXT: F U L L T E X T; HASH: H A S H; IF: I F; IGNORE: I G N O R E; INDEX: I N D E X; INPLACE: I N P L A C E; INSERT_METHOD: I N S E R T '_' M E T H O D; INT: I N T; INTEGER: I N T E G E R; INVOKER: I N V O K E R; KEY: K E Y; KEYS: K E Y S; KEY_BLOCK_SIZE: K E Y '_' B L O C K '_' S I Z E; LAST: L A S T; LIKE: L I K E; LOCK: L O C K; LONG: L O N G; LONGBLOB: L O N G B L O B; LONGTEXT: L O N G T E X T; MATCH: M A T C H; MAX_ROWS: M A X '_' R O W S; MEDIUMBLOB: M E D I U M B L O B; MEDIUMINT: M E D I U M I N T; MEDIUMTEXT: M E D I U M T E X T; MEMORY: M E M O R Y; MERGE: M E R G E; MIN_ROWS: M I N '_' R O W S; MODIFY: M O D I F Y; NAME: <NAME>; NO: N O; NONE: N O N E; NOT: N O T; NOW: N O W; NULL: N U L L; NUMERIC: N U M E R I C; OFFLINE: O F F L I N E; ON: O N; ONLINE: O N L I N E; OR: O R; ORDER: O R D E R; PACK_KEYS: P A C K '_' K E Y S; PARSER: P A R S E R; PARTIAL: P A R T I A L; PASSWORD: <PASSWORD>; PRIMARY: P R I M A R Y; REAL: R E A L; REDUNDANT: R E D U N D A N T; REFERENCES: R E F E R E N C E S; RENAME: R E N A M E; REPLACE: R E P L A C E; RESTRICT: R E S T R I C T; ROW_FORMAT: R O W '_' F O R M A T; SCHEMA: S C H E M A; SECURITY: S E C U R I T Y; SET: S E T; SHARED: S H A R E D; SIMPLE: S I M P L E; SMALLINT: S M A L L I N T; SPATIAL: S P A T I A L; SQL: S Q L; STORAGE: S T O R A G E; TABLE: T A B L E; TABLESPACE: T A B L E S P A C E; TEMPORARY: T E M P O R A R Y; TEMPTABLE: T E M P T A B L E; TEXT: T E X T; TIME: T I M E; TIMESTAMP: T I M E S T A M P; TINYBLOB: T I N Y B L O B; TINYINT: T I N Y I N T; TINYTEXT: T I N Y T E X T; TO: T O; TRUE: T R U E; UNDEFINED: U N D E F I N E D; UNION: U N I O N; UNIQUE: U N I Q U E; UNSIGNED: U N S I G N E D; UPDATE: U P D A T E; UPGRADE: U P G R A D E; USING: U S I N G; VARBINARY: V A R B I N A R Y; VARCHAR: V A R C H A R; VIEW: V I E W; WITH: W I T H; YEAR: Y E A R; ZEROFILL: Z E R O F I L L; fragment A: [Aa]; fragment B: [Bb]; fragment C: [Cc]; fragment D: [Dd]; fragment E: [Ee]; fragment F: [Ff]; fragment G: [Gg]; fragment H: [Hh]; fragment I: [Ii]; fragment J: [Jj]; fragment K: [Kk]; fragment L: [Ll]; fragment M: [Mm]; fragment N: [Nn]; fragment O: [Oo]; fragment P: [Pp]; fragment Q: [Qq]; fragment R: [Rr]; fragment S: [Ss]; fragment T: [Tt]; fragment U: [Uu]; fragment V: [Vv]; fragment W: [Ww]; fragment X: [Xx]; fragment Y: [Yy]; fragment Z: [Zz];
icfp2014/Lib.agda
luminousfennell/polybta
1
4662
module Lib where open import Data.Nat public hiding (_<_) open import Function public using (_∘_) open import Data.List public open import Data.Product public using (_×_ ; _,_ ; proj₁ ; proj₂ ; Σ ; ∃) open import Data.Sum public using (_⊎_ ; [_,_]′ ; inj₁ ; inj₂) open import Relation.Nullary public open import Relation.Binary.PropositionalEquality public hiding ([_]) open import Category.Functor public -- Pointer into a list. It is similar to list membership as defined in -- Data.List.AnyMembership, rather than going through propositional -- equality, it asserts the existence of the referenced element -- directly. infix 4 _∈_ data _∈_ {A : Set} : A → List A → Set where hd : ∀ {x xs} → x ∈ (x ∷ xs) tl : ∀ {x y xs} → x ∈ xs → x ∈ (y ∷ xs) mapIdx : {A B : Set} → (f : A → B) → {x : A} {xs : List A} → x ∈ xs → f x ∈ map f xs mapIdx f hd = hd mapIdx f (tl x₁) = tl (mapIdx f x₁)
test/Succeed/Issue229.agda
cruhland/agda
1,989
15787
{-# OPTIONS --universe-polymorphism #-} module Issue229 where open import Common.Level data Works a b : Set (lsuc a ⊔ lsuc b) where w : (A : Set a)(B : Set b) → Works a b record Doesn'tWork a b : Set (lsuc a ⊔ lsuc b) where field A : Set a B : Set b -- An internal error has occurred. Please report this as a bug. -- Location of the error: src/full/Agda/Interaction/Highlighting/Generate.hs:469
antlr-grammars/dlvhex/DLVHEXLexer.g4
DomenicoIngrati/EmbASP
1
5281
lexer grammar DLVHEXLexer; HEADER : 'DLVHEX '.*?NL-> skip; WHITE_SPACE: (NL|WS)-> skip; COLON : ':'; COMMA : ','; COST_BEGIN : '<'; COST_END : '>'; INTEGER : '0'|[1-9][0-9]*; LEVEL_BEGIN: '['; LEVEL_END : ']'; GROUND_QUERY_BEGIN: ' is '-> mode(IN_GROUND_QUERY); ANSWER_SET_BEGIN: '{'; ANSWER_SET_END : '}'; IDENTIFIER : [a-zA-Z][a-zA-Z0-9_]*; STRING_CONSTANT : '"'~["]*'"'; TERMS_BEGIN : '('; TERMS_END : ')'; mode IN_GROUND_QUERY; REASONING : 'bravely'|'cautiously'; DOT : '.'-> mode(DEFAULT_MODE); BOOLEAN : 'false'|'true'; WHITESPACE_IN_GROUND_QUERY: (NL|WS)-> skip; WITNESS_LABEL : ', evidenced by'-> mode(DEFAULT_MODE); fragment NL: [\n\r]; fragment WS: [ \t];
src/firmware/Platform/Lcd/Poll.asm
pete-restall/Cluck2Sesame-Prototype
1
26184
<reponame>pete-restall/Cluck2Sesame-Prototype #define __CLUCK2SESAME_PLATFORM_LCD_POLL_ASM #include "Platform.inc" #include "TailCalls.inc" #include "TableJumps.inc" #include "PollChain.inc" #include "States.inc" radix decimal extern POLL_AFTER_LCD Lcd code global pollLcd global pollNextInChainAfterLcd pollLcd: .unknownBank tableDefinitionToJumpWith lcdState createLcdStateTable pollNextInChainAfterLcd: tcall POLL_AFTER_LCD end
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_488.asm
ljhsiun2/medusa
9
16866
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xfd6d, %rsi lea addresses_normal_ht+0x10f6d, %rdi nop nop nop nop and $52899, %r11 mov $43, %rcx rep movsq nop sub $22078, %r15 lea addresses_normal_ht+0xc56d, %rsi lea addresses_WT_ht+0x2d65, %rdi clflush (%rsi) nop nop nop nop dec %rbx mov $102, %rcx rep movsl nop nop nop nop nop inc %rsi lea addresses_A_ht+0x1d96d, %r15 nop sub %rsi, %rsi movl $0x61626364, (%r15) xor $56844, %r15 lea addresses_WT_ht+0x1ad2d, %rbx nop nop nop add $19059, %rbp mov (%rbx), %r11 add $53360, %r15 lea addresses_WT_ht+0xb96d, %rbp add %rdi, %rdi mov $0x6162636465666768, %r11 movq %r11, (%rbp) sub $33415, %r11 lea addresses_WC_ht+0x436d, %rsi lea addresses_normal_ht+0xc16d, %rdi nop nop nop add $18619, %r11 mov $124, %rcx rep movsq nop nop nop cmp $25429, %r15 lea addresses_A_ht+0x8822, %rsi lea addresses_UC_ht+0x15b6d, %rdi nop and %rdx, %rdx mov $107, %rcx rep movsb nop nop nop nop inc %rdx lea addresses_A_ht+0x1976d, %rsi lea addresses_normal_ht+0x1756d, %rdi nop nop nop add $42190, %rdx mov $65, %rcx rep movsq nop add %rbp, %rbp lea addresses_A_ht+0x11d79, %rsi lea addresses_WC_ht+0x1142d, %rdi nop nop nop cmp %r15, %r15 mov $126, %rcx rep movsw nop nop nop nop xor $64633, %rdx lea addresses_WT_ht+0x1a56d, %rdx nop nop nop cmp %rbx, %rbx mov $0x6162636465666768, %r11 movq %r11, %xmm1 vmovups %ymm1, (%rdx) nop nop xor %r15, %r15 lea addresses_WC_ht+0xd6d, %rsi nop nop nop nop nop cmp %rbp, %rbp mov $0x6162636465666768, %rbx movq %rbx, %xmm1 movups %xmm1, (%rsi) nop nop nop nop cmp $25957, %rbp lea addresses_WT_ht+0x1d9ed, %r11 nop xor $51027, %r15 mov $0x6162636465666768, %rdx movq %rdx, %xmm5 vmovups %ymm5, (%r11) nop nop nop nop nop dec %rbp lea addresses_WC_ht+0xe76d, %rbp nop nop nop nop nop sub %rdx, %rdx mov $0x6162636465666768, %r15 movq %r15, %xmm5 movups %xmm5, (%rbp) nop nop xor %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %r9 push %rcx push %rdx // Faulty Load lea addresses_normal+0x1ed6d, %rcx nop nop nop sub $1552, %r10 vmovups (%rcx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rdx lea oracles, %r13 and $0xff, %rdx shlq $12, %rdx mov (%r13,%rdx,1), %rdx pop %rdx pop %rcx pop %r9 pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}} {'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 */
zipdcf/src/zipdcf.adb
onox/dcf-ada
5
10752
<gh_stars>1-10 -- SPDX-License-Identifier: MIT -- -- Copyright (c) 2019 onox <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. with Ada.Command_Line; with Ada.Directories; with Ada.Streams; with Ada.Strings.Fixed; with Ada.Strings.Unbounded; with Ada.Text_IO; with DCF.Streams.Calendar; with DCF.Zip.Compress; with DCF.Zip.Create; use Ada.Command_Line; use Ada.Text_IO; procedure ZipDCF is package Dirs renames Ada.Directories; package SU renames Ada.Strings.Unbounded; Quiet : Boolean := False; Add_Directories : Boolean := True; Recursive : Boolean := False; Junk_Directories : Boolean := False; Comment : SU.Unbounded_String; Compression_Method : DCF.Zip.Compress.Compression_Method := DCF.Zip.Compress.Deflate_2; Last_Option : Natural := 0; procedure Help is begin Put_Line ("ZipDCF " & DCF.Zip.Version & " - create document container files"); New_Line; Put_Line ("Usage: zipdcf [-options] [-z comment] file list"); New_Line; Put_Line (" -D no directory entries -q quiet mode"); Put_Line (" -r recurse into directories -j junk directory structure"); Put_Line (" -0 store files uncompressed"); Put_Line (" -1 use faster compression -z add archive file comment"); Put_Line (" -9 use better compression"); end Help; function Maybe_Trash_Dir (Name : String) return String is Index : constant Natural := Ada.Strings.Fixed.Index (Name, "/", Ada.Strings.Backward); begin return (if Junk_Directories then Name (Index + 1 .. Name'Last) else Name); end Maybe_Trash_Dir; begin if Argument_Count = 0 then Help; return; end if; for I in 1 .. Argument_Count loop if Argument (I) (1) = '-' then if Last_Option = I then null; -- Argument for a previous option else Last_Option := I; if Argument (I)'Length = 1 then Help; return; end if; for J in 2 .. Argument (I)'Last loop case Argument (I) (J) is when 'D' => Add_Directories := False; when 'r' => Recursive := True; when '0' => Compression_Method := DCF.Zip.Compress.Store; when '1' => Compression_Method := DCF.Zip.Compress.Deflate_1; when '9' => Compression_Method := DCF.Zip.Compress.Deflate_3; when 'q' => Quiet := True; when 'j' => Junk_Directories := True; when 'z' => if I = Argument_Count then Help; return; end if; Comment := SU.To_Unbounded_String (Argument (I + 1)); Last_Option := I + 1; when others => Help; return; end case; end loop; end if; end if; end loop; if Argument_Count = Last_Option then Help; return; end if; declare Archive : constant String := Argument (Last_Option + 1); begin if Dirs.Exists (Archive) then Put_Line ("Archive file '" & Archive & "' already exists"); return; end if; if not Quiet then Put_Line ("Archive: " & Archive); end if; declare Archive_Stream : aliased DCF.Streams.File_Zipstream := DCF.Streams.Create (Archive); Info : DCF.Zip.Create.Zip_Create_Info; procedure Add_File (Path : String) is Name : constant String := Maybe_Trash_Dir (Path); begin if not Dirs.Exists (Path) then Put_Line ("warning: " & Name & " does not exist"); return; end if; declare use all type Dirs.File_Kind; File_Is_Directory : constant Boolean := Dirs.Kind (Path) = Directory; begin if not File_Is_Directory then if not Quiet then Put_Line (" adding: " & Name); end if; declare File_Stream : aliased DCF.Streams.File_Zipstream := DCF.Streams.Open (Path); begin DCF.Streams.Set_Name (File_Stream, Name); DCF.Streams.Set_Time (File_Stream, DCF.Streams.Calendar.Convert (Dirs.Modification_Time (Path))); DCF.Zip.Create.Add_Stream (Info, File_Stream); end; else if Add_Directories then if not Quiet then Put_Line (" adding: " & Name & '/'); end if; declare Empty_Array : aliased Ada.Streams.Stream_Element_Array := (1 .. 0 => <>); Dir_Stream : aliased DCF.Streams.Array_Zipstream (Empty_Array'Access); begin DCF.Streams.Set_Name (Dir_Stream, Name & '/'); DCF.Streams.Set_Time (Dir_Stream, DCF.Streams.Calendar.Convert (Dirs.Modification_Time (Path))); DCF.Zip.Create.Add_Stream (Info, Dir_Stream); end; end if; if Recursive then declare procedure Add_Entry (Next_Entry : Dirs.Directory_Entry_Type) is Entry_Name : constant String := Dirs.Simple_Name (Next_Entry); begin if Entry_Name not in "." | ".." then Add_File (Dirs.Compose (Path, Entry_Name)); end if; end Add_Entry; begin Dirs.Search (Path, "", Process => Add_Entry'Access); end; end if; end if; end; end Add_File; use type SU.Unbounded_String; String_Comment : constant String := SU.To_String (Comment); begin DCF.Zip.Create.Create (Info, Archive_Stream'Unchecked_Access, Compress => Compression_Method); for I in Last_Option + 2 .. Argument_Count loop Add_File (Argument (I)); end loop; -- Add optional archive file comment if Comment /= "" then if not Quiet then Put_Line (" comment: " & String_Comment); end if; DCF.Zip.Create.Set_Comment (Info, String_Comment); end if; DCF.Zip.Create.Finish (Info); end; end; end ZipDCF;
kernel/src/init.asm
anchovieshat/cathode-old
0
167713
<gh_stars>0 bits 64 extern main global _start section .boot _start: mov rsp, rsi call load_gdt call main .loop: cli hlt jmp .loop default rel section .text load_gdt: lea rax, [gdt.null_seg] mov [gdt.gdtloc], rax lgdt [gdt] lea rax, [.newcs] mov [.offset], rax mov dword [.selector], 0x08 jmp [.offset] .offset: dq 0 .selector: dd 0 nop nop .newcs: mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax ret section .data gdt: dw .end - .null_seg .gdtloc: dd 0 .null_seg: dq 0x0000000000000000 .code_seg: dq 0x0020980000000000 .data_seg: dq 0x0000920000000000 .end:
programs/oeis/072/A072078.asm
neoneye/loda
22
242309
; A072078: Number of 3-smooth divisors of n. ; 1,2,2,3,1,4,1,4,3,2,1,6,1,2,2,5,1,6,1,3,2,2,1,8,1,2,4,3,1,4,1,6,2,2,1,9,1,2,2,4,1,4,1,3,3,2,1,10,1,2,2,3,1,8,1,4,2,2,1,6,1,2,3,7,1,4,1,3,2,2,1,12,1,2,2,3,1,4,1,5,5,2,1,6,1,2,2,4,1,6,1,3,2,2,1,12,1,2,3,3 add $0,1 mov $2,2 mov $3,$0 mov $4,$0 mov $11,1 mov $12,1 lpb $3 mov $5,$4 lpb $5 add $6,1 mov $7,$0 div $0,$2 mod $7,$2 cmp $7,0 sub $5,$7 add $11,$12 lpe mov $7,$2 add $2,1 add $12,$6 lpb $6,4 mov $7,$0 cmp $7,1 cmp $7,0 lpe mov $3,$0 sub $3,$7 lpe mov $0,$11
Miei-sorgenti/new/Simulazione/BranchY/branchy.asm
DigiOhhh/LabArchitettura2-2017-2018
1
1002
<reponame>DigiOhhh/LabArchitettura2-2017-2018 # (A) Si implementi, senza fare uso di pseudo-istruzioni, una procedura chiamata ``branchy'' così definita: # Input: due valori interi a e b, due indirizzi del segmento testo T1 e T2. # Output: un indirizzo del segmento testo. # La procedura restituisce un indirizzo determinato da queste condizioni: # se a>b viene restituito T1; # se a<b viene restituito T2; # (B) se a=b viene restituito l'indirizzo dell'istruzione che, nel chiamante, precede la chiamata # alla procedura. .text .globl branchy branchy: subu $sp, $sp, 24 sw $s0, 20($sp) sw $s1, 16($sp) sw $s2, 12($sp) sw $s3, 8($sp) sw $fp, 4($sp) sw $ra, ($sp) addiu $fp, $sp, 20 add $s0, $a0, $zero add $s1, $a1, $zero add $s2, $a2, $zero add $s3, $a3, $zero slt $t0, $s0, $s1 addi $t1, $zero, 1 beq $t0, $t1, a_less_b beq $s0, $s1, a_equal_b # a_greater_b add $v0, $s2, $zero j return a_less_b: add $v0, $s3, $zero j return a_equal_b: add $v0, $ra, $zero addi $v0, $v0, -8 # In $ra viene inserito l'indirizzo della chiamata più 4, quindi # devo sottrarre 8 return: lw $ra, ($sp) lw $fp, 4($sp) lw $s3, 8($sp) lw $s2, 12($sp) lw $s1, 16($sp) lw $s0, 20($sp) addi $sp, $sp, 24 jr $ra
oeis/338/A338227.asm
neoneye/loda-programs
11
94734
; A338227: a(n) = x(n) mod floor(sqrt(x(n))), where x(n) = floor((n^2)/2). ; Submitted by <NAME> ; 0,0,0,0,2,0,2,4,1,4,0,3,8,2,7,0,6,11,4,10,2,8,0,6,14,3,12,0,9,18,6,15,2,12,23,8,20,4,16,0,12,24,7,20,2,15,30,10,25,4,20,35,14,30,8,24,1,18,36,11,30,4,23,42,16,35,8,28,0,20,42,12,34,3 add $0,2 seq $0,7590 ; a(n) = floor(n^2/2). mov $1,$0 seq $1,196 ; Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times. mod $0,$1
programs/oeis/016/A016758.asm
karttu/loda
1
96664
<filename>programs/oeis/016/A016758.asm ; A016758: a(n) = (2*n+1)^6. ; 1,729,15625,117649,531441,1771561,4826809,11390625,24137569,47045881,85766121,148035889,244140625,387420489,594823321,887503681,1291467969,1838265625,2565726409,3518743761,4750104241,6321363049,8303765625,10779215329,13841287201,17596287801,22164361129,27680640625,34296447249,42180533641,51520374361,62523502209,75418890625,90458382169,107918163081,128100283921,151334226289,177978515625,208422380089,243087455521,282429536481,326940373369,377149515625,433626201009,496981290961,567869252041,646990183449,735091890625,832972004929,941480149401,1061520150601,1194052296529,1340095640625,1500730351849,1677100110841,1870414552161,2081951752609,2313060765625,2565164201769,2839760855281,3138428376721,3462825991689,3814697265625,4195872914689,4608273662721,5053913144281,5534900853769,6053445140625,6611856250609,7212549413161,7858047974841,8550986578849,9294114390625,10090298369529,10942526586601,11853911588401,12827693806929,13867245015625,14976071831449,16157819263041,17416274304961,18755369578009,20179187015625,21691961596369,23298085122481,25002110044521,26808753332089,28722900390625,30749609024289,32894113444921,35161828327081,37558352909169,40089475140625,42761175875209,45579633110361,48551226272641,51682540549249,54980371265625,58451728309129,62103840598801,65944160601201,69980368892329,74220378765625,78672340886049,83344647990241,88245939632761,93385106978409,98771297640625,104413920565969,110322650964681,116507435287321,122978496247489,129746337890625,136821750708889,144215816802121,151939915084881,160005726539569,168425239515625,177210755074809,186374892382561,195930594145441,205891132094649,216270112515625,227081481823729,238339532186001,250058907189001,262254607552729,274941996890625,288136807515649,301855146292441,316113500535561,330928743953809,346318142640625,362299361110569,378890468381881,396109944105121,413976684737889,432510009765625,451729667968489,471655843734321,492309163417681,513710701744969,535881988265625,558845013849409,582622237229761,607236591593241,632711491215049,659070838140625,686339028913329,714540961348201,743702041351801,773848189788129,805005849390625,837201991720249,870464124169641,904820297013361,940299110504209,976929722015625,1014741853230169,1053765797374081,1094032426497921,1135573198803289,1178420166015625,1222605980803089,1268163904241521,1315127813325481,1363532208525369,1413412221390625,1464803622199009,1517742827651961,1572266908616041,1628413597910449,1686221298140625,1745729089577929,1806976738085401,1870004703089601,1934854145598529,2001566936265625,2070185663499849,2140753641621841,2213314919066161,2287914286629609,2364597285765625,2443410216924769,2524400147941281,2607614922465721,2693103168443689,2780914306640625,2871098559212689,2963706958323721,3058791354808281,3156404426880769,3256599688890625,3359431500123609,3464955073649161,3573226485213841,3684302682180849,3798241492515625,3915101633817529,4034942722397601,4157825282402401,4283810754983929,4412961507515625,4545340842854449,4681013008649041,4820043206693961,4962497602330009,5108443333890625,5257948522194369,5411082280083481,5567914722008521,5728516973659089,5892961181640625,6061320523197289,6233669215980921,6410082527866081,6590636786811169,6775409390765625,6964478817623209,7157924635221361,7355827511386641,7558269224026249,7765332671265625,7977101881632129,8193662024284801,8415099419290201,8641501547944329,8872957063140625,9109555799784049 mul $0,2 mov $1,$0 add $1,1 pow $1,6
oeis/141/A141845.asm
neoneye/loda-programs
11
9526
; A141845: a(n) = 5*a(n-1) + A047201(n), a(1) = 1. A047201 = numbers not divisible by 5: (1, 2, 3, 4, 6, 7, 8, 9, 11,...). ; Submitted by <NAME> ; 1,7,38,194,976,4887,24443,122224,611131,3055667,15278348,76391754,381958786,1909793947,9548969753,47744848784,238724243941,1193621219727,5968106098658,29840530493314,149202652466596,746013262333007 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,330002 ; Beatty sequence for x, where 1/x + 1/(x+1)^2 = 1. sub $0,$1 mul $1,6 add $1,$0 lpe mov $0,$1
dino/lcs/enemy/A8.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
12776
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D3C move.l D0, (A4)+ 004D3E move.l D0, (A4)+ 034314 move.b ($22,PC,D0.w), ($a8,A6) 03431A moveq #$0, D0 [enemy+A8] 03431C move.b ($a8,A6), D0 034320 add.w D0, D0 [enemy+A8] 03B2C8 move.b #$0, ($a8,A6) [enemy+25] 03B2CE movea.l ($a0,A6), A1 03B46E cmp.b ($a8,A6), D0 03B472 beq $3b492 03B476 move.b ($2d,A2), ($a8,A6) 03B47C beq $3b492 [enemy+A8] 03C1AC clr.w ($a8,A6) 03C1B0 move.w ($a4,A6), D0 [enemy+A8] 03C310 move.w ($a8,A6), D0 03C314 move.w ($6,PC,D0.w), D0 [enemy+A8] 03C330 move.w #$2, ($a8,A6) [enemy+ 4, enemy+ 6] 03C336 moveq #$d, D0 [enemy+A8] 03C362 move.w #$6, ($a8,A6) 03C368 move.b #$6, ($58,A6) [enemy+A8] 03C412 move.w #$a, ($a8,A6) 03C418 move.b #$1e, ($80,A6) [enemy+A8] 03C430 move.w ($a8,A6), D0 03C434 move.w ($6,PC,D0.w), D0 [enemy+A8] 03C4CE move.w #$8, ($a8,A6) 03C4D4 moveq #$a, D0 [enemy+A8] 03C4EA move.w #$a, ($a8,A6) 03C4F0 moveq #$b, D0 [enemy+A8] 03C54E move.w #$c, ($a8,A6) [enemy+51] 03C554 moveq #$e, D0 [enemy+A8] 03CD7C move.w #$8, ($a8,A6) 03CD82 move #$1, CCR [enemy+A8] 03DED0 move.b #$a, ($a8,A6) [enemy+AA] 03DED6 move.b D0, ($a1,A6) [enemy+A8] 03E57E subq.b #1, ($a8,A6) 03E582 bne $3e5ba [enemy+A8] 03E586 move.b #$1e, ($a8,A6) 03E58C movea.w ($76,A6), A0 [enemy+A8] 03E60A subq.b #1, ($a8,A6) 03E60E bne $3e62a [enemy+A8] 03E612 move.b #$c, ($a8,A6) 03E618 moveq #$0, D0 [enemy+A8] 03E8D2 subq.b #1, ($a8,A6) 03E8D6 bne $3e8f2 [enemy+A8] 03E8DA move.b #$f, ($a8,A6) 03E8E0 moveq #$0, D0 [enemy+A8] 03E9A6 subq.b #1, ($a8,A6) 03E9AA bne $3e9c2 [enemy+A8] 03E9AE move.b #$6, ($a8,A6) 03E9B4 move.b ($22,A6), ($a9,A6) [enemy+A8] 03F0DC subq.b #1, ($a8,A6) 03F0E0 bne $3f0ea [enemy+A8] 03F0E4 move.b #$1e, ($a8,A6) 03F0EA jsr $1862.l [enemy+A8] 03F16A move.b #$1e, ($a8,A6) [enemy+AC] 03F170 jsr $32c5e.l [enemy+A8] 03F1EC move.b #$6, ($a8,A6) 03F1F2 move.w #$78, ($ac,A6) [enemy+A8] 03F228 move.b #$6, ($a8,A6) [enemy+A1] 03F22E move.w #$78, ($ac,A6) [enemy+A8] 03F3EE move.b #$1e, ($a8,A6) [enemy+AC] 03F3F4 jsr $32c5e.l [enemy+A8] 040028 move.b #$1e, ($a8,A6) [enemy+AC] 04002E move.w ($88,A6), D1 [enemy+A8] 040298 move.w A0, ($a8,A1) [enemy+10] 04029C move.w A2, ($aa,A1) [enemy+A8] 041D7A movea.w ($a8,A6), A1 041D7E bsr $41d9e [enemy+A8] 041F8A move.l (A0)+, ($a8,A6) [enemy+A4, enemy+A6] 041F8E move.b (A0), ($ac,A6) 041FE4 move.l ($a8,A6), D0 [enemy+ C, enemy+ E] 041FE8 add.l D0, ($10,A6) 04264E move.b #$2, ($a8,A6) 042654 move.b D0, ($bd,A6) [enemy+A8] 042B52 tst.b ($a8,A6) 042B56 beq $42b86 [enemy+A8] 042B64 cmpi.b #$2, ($a8,A6) 042B6A bne $42b86 [enemy+A8] 042B76 subq.b #1, ($a8,A6) 042B7A move.b #$2, ($bd,A6) [enemy+A8] 048414 move.w D0, ($a8,A6) 048418 move.w D0, ($aa,A6) 0484DA move.w ($a8,A6), D0 0484DE move.w ($30,PC,D0.w), D1 [enemy+A8] 048528 move.w #$0, ($a8,A6) 04852E rts 048768 move.w #$4, ($a8,A6) 04876E moveq #$0, D0 [enemy+A8] 048C06 move.w #$6, ($a8,A6) 048C0C move.b #$2, ($0,A6) [enemy+A8] 048CD2 move.w #$8, ($a8,A6) 048CD8 clr.w ($6,A6) [enemy+A8] 04DD94 move.w D0, ($a8,A6) 04DD98 move.w D0, ($aa,A6) 04E092 move.w ($a8,A6), D0 04E096 move.w ($1c,PC,D0.w), D1 [enemy+A8] 04E59C move.w #$6, ($a8,A6) 04E5A2 moveq #$0, D0 [enemy+A8] 04EA02 move.w #$8, ($a8,A6) 04EA08 moveq #$0, D0 [enemy+A8] 04EBEC move.w #$a, ($a8,A6) 04EBF2 move.b #$2, ($0,A6) [enemy+A8] 0509FA move.b D0, ($a8,A6) 0509FE rts [enemy+A8] 050A02 move.b ($a8,A6), D0 050A06 lsl.w #5, D0 [enemy+A8] 05365E clr.b ($a8,A6) 053662 clr.b ($a9,A6) 053840 subq.b #1, ($a8,A6) 053844 bcc $5388e [enemy+A8] 053848 move.b #$1, ($a8,A6) 05384E addq.b #1, ($22,A6) [enemy+A8] 0539A6 move.b D0, ($a8,A6) 0539AA moveq #$7, D0 0569B6 move.w D0, ($a8,A6) 0569BA addi.w #$8, ($a8,A6) [enemy+A8] 0569C0 jsr $119c.l [enemy+A8] 056A18 cmp.w ($a8,A6), D0 [enemy+AC] 056A1C bne $56a4c [enemy+A8] 056A3C move.w D0, ($a8,A6) 056A40 addi.w #$10, ($a8,A6) [enemy+A8] 056A46 jsr $121e.l [enemy+A8] 056D36 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC] 056D3E moveq #$1, D0 056D9E move.l #$0, ($a6,A6) 056DA6 moveq #$0, D0 056E02 move.l #$100, ($a6,A6) [enemy+AA, enemy+AC] 056E0A move.w #$0, ($a2,A6) [enemy+A6, enemy+A8] 056E64 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC] 056E6C move.b #$1, ($24,A6) 056EC6 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC] 056ECE move.b #$0, ($24,A6) 056F56 move.l #$0, ($a6,A6) [enemy+AE, enemy+B0] 056F5E move.b #$1, ($24,A6) 056FAC move.l ($a6,A6), D0 [enemy+ C, enemy+ E] 056FB0 add.l D0, ($aa,A6) 056FFC move.l ($a6,A6), D0 057000 add.l D0, ($aa,A6) [enemy+A6, enemy+A8] 057028 move.l ($a6,A6), D0 [enemy+ C, enemy+ E] 05702C add.l D0, ($aa,A6) 057064 move.l ($a6,A6), D0 [enemy+ C, enemy+ E] 057068 add.l D0, ($aa,A6) 05777A move.w #$3c, ($a8,A6) [enemy+ 5] 057780 rts [enemy+A8] 057CC6 clr.b ($a8,A6) 057CCA jsr $12cb4.l 057D00 tst.b ($a8,A6) 057D04 bne $57d44 057D3E move.b #$1, ($a8,A6) 057D44 jsr $121e.l [enemy+A8] 0585DC move.w A0, ($a8,A6) [enemy+A2] 0585E0 move.b #$2, ($be,A6) [enemy+A8] 058734 movea.w ($a8,A6), A1 058738 move.w A1, ($b6,A6) [enemy+A8] 05A29A movea.w ($a8,A6), A1 05A29E bra $5a2a4 [enemy+A8] 05B02A move.w A1, ($a8,A0) [enemy+10] 05B02E move.b ($96,A6), ($96,A0) [enemy+A8] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
base/boot/startup/i386/exp.asm
npocmaka/Windows-Server-2003
17
177376
;++ ; ; Module name ; ; exp.asm ; ; Author ; ; <NAME> (tomp) Feb-26-91 ; ; Description ; ; Entry points exported to OS loader by SU module. Exported ; routines provide basic machine dependent i/o funtions needed ; by the OS loader. Providing these routines decouples the ; OS loader from the h/w. Note that the OS loader will ; refer to these exported routines as the "external services". ; ; ; Exported Procedures ; ; RebootProcessor - Reboots the machine ; GetSector - Read one or more sectors from the boot device. ; PutChar - Puts a character on the video display. ; GetKey - Gets a key from the keyboard ; GetCounter - Reads the Tick Counter ; Reboot - Transfers control to a loaded boot sector. ; HardwareCursor - set position of hardware cursor ; GetDateTime - gets date and time ; ComPort - int14 functions ; GetStallCount - calculates processor stall count ; ; ; Notes ; ; When adding a new exported routine note that you must manually add the ; entry's name to the BootRecord in "sudata.asm". ; ;-- include su.inc include macro.inc DISK_TABLE_VECTOR equ 01Eh * 4 _TEXT segment para use16 public 'CODE' ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP .386p extrn _DiskBaseTable:near extrn _RomDiskBasePointer:near extrn _EddsAddressPacket:near ;++ ; ; Exported Name: ; ; RebootProcessor ; ; Arguments: ; ; None ; ; Description: ; ; Reboot the processor using INT 19h ; ; ; ;-- ; ; ExportEntry takes us from a 32bit cs to a 16bit cs, inits 16bit stack ; and ds segments and saves the callers esp and ebp. ; ;-- EXPORT_ENTRY_MACRO RebootProcessor ; ; Switch to real mode so we can take interrupts ; ENTER_REALMODE_MACRO ; ; int 19h doesn't do what you would expect on BIOS Boot Specification machines. ; It either goes on to the next boot device or goes back to the first boot ; device. In both cases, it does not properly reset the machine. So we write ; to the keyboard port instead (as does HalpReboot). ; ; int 19h mov ax, 040h mov ds, ax mov word ptr ds:[72h], 1234h ; set location 472 to 1234 to indicate warm reboot mov al, 0feh out 64h, al ; write to keyboard port to cause reboot ; ; Loop forever and wait to ctrl-alt-del (should never get here) ; WAIT_FOREVER_MACRO ;EXPORT_EXIT_MACRO ;++ ; ; Name: ; ; GetSector ; ; Description: ; ; Reads the requested number of sectors from the specified drive into ; the specified buffer. ; ; Arguments: ; ; ULONG Virtual address into which to read data ; ULONG Number of sectors to read ; ULONG Physical sector number ; ULONG Drive Number ; ULONG Function Number ; TOS -> ULONG Flat return address (must be used with KeCodeSelector) ; ;-- EXPORT_ENTRY_MACRO GetSector ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <GetSectorFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Get the requested sectors. Arguments on realmode stack ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 ; ; Put the buffer pointer into es:bx. Note that and buffer ; addresses passed to this routine MUST be in the lower one ; megabyte of memory to be addressable in real mode. ; mov eax,[bp].BufferPointer mov bx,ax and bx,0fh shr eax,4 mov es,ax ; ; Place the upper 2 bits of the 10bit track/cylinder number ; into the uppper 2 bits of the SectorNumber as reguired by ; the bios. ; mov cx,word ptr [bp].TrackNumber xchg ch,cl shl cl,6 add cl,byte ptr [bp].SectorNumber ; ; Get the rest of the arguments ; mov ah,byte ptr [bp].FunctionNumber mov al,byte ptr [bp].NumberOfSectors mov dh,byte ptr [bp].HeadNumber mov dl,byte ptr [bp].DriveNumber ; ; Check to see if we are trying to reset/read/write/verify off the second ; floppy drive. If so, we need to go change the disk-base vector. ; cmp dl,1 jne gs3 cmp ah,4 jg gs3 cmp ah,0 je gs1 cmp ah,2 jl gs3 gs1: ; ; We need to point the BIOS disk-table vector to our own table for this ; drive. ; push es push bx push di push 0 pop es mov di, offset DGROUP:_RomDiskBasePointer mov bx,es:[DISK_TABLE_VECTOR] mov [di],bx mov bx,es:[DISK_TABLE_VECTOR+2] mov [di+2],bx mov bx,offset DGROUP:_DiskBaseTable mov es:[DISK_TABLE_VECTOR],bx mov bx,ds mov es:[DISK_TABLE_VECTOR+2],bx pop di pop bx pop es int BIOS_DISK_INTERRUPT push es push bx push di push 0 pop es mov di, offset DGROUP:_RomDiskBasePointer mov bx, [di] mov es:[DISK_TABLE_VECTOR],bx mov bx, [di+2] mov es:[DISK_TABLE_VECTOR+2],bx pop di pop bx pop es jc gs5 xor eax,eax jmp short gs5 gs3: ; ; Call the bios to read the sector now ; if 0 push ax push dx push cx push bx push es extrn _DisplayArgs:near call _DisplayArgs pop es pop bx pop cx pop dx pop ax endif int BIOS_DISK_INTERRUPT jc gs5 ; ; Carry wasn't set so we have no error and need to "clean" eax of ; any garbage that may have been left in it. ; xor eax,eax gs5: if 0 push ax push dx push cx push bx push es extrn _DisplayArgs:near call _DisplayArgs pop es pop bx pop cx pop dx pop ax endif ; ; Mask-off any garbage that my have been left in the upper ; 16bits of eax. ; and eax,0000ffffh ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <GetSectorFrame> ; ; Save return code on 16bit stack ; Re-enable protect-mode and paging. ; ; move cx into high 16-bits of ecx, and dx into cx. This is so the loader ; can get at interesting values in dx, even though edx gets munged by the ; random real-mode macros. shl ecx, 16 mov cx,dx push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Name: ; ; GetEddsSector ; ; Description: ; ; Reads the requested number of sectors from the specified drive into ; the specified buffer based on the Phoenix Enhanced Disk Drive Spec. ; ; Arguments: ; ; ULONG xint13 function number (42 = read, 43 = write) ; ULONG Virtual address into which to read data ; ULONG Number of logical blocks to read (word) ; ULONG Logical block number (High dword) ; ULONG Logical block number (Low dword) ; ULONG Drive Number (byte) ; TOS -> ULONG Flat return address (must be used with KeCodeSelector) ; ;-- EXPORT_ENTRY_MACRO GetEddsSector ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <GetEddsSectorFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Get the requested sectors. Arguments on realmode stack ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 push ds push si push bx ; ; Set up DS:SI -> Disk Address Packet ; push 0 pop ds mov si, offset DGROUP:_EddsAddressPacket mov ds:[si],word ptr 10h ; Packet size = 10h, plus reserved byte mov ax,word ptr [bp].NumberOfBlocks mov ds:[si][2],ax ; Num blocks to transfer mov eax,[bp].BufPointer mov bx,ax and bx,0fh mov ds:[si][4],bx ; Transfer buffer address (low word=offset) shr eax,4 mov ds:[si][6],ax ; Transfer buffer address (high word=segment) mov eax,[bp].LBNLow mov ds:[si][8],eax ; Starting logical block number (low dword) mov eax,[bp].LBNHigh mov ds:[si][12],eax ; Starting logical block number (high dword) ; ; Call the bios to read the sector now (DS:SI -> Disk address packet) ; mov ah,byte ptr [bp].FunctionNum ; function xor al,al ; force verify on write off mov dl,byte ptr [bp].DriveNum ; DL = drive number int BIOS_DISK_INTERRUPT jc geserror1 ; ; Carry wasn't set so we have no error and need to "clean" eax of ; any garbage that may have been left in it. ; xor eax,eax geserror1: ; ; Mask-off any garbage that my have been left in the upper ; 16bits of eax. ; and eax,0000ffffh pop bx pop si pop ds ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <GetEddsSectorFrame> ; ; Save return code on 16bit stack ; Re-enable protect-mode and paging. ; ; move cx into high 16-bits of ecx, and dx into cx. This is so the loader ; can get at interesting values in dx, even though edx gets munged by the ; random real-mode macros. shl ecx, 16 mov cx,dx push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; GetKey ; ; Description: ; ; Checks the keyboard to see if a key is available. ; ; Arguments: ; ; None. ; ; Returns: ; ; If no key is available, returns 0 ; ; If ASCII character is available, LSB 0 is ASCII code ; LSB 1 is keyboard scan code ; If extended character is available, LSB 0 is extended ASCII code ; LSB 1 is keyboard scan code ; ;-- EXPORT_ENTRY_MACRO GetKey ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in real mode. ; ENTER_REALMODE_MACRO ; ; Set up registers to call BIOS and check to see if a key is available ; mov ax,0100h int BIOS_KEYBOARD_INTERRUPT jnz GkKeyAvail mov eax, 0 jmp GkDone GkKeyAvail: ; ; Now we call BIOS again, this time to get the key from the keyboard buffer ; mov ax,0h int BIOS_KEYBOARD_INTERRUPT and eax,0000ffffh ; ; Save return code on 16bit stack ; Re-enable protect mode and paging ; GkDone: push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32-bit universe ; EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; GetCounter ; ; Description: ; ; Reads the tick counter (incremented 18.2 times per second) ; ; Arguments: ; ; None ; ; Returns: ; ; The current value of the tick counter ; ;-- EXPORT_ENTRY_MACRO GetCounter ; ; Go into real mode. ; ENTER_REALMODE_MACRO mov ah,0 int 01ah mov ax,cx ; high word of count shl eax,16 mov ax,dx ; low word of count push eax RE_ENABLE_PAGING_MACRO pop eax EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; Reboot ; ; Description: ; ; Switches to real-mode and transfers control to a loaded boot sector ; ; Arguments: ; ; unsigned BootType ; 0 = FAT. Just jump to 0:7c00. ; 1 = HPFS. Assumes boot code and super+spare areas (20 sectors) ; are already loaded at 0xd000; jumps to d00:200. ; 2 = NTFS. Assumes boot code is loaded (16 sectors) at 0xd000. ; Jumps to d00:256. ; ; Returns: ; Does not return ; ; Environment: ; ; Boot sector has been loaded at 7C00 ;-- EXPORT_ENTRY_MACRO Reboot ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <RebootFrame>, ebx ; ; Go into real mode. ; ENTER_REALMODE_MACRO ; ; Get the BootType argument. Arguments on realmode stack ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 mov edx, [bp].BootType ; ; Zero out the firmware heaps, 3000:0000 - 4000:ffff. ; xor eax,eax ; prepare for stosd mov bx,3000h mov es,bx mov di,ax ; es:di = physical address 30000 mov cx,4000h ; cx = rep count, # dwords in 64K cld rep stosd mov cx,4000h ; rep count mov es,cx ; es:di = physical address 40000 rep stosd ; ; Disable the A20 line. Some things (like EMM386 and OS/2 on PS/2 machines) ; hiccup or die if we don't do this. ; extrn _DisableA20:near call _DisableA20 ; ; Put the video adapter back in 80x25 mode ; push dx mov ax, 0003h int 010h pop dx ; ; Reset all the segment registers and setup the original stack ; mov ax,0 mov ds,ax mov es,ax mov fs,ax mov gs,ax mov ax,30 mov ss,ax mov esp,0100h mov ebp,0 mov esi,0 mov edi,0 test dx,-1 jz FatBoot ; ; Setup the registers the way the second sector of the OS/2 HPFS boot code ; expects them. We skip the first sector entirely, as that just loads in ; the rest of the sectors. Since the rest of the sectors are ours and not ; OS/2's, this would cause great distress. ; mov ax,07c0h mov ds, ax mov ax, 0d00h mov es, ax cli xor ax,ax mov ss,ax mov sp, 07c00h sti push 0d00h push 0256h jmp RebootDoit FatBoot: push 0 ; set up for branch to boot sector push 07c00h mov dx,080h ; ; And away we go! ; RebootDoit: retf RE_ENABLE_PAGING_MACRO REMOVE_STACK_FRAME_MACRO <RebootFrame> EXPORT_EXIT_MACRO ;++ ; ; Name: ; ; HardwareCursor ; ; Description: ; ; Positions the hardware cursor and performs other display stuff. ; ; Arguments: ; ; ULONG Y coord (0 based) ; ULONG X coord (0 based) ; TOS -> ULONG Flat return address (must be used with KeCodeSelector) ; ; If X = 0x80000000, then Y contains values that get placed into ; ax (low word of Y) and bx (hi word of y). ; Otherwise X,Y = coors for cursor ; ; ;-- EXPORT_ENTRY_MACRO HardwareCursor ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <HardwareCursorFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Get the requested sectors. Arguments on realmode stack ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 ; ; Put the row (y coord) in dh and the column (x coord) in dl. ; mov eax,[bp].YCoord mov edx,[bp].XCoord cmp edx,80000000h jne gotxy mov ebx,eax shr ebx,16 jmp doint10 gotxy: mov dh,al mov ah,2 mov bh,0 doint10: int 10h ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <HardwareCursorFrame> ; ; Re-enable protect-mode and paging. ; RE_ENABLE_PAGING_MACRO ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Name: ; ; GetDateTime ; ; Description: ; ; Gets date and time ; ; Arguments: ; ; ULONG Virtual address of a dword in which to place time. ; ULONG Virtual address of a dword in which to place date. ; TOS -> ULONG Flat return address (must be used with KeCodeSelector) ; ;-- BCD_TO_BIN macro xor ah,ah rol ax,4 ror al,4 aad endm EXPORT_ENTRY_MACRO GetDateTime ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <GetDateTimeFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 ; ; Get the time ; mov ah,2 int 1ah ; ; Convert BIOS time format into our format and place in caller's dword ; bits 0-5 are the second ; bits 6-11 are the minute ; bits 12-16 are the hour ; xor eax,eax mov al,dh ; BCD seconds BCD_TO_BIN movzx edx,ax mov al,cl ; BCD minutes BCD_TO_BIN shl ax,6 or dx,ax mov al,ch ; BCD hours BCD_TO_BIN shl eax,12 or edx,eax mov eax,[bp].TimeDword mov bx,ax and bx,0fh shr eax,4 mov es,ax mov es:[bx],edx ; ; Get the date ; mov ah,4 int 1ah ; ; Convert BIOS date format into our format and place in caller's dword ; bits 0-4 are the day ; bits 5-8 are the month ; bits 9-31 are the year ; xor eax,eax mov al,dl ; BCD day BCD_TO_BIN mov bl,dh movzx edx,ax mov al,bl ; BCD month BCD_TO_BIN shl ax,5 or dx,ax mov al,cl ; BCD year BCD_TO_BIN mov cl,al mov al,ch ; BCD century BCD_TO_BIN mov ah,100 mul ah xor ch,ch add ax,cx shl eax,9 or edx,eax mov eax,[bp].DateDword mov bx,ax and bx,0fh shr eax,4 mov es,ax mov es:[bx],edx ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <GetDateTimeFrame> ; ; Re-enable protect-mode and paging. ; RE_ENABLE_PAGING_MACRO ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; VOID ; DetectHardware ( ; IN PDETECTION_RECORD DetectionRecord ; ) ; ; Routine Description: ; ; This routine invokes x86 16 bit real mode detection code from ; osloader 32 bit flat mode. ; ; Arguments: ; ; DetectionRecord - Supplies a pointer to a detection record structure. ; ; Return Value: ; ; None. ; ;-- EXPORT_ENTRY_MACRO DetectHardware ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <DetectionFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Call the Hardware Detection code ; push cs push offset _TEXT:DetectionDone ; push far return addr push DETECTION_ADDRESS_SEG push DETECTION_ADDRESS_OFFSET retf DetectionDone: ; ; Restore bp and remove stack-frame from stack ; REMOVE_STACK_FRAME_MACRO <DetectionFrame> ; ; No return code, so we don't save return code around page enabling code ; Re-enable protect-mode and paging. ; RE_ENABLE_PAGING_MACRO ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; VOID ; ComPort ( ; IN LONG Port, ; IN ULONG Function, ; IN UCHAR Arg ; ) ; ; Routine Description: ; ; Invoke int14 on com1. ; ; Arguments: ; ; Port - port # (0 = com1, etc). ; ; Function - int 14 function (for ah) ; ; Arg - arg for function (for al) ; ; Return Value: ; ; None. ; ;-- EXPORT_ENTRY_MACRO ComPort ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <ComPortFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 ; ; Get args and call int14 ; mov ah,byte ptr [bp].ComPortFunction mov al,byte ptr [bp].ComPortArg mov dx,word ptr [bp].ComPortPort int 14h ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <ComPortFrame> ; ; No return code, so we don't save return code around page enabling code ; Re-enable protect-mode and paging. ; RE_ENABLE_PAGING_MACRO ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; ULONG ; GetStallCount ( ; VOID ; ) ; ; Routine Description: ; ; Calculates how many increments are required to stall for one microsecond ; ; The way this routine works is to set up an ISR on the BIOS vector 1C. ; This routine will get called 18.2 times a second. The location where ; IP will be stored when the interrupt occurs is computed and stashed in ; the code segment. When the ISR fires, the IP on the stack is changed ; to point to the next chunk of code to execute. So we can spin in a ; very tight loop and automatically get blown out of the loop when the ; interrupt occurs. ; ; This is all pretty sleazy, but it allows us to calibrate accurately ; without relying on the 8259 or 8254 (just BIOS). It also does not ; depend on whether the ISR can affect the CPU registers or not. (some ; BIOSes, notably Olivetti, will preserve the registers for you) ; ; Arguments: ; ; None. ; ; Return Value: ; ; Number of increments required to stall for one microsecond ; ;-- EXPORT_ENTRY_MACRO GetStallCount ; ; Go into real mode. ; ENTER_REALMODE_MACRO cli push di push si push ds mov ax,0 mov ds,ax ; ; save previous vector ; mov di, 01ch*4 mov cx, [di] mov dx, [di+2] ; ; insert our vector ; mov ax, offset GscISR mov [di], ax push cs pop ax mov [di+2], ax mov eax,0 mov ebx,0 mov si,sp sub si,6 mov cs:savesp,si mov cs:newip,offset GscLoop2 sti ; ; wait for first tick. ; GscLoop1: cmp ebx,0 je GscLoop1 ; ; start counting ; ; ; We spin in this loop until the ISR fires. The ISR will munge the return ; address on the stack to blow us out of the loop and into GscLoop3 ; GscLoop2: mov cs:newip,offset GscLoop4 GscLoop3: add eax,1 jnz short GscLoop3 ; GscLoop4: ; ; stop counting ; ; ; replace old vector ; cli mov [di],cx mov [di+2],dx sti pop ds pop si pop di jmp GscDone newip dw ? savesp dw ? GscISR: ; ; blow out of loop ; push bp push ax mov bp,cs:savesp mov ax,cs:newip mov ss:[bp],ax pop ax pop bp GscISRdone: iret GscDone: mov edx, eax mov ecx,16 shr edx,cl ; (dx:ax) = dividend mov cx,0D6A6h ; (cx) = divisor div cx and eax,0ffffh inc eax ; round loopcount up (prevent 0) ; ; Re-enable protect-mode and paging. ; push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; InitializeDisplayForNt ; ; Description: ; ; Puts the display into 50 line mode ; ; Arguments: ; ; None ; ; Returns: ; ; None ; ;-- EXPORT_ENTRY_MACRO InitializeDisplayForNt ; ; Go into real mode. ; ENTER_REALMODE_MACRO mov ax, 1112h ; Load 8x8 font mov bx, 0 int 10h RE_ENABLE_PAGING_MACRO EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; GetMemoryDescriptor ; ; Description: ; ; Returns a memory descriptor ; ; Arguments: ; ; pointer to MemoryDescriptorFrame ; ; Returns: ; ; None ; ;-- EXPORT_ENTRY_MACRO GetMemoryDescriptor ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <MemoryDescriptorFramePointer>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 mov eax,[bp].E820FramePointer mov bp,ax and bp,0fh shr eax,4 mov es,ax ; (es:bp) = E820 Frame mov ebx, es:[bp].Key mov ecx, es:[bp].DescSize lea di, [bp].BaseAddrLow mov eax, 0E820h mov edx, 'SMAP' ; (edx) = signature INT 15h mov es:[bp].Key, ebx ; update callers ebx mov es:[bp].DescSize, ecx ; update callers size sbb ecx, ecx ; ecx = -1 if carry, else 0 sub eax, 'SMAP' ; eax = 0 if signature matched or ecx, eax mov es:[bp].ErrorFlag, ecx ; return 0 or non-zero ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <MemoryDescriptorFramePointer> RE_ENABLE_PAGING_MACRO EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; GetElToritoStatus ; ; Description: ; ; Get El Torito Disk Emulation Status ; ; Arguments: ; ; None ; ; Returns: ; ; None ; ;-- EXPORT_ENTRY_MACRO GetElToritoStatus ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <GetElToritoStatusFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 push dx push bx push ds push si ; ; Put the Specification Packet pointer into DS:SI, and the Drive ; Number on DL. Note that and buffer ; addresses passed to this routine MUST be in the lower one ; megabyte of memory to be addressable in real mode. ; mov eax,[bp].SpecPacketPointer mov bx,ax and bx,0fh mov si,bx shr eax,4 mov ds,ax mov dl,byte ptr [bp].ETDriveNum mov ax,04B01h ; Function = Return Disk Emulation status int BIOS_DISK_INTERRUPT jc etstatuserr ; ; Carry wasn't set so we have no error and need to "clean" eax of ; any garbage that may have been left in it. ; xor eax,eax etstatuserr: ; ; Mask-off any garbage that my have been left in the upper ; 16bits of eax. ; and eax,0000ffffh pop si pop ds pop bx pop dx ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <GetElToritoStatusFrame> ; ; Save return code on 16bit stack ; Re-enable protect-mode and paging. ; push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; GetExtendedInt13Params ; ; Description: ; ; Determine if extended int13 services are available for a drive ; and if so retrieve extended disk parameters. ; ; Arguments: ; ; - 32-bit flat pointer to 26-byte param packet filled by this routine ; ; - int 13 unit number ; ; Returns: ; ; ax = 0 means extended int13 not supported on the given drive ; ax = 1 means extended int13 supported and param packet filled in ; ;-- EXPORT_ENTRY_MACRO GetExtendedInt13Params ; ; Move the arguments from the caller's 32bit stack to the SU module's ; 16bit stack. ; MAKE_STACK_FRAME_MACRO <GetExtendedInt13ParamsFrame>, ebx ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; Make (bp) point to the bottom of the argument frame. ; push bp mov bp,sp add bp,2 push dx push bx push ds push si ; ; Check for support for this drive. ; mov ah,41h mov bx,55aah mov dl,byte ptr [bp].Int13UnitNumber int BIOS_DISK_INTERRUPT jc noxint13 ; carry set means no xint13 cmp bx,0aa55h ; check signature jnz noxint13 ; not present, no xint13 test cl,1 ; bit 0 clear means no xint13 jz noxint13 ; ; If we get here it looks like we have xint13 support. ; Some BIOSes are broken though so we do some validation while we're ; asking for the extended int13 drive parameters for the drive. ; Note that and buffer addresses passed to this routine ; MUST be in the lower one megabyte of memory to be addressable in real mode. ; mov eax,[bp].ParamPacketPointer mov bx,ax and bx,0fh mov si,bx shr eax,4 mov ds,ax ; DS:SI -> param packet mov word ptr [si],26 ; initialize packet with size ; some bioses helpfully zero out ; the whole buffer according to ; this size, so make SURE the ; entire word is initialized and ; there's no junk in the high byte. mov dl,byte ptr [bp].Int13UnitNumber mov ah,48h int BIOS_DISK_INTERRUPT jc noxint13 ; ; If we get here then everything's cool and we have xint13 parameters. ; We also know carry isn't set. ; mov al,1 jnc xint13done noxint13: xor al,al xint13done: movzx eax,al pop si pop ds pop bx pop dx ; ; Restore bp and remove stack-frame from stack ; pop bp REMOVE_STACK_FRAME_MACRO <GetExtendedInt13ParamsFrame> ; ; Save return code on 16bit stack ; Re-enable protect-mode and paging. ; push eax RE_ENABLE_PAGING_MACRO pop eax ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO ;++ ; ; Routine Name: ; ; ApmAttemptReconnect ; ; Description: ; ; Called only during x86 resume from hiberate operation. Attempts ; to connect to APM bios in same way ntdetect.com did on first try, ; so that if APM is present on the machine, it will be reinited to ; the same working state it was in before hibernate. ; ; APM version, addresses, selector mappings, etc, are assumed ; not to have changed while the machine is hibernated. ; ; ; Arguments: ; ; None. ; ; Returns: ; ; None. (It either works or it doesn't.) ; ;-- ; ; Yet another set of cheater APM include values ; APM_INSTALLATION_CHECK equ 5300h APM_REAL_MODE_CONNECT equ 5301h APM_PROTECT_MODE_16bit_CONNECT equ 5302h APM_DRIVER_VERSION equ 530Eh APM_DISCONNECT equ 5304h APM_DEVICE_BIOS equ 0h APM_MODE_16BIT equ 1h EXPORT_ENTRY_MACRO ApmAttemptReconnect ; ; Go into real mode. We still have the same stack and sp ; but we'll be executing in realmode. ; ENTER_REALMODE_MACRO ; ; APM installation check ; mov eax,APM_INSTALLATION_CHECK mov ebx,APM_DEVICE_BIOS int 15h jc aar_punt cmp bl,'M' jnz aar_punt cmp bh,'P' jnz aar_punt ; ; If we get here, we have an APM bios. If we just call it, ; we may get grief. So we will connect in real mode, then ; set our version to the whatever the driver says it is, or 1.2, ; whichever is LESS. Then query options again. ; cmp ah,1 jle aar10 mov ah,1 ; ah = min(old ah, 1) aar10: cmp al,2 jle aar20 mov al,2 ; al = min(old al, 2) aar20: ; ; ax = min(apm version, 1.2) ; push ax ; ; connect to the real mode interface ; mov ax,APM_REAL_MODE_CONNECT mov bx,APM_DEVICE_BIOS int 15h pop ax jc aar_punt push ax ; ; set the version of the real mode interface ; mov cx,ax ; ax = major.minor mov bx,APM_DEVICE_BIOS mov ax,APM_DRIVER_VERSION int 15h pop ax jc aar_punt ; ; do the install check again, now that we've connected and ; set the version to min(apm ver, 1.2) some apm bios code ; will give us different install parameters now. ; mov ax,APM_INSTALLATION_CHECK mov bx,APM_DEVICE_BIOS int 15h jc aar_punt ; ; If we are here: ; AH = revised Major version ; AL = revised Minor version ; CX = APM Flags ; push cx push ax ; ; Now disconnect from the real mode interface ; mov ax,APM_DISCONNECT mov bx,APM_DEVICE_BIOS int 15h pop ax pop cx jc aar_punt ; ; Since we are here: ; AH = revised Major version ; AL = revised Minor version ; CX = apm parameters ; ; APM is present, and seems to work, and we've set it to the ; version number that we think it and we both like. ; ; So, things should just work, if APM has proper support ; for the modes and features that we need. ; cmp cx,APM_MODE_16BIT jz aar_punt ; ; 16bit protected mode is available ; push ax push cx ; ; do 16 bit protected mode connect ; mov ax,APM_PROTECT_MODE_16bit_CONNECT mov bx,APM_DEVICE_BIOS int 15h pop cx pop ax jc aar_punt ; ; do 16 bit protected mode set version ; mov cx,ax mov ax,APM_DRIVER_VERSION mov bx,APM_DEVICE_BIOS int 15h ; ; if NC, then we have connect to 16bit proected mode interface, ; AND set the version. since ntdetect.com presumably did this ; exact same thing at first boot, we already have GDT entries pointing ; to the 16bit code, hooks set, etc. So, in theory, it just works. ; ; if CY here, or anywhere above, APM doesn't work for us. Too bad. ; aar_punt: ; ; return to paged mode ; RE_ENABLE_PAGING_MACRO ; ; Return to caller and the 32bit universe. ; EXPORT_EXIT_MACRO _TEXT ends end
oeis/282/A282601.asm
neoneye/loda-programs
11
241091
<reponame>neoneye/loda-programs ; A282601: a(n) = Sum_(k=1..phi(n)/2) floor(d_k/2) where d_k are the totatives of n. ; Submitted by <NAME>(w1) ; 0,0,0,0,1,0,2,1,3,1,6,2,9,3,6,6,16,5,20,8,14,10,30,10,29,15,28,18,49,14,56,28,38,28,48,24,81,36,54,36,100,30,110,50,64,55,132,44,124,57,96,72,169,56,130,78,122,91,210,56,225,105,136,120,186,80,272,128,182,102 add $0,1 mov $2,$0 div $2,2 lpb $2 mov $3,$2 gcd $3,$0 cmp $3,1 mul $3,$2 div $3,2 add $1,$3 sub $2,1 lpe mov $0,$1
Categories/Categories/Products.agda
copumpkin/categories
98
11093
<filename>Categories/Categories/Products.agda {-# OPTIONS --universe-polymorphism #-} open import Level module Categories.Categories.Products (o ℓ e : Level) where open import Categories.Category open import Categories.Categories import Categories.Object.Products open Categories.Object.Products (Categories o ℓ e) open import Categories.Product import Categories.Product.Projections import Categories.Product.Properties open import Categories.Terminal private import Categories.Object.Product open Categories.Object.Product (Categories o ℓ e) renaming (Product to ProductObject) product : {A B : Category o ℓ e} → ProductObject A B product {A}{B} = record { A×B = Product A B ; π₁ = ∏₁ ; π₂ = ∏₂ ; ⟨_,_⟩ = _※_ ; commute₁ = λ {C}{f}{g} → ※-commute₁ {A = C}{f}{g} ; commute₂ = λ {C}{f}{g} → ※-commute₂ {A = C}{f}{g} ; universal = λ {C}{f}{g}{i} → ※-universal {A = C}{f}{g}{i} } where open Categories.Product.Projections A B open Categories.Product.Properties A B products : Products products = record { terminal = One {o}{ℓ}{e} ; binary = record { product = λ {A}{B} → product {A}{B} } }
pwnlib/shellcraft/templates/amd64/linux/time.asm
zaratec/pwntools
5
6359
<% from pwnlib.shellcraft.amd64.linux import syscall %> <%page args="timer"/> <%docstring> Invokes the syscall time. See 'man 2 time' for more information. Arguments: timer(time_t): timer </%docstring> ${syscall('SYS_time', timer)}
programs/oeis/315/A315207.asm
karttu/loda
0
3098
; A315207: Coordination sequence Gal.5.140.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,6,10,14,20,24,30,34,38,44,50,54,58,64,68,74,78,82,88,94,98,102,108,112,118,122,126,132,138,142,146,152,156,162,166,170,176,182,186,190,196,200,206,210,214,220,226,230,234,240 mov $1,1 mov $2,$0 mul $2,2 mov $5,$0 lpb $0,1 mov $0,1 mov $6,4 bin $6,$2 add $2,1 div $2,3 mul $2,2 add $6,$4 trn $0,$6 mov $1,$2 add $4,1 lpe mov $3,$5 mul $3,4 add $1,$3
tools/utils.adb
Fabien-Chouteau/sdlada
1
18222
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; package body Utils is procedure Comment_Dash (Total : in Positive; Indent : in Natural := 0; New_Line : Boolean := True) is begin if Indent > 0 then for Index in 1 .. Indent loop Put (' '); end loop; end if; for Index in 1 .. Total loop Put ('-'); end loop; if New_Line then Ada.Text_IO.New_Line; end if; end Comment_Dash; procedure Comment (Indent : in Natural; Text : in String; New_Line : in Boolean := True) is begin if Indent > 0 then for Index in 1 .. Indent loop Put (' '); end loop; end if; if Text = "" then Put ("--"); else Put ("-- " & Text); end if; if New_Line then Ada.Text_IO.New_Line; end if; end Comment; procedure Output_Field (Text : in String; Width : in Integer; Indent : in Natural; Separator : in String := " "; Truncate : in Boolean := False) is Field_Index : Positive_Count := Col; begin if Indent > 0 then for Index in 1 .. Indent loop Put (' '); end loop; end if; if Text'Length + Indent > Width and Truncate then Put (Text (Text'First .. Width) & Separator); else Put (Text & Separator); end if; Set_Col (Field_Index + Positive_Count (Width + Indent)); end Output_Field; end Utils;
generic_vector_math.adb
FROL256/ada-ray-tracer
3
9060
<filename>generic_vector_math.adb with Ada.Numerics.Generic_Elementary_Functions; with Ada.Unchecked_Conversion; use Ada.Numerics; --use Ada.Numerics.Aux; package body Generic_Vector_Math is package Float_Functions is new Generic_Elementary_Functions (float); use Float_Functions; function BitCopyToTypeT is new Ada.Unchecked_Conversion(float, T); function ZeroT return T is begin return BitCopyToTypeT(0.0); end ZeroT; function min (a, b : T) return T is begin if a < b then return a; else return b; end if; end; function max (a, b : T) return T is begin if a >= b then return a; else return b; end if; end; function min (a, b, c : T) return T is begin if a < b and a < c then return a; elsif b < c and b < a then return b; else return c; end if; end; function max (a, b, c : T) return T is begin if a >= b and a >= c then return a; elsif b >= c and b >= a then return b; else return c; end if; end; function clamp(x,a,b : T) return T is begin return min(max(x,a),b); end clamp; function sqr(x : T) return T is begin return x*x; end sqr; function "+" (a, b : vector4) return vector4 is res : vector4; begin res.x := a.x + b.x; res.y := a.y + b.y; res.z := a.z + b.z; res.w := a.w + b.w; return res; end; function "+" (a, b : vector3) return vector3 is res : vector3; begin res.x := a.x + b.x; res.y := a.y + b.y; res.z := a.z + b.z; return res; end; function "-" (a, b : vector3) return vector3 is res : vector3; begin res.x := a.x - b.x; res.y := a.y - b.y; res.z := a.z - b.z; return res; end; function "*" (a, b : vector3) return vector3 is res : vector3; begin res.x := a.x * b.x; res.y := a.y * b.y; res.z := a.z * b.z; return res; end; function dot(a, b : vector3) return T is begin return a.x*b.x + a.y*b.y + a.z*b.z; end; function cross(a, b : vector3) return vector3 is res : vector3; begin res.x := a.y*b.z - b.y*a.z; res.y := a.z*b.x - b.z*a.x; res.z := a.x*b.y - b.x*a.y; return res; end; function min(a, b : vector3) return vector3 is res : vector3; begin res.x := min(a.x, b.x); res.y := min(a.y, b.y); res.z := min(a.z, b.z); return res; end; function max(a, b : vector3) return vector3 is begin return (max(a.x,b.x), max(a.y,b.y), max(a.z, b.z)); end; function clamp(x : vector3; a,b : T) return vector3 is begin return (clamp(x.x,a,b), clamp(x.y,a,b), clamp(x.z,a,b)); end; function clamp(x,a,b : vector3) return vector3 is begin return (clamp(x.x,a.x,b.x), clamp(x.y,a.y,b.y), clamp(x.z,a.z,b.z)); end; function "*" (a : vector3; k : T) return vector3 is begin return (k*a.x, k*a.y, k*a.z); end; function "*"(k: T; a : vector3) return vector3 is begin return (k*a.x, k*a.y, k*a.z); end; function "*"(v : vector3; m : Matrix4) return vector3 is res : vector3; begin res.x := v.x*m(0,0) + v.y*m(1,0) + v.z*m(2,0) + m(3,0); res.y := v.x*m(0,1) + v.y*m(1,1) + v.z*m(2,1) + m(3,1); res.z := v.x*m(0,2) + v.y*m(1,2) + v.z*m(2,2) + m(3,2); return res; end; function "*"(v : vector4; m : Matrix4) return vector4 is res : vector4; begin res.x := v.x*m(0,0) + v.y*m(1,0) + v.z*m(2,0) + v.w*m(3,0); res.y := v.x*m(0,1) + v.y*m(1,1) + v.z*m(2,1) + v.w*m(3,1); res.z := v.x*m(0,2) + v.y*m(1,2) + v.z*m(2,2) + v.w*m(3,2); res.w := v.x*m(0,3) + v.y*m(1,3) + v.z*m(2,3) + v.w*m(3,3); return res; end; function "*"(m : Matrix4; v : vector3) return vector3 is res : vector3; begin res.x := m(0,0)*v.x + m(0,1)*v.y + m(0,2)*v.z + m(0,3); res.y := m(1,0)*v.x + m(1,1)*v.y + m(1,2)*v.z + m(1,3); res.z := m(2,0)*v.x + m(2,1)*v.y + m(2,2)*v.z + m(2,3); return res; end; function "*"(m : Matrix4; v : vector4) return vector4 is res : vector4; begin res.x := m(0,0)*v.x + m(0,1)*v.y + m(0,2)*v.z + m(0,3)*v.w; res.y := m(1,0)*v.x + m(1,1)*v.y + m(1,2)*v.z + m(1,3)*v.w; res.z := m(2,0)*v.x + m(2,1)*v.y + m(2,2)*v.z + m(2,3)*v.w; res.w := m(3,0)*v.x + m(3,1)*v.y + m(3,2)*v.z + m(3,3)*v.w; return res; end; function GetRow(m : Matrix4; i : integer) return vector4 is res : vector4; begin res.x := m(i,0); res.y := m(i,1); res.z := m(i,2); res.w := m(i,3); return res; end GetRow; function GetCol(m : Matrix4; i : integer) return vector4 is res : vector4; begin res.x := m(0,i); res.y := m(1,i); res.z := m(2,i); res.w := m(3,i); return res; end GetCol; procedure SetRow(m : in out Matrix4; i : in integer; v : in vector4) is begin m(i,0) := v.x; m(i,1) := v.y; m(i,2) := v.z; m(i,3) := v.w; end SetRow; procedure SetCol(m : in out Matrix4; i : in integer; v : in vector4) is begin m(0,i) := v.x; m(1,i) := v.y; m(2,i) := v.z; m(3,i) := v.w; end SetCol; function "*"(m1 : Matrix4; m2 : Matrix4) return Matrix4 is m : Matrix4; begin m(0,0) := m1(0,0) * m2(0,0) + m1(0,1) * m2(1,0) + m1(0,2) * m2(2,0) + m1(0,3) * m2(3,0); m(0,1) := m1(0,0) * m2(0,1) + m1(0,1) * m2(1,1) + m1(0,2) * m2(2,1) + m1(0,3) * m2(3,1); m(0,2) := m1(0,0) * m2(0,2) + m1(0,1) * m2(1,2) + m1(0,2) * m2(2,2) + m1(0,3) * m2(3,2); m(0,3) := m1(0,0) * m2(0,3) + m1(0,1) * m2(1,3) + m1(0,2) * m2(2,3) + m1(0,3) * m2(3,3); m(1,0) := m1(1,0) * m2(0,0) + m1(1,1) * m2(1,0) + m1(1,2) * m2(2,0) + m1(1,3) * m2(3,0); m(1,1) := m1(1,0) * m2(0,1) + m1(1,1) * m2(1,1) + m1(1,2) * m2(2,1) + m1(1,3) * m2(3,1); m(1,2) := m1(1,0) * m2(0,2) + m1(1,1) * m2(1,2) + m1(1,2) * m2(2,2) + m1(1,3) * m2(3,2); m(1,3) := m1(1,0) * m2(0,3) + m1(1,1) * m2(1,3) + m1(1,2) * m2(2,3) + m1(1,3) * m2(3,3); m(2,0) := m1(2,0) * m2(0,0) + m1(2,1) * m2(1,0) + m1(2,2) * m2(2,0) + m1(2,3) * m2(3,0); m(2,1) := m1(2,0) * m2(0,1) + m1(2,1) * m2(1,1) + m1(2,2) * m2(2,1) + m1(2,3) * m2(3,1); m(2,2) := m1(2,0) * m2(0,2) + m1(2,1) * m2(1,2) + m1(2,2) * m2(2,2) + m1(2,3) * m2(3,2); m(2,3) := m1(2,0) * m2(0,3) + m1(2,1) * m2(1,3) + m1(2,2) * m2(2,3) + m1(2,3) * m2(3,3); m(3,0) := m1(3,0) * m2(0,0) + m1(3,1) * m2(1,0) + m1(3,2) * m2(2,0) + m1(3,3) * m2(3,0); m(3,1) := m1(3,0) * m2(0,1) + m1(3,1) * m2(1,1) + m1(3,2) * m2(2,1) + m1(3,3) * m2(3,1); m(3,2) := m1(3,0) * m2(0,2) + m1(3,1) * m2(1,2) + m1(3,2) * m2(2,2) + m1(3,3) * m2(3,2); m(3,3) := m1(3,0) * m2(0,3) + m1(3,1) * m2(1,3) + m1(3,2) * m2(2,3) + m1(3,3) * m2(3,3); return m; end; end Generic_Vector_Math;
core/src/main/c/share/asmlib/libad64.asm
terasum/questdb
8,451
241135
; ----------------------------- LIBAD64.ASM --------------------------- ; DLL entry function for LIBAD64.DLL default rel global DllEntry SECTION .text align=16 DllEntry: mov eax, 1 ret ;DllMain endp
programs/oeis/123/A123290.asm
karttu/loda
1
246081
; A123290: Number of distinct binomial(n,2)-tuples of zeros and ones that are obtained as the collection of all 2 X 2 minor determinants of a 2 X n matrix over GF(2). ; 2,8,36,156,652,2668,10796,43436,174252,698028,2794156,11180716,44731052,178940588,715795116,2863245996,11453115052,45812722348,183251413676,733006703276,2932028910252,11728119835308,46912487729836,187649967696556,750599904340652,3002399684471468 mov $1,2 pow $1,$0 mov $0,2 sub $1,1 mul $1,2 mov $3,$1 mul $3,2 add $0,$3 mul $1,2 mov $2,$1 mov $4,1 mul $4,$1 add $0,$4 add $2,3 mul $2,$1 mov $1,$0 add $1,$2 div $1,12 mul $1,2 add $1,2
test/asset/agda-stdlib-1.0/Codata/Colist/Categorical.agda
omega12345/agda-mode
5
5888
<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- A categorical view of Colist ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe --sized-types #-} module Codata.Colist.Categorical where open import Codata.Conat using (infinity) open import Codata.Colist open import Category.Functor open import Category.Applicative functor : ∀ {ℓ i} → RawFunctor {ℓ} (λ A → Colist A i) functor = record { _<$>_ = map } applicative : ∀ {ℓ i} → RawApplicative {ℓ} (λ A → Colist A i) applicative = record { pure = replicate infinity ; _⊛_ = ap }
programs/oeis/167/A167545.asm
neoneye/loda
22
89146
<reponame>neoneye/loda ; A167545: n^6 mod 16. ; 0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9,0,9,0,1,0,1,0,9 pow $0,6 mod $0,16
libsrc/_DEVELOPMENT/adt/b_array/c/sdcc_iy/b_array_size_fastcall.asm
jpoikela/z88dk
640
85984
; size_t b_array_size_fastcall(b_array_t *a) SECTION code_clib SECTION code_adt_b_array PUBLIC _b_array_size_fastcall EXTERN asm_b_array_size defc _b_array_size_fastcall = asm_b_array_size
libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_capacity.asm
jpoikela/z88dk
640
84739
<reponame>jpoikela/z88dk<filename>libsrc/_DEVELOPMENT/adt/bv_stack/z80/asm_bv_stack_capacity.asm ; =============================================================== ; Mar 2014 ; =============================================================== ; ; size_t bv_stack_capacity(bv_stack_t *s) ; ; Return current capacity of the stack. ; ; =============================================================== SECTION code_clib SECTION code_adt_bv_stack PUBLIC asm_bv_stack_capacity EXTERN l_readword_hl defc asm_bv_stack_capacity = l_readword_hl - 4 ; enter : hl = stack * ; ; exit : hl = stack.capacity ; ; uses : a, hl
Task/String-matching/Ada/string-matching.ada
LaudateCorpus1/RosettaCodeData
1
10564
with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; procedure Match_Strings is S1 : constant String := "abcd"; S2 : constant String := "abab"; S3 : constant String := "ab"; begin if S1'Length >= S3'Length and then S1 (S1'First..S1'First + S3'Length - 1) = S3 then Put_Line (''' & S1 & "' starts with '" & S3 & '''); end if; if S2'Length >= S3'Length and then S2 (S2'Last - S3'Length + 1..S2'Last) = S3 then Put_Line (''' & S2 & "' ends with '" & S3 & '''); end if; Put_Line (''' & S3 & "' first appears in '" & S1 & "' at" & Integer'Image (Index (S1, S3))); Put_Line ( ''' & S3 & "' appears in '" & S2 & ''' & Integer'Image (Ada.Strings.Fixed.Count (S2, S3)) & " times" ); end Match_Strings;
source/asis/spec/annex_c/ada-task_termination.ads
faelys/gela-asis
4
18459
<gh_stars>1-10 ------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ with Ada.Task_Identification; with Ada.Exceptions; package Ada.Task_Termination is pragma Preelaborate(Task_Termination); type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception); type Termination_Handler is access protected procedure (Cause : in Cause_Of_Termination; T : in Ada.Task_Identification.Task_Id; X : in Ada.Exceptions.Exception_Occurrence); procedure Set_Dependents_Fallback_Handler (Handler: in Termination_Handler); function Current_Task_Fallback_Handler return Termination_Handler; procedure Set_Specific_Handler (T : in Ada.Task_Identification.Task_Id; Handler : in Termination_Handler); function Specific_Handler (T : Ada.Task_Identification.Task_Id) return Termination_Handler; end Ada.Task_Termination;