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
software/profi/net-tools/src/pqdos/browser/player/player.asm
r4wabr/karabas_pro
3
10244
<reponame>r4wabr/karabas_pro<filename>software/profi/net-tools/src/pqdos/browser/player/player.asm ;Universal PT2'n'PT3 Turbo Sound player for ZX Spectrum ;(c)2004-2007 S.V.Bulba <<EMAIL>> ;Specially for AlCo ;http://bulba.untergrund.net/ (http://bulba.at.kz/) MODULE VTPL ;Release number Release EQU "0" ;Conditional assembly ;1) Current position counters at (Vars1+0) and (Vars2+0) CurPosCounter=0 ;2) Allow channels allocation bits at (START+10) ACBBAC=0 ;3) Allow loop checking and disabling LoopChecker=1 ;4) Insert official identificator Id=0 ;5) Set IY for correct return to ZX Basic Basic=1 ;Features ;-------- ;-Can be compiled at any address (i.e. no need rounding ORG ; address). ;-Variables (VARS) can be located at any address (not only after ; code block). ;-INIT subprogram checks PT3-module version and rightly ; generates both note and volume tables outside of code block ; (in VARS). ;-Two portamento (spc. command 3xxx) algorithms (depending of ; PT3 module version). ;-New 1.XX and 2.XX special command behaviour (only for PT v3.7 ; and higher). ;-Any Tempo value are accepted (including Tempo=1 and Tempo=2). ;-TS modes: 2xPT3, 2xPT2 and PT v3.7 TS standard. ;-Fully compatible with Ay_Emul PT3 and PT2 players codes. ;-See also notes at the end of this source code. ;Limitations ;----------- ;-Can run in RAM only (self-modified code is used). ;-PT2 position list must be end by #FF marker only. ;Warning!!! PLAY subprogram can crash if no module are loaded ;into RAM or INIT subprogram was not called before. ;Call MUTE or INIT one more time to mute sound after stopping ;playing ;Test codes (commented) ; LD A,32 ;SinglePT3(TS if TSPT3.7),ABC,Looped ; LD (START+10),A ; LD HL,#8000 ;Mod1 ; LD DE,#A000 ;Mod2 (optional) ; CALL START+3 ; EI ;_LP HALT ; CALL START+5 ; XOR A ; IN A,(#FE) ; CPL ; AND 15 ; JR Z,_LP ; JR START+8 TonA EQU 0 TonB EQU 2 TonC EQU 4 Noise EQU 6 Mixer EQU 7 AmplA EQU 8 AmplB EQU 9 AmplC EQU 10 Env EQU 11 EnvTp EQU 13 ;Entry and other points ;START initialize playing of modules at MDLADDR (single module) ;START+3 initialization with module address in HL and DE (TS) ;START+5 play one quark ;START+8 mute ;START+10 setup and status flags START: LD HL,outputBuffer ;DE - address of 2nd module for TS JR INIT JP PLAY JR MUTE SETUP DB 0 ;set bit0, if you want to play without looping ;(optional); ;set bit1 for PT2 and reset for PT3 before ;calling INIT; ;bits2-3: %00-ABC, %01-ACB, %10-BAC (optional); ;bits4-5: %00-no TS, %01-2 modules TS, %10- ;autodetect PT3 TS-format by AlCo (PT 3.7+); ;Remark: old PT3 TS-format by AlCo (PT 3.6) is not ;documented and must be converted to new standard. ;bit6 is set each time, when loop point of 2nd TS ;module is passed (optional). ;bit7 is set each time, when loop point of 1st TS ;or of single module is passed (optional). ;Identifier IF Id DB "=UniPT2/PT3/TS-Player r.",Release,"=" ENDIF IF LoopChecker CHECKLP LD HL,SETUP BIT 0,(IY-100+VRS.ModNum) JR Z,CHL1 SET 6,(HL) JR CHL2 CHL1 SET 7,(HL) CHL2 BIT 0,(HL) RET Z POP HL INC (IY-100+VRS.DelyCnt) INC (IY-100+VRS.ChanA+CHP.NtSkCn) XOR A LD (IY-100+VRS.AYREGS+AmplA),A LD (IY-100+VRS.AYREGS+AmplB),A LD (IY-100+VRS.AYREGS+AmplC),A RET ENDIF MUTE: XOR A LD H,A LD L,A LD (VARS1+VRS.AYREGS+AmplA),A LD (VARS1+VRS.AYREGS+AmplB),HL LD (VARS2+VRS.AYREGS+AmplA),A LD (VARS2+VRS.AYREGS+AmplB),HL JP ROUT INIT: ;HL - AddressOfModule ;DE - AddresOf2ndModule PUSH DE PUSH HL LD HL,VARS LD (HL),0 LD DE,VARS+1 LD BC,VAR0END-VARS-1 LDIR INC HL LD (VARS1+VRS.AdInPtA),HL ;ptr to zero LD (VARS2+VRS.AdInPtA),HL POP HL LD IY,VARS1+100 LD A,(START+10) AND 2 JP NZ,I_PT2 CALL INITPT3 LD HL,(e_-SamCnv-2)*256+#18 LD (SamCnv),HL LD A,#BA LD (OrnCP),A LD (SamCP),A LD A,#7B LD (OrnLD),A LD (SamLD),A LD A,#87 LD (SamClc2),A POP HL ;Use version and ton table of 1st module LD A,(IX+13-100) ;EXTRACT VERSION NUMBER SUB #30 JR C,L20 CP 10 JR C,L21 L20 LD A,6 L21 LD (Version),A PUSH AF ;VolTable version CP 4 LD A,(IX+99-100) ;TONE TABLE NUMBER RLA AND 7 PUSH AF ;NoteTable number LD IY,VARS2+100 LD A,(START+10) AND 48 JR Z,NOTS CP 16 JR Z,TwoPT3s LD A,(Version) CP 7 JR C,NOTS LD A,(IX+98-100) ;ALCO TS MARKER CP #20 JR Z,NOTS LD HL,VARS1 LD DE,VARS2 LD BC,VRS LDIR SET 1,(IY-100+VRS.ModNum) LD C,A ADD A,A ADD A,C SUB 2 LD (TSSub),A JR AlCoTS_ TwoPT3s CALL INITPT3 AlCoTS_ LD A,1 LD (is_ts),A SET 0,(IY-100+VRS.ModNum) NOTS LD BC,PT3PD LD HL,0 LD DE,PT3EMPTYORN JR INITCOMMON I_PT2 CALL INITPT2 LD HL,#51CB LD (SamCnv),HL LD A,#BB LD (OrnCP),A LD (SamCP),A LD A,#7A LD (OrnLD),A LD (SamLD),A LD A,#80 LD (SamClc2),A POP HL LD A,5 LD (Version),A PUSH AF LD A,2 PUSH AF LD A,(START+10) AND 48 JR Z,NOTS2 LD IY,VARS2+100 LD A,1 LD (is_ts),A SET 0,(IY-100+VRS.ModNum) CALL INITPT2 NOTS2 LD BC,PT2PD LD HL,#8687 LD DE,PT2EMPTYORN INITCOMMON IF Basic LD IY,#5C3A ENDIF LD (PTDEC),BC LD (PsCalc),HL PUSH DE ;note table data depacker ;(c) <NAME> LD DE,T_PACK LD BC,T1_+(2*49)-1 TP_0 LD A,(DE) INC DE CP 15*2 JR NC,TP_1 LD H,A LD A,(DE) LD L,A INC DE JR TP_2 TP_1 PUSH DE LD D,0 LD E,A ADD HL,DE ADD HL,DE POP DE TP_2 LD A,H LD (BC),A DEC BC LD A,L LD (BC),A DEC BC SUB #F8*2 JR NZ,TP_0 INC A LD (VARS1+VRS.DelyCnt),A LD (VARS2+VRS.DelyCnt),A LD HL,#F001 ;H - CHP.Volume, L - CHP.NtSkCn LD (VARS1+VRS.ChanA+CHP.NtSkCn),HL LD (VARS1+VRS.ChanB+CHP.NtSkCn),HL LD (VARS1+VRS.ChanC+CHP.NtSkCn),HL LD (VARS2+VRS.ChanA+CHP.NtSkCn),HL LD (VARS2+VRS.ChanB+CHP.NtSkCn),HL LD (VARS2+VRS.ChanC+CHP.NtSkCn),HL POP HL LD (VARS1+VRS.ChanA+CHP.OrnPtr),HL LD (VARS1+VRS.ChanB+CHP.OrnPtr),HL LD (VARS1+VRS.ChanC+CHP.OrnPtr),HL LD (VARS2+VRS.ChanA+CHP.OrnPtr),HL LD (VARS2+VRS.ChanB+CHP.OrnPtr),HL LD (VARS2+VRS.ChanC+CHP.OrnPtr),HL POP AF ;NoteTableCreator (c) <NAME> ;A - NoteTableNumber*2+VersionForNoteTable ;(xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0) LD HL,NT_DATA LD D,0 ADD A,A LD E,A ADD HL,DE LD E,(HL) INC HL SRL E SBC A,A AND #A7 ;#00 (NOP) or #A7 (AND A) LD (L3),A EX DE,HL LD BC,T1_ ADD HL,BC LD A,(DE) ADD A,T_ LD C,A ADC A,T_/256 SUB C LD B,A PUSH BC LD DE,NT_ PUSH DE LD B,12 L1 PUSH BC LD C,(HL) INC HL PUSH HL LD B,(HL) PUSH DE EX DE,HL LD DE,23 LD IXH,8 L2 SRL B RR C L3 DB #19 ;AND A or NOP LD A,C ADC A,D ;=ADC 0 LD (HL),A INC HL LD A,B ADC A,D LD (HL),A ADD HL,DE DEC IXH JR NZ,L2 POP DE INC DE INC DE POP HL INC HL POP BC DJNZ L1 POP HL POP DE LD A,E CP TCOLD_1 JR NZ,CORR_1 LD A,#FD LD (NT_+#2E),A CORR_1 LD A,(DE) AND A JR Z,TC_EXIT RRA PUSH AF ADD A,A LD C,A ADD HL,BC POP AF JR NC,CORR_2 DEC (HL) DEC (HL) CORR_2 INC (HL) AND A SBC HL,BC INC DE JR CORR_1 TC_EXIT POP AF ;VolTableCreator (c) <NAME> ;A - VersionForVolumeTable (0..4 - 3.xx..3.4x; ;5.. - 2.x,3.5x..3.6x..VTII1.0) CP 5 LD HL,#11 LD D,H LD E,H LD A,#17 JR NC,M1 DEC L LD E,L XOR A M1 LD (M2),A LD IX,VT_+16 LD C,#F INITV2 PUSH HL ADD HL,DE EX DE,HL SBC HL,HL LD B,#10 INITV1 LD A,L M2 DB #7D LD A,H ADC A,0 LD (IX),A INC IX ADD HL,DE DJNZ INITV1 POP HL LD A,E CP #77 JR NZ,M3 INC E M3 DEC C JR NZ,INITV2 JP ROUT INITPT3 CALL SETMDAD PUSH HL LD DE,100 ADD HL,DE LD A,(HL) LD (IY-100+VRS.Delay),A PUSH HL POP IX ADD HL,DE CALL SETCPPT LD E,(IX+102-100) INC HL IF CurPosCounter LD (IY-100+VRS.PosSub),L ENDIF ADD HL,DE CALL SETLPPT POP DE LD L,(IX+103-100) LD H,(IX+104-100) ADD HL,DE CALL SETPTPT LD HL,169 ADD HL,DE CALL SETORPT LD HL,105 ADD HL,DE SETSMPT LD (IY-100+VRS.SamPtrs),L LD (IY-100+VRS.SamPtrs+1),H RET INITPT2 LD A,(HL) LD (IY-100+VRS.Delay),A PUSH HL PUSH HL PUSH HL INC HL INC HL LD A,(HL) INC HL CALL SETSMPT LD E,(HL) INC HL LD D,(HL) POP HL AND A SBC HL,DE CALL SETMDAD POP HL LD DE,67 ADD HL,DE CALL SETORPT LD E,32 ADD HL,DE LD C,(HL) INC HL LD B,(HL) LD E,30 ADD HL,DE CALL SETCPPT LD E,A INC HL IF CurPosCounter LD (IY-100+VRS.PosSub),L ENDIF ADD HL,DE CALL SETLPPT POP HL ADD HL,BC SETPTPT LD (IY-100+VRS.PatsPtr),L LD (IY-100+VRS.PatsPtr+1),H RET SETMDAD LD (IY-100+VRS.MODADDR),L LD (IY-100+VRS.MODADDR+1),H RET SETORPT LD (IY-100+VRS.OrnPtrs),L LD (IY-100+VRS.OrnPtrs+1),H RET SETCPPT LD (IY-100+VRS.CrPsPtr),L LD (IY-100+VRS.CrPsPtr+1),H RET SETLPPT LD (IY-100+VRS.LPosPtr),L LD (IY-100+VRS.LPosPtr+1),H RET SETENBS LD (IY-100+VRS.EnvBase),L LD (IY-100+VRS.EnvBase+1),H RET SETESLD LD (IY-100+VRS.CurESld),L LD (IY-100+VRS.CurESld+1),H RET GETIX PUSH IY POP IX ADD IX,DE RET PTDECOD CALL GETIX PTDEC EQU $+1 JP #C3C3 ;PT2 pattern decoder PD2_SAM CALL SETSAM JR PD2_LOOP PD2_EOff LD (IX-12+CHP.Env_En),A JR PD2_LOOP PD2_ENV LD (IX-12+CHP.Env_En),16 LD (IY-100+VRS.AYREGS+EnvTp),A LD A,(BC) INC BC LD L,A LD A,(BC) INC BC LD H,A CALL SETENBS JR PD2_LOOP PD2_ORN CALL SETORN JR PD2_LOOP PD2_SKIP INC A LD (IX-12+CHP.NNtSkp),A JR PD2_LOOP PD2_VOL RRCA RRCA RRCA RRCA LD (IX-12+CHP.Volume),A JR PD2_LOOP PD2_DEL CALL C_DELAY JR PD2_LOOP PD2_GLIS SET 2,(IX-12+CHP.Flags) INC A LD (IX-12+CHP.TnSlDl),A LD (IX-12+CHP.TSlCnt),A LD A,(BC) INC BC LD (IX-12+CHP.TSlStp),A ADD A,A SBC A,A LD (IX-12+CHP.TSlStp+1),A SCF JR PD2_LP2 PT2PD AND A PD2_LP2 EX AF,AF' PD2_LOOP LD A,(BC) INC BC ADD A,#20 JR Z,PD2_REL JR C,PD2_SAM ADD A,96 JR C,PD2_NOTE INC A JR Z,PD2_EOff ADD A,15 JP Z,PD_FIN JR C,PD2_ENV ADD A,#10 JR C,PD2_ORN ADD A,#40 JR C,PD2_SKIP ADD A,#10 JR C,PD2_VOL INC A JR Z,PD2_DEL INC A JR Z,PD2_GLIS INC A JR Z,PD2_PORT INC A JR Z,PD2_STOP LD A,(BC) INC BC LD (IX-12+CHP.CrNsSl),A JR PD2_LOOP PD2_PORT RES 2,(IX-12+CHP.Flags) LD A,(BC) INC BC INC BC ;ignoring precalc delta to right sound INC BC SCF JR PD2_LP2 PD2_STOP LD (IX-12+CHP.TSlCnt),A JR PD2_LOOP PD2_REL LD (IX-12+CHP.Flags),A JR PD2_EXIT PD2_NOTE LD L,A LD A,(IX-12+CHP.Note) LD (PrNote+1),A LD (IX-12+CHP.Note),L XOR A LD (IX-12+CHP.TSlCnt),A SET 0,(IX-12+CHP.Flags) EX AF,AF' JR NC,NOGLIS2 BIT 2,(IX-12+CHP.Flags) JR NZ,NOPORT2 LD (LoStep),A ADD A,A SBC A,A EX AF,AF' LD H,A LD L,A INC A CALL SETPORT NOPORT2 LD (IX-12+CHP.TSlCnt),1 NOGLIS2 XOR A PD2_EXIT LD (IX-12+CHP.PsInSm),A LD (IX-12+CHP.PsInOr),A LD (IX-12+CHP.CrTnSl),A LD (IX-12+CHP.CrTnSl+1),A JP PD_FIN ;PT3 pattern decoder PD_OrSm LD (IX-12+CHP.Env_En),0 CALL SETORN PD_SAM_ LD A,(BC) INC BC RRCA PD_SAM CALL SETSAM JR PD_LOOP PD_VOL RRCA RRCA RRCA RRCA LD (IX-12+CHP.Volume),A JR PD_LP2 PD_EOff LD (IX-12+CHP.Env_En),A LD (IX-12+CHP.PsInOr),A JR PD_LP2 PD_SorE DEC A JR NZ,PD_ENV LD A,(BC) INC BC LD (IX-12+CHP.NNtSkp),A JR PD_LP2 PD_ENV CALL SETENV JR PD_LP2 PD_ORN CALL SETORN JR PD_LOOP PD_ESAM LD (IX-12+CHP.Env_En),A LD (IX-12+CHP.PsInOr),A CALL NZ,SETENV JR PD_SAM_ PT3PD LD A,(IX-12+CHP.Note) LD (PrNote+1),A LD L,(IX-12+CHP.CrTnSl) LD H,(IX-12+CHP.CrTnSl+1) LD (PrSlide+1),HL PD_LOOP LD DE,#2010 PD_LP2 LD A,(BC) INC BC ADD A,E JR C,PD_OrSm ADD A,D JR Z,PD_FIN JR C,PD_SAM ADD A,E JR Z,PD_REL JR C,PD_VOL ADD A,E JR Z,PD_EOff JR C,PD_SorE ADD A,96 JR C,PD_NOTE ADD A,E JR C,PD_ORN ADD A,D JR C,PD_NOIS ADD A,E JR C,PD_ESAM ADD A,A LD E,A LD HL,SPCCOMS+#FF20-#2000 ADD HL,DE LD E,(HL) INC HL LD D,(HL) PUSH DE JR PD_LOOP PD_NOIS LD (IY-100+VRS.Ns_Base),A JR PD_LP2 PD_REL RES 0,(IX-12+CHP.Flags) JR PD_RES PD_NOTE LD (IX-12+CHP.Note),A SET 0,(IX-12+CHP.Flags) XOR A PD_RES LD (PDSP_+1),SP LD SP,IX LD H,A LD L,A PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PUSH HL PDSP_ LD SP,#3131 PD_FIN LD A,(IX-12+CHP.NNtSkp) LD (IX-12+CHP.NtSkCn),A RET C_PORTM LD A,(BC) INC BC ;SKIP PRECALCULATED TONE DELTA (BECAUSE ;CANNOT BE RIGHT AFTER PT3 COMPILATION) INC BC INC BC EX AF,AF' LD A,(BC) ;SIGNED TONE STEP INC BC LD (LoStep),A LD A,(BC) INC BC AND A EX AF,AF' LD L,(IX-12+CHP.CrTnSl) LD H,(IX-12+CHP.CrTnSl+1) ;Set portamento variables ;A - Delay; A' - Hi(Step); ZF' - (A'=0); HL - CrTnSl SETPORT RES 2,(IX-12+CHP.Flags) LD (IX-12+CHP.TnSlDl),A LD (IX-12+CHP.TSlCnt),A PUSH HL LD DE,NT_ LD A,(IX-12+CHP.Note) LD (IX-12+CHP.SlToNt),A ADD A,A LD L,A LD H,0 ADD HL,DE LD A,(HL) INC HL LD H,(HL) LD L,A PUSH HL PrNote LD A,#3E LD (IX-12+CHP.Note),A ADD A,A LD L,A LD H,0 ADD HL,DE LD E,(HL) INC HL LD D,(HL) POP HL SBC HL,DE LD (IX-12+CHP.TnDelt),L LD (IX-12+CHP.TnDelt+1),H POP DE Version EQU $+1 LD A,#3E CP 6 JR C,OLDPRTM ;Old 3xxx for PT v3.5- PrSlide LD DE,#1111 LD (IX-12+CHP.CrTnSl),E LD (IX-12+CHP.CrTnSl+1),D LoStep EQU $+1 OLDPRTM LD A,#3E EX AF,AF' JR Z,NOSIG EX DE,HL NOSIG SBC HL,DE JP P,SET_STP CPL EX AF,AF' NEG EX AF,AF' SET_STP LD (IX-12+CHP.TSlStp+1),A EX AF,AF' LD (IX-12+CHP.TSlStp),A LD (IX-12+CHP.COnOff),0 RET C_GLISS SET 2,(IX-12+CHP.Flags) LD A,(BC) INC BC LD (IX-12+CHP.TnSlDl),A AND A JR NZ,GL36 LD A,(Version) ;AlCo PT3.7+ CP 7 SBC A,A INC A GL36 LD (IX-12+CHP.TSlCnt),A LD A,(BC) INC BC EX AF,AF' LD A,(BC) INC BC JR SET_STP C_SMPOS LD A,(BC) INC BC LD (IX-12+CHP.PsInSm),A RET C_ORPOS LD A,(BC) INC BC LD (IX-12+CHP.PsInOr),A RET C_VIBRT LD A,(BC) INC BC LD (IX-12+CHP.OnOffD),A LD (IX-12+CHP.COnOff),A LD A,(BC) INC BC LD (IX-12+CHP.OffOnD),A XOR A LD (IX-12+CHP.TSlCnt),A LD (IX-12+CHP.CrTnSl),A LD (IX-12+CHP.CrTnSl+1),A RET C_ENGLS LD A,(BC) INC BC LD (IY-100+VRS.Env_Del),A LD (IY-100+VRS.CurEDel),A LD A,(BC) INC BC LD L,A LD A,(BC) INC BC LD H,A LD (IY-100+VRS.ESldAdd),L LD (IY-100+VRS.ESldAdd+1),H RET C_DELAY LD A,(BC) INC BC LD (IY-100+VRS.Delay),A LD HL,VARS2+VRS.ModNum ;if AlCo_TS BIT 1,(HL) RET Z LD (VARS1+VRS.Delay),A LD (VARS1+VRS.DelyCnt),A LD (VARS2+VRS.Delay),A RET SETENV LD (IX-12+CHP.Env_En),E LD (IY-100+VRS.AYREGS+EnvTp),A LD A,(BC) INC BC LD H,A LD A,(BC) INC BC LD L,A CALL SETENBS XOR A LD (IX-12+CHP.PsInOr),A LD (IY-100+VRS.CurEDel),A LD H,A LD L,A JP SETESLD SETORN ADD A,A LD E,A LD D,0 LD (IX-12+CHP.PsInOr),D LD L,(IY-100+VRS.OrnPtrs) LD H,(IY-100+VRS.OrnPtrs+1) ADD HL,DE LD E,(HL) INC HL LD D,(HL) LD L,(IY-100+VRS.MODADDR) LD H,(IY-100+VRS.MODADDR+1) ADD HL,DE LD (IX-12+CHP.OrnPtr),L LD (IX-12+CHP.OrnPtr+1),H C_NOP RET SETSAM ADD A,A LD E,A LD D,0 LD L,(IY-100+VRS.SamPtrs); LD H,(IY-100+VRS.SamPtrs+1); ADD HL,DE LD E,(HL) INC HL LD D,(HL) LD L,(IY-100+VRS.MODADDR) LD H,(IY-100+VRS.MODADDR+1) ADD HL,DE LD (IX-12+CHP.SamPtr),L LD (IX-12+CHP.SamPtr+1),H RET ;ALL 16 ADDRESSES TO PROTECT FROM BROKEN PT3 MODULES SPCCOMS DW C_NOP DW C_GLISS DW C_PORTM DW C_SMPOS DW C_ORPOS DW C_VIBRT DW C_NOP DW C_NOP DW C_ENGLS DW C_DELAY DW C_NOP DW C_NOP DW C_NOP DW C_NOP DW C_NOP DW C_NOP CHREGS CALL GETIX XOR A LD (Ampl),A BIT 0,(IX+CHP.Flags) PUSH HL JP Z,CH_EXIT LD (CSP_+1),SP LD L,(IX+CHP.OrnPtr) LD H,(IX+CHP.OrnPtr+1) LD SP,HL POP DE LD H,A LD A,(IX+CHP.PsInOr) LD L,A ADD HL,SP INC A ;PT2 PT3 OrnCP INC A ;CP E CP D JR C,CH_ORPS OrnLD DB 1 ;LD A,D LD A,E CH_ORPS LD (IX+CHP.PsInOr),A LD A,(IX+CHP.Note) ADD A,(HL) JP P,CH_NTP XOR A CH_NTP CP 96 JR C,CH_NOK LD A,95 CH_NOK ADD A,A EX AF,AF' LD L,(IX+CHP.SamPtr) LD H,(IX+CHP.SamPtr+1) LD SP,HL POP DE LD H,0 LD A,(IX+CHP.PsInSm) LD B,A ADD A,A SamClc2 ADD A,A ;or ADD A,B for PT2 LD L,A ADD HL,SP LD SP,HL LD A,B INC A ;PT2 PT3 SamCP INC A ;CP E CP D JR C,CH_SMPS SamLD DB 1 ;LD A,D LD A,E CH_SMPS LD (IX+CHP.PsInSm),A POP BC POP HL ;Convert PT2 sample to PT3 ;PT2 PT3 SamCnv POP HL ;BIT 2,C JR e_ POP HL LD H,B JR NZ,$+8 EX DE,HL AND A SBC HL,HL SBC HL,DE LD D,C RR C SBC A,A CPL AND #3E RR C RR B AND C LD C,A LD A,B RRA RRA RR D RRA AND #9F LD B,A e_ LD E,(IX+CHP.TnAcc) LD D,(IX+CHP.TnAcc+1) ADD HL,DE BIT 6,B JR Z,CH_NOAC LD (IX+CHP.TnAcc),L LD (IX+CHP.TnAcc+1),H CH_NOAC EX DE,HL EX AF,AF' ADD A,NT_ LD L,A ADC A,NT_/256 SUB L LD H,A LD SP,HL POP HL ADD HL,DE LD E,(IX+CHP.CrTnSl) LD D,(IX+CHP.CrTnSl+1) ADD HL,DE CSP_ LD SP,#3131 EX (SP),HL XOR A OR (IX+CHP.TSlCnt) JR Z,CH_AMP DEC (IX+CHP.TSlCnt) JR NZ,CH_AMP LD A,(IX+CHP.TnSlDl) LD (IX+CHP.TSlCnt),A LD L,(IX+CHP.TSlStp) LD H,(IX+CHP.TSlStp+1) LD A,H ADD HL,DE LD (IX+CHP.CrTnSl),L LD (IX+CHP.CrTnSl+1),H BIT 2,(IX+CHP.Flags) JR NZ,CH_AMP LD E,(IX+CHP.TnDelt) LD D,(IX+CHP.TnDelt+1) AND A JR Z,CH_STPP EX DE,HL CH_STPP SBC HL,DE JP M,CH_AMP LD A,(IX+CHP.SlToNt) LD (IX+CHP.Note),A XOR A LD (IX+CHP.TSlCnt),A LD (IX+CHP.CrTnSl),A LD (IX+CHP.CrTnSl+1),A CH_AMP LD A,(IX+CHP.CrAmSl) BIT 7,C JR Z,CH_NOAM BIT 6,C JR Z,CH_AMIN CP 15 JR Z,CH_NOAM INC A JR CH_SVAM CH_AMIN CP -15 JR Z,CH_NOAM DEC A CH_SVAM LD (IX+CHP.CrAmSl),A CH_NOAM LD L,A LD A,B AND 15 ADD A,L JP P,CH_APOS XOR A CH_APOS CP 16 JR C,CH_VOL LD A,15 CH_VOL OR (IX+CHP.Volume) ADD A,VT_ LD L,A ADC A,VT_/256 SUB L LD H,A LD A,(HL) CH_ENV BIT 0,C JR NZ,CH_NOEN OR (IX+CHP.Env_En) CH_NOEN LD (Ampl),A BIT 7,B LD A,C JR Z,NO_ENSL RLA RLA SRA A SRA A SRA A ADD A,(IX+CHP.CrEnSl) ;SEE COMMENT BELOW BIT 5,B JR Z,NO_ENAC LD (IX+CHP.CrEnSl),A NO_ENAC ADD A,(IY-100+VRS.AddToEn) ;BUG IN PT3 - NEED WORD HERE LD (IY-100+VRS.AddToEn),A JR CH_MIX NO_ENSL RRA ADD A,(IX+CHP.CrNsSl) LD (IY-100+VRS.AddToNs),A BIT 5,B JR Z,CH_MIX LD (IX+CHP.CrNsSl),A CH_MIX LD A,B RRA AND #48 CH_EXIT OR (IY-100+VRS.AYREGS+Mixer) RRCA LD (IY-100+VRS.AYREGS+Mixer),A POP HL XOR A OR (IX+CHP.COnOff) RET Z DEC (IX+CHP.COnOff) RET NZ XOR (IX+CHP.Flags) LD (IX+CHP.Flags),A RRA LD A,(IX+CHP.OnOffD) JR C,CH_ONDL LD A,(IX+CHP.OffOnD) CH_ONDL LD (IX+CHP.COnOff),A RET PLAY_ XOR A LD (IY-100+VRS.AddToEn),A LD (IY-100+VRS.AYREGS+Mixer),A DEC A LD (IY-100+VRS.AYREGS+EnvTp),A DEC (IY-100+VRS.DelyCnt) JP NZ,PL2 DEC (IY-100+VRS.ChanA+CHP.NtSkCn) JR NZ,PL1B LD C,(IY-100+VRS.AdInPtA) LD B,(IY-100+VRS.AdInPtA+1) LD A,(BC) AND A JR NZ,PL1A LD D,A LD (IY-100+VRS.Ns_Base),A LD L,(IY-100+VRS.CrPsPtr) LD H,(IY-100+VRS.CrPsPtr+1) INC HL LD A,(HL) INC A JR NZ,PLNLP IF LoopChecker CALL CHECKLP ENDIF LD L,(IY-100+VRS.LPosPtr) LD H,(IY-100+VRS.LPosPtr+1) LD A,(HL) INC A PLNLP CALL SETCPPT DEC A BIT 1,(IY-100+VRS.ModNum) JR Z,NoAlCo TSSub EQU $+1 SUB #D6 CPL NoAlCo ;PT2 PT3 PsCalc DEC A ;ADD A,A NOP DEC A ;ADD A,(HL) NOP ADD A,A LD E,A RL D IF CurPosCounter LD A,L SUB (IY-100+VRS.PosSub) LD (IY-100+VRS.CurPos),A ENDIF LD L,(IY-100+VRS.PatsPtr) LD H,(IY-100+VRS.PatsPtr+1) ADD HL,DE LD E,(IY-100+VRS.MODADDR) LD D,(IY-100+VRS.MODADDR+1) LD (PSP_+1),SP LD SP,HL POP HL ADD HL,DE LD B,H LD C,L POP HL ADD HL,DE LD (IY-100+VRS.AdInPtB),L LD (IY-100+VRS.AdInPtB+1),H POP HL ADD HL,DE LD (IY-100+VRS.AdInPtC),L LD (IY-100+VRS.AdInPtC+1),H PSP_ LD SP,#3131 PL1A LD DE,VRS.ChanA+12-100 CALL PTDECOD LD (IY-100+VRS.AdInPtA),C LD (IY-100+VRS.AdInPtA+1),B PL1B DEC (IY-100+VRS.ChanB+CHP.NtSkCn) JR NZ,PL1C LD DE,VRS.ChanB+12-100 LD C,(IY-100+VRS.AdInPtB) LD B,(IY-100+VRS.AdInPtB+1) CALL PTDECOD LD (IY-100+VRS.AdInPtB),C LD (IY-100+VRS.AdInPtB+1),B PL1C DEC (IY-100+VRS.ChanC+CHP.NtSkCn) JR NZ,PL1D LD DE,VRS.ChanC+12-100 LD C,(IY-100+VRS.AdInPtC) LD B,(IY-100+VRS.AdInPtC+1) CALL PTDECOD LD (IY-100+VRS.AdInPtC),C LD (IY-100+VRS.AdInPtC+1),B PL1D LD A,(IY-100+VRS.Delay) LD (IY-100+VRS.DelyCnt),A PL2 LD DE,VRS.ChanA-100 LD L,(IY-100+VRS.AYREGS+TonA) LD H,(IY-100+VRS.AYREGS+TonA+1) CALL CHREGS LD (IY-100+VRS.AYREGS+TonA),L LD (IY-100+VRS.AYREGS+TonA+1),H Ampl EQU $+1 LD A,#3E LD (IY-100+VRS.AYREGS+AmplA),A LD DE,VRS.ChanB-100 LD L,(IY-100+VRS.AYREGS+TonB) LD H,(IY-100+VRS.AYREGS+TonB+1) CALL CHREGS LD (IY-100+VRS.AYREGS+TonB),L LD (IY-100+VRS.AYREGS+TonB+1),H LD A,(Ampl) LD (IY-100+VRS.AYREGS+AmplB),A LD DE,VRS.ChanC-100 LD L,(IY-100+VRS.AYREGS+TonC) LD H,(IY-100+VRS.AYREGS+TonC+1) CALL CHREGS LD (IY-100+VRS.AYREGS+TonC),L LD (IY-100+VRS.AYREGS+TonC+1),H LD A,(Ampl) LD (IY-100+VRS.AYREGS+AmplC),A LD A,(IY-100+VRS.Ns_Base) ADD (IY-100+VRS.AddToNs) LD (IY-100+VRS.AYREGS+Noise),A LD A,(IY-100+VRS.AddToEn) LD E,A ADD A,A SBC A,A LD D,A LD L,(IY-100+VRS.EnvBase) LD H,(IY-100+VRS.EnvBase+1) ADD HL,DE LD E,(IY-100+VRS.CurESld) LD D,(IY-100+VRS.CurESld+1) ADD HL,DE LD (IY-100+VRS.AYREGS+Env),L LD (IY-100+VRS.AYREGS+Env+1),H XOR A OR (IY-100+VRS.CurEDel) RET Z DEC (IY-100+VRS.CurEDel) RET NZ LD A,(IY-100+VRS.Env_Del) LD (IY-100+VRS.CurEDel),A LD L,(IY-100+VRS.ESldAdd) LD H,(IY-100+VRS.ESldAdd+1) ADD HL,DE JP SETESLD PLAY LD IY,VARS1+100 CALL PLAY_ LD A,(is_ts) AND A JR Z,PL_nts LD IY,VARS2+100 CALL PLAY_ PL_nts IF Basic LD IY,#5C3A ENDIF ROUT LD BC,#FFFD LD A,(is_ts) AND A JR Z,r_nts ;keep old standard OUT (C),B r_nts EX AF,AF' IF ACBBAC LD IX,VARS1+VRS.AYREGS ELSE LD HL,VARS1+VRS.AYREGS ENDIF CALL ROUT_ EX AF,AF' RET Z LD B,D CPL OUT (C),A IF ACBBAC LD IX,VARS2+VRS.AYREGS ELSE LD HL,VARS2+VRS.AYREGS ENDIF ROUT_ IF ACBBAC LD A,(SETUP) AND 12 JR Z,ABC ADD A,CHTABLE LD E,A ADC A,CHTABLE/256 SUB E LD D,A LD B,0 PUSH IX POP HL LD A,(DE) INC DE LD C,A ADD HL,BC LD A,(IX+TonB) LD C,(HL) LD (IX+TonB),C LD (HL),A INC HL LD A,(IX+TonB+1) LD C,(HL) LD (IX+TonB+1),C LD (HL),A LD A,(DE) INC DE LD C,A ADD HL,BC LD A,(IX+AmplB) LD C,(HL) LD (IX+AmplB),C LD (HL),A LD A,(DE) INC DE LD (RxCA1),A XOR 8 LD (RxCA2),A LD A,(DE) AND (IX+Mixer) LD E,A LD A,(IX+Mixer) RxCA1 DB #E6 AND %010010 OR E LD E,A LD A,(IX+Mixer) AND %010010 RxCA2 OR E OR E LD (IX+Mixer),A ABC ENDIF XOR A LD DE,#FFBF IF ACBBAC LD BC,#FFFD PUSH IX POP HL ENDIF LOUT OUT (C),A LD B,E OUTI LD B,D INC A CP 13 JR NZ,LOUT OUT (C),A LD A,(HL) AND A RET M LD B,E OUT (C),A RET IF ACBBAC CHTABLE EQU $-4 DB 4,5,15,%001001,0,7,7,%100100 ENDIF NT_DATA DB (T_NEW_0-T1_)*2 DB TCNEW_0-T_ DB (T_OLD_0-T1_)*2+1 DB TCOLD_0-T_ DB (T_NEW_1-T1_)*2+1 DB TCNEW_1-T_ DB (T_OLD_1-T1_)*2+1 DB TCOLD_1-T_ DB (T_NEW_2-T1_)*2 DB TCNEW_2-T_ DB (T_OLD_2-T1_)*2 DB TCOLD_2-T_ DB (T_NEW_3-T1_)*2 DB TCNEW_3-T_ DB (T_OLD_3-T1_)*2 DB TCOLD_3-T_ T_ TCOLD_0 DB #00+1,#04+1,#08+1,#0A+1,#0C+1,#0E+1,#12+1,#14+1 DB #18+1,#24+1,#3C+1,0 TCOLD_1 DB #5C+1,0 TCOLD_2 DB #30+1,#36+1,#4C+1,#52+1,#5E+1,#70+1,#82,#8C,#9C DB #9E,#A0,#A6,#A8,#AA,#AC,#AE,#AE,0 TCNEW_3 DB #56+1 TCOLD_3 DB #1E+1,#22+1,#24+1,#28+1,#2C+1,#2E+1,#32+1,#BE+1,0 TCNEW_0 DB #1C+1,#20+1,#22+1,#26+1,#2A+1,#2C+1,#30+1,#54+1 DB #BC+1,#BE+1,0 TCNEW_1 EQU TCOLD_1 TCNEW_2 DB #1A+1,#20+1,#24+1,#28+1,#2A+1,#3A+1,#4C+1,#5E+1 DB #BA+1,#BC+1,#BE+1,0 PT3EMPTYORN EQU $-1 DB 1,0 ;first 12 values of tone tables (packed) T_PACK DB #06EC*2/256,#06EC*2 DB #0755-#06EC DB #07C5-#0755 DB #083B-#07C5 DB #08B8-#083B DB #093D-#08B8 DB #09CA-#093D DB #0A5F-#09CA DB #0AFC-#0A5F DB #0BA4-#0AFC DB #0C55-#0BA4 DB #0D10-#0C55 DB #066D*2/256,#066D*2 DB #06CF-#066D DB #0737-#06CF DB #07A4-#0737 DB #0819-#07A4 DB #0894-#0819 DB #0917-#0894 DB #09A1-#0917 DB #0A33-#09A1 DB #0ACF-#0A33 DB #0B73-#0ACF DB #0C22-#0B73 DB #0CDA-#0C22 DB #0704*2/256,#0704*2 DB #076E-#0704 DB #07E0-#076E DB #0858-#07E0 DB #08D6-#0858 DB #095C-#08D6 DB #09EC-#095C DB #0A82-#09EC DB #0B22-#0A82 DB #0BCC-#0B22 DB #0C80-#0BCC DB #0D3E-#0C80 DB #07E0*2/256,#07E0*2 DB #0858-#07E0 DB #08E0-#0858 DB #0960-#08E0 DB #09F0-#0960 DB #0A88-#09F0 DB #0B28-#0A88 DB #0BD8-#0B28 DB #0C80-#0BD8 DB #0D60-#0C80 DB #0E10-#0D60 DB #0EF8-#0E10 ;vars from here can be stripped ;you can move VARS to any other address VARS is_ts DB 0 ;ChannelsVars STRUCT CHP ;reset group PsInOr DB 0 PsInSm DB 0 CrAmSl DB 0 CrNsSl DB 0 CrEnSl DB 0 TSlCnt DB 0 CrTnSl DW 0 TnAcc DW 0 COnOff DB 0 ;reset group OnOffD DB 0 ;IX for PTDECOD here (+12) OffOnD DB 0 OrnPtr DW 0 SamPtr DW 0 NNtSkp DB 0 Note DB 0 SlToNt DB 0 Env_En DB 0 Flags DB 0 ;Enabled - 0, SimpleGliss - 2 TnSlDl DB 0 TSlStp DW 0 TnDelt DW 0 NtSkCn DB 0 Volume DB 0 ENDS STRUCT VRS ;IF not works in STRUCT in SjASM :( ; IF CurPosCounter CurPos DB 0 PosSub DB 0 ; ENDIF ModNum DB 0 ;bit0: ChipNum ;bit1: 1-reversed patterns order (AlCo TS) ChanA DS CHP ChanB DS CHP ChanC DS CHP ;GlobalVars MODADDR DW 0 OrnPtrs DW 0 SamPtrs DW 0 PatsPtr DW 0 AdInPtA DW 0 AdInPtB DW 0 AdInPtC DW 0 CrPsPtr DW 0 LPosPtr DW 0 Delay DB 0 DelyCnt DB 0 ESldAdd DW 0 CurESld DW 0 Env_Del DB 0 CurEDel DB 0 Ns_Base DB 0 AddToNs DB 0 AddToEn DB 0 EnvBase DW 0 AYREGS DS 14 ENDS VARS1 DS VRS VARS2 DS VRS VT_ EQU $-16 DS 256-16 ;CreatedVolumeTableAddress T1_ EQU VT_+16 ;Tone tables data depacked here T_OLD_1 EQU T1_ T_OLD_2 EQU T_OLD_1+24 T_OLD_3 EQU T_OLD_2+24 T_OLD_0 EQU T_OLD_3+2 T_NEW_0 EQU T_OLD_0 T_NEW_1 EQU T_OLD_1 T_NEW_2 EQU T_NEW_0+24 T_NEW_3 EQU T_OLD_3 PT2EMPTYORN EQU VT_+31 ;1,0,0 sequence NT_ DS 192 ;CreatedNoteTableAddress VAR0END EQU VT_+16 ;INIT zeroes from VARS to VAR0END-1 VARSEND EQU $ MDLADDR EQU outputBuffer ;Release 0 steps: ;04/21/2007 ;Works start (PTxPlay adaptation); first beta. ;04/22/2007 ;Job finished; beta-testing. ;04/23/2007 ;PT v3.7 TS mode corrected (after AlCo remarks). ;04/29/2007 ;Added 1.XX and 2.XX special commands interpretation for PT3 ;modules of v3.7+. ;Size (minimal build for ZX Spectrum): ;Code block #908 bytes ;Variables #2BF bytes (can be stripped) ;Total size #908+#2BF=#BC7 (3015) bytes ENDMODULE
alloy4fun_models/trashltl/models/8/Fjg4zJP658sMQodhp.als
Kaixi26/org.alloytools.alloy
0
810
open main pred idFjg4zJP658sMQodhp_prop9 { always (Protected not in Trash) } pred __repair { idFjg4zJP658sMQodhp_prop9 } check __repair { idFjg4zJP658sMQodhp_prop9 <=> prop9o }
test/fail/IrrelevantRecordMatching.agda
asr/agda-kanso
1
14776
<filename>test/fail/IrrelevantRecordMatching.agda -- 2010-09-07 Andreas module IrrelevantRecordMatching where record Prod (A B : Set) : Set where constructor _,_ field fst : A snd : B wrongElim : {A : Set} -> .(Prod A A) -> A wrongElim (a , a') = a -- needs to fail because a is irrelevant
color/super_palettes.asm
etdv-thevoid/pokemon-rgb-enhanced
1
17317
<filename>color/super_palettes.asm ; Note: after calling this, you may need to set W2_ForceBGPUpdate/ForceOBPUpdate to nonzero. ; d = palette to load (see constants/palette_constants.), e = palette index LoadSGBPalette: ld a,[rSVBK] ld b,a ld a,2 ld [rSVBK],a push bc ld a,e ld l,d ld h,0 add hl add hl add hl ld de,SuperPalettes add hl,de ld de,W2_BgPaletteData jr startPaletteTransfer LoadSGBPalette_Sprite: ld a,[rSVBK] ld b,a ld a,2 ld [rSVBK],a push bc ld a,e ld l,d ld h,0 add hl add hl add hl ld de,SuperPalettes add hl,de ld de,W2_BgPaletteData + $40 startPaletteTransfer: add a add a add a add e ld e,a ld b,8 .palLoop ld a,[hli] ld [de],a inc de dec b jr nz,.palLoop pop af ld [rSVBK],a ret INCLUDE "data/super_palettes.asm"
src/module/ModuleEntry.asm
Dunkansdk/AoW
2
178636
<filename>src/module/ModuleEntry.asm ;////////////////////////////////////////////////////////////////////// ;/// This file is subject to the terms and conditions defined in /// ;/// file 'LICENSE.txt', which is part of this source code package. /// ;////////////////////////////////////////////////////////////////////// [SEGMENT .text] ;//////////////////////////////////////////////////// ;/// Define all modules includes ;//////////////////////////////////////////////////// %include 'src/module/ModuleSpeedhack.asm' ;//////////////////////////////////////////////////// ;/// Define foundation ;//////////////////////////////////////////////////// %ifdef FND_MUNDOS_PERDIDOS %include 'src/foundation/MundosPerdidosAO/Foundation.asm' %include 'src/foundation/MundosPerdidosAO/FoundationValues.asm' %elif defined(FND_HISPANO) %include 'src/foundation/HispanoAO/Foundation.asm' %include 'src/foundation/HispanoAO/FoundationValues.asm' %endif ;//////////////////////////////////////////////////// ;/// \brief Initialize foundation enviroment ;//////////////////////////////////////////////////// InitializeModule: PUSH EBP MOV EBP, ESP ;//////////////////////////////////////////////// ;/// Initialize SpeedHACK module ;//////////////////////////////////////////////// CALL InitializeSpeedhackModule ;//////////////////////////////////////////////// ;/// Initialize Foundation module ;//////////////////////////////////////////////// CALL InitializeFoundation MOV ESP, EBP POP EBP RET ;//////////////////////////////////////////////////// ;/// \brief Send data to the server ;/// ;/// \param sndData The data to send to the server ;//////////////////////////////////////////////////// HandleOutgoingData: PUSH EBP MOV EBP, ESP ;//////////////////////////////////////////////// ;/// Debug the outgoing packet ;//////////////////////////////////////////////// PUSH DWORD [EBP + 0x08] CALL DWORD [OutputDebugStringA] MOV ESP, EBP POP EBP RET 0x04 ;//////////////////////////////////////////////////// ;/// \brief Handle data from the server ;/// ;/// \param data The data recived from the server ;//////////////////////////////////////////////////// HandleIncommingData: PUSH EBP MOV EBP, ESP ;//////////////////////////////////////////////// ;/// Debug the incomming packet ;//////////////////////////////////////////////// PUSH DWORD [EBP + 0x08] CALL DWORD [OutputDebugStringA] MOV ESP, EBP POP EBP RET 0x04
src/jason-tickets-modules.adb
stcarrez/jason
2
372
----------------------------------------------------------------------- -- jason-tickets-modules -- Module tickets -- Copyright (C) 2016, 2017, 2019 Stephane.Carrez -- Written by Stephane.Carrez (<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.Calendar; with AWA.Modules.Beans; with AWA.Modules.Get; with AWA.Permissions; with AWA.Comments.Models; with Util.Log.Loggers; with Jason.Tickets.Beans; with ADO.Sessions; with AWA.Services.Contexts; with ADO.Sessions.Entities; package body Jason.Tickets.Modules is use type ADO.Identifier; package ASC renames AWA.Services.Contexts; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Jason.Tickets.Module"); package Register is new AWA.Modules.Beans (Module => Ticket_Module, Module_Access => Ticket_Module_Access); -- ------------------------------ -- Initialize the tickets module. -- ------------------------------ overriding procedure Initialize (Plugin : in out Ticket_Module; App : in AWA.Modules.Application_Access; Props : in ASF.Applications.Config) is begin Log.Info ("Initializing the tickets module"); -- Register here any bean class, servlet, filter. Register.Register (Plugin => Plugin, Name => "Jason.Tickets.Beans.Ticket_Bean", Handler => Jason.Tickets.Beans.Create_Ticket_Bean'Access); Register.Register (Plugin => Plugin, Name => "Jason.Tickets.Beans.Ticket_List_Bean", Handler => Jason.Tickets.Beans.Create_Ticket_List_Bean'Access); Register.Register (Plugin => Plugin, Name => "Jason.Tickets.Beans.Ticket_Status_List_Bean", Handler => Jason.Tickets.Beans.Create_Status_List'Access); Register.Register (Plugin => Plugin, Name => "Jason.Tickets.Beans.Ticket_Type_List_Bean", Handler => Jason.Tickets.Beans.Create_Type_List'Access); Register.Register (Plugin => Plugin, Name => "Jason.Tickets.Beans.Ticket_Report_Bean", Handler => Jason.Tickets.Beans.Create_Ticket_Report_Bean'Access); AWA.Modules.Module (Plugin).Initialize (App, Props); -- Add here the creation of manager instances. end Initialize; -- ------------------------------ -- Get the tickets module. -- ------------------------------ function Get_Ticket_Module return Ticket_Module_Access is function Get is new AWA.Modules.Get (Ticket_Module, Ticket_Module_Access, NAME); begin return Get; end Get_Ticket_Module; -- ------------------------------ -- Load the ticket. -- ------------------------------ procedure Load_Ticket (Model : in Ticket_Module; Ticket : in out Jason.Tickets.Models.Ticket_Ref'Class; Project : in out Jason.Projects.Models.Project_Ref'Class; Tags : in out AWA.Tags.Beans.Tag_List_Bean; Id : in ADO.Identifier) is DB : ADO.Sessions.Session := Model.Get_Session; Found : Boolean; begin if Id /= ADO.NO_IDENTIFIER then Ticket.Load (DB, Id, Found); if Found then Project.Load (DB, Ticket.Get_Project.Get_Id, Found); end if; else Project.Load (DB, Project.Get_Id, Found); end if; -- Jason.Projects.Models.Project_Ref (Project) := ; -- Ticket.Get_Project.Copy (Projects.Models.Project_Ref (Project)); if Id /= ADO.NO_IDENTIFIER and Found then Tags.Load_Tags (DB, Id); end if; end Load_Ticket; -- ------------------------------ -- Create -- ------------------------------ procedure Create (Model : in Ticket_Module; Entity : in out Jason.Tickets.Models.Ticket_Ref'Class; Project_Id : in ADO.Identifier) is pragma Unreferenced (Model); Ctx : constant ASC.Service_Context_Access := ASC.Current; DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx); User : constant ADO.Identifier := Ctx.Get_User_Identifier; Project : Jason.Projects.Models.Project_Ref; begin -- Check that the user has the create ticket permission on the given project. AWA.Permissions.Check (Permission => ACL_Create_Tickets.Permission, Entity => Project_Id); Ctx.Start; Project.Load (DB, Project_Id); Project.Set_Last_Ticket (Project.Get_Last_Ticket + 1); Entity.Set_Create_Date (Ada.Calendar.Clock); Entity.Set_Status (Jason.Tickets.Models.OPEN); Entity.Set_Creator (Ctx.Get_User); Entity.Set_Project (Project); Entity.Set_Ident (Project.Get_Last_Ticket); Entity.Save (DB); Project.Save (DB); Ctx.Commit; Log.Info ("Ticket {0} created for user {1}", ADO.Identifier'Image (Entity.Get_Id), ADO.Identifier'Image (User)); end Create; -- ------------------------------ -- Save -- ------------------------------ procedure Save (Model : in Ticket_Module; Entity : in out Jason.Tickets.Models.Ticket_Ref'Class; Comment : in String) is pragma Unreferenced (Model); Ctx : constant ASC.Service_Context_Access := ASC.Current; DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx); Cmt : AWA.Comments.Models.Comment_Ref; Now : constant Ada.Calendar.Time := Ada.Calendar.Clock; begin -- Check that the user has the update ticket permission on the given ticket. AWA.Permissions.Check (Permission => ACL_Update_Tickets.Permission, Entity => Entity); Ctx.Start; Entity.Set_Update_Date (Now); if Comment'Length > 0 then Cmt.Set_Author (Ctx.Get_User); Cmt.Set_Create_Date (Now); Cmt.Set_Message (Comment); Cmt.Set_Entity_Id (Entity.Get_Id); Cmt.Set_Entity_Type (ADO.Sessions.Entities.Find_Entity_Type (DB, Models.TICKET_TABLE)); Cmt.Save (DB); end if; Entity.Save (DB); Ctx.Commit; end Save; end Jason.Tickets.Modules;
src/apsepp-test_event_class-generic_timestamp_mixin.adb
thierr26/ada-apsepp
0
423
<reponame>thierr26/ada-apsepp -- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. package body Apsepp.Test_Event_Class.Generic_Timestamp_Mixin is ---------------------------------------------------------------------------- overriding procedure Set (Obj : in out Child_W_Timestamp; Data : Test_Event_Data) is begin Parent (Obj).Set (Data); -- Inherited procedure call. Obj.Date := Data.Date; end Set; ---------------------------------------------------------------------------- overriding function Timestamp (Obj : Child_W_Timestamp) return Time is (Obj.Date); ---------------------------------------------------------------------------- overriding procedure Set_Timestamp (Obj : in out Child_W_Timestamp; Date : Time := Clock) is begin Obj.Date := Date; end Set_Timestamp; ---------------------------------------------------------------------------- end Apsepp.Test_Event_Class.Generic_Timestamp_Mixin;
oeis/038/A038293.asm
neoneye/loda-programs
11
23670
<filename>oeis/038/A038293.asm ; A038293: Triangle whose (i,j)-th entry is binomial(i,j)*9^(i-j)*3^j. ; Submitted by <NAME> ; 1,9,3,81,54,9,729,729,243,27,6561,8748,4374,972,81,59049,98415,65610,21870,3645,243,531441,1062882,885735,393660,98415,13122,729,4782969,11160261,11160261,6200145,2066715,413343,45927,2187 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe add $2,$1 bin $1,$0 mov $0,3 add $2,4 pow $0,$2 mul $1,$0 mov $0,$1 div $0,81
libsrc/_DEVELOPMENT/string/c/sccz80/strrstr_callee.asm
UnivEngineer/z88dk
1
244751
; char *strrstr(const char *s, const char *w) SECTION code_clib SECTION code_string PUBLIC strrstr_callee EXTERN asm_strrstr strrstr_callee: IF __CPU_GBZ80__ pop bc pop de pop hl push bc call asm_strrstr ld d,h ld e,l ret ELSE pop hl pop de ex (sp),hl jp asm_strrstr ENDIF ; SDCC bridge for Classic IF __CLASSIC PUBLIC _strrstr_callee defc _strrstr_callee = strrstr_callee ENDIF
Categories/Adjoint/Properties.agda
Taneb/agda-categories
0
16477
<reponame>Taneb/agda-categories<gh_stars>0 {-# OPTIONS --without-K --safe #-} module Categories.Adjoint.Properties where open import Level open import Data.Product using (Σ; _,_; -,_; proj₂; uncurry) open import Function using (_$_) open import Categories.Adjoint using (_⊣_; Adjoint; Hom-NI′⇒Adjoint) open import Categories.Adjoint.RAPL public open import Categories.Category using (Category; _[_,_]) open import Categories.Category.Product using (_⁂_; _⁂ⁿⁱ_) open import Categories.Category.Construction.Comma using (CommaObj; Comma⇒; _↙_) open import Categories.Functor renaming (id to idF) open import Categories.Functor.Hom open import Categories.Functor.Construction.Constant open import Categories.Functor.Construction.LiftSetoids open import Categories.Functor.Properties open import Categories.Functor.Continuous open import Categories.Functor.Cocontinuous open import Categories.Functor.Bifunctor open import Categories.Functor.Bifunctor.Properties open import Categories.NaturalTransformation open import Categories.NaturalTransformation.Properties open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism; _≃_; _ⓘₕ_; _ⓘˡ_; module ≃) open import Categories.NaturalTransformation.NaturalIsomorphism.Properties open import Categories.Monad open import Categories.Monad.Duality open import Categories.Comonad open import Categories.Morphism.Universal open import Categories.Yoneda import Categories.Yoneda.Properties as YP import Categories.Diagram.Colimit as Col import Categories.Diagram.Duality as Duality import Categories.Morphism as Mor import Categories.Morphism.Reasoning as MR private variable o ℓ e : Level C D E J : Category o ℓ e -- if the left adjoint functor is a partial application of bifunctor, then it uniquely -- determines a bifunctor compatible with the right adjoint functor. module _ {C : Category o ℓ e} (L : Bifunctor C E D) {R : ∀ (X : Category.Obj E) → Functor D C} (LR : ∀ (X : Category.Obj E) → appʳ L X ⊣ R X) where private module C = Category C module D = Category D module E = Category E module L = Functor L module R X = Functor (R X) module LR X = Adjoint (LR X) open C F′ : ∀ {A X B Y} f g → R.F₀ A X ⇒ R.F₀ B Y F′ {A} {X} {B} {Y} f g = LR.Ladjunct B (LR.counit.η A Y D.∘ L.F₁ (R.F₁ A g , f)) -- R.F₁ B (LR.counit.η A Y) ∘ R.F₁ B (L.F₁ (R.F₁ A g , f)) ∘ LR.unit.η B (R.F₀ A X) commute′ : ∀ {A B X} (f : A E.⇒ B) → LR.counit.η A X D.∘ L.F₁ (F′ f D.id , E.id) D.≈ LR.counit.η B X D.∘ L.F₁ (C.id , f) commute′ {A} {B} {X} f = begin LR.counit.η A X D.∘ L.F₁ (F′ f D.id , E.id) ≈⟨ LR.RLadjunct≈id A ⟩ LR.counit.η B X D.∘ L.F₁ (R.F₁ B D.id , f) ≈⟨ refl ⟩∘⟨ L.F-resp-≈ (R.identity B , E.Equiv.refl) ⟩ LR.counit.η B X D.∘ L.F₁ (C.id , f) ∎ where open D.HomReasoning open HomReasoning decompose₁ : ∀ {A B X Y} {f : A E.⇒ B} {g : X D.⇒ Y} → F′ f g ≈ R.F₁ A g ∘ F′ f D.id decompose₁ {A} {B} {X} {Y} {f} {g} = begin F′ f g ≈⟨ R.F-resp-≈ A (D.∘-resp-≈ʳ [ L ]-decompose₁) ⟩∘⟨refl ⟩ R.F₁ A (LR.counit.η B Y D.∘ L.F₁ (R.F₁ B g , E.id) D.∘ L.F₁ (C.id , f)) ∘ LR.unit.η A (R.F₀ B X) ≈⟨ R.F-resp-≈ A (pullˡ (LR.counit.commute B g)) ⟩∘⟨refl ⟩ R.F₁ A ((g D.∘ LR.counit.η B X) D.∘ L.F₁ (C.id , f)) ∘ LR.unit.η A (R.F₀ B X) ≈˘⟨ R.F-resp-≈ A (pushʳ (D.∘-resp-≈ʳ (L.F-resp-≈ (R.identity B , E.Equiv.refl)))) ⟩∘⟨refl ⟩ R.F₁ A (g D.∘ LR.counit.η B X D.∘ L.F₁ (R.F₁ B D.id , f)) ∘ LR.unit.η A (R.F₀ B X) ≈⟨ R.homomorphism A ⟩∘⟨refl ⟩ (R.F₁ A g ∘ R.F₁ A (LR.counit.η B X D.∘ L.F₁ (R.F₁ B D.id , f))) ∘ LR.unit.η A (R.F₀ B X) ≈⟨ assoc ⟩ R.F₁ A g ∘ F′ f D.id ∎ where open MR D decompose₂ : ∀ {A B X Y} {f : A E.⇒ B} {g : X D.⇒ Y} → F′ f g ≈ F′ f D.id ∘ R.F₁ B g decompose₂ {A} {B} {X} {Y} {f} {g} = begin F′ f g ≈⟨ R.F-resp-≈ A (D.∘-resp-≈ʳ [ L ]-decompose₂) ⟩∘⟨refl ⟩ R.F₁ A (LR.counit.η B Y D.∘ L.F₁ (C.id , f) D.∘ L.F₁ (R.F₁ B g , E.id)) ∘ LR.unit.η A (R.F₀ B X) ≈˘⟨ R.F-resp-≈ A (pushˡ (D.∘-resp-≈ʳ (L.F-resp-≈ (R.identity B , E.Equiv.refl)))) ⟩∘⟨refl ⟩ R.F₁ A ((LR.counit.η B Y D.∘ L.F₁ (R.F₁ B D.id , f)) D.∘ L.F₁ (R.F₁ B g , E.id)) ∘ LR.unit.η A (R.F₀ B X) ≈⟨ R.homomorphism A ⟩∘⟨refl ⟩ (R.F₁ A (LR.counit.η B Y D.∘ L.F₁ (R.F₁ B D.id , f)) ∘ R.F₁ A (L.F₁ (R.F₁ B g , E.id))) ∘ LR.unit.η A (R.F₀ B X) ≈˘⟨ MR.pushʳ C (LR.unit.commute A (R.F₁ B g)) ⟩ R.F₁ A (LR.counit.η B Y D.∘ L.F₁ (R.F₁ B D.id , f)) ∘ LR.unit.η A (R.F₀ B Y) ∘ R.F₁ B g ≈˘⟨ assoc ⟩ F′ f D.id ∘ R.F₁ B g ∎ where open MR D swap : ∀ {A B X Y} {f : A E.⇒ B} {g : X D.⇒ Y} → R.F₁ A g ∘ F′ f D.id ≈ F′ f D.id ∘ R.F₁ B g swap = trans (⟺ decompose₁) decompose₂ commute″ : ∀ {X Y Z A} {f : Y E.⇒ Z} {g : X E.⇒ Y} → F′ (f E.∘ g) (D.id {A}) ≈ F′ g D.id ∘ F′ f D.id commute″ {X} {Y} {Z} {A} {f} {g} = begin F′ (f E.∘ g) D.id ≈⟨ R.F-resp-≈ X (D.∘-resp-≈ʳ (L.F-resp-≈ (R.identity Z , E.Equiv.refl))) ⟩∘⟨refl ⟩ R.F₁ X (LR.counit.η Z A D.∘ L.F₁ (C.id , f E.∘ g)) ∘ LR.unit.η X (R.F₀ Z A) ≈⟨ R.F-resp-≈ X (D.∘-resp-≈ʳ (Functor.homomorphism (appˡ L (R.F₀ Z A)))) ⟩∘⟨refl ⟩ R.F₁ X (LR.counit.η Z A D.∘ L.F₁ (C.id , f) D.∘ L.F₁ (C.id , g)) ∘ LR.unit.η X (R.F₀ Z A) ≈˘⟨ R.F-resp-≈ X (MR.pushˡ D (commute′ f)) ⟩∘⟨refl ⟩ R.F₁ X ((LR.counit.η Y A D.∘ L.F₁ (F′ f D.id , E.id)) D.∘ L.F₁ (C.id , g)) ∘ LR.unit.η X (R.F₀ Z A) ≈˘⟨ R.F-resp-≈ X (MR.pushʳ D [ L ]-commute) ⟩∘⟨refl ⟩ R.F₁ X (LR.counit.η Y A D.∘ L.F₁ (C.id , g) D.∘ L.F₁ (F′ f D.id , E.id)) ∘ LR.unit.η X (R.F₀ Z A) ≈˘⟨ R.F-resp-≈ X D.assoc ⟩∘⟨refl ⟩ R.F₁ X ((LR.counit.η Y A D.∘ L.F₁ (C.id , g)) D.∘ L.F₁ (F′ f D.id , E.id)) ∘ LR.unit.η X (R.F₀ Z A) ≈⟨ R.homomorphism X ⟩∘⟨refl ⟩ (R.F₁ X (LR.counit.η Y A D.∘ L.F₁ (C.id , g)) ∘ R.F₁ X (L.F₁ (F′ f D.id , E.id))) ∘ LR.unit.η X (R.F₀ Z A) ≈˘⟨ MR.pushʳ C (LR.unit.commute X (F′ f D.id)) ⟩ R.F₁ X (LR.counit.η Y A D.∘ L.F₁ (C.id , g)) ∘ LR.unit.η X (R.F₀ Y A) ∘ F′ f D.id ≈˘⟨ R.F-resp-≈ X (D.∘-resp-≈ʳ (L.F-resp-≈ (R.identity Y , E.Equiv.refl))) ⟩∘⟨ refl ⟩∘⟨ refl ⟩ R.F₁ X (LR.counit.η Y A D.∘ L.F₁ (R.F₁ Y D.id , g)) ∘ LR.unit.η X (R.F₀ Y A) ∘ F′ f D.id ≈˘⟨ assoc ⟩ F′ g D.id ∘ F′ f D.id ∎ induced-bifunctorʳ : Bifunctor E.op D C induced-bifunctorʳ = record { F₀ = uncurry R.F₀ ; F₁ = uncurry F′ ; identity = λ where {e , d} → let open MR D in begin F′ E.id D.id ≈⟨ R.F-resp-≈ e (D.∘-resp-≈ʳ (L.F-resp-≈ (R.identity e , E.Equiv.refl))) ⟩∘⟨ refl ⟩ R.F₁ e (LR.counit.η e d D.∘ L.F₁ (C.id , E.id)) ∘ LR.unit.η e (R.F₀ e d) ≈⟨ R.F-resp-≈ e (elimʳ L.identity) ⟩∘⟨ refl ⟩ R.F₁ e (LR.counit.η e d) ∘ LR.unit.η e (R.F₀ e d) ≈⟨ LR.zag e ⟩ C.id ∎ ; homomorphism = λ where {A , X} {B , Y} {W , Z} {f , h} {g , i} → let open MR C in begin F′ (f E.∘ g) (i D.∘ h) ≈⟨ decompose₁ ⟩ R.F₁ W (i D.∘ h) ∘ F′ (f E.∘ g) D.id ≈˘⟨ center⁻¹ (⟺ (R.homomorphism W)) (⟺ commute″) ⟩ R.F₁ W i ∘ (R.F₁ W h ∘ F′ g D.id) ∘ F′ f D.id ≈˘⟨ center (⟺ swap) ⟩ (R.F₁ W i ∘ F′ g D.id) ∘ R.F₁ B h ∘ F′ f D.id ≈˘⟨ decompose₁ ⟩∘⟨ decompose₁ ⟩ F′ g i ∘ F′ f h ∎ ; F-resp-≈ = λ where {A , X} {B , Y} (eq , eq′) → ∘-resp-≈ˡ (R.F-resp-≈ B (D.∘-resp-≈ʳ (L.F-resp-≈ (R.F-resp-≈ A eq′ , eq)))) } -- LAPC: left adjoint preserves colimits. module _ {L : Functor C D} {R : Functor D C} (L⊣R : L ⊣ R) (F : Functor J C) where private module F = Functor F open Col lapc : Colimit F → Colimit (L ∘F F) lapc col = Duality.coLimit⇒Colimit D (rapl (Adjoint.op L⊣R) F.op (Duality.Colimit⇒coLimit C col)) -- adjoint functors induce monads and comonads module _ {L : Functor C D} {R : Functor D C} (L⊣R : L ⊣ R) where private module C = Category C module D = Category D module L = Functor L module R = Functor R open Adjoint L⊣R rapl′ : ∀ {o ℓ e} → Continuous o ℓ e R rapl′ lim = rapl L⊣R _ lim , Mor.≅.refl C lapc′ : ∀ {o ℓ e} → Cocontinuous o ℓ e L lapc′ col = lapc L⊣R _ col , Mor.≅.refl D adjoint⇒monad : Monad C adjoint⇒monad = record { F = R ∘F L ; η = unit ; μ = record { η = μ′.η ; commute = μ′.commute ; sym-commute = μ′.sym-commute } ; assoc = [ R ]-resp-square (counit.commute _) ; sym-assoc = [ R ]-resp-square (counit.sym-commute _) ; identityˡ = λ {X} → begin μ′.η X ∘ R.F₁ (L.F₁ (unit.η X)) ≈⟨ [ R ]-resp-∘ zig ⟩ R.F₁ D.id ≈⟨ R.identity ⟩ C.id ∎ ; identityʳ = zag } where open C open HomReasoning μ′ : NaturalTransformation (R ∘F (L ∘F R) ∘F L) (R ∘F Categories.Functor.id ∘F L) μ′ = R ∘ˡ counit ∘ʳ L module μ′ = NaturalTransformation μ′ module _ {L : Functor C D} {R : Functor D C} (L⊣R : L ⊣ R) where open Adjoint L⊣R adjoint⇒comonad : Comonad D adjoint⇒comonad = coMonad⇒Comonad D (adjoint⇒monad op) -- adjoint functors are the same as universal morphisms module _ {R : Functor D C} where private module C = Category C module D = Category D module R = Functor R adjoint⇒universalMorphisms : ∀ {L : Functor C D} → L ⊣ R → ∀ (X : C.Obj) → UniversalMorphism X R adjoint⇒universalMorphisms {L} L⊣R X = record { initial = record { ⊥ = record { f = unit.η X } ; ! = let open C.HomReasoning in record { commute = LRadjunct≈id ○ ⟺ C.identityʳ } ; !-unique = λ {A} g → let open D.HomReasoning in -, (begin Radjunct (f A) ≈⟨ Radjunct-resp-≈ (C.Equiv.sym (C.Equiv.trans (commute g) (C.identityʳ {f = f A}))) ⟩ Radjunct (Ladjunct (h g)) ≈⟨ RLadjunct≈id ⟩ h g ∎) } } where module L = Functor L open Adjoint L⊣R open Comma⇒ open CommaObj universalMophisms⇒adjoint : (∀ (X : C.Obj) → UniversalMorphism X R) → Σ (Functor C D) (λ L → L ⊣ R) universalMophisms⇒adjoint umors = L , record { unit = ntHelper record { η = λ c → f (umors.⊥ c) ; commute = λ i → let open C.HomReasoning in ⟺ (commute (⊥X⇒⊥Y i) ○ C.identityʳ ) } ; counit = ntHelper record { η = ε ; commute = λ {X Y} i → let open C.HomReasoning open MR C in proj₂ $ umors.!-unique₂ (R.F₀ X) {record { f = R.F₁ i }} (record { h = ε Y D.∘ L₁ (R.F₁ i) ; commute = begin R.F₁ (ε Y D.∘ L₁ (R.F₁ i)) C.∘ f (⊥Rd X) ≈⟨ R.homomorphism ⟩∘⟨refl ⟩ (R.F₁ (ε Y) C.∘ R.F₁ (L₁ (R.F₁ i))) C.∘ f (⊥Rd X) ≈⟨ pullʳ (commute (⊥X⇒⊥Y (R.F₁ i)) ○ C.identityʳ) ⟩ R.F₁ (ε Y) C.∘ f (⊥Rd Y) C.∘ R.F₁ i ≈⟨ cancelˡ (commute (⊥Rd⇒id Y) ○ C.identityˡ) ⟩ R.F₁ i ≈˘⟨ C.identityʳ ⟩ R.F₁ i C.∘ C.id ∎ }) (record { h = i D.∘ ε X ; commute = begin R.F₁ (i D.∘ ε X) C.∘ f (⊥Rd X) ≈⟨ R.homomorphism ⟩∘⟨refl ⟩ (R.F₁ i C.∘ R.F₁ (ε X)) C.∘ f (⊥Rd X) ≈⟨ cancelʳ (commute (⊥Rd⇒id X) ○ C.identityˡ) ⟩ R.F₁ i ≈˘⟨ C.identityʳ ⟩ R.F₁ i C.∘ C.id ∎ }) } ; zig = λ {c} → let open C.HomReasoning open MR C α = f (umors.⊥ c) in proj₂ $ umors.!-unique₂ c {record { f = α }} (record { h = ε (L₀ c) D.∘ L₁ α ; commute = begin R.F₁ (ε (L₀ c) D.∘ L₁ α) C.∘ α ≈⟨ R.homomorphism ⟩∘⟨refl ⟩ (R.F₁ (ε (L₀ c)) C.∘ R.F₁ (L₁ α)) C.∘ α ≈⟨ pullʳ (commute (⊥X⇒⊥Y α) ○ C.identityʳ) ⟩ R.F₁ (ε (L₀ c)) C.∘ f (⊥Rd (L₀ c)) C.∘ α ≈⟨ cancelˡ (commute (⊥Rd⇒id (L₀ c)) ○ C.identityˡ) ⟩ α ≈˘⟨ C.identityʳ ⟩ α C.∘ C.id ∎ }) (record { h = D.id ; commute = C.∘-resp-≈ˡ R.identity ○ id-comm-sym }) ; zag = λ {d} → C.Equiv.trans (commute (⊥Rd⇒id d)) C.identityˡ } where module umors X = UniversalMorphism (umors X) open CommaObj open Comma⇒ commaObj∘g : ∀ {X Y} → X C.⇒ Y → CommaObj (const! X) R commaObj∘g {X} {Y} g = record { f = f (umors.⊥ Y) C.∘ g } ⊥X⇒⊥Y : ∀ {X Y} (g : X C.⇒ Y) → (X ↙ R) [ umors.⊥ X , commaObj∘g g ] ⊥X⇒⊥Y {X} {Y} g = umors.! X {commaObj∘g g} L₀ : ∀ X → D.Obj L₀ X = β (umors.⊥ X) L₁ : ∀ {X Y} → X C.⇒ Y → β (umors.⊥ X) D.⇒ β (umors.⊥ Y) L₁ {X} {Y} g = h (⊥X⇒⊥Y g) L : Functor C D L = record { F₀ = L₀ ; F₁ = L₁ ; identity = λ {X} → proj₂ $ umors.!-unique X $ record { commute = elimˡ R.identity ○ ⟺ C.identityʳ ○ ⟺ C.identityʳ } ; homomorphism = λ {X Y Z} {i j} → proj₂ $ umors.!-unique₂ X (umors.! X) $ record { commute = begin R.F₁ (h (umors.! Y) D.∘ h (umors.! X)) C.∘ f (umors.⊥ X) ≈⟨ (C.∘-resp-≈ˡ R.homomorphism) ○ C.assoc ⟩ R.F₁ (h (umors.! Y)) C.∘ R.F₁ (h (umors.! X)) C.∘ f (umors.⊥ X) ≈⟨ (C.∘-resp-≈ʳ (commute (⊥X⇒⊥Y i) ○ C.identityʳ)) ○ C.sym-assoc ⟩ (R.F₁ (h (umors.! Y)) C.∘ f (umors.⊥ Y)) C.∘ i ≈⟨ pushˡ (commute (⊥X⇒⊥Y j) ○ C.identityʳ) ⟩ f (umors.⊥ Z) C.∘ j C.∘ i ≈˘⟨ C.identityʳ ⟩ (f (umors.⊥ Z) C.∘ j C.∘ i) C.∘ C.id ∎ } ; F-resp-≈ = λ {X} eq → proj₂ $ umors.!-unique₂ X (umors.! X) $ record { commute = commute (umors.! X) ○ C.∘-resp-≈ˡ (C.∘-resp-≈ʳ (⟺ eq)) } } where open C.HomReasoning open MR C module L = Functor L ⊥Rd : (d : D.Obj) → CommaObj (const! (R.F₀ d)) R ⊥Rd d = umors.⊥ (R.F₀ d) ⊥Rd⇒id : (d : D.Obj) → (R.F₀ d ↙ R) [ ⊥Rd d , record { f = C.id } ] ⊥Rd⇒id d = umors.! (R.F₀ d) {record { f = C.id }} ε : ∀ d → L₀ (R.F₀ d) D.⇒ d ε d = h (⊥Rd⇒id d) -- adjoint functors of a functor are isomorphic module _ (L : Functor C D) where open YP C R≃R′ : ∀ {R R′} → L ⊣ R → L ⊣ R′ → R ≃ R′ R≃R′ {R} {R′} L⊣R L⊣R′ = yoneda-NI R R′ (unlift-≃ Hom[-,R-]≃Hom[-,R′-]) where module ⊣₁ = Adjoint L⊣R module ⊣₂ = Adjoint L⊣R′ Hom[-,R-]≃Hom[-,R′-] : ⊣₁.Hom[-,R-]′ ≃ ⊣₂.Hom[-,R-]′ Hom[-,R-]≃Hom[-,R′-] = ≃.trans (≃.sym ⊣₁.Hom-NI) ⊣₂.Hom-NI module _ {R : Functor D C} where L≃L′ : ∀ {L L′} → L ⊣ R → L′ ⊣ R → L ≃ L′ L≃L′ L⊣R L′⊣R = NaturalIsomorphism.op L′≃Lᵒᵖ where module ⊣₁ = Adjoint L⊣R module ⊣₂ = Adjoint L′⊣R L′≃Lᵒᵖ = R≃R′ (Functor.op R) ⊣₂.op ⊣₁.op -- adjoint functors are preserved by natural isomorphisms module _ {L L′ : Functor C D} {R R′ : Functor D C} where private module C = Category C module D = Category D module L = Functor L module L′ = Functor L′ module R = Functor R module R′ = Functor R′ ⊣×≃⇒⊣ : L ⊣ R → L ≃ L′ → R ≃ R′ → L′ ⊣ R′ ⊣×≃⇒⊣ L⊣R L≃L′ R≃R′ = Hom-NI′⇒Adjoint (≃.trans (LiftSetoids _ _ ⓘˡ Hom[L′-,-]≃Hom[L-,-]) (≃.trans Hom-NI (LiftSetoids _ _ ⓘˡ Hom[-,R-]≃Hom[-,R′-]))) where open Adjoint L⊣R Hom[L′-,-]≃Hom[L-,-] : Hom[ D ][-,-] ∘F (L′.op ⁂ idF) ≃ Hom[ D ][-,-] ∘F (L.op ⁂ idF) Hom[L′-,-]≃Hom[L-,-] = Hom[ D ][-,-] ⓘˡ (NaturalIsomorphism.op L≃L′ ⁂ⁿⁱ ≃.refl) Hom[-,R-]≃Hom[-,R′-] : Hom[ C ][-,-] ∘F (idF ⁂ R) ≃ Hom[ C ][-,-] ∘F (idF ⁂ R′) Hom[-,R-]≃Hom[-,R′-] = Hom[ C ][-,-] ⓘˡ (≃.refl ⁂ⁿⁱ R≃R′)
Basic/Compiler/SplitCode.agda
AndrasKovacs/SemanticsWithApplications
8
9118
<filename>Basic/Compiler/SplitCode.agda module Basic.Compiler.SplitCode where open import Basic.Compiler.Code open import Basic.AST open import Basic.BigStep open import Utils.Monoid open import Data.Vec hiding (_++_; [_]; _∷ʳ_) open import Data.Bool renaming (if_then_else_ to ifBool_then_else_) open import Data.Nat open import Data.List hiding ([_]) open import Relation.Binary.PropositionalEquality open import Function open import Data.Product open import Algebra import Level as L private module LM {a}{A : Set a} = Algebra.Monoid (Data.List.monoid A) {- Exercise 3.5 This code logically belongs to either Compiler.Code or Compiler.CorrectFrom. It has its own module solely because it slows down typechecking for the module it's in, which is rather annoying. -} ▷*-split : ∀ {n}{s s' : State n}{e e'} c₁ {c₂} → (p : ⟨ c₁ <> c₂ , e , s ⟩▷*⟨ [] , e' , s' ⟩) → ∃₂ λ s'' e'' → ∃₂ λ (p1 : ⟨ c₁ , e , s ⟩▷*⟨ [] , e'' , s'' ⟩) (p2 : ⟨ c₂ , e'' , s'' ⟩▷*⟨ [] , e' , s' ⟩) → ▷*-length p1 + ▷*-length p2 ≡ ▷*-length p ▷*-split [] p = _ , _ , done , p , refl ▷*-split (.ADD ∷ cs) (ADD a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , ADD a b ∷ p1 , p2 , cong suc eqn ▷*-split (.MUL ∷ cs) (MUL a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , MUL a b ∷ p1 , p2 , cong suc eqn ▷*-split (.SUB ∷ cs) (SUB a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , SUB a b ∷ p1 , p2 , cong suc eqn ▷*-split (.EQ ∷ cs) (EQ a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , EQ a b ∷ p1 , p2 , cong suc eqn ▷*-split (.LT ∷ cs) (LT a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , LT a b ∷ p1 , p2 , cong suc eqn ▷*-split (.LTE ∷ cs) (LTE a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , LTE a b ∷ p1 , p2 , cong suc eqn ▷*-split (.AND ∷ cs) (AND a b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , AND a b ∷ p1 , p2 , cong suc eqn ▷*-split (.(PUSH n₁) ∷ cs) (PUSH n₁ ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , PUSH n₁ ∷ p1 , p2 , cong suc eqn ▷*-split (.TRUE ∷ cs) (TRUE ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , TRUE ∷ p1 , p2 , cong suc eqn ▷*-split (.FALSE ∷ cs) (FALSE ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , FALSE ∷ p1 , p2 , cong suc eqn ▷*-split (.NOT ∷ cs) (NOT b ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , NOT b ∷ p1 , p2 , cong suc eqn ▷*-split (.(FETCH x) ∷ cs) (FETCH x ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , FETCH x ∷ p1 , p2 , cong suc eqn ▷*-split (.(STORE x) ∷ cs) (STORE x ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , STORE x ∷ p1 , p2 , cong suc eqn ▷*-split (.NOOP ∷ cs) (NOOP ∷ p) with ▷*-split cs p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , NOOP ∷ p1 , p2 , cong suc eqn ▷*-split (._ ∷ cs){c₂} (BRANCH{ca}{cb}{._}{t}{e} ∷ p) rewrite sym $ LM.assoc (ifBool t then ca else cb) cs c₂ with ▷*-split ((ifBool t then ca else cb) <> cs) p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , BRANCH ∷ p1 , p2 , cong suc eqn ▷*-split (._ ∷ cs){c₁} (LOOP{ca}{cb}{._}{e}{s} ∷ p) rewrite sym $ LM.assoc ca (BRANCH (cb ∷ʳ LOOP ca cb) (NOOP ∷ []) ∷ cs) c₁ with ▷*-split (ca <> (BRANCH (cb ∷ʳ LOOP ca cb) (NOOP ∷ []) ∷ cs)) p ... | s'' , e'' , p1 , p2 , eqn = s'' , e'' , LOOP ∷ p1 , p2 , cong suc eqn
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/ys_w68.asm
prismotizm/gigaleak
0
166626
<reponame>prismotizm/gigaleak Name: ys_w68.asm Type: file Size: 32678 Last-Modified: '2016-05-13T04:50:34Z' SHA-1: AE634EEB4D20512603B1EAB82A46F2FC3BC6E886 Description: null
programs/oeis/327/A327021.asm
neoneye/loda
22
172765
<reponame>neoneye/loda ; A327021: a(n) = (2*n-1)! / 2^(n-1) if n > 0 and a(0) = 1. ; 1,1,3,30,630,22680,1247400,97297200,10216206000,1389404016000,237588086736000,49893498214560000,12623055048283680000,3786916514485104000000,1329207696584271504000000,539658324813214230624000000,250941121038144617240160000000,132496911908140357902804480000000 mul $0,2 trn $0,1 seq $0,90932 ; a(n) = n! / 2^floor(n/2).
oeis/112/A112469.asm
neoneye/loda-programs
11
20875
; A112469: Partial sums of (-1)^n*F(n-1). ; Submitted by <NAME> ; 1,1,2,1,3,0,5,-3,10,-11,23,-32,57,-87,146,-231,379,-608,989,-1595,2586,-4179,6767,-10944,17713,-28655,46370,-75023,121395,-196416,317813,-514227,832042,-1346267,2178311,-3524576,5702889,-9227463,14930354,-24157815,39088171,-63245984,102334157,-165580139,267914298,-433494435,701408735,-1134903168,1836311905,-2971215071,4807526978,-7778742047,12586269027,-20365011072,32951280101,-53316291171,86267571274,-139583862443,225851433719,-365435296160,591286729881,-956722026039,1548008755922 mov $2,1 lpb $0 sub $0,1 mov $1,2 add $1,$3 sub $1,$2 mov $3,$2 mov $2,$1 lpe mov $0,$2
src/model/hyperion-agents-models.adb
stcarrez/hyperion
0
27679
----------------------------------------------------------------------- -- Hyperion.Agents.Models -- Hyperion.Agents.Models ----------------------------------------------------------------------- -- File generated by ada-gen DO NOT MODIFY -- Template used: templates/model/package-body.xhtml -- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095 ----------------------------------------------------------------------- -- Copyright (C) 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; with Util.Beans.Objects.Time; package body Hyperion.Agents.Models is use type ADO.Objects.Object_Record_Access; use type ADO.Objects.Object_Ref; pragma Warnings (Off, "formal parameter * is not referenced"); function Agent_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => AGENT_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Agent_Key; function Agent_Key (Id : in String) return ADO.Objects.Object_Key is Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER, Of_Class => AGENT_DEF'Access); begin ADO.Objects.Set_Value (Result, Id); return Result; end Agent_Key; function "=" (Left, Right : Agent_Ref'Class) return Boolean is begin return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right); end "="; procedure Set_Field (Object : in out Agent_Ref'Class; Impl : out Agent_Access) is Result : ADO.Objects.Object_Record_Access; begin Object.Prepare_Modify (Result); Impl := Agent_Impl (Result.all)'Access; end Set_Field; -- Internal method to allocate the Object_Record instance procedure Allocate (Object : in out Agent_Ref) is Impl : Agent_Access; begin Impl := new Agent_Impl; Impl.Create_Date := ADO.DEFAULT_TIME; ADO.Objects.Set_Object (Object, Impl.all'Access); end Allocate; -- ---------------------------------------- -- Data object: Agent -- ---------------------------------------- procedure Set_Id (Object : in out Agent_Ref; Value : in ADO.Identifier) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value); end Set_Id; function Get_Id (Object : in Agent_Ref) return ADO.Identifier is Impl : constant Agent_Access := Agent_Impl (Object.Get_Object.all)'Access; begin return Impl.Get_Key_Value; end Get_Id; procedure Set_Hostname (Object : in out Agent_Ref; Value : in String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Hostname, Value); end Set_Hostname; procedure Set_Hostname (Object : in out Agent_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Hostname, Value); end Set_Hostname; function Get_Hostname (Object : in Agent_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Hostname); end Get_Hostname; function Get_Hostname (Object : in Agent_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Agent_Access := Agent_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Hostname; end Get_Hostname; procedure Set_Ip (Object : in out Agent_Ref; Value : in String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Ip, Value); end Set_Ip; procedure Set_Ip (Object : in out Agent_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 3, Impl.Ip, Value); end Set_Ip; function Get_Ip (Object : in Agent_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Ip); end Get_Ip; function Get_Ip (Object : in Agent_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Agent_Access := Agent_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Ip; end Get_Ip; procedure Set_Key (Object : in out Agent_Ref; Value : in String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_String (Impl.all, 4, Impl.Key, Value); end Set_Key; procedure Set_Key (Object : in out Agent_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Unbounded_String (Impl.all, 4, Impl.Key, Value); end Set_Key; function Get_Key (Object : in Agent_Ref) return String is begin return Ada.Strings.Unbounded.To_String (Object.Get_Key); end Get_Key; function Get_Key (Object : in Agent_Ref) return Ada.Strings.Unbounded.Unbounded_String is Impl : constant Agent_Access := Agent_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Key; end Get_Key; procedure Set_Create_Date (Object : in out Agent_Ref; Value : in Ada.Calendar.Time) is Impl : Agent_Access; begin Set_Field (Object, Impl); ADO.Objects.Set_Field_Time (Impl.all, 5, Impl.Create_Date, Value); end Set_Create_Date; function Get_Create_Date (Object : in Agent_Ref) return Ada.Calendar.Time is Impl : constant Agent_Access := Agent_Impl (Object.Get_Load_Object.all)'Access; begin return Impl.Create_Date; end Get_Create_Date; -- Copy of the object. procedure Copy (Object : in Agent_Ref; Into : in out Agent_Ref) is Result : Agent_Ref; begin if not Object.Is_Null then declare Impl : constant Agent_Access := Agent_Impl (Object.Get_Load_Object.all)'Access; Copy : constant Agent_Access := new Agent_Impl; begin ADO.Objects.Set_Object (Result, Copy.all'Access); Copy.Copy (Impl.all); Copy.Hostname := Impl.Hostname; Copy.Ip := Impl.Ip; Copy.Key := Impl.Key; Copy.Create_Date := Impl.Create_Date; end; end if; Into := Result; end Copy; procedure Find (Object : in out Agent_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Impl : constant Agent_Access := new Agent_Impl; begin Impl.Find (Session, Query, Found); if Found then ADO.Objects.Set_Object (Object, Impl.all'Access); else ADO.Objects.Set_Object (Object, null); Destroy (Impl); end if; end Find; procedure Load (Object : in out Agent_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier) is Impl : constant Agent_Access := new Agent_Impl; Found : Boolean; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); raise ADO.Objects.NOT_FOUND; end if; ADO.Objects.Set_Object (Object, Impl.all'Access); end Load; procedure Load (Object : in out Agent_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean) is Impl : constant Agent_Access := new Agent_Impl; Query : ADO.SQL.Query; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Impl.Find (Session, Query, Found); if not Found then Destroy (Impl); else ADO.Objects.Set_Object (Object, Impl.all'Access); end if; end Load; procedure Save (Object : in out Agent_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl = null then Impl := new Agent_Impl; ADO.Objects.Set_Object (Object, Impl); end if; if not ADO.Objects.Is_Created (Impl.all) then Impl.Create (Session); else Impl.Save (Session); end if; end Save; procedure Delete (Object : in out Agent_Ref; Session : in out ADO.Sessions.Master_Session'Class) is Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object; begin if Impl /= null then Impl.Delete (Session); end if; end Delete; -- -------------------- -- Free the object -- -------------------- procedure Destroy (Object : access Agent_Impl) is type Agent_Impl_Ptr is access all Agent_Impl; procedure Unchecked_Free is new Ada.Unchecked_Deallocation (Agent_Impl, Agent_Impl_Ptr); pragma Warnings (Off, "*redundant conversion*"); Ptr : Agent_Impl_Ptr := Agent_Impl (Object.all)'Access; pragma Warnings (On, "*redundant conversion*"); begin Unchecked_Free (Ptr); end Destroy; procedure Find (Object : in out Agent_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean) is Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query, AGENT_DEF'Access); begin Stmt.Execute; if Stmt.Has_Elements then Object.Load (Stmt, Session); Stmt.Next; Found := not Stmt.Has_Elements; else Found := False; end if; end Find; overriding procedure Load (Object : in out Agent_Impl; Session : in out ADO.Sessions.Session'Class) is Found : Boolean; Query : ADO.SQL.Query; Id : constant ADO.Identifier := Object.Get_Key_Value; begin Query.Bind_Param (Position => 1, Value => Id); Query.Set_Filter ("id = ?"); Object.Find (Session, Query, Found); if not Found then raise ADO.Objects.NOT_FOUND; end if; end Load; procedure Save (Object : in out Agent_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Update_Statement := Session.Create_Statement (AGENT_DEF'Access); begin if Object.Is_Modified (1) then Stmt.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Object.Clear_Modified (1); end if; if Object.Is_Modified (2) then Stmt.Save_Field (Name => COL_1_1_NAME, -- hostname Value => Object.Hostname); Object.Clear_Modified (2); end if; if Object.Is_Modified (3) then Stmt.Save_Field (Name => COL_2_1_NAME, -- ip Value => Object.Ip); Object.Clear_Modified (3); end if; if Object.Is_Modified (4) then Stmt.Save_Field (Name => COL_3_1_NAME, -- key Value => Object.Key); Object.Clear_Modified (4); end if; if Object.Is_Modified (5) then Stmt.Save_Field (Name => COL_4_1_NAME, -- create_date Value => Object.Create_Date); Object.Clear_Modified (5); end if; if Stmt.Has_Save_Fields then Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); declare Result : Integer; begin Stmt.Execute (Result); if Result /= 1 then if Result /= 0 then raise ADO.Objects.UPDATE_ERROR; end if; end if; end; end if; end Save; procedure Create (Object : in out Agent_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Query : ADO.Statements.Insert_Statement := Session.Create_Statement (AGENT_DEF'Access); Result : Integer; begin Session.Allocate (Id => Object); Query.Save_Field (Name => COL_0_1_NAME, -- id Value => Object.Get_Key); Query.Save_Field (Name => COL_1_1_NAME, -- hostname Value => Object.Hostname); Query.Save_Field (Name => COL_2_1_NAME, -- ip Value => Object.Ip); Query.Save_Field (Name => COL_3_1_NAME, -- key Value => Object.Key); Query.Save_Field (Name => COL_4_1_NAME, -- create_date Value => Object.Create_Date); Query.Execute (Result); if Result /= 1 then raise ADO.Objects.INSERT_ERROR; end if; ADO.Objects.Set_Created (Object); end Create; procedure Delete (Object : in out Agent_Impl; Session : in out ADO.Sessions.Master_Session'Class) is Stmt : ADO.Statements.Delete_Statement := Session.Create_Statement (AGENT_DEF'Access); begin Stmt.Set_Filter (Filter => "id = ?"); Stmt.Add_Param (Value => Object.Get_Key); Stmt.Execute; end Delete; -- ------------------------------ -- Get the bean attribute identified by the name. -- ------------------------------ overriding function Get_Value (From : in Agent_Ref; Name : in String) return Util.Beans.Objects.Object is Obj : ADO.Objects.Object_Record_Access; Impl : access Agent_Impl; begin if From.Is_Null then return Util.Beans.Objects.Null_Object; end if; Obj := From.Get_Load_Object; Impl := Agent_Impl (Obj.all)'Access; if Name = "id" then return ADO.Objects.To_Object (Impl.Get_Key); elsif Name = "hostname" then return Util.Beans.Objects.To_Object (Impl.Hostname); elsif Name = "ip" then return Util.Beans.Objects.To_Object (Impl.Ip); elsif Name = "key" then return Util.Beans.Objects.To_Object (Impl.Key); elsif Name = "create_date" then return Util.Beans.Objects.Time.To_Object (Impl.Create_Date); end if; return Util.Beans.Objects.Null_Object; end Get_Value; -- ------------------------------ -- Load the object from current iterator position -- ------------------------------ procedure Load (Object : in out Agent_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class) is pragma Unreferenced (Session); begin Object.Set_Key_Value (Stmt.Get_Identifier (0)); Object.Hostname := Stmt.Get_Unbounded_String (1); Object.Ip := Stmt.Get_Unbounded_String (2); Object.Key := Stmt.Get_Unbounded_String (3); Object.Create_Date := Stmt.Get_Time (4); ADO.Objects.Set_Created (Object); end Load; end Hyperion.Agents.Models;
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sf2/gstrats.asm
prismotizm/gigaleak
0
3447
<filename>other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sf2/gstrats.asm Name: gstrats.asm Type: file Size: 64594 Last-Modified: '1993-03-02T01:40:45Z' SHA-1: B2A3B073772FE79BB67EDC8C57CDCBE18871D7BE Description: null
Commands/Miscellaneous Commands suite/system info/user ID of (get system info).applescript
looking-for-a-job/applescript-examples
1
3848
#!/usr/bin/osascript user ID of (get system info)
source/tasking/machine-pc-linux-gnu/s-intnum.ads
ytomino/drake
33
29717
pragma License (Unrestricted); -- implementation unit specialized for Linux with C.signal; package System.Interrupt_Numbers is pragma Preelaborate; First_Interrupt_Id : constant := C.signal.SIGHUP; Last_Interrupt_Id : constant := C.signal.NSIG - 1; -- SIGRTMAX (__libc_current_sigrtmax) = NSIG - 1 = 64 function Is_Reserved (Interrupt : C.signed_int) return Boolean; end System.Interrupt_Numbers;
oeis/305/A305153.asm
neoneye/loda-programs
11
242554
<reponame>neoneye/loda-programs ; A305153: a(n) = 30*2^n + 12. ; 42,72,132,252,492,972,1932,3852,7692,15372,30732,61452,122892,245772,491532,983052,1966092,3932172,7864332,15728652,31457292,62914572,125829132,251658252,503316492,1006632972,2013265932,4026531852,8053063692,16106127372,32212254732,64424509452,128849018892,257698037772,515396075532,1030792151052,2061584302092,4123168604172,8246337208332,16492674416652,32985348833292,65970697666572,131941395333132,263882790666252,527765581332492,1055531162664972,2111062325329932,4222124650659852,8444249301319692 mov $1,2 pow $1,$0 sub $1,1 mul $1,30 add $1,42 mov $0,$1
libsrc/stdio_new/file/stream-out/stdio_outbuff.asm
andydansby/z88dk-mk2
1
1819
; stdio_outbuff ; 05.2008 aralbrec XLIB stdio_outbuff LIB stdio_outchar ; output string of chars to file / device from temporary buffer ; ; enter : b = number of chars from buffer to output ; hl = & buffer - 1 ; ix = & attached file / device output function ; exit : carry set if error on stream, ERRNO set appropriately ; uses : af, b, hl, exx .stdio_outbuff ld a,b or a ret z .loop inc hl ld a,(hl) call stdio_outchar ret c djnz loop ret
Map.asm
sleepingburrito/BackIsle
1
1703
SECTION "MAIN", ROM0[$0150] ;fill in non read only map regs for args LoadMap: PushAllRegs call FadeDisplayOff OAMCopyMacro call LoadTileMapBg call FadeDisplayOn PopAllRegs ret ;finds starting of tile map in rom of mapX/map ;returns in mapTileMapStart ;clobbers A TileMapStartOffset: push HL push BC ;set map starting point ld HL, ROM_BANK_START ;set y setup ld A, [mapY] CCTZ jp z, .SetX ld BC, TOTAL_MAP_WIDTH_TILES * MAP_HEIGHT_SCREEN_TILES ;move one map down worth of tiles ;set y math .loopY add HL, BC dec A jp nz, .loopY .SetX ld A, [mapX] CCTZ jp z, .exit ld B, 0 ld C, MAP_WIDTH_SCREEN_TILES .loopX add HL, BC dec A jp nz, .loopX .exit SetR16Pointer H, L, mapTileMapStart pop BC pop HL ret
programs/oeis/212/A212971.asm
karttu/loda
0
25017
<filename>programs/oeis/212/A212971.asm<gh_stars>0 ; A212971: Number of (w,x,y) with all terms in {0,...,n} and w<floor((x+y)/3)). ; 0,0,3,11,25,48,82,128,189,267,363,480,620,784,975,1195,1445,1728,2046,2400,2793,3227,3703,4224,4792,5408,6075,6795,7569,8400,9290,10240,11253,12331,13475,14688,15972,17328,18759,20267,21853,23520 mov $2,$0 lpb $2,1 add $3,$2 add $1,$3 sub $1,$0 trn $0,3 sub $2,1 lpe
source/hash/a-cmuha3.adb
ytomino/drake
33
30832
<reponame>ytomino/drake package body Ada.Containers.Murmur_Hash_3 is -- use MurmurHash3_x86_32 procedure Step (h1 : in out Hash_Type; Item : Hash_Type); procedure Step (h1 : in out Hash_Type; Item : Hash_Type) is c1 : constant := 16#cc9e2d51#; c2 : constant := 16#1b873593#; k1 : Hash_Type := Item; begin k1 := k1 * c1; k1 := Rotate_Left (k1, 15); k1 := k1 * c2; h1 := h1 xor k1; end Step; -- implementation function Initialize (Initiator : Hash_Type) return State is begin return (h1 => Initiator, len => 0); end Initialize; procedure Update (S : in out State; Item : Hash_Type) is begin Step (S.h1, Item); S.h1 := Rotate_Left (S.h1, 13); S.h1 := S.h1 * 5 + 16#e6546b64#; S.len := S.len + 4; end Update; procedure Update (S : in out State; Item : Hash_8) is begin Step (S.h1, Hash_Type'Mod (Item)); S.len := S.len + 1; end Update; procedure Update (S : in out State; Item : Hash_16) is begin Step (S.h1, Hash_Type'Mod (Item)); S.len := S.len + 2; end Update; procedure Update (S : in out State; Item : Hash_24) is begin Step (S.h1, Hash_Type'Mod (Item)); S.len := S.len + 3; end Update; procedure Finalize (S : State; Digest : out Hash_Type) is begin Digest := S.h1 xor Hash_Type'Mod (S.len); Digest := Digest xor Shift_Right (Digest, 16); Digest := Digest * 16#85ebca6b#; Digest := Digest xor Shift_Right (Digest, 13); Digest := Digest * 16#c2b2ae35#; Digest := Digest xor Shift_Right (Digest, 16); end Finalize; end Ada.Containers.Murmur_Hash_3;
programs/oeis/256/A256595.asm
neoneye/loda
22
170436
; A256595: Triangle A074909(n) with 0's as second column. ; 1,1,0,1,0,3,1,0,6,4,1,0,10,10,5,1,0,15,20,15,6,1,0,21,35,35,21,7,1,0,28,56,70,56,28,8,1,0,36,84,126,126,84,36,9,1,0,45,120,210,252,210,120,45,10,1,0,55,165,330,462,462,330,165,55,11 lpb $0 mov $2,$0 sub $0,1 add $1,1 trn $0,$1 add $0,1 lpe bin $1,$2 mov $0,$1
_build/dispatcher/jmp_ippsGFpMul_d5d1d9bd.asm
zyktrcn/ippcp
1
23219
extern m7_ippsGFpMul:function extern n8_ippsGFpMul:function extern y8_ippsGFpMul:function extern e9_ippsGFpMul:function extern l9_ippsGFpMul:function extern n0_ippsGFpMul:function extern k0_ippsGFpMul:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpMul .Larraddr_ippsGFpMul: dq m7_ippsGFpMul dq n8_ippsGFpMul dq y8_ippsGFpMul dq e9_ippsGFpMul dq l9_ippsGFpMul dq n0_ippsGFpMul dq k0_ippsGFpMul segment .text global ippsGFpMul:function (ippsGFpMul.LEndippsGFpMul - ippsGFpMul) .Lin_ippsGFpMul: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpMul: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpMul] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpMul:
src/extraction-renamings.adb
TNO/Dependency_Graph_Extractor-Ada
0
24093
<filename>src/extraction-renamings.adb<gh_stars>0 with Extraction.Node_Edge_Types; with Extraction.Utilities; package body Extraction.Renamings is use type LALCO.Ada_Node_Kind_Type; function Is_Renaming (Node : LAL.Ada_Node'Class) return Boolean; function Is_Renaming (Node : LAL.Ada_Node'Class) return Boolean is begin return Node.Kind in LALCO.Ada_Package_Renaming_Decl | LALCO.Ada_Generic_Package_Renaming_Decl | LALCO.Ada_Subp_Renaming_Decl | LALCO.Ada_Generic_Subp_Renaming_Decl or else (Node.Kind = LALCO.Ada_Exception_Decl and then not Node.As_Exception_Decl.F_Renames.Is_Null) or else (Node.Kind = LALCO.Ada_Object_Decl and then not Node.As_Object_Decl.F_Renaming_Clause.Is_Null); end Is_Renaming; function Get_Renamed_Name (Basic_Decl : LAL.Basic_Decl'Class) return LAL.Name; function Get_Renamed_Name (Basic_Decl : LAL.Basic_Decl'Class) return LAL.Name is begin case LALCO.Ada_Basic_Decl (Basic_Decl.Kind) is when LALCO.Ada_Package_Renaming_Decl => return Basic_Decl.As_Package_Renaming_Decl.F_Renames.F_Renamed_Object; when LALCO.Ada_Generic_Package_Renaming_Decl => return Basic_Decl.As_Generic_Package_Renaming_Decl.F_Renames; when LALCO.Ada_Subp_Renaming_Decl => return Basic_Decl.As_Subp_Renaming_Decl.F_Renames.F_Renamed_Object; when LALCO.Ada_Generic_Subp_Renaming_Decl => return Basic_Decl.As_Generic_Subp_Renaming_Decl.F_Renames; when LALCO.Ada_Exception_Decl => return Basic_Decl.As_Exception_Decl.F_Renames.F_Renamed_Object; when LALCO.Ada_Object_Decl => return Basic_Decl.As_Object_Decl.F_Renaming_Clause.F_Renamed_Object; when others => raise Internal_Extraction_Error with "Cases in Is_Renaming and Get_Renamed_Name do not match"; end case; end Get_Renamed_Name; procedure Extract_Edges (Node : LAL.Ada_Node'Class; Graph : Graph_Operations.Graph_Context) is begin if Utilities.Is_Relevant_Basic_Decl (Node) and then Is_Renaming (Node) and then not Utilities.Get_Referenced_Decl (Get_Renamed_Name (Node.As_Basic_Decl)) .Is_Null -- Ignore builtins. then declare Renaming_Decl : constant LAL.Basic_Decl := Node.As_Basic_Decl; Renamed_Name : constant LAL.Defining_Name := Utilities.Get_Referenced_Defining_Name (Get_Renamed_Name (Renaming_Decl)); Renamed_Decl : constant LAL.Basic_Decl := Utilities.Get_Referenced_Decl (Get_Renamed_Name (Renaming_Decl)); begin Graph.Write_Edge (Renaming_Decl, Renamed_Name, Renamed_Decl, Node_Edge_Types.Edge_Type_Renames); end; end if; end Extract_Edges; end Extraction.Renamings;
agda-stdlib/src/Algebra/Module/Bundles.agda
DreamLinuxer/popl21-artifact
5
16398
<filename>agda-stdlib/src/Algebra/Module/Bundles.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Definitions of algebraic structures defined over some other -- structure, like modules and vector spaces -- -- Terminology of bundles: -- * There are both *semimodules* and *modules*. -- - For M an R-semimodule, R is a semiring, and M forms a commutative -- monoid. -- - For M an R-module, R is a ring, and M forms an Abelian group. -- * There are all four of *left modules*, *right modules*, *bimodules*, -- and *modules*. -- - Left modules have a left-scaling operation. -- - Right modules have a right-scaling operation. -- - Bimodules have two sorts of scalars. Left-scaling handles one and -- right-scaling handles the other. Left-scaling and right-scaling -- are furthermore compatible. -- - Modules are bimodules with a single sort of scalars and scalar -- multiplication must also be commutative. Left-scaling and -- right-scaling coincide. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Algebra.Module.Bundles where open import Algebra.Bundles open import Algebra.Core open import Algebra.Module.Structures open import Algebra.Module.Definitions open import Function.Base open import Level open import Relation.Binary import Relation.Binary.Reasoning.Setoid as SetR private variable r ℓr s ℓs : Level ------------------------------------------------------------------------ -- Left modules ------------------------------------------------------------------------ record LeftSemimodule (semiring : Semiring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open Semiring semiring infixr 7 _*ₗ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ Carrier Carrierᴹ 0ᴹ : Carrierᴹ isLeftSemimodule : IsLeftSemimodule semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_ open IsLeftSemimodule isLeftSemimodule public +ᴹ-commutativeMonoid : CommutativeMonoid m ℓm +ᴹ-commutativeMonoid = record { isCommutativeMonoid = +ᴹ-isCommutativeMonoid } open CommutativeMonoid +ᴹ-commutativeMonoid public using () renaming ( monoid to +ᴹ-monoid ; semigroup to +ᴹ-semigroup ; magma to +ᴹ-magma ; rawMagma to +ᴹ-rawMagma ; rawMonoid to +ᴹ-rawMonoid ) record LeftModule (ring : Ring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open Ring ring infixr 8 -ᴹ_ infixr 7 _*ₗ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ Carrier Carrierᴹ 0ᴹ : Carrierᴹ -ᴹ_ : Op₁ Carrierᴹ isLeftModule : IsLeftModule ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ open IsLeftModule isLeftModule public leftSemimodule : LeftSemimodule semiring m ℓm leftSemimodule = record { isLeftSemimodule = isLeftSemimodule } open LeftSemimodule leftSemimodule public using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMagma; +ᴹ-rawMonoid) +ᴹ-abelianGroup : AbelianGroup m ℓm +ᴹ-abelianGroup = record { isAbelianGroup = +ᴹ-isAbelianGroup } open AbelianGroup +ᴹ-abelianGroup public using () renaming (group to +ᴹ-group) ------------------------------------------------------------------------ -- Right modules ------------------------------------------------------------------------ record RightSemimodule (semiring : Semiring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open Semiring semiring infixl 7 _*ᵣ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ᵣ_ : Opᵣ Carrier Carrierᴹ 0ᴹ : Carrierᴹ isRightSemimodule : IsRightSemimodule semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ᵣ_ open IsRightSemimodule isRightSemimodule public +ᴹ-commutativeMonoid : CommutativeMonoid m ℓm +ᴹ-commutativeMonoid = record { isCommutativeMonoid = +ᴹ-isCommutativeMonoid } open CommutativeMonoid +ᴹ-commutativeMonoid public using () renaming ( monoid to +ᴹ-monoid ; semigroup to +ᴹ-semigroup ; magma to +ᴹ-magma ; rawMagma to +ᴹ-rawMagma ; rawMonoid to +ᴹ-rawMonoid ) record RightModule (ring : Ring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open Ring ring infixr 8 -ᴹ_ infixl 7 _*ᵣ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ᵣ_ : Opᵣ Carrier Carrierᴹ 0ᴹ : Carrierᴹ -ᴹ_ : Op₁ Carrierᴹ isRightModule : IsRightModule ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ᵣ_ open IsRightModule isRightModule public rightSemimodule : RightSemimodule semiring m ℓm rightSemimodule = record { isRightSemimodule = isRightSemimodule } open RightSemimodule rightSemimodule public using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMagma; +ᴹ-rawMonoid) +ᴹ-abelianGroup : AbelianGroup m ℓm +ᴹ-abelianGroup = record { isAbelianGroup = +ᴹ-isAbelianGroup } open AbelianGroup +ᴹ-abelianGroup public using () renaming (group to +ᴹ-group) ------------------------------------------------------------------------ -- Bimodules ------------------------------------------------------------------------ record Bisemimodule (R-semiring : Semiring r ℓr) (S-semiring : Semiring s ℓs) m ℓm : Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where private module R = Semiring R-semiring module S = Semiring S-semiring infixr 7 _*ₗ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ R.Carrier Carrierᴹ _*ᵣ_ : Opᵣ S.Carrier Carrierᴹ 0ᴹ : Carrierᴹ isBisemimodule : IsBisemimodule R-semiring S-semiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_ _*ᵣ_ open IsBisemimodule isBisemimodule public leftSemimodule : LeftSemimodule R-semiring m ℓm leftSemimodule = record { isLeftSemimodule = isLeftSemimodule } rightSemimodule : RightSemimodule S-semiring m ℓm rightSemimodule = record { isRightSemimodule = isRightSemimodule } open LeftSemimodule leftSemimodule public using ( +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma ; +ᴹ-rawMonoid) record Bimodule (R-ring : Ring r ℓr) (S-ring : Ring s ℓs) m ℓm : Set (r ⊔ s ⊔ ℓr ⊔ ℓs ⊔ suc (m ⊔ ℓm)) where private module R = Ring R-ring module S = Ring S-ring infixr 7 _*ₗ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ R.Carrier Carrierᴹ _*ᵣ_ : Opᵣ S.Carrier Carrierᴹ 0ᴹ : Carrierᴹ -ᴹ_ : Op₁ Carrierᴹ isBimodule : IsBimodule R-ring S-ring _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_ open IsBimodule isBimodule public leftModule : LeftModule R-ring m ℓm leftModule = record { isLeftModule = isLeftModule } rightModule : RightModule S-ring m ℓm rightModule = record { isRightModule = isRightModule } open LeftModule leftModule public using ( +ᴹ-abelianGroup; +ᴹ-commutativeMonoid; +ᴹ-group; +ᴹ-monoid ; +ᴹ-semigroup; +ᴹ-magma; +ᴹ-rawMagma; +ᴹ-rawMonoid) bisemimodule : Bisemimodule R.semiring S.semiring m ℓm bisemimodule = record { isBisemimodule = isBisemimodule } open Bisemimodule bisemimodule public using (leftSemimodule; rightSemimodule) ------------------------------------------------------------------------ -- Modules over commutative structures ------------------------------------------------------------------------ record Semimodule (commutativeSemiring : CommutativeSemiring r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open CommutativeSemiring commutativeSemiring infixr 7 _*ₗ_ infixl 7 _*ᵣ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ Carrier Carrierᴹ _*ᵣ_ : Opᵣ Carrier Carrierᴹ 0ᴹ : Carrierᴹ isSemimodule : IsSemimodule commutativeSemiring _≈ᴹ_ _+ᴹ_ 0ᴹ _*ₗ_ _*ᵣ_ open IsSemimodule isSemimodule public private module L = LeftDefs Carrier _≈ᴹ_ module R = RightDefs Carrier _≈ᴹ_ bisemimodule : Bisemimodule semiring semiring m ℓm bisemimodule = record { isBisemimodule = isBisemimodule } open Bisemimodule bisemimodule public using ( leftSemimodule; rightSemimodule ; +ᴹ-commutativeMonoid; +ᴹ-monoid; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMagma; +ᴹ-rawMonoid) open SetR ≈ᴹ-setoid *ₗ-comm : L.Commutative _*ₗ_ *ₗ-comm x y m = begin x *ₗ y *ₗ m ≈⟨ ≈ᴹ-sym (*ₗ-assoc x y m) ⟩ (x * y) *ₗ m ≈⟨ *ₗ-cong (*-comm _ _) ≈ᴹ-refl ⟩ (y * x) *ₗ m ≈⟨ *ₗ-assoc y x m ⟩ y *ₗ x *ₗ m ∎ *ᵣ-comm : R.Commutative _*ᵣ_ *ᵣ-comm m x y = begin m *ᵣ x *ᵣ y ≈⟨ *ᵣ-assoc m x y ⟩ m *ᵣ (x * y) ≈⟨ *ᵣ-cong ≈ᴹ-refl (*-comm _ _) ⟩ m *ᵣ (y * x) ≈⟨ ≈ᴹ-sym (*ᵣ-assoc m y x) ⟩ m *ᵣ y *ᵣ x ∎ record Module (commutativeRing : CommutativeRing r ℓr) m ℓm : Set (r ⊔ ℓr ⊔ suc (m ⊔ ℓm)) where open CommutativeRing commutativeRing infixr 8 -ᴹ_ infixr 7 _*ₗ_ infixl 6 _+ᴹ_ infix 4 _≈ᴹ_ field Carrierᴹ : Set m _≈ᴹ_ : Rel Carrierᴹ ℓm _+ᴹ_ : Op₂ Carrierᴹ _*ₗ_ : Opₗ Carrier Carrierᴹ _*ᵣ_ : Opᵣ Carrier Carrierᴹ 0ᴹ : Carrierᴹ -ᴹ_ : Op₁ Carrierᴹ isModule : IsModule commutativeRing _≈ᴹ_ _+ᴹ_ 0ᴹ -ᴹ_ _*ₗ_ _*ᵣ_ open IsModule isModule public bimodule : Bimodule ring ring m ℓm bimodule = record { isBimodule = isBimodule } open Bimodule bimodule public using ( leftModule; rightModule; leftSemimodule; rightSemimodule ; +ᴹ-abelianGroup; +ᴹ-group; +ᴹ-commutativeMonoid; +ᴹ-monoid ; +ᴹ-semigroup; +ᴹ-magma ; +ᴹ-rawMonoid; +ᴹ-rawMagma) semimodule : Semimodule commutativeSemiring m ℓm semimodule = record { isSemimodule = isSemimodule } open Semimodule semimodule public using (*ₗ-comm; *ᵣ-comm)
dv3/qpc/hd/ckwp.asm
olifink/smsqe
0
29849
; DV3 QPC Hard Disk Check Write Protect V3.00  1993 <NAME> section dv3 xdef hd_ckwp include 'dev8_dv3_keys' include 'dev8_dv3_hd_keys' include 'dev8_smsq_qpc_keys' ;+++ ; Check write protect, density: does dothing ; ; ; a3 c p pointer to linkage block ; a4 c p pointer to drive definition ; ; all registers except d0 preserved ; ; status arbitrary ; ;--- hd_ckwp move.l a1,-(a7) lea -1(a3,d7.w),a1 tst.b hdl_wprt(a1) smi ddf_wprot(a4) ; set write protect bne.s hdwp_exit ; logical protection, do not check phys dc.w qpc.chkwp sne ddf_wprot(a4) hdwp_exit move.l (a7)+,a1 rts end
kv-avm-instances.ads
davidkristola/vole
4
28981
with Interfaces; with kv.avm.Executables; with kv.avm.Instructions; with kv.avm.Registers; with kv.avm.Actors; with kv.avm.Processors; with kv.avm.Frames; with kv.avm.Actor_References; with kv.avm.Actor_References.Sets; with kv.avm.Messages; with kv.avm.Tuples; with kv.avm.control; with kv.avm.Memories; package kv.avm.Instances is use Interfaces; use kv.avm.Messages; type Instance_Type is new kv.avm.Executables.Executable_Interface with private; type Instance_Access is access all Instance_Type; function "+"(RHS : Instance_Access) return kv.avm.Executables.Executable_Access; procedure Initialize (Self : access Instance_Type; Actor : in kv.avm.Actors.Actor_Access; Memory : in kv.avm.Memories.Memory_Type; Myself : in kv.avm.Actor_References.Actor_Reference_Type); -- Routine used in unit tests function Get_Frame(Self : Instance_Type) return kv.avm.Frames.Frame_Access; overriding procedure Process_Message (Self : in out Instance_Type; Message : in kv.avm.Messages.Message_Type); overriding procedure Process_Gosub (Self : access Instance_Type; Tailcall : in Boolean; Supercall : in Boolean; Reply_To : in kv.avm.Actor_References.Actor_Reference_Type; Method : in kv.avm.Registers.String_Type; Data : access constant kv.avm.Memories.Register_Set_Type; Future : in Interfaces.Unsigned_32); overriding function Can_Accept_Message_Now(Self : Instance_Type; Message : kv.avm.Messages.Message_Type) return Boolean; overriding function Program_Counter (Self : in Instance_Type) return Interfaces.Unsigned_32; overriding function Is_Running (Self : in Instance_Type) return Boolean; overriding procedure Step (Self : access Instance_Type; Processor : access kv.avm.Processors.Processor_Type; Status : out kv.avm.Control.Status_Type); overriding procedure Process_Internal_Response (Self : in out Instance_Type; Answer : in kv.avm.Tuples.Tuple_Type); overriding procedure Resolve_Future (Self : in out Instance_Type; Answer : in kv.avm.Tuples.Tuple_Type; Future : in Interfaces.Unsigned_32); function Alive(Self : Instance_Type) return Boolean; overriding procedure Halt_Actor (Self : in out Instance_Type); overriding function Reachable(Self : Instance_Type) return kv.avm.Actor_References.Sets.Set; overriding function Image(Self : Instance_Type) return String; overriding function Debug_Info(Self : Instance_Type) return String; type Instance_Factory is new kv.avm.Executables.Executable_Factory with null record; overriding procedure New_Executable (Self : in out Instance_Factory; Actor : in kv.avm.Actors.Actor_Access; Machine : in kv.avm.Control.Control_Access; Executable : out kv.avm.Executables.Executable_Access; Reference : out kv.avm.Actor_References.Actor_Reference_Type); private type Instance_Type is new kv.avm.Executables.Executable_Interface with record Actor : kv.avm.Actors.Actor_Access; Myself : kv.avm.Actor_References.Actor_Reference_Type; Pc : Interfaces.Unsigned_32; Memory : kv.avm.Memories.Memory_Type; Attributes : kv.avm.Memories.Register_Array_Type; Constants : kv.avm.Memories.Register_Array_Type; Frame : kv.avm.Frames.Frame_Access; Alive : Boolean; end record; end kv.avm.Instances;
Ada/src/Problem_02.adb
Tim-Tom/project-euler
0
25343
with Ada.Text_IO; with Ada.Long_Integer_Text_IO; package body Problem_02 is package IO renames Ada.Text_IO; procedure Solve is n : Long_Integer; n_1 : Long_Integer := 1; n_2 : Long_Integer := 0; sum : Long_Integer := 0; begin loop n := n_1 + n_2; exit when n > 4_000_000; if n mod 2 = 0 then sum := sum + n; end if; n_2 := n_1; n_1 := n; end loop; Ada.Long_Integer_Text_IO.Put(sum); IO.New_Line; end Solve; end Problem_02;
oeis/170/A170792.asm
neoneye/loda-programs
11
95479
<filename>oeis/170/A170792.asm ; A170792: a(n) = n^9*(n^10 + 1)/2. ; 0,1,262400,581140575,137439084544,9536744140625,304679875044096,5699447612863375,72057594105036800,675425859030206289,5000000000500000000,30579545225386246991,159739999687891353600,730960145193025305025,2988151979484787721984,11084189100284724609375,37778931862991521447936,119536217842634956361825,354117672677768017824000,989209827830318138410879,2621440000000256000000000,6624248320165910202813681,16032488606509786457516800,37307735463796255857284975,83749764955013897439412224 mov $1,$0 pow $0,9 mov $2,$1 pow $2,10 mul $2,$0 add $0,$2 div $0,2
src/LibraBFT/Impl/Types/Waypoint.agda
LaudateCorpus1/bft-consensus-agda
0
6245
{- 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 open import LibraBFT.Impl.OBM.Logging.Logging import LibraBFT.Impl.Types.Ledger2WaypointConverter as Ledger2WaypointConverter open import LibraBFT.ImplShared.Consensus.Types import LibraBFT.ImplShared.Util.Crypto as Crypto open import Optics.All open import Util.Hash open import Util.Prelude module LibraBFT.Impl.Types.Waypoint where newAny : LedgerInfo → Waypoint newAny ledgerInfo = let converter = Ledger2WaypointConverter.new ledgerInfo in Waypoint∙new (ledgerInfo ^∙ liVersion) (Crypto.hashL2WC converter) newEpochBoundary : LedgerInfo → Either ErrLog Waypoint newEpochBoundary ledgerInfo = if ledgerInfo ^∙ liEndsEpoch then pure (newAny ledgerInfo) else Left fakeErr -- ["newEpochBoundary", "no validator set"] verify : Waypoint → LedgerInfo → Either ErrLog Unit verify self ledgerInfo = do lcheck (self ^∙ wVersion == ledgerInfo ^∙ liVersion) ("Waypoint" ∷ "version mismatch" ∷ []) --show (self^.wVersion), show (ledgerInfo^.liVersion)] let converter = Ledger2WaypointConverter.new ledgerInfo lcheck (self ^∙ wValue == Crypto.hashL2WC converter) ("Waypoint" ∷ "value mismatch" ∷ []) --show (self^.wValue), show (Crypto.hashL2WC converter)] pure unit epochChangeVerificationRequired : Waypoint → Epoch → Bool epochChangeVerificationRequired _self _epoch = true isLedgerInfoStale : Waypoint → LedgerInfo → Bool isLedgerInfoStale self ledgerInfo = ⌊ (ledgerInfo ^∙ liVersion) <?-Version (self ^∙ wVersion) ⌋ verifierVerify : Waypoint → LedgerInfoWithSignatures → Either ErrLog Unit verifierVerify self liws = verify self (liws ^∙ liwsLedgerInfo)
examples/pcre_config.adb
ray2501/ada-adapcre
0
30060
<filename>examples/pcre_config.adb -- -- Basic checks of installation of the PCRE Ada binding. -- -- giving some details of PCRE build options. -- test of compile/study/match -- with Text_IO; use Text_IO; with AdaPcre; use AdaPcre; with Ada.Environment_Variables; use Ada.Environment_Variables; procedure Pcre_Config is package V_IO is new Fixed_IO (AdaPcre.Version_Number); Retcode : Integer; Conf, Info_Size : Integer; Word_Pattern : constant String := "([a-zA-Z]+)"; Subject : constant String := ";-)I love PATTERN matching!"; Regexp : Pcre_Type; Extra : Extra_type; Msg : Message; Last_Msg, ErrPos : Natural := 0; Result : Match_Array (0 .. 5); begin -- Checking version retrieval Put_Line ("Configuration of PCRE library on your system"); New_Line; Put (Pcre_Version); Put (" => Your version of PCRE is "); V_IO.Put (AdaPcre.Version, Fore => 1, Aft => 2); New_Line; if Version < 8.0 then Put_Line ("Old version. Please consider upgrading to a newer version."); end if; -- checking config options used for library build -- UTF-8 support Retcode := Config (PCRE_CONFIG_UTF8, Conf'Address); if Conf = 1 then Put_Line ("PCRE library was build with UTF-8 support"); elsif Conf = 0 then Put_Line ("no UTF-8 support in the PCRE library"); else Put_Line ("Wrong output in pcre_config for CONFIG_UTF8"); end if; -- Configuration of Newline Retcode := Config (PCRE_CONFIG_NEWLINE, Conf'Address); case Conf is when 10 => Put_Line ("Character sequence for newline is LF"); when 13 => Put_Line ("Character sequence for newline is CR"); when 3338 => Put_Line ("Character sequence for newline is CRLF"); when -1 => Put_Line ("Character sequence for newline is ANY"); when -2 => Put_Line ("Character sequence for newline is ANYCRLF"); when others => Put_Line ("Wrong output in pcre_config for CONFIG_NEWLINE :" & Integer'Image (Conf)); end case; -- Locale support Put ("Locale support : "); if Exists ("LC_CTYPE") then Put_Line ("LC_CTYPE is " & Value ("LC_CTYPE")); else Put_Line ("no LC_CTYPE defined"); end if; New_Line; -- Testing a demo case : Put_Line ("Testing compile, study, match."); Compile (Regexp, Word_Pattern, Msg, Last_Msg, ErrPos); if Regexp = Null_Pcre then Put_Line ("PCRE compilation failed at offset " & Natural'Image (ErrPos)); Put_Line (Msg (1 .. Last_Msg)); return; end if; Study (Extra, Regexp, Msg, Last_Msg); if Extra = Null_Extra and then Last_Msg > 0 then Put_Line ("PCRE study failed."); Put_Line (Msg (1 .. Last_Msg)); Free (Regexp); return; end if; Put_Line ("Compilation of pattern OK."); -- Getting the size of pattern matcher Retcode := Fullinfo (Regexp, Extra, What => PCRE_INFO_SIZE, Output_Addr => Info_Size'Address); Put_Line ("INFO_SIZE of matcher is" & Integer'Image (Info_Size)); Match (Retcode, Result, Regexp, Extra, Subject, Subject'Length); if Retcode < 0 then if Retcode = PCRE_ERROR_NOMATCH then Put_Line ("No match"); else Put_Line ("Matching error :" & Integer'Image (Retcode)); end if; Put_Line ("Something is wrong in your PCRE installation"); Free (Regexp); return; end if; Put_Line ("Match succeeded at offset " & Integer'Image (Result (0))); Put_Line ("Return code for pcre_match :" & Natural'Image (Retcode)); Free (Extra); Free (Regexp); New_Line; Put_Line ("Congratulations : your PCRE installation is working !"); end Pcre_Config;
test/succeed/Issue168.agda
asr/agda-kanso
0
15077
module Issue168 where postulate X : Set open import Issue168b open Membership X postulate P : Nat → Set lemma : ∀ n → P (id n) foo : P zero foo = lemma _
programs/oeis/242/A242412.asm
jmorken/loda
1
161013
; A242412: a(n) = (2n-1)^2 + 14. ; 15,23,39,63,95,135,183,239,303,375,455,543,639,743,855,975,1103,1239,1383,1535,1695,1863,2039,2223,2415,2615,2823,3039,3263,3495,3735,3983,4239,4503,4775,5055,5343,5639,5943,6255,6575,6903,7239,7583,7935,8295,8663,9039,9423,9815,10215,10623,11039,11463,11895,12335,12783,13239,13703,14175,14655,15143,15639,16143,16655,17175,17703,18239,18783,19335,19895,20463,21039,21623,22215,22815,23423,24039,24663,25295,25935,26583,27239,27903,28575,29255,29943,30639,31343,32055,32775,33503,34239,34983,35735,36495,37263,38039,38823,39615,40415,41223,42039,42863,43695,44535,45383,46239,47103,47975,48855,49743,50639,51543,52455,53375,54303,55239,56183,57135,58095,59063,60039,61023,62015,63015,64023,65039,66063,67095,68135,69183,70239,71303,72375,73455,74543,75639,76743,77855,78975,80103,81239,82383,83535,84695,85863,87039,88223,89415,90615,91823,93039,94263,95495,96735,97983,99239,100503,101775,103055,104343,105639,106943,108255,109575,110903,112239,113583,114935,116295,117663,119039,120423,121815,123215,124623,126039,127463,128895,130335,131783,133239,134703,136175,137655,139143,140639,142143,143655,145175,146703,148239,149783,151335,152895,154463,156039,157623,159215,160815,162423,164039,165663,167295,168935,170583,172239,173903,175575,177255,178943,180639,182343,184055,185775,187503,189239,190983,192735,194495,196263,198039,199823,201615,203415,205223,207039,208863,210695,212535,214383,216239,218103,219975,221855,223743,225639,227543,229455,231375,233303,235239,237183,239135,241095,243063,245039,247023,249015 sub $1,$0 bin $1,2 mul $1,8 add $1,15
oeis/111/A111277.asm
neoneye/loda-programs
11
27885
; A111277: Number of permutations avoiding the patterns {2413,4213,2431,4231,4321}; also number of permutations avoiding the patterns {3142,3412,3421,4312,4321}; number of weak sorting class based on 2413 or 3142. ; 1,1,2,6,19,59,180,544,1637,4917,14758,44282,132855,398575,1195736,3587220,10761673,32285033,96855114,290565358,871696091,2615088291,7845264892,23535794696,70607384109,211822152349,635466457070,1906399371234,5719198113727,17157594341207,51472783023648,154418349070972,463255047212945,1389765141638865,4169295424916626,12507886274749910,37523658824249763,112570976472749323,337712929418248004,1013138788254744048,3039416364764232181,9118249094292696581,27354747282878089782,82064241848634269386 mov $1,3 pow $1,$0 sub $1,$0 sub $1,$0 div $1,4 add $1,1 mov $0,$1
Categories/Monad/Strong.agda
rei1024/agda-categories
0
13838
<filename>Categories/Monad/Strong.agda {-# OPTIONS --without-K --safe #-} -- Define Strong Monad; use the Wikipedia definition -- https://en.wikipedia.org/wiki/Strong_monad -- At the nLab, https://ncatlab.org/nlab/show/strong+monad -- there are two further definitions; the 2-categorical version is too complicated -- and the Moggi definition is a special case of the one here module Categories.Monad.Strong where open import Level open import Data.Product using (_,_) open import Categories.Category open import Categories.Functor renaming (id to idF) open import Categories.Category.Monoidal open import Categories.Category.Product open import Categories.NaturalTransformation hiding (id) -- open import Categories.NaturalTransformation.NaturalIsomorphism open import Categories.Monad private variable o ℓ e : Level record Strength {C : Category o ℓ e} (V : Monoidal C) (m : Monad C) : Set (o ⊔ ℓ ⊔ e) where open Category C open Monoidal V open Monad m using (F) module M = Monad m open NaturalTransformation M.η using (η) open NaturalTransformation M.μ renaming (η to μ) open Functor F field strengthen : NaturalTransformation (⊗ ∘F (idF ⁂ F)) (F ∘F ⊗) private module t = NaturalTransformation strengthen field -- strengthening with 1 is irrelevant identityˡ : {A : Obj} → F₁ (unitorˡ.from) ∘ t.η (unit , A) ≈ unitorˡ.from -- commutes with unit (of monad) η-comm : {A B : Obj} → t.η (A , B) ∘ (id ⊗₁ η B) ≈ η (A ⊗₀ B) -- strength commutes with multiplication μ-η-comm : {A B : Obj} → μ (A ⊗₀ B) ∘ F₁ (t.η (A , B)) ∘ t.η (A , F₀ B) ≈ t.η (A , B) ∘ id ⊗₁ μ B -- consecutive applications of strength commute (i.e. strength is associative) strength-assoc : {A B C : Obj} → F₁ associator.from ∘ t.η (A ⊗₀ B , C) ≈ t.η (A , B ⊗₀ C) ∘ id ⊗₁ t.η (B , C) ∘ associator.from record StrongMonad {C : Category o ℓ e} (V : Monoidal C) : Set (o ⊔ ℓ ⊔ e) where field m : Monad C strength : Strength V m
07_Jump_Loop/src/jumploop.asm
junehan-dev/asm-beginning_x64_programming
0
14211
<reponame>junehan-dev/asm-beginning_x64_programming extern printf section .data number dq 5 fmt db "The sum from 0 to %ld is %ld", 10, 0 section .bss section .text global main main: push rbp mov rbp, rsp mov rbx, 0 ; counter mov rax, 0 ; sum will be in rax jloop: add rax, rbx inc rbx cmp rbx, [number] jle jloop print: mov rdi, fmt mov rsi, [number] mov rdx, rax mov rax, 0 call printf exit: mov rsp, rbp pop rbp ret
Sources/Globe_3d/culler/globe_3d-culler-impostoring_frustum.ads
ForYouEyesOnly/Space-Convoy
1
14244
pragma Warnings (Off); pragma Style_Checks (Off); with globe_3d.Impostor; with GL.Textures; with ada.containers.hashed_Maps; with ada.unchecked_Conversion; package GLOBE_3D.Culler.impostoring_frustum is type Culler is new globe_3d.culler.Culler with private; type p_Culler is access all Culler'Class; procedure add (Self : in out Culler; the_Visual : in globe_3d.p_Visual); procedure rid (Self : in out Culler; the_Visual : in globe_3d.p_Visual); function object_Count (Self : in Culler) return Natural; procedure evolve (Self : in out Culler; By : in Real); -- tbd : rename 'freshen' ? function vanish_point_size_Min (Self : in Culler'Class) return Real; procedure vanish_point_size_Min_is (Self : in out Culler'Class; Now : in Real); -- -- visuals whose projected size falls below this minimum will not be displayed. function impostor_size_Min (Self : in Culler'Class) return Real; procedure impostor_size_Min_is (Self : in out Culler'Class; Now : in Real); -- -- visuals whose projected size falls below this minimum will be displayed as impostors. function frustum_culling_Enabled (Self : in Culler'Class) return Boolean; procedure frustum_culling_Enabled_is (Self : in out Culler'Class; Now : in Boolean); private type sprite_Set is tagged record Visual : globe_3d.p_Visual; Impostor : globe_3d.impostor.p_Impostor; end record; type sprite_Set_view is access all sprite_Set; type sprite_Set_views is array (Positive range <>) of sprite_Set_view; procedure destroy (Self : in out sprite_Set); procedure free (Self : in sprite_Set_view); function Hash is new ada.unchecked_Conversion (p_Visual, ada.containers.Hash_type); package physics_object_sprite_set_Maps is new ada.containers.hashed_Maps (p_Visual, sprite_Set_view, hash => Hash, equivalent_keys => "="); use physics_object_sprite_set_Maps; package impostor_load_Balancer is type Slot is record max_Faces : Positive; max_Updates : Positive; Impostors : Impostor.p_Impostor_array (1 .. 10_000); impostors_Count : Natural := 0; end record; type Slots is array (Positive range <>) of Slot; type p_Slots is access all Slots; end impostor_load_Balancer; default_Slots : aliased impostor_load_Balancer.Slots := (1 => (max_Faces => 100, max_Updates => 20, others => <>), 2 => (max_Faces => 1000, max_Updates => 15, others => <>), 3 => (max_Faces => Positive'Last, max_Updates => 12, others => <>)); -- -- tbd : tune default_Slots to reasonable defaults. type Culler is new globe_3d.culler.Culler with record countDown : Natural := 0; frame_Count : Natural := 0; vanish_point_size_Min : Real := 0.0012; impostor_size_Min : Real := 0.0625; frustum_culling_Enabled : Boolean := True; object_sprite_set_Map : physics_object_sprite_set_maps.Map; impostor_load_Slots : impostor_load_Balancer.p_Slots := default_Slots'Access; texture_Pool : aliased GL.textures.Pool; end record; end globe_3d.Culler.impostoring_frustum;
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0xca_notsx.log_21829_1645.asm
ljhsiun2/medusa
9
174770
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r8 push %rcx push %rdi push %rsi lea addresses_A_ht+0x1e652, %rsi lea addresses_WT_ht+0x1e252, %rdi nop nop nop nop xor %r8, %r8 mov $81, %rcx rep movsl nop xor %r10, %r10 lea addresses_normal_ht+0x19652, %rsi lea addresses_UC_ht+0x14b92, %rdi and %r11, %r11 mov $74, %rcx rep movsb nop nop lfence pop %rsi pop %rdi pop %rcx pop %r8 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %r8 push %rcx push %rdx push %rsi // Store lea addresses_WC+0x1fe9a, %rsi nop nop nop dec %r15 mov $0x5152535455565758, %r8 movq %r8, (%rsi) nop nop xor $51001, %rdx // Store lea addresses_normal+0x82ee, %r10 nop nop nop nop nop cmp %r13, %r13 mov $0x5152535455565758, %r8 movq %r8, (%r10) add %rdx, %rdx // Load lea addresses_D+0x13b52, %r10 nop nop nop nop sub %r8, %r8 movb (%r10), %cl nop nop nop nop add %r15, %r15 // Faulty Load lea addresses_PSE+0xe52, %rsi nop and %r15, %r15 mov (%rsi), %r13d lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rsi pop %rdx pop %rcx pop %r8 pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': True, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': True}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
programs/oeis/193/A193335.asm
neoneye/loda
22
5266
<gh_stars>10-100 ; A193335: Number of odd divisors of sigma(n). ; 1,2,1,2,2,2,1,4,2,3,2,2,2,2,2,2,3,4,2,4,1,3,2,4,2,4,2,2,4,3,1,6,2,4,2,4,2,4,2,6,4,2,2,4,4,3,2,2,4,4,3,3,4,4,3,4,2,6,4,4,2,2,2,2,4,3,2,6,2,3,3,8,2,4,2,4,2,4,2,4,3,6,4,2,4,4,4,6,6,6,2,4,1,3,4,6,3,6,4,4 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). sub $0,1 seq $0,54844 ; Number of ways to write n as the sum of any number of consecutive integers (including the trivial one-term sum n = n). div $0,2
oeis/113/A113424.asm
neoneye/loda-programs
11
173486
; A113424: a(n) = (6n)!/((3n)!(2n)!n!). ; 1,60,13860,4084080,1338557220,465817912560,168470811709200,62588625639883200,23717177328413240100,9124964373613212524400,3553261127084984957001360,1397224499394244497967972800,553883078634868423069470550800,221068174083308549543680044926400,88747592905974744450484289056065600,35806695484463943560955394491153934080,14510103865462068378959033689501207505700,5902650002903746044650310853538131346713200,2409374284518599450299669478401620206375043600,986468578252041753883912320181919869759160510400 mov $1,$0 mul $1,3 mov $2,6 mul $2,$0 bin $2,$1 bin $1,$0 mul $1,$2 mov $0,$1
oeis/064/A064734.asm
neoneye/loda-programs
11
26001
; A064734: Final digits of A005165(2n+1) for large n, read from right. ; Submitted by <NAME> ; 1,8,9,2,2,4,4,6,3,8,3,8,7,3,6,0,6,4,3,5,5,8,7,1,1,4,2,3,6,7,3,1,3,4,4,9,8,3,9,5,1,4,0,8,3,0,5,3,6,5,9,2,6,1,8,2,3,1,8,6,8,3,1,1,8,8,0,1,0,7,1,1,1,3,9,7,0,4,6,0,0,3,3,6,7,0,0,6,3,6,5,7,5,2,0,9,2,2,5,4 mov $3,$0 add $3,4 mul $3,4 lpb $3 mul $2,$3 sub $2,$1 add $1,$2 mov $2,1 sub $2,$1 sub $3,1 lpe mov $4,10 pow $4,$0 div $1,$4 mov $0,$1 mod $0,10
src/linereader.adb
bracke/websitegenerator
1
22675
with Ada.Text_IO; package body Linereader is SL : constant Natural := Separator_Sequence'Length; function End_Of_Input(Self : Reader) return Boolean is begin return Self.End_Of_Input; end End_Of_Input; procedure Restore (Self : in out Reader) is begin Self.Position := Self.Backup; end Restore; procedure Backup (Self : in out Reader) is begin Self.Backup := Self.Position; end Backup; function Get_Remainder (Self : in out Reader) return String is Result : constant String := Self.Source(Self.Position .. Self.Last); subtype NiceString is String (1 .. Self.Last - Self.Position + 1); begin Self.End_Of_Input := True; return NiceString(Result); end Get_Remainder; function Separator_Position(Self: Reader) return Natural is pragma Inline(Separator_Position); K : Natural := Self.Position; begin while Self.Source(K) /= Separator_Sequence(Separator_Sequence'First) loop K := K + 1; exit when K > Self.Len; end loop; return K; end Separator_Position; function Get_Line(Self: in out Reader) return String is Next_Separator : Natural; begin if Self.End_Of_Input then raise End_Of_Input_Exception; end if; Next_Separator := Separator_Position(Self); if Next_Separator > Self.Last then declare Result : constant String := Self.Source(Self.Position .. Self.Last); subtype NiceString is String (1 .. Self.Last - Self.Position); begin Self.End_Of_Input := True; return NiceString(Result); end; else declare Result : String renames Self.Source(Self.Position .. Next_Separator); subtype NiceString is String (1 .. Next_Separator - Self.Position); begin Self.Position := Next_Separator + SL; return NiceString(Result); end; end if; end Get_Line; end Linereader;
source/web/tools/a2js/engines-generic_engines.adb
svn2github/matreshka
24
13580
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the <NAME>, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Wide_Text_IO; with Asis.Elements; package body Engines.Generic_Engines is --------- -- "=" -- --------- overriding function "=" (Left, Right : Property_Key) return Boolean is begin return Asis.Elements.Is_Identical (Left.Element, Right.Element) and then Left.Name = Right.Name; end "="; ------------------ -- Get_Property -- ------------------ function Get_Property (Self : access Engine; Element : Asis.Element; Name : Propert_Name) return Property_Type is Key : constant Property_Key := (Element, Name); Pos : constant Property_Maps.Cursor := Self.Property_Cache.Find (Key); Value : Property_Type; Action : Action_Callback; begin if Property_Maps.Has_Element (Pos) then Value := Property_Maps.Element (Pos); else declare Kind : constant Asis.Extensions.Flat_Kinds.Flat_Element_Kinds := Asis.Extensions.Flat_Kinds.Flat_Element_Kind (Element); begin Action := Self.Actions.Element ((Kind, Name)); exception when Constraint_Error => Ada.Wide_Text_IO.Put (Asis.Extensions.Flat_Kinds.Flat_Element_Kinds'Wide_Image (Kind)); Ada.Wide_Text_IO.Put (" "); Ada.Wide_Text_IO.Put_Line (Propert_Name'Wide_Image (Name)); Ada.Wide_Text_IO.Put_Line (Asis.Elements.Debug_Image (Element)); raise; end; Value := Action (Self.Context, Element, Name); Self.Property_Cache.Insert (Key, Value); end if; return Value; end Get_Property; ------------------ -- Get_Property -- ------------------ function Get_Property (Self : access Engine; List : Asis.Element_List; Name : Propert_Name; Empty : Property_Type; Sum : access function (Left, Right : Property_Type) return Property_Type) return Property_Type is Result : Property_Type := Empty; begin for J in List'Range loop declare Next : constant Property_Type := Self.Get_Property (List (J), Name); begin Result := Sum (Result, Next); end; end loop; return Result; end Get_Property; ---------- -- Hash -- ---------- function Hash (Value : Property_Key) return Ada.Containers.Hash_Type is use type Ada.Containers.Hash_Type; Element_Hash : constant Asis.ASIS_Integer := Asis.Elements.Hash (Value.Element); Name_Hash : constant Ada.Containers.Hash_Type := Propert_Name'Pos (Value.Name); begin return Name_Hash + Ada.Containers.Hash_Type (abs Element_Hash); end Hash; ---------- -- Hash -- ---------- function Hash (Value : Action_Key) return Ada.Containers.Hash_Type is use type Ada.Containers.Hash_Type; Kind_Hash : constant Ada.Containers.Hash_Type := Asis.Extensions.Flat_Kinds.Flat_Element_Kinds'Pos (Value.Kind); Name_Hash : constant Ada.Containers.Hash_Type := Propert_Name'Pos (Value.Name); begin return Name_Hash + Kind_Hash; end Hash; ------------------------- -- Register_Calculator -- ------------------------- procedure Register_Calculator (Self : in out Engine; Kind : Asis.Extensions.Flat_Kinds.Flat_Element_Kinds; Name : Propert_Name; Action : access function (Engine : access Abstract_Context; Element : Asis.Element; Name : Propert_Name) return Property_Type) is begin Self.Actions.Insert ((Kind, Name), Action); end Register_Calculator; end Engines.Generic_Engines;
legacy/Data/Num/Bij.agda
banacorn/numeral
1
428
module Data.Num.Bij where open import Data.List hiding ([_]) open import Relation.Binary open import Relation.Binary.PropositionalEquality as PropEq using (_≡_; _≢_) import Level -------------------------------------------------------------------------------- -- Bijective Numeration -- -- A numeral system which has a unique representation for every non-negative -- interger -- http://en.wikipedia.org/wiki/Bijective_numeration -------------------------------------------------------------------------------- -- zeroless binary number infixl 7 _*B_ infixl 6 _+B_ data DigitB : Set where one : DigitB two : DigitB Bij : Set Bij = List DigitB incrB : Bij → Bij incrB [] = one ∷ [] incrB (one ∷ a) = two ∷ a incrB (two ∷ a) = one ∷ incrB a -- addition _+B_ : Bij → Bij → Bij [] +B b = b a +B [] = a (one ∷ as) +B (one ∷ bs) = two ∷ as +B bs (one ∷ as) +B (two ∷ bs) = one ∷ incrB (as +B bs) (two ∷ as) +B (one ∷ bs) = one ∷ incrB (as +B bs) (two ∷ as) +B (two ∷ bs) = two ∷ incrB (as +B bs) -- arithmetic shift *2_ : Bij → Bij *2 [] = [] *2 (one ∷ as) = two ∷ *2 as *2 (two ∷ as) = two ∷ incrB (*2 as) -- multiplication _*B_ : Bij → Bij → Bij [] *B b = [] (one ∷ as) *B b = b +B (*2 (as *B b)) (two ∷ as) *B b = b +B b +B (*2 (as *B b)) -------------------------------------------------------------------------------- -- Ordering -------------------------------------------------------------------------------- infix 4 _≤-digitB_ _≤B_ _<B_ data _≤-digitB_ : Rel DigitB Level.zero where 1≤1 : one ≤-digitB one 1≤2 : one ≤-digitB two 2≤2 : two ≤-digitB two data _≤B_ : Rel Bij Level.zero where []≤all : ∀ {n} → [] ≤B n ≤here : ∀ {as bs a b} -- compare the least digit → {a≤b : a ≤-digitB b} → {as≡bs : as ≡ bs} → a ∷ as ≤B b ∷ bs ≤there : ∀ {as bs a b} → (as<bs : incrB as ≤B bs) -- compare the rest digits → a ∷ as ≤B b ∷ bs _<B_ : Rel Bij Level.zero a <B b = incrB a ≤B b {- decr : Bij → Bij decr [] = [] decr (one ∷ a) = a decr (two ∷ a) = one ∷ a _-_ : Bij → Bij → Bij [] - bs = [] as - [] = as (one ∷ as) - (one ∷ bs) = as - bs (one ∷ as) - (two ∷ bs) = one ∷ decr (as - bs) (two ∷ as) - (one ∷ bs) = one ∷ as - bs (two ∷ as) - (two ∷ bs) = as - bs -} -------------------------------------------------------------------------------- -- typeclass for converting data types to Bij -- http://people.cs.kuleuven.be/~dominique.devriese/agda-instance-arguments/icfp001-Devriese.pdf record Conversion (t : Set) : Set where constructor conversion field [_] : t → Bij !_! : Bij → t -- split morphism -- !_! is a section of [_] -- [_] is a retraction of !_! -- [!!]-id : ∀ n → [ ! n ! ] ≡ n [_] : ∀ {t} → {{convT : Conversion t}} → t → Bij [_] {{convT}} = Conversion.[ convT ] !_! : ∀ {t} → {{convT : Conversion t}} → Bij → t !_! {{convT}} = Conversion.! convT ! --[!!]-id : ∀ {t} → {{convT : Conversion t}} → (n : Bij) → [ ! n ! ] ≡ n --[!!]-id {{convT}} = Conversion.[!!]-id convT -- alias, more meaningful than the forgettable [_] and !_! (replace them some day) toBij = [_] fromBij = !_!
data/mapHeaders/CeladonMansionRoof.asm
AmateurPanda92/pokemon-rby-dx
9
89845
CeladonMansionRoof_h: db MANSION ; tileset db CELADON_MANSION_ROOF_HEIGHT, CELADON_MANSION_ROOF_WIDTH ; dimensions (y, x) dw CeladonMansionRoof_Blocks ; blocks dw CeladonMansionRoof_TextPointers ; texts dw CeladonMansionRoof_Script ; scripts db 0 ; connections dw CeladonMansionRoof_Object ; objects
gnu/usr.bin/gcc/gcc/config/ia64/crtend.asm
ArrogantWombatics/openbsd-src
1
88057
<reponame>ArrogantWombatics/openbsd-src /* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. Contributed by <NAME>, <<EMAIL>> The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "auto-host.h" .section .ctors,"aw","progbits" .align 8 __CTOR_END__: data8 0 .section .dtors,"aw","progbits" .align 8 __DTOR_END__: data8 0 .section .jcr,"aw","progbits" .align 8 __JCR_END__: data8 0 #ifndef HAVE_INITFINI_ARRAY /* * Fragment of the ELF _init routine that invokes our dtor cleanup. * * We make the call by indirection, because in large programs the * .fini and .init sections are not in range of the destination, and * we cannot allow the linker to insert a stub at the end of this * fragment of the _fini function. Further, Itanium does not implement * the long branch instructions, and we do not wish every program to * trap to the kernel for emulation. * * Note that we require __do_global_ctors_aux to preserve the GP, * so that the next fragment in .fini gets the right value. */ .section .init,"ax","progbits" { .mlx movl r2 = @pcrel(__do_global_ctors_aux# - 16) } { .mii mov r3 = ip ;; add r2 = r2, r3 ;; } { .mib mov b6 = r2 br.call.sptk.many b0 = b6 ;; } #endif /* !HAVE_INITFINI_ARRAY */ .text .align 16 #ifdef HAVE_INITFINI_ARRAY /* This is referenced from crtbegin.o. */ .globl __do_global_ctors_aux# .type __do_global_ctors_aux#,@function .hidden __do_global_ctors_aux# #endif .proc __do_global_ctors_aux# __do_global_ctors_aux: /* for (loc0 = __CTOR_END__-1; *p != -1; --p) (*p) (); */ { .mlx alloc loc4 = ar.pfs, 0, 5, 0, 0 movl loc0 = @gprel(__CTOR_END__# - 8) ;; } { .mmi add loc0 = loc0, gp mov loc1 = b0 ;; } { .mmi ld8 loc3 = [loc0], -8 mov loc2 = gp ;; } { .mfb cmp.eq p6, p0 = -1, loc3 (p6) br.cond.spnt.few 2f } 0: { .mmi ld8 r15 = [loc3], 8 ;; ld8 gp = [loc3] mov b6 = r15 } { .mfb ld8 loc3 = [loc0], -8 br.call.sptk.many b0 = b6 ;; } { .mfb cmp.ne p6, p0 = -1, loc3 (p6) br.cond.sptk.few 0b } 2: { .mii mov gp = loc2 mov b0 = loc1 mov ar.pfs = loc4 } { .bbb br.ret.sptk.many b0 ;; } .endp __do_global_ctors_aux#
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_424.asm
ljhsiun2/medusa
9
245816
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rax push %rbx push %rdx push %rsi lea addresses_A_ht+0xe45b, %rbx nop nop xor %r12, %r12 movw $0x6162, (%rbx) nop nop nop nop nop xor $18858, %rbx lea addresses_D_ht+0xc81b, %r10 xor $64800, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%r10) nop nop and %rsi, %rsi lea addresses_WC_ht+0x2a5b, %rax dec %rdx mov $0x6162636465666768, %rbx movq %rbx, %xmm1 vmovups %ymm1, (%rax) and $26560, %r10 pop %rsi pop %rdx pop %rbx pop %rax pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r9 push %rax push %rcx push %rdi // Faulty Load lea addresses_normal+0x9e5b, %rax nop and %rdi, %rdi mov (%rax), %r15w lea oracles, %rdi and $0xff, %r15 shlq $12, %r15 mov (%rdi,%r15,1), %r15 pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
maps/IlexForestAzaleaGate.asm
Dev727/ancientplatinum
28
6826
object_const_def ; object_event constants const ILEXFORESTAZALEAGATE_OFFICER const ILEXFORESTAZALEAGATE_GRANNY IlexForestAzaleaGate_MapScripts: db 0 ; scene scripts db 0 ; callbacks IlexForestAzaleaGateOfficerScript: jumptextfaceplayer IlexForestAzaleaGateOfficerText IlexForestAzaleaGateGrannyScript: jumptextfaceplayer IlexForestAzaleaGateGrannyText IlexForestAzaleaGateOfficerText: text "ILEX FOREST is" line "big. Be careful!" cont "Don't get lost." done IlexForestAzaleaGateGrannyText: text "The FOREST is" line "watched over by" cont "its protector." para "Stay out of" line "mischief!" done IlexForestAzaleaGate_MapEvents: db 0, 0 ; filler db 4 ; warp events warp_event 0, 4, ILEX_FOREST, 2 warp_event 0, 5, ILEX_FOREST, 3 warp_event 9, 4, AZALEA_TOWN, 7 warp_event 9, 5, AZALEA_TOWN, 8 db 0 ; coord events db 0 ; bg events db 2 ; object events object_event 5, 2, SPRITE_OFFICER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, IlexForestAzaleaGateOfficerScript, -1 object_event 1, 3, SPRITE_GRANNY, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, IlexForestAzaleaGateGrannyScript, -1
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_7489_1220.asm
ljhsiun2/medusa
9
100913
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x817d, %rdx nop nop nop nop add %r8, %r8 mov (%rdx), %ecx nop nop nop nop nop and $34996, %r9 lea addresses_WC_ht+0x200d, %r13 nop nop xor $44415, %rdi movw $0x6162, (%r13) nop nop nop nop xor $20637, %r8 lea addresses_WC_ht+0x697d, %rsi lea addresses_normal_ht+0x837d, %rdi clflush (%rsi) nop nop nop nop and %rbp, %rbp mov $47, %rcx rep movsq add $1824, %r13 lea addresses_normal_ht+0x1397d, %rdi nop nop nop nop and %r8, %r8 mov $0x6162636465666768, %rsi movq %rsi, (%rdi) nop nop nop nop xor $63644, %r9 lea addresses_normal_ht+0xd55, %r9 clflush (%r9) nop nop nop nop nop add %rdx, %rdx mov $0x6162636465666768, %r13 movq %r13, %xmm6 movups %xmm6, (%r9) nop nop nop nop nop cmp $63124, %r13 lea addresses_UC_ht+0xe485, %rsi lea addresses_WC_ht+0x1155d, %rdi and %rdx, %rdx mov $107, %rcx rep movsl nop nop nop mfence pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %rbx push %rcx push %rdx // Load lea addresses_WT+0x1ff35, %rbx nop nop nop nop add %r11, %r11 movb (%rbx), %r10b nop and $36441, %r11 // Load lea addresses_PSE+0x788d, %rcx nop and $27083, %rdx movntdqa (%rcx), %xmm5 vpextrq $0, %xmm5, %r15 nop nop nop nop nop add $39790, %r15 // Store lea addresses_PSE+0x1db7d, %rdx xor %r10, %r10 mov $0x5152535455565758, %rcx movq %rcx, %xmm4 movups %xmm4, (%rdx) nop nop nop dec %r13 // Faulty Load lea addresses_A+0x117d, %rbx nop nop nop nop nop xor %rdx, %rdx mov (%rbx), %r10w lea oracles, %r11 and $0xff, %r10 shlq $12, %r10 mov (%r11,%r10,1), %r10 pop %rdx pop %rcx pop %rbx pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': True, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 10, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}} {'00': 7489} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
agda-stdlib/src/Data/Empty/Polymorphic.agda
DreamLinuxer/popl21-artifact
5
15823
<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Level polymorphic Empty type ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Empty.Polymorphic where open import Level data ⊥ {ℓ : Level} : Set ℓ where ⊥-elim : ∀ {w ℓ} {Whatever : Set w} → ⊥ {ℓ} → Whatever ⊥-elim ()
6_kyu/Three_added_Characters.asm
UlrichBerntien/Codewars-Katas
0
8225
<gh_stars>0 global added_char extern puts section .text ; input: rdi = s1, rsi = s2 ; output: al ; callee saved registers: rbx, rsp, rbp, r12-r15 added_char: sub rsp, 400h ; allocate 100h dword table on stack ; init character counter table xor rax, rax mov ecx, 100h/2 ; init the 100h dwords with 100h/2 qwords .init_loop: mov [rsp+rcx*8-8], rax loop .init_loop ; count characters in string s1 xchg rsi, rdi ; rsi = s1, rdi = s2 cld ; go upwards in the strings .s1_count_loop: lodsb inc dword [rsp+rax*4] test al, al jnz .s1_count_loop ; repeat until end of string ; subtract count of characters in string s2 ; a negative count indicates an added char in s2 mov rsi, rdi ; rsi = s2 .s2_count_loop: lodsb dec dword [rsp+rax*4] js .found ; counter negative: found an added char test al, al jnz .s2_count_loop ; repeat until end of string ; the rip is here: error, not found an added char .found: add rsp, 400h ret
experiments/test-suite/mutation-based/100/fullTree.als
kaiyuanw/AlloyFLCore
1
4671
pred test37 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node0->Node0 + Node0->Node1 + Node1->Node1 } } run test37 for 3 expect 0 pred test13 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node1->Node1 Acyclic[] } } run test13 for 3 expect 0 pred test5 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node0 right = Node0->Node0 } } run test5 for 3 expect 1 pred test16 { some disj Node0: Node { Node = Node0 no left right = Node0->Node0 Acyclic[] } } run test16 for 3 expect 0 pred test35 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node1->Node1 } } run test35 for 3 expect 1 pred test36 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 + Node1->Node1 no right } } run test36 for 3 expect 0 pred test20 { some disj Node0, Node1, Node2: Node { Node = Node0 + Node1 + Node2 left = Node2->Node1 right = Node0->Node2 Acyclic[] } } run test20 for 3 expect 1 pred test21 { some disj Node0, Node1, Node2: Node { Node = Node0 + Node1 + Node2 left = Node0->Node2 + Node1->Node0 no right Acyclic[] } } run test21 for 3 expect 1 pred test22 { some disj Node0, Node1, Node2: Node { Node = Node0 + Node1 + Node2 no left right = Node0->Node2 + Node1->Node0 Acyclic[] } } run test22 for 3 expect 1 pred test27 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node0->Node1 + Node1->Node0 makeFull[] } } run test27 for 3 expect 0 pred test42 { some disj Node0: Node { Node = Node0 left = Node0->Node0 right = Node0->Node0 } } run test42 for 3 expect 1 pred test19 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node1->Node0 Acyclic[] } } run test19 for 3 expect 1 pred test30 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node1->Node0 makeFull[] } } run test30 for 3 expect 1 pred test34 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 + Node1->Node1 right = Node1->Node1 } } run test34 for 3 expect 0 pred test43 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node0->Node1 + Node1->Node1 } } run test43 for 3 expect 1 pred test6 { some disj Node0: Node { Node = Node0 left = Node0->Node0 no right } } run test6 for 3 expect 1 pred test40 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node1->Node1 } } run test40 for 3 expect 1 pred test18 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 no right Acyclic[] } } run test18 for 3 expect 1 pred test38 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node0 + Node0->Node1 + Node1->Node0 + Node1->Node1 right = Node1->Node1 } } run test38 for 3 expect 0 pred test25 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left no right makeFull[] } } run test25 for 3 expect 1 pred test1 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node1 + Node1->Node1 right = Node0->Node1 + Node1->Node1 } } run test1 for 3 expect 1 pred test14 { some disj Node0: Node { Node = Node0 no left no right Acyclic[] } } run test14 for 3 expect 1 pred test7 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 no right } } run test7 for 3 expect 1 pred test39 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node1->Node0 + Node1->Node1 } } run test39 for 3 expect 0 pred test10 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node0->Node0 Acyclic[] } } run test10 for 3 expect 0 pred test11 { some disj Node0, Node1, Node2: Node { Node = Node0 + Node1 + Node2 left = Node2->Node1 right = Node0->Node1 Acyclic[] } } run test11 for 3 expect 0 pred test15 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node0->Node1 + Node1->Node0 Acyclic[] } } run test15 for 3 expect 0 pred test31 { some disj Node0: Node { Node = Node0 left = Node0->Node0 no right FullTree[] } } run test31 for 3 expect 0 pred test28 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 no right makeFull[] } } run test28 for 3 expect 0 pred test33 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node0->Node0 + Node0->Node1 } } run test33 for 3 expect 0 pred test2 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node1 + Node1->Node1 right = Node0->Node1 } } run test2 for 3 expect 1 pred test4 { some disj Node0: Node { Node = Node0 no left no right } } run test4 for 3 expect 1 pred test32 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node1->Node0 FullTree[] } } run test32 for 3 expect 0 pred test9 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left no right Acyclic[] } } run test9 for 3 expect 1 pred test26 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node1->Node0 makeFull[] } } run test26 for 3 expect 0 pred test3 { no Node no left no right } run test3 for 3 expect 1 pred test29 { some disj Node0: Node { Node = Node0 no left no right makeFull[] } } run test29 for 3 expect 1 pred test24 { some disj Node0: Node { Node = Node0 left = Node0->Node0 no right makeFull[] } } run test24 for 3 expect 1 pred test41 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node0->Node1 + Node1->Node0 no right } } run test41 for 3 expect 1 pred test44 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node1 right = Node0->Node1 + Node1->Node0 } } run test44 for 3 expect 1 pred test23 { some disj Node0, Node1: Node { Node = Node0 + Node1 no left right = Node0->Node1 + Node1->Node0 makeFull[] } } run test23 for 3 expect 0 pred test8 { some disj Node0: Node { Node = Node0 left = Node0->Node0 no right Acyclic[] } } run test8 for 3 expect 0 pred test17 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node0->Node1 Acyclic[] } } run test17 for 3 expect 0 pred test12 { some disj Node0, Node1: Node { Node = Node0 + Node1 left = Node1->Node0 right = Node1->Node0 Acyclic[] } } run test12 for 3 expect 0
src/modules/editor.asm
freem/nesmon
2
5977
<reponame>freem/nesmon ;==============================================================================; ; nesmon/src/modules/editor.asm ; Editor module ;==============================================================================; ; The nesmon editor is a simple line editor. This editor provides the core ; functionality of the nesmon toolset, as commands are entered here. ; With space at a premium, we try to avoid storing a complete buffer of the ; visible text. ;==============================================================================; ; Routine naming: editor_* ;==============================================================================; .ignorenl ; module variables (todo) ; cursor defines CURSOR_SPRITE_Y = OAM_BUF+4 CURSOR_SPRITE_TILE = OAM_BUF+5 CURSOR_SPRITE_ATTR = OAM_BUF+6 CURSOR_SPRITE_X = OAM_BUF+7 CURSOR_TILE_ON = 1 CURSOR_TILE_OFF = 2 .endinl ;==============================================================================; ; editor_Init ; Setup for the editor module editor_Init: ; TEMPORARY HACK lda #1 sta activeKBType ; end TEMPORARY HACK ; --system variable initialization-- lda #0 sta edcursorX sta curLineEnd sta curNumChars sta editScrollY sta editScrollNT ; clear line buffer jsr editor_ClearLineBuf ; clear module ram jsr nesmon_ClearModuleRAM ; --module variable initialization-- ; --welcome message-- ; prepare header ldx #$20 ldy #$21 lda #15 stx tmp00 sty tmp01 sta tmp02 jsr vramBuf_NewEntry ldx #<cartSignature ldy #>cartSignature stx tmp00 sty tmp01 lda #15 jsr vramBuf_AddFromPtr ; build date ldx #$20 ldy #$31 lda #14 stx tmp00 sty tmp01 sta tmp02 jsr vramBuf_NewEntry ldx #<(cartSignature+16) ldy #>(cartSignature+16) stx tmp00 sty tmp01 lda #14 jsr vramBuf_AddFromPtr lda #1 sta runNormalVBuf jsr ppu_WaitVBL ; --cursor (visual)-- ; reset cursor cell ldx #1 stx edcurDispX inx stx edcurDispY ; this is a system variable, but it makes more sense to define it here lda #1 sta editLineNum ; blinkenstein 3d lda #0 sta edcurBlink sta timer1 ; --software keyboard-- jsr vramBuf_Init ; temporary shoving this off-screen (was $2220) lda #$26 ldx #$20 sta softkbPos stx softkbPos+1 jsr softkb_Show lda #1 sta runNormalVBuf jsr ppu_WaitVBL ; execution falls through ;==============================================================================; ; editor_MainLoop ; Editor module main loop editor_MainLoop: ; --before vblank-- jsr editor_HandleInput ; handle input jsr editor_UpdateCursorSprite lda activeKBType bne @skipSoftKBUpdate ; update software keyboard cursor or whatever jsr softkb_Update @skipSoftKBUpdate: ; --vblank-- jsr ppu_WaitVBL ; --after vblank-- inc timer1 lda timer1 cmp #20 ; this value subject to change (currently 1/3 of 60) bne @noBlinking ; reset timer lda #0 sta timer1 ; change blink state lda edcurBlink eor #1 sta edcurBlink @noBlinking: jsr editor_GetInput ; get input for next frame jmp editor_MainLoop ;==============================================================================; ; editor_GetCursorPos ; Returns the PPU address of the cursor's current position editor_GetCursorPos: ; in the basic case, it goes like this: ; addr = $2000 ; addr += edcurDispX+1 ; easy ; addr += (edcurDispY * $20; <<5) ; need to account for upper NT addr ; say you're on row 8; 8<<5 is 256. ; You need to be able to store 4 bits of the overflow rts ;==============================================================================; ; editor_PrintLine ; Prints a line of text to the screen. editor_PrintLine: ; find current position rts ;==============================================================================; ; editor_UpdateCursorSprite ; Updates the cursor sprite. editor_UpdateCursorSprite: ; sprite X position lda edcurDispX ; multiply by 8 asl asl asl sta CURSOR_SPRITE_X ; sprite Y position lda edcurDispY ; multiply by 8 asl asl asl ; subtract 1 for proper positioning sec sbc #1 sta CURSOR_SPRITE_Y ; sprite frame lda #CURSOR_TILE_ON clc adc edcurBlink sta CURSOR_SPRITE_TILE ; sprite attributes ; todo: hide sprite behind letter when on non-solid frame? lda #%00000000 sta CURSOR_SPRITE_ATTR rts ;==============================================================================; ; editor_GetInput ; Gets input for this frame. editor_GetInput: ; --controller input-- jsr io_ReadJoySafe ; check which keyboard is active and get its input accordingly lda activeKBType bne @hwKeyboard ; --software keyboard input-- ; soft keyboard input relies on the joypad input jmp softkb_Input @hwKeyboard: ; --hardware keyboard input-- ; get ReadKeys routine from the jump table lda hardkbJumpTable sta tmp00 iny lda hardkbJumpTable+1 sta tmp01 ; set up routine ldy #KBROUTINE_GETKEYS lda (tmp00),y sta tmp02 iny lda (tmp00),y sta tmp03 ; do ReadKeys jmp (tmp02) ;==============================================================================; ; editor_HandleInput ; Handles the input editor_HandleInput: ; oh boy this is going to be fun! ; --joypad-- ; we only need a few things here ; --software keyboard-- @handleInput_SoftKB: ;jsr softkb_Input ; --hardware keyboard-- @handleInput_HWKB: ; [SPECIAL KEYS] ; Enter: typically sends the current line to the command parser rts ;==============================================================================; ; editor_ClearLineBuf ; Clears the contents of the line buffer. editor_ClearLineBuf: lda #0 ldx #30 @clearBuf: sta curLineBuf,x dex bpl @clearBuf rts
src/util/icon/asm_justrg.asm
olifink/qspread
0
176818
* Sprite justrg * * Mode 4 * +|-----------------+ * - g - * | gggggg | * | g | * | | * |wwwwwwwwwwwwwwwwww| * |wrrrrrrrrrrrrrrrrw| * |wrrrrrrrrwrrrrwrrw| * |wrrrrrrrrwrrrwrwrw| * |wrrrrrrrrwrrrwrwrw| * |wrrrrrrrrwrwrrwrrw| * |wrrrrrrrrrrrrrrrrw| * |wwwwwwwwwwwwwwwwww| * +|-----------------+ * section sprite xdef mes_justrg xref mes_zero mes_justrg dc.w $0100,$0000 dc.w 18,12,0,0 dc.l mcs_justrg-* dc.l mes_zero-* dc.l sp_justrg-* mcs_justrg dc.w $0000,$0100 dc.w $0000,$0000 dc.w $0000,$1F00 dc.w $8000,$0000 dc.w $0000,$0100 dc.w $0000,$0000 dc.w $0000,$0000 dc.w $0000,$0000 dc.w $FFFF,$FFFF dc.w $C0C0,$0000 dc.w $80FF,$00FF dc.w $40C0,$0000 dc.w $80FF,$42FF dc.w $40C0,$0000 dc.w $80FF,$45FF dc.w $40C0,$0000 dc.w $80FF,$45FF dc.w $40C0,$0000 dc.w $80FF,$52FF dc.w $40C0,$0000 dc.w $80FF,$00FF dc.w $40C0,$0000 dc.w $FFFF,$FFFF dc.w $C0C0,$0000 sp_justrg incbin 'win1_util_icon_asm_justrg_spr' * end
src/svd/sam_svd-gclk.ads
Fabien-Chouteau/samd51-hal
1
28097
<gh_stars>1-10 pragma Style_Checks (Off); -- This spec has been automatically generated from ATSAMD51G19A.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package SAM_SVD.GCLK is pragma Preelaborate; --------------- -- Registers -- --------------- -- Control type GCLK_CTRLA_Register is record -- Software Reset SWRST : Boolean := False; -- unspecified Reserved_1_7 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for GCLK_CTRLA_Register use record SWRST at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; end record; -- Generic Clock Generator Control n Synchronization Busy bits type SYNCBUSY_GENCTRLSelect is (-- Generic clock generator 0 GCLK0, -- Generic clock generator 1 GCLK1, -- Generic clock generator 2 GCLK2, -- Generic clock generator 3 GCLK3, -- Generic clock generator 4 GCLK4, -- Generic clock generator 5 GCLK5, -- Generic clock generator 6 GCLK6, -- Generic clock generator 7 GCLK7, -- Generic clock generator 8 GCLK8, -- Generic clock generator 9 GCLK9, -- Generic clock generator 10 GCLK10, -- Generic clock generator 11 GCLK11) with Size => 12; for SYNCBUSY_GENCTRLSelect use (GCLK0 => 1, GCLK1 => 2, GCLK2 => 4, GCLK3 => 8, GCLK4 => 16, GCLK5 => 32, GCLK6 => 64, GCLK7 => 128, GCLK8 => 256, GCLK9 => 512, GCLK10 => 1024, GCLK11 => 2048); -- Synchronization Busy type GCLK_SYNCBUSY_Register is record -- Read-only. Software Reset Synchroniation Busy bit SWRST : Boolean; -- unspecified Reserved_1_1 : HAL.Bit; -- Read-only. Generic Clock Generator Control n Synchronization Busy -- bits GENCTRL : SYNCBUSY_GENCTRLSelect; -- unspecified Reserved_14_31 : HAL.UInt18; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCLK_SYNCBUSY_Register use record SWRST at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; GENCTRL at 0 range 2 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; -- Source Select type GENCTRL_SRCSelect is (-- XOSC0 oscillator output XOSC0, -- XOSC1 oscillator output XOSC1, -- Generator input pad GCLKIN, -- Generic clock generator 1 output GCLKGEN1, -- OSCULP32K oscillator output OSCULP32K, -- XOSC32K oscillator output XOSC32K, -- DFLL output DFLL, -- DPLL0 output DPLL0, -- DPLL1 output DPLL1) with Size => 4; for GENCTRL_SRCSelect use (XOSC0 => 0, XOSC1 => 1, GCLKIN => 2, GCLKGEN1 => 3, OSCULP32K => 4, XOSC32K => 5, DFLL => 6, DPLL0 => 7, DPLL1 => 8); -- Divide Selection type GENCTRL_DIVSELSelect is (-- Divide input directly by divider factor DIV1, -- Divide input by 2^(divider factor+ 1) DIV2) with Size => 1; for GENCTRL_DIVSELSelect use (DIV1 => 0, DIV2 => 1); subtype GCLK_GENCTRL_DIV_Field is HAL.UInt16; -- Generic Clock Generator Control type GCLK_GENCTRL_Register is record -- Source Select SRC : GENCTRL_SRCSelect := SAM_SVD.GCLK.XOSC0; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; -- Generic Clock Generator Enable GENEN : Boolean := False; -- Improve Duty Cycle IDC : Boolean := False; -- Output Off Value OOV : Boolean := False; -- Output Enable OE : Boolean := False; -- Divide Selection DIVSEL : GENCTRL_DIVSELSelect := SAM_SVD.GCLK.DIV1; -- Run in Standby RUNSTDBY : Boolean := False; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; -- Division Factor DIV : GCLK_GENCTRL_DIV_Field := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCLK_GENCTRL_Register use record SRC at 0 range 0 .. 3; Reserved_4_7 at 0 range 4 .. 7; GENEN at 0 range 8 .. 8; IDC at 0 range 9 .. 9; OOV at 0 range 10 .. 10; OE at 0 range 11 .. 11; DIVSEL at 0 range 12 .. 12; RUNSTDBY at 0 range 13 .. 13; Reserved_14_15 at 0 range 14 .. 15; DIV at 0 range 16 .. 31; end record; -- Generic Clock Generator Control type GCLK_GENCTRL_Registers is array (0 .. 11) of GCLK_GENCTRL_Register; -- Generic Clock Generator type PCHCTRL_GENSelect is (-- Generic clock generator 0 GCLK0, -- Generic clock generator 1 GCLK1, -- Generic clock generator 2 GCLK2, -- Generic clock generator 3 GCLK3, -- Generic clock generator 4 GCLK4, -- Generic clock generator 5 GCLK5, -- Generic clock generator 6 GCLK6, -- Generic clock generator 7 GCLK7, -- Generic clock generator 8 GCLK8, -- Generic clock generator 9 GCLK9, -- Generic clock generator 10 GCLK10, -- Generic clock generator 11 GCLK11) with Size => 4; for PCHCTRL_GENSelect use (GCLK0 => 0, GCLK1 => 1, GCLK2 => 2, GCLK3 => 3, GCLK4 => 4, GCLK5 => 5, GCLK6 => 6, GCLK7 => 7, GCLK8 => 8, GCLK9 => 9, GCLK10 => 10, GCLK11 => 11); -- Peripheral Clock Control type GCLK_PCHCTRL_Register is record -- Generic Clock Generator GEN : PCHCTRL_GENSelect := SAM_SVD.GCLK.GCLK0; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- Channel Enable CHEN : Boolean := False; -- Write Lock WRTLOCK : Boolean := False; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for GCLK_PCHCTRL_Register use record GEN at 0 range 0 .. 3; Reserved_4_5 at 0 range 4 .. 5; CHEN at 0 range 6 .. 6; WRTLOCK at 0 range 7 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- Peripheral Clock Control type GCLK_PCHCTRL_Registers is array (0 .. 47) of GCLK_PCHCTRL_Register; ----------------- -- Peripherals -- ----------------- -- Generic Clock Generator type GCLK_Peripheral is record -- Control CTRLA : aliased GCLK_CTRLA_Register; -- Synchronization Busy SYNCBUSY : aliased GCLK_SYNCBUSY_Register; -- Generic Clock Generator Control GENCTRL : aliased GCLK_GENCTRL_Registers; -- Peripheral Clock Control PCHCTRL : aliased GCLK_PCHCTRL_Registers; end record with Volatile; for GCLK_Peripheral use record CTRLA at 16#0# range 0 .. 7; SYNCBUSY at 16#4# range 0 .. 31; GENCTRL at 16#20# range 0 .. 383; PCHCTRL at 16#80# range 0 .. 1535; end record; -- Generic Clock Generator GCLK_Periph : aliased GCLK_Peripheral with Import, Address => GCLK_Base; end SAM_SVD.GCLK;
P6/data_P6_2/cal_I_test0.asm
alxzzhou/BUAA_CO_2020
1
175013
lui $1,41188 ori $1,$1,30946 lui $2,31900 ori $2,$2,15641 lui $3,4704 ori $3,$3,20900 lui $4,24212 ori $4,$4,49289 lui $5,23409 ori $5,$5,24126 lui $6,1846 ori $6,$6,39808 mthi $1 mtlo $2 sec0: nop nop nop addiu $6,$2,30994 sec1: nop nop sltu $2,$3,$2 addiu $5,$2,23381 sec2: nop nop andi $2,$3,19933 addiu $2,$2,1708 sec3: nop nop mflo $2 addiu $5,$2,-26186 sec4: nop nop lbu $2,6($0) addiu $3,$2,24556 sec5: nop or $2,$5,$4 nop addiu $5,$2,-22212 sec6: nop nor $2,$1,$2 nor $2,$4,$4 addiu $0,$2,-21708 sec7: nop subu $2,$4,$3 ori $2,$3,18228 addiu $2,$2,12441 sec8: nop nor $2,$1,$3 mfhi $2 addiu $2,$2,13948 sec9: nop and $2,$3,$0 lb $2,14($0) addiu $3,$2,-3573 sec10: nop lui $2,13714 nop addiu $2,$2,7372 sec11: nop lui $2,65290 nor $2,$4,$2 addiu $4,$2,-24234 sec12: nop ori $2,$4,6251 addiu $2,$2,17650 addiu $3,$2,-27498 sec13: nop lui $2,48014 mflo $2 addiu $5,$2,-18600 sec14: nop addiu $2,$3,23068 lhu $2,4($0) addiu $4,$2,3799 sec15: nop mflo $2 nop addiu $2,$2,2694 sec16: nop mflo $2 and $2,$4,$4 addiu $0,$2,23536 sec17: nop mfhi $2 ori $2,$3,42239 addiu $4,$2,14547 sec18: nop mflo $2 mflo $2 addiu $5,$2,-7365 sec19: nop mflo $2 lw $2,12($0) addiu $1,$2,-26369 sec20: nop lb $2,5($0) nop addiu $5,$2,3841 sec21: nop lh $2,10($0) subu $2,$0,$5 addiu $2,$2,2297 sec22: nop lh $2,8($0) xori $2,$5,42868 addiu $1,$2,8403 sec23: nop lhu $2,6($0) mfhi $2 addiu $5,$2,-24401 sec24: nop lhu $2,14($0) lbu $2,6($0) addiu $0,$2,5406 sec25: sltu $2,$1,$4 nop nop addiu $2,$2,-5518 sec26: slt $2,$1,$3 nop xor $2,$4,$2 addiu $3,$2,-18485 sec27: xor $2,$2,$5 nop slti $2,$4,-15443 addiu $4,$2,-8427 sec28: nor $2,$4,$5 nop mflo $2 addiu $4,$2,-24912 sec29: and $2,$3,$2 nop lbu $2,10($0) addiu $4,$2,30719 sec30: xor $2,$3,$3 subu $2,$5,$4 nop addiu $6,$2,-14497 sec31: slt $2,$5,$1 subu $2,$2,$6 xor $2,$5,$1 addiu $6,$2,-9402 sec32: addu $2,$3,$3 nor $2,$3,$4 sltiu $2,$4,19561 addiu $1,$2,5418 sec33: or $2,$1,$3 subu $2,$3,$0 mfhi $2 addiu $4,$2,21155 sec34: slt $2,$5,$3 or $2,$3,$5 lb $2,0($0) addiu $3,$2,-28066 sec35: sltu $2,$1,$1 addiu $2,$2,-27448 nop addiu $3,$2,-20783 sec36: sltu $2,$3,$3 lui $2,4924 or $2,$4,$2 addiu $4,$2,-19811 sec37: nor $2,$3,$1 slti $2,$3,12166 xori $2,$4,39761 addiu $3,$2,8525 sec38: or $2,$1,$3 xori $2,$2,7008 mflo $2 addiu $1,$2,27883 sec39: addu $2,$4,$1 ori $2,$0,15475 lhu $2,10($0) addiu $2,$2,3568 sec40: xor $2,$3,$3 mflo $2 nop addiu $3,$2,11624 sec41: or $2,$1,$1 mflo $2 nor $2,$0,$3 addiu $4,$2,-5799 sec42: and $2,$2,$2 mflo $2 sltiu $2,$4,-900 addiu $5,$2,4017 sec43: and $2,$2,$6 mfhi $2 mfhi $2 addiu $4,$2,-31183 sec44: sltu $2,$4,$3 mflo $2 lhu $2,2($0) addiu $4,$2,26484 sec45: or $2,$1,$3 lh $2,12($0) nop addiu $3,$2,29415 sec46: nor $2,$4,$2 lh $2,8($0) addu $2,$6,$4 addiu $0,$2,-11704 sec47: or $2,$2,$6 lh $2,14($0) xori $2,$4,20579 addiu $3,$2,-24290 sec48: and $2,$3,$3 lbu $2,7($0) mflo $2 addiu $3,$2,9276 sec49: subu $2,$4,$3 lw $2,4($0) lb $2,11($0) addiu $1,$2,-11151 sec50: lui $2,9594 nop nop addiu $4,$2,-1078 sec51: xori $2,$2,11181 nop xor $2,$3,$5 addiu $3,$2,-2519 sec52: andi $2,$2,7108 nop slti $2,$4,-5619 addiu $3,$2,9577 sec53: xori $2,$4,42575 nop mfhi $2 addiu $1,$2,14680 sec54: slti $2,$3,-31786 nop lbu $2,4($0) addiu $4,$2,-26725 sec55: addiu $2,$3,-6095 addu $2,$2,$6 nop addiu $3,$2,21136 sec56: lui $2,49810 slt $2,$3,$1 nor $2,$3,$4 addiu $2,$2,26431 sec57: addiu $2,$3,32002 slt $2,$6,$3 andi $2,$5,12205 addiu $2,$2,-28389 sec58: sltiu $2,$4,-8677 slt $2,$4,$2 mflo $2 addiu $3,$2,-21716 sec59: xori $2,$4,20850 slt $2,$2,$1 lbu $2,15($0) addiu $1,$2,16239 sec60: addiu $2,$1,12010 lui $2,44136 nop addiu $3,$2,23598 sec61: ori $2,$4,9485 sltiu $2,$2,23053 or $2,$3,$0 addiu $3,$2,23728 sec62: addiu $2,$6,3688 lui $2,64938 xori $2,$2,40933 addiu $3,$2,21867 sec63: addiu $2,$2,-4932 addiu $2,$3,19612 mfhi $2 addiu $0,$2,-29753 sec64: addiu $2,$1,2757 addiu $2,$4,10297 lbu $2,10($0) addiu $4,$2,-10161 sec65: addiu $2,$6,-1977 mfhi $2 nop addiu $0,$2,10221 sec66: addiu $2,$2,-13110 mflo $2 or $2,$3,$3 addiu $4,$2,16796 sec67: lui $2,29915 mfhi $2 andi $2,$4,52455 addiu $3,$2,2668 sec68: sltiu $2,$4,-967 mfhi $2 mfhi $2 addiu $2,$2,9824 sec69: andi $2,$3,39706 mfhi $2 lhu $2,2($0) addiu $6,$2,27163 sec70: addiu $2,$0,-3548 lhu $2,6($0) nop addiu $2,$2,-5411 sec71: ori $2,$4,12898 lh $2,14($0) addu $2,$5,$3 addiu $2,$2,-26603 sec72: andi $2,$5,9048 lbu $2,16($0) xori $2,$3,36748 addiu $4,$2,534 sec73: sltiu $2,$6,1522 lhu $2,14($0) mfhi $2 addiu $4,$2,26718 sec74: slti $2,$1,27642 lb $2,13($0) lh $2,0($0) addiu $2,$2,18775 sec75: mflo $2 nop nop addiu $6,$2,3866 sec76: mflo $2 nop xor $2,$5,$3 addiu $2,$2,2112 sec77: mfhi $2 nop sltiu $2,$3,-25934 addiu $3,$2,25278 sec78: mfhi $2 nop mflo $2 addiu $1,$2,8472 sec79: mflo $2 nop lb $2,3($0) addiu $2,$2,24665 sec80: mflo $2 subu $2,$5,$3 nop addiu $5,$2,-25527 sec81: mfhi $2 sltu $2,$6,$4 addu $2,$1,$0 addiu $2,$2,-1383 sec82: mfhi $2 subu $2,$4,$3 slti $2,$4,12175 addiu $1,$2,-28491 sec83: mfhi $2 sltu $2,$5,$3 mfhi $2 addiu $4,$2,22754 sec84: mfhi $2 and $2,$4,$1 lb $2,6($0) addiu $5,$2,-32316 sec85: mfhi $2 slti $2,$4,-9377 nop addiu $2,$2,18547 sec86: mflo $2 xori $2,$5,51015 sltu $2,$4,$5 addiu $6,$2,11402 sec87: mfhi $2 addiu $2,$2,-8989 addiu $2,$2,17469 addiu $2,$2,-9572 sec88: mfhi $2 andi $2,$1,33629 mfhi $2 addiu $4,$2,-6797 sec89: mflo $2 andi $2,$0,65130 lhu $2,8($0) addiu $4,$2,-18949 sec90: mflo $2 mfhi $2 nop addiu $2,$2,20451 sec91: mfhi $2 mfhi $2 or $2,$4,$5 addiu $4,$2,-29840 sec92: mflo $2 mflo $2 ori $2,$3,18963 addiu $4,$2,25373 sec93: mflo $2 mflo $2 mflo $2 addiu $2,$2,-26679 sec94: mflo $2 mflo $2 lbu $2,16($0) addiu $2,$2,-16695 sec95: mflo $2 lhu $2,4($0) nop addiu $4,$2,6380 sec96: mflo $2 lhu $2,8($0) sltu $2,$3,$6 addiu $3,$2,-596 sec97: mfhi $2 lw $2,0($0) andi $2,$6,47388 addiu $5,$2,-16472 sec98: mfhi $2 lw $2,16($0) mflo $2 addiu $2,$2,-589 sec99: mfhi $2 lh $2,6($0) lw $2,4($0) addiu $2,$2,-32683 sec100: lb $2,15($0) nop nop addiu $3,$2,-17855 sec101: lw $2,0($0) nop and $2,$2,$6 addiu $2,$2,23145 sec102: lb $2,5($0) nop ori $2,$3,60348 addiu $3,$2,25431 sec103: lw $2,8($0) nop mfhi $2 addiu $2,$2,-10917 sec104: lhu $2,14($0) nop lh $2,8($0) addiu $2,$2,9971 sec105: lhu $2,6($0) nor $2,$3,$2 nop addiu $2,$2,16953 sec106: lh $2,16($0) slt $2,$3,$4 addu $2,$3,$3 addiu $4,$2,28608 sec107: lbu $2,1($0) nor $2,$3,$2 lui $2,52579 addiu $2,$2,20347 sec108: lb $2,13($0) slt $2,$6,$2 mflo $2 addiu $3,$2,16535 sec109: lw $2,4($0) or $2,$5,$4 lw $2,16($0) addiu $2,$2,20595 sec110: lw $2,12($0) addiu $2,$4,-714 nop addiu $4,$2,-16394 sec111: lbu $2,3($0) lui $2,42445 and $2,$3,$4 addiu $3,$2,6398 sec112: lb $2,7($0) sltiu $2,$5,19014 ori $2,$3,49826 addiu $0,$2,24500 sec113: lw $2,8($0) xori $2,$4,6278 mfhi $2 addiu $2,$2,12911 sec114: lw $2,16($0) xori $2,$3,22394 lh $2,8($0) addiu $5,$2,7104 sec115: lh $2,8($0) mfhi $2 nop addiu $4,$2,-1162 sec116: lb $2,15($0) mflo $2 nor $2,$3,$4 addiu $5,$2,2992 sec117: lhu $2,0($0) mfhi $2 xori $2,$5,6149 addiu $4,$2,23393 sec118: lbu $2,0($0) mfhi $2 mflo $2 addiu $1,$2,20336 sec119: lw $2,4($0) mfhi $2 lbu $2,15($0) addiu $3,$2,-27965 sec120: lbu $2,9($0) lw $2,0($0) nop addiu $4,$2,24932 sec121: lh $2,4($0) lbu $2,16($0) nor $2,$0,$2 addiu $3,$2,4619 sec122: lh $2,4($0) lh $2,14($0) andi $2,$5,3585 addiu $2,$2,-22202 sec123: lhu $2,14($0) lh $2,12($0) mfhi $2 addiu $5,$2,-13135 sec124: lhu $2,12($0) lw $2,8($0) lw $2,8($0) addiu $3,$2,17304
src/Relation/Ternary/Separation/Monad/Error.agda
laMudri/linear.agda
34
10781
<filename>src/Relation/Ternary/Separation/Monad/Error.agda open import Relation.Unary open import Relation.Ternary.Separation module Relation.Ternary.Separation.Monad.Error {ℓ} {A : Set ℓ} {{r : RawSep A}} {u} {{_ : IsUnitalSep r u}} where open import Level open import Function open import Data.Unit open import Data.Sum open import Relation.Unary renaming (U to True) open import Relation.Unary.PredicateTransformer using (PT; Pt) open import Relation.Ternary.Separation.Morphisms open import Relation.Ternary.Separation.Monad open import Relation.Binary.PropositionalEquality module _ where record ExceptT (M : Pt A ℓ) (E : Set ℓ) (P : Pred A ℓ) (Φ : A) : Set ℓ where constructor partial field runErr : M ((λ _ → E) ∪ P) Φ open ExceptT public open import Relation.Ternary.Separation.Monad.Identity Except : ∀ E → Pt A ℓ Except E = ExceptT Identity.Id E pattern error e = partial (inj₁ e) pattern ✓ x = partial (inj₂ x) data Err : Set ℓ where err : Err ErrorT : (M : Pt A ℓ) {{monad : Monads.Monad ⊤ ℓ (λ _ _ → M) }} → Pt A ℓ ErrorT M = ExceptT M Err open import Relation.Ternary.Separation.Monad.Identity Error : Pt A ℓ Error = ErrorT Identity.Id module ExceptTrans (M : Pt A ℓ) {{monad : Monads.Monad ⊤ ℓ (λ _ _ → M) }} (Exc : Set ℓ) where open Monads instance except-monad : Monad ⊤ ℓ (λ _ _ → ExceptT M Exc) runErr (Monad.return except-monad px) = return (inj₂ px) runErr (app (Monad.bind except-monad f) (partial mpx) σ) = do inj₂ px ×⟨ σ₂ ⟩ f ← mpx &⟨ _ ─✴ _ ∥ ⊎-comm σ ⟩ f where (inj₁ e ×⟨ σ₂ ⟩ f) → return (inj₁ e) case app f px (⊎-comm σ₂) of λ where (partial z) → z mapExc : ∀ {E₁ E₂ P} → (E₁ → E₂) → ∀[ ExceptT M E₁ P ⇒ ExceptT M E₂ P ] mapExc f (partial mc) = partial (mapM mc λ where (inj₁ e) → inj₁ (f e); (inj₂ px) → inj₂ px) module ExceptMonad (Exc : Set ℓ) where open import Relation.Ternary.Separation.Monad.Identity open ExceptTrans Identity.Id {{ Identity.id-monad }} Exc public module ErrorTrans (M : Pt A ℓ) {{monad : Monads.Monad ⊤ ℓ (λ _ _ → M) }} where open import Relation.Ternary.Separation.Monad.Identity open ExceptTrans M {{ monad }} Err public renaming (except-monad to error-monad) module ErrorMonad where open import Relation.Ternary.Separation.Monad.Identity open ExceptTrans Identity.Id {{ Identity.id-monad }} Err public renaming (except-monad to error-monad)
src/arch/socs/stm32f439/soc-nvic.adb
PThierry/ewok-kernel
0
30813
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- package body soc.nvic with spark_mode => off is function to_irq_number (intr : soc.interrupts.t_interrupt) return t_irq_index is begin return t_irq_index'val (soc.interrupts.t_interrupt'pos (intr) - 16); end to_irq_number; procedure enable_irq (irq : in t_irq_index) is begin case irq is when 0 .. 31 => NVIC.ISER0.irq(irq) := IRQ_ENABLED; when 32 .. 63 => NVIC.ISER1.irq(irq) := IRQ_ENABLED; when 64 .. 80 => NVIC.ISER2.irq(irq) := IRQ_ENABLED; end case; end enable_irq; procedure clear_pending_irq (irq : in t_irq_index) is begin case irq is when 0 .. 31 => NVIC.ICPR0.irq(irq) := CLEAR_PENDING; when 32 .. 63 => NVIC.ICPR1.irq(irq) := CLEAR_PENDING; when 64 .. 80 => NVIC.ICPR2.irq(irq) := CLEAR_PENDING; end case; end clear_pending_irq; end soc.nvic;
theorems/homotopy/SuspProduct.agda
cmknapp/HoTT-Agda
0
14058
<reponame>cmknapp/HoTT-Agda<gh_stars>0 {-# OPTIONS --without-K #-} open import HoTT open import homotopy.SuspSectionDecomp open import homotopy.CofiberComp module homotopy.SuspProduct where module SuspProduct {i} {j} (X : Ptd i) (Y : Ptd j) where private i₁ : fst (X ⊙→ X ⊙× Y) i₁ = ((λ x → (x , snd Y)) , idp) i₂ : fst (Y ⊙→ X ⊙× Y) i₂ = ((λ y → (snd X , y)) , idp) j₂ : fst (⊙Cof i₁) → fst Y j₂ = CofiberRec.f (snd Y) snd (λ x → idp) ⊙path : ⊙Susp (X ⊙× Y) == ⊙Susp X ⊙∨ (⊙Susp Y ⊙∨ ⊙Susp (X ⊙∧ Y)) ⊙path = ⊙ua (⊙≃-in (SuspSectionDecomp.eq i₁ fst (λ x → idp)) (! $ ap winl $ merid (snd X))) ∙ ap (λ Z → ⊙Susp X ⊙∨ Z) (⊙ua (⊙≃-in (SuspSectionDecomp.eq (⊙cfcod' i₁ ⊙∘ i₂) j₂ (λ y → idp)) (! $ ap winl $ merid (snd Y)))) ∙ ap (λ Z → ⊙Susp X ⊙∨ (⊙Susp Y ⊙∨ ⊙Susp Z)) (CofiberComp.⊙path i₁ i₂)
oeis/028/A028158.asm
neoneye/loda-programs
11
84498
; A028158: Expansion of 1/((1-4x)(1-8x)(1-10x)(1-11x)). ; Submitted by <NAME> ; 1,33,695,11925,181911,2572893,34540735,446515125,5610825671,68978848653,833511432975,9933242415525,117049255275031,1366477139586813,15829397675656415,182175233504671125,2085009104934341991,23750419100554859373,269443828297173915055 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,19742 ; Expansion of 1/((1-4x)(1-10x)(1-11x)). mul $1,8 add $1,$0 lpe mov $0,$1
data/maps/scenes.asm
AtmaBuster/pokeplat-gen2
6
246553
<reponame>AtmaBuster/pokeplat-gen2 scene_var: MACRO ; map, variable map_id \1 dw \2 ENDM MapScenes:: scene_var DEBUG_ROOM, wDebugRoomSceneID scene_var POKECENTER_2F, wPokecenter2FSceneID scene_var TRADE_CENTER, wTradeCenterSceneID scene_var COLOSSEUM, wColosseumSceneID scene_var TIME_CAPSULE, wTimeCapsuleSceneID scene_var MOBILE_TRADE_ROOM, wMobileTradeRoomSceneID scene_var MOBILE_BATTLE_ROOM, wMobileBattleRoomSceneID scene_var PLAYERS_HOUSE_2F, wPlayersHouse2FSceneID scene_var PLAYERS_HOUSE_1F, wPlayersHouse1FSceneID scene_var TWINLEAF_TOWN, wTwinleafTownSceneID scene_var RIVAL_HOUSE_2F, wRivalHouse2FSceneID scene_var ROUTE_201, wRoute201SceneID scene_var LAKE_VERITY_LOW, wLakeVerityLowSceneID scene_var SANDGEM_TOWN, wSandgemTownSceneID scene_var ROWANS_LAB, wRowansLabSceneID scene_var ROUTE_202, wRoute202SceneID scene_var JUBILIFE_CITY, wJubilifeCitySceneID scene_var ROUTE_203, wRoute203SceneID scene_var OREBURGH_GATE_1F, wOreburghGate1FSceneID scene_var OREBURGH_GYM, wOreburghGymSceneID scene_var OREBURGH_CITY, wOreburghCitySceneID db -1 ; end
Transynther/x86/_processed/NC/_st_zr_sm_/i3-7100_9_0xca_notsx.log_21829_1869.asm
ljhsiun2/medusa
9
171641
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x9953, %rbx add %r11, %r11 vmovups (%rbx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r13 nop nop nop nop inc %rbp lea addresses_D_ht+0x17aab, %rsi lea addresses_WC_ht+0x4e4b, %rdi nop and $44023, %rdx mov $5, %rcx rep movsw nop nop mfence lea addresses_WT_ht+0x2c2b, %r13 nop nop nop nop nop and $21936, %rdi mov $0x6162636465666768, %rdx movq %rdx, (%r13) nop nop nop nop nop xor $45989, %rsi lea addresses_WC_ht+0x1cc2b, %rsi lea addresses_D_ht+0xc062, %rdi nop nop nop and %rbx, %rbx mov $112, %rcx rep movsl nop dec %rdi lea addresses_WC_ht+0xb68b, %rbp nop nop nop nop nop and $55263, %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm0 vmovups %ymm0, (%rbp) nop nop nop nop nop xor $52641, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r9 push %rax push %rbx push %rcx // Store lea addresses_D+0x10ddb, %rcx nop sub %r15, %r15 movl $0x51525354, (%rcx) // Exception!!! nop nop nop mov (0), %rcx xor %r10, %r10 // Store lea addresses_A+0x6193, %r15 nop nop nop inc %rax movl $0x51525354, (%r15) nop nop nop nop cmp %r9, %r9 // Store lea addresses_D+0x1b63f, %rax nop nop nop nop xor %r10, %r10 mov $0x5152535455565758, %rbx movq %rbx, %xmm3 vmovups %ymm3, (%rax) nop nop nop nop dec %r10 // Store lea addresses_US+0x1ca2b, %r10 clflush (%r10) nop nop nop nop nop xor %r15, %r15 mov $0x5152535455565758, %r11 movq %r11, %xmm3 movaps %xmm3, (%r10) nop nop nop xor %rcx, %rcx // Store mov $0x260622000000062b, %rbx nop nop nop nop nop xor $32247, %rcx mov $0x5152535455565758, %rax movq %rax, (%rbx) // Exception!!! nop nop mov (0), %r11 nop nop nop xor %r11, %r11 // Store lea addresses_D+0x422b, %r10 nop nop nop nop nop xor $17873, %rcx movb $0x51, (%r10) inc %r15 // Store mov $0x136a400000000feb, %rcx nop nop add $32432, %r9 mov $0x5152535455565758, %rax movq %rax, %xmm2 vmovups %ymm2, (%rcx) // Exception!!! nop nop nop nop mov (0), %r15 nop dec %rbx // Faulty Load mov $0x260622000000062b, %r10 nop inc %rcx mov (%r10), %r15 lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rcx pop %rbx pop %rax pop %r9 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': True, 'type': 'addresses_A', 'size': 4, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_US', 'size': 16, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}} {'58': 12920, '00': 8909} 58 00 58 58 00 58 58 58 58 00 00 58 58 58 58 00 58 00 58 58 00 58 00 00 00 58 58 00 58 00 00 58 58 58 58 00 58 00 58 00 58 58 58 00 58 00 58 00 58 00 00 58 58 58 58 58 00 58 00 58 00 00 00 58 58 00 00 58 00 58 58 58 58 58 58 00 00 00 58 58 58 00 58 00 00 58 58 00 00 58 00 58 58 58 00 00 58 58 00 58 58 00 58 00 00 00 58 00 00 58 00 58 58 58 00 00 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 58 00 00 58 58 00 58 58 58 00 58 58 00 58 58 58 00 58 00 00 58 58 58 58 00 58 00 58 00 58 58 00 00 58 00 58 00 58 00 00 58 58 58 00 58 00 58 58 00 00 58 58 00 00 00 00 00 58 00 58 58 58 00 58 00 58 58 58 00 58 58 00 58 58 58 58 00 58 58 00 58 00 00 58 00 58 00 00 58 00 58 58 58 58 00 58 00 58 00 58 00 58 00 00 00 58 58 58 00 00 00 58 58 58 00 58 58 58 58 00 58 58 58 00 00 00 00 00 58 58 00 58 58 58 00 58 58 58 00 00 58 00 58 58 00 58 58 58 00 00 58 58 00 58 00 58 00 58 00 58 00 00 58 58 00 58 58 58 58 58 00 58 58 58 58 00 58 00 58 58 00 00 00 00 58 00 58 58 58 58 58 58 00 58 58 58 58 58 00 00 00 58 58 58 58 00 58 00 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 00 00 58 58 58 58 00 58 58 00 58 00 58 00 00 00 58 58 58 00 58 58 58 00 58 58 58 58 58 58 58 58 00 00 00 58 58 00 58 00 00 00 58 58 58 00 58 58 58 00 58 00 58 00 00 00 58 00 58 58 58 58 58 58 00 00 00 58 00 58 58 00 58 58 00 58 58 00 58 00 58 00 58 00 00 58 00 58 00 00 58 00 58 00 58 58 58 58 58 58 58 58 00 00 00 00 58 00 00 58 58 00 00 58 58 58 58 00 58 58 58 58 58 58 00 58 00 58 58 00 58 00 58 58 00 58 00 58 00 00 58 58 58 58 00 58 58 58 00 58 58 00 00 00 58 58 58 58 58 58 00 58 00 58 58 00 58 58 00 00 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 00 58 58 58 58 00 58 58 00 00 58 58 00 58 00 58 58 00 00 58 58 58 58 58 58 00 58 58 00 58 00 00 58 58 00 58 58 58 58 00 58 00 58 58 58 00 58 00 58 58 58 58 00 58 58 58 58 58 00 58 00 00 58 58 00 58 58 58 00 58 58 58 58 00 00 58 58 00 00 58 58 00 00 58 58 58 00 58 00 58 58 00 58 58 00 58 58 00 58 00 00 58 58 58 58 58 00 58 58 58 58 58 58 00 00 58 58 58 00 00 58 00 58 58 58 58 58 58 58 58 00 00 58 00 58 00 00 58 00 58 58 58 58 58 00 58 00 58 00 58 00 58 58 00 58 58 58 58 00 00 58 58 00 58 58 00 00 58 00 00 58 58 00 58 58 58 00 00 58 58 58 58 00 00 58 00 58 58 00 00 00 58 00 58 58 00 58 58 58 00 58 58 58 00 58 00 58 00 58 00 58 00 00 00 00 00 58 00 58 58 58 58 58 00 00 58 00 58 00 00 58 58 00 58 58 58 00 58 58 58 00 58 58 58 58 00 00 58 58 00 58 00 00 00 58 00 00 00 58 00 58 58 58 58 58 00 58 58 58 58 58 58 00 58 00 00 00 00 58 58 00 58 00 58 00 00 58 00 00 58 58 00 00 58 00 00 58 00 58 00 58 58 00 58 58 58 00 00 00 58 00 58 58 58 00 00 00 00 00 58 00 58 00 58 00 00 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 00 00 58 00 58 58 00 58 00 58 58 58 00 58 00 00 58 58 58 00 00 58 58 00 00 58 58 58 00 58 00 00 58 00 00 00 00 58 00 58 00 58 58 00 58 00 00 00 00 58 00 00 58 58 00 58 58 58 58 00 00 58 00 00 00 58 58 58 58 58 58 58 58 58 58 00 00 00 00 58 00 00 58 00 00 00 58 58 58 58 58 58 58 00 58 58 00 00 58 00 00 00 58 00 58 58 58 58 */
src/rec.asm
Hacktix/gbctv
14
89025
SECTION "Recording", ROM0 ;------------------------------------------------------------------------ ; Waits for a HIGH IR signal to start recording signal data and storing ; it on the currently selected SRAM bank. ;------------------------------------------------------------------------ StartRecording:: ; Disable Interrupts di ; Set recording icon ld hl, ADDR_SYMBOL_A ld a, REC_SYMBOL_TILENO ld [hl], a ; Initialize IR reading ld a, RPF_ENREAD ld [rRP], a ; Wait for first signal to arrive .recordWaitLoop ld a, [rRP] bit 1, a jp nz, .recordWaitLoop ; Initialize system for high-speed IR reading ld a, KEY1F_PREPARE ld [rKEY1], a stop ; Double-speed mode ld hl, wRecordingBase ; Pre-load RAM pointer ld a, LOW(rRP) ld c, a ; Load pointer for LDH [$ff00 + C] ld a, HIGH(_RAM) ld b, a ; Pre-load CP value for upper RAM boundary ; Higher performance due to register-based CP ; Record until RAM is full .recordLoop ldh a, [c] ld [hli], a ld a, h cp b jr nz, .recordLoop ; Stop double speed mode ld a, KEY1F_PREPARE ld [rKEY1], a stop ; Disable IR Read & Write xor a ld [rRP], a ; Post-process recorded inputs call PostProcessRecording ; Re-enable interrupts and return to menu loop call InitInterrupts jp MenuLoop ;------------------------------------------------------------------------ ; Should be called after each recording. Iterates over all "raw" IR-reg ; input byte values and converts them to values that can be written to ; the register to output the recorded signal. ;------------------------------------------------------------------------ PostProcessRecording:: ; Load base pointer ld hl, wRecordingBase .postProcessingLoop ; Process recorded byte ld a, [hl] xor $ff ; Flip bits (Input 1 = Low Signal, Input 0 = High Signal) and RPF_DATAIN ; Zero out all bits other than the actual data bit rra ; Shift input-bit right by one to output bit ld [hli], a ; Overwrite original value in SRAM ; Check if end of SRAM is reached ld a, h cp b jr nz, .postProcessingLoop ret
grammar/env.g4
cicorias/cpp-dotenv
0
3559
grammar dotenv; env : line_content (NL line_content)* EOF ; // FIRST: SP, UNQUOTED_KEY_CHAR, '"', '\'', CS, NL, EOF // FOLLOW: - line_content : SP* (key SP* EQ SP* value SP*)? comment? ; // FIRST: SP, UNQUOTED_KEY_CHAR, '"', '\'', CS, 3 // FOLLOW: NL, EOF key : UNQUOTED_KEY | '\''SINGLE_UNQUOTED_STRING '\'' | '"' DOUBLE_UNQUOTED_STRING '"' ; // FIRST: UNQUOTED_KEY_CHAR, '"', '\'' // FOLLOW: SP, EQ value : UNQUOTED_VALUE | ('\''SINGLE_UNQUOTED_STRING '\'') | ('"' DOUBLE_UNQUOTED_STRING '"') | ; // FIRST: UNQUOTED_VALUE_CHAR, '"', '\'', 3 // FOLLOW: SP, CS, NL, EOF comment : CS UNQUOTED_COMMENT ; // FIRST: CS // FOLLOW: NL, EOF STRING : '\''SINGLE_UNQUOTED_STRING? '\'' | '"' DOUBLE_UNQUOTED_STRING? '"' ; // FIRST: '"', '\'' // FOLLOW: SP, EQ, CS, NL, EOF fragment SINGLE_UNQUOTED_STRING : ~['] ; fragment DOUBLE_UNQUOTED_STRING : ~["] ; UNQUOTED_KEY : UNQUOTED_KEY_CHAR+ ; // FIRST: UNQUOTED_KEY_CHAR // FOLLOW: SP, EQ fragment UNQUOTED_KEY_CHAR : ~[#= "'\t\n\r] ; UNQUOTED_VALUE : UNQUOTED_VALUE_CHAR+ ; // FIRST: UNQUOTED_VALUE_CHAR // FOLLOW: SP, CS, NL, EOF fragment UNQUOTED_VALUE_CHAR : ~[# "'\t\n\r] ; UNQUOTED_COMMENT : UNQUOTED_COMMENT_CHAR* ; // FIRST: UNQUOTED_COMMENT_CHAR // FOLLOW: NL, EOF fragment UNQUOTED_COMMENT_CHAR : ~[\n\r] ; CS : '#' ; EQ : '=' ; SP : ' ' | '\t' ; NL : '\r'? '\n' ;
FVIEW.asm
AvixSoft/Avix-486
0
176192
global mouse global printf global setdta global ffile group dgroup section code mouse: push bp mov bp,sp mov ax,[bp+12] int 33h mov si,[bp+10] mov [si],bx mov si,[bp+8] mov [si],cx mov si,[bp+6] mov [si],dx pop bp retf 8 printf: push bp mov bp,sp mov ax,0a000h mov fs,ax lgs di,[bp+6] mov dx,[bp+12] ;y mov ax,80 mul dx mov si,[bp+14] ;x shr si,3 add si,ax mov bx,[bp+10] mov cx,[bx] mov bx,[bx+2] label: push di ;cmp [bx],32 ;jb lbl ;cmp [bx],126 ;ja lbl mov ax,[bx] sub ax,32 mov dl,11 mul dl add di,ax push cx push si mov cx,11 label1: mov al,[gs:di] ;xor al,[fs:si] mov [fs:si],al add si,80 inc di loop label1 pop si pop cx lbl: pop di inc bx inc si loop label pop bp retf 10 setdta: push bp mov bp,sp push ds lds dx,[bp+6] mov ax,01a00h int 21h pop ds pop bp retf 4 ffile: push bp mov bp,sp mov dx,[bp+6] mov cx,[bp+8] mov si,[bp+10] mov ax,[si] int 21h mov [si],ax pop bp retf 6
libsrc/_DEVELOPMENT/arch/sms/vram/z80/asm_sms_memset_vram.asm
jpoikela/z88dk
640
175720
<filename>libsrc/_DEVELOPMENT/arch/sms/vram/z80/asm_sms_memset_vram.asm<gh_stars>100-1000 ; ======================================================================== ; ; void *sms_memset_vram(void *dst, unsigned char c, unsigned int n) ; ; memset VRAM; VRAM addresses are assumed to be stable. ; ; ======================================================================== SECTION code_clib SECTION code_crt_common PUBLIC asm_sms_memset_vram EXTERN asm_sms_vram_write_de EXTERN asm_sms_set_vram asm_sms_memset_vram: ; memset vram ; ; enter : de = void *dst in vram ; a = unsigned char c ; bc = unsigned int n > 0 ; ; exit : hl = void *dst, &byte after last written in vram ; bc = 0 ; ; uses : f, bc, de, hl ld l,a call asm_sms_vram_write_de ld a,l ex de,hl jp asm_sms_set_vram
src/lumen-window.ads
darkestkhan/lumen
8
24123
<filename>src/lumen-window.ads -- Lumen.Window -- Create and destroy native windows and associated OpenGL -- rendering contexts -- -- <NAME>, NiEstu, Phoenix AZ, Spring 2010 -- This code is covered by the ISC License: -- -- Copyright © 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- The software is provided "as is" and the author disclaims all warranties -- with regard to this software including all implied warranties of -- merchantability and fitness. In no event shall the author be liable for any -- special, direct, indirect, or consequential damages or any damages -- whatsoever resulting from loss of use, data or profits, whether in an -- action of contract, negligence or other tortious action, arising out of or -- in connection with the use or performance of this software. with Lumen.Events; use Lumen.Events; with Ada.Calendar; package Lumen.Window is -- A time that won't ever happen during the execution of a Lumen app Never : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (Year => Ada.Calendar.Year_Number'First, Month => Ada.Calendar.Month_Number'First, Day => Ada.Calendar.Day_Number'First); -- Exceptions defined by this package FailedToCreateContext : exception; -- The types of events that can be reported type Event_Type is (Unknown_Event, Key_Press, Key_Release, Button_Press, Button_Release, Pointer_Motion, Enter_Window, Leave_Window, Focus_In, Focus_Out, Exposed, Hidden, Resized, Close_Window); -- Raw keycode, not much use except at the very lowest level type Raw_Keycode is mod 2 ** Integer'Size; -- Rendering context's color depth type Color_Depth is (Pseudo_Color, True_Color); type Button_Enum is (Button_1, Button_2, Button_3, Button_4, Button_5, Button_6, Button_7, Button_8, Button_9); type Button_Set is array(Button_Enum) of Boolean; NoButtons : constant Button_Set := (others => False); type Event_Mouse_Down is access procedure (X : Integer; Y : Integer; Button : Button_Enum; Modifiers : Modifier_Set); type Event_Mouse_Up is access procedure (X : Integer; Y : Integer; Button : Button_Enum; Modifiers : Modifier_Set); type Event_Mouse_Move is access procedure (X : Integer; Y : Integer; Modifiers : Modifier_Set); type Event_Key_Press is access procedure (Category : Key_Category; Symbol : Key_Symbol; Modifiers : Modifier_Set); type Event_Key_Release is access procedure (Category : Key_Category; Symbol : Key_Symbol; Modifiers : Modifier_Set); type Event_Character is access procedure (Char : String; Modifiers : Modifier_Set); type Event_Exposed is access procedure (Top : Integer; Left : Integer; Height : Natural; Width : Natural); type Event_Resize is access procedure (Height : Integer; Width : Integer); type Window_Public is tagged record -- Public for Lumen-Events-Animate Prior_Frame : Ada.Calendar.Time := Never; SPF : Duration := 0.0; App_Frames : Long_Integer := 0; Last_Frames : Long_Integer := 0; Looping : Boolean := True; App_Start : Ada.Calendar.Time := Never; Last_Start : Ada.Calendar.Time := Never; -- Really Public Mouse_Down : Event_Mouse_Down := null; Mouse_Up : Event_Mouse_Up := null; Mouse_Move : Event_Mouse_Move := null; Key_Press : Event_Key_Press := null; Key_Release : Event_Key_Release := null; Character : Event_Character := null; Exposed : Event_Exposed := null; Resize : Event_Resize := null; end record; type Window_Type is new Window_Public with private; type Window_Handle is access all Window_Type'Class; -- Null window; in X, this means the root window is the parent No_Window : constant Window_Handle := null; -- Local exceptions raised by these procedures Connection_Failed : exception; -- can't connect to X server Context_Failed : exception; -- can't create or attach OpenGL context Not_Available : exception; -- can't find a visual with given attributes -- format of explicit visual ID (LUMEN_VISUAL_ID) is invalid Invalid_ID : exception; type Context_Attributes is record Red_Size : Integer; Green_Size : Integer; Blue_Size : Integer; Alpha_Size : Integer; Depth_Size : Integer; Stencil_Size : Integer; end record; Default_Context_Attributes : constant Context_Attributes:= (Red_Size => 8, Green_Size => 8, Blue_Size => 8, Alpha_Size => 8, Depth_Size => 24, Stencil_Size => 8); -- Create a native window, with defaults for configuration intended to -- create a "usable" window. Details about the parameters are: -- -- Win: Object into which the new window's handle will be stored. -- -- Parent: Handle of an existing window that will act as the new window's -- parent, or No_Window, meaning an independent top-level window. -- -- Width, Height: Window dimensions in pixels. -- -- Events: Set of events this window wishes to receive. -- -- Name: Name associated with new window, often displayed in the window's -- title bar. If blank, the executable's filename is used. -- -- Icon_Name: Name associated with the window's icon. If blank, the -- executable's filename is used. -- -- Class_Name, Instance_Name: Together these make up the window's "class". -- If blank, the class name is set to the executable's filename with -- initial capitalization; the instance name is set to the executable's -- filename. -- -- Context: An existing GL rendering context to be used in the new window, -- or No_Context, meaning a new context is created for the window. -- -- Depth: The color depth of the GL rendering context, either true-color or -- indexed/pseudo-color. -- -- Direct: Whether you want direct rendering or server-based rendering. -- -- Animated: Whether the GL rendering context will be double-buffered, thus -- allowing smooth animation. -- -- Attributes: The various graphic display ("visual") attributes which can -- be set. The defaults work for most modern systems. procedure Create (Win : in out Window_Handle; Parent : in Window_Handle := No_Window; Width : in Natural := 400; Height : in Natural := 400; Name : in String := ""; Icon_Name : in String := ""; Class_Name : in String := ""; Instance_Name : in String := ""; Depth : in Color_Depth := True_Color; Direct : in Boolean := True; Animated : in Boolean := True; Attributes : in Context_Attributes := Default_Context_Attributes); -- Destroy a native window, including its current rendering context. procedure Destroy (Win : in out Window_Handle); -- Set various textual names associated with a window. Null string means -- leave the current value unchanged; procedure Set_Names (Win : in Window_Handle; Name : in String := ""; Icon_Name : in String := ""; Class_Name : in String := ""; Instance_Name : in String := ""); -- Select a window to use for subsequent OpenGL calls procedure Make_Current (Win : in Window_Handle); -- Promotes the back buffer to front; only valid if the window is double -- buffered, meaning Animated was true when the window was created. Useful -- for smooth animation. procedure Swap (Win : in Window_Handle); -- Return current window width function Width (Win : in Window_Handle) return Natural; -- Return current window width function Height (Win : in Window_Handle) return Natural; -- Resize given window to particular size. procedure Resize (Win : in Window_Handle; Width : in Positive; Height : in Positive); -- Move mouse pointer to given position in given window. -- Doesn't expose window. NOTE: Should be said window exposed or not? -- If coordinate is outside said window then pointer will be moved to -- the edge of window. -- Point of origin (0, 0) is in lower-left corner (just like in OpenGL). procedure Warp_Pointer (Win : in Window_Handle; X : in Natural; Y : in Natural); -- Get current coordinates of mouse pointer relative to point of origin -- of given window. -- Point of origin (0, 0) is in lower-left corner (just like in OpenGL). procedure Get_Pointer (Win : in Window_Handle; X : out Integer; Y : out Integer; Modifiers : out Modifier_Set); -- Move window to specified position on screen. -- Point of origin is in top-left due to most of windowing systems placing -- it there - and this one procedure is working in the context of windowing -- system. procedure Move_Window (Win : in Window_Handle; X : in Natural; Y : in Natural); -- Raise or Lower window. NOTE: This is not minimize/maximize - just makes -- given window on top/bottom of window stack (thus if Win is on layer over -- some other window it will be on bottom layer after Lower_Window. Inverse -- happens for Raise_Window). procedure Raise_Window (Win : in Window_Handle); procedure Lower_Window (Win : in Window_Handle); -- All event processing is done in this call -- Events are reported by CallBacks (see Window_Type in lumen.ads) function Process_Events (Win : in Window_Handle) return Boolean; --------------------------------------------------------------------------- private type Window_Type is new Window_Public with record Height : Natural; Width : Natural; end record; end Lumen.Window;
src/skeleton_sound_engine.6502.asm
mrpopogod/nes-fun
0
25144
<filename>src/skeleton_sound_engine.6502.asm ; In order to be fully agnostic we split the vars into their own file and let this fall wherever the include puts us ; Make sure to include skeleton_sound_engine_vars.6502.asm sound_init: lda #$0F sta $4015 ;enable Square 1, Square 2, Triangle and Noise channels lda #$30 sta $4000 ;set Square 1 volume to 0 sta $4004 ;set Square 2 volume to 0 sta $400C ;set Noise volume to 0 lda #$80 sta $4008 ;silence Triangle lda #$00 sta sound_disable_flag ;clear disable flag ;later, if we have other variables we want to initialize, we will do that here. sta sfx_playing sta sfx_index sta sound_frame_counter rts sound_disable: lda #$00 sta $4015 ;disable all channels lda #$01 sta sound_disable_flag ;set disable flag rts sound_load: lda #$01 sta sfx_playing ;set playing flag lda #$00 sta sfx_index ;reset the index and counter sta sound_frame_counter rts sound_play_frame: lda sound_disable_flag bne @done ;if disable flag is set, don't advance a frame lda sfx_playing beq @done ;if our sound isn't playing, don't advance a frame inc sound_frame_counter lda sound_frame_counter cmp #$08 ;***change this compare value to make the notes play faster or slower*** bne @done ;only take action once every 8 frames. ldy sfx_index ;read the next byte from our sound data stream lda sfx1_data, y ;***comment out this line and uncomment one of the ones below to play another data stream (data streams are located in sound_data.i)*** ;lda sfx2_data, y ;lda sfx3_data, y cmp #$FF bne @note ;if not #$FF, we have a note value lda #$30 ;else if #$FF, we are at the end of the sound data, so stop the sound and return sta $4000 lda #$00 sta sfx_playing sta sound_frame_counter rts @note: asl a ;multiply by 2, because our note table is stored as words tay ;we'll use this as an index into the note table lda note_table, y ;read the low byte of our period from the table sta $4002 lda note_table+1, y ;read the high byte of our period from the table sta $4003 lda #$7F ;duty cycle 01, volume F sta $4000 lda #$08 ;set negate flag so low Square notes aren't silenced sta $4001 inc sfx_index ;move our index to the next byte position in the data stream lda #$00 sta sound_frame_counter ;reset frame counter so we can start counting to 8 again. @done: rts .include "note_table.6502.asm" ;period lookup table for notes .include "skeleton_sound_data.6502.asm" ;holds the data for sfx1_data, sfx2_data and sfx3_data. Try making your own too.
programs/oeis/127/A127802.asm
neoneye/loda
22
161737
; A127802: a(0) = 1, a(n) = 3*A036987(n), n>1. ; 1,3,0,3,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $1,2 lpb $0 sub $0,1 pow $1,2 gcd $1,$0 div $0,2 lpe sub $1,1 mov $0,$1
src/main/scala/parsing/antlr/Graphics.g4
Ryan-Git/LangImplPatterns
0
481
grammar Graphics; file : command+ ; command : 'line' 'from' point 'to' point ; point: INT ',' INT ; INT : '0'..'9'+ ; WS : [ \r\t\n]+ -> skip ;
as1.adb
twinbee/dekkerAda
0
8600
<gh_stars>0 --------------------------------------------------------------- -- Author: <NAME> --- -- Class: CSC410 Burgess --- -- Date: 09-01-04 Modified: 9-05-04 --- -- Desc: Assignment 1:DEKKER's ALGORITHM --- -- a simple implementation of --- -- Dekker's algorithm which describes mutual exclusion for --- -- two processes (TASKS) assuming fair hardware. --- -- Dekker's algorithm as described in --- -- "Algorithms for Mutual Exclusion", <NAME> --- -- MIT PRESS Cambridge, 1974 ISBN: 0-262-18119-3 --- ---------------------------------------------------------------- -- dependencies WITH ADA.TEXT_IO; USE ADA.TEXT_IO; WITH ADA.NUMERICS.FLOAT_RANDOM; --USE ADA.NUMERICS.FLOAT_RANDOM; WITH ADA.INTEGER_TEXT_IO; USE ADA.INTEGER_TEXT_IO; --WITH ADA.INTEGER_IO; USE ADA.INTEGER_IO; WITH ADA.CALENDAR; USE ADA.CALENDAR; -- (provides cast: natural -> time for input into delay) --WITH ADA.STRINGS; USE ADA.STRINGS; WITH ADA.STRINGS.UNBOUNDED; USE ADA.STRINGS.UNBOUNDED; ---------------------------------------------------------------- ---------------------------------------------------------------- -- specifications PACKAGE BODY as1 IS PROCEDURE dekker IS --implementation of the driver and user interface turn : Integer RANGE 0..1 := 0; --called for by dekker's flag : ARRAY(0..1) OF Boolean := (OTHERS => FALSE);--dekker's tempString : Unbounded_String; --buffer used to hold the output for a task tempString0 : Unbounded_String := To_Unbounded_String(""); --buffer used to make the spaces for indents --user defined at runtime-- iterations_user : Integer RANGE 0..100 := 10; -- iterations per task tasks_user : Integer RANGE 0..100 := 2; -- num proccesses TASK TYPE single_task IS -- "an ENTRY is a TASK's version of a PROCEDURE or FUNCTION" ENTRY start (id_self : IN Integer; id_other : IN Integer; iterations_in : IN Integer); END single_task; --we have to use a pointer every time we throw off a new task TYPE p_ptr IS ACCESS single_task; --reference type ptr : ARRAY(0..tasks_user) OF p_ptr; --how do we allocate dynamically? -- "since TASK TYPE single_task is part of PROCEDURE dekker, -- we must define it here or in a specifications file " TASK BODY single_task IS i,j : Integer := 0; -- identity, other task' identity iterations : Integer := 0; -- # of iterations G : Ada.Numerics.Float_Random.Generator; -- yields a random Natural after seed BEGIN --single_task -- this is Dekker's algorithm implementation, the tasks themselves ACCEPT Start (id_self : IN Integer; id_other : IN Integer; iterations_in : IN Integer) DO i := id_self; j := id_other; iterations := iterations_user; END Start; FOR x IN 1 .. iterations LOOP Ada.Numerics.Float_Random.Reset(G); --like seed_rand(time(0)) in c delay (Standard.Duration( (Ada.Numerics.Float_Random.Random(G) ) ) ); -- Begin Dekker's Algorithm flag(i) := TRUE; --"requesting & in-CS" combined WHILE flag(j) LOOP IF turn = j THEN BEGIN flag(i) := FALSE; --fell in WHILE turn = j LOOP null; --event loop, do nothing END loop; flag(i) := TRUE; END; -- for begin END IF; END LOOP; -- Critical Section FOR x IN 0..8*i LOOP tempString0 := tempString0 & To_UnBounded_String(" "); --build up indent END LOOP; tempString := tempString0 & To_Unbounded_String(Integer'Image(i) & " in CS"); Put_Line( To_String(tempString) ); tempString0 := To_UnBounded_String(""); DELAY Standard.Duration( ( (Ada.Numerics.Float_Random.random(G) ) )); FOR x IN 0..8*i LOOP tempString0 := tempString0 & To_UnBounded_String(" "); --build up indent END LOOP; tempString := tempString0 & To_Unbounded_String(Integer'Image(i) & " out CS"); Put_Line( To_String(tempString) ); tempString0 := To_UnBounded_String(""); -- end Critical Section turn := j; --"next process" flag(i) := FALSE; --"finished with my critical section" END LOOP; END single_task; ---------------------------------------------------------------- ---------------------------------------------------------------- -- implementation BEGIN --procedure dekker --sanity checking on the input LOOP put("# tasks[1-2]: "); get(tasks_user); EXIT WHEN (tasks_user > 0 AND tasks_user <= 2); END LOOP; LOOP put("# iterations[1-20]: "); get(iterations_user); EXIT WHEN (iterations_user > 0 AND iterations_user <= 20); END LOOP; -- For each proccess, start it and pass them their id's FOR x IN 0 .. (tasks_user-1) LOOP ptr(x) := NEW single_task; ptr(x).Start(x,1-x, iterations_user); END LOOP; END dekker; END as1;
antlr-basics/src/main/java/com/poc/chapter_05_part01/Csv.g4
cgonul/antlr-poc
0
3240
grammar Csv; file : (row NL)* ; row : ID (',' ID )* ; ID : [(a-z|1-9)]+ ; NL : '\r'? '\n' ; WS : [ \t\r\n]+ -> skip ;
lab_11_str/lab_11_str/DelSpace.asm
Winterpuma/bmstu_MDPL
14
13829
.386 .model flat, c public DelSpace .code DelSpace: push ebp mov ebp, esp push edi mov edi, [ebp + 8] ; str mov ebx, edi mov eax, 0 mov ecx, 0 mov cx, -1 ; FFFF mov al, ' ' ; our symbol to compare with cld ; CF = 0 go right direction repe scasb ; Fing byte != to AL in block of ECX bytes by adress ES:EDI (while edi symbol != al symbol & ecx != 0) mov esi, edi dec esi ; pointer to first meaningfull symbol mov al, 0 ; find end of string mov cx, -1 repne scasb ; Find byte == to AL in clock of ECX bytes by adress ES:EDI neg cx ; sub edi, 2 ; last non zero symbol mov al, ' ' std ; left direction repe scasb ; Fing byte != to AL in block of ECX bytes by adress ES:EDI mov ax, cx ; len of new string mov edi, ebx ; beginning of string cld ; right direction rep movsb ; Write to ES:EDI block of ECX bytes from DS:ESI mov cx, 0 mov [edi], cx ; set end of string pop edi pop ebp ret end
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/lto12_pkg.ads
best08618/asylo
7
9163
-- { dg-excess-errors "cannot generate code" } package Lto12_Pkg is type R (Kind : Boolean := False) is record case Kind is when True => I : Integer; when others => null; end case; end record; function F return R; end Lto12_Pkg;
Cubical/Algebra/CommRing/Kernel.agda
thomas-lamiaux/cubical
1
6445
{-# OPTIONS --safe #-} module Cubical.Algebra.CommRing.Kernel where open import Cubical.Foundations.Prelude open import Cubical.Algebra.CommRing.Base open import Cubical.Algebra.CommRing.Ideal using (IdealsIn; Ideal→CommIdeal) open import Cubical.Algebra.Ring.Kernel using () renaming (kernelIdeal to ringKernelIdeal) private variable ℓ : Level -- If R and S were implicit, their ·Comm component could (almost?) never be inferred. kernelIdeal : (R S : CommRing ℓ) (f : CommRingHom R S) → IdealsIn R kernelIdeal _ _ f = Ideal→CommIdeal (ringKernelIdeal f)
programs/oeis/039/A039701.asm
neoneye/loda
22
170756
<filename>programs/oeis/039/A039701.asm<gh_stars>10-100 ; A039701: a(n) = n-th prime modulo 3. ; 2,0,2,1,2,1,2,1,2,2,1,1,2,1,2,2,2,1,1,2,1,1,2,2,1,2,1,2,1,2,1,2,2,1,2,1,1,1,2,2,2,1,2,1,2,1,1,1,2,1,2,2,1,2,2,2,2,1,1,2,1,2,1,2,1,2,1,1,2,1,2,2,1,1,1,2,2,1,2,1,2,1,2,1,1,2,2,1,2,1,2,2,1,2,1,2,2,2,1,1 seq $0,6005 ; The odd prime numbers together with 1. max $0,2 mod $0,3
src/latin_utils/latin_utils-dictionary_package-parse_record_io.adb
spr93/whitakers-words
204
30707
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Dictionary_Package) package body Parse_Record_IO is --------------------------------------------------------------------------- procedure Get (File : in Ada.Text_IO.File_Type; Item : out Parse_Record) is Spacer : Character; pragma Unreferenced (Spacer); begin Stem_Type_IO.Get (File, Item.Stem); Ada.Text_IO.Get (File, Spacer); Inflection_Record_IO.Get (File, Item.IR); Ada.Text_IO.Get (File, Spacer); Dictionary_Kind_IO.Get (File, Item.D_K); Ada.Text_IO.Get (File, Spacer); MNPC_IO.Get (File, Item.MNPC); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Parse_Record) is Spacer : Character; pragma Unreferenced (Spacer); begin Stem_Type_IO.Get (Item.Stem); Ada.Text_IO.Get (Spacer); Inflection_Record_IO.Get (Item.IR); Ada.Text_IO.Get (Spacer); Dictionary_Kind_IO.Get (Item.D_K); Ada.Text_IO.Get (Spacer); MNPC_IO.Get (Item.MNPC); end Get; --------------------------------------------------------------------------- procedure Put (File : in Ada.Text_IO.File_Type; Item : in Parse_Record) is begin Stem_Type_IO.Put (File, Item.Stem); Ada.Text_IO.Put (File, ' '); Inflection_Record_IO.Put (File, Item.IR); Ada.Text_IO.Put (File, ' '); Dictionary_Kind_IO.Put (File, Item.D_K); Ada.Text_IO.Put (File, ' '); MNPC_IO.Put (File, Item.MNPC); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Parse_Record) is begin Stem_Type_IO.Put (Item.Stem); Ada.Text_IO.Put (' '); Inflection_Record_IO.Put (Item.IR); Ada.Text_IO.Put (' '); Dictionary_Kind_IO.Put (Item.D_K); Ada.Text_IO.Put (' '); MNPC_IO.Put (Item.MNPC); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Parse_Record; Last : out Integer ) is -- Used for computing lower bound of substring Low : Integer := Source'First - 1; begin Stem_Type_IO.Get (Source, Target.Stem, Low); Low := Low + 1; Inflection_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.IR, Low); Low := Low + 1; Dictionary_Kind_IO.Get (Source (Low + 1 .. Source'Last), Target.D_K, Low); Low := Low + 1; MNPC_IO.Get (Source (Low + 1 .. Source'Last), Target.MNPC, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Parse_Record) is -- These variables are used for computing bounds of substrings Low : Integer := 0; High : Integer := 0; begin -- Put Stem_Type High := Low + Max_Stem_Size; Target (Target'First + Low .. Target'First - 1 + High) := Item.Stem; Low := High + 1; Target (Target'First - 1 + Low) := ' '; -- Put Inflection_Record High := Low + Inflection_Record_IO.Default_Width; Inflection_Record_IO.Put (Target (Target'First + Low .. Target'First - 1 + High), Item.IR); Low := High + 1; Target (Target'First - 1 + Low) := ' '; -- Put Dictionary_Kind High := Low + Dictionary_Kind_IO.Default_Width; Dictionary_Kind_IO.Put (Target (Target'First + Low .. Target'First - 1 + High), Item.D_K); Low := High + 1; -- Put MNPC Target (Target'First - 1 + Low) := ' '; High := Low + MNPC_IO_Default_Width; MNPC_IO.Put (Target (Target'First + Low .. Target'First - 1 + High), Item.MNPC); -- Fill remainder of string Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Parse_Record_IO;
generated/natools-static_maps-web-simple_pages.adb
faelys/natools-web
1
5588
<filename>generated/natools-static_maps-web-simple_pages.adb -- Generated at 2017-03-10 17:26:29 +0000 by Natools.Static_Hash_Maps -- from src/natools-web-simple_pages-maps.sx with Natools.Static_Maps.Web.Simple_Pages.Commands; with Natools.Static_Maps.Web.Simple_Pages.Components; package body Natools.Static_Maps.Web.Simple_Pages is function To_Command (Key : String) return Command is N : constant Natural := Natools.Static_Maps.Web.Simple_Pages.Commands.Hash (Key); begin if Map_1_Keys (N).all = Key then return Map_1_Elements (N); else return Unknown_Command; end if; end To_Command; function To_Component (Key : String) return Component is N : constant Natural := Natools.Static_Maps.Web.Simple_Pages.Components.Hash (Key); begin if Map_2_Keys (N).all = Key then return Map_2_Elements (N); else return Error; end if; end To_Component; end Natools.Static_Maps.Web.Simple_Pages;
day02/day02.adb
thorstel/Advent-of-Code-2018
2
6190
<gh_stars>1-10 with Ada.Text_IO; with Ada.Containers.Generic_Array_Sort; with Ada.Containers.Vectors; use Ada.Text_IO; procedure Day02 is subtype Input_String is String (1 .. 26); package String_Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Input_String); procedure String_Sort is new Ada.Containers.Generic_Array_Sort (Positive, Character, String); File : File_Type; Inputs : String_Vectors.Vector; Twice_Count : Integer := 0; Thrice_Count : Integer := 0; begin -- Input processing + Part 1 Open (File, In_File, "input.txt"); while not End_Of_File (File) loop declare Line : String := Get_Line (File); Char : Character := ' '; counter : Integer := 0; Has_Twice : Boolean := False; Has_Thrice : Boolean := False; begin Inputs.Append (Line); String_Sort (Line); for I in Line'Range loop if Char = Line (I) then Counter := Counter + 1; end if; if Char /= Line (I) or I = Line'Last then if Counter = 2 then Has_Twice := True; elsif Counter = 3 then Has_Thrice := True; end if; Counter := 1; Char := Line (I); end if; end loop; if Has_Twice then Twice_Count := Twice_Count + 1; end if; if Has_Thrice then Thrice_Count := Thrice_Count + 1; end if; end; end loop; Close (File); Put_Line ("Part 1 =" & Integer'Image (Twice_Count * Thrice_Count)); -- Part 2 declare Diff_Count : Integer; begin Outer_Loop : for I in Inputs.Iterate loop for J in Inputs.Iterate loop Diff_Count := 0; for C in 1 .. 26 loop if Inputs (I) (C) /= Inputs (J) (C) then Diff_Count := Diff_Count + 1; end if; end loop; if Diff_Count = 1 then Put_Line ("Part 2: The lines are"); Put_Line (Inputs (I) & " and"); Put_Line (Inputs (J)); exit Outer_Loop; end if; end loop; end loop Outer_Loop; end; end Day02;
base/ntos/ke/i386/spinlock.asm
npocmaka/Windows-Server-2003
17
17666
TITLE "Spin Locks" ;++ ; ; Copyright (c) 1989 Microsoft Corporation ; ; Module Name: ; ; spinlock.asm ; ; Abstract: ; ; This module implements the routines for acquiring and releasing ; spin locks. ; ; Author: ; ; <NAME> (bryanwi) 13 Dec 89 ; ; Environment: ; ; Kernel mode only. ; ; Revision History: ; ; <NAME> (kenr) 22-Jan-1991 ; Removed KeAcquireSpinLock macros, and made functions ;-- PAGE .586p include ks386.inc include callconv.inc ; calling convention macros include i386\kimacro.inc include mac386.inc include irqli386.inc EXTRNP _KeBugCheckEx,5 _TEXT$00 SEGMENT PARA PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING PAGE SUBTTL "Ke Acquire Spin Lock At DPC Level" ;++ ; ; VOID ; KefAcquireSpinLockAtDpcLevel ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function acquires a kernel spin lock. ; ; N.B. This function assumes that the current IRQL is set properly. ; It neither raises nor lowers IRQL. ; ; Arguments: ; ; (ecx) SpinLock - Supplies a pointer to an kernel spin lock. ; ; Return Value: ; ; None. ; ;-- align 16 cPublicFastCall KefAcquireSpinLockAtDpcLevel, 1 cPublicFpo 0, 0 if DBG push ecx CurrentIrql pop ecx cmp al, DISPATCH_LEVEL jl short asld50 endif ifdef NT_UP fstRET KefAcquireSpinLockAtDpcLevel else ; ; Attempt to assert the lock ; asld10: ACQUIRE_SPINLOCK ecx,<short asld20> fstRET KefAcquireSpinLockAtDpcLevel ; ; Lock is owned, spin till it looks free, then go get it again. ; align 4 asld20: SPIN_ON_SPINLOCK ecx,<short asld10> endif if DBG asld50: stdCall _KeBugCheckEx,<IRQL_NOT_GREATER_OR_EQUAL,ecx,eax,0,0> int 3 ; help debugger backtrace. endif fstENDP KefAcquireSpinLockAtDpcLevel ;++ ; ; VOID ; KeAcquireSpinLockAtDpcLevel ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; Thunk for standard call callers ; ;-- cPublicProc _KeAcquireSpinLockAtDpcLevel, 1 cPublicFpo 1,0 ifndef NT_UP mov ecx,[esp+4] ; SpinLock aslc10: ACQUIRE_SPINLOCK ecx,<short aslc20> stdRET _KeAcquireSpinLockAtDpcLevel aslc20: SPIN_ON_SPINLOCK ecx,<short aslc10> endif stdRET _KeAcquireSpinLockAtDpcLevel stdENDP _KeAcquireSpinLockAtDpcLevel PAGE SUBTTL "Ke Release Spin Lock From Dpc Level" ;++ ; ; VOID ; KefReleaseSpinLockFromDpcLevel ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function releases a kernel spin lock. ; ; N.B. This function assumes that the current IRQL is set properly. ; It neither raises nor lowers IRQL. ; ; Arguments: ; ; (ecx) SpinLock - Supplies a pointer to an executive spin lock. ; ; Return Value: ; ; None. ; ;-- align 16 cPublicFastCall KefReleaseSpinLockFromDpcLevel ,1 cPublicFpo 0,0 ifndef NT_UP RELEASE_SPINLOCK ecx endif fstRET KefReleaseSpinLockFromDpcLevel fstENDP KefReleaseSpinLockFromDpcLevel ;++ ; ; VOID ; KeReleaseSpinLockFromDpcLevel ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; Thunk for standard call callers ; ;-- cPublicProc _KeReleaseSpinLockFromDpcLevel, 1 cPublicFpo 1,0 ifndef NT_UP mov ecx, [esp+4] ; (ecx) = SpinLock RELEASE_SPINLOCK ecx endif stdRET _KeReleaseSpinLockFromDpcLevel stdENDP _KeReleaseSpinLockFromDpcLevel PAGE SUBTTL "Ki Acquire Kernel Spin Lock" ;++ ; ; VOID ; FASTCALL ; KiAcquireSpinLock ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function acquires a kernel spin lock. ; ; N.B. This function assumes that the current IRQL is set properly. ; It neither raises nor lowers IRQL. ; ; Arguments: ; ; (ecx) SpinLock - Supplies a pointer to an kernel spin lock. ; ; Return Value: ; ; None. ; ;-- align 16 cPublicFastCall KiAcquireSpinLock ,1 cPublicFpo 0,0 ifndef NT_UP ; ; Attempt to assert the lock ; asl10: ACQUIRE_SPINLOCK ecx,<short asl20> fstRET KiAcquireSpinLock ; ; Lock is owned, spin till it looks free, then go get it again. ; align 4 asl20: SPIN_ON_SPINLOCK ecx,<short asl10> else fstRET KiAcquireSpinLock endif fstENDP KiAcquireSpinLock PAGE SUBTTL "Ki Release Kernel Spin Lock" ;++ ; ; VOID ; FASTCALL ; KiReleaseSpinLock ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function releases a kernel spin lock. ; ; N.B. This function assumes that the current IRQL is set properly. ; It neither raises nor lowers IRQL. ; ; Arguments: ; ; (ecx) SpinLock - Supplies a pointer to an executive spin lock. ; ; Return Value: ; ; None. ; ;-- align 16 cPublicFastCall KiReleaseSpinLock ,1 cPublicFpo 0,0 ifndef NT_UP RELEASE_SPINLOCK ecx endif fstRET KiReleaseSpinLock fstENDP KiReleaseSpinLock PAGE SUBTTL "Try to acquire Kernel Spin Lock" ;++ ; ; BOOLEAN ; KeTryToAcquireSpinLock ( ; IN PKSPIN_LOCK SpinLock, ; OUT PKIRQL OldIrql ; ) ; ; Routine Description: ; ; This function attempts acquires a kernel spin lock. If the ; spinlock is busy, it is not acquire and FALSE is returned. ; ; Arguments: ; ; SpinLock (TOS+4) - Supplies a pointer to an kernel spin lock. ; OldIrql (TOS+8) = Location to store old irql ; ; Return Value: ; TRUE - Spinlock was acquired & irql was raise ; FALSE - SpinLock was not acquired - irql is unchanged. ; ;-- align dword cPublicProc _KeTryToAcquireSpinLock ,2 cPublicFpo 2,0 ifdef NT_UP ; UP Version of KeTryToAcquireSpinLock RaiseIrql DISPATCH_LEVEL mov ecx, [esp+8] ; (ecx) -> ptr to OldIrql mov [ecx], al ; save OldIrql mov eax, 1 ; Return TRUE stdRET _KeTryToAcquireSpinLock else ; MP Version of KeTryToAcquireSpinLock mov edx,[esp+4] ; (edx) -> spinlock ; ; First check the spinlock without asserting a lock ; TEST_SPINLOCK edx,<short ttsl10> ; ; Spinlock looks free raise irql & try to acquire it ; ; ; raise to dispatch_level ; RaiseIrql DISPATCH_LEVEL mov edx, [esp+4] ; (edx) -> spinlock mov ecx, [esp+8] ; (ecx) = Return OldIrql ACQUIRE_SPINLOCK edx,<short ttsl20> mov [ecx], al ; save OldIrql mov eax, 1 ; spinlock was acquired, return TRUE stdRET _KeTryToAcquireSpinLock ttsl10: xor eax, eax ; return FALSE YIELD stdRET _KeTryToAcquireSpinLock ttsl20: YIELD mov ecx, eax ; (ecx) = OldIrql LowerIrql ecx xor eax, eax ; return FALSE stdRET _KeTryToAcquireSpinLock endif stdENDP _KeTryToAcquireSpinLock PAGE SUBTTL "Ki Try to acquire Kernel Spin Lock" ;++ ; ; BOOLEAN ; FASTCALL ; KeTryToAcquireSpinLockAtDpcLevel ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function attempts acquires a kernel spin lock. If the ; spinlock is busy, it is not acquire and FALSE is returned. ; ; Arguments: ; ; SpinLock (ecx) - Supplies a pointer to an kernel spin lock. ; ; Return Value: ; ; TRUE - Spinlock was acquired ; FALSE - SpinLock was not acquired ; ;-- align dword cPublicFastCall KeTryToAcquireSpinLockAtDpcLevel ,1 cPublicFpo 0, 0 ; ; First check the spinlock without asserting a lock ; ifndef NT_UP TEST_SPINLOCK ecx, <short atsl20> ; ; Spinlock looks free try to acquire it. ; ACQUIRE_SPINLOCK ecx, <short atsl20> endif mov eax, 1 ; spinlock was acquired, return TRUE fstRET KeTryToAcquireSpinLockAtDpcLevel ifndef NT_UP atsl20: YIELD ; xor eax, eax ; return FALSE fstRET KeTryToAcquireSpinLockAtDpclevel endif fstENDP KeTryToAcquireSpinLockAtDpcLevel ;++ ; ; BOOLEAN ; KeTestSpinLock ( ; IN PKSPIN_LOCK SpinLock ; ) ; ; Routine Description: ; ; This function tests a kernel spin lock. If the spinlock is ; busy, FALSE is returned. If not, TRUE is returned. The spinlock ; is never acquired. This is provided to allow code to spin at low ; IRQL, only raising the IRQL when there is a reasonable hope of ; acquiring the lock. ; ; Arguments: ; ; SpinLock (ecx) - Supplies a pointer to a kernel spin lock. ; ; Return Value: ; TRUE - Spinlock appears available ; FALSE - SpinLock is busy ; ;-- cPublicFastCall KeTestSpinLock ,1 TEST_SPINLOCK ecx,<short tso10> mov eax, 1 fstRET KeTestSpinLock tso10: YIELD xor eax, eax fstRET KeTestSpinLock fstENDP KeTestSpinLock page ,132 subttl "Acquire In Stack Queued SpinLock At Dpc Level" ifdef QLOCK_STAT_GATHER EXTRNP KiQueueStatTrySucceeded,2,,FASTCALL EXTRNP KiQueueStatTryFailed,1,,FASTCALL EXTRNP KiQueueStatTry,1,,FASTCALL EXTRNP KiQueueStatAcquireQueuedLock,1,,FASTCALL EXTRNP KiQueueStatAcquireQueuedLockRTS,1,,FASTCALL EXTRNP KiQueueStatTryAcquire,3,,FASTCALL EXTRNP KiQueueStatReleaseQueuedLock,2,,FASTCALL EXTRNP KiQueueStatAcquire,1,,FASTCALL EXTRNP KiQueueStatRelease,1,,FASTCALL EXTRNP KiAcquireQueuedLock,1,,FASTCALL EXTRNP KiReleaseQueuedLock,1,,FASTCALL ; ; The following routines are used to wrap the actual calls to the ; real routines which have been usurped here by patching the import ; table. ; cPublicFastCall __cap_KeAcquireQueuedSpinLock,1 sub esp, 8 ; make room to save time push ecx ; save args rdtsc ; get time mov [esp].4, eax ; save low part mov [esp].8, edx ; save high part mov ecx, [esp] ; restore arg fstCall KiQueueStatAcquireQueuedLock acqst: mov ecx, esp ; set arg pointer for data accum push eax ; save result fstCall KiQueueStatAcquire pop eax ; restore result add esp, 12 ; restore stack pointer fstRET __cap_KeAcquireQueuedSpinLock fstENDP __cap_KeAcquireQueuedSpinLock cPublicFastCall __cap_KeAcquireQueuedSpinLockRaiseToSynch,1 sub esp, 8 ; make room to save time push ecx ; save args rdtsc ; get time mov [esp].4, eax ; save low part mov [esp].8, edx ; save high part mov ecx, [esp] ; restore arg fstCall KiQueueStatAcquireQueuedLockRTS jmp short acqst ; use common code to finish fstENDP __cap_KeAcquireQueuedSpinLockRaiseToSynch cPublicFastCall __cap_KeTryToAcquireQueuedSpinLockRaiseToSynch,2 push ecx ; save arg push SYNCH_LEVEL tryst: fstCall KiQueueStatTryAcquire push eax ; save result mov ecx, esp fstCall KiQueueStatTry pop eax ; restore result add esp, 4 ; drop saved arg or eax, eax ; some assembly callers expect appropriate flags fstRET __cap_KeTryToAcquireQueuedSpinLockRaiseToSynch fstENDP __cap_KeTryToAcquireQueuedSpinLockRaiseToSynch cPublicFastCall __cap_KeTryToAcquireQueuedSpinLock,2 push ecx ; save arg push DISPATCH_LEVEL jmp short tryst ; use common code to finish fstENDP __cap_KeTryToAcquireQueuedSpinLock cPublicFastCall __cap_KeReleaseQueuedSpinLock,2 push ecx ; save args mov ecx, esp ; set arg for stat release routine push edx ; save other arg fstCall KiQueueStatRelease pop edx pop ecx fstCall KiQueueStatReleaseQueuedLock fstRET __cap_KeReleaseQueuedSpinLock fstENDP __cap_KeReleaseQueuedSpinLock ; ; KeAcquireQueuedSpinLockAtDpcLevel ; KeReleaseQueuedSpinLockFromDpcLevel ; ; These two routines are defined here in assembly code so ; as to capture the caller's address. ; cPublicFastCall KeAcquireQueuedSpinLockAtDpcLevel,1 sub esp, 8 ; make room to save time push ecx ; save args rdtsc ; get time mov [esp].4, eax ; save low part mov [esp].8, edx ; save high part mov ecx, [esp] ; restore arg fstCall KiAcquireQueuedLock mov ecx, esp fstCall KiQueueStatAcquire add esp, 12 ; restore SP fstRET KeAcquireQueuedSpinLockAtDpcLevel fstENDP KeAcquireQueuedSpinLockAtDpcLevel cPublicFastCall KeReleaseQueuedSpinLockFromDpcLevel,1 push ecx ; save args mov ecx, esp ; set arg for stat release routine fstCall KiQueueStatRelease pop ecx fstCall KiReleaseQueuedLock fstRET KeReleaseQueuedSpinLockFromDpcLevel fstENDP KeReleaseQueuedSpinLockFromDpcLevel ; ; KiCaptureQueuedSpinlockRoutines ; ; Replace the import table entries for the x86 HAL queued spinlock ; routines with our statistic capturing variety. ; EXTRNP KeAcquireQueuedSpinLock,1,IMPORT,FASTCALL EXTRNP KeAcquireQueuedSpinLockRaiseToSynch,1,IMPORT,FASTCALL EXTRNP KeTryToAcquireQueuedSpinLockRaiseToSynch,2,IMPORT,FASTCALL EXTRNP KeTryToAcquireQueuedSpinLock,2,IMPORT,FASTCALL EXTRNP KeReleaseQueuedSpinLock,2,IMPORT,FASTCALL cPublicFastCall KiCaptureQueuedSpinlockRoutines,0 mov eax, @__cap_KeAcquireQueuedSpinLock@4 mov [__imp_@KeAcquireQueuedSpinLock@4], eax mov eax, @__cap_KeAcquireQueuedSpinLockRaiseToSynch@4 mov [__imp_@KeAcquireQueuedSpinLockRaiseToSynch@4], eax mov eax, @__cap_KeTryToAcquireQueuedSpinLockRaiseToSynch@8 mov [__imp_@KeTryToAcquireQueuedSpinLockRaiseToSynch@8], eax mov eax, @__cap_KeTryToAcquireQueuedSpinLock@8 mov [__imp_@KeTryToAcquireQueuedSpinLock@8], eax mov eax, @__cap_KeReleaseQueuedSpinLock@8 mov [__imp_@KeReleaseQueuedSpinLock@8], eax fstRet KiCaptureQueuedSpinlockRoutines fstENDP KiCaptureQueuedSpinlockRoutines else ;++ ; ; VOID ; FASTCALL ; KeAcquireInStackQueuedSpinLockAtDpcLevel ( ; IN PKSPIN_LOCK SpinLock, ; IN PKLOCK_QUEUE_HANDLE LockHandle ; ) ; ; Routine Description: ; ; This function acquires the specified in stack queued spin lock at the ; current IRQL. ; ; Arguments: ; ; SpinLock (ecx) - Supplies the address of a spin lock. ; ; LockHandle (edx) - Supplies the address of an in stack lock handle. ; ; Return Value: ; ; None. ;-- align 16 cPublicFastCall KeAcquireInStackQueuedSpinLockAtDpcLevel,2 cPublicFpo 0,0 ifndef NT_UP xor eax, eax ; set next link to NULL mov [edx].LqhNext, eax ; mov [edx].LqhLock, ecx ; set spin lock address lea ecx, dword ptr [edx+LqhNext] ; compute address of lock queue jmp short @KeAcquireQueuedSpinLockAtDpcLevel@4 ; finish in common code else fstRET KeAcquireInStackQueuedSpinLockAtDpcLevel endif fstENDP KeAcquireInStackQueuedSpinLockAtDpcLevel page ,132 subttl "Acquire Queued SpinLock" ;++ ; ; VOID ; KeAcquireQueuedSpinLockAtDpcLevel ( ; IN PKSPIN_LOCK_QUEUE QueuedLock ; ) ; ; Routine Description: ; ; This function acquires the specified queued spinlock. ; No change to IRQL is made, IRQL is not returned. It is ; expected IRQL is sufficient to avoid context switch. ; ; Unlike the equivalent Ke versions of these routines, ; the argument to this routine is the address of the ; lock queue entry (for the lock to be acquired) in the ; PRCB rather than the LockQueueNumber. This saves us ; a couple of instructions as the address can be calculated ; at compile time. ; ; NOTE: This code may be modified for use during textmode ; setup if this is an MP kernel running with a UP HAL. ; ; Arguments: ; ; LockQueueEntry (ecx) - Supplies the address of the queued ; spinlock entry in this processor's ; PRCB. ; ; Return Value: ; ; None. ; ; N.B. ecx is preserved, assembly code callers can take advantage ; of this by avoiding setting up ecx for the call to release if ; the caller can preserve the lock that long. ; ;-- ; compile time assert sizeof(KSPIN_LOCK_QUEUE) == 8 .errnz (LOCK_QUEUE_HEADER_SIZE - 8) align 16 cPublicFastCall KeAcquireQueuedSpinLockAtDpcLevel,1 cPublicFpo 0,0 ifndef NT_UP ; Get address of the actual lock. mov edx, [ecx].LqLock ifdef CAPKERN_SYNCH_POINTS push edx push 000010101h ; 1 Dword, Timestamp, Subcode = 1 call _CAP_Log_NInt add esp, 8 endif mov eax, ecx ; save Lock Queue entry address ; Exchange the value of the lock with the address of this ; Lock Queue entry. xchg [edx], eax cmp eax, 0 ; check if lock is held jnz short @f ; jiff held ; note: the actual lock address will be word aligned, we use ; the bottom two bits as indicators, bit 0 is LOCK_QUEUE_WAIT, ; bit 1 is LOCK_QUEUE_OWNER. or edx, LOCK_QUEUE_OWNER ; mark self as lock owner mov [ecx].LqLock, edx ; lock has been acquired, return. aqsl20: endif fstRET KeAcquireQueuedSpinLockAtDpcLevel ifndef NT_UP @@: if DBG ; make sure it isn't already held by THIS processor. test edx, LOCK_QUEUE_OWNER jz short @f ; KeBugCheckEx(SPIN_LOCK_ALREADY_OWNED, ; actual lock address, ; my context, ; previous acquirer, ; 2); stdCall _KeBugCheckEx,<SPIN_LOCK_ALREADY_OWNED,edx,ecx,eax,2> @@: endif ; The lock is already held by another processor. Set the wait ; bit in this processor's Lock Queue entry, then set the next ; field in the Lock Queue entry of the last processor to attempt ; to acquire the lock (this is the address returned by the xchg ; above) to point to THIS processor's lock queue entry. or edx, LOCK_QUEUE_WAIT ; set lock bit mov [ecx].LqLock, edx mov [eax].LqNext, ecx ; set previous acquirer's ; next field. ifdef CAPKERN_SYNCH_POINTS and edx, 0FFFFFFFCh push edx xor edx, edx ; Wait. aqsl30: inc edx test [ecx].LqLock, LOCK_QUEUE_WAIT ; check if still waiting jz short aqsl40 ; jif lock acquired YIELD ; fire avoidance. jmp short aqsl30 ; else, continue waiting aqsl40: push edx push 000020104h ; 2 Dwords, Timestamp, Subcode = 4 call _CAP_Log_NInt add esp, 12 jmp short aqsl20 else ; Wait. @@: test [ecx].LqLock, LOCK_QUEUE_WAIT ; check if still waiting jz short aqsl20 ; jif lock acquired YIELD ; fire avoidance. jmp short @b ; else, continue waiting endif endif fstENDP KeAcquireQueuedSpinLockAtDpcLevel page ,132 subttl "Release In Stack Queued SpinLock From Dpc Level" ;++ ; ; VOID ; FASTCALL ; KeReleaseInStackQueuedSpinLockFromDpcLevel ( ; IN PKLOCK_QUEUE_HANDLE LockHandle ; ) ; ; Routine Description: ; ; This function releases a queued spinlock and preserves the current ; IRQL. ; ; Arguments: ; ; LockHandle (ecx) - Supplies the address of a lock handle. ; ; Return Value: ; ; None. ; ;-- cPublicFastCall KeReleaseInStackQueuedSpinLockFromDpcLevel,1 cPublicFpo 0,0 ifndef NT_UP lea ecx, dword ptr[ecx+LqhNext] ; compute address of lock queue jmp short @KeReleaseQueuedSpinLockFromDpcLevel@4 ; finish in common code else fstRET KeReleaseInStackQueuedSpinLockFromDpcLevel endif fstENDP KeReleaseInStackQueuedSpinLockFromDpcLevel page ,132 subttl "Release Queued SpinLock" ;++ ; ; VOID ; KeReleaseQueuedSpinLockFromDpcLevel ( ; IN PKSPIN_LOCK_QUEUE QueuedLock ; ) ; ; Routine Description: ; ; This function releases a queued spinlock. ; No change to IRQL is made, IRQL is not returned. It is ; expected IRQL is sufficient to avoid context switch. ; ; NOTE: This code may be modified for use during textmode ; setup if this is an MP kernel running with a UP HAL. ; ; Arguments: ; ; LockQueueEntry (ecx) - Supplies the address of the queued ; spinlock entry in this processor's ; PRCB. ; ; Return Value: ; ; None. ; ;-- cPublicFastCall KeReleaseQueuedSpinLockFromDpcLevel,1 cPublicFpo 0,0 .errnz (LOCK_QUEUE_OWNER - 2) ; error if not bit 1 for btr ifndef NT_UP mov eax, ecx ; need in eax for cmpxchg mov edx, [ecx].LqNext mov ecx, [ecx].LqLock ifdef CAPKERN_SYNCH_POINTS push ecx and ecx, 0FFFFFFFCh push ecx push 000010107h ; 1 Dword, Timestamp, Subcode = 7 call _CAP_Log_NInt add esp, 8 pop ecx endif ; Quick check: If Lock Queue entry's Next field is not NULL, ; there is another waiter. Don't bother with ANY atomic ops ; in this case. ; ; N.B. Careful ordering, the test will clear the CF bit and set ; the ZF bit appropriately if the Next Field (in EDX) is zero. ; The BTR will set the CF bit to the previous value of the owner ; bit. test edx, edx ; Clear the "I am owner" field in the Lock entry. btr ecx, 1 ; clear owner bit if DBG jnc short rqsl90 ; bugcheck if was not set ; tests CF endif mov [eax].LqLock, ecx ; clear lock bit in queue entry jnz short rqsl40 ; jif another processor waits ; tests ZF xor edx, edx ; new lock owner will be NULL push eax ; save &PRCB->LockQueue[Number] ; Use compare exchange to attempt to clear the actual lock. ; If there are still no processors waiting for the lock when ; the compare exchange happens, the old contents of the lock ; should be the address of this lock entry (eax). lock cmpxchg [ecx], edx ; store 0 if no waiters pop eax ; restore lock queue address jnz short rqsl60 ; jif store failed ; The lock has been released. Return to caller. endif fstRET KeReleaseQueuedSpinLockFromDpcLevel ifndef NT_UP ; Another processor is waiting on this lock. Hand the lock ; to that processor by getting the address of its LockQueue ; entry, turning ON its owner bit and OFF its wait bit. rqsl40: xor [edx].LqLock, (LOCK_QUEUE_OWNER+LOCK_QUEUE_WAIT) ; Done, the other processor now owns the lock, clear the next ; field in my LockQueue entry (to preserve the order for entering ; the queue again) and return. mov [eax].LqNext, 0 fstRET KeReleaseQueuedSpinLockFromDpcLevel ; We get here if another processor is attempting to acquire ; the lock but had not yet updated the next field in this ; processor's Queued Lock Next field. Wait for the next ; field to be updated. ifdef CAPKERN_SYNCH_POINTS rqsl60: push ecx xor ecx, ecx rqsl70: inc ecx mov edx, [eax].LqNext test edx, edx ; check if still 0 jnz short rqsl80 ; jif Next field now set. YIELD ; wait a bit jmp short rqsl70 ; continue waiting rqsl80: push ecx push 000020104h ; 2 Dwords, Timestamp, Subcode = 4 call _CAP_Log_NInt add esp, 12 jmp short rqsl40 else rqsl60: mov edx, [eax].LqNext test edx, edx ; check if still 0 jnz short rqsl40 ; jif Next field now set. YIELD ; wait a bit jmp short rqsl60 ; continue waiting endif if DBG rqsl90: stdCall _KeBugCheckEx,<SPIN_LOCK_NOT_OWNED,ecx,eax,0,0> int 3 ; help debugger back trace. endif endif fstENDP KeReleaseQueuedSpinLockFromDpcLevel endif page ,132 subttl "Try to Acquire Queued SpinLock" ;++ ; ; LOGICAL ; KeTryToAcquireQueuedSpinLockAtRaisedIrql ( ; IN PKSPIN_LOCK_QUEUE QueuedLock ; ) ; ; Routine Description: ; ; This function attempts to acquire the specified queued spinlock. ; No change to IRQL is made, IRQL is not returned. It is ; expected IRQL is sufficient to avoid context switch. ; ; NOTE: This code may be modified for use during textmode ; setup if this is an MP kernel running with a UP HAL. ; ; Arguments: ; ; LockQueueEntry (ecx) - Supplies the address of the queued ; spinlock entry in this processor's ; PRCB. ; ; Return Value: ; ; TRUE if the lock was acquired, FALSE otherwise. ; N.B. ZF is set if FALSE returned, clear otherwise. ; ;-- align 16 cPublicFastCall KeTryToAcquireQueuedSpinLockAtRaisedIrql,1 cPublicFpo 0,0 ifndef NT_UP ; Get address of Lock Queue entry mov edx, [ecx].LqLock ifdef CAPKERN_SYNCH_POINTS push edx push 000010108h ; 1 Dword, Timestamp, Subcode = 8 call _CAP_Log_NInt add esp, 8 endif ; Store the Lock Queue entry address in the lock ONLY if the ; current lock value is 0. xor eax, eax ; old value must be 0 lock cmpxchg [edx], ecx jnz short taqsl60 ; Lock has been acquired. ; note: the actual lock address will be word aligned, we use ; the bottom two bits as indicators, bit 0 is LOCK_QUEUE_WAIT, ; bit 1 is LOCK_QUEUE_OWNER. or edx, LOCK_QUEUE_OWNER ; mark self as lock owner mov [ecx].LqLock, edx ifdef QLOCK_STAT_GATHER mov edx, [esp] fstCall KiQueueStatTrySucceeded endif or eax, 1 ; return TRUE fstRET KeTryToAcquireQueuedSpinLockAtRaisedIrql taqsl60: if 0 ; note: it is not fatal if the current processor already owns the ; lock as this is perfectly normal - just return FALSE. test edx, LOCK_QUEUE_OWNER jz short @f stdCall _KeBugCheckEx,<SPIN_LOCK_ALREADY_OWNED, edx, ecx,0,1> @@: endif ; The lock is already held by another processor. Indicate ; failure to the caller. ifdef QLOCK_STAT_GATHER fstCall KiQueueStatTryFailed endif xor eax, eax ; return FALSE fstRET KeTryToAcquireQueuedSpinLockAtRaisedIrql ; In the event that this is an MP kernel running with a UP ; HAL, the following UP version is copied over the MP version ; during kernel initialization. public _KeTryToAcquireQueuedSpinLockAtRaisedIrqlUP _KeTryToAcquireQueuedSpinLockAtRaisedIrqlUP: endif ; UP version, always succeed. xor eax, eax or eax, 1 fstRet KeTryToAcquireQueuedSpinLockAtRaisedIrql fstENDP KeTryToAcquireQueuedSpinLockAtRaisedIrql _TEXT$00 ends end
SPC/spc.asm
Kannagi/Super-Kannagi-Sound
11
84161
<filename>SPC/spc.asm<gh_stars>10-100 .DEFINE SPCRAM $200 .DEFINE LKS_SPC_CONTROL $10 .DEFINE LKS_SPC_ADDR $11 .DEFINE LKS_SPC_DATA $12 .DEFINE LKS_SPC_PLAY $13 .DEFINE LKS_SPC_VOLUME $14 .DEFINE LKS_SPC_TICKS $15 .DEFINE LKS_SPC_RVOLUME $16 .DEFINE LKS_SPC_RDATA $17 .DEFINE LKS_SPC_DATA2 $18 .DEFINE LKS_SPC_BRR_VOLUME $20 .DEFINE LKS_SPC_BRR_PLAY $21 .DEFINE LKS_SPC_BRR_PITCH $22 .DEFINE LKS_SPC_BRR_INIT $23 ;----------------- .DEFINE LKS_SPC_OFF $00 .DEFINE LKS_SPC_ON $01 .DEFINE LKS_SPC_LOOP $02 ;----------------- .DEFINE LKS_SPC_SPLDIR $1100 .DEFINE LKS_SPC_HEADER $1500 .DEFINE LKS_SPC_TRACK $1600 ;size $2A00 .DEFINE LKS_SPC_SAMPLE $4000 .DEFINE LKS_SPC_SZSPL $00BD .MACRO WaitAPUIO -: cmp APUIO0+\1 bne - .ENDM .MACRO LKS_SPC_WAIT lda LKS_SPC_VAR sta APUIO0 -: cmp APUIO0 beq - lda APUIO0 sta LKS_SPC_VAR stz APUIO1 .ENDM .MACRO LKS_SPC_Get lda #\1 sta APUIO1 LKS_SPC_WAIT .ENDM .MACRO LKS_SPC_Set_var lda #\1 sta APUIO1 LKS_SPC_WAIT .ENDM .MACRO LKS_SPC_Set lda #\1 sta APUIO1 lda #\2 sta APUIO2 lda #\3 sta APUIO3 LKS_SPC_WAIT .ENDM .MACRO LKS_SPC_Set2 lda #\1 sta APUIO1 ldx #\2 stx APUIO2 LKS_SPC_WAIT .ENDM .MACRO LKS_SPC_Set3 ldx #0 --: lda #\1 sta APUIO1 lda.l \2,x sta APUIO2 LKS_SPC_WAIT inx cpx #\3 bne -- .ENDM .MACRO LKS_SPC_Set3_2 ldx #0 --: lda #\1 sta APUIO1 lda.l \2,x sta APUIO2 inx lda.l \2,x sta APUIO3 lda LKS_SPC_VAR sta APUIO0 LKS_SPC_WAIT inx cpx #\3 bcc -- .ENDM .MACRO SPC_Procedure1 lda #$AA WaitAPUIO 0 sta APUIO0 lda #$BB WaitAPUIO 1 .ENDM .MACRO SPC_Procedure2 ldx #\1 stx APUIO2 lda #$CC sta APUIO1 sta APUIO0 WaitAPUIO 0 .ENDM .MACRO SPC_Procedure3 ldx #0 --: lda.l \1,x sta APUIO1 txa sta APUIO0 WaitAPUIO 0 inx cpx #$1300 bne -- .ENDM .MACRO SPC_Procedure4 stz APUIO1 ldx #\1 stx APUIO2 lda APUIO0 clc adc #$22 sta APUIO0 WaitAPUIO 0 .ENDM .MACRO SPC_Procedure5 stz APUIO1 ldx #\1 stx APUIO2 lda APUIO0 clc adc #$2 cmp #0 bne + clc adc #$2 +: sta APUIO0 WaitAPUIO 0 .ENDM
assembly_code/chp3_05.asm
Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions
104
242963
<reponame>Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions ;Binary Search [org 0x0100] jmp start1 data: db 1,2,3,4,5,6,7,8,9,10,11 start: db 0 end: db 10 key: db -1 start1: mov al,[key] loop1: mov cl,[start] cmp cl,[end] ja end1 ;Checking if(start<=end), if not then jump to end1 mov dl,[start] add dl,[end] ;dl is basically now start + end sar dl,1 ;here dl is being divided by 2 mov bl,dl ;bl is mid and is calculated by (start + end)/2 cmp al, [data + bx] je store ; agar data mil gaya tw program end kar do ja step1 ; agar data greater hai current element sey jb step2 ; agar data smaller hai current element sey step1: add dl,1 ;mid + 1 kar do mov [start],dl ;start ko ab mid + 1 kar do taakey hum mid se aagey jaga par dekhein jmp loop1 step2: sub dl,1 ;mid -1 kar do mov[end],dl ;end ko ab mid - 1 kar do taakey hum mid se previous jaga par dekhein jmp loop1 store: mov ax, 1 mov ax,0x4c00 int 21h end1: mov ax,0 mov ax,0x4c00 int 21h
alloy4fun_models/trashltl/models/16/2tcW9wcANStzK5S5C.als
Kaixi26/org.alloytools.alloy
0
1776
open main pred id2tcW9wcANStzK5S5C_prop17 { } pred __repair { id2tcW9wcANStzK5S5C_prop17 } check __repair { id2tcW9wcANStzK5S5C_prop17 <=> prop17o }
Cubical/Data/NatPlusOne/Properties.agda
cmester0/cubical
1
11510
<reponame>cmester0/cubical {-# OPTIONS --cubical --no-exact-split --safe #-} module Cubical.Data.NatPlusOne.Properties where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Data.Nat open import Cubical.Data.NatPlusOne.Base 1+Path : ℕ ≡ ℕ₊₁ 1+Path = isoToPath (iso 1+_ -1+_ (λ _ → refl) (λ _ → refl))
mc-sema/validator/x86_64/tests/IMUL64rri8.asm
randolphwong/mcsema
2
7891
BITS 64 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_SF|FLAG_ZF|FLAG_AF|FLAG_PF ;TEST_FILE_META_END ; IMUL64rri8 mov ebx, 0x20000 mov ecx, 0x34343434 ;TEST_BEGIN_RECORDING imul ebx, ecx, 0xb ;TEST_END_RECORDING
ee/wman/drarr.asm
olifink/smsqe
0
4634
* Window Manager Draw Arrows V1.01  1986 <NAME> QJUMP * 2002 <NAME> * * 2002-11-13 1.01 Allocated more space for pattern on stack (MK) * section wman * xdef wm_drupa draw up arrows xdef wm_drdna draw down arrows xdef wm_drlta draw left arrows xdef wm_drrta draw right arrows * xref wm_ssclr set single colour blob * xref wm_uparr xref wm_dnarr xref wm_ltarr xref wm_rtarr * include dev8_keys_wwork include dev8_keys_qdos_io * * d0 s * d1 s * d2 s 0 * d3 s -1 * d4 c p area size * d5 c p area origin * d6 sp position increment * d7 sp blob count * a0 c p window channel ID * a4 c p window definition * reglist reg d4-d7/a1/a2 pattern equ $60 pattern frame frame equ $60+4 pattern + pointer to blob blob equ $60 * wm_drupa movem.l reglist,-(sp) pea wm_uparr(pc) draw up arrows bra.s wm_drscr wm_drdna movem.l reglist,-(sp) addq.w #ww.scarr-1,d5 for down arrow, origin at bottom pea wm_dnarr(pc) draw down arrows * * draw scrolling arrows * wm_drscr sub.w #pattern,sp clr.w d4 swap d4 width of scroll area sub.w #ww.scawd,d4 less arrow width blt.s wda_exit moveq #ww.scasp,d6 divu d6,d4 divided by spacing move.w d4,d7 ... number to draw (-1) * add.l #ww.scawd<<16,d4 width + lsr.l #1,d4 ... remainder (/2) clr.w d4 ... is offset to first one add.l d4,d5 swap d6 and spacing move.w wwa_psac+wwa.clen(a3),d1 ; scroll arrow colour bra.s wda_do * * wm_drlta movem.l reglist,-(sp) pea wm_ltarr(pc) draw left arrows bra.s wm_drpan wm_drrta movem.l reglist,-(sp) add.l #(ww.pnarr-1)<<16,d5 for right arrow, origin at right pea wm_rtarr(pc) draw right arrows * * draw panning arrows * wm_drpan sub.w #pattern,sp sub.w #ww.pnaht,d4 ; height less arrow height blt.s wda_exit ext.l d4 moveq #ww.pnasp,d6 divu d6,d4 ; divided by spacing move.w d4,d7 ; ... number to draw (-1) * swap d4 add.w #ww.pnaht,d4 lsr.w #1,d4 ; remainder (/2) add.w d4,d5 ; is offset of first move.w wwa_psac(a3),d1 ; pan arrow colour * * wda_do move.l sp,a2 set pointer to colour pattern * move.l ww_wstat(a4),a1 bsr.l wm_ssclr * wda_loop moveq #iop.wblb,d0 write blob move.l d5,d1 ... position moveq #0,d2 moveq #-1,d3 move.l blob(sp),a1 ... pointer to blob trap #3 * add.l d6,d5 update position dbra d7,wda_loop * wda_exit add.w #frame,sp movem.l (sp)+,reglist rts end
sampleprj/adalib/src/exemple.adb
astyl/AcrobatomaticBuildSystem
10
29660
<reponame>astyl/AcrobatomaticBuildSystem package body Example is function Hello(i: in Integer) return Integer is begin return i+1; end Hello; end Example;
programs/oeis/227/A227582.asm
karttu/loda
1
243204
<gh_stars>1-10 ; A227582: Expansion of (2+3*x+2*x^2+2*x^3+3*x^4+x^5-x^6)/(1-2*x+x^2-x^5+2*x^6-x^7). ; 2,7,14,23,35,50,67,86,107,131,158,187,218,251,287,326,367,410,455,503,554,607,662,719,779,842,907,974,1043,1115,1190,1267,1346,1427,1511,1598,1687,1778,1871,1967,2066,2167,2270,2375,2483,2594,2707,2822,2939 mov $1,$0 add $1,3 mul $1,$0 mul $1,6 add $1,1 div $1,5 add $1,2
Chapter1/#10.agda
CodaFi/HoTT-Exercises
0
7223
module #10 where {- Exercise 1.10. Show that the Ackermann function ack : N → N → N is definable using only recN satisfying the following equations: -} open import Data.Nat open import Relation.Binary.PropositionalEquality recₙ : ∀{c}{C : Set c} → C → (ℕ → C → C) → ℕ → C recₙ c₀ cₛ zero = c₀ recₙ c₀ cₛ (suc n) = cₛ n (recₙ c₀ cₛ n) ack : ℕ → ℕ → ℕ ack zero n = suc n ack (suc m) zero = ack m 1 ack (suc m) (suc n) = ack m (ack (suc m) n) ack-rec : ℕ → ℕ → ℕ ack-rec = recₙ suc (λ m cont → recₙ (cont 1) (λ _ n → cont n)) {- The process of proving this might destroy my computer, so no. ack-β : (n m : ℕ) → ack m n ≡ ack-rec m n ack-β m n = {!!} -}
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr2.ads
best08618/asylo
7
17923
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr2.ads package discr2 is procedure Dummy; end discr2;
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-numaux.adb
orb-zhuchen/Orb
0
3238
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . N U M E R I C S . A U X -- -- -- -- B o d y -- -- (Machine Version for x86) -- -- -- -- Copyright (C) 1998-2019, 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. -- -- -- ------------------------------------------------------------------------------ with System.Machine_Code; use System.Machine_Code; package body Ada.Numerics.Aux is NL : constant String := ASCII.LF & ASCII.HT; ----------------------- -- Local subprograms -- ----------------------- function Is_Nan (X : Double) return Boolean; -- Return True iff X is a IEEE NaN value function Logarithmic_Pow (X, Y : Double) return Double; -- Implementation of X**Y using Exp and Log functions (binary base) -- to calculate the exponentiation. This is used by Pow for values -- for values of Y in the open interval (-0.25, 0.25) procedure Reduce (X : in out Double; Q : out Natural); -- Implement reduction of X by Pi/2. Q is the quadrant of the final -- result in the range 0..3. The absolute value of X is at most Pi/4. -- It is needed to avoid a loss of accuracy for sin near Pi and cos -- near Pi/2 due to the use of an insufficiently precise value of Pi -- in the range reduction. pragma Inline (Is_Nan); pragma Inline (Reduce); -------------------------------- -- Basic Elementary Functions -- -------------------------------- -- This section implements a few elementary functions that are used to -- build the more complex ones. This ordering enables better inlining. ---------- -- Atan -- ---------- function Atan (X : Double) return Double is Result : Double; begin Asm (Template => "fld1" & NL & "fpatan", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", X)); -- The result value is NaN iff input was invalid if not (Result = Result) then raise Argument_Error; end if; return Result; end Atan; --------- -- Exp -- --------- function Exp (X : Double) return Double is Result : Double; begin Asm (Template => "fldl2e " & NL & "fmulp %%st, %%st(1)" & NL -- X * log2 (E) & "fld %%st(0) " & NL & "frndint " & NL -- Integer (X * Log2 (E)) & "fsubr %%st, %%st(1)" & NL -- Fraction (X * Log2 (E)) & "fxch " & NL & "f2xm1 " & NL -- 2**(...) - 1 & "fld1 " & NL & "faddp %%st, %%st(1)" & NL -- 2**(Fraction (X * Log2 (E))) & "fscale " & NL -- E ** X & "fstp %%st(1) ", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", X)); return Result; end Exp; ------------ -- Is_Nan -- ------------ function Is_Nan (X : Double) return Boolean is begin -- The IEEE NaN values are the only ones that do not equal themselves return X /= X; end Is_Nan; --------- -- Log -- --------- function Log (X : Double) return Double is Result : Double; begin Asm (Template => "fldln2 " & NL & "fxch " & NL & "fyl2x " & NL, Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", X)); return Result; end Log; ------------ -- Reduce -- ------------ procedure Reduce (X : in out Double; Q : out Natural) is Half_Pi : constant := Pi / 2.0; Two_Over_Pi : constant := 2.0 / Pi; HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size); M : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant P1 : constant Double := Double'Leading_Part (Half_Pi, HM); P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM); P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM); P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM); P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3 - P4, HM); P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5); K : Double; R : Integer; begin -- For X < 2.0**HM, all products below are computed exactly. -- Due to cancellation effects all subtractions are exact as well. -- As no double extended floating-point number has more than 75 -- zeros after the binary point, the result will be the correctly -- rounded result of X - K * (Pi / 2.0). K := X * Two_Over_Pi; while abs K >= 2.0**HM loop K := K * M - (K * M - K); X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6; K := X * Two_Over_Pi; end loop; -- If K is not a number (because X was not finite) raise exception if Is_Nan (K) then raise Constraint_Error; end if; -- Go through an integer temporary so as to use machine instructions R := Integer (Double'Rounding (K)); Q := R mod 4; K := Double (R); X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6; end Reduce; ---------- -- Sqrt -- ---------- function Sqrt (X : Double) return Double is Result : Double; begin if X < 0.0 then raise Argument_Error; end if; Asm (Template => "fsqrt", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", X)); return Result; end Sqrt; -------------------------------- -- Other Elementary Functions -- -------------------------------- -- These are built using the previously implemented basic functions ---------- -- Acos -- ---------- function Acos (X : Double) return Double is Result : Double; begin Result := 2.0 * Atan (Sqrt ((1.0 - X) / (1.0 + X))); -- The result value is NaN iff input was invalid if Is_Nan (Result) then raise Argument_Error; end if; return Result; end Acos; ---------- -- Asin -- ---------- function Asin (X : Double) return Double is Result : Double; begin Result := Atan (X / Sqrt ((1.0 - X) * (1.0 + X))); -- The result value is NaN iff input was invalid if Is_Nan (Result) then raise Argument_Error; end if; return Result; end Asin; --------- -- Cos -- --------- function Cos (X : Double) return Double is Reduced_X : Double := abs X; Result : Double; Quadrant : Natural range 0 .. 3; begin if Reduced_X > Pi / 4.0 then Reduce (Reduced_X, Quadrant); case Quadrant is when 0 => Asm (Template => "fcos", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); when 1 => Asm (Template => "fsin", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", -Reduced_X)); when 2 => Asm (Template => "fcos ; fchs", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); when 3 => Asm (Template => "fsin", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end case; else Asm (Template => "fcos", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end if; return Result; end Cos; --------------------- -- Logarithmic_Pow -- --------------------- function Logarithmic_Pow (X, Y : Double) return Double is Result : Double; begin Asm (Template => "" -- X : Y & "fyl2x " & NL -- Y * Log2 (X) & "fld %%st(0) " & NL -- Y * Log2 (X) : Y * Log2 (X) & "frndint " & NL -- Int (...) : Y * Log2 (X) & "fsubr %%st, %%st(1)" & NL -- Int (...) : Fract (...) & "fxch " & NL -- Fract (...) : Int (...) & "f2xm1 " & NL -- 2**Fract (...) - 1 : Int (...) & "fld1 " & NL -- 1 : 2**Fract (...) - 1 : Int (...) & "faddp %%st, %%st(1)" & NL -- 2**Fract (...) : Int (...) & "fscale ", -- 2**(Fract (...) + Int (...)) Outputs => Double'Asm_Output ("=t", Result), Inputs => (Double'Asm_Input ("0", X), Double'Asm_Input ("u", Y))); return Result; end Logarithmic_Pow; --------- -- Pow -- --------- function Pow (X, Y : Double) return Double is type Mantissa_Type is mod 2**Double'Machine_Mantissa; -- Modular type that can hold all bits of the mantissa of Double -- For negative exponents, do divide at the end of the processing Negative_Y : constant Boolean := Y < 0.0; Abs_Y : constant Double := abs Y; -- During this function the following invariant is kept: -- X ** (abs Y) = Base**(Exp_High + Exp_Mid + Exp_Low) * Factor Base : Double := X; Exp_High : Double := Double'Floor (Abs_Y); Exp_Mid : Double; Exp_Low : Double; Exp_Int : Mantissa_Type; Factor : Double := 1.0; begin -- Select algorithm for calculating Pow (integer cases fall through) if Exp_High >= 2.0**Double'Machine_Mantissa then -- In case of Y that is IEEE infinity, just raise constraint error if Exp_High > Double'Safe_Last then raise Constraint_Error; end if; -- Large values of Y are even integers and will stay integer -- after division by two. loop -- Exp_Mid and Exp_Low are zero, so -- X**(abs Y) = Base ** Exp_High = (Base**2) ** (Exp_High / 2) Exp_High := Exp_High / 2.0; Base := Base * Base; exit when Exp_High < 2.0**Double'Machine_Mantissa; end loop; elsif Exp_High /= Abs_Y then Exp_Low := Abs_Y - Exp_High; Factor := 1.0; if Exp_Low /= 0.0 then -- Exp_Low now is in interval (0.0, 1.0) -- Exp_Mid := Double'Floor (Exp_Low * 4.0) / 4.0; Exp_Mid := 0.0; Exp_Low := Exp_Low - Exp_Mid; if Exp_Low >= 0.5 then Factor := Sqrt (X); Exp_Low := Exp_Low - 0.5; -- exact if Exp_Low >= 0.25 then Factor := Factor * Sqrt (Factor); Exp_Low := Exp_Low - 0.25; -- exact end if; elsif Exp_Low >= 0.25 then Factor := Sqrt (Sqrt (X)); Exp_Low := Exp_Low - 0.25; -- exact end if; -- Exp_Low now is in interval (0.0, 0.25) -- This means it is safe to call Logarithmic_Pow -- for the remaining part. Factor := Factor * Logarithmic_Pow (X, Exp_Low); end if; elsif X = 0.0 then return 0.0; end if; -- Exp_High is non-zero integer smaller than 2**Double'Machine_Mantissa Exp_Int := Mantissa_Type (Exp_High); -- Standard way for processing integer powers > 0 while Exp_Int > 1 loop if (Exp_Int and 1) = 1 then -- Base**Y = Base**(Exp_Int - 1) * Exp_Int for Exp_Int > 0 Factor := Factor * Base; end if; -- Exp_Int is even and Exp_Int > 0, so -- Base**Y = (Base**2)**(Exp_Int / 2) Base := Base * Base; Exp_Int := Exp_Int / 2; end loop; -- Exp_Int = 1 or Exp_Int = 0 if Exp_Int = 1 then Factor := Base * Factor; end if; if Negative_Y then Factor := 1.0 / Factor; end if; return Factor; end Pow; --------- -- Sin -- --------- function Sin (X : Double) return Double is Reduced_X : Double := X; Result : Double; Quadrant : Natural range 0 .. 3; begin if abs X > Pi / 4.0 then Reduce (Reduced_X, Quadrant); case Quadrant is when 0 => Asm (Template => "fsin", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); when 1 => Asm (Template => "fcos", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); when 2 => Asm (Template => "fsin", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", -Reduced_X)); when 3 => Asm (Template => "fcos ; fchs", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end case; else Asm (Template => "fsin", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end if; return Result; end Sin; --------- -- Tan -- --------- function Tan (X : Double) return Double is Reduced_X : Double := X; Result : Double; Quadrant : Natural range 0 .. 3; begin if abs X > Pi / 4.0 then Reduce (Reduced_X, Quadrant); if Quadrant mod 2 = 0 then Asm (Template => "fptan" & NL & "ffree %%st(0)" & NL & "fincstp", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); else Asm (Template => "fsincos" & NL & "fdivp %%st, %%st(1)" & NL & "fchs", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end if; else Asm (Template => "fptan " & NL & "ffree %%st(0) " & NL & "fincstp ", Outputs => Double'Asm_Output ("=t", Result), Inputs => Double'Asm_Input ("0", Reduced_X)); end if; return Result; end Tan; ---------- -- Sinh -- ---------- function Sinh (X : Double) return Double is begin -- Mathematically Sinh (x) is defined to be (Exp (X) - Exp (-X)) / 2.0 if abs X < 25.0 then return (Exp (X) - Exp (-X)) / 2.0; else return Exp (X) / 2.0; end if; end Sinh; ---------- -- Cosh -- ---------- function Cosh (X : Double) return Double is begin -- Mathematically Cosh (X) is defined to be (Exp (X) + Exp (-X)) / 2.0 if abs X < 22.0 then return (Exp (X) + Exp (-X)) / 2.0; else return Exp (X) / 2.0; end if; end Cosh; ---------- -- Tanh -- ---------- function Tanh (X : Double) return Double is begin -- Return the Hyperbolic Tangent of x -- x -x -- e - e Sinh (X) -- Tanh (X) is defined to be ----------- = -------- -- x -x Cosh (X) -- e + e if abs X > 23.0 then return Double'Copy_Sign (1.0, X); end if; return 1.0 / (1.0 + Exp (-(2.0 * X))) - 1.0 / (1.0 + Exp (2.0 * X)); end Tanh; end Ada.Numerics.Aux;
corpus/antlr4/training/VisualBasic6.g4
antlr/groom
408
3315
<reponame>antlr/groom<gh_stars>100-1000 /* * Copyright (C) 2016, <NAME> <<EMAIL>> * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD 3-clause license. See the LICENSE file for details. */ /* * Visual Basic 6.0 Grammar for ANTLR4 * * This is an approximate grammar for Visual Basic 6.0, derived * from the Visual Basic 6.0 language reference * http://msdn.microsoft.com/en-us/library/aa338033%28v=vs.60%29.aspx * and tested against MSDN VB6 statement examples as well as several Visual * Basic 6.0 code repositories. * * Characteristics: * * 1. This grammar is line-based and takes into account whitespace, so that * member calls (e.g. "A.B") are distinguished from contextual object calls * in WITH statements (e.g. "A .B"). * * 2. Keywords can be used as identifiers depending on the context, enabling * e.g. "A.Type", but not "Type.B". * * * Known limitations: * * 1. Preprocessor statements (#if, #else, ...) must not interfere with regular * statements. * * 2. Comments are skipped. * * * Change log: * * v1.4 * - erase statement fix * - explicit token definition * * v1.3 * - call statement precedence * * v1.2 * - refined call statements * * v1.1 * - precedence of operators and of ELSE in select statements * - optimized member calls * * v1.0 Initial revision */ grammar VisualBasic6; options { language = Java; } // module ---------------------------------- startRule : module EOF ; module : WS? NEWLINE* (moduleHeader NEWLINE+)? moduleConfig? NEWLINE* moduleAttributes? NEWLINE* moduleOptions? NEWLINE* moduleBody? NEWLINE* WS? ; moduleHeader : VERSION WS DOUBLELITERAL WS CLASS ; moduleConfig : BEGIN NEWLINE+ moduleConfigElement+ END NEWLINE+ ; moduleConfigElement : ambiguousIdentifier WS? EQ WS? literal NEWLINE ; moduleAttributes : (attributeStmt NEWLINE+)+ ; moduleOptions : (moduleOption NEWLINE+)+ ; moduleOption : OPTION_BASE WS INTEGERLITERAL # optionBaseStmt | OPTION_COMPARE WS (BINARY | TEXT) # optionCompareStmt | OPTION_EXPLICIT # optionExplicitStmt | OPTION_PRIVATE_MODULE # optionPrivateModuleStmt ; moduleBody : moduleBodyElement (NEWLINE+ moduleBodyElement)* ; moduleBodyElement : moduleBlock | declareStmt | enumerationStmt | eventStmt | functionStmt | macroIfThenElseStmt | propertyGetStmt | propertySetStmt | propertyLetStmt | subStmt | typeStmt ; // block ---------------------------------- moduleBlock : block ; attributeStmt : ATTRIBUTE WS implicitCallStmt_InStmt WS? EQ WS? literal (WS? COMMA WS? literal)* ; block : blockStmt (NEWLINE+ WS? blockStmt)* ; blockStmt : appactivateStmt | attributeStmt | beepStmt | chdirStmt | chdriveStmt | closeStmt | constStmt | dateStmt | deleteSettingStmt | deftypeStmt | doLoopStmt | endStmt | eraseStmt | errorStmt | exitStmt | explicitCallStmt | filecopyStmt | forEachStmt | forNextStmt | getStmt | goSubStmt | goToStmt | ifThenElseStmt | implementsStmt | inputStmt | killStmt | letStmt | lineInputStmt | lineLabel | loadStmt | lockStmt | lsetStmt | macroIfThenElseStmt | midStmt | mkdirStmt | nameStmt | onErrorStmt | onGoToStmt | onGoSubStmt | openStmt | printStmt | putStmt | raiseEventStmt | randomizeStmt | redimStmt | resetStmt | resumeStmt | returnStmt | rmdirStmt | rsetStmt | savepictureStmt | saveSettingStmt | seekStmt | selectCaseStmt | sendkeysStmt | setattrStmt | setStmt | stopStmt | timeStmt | unloadStmt | unlockStmt | variableStmt | whileWendStmt | widthStmt | withStmt | writeStmt | implicitCallStmt_InBlock ; // statements ---------------------------------- appactivateStmt : APPACTIVATE WS valueStmt (WS? COMMA WS? valueStmt) ; beepStmt : BEEP ; chdirStmt : CHDIR WS valueStmt ; chdriveStmt : CHDRIVE WS valueStmt ; closeStmt : CLOSE (WS valueStmt (WS? COMMA WS? valueStmt)*)? ; constStmt : (visibility WS)? CONST WS constSubStmt (WS? COMMA WS? constSubStmt)* ; constSubStmt : ambiguousIdentifier typeHint? (WS asTypeClause)? WS? EQ WS? valueStmt ; dateStmt : DATE WS? EQ WS? valueStmt ; declareStmt : (visibility WS)? DECLARE WS (FUNCTION typeHint? | SUB) WS ambiguousIdentifier typeHint? WS LIB WS STRINGLITERAL (WS ALIAS WS STRINGLITERAL)? (WS? argList)? (WS asTypeClause)? ; deftypeStmt : ( DEFBOOL | DEFBYTE | DEFINT | DEFLNG | DEFCUR | DEFSNG | DEFDBL | DEFDEC | DEFDATE | DEFSTR | DEFOBJ | DEFVAR ) WS letterrange (WS? COMMA WS? letterrange)* ; deleteSettingStmt : DELETESETTING WS valueStmt WS? COMMA WS? valueStmt (WS? COMMA WS? valueStmt)? ; doLoopStmt : DO NEWLINE+ (block NEWLINE+)? LOOP | DO WS (WHILE | UNTIL) WS valueStmt NEWLINE+ (block NEWLINE+)? LOOP | DO NEWLINE+ (block NEWLINE+) LOOP WS (WHILE | UNTIL) WS valueStmt ; endStmt : END ; enumerationStmt : (visibility WS)? ENUM WS ambiguousIdentifier NEWLINE+ (enumerationStmt_Constant)* END_ENUM ; enumerationStmt_Constant : ambiguousIdentifier (WS? EQ WS? valueStmt)? NEWLINE+ ; eraseStmt : ERASE WS valueStmt (WS? COMMA WS? valueStmt)* ; errorStmt : ERROR WS valueStmt ; eventStmt : (visibility WS)? EVENT WS ambiguousIdentifier WS? argList ; exitStmt : EXIT_DO | EXIT_FOR | EXIT_FUNCTION | EXIT_PROPERTY | EXIT_SUB ; filecopyStmt : FILECOPY WS valueStmt WS? COMMA WS? valueStmt ; forEachStmt : FOR WS EACH WS ambiguousIdentifier typeHint? WS IN WS valueStmt NEWLINE+ (block NEWLINE+)? NEXT (WS ambiguousIdentifier)? ; forNextStmt : FOR WS ambiguousIdentifier typeHint? (WS asTypeClause)? WS? EQ WS? valueStmt WS TO WS valueStmt (WS STEP WS valueStmt)? NEWLINE+ (block NEWLINE+)? NEXT (WS ambiguousIdentifier)? ; functionStmt : (visibility WS)? (STATIC WS)? FUNCTION WS ambiguousIdentifier (WS? argList)? (WS asTypeClause)? NEWLINE+ (block NEWLINE+)? END_FUNCTION ; getStmt : GET WS valueStmt WS? COMMA WS? valueStmt? WS? COMMA WS? valueStmt ; goSubStmt : GOSUB WS valueStmt ; goToStmt : GOTO WS valueStmt ; ifThenElseStmt : IF WS ifConditionStmt WS THEN WS blockStmt (WS ELSE WS blockStmt)? # inlineIfThenElse | ifBlockStmt ifElseIfBlockStmt* ifElseBlockStmt? END_IF # blockIfThenElse ; ifBlockStmt : IF WS ifConditionStmt WS THEN NEWLINE+ (block NEWLINE+)? ; ifConditionStmt : valueStmt ; ifElseIfBlockStmt : ELSEIF WS ifConditionStmt WS THEN NEWLINE+ (block NEWLINE+)? ; ifElseBlockStmt : ELSE NEWLINE+ (block NEWLINE+)? ; implementsStmt : IMPLEMENTS WS ambiguousIdentifier ; inputStmt : INPUT WS valueStmt (WS? COMMA WS? valueStmt)+ ; killStmt : KILL WS valueStmt ; letStmt : (LET WS)? implicitCallStmt_InStmt WS? (EQ | PLUS_EQ | MINUS_EQ) WS? valueStmt ; lineInputStmt : LINE_INPUT WS valueStmt WS? COMMA WS? valueStmt ; loadStmt : LOAD WS valueStmt ; lockStmt : LOCK WS valueStmt (WS? COMMA WS? valueStmt (WS TO WS valueStmt)?)? ; lsetStmt : LSET WS implicitCallStmt_InStmt WS? EQ WS? valueStmt ; macroIfThenElseStmt : macroIfBlockStmt macroElseIfBlockStmt* macroElseBlockStmt? MACRO_END_IF ; macroIfBlockStmt : MACRO_IF WS ifConditionStmt WS THEN NEWLINE+ (moduleBody NEWLINE+)? ; macroElseIfBlockStmt : MACRO_ELSEIF WS ifConditionStmt WS THEN NEWLINE+ (moduleBody NEWLINE+)? ; macroElseBlockStmt : MACRO_ELSE NEWLINE+ (moduleBody NEWLINE+)? ; midStmt : MID WS? LPAREN WS? argsCall WS? RPAREN ; mkdirStmt : MKDIR WS valueStmt ; nameStmt : NAME WS valueStmt WS AS WS valueStmt ; onErrorStmt : ON_ERROR WS (GOTO WS valueStmt | RESUME WS NEXT) ; onGoToStmt : ON WS valueStmt WS GOTO WS valueStmt (WS? COMMA WS? valueStmt)* ; onGoSubStmt : ON WS valueStmt WS GOSUB WS valueStmt (WS? COMMA WS? valueStmt)* ; openStmt : OPEN WS valueStmt WS FOR WS (APPEND | BINARY | INPUT | OUTPUT | RANDOM) (WS ACCESS WS (READ | WRITE | READ_WRITE))? (WS (SHARED | LOCK_READ | LOCK_WRITE | LOCK_READ_WRITE))? WS AS WS valueStmt (WS LEN WS? EQ WS? valueStmt)? ; outputList : outputList_Expression (WS? (SEMICOLON | COMMA) WS? outputList_Expression?)* | outputList_Expression? (WS? (SEMICOLON | COMMA) WS? outputList_Expression?)+ ; outputList_Expression : valueStmt | (SPC | TAB) (WS? LPAREN WS? argsCall WS? RPAREN)? ; printStmt : PRINT WS valueStmt WS? COMMA (WS? outputList)? ; propertyGetStmt : (visibility WS)? (STATIC WS)? PROPERTY_GET WS ambiguousIdentifier typeHint? (WS? argList)? (WS asTypeClause)? NEWLINE+ (block NEWLINE+)? END_PROPERTY ; propertySetStmt : (visibility WS)? (STATIC WS)? PROPERTY_SET WS ambiguousIdentifier (WS? argList)? NEWLINE+ (block NEWLINE+)? END_PROPERTY ; propertyLetStmt : (visibility WS)? (STATIC WS)? PROPERTY_LET WS ambiguousIdentifier (WS? argList)? NEWLINE+ (block NEWLINE+)? END_PROPERTY ; putStmt : PUT WS valueStmt WS? COMMA WS? valueStmt? WS? COMMA WS? valueStmt ; raiseEventStmt : RAISEEVENT WS ambiguousIdentifier (WS? LPAREN WS? (argsCall WS?)? RPAREN)? ; randomizeStmt : RANDOMIZE (WS valueStmt)? ; redimStmt : REDIM WS (PRESERVE WS)? redimSubStmt (WS? COMMA WS? redimSubStmt)* ; redimSubStmt : implicitCallStmt_InStmt WS? LPAREN WS? subscripts WS? RPAREN (WS asTypeClause)? ; resetStmt : RESET ; resumeStmt : RESUME (WS (NEXT | ambiguousIdentifier))? ; returnStmt : RETURN ; rmdirStmt : RMDIR WS valueStmt ; rsetStmt : RSET WS implicitCallStmt_InStmt WS? EQ WS? valueStmt ; savepictureStmt : SAVEPICTURE WS valueStmt WS? COMMA WS? valueStmt ; saveSettingStmt : SAVESETTING WS valueStmt WS? COMMA WS? valueStmt WS? COMMA WS? valueStmt WS? COMMA WS? valueStmt ; seekStmt : SEEK WS valueStmt WS? COMMA WS? valueStmt ; selectCaseStmt : SELECT WS CASE WS valueStmt NEWLINE+ sC_Case* WS? END_SELECT ; sC_Case : CASE WS sC_Cond WS? (COLON? NEWLINE* | NEWLINE+) (block NEWLINE+)? ; // ELSE first, so that it is not interpreted as a variable call sC_Cond : ELSE # caseCondElse | IS WS? comparisonOperator WS? valueStmt # caseCondIs | valueStmt (WS? COMMA WS? valueStmt)* # caseCondValue | INTEGERLITERAL WS TO WS valueStmt (WS? COMMA WS? valueStmt)* # caseCondTo ; sendkeysStmt : SENDKEYS WS valueStmt (WS? COMMA WS? valueStmt)? ; setattrStmt : SETATTR WS valueStmt WS? COMMA WS? valueStmt ; setStmt : SET WS implicitCallStmt_InStmt WS? EQ WS? valueStmt ; stopStmt : STOP ; subStmt : (visibility WS)? (STATIC WS)? SUB WS ambiguousIdentifier (WS? argList)? NEWLINE+ (block NEWLINE+)? END_SUB ; timeStmt : TIME WS? EQ WS? valueStmt ; typeStmt : (visibility WS)? TYPE WS ambiguousIdentifier NEWLINE+ (typeStmt_Element)* END_TYPE ; typeStmt_Element : ambiguousIdentifier (WS? LPAREN (WS? subscripts)? WS? RPAREN)? (WS asTypeClause)? NEWLINE+ ; typeOfStmt : TYPEOF WS valueStmt (WS IS WS type)? ; unloadStmt : UNLOAD WS valueStmt ; unlockStmt : UNLOCK WS valueStmt (WS? COMMA WS? valueStmt (WS TO WS valueStmt)?)? ; // operator precedence is represented by rule order valueStmt : literal # vsLiteral | implicitCallStmt_InStmt # vsICS | LPAREN WS? valueStmt (WS? COMMA WS? valueStmt)* RPAREN # vsStruct | NEW WS valueStmt # vsNew | typeOfStmt # vsTypeOf | midStmt # vsMid | ADDRESSOF WS valueStmt # vsAddressOf | implicitCallStmt_InStmt WS? ASSIGN WS? valueStmt # vsAssign | valueStmt WS IS WS valueStmt # vsIs | valueStmt WS LIKE WS valueStmt # vsLike | valueStmt WS? GEQ WS? valueStmt # vsGeq | valueStmt WS? LEQ WS? valueStmt # vsLeq | valueStmt WS? GT WS? valueStmt # vsGt | valueStmt WS? LT WS? valueStmt # vsLt | valueStmt WS? NEQ WS? valueStmt # vsNeq | valueStmt WS? EQ WS? valueStmt # vsEq | valueStmt WS AMPERSAND WS valueStmt # vsAmp | MINUS WS? valueStmt # vsNegation | PLUS WS? valueStmt # vsPlus | valueStmt WS? PLUS WS? valueStmt # vsAdd | valueStmt WS? MOD WS? valueStmt # vsMod | valueStmt WS? DIV WS? valueStmt # vsDiv | valueStmt WS? MULT WS? valueStmt # vsMult | valueStmt WS? MINUS WS? valueStmt # vsMinus | valueStmt WS? POW WS? valueStmt # vsPow | valueStmt WS IMP WS valueStmt # vsImp | valueStmt WS EQV WS valueStmt # vsEqv | valueStmt WS? XOR WS? valueStmt # vsXor | valueStmt WS? OR WS? valueStmt # vsOr | valueStmt WS AND WS valueStmt # vsAnd | NOT WS valueStmt # vsNot ; variableStmt : (DIM | STATIC | visibility) WS (WITHEVENTS WS)? variableListStmt ; variableListStmt : variableSubStmt (WS? COMMA WS? variableSubStmt)* ; variableSubStmt : ambiguousIdentifier (WS? LPAREN WS? (subscripts WS?)? RPAREN WS?)? typeHint? (WS asTypeClause)? ; whileWendStmt : WHILE WS valueStmt NEWLINE+ (block NEWLINE)* WEND ; widthStmt : WIDTH WS valueStmt WS? COMMA WS? valueStmt ; withStmt : WITH WS implicitCallStmt_InStmt NEWLINE+ (block NEWLINE+)? END_WITH ; writeStmt : WRITE WS valueStmt WS? COMMA (WS? outputList)? ; // complex call statements ---------------------------------- explicitCallStmt : eCS_ProcedureCall | eCS_MemberProcedureCall ; // parantheses are required in case of args -> empty parantheses are removed eCS_ProcedureCall : CALL WS ambiguousIdentifier typeHint? (WS? LPAREN WS? argsCall WS? RPAREN)? ; // parantheses are required in case of args -> empty parantheses are removed eCS_MemberProcedureCall : CALL WS implicitCallStmt_InStmt? DOT ambiguousIdentifier typeHint? (WS? LPAREN WS? argsCall WS? RPAREN)? ; implicitCallStmt_InBlock : iCS_B_ProcedureCall | iCS_B_MemberProcedureCall ; // parantheses are forbidden in case of args // variables cannot be called in blocks // certainIdentifier instead of ambiguousIdentifier for preventing ambiguity with statement keywords iCS_B_ProcedureCall : certainIdentifier (WS argsCall)? ; iCS_B_MemberProcedureCall : implicitCallStmt_InStmt? DOT ambiguousIdentifier typeHint? (WS argsCall)? dictionaryCallStmt? ; // iCS_S_MembersCall first, so that member calls are not resolved as separate iCS_S_VariableOrProcedureCalls implicitCallStmt_InStmt : iCS_S_MembersCall | iCS_S_VariableOrProcedureCall | iCS_S_ProcedureOrArrayCall | iCS_S_DictionaryCall ; iCS_S_VariableOrProcedureCall : ambiguousIdentifier typeHint? dictionaryCallStmt? ; iCS_S_ProcedureOrArrayCall : (ambiguousIdentifier | baseType) typeHint? WS? LPAREN WS? (argsCall WS?)? RPAREN dictionaryCallStmt? ; iCS_S_MembersCall : (iCS_S_VariableOrProcedureCall | iCS_S_ProcedureOrArrayCall)? iCS_S_MemberCall+ dictionaryCallStmt? ; iCS_S_MemberCall : DOT (iCS_S_VariableOrProcedureCall | iCS_S_ProcedureOrArrayCall) ; iCS_S_DictionaryCall : dictionaryCallStmt ; // atomic call statements ---------------------------------- argsCall : (argCall? WS? (COMMA | SEMICOLON) WS?)* argCall (WS? (COMMA | SEMICOLON) WS? argCall?)* ; argCall : ((BYVAL | BYREF | PARAMARRAY) WS)? valueStmt ; dictionaryCallStmt : EXCLAMATIONMARK ambiguousIdentifier typeHint? ; // atomic rules for statements argList : LPAREN (WS? arg (WS? COMMA WS? arg)*)? WS? RPAREN ; arg : (OPTIONAL WS)? ((BYVAL | BYREF) WS)? (PARAMARRAY WS)? ambiguousIdentifier (WS? LPAREN WS? RPAREN)? (WS asTypeClause)? (WS? argDefaultValue)? ; argDefaultValue : EQ WS? (literal | ambiguousIdentifier) ; subscripts : subscript (WS? COMMA WS? subscript)* ; subscript : (valueStmt WS TO WS)? valueStmt ; // atomic rules ---------------------------------- ambiguousIdentifier : (IDENTIFIER | ambiguousKeyword)+ | L_SQUARE_BRACKET (IDENTIFIER | ambiguousKeyword)+ R_SQUARE_BRACKET ; asTypeClause : AS WS (NEW WS)? type (WS fieldLength)? ; baseType : BOOLEAN | BYTE | COLLECTION | DATE | DOUBLE | INTEGER | LONG | SINGLE | STRING | VARIANT ; certainIdentifier : IDENTIFIER (ambiguousKeyword | IDENTIFIER)* | ambiguousKeyword (ambiguousKeyword | IDENTIFIER)+ ; comparisonOperator : LT | LEQ | GT | GEQ | EQ | NEQ | IS | LIKE ; complexType : ambiguousIdentifier (DOT ambiguousIdentifier)* ; fieldLength : MULT WS? (INTEGERLITERAL | ambiguousIdentifier) ; letterrange : certainIdentifier (WS? MINUS WS? certainIdentifier)? ; lineLabel : ambiguousIdentifier COLON ; literal : COLORLITERAL | DATELITERAL | DOUBLELITERAL | FILENUMBER | INTEGERLITERAL | STRINGLITERAL | TRUE | FALSE | NOTHING | NULL ; type : (baseType | complexType) (WS? LPAREN WS? RPAREN)? ; typeHint : AMPERSAND | AT | DOLLAR | EXCLAMATIONMARK | HASH | PERCENT ; visibility : PRIVATE | PUBLIC | FRIEND | GLOBAL ; // ambiguous keywords ambiguousKeyword : ACCESS | ADDRESSOF | ALIAS | AND | ATTRIBUTE | APPACTIVATE | APPEND | AS | BEEP | BEGIN | BINARY | BOOLEAN | BYVAL | BYREF | BYTE | CALL | CASE | CLASS | CLOSE | CHDIR | CHDRIVE | COLLECTION | CONST | DATE | DECLARE | DEFBOOL | DEFBYTE | DEFCUR | DEFDBL | DEFDATE | DEFDEC | DEFINT | DEFLNG | DEFOBJ | DEFSNG | DEFSTR | DEFVAR | DELETESETTING | DIM | DO | DOUBLE | EACH | ELSE | ELSEIF | END | ENUM | EQV | ERASE | ERROR | EVENT | FALSE | FILECOPY | FRIEND | FOR | FUNCTION | GET | GLOBAL | GOSUB | GOTO | IF | IMP | IMPLEMENTS | IN | INPUT | IS | INTEGER | KILL | LOAD | LOCK | LONG | LOOP | LEN | LET | LIB | LIKE | LSET | ME | MID | MKDIR | MOD | NAME | NEXT | NEW | NOT | NOTHING | NULL | ON | OPEN | OPTIONAL | OR | OUTPUT | PARAMARRAY | PRESERVE | PRINT | PRIVATE | PUBLIC | PUT | RANDOM | RANDOMIZE | RAISEEVENT | READ | REDIM | REM | RESET | RESUME | RETURN | RMDIR | RSET | SAVEPICTURE | SAVESETTING | SEEK | SELECT | SENDKEYS | SET | SETATTR | SHARED | SINGLE | SPC | STATIC | STEP | STOP | STRING | SUB | TAB | TEXT | THEN | TIME | TO | TRUE | TYPE | TYPEOF | UNLOAD | UNLOCK | UNTIL | VARIANT | VERSION | WEND | WHILE | WIDTH | WITH | WITHEVENTS | WRITE | XOR ; // lexer rules -------------------------------------------------------------------------------- // keywords ACCESS : A C C E S S ; ADDRESSOF : A D D R E S S O F ; ALIAS : A L I A S ; AND : A N D ; ATTRIBUTE : A T T R I B U T E ; APPACTIVATE : A P P A C T I V A T E ; APPEND : A P P E N D ; AS : A S ; BEGIN : B E G I N ; BEEP : B E E P ; BINARY : B I N A R Y ; BOOLEAN : B O O L E A N ; BYVAL : B Y V A L ; BYREF : B Y R E F ; BYTE : B Y T E ; CALL : C A L L ; CASE : C A S E ; CHDIR : C H D I R ; CHDRIVE : C H D R I V E ; CLASS : C L A S S ; CLOSE : C L O S E ; COLLECTION : C O L L E C T I O N ; CONST : C O N S T ; DATE : D A T E ; DECLARE : D E C L A R E ; DEFBOOL : D E F B O O L ; DEFBYTE : D E F B Y T E ; DEFDATE : D E F D A T E ; DEFDBL : D E F D B L ; DEFDEC : D E F D E C ; DEFCUR : D E F C U R ; DEFINT : D E F I N T ; DEFLNG : D E F L N G ; DEFOBJ : D E F O B J ; DEFSNG : D E F S N G ; DEFSTR : D E F S T R ; DEFVAR : D E F V A R ; DELETESETTING : D E L E T E S E T T I N G ; DIM : D I M ; DO : D O ; DOUBLE : D O U B L E ; EACH : E A C H ; ELSE : E L S E ; ELSEIF : E L S E I F ; END_ENUM : E N D ' ' E N U M ; END_FUNCTION : E N D ' ' F U N C T I O N ; END_IF : E N D ' ' I F ; END_PROPERTY : E N D ' ' P R O P E R T Y ; END_SELECT : E N D ' ' S E L E C T ; END_SUB : E N D ' ' S U B ; END_TYPE : E N D ' ' T Y P E ; END_WITH : E N D ' ' W I T H ; END : E N D ; ENUM : E N U M ; EQV : E Q V ; ERASE : E R A S E ; ERROR : E R R O R ; EVENT : E V E N T ; EXIT_DO : E X I T ' ' D O ; EXIT_FOR : E X I T ' ' F O R ; EXIT_FUNCTION : E X I T ' ' F U N C T I O N ; EXIT_PROPERTY : E X I T ' ' P R O P E R T Y ; EXIT_SUB : E X I T ' ' S U B ; FALSE : F A L S E ; FILECOPY : F I L E C O P Y ; FRIEND : F R I E N D ; FOR : F O R ; FUNCTION : F U N C T I O N ; GET : G E T ; GLOBAL : G L O B A L ; GOSUB : G O S U B ; GOTO : G O T O ; IF : I F ; IMP : I M P ; IMPLEMENTS : I M P L E M E N T S ; IN : I N ; INPUT : I N P U T ; IS : I S ; INTEGER : I N T E G E R ; KILL: K I L L ; LOAD : L O A D ; LOCK : L O C K ; LONG : L O N G ; LOOP : L O O P ; LEN : L E N ; LET : L E T ; LIB : L I B ; LIKE : L I K E ; LINE_INPUT : L I N E ' ' I N P U T ; LOCK_READ : L O C K ' ' R E A D ; LOCK_WRITE : L O C K ' ' W R I T E ; LOCK_READ_WRITE : L O C K ' ' R E A D ' ' W R I T E ; LSET : L S E T ; MACRO_IF : HASH I F ; MACRO_ELSEIF : HASH E L S E I F ; MACRO_ELSE : HASH E L S E ; MACRO_END_IF : HASH E N D ' ' I F ; ME : M E ; MID : M I D ; MKDIR : M K D I R ; MOD : M O D ; NAME : <NAME> ; NEXT : N E X T ; NEW : N E W ; NOT : N O T ; NOTHING : N O T H I N G ; NULL : N U L L ; ON : O N ; ON_ERROR : O N ' ' E R R O R ; OPEN : O P E N ; OPTIONAL : O P T I O N A L ; OPTION_BASE : O P T I O N ' ' B A S E ; OPTION_EXPLICIT : O P T I O N ' ' E X P L I C I T ; OPTION_COMPARE : O P T I O N ' ' C O M P A R E ; OPTION_PRIVATE_MODULE : O P T I O N ' ' P R I V A T E ' ' M O D U L E ; OR : O R ; OUTPUT : O U T P U T ; PARAMARRAY : P A R A M A R R A Y ; PRESERVE : P R E S E R V E ; PRINT : P R I N T ; PRIVATE : P R I V A T E ; PROPERTY_GET : P R O P E R T Y ' ' G E T ; PROPERTY_LET : P R O P E R T Y ' ' L E T ; PROPERTY_SET : P R O P E R T Y ' ' S E T ; PUBLIC : P U B L I C ; PUT : P U T ; RANDOM : R A N D O M ; RANDOMIZE : R A N D O M I Z E ; RAISEEVENT : R A I S E E V E N T ; READ : R E A D ; READ_WRITE : R E A D ' ' W R I T E ; REDIM : R E D I M ; REM : R E M ; RESET : R E S E T ; RESUME : R E S U M E ; RETURN : R E T U R N ; RMDIR : R M D I R ; RSET : R S E T ; SAVEPICTURE : S A V E P I C T U R E ; SAVESETTING : S A V E S E T T I N G ; SEEK : S E E K ; SELECT : S E L E C T ; SENDKEYS : S E N D K E Y S ; SET : S E T ; SETATTR : S E T A T T R ; SHARED : S H A R E D ; SINGLE : S I N G L E ; SPC : S P C ; STATIC : S T A T I C ; STEP : S T E P ; STOP : S T O P ; STRING : S T R I N G ; SUB : S U B ; TAB : T A B ; TEXT : T E X T ; THEN : T H E N ; TIME : T I M E ; TO : T O ; TRUE : T R U E ; TYPE : T Y P E ; TYPEOF : T Y P E O F ; UNLOAD : U N L O A D ; UNLOCK : U N L O C K ; UNTIL : U N T I L ; VARIANT : V A R I A N T ; VERSION : V E R S I O N ; WEND : W E N D ; WHILE : W H I L E ; WIDTH : W I D T H ; WITH : W I T H ; WITHEVENTS : W I T H E V E N T S ; WRITE : W R I T E ; XOR : X O R ; // symbols AMPERSAND : '&' ; ASSIGN : ':=' ; AT : '@' ; COLON : ':' ; COMMA : ',' ; DIV : '\\' | '/' ; DOLLAR : '$' ; DOT : '.' ; EQ : '=' ; EXCLAMATIONMARK : '!' ; GEQ : '>=' ; GT : '>' ; HASH : '#' ; LEQ : '<=' ; LPAREN : '(' ; LT : '<' ; MINUS : '-' ; MINUS_EQ : '-=' ; MULT : '*' ; NEQ : '<>' ; PERCENT : '%' ; PLUS : '+' ; PLUS_EQ : '+=' ; POW : '^' ; RPAREN : ')' ; SEMICOLON : ';' ; L_SQUARE_BRACKET : '[' ; R_SQUARE_BRACKET : ']' ; // literals STRINGLITERAL : '"' (~["\r\n] | '""')* '"' ; DATELITERAL : HASH (~[#\r\n])* HASH ; COLORLITERAL : '&H' [0-9A-F]+ AMPERSAND? ; INTEGERLITERAL : (PLUS | MINUS)? ('0'..'9')+ ( ('e' | 'E') INTEGERLITERAL)* (HASH | AMPERSAND)? ; DOUBLELITERAL : (PLUS | MINUS)? ('0'..'9')* DOT ('0'..'9')+ ( ('e' | 'E') (PLUS|MINUS)? ('0'..'9')+)* (HASH | AMPERSAND)? ; FILENUMBER : HASH LETTERORDIGIT+ ; // identifier IDENTIFIER : LETTER LETTERORDIGIT* ; // whitespace, line breaks, comments, ... LINE_CONTINUATION : ' ' '_' '\r'? '\n' -> skip ; NEWLINE : WS? ('\r'? '\n' | COLON ' ') WS? ; COMMENT : WS? ('\'' | COLON? REM ' ') (LINE_CONTINUATION | ~('\n' | '\r'))* -> skip ; WS : [ \t]+ ; // letters fragment LETTER : [a-zA-Z_������] ; fragment LETTERORDIGIT : [a-zA-Z0-9_������] ; // case insensitive chars fragment A : ('a'|'A') ; fragment B : ('b'|'B') ; fragment C : ('c'|'C') ; fragment D : ('d'|'D') ; fragment E : ('e'|'E') ; fragment F : ('f'|'F') ; fragment G : ('g'|'G') ; fragment H : ('h'|'H') ; fragment I : ('i'|'I') ; fragment J : ('j'|'J') ; fragment K : ('k'|'K') ; fragment L : ('l'|'L') ; fragment M : ('m'|'M') ; fragment N : ('n'|'N') ; fragment O : ('o'|'O') ; fragment P : ('p'|'P') ; fragment Q : ('q'|'Q') ; fragment R : ('r'|'R') ; fragment S : ('s'|'S') ; fragment T : ('t'|'T') ; fragment U : ('u'|'U') ; fragment V : ('v'|'V') ; fragment W : ('w'|'W') ; fragment X : ('x'|'X') ; fragment Y : ('y'|'Y') ; fragment Z : ('z'|'Z') ;
template.scpt
GazimbeIsaac/Templates
0
3390
<reponame>GazimbeIsaac/Templates<filename>template.scpt #!/usr/bin/env osascript # vim:ts=4:sts=4:sw=4:et # # Author: <NAME> # Date: 2020-06-13 20:47:12 +0100 (Sat, 13 Jun 2020) # # https://github.com/harisekhon/templates # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish # # https://www.linkedin.com/in/harisekhon # set folderName to "My New Folder" set folderLocation to desktop tell application "Finder" make new folder with properties {name:folderName, location:folderLocation} end tell set x to 2555 set y to 1255 tell application "System Events" click at {x,y} end tell
programs/oeis/070/A070550.asm
karttu/loda
0
21124
; A070550: a(n) = a(n-1) + a(n-3) + a(n-4), starting with a(0..3) = 1, 2, 2, 3. ; 1,2,2,3,6,10,15,24,40,65,104,168,273,442,714,1155,1870,3026,4895,7920,12816,20737,33552,54288,87841,142130,229970,372099,602070,974170,1576239,2550408,4126648,6677057,10803704,17480760,28284465,45765226,74049690,119814915,193864606,313679522,507544127,821223648,1328767776,2149991425,3478759200,5628750624,9107509825,14736260450,23843770274,38580030723,62423800998,101003831722,163427632719,264431464440,427859097160,692290561601,1120149658760,1812440220360,2932589879121,4745030099482,7677619978602,12422650078083,20100270056686,32522920134770,52623190191455,85146110326224,137769300517680,222915410843905,360684711361584,583600122205488,944284833567073,1527884955772562,2472169789339634,4000054745112195,6472224534451830 mov $2,2 mov $5,$0 lpb $2,1 mov $0,$5 sub $2,1 add $0,$2 cal $0,92263 ; a(1)=1, a(n+1)=ceiling(phi*a(n))+1 if a(n) is odd, a(n+1)=ceiling(phi*a(n)) if a(n) is even, where phi=(1+sqrt(5))/2. div $0,2 mov $3,$0 mov $4,$2 lpb $4,1 mov $1,$3 sub $4,1 lpe lpe lpb $5,1 sub $1,$3 mov $5,0 lpe
oeis/078/A078318.asm
neoneye/loda-programs
11
8925
; A078318: Sum of divisors of n*rad(n)+1, where rad=A007947 (squarefree kernel). ; Submitted by <NAME> ; 3,6,18,13,42,38,93,18,56,102,186,74,324,198,342,48,540,110,546,272,756,588,972,180,312,678,126,528,1266,972,1596,84,1980,1260,1842,256,2484,1842,2286,402,2613,2124,3534,1440,1281,2220,4536,307,660,672,3906,2016,5076,434,4860,948,6552,4044,5226,1802,5586,4620,2324,176,6342,4358,8100,3354,7146,5490,7566,434,10584,5478,1692,4320,10692,7308,9366,1170,434,8370,13608,3530,10842,7980,13644,2100,12636,2812,12852,6048,16182,8838,13542,578,16956,1374,6160,1344 seq $0,64549 ; a(n) = n * Product_{primes p|n} p. seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
src/test/ref/bitmap-plotter.asm
jbrandwood/kickc
2
165696
// Commodore 64 PRG executable file .file [name="bitmap-plotter.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const BMM = $20 .const DEN = $10 .const RSEL = 8 .const plots_cnt = 8 .label BITMAP = $2000 .label D011 = $d011 .label RASTER = $d012 .label D018 = $d018 .label BG_COLOR = $d020 .label FGCOL = $d021 .label SCREEN = $400 .segment Code main: { // *BG_COLOR = 0 lda #0 sta BG_COLOR // *FGCOL = 0 sta FGCOL // *D011 = BMM|DEN|RSEL|3 lda #BMM|DEN|RSEL|3 sta D011 // *D018 = (byte)(((word)SCREEN/$40)|((word)BITMAP/$400)) lda #SCREEN/$40|BITMAP/$400 sta D018 // init_screen() jsr init_screen // init_plot_tables() jsr init_plot_tables __b1: // while (*RASTER!=$ff) lda #$ff cmp RASTER bne __b1 // (*BG_COLOR)++; inc BG_COLOR // plots() jsr plots // (*BG_COLOR)--; dec BG_COLOR jmp __b1 } init_screen: { .label b = 2 .label c = 4 lda #<BITMAP sta.z b lda #>BITMAP sta.z b+1 __b1: // for(byte* b = BITMAP; b!=BITMAP+$2000; b++) lda.z b+1 cmp #>BITMAP+$2000 bne __b2 lda.z b cmp #<BITMAP+$2000 bne __b2 lda #<SCREEN sta.z c lda #>SCREEN sta.z c+1 __b3: // for(byte* c = SCREEN; c!=SCREEN+$400;c++) lda.z c+1 cmp #>SCREEN+$400 bne __b4 lda.z c cmp #<SCREEN+$400 bne __b4 // } rts __b4: // *c = $14 lda #$14 ldy #0 sta (c),y // for(byte* c = SCREEN; c!=SCREEN+$400;c++) inc.z c bne !+ inc.z c+1 !: jmp __b3 __b2: // *b = 0 lda #0 tay sta (b),y // for(byte* b = BITMAP; b!=BITMAP+$2000; b++) inc.z b bne !+ inc.z b+1 !: jmp __b1 } init_plot_tables: { .label __9 = 7 .label yoffs = 2 ldy #$80 ldx #0 __b1: // x&$f8 txa and #$f8 // plot_xlo[x] = x&$f8 sta plot_xlo,x // plot_xhi[x] = BYTE1(BITMAP) lda #>BITMAP sta plot_xhi,x // plot_bit[x] = bits tya sta plot_bit,x // bits = bits/2 tya lsr tay // if(bits==0) cpy #0 bne __b2 ldy #$80 __b2: // for(byte x : 0..255) inx cpx #0 bne __b1 lda #<0 sta.z yoffs sta.z yoffs+1 tax __b3: // y&$7 lda #7 sax.z __9 // BYTE0(yoffs) lda.z yoffs // y&$7 | BYTE0(yoffs) ora.z __9 // plot_ylo[y] = y&$7 | BYTE0(yoffs) sta plot_ylo,x // BYTE1(yoffs) lda.z yoffs+1 // plot_yhi[y] = BYTE1(yoffs) sta plot_yhi,x // if((y&$7)==7) lda #7 cmp.z __9 bne __b4 // yoffs = yoffs + 40*8 lda.z yoffs clc adc #<$28*8 sta.z yoffs lda.z yoffs+1 adc #>$28*8 sta.z yoffs+1 __b4: // for(byte y : 0..255) inx cpx #0 bne __b3 // } rts } plots: { ldx #0 __b1: // for(byte i=0; i<plots_cnt;i++) cpx #plots_cnt bcc __b2 // } rts __b2: // plot(plots_x[i], plots_y[i]) lda plots_x,x sta.z plot.x lda plots_y,x sta.z plot.y jsr plot // for(byte i=0; i<plots_cnt;i++) inx jmp __b1 } // void plot(__zp(7) char x, __zp(6) char y) plot: { .label x = 7 .label y = 6 .label plotter_x = 4 .label plotter_y = 2 .label plotter = 4 // BYTE1(plotter_x) = plot_xhi[x] ldy.z x lda plot_xhi,y sta.z plotter_x+1 lda #<0 sta.z plotter_x // BYTE0(plotter_x) = plot_xlo[x] lda plot_xlo,y sta.z plotter_x // BYTE1(plotter_y) = plot_yhi[y] ldy.z y lda plot_yhi,y sta.z plotter_y+1 lda #<0 sta.z plotter_y // BYTE0(plotter_y) = plot_ylo[y] lda plot_ylo,y sta.z plotter_y // byte* plotter = plotter_x+plotter_y clc lda.z plotter adc.z plotter_y sta.z plotter lda.z plotter+1 adc.z plotter_y+1 sta.z plotter+1 // *plotter | plot_bit[x] ldy #0 lda (plotter),y ldy.z x ora plot_bit,y // *plotter = *plotter | plot_bit[x] ldy #0 sta (plotter),y // } rts } .segment Data plots_x: .byte $3c, $50, $6e, $50, $3c, $28, $a, $28 plots_y: .byte $a, $28, $3c, $50, $6e, $50, $3c, $28 plot_xlo: .fill $100, 0 plot_xhi: .fill $100, 0 plot_ylo: .fill $100, 0 plot_yhi: .fill $100, 0 plot_bit: .fill $100, 0
CPU/cpu_test/test_storage/ov_handler.asm
SilenceX12138/MIPS-Microsystems
55
85527
<filename>CPU/cpu_test/test_storage/ov_handler.asm .text li $t1,0 eret
oeis/114/A114047.asm
neoneye/loda-programs
11
8423
; A114047: x such that x^2 - 13*y^2 = 1. ; Submitted by <NAME> ; 1,649,842401,1093435849,1419278889601,1842222905266249,2391203911756701601,3103780835237293411849,4028705132934095091878401,5229256158767620191964752649,6787570465375238075075157060001,8810261234800900253827361899128649,11435712295201103154229840669911926401,14843545748909797093290079362183781339849,19266910946372621425987368782273878267197601,25008435564845913701134511389312131807041146249,32460930096259049611451169795958364811661140633601,42134262256508681549749917260642568213404353501267849 mul $0,2 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,18 add $3,$2 lpe mov $0,$3