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 |
|---|---|---|---|---|
oeis/205/A205456.asm | neoneye/loda-programs | 11 | 9310 | <reponame>neoneye/loda-programs
; A205456: Symmetric matrix by antidiagonals: C(max(i,j),min(i,j)), i>=1, j>=1.
; Submitted by <NAME>
; 1,2,2,3,1,3,4,3,3,4,5,6,1,6,5,6,10,4,4,10,6,7,15,10,1,10,15,7,8,21,20,5,5,20,21,8,9,28,35,15,1,15,35,28,9,10,36,56,35,6,6,35,56,36,10,11,45,84,70,21,1,21,70,84,45,11,12,55,120,126,56,7,7,56,126,120
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
min $0,$2
add $0,1
add $1,2
sub $1,$0
bin $1,$0
mov $0,$1
|
programs/oeis/205/A205312.asm | jmorken/loda | 1 | 172654 | ; A205312: Number of (n+1) X 3 0..1 arrays with every 2 X 2 subblock having the same number of equal edges, and new values 0..1 introduced in row major order.
; 20,84,376,1708,7784,35500,161928,738636,3369320,15369324,70107976,319801228,1458790184,6654348460,30354161928,138462112716,631602239720,2881086973164,13142230386376,59948977985548,273460429154984,1247404189803820,5690100090709128
add $0,1
mov $1,6
lpb $0
sub $0,1
mul $1,2
add $2,$1
sub $2,4
add $1,$2
lpe
|
programs/oeis/070/A070534.asm | neoneye/loda | 22 | 161669 | ; A070534: a(n) = n^4 mod 17.
; 0,1,16,13,1,13,4,4,16,16,4,4,13,1,13,16,1,0,1,16,13,1,13,4,4,16,16,4,4,13,1,13,16,1,0,1,16,13,1,13,4,4,16,16,4,4,13,1,13,16,1,0,1,16,13,1,13,4,4,16,16,4,4,13,1,13,16,1,0,1,16,13,1,13,4,4,16,16,4,4,13,1,13,16,1,0,1,16,13,1,13,4,4,16,16,4,4,13,1,13
pow $0,4
mod $0,17
|
src/natools-s_expressions-templates-generic_discrete_render.adb | faelys/natools | 0 | 2174 | ------------------------------------------------------------------------------
-- Copyright (c) 2014, <NAME> --
-- --
-- Permission to use, copy, modify, and 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. --
------------------------------------------------------------------------------
procedure Natools.S_Expressions.Templates.Generic_Discrete_Render
(Output : in out Ada.Streams.Root_Stream_Type'Class;
Template : in out Lockable.Descriptor'Class;
Value : in T)
is
Current_Value : T := T'First;
Event : Events.Event := Template.Current_Event;
begin
loop
case Event is
when Events.Add_Atom =>
if Current_Value = Value then
Output.Write (Template.Current_Atom);
return;
end if;
when Events.Open_List =>
loop
Template.Next (Event);
case Event is
when Events.Add_Atom =>
Output.Write (Template.Current_Atom);
when others =>
return;
end case;
end loop;
when Events.Close_List | Events.End_Of_Input | Events.Error =>
exit;
end case;
Template.Next (Event);
Current_Value := T'Succ (Current_Value);
end loop;
Output.Write (To_Atom (Default_Image (Value)));
end Natools.S_Expressions.Templates.Generic_Discrete_Render;
|
Library/GrObj/Body/bodyManager.asm | steakknife/pcgeos | 504 | 27546 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Body
FILE: bodyManager.asm
AUTHOR: <NAME>, November 15, 1989
REVISION HISTORY:
Name Date Description
---- ---- -----------
ss 11/15/89 Initial revision.
DESCRIPTION:
Manager for this module.
$Id: bodyManager.asm,v 1.1 97/04/04 18:07:48 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include grobjGeode.def
;------------------------------------------------------------------------------
; Include definitions.
;------------------------------------------------------------------------------
include bodyConstant.def
;include bodyMacro.def
;------------------------------------------------------------------------------
; Local variables.
;------------------------------------------------------------------------------
;include bodyVariable.def
;------------------------------------------------------------------------------
; Here comes the code...
;------------------------------------------------------------------------------
include bodyClass.asm
include bodyObjArray.asm
include bodyMouse.asm
include bodyProcessChildren.asm
include bodyGroup.asm
include bodyUtils.asm
include bodyPriorityList.asm
include body.asm
include bodyKeyboard.asm
include bodySelectionList.asm
include bodySortableArray.asm
include bodyCutCopyPaste.asm
include bodyAlign.asm
include bodyUI.asm
include bodyAttr.asm
include bodyTransfer.asm
include bodyImpex.asm
include bodyC.asm
if INCLUDE_TEST_CODE
include bodyTest.asm
endif
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/rep_clause1.ads | best08618/asylo | 7 | 24145 | <gh_stars>1-10
-- { dg-do compile }
-- { dg-options "-gnatwa" }
package Rep_Clause1 is
generic
type Custom_T is private;
package Handler is
type Storage_T is record
A : Boolean;
B : Boolean;
C : Custom_T;
end record;
for Storage_T use record
A at 0 range 0..0;
B at 1 range 0..0;
end record;
end Handler;
end Rep_Clause1;
|
programs/oeis/152/A152777.asm | karttu/loda | 1 | 3758 | ; A152777: 7 times heptagonal numbers: 7*n*(5*n-3)/2.
; 0,7,49,126,238,385,567,784,1036,1323,1645,2002,2394,2821,3283,3780,4312,4879,5481,6118,6790,7497,8239,9016,9828,10675,11557,12474,13426,14413,15435,16492,17584,18711,19873,21070,22302,23569,24871,26208,27580,28987,30429,31906,33418,34965,36547,38164,39816,41503,43225,44982,46774,48601,50463,52360,54292,56259,58261,60298,62370,64477,66619,68796,71008,73255,75537,77854,80206,82593,85015,87472,89964,92491,95053,97650,100282,102949,105651,108388,111160,113967,116809,119686,122598,125545,128527,131544,134596,137683,140805,143962,147154,150381,153643,156940,160272,163639,167041,170478,173950,177457,180999,184576,188188,191835,195517,199234,202986,206773,210595,214452,218344,222271,226233,230230,234262,238329,242431,246568,250740,254947,259189,263466,267778,272125,276507,280924,285376,289863,294385,298942,303534,308161,312823,317520,322252,327019,331821,336658,341530,346437,351379,356356,361368,366415,371497,376614,381766,386953,392175,397432,402724,408051,413413,418810,424242,429709,435211,440748,446320,451927,457569,463246,468958,474705,480487,486304,492156,498043,503965,509922,515914,521941,528003,534100,540232,546399,552601,558838,565110,571417,577759,584136,590548,596995,603477,609994,616546,623133,629755,636412,643104,649831,656593,663390,670222,677089,683991,690928,697900,704907,711949,719026,726138,733285,740467,747684,754936,762223,769545,776902,784294,791721,799183,806680,814212,821779,829381,837018,844690,852397,860139,867916,875728,883575,891457,899374,907326,915313,923335,931392,939484,947611,955773,963970,972202,980469,988771,997108,1005480,1013887,1022329,1030806,1039318,1047865,1056447,1065064,1073716,1082403
mov $1,$0
bin $0,2
mul $0,5
add $1,$0
mul $1,7
|
programs/oeis/169/A169933.asm | karttu/loda | 0 | 177371 | <reponame>karttu/loda
; A169933: a(n) = 2+n in the arithmetic defined in A169918.
; 0,2,4,6,8,0,2,4,6,8,10,12,14,16,18,10,12,14,16,18,20,22,24,26,28,20,22,24,26,28,30,32,34,36,38,30,32,34,36,38,40,42,44,46,48,40,42,44,46,48,50,52,54,56,58,50,52,54,56,58,60,62,64,66,68,60,62,64,66,68,70,72,74,76,78
add $0,6565
mov $1,$0
mod $0,10
add $1,$0
sub $1,6569
div $1,2
mul $1,2
|
programs/oeis/100/A100172.asm | karttu/loda | 1 | 95718 | ; A100172: Structured triakis icosahedral numbers (vertex structure 4).
; 1,32,150,412,875,1596,2632,4040,5877,8200,11066,14532,18655,23492,29100,35536,42857,51120,60382,70700,82131,94732,108560,123672,140125,157976,177282,198100,220487,244500,270196,297632,326865,357952,390950,425916,462907,501980,543192,586600,632261,680232,730570,783332,838575,896356,956732,1019760,1085497,1154000,1225326,1299532,1376675,1456812,1540000,1626296,1715757,1808440,1904402,2003700,2106391,2212532,2322180,2435392,2552225,2672736,2796982,2925020,3056907,3192700,3332456,3476232,3624085,3776072,3932250,4092676,4257407,4426500,4600012,4778000,4960521,5147632,5339390,5535852,5737075,5943116,6154032,6369880,6590717,6816600,7047586,7283732,7525095,7771732,8023700,8281056,8543857,8812160,9086022,9365500,9650651,9941532,10238200,10540712,10849125,11163496,11483882,11810340,12142927,12481700,12826716,13178032,13535705,13899792,14270350,14647436,15031107,15421420,15818432,16222200,16632781,17050232,17474610,17905972,18344375,18789876,19242532,19702400,20169537,20644000,21125846,21615132,22111915,22616252,23128200,23647816,24175157,24710280,25253242,25804100,26362911,26929732,27504620,28087632,28678825,29278256,29885982,30502060,31126547,31759500,32400976,33051032,33709725,34377112,35053250,35738196,36432007,37134740,37846452,38567200,39297041,40036032,40784230,41541692,42308475,43084636,43870232,44665320,45469957,46284200,47108106,47941732,48785135,49638372,50501500,51374576,52257657,53150800,54054062,54967500,55891171,56825132,57769440,58724152,59689325,60665016,61651282,62648180,63655767,64674100,65703236,66743232,67794145,68856032,69928950,71012956,72108107,73214460,74332072,75461000,76601301,77753032,78916250,80091012,81277375,82475396,83685132,84906640,86139977,87385200,88642366,89911532,91192755,92486092,93791600,95109336,96439357,97781720,99136482,100503700,101883431,103275732,104680660,106098272,107528625,108971776,110427782,111896700,113378587,114873500,116381496,117902632,119436965,120984552,122545450,124119716,125707407,127308580,128923292,130551600,132193561,133849232,135518670,137201932,138899075,140610156,142335232,144074360,145827597,147595000
mov $2,$0
mov $3,$0
sub $3,1
mul $3,$0
mov $4,$3
add $3,1
add $3,$0
mul $4,$0
add $4,6
mov $7,$0
add $7,6
mul $7,$3
div $7,2
mul $7,3
mov $0,$7
add $4,1
sub $0,$4
mov $1,$0
sub $1,1
mov $5,$2
mul $5,5
add $1,$5
mov $6,$2
mul $6,$2
mov $5,$6
mul $5,5
add $1,$5
mul $6,$2
mov $5,$6
mul $5,9
add $1,$5
|
base/Kernel/Native/arm/Crt/fpadefs.asm | sphinxlogic/Singularity-RDK-2.0 | 0 | 29110 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
; Assembler source for FPA support code and emulator
; ==================================================
; Definitions for FPA instructions and registers. Also used by "fplib".
;
; Copyright (C) Advanced RISC Machines Limited, 1992-7. All rights reserved.
;
; RCS Revision: 1
; Checkin Date: 2007/06/29 02:59:16
; Revising Author
;===========================================================================
; FPSR fields
; -----------
IOC_pos EQU 0
IOC_bit EQU 1:SHL:IOC_pos
DZC_pos EQU 1
DZC_bit EQU 1:SHL:DZC_pos
OFC_pos EQU 2
OFC_bit EQU 1:SHL:OFC_pos
UFC_pos EQU 3
UFC_bit EQU 1:SHL:UFC_pos
IXC_pos EQU 4
IXC_bit EQU 1:SHL:IXC_pos
ND_pos EQU 8
ND_bit EQU 1:SHL:ND_pos
NE_pos EQU 9
NE_bit EQU 1:SHL:NE_pos
SO_pos EQU 10
SO_bit EQU 1:SHL:SO_pos
EP_pos EQU 11
EP_bit EQU 1:SHL:EP_pos
AC_pos EQU 12
AC_bit EQU 1:SHL:AC_pos
IOE_pos EQU 16
IOE_bit EQU 1:SHL:IOE_pos
DZE_pos EQU 17
DZE_bit EQU 1:SHL:DZE_pos
OFE_pos EQU 18
OFE_bit EQU 1:SHL:OFE_pos
UFE_pos EQU 19
UFE_bit EQU 1:SHL:UFE_pos
IXE_pos EQU 20
IXE_bit EQU 1:SHL:IXE_pos
SysID_pos EQU 24
SysID_mask EQU &FF:SHL:SysID_pos
SysID_oldFPE EQU 0x00
SysID_FPE EQU 0x01
SysID_FPPC EQU 0x80
; SysID_FPA EQU 0x81 ;Already defined in "optcheck" file
;===========================================================================
; FPCR fields - many also valid for CPDO and CPRT instructions
; ------------------------------------------------------------
S2_pos EQU 0
S2_mask EQU &F:SHL:S2_pos
S2_Ibit EQU &8:SHL:S2_pos
Op3_pos EQU 4
Op3_mask EQU &1:SHL:Op3_pos
RM_pos EQU 5
RM_mask EQU &3:SHL:RM_pos
Pr2_pos EQU 7
Pr2_mask EQU &1:SHL:Pr2_pos
DA_pos EQU 8
DA_bit EQU 1:SHL:DA_pos
RE_pos EQU 9
RE_bit EQU 1:SHL:RE_pos
AB_pos EQU 10
AB_bit EQU 1:SHL:AB_pos
SB_pos EQU 11
SB_bit EQU 1:SHL:SB_pos
Ds_pos EQU 12
Ds_mask EQU &7:SHL:Ds_pos
Op2_pos EQU 15
Op2_mask EQU &1:SHL:Op2_pos
S1_pos EQU 16
S1_mask EQU &7:SHL:S1_pos
Pr1_pos EQU 19
Pr1_mask EQU &1:SHL:Pr1_pos
Op1_pos EQU 20
Op1_mask EQU &F:SHL:Op1_pos
EO_pos EQU 26
EO_bit EQU 1:SHL:EO_pos
MO_pos EQU 27
MO_bit EQU 1:SHL:MO_pos
IE_pos EQU 28
IE_bit EQU 1:SHL:IE_pos
RU_pos EQU 31
RU_bit EQU 1:SHL:RU_pos
Pr_mask EQU Pr1_mask+Pr2_mask
Op_mask EQU Op1_mask+Op2_mask+Op3_mask
; Rounding mode values
RM_Nearest EQU 0:SHL:RM_pos
RM_PlusInf EQU 1:SHL:RM_pos
RM_MinusInf EQU 2:SHL:RM_pos
RM_Zero EQU 3:SHL:RM_pos
;===========================================================================
; Instruction fields - all coprocessor instructions
; -------------------------------------------------
;
; The following bit distinguishes CPRTs from CPDOs.
RTnotDO_pos EQU 4
RTnotDO_bit EQU 1:SHL:RTnotDO_pos
; The two recognised coprocessor numbers and the position and mask of the
; field in the instruction.
Coproc_pos EQU 8
Coproc_mask EQU &F:SHL:Coproc_pos
Coproc_1 EQU 1:SHL:Coproc_pos
Coproc_2 EQU 2:SHL:Coproc_pos
; The following bit distinguishes CPDTs from CPRT/CPDOs.
RTDOnotDT_pos EQU 25
RTDOnotDT_bit EQU 1:SHL:RTDOnotDT_pos
; For instructions that take the undefined instruction exception vector, the
; following bit distinguishes coprocessor instructions from genuinely
; undefined instructions.
NotUndef_pos EQU 27
NotUndef_bit EQU 1:SHL:NotUndef_pos
Cond_pos EQU 28
Cond_mask EQU &F:SHL:Cond_pos
Cond_EQ EQU &0:SHL:Cond_pos
Cond_NE EQU &1:SHL:Cond_pos
Cond_CS EQU &2:SHL:Cond_pos
Cond_CC EQU &3:SHL:Cond_pos
Cond_MI EQU &4:SHL:Cond_pos
Cond_PL EQU &5:SHL:Cond_pos
Cond_VS EQU &6:SHL:Cond_pos
Cond_VC EQU &7:SHL:Cond_pos
Cond_HI EQU &8:SHL:Cond_pos
Cond_LS EQU &9:SHL:Cond_pos
Cond_GE EQU &A:SHL:Cond_pos
Cond_LT EQU &B:SHL:Cond_pos
Cond_GT EQU &C:SHL:Cond_pos
Cond_LE EQU &D:SHL:Cond_pos
Cond_AL EQU &E:SHL:Cond_pos
Cond_NV EQU &F:SHL:Cond_pos
; CPDT-specific instruction fields
; --------------------------------
DT_offset_pos EQU 0
DT_offset_mask EQU &FF:SHL:DT_offset_pos
DT_src_pos EQU 12
DT_src_mask EQU &7:SHL:DT_src_pos
DT_dst_pos EQU 12
DT_dst_mask EQU &7:SHL:DT_dst_pos
DT_pr2_pos EQU 15
DT_pr2_mask EQU &1:SHL:DT_pr2_pos
DT_ARMreg_pos EQU 16
DT_ARMreg_mask EQU &F:SHL:DT_ARMreg_pos
DT_LnotS_pos EQU 20
DT_LnotS_bit EQU 1:SHL:DT_LnotS_pos
DT_wb_pos EQU 21
DT_wb_bit EQU 1:SHL:DT_wb_pos
DT_pr1_pos EQU 22
DT_pr1_mask EQU &1:SHL:DT_pr1_pos
DT_UnotD_pos EQU 23
DT_UnotD_bit EQU 1:SHL:DT_UnotD_pos
DT_PreIndex_pos EQU 24
DT_PreIndex_bit EQU 1:SHL:DT_PreIndex_pos
; CPRT-specific instruction fields
; --------------------------------
;
; The following FPCR fields also apply to CPRTs: S2_pos, S2_mask, S2_Ibit,
; Op3_pos, Op3_mask, RM_pos, RM_mask, Pr2_pos, Pr2_mask, S1_pos, S1_mask,
; Pr1_pos, Pr1_mask, Op1_pos, Op1_mask. (Note Op2_pos and Op2_mask are not
; included in this list.)
RT_ARMreg_pos EQU 12
RT_ARMreg_mask EQU &F:SHL:RT_ARMreg_pos
RT_SnotL_pos EQU 20
RT_SnotL_bit EQU 1:SHL:RT_SnotL_pos
; The following is the full opcode mask for a CPRT, in which the Pr2_mask
; field is part of an ARM register number rather than of the opcode. It
; includes the Pr3_mask field, whose only purpose is to tell us that this
; *is* a CPRT rather than a CPDO
OpRT_mask EQU Op1_mask+Op3_mask
; The following bit distinguishes CMF(E)s from CNF(E)s.
CompNeg_pos EQU 21
CompNeg_bit EQU 1:SHL:CompNeg_pos
; The following bit distinguishes exception-causing comparisons from
; non-exception causing comparisons.
CompExc_pos EQU 22
CompExc_bit EQU 1:SHL:CompExc_pos
; CPDO-specific instruction fields
; --------------------------------
;
; The following FPCR fields also apply to CPDOs: S2_pos, S2_mask, S2_Ibit,
; Op3_pos, Op3_mask, RM_pos, RM_mask, Pr2_pos, Pr2_mask, Ds_pos, Ds_mask,
; Op2_pos, Op2_mask, S1_pos, S1_mask, Pr1_pos, Pr1_mask, Op1_pos, Op1_mask.
; The bit to indicate that the operation is monadic and not dyadic.
DO_monad_pos EQU 15
DO_monad_bit EQU 1:SHL:DO_monad_pos
; The bit to indicate that this is a subtraction (SUF or RSF) rather than an
; addition (ADF).
SubNotAdd_pos EQU 21
SubNotAdd_bit EQU 1:SHL:SubNotAdd_pos
; The bit to indicate that this is a reverse subtraction (RSF) rather than
; an addition or ordinary subtraction (ADF or SUF).
RSF_pos EQU 20
RSF_bit EQU 1:SHL:RSF_pos
; The bit to indicate that this is a reverse division (RDF or FRD) rather
; than a normal division (DVF or FDV).
RevDiv_pos EQU 20
RevDiv_bit EQU 1:SHL:RevDiv_pos
; The bit to indicate that this is a "fast" multiplication or division (FML,
; FDV or FRD), rather than the normal version (MUF, DVF or RDF).
Fast_pos EQU 23
Fast_bit EQU 1:SHL:Fast_pos
; The bit to indicate that a move-type instruction (MVF, MNF or ABS) is an
; MNF.
MNF_pos EQU 20
MNF_bit EQU 1:SHL:MNF_pos
; The bit to indicate that a move-type instruction (MVF, MNF or ABS) is an
; ABS.
ABS_pos EQU 21
ABS_bit EQU 1:SHL:ABS_pos
; The bit to indicate that this is a COS instruction rather than a SIN.
COSnotSIN_pos EQU 20
COSnotSIN_bit EQU 1:SHL:COSnotSIN_pos
; The bit to indicate that this is a ACS instruction rather than an ASN.
ACSnotASN_pos EQU 22
ACSnotASN_bit EQU 1:SHL:ACSnotASN_pos
; The bit to indicate that this is a LOG instruction rather than an LGN.
LOGnotLGN_pos EQU 20
LOGnotLGN_bit EQU 1:SHL:LOGnotLGN_pos
; The bit to indicate that this is a RPW instruction rather than a POW.
RPWnotPOW_pos EQU 20
RPWnotPOW_bit EQU 1:SHL:RPWnotPOW_pos
;===========================================================================
;
; Floating point formats.
;
; There are four floating point formats: Single, Double, Extended and
; Internal. Single, Double and Extended are memory formats and
; Internal is the floating point register format. (The FPE keeps the
; floating pointer registers in Internal format even through they are
; actually in memory somewhere.) The FPE uses precisely the same
; Internal format as the FPA chip in order to allow the FPASC and FPE
; to share code. STF converts from Internal format to Single, Double
; or Extended format. LDF converts from Single, Double or Extended
; format to Internal format.
;
; All floating point values in memory must be aligned on 4 byte
; boundaries.
;
; The Single and Double formats are specified by the ANSI/IEEE
; standard 754-1985. They look like this:
;
; The Single format is 32 bits wide:
;
; | Sign | Exponent | Fraction |
;
; The sign field is 1 bit wide the exponent field is 8 bits wide and
; the fraction field is 23 bits wide. The exponent field is biased by
; 127 (i.e. an exponent of 1 is encoded as 0x80). The fraction has an
; implicit leading 1 unless the number is denormalised (see table
; below).
;
; The following table summarises the Single format:
; Where: 's' is -1 if the sign bit is set and 1 if the sign bit is clear.
; 'e' is the value of the exponent field interpreted as unsigned.
; 'f' is the fraction field interpreted as binary digits
;
; Exponent Fraction What it is Value
; 0 0 signed zero +0 or -0
; 0 non-zero denorm. number s * (0.f) * (2**(-126))
; 255 0 infinity s * infinity
; 255 non-zero NaN
; otherwise normal number s * (1.f) * (2**(e-127))
;
; The Double format is 64 bits wide:
;
; address: | Sign | Exponent | Fraction high |
; address + 4: | Fraction low |
;
; The sign field is 1 bit wide the exponent field is 11 bits wide and
; the fraction field is 52 bits wide (20 bits in Fraction high and 32
; in Fraction low). The exponent is biased by 1023. The fraction has
; an implicit leading 1 unless the number is denormalised (see table
; below).
;
; The following table summarises the Double format:
;
; Exponent Fraction What it is Value
; 0 0 signed zero +0 or -0
; 0 non-zero denorm. number s * (0.f) * (2**(-1022))
; 2047 0 infinity s * infinity
; 2047 non-zero NaN
; otherwise normal number s * (1.f) * (2**(e-1023))
;
; Extended format implements the IEEE Double Extended format. People
; wanting an IEEE Single Extended format should either use Double or
; Extended. Since the reasons the standard suggests for wanting to
; have Single Extended as well as Double Extended are upwards
; compatibility and speed, and the former doesn't really apply in our
; world, and some Double precision operations are faster than Extended
; ones (e.g. multiplication), I would actually recommend someone who
; wanted an IEEE Single Extended format to use Double, not Extended.
;
; The Extended format is 96 bits wide:
;
; address: | Sign | Reserved | Exponent |
; address + 4: | Units | Fraction high |
; address + 8: | Fraction low |
;
; The sign field is 1 bit wide, the reserved field is 16 bits wide,
; the exponent field is 15 bits wide, the units field is 1 bit wide
; and the fraction is 63 bits wide (31 bits in Fraction high and 32 in
; Fraction low). The exponent is biased by 16383 = 0x3FFF. The Units
; bit is used instead of having the fraction have an implicit leading
; 1. The Reserved bits are ignored when read and always written as 0.
;
; The floating point registers are kept in Internal format. This is
; the same as Extended format except that the first word contains a
; new field:
;
; The Internal format is 96 bits wide:
;
; address: | Sign | Uncommon | Reserved | Exponent |
; address + 4: | Units | Fraction high |
; address + 8: | Fraction low |
;
; The sign field is 1 bit wide, the uncommon field is 1 bit wide, the
; reserved field is 15 bits wide, the exponent field is 15 bits wide,
; the units field is 1 bit wide and the fraction is 63 bits wide (31
; bits in Fraction high and 32 in Fraction low). The exponent is
; biased by 16383 = 0x3FFF. The Units bit is used instead of having
; the fraction have an implicit leading 1. The Reserved bits are
; ignored when read and always written as 0.
;
; SFM stores in Internal format. When LFM is loading if the uncommon
; bit is set the memory is loaded unchanged. If the uncommon bit is
; clear LFM will load it as an Extended number possibly setting the
; uncommon bit in the process.Another way of putting this is that LFM
; ORs the uncommon bit from memory with an uncommon bit calculated
; from the other fields of the number in memory.
;
; Extended numbers are interpreted as Internal numbers with the
; uncommon bit clear (which it is).
;
; The following table summarises the Exteded and Internal formats:
;
; Exponent Unit Fraction What it is Value
; 0 0 0 signed zero +0 or -0
; 0 0 non-zero denorm. number s * (0.f) * (2**(-16383))
; 32767 0 0 infinity s * infinity
; 32767 1 0 *** Not a valid bit pattern (see note 1) ***
; 32767 x non-zero NaN NaN
; other 0 anything *** Not a valid bit pattern (see note 2) ***
; other 1 anything normal number s * (1.f) * (2**(e-16383))
;
;
; Notes: 1. This bit pattern is known as an "anomalous infinity" in these
; sources and is actually treated as s * infinity.
; 2. These bit patterns are known as "unnormalised numbers" in these
; sources, and are actually treated as representing the value
; s * (0.f) * (2**(e-16383)). While this behaviour is not part of
; the architectural specification and should not be relied upon by
; programmers, it is important to the correct treatment of the
; intermediate result in the URD/NRM instruction pair in this
; implementation, and so should not be changed.
;
; Uncommon Units Exponent Fraction Notes What it is
; bit bit
; 0 0 0x0000 0 (a) A zero
; 0 0 0x0000 non-zero Should not happen
; 0 0 0x4016 x (b) Result of URD
; 0 0 0x4033 x (b) Result of URD
; 0 0 0x403E x (b) Result of URD
; 0 0 other x Should not happen
; 0 1 0x7FFF x Should not happen
; 0 1 other x (a) Normalised number
; 1 0 0x0000 0 Should not happen
; 1 0 0x0000 non-zero (a) Extended denorm. number
; 1 0 0x7FFF 0 (a) Extended infinity
; 1 0 0x7FFF non-zero (a,d-f) Extended NaN
; 1 0 other 0 (c) Extended unnormalised zero
; 1 0 other non-zero (c) Extended unnorm. number
; 1 1 0x3C00 0 Should not happen
; 1 1 0x3C00 non-zero (a) Double denormalised number
; 1 1 0x3F80 0 Should not happen
; 1 1 0x3F80 non-zero (a) Single denormalised number
; 1 1 0x407F 0 (a) Single infinity
; 1 1 0x407F non-zero (a,e) Single NaN
; 1 1 0x43FF 0 (a) Double infinity
; 1 1 0x43FF non-zero (a,e) Double NaN
; 1 1 0x7FFF 0 (c) Anomalous ext. infinity
; 1 1 0x7FFF non-zero (a,d-f) Extended NaN
; 1 1 other x Should not happen
;
; Notes:
;
; (a) These bit patterns occur normally.
; The original format is kept for NaNs because exceptions are
; generated for signalling NaNs only when converting to a
; different format. The original format is kept for denormalised
; numbers and infinites just because it is convenient.
;
; (b) These bit patterns are the intermediate result of URD before NRM.
; They are treated as unnormalized numbers. URD followed by NRM
; implements RND, or the IEEE "Round a floating point number to
; another floating point number whose value is an integer"
; operation (see section 5.5 "Round Floating-Point Number to
; Integer Value" on page 11 of the standard). If one of these
; numbers is saved (SFM) and restored (LFM) the uncommon bit may
; become set. ("may" rather than "will" because the URD
; instruction generally doesn't change numbers which are
; sufficiently large to already have an integer value). The same
; applies to STFE followed by LDFE (for the benefit of programs
; which use that pair for register preservation &
; restoration). This setting of the uncommon bit is OK because the
; URD results are chosen so that setting the uncommon bit
; transforms them into extended unnormalised numbers which have
; the correct values for the results.
;
; (c) Bit patterns that technically have no meaning.
; These can only be generated by abusing LDFE and LFM. See Notes 1
; & 2 above.
;
; (d) These are indeed both "Extended NaN": the units bit is effectively a
; "don't care" bit for extended NaNs. This is basically just a
; consequence of extended precision having a units bit, while single and
; double precision don't: the "anomalous extended infinity" is a similar
; consequence.
;
; (e) The general rules about NaN processing are:
;
; * If the top fraction bit is a 1, the NaN is a quiet NaN; if a 0, the
; NaN is a signalling NaN. (N.B. This is the top fraction bit - i.e.
; the second bit of the mantissa - rather than the units bit because
; the units bit does not exist in all formats.)
;
; * A format conversion on a NaN will truncate the fraction at the
; appropriate point for a format narrowing, or extend it with zeros
; for a format widening. If the original NaN was a signalling NaN, an
; invalid operation exception is generated. If this exception is
; untrapped, the result is also "quietened" by having its top fraction
; bit set. (The net result of this is that the result always ends up
; having its top fraction bit set and thus being a NaN rather than an
; infinity, unless the result is generated by a trap handler - in this
; latter case, the trap handler has the responsibility for producing
; the "correct" result.)
;
; * An operation on NaN operand(s) will generate an invalid operation
; exception if any operand is a signalling NaN, as mandated by the
; IEEE standard. If this doesn't happen, or if the exception is
; untrapped, the result is produced by the following rules:
;
; - If the operation is monadic, the result is obtained by
; format-converting the operand NaN to the destination format of the
; operation. (For some versions of the code, the invalid operation
; exception is suppressed if the operation is MVF, MNF, ABS or STF
; and no change of format occurs; for others, this doesn't happen.
; See the discussion under "FPESigNaNCopy_Invalid" in the "main.s"
; source file for more details of this.)
;
; - If the operation is dyadic, the result is obtained by
; format-converting the first operand to the destination format of
; the operation if the first operand is a NaN, and otherwise by
; format-converting the second operand similarly. (Note that this
; rule pays no attention to which NaNs are signalling. In
; particular, if the first operand is a quiet NaN and the second one
; a signalling NaN, the second operand will generate the invalid
; operation exception - but if the exception is untrapped, the first
; operand will generate the result. This is done to match likely
; future hardware behaviour.)
;
; * If an invalid operation exception occurs for other reasons than a
; NaN operand, and the exception is untrapped, the resulting quiet NaN
; has units bit 0, top fraction bit 1, all other fraction bits 0, and
; sign bit equal to what the operation would normally have produced -
; e.g. EOR of the operand signs for infinity * 0; ((rounding mode =
; "to -infinity") ? 1 : 0) for infinity - infinity; etc. (This is
; again to match likely future hardware behaviour.)
;
; (f) The NE bit in the FPSR modifies the rules about extended NaNs when it
; is 0. Basically, these rules cause extended precision to no longer be
; a fully supported IEEE format, but are necessary to allow code that
; uses STFE/LDFE for register preservation and restoration to use
; signalling NaNs effectively. (I.e. basically code that uses the
; "/fpe2" APCS option and some other legacy code.)
;
; The problem for such code is that if extended precision is treated as
; a fully supported IEEE precision, a register-preserving STFE normally
; contains an implicit format conversion and so *must* generate an
; exception. Having a procedure call generate an exception merely
; because the calling procedure happens to have a signalling NaN in a
; register isn't very desirable...
;
; To deal with this, NE=0 provides a "legacy code compatibility" option
; in which an extended precision NaN is regarded as being "really
; single" or "really double", depending on whether the bottom bit of the
; extended precision mantissa is 0 or 1 (respectively). Format
; conversions from single or double precision to extended precision then
; clear or set this bit appropriately in addition to the operations
; described above, and never generate an invalid operation exception.
; Format conversions from a "really single" extended signalling NaN to
; single precision or from a "really double" extended signalling NaN to
; double precision are regarded as not involving a change of precision
; and thus not generating an invalid operation exception; ones from a
; "really single" extended NaN to double precision or a "really double"
; extended NaN to single precision still operate as normal.
;
; NE=1 provides full IEEE compatibility, in which any conversion of a
; signalling NaN from one of single, double or extended precision to
; another will generate an invalid operation exception.
;
; Note also that all this only applies to current systems like the
; FPA+FPASC which don't generate invalid operation exceptions for copies
; of signalling NaNs without change of format. Possible future hardware
; systems which generate invalid operation exceptions on any copy of a
; signalling NaN by an MVF, MNF, ABS or STF instruction will pay no
; attention to the NE bit and only supply the full IEEE compatibility
; option.
;===========================================================================
; Fields in top words of numbers
; ------------------------------
; Single precision fields:
SFrc_pos EQU 0
SFrc_len EQU 23
SFrc_mask EQU ((1:SHL:SFrc_len) - 1):SHL:SFrc_len
SExp_pos EQU 23
SExp_len EQU 8
SExp_mask EQU ((1:SHL:SExp_len) - 1):SHL:SExp_pos
; Double precision fields:
DFhi_pos EQU 0
DFhi_len EQU 20
DFhi_mask EQU ((1:SHL:DFhi_len) - 1):SHL:DFhi_len
DExp_pos EQU 20
DExp_len EQU 11
DExp_mask EQU ((1:SHL:DExp_len) - 1):SHL:DExp_pos
; Extended and internal precision fields:
EIExp_pos EQU 0
EIExp_len EQU 15
EIExp_mask EQU ((1:SHL:EIExp_len) - 1):SHL:EIExp_pos
IRsv_pos EQU 15
IRsv_mask EQU &7FFF:SHL:IRsv_pos
ERsv_pos EQU 15
ERsv_mask EQU &FFFF:SHL:ERsv_pos
Uncommon_pos EQU 30
Uncommon_bit EQU 1:SHL:Uncommon_pos
EIExp_mask_pt1 EQU EIExp_mask:AND:&FF
EIExp_mask_pt2 EQU EIExp_mask:AND:&FF00
ASSERT EIExp_mask_pt1:OR:EIExp_mask_pt2 = EIExp_mask
ASSERT EIExp_mask_pt1:AND:EIExp_mask_pt2 = 0
IRsv_mask_pt1 EQU IRsv_mask:AND:&3FC000
IRsv_mask_pt2 EQU IRsv_mask:AND:&3FC00000
ASSERT IRsv_mask_pt1:OR:IRsv_mask_pt2 = IRsv_mask
ASSERT IRsv_mask_pt1:AND:IRsv_mask_pt2 = 0
; Shared fields:
Sign_pos EQU 31
Sign_bit EQU 1:SHL:Sign_pos
; The following immediate mask will reduce a sign/uncommon/exponent word to
; just the exponent.
ToExp_mask EQU &FFFFFFFF - Sign_bit - Uncommon_bit
ASSERT EIExp_pos = 0 ;This mask won't do its job otherwise
; The minimum and maximum allowed exponents for single, double and extended
; precision numbers held in internal format.
SMin_Exp EQU &3F81
SMax_Exp EQU &407E
DMin_Exp EQU &3C01
DMax_Exp EQU &43FE
EMin_Exp EQU &0000
EMax_Exp EQU &7FFE
; The normal exponent bias in a single, a double and an extended or internal
; precision number. In the first two cases, the bias for a denormalised
; number is one smaller.
SExp_bias EQU &7F
DExp_bias EQU &3FF
EIExp_bias EQU &3FFF
; The special exponents for NaNs and infinities of various precisions.
NaNInfExp_Single EQU &407F
NaNInfExp_Double EQU &43FF
NaNInfExp_Extended EQU &7FFF
; The special exponents for denormalised numbers of various precisions.
DenormExp_Single EQU &3F80
DenormExp_Double EQU &3C00
DenormExp_Extended EQU &0000
; The bias adjustments for entry to overflow and underflow trap handlers.
TrapBiasAdjust_Single EQU &C0
TrapBiasAdjust_Double EQU &600
TrapBiasAdjust_Extended EQU &6000
;===========================================================================
; Fields in other words of numbers
; --------------------------------
EIUnits_pos EQU 31
EIUnits_bit EQU 1:SHL:EIUnits_pos
EIFracTop_pos EQU 30
EIFracTop_bit EQU 1:SHL:EIFracTop_pos
;===========================================================================
; Comparison results
; ------------------
Comp_GT EQU &20000000
Comp_EQ EQU &60000000
Comp_LT EQU &80000000
Comp_Un_Orig EQU &10000000
Comp_Un_Alt EQU &30000000
;===========================================================================
; Floating point condition codes
;
; Here are the FPE/ARM condition code maps. The FPE has an FPSR bit
; called AC that determines if the old mapping or new is used:
;
; With AC=0:
;
; Relation Z C N V
; ---------------------------
; EQUAL 1 1 0 0
; LESS THAN 0 0 1 0
; GREATER TNAN 0 1 0 0
; UNORDERED 0 0 0 1
;
; Code Nm Flags Meaning Floating point meaning
; ------------------------------------------------------------------
; 0000 EQ Z==1 equal equal
; 0001 NE Z==0 not equal not equal (includes unordered)
; 0010 HS C==1 higher or same greater or equal
; 0011 LO C==0 lower than less than or unordered
; 0100 MI N==1 negative less than
; 0101 PL N==0 nonnegative greater, equal, or unordered
; 0110 VS V==1 overflow unordered
; 0111 VC V==0 not overflow less, greater, or equal
; 1000 HI C==1 && Z==0 higher than greater than
; 1001 LS C==0 || Z==1 lower or same less, equal, or unordered
; 1010 GE N==V greater or equal greater or equal (same as 0010)
; 1011 LT N!=V less than less than or unordered (same as 0011)
; 1100 GT Z==0 && N==V greater than greater than (same as 1000)
; 1101 LE Z==1 || N!=V less or equal less, equal, or unordered (same as 1001)
; 1110 AL don't care always always
; 1111 don't care never never
;
; With AC=1:
;
; Relation Z C N V
; --- ------------------------
; EQUAL 1 1 0 0
; LESS THAN 0 0 1 0
; GREATER TNAN 0 1 0 0
; UNORDERED 0 1 0 1
;
; The only difference is the UNORDERED now sets both C and V.
; Now: C <==> greater than or equal or unordered
;
; This changes the condition code table to:
;
; Code Nm Flags Meaning Floating point meaning
; --- ---------------------------------------------------------------
; 0000 EQ Z==1 equal equal
; 0001 NE Z==0 not equal not equal (includes unordered)
; 0010 HS C==1 higher or same greater, equal, or unordered
; 0011 LO C==0 lower than less than
; 0100 MI N==1 negative less than
; 0101 PL N==0 nonnegative greater, equal, or unordered
; 0110 VS V==1 overflow unordered
; 0111 VC V==0 not overflow less, greater, or equal
; 1000 HI C==1 && Z==0 higher than greater or unordered
; 1001 LS C==0 || Z==1 lower or same less or equal
; 1010 GE N==V greater or equal greater or equal
; 1011 LT N!=V less than less than or unordered
; 1100 GT Z==0 && N==V greater than greater than
; 1101 LE Z==1 || N!=V less or equal less, equal, or unordered
; 1110 AL don't care always always
; 1111 don't care never never
;
; Only the entries for 0010, 0011, 1000 and 1001 have changed.
;
; Now all floating point conditionals that can be expressed in C are
; available in one test.
;
; The ARM C compiler does not yet do the right thing for floating
; point comparisons.
;===========================================================================
; Invalid operation reason codes
; ------------------------------
; These were once used to construct quiet NaNs which would give some
; indication what sort of operation created the NaN. They are now only used
; for some internal purposes, having been removed because it is very
; unlikely that any future hardware which handles NaNs will mimic this
; behaviour.
; InvReas_InitNaN is not an invalid operation reason code; however, like
; all the others, it is related to a NaN that the system can generate. It is
; therefore placed in the same set of numbers.
; InvReas_MsvOverflow and InvReas_MsvUnderflow are similar: NaNs
; (originally constructed from them) are used on entry to overflow and
; underflow trap handlers respectively to indicate that the result is so
; massively out of range that the IEEE-specified exponent bias adjustment
; (&C0 for single, &600 for double and &6000 for extended) is not enough to
; bring it in range.
InvReas_SigNaN EQU 0 ;An operand is a signalling NaN
InvReas_InitNaN EQU 1 ;(Used to generate initial NaNs)
InvReas_MsvOverflow EQU 2 ;(Used for massive overflow)
InvReas_MsvUnderflow EQU 3 ;(Used for massive underflow)
InvReas_MagSubInf EQU 4 ;Magnitude subtraction of infinities
InvReas_InfTimes0 EQU 5 ;Infinity times zero
InvReas_0TimesInf EQU 6 ;Zero times infinity
InvReas_0Div0 EQU 7 ;Zero divided by zero
InvReas_InfDivInf EQU 8 ;Infinity divided by infinity
InvReas_InfRemX EQU 9 ;RMF with 1st operand infinite
InvReas_XRem0 EQU 10 ;RMF of non-infinite number by zero
InvReas_SqrtNeg EQU 11 ;Square root of a negative number
InvReas_FixQNaN EQU 12 ;FIX applied to a quiet NaN
InvReas_FixInf EQU 13 ;FIX applied to an infinity
InvReas_FixRange EQU 14 ;FIX on an out-of-range number
InvReas_CompQNaN EQU 15 ;CMFE/CNFE on a quiet NaN
InvReas_SinCosRange EQU 16 ;SIN/COS on too big an argument
InvReas_SinCosInf EQU 17 ;SIN/COS on an infinity
InvReas_TanRange EQU 18 ;TAN on too big an argument
InvReas_TanInf EQU 19 ;TAN on an infinity
InvReas_AsnAcsRange EQU 20 ;ASN/ACS on too big an argument
InvReas_AsnAcsInf EQU 21 ;ASN/ACS on an infinity
InvReas_PolZeroZero EQU 22 ;POL on two zeros
InvReas_PolInfInf EQU 23 ;POL on two infinities
InvReas_LgnLogNeg EQU 24 ;LGN/LOG of a negative argument
InvReas_NegPowX EQU 25 ;POW/RPW to do (negative)^X
InvReas_0PowNonpos EQU 26 ;POW/RPW to do (zero)^(non-positive)
InvReas_BadInfPow EQU 27 ;POW/RPW to do 1^(+/-infinity) or
; (+infinity)^0
;===========================================================================
END
|
Task/Unicode-variable-names/Ada/unicode-variable-names.ada | mullikine/RosettaCodeData | 1 | 6383 | <filename>Task/Unicode-variable-names/Ada/unicode-variable-names.ada<gh_stars>1-10
with Ada.Text_IO;
procedure main is
Δ : Integer;
begin
Δ := 41;
Δ := Δ + 1;
Ada.Text_IO.Put_Line (Δ'Img);
end main;
|
projects/batfish/src/main/antlr4/org/batfish/grammar/mrv/Mrv_async.g4 | zabrewer/batfish | 763 | 5763 | parser grammar Mrv_async;
import Mrv_common;
options {
tokenVocab = MrvLexer;
}
a_async
:
ASYNC PERIOD
(
a_async_access
| a_async_autohang
| a_async_dsrwait
| a_async_flowcont
| a_async_maxconnections
| a_async_name
| a_async_outauthtype
| a_async_speed
)
;
a_async_access
:
ACCESS nbdecl
;
a_async_autohang
:
AUTOHANG nbdecl
;
a_async_dsrwait
:
DSRWAIT nbdecl
;
a_async_flowcont
:
FLOWCONT nbdecl
;
a_async_maxconnections
:
MAXCONNECTIONS nodecl
;
a_async_name
:
NAME nsdecl
;
a_async_speed
:
SPEED nspdecl
;
a_async_outauthtype
:
OUTAUTHTYPE nbdecl
;
|
programs/oeis/174/A174338.asm | karttu/loda | 1 | 89888 | ; A174338: a(n) = 97*n^2.
; 0,97,388,873,1552,2425,3492,4753,6208,7857,9700,11737,13968,16393,19012,21825,24832,28033,31428,35017,38800,42777,46948,51313,55872,60625,65572,70713,76048,81577,87300,93217,99328,105633,112132,118825,125712,132793,140068,147537,155200,163057,171108,179353,187792,196425,205252,214273,223488,232897,242500,252297,262288,272473,282852,293425,304192,315153,326308,337657,349200,360937,372868,384993,397312,409825,422532,435433,448528,461817,475300,488977,502848,516913,531172,545625,560272,575113,590148,605377,620800,636417,652228,668233,684432,700825,717412,734193,751168,768337,785700,803257,821008,838953,857092,875425,893952,912673,931588,950697,970000,989497,1009188,1029073,1049152,1069425,1089892,1110553,1131408,1152457,1173700,1195137,1216768,1238593,1260612,1282825,1305232,1327833,1350628,1373617,1396800,1420177,1443748,1467513,1491472,1515625,1539972,1564513,1589248,1614177,1639300,1664617,1690128,1715833,1741732,1767825,1794112,1820593,1847268,1874137,1901200,1928457,1955908,1983553,2011392,2039425,2067652,2096073,2124688,2153497,2182500,2211697,2241088,2270673,2300452,2330425,2360592,2390953,2421508,2452257,2483200,2514337,2545668,2577193,2608912,2640825,2672932,2705233,2737728,2770417,2803300,2836377,2869648,2903113,2936772,2970625,3004672,3038913,3073348,3107977,3142800,3177817,3213028,3248433,3284032,3319825,3355812,3391993,3428368,3464937,3501700,3538657,3575808,3613153,3650692,3688425,3726352,3764473,3802788,3841297,3880000,3918897,3957988,3997273,4036752,4076425,4116292,4156353,4196608,4237057,4277700,4318537,4359568,4400793,4442212,4483825,4525632,4567633,4609828,4652217,4694800,4737577,4780548,4823713,4867072,4910625,4954372,4998313,5042448,5086777,5131300,5176017,5220928,5266033,5311332,5356825,5402512,5448393,5494468,5540737,5587200,5633857,5680708,5727753,5774992,5822425,5870052,5917873,5965888,6014097
pow $0,2
mov $1,97
mul $1,$0
|
libsrc/_DEVELOPMENT/arch/zx/ulaplus/z80/asm_ulap_read_palette.asm | jpoikela/z88dk | 640 | 104542 | <filename>libsrc/_DEVELOPMENT/arch/zx/ulaplus/z80/asm_ulap_read_palette.asm
; void *ulap_read_palette(void *dst,unsigned char pent,unsigned char num)
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_arch
PUBLIC asm_ulap_read_palette
asm_ulap_read_palette:
; enter : hl = void *dst
; e = unsigned char pent
; d = unsigned char num > 0
;
; exit : hl = void *dst after last byte written
;
; uses : f, bc, de, hl
ld c,__IO_ULAP_REGISTER & 0xff
loop:
ld b,__IO_ULAP_REGISTER / 256
out (c),e
ld b,__IO_ULAP_DATA / 256
ini
inc e
dec d
jr nz, loop
ret
|
oeis/076/A076109.asm | neoneye/loda-programs | 11 | 92278 | ; A076109: Least positive k such that k^n is the sum of n consecutive integers, or 0 if no such k exists.
; Submitted by <NAME>
; 1,1,3,0,5,3,7,0,3,5,11,0,13,7,15,0,17,3,19,0,21,11,23,0,5,13,3,0,29,15,31,0,33,17,35,0,37,19,39,0,41,21,43,0,15,23,47,0,7,5,51,0,53,3,55,0,57,29,59,0,61,31,21,0,65,33,67,0,69,35,71,0,73,37,15,0,77,39,79,0,3,41,83,0,85,43,87,0,89,15,91,0,93,47,95,0,97,7,33,0
add $0,1
mov $1,1
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
gcd $5,$2
mul $1,$5
div $2,$5
sub $2,$6
mul $1,$2
lpe
mov $0,$1
|
Task/Pointers-and-references/Ada/pointers-and-references-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 18129 | <filename>Task/Pointers-and-references/Ada/pointers-and-references-3.ada
declare
type Int_Ptr is access all Integer;
Ref : Int_Ptr;
Var : aliased Integer := 3;
Val : Integer := Var;
begin
Ref := Var'Access; -- "Ref := Val'Access;" would be a syntax error
|
iceworm/trees/IceSql.g4 | wrmsr0/iceworm | 0 | 6429 | grammar IceSql;
@header {
import dataclasses
@dataclasses.dataclass(frozen=True)
class IceSqlParserConfig:
interval_units: bool = False
DEFAULT_ICE_SQL_PARSER_CONFIG = IceSqlParserConfig()
}
@parser::members {
_config = None
@property
def config(self):
return self._config or DEFAULT_ICE_SQL_PARSER_CONFIG
@config.setter
def config(self, config):
if self._config is not None or not isinstance(config, IceSqlParserConfig):
raise TypeError
self._config = config
}
tokens {
DELIMITER
}
singleStatement
: statement EOF
;
statement
: select
| createTable
| insert
| delete
;
createTable
: CREATE (OR REPLACE)? TABLE qualifiedName ('(' colSpec (',' colSpec)* ')')? (AS select)?
;
colSpec
: identifier typeSpec?
;
insert
: INSERT INTO qualifiedName select
;
delete
: DELETE FROM qualifiedName (WHERE where=booleanExpression)?
;
select
: cteSelect
;
cteSelect
: (WITH cte (',' cte)*)? setSelect
;
cte
: identifier AS '(' select ')'
;
setSelect
: parenSelect setSelectItem*
;
setSelectItem
: setSelectKind setQuantifier? parenSelect
;
setSelectKind
: INTERSECT
| MINUS
| EXCEPT
| UNION ALL?
;
parenSelect
: '(' parenSelect ')'
| primarySelect
;
primarySelect
: SELECT topN? setQuantifier? selectItem (',' selectItem)*
(FROM relation (',' relation)*)?
(WHERE where=booleanExpression)?
(GROUP BY grouping)?
(HAVING having=booleanExpression)?
(QUALIFY qualify=booleanExpression)?
(ORDER BY sortItem (',' sortItem)*)?
(LIMIT INTEGER_VALUE)?
;
topN
: TOP number
;
selectItem
: '*' #allSelectItem
| identifier '.' '*' #identifierAllSelectItem
| expression (AS? identifier)? #expressionSelectItem
;
expression
: booleanExpression
;
booleanExpression
: valueExpression predicate[$valueExpression.ctx]? #predicatedBooleanExpression
| op=NOT booleanExpression #unaryBooleanExpression
| booleanExpression op=(AND | OR) booleanExpression #binaryBooleanExpression
;
predicate[ParserRuleContext value]
: cmpOp right=valueExpression #cmpPredicate
| IS NOT? NULL #isNullPredicate
| NOT? BETWEEN lower=valueExpression AND upper=valueExpression #betweenPredicate
| NOT? IN '(' expression (',' expression)* ')' #inListPredicate
| NOT? IN '(' select ')' #inSelectPredicate
| NOT? IN JINJA #inJinjaPredicate
| NOT? kind=(LIKE | ILIKE | RLIKE) ANY?
(expression | ('(' expression (',' expression)* ')'))
(ESCAPE esc=string)? #likePredicate
;
valueExpression
: primaryExpression #primaryValueExpression
| op=unaryOp valueExpression #unaryValueExpression
| left=valueExpression op=arithOp right=valueExpression #arithValueExpression
| valueExpression
(':' traversalKey | ':'? '[' traversalKey ']')
('.' traversalKey | '[' traversalKey ']')* #traversalValueExpression
| valueExpression '::' typeSpec #castValueExpression
;
traversalKey
: identifier
| string
| integer
;
primaryExpression
: functionCall #functionCallExpression
| CASE (val=expression)? caseItem* (ELSE default=expression)? END #caseExpression
| { not self.config.interval_units }? INTERVAL expression #intervalExpression
| { self.config.interval_units }? INTERVAL expression intervalUnit #intervalExpression
| INTERVAL expression intervalUnit #intervalExpression
| '(' select ')' #selectExpression
| '(' expression ')' #parenExpression
| CAST '(' expression AS typeSpec ')' #castCallExpression
| DATE string #dateExpression
| EXTRACT '(' part=identifier FROM value=expression ')' #extractExpression
| JINJA #jinjaExpression
| simpleExpression #simplePrimaryExpression
;
simpleExpression
: var
| param
| qualifiedName
| number
| string
| null
| true
| false
;
typeSpec
: identifier ('(' (simpleExpression (',' simpleExpression)*)? ')')?
;
functionCall
: qualifiedName '(' setQuantifier? (expression (',' expression)*)? ')'
((IGNORE | RESPECT) NULLS)?
(WITHIN GROUP '(' ORDER BY sortItem (',' sortItem)* ')')?
over? #expressionFunctionCall
| qualifiedName '(' kwarg (',' kwarg)* ')'
((IGNORE | RESPECT) NULLS)?
(WITHIN GROUP '(' ORDER BY sortItem (',' sortItem)* ')')?
over? #kwargFunctionCall
| qualifiedName '(' setQuantifier? expression (IGNORE | RESPECT) NULLS ')'
(WITHIN GROUP '(' ORDER BY sortItem (',' sortItem)* ')')?
over? #nullsFunctionCall
| qualifiedName '(' '*' ')'
over? #starFunctionCall
;
kwarg
: identifier '=>' expression
;
caseItem
: WHEN expression THEN expression
;
intervalUnit
: SECOND
| MINUTE
| HOUR
| DAY
| MONTH
| YEAR
;
over
: OVER '('
(PARTITION BY (expression (',' expression)*))?
(ORDER BY sortItem (',' sortItem)*)?
frame? ')'
;
frameBound
: INTEGER_VALUE (PRECEDING | FOLLOWING) #numFrameBound
| UNBOUNDED (PRECEDING | FOLLOWING) #unboundedFrameBound
| CURRENT ROW #currentRowFrameBound
;
frame
: (ROWS | RANGE) frameBound #singleFrame
| (ROWS | RANGE) BETWEEN frameBound AND frameBound #doubleFrame
;
sortItem
: expression direction=(ASC | DESC)? (NULLS (FIRST | LAST))?
;
relation
: left=relation ty=joinType?
JOIN right=relation
(ON cond=booleanExpression)?
(USING '(' using=identifierList ')')? #joinRelation
| relation PIVOT '('
func=qualifiedName '(' pc=identifier ')'
FOR vc=identifier IN '(' (expression (',' expression)*)? ')' ')' #pivotRelation
| relation UNPIVOT '('
vc=identifier
FOR nc=identifier IN '(' identifierList? ')' ')' #unpivotRelation
| LATERAL relation #lateralRelation
| functionCall #functionCallRelation
| '(' select ')' #selectRelation
| '(' relation ')' #parenRelation
| JINJA #jinjaRelation
| relation AS? identifier ('(' identifierList ')')? #aliasedRelation
| qualifiedName #tableRelation
;
grouping
: expression (',' expression)* #flatGrouping
| GROUPING SETS '(' groupingSet (',' groupingSet)* ')' #setsGrouping
;
groupingSet
: '(' expression (',' expression)* ')'
;
qualifiedName
: identifier ('.' identifier)*
;
identifierList
: identifier (',' identifier)*
;
identifier
: unquotedIdentifier
| quotedIdentifier
;
quotedIdentifier
: QUOTED_IDENTIFIER
;
var
: '$' IDENTIFIER
;
param
: ':' IDENTIFIER
;
number
: integer #integerNumber
| DECIMAL_VALUE #decimalNumber
| FLOAT_VALUE #floatNumber
;
integer
: INTEGER_VALUE
;
string
: STRING
;
null
: NULL
;
true
: TRUE
;
false
: FALSE
;
setQuantifier
: DISTINCT
| ALL
;
joinType
: INNER
| LEFT
| LEFT OUTER
| RIGHT
| RIGHT OUTER
| FULL
| FULL OUTER
| CROSS
| NATURAL
;
cmpOp
: '='
| '!='
| '<>'
| '<'
| '<='
| '>'
| '>='
;
arithOp
: '+'
| '-'
| '*'
| '/'
| '%'
| '||'
;
unaryOp
: '+'
| '-'
;
unquotedIdentifier
: IDENTIFIER
| CASE
| DATE
| DAY
| EXTRACT
| FIRST
| GROUPING
| HOUR
| ILIKE
| LAST
| LEFT
| LIKE
| MINUTE
| MONTH
| OUTER
| RANGE
| REPLACE
| RIGHT
| RLIKE
| SECOND
| YEAR
;
ALL: 'all';
AND: 'and';
ANY: 'any';
AS: 'as';
ASC: 'asc';
BETWEEN: 'between';
BY: 'by';
CASE: 'case';
CAST: 'cast';
CREATE: 'create';
CROSS: 'cross';
CURRENT: 'current';
DATE: 'date';
DAY: 'day';
DELETE: 'delete';
DESC: 'desc';
DISTINCT: 'distinct';
DROP: 'drop';
ELSE: 'else';
END: 'end';
ESCAPE: 'escape';
EXCEPT: 'except';
EXTRACT: 'extract';
FALSE: 'false';
FIRST: 'first';
FOLLOWING: 'following';
FOR: 'for';
FROM: 'from';
FULL: 'full';
FUNCTION: 'function';
GROUP: 'group';
GROUPING: 'grouping';
HAVING: 'having';
HOUR: 'hour';
IGNORE: 'ignore';
ILIKE: 'ilike';
IN: 'in';
INNER: 'inner';
INSERT: 'insert';
INTERSECT: 'intersect';
INTERVAL: 'interval';
INTO: 'into';
IS: 'is';
JOIN: 'join';
LAST: 'last';
LATERAL: 'lateral';
LEFT: 'left';
LIKE: 'like';
LIMIT: 'limit';
MINUS: 'minus';
MINUTE: 'minute';
MONTH: 'month';
NATURAL: 'natural';
NOT: 'not';
NULL: 'null';
NULLS: 'nulls';
ON: 'on';
OR: 'or';
ORDER: 'order';
OUTER: 'outer';
OVER: 'over';
PARTITION: 'partition';
PIVOT: 'pivot';
PRECEDING: 'preceding';
QUALIFY: 'qualify';
RANGE: 'range';
REPLACE: 'replace';
RESPECT: 'respect';
RIGHT: 'right';
RLIKE: 'rlike';
ROW: 'row';
ROWS: 'rows';
SECOND: 'second';
SELECT: 'select';
SETS: 'sets';
TABLE: 'table';
THEN: 'then';
TOP: 'top';
TRUE: 'true';
UNBOUNDED: 'unbounded';
UNION: 'union';
UNPIVOT: 'unpivot';
USING: 'using';
WHEN: 'when';
WHERE: 'where';
WITH: 'with';
WITHIN: 'within';
YEAR: 'year';
STRING
: '\'' (~'\'' | '\'\'' | '\\\'')* '\''
;
INTEGER_VALUE
: DIGIT+
;
DECIMAL_VALUE
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
FLOAT_VALUE
: DIGIT+ ('.' DIGIT*)? EXPONENT
| '.' DIGIT+ EXPONENT
;
IDENTIFIER
: (LETTER | '_') (LETTER | DIGIT | '_' | '@' | '$')*
;
QUOTED_IDENTIFIER
: '"' (~'"' | '""')* '"'
;
JINJA
: '{{' .*? '}}'
;
fragment EXPONENT
: [Ee] [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Za-z]
;
COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BLOCK_COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
JINJA_STATEMENT
: '{%' .*? '%}' -> channel(HIDDEN)
;
JINJA_COMMENT
: '{#' .*? '#}' -> channel(HIDDEN)
;
WS
: [ \t\n\r]+ -> channel(HIDDEN)
;
|
third.asm | hydroxion/assembler | 0 | 242264 | .data
# List stored in memory
list: .space 16
.text
ADDI $s0, $zero, 5
ADDI $s1, $zero, 5
ADDI $s2, $zero, 5
ADDI $s3, $zero, 5
ADDI $s4, $zero, 5
# Create index (offset)
ADDI $t0, $zero, 0
SW $s0, list($t0)
ADDI $t0, $t0, 4
SW $s1, list($t0)
ADDI $t0, $t0, 4
SW $s2, list($t0)
ADDI $t0, $t0, 4
SW $s3, list($t0)
ADDI $t0, $t0, 4
SW $s4, list($t0)
# Retrieve values and do f = (a – b) + (c + d)
ADDI $t0, $zero, 0
LW $s0, list($t0)
ADDI $t0, $t0, 4
LW $s1, list($t0)
ADDI $t0, $t0, 4
LW $s2, list($t0)
ADDI $t0, $t0, 4
LW $s3, list($t0)
ADDI $t0, $t0, 4
LW $s4, list($t0)
ADDI $t0, $t0, 4
# Show the value retrieved from memory
# LI $v0, 1
# ADDI $a0, $s1, 0
# syscall
ADD $t1, $s0, $s1
ADD $t2, $s3, $s4
ADD $s5, $t1, $t2
# Show the final result
LI $v1, 1
ADDI $a0, $s5, 0
syscall |
number_convert.asm | tor4z/nasm_training | 0 | 160301 | <reponame>tor4z/nasm_training<filename>number_convert.asm
global _start
section .bss
res resb 1
section .data
msg db 'The result is: '
msgLen equ $ - msg
newLine db 0xA
section .text
_start:
sub ah, ah ; Set ah to 00H
mov al, '9' ; Put '9' to al
sub al, '3' ; '9' - '3' = 06H, value in al is number 06H
aas ; ASCII Adjust
or al, 30H ; 30H | 06H = 36H, convert 06H to ascii '6'
mov [res], ax ; Store ax value to res
; Print msg
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, msgLen
int 0x80
; Print res
mov eax, 4
mov ebx, 1
mov ecx, res
mov edx, 1
int 0x80
; Print '\n'
mov eax, 4
mov ebx, 1
mov ecx, newLine
mov edx, 1
int 0x80
; Exit
mov eax, 1
mov ebx, 0
int 0x80
; AAA - ASCII Adjust After Addition
; AAS - ASCII Adjust After Subtraction
; AAM - ASCII Adjust After Multiplication
; AAD - ASCII Adjust Before Division
; These instructions do not take any operands and assumes the required operand to be in the AL register.
|
Opus/asm/rip.asm | Computer-history-Museum/MS-Word-for-Windows-v1.1 | 2 | 166235 | page 58,82
;
; stacktrace using BP. Go through BP chain, attempting to find calls to
; current procedure and displaying name (if it exists symbolicly) and
; arguments.
;
include noxport.inc
include newexe.inc
SEGI STRUC ;* result of GetCodeInfo
sectorSegi DW ? ; logical sector number in file of start of segment
cbFileSegi DW ? ; number bytes in file
flagsSegi DW ? ; segment flags
cbRamSegi DW ? ; minimum number bytes to allocate for segment
hSegi DW ? ; Handle to segment (0 if not loaded)
cbAlignSegi DW ? ; Alignment shift count for segment data
SEGI ENDS
PCODE_HEADER struc
ph_code db 3 dup(?)
ph_enMacReg db ?
ph_snReg dw ?
ph_rReg dw ?
ph_mpenbpc dw ?
PCODE_HEADER ends
sBegin DATA
staticB segiT,<SIZE SEGI DUP (?)> ;* SEGI buffer for GetCodeInfo
sEnd DATA
createSeg _RIP,rip,byte,public,CODE
PUBLIC StackTrace
externFP <FGetSegSymb, FFindSeg, FGetSymbol>
externFP <GetSnMac, FGetPcodeSegName, FGetConstSymb>
externFP <HOpenOutFile, DwSeekDw, CchWriteDoshnd, FCloseDoshnd>
externFP <HOpenDbgScreen>
externFP <GetCodeInfo,GlobalHandle>
externA $q_snMacReal
sBegin data
externW SymDef
externW $q_mpsnpfn
externW vpszStackTrace1
externW vpszStackTrace2
fDoingRIP dw 0 ; currently in process of ripping...
sEnd DATA
; CODE SEGMENT _RIP
sBegin rip
assumes cs,rip
assumes ds,dgroup
assumes ss,dgroup
csCurrent equ bp-8 ; Most recent CS during backtrace
bpCurrent equ bp-10 ; Most recent BP during backtrace
bpLast equ bp-12 ; Most recent BP during backtrace
fPcodeFrame equ bp-14 ; TRUE == Pcode frame
RetSeg equ bp-16 ; return segment from frame
RetOffset equ bp-18 ; return offset from frame
SnMac equ bp-20 ; count of pcode segments
pBuff equ bp-22 ; pointer into buffer
BuffStart equ bp-(24+80) ; buffer start
SymFile equ bp-(104+66) ; sym file name
hOutFile equ bp-172 ; dos handle for output file
chOutBuff equ bp-174 ; buffer for a char to output
pArgStart equ bp-176 ; pointer to start of args
pArgEnd equ bp-178 ; pointer to end of args
pLocalStart equ bp-180 ; pointer to start of locals
pLocalEnd equ bp-182 ; pointer to end of locals
cPcodeArgs equ bp-184 ; count of pcode args
fPrintDbgScr equ bp-186 ; print chars to the aux port?
fThunk equ bp-188 ; true iff last far ret was a thunk address
hDbgScreen equ bp-190 ; dos handle for debug screen
fNextFrameNat equ bp-192 ; true iff switching from pcode to native
cbLocalsMax equ 194
;* * * String pool
szSnMsg: DB "pcode : sn = ", 0
szBpcMsg: DB " bpc = ", 0
szBadBP DB 0dh, 0ah, "Illegal Frame Pointer = ", 0
szNoStack DB 0dh, 0ah, "Not enough stack to run RIP code", 0dh, 0ah, 0
szArg DB " Args:", 0dh, 0ah, 0
szLocal DB " Locals:", 0dh, 0ah, 0
StackTrace proc far
cmp ss:[fDoingRIP],0 ; are we currently ripping?
jz traceinit ; no - skip
ret ; yes - just return
traceinit:
mov ax,sp ; check to see if we have enough
sub ax,cbLocalsMax ; stack to run the RIP code
cmp ax,ss:[0ah]
ja traceinit2
mov bx,offset szNoStack ; send message about out of stack space
push cs
pop es
call PrintSz
ret
traceinit2:
mov ss:[fDoingRIP],1 ; indicate we are currently ripping
INC BP ; setup a standard frame
PUSH BP
MOV BP,SP
PUSH DS
PUSH DI
PUSH SI
SUB SP,cbLocalsMax ; save room for locals...
push ss ; set ds = frame seg
pop ds
; init locals
mov word ptr [fPrintDbgScr],1 ; indicate printing to the debug screen OK
call HOpenDbgScreen ; enable printing to the debug screen?
mov [hDbgScreen],ax ; save handle to debug screen
cmp ax,-1 ; legal handle?
jne traceinit3 ; yes - skip
mov word ptr [fPrintDbgScr],0 ; indicate printing to the debug screen not OK
traceinit3:
mov bx,[bp] ; init past the DoStackTrace proc
and bl,0feh
mov [bpLast],bx
mov word ptr [fPcodeFrame],1 ; start out in pcode mode
mov word ptr [fThunk],0 ; clear thunk hit flag
mov bx,[bx]
and bl,0feh
mov [bpCurrent],bx
mov [csCurrent],cs
mov ax,0
mov [pArgStart],ax
mov [pArgEnd],ax
mov [pLocalStart],ax
mov [pLocalEnd],ax
mov [fNextFrameNat],ax
call GetSnMac
mov [SnMac],ax
call HOpenOutFile ; open the output file
mov [hOutFile],ax ; save returned file handle
cmp ax,-1 ; was the file opened?
je traceinit4 ; no - skip
push ax ; handle of file to seek in
xor ax,ax ; offset to seek to
push ax
push ax
mov ax,2 ; seek to end of file
push ax
call DwSeekDw
test dx,8000h ; error?
jz traceinit4 ; no - skip
lea bx,[hOutFile]
call CloseOutFile ; yes - close the file
traceinit4:
call doutcrlf
call doutcrlf
mov bx,[vpszStackTrace1] ; get Stack Trace Message
push ss
pop es
call PrintSz
call doutcrlf
mov bx,[vpszStackTrace2] ; state info
push ss ; point es to local vars area
pop es
call PrintSz
call doutcrlf
call doutcrlf
traceloop:
mov bx,[bpCurrent]
mov [bpLast],bx
mov bx,[bx] ; get previous bp
and bl,0feh ; strip off near/far flag
mov [bpCurrent],bx ; and save it
or bx,bx ; end of frames?
jnz traceloop2 ; no - skip
jmp endtrace ; yes - quit
traceloop2:
cmp bx,[bpLast] ; is this OK?
jbe traceloop4 ; no - skip
lea ax,[BuffStart] ; get address of start of strings
mov [pBuff],ax ; and save it
cmp bx,word ptr ds:[0ah] ; below stack min?
jb traceloop4
cmp bx,word ptr ds:[0eh] ; or above stack max?
jbe traceloop6
traceloop4:
jmp badbp
traceloop6:
cmp word ptr [fPcodeFrame],0 ; were we in a pcode frame?
jz traceloop8 ; no - skip
cmp word ptr [fNextFrameNat],0 ; native code in this frame?
jz traceloop7 ; no - skip
mov word ptr [fPcodeFrame],0 ; yes - indicate native code
mov word ptr [fNextFrameNat],0 ; clear flag
jmp traceloop8 ; skip
traceloop7:
test byte ptr [bx],1 ; are we switching to native?
jz traceloop8 ; no - skip
mov word ptr [fNextFrameNat],1 ; yes - indicate native code in next frame
mov bx,[bpLast] ; check for return sn == snMac
mov ax,[bx+4]
and ax,7fffh
cmp ax,[snMac]
jz traceloop ; yes - skip to next frame
traceloop8:
call GetRetAddr ; get next return address
mov [RetOffset],ax ; save address for later...
mov [RetSeg],dx
cmp word ptr [fPcodeFrame],0 ; are we in a pcode frame?
jz traceloop10 ; no - skip
call PrintPcodeAddress ; yes - print sn:bpc
jmp traceloop34
traceloop10:
cmp word ptr [fThunk],0 ; is this a short ret to a swapped segment?
jz traceloop11 ; no - skip
push dx ; yes - pass the segment number
lea bx,[SymFile] ; pass the address to save the sym file name
push bx
push [pBuff] ; pass the address to save the seg name
call FGetSegSymb ; get the segment symbol
jmp traceloop18
traceloop11:
;* * See if a Windows thunk
mov es,[RetSeg] ; get seg and offset of return
mov bx,[RetOffset]
cmp word ptr es:[bx],INTVECTOR shl 8 OR INTOPCODE
jne traceloop16
cmp byte ptr es:[bx+2],0
jne traceloop16
xor cx,cx
mov cl,es:[bx+3] ; get segment number
jcxz traceloop16 ; not thunk if == 0
traceloop12:
add bx,4 ; Scan forwards for end of table
cmp word ptr es:[bx],0
jnz traceloop12
mov es,word ptr es:[bx+2] ; Got it, recover EXE header address
cmp word ptr es:[ne_magic],NEMAGIC ; Is it a new exe header?
jne traceloop16 ; No, then cant be return thunk.
push cx ; save segment number
mov [csCurrent],cx
mov word ptr [fThunk],1 ; indicate hit a thunk
mov bx,es:[ne_restab] ; get pointer to stModuleName
mov cl,es:[bx] ; get length of module name
lea di,[SymFile] ; get the address to save the sym file name
traceloop14:
inc bx ; point to next char
mov al,es:[bx] ; get a char
mov [di],al ; save it
inc di
loop traceloop14
mov word ptr [di],'s.' ; save .sym on end of module name
mov word ptr [di+2],'my'
mov byte ptr [di+4],0
mov bx,[bpLast] ; get pointer to frame
mov bx,[bx-2] ; get "real" return offset
mov [RetOffset],bx ; and save it
lea bx,[SymFile] ; pass the address to save the sym file name
push bx
push [pBuff] ; pass the address to save the seg name
call FGetSegSymb ; get the segment symbol
jmp traceloop18
traceloop16:
push [RetSeg] ; pass the segment to look up
lea bx,[SymFile] ; pass the address to save the sym file name
push bx
push [pBuff] ; pass the address to save the seg name
call FFindSeg ; find the segment
traceloop18:
or ax,ax ; successful?
jnz traceloop20 ; yes - skip
call PrintSegOff ; no - just print segment:offset
jmp traceloop34
traceloop20:
mov bx,[pBuff] ; get the pointer to the buffer
dec bx
traceloop22:
inc bx ; point to next char
cmp byte ptr [bx],0 ; end of string?
jnz traceloop22 ; no - loop
mov byte ptr [bx],':' ; yes - save seperator in string
inc bx ; point to where to put offset symbol
mov [pBuff],bx ; and save it
push [RetOffset] ; pass the offset to lookup
push [pBuff] ; pass the place to put the offset symbol
call FGetSymbol ; get the symbol
or ax,ax ; successful?
jnz traceloop24 ; yes - skip
call PrintSegOff ; no - just print segment:offset
jmp traceloop34
traceloop24:
;* * before printing : compare with special names : RetToolbox? RetNative?
mov bx,[pBuff] ; get the pointer to the buffer
;* * possibly "RetNative?" (sure it's ugly - but fast & simple)
cmp word ptr [bx],"eR"
jne traceloop26
cmp word ptr [bx+2],"Nt"
jne traceloop26
cmp word ptr [bx+4],"ta"
jne traceloop26
cmp word ptr [bx+6],"vi"
jne traceloop26
cmp byte ptr [bx+8],"e"
jne traceloop26
cmp byte ptr [bx+9],"0"
jb traceloop26
cmp byte ptr [bx+9],"3"
ja traceloop26
cmp byte ptr [bx+10],0
je traceloop28
traceloop26:
;* * possibly "RetToolbox?"
cmp word ptr [bx],"eR"
jne traceloop30
cmp word ptr [bx+2],"Tt"
jne traceloop30
cmp word ptr [bx+4],"oo"
jne traceloop30
cmp word ptr [bx+6],"bl"
jne traceloop30
cmp word ptr [bx+8],"xo"
jne traceloop30
cmp byte ptr [bx+10],"0"
jb traceloop30
cmp byte ptr [bx+10],"3"
ja traceloop30
cmp byte ptr [bx+11],0
jne traceloop30
;* * Start of Pcode frame
traceloop28:
mov word ptr [fPcodeFrame],1
mov word ptr [fThunk],0 ; clear thunk hit flag
jmp traceloop40 ; skip to next frame...
traceloop30:
lea bx,[SymFile] ; point to sym file name
traceloop32:
inc bx ; point to next char
cmp byte ptr [bx],'.' ; at file extension yet?
jne traceloop32 ; no - loop
mov byte ptr [bx],0 ; yes - end string here
mov dx,bx ; and save for a moment
lea bx,[SymFile] ; point to sym file name
push ss ; point es to local vars area
pop es
call PrintSz ; print the map name
mov bx,dx ; point to where we ended the string
mov byte ptr [bx],'.' ; restore the extension
mov al,'!' ; seperator between map name and seg name
call dout
lea bx,[BuffStart] ; point to seg and symbol names
push ss ; point es to local vars area
pop es
call PrintSz ; print the map name
mov cx,[RetOffset] ; get offset
sub cx,[SymDef] ; calc offset from start of proc
jcxz traceloop34 ; skip if no offset
mov al,'+' ; seperator between symbol name and offset
call dout
mov ax,cx ; output the offset
call dout16
traceloop34:
cmp word ptr [fPcodeFrame],0 ; pcode frame?
jz traceloop36 ; no - skip
cmp word ptr [fNextFrameNat],0 ; is this really a native frame?
jnz traceloop36 ; yes - skip
call SetupPcodeArgs ; yes - setup to print pcode locals and args
jmp traceloop38
traceloop36:
call SetupNatArgs ; setup to print native locals and args
traceloop38:
call PrintArgs ; print this frame's locals and args
call doutcrlf ; output a carrage return line feed
traceloop40:
jmp traceloop ; and loop and loop and...
badbp:
mov bx,offset szBadBP ; print bad BP message
push cs
pop es
call PrintSz
mov ax,[bpLast]
call dout16
call doutcrlf
endtrace:
lea bx,[hOutFile]
call CloseOutFile ; close the output file
lea bx,[hDbgScreen]
call CloseOutFile ; close the debug screen
sub bp,0006
mov sp,bp
pop si
pop di
pop ds
pop bp
dec bp
mov ss:[fDoingRIP],0 ; indicate we are not currently ripping
ret
stacktrace endp
;
; GetRetAddr - peeks at frame to get return address
;
; enter:
; exit: dx:ax = return address
;
GetRetAddr:
mov bx,[bpLast]
mov ax,[bx+2] ; get offset part of ret addr
mov dx,[bx+4] ; get segment part
test byte ptr [bx],1 ; near or far frame?
jz getnearaddr
;
; far frame
;
mov [csCurrent],dx ; remember current CS
mov word ptr [fThunk],0 ; clear thunk hit flag
ret
getnearaddr:
test byte ptr [fPcodeFrame],0ffh
jz near_native
;* * Pcode return
and dh,07fh ;* strip fValue bit
ret
near_native:
mov dx,[csCurrent] ; use current CS
ret
;
; Print return address in form:
;
; <segment>:<offset>
;
PrintSegOff:
mov ax,[RetSeg]
call dout16
mov al,":"
call dout
mov ax,[RetOffset]
call dout16
ret
;* * Special Pcode routines
;* print Pcode address
PrintPcodeAddress:
mov word ptr [cPcodeArgs],0 ; init count of pcode args
mov bx,offset szSnMsg ; print sn message
push cs
pop es
call PrintSz
mov ax,[RetSeg] ; get sn
push ax ; save for call to FGetPcodeSegName
call dout16
push [pBuff] ; point to buffer
call FGetPcodeSegName
or ax,ax ; seg name found?
jz PrintPcode2 ; no - skip
mov al," " ; print seg name
call dout
mov al," "
call dout
mov al,"("
call dout
push ds
pop es
mov bx,[pBuff]
call PrintSz
mov al,")"
call dout
PrintPcode2:
mov bx,offset szBpcMsg ; print bpc message
push cs
pop es
call PrintSz
mov ax,[RetOffset] ; get bpc
call dout16
mov bx,[RetSeg] ; get sn
push bx
call near ptr GetPsOfSn ; get physical address of pcode seg
or ax,ax ; swapped out?
jnz PrintPcode4 ; no - skip
jmp PrintPcode12 ; yes - exit
PrintPcode4:
mov es,ax ; in memory - put seg in es
mov bx,offset ph_mpenbpc ; point to mpenbpc table
xor cx,cx
mov cl,es:[ph_enMacReg] ; get count of procs
mov dx,0 ; init proc counter
PrintPcode6:
mov ax,es:[bx] ; get the next entry point
cmp ax,[RetOffset] ; is this one past the one we want?
ja PrintPcode8 ; yes - skip
inc bx ; point to next entry
inc bx
inc dx ; bump proc counter
loop PrintPcode6 ; and loop
PrintPcode8:
mov bx,es:[bx-2] ; save start of the proc
push bx
mov al,es:[bx-1] ; get seg code byte
and ax,001fh ; strip off all but count of args
mov [cPcodeArgs],ax
dec dx ; set proc number back
mov dh,[RetSeg] ; get seg in dh, proc # in dl
push dx
lea bx,[SymFile] ; get pointer to sym file name
mov [bx],'po' ; and save 'opus.sym' in it
mov [bx+2],'su'
mov [bx+4],'s.'
mov [bx+6],'my'
mov byte ptr [bx+8],0
push bx
push [pBuff] ; point to buffer
call FGetConstSymb
pop dx ; get back start of proc offset
or ax,ax ; OK?
jz PrintPcode12 ; no - exit
mov al,' ' ; seperator between map name and seg name
call dout
mov al,' ' ; seperator between map name and seg name
call dout
mov al,'(' ; seperator between map name and seg name
call dout
lea bx,[BuffStart] ; point to seg and symbol names
push ss ; point es to local vars area
pop es
call PrintSz ; print the map name
mov cx,[RetOffset] ; get offset
sub cx,dx ; calc offset from start of proc
dec cx
dec cx
jcxz PrintPcode10 ; skip if no offset
mov al,'+' ; seperator between symbol name and offset
call dout
mov ax,cx ; output the offset
call dout16
PrintPcode10:
mov al,')' ; seperator between map name and seg name
call dout
PrintPcode12:
ret
PrintArgs:
push [fPrintDbgScr] ; save flag
mov word ptr [fPrintDbgScr], 0 ; don't print args to the aux port
call doutcrlf
mov bx,offset szArg ; point to args string
push cs ; point es to local vars area
pop es
call PrintSz ; print the string
mov si,-2
mov bx,[pArgStart] ; point to start of args
mov cx,bx
sub cx,[pArgEnd] ; calc cb to print
cmp cx,0
jns PrintArgs2 ; skip if don't need to fix increment
mov si,2
neg cx
PrintArgs2:
call DumpMem ; dump the args
mov bx,offset szLocal ; point to locals string
push cs ; point es to local vars area
pop es
call PrintSz ; print the map name
mov si,-2
mov bx,[pLocalStart] ; point to start of locals
mov cx,bx
sub cx,[pLocalEnd] ; calc cb to print
cmp cx,0
jns PrintArgs4 ; skip if don't need to fix increment
mov si,2
neg cx
PrintArgs4:
call DumpMem ; dump the locals
pop [fPrintDbgScr] ; restore flag
xor ax,ax ; clear pointers
mov [pArgStart],ax
mov [pArgEnd],ax
mov [pLocalStart],ax
mov [pLocalEnd],ax
ret
DumpMem:
shr cx,1 ; make into cwDump
jcxz DumpMem6 ; exit if nothing to print
jmp DumpMem3
DumpMem2:
cmp dl,8 ; done with this line?
jb DumpMem4 ; no - skip
call doutcrlf
DumpMem3:
mov al,' '
call dout
call dout
call dout
call dout
mov dl,0
DumpMem4:
mov ax,[bx] ; get a word
call dout16
mov al,' ' ; seperator between numbers
call dout
call dout
add bx,si ; point to next word
inc dl ; bump counter
loop DumpMem2 ; loop until all words printed
call doutcrlf
DumpMem6:
ret
SetupPcodeArgs:
mov ax,[bpCurrent] ; set pArgStart and pArgEnd
dec ax
dec ax
mov [pArgStart],ax
mov cx,[cPcodeArgs]
shl cx,1
sub ax,cx
mov [pArgEnd],ax
mov [pLocalStart],ax ; set pLocalStart and pLocalEnd
mov ax,[bpLast]
add ax,4
mov [pLocalEnd],ax
ret
SetupNatArgs:
mov ax,[bpCurrent] ; set pArgStart and pArgEnd
mov bx,ax
add ax,4
test word ptr [bx],0001h
jz SetupNat2
add ax,2
SetupNat2:
mov [pArgStart],ax
mov bx,[bx]
and bl,0feh
sub bx,4
cmp bx,-4
jne SetupNat4
mov bx,ax
SetupNat4:
mov [pArgEnd],bx
mov ax,[bpCurrent] ; set pLocalStart and pLocalEnd
sub ax,8
mov [pLocalStart],ax
mov ax,[bpLast]
add ax,8
mov [pLocalEnd],ax
ret
;*
;* PrintSz : ES:BX = "sz" string
;*
;* print string
PrintSz:
push ax ; save regs
PrintSz2:
mov al,es:[bx] ; get a char
inc bx ; point to next char
cmp al,0 ; end of string?
jz PrintSz4 ; yes - exit
call dout ; output the char
jmp PrintSz2 ; loop
PrintSz4:
pop ax
ret
MakeHexDigit:
add al,'0'
cmp al,'9'
jbe MakeHex2
add al,'A' - '0' - 10
MakeHex2:
ret
; print out a 16 bit unsigned in 4 hex digit format
dout16:
push bx ; save environment
push cx
mov bx,ax ; val saved in bx
mov al,ah
mov cl,4
shr al,cl
call MakeHexDigit
call dout
mov al,bh
and al,0fh
call MakeHexDigit
call dout
mov al,bl
mov cl,4
shr al,cl
call MakeHexDigit
call dout
mov al,bl
and al,0fh
call MakeHexDigit
call dout
pop cx ; restore environment
pop bx
ret
; print out a carrage return line feed pair
doutcrlf:
mov al,0dh
call dout
mov al,0ah
call dout
ret
; print out a char
dout:
push bx ; save environment
cmp word ptr [fPrintDbgScr],0 ; print to the debug screen?
jz dout2 ; no - skip
lea bx,[hDbgScreen] ; get handle of debug screen to print to
call doutfile
dout2:
lea bx,[hOutFile] ; get handle of file to print to
call doutfile
pop bx ; restore environment
ret
; print out a char to the opened file
doutfile:
cmp [bx],0ffffh ; exit if file not open
je doutfile4
push ax ; save environment
push cx
push dx
push bx
push [bx] ; pass file handle
lea bx,[chOutBuff]
push ss
push bx
mov [bx],al
mov ax,1
push ax
call CchWriteDoshnd
test ax,8000h
jz doutfile2
pop bx ; close this file if error
push bx
call CloseOutFile
doutfile2:
pop bx ; restore environment
pop dx
pop cx
pop ax
doutfile4:
ret
; close the output file
CloseOutFile:
cmp [bx],0ffffh
je CloseOut2
push ax ; save environment
push cx
push dx
push bx
push [bx]
call FCloseDoshnd
pop bx
mov [bx],0ffffh
pop dx ; restore environment
pop cx
pop ax
CloseOut2:
ret
;********** GetPsOfSn **********
;* entry : sn = Pcode segment #
;* * find physical segment of Pcode segment (if resident)
;* exit : AX = ps (or 0 if not resident)
; %%Function:GetPsOfSn %%Owner:BRADV
cProc GetPsOfSn, <NEAR, ATOMIC>
ParmW sn
cBegin GetPsOfSn
XOR AX,AX ;* return zero if segMac
MOV BX,sn
CMP BX,$q_snMacReal
JAE get_ps_end
SHL BX,1 ;* Make into word pointer
SHL BX,1 ;* DWORD ptr
ADD BX,OFFSET DGROUP:$q_mpsnpfn ;* DS:BX => table
PUSH WORD PTR [BX+2] ;* segment
PUSH WORD PTR [BX] ;* offset (lpthunk on stack)
MOV BX,OFFSET DGROUP:segiT ;* address of buffer
cCall GetCodeInfo,<DS,BX> ;* lpthunk, lpsegi
OR AX,AX
JZ get_ps_end ;* error - assume non-resident
;* * good segment info, see if segment resident
MOV AX,segiT.hSegi ;* handle or ps if fixed
TEST AX,1
JNZ get_ps_end ;* ax = ps
cCall GlobalHandle,<ax> ;* get handle info
MOV AX,DX ;* ps (or 0 if not loaded)
get_ps_end:
cEnd GetPsOfSn
sEnd rip
END
|
test/agda/FRP/JS/Test/DOM.agda | agda/agda-frp-js | 63 | 5819 | open import FRP.JS.Nat using ( ℕ ; suc ; _+_ )
open import FRP.JS.DOM
open import FRP.JS.RSet
open import FRP.JS.Time using ( Time ; epoch )
open import FRP.JS.Delay using ( _ms )
open import FRP.JS.Behaviour
open import FRP.JS.Bool using ( Bool ; not ; true )
open import FRP.JS.QUnit using ( TestSuite ; ok◇ ; test ; _,_ ; ε )
module FRP.JS.Test.DOM where
withDOW : {A : Set} → ((w : DOW) → A) → A
withDOW f = f unattached
tests : TestSuite
tests =
( test "≟*"
( ok◇ "[] ≟* []"
(withDOW λ w → [] {w} ≟* [])
, ok◇ "[] ++ [] ≟* []"
(withDOW λ w → [] {left w} ++ [] ≟* []) )
, test "attr"
( ok◇ "attr class [ alpha ] ≟* attr class [ alpha ]"
(withDOW λ w → attr {w} "class" [ "alpha" ] ≟* attr "class" [ "alpha" ])
, ok◇ "attr foo [ alpha ] ≟* attr foo [ alpha ]"
(withDOW λ w → attr {w} "foo" [ "alpha" ] ≟* attr "foo" [ "alpha" ])
, ok◇ "attr foo [ alpha ] ++ attr bar [ alpha ] ≟* attr foo [ alpha ] ++ attr bar [ alpha ]"
(withDOW λ w → attr {left w} "foo" [ "alpha" ] ++ attr "bar" [ "alpha" ] ≟* attr "foo" [ "alpha" ] ++ attr "bar" [ "alpha" ])
, ok◇ "attr class [ beta ] ≟* attr class [ alpha ]"
(withDOW λ w → not* (attr {w} "class" [ "beta" ] ≟* attr "class" [ "alpha" ]))
, ok◇ "attr foo [ alpha ] ≟* attr class [ alpha ]"
(withDOW λ w → not* (attr {w} "foo" [ "alpha" ] ≟* attr "class" [ "alpha" ]))
, ok◇ "attr foo [ alpha ] ++ attr bar [ alpha ] ≟* attr foo [ alpha ]"
(withDOW λ w → not* (attr {left w} "foo" [ "alpha" ] ++ attr "bar" [ "alpha" ] ≟* attr "foo" [ "alpha" ])) )
, test "text"
( ok◇ "text [ abc ] ≟* text [ abc ]"
(withDOW λ w → text {w} [ "abc" ] ≟* text [ "abc" ])
, ok◇ "text [ a ] ≟* text [ abc ]"
(withDOW λ w → not* (text {w} [ "a" ] ≟* text [ "abc" ]))
, ok◇ "[] ≟* text [ abc ]"
(withDOW λ w → not* ([] ≟* text {w} [ "abc" ]))
, ok◇ "text [ abc ] ++ [] ≟* text [ abc ]"
(withDOW λ w → text {left w} [ "abc" ] ++ [] ≟* (text [ "abc" ]))
, ok◇ "[] ++ text [ abc ] ≟* text [ abc ]"
(withDOW λ w → [] ++ text {right w} [ "abc" ] ≟* (text [ "abc" ])) )
, test "element"
( ok◇ "element p (text [ abc ]) ≟* element p (text [ abc ])"
(withDOW λ w → element "p" {w} (text [ "abc" ]) ≟* element "p" (text [ "abc" ]))
, ok◇ "element p (text [ a ]) ≟* element p (text [ abc ])"
(withDOW λ w → not* (element "p" {w} (text [ "a" ]) ≟* element "p" (text [ "abc" ])))
, ok◇ "element div (attr class [ alpha ] ++ text [ abc ]) ≟* element div (attr class [ alpha ] ++ text [ abc ])"
(withDOW λ w → element "div" {w} (attr "class" [ "alpha" ] ++ text [ "abc" ]) ≟* element "div" {w} (attr "class" [ "alpha" ] ++ text [ "abc" ]))
, ok◇ "element div (attr class [ beta ] ++ text [ abc ]) ≟* element div (attr class [ alpha ] ++ text [ abc ])"
(withDOW λ w → not* (element "div" {w} (attr "class" [ "beta" ] ++ text [ "abc" ]) ≟* element "div" {w} (attr "class" [ "alpha" ] ++ text [ "abc" ])))
, ok◇ "element p (text [ abc ]) ≟* element p (text [ abc ])"
(withDOW λ w → element "p" {w} (text [ "abc" ]) ≟* element "p" (text [ "abc" ]))
, ok◇ "element p (text [ a ]) ++ element p (text [ b ]) ≟* element p (text [ a ])"
(withDOW λ w → not* (element "p" {left w} (text [ "a" ]) ++ element "p" (text [ "b" ]) ≟* element "p" (text [ "a" ])))
)
, test "join"
( ok◇ "text (join (map [ x ] [ abc ])) ≟* text [ abc ]"
(withDOW λ w → text {w} (join (map (λ s → [ s ]) [ "abc" ])) ≟* text [ "abc" ])
, ok◇ "join (map (text [ x ]) [ abc ]) ≟* text [ abc ]"
(withDOW λ w → join (map (λ s → text {w} [ s ]) [ "abc" ]) ≟* text [ "abc" ])
, ok◇ "element p (join (map (attr foo [ x ]) [ alpha ]) ++ join (map (attr bar [ x ]) [ alpha ])) ≟* element p (attr foo [ alpha ] ++ attr bar [ alpha ])"
(withDOW λ w → element "p" {w} (join (map (λ s → attr "foo" [ s ]) [ "alpha" ]) ++ join (map (λ s → attr "bar" [ s ]) [ "alpha" ])) ≟* element "p" (attr "foo" [ "alpha" ] ++ attr "bar" [ "alpha" ]))
, ok◇ "element p (join (map (attr foo [ x ]) [ beta ]) ++ join (map (attr bar [ x ]) [ alpha ])) ≟* element p (attr foo [ alpha ] ++ attr bar [ alpha ])"
(withDOW λ w → not* (element "p" {w} (join (map (λ s → attr "foo" [ s ]) [ "beta" ]) ++ join (map (λ s → attr "bar" [ s ]) [ "alpha" ])) ≟* element "p" (attr "foo" [ "alpha" ] ++ attr "bar" [ "alpha" ])))
, ok◇ "text (join (map [ x ] [ a ])) ≟* text [ abc ]"
(withDOW λ w → not* (text {w} (join (map (λ s → [ s ]) [ "a" ])) ≟* text [ "abc" ]))
, ok◇ "join (map (text [ x ]) [ a ]) ≟* text [ abc ]"
(withDOW λ w → not* (join (map (λ s → text {w} [ s ]) [ "a" ]) ≟* text [ "abc" ])) ) )
|
examples/simple_example.adb | AntonMeep/parse_args | 9 | 15588 | <filename>examples/simple_example.adb
-- simple_example
-- A simple example of the use of parse_args
-- Copyright (c) 2014, <NAME>
--
-- 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 Parse_Args;
use Parse_Args;
with Parse_Args.Integer_Array_Options;
with Ada.Text_IO;
use Ada.Text_IO;
procedure Simple_Example is
AP : Argument_Parser;
begin
AP.Add_Option(Make_Boolean_Option(False), "help", 'h', Usage => "Display this help text");
AP.Add_Option(Make_Boolean_Option(False), "foo", 'f', Usage => "The foo option");
AP.Add_Option(Make_Boolean_Option(True), "bar", 'b', Usage => "The bar option");
AP.Add_Option(Make_Repeated_Option(0), "baz", 'z',
Usage => "The baz option (can be repeated for more baz)");
AP.Add_Option(Make_Boolean_Option(False), "long-only",
Long_Option => "long-only",
Usage => "The --long-only option has no short version");
AP.Add_Option(Make_Boolean_Option(False), "short-only",
Short_Option => 'x', Long_Option => "-",
Usage => "The -x option has no long version");
AP.Add_Option(Make_Natural_Option(0), "natural", 'n', Usage => "Specify a natural number argument");
AP.Add_Option(Make_Integer_Option(-1), "integer", 'i', Usage => "Specify an integer argument");
AP.Add_Option(Make_String_Option(""), "string", 's', Usage => "Specify a string argument");
AP.Add_Option(Integer_Array_Options.Make_Option, "array", 'a',
Usage => "Specify a comma-separated integer array argument");
AP.Append_Positional(Make_String_Option("INFILE"), "INFILE");
AP.Allow_Tail_Arguments("TAIL-ARGUMENTS");
AP.Set_Prologue("A demonstration of the basic features of the Parse_Args library.");
AP.Parse_Command_Line;
if AP.Parse_Success and then AP.Boolean_Value("help") then
AP.Usage;
elsif AP.Parse_Success then
Put_Line("Command name is: " & AP.Command_Name);
New_Line;
for I in AP.Iterate loop
Put_Line("Option "& Option_Name(I) & " was " &
(if AP(I).Set then "" else "not ") &
"set on the command line. Value: " &
AP(I).Image);
end loop;
New_Line;
Put_Line("There were: " & Integer'Image(Integer(AP.Tail.Length)) & " tail arguments.");
declare
I : Integer := 1;
begin
for J of AP.Tail loop
Put_Line("Argument" & Integer'Image(I) & " is: " & J);
I := I + 1;
end loop;
end;
else
Put_Line("Error while parsing command-line arguments: " & AP.Parse_Message);
end if;
end Simple_Example;
|
CODE/ADV/ADV.asm | mspeculatrix/Zolatron64 | 0 | 26662 | <filename>CODE/ADV/ADV.asm
; Code for Zolatron 64 6502-based microcomputer.
;
; GitHub: https://github.com/mspeculatrix/Zolatron64/
; Blog: https://mansfield-devine.com/speculatrix/category/projects/zolatron/
;
; Written for the Beebasm assembler
; Assemble with:
; beebasm -v -i ADV.asm
CPU 1 ; use 65C02 instruction set
INCLUDE "../../LIB/cfg_main.asm"
INCLUDE "../../LIB/cfg_page_0.asm"
; PAGE 1 is the STACK
INCLUDE "../../LIB/cfg_page_2.asm"
; PAGE 3 is used for STDIN & STDOUT buffers, plus indexes
INCLUDE "../../LIB/cfg_page_4.asm"
INCLUDE "../../LIB/cfg_VIAC.asm"
MACRO NEWLINE
lda #CHR_LINEEND
jsr OSWRCH
ENDMACRO
ORG USR_PAGE
.startcode
sei ; don't interrupt me yet
cld ; we don' need no steenkin' BCD
ldx #$ff ; set stack pointer to $01FF - only need to set the
txs ; LSB, as MSB is assumed to be $01
lda #0
sta PRG_EXIT_CODE
cli
stz VIAC_PORTA
stz VIAC_PORTB
.main
LOAD_MSG start_msg
jsr OSWRMSG
NEWLINE
NEWLINE
LOAD_MSG location_00
jsr OSWRMSG
.prog_end
jmp OSSFTRST
.start_msg
equs "Adventure", 10, 10
equs "<--- Your terminal must be at least this wide to go on this ride --->",0
.location_00
equs "You find yourself standing in a large, open-plan office.",10
equs "You're the only one here.",10
equs "It's night and the office is dimly lit by a few glowing computer",10
equs "screens, blinking router LEDs and the occasional anglepoise.",10
equs "Above the hum of the A/C and the faint sound of traffic outside you",10
equs "can hear a feeble electronic beeping. But it's not obvious where",10
equs "it's coming from.",10
equs "Nearby, one desk supports a bizarrely old-fashioned terminal. Its",10
equs "CRT display shows a message in green characters that you find",10
equs "strangely comforting.",0
.endcode
SAVE "../bin/ADV.BIN", startcode, endcode
|
Programs/Fibonacci.asm | visrealm/vrcpu | 102 | 80128 | ; FIBONACCI SEQUENCE
;
; If you want to halt instead of repeat, look
; at the jc .begin line. You might want to create
; Another label with another action to end ;)
.begin:
clra
inc Rb
.loop:
add Rc, Rb
jc .begin
mov Rd, Rc
mov Rc, Rb
mov Rb, Rd
jmp .loop
|
misc/add_sub.asm | a1393323447/x86-Assambely | 3 | 22997 | ; 不产生进位的加法
mov ax, 0x0001
mov bx, 0x0002
add ax, bx
; 产生进位的加法
mov ax, 0xf000
mov bx, 0x1000
add ax, bx
; 不产生借位的减法
mov cx, 0x0003
mov dx, 0x0002
sub cx, dx
; 产生借位的减法
mov cx, 0x0001
mov dx, 0x0002
sub cx, dx
; 当发生进位或者借位的时候, cf 标志位会被置为 1, 否则为 0
; 指令 inc [increase] dec [decrease], 自增, 自减, 不会影响 cf 位
dead_loop: jmp dead_loop
times 510-($-$$) db 0
db 0x55, 0xaa |
src/main/antlr4/org/tendiwa/inflectible/antlr/LexemeParser.g4 | gvlasov/inflectible | 30 | 1980 | parser grammar LexemeParser;
import SharedParser;
options {
tokenVocab=LexemeLexer;
}
lexemes: lexeme+;
lexeme: conceptId partOfSpeech persistentGrammemes? WORD_FORMS_START wordForms ELLIPSIS? WORD_FORMS_END;
persistentGrammemes: grammaticalMeaning;
partOfSpeech: LPAREN PART_OF_SPEECH RPAREN;
wordForms: headword? inflectedWordForm*;
headword: spelling;
inflectedWordForm: spelling grammaticalMeaning;
spelling: SPELLING;
grammaticalMeaning: LT grammemes GT;
|
src/tcg-outputs-libgba.adb | Fabien-Chouteau/tiled-code-gen | 1 | 17717 | <filename>src/tcg-outputs-libgba.adb
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2021 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO; use Ada.Text_IO;
with TCG.Utils; use TCG.Utils;
with TCG.Tilesets;
with TCG.Palette;
use TCG;
package body TCG.Outputs.LibGBA is
use type Tilesets.Master_Tile_Id;
use type Palette.Color_Id;
procedure Generate_Charblock (Filepath : String;
Package_Name : String);
procedure Generate_Tileset_Collisions (Filepath : String;
Package_Name : String);
procedure Generate_Root_Package
(Filename : String;
Package_Name : String;
Format : Palette.Output_Color_Format);
------------------------
-- Generate_Charblock --
------------------------
procedure Generate_Charblock (Filepath : String;
Package_Name : String)
is
Output : Ada.Text_IO.File_Type;
procedure P (Str : String);
procedure PL (Str : String);
procedure NL;
procedure P (Str : String) is
begin
Put (Output, Str);
end P;
procedure PL (Str : String) is
begin
Put_Line (Output, Str);
end PL;
procedure NL is
begin
New_Line (Output);
end NL;
begin
pragma Style_Checks ("M200");
Create (Output, Out_File, Filepath);
PL ("with GBA.Graphics.Charblocks;");
PL ("pragma Style_Checks (Off);");
PL ("package " & Package_Name & " is");
NL;
PL (" Block : aliased constant GBA.Graphics.Charblocks.Charblock_Raw :=");
PL (" (");
for Id in Tilesets.First_Id .. Tilesets.Last_Id loop
for Y in 1 .. Tilesets.Tile_Height loop
P (" ");
for X in 1 .. Tilesets.Tile_Width loop
if Id /= Tilesets.No_Tile and then Id <= Tilesets.Last_Id then
P (Palette.Color_Id'Image ((Tilesets.Pix (Id, X, Y))));
else
P (" 0");
end if;
if X /= Tilesets.Tile_Width then
P (",");
end if;
end loop;
if Y /= Tilesets.Tile_Height then
PL (",");
else
P ("");
end if;
end loop;
if Id /= Tilesets.Last_Id then
PL (",");
else
PL (");");
end if;
end loop;
PL ("end " & Package_Name & ";");
Close (Output);
end Generate_Charblock;
---------------------------------
-- Generate_Tileset_Collisions --
---------------------------------
procedure Generate_Tileset_Collisions (Filepath : String;
Package_Name : String)
is
Output : Ada.Text_IO.File_Type;
procedure P (Str : String);
procedure PL (Str : String);
procedure NL;
procedure P (Str : String) is
begin
Put (Output, Str);
end P;
procedure PL (Str : String) is
begin
Put_Line (Output, Str);
end PL;
procedure NL is
begin
New_Line (Output);
end NL;
begin
Create (Output, Out_File, Filepath);
PL ("with GBA.Graphics.Charblocks;");
PL ("pragma Style_Checks (Off);");
PL ("package " & Package_Name & " is");
NL;
PL (" Block : aliased constant GBA.Graphics.Charblocks.Charblock_Raw :=");
PL (" (");
for Id in Tilesets.First_Id .. Tilesets.Last_Id loop
for Y in 1 .. Tilesets.Tile_Height loop
P (" ");
for X in 1 .. Tilesets.Tile_Width loop
P (if Id /= Tilesets.No_Tile
and then
Id <= Tilesets.Last_Id
and then
Tilesets.Collision (Id, X, Y)
then
"1"
else
"0");
if X /= Tilesets.Tile_Width then
P (",");
end if;
end loop;
if Y /= Tilesets.Tile_Height then
PL (",");
else
P ("");
end if;
end loop;
if Id /= Tilesets.Last_Id then
PL (",");
else
PL (");");
end if;
end loop;
PL ("end " & Package_Name & ";");
Close (Output);
end Generate_Tileset_Collisions;
---------------------------
-- Generate_Root_Package --
---------------------------
procedure Generate_Root_Package
(Filename : String;
Package_Name : String;
Format : Palette.Output_Color_Format)
is
Output : File_Type;
begin
Create (Output, Out_File, Filename);
Put_Line (Output, "with GBA.Graphics.Palettes;");
Put_Line (Output, "with GBA.Graphics.Charblocks;");
New_Line (Output);
Put_Line (Output, "pragma Style_Checks (Off);");
Put_Line (Output, "package " & Package_Name & " is");
New_Line (Output);
New_Line (Output);
Put_Line (Output,
" Palette : aliased GBA.Graphics.Palettes.Palette := (");
declare
use TCG.Palette;
First : constant Color_Id := Palette.First_Id;
Last : constant Color_Id := Palette.Last_Id;
-- The GBA palettes have fixed size 256 colors
Max : constant Color_Id := 255;
begin
if First /= 0 then
raise Program_Error with "expected Palette.First_Id = 0";
end if;
if Last > 255 then
raise Program_Error with "Palette size (" &
Palette.Number_Of_Colors'Img &
") above maximum allowed for LibGBA (256)";
end if;
for Id in First .. Max loop
if Id <= Last then
Put (Output, " " & Id'Img & " => " &
Palette.Image (Palette.Convert (Id), Format));
else
Put (Output, " " & Id'Img & " => 0");
end if;
if Id /= Max then
Put_Line (Output, ",");
end if;
end loop;
end;
Put_Line (Output, ");");
New_Line (Output);
Put_Line (Output, " type Object_Kind is (Rectangle_Obj, Point_Obj,");
Put_Line (Output, " Ellipse_Obj, Polygon_Obj, Tile_Obj, Text_Obj);");
New_Line (Output);
Put_Line (Output, " type String_Access is access all String;");
New_Line (Output);
Put_Line (Output, " type Object");
Put_Line (Output, " (Kind : Object_Kind := Rectangle_Obj)");
Put_Line (Output, " is record");
Put_Line (Output, " Name : String_Access;");
Put_Line (Output, " Id : Natural;");
Put_Line (Output, " X : Float;");
Put_Line (Output, " Y : Float;");
Put_Line (Output, " Width : Float;");
Put_Line (Output, " Height : Float;");
-- Put_Linr (Output, " Points : Polygon_Access;");
Put_Line (Output, " Str : String_Access;");
Put_Line (Output, " Flip_Vertical : Boolean;");
Put_Line (Output, " Flip_Horizontal: Boolean;");
Put_Line
(Output, " Tile_Id : GBA.Graphics.Charblocks.Tile_Id;");
Put_Line (Output, " end record;");
New_Line (Output);
Put_Line (Output, " type Object_Array is array (Natural range <>)");
Put_Line (Output, " of Object;");
New_Line (Output);
Put_Line (Output, "end " & Package_Name & ";");
Close (Output);
end Generate_Root_Package;
-----------------------
-- Gen_LibGBA_Source --
-----------------------
procedure Gen_LibGBA_Source
(Directory : String;
Root_Package_Name : String;
Map_List : TCG.Maps.List.List)
is
Format : constant Palette.Output_Color_Format := Palette.RGB555;
begin
if not TCG.Utils.Make_Dir (Directory) then
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
"Cannot create directory for GESTE code: '" & Directory & "'");
return;
end if;
if Tilesets.Tile_Width /= Tilesets.Tile_Height then
raise Program_Error with "Tiles are not square";
end if;
if Tilesets.Tile_Width /= 8 then
raise Program_Error with "Only 8x8 tiles allowed for LibGBA";
end if;
if Tilesets.Number_Of_Tiles > 512 then
raise Program_Error
with "Number of tiles (" & Tilesets.Number_Of_Tiles'Img &
") above maximum allowed for LibGBA (512)";
end if;
declare
Package_Name : constant String := Root_Package_Name;
Filename : constant String :=
Compose (Directory, To_Ada_Filename (Package_Name));
begin
Generate_Root_Package (Filename, Package_Name, Format);
end;
declare
Package_Name : constant String := Root_Package_Name & ".Charblock";
Filename : constant String :=
Compose (Directory, To_Ada_Filename (Package_Name));
begin
Generate_Charblock (Filename, Package_Name);
end;
declare
Package_Name : constant String :=
Root_Package_Name & ".Collisions";
Filename : constant String :=
Compose (Directory, To_Ada_Filename (Package_Name));
begin
Generate_Tileset_Collisions (Filename, Package_Name);
end;
for Map of Map_List loop
declare
Package_Name : constant String :=
Root_Package_Name & "." & To_Ada_Identifier (Maps.Name (Map));
Filename : constant String :=
Compose (Directory, To_Ada_Filename (Package_Name));
begin
TCG.Maps.Generate_LibGBA_Source (Map, Package_Name, Filename);
end;
end loop;
end Gen_LibGBA_Source;
end TCG.Outputs.LibGBA;
|
source/asis/asis-gela-library.adb | faelys/gela-asis | 4 | 4137 | <gh_stars>1-10
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $:
with Ada.Wide_Text_IO;
with Ada.Strings.Maps;
with Ada.Strings.Fixed;
with Ada.Strings.Wide_Fixed;
with Ada.Characters.Handling;
with Ada.Command_Line;
package body Asis.Gela.Library is
function To_File_Name
(Full_Name : Wide_String;
Suffix : String) return Wide_String;
function Gela_Lib_Path return String;
function Env return String is separate;
Search_Path : Unbounded_Wide_String;
Path_Separator : constant Wide_String := (1 => Wide_Character'Val (10));
File_Separator : constant Wide_Character := '/';
------------------------
-- Add_To_Search_Path --
------------------------
procedure Add_To_Search_Path (Path : Wide_String) is
use Ada.Strings.Wide_Unbounded;
begin
if Path'Length > 0 and then Path (Path'Last) /= File_Separator then
Search_Path := Search_Path & Path & File_Separator & Path_Separator;
else
Search_Path := Search_Path & Path & Path_Separator;
end if;
end Add_To_Search_Path;
---------------
-- Body_File --
---------------
function Body_File
(Full_Name : Wide_String)
return Wide_String
is
begin
return To_File_Name (Full_Name, ".adb");
end Body_File;
-----------------------
-- Clear_Search_Path --
-----------------------
procedure Clear_Search_Path is
use Ada.Characters.Handling;
Lib : constant Wide_String := To_Wide_String (Gela_Lib_Path);
begin
Search_Path := W.Null_Unbounded_Wide_String;
Add_To_Search_Path (Lib);
end Clear_Search_Path;
----------------------
-- Declaration_File --
----------------------
function Declaration_File
(Full_Name : Wide_String)
return Wide_String
is
begin
return To_File_Name (Full_Name, ".ads");
end Declaration_File;
-------------------
-- Gela_Lib_Path --
-------------------
function Gela_Lib_Path return String is
begin
return Env;
end Gela_Lib_Path;
---------------------
-- Has_Declaration --
---------------------
function Has_Declaration
(Full_Name : Wide_String)
return Boolean
is
File_Name : constant Wide_String := Declaration_File (Full_Name);
begin
return File_Exists (File_Name);
end Has_Declaration;
-----------------
-- File_Exists --
-----------------
function File_Exists (File_Name : Wide_String) return Boolean is
use Ada.Wide_Text_IO;
use Ada.Characters.Handling;
File : File_Type;
begin
Open (File, In_File, To_String (File_Name));
Close (File);
return True;
exception
when others =>
return False;
end File_Exists;
----------------
-- Find_File --
----------------
function Find_File (File_Name : Wide_String) return Wide_String is
use Ada.Characters.Handling;
Path : Unbounded_Wide_String := Search_Path;
Pos : Natural;
begin
loop
Pos := W.Index (Path, Path_Separator);
exit when Pos = 0;
declare
File : constant Wide_String :=
W.Slice (Path, 1, Pos - 1) & File_Name;
begin
W.Delete (Path, 1, Pos);
if File_Exists (File) then
return File;
end if;
end;
end loop;
return File_Name;
end Find_File;
------------------------
-- Is_Predefined_Unit --
------------------------
function Is_Predefined_Unit (File_Name : Wide_String) return Boolean is
use Ada.Characters.Handling;
Lib : constant Wide_String := To_Wide_String (Gela_Lib_Path);
begin
if Lib = "" then
return False;
else
return Ada.Strings.Wide_Fixed.Index (File_Name, Lib) > 0;
end if;
end Is_Predefined_Unit;
------------------
-- To_File_Name --
------------------
function To_File_Name
(Full_Name : Wide_String;
Suffix : String) return Wide_String
is
use Ada.Strings.Maps;
use Ada.Strings.Fixed;
use Ada.Characters.Handling;
Name : constant String := To_Lower (To_String (Full_Name));
Repl : constant Character_Mapping := To_Mapping (".","-");
File : constant String := Translate (Name, Repl) & Suffix;
begin
return Find_File (To_Wide_String (File));
end To_File_Name;
end Asis.Gela.Library;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * 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 OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
|
tests/tk-image-photo-photo_options_test_data.ads | thindil/tashy2 | 2 | 8477 | <gh_stars>1-10
-- This package is intended to set up and tear down the test environment.
-- Once created by GNATtest, this package will never be overwritten
-- automatically. Contents of this package can be modified in any way
-- except for sections surrounded by a 'read only' marker.
with Tk.Image.Image_Options_Test_Data.Image_Options_Tests;
with GNATtest_Generated;
package Tk.Image.Photo.Photo_Options_Test_Data is
-- begin read only
type Test_Photo_Options is new GNATtest_Generated.GNATtest_Standard.Tk.Image
.Image_Options_Test_Data
.Image_Options_Tests
.Test_Image_Options
-- end read only
with
null record;
procedure Set_Up(Gnattest_T: in out Test_Photo_Options);
procedure Tear_Down(Gnattest_T: in out Test_Photo_Options);
end Tk.Image.Photo.Photo_Options_Test_Data;
|
formalization/Data/Signed.agda | brunoczim/Celeste | 1 | 14178 | module Data.Signed where
open import Data.Bit using
(Bit
; b0
; b1
; Bits-num
; Bits-neg
; Overflowing
; _overflow:_
; result
; carry
; WithCarry
; _with-carry:_
; toBool
; tryToFinₙ
; !ₙ
; _⊕_
; _↔_
) renaming
( _+_ to bit+
; _-_ to bit-
; ! to bit!
; _&_ to bit&
; _~|_ to bit|
; _^_ to bit^
; _>>_ to bit>>
; _<<_ to bit<<
)
open import Data.Unit using (⊤)
open import Data.Nat using (ℕ; suc; zero) renaming (_≤_ to ℕ≤)
open import Data.Vec using (Vec; _∷_; []; head; tail; replicate)
open import Data.Nat.Literal using (Number)
open import Data.Int.Literal using (Negative)
open import Data.Maybe using (just; nothing)
open import Data.Empty using (⊥)
infixl 8 _-_ _+_
infixl 7 _<<_ _>>_
infixl 6 _&_
infixl 5 _^_
infixl 4 _~|_
record Signed (n : ℕ) : Set where
constructor mk-int
field
bits : Vec Bit n
open Signed public
instance
Signed-num : {m : ℕ} → Number (Signed m)
Signed-num {zero} .Number.Constraint = Number.Constraint (Bits-num {zero})
Signed-num {suc m} .Number.Constraint = Number.Constraint (Bits-num {m})
Signed-num {zero} .Number.fromNat zero ⦃ p ⦄ = mk-int [] where
Signed-num {zero} .Number.fromNat (suc _) ⦃ ℕ≤.s≤s () ⦄
Signed-num {suc m} .Number.fromNat n ⦃ p ⦄ = mk-int (mk-bits p) where
mk-bits : Number.Constraint (Bits-num {m}) n → Vec Bit (suc m)
mk-bits p = b0 ∷ Number.fromNat Bits-num n ⦃ p ⦄
instance
Signed-neg : {m : ℕ} → Negative (Signed (suc m))
Signed-neg {m} .Negative.Constraint = Negative.Constraint (Bits-neg {m})
Signed-neg {m} .Negative.fromNeg n ⦃ p ⦄ = mk-int bitVec where
bitVec : Vec Bit (suc m)
bitVec = Negative.fromNeg (Bits-neg {m}) n ⦃ p ⦄
_+_ : {n : ℕ} → Signed n → Signed n → Overflowing (Signed n)
p + q = mk-int (result sum) overflow: toBool overflow where
sum = bit+ (bits p) (bits q)
last-carry : {n : ℕ} → Vec Bit n → Bit
last-carry [] = b0
last-carry (b ∷ _) = b
overflow = head (carry sum) ⊕ last-carry (tail (carry sum))
_-_ : {n : ℕ} → Signed n → Signed n → Overflowing (Signed n)
p - q = mk-int (result sub) overflow: toBool overflow where
sub = bit- (bits p) (bits q)
last-carry : {n : ℕ} → Vec Bit n → Bit
last-carry [] = b0
last-carry (b ∷ _) = b
overflow = head (carry sub) ↔ last-carry (tail (carry sub))
rotr : {n : ℕ} → Signed n → Signed n → WithCarry (Signed n) (Signed n)
rotr {n} (mk-int ps) (mk-int qs) = new-result with-carry: new-carry where
shifted : WithCarry (Vec Bit n) (Vec Bit n)
shifted with tryToFinₙ qs
... | just i = bit>> ps i
... | nothing = replicate b0 with-carry: ps
new-result : Signed n
new-result = mk-int (result shifted)
new-carry : Signed n
new-carry = mk-int (carry shifted)
rotl : {n : ℕ} → Signed n → Signed n → WithCarry (Signed n) (Signed n)
rotl {n} (mk-int ps) (mk-int qs) = new-result with-carry: new-carry where
shifted : WithCarry (Vec Bit n) (Vec Bit n)
shifted with tryToFinₙ qs
... | just i = bit<< ps i
... | nothing = replicate b0 with-carry: ps
new-result : Signed n
new-result = mk-int (result shifted)
new-carry : Signed n
new-carry = mk-int (carry shifted)
_>>_ : {n : ℕ} → Signed n → Signed n → Signed n
ps >> qs = result (rotr ps qs)
_<<_ : {n : ℕ} → Signed n → Signed n → Signed n
ps << qs = result (rotl ps qs)
arotr : {n : ℕ} → Signed n → Signed n → WithCarry (Signed n) (Signed n)
arotr {n} (mk-int []) _ = mk-int [] with-carry: mk-int []
arotr {suc n} (mk-int (p ∷ ps)) (mk-int qs) = new-result with-carry: new-carry
where
shifted : WithCarry (Vec Bit n) (Vec Bit n)
shifted with tryToFinₙ qs
... | just i = bit>> ps i
... | nothing = replicate b0 with-carry: ps
new-result : Signed (suc n)
new-result = mk-int (p ∷ result shifted)
new-carry : Signed (suc n)
new-carry = mk-int (b0 ∷ carry shifted)
arotl : {n : ℕ} → Signed n → Signed n → WithCarry (Signed n) (Signed n)
arotl {n} (mk-int []) _ = mk-int [] with-carry: mk-int []
arotl {suc n} (mk-int (p ∷ ps)) (mk-int qs) = new-result with-carry: new-carry
where
shifted : WithCarry (Vec Bit n) (Vec Bit n)
shifted with tryToFinₙ qs
... | just i = bit<< ps i
... | nothing = replicate b0 with-carry: ps
new-result : Signed (suc n)
new-result = mk-int (p ∷ result shifted)
new-carry : Signed (suc n)
new-carry = mk-int (b0 ∷ carry shifted)
_a>>_ : {n : ℕ} → Signed n → Signed n → Signed n
ps a>> qs = result (rotr ps qs)
_a<<_ : {n : ℕ} → Signed n → Signed n → Signed n
ps a<< qs = result (rotl ps qs)
! : {n : ℕ} → Signed n → Signed n
! (mk-int ps) = mk-int (!ₙ ps)
_&_ : {n : ℕ} → Signed n → Signed n → Signed n
(mk-int ps) & (mk-int qs) = mk-int (bit& ps qs)
_~|_ : {n : ℕ} → Signed n → Signed n → Signed n
(mk-int ps) ~| (mk-int qs) = mk-int (bit| ps qs)
_^_ : {n : ℕ} → Signed n → Signed n → Signed n
(mk-int ps) ^ (mk-int qs) = mk-int (bit^ ps qs)
|
config/askpass.applescript | JarryShaw/MacDaily | 10 | 2755 | <gh_stars>1-10
#!/usr/bin/env osascript
-- script based on https://github.com/theseal/ssh-askpass
on run argv
set args to argv as text
if args starts with "--help" or args starts with "-h" then
return "macdaily-askpass [-h|--help] [prompt]"
end if
display dialog args with icon caution default button "OK" default answer "" with hidden answer
return result's text returned
end run
|
src/main/antlr/Eemo.g4 | marcopennekamp/eemo | 0 | 5813 | grammar Eemo;
@header {
package me.pennekamp.eemo.parser;
}
discussion
: conversation
;
conversation
: ConversationStart
labeledLine*
ConversationEnd
;
labeledLine
: label? (conversation | statement)
;
statement
: Increment
| Double
| Add
| Decrement
| Halve
| Sub
| Reset
| MoveToLeft
| MoveToRight
| MoveToRegister
| MoveToStack
| CopyToLeftStack
| Output
| Input
| ifPositive
| jump
| Nop
;
label
: Id
;
ifPositive
: IfPositive conversation
;
jump
: Jump Id
;
ConversationStart: '(^-^)/';
ConversationEnd: '\\(._.)';
Increment: '(^-^)';
Double: '(^o^)';
Add: '(*-*)';
Decrement: '(;-;)';
Halve: '(;o;)';
Sub: '(._.)';
Reset: '(^~^)';
MoveToLeft: '(°-° )';
MoveToRight: '( °-°)';
MoveToRegister: '\\(^-^)/';
MoveToStack: '(>-<)';
CopyToLeftStack: '(° _° )';
Output: '(°o°)';
Input: '(o-o)';
IfPositive: '(?-?)';
Jump: '(+-+)';
Nop: '(-_-)';
Id
: '(' ~(' ' | '(' | ')')+ ')'
;
Skip
: [ \t\n\r] -> skip
;
Comment
: '#' ~('\n')* -> skip
; |
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1086.asm | ljhsiun2/medusa | 9 | 22617 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x113ae, %rsi
lea addresses_UC_ht+0xddae, %rdi
clflush (%rdi)
nop
nop
nop
xor %r13, %r13
mov $17, %rcx
rep movsq
xor %r13, %r13
lea addresses_UC_ht+0x1bbae, %r12
nop
nop
nop
nop
cmp $13500, %rbx
movups (%r12), %xmm7
vpextrq $0, %xmm7, %r8
sub %rcx, %rcx
lea addresses_normal_ht+0x12bae, %rsi
lea addresses_WT_ht+0xd1ae, %rdi
xor %rbx, %rbx
mov $123, %rcx
rep movsw
nop
nop
nop
add %r8, %r8
lea addresses_WC_ht+0x185ae, %rsi
lea addresses_UC_ht+0x4e22, %rdi
nop
nop
cmp %r13, %r13
mov $93, %rcx
rep movsl
sub $20287, %rdi
lea addresses_A_ht+0x789e, %rbx
nop
nop
nop
nop
nop
xor %r12, %r12
movl $0x61626364, (%rbx)
nop
nop
nop
inc %r13
lea addresses_D_ht+0x4eea, %r8
nop
nop
nop
nop
nop
sub $14361, %rdi
movl $0x61626364, (%r8)
nop
nop
nop
nop
add $16381, %rsi
lea addresses_UC_ht+0xb6ae, %rbx
nop
nop
cmp $31850, %r12
mov (%rbx), %esi
sub $7780, %r12
lea addresses_normal_ht+0x2fae, %r12
nop
nop
nop
xor $16684, %rcx
movups (%r12), %xmm3
vpextrq $0, %xmm3, %r13
nop
nop
nop
nop
add $61928, %rdi
lea addresses_A_ht+0x51ba, %rcx
nop
xor $61632, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0xfbae, %rsi
lea addresses_WT_ht+0x648e, %rdi
nop
nop
nop
nop
and %rbp, %rbp
mov $63, %rcx
rep movsq
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0x143ae, %rsi
lea addresses_D_ht+0x1aa2e, %rdi
nop
nop
nop
cmp $10462, %rbx
mov $10, %rcx
rep movsq
nop
nop
nop
sub %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %rcx
push %rdx
// Faulty Load
lea addresses_UC+0xf3ae, %rdx
nop
nop
nop
nop
xor $62032, %r8
movups (%rdx), %xmm4
vpextrq $0, %xmm4, %r13
lea oracles, %r8
and $0xff, %r13
shlq $12, %r13
mov (%r8,%r13,1), %r13
pop %rdx
pop %rcx
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
release/src/router/gmp/source/mpn/x86_64/pentium4/aors_n.asm | zhoutao0712/rtn11pb1 | 184 | 16076 | dnl x86-64 mpn_add_n/mpn_sub_n optimized for Pentium 4.
dnl Copyright 2007, 2008 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C K8,K9: 2.8
C K10: 2.8
C P4: 4
C P6-15: 3.6-5 (fluctuating)
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp', `%rdx')
define(`n', `%rcx')
define(`cy', `%r8')
ifdef(`OPERATION_add_n', `
define(ADDSUB, add)
define(func, mpn_add_n)
define(func_nc, mpn_add_nc)')
ifdef(`OPERATION_sub_n', `
define(ADDSUB, sub)
define(func, mpn_sub_n)
define(func_nc, mpn_sub_nc)')
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(func_nc)
jmp L(ent)
EPILOGUE()
PROLOGUE(func)
xor %r8, %r8
L(ent): push %rbx
push %r12
mov (vp), %r9
mov R32(n), R32(%rax)
and $3, R32(%rax)
jne L(n00) C n = 0, 4, 8, ...
mov R32(%r8), R32(%rbx)
mov (up), %r8
mov 8(up), %r10
ADDSUB %r9, %r8
mov 8(vp), %r9
setc R8(%rax)
lea -16(rp), rp
jmp L(L00)
L(n00): cmp $2, R32(%rax)
jnc L(n01) C n = 1, 5, 9, ...
mov (up), %r11
mov R32(%r8), R32(%rax)
xor R32(%rbx), R32(%rbx)
dec n
jnz L(gt1)
ADDSUB %r9, %r11
setc R8(%rbx)
ADDSUB %rax, %r11
adc $0, R32(%rbx)
mov %r11, (rp)
jmp L(ret)
L(gt1): mov 8(up), %r8
ADDSUB %r9, %r11
mov 8(vp), %r9
setc R8(%rbx)
lea -8(rp), rp
lea 8(up), up
lea 8(vp), vp
jmp L(L01)
L(n01): jne L(n10) C n = 2, 6, 10, ...
mov (up), %r12
mov R32(%r8), R32(%rbx)
mov 8(up), %r11
ADDSUB %r9, %r12
mov 8(vp), %r9
setc R8(%rax)
lea -32(rp), rp
lea 16(up), up
lea 16(vp), vp
jmp L(L10)
L(n10): mov (up), %r10 C n = 3, 7, 11, ...
mov R32(%r8), R32(%rax)
xor R32(%rbx), R32(%rbx)
mov 8(up), %r12
ADDSUB %r9, %r10
mov 8(vp), %r9
setc R8(%rbx)
lea -24(rp), rp
lea -8(up), up
lea -8(vp), vp
jmp L(L11)
L(c0): mov $1, R8(%rbx)
jmp L(rc0)
L(c1): mov $1, R8(%rax)
jmp L(rc1)
L(c2): mov $1, R8(%rbx)
jmp L(rc2)
L(c3): mov $1, R8(%rax)
jmp L(rc3)
ALIGN(16)
L(top): mov (up), %r8 C not on critical path
ADDSUB %r9, %r11 C not on critical path
mov (vp), %r9 C not on critical path
setc R8(%rbx) C save carry out
mov %r12, (rp)
L(L01): ADDSUB %rax, %r11 C apply previous carry out
jc L(c0) C jump if ripple
L(rc0): mov 8(up), %r10
ADDSUB %r9, %r8
mov 8(vp), %r9
setc R8(%rax)
mov %r11, 8(rp)
L(L00): ADDSUB %rbx, %r8
jc L(c1)
L(rc1): mov 16(up), %r12
ADDSUB %r9, %r10
mov 16(vp), %r9
setc R8(%rbx)
mov %r8, 16(rp)
L(L11): ADDSUB %rax, %r10
jc L(c2)
L(rc2): mov 24(up), %r11
ADDSUB %r9, %r12
lea 32(up), up
mov 24(vp), %r9
lea 32(vp), vp
setc R8(%rax)
mov %r10, 24(rp)
L(L10): ADDSUB %rbx, %r12
jc L(c3)
L(rc3): lea 32(rp), rp
sub $4, n
ja L(top)
L(end): ADDSUB %r9, %r11
setc R8(%rbx)
mov %r12, (rp)
ADDSUB %rax, %r11
jnc L(1)
mov $1, R8(%rbx)
L(1): mov %r11, 8(rp)
L(ret): mov R32(%rbx), R32(%rax)
pop %r12
pop %rbx
ret
EPILOGUE()
|
oeis/175/A175049.asm | neoneye/loda-programs | 11 | 21188 | <reponame>neoneye/loda-programs
; A175049: y-values in the solution to x^2-59*y^2=1.
; Submitted by <NAME>
; 0,69,73140,77528331,82179957720,87110677654869,92337236134203420,97877383191577970331,103749933845836514347440,109974831999203513630316069,116573218169221878611620685700,123567501284543192124804296525931,130981434788397614430413942696801160,138840197308200186753046654454312703669,147170478165257409560615023307628769087980,156000568014975545934065171659432040920555131,165360454925395913432699521343974655747019350880,175281926220351653263115558559441475659799591377669
mov $3,1
lpb $0
sub $0,$3
add $4,$2
mov $1,$4
mul $1,529
add $2,1
add $2,$1
add $4,$2
lpe
mov $0,$2
mul $0,69
|
agda-stdlib-0.9/src/Data/Unit/Core.agda | qwe2/try-agda | 1 | 11057 | <filename>agda-stdlib-0.9/src/Data/Unit/Core.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some unit types
------------------------------------------------------------------------
-- The definitions in this file are reexported by Data.Unit.
module Data.Unit.Core where
open import Level
------------------------------------------------------------------------
-- A unit type defined as a data-type
-- The ⊤ type (see Data.Unit) comes with η-equality, which is often
-- nice to have, but sometimes it is convenient to be able to stop
-- unfolding (see "Hidden types" below).
data Unit : Set where
unit : Unit
------------------------------------------------------------------------
-- Hidden types
-- "Hidden" values.
Hidden : ∀ {a} → Set a → Set a
Hidden A = Unit → A
-- The hide function can be used to hide function applications. Note
-- that the type-checker doesn't see that "hide f x" contains the
-- application "f x".
hide : ∀ {a b} {A : Set a} {B : A → Set b} →
((x : A) → B x) → ((x : A) → Hidden (B x))
hide f x unit = f x
-- Reveals a hidden value.
reveal : ∀ {a} {A : Set a} → Hidden A → A
reveal f = f unit
|
libsrc/video/hd44780/lcd_vpeek.asm | ahjelm/z88dk | 640 | 16752 |
SECTION code_driver
PUBLIC lcd_vpeek
PUBLIC _lcd_vpeek
PUBLIC asm_lcd_vpeek
EXTERN __console_x
EXTERN asm_lcd_get_vram_addr
lcd_vpeek:
_lcd_vpeek:
pop bc
pop hl
push hl
push bc
ld bc,(__console_x)
ld a,l
call asm_lcd_vpeek
ld l,a
ld h,0
ret
; Entry:
; a = character
; b = y
; c = x
asm_lcd_vpeek:
; First of all, put onto the VRAM map
call asm_lcd_get_vram_addr
ld a,(hl)
and a
ret
|
child_processes-platform.ads | annexi-strayline/AURA | 13 | 23176 | <reponame>annexi-strayline/AURA<filename>child_processes-platform.ads
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- This package contains all of the platform-specific abstractions
private with Interfaces.C;
private package Child_Processes.Platform is
type Process_ID is private;
type Stream_Handle is private;
procedure Create_Process (Image_Path : in String;
Arguments : in String;
Working_Directory: in String;
ID : out Process_ID;
Standard_Input : out Stream_Handle;
Standard_Output : out Stream_Handle;
Standard_Error : out Stream_Handle);
-- Creates the process and sets-up the IO streams. Before executing
-- the image, the newly created process' working directory is set to
-- Working_Directory.
--
-- Arguments should be of the standard command-line format, space-separated.
-- The binding will re-arrange these into the appriate repsentation as
-- required by the platform
--
-- Launch_Failure is raised in the if forking of a new process fails.
procedure Wait_Termination (ID : in Process_ID;
Exit_Code: out Exit_Status);
-- Waits indefinately for the created process to terminate. Exit_Code
-- is either set to Success or Failure
procedure Kill (ID: in Process_ID);
-- Sends SIGTERM to the process
procedure Nuke (ID: in Process_ID);
-- Sends SIGKILL to the process;
procedure Read_Buffer (Stream: in Stream_Handle;
Buffer: out Stream_Element_Array;
Last : out Stream_Element_Offset);
-- This operation never blocks
procedure Write_Buffer (Stream: in Stream_Handle;
Buffer: in Stream_Element_Array;
Last : out Stream_Element_Offset);
-- This operation never blocks
procedure Wait_Can_Read (Stream : in Stream_Handle;
Timeout : in Duration;
Timed_Out: out Boolean);
procedure Wait_Can_Write (Stream : in Stream_Handle;
Timeout : in Duration;
Timed_Out: out Boolean);
-- Blocks until the stream is able to read resp. write
-- If Timeout is 0, the timeout is indefinate.
--
-- Timed_Out is set to False iff a timeout occurs before the
-- stream is ready.
procedure Close_Stream (Handle: in Stream_Handle);
private
-- CRTL Types (x86_64 FreeBSD) --
-- These are all defined here rather than "as needed" (with the rest being
-- in the body) to make the body as platform-agnostic as possible. Only the
-- private part of this spec should be different between most unicies
use type Interfaces.Integer_64;
use type Interfaces.C.int;
use type Interfaces.C.long;
type id_t is new Interfaces.Integer_64;
type pid_t is new id_t;
type time_t is new Interfaces.Integer_64;
type suseconds_t is new Interfaces.C.long;
type timeval is
record
tv_sec : time_t;
tv_usec: suseconds_t;
end record;
type ssize_t is new Interfaces.Integer_64;
-- Ada types --
type Process_ID is new pid_t;
type Stream_Handle is new Interfaces.C.int;
-- (via manpages)
-- standard file descriptor
end Child_Processes.Platform;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt26.adb | best08618/asylo | 7 | 5624 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt26.adb
-- { dg-do run }
-- { dg-options "-gnato -O" }
with Interfaces; use Interfaces;
procedure Opt26 is
procedure Shift_Left_Bool
(Bool : in Boolean;
U8 : out Interfaces.Unsigned_8)
is
begin
U8 := Shift_Left (Boolean'Pos (Bool), 6);
end Shift_Left_Bool;
procedure Shift_Left_Not_Bool
(Bool : in Boolean;
U8 : out Interfaces.Unsigned_8)
is
begin
U8 := Shift_Left (Boolean'Pos (not Bool), 6);
end Shift_Left_Not_Bool;
Bool : constant Boolean := True;
Byte1, Byte2 : Interfaces.Unsigned_8;
begin
Shift_Left_Bool (Bool, Byte1);
Shift_Left_Not_Bool (Bool, Byte2);
if Byte1 + Byte2 /= 64 then
raise Program_Error;
end if;
end;
|
src/TwoPassMerge/PriorityProof.agda | jstolarek/dep-typed-wbl-heaps | 1 | 11234 | ----------------------------------------------------------------------
-- Copyright: 2013, <NAME>, Lodz University of Technology --
-- --
-- License: See LICENSE file in root of the repo --
-- Repo address: https://github.com/jstolarek/dep-typed-wbl-heaps --
-- --
-- Weight biased leftist heap that proves to maintain priority --
-- invariant: priority at the node is not lower than priorities of --
-- its two children. Uses a two-pass merging algorithm. --
----------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
module TwoPassMerge.PriorityProof where
open import Basics.Nat renaming (_≥_ to _≥ℕ_)
open import Basics
open import Sized
-- Priority invariant says that: for any node in the tree priority in
-- that node is higher than priority stored by its children. This
-- means that any path from root to leaf is ordered (highest priority
-- at the root, lowest at the leaf). This property allows us to
-- construct an efficient merging operation (see paper for more
-- details).
--
-- To prove this invariant we will index nodes using Priority. Index
-- of value n says that "this heap can store elements with priorities
-- n or lower" (remember that lower priority means larger Nat). In
-- other words Heap indexed with 0 can store any Priority, while Heap
-- indexed with 3 can store priorities 3, 4 and lower, but can't store
-- 0, 1 and 2.
--
-- As previously, Heap has two constructors:
--
-- 1) empty returns Heap n, where index n is not constrained in any
-- way. This means that empty heap can be given any restriction on
-- priorities of stored elements.
--
-- 2) node also creates Heap n, but this time n is constrained. If we
-- store priority p in a node then:
-- a) the resulting heap can only be restricted to store
-- priorities at least as high as p. For example, if we
-- create a node that stores priority 3 we cannot restrict
-- the resulting heap to store priorities 4 and lower,
-- because the fact that we store 3 in that node violates the
-- restriction. This restriction is expressed by the "p ≥ n"
-- parameter: if we can construct a value of type (p ≥ n)
-- then existance of such a value becomes a proof that p is
-- greater-equal to n. We must supply such proof to every
-- node.
-- b) children of a node can only be restricted to store
-- priorities that are not higher than p. Example: if we
-- restrict a node to store priorities 4 and lower we cannot
-- restrict its children to store priorities 3 and
-- higher. This restriction is expressed by index "p" in the
-- subheaps passed to node constructor.
data Heap : {i : Size} → Priority → Set where
empty : {i : Size} {n : Priority} → Heap {↑ i} n
node : {i : Size} {n : Priority} → (p : Priority) → Rank → p ≥ n →
Heap {i} p → Heap {i} p → Heap {↑ i} n
-- Let's demonstrate that priority invariant cannot be broken. Below
-- we construct a heap like this:
--
-- ?
-- / \
-- / \
-- E 0
--
-- where E means empty node and 0 means node storing Priority 0 (yes,
-- this heap violates the rank invariant!). We left out the root
-- element. The only value that can be supplied there is zero (try
-- giving one and see that typechecker will not accept it). This is
-- beacuse the value n with which 0 node can be index must obey the
-- restriction 0 ≥ n. This means that 0 node can only be indexed with
-- 0. When we try to construct ? node we are thus only allowed to
-- insert priority 0.
heap-broken : Heap zero
heap-broken = node {!!} (suc one) ge0 empty (node zero one ge0 empty empty)
-- Here is a correct heap. It stores one at the leaf and 0 at the
-- root. It still violates the rank invariant - we deal with that in
-- TwoPassMerge.RankProof.
heap-correct : Heap zero
heap-correct = node zero (suc one) ge0 empty (node one one ge0 empty empty)
-- Again, we need a function to extract rank from a node
rank : {b : Priority} → Heap b → Rank
rank empty = zero
rank (node _ r _ _ _) = r
-- The first question is how to create a singleton heap, ie. a Heap
-- storing one element. The question we need to answer is "what
-- Priorities can we later store in a singleton Heap?". "Any" seems to
-- be a reasonable answer. This means the resulting Heap will be
-- indexed with zero, meaning "Priorities lower or equal to zero can
-- be stored in this Heap" (remember that any priority is lower or
-- equal to zero). This leads us to following definition:
singleton : (p : Priority) → Heap zero
singleton p = node p one ge0 empty empty
-- We can imagine we would like to limit the range of priorities we
-- can insert into a singleton Heap. This means the resulting Heap
-- would be index with some b (the bound on allowed Priority
-- values). In such case however we are required to supply a proof
-- that p ≥ b. This would lead us to a definition like this:
--
-- singletonB : {b : Priority} → (p : Priority) → p ≥ b → Heap b
-- singletonB p p≥b = node p one p≥b empty empty
--
-- We'll return to that idea soon.
-- makeT now returns indexed heaps, so it requires one more parameter:
-- a proof that priorities stored in resulting heap are not lower than
-- in the subheaps.
makeT : {b : Nat} → (p : Priority) → p ≥ b → Heap p → Heap p → Heap b
makeT p p≥b l r with rank l ≥ℕ rank r
makeT p p≥b l r | true = node p (suc (rank l + rank r)) p≥b l r
makeT p p≥b l r | false = node p (suc (rank l + rank r)) p≥b r l
-- The important change in merge is that now we don't compare node
-- priorities using an operator that returns Bool. We compare them
-- using "order" function that not only returns result of comparison,
-- but also supplies a proof of the result. This proof tells us
-- something important about the relationship between p1, p2 and
-- priority bound of the merged Heap. Note that we use the new proof
-- to reconstruct one of the heaps that is passed in recursive call to
-- merge. We must do this because by comparing priorities p1 and p2 we
-- learned something new about restriction placed on priorities in one
-- of the heaps and we can now be more precise in expressing these
-- restrictions.
--
-- Note also that despite indexing our data types with Size the
-- termination checker complains that merge function does not
-- terminate. This is not a problem in our definitions but a bug in
-- Agda's implementation. I leave the code in this form in hope that
-- this bug will be fixed in a future release of Agda. For mor details
-- see http://code.google.com/p/agda/issues/detail?id=59#c23
merge : {i j : Size} {p : Nat} → Heap {i} p → Heap {j} p → Heap p
merge empty h2 = h2
merge h1 empty = h1
merge .{↑ i} .{↑ j}
(node {i} p1 l-rank p1≥p l1 r1)
(node {j} p2 r-rank p2≥p l2 r2)
with order p1 p2
merge .{↑ i} .{↑ j}
(node {i} p1 l-rank p1≥p l1 r1)
(node {j} p2 r-rank p2≥p l2 r2)
| le p1≤p2
= makeT p1 p1≥p l1 (merge {i} {↑ j} r1 (node p2 r-rank p1≤p2 l2 r2))
merge .{↑ i} .{↑ j}
(node {i} p1 l-rank p1≥p l1 r1)
(node {j} p2 r-rank p2≥p l2 r2)
| ge p1≥p2
= makeT p2 p2≥p l2 (merge {↑ i} {j} (node p1 l-rank p1≥p2 l1 r1) r2)
-- When writing indexed insert function we once again have to answer a
-- question of how to index input and output Heap. The easiest
-- solution is to be liberal: let us require that the input and output
-- Heap have no limitations on Priorities they can store. In other
-- words, let they be indexed by zero:
insert : Priority → Heap zero → Heap zero
insert p h = merge (singleton p) h
-- Now we can create an example heap. The only difference between this
-- heap and the heap without any proofs is that we need to explicitly
-- instantiate implicit Priority parameter of empty constructor.
heap : Heap zero
heap = insert (suc (suc zero))
(insert (suc zero)
(insert zero
(insert (suc (suc (suc zero))) (empty {n = zero}))))
-- But what if we want to insert into a heap that is not indexed with
-- 0? One solution is to be liberal and ``promote'' that heap so that
-- after insertion it can store elements with any priorities:
toZero : {b : Priority} → Heap b → Heap zero
toZero empty = empty
toZero (node p rank _ l r) = node p rank ge0 l r
insert0 : {b : Priority} → Priority → Heap b → Heap zero
insert0 p h = merge (singleton p) (toZero h)
-- But what if we actaully want to maintain bounds imposed on the heap
-- by its index? To achieve that we need a new singleton function that
-- constructs a singleton Heap with a bound equal to priority of a
-- single element stored by the heap. To construct a proof required by
-- node we use ≥sym, which proves that if p ≡ p then p ≥ p.
singletonB : (p : Priority) → Heap p
singletonB p = node p one (≥sym refl) empty empty
-- We can now write new insert function that uses singletonB function:
insertB : (p : Priority) → Heap p → Heap p
insertB p h = merge (singletonB p) h
-- However, that function is pretty much useless - it can insert
-- element with priority p only to a heap that has p as its bound. In
-- other words if we have Heap zero - ie. a heap that can store any
-- possible priority -- the only thing that we can insert into it
-- using insertB function is zero. That's clearly not what we want. We
-- need a way to manipulate resulting priority bound.
-- Let's try again. This time we will write functions with signatures:
--
-- singletonB' : {b : Priority} → (p : Priority) → p ≥ b → Heap b
-- insertB' : {b : Priority} → (p : Priority) → p ≥ b → Heap p → Heap b
--
-- Singleton allows to construct Heap containing priority p but
-- bounded by b. This of course requires proof that p ≥ b, ie. that
-- priority p can actually be stored in Heap b. insertB' is similar -
-- it can insert element of priority p into Heap bounded by p but the
-- resulting Heap can be bounded by b (provided that p ≥ b, for which
-- we must supply evidence). Let's implement that.
-- Implementing singletonB' is straightforward:
singletonB' : {b : Priority} → (p : Priority) → p ≥ b → Heap b
singletonB' p p≥b = node p one p≥b empty empty
-- To implement insertB' we need two additional functions. Firstly, we
-- need a proof of transitivity of ≥. We proceed by induction on
-- c. Our base case is:
--
-- a ≥ b ∧ b ≥ 0 ⇒ a ≥ 0
--
-- In other words if c is 0 then ge0 proves the property. If c is not
-- zero, then b is also not zero (by definitions of data constructors
-- of ≥) and hence a is also not zero. This gives us second equation
-- that is a recursive proof on ≥trans.
≥trans : {a b c : Nat} → a ≥ b → b ≥ c → a ≥ c
≥trans a≥b ge0 = ge0
≥trans (geS a≥b) (geS b≥c) = geS (≥trans a≥b b≥c)
-- Having proved the transitivity of ≥ we can construct a function
-- that loosens the bound we put on a heap. If we have a heap with a
-- bound p - meaning that all priorities in a heap are guaranteed to
-- be lower than or equal to p - and we also have evidence than n is a
-- priority higher than p then we can change the restriction on the
-- heap so that it accepts higher priorites. For example if we have
-- Heap 5, ie. all elements in the heap are 5 or greater, and we have
-- evidence that 5 ≥ 3, then we can convert Heap 5 to Heap 3. Note how
-- we are prevented from writing wrong code: if we have Heap 3 we
-- cannot convert it to Heap 5. This is not possible from theoretical
-- point of view: Heap 3 may contain 4, but Heap 5 is expected to
-- contain elements not smaller than 5. It is also not possible
-- practically: thanks to our definition of ≥ we can't orivide
-- evidence that 3 ≥ 5 because we cannot construct value of that type.
liftBound : {p b : Priority} → b ≥ p → Heap b → Heap p
liftBound b≥n empty = empty
liftBound b≥n (node p rank p≥b l r)
= node p rank (≥trans p≥b b≥n) l r
-- With singletonB and liftBound we can construct insert function that
-- allows to insert element with priority p into a Heap bound by b,
-- but only if we can supply evidence that p ≥ b, ie. that p can
-- actually be stored in the heap.
insertB' : {b : Priority} → (p : Priority) → p ≥ b → Heap p → Heap b
insertB' p p≥b h = merge (singletonB' p p≥b) (liftBound p≥b h)
-- But if we try to create an example Heap as we did previously we
-- quickly discover that this function isn't of much use either:
heap' : Heap zero
heap' = insertB' (suc (suc zero)) {!!}
(insertB' (suc zero) {!!}
(insertB' zero {!!}
(insertB' (suc (suc (suc zero))) {!!} (empty))))
-- In third hole we are required to supply evidence that 0 ≥ 1 and
-- that is not possible. The reason is that our insertB' function
-- allows us only to insert elements into a heap in decreasing order:
heap'' : Heap zero
heap'' = insertB' zero ge0
(insertB' (suc zero) ge0
(insertB' (suc (suc zero)) (geS ge0)
(insertB' (suc (suc (suc zero))) (geS (geS ge0)) (empty))))
-- This is a direct consequence of our requirement that priority of
-- element being inserted and bound on the Heap we insert into match.
-- Again, findMin and deletMin are incomplete
findMin : {b : Priority} → Heap b → Priority
findMin empty = {!!}
findMin (node p _ _ _ _) = p
-- deleteMin requires a bit more work than previously. First, notice
-- that the bound placed on the input and output heaps is the
-- same. This happens because relation between priorities in a node
-- and it's children is ≥, not > (ie. equality is allowed). We cannot
-- therefore guearantee that bound on priority will increase after
-- removing highest-priority element from the Heap. When we merge
-- left and right subtrees we need to lift their bounds so they are
-- now both b (not p).
deleteMin : {b : Priority} → Heap b → Heap b
deleteMin empty = {!!}
deleteMin (node p rank p≥b l r) = merge (liftBound p≥b l) (liftBound p≥b r)
|
README/DependentlyTyped/Extensional-type-theory.agda | nad/dependently-typed-syntax | 5 | 6788 | <gh_stars>1-10
------------------------------------------------------------------------
-- If the "Outrageous but Meaningful Coincidences" approach is used to
-- formalise a language, then you can end up with an extensional type
-- theory (with equality reflection)
------------------------------------------------------------------------
module README.DependentlyTyped.Extensional-type-theory where
import Axiom.Extensionality.Propositional as E
open import Data.Empty
open import Data.Product renaming (curry to c)
open import Data.Unit
open import Data.Universe.Indexed
import deBruijn.Context
open import Function hiding (_∋_) renaming (const to k)
import Level
import Relation.Binary.PropositionalEquality as P
------------------------------------------------------------------------
-- A non-indexed universe
mutual
data U : Set where
empty : U
π : (a : U) (b : El a → U) → U
El : U → Set
El empty = ⊥
El (π a b) = (x : El a) → El (b x)
Uni : IndexedUniverse _ _ _
Uni = record { I = ⊤; U = λ _ → U; El = El }
------------------------------------------------------------------------
-- Contexts and variables
-- We get these for free.
open deBruijn.Context Uni public
renaming (_·_ to _⊙_; ·-cong to ⊙-cong)
-- Some abbreviations.
⟨empty⟩ : ∀ {Γ} → Type Γ
⟨empty⟩ = -, λ _ → empty
⟨π⟩ : ∀ {Γ} (σ : Type Γ) → Type (Γ ▻ σ) → Type Γ
⟨π⟩ σ τ = -, k π ˢ indexed-type σ ˢ c (indexed-type τ)
⟨π̂⟩ : ∀ {Γ} (σ : Type Γ) →
((γ : Env Γ) → El (indexed-type σ γ) → U) → Type Γ
⟨π̂⟩ σ τ = -, k π ˢ indexed-type σ ˢ τ
------------------------------------------------------------------------
-- Well-typed terms
mutual
infixl 9 _·_
infix 3 _⊢_
-- Terms.
data _⊢_ (Γ : Ctxt) : Type Γ → Set where
var : ∀ {σ} (x : Γ ∋ σ) → Γ ⊢ σ
ƛ : ∀ {σ τ} (t : Γ ▻ σ ⊢ τ) → Γ ⊢ ⟨π⟩ σ τ
_·_ : ∀ {σ τ} (t₁ : Γ ⊢ ⟨π̂⟩ σ τ) (t₂ : Γ ⊢ σ) → Γ ⊢ (-, τ ˢ ⟦ t₂ ⟧)
-- Semantics of terms.
⟦_⟧ : ∀ {Γ σ} → Γ ⊢ σ → Value Γ σ
⟦ var x ⟧ γ = lookup x γ
⟦ ƛ t ⟧ γ = λ v → ⟦ t ⟧ (γ , v)
⟦ t₁ · t₂ ⟧ γ = (⟦ t₁ ⟧ γ) (⟦ t₂ ⟧ γ)
------------------------------------------------------------------------
-- We can define looping terms (assuming extensionality)
module Looping (ext : E.Extensionality Level.zero Level.zero) where
-- The casts are examples of the use of equality reflection: the
-- casts are meta-language constructions, not object-language
-- constructions.
cast₁ : ∀ {Γ} →
Γ ▻ ⟨empty⟩ ⊢ ⟨π⟩ ⟨empty⟩ ⟨empty⟩ → Γ ▻ ⟨empty⟩ ⊢ ⟨empty⟩
cast₁ t = P.subst (_⊢_ _) (P.cong (_,_ tt) (ext (⊥-elim ∘ proj₂))) t
cast₂ : ∀ {Γ} →
Γ ▻ ⟨empty⟩ ⊢ ⟨empty⟩ → Γ ▻ ⟨empty⟩ ⊢ ⟨π⟩ ⟨empty⟩ ⟨empty⟩
cast₂ t = P.subst (_⊢_ _) (P.cong (_,_ tt) (ext (⊥-elim ∘ proj₂))) t
ω : ε ▻ ⟨empty⟩ ⊢ ⟨empty⟩
ω = cast₁ (ƛ (cast₂ (var zero) · var zero))
-- A simple example of a term which does not have a normal form.
Ω : ε ▻ ⟨empty⟩ ⊢ ⟨empty⟩
Ω = cast₂ ω · ω
const-Ω : ε ⊢ ⟨π⟩ ⟨empty⟩ ⟨empty⟩
const-Ω = ƛ Ω
-- Some observations:
--
-- * The language with spines (in README.DependentlyTyped.Term) does
-- not support terms like the ones above; in the casts one would
-- have to prove that distinct spines are equal.
--
-- * The spines ensure that the normaliser in
-- README.DependentlyTyped.NBE terminates. The existence of terms
-- like Ω implies that it is impossible to implement a normaliser
-- for the spine-less language defined in this module.
|
bb-runtimes/examples/e500v2/info.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 5891 | ------------------------------------------------------------------------------
-- --
-- BAREBOARD EXAMPLE --
-- --
-- Copyright (C) 2011, AdaCore --
------------------------------------------------------------------------------
with Ada.Text_Io; use Ada.Text_Io;
with Interfaces; use Interfaces;
with System.Machine_Code; use System.Machine_Code;
procedure Info is
Hex_Digits : array (0 .. 15) of Character := "0123456789abcdef";
subtype String8 is String (1 .. 8);
subtype String4 is String (1 .. 4);
function Image8 (V : Unsigned_32) return String8 is
Res : String8;
begin
for I in Res'Range loop
Res (I) := Hex_Digits (Natural (Shift_Right (V, 4 * (8 - I)) and 15));
end loop;
return Res;
end Image8;
function Image4 (V : Unsigned_32) return String4 is
Res : String4;
begin
for I in Res'Range loop
Res (I) := Hex_Digits (Natural (Shift_Right (V, 4 * (4 - I)) and 15));
end loop;
return Res;
end Image4;
function Image1 (V : Unsigned_32) return Character is
begin
return Hex_Digits (Natural (V and 15));
end Image1;
generic
Spr : Natural;
function Get_Spr return Unsigned_32;
function Get_Spr return Unsigned_32 is
Res : Unsigned_32;
begin
Asm ("mfspr %0,%1",
Inputs => Natural'Asm_Input ("K", Spr),
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Spr;
generic
Spr : Natural;
procedure Set_Spr (V : Unsigned_32);
procedure Set_Spr (V : Unsigned_32) is
begin
Asm ("mtspr %0,%1",
Inputs => (Natural'Asm_Input ("K", Spr),
Unsigned_32'Asm_Input ("r", V)));
end Set_Spr;
function Get_Pir is new Get_Spr (286);
function Get_Pvr is new Get_Spr (287);
function Get_Svr is new Get_Spr (1023);
function Get_Mmucfg is new Get_Spr (1015);
function Get_Pid0 is new Get_Spr (48);
function Get_Pid1 is new Get_Spr (633);
function Get_Pid2 is new Get_Spr (634);
function Get_Tlb0cfg is new Get_Spr (688);
function Get_Tlb1cfg is new Get_Spr (689);
procedure Set_Mas0 is new Set_Spr (624);
function Get_Mas1 is new Get_Spr (625);
function Get_Mas2 is new Get_Spr (626);
function Get_Mas3 is new Get_Spr (627);
function Field (V : Unsigned_32; F, L : Natural) return Unsigned_32 is
begin
return Shift_Right (V, 63 - L)
and Shift_Right (16#ffff_ffff#, 32 - (L - F + 1));
end Field;
procedure Put_Bit (V : Unsigned_32; F : Natural; Name : Character) is
begin
if Field (V, F, F) = 1 then
Put (Name);
else
Put ('-');
end if;
end Put_Bit;
procedure Os_Exit;
pragma Import (C, Os_Exit, "exit");
Val : Unsigned_32;
Npids : Unsigned_32;
Ntlbs : Unsigned_32;
Nent : Unsigned_32;
begin
Put_Line ("PIR: " & Image8 (Get_Pir));
Put_Line ("PVR: " & Image8 (Get_Pvr));
Put_Line ("SVR: " & Image8 (Get_Svr));
Val := Get_Mmucfg;
Put_Line ("MMUCFG: " & Image8 (Val));
Npids := Field (Val, 49, 52);
Ntlbs := 1 + Field (Val, 60, 61);
Put ("NPIDS: " & Image8 (Npids));
Put (", PIDSIZE: " & Image8 (1 + Field (Val, 53, 57)));
Put (", NTLBS: " & Image8 (Ntlbs));
Put (", MAVN: " & Image8 (1 + Field (Val, 62, 63)));
New_Line;
Put ("PID0: " & Image8 (Get_Pid0));
if Npids > 1 then
Put (", PID1: " & Image8 (Get_Pid1));
if Npids > 2 then
Put (", PID2: " & Image8 (Get_Pid2));
end if;
end if;
New_Line;
for I in 0 .. Ntlbs - 1 loop
case I is
when 0 => Val := Get_Tlb0cfg;
when 1 => Val := Get_Tlb1cfg;
when others => exit;
end case;
Put_Line ("TLB" & Character'Val (48 + I) & "CFG: " & Image8 (Val));
Put (" Assoc: " & Image4 (Field (Val, 32, 39)));
Put (", MinSz: " & Image1 (Field (Val, 40, 43)));
Put (", MaxSz: " & Image1 (Field (Val, 44, 47)));
Put (", Iprot: " & Image1 (Field (Val, 48, 48)));
Put (", Avail: " & Image1 (Field (Val, 49, 49)));
Put (", Nentry: " & Image4 (Field (Val, 52, 63)));
New_Line;
end loop;
New_Line;
Put_Line ("TLB1:");
Val := Get_Tlb1cfg;
Nent := Field (Val, 52, 63);
Put_Line (" #: P Pid S VA Flags PA U USUSUS");
for I in 0 .. Nent - 1 loop
Set_Mas0 (2 ** 28 + I * 2 ** 16);
Asm ("tlbre", Volatile => True);
Val := Get_Mas1;
if Field (Val, 32, 32) = 1 then
declare
Sz : Unsigned_32;
Mask : Unsigned_32;
begin
-- Valid
Put (Image4 (I) & ": ");
Put_Bit (Val, 33, 'P');
Put (' ');
Put (Image4 (Field (Val, 34, 47)));
Put (' ');
Put (Image1 (Field (Val, 51, 51)));
Put (' ');
Sz := Field (Val, 52, 55);
Mask := Shift_Right (16#ffff_ffff#, Natural (32 - (10 + 2 * Sz)));
Val := Get_Mas2;
Put (Image8 (Val and not Mask));
Put ('-');
Put (Image8 (Val or Mask));
Put (' ');
Put (Image1 (Field (Val, 56, 57)));
Put_Bit (Val, 58, 'V');
Put_Bit (Val, 59, 'W');
Put_Bit (Val, 60, 'I');
Put_Bit (Val, 61, 'M');
Put_Bit (Val, 62, 'G');
Put_Bit (Val, 63, 'E');
Put (' ');
Val := Get_Mas3;
Put (Image8 (Val and not Mask));
Put (' ');
Put (Image1 (Field (Val, 54, 57)));
Put (' ');
Put_Bit (Val, 58, 'x');
Put_Bit (Val, 59, 'X');
Put_Bit (Val, 60, 'w');
Put_Bit (Val, 61, 'W');
Put_Bit (Val, 62, 'r');
Put_Bit (Val, 63, 'R');
New_Line;
end;
end if;
end loop;
New_Line;
Os_Exit;
end Info;
|
archive/agda-3/src/Oscar/Class/Setoid.agda | m0davis/oscar | 0 | 7298 |
open import Oscar.Prelude
open import Oscar.Class.IsEquivalence
module Oscar.Class.Setoid where
record Setoid 𝔬 ℓ : Ø ↑̂ (𝔬 ∙̂ ℓ) where
constructor ∁
field
{Object} : Ø 𝔬
ObjectEquivalence : Object → Object → Ø ℓ
⦃ `IsEquivalence ⦄ : IsEquivalence ObjectEquivalence
|
STM32F4/ToyOBDH/ground_station/shared/src/ttc_data.ads | AntonioRamosNieto/TFG-STM32F429 | 0 | 20780 | <filename>STM32F4/ToyOBDH/ground_station/shared/src/ttc_data.ads
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, Universidad Politécnica de Madrid --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
-- --
------------------------------------------------------------------------------
-- Data types for the TTC subsystem.
with HK_Data; use HK_Data;
package TTC_Data is
-- Telemeetry
type TM_Type is (Basic, Housekeeping, Error);
-- Basic TM contais the last sensor data
-- Housekeeping TM contains an array with a log of recent sensor data
type TM_Message (Kind : TM_Type) is
record
Timestamp : Mission_Time;
case Kind is
when Basic =>
Data : Sensor_Data;
when Housekeeping =>
Data_Log : HK_Log;
when Error =>
null;
end case;
end record;
-- Telecommand
type TC_Type is (HK);
-- HK TC requests a housekeeping TM to be sent to ground
type TC_Message(Kind : TC_Type) is
record
Timestamp : Mission_Time;
end record;
end TTC_Data;
|
Appl/Calendar/Repeat/repeatTable.asm | steakknife/pcgeos | 504 | 160081 | <reponame>steakknife/pcgeos<gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Calendar/Repeat
FILE: repeatTable.asm
AUTHOR: <NAME>, Dec 20, 1989
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/20/89 Initial revision
DESCRIPTION:
Maintain the YearRepeat tables, which store all the
occurrences of every repeat event for that year.
$Id: repeatTable.asm,v 1.1 97/04/04 14:48:52 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CommonCode segment resource
OVERFLOW = 0x0001 ; overflow mask
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetMonthMapRepeats
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Returns the MonthMap for Repeat Events for the specified month
CALLED BY: DatabaseGetMonthMap
PASS: ES = DGroup
BP = Year
DH = Month
RETURN: CX:DX = MonthMap
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 5/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetMonthMapRepeats proc near
uses ax, bx, si, ds, es
.enter
; Get the YearMap, and call to create the month map
;
segmov ds, es, ax ; DGroup => DS
call GenerateRepeat ; generate events for this year
mov bx, ds:[tableHandle] ; table handle => BX
mov si, ds:[tableChunk] ; table chunk => SI
call MemLock ; lock the block
mov es, ax ; RepeatMap => ES:*SI
mov si, es:[si] ; dereference the chunk handle
call CreateMonthMap ; MonthMap => CX:DX
call MemUnlock ; unlock the block
.leave
ret
GetMonthMapRepeats endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetRangeOfRepeats
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get repeat events for the given range
CALLED BY: GLOBAL
PASS: SS:BP = EventRangeStruct
DS = Relocatable segment, DS:0 = block handle
ES = DGroup
RETURN: Carry = Set if aborted
= Clear if not
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/20/89 Initial version
Don 4/8/90 Changed to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetRangeOfRepeats proc far
uses ax, bx, cx, dx, si, di
.enter
; Some set-up work
;
push ds:[LMBH_handle] ; save the block handle
segmov ds, es ; DGroup to DS
mov bx, bp ; EventRangeStruct to BX
mov bp, ss:[bx].ERS_startYear ; get the desired year
EC < cmp bp, ss:[bx].ERS_endYear ; same year >
EC < ERROR_NZ REPEAT_GET_EVENTS_DIFFERENT_YEARS >
call GenerateRepeat ; generate the events
mov bp, bx ; EventRangeStruct back to BP
; Now set up to send Repeat Events to the DayPlan
;
mov bx, ds:[tableHandle] ; table handle => BX
mov si, ds:[tableChunk] ; table chunk => DI
call MemLock ; lock the block
mov es, ax ; ES:*DI is the RepeatTable
mov dx, {word} ss:[bp].ERS_endDay
call DateToTablePos
push bx ; save the last offset
mov dx, {word} ss:[bp].ERS_startDay
call DateToTablePos ; first position => BX
pop dx ; lastr offset => DX
jmp midLoop ; start looping
; Now loop through the table
;
tableLoop:
mov cx, es:[di] ; get value of position
EC < tst cx ; any ID or handle ?? >
EC < ERROR_Z GET_RANGE_OF_REPEATS_BAD_MAP_ITEM >
test cx, OVERFLOW ; OVERFLOW bit set ?
je notOverflow ; no - easy case
and cx, (not OVERFLOW) ; clear the OVERFLOW bit
call GetOverflowEvents ; load all these events
jmp next
notOverflow:
call RepeatLoadEvent ; load the event into the DP
; Find the next entry by scanning, unless curtailed by carry set
;
next:
jc done ; if carry set, abort
add bx, 2 ; go to the next entry
midLoop:
clr ax ; comparison value => AX
mov di, es:[si] ; dereference the table handle
mov cx, YearMapSize ; raw size of the table
add di, bx ; go to current offset
sub cx, bx ; bytes left in table = CX
shr cx ; want it in words!
repz scasw ; look for non-zero value
jz calcOffset ; if over array, don't back up
sub di, 2 ; account for overscan
calcOffset:
mov bx, di ; memory offset => BX
sub bx, es:[si] ; table offset => BX
cmp bx, dx ; else check past bounds
jle tableLoop ; within bounds - continue
; Clean up (carry flag must be preserved)
done:
pushf ; save the carry flag
cmp bx, ss:[bp].ERS_nextOffset ; compare with existing offset
jge postDone ; if not sooner, do nothing
mov ss:[bp].ERS_nextOffset, bx ; store the next offset
postDone:
mov bx, es:[LMBH_handle] ; block handle => BX
call MemUnlock ; unlock the block
segmov es, ds ; DGroup back to DS
popf ; restore the carry flag
pop bx ; restore the block handle
call MemDerefDS ; restore segment to DS
.leave
ret
GetRangeOfRepeats endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetOverflowEvents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cause all RepeatEvents in the Overflow table to be loaded
CALLED BY: GetRangeOfRepeats
PASS: ES:*CX = Overflow table
BX = Table offset
SS:BP = EventRangeStruct
RETURN: Carry = Set if aborted
= Clear if not
DESTROYED: CX, DI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/20/89 Initial version
Don 7/13/90 Change register usage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetOverflowEvents proc near
uses ax, si
.enter
; Loop through the events
;
mov di, cx ; item to DI
mov si, es:[di] ; dereference the handle
mov ax, es:[si] ; store the size in AX
clr si ; initalize the counter
loadLoop:
add si, 2 ; go to next entry
cmp si, ax ; check the size
je done
EC < ERROR_G REPEAT_GET_OVERFLOW_BAD_OFFSET >
add si, es:[di] ; SI now holds absolute address
mov cx, es:[si] ; obtain the RepeatID
sub si, es:[di] ; SI now holds offset
tst cx ; is the overflow zero ??
jz loadLoop ; jump if zero
call RepeatLoadEvent ; else load the repeat event
jnc loadLoop ; if carry clear, continue
done:
.leave
ret
GetOverflowEvents endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenerateRepeat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate all the repeating events for a year
CALLED BY: GLOBAL
PASS: BP = Year of generation
DS = DGroup
RETURN: Nothing
DESTROYED: ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/20/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenerateRepeat proc far
uses ax, bx, cx, dx, di, si
.enter
; Some set-up work
;
call EnterRepeat ; enter the repeat routines
jnc exit ; if clear, events already gen
mov ax, ds:[repeatMapGroup]
mov di, ds:[repeatMapItem]
call GP_DBLockDerefSI ; lock the RepeatMap
mov cx, es:[si].RMH_size ; get the size of the table
mov bx, (size RepeatMapHeader) - (size RepeatMapStruct)
jmp next
; Now loop through all of the RepeatEvents
;
genLoop:
mov dx, es:[si][bx].RMS_item ; get the Repeat item #
tst dx ; a non-event ??
je next
call GenerateParse ; parse it, dude
mov si, es:[di] ; dereference the handle
next:
add bx, size RepeatMapStruct ; go to the next RepeatEvent
cmp bx, cx
jl genLoop ; continue until through table
call DBUnlock ; unlock the block
exit:
.leave
ret
GenerateRepeat endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CreateRepeatYearTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a year table
CALLED BY: EnterRepeat
PASS: Nothing
RETURN: CX:DX = RepeatTable OD
DESTROYED: ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/20/89 Initial version
Don 4/6/90 Changed to LMem allocation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CreateRepeatYearTable proc near
uses ax, bx, ds
.enter
; Allocate the LMem block
;
mov ax, YearMapSize+50 ; bytes to allocate
mov cl, mask HF_SWAPABLE
mov ch, mask HAF_LOCK or mask HAF_NO_ERR
call MemAlloc ; allocate the memory
mov ds, ax ; segment => DS
call RepeatInitTable ; initalize a table
.leave
ret
CreateRepeatYearTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ClearRepeatYearTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clear the RepeatTable
CALLED BY: GLOBAL
PASS: CX:DX = RepeatTable OD
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/20/89 Initial version
Don 4/6/90 Changed to LMem stuff
sean 2/7/96 Got rid of code to DerefES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ClearRepeatYearTable proc near
uses ax, bx, ds
.enter
; Basically, just restart the heap
;
mov bx, cx ; handle => BX
call MemLock ; lock the block
mov ds, ax
call RepeatInitTable ; re-initialize the table
.leave
ret
ClearRepeatYearTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RepeatInitTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create an LMem heap and allocate an empty table chunk
CALLED BY: CreateRepeatYearTable, ClearRepeatYearTable
PASS: DS = Segment of locked LMem block
BX = LMem block handle
RETURN: CX:DX = RepeatTable OD
DESTROYED: AX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/7/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RepeatInitTable proc near
uses bp, di, si
.enter
; Initalize the heap
;
mov ax, LMEM_TYPE_GENERAL ; a general type of heap
mov cx, 10 ; allocate ten handles
mov dx, size LMemBlockHeader ; offset at which to begin heap
mov si, YearMapSize + 30 ; initial heap size in bytes
clr bp ; allocate end of block
clr di ; LocalMemoryFlags
call LMemInitHeap ; initialize the heap
; Now allocate the actual table item
;
mov cx, YearMapSize ; bytes to allocate
call LMemAlloc ; allocate the table
mov dx, ax ; table chunk => DX
; Now initialize the table
;
mov si, ax
segmov es, ds, ax ; ES:*SI is the table
mov si, es:[si] ; dereference the handle
call ClearSomeBytes ; clear those bytes
call MemUnlock ; unlock the table block
mov cx, bx ; table handle => CX
.leave
ret
RepeatInitTable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenerateAddEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add an event to the RepeatTable
CALLED BY: Generate - GLOBAL
PASS: DS = DGroup
ES:*DI = RepeatStruct
DH = Month
DL = Day
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
Keep a table of words, 384 = 12 months by 32 word each
If just one repeat event, word value is Repeat ID with the
low bit is set.
Else value is an item #, containing a list of repeat events
for that day. Format for the list:
1st word: Size of list (in bytes)
2nd word: 1st Repeat ID
3rd word: 2nd Repeat ID
...
A value of zero in either the table or list indicates no
Repeat ID Present.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/20/89 Initial version
Don 4/7/90 Update to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _REPEAT_DATE_EXCEPTIONS
GenerateAddEventFar proc far
call GenerateAddEvent
ret
GenerateAddEventFar endp
endif
GenerateAddEvent proc near
uses ax, bx, cx, dx, bp, si, di
.enter
; Now add (or delete) the sucker
;
push es:[LMBH_handle] ; save this handle
push ds ; save DGroup
mov bx, ds:[tableHandle] ; table handle => BX
call MemLock ; lock the table
call DateToTablePos ; calc table position => BX
mov si, es:[di] ; dereference the handle
mov dx, es:[si].RES_ID ; get the ID
mov es, ax ; setup this segment
mov di, ds:[tableChunk] ; chunk handle => DI
mov si, ds:[repeatGenProc] ; generate routine => SI
mov ds, ax ; setup this segment also
call si ; call either AddNewEvent
; ...or RemoveEvent
; We're done
;
mov bx, ds:[LMBH_handle] ; block handle => BX
call MemUnlock ; unlock the block
pop ds ; restore the DGroup segment
pop bx ; restore the LMem handle
call MemDerefES ; and dereference it
.leave
ret
GenerateAddEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AddNewEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adds the event to the bleeping table
CALLED BY: GenerateAddEvent
PASS: DS:*DI = RepeatTable
ES:*DI = RepeatTable
BX = Offset
DX = Repeat ID
RETURN: Nothing
DESTROYED: BX, CX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/20/89 Initial version
Don 4/7/90 Update to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AddNewEvent proc near
; Determine how to add the event
;
mov si, ds:[di] ; dereference the handle
add si, bx ; go to correct entry
test {word} ds:[si], 0xffff ; an empty event ??
je Easy ; 1st event - jump
test {word} ds:[si], OVERFLOW ; check the low bit
jne Overflow
; Must add a new overflow event
;
push dx ; save the RepeatID
push ds:[si] ; save the old Repeat ID
mov bp, di ; move the RepeatTable chunk
mov cx, 10 ; initial size
call LMemAlloc ; allocate another chunk
mov si, ds:[bp] ; dereference the handle
add si, bx ; go to the correct entry
mov ds:[si], ax ; store the item #
or {word} ds:[si], OVERFLOW ; set the OVERFLOW bit
; Initialize the overflow block
;
mov di, ax ; chunk handle => DI
mov si, ds:[di] ; dereference the handle
call ClearSomeBytes
mov {word} ds:[si], 10 ; its size
pop ds:[si]+2 ; restore the old RepeatID
pop ds:[si]+4 ; restore the new RepeatID
ret
; A normal overflow event
;
Overflow:
push di ; save the chunk handle
mov di, ds:[si] ; get the item #
and di, not OVERFLOW ; clear the overflow bit
call AddOverflowEvent ; add the event
pop di ; restore the chunk handle
ret
; The first event - easy
;
Easy:
mov es:[si], dx ; store that value
ret
AddNewEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AddOverflowEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add a Repeat ID to the overflow list
CALLED BY: AddNewEvent
PASS: DS:*DI = Overflow table chunk
ES:*DI = Overflow table chunk
DX = Repeat ID to add
RETURN: Nothing
DESTROYED: AX, BX, CX, DI, SI, BP, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/30/89 Initial version
Don 4/7/90 Update to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AddOverflowEvent proc near
; Find an empty space
;
mov bp, di ; chunk handle => BP
mov di, es:[di] ; ES:DI is the overflow table
clr ax ; initialize the count
mov cx, es:[di] ; chunk size => CX
shr cx, 1 ; turn into words
repne scasw ; look for a zero
jnz addSpace ; if done, add space to chunk
mov es:[di-2], dx ; store the RepeatID
ret
; Add some open space
;
addSpace:
mov di, es:[bp] ; ES:DI is the overflow table
mov bx, es:[di] ; old table size => BX
mov cx, bx
add cx, 10 ; increase the size
mov ax, bp ; chunk handle => AX
call LMemReAlloc ; re-allocate the chunk
mov si, es:[bp] ; dererference the handle
mov es:[si], cx ; store the new size
mov cx, 10 ; bytes to zero out
add si, bx ; start of new mem to SI
call ClearSomeBytes
mov es:[si], dx ; store the RepeatID
.leave
ret
AddOverflowEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RemoveEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove the event from the bleeping table
CALLED BY: GenerateAddEvent
PASS: ES:*DI = RepeatTable chunk
DS:*DI = RepeatTable chunk
BX = Offset
DX = Repeat ID
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, BP, DI, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/20/89 Initial version
Don 4/7/90 Update to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RemoveEvent proc near
; Determine how to delete the event
;
mov si, es:[di] ; dereference the handle
add si, bx ; go to correct entry
test {word} es:[si], OVERFLOW ; check the low bit
je easy ; jump if bit not set!
; An overflow event
;
push di
mov di, es:[si] ; get the item #
and di, not OVERFLOW ; clear the overflow bit
call RemoveOverflowEvent ; add the event
pop di
jnc done ; jump if overflow still exists
mov si, es:[di] ; dereference the handle
mov {word} es:[si][bx], 0 ; clear the overflow table
done:
ret
; The first event - easy. When we have repeat date exceptions,
; we can no longer assume that every day in the range of a
; particular repeating event holds that repeat ID, so we
; have no easy way of performing this sanity check (well, we
; could compare today against any of the repeat date
; exceptions, but we're lazy) - Don 2/13/96
easy:
if not _REPEAT_DATE_EXCEPTIONS
EC < cmp dx, es:[si] ; check the word >
EC < ERROR_NZ REMOVE_EVENT_REPEAT_ID_NOT_FOUND >
endif
mov {word} es:[si], 0 ; clear the value
ret
RemoveEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RemoveOverflowEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a Repeat ID to the overflow list
CALLED BY: RemoveEvent
PASS: ES:*DI = Overflow table
DS:*DI = Overflow table
DX = Repeat ID to remove
RETURN: Carry = Set if overflow table is removed
DESTROYED: DX, BP, DI, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/30/89 Initial version
Don 4/7/90 Update to use LMem stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RemoveOverflowEvent proc near
; Find the repeat ID
;
mov bp, di ; chunk handle => BP
mov di, es:[di] ; derefernce the handle
mov ax, dx ; Repeat ID => AX
mov cx, es:[di] ; table size => CX
shr cx, 1 ; change to word count
add di, 2 ; start at proper offset
repne scasw ; look for the ID
; Before exception dates, if we did not find the Repeat ID, then
; we knew the data structures were hosed. With the addition of
; this wonderful feature, we can't be so sure. I also made the code
; a bit more robust for the non-EC case. - Don 11/6/95
;
if not _REPEAT_DATE_EXCEPTIONS
EC < ERROR_NZ REMOVE_EVENT_REPEAT_ID_NOT_FOUND >
endif
jnz exit
mov {word} es:[di-2], 0 ; remove the repeat ID
; Any events left in the table ??
;
mov di, es:[bp] ; re-dereference the handle
mov cx, es:[di] ; table size => CX
shr cx, 1 ; change to word count
dec cx ; account for count word
add di, 2 ; start at proper offset
clr ax ; look for non-zero ID
repe scasw ; scan the string
jz nukeChunk ; if no ID's found, jump
exit:
clc
ret
; Else nuke the useless chunk
;
nukeChunk:
mov ax, bp ; chunk handle => AX
call LMemFree ; free up the chunk
stc
ret
RemoveOverflowEvent endp
CommonCode ends
FileCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DestroyRepeatYearTable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destory a repeat year table
CALLED BY: RepeatEnd
PASS: CX:DX = RepeatTable OD
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/7/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DestroyRepeatYearTable proc near
uses bx
.enter
mov bx, cx ; handle => BX
EC < call ECCheckMemHandleNS ; verify the handle >
call MemFree ; free up the block
.leave
ret
DestroyRepeatYearTable endp
FileCode ends
|
pwnlib/shellcraft/templates/mips/linux/killparent.asm | DrKeineLust/pwntools | 325 | 179878 | <gh_stars>100-1000
<%
from pwnlib.shellcraft.mips.linux import getppid, kill
from pwnlib.constants import SIGKILL
from pwnlib.shellcraft.common import label
%>
<%docstring>
Kills its parent process until whatever the parent is (probably init)
cannot be killed any longer.
</%docstring>
<%
killparent_loop = label('killparent')
%>
${killparent_loop}:
${getppid()}
${kill('$v0', SIGKILL)}
beq $v0, $zero, ${killparent_loop}
|
programs/oeis/202/A202201.asm | karttu/loda | 1 | 15175 | ; A202201: Number of (n+2) X 9 binary arrays avoiding patterns 001 and 101 in rows and columns.
; 2430,11880,44550,138996,378378,926640,2084940,4375800,8664084,16325712,29476980,51279480,86337900,141210432,225054126,350430300,534298050,799227000,1174863690,1699689420,2423110950,3407929200,4733235000,6497785008,8823915144,11862053280,15795897480,20848330800,27288148536,35437678848,45681382890,58475525940,74359016550,93965516424,118036929582,147438385380,183174836130,226409396400,278483557572,340939417896,415544075100,504316335600,609555901500,733875203880,880234058340,1051977326400,1252875774150,1487170327500,1759619931498,2075553229464,2440924286130,2862372587580,3347287559550,3903877854576,4541245667568,5269466348640,6099673591440,7044150484800,8116426725264,9331382297952,10705357943280,12256272737280,14003749123650,15969245746212,18176198441166,20650169759400,23419007400150,26513011948500,29965114320570,33811063331760,38089623815100,42842785728600,48115984702500,53958334489488,60422871793284,67566813963480,75451830057180,84144325780800,93715742838366,104242873225788,115808189023890,128500188256440,142413757393050,157650551090604,174319389780822,192536675725680,212426828176680,234122738288400,257766244451352,283508628723936,311511135058200,341945510029200,374994566793000,410852773013760,449726863515930,491836478433300,537414827642550,586709382285000,639982594196478,697512644081604,759594219285330,826539322031280,898678109013300,976359763243656,1059953399078508,1149849001358640,1246458399620940,1350216278353800,1461581224287444,1581036811728192,1709092726963830,1846285932785580,1993181874190650,2150375726347992,2318493685928706,2498194306921500,2690169882072750,2895147871110000,3113892376927200,3347205670929600,3595929768756000,3860948057616000,4143186976500000,4443617750539968,4763258180819424,5103174490951680,5464483231766130,5848353245463300,6256007690620446,6688726129450728,7147846678740390,7634768225909940,8150952711667050,8697927480740784
mov $3,$0
mov $0,1
add $0,$3
add $0,9
mov $2,$0
bin $0,8
mov $3,$0
mov $0,0
mov $1,$3
sub $2,8
add $0,$2
mul $0,$3
add $1,$0
sub $1,135
mul $1,18
add $1,2430
|
oeis/027/A027475.asm | neoneye/loda-programs | 11 | 26635 | <gh_stars>10-100
; A027475: a(n) = (n-1) * 15^(n-2).
; 1,30,675,13500,253125,4556250,79734375,1366875000,23066015625,384433593750,6343154296875,103797070312500,1686702392578125,27246730957031250,437893890380859375,7006302246093750000,111662942047119140625,1773470256042480468750,28079945720672607421875,443367564010620117187500,6983039133167266845703125,109733472092628479003906250,1720820357816219329833984375,26934579513645172119140625000,420852804900705814361572265625,6565303756451010704040527343750,102267231590871512889862060546875
mov $1,$0
add $0,1
mov $2,15
pow $2,$1
mul $0,$2
|
oeis/344/A344329.asm | neoneye/loda-programs | 11 | 104942 | <reponame>neoneye/loda-programs
; A344329: Number of divisors of n^6.
; Submitted by <NAME>
; 1,7,7,13,7,49,7,19,13,49,7,91,7,49,49,25,7,91,7,91,49,49,7,133,13,49,19,91,7,343,7,31,49,49,49,169,7,49,49,133,7,343,7,91,91,49,7,175,13,91,49,91,7,133,49,133,49,49,7,637,7,49,91,37,49,343,7,91,49,343,7,247,7,49,91,91,49,343,7,175,25,49,7,637,49,49,49,133,7,637,49,91,49,49,49,217,7,91,91,169
add $0,1
mov $1,1
mov $2,2
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
add $5,6
lpe
mul $1,$5
lpe
mov $0,$1
|
include/game-gevent.ads | Holt59/Ada-SDL | 0 | 13306 | --------------------------------------------
-- --
-- PACKAGE GAME - PARTIE ADA --
-- --
-- GAME-GEVENT.ADS --
-- --
-- Gestion des évènements --
-- --
-- Créateur : <NAME> --
-- Adresse : <EMAIL> --
-- --
-- Dernière modification : 14 / 06 / 2011 --
-- --
--------------------------------------------
package Game.GEvent is
-- Voir plus bas
type Event;
-- Les différents types d'event possible
type Event_Type is (ACTIVE, KEYDOWN, KEYUP, MOUSE_MOTION, MOUSE_BUTTON_DOWN,
MOUSE_BUTTON_UP, QUIT,NONE);
-- Les différentes valeurs des touches du clavier (sur un clavier QWERTY !!)
type Event_Key is (K_BACKSPACE,K_TAB,K_CLEAR,K_RETURN,K_PAUSE,K_ESCAPE,K_SPACE,
K_EXCLAIM,K_QUOTEDBL,K_HASH,K_DOLLAR,K_AMPERSAND,K_QUOTE,
K_LEFTPAREN,K_RIGHTPAREN,K_ASTERISK,K_PLUS,K_COMMA,K_MINUS,
K_PERIOD,K_SLASH,
-- TOUCHE NOMBRE (AU DESSUS DES LETTRES)
K_0,K_1,K_2,K_3,K_4,K_5,K_6,K_7,K_8,K_9,
K_COLON,K_SEMICOLON,K_LESS,K_EQUALS,K_GREATER,K_QUESTION,
K_AT,K_LEFTBRACKET,K_BACKSLASH,K_RIGHTBRACKET,K_CARET,
K_UNDERSCORE,K_BACKQUOTE,
-- TOUCHE LETTRES (CLAVIER QWERTY !!)
K_A,K_B,K_C,K_D,K_E,K_F,K_G,K_H,K_I,K_J,K_K,K_L,K_M,K_N,K_O,K_P,K_Q,K_R,K_S,K_T,K_U,K_V,K_W,K_X,K_Y,K_Z,
K_DELETE,
-- TOUCHE DU PAVE NUMERIQUE (K_KP)
K_KP0,K_KP1,K_KP2,K_KP3,K_KP4,K_KP5,K_KP6,K_KP7,K_KP8,K_KP9,
K_KP_PERIOD,K_KP_DIVIDE,K_KP_MULTIPLY,K_KP_MINUS,K_KP_PLUS,K_KP_ENTER,K_KP_EQUALS,
-- FLECHES DIRECTIONNELLES
K_UP,K_DOWN,K_RIGHT,K_LEFT,
K_INSERT,K_HOME,K_END,K_PAGEUP,K_PAGEDOWN,
-- TOUCHE DE FONCTION (F1..F15)
K_F1,K_F2,K_F3,K_F4,K_F5,K_F6,K_F7,K_F8,K_F9,K_F10,K_F11,K_F12,K_F13,K_F14,K_F15,
K_NUMLOCK,K_CAPSLOCK,K_SCROLLOCK,K_RSHIFT,
K_LSHIFT,K_RCTRL,K_LCTRL,K_RALT,K_LALT,K_RMETA,K_LMETA,
K_LSUPER,K_RSUPER,K_MODE,K_HELP,K_PRINT,K_SYSREQ,
K_BREAK,K_MENU,K_POWER,K_EURO);
-- Les boutons de la souris
type Event_Mouse_Key is (LEFT,MIDDLE,RIGHT,WHEELUP,WHEELDOWN);
type Tab_Key is array (Event_Key) of Boolean;
type Tab_Mouse is array (Event_Mouse_Key) of Boolean;
-- Type contenant toutes les informations à propos des events
type Event is
record
Etype : Event_Type := NONE; -- Le type de l'event
Ekey : Tab_Key := (others => False); -- Array (Event_Key range K_BACKSPACE..K_EURO) of Boolean;
X,Y : Integer := -1; -- Les coordonnées de la souris, sinon (-1,-1)
X_Rel, Y_Rel : Integer := 0; -- Les coordonnées du mouvement de la souris
EMouseButton : Tab_Mouse := (others => False); -- Array (Event_Mouse_Key range LEFT..RIGHT) of Boolean;
end record;
-- Retourne un nouvel event (ré)initialisé par (NONE,(others => False),-1,-1,0,0,(others => False))
function New_Event return Event;
-- Attends qu'un event arrive et le retourne, cette fonction bloque le
-- programme tant qu'elle ne reçoit pas un évènement
procedure Wait_Event (E : in out Event);
-- Regarde si il y a des events en attente
-- Si il y en a, E est mis à jour avec le premier event de la queue et
-- En_Of_Queue est mis à False
-- Sinon E n'est pas modifié et End_Of_Queue est mis à True
procedure Poll_Event(E : in out Event;
End_Of_Queue : out Boolean);
-- Enable_Key_Repeat active la répétition lors de la génération d'event
-- au clavier : Lorsqu'il est activé, l'appuie sur une touche génère
-- un premier event, puis après Wait milliseconde, elle génère un event
-- toutes les Interval milliseconde tant qu'elle n'est pas relevé
-- Mettre Wait à 0 desactive la répétition, pour plus de clareté, il
-- est conseillé d'utiliser la fonction de désactivation
procedure Enable_Key_Repeat(Wait : in Positive := 500;
Interval : in Positive := 30);
procedure Disable_Key_Repeat;
end Game.GEvent;
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_30_283.asm | ljhsiun2/medusa | 9 | 13101 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_30_283.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x11fa8, %r14
nop
nop
nop
dec %r8
movl $0x61626364, (%r14)
cmp $30677, %r10
lea addresses_D_ht+0x153f4, %rsi
lea addresses_A_ht+0x1b274, %rdi
nop
nop
cmp $31356, %rax
mov $29, %rcx
rep movsw
nop
nop
nop
nop
sub $21818, %rcx
lea addresses_normal_ht+0x98f8, %rsi
lea addresses_normal_ht+0xd5b4, %rdi
nop
nop
nop
nop
xor %r15, %r15
mov $4, %rcx
rep movsw
nop
dec %r15
lea addresses_A_ht+0x67d8, %rdi
cmp %r14, %r14
mov (%rdi), %r8
nop
nop
nop
nop
sub %r14, %r14
lea addresses_WC_ht+0xdf4, %rsi
clflush (%rsi)
nop
nop
add %rcx, %rcx
mov (%rsi), %r15
nop
nop
nop
sub $28009, %r10
lea addresses_normal_ht+0x1d0b4, %rdi
nop
nop
dec %r10
mov $0x6162636465666768, %r8
movq %r8, %xmm7
and $0xffffffffffffffc0, %rdi
movaps %xmm7, (%rdi)
sub $59412, %r10
lea addresses_normal_ht+0x9694, %rsi
lea addresses_D_ht+0x145f4, %rdi
nop
and %r8, %r8
mov $98, %rcx
rep movsw
nop
nop
nop
xor $18472, %rcx
lea addresses_normal_ht+0x1703c, %r15
nop
nop
nop
nop
nop
sub $51842, %rdi
mov $0x6162636465666768, %r8
movq %r8, %xmm4
vmovups %ymm4, (%r15)
nop
nop
nop
nop
and %r8, %r8
lea addresses_normal_ht+0x13df4, %r10
nop
nop
nop
nop
cmp %r14, %r14
movl $0x61626364, (%r10)
nop
cmp $42417, %r10
lea addresses_D_ht+0x5df4, %r10
nop
nop
nop
nop
sub $21685, %r14
vmovups (%r10), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rax
nop
inc %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r8
push %r9
push %rcx
push %rsi
// Store
lea addresses_D+0x16b94, %r15
clflush (%r15)
nop
nop
nop
nop
and %r8, %r8
movb $0x51, (%r15)
cmp %r15, %r15
// Load
lea addresses_D+0x43d4, %rcx
nop
xor %rsi, %rsi
mov (%rcx), %r13w
nop
inc %rcx
// Store
lea addresses_WC+0x8df4, %r13
nop
nop
nop
xor $52941, %r12
movw $0x5152, (%r13)
nop
and $6170, %rsi
// Load
lea addresses_WC+0x1a334, %r8
and $55875, %rcx
mov (%r8), %r9w
nop
nop
nop
nop
nop
sub %r12, %r12
// Store
lea addresses_PSE+0xc63c, %r9
nop
cmp $5934, %rcx
mov $0x5152535455565758, %rsi
movq %rsi, (%r9)
nop
nop
nop
nop
inc %r15
// Faulty Load
lea addresses_WC+0x8df4, %r13
nop
cmp %r12, %r12
mov (%r13), %r9
lea oracles, %r12
and $0xff, %r9
shlq $12, %r9
mov (%r12,%r9,1), %r9
pop %rsi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'52': 30}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
oeis/153/A153238.asm | neoneye/loda-programs | 11 | 9041 | <filename>oeis/153/A153238.asm
; A153238: Numbers k such that 2*k + 3 is composite.
; Submitted by <NAME>
; 3,6,9,11,12,15,16,18,21,23,24,26,27,30,31,33,36,37,39,41,42,44,45,46,48,51,54,56,57,58,59,60,61,63,65,66,69,70,71,72,75,76,78,79,81,83,84,86,87,90,91,92,93,96,99,100,101,102,103,105,106,107,108,109,111,114,116,117,120,121,122,123,125,126,128,129,131,132,135,136,138,141,142,143,144,146,147,148,149,150,151,153,156,158,159,160,161,162,163,165
add $0,2
mov $1,3
mov $2,1
lpb $0
mov $3,$2
lpb $3
add $2,2
mov $4,$1
gcd $4,$2
cmp $4,1
sub $3,$4
lpe
sub $0,1
add $2,2
mul $1,$2
lpe
mov $0,$2
div $0,2
sub $0,1
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/mul10u_fastcall.asm | Frodevan/z88dk | 640 | 99937 |
SECTION code_fp_math32
PUBLIC _mul10u_fastcall
EXTERN m32_fsmul10u_fastcall
defc _mul10u_fastcall = m32_fsmul10u_fastcall
|
libsrc/_DEVELOPMENT/font/fzx/c/sdcc_iy/fzx_at_callee.asm | meesokim/z88dk | 0 | 168808 | <filename>libsrc/_DEVELOPMENT/font/fzx/c/sdcc_iy/fzx_at_callee.asm
; void fzx_at_callee(struct fzx_state *fs, uint16_t x, uint16_t y)
SECTION code_font_fzx
PUBLIC _fzx_at
EXTERN asm_fzx_at
_fzx_at:
pop af
pop ix
pop hl
pop bc
push af
jp asm_fzx_at
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_21829_903.asm | ljhsiun2/medusa | 9 | 98879 | .global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rbp
push %rdx
lea addresses_A_ht+0xbc60, %rbp
nop
nop
nop
nop
nop
add $38459, %rdx
movb $0x61, (%rbp)
dec %r8
pop %rdx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %r8
push %rax
push %rsi
// Store
lea addresses_UC+0xcd40, %rsi
nop
nop
nop
nop
nop
cmp $60928, %r8
movb $0x51, (%rsi)
nop
nop
add $5926, %rsi
// Faulty Load
mov $0x6fcc30000000970, %r8
nop
nop
add %rax, %rax
mov (%r8), %r12d
lea oracles, %r8
and $0xff, %r12
shlq $12, %r12
mov (%r8,%r12,1), %r12
pop %rsi
pop %rax
pop %r8
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_UC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Definition/Typed/Consequences/Reduction.agda | loic-p/logrel-mltt | 0 | 17386 | <reponame>loic-p/logrel-mltt
{-# OPTIONS --without-K --safe #-}
module Definition.Typed.Consequences.Reduction where
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.Typed.EqRelInstance
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Fundamental.Reducibility
open import Tools.Embedding
open import Tools.Product
-- Helper function where all reducible types can be reduced to WHNF.
whNorm′ : ∀ {A Γ l} ([A] : Γ ⊩⟨ l ⟩ A)
→ ∃ λ B → Whnf B × Γ ⊢ A :⇒*: B
whNorm′ (Uᵣ′ .⁰ 0<1 ⊢Γ) = U , Uₙ , idRed:*: (Uⱼ ⊢Γ)
whNorm′ (ℕᵣ D) = ℕ , ℕₙ , D
whNorm′ (ne′ K D neK K≡K) = K , ne neK , D
whNorm′ (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) = Π F ▹ G , Πₙ , D
whNorm′ (emb′ 0<1 [A]) = whNorm′ [A]
-- Well-formed types can all be reduced to WHNF.
whNorm : ∀ {A Γ} → Γ ⊢ A → ∃ λ B → Whnf B × Γ ⊢ A :⇒*: B
whNorm A = whNorm′ (reducible A)
-- Helper function where reducible all terms can be reduced to WHNF.
whNormTerm′ : ∀ {a A Γ l} ([A] : Γ ⊩⟨ l ⟩ A) → Γ ⊩⟨ l ⟩ a ∷ A / [A]
→ ∃ λ b → Whnf b × Γ ⊢ a :⇒*: b ∷ A
whNormTerm′ (Uᵣ′ a b c) (Uₜ A d typeA A≡A [t]) = A , typeWhnf typeA , d
whNormTerm′ (ℕᵣ x) (ιx (ℕₜ n d n≡n prop)) =
let natN = natural prop
in n , naturalWhnf natN , convRed:*: d (sym (subset* (red x)))
whNormTerm′ (ne′ K D neK K≡K) (ιx (neₜ k d (neNfₜ neK₁ ⊢k k≡k))) =
k , ne neK₁ , convRed:*: d (sym (subset* (red D)))
whNormTerm′ (Πᵣ′ F G D ⊢F ⊢G A≡A [F] [G] G-ext) (Πₜ f d funcF f≡f [f] [f]₁) =
f , functionWhnf funcF , convRed:*: d (sym (subset* (red D)))
whNormTerm′ (emb′ 0<1 [A]) (ιx [a]) = whNormTerm′ [A] [a]
-- Well-formed terms can all be reduced to WHNF.
whNormTerm : ∀ {a A Γ} → Γ ⊢ a ∷ A → ∃ λ b → Whnf b × Γ ⊢ a :⇒*: b ∷ A
whNormTerm {a} {A} ⊢a =
let [A] , [a] = reducibleTerm ⊢a
in whNormTerm′ [A] [a]
|
libsrc/_DEVELOPMENT/arch/zx/esxdos/z80/asm_esxdos_disk_read.asm | jpoikela/z88dk | 640 | 85036 | ; int esxdos_disk_read(uchar device, ulong position, void *dst)
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_esxdos
PUBLIC asm_esxdos_disk_read
EXTERN error_znc
EXTERN __esxdos_error_mc
asm_esxdos_disk_read:
; DISK_READ:
; Read one block of data from device A, at position BCDE at address HL
;
; Note: This may be disk io from a physical position on the disk
; rather than from a specific file.
;
; enter : a = uchar device
; bcde = ulong position
; hl = void *dst
;
; exit : success
;
; hl = 0
; carry reset
;
; error
;
; hl = -1
; carry set, errno set
;
; uses : unknown
IF __SDCC_IY
push hl
pop iy
ELSE
push hl
pop ix
ENDIF
rst __ESXDOS_SYSCALL
defb __ESXDOS_SYS_DISK_READ
jp nc, error_znc
jp __esxdos_error_mc
|
src/passing-expressions.asm | hirohito-protagonist/hla-learn-adventure | 0 | 98175 | ; Assembly code emitted by HLA compiler
; Version 2.16 build 4413 (prototype)
; HLA compiler written by <NAME>
; NASM compatible output
bits 32
%define ExceptionPtr__hla_ [dword fs:0]
global QuitMain__hla_
global DfltExHndlr__hla_
global _HLAMain
global HWexcept__hla_
global start
section .text code align=16
extern STDOUT_PUTU32
extern STDOUT_NEWLN
extern DefaultExceptionHandler__hla_
extern abstract__hla_
extern HardwareException__hla_
extern BuildExcepts__hla_
extern STDOUT_PUTS
extern Raise__hla_
extern shortDfltExcept__hla_
section .text
; procedure ExprParm__hla_1885
ExprParm__hla_1885:
; push ebp
db 055h ;
; mov ebp, esp
db 089h ;
db 0e5h ; mod-reg-r/m
; and esp, -4
db 083h ;
db 0e4h ;
db 0fch ;
; push strict dword str__hla_1886
db 068h ;
dd str__hla_1886
call STDOUT_PUTS
; push dword [ebp+8]
db 0ffh ;
db 075h ;
db 08h ;
call STDOUT_PUTU32
call STDOUT_NEWLN
xExprParm__hla_1885__hla_:
; mov esp, ebp
db 089h ;
db 0ech ; mod-reg-r/m
; pop ebp
db 05dh ;
; ret 4
db 0c2h ; opcode
dw 04h
;ExprParm__hla_1885 endp
;/* HWexcept__hla_ gets called when Windows raises the exception. */
; procedure HWexcept__hla_
HWexcept__hla_:
jmp HardwareException__hla_
;HWexcept__hla_ endp
; procedure DfltExHndlr__hla_
DfltExHndlr__hla_:
jmp DefaultExceptionHandler__hla_
;DfltExHndlr__hla_ endp
; procedure _HLAMain
_HLAMain:
nop
; procedure start
start:
;start endp
call BuildExcepts__hla_
; push dword 0
db 06ah ;
db 00h ;
; push ebp
db 055h ;
; push ebp
db 055h ;
; lea ebp, [esp+4]
db 08dh ;
db 06ch ;
db 024h ;
db 04h ;
; mov eax, [Operand1__hla_1888]
db 0a1h ;
dd (Operand1__hla_1888+0)
; add eax, dword [Operand2__hla_1889]
db 03h ;
db 05h ;
dd Operand2__hla_1889
; push eax
db 050h ;
call ExprParm__hla_1885
; mov eax, [Operand1__hla_1888]
db 0a1h ;
dd (Operand1__hla_1888+0)
; add eax, dword [Operand2__hla_1889]
db 03h ;
db 05h ;
dd Operand2__hla_1889
; push eax
db 050h ;
call ExprParm__hla_1885
QuitMain__hla_:
; push dword 0
db 06ah ;
db 00h ;
; call [__imp__ExitProcess@4]
db 0ffh ;
db 015h ;
dd __imp__ExitProcess@4
;_HLAMain endp
section .text
align (4)
len__hla_1886 dd 0ch
dd 0ch
str__hla_1886:
db "exprValue = "
db 0
db 0
db 0
db 0
section .data data align=16
extern MainPgmCoroutine__hla_
extern __imp__MessageBoxA@16
extern __imp__ExitProcess@4
align (4)
Operand1__hla_1888 :dd 0x5
Operand2__hla_1889 :dd 0x14
|
programs/oeis/001/A001585.asm | karttu/loda | 1 | 102916 | ; A001585: a(n) = 3^n + n^3.
; 1,4,17,54,145,368,945,2530,7073,20412,60049,178478,533169,1596520,4785713,14352282,43050817,129145076,387426321,1162268326,3486792401,10460362464,31381070257,94143190994,282429550305,847288625068,2541865845905,7625597504670,22876792476913,68630377389272,205891132121649,617673396313738,1853020188884609,5559060566591460
mov $1,3
pow $1,$0
pow $0,3
add $1,$0
|
programs/serial.asm | mynameispyo/InpyoOS | 0 | 29177 | <gh_stars>0
; ------------------------------------------------------------------
; MichalOS Serial Tester
; ------------------------------------------------------------------
BITS 16
%INCLUDE "osdev.inc"
ORG 100h
start:
call .draw_background
mov ax, 0 ; Set up the serial port
call os_serial_port_enable
call os_get_via_serial ; Is the other computer waiting for connection?
cmp al, 123
je near .connection_request
mov si, .wait_msg1
mov ax, .wait_msg2
mov bx, .blank
mov cx, .blank
mov dx, .blank
call os_temp_box
.loop:
mov al, 123
call os_send_via_serial
call os_get_via_serial
cmp al, 125
je near .request_confirm
call os_check_for_key
cmp al, 27
je near .exit
jmp .loop
.connection_request:
mov al, 125
call os_send_via_serial
.request_confirm:
mov ax, .connection_msg
mov bx, 0
mov cx, 0
mov dx, 0
call os_dialog_box
jmp .exit
.draw_background:
mov ax, .title_msg
mov bx, .blank
mov cx, 256
call os_draw_background
ret
.exit:
mov al, 0
call os_send_via_serial
ret
.title_msg db 'InpyoOS Serial Tester', 0
.blank db 0
.wait_msg1 db 'Waiting for a response...', 0
.wait_msg2 db 'Press Esc to quit.', 0
.connection_msg db 'Successfully connected.', 0
; ------------------------------------------------------------------
|
src/planet.ads | drm343/Space-War-3000 | 2 | 6327 | with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Rule; use Rule;
package Planet is
package SU renames Ada.Strings.Unbounded;
package Origin_Define is
type Object is tagged private;
function Build (name : String;
colony : Integer;
starship : Integer;
station : Integer)
return Object;
function "=" (Left, Right : Object) return Boolean;
function show (planet: in Object) return String;
procedure attack (planet: in out Object);
private
type Object is tagged
record
Name : SU.Unbounded_String;
Damage: Boolean;
Colony: Integer;
Starship: Integer;
Station: Integer;
end record;
end Origin_Define;
subtype Object is Origin_Define.Object;
function Build (name : String;
colony : Integer;
starship : Integer;
station : Integer)
return Object
renames Origin_Define.Build;
subtype Planet_Range is Positive range 1 .. 10;
package Vectors is new Ada.Containers.Vectors
(Element_Type => Origin_Define.Object,
Index_Type => Planet_Range,
"=" => Origin_Define."=");
subtype Vector is Vectors.Vector;
end Planet;
|
source/nodes/program-nodes-elsif_paths.adb | reznikmm/gela | 0 | 19098 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Elsif_Paths is
function Create
(Elsif_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Condition : not null Program.Elements.Expressions.Expression_Access;
Then_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Elsif_Path is
begin
return Result : Elsif_Path :=
(Elsif_Token => Elsif_Token, Condition => Condition,
Then_Token => Then_Token, Statements => Statements,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Condition : not null Program.Elements.Expressions
.Expression_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Elsif_Path is
begin
return Result : Implicit_Elsif_Path :=
(Condition => Condition, Statements => Statements,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Condition
(Self : Base_Elsif_Path)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Condition;
end Condition;
overriding function Statements
(Self : Base_Elsif_Path)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Statements;
end Statements;
overriding function Elsif_Token
(Self : Elsif_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Elsif_Token;
end Elsif_Token;
overriding function Then_Token
(Self : Elsif_Path)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Then_Token;
end Then_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Elsif_Path)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Elsif_Path)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Elsif_Path)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Elsif_Path'Class) is
begin
Set_Enclosing_Element (Self.Condition, Self'Unchecked_Access);
for Item in Self.Statements.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Elsif_Path (Self : Base_Elsif_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Elsif_Path;
overriding function Is_Path (Self : Base_Elsif_Path) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Path;
overriding procedure Visit
(Self : not null access Base_Elsif_Path;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Elsif_Path (Self);
end Visit;
overriding function To_Elsif_Path_Text
(Self : in out Elsif_Path)
return Program.Elements.Elsif_Paths.Elsif_Path_Text_Access is
begin
return Self'Unchecked_Access;
end To_Elsif_Path_Text;
overriding function To_Elsif_Path_Text
(Self : in out Implicit_Elsif_Path)
return Program.Elements.Elsif_Paths.Elsif_Path_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Elsif_Path_Text;
end Program.Nodes.Elsif_Paths;
|
test1.asm | dadddda/assembly-language-emulator | 0 | 168409 | ; Test program.
SP = SP - 4
R1 = 20
R2 = R1 + -10
RV = R2
SP = SP + 4
RET
|
FlaxVM/bin/Debug/Examples/dup.asm | DreamVB/FlaxVM | 0 | 3935 | # Test DUP
PUSH 20
DUP
ADD
SYS 3
HLT
|
programs/oeis/140/A140153.asm | neoneye/loda | 22 | 2976 | <filename>programs/oeis/140/A140153.asm
; A140153: a(1)=1, a(n) = a(n-1) + n^3 if n odd, a(n) = a(n-1) + n^1 if n is even.
; 1,3,30,34,159,165,508,516,1245,1255,2586,2598,4795,4809,8184,8200,13113,13131,19990,20010,29271,29293,41460,41484,57109,57135,76818,76846,101235,101265,131056,131088,167025,167059,209934,209970,260623,260661,319980,320020,388941,388983,468490,468534,559659,559705,663528,663576,781225,781275,913926,913978,1062855,1062909,1229284,1229340,1414533,1414591,1619970,1620030,1847011,1847073,2097120,2097184,2371809,2371875,2672638,2672706,3001215,3001285,3359196,3359268,3748285,3748359,4170234,4170310,4626843,4626921,5119960,5120040,5651481,5651563,6223350,6223434,6837559,6837645,7496148,7496236,8201205,8201295,8954866,8954958,9759315,9759409,10616784,10616880,11529553,11529651,12499950,12500050
mov $3,$0
add $3,1
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
sub $0,$3
mov $2,3
add $2,$0
add $0,1
mod $2,2
mul $2,2
mov $5,1
add $5,$2
pow $0,$5
add $1,$0
lpe
mov $0,$1
|
oeis/243/A243132.asm | neoneye/loda-programs | 11 | 92567 | ; A243132: 32*n^6 - 48*n^4 + 18*n^2 - 1.
; -1,1,1351,19601,119071,470449,1431431,3650401,8193151,16692641,31521799,55989361,94558751,153090001,239104711,362074049,533729791,768398401,1083358151,1499219281,2040327199,2735188721,3616921351,4723725601,6099380351,7793761249,9863382151,12371959601,15391000351,19000411921,23289136199,28355806081,34309425151,41270070401,49369617991,58752492049,69576436511,82013310001,96249903751,112488782561,130949148799,151867729441,175499686151,202119548401,232022169631,265523706449,302962620871,344700705601
mul $0,2
mov $2,$0
pow $0,2
sub $0,3
mul $0,$2
pow $0,2
sub $0,2
div $0,2
|
base/ntsetup/opktools/oformat/forproc.asm | npocmaka/Windows-Server-2003 | 17 | 13878 | ;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
; SCCSID = @(#)forproc.asm 1.2 85/07/25
.xlist
.xcref
BREAK MACRO subtitle
SUBTTL subtitle
PAGE
ENDM
include bpb.inc
INCLUDE FORCHNG.INC
INCLUDE SYSCALL.INC
INCLUDE FOREQU.INC
INCLUDE FORMACRO.INC
INCLUDE FORSWTCH.INC
INCLUDE IOCTL.INC
.cref
.list
data segment public para 'DATA'
data ends
code segment public para 'CODE'
assume cs:code,ds:data
PUBLIC FormatAnother?,Yes?,REPORT,USER_STRING
public fdsksiz,fdsksizM100s,badsiz,badsizM100s
public syssiz,datasiz,datasizM100s,biosiz
public AllocSize,AllocNum,MegSizes
public Get_Free_Space
extrn std_printf:near,crlf:near,PrintString:near
extrn Multiply_32_Bits:near
extrn AddToSystemSize:near
;No more SAFE module
; EXTRN UpdateSystemSize:NEAR
data segment public para 'DATA'
extrn driveLetter:byte
extrn msgInsertDisk:byte
extrn msgFormatAnother?:byte
extrn msgQuickFormatAnother?:byte
extrn msgTotalDiskSpace:byte
extrn msgTotalDiskSpaceMeg:byte
extrn msgSystemSpace:byte
extrn msgBadSpace:byte
extrn msgBadSpaceMeg:byte
extrn msgDataSpace:byte
extrn msgDataSpaceMeg:byte
extrn Read_Write_Relative:byte
extrn msgAllocSize:byte
extrn MsgAllocNum:Byte
extrn deviceParameters:byte
EXTRN fBig32Fat:BYTE
extrn bios:byte
extrn dos:byte
extrn command:byte
IFDEF DBLSPACE_HOOKS
extrn DblSpaceBin:byte
ENDIF
extrn Serial_Num_Low:Word
extrn Serial_Num_High:Word
extrn msgSerialNumber:Byte
extrn SwitchMap:Word
extrn SwitchCopy:Word
extrn inbuff:byte
MegSizes db 0
fdsksiz dd 0
fdsksizM100s dw 0
syssiz dd 0
biosiz dd 0
badsiz dd 0
badsizM100s dw 0
datasiz dd 0
datasizM100s dw 0
AllocSize dd 0
AllocNum dd 0
dw offset driveLetter
ExtFreePacket ExtGetDskFreSpcStruc <>
data ends
;***************************************************************************
; Wait for key. If yes return carry clear, else no. Insures
; explicit Y or N answer.
;***************************************************************************
FormatAnother? proc near
test SwitchCopy,SWITCH_Q ;use different message with /Q
jz @F
Message msgQuickFormatAnother?
jmp SHORT CheckResponse
@@:
Message msgFormatAnother?
CheckResponse:
CALL Yes?
pushf ; save result
call CrLf ; send a new line
popf ; retrieve the result
jnc WAIT20
jz Wait20
JMP SHORT FormatAnother?
WAIT20:
RET
FormatAnother? endp
;***************************************************************************
;Routine name:Yes?
;***************************************************************************
;
;Description: Validate that input is valid Y/N for the country dependent info
; Wait for key. If YES return carry clear,else carry set.
; If carry is set, Z is set if explicit NO, else key was not Yes or No.
;
;Called Procedures: Message (macro)
; User_String
;
;Change History: Created 4/32/87 MT
;
;Input: None
;
;Output: CY = 0 Yes is entered
; CY = 1, Z = No
; CY = 1, NZ = other
;
;Psuedocode
;----------
;
; Get input (CALL USER STRING)
; IF got character
; Check for country dependent Y/N (INT 21h, AX=6523h Get Ext Country)
; IF Yes
; clc
; ELSE (No)
; IF No
; stc
; Set Zero flag
; ELSE (Other)
; stc
; Set NZ
; ENDIF
; ENDIF
; ELSE (nothing entered)
; stc
; Set NZ flag
; ENDIF
; ret
;***************************************************************************
Procedure YES?
call User_String ;Get character
jz $$IF1 ;Got one if returned NZ
mov AL,23h ;See if it is Y/N
mov dl,[InBuff+2] ;Get character
DOS_Call GetExtCntry ;Get country info call
cmp AX,Found_Yes ;Which one?
jne $$IF2 ;Got a Yes
clc ;Clear CY for return
jmp SHORT $$EN2 ;Not a Yes
$$IF2:
cmp AX,Found_No ;Is it No?
jne $$IF4 ;Yep
stc ;Set CY for return
jmp SHORT $$EN4 ;Something else we don't want
$$IF4:
xor AL,AL ;Set NZ flag for ret
cmp AL,1 ; " " " "
stc ;And CY flag for good measure
$$EN4:
$$EN2:
jmp SHORT $$EN1 ;No char found at all
$$IF1:
xor AL,AL ;Set NZ flag for ret
cmp AL,1
stc ;And CY flag for good measure
$$EN1:
ret
Yes? endp
;***************************************************************************
; Get a string from user. Z is set if user typed no chars (imm CR)
; We need to flush a second time to get rid of incoming Kanji characters also.
;***************************************************************************
Procedure USER_STRING
mov AX,(STD_CON_INPUT_FLUSH SHL 8) + 0 ; Clean out input
int 21h
mov DX,OFFSET InBuff
mov AH,STD_CON_STRING_INPUT
int 21h
mov AX,(STD_CON_INPUT_FLUSH SHL 8) + 0 ; Clean out input
int 21h
cmp byte ptr [InBuff+1],0
ret
USER_STRING endp
;*********************************************
; Make a status report including the following information:
; Total disk capacity
; Total system area used
; Total bad space allocated
; Total data space available
; Number of allocation units
; Size of allocation units
Procedure Report
call crlf
call Calc_System_Space ;calc system space
call Calc_Total_Addressible_Space ;calc total space
cmp MegSizes,0
jne IsHuge3
jmp NotHuge3
IsHuge3:
Message msgTotalDiskSpaceMeg
;call std_printf
cmp word ptr SysSiz,0
jnz SHOWSYSh
cmp word ptr SysSiz+2,0
jz CHKBADh
ShowSysh:
Message msgSystemSpace
;CALL std_printf
;Report space used by system
ChkBadh:
cmp word ptr BadSiz,0
jnz ShowBadh
cmp word ptr BadSiz+2,0
jnz ShowBadh
cmp BadSizM100s,0
jz ShowDatah
ShowBadh:
Message msgBadSpaceMeg
;call std_printf
ShowDatah:
.386
mov eax,SysSiz
xor edx,edx
mov ebx,1024*1024
div ebx ;EAX is MEG, EDX remainder
;; push eax
db 066h,050h
;;
mov eax,edx
xor edx,edx
mov ebx,(1024 * 1024) / 100
div ebx
shr ebx,1
cmp edx,ebx
jb short NoRnd3
inc eax
NoRnd3:
;; pop ecx
db 066h,059h
;;
movzx ebx,BadSizM100s
add eax,ebx
add ecx,BadSiz ;ECX.EAX is bad+sys size in MEG
mov ebx,Fdsksiz
movzx edx,FdsksizM100s
ChkBorrow:
cmp edx,eax
jae short NoSubAdj
dec ebx
add edx,100
jmp short ChkBorrow
NoSubAdj:
sub edx,eax
mov eax,edx
sub ebx,ecx
mov datasiz,ebx
.8086
mov datasizM100s,AX
Message msgDataSpaceMeg ;call std_printf
jmp short Huge3
NotHuge3:
Message msgTotalDiskSpace
;call std_printf
cmp word ptr SysSiz,0
jnz SHOWSYS
cmp word ptr SysSiz+2,0
jz CHKBAD
ShowSys:
Message msgSystemSpace
;CALL std_printf
;Report space used by system
ChkBad:
cmp word ptr BadSiz,0
jnz ShowBad
cmp word ptr BadSiz+2,0
jz ShowData
ShowBad:
Message msgBadSpace
;call std_printf
ShowData:
mov CX,word ptr Fdsksiz
mov BX,word ptr Fdsksiz+2
sub CX,word ptr BadSiz
sbb BX,word ptr BadSiz+2
sub CX,word ptr SysSiz
sbb BX,word ptr SysSiz+2
mov word ptr datasiz,CX
mov word ptr datasiz+2,BX
Message msgDataSpace ;call std_printf
Huge3:
call crlf
mov AX,deviceParameters.DP_BPB.oldBPB.BPB_BytesPerSector ;
mov CL,deviceParameters.DP_BPB.oldBPB.BPB_SectorsPerCluster ;
.errnz EDP_BPB NE DP_BPB
xor CH,CH
mul CX ;Get bytes per alloc
mov word ptr AllocSize,AX ;Save allocation size
mov word ptr AllocSize+2,DX ; for message
Message msgAllocSize ;Print size of cluster
call Get_Free_Space ;get disk space
.386
mov AllocNum,EBX ;Put result in msg
.8086
Message msgAllocNum ; = cluster/disk
call crlf
test switchmap, SWITCH_8 ;If 8 tracks, don't display
jnz NoSerialNumber ;serial number
Message msgSerialNumber ;Spit out serial number
call crlf
NoSerialNumber:
ret
Report endp
;***************************************************************************
;Routine name: Read_Disk
;***************************************************************************
;
;description: Read in data using Generic IOCtl
;
;Called Procedures: None
;
;
;Change History: Created 5/13/87 MT
;
;Input: AL = Drive number (0=A)
; DS:BX = Transfer address
; CX = Number of sectors
; Read_Write_Relative.Start_Sector_High = Logical start sector high
; DX = logical start sector number low
;
;Output: CY if error
; AH = INT 25h error code
;
;Psuedocode
;----------
; Save registers
; Setup structure for function call
; Read the disk (AX=440Dh, CL = 6Fh)
; Restore registers
; ret
;***************************************************************************
Procedure Read_Disk
push BX ;Save registers
push CX
push DX
push SI
push DI
push BP
push ES
push DS
mov SI,data
mov ES,SI
assume ES:data,DS:nothing
;Get transfer buffer add
mov ES:Read_Write_Relative.Buffer_Offset,BX
mov BX,DS
mov ES:Read_Write_Relative.Buffer_Segment,BX ;Get segment
mov BX,data ;Point DS at parameter list
mov DS,BX
assume DS:data,ES:data
mov Read_Write_Relative.Number_Sectors,CX ;Number of sec to read
mov Read_Write_Relative.Start_Sector_Low,DX ;Start sector
mov BX,offset Read_Write_Relative
mov CX,0ffffh ;Read relative sector
mov dl,al ;Drive # to DL
inc dl ;1 based
mov ax,(Get_Set_DriveInfo SHL 8) OR Ext_ABSDiskReadWrite
mov si,0 ;READ
int 21h ;Do the read
pop DS
pop ES
pop BP
pop DI
pop SI
pop DX ;Restore registers
pop CX
pop BX
ret
Read_Disk endp
;***************************************************************************
;Routine name: Write_Disk
;***************************************************************************
;
;description: Write Data using Generic IOCtl
;
;Called Procedures: None
;
;
;Change History: Created 5/13/87 MT
;
;Input: AL = Drive number (0=A)
; DS:BX = Transfer address
; CX = Number of sectors
; Read_Write_Relative.Start_Sector_High = Logical start sector high
; DX = logical start sector number low
;
;Output: CY if error
; AH = INT 26h error code
;
;Psuedocode
;----------
; Save registers
; Setup structure for function call
; Write to disk (AX=440Dh, CL = 4Fh)
; Restore registers
; ret
;***************************************************************************
Procedure Write_Disk
push BX ;Save registers
push CX
push DX
push SI
push DI
push BP
push ES
push DS
mov SI,data
mov ES,SI
assume ES:data, DS:nothing
;Get transfer buffer add
mov ES:Read_Write_Relative.Buffer_Offset,BX
mov BX,DS
mov ES:Read_Write_Relative.Buffer_Segment,BX ;Get segment
mov BX,data ;Point DS at parameter list
mov DS,BX
assume DS:data, ES:data
mov Read_Write_Relative.Number_Sectors,CX ;Number of sec to write
mov Read_Write_Relative.Start_Sector_Low,DX ;Start sector
mov BX,offset Read_Write_Relative
mov CX,0ffffh ;Write relative sector
mov dl,al ;Drive # to DL
inc dl ;1 based
mov ax,(Get_Set_DriveInfo SHL 8) OR Ext_ABSDiskReadWrite
mov si,1 ;WRITE
int 21h ;Do the write
pop DS
pop ES
pop BP
pop DI
pop SI
pop DX ;Restore registers
pop CX
pop BX
ret
Write_Disk endp
;=========================================================================
; Calc_Total_Addressible_Space : Calculate the total space that is
; addressible on the the disk by DOS.
;
; Inputs : none
;
; Outputs : Fdsksiz - Size in bytes of the disk
;=========================================================================
Procedure Calc_Total_Addressible_Space
push AX ;save affected regs
push DX
push BX
call Get_Free_Space ;get free disk space
.386
;; Manual assemble to prevent compile warning
;; push EBX ;save avail. cluster
;; push EDX ;save total. cluster
db 066h,053h
db 066h,052h
;;
movzx ecx,DeviceParameters.DP_BPB.oldBPB.BPB_SectorsPerCluster
movzx eax,DeviceParameters.DP_BPB.oldBPB.BPB_BytesPerSector
.errnz EDP_BPB NE DP_BPB
mul ecx
mov ecx,eax ;ECX = bytes/clus
;; Manual assemble to prevent compile warning
;; pop eax ;Recover Total Clus
;; push eax
db 066h,058h
db 066h,050h
;;
mul ecx ;EDX:EAX = Total Bytes
mov FdskSiz,eax
or edx,edx ;Disk >= 4Gig?
jz short NotHuge1 ;No
mov MegSizes,1
mov ebx,1024*1024
div ebx ; EAX is MEG, EDX remainder
mov FdskSiz,EAX
mov eax,edx
xor edx,edx
mov ebx,(1024 * 1024) / 100
div ebx
shr ebx,1
cmp edx,ebx
jb short NoRnd1
inc eax
NoRnd1:
mov fdsksizM100s,ax
cmp eax,100
jb short NotHuge1
inc FdskSiz
mov fdsksizM100s,0
NotHuge1:
;; Manual assemble to prevent compile warning
;; pop EDX ;get total clusters
;; pop EBX ;get avail clusters
db 066h,05Ah
db 066h,05Bh
;;
mov EAX,EDX ;get total clusters
sub EAX,EBX ;get bad+sys clusters
test fBig32FAT,0ffh
jz short NotFAT32
dec eax ;FAT32 volumes have one
; cluster allocated to the
; root dir
NotFAT32:
mul ecx ;EDX:EAX bad+sys bytes
sub EAX,SysSiz ;Remove sys bytes
sbb EDX,0
mov ecx,edx
or ecx,eax ;ECX != 0 if any bad clusters
mov badsiz,EAX
cmp MegSizes,0 ;Disk >= 4Gig?
je short NotHuge2 ;No
mov ebx,1024*1024
div ebx ;EAX is MEG, EDX remainder
mov badsiz,EAX
mov eax,edx
xor edx,edx
mov ebx,(1024 * 1024) / 100
div ebx
shr ebx,1
cmp edx,ebx
jb short NoRnd2
inc eax
NoRnd2:
mov badsizM100s,ax
cmp eax,100
jb short ChkZr
inc badsiz
mov badsizM100s,0
ChkZr:
cmp badsiz,0
jnz short NotHuge2
cmp badsizM100s,0
jnz short NotHuge2
or ecx,ecx ;Were there any bad clusters?
jz short NotHuge2 ;No
;
; There WERE bad clusters, but there were less than .01 MEG worth of them.
; Need to cheat so that the displayed count is != 0
;
inc badsizM100s
NotHuge2:
.8086
pop BX
pop DX ;restore regs
pop AX
ret
Calc_Total_Addressible_Space endp
;=========================================================================
; Get_Free_Space : Get the free space on the disk.
;
; Inputs : none
;
; Outputs : EBX - Available space in clusters
; EDX - Total space in clusters
;=========================================================================
Procedure Get_Free_Space
.386
push di
xor ebx,ebx
mov ax,(Get_Set_DriveInfo SHL 8) OR Get_ExtFreeSpace
mov cx,SIZE ExtGetDskFreSpcStruc
push ds
pop es
mov di,offset ExtFreePacket
mov DX,offset DriveLetter
int 21h
mov edx,ebx
jc short IsDone
mov ebx,[di.ExtFree_AvailableClusters]
mov edx,[di.ExtFree_TotalClusters]
.8086
IsDone:
pop di
ret
Get_Free_Space endp
;=========================================================================
; Calc_System_Space : This routine calculates the space occupied by
; the system on the disk.
;
; Inputs : BIOS.FileSizeInBytes
; Command.FileSizeInBytes
;
; Outputs : SysSiz - Size of the system
;=========================================================================
Procedure Calc_System_Space
push AX ;save regs
push DX
mov word ptr SysSiz+0,00h ;clear variable
mov word ptr SysSiz+2,00h
mov AX,word ptr [Dos.FileSizeInBytes+0] ;get dos size
mov DX,word ptr [Dos.FileSizeInBytes+2]
call AddToSystemSize ;add in values
mov AX,word ptr [Bios.FileSizeInBytes+0] ;get bios size
mov DX,word ptr [Bios.FileSizeInBytes+2]
call AddToSystemSize ;add in values
mov AX,word ptr [Command.FileSizeInBytes+0] ;get command size
mov DX,word ptr [Command.FileSizeInBytes+2]
call AddToSystemSize ;add in values
IFDEF DBLSPACE_HOOKS
mov ax, word ptr [DblSpaceBin.FileSizeInBytes] ;get dblspace
mov dx, word ptr [DblSpaceBin.FileSizeInBytes+2] ; size--may be
call AddToSystemSize ; zero
ENDIF
pop DX ;restore regs
pop AX
ret
Calc_System_Space endp
code ends
end
|
oeis/260/A260860.asm | neoneye/loda-programs | 11 | 89323 | ; A260860: Base-60 representation of a(n) is the concatenation of the base-60 representations of 1, 2, ..., n, n-1, ..., 1.
; 0,1,3721,13402921,48250954921,173703464074921,625332472251274921,2251196900199483274921,8104308840723833403274921,29175511826606141868603274921,105031842575782131223980603274921,378114633272815673636150700603274921
seq $0,269025 ; a(n) = Sum_{k = 0..n} 60^k.
sub $0,1
pow $0,2
div $0,3600
|
oeis/063/A063489.asm | neoneye/loda-programs | 11 | 177456 | <reponame>neoneye/loda-programs
; A063489: a(n) = (2*n-1)*(5*n^2-5*n+6)/6.
; Submitted by <NAME>
; 1,8,30,77,159,286,468,715,1037,1444,1946,2553,3275,4122,5104,6231,7513,8960,10582,12389,14391,16598,19020,21667,24549,27676,31058,34705,38627,42834,47336,52143,57265,62712,68494,74621,81103,87950,95172,102779,110781,119188,128010,137257,146939,157066,167648,178695,190217,202224,214726,227733,241255,255302,269884,285011,300693,316940,333762,351169,369171,387778,407000,426847,447329,468456,490238,512685,535807,559614,584116,609323,635245,661892,689274,717401,746283,775930,806352,837559,869561
mul $0,10
mov $1,$0
add $0,8
bin $0,3
sub $1,2
pow $1,2
sub $0,$1
mul $0,3
div $0,300
add $0,1
|
Task/Rosetta-Code-Count-examples/Ada/rosetta-code-count-examples.ada | djgoku/RosettaCodeData | 0 | 11155 | with Aws.Client, Aws.Messages, Aws.Response, Aws.Resources, Aws.Url;
with Dom.Readers, Dom.Core, Dom.Core.Documents, Dom.Core.Nodes, Dom.Core.Attrs;
with Input_Sources.Strings, Unicode, Unicode.Ces.Utf8;
with Ada.Strings.Unbounded, Ada.Strings.Fixed, Ada.Text_IO, Ada.Command_Line;
with Ada.Containers.Vectors;
use Aws.Client, Aws.Messages, Aws.Response, Aws.Resources, Aws.Url;
use Dom.Readers, Dom.Core, Dom.Core.Documents, Dom.Core.Nodes, Dom.Core.Attrs;
use Aws, Ada.Strings.Unbounded, Ada.Strings.Fixed, Input_Sources.Strings;
use Ada.Text_IO, Ada.Command_Line;
procedure Count_Examples is
package Members_Vectors is new Ada.Containers.Vectors (
Index_Type => Positive,
Element_Type => Unbounded_String);
use Members_Vectors;
Exemples : Vector;
Nbr_Lg, Total : Natural := 0;
procedure Get_Vector (Category : in String; Mbr_Vector : in out Vector) is
Reader : Tree_Reader;
Doc : Document;
List : Node_List;
N : Node;
A : Attr;
Page : Aws.Response.Data;
Uri_Xml : constant String :=
"http://rosettacode.org/mw/api.php?action=query&list=categorymembers"
&
"&format=xml&cmlimit=500&cmtitle=Category:";
begin
Page := Client.Get (Uri_Xml & Category);
if Response.Status_Code (Page) not in Messages.Success then
raise Client.Connection_Error;
end if;
declare
Xml : constant String := Message_Body (Page);
Source : String_Input;
begin
Open
(Xml'Unrestricted_Access,
Unicode.Ces.Utf8.Utf8_Encoding,
Source);
Parse (Reader, Source);
Close (Source);
end;
Doc := Get_Tree (Reader);
List := Get_Elements_By_Tag_Name (Doc, "cm");
for Index in 1 .. Length (List) loop
N := Item (List, Index - 1);
A := Get_Named_Item (Attributes (N), "title");
Append (Mbr_Vector, To_Unbounded_String (Value (A)));
end loop;
Free (List);
Free (Reader);
end Get_Vector;
function Scan_Page (Title : String) return Natural is
Page : Aws.Response.Data;
File : Aws.Resources.File_Type;
Buffer : String (1 .. 1024);
Languages, Position, Last : Natural := 0;
begin
Page :=
Client.Get
("http://rosettacode.org/mw/index.php?title=" &
Aws.Url.Encode (Title) &
"&action=raw");
Response.Message_Body (Page, File);
while not End_Of_File (File) loop
Resources.Get_Line (File, Buffer, Last);
Position :=
Index
(Source => Buffer (Buffer'First .. Last),
Pattern => "=={{header|");
if Position > 0 then
Languages := Languages + 1;
end if;
end loop;
Close (File);
return Languages;
end Scan_Page;
begin
Get_Vector ("Programming_Tasks", Exemples);
for I in First_Index (Exemples) .. Last_Index (Exemples) loop
declare
Title : constant String :=
To_String (Members_Vectors.Element (Exemples, I));
begin
Nbr_Lg := Scan_Page (Title);
Total := Total + Nbr_Lg;
Put_Line (Title & " :" & Integer'Image (Nbr_Lg) & " exemples.");
end;
end loop;
Put_Line ("Total :" & Integer'Image (Total) & " exemples.");
end Count_Examples;
|
agda-stdlib-0.9/src/Data/Vec.agda | qwe2/try-agda | 1 | 9359 | <filename>agda-stdlib-0.9/src/Data/Vec.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Vectors
------------------------------------------------------------------------
module Data.Vec where
open import Category.Applicative
open import Data.Nat
open import Data.Fin using (Fin; zero; suc)
open import Data.List as List using (List)
open import Data.Product as Prod using (∃; ∃₂; _×_; _,_)
open import Function
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
------------------------------------------------------------------------
-- Types
infixr 5 _∷_
data Vec {a} (A : Set a) : ℕ → Set a where
[] : Vec A zero
_∷_ : ∀ {n} (x : A) (xs : Vec A n) → Vec A (suc n)
infix 4 _∈_
data _∈_ {a} {A : Set a} : A → {n : ℕ} → Vec A n → Set a where
here : ∀ {n} {x} {xs : Vec A n} → x ∈ x ∷ xs
there : ∀ {n} {x y} {xs : Vec A n} (x∈xs : x ∈ xs) → x ∈ y ∷ xs
infix 4 _[_]=_
data _[_]=_ {a} {A : Set a} :
{n : ℕ} → Vec A n → Fin n → A → Set a where
here : ∀ {n} {x} {xs : Vec A n} → x ∷ xs [ zero ]= x
there : ∀ {n} {i} {x y} {xs : Vec A n}
(xs[i]=x : xs [ i ]= x) → y ∷ xs [ suc i ]= x
------------------------------------------------------------------------
-- Some operations
head : ∀ {a n} {A : Set a} → Vec A (1 + n) → A
head (x ∷ xs) = x
tail : ∀ {a n} {A : Set a} → Vec A (1 + n) → Vec A n
tail (x ∷ xs) = xs
[_] : ∀ {a} {A : Set a} → A → Vec A 1
[ x ] = x ∷ []
infixr 5 _++_
_++_ : ∀ {a m n} {A : Set a} → Vec A m → Vec A n → Vec A (m + n)
[] ++ ys = ys
(x ∷ xs) ++ ys = x ∷ (xs ++ ys)
infixl 4 _⊛_
_⊛_ : ∀ {a b n} {A : Set a} {B : Set b} →
Vec (A → B) n → Vec A n → Vec B n
[] ⊛ _ = []
(f ∷ fs) ⊛ (x ∷ xs) = f x ∷ (fs ⊛ xs)
replicate : ∀ {a n} {A : Set a} → A → Vec A n
replicate {n = zero} x = []
replicate {n = suc n} x = x ∷ replicate x
applicative : ∀ {a n} → RawApplicative (λ (A : Set a) → Vec A n)
applicative = record
{ pure = replicate
; _⊛_ = _⊛_
}
map : ∀ {a b n} {A : Set a} {B : Set b} →
(A → B) → Vec A n → Vec B n
map f xs = replicate f ⊛ xs
zipWith : ∀ {a b c n} {A : Set a} {B : Set b} {C : Set c} →
(A → B → C) → Vec A n → Vec B n → Vec C n
zipWith _⊕_ xs ys = replicate _⊕_ ⊛ xs ⊛ ys
zip : ∀ {a b n} {A : Set a} {B : Set b} →
Vec A n → Vec B n → Vec (A × B) n
zip = zipWith _,_
unzip : ∀ {a b n} {A : Set a} {B : Set b} →
Vec (A × B) n → Vec A n × Vec B n
unzip [] = [] , []
unzip ((x , y) ∷ xys) = Prod.map (_∷_ x) (_∷_ y) (unzip xys)
foldr : ∀ {a b} {A : Set a} (B : ℕ → Set b) {m} →
(∀ {n} → A → B n → B (suc n)) →
B zero →
Vec A m → B m
foldr b _⊕_ n [] = n
foldr b _⊕_ n (x ∷ xs) = x ⊕ foldr b _⊕_ n xs
foldr₁ : ∀ {a} {A : Set a} {m} →
(A → A → A) → Vec A (suc m) → A
foldr₁ _⊕_ (x ∷ []) = x
foldr₁ _⊕_ (x ∷ y ∷ ys) = x ⊕ foldr₁ _⊕_ (y ∷ ys)
foldl : ∀ {a b} {A : Set a} (B : ℕ → Set b) {m} →
(∀ {n} → B n → A → B (suc n)) →
B zero →
Vec A m → B m
foldl b _⊕_ n [] = n
foldl b _⊕_ n (x ∷ xs) = foldl (λ n → b (suc n)) _⊕_ (n ⊕ x) xs
foldl₁ : ∀ {a} {A : Set a} {m} →
(A → A → A) → Vec A (suc m) → A
foldl₁ _⊕_ (x ∷ xs) = foldl _ _⊕_ x xs
concat : ∀ {a m n} {A : Set a} →
Vec (Vec A m) n → Vec A (n * m)
concat [] = []
concat (xs ∷ xss) = xs ++ concat xss
splitAt : ∀ {a} {A : Set a} m {n} (xs : Vec A (m + n)) →
∃₂ λ (ys : Vec A m) (zs : Vec A n) → xs ≡ ys ++ zs
splitAt zero xs = ([] , xs , refl)
splitAt (suc m) (x ∷ xs) with splitAt m xs
splitAt (suc m) (x ∷ .(ys ++ zs)) | (ys , zs , refl) =
((x ∷ ys) , zs , refl)
take : ∀ {a} {A : Set a} m {n} → Vec A (m + n) → Vec A m
take m xs with splitAt m xs
take m .(ys ++ zs) | (ys , zs , refl) = ys
drop : ∀ {a} {A : Set a} m {n} → Vec A (m + n) → Vec A n
drop m xs with splitAt m xs
drop m .(ys ++ zs) | (ys , zs , refl) = zs
group : ∀ {a} {A : Set a} n k (xs : Vec A (n * k)) →
∃ λ (xss : Vec (Vec A k) n) → xs ≡ concat xss
group zero k [] = ([] , refl)
group (suc n) k xs with splitAt k xs
group (suc n) k .(ys ++ zs) | (ys , zs , refl) with group n k zs
group (suc n) k .(ys ++ concat zss) | (ys , ._ , refl) | (zss , refl) =
((ys ∷ zss) , refl)
-- Splits a vector into two "halves".
split : ∀ {a n} {A : Set a} → Vec A n → Vec A ⌈ n /2⌉ × Vec A ⌊ n /2⌋
split [] = ([] , [])
split (x ∷ []) = (x ∷ [] , [])
split (x ∷ y ∷ xs) = Prod.map (_∷_ x) (_∷_ y) (split xs)
reverse : ∀ {a n} {A : Set a} → Vec A n → Vec A n
reverse {A = A} = foldl (Vec A) (λ rev x → x ∷ rev) []
sum : ∀ {n} → Vec ℕ n → ℕ
sum = foldr _ _+_ 0
toList : ∀ {a n} {A : Set a} → Vec A n → List A
toList [] = List.[]
toList (x ∷ xs) = List._∷_ x (toList xs)
fromList : ∀ {a} {A : Set a} → (xs : List A) → Vec A (List.length xs)
fromList List.[] = []
fromList (List._∷_ x xs) = x ∷ fromList xs
-- Snoc.
infixl 5 _∷ʳ_
_∷ʳ_ : ∀ {a n} {A : Set a} → Vec A n → A → Vec A (1 + n)
[] ∷ʳ y = [ y ]
(x ∷ xs) ∷ʳ y = x ∷ (xs ∷ʳ y)
initLast : ∀ {a n} {A : Set a} (xs : Vec A (1 + n)) →
∃₂ λ (ys : Vec A n) (y : A) → xs ≡ ys ∷ʳ y
initLast {n = zero} (x ∷ []) = ([] , x , refl)
initLast {n = suc n} (x ∷ xs) with initLast xs
initLast {n = suc n} (x ∷ .(ys ∷ʳ y)) | (ys , y , refl) =
((x ∷ ys) , y , refl)
init : ∀ {a n} {A : Set a} → Vec A (1 + n) → Vec A n
init xs with initLast xs
init .(ys ∷ʳ y) | (ys , y , refl) = ys
last : ∀ {a n} {A : Set a} → Vec A (1 + n) → A
last xs with initLast xs
last .(ys ∷ʳ y) | (ys , y , refl) = y
infixl 1 _>>=_
_>>=_ : ∀ {a b m n} {A : Set a} {B : Set b} →
Vec A m → (A → Vec B n) → Vec B (m * n)
xs >>= f = concat (map f xs)
infixl 4 _⊛*_
_⊛*_ : ∀ {a b m n} {A : Set a} {B : Set b} →
Vec (A → B) m → Vec A n → Vec B (m * n)
fs ⊛* xs = fs >>= λ f → map f xs
-- Interleaves the two vectors.
infixr 5 _⋎_
_⋎_ : ∀ {a m n} {A : Set a} →
Vec A m → Vec A n → Vec A (m +⋎ n)
[] ⋎ ys = ys
(x ∷ xs) ⋎ ys = x ∷ (ys ⋎ xs)
-- A lookup function.
lookup : ∀ {a n} {A : Set a} → Fin n → Vec A n → A
lookup zero (x ∷ xs) = x
lookup (suc i) (x ∷ xs) = lookup i xs
-- An inverse of flip lookup.
tabulate : ∀ {n a} {A : Set a} → (Fin n → A) → Vec A n
tabulate {zero} f = []
tabulate {suc n} f = f zero ∷ tabulate (f ∘ suc)
-- Update.
infixl 6 _[_]≔_
_[_]≔_ : ∀ {a n} {A : Set a} → Vec A n → Fin n → A → Vec A n
[] [ () ]≔ y
(x ∷ xs) [ zero ]≔ y = y ∷ xs
(x ∷ xs) [ suc i ]≔ y = x ∷ xs [ i ]≔ y
-- Generates a vector containing all elements in Fin n. This function
-- is not placed in Data.Fin because Data.Vec depends on Data.Fin.
--
-- The implementation was suggested by <NAME> ("Fwd: how to
-- count 0..n-1", http://thread.gmane.org/gmane.comp.lang.agda/2554).
allFin : ∀ n → Vec (Fin n) n
allFin _ = tabulate id
|
oeis/017/A017127.asm | neoneye/loda-programs | 11 | 91393 | <reponame>neoneye/loda-programs
; A017127: a(n) = (8*n + 5)^3.
; 125,2197,9261,24389,50653,91125,148877,226981,328509,456533,614125,804357,1030301,1295029,1601613,1953125,2352637,2803221,3307949,3869893,4492125,5177717,5929741,6751269,7645373,8615125,9663597,10793861,12008989,13312053,14706125,16194277,17779581,19465109,21253933,23149125,25153757,27270901,29503629,31855013,34328125,36926037,39651821,42508549,45499293,48627125,51895117,55306341,58863869,62570773,66430125,70444997,74618461,78953589,83453453,88121125,92959677,97972181,103161709,108531333
mul $0,8
add $0,5
pow $0,3
|
oeis/010/A010636.asm | neoneye/loda-programs | 11 | 171912 | <filename>oeis/010/A010636.asm
; A010636: Decimal expansion of cube root of 66.
; Submitted by <NAME>
; 4,0,4,1,2,4,0,0,2,0,6,2,2,1,9,0,2,7,0,8,0,1,9,9,0,0,7,4,6,3,4,2,6,2,1,1,3,3,7,2,3,0,9,8,1,8,4,4,9,8,2,3,6,9,2,9,8,8,8,2,4,5,7,4,9,2,1,2,2,1,6,4,0,0,9,2,4,8,8,7,7,5,5,1,5,7,4,3,1,0,9,0,4,0,1,1,3,4,3,9
mov $3,$0
mul $3,2
lpb $3
add $6,$2
add $1,$6
add $1,$2
add $1,64
mov $2,$1
mul $2,32
sub $3,1
add $5,$2
add $6,$5
lpe
mov $1,$5
mov $4,10
pow $4,$0
mul $4,4
div $2,$4
add $2,1
div $1,$2
mov $0,$1
add $0,$4
mod $0,10
|
osx/applescripts/iterm-new-window.applescript | yjpark/dotfiles | 7 | 4432 | <filename>osx/applescripts/iterm-new-window.applescript
#! /usr/bin/osascript
on run argv
tell app "iTerm2"
create window with default profile
activate
end
end run
|
test/Succeed/Issue1610.agda | cruhland/agda | 1,989 | 8304 |
postulate Name : Set
{-# BUILTIN QNAME Name #-}
data ⊤ : Set where
tt : ⊤
data Term : Set where
con : Name → Term → Term
data X : ⊤ → Set where
x : {t : ⊤} → X t
data Y : Set where
y : Y
-- this type checks
g : {t : ⊤} → Term → X t
g {t} (con nm args) = x {t}
-- this doesn't
f : {t : ⊤} → Term → X t
f {t} (con (quote Y.y) args) = x {t}
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-- offending line is above
f t = x
-- t != args of type ⊤
-- when checking that the expression x {t} has type X args
|
wc.asm | adrianna157/CS444-Lab5-Mutexes | 0 | 244639 | <gh_stars>0
_wc: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
printf(1, "%d %d %d %s\n", l, w, c, name);
}
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 57 push %edi
4: 56 push %esi
int fd, i;
if(argc <= 1){
5: be 01 00 00 00 mov $0x1,%esi
{
a: 53 push %ebx
b: 83 e4 f0 and $0xfffffff0,%esp
e: 83 ec 10 sub $0x10,%esp
11: 8b 45 0c mov 0xc(%ebp),%eax
if(argc <= 1){
14: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
18: 8d 58 04 lea 0x4(%eax),%ebx
1b: 7e 60 jle 7d <main+0x7d>
1d: 8d 76 00 lea 0x0(%esi),%esi
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
20: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
27: 00
28: 8b 03 mov (%ebx),%eax
2a: 89 04 24 mov %eax,(%esp)
2d: e8 c0 03 00 00 call 3f2 <open>
32: 85 c0 test %eax,%eax
34: 89 c7 mov %eax,%edi
36: 78 26 js 5e <main+0x5e>
printf(1, "wc: cannot open %s\n", argv[i]);
exit();
}
wc(fd, argv[i]);
38: 8b 13 mov (%ebx),%edx
for(i = 1; i < argc; i++){
3a: 83 c6 01 add $0x1,%esi
3d: 83 c3 04 add $0x4,%ebx
wc(fd, argv[i]);
40: 89 04 24 mov %eax,(%esp)
43: 89 54 24 04 mov %edx,0x4(%esp)
47: e8 54 00 00 00 call a0 <wc>
close(fd);
4c: 89 3c 24 mov %edi,(%esp)
4f: e8 86 03 00 00 call 3da <close>
for(i = 1; i < argc; i++){
54: 3b 75 08 cmp 0x8(%ebp),%esi
57: 75 c7 jne 20 <main+0x20>
}
exit();
59: e8 54 03 00 00 call 3b2 <exit>
printf(1, "wc: cannot open %s\n", argv[i]);
5e: 8b 03 mov (%ebx),%eax
60: c7 44 24 04 8c 0b 00 movl $0xb8c,0x4(%esp)
67: 00
68: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6f: 89 44 24 08 mov %eax,0x8(%esp)
73: e8 e8 04 00 00 call 560 <printf>
exit();
78: e8 35 03 00 00 call 3b2 <exit>
wc(0, "");
7d: c7 44 24 04 7e 0b 00 movl $0xb7e,0x4(%esp)
84: 00
85: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8c: e8 0f 00 00 00 call a0 <wc>
exit();
91: e8 1c 03 00 00 call 3b2 <exit>
96: 66 90 xchg %ax,%ax
98: 66 90 xchg %ax,%ax
9a: 66 90 xchg %ax,%ax
9c: 66 90 xchg %ax,%ax
9e: 66 90 xchg %ax,%ax
000000a0 <wc>:
{
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 57 push %edi
a4: 56 push %esi
inword = 0;
a5: 31 f6 xor %esi,%esi
{
a7: 53 push %ebx
l = w = c = 0;
a8: 31 db xor %ebx,%ebx
{
aa: 83 ec 3c sub $0x3c,%esp
l = w = c = 0;
ad: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
b4: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
bb: 90 nop
bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf, sizeof(buf))) > 0){
c0: 8b 45 08 mov 0x8(%ebp),%eax
c3: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
ca: 00
cb: c7 44 24 04 a0 10 00 movl $0x10a0,0x4(%esp)
d2: 00
d3: 89 04 24 mov %eax,(%esp)
d6: e8 ef 02 00 00 call 3ca <read>
db: 83 f8 00 cmp $0x0,%eax
de: 89 45 e4 mov %eax,-0x1c(%ebp)
e1: 7e 54 jle 137 <wc+0x97>
e3: 31 ff xor %edi,%edi
e5: eb 0b jmp f2 <wc+0x52>
e7: 90 nop
inword = 0;
e8: 31 f6 xor %esi,%esi
for(i=0; i<n; i++){
ea: 83 c7 01 add $0x1,%edi
ed: 3b 7d e4 cmp -0x1c(%ebp),%edi
f0: 74 38 je 12a <wc+0x8a>
if(buf[i] == '\n')
f2: 0f be 87 a0 10 00 00 movsbl 0x10a0(%edi),%eax
l++;
f9: 31 c9 xor %ecx,%ecx
if(strchr(" \r\t\n\v", buf[i]))
fb: c7 04 24 69 0b 00 00 movl $0xb69,(%esp)
l++;
102: 3c 0a cmp $0xa,%al
104: 0f 94 c1 sete %cl
if(strchr(" \r\t\n\v", buf[i]))
107: 89 44 24 04 mov %eax,0x4(%esp)
l++;
10b: 01 cb add %ecx,%ebx
if(strchr(" \r\t\n\v", buf[i]))
10d: e8 4e 01 00 00 call 260 <strchr>
112: 85 c0 test %eax,%eax
114: 75 d2 jne e8 <wc+0x48>
else if(!inword){
116: 85 f6 test %esi,%esi
118: 75 16 jne 130 <wc+0x90>
w++;
11a: 83 45 e0 01 addl $0x1,-0x20(%ebp)
for(i=0; i<n; i++){
11e: 83 c7 01 add $0x1,%edi
121: 3b 7d e4 cmp -0x1c(%ebp),%edi
inword = 1;
124: 66 be 01 00 mov $0x1,%si
for(i=0; i<n; i++){
128: 75 c8 jne f2 <wc+0x52>
12a: 01 7d dc add %edi,-0x24(%ebp)
12d: eb 91 jmp c0 <wc+0x20>
12f: 90 nop
130: be 01 00 00 00 mov $0x1,%esi
135: eb b3 jmp ea <wc+0x4a>
if(n < 0){
137: 75 35 jne 16e <wc+0xce>
printf(1, "%d %d %d %s\n", l, w, c, name);
139: 8b 45 0c mov 0xc(%ebp),%eax
13c: 89 5c 24 08 mov %ebx,0x8(%esp)
140: c7 44 24 04 7f 0b 00 movl $0xb7f,0x4(%esp)
147: 00
148: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14f: 89 44 24 14 mov %eax,0x14(%esp)
153: 8b 45 dc mov -0x24(%ebp),%eax
156: 89 44 24 10 mov %eax,0x10(%esp)
15a: 8b 45 e0 mov -0x20(%ebp),%eax
15d: 89 44 24 0c mov %eax,0xc(%esp)
161: e8 fa 03 00 00 call 560 <printf>
}
166: 83 c4 3c add $0x3c,%esp
169: 5b pop %ebx
16a: 5e pop %esi
16b: 5f pop %edi
16c: 5d pop %ebp
16d: c3 ret
printf(1, "wc: read error\n");
16e: c7 44 24 04 6f 0b 00 movl $0xb6f,0x4(%esp)
175: 00
176: c7 04 24 01 00 00 00 movl $0x1,(%esp)
17d: e8 de 03 00 00 call 560 <printf>
exit();
182: e8 2b 02 00 00 call 3b2 <exit>
187: 66 90 xchg %ax,%ax
189: 66 90 xchg %ax,%ax
18b: 66 90 xchg %ax,%ax
18d: 66 90 xchg %ax,%ax
18f: 90 nop
00000190 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 8b 45 08 mov 0x8(%ebp),%eax
196: 8b 4d 0c mov 0xc(%ebp),%ecx
199: 53 push %ebx
char *os;
os = s;
while((*s++ = *t++) != 0)
19a: 89 c2 mov %eax,%edx
19c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1a0: 83 c1 01 add $0x1,%ecx
1a3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
1a7: 83 c2 01 add $0x1,%edx
1aa: 84 db test %bl,%bl
1ac: 88 5a ff mov %bl,-0x1(%edx)
1af: 75 ef jne 1a0 <strcpy+0x10>
;
return os;
}
1b1: 5b pop %ebx
1b2: 5d pop %ebp
1b3: c3 ret
1b4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1ba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000001c0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1c0: 55 push %ebp
1c1: 89 e5 mov %esp,%ebp
1c3: 8b 55 08 mov 0x8(%ebp),%edx
1c6: 53 push %ebx
1c7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
1ca: 0f b6 02 movzbl (%edx),%eax
1cd: 84 c0 test %al,%al
1cf: 74 2d je 1fe <strcmp+0x3e>
1d1: 0f b6 19 movzbl (%ecx),%ebx
1d4: 38 d8 cmp %bl,%al
1d6: 74 0e je 1e6 <strcmp+0x26>
1d8: eb 2b jmp 205 <strcmp+0x45>
1da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1e0: 38 c8 cmp %cl,%al
1e2: 75 15 jne 1f9 <strcmp+0x39>
p++, q++;
1e4: 89 d9 mov %ebx,%ecx
1e6: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
1e9: 0f b6 02 movzbl (%edx),%eax
p++, q++;
1ec: 8d 59 01 lea 0x1(%ecx),%ebx
while(*p && *p == *q)
1ef: 0f b6 49 01 movzbl 0x1(%ecx),%ecx
1f3: 84 c0 test %al,%al
1f5: 75 e9 jne 1e0 <strcmp+0x20>
1f7: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
1f9: 29 c8 sub %ecx,%eax
}
1fb: 5b pop %ebx
1fc: 5d pop %ebp
1fd: c3 ret
1fe: 0f b6 09 movzbl (%ecx),%ecx
while(*p && *p == *q)
201: 31 c0 xor %eax,%eax
203: eb f4 jmp 1f9 <strcmp+0x39>
205: 0f b6 cb movzbl %bl,%ecx
208: eb ef jmp 1f9 <strcmp+0x39>
20a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000210 <strlen>:
uint
strlen(const char *s)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
216: 80 39 00 cmpb $0x0,(%ecx)
219: 74 12 je 22d <strlen+0x1d>
21b: 31 d2 xor %edx,%edx
21d: 8d 76 00 lea 0x0(%esi),%esi
220: 83 c2 01 add $0x1,%edx
223: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
227: 89 d0 mov %edx,%eax
229: 75 f5 jne 220 <strlen+0x10>
;
return n;
}
22b: 5d pop %ebp
22c: c3 ret
for(n = 0; s[n]; n++)
22d: 31 c0 xor %eax,%eax
}
22f: 5d pop %ebp
230: c3 ret
231: eb 0d jmp 240 <memset>
233: 90 nop
234: 90 nop
235: 90 nop
236: 90 nop
237: 90 nop
238: 90 nop
239: 90 nop
23a: 90 nop
23b: 90 nop
23c: 90 nop
23d: 90 nop
23e: 90 nop
23f: 90 nop
00000240 <memset>:
void*
memset(void *dst, int c, uint n)
{
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
243: 8b 55 08 mov 0x8(%ebp),%edx
246: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
247: 8b 4d 10 mov 0x10(%ebp),%ecx
24a: 8b 45 0c mov 0xc(%ebp),%eax
24d: 89 d7 mov %edx,%edi
24f: fc cld
250: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
252: 89 d0 mov %edx,%eax
254: 5f pop %edi
255: 5d pop %ebp
256: c3 ret
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <strchr>:
char*
strchr(const char *s, char c)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 8b 45 08 mov 0x8(%ebp),%eax
266: 53 push %ebx
267: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
26a: 0f b6 18 movzbl (%eax),%ebx
26d: 84 db test %bl,%bl
26f: 74 1d je 28e <strchr+0x2e>
if(*s == c)
271: 38 d3 cmp %dl,%bl
273: 89 d1 mov %edx,%ecx
275: 75 0d jne 284 <strchr+0x24>
277: eb 17 jmp 290 <strchr+0x30>
279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
280: 38 ca cmp %cl,%dl
282: 74 0c je 290 <strchr+0x30>
for(; *s; s++)
284: 83 c0 01 add $0x1,%eax
287: 0f b6 10 movzbl (%eax),%edx
28a: 84 d2 test %dl,%dl
28c: 75 f2 jne 280 <strchr+0x20>
return (char*)s;
return 0;
28e: 31 c0 xor %eax,%eax
}
290: 5b pop %ebx
291: 5d pop %ebp
292: c3 ret
293: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002a0 <gets>:
char*
gets(char *buf, int max)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 57 push %edi
2a4: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
2a5: 31 f6 xor %esi,%esi
{
2a7: 53 push %ebx
2a8: 83 ec 2c sub $0x2c,%esp
cc = read(0, &c, 1);
2ab: 8d 7d e7 lea -0x19(%ebp),%edi
for(i=0; i+1 < max; ){
2ae: eb 31 jmp 2e1 <gets+0x41>
cc = read(0, &c, 1);
2b0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
2b7: 00
2b8: 89 7c 24 04 mov %edi,0x4(%esp)
2bc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2c3: e8 02 01 00 00 call 3ca <read>
if(cc < 1)
2c8: 85 c0 test %eax,%eax
2ca: 7e 1d jle 2e9 <gets+0x49>
break;
buf[i++] = c;
2cc: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
for(i=0; i+1 < max; ){
2d0: 89 de mov %ebx,%esi
buf[i++] = c;
2d2: 8b 55 08 mov 0x8(%ebp),%edx
if(c == '\n' || c == '\r')
2d5: 3c 0d cmp $0xd,%al
buf[i++] = c;
2d7: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
2db: 74 0c je 2e9 <gets+0x49>
2dd: 3c 0a cmp $0xa,%al
2df: 74 08 je 2e9 <gets+0x49>
for(i=0; i+1 < max; ){
2e1: 8d 5e 01 lea 0x1(%esi),%ebx
2e4: 3b 5d 0c cmp 0xc(%ebp),%ebx
2e7: 7c c7 jl 2b0 <gets+0x10>
break;
}
buf[i] = '\0';
2e9: 8b 45 08 mov 0x8(%ebp),%eax
2ec: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
2f0: 83 c4 2c add $0x2c,%esp
2f3: 5b pop %ebx
2f4: 5e pop %esi
2f5: 5f pop %edi
2f6: 5d pop %ebp
2f7: c3 ret
2f8: 90 nop
2f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000300 <stat>:
int
stat(const char *n, struct stat *st)
{
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 56 push %esi
304: 53 push %ebx
305: 83 ec 10 sub $0x10,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
308: 8b 45 08 mov 0x8(%ebp),%eax
30b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
312: 00
313: 89 04 24 mov %eax,(%esp)
316: e8 d7 00 00 00 call 3f2 <open>
if(fd < 0)
31b: 85 c0 test %eax,%eax
fd = open(n, O_RDONLY);
31d: 89 c3 mov %eax,%ebx
if(fd < 0)
31f: 78 27 js 348 <stat+0x48>
return -1;
r = fstat(fd, st);
321: 8b 45 0c mov 0xc(%ebp),%eax
324: 89 1c 24 mov %ebx,(%esp)
327: 89 44 24 04 mov %eax,0x4(%esp)
32b: e8 da 00 00 00 call 40a <fstat>
close(fd);
330: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
333: 89 c6 mov %eax,%esi
close(fd);
335: e8 a0 00 00 00 call 3da <close>
return r;
33a: 89 f0 mov %esi,%eax
}
33c: 83 c4 10 add $0x10,%esp
33f: 5b pop %ebx
340: 5e pop %esi
341: 5d pop %ebp
342: c3 ret
343: 90 nop
344: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
348: b8 ff ff ff ff mov $0xffffffff,%eax
34d: eb ed jmp 33c <stat+0x3c>
34f: 90 nop
00000350 <atoi>:
int
atoi(const char *s)
{
350: 55 push %ebp
351: 89 e5 mov %esp,%ebp
353: 8b 4d 08 mov 0x8(%ebp),%ecx
356: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
357: 0f be 11 movsbl (%ecx),%edx
35a: 8d 42 d0 lea -0x30(%edx),%eax
35d: 3c 09 cmp $0x9,%al
n = 0;
35f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
364: 77 17 ja 37d <atoi+0x2d>
366: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
368: 83 c1 01 add $0x1,%ecx
36b: 8d 04 80 lea (%eax,%eax,4),%eax
36e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
372: 0f be 11 movsbl (%ecx),%edx
375: 8d 5a d0 lea -0x30(%edx),%ebx
378: 80 fb 09 cmp $0x9,%bl
37b: 76 eb jbe 368 <atoi+0x18>
return n;
}
37d: 5b pop %ebx
37e: 5d pop %ebp
37f: c3 ret
00000380 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
380: 55 push %ebp
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
381: 31 d2 xor %edx,%edx
{
383: 89 e5 mov %esp,%ebp
385: 56 push %esi
386: 8b 45 08 mov 0x8(%ebp),%eax
389: 53 push %ebx
38a: 8b 5d 10 mov 0x10(%ebp),%ebx
38d: 8b 75 0c mov 0xc(%ebp),%esi
while(n-- > 0)
390: 85 db test %ebx,%ebx
392: 7e 12 jle 3a6 <memmove+0x26>
394: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
398: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
39c: 88 0c 10 mov %cl,(%eax,%edx,1)
39f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
3a2: 39 da cmp %ebx,%edx
3a4: 75 f2 jne 398 <memmove+0x18>
return vdst;
}
3a6: 5b pop %ebx
3a7: 5e pop %esi
3a8: 5d pop %ebp
3a9: c3 ret
000003aa <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3aa: b8 01 00 00 00 mov $0x1,%eax
3af: cd 40 int $0x40
3b1: c3 ret
000003b2 <exit>:
SYSCALL(exit)
3b2: b8 02 00 00 00 mov $0x2,%eax
3b7: cd 40 int $0x40
3b9: c3 ret
000003ba <wait>:
SYSCALL(wait)
3ba: b8 03 00 00 00 mov $0x3,%eax
3bf: cd 40 int $0x40
3c1: c3 ret
000003c2 <pipe>:
SYSCALL(pipe)
3c2: b8 04 00 00 00 mov $0x4,%eax
3c7: cd 40 int $0x40
3c9: c3 ret
000003ca <read>:
SYSCALL(read)
3ca: b8 05 00 00 00 mov $0x5,%eax
3cf: cd 40 int $0x40
3d1: c3 ret
000003d2 <write>:
SYSCALL(write)
3d2: b8 10 00 00 00 mov $0x10,%eax
3d7: cd 40 int $0x40
3d9: c3 ret
000003da <close>:
SYSCALL(close)
3da: b8 15 00 00 00 mov $0x15,%eax
3df: cd 40 int $0x40
3e1: c3 ret
000003e2 <kill>:
SYSCALL(kill)
3e2: b8 06 00 00 00 mov $0x6,%eax
3e7: cd 40 int $0x40
3e9: c3 ret
000003ea <exec>:
SYSCALL(exec)
3ea: b8 07 00 00 00 mov $0x7,%eax
3ef: cd 40 int $0x40
3f1: c3 ret
000003f2 <open>:
SYSCALL(open)
3f2: b8 0f 00 00 00 mov $0xf,%eax
3f7: cd 40 int $0x40
3f9: c3 ret
000003fa <mknod>:
SYSCALL(mknod)
3fa: b8 11 00 00 00 mov $0x11,%eax
3ff: cd 40 int $0x40
401: c3 ret
00000402 <unlink>:
SYSCALL(unlink)
402: b8 12 00 00 00 mov $0x12,%eax
407: cd 40 int $0x40
409: c3 ret
0000040a <fstat>:
SYSCALL(fstat)
40a: b8 08 00 00 00 mov $0x8,%eax
40f: cd 40 int $0x40
411: c3 ret
00000412 <link>:
SYSCALL(link)
412: b8 13 00 00 00 mov $0x13,%eax
417: cd 40 int $0x40
419: c3 ret
0000041a <mkdir>:
SYSCALL(mkdir)
41a: b8 14 00 00 00 mov $0x14,%eax
41f: cd 40 int $0x40
421: c3 ret
00000422 <chdir>:
SYSCALL(chdir)
422: b8 09 00 00 00 mov $0x9,%eax
427: cd 40 int $0x40
429: c3 ret
0000042a <dup>:
SYSCALL(dup)
42a: b8 0a 00 00 00 mov $0xa,%eax
42f: cd 40 int $0x40
431: c3 ret
00000432 <getpid>:
SYSCALL(getpid)
432: b8 0b 00 00 00 mov $0xb,%eax
437: cd 40 int $0x40
439: c3 ret
0000043a <sbrk>:
SYSCALL(sbrk)
43a: b8 0c 00 00 00 mov $0xc,%eax
43f: cd 40 int $0x40
441: c3 ret
00000442 <sleep>:
SYSCALL(sleep)
442: b8 0d 00 00 00 mov $0xd,%eax
447: cd 40 int $0x40
449: c3 ret
0000044a <uptime>:
SYSCALL(uptime)
44a: b8 0e 00 00 00 mov $0xe,%eax
44f: cd 40 int $0x40
451: c3 ret
00000452 <getppid>:
#ifdef GETPPID
SYSCALL(getppid)
452: b8 16 00 00 00 mov $0x16,%eax
457: cd 40 int $0x40
459: c3 ret
0000045a <cps>:
#endif // GETPPID
#ifdef CPS
SYSCALL(cps)
45a: b8 17 00 00 00 mov $0x17,%eax
45f: cd 40 int $0x40
461: c3 ret
00000462 <halt>:
#endif // CPS
#ifdef HALT
SYSCALL(halt)
462: b8 18 00 00 00 mov $0x18,%eax
467: cd 40 int $0x40
469: c3 ret
0000046a <kdebug>:
#endif // HALT
#ifdef KDEBUG
SYSCALL(kdebug)
46a: b8 19 00 00 00 mov $0x19,%eax
46f: cd 40 int $0x40
471: c3 ret
00000472 <va2pa>:
#endif // KDEBUG
#ifdef VA2PA
SYSCALL(va2pa)
472: b8 1a 00 00 00 mov $0x1a,%eax
477: cd 40 int $0x40
479: c3 ret
0000047a <kthread_create>:
#endif // VA2PA
#ifdef KTHREADS
SYSCALL(kthread_create)
47a: b8 1b 00 00 00 mov $0x1b,%eax
47f: cd 40 int $0x40
481: c3 ret
00000482 <kthread_join>:
SYSCALL(kthread_join)
482: b8 1c 00 00 00 mov $0x1c,%eax
487: cd 40 int $0x40
489: c3 ret
0000048a <kthread_exit>:
SYSCALL(kthread_exit)
48a: b8 1d 00 00 00 mov $0x1d,%eax
48f: cd 40 int $0x40
491: c3 ret
00000492 <kthread_self>:
#endif // KTHREADS
#ifdef BENNY_MOOTEX
SYSCALL(kthread_self)
492: b8 1e 00 00 00 mov $0x1e,%eax
497: cd 40 int $0x40
499: c3 ret
0000049a <kthread_yield>:
SYSCALL(kthread_yield)
49a: b8 1f 00 00 00 mov $0x1f,%eax
49f: cd 40 int $0x40
4a1: c3 ret
000004a2 <kthread_cpu_count>:
SYSCALL(kthread_cpu_count)
4a2: b8 20 00 00 00 mov $0x20,%eax
4a7: cd 40 int $0x40
4a9: c3 ret
000004aa <kthread_thread_count>:
SYSCALL(kthread_thread_count)
4aa: b8 21 00 00 00 mov $0x21,%eax
4af: cd 40 int $0x40
4b1: c3 ret
4b2: 66 90 xchg %ax,%ax
4b4: 66 90 xchg %ax,%ax
4b6: 66 90 xchg %ax,%ax
4b8: 66 90 xchg %ax,%ax
4ba: 66 90 xchg %ax,%ax
4bc: 66 90 xchg %ax,%ax
4be: 66 90 xchg %ax,%ax
000004c0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
4c0: 55 push %ebp
4c1: 89 e5 mov %esp,%ebp
4c3: 57 push %edi
4c4: 56 push %esi
4c5: 89 c6 mov %eax,%esi
4c7: 53 push %ebx
4c8: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
4cb: 8b 5d 08 mov 0x8(%ebp),%ebx
4ce: 85 db test %ebx,%ebx
4d0: 74 09 je 4db <printint+0x1b>
4d2: 89 d0 mov %edx,%eax
4d4: c1 e8 1f shr $0x1f,%eax
4d7: 84 c0 test %al,%al
4d9: 75 75 jne 550 <printint+0x90>
neg = 1;
x = -xx;
} else {
x = xx;
4db: 89 d0 mov %edx,%eax
neg = 0;
4dd: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
4e4: 89 75 c0 mov %esi,-0x40(%ebp)
}
i = 0;
4e7: 31 ff xor %edi,%edi
4e9: 89 ce mov %ecx,%esi
4eb: 8d 5d d7 lea -0x29(%ebp),%ebx
4ee: eb 02 jmp 4f2 <printint+0x32>
do{
buf[i++] = digits[x % base];
4f0: 89 cf mov %ecx,%edi
4f2: 31 d2 xor %edx,%edx
4f4: f7 f6 div %esi
4f6: 8d 4f 01 lea 0x1(%edi),%ecx
4f9: 0f b6 92 a7 0b 00 00 movzbl 0xba7(%edx),%edx
}while((x /= base) != 0);
500: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
502: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
505: 75 e9 jne 4f0 <printint+0x30>
if(neg)
507: 8b 55 c4 mov -0x3c(%ebp),%edx
buf[i++] = digits[x % base];
50a: 89 c8 mov %ecx,%eax
50c: 8b 75 c0 mov -0x40(%ebp),%esi
if(neg)
50f: 85 d2 test %edx,%edx
511: 74 08 je 51b <printint+0x5b>
buf[i++] = '-';
513: 8d 4f 02 lea 0x2(%edi),%ecx
516: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
51b: 8d 79 ff lea -0x1(%ecx),%edi
51e: 66 90 xchg %ax,%ax
520: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
525: 83 ef 01 sub $0x1,%edi
write(fd, &c, 1);
528: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
52f: 00
530: 89 5c 24 04 mov %ebx,0x4(%esp)
534: 89 34 24 mov %esi,(%esp)
537: 88 45 d7 mov %al,-0x29(%ebp)
53a: e8 93 fe ff ff call 3d2 <write>
while(--i >= 0)
53f: 83 ff ff cmp $0xffffffff,%edi
542: 75 dc jne 520 <printint+0x60>
putc(fd, buf[i]);
}
544: 83 c4 4c add $0x4c,%esp
547: 5b pop %ebx
548: 5e pop %esi
549: 5f pop %edi
54a: 5d pop %ebp
54b: c3 ret
54c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
x = -xx;
550: 89 d0 mov %edx,%eax
552: f7 d8 neg %eax
neg = 1;
554: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
55b: eb 87 jmp 4e4 <printint+0x24>
55d: 8d 76 00 lea 0x0(%esi),%esi
00000560 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
560: 55 push %ebp
561: 89 e5 mov %esp,%ebp
563: 57 push %edi
char *s;
int c, i, state;
uint *ap;
state = 0;
564: 31 ff xor %edi,%edi
{
566: 56 push %esi
567: 53 push %ebx
568: 83 ec 3c sub $0x3c,%esp
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
56b: 8b 5d 0c mov 0xc(%ebp),%ebx
ap = (uint*)(void*)&fmt + 1;
56e: 8d 45 10 lea 0x10(%ebp),%eax
{
571: 8b 75 08 mov 0x8(%ebp),%esi
ap = (uint*)(void*)&fmt + 1;
574: 89 45 d4 mov %eax,-0x2c(%ebp)
for(i = 0; fmt[i]; i++){
577: 0f b6 13 movzbl (%ebx),%edx
57a: 83 c3 01 add $0x1,%ebx
57d: 84 d2 test %dl,%dl
57f: 75 39 jne 5ba <printf+0x5a>
581: e9 ca 00 00 00 jmp 650 <printf+0xf0>
586: 66 90 xchg %ax,%ax
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
588: 83 fa 25 cmp $0x25,%edx
58b: 0f 84 c7 00 00 00 je 658 <printf+0xf8>
write(fd, &c, 1);
591: 8d 45 e0 lea -0x20(%ebp),%eax
594: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
59b: 00
59c: 89 44 24 04 mov %eax,0x4(%esp)
5a0: 89 34 24 mov %esi,(%esp)
state = '%';
} else {
putc(fd, c);
5a3: 88 55 e0 mov %dl,-0x20(%ebp)
write(fd, &c, 1);
5a6: e8 27 fe ff ff call 3d2 <write>
5ab: 83 c3 01 add $0x1,%ebx
for(i = 0; fmt[i]; i++){
5ae: 0f b6 53 ff movzbl -0x1(%ebx),%edx
5b2: 84 d2 test %dl,%dl
5b4: 0f 84 96 00 00 00 je 650 <printf+0xf0>
if(state == 0){
5ba: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
5bc: 0f be c2 movsbl %dl,%eax
if(state == 0){
5bf: 74 c7 je 588 <printf+0x28>
}
} else if(state == '%'){
5c1: 83 ff 25 cmp $0x25,%edi
5c4: 75 e5 jne 5ab <printf+0x4b>
if(c == 'd' || c == 'u'){
5c6: 83 fa 75 cmp $0x75,%edx
5c9: 0f 84 99 00 00 00 je 668 <printf+0x108>
5cf: 83 fa 64 cmp $0x64,%edx
5d2: 0f 84 90 00 00 00 je 668 <printf+0x108>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
5d8: 25 f7 00 00 00 and $0xf7,%eax
5dd: 83 f8 70 cmp $0x70,%eax
5e0: 0f 84 aa 00 00 00 je 690 <printf+0x130>
putc(fd, '0');
putc(fd, 'x');
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
5e6: 83 fa 73 cmp $0x73,%edx
5e9: 0f 84 e9 00 00 00 je 6d8 <printf+0x178>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5ef: 83 fa 63 cmp $0x63,%edx
5f2: 0f 84 2b 01 00 00 je 723 <printf+0x1c3>
putc(fd, *ap);
ap++;
} else if(c == '%'){
5f8: 83 fa 25 cmp $0x25,%edx
5fb: 0f 84 4f 01 00 00 je 750 <printf+0x1f0>
write(fd, &c, 1);
601: 8d 45 e6 lea -0x1a(%ebp),%eax
604: 83 c3 01 add $0x1,%ebx
607: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
60e: 00
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
60f: 31 ff xor %edi,%edi
write(fd, &c, 1);
611: 89 44 24 04 mov %eax,0x4(%esp)
615: 89 34 24 mov %esi,(%esp)
618: 89 55 d0 mov %edx,-0x30(%ebp)
61b: c6 45 e6 25 movb $0x25,-0x1a(%ebp)
61f: e8 ae fd ff ff call 3d2 <write>
putc(fd, c);
624: 8b 55 d0 mov -0x30(%ebp),%edx
write(fd, &c, 1);
627: 8d 45 e7 lea -0x19(%ebp),%eax
62a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
631: 00
632: 89 44 24 04 mov %eax,0x4(%esp)
636: 89 34 24 mov %esi,(%esp)
putc(fd, c);
639: 88 55 e7 mov %dl,-0x19(%ebp)
write(fd, &c, 1);
63c: e8 91 fd ff ff call 3d2 <write>
for(i = 0; fmt[i]; i++){
641: 0f b6 53 ff movzbl -0x1(%ebx),%edx
645: 84 d2 test %dl,%dl
647: 0f 85 6d ff ff ff jne 5ba <printf+0x5a>
64d: 8d 76 00 lea 0x0(%esi),%esi
}
}
}
650: 83 c4 3c add $0x3c,%esp
653: 5b pop %ebx
654: 5e pop %esi
655: 5f pop %edi
656: 5d pop %ebp
657: c3 ret
state = '%';
658: bf 25 00 00 00 mov $0x25,%edi
65d: e9 49 ff ff ff jmp 5ab <printf+0x4b>
662: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 10, 1);
668: c7 04 24 01 00 00 00 movl $0x1,(%esp)
66f: b9 0a 00 00 00 mov $0xa,%ecx
printint(fd, *ap, 16, 0);
674: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
677: 31 ff xor %edi,%edi
printint(fd, *ap, 16, 0);
679: 8b 10 mov (%eax),%edx
67b: 89 f0 mov %esi,%eax
67d: e8 3e fe ff ff call 4c0 <printint>
ap++;
682: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
686: e9 20 ff ff ff jmp 5ab <printf+0x4b>
68b: 90 nop
68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
write(fd, &c, 1);
690: 8d 45 e1 lea -0x1f(%ebp),%eax
693: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
69a: 00
69b: 89 44 24 04 mov %eax,0x4(%esp)
69f: 89 34 24 mov %esi,(%esp)
6a2: c6 45 e1 30 movb $0x30,-0x1f(%ebp)
6a6: e8 27 fd ff ff call 3d2 <write>
6ab: 8d 45 e2 lea -0x1e(%ebp),%eax
6ae: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6b5: 00
6b6: 89 44 24 04 mov %eax,0x4(%esp)
6ba: 89 34 24 mov %esi,(%esp)
6bd: c6 45 e2 78 movb $0x78,-0x1e(%ebp)
6c1: e8 0c fd ff ff call 3d2 <write>
printint(fd, *ap, 16, 0);
6c6: b9 10 00 00 00 mov $0x10,%ecx
6cb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6d2: eb a0 jmp 674 <printf+0x114>
6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
6d8: 8b 45 d4 mov -0x2c(%ebp),%eax
ap++;
6db: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
s = (char*)*ap;
6df: 8b 38 mov (%eax),%edi
s = "(null)";
6e1: b8 a0 0b 00 00 mov $0xba0,%eax
6e6: 85 ff test %edi,%edi
6e8: 0f 44 f8 cmove %eax,%edi
while(*s != 0){
6eb: 0f b6 07 movzbl (%edi),%eax
6ee: 84 c0 test %al,%al
6f0: 74 2a je 71c <printf+0x1bc>
6f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
6f8: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
6fb: 8d 45 e3 lea -0x1d(%ebp),%eax
s++;
6fe: 83 c7 01 add $0x1,%edi
write(fd, &c, 1);
701: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
708: 00
709: 89 44 24 04 mov %eax,0x4(%esp)
70d: 89 34 24 mov %esi,(%esp)
710: e8 bd fc ff ff call 3d2 <write>
while(*s != 0){
715: 0f b6 07 movzbl (%edi),%eax
718: 84 c0 test %al,%al
71a: 75 dc jne 6f8 <printf+0x198>
state = 0;
71c: 31 ff xor %edi,%edi
71e: e9 88 fe ff ff jmp 5ab <printf+0x4b>
putc(fd, *ap);
723: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
726: 31 ff xor %edi,%edi
putc(fd, *ap);
728: 8b 00 mov (%eax),%eax
write(fd, &c, 1);
72a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
731: 00
732: 89 34 24 mov %esi,(%esp)
putc(fd, *ap);
735: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
738: 8d 45 e4 lea -0x1c(%ebp),%eax
73b: 89 44 24 04 mov %eax,0x4(%esp)
73f: e8 8e fc ff ff call 3d2 <write>
ap++;
744: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
748: e9 5e fe ff ff jmp 5ab <printf+0x4b>
74d: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
750: 8d 45 e5 lea -0x1b(%ebp),%eax
state = 0;
753: 31 ff xor %edi,%edi
write(fd, &c, 1);
755: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
75c: 00
75d: 89 44 24 04 mov %eax,0x4(%esp)
761: 89 34 24 mov %esi,(%esp)
764: c6 45 e5 25 movb $0x25,-0x1b(%ebp)
768: e8 65 fc ff ff call 3d2 <write>
76d: e9 39 fe ff ff jmp 5ab <printf+0x4b>
772: 66 90 xchg %ax,%ax
774: 66 90 xchg %ax,%ax
776: 66 90 xchg %ax,%ax
778: 66 90 xchg %ax,%ax
77a: 66 90 xchg %ax,%ax
77c: 66 90 xchg %ax,%ax
77e: 66 90 xchg %ax,%ax
00000780 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
780: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
781: a1 80 10 00 00 mov 0x1080,%eax
{
786: 89 e5 mov %esp,%ebp
788: 57 push %edi
789: 56 push %esi
78a: 53 push %ebx
78b: 8b 5d 08 mov 0x8(%ebp),%ebx
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
78e: 8b 08 mov (%eax),%ecx
bp = (Header*)ap - 1;
790: 8d 53 f8 lea -0x8(%ebx),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
793: 39 d0 cmp %edx,%eax
795: 72 11 jb 7a8 <free+0x28>
797: 90 nop
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
798: 39 c8 cmp %ecx,%eax
79a: 72 04 jb 7a0 <free+0x20>
79c: 39 ca cmp %ecx,%edx
79e: 72 10 jb 7b0 <free+0x30>
7a0: 89 c8 mov %ecx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7a2: 39 d0 cmp %edx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7a4: 8b 08 mov (%eax),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7a6: 73 f0 jae 798 <free+0x18>
7a8: 39 ca cmp %ecx,%edx
7aa: 72 04 jb 7b0 <free+0x30>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ac: 39 c8 cmp %ecx,%eax
7ae: 72 f0 jb 7a0 <free+0x20>
break;
if(bp + bp->s.size == p->s.ptr){
7b0: 8b 73 fc mov -0x4(%ebx),%esi
7b3: 8d 3c f2 lea (%edx,%esi,8),%edi
7b6: 39 cf cmp %ecx,%edi
7b8: 74 1e je 7d8 <free+0x58>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
7ba: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
7bd: 8b 48 04 mov 0x4(%eax),%ecx
7c0: 8d 34 c8 lea (%eax,%ecx,8),%esi
7c3: 39 f2 cmp %esi,%edx
7c5: 74 28 je 7ef <free+0x6f>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
7c7: 89 10 mov %edx,(%eax)
freep = p;
7c9: a3 80 10 00 00 mov %eax,0x1080
}
7ce: 5b pop %ebx
7cf: 5e pop %esi
7d0: 5f pop %edi
7d1: 5d pop %ebp
7d2: c3 ret
7d3: 90 nop
7d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
7d8: 03 71 04 add 0x4(%ecx),%esi
7db: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
7de: 8b 08 mov (%eax),%ecx
7e0: 8b 09 mov (%ecx),%ecx
7e2: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
7e5: 8b 48 04 mov 0x4(%eax),%ecx
7e8: 8d 34 c8 lea (%eax,%ecx,8),%esi
7eb: 39 f2 cmp %esi,%edx
7ed: 75 d8 jne 7c7 <free+0x47>
p->s.size += bp->s.size;
7ef: 03 4b fc add -0x4(%ebx),%ecx
freep = p;
7f2: a3 80 10 00 00 mov %eax,0x1080
p->s.size += bp->s.size;
7f7: 89 48 04 mov %ecx,0x4(%eax)
p->s.ptr = bp->s.ptr;
7fa: 8b 53 f8 mov -0x8(%ebx),%edx
7fd: 89 10 mov %edx,(%eax)
}
7ff: 5b pop %ebx
800: 5e pop %esi
801: 5f pop %edi
802: 5d pop %ebp
803: c3 ret
804: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000810 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
810: 55 push %ebp
811: 89 e5 mov %esp,%ebp
813: 57 push %edi
814: 56 push %esi
815: 53 push %ebx
816: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
819: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
81c: 8b 1d 80 10 00 00 mov 0x1080,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
822: 8d 48 07 lea 0x7(%eax),%ecx
825: c1 e9 03 shr $0x3,%ecx
if((prevp = freep) == 0){
828: 85 db test %ebx,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
82a: 8d 71 01 lea 0x1(%ecx),%esi
if((prevp = freep) == 0){
82d: 0f 84 9b 00 00 00 je 8ce <malloc+0xbe>
833: 8b 13 mov (%ebx),%edx
835: 8b 7a 04 mov 0x4(%edx),%edi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
838: 39 fe cmp %edi,%esi
83a: 76 64 jbe 8a0 <malloc+0x90>
83c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax
if(nu < 4096)
843: bb 00 80 00 00 mov $0x8000,%ebx
848: 89 45 e4 mov %eax,-0x1c(%ebp)
84b: eb 0e jmp 85b <malloc+0x4b>
84d: 8d 76 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
850: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
852: 8b 78 04 mov 0x4(%eax),%edi
855: 39 fe cmp %edi,%esi
857: 76 4f jbe 8a8 <malloc+0x98>
859: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
85b: 3b 15 80 10 00 00 cmp 0x1080,%edx
861: 75 ed jne 850 <malloc+0x40>
if(nu < 4096)
863: 8b 45 e4 mov -0x1c(%ebp),%eax
866: 81 fe 00 10 00 00 cmp $0x1000,%esi
86c: bf 00 10 00 00 mov $0x1000,%edi
871: 0f 43 fe cmovae %esi,%edi
874: 0f 42 c3 cmovb %ebx,%eax
p = sbrk(nu * sizeof(Header));
877: 89 04 24 mov %eax,(%esp)
87a: e8 bb fb ff ff call 43a <sbrk>
if(p == (char*)-1)
87f: 83 f8 ff cmp $0xffffffff,%eax
882: 74 18 je 89c <malloc+0x8c>
hp->s.size = nu;
884: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
887: 83 c0 08 add $0x8,%eax
88a: 89 04 24 mov %eax,(%esp)
88d: e8 ee fe ff ff call 780 <free>
return freep;
892: 8b 15 80 10 00 00 mov 0x1080,%edx
if((p = morecore(nunits)) == 0)
898: 85 d2 test %edx,%edx
89a: 75 b4 jne 850 <malloc+0x40>
return 0;
89c: 31 c0 xor %eax,%eax
89e: eb 20 jmp 8c0 <malloc+0xb0>
if(p->s.size >= nunits){
8a0: 89 d0 mov %edx,%eax
8a2: 89 da mov %ebx,%edx
8a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
8a8: 39 fe cmp %edi,%esi
8aa: 74 1c je 8c8 <malloc+0xb8>
p->s.size -= nunits;
8ac: 29 f7 sub %esi,%edi
8ae: 89 78 04 mov %edi,0x4(%eax)
p += p->s.size;
8b1: 8d 04 f8 lea (%eax,%edi,8),%eax
p->s.size = nunits;
8b4: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
8b7: 89 15 80 10 00 00 mov %edx,0x1080
return (void*)(p + 1);
8bd: 83 c0 08 add $0x8,%eax
}
}
8c0: 83 c4 1c add $0x1c,%esp
8c3: 5b pop %ebx
8c4: 5e pop %esi
8c5: 5f pop %edi
8c6: 5d pop %ebp
8c7: c3 ret
prevp->s.ptr = p->s.ptr;
8c8: 8b 08 mov (%eax),%ecx
8ca: 89 0a mov %ecx,(%edx)
8cc: eb e9 jmp 8b7 <malloc+0xa7>
base.s.ptr = freep = prevp = &base;
8ce: c7 05 80 10 00 00 84 movl $0x1084,0x1080
8d5: 10 00 00
base.s.size = 0;
8d8: ba 84 10 00 00 mov $0x1084,%edx
base.s.ptr = freep = prevp = &base;
8dd: c7 05 84 10 00 00 84 movl $0x1084,0x1084
8e4: 10 00 00
base.s.size = 0;
8e7: c7 05 88 10 00 00 00 movl $0x0,0x1088
8ee: 00 00 00
8f1: e9 46 ff ff ff jmp 83c <malloc+0x2c>
8f6: 66 90 xchg %ax,%ax
8f8: 66 90 xchg %ax,%ax
8fa: 66 90 xchg %ax,%ax
8fc: 66 90 xchg %ax,%ax
8fe: 66 90 xchg %ax,%ax
00000900 <benny_thread_create>:
static struct benny_thread_s *bt_new(void);
int
benny_thread_create(benny_thread_t *abt, void (*func)(void*), void *arg_ptr)
{
900: 55 push %ebp
901: 89 e5 mov %esp,%ebp
903: 56 push %esi
904: 53 push %ebx
905: 83 ec 10 sub $0x10,%esp
}
static struct benny_thread_s *
bt_new(void)
{
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
908: c7 04 24 0c 00 00 00 movl $0xc,(%esp)
90f: e8 fc fe ff ff call 810 <malloc>
if (bt == NULL) {
914: 85 c0 test %eax,%eax
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
916: 89 c6 mov %eax,%esi
if (bt == NULL) {
918: 74 66 je 980 <benny_thread_create+0x80>
// allocate 2 pages worth of memory and then make sure the
// beginning address used for the stack is page alligned.
// we want it page alligned so that we don't generate a
// page fault by accessing the stack for a thread.
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
91a: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
921: e8 ea fe ff ff call 810 <malloc>
if (bt->bt_stack == NULL) {
926: 85 c0 test %eax,%eax
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
928: 89 c3 mov %eax,%ebx
92a: 89 46 08 mov %eax,0x8(%esi)
92d: 89 46 04 mov %eax,0x4(%esi)
if (bt->bt_stack == NULL) {
930: 74 5d je 98f <benny_thread_create+0x8f>
free(bt);
return NULL;
}
if (((uint) bt->bt_stack) % PGSIZE != 0) {
932: 25 ff 0f 00 00 and $0xfff,%eax
937: 75 37 jne 970 <benny_thread_create+0x70>
// allign the thread stack to a page boundary
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
}
bt->bid = -1;
939: c7 06 ff ff ff ff movl $0xffffffff,(%esi)
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
93f: 8b 45 10 mov 0x10(%ebp),%eax
942: 89 5c 24 08 mov %ebx,0x8(%esp)
946: 89 44 24 04 mov %eax,0x4(%esp)
94a: 8b 45 0c mov 0xc(%ebp),%eax
94d: 89 04 24 mov %eax,(%esp)
950: e8 25 fb ff ff call 47a <kthread_create>
if (bt->bid != 0) {
955: 85 c0 test %eax,%eax
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
957: 89 06 mov %eax,(%esi)
if (bt->bid != 0) {
959: 74 2d je 988 <benny_thread_create+0x88>
*abt = (benny_thread_t) bt;
95b: 8b 45 08 mov 0x8(%ebp),%eax
95e: 89 30 mov %esi,(%eax)
result = 0;
960: 31 c0 xor %eax,%eax
}
962: 83 c4 10 add $0x10,%esp
965: 5b pop %ebx
966: 5e pop %esi
967: 5d pop %ebp
968: c3 ret
969: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
970: 29 c3 sub %eax,%ebx
972: 81 c3 00 10 00 00 add $0x1000,%ebx
978: 89 5e 04 mov %ebx,0x4(%esi)
97b: eb bc jmp 939 <benny_thread_create+0x39>
97d: 8d 76 00 lea 0x0(%esi),%esi
980: 8b 1d 04 00 00 00 mov 0x4,%ebx
986: eb b7 jmp 93f <benny_thread_create+0x3f>
int result = -1;
988: b8 ff ff ff ff mov $0xffffffff,%eax
98d: eb d3 jmp 962 <benny_thread_create+0x62>
free(bt);
98f: 89 34 24 mov %esi,(%esp)
return NULL;
992: 31 f6 xor %esi,%esi
free(bt);
994: e8 e7 fd ff ff call 780 <free>
999: 8b 5b 04 mov 0x4(%ebx),%ebx
99c: eb a1 jmp 93f <benny_thread_create+0x3f>
99e: 66 90 xchg %ax,%ax
000009a0 <benny_thread_bid>:
{
9a0: 55 push %ebp
9a1: 89 e5 mov %esp,%ebp
return bt->bid;
9a3: 8b 45 08 mov 0x8(%ebp),%eax
}
9a6: 5d pop %ebp
return bt->bid;
9a7: 8b 00 mov (%eax),%eax
}
9a9: c3 ret
9aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000009b0 <benny_thread_join>:
{
9b0: 55 push %ebp
9b1: 89 e5 mov %esp,%ebp
9b3: 53 push %ebx
9b4: 83 ec 14 sub $0x14,%esp
9b7: 8b 5d 08 mov 0x8(%ebp),%ebx
retVal = kthread_join(bt->bid);
9ba: 8b 03 mov (%ebx),%eax
9bc: 89 04 24 mov %eax,(%esp)
9bf: e8 be fa ff ff call 482 <kthread_join>
if (retVal == 0) {
9c4: 85 c0 test %eax,%eax
9c6: 75 27 jne 9ef <benny_thread_join+0x3f>
free(bt->mem_stack);
9c8: 8b 53 08 mov 0x8(%ebx),%edx
9cb: 89 45 f4 mov %eax,-0xc(%ebp)
9ce: 89 14 24 mov %edx,(%esp)
9d1: e8 aa fd ff ff call 780 <free>
bt->bt_stack = bt->mem_stack = NULL;
9d6: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
9dd: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx)
free(bt);
9e4: 89 1c 24 mov %ebx,(%esp)
9e7: e8 94 fd ff ff call 780 <free>
9ec: 8b 45 f4 mov -0xc(%ebp),%eax
}
9ef: 83 c4 14 add $0x14,%esp
9f2: 5b pop %ebx
9f3: 5d pop %ebp
9f4: c3 ret
9f5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
9f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000a00 <benny_thread_exit>:
{
a00: 55 push %ebp
a01: 89 e5 mov %esp,%ebp
}
a03: 5d pop %ebp
return kthread_exit(exitValue);
a04: e9 81 fa ff ff jmp 48a <kthread_exit>
a09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000a10 <benny_mootex_init>:
}
# ifdef BENNY_MOOTEX
int
benny_mootex_init(benny_mootex_t *benny_mootex)
{
a10: 55 push %ebp
a11: 89 e5 mov %esp,%ebp
a13: 8b 45 08 mov 0x8(%ebp),%eax
benny_mootex->locked = 0;
a16: c7 00 00 00 00 00 movl $0x0,(%eax)
benny_mootex->bid = -1;
a1c: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
return 0;
}
a23: 31 c0 xor %eax,%eax
a25: 5d pop %ebp
a26: c3 ret
a27: 89 f6 mov %esi,%esi
a29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000a30 <benny_mootex_yieldlock>:
int
benny_mootex_yieldlock(benny_mootex_t *benny_mootex)
{
a30: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
a31: b8 01 00 00 00 mov $0x1,%eax
a36: 89 e5 mov %esp,%ebp
a38: 56 push %esi
a39: 53 push %ebx
a3a: 8b 5d 08 mov 0x8(%ebp),%ebx
a3d: f0 87 03 lock xchg %eax,(%ebx)
// #error this is the call to lock the mootex that will yield in a
// #error loop until the lock is acquired.
while(xchg(&benny_mootex->locked, 1) != 0){
a40: 85 c0 test %eax,%eax
a42: be 01 00 00 00 mov $0x1,%esi
a47: 74 15 je a5e <benny_mootex_yieldlock+0x2e>
a49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
benny_yield(void)
{
// # error This just gives up the rest of this scheduled time slice to
// # error another process/thread.
return kthread_yield();
a50: e8 45 fa ff ff call 49a <kthread_yield>
a55: 89 f0 mov %esi,%eax
a57: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
a5a: 85 c0 test %eax,%eax
a5c: 75 f2 jne a50 <benny_mootex_yieldlock+0x20>
return kthread_self();
a5e: e8 2f fa ff ff call 492 <kthread_self>
benny_mootex->bid = benny_self();
a63: 89 43 04 mov %eax,0x4(%ebx)
}
a66: 31 c0 xor %eax,%eax
a68: 5b pop %ebx
a69: 5e pop %esi
a6a: 5d pop %ebp
a6b: c3 ret
a6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000a70 <benny_mootex_spinlock>:
{
a70: 55 push %ebp
a71: ba 01 00 00 00 mov $0x1,%edx
a76: 89 e5 mov %esp,%ebp
a78: 53 push %ebx
a79: 83 ec 04 sub $0x4,%esp
a7c: 8b 5d 08 mov 0x8(%ebp),%ebx
a7f: 90 nop
a80: 89 d0 mov %edx,%eax
a82: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
a85: 85 c0 test %eax,%eax
a87: 75 f7 jne a80 <benny_mootex_spinlock+0x10>
return kthread_self();
a89: e8 04 fa ff ff call 492 <kthread_self>
benny_mootex->bid = benny_self();
a8e: 89 43 04 mov %eax,0x4(%ebx)
}
a91: 83 c4 04 add $0x4,%esp
a94: 31 c0 xor %eax,%eax
a96: 5b pop %ebx
a97: 5d pop %ebp
a98: c3 ret
a99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000aa0 <benny_mootex_unlock>:
{
aa0: 55 push %ebp
aa1: 89 e5 mov %esp,%ebp
aa3: 53 push %ebx
aa4: 83 ec 04 sub $0x4,%esp
aa7: 8b 5d 08 mov 0x8(%ebp),%ebx
return kthread_self();
aaa: e8 e3 f9 ff ff call 492 <kthread_self>
if(tid == benny_mootex->bid){
aaf: 39 43 04 cmp %eax,0x4(%ebx)
ab2: 75 1c jne ad0 <benny_mootex_unlock+0x30>
__sync_synchronize();
ab4: 0f ae f0 mfence
return 0;
ab7: 31 c0 xor %eax,%eax
benny_mootex->bid = -1;
ab9: c7 43 04 ff ff ff ff movl $0xffffffff,0x4(%ebx)
__sync_lock_release(&benny_mootex->locked);
ac0: c7 03 00 00 00 00 movl $0x0,(%ebx)
}
ac6: 83 c4 04 add $0x4,%esp
ac9: 5b pop %ebx
aca: 5d pop %ebp
acb: c3 ret
acc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ad0: 83 c4 04 add $0x4,%esp
return -1;
ad3: b8 ff ff ff ff mov $0xffffffff,%eax
}
ad8: 5b pop %ebx
ad9: 5d pop %ebp
ada: c3 ret
adb: 90 nop
adc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000ae0 <benny_mootex_trylock>:
{
ae0: 55 push %ebp
ae1: b8 01 00 00 00 mov $0x1,%eax
ae6: 89 e5 mov %esp,%ebp
ae8: 53 push %ebx
ae9: 83 ec 04 sub $0x4,%esp
aec: 8b 5d 08 mov 0x8(%ebp),%ebx
aef: f0 87 03 lock xchg %eax,(%ebx)
if(xchg(&benny_mootex->locked, 1) != 0){
af2: 85 c0 test %eax,%eax
af4: 75 08 jne afe <benny_mootex_trylock+0x1e>
int tid = kthread_self();
af6: e8 97 f9 ff ff call 492 <kthread_self>
benny_mootex->bid = tid;
afb: 89 43 04 mov %eax,0x4(%ebx)
}
afe: 83 c4 04 add $0x4,%esp
b01: b8 ff ff ff ff mov $0xffffffff,%eax
b06: 5b pop %ebx
b07: 5d pop %ebp
b08: c3 ret
b09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b10 <benny_mootex_wholock>:
{
b10: 55 push %ebp
b11: 89 e5 mov %esp,%ebp
return benny_mootex->bid;
b13: 8b 45 08 mov 0x8(%ebp),%eax
}
b16: 5d pop %ebp
return benny_mootex->bid;
b17: 8b 40 04 mov 0x4(%eax),%eax
}
b1a: c3 ret
b1b: 90 nop
b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000b20 <benny_mootex_islocked>:
{
b20: 55 push %ebp
b21: 89 e5 mov %esp,%ebp
return benny_mootex->locked;
b23: 8b 45 08 mov 0x8(%ebp),%eax
}
b26: 5d pop %ebp
return benny_mootex->locked;
b27: 8b 00 mov (%eax),%eax
}
b29: c3 ret
b2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000b30 <benny_self>:
{
b30: 55 push %ebp
b31: 89 e5 mov %esp,%ebp
}
b33: 5d pop %ebp
return kthread_self();
b34: e9 59 f9 ff ff jmp 492 <kthread_self>
b39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b40 <benny_yield>:
{
b40: 55 push %ebp
b41: 89 e5 mov %esp,%ebp
}
b43: 5d pop %ebp
return kthread_yield();
b44: e9 51 f9 ff ff jmp 49a <kthread_yield>
b49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b50 <benny_cpu_count>:
int
benny_cpu_count(void)
{
b50: 55 push %ebp
b51: 89 e5 mov %esp,%ebp
// # error call the kthread_cpu_count() function.
// kthread_cpu_count();
return kthread_cpu_count();
}
b53: 5d pop %ebp
return kthread_cpu_count();
b54: e9 49 f9 ff ff jmp 4a2 <kthread_cpu_count>
b59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b60 <benny_thread_count>:
int
benny_thread_count(void)
{
b60: 55 push %ebp
b61: 89 e5 mov %esp,%ebp
// # error call the kthread_thread_count() function.
// kthread_thread_count()
return kthread_thread_count();
}
b63: 5d pop %ebp
return kthread_thread_count();
b64: e9 41 f9 ff ff jmp 4aa <kthread_thread_count>
|
fasm/source/Linux/x64/fasm.asm | ElecBot/x64-FASM-Programs | 1 | 173877 |
; flat assembler interface for Linux x64
; Copyright (c) 1999-2020, <NAME>.
; All rights reserved.
format ELF64 executable 3 at 400000h
entry start
include 'modes.inc'
segment readable executable
start:
mov [con_handle],1
mov esi,_logo
call display_string
mov [command_line],rsp
mov rcx,[rsp]
mov rbx,[rsp+8+rcx*8+8]
mov [environment],rbx
call get_params
jc information
call init_memory
mov esi,_memory_prefix
call display_string
mov eax,[memory_end]
sub eax,[memory_start]
add eax,[additional_memory_end]
sub eax,[additional_memory]
shr eax,10
call display_number
mov esi,_memory_suffix
call display_string
mov eax,96
mov edi,buffer
xor esi,esi
syscall
mov eax,dword [buffer]
mov ecx,1000
mul ecx
mov ebx,eax
mov eax,dword [buffer+4]
div ecx
add eax,ebx
mov [start_time],eax
and [preprocessing_done],0
call preprocessor
or [preprocessing_done],-1
call parser
call assembler
call formatter
call display_user_messages
movzx eax,[current_pass]
inc eax
call display_number
mov esi,_passes_suffix
call display_string
mov eax,96
mov edi,buffer
xor esi,esi
syscall
mov eax,dword [buffer]
mov ecx,1000
mul ecx
mov ebx,eax
mov eax,dword [buffer+4]
div ecx
add eax,ebx
sub eax,[start_time]
jnc time_ok
add eax,3600000
time_ok:
xor edx,edx
mov ebx,100
div ebx
or eax,eax
jz display_bytes_count
xor edx,edx
mov ebx,10
div ebx
push edx
call display_number
mov dl,'.'
call display_character
pop eax
call display_number
mov esi,_seconds_suffix
call display_string
display_bytes_count:
mov eax,[written_size]
call display_number
mov esi,_bytes_suffix
call display_string
xor al,al
jmp exit_program
information:
mov esi,_usage
call display_string
mov al,1
jmp exit_program
get_params:
mov rbx,[command_line]
mov [input_file],0
mov [output_file],0
mov [symbols_file],0
mov [memory_setting],0
mov [passes_limit],100
mov rcx,[rbx]
add rbx,8*2
dec rcx
jz bad_params
mov [definitions_pointer],predefinitions
mov [path_pointer],paths
get_param:
mov rsi,[rbx]
mov al,[rsi]
cmp al,'-'
je option_param
cmp [input_file],0
jne get_output_file
call collect_path
mov [input_file],edx
jmp next_param
get_output_file:
cmp [output_file],0
jne bad_params
call collect_path
mov [output_file],edx
jmp next_param
option_param:
inc rsi
lodsb
cmp al,'m'
je memory_option
cmp al,'M'
je memory_option
cmp al,'p'
je passes_option
cmp al,'P'
je passes_option
cmp al,'d'
je definition_option
cmp al,'D'
je definition_option
cmp al,'s'
je symbols_option
cmp al,'S'
je symbols_option
bad_params:
stc
ret
memory_option:
cmp byte [rsi],0
jne get_memory_setting
dec rcx
jz bad_params
add rbx,8
mov rsi,[rbx]
get_memory_setting:
call get_option_value
or edx,edx
jz bad_params
cmp edx,1 shl (32-10)
jae bad_params
mov [memory_setting],edx
jmp next_param
passes_option:
cmp byte [rsi],0
jne get_passes_setting
dec rcx
jz bad_params
add rbx,8
mov rsi,[rbx]
get_passes_setting:
call get_option_value
or edx,edx
jz bad_params
cmp edx,10000h
ja bad_params
mov [passes_limit],dx
next_param:
add rbx,8
dec rcx
jnz get_param
cmp [input_file],0
je bad_params
mov eax,[definitions_pointer]
mov byte [eax],0
mov [initial_definitions],predefinitions
clc
ret
definition_option:
cmp byte [rsi],0
jne get_definition
dec rcx
jz bad_params
add rbx,8
mov rsi,[rbx]
get_definition:
mov r12d,edi
mov edi,[definitions_pointer]
call convert_definition_option
mov [definitions_pointer],edi
mov edi,r12d
jc bad_params
jmp next_param
symbols_option:
cmp byte [rsi],0
jne get_symbols_setting
dec rcx
jz bad_params
add rbx,8
mov rsi,[rbx]
get_symbols_setting:
call collect_path
mov [symbols_file],edx
jmp next_param
get_option_value:
xor eax,eax
mov edx,eax
get_option_digit:
lodsb
cmp al,20h
je option_value_ok
or al,al
jz option_value_ok
sub al,30h
jc invalid_option_value
cmp al,9
ja invalid_option_value
imul edx,10
jo invalid_option_value
add edx,eax
jc invalid_option_value
jmp get_option_digit
option_value_ok:
dec rsi
clc
ret
invalid_option_value:
stc
ret
convert_definition_option:
mov edx,edi
cmp edi,predefinitions+1000h
jae bad_definition_option
xor al,al
stosb
copy_definition_name:
lodsb
cmp al,'='
je copy_definition_value
cmp al,20h
je bad_definition_option
or al,al
jz bad_definition_option
cmp edi,predefinitions+1000h
jae bad_definition_option
stosb
inc byte [edx]
jnz copy_definition_name
bad_definition_option:
stc
ret
copy_definition_value:
lodsb
cmp al,20h
je definition_value_end
or al,al
jz definition_value_end
cmp edi,predefinitions+1000h
jae bad_definition_option
stosb
jmp copy_definition_value
definition_value_end:
dec rsi
cmp edi,predefinitions+1000h
jae bad_definition_option
xor al,al
stosb
clc
ret
collect_path:
mov edi,[path_pointer]
mov edx,edi
copy_path_to_low_memory:
lodsb
stosb
test al,al
jnz copy_path_to_low_memory
mov [path_pointer],edi
retn
include 'system.inc'
include '..\..\version.inc'
_copyright db 'Copyright (c) 1999-2020, <NAME>',0xA,0
_logo db 'flat assembler version ',VERSION_STRING,0
_usage db 0xA
db 'usage: fasm <source> [output]',0xA
db 'optional settings:',0xA
db ' -m <limit> set the limit in kilobytes for the available memory',0xA
db ' -p <limit> set the maximum allowed number of passes',0xA
db ' -d <name>=<value> define symbolic variable',0xA
db ' -s <file> dump symbolic information for debugging',0xA
db 0
_memory_prefix db ' (',0
_memory_suffix db ' kilobytes memory, x64)',0xA,0
_passes_suffix db ' passes, ',0
_seconds_suffix db ' seconds, ',0
_bytes_suffix db ' bytes.',0xA,0
_no_low_memory db 'failed to allocate memory within 32-bit addressing range',0
include '..\..\errors.inc'
include '..\..\symbdump.inc'
include '..\..\preproce.inc'
include '..\..\parser.inc'
include '..\..\exprpars.inc'
include '..\..\assemble.inc'
include '..\..\exprcalc.inc'
include '..\..\x86_64.inc'
include '..\..\avx.inc'
include '..\..\formats.inc'
include '..\..\tables.inc'
include '..\..\messages.inc'
segment readable writeable
align 4
include '..\..\variable.inc'
command_line dq ?
memory_setting dd ?
path_pointer dd ?
definitions_pointer dd ?
environment dq ?
timestamp dq ?
start_time dd ?
con_handle dd ?
displayed_count dd ?
last_displayed db ?
character db ?
preprocessing_done db ?
buffer rb 1000h
predefinitions rb 1000h
paths rb 10000h
|
agda/TreeSort/Impl2/Correctness/Order.agda | bgbianchi/sorting | 6 | 1288 | open import Relation.Binary.Core
module TreeSort.Impl2.Correctness.Order {A : Set}
(_≤_ : A → A → Set)
(tot≤ : Total _≤_)
(trans≤ : Transitive _≤_) where
open import BBSTree _≤_
open import BBSTree.Properties _≤_ trans≤
open import Data.List
open import Function using (_∘_)
open import List.Sorted _≤_
open import TreeSort.Impl2 _≤_ tot≤
theorem-treeSort-sorted : (xs : List A) → Sorted (flatten (treeSort xs))
theorem-treeSort-sorted = lemma-bbst-sorted ∘ treeSort
|
game/data/stages/stages-index.asm | pompshuffle/super-tilt-bro | 2 | 2317 | stages_init_routine:
RAW_VECTOR(stage_generic_init) ; Plateau
RAW_VECTOR(stage_pit_init) ; Pit
RAW_VECTOR(stage_generic_init) ; Shelf
RAW_VECTOR(stage_gem_init) ; Gem
stages_tick_routine:
RAW_VECTOR(dummy_routine) ; Plateau
RAW_VECTOR(stage_pit_tick) ; Pit
RAW_VECTOR(dummy_routine) ; Shelf
RAW_VECTOR(stage_gem_tick) ; Gem
stages_nametable:
RAW_VECTOR(nametable_flatland) ; Plateau
RAW_VECTOR(nametable_stage_pit) ; Pit
RAW_VECTOR(nametable_stage_shelf) ; Shelf
RAW_VECTOR(nametable_stage_gem) ; Gem
stage_palettes:
RAW_VECTOR(stage_plateau_palette_data) ; Plateau
RAW_VECTOR(stage_pit_palette_data) ; Pit
RAW_VECTOR(stage_shelf_palette_data) ; Shelf
RAW_VECTOR(stage_gem_palette_data) ; Gem
stages_data:
RAW_VECTOR(stage_plateau_data) ; Plateau
RAW_VECTOR(stage_pit_data) ; Pit
RAW_VECTOR(stage_shelf_data) ; Shelf
RAW_VECTOR(stage_gem_data) ; Gem
stages_bank:
.byt STAGE_PLATEAU_BANK_NUMBER ; Plateau
.byt STAGE_PIT_BANK_NUMBER ; Pit
.byt STAGE_SHELF_BANK_NUMBER ; Shelf
.byt STAGE_GEM_BANK_NUMBER ; Gem
stages_tileset_lsb:
.byt <tileset_ruins ; Plateau
.byt <tileset_jungle ; Pit
.byt <tileset_ruins ; Shelf
.byt <tileset_magma ; Gem
stages_tileset_msb:
.byt >tileset_ruins ; Plateau
.byt >tileset_jungle ; Pit
.byt >tileset_ruins ; Shelf
.byt >tileset_magma ; Gem
stages_tileset_bank:
.byt TILESET_RUINS_BANK_NUMBER ; Plateau
.byt TILESET_JUNGLE_BANK_NUMBER ; Pit
.byt TILESET_RUINS_BANK_NUMBER ; Shelf
.byt TILESET_MAGMA_BANK_NUMBER ; Gem
|
oeis/067/A067061.asm | neoneye/loda-programs | 11 | 82885 | ; A067061: A permutation of the natural numbers.
; Submitted by <NAME>(s4)
; 4,1,5,2,6,3,10,7,11,8,12,9,16,13,17,14,18,15,22,19,23,20,24,21,28,25,29,26,30,27,34,31,35,32,36,33,40,37,41,38,42,39,46,43,47,44,48,45,52,49,53,50,54,51,58,55,59,56,60,57,64,61,65,62,66,63,70,67,71,68,72,69
mov $2,$0
div $2,6
sub $2,$0
div $0,2
mul $0,7
add $0,4
mul $2,3
add $0,$2
|
arch/ARM/STM32/svd/stm32wb55x/stm32_svd-pka.ads | morbos/Ada_Drivers_Library | 2 | 14604 | <filename>arch/ARM/STM32/svd/stm32wb55x/stm32_svd-pka.ads
-- This spec has been automatically generated from STM32WB55x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.PKA is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_MODE_Field is HAL.UInt6;
type CR_Register is record
EN : Boolean := False;
START : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
MODE : CR_MODE_Field := 16#0#;
-- unspecified
Reserved_14_16 : HAL.UInt3 := 16#0#;
PROCENDIE : Boolean := False;
-- unspecified
Reserved_18_18 : HAL.Bit := 16#0#;
RAMERRIE : Boolean := False;
ADDRERRIE : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
EN at 0 range 0 .. 0;
START at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
MODE at 0 range 8 .. 13;
Reserved_14_16 at 0 range 14 .. 16;
PROCENDIE at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
RAMERRIE at 0 range 19 .. 19;
ADDRERRIE at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
type SR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
BUSY : Boolean := False;
PROCENDF : Boolean := False;
-- unspecified
Reserved_18_18 : HAL.Bit := 16#0#;
RAMERRF : Boolean := False;
ADDRERRF : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
BUSY at 0 range 16 .. 16;
PROCENDF at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
RAMERRF at 0 range 19 .. 19;
ADDRERRF at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
type CLRFR_Register is record
-- unspecified
Reserved_0_16 : HAL.UInt17 := 16#0#;
PROCENDFC : Boolean := False;
-- unspecified
Reserved_18_18 : HAL.Bit := 16#0#;
RAMERRFC : Boolean := False;
ADDRERRFC : Boolean := False;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CLRFR_Register use record
Reserved_0_16 at 0 range 0 .. 16;
PROCENDFC at 0 range 17 .. 17;
Reserved_18_18 at 0 range 18 .. 18;
RAMERRFC at 0 range 19 .. 19;
ADDRERRFC at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type PKA_Peripheral is record
CR : aliased CR_Register;
SR : aliased SR_Register;
CLRFR : aliased CLRFR_Register;
end record
with Volatile;
for PKA_Peripheral use record
CR at 16#0# range 0 .. 31;
SR at 16#4# range 0 .. 31;
CLRFR at 16#8# range 0 .. 31;
end record;
PKA_Periph : aliased PKA_Peripheral
with Import, Address => System'To_Address (16#58002000#);
end STM32_SVD.PKA;
|
programs/oeis/005/A005004.asm | neoneye/loda | 22 | 164396 | <reponame>neoneye/loda<gh_stars>10-100
; A005004: Davenport-Schinzel numbers of degree n on 3 symbols.
; 1,3,5,8,10,14,16,20,22,26,28,32,34,38,40,44,46,50,52,56,58,62,64,68,70,74,76,80,82,86,88,92,94,98,100,104,106,110,112,116,118,122,124,128,130,134,136,140,142,146,148,152,154,158,160,164,166
mov $1,$0
mul $1,2
mov $2,$0
sub $0,1
gcd $2,2
trn $0,$2
add $1,$0
mov $0,$1
add $0,1
|
test/Succeed/Issue1009.agda | cruhland/agda | 1,989 | 6930 | <reponame>cruhland/agda
-- 2013-12-28 Andreas, issue reported by <NAME>
{-# OPTIONS --allow-unsolved-metas #-}
{-# OPTIONS -v tc.cc:15 #-} -- Keep! Debug printing triggered the problem.
record Σ (A : Set) (B : A → Set) : Set where
field
fst : A
snd : B fst
test : {A : Set} → Σ A (λ {_ → A})
test = _
-- This used to trigger an internal error
-- (funnily only at -v tc.cc:15 verbosity)
-- because adding the clause to an
-- extended lambda failed. Reason:
-- Extended lambda was registered as Axiom
-- during first checking, not Defn as
-- checkFunDef' now expects.
|
alloy4fun_models/trashltl/models/4/P9bdxK3yoDg4gXAjH.als | Kaixi26/org.alloytools.alloy | 0 | 5325 | open main
pred idP9bdxK3yoDg4gXAjH_prop5 {
eventually (File' in File and File != File')
}
pred __repair { idP9bdxK3yoDg4gXAjH_prop5 }
check __repair { idP9bdxK3yoDg4gXAjH_prop5 <=> prop5o } |
programs/oeis/070/A070718.asm | karttu/loda | 1 | 557 | ; A070718: n^7 mod 37.
; 0,1,17,4,30,18,31,34,29,16,10,11,9,32,23,35,12,15,13,24,22,25,2,14,5,28,26,27,21,8,3,6,19,7,33,20,36,0,1,17,4,30,18,31,34,29,16,10,11,9,32,23,35,12,15,13,24,22,25,2,14,5,28,26,27,21,8,3,6,19,7,33,20,36,0,1,17
pow $0,7
mod $0,37
mov $1,$0
|
examples/STM32F4_DISCO/simple_audio/src/audio_stream.adb | rocher/Ada_Drivers_Library | 192 | 26177 | <filename>examples/STM32F4_DISCO/simple_audio/src/audio_stream.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- 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. --
-- --
------------------------------------------------------------------------------
package body Audio_Stream is
------------------------------
-- Double_Buffer_Controller --
------------------------------
protected body Double_Buffer_Controller is
-----------
-- Start --
-----------
procedure Start
(Destination : Address;
Source_0 : Address;
Source_1 : Address;
Data_Count : UInt16)
is
Config : DMA_Stream_Configuration;
begin
Enable_Clock (Controller.all);
Config.Channel := Audio_TX_DMA_Chan;
Config.Direction := Memory_To_Peripheral;
Config.Increment_Peripheral_Address := False;
Config.Increment_Memory_Address := True;
Config.Peripheral_Data_Format := HalfWords;
Config.Memory_Data_Format := HalfWords;
Config.Operation_Mode := Circular_Mode;
Config.Priority := Priority_High;
Config.FIFO_Enabled := False;
Config.FIFO_Threshold := FIFO_Threshold_Full_Configuration;
Config.Memory_Burst_Size := Memory_Burst_Single;
Config.Peripheral_Burst_Size := Peripheral_Burst_Single;
Configure (Controller.all, Stream, Config);
Configure_Data_Flow
(Controller.all,
Stream,
Source => Source_0,
Destination => Destination,
Data_Count => Data_Count);
for Selected_Interrupt in DMA_Interrupt loop
Enable_Interrupt (Controller.all, Stream, Selected_Interrupt);
end loop;
Configure_Double_Buffered_Mode (This => Controller.all,
Stream => Stream,
Buffer_0_Value => Source_0,
Buffer_1_Value => Source_1,
First_Buffer_Used => Memory_Buffer_0);
Buffer_0 := Source_0;
Buffer_1 := Source_1;
Enable_Double_Buffered_Mode (Controller.all, Stream);
Clear_All_Status (Controller.all, Stream);
Enable (Controller.all, Stream);
end Start;
--------------------------------
-- Wait_For_Transfer_Complete --
--------------------------------
entry Wait_For_Transfer_Complete when Interrupt_Triggered is
begin
Interrupt_Triggered := False;
end Wait_For_Transfer_Complete;
---------------------
-- Not_In_Transfer --
---------------------
function Not_In_Transfer return Address is
begin
case Current_Memory_Buffer (Controller.all, Stream) is
when Memory_Buffer_0 =>
return Buffer_1;
when Memory_Buffer_1 =>
return Buffer_0;
end case;
end Not_In_Transfer;
-----------------------
-- Interrupt_Handler --
-----------------------
procedure Interrupt_Handler is
begin
for Flag in DMA_Status_Flag loop
if Status (Controller.all, Stream, Flag) then
case Flag is
when Transfer_Complete_Indicated =>
Interrupt_Triggered := True;
when others =>
null;
end case;
Clear_Status (Controller.all, Stream, Flag);
end if;
end loop;
end Interrupt_Handler;
end Double_Buffer_Controller;
end Audio_Stream;
|
examples/tts_example_c.ads | jorge-real/TTS-Runtime-Ravenscar | 2 | 29494 | package TTS_Example_C is
procedure Main;
end TTS_Example_C;
|
Appl/Icon/Viewer/viewerManager.asm | steakknife/pcgeos | 504 | 7145 | <filename>Appl/Icon/Viewer/viewerManager.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(c) Copyright GeoWorks 1994. All Rights Reserved.
GEOWORKS CONFIDENTIAL
PROJECT: Icon editor
MODULE: Viewer
FILE: viewerManager.asm
AUTHOR: <NAME>, Jun 17, 1994
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
stevey 6/17/94 Initial revision
DESCRIPTION:
Manager file for Viewer module.
$Id: viewerManager.asm,v 1.1 97/04/04 16:06:59 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include iconGeode.def
include viewerConstant.def
;-----------------------------------------------------------------------------
; Classes
;-----------------------------------------------------------------------------
idata segment
VisIconClass
idata ends
;-----------------------------------------------------------------------------
; Code
;-----------------------------------------------------------------------------
include viewerVisIcon.asm
include viewerMain.asm
include viewerKbd.asm
include viewerUI.asm
|
protect_mod/pm1.asm | tor4z/os_sel | 0 | 18492 | ;;;==================================
;;; pm1.asm
;;; nasm pm1.asm -0 pm1.o
;;;=================================
%include "pm.inc" ; Include pm
org 0100h
jmp LABEL_BEGIN
[SECTION .gdt]
LABEL_GDT:
;; Base Limit Attribute
Descriptor 0, 0, 0 ; NULL description
LABEL_DESC_CODE32:
Descriptor 0, SegCode32Len - 1, DA_C + DA_32
LABEL_DESC_VIDEO:
Descriptor 0b8000h, 0ffffh, DA_DRW ; Video memory address
GdtLen equ $ - LABEL_GDT ; Lenght of GDT
GdtPtr dw GdtLen - 1 ; GDT Limit
dd 0 ; GDT Base, to be fill
;; GDT Selector
SelectorCode32 equ LABEL_DESC_CODE32 - LABEL_GDT
SelectorVideo equ LABEL_DESC_VIDEO - LABEL_GDT
;; End of [SECTION .gdt]
[SECTION .s16]
[BITS 16]
LABEL_BEGIN:
;; Reload data segment register
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0100h
;; Initialize 32-bit segment description
xor eax, eax
mov ax, cs
shl eax, 4
add eax, LABEL_SEG_CODE32
mov word [LABEL_DESC_CODE32 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE32 + 4], al
mov byte [LABEL_DESC_CODE32 + 7], ah
;; Prepare to load GDTR
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_GDT ; Add GDT base to EAX, segment * 16 + offset
mov dword [GdtPtr + 2], eax ; Set GDT Base to [GdtPr + 2]
lgdt [GdtPtr] ; Load GDTR
cli ; Close interrupt
;; Enable A20
in al, 92h
or al, 00000010b
out 92h, al
;; Prepare to Switch to protected mode
mov eax, cr0
or eax, 1
mov cr0, eax
;; Switch to protected mode
jmp dword SelectorCode32:0
;; End of [SECTION .s16]
[SECTION .s32]
[BITS 32]
LABEL_SEG_CODE32:
mov ax, SelectorVideo
mov gs, ax ; Set Video Selector as destination segment
mov edi, (80 * 11 + 79) * 2 ; line 11 and row 79 in the screen
mov ah, 0ch ; 0000:black background, 1100:red font color
mov al, 'P'
mov [gs:edi], ax
jmp $
SegCode32Len equ $ - LABEL_SEG_CODE32
;; End of [SECTION .s32]
|
stm32f1/drivers/stm32gd-drivers-cdc.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 20797 | package STM32GD.Drivers.CDC is
function EP0_Reset (BTable_Offset : Integer) return Integer;
procedure EP0_Handler (Out_Transaction : Boolean);
end STM32GD.Drivers.CDC;
|
test/succeed/Issue353.agda | asr/agda-kanso | 0 | 12359 |
module Issue353 where
data Func : Set₁ where
K : (A : Set) → Func
-- Doesn't work.
module M where
const : ∀ {A B : Set₁} → A → B → A
const x = λ _ → x
⟦_⟧ : Func → Set → Set
⟦ K A ⟧ X = const A X
data μ (F : Func) : Set where
⟨_⟩ : ⟦ F ⟧ (μ F) → μ F
-- Error: μ is not strictly positive, because it occurs in the second
-- argument to ⟦_⟧ in the type of the constructor ⟨_⟩ in the
-- definition of μ.
|
programs/oeis/040/A040872.asm | neoneye/loda | 22 | 82432 | ; A040872: Continued fraction for sqrt(903).
; 30,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60,20,60
mov $1,2
pow $1,$0
add $1,2
gcd $1,6
sub $1,2
mul $1,10
add $1,20
mov $0,$1
|
oeis/145/A145601.asm | neoneye/loda-programs | 11 | 91175 | <filename>oeis/145/A145601.asm<gh_stars>10-100
; A145601: a(n) is the number of walks from (0,0) to (0,2) that remain in the upper half-plane y >= 0 using 2*n unit steps either up (U), down (D), left (L) or right (R).
; Submitted by <NAME>(s1)
; 1,15,189,2352,29700,382239,5010005,66745536,901995588,12342120700,170724392916,2384209771200,33577620944400,476432168185575,6805332732133125,97790670976838400,1412830549632694500
add $0,1
mov $1,$0
mul $0,2
add $0,1
seq $1,71724 ; a(n) = 3*binomial(2n, n-1)/(n+2), n > 0, with a(0)=1.
mul $0,$1
mul $0,$1
div $0,3
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_606.asm | ljhsiun2/medusa | 9 | 25878 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x291d, %r10
nop
nop
cmp %rax, %rax
and $0xffffffffffffffc0, %r10
vmovntdqa (%r10), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rcx
nop
xor $22069, %r8
lea addresses_UC_ht+0x2ad1, %r10
nop
nop
nop
nop
add $35813, %rsi
mov $0x6162636465666768, %r15
movq %r15, %xmm7
and $0xffffffffffffffc0, %r10
movntdq %xmm7, (%r10)
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x1199d, %rsi
lea addresses_WC_ht+0x1e89d, %rdi
clflush (%rdi)
nop
nop
nop
add $28203, %r14
mov $119, %rcx
rep movsb
cmp $41193, %rdi
lea addresses_D_ht+0x1819d, %rsi
nop
nop
nop
nop
add $28983, %rax
mov $0x6162636465666768, %r15
movq %r15, %xmm2
movups %xmm2, (%rsi)
nop
nop
nop
inc %rcx
lea addresses_A_ht+0xf29d, %rcx
sub $6800, %r10
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
inc %r14
lea addresses_D_ht+0x1acc9, %rdi
nop
xor %r10, %r10
movb (%rdi), %cl
nop
dec %rdi
lea addresses_D_ht+0x11d, %rax
nop
nop
nop
nop
xor $34508, %r14
vmovups (%rax), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
nop
nop
nop
add %r8, %r8
lea addresses_UC_ht+0x299d, %rsi
lea addresses_normal_ht+0x420d, %rdi
nop
nop
nop
nop
xor %rax, %rax
mov $109, %rcx
rep movsb
nop
nop
sub %r15, %r15
lea addresses_D_ht+0x168ed, %rsi
lea addresses_UC_ht+0x8c1d, %rdi
nop
nop
nop
add %rax, %rax
mov $75, %rcx
rep movsw
nop
and %rdi, %rdi
lea addresses_UC_ht+0x832d, %rsi
lea addresses_WT_ht+0x8de5, %rdi
clflush (%rdi)
nop
and %rax, %rax
mov $118, %rcx
rep movsq
nop
nop
nop
nop
add %rax, %rax
lea addresses_UC_ht+0x2b5d, %r14
nop
nop
nop
nop
nop
inc %r8
mov (%r14), %ax
nop
nop
nop
nop
and $53536, %rsi
lea addresses_UC_ht+0x10add, %rsi
nop
nop
nop
nop
xor $59886, %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm4
movups %xmm4, (%rsi)
nop
nop
nop
nop
xor $42855, %rdi
lea addresses_UC_ht+0xcf9d, %rsi
lea addresses_UC_ht+0x1445d, %rdi
clflush (%rdi)
nop
nop
cmp %r15, %r15
mov $121, %rcx
rep movsl
and $47494, %r14
lea addresses_A_ht+0xe19d, %r14
nop
nop
nop
sub $54991, %rdi
movups (%r14), %xmm6
vpextrq $0, %xmm6, %r15
nop
nop
dec %r15
lea addresses_UC_ht+0x1abd5, %rdi
nop
nop
nop
and $22875, %r15
movl $0x61626364, (%rdi)
nop
xor %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x1119d, %rsi
lea addresses_UC+0x1399d, %rdi
nop
nop
nop
inc %r10
mov $5, %rcx
rep movsw
nop
nop
nop
nop
nop
add $62809, %r15
// Store
lea addresses_WT+0x191e3, %r9
nop
nop
nop
nop
sub %r14, %r14
mov $0x5152535455565758, %rcx
movq %rcx, (%r9)
nop
nop
inc %r9
// Store
lea addresses_UC+0xb8ba, %r9
nop
nop
nop
and %rcx, %rcx
movb $0x51, (%r9)
nop
nop
cmp $33436, %r9
// Faulty Load
lea addresses_A+0x1119d, %r15
nop
nop
nop
nop
nop
sub $31442, %rdi
movb (%r15), %cl
lea oracles, %r14
and $0xff, %rcx
shlq $12, %rcx
mov (%r14,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_A'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 4}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 6}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}}
{'dst': {'same': True, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 10}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 3}, 'OP': 'STOR'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
Others/BubleSortTest.asm | LeonardoSanBenitez/Assembly-exercises | 0 | 102196 | <filename>Others/BubleSortTest.asm<gh_stars>0
# --------------------------------------------------- #
# Main
# --------------------------------------------------- #
# Brief: Just for testing poupouses.
.text 0x00400000
addi $t0, $zero, 8
addi $t1, $zero, 5
addi $t2, $zero, 1
addi $t3, $zero, 3
addi $t4, $zero, 2
addi $t5, $zero, 20
addi $t6, $zero, 7
addi $t7, $zero, 666
sw $t0, 0 ($gp)
sw $t1, 4 ($gp)
sw $t2, 8 ($gp)
sw $t3, 12 ($gp)
sw $t4, 16 ($gp)
sw $t5, 20 ($gp)
sw $t6, 24 ($gp)
sw $t7, 28 ($gp)
add $a0, $zero, $gp # array addr: 0x00
addi $a1, $zero, 32 # array size (in bytes)
jal bubbleSortCrescent
# Finish program
li $v0, 17 # Service terminate
li $a0, 0 # Service parameter (termination result)
syscall
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i3-7100_9_0x84_notsx.log_21829_3063.asm | ljhsiun2/medusa | 9 | 6755 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x4583, %rsi
lea addresses_WC_ht+0x8a19, %rdi
nop
nop
nop
and %rbx, %rbx
mov $110, %rcx
rep movsb
nop
nop
nop
nop
nop
add %rax, %rax
lea addresses_WC_ht+0x16a49, %rsi
and $18695, %rbp
movups (%rsi), %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0xc53, %rax
nop
nop
nop
nop
cmp $32637, %rcx
mov (%rax), %bx
nop
nop
nop
nop
nop
add $60604, %rcx
lea addresses_D_ht+0x194c3, %rsi
lea addresses_WC_ht+0x1df09, %rdi
nop
nop
nop
nop
and %rbp, %rbp
mov $84, %rcx
rep movsq
cmp $15013, %rbp
lea addresses_WT_ht+0x127e1, %rsi
lea addresses_normal_ht+0xd689, %rdi
nop
nop
nop
nop
xor $14959, %rbx
mov $112, %rcx
rep movsw
xor %rcx, %rcx
lea addresses_A_ht+0x16c89, %rsi
clflush (%rsi)
nop
nop
nop
xor %r11, %r11
mov $0x6162636465666768, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%rsi)
nop
cmp $56566, %rbp
lea addresses_WT_ht+0x83c9, %rsi
lea addresses_WT_ht+0x15571, %rdi
nop
nop
nop
nop
add %rax, %rax
mov $51, %rcx
rep movsq
nop
nop
nop
dec %rcx
lea addresses_D_ht+0x1b509, %rbp
nop
nop
nop
nop
nop
and $9272, %rax
movl $0x61626364, (%rbp)
nop
xor $16872, %rdi
lea addresses_normal_ht+0x10aa9, %rax
nop
nop
add %rbp, %rbp
mov (%rax), %rcx
nop
nop
nop
nop
nop
dec %rdi
lea addresses_A_ht+0xd849, %rsi
lea addresses_A_ht+0x8569, %rdi
nop
nop
nop
dec %r11
mov $25, %rcx
rep movsq
nop
nop
and %rbp, %rbp
lea addresses_UC_ht+0x148c, %rax
sub %rsi, %rsi
movl $0x61626364, (%rax)
sub %rcx, %rcx
lea addresses_UC_ht+0x10889, %rbp
nop
inc %rdi
movb (%rbp), %al
nop
sub $37829, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rdi
// Store
lea addresses_WC+0x9889, %r8
inc %rdi
movl $0x51525354, (%r8)
nop
dec %r8
// Faulty Load
lea addresses_WC+0x9889, %r10
nop
nop
xor $44647, %rbx
vmovntdqa (%r10), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rdi
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': True, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'13': 1, '5f': 1, '45': 6100, 'c3': 1, '68': 1, 'f1': 1, 'd6': 1, '03': 1, '85': 1, '49': 36, '00': 15682, '61': 1, '91': 2}
00 00 45 00 45 00 45 00 45 00 00 00 00 45 00 00 45 00 45 00 45 00 00 45 00 45 00 00 45 45 45 45 00 00 00 00 00 45 00 00 45 45 00 00 45 45 00 00 45 45 00 00 00 00 00 00 00 45 45 00 00 00 00 45 00 00 00 00 00 00 45 45 45 00 00 00 00 00 45 00 00 00 00 45 45 00 00 45 00 00 00 00 45 45 45 00 00 45 45 00 00 45 00 00 00 00 00 45 00 00 00 45 00 45 45 45 00 45 45 00 00 00 00 00 00 00 45 00 45 00 45 00 45 00 00 00 00 45 00 45 45 00 00 45 00 00 45 45 45 00 00 45 45 00 00 00 45 00 00 00 00 00 00 00 45 45 00 45 00 00 45 00 00 45 00 00 00 00 00 00 00 45 45 00 00 45 00 45 00 00 00 45 00 00 00 00 45 00 00 00 00 45 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 45 00 00 00 45 00 00 45 45 00 00 45 45 00 00 45 45 45 00 00 45 00 45 45 00 00 00 45 00 45 45 00 45 45 45 00 45 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 45 00 45 00 45 00 00 00 45 00 00 00 00 45 00 45 00 00 45 45 00 45 45 00 45 00 00 00 00 00 00 00 00 00 45 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 45 00 45 45 00 00 45 00 45 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 45 00 00 00 00 00 45 00 45 00 00 00 00 00 00 45 45 00 45 00 45 00 45 00 00 00 00 00 45 00 45 00 45 00 00 00 45 00 45 45 00 00 45 00 00 00 00 00 45 00 45 00 00 45 45 00 45 00 00 45 00 00 00 45 00 45 00 00 00 45 00 45 45 00 45 00 45 00 00 00 00 45 00 00 00 00 00 00 45 00 00 00 00 00 00 45 45 00 00 00 45 00 00 00 00 00 00 45 45 45 00 45 00 00 00 00 00 45 00 45 00 00 45 00 45 00 00 00 00 00 00 00 00 45 00 00 00 00 00 45 00 45 00 45 00 00 00 00 00 45 00 00 45 00 45 45 45 00 45 00 00 00 00 00 00 45 00 00 45 00 45 00 45 00 00 00 00 00 00 00 00 45 00 45 00 00 00 00 00 00 00 00 00 45 00 45 00 00 45 00 00 00 00 45 45 45 45 45 45 00 45 00 45 45 00 00 00 00 00 45 00 00 45 45 00 45 00 00 45 00 00 00 45 45 00 00 00 00 00 00 45 00 00 00 00 45 00 00 45 00 00 00 00 00 00 00 00 00 00 45 00 00 00 45 00 00 45 00 00 00 00 00 00 00 45 45 00 45 00 00 45 00 00 00 00 45 00 45 00 45 00 00 00 00 00 00 45 00 00 45 00 00 00 00 00 00 45 00 00 00 00 45 00 00 00 00 00 00 45 00 45 00 00 45 00 00 00 45 00 00 45 00 00 45 00 00 00 00 00 45 00 00 00 00 45 00 00 45 45 00 00 00 00 00 45 00 00 45 45 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 45 45 00 00 45 00 45 00 00 45 00 45 00 45 00 00 00 00 00 45 00 00 00 45 00 00 45 00 00 00 00 00 00 00 00 45 00 00 45 45 00 00 00 45 45 00 00 45 00 45 45 45 00 45 45 45 45 00 45 45 45 45 00 00 00 00 00 45 45 00 00 45 00 00 00 00 45 00 45 00 00 45 00 00 00 00 45 00 45 45 00 00 00 00 00 00 45 00 00 00 00 45 00 00 45 00 00 00 00 00 00 00 00 45 00 45 00 00 00 00 00 00 00 00 00 45 00 00 45 00 00 00 45 00 00 00 00 00 00 00 00 45 00 45 45 00 00 00 45 00 00 00 00 00 00 00 00 00 45 00 45 00 00 00 00 45 00 00 00 00 00 00 45 00 00 45 00 00 00 00 45 00 00 00 45 00 00 00 45 00 68 00 00 00 00 45 00 00 00 45 00 00 00 00 45 45 00 00 00 45 45 45 00 45 00 00 00 45 00 00 00 00 00 00 00 00 00 00 45 45 45 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
extern/gnat_sdl/gnat_sdl2/src/bmiintrin_h.ads | AdaCore/training_material | 15 | 14394 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package bmiintrin_h is
-- Copyright (C) 2010-2017 Free Software Foundation, Inc.
-- This file is part of GCC.
-- GCC is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3, or (at your option)
-- any later version.
-- GCC 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 General Public License for more details.
-- 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/>.
-- skipped func __tzcnt_u16
-- skipped func __andn_u32
-- skipped func __bextr_u32
-- skipped func _bextr_u32
-- skipped func __blsi_u32
-- skipped func _blsi_u32
-- skipped func __blsmsk_u32
-- skipped func _blsmsk_u32
-- skipped func __blsr_u32
-- skipped func _blsr_u32
-- skipped func __tzcnt_u32
-- skipped func _tzcnt_u32
-- skipped func __andn_u64
-- skipped func __bextr_u64
-- skipped func _bextr_u64
-- skipped func __blsi_u64
-- skipped func _blsi_u64
-- skipped func __blsmsk_u64
-- skipped func _blsmsk_u64
-- skipped func __blsr_u64
-- skipped func _blsr_u64
-- skipped func __tzcnt_u64
-- skipped func _tzcnt_u64
end bmiintrin_h;
|
programs/oeis/157/A157613.asm | karttu/loda | 1 | 301 | <gh_stars>1-10
; A157613: a(n) = 2662*n + 22.
; 2684,5346,8008,10670,13332,15994,18656,21318,23980,26642,29304,31966,34628,37290,39952,42614,45276,47938,50600,53262,55924,58586,61248,63910,66572,69234,71896,74558,77220,79882,82544,85206,87868,90530,93192,95854,98516,101178,103840,106502,109164,111826,114488,117150,119812,122474,125136,127798,130460,133122,135784,138446,141108,143770,146432,149094,151756,154418,157080,159742,162404,165066,167728,170390,173052,175714,178376,181038,183700,186362,189024,191686,194348,197010,199672,202334,204996,207658,210320,212982,215644,218306,220968,223630,226292,228954,231616,234278,236940,239602,242264,244926,247588,250250,252912,255574,258236,260898,263560,266222,268884,271546,274208,276870,279532,282194,284856,287518,290180,292842,295504,298166,300828,303490,306152,308814,311476,314138,316800,319462,322124,324786,327448,330110,332772,335434,338096,340758,343420,346082,348744,351406,354068,356730,359392,362054,364716,367378,370040,372702,375364,378026,380688,383350,386012,388674,391336,393998,396660,399322,401984,404646,407308,409970,412632,415294,417956,420618,423280,425942,428604,431266,433928,436590,439252,441914,444576,447238,449900,452562,455224,457886,460548,463210,465872,468534,471196,473858,476520,479182,481844,484506,487168,489830,492492,495154,497816,500478,503140,505802,508464,511126,513788,516450,519112,521774,524436,527098,529760,532422,535084,537746,540408,543070,545732,548394,551056,553718,556380,559042,561704,564366,567028,569690,572352,575014,577676,580338,583000,585662,588324,590986,593648,596310,598972,601634,604296,606958,609620,612282,614944,617606,620268,622930,625592,628254,630916,633578,636240,638902,641564,644226,646888,649550,652212,654874,657536,660198,662860,665522
mov $1,$0
mul $1,2662
add $1,2684
|
src/sys/encoders/util-encoders-kdf-pbkdf2.ads | RREE/ada-util | 60 | 29205 | -----------------------------------------------------------------------
-- util-encoders-kdf-pbkdf2 -- Password-Based Key Derivation Function 2, RFC 8018.
-- 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.
-----------------------------------------------------------------------
-- Password-Based Key Derivation Function 2, RFC 8018.
generic
Length : Stream_Element_Offset;
with procedure Hash (Key : in Ada.Streams.Stream_Element_Array;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array);
procedure Util.Encoders.KDF.PBKDF2 (Password : in Secret_Key;
Salt : in Secret_Key;
Counter : in Positive;
Result : out Secret_Key);
|
src/main/antlr4/imports/PlayPlusWords.g4 | SebLuca/SI_TEST_changbranch | 0 | 2178 | <reponame>SebLuca/SI_TEST_changbranch<gh_stars>0
lexer grammar PlayPlusWords;
// Comments -> ignored
COMMENT : (('/*' (.*) '*/') | ('//' (.*) NEWLINE)) -> skip;
SKIPA : 'skip';
// Words
AFFECT: 'affect';
LPAR: '(';
RPAR: ')';
COMMA: ',';
PLUS: '+';
MINUS: '-';
MOD: '%';
MULT:'*';
DIV:'/';
SEMICOLON: ';';
EQUALS:'=';
COLON: ':';
LTHAN:'<';
MTHAN:'>';
LBRA:'[';
RBRA: ']';
WLD: '.wld';
COMPUTE: 'compute';
IF:'if';
THEN:'then';
ELSE:'else';
WHILE:'while';
SET:'set';
TO:'to';
NEXT:'next';
IMPORT:'import';
FUNCTION:'function';
RETURN:'return';
LATITUDE:'latitude';
LONGITUDE:'longitude';
GRID:'grid';
SIZE:'size';
MAP:'map';
RADIO:'radio';
AMMO:'ammo';
FRUITS:'fruits';
SODA:'soda';
COUNT:'count';
LIFE:'life';
TRUE:'true';
FALSE:'false';
ENNEMI:'ennemi';
IS:'is';
NORTH:'north';
SOUTH:'south';
EAST:'east';
WEST:'west';
GRAAL:'graal';
OR:'or';
NOT:'not';
DIRT:'dirt';
ROCK:'rock';
VINES:'vines';
ZOMBIE:'zombie';
PLAYER:'player';
NEARBY:'nearby';
MOVE:'move';
SHOOT:'shoot';
USE:'use';
NOTHING:'nothing';
AS:'as';
DECLARE:'declare';
AND : 'and';
RETAIN : 'retain';
BY: 'by';
DEFAULT:'default';
LOCAL: 'local';
DO:'do';
DONE:'done';
WHEN:'when';
YOUR:'your';
TURN:'turn';
BOOLEAN: 'boolean';
INTEGER:'integer';
SQUARE:'square';
VOID: 'void';
// Identifiers
FILEDECL: FILENAME WLD;
ID: LETTER (LETTER | DIGIT)* ;
FILENAME: LETTER (DIGIT | LETTER)*;
NUMBER: (MINUS) ? (DIGIT)+;
fragment LETTER: 'A'..'Z' | 'a'..'z' ;
fragment DIGIT: '0'..'9' ;
// Whitespaces -> ignored
NEWLINE: '\r'? '\n' -> skip ;
WS: [ \t]+ -> skip ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.