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
blob/DebuggerBlob.asm
flamewing/genesis-debugger
10
177744
; =========================================================================== ; Copyright (C) 2011-2018 by flamewing ; ; Permission to use, copy, modify, and/or distribute this software for any ; purpose with or without fee is hereby granted. ; ; 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. ; =========================================================================== ; For all the "unhandled" vectors. ErrorTrap: nop nop bra.s ErrorTrap ; These get called from the binary blob. Do not edit them, or move them ; relative to the binary blobs below. jmp (KosDec).l jmp (EniDec).l ; This is the terminal code and graphics, plus the disassembler and the plane ; mappings for the debugger. incbin "_debugger/Part1.bin" WHITE EQU 0<<13 BLUE EQU 1<<13 RED EQU 2<<13 GREEN EQU 3<<13 ; Strings are word arrays: length followed by characters. You can change the ; length, but do NOT change the number of characters! The wasted space is the ; price to pay for a binary blob... ; The high byte of each word used for a character is the palette line to use: HackerName: dc.w 11 dc.w WHITE|'Y', WHITE|'o', WHITE|'u', WHITE|'r', WHITE|' ', WHITE|'N' dc.w WHITE|'a', WHITE|'m', WHITE|'e', WHITE|' ', WHITE|' ' even EMailmsg: dc.w 33 dc.w BLUE|'y', BLUE|'o', BLUE|'u', BLUE|'r', BLUE|'.', BLUE|'e' dc.w BLUE|'m', BLUE|'a', BLUE|'i', BLUE|'l', BLUE|'@', BLUE|'s' dc.w BLUE|'e', BLUE|'r', BLUE|'v', BLUE|'e', BLUE|'r', BLUE|'.' dc.w BLUE|'d', BLUE|'o', BLUE|'m', BLUE|'a', BLUE|'i', BLUE|'n' dc.w BLUE|' ', BLUE|' ', BLUE|' ', BLUE|' ', BLUE|' ', BLUE|' ' dc.w BLUE|' ', BLUE|' ', BLUE|' ' even ; Do not move or add padding between the code that follows. The debugger is ; split into these many parts because asm68k sucks. BusErrorMsg: incbin "_debugger/Part2.bin" BusError: incbin "_debugger/Part3.bin" AddressError: incbin "_debugger/Part4.bin" TraceError: incbin "_debugger/Part5.bin" SpuriousException: incbin "_debugger/Part6.bin" ZeroDivideError: incbin "_debugger/Part7.bin" CHKExceptionError: incbin "_debugger/Part8.bin" TRAPVError: incbin "_debugger/Part9.bin" IllegalInstrError: incbin "_debugger/PartA.bin" PrivilegeViolation: incbin "_debugger/PartB.bin" LineAEmulation: incbin "_debugger/PartC.bin" LineFEmulation: incbin "_debugger/PartD.bin" TrapVector: incbin "_debugger/PartE.bin" ; Edit this to something sensible. One suggestion is the SVN revision. RevisionNumber: dc.w 1 incbin "_debugger/PartF.bin"
programs/oeis/208/A208946.asm
karttu/loda
0
163790
<filename>programs/oeis/208/A208946.asm ; A208946: Number of 4-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero with no three beads in a row equal. ; 5,22,57,122,223,366,563,820,1143,1544,2029,2604,3281,4066,4965,5990,7147,8442,9887,11488,13251,15188,17305,19608,22109,24814,27729,30866,34231,37830,41675,45772,50127,54752,59653,64836,70313,76090,82173,88574,95299,102354,109751,117496,125595,134060,142897,152112,161717,171718,182121,192938,204175,215838,227939,240484,253479,266936,280861,295260,310145,325522,341397,357782,374683,392106,410063,428560,447603,467204,487369,508104,529421,551326,573825,596930,620647,644982,669947,695548,721791,748688,776245,804468,833369,862954,893229,924206,955891,988290,1021415,1055272,1089867,1125212,1161313,1198176,1235813,1274230,1313433,1353434,1394239,1435854,1478291,1521556,1565655,1610600,1656397,1703052,1750577,1798978,1848261,1898438,1949515,2001498,2054399,2108224,2162979,2218676,2275321,2332920,2391485,2451022,2511537,2573042,2635543,2699046,2763563,2829100,2895663,2963264,3031909,3101604,3172361,3244186,3317085,3391070,3466147,3542322,3619607,3698008,3777531,3858188,3939985,4022928,4107029,4192294,4278729,4366346,4455151,4545150,4636355,4728772,4822407,4917272,5013373,5110716,5209313,5309170,5410293,5512694,5616379,5721354,5827631,5935216,6044115,6154340,6265897,6378792,6493037,6608638,6725601,6843938,6963655,7084758,7207259,7331164,7456479,7583216,7711381,7840980,7972025,8104522,8238477,8373902,8510803,8649186,8789063,8930440,9073323,9217724,9363649,9511104,9660101,9810646,9962745,10116410,10271647,10428462,10586867,10746868,10908471,11071688,11236525,11402988,11571089,11740834,11912229,12085286,12260011,12436410 mov $5,$0 mov $6,$0 add $0,1 add $0,$5 mov $2,$0 mov $0,4 mov $3,1 mov $4,1 lpb $2,1 lpb $4,1 mov $1,$0 sub $4,$3 trn $5,$2 trn $2,2 add $5,3 add $5,$2 lpe add $0,$3 lpb $5,1 sub $5,$3 add $0,$5 lpe add $1,$0 sub $0,6 add $1,3 add $1,$0 trn $2,1 add $4,$3 lpe add $1,3 lpb $6,1 add $1,11 sub $6,1 lpe sub $1,15
oeis/142/A142737.asm
neoneye/loda-programs
11
8184
<filename>oeis/142/A142737.asm<gh_stars>10-100 ; A142737: Primes congruent to 10 mod 59. ; Submitted by <NAME> ; 541,659,1013,1249,1367,1721,2311,3019,3137,3373,3491,3727,4789,5261,5851,6323,7621,8093,8329,8447,9391,10099,10453,11161,11279,11633,11987,12577,13049,13757,14347,15173,15527,15881,16943,18713,19421,20011,20129,20483,20719,21191,22961,23197,23669,24023,24967,25321,25439,25793,26029,26501,26737,27091,27799,27917,28979,29333,29569,30631,32401,33581,34171,36767,37003,37357,38183,38891,39953,40189,40543,40897,41959,42667,44201,44909,45263,45853,45971,46679,47269,47387,47623,47741,47977,48449,49157 mov $1,3 mov $2,$0 add $2,6 pow $2,2 lpb $2 add $1,24 sub $2,1 mov $3,$1 add $1,4 add $3,7 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,31 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,55
45/beef/cw/kernel/kerninit.asm
minblock/msdos
0
178248
;* ;* COW : Character Oriented Windows ;* ;* kerninit : kernel initialization procedure / kernel exit procedure include kernel.inc include galloc.inc ;* for hi_hexpand include indrv.inc ;* for inos include inscr.inc ;* for insj include inkbd.inc ;* for inkj include insyd.inc ;* for inyj neLomOffset = neLom PUBLIC neLomOffset ;* address for Pcode Debugger ;---------------------------------------------------------------------------- IFDEF DUAL createSeg CWOS2,CWOS2,BYTE,PUBLIC,CODE createSeg OSSPEC_TEXT,OSSPEC_TEXT,BYTE,PUBLIC,CODE sBegin DATA externW <inosDrv,insj,inkj,inyj> externW <insjOS2,inkjOS2,inyjOS2> externW <_eData> globalW fProtectMode,? sEnd DATA sBegin CWOS2 externW <inosDrvOS2> sEnd CWOS2 sBegin OSSPEC_TEXT externW <rgfnosspec,rgfnosspec3> sEnd OSSPEC_TEXT sBegin DRV externW pinos sEnd DRV ENDIF ;DUAL createSeg KERNEL_BUFF,KERNEL_BUFF,WORD,PUBLIC,BEFORE_BSS,DGROUP ;---------------------------------------------------------------------------- sBegin KERNEL_BUFF assumes DS,DGROUP globalB rgbKernelBuff,<2 DUP (?)> ;* Kernel buffer placed before BSS. ;* see KNULL.ASM for special kludge sEnd KERNEL_BUFF ;---------------------------------------------------------------------------- sBegin BSS assumes DS,DGROUP externB iexeCur ;* set to 255 when closing EXE file globalW psLom,0 ;* ps of LOM data initialized by loader globalW hGlobalHeap,0 ; Handle to master object globalW pGlobalHeap,0 ; Current physical address globalB fShellPresent,0 ;* TRUE if DOS SHELL present IFDEF STARTUP_SAVE_DIR ;* szDirOrig : x:\dir.... staticB szDirOrig,<(3+64) DUP (?)> ;* original directory ENDIF ;STARTUP_SAVE_DIR sEnd BSS ;---------------------------------------------------------------------------- sBegin DATA assumes DS,DGROUP externW <pStackTop, pStackMin, pStackBot> externDP <pwndFocus> ;* for restoring focus externW <fColorModeOld> ;* last color mode IFDEF DEBUG externB <sdVerCow> externB <ayMac> ENDIF ;*DEBUG sEnd DATA ;---------------------------------------------------------------------------- ;* * Far entry provided by application externFPublic <WinMain> externFPublic <GlobalFree> externFP <LeaveCow> IFDEF DUAL externFP <FInitCow> externFP <ExitKernel> ENDIF ;DUAL ;* * screen init - reinit must be fixed !! externFPublic <FInitScreenInternal> ;* (private) externFP <FInitMouse> ;* from mouse.asm externFPublic <FEnableMouse> externFP <FInitSysTimer> ;* from ktimer.asm externFP <InitThunk> ;* from ldthunk.asm externFP <InitInt24Etc> ;* from int24.asm externFP <ReroutePrtSc> ;---------------------------------------------------------------------------- sBegin KERNEL externNP <ghexpand> ; Near procedure in Kernel segment. sEnd KERNEL ;---------------------------------------------------------------------------- sBegin INIT IFDEF KEEP_SYMDEB_CODE externNP <DebugInit> ;* from lddebug.asm ENDIF ; KEEP_SYMDEB_CODE ifdef CBox externNP <TouchUpTables> endif ; CBox ;********** BeginKernel ********** ;* entry : es = psLom ;* ax = handle of LOADER ;* si = start of DDS local heap ;* di = end of DDS local heap ;* sp = Bottom of stack ;* * rgbKernel filled with rlbMove (relocations for main swap file). ;* * Called by loader to start up the kernel ;* exit : NEVER EXITED ! (see ExitKernel()). assumes CS,INIT assumes DS,DGROUP assumes SS,DGROUP assumes ES,NOTHING IFDEF DUAL os2_startup: ;* entry: es == 0 ;* ds == DGROUP ;* ax == env seg ;* bx == offset of command line in env seg ;* cx == cbDGROUP ;* bp == 0 mov pStackBot,sp push ax ;* push parms for WinMain push bx ;* * Initialize OS specific tables ;* * NOTE: No OS specific calls can be made before this operation!! lea ax,_eData mov pStackTop,ax push ds pop es ;* ES => DGROUP mov ax,CWOS2 mov ds,ax ;* DS => CWOS2 assumes DS,CWOS2 assumes ES,DGROUP ;* * Initialize the OS/2 form of inosDrv mov di,dataOffset inosDrv mov si,cwos2Offset inosDrvOS2 mov cx,(cbInosMin + 1) / 2 Assert <(cbInosMin + 1) / 2 EQ cbInosMin / 2> rep movsw push es pop ds assumes DS,DGROUP assumes ES,nothing ;* * insj mov di,dataOffset insj mov si,dataOffset insjOS2 mov cx,(cbInsjMin + 1) / 2 Assert <(cbInsjMin + 1) / 2 EQ cbInsjMin / 2> rep movsw ;* * inkj mov di,dataOffset inkj mov si,dataOffset inkjOS2 mov cx,(cbInkjMin + 1) / 2 Assert <(cbInkjMin + 1) / 2 EQ cbInkjMin / 2> rep movsw ;* * inyj mov di,dataOffset inyj mov si,dataOffset inyjOS2 mov cx,(cbInyjMin + 1) / 2 Assert <(cbInyjMin + 1) / 2 EQ cbInyjMin / 2> rep movsw ;* * OS calls now available mov fProtectMode,sp ;* we are in protect mode ; cCall FInitCow ; or ax,ax ; jz init_err cCall WinMain ;* <ax,bx> already pushed IFDEF DEBUG cCall CowAssertFailed DB "Return from WinMain$" ENDIF ;DEBUG init_err: mov ax,2 cCall ExitKernel ENDIF ;DUAL LabelFP <PUBLIC, cw_init> ;* special label for Binding cProc BeginKernel,<FAR,PUBLIC,ATOMIC> cBegin BeginKernel push ax ;* save hmemLoader mov psLom,es ;* save all important psLom IFDEF DUAL ;* * check for OS/2 startup mov cx,es jcxz os2_startup ENDIF ;DUAL IFDEF DEBUG IFDEF NOT_WANTED ;* Print COW version stamp mov dx,dataOffset sdVerCow mov ah,9 int 21h ENDIF ;NOT_WANTED ENDIF ;DEBUG IFDEF DUAL ;* * we are in real mode! xor cx,cx mov fProtectMode,cx ;* * Initialize OS specific tables ;* * NOTE: No OS specific calls can be made before this operation!! push ds push es push si push di ;* * Set OS specific jump table to DOS 3 form mov ax,OSSPEC_TEXT mov ds,ax ;* DS,ES => OSSPEC_TEXT mov es,ax assumes DS,OSSPEC_TEXT assumes ES,OSSPEC_TEXT mov si,osspec_textOffset rgfnosspec3 mov di,osspec_textOffset rgfnosspec mov cx,si sub cx,di inc cx shr cx,1 rep movsw ;* * Set pinos to 0, indicating DOS 3 mov ax,DRV_FIXED mov ds,ax ;* DS => DRV assumes DS,DRV_FIXED xor cx,cx mov ds:[pinos],cx pop di pop si pop es pop ds assumes DS,DGROUP assumes ES,nothing ;* * OS calls now available ENDIF ;DUAL ;* * Copy very important variables from LOM into DS mov ax,es:[pGlobalHeapLom] mov pGlobalHeap,ax mov ax,es:[hGlobalHeapLom] mov hGlobalHeap,ax ;* * Initialize DDS for stack limits mov ax,sp mov pStackBot,ax mov pStackMin,ax sub ax,es:[neLom.ne_stack] ;* less stack size mov pStackTop,ax ;* * Set global handle expansion proc mov es,pGlobalHeap mov es:[hi_hexpand],kernelOffset ghexpand IFDEF KEEP_SYMDEB_CODE ;* * Initialize Debugger cCall DebugInit ENDIF ;KEEP_SYMDEB_CODE ;* * Initialize entry table for Thunk control cCall InitThunk ;* * Initialize the system timer cCall FInitSysTimer ;* * Initialize INT24 hook cCall InitInt24Etc ;* * Free the loader cCall GlobalFree ;* handle already on the stack IFDEF DEBUG or ax,ax jz ok_free_loader cCall CowAssertFailed DB "freeing loader$" ok_free_loader: ENDIF ;DEBUG ;* * save the start-up drive / directory IFDEF STARTUP_SAVE_DIR mov si,dataOffset szDirOrig mov ah,19h int 21h add al,'A' mov [si],al mov word ptr [si+1], '\:' ;* drive:\ lea si,[si+3] ;* after drive xor dl,dl ;* current drive mov ah,47h ;* get directory (current drive) int 21h ENDIF ;STARTUP_SAVE_DIR ;* * test for shell present mov ah,30h int 21h ;* check DOS major version cmp al,3 jb ancient_dos ;* * DOS 3 or higher, we can use the INT 2F multiplex 18H test. mov ax,1800h ;* check shell present int 2fh ;* 0 if not present ;* 80H if stub present ;* FFH if shell present and al,1 ;* TRUE if present mov fShellPresent,al ancient_dos: ;* * call the Application's main entry point mov ax,lomOffset szCmdLine ;* address of command line cCall WinMain,<psLom,ax> IFDEF DEBUG cCall CowAssertFailed DB "Return from WinMain$" ENDIF ;DEBUG cEnd BeginKernel ;---------------------------------------------------------------------------- ; ; COW PUBLIC ENTRY ; entry: pinst => INST structure (NULL => re-init previous mode) ; * Initialize screen & mouse ; exit: AX = 1 if ok, 0 if error assumes CS,INIT assumes DS,DGROUP assumes SS,DGROUP assumes ES,NOTHING IFNDEF PROFILE cProc FInitScreen,<PUBLIC, FAR, ATOMIC> ;* all calls atomic ELSE cProc FInitScreen,<PUBLIC, FAR> ;* profile needs BP saved ENDIF ;PROFILE parmW pinst ;* mode (pass to internal init) cBegin FInitScreen StartPublic cCall FInitScreenInternal, <pinst> or ax,ax jz @F cCall FInitMouse ;* ax = success code or ax,ax jz @F mov bx,pinst ifdef CBox cCall TouchUpTables endif ; CBox cCall ReroutePrtSc test [bx].finstInst,finstDisableMouse jz @F xor ax,ax cCall FEnableMouse,<ax> ;* turn mouse off mov ax,sp @@: Save <ax> StopPublic cEnd FInitScreen sEnd INIT ;---------------------------------------------------------------------------- sBegin EXIT ;---------------------------------------------------------------------------- ; ; EndCow ; prepare CW for termination ; ; entry : fClearScreen => should we clear the screen ; exit : n/a (COW disabled) assumes CS,EXIT assumes SS,DGROUP assumes DS,DGROUP assumes ES,NOTHING cPublic EndCow, <ATOMIC> parmW fClearScreen cBegin EndCow cCall LeaveCow,<fClearScreen> cEnd EndCow sEnd EXIT ;---------------------------------------------------------------------------- END BeginKernel
sk/sfx/A7.asm
Cancer52/flamedriver
9
104459
<filename>sk/sfx/A7.asm Sound_A7_Header: smpsHeaderStartSong 3 smpsHeaderVoice Sound_A7_AD_Voices smpsHeaderTempoSFX $01 smpsHeaderChanSFX $01 smpsHeaderSFXChannel cFM3, Sound_A7_FM3, $0B, $10 ; FM3 Data Sound_A7_FM3: smpsSetvoice $00 dc.b nB4, $17 smpsStop Sound_A7_AD_Voices: ; Voice $00 ; $07 ; $30, $70, $10, $20, $17, $19, $14, $14, $00, $00, $00, $00 ; $0C, $0C, $0C, $0C, $0F, $0F, $0F, $0F, $80, $80, $80, $80 smpsVcAlgorithm $07 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $02, $01, $07, $03 smpsVcCoarseFreq $00, $00, $00, $00 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $14, $14, $19, $17 smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $00 smpsVcDecayRate2 $0C, $0C, $0C, $0C smpsVcDecayLevel $00, $00, $00, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $00, $00, $00
source/command_line.adb
jquorning/CELLE
0
19167
-- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Ada.Text_IO; with Ada.Command_Line; with GNAT.Command_Line; with Options; with Macros; package body Command_Line is procedure Getopt_Callback (Switch : in String; Param : in String; Section : in String); -- To be installed and called by Getopt on command line switch encounter. Long_Switch_Output_Dir : constant String := "--output-dir"; Long_Switch_Show_Help : constant String := "--help"; Long_Switch_Template_File : constant String := "--template"; Long_Switch_Language : constant String := "--language"; Long_Switch_Show_Version : constant String := "--version"; Switch_Define_Macro_Long : constant String := "--define-macro"; Switch_Define_Macro_Short : constant String := "-D"; use GNAT.Command_Line; Config : Command_Line_Configuration; File_Count : Natural := Natural'First; procedure Getopt_Callback (Switch, Param, Section : in String) is pragma Unreferenced (Section); begin if Switch = Switch_Define_Macro_Short or Switch = Switch_Define_Macro_Long then Macros.Append (Param); else -- Then it must be the file to process (.y). -- Found switch not accounted for. Assume input file name. Options.Input_File := new String'(Switch); File_Count := Natural'Succ (File_Count); end if; end Getopt_Callback; procedure Parse (Success : out Boolean) is begin Success := False; Options.Program_Name := new String'(Ada.Command_Line.Command_Name); Define_Switch (Config, Options.Basis_Flag'Access, "-b", Help => "Print only the basis in report."); Define_Switch (Config, Options.Compress'Access, "-c", Help => "Do not compress the action table."); Define_Switch (Config, Options.Output_Dir'Access, "-d=", Help => "Output directory. Default '.'", Long_Switch => Long_Switch_Output_Dir & '=', Argument => "DIR"); Define_Switch (Config, "-D=", -- Handled by GetOpt_Callback Help => "Define an %ifdef macro.", Long_Switch => Switch_Define_Macro_Long & '=', Argument => "MACRO"); Define_Switch (Config, Options.Placeholder_Dummy'Access, "-f=", Help => "Placeholder for -f compiler options. Ignored.", Argument => "IGNORE"); Define_Switch (Config, Options.RP_Flag'Access, "-g", Help => "Print grammar without actions."); Define_Switch (Config, Options.Show_Help'Access, "-h", Help => "Show this help text.", Long_Switch => Long_Switch_Show_Help); Define_Switch (Config, Options.Placeholder_Dummy'Access, "-I=", Help => "Placeholder for '-I' compiler options. Ignored.", Argument => "IGNORE"); Define_Switch (Config, Options.Language_String'Access, "-L=", Help => "Language (Ada, C). Default is 'C'.", Long_Switch => Long_Switch_Language & '=', Argument => "LANG"); Define_Switch (Config, Options.Make_Headers'Access, "-m", Help => "Output a makeheaders compatible file."); Define_Switch (Config, Options.No_Line_Nos'Access, "-l", Help => "Do not print #line statements."); Define_Switch (Config, Options.Placeholder_Dummy'Access, "-O=", Help => "Placeholder for '-O' compiler options. Ignored.", Argument => "IGNORE"); Define_Switch (Config, Options.Show_Conflict'Access, "-p", Help => "Show conflicts resolved by precedence rules."); Define_Switch (Config, Options.Be_Quiet'Access, "-q", Help => "Quiet. Do not print the report file."); Define_Switch (Config, Options.No_Resort'Access, "-r", Help => "Do not sort or renumber states"); Define_Switch (Config, Options.Statistics'Access, "-s", Help => "Print parser stats to standard output."); Define_Switch (Config, Options.Generate_SQL'Access, "-S", Help => "Generate the *.sql file describing the parser tables."); Define_Switch (Config, Options.Show_Version'Access, "-x", Help => "Show program name and version.", Long_Switch => Long_Switch_Show_Version); Define_Switch (Config, Options.User_Template'Access, "-T=", Help => "Specify a template file.", Long_Switch => Long_Switch_Template_File & '=', Argument => "FILE"); Define_Switch (Config, Options.Placeholder_Dummy'Access, "-W=", Help => "Placeholder for '-W' compiler options. Ignored.", Argument => "IGNORE"); Define_Switch (Config, Options.Debug_Level'Access, "-z=", Help => "Emit debug info (dump of tables etc). " & "(Default LEVEL= 0)", Argument => "LEVEL"); Define_Switch (Config, "*", Help => "File to Parse (Typically parse.y)."); -- Do the whole parsing business. -- Actually just the -D= option and file name. begin Getopt (Config, Getopt_Callback'Access); exception when Exit_From_Command_Line => Options.Show_Help := True; Success := True; end; if Options.Show_Help or Options.Show_Version then Success := True; elsif File_Count = 1 then Success := True; else raise Parameter_Error with "Error: Exactly one source file must be givven."; end if; exception when Invalid_Switch => Ada.Text_IO.Put_Line ("INVALID_SWITCH"); Success := False; when Invalid_Parameter => Ada.Text_IO.Put_Line ("INVALID_PARAMETER"); Success := False; -- when Exit_From_Command_Line => -- Ada.Text_IO.Put_Line ("EXIT_FROM_COMMAND_LINE"); -- Success := False; end Parse; end Command_Line;
nasm-gcc-container/nasm-gcc/src/02/_18.asm
smith-30/low-layer
0
18817
section .data test: dq -1 section .text mov byte[test], 1 mov word[test], 1 mov dword[test], 1 mov qword[test], 1 global _start _start: ; mov byte[test], 1 ; mov word[test], 1 ; mov dword[test], 1 ; mov qword[test], 1 mov rax, 1 mov rdi, 1 mov rsi, [test] mov rdx, 1 syscall mov rax, 60 xor rdi, rdi syscall ; mov word[test], 1 ; mov dword[test], 1 ; mov qword[test], 1
reuse/TestArraySum.asm
William0Friend/my_masm
0
2077
; Testing the ArraySum procedure (TestArraySum.asm) .386 .model flat,stdcall .stack 4096 ExitProcess PROTO, dwExitCode:dword .data array dword 10000h,20000h,30000h,40000h,50000h theSum dword ? .code main proc mov esi,OFFSET array ; ESI points to array mov ecx,LENGTHOF array ; ECX = array count call ArraySum ; calculate the sum mov theSum,eax ; returned in EAX invoke ExitProcess,0 main endp ;----------------------------------------------------- ArraySum proc ; ; Calculates the sum of an array of 32-bit integers. ; Receives: ESI = the array offset ; ECX = number of elements in the array ; Returns: EAX = sum of the array elements ;----------------------------------------------------- push esi ; save ESI, ECX push ecx mov eax,0 ; set the sum to zero L1: add eax,[esi] ; add each integer to sum add esi,TYPE DWORD ; point to next integer loop L1 ; repeat for array size pop ecx ; restore ECX, ESI pop esi ret ; sum is in EAX ArraySum endp end main
oeis/132/A132732.asm
neoneye/loda-programs
11
10088
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A132732: Row sums of triangle A132731. ; 1,2,4,10,24,54,116,242,496,1006,2028,4074,8168,16358,32740,65506,131040,262110,524252,1048538,2097112,4194262,8388564,16777170,33554384,67108814,134217676,268435402,536870856,1073741766,2147483588,4294967234,8589934528,17179869118,34359738300,68719476666,137438953400,274877906870,549755813812,1099511627698,2199023255472,4398046511022,8796093022124,17592186044330,35184372088744,70368744177574,140737488355236,281474976710562,562949953421216,1125899906842526,2251799813685148,4503599627370394 mov $1,2 pow $1,$0 mul $0,2 mul $1,2 mov $2,$0 cmp $2,0 add $0,$2 sub $1,$0 mov $0,$1
greetings/gmain.adb
MatrixMike/AdaDemo1
1
11022
with Greetings; procedure Gmain is begin Greetings.Hello; Greetings.Middle; Greetings.Goodbye; end Gmain;
8. Hex to decimal (A,B,C -> 0,1,2).asm
arfin97/Assembly
1
173375
; Write· a program to read one of the hex digits A-F, and display it on the next line in decimal. .model small .stack 100h .data msg1 db 'enter a hex digit: $' msg2 db 'the decimal is: $' var db ? .code main proc ;initialization mov ax, @data mov ds, ax ;display msg 1 lea dx, msg1 mov ah, 9 int 21h ;input hex char mov ah, 1 int 21h ;convert it to decimal mov var, al sub var, 17d ;print new line mov ah, 2 mov dl, 0dh int 21h mov dl, 0ah int 21h ;display msg 2 lea dx, msg2 mov ah, 9 int 21h ;display converted num mov ah, 2 mov dl, var int 21h ;exit dos mov ah, 4ch int 21h main endp end main
GIOVANNI/gambatte/test/hwtests/oamdma/oamdmasrcC000_gdmasrcC000_gdmalen13_oamdumper_1.asm
ReallyEvilFish/1234
9
2517
<filename>GIOVANNI/gambatte/test/hwtests/oamdma/oamdmasrcC000_gdmasrcC000_gdmalen13_oamdumper_1.asm .size 8000 .data@0 01 .text@48 jp lstatint .data@9c 02 03 04 05 .text@100 jp lbegin .data@143 c0 00 00 00 1a 00 03 .text@150 lbegin: ld c, 44 ld b, 90 lbegin_waitly90: ldff a, (c) cmp a, b jrnz lbegin_waitly90 ld a, 0a ld(0000), a ld hl, fe00 ld c, a0 ld a, a0 lbegin_fill_oam: ld(hl++), a dec c jrnz lbegin_fill_oam ld c, 44 ld b, 90 lbegin_waitly90_2: ldff a, (c) cmp a, b jrnz lbegin_waitly90_2 ld hl, c1ff ld a, 00 lbegin_set_c1xx: ld(hl--), a inc a jrnz lbegin_set_c1xx lbegin_set_c0xx: dec a ld(hl--), a jrnz lbegin_set_c0xx ld a, 90 ldff(45), a ld a, 40 ldff(41), a xor a, a ldff(0f), a ld a, 02 ldff(ff), a ei halt .text@1000 lstatint: ld a, c0 ldff(51), a xor a, a ldff(52), a ldff(54), a ld a, 80 ldff(53), a ld c, 55 ld a, c0 ldff(46), a ld a, 13 ldff(55), a nop nop nop nop ld c, 44 ld b, 96 lstatint_waitly96: ldff a, (c) cmp a, b jrnz lstatint_waitly96 xor a, a ldff(40), a ld hl, feff ld de, a000 lstatint_dump_oam_to_sram: ld a, (hl--) dec e ld(de), a jrnz lstatint_dump_oam_to_sram xor a, a ld(0000), a
src/util-streams.ads
Letractively/ada-util
0
25562
----------------------------------------------------------------------- -- Util.Streams -- Stream utilities -- Copyright (C) 2010 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Streams; package Util.Streams is pragma Preelaborate; -- ----------------------- -- Output stream -- ----------------------- -- The <b>Output_Stream</b> is an interface that accepts output bytes -- and sends them to a sink. type Output_Stream is limited interface; type Output_Stream_Access is access all Output_Stream'Class; -- Write the buffer array to the output stream. procedure Write (Stream : in out Output_Stream; Buffer : in Ada.Streams.Stream_Element_Array) is abstract; -- Flush the buffer (if any) to the sink. procedure Flush (Stream : in out Output_Stream) is null; -- Close the sink. procedure Close (Stream : in out Output_Stream) is null; -- ----------------------- -- Input stream -- ----------------------- -- The <b>Input_Stream</b> is the interface that reads input bytes -- from a source and returns them. type Input_Stream is limited interface; type Input_Stream_Access is access all Input_Stream'Class; -- Read into the buffer as many bytes as possible and return in -- <b>last</b> the position of the last byte read. procedure Read (Stream : in out Input_Stream; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is abstract; -- Copy the input stream to the output stream until the end of the input stream -- is reached. procedure Copy (From : in out Input_Stream'Class; Into : in out Output_Stream'Class); -- Notes: -- ------ -- The <b>Ada.Streams.Root_Stream_Type</b> implements the <b>Output_Stream</b> -- and <b>Input_Stream</b>. It is however not easy to use for composing various -- stream behaviors. end Util.Streams;
AsmSamples/loop/mycode.asm
ytugba/My-Otiose-Projects
1
103574
; multiplies each element of BLOCK1 by 2 and stores the result in BLOCK2 ; org 100h BLOCK1 DW 1h, 2h, 3h, 4h BLOCK2 DW 4 DUP(?) cld; clear direction flag (auto-increment) mov cx, 4 mov si, offset BLOCK1 mov di, offset BLOCK2 l1: lodsw mov dx, 2 mul dx stosw loop l1 hlt
oeis/108/A108874.asm
neoneye/loda-programs
11
11490
; A108874: Numbers n such that 41*n + 43 is prime. ; Submitted by <NAME> ; 0,14,20,26,38,44,48,56,60,66,80,90,116,126,138,140,146,158,170,174,186,198,200,224,228,230,236,240,248,254,264,266,270,290,294,300,306,308,314,320,324,338,354,356,368,374,378,384,390,398,404,416,426,434,446,450,468,474,476,488,494,500,504,506,530,534,548,558,560,564,578,588,606,608,620,630,636,650,660,668,684,696,698,710,716,734,756,758,768,776,800,818,824,836,840,846,858,888,894,896 mov $1,39 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $1,18 sub $2,1 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,59 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,80 div $0,41 mul $0,2
src/LibraBFT/Impl/Consensus/Liveness/RoundState.agda
LaudateCorpus1/bft-consensus-agda
0
1354
<filename>src/LibraBFT/Impl/Consensus/Liveness/RoundState.agda {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import LibraBFT.Base.Types import LibraBFT.Impl.Consensus.BlockStorage.BlockStore as BlockStore import LibraBFT.Impl.Consensus.ConsensusTypes.SyncInfo as SyncInfo import LibraBFT.Impl.Consensus.ConsensusTypes.Vote as Vote import LibraBFT.Impl.Consensus.PendingVotes as PendingVotes import LibraBFT.Impl.OBM.ECP-LBFT-OBM-Diff.ECP-LBFT-OBM-Diff-1 as ECP-LBFT-OBM-Diff-1 open import LibraBFT.Impl.OBM.Logging.Logging open import LibraBFT.Impl.OBM.Rust.Duration as Duration open import LibraBFT.Impl.OBM.Rust.RustTypes open import LibraBFT.Impl.OBM.Time open import LibraBFT.ImplShared.Base.Types open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.ImplShared.Util.Crypto open import LibraBFT.ImplShared.Util.Dijkstra.All open import LibraBFT.Abstract.Types.EpochConfig UID NodeId open import Optics.All open import Util.Hash open import Util.ByteString open import Util.PKCS open import Util.Prelude ------------------------------------------------------------------------------ open import Agda.Builtin.Float module LibraBFT.Impl.Consensus.Liveness.RoundState where ------------------------------------------------------------------------------ new : RoundStateTimeInterval → Instant → RoundState new ti i = mkRoundState {-_rsTimeInterval =-} ti {-_rsHighestCommittedRound =-} {-Round-} 0 {-_rsCurrentRound =-} {-Round-} 0 {-_rsCurrentRoundDeadline =-} i {-_rsPendingVotes =-} PendingVotes∙new {-_rsVoteSent =-} nothing ------------------------------------------------------------------------------ setupTimeoutM : Instant → LBFT Duration processLocalTimeoutM : Instant → Epoch → Round → LBFT Bool processLocalTimeoutM now obmEpoch round = do currentRound ← use (lRoundState ∙ rsCurrentRound) ifD round /= currentRound then pure false else do void (setupTimeoutM now) -- setup the next timeout ECP-LBFT-OBM-Diff-1.e_RoundState_processLocalTimeoutM obmEpoch round ------------------------------------------------------------------------------ maybeAdvanceRound : Round → SyncInfo → Maybe (Round × NewRoundReason) processCertificatesM : Instant → SyncInfo → LBFT (Maybe NewRoundEvent) processCertificatesM now syncInfo = do -- logEE ("RoundState" ∷ "processCertificatesM" {-∷ lsSI syncInfo-} ∷ []) $ do rshcr <- use (lRoundState ∙ rsHighestCommittedRound) whenD (syncInfo ^∙ siHighestCommitRound >? rshcr) $ do lRoundState ∙ rsHighestCommittedRound ∙= (syncInfo ^∙ siHighestCommitRound) logInfo fakeInfo -- InfoUpdateHighestCommittedRound (syncInfo^.siHighestCommitRound) rscr ← use (lRoundState ∙ rsCurrentRound) maybeSD (maybeAdvanceRound rscr syncInfo) (pure nothing) $ λ (pcr' , reason) → do lRoundState ∙ rsCurrentRound ∙= pcr' lRoundState ∙ rsPendingVotes ∙= PendingVotes∙new lRoundState ∙ rsVoteSent ∙= nothing timeout ← setupTimeoutM now pure (just (NewRoundEvent∙new pcr' reason timeout)) abstract processCertificatesM-abs = processCertificatesM processCertificatesM-abs-≡ : processCertificatesM-abs ≡ processCertificatesM processCertificatesM-abs-≡ = refl maybeAdvanceRound currentRound syncInfo = let newRound = SyncInfo.highestRound syncInfo + 1 in if-dec newRound >? currentRound then just (newRound , (if is-nothing (syncInfo ^∙ siHighestTimeoutCert) then QCReady else TOReady)) else nothing ------------------------------------------------------------------------------ insertVoteM : Vote → ValidatorVerifier → LBFT VoteReceptionResult insertVoteM vote verifier = do currentRound ← use (lRoundState ∙ rsCurrentRound) ifD vote ^∙ vVoteData ∙ vdProposed ∙ biRound == currentRound then PendingVotes.insertVoteM vote verifier else pure (UnexpectedRound (vote ^∙ vVoteData ∙ vdProposed ∙ biRound) currentRound) ------------------------------------------------------------------------------ recordVoteM : Vote → LBFT Unit recordVoteM v = rsVoteSent-rm ∙= just v ------------------------------------------------------------------------------ setupDeadlineM : Instant → LBFT Duration roundIndexAfterCommittedRound : Round → Round → Round getRoundDuration : ExponentialTimeInterval → Round → Duration setupTimeoutM now = do timeout ← setupDeadlineM now r ← use (lRoundState ∙ rsCurrentRound) -- act (SetTimeout timeout r) pure timeout setupDeadlineM now = do ti ← use (lRoundState ∙ rsTimeInterval) cr ← use (lRoundState ∙ rsCurrentRound) hcr ← use (lRoundState ∙ rsHighestCommittedRound) let timeout = getRoundDuration ti (roundIndexAfterCommittedRound cr hcr) lRoundState ∙ rsCurrentRoundDeadline ∙= iPlus now timeout pure timeout roundIndexAfterCommittedRound currentRound highestCommittedRound = grd‖ highestCommittedRound == 0 ≔ currentRound ∸ 1 ‖ currentRound <?ℕ highestCommittedRound + 3 ≔ 0 ‖ otherwise≔ currentRound ∸ highestCommittedRound ∸ 3 postulate -- TODO-1 : _**_, ceiling (for Floats) _**_ : Float → Float → Float ceiling : Float → U64 getRoundDuration i r = let pow = min r (i ^∙ etiMaxExponent) -- TODO/NOTE: cap on max timeout -- undermines theoretical liveness properties baseMultiplier = (i ^∙ etiExponentBase) ** {-fromIntegral-} primNatToFloat pow --durationMs = ceiling (fromIntegral (i^.etiBaseMs) * baseMultiplier) durationMs = ceiling (primFloatTimes (primNatToFloat (i ^∙ etiBaseMs)) baseMultiplier) in Duration.fromMillis durationMs
data/pokemon/dex_entries/drapion.asm
AtmaBuster/pokeplat-gen2
6
16802
db "SCORPION@" ; species name db "It attacks people" next "and #MON that" next "cross the desert." page "This has only" next "furthered its bad" next "reputation.@"
agda-stdlib-0.9/src/Data/Fin/Subset/Properties.agda
qwe2/try-agda
1
10681
<filename>agda-stdlib-0.9/src/Data/Fin/Subset/Properties.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Some properties about subsets ------------------------------------------------------------------------ module Data.Fin.Subset.Properties where open import Algebra import Algebra.Properties.BooleanAlgebra as BoolProp open import Data.Empty using (⊥-elim) open import Data.Fin using (Fin); open Data.Fin.Fin open import Data.Fin.Subset open import Data.Nat using (ℕ) open import Data.Product open import Data.Sum as Sum open import Data.Vec hiding (_∈_) open import Function open import Function.Equality using (_⟨$⟩_) open import Function.Equivalence using (_⇔_; equivalence; module Equivalence) open import Relation.Binary open import Relation.Binary.PropositionalEquality as P using (_≡_) ------------------------------------------------------------------------ -- Constructor mangling drop-there : ∀ {s n x} {p : Subset n} → suc x ∈ s ∷ p → x ∈ p drop-there (there x∈p) = x∈p drop-∷-⊆ : ∀ {n s₁ s₂} {p₁ p₂ : Subset n} → s₁ ∷ p₁ ⊆ s₂ ∷ p₂ → p₁ ⊆ p₂ drop-∷-⊆ p₁s₁⊆p₂s₂ x∈p₁ = drop-there $ p₁s₁⊆p₂s₂ (there x∈p₁) drop-∷-Empty : ∀ {n s} {p : Subset n} → Empty (s ∷ p) → Empty p drop-∷-Empty ¬∃∈ (x , x∈p) = ¬∃∈ (suc x , there x∈p) ------------------------------------------------------------------------ -- Properties involving ⊥ ∉⊥ : ∀ {n} {x : Fin n} → x ∉ ⊥ ∉⊥ (there p) = ∉⊥ p ⊥⊆ : ∀ {n} {p : Subset n} → ⊥ ⊆ p ⊥⊆ x∈⊥ with ∉⊥ x∈⊥ ... | () Empty-unique : ∀ {n} {p : Subset n} → Empty p → p ≡ ⊥ Empty-unique {p = []} ¬∃∈ = P.refl Empty-unique {p = s ∷ p} ¬∃∈ with Empty-unique (drop-∷-Empty ¬∃∈) Empty-unique {p = outside ∷ .⊥} ¬∃∈ | P.refl = P.refl Empty-unique {p = inside ∷ .⊥} ¬∃∈ | P.refl = ⊥-elim (¬∃∈ (zero , here)) ------------------------------------------------------------------------ -- Properties involving ⊤ ∈⊤ : ∀ {n} {x : Fin n} → x ∈ ⊤ ∈⊤ {x = zero} = here ∈⊤ {x = suc x} = there ∈⊤ ⊆⊤ : ∀ {n} {p : Subset n} → p ⊆ ⊤ ⊆⊤ = const ∈⊤ ------------------------------------------------------------------------ -- A property involving ⁅_⁆ x∈⁅y⁆⇔x≡y : ∀ {n} {x y : Fin n} → x ∈ ⁅ y ⁆ ⇔ x ≡ y x∈⁅y⁆⇔x≡y {x = x} {y} = equivalence (to y) (λ x≡y → P.subst (λ y → x ∈ ⁅ y ⁆) x≡y (x∈⁅x⁆ x)) where to : ∀ {n x} (y : Fin n) → x ∈ ⁅ y ⁆ → x ≡ y to (suc y) (there p) = P.cong suc (to y p) to zero here = P.refl to zero (there p) with ∉⊥ p ... | () x∈⁅x⁆ : ∀ {n} (x : Fin n) → x ∈ ⁅ x ⁆ x∈⁅x⁆ zero = here x∈⁅x⁆ (suc x) = there (x∈⁅x⁆ x) ------------------------------------------------------------------------ -- A property involving _∪_ ∪⇔⊎ : ∀ {n} {p₁ p₂ : Subset n} {x} → x ∈ p₁ ∪ p₂ ⇔ (x ∈ p₁ ⊎ x ∈ p₂) ∪⇔⊎ = equivalence (to _ _) from where to : ∀ {n} (p₁ p₂ : Subset n) {x} → x ∈ p₁ ∪ p₂ → x ∈ p₁ ⊎ x ∈ p₂ to [] [] () to (inside ∷ p₁) (s₂ ∷ p₂) here = inj₁ here to (outside ∷ p₁) (inside ∷ p₂) here = inj₂ here to (s₁ ∷ p₁) (s₂ ∷ p₂) (there x∈p₁∪p₂) = Sum.map there there (to p₁ p₂ x∈p₁∪p₂) ⊆∪ˡ : ∀ {n p₁} (p₂ : Subset n) → p₁ ⊆ p₁ ∪ p₂ ⊆∪ˡ [] () ⊆∪ˡ (s ∷ p₂) here = here ⊆∪ˡ (s ∷ p₂) (there x∈p₁) = there (⊆∪ˡ p₂ x∈p₁) ⊆∪ʳ : ∀ {n} (p₁ p₂ : Subset n) → p₂ ⊆ p₁ ∪ p₂ ⊆∪ʳ p₁ p₂ rewrite BooleanAlgebra.∨-comm (booleanAlgebra _) p₁ p₂ = ⊆∪ˡ p₁ from : ∀ {n} {p₁ p₂ : Subset n} {x} → x ∈ p₁ ⊎ x ∈ p₂ → x ∈ p₁ ∪ p₂ from (inj₁ x∈p₁) = ⊆∪ˡ _ x∈p₁ from (inj₂ x∈p₂) = ⊆∪ʳ _ _ x∈p₂ ------------------------------------------------------------------------ -- _⊆_ is a partial order -- The "natural poset" associated with the boolean algebra. module NaturalPoset where private open module BA {n} = BoolProp (booleanAlgebra n) public using (poset) open module Po {n} = Poset (poset {n = n}) public -- _⊆_ is equivalent to the natural lattice order. orders-equivalent : ∀ {n} {p₁ p₂ : Subset n} → p₁ ⊆ p₂ ⇔ p₁ ≤ p₂ orders-equivalent = equivalence (to _ _) (from _ _) where to : ∀ {n} (p₁ p₂ : Subset n) → p₁ ⊆ p₂ → p₁ ≤ p₂ to [] [] p₁⊆p₂ = P.refl to (inside ∷ p₁) (_ ∷ p₂) p₁⊆p₂ with p₁⊆p₂ here to (inside ∷ p₁) (.inside ∷ p₂) p₁⊆p₂ | here = P.cong (_∷_ inside) (to p₁ p₂ (drop-∷-⊆ p₁⊆p₂)) to (outside ∷ p₁) (_ ∷ p₂) p₁⊆p₂ = P.cong (_∷_ outside) (to p₁ p₂ (drop-∷-⊆ p₁⊆p₂)) from : ∀ {n} (p₁ p₂ : Subset n) → p₁ ≤ p₂ → p₁ ⊆ p₂ from [] [] p₁≤p₂ x = x from (.inside ∷ _) (_ ∷ _) p₁≤p₂ here rewrite P.cong head p₁≤p₂ = here from (_ ∷ p₁) (_ ∷ p₂) p₁≤p₂ (there xs[i]=x) = there (from p₁ p₂ (P.cong tail p₁≤p₂) xs[i]=x) -- _⊆_ is a partial order. poset : ℕ → Poset _ _ _ poset n = record { Carrier = Subset n ; _≈_ = _≡_ ; _≤_ = _⊆_ ; isPartialOrder = record { isPreorder = record { isEquivalence = P.isEquivalence ; reflexive = λ i≡j → from ⟨$⟩ reflexive i≡j ; trans = λ x⊆y y⊆z → from ⟨$⟩ trans (to ⟨$⟩ x⊆y) (to ⟨$⟩ y⊆z) } ; antisym = λ x⊆y y⊆x → antisym (to ⟨$⟩ x⊆y) (to ⟨$⟩ y⊆x) } } where open NaturalPoset open module E {p₁ p₂} = Equivalence (orders-equivalent {n = n} {p₁ = p₁} {p₂ = p₂})
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/border.asm
gb-archive/really-old-stuff
10
27774
<reponame>gb-archive/really-old-stuff<filename>mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/border.asm ; __FASTCALL__ Routine to change de border ; Parameter (color) specified in A register BORDER EQU 229Bh ; Nothing to do! (Directly from the ZX Spectrum ROM)
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_1516.asm
ljhsiun2/medusa
9
165454
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0xbd20, %rsi nop nop nop nop cmp %rcx, %rcx mov (%rsi), %r10d and %r9, %r9 lea addresses_A_ht+0x1d5d0, %rbx nop and %rdi, %rdi vmovups (%rbx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r9 nop nop nop nop sub %rcx, %rcx lea addresses_normal_ht+0x53c, %rsi nop nop nop nop xor %rax, %rax mov $0x6162636465666768, %r9 movq %r9, %xmm0 vmovups %ymm0, (%rsi) nop nop nop nop and %rsi, %rsi lea addresses_D_ht+0x6130, %rsi nop nop nop nop nop cmp %r9, %r9 movb $0x61, (%rsi) nop nop nop nop nop and $5987, %r10 lea addresses_A_ht+0x1ba40, %r9 nop nop nop nop nop and $20942, %r10 movw $0x6162, (%r9) nop add %r10, %r10 lea addresses_WC_ht+0x1b930, %rdi nop nop nop sub %r10, %r10 mov (%rdi), %eax nop nop xor %rcx, %rcx lea addresses_A_ht+0x2823, %rax nop nop nop and $12229, %rbx mov $0x6162636465666768, %r9 movq %r9, %xmm5 vmovups %ymm5, (%rax) nop nop nop nop cmp %r9, %r9 lea addresses_WT_ht+0xf160, %rsi lea addresses_WC_ht+0x1c9b0, %rdi nop nop and $37312, %r9 mov $10, %rcx rep movsq nop add %r9, %r9 lea addresses_normal_ht+0xb628, %r10 sub %rcx, %rcx mov (%r10), %eax nop sub $18535, %r10 lea addresses_WC_ht+0x14eb0, %rsi lea addresses_UC_ht+0x8020, %rdi clflush (%rsi) nop nop nop nop nop add %rax, %rax mov $28, %rcx rep movsl nop nop nop nop cmp %rax, %rax pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r9 push %rax push %rbx push %rdi // Faulty Load lea addresses_WT+0x9530, %r15 nop nop nop nop nop dec %rax mov (%r15), %r11w lea oracles, %rdi and $0xff, %r11 shlq $12, %r11 mov (%rdi,%r11,1), %r11 pop %rdi pop %rbx pop %rax pop %r9 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_WT', 'AVXalign': True, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': True}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
libsrc/graphics/eg2000/clg.asm
grancier/z180
0
96049
; ; Colour Genie EG2000 graphics routines ; ; cls () -- clear screen ; ; <NAME> - 2015 ; ; ; $Id: clg.asm,v 1.3 2017/01/02 22:57:58 aralbrec Exp $ ; SECTION code_clib PUBLIC clg PUBLIC _clg INCLUDE "graphics/grafix.inc" .clg ._clg call $38a9 ; FGR ld a,0 ; black ; call $384d ; FCLS ld a,3 ; green jp $38da ; FCOLOU
Cubical/HITs/FreeGroup/Properties.agda
thomas-lamiaux/cubical
0
10335
<reponame>thomas-lamiaux/cubical {- This file contains: Properties of the FreeGroup: - FreeGroup A is Set, SemiGroup, Monoid, Group - Recursion principle for the FreeGroup - Induction principle for the FreeGroup on hProps - Condition for the equality of Group Homomorphisms from FreeGroup - Equivalence of the types (A → Group .fst) (GroupHom (freeGroupGroup A) Group) -} {-# OPTIONS --safe #-} module Cubical.HITs.FreeGroup.Properties where open import Cubical.HITs.FreeGroup.Base open import Cubical.Foundations.Prelude open import Cubical.Foundations.Path open import Cubical.Foundations.Function open import Cubical.Foundations.Equiv open import Cubical.Foundations.Equiv.BiInvertible open import Cubical.Algebra.Group open import Cubical.Algebra.Group.Morphisms open import Cubical.Algebra.Group.MorphismProperties open import Cubical.Algebra.Monoid.Base open import Cubical.Algebra.Semigroup.Base private variable ℓ ℓ' : Level A : Type ℓ freeGroupIsSet : isSet (FreeGroup A) freeGroupIsSet = trunc freeGroupIsSemiGroup : IsSemigroup {A = FreeGroup A} _·_ freeGroupIsSemiGroup = issemigroup freeGroupIsSet assoc freeGroupIsMonoid : IsMonoid {A = FreeGroup A} ε _·_ freeGroupIsMonoid = ismonoid freeGroupIsSemiGroup (λ x → sym (idr x)) (λ x → sym (idl x)) freeGroupIsGroup : IsGroup {G = FreeGroup A} ε _·_ inv freeGroupIsGroup = isgroup freeGroupIsMonoid invr invl freeGroupGroupStr : GroupStr (FreeGroup A) freeGroupGroupStr = groupstr ε _·_ inv freeGroupIsGroup -- FreeGroup is indeed a group freeGroupGroup : Type ℓ → Group ℓ freeGroupGroup A = FreeGroup A , freeGroupGroupStr -- The recursion principle for the FreeGroup rec : {Group : Group ℓ'} → (A → Group .fst) → GroupHom (freeGroupGroup A) Group rec {Group = G , groupstr 1g _·g_ invg (isgroup (ismonoid isSemigroupg ·gIdR ·gIdL) ·gInvR ·gInvL)} f = f' , isHom where f' : FreeGroup _ → G f' (η a) = f a f' (g1 · g2) = (f' g1) ·g (f' g2) f' ε = 1g f' (inv g) = invg (f' g) f' (assoc g1 g2 g3 i) = IsSemigroup.·Assoc isSemigroupg (f' g1) (f' g2) (f' g3) i f' (idr g i) = sym (·gIdR (f' g)) i f' (idl g i) = sym (·gIdL (f' g)) i f' (invr g i) = ·gInvR (f' g) i f' (invl g i) = ·gInvL (f' g) i f' (trunc g1 g2 p q i i₁) = IsSemigroup.is-set isSemigroupg (f' g1) (f' g2) (cong f' p) (cong f' q) i i₁ isHom : IsGroupHom freeGroupGroupStr f' _ IsGroupHom.pres· isHom = λ g1 g2 → refl IsGroupHom.pres1 isHom = refl IsGroupHom.presinv isHom = λ g → refl -- The induction principle for the FreeGroup for hProps elimProp : {B : FreeGroup A → Type ℓ'} → ((x : FreeGroup A) → isProp (B x)) → ((a : A) → B (η a)) → ((g1 g2 : FreeGroup A) → B g1 → B g2 → B (g1 · g2)) → (B ε) → ((g : FreeGroup A) → B g → B (inv g)) → (x : FreeGroup A) → B x elimProp {B = B} Bprop η-ind ·-ind ε-ind inv-ind = induction where induction : ∀ g → B g induction (η a) = η-ind a induction (g1 · g2) = ·-ind g1 g2 (induction g1) (induction g2) induction ε = ε-ind induction (inv g) = inv-ind g (induction g) induction (assoc g1 g2 g3 i) = path i where p1 : B g1 p1 = induction g1 p2 : B g2 p2 = induction g2 p3 : B g3 p3 = induction g3 path : PathP (λ i → B (assoc g1 g2 g3 i)) (·-ind g1 (g2 · g3) p1 (·-ind g2 g3 p2 p3)) (·-ind (g1 · g2) g3 (·-ind g1 g2 p1 p2) p3) path = isProp→PathP (λ i → Bprop (assoc g1 g2 g3 i)) (·-ind g1 (g2 · g3) p1 (·-ind g2 g3 p2 p3)) (·-ind (g1 · g2) g3 (·-ind g1 g2 p1 p2) p3) induction (idr g i) = path i where p : B g p = induction g pε : B ε pε = induction ε path : PathP (λ i → B (idr g i)) p (·-ind g ε p pε) path = isProp→PathP (λ i → Bprop (idr g i)) p (·-ind g ε p pε) induction (idl g i) = path i where p : B g p = induction g pε : B ε pε = induction ε path : PathP (λ i → B (idl g i)) p (·-ind ε g pε p) path = isProp→PathP (λ i → Bprop (idl g i)) p (·-ind ε g pε p) induction (invr g i) = path i where p : B g p = induction g pinv : B (inv g) pinv = inv-ind g p pε : B ε pε = induction ε path : PathP (λ i → B (invr g i)) (·-ind g (inv g) p pinv) pε path = isProp→PathP (λ i → Bprop (invr g i)) (·-ind g (inv g) p pinv) pε induction (invl g i) = path i where p : B g p = induction g pinv : B (inv g) pinv = inv-ind g p pε : B ε pε = induction ε path : PathP (λ i → B (invl g i)) (·-ind (inv g) g pinv p) pε path = isProp→PathP (λ i → Bprop (invl g i)) (·-ind (inv g) g pinv p) pε induction (trunc g1 g2 q1 q2 i i₁) = square i i₁ where p1 : B g1 p1 = induction g1 p2 : B g2 p2 = induction g2 dq1 : PathP (λ i → B (q1 i)) p1 p2 dq1 = cong induction q1 dq2 : PathP (λ i → B (q2 i)) p1 p2 dq2 = cong induction q2 square : SquareP (λ i i₁ → B (trunc g1 g2 q1 q2 i i₁)) {a₀₀ = p1} {a₀₁ = p2} dq1 {a₁₀ = p1} {a₁₁ = p2} dq2 (cong induction (refl {x = g1})) (cong induction (refl {x = g2})) square = isProp→SquareP (λ i i₁ → Bprop (trunc g1 g2 q1 q2 i i₁)) (cong induction (refl {x = g1})) (cong induction (refl {x = g2})) dq1 dq2 -- Two group homomorphisms from FreeGroup to G are the same if they agree on every a : A freeGroupHom≡ : {Group : Group ℓ'}{f g : GroupHom (freeGroupGroup A) Group} → (∀ a → (fst f) (η a) ≡ (fst g) (η a)) → f ≡ g freeGroupHom≡ {Group = G , (groupstr 1g _·g_ invg isGrp)} {f} {g} eqOnA = GroupHom≡ (funExt pointwise) where B : ∀ x → Type _ B x = (fst f) x ≡ (fst g) x Bprop : ∀ x → isProp (B x) Bprop x = (isSetGroup (G , groupstr 1g _·g_ invg isGrp)) ((fst f) x) ((fst g) x) η-ind : ∀ a → B (η a) η-ind = eqOnA ·-ind : ∀ g1 g2 → B g1 → B g2 → B (g1 · g2) ·-ind g1 g2 ind1 ind2 = (fst f) (g1 · g2) ≡⟨ IsGroupHom.pres· (f .snd) g1 g2 ⟩ ((fst f) g1) ·g ((fst f) g2) ≡⟨ cong (λ x → x ·g ((fst f) g2)) ind1 ⟩ ((fst g) g1) ·g ((fst f) g2) ≡⟨ cong (λ x → ((fst g) g1) ·g x) ind2 ⟩ ((fst g) g1) ·g ((fst g) g2) ≡⟨ sym (IsGroupHom.pres· (g .snd) g1 g2) ⟩ (fst g) (g1 · g2) ∎ ε-ind : B ε ε-ind = (fst f) ε ≡⟨ IsGroupHom.pres1 (f .snd) ⟩ 1g ≡⟨ sym (IsGroupHom.pres1 (g .snd)) ⟩ (fst g) ε ∎ inv-ind : ∀ x → B x → B (inv x) inv-ind x ind = (fst f) (inv x) ≡⟨ IsGroupHom.presinv (f .snd) x ⟩ invg ((fst f) x) ≡⟨ cong invg ind ⟩ invg ((fst g) x) ≡⟨ sym (IsGroupHom.presinv (g .snd) x) ⟩ (fst g) (inv x) ∎ pointwise : ∀ x → (fst f) x ≡ (fst g) x pointwise = elimProp Bprop η-ind ·-ind ε-ind inv-ind -- The type of Group Homomorphisms from the FreeGroup A into G -- is equivalent to the type of functions from A into G .fst A→Group≃GroupHom : {Group : Group ℓ'} → (A → Group .fst) ≃ GroupHom (freeGroupGroup A) Group A→Group≃GroupHom {Group = Group} = biInvEquiv→Equiv-right biInv where biInv : BiInvEquiv (A → Group .fst) (GroupHom (freeGroupGroup A) Group) BiInvEquiv.fun biInv = rec BiInvEquiv.invr biInv (hom , _) a = hom (η a) BiInvEquiv.invr-rightInv biInv hom = freeGroupHom≡ (λ a → refl) BiInvEquiv.invl biInv (hom , _) a = hom (η a) BiInvEquiv.invl-leftInv biInv f = funExt (λ a → refl)
source/machine-w64-mingw32/s-stack.ads
ytomino/drake
33
4163
pragma License (Unrestricted); -- runtime unit specialized for Windows with C.winnt; package System.Stack is pragma Preelaborate; procedure Get ( TEB : C.winnt.struct_TEB_ptr := C.winnt.NtCurrentTeb; Top, Bottom : out Address); end System.Stack;
src/equipment_menu.adb
Fabien-Chouteau/motherlode
2
20011
<filename>src/equipment_menu.adb -- Motherlode -- Copyright (c) 2020 <NAME> with HAL; use HAL; with PyGamer; use PyGamer; with PyGamer.Time; with PyGamer.Controls; with PyGamer.Screen; with Parameters; use Parameters; with Render; with World; with Player; with Sound; package body Equipment_Menu is use type Parameters.Equipment; Selected : Parameters.Equipment := Parameters.Equipment'First; --------- -- Img -- --------- function Img (Kind : Parameters.Equipment) return String is (case Kind is when Engine => "Engine", when Cargo => "Cargo", when Tank => "Tank", when Drill => "Drill"); ----------------- -- Draw_Screen -- ----------------- procedure Draw_Screen (FB : in out HAL.UInt16_Array) is Y_Offest : Natural := 16; begin FB := (others => 0); declare Str : String := Player.Money'Img; begin Str (Str'First) := '$'; Render.Draw_String_Left (FB, Str, Screen.Width - 1, 1); end; for Kind in Parameters.Equipment loop Render.Draw_String (FB, Img (Kind), X => 0, Y => Y_Offest + 4); if Selected = Kind then Render.Draw_H_Line (FB, 0, Y_Offest, Len => 50, Color => UInt16'Last); Render.Draw_H_Line (FB, 0, Y_Offest + World.Cell_Size, Len => 50, Color => UInt16'Last); Render.Draw_V_Line (FB, 50, 16, Len => Y_Offest - 16, Color => UInt16'Last); Render.Draw_V_Line (FB, 50, Y_Offest + 16, Len => Screen.Height - Y_Offest - 16 * 3, Color => UInt16'Last); if Player.Level (Kind) = Equipment_Level'Last then Render.Draw_String_Center (FB, "Max level", X => 55 + (Screen.Width - 55) / 2, Y => Screen.Height / 2 - 8); else Render.Draw_String_Left (FB, "Next upgrade:", X => Screen.Width - 1, Y => 5 + 16 * 1); Render.Draw_String_Left (FB, "level" & Equipment_Level'Image (Player.Level (Kind) + 1), X => Screen.Width - 1, Y => 5 + 16 * 2); Render.Draw_String_Left (FB, "Cost:", X => Screen.Width - 1, Y => 5 + 16 * 3); Render.Draw_String_Left (FB, "$" & Parameters.Price (Kind, Player.Level (Kind) + 1)'Img, X => Screen.Width - 1, Y => 5 + 16 * 4); end if; end if; Y_Offest := Y_Offest + 20; end loop; Render.Draw_H_Line (FB, 50, Y_Offest, Len => Screen.Width - 1 - 50, Color => UInt16'Last); Render.Draw_H_Line (FB, 50, 16, Len => Screen.Width - 1 - 50, Color => UInt16'Last); Render.Draw_String (FB, "Press A to upgrade", X => 0, Y => Y_Offest + 4); Render.Draw_String (FB, "Press B to exit", X => 0, Y => Y_Offest + 4 + 16); end Draw_Screen; --------- -- Run -- --------- procedure Run is Period : constant Time.Time_Ms := Parameters.Frame_Period; Next_Release : Time.Time_Ms; begin Next_Release := Time.Clock; loop Controls.Scan; if Controls.Falling (Controls.Down) then if Selected = Parameters.Equipment'Last then Selected := Parameters.Equipment'First; else Selected := Parameters.Equipment'Succ (Selected); end if; elsif Controls.Falling (Controls.Up) then if Selected = Parameters.Equipment'First then Selected := Parameters.Equipment'Last; else Selected := Parameters.Equipment'Pred (Selected); end if; end if; if Controls.Falling (Controls.A) then Player.Upgrade (Selected); end if; if Controls.Falling (Controls.B) then return; end if; if Render.Flip then Render.Refresh_Screen (Render.FB1'Access); Draw_Screen (Render.FB2); else Render.Refresh_Screen (Render.FB2'Access); Draw_Screen (Render.FB1); end if; Render.Flip := not Render.Flip; Sound.Tick; Time.Delay_Until (Next_Release); Next_Release := Next_Release + Period; end loop; end Run; end Equipment_Menu;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/slice1.adb
best08618/asylo
7
25328
-- { dg-do compile } -- { dg-options "-O2" } function slice1 (Offset : Integer) return String is Convert : constant String := "0123456789abcdef"; Buffer : String (1 .. 32); Pos : Natural := Buffer'Last; Value : Long_Long_Integer := Long_Long_Integer (Offset); begin while Value > 0 loop Buffer (Pos) := Convert (Integer (Value mod 16)); Pos := Pos - 1; Value := Value / 16; end loop; return Buffer (Pos + 1 .. Buffer'Last); end;
agda/BBHeap.agda
bgbianchi/sorting
6
11527
<reponame>bgbianchi/sorting<gh_stars>1-10 module BBHeap {A : Set}(_≤_ : A → A → Set) where open import BHeap _≤_ hiding (forget ; # ; flatten) open import Bound.Lower A open import Bound.Lower.Order _≤_ open import BTree {A} hiding (flatten) open import Data.Nat open import Data.List mutual data BBHeap : Bound → Set where leaf : {b : Bound} → BBHeap b left : {b : Bound}{x : A}{l r : BBHeap (val x)} → LeB b (val x) → l ⋘ r → BBHeap b right : {b : Bound}{x : A}{l r : BBHeap (val x)} → LeB b (val x) → l ⋙ r → BBHeap b data _≃_ : {b b' : Bound} → BBHeap b → BBHeap b' → Set where ≃lf : {b b' : Bound} → leaf {b} ≃ leaf {b'} ≃nd : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋘r : l ⋘ r) → (l'⋘r' : l' ⋘ r') → l ≃ r → l' ≃ r' → l ≃ l' → (left b≤x l⋘r) ≃ (left b'≤x' l'⋘r') data _⋘_ : {b b' : Bound} → BBHeap b → BBHeap b' → Set where lf⋘ : {b b' : Bound} → leaf {b} ⋘ leaf {b'} ll⋘ : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋘r : l ⋘ r) → (l'⋘r' : l' ⋘ r') → (l'≃r' : l' ≃ r') → r ≃ l' → (left b≤x l⋘r) ⋘ (left b'≤x' l'⋘r') lr⋘ : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋙r : l ⋙ r) → (l'⋘r' : l' ⋘ r') → (l'≃r' : l' ≃ r') → l ⋗ l' → (right b≤x l⋙r) ⋘ (left b'≤x' l'⋘r') data _⋙_ : {b b' : Bound} → BBHeap b → BBHeap b' → Set where ⋙lf : {b b' : Bound}{x : A} → (b≤x : LeB b (val x)) → (left b≤x lf⋘) ⋙ leaf {b'} ⋙rl : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋘r : l ⋘ r) → (l≃r : l ≃ r) → (l'⋘r' : l' ⋘ r') → l ⋗ r' → (left b≤x l⋘r) ⋙ (left b'≤x' l'⋘r') ⋙rr : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋘r : l ⋘ r) → (l≃r : l ≃ r) → (l'⋙r' : l' ⋙ r') → l ≃ l' → (left b≤x l⋘r) ⋙ (right b'≤x' l'⋙r') data _⋗_ : {b b' : Bound} → BBHeap b → BBHeap b' → Set where ⋗lf : {b b' : Bound}{x : A} → (b≤x : LeB b (val x)) → (left b≤x lf⋘) ⋗ (leaf {b'}) ⋗nd : {b b' : Bound}{x x' : A}{l r : BBHeap (val x)}{l' r' : BBHeap (val x')} → (b≤x : LeB b (val x)) → (b'≤x' : LeB b' (val x')) → (l⋘r : l ⋘ r) → (l'⋘r' : l' ⋘ r') → l ≃ r → l' ≃ r' → l ⋗ l' → (left b≤x l⋘r) ⋗ (left b'≤x' l'⋘r') # : {b : Bound} → BBHeap b → ℕ # leaf = zero # (left {l = l} {r = r} _ _) = suc (# l + # r) # (right {l = l} {r = r} _ _) = suc (# l + # r) relax : {b : Bound}(h : BBHeap b) → BHeap b relax leaf = lf relax (left {l = l} {r = r} b≤x _) = nd b≤x (relax l) (relax r) relax (right {l = l} {r = r} b≤x _) = nd b≤x (relax l) (relax r) forget : {b : Bound}(h : BBHeap b) → BTree forget leaf = leaf forget (left {x = x} {l = l} {r = r} _ _) = node x (forget l) (forget r) forget (right {x = x} {l = l} {r = r} _ _) = node x (forget l) (forget r) flatten : {b : Bound} → BBHeap b → List A flatten leaf = [] flatten (left {x = x} {l = l} {r = r} _ _) = x ∷ flatten l ++ flatten r flatten (right {x = x} {l = l} {r = r} _ _) = x ∷ flatten l ++ flatten r
programs/oeis/016/A016084.asm
jmorken/loda
1
164846
<gh_stars>1-10 ; A016084: a(n+1) = a(n) + its digital root. ; 5,10,11,13,17,25,32,37,38,40,44,52,59,64,65,67,71,79,86,91,92,94,98,106,113,118,119,121,125,133,140,145,146,148,152,160,167,172,173,175,179,187,194,199,200,202,206,214,221,226,227,229,233,241,248,253,254,256,260,268,275,280,281,283,287,295,302,307,308,310,314,322,329,334,335,337,341,349,356,361,362,364,368,376,383,388,389,391,395,403,410,415,416,418,422,430,437,442,443,445,449,457,464,469,470,472,476,484,491,496,497,499,503,511,518,523,524,526,530,538,545,550,551,553,557,565,572,577,578,580,584,592,599,604,605,607,611,619,626,631,632,634,638,646,653,658,659,661,665,673,680,685,686,688,692,700,707,712,713,715,719,727,734,739,740,742,746,754,761,766,767,769,773,781,788,793,794,796,800,808,815,820,821,823,827,835,842,847,848,850,854,862,869,874,875,877,881,889,896,901,902,904,908,916,923,928,929,931,935,943,950,955,956,958,962,970,977,982,983,985,989,997,1004,1009,1010,1012,1016,1024,1031,1036,1037,1039,1043,1051,1058,1063,1064,1066,1070,1078,1085,1090,1091,1093,1097,1105,1112,1117,1118,1120 mov $3,$0 mod $0,2 mov $1,$0 pow $1,$0 mov $2,1 add $2,$3 mov $0,$2 mov $4,4 lpb $0 sub $0,1 mod $4,9 add $4,$1 mov $1,$4 lpe
alloy4fun_models/trashltl/models/7/nudSLbJXynT3uqxDy.als
Kaixi26/org.alloytools.alloy
0
2401
<reponame>Kaixi26/org.alloytools.alloy open main pred idnudSLbJXynT3uqxDy_prop8 { always all f: File.link | eventually f.link in Trash } pred __repair { idnudSLbJXynT3uqxDy_prop8 } check __repair { idnudSLbJXynT3uqxDy_prop8 <=> prop8o }
AppleScripts/Applications/Pro Tools/VocALign Capture.applescript
fantopop/post-production-scripts
16
2490
<gh_stars>10-100 -- -- AppleScripts for Avid Pro Tools. -- -- Script description: -- Open VocALign window (if needed) and captures selection. -- -- (C) 2017 <NAME> -- http://github.com/fantopop -- tell application "Finder" tell application "System Events" set PT to the first application process whose creator type is "PTul" tell PT activate set frontmost to true -- Check whether there is an open track plug-in window. set isOpen to count (windows whose name contains "Audio Suite: VocALign") -- Open plug-in if needed. if isOpen is 0 then # display dialog "Can't find VocALign plug-in window." buttons {"OK"} default button {"OK"} with icon caution with title "AppleScript error" # return click menu item "VocALign Project" of menu "Other" of menu item "Other" of menu "AudioSuite" of menu bar item "AudioSuite" of menu bar 1 end if -- Bring plug-in to front. set win to (1st window whose name contains "Audio Suite: VocALign") perform action "AXRaise" of win click button "Analyze" of win end tell end tell end tell
dataToTestOn/asm/3/prog02.asm
Epacik/8051-ASM-Plugin
1
245720
<gh_stars>1-10 LJMP START ORG 100H START: CALL LCD_CLR KLAWISZ: MOV A, #0 CALL WAIT_KEY ; 'lewa' cyfra ;Przesuń bity w akumulatorze w lewo RL A RL A RL A RL A ;przenieś zawartość do R3 MOV R3, A ; pobierz prawą cyfrę CALL WAIT_KEY ; bitwise or na A i R3 żeby połączyć 2 cyfry w liczbę 2 cyfrową ORL A, R3 MOV R2, A CALL LCD_CLR MOV A, R2 CALL HTB CALL WRITE_HEX SJMP KLAWISZ HTB: MOV R0,#00h MOV R1,#00h CJNE A,#00h,CALC_HTB RET CALC_HTB: MOV B,#100 ; dzielenie przez 100 DIV AB MOV R0,A ; zapisz Akumulator do R0 MOV A,B MOV B,#10 ; podziel przez 10 DIV AB SWAP A MOV R1,A ; zapisz dziesiątki do R1 MOV A,B ORL A,R1 MOV R1,A ;zapisz jedności do R1 RET
target/cos_117/disasm/iop_overlay1/DSPL.asm
jrrk2/cray-sim
49
20505
0x0000 (0x000000) 0x2104- f:00020 d: 260 | A = OR[260] 0x0001 (0x000002) 0x290D- f:00024 d: 269 | OR[269] = A 0x0002 (0x000004) 0x2104- f:00020 d: 260 | A = OR[260] 0x0003 (0x000006) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0004 (0x000008) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC) 0x0006 (0x00000C) 0x2904- f:00024 d: 260 | OR[260] = A 0x0007 (0x00000E) 0x2104- f:00020 d: 260 | A = OR[260] 0x0008 (0x000010) 0x291E- f:00024 d: 286 | OR[286] = A 0x0009 (0x000012) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x000A (0x000014) 0x2B04- f:00025 d: 260 | OR[260] = A + OR[260] 0x000B (0x000016) 0x2104- f:00020 d: 260 | A = OR[260] 0x000C (0x000018) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x000D (0x00001A) 0xB234- f:00131 d: 52 | R = OR[52], C = 1 0x000E (0x00001C) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x000F (0x00001E) 0x210D- f:00020 d: 269 | A = OR[269] 0x0010 (0x000020) 0x3904- f:00034 d: 260 | (OR[260]) = A 0x0011 (0x000022) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1 0x0012 (0x000024) 0x211E- f:00020 d: 286 | A = OR[286] 0x0013 (0x000026) 0x290E- f:00024 d: 270 | OR[270] = A 0x0014 (0x000028) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0015 (0x00002A) 0x290D- f:00024 d: 269 | OR[269] = A 0x0016 (0x00002C) 0x210D- f:00020 d: 269 | A = OR[269] 0x0017 (0x00002E) 0x8407- f:00102 d: 7 | P = P + 7 (0x001E), A = 0 0x0018 (0x000030) 0x1800-0x2020 f:00014 d: 0 | A = 8224 (0x2020) 0x001A (0x000034) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x001B (0x000036) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1 0x001C (0x000038) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1 0x001D (0x00003A) 0x7207- f:00071 d: 7 | P = P - 7 (0x0016) 0x001E (0x00003C) 0x211B- f:00020 d: 283 | A = OR[283] 0x001F (0x00003E) 0x2920- f:00024 d: 288 | OR[288] = A 0x0020 (0x000040) 0x211B- f:00020 d: 283 | A = OR[283] 0x0021 (0x000042) 0x251C- f:00022 d: 284 | A = A + OR[284] 0x0022 (0x000044) 0x2921- f:00024 d: 289 | OR[289] = A 0x0023 (0x000046) 0x211D- f:00020 d: 285 | A = OR[285] 0x0024 (0x000048) 0x8602- f:00103 d: 2 | P = P + 2 (0x0026), A # 0 0x0025 (0x00004A) 0x700A- f:00070 d: 10 | P = P + 10 (0x002F) 0x0026 (0x00004C) 0x2003- f:00020 d: 3 | A = OR[3] 0x0027 (0x00004E) 0x1C00-0x0198 f:00016 d: 0 | A = A + 408 (0x0198) 0x0029 (0x000052) 0x2924- f:00024 d: 292 | OR[292] = A 0x002A (0x000054) 0x100D- f:00010 d: 13 | A = 13 (0x000D) 0x002B (0x000056) 0x2925- f:00024 d: 293 | OR[293] = A 0x002C (0x000058) 0x1022- f:00010 d: 34 | A = 34 (0x0022) 0x002D (0x00005A) 0x2926- f:00024 d: 294 | OR[294] = A 0x002E (0x00005C) 0x712B- f:00070 d: 299 | P = P + 299 (0x0159) 0x002F (0x00005E) 0x1008- f:00010 d: 8 | A = 8 (0x0008) 0x0030 (0x000060) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002) 0x0031 (0x000062) 0x291F- f:00024 d: 287 | OR[287] = A 0x0032 (0x000064) 0x2104- f:00020 d: 260 | A = OR[260] 0x0033 (0x000066) 0x290D- f:00024 d: 269 | OR[269] = A 0x0034 (0x000068) 0x2104- f:00020 d: 260 | A = OR[260] 0x0035 (0x00006A) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0036 (0x00006C) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC) 0x0038 (0x000070) 0x2904- f:00024 d: 260 | OR[260] = A 0x0039 (0x000072) 0x2104- f:00020 d: 260 | A = OR[260] 0x003A (0x000074) 0x2927- f:00024 d: 295 | OR[295] = A 0x003B (0x000076) 0x1008- f:00010 d: 8 | A = 8 (0x0008) 0x003C (0x000078) 0x2B04- f:00025 d: 260 | OR[260] = A + OR[260] 0x003D (0x00007A) 0x2104- f:00020 d: 260 | A = OR[260] 0x003E (0x00007C) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x003F (0x00007E) 0xB234- f:00131 d: 52 | R = OR[52], C = 1 0x0040 (0x000080) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x0041 (0x000082) 0x210D- f:00020 d: 269 | A = OR[269] 0x0042 (0x000084) 0x3904- f:00034 d: 260 | (OR[260]) = A 0x0043 (0x000086) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1 0x0044 (0x000088) 0x1026- f:00010 d: 38 | A = 38 (0x0026) 0x0045 (0x00008A) 0x2929- f:00024 d: 297 | OR[297] = A 0x0046 (0x00008C) 0x2118- f:00020 d: 280 | A = OR[280] 0x0047 (0x00008E) 0x292A- f:00024 d: 298 | OR[298] = A 0x0048 (0x000090) 0x2119- f:00020 d: 281 | A = OR[281] 0x0049 (0x000092) 0x292B- f:00024 d: 299 | OR[299] = A 0x004A (0x000094) 0x2127- f:00020 d: 295 | A = OR[295] 0x004B (0x000096) 0x292C- f:00024 d: 300 | OR[300] = A 0x004C (0x000098) 0x211F- f:00020 d: 287 | A = OR[287] 0x004D (0x00009A) 0x292D- f:00024 d: 301 | OR[301] = A 0x004E (0x00009C) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x004F (0x00009E) 0x292E- f:00024 d: 302 | OR[302] = A 0x0050 (0x0000A0) 0x1129- f:00010 d: 297 | A = 297 (0x0129) 0x0051 (0x0000A2) 0x5800- f:00054 d: 0 | B = A 0x0052 (0x0000A4) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0053 (0x0000A6) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0054 (0x0000A8) 0x2119- f:00020 d: 281 | A = OR[281] 0x0055 (0x0000AA) 0x251F- f:00022 d: 287 | A = A + OR[287] 0x0056 (0x0000AC) 0x2919- f:00024 d: 281 | OR[281] = A 0x0057 (0x0000AE) 0x8002- f:00100 d: 2 | P = P + 2 (0x0059), C = 0 0x0058 (0x0000B0) 0x2D18- f:00026 d: 280 | OR[280] = OR[280] + 1 0x0059 (0x0000B2) 0x2127- f:00020 d: 295 | A = OR[295] 0x005A (0x0000B4) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006) 0x005B (0x0000B6) 0x2908- f:00024 d: 264 | OR[264] = A 0x005C (0x0000B8) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x005D (0x0000BA) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x005E (0x0000BC) 0x2928- f:00024 d: 296 | OR[296] = A 0x005F (0x0000BE) 0x2127- f:00020 d: 295 | A = OR[295] 0x0060 (0x0000C0) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004) 0x0061 (0x0000C2) 0x2908- f:00024 d: 264 | OR[264] = A 0x0062 (0x0000C4) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0063 (0x0000C6) 0x2923- f:00024 d: 291 | OR[291] = A 0x0064 (0x0000C8) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1 0x0065 (0x0000CA) 0x3104- f:00030 d: 260 | A = (OR[260]) 0x0066 (0x0000CC) 0x2904- f:00024 d: 260 | OR[260] = A 0x0067 (0x0000CE) 0x2104- f:00020 d: 260 | A = OR[260] 0x0068 (0x0000D0) 0x2706- f:00023 d: 262 | A = A - OR[262] 0x0069 (0x0000D2) 0x8007- f:00100 d: 7 | P = P + 7 (0x0070), C = 0 0x006A (0x0000D4) 0x2104- f:00020 d: 260 | A = OR[260] 0x006B (0x0000D6) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x006C (0x0000D8) 0x8003- f:00100 d: 3 | P = P + 3 (0x006F), C = 0 0x006D (0x0000DA) 0x8402- f:00102 d: 2 | P = P + 2 (0x006F), A = 0 0x006E (0x0000DC) 0x7002- f:00070 d: 2 | P = P + 2 (0x0070) 0x006F (0x0000DE) 0x7003- f:00070 d: 3 | P = P + 3 (0x0072) 0x0070 (0x0000E0) 0x7C34- f:00076 d: 52 | R = OR[52] 0x0071 (0x0000E2) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x0072 (0x0000E4) 0x2128- f:00020 d: 296 | A = OR[296] 0x0073 (0x0000E6) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003) 0x0074 (0x0000E8) 0x8602- f:00103 d: 2 | P = P + 2 (0x0076), A # 0 0x0075 (0x0000EA) 0x700A- f:00070 d: 10 | P = P + 10 (0x007F) 0x0076 (0x0000EC) 0x2003- f:00020 d: 3 | A = OR[3] 0x0077 (0x0000EE) 0x1C00-0x019F f:00016 d: 0 | A = A + 415 (0x019F) 0x0079 (0x0000F2) 0x2924- f:00024 d: 292 | OR[292] = A 0x007A (0x0000F4) 0x1015- f:00010 d: 21 | A = 21 (0x0015) 0x007B (0x0000F6) 0x2925- f:00024 d: 293 | OR[293] = A 0x007C (0x0000F8) 0x101E- f:00010 d: 30 | A = 30 (0x001E) 0x007D (0x0000FA) 0x2926- f:00024 d: 294 | OR[294] = A 0x007E (0x0000FC) 0x70DB- f:00070 d: 219 | P = P + 219 (0x0159) 0x007F (0x0000FE) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0080 (0x000100) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001) 0x0081 (0x000102) 0x2922- f:00024 d: 290 | OR[290] = A 0x0082 (0x000104) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0083 (0x000106) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002) 0x0084 (0x000108) 0x291F- f:00024 d: 287 | OR[287] = A 0x0085 (0x00010A) 0x2120- f:00020 d: 288 | A = OR[288] 0x0086 (0x00010C) 0x2721- f:00023 d: 289 | A = A - OR[289] 0x0087 (0x00010E) 0x8493- f:00102 d: 147 | P = P + 147 (0x011A), A = 0 0x0088 (0x000110) 0x2123- f:00020 d: 291 | A = OR[291] 0x0089 (0x000112) 0x8491- f:00102 d: 145 | P = P + 145 (0x011A), A = 0 0x008A (0x000114) 0x2123- f:00020 d: 291 | A = OR[291] 0x008B (0x000116) 0x2722- f:00023 d: 290 | A = A - OR[290] 0x008C (0x000118) 0x8002- f:00100 d: 2 | P = P + 2 (0x008E), C = 0 0x008D (0x00011A) 0x7073- f:00070 d: 115 | P = P + 115 (0x0100) 0x008E (0x00011C) 0x2123- f:00020 d: 291 | A = OR[291] 0x008F (0x00011E) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0090 (0x000120) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001) 0x0091 (0x000122) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0092 (0x000124) 0x0802- f:00004 d: 2 | A = A > 2 (0x0002) 0x0093 (0x000126) 0x291F- f:00024 d: 287 | OR[287] = A 0x0094 (0x000128) 0x2104- f:00020 d: 260 | A = OR[260] 0x0095 (0x00012A) 0x290D- f:00024 d: 269 | OR[269] = A 0x0096 (0x00012C) 0x2104- f:00020 d: 260 | A = OR[260] 0x0097 (0x00012E) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0098 (0x000130) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC) 0x009A (0x000134) 0x2904- f:00024 d: 260 | OR[260] = A 0x009B (0x000136) 0x2104- f:00020 d: 260 | A = OR[260] 0x009C (0x000138) 0x2927- f:00024 d: 295 | OR[295] = A 0x009D (0x00013A) 0x211F- f:00020 d: 287 | A = OR[287] 0x009E (0x00013C) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002) 0x009F (0x00013E) 0x2504- f:00022 d: 260 | A = A + OR[260] 0x00A0 (0x000140) 0x2904- f:00024 d: 260 | OR[260] = A 0x00A1 (0x000142) 0x2104- f:00020 d: 260 | A = OR[260] 0x00A2 (0x000144) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x00A3 (0x000146) 0xB234- f:00131 d: 52 | R = OR[52], C = 1 0x00A4 (0x000148) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x00A5 (0x00014A) 0x210D- f:00020 d: 269 | A = OR[269] 0x00A6 (0x00014C) 0x3904- f:00034 d: 260 | (OR[260]) = A 0x00A7 (0x00014E) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1 0x00A8 (0x000150) 0x1026- f:00010 d: 38 | A = 38 (0x0026) 0x00A9 (0x000152) 0x2929- f:00024 d: 297 | OR[297] = A 0x00AA (0x000154) 0x2118- f:00020 d: 280 | A = OR[280] 0x00AB (0x000156) 0x292A- f:00024 d: 298 | OR[298] = A 0x00AC (0x000158) 0x2119- f:00020 d: 281 | A = OR[281] 0x00AD (0x00015A) 0x292B- f:00024 d: 299 | OR[299] = A 0x00AE (0x00015C) 0x2127- f:00020 d: 295 | A = OR[295] 0x00AF (0x00015E) 0x292C- f:00024 d: 300 | OR[300] = A 0x00B0 (0x000160) 0x211F- f:00020 d: 287 | A = OR[287] 0x00B1 (0x000162) 0x292D- f:00024 d: 301 | OR[301] = A 0x00B2 (0x000164) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00B3 (0x000166) 0x292E- f:00024 d: 302 | OR[302] = A 0x00B4 (0x000168) 0x1129- f:00010 d: 297 | A = 297 (0x0129) 0x00B5 (0x00016A) 0x5800- f:00054 d: 0 | B = A 0x00B6 (0x00016C) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00B7 (0x00016E) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00B8 (0x000170) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00B9 (0x000172) 0x290F- f:00024 d: 271 | OR[271] = A 0x00BA (0x000174) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00BB (0x000176) 0x2910- f:00024 d: 272 | OR[272] = A 0x00BC (0x000178) 0x2123- f:00020 d: 291 | A = OR[291] 0x00BD (0x00017A) 0x2911- f:00024 d: 273 | OR[273] = A 0x00BE (0x00017C) 0x702E- f:00070 d: 46 | P = P + 46 (0x00EC) 0x00BF (0x00017E) 0x210F- f:00020 d: 271 | A = OR[271] 0x00C0 (0x000180) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001) 0x00C1 (0x000182) 0x2527- f:00022 d: 295 | A = A + OR[295] 0x00C2 (0x000184) 0x290D- f:00024 d: 269 | OR[269] = A 0x00C3 (0x000186) 0x310D- f:00030 d: 269 | A = (OR[269]) 0x00C4 (0x000188) 0x290D- f:00024 d: 269 | OR[269] = A 0x00C5 (0x00018A) 0x210F- f:00020 d: 271 | A = OR[271] 0x00C6 (0x00018C) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x00C7 (0x00018E) 0x2908- f:00024 d: 264 | OR[264] = A 0x00C8 (0x000190) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00C9 (0x000192) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x00CA (0x000194) 0x8604- f:00103 d: 4 | P = P + 4 (0x00CE), A # 0 0x00CB (0x000196) 0x210D- f:00020 d: 269 | A = OR[269] 0x00CC (0x000198) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x00CD (0x00019A) 0x290D- f:00024 d: 269 | OR[269] = A 0x00CE (0x00019C) 0x210D- f:00020 d: 269 | A = OR[269] 0x00CF (0x00019E) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x00D0 (0x0001A0) 0x2912- f:00024 d: 274 | OR[274] = A 0x00D1 (0x0001A2) 0x2D0F- f:00026 d: 271 | OR[271] = OR[271] + 1 0x00D2 (0x0001A4) 0x2112- f:00020 d: 274 | A = OR[274] 0x00D3 (0x0001A6) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x00D4 (0x0001A8) 0x290D- f:00024 d: 269 | OR[269] = A 0x00D5 (0x0001AA) 0x2110- f:00020 d: 272 | A = OR[272] 0x00D6 (0x0001AC) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001) 0x00D7 (0x0001AE) 0x251E- f:00022 d: 286 | A = A + OR[286] 0x00D8 (0x0001B0) 0x290E- f:00024 d: 270 | OR[270] = A 0x00D9 (0x0001B2) 0x2110- f:00020 d: 272 | A = OR[272] 0x00DA (0x0001B4) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x00DB (0x0001B6) 0x2908- f:00024 d: 264 | OR[264] = A 0x00DC (0x0001B8) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00DD (0x0001BA) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x00DE (0x0001BC) 0x8607- f:00103 d: 7 | P = P + 7 (0x00E5), A # 0 0x00DF (0x0001BE) 0x310E- f:00030 d: 270 | A = (OR[270]) 0x00E0 (0x0001C0) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x00E1 (0x0001C2) 0x250D- f:00022 d: 269 | A = A + OR[269] 0x00E2 (0x0001C4) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x00E3 (0x0001C6) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x00E4 (0x0001C8) 0x7006- f:00070 d: 6 | P = P + 6 (0x00EA) 0x00E5 (0x0001CA) 0x310E- f:00030 d: 270 | A = (OR[270]) 0x00E6 (0x0001CC) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x00E8 (0x0001D0) 0x250D- f:00022 d: 269 | A = A + OR[269] 0x00E9 (0x0001D2) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x00EA (0x0001D4) 0x2D10- f:00026 d: 272 | OR[272] = OR[272] + 1 0x00EB (0x0001D6) 0x2F11- f:00027 d: 273 | OR[273] = OR[273] - 1 0x00EC (0x0001D8) 0x2111- f:00020 d: 273 | A = OR[273] 0x00ED (0x0001DA) 0x8E2E- f:00107 d: 46 | P = P - 46 (0x00BF), A # 0 0x00EE (0x0001DC) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1 0x00EF (0x0001DE) 0x3104- f:00030 d: 260 | A = (OR[260]) 0x00F0 (0x0001E0) 0x2904- f:00024 d: 260 | OR[260] = A 0x00F1 (0x0001E2) 0x2104- f:00020 d: 260 | A = OR[260] 0x00F2 (0x0001E4) 0x2706- f:00023 d: 262 | A = A - OR[262] 0x00F3 (0x0001E6) 0x8007- f:00100 d: 7 | P = P + 7 (0x00FA), C = 0 0x00F4 (0x0001E8) 0x2104- f:00020 d: 260 | A = OR[260] 0x00F5 (0x0001EA) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x00F6 (0x0001EC) 0x8003- f:00100 d: 3 | P = P + 3 (0x00F9), C = 0 0x00F7 (0x0001EE) 0x8402- f:00102 d: 2 | P = P + 2 (0x00F9), A = 0 0x00F8 (0x0001F0) 0x7002- f:00070 d: 2 | P = P + 2 (0x00FA) 0x00F9 (0x0001F2) 0x7003- f:00070 d: 3 | P = P + 3 (0x00FC) 0x00FA (0x0001F4) 0x7C34- f:00076 d: 52 | R = OR[52] 0x00FB (0x0001F6) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x00FC (0x0001F8) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00FD (0x0001FA) 0x2923- f:00024 d: 291 | OR[291] = A 0x00FE (0x0001FC) 0x7435- f:00072 d: 53 | R = P + 53 (0x0133) 0x00FF (0x0001FE) 0x701B- f:00070 d: 27 | P = P + 27 (0x011A) 0x0100 (0x000200) 0x1026- f:00010 d: 38 | A = 38 (0x0026) 0x0101 (0x000202) 0x2929- f:00024 d: 297 | OR[297] = A 0x0102 (0x000204) 0x2118- f:00020 d: 280 | A = OR[280] 0x0103 (0x000206) 0x292A- f:00024 d: 298 | OR[298] = A 0x0104 (0x000208) 0x2119- f:00020 d: 281 | A = OR[281] 0x0105 (0x00020A) 0x292B- f:00024 d: 299 | OR[299] = A 0x0106 (0x00020C) 0x211E- f:00020 d: 286 | A = OR[286] 0x0107 (0x00020E) 0x292C- f:00024 d: 300 | OR[300] = A 0x0108 (0x000210) 0x211F- f:00020 d: 287 | A = OR[287] 0x0109 (0x000212) 0x292D- f:00024 d: 301 | OR[301] = A 0x010A (0x000214) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x010B (0x000216) 0x292E- f:00024 d: 302 | OR[302] = A 0x010C (0x000218) 0x1129- f:00010 d: 297 | A = 297 (0x0129) 0x010D (0x00021A) 0x5800- f:00054 d: 0 | B = A 0x010E (0x00021C) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x010F (0x00021E) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0110 (0x000220) 0x2119- f:00020 d: 281 | A = OR[281] 0x0111 (0x000222) 0x251F- f:00022 d: 287 | A = A + OR[287] 0x0112 (0x000224) 0x2919- f:00024 d: 281 | OR[281] = A 0x0113 (0x000226) 0x8002- f:00100 d: 2 | P = P + 2 (0x0115), C = 0 0x0114 (0x000228) 0x2D18- f:00026 d: 280 | OR[280] = OR[280] + 1 0x0115 (0x00022A) 0x2123- f:00020 d: 291 | A = OR[291] 0x0116 (0x00022C) 0x2722- f:00023 d: 290 | A = A - OR[290] 0x0117 (0x00022E) 0x2923- f:00024 d: 291 | OR[291] = A 0x0118 (0x000230) 0x741B- f:00072 d: 27 | R = P + 27 (0x0133) 0x0119 (0x000232) 0x7294- f:00071 d: 148 | P = P - 148 (0x0085) 0x011A (0x000234) 0x2120- f:00020 d: 288 | A = OR[288] 0x011B (0x000236) 0x2721- f:00023 d: 289 | A = A - OR[289] 0x011C (0x000238) 0x8403- f:00102 d: 3 | P = P + 3 (0x011F), A = 0 0x011D (0x00023A) 0x7416- f:00072 d: 22 | R = P + 22 (0x0133) 0x011E (0x00023C) 0x7204- f:00071 d: 4 | P = P - 4 (0x011A) 0x011F (0x00023E) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1 0x0120 (0x000240) 0x3104- f:00030 d: 260 | A = (OR[260]) 0x0121 (0x000242) 0x2904- f:00024 d: 260 | OR[260] = A 0x0122 (0x000244) 0x2104- f:00020 d: 260 | A = OR[260] 0x0123 (0x000246) 0x2706- f:00023 d: 262 | A = A - OR[262] 0x0124 (0x000248) 0x8007- f:00100 d: 7 | P = P + 7 (0x012B), C = 0 0x0125 (0x00024A) 0x2104- f:00020 d: 260 | A = OR[260] 0x0126 (0x00024C) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x0127 (0x00024E) 0x8003- f:00100 d: 3 | P = P + 3 (0x012A), C = 0 0x0128 (0x000250) 0x8402- f:00102 d: 2 | P = P + 2 (0x012A), A = 0 0x0129 (0x000252) 0x7002- f:00070 d: 2 | P = P + 2 (0x012B) 0x012A (0x000254) 0x7003- f:00070 d: 3 | P = P + 3 (0x012D) 0x012B (0x000256) 0x7C34- f:00076 d: 52 | R = OR[52] 0x012C (0x000258) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x012D (0x00025A) 0x102A- f:00010 d: 42 | A = 42 (0x002A) 0x012E (0x00025C) 0x2929- f:00024 d: 297 | OR[297] = A 0x012F (0x00025E) 0x1129- f:00010 d: 297 | A = 297 (0x0129) 0x0130 (0x000260) 0x5800- f:00054 d: 0 | B = A 0x0131 (0x000262) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0132 (0x000264) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0133 (0x000266) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0134 (0x000268) 0x2929- f:00024 d: 297 | OR[297] = A 0x0135 (0x00026A) 0x1800-0x0123 f:00014 d: 0 | A = 291 (0x0123) 0x0137 (0x00026E) 0x292A- f:00024 d: 298 | OR[298] = A 0x0138 (0x000270) 0x1800-0x0005 f:00014 d: 0 | A = 5 (0x0005) 0x013A (0x000274) 0x292B- f:00024 d: 299 | OR[299] = A 0x013B (0x000276) 0x2120- f:00020 d: 288 | A = OR[288] 0x013C (0x000278) 0x292C- f:00024 d: 300 | OR[300] = A 0x013D (0x00027A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x013E (0x00027C) 0x292D- f:00024 d: 301 | OR[301] = A 0x013F (0x00027E) 0x211E- f:00020 d: 286 | A = OR[286] 0x0140 (0x000280) 0x292E- f:00024 d: 302 | OR[302] = A 0x0141 (0x000282) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0142 (0x000284) 0x292F- f:00024 d: 303 | OR[303] = A 0x0143 (0x000286) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x0144 (0x000288) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001) 0x0145 (0x00028A) 0x2930- f:00024 d: 304 | OR[304] = A 0x0146 (0x00028C) 0x1129- f:00010 d: 297 | A = 297 (0x0129) 0x0147 (0x00028E) 0x5800- f:00054 d: 0 | B = A 0x0148 (0x000290) 0x1800-0x2318 f:00014 d: 0 | A = 8984 (0x2318) 0x014A (0x000294) 0x7C09- f:00076 d: 9 | R = OR[9] 0x014B (0x000296) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1 0x014C (0x000298) 0x211E- f:00020 d: 286 | A = OR[286] 0x014D (0x00029A) 0x290E- f:00024 d: 270 | OR[270] = A 0x014E (0x00029C) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x014F (0x00029E) 0x290D- f:00024 d: 269 | OR[269] = A 0x0150 (0x0002A0) 0x210D- f:00020 d: 269 | A = OR[269] 0x0151 (0x0002A2) 0x8407- f:00102 d: 7 | P = P + 7 (0x0158), A = 0 0x0152 (0x0002A4) 0x1800-0x2020 f:00014 d: 0 | A = 8224 (0x2020) 0x0154 (0x0002A8) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x0155 (0x0002AA) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1 0x0156 (0x0002AC) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1 0x0157 (0x0002AE) 0x7207- f:00071 d: 7 | P = P - 7 (0x0150) 0x0158 (0x0002B0) 0x0200- f:00001 d: 0 | EXIT 0x0159 (0x0002B2) 0x7626- f:00073 d: 38 | R = P - 38 (0x0133) 0x015A (0x0002B4) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x015B (0x0002B6) 0x290F- f:00024 d: 271 | OR[271] = A 0x015C (0x0002B8) 0x2126- f:00020 d: 294 | A = OR[294] 0x015D (0x0002BA) 0x2910- f:00024 d: 272 | OR[272] = A 0x015E (0x0002BC) 0x2125- f:00020 d: 293 | A = OR[293] 0x015F (0x0002BE) 0x2911- f:00024 d: 273 | OR[273] = A 0x0160 (0x0002C0) 0x702E- f:00070 d: 46 | P = P + 46 (0x018E) 0x0161 (0x0002C2) 0x210F- f:00020 d: 271 | A = OR[271] 0x0162 (0x0002C4) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001) 0x0163 (0x0002C6) 0x2524- f:00022 d: 292 | A = A + OR[292] 0x0164 (0x0002C8) 0x290D- f:00024 d: 269 | OR[269] = A 0x0165 (0x0002CA) 0x310D- f:00030 d: 269 | A = (OR[269]) 0x0166 (0x0002CC) 0x290D- f:00024 d: 269 | OR[269] = A 0x0167 (0x0002CE) 0x210F- f:00020 d: 271 | A = OR[271] 0x0168 (0x0002D0) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x0169 (0x0002D2) 0x2908- f:00024 d: 264 | OR[264] = A 0x016A (0x0002D4) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x016B (0x0002D6) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x016C (0x0002D8) 0x8604- f:00103 d: 4 | P = P + 4 (0x0170), A # 0 0x016D (0x0002DA) 0x210D- f:00020 d: 269 | A = OR[269] 0x016E (0x0002DC) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008) 0x016F (0x0002DE) 0x290D- f:00024 d: 269 | OR[269] = A 0x0170 (0x0002E0) 0x210D- f:00020 d: 269 | A = OR[269] 0x0171 (0x0002E2) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0172 (0x0002E4) 0x2912- f:00024 d: 274 | OR[274] = A 0x0173 (0x0002E6) 0x2D0F- f:00026 d: 271 | OR[271] = OR[271] + 1 0x0174 (0x0002E8) 0x2112- f:00020 d: 274 | A = OR[274] 0x0175 (0x0002EA) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF) 0x0176 (0x0002EC) 0x290D- f:00024 d: 269 | OR[269] = A 0x0177 (0x0002EE) 0x2110- f:00020 d: 272 | A = OR[272] 0x0178 (0x0002F0) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001) 0x0179 (0x0002F2) 0x251E- f:00022 d: 286 | A = A + OR[286] 0x017A (0x0002F4) 0x290E- f:00024 d: 270 | OR[270] = A 0x017B (0x0002F6) 0x2110- f:00020 d: 272 | A = OR[272] 0x017C (0x0002F8) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001) 0x017D (0x0002FA) 0x2908- f:00024 d: 264 | OR[264] = A 0x017E (0x0002FC) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x017F (0x0002FE) 0x2708- f:00023 d: 264 | A = A - OR[264] 0x0180 (0x000300) 0x8607- f:00103 d: 7 | P = P + 7 (0x0187), A # 0 0x0181 (0x000302) 0x310E- f:00030 d: 270 | A = (OR[270]) 0x0182 (0x000304) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009) 0x0183 (0x000306) 0x250D- f:00022 d: 269 | A = A + OR[269] 0x0184 (0x000308) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009) 0x0185 (0x00030A) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x0186 (0x00030C) 0x7006- f:00070 d: 6 | P = P + 6 (0x018C) 0x0187 (0x00030E) 0x310E- f:00030 d: 270 | A = (OR[270]) 0x0188 (0x000310) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00) 0x018A (0x000314) 0x250D- f:00022 d: 269 | A = A + OR[269] 0x018B (0x000316) 0x390E- f:00034 d: 270 | (OR[270]) = A 0x018C (0x000318) 0x2D10- f:00026 d: 272 | OR[272] = OR[272] + 1 0x018D (0x00031A) 0x2F11- f:00027 d: 273 | OR[273] = OR[273] - 1 0x018E (0x00031C) 0x2111- f:00020 d: 273 | A = OR[273] 0x018F (0x00031E) 0x8E2E- f:00107 d: 46 | P = P - 46 (0x0161), A # 0 0x0190 (0x000320) 0x765D- f:00073 d: 93 | R = P - 93 (0x0133) 0x0191 (0x000322) 0x7277- f:00071 d: 119 | P = P - 119 (0x011A) 0x0192 (0x000324) 0x4E4F- f:00047 d: 79 | A = A << B | **** non-standard encoding with D:0x004F **** 0x0193 (0x000326) 0x5420- f:00052 d: 32 | A = A + B | **** non-standard encoding with D:0x0020 **** 0x0194 (0x000328) 0x4C4F- f:00046 d: 79 | A = A >> B | **** non-standard encoding with D:0x004F **** 0x0195 (0x00032A) 0x4747- f:00043 d: 327 | C = 1, IOB = BZ | **** non-standard encoding with D:0x0147 **** 0x0196 (0x00032C) 0x4544- f:00042 d: 324 | C = 1, IOB = DN | **** non-standard encoding with D:0x0144 **** 0x0197 (0x00032E) 0x204F- f:00020 d: 79 | A = OR[79] 0x0198 (0x000330) 0x4E00- f:00047 d: 0 | A = A << B 0x0199 (0x000332) 0x4449- f:00042 d: 73 | C = 1, IOB = DN | **** non-standard encoding with D:0x0049 **** 0x019A (0x000334) 0x5350- f:00051 d: 336 | A = A & B | **** non-standard encoding with D:0x0150 **** 0x019B (0x000336) 0x4C41- f:00046 d: 65 | A = A >> B | **** non-standard encoding with D:0x0041 **** 0x019C (0x000338) 0x5920- f:00054 d: 288 | B = A | **** non-standard encoding with D:0x0120 **** 0x019D (0x00033A) 0x4E4F- f:00047 d: 79 | A = A << B | **** non-standard encoding with D:0x004F **** 0x019E (0x00033C) 0x5420- f:00052 d: 32 | A = A + B | **** non-standard encoding with D:0x0020 **** 0x019F (0x00033E) 0x4156- f:00040 d: 342 | C = 1, io 0526 = DN 0x01A0 (0x000340) 0x4149- f:00040 d: 329 | C = 1, io 0511 = DN 0x01A1 (0x000342) 0x4C41- f:00046 d: 65 | A = A >> B | **** non-standard encoding with D:0x0041 **** 0x01A2 (0x000344) 0x424C- f:00041 d: 76 | C = 1, io 0114 = BZ 0x01A3 (0x000346) 0x4500- f:00042 d: 256 | C = 1, IOB = DN | **** non-standard encoding with D:0x0100 **** 0x01A4 (0x000348) 0x0000- f:00000 d: 0 | PASS 0x01A5 (0x00034A) 0x0000- f:00000 d: 0 | PASS 0x01A6 (0x00034C) 0x0000- f:00000 d: 0 | PASS 0x01A7 (0x00034E) 0x0000- f:00000 d: 0 | PASS
ledpwmpulsating.asm
Fidget-Spinner/msp430-snippets
0
3714
<reponame>Fidget-Spinner/msp430-snippets ;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,"msp430.h" ; Include device header file ;------------------------------------------------------------------------------- .def RESET ; Export program entry-point to ; make it known to linker. ;------------------------------------------------------------------------------- .text ; Assemble into program memory. .retain ; Override ELF conditional linking ; and retain current section. .retainrefs ; And retain any sections that have ; references to current section. ;------------------------------------------------------------------------------- RESET mov.w #__STACK_END,SP ; Initialize stackpointer StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer ;------------------------------------------------------------------------------- ; Main loop here ;------------------------------------------------------------------------------- mov.w #0d,R5 ; Counts how many periods have elapsed. mov.w #0, R6 ; Check whether counting down or not 0 =no (counting up), 1 =yes (counting down) mov.w #961d,R11 ; R11 stores counts to keep light on for bis.b #001h, &P1DIR ; Set P1.0 as output Start mov.w #2,R9 ; Counter for on/off state. on = 1, off = 2. Can increase this number to repeat states. inc.w R5 ; +1 period elapsed cmp.w #120d,R5 ; Checks if 120 periods (roughly 2 seconds) has passed jge Toggle ; If yes, toggle RetToggle cmp.w #0, R6 ; If counting up, jnz Down ; If not counting up, jmp to Down add.w #16, R11 ; Else add 4 minus 2 (add 2 in total) Down sub.w #8, R11 ; If counting down, minus 2 mov.w #4600d,R10 ; 4600 counts is 1 cycle sub.w R11, R10 ; Counter for Delay loop; 4600 counts is 1 cycle. Mainloop xor.b #001h, &P1OUT ; Toggle value of P1.0 (ie toggle the LED) mov.w R10, R15 ; Resets counter for Delay loop cmp.w #2,R9 ; Test if state is on or off, off = 2 will set neg flag jeq Delay ; If eq(off), jmp to Delay mov.w R11, R15 ; Else, (on), will mov R11 (counter for on) into the R15 counter Delay dec.w R15 ; The Delay loop jnz Delay ; While R15 is not zero, keep looping back to label Delay dec.w R9 jz Start ; Marks the end of 1 clock cycle jmp Mainloop Toggle xor.w #001h,R6 ; Toggle up or down mov.w #0h, R5 ; Reset the period counter jmp RetToggle nop ;------------------------------------------------------------------------------- ; Stack Pointer definition ;------------------------------------------------------------------------------- .global __STACK_END .sect .stack ;------------------------------------------------------------------------------- ; Interrupt Vectors ;------------------------------------------------------------------------------- .sect ".reset" ; MSP430 RESET Vector .short RESET
src/Command_Line/line_parsers-receivers-multi_receivers.ads
fintatarta/eugen
0
23891
-- -- This package provides a "multi receiver," that is a handler that is able -- to store many instances of a basic handler. After the parsing it -- can be seen as a vector with a length and a way to access the n-th element. -- with Ada.Containers.Vectors; generic type Basic_Receiver is new Abstract_Parameter_Handler with private; package Line_Parsers.Receivers.Multi_Receivers is type Multi_Receiver is new Abstract_Parameter_Handler with private; overriding function Is_Set (Handler : Multi_Receiver) return Boolean; overriding function Reusable (Handler : Multi_Receiver) return Boolean; overriding procedure Receive (Handler : in out Multi_Receiver; Name : String; Value : String; Position : Natural); -- Return the number of times Receive was called function Length (Handler : Multi_Receiver) return Ada.Containers.Count_Type; function Element (Handler : Multi_Receiver; Pos : Positive) return Basic_Receiver; package Value_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Basic_Receiver); function All_Values (Handler : Multi_Receiver) return Value_Vectors.Vector; private use type Ada.Containers.Count_Type; type Multi_Receiver is new Abstract_Parameter_Handler with record Values : Value_Vectors.Vector; Set : Boolean := False; end record; function Is_Set (Handler : Multi_Receiver) return Boolean is (Handler.Length > 0); function All_Values (Handler : Multi_Receiver) return Value_Vectors.Vector is (Handler.Values); function Reusable (Handler : Multi_Receiver) return Boolean is (True); function Length (Handler : Multi_Receiver) return Ada.Containers.Count_Type is (Handler.Values.Length); function Element (Handler : Multi_Receiver; Pos : Positive) return Basic_Receiver is (Handler.Values (Pos)); end Line_Parsers.Receivers.Multi_Receivers;
sw/552tests/inst_tests/xori_13.asm
JPShen-UWM/ThreadKraken
1
11183
<reponame>JPShen-UWM/ThreadKraken // Original test: ./shojaei/hw4/problem6/xori_6.asm // Author: shojaei // Test source code follows lbi r1, 224 xori r1, r1, 0 halt
Definition/LogicalRelation/Properties/Reflexivity.agda
loic-p/logrel-mltt
0
11583
<gh_stars>0 {-# OPTIONS --without-K --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Properties.Reflexivity {{eqrel : EqRelSet}} where open import Definition.Untyped open import Definition.Typed open import Definition.LogicalRelation open import Tools.Embedding open import Tools.Product import Tools.PropositionalEquality as PE -- Reflexivity of reducible types. reflEq : ∀ {l Γ A} ([A] : Γ ⊩⟨ l ⟩ A) → Γ ⊩⟨ l ⟩ A ≡ A / [A] reflEq (Uᵣ′ l′ l< ⊢Γ) = (U₌ PE.refl) reflEq (ℕᵣ D) = ιx (ℕ₌ (red D)) reflEq (ne′ K [ ⊢A , ⊢B , D ] neK K≡K) = ιx (ne₌ _ [ ⊢A , ⊢B , D ] neK K≡K) reflEq (Πᵣ′ F G [ ⊢A , ⊢B , D ] ⊢F ⊢G A≡A [F] [G] G-ext) = Π₌ _ _ D A≡A (λ ρ ⊢Δ → reflEq ([F] ρ ⊢Δ)) (λ ρ ⊢Δ [a] → reflEq ([G] ρ ⊢Δ [a])) reflEq (emb′ 0<1 [A]) = ιx (reflEq [A]) reflNatural-prop : ∀ {Γ n} → Natural-prop Γ n → [Natural]-prop Γ n n reflNatural-prop (sucᵣ (ℕₜ n d t≡t prop)) = sucᵣ (ℕₜ₌ n n d d t≡t (reflNatural-prop prop)) reflNatural-prop zeroᵣ = zeroᵣ reflNatural-prop (ne (neNfₜ neK ⊢k k≡k)) = ne (neNfₜ₌ neK neK k≡k) -- Reflexivity of reducible terms. reflEqTerm : ∀ {l Γ A t} ([A] : Γ ⊩⟨ l ⟩ A) → Γ ⊩⟨ l ⟩ t ∷ A / [A] → Γ ⊩⟨ l ⟩ t ≡ t ∷ A / [A] reflEqTerm (Uᵣ′ ⁰ 0<1 ⊢Γ) (Uₜ A d typeA A≡A [A]) = Uₜ₌ A A d d typeA typeA A≡A [A] [A] (reflEq [A]) reflEqTerm (ℕᵣ D) (ιx (ℕₜ n [ ⊢t , ⊢u , d ] t≡t prop)) = ιx (ℕₜ₌ n n [ ⊢t , ⊢u , d ] [ ⊢t , ⊢u , d ] t≡t (reflNatural-prop prop)) reflEqTerm (ne′ K D neK K≡K) (ιx (neₜ k d (neNfₜ neK₁ ⊢k k≡k))) = ιx (neₜ₌ k k d d (neNfₜ₌ neK₁ neK₁ k≡k)) reflEqTerm (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Πₜ f d funcF f≡f [f] [f]₁) = Πₜ₌ f f d d funcF funcF f≡f (Πₜ f d funcF f≡f [f] [f]₁) (Πₜ f d funcF f≡f [f] [f]₁) (λ ρ ⊢Δ [a] → [f] ρ ⊢Δ [a] [a] (reflEqTerm ([F] ρ ⊢Δ) [a])) reflEqTerm (emb′ 0<1 [A]) (ιx t) = ιx (reflEqTerm [A] t)
example3/example3-1.asm
xabinapal/c64-examples
4
26607
;============================================================ ; Example 3-1 ; Moving a sprite ;============================================================ !cpu 6502 !to "build/example3-1.prg",cbm * = $1000 lda #$01 sta $d015 ; turn sprite 0 on sta $d027 ; make it white lda #$40 sta $d000 sta $d001 ; set x and y coordinates to 40 loop: lda $d012 cmp #$ff bne loop ; wait until raster line $ff lda dir ; check moving direction beq down ; if 0, down up: ldx coord dex stx coord ; decrement coordinates stx $d000 stx $d001 cpx #$40 ; change dir when coordinate is 40 bne loop lda #$00 sta dir jmp loop down: ldx coord inx stx coord stx $d000 stx $d001 cpx #$e0 bne loop lda #$01 sta dir jmp loop coord: !byte $40 ; current x and y coordinates dir: !byte $00 ; current direction ; 0 = down-right ; 1 = up-left
libsrc/_DEVELOPMENT/alloc/obstack/c/sccz80/obstack_next_free.asm
meesokim/z88dk
0
93078
; =============================================================== ; Dec 2013 ; =============================================================== ; ; void *obstack_next_free(struct obstack *ob) ; ; Returns address of next available byte in the obstack. ; ; =============================================================== SECTION code_alloc_obstack PUBLIC obstack_next_free obstack_next_free: INCLUDE "alloc/obstack/z80/asm_obstack_next_free.asm"
Mockingbird/Problems/Chapter10.agda
splintah/combinatory-logic
1
6453
open import Mockingbird.Forest using (Forest) -- Is There a Sage Bird? module Mockingbird.Problems.Chapter10 {b ℓ} (forest : Forest {b} {ℓ}) where open import Data.Product using (_,_; proj₁; proj₂; ∃-syntax) open import Function using (_$_) open import Mockingbird.Forest.Birds forest open Forest forest module _ ⦃ _ : HasComposition ⦄ ⦃ _ : HasMockingbird ⦄ ⦃ _ : HasLark ⦄ where private hasMockingbirdComposer : ∃[ A ] (∀ x y → A ∙ x ∙ y ≈ x ∙ (M ∙ y)) hasMockingbirdComposer = (L , isMockingbirdComposer) where isMockingbirdComposer = λ x y → begin L ∙ x ∙ y ≈⟨ isLark x y ⟩ x ∙ (y ∙ y) ≈˘⟨ congˡ $ isMockingbird y ⟩ x ∙ (M ∙ y) ∎ hasSageBird : HasSageBird hasSageBird = record { Θ = M ∘ L ; isSageBird = λ x → begin x ∙ ((M ∘ L) ∙ x) ≈⟨ congˡ $ isComposition M L x ⟩ x ∙ (M ∙ (L ∙ x)) ≈⟨ congˡ $ isMockingbird (L ∙ x) ⟩ x ∙ ((L ∙ x) ∙ (L ∙ x)) ≈˘⟨ isLark x (L ∙ x) ⟩ (L ∙ x) ∙ (L ∙ x) ≈˘⟨ isMockingbird (L ∙ x) ⟩ M ∙ (L ∙ x) ≈˘⟨ isComposition M L x ⟩ (M ∘ L) ∙ x ∎ } module _ ⦃ _ : HasComposition ⦄ ⦃ _ : HasMockingbird ⦄ (hasMockingbirdComposer : ∃[ A ] (∀ x y → A ∙ x ∙ y ≈ x ∙ (M ∙ y))) where private A = proj₁ hasMockingbirdComposer [Ax]y≈x[My] = proj₂ hasMockingbirdComposer instance hasLark : HasLark hasLark = record { L = A ; isLark = λ x y → begin (A ∙ x) ∙ y ≈⟨ [Ax]y≈x[My] x y ⟩ x ∙ (M ∙ y) ≈⟨ congˡ $ isMockingbird y ⟩ x ∙ (y ∙ y) ∎ } hasSageBird′ : HasSageBird hasSageBird′ = hasSageBird
Task/User-input-Text/Ada/user-input-text-4.ada
LaudateCorpus1/RosettaCodeData
1
18583
<filename>Task/User-input-Text/Ada/user-input-text-4.ada with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Text_IO.Unbounded_IO; procedure User_Input2 is S : Ada.Strings.Unbounded.Unbounded_String; I : Integer; begin Ada.Text_IO.Put("Enter a string: "); S := Ada.Strings.Unbounded.To_Unbounded_String(Ada.Text_IO.Get_Line); Ada.Text_IO.Put_Line(Ada.Strings.Unbounded.To_String(S)); Ada.Text_IO.Unbounded_IO.Put_Line(S); Ada.Text_IO.Put("Enter an integer: "); Ada.Integer_Text_IO.Get(I); Ada.Text_IO.Put_Line(Integer'Image(I)); end User_Input2;
oeis/151/A151976.asm
neoneye/loda-programs
11
93951
; A151976: Minimal recursive sequence beginning with 5 similar to N with respect to property of integer to be or not to be in A079523. ; Submitted by <NAME> ; 5,6,8,10,13,14,17,18,21,22,24,26,29,30,32,34,37,38,40,42,45,46,49,50,53,54,56,58,61 mov $2,$0 add $0,2 mov $1,64 gcd $1,$0 mod $1,3 mul $2,2 add $1,$2 mov $0,$1 add $0,3
malban/Release/VRelease/Release.History/VRelease_2017_04_14/Song/track_12_08.asm
mikepea/vectrex-playground
5
162955
dw $0040 track_12_08: db $F5, $77, $86, $EF, $47, $1E, $4F, $1E, $F8, $77 db $EF, $47, $B1, $C3, $DF, $0F, $67, $99, $E3, $7B db $DC, $0C, $0F, $FD, $E8, $E9, $C4, $BE, $EA, $A3 db $EE, $FD, $2F, $3F, $A8, $F6, $8C, $4B, $AC, $E1 db $D3, $48, $F9, $EF, $87, $AB, $BB, $AF, $BD, $EA db $78, $F3, $EF, $72, $BB, $BB, $7B, $DD, $E7, $8E db $DE, $F7, $4B, $BB, $87, $BD, $D2, $78, $E7, $EF db $70, $BB, $B7, $BD, $C6, $78, $FD, $DE, $8E, $9C db $4B, $E6, $AA, $3E, $AF, $D2, $F1, $FA, $8F, $58 db $C4, $BA, $4E, $1C, $F4, $8F, $DD, $E8, $E9, $C4 db $BE, $6A, $A3, $EA, $FD, $2F, $1F, $A8, $F5, $8C db $4B, $A4, $E1, $CF, $48, $FF, $DE, $8E, $9C, $4B db $EE, $AA, $3E, $EF, $D2, $F3, $FA, $8F, $68, $C4 db $BA, $CE, $1D, $34, $80
P6/data_P6_2/ALUTest62.asm
alxzzhou/BUAA_CO_2020
1
25039
<reponame>alxzzhou/BUAA_CO_2020 lw $3,0($0) addu $4,$0,$3 ori $5,$0,41871 nor $4,$4,$3 or $5,$3,$3 slt $6,$5,$3 srav $5,$3,$3 slti $4,$4,11790 sh $4,8($0) srav $3,$6,$3 sw $3,0($0) slt $4,$4,$3 sb $3,13($0) subu $3,$5,$3 ori $3,$1,46800 subu $1,$3,$3 addiu $1,$1,14740 srav $4,$4,$3 sb $3,12($0) sra $6,$6,6 addiu $5,$1,-19921 slt $3,$4,$3 sh $5,6($0) xori $1,$3,17113 addiu $3,$3,-15023 sh $5,2($0) sll $5,$3,5 addiu $4,$4,19205 sllv $3,$6,$3 lw $5,12($0) slti $5,$3,-20748 slt $0,$3,$3 addu $6,$1,$3 addiu $4,$1,16618 srav $1,$3,$3 lh $0,2($0) slti $1,$3,28724 addiu $6,$6,19529 sb $4,12($0) sllv $3,$3,$3 lhu $1,0($0) ori $4,$3,38671 addiu $4,$4,-18073 srl $4,$5,2 lb $4,15($0) addiu $5,$0,19553 andi $3,$6,22588 xor $6,$6,$3 sllv $5,$1,$3 and $3,$3,$3 ori $3,$3,55028 lbu $1,11($0) lb $1,1($0) srlv $3,$5,$3 lb $4,16($0) sb $4,12($0) slti $4,$3,22993 sh $3,0($0) xori $0,$4,20036 subu $3,$3,$3 addu $4,$1,$3 sll $3,$6,26 xori $3,$3,16935 lb $4,9($0) addiu $4,$5,14307 sra $3,$3,7 xori $3,$5,35250 addu $1,$3,$3 lb $5,6($0) addiu $3,$4,16213 xor $3,$5,$3 sw $3,8($0) srl $4,$3,2 nor $4,$5,$3 addu $1,$4,$3 subu $0,$6,$3 subu $0,$4,$3 addu $6,$3,$3 addiu $0,$3,25023 srav $3,$1,$3 xori $4,$4,60999 xor $5,$0,$3 sltu $4,$5,$3 slt $3,$1,$3 sllv $5,$6,$3 addu $4,$1,$3 andi $6,$4,63621 sh $3,8($0) sllv $5,$3,$3 nor $5,$1,$3 slt $5,$3,$3 slti $3,$3,-4144 sltu $1,$0,$3 lbu $4,12($0) addu $5,$1,$3 addiu $3,$1,13228 slt $3,$2,$3 slt $5,$3,$3 or $6,$3,$3 slti $1,$3,-5573 slt $5,$5,$3 sllv $4,$4,$3 lhu $1,8($0) sll $4,$4,6 srav $5,$1,$3 andi $0,$4,52712 sh $1,8($0) lhu $5,12($0) addiu $3,$3,-933 sltu $3,$0,$3 ori $0,$3,9678 lw $1,16($0) lb $5,11($0) sltu $4,$4,$3 slt $3,$5,$3 xor $5,$3,$3 lbu $3,2($0) srav $3,$3,$3 lhu $3,0($0) sw $6,8($0) sll $5,$2,22 subu $3,$5,$3 sw $2,0($0) andi $5,$5,53065 addu $1,$1,$3 subu $5,$5,$3 srl $3,$4,26 sra $6,$5,18 addiu $5,$3,6426 sw $3,16($0) xori $6,$0,36131 sll $1,$4,12 sb $3,14($0) sltiu $4,$5,9401 lhu $3,2($0) lbu $6,0($0) srlv $3,$1,$3 slt $3,$4,$3 sltu $4,$0,$3 or $3,$3,$3 sll $4,$5,30 and $5,$5,$3 nor $5,$6,$3 sltu $6,$1,$3 slti $4,$3,9398 sra $4,$3,20 xori $4,$5,57958 slti $4,$3,10501 ori $1,$4,17428 addu $4,$4,$3 subu $5,$1,$3 xori $5,$6,53347 sw $3,12($0) slt $6,$3,$3 srav $4,$3,$3 addiu $3,$3,11852 subu $0,$1,$3 nor $6,$6,$3 addiu $6,$3,-9372 and $0,$3,$3 addu $5,$5,$3 subu $0,$0,$3 sll $1,$1,3 xor $4,$4,$3 lbu $1,6($0) addu $3,$3,$3 sra $4,$6,2 sb $5,1($0) sra $4,$6,7 lhu $5,10($0) ori $1,$3,27584 lh $3,10($0) slti $4,$3,-23889 addu $4,$1,$3 sll $3,$2,9 addu $5,$1,$3 addiu $6,$0,2027 sh $4,8($0) sw $5,12($0) slt $3,$4,$3 addu $4,$0,$3 sllv $3,$3,$3 slti $4,$3,-14865 addiu $3,$5,-2856 srl $1,$4,4 xori $3,$3,62924 nor $4,$3,$3 slti $5,$5,-25438 xori $4,$3,33179 sb $0,6($0) srl $4,$1,14 srl $6,$6,25 nor $3,$5,$3 sra $3,$3,31 ori $5,$5,51653 addu $4,$3,$3 sh $5,6($0) lb $4,5($0) lw $4,8($0) nor $5,$1,$3 lh $4,10($0) nor $4,$4,$3 xor $0,$3,$3 xori $3,$3,17593 ori $3,$5,5076 sll $3,$0,6 subu $4,$1,$3 ori $3,$1,52603 or $6,$1,$3 slti $3,$3,24110 addiu $1,$1,-22822 nor $5,$5,$3 sllv $4,$4,$3 lb $3,1($0) addiu $3,$3,13931 lbu $0,12($0) sltu $5,$3,$3 lbu $4,12($0) srlv $1,$1,$3 xor $4,$4,$3 sltiu $4,$4,24031 lhu $0,8($0) srav $6,$1,$3 sb $1,15($0) addu $5,$5,$3 lbu $3,16($0) sra $0,$1,22 ori $3,$3,28268 xor $4,$4,$3 lb $3,8($0) sra $5,$5,14 sw $1,16($0) sllv $3,$6,$3 sltiu $4,$4,22210 xor $5,$4,$3 xor $4,$4,$3 nor $0,$0,$3 srlv $0,$4,$3 sll $3,$4,25 addu $5,$3,$3 sh $4,0($0) sh $3,2($0) subu $5,$3,$3 nor $1,$1,$3 sh $3,4($0) srlv $1,$3,$3 slti $0,$0,-26284 sllv $3,$3,$3 and $3,$5,$3 lhu $5,2($0) srl $3,$4,28 sw $3,4($0) andi $5,$5,8569 or $3,$3,$3 addiu $3,$4,1782 addiu $3,$6,-275 sb $3,5($0) addiu $6,$6,10023 sllv $4,$3,$3 lb $5,3($0) slti $4,$4,-2535 addu $0,$0,$3 addu $5,$1,$3 sltiu $4,$4,-17594 nor $1,$4,$3 slt $6,$1,$3 sltiu $3,$5,17544 lh $3,16($0) sb $1,11($0) lw $4,16($0) subu $5,$6,$3 sw $4,0($0) subu $3,$0,$3 and $3,$4,$3 lw $5,0($0) and $4,$3,$3 addu $3,$6,$3 sltu $4,$4,$3 addu $5,$5,$3 xori $4,$3,17352 sll $3,$6,7 ori $1,$3,17093 sltiu $3,$4,-14446 lbu $0,15($0) sltu $3,$3,$3 lhu $3,0($0) ori $1,$3,12851 andi $1,$3,63490 xor $3,$3,$3 and $1,$1,$3 lw $6,16($0) sw $3,8($0) sllv $3,$4,$3 sll $4,$3,22 sll $1,$3,5 addu $5,$4,$3 sllv $4,$6,$3 sllv $5,$3,$3 sra $5,$4,13 lb $3,3($0) nor $4,$6,$3 xori $3,$1,41480 addiu $3,$5,22837 lh $4,4($0) sltu $3,$4,$3 xor $3,$6,$3 xori $5,$4,35644 srlv $4,$3,$3 srlv $4,$4,$3 addu $5,$5,$3 lbu $3,9($0) lw $3,4($0) sra $6,$2,9 sllv $1,$4,$3 sltu $6,$6,$3 or $4,$4,$3 addiu $3,$3,19281 sh $5,16($0) sb $4,0($0) lb $3,0($0) xor $4,$3,$3 or $3,$5,$3 ori $3,$0,49820 addiu $0,$3,9067 xori $4,$4,54355 lh $6,4($0) sltiu $4,$4,13228 addu $3,$3,$3 addu $1,$3,$3 sb $1,3($0) srlv $4,$1,$3 slt $4,$1,$3 srl $4,$4,3 addu $4,$3,$3 addu $5,$5,$3 andi $1,$5,60722 lh $1,6($0) srav $4,$4,$3 subu $3,$1,$3 subu $3,$1,$3 addu $5,$0,$3 addu $1,$4,$3 and $4,$4,$3 sw $5,12($0) addu $4,$5,$3 srl $1,$3,19 sltiu $5,$3,25566 sltiu $1,$3,6117 srav $3,$3,$3 lhu $0,0($0) lh $4,16($0) addiu $1,$4,25908 srav $3,$3,$3 lh $5,4($0) lb $4,4($0) lbu $1,4($0) sllv $6,$0,$3 slt $4,$3,$3 subu $5,$5,$3 xor $4,$1,$3 srlv $4,$3,$3 xori $4,$6,31701 xor $6,$6,$3 ori $3,$4,45494 addiu $5,$5,27231 xor $4,$4,$3 srl $6,$6,10 slt $0,$0,$3 andi $0,$1,41094 or $4,$4,$3 sw $5,12($0) lw $4,12($0) lw $4,12($0) or $1,$6,$3 sh $3,0($0) xor $1,$3,$3 lh $1,6($0) xor $3,$5,$3 xori $3,$4,3049 lhu $4,12($0) lh $6,10($0) srav $3,$3,$3 xori $3,$4,53249 slti $5,$0,-4516 srav $0,$4,$3 slti $3,$4,22030 lbu $3,13($0) xori $5,$3,24977 slt $3,$3,$3 xor $4,$1,$3 addiu $6,$3,19236 addiu $5,$1,18861 srlv $1,$1,$3 slt $3,$4,$3 and $5,$5,$3 sltiu $4,$3,23294 nor $3,$4,$3 sltu $3,$3,$3 slt $0,$3,$3 slt $5,$4,$3 srl $1,$3,17 subu $1,$1,$3 lhu $0,2($0) srlv $4,$6,$3 srl $3,$6,21 lb $0,11($0) slt $3,$4,$3 subu $5,$4,$3 addiu $3,$3,20002 lw $3,0($0) srl $3,$4,23 nor $5,$4,$3 srav $4,$3,$3 subu $5,$4,$3 subu $4,$3,$3 addiu $4,$1,-30471 sllv $1,$1,$3 lw $6,0($0) addu $4,$4,$3 sltu $3,$5,$3 lw $5,8($0) srlv $3,$6,$3 lhu $4,6($0) or $5,$3,$3 sb $4,3($0) sh $4,14($0) addiu $1,$1,-2502 sllv $5,$3,$3 sw $3,8($0) slti $4,$3,21647 sllv $4,$4,$3 xor $1,$5,$3 srlv $3,$3,$3 subu $4,$4,$3 sltiu $6,$3,-13978 sltu $0,$5,$3 nor $6,$1,$3 slt $3,$4,$3 sltu $4,$4,$3 ori $1,$1,41825 andi $1,$5,49912 lh $3,6($0) sltiu $4,$3,-2166 lbu $1,6($0) slt $4,$4,$3 sra $5,$3,26 slt $4,$3,$3 subu $5,$5,$3 lbu $6,13($0) or $3,$3,$3 srl $4,$3,19 nor $4,$3,$3 addiu $6,$6,25595 sltu $4,$1,$3 sh $5,10($0) lbu $3,14($0) sra $4,$5,1 srlv $1,$4,$3 nor $5,$5,$3 addu $4,$1,$3 subu $1,$6,$3 sb $5,2($0) lbu $5,8($0) sll $4,$4,0 sb $4,10($0) srav $3,$3,$3 lb $0,10($0) subu $4,$6,$3 lbu $1,2($0) lbu $5,4($0) and $1,$3,$3 sllv $4,$6,$3 sh $3,16($0) xor $1,$4,$3 subu $3,$4,$3 srlv $1,$3,$3 sltu $0,$4,$3 srl $4,$1,28 lbu $3,13($0) slt $0,$0,$3 or $1,$0,$3 addu $6,$4,$3 ori $6,$4,48619 lhu $2,6($0) sw $5,8($0) slt $3,$1,$3 lw $3,8($0) nor $5,$5,$3 addu $5,$3,$3 lhu $5,4($0) srlv $4,$6,$3 sltiu $3,$3,8975 sh $4,16($0) andi $3,$4,13762 lw $3,4($0) slti $4,$4,15738 nor $3,$1,$3 sltu $4,$4,$3 xori $4,$3,62904 srl $4,$1,4 and $3,$3,$3 sh $3,4($0) sllv $5,$3,$3 lh $1,4($0) addu $1,$1,$3 sll $1,$3,21 subu $3,$5,$3 sb $4,11($0) lw $3,8($0) subu $4,$3,$3 addu $1,$1,$3 or $1,$2,$3 sll $4,$5,5 lbu $4,15($0) nor $3,$3,$3 sh $3,10($0) addu $4,$4,$3 srl $4,$5,24 slti $0,$4,6309 lhu $5,10($0) lhu $1,6($0) sltu $0,$0,$3 xor $3,$4,$3 sllv $4,$3,$3 addiu $3,$4,26451 srl $4,$4,13 addu $0,$4,$3 srl $3,$6,9 nor $4,$3,$3 slt $6,$3,$3 xori $6,$6,47517 sltiu $1,$1,2563 sllv $3,$3,$3 lhu $4,2($0) and $4,$3,$3 lw $3,16($0) addu $3,$0,$3 slti $5,$3,8676 sltiu $5,$4,11873 srl $3,$3,10 addu $0,$3,$3 sllv $3,$5,$3 sllv $4,$4,$3 lh $4,14($0) sll $4,$4,7 slti $1,$2,-3741 addiu $5,$5,7049 nor $3,$4,$3 sltu $1,$6,$3 lbu $3,12($0) srlv $1,$0,$3 subu $1,$5,$3 slt $1,$1,$3 subu $4,$4,$3 lb $4,3($0) srav $6,$4,$3 lbu $4,1($0) srlv $4,$4,$3 andi $4,$3,40188 sra $3,$3,25 ori $6,$4,42294 srl $3,$3,31 sb $6,12($0) srl $0,$4,13 or $4,$4,$3 subu $4,$4,$3 subu $5,$6,$3 lhu $5,4($0) andi $5,$3,24967 addu $3,$3,$3 lw $1,8($0) srl $3,$3,13 lh $0,4($0) srl $1,$3,25 subu $3,$4,$3 sh $5,4($0) sltu $4,$4,$3 ori $4,$3,12574 sltu $5,$5,$3 addu $6,$4,$3 xori $4,$3,5041 andi $5,$2,4820 or $4,$5,$3 lb $4,0($0) or $4,$4,$3 sb $3,5($0) sw $3,8($0) sllv $0,$3,$3 srav $3,$3,$3 or $4,$3,$3 xori $3,$3,4672 slti $3,$3,16822 and $3,$3,$3 slt $5,$1,$3 xor $4,$4,$3 sw $3,0($0) sllv $1,$4,$3 sb $3,14($0) ori $3,$0,21416 lhu $1,12($0) or $1,$1,$3 subu $1,$5,$3 lw $0,4($0) lhu $3,8($0) sll $4,$4,24 or $5,$5,$3 and $0,$1,$3 sra $4,$4,16 slt $1,$4,$3 sltu $4,$6,$3 sltiu $5,$3,-15660 srl $4,$3,12 nor $5,$4,$3 lh $4,2($0) sw $4,0($0) and $4,$1,$3 lw $4,16($0) addiu $1,$2,-2217 slti $5,$1,-13331 sltiu $4,$4,-19350 srlv $4,$1,$3 slti $3,$6,-32596 addu $5,$5,$3 subu $3,$3,$3 lw $4,8($0) srl $3,$4,30 subu $3,$4,$3 slt $1,$1,$3 addu $4,$4,$3 srlv $5,$4,$3 subu $3,$3,$3 xori $5,$3,39471 xor $1,$6,$3 subu $6,$0,$3 subu $5,$4,$3 sltu $5,$4,$3 xor $5,$1,$3 subu $4,$3,$3 or $3,$4,$3 and $1,$5,$3 lb $3,16($0) slti $0,$3,3649 nor $4,$1,$3 addu $5,$5,$3 lh $1,16($0) sllv $3,$4,$3 lw $4,16($0) sllv $4,$3,$3 sra $4,$0,18 srlv $4,$5,$3 nor $6,$5,$3 xor $5,$2,$3 lhu $0,2($0) lbu $0,4($0) sllv $3,$3,$3 sh $6,8($0) sra $1,$3,14 srl $3,$0,20 sra $3,$3,23 xor $4,$4,$3 sltu $5,$1,$3 slti $3,$3,32470 sh $1,2($0) addu $4,$4,$3 srav $1,$4,$3 slti $3,$4,-27666 sllv $1,$4,$3 srlv $1,$3,$3 lbu $3,10($0) ori $3,$5,28654 xori $3,$3,53708 lh $1,2($0) addiu $3,$5,-3859 subu $3,$3,$3 lb $4,2($0) addu $1,$5,$3 addu $1,$1,$3 ori $6,$3,25552 srlv $4,$5,$3 srlv $3,$3,$3 xor $0,$3,$3 subu $6,$3,$3 lhu $6,4($0) lw $1,4($0) sra $4,$3,17 addiu $4,$4,2807 xori $3,$4,16227 sll $4,$5,4 srl $3,$3,9 sh $4,14($0) slt $3,$3,$3 ori $3,$3,20833 addu $6,$3,$3 srav $0,$6,$3 xor $3,$5,$3 ori $3,$3,54400 addiu $3,$4,-20936 sllv $3,$3,$3 andi $5,$5,31995 sh $3,2($0) and $1,$3,$3 sltu $4,$1,$3 xor $3,$3,$3 sw $0,4($0) sllv $5,$4,$3 xori $3,$3,34331 lhu $4,4($0) addiu $1,$0,21292 slt $6,$4,$3 sra $5,$3,12 subu $3,$3,$3 xor $1,$1,$3 lb $3,8($0) sltu $0,$3,$3 lbu $6,1($0) sltu $3,$3,$3 nor $5,$5,$3 sh $4,6($0) addiu $3,$3,-8304 srav $3,$1,$3 addu $4,$6,$3 xori $4,$6,42388 sw $4,16($0) slti $3,$0,-19185 lb $1,2($0) sw $3,12($0) srav $3,$3,$3 sw $4,8($0) ori $3,$3,54110 sra $3,$3,13 lbu $3,12($0) sra $3,$3,31 lbu $4,13($0) slt $3,$4,$3 sltiu $6,$4,-28224 srav $1,$6,$3 addiu $4,$1,5423 srav $6,$3,$3 addiu $0,$4,-24878 addu $4,$3,$3 srl $5,$6,23 or $3,$4,$3 sll $4,$0,15 addiu $3,$3,2403 sh $3,10($0) sllv $3,$5,$3 sltu $1,$3,$3 sw $4,8($0) srlv $1,$1,$3 xori $0,$0,64996 sra $1,$3,6 lw $4,12($0) xor $0,$3,$3 lw $1,12($0) slti $3,$4,-6093 lbu $6,2($0) sh $6,8($0) slti $6,$4,-10917 sltu $3,$4,$3 subu $3,$3,$3 sh $3,14($0) sb $4,0($0) and $4,$3,$3 lbu $4,0($0) addu $4,$3,$3 sra $4,$4,13 addu $4,$5,$3 sllv $3,$5,$3 xor $5,$1,$3 slti $1,$0,-22318 addiu $4,$4,29218 ori $0,$6,14181 ori $6,$4,17838 sh $5,2($0) xor $5,$5,$3 and $5,$3,$3 subu $3,$4,$3 lh $0,14($0) sw $3,0($0) or $3,$1,$3 srl $1,$4,7 subu $1,$3,$3 addiu $4,$4,-30380 lbu $1,3($0) addu $1,$1,$3 slt $3,$4,$3 and $5,$5,$3 addiu $4,$4,24210 ori $0,$3,40597 lh $4,4($0) sltu $0,$1,$3 srav $1,$3,$3 addu $5,$3,$3 addiu $4,$4,18927 xor $3,$3,$3 slti $6,$3,-26529 sw $4,16($0) srlv $1,$1,$3 xori $4,$1,2848 srav $0,$5,$3 ori $6,$6,18931 subu $3,$1,$3 sh $3,0($0) and $3,$1,$3 lw $3,16($0) srlv $6,$1,$3 sltu $4,$4,$3 or $1,$1,$3 lh $1,0($0) slti $3,$1,6352 sltu $3,$3,$3 lhu $1,16($0) sllv $1,$1,$3 slt $5,$1,$3 sllv $1,$1,$3 srl $1,$6,26 sw $4,0($0) srl $4,$4,29 slt $1,$1,$3 slt $4,$4,$3 srl $5,$0,1 andi $3,$3,25959 sra $1,$4,4 addu $1,$1,$3 lb $6,11($0) srlv $3,$1,$3 subu $6,$5,$3 and $1,$3,$3 and $4,$4,$3 sb $6,13($0) subu $4,$6,$3 lhu $3,8($0) lhu $1,8($0) addiu $4,$1,-7373 lw $5,12($0) nor $1,$1,$3 sw $3,0($0) srlv $4,$5,$3 sllv $3,$3,$3 lbu $1,6($0) lb $1,14($0) ori $5,$4,65007 xor $6,$4,$3 subu $4,$4,$3 sllv $0,$5,$3 addu $0,$0,$3 slt $3,$3,$3 xori $1,$1,36605 or $5,$1,$3 addu $3,$6,$3 slti $3,$3,7944 xor $3,$1,$3 xori $4,$3,45293 addu $3,$5,$3 sh $4,10($0) lhu $4,14($0) ori $0,$4,47042 subu $5,$3,$3 xori $0,$1,37153 andi $1,$3,39634 lhu $3,14($0) lhu $4,10($0) slti $3,$1,11982 srlv $3,$3,$3 lhu $3,10($0) srav $3,$5,$3 lb $0,5($0) sll $3,$3,19 subu $5,$5,$3 nor $0,$1,$3 and $3,$4,$3 or $3,$3,$3 sra $1,$1,19 sltu $5,$5,$3 addiu $5,$1,-21051 lb $5,8($0) sw $1,0($0) sltiu $1,$3,-2321 srlv $1,$6,$3 and $6,$0,$3 sltiu $1,$4,6825 nor $4,$4,$3 and $3,$3,$3 andi $4,$4,53288 sw $4,4($0) lhu $5,6($0) lh $3,16($0) nor $5,$5,$3
data/pokemon/egg_moves_hoenn.asm
AtmaBuster/pokeplat-gen2
6
85379
SECTION "Egg Moves 3", ROMX EggMovePointers3:: dw TreeckoEggMoves dw NoEggMoves3 dw NoEggMoves3 dw TorchicEggMoves dw NoEggMoves3 dw NoEggMoves3 dw MudkipEggMoves dw NoEggMoves3 dw NoEggMoves3 dw PoochyenaEggMoves dw NoEggMoves3 dw ZigzagoonEggMoves dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw LotadEggMoves dw NoEggMoves3 dw NoEggMoves3 dw SeedotEggMoves dw NoEggMoves3 dw NoEggMoves3 dw TaillowEggMoves dw NoEggMoves3 dw WingullEggMoves dw NoEggMoves3 dw RaltsEggMoves dw NoEggMoves3 dw NoEggMoves3 dw SurskitEggMoves dw NoEggMoves3 dw ShroomishEggMoves dw NoEggMoves3 dw SlakothEggMoves dw NoEggMoves3 dw NoEggMoves3 dw NincadaEggMoves dw NoEggMoves3 dw NoEggMoves3 dw WhismurEggMoves dw NoEggMoves3 dw NoEggMoves3 dw MakuhitaEggMoves dw NoEggMoves3 dw AzurillEggMoves dw NosepassEggMoves dw SkittyEggMoves dw NoEggMoves3 dw SableyeEggMoves dw MawileEggMoves dw AronEggMoves dw NoEggMoves3 dw NoEggMoves3 dw MedititeEggMoves dw NoEggMoves3 dw ElectrikeEggMoves dw NoEggMoves3 dw PlusleEggMoves dw MinunEggMoves dw VolbeatEggMoves dw IllumiseEggMoves dw RoseliaEggMoves dw GulpinEggMoves dw NoEggMoves3 dw CarvanhaEggMoves dw NoEggMoves3 dw WailmerEggMoves dw NoEggMoves3 dw NumelEggMoves dw NoEggMoves3 dw TorkoalEggMoves dw SpoinkEggMoves dw NoEggMoves3 dw SpindaEggMoves dw TrapinchEggMoves dw NoEggMoves3 dw NoEggMoves3 dw CacneaEggMoves dw NoEggMoves3 dw SwabluEggMoves dw NoEggMoves3 dw ZangooseEggMoves dw SeviperEggMoves dw NoEggMoves3 dw NoEggMoves3 dw BarboachEggMoves dw NoEggMoves3 dw CorphishEggMoves dw NoEggMoves3 dw BaltoyEggMoves dw NoEggMoves3 dw LileepEggMoves dw NoEggMoves3 dw AnorithEggMoves dw NoEggMoves3 dw FeebasEggMoves dw NoEggMoves3 dw CastformEggMoves dw KecleonEggMoves dw ShuppetEggMoves dw NoEggMoves3 dw DuskullEggMoves dw NoEggMoves3 dw TropiusEggMoves dw ChimechoEggMoves dw AbsolEggMoves dw NoEggMoves3 dw SnoruntEggMoves dw NoEggMoves3 dw SphealEggMoves dw NoEggMoves3 dw NoEggMoves3 dw ClamperlEggMoves dw NoEggMoves3 dw NoEggMoves3 dw RelicanthEggMoves dw LuvdiscEggMoves dw BagonEggMoves dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 dw NoEggMoves3 TreeckoEggMoves: dw CRUNCH dw CRUSH_CLAW dw DOUBLE_KICK dw DRAGONBREATH dw ENDEAVOR dw GRASSWHISTLE dw LEAF_STORM dw LEECH_SEED dw MAGICAL_LEAF dw MUD_SPORT dw SYNTHESIS dw WORRY_SEED dw -1 ; end TorchicEggMoves: dw AGILITY dw BATON_PASS dw COUNTER dw CRUSH_CLAW dw ENDURE dw FEINT dw LAST_RESORT dw NIGHT_SLASH dw REVERSAL dw ROCK_SLIDE dw SMELLINGSALT dw SWAGGER dw -1 ; end MudkipEggMoves: dw ANCIENTPOWER dw BITE dw COUNTER dw CURSE dw DOUBLE_EDGE dw ICE_BALL dw MIRROR_COAT dw MUD_BOMB dw REFRESH dw STOMP dw UPROAR dw WHIRLPOOL dw -1 ; end PoochyenaEggMoves: dw ASTONISH dw COVET dw FIRE_FANG dw ICE_FANG dw LEER dw ME_FIRST dw POISON_FANG dw SUCKER_PUNCH dw THUNDER_FANG dw YAWN dw -1 ; end ZigzagoonEggMoves: dw CHARM dw HELPING_HAND dw MUD_SLAP dw PURSUIT dw SUBSTITUTE dw TICKLE dw TRICK dw -1 ; end LotadEggMoves: dw FLAIL dw LEECH_SEED dw RAZOR_LEAF dw SWEET_SCENT dw TICKLE dw WATER_GUN dw -1 ; end SeedotEggMoves: dw AMNESIA dw FALSE_SWIPE dw LEECH_SEED dw NASTY_PLOT dw QUICK_ATTACK dw RAZOR_WIND dw TAKE_DOWN dw WORRY_SEED dw -1 ; end TaillowEggMoves: dw BRAVE_BIRD dw MIRROR_MOVE dw PURSUIT dw RAGE dw REFRESH dw SKY_ATTACK dw SUPERSONIC dw WHIRLWIND dw -1 ; end WingullEggMoves: dw AGILITY dw AQUA_RING dw GUST dw KNOCK_OFF dw MIST dw TWISTER dw WATER_SPORT dw -1 ; end RaltsEggMoves: dw CONFUSE_RAY dw DESTINY_BOND dw DISABLE dw GRUDGE dw MEAN_LOOK dw MEMENTO dw SHADOW_SNEAK dw WILL_O_WISP dw -1 ; end SurskitEggMoves: dw BUG_BITE dw FORESIGHT dw HYDRO_PUMP dw MIND_READER dw MUD_SHOT dw PSYBEAM dw SIGNAL_BEAM dw -1 ; end ShroomishEggMoves: dw CHARM dw FAKE_TEARS dw FALSE_SWIPE dw HELPING_HAND dw SEED_BOMB dw SWAGGER dw WAKE_UP_SLAP dw WORRY_SEED dw -1 ; end SlakothEggMoves: dw BODY_SLAM dw CRUSH_CLAW dw CURSE dw HAMMER_ARM dw NIGHT_SLASH dw PURSUIT dw SLASH dw SLEEP_TALK dw SNORE dw -1 ; end NincadaEggMoves: dw BUG_BITE dw BUG_BUZZ dw ENDURE dw FAINT_ATTACK dw GUST dw NIGHT_SLASH dw SILVER_WIND dw -1 ; end WhismurEggMoves: dw ENDEAVOR dw EXTRASENSORY dw SMELLINGSALT dw SMOKESCREEN dw SNORE dw SWAGGER dw TAKE_DOWN dw -1 ; end MakuhitaEggMoves: dw BULLET_PUNCH dw COUNTER dw CROSS_CHOP dw DETECT dw DYNAMICPUNCH dw FAINT_ATTACK dw FORESIGHT dw HELPING_HAND dw REVENGE dw WAKE_UP_SLAP dw -1 ; end AzurillEggMoves: dw ENCORE dw FAKE_TEARS dw REFRESH dw SING dw SLAM dw TICKLE dw -1 ; end NosepassEggMoves: dw BLOCK dw DOUBLE_EDGE dw EXPLOSION dw MAGNITUDE dw ROLLOUT dw -1 ; end SkittyEggMoves: dw BATON_PASS dw FAKE_OUT dw FAKE_TEARS dw HELPING_HAND dw LAST_RESORT dw PSYCH_UP dw SUBSTITUTE dw SUCKER_PUNCH dw TICKLE dw UPROAR dw WISH dw ZEN_HEADBUTT dw -1 ; end SableyeEggMoves: dw FLATTER dw MOONLIGHT dw NASTY_PLOT dw PSYCH_UP dw RECOVER dw -1 ; end MawileEggMoves: dw ANCIENTPOWER dw FALSE_SWIPE dw FIRE_FANG dw ICE_FANG dw POISON_FANG dw PSYCH_UP dw PUNISHMENT dw SUCKER_PUNCH dw SWORDS_DANCE dw THUNDER_FANG dw TICKLE dw -1 ; end AronEggMoves: dw BODY_SLAM dw CURSE dw DRAGON_RUSH dw ENDEAVOR dw IRON_HEAD dw SCREECH dw SMELLINGSALT dw STOMP dw -1 ; end MedititeEggMoves: dw BATON_PASS dw BULLET_PUNCH dw DYNAMICPUNCH dw FAKE_OUT dw FIRE_PUNCH dw FORESIGHT dw GUARD_SWAP dw ICE_PUNCH dw POWER_SWAP dw PSYCHO_CUT dw THUNDERPUNCH dw -1 ; end ElectrikeEggMoves: dw CRUNCH dw CURSE dw DISCHARGE dw FIRE_FANG dw HEADBUTT dw ICE_FANG dw SWIFT dw THUNDER_FANG dw UPROAR dw -1 ; end PlusleEggMoves: dw SING dw SUBSTITUTE dw SWEET_KISS dw WISH dw -1 ; end MinunEggMoves: dw SING dw SUBSTITUTE dw SWEET_KISS dw WISH dw -1 ; end VolbeatEggMoves: dw BATON_PASS dw BUG_BUZZ dw ENCORE dw SILVER_WIND dw TRICK dw -1 ; end IllumiseEggMoves: dw BATON_PASS dw BUG_BUZZ dw ENCORE dw GROWTH dw SILVER_WIND dw -1 ; end RoseliaEggMoves: dw COTTON_SPORE dw EXTRASENSORY dw LEAF_STORM dw MIND_READER dw PIN_MISSILE dw RAZOR_LEAF dw SLEEP_POWDER dw SPIKES dw SYNTHESIS dw -1 ; end GulpinEggMoves: dw ACID_ARMOR dw CURSE dw DESTINY_BOND dw DREAM_EATER dw PAIN_SPLIT dw SMOG dw -1 ; end CarvanhaEggMoves: dw ANCIENTPOWER dw DOUBLE_EDGE dw HYDRO_PUMP dw THRASH dw -1 ; end WailmerEggMoves: dw BODY_SLAM dw CURSE dw DEFENSE_CURL dw DOUBLE_EDGE dw FISSURE dw SLEEP_TALK dw SNORE dw SWAGGER dw THRASH dw TICKLE dw -1 ; end NumelEggMoves: dw ANCIENTPOWER dw BODY_SLAM dw DEFENSE_CURL dw HEAT_WAVE dw HOWL dw MUD_BOMB dw ROLLOUT dw SCARY_FACE dw STOMP dw YAWN dw -1 ; end TorkoalEggMoves: dw EARTHQUAKE dw ENDURE dw ERUPTION dw FISSURE dw SLEEP_TALK dw YAWN dw -1 ; end SpoinkEggMoves: dw AMNESIA dw EXTRASENSORY dw FUTURE_SIGHT dw MIRROR_COAT dw SUBSTITUTE dw TRICK dw ZEN_HEADBUTT dw -1 ; end SpindaEggMoves: dw ASSIST dw BATON_PASS dw DISABLE dw ENCORE dw FAKE_OUT dw PSYCHO_CUT dw ROCK_SLIDE dw ROLE_PLAY dw SMELLINGSALT dw TRICK dw WISH dw -1 ; end TrapinchEggMoves: dw FLAIL dw FOCUS_ENERGY dw FURY_CUTTER dw GUST dw QUICK_ATTACK dw -1 ; end CacneaEggMoves: dw ACID_ARMOR dw COUNTER dw DYNAMICPUNCH dw GRASSWHISTLE dw LOW_KICK dw MAGICAL_LEAF dw SEED_BOMB dw SMELLINGSALT dw TEETER_DANCE dw -1 ; end SwabluEggMoves: dw AGILITY dw DRAGON_RUSH dw FEATHERDANCE dw HAZE dw PURSUIT dw RAGE dw -1 ; end ZangooseEggMoves: dw COUNTER dw CURSE dw DOUBLE_HIT dw DOUBLE_KICK dw FLAIL dw FURY_SWIPES dw METAL_CLAW dw NIGHT_SLASH dw RAZOR_WIND dw ROAR dw -1 ; end SeviperEggMoves: dw ASSURANCE dw BODY_SLAM dw NIGHT_SLASH dw SCARY_FACE dw SPIT_UP dw STOCKPILE dw SWALLOW dw -1 ; end BarboachEggMoves: dw FLAIL dw HYDRO_PUMP dw SPARK dw TAKE_DOWN dw THRASH dw WHIRLPOOL dw -1 ; end CorphishEggMoves: dw ANCIENTPOWER dw BODY_SLAM dw ENDEAVOR dw KNOCK_OFF dw METAL_CLAW dw MUD_SPORT dw SUPERPOWER dw -1 ; end BaltoyEggMoves: dw ANCIENTPOWER dw EARTH_POWER dw MUD_SLAP dw SIGNAL_BEAM dw SNORE dw TRICK dw ZEN_HEADBUTT dw -1 ; end LileepEggMoves: dw BARRIER dw MIRROR_COAT dw RECOVER dw ROCK_SLIDE dw TICKLE dw WRING_OUT dw -1 ; end AnorithEggMoves: dw CROSS_POISON dw KNOCK_OFF dw RAPID_SPIN dw ROCK_SLIDE dw SAND_ATTACK dw SCREECH dw SWORDS_DANCE dw -1 ; end FeebasEggMoves: dw CONFUSE_RAY dw DRAGONBREATH dw HAZE dw HYPNOSIS dw LIGHT_SCREEN dw MIRROR_COAT dw MIST dw MUD_SPORT dw TICKLE dw -1 ; end CastformEggMoves: dw AMNESIA dw DISABLE dw FUTURE_SIGHT dw LUCKY_CHANT dw OMINOUS_WIND dw PSYCH_UP dw -1 ; end KecleonEggMoves: dw DISABLE dw DIZZY_PUNCH dw FAKE_OUT dw MAGIC_COAT dw NASTY_PLOT dw TRICK dw -1 ; end ShuppetEggMoves: dw ASTONISH dw CONFUSE_RAY dw DESTINY_BOND dw DISABLE dw FORESIGHT dw IMPRISON dw PAYBACK dw PURSUIT dw SHADOW_SNEAK dw -1 ; end DuskullEggMoves: dw DESTINY_BOND dw FAINT_ATTACK dw GRUDGE dw IMPRISON dw MEMENTO dw OMINOUS_WIND dw PAIN_SPLIT dw -1 ; end TropiusEggMoves: dw CURSE dw HEADBUTT dw LEAF_BLADE dw LEAF_STORM dw LEECH_SEED dw NATURE_POWER dw RAZOR_WIND dw SLAM dw SYNTHESIS dw -1 ; end ChimechoEggMoves: dw CURSE dw DISABLE dw DREAM_EATER dw FUTURE_SIGHT dw HYPNOSIS dw RECOVER dw WISH dw -1 ; end AbsolEggMoves: dw ASSURANCE dw BATON_PASS dw CURSE dw DOUBLE_EDGE dw FAINT_ATTACK dw MAGIC_COAT dw ME_FIRST dw MEAN_LOOK dw PUNISHMENT dw SUBSTITUTE dw SUCKER_PUNCH dw ZEN_HEADBUTT dw -1 ; end SnoruntEggMoves: dw BIDE dw BLOCK dw DISABLE dw ROLLOUT dw SPIKES dw -1 ; end SphealEggMoves: dw CURSE dw FISSURE dw ROCK_SLIDE dw SIGNAL_BEAM dw SPIT_UP dw STOCKPILE dw SWALLOW dw SPIT_UP dw WATER_SPORT dw YAWN dw -1 ; end ClamperlEggMoves: dw AQUA_RING dw BARRIER dw BODY_SLAM dw CONFUSE_RAY dw MUD_SPORT dw REFRESH dw SUPERSONIC dw -1 ; end RelicanthEggMoves: dw AMNESIA dw AQUA_TAIL dw MAGNITUDE dw MUD_SLAP dw ROCK_SLIDE dw SKULL_BASH dw SLEEP_TALK dw SNORE dw WATER_SPORT dw -1 ; end LuvdiscEggMoves: dw AQUA_RING dw CAPTIVATE dw MUD_SPORT dw SPLASH dw SUPERSONIC dw WATER_SPORT dw -1 ; end BagonEggMoves: dw DRAGON_DANCE dw DRAGON_RAGE dw DRAGON_RUSH dw FIRE_FANG dw HYDRO_PUMP dw SHADOW_CLAW dw THRASH dw TWISTER dw -1 ; end NoEggMoves3: dw -1 ; end
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/remote_type.ads
best08618/asylo
7
7532
<gh_stars>1-10 with Ada.Streams; generic type Element_Type is private; package remote_type is pragma Remote_Types; type List is private; procedure Append (Container : in out List; New_Item : in Element_Type); private use Ada.Streams; type List_Record is record A : Boolean; end record; type List is access List_Record; procedure Read (S : access Root_Stream_Type'Class; L : out List); for List'Read use Read; procedure Write (S : access Root_Stream_Type'Class; L : in List); for List'Write use Write; end remote_type;
b3_oem_high_chars.asm
jedimatt42/tipicmd
5
87376
<reponame>jedimatt42/tipicmd<gh_stars>1-10 DEF PAT127 **************************************** * High Character Patterns **************************************** PAT127 DATA >0000,>1028,>4444,>7C00 ; PAT128 DATA >3844,>4040,>4438,>0818 ; PAT129 DATA >2800,>4444,>4C34,>0000 ; PAT130 DATA >0810,>3844,>7C40,>3800 ; PAT131 DATA >1028,>0038,>444C,>3400 ; PAT132 DATA >0028,>0038,>444C,>3400 ; PAT133 DATA >2010,>0038,>444C,>3400 ; PAT134 DATA >1028,>1038,>444C,>3400 ; PAT135 DATA >0038,>4440,>4438,>0818 ; PAT136 DATA >1028,>0038,>447C,>4038 ; PAT137 DATA >2800,>3844,>7C40,>3800 ; PAT138 DATA >2010,>0038,>447C,>4038 ; PAT139 DATA >0028,>0030,>1038,>0000 ; PAT140 DATA >1028,>0030,>1038,>0000 ; PAT141 DATA >2010,>0030,>1038,>0000 ; PAT142 DATA >2800,>3844,>7C44,>4400 ; PAT143 DATA >1028,>1038,>447C,>4444 ; PAT144 DATA >0810,>007C,>4078,>407C ; PAT145 DATA >0000,>6814,>3850,>2C00 ; PAT146 DATA >3C50,>507C,>5050,>5C00 ; PAT147 DATA >1028,>0038,>4444,>3800 ; PAT148 DATA >0028,>0038,>4444,>3800 ; PAT149 DATA >2010,>0038,>4444,>3800 ; PAT150 DATA >1028,>0044,>444C,>3400 ; PAT151 DATA >2010,>0044,>444C,>3400 ; PAT152 DATA >0028,>0044,>4438,>0870 ; PAT153 DATA >2838,>4444,>4444,>3800 ; PAT154 DATA >2800,>4444,>4444,>3800 ; PAT155 DATA >0010,>3C50,>503C,>1000 ; PAT156 DATA >1820,>2070,>2020,>7C00 ; PAT157 DATA >4444,>287C,>107C,>1000 ; PAT158 DATA >0068,>5C58,>7C54,>5C00 ; PAT159 DATA >0408,>1C08,>0808,>1000 ; PAT160 DATA >0810,>0038,>444C,>3400 ; PAT161 DATA >0810,>0030,>1038,>0000 ; PAT162 DATA >0810,>0038,>4444,>3800 ; PAT163 DATA >0810,>0044,>444C,>3400 ; PAT164 DATA >2458,>0058,>6444,>4444 ; PAT165 DATA >2458,>0044,>6454,>4C44 ; PAT166 DATA >3844,>4C34,>007C,>0000 ; PAT167 DATA >3844,>4438,>007C,>0000 ; PAT168 DATA >1000,>1020,>4044,>3800 ; PAT169 DATA >0000,>0000,>FC80,>0000 ; PAT170 DATA >0000,>0000,>FC04,>0000 ; PAT171 DATA >4050,>2058,>040C,>101C ; PAT172 DATA >4050,>2054,>141C,>0404 ; PAT173 DATA >0010,>0010,>1010,>1000 ; PAT174 DATA >0000,>0024,>4824,>0000 ; PAT175 DATA >0000,>0048,>2448,>0000 ; PAT176 DATA >0054,>00A8,>0054,>00A8 ; PAT177 DATA >54A8,>54A8,>54A8,>54A8 ; PAT178 DATA >FCA8,>FC54,>FCA8,>FC54 ; PAT179 DATA >2020,>2020,>2020,>2020 ; PAT180 DATA >2020,>2020,>E020,>2020 ; PAT181 DATA >2020,>E020,>E020,>2020 ; PAT182 DATA >2828,>2828,>E828,>2828 ; PAT183 DATA >0000,>0000,>F828,>2828 ; PAT184 DATA >0000,>E020,>E020,>2020 ; PAT185 DATA >2828,>E808,>E828,>2828 ; PAT186 DATA >2828,>2828,>2828,>2828 ; PAT187 DATA >0000,>F808,>E828,>2828 ; PAT188 DATA >2828,>E808,>F800,>0000 ; PAT189 DATA >2828,>2828,>F800,>0000 ; PAT190 DATA >2020,>E020,>E000,>0000 ; PAT191 DATA >0000,>0000,>E020,>2020 ; PAT192 DATA >2020,>2020,>3C00,>0000 ; PAT193 DATA >2020,>2020,>FC00,>0000 ; PAT194 DATA >0000,>0000,>FC20,>2020 ; PAT195 DATA >2020,>2020,>3C20,>2020 ; PAT196 DATA >0000,>0000,>FC00,>0000 ; PAT197 DATA >2020,>2020,>FC20,>2020 ; PAT198 DATA >2020,>3C20,>3C20,>2020 ; PAT199 DATA >2828,>2828,>2C28,>2828 ; PAT200 DATA >2828,>2C20,>3C00,>0000 ; PAT201 DATA >0000,>3C20,>2C28,>2828 ; PAT202 DATA >2828,>EC00,>FC00,>0000 ; PAT203 DATA >0000,>FC00,>EC28,>2828 ; PAT204 DATA >2828,>2C20,>2C28,>2828 ; PAT205 DATA >0000,>FC00,>FC00,>0000 ; PAT206 DATA >2828,>EC00,>EC28,>2828 ; PAT207 DATA >2020,>FC00,>FC00,>0000 ; PAT208 DATA >2828,>2828,>FC00,>0000 ; PAT209 DATA >0000,>FC00,>FC20,>2020 ; PAT210 DATA >0000,>0000,>FC28,>2828 ; PAT211 DATA >2828,>2828,>3C00,>0000 ; PAT212 DATA >2020,>3C20,>3C00,>0000 ; PAT213 DATA >0000,>3C20,>3C20,>2020 ; PAT214 DATA >0000,>0000,>3C28,>2828 ; PAT215 DATA >2828,>2828,>FC28,>2828 ; PAT216 DATA >2020,>FC20,>FC20,>2020 ; PAT217 DATA >2020,>2020,>E000,>0000 ; PAT218 DATA >0000,>0000,>3C20,>2020 ; PAT219 DATA >FCFC,>FCFC,>FCFC,>FCFC ; PAT220 DATA >0000,>0000,>FCFC,>FCFC ; PAT221 DATA >E0E0,>E0E0,>E0E0,>E0E0 ; PAT222 DATA >1C1C,>1C1C,>1C1C,>1C1C ; PAT223 DATA >FCFC,>FCFC,>0000,>0000 ; PAT224 DATA >0000,>344C,>484C,>3400 ; PAT225 DATA >3048,>4870,>4844,>5800 ; PAT226 DATA >0078,>4040,>4040,>4000 ; PAT227 DATA >0000,>7C28,>2828,>2400 ; PAT228 DATA >7C44,>2010,>2044,>7C00 ; PAT229 DATA >001C,>2824,>2418,>0000 ; PAT230 DATA >0048,>4848,>4874,>4000 ; PAT231 DATA >0000,>7C10,>1010,>0800 ; PAT232 DATA >3810,>3854,>5438,>1038 ; PAT233 DATA >3844,>445C,>4444,>3800 ; PAT234 DATA >0038,>4444,>4428,>6C00 ; PAT235 DATA >3040,>3844,>4444,>3800 ; PAT236 DATA >0000,>2854,>5428,>0000 ; PAT237 DATA >0008,>5454,>5438,>1000 ; PAT238 DATA >3844,>4020,>4044,>3800 ; PAT239 DATA >0038,>4444,>4444,>4400 ; PAT240 DATA >007C,>007C,>007C,>0000 ; PAT241 DATA >0010,>3810,>0038,>0000 ; PAT242 DATA >0030,>0830,>0038,>0000 ; PAT243 DATA >0018,>2018,>0038,>0000 ; PAT244 DATA >1028,>2020,>2020,>2000 ; PAT245 DATA >1028,>0808,>0808,>0800 ; PAT246 DATA >0010,>0038,>0010,>0000 ; PAT247 DATA >0000,>5824,>0058,>2400 ; PAT248 DATA >0020,>5020,>0000,>0000 ; PAT249 DATA >0020,>7020,>0000,>0000 ; PAT250 DATA >0030,>3000,>0000,>0000 ; PAT251 DATA >0404,>0408,>6828,>1000 ; PAT252 DATA >0060,>5050,>0000,>0000 ; PAT253 DATA >6010,>2070,>0000,>0000 ; PAT254 DATA >0000,>F8F8,>F8F8,>0000 ; PAT255 DATA >0000,>0000,>0000,>0000 ;
programs/oeis/147/A147875.asm
karttu/loda
1
242904
; A147875: Second heptagonal numbers: a(n) = n*(5*n+3)/2. ; 0,4,13,27,46,70,99,133,172,216,265,319,378,442,511,585,664,748,837,931,1030,1134,1243,1357,1476,1600,1729,1863,2002,2146,2295,2449,2608,2772,2941,3115,3294,3478,3667,3861,4060,4264,4473,4687,4906,5130,5359,5593,5832,6076,6325,6579,6838,7102,7371,7645,7924,8208,8497,8791,9090,9394,9703,10017,10336,10660,10989,11323,11662,12006,12355,12709,13068,13432,13801,14175,14554,14938,15327,15721,16120,16524,16933,17347,17766,18190,18619,19053,19492,19936,20385,20839,21298,21762,22231,22705,23184,23668,24157,24651,25150,25654,26163,26677,27196,27720,28249,28783,29322,29866,30415,30969,31528,32092,32661,33235,33814,34398,34987,35581,36180,36784,37393,38007,38626,39250,39879,40513,41152,41796,42445,43099,43758,44422,45091,45765,46444,47128,47817,48511,49210,49914,50623,51337,52056,52780,53509,54243,54982,55726,56475,57229,57988,58752,59521,60295,61074,61858,62647,63441,64240,65044,65853,66667,67486,68310,69139,69973,70812,71656,72505,73359,74218,75082,75951,76825,77704,78588,79477,80371,81270,82174,83083,83997,84916,85840,86769,87703,88642,89586,90535,91489,92448,93412,94381,95355,96334,97318,98307,99301,100300,101304,102313,103327,104346,105370,106399,107433,108472,109516,110565,111619,112678,113742,114811,115885,116964,118048,119137,120231,121330,122434,123543,124657,125776,126900,128029,129163,130302,131446,132595,133749,134908,136072,137241,138415,139594,140778,141967,143161,144360,145564,146773,147987,149206,150430,151659,152893,154132,155376 mov $1,$0 mul $1,10 add $1,3 pow $1,2 div $1,40
cmd/adddrv/hardint.asm
minblock/msdos
0
102392
title HARDWARE INTERRAPT DISABLE/ENABLE name hardint page 53, 132 ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;*********************************************************************** ; HARDINT.ASM ; ; Hardware interrapt disable and enable function. ; ; _intdisable ; hardware interrapt disable. ; ; _intenable ; hardware interrapt enable. ; ;----------------------------------------------------------------------- ; Modification history ;----------------------------------------------------------------------- ; MSKK00 July 20, 1987 akitok ; Make out. ;----------------------------------------------------------------------- .xlist include cmacros.inc .list sBegin code assumes cs,code ;*********************************************************************** ; void intdisable(void); ; disable hardware interrapt. ; ; input : ; none. ; ; output : ; none. ; ;*********************************************************************** cProc intdisable, <PUBLIC> cBegin cli ; interrapt disable. cEnd ;*********************************************************************** ; void intenable(void); ; enable hardware interrapt. ; ; input : ; none. ; ; output : ; none. ; ;*********************************************************************** cProc intenable, <PUBLIC> cBegin sti ; interrapt enable. cEnd sEnd code end 
Task/Conditional-structures/Ada/conditional-structures-3.ada
LaudateCorpus1/RosettaCodeData
1
28115
<reponame>LaudateCorpus1/RosettaCodeData case Today is when Monday => Compute_Starting_Balance; when Friday => Compute_Ending_Balance; when Tuesday .. Thursday => Accumulate_Sales; -- ignore Saturday and Sunday end case;
assign3/assign3a/assign3a.asm
Andrew-Slade/Assembler
0
241947
<gh_stars>0 //KC03H99A JOB ,'<NAME>',MSGCLASS=H 00010004 //JSTEP01 EXEC PGM=ASSIST 00020004 //STEPLIB DD DSN=KC00NIU.ASSIST.LOADLIB,DISP=SHR 00030004 //SYSPRINT DD SYSOUT=* 00040004 //SYSIN DD * 00050004 *************************************************** 00060004 * ASSIGNMENT 3 - BASIC ASSEMBLY PROGRAM * 00070004 * * 00080004 * DATE DUE: 09/15/2017 * 00090013 *************************************************** 00100013 *PROCEDURE * 00110016 * * * 00120013 *1 LOAD 15 INTO REGISTER 2 * 00121013 *2 LOAD 7 INTO REGISTER 3 * 00122013 *3 SUBTRACT REGISTER 3 FROM R2 * 00123013 *4 DUMP REGISTERS * 00124013 *5 DEFINE NUM1 AS A FULLWORD OF 15 * 00126014 *6 DEFINE NUM2 AS A FULLWORD OF 7 * 00127014 *7 BREAK TO OS * 00128014 *************************************************** 00130004 ASSIGN3A CSECT 00140012 * 00141016 USING ASSIGN3A,15 ESTABLISH ADDRESSABILITY 00150012 * 00160016 L 2,NUM1 LOAD R2 WITH 15 00180018 L 3,NUM2 LOAD R3 WITH 7 00190018 SR 2,3 SUBTRACT R3 FROM R2 00200011 XDUMP 00210020 * 00211016 BR 14 RETURN TO CALLER 00220011 * 00221014 LTORG 00222015 NUM1 DC F'15' DEFINE FULLWORD OF 15 00230011 NUM2 DC F'7' DEFINE FULLWORD OF 7 00240011 * 00241016 END ASSIGN3A 00250012 /* 00260004 // 00270004
programs/oeis/339/A339255.asm
jmorken/loda
1
242135
<reponame>jmorken/loda ; A339255: Leading digit of n in base 5. ; 1,2,3,4,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2 add $0,1 lpb $0,$0 div $0,5 lpe mov $1,$0
programs/oeis/298/A298790.asm
neoneye/loda
22
101165
; A298790: Partial sums of A298788. ; 1,4,11,23,36,53,77,100,127,163,196,233,281,324,371,431,484,541,613,676,743,827,900,977,1073,1156,1243,1351,1444,1541,1661,1764,1871,2003,2116,2233,2377,2500,2627,2783,2916,3053,3221,3364,3511,3691,3844,4001,4193,4356,4523,4727,4900,5077,5293,5476,5663,5891,6084,6281,6521,6724,6931,7183,7396,7613,7877,8100,8327,8603,8836,9073,9361,9604,9851,10151,10404,10661,10973,11236,11503,11827,12100,12377,12713,12996,13283,13631,13924,14221,14581,14884,15191,15563,15876,16193,16577,16900,17227,17623 mov $5,$0 mul $5,7 div $5,3 mov $3,$5 pow $3,2 mov $1,$3 div $1,7 add $1,1 mov $2,$0 mul $2,2 add $1,$2 mov $4,$0 mul $4,$0 add $1,$4 mov $0,$1
src/main/antlr/io/georocket/index/Tags.g4
tobias93/georocket
0
4819
grammar Tags; @header { package io.georocket.index; import org.apache.commons.text.StringEscapeUtils; import io.georocket.query.ThrowingErrorListener; } @members { public static java.util.List<String> parse(String tags) { TagsLexer lexer = new TagsLexer(CharStreams.fromString(tags.trim())); lexer.removeErrorListeners(); lexer.addErrorListener(new ThrowingErrorListener()); CommonTokenStream tokens = new CommonTokenStream(lexer); TagsParser parser = new TagsParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(new ThrowingErrorListener()); return parser.tags().result; } } tags returns [java.util.List<String> result] @init { $result = new java.util.ArrayList<String>(); } : a=string { $result.add($a.result); } ( ',' b=string { $result.add($b.result); } )* EOF ; string returns [String result] : QUOTED_STRING { $result = $QUOTED_STRING.text; } | STRING { $result = $STRING.text; } ; QUOTED_STRING : ( '"' ( '\\"' | ~('\n'|'\r') )*? '"' | '\'' ( '\\\'' | ~('\n'|'\r') )*? '\'' ) { String s = getText(); s = s.substring(1, s.length() - 1); s = StringEscapeUtils.unescapeJava(s); setText(s); } ; STRING : ~[ ,:\n\r"']+ ;
programs/oeis/173/A173196.asm
karttu/loda
1
13166
; A173196: Partial sums of A002620. ; 0,0,1,3,7,13,22,34,50,70,95,125,161,203,252,308,372,444,525,615,715,825,946,1078,1222,1378,1547,1729,1925,2135,2360,2600,2856,3128,3417,3723,4047,4389,4750,5130,5530,5950,6391,6853,7337,7843,8372,8924,9500,10100,10725,11375,12051,12753,13482,14238,15022,15834,16675,17545,18445,19375,20336,21328,22352,23408,24497,25619,26775,27965,29190,30450,31746,33078,34447,35853,37297,38779,40300,41860,43460,45100,46781,48503,50267,52073,53922,55814,57750,59730,61755,63825,65941,68103,70312,72568,74872,77224,79625,82075,84575,87125,89726,92378,95082,97838,100647,103509,106425,109395,112420,115500,118636,121828,125077,128383,131747,135169,138650,142190,145790,149450,153171,156953,160797,164703,168672,172704,176800,180960,185185,189475,193831,198253,202742,207298,211922,216614,221375,226205,231105,236075,241116,246228,251412,256668,261997,267399,272875,278425,284050,289750,295526,301378,307307,313313,319397,325559,331800,338120,344520,351000,357561,364203,370927,377733,384622,391594,398650,405790,413015,420325,427721,435203,442772,450428,458172,466004,473925,481935,490035,498225,506506,514878,523342,531898,540547,549289,558125,567055,576080,585200,594416,603728,613137,622643,632247,641949,651750,661650,671650,681750,691951,702253,712657,723163,733772,744484,755300,766220,777245,788375,799611,810953,822402,833958,845622,857394,869275,881265,893365,905575,917896,930328,942872,955528,968297,981179,994175,1007285,1020510,1033850,1047306,1060878,1074567,1088373,1102297,1116339,1130500,1144780,1159180,1173700,1188341,1203103,1217987,1232993,1248122,1263374,1278750,1294250 mov $3,$0 pow $0,2 trn $1,$3 add $1,$3 mul $1,2 mov $2,$3 add $2,$0 sub $2,1 mul $1,$2 add $1,$0 div $1,24
awa/plugins/awa-wikis/regtests/awa-wikis-modules-tests.ads
fuzzysloth/ada-awa
81
15895
----------------------------------------------------------------------- -- awa-wikis-modules-tests -- Unit tests for wikis service -- Copyright (C) 2015, 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with AWA.Tests; with ADO; package AWA.Wikis.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Wikis.Modules.Wiki_Module_Access; Wiki_Id : ADO.Identifier := ADO.NO_IDENTIFIER; Public_Id : ADO.Identifier := ADO.NO_IDENTIFIER; Private_Id : ADO.Identifier := ADO.NO_IDENTIFIER; end record; -- Test creation of a wiki space. procedure Test_Create_Wiki_Space (T : in out Test); -- Test creation of a wiki page. procedure Test_Create_Wiki_Page (T : in out Test); -- Test creation of a wiki page content. procedure Test_Create_Wiki_Content (T : in out Test); -- Test getting the wiki page as well as info, history pages. procedure Test_Wiki_Page (T : in out Test); -- Test updating the wiki page through a POST request. procedure Test_Update_Page (T : in out Test); end AWA.Wikis.Modules.Tests;
java-ws-template/src/main/antlr4/odata/antlr/ODataLexer.g4
luca-vercelli/java-web-template
0
7683
/* * This is the lexer grammar of OData (please see ODataParser.g4 * for more details). * The used dialect/metalanguage is documented at http://antlr.org/ * This will all change in the near future, so please do not build * a house on it ;-) * The plan is to collect here the character base and signalling * tokens that somehow form the words of the OData vocabulary. * These notes will be replaced when the code will be released. * * Contact: <NAME> <<EMAIL>> */ lexer grammar ODataLexer; HexLiteral : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ; DecimalLiteral : (SIGN)? ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ; OctalLiteral : '0' ('0'..'7')+ IntegerTypeSuffix? ; fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ; fragment IntegerTypeSuffix : ('l'|'L') ; FloatingPointLiteral : (SIGN)? ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix? | (SIGN)? '.' ('0'..'9')+ Exponent? FloatTypeSuffix? | (SIGN)? ('0'..'9')+ Exponent FloatTypeSuffix? | (SIGN)? ('0'..'9')+ FloatTypeSuffix ; fragment Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; fragment FloatTypeSuffix : ('f'|'F'|'d'|'D') ; ////////////////////////////////////////////////////////////// StringLiteral : '\'' ( EscapeSequence | ~('\''|'\\') )* '\'' ; fragment EscapeSequence : '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\') | UnicodeEscape | OctalEscape ; fragment OctalEscape : '\\' ('0'..'3') ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ; fragment UnicodeEscape : '\\' 'u' HexDigit HexDigit HexDigit HexDigit ; ////////////////////////////////////////////////////////////// WS : (' '|'\r'|'\t'|'\u000C'|'\n') -> skip ; SQ : [']; DQ : '\u0022'; SP : '\u0020'; HTAB : '\u0009'; CR : '\u000D'; LF : '\u000A'; SEMI : [;]; COMMA : [,]; EQ : [=]; DOLLAR : '$'; PLUS : [+]; MINUS : [-]; SIGN : (PLUS | MINUS); AMPERSAND : [&]; OP : '('; CP : ')'; OB : '['; CB : ']'; OC : '{'; CC : '}'; TILDE : '~'; STAR : [*]; ESCAPE : [\u005C]; // reverse solidus U+005C SLASH : '/'; DOT : '.'; COLON : ':'; PERCENT : '%'; AT_SIGN : '@'; EXCLAMATION : '!'; QUESTION : '?'; UNDERSCORE : '_'; A : [Aa] ; B : [Bb] ; C : [Cc] ; D : [Dd] ; E : [Ee] ; F : [Ff] ; G : [Gg] ; H : [Hh] ; I : [Ii] ; L : [Ll] ; M : [Mm] ; N : [Nn] ; O : [Oo] ; P : [Pp] ; R : [Rr] ; S : [Ss] ; T : [Tt] ; U : [Uu] ; Y : [Yy] ; ZERO : '0' ; ONE : '1' ; TWO: '2' ; THREE: '3' ; // ColCol : COLON COLON ; // ColSlaSla : COLON SLASH SLASH ; // HttpOrHttpsAnyCase : H T T P ( S )? ; Binary_LAC : B I N A R Y ; True_LAC : T R U E ; False_LAC : F A L S E ; DateTimeOffset_LAC: Date_LAC Time_LAC O F F S E T ; Duration_LAC : D U R A T I O N ; TimeOfDay_LAC : Time_LAC O F D A Y ; Date_LAC : D A T E ; Time_LAC : T I M E ; MultiLineStringOP_LAC : Multi_LAC LineString_LAC OP ; LineString_LAC : L I N E S T R I N G ; MultiPointOP_LAC : Multi_LAC P O I N T OP ; MultiPolygonOP_LAC : Multi_LAC Polygon_LAC OP ; Point_LAC : P O I N T ; Geography_LAC: G E O G R A P H Y ; Geometry_LAC : G E O M E T R Y ; Polygon_LAC : P O L Y G O N ; Multi_LAC : M U L T I ; CollectionOP_LAC : C O L L E C T I O N OP ; GUID_LAC : G U I D ; SRID_LAC : S R I D ; I64_POSTFIX : L; DollarMETADATA : DOLLAR 'metadata' ; DollarBATCH : DOLLAR 'batch' ; DollarSKIPTOKEN : DOLLAR 'skiptoken' ; DollarCOUNT : SLASH DOLLAR 'count' ; DollarLINKS : SLASH DOLLAR 'links' ; DollarVALUE : SLASH DOLLAR 'value' ; DollarREF : DOLLAR 'ref'; DollarAPPLY : DOLLAR 'apply' ; DollarEXPAND : DOLLAR 'expand' ; DollarLEVELS : DOLLAR 'levels' ; DollarFILTER : DOLLAR 'filter' ; DollarORDERBY : DOLLAR 'orderby' ; DollarSKIP : DOLLAR 'skip' ; DollarTOP : DOLLAR 'top' ; DollarFORMAT : DOLLAR 'format' ; DollarINLINECOUNT : DOLLAR 'inlinecount' ; DollarSELECT : DOLLAR 'select' ; DollarROOT : DOLLAR 'root' ; DollarIT : DOLLAR 'it' ; AtomToken : 'atom' ; JsonToken : 'json' ; XmlToken : 'xml' ; AllToken : 'all' ; AllPagesToken : AllToken 'pages' ; NoneToken : 'none' ; AscToken : 'asc' ; DescToken : 'desc' ; SumToken : 'sum' ; MinToken : 'min' ; MaxToken : 'max' ; AverageToken : 'average' ; AnyToken: 'any' ; AsToken : 'as' ; SubStringOfToken : 'substringof' ; StartsWithToken : 'startswith' ; EndsWithToken : 'endswith' ; LengthToken : 'length' ; IndexOfToken : 'indexof' ; SubstringToken : 'substring' ; ContainsToken : 'contains' ; ToLowerToken : 'tolower' ; ToUpperToken : 'toupper' ; TrimToken : 'trim' ; ConcatToken : 'concat' ; // this is both a function and an aggregate function YearToken : 'year' ; MonthToken : 'month' ; DayToken : 'day' ; DaysToken : 'days' ; HourToken : 'hour' ; HoursToken : HourToken 's' ; MinuteToken : 'minute' ; MinutesToken : MinuteToken 's' ; SecondToken : 'second' ; SecondsToken : SecondToken 's' ; DateToken : 'date' ; TimeToken : 'time' ; RoundToken : 'round' ; FloorToken : 'floor' ; CeilingToken : 'ceiling' ; FractionalSecondsToken : 'fractionalseconds' ; //new in v4 TotalOffsetMinutesToken : 'gettotaloffsetminutes' | 'totaloffsetminutes' ; //new in v4 GeoDotDistanceToken : 'geo.distance' ; GeoLengthToken : 'geo.length' ; GeoDotIntersectsToken : 'geo.intersects' ; MinDateTimeToken : 'mindatetime' ; MaxDateTimeToken : 'maxdatetime' ; NowToken : 'now' ; // -- AndToken : 'and' ; OrToken : 'or' ; EqToken : 'eq' ; NeToken : 'ne' ; LtToken : 'lt' ; LeToken : 'le' ; GtToken : 'gt' ; GeToken : 'ge' ; HasToken : 'has' ; AddToken : 'add' ; SubToken : 'sub' ; MulToken : 'mul' ; DivToken : 'div' ; ModToken : 'mod' ; NotToken : 'not' ; IsOfToken : 'isof' ; CastToken : 'cast' ; // Aggregate extension of OData AggregateToken : 'aggregate' ; GroupByToken : 'groupby' ; TopCountToken : 'topcount' ; TopSumToken : 'topsum' ; TopPercentToken : 'toppercent' ; BottomCountToken : 'bottomcount' ; BottomSumToken : 'bottomsum' ; BottomPercentToken : 'bottompercent' ; IdentityToken : 'identity' ; FilterToken : 'filter' ; ExpandToken : 'expand' ; //see ConcatToken // -- // _LUC means "uppercase" All_LUC : 'ALL' ; D_LUC : 'D'; H_LUC : 'H'; M_LUC : 'M'; P_LUC : 'P'; S_LUC : 'S'; T_LUC : 'T'; X_LUC : 'X'; Z_LUC : 'Z'; BToken : 'b'; FToken : 'f'; NToken : 'n'; RToken : 'r'; TToken : 't'; VToken : 'v'; UToken : 'u'; NotANumber_LXC : 'NaN' ; Infinity_LUC : 'INF' ; NullToken : 'null' ; TrueToken : 'true' ; FalseToken : 'false' ; // EmptyString : '' ; // danger will robinson ! FIXME // refactor below: ONE_TO_TWO : [1-2]; ONE_TO_THREE : ONE_TO_TWO | [3]; ONE_TO_FOUR : ONE_TO_THREE | [4]; ONE_TO_NINE : ONE_TO_FOUR | [5-9]; ZERO_TO_ONE : [0-1]; ZERO_TO_TWO : ZERO_TO_ONE | [2]; ZERO_TO_THREE : ZERO_TO_TWO | [3]; ZERO_TO_FOUR : ZERO_TO_THREE | [4]; ZERO_TO_FIVE : ZERO_TO_FOUR | [5]; ZERO_TO_FIFTY_NINE : ZERO_TO_FIVE Digit; ONEHUNDRED_TO_ONEHUNDREDNINETYNINE : '1' Digit Digit; // 100-199 TWOHUNDRED_TO_TWOHUNDREDFOURTYNINE : '2' ZERO_TO_FOUR Digit; // 200-249 TWOHUNDREDFIFTY_TO_TWOHUNDREDFIFTYFIVE : '25' ZERO_TO_FIVE; // 250-255 TEN_TO_NINETYNINE : ONE_TO_NINE Digit; // 10-99 DIGIT3: Digit Digit Digit; DIGIT5 : DIGIT3 Digit Digit; DIGIT10 : DIGIT5 DIGIT5; DIGIT19 : DIGIT10 DIGIT5 DIGIT3 Digit; HEXDIG1 : HexDigit ; HEXDIG2 : HEXDIG1 HEXDIG1 ; HEXDIG4 : HEXDIG2 HEXDIG2 ; HEXDIG8 : HEXDIG4 HEXDIG4 ; HEXDIG12 : HEXDIG8 HEXDIG4 ; // Below is my personal bug ;-) H16 : HEXDIG1 | HEXDIG2 | HEXDIG2 HEXDIG1 | HEXDIG4 ; //1*4HEXDIG from ABNF H16Col : H16 COLON ; // Punctuation resolved: Unencoded : DQ | ESCAPE | UnencodedNoSpecial; UnencodedNoSpecial : SP | COLON | OC | CC | OB | CB ; // COMMENT_ANTLR: Heavy hacks, since ABNF grammars' BWS/OWS may match the empty string XWS : SP | HTAB ; // "required" whitespace VWS : CR | LF | XWS ; // "bad" vertical whitespace // COMMENT_ANTLR4: ( XWS )* is OWS when considered bad (from context) identical as lexer rules so: // COMMENT_ANTLR4_CONT: ... OWS (otherwise not referenced has been renamed to BWS OdataIdentifier : ( Alpha | UNDERSCORE ) ( Alpha | Digit | UNDERSCORE )*; ParameterAlias : AT_SIGN ( Alpha | Digit | UNDERSCORE )* ; Alpha : [a-zA-Z]; Digit : [0-9];
out/sort.adb
FardaleM/metalang
22
12135
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure sort is type stringptr is access all char_array; procedure PString(s : stringptr) is begin String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all)); end; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; procedure SkipSpaces is C : Character; Eol : Boolean; begin loop Look_Ahead(C, Eol); exit when Eol or C /= ' '; Get(C); end loop; end; type a is Array (Integer range <>) of Integer; type a_PTR is access a; function copytab(tab : in a_PTR; len : in Integer) return a_PTR is o : a_PTR; begin o := new a (0..len - 1); for i in integer range 0..len - 1 loop o(i) := tab(i); end loop; return o; end; procedure bubblesort(tab : in a_PTR; len : in Integer) is tmp : Integer; begin for i in integer range 0..len - 1 loop for j in integer range i + 1..len - 1 loop if tab(i) > tab(j) then tmp := tab(i); tab(i) := tab(j); tab(j) := tmp; end if; end loop; end loop; end; procedure qsort0(tab : in a_PTR; len : in Integer; b : in Integer; c : in Integer) is tmp : Integer; j0 : Integer; j : Integer; i0 : Integer; i : Integer; begin i := b; j := c; if i < j then i0 := i; j0 := j; -- pivot : tab[0] while i /= j loop if tab(i) > tab(j) then if i = j - 1 then -- on inverse simplement tmp := tab(i); tab(i) := tab(j); tab(j) := tmp; i := i + 1; else -- on place tab[i+1] à la place de tab[j], tab[j] à la place de tab[i] et tab[i] à la place de tab[i+1] tmp := tab(i); tab(i) := tab(j); tab(j) := tab(i + 1); tab(i + 1) := tmp; i := i + 1; end if; else j := j - 1; end if; end loop; qsort0(tab, len, i0, i - 1); qsort0(tab, len, i + 1, j0); end if; end; tmp : Integer; tab3 : a_PTR; tab2 : a_PTR; tab : a_PTR; len : Integer; begin len := 2; Get(len); SkipSpaces; tab := new a (0..len - 1); for i_0 in integer range 0..len - 1 loop tmp := 0; Get(tmp); SkipSpaces; tab(i_0) := tmp; end loop; tab2 := copytab(tab, len); bubblesort(tab2, len); for i in integer range 0..len - 1 loop PInt(tab2(i)); PString(new char_array'( To_C(" "))); end loop; PString(new char_array'( To_C("" & Character'Val(10)))); tab3 := copytab(tab, len); qsort0(tab3, len, 0, len - 1); for i in integer range 0..len - 1 loop PInt(tab3(i)); PString(new char_array'( To_C(" "))); end loop; PString(new char_array'( To_C("" & Character'Val(10)))); end;
power-set-algebra/powerset.agda
heades/AUGL
0
11021
<reponame>heades/AUGL module powerset where open import level open import list open import bool open import product open import empty open import unit open import sum open import eq open import functions renaming (id to id-set) public -- Extensionality will be used when proving equivalences of morphisms. postulate ext-set : ∀{l1 l2 : level} → extensionality {l1} {l2} -- These are isomorphisms, but Agda has no way to prove these as -- equivalences. They are consistent to adopt as equivalences by -- univalence: postulate ⊎-unit-r : ∀{X : Set} → (X ⊎ ⊥) ≡ X postulate ⊎-unit-l : ∀{X : Set} → (⊥ ⊎ X) ≡ X postulate ∧-unit : ∀{ℓ}{A : Set ℓ} → A ≡ ((⊤ {ℓ}) ∧ A) postulate ∧-sym : ∀{ℓ}{A B : Set ℓ} → (A ∧ B) ≡ (B ∧ A) postulate ∧-unit-r : ∀{ℓ}{A : Set ℓ} → A ≡ (A ∧ (⊤ {ℓ})) postulate ∧-assoc : ∀{ℓ}{A B C : Set ℓ} → (A ∧ (B ∧ C)) ≡ ((A ∧ B) ∧ C) ℙ : {X : Set} → (X → 𝔹) → Set ℙ {X} S = (X → 𝔹) → 𝔹 _∪_ : {X : Set}{S : X → 𝔹} → ℙ S → ℙ S → ℙ S (s₁ ∪ s₂) x = (s₁ x) || (s₂ x) _∩_ : {X : Set}{S : X → 𝔹} → ℙ S → ℙ S → ℙ S (s₁ ∩ s₂) x = (s₁ x) && (s₂ x) _×S_ : {X Y : Set} → (S₁ : X → 𝔹) → (S₂ : Y → 𝔹) → (X × Y) → 𝔹 _×S_ S₁ S₂ (a , b) = (S₁ a) && (S₂ b) π₁ : ∀{X Y : Set} → ((Σ X (λ x → Y) → 𝔹) → 𝔹) → ((X → 𝔹) → 𝔹) π₁ P S = P (λ x → S (fst x)) π₂ : ∀{X Y : Set} → ((Σ X (λ x → Y) → 𝔹) → 𝔹) → ((Y → 𝔹) → 𝔹) π₂ P S = P (λ x → S (snd x)) i₁ : {X Y : Set}{S₁ : X → 𝔹}{S₂ : Y → 𝔹} → ℙ S₁ → (((X × Y) → 𝔹) → 𝔹) i₁ {X}{Y}{S₁}{S₂} P S = {!!} i₂ : {X Y : Set}{S₁ : X → 𝔹}{S₂ : Y → 𝔹} → ℙ S₂ → ℙ (S₁ ×S S₂) i₂ {X}{Y}{S₁}{S₂} P _ = P S₂ cp-ar : {X Y Z : Set}{S₁ : X → 𝔹}{S₂ : Y → 𝔹}{S₃ : Z → 𝔹} → (ℙ S₁ → ℙ S₃) → (ℙ S₂ → ℙ S₃) → ℙ (S₁ ×S S₂) → ℙ S₃ cp-ar {X}{Y}{Z}{S₁}{S₂}{S₃} f g P S = (f (π₁ P) S) || (g (π₂ P) S) cp-diag₁ : {X Y Z : Set}{S₁ : X → 𝔹}{S₂ : Y → 𝔹}{S₃ : Z → 𝔹}{f : ℙ S₁ → ℙ S₃}{g : ℙ S₂ → ℙ S₃} → cp-ar {X}{Y}{Z}{S₁}{S₂}{S₃ = S₃} f g ∘ (i₁ {X}{Y}{S₁}{S₂}) ≡ f cp-diag₁ {X}{Y}{Z}{S₁}{S₂}{S₃}{f}{g} = ext-set (λ {x} → ext-set (λ {S} → {!!})) -- cp-diag₂ : {X Y Z : Set}{f : Z → X}{g : Z → Y} → cp-ar f g ∘ i₂ ≡ ℙₐ g -- cp-diag₂ {X}{Y}{Z}{f}{g} = refl -- co-curry : {A B C : Set} → ((A × B) → C) → ℙ (B → C) → ℙ A -- co-curry {A}{B}{C} f = ℙₐ {A}{B → C} (curry f) -- co-uncurry : {A B C : Set} → (A → B → C) → ℙ C → ℙ (A × B) -- co-uncurry {A}{B}{C} f = ℙₐ {A × B} {C} (uncurry f) -- liftℙ : {A B : Set} → (A → ℙ B) → ℙ A → ℙ B -- liftℙ {A} f s b = ∀(a : A) → (s a) × (f a b)
common/sectmap.asm
DigitalMars/optlink
28
5821
TITLE SECTMAP - Copyright (C) SLR Systems 1993 INCLUDE MACROS if any_overlays .DATA .CODE PASS2_TEXT ASSUME DS:NOTHING ALLOW_SECTION_MAP PROC ; ; ; if any_overlays if fg_os2 RELEASE SECTIONMAP_OK_SEM else CALL DO_PRINT_SECTIONS endif endif RET ALLOW_SECTION_MAP ENDP ASSUME DS:NOTHING DO_PRINT_SECTIONS PROC ; ;OUTPUT A DETAILED LIST DESCRIBING ALL SECTIONS IN FILE (IF OVERLAYS) ; BITT SEGMENTS_MAP JZ 9$ BITT DOING_OVERLAYS JZ 9$ if fg_os2 CAPTURE SECTIONMAP_OK_SEM endif LEA SI,SECTIONS_HEADER CALL HEADER_OUT LDS SI,FIRST_SECTION FIXES JMP 8$ 1$: MOV WM_CURN_SECTION.OFFS,SI MOV WM_CURN_SECTION.SEGM,DS SYM_CONV_DS PUSHM [SI]._SECT_NEXT_SECTION_ORDER.OFFS,[SI]._SECT_NEXT_SECTION_ORDER.SEGM CMP [SI]._SECT_NUMBER,0 JZ 5$ ;SKIP ROOT TEST [SI]._SECT_FLAGS,MASK SECT_CODEVIEW JNZ 5$ ;SKIP CODEVIEW CALL PRINT_SECTION 5$: POPM DS,SI 8$: MOV CX,DS OR CX,CX JNZ 1$ 9$: RET DO_PRINT_SECTIONS ENDP ASSUME DS:NOTHING PRINT_SECTION PROC NEAR ; ;FIRST, SECTION # ; LEA DI,XOUTBUF MOV AL,' ' STOSB MOV AX,[SI]._SECT_NUMBER XOR DX,DX CALL HEXDWOUTSH LEA CX,XOUTBUF+7 CALL SPACE_OUT ; ;NOW PRINT OUTPUT FILENAME ; LDS SI,[SI]._SECT_OUTFILE SYM_CONV_DS LDS SI,[SI]._OF_FILE_LIST LEA SI,[SI].FILE_LIST_NFN CALL CONV_MOVE_PRIM_EXT LEA CX,XOUTBUF+20 CALL SPACE_OUT ; ;NOW PRINT FILE ADDRESS ; LDS SI,WM_CURN_SECTION SYM_CONV_DS MOV AX,[SI]._SECT_FILE_ADDRESS.LW MOV DX,[SI]._SECT_FILE_ADDRESS.HW CALL SHR_DXAX_4 ;CONVERT TO PARAGRAPH CALL OUT5 ;PRINT IT ; ;NOW PRINT FILE SIZE ; MOV AX,[SI]._SECT_FILE_SIZE XOR DX,DX CALL OUT5 ; ;NOW OUTPUT MEMORY LOAD ADDRESS ; MOV AX,[SI]._SECT_BASE_ADDRESS.LW MOV DX,[SI]._SECT_BASE_ADDRESS.HW CALL SHR_DXAX_4 CALL OUT5 ; ;NOW OUTPUT MEMORY SIZE ; MOV AX,[SI]._SECT_MAX_ADDRESS.LW MOV DX,[SI]._SECT_MAX_ADDRESS.HW ADD AX,15 ADC DX,0 SUB AX,[SI]._SECT_BASE_ADDRESS.LW SBB DX,[SI]._SECT_BASE_ADDRESS.HW CALL SHR_DXAX_4 CALL OUT5 if fg_plink endif CALL LINE_OUT RET PRINT_SECTION ENDP iff data_in_codeseg .DATA endif if fg_plink SECTIONS_HEADER DB LENGTH SECTIONS_HEADER-1,0DH,0AH,\ ' Sect# Fname Faddr Fsize Maddr Msize Parent Name',0dh,0ah else SECTIONS_HEADER DB LENGTH SECTIONS_HEADER-1,0DH,0AH,\ ' Sect# Fname Faddr Fsize Maddr Msize',0dh,0ah endif endif END
oeis/052/A052964.asm
neoneye/loda-programs
11
91259
<reponame>neoneye/loda-programs ; A052964: Expansion of (1-x)/((1-2x)(1+x-x^2)). ; Submitted by <NAME> ; 1,0,3,1,10,7,35,36,127,165,474,715,1807,3004,6995,12393,27370,50559,107883,204820,427351,826045,1698458,3321891,6765175,13333932,26985675,53457121,107746282,214146295,430470899,857417220,1720537327,3431847189,6878624730,13733091643,27505271455,54947296924,109996928003,219828275865,439924466026,879415437615,1759532283963,3517929664756,7037695641415,14072420067757,28149647662490,56291516582931,112595619434887,225170873858700,450374698997499,900696081703825,1801478430978922,3602817278095399 mov $3,1 lpb $0 sub $0,1 add $4,$2 mov $2,$3 add $4,$1 add $1,$3 mov $3,$4 mov $4,$2 lpe mov $0,$3
oeis/260/A260611.asm
neoneye/loda-programs
11
179609
<filename>oeis/260/A260611.asm ; A260611: a(n) = superfactorial(prime(n)-1) mod prime(n). ; Submitted by <NAME> ; 1,2,3,6,1,8,13,1,1,17,1,6,9,1,46,30,58,50,1,1,27,78,82,34,22,10,102,106,76,15,126,1,37,138,105,1,28,1,1,93,1,19,190,81,14,198,210,1,1,107,144,1,64,250,16,262,82,1,60,53,282,155,306,1,288,203,330,189,1,136,42,1,366,269,378,382,115,334,381,266,1,392,430,254,1,1,382,348,413,1,466,478,1,1,498,502,208,286,1,52 seq $0,6093 ; a(n) = prime(n) - 1. seq $0,126868 ; a(n) = (n+1)!! mod n.
source/network-generic_promises.adb
reznikmm/network
1
6894
<reponame>reznikmm/network with Ada.Unchecked_Deallocation; package body Network.Generic_Promises is procedure Free is new Ada.Unchecked_Deallocation (List_Node, List_Node_Access); function Has_Listener (Self : Promise'Class; Value : not null Listener_Access) return Boolean; ------------------ -- Add_Listener -- ------------------ not overriding procedure Add_Listener (Self : in out Promise'Class; Value : not null Listener_Access) is Parent : constant Controller_Access := Self.Parent; begin case Parent.Data.State is when Pending => if not Self.Has_Listener (Value) then Parent.Data.Listeners := new List_Node' (Item => Value, Next => Parent.Data.Listeners); end if; when Resolved => Value.On_Resolve (Parent.Data.Resolve_Value); when Rejected => Value.On_Reject (Parent.Data.Reject_Value); end case; end Add_Listener; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : in out Controller) is begin if Self.Data.State = Pending then declare Next : List_Node_Access := Self.Data.Listeners; begin while Next /= null loop declare Item : List_Node_Access := Next; begin Next := Item.Next; Free (Item); end; end loop; end; end if; end Finalize; ------------------ -- Has_Listener -- ------------------ function Has_Listener (Self : Promise'Class; Value : not null Listener_Access) return Boolean is Next : List_Node_Access := Self.Parent.Data.Listeners; begin while Next /= null loop if Next.Item = Value then return True; end if; Next := Next.Next; end loop; return False; end Has_Listener; ----------------- -- Is_Attached -- ----------------- function Is_Attached (Self : Promise'Class) return Boolean is begin return Self.Parent /= null; end Is_Attached; ---------------- -- Is_Pending -- ---------------- function Is_Pending (Self : Promise'Class) return Boolean is begin return Self.Parent.Is_Pending; end Is_Pending; function Is_Pending (Self : Controller'Class) return Boolean is begin return Self.Data.State = Pending; end Is_Pending; ----------------- -- Is_Rejected -- ----------------- function Is_Rejected (Self : Promise'Class) return Boolean is begin return Self.Parent.Is_Rejected; end Is_Rejected; function Is_Rejected (Self : Controller'Class) return Boolean is begin return Self.Data.State = Rejected; end Is_Rejected; ----------------- -- Is_Resolved -- ----------------- function Is_Resolved (Self : Promise'Class) return Boolean is begin return Self.Parent.Is_Resolved; end Is_Resolved; function Is_Resolved (Self : Controller'Class) return Boolean is begin return Self.Data.State = Resolved; end Is_Resolved; ------------ -- Reject -- ------------ procedure Reject (Self : in out Controller'Class; Value : Reject_Element) is Next : List_Node_Access := Self.Data.Listeners; begin Self.Data := (Rejected, Value); while Next /= null loop declare Item : List_Node_Access := Next; begin Item.Item.On_Reject (Self.Data.Reject_Value); Next := Item.Next; Free (Item); end; end loop; end Reject; --------------------- -- Remove_Listener -- --------------------- procedure Remove_Listener (Self : in out Promise'Class; Value : not null Listener_Access) is Next : List_Node_Access := Self.Parent.Data.Listeners; begin if Next.Item = Value then Self.Parent.Data.Listeners := Next.Next; Free (Next); end if; while Next /= null loop if Next.Next /= null and then Next.Next.Item = Value then Next.Next := Next.Next.Next; Free (Next); exit; end if; end loop; end Remove_Listener; ------------- -- Resolve -- ------------- procedure Resolve (Self : in out Controller'Class; Value : Resolve_Element) is Next : List_Node_Access := Self.Data.Listeners; begin Self.Data := (Resolved, Value); while Next /= null loop declare Item : List_Node_Access := Next; begin Item.Item.On_Resolve (Self.Data.Resolve_Value); Next := Item.Next; Free (Item); end; end loop; end Resolve; ---------------- -- To_Promise -- ---------------- function To_Promise (Self : access Controller'Class) return Promise is begin return (Parent => Self.all'Unchecked_Access); end To_Promise; end Network.Generic_Promises;
x86/Evaluate.asm
lucabrivio/asmFish-fasmg
1
21579
MinorBehindPawn = (( 16 shl 16) + ( 0)) BishopPawns = (( 8 shl 16) + ( 12)) RookOnPawn = (( 8 shl 16) + ( 24)) TrappedRook = (( 92 shl 16) + ( 0)) WeakQueen = (( 50 shl 16) + ( 10)) OtherCheck = (( 10 shl 16) + ( 10)) CloseEnemies = (( 7 shl 16) + ( 0)) PawnlessFlank = (( 20 shl 16) + ( 80)) ThreatByHangingPawn = (( 71 shl 16) + ( 61)) ThreatBySafePawn = ((182 shl 16) + (175)) ThreatByRank = (( 16 shl 16) + ( 3)) Hanging = (( 48 shl 16) + ( 27)) ThreatByPawnPush = (( 38 shl 16) + ( 22)) HinderPassedPawn = (( 7 shl 16) + ( 0)) LongRangedBishop = (22 shl 16) + 0 TrappedBishopA1H1 = (50 shl 16) + 50 LazyThreshold = 1500 macro EvalInit Us ; in: r13 rook + queen ; r12 bishop+queen ; r14 all pieces local Them, Down local NotUsed, PinnedLoop, NoPinned, YesPinned if Us = White Them = Black Down = DELTA_S else Them = White Down = DELTA_N end if ; Assert e, rdi, qword[.ei.pi], 'assertion rdi = ei.pi failed in EvalInit' movzx ecx, word[rbx+State.npMaterial+2*Us] movzx eax, byte[rbp+Pos.pieceList+16*(8*Them+King)] if Them = White cmp eax, SQ_A2 setb al else cmp eax, SQ_A8 setae al end if mov r9, qword[.ei.attackedBy+8*(8*Them+King)] or qword[.ei.attackedBy+8*(8*Them+0)], r9 mov r10, qword[rdi+PawnEntry.pawnAttacks+8*Us] mov qword[.ei.attackedBy+8*(8*Us+Pawn)], r10 or qword[.ei.attackedBy+8*(8*Us+0)], r10 ; rdx = b xor r8, r8 xor edx, edx cmp ecx, RookValueMg + KnightValueMg jb NotUsed mov r8, r9 neg rax ShiftBB Down, r8 and r8, rax or r8, r9 and r9, r10 _popcnt rdx, r9, rcx xor eax, eax mov dword[.ei.kingAttackersWeight+4*Us], eax mov dword[.ei.kingAdjacentZoneAttacksCount+4*Us], eax NotUsed: mov qword[.ei.kingRing+8*Them], r8 mov dword[.ei.kingAttackersCount+4*Us], edx and r10, qword[.ei.attackedBy+8*(8*Us+King)] mov qword[.ei.attackedBy2+8*Us], r10 end macro macro EvalPieces Us, Pt ; in: rbp address of Pos struct ; rbx address of State struct ; rsp address of evaluation info ; rdi address of PawnEntry struct ; io: esi score accumulated ; ; in: r13 all pieces ; r12 pieces of type Pt ( qword[rbp+Pos.typeBB+8*Pt]) local addsub, subadd local Them, OutpostRanks local RookOnFile0, RookOnFile1 local Outpost0, Outpost1, KingAttackWeight local MobilityBonus, ProtectorBonus local NextPiece, NoPinned, NoKingRing, AllDone local OutpostElse, OutpostDone, NoBehindPawnBonus local NoEnemyPawnBonus, NoOpenFileBonus, NoTrappedByKing local SkipQueenPin, QueenPinLoop if Us = White ;addsub equ add ;subadd equ sub macro addsub a, b add a, b end macro macro subadd a, b sub a, b end macro Them = Black OutpostRanks = 0x0000FFFFFF000000 else ;addsub equ sub ;subadd equ add macro addsub a, b sub a, b end macro macro subadd a, b add a, b end macro Them = White OutpostRanks = 0x000000FFFFFF0000 end if RookOnFile0 = ((20 shl 16) + (7)) RookOnFile1 = ((45 shl 16) + (20)) if Pt = Knight Outpost0 = ((22 shl 16) + ( 6)) Outpost1 = ((36 shl 16) + (12)) KingAttackWeight = 78 MobilityBonus equ MobilityBonus_Knight KingProtector_Pt = ((-3 shl 16) + (-5)) else if Pt = Bishop Outpost0 = (( 9 shl 16) + (2)) Outpost1 = ((15 shl 16) + (5)) KingAttackWeight = 56 MobilityBonus equ MobilityBonus_Bishop KingProtector_Pt = ((-4 shl 16) + (-3)) else if Pt = Rook KingAttackWeight = 45 MobilityBonus equ MobilityBonus_Rook KingProtector_Pt = ((-3 shl 16) + (0)) else if Pt = Queen KingAttackWeight = 11 MobilityBonus equ MobilityBonus_Queen KingProtector_Pt = ((-1 shl 16) + (1)) else err 'bad Pt in Eval Pieces' end if ; Assert e, rdi, qword[.ei.pi], 'assertion rdi=qword[.ei.pi] failed in EvalPieces' xor eax, eax mov qword[.ei.attackedBy+8*(8*Us+Pt)], rax mov r11, qword[rbp+Pos.typeBB+8*Us] ; r11 = our pieces lea r15, [rbp+Pos.pieceList+16*(8*Us+Pt)] movzx r14d, byte[rbp+Pos.pieceList+16*(8*Us+Pt)] cmp r14d, 64 jae AllDone NextPiece: add r15, 1 ; r14 = square s ; Find attacked squares, including x-ray attacks for bishops and rooks if Pt = Knight mov r9, qword[KnightAttacks+8*r14] else if Pt = Bishop mov rax, qword[rbp+Pos.typeBB+8*Queen] and rax, r11 xor rax, r13 BishopAttacks r9, r14, rax, rdx else if Pt = Rook mov rax, qword[rbp+Pos.typeBB+8*Queen] or rax, r12 and rax, r11 xor rax, r13 RookAttacks r9, r14, rax, rdx else if Pt = Queen QueenAttacks r9, r14, r13, rax, rdx else err 'bad Pt in EvalPieces' end if ; r9 = b movzx r8d, byte[rbp+Pos.pieceList+16*(8*Us+King)] ; r8d = our ksq mov rax, qword[.ei.pinnedPieces+8*Us] bt rax, r14 jnc NoPinned ; 98.92% mov eax, r8d shl eax, 6+3 and r9, qword[LineBB+rax+8*r14] NoPinned: mov rax, qword[.ei.attackedBy+8*(8*Us+Pt)] mov rdx, qword[.ei.attackedBy+8*(8*Us+0)] mov rcx, r9 and rcx, rdx or rax, r9 or rdx, rax or qword[.ei.attackedBy2+8*Us], rcx mov qword[.ei.attackedBy+8*(8*Us+Pt)], rax mov qword[.ei.attackedBy+8*(8*Us+0)], rdx test r9, qword[.ei.kingRing+8*Them] jz NoKingRing ; 74.44% add dword[.ei.kingAttackersCount+4*Us], 1 add dword[.ei.kingAttackersWeight+4*Us], KingAttackWeight mov rax, qword[.ei.attackedBy+8*(8*Them+King)] and rax, r9 _popcnt rax, rax, rcx add dword[.ei.kingAdjacentZoneAttacksCount+4*Us], eax NoKingRing: mov rax, qword[.ei.mobilityArea+8*Us] and rax, r9 _popcnt r10, rax, rcx addsub esi, dword[MobilityBonus+4*r10] lea eax, [8*r8] movzx eax, byte[SquareDistance+8*rax+r14] imul eax, KingProtector_Pt addsub esi, eax if Pt = Knight | Pt = Bishop ; Bonus when behind a pawn if Us = White cmp r14d, SQ_A5 jae NoBehindPawnBonus else cmp r14d, SQ_A5 jb NoBehindPawnBonus end if mov rax, qword[rbp+Pos.typeBB+8*Pawn] lea ecx, [r14+8*(Them-Us)] bt rax, rcx lea eax, [rsi+MinorBehindPawn*(Them-Us)] cmovc esi, eax NoBehindPawnBonus: ; Bonus for outpost squares mov rax, OutpostRanks mov rcx, qword[rdi+PawnEntry.pawnAttacksSpan+8*Them] mov rdx, r11 _andn rcx, rcx, rax mov rax, qword[.ei.attackedBy+8*(8*Us+Pawn)] bt rcx, r14 jnc OutpostElse lea ecx, [rsi+2*Outpost1*(Them-Us)] add esi, 2*Outpost0*(Them-Us) bt rax, r14 cmovc esi, ecx jmp OutpostDone OutpostElse: _andn rdx, rdx, rcx and rdx, r9 jz OutpostDone lea ecx, [rsi+Outpost1*(Them-Us)] add esi, Outpost0*(Them-Us) test rdx, qword[.ei.attackedBy+8*(8*Us+Pawn)] cmovnz esi, ecx OutpostDone: ; Penalty for pawns on the same color square as the bishop if Pt = Bishop xor ecx, ecx mov rax, DarkSquares bt rax, r14 adc rcx, rdi movzx eax, byte[rcx+PawnEntry.pawnsOnSquares+2*Us] imul eax, BishopPawns subadd esi, eax mov rdx, qword[.ei.attackedBy + 8*(8*Them + Pawn)] mov rax, 0x8142241818244281 mov rcx, (FileDBB or FileEBB) and (Rank4BB or Rank5BB) _andn rax, rdx, rax lea edx, [rsi + LongRangedBishop*(Them - Us)] bt rax, r14 jnc @1f and rcx, qword[BishopAttacksPDEP + 8*r14] test rcx, qword[rbp + Pos.typeBB + 8*Pawn] cmovz esi, edx @1: end if if PEDANTIC = 1 & Pt = Bishop lea rdx, [rbp + Pos.board + r14] cmp byte[rbp + Pos.chess960], 0 je @2f mov rcx, DELTA_E + 8*(1-2*Us) cmp r14d, SQ_A1 xor (56*Us) je @1f mov rcx, DELTA_W + 8*(1-2*Us) cmp r14d, SQ_H1 xor (56*Us) jne @2f @1: cmp byte[rdx + rcx], 8*Us + Pawn jne @2f mov eax, 4*TrappedBishopA1H1 cmp byte[rdx + rcx + 8*(1-2*Us)], 0 jne @1f mov eax, 2*TrappedBishopA1H1 cmp byte[rdx + rcx + rcx], 8*Us + Pawn je @1f mov eax, TrappedBishopA1H1 @1: subadd esi, eax @2: end if else if Pt = Rook if Us = White cmp r14d, SQ_A5 jb NoEnemyPawnBonus else cmp r14d, SQ_A5 jae NoEnemyPawnBonus end if mov rax, qword[rbp+Pos.typeBB+8*Them] and rax, qword[rbp+Pos.typeBB+8*Pawn] and rax, qword[RookAttacksPDEP+8*r14] _popcnt rax, rax, rcx imul eax, RookOnPawn addsub esi, eax NoEnemyPawnBonus: mov ecx, r14d and ecx, 7 movzx eax, byte[rdi+PawnEntry.semiopenFiles+1*Us] movzx edx, byte[rdi+PawnEntry.semiopenFiles+1*Them] bt eax, ecx jnc NoOpenFileBonus lea eax, [rsi+RookOnFile0*(Them-Us)] lea esi, [rsi+RookOnFile1*(Them-Us)] bt edx, ecx cmovnc esi, eax jmp NoTrappedByKing NoOpenFileBonus: mov ecx, r14d and ecx, 7 mov eax, r8d cmp r10d, 4 jae NoTrappedByKing mov edx, eax and eax, 7 sub ecx, eax sub eax, 4 xor ecx, eax js NoTrappedByKing mov ecx, r8d and ecx, 7 mov edx, ecx mov eax, r14d and eax, 7 sub ecx, eax sub ecx, 1 sar ecx, 31 sub edx, ecx xor eax, eax bts eax, edx sub eax, 1 xor eax, ecx test al, byte[rdi+PawnEntry.semiopenFiles+1*Us] jnz NoTrappedByKing movzx eax, byte[rbx+State.castlingRights] and eax, 3 shl (2*Us) setz al add eax, 1 imul r10d, 22*65536 sub r10d, TrappedRook imul r10d, eax addsub esi, r10d NoTrappedByKing: else if Pt = Queen xor edx, edx mov rax, r12 or rax, qword[rbp+Pos.typeBB+8*Rook] and rax, qword[RookAttacksPDEP+8*r14] mov rcx, r12 or rcx, qword[rbp+Pos.typeBB+8*Bishop] and rcx, qword[BishopAttacksPDEP+8*r14] or rax, rcx mov r9, qword[rbp+Pos.typeBB+8*Rook] or r9, qword[rbp+Pos.typeBB+8*Bishop] and r9, qword[rbp+Pos.typeBB+8*Them] and rax, r9 jz SkipQueenPin shl r14d, 6+3 bsf rcx, rax QueenPinLoop: mov rcx, qword[BetweenBB+r14+8*rcx] _blsr rax, rax, r9 and rcx, r13 _blsr r8, rcx, r9 neg r8 sbb r8, r8 _andn rcx, r8, rcx or rdx, rcx bsf rcx, rax jnz QueenPinLoop test rdx, r13 lea eax, [rsi+WeakQueen*(Us-Them)] cmovnz esi, eax SkipQueenPin: end if movzx r14d, byte[r15] cmp r14d, 64 jb NextPiece AllDone: end macro macro EvalKing Us ; in rbp address of Pos struct ; rbx address of State struct ; rsp address of evaluation info ; add/sub score to dword[.ei.score] local Them, Up, Camp local PiecesUs, PiecesThem local QueenCheck, RookCheck, BishopCheck, KnightCheck local AllDone, DoKingSafety, KingSafetyDoneRet local RookDone, BishopDone, KnightDone local NoKingSide, NoQueenSide, NoPawns if Us = White Them = Black Up = DELTA_N AttackedByUs = r12 AttackedByThem = r13 PiecesUs = r14 PiecesThem = r15 Camp = Rank1BB or Rank2BB or Rank3BB or Rank4BB or Rank5BB else Them = White Up = DELTA_S AttackedByUs = r13 AttackedByThem = r12 PiecesUs = r15 PiecesThem = r14 Camp = Rank4BB or Rank5BB or Rank6BB or Rank7BB or Rank8BB end if QueenCheck = 780 RookCheck = 880 BishopCheck = 435 KnightCheck = 790 Assert e, rdi, qword[.ei.pi], 'assertion rdi=qword[.ei.pi] failed in EvalKing' Assert e, AttackedByUs, qword[.ei.attackedBy+8*(8*Us+0)], 'assertion AttackedByUs failed in EvalKing' Assert e, AttackedByThem, qword[.ei.attackedBy+8*(8*Them+0)], 'assertion AttackedByThem failed in EvalKing' Assert e, PiecesUs, qword[rbp+Pos.typeBB+8*Us], 'assertion PiecesUs failed in EvalKing' Assert e, PiecesThem, qword[rbp+Pos.typeBB+8*Them], 'assertion PiecesThem failed in EvalKing' movzx ecx, byte[rbp+Pos.pieceList+16*(8*Us+King)] mov r11d, ecx ; r11d = our king square movzx eax, byte[rbx+State.castlingRights] movzx edx, byte[rdi+PawnEntry.castlingRights] mov esi, dword[rdi+PawnEntry.kingSafety+4*Us] cmp cl, byte[rdi+PawnEntry.kingSquares+1*Us] jne DoKingSafety ; 27.75% xor eax, edx test eax, 3 shl (2*Us) jne DoKingSafety ; 0.68% KingSafetyDoneRet: mov edi, dword[.ei.kingAttackersCount+4*Them] movzx ecx, byte[rbp+Pos.pieceEnd+(8*Them+Queen)] and ecx, 15 add ecx, edi mov r8, qword[.ei.attackedBy2+8*Us] _andn r8, r8, qword[.ei.attackedBy+8*(8*Us+King)] and r8, AttackedByThem ; r8=kingOnlyDefended mov r9, PiecesThem or r9, AttackedByUs _andn r9, r9, qword[.ei.kingRing+8*Us] and r9, AttackedByThem ; r9=undefended or r9, r8 cmp ecx, 2 jb AllDone imul edi, dword[.ei.kingAttackersWeight+4*Them] imul eax, dword[.ei.kingAdjacentZoneAttacksCount+4*Them], 102 add edi, eax _popcnt rax, r9, rcx imul eax, 191 add edi, eax mov rdx, qword[.ei.pinnedPieces+8*Us] neg rdx sbb eax, eax and eax, 143 add edi, eax test PiecesThem, qword[rbp+Pos.typeBB+8*Queen] lea eax, [rdi-848] cmovz edi, eax ; the following does edi += - 5*mg_value(score)/8 + 40 lea ecx, [rsi+0x08000] add edi, 40 sar ecx, 16 lea edx, [9*rcx] lea eax, [9*rcx+7] cmovs edx, eax sar edx, 3 sub edi, edx ; edi = kingDanger and r8, qword[.ei.attackedBy2+8*Them] _andn r8, r8, AttackedByUs or r8, PiecesThem not r8 ; r8 = safe mov r9, qword[rbp+Pos.typeBB+8*Pawn] mov rax, PiecesThem and rax, r9 ShiftBB Up, r9 and r9, rax or r9, qword[.ei.attackedBy+8*(8*Us+Pawn)] not r9 ; r9 = other xor PiecesUs, PiecesThem RookAttacks r10, r11, PiecesUs, rax ; r10 = b1 = pos.attacks_from<ROOK >(ksq) BishopAttacks rdx, r11, PiecesUs, rax ; rdx = b1 = pos.attacks_from<BISHOP>(ksq) xor PiecesUs, PiecesThem ; Enemy queen safe checks mov rax, r10 or rax, rdx and rax, qword[.ei.attackedBy+8*(8*Them+Queen)] and rax, r8 lea ecx, [rdi+QueenCheck] cmovnz edi, ecx ; For other pieces, also consider the square safe if attacked twice, ; and only defended by a queen. mov rax, PiecesThem or rax, qword[.ei.attackedBy2+8*Us] not rax and rax, qword[.ei.attackedBy+8*(8*Us+Queen)] and rax, qword[.ei.attackedBy2+8*Them] or r8, rax ; r8 = safe and r10, qword[.ei.attackedBy+8*(8*Them+Rook)] ; r10 = b1 & ei.attackedBy[Them][ROOK] and rdx, qword[.ei.attackedBy+8*(8*Them+Bishop)] ; rdx = b1 & ei.attackedBy[Them][BISHOP] mov rcx, qword[KnightAttacks+8*r11] and rcx, qword[.ei.attackedBy+8*(8*Them+Knight)] ; rcx = b ; Enemy rooks safe and other checks test r10, r8 lea eax, [rdi+RookCheck] cmovnz edi, eax jnz RookDone test r10, r9 lea eax, [rsi-OtherCheck] cmovnz esi, eax RookDone: ; Enemy bishops safe and other checks test rdx, r8 lea eax, [rdi+BishopCheck] cmovnz edi, eax jnz BishopDone test rdx, r9 lea eax, [rsi-OtherCheck] cmovnz esi, eax BishopDone: ; Enemy knights safe and other checks test rcx, r8 lea eax, [rdi+KnightCheck] cmovnz edi, eax jnz KnightDone test rcx, r9 lea eax, [rsi-OtherCheck] cmovnz esi, eax KnightDone: ; Compute the king danger score and subtract it from the evaluation test edi, edi js AllDone mov eax, edi shr eax, 4 ; kingDanger>=0 here sub esi, eax imul edi, edi shr edi, 12 shl edi, 16 sub esi, edi jmp AllDone DoKingSafety: ; rdi = address of PawnEntry movzx ecx, byte[rbp+Pos.pieceList+16*(8*Us+King)] movzx eax, byte[rbx+State.castlingRights] movzx edx, byte[rdi+PawnEntry.castlingRights] and eax, 3 shl (2*Us) and edx, 3 shl (2*Them) add edx, eax mov byte[rdi+PawnEntry.kingSquares+1*Us], cl mov byte[rdi+PawnEntry.castlingRights], dl call ShelterStorm#Us mov esi, eax mov ecx, SQ_G1 + Us*(SQ_G8-SQ_G1) test byte[rbx+State.castlingRights], 1 shl (2*Us+0) jz NoKingSide call ShelterStorm#Us cmp esi, eax cmovl esi, eax NoKingSide: mov ecx, SQ_C1 + Us*(SQ_C8-SQ_C1) test byte[rbx+State.castlingRights], 1 shl (2*Us+1) jz NoQueenSide call ShelterStorm#Us cmp esi, eax cmovl esi, eax NoQueenSide: shl esi, 16 ; esi = score lea ecx, [8*r11] ; r11d = ksq lea rcx, [DistanceRingBB+8*rcx] mov rdi, qword[.ei.pi] ; clobbered by ShelterStorm mov rdx, PiecesUs and rdx, qword[rbp+Pos.typeBB+8*Pawn] mov dword[rdi+PawnEntry.kingSafety+4*Us], esi jz KingSafetyDoneRet iterate i, 0, 1, 2, 3, 4, 5, 6 sub esi, 16 mov dword[rdi+PawnEntry.kingSafety+4*Us], esi test rdx, qword[rcx+8*i] jnz KingSafetyDoneRet end iterate sub esi, 16 mov dword[rdi+PawnEntry.kingSafety+4*Us], esi if DEBUG and rdx, qword[rcx+8*7] Assert ne, rdx, 0, 'assertion rdx !=0 failed in DoKingSafety' end if jmp KingSafetyDoneRet AllDone: and r11d, 7 mov r11, qword[KingFlank+8*r11] ; r11 = KingFlank[kf] ksq is not used anymore mov rax, Camp and rax, r11 and rax, AttackedByThem mov rdi, qword[.ei.pi] ; we may have clobbered rdi with kingDanger test r11, qword[rbp+Pos.typeBB+8*Pawn] lea ecx, [rsi-PawnlessFlank] cmovz esi, ecx ; pawnless flank mov rdx, qword[.ei.attackedBy+8*(8*Us+Pawn)] not rdx and rdx, qword[.ei.attackedBy2+8*Them] and rdx, rax if Us eq White shl rax, 4 else shr rax, 4 end if or rax, rdx _popcnt rax, rax, r9 imul eax, CloseEnemies sub esi, eax ; king tropism if Us eq White add dword[.ei.score], esi else sub dword[.ei.score], esi end if end macro macro ShelterStorm Us ; in: rbp position ; rbx state ; ecx ksq ; out: eax saftey if Us = White Them = Black Up = DELTA_N PiecesUs equ r14 PiecesThem equ r15 else Them = White Up = DELTA_S PiecesUs equ r15 PiecesThem equ r14 end if MaxSafetyBonus = 258 push rsi rdi r11 r12 r13 Assert e, PiecesUs, qword[rbp+Pos.typeBB+8*Us], 'assertion PiecesUs failed in EvalPassedPawns' Assert e, PiecesThem, qword[rbp+Pos.typeBB+8*Them], 'assertion PiecesThem failed in EvalPassedPawns' ; ecx = ksq mov r13d, ecx shr r13d, 3 mov r8, qword[InFrontBB+8*(8*Us+r13)] or r8, qword[RankBB+8*r13] and r8, qword[rbp+Pos.typeBB+8*Pawn] ; r8 = b mov r9, PiecesUs and r9, r8 ; r9 = ourPawns mov r10, PiecesThem and r10, r8 ; r10 = theirPawns mov eax, MaxSafetyBonus ; eax = saftey if Us eq Black xor r13d, 7 end if add r13d, 1 ; r13d = relative_rank(Us, ksq)+1 and ecx, 7 ; ecx = file of ksq lea r12d, [5*rcx] lea r12d, [r12+8*rcx+2] shr r12d, 4 ; r12d = max(FILE_B, min(FILE_G, ecx))-1 macro ShelterStormAcc local AddStormDanger, TryNext if Us eq White xor edx, edx else mov edx, 7 shl 3 end if if Us eq White mov r8, qword[FileBB+8*r12] and r8, r10 bsf rdi, r8 cmovz edi, edx shr edi, 3 else mov r8, qword[FileBB+8*r12] and r8, r10 bsr rdi, r8 cmovz edi, edx shr edi, 3 xor edi, 7 end if ; edi = rkThem if Us eq White mov r8, qword[FileBB+8*r12] and r8, r9 bsf rsi, r8 cmovz esi, edx shr esi, 3 else mov r8, qword[FileBB+8*r12] and r8, r9 bsr rsi, r8 cmovz esi, edx shr esi, 3 xor esi, 7 end if ; esi = rkUs mov edx, r12d shl edx, 3+2 ; ShelterWeakness and StormDanger are twice as big ; to avoid an anoying min(f,FILE_H-f) in ShelterStorm add esi, 1 ; esi = rkUs+1 lea r11, [StormDanger_BlockedByKing+rdx] lea r8, [ShelterWeakness_No - 4*1 + rdx] cmp ecx, r12d lea r12d, [r12+1] jne TryNext lea r8, [ShelterWeakness_Yes - 4*1 + rdx] cmp edi, r13d je AddStormDanger TryNext: lea r11, [StormDanger_NoFriendlyPawn + rdx] cmp esi, 1 je AddStormDanger lea r11, [StormDanger_BlockedByPawn + rdx] cmp esi, edi je AddStormDanger lea r11, [StormDanger_Unblocked + rdx] AddStormDanger: sub eax, dword[r8 + 4*rsi] sub eax, dword[r11 + 4*rdi] end macro ShelterStormAcc ShelterStormAcc ShelterStormAcc pop r13 r12 r11 rdi rsi ret end macro macro EvalThreats Us ; in: rbp position ; rbx state ; rsp evaluation info ; r10-r15 various bitboards ; io: esi score accumulated local addsub, Them, Up, Left, Right local AttackedByUs, AttackedByThem, PiecesPawn, PiecesUs, PiecesThem local TRank2BB, TRank7BB local ThreatByKing0, ThreatByKing1 local SafeThreatsDone, SafeThreatsLoop, WeakDone local ThreatMinorLoop, ThreatMinorDone, ThreatRookLoop, ThreatRookDone local ThreatMinorSkipPawn, ThreatRookSkipPawn ThreatByKing0 = (( 3 shl 16) + ( 62)) ThreatByKing1 = (( 9 shl 16) + (138)) if Us = White ;addsub equ add macro addsub a, b add a, b end macro AttackedByUs equ r12 AttackedByThem equ r13 PiecesPawn equ r11 PiecesUs equ r14 PiecesThem equ r15 Them = Black Up = DELTA_N Left = DELTA_NW Right = DELTA_NE TRank2BB = Rank2BB TRank7BB = Rank7BB else ;addsub equ sub macro addsub a, b sub a, b end macro AttackedByUs equ r13 AttackedByThem equ r12 PiecesPawn equ r11 PiecesUs equ r15 PiecesThem equ r14 Them = White Up = DELTA_S Left = DELTA_SE Right = DELTA_SW TRank2BB = Rank7BB TRank7BB = Rank2BB end if Assert e, PiecesPawn, qword[rbp+Pos.typeBB+8*Pawn], 'assertion PiecesPawn failed in EvalThreats' Assert e, AttackedByUs, qword[.ei.attackedBy+8*(8*Us+0)], 'assertion AttackedByUs failed in EvalThreats' Assert e, AttackedByThem, qword[.ei.attackedBy+8*(8*Them+0)], 'assertion AttackedByThem failed in EvalThreats' Assert e, PiecesUs, qword[rbp+Pos.typeBB+8*Us], 'assertion PiecesUs failed in EvalThreats' Assert e, PiecesThem, qword[rbp+Pos.typeBB+8*Them], 'assertion PiecesThem failed in EvalThreats' mov r8, PiecesThem mov r9, PiecesPawn and r9, PiecesThem xor r8, r9 and r8, qword[.ei.attackedBy+8*(8*Us+Pawn)] ; r8 = weak jz SafeThreatsDone mov r9, AttackedByThem not r9 or r9, AttackedByUs and r9, PiecesUs and r9, PiecesPawn mov rdx, r9 ShiftBB Right, r9, rcx ShiftBB Left, rdx, rcx or r9, rdx and r9, r8 ; r9 = safeThreats xor r8, r9 lea eax, [rsi + ThreatByHangingPawn*(Them-Us)] cmovnz esi, eax _popcnt rcx, r9, rax imul ecx, ThreatBySafePawn addsub esi, ecx SafeThreatsDone: mov r9, qword[.ei.attackedBy2+8*Us] _andn r9, r9, qword[.ei.attackedBy2+8*Them] or r9, qword[.ei.attackedBy+8*(8*Them+Pawn)] ; r9 = stronglyProtected mov r8, PiecesPawn _andn r8, r8, PiecesThem and r8, r9 ; r8 = defended (= pos.pieces(Them) & ~pos.pieces(PAWN) & stronglyProtected) _andn r9, r9, PiecesThem and r9, AttackedByUs ; r9 = weak (stronglyProtected variable is not used anymore) or r8, r9 ; r8 = defended | weak jz WeakDone mov rax, qword[.ei.attackedBy+8*(8*Us+Knight)] or rax, qword[.ei.attackedBy+8*(8*Us+Bishop)] and r8, rax jz ThreatMinorDone ThreatMinorLoop: bsf rax, r8 movzx ecx, byte[rbp+Pos.board+rax] addsub esi, dword[Threat_Minor+4*rcx] shr eax, 3 if Us eq White xor eax, Them*7 end if ; tricky: we want only the lower byte of the memory here, ; but the upper 3 bytes of eax are zero anyways and eax, dword[IsNotPawnMasks+rcx] imul eax, ThreatByRank addsub esi, eax _blsr r8, r8, rcx jnz ThreatMinorLoop ThreatMinorDone: mov rdx, PiecesThem and rdx, qword[rbp+Pos.typeBB+8*Queen] or rdx, r9 and rdx, qword[.ei.attackedBy+8*(8*Us+Rook)] jz ThreatRookDone ThreatRookLoop: bsf rax, rdx movzx ecx, byte[rbp+Pos.board+rax] addsub esi, dword[Threat_Rook+4*rcx] shr eax, 3 if Us eq White xor eax, Them*7 end if and eax, dword[IsNotPawnMasks+rcx] imul eax, ThreatByRank addsub esi, eax _blsr rdx, rdx, rcx jnz ThreatRookLoop ThreatRookDone: _andn rax, AttackedByThem, r9 _popcnt rax, rax, rcx imul eax, Hanging addsub esi, eax mov rcx, qword[.ei.attackedBy+8*(8*Us+King)] and rcx, r9 mov rdx, rcx neg rdx sbb edx, edx _blsr rcx, rcx, rax neg rcx sbb eax, eax and eax, ThreatByKing1-ThreatByKing0 add eax, ThreatByKing0 and eax, edx addsub esi, eax WeakDone: WeakUnopposedPawn = (5 shl 16) + 25 mov rcx, qword[rbp + Pos.typeBB + 8*Rook] or rcx, qword[rbp + Pos.typeBB + 8*Queen] movzx edx, byte[rdi + PawnEntry.weakUnopposed] mov rax, not TRank7BB and rax, PiecesUs and rax, PiecesPawn test rcx, PiecesUs jz @1f if Us = White shr edx, 4 else and edx, 0x0F end if imul edx, WeakUnopposedPawn addsub esi, edx @1: mov r8, PiecesUs or r8, PiecesThem mov rcx, TRank2BB and rcx, rax ShiftBB Up, rcx _andn rdx, r8, rcx or rax, rdx ShiftBB Up, rax mov rdx, r8 not rdx and rax, rdx mov rcx, qword[.ei.attackedBy+8*(8*Them+Pawn)] not rcx and rax, rcx mov rdx, AttackedByThem not rdx or rdx, AttackedByUs and rax, rdx mov rdx, rax ShiftBB Left, rax, rcx ShiftBB Right, rdx, rcx or rax, rdx and rax, PiecesThem mov rcx, qword[.ei.attackedBy+8*(8*Us+Pawn)] not rcx and rax, rcx _popcnt rax, rax, rdx imul eax, ThreatByPawnPush addsub esi, eax end macro macro EvalPassedPawns Us ; in: rbp position ; rbx state ; rsp evaluation info ; r15 qword[rdi+PawnEntry.passedPawns+8*Us] ; add to dword[.ei.score] local addsub, subadd, Them, Up, s, PiecesUs, PiecesThem local NextPawn, AllDone, AddToBonus, Continue local DoScaleDown, DontScaleDown if Us = White ;addsub equ add ;subadd equ sub macro addsub a, b add a, b end macro macro subadd a, b sub a, b end macro Them equ Black Up equ DELTA_N AttackedByUs equ r12 AttackedByThem equ r13 PiecesUs equ r14 PiecesThem equ r15 else ;addsub equ sub ;subadd equ add macro addsub a, b sub a, b end macro macro subadd a, b add a, b end macro Them equ White Up equ DELTA_S AttackedByUs equ r13 AttackedByThem equ r12 PiecesUs equ r15 PiecesThem equ r14 end if ;ProfileInc EvalPassedPawns Assert e, rdi, qword[.ei.pi], 'assertion rdi = ei.pi failed in EvalPassedPawns' Assert ne, r9, 0, 'assertion r9!=0 failed in EvalPassedPawns' Assert e, AttackedByUs, qword[.ei.attackedBy+8*(8*Us+0)], 'assertion AttackedByUs failed in EvalPassedPawns' Assert e, AttackedByThem, qword[.ei.attackedBy+8*(8*Them+0)], 'assertion AttackedByThem failed in EvalPassedPawns' Assert e, PiecesUs, qword[rbp+Pos.typeBB+8*Us], 'assertion PiecesUs failed in EvalPassedPawns' Assert e, PiecesThem, qword[rbp+Pos.typeBB+8*Them], 'assertion PiecesThem failed in EvalPassedPawns' NextPawn: bsf r8, r9 _blsr r9, r9, rax mov ecx, r8d shr ecx, 3 if Us = Black xor ecx, 7 end if ; ecx = r+1 mov esi, dword[PassedRank+4*rcx] ; esi = (mbonus, ebonus) mov rax, qword[ForwardBB+8*(64*Us+r8)] add r8d, Up ; r8d = blockSq mov rdx, AttackedByThem or rdx, PiecesThem and rax, rdx _popcnt rax, rax, r10 imul eax, HinderPassedPawn subadd dword[.ei.score], eax lea edi, [rcx-2] sub ecx, 1 imul edi, ecx ; ecx = r ; edi = rr = r*(r-1) if Us = White cmp r8d, SQ_A4+Up jb Continue else cmp r8d, SQ_A6+Up jae Continue end if ; at this point rr!=0 ; ecx is free because s = r8-Up s equ (r8-Up) movzx eax, byte[rbp+Pos.pieceList+16*(8*Them+King)] movzx edx, byte[rbp+Pos.pieceList+16*(8*Us+King)] shl eax, 6 shl edx, 6 xor r10d, r10d movzx r11d, byte[SquareDistance+rdx+r8+Up] movzx eax, byte[SquareDistance+rax+r8] movzx edx, byte[SquareDistance+rdx+r8] lea eax, [5*rax] if Us = White cmp r8d, SQ_A7+Up cmovb r10d, r11d else cmp r8d, SQ_A3+Up cmovae r10d, r11d end if lea edx, [2*rdx+r10] sub eax, edx imul eax, edi add esi, eax mov r10, qword[ForwardBB+8*(64*Us+s)] lea eax, [rdi+2*rcx] bt PiecesUs, r8 jc AddToBonus ; the pawn is blocked by us mov r11, r10 bt PiecesThem, r8 jc Continue ; the pawn is blocked by them xor PiecesThem, PiecesUs RookAttacks rax, s, PiecesThem, rdx xor PiecesThem, PiecesUs mov rcx, qword[rbp+Pos.typeBB+8*Rook] or rcx, qword[rbp+Pos.typeBB+8*Queen] and rcx, qword[ForwardBB+8*(64*Them+s)] and rax, rcx or rcx, -1 test PiecesUs, rax cmovz rcx, AttackedByUs and r10, rcx or rcx, -1 test PiecesThem, rax cmovz rcx, AttackedByThem or rcx, PiecesThem and r11, rcx bt r11, r8 sbb eax, eax neg r11 sbb edx, edx lea edx, [5*rdx] lea eax, [rdx+4*rax+9] ; eax = k/2 xor edx, edx bt r10, r8 adc edx, edx xor r10, qword[ForwardBB+8*(64*Us+s)] cmp r10, 1 adc edx, edx add eax, edx ; eax = k/2 add edi, edi imul eax, edi AddToBonus: imul eax, 0x00010001 add esi, eax Continue: ; r8d = blockSq ; scale down bonus for candidate passers which need more than one pawn ; push to become passed lea ecx, [rsi+0x08000] sar ecx, 16 movsx eax, si mov r10, qword[rbp+Pos.typeBB+8*Pawn] test r10, qword[ForwardBB+8*(64*Us+s)] jnz DoScaleDown and r10, PiecesThem test r10, qword[PassedPawnMask+8*(r8+64*(Us))] jz DontScaleDown DoScaleDown: cdq sub eax, edx sar eax, 1 xchg eax, ecx cdq sub eax, edx sar eax, 1 shl eax, 16 lea esi, [rax+rcx] DontScaleDown: and r8d, 7 add esi, dword[PassedFile+4*r8] addsub dword[.ei.score], esi test r9, r9 jnz NextPawn AllDone: mov rdi, qword[.ei.pi] end macro macro EvalSpace Us ; in: rbp position ; rbx state ; rdi qword[.ei.pi] ; r10-r15 various bitboards ; rsp evaluation info local addsub, Them, SpaceMask local AttackedByUs, AttackedByThem local PiecesPawn, PiecesAll, PiecesUs, PiecesThem if Us = White ;addsub equ add macro addsub a, b add a, b end macro AttackedByUs equ r12 AttackedByThem equ r13 PiecesPawn equ r11 PiecesUs equ r14 PiecesThem equ r15 Them = Black SpaceMask = ((FileCBB or FileDBB or FileEBB or FileFBB) \ and (Rank2BB or Rank3BB or Rank4BB)) else ;addsub equ sub macro addsub a, b sub a, b end macro AttackedByUs equ r13 AttackedByThem equ r12 PiecesPawn equ r11 PiecesUs equ r15 PiecesThem equ r14 Them = White SpaceMask = ((FileCBB or FileDBB or FileEBB or FileFBB) \ and (Rank7BB or Rank6BB or Rank5BB)) end if Assert e, PiecesPawn, qword[rbp+Pos.typeBB+8*Pawn], 'assertion PiecesPawn failed in EvalSpace' Assert e, AttackedByUs, qword[.ei.attackedBy+8*(8*Us+0)], 'assertion AttackedByUs failed in EvalSpace' Assert e, AttackedByThem, qword[.ei.attackedBy+8*(8*Them+0)], 'assertion AttackedByThem failed in EvalSpace' Assert e, PiecesUs, qword[rbp+Pos.typeBB+8*Us], 'assertion PiecesUs failed in EvalSpace' Assert e, PiecesThem, qword[rbp+Pos.typeBB+8*Them], 'assertion PiecesThem failed in EvalSpace' mov rdx, PiecesUs and rdx, PiecesPawn ; rdx = pos.pieces(Us, PAWN) _andn rax, AttackedByUs, AttackedByThem or rax, qword[.ei.attackedBy+8*(8*Them+Pawn)] or rax, rdx mov rcx, SpaceMask _andn rax, rax, rcx ; rax = safe mov rcx, rdx if Us eq White shr rdx, 8 or rcx, rdx mov rdx, rcx shr rdx, 16 or rcx, rdx else if Us eq Black shl rdx, 8 or rcx, rdx mov rdx, rcx shl rdx, 16 or rcx, rdx end if ; rcx = behind and rcx, rax if Us eq White shl rax, 32 else if Us eq Black shr rax, 32 end if or rax, rcx _popcnt rax, rax, rdx movzx ecx, byte[rdi+PawnEntry.openFiles] add ecx, ecx _popcnt rdx, qword[rbp+Pos.typeBB+8*Us], r8 sub edx, ecx imul edx, edx imul eax, edx shr eax, 4 ; eax>0 so division by 16 is easy shl eax, 16 addsub esi, eax end macro Evaluate_Cold: virtual at rsp .ei EvalInfo end virtual calign 16 .DoPawnEval: mov byte[rdi + PawnEntry.weakUnopposed], 0 mov qword[rbp+Pos.state], rbx EvalPawns White mov dword[rdi+PawnEntry.score], esi EvalPawns Black mov rbx, qword[rbp+Pos.state] movzx ecx, byte[rdi+PawnEntry.semiopenFiles+0] movzx eax, byte[rdi+PawnEntry.semiopenFiles+1] mov r8, qword[rbx+State.pawnKey] mov edx, ecx xor ecx, eax and edx, eax mov eax, dword[rdi+PawnEntry.score] sub eax, esi _popcnt rcx, rcx, r9 _popcnt rdx, rdx, r9 mov qword[rdi+PawnEntry.key], r8 mov dword[rdi+PawnEntry.score], eax mov byte[rdi+PawnEntry.asymmetry], cl mov byte[rdi+PawnEntry.openFiles], dl jmp Evaluate.DoPawnEvalReturn .ReturnLazyEval: ;ProfileInc EvaluateLazy add eax, 2*(LazyThreshold+1) mov ecx, dword[rbp+Pos.sideToMove] neg ecx cdq ; divide eax by 2 sub eax, edx ; sar eax, 1 ; xor eax, ecx sub eax, ecx Display 2, "Lazy Eval returning %i0%n" add rsp, sizeof.EvalInfo pop r15 r14 r13 r12 rdi rsi rbx ret calign 16 ShelterStormWhite: ShelterStorm0: ShelterStorm White calign 16 ShelterStormBlack: ShelterStorm1: ShelterStorm Black calign 64 Evaluate: ; in rbp address of Pos struct ; rbx address of State struct ; out eax evaluation ;ProfileInc Evaluate push rbx rsi rdi r12 r13 r14 r15 sub rsp, sizeof.EvalInfo virtual at rsp .ei EvalInfo end virtual mov rdi, qword[rbx+State.pawnKey] and edi, PAWN_HASH_ENTRY_COUNT-1 imul edi, sizeof.PawnEntry add rdi, qword[rbp+Pos.pawnTable] mov r15, qword[rdi+PawnEntry.key] mov qword[.ei.pi], rdi mov eax, dword[rbx+State.psq] mov dword[.ei.score], eax mov r12, qword[rbp+Pos.typeBB+8*Queen] mov r13, qword[rbp+Pos.typeBB+8*Rook] or r13, r12 mov r14, qword[rbp+Pos.typeBB+8*White] or r14, qword[rbp+Pos.typeBB+8*Black] or r12, qword[rbp+Pos.typeBB+8*Bishop] mov esi, dword[rbp+Pos.sideToMove] movzx eax, byte[rbp+Pos.pieceList+16*(8*White+King)] movzx edx, byte[rbp+Pos.pieceList+16*(8*Black+King)] mov rax, qword[KingAttacks+8*rax] mov rdx, qword[KingAttacks+8*rdx] xor rcx, rcx mov qword[.ei.attackedBy+8*(8*White+0 )], rcx mov qword[.ei.attackedBy+8*(8*White+King)], rax mov qword[.ei.attackedBy+8*(8*Black+0 )], rcx mov qword[.ei.attackedBy+8*(8*Black+King)], rdx mov rax, qword[rbp+Pos.typeBB+8*White] mov rdx, qword[rbp+Pos.typeBB+8*Black] and rax, qword[rbx+State.blockersForKing+8*White] and rdx, qword[rbx+State.blockersForKing+8*Black] mov qword[.ei.pinnedPieces+8*White], rax mov qword[.ei.pinnedPieces+8*Black], rdx mov rsi, qword[rbx+State.materialKey] and esi, MATERIAL_HASH_ENTRY_COUNT-1 ;imul esi, sizeof.MaterialEntry shl esi, 4 add rsi, qword[rbp+Pos.materialTable] mov rdx, qword[rsi+MaterialEntry.key] movsx eax, word[rsi+MaterialEntry.value] movzx ecx, byte[rsi+MaterialEntry.evaluationFunction] mov qword[.ei.me], rsi cmp rdx, qword[rbx+State.materialKey] ;ProfileCond ne, DoMaterialEval jne DoMaterialEval ; 0.87% .DoMaterialEvalReturn: imul eax, 0x00010001 add dword[.ei.score], eax test ecx, ecx ;ProfileCond nz, HaveSpecializedEval jnz HaveSpecializedEval mov eax, dword[rdi+PawnEntry.score] cmp r15, qword[rbx+State.pawnKey] ;ProfileCond ne, DoPawnEval jne Evaluate_Cold.DoPawnEval ; 6.34% .DoPawnEvalReturn: add eax, dword[.ei.score] mov dword[.ei.score], eax ; We have taken into account all cheap evaluation terms. ; If score exceeds a threshold return a lazy evaluation. ; lazy eval is called about 5% of the time ; checking if abs(a/2) > LazyThreshold ; is the same as checking if a-2*(LazyThreshold+1) ; is in the unsigned range [0,-4*(LazyThreshold+1)] lea edx, [rax+0x08000] sar edx, 16 movsx eax, ax lea eax, [rax+rdx-2*(LazyThreshold+1)] cmp eax, 1-4*(LazyThreshold+1) jb Evaluate_Cold.ReturnLazyEval EvalInit White EvalInit Black mov r8, qword[rbp+Pos.typeBB+8*White] mov r9, qword[rbp+Pos.typeBB+8*Black] mov rcx, Rank2BB+Rank3BB mov rsi, Rank7BB+Rank6BB mov rax, r8 or rax, r9 mov rdx, rax mov r13, rax ; r13 = all pieces ShiftBB DELTA_S, rax ShiftBB DELTA_N, rdx and r8, qword[rbp+Pos.typeBB+8*Pawn] and r9, qword[rbp+Pos.typeBB+8*Pawn] or rax, rcx or rdx, rsi and rax, r8 and rdx, r9 movzx ecx, byte[rbp+Pos.pieceList+16*(8*White+King)] movzx esi, byte[rbp+Pos.pieceList+16*(8*Black+King)] or rax, qword[.ei.attackedBy+8*(8*Black+Pawn)] or rdx, qword[.ei.attackedBy+8*(8*White+Pawn)] bts rax, rcx bts rdx, rsi not rax not rdx mov qword[.ei.mobilityArea+8*White], rax mov qword[.ei.mobilityArea+8*Black], rdx ; EvalPieces adds to esi mov esi, dword[.ei.score] xor r15, r15 ; prepare for dirty trick mov r12, qword[rbp+Pos.typeBB+8*Knight] EvalPieces White, Knight EvalPieces Black, Knight mov r12, qword[rbp+Pos.typeBB+8*Bishop] EvalPieces White, Bishop EvalPieces Black, Bishop mov r12, qword[rbp+Pos.typeBB+8*Rook] EvalPieces White, Rook EvalPieces Black, Rook mov r12, qword[rbp+Pos.typeBB+8*Queen] EvalPieces White, Queen EvalPieces Black, Queen mov r14, qword[rbp+Pos.typeBB+8*White] mov r15, qword[rbp+Pos.typeBB+8*Black] mov r12, qword[.ei.attackedBy+8*(8*White+0)] mov r13, qword[.ei.attackedBy+8*(8*Black+0)] ; EvalKing adds to dword[.ei.score] mov dword[.ei.score], esi EvalKing Black EvalKing White ; EvalPassedPawns adds to dword[.ei.score] mov r9, qword[rdi+PawnEntry.passedPawns+8*White] test r9, r9 jnz Evaluate_Cold2.EvalPassedPawns0 mov r9, qword[rdi+PawnEntry.passedPawns+8*Black] test r9, r9 jnz Evaluate_Cold2.EvalPassedPawns1 .EvalPassedPawnsRet: mov esi, dword[.ei.score] ; EvalThreats, EvalSpace add to esi ; EvalPassedPawns and EvalThreats are switched because ; EvalThreats and EvalSpace share r10-r15 mov r11, qword[rbp+Pos.typeBB+8*Pawn] EvalThreats Black EvalThreats White movzx eax, word[rbx+State.npMaterial+2*0] movzx ecx, word[rbx+State.npMaterial+2*1] add eax, ecx cmp eax, 12222 jb .SkipSpace EvalSpace Black EvalSpace White .SkipSpace: mov r14, rdi mov r15, qword[.ei.me] ; Evaluate position potential for the winning side mov r8, FileABB or FileBBB or FileCBB or FileDBB mov rcx, FileEBB or FileFBB or FileGBB or FileHBB and r8, r11 and rcx, r11 mov eax, 16 neg r8 sbb r8, r8 and r8, rcx cmovnz r8d, eax _popcnt rax, r11, rcx movzx edx, byte[rdi+PawnEntry.asymmetry] lea edx, [rdx+rax-17] lea r8d, [r8+4*rax] lea r8d, [r8+8*rdx] movsx r9d, si sar r9d, 31 movsx edi, si sub esi, r9d xor edi, r9d sub edi, r9d neg edi movzx eax, byte[rbp+Pos.pieceList+16*(8*White+King)] movzx ecx, byte[rbp+Pos.pieceList+16*(8*Black+King)] and eax, 0111000b and ecx, 0111000b sub eax, ecx cdq xor eax, edx sub eax, edx sub r8d, eax movzx eax, byte[rbp+Pos.pieceList+16*(8*White+King)] movzx ecx, byte[rbp+Pos.pieceList+16*(8*Black+King)] and eax, 7 and ecx, 7 sub eax, ecx cdq xor eax, edx sub eax, edx lea eax, [r8+8*rax] ; eax = initiative cmp eax, edi cmovl eax, edi test edi, edi cmovz r9d, eax xor eax, r9d add esi, eax ; esi = score ; r14 = ei.pi ; Evaluate scale factor for the winning side movsx r12d, si lea r13d, [r12-1] shr r13d, 31 movzx ecx, byte[r15+MaterialEntry.scalingFunction+r13] movzx eax, byte[r15+MaterialEntry.factor+r13] movzx edx, byte[r15+MaterialEntry.gamePhase] add esi, 0x08000 sar esi, 16 test ecx, ecx jnz Evaluate_Cold2.HaveScaleFunction ; 1.98% .HaveScaleFunctionReturn: lea ecx, [rax-48] mov r10, qword[rbp+Pos.typeBB+8*Bishop] mov r8, qword[rbp+Pos.typeBB+8*White] mov r9, qword[rbp+Pos.typeBB+8*Black] mov edi, dword[rbx+State.npMaterial] and r8, r10 and r9, r10 test ecx, not 16 jnz .ScaleFactorDone _blsr r8, r8, rcx _blsr r9, r9, rcx mov r11, qword[rbp+Pos.typeBB+8*Pawn] mov rcx, DarkSquares test rcx, r10 jz .NotOppBishop mov rcx, LightSquares test rcx, r10 jz .NotOppBishop or r8, r9 jnz .NotOppBishop _blsr rcx, r11, r8 mov eax, 46 neg rcx sbb ecx, ecx and ecx, 31-9 add ecx, 9 cmp edi, (BishopValueMg shl 16) + BishopValueMg cmove eax, ecx jmp .ScaleFactorDone .NotOppBishop: lea r9d, [r12+BishopValueEg] and r11, qword[rbp+Pos.typeBB+8*r13] xor r13d, 1 cmp r9d, 2*BishopValueEg+1 jae .ScaleFactorDone shl r13, 4+3 movzx r9d, byte[rbp+Pos.pieceList+16*(King)+r13] lea r8, [PassedPawnMask+4*r13] test r11, qword[r8+8*r9] jz .ScaleFactorDone _popcnt rcx, r11, r9 cmp ecx, 3 jae .ScaleFactorDone imul ecx, 7 add ecx, 37 mov eax, ecx .ScaleFactorDone: ; eax = scale factor ; edx = phase ; esi = mg_score(score) ; r12d = eg_value(score) ; adjust score for side to move ;// Interpolate between a middlegame and a (scaled by 'sf') endgame score ;Value v = mg_value(score) * int(ei.me->game_phase()) ; + eg_value(score) * int(PHASE_MIDGAME - ei.me->game_phase()) * sf / SCALE_FACTOR_NORMAL; ;v /= int(PHASE_MIDGAME); mov ecx, dword[rbp+Pos.sideToMove] mov edi, 128 sub edi, edx imul edi, r12d mov r11d, ecx imul edi, eax lea r14d, [rdi+3FH] test edi, edi cmovs edi, r14d imul esi, edx sar edi, 6 lea edx, [rdi+rsi] lea eax, [rdx+7FH] test edx, edx cmovs edx, eax neg r11d sar edx, 7 xor edx, r11d lea eax, [rcx+rdx+Eval_Tempo] Display 2, "Evaluate returning %i0%n" add rsp, sizeof.EvalInfo pop r15 r14 r13 r12 rdi rsi rbx ret Evaluate_Cold2: virtual at rsp .ei EvalInfo end virtual .HaveScaleFunction: mov eax, ecx shr eax, 1 mov eax, dword[EndgameScale_FxnTable+4*rax] and ecx, 1 call rax Display 2, "Scale returned %i0%n" cmp eax, SCALE_FACTOR_NONE movzx edx, byte[r15+MaterialEntry.gamePhase] movzx ecx, byte[r15+MaterialEntry.factor+r13] cmove eax, ecx jmp Evaluate.HaveScaleFunctionReturn calign 16 .EvalPassedPawns0: EvalPassedPawns White mov r9, qword[rdi+PawnEntry.passedPawns+8*Black] test r9, r9 jz Evaluate.EvalPassedPawnsRet calign 8 .EvalPassedPawns1: EvalPassedPawns Black jmp Evaluate.EvalPassedPawnsRet HaveSpecializedEval: mov eax, ecx shr eax, 1 mov eax, dword[EndgameEval_FxnTable+4*rax] and ecx, 1 call rax Display 2, "Special Eval returned %i0%n" add rsp, sizeof.EvalInfo pop r15 r14 r13 r12 rdi rsi rbx ret ; this is rarely called and should preserve rdi,r12,r13,r14,r15 (as well as rbx and rbp) DoMaterialEval: ; in: rsi address of MaterialEntry ; rbp address of position ; rbx address of state ; rsp address of EvalInfo ; out: return is .DoMaterialEvalReturn ; eax sign_ext(word[rsi+MaterialEntry.value]) ; ecx zero_ext(byte[rsi+MaterialEntry.evaluationFunction]) push r12 r13 r14 r15 mov r12, qword[rbx+State.materialKey] movzx r14d, word[rbx+State.npMaterial+2*0] movzx r15d, word[rbx+State.npMaterial+2*1] lea eax, [r14+r15] xor edx, edx mov ecx, MidgameLimit - EndgameLimit sub eax, EndgameLimit cmovs eax, edx cmp eax, ecx cmovae eax, ecx shl eax, 7 div ecx xor edx, edx mov qword[rsi+MaterialEntry.key], r12 mov byte[rsi+MaterialEntry.scalingFunction+0], dl mov byte[rsi+MaterialEntry.scalingFunction+1], dl mov byte[rsi+MaterialEntry.evaluationFunction], dl mov byte[rsi+MaterialEntry.gamePhase], al mov byte[rsi+MaterialEntry.factor+1*White], SCALE_FACTOR_NORMAL mov byte[rsi+MaterialEntry.factor+1*Black], SCALE_FACTOR_NORMAL mov word[rsi+MaterialEntry.value], dx ; Let's look if we have a specialized evaluation function for this particular ; material configuration. Firstly we look for a fixed configuration one, then ; for a generic one if the previous search failed. lea r10, [EndgameEval_Map] lea r11, [EndgameEval_Map+2*ENDGAME_EVAL_MAP_SIZE*sizeof.EndgameMapEntry] lea r13, [rsi+MaterialEntry.evaluationFunction] .NextEvalKey: mov rdx, qword[r10+EndgameMapEntry.key] mov ecx, dword[r10+EndgameMapEntry.entri] add r10, sizeof.EndgameMapEntry cmp rdx, qword[rsi+MaterialEntry.key] je .FoundEvalFxn cmp r10, r11 jb .NextEvalKey mov r8, qword[rbp+Pos.typeBB+8*Black] mov r9, qword[rbp+Pos.typeBB+8*White] .Try_KXK_White: mov ecx, 2*EndgameEval_KXK_index _blsr rdx, r8 jnz .Try_KXK_Black cmp r14d, RookValueMg jge .FoundEvalFxn .Try_KXK_Black: add ecx, 1 _blsr rdx, r9 jnz .Try_KXK_Done cmp r15d, RookValueMg jge .FoundEvalFxn .Try_KXK_Done: ; OK, we didn't find any special evaluation function for the current material ; configuration. Is there a suitable specialized scaling function? lea r10, [EndgameScale_Map] lea r11, [EndgameScale_Map+2*ENDGAME_SCALE_MAP_SIZE*sizeof.EndgameMapEntry] .NextScaleKey: mov rdx, qword[r10+EndgameMapEntry.key] mov ecx, dword[r10+EndgameMapEntry.entri] add r10, sizeof.EndgameMapEntry cmp rdx, qword[rsi+MaterialEntry.key] je .FoundScaleFxn cmp r10, r11 jb .NextScaleKey sub rsp, 8*16 jmp .Continue .FoundScaleFxn: mov r13d, ecx and r13d, 1 lea r13, [rsi+MaterialEntry.scalingFunction+r13] xor eax, eax ; obey out condtions mov byte[r13], cl xor ecx, ecx pop r15 r14 r13 r12 jmp Evaluate.DoMaterialEvalReturn .FoundEvalFxn: xor eax, eax ; obey out condtions mov byte[r13], cl pop r15 r14 r13 r12 jmp Evaluate.DoMaterialEvalReturn .Continue: ; We didn't find any specialized scaling function, so fall back on generic ; ones that refer to more than one material distribution. Note that in this ; case we don't return after setting the function. xor r8d, r8d .CountLoop: mov rdx, qword[rbp+Pos.typeBB+r8] mov rax, qword[rbp+Pos.typeBB+8*Pawn] and rax, rdx _popcnt rax, rax, rcx mov dword[rsp+4*(r8+Pawn)], eax mov rax, qword[rbp+Pos.typeBB+8*Knight] and rax, rdx _popcnt rax, rax, rcx mov dword[rsp+4*(r8+Knight)], eax mov rax, qword[rbp+Pos.typeBB+8*Bishop] and rax, rdx _popcnt rax, rax, rcx mov dword[rsp+4*(r8+Bishop)], eax cmp eax, 2 sbb eax, eax add eax, 1 mov dword[rsp+4*(r8+1)], eax ; bishop pair mov rax, qword[rbp+Pos.typeBB+8*Rook] and rax, rdx _popcnt rax, rax, rcx mov dword[rsp+4*(r8+Rook)], eax mov rax, qword[rbp+Pos.typeBB+8*Queen] and rax, rdx _popcnt rax, rax, rcx mov dword[rsp+4*(r8+Queen)], eax add r8d, 8 cmp r8d, 16 jb .CountLoop iterate Us, White, Black if Us = White Them equ Black npMat equ r14d else Them equ White npMat equ r15d end if .Check_KBPsKs_#Us: cmp npMat, BishopValueMg jne .Check_KQKRPs_#Us mov eax, dword[rsp+4*(8*Us+Bishop)] cmp eax, 1 jne .Check_KQKRPs_#Us mov eax, dword[rsp+4*(8*Us+Pawn)] test eax, eax jz .Check_KQKRPs_#Us mov byte[rsi+MaterialEntry.scalingFunction+1*Us], 2*EndgameScale_KBPsK_index+Us jmp .Check_sDone_#Us .Check_KQKRPs_#Us: cmp npMat, QueenValueMg jne .Check_sDone_#Us mov eax, dword[rsp+4*(8*Us+Pawn)] test eax, eax jnz .Check_sDone_#Us mov eax, dword[rsp+4*(8*Us+Queen)] cmp eax, 1 jne .Check_sDone_#Us mov eax, dword[rsp+4*(8*Them+Rook)] cmp eax, 1 jne .Check_sDone_#Us mov eax, dword[rsp+4*(8*Them+Pawn)] test eax, eax jz .Check_sDone_#Us mov byte[rsi+MaterialEntry.scalingFunction+1*Us], 2*EndgameScale_KQKRPs_index+Us .Check_sDone_#Us: end iterate mov rax, qword[rbp+Pos.typeBB+8*Pawn] test r14d, r14d jnz .NotOnlyPawns test r15d, r15d jnz .NotOnlyPawns test rax, rax jz .NotOnlyPawns .OnlyPawns: mov ecx, dword[rsp+4*(8*Black+Pawn)] mov eax, ((0) shl 16) + ((2*EndgameScale_KPsK_index+White) shl 0) test ecx, ecx jz .OnlyPawnsWrite mov edx, dword[rsp+4*(8*White+Pawn)] mov eax, (((2*EndgameScale_KPsK_index+Black)) shl 8) + ((0) shl 0) test edx, edx jz .OnlyPawnsWrite xor eax, eax cmp ecx, 1 jne .OnlyPawnsWrite cmp edx, 1 jne .OnlyPawnsWrite mov eax, (((2*EndgameScale_KPKP_index+Black)) shl 8) + ((2*EndgameScale_KPKP_index+White) shl 0) .OnlyPawnsWrite: mov word[rsi+MaterialEntry.scalingFunction], ax ; write both entries .NotOnlyPawns: mov eax, dword[rsp+4*(8*White+Pawn)] test eax, eax jnz .P1 mov ecx, r14d sub ecx, r15d cmp ecx, BishopValueMg jg .P1 mov eax, 14 mov ecx, 4 cmp r15d, BishopValueMg cmovle eax, ecx mov ecx, SCALE_FACTOR_DRAW cmp r14d, RookValueMg cmovl eax, ecx mov byte[rsi+MaterialEntry.factor+1*White], al .P1: mov eax, dword[rsp+4*(8*Black+Pawn)] test eax, eax jnz .P2 mov ecx, r15d sub ecx, r14d cmp ecx, BishopValueMg jg .P2 mov eax, 14 mov ecx, 4 cmp r14d, BishopValueMg cmovle eax, ecx mov ecx, SCALE_FACTOR_DRAW cmp r15d, RookValueMg cmovl eax, ecx mov byte[rsi+MaterialEntry.factor+1*Black], al .P2: mov eax, dword[rsp+4*(8*White+Pawn)] cmp eax, 1 jne .P3 mov ecx, r14d sub ecx, r15d cmp ecx, BishopValueMg jg .P3 mov byte[rsi+MaterialEntry.factor+1*White], SCALE_FACTOR_ONEPAWN .P3: mov eax, dword[rsp+4*(8*Black+Pawn)] cmp eax, 1 jne .P4 mov ecx, r15d sub ecx, r14d cmp ecx, BishopValueMg jg .P4 mov byte[rsi+MaterialEntry.factor+1*Black], SCALE_FACTOR_ONEPAWN .P4: lea r8, [rsp+4*0] ; pieceCount[Us] lea r9, [rsp+4*8] ; pieceCount[Them] mov eax, dword[r8+4*Pawn] mov eax, dword[PawnsSet+4*rax] mov ecx, dword[r9+4*Pawn] mov ecx, dword[PawnsSet+4*rcx] sub eax, ecx xor r15d, r15d .ColorLoop: xor r10d, r10d ; partial index into quadatic mov r14d, 1 .Piece1Loop: ;mov r11d, dword[DoMaterialEval_Data.Linear+4*r14] ; v xor r11d, r11d mov r13d, 1 cmp dword[r8+4*r14], 0 je .SkipPiece .Piece2Loop: mov ecx, dword[DoMaterialEval_Data.QuadraticOurs+r10+4*r13] imul ecx, dword[r8+4*r13] add r11d, ecx mov ecx, dword[DoMaterialEval_Data.QuadraticTheirs+r10+4*r13] imul ecx, dword[r9+4*r13] add r11d, ecx add r13, 1 cmp r13d, r14d jbe .Piece2Loop lea edx, [2*r15-1] imul edx, dword[r8+4*r14] imul r11d, edx sub eax, r11d .SkipPiece: add r14, 1 add r10d, 8*4 cmp r14d, Queen jbe .Piece1Loop ; Special handling of Queen vs. Minors mov edx, [r8+4*Queen] sub edx, 1 mov ecx, [r9+4*Knight] or edx, [r9+4*Queen] jnz .NoQueenImbalance add ecx, [r9+4*Bishop] lea edx, [2*r15-1] imul edx, dword[QueenMinorsImbalance+4*rcx] sub eax, edx .NoQueenImbalance: xchg r8, r9 add r15d, 1 cmp r15d, 2 jb .ColorLoop ; divide by 16, round towards zero cdq and edx, 15 add eax, edx sar eax, 4 mov word[rsi+MaterialEntry.value], ax movzx ecx, byte[rsi+MaterialEntry.evaluationFunction] add rsp, 8*16 pop r15 r14 r13 r12 jmp Evaluate.DoMaterialEvalReturn restore MinorBehindPawn restore BishopPawns restore RookOnPawn restore TrappedRook restore WeakQueen restore OtherCheck restore CloseEnemies restore PawnlessFlank restore ThreatByHangingPawn restore ThreatByRank restore Hanging restore ThreatByPawnPush restore HinderPassedPawn restore LazyThreshold
programs/oeis/295/A295933.asm
karttu/loda
0
170178
<filename>programs/oeis/295/A295933.asm ; A295933: Number of (not necessarily maximum) cliques in the n-Sierpinski sieve graph. ; 8,20,55,160,475,1420,4255,12760,38275,114820,344455,1033360,3100075,9300220,27900655,83701960,251105875,753317620,2259952855,6779858560,20339575675,61018727020,183056181055,549168543160,1647505629475,4942516888420,14827550665255 add $0,1 mov $1,1 lpb $0,1 sub $0,1 mul $1,2 sub $2,6 trn $2,2 add $2,$1 add $2,5 mov $1,$2 lpe add $1,1
test/Common/Char.agda
larrytheliquid/agda
0
12554
<reponame>larrytheliquid/agda<gh_stars>0 module Common.Char where postulate Char : Set {-# BUILTIN CHAR Char #-}
oeis/071/A071583.asm
neoneye/loda-programs
11
83201
; A071583: Powers of 5 written backwards. ; Submitted by <NAME>(s4) ; 1,5,52,521,526,5213,52651,52187,526093,5213591,5265679,52182884,526041442,5213070221,5265153016,52187571503,526098785251,521354939267,5265627964183,52182368437091,52604613476359,521302851738674,5265101975814832,52187055982902911,52609357744640695,521359678322320892,5265674839116110941,5218283296950850547,52604191648920925273,521307590329415462681,526515874516475223139,5218752937703782166564,52609826968356346038232,521354418439628123514611,526562270476431906670285,5218231630733765403830192 mov $4,$0 mov $0,5 pow $0,$4 lpb $0 mov $2,$0 div $0,10 mod $2,10 mul $3,10 add $3,$2 lpe mov $0,$3
oeis/263/A263416.asm
neoneye/loda-programs
11
85817
<gh_stars>10-100 ; A263416: a(n) = Product_{k=0..n} (3*k+1)^(n-k). ; Submitted by <NAME> ; 1,1,4,112,31360,114150400,6648119296000,7356542888181760000,179090034163620983603200000,108995627512253039588776345600000000,1857397104331364341705287836001894400000000000,981210407605679794692064339146706741991833600000000000000,17623754930731313201216318227642100243251854967413145600000000000000000,11712145745382225765432693328030355479583455921826970238054511411200000000000000000000,311339685555608897057889387372873041898700075437611673289503404124410264682496000000000000000000000000 mov $1,1 mov $2,1 mov $3,1 lpb $0 sub $0,1 add $2,3 mul $3,$1 mul $1,$2 lpe mov $0,$3
data/phone/text/chad_caller.asm
Dev727/ancientplatinum
28
242377
ChadObservingWildText: text "I recently began" line "observing wild" cont "@" text_ram wStringBuffer4 text "." para "I've been learning" line "all sorts of new" para "things through my" line "observations." para "I wish I could" line "become a #MON" para "researcher like" line "PROF.OAK soon." done UnknownText_0x65318: text "Oh yes, I managed" line "to knock out a" para "wild @" text_ram wStringBuffer4 text " a" line "while back." para "Well, considering" line "all the studying I" para "do every day, it" line "was inevitable." done UnknownText_0x65399: text "Oh yes, I came" line "close to catching" para "a wild @" text_ram wStringBuffer4 text "," line "but it got away." para "For the longest" line "time, I've been" para "wanting to observe" line "@" text_ram wStringBuffer4 text ". Rats…" done UnknownText_0x65419: text "Want to battle?" line "I have to battle" para "every so often to" line "avoid rusting out." para "I'll be on" line "@" text_ram wStringBuffer5 text "!" done UnknownText_0x65471: text "See you later!" done ChadBlueGossipText: text "Do you know BLUE?" para "He's PROF.OAK's" line "grandson and a" para "former #MON" line "LEAGUE CHAMPION!" para "He's one super" line "#MON trainer!" done ChadDaisyGossipText: text "PROF.OAK has a" line "granddaughter" cont "named DAISY." para "When she's around," line "even the most" para "ferocious #MON" line "calm right down." done ChadProfElmGossipText: text "Everyone's talking" line "about PROF.ELM." para "He used to be an" line "assistant to the" cont "great PROF.OAK!" para "That is so cool!" line "I envy him!" done ChadDreamGossipText: text "PROF.OAK's dream" line "is to compile a" para "comprehensive" line "#DEX." para "I envy you for" line "taking part in" cont "that project…" done ChadKurtGossipText: text "Do you know KURT," line "the BALL creator?" para "He and PROF.OAK go" line "back a long way." para "I guess great" line "people attract one" cont "another!" done ChadLeagueGossipText: text "#MON LEAGUE is" line "the great gather-" cont "ing place for all" para "trainers who wish" line "to become CHAMP." para "PROF.OAK acts as" line "an advisor to the" para "#MON LEAGUE's" line "headquarters." para "He really is a" line "great man." done ChadRadioShowGossipText: text "PROF.OAK'S #MON" line "TALK is a popular" cont "radio show, right?" para "Did you know that" line "he was going to" para "turn down the show" line "at first?" para "But MARY's energy" line "and persistence" cont "wore him down." para "So we have MARY to" line "thank for it!" done ChadBattlingGossipText: text "PROF.OAK used to" line "be a trainer a" cont "long time ago." para "But rather than" line "battling, he found" para "#MON themselves" line "to be interesting." para "So he abandoned" line "his training to" para "focus on becoming" line "a researcher." done ChadDaisyTeaGossipText: text "PROF.OAK has a" line "granddaughter" cont "named DAISY." para "She has tea every" line "day for an hour" para "from three in the" line "afternoon." para "I wish I could" line "join her for tea" para "and chat about" line "PROF.OAK." done ChadTravelGossipText: text "Did you know?" line "PROF.OAK traveled" para "all over the world" line "when he was young." para "While traveling," line "he must've learned" para "about #MON" line "naturally." para "I envy him…" line "I'd like to travel" para "and learn about" line "things too…" done UnknownText_0x65a23: text "I'm going to study" line "hard so PROF.OAK" para "will make me his" line "assistant!" done UnknownText_0x65a63: text "Do you remember" line "about our battle?" para "The place is" line "@" text_ram wStringBuffer5 text "." para "Hurry over--I'm" line "waiting." done
alloy4fun_models/trainstlt/models/1/GSTyChKYCgAfWFfjD.als
Kaixi26/org.alloytools.alloy
0
1335
open main pred idGSTyChKYCgAfWFfjD_prop2 { eventually (all s:Signal | s in Green) } pred __repair { idGSTyChKYCgAfWFfjD_prop2 } check __repair { idGSTyChKYCgAfWFfjD_prop2 <=> prop2o }
tests/subnormal-target/src/calc.ads
TUM-EI-RCS/StratoX
12
12087
<gh_stars>10-100 package calc with SPARK_Mode is function calc (f1, f2: Float) return Float with Pre => f1 in -1000.0 .. 1000.0 and f2 in -1000.0 .. 1000.0; end calc;
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshc_saddr2aaddr.asm
Frodevan/z88dk
640
85087
<filename>libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshc_saddr2aaddr.asm<gh_stars>100-1000 ; void *tshc_saddr2aaddr(void *saddr) SECTION code_clib SECTION code_arch PUBLIC tshc_saddr2aaddr EXTERN asm_tshc_saddr2aaddr defc tshc_saddr2aaddr = asm_tshc_saddr2aaddr ; SDCC bridge for Classic IF __CLASSIC PUBLIC _tshc_saddr2aaddr defc _tshc_saddr2aaddr = tshc_saddr2aaddr ENDIF
FormalAnalyzer/models/meta/cap_button.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
699
<gh_stars>0 // filename: cap_button.als module cap_button open IoTBottomUp one sig cap_button extends Capability {} { attributes = cap_button_attr } abstract sig cap_button_attr extends Attribute {} one sig cap_button_attr_button extends cap_button_attr {} { values = cap_button_attr_button_val } abstract sig cap_button_attr_button_val extends AttrValue {} one sig cap_button_attr_button_val_pushed extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_held extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_double extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_pushed_2x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_pushed_3x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_pushed_4x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_pushed_5x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_pushed_6x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_2x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_3x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_4x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_5x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_6x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_down_hold extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_2x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_3x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_4x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_5x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_6x extends cap_button_attr_button_val {} one sig cap_button_attr_button_val_up_hold extends cap_button_attr_button_val {} one sig cap_button_attr_numberOfButtons extends cap_button_attr {} { values = cap_button_attr_numberOfButtons_val } abstract sig cap_button_attr_numberOfButtons_val extends AttrValue {} one sig cap_button_attr_supportedButtonValues extends cap_button_attr {} { values = cap_button_attr_supportedButtonValues_val } abstract sig cap_button_attr_supportedButtonValues_val extends AttrValue {}
examples/outdated-and-incorrect/Alonzo/PreludeList.agda
asr/agda-kanso
1
5122
<reponame>asr/agda-kanso<gh_stars>1-10 module PreludeList where open import AlonzoPrelude as Prelude open import PreludeNat infixr 50 _::_ _++_ data List (A : Set) : Set where [] : List A _::_ : A -> List A -> List A {-# BUILTIN LIST List #-} {-# BUILTIN NIL [] #-} {-# BUILTIN CONS _::_ #-} [_] : {A : Set} -> A -> List A [ x ] = x :: [] length : {A : Set} -> List A -> Nat length [] = 0 length (_ :: xs) = 1 + length xs map : {A B : Set} -> (A -> B) -> List A -> List B map f [] = [] map f (x :: xs) = f x :: map f xs _++_ : {A : Set} -> List A -> List A -> List A [] ++ ys = ys (x :: xs) ++ ys = x :: (xs ++ ys) zipWith : {A B C : Set} -> (A -> B -> C) -> List A -> List B -> List C zipWith f [] [] = [] zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys zipWith f [] (_ :: _) = [] zipWith f (_ :: _) [] = [] foldr : {A B : Set} -> (A -> B -> B) -> B -> List A -> B foldr f z [] = z foldr f z (x :: xs) = f x (foldr f z xs) foldl : {A B : Set} -> (B -> A -> B) -> B -> List A -> B foldl f z [] = z foldl f z (x :: xs) = foldl f (f z x) xs replicate : {A : Set} -> Nat -> A -> List A replicate zero x = [] replicate (suc n) x = x :: replicate n x iterate : {A : Set} -> Nat -> (A -> A) -> A -> List A iterate zero f x = [] iterate (suc n) f x = x :: iterate n f (f x) splitAt : {A : Set} -> Nat -> List A -> List A × List A splitAt zero xs = < [] , xs > splitAt (suc n) [] = < [] , [] > splitAt (suc n) (x :: xs) = add x $ splitAt n xs where add : _ -> List _ × List _ -> List _ × List _ add x < ys , zs > = < x :: ys , zs > reverse : {A : Set} -> List A -> List A reverse xs = foldl (flip _::_) [] xs
src/dict.asm
Veltas/zenv
6
12317
<filename>src/dict.asm ; vi:syntax=z80 ; ZEnv - Forth for the ZX Spectrum ; Copyright 2021 (C) - <NAME>, MIT Licence ; https://github.com/veltas/zenv ; Dictionary words ; \ Remove named word and everything in dictionary after ; ( " name" --) ; : FORGET HEADER forget, "FORGET", 0 forget: CALL colon_code ; BL WORD DX bl: DX word ; ( str) ; SYM-LAST @ DX sym_last: DX fetch ; ( str sym) ; BEGIN .begin: ; ?DUP 0= IF CWHAT? THEN DX question_dup: DX zero_equals: DX if_raw: DB .then-$-1: DX cwhat_question .then: ; 2DUP >SYM ROT COUNT COMPARE WHILE DX two_dup: DX to_sym: DX rot: DX count: DX compare: DX if_raw DB .repeat-$-1 ; @ DX fetch ; REPEAT DX again_raw DB .begin-$+256 .repeat: ; NIP DX nip ; ( sym) ; DUP @ SWAP DX dup: DX fetch: DX swap ; ( prev-sym sym) ; H ! DX h_: DX store ; ( prev-sym) ; SYM-LAST ! ; DX sym_last: DX store: DX exit
src/strings/check.asm
majioa/fleco
0
11438
<filename>src/strings/check.asm<gh_stars>0 ;[]-----------------------------------------------------------------[] ;| CHECK.ASM -- string checking functions | ;[]-----------------------------------------------------------------[] ; ; $Copyright: 2005$ ; $Revision: 1.1.1.1 $ ; ;bool __fastcall IsDelimiter(const AnsiString& delimiters, int index) const; ;bool __fastcall IsEmpty() const; ;bool __fastcall IsPathDelimiter(int index) const; %include 'constant.inc' ; EXTERN GetSymbol ; EXTERN GetRutfSymbol ; EXTERN CompareSymbol ; EXTERN ConvertSymbol EXTERN ConvertSymbol_table EXTERN CompareSymbol_table GLOBAL @FastString@IsDelimiter$xqqrrx10FastStringui GLOBAL @FastString@IsEmpty$xqqrv GLOBAL @FastString@IsPathDelimiter$xqqrui GLOBAL IsEmpty section _TEXT IsEmpty: mov eax, [eax] or eax, eax jz IsEmpty_exit cmp dword [eax-SIZEOF_FASTSTRING+FastString.Length],0 IsEmpty_exit: ret @FastString@IsDelimiter$xqqrrx10FastStringui: ;in ;eax: this ;edx: delimiters fast string ;ecx: index call IsEmpty jz @FastString@IsDelimiter$xqqrrx10FastStringui_exit push ebx push esi push edi mov esi, [eax] mov edi, edx ; ; mov eax, [esi-SIZEOF_FASTSTRING+FastString.Locale] ; movzx eax, byte [eax-SIZEOF_LOCALE+Locale.Type] movzx eax, word [esi-SIZEOF_FASTSTRING+FastString.CP] shr eax, 12 and eax, 1100b movzx edx, word [edi-SIZEOF_FASTSTRING+FastString.CP] shr edx, 14 call [ConvertSymbol_table+edx*4+eax] ; call GetCPS call [CompareSymbol_table+edx*4] pop edi pop esi pop ebx @FastString@IsDelimiter$xqqrrx10FastStringui_exit: ret @FastString@IsEmpty$xqqrv: call IsEmpty setz al ret @FastString@IsPathDelimiter$xqqrui: ;in ;eax: this ;edx: index call IsEmpty jz @FastString@IsPathDelimiter$xqqrui_exit push ebx mov ebx, [eax] movzx eax, word [ebx-SIZEOF_FASTSTRING+FastString.CP] shr eax, 14 or eax, 1100b call [ConvertSymbol_table+eax] ; call GetRutfSymbol cmp eax, [PathDelimiter] setz al pop ebx @FastString@IsPathDelimiter$xqqrui_exit: ret section _DATA PathDelimiter: dd '/'
8088/mintimer/multimer.asm
reenigne/reenigne
92
220
%include "../defaults_bin.asm" in al,0x61 and al,0xfc or al,1 out 0x61,al ; Enable auto-EOI mov al,0x13 ; ICW4 needed, not cascaded, call address interval 8, edge triggered out 0x20,al ; Set ICW1 mov al,0x08 ; Interrupt vector address out 0x21,al ; Set ICW2 mov al,0x0f ; 8086/808 mode, auto-EOI, buffered mode/master, not special fully nested mode out 0x21,al ; Set ICW4 mov al,0xbc ; Enable IRQs 0 (timer), 1 (keyboard) and 6 (floppy disk). out 0x21,al ; Leave disabled 2 (EGA/VGA/slave 8259) 3 (COM2/COM4), 4 (COM1/COM3), 5 (hard drive, LPT2) and 7 (LPT1) xor ax,ax mov ds,ax mov word[8*4],irq0 mov [8*4+2],cs xor ax,ax doTest: push ax safeRefreshOff writePIT16 0, 2, 2 ; Ensure an IRQ0 is pending writePIT16 0, 2, 100 ; Queue an IRQ0 to execute from HLT sti hlt ; ACK first IRQ0 hlt ; wait for second IRQ0 writePIT16 0, 2, 0 ; Queue an IRQ0 for after the test in case of crash writePIT16 2, 2, 0 ; ***TIMING START*** pop ax push ax imul ah mov al,0x80 out 0x43,al ; ***TIMING END*** in al,0x42 mov bl,al in al,0x42 mov bh,al mov al,0x80 out 0x43,al in al,0x42 mov cl,al in al,0x42 mov ch,al mov al,0x80 out 0x43,al in al,0x42 mov dl,al in al,0x42 mov dh,al mov al,0x80 out 0x43,al in al,0x42 mov ah,al in al,0x42 xchg ah,al add bx,ax add bx,cx add bx,dx push bx refreshOn pop ax neg ax sub al,200 - '0' cmp al,32 jae noSaturate mov al,32 noSaturate: outputCharacter pop ax inc ax jz done jmp doTest done: complete irq0: iret
maps/CeladonMansion3F.asm
genterz/pokecross
28
95741
<reponame>genterz/pokecross<gh_stars>10-100 object_const_def ; object_event constants const CELADONMANSION3F_COOLTRAINER_M const CELADONMANSION3F_GYM_GUY const CELADONMANSION3F_SUPER_NERD const CELADONMANSION3F_FISHER CeladonMansion3F_MapScripts: db 0 ; scene scripts db 0 ; callbacks GameFreakGameDesignerScript: faceplayer opentext writetext GameFreakGameDesignerText readvar VAR_DEXCAUGHT ifgreater NUM_POKEMON - 2 - 1, .CompletedPokedex ; ignore Mew and Celebi waitbutton closetext end .CompletedPokedex: buttonsound writetext GameFreakGameDesignerCompletedPokedexText playsound SFX_DEX_FANFARE_230_PLUS waitsfx writetext GameFreakGameDesignerPauseForDiplomaText buttonsound special Diploma writetext GameFreakGameDesignerAfterDiplomaText waitbutton closetext setevent EVENT_ENABLE_DIPLOMA_PRINTING end GameFreakGraphicArtistScript: faceplayer opentext checkevent EVENT_ENABLE_DIPLOMA_PRINTING iftrue .CanPrintDiploma writetext GameFreakGraphicArtistText waitbutton closetext end .CanPrintDiploma: writetext GameFreakGraphicArtistPrintDiplomaText yesorno iffalse .Refused special PrintDiploma closetext end .Refused: writetext GameFreakGraphicArtistRefusedText waitbutton closetext end .CancelPrinting: ; unused writetext GameFreakGraphicArtistErrorText waitbutton closetext end GameFreakProgrammerScript: jumptextfaceplayer GameFreakProgrammerText GameFreakCharacterDesignerScript: jumptextfaceplayer GameFreakCharacterDesignerText CeladonMansion3FDevRoomSign: jumptext CeladonMansion3FDevRoomSignText CeladonMansion3FDrawing: jumptext CeladonMansion3FDrawingText CeladonMansion3FGameProgram: jumptext CeladonMansion3FGameProgramText CeladonMansion3FReferenceMaterial: jumptext CeladonMansion3FReferenceMaterialText GameFreakGameDesignerText: text "Is that right?" para "I'm the GAME" line "DESIGNER!" para "Filling up your" line "#DEX is tough," cont "but don't give up!" done GameFreakGameDesignerCompletedPokedexText: text "Wow! Excellent!" line "You completed your" cont "#DEX!" para "Congratulations!" done GameFreakGameDesignerPauseForDiplomaText: text "…" done GameFreakGameDesignerAfterDiplomaText: text "The GRAPHIC ARTIST" line "will print out a" cont "DIPLOMA for you." para "You should go show" line "it off." done GameFreakGraphicArtistText: text "I'm the GRAPHIC" line "ARTIST." para "I drew you!" done GameFreakGraphicArtistPrintDiplomaText: text "I'm the GRAPHIC" line "ARTIST." para "Oh, you completed" line "your #DEX?" para "Want me to print" line "out your DIPLOMA?" done GameFreakGraphicArtistRefusedText: text "Give me a shout if" line "you want your" cont "DIPLOMA printed." done GameFreakGraphicArtistErrorText: text "Something's wrong." line "I'll have to can-" cont "cel printing." done GameFreakProgrammerText: text "Who, me? I'm the" line "PROGRAMMER." para "Play the slot" line "machines!" done GameFreakCharacterDesignerText: text "Aren't the TWINS" line "adorable?" para "JASMINE's pretty" line "too." para "Oh, I love them!" done CeladonMansion3FDevRoomSignText: text "GAME FREAK" line "DEVELOPMENT ROOM" done CeladonMansion3FDrawingText: text "It's a detailed" line "drawing of a" cont "pretty girl." done CeladonMansion3FGameProgramText: text "It's the game" line "program. Messing" para "with it could put" line "a bug in the game!" done CeladonMansion3FReferenceMaterialText: text "It's crammed with" line "reference materi-" cont "als. There's even" cont "a # DOLL." done CeladonMansion3F_MapEvents: db 0, 0 ; filler db 4 ; warp events warp_event 0, 0, CELADON_MANSION_ROOF, 1 warp_event 1, 0, CELADON_MANSION_2F, 2 warp_event 6, 0, CELADON_MANSION_2F, 3 warp_event 7, 0, CELADON_MANSION_ROOF, 2 db 0 ; coord events db 4 ; bg events bg_event 5, 8, BGEVENT_UP, CeladonMansion3FDevRoomSign bg_event 4, 3, BGEVENT_UP, CeladonMansion3FDrawing bg_event 1, 6, BGEVENT_UP, CeladonMansion3FGameProgram bg_event 1, 3, BGEVENT_UP, CeladonMansion3FReferenceMaterial db 4 ; object events object_event 3, 6, SPRITE_COOLTRAINER_M, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GameFreakGameDesignerScript, -1 object_event 3, 4, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GameFreakGraphicArtistScript, -1 object_event 0, 7, SPRITE_SUPER_NERD, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, GameFreakProgrammerScript, -1 object_event 0, 4, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_UP, 2, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, GameFreakCharacterDesignerScript, -1
Irvine/Examples/ch07/32 bit/Shrd.asm
alieonsido/ASM_TESTING
0
7147
; SHRD Example (Shrd.asm) Comment ! This program shifts an array of five 32-bit integers using the SHRD instruction. It shifts a series of consecutive doublewords 4 bits to the right. The number is in little Endian order. ! INCLUDE Irvine32.inc COUNT = 4 ; shift count .data array DWORD 648B2165h,8C943A29h,6DFA4B86h,91F76C04h,8BAF9857h .code main PROC mov bl,COUNT call ShiftDoublewords ; Display the results mov esi,OFFSET array mov ecx,LENGTHOF array mov ebx,TYPE array call DumpMem exit main ENDP ;--------------------------------------------------------------- ShiftDoublewords PROC ; ; Shifts an array of doublewords to the right. ; The array is a global variable. ; Receives: BL = number of bits to shift ; Returns: nothing ;--------------------------------------------------------------- mov esi,OFFSET array mov ecx,(LENGTHOF array) - 1 L1: push ecx ; save loop counter mov eax,[esi + TYPE DWORD] mov cl,bl ; shift count shrd [esi],eax,cl ; shift EAX into high bits of [esi] add esi,TYPE DWORD ; point to next doubleword pair pop ecx ; restore loop counter loop L1 ; Right-shift the last doubleword shr DWORD PTR [esi],COUNT ret ShiftDoublewords ENDP END main
programs/oeis/007/A007904.asm
karttu/loda
0
89256
; A007904: Crystal ball sequence for diamond. ; 1,5,17,41,83,147,239,363,525,729,981,1285,1647,2071,2563,3127,3769,4493,5305,6209,7211,8315,9527,10851,12293,13857,15549,17373,19335,21439,23691,26095,28657,31381,34273,37337,40579,44003,47615,51419,55421,59625,64037,68661,73503,78567,83859,89383,95145,101149,107401,113905,120667,127691,134983,142547,150389,158513,166925,175629,184631,193935,203547,213471,223713,234277,245169,256393,267955,279859,292111,304715,317677,331001,344693,358757,373199,388023,403235,418839,434841,451245,468057,485281,502923,520987,539479,558403,577765,597569,617821,638525,659687,681311,703403,725967,749009,772533,796545,821049,846051,871555,897567,924091,951133,978697,1006789,1035413,1064575,1094279,1124531,1155335,1186697,1218621,1251113,1284177,1317819,1352043,1386855,1422259,1458261,1494865,1532077,1569901,1608343,1647407,1687099,1727423,1768385,1809989,1852241,1895145,1938707,1982931,2027823,2073387,2119629,2166553,2214165,2262469,2311471,2361175,2411587,2462711,2514553,2567117,2620409,2674433,2729195,2784699,2840951,2897955,2955717,3014241,3073533,3133597,3194439,3256063,3318475,3381679,3445681,3510485,3576097,3642521,3709763,3777827,3846719,3916443,3987005,4058409,4130661,4203765,4277727,4352551,4428243,4504807,4582249,4660573,4739785,4819889,4900891,4982795,5065607,5149331,5233973,5319537,5406029,5493453,5581815,5671119,5761371,5852575,5944737,6037861,6131953,6227017,6323059,6420083,6518095,6617099,6717101,6818105,6920117,7023141,7127183,7232247,7338339,7445463,7553625,7662829,7773081,7884385,7996747,8110171,8224663,8340227,8456869,8574593,8693405,8813309,8934311,9056415,9179627,9303951,9429393,9555957,9683649,9812473,9942435,10073539,10205791,10339195,10473757,10609481,10746373,10884437,11023679,11164103,11305715,11448519,11592521,11737725,11884137,12031761,12180603,12330667,12481959,12634483,12788245,12943249 mov $2,$0 add $2,1 mov $9,$0 lpb $2,1 mov $0,$9 sub $2,1 sub $0,$2 mov $6,$0 sub $6,$0 pow $0,2 mul $0,5 mov $5,$6 add $5,$0 mov $7,$5 mov $8,10 lpb $0,1 add $3,5 mov $4,$3 log $4,2 mov $0,$4 mov $3,1 mov $6,2 add $7,$8 div $7,2 add $6,$7 lpe sub $6,5 pow $6,$3 add $1,$6 lpe
stm32l0/stm32gd-usart-peripheral.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
20086
<reponame>ekoeppen/STM32_Generic_Ada_Drivers with STM32_SVD; use STM32_SVD; with STM32GD.Clock; with STM32GD.Clock.Tree; generic USART : STM32GD.USART.USART_Instance; Speed : UInt32; with package Clock_Tree is new STM32GD.Clock.Tree (<>); Clock : STM32GD.Clock.Clock_Type; RX_DMA_Buffer_Size : in Natural := 0; package STM32GD.USART.Peripheral is pragma Preelaborate; RX_DMA_Buffer: array (1 .. RX_DMA_Buffer_Size) of Byte; procedure Init; procedure Enable; procedure Disable; procedure Transmit (Data : in Byte); function Receive return Byte; function Data_Available return Boolean; procedure DMA_Transmit (Data : in USART_Data; Count : in Natural); procedure DMA_Receive (Data : out USART_Data; Count : out Natural); function DMA_Receive (Delimiter : in Byte; Data : out USART_Data; Data_Index : in out Natural) return Boolean; procedure DMA_Receive (Delimiter : Byte; Data : out USART_Data; Count : out Natural); function DMA_Receive return Byte; end STM32GD.USART.Peripheral;
ASM/src/items_as_adult.asm
Triaphlax/OoT-Randomizer
344
178305
<filename>ASM/src/items_as_adult.asm stick_as_adult: la t8, SAVE_CONTEXT lw t8, 0x04(t8) ; Link age bnez t8, @@return ; Return if child nop la t2, empty_dlist ; Load empty display list if adult @@return: addiu t8, v1, 0x0008 ; displaced code jr ra sw t8, 0x02C0(t7) ; displaced code masks_as_adult: la t7, SAVE_CONTEXT lw t7, 0x04(t7) ; Link age bnez t7, @@return ; Return if child nop la t6, empty_dlist ; Load empty display list if adult @@return: sw t6, 0x0004(v0) jr ra lb t7, 0x013F(s0)
programs/oeis/052/A052589.asm
neoneye/loda
22
24790
; A052589: a(n) = (2^n - 1)*n!. ; 0,1,6,42,360,3720,45360,640080,10281600,185431680,3712262400,81709689600,1961511552000,51005527372800,1428241944729600,42848566016256000,1371175035310080000,46620306887970816000,1678337450340655104000,63776944758045302784000 mov $1,2 pow $1,$0 sub $1,1 mul $1,32 lpb $0 mul $1,$0 sub $0,1 lpe div $1,32 mov $0,$1
src/extraction-node_edge_types.adb
TNO/Dependency_Graph_Extractor-Ada
0
27118
<filename>src/extraction-node_edge_types.adb with Ada.Characters.Handling; with GNATCOLL.VFS_Utils; with Langkit_Support.Slocs; with Langkit_Support.Text; package body Extraction.Node_Edge_Types is use type LALCO.Ada_Node_Kind_Type; use type VFS.Filesystem_String; use type VFS.Virtual_File; Decl_Name_Prefix : constant String := "decl:"; Dir_Name_Prefix : constant String := "dir:"; File_Name_Prefix : constant String := "file:"; Proj_Name_Prefix : constant String := "proj:"; Filenames_Are_Case_Insensitive : constant Boolean := not GNATCOLL.VFS_Utils.Local_Host_Is_Case_Sensitive; function Encode (Text : Langkit_Support.Text.Text_Type) return String is (Langkit_Support.Text.To_UTF8 (Text)); function Encode (Sloc_Range : Langkit_Support.Slocs.Source_Location_Range) return String is (Langkit_Support.Slocs.Image (Sloc_Range)); function Encode (Value : Boolean) return String is (if Value then "true" else "false"); function Get_Node_Name (File : VFS.Virtual_File; Directory_Prefix : VFS.Virtual_File) return String is Filename : constant String := Utilities.Get_Unique_Filename (File, Directory_Prefix, Make_Lower_Case => Filenames_Are_Case_Insensitive); begin if File.Is_Directory then return Dir_Name_Prefix & Filename; else return File_Name_Prefix & Filename; end if; end Get_Node_Name; function Get_Node_Name (Project : GPR.Project_Type; Directory_Prefix : VFS.Virtual_File) return String is Filename : constant String := Utilities.Get_Unique_Filename (Project.Project_Path, Directory_Prefix, Make_Lower_Case => Filenames_Are_Case_Insensitive); Name : constant String := Project.Name; begin return Proj_Name_Prefix & Filename & ":" & Name; end Get_Node_Name; function Get_Node_Name (Analysis_Unit : LAL.Analysis_Unit; Directory_Prefix : VFS.Virtual_File) return String is Filename : constant String := Utilities.Get_Unique_Filename (Analysis_Unit.Get_Filename, Directory_Prefix, Make_Lower_Case => Filenames_Are_Case_Insensitive); begin return File_Name_Prefix & Filename; end Get_Node_Name; function Get_Node_Name (Defining_Name : LAL.Defining_Name; Basic_Decl : LAL.Basic_Decl'Class; Directory_Prefix : VFS.Virtual_File) return String is Filename : constant String := Utilities.Get_Unique_Filename (Defining_Name.Unit.Get_Filename, Directory_Prefix, Make_Lower_Case => Filenames_Are_Case_Insensitive); Name : constant String := Encode (Defining_Name.P_Relative_Name.Text); Sloc_Range : constant String := Encode (Basic_Decl.Sloc_Range); begin return Decl_Name_Prefix & Filename & ":" & Name & "[" & Sloc_Range & "]"; end Get_Node_Name; function Node_Attributes return GW.Attribute_Definition_Sets.Map is begin return Attributes : GW.Attribute_Definition_Sets.Map do Attributes.Insert (Node_Attribute_Fully_Qualified_Name, GW.GraphML_String); Attributes.Insert (Node_Attribute_Is_Formal_Parameter, GW.GraphML_Boolean); Attributes.Insert (Node_Attribute_Is_Main_Program, GW.GraphML_Boolean); Attributes.Insert (Node_Attribute_Relative_Name, GW.GraphML_String); Attributes.Insert (Node_Attribute_Source_Location, GW.GraphML_String); end return; end Node_Attributes; function Get_Node_Attributes (File : VFS.Virtual_File; Directory_Prefix : VFS.Virtual_File) return GW.Attribute_Value_Sets.Map is -- Note that in the case of the fully quantified and relative names, we -- keep the original casing to keep the names as readable as possible. -- This differs from the behavior in the case of node names, where we -- normalize the casing depending on the case-sensitivity of file system -- to ensure that we do not get dupicate nodes on case-insensitive file -- systems due to file names having different casings in different parts -- of a codebase. As Extraction.Extract_Dependency_Graph first iterates -- over the file system to create nodes for all files and directories, -- it is ensured, via the implementation of Extraction.File_System, -- that the fully quantified and relative names that end up in our -- graph have casings that match the on-disk ones. Fully_Qualified_Name : constant SU.Unbounded_String := +Utilities.Get_Unique_Filename (File, Directory_Prefix, Make_Lower_Case => False); Relative_Name : constant SU.Unbounded_String := +(+File.Base_Dir_Name); begin return Attributes : GW.Attribute_Value_Sets.Map do Attributes.Insert (Node_Attribute_Fully_Qualified_Name, Fully_Qualified_Name); Attributes.Insert (Node_Attribute_Relative_Name, Relative_Name); end return; end Get_Node_Attributes; function Get_Node_Attributes (Project : GPR.Project_Type) return GW.Attribute_Value_Sets.Map is Fully_Qualified_Name : constant SU.Unbounded_String := +Project.Name; Relative_Name : constant SU.Unbounded_String := +Project.Name; begin return Attributes : GW.Attribute_Value_Sets.Map do Attributes.Insert (Node_Attribute_Fully_Qualified_Name, Fully_Qualified_Name); Attributes.Insert (Node_Attribute_Relative_Name, Relative_Name); end return; end Get_Node_Attributes; function Get_Node_Attributes (Defining_Name : LAL.Defining_Name; Basic_Decl : LAL.Basic_Decl; Context : Utilities.Project_Context) return GW.Attribute_Value_Sets.Map is Uninstantiated_Defining_Name : constant LAL.Defining_Name := Defining_Name.P_Get_Uninstantiated_Node.As_Defining_Name; Uninstantiated_Basic_Decl : constant LAL.Basic_Decl := Basic_Decl.P_Get_Uninstantiated_Node.As_Basic_Decl; Fully_Qualified_Name : constant String := Encode (Uninstantiated_Defining_Name.P_Fully_Qualified_Name); Is_Formal_Parameter : constant String := Encode (Uninstantiated_Basic_Decl.P_Is_Formal); Is_Main_Subprogram : constant String := Encode (Utilities.Is_Project_Main_Program (Uninstantiated_Basic_Decl, Context)); Relative_Name : constant String := Encode (Uninstantiated_Defining_Name.P_Relative_Name.Text); Sloc_Range : constant String := Encode (Uninstantiated_Basic_Decl.Sloc_Range); begin return Attributes : GW.Attribute_Value_Sets.Map do Attributes.Insert (Node_Attribute_Fully_Qualified_Name, +Fully_Qualified_Name); Attributes.Insert (Node_Attribute_Is_Formal_Parameter, +Is_Formal_Parameter); Attributes.Insert (Node_Attribute_Relative_Name, +Relative_Name); Attributes.Insert (Node_Attribute_Source_Location, +Sloc_Range); if Basic_Decl.P_Is_Subprogram then Attributes.Insert (Node_Attribute_Is_Main_Program, +Is_Main_Subprogram); end if; end return; end Get_Node_Attributes; function Get_File_Subtype (File : VFS.Virtual_File) return GW.Node_Subtype is Extension : constant String := Ada.Characters.Handling.To_Lower (+File.File_Extension); begin if File = Utilities.Standard_Unit_File then return Node_Type_Ada_Specification_File; elsif Extension = ".adb" then return Node_Type_Ada_Body_File; elsif Extension = ".ads" then return Node_Type_Ada_Specification_File; elsif Extension = ".c" then return Node_Type_C_Source_File; elsif Extension = ".gpr" then return Node_Type_Gnat_Project_File; elsif Extension = ".h" then return Node_Type_C_Header_File; else return Node_Type_Unknown_File_Type; end if; end Get_File_Subtype; function Get_Decl_Subtype (Decl : LAL.Basic_Decl) return GW.Node_Subtype is begin case LALCO.Ada_Basic_Decl (Decl.Kind) is -- Components. when LALCO.Ada_Component_Decl => return Node_Type_Ada_Component_Declaration; -- Discriminants. when LALCO.Ada_Discriminant_Spec => return Node_Type_Ada_Discriminant_Declaration; -- Exceptions. when LALCO.Ada_Exception_Decl => return Node_Type_Ada_Exception_Declaration; -- Numbers. when LALCO.Ada_Number_Decl => return Node_Type_Ada_Number_Declaration; -- Objects. when LALCO.Ada_Object_Decl => return Node_Type_Ada_Object_Declaration; -- Packages. when LALCO.Ada_Package_Decl | LALCO.Ada_Package_Body_Stub | LALCO.Ada_Package_Body | LALCO.Ada_Package_Renaming_Decl | LALCO.Ada_Generic_Package_Decl | LALCO.Ada_Generic_Package_Instantiation | LALCO.Ada_Generic_Package_Renaming_Decl => return Node_Type_Ada_Package_Declaration; -- Protected. when LALCO.Ada_Protected_Type_Decl | LALCO.Ada_Protected_Body_Stub | LALCO.Ada_Protected_Body | LALCO.Ada_Single_Protected_Decl => return Node_Type_Ada_Protected_Declaration; -- Subprograms. when LALCO.Ada_Abstract_Subp_Decl | LALCO.Ada_Subp_Decl | LALCO.Ada_Expr_Function | LALCO.Ada_Null_Subp_Decl | LALCO.Ada_Subp_Body | LALCO.Ada_Subp_Renaming_Decl | LALCO.Ada_Subp_Body_Stub | LALCO.Ada_Generic_Subp_Decl | LALCO.Ada_Generic_Subp_Instantiation | LALCO.Ada_Generic_Subp_Renaming_Decl | LALCO.Ada_Abstract_Formal_Subp_Decl | LALCO.Ada_Concrete_Formal_Subp_Decl => return Node_Type_Ada_Subprogram_Declaration; when LALCO.Ada_Entry_Decl | LALCO.Ada_Entry_Body => return Node_Type_Ada_Entry_Declaration; when LALCO.Ada_Enum_Literal_Decl => return Node_Type_Ada_Enum_Literal_Declaration; -- Tasks. when LALCO.Ada_Task_Type_Decl | LALCO.Ada_Task_Body_Stub | LALCO.Ada_Task_Body | LALCO.Ada_Single_Task_Decl => return Node_Type_Ada_Task_Declaration; -- Types. when LALCO.Ada_Type_Decl | LALCO.Ada_Subtype_Decl | LALCO.Ada_Incomplete_Type_Decl | LALCO.Ada_Incomplete_Tagged_Type_Decl => return Node_Type_Ada_Type_Declaration; when others => raise Internal_Extraction_Error with "Unhandled basic declaration: " & Decl.Kind'Image; end case; end Get_Decl_Subtype; function Edge_Attributes return GW.Attribute_Definition_Sets.Map is begin return Attributes : GW.Attribute_Definition_Sets.Map do Attributes.Insert (Edge_Attribute_Has_Access_Type, GW.GraphML_Boolean); Attributes.Insert (Edge_Attribute_Has_Array_Type, GW.GraphML_Boolean); Attributes.Insert (Edge_Attribute_Is_Dispatching, GW.GraphML_Boolean); end return; end Edge_Attributes; function Get_Edge_Attributes (Expr : LAL.Expr'Class) return GW.Attribute_Value_Sets.Map is Is_Dispatching : constant String := Encode (Expr.P_Is_Dispatching_Call); begin return Attributes : GW.Attribute_Value_Sets.Map do Attributes.Insert (Edge_Attribute_Is_Dispatching, +Is_Dispatching); end return; end Get_Edge_Attributes; function Get_Edge_Attributes (Type_Expr : LAL.Type_Expr'Class; Can_Have_Array_Type : Boolean) return GW.Attribute_Value_Sets.Map is Has_Access_Type : Boolean := False; Has_Array_Type : Boolean := False; procedure Get_Attribute_Values (Type_Def : LAL.Type_Def); procedure Get_Attribute_Values (Type_Expr : LAL.Type_Expr'Class); procedure Get_Attribute_Values (Type_Expr : LAL.Type_Expr'Class) is begin if Type_Expr.Kind = LALCO.Ada_Anonymous_Type then Get_Attribute_Values (Type_Expr.As_Anonymous_Type.F_Type_Decl.F_Type_Def); end if; end Get_Attribute_Values; procedure Get_Attribute_Values (Type_Def : LAL.Type_Def) is begin if Type_Def.Kind = LALCO.Ada_Array_Type_Def then Has_Array_Type := True; Get_Attribute_Values (Type_Def.As_Array_Type_Def.F_Component_Type.F_Type_Expr); elsif Type_Def.Kind = LALCO.Ada_Type_Access_Def then Has_Access_Type := True; Get_Attribute_Values (Type_Def.As_Type_Access_Def.F_Subtype_Indication); end if; end Get_Attribute_Values; begin Get_Attribute_Values (Type_Expr); return Attributes : GW.Attribute_Value_Sets.Map do Attributes.Insert (Edge_Attribute_Has_Access_Type, +Encode (Has_Access_Type)); if Can_Have_Array_Type then Attributes.Insert (Edge_Attribute_Has_Array_Type, +Encode (Has_Array_Type)); elsif Has_Array_Type then raise Internal_Extraction_Error with "Unexpected Has_Array_Type in Get_Edge_Attributes"; end if; end return; end Get_Edge_Attributes; end Extraction.Node_Edge_Types;
Ports/AVR32/UC3/IAR/os_cpu_a.asm
zhiqiang-hu/uC-OS3
255
102878
<filename>Ports/AVR32/UC3/IAR/os_cpu_a.asm<gh_stars>100-1000 /* ********************************************************************************************************* * uC/OS-III * The Real-Time Kernel * * Copyright 2009-2021 Silicon Laboratories Inc. www.silabs.com * * SPDX-License-Identifier: APACHE-2.0 * * This software is subject to an open source license and is distributed by * Silicon Laboratories Inc. pursuant to the terms of the Apache License, * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. * ********************************************************************************************************* */ /* ********************************************************************************************************* * * ATMEL AVR32 UC3 Port * * File : os_cpu_a.asm * Version : V3.08.01 ********************************************************************************************************* * Toolchain : IAR AVR32 ********************************************************************************************************* */ /* ********************************************************************************************************* * ASM HEADER ********************************************************************************************************* */ MODULE OS_CPU_A RSEG CODE32:CODE ;$PAGE /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ OS_CPU_SR_GM_OFFSET EQU 16 /* Status Register, Global Interrupt Mask Offset */ /* ********************************************************************************************************* * PUBLIC DECLARATIONS ********************************************************************************************************* */ PUBLIC OSCtxSw PUBLIC OSCtxRestore PUBLIC OSIntCtxRestore PUBLIC OSIntISRHandler PUBLIC OSFastIntISRHandler EXTERN OSTCBCurPtr EXTERN OSTCBHighRdyPtr EXTERN OSTaskSwHook EXTERN OSPrioHighRdy EXTERN OSPrioCur EXTERN OSIntNestingCtr EXTERN OSIntExit EXTERN BSP_INTC_IntGetHandler ;$PAGE /* ********************************************************************************************************* * TASK LEVEL CONTEXT SWITCH * * Description: This function is called when a task makes a higher priority task ready-to-run. * * Arguments : None. * * Note(s) : 1) Upon entry, * OSTCBCurPtr points to the OS_TCB of the task to suspend * OSTCBHighRdyPtr points to the OS_TCB of the task to resume * * 2) The stack frame of the task to suspend looks as follows: * * SP --> SR (Low Memory) * PC (High memory) * * 3) The saved context of the task to resume looks as follows: * * OSTCBHighRdyPtr->OSTCBStkPtr --> SP --> * R7 ----/ (Low memory) * . * . * R0 * SR * PC * LR * R12 * . * . * R8 ----\ (High memory) * * where the stack pointer points to the task start address. * * 4) OSCtxSw() has to save all registers from the suspended task. Since PC and SR are * already on the stack, they need to be moved after R0-R7. Then, the remaining * registers (R8-R12, LR) are pushed into the stack frame. Only then the Stack * Pointer of the task to suspend is saved on OSTCBCurPtr. * * 5) OSCtxSw() MUST: * a) Save processor registers then, * b) Save current task's stack pointer into the current task's OS_TCB, * c) Call OSTaskSwHook(), * d) Set OSTCBCurPtr = OSTCBHighRdyPtr, * e) Set OSPrioCur = OSPrioHighRdy, * f) Switch to the highest priority task. * * pseudo-code: * void OSCtxSw (void) * { * Save processor registers; * * OSTCBCurPtr->OSTCBStkPtr = SP; * * OSTaskSwHook(); * * OSTCBCurPtr = OSTCBHighRdyPtr; * OSPrioCur = OSPrioHighRdy; * * OSCtxRestore(OSTCBHighRdyPtr->OSTCBStkPtr); * } ********************************************************************************************************* */ OSCtxSw: PUSHM R10-R12, LR /* Save R10-R12, LR into stack */ LD.D R10, SP[4*4] /* Copy SR and PC from bottom of stack */ PUSHM R10-R11 /* Save SR and PC into stack */ ST.D SP[6*4], R8 /* Save R8 and R9 into stack */ PUSHM R0-R7 /* Save R0-R7 into stack */ MOV R8, LWRD(OSTCBCurPtr) ORH R8, HWRD(OSTCBCurPtr) /* OSTCBCurPtr */ LD.W R9, R8[0] /* *OSTCBCurPtr */ ST.W R9[0], SP /* OSTCBCurPtr->OSTCBStkPtr = SP */ RCALL OSTaskSwHook MOV R12, LWRD(OSTCBHighRdyPtr) ORH R12, HWRD(OSTCBHighRdyPtr) /* OSTCBHighRdyPtr */ LD.W R10, R12[0] /* *OSTCBHighRdyPtr */ MOV R8, LWRD(OSTCBCurPtr) ORH R8, HWRD(OSTCBCurPtr) /* OSTCBCurPtr */ ST.W R8[0], R10 /* OSTCBCurPtr = OSTCBHighRdyPtr */ MOV R12, LWRD(OSPrioHighRdy) ORH R12, HWRD(OSPrioHighRdy) LD.UB R11, R12[0] /* *OSPrioHighRdy */ MOV R12, LWRD(OSPrioCur) ORH R12, HWRD(OSPrioCur) ST.B R12[0], R11 /* OSPrioCur = OSPrioHighRdy */ LD.W R12, R10[0] /* Retrieve OSTCBHighRdyPtr->OSTCBStkPtr */ LDM R12, R0-R7 /* Restore R0-R7 */ LD.D R8, R12[14*4] /* Restore R8-R9 */ LD.D R10, R12[ 8*4] /* Retrieve PC and SR from stack frame */ ST.D R12[14*4], R10 /* Store PC and SR at bottom of stack frame */ SUB R12, -10*4 /* Move Stack Pointer Reference to LR */ SUB SP, R12, -4*4 /* Restore Stack Pointer */ LDM R12, R10-R12, LR /* Restore R10-R12, LR */ RETS /* Restore PC and SR {restore task} */ ;$PAGE /* ********************************************************************************************************* * RESTORE CONTEXT FUNCTIONS * * Description: These functions are used to perform context switch. * * void OSCtxRestore (CPU_STK *p_stk) * Restore R0-R9 * Move SR and PC to bottom of Stack frame * Restore Stack Pointer to point to SR and PC * Restore R10-R12, LR * Return from Supervisor Call {context switch} * * void OSIntCtxRestore (CPU_STK *p_stk) * Restore Stack Pointer * Restore R0-R7 * Return from INT {context switch} * * Arguments : p_stk Stack address for the context to be restored ********************************************************************************************************* */ OSCtxRestore: LDM R12, R0-R7 /* Restore R0-R7 */ LD.D R8, R12[14*4] /* Restore R8-R9 */ LD.D R10, R12[ 8*4] /* Retrieve PC and SR from stack frame */ ST.D R12[14*4], R10 /* Store PC and SR at bottom of stack frame */ SUB R12, -10*4 /* Move Stack Pointer Reference to LR */ SUB SP, R12, -4*4 /* Restore Stack Pointer */ LDM R12, R10-R12, LR /* Restore R10-R12, LR */ RETS /* Restore PC and SR {restore task} */ OSIntCtxRestore: MOV SP, R12 /* Restore SP (Stack Pointer) */ POPM R0-R7 /* Restore R0-R7 */ RETE /* Restore R8-R12, LR, PC and SR {restore task} */ ;$PAGE /* ********************************************************************************************************* * OS INTERRUPT HANDLER * * Description: This function handles the OS specific steps to wrap an user-defined function to be called * on an interrupt. * * prototype: void OSIntISRHandler(CPU_FNCT_PTR p_user_isr); * * Notes : 1) OSIntISRHandler() MUST: * a) save remaining registers (R0-R7), * b) increment OSIntNestingCtr, * c) if (OSIntNestingCtr == 1) OSTCBCurPtr->OSTCBStkPtr = SP, * d) re-enable interrupts, * e) call user-defined function, * f) call OSIntExit(), * g) restore remaining registers (R0-R7), * h) return from interrupt. * * 2) Interrupts MUST be disabled when this function is called. ********************************************************************************************************* */ OSIntISRHandler: PUSHM R0-R7 /* Save R0-R7 into stack */ MOV R11, LWRD(OSIntNestingCtr) ORH R11, HWRD(OSIntNestingCtr) LD.UB R10, R11[0] SUB R10, -1 ST.B R11[0], R10 /* OSIntNestingCtr++ */ CP.W R10, 1 /* Test OSIntNestingCtr */ BRNE OSIntISRHandler_1 MOV R11, LWRD(OSTCBCurPtr) /* if (OSIntNestingCtr == 1) { */ ORH R11, HWRD(OSTCBCurPtr) LD.W R10, R11[0] ST.W R10[0], SP /* OSTCBCurPtr->OSTCBStkPtr = SP; */ /* } */ OSIntISRHandler_1: CSRF OS_CPU_SR_GM_OFFSET /* Clear global interrupt mask (enable interrupts) */ ICALL R12 /* call user ISR function */ RCALL OSIntExit POPM R0-R7 /* Restore R0-R7 from stack */ RETE ;$PAGE /* ********************************************************************************************************* * OS FAST (non-OS) INTERRUPT HANDLER * * Description: This function handles OS specific steps to wrap an user-defined function to be called on * a fast (non-OS) interrupt. * * prototype: void OSFastIntISRHandler(CPU_FNCT_PTR p_user_isr); * * Notes : 1) OSFastIntISRHandler() MUST: * a) increment OSIntNestingCtr, * b) re-enable interrupts, * c) call user-defined function, * d) disable interrupts, * e) decrement OSIntNestingCtr, * f) return from interrupt. * * 2) Interrupts MUST be disabled when this function is called. ********************************************************************************************************* */ OSFastIntISRHandler: MOV R11, LWRD(OSIntNestingCtr) ORH R11, HWRD(OSIntNestingCtr) LD.UB R10, R11[0] SUB R10, -1 ST.B R11[0], R10 /* OSIntNestingCtr++ */ CSRF OS_CPU_SR_GM_OFFSET /* Clear global interrupt mask (enable interrupts) */ ICALL R12 /* call user ISR function */ SSRF OS_CPU_SR_GM_OFFSET /* Set global interrupt mask (disable interrupts) */ NOP NOP MOV R11, LWRD(OSIntNestingCtr) ORH R11, HWRD(OSIntNestingCtr) LD.UB R10, R11[0] SUB R10, 1 ST.B R11[0], R10 /* OSIntNestingCtr-- */ RETE ;$PAGE /* ********************************************************************************************************* * CPU ASSEMBLY PORT FILE END ********************************************************************************************************* */ END
Src/Ant8/Tests/aa8/basic/02_add_r0.asm
geoffthorpe/ant-architecture
0
173243
<filename>Src/Ant8/Tests/aa8/basic/02_add_r0.asm # $Id: 02_add_r0.asm,v 1.3 2001/03/22 00:38:59 ellard Exp $ # # Copyright 1999-2001 by the President and Fellows of Harvard College. # See LICENSE.txt for license information. # #@ tests add for r0 # OK lc r2, 1 add r0, r2, r2 hlt
oeis/278/A278705.asm
neoneye/loda-programs
11
25389
; A278705: Number of length-4 cycles in all simple labeled graphs on n nodes. ; Submitted by <NAME> ; 12,960,92160,13762560,3523215360,1623497637888,1385384650997760,2229281815548395520,6848353737364671037440,40517904423021555933511680,464691742246749620690258755584,10382058415869198798257999252029440,453599053561602541628424159320667586560 mov $1,$0 add $1,3 bin $1,2 add $0,$1 bin $1,2 mov $2,2 pow $2,$0 div $2,2 mul $1,$2 mov $0,$1
money-run/money-run.asm
avik-das/gbdev
6
19117
<filename>money-run/money-run.asm ; money-run.asm - <NAME> ; ; A simple side-scroller, in which the character is asked to go from ; left to right, navigating over a series procedurally generated ; columns. ; ; The name is refers to the gameplay mechanic in which the player will ; be trying to collect money while avoiding getting stuck amongst the ; columns. ; = DATA/VARIABLES ================================================== ; Here we set up some locations in memory to store data that will be ; used in the program. Typically, we will store data in the internal ; RAM, which gives us 8KB to work with. SECTION "RAM",WRAM0[$c000] ; The buttons that are joypad pressed on the joypad. The fields are ; as follows: ; bit 7: down ; bit 6: up ; bit 5: left ; bit 4: right ; bit 3: start ; bit 2: select ; bit 1: B ; bit 0: A ; When a bit is set, the corresponding button is pressed. This ; structure is updated by read_joypad. PAD : DB OLDPAD: DB ; The background is 256 pixels wide, with each column taking up 16 ; pixels, giving us 16 separate heights to work with. ; ; We can exploit the fact that not all eight bits in one byte are ; used to store a height, but storing multiple heights in one byte ; results in much more awkward code. This is a space-time trade-off. HEIGHTS: DS 16 RANDHEIGHT: DB ; a random number used for generating the heights BGSCRL: DB ; amount to scroll the background by ; The player struct, which defines the state of the player. ; ; The Y-coordinate and downward velocity are are stored as two bytes ; each, in a 8.8 fixed point format. This means that the first byte ; is the integer portion of the number, and the second byte contains ; the fractional portion. The Y-coordinate is the actual pixel ; coordinate on screen, as opposed to being offset by 16 pixels as is ; the case in the OAM structure. ; ; The X-coordinate does not need to be stored in fixed point format, ; since no forces are applied horizontally, so no numeric integration ; needs to be done on the X-coordinate. The X-coordinate is the ; actual position on screen, plus 16. This allows the player to go ; partally off screen without the position wrapping around. ; PLAYER_STATE: DB ; the x position DS 2 ; the y position DS 2 ; the downward velocity SCROLLFLAG: DB ; whether or not to scroll the world VBFLAG: DB ; whether or not we are in V-Blank ; Instead of directly manipulating values in the OAM during V-Blank, ; we store a copy of the OAM. Then, we can alter this copy at any ; time, not just during V-Blank, and when the OAM is indeed ; available, we initiate a DMA transfer from the copy to the OAM. OAMBUF EQU $df00 ; allocate the last page in RAM for the copy PLAYER EQU OAMBUF ; the player starts at the first sprite ; = INTERRUPT HANDLERS ============================================== ; These are simple interrupt handlers that simply call the actual ; procedures responsible for taking any action. The procedures will ; call "reti". SECTION "vblank",ROM0[$40] nop jp vblank SECTION "timer",ROM0[$50] nop jp timer SECTION "start",ROM0[$100] nop jp start ; = CATRIDGE HEADER ================================================= ; Nintendo logo. must be exactly as given DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E DB "MONEYRUN",0,0,0,0,0,0,0 ; title, upper case ASCII, 15 bytes DB 0 ; not a GBC catridge DB 0,0 ; new licensee code, high and low nibbles. not important DB 0 ; not SGB DB 0 ; catridge type, ROM only DB 0 ; ROM size, 256Kbit = 32KByte = 2 banks DB 0 ; RAM size, no RAM DB 1 ; destination code, non-Japanese DB $33 ; old licensee code, $33 => check new licensee code DB 0 ; mask ROM version number, usually 0 DB 0 ; complement check. computed by rgbfix. important. DW 0 ; checksum. computed by rgbfix. not important. ; = INITIALIZATION ================================================== start: nop di ; disable interrupts ld sp, $ffff ; put the stack at the top of the RAM init: call lcd_off call init_ram call copy_dma_routine call load_bg_tileset call init_player_obj call lcd_on call start_timer ld a,%00000101 ; enable V-Blank interrupt ; enable timer interrupt ld [$ffff],a ei ; = MENU INITIALIZATION + MENU LOOP ================================= switch_to_menu: di call lcd_off call init_ram_for_menu call load_bg_for_menu call place_player_in_menu call lcd_on ei .loop: halt nop ld a,[VBFLAG] or 0 jr z,.loop ld a,0 ld [VBFLAG],a ld hl,RANDHEIGHT inc [hl] call read_joypad call react_to_input_in_menu jr .loop ; = GAMEPLAY INITIALIZATION + GAMEPLAY LOOP ========================= start_game: di call lcd_off call init_ram_for_gameplay call generate_initial_bg_for_gameplay call set_player_initial_position_for_gameplay call lcd_on ei .loop: halt nop ld a,[VBFLAG] or 0 jr z,.loop ld a,0 ld [VBFLAG],a call read_joypad call react_to_input_during_gameplay call apply_forces call position_player call scroll_world_if_needed call check_for_game_over jr .loop ; = MENU INITIALIZATION + MENU LOOP ================================= show_game_over_screen: di call lcd_off call init_ram_for_game_over call load_bg_for_game_over call hide_player call lcd_on ei .loop: halt nop ld a,[VBFLAG] or 0 jr z,.loop ld a,0 ld [VBFLAG],a call read_joypad call react_to_input_in_game_over jr .loop ; = INITIALIZATION FUNCTIONS ======================================== init_ram: ; Initialize the RAM variables, but only the ones used all throughout ; the program. There are other variables only used in one mode of the ; program (e.g. menu vs. gameplay) that are initialized at the ; beginning of that mode. ld a,0 ld [PAD],a ld [OLDPAD],a ld [VBFLAG],a ld [RANDHEIGHT],a ret init_ram_for_menu: init_ram_for_game_over: ld a,0 ld [BGSCRL],a ret init_ram_for_gameplay: ld a,0 ld [BGSCRL],a ret copy_dma_routine: ; copy the sprite DMA procedure into HRAM ld hl,sprite_dma ld de,hram_sprite_dma ld bc,sprite_dma_end-sprite_dma call memcpy ret load_bg_tileset: ld a,[bgpal] ; set the background palette ld [$ff47],a ; load the background tiles into the Tile Data Table ld hl,bgbox ; source address ld de,$8800 ; destination address ld bc,816 ; number of bytes to copy call memcpy ret load_bg_for_menu: ; reset the screen position, both scrolly and scrollx ld a,0 ld [$ff42],a ld [$ff43],a call clear_bg ; Boxes ld a,$80 ; box top-left tiles ld [$9908],a ld [$9948],a ld [$994a],a ld [$994c],a ld [$9986],a ld [$9988],a ld [$998a],a ld [$998c],a ld a,$81 ; box top-right tiles ld [$9909],a ld [$9949],a ld [$994b],a ld [$994d],a ld [$9987],a ld [$9989],a ld [$998b],a ld [$998d],a ld a,$82 ; box bottom-left tiles ld [$9928],a ld [$9968],a ld [$996a],a ld [$996c],a ld [$99a6],a ld [$99a8],a ld [$99aa],a ld [$99ac],a ld a,$83 ; box bottom-right tiles ld [$9929],a ld [$9969],a ld [$996b],a ld [$996d],a ld [$99a7],a ld [$99a9],a ld [$99ab],a ld [$99ad],a ; Game title ld hl,bgtitlemap ; source address ld de,$9845 ; destination address ld bc,10 ; number of bytes to copy call memcpy ld hl,bgtitlemap + 10 ; source address ld de,$9865 ; destination address ld bc,10 ; number of bytes to copy call memcpy ld hl,bgtitlemap + 20 ; source address ld de,$9887 ; destination address ld bc,6 ; number of bytes to copy call memcpy ld hl,bgtitlemap + 26 ; source address ld de,$98a7 ; destination address ld bc,6 ; number of bytes to copy call memcpy ; Press start text ld hl,bgpressstartmap ; source address ld de,$99e4 ; destination address ld bc,12 ; number of bytes to copy call memcpy ret load_bg_for_game_over: ; reset the screen position, both scrolly and scrollx ld a,0 ld [$ff42],a ld [$ff43],a call clear_bg ; Game over title ld hl,gameovertitlemap ; source address ld de,$98c6 ; destination address ld bc,8 ; number of bytes to copy call memcpy ld hl,gameovertitlemap + 8 ; source address ld de,$98e6 ; destination address ld bc,8 ; number of bytes to copy call memcpy ld hl,gameovertitlemap + 16 ; source address ld de,$9926 ; destination address ld bc,8 ; number of bytes to copy call memcpy ld hl,gameovertitlemap + 24 ; source address ld de,$9946 ; destination address ld bc,8 ; number of bytes to copy call memcpy ret generate_initial_bg_for_gameplay: ; reset the screen position ld a,0 ld [$ff42],a ; scrolly will always be 0 ld [$ff43],a ; scrollx starts at 0 call generate_initial_heights call load_all_columns_into_bg_tile_map ret generate_initial_heights: ld hl,HEIGHTS ; the base address of the height map ld a,$0 .loop: push af ; preserve A call next_rand_height ld [hl],a ; generate two random heights and place it into the ; height map inc hl ; go to the next byte in the height map pop af ; restore A inc a ; only generate data for 16 bytes cp $16 jr nz, .loop ret load_all_columns_into_bg_tile_map: ld a,$0 .loop: push af call load_column_into_bg_tile_map pop af inc a cp $10 jr nz, .loop ret load_column_into_bg_tile_map: ; parameters: ; a = the index of the column to load ld d,a ; save a, because we'll need the original value later ld hl,HEIGHTS ; start with the start address of the height map ld b,$00 ; bc = $00AA, where AA = index ld c,a add hl,bc ; actual address = start of height map + $00AA ld a,[hl] ; grab the height from the height map. ld b,a ; save the height in b sla d ; multiply the column index by 2, since in the tile ; map, each column takes up two tiles ld h,$98 ; HL = $98DD, where DD = index * 2 ld l,d jp load_column_into_bg_tile_map_at_address ; tail call init_player_obj: ; Set up the initial player state, so that it can be placed as ; necessary. This doesn't actually position the player, as the ; starting position differs based on if we're on the menu or not. ; load the object palette 0 ld a,[sppal] ; load the object palette 0 data ld [$ff48],a ; and store it into the object palette 0 register ; zero out the OAM buffer ld de,OAMBUF ld bc,256 call zeromem ; load the sprite tiles into the Sprite Pattern Table ld hl,ghost ; source address ld de,$8000 ; destination address ld bc,256 ; number of bytes to copy call memcpy ; Display the sprites on the screen by populating the Object ; Attribute Memory (OAM). The X- and Y-coordinates will be filled in ; by "position_player" later. ld a,0 ; pattern number ld [PLAYER+2],a ld a,%00000000 ; priority: on top of background ; no y-flip ; no x-flip ; palette 0 ; 4 LSB ignored ld [PLAYER+3],a ; our player requires two sprites, so initialize the second one ld a,2 ; pattern number ld [PLAYER+6],a ld a,%00000000 ; priority: on top of background ; no y-flip ; no x-flip ; palette 0 ; 4 LSB ignored ld [PLAYER+7],a ret place_player_in_menu: ld a,101 ld [PLAYER_STATE],a ; X-coordinate ld a,64 ld [PLAYER_STATE+1],a ; Y-coordinate (integer part) ; All other portions of the player state are not set because they are ; not used during the menu. jp position_player ; tail call hide_player: ld a,240 ld [PLAYER_STATE+1],a ; Y-coordinate (integer part) jp position_player ; tail call set_player_initial_position_for_gameplay: ld a,144 ld [PLAYER_STATE],a ; X-coordinate ld a,0 ld [PLAYER_STATE+1],a ; Y-coordinate (integer part) ld [PLAYER_STATE+2],a ; Y-coordinate (fractional part) ld [PLAYER_STATE+3],a ; downward velocity (integer part) ld [PLAYER_STATE+4],a ; downward velocity (fractional part) jp position_player ; tail call start_timer: ; The timer will be incremented 4096 times each second, and each time ; it overflows, it will be reset to 196. This means that the timer ; will overflow every (1/4096) * (256 - 196) = ~0.0156s. ld a,192 ; the value of rTIMA after it overflows ld [$ff06],a ld a,%00000100 ; enable the timer ; increment rTIMA at 4096Hz ld [$ff07],a ret ; = INTERRUPT HANDLERS ============================================== vblank: push af push bc push de push hl ; Note that the DMA procedure must be initiated from High RAM. The ; mechanism for that is detailed alongside the definition of this ; initiation procedure. call hram_sprite_dma call scroll_bg ld a,1 ld [VBFLAG],a pop hl pop de pop bc pop af reti timer: push af ld a,1 ld [SCROLLFLAG],a pop af reti ; = MAIN LOOP FUNCTIONS ============================================= read_joypad: ; The state that was current before should now become the old state. ld a,[PAD] ld [OLDPAD],a ; First, we will read the direction pad by sending a value to the ; joypad register (P1) that will enable the d-pad (by clearing bit 4) ; and disable the buttons (by setting bit 5). ld a,%00100000 ld [$ff00],a ; To minimize the effects of key bouncing, in which the contacts of ; the joypad cause oscillations between the high and low states, we ; read from P1 multiple times and only use the last value read. ld a,[$ff00] ld a,[$ff00] ld a,[$ff00] ld a,[$ff00] and %00001111 ; pick out only the input lines... swap a ; ...put the states into the high nibble... ld b,a ; ...and save it away temporarily ; Now we want to read the buttons, and that means we disable the d-pad ; (by setting bit 4) and enable the buttons (by clearing bit 5). ld a,%00010000 ld [$ff00],a ld a,[$ff00] ld a,[$ff00] ld a,[$ff00] ld a,[$ff00] and %00001111 or b ; B contains the d-pad input in the high nibble, so we ; can we incorporate the button input in the low nibble ; Now, A contains the state of the d-pad and the buttons, but when a ; bit is cleared, that means the button is pressed. So, we take the ; complement, and we have an intuitive mapping of 1->pressed and ; 0->not pressed. cpl ld [PAD],a ret react_to_input_in_menu: .start_game: ld a,[PAD] bit 3,a jr z,.done ld a,[OLDPAD] bit 3,a jr nz,.done ; only respond to start if start wasn't pressed before jp start_game .done: ret react_to_input_in_game_over: .switch_to_menu: ld a,[PAD] bit 3,a jr z,.done ld a,[OLDPAD] bit 3,a jr nz,.done ; only respond to start if start wasn't pressed before jp switch_to_menu .done: ret react_to_input_during_gameplay: ; When moving horizontally, the player's height needs to be checked ; against the column the player will move into. For that, we'll need ; the player's x position, which we will manipulate before checking ; the height map. call load_player_real_x_position ld c,a .move_right: ld a,[PAD] bit 4,a jr z,.move_left ; Check if the player is allowed to move right ld a,c ; reload the x position and get the position the right add 17 ; side of the player would end up at call load_height_map_entry_for_x_position call height_to_num_pixels_above_column add 1 ; add 1 to the number of pixels above the column ; because being exactly on the ground is okay call is_player_above_column jr nz,.move_right_slower ; If we can't move right by 2 pixels, try to ; move right by only 1 pixel. ld a,[PLAYER_STATE] sub 176 jr nc,.move_left add 178 ld [PLAYER_STATE],a jr .move_left .move_right_slower: ; Check if the player is allowed to move right ld a,c ; reload the x position and get the position the right add 16 ; side of the player would end up at call load_height_map_entry_for_x_position call height_to_num_pixels_above_column add 1 ; add 1 to the number of pixels above the column ; because being exactly on the ground is okay call is_player_above_column jr nz,.move_left ld a,[PLAYER_STATE] sub 176 jr nc,.move_left add 177 ld [PLAYER_STATE],a jr .move_left .move_left: ld a,[PAD] bit 5,a jr z,.jump ; Check if the player is allowed to move left ld a,c ; reload the x position and get the position the left sub 1 ; side of the player would end up at call load_height_map_entry_for_x_position call height_to_num_pixels_above_column add 1 ; add 1 to the number of pixels above the column ; because being exactly on the ground is okay call is_player_above_column jr nz,.jump ld a,[PLAYER_STATE] sub 1 ld [PLAYER_STATE],a .jump: ld a,[PAD] bit 0,a jr z,.done ld a,[OLDPAD] bit 0,a jr nz,.done ; only respond to A if A wasn't pressed before ld a,[PLAYER_STATE+3] cp 0 jr nz,.done ld a,[PLAYER_STATE+4] cp 0 jr nz,.done ld a,$fc ld [PLAYER_STATE+3],a ld a,$70 ld [PLAYER_STATE+4],a .done: ret apply_forces: ; In simple Newtonian mechanics, over time: ; ; 1. The downward speed of an object increases linearly with time, ; proportional to the acceleration due to gravity. ; ; 2. The Y-position increases linearly, proportional to the downward, ; velocity. This means it actually increases quadratically with ; time: ; ; y(t) = g * t^2 + v0 * t + y0 ; ; This results in the following updates: ; ; y' = y' + v * t * k ; v' = v' + g * t * k ; ; Where "k" is a constant to account for the fact that we're dealing ; with pixels and frames, not meters and seconds. Because the ; timestep is constant (always one frame), we can set "t * k = 1", ; and set "g" to whatever value makes sense for us. ; y' = y' + v ld bc,PLAYER_STATE+2 ld de,PLAYER_STATE+4 call add_16bit_numbers_in_memory call check_is_grounded jr z,.not_grounded ; Since the player is on or below the ground, reset the player to the ; correct height, and set the downward velocity to "0". Register a ; contains the height to which to reset the player, as an integer. sub 16 ; subtract 16 because the height refers to the player's feet ld [PLAYER_STATE+1],a ld a,0 ld [PLAYER_STATE+2],a ld [PLAYER_STATE+3],a ld [PLAYER_STATE+4],a jr .grounded .not_grounded: ; v' = v' + g ; register b = g in the above equation. The value can be adjusted ; based on trial and error to get the right feel for the game. ld hl,PLAYER_STATE+4 ld b,32 call add_fractional_to_16bit_number .grounded: ret check_is_grounded: ; output: ; a = the height where the player should be placed, if the player ; is on or below the ground. The output is "0" if the player is ; above the height of the tallest column under it. ; ; Sets the zero flag based on if "a" is "0" or not. call load_player_real_x_position ld c,a ; keep the position around for later and %00001111 ; if the last four bits are zero, then we're jr z,.on_column ; cleanly on a column ; At this point, we know at least one of the last three digits is ; non-zero, so we're between columns. That means we have to check ; two adjacent columns. .between_columns: ld a,c ; reload the x position call load_height_map_entry_for_x_position ld d,a ld a,c ; reload the x position add 15 ; get the x position at the right edge of the player call load_height_map_entry_for_x_position ld b,d call max call height_to_num_pixels_above_column jr is_player_above_column ; tail call .on_column: ; The player is exclusively over a column. ld a,c ; reload the x position call load_height_map_entry_for_x_position call height_to_num_pixels_above_column ; drop down into "is_player_above_column" function is_player_above_column: ; parameters: ; a = number of pixels above the column to check against ; ; Sets the zero flag if the player's feet are above the specified ; number of pixels, and unsets the flag otherwise (i.e. z := "is ; player not grounded"). ld b,a ld a,[PLAYER_STATE+1] ; load the player's y position and add 16 to add 16 ; get the position of the player's feet sub b ; compare it against the ground height as jr c,.not_grounded ; computed above (number of pixels above the ; the player's feet) ld a,b ; either we're below the ground or on the jr .set_z_flag ; ground. Either way, the output is the ; ground position. .not_grounded: ld a,0 .set_z_flag: cp 0 ret load_height_map_entry_for_x_position: ; parameters: ; a = the real x position of the player in the level, modulo 256. ; This is the x position of the player on the screen, plus the ; offset of the background. ; output: ; a = the height map entry corresponding to the given x position. ; This entry is one byte, and it consists of the heights for ; two adjacent columns. srl a ; divide the x position by 16 to get the column number srl a srl a srl a ld hl,HEIGHTS ; load the base address of the height map add a,l ; add the index into the height map and save it into ld l,a ; "l" so that "hl" points to the height that we then ld a,[hl] ; load into "a" ret height_to_num_pixels_above_column: ; parameters: ; a = the height of a column, as extracted from the height map ; output: ; a = the number of pixels that make up the sky above the column ld b,a ; compute (9 - height), as that tells us the number of ld a,9 ; sky tiles above the column sub b sla a ; multiply by 16 to get the number of pixels above the sla a ; column sla a sla a ret position_player: ; Note that the actual Y-coordinate on the screen is the value stored ; in the OAM structure minus 16, and the actual X-coordinate is the ; stored value minus 8. Furthermore, the two sprites that comprise ; the player have the same Y-coordinate, but two different ; X-coordinates (one being 8 more than the other). ; Because the coordinates are stored in 8.8 fixed point format, we ; can simply ignore the second byte in each pair, since the entire ; first byte is the integer portion. ; load and write the X-coordinates ld a,[PLAYER_STATE] sub a,8 ld [PLAYER+1],a add a,8 ld [PLAYER+5],a ; load and write the Y-coordinate ld a,[PLAYER_STATE+1] add a,16 ld [PLAYER],a ld [PLAYER+4],a ret load_player_real_x_position: ; output: ; a = the real x position of the player's left side, accounting for ; how much the background has scrolled (modulo any wraparound). ld a,[PLAYER_STATE] ; to get the player's real x position, start sub 15 ; with the position on screen, and add the ld hl,BGSCRL ; level scroll offset add a,[hl] ret scroll_world_if_needed: ld a,[SCROLLFLAG] cp 0 jr z,.no_scroll ld a,0 ld [SCROLLFLAG],a ld hl,BGSCRL inc [hl] ld hl,PLAYER_STATE dec [hl] .no_scroll: ret check_for_game_over: ; The player's x position is stored as the on-screen x position plus ; 16, so that the player can be partially to the left of the screen. ; This means that when the player has fully gone past the left of the ; screen, the position has wrapped around to 255. ; Because the player can't go too far to the right of the screen, we ; can safely assume the player's position is near 255 only when the ; player has gone to the left of the screen. Accounting for a little ; bit of buffer, we can safely check to see if the position is near ; 255, and if so, end the game. ld a,[PLAYER_STATE] sub 250 jr c,.done jp show_game_over_screen .done: ret scroll_bg: ld a,[BGSCRL] ld [$ff43],a ; set scrollx ret ; During the DMA transfer, the CPU can only access the High RAM ; (HRAM), so the transfer must be initiated from inside of HRAM. ; However, we can't directly place this procedure there at assembly ; time, so we'll put it here with the rest of the code, then copy it ; into HRAM at run time. sprite_dma: ld a,OAMBUF/$100 ld [$ff46],a ld a,$28 .wait: dec a jr nz,.wait ret sprite_dma_end: ; We'll set aside some space in HRAM, but we'll have to store the ; actual data here at run time. PUSHS SECTION "HRAM",HRAM ; This is the procedure that will actually be called to initiate the ; DMA transfer. hram_sprite_dma: DS sprite_dma_end-sprite_dma POPS ; = UTILITY FUNCTIONS =============================================== load_column_into_bg_tile_map_at_address: ; parameters: ; hl = start address of bg tile map ; b = number of rows filled with boxes ld a,$9 ; compute the number of rows filled with sky sub b ; b = 9 - b ld b,a ld d,$00 ; DE = $001f ld e,$1f ; the amount to increment HL by each tile row, minus one ; (so two increments are needed for each logical row). ; the minus one is because we'll increment by one in ; order to fill out the left and right sides of the box ; on each of the top and bottom portions of the box. ld c,$0 .loop: ld a,c ; if c == b: load a box tile sub b jr nc, .box ld a,$84 ; otherwise, load a sky tile ld [hl],a ; fill out the top-left inc hl ; fill out the top-right ld [hl],a add hl,de ; fill out the bottom-left ld [hl],a inc hl ; fill out the bottom-right ld [hl],a add hl,de ; get ready for the next load jr .done .box: ld a,$80 ; load a box tile ld [hl],a ; fill out the top-left inc hl ; fill out the top-right inc a ; with the next tile ld [hl],a add hl,de ; fill out the bottom-left inc a ; with the next tile ld [hl],a inc hl ; fill out the bottom-right inc a ; with the next tile ld [hl],a add hl,de ; get ready for the next load .done: inc c ; only bother filling out the top 9 rows, as that's all ld a,c ; that will be visible on screen cp $9 jr nz, .loop ret clear_bg: ; Zero out the background by loading only sky tiles. ld b,$04 ; we will write $0400 (1024) bytes ld c,$00 ld hl,$9800 ; we will be writing to the BG tile map .bg_reset_loop: ld a,$84 ; we will only be writing sky tiles ld [hl],a ; store one byte in the destination inc hl ; prepare to write another byte ; the same caveat applies as in memcpy dec bc ; decrement the counter ld a,b or c jr z,.bg_reset_loop_done ; return if all bytes written jr .bg_reset_loop .bg_reset_loop_done: ret memcpy: ; parameters: ; hl = source address ; de = destination address ; bc = number of bytes to copy ; assumes: ; bc > 0 ld a,[hl] ; load a byte from the source ld [de],a ; store it in the destination inc hl ; prepare to load another byte... inc de ; ...and prepare to write it ; Now we'll decrement the counter and check if it's zero. ; Unfortunately, when a 16-bit register is decremented, the zero flag ; is not updated, so we need to check if the counter is zero ; manually. A 16-bit value is zero when its constituent 8-bit ; portions are both zero, that is when (b | c) == 0, where "|" is a ; bitwise OR. dec bc ; decrement the counter ld a,b or c ret z ; return if all bytes written jr memcpy zeromem: ; parameters ; de = destination address ; bc = number of bytes to zero out ; assumes: ; bc > 0 .zeromem_loop: ld a,0 ; we will only be writing zeros ld [de],a ; store one byte in the destination inc de ; prepare to write another byte ; the same caveat applies as in memcpy dec bc ; decrement the counter ld a,b or c ret z ; return if all bytes written jr .zeromem_loop lcd_off: ld a,[$ff40] ; load the LCD Control register bit 7,a ; check bit 7, whether the LCD is on ret z ; if off, return immediately wait_vblank: ld a,[$ff44] ; load the vertical line the LCD is at cp 145 jr nz, wait_vblank ; Technically, at this point, we are not just at VBlank, but exactly ; at the start of VBlank. This is because the previous instruction ; made sure that [LY] is exactly 145, the first value when entering ; VBlank. ld a,[$ff40] ; load the LCD Control register res 7,a ; clear bit 7, turning off the LCD ld [$ff40],a ; write the new value back to the LCD Control register ret ; and done... lcd_on: ld a,%11000111 ; LCD on ; Window Tile Map at $9800-9fff ; window off ; BG & window Tile Data at $8800-$97ff ; BG Tile Map at $9800-$9bff ; sprite size 8x16 ; sprites on ; BG on ld [$ff40],a ; write it to the LCD Control register rand: ; An 8-bit pseudo-random number generator. Taken from ; http://www.z80.info/pseudo-random.txt ; ; R = an integer in the range [1, 256] ; R -> (33 * R) mod 257 ; ; parameters: ; hl = address where to take the seed and store the next seed ; output: ; a = next random number ld a,[hl] ld b,a rrca ; multiply by 32 rrca rrca xor $1f add a,b sbc a,$ff ld [hl],a ret next_rand_height: ; Generate the next random height to put into the height map. The ; result is in the range of [2, 5] inclusive. ; ; output: ; a = next random height push hl ; preserve HL ld hl,RANDHEIGHT ; the PRNG seed is in RANDHEIGHT call rand ; generate a pseudo-random number in the range ; [1, 256] and %00000011 ; preserve the two least-significant bits of the add a,%00000010 ; height. This brings the value down to the range ; of [0, 3]. Then add "2", bringing the value into ; the range [2, 5]. pop hl ; restore HL ret add_fractional_to_16bit_number: ; Adds a fractional value to 16-bit number stored in a 8.8 fixed ; point format. This entails adding the given value to the second ; byte (fractional part) of the number, then propagating the carry to ; the first byte (the integer part). ; ; No corresponding function is necessary to add an integer value, as ; that can be accomplished purely by adding to the first byte, ; without dealing with any carry. ; ; Stores the resulting number back at the location from which the ; original value was read. ; ; parameters: ; hl = address of *second* byte of the number to add to ; b = the fractional number to add ; output: ; [hl - 1] = [hl - 1] + b ld a,[hl] ; load the fractional part add a,b ; add the fractional part, setting the carry flag ld [hl],a ; store the fractional part dec hl ; move the address to the integer part ; this does not set the carry jr nc,.done ; no need to do anything to the integer part if there was ; no carry from the fractional part inc [hl] ; but if there was a carry, increment the integer part .done: ret max: ; Given two 8-bit integers, returns the larger of the two. ; ; parameters: ; a = the first integer ; b = the second integer ; output: ; a = max(a, b) sub b ; carry => a - b < 0 => a < b jr c,.b_is_larger .a_is_larger: add b ; restore a to its original value ret .b_is_larger: ld a,b ret add_16bit_numbers_in_memory: ; Adds two 16-bit numbers stored in a 8.8 fixed point format, storing ; the result back into the memory location of the first of the two ; numbers. ; ; parameters: ; bc = address of the *second* byte of the first number ; de = address of the *second* byte of the second number ; output: ; [bc - 1] = [bc - 1] + [de - 1] ld a,[bc] ; load the fractional part of the first number ld h,a ; into "h" ld a,[de] ; load the fractional part of the second number into "a" add a,h ; a += h. This sets the carry flag. ld [bc],a ; store the result back into the fractional part of the ; first number dec bc ; move the the integer part of both numbers dec de ; this doesn't affect the carry flag ld a,[bc] ; load the integer part of the first number ld h,a ; into "h" ld a,[de] ; load the integer part of the second number into "a" adc a,h ; a += h + c ld [bc],a ; store the result back into the integer part of the first ; number ret ; = DATA ============================================================ bgpal: DB %11100100 ; white is transparent, lightest to darkest. sppal: DB %00011100 ; missing second darkest bgbox: ; background box, 2x2 tiles DB $7f,$7f,$9f,$f0,$8f,$f8,$c7,$fc DB $e3,$be,$f1,$9f,$f8,$8f,$fc,$87 DB $fe,$fe,$f9,$0f,$f1,$1f,$e3,$3f DB $c5,$7f,$8b,$fd,$97,$f9,$6f,$f1 DB $fe,$87,$f9,$8f,$f1,$9f,$e2,$bf DB $c5,$fe,$8b,$fc,$97,$f8,$7f,$7f DB $3f,$e1,$1f,$f1,$8f,$f9,$c7,$7d DB $e3,$3f,$f1,$1f,$f9,$0f,$fe,$fe bgsky: ; background sky, 1x1 tile DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00 bgbigfont: ; backgound menu title, 7 2x2 tites DB $00,$00,$38,$38,$6c,$6c,$5e,$5e ; M DB $5f,$5f,$5f,$5f,$5f,$5f,$5f,$5f DB $00,$00,$1c,$1c,$36,$36,$6e,$6e DB $de,$de,$de,$de,$fe,$fe,$fe,$fe DB $5b,$5b,$5b,$5b,$59,$59,$78,$78 DB $78,$78,$78,$78,$38,$38,$00,$00 DB $de,$de,$de,$de,$9e,$9e,$1e,$1e DB $1e,$1e,$1e,$1e,$1c,$1c,$00,$00 DB $00,$00,$07,$07,$1f,$1f,$36,$36 ; O DB $2c,$2c,$6c,$6c,$5c,$5c,$5c,$5c DB $00,$00,$e0,$e0,$f8,$f8,$7c,$7c DB $3c,$3c,$3e,$3e,$3e,$3e,$3e,$3e DB $5c,$5c,$7c,$7c,$7c,$7c,$3c,$3c DB $3e,$3e,$1f,$1f,$07,$07,$00,$00 DB $3e,$3e,$2e,$2e,$2e,$2e,$2c,$2c DB $6c,$6c,$f8,$f8,$e0,$e0,$00,$00 DB $00,$00,$38,$38,$6e,$6e,$5f,$5f ; N DB $5f,$5f,$5f,$5f,$5b,$5b,$5b,$5b DB $00,$00,$1c,$1c,$1e,$1e,$16,$16 DB $16,$16,$16,$16,$96,$96,$96,$96 DB $59,$59,$59,$59,$58,$58,$78,$78 DB $78,$78,$78,$78,$38,$38,$00,$00 DB $d6,$d6,$d6,$d6,$f6,$f6,$fe,$fe DB $7e,$7e,$7e,$7e,$1c,$1c,$00,$00 DB $00,$00,$3f,$3f,$67,$67,$5e,$5e ; E DB $58,$58,$70,$70,$70,$70,$3f,$3f DB $00,$00,$fc,$fc,$fe,$fe,$3e,$3e DB $0e,$0e,$04,$04,$00,$00,$80,$80 DB $3f,$3f,$78,$78,$50,$50,$58,$58 DB $7e,$7e,$7f,$7f,$3f,$3f,$00,$00 DB $80,$80,$04,$04,$0e,$0e,$1e,$1e DB $36,$36,$ee,$ee,$fc,$fc,$00,$00 DB $00,$00,$38,$38,$68,$68,$58,$58 ; Y DB $58,$58,$7c,$7c,$3e,$3e,$3f,$3f DB $00,$00,$1c,$1c,$1e,$1e,$16,$16 DB $16,$16,$36,$36,$6c,$6c,$dc,$dc DB $1f,$1f,$0f,$0f,$03,$03,$03,$03 DB $03,$03,$03,$03,$01,$01,$00,$00 DB $f8,$f8,$e0,$e0,$c0,$c0,$c0,$c0 DB $c0,$c0,$c0,$c0,$80,$80,$00,$00 DB $00,$00,$3f,$3f,$6f,$6f,$5c,$5c ; R DB $58,$58,$58,$58,$5c,$5c,$5f,$5f DB $00,$00,$e0,$e0,$f8,$f8,$7c,$7c DB $3c,$3c,$2c,$2c,$68,$68,$d8,$d8 DB $5f,$5f,$5f,$5f,$5b,$5b,$79,$79 DB $78,$78,$78,$78,$38,$38,$00,$00 DB $f0,$f0,$c0,$c0,$e0,$e0,$f0,$f0 DB $f8,$f8,$7c,$7c,$38,$38,$00,$00 DB $00,$00,$38,$38,$68,$68,$58,$58 ; U DB $58,$58,$58,$58,$58,$58,$58,$58 DB $00,$00,$1c,$1c,$1e,$1e,$1e,$1e DB $1e,$1e,$1e,$1e,$1e,$1e,$1e,$1e DB $58,$58,$5c,$5c,$7c,$7c,$3f,$3f DB $3f,$3f,$1f,$1f,$07,$07,$00,$00 DB $16,$16,$36,$36,$2e,$2e,$ec,$ec DB $dc,$dc,$f8,$f8,$e0,$e0,$00,$00 DB $00,$00,$07,$07,$1f,$1f,$36,$36 ; G DB $2c,$2c,$6c,$6c,$5c,$5c,$5c,$5c DB $00,$00,$f0,$f0,$fc,$fc,$1e,$1e DB $0e,$0e,$00,$00,$00,$00,$7e,$7e DB $5c,$5c,$7c,$7c,$7c,$7c,$3c,$3c DB $3e,$3e,$1f,$1f,$07,$07,$00,$00 DB $76,$76,$1e,$1e,$0e,$0e,$1e,$1e DB $3e,$3e,$fc,$fc,$f0,$f0,$00,$00 DB $00,$00,$07,$07,$1f,$1f,$37,$37 ; A DB $2f,$2f,$6c,$6c,$5c,$5c,$58,$58 DB $00,$00,$e0,$e0,$f8,$f8,$fc,$fc DB $fc,$fc,$3e,$3e,$3e,$3e,$1e,$1e DB $58,$58,$5f,$5f,$5f,$5f,$78,$78 DB $78,$78,$78,$78,$38,$38,$00,$00 DB $1e,$1e,$fe,$fe,$f6,$f6,$16,$16 DB $16,$16,$16,$16,$1c,$1c,$00,$00 DB $00,$00,$38,$38,$6c,$6c,$6c,$6c ; V DB $2e,$2e,$36,$36,$17,$17,$1b,$1b DB $00,$00,$1c,$1c,$3e,$3e,$2e,$2e DB $6c,$6c,$5c,$5c,$d8,$d8,$f8,$f8 DB $0b,$0b,$0d,$0d,$05,$05,$06,$06 DB $03,$03,$03,$03,$01,$01,$00,$00 DB $f0,$f0,$f0,$f0,$e0,$e0,$e0,$e0 DB $c0,$c0,$c0,$c0,$80,$80,$00,$00 bgsmallfont: DB $00,$00,$3c,$3c,$42,$42,$42,$42 ; P DB $7c,$7c,$40,$40,$40,$40,$00,$00 DB $00,$00,$3c,$3c,$42,$42,$42,$42 ; R DB $7c,$7c,$48,$48,$44,$44,$00,$00 DB $00,$00,$3c,$3c,$42,$42,$42,$42 ; E DB $7c,$7c,$40,$40,$3e,$3e,$00,$00 DB $00,$00,$3c,$3c,$42,$42,$40,$40 ; S DB $3c,$3c,$02,$02,$3c,$3c,$00,$00 DB $00,$00,$7e,$7e,$08,$08,$08,$08 ; T DB $08,$08,$08,$08,$08,$08,$00,$00 DB $00,$00,$18,$18,$24,$24,$42,$42 ; A DB $7e,$7e,$42,$42,$42,$42,$00,$00 bgtitlemap: ; The tile map for the menu title. This is just the four lines that ; make up the title, and that too only the part of the lines that ; have actual tiles in them. The bytes are copied into the correct ; location in the tile map area of memory. DB $85,$86,$89,$8a,$8d,$8e,$91,$92,$95,$96 ; Line 0 DB $87,$88,$8b,$8c,$8f,$90,$93,$94,$97,$98 ; Line 1 DB $99,$9a,$9d,$9e,$8d,$8e ; Line 2 DB $9b,$9c,$9f,$a0,$8f,$90 ; Line 3 bgpressstartmap: ; The tile map for "PRESS START" text. This is just the line that ; makes up the text, and that too only part of the line. The bytes ; are copied into the correct location int he tile map area of ; memory. DB $ad,$ae,$af,$b0,$b0,$84,$84,$b0,$b1,$b2,$ae,$b1 gameovertitlemap: ; The tile map for the game over title. This is just the four lines ; that make up the title, and that too only the part of the lines ; that have actual tiles in them. The bytes are copied into the ; correct location in the tile map area of memory. DB $a1,$a2,$a5,$a6,$85,$86,$91,$92 ; Line 0 DB $a3,$a4,$a7,$a8,$87,$88,$93,$94 ; Line 1 DB $89,$8a,$a9,$aa,$91,$92,$99,$9a ; Line 2 DB $8b,$8c,$ab,$ac,$93,$94,$9b,$9c ; Line 3 ghost: ; foreground ghost ; ; There are a total of 4 tiles laid out in a 2x2 grid, but because ; the sprites used are 8x16 pixels in dimension, only two sprites are ; required. DB $03,$00,$0c,$03,$10,$0f,$11,$0f ; sprite 0 DB $23,$1d,$27,$19,$27,$19,$61,$1f DB $ab,$55,$a5,$5a,$a1,$5f,$61,$1f DB $21,$1f,$20,$1f,$26,$19,$19,$00 DB $c0,$00,$30,$c0,$f8,$f0,$f8,$f0 ; sprite 1 DB $fc,$d8,$fc,$98,$fc,$98,$fe,$f8 DB $ff,$5a,$ff,$aa,$ff,$fa,$fe,$f8 DB $fc,$f8,$fc,$f8,$7c,$98,$98,$00 ; vim: ft=rgbasm:tw=72:cc=72:ts=2:sw=2
libsrc/_DEVELOPMENT/math/float/math32/c/sdcc/cm32_sdcc_atan2_callee.asm
jpoikela/z88dk
640
240461
<reponame>jpoikela/z88dk SECTION code_fp_math32 PUBLIC cm32_sdcc_atan2_callee EXTERN _m32_atan2f cm32_sdcc_atan2_callee: pop hl ; return pop bc ; LHS pop de pop af ; RHS ex (sp),hl ; return to stack push hl ; RHS push af push de ; LHS push bc call _m32_atan2f pop af pop af pop af pop af ret
rgb_triangle.asm
Dove6/bmp-rgb-triangle-mips
0
22462
<reponame>Dove6/bmp-rgb-triangle-mips<gh_stars>0 ##### USER-DEFINED SYMBOLS ##### # given vertices .eqv VERTEX1_X 148 .eqv VERTEX1_Y 51 .eqv VERTEX1_COLOR 0xa9f7d1 # 0xRRGGBB .eqv VERTEX2_X 212 .eqv VERTEX2_Y 121 .eqv VERTEX2_COLOR 0xaa3af1 # 0xRRGGBB .eqv VERTEX3_X 72 .eqv VERTEX3_Y 197 .eqv VERTEX3_COLOR 0xeb6f24 # 0xRRGGBB # settings .eqv BITMAP_WIDTH 256 .eqv BITMAP_HEIGHT 256 .eqv RESULT_FILENAME "result.bmp" ##### INTERNAL DATA ##### .data .half -1 # padding (for word-aligning bitmap header) bitmap_file_header: # BITMAPFILEHEADER structure template .ascii "BM" # (+0x0) bfType .word 14 # (+0x2) bfSize .half 0 # (+0x6) bfReserved1 .half 0 # (+0x8) bfReserved2 .word 54 # (+0xa) bfOffBits # symbols for info header-related offsets .eqv BFSIZE 2 bitmap_info_header: # BITMAPINFOHEADER structure template .word 40 # (+0x00) biSize .word 0 # (+0x04) biWidth (to specify) .word 0 # (+0x08) biHeight (to specify) .half 1 # (+0x0c) biPlanes .half 24 # (+0x0e) biBitCount .word 0 # (+0x10) biCompression .word 0 # (+0x14) biSizeImage (to specify) .word 0 # (+0x18) biXPelsPerMeter (ignored) .word 0 # (+0x1c) biYPelsPerMeter (ignored) .word 0 # (+0x20) biClrUsed .word 0 # (+0x24) biClrImportant # symbols for info header-related offsets .eqv BISIZE 0 .eqv BIWIDTH 4 .eqv BIHEIGHT 8 .eqv BISIZEIMAGE 20 output_filename: .asciiz RESULT_FILENAME vertex_data: # three vertex structures (3 words each) .word VERTEX1_X # (+0x00) X1 .word VERTEX1_Y # (+0x04) Y1 .word VERTEX1_COLOR # (+0x08) B1 # (+0x09) G1 # (+0x0a) R1 .word VERTEX2_X # (+0x0c) X2 .word VERTEX2_Y # (+0x10) Y2 .word VERTEX2_COLOR # (+0x14) B2 # (+0x15) G2 # (+0x16) R2 .word VERTEX3_X # (+0x18) X3 .word VERTEX3_Y # (+0x1c) Y3 .word VERTEX3_COLOR # (+0x20) B3 # (+0x21) G3 # (+0x22) R3 # symbols for vertices-related offsets .eqv X1 0 .eqv Y1 4 .eqv COLOR1 8 .eqv B1 8 .eqv G1 9 .eqv R1 10 .eqv X2 12 .eqv Y2 16 .eqv COLOR2 20 .eqv B2 20 .eqv G2 21 .eqv R2 22 .eqv X3 24 .eqv Y3 28 .eqv COLOR3 32 .eqv B3 32 .eqv G3 33 .eqv R3 34 error_strings: # array of error messages with a maximal length of 63 characters .align 3 .asciiz "An error has occured: " # common error message .double 0, 0, 0, 0, 0 # padding .asciiz "Non-positive bitmap size." # error code 1 .double 0, 0, 0, 0 # padding .asciiz "Vertex outside the bitmap." # error code 2 .double 0, 0, 0, 0 # padding .asciiz "Specified shape is not a triangle." # error code 3 .double 0, 0, 0 # padding .asciiz "Too large image size." # error code 4 .double 0, 0, 0, 0, 0 # padding .asciiz "Couldn't create the output file." # error code 5 .double 0, 0, 0 # padding .asciiz "Error while writing to output file." # error code 6 .double 0, 0, 0 # padding .asciiz "Unknown error." # unknown error code .double 0, 0, 0, 0, 0, 0 # padding .text ##### MACROS ##### .macro pad_to_word(%regValue, %regResult) # %regValue may be %regResult addiu %regResult, %regValue, 3 andi %regResult, -4 .end_macro .macro min_max_of_three(%regNumber1, %regNumber2, %regNumber3, %regTemporary, %regResultMin, %regResultMax) # no register may occur more than once in the argument list # (except %regResult1, which can be used as %regTemporary) move %regResultMin, %regNumber1 move %regResultMax, %regNumber1 sgtu %regTemporary, %regNumber2, %regResultMax movn %regResultMax, %regNumber2, %regTemporary sltu %regTemporary, %regNumber2, %regResultMin movn %regResultMin, %regNumber2, %regTemporary sgtu %regTemporary, %regNumber3, %regResultMax movn %regResultMax, %regNumber3, %regTemporary sltu %regTemporary, %regNumber3, %regResultMin movn %regResultMin, %regNumber3, %regTemporary .end_macro .macro check_if_in_range(%regMin, %regMax, %regChecked, %regTemporary, %regResult) # neither %regMax nor %regChecked can be used as %regTemporary # %regResult cannot be %regTemporary # values of %regTemporary and %regResult are overwritten # result: # %regResult - 1 if in range, 0 otherwise sge %regTemporary, %regChecked, %regMin sle %regResult, %regChecked, %regMax and %regResult, %regTemporary, %regResult .end_macro .macro compare_points(%regX1, %regY1, %regX2, %regY2, %regTemporary, %regResult) # neither %regY1 nor %regY2 can be used as %regResult # %regResult cannot be %regTemporary # values of %regTemporary and %regResult are overwritten # result: # %regResult - 1 if points have the same coordinates, 0 otherwise seq %regTemporary, %regX1, %regX2 seq %regResult, %regY1, %regY2 and %regResult, %regTemporary, %regResult .end_macro .macro blend_color(%regColor1, %regColor2, %regColor3, %shift, %fpRegWeight1, %fpRegWeight2, %fpRegWeight3, %regResult) # $f30 and $f31 are used for calculations internally, so they cannot be used as %fpRegWeight1-3 # weights in %fpRegWeight1-3 have to be single-precision floating-point values and should sum to 1.0 # result: # %regResult - blent compound color (range: 0-255) srl %regResult, %regColor1, %shift # first part andi %regResult, 0xff mtc1 %regResult, $f31 cvt.s.w $f31, $f31 mul.s $f31, $f31, %fpRegWeight1 srl %regResult, %regColor2, %shift # second part andi %regResult, 0xff mtc1 %regResult, $f30 cvt.s.w $f30, $f30 mul.s $f30, $f30, %fpRegWeight2 add.s $f31, $f31, $f30 srl %regResult, %regColor3, %shift # third part andi %regResult, 0xff mtc1 %regResult, $f30 cvt.s.w $f30, $f30 mul.s $f30, $f30, %fpRegWeight3 add.s $f31, $f31, $f30 round.w.s $f31, $f31 # getting result back from coproc 1 mfc1 %regResult, $f31 andi %regResult, 0xff .end_macro ### MAIN FUNCTION ### main: la $s2, vertex_data li $s3, BITMAP_WIDTH li $s4, BITMAP_HEIGHT ## validate input move $a0, $s3 move $a1, $s4 move $a2, $s2 jal validate_input bltz $v0, print_error # handle the error on negative return value ## prepare bitmap header and data buffer move $a0, $s3 move $a1, $s4 jal generate_bitmap bltz $v0, print_error # handle the error on negative return value move $s0, $v0 move $s1, $v1 ## process the bitmap move $a0, $s0 move $a1, $s1 move $a2, $s2 jal draw_triangle ## save it to file la $a0, output_filename move $a1, $s0 move $a2, $s1 jal save_bitmap_to_file bgez $v0, exit # jump over the error handling on return value >= 0 ## handle errors print_error: subu $t3, $zero, $v0 li $t0, 1 li $t1, 5 addu $t2, $t0, $t1 check_if_in_range($t0, $t1, $t3, $t0, $t1) movn $t2, $t3, $t1 sll $t2, $t2, 6 # multiply by 64 (bytes per string) li $v0, 4 la $a0, error_strings # output a general error message syscall li $v0, 4 la $a0, error_strings($t2) # print more specific error info syscall ## finish the execution exit: li $v0, 10 syscall ##### FUNCTIONS ##### validate_input: # parameters: # $a0 - bitmap width # $a1 - bitmap height # $a2 - address of vertices data # returns: # $v0 - 0 for valid data, negative error number otherwise move $v0, $zero subiu $t0, $a0, 1 subiu $t1, $a1, 1 slt $t0, $t0, $zero slt $t1, $t1, $zero or $t0, $t0, $t1 beqz $t0, validate_vertices li $v0, -1 # error: non-positive bitmap size jr $ra validate_vertices: li $t0, 3 # initialize loop counter for three vertices move $t1, $a2 validate_vertices_loop: subiu $t0, $t0, 1 bltz $t0, validate_shape lw $t2, ($t1) # X lw $t3, 4($t1) # Y check_if_in_range($zero, $a0, $t2, $t4, $t2) # check if 0 <= X <= width check_if_in_range($zero, $a1, $t3, $t4, $t3) # check if 0 <= Y <= height and $t2, $t2, $t3 addiu $t1, $t1, 12 bnez $t2, validate_vertices_loop li $v0, -2 # error: vertex outside the bitmap jr $ra validate_shape: li $t9, -3 # error: not a triangle lw $t0, X1($a2) lw $t1, Y1($a2) lw $t2, X2($a2) lw $t3, Y2($a2) lw $t4, X3($a2) lw $t5, Y3($a2) compare_points($t0, $t1, $t2, $t3, $t7, $t6) # point1 and point2 movn $v0, $t9, $t6 # indicate an error if points are identical compare_points($t0, $t1, $t4, $t5, $t7, $t6) # point1 and point3 movn $v0, $t9, $t6 # indicate an error if points are identical compare_points($t2, $t3, $t4, $t5, $t7, $t6) # point2 and point3 movn $v0, $t9, $t6 # indicate an error if points are identical jr $ra generate_bitmap: # parameters: # $a0 - bitmap width # $a1 - bitmap height # returns: # $v0 - address of adjusted BITMAPINFOHEADER structure describing the bitmap on success, negative error code otherwise # $v1 - address of image data buffer on success move $t0, $a0 move $t1, $a1 ## prepare header lw $t2, bitmap_info_header+BISIZE # allocate memory for bitmap header li $v0, 9 move $a0, $t2 syscall move $t3, $v0 # copy template data to allocated header move $t4, $zero header_copy_loop: lw $t5, bitmap_info_header($t4) addu $t6, $t3, $t4 sw $t5, ($t6) addiu $t4, $t4, 4 blt $t4, $t2, header_copy_loop # adjust the bitmap header sw $t0, BIWIDTH($t3) sw $t1, BIHEIGHT($t3) sll $t4, $t0, 1 # addu $t4, $t4, $t0 # multiply width by 3 pad_to_word($t4, $t4) mulu $t4, $t4, $t1 mfhi $t5 # check for too big size beqz $t5, proceed_with_data_size li $v0, -4 # error: size too large jr $ra proceed_with_data_size: sw $t4, BISIZEIMAGE($t3) # pixel data size ## allocate space for pixel data li $v0, 9 move $a0, $t4 syscall ## place returned addresses in v-registers move $v1, $v0 move $v0, $t3 jr $ra draw_triangle: # parameters: # $a0 - address of bitmap details (BITMAPINFOHEADER) # $a1 - address of bitmap data # $a2 - address of vertices data ## prologue subiu $sp, $sp, 64 sw $s0, ($sp) sw $s1, 4($sp) sw $s2, 8($sp) sw $s3, 12($sp) sw $s4, 16($sp) sw $s5, 20($sp) sw $s6, 24($sp) sw $s7, 28($sp) ## stack layout # (+0x3c) [X1 - X3] - helper barycentric equation factor for the second vertex Y position # (+0x38) [X3 - X2] - helper barycentric equation factor for the first vertex Y position # (+0x34) [Y3 - Y1] - helper barycentric equation factor for the second vertex X position # (+0x30) [Y2 - Y3] - helper barycentric equation factor for the first vertex X position # (+0x2c) vertex max Y # (+0x28) vertex min Y # (+0x24) vertex max X # (+0x20) vertex min X # (+0x00) saved registers (8 * 4 bytes) .eqv FACTOR_Y2 60 .eqv FACTOR_Y1 56 .eqv FACTOR_X2 52 .eqv FACTOR_X1 48 .eqv MAX_Y 44 .eqv MIN_Y 40 .eqv MAX_X 36 .eqv MIN_X 32 ## registers layout # saved registers layout: # $s0 - row counter # $s1 - column counter # $s2 - pixel memory offset # $s3 - empty (outside the clipping rectangle) row indicator (0 - non-empty, 1 - empty) # $s4 - barycentric equation line constant summand for the first vertex # $s5 - barycentric equation line constant summand for the second vertex # $s6 - background color # temporary registers layout: # $t0 - current color # floating-point registers layout: # $f0 - zero # $f1 - barycentric equations denominator mtc1 $zero, $f0 # place 0 in floating-point register (for further calculations) lw $s0, BIHEIGHT($a0) ## calculate background color li $s6, 0xffffff lw $t9, COLOR3($a2) lw $t8, COLOR2($a2) lw $t7, COLOR1($a2) li $t6, 0xf0f0f0 and $t5, $t9, $t6 seq $t5, $t5, $t6 move $t3, $t5 # increment if first vertex is whitish and $t5, $t8, $t6 seq $t5, $t5, $t6 addu $t3, $t3, $t5 # increment if second vertex is whitish and $t5, $t7, $t6 seq $t5, $t5, $t6 addu $t3, $t3, $t5 # increment if third vertex is whitish blt $t3, 2, calc_denominator li $s6, 0x000000 # if 2 or more vertices are whitish, make background black ## calculate constant barymetric equations parts # calculate barymetric equations denominator: (Y2 - Y3)(X1 - X3)+(X3 - X2)(Y1 - Y3) calc_denominator: lw $t9, Y3($a2) lw $t8, X3($a2) lw $t7, Y2($a2) lw $t6, X2($a2) lw $t5, Y1($a2) lw $t4, X1($a2) subu $t3, $t7, $t9 subu $t2, $t8, $t6 subu $t1, $t5, $t9 subu $t0, $t4, $t8 mul $t3, $t3, $t0 mul $t2, $t2, $t1 addu $t3, $t3, $t2 mtc1 $t3, $f1 # cvt.s.w $f1, $f1 # save the denominator in $f1 # calculate barycentric equations helper factors subu $t3, $t7, $t9 # Y2 - Y3 subu $t2, $t9, $t5 # Y3 - Y1 sw $t3, FACTOR_X1($sp) sw $t2, FACTOR_X2($sp) subu $t3, $t8, $t6 # X3 - X2 subu $t2, $t4, $t8 # X1 - X3 sw $t3, FACTOR_Y1($sp) sw $t2, FACTOR_Y2($sp) ## calculate clipping rectangle position # calculate min and max vertex X position min_max_of_three($t8, $t6, $t4, $t1, $t3, $t2) sw $t3, MIN_X($sp) sw $t2, MAX_X($sp) # calculate min and max vertex Y position min_max_of_three($t9, $t7, $t5, $t1, $t3, $t2) sw $t3, MIN_Y($sp) sw $t2, MAX_Y($sp) row_loop: subiu $s0, $s0, 1 bltz $s0, drawing_end lw $s1, BIWIDTH($a0) ## calculate barycentric equation summands (constant per line) # first: (X3 - X2)(Yp - Y3) lw $t9, Y3($a2) subu $t9, $s0, $t9 lw $t8, FACTOR_Y1($sp) mul $s4, $t8, $t9 # save the summand in $s4 # second: (X1 - X3)(Yp - Y3) lw $t8, FACTOR_Y2($sp) mul $s5, $t8, $t9 # save the summand in $s5 ## calculate memory offset of the last column in the row calc_offset: lw $s2, BIWIDTH($a0) pad_to_word($s2, $s2) mulu $s2, $s2, $s0 # multiply padded image width by current row number addu $s2, $s2, $s1 # add last column offset sll $t9, $s2, 1 # addu $s2, $t9, $s2 # multiply by 3 (bytes per pixels) ## check if row is inside the clipping rectangle lw $t9, MIN_Y($sp) lw $t8, MAX_Y($sp) check_if_in_range($t9, $t8, $s0, $t9, $s3) # save result in $s3 column_loop: subiu $s1, $s1, 1 subiu $s2, $s2, 3 bltz $s1, row_loop move $t0, $s6 # current color = background ## check if pixel is inside the clipping rectangle # check vertically beqz $s3, store_pixel # check horizontally lw $t9, MIN_X($sp) lw $t8, MAX_X($sp) check_if_in_range($t9, $t8, $s1, $t9, $t8) beqz $t9, store_pixel ## calculate barymetric weights # W1 = 100*[(Y2 - Y3)(Xp - X3) + (X3 - X2)(Yp - Y3)]/[(Y2 - Y3)(X1 - X3)+(X3 - X2)(Y1 - Y3)] lw $t9, FACTOR_X1($sp) # Y2 - Y3 lw $t8, X3($a2) subu $t8, $s1, $t8 mul $t9, $t9, $t8 addu $t9, $t9, $s4 mtc1 $t9, $f2 # $f2 = W1 cvt.s.w $f2, $f2 div.s $f2, $f2, $f1 c.lt.s $f2, $f0 bc1t store_pixel # W2 = 100*[(Y3 - Y1)(Xp - X3) + (X1 - X3)(Yp - Y3)]/[(Y2 - Y3)(X1 - X3)+(X3 - X2)(Y1 - Y3)] lw $t7, FACTOR_X2($sp) # Y3 - Y1 mul $t8, $t8, $t7 addu $t8, $t8, $s5 mtc1 $t8, $f3 # $f3 = W2 cvt.s.w $f3, $f3 div.s $f3, $f3, $f1 c.lt.s $f3, $f0 bc1t store_pixel # W3 = 100 - W1 - W2 li $t7, 1 # mtc1 $t7, $f4 # cvt.s.w $f4, $f4 # li.s $f4, 100.0 sub.s $f4, $f4, $f2 sub.s $f4, $f4, $f3 # $f4 = W3 c.lt.s $f4, $f0 bc1t store_pixel ## calculate blent color move $t0, $zero lw $t9, COLOR1($a2) lw $t8, COLOR2($a2) lw $t7, COLOR3($a2) # red blend_color($t9, $t8, $t7, 16, $f2, $f3, $f4, $t6) sll $t0, $t6, 16 # green blend_color($t9, $t8, $t7, 8, $f2, $f3, $f4, $t6) sll $t6, $t6, 8 or $t0, $t0, $t6 # blue blend_color($t9, $t8, $t7, 0, $f2, $f3, $f4, $t6) or $t0, $t0, $t6 store_pixel: addu $t9, $a1, $s2 # add offset to image address sb $t0, ($t9) # store blue srl $t0, $t0, 8 sb $t0, 1($t9) # store green srl $t0, $t0, 8 sb $t0, 2($t9) # store red j column_loop drawing_end: ## epilogue lw $s7, 28($sp) lw $s6, 24($sp) lw $s5, 20($sp) lw $s4, 16($sp) lw $s3, 12($sp) lw $s2, 8($sp) lw $s1, 4($sp) lw $s0, ($sp) addiu $sp, $sp, 64 jr $ra save_bitmap_to_file: # parameters: # $a0 - address of null-terminated output filename string # $a1 - address of bitmap details (BITMAPINFOHEADER) # $a2 - address of bitmap data # returns: # $v0 - 0 on success, positive error code otherwise move $t0, $a1 move $t1, $a2 ## open output file li $v0, 13 # filename already in $a0 li $a1, 1 # write-only mode syscall move $t2, $v0 bgez $t2, write_file_header li $v0, -5 # error: could not open the file jr $ra ## write BMP headers to file write_file_header: li $v0, 15 move $a0, $t2 la $a1, bitmap_file_header lw $t3, BFSIZE($a1) move $a2, $t3 syscall beq $v0, $t3, write_info_header li $v0, -6 # error writing to file jr $ra write_info_header: li $v0, 15 move $a0, $t2 move $a1, $t0 lw $t3, BISIZE($a1) move $a2, $t3 syscall beq $v0, $t3, write_bitmap li $v0, -6 # error writing to file jr $ra ## write image contents to file write_bitmap: li $v0, 15 move $a0, $t2 move $a1, $t1 lw $t3, BISIZEIMAGE($t0) move $a2, $t3 syscall beq $v0, $t3, close_file li $v0, -6 # error writing to file jr $ra ## close the file close_file: li $v0, 16 move $a0, $t0 syscall move $v0, $zero jr $ra
Definition/Conversion/Stability.agda
Vtec234/logrel-mltt
0
16468
<gh_stars>0 {-# OPTIONS --without-K --safe #-} module Definition.Conversion.Stability where open import Definition.Untyped open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Weakening open import Definition.Conversion open import Definition.Conversion.Soundness open import Definition.Typed.Consequences.Syntactic open import Definition.Typed.Consequences.Substitution open import Tools.Product import Tools.PropositionalEquality as PE -- Equality of contexts. data ⊢_≡_ : (Γ Δ : Con Term) → Set where ε : ⊢ ε ≡ ε _∙_ : ∀ {Γ Δ A B} → ⊢ Γ ≡ Δ → Γ ⊢ A ≡ B → ⊢ Γ ∙ A ≡ Δ ∙ B mutual -- Syntactic validity and conversion substitution of a context equality. contextConvSubst : ∀ {Γ Δ} → ⊢ Γ ≡ Δ → ⊢ Γ × ⊢ Δ × Δ ⊢ˢ idSubst ∷ Γ contextConvSubst ε = ε , ε , id contextConvSubst (_∙_ {Γ} {Δ} {A} {B} Γ≡Δ A≡B) = let ⊢Γ , ⊢Δ , [σ] = contextConvSubst Γ≡Δ ⊢A , ⊢B = syntacticEq A≡B Δ⊢B = stability Γ≡Δ ⊢B in ⊢Γ ∙ ⊢A , ⊢Δ ∙ Δ⊢B , (wk1Subst′ ⊢Γ ⊢Δ Δ⊢B [σ] , conv (var (⊢Δ ∙ Δ⊢B) here) (PE.subst (λ x → _ ⊢ _ ≡ x) (wk1-tailId A) (wkEq (step id) (⊢Δ ∙ Δ⊢B) (stabilityEq Γ≡Δ (sym A≡B))))) -- Stability of types under equal contexts. stability : ∀ {A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A → Δ ⊢ A stability Γ≡Δ A = let ⊢Γ , ⊢Δ , σ = contextConvSubst Γ≡Δ q = substitution A σ ⊢Δ in PE.subst (λ x → _ ⊢ x) (subst-id _) q -- Stability of type equality. stabilityEq : ∀ {A B Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A ≡ B → Δ ⊢ A ≡ B stabilityEq Γ≡Δ A≡B = let ⊢Γ , ⊢Δ , σ = contextConvSubst Γ≡Δ q = substitutionEq A≡B (substRefl σ) ⊢Δ in PE.subst₂ (λ x y → _ ⊢ x ≡ y) (subst-id _) (subst-id _) q -- Reflexivity of context equality. reflConEq : ∀ {Γ} → ⊢ Γ → ⊢ Γ ≡ Γ reflConEq ε = ε reflConEq (⊢Γ ∙ ⊢A) = reflConEq ⊢Γ ∙ refl ⊢A -- Symmetry of context equality. symConEq : ∀ {Γ Δ} → ⊢ Γ ≡ Δ → ⊢ Δ ≡ Γ symConEq ε = ε symConEq (Γ≡Δ ∙ A≡B) = symConEq Γ≡Δ ∙ stabilityEq Γ≡Δ (sym A≡B) -- Stability of terms. stabilityTerm : ∀ {t A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ t ∷ A → Δ ⊢ t ∷ A stabilityTerm Γ≡Δ t = let ⊢Γ , ⊢Δ , σ = contextConvSubst Γ≡Δ q = substitutionTerm t σ ⊢Δ in PE.subst₂ (λ x y → _ ⊢ x ∷ y) (subst-id _) (subst-id _) q -- Stability of term reduction. stabilityRedTerm : ∀ {t u A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ t ⇒ u ∷ A → Δ ⊢ t ⇒ u ∷ A stabilityRedTerm Γ≡Δ (conv d x) = conv (stabilityRedTerm Γ≡Δ d) (stabilityEq Γ≡Δ x) stabilityRedTerm Γ≡Δ (app-subst d x) = app-subst (stabilityRedTerm Γ≡Δ d) (stabilityTerm Γ≡Δ x) stabilityRedTerm Γ≡Δ (fst-subst ⊢F ⊢G t⇒) = fst-subst (stability Γ≡Δ ⊢F) (stability (Γ≡Δ ∙ refl ⊢F) ⊢G) (stabilityRedTerm Γ≡Δ t⇒) stabilityRedTerm Γ≡Δ (snd-subst ⊢F ⊢G t⇒) = snd-subst (stability Γ≡Δ ⊢F) (stability (Γ≡Δ ∙ refl ⊢F) ⊢G) (stabilityRedTerm Γ≡Δ t⇒) stabilityRedTerm Γ≡Δ (Σ-β₁ ⊢F ⊢G ⊢t ⊢u) = Σ-β₁ (stability Γ≡Δ ⊢F) (stability (Γ≡Δ ∙ refl ⊢F) ⊢G) (stabilityTerm Γ≡Δ ⊢t) (stabilityTerm Γ≡Δ ⊢u) stabilityRedTerm Γ≡Δ (Σ-β₂ ⊢F ⊢G ⊢t ⊢u) = Σ-β₂ (stability Γ≡Δ ⊢F) (stability (Γ≡Δ ∙ refl ⊢F) ⊢G) (stabilityTerm Γ≡Δ ⊢t) (stabilityTerm Γ≡Δ ⊢u) stabilityRedTerm Γ≡Δ (β-red x x₁ x₂) = β-red (stability Γ≡Δ x) (stabilityTerm (Γ≡Δ ∙ refl x) x₁) (stabilityTerm Γ≡Δ x₂) stabilityRedTerm Γ≡Δ (natrec-subst x x₁ x₂ d) = let ⊢Γ , _ , _ = contextConvSubst Γ≡Δ in natrec-subst (stability (Γ≡Δ ∙ refl (ℕⱼ ⊢Γ)) x) (stabilityTerm Γ≡Δ x₁) (stabilityTerm Γ≡Δ x₂) (stabilityRedTerm Γ≡Δ d) stabilityRedTerm Γ≡Δ (natrec-zero x x₁ x₂) = let ⊢Γ , _ , _ = contextConvSubst Γ≡Δ in natrec-zero (stability (Γ≡Δ ∙ refl (ℕⱼ ⊢Γ)) x) (stabilityTerm Γ≡Δ x₁) (stabilityTerm Γ≡Δ x₂) stabilityRedTerm Γ≡Δ (natrec-suc x x₁ x₂ x₃) = let ⊢Γ , _ , _ = contextConvSubst Γ≡Δ in natrec-suc (stabilityTerm Γ≡Δ x) (stability (Γ≡Δ ∙ refl (ℕⱼ ⊢Γ)) x₁) (stabilityTerm Γ≡Δ x₂) (stabilityTerm Γ≡Δ x₃) stabilityRedTerm Γ≡Δ (Emptyrec-subst x d) = Emptyrec-subst (stability Γ≡Δ x) (stabilityRedTerm Γ≡Δ d) -- Stability of type reductions. stabilityRed : ∀ {A B Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A ⇒ B → Δ ⊢ A ⇒ B stabilityRed Γ≡Δ (univ x) = univ (stabilityRedTerm Γ≡Δ x) -- Stability of type reduction closures. stabilityRed* : ∀ {A B Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A ⇒* B → Δ ⊢ A ⇒* B stabilityRed* Γ≡Δ (id x) = id (stability Γ≡Δ x) stabilityRed* Γ≡Δ (x ⇨ D) = stabilityRed Γ≡Δ x ⇨ stabilityRed* Γ≡Δ D -- Stability of term reduction closures. stabilityRed*Term : ∀ {t u A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ t ⇒* u ∷ A → Δ ⊢ t ⇒* u ∷ A stabilityRed*Term Γ≡Δ (id x) = id (stabilityTerm Γ≡Δ x) stabilityRed*Term Γ≡Δ (x ⇨ d) = stabilityRedTerm Γ≡Δ x ⇨ stabilityRed*Term Γ≡Δ d mutual -- Stability of algorithmic equality of neutrals. stability~↑ : ∀ {k l A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ k ~ l ↑ A → Δ ⊢ k ~ l ↑ A stability~↑ Γ≡Δ (var-refl x x≡y) = var-refl (stabilityTerm Γ≡Δ x) x≡y stability~↑ Γ≡Δ (app-cong k~l x) = app-cong (stability~↓ Γ≡Δ k~l) (stabilityConv↑Term Γ≡Δ x) stability~↑ Γ≡Δ (fst-cong p~r) = fst-cong (stability~↓ Γ≡Δ p~r) stability~↑ Γ≡Δ (snd-cong p~r) = snd-cong (stability~↓ Γ≡Δ p~r) stability~↑ Γ≡Δ (natrec-cong x₁ x₂ x₃ k~l) = let ⊢Γ , _ , _ = contextConvSubst Γ≡Δ in natrec-cong (stabilityConv↑ (Γ≡Δ ∙ (refl (ℕⱼ ⊢Γ))) x₁) (stabilityConv↑Term Γ≡Δ x₂) (stabilityConv↑Term Γ≡Δ x₃) (stability~↓ Γ≡Δ k~l) stability~↑ Γ≡Δ (Emptyrec-cong x₁ k~l) = Emptyrec-cong (stabilityConv↑ Γ≡Δ x₁) (stability~↓ Γ≡Δ k~l) -- Stability of algorithmic equality of neutrals of types in WHNF. stability~↓ : ∀ {k l A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ k ~ l ↓ A → Δ ⊢ k ~ l ↓ A stability~↓ Γ≡Δ ([~] A D whnfA k~l) = [~] A (stabilityRed* Γ≡Δ D) whnfA (stability~↑ Γ≡Δ k~l) -- Stability of algorithmic equality of types. stabilityConv↑ : ∀ {A B Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A [conv↑] B → Δ ⊢ A [conv↑] B stabilityConv↑ Γ≡Δ ([↑] A′ B′ D D′ whnfA′ whnfB′ A′<>B′) = [↑] A′ B′ (stabilityRed* Γ≡Δ D) (stabilityRed* Γ≡Δ D′) whnfA′ whnfB′ (stabilityConv↓ Γ≡Δ A′<>B′) -- Stability of algorithmic equality of types in WHNF. stabilityConv↓ : ∀ {A B Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ A [conv↓] B → Δ ⊢ A [conv↓] B stabilityConv↓ Γ≡Δ (U-refl x) = let _ , ⊢Δ , _ = contextConvSubst Γ≡Δ in U-refl ⊢Δ stabilityConv↓ Γ≡Δ (ℕ-refl x) = let _ , ⊢Δ , _ = contextConvSubst Γ≡Δ in ℕ-refl ⊢Δ stabilityConv↓ Γ≡Δ (Empty-refl x) = let _ , ⊢Δ , _ = contextConvSubst Γ≡Δ in Empty-refl ⊢Δ stabilityConv↓ Γ≡Δ (Unit-refl x) = let _ , ⊢Δ , _ = contextConvSubst Γ≡Δ in Unit-refl ⊢Δ stabilityConv↓ Γ≡Δ (ne x) = ne (stability~↓ Γ≡Δ x) stabilityConv↓ Γ≡Δ (Π-cong F A<>B A<>B₁) = Π-cong (stability Γ≡Δ F) (stabilityConv↑ Γ≡Δ A<>B) (stabilityConv↑ (Γ≡Δ ∙ refl F) A<>B₁) stabilityConv↓ Γ≡Δ (Σ-cong F A<>B A<>B₁) = Σ-cong (stability Γ≡Δ F) (stabilityConv↑ Γ≡Δ A<>B) (stabilityConv↑ (Γ≡Δ ∙ refl F) A<>B₁) -- Stability of algorithmic equality of terms. stabilityConv↑Term : ∀ {t u A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ t [conv↑] u ∷ A → Δ ⊢ t [conv↑] u ∷ A stabilityConv↑Term Γ≡Δ ([↑]ₜ B t′ u′ D d d′ whnfB whnft′ whnfu′ t<>u) = [↑]ₜ B t′ u′ (stabilityRed* Γ≡Δ D) (stabilityRed*Term Γ≡Δ d) (stabilityRed*Term Γ≡Δ d′) whnfB whnft′ whnfu′ (stabilityConv↓Term Γ≡Δ t<>u) -- Stability of algorithmic equality of terms in WHNF. stabilityConv↓Term : ∀ {t u A Γ Δ} → ⊢ Γ ≡ Δ → Γ ⊢ t [conv↓] u ∷ A → Δ ⊢ t [conv↓] u ∷ A stabilityConv↓Term Γ≡Δ (ℕ-ins x) = ℕ-ins (stability~↓ Γ≡Δ x) stabilityConv↓Term Γ≡Δ (Empty-ins x) = Empty-ins (stability~↓ Γ≡Δ x) stabilityConv↓Term Γ≡Δ (Unit-ins x) = Unit-ins (stability~↓ Γ≡Δ x) stabilityConv↓Term Γ≡Δ (ne-ins t u neN x) = ne-ins (stabilityTerm Γ≡Δ t) (stabilityTerm Γ≡Δ u) neN (stability~↓ Γ≡Δ x) stabilityConv↓Term Γ≡Δ (univ x x₁ x₂) = univ (stabilityTerm Γ≡Δ x) (stabilityTerm Γ≡Δ x₁) (stabilityConv↓ Γ≡Δ x₂) stabilityConv↓Term Γ≡Δ (zero-refl x) = let _ , ⊢Δ , _ = contextConvSubst Γ≡Δ in zero-refl ⊢Δ stabilityConv↓Term Γ≡Δ (suc-cong t<>u) = suc-cong (stabilityConv↑Term Γ≡Δ t<>u) stabilityConv↓Term Γ≡Δ (η-eq x x₁ y y₁ t<>u) = let ⊢F , ⊢G = syntacticΠ (syntacticTerm x) in η-eq (stabilityTerm Γ≡Δ x) (stabilityTerm Γ≡Δ x₁) y y₁ (stabilityConv↑Term (Γ≡Δ ∙ refl ⊢F) t<>u) stabilityConv↓Term Γ≡Δ (Σ-η ⊢p ⊢r pProd rProd fstConv sndConv) = Σ-η (stabilityTerm Γ≡Δ ⊢p) (stabilityTerm Γ≡Δ ⊢r) pProd rProd (stabilityConv↑Term Γ≡Δ fstConv) (stabilityConv↑Term Γ≡Δ sndConv) stabilityConv↓Term Γ≡Δ (η-unit [t] [u] tUnit uUnit) = let [t] = stabilityTerm Γ≡Δ [t] [u] = stabilityTerm Γ≡Δ [u] in η-unit [t] [u] tUnit uUnit
programs/oeis/020/A020703.asm
karttu/loda
0
172853
<filename>programs/oeis/020/A020703.asm<gh_stars>0 ; A020703: Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,3,5,7,... ; 1,4,3,2,9,8,7,6,5,16,15,14,13,12,11,10,25,24,23,22,21,20,19,18,17,36,35,34,33,32,31,30,29,28,27,26,49,48,47,46,45,44,43,42,41,40,39,38,37,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173,172,171,170,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,256,255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,234,233,232 add $0,1 mov $1,5 lpb $0,1 add $2,2 sub $0,$2 add $1,$2 lpe sub $1,$0 sub $1,3
programs/oeis/162/A162786.asm
neoneye/loda
22
7673
; A162786: a(n) = A162526(n)/6. ; 6,7,8,9,10,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277 mov $1,$0 trn $1,1 seq $1,6005 ; The odd prime numbers together with 1. sub $1,6 max $0,$1 add $0,6
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3804f.ada
best08618/asylo
7
85
<gh_stars>1-10 -- CE3804F.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 FLOAT_IO GET RAISES CONSTRAINT_ERROR WHEN THE VALUE -- SUPPLIED BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN FIELD'LAST -- WHEN FIELD'LAST IS LESS THAN INTEGER'LAST, OR THE VALUE READ IS -- OUT OF RANGE OF THE ITEM PARAMETER, BUT WITHIN THE RANGE OF THE -- SUBTYPE USED TO INSTANTIATE FLOAT_IO. -- APPLICABILITY CRITERIA: -- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH -- SUPPORT TEXT FILES. -- HISTORY: -- SPS 09/07/82 -- JBG 08/30/83 -- DWC 09/11/87 SPLIT CASE FOR FIXED_IO INTO CE3804P.ADA AND -- CORRECTED EXCEPTION HANDLING. -- JRL 06/07/96 Added call to Ident_Int in expressions involving -- Field'Last, to make the expressions non-static and -- prevent compile-time rejection. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3804F IS INCOMPLETE : EXCEPTION; BEGIN TEST ("CE3804F", "CHECK THAT FLOAT_IO GET RAISES " & "CONSTRAINT_ERROR WHEN THE VALUE SUPPLIED " & "BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN " & "FIELD'LAST WHEN FIELD'LAST IS LESS THAN " & "INTEGER'LAST, OR THE VALUE READ IS OUT OF " & "RANGE OF THE ITEM PARAMETER, BUT WITHIN THE " & "RANGE OF THE SUBTYPE USED TO INSTANTIATE " & "FLOAT_IO."); DECLARE FT : FILE_TYPE; TYPE FLT IS NEW FLOAT RANGE 1.0 .. 10.0; PACKAGE FL_IO IS NEW FLOAT_IO (FLT); USE FL_IO; X : FLT RANGE 1.0 .. 5.0; BEGIN BEGIN GET (FT, X, IDENT_INT(-3)); FAILED ("CONSTRAINT_ERROR NOT RAISED FOR NEGATIVE " & "WIDTH"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN STATUS_ERROR => FAILED ("STATUS_ERROR RAISED INSTEAD OF " & "CONSTRAINT_ERROR FOR NEGATIVE WIDTH"); WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED FOR NEGATIVE " & "WIDTH"); END; IF FIELD'LAST < INTEGER'LAST THEN BEGIN GET (X, FIELD'LAST + Ident_Int(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "FIELD'LAST + 1 WIDTH - DEFAULT"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "FIELD'LAST + 1 WIDTH - DEFAULT"); END; END IF; BEGIN CREATE (FT, OUT_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " & "WITH OUT_FILE MODE"); RAISE INCOMPLETE; WHEN NAME_ERROR => NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " & "WITH OUT_FILE MODE"); RAISE INCOMPLETE; END; PUT (FT, "1.0"); NEW_LINE (FT); PUT (FT, "8.0"); NEW_LINE (FT); PUT (FT, "2.0"); NEW_LINE (FT); PUT (FT, "3.0"); CLOSE (FT); BEGIN OPEN (FT, IN_FILE, LEGAL_FILE_NAME); EXCEPTION WHEN USE_ERROR => NOT_APPLICABLE ("USE_ERROR RAISED; TEXT OPEN " & "FOR IN_FILE MODE"); RAISE INCOMPLETE; END; GET (FT, X); IF X /= 1.0 THEN FAILED ("WRONG VALUE READ WITH EXTERNAL FILE"); END IF; BEGIN GET (FT, X); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "VALUE OUT OF RANGE WITH EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "VALUE OUT OF RANGE WITH EXTERNAL FILE"); END; BEGIN GET (FT, X, IDENT_INT(-1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "NEGATIVE WIDTH WITH EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "NEGATIVE WIDTH WITH EXTERNAL FILE"); END; SKIP_LINE (FT); IF FIELD'LAST < INTEGER'LAST THEN BEGIN GET (FT, X, FIELD'LAST + Ident_Int(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - " & "FIELD'LAST + 1 WIDTH WITH " & "EXTERNAL FILE"); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "FIELD'LAST + 1 WIDTH WITH " & "EXTERNAL FILE"); END; END IF; SKIP_LINE (FT); BEGIN GET (FT, X, 3); EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED - " & "OUT OF RANGE WITH EXTERNAL FILE"); WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - " & "OUT OF RANGE WITH EXTERNAL FILE"); END; BEGIN DELETE (FT); EXCEPTION WHEN USE_ERROR => NULL; END; EXCEPTION WHEN INCOMPLETE => NULL; END; RESULT; END CE3804F;
effects.asm
raphnet/super_sudoku
6
20449
.include "header.inc" .include "snesregs.inc" .include "misc_macros.inc" .include "zeropage.inc" .16BIT .bank 0 .ramsection "effects_variables" SLOT RAM_SLOT ; Pointer to the effect routine that must be called from vblank (see effects_dovblank) effects_cur_routine: dw ; Effect state and varibles (shared between different effects) effects_state: dw effects_tmp: dw ; Options for mosaic effects: BG mask (for the 4 lower bits of MOSAIC/$2106) effects_mosaic_bgmask: dw .ends .section "Effects" FREE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Run the active non-blocking effect. ; ; To be called from vblank. ; effects_dovblank: jmp (effects_cur_routine) rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Initialize the non blocking effect helper ; effects_init: pushall A16 lda #_effects_nop sta effects_cur_routine popall rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Start a "mosaic pulse" effect. ; ; Not bad to signal errors. Similar to a visual bell. ; effect_mosaic_pulse: pushall A16 lda #_effects_mosaic_do sta effects_cur_routine stz effects_state stz effects_tmp lda #5 sta effects_mosaic_bgmask popall rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Internal no-operation routine used as a placeholder when there ; is no active effect. ; _effects_nop: rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Internal function for the mosaic pulse effect. ; _effects_mosaic_do: pushall A8 lda effects_state bne @shrinking @growing: lda effects_tmp inc A cmp #7 beq @done_growing sta effects_tmp asl asl asl asl ora effects_mosaic_bgmask sta MOSAIC bra @done @done_growing: inc effects_state bra @done @shrinking: lda effects_tmp dec A bmi @done_shrinking sta effects_tmp asl asl asl asl ora effects_mosaic_bgmask sta MOSAIC bra @done @done_shrinking: A16 lda #_effects_nop ; Replace this routine by the nop sta effects_cur_routine ; routine, stop being called. @done: popall rts pha phx phy php A8 XY8 ; ramp up lda #07 @lp1: wai sta MOSAIC clc adc #$20 bcc @lp1 ; ramp down lda #$e7 @lp2: wai sta MOSAIC sec sbc #$20 bit #$f0 bne @lp2 stz MOSAIC plp ply plx pla rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Performa fade-in using INIDISP bits 3-0 (master brightness) ; ; BLOCKING ; effect_fadein: pha phx php A8 XY8 ldx #0 ; black screen, not blanked stx INIDISP ; Bits 3-0 : Master brightness. 0 = black, 15 = max @loop: ; Halt until next vblank wai ; Increment brightness every 4 frames lda framecount and #0 ; will be 0 every 2 cycles bne @loop inx stx INIDISP cpx #15 beq @done bra @loop @done: plp plx pla rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Performa fade-out using INIDISP bits 3-0 (master brightness) ; ; BLOCKING ; effect_fadeout: pha phx php A8 XY8 ldx #15 ; black screen, not blanked ; Bits 3-0 : Master brightness. 0 = black, 15 = max @loop: ; Halt until next vblank wai ; Decrement brightness every 4 frames lda framecount and #0 ; will be 0 every 2 cycles bne @loop dex stx INIDISP cpx #0 beq @done bra @loop @done: plp plx pla rts .ends
registrar-source_files.adb
annexi-strayline/AURA
13
6179
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Directories; with Ada.IO_Exceptions; package body Registrar.Source_Files is package DIR renames Ada.Directories; package SIO renames Ada.Streams.Stream_IO; package UBS renames Ada.Strings.Unbounded; -- -- Source_File_Access -- ---------- -- Read -- ---------- procedure Read (Stream: not null access Ada.Streams.Root_Stream_Type'Class; Item : out Source_File_Access) is begin Item := null; end; -- -- Source_File -- --------------- -- Full_Name -- --------------- function Full_Name (Source: Source_File) return String is (UBS.To_String (Source.Full_Name)); function Hash (Source: Source_File) return Stream_Hashing.Hash_Type is (Source.Current_Hash); ------------------ -- Compute_Hash -- ------------------ procedure Compute_Hash (File: in out Source_File) is use SIO; begin pragma Assert (Is_Open (File.File_Actual)); Reset (File => File.File_Actual, Mode => In_File); File.Current_Hash := Stream_Hashing.Digest_Stream (Stream (File.File_Actual)); end Compute_Hash; -- -- Source_Stream -- -------------------------- -- Checkout_Read_Stream -- -------------------------- function Do_Checkout (Source : not null Source_File_Access; Mode : SIO.File_Mode; Rewrite: Boolean) return Source_Stream is Locked_Out: Boolean := False; use type Ada.Streams.Stream_IO.Stream_Access; begin Source.Stream_Checkout.Lock; Locked_Out := True; if not SIO.Is_Open (Source.File_Actual) then if not Rewrite then -- This will be the case most of the time SIO.Open (File => Source.File_Actual, Mode => Mode, Name => Full_Name (Source.all)); else declare Name: constant String := Full_Name (Source.all); begin DIR.Delete_File (Name); SIO.Create (File => Source.File_Actual, Mode => Mode, Name => Name); end; end if; else if not Rewrite then -- When such files are initially allocated, they will be -- in the open state, trying to re-open them will raise -- an exception SIO.Reset (File => Source.File_Actual, Mode => Mode); else SIO.Delete (Source.File_Actual); SIO.Create (File => Source.File_Actual, Mode => Mode, Name => Full_Name (Source.all)); end if; end if; return S: Source_Stream do S.File := Source; S.Checkout.File := Source; S.Stream_Actual := SIO.Stream (Source.File_Actual); end return; exception when others => if Locked_Out then Source.Stream_Checkout.Release; end if; raise; end Do_Checkout; ---------------------------------------------------------------------------- function Checkout_Read_Stream (Source: not null Source_File_Access) return Source_Stream is (Do_Checkout (Source => Source, Mode => SIO.In_File, Rewrite => False)); --------------------------- -- Checkout_Write_Stream -- --------------------------- function Checkout_Write_Stream (Source : not null Source_File_Access; Rewrite: in Boolean := False) return Source_Stream is (Do_Checkout (Source => Source, Mode => SIO.Append_File, Rewrite => Rewrite)); ----------------- -- End_Of_File -- ----------------- function End_Of_File (Stream: in Source_Stream) return Boolean is (SIO.End_Of_File (Stream.File.File_Actual)); ----------------------- -- Position_At_Start -- ----------------------- procedure Position_At_Start (Stream: in out Source_Stream) is begin SIO.Reset (Stream.File.File_Actual); end Position_At_Start; --------------------- -- Position_At_End -- --------------------- procedure Position_At_End (Stream: in out Source_Stream) is use SIO; File_Size: Count := Size (Stream.File.File_Actual); begin if File_Size > 0 then Set_Index (File => Stream.File.File_Actual, To => Positive_Count (File_Size)); end if; end Position_At_End; ---------- -- Read -- ---------- overriding procedure Read (Stream: in out Source_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is begin Stream.Stream_Actual.Read (Item => Item, Last => Last); end Read; ----------- -- Write -- ----------- overriding procedure Write (Stream: in out Source_Stream; Item : in Ada.Streams.Stream_Element_Array) is begin Stream.Stream_Actual.Write (Item); end Write; -- -- Stream_Checkout_Lock -- protected body Stream_Checkout_Lock is ---------- -- Lock -- ---------- entry Lock when not Lock_Actual is begin Lock_Actual := True; end Lock; ------------- -- Release -- ------------- procedure Release is begin Lock_Actual := False; end Release; ------------ -- Locked -- ------------ function Locked return Boolean is (Lock_Actual); end Stream_Checkout_Lock; -- -- Stream_Checkout_Token -- -------------- -- Finalize -- -------------- overriding procedure Finalize (Token: in out Stream_Checkout_Token) is use type SIO.File_Mode; begin if Token.File /= null then pragma Assert (SIO.Is_Open (Token.File.File_Actual)); if SIO.Mode (Token.File.File_Actual) /= SIO.In_File then -- Recompute hash after modification Token.File.Compute_Hash; end if; SIO.Close (Token.File.File_Actual); Token.File.Stream_Checkout.Release; end if; end Finalize; end Registrar.Source_Files;
samples/vulkan_test-environment.adb
zrmyers/VulkanAda
1
19073
<gh_stars>1-10 -------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -------------------------------------------------------------------------------- with Ada.Text_IO; With Glfw; with Vulkan; procedure Vulkan_Test.Environment is hints : Glfw.Record_Window_Hints := ( Client_Api => Glfw.NO_API, others => <>); window_handle : Glfw.Glfw_Window := Glfw.No_Window; begin Ada.Text_IO.Put_Line("Initializing Window System"); -- Initialize GLFW GLFW.Platform_Init; -- Initialize Window GLFW.Window_Set_Hints(hints => hints); window_handle := Glfw.Window_Create( width => 1024, height => 768, title => "Hello Vulkan!"); -- Main Loop loop ------------------------------------------------------------------------ -- This loop will run forever until the user closes the window or some -- kind of exception occurs, which causes the program to begin handling -- the exception. ------------------------------------------------------------------------ pragma Warnings (Off, "variable ""window_handle"" is not modified in loop body"); pragma Warnings (Off, "possible infinite loop"); exit when Glfw.Window_Should_Close(window_handle => window_handle); pragma Warnings (On, "variable ""window_handle"" is not modified in loop body"); pragma Warnings (On, "possible infinite loop"); -- Poll for Glfw events Glfw.Platform_Process_Events; end loop; Ada.Text_IO.Put_Line("Destroying Window"); Glfw.Window_Destroy(window_handle => window_handle); Ada.Text_IO.Put_Line("Shutting Down GLFW"); -- Shut down the GLFW instance Glfw.Platform_Shutdown; end Vulkan_Test.Environment;
programs/oeis/216/A216195.asm
neoneye/loda
22
98670
; A216195: Abelian complexity function of the period-doubling sequence (A096268). ; 2,2,3,2,3,3,3,2,3,3,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,5,4,5,4,4,3,4,4,5,4,5,4,4,3,4,4,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4 lpb $0 mov $2,$0 div $0,2 seq $2,73059 ; a(n) = (1/2)*(A073504(n+1) - A073504(n)). add $1,$2 lpe add $1,2 mov $0,$1
Library/SpecUI/CommonUI/CMain/cmainAppDocumentControl.asm
steakknife/pcgeos
504
167959
<gh_stars>100-1000 COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: CommonUI/CMain FILE: cmainAppDocumentControl.asm ROUTINES: Name Description ---- ----------- GLB OLDocumentGroup Open look document control class REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version DESCRIPTION: $Id: cmainAppDocumentControl.asm,v 1.1 97/04/07 10:52:18 newdeal Exp $ ------------------------------------------------------------------------------@ CommonUIClassStructures segment resource OLDocumentGroupClass mask CLASSF_NEVER_SAVED or \ mask CLASSF_DISCARD_ON_SAVE CommonUIClassStructures ends ;--------------------------------------------------- DocInit segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupAppStartup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Do what we must when application first starts up. CALLED BY: MSG_META_APP_STARTUP PASS: *ds:si = GenDocumentGroup object ^hdx = AppLaunchBlock RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupAppStartup method dynamic OLDocumentGroupClass, MSG_META_APP_STARTUP .enter ; give ourselves a one way upward link to the UI document control ; so that GUP stuff will work push dx EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset movdw cxdx, ds:[di].GDGI_documentControl call GenSetUpwardLink pop dx ; let any children that have come back from the dead know about this. mov ax, MSG_META_APP_STARTUP call GenSendToChildren Destroy ax, cx, dx, bp .leave ret OLDocumentGroupAppStartup endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupAttach %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Make sure that any UserDoDialog won't block the UI from finishing MSG_META_ATTACH -- force queue in front the attach if in a single-threaded app. PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - MSG_META_ATTACH cx, dx, bp - ? RETURN: nothing ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 4/30/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupAttach method dynamic OLDocumentGroupClass, MSG_META_ATTACH clr bx push si call GeodeGetAppObject pop si call ObjTestIfObjBlockRunByCurThread jne twoThreaded ; If single-threaded, do the ATTACH after the current method is ; finished being handled, so that the UI thread finished its ; MSG_META_ATTACH. -- Doug 4/30/93 ; mov ax, MSG_OLDG_ATTACH mov bx, ds:[LMBH_handle] mov di, mask MF_FORCE_QUEUE GOTO ObjMessage twoThreaded: ; Allow two-threaded apps to just go ahead & finish the attached, ; since the UI is free to finish the ATTACH over on its side. ; FALL_THRU OLDocumentGroupOLDGAttach OLDocumentGroupAttach endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupOLDGAttach -- MSG_OLDG_ATTACH for OLDocumentGroupClass DESCRIPTION: Send attach to children PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_OLDG_ATTACH cx, dx, bp - Same as that passed in MSG_META_ATTACH RETURN: none DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version Doug 4/30/93 Changed to happen *after* MSG_META_ATTACH done ------------------------------------------------------------------------------@ OLDocumentGroupOLDGAttach method OLDocumentGroupClass, MSG_OLDG_ATTACH mov ax, MSG_META_ATTACH call GenSendToChildren Destroy ax, cx, dx, bp ret OLDocumentGroupOLDGAttach endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupOpenDefaultDoc -- MSG_GEN_DOCUMENT_GROUP_OPEN_DEFAULT_DOC for OLDocumentGroupClass DESCRIPTION: Open the default document (if one exists) PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_OPEN_DEFAULT_DOC dx - size DocumentCommonParams ss:bp - DocumentCommonParams RETURN: none DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupOpenDefaultDoc method dynamic \ OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_OPEN_DEFAULT_DOC if UNTITLED_DOCS_ON_SP_TOP mov ax, ATTR_GEN_PATH_DATA call ObjVarFindData jc skipRedwoodDirectoryStuff ; ; In for floppy-based-systems with untitled docs on the local disk, ; try the document floppy first, without creating a new document. ; Then try the local disk. ; ; mov ss:[bp].DCP_diskHandle, SP_DOCUMENT mov {TCHAR}ss:[bp].DCP_path[0], 0 mov ss:[bp].DCP_flags, mask DOF_NO_ERROR_DIALOG ;don't create! ;(and don't complain on errors) openDoc:: push bp mov ax, MSG_GEN_DOCUMENT_GROUP_OPEN_DOC call ObjCallInstanceNoLock pop bp jnc done ;doc found, done ornf ss:[bp].DCP_docAttrs, mask GDA_UNTITLED mov ss:[bp].DCP_diskHandle, SP_TOP skipRedwoodDirectoryStuff: endif ; if UNTITLED_DOCS_ON_SP_TOP mov ss:[bp].DCP_flags, mask DOF_CREATE_FILE_IF_FILE_DOES_NOT_EXIST mov ax, MSG_GEN_DOCUMENT_GROUP_OPEN_DOC call ObjCallInstanceNoLock jnc done ; *** handle error opening default file done: Destroy ax, cx, dx ret OLDocumentGroupOpenDefaultDoc endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupUpdateModelExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: Provide default model node behavior PASS: *ds:si - instance data ds:di - ptr to start of master instance data es - segment of class ax - model messages RETURN: nothing ALLOWED TO DESTROY: bx, si, di, ds, es PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- doug 9/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupUpdateModelExcl method OLDocumentGroupClass, MSG_META_GAINED_MODEL_EXCL, MSG_META_LOST_MODEL_EXCL, MSG_META_GAINED_SYS_MODEL_EXCL, MSG_META_LOST_SYS_MODEL_EXCL mov bp, MSG_META_GAINED_MODEL_EXCL ; pass base message in bp mov bx, offset Vis_offset mov di, offset OLDGI_modelExcl GOTO FlowUpdateHierarchicalGrab OLDocumentGroupUpdateModelExcl endm DocInit ends ;--- DocExit segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupDetach -- MSG_META_DETACH for OLDocumentGroupClass DESCRIPTION: Send attach to children PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_META_DETACH or MSG_META_APP_SHUTDOWN cx - caller's ID dx:bp - OD for MSG_META_ACK RETURN: none DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupDetach method dynamic OLDocumentGroupClass, MSG_META_DETACH, MSG_META_APP_SHUTDOWN push ax, cx, dx, bp call ObjInitDetach ; increment detach count for each child push ax mov ax, MSG_GEN_COUNT_CHILDREN call ObjCallInstanceNoLock ;dx = # of children pop ax mov cx, dx jcxz done 10$: call ObjIncDetach loop 10$ ; send to children mov dx, ds:[LMBH_handle] mov bp, si ;dx:bp = OD for ACK call GenSendToChildren done: pop ax, cx, dx, bp mov di, offset OLDocumentGroupClass call ObjCallSuperNoLock call ObjEnableDetach Destroy ax, cx, dx, bp ret OLDocumentGroupDetach endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupShutdownComplete DESCRIPTION: Nukes generic one-way upward link, once children have shut down. PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_META_SHUTDOWN_COMPLETE cx - caller's ID dx:bp - OD for MSG_META_ACK RETURN: none DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 5/92 Initial version ardeb 10/19/92 Changed to SHUTDOWN_COMPLETE ------------------------------------------------------------------------------@ OLDocumentGroupShutdownComplete method dynamic OLDocumentGroupClass, MSG_META_SHUTDOWN_COMPLETE mov di, ds:[si] add di, ds:[di].Gen_offset mov ds:[di].GI_link.LP_next.handle, 0 ; nuke upward one-way mov ds:[di].GI_link.LP_next.chunk, 0 ; link mov di, offset OLDocumentGroupClass GOTO ObjCallSuperNoLock OLDocumentGroupShutdownComplete endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupQuit -- MSG_META_QUIT for OLDocumentGroupClass DESCRIPTION: Handle a user request to quit. PASS: *ds:si - instance data es - segment of OLApAppocumentControlClass ax - MSG_META_QUIT RETURN: none DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: ptr = first child; status = CONTINUE; while ((ptr != NULL) && (STATUS == CONTINUE)) { status = MSG_GEN_DOCUMENT_USER_CLOSE(ptr); ptr = NextSibling(ptr); } KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupQuit method dynamic OLDocumentGroupClass, MSG_META_QUIT ; Save the optr with the current model grab mov ax, MSG_META_GET_MODEL_EXCL call ObjCallInstanceNoLock ;cx:dx = cur model pushdw cxdx mov cx, ds:[di].OLDGI_quitObj.handle mov dx, ds:[di].OLDGI_quitObj.chunk tst cx jnz while ; begin at first child EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset mov cx, ds:[di].GI_comp.CP_firstChild.handle mov dx, ds:[di].GI_comp.CP_firstChild.chunk tst cx ;check for no children jz finished ; cx:dx = child ; ds:di = spec offset while: test dx, LP_IS_PARENT jnz finished push si ; find next sibling (in case this object is removed in the call) mov di, ds:[si] add di, ds:[di].Vis_offset mov bx, cx mov si, dx ;bx:si = child to call call ObjLockObjBlock mov es, ax mov bp, es:[si] add bp, es:[bp].Gen_offset mov ax, es:[bp].GI_link.LP_next.handle mov ds:[di].OLDGI_quitObj.handle, ax mov ax, es:[bp].GI_link.LP_next.chunk mov ds:[di].OLDGI_quitObj.chunk, ax call MemUnlock EC < push ax > ; ec shouldn't trash EC < mov ax, NULL_SEGMENT > ; to avoid ec crash EC < mov_tr es, ax > EC < pop ax > ; ec shouldn't trash movdw bxsi, cxdx mov ax, MSG_META_GRAB_MODEL_EXCL mov di, mask MF_FIXUP_DS call ObjMessage mov ax, MSG_GEN_DOCUMENT_CLOSE clr bp ; user-initiated mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ;cx = DocQuitStatus pop si cmp cx, DQS_SAVE_ERROR jz cancel cmp cx, DQS_CANCEL jz cancel cmp cx, DQS_DELAYED jz delayed ; continue, but clear the queue first popdw bxdx call restoreModel mov ax, MSG_META_QUIT mov bx, ds:[LMBH_handle] mov di, mask MF_FORCE_QUEUE GOTO ObjMessage ; all done ! finished: popdw cxdx clr cx jmp common ; delayed (in the middle of a "save as") delayed: popdw bxdx ret ; cancel quitting cancel: popdw bxdx call restoreModel mov cx, -1 ;cx = non-zero (abort) common: clr ax mov di, ds:[si] add di, ds:[di].Vis_offset mov ds:[di].OLDGI_quitObj.handle, ax mov ds:[di].OLDGI_quitObj.chunk, ax mov ax, MSG_META_QUIT_ACK call SendToUIDocControl Destroy ax, cx, dx, bp ret restoreModel: ; restore the model grab to the doc which had it initially xchg dx, si mov ax, MSG_META_GRAB_MODEL_EXCL mov di, mask MF_FIXUP_DS call ObjMessage ;restore the cur model xchg dx, si retn OLDocumentGroupQuit endm SendToUIDocControl proc far class OLDocumentGroupClass EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset mov bx, ds:[di].GDGI_documentControl.handle mov si, ds:[di].GDGI_documentControl.chunk mov di, mask MF_FIXUP_DS GOTO ObjMessage SendToUIDocControl endp DocExit ends ;--- DocCommon segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetTotalSize -- MSG_OLDG_GET_TOTAL_SIZE for OLDocumentGroupClass DESCRIPTION: Returns total size of all child documents. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_OLDG_GET_TOTAL_SIZE RETURN: dx.cx -- total size bp - non-zero if an individual file was too large ax - destroyed ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 1/16/94 Initial Version ------------------------------------------------------------------------------@ if FLOPPY_BASED_DOCUMENTS OLDocumentGroupGetTotalSize method dynamic OLDocumentGroupClass, \ MSG_OLDG_GET_TOTAL_SIZE clrdw dxcx ; initialize size clr bp ; no individual files too large yet mov ax, MSG_OL_DOCUMENT_ADD_SIZE_TO_TOTAL clr bx ; initial child (first push bx ; child of push bx ; composite) mov bx, offset GI_link ; Pass offset to LinkPart push bx clr bx ; Use standard function push bx mov bx,OCCT_DONT_SAVE_PARAMS_DONT_TEST_ABORT push bx EC< call GenCheckGenAssumption ; Make sure gen data exists > mov bx, offset Gen_offset mov di, offset GI_comp call ObjCompProcessChildren ;must use a call (no GOTO) since ;parameters are passed on the stack ret OLDocumentGroupGetTotalSize endm endif COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupMarkDirty -- MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY for OLDocumentGroupClass DESCRIPTION: Mark a document as dirty PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY cx:dx - document to mark dirty. If 0 then the target document is marked as dirty RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupMarkDirty method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY mov ax, MSG_GEN_DOCUMENT_MARK_DIRTY FALL_THRU SendToCXDXOrTargetDocument OLDocumentGroupMarkDirty endm COMMENT @---------------------------------------------------------------------- FUNCTION: SendToCXDXOrTargetDocument DESCRIPTION: Send a method to the document in cx:dx or to the target document if cx:dx is 0 CALLED BY: GLOBAL PASS: *ds:si - GenDocumentGroup ax - method to send cx:dx - document or 0 to send to target RETURN: none DESTROYED: ax, bx, cx, dx, si, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ SendToCXDXOrTargetDocument proc far tst cx jnz common pushdw bxsi mov bx, segment GenDocumentClass mov si, offset GenDocumentClass mov di, mask MF_RECORD call ObjMessage popdw bxsi mov cx, di mov dx, TO_MODEL mov ax, MSG_META_SEND_CLASSED_EVENT GOTO ObjCallInstanceNoLock common: movdw bxsi, cxdx mov di, mask MF_FIXUP_DS GOTO ObjMessage SendToCXDXOrTargetDocument endp COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupSendClassedEvent DESCRIPTION: Sends "TO_MODEL" messages on to current Model exclusive PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_META_SEND_CLASSED_EVENT cx - handle of classed event dx - TargetObject RETURN: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 7/91 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupSendClassedEvent method OLDocumentGroupClass, \ MSG_META_SEND_CLASSED_EVENT cmp dx, TO_MODEL je toModelDoc mov di, offset OLDocumentGroupClass GOTO ObjCallSuperNoLock toModelDoc: movdw bxbp, ds:[di].OLDGI_modelExcl.HG_OD clr di call FlowDispatchSendOnOrDestroyClassedEvent ret OLDocumentGroupSendClassedEvent endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetDocByFile -- MSG_GEN_DOCUMENT_GROUP_GET_DOC_BY_FILE for OLDocumentGroupClass DESCRIPTION: Set the output PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_GET_DOC_BY_FILE cx - file handle open to the document RETURN: cx:dx - OD (0 if none) cx - unchanged ALLOWED TO DESTROY: ax bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetDocByFile method OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_DOC_BY_FILE doc local optr .enter ; ; Use ObjCompProcessChildren to send MSG_GEN_DOCUMENT_TEST_FOR_FILE ; to each of our GenDocument children. If the file handle passed in CX ; doesn't belong to the child, it will return carry clear with CX ; unmodified, so we can tell OCPC to not save the parameters. If the ; file does belong to the child, it will mark itself dirty and return ; carry set, causing the processing of the children to abort. ; clr ax mov doc.handle, ax mov doc.chunk, ax push bp mov dx, ss lea bp, doc push ax ; Start with the first child push ax mov di, offset GI_link push di push ax ; Use canned callback mov ax, OCCT_DONT_SAVE_PARAMS_TEST_ABORT push ax mov bx, offset Gen_offset mov di, offset GI_comp mov ax, MSG_GEN_DOCUMENT_TEST_FOR_FILE call ObjCompProcessChildren pop bp mov cx, doc.handle mov dx, doc.chunk .leave ret OLDocumentGroupGetDocByFile endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupMarkDirtyByFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locate the document that has the given file open and mark it dirty CALLED BY: MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY_BY_FILE PASS: *ds:si = instance data es = segment of OLDocumentGroupClass ax = MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY_BY_FILE cx = file handle RETURN: nothing DESTROYED: ? PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/ 9/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupMarkDirtyByFile method OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_MARK_DIRTY_BY_FILE call OLDocumentGroupGetDocByFile ;cx:dx = OD EC < tst cx > EC < ERROR_Z PASSED_FILE_NOT_OPENED_BY_DOCUMENT_CONTROL > mov bx, cx mov si, dx mov ax, MSG_GEN_DOCUMENT_MARK_DIRTY mov di, mask MF_FIXUP_DS GOTO ObjMessage OLDocumentGroupMarkDirtyByFile endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupAutoSaveByFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locate the document that has the given file open and trigger an autosave CALLED BY: MSG_GEN_DOCUMENT_GROUP_AUTO_SAVE_BY_FILE PASS: *ds:si = instance data es = segment of OLDocumentGroupClass ax = MSG_GEN_DOCUMENT_GROUP_AUTO_SAVE_BY_FILE cx = file handle RETURN: nothing DESTROYED: cx, dx, bx, si, ax, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- rg 4/10/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupAutoSaveByFile method OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_AUTO_SAVE_BY_FILE call OLDocumentGroupGetDocByFile ;cx:dx = OD jcxz notMyDoc mov bx, cx mov si, dx mov ax, MSG_GEN_DOCUMENT_AUTO_SAVE mov di, mask MF_FIXUP_DS GOTO ObjMessage notMyDoc: ret OLDocumentGroupAutoSaveByFile endp COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupFileChanged -- MSG_OLDG_FILE_CHANGED for OLDocumentGroupClass DESCRIPTION: Update the UI for the document control (pass this on to the UI document control) PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_OLDG_FILE_CHANGED dx - size DocumentFileChangedParams ss:bp - DocumentFileChangedParams RETURN: cx, dx, bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupFileChanged method dynamic OLDocumentGroupClass, MSG_OLDG_FILE_CHANGED EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset mov bx, ds:[di].GDGI_documentControl.handle mov si, ds:[di].GDGI_documentControl.chunk mov ax, MSG_GEN_DOCUMENT_CONTROL_FILE_CHANGED mov dx, size DocumentFileChangedParams mov di, mask MF_STACK GOTO ObjMessage OLDocumentGroupFileChanged endm ;------ OLDocumentGroupGetUIAttrs method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_UI_ATTRS mov ax, MSG_GEN_DOCUMENT_CONTROL_GET_ATTRS GOTO CallUIDocControl OLDocumentGroupGetUIAttrs endm ;------ OLDocumentGroupGetTemplateDir method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_TEMPLATE_DIR mov ax, MSG_GEN_DOCUMENT_CONTROL_GET_TEMPLATE_DIR GOTO CallUIDocControl OLDocumentGroupGetTemplateDir endm ;------ OLDocumentGroupGetUIFeatures method dynamic \ OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_UI_FEATURES mov ax, MSG_GEN_DOCUMENT_CONTROL_GET_FEATURES FALL_THRU CallUIDocControl OLDocumentGroupGetUIFeatures endm ;------ CallUIDocControl proc far class OLDocumentGroupClass EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset mov bx, ds:[di].GDGI_documentControl.handle mov si, ds:[di].GDGI_documentControl.chunk mov di, mask MF_CALL or mask MF_FIXUP_DS GOTO ObjMessage CallUIDocControl endp COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetOutput -- MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT for OLDocumentGroupClass DESCRIPTION: Get the output PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT cx:dx - output RETURN: bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetOutput method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT add bx, ds:[bx].Gen_offset movdw cxdx, ds:[bx].GDGI_output ret OLDocumentGroupGetOutput endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetAttrs -- MSG_GEN_DOCUMENT_GROUP_GET_ATTRS for OLDocumentGroupClass DESCRIPTION: Get the DocumentControlAttrs PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_GET_ATTRS RETURN: ax - GenDocumentGroupAttrs cx, dx, bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetAttrs method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_ATTRS add bx, ds:[bx].Gen_offset mov ax, ds:[bx].GDGI_attrs ret OLDocumentGroupGetAttrs endm DocCommon ends ;--- DocNewOpen segment resource COMMENT @---------------------------------------------------------------------- MESSAGE: OLDocumentGroupAlterFTVMCExcl -- MSG_META_MUP_ALTER_FTVMC_EXCL for OLDocumentGroupClass DESCRIPTION: Alter an exclusive PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message cx:dx - object bp - flags RETURN: DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 5/ 4/92 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupAlterFTVMCExcl method dynamic OLDocumentGroupClass, MSG_META_MUP_ALTER_FTVMC_EXCL ; Since we're a model node, check to see if this request ; includes a change to the focus hierarchy. test bp, mask MAEF_MODEL jz callSuper ; if not, skip & send to superclass ; Call Flow utility routine to handle modifying the node push ax ; save message mov ax, MSG_META_GAINED_MODEL_EXCL ;pass gained message push bp ; save original flags ; Pass only the "GRAB" flag & ; which hierarchy this node is. and bp, mask MAEF_GRAB or mask MAEF_MODEL mov bx, offset Vis_offset mov di, offset OLDGI_modelExcl call FlowAlterHierarchicalGrab pop bp ; restore original flags pop ax ; restore message ; Now that we've updated the focus node, clear that portion ; of the request from the flags and bp, not mask MAEF_MODEL ; If request was also to grab/release on other nodes, pass on request test bp, MAEF_MASK_OF_ALL_HIERARCHIES jz done ; otherwise done. callSuper: ; Pass message on to superclass for handling outside of this class. mov di, offset OLDocumentGroupClass call ObjCallSuperNoLock done: ret OLDocumentGroupAlterFTVMCExcl endm COMMENT @---------------------------------------------------------------------- FUNCTION: CreateDocObject DESCRIPTION: Create a new document object and add it as a child of this object. Send it a new or open method and send the correct notification CALLED BY: INTERNAL PASS: *ds:si - GenDocumentGroup object ax - method to send to document dx - size DocumentCommonParams ss:bp - DocumentCommonParams RETURN: cx:dx - new Document object created (0 if error) DESTROYED: ax, bx, di, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version Steve 2/92 Added duplicate resource option ------------------------------------------------------------------------------@ CreateDocObject proc far class OLDocumentGroupClass if CUSTOM_DOCUMENT_PATH call CustomDocPathInitDocCommonParams endif ; CUSTOM_DOCUMENT_PATH push ax ;message push bp ;stack frame offset ; create a new object EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset tst ds:[di].GDGI_genDocument.handle LONG jnz duplicateDocumentResource les di, ds:[di].GDGI_documentClass push si ;doc control chunk mov bx, ds:[LMBH_handle] ;put it in this block call ObjInstantiate ;create new object (bx:si) mov dx, si ;new document chunk pop si ;doc control chunk addDocument: pop bp ;stack frame offset push bp ;stack frame offset ; If opening for an IACP connection, set ; ATTR_GEN_DOCUMENT_OPEN_FOR_IACP_ONLY on the new object ; ; { test ss:[bp].DCP_flags, mask DOF_OPEN_FOR_IACP_ONLY jz afterPrintCheck push dx, si ;new chunk, control chunk mov si, dx ;new chunk mov dx, size AddVarDataParams sub sp, dx mov bp, sp clr ax mov ss:[bp].AVDP_data.segment, ax mov ss:[bp].AVDP_data.offset, ax mov ss:[bp].AVDP_dataSize, ax mov ss:[bp].AVDP_dataType, ATTR_GEN_DOCUMENT_OPEN_FOR_IACP_ONLY mov ax, MSG_META_ADD_VAR_DATA mov di, mask MF_FIXUP_DS call ObjMessage add sp, size AddVarDataParams pop dx, si ;new chunk, control chunk afterPrintCheck: ; } ; add new document object as child of document control mov cx, bx ;new document handle mov bp, CCO_FIRST or mask CCF_MARK_DIRTY mov ax, MSG_GEN_ADD_CHILD call ObjCallInstanceNoLock ; Update the number of documents NKE < call OLDocumentGroupUpdateDocumentCount > ; mark the new document object as usable push dx, si ;new chunk, control chunk mov si, dx ;new chunk mov ax, MSG_GEN_SET_USABLE mov dl, VUM_MANUAL mov di, mask MF_FIXUP_DS call ObjMessage pop dx, si ;new chunk, control chunk ; send new document object the file name pop bp ;stack frame offset pop ax ;ax = method to send to doc push si ;document control chunk mov si, dx ;^lbx:si = new document mov dx, size DocumentCommonParams mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK call ObjMessage ;carry - set if error ;bp = file handle mov cx, bx ;cx:dx = document mov dx, si pop si ;*ds:si = control jnc done ; error -- remove new document from document control push si ;save doc control mov ax, MSG_OLDG_REMOVE_DOC call ObjCallInstanceNoLock mov ax, MSG_OLDC_TEST_FOR_DISPLAY_MAIN_DIALOG call SendToUIDocControl clr cx clr dx pop si ;*ds:si = doc control stc done: ret duplicateDocumentResource: mov bx,ds:[di].GDGI_genDocument.handle ;resource handle clr ax ; have current geode own block clr cx ; have current thread run block call ObjDuplicateResource mov dx,ds:[di].GDGI_genDocument.chunk jmp addDocument CreateDocObject endp if CUSTOM_DOCUMENT_PATH COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CustomDocPathInitDocCommonParams %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initializes the passed DocumentCommonParams with the values in ATTR_GEN_PATH_DATA if present. CALLED BY: (INTERNAL) CreateDocObject, OLDocumentGroupGetDefaultName PASS: *ds:si - Object containing ATTR_GEN_PATH_DATA ss:bp - DocumentCommonParams RETURN: DocumentCommonParams structure modified if ATTR_GEN_PATH_DATA present. DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ptrinh 12/16/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CustomDocPathInitDocCommonParams proc near uses ax,bx,si,di,es .enter ; ; Only copy if there wasn't passed a diskhandle or path... ; tst ss:[bp].DCP_diskHandle jnz done tst {TCHAR}ss:[bp].DCP_path[0] jnz done ; ; and if exists ATTR_GEN_PATH_DATA... ; mov ax, ATTR_GEN_PATH_DATA call ObjVarFindData ; ds:bx - GenFilePath jnc done ; ; Copy disk handle and path name -- optimized based on ; assumptions. (See CheckHack.) ; segmov es, ss, di lea di, ss:[bp].DCP_diskHandle ; es:di - dst lea si, ds:[bx].GFP_disk ; ds:si - src movsw ; DiskHandle CheckHack < size GFP_disk eq size word > LocalCopyString ; Path CheckHack < offset DCP_diskHandle + 2 eq offset DCP_path > CheckHack < offset GFP_disk + 2 eq offset GFP_path > done: .leave ret CustomDocPathInitDocCommonParams endp endif ; CUSTOM_DOCUMENT_PATH COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupUpdateDocumentCount %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update the number of documents CALLED BY: CreateDocObject OLDocumentGroupRemoveDoc PASS: *ds:si = GenDocumentGroup RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 9/ 8/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupOpenDoc -- MSG_GEN_DOCUMENT_GROUP_OPEN_DOC for OLDocumentGroupClass DESCRIPTION: Open a file PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_OPEN_DOC dx - size DocumentCommonParams ss:bp - DocumentCommonParams RETURN: cx:dx - new Document object created (0 if error) DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupOpenDoc method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_OPEN_DOC ornf ss:[bp].DCP_flags, mask DOF_RAISE_APP_AND_DOC ; If we are being asked to FORCE template behavior, then ALWAYS ; "open" the document (since it really opens the document and copies ; it into a new document). --JimG 9/2/94 test ss:[bp].DCP_flags, mask DOF_FORCE_TEMPLATE_BEHAVIOR jnz openIt call OLDocumentGroupSearchForDoc jc done openIt: mov ax, MSG_GEN_DOCUMENT_OPEN call CreateDocObject done: ret OLDocumentGroupOpenDoc endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupSearchForDoc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Search our generic children for one that has a document open CALLED BY: MSG_GEN_DOCUMENT_GROUP_SEARCH_FOR_DOC PASS: *ds:si = GenDocumentGroup object ss:bp = DocumentCommonParams describing the document RETURN: carry set if document found DESTROYED: ax, bx, di SIDE EFFECTS: the document and app may be raised, if DOF_RAISE_APP_AND_DOC is set in the DCP and the document is found. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/22/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupSearchForDoc method OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_SEARCH_FOR_DOC .enter test ss:[bp].DCP_flags, mask DOF_NAME_HOLDS_FILE_ID jnz haveID ; ; Fetch the real ID for the document. ; push ds, si segmov ds, ss lea dx, ss:[bp].DCP_path lea si, ss:[bp].DCP_name mov bx, ss:[bp].DCP_diskHandle call IACPGetDocumentID pop ds, si ; ; Save the first four bytes of DCP_name and the original disk handle. ; pushdw ({FileID}ss:[bp].DCP_name) push ss:[bp].DCP_diskHandle ; ; Replace them with the 48-bit file ID. ; movdw ({FileID}ss:[bp].DCP_name), cxdx mov ss:[bp].DCP_diskHandle, ax haveID: push ss:[bp].DCP_flags ; save so we know what to pop ornf ss:[bp].DCP_flags, mask DOF_NAME_HOLDS_FILE_ID clr ax push ax, ax ;first child mov ax, offset GI_link push ax clr ax push ax ;callback.segment mov ax, OCCT_SAVE_PARAMS_TEST_ABORT push ax ;callback.offset mov bx, offset Gen_offset mov di, offset GI_comp mov ax, MSG_GEN_DOCUMENT_SEARCH_FOR_DOC call ObjCompProcessChildren ; ; Restore disk handle and first four bytes of the name if necessary. ; lahf pop bx test bx, mask DOF_NAME_HOLDS_FILE_ID jnz done pop ss:[bp].DCP_diskHandle popdw ({FileID}ss:[bp].DCP_name) done: sahf .leave ret OLDocumentGroupSearchForDoc endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetDefaultName -- MSG_GEN_DOCUMENT_GROUP_GET_DEFAULT_NAME for OLDocumentGroupClass DESCRIPTION: Get the DocumentControlAttrs PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_GET_DEFAULT_NAME cx:dx - DocumentCommonParams buffer RETURN: ax - DocumentControlAttrs cx, dx, bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetDefaultName method dynamic \ OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_DEFAULT_NAME uses cx, dx .enter mov es, cx mov di, dx ; default documents retrieved from us are always in the DOCUMENT ; directory 7/29/93 cbh if UNTITLED_DOCS_ON_SP_TOP mov es:[di].DCP_diskHandle, SP_TOP elseif CUSTOM_DOCUMENT_PATH mov es:[di].DCP_diskHandle, 0 else mov es:[di].DCP_diskHandle, SP_DOCUMENT endif mov {TCHAR}es:[di].DCP_path[0], 0 if CUSTOM_DOCUMENT_PATH call CustomDocPathInitDocCommonParams endif ; CUSTOM_DOCUMENT_PATH ; copy default name from our instance data. mov si, ds:[si] add si, ds:[si].Gen_offset mov ax, ds:[si].GDGI_attrs ; return attrs in ax mov si, ds:[si].GDGI_untitledName mov si, ds:[si] ;ds:si = source (default name) CheckHack <offset DCP_name eq 0> ChunkSizePtr ds, si, cx SBCS <EC < cmp cx, FILE_LONGNAME_LENGTH-3+1 >> DBCS <EC < cmp cx, (FILE_LONGNAME_LENGTH-3+1)*(size wchar) >> EC < ERROR_A OLAPPDC_DEFAULT_NAME_TOO_LONG > rep movsb .leave ret OLDocumentGroupGetDefaultName endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetToken -- MSG_GEN_DOCUMENT_GROUP_GET_TOKEN for OLDocumentGroupClass DESCRIPTION: Get the token from the UI doc control PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message cx:dx - address to store token RETURN: cx, dx, bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetToken method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_TOKEN mov ax, MSG_GEN_DOCUMENT_CONTROL_GET_TOKEN call CallUIDocControl ret OLDocumentGroupGetToken endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetProtocol -- MSG_GEN_DOCUMENT_GROUP_GET_PROTOCOL for OLDocumentGroupClass DESCRIPTION: Get the protocol PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_GET_PROTOCOL RETURN: cx - major protocol dx - minor protocol bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetProtocol method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_PROTOCOL add bx, ds:[bx].Gen_offset mov cx, ds:[bx].GDGI_protocolMajor mov dx, ds:[bx].GDGI_protocolMinor ret OLDocumentGroupGetProtocol endm COMMENT @---------------------------------------------------------------------- MESSAGE: OLDocumentGroupGetView -- MSG_APP_GEN_DOCUMENT_CONTROL_GET_VIEW for OLDocumentGroupClass DESCRIPTION: Return to associated GenView PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message RETURN: cx:dx - GenView ax, bp - unchanged DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 7/25/91 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetView method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_VIEW add bx, ds:[bx].Gen_offset movdw cxdx, ds:[bx].GDGI_genView ret OLDocumentGroupGetView endm COMMENT @---------------------------------------------------------------------- MESSAGE: OLDocumentGroupGetDisplay -- MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY for OLDocumentGroupClass DESCRIPTION: Return to associated GenDisplay PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message RETURN: cx:dx - GenDisplay ax, bp - unchanged DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 7/25/91 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetDisplay method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY add bx, ds:[bx].Gen_offset movdw cxdx, ds:[bx].GDGI_genDisplay ret OLDocumentGroupGetDisplay endm COMMENT @---------------------------------------------------------------------- MESSAGE: OLDocumentGroupGetDisplayGroup -- MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY_GROUP for OLDocumentGroupClass DESCRIPTION: Return to associated GenDisplayGroup PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message RETURN: cx:dx - GenDisplayGroup ax, bp - unchanged DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 7/25/91 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetDisplayGroup method dynamic \ OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY_GROUP add bx, ds:[bx].Gen_offset movdw cxdx, ds:[bx].GDGI_genDisplayGroup ret OLDocumentGroupGetDisplayGroup endm DocNewOpen ends ;--- DocNew segment resource OLDocumentGroupGetCreator method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_GET_CREATOR mov ax, MSG_GEN_DOCUMENT_CONTROL_GET_CREATOR call CallUIDocControl ret OLDocumentGroupGetCreator endm DocNew ends ;--- DocMisc segment resource COMMENT @---------------------------------------------------------------------- MESSAGE: OLDocumentGroupImportNewDoc -- MSG_GEN_DOCUMENT_GROUP_IMPORT_NEW_DOC for OLDocumentGroupClass DESCRIPTION: Create a new document and import into it PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - The message ss:bp - ImpexTranslationParams dx -- size ImpexTranslationParams RETURN: cx:dx - new Document object created carry - set if error DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 6/ 9/92 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupImportNewDoc method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_IMPORT_NEW_DOC push bp sub sp, size DocumentCommonParams mov bp, sp clr ax mov ss:[bp].DCP_flags, mask DOF_FORCE_REAL_EMPTY_DOCUMENT mov ss:[bp].DCP_diskHandle, ax mov ss:[bp].DCP_connection, ax mov ss:[bp].DCP_docAttrs, mask GDA_UNTITLED mov ax, MSG_GEN_DOCUMENT_NEW call CreateDocObject lahf add sp, size DocumentCommonParams sahf pop bp jc done push bp movdw bxsi, cxdx mov dx, size ImpexTranslationParams mov ax, MSG_GEN_DOCUMENT_IMPORT mov di, mask MF_FIXUP_DS call ObjMessage movdw cxdx, bxsi pop bp done: pushf mov ax, ss:[bp].ITP_returnMsg movdw bxsi, ss:[bp].ITP_impexOD mov dx, size ImpexTranslationParams mov di, mask MF_STACK call ObjMessage popf ret OLDocumentGroupImportNewDoc endm DocMisc ends ;--- DocObscure segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupGetDocName-- MSG_PRINT_GET_DOC_NAME for OLDocumentGroupClass DESCRIPTION: Get the document name from the target document PASS: DS:DI = OLDocumentGroupClass specific instance data DS:BX = Deref'd OLDocumentGroupClass ES = Segment of OLApAppocumentControlClass CX:DX = OD to send method name to (PrintControlClass) BP = Method to send to OD (MSG_PRINT_CONTROL_SET_DOC_NAME) RETURN: Nothing DESTROYED: AX, BX, CX, DX, DI, SI, BP REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: I allocate more than the necessary number of bytes on the stack, as that is what the DocumentClass expects. Actually, though, the name cannot exceed FILE_LONGNAME_LENGTH+1, include the null terminator. REVISION HISTORY: Name Date Description ---- ---- ----------- Don 10/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupGetDocName method dynamic OLDocumentGroupClass, \ MSG_PRINT_GET_DOC_NAME .enter ; Allocate memory for the block ; mov bx, di ; OLAppDocInstance => DS:BX sub sp, FILE_LONGNAME_BUFFER_SIZE ; bytes to allocate mov di, sp ; store buffer => AX push cx, dx ; store the SPC OD mov {byte} ss:[di], 0 ; null terminate the string mov cx, ss mov dx, di ; buffer => CX:DX ; Ask the target document to fill the block ; mov si, ds:[bx].OLDGI_modelExcl.HG_OD.chunk mov bx, ds:[bx].OLDGI_modelExcl.HG_OD.handle tst bx ; any target document ?? jz done ; nope, so return empty string mov ax, MSG_GEN_DOCUMENT_GET_FILE_NAME mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ; fill that block! ; Now send the document name off to the SpoolPrintControl ; done: pop bx, si ; PrintControl OD => BX:SI mov ax, bp ; method => AX mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage ; send the document name add sp, FILE_LONGNAME_BUFFER_SIZE .leave ret OLDocumentGroupGetDocName endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupSetOutput -- MSG_GEN_DOCUMENT_GROUP_SET_OUTPUT for OLDocumentGroupClass DESCRIPTION: Set the output PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_GEN_DOCUMENT_GROUP_SET_OUTPUT cx:dx - output RETURN: cx, dx, bp - unchanged DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupSetOutput method dynamic OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_SET_OUTPUT mov di, ds:[si] add di, ds:[di].Gen_offset mov ds:[di].GDGI_output.handle, cx mov ds:[di].GDGI_output.chunk, dx ret OLDocumentGroupSetOutput endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLDocumentGroupGetModelExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the model exclusive for this app. CALLED BY: GLOBAL PASS: nada RETURN: cx:dx - model object carry set DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 5/14/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLDocumentGroupGetModelExcl method dynamic OLDocumentGroupClass, MSG_META_GET_MODEL_EXCL .enter movdw cxdx, ds:[di].OLDGI_modelExcl.HG_OD stc .leave ret OLDocumentGroupGetModelExcl endp DocObscure ends ;--- DocSaveAsClose segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupRemoveDoc -- MSG_OLDG_REMOVE_DOC for OLDocumentGroupClass DESCRIPTION: Remove an already closed document PASS: *ds:si - instance data es - segment of OLDocumentGroupClass ax - MSG_OLDG_REMOVE_DOC cx:dx - document to remove RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupRemoveDoc method dynamic OLDocumentGroupClass, MSG_OLDG_REMOVE_DOC ; release all exclusives for the document push cx, dx, si mov ax, MSG_META_RELEASE_MODEL_EXCL movdw bxsi, cxdx mov di, mask MF_FIXUP_DS call ObjMessage ; make the document not usable mov ax, MSG_GEN_SET_NOT_USABLE mov dl, VUM_NOW mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx, si ; remove the document clr bp ;don't bother marking dirty mov ax, MSG_GEN_REMOVE_CHILD call ObjCallInstanceNoLock ; Update the number of documents NKE < call OLDocumentGroupUpdateDocumentCount > ; if this document was the target document then zero the target ; OR if this document was the last document push cx,dx ;document OD ; free the document. If the genDocument.handle field is ; non-zero, it means that a resource was duplicated to ; create the document and we must free the block ; that resulted from duplicating the resource. Otherwise ; the document was created with ObjInstantiate in the ; same block as the Control and we should just free the object EC < call GenCheckGenAssumption > mov di, ds:[si] add di, ds:[di].Gen_offset tst ds:[di].GDGI_genDocument.handle jnz freeBlock mov ax,MSG_META_OBJ_FREE ; free object only jmp freeIt freeBlock: mov ax,MSG_META_BLOCK_FREE ; free whole block freeIt: pop bx,si ; document OD mov di,mask MF_FIXUP_DS call ObjMessage ret OLDocumentGroupRemoveDoc endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupSaveAsCancelled -- MSG_GEN_DOCUMENT_GROUP_SAVE_AS_CANCELLED for OLDocumentGroupClass DESCRIPTION: Cancel quitting PASS: *ds:si - instance data es - segment of OLApAppocumentControlClass ax - MSG_GEN_DOCUMENT_GROUP_SAVE_AS_CANCELLED RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupSaveAsCancelled method dynamic \ OLDocumentGroupClass, MSG_GEN_DOCUMENT_GROUP_SAVE_AS_CANCELLED mov ax, MSG_OLDG_USER_CLOSE_CANCELLED call ObjCallInstanceNoLock ; inform target document mov ax, MSG_GEN_DOCUMENT_SAVE_AS_CANCELLED clr cx call SendToCXDXOrTargetDocument ; ; Clear out any pending query-save-documents reply. 3/30/94 cbh ; clr cx mov ax, MSG_META_QUERY_SAVE_DOCUMENTS GOTO ObjCallInstanceNoLock OLDocumentGroupSaveAsCancelled endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupUserCloseCancelled -- MSG_OLDG_USER_CLOSE_CANCELLED for OLDocumentGroupClass DESCRIPTION: User close cancelled PASS: *ds:si - instance data es - segment of OLApAppocumentControlClass ax - MSG_OLDG_USER_CLOSE_CANCELLED RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupUserCloseCancelled method dynamic \ OLDocumentGroupClass, MSG_OLDG_USER_CLOSE_CANCELLED clr ax mov ds:[di].OLDGI_quitObj.chunk, ax xchg ax, ds:[di].OLDGI_quitObj.handle tst ax jz notQuitting mov cx, -1 ;cx = non-zero (abort) mov ax, MSG_META_QUIT_ACK push si ;save app doc control ptr call SendToUIDocControl pop si ;restore ptr notQuitting: ret OLDocumentGroupUserCloseCancelled endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupUserCloseOK -- MSG_OLDG_USER_CLOSE_OK for OLDocumentGroupClass DESCRIPTION: User close OK PASS: *ds:si - instance data es - segment of OLApAppocumentControlClass ax - MSG_OLDG_USER_CLOSE_OK RETURN: DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version ------------------------------------------------------------------------------@ OLDocumentGroupUserCloseOK method dynamic \ OLDocumentGroupClass, MSG_OLDG_USER_CLOSE_OK tst ds:[di].OLDGI_quitObj.handle jz notQuitting mov ax, MSG_META_QUIT ;continue call ObjCallInstanceNoLock notQuitting: ret OLDocumentGroupUserCloseOK endm COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupQuerySaveDocuments -- MSG_META_QUERY_SAVE_DOCUMENTS for OLDocumentGroupClass DESCRIPTION: Queries user to save any opened documents, prior to switching applications. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_META_QUERY_SAVE_DOCUMENTS cx - event to use after we`ve done our duty RETURN: nothing ax, cx, dx, bp - destroyed ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 6/23/93 Initial Version ------------------------------------------------------------------------------@ if VOLATILE_SYSTEM_STATE OLDocumentGroupQuerySaveDocuments method dynamic OLDocumentGroupClass, \ MSG_META_QUERY_SAVE_DOCUMENTS ; ; Save the passed event to use when we're done. ; If there's already an event hanging around, let's nuke it. ; mov bx, ds:[di].OLDGI_appSwitchMsg ;get current message mov ds:[di].OLDGI_appSwitchMsg, cx ;store new message tst bx ;no old message, branch jz 10$ call ObjFreeMessage 10$: ; ; If no message was passed in cx, the system is trying to flush ; out the query message because of a user cancel, so we'll do ; nothing further. 3/30/94 cbh ; tst cx jz exit mov ax, MSG_OL_DOCUMENT_WAIT_FOR_QUERY call GenSendToChildren ;have documents wait for query ;if anyone is clean, mark them now mov ax, MSG_OLDG_DOC_MARKED_CLEAN call ObjCallInstanceNoLock exit: ret OLDocumentGroupQuerySaveDocuments endm endif COMMENT @---------------------------------------------------------------------- METHOD: OLDocumentGroupDocMarkedClean -- MSG_OLDG_DOC_MARKED_CLEAN for OLDocumentGroupClass DESCRIPTION: Sent when a document marks itself clean. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_OLDG_DOC_MARKED_CLEAN RETURN: nothing ax, cx, dx, bp - destroyed ALLOWED TO DESTROY: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chris 7/26/93 Initial Version ------------------------------------------------------------------------------@ if VOLATILE_SYSTEM_STATE OLDocumentGroupDocMarkedClean method dynamic OLDocumentGroupClass, \ MSG_OLDG_DOC_MARKED_CLEAN ; ; Not in app switching mode, exit ; mov cx, ds:[di].OLDGI_appSwitchMsg tst cx jz exit ; ; Collect the number of currently dirty documents. ; push cx call CheckDirtyDocuments ;counts number of dirties pop bx ;restore app switch message jc stillDirty ;still a dirty document, branch ; ; Fire off the stored app switching message. ; mov di, mask MF_FORCE_QUEUE call MessageDispatch ; ; Event fired off, nuke references to it. ; EC < call VisCheckVisAssumption > mov di, ds:[si] add di, ds:[di].Vis_offset clr ds:[di].OLDGI_appSwitchMsg jmp short exit stillDirty: ; ; Still at least one dirty document open, go fire off another ; MSG_META_QUERY_SAVE_DOCUMENTS to a document that is waiting for it. ; call QueryFirstDocumentWaiting exit: ret OLDocumentGroupDocMarkedClean endm endif COMMENT @---------------------------------------------------------------------- ROUTINE: QueryFirstDocumentWaiting SYNOPSIS: Sends message to the first document still waiting for a query. CALLED BY: OLDocumentGroupDocMarkedClean PASS: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 8/27/93 Initial version ------------------------------------------------------------------------------@ if VOLATILE_SYSTEM_STATE QueryFirstDocumentWaiting proc near mov ax, MSG_OL_DOCUMENT_QUERY_IF_WAITING clr bx ; initial child (first push bx ; child of push bx ; composite) mov bx,offset GI_link ;pass offset to LinkPart push bx clr bx push bx ;send message ; ornf bx, OCCT_SAVE_PARAMS_TEST_ABORT push bx mov bx,offset Gen_offset ;pass offset to master part mov di,offset GI_comp ;pass offset to composite call ObjCompProcessChildren ret QueryFirstDocumentWaiting endp endif DocSaveAsClose ends Resident segment resource COMMENT @---------------------------------------------------------------------- ROUTINE: CheckDirtyDocuments, CheckDocumentDirty SYNOPSIS: Checks if any document dirty, or on the ramdisk. CALLED BY: OLDocumentGroupDocMarkedClean PASS: *ds:si -- doc group/ document RETURN: carry set if any dirty documents DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 7/26/93 Initial version ------------------------------------------------------------------------------@ if VOLATILE_SYSTEM_STATE CheckDirtyDocuments proc far mov bx, offset CheckDocumentDirty clr di ;do all children call OLResidentProcessGenChildrenFromDI ret CheckDirtyDocuments endp CheckDocumentDirty proc far ; ; ; class GenDocumentClass mov di, ds:[si] add di, ds:[di].Gen_offset test ds:[di].GDI_attrs, mask GDA_AUTO_SAVE_STOPPED ;no autosave, hopefully means clc ; shutting down, ignore whether ; on ramdisk and exit c=0 jnz exit call DocCheckIfOnRamdisk ;document still on the ramdisk, jz dirty ; we need to return "dirty". test ds:[di].GDI_attrs, mask GDA_DIRTY jz exit dirty: stc ;return carry set and quit exit: ret CheckDocumentDirty endp endif Resident ends
examples/SPARK2005/sqrt/src/sqrt.ads
michalkonecny/polypaver
1
7962
<reponame>michalkonecny/polypaver --# inherit PolyPaver.Exact, PolyPaver.Floats; package Example is function Sqrt (X : in Float) return Float; --# pre 1.0 <= X and X <= 2.0; --# return R => --# R <= (1.0+4.0*PolyPaver.Floats.Eps_Rel)*PolyPaver.Exact.Sqrt(X); end Example;
programs/oeis/191/A191760.asm
jmorken/loda
1
172447
; A191760: Digital root of the n-th odd square. ; 1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1,1,9,7,4,9,4,7,9,1 mov $2,85 mul $2,$0 mul $0,$2 add $0,$2 mov $1,$0 lpb $1 mod $1,9 lpe add $1,1
gcc-gcc-7_3_0-release/gcc/ada/s-traceb.ads
best08618/asylo
7
27036
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . T R A C E B A C K -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a method for generating a traceback of the current -- execution location. The traceback shows the locations of calls in the call -- chain, up to either the top or a designated number of levels. pragma Compiler_Unit_Warning; pragma Polling (Off); -- We must turn polling off for this unit, because otherwise we get -- elaboration circularities with System.Exception_Tables. with System.Traceback_Entries; package System.Traceback is ---------------- -- Call_Chain -- ---------------- procedure Call_Chain (Traceback : in out System.Traceback_Entries.Tracebacks_Array; Max_Len : Natural; Len : out Natural; Exclude_Min : System.Address := System.Null_Address; Exclude_Max : System.Address := System.Null_Address; Skip_Frames : Natural := 1); -- Store up to Max_Len code locations in Traceback, corresponding to the -- current call chain. -- -- Traceback is an array of addresses where the result will be stored. -- -- Max_Len is the length of the Traceback array. If the call chain is -- longer than this, then additional entries are discarded, and the -- traceback is missing some of the highest level entries. -- -- Len is the number of addresses returned in the Traceback array -- -- Exclude_Min/Exclude_Max, if non null, provide a range of addresses -- to ignore from the computation of the traceback. -- -- Skip_Frames says how many of the most recent calls should at least -- be excluded from the result, regardless of the exclusion bounds and -- starting with this procedure itself: 1 means exclude the frame for -- this procedure, 2 means 1 + exclude the frame for this procedure's -- caller, ... -- -- On return, the Traceback array is filled in, and Len indicates the -- number of stored entries. The first entry is the most recent call, -- and the last entry is the highest level call. function C_Call_Chain (Traceback : System.Address; Max_Len : Natural) return Natural; pragma Export (C, C_Call_Chain, "system__traceback__c_call_chain"); -- Version that can be used directly from C end System.Traceback;