Dataset Viewer
max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
software/driver/ublox8-protocol.ads | TUM-EI-RCS/StratoX | 12 | 21414 | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: <NAME> (<EMAIL>)
--
-- Description: U-Blox protocol definition. Following u-blox 6/7/8 Receiver Description
-- @author <NAME> <<EMAIL>>
-- @author <NAME> <<EMAIL>>
-- @author <NAME> <<EMAIL>>
--
-- @author <NAME>
-- (rework, add ubx7+ compatibility)
--
-- @author <NAME> (Ada Port)
-- Protocoll: https://de.wikipedia.org/wiki/NMEA_0183
with HIL; use HIL;
package ublox8.Protocol with SPARK_Mode is
UBX_SYNC1 : constant := 16#B5#;
UBX_SYNC2 : constant := 16#62#;
-- Message Classes
UBX_CLASS_NAV : constant := 16#01#;
UBX_CLASS_ACK : constant := 16#05#;
UBX_CLASS_CFG : constant := 16#06#;
UBX_CLASS_MON : constant := 16#0A#;
UBX_CLASS_RTCM3 : constant := 16#F5# ;--*< This is undocumented (?)
-- Message IDs
UBX_ID_NAV_POSLLH : constant := 16#02#;
UBX_ID_NAV_STATUS : constant := 16#03#;
UBX_ID_NAV_DOP : constant := 16#04#;
UBX_ID_NAV_SOL : constant := 16#06#;
UBX_ID_NAV_PVT : constant := 16#07#;
UBX_ID_NAV_VELNED : constant := 16#12#;
UBX_ID_NAV_TIMEUTC : constant := 16#21#;
UBX_ID_NAV_SVINFO : constant := 16#30#;
UBX_ID_NAV_SAT : constant := 16#35#;
UBX_ID_NAV_SVIN : constant := 16#3B#;
UBX_ID_NAV_RELPOSNED : constant := 16#3C#;
UBX_ID_ACK_NAK : constant := 16#00#;
UBX_ID_ACK_ACK : constant := 16#01#;
UBX_ID_CFG_PRT : constant := 16#00#;
UBX_ID_CFG_MSG : constant := 16#01#;
UBX_ID_CFG_RATE : constant := 16#08#;
UBX_ID_CFG_NAV5 : constant := 16#24#;
UBX_ID_CFG_SBAS : constant := 16#16#;
UBX_ID_CFG_TMODE3 : constant := 16#71#;
UBX_ID_MON_VER : constant := 16#04#;
UBX_ID_MON_HW : constant := 16#09#;
UBX_ID_RTCM31_005 : constant := 16#05#;
UBX_ID_RTCM31_077 : constant := 16#4D#;
UBX_ID_RTCM31_087 : constant := 16#57#;
-- lengths
UBX_LENGTH_CFG_PRT : constant := 20;
UBX_LENGTH_CFG_MSG : constant := 8;
UBX_LENGTH_NAV_PVT : constant := 92;
UBX_LENGTH_ACK_ACK : constant := 2;
-- Message Classes and IDs
-- UBX_MSG_NAV_POSLLH : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_POSLLH, 8));
-- UBX_MSG_NAV_SOL : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SOL, 8));
-- UBX_MSG_NAV_DOP : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_DOP, 8));
-- UBX_MSG_NAV_PVT : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_PVT, 8));
-- UBX_MSG_NAV_VELNED : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_VELNED, 8));
-- UBX_MSG_NAV_TIMEUTC : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_TIMEUTC, 8));
-- UBX_MSG_NAV_SVINFO : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SVINFO, 8));
-- UBX_MSG_NAV_SAT : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SAT, 8));
-- UBX_MSG_NAV_SVIN : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SVIN, 8));
-- UBX_MSG_NAV_RELPOSNED : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_RELPOSNED, 8));
-- UBX_MSG_ACK_NAK : constant := ((UBX_CLASS_ACK) or Shift_Left(UBX_ID_ACK_NAK, 8));
-- UBX_MSG_ACK_ACK : constant := ((UBX_CLASS_ACK) or Shift_Left(UBX_ID_ACK_ACK, 8));
-- UBX_MSG_CFG_PRT : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_PRT, 8));
-- UBX_MSG_CFG_MSG : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_MSG, 8));
-- UBX_MSG_CFG_RATE : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_RATE, 8));
-- UBX_MSG_CFG_NAV5 : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_NAV5, 8));
-- UBX_MSG_CFG_SBAS : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_SBAS, 8));
-- UBX_MSG_CFG_TMODE3 : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_TMODE3, 8));
-- UBX_MSG_MON_HW : constant := ((UBX_CLASS_MON) or Shift_Left(UBX_ID_MON_HW, 8));
-- UBX_MSG_MON_VER : constant := ((UBX_CLASS_MON) or Shift_Left(UBX_ID_MON_VER, 8));
-- UBX_MSG_RTCM31_005 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_005, 8));
-- UBX_MSG_RTCM31_077 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_077, 8));
-- UBX_MSG_RTCM31_087 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_087, 8));
-- RX NAV-PVT message content details
-- Bitfield "valid" masks
UBX_RX_NAV_PVT_VALIDVALIDDATE : constant := 16#01# ;--*< validDate (Valid UTC Date)
UBX_RX_NAV_PVT_VALIDVALIDTIME : constant := 16#02# ;--*< validTime (Valid UTC Time)
UBX_RX_NAV_PVT_VALIDFULLYRESOLVED : constant := 16#04# ;--*< fullyResolved (1 := UTC Time of Day has been fully resolved (no seconds uncertainty))
-- Bitfield "flags" masks
UBX_RX_NAV_PVT_FLAGSGNSSFIXOK : constant := 16#01# ;--*< gnssFixOK (A valid fix (i.e within DOP and accuracy masks))
UBX_RX_NAV_PVT_FLAGSDIFFSOLN : constant := 16#02# ;--*< diffSoln (1 if differential corrections were applied)
UBX_RX_NAV_PVT_FLAGSPSMSTATE : constant := 16#1C# ;--*< psmState (Power Save Mode state (see Power Management))
UBX_RX_NAV_PVT_FLAGSHEADVEHVALID : constant := 16#20# ;--*< headVehValid (Heading of vehicle is valid)
-- RX NAV-TIMEUTC message content details
-- Bitfield "valid" masks
UBX_RX_NAV_TIMEUTC_VALIDVALIDTOW : constant := 16#01# ;--*< validTOW (1 := Valid Time of Week)
UBX_RX_NAV_TIMEUTC_VALIDVALIDKWN : constant := 16#02# ;--*< validWKN (1 := Valid Week Number)
UBX_RX_NAV_TIMEUTC_VALIDVALIDUTC : constant := 16#04# ;--*< validUTC (1 := Valid UTC Time)
UBX_RX_NAV_TIMEUTC_VALIDUTCSTANDARD : constant := 16#F0# ;--*< utcStandard (0..15 := UTC standard identifier)
-- TX CFG-PRT message contents
UBX_TX_CFG_PRT_PORTID : constant := 16#01# ;--*< UART1
UBX_TX_CFG_PRT_PORTID_USB : constant := 16#03# ;--*< USB
UBX_TX_CFG_PRT_MODE : constant := 16#0000_008D0# ;--*< 2#0000100011010000#: 8N1
UBX_TX_CFG_PRT_BAUDRATE : constant :=38_400 ;--*< choose38_400 as GPS baudrate
--UBX_TX_CFG_PRT_INPROTOMASK : constant := (2**5) or (2**2) or 16#01# ;--*< RTCM3 in and RTCM2 in and UBX in
UBX_TX_CFG_PRT_OUTPROTOMASK_GPS : constant := (16#01#) ;--*< UBX out
--UBX_TX_CFG_PRT_OUTPROTOMASK_RTCM : constant := (2**5) or 16#01# ;--*< RTCM3 out and UBX out
-- TX CFG-RATE message contents
UBX_TX_CFG_RATE_MEASINTERVAL : constant := 200 ;--*< 200ms for 5Hz
UBX_TX_CFG_RATE_NAVRATE : constant := 1 ;--*< cannot be changed
UBX_TX_CFG_RATE_TIMEREF : constant := 0 ;--*< 0: UTC, 1: GPS time
-- TX CFG-NAV5 message contents
UBX_TX_CFG_NAV5_MASK : constant := 00_005 ;--*< Only update dynamic model and fix mode
UBX_TX_CFG_NAV5_DYNMODEL : constant := 7; --*< 0 Portable, 2 Stationary, 3 Pedestrian, 4 Automotive, 5 Sea, 6 Airborne <1g, 7 Airborne <2g, 8 Airborne <4g
UBX_TX_CFG_NAV5_DYNMODEL_RTCM : constant := 2;
UBX_TX_CFG_NAV5_FIXMODE : constant := 2 ;--*< 1 2D only, 2 3D only, 3 Auto 2D/3D
-- TX CFG-SBAS message contents
UBX_TX_CFG_SBAS_MODE_ENABLED : constant := 1 ;--*< SBAS enabled
UBX_TX_CFG_SBAS_MODE_DISABLED : constant := 0 ;--*< SBAS disabled
UBX_TX_CFG_SBAS_MODE : constant := UBX_TX_CFG_SBAS_MODE_DISABLED ;--*< SBAS enabled or disabled
-- TX CFG-MSG message contents
UBX_TX_CFG_MSG_RATE1_5HZ : constant := 16#01# ;--*< {16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#} the second entry is for UART1
UBX_TX_CFG_MSG_RATE1_1HZ : constant := 16#05# ;--*< {16#00#, 16#05#, 16#00#, 16#00#, 16#00#, 16#00#} the second entry is for UART1
UBX_TX_CFG_MSG_RATE1_05HZ : constant := 10;
-- TX CFG-TMODE3 message contents
UBX_TX_CFG_TMODE3_FLAGS : constant := 1 ;--*< start survey-in
UBX_TX_CFG_TMODE3_SVINMINDUR : constant := (2*60) ;--*< survey-in: minimum duration [s] (higher:=higher precision)
UBX_TX_CFG_TMODE3_SVINACCLIMIT : constant := 10_000 ;--*< survey-in: position accuracy limit 0.1[mm]
-- RTCM3
RTCM3_PREAMBLE : constant := 16#D3#;
RTCM_BUFFER_LENGTH : constant := 110 ;--*< maximum message length of an RTCM message
subtype Header_Index_Type is Natural range 1 .. 6;
HEADER_SYNC_CHAR_1 : Header_Index_Type := 1;
HEADER_SYNC_CHAR_2 : Header_Index_Type := 2;
HEADER_MSG_CLASS : Header_Index_Type := 3;
HEADER_MSG_ID : Header_Index_Type := 4;
HEADER_LENGTH : Header_Index_Type := 5;
subtype UBX_Header_Array is Byte_Array(Header_Index_Type);
subtype Checksum_Index_Type is Natural range 1 .. 2;
CK_A : constant Checksum_Index_Type := 1;
CK_B : constant Checksum_Index_Type := 2;
subtype UBX_Checksum_Array is Byte_Array(Checksum_Index_Type);
-- type rtcm_message_t is
-- record
-- Unsigned_8 buffer(RTCM_BUFFER_LENGTH);
-- pos : Unsigned_16; --/< next position in buffer
-- message_length : Unsigned_16; --/< message length without header and CRC (both 3 bytes)
-- end record;
--
-- -- General: Header
-- type ubx_header_t is record
-- sync1 : Unsigned_8;
-- sync2 : Unsigned_8;
-- msg : Unsigned_16;
-- length : Unsigned_16;
-- end record;
--
--
--
--
-- -- General: Checksum
-- type ubx_checksum_t is record
-- ck_a : Unsigned_8;
-- ck_b : Unsigned_8;
-- end record;
--
-- -- Rx NAV-POSLLH
-- type ubx_payload_rx_nav_posllh_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- lon : Integer_32; --*< Longitude [1e-7 deg]
-- lat : Integer_32; --*< Latitude [1e-7 deg]
-- height : Integer_32; --*< Height above ellipsoid [mm]
-- hMSL : Integer_32; --*< Height above mean sea level [mm]
-- hAcc : Unsigned_32; --*< Horizontal accuracy estimate [mm]
-- vAcc : Unsigned_32; --*< Vertical accuracy estimate [mm]
-- end record;
--
-- -- Rx NAV-DOP
-- type ubx_payload_rx_nav_dop_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- gDOP : Unsigned_16; --*< Geometric DOP [0.01]
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- tDOP : Unsigned_16; --*< Time DOP [0.01]
-- vDOP : Unsigned_16; --*< Vertical DOP [0.01]
-- hDOP : Unsigned_16; --*< Horizontal DOP [0.01]
-- nDOP : Unsigned_16; --*< Northing DOP [0.01]
-- eDOP : Unsigned_16; --*< Easting DOP [0.01]
-- end record;
--
-- -- Rx NAV-SOL
-- type ubx_payload_rx_nav_sol_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- fTOW : Integer_32; --*< Fractional part of iTOW (range: +/500_000) [ns]
-- week : Integer_16; --*< GPS week
-- gpsFix : Unsigned_8; --*< GPSfix type: 0 := No fix, 1 := Dead Reckoning only, 2 := 2D fix, 3 := 3d-fix, 4 := GPS + dead reckoning, 5 := time only fix
-- flags : Unsigned_8;
-- ecefX : Integer_32;
-- ecefY : Integer_32;
-- ecefZ : Integer_32;
-- pAcc : Unsigned_32;
-- ecefVX : Integer_32;
-- ecefVY : Integer_32;
-- ecefVZ : Integer_32;
-- sAcc : Unsigned_32;
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- reserved1 : Unsigned_8;
-- numSV : Unsigned_8; --*< Number of SVs used in Nav Solution
-- reserved2 : Unsigned_32;
-- end record;
--
-- -- Rx NAV-PVT (ubx8)
-- type ubx_payload_rx_nav_pvt_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- year : Unsigned_16; --*< Year (UTC)
-- month : Unsigned_8; --*< Month, range 1..12 (UTC)
-- day : Unsigned_8; --*< Day of month, range 1..31 (UTC)
-- hour : Unsigned_8; --*< Hour of day, range 0..23 (UTC)
-- min : Unsigned_8; --*< Minute of hour, range 0..59 (UTC)
-- sec : Unsigned_8; --*< Seconds of minute, range 0..60 (UTC)
-- valid : Unsigned_8; --*< Validity flags (see UBX_RX_NAV_PVT_VALID...)
-- tAcc : Unsigned_32; --*< Time accuracy estimate (UTC) [ns]
-- nano : Integer_32; --*< Fraction of second (UTC) [-1e9...1e9 ns]
-- fixType : Unsigned_8; --*< GNSSfix type: 0 := No fix, 1 := Dead Reckoning only, 2 := 2D fix, 3 := 3d-fix, 4 := GNSS + dead reckoning, 5 := time only fix
-- flags : Unsigned_8; --*< Fix Status Flags (see UBX_RX_NAV_PVT_FLAGS...)
-- reserved1 : Unsigned_8;
-- numSV : Unsigned_8; --*< Number of SVs used in Nav Solution
-- lon : Integer_32; --*< Longitude [1e-7 deg]
-- lat : Integer_32; --*< Latitude [1e-7 deg]
-- height : Integer_32; --*< Height above ellipsoid [mm]
-- hMSL : Integer_32; --*< Height above mean sea level [mm]
-- hAcc : Unsigned_32; --*< Horizontal accuracy estimate [mm]
-- vAcc : Unsigned_32; --*< Vertical accuracy estimate [mm]
-- velN : Integer_32; --*< NED north velocity [mm/s]
-- velE : Integer_32; --*< NED east velocity [mm/s]
-- velD : Integer_32; --*< NED down velocity [mm/s]
-- gSpeed : Integer_32; --*< Ground Speed (2-D) [mm/s]
-- headMot : Integer_32; --*< Heading of motion (2-D) [1e-5 deg]
-- sAcc : Unsigned_32; --*< Speed accuracy estimate [mm/s]
-- headAcc : Unsigned_32; --*< Heading accuracy estimate (motion and vehicle) [1e-5 deg]
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- reserved2 : Unsigned_16;
-- reserved3 : Unsigned_32;
-- headVeh : Integer_32; --*< (ubx8+ only) Heading of vehicle (2-D) [1e-5 deg]
-- reserved4 : Unsigned_32; --*< (ubx8+ only)
-- end record;
-- UBX_PAYLOAD_RX_NAV_PVT_SIZE_UBX7 : constant := (sizeof(ubx_payload_rx_nav_pvt_t) - 8);
-- UBX_PAYLOAD_RX_NAV_PVT_SIZE_UBX8 : constant := (sizeof(ubx_payload_rx_nav_pvt_t));
--
-- -- Rx NAV-TIMEUTC
-- type ubx_payload_rx_nav_timeutc_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- tAcc : Unsigned_32; --*< Time accuracy estimate (UTC) [ns]
-- nano : Integer_32; --*< Fraction of second, range -1e9 .. 1e9 (UTC) [ns]
-- year : Unsigned_16; --*< Year, range1_999..2099 (UTC)
-- month : Unsigned_8; --*< Month, range 1..12 (UTC)
-- day : Unsigned_8; --*< Day of month, range 1..31 (UTC)
-- hour : Unsigned_8; --*< Hour of day, range 0..23 (UTC)
-- min : Unsigned_8; --*< Minute of hour, range 0..59 (UTC)
-- sec : Unsigned_8; --*< Seconds of minute, range 0..60 (UTC)
-- valid : Unsigned_8; --*< Validity Flags (see UBX_RX_NAV_TIMEUTC_VALID...)
-- end record;
--
-- -- Rx NAV-SVINFO Part 1
-- type ubx_payload_rx_nav_svinfo_part1_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- numCh : Unsigned_8; --*< Number of channels
-- globalFlags : Unsigned_8;
-- reserved2 : Unsigned_16;
-- end record;
--
-- -- Rx NAV-SVINFO Part 2 (repeated)
-- type ubx_payload_rx_nav_svinfo_part2_t is record
-- chn : Unsigned_8; --*< Channel number, 255 for SVs not assigned to a channel
-- svid : Unsigned_8; --*< Satellite ID
-- flags : Unsigned_8;
-- quality : Unsigned_8;
-- Unsigned_8 cno; --*< Carrier to Noise Ratio (Strength : Signal) [dbHz]
-- elev : Integer_8; --*< Elevation [deg]
-- azim : Integer_16; --*< Azimuth [deg]
-- prRes : Integer_32; --*< Pseudo range residual [cm]
-- end record;
--
-- -- Rx NAV-SVIN (survey-in info)
-- type ubx_payload_rx_nav_svin_t is record
-- version : Unsigned_8;
-- Unsigned_8 reserved1(3);
-- iTOW : Unsigned_32;
-- dur : Unsigned_32;
-- meanX : Integer_32;
-- meanY : Integer_32;
-- meanZ : Integer_32;
-- meanXHP : Integer_8;
-- meanYHP : Integer_8;
-- meanZHP : Integer_8;
-- reserved2 : Integer_8;
-- meanAcc : Unsigned_32;
-- obs : Unsigned_32;
-- valid : Unsigned_8;
-- active : Unsigned_8;
-- Unsigned_8 reserved3(2);
-- end record;
--
-- -- Rx NAV-VELNED
-- type ubx_payload_rx_nav_velned_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- velN : Integer_32; --*< North velocity component [cm/s]
-- velE : Integer_32; --*< East velocity component [cm/s]
-- velD : Integer_32; --*< Down velocity component [cm/s]
-- speed : Unsigned_32; --*< Speed (3-D) [cm/s]
-- gSpeed : Unsigned_32; --*< Ground speed (2-D) [cm/s]
-- heading : Integer_32; --*< Heading of motion 2-D [1e-5 deg]
-- sAcc : Unsigned_32; --*< Speed accuracy estimate [cm/s]
-- cAcc : Unsigned_32; --*< Course / Heading accuracy estimate [1e-5 deg]
-- end record;
--
-- -- Rx MON-HW (ubx6)
-- type ubx_payload_rx_mon_hw_ubx6_t is record
-- pinSel : Unsigned_32;
-- pinBank : Unsigned_32;
-- pinDir : Unsigned_32;
-- pinVal : Unsigned_32;
-- noisePerMS : Unsigned_16;
-- agcCnt : Unsigned_16;
-- aStatus : Unsigned_8;
-- aPower : Unsigned_8;
-- flags : Unsigned_8;
-- reserved1 : Unsigned_8;
-- usedMask : Unsigned_32;
-- Unsigned_8 VP(25);
-- jamInd : Unsigned_8;
-- reserved3 : Unsigned_16;
-- pinIrq : Unsigned_32;
-- pullH : Unsigned_32;
-- pullL : Unsigned_32;
-- end record;
--
-- -- Rx MON-HW (ubx7+)
-- type ubx_payload_rx_mon_hw_ubx7_t is record
-- pinSel : Unsigned_32;
-- pinBank : Unsigned_32;
-- pinDir : Unsigned_32;
-- pinVal : Unsigned_32;
-- noisePerMS : Unsigned_16;
-- agcCnt : Unsigned_16;
-- aStatus : Unsigned_8;
-- aPower : Unsigned_8;
-- flags : Unsigned_8;
-- reserved1 : Unsigned_8;
-- usedMask : Unsigned_32;
-- Unsigned_8 VP(17);
-- jamInd : Unsigned_8;
-- reserved3 : Unsigned_16;
-- pinIrq : Unsigned_32;
-- pullH : Unsigned_32;
-- pullL : Unsigned_32;
-- end record;
--
-- -- Rx MON-VER Part 1
-- type ubx_payload_rx_mon_ver_part1_t is record
-- Unsigned_8 swVersion(30);
-- Unsigned_8 hwVersion(10);
-- end record;
--
-- -- Rx MON-VER Part 2 (repeated)
-- type ubx_payload_rx_mon_ver_part2_t is record
-- Unsigned_8 extension(30);
-- end record;
--
-- -- Rx ACK-ACK
-- typedef union {
-- msg : Unsigned_16;
-- type is
-- record
-- clsID : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- } ubx_payload_rx_ack_ack_t;
--
-- -- Rx ACK-NAK
-- typedef union {
-- msg : Unsigned_16;
-- type is
-- record
-- clsID : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- } ubx_payload_rx_ack_nak_t;
--
-- -- Tx CFG-PRT
-- type is
-- record
-- portID : Unsigned_8;
-- reserved0 : Unsigned_8;
-- txReady : Unsigned_16;
-- mode : Unsigned_32;
-- baudRate : Unsigned_32;
-- inProtoMask : Unsigned_16;
-- outProtoMask : Unsigned_16;
-- flags : Unsigned_16;
-- reserved5 : Unsigned_16;
-- end record ubx_payload_tx_cfg_prt_t;
--
-- -- Tx CFG-RATE
-- type is
-- record
-- measRate : Unsigned_16; --*< Measurement Rate, GPS measurements are taken every measRate milliseconds
-- navRate : Unsigned_16; --*< Navigation Rate, in number of measurement cycles. This parameter cannot be changed, and must be set to 1
-- timeRef : Unsigned_16; --*< Alignment to reference time: 0 := UTC time, 1 := GPS time
-- end record ubx_payload_tx_cfg_rate_t;
--
-- -- Tx CFG-NAV5
-- type is
-- record
-- mask : Unsigned_16;
-- dynModel : Unsigned_8; --*< Dynamic Platform model: 0 Portable, 2 Stationary, 3 Pedestrian, 4 Automotive, 5 Sea, 6 Airborne <1g, 7 Airborne <2g, 8 Airborne <4g
-- fixMode : Unsigned_8; --*< Position Fixing Mode: 1 2D only, 2 3D only, 3 Auto 2D/3D
-- fixedAlt : Integer_32;
-- fixedAltVar : Unsigned_32;
-- minElev : Integer_8;
-- drLimit : Unsigned_8;
-- pDop : Unsigned_16;
-- tDop : Unsigned_16;
-- pAcc : Unsigned_16;
-- tAcc : Unsigned_16;
-- staticHoldThresh : Unsigned_8;
-- dgpsTimeOut : Unsigned_8;
-- cnoThreshNumSVs : Unsigned_8; --*< (ubx7+ only,else0)
-- cnoThresh : Unsigned_8; --*< (ubx7+ only,else0)
-- reserved : Unsigned_16;
-- staticHoldMaxDist : Unsigned_16; --*< (ubx8+ only,else0)
-- utcStandard : Unsigned_8; --*< (ubx8+ only,else0)
-- reserved3 : Unsigned_8;
-- reserved4 : Unsigned_32;
-- end record ubx_payload_tx_cfg_nav5_t;
--
-- -- tx cfg-sbas
-- type is
-- record
-- mode : Unsigned_8;
-- usage : Unsigned_8;
-- maxSBAS : Unsigned_8;
-- scanmode2 : Unsigned_8;
-- scanmode1 : Unsigned_32;
-- end record ubx_payload_tx_cfg_sbas_t;
--
-- -- Tx CFG-MSG
-- struct {
-- union {
-- msg : Unsigned_16;
-- type is
-- record
-- msgClass : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- };
-- rate : Unsigned_8;
-- } ubx_payload_tx_cfg_msg_t;
--
-- -- CFG-TMODE3 ublox 8 (protocol version >= 20)
-- type is
-- record
-- version : Unsigned_8;
-- reserved1 : Unsigned_8;
-- flags : Unsigned_16;
-- ecefXOrLat : Integer_32;
-- ecefYOrLon : Integer_32;
-- ecefZOrAlt : Integer_32;
-- ecefXOrLatHP : Integer_8;
-- ecefYOrLonHP : Integer_8;
-- ecefZOrAltHP : Integer_8;
-- reserved2 : Unsigned_8;
-- fixedPosAcc : Unsigned_32;
-- svinMinDur : Unsigned_32;
-- svinAccLimit : Unsigned_32;
-- Unsigned_8 reserved3(8);
-- end record ubx_payload_tx_cfg_tmode3_t;
--
-- -- General message and payload buffer union
-- union {
-- payload_rx_nav_pvt : ubx_payload_rx_nav_pvt_t;
-- payload_rx_nav_posllh : ubx_payload_rx_nav_posllh_t;
-- payload_rx_nav_sol : ubx_payload_rx_nav_sol_t;
-- payload_rx_nav_dop : ubx_payload_rx_nav_dop_t;
-- payload_rx_nav_timeutc : ubx_payload_rx_nav_timeutc_t;
-- payload_rx_nav_svinfo_part1 : ubx_payload_rx_nav_svinfo_part1_t;
-- payload_rx_nav_svinfo_part2 : ubx_payload_rx_nav_svinfo_part2_t;
-- payload_rx_nav_svin : ubx_payload_rx_nav_svin_t;
-- payload_rx_nav_velned : ubx_payload_rx_nav_velned_t;
-- payload_rx_mon_hw_ubx6 : ubx_payload_rx_mon_hw_ubx6_t;
-- payload_rx_mon_hw_ubx7 : ubx_payload_rx_mon_hw_ubx7_t;
-- payload_rx_mon_ver_part1 : ubx_payload_rx_mon_ver_part1_t;
-- payload_rx_mon_ver_part2 : ubx_payload_rx_mon_ver_part2_t;
-- payload_rx_ack_ack : ubx_payload_rx_ack_ack_t;
-- payload_rx_ack_nak : ubx_payload_rx_ack_nak_t;
-- payload_tx_cfg_prt : ubx_payload_tx_cfg_prt_t;
-- payload_tx_cfg_rate : ubx_payload_tx_cfg_rate_t;
-- payload_tx_cfg_nav5 : ubx_payload_tx_cfg_nav5_t;
-- payload_tx_cfg_sbas : ubx_payload_tx_cfg_sbas_t;
-- payload_tx_cfg_msg : ubx_payload_tx_cfg_msg_t;
-- payload_tx_cfg_tmode3 : ubx_payload_tx_cfg_tmode3_t;
-- } ubxbuf_t;
--
-- #pragma pack(pop)
-- --** END OF u-blox protocol binary message and payload definitions **
--
-- -- Decoder state
-- enum {
-- UBX_DECODE_SYNC1 := 0,
-- UBX_DECODE_SYNC2,
-- UBX_DECODE_CLASS,
-- UBX_DECODE_ID,
-- UBX_DECODE_LENGTH1,
-- UBX_DECODE_LENGTH2,
-- UBX_DECODE_PAYLOAD,
-- UBX_DECODE_CHKSUM1,
-- UBX_DECODE_CHKSUM2,
--
-- UBX_DECODE_RTCM3
-- } ubxdecode_state_t;
--
-- -- Rx message state
-- enum {
-- UBX_RXMSG_IGNORE := 0,
-- UBX_RXMSG_HANDLE,
-- UBX_RXMSG_DISABLE,
-- UBX_RXMSG_ERROR_LENGTH
-- } ubx_rxmsg_state_t;
--
-- -- ACK state
-- enum {
-- UBX_ACK_IDLE := 0,
-- UBX_ACK_WAITING,
-- UBX_ACK_GOT_ACK,
-- UBX_ACK_GOT_NAK
-- } ubxack_state_t;
--
--
-- class GPSDriverUBX : public GPSHelper
-- {
-- <<public>>
-- GPSDriverUBX(callback : GPSCallbackPtr, void *callback_user, struct vehiclegps_position_s *gps_position,
-- struct satellite_info_s *satellite_info);
-- virtual not GPSDriverUBX;
-- function receive(timeout : unsigned) return Integer;
-- function configure(unsigned &baudrate; output_mode : OutputMode) return Integer;
--
-- function restartSurveyIn return Integer;
-- <<private>>
--
-- --*
-- -- Parse the binary UBX packet
-- --
-- function parseChar(b : in Unsigned_8) return Integer;
--
-- --*
-- -- Start payload rx
-- --
-- function payloadRxInit return Integer;
--
-- --*
-- -- Add payload rx byte
-- --
-- function payloadRxAdd(b : in Unsigned_8) return Integer;
-- function payloadRxAddNavSvinfo(b : in Unsigned_8) return Integer;
-- function payloadRxAddMonVer(b : in Unsigned_8) return Integer;
--
-- --*
-- -- Finish payload rx
-- --
-- function payloadRxDone return Integer;
--
-- --*
-- -- Reset the parse state machine for a fresh start
-- --
-- procedure decodeInit;
--
-- --*
-- -- While parsing add every byte (except the sync bytes) to the checksum
-- --
-- procedure addByteToChecksum(const Unsigned_8);
--
-- --*
-- -- Send a message
-- -- @return true on success, false on write error (set : errno)
-- --
-- function sendMessage(msg : in Unsigned_16; const Unsigned_8 *payload; length : in Unsigned_16) return Boolean;
--
-- --*
-- -- Configure message rate
-- -- @return true on success, false on write error
-- --
-- function configureMessageRate(msg : in Unsigned_16; rate : in Unsigned_8) return Boolean;
--
-- --*
-- -- Calculate and add checksum for given buffer
-- --
-- procedure calcChecksum(const Unsigned_8 *buffer; length : in Unsigned_16; ubx_checksum_t *checksum);
--
-- --*
-- -- Wait for message acknowledge
-- --
-- function waitForAck(msg : in Unsigned_16; timeout : in unsigned; report : in Boolean) return Integer;
--
-- --*
-- -- combines the configure_message_rate and wait_for_ack calls
-- -- @return true on success
-- --
-- inline Boolean configureMessageRateAndAck(msg : Unsigned_16, rate : Unsigned_8, Boolean report_ack_error := false);
--
-- --*
-- -- Calculate FNV1 hash
-- --
-- function fnv1_32_str(Unsigned_8 *str; hval : Unsigned_32) return Unsigned_32;
--
-- struct vehiclegps_position_s *gps_position;
-- struct satellite_info_s *satellite_info;
-- configured : Boolean;
-- ack_state : ubxack_state_t;
-- got_posllh : Boolean;
-- got_velned : Boolean;
-- decode_state : ubxdecode_state_t;
-- rx_msg : Unsigned_16;
-- rx_state : ubx_rxmsg_state_t;
-- rx_payload_length : Unsigned_16;
-- rx_payload_index : Unsigned_16;
-- rx_ck_a : Unsigned_8;
-- rx_ck_b : Unsigned_8;
-- disable_cmd_last : gps_abstime;
-- ack_waiting_msg : Unsigned_16;
-- buf : ubxbuf_t;
-- ubx_version : Unsigned_32;
-- use_nav_pvt : Boolean;
-- output_mode : OutputMode := OutputMode::GPS;
--
-- rtcm_message_t *rtcm_message := nullptr;
-- };
end ublox8.Protocol;
|
prototype/command-response/Sodium.agda | stevana/haarss | 1 | 721 | module Sodium where
open import Category.Functor
open import Category.Applicative
open import Category.Monad
open import Data.Unit
open import Data.Bool
open import Data.Maybe
open import Data.Product
open import IO.Primitive
postulate
-- Core.
Reactive : Set → Set
sync : ∀ {A} → Reactive A → IO A
Event : Set → Set
Behaviour : Set → Set
listen : ∀ {A} → Event A → (A → IO ⊤) → Reactive (IO ⊤)
filterJust : ∀ {A} → Event (Maybe A) → Event A
hold : ∀ {A} → A → Event A → Reactive (Behaviour A)
updates value : ∀ {A} → Behaviour A → Event A
snapshot : ∀ {A B C} → (A → B → C) → Event A → Behaviour B → Event C
-- Derived.
gate : ∀ {A} → Event A → Behaviour Bool → Event A
filterE : ∀ {A} → (A → Bool) → Event A → Event A
collectE : ∀ {A B} {S : Set} → (A → S → (B × S)) → S →
Event A → Reactive (Event B)
collect : ∀ {A B} {S : Set} → (A → S → (B × S)) → S →
Behaviour A → Reactive (Behaviour B)
accum : ∀ {A} → A → Event (A → A) → Reactive (Behaviour A)
-- IO.
executeSyncIO executeAsyncIO : ∀ {A} → Event (IO A) → Event A
-- Instances.
reactiveMonad : RawMonad Reactive
behaviourApplicative : RawApplicative Behaviour
eventFunctor : RawFunctor Event
|
src/btt_channel_four.asm | Gegel85/BTTGB | 1 | 95033 | <filename>src/btt_channel_four.asm
;channel 4
bttIntroFour::
db $00, $00, $00, $C0, QUAVER * 2 ; NO SOUND
db $00, $00, $00, $C0, $FF ; NO SOUND
bttChannelFour::
;mesure 1
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 2
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 3
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 4
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $67, $07, $C0, QUAVER * 2 ; Tsssssss
;mesure 5
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 6
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 7
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 8
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 9
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 10
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 11
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 12
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 13
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
;mesure 14
db $00, $67, $07, $C0, QUAVER ; Tsssssss
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 15
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 16
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 17
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 18
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 19
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 20
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 21
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, $FF ; NO SOUND
|
source/nodes/program-nodes-discrete_simple_expression_ranges.ads | optikos/oasis | 0 | 21264 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Discrete_Simple_Expression_Ranges;
with Program.Element_Visitors;
package Program.Nodes.Discrete_Simple_Expression_Ranges is
pragma Preelaborate;
type Discrete_Simple_Expression_Range is
new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text
with private;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Discrete_Subtype_Definition : Boolean := False)
return Discrete_Simple_Expression_Range;
type Implicit_Discrete_Simple_Expression_Range is
new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
with private;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Is_Discrete_Subtype_Definition : Boolean := False)
return Implicit_Discrete_Simple_Expression_Range
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Discrete_Simple_Expression_Range is
abstract new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
with record
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Discrete_Subtype_Definition : Boolean;
end record;
procedure Initialize
(Self : aliased in out Base_Discrete_Simple_Expression_Range'Class);
overriding procedure Visit
(Self : not null access Base_Discrete_Simple_Expression_Range;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Lower_Bound
(Self : Base_Discrete_Simple_Expression_Range)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Upper_Bound
(Self : Base_Discrete_Simple_Expression_Range)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Discrete_Subtype_Definition
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Discrete_Simple_Expression_Range_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Discrete_Range_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
type Discrete_Simple_Expression_Range is
new Base_Discrete_Simple_Expression_Range
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text
with record
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Discrete_Simple_Expression_Range_Text
(Self : aliased in out Discrete_Simple_Expression_Range)
return Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text_Access;
overriding function Double_Dot_Token
(Self : Discrete_Simple_Expression_Range)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Discrete_Simple_Expression_Range is
new Base_Discrete_Simple_Expression_Range
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Discrete_Simple_Expression_Range_Text
(Self : aliased in out Implicit_Discrete_Simple_Expression_Range)
return Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
end Program.Nodes.Discrete_Simple_Expression_Ranges;
|
maybe-thms.agda | rfindler/ial | 29 | 4367 | <reponame>rfindler/ial
module maybe-thms where
open import eq
open import level
open import maybe
open import product
open import sum
maybe-dec : ∀ {ℓ}{A : Set ℓ}(x : maybe A) → x ≡ nothing ∨ Σ A (λ a → x ≡ just a)
maybe-dec nothing = inj₁ refl
maybe-dec (just a) = inj₂ (a , refl) |
mkbiosimg/bootsecs/boot32.asm | zylon-internet/BooterMicro | 18 | 95900 | <reponame>zylon-internet/BooterMicro
; +--------+
; | |
; | |
; |--------| 4000:0000
; | |
; | FAT |
; | |
; |--------| 2000:0000
; |BOOT SEC|
; |RELOCATE|
; |--------| 1FE0:0000
; | |
; | |
; | |
; | |
; |--------|
; |BOOT SEC|
; |ORIGIN | 07C0:0000
; |--------|
; | |
; | |
; | |
; |--------|
; |KERNEL |
; |LOADED |
; |--------| 0060:0000
; | |
; +--------+
;%define MULTI_SEC_READ 1
segment .text
%define BASE 0x7c00
org BASE
Entry: jmp short real_start
nop
; bp is initialized to 7c00h
%define bsOemName bp+0x03 ; OEM label
%define bsBytesPerSec bp+0x0b ; bytes/sector
%define bsSecPerClust bp+0x0d ; sectors/allocation unit
%define bsResSectors bp+0x0e ; # reserved sectors
%define bsFATs bp+0x10 ; # of fats
%define bsRootDirEnts bp+0x11 ; # of root dir entries
%define bsSectors bp+0x13 ; # sectors total in image
%define bsMedia bp+0x15 ; media descrip: fd=2side9sec, etc...
%define sectPerFat bp+0x16 ; # sectors in a fat
%define sectPerTrack bp+0x18 ; # sectors/track
%define nHeads bp+0x1a ; # heads
%define nHidden bp+0x1c ; # hidden sectors
%define nSectorHuge bp+0x20 ; # sectors if > 65536
%define xsectPerFat bp+0x24 ; Sectors/Fat
%define xrootClst bp+0x2c ; Starting cluster of root directory
%define drive bp+0x40 ; Drive number
times 0x5a-$+$$ db 0
%define LOADSEG 0x0060
%define FATSEG 0x2000
%define fat_sector bp+0x48 ; last accessed sector of the FAT
%define loadsegoff_60 bp+loadseg_off-Entry ; FAR pointer = 60:0
%define loadseg_60 bp+loadseg_seg-Entry
%define fat_start bp+0x5e ; first FAT sector
%define data_start bp+0x62 ; first data sector
%define fat_secmask bp+0x66 ; number of clusters in a FAT sector - 1
%define fat_secshift bp+0x68 ; fat_secmask+1 = 2^fat_secshift
;-----------------------------------------------------------------------
; ENTRY
;-----------------------------------------------------------------------
real_start: cld
cli
sub ax, ax
mov ds, ax
mov bp, 0x7c00
mov ax, 0x1FE0
mov es, ax
mov si, bp
mov di, bp
mov cx, 0x0100
rep movsw ; move boot code to the 0x1FE0:0x0000
jmp word 0x1FE0:cont
loadseg_off dw 0
loadseg_seg dw LOADSEG
cont: mov ds, ax
mov ss, ax
lea sp, [bp-0x20]
sti
mov [drive], dl ; BIOS passes drive number in DL
; call print
; db "Loading ",0
; Calc Params
; Fat_Start
mov si, word [nHidden]
mov di, word [nHidden+2]
add si, word [bsResSectors]
adc di, byte 0
mov word [fat_start], si
mov word [fat_start+2], di
; Data_Start
mov al, [bsFATs]
cbw
push ax
mul word [xsectPerFat+2]
add di, ax
pop ax
mul word [xsectPerFat]
add ax, si
adc dx, di
mov word[data_start], ax
mov word[data_start+2], dx
; fat_secmask
mov ax, word[bsBytesPerSec]
shr ax, 1
shr ax, 1
dec ax
mov word [fat_secmask], ax
; fat_secshift
; cx = temp
; ax = fat_secshift
xchg ax, cx ; cx = 0 after movsw
inc cx
secshift: inc ax
shr cx, 1
cmp cx, 1
jne secshift
mov byte [fat_secshift], al
dec cx
; FINDFILE: Searches for the file in the root directory.
;
; Returns:
; DX:AX = first cluster of file
mov word [fat_sector], cx ; CX is 0 after "dec"
mov word [fat_sector + 2], cx
mov ax, word [xrootClst]
mov dx, word [xrootClst + 2]
ff_next_cluster:
push dx ; save cluster
push ax
call convert_cluster
jc boot_error ; EOC encountered
ff_next_sector:
push bx ; save sector count
les bx, [loadsegoff_60]
call readDisk
push dx ; save sector
push ax
mov ax, [bsBytesPerSec]
; Search for KERNEL.SYS file name, and find start cluster.
ff_next_entry: mov cx, 11
mov si, filename
mov di, ax
sub di, 0x20
repe cmpsb
jz ff_done
sub ax, 0x20
jnz ff_next_entry
pop ax ; restore sector
pop dx
pop bx ; restore sector count
dec bx
jnz ff_next_sector
ff_find_next_cluster:
pop ax ; restore current cluster
pop dx
call next_cluster
jmp short ff_next_cluster
ff_done:
mov ax, [es:di+0x1A-11] ; get cluster number
mov dx, [es:di+0x14-11]
c4:
sub bx, bx ; ES points to LOADSEG
c5: push dx
push ax
push bx
call convert_cluster
jc boot_success
mov di, bx
pop bx
c6:
call readDisk
dec di
jnz c6
pop ax
pop dx
call next_cluster
jmp short c5
boot_error:
xor ah,ah
int 0x16 ; wait for a key
int 0x19 ; reboot the machine
; input:
; DX:AX - cluster
; output:
; DX:AX - next cluster
; CX = 0
; modify:
; DI
next_cluster:
push es
mov di, ax
and di, [fat_secmask]
mov cx, [fat_secshift]
cn_loop:
shr dx,1
rcr ax,1
dec cx
jnz cn_loop ; DX:AX fat sector where our
; cluster resides
; DI - cluster index in this
; sector
shl di,1 ; DI - offset in the sector
shl di,1
add ax, [fat_start]
adc dx, [fat_start+2] ; DX:AX absolute fat sector
push bx
mov bx, FATSEG
mov es, bx
sub bx, bx
cmp ax, [fat_sector]
jne cn1 ; if the last fat sector we
; read was this, than skip
cmp dx,[fat_sector+2]
je cn_exit
cn1:
mov [fat_sector],ax ; save the fat sector number,
mov [fat_sector+2],dx ; we are going to read
call readDisk
cn_exit:
pop bx
mov ax, [es:di] ; DX:AX - next cluster
mov dx, [es:di + 2] ;
pop es
ret
boot_success:
mov bl, [drive]
jmp far [loadsegoff_60]
; Convert cluster to the absolute sector
;input:
; DX:AX - target cluster
;output:
; DX:AX - absoulute sector
; BX - [bsSectPerClust]
;modify:
; CX
convert_cluster:
cmp dx,0x0fff
jne c3
cmp ax,0xfff8
jb c3 ; if cluster is EOC (carry is set), do ret
stc
ret
c3:
mov cx, dx ; sector = (cluster - 2)*clussize +
; + data_start
sub ax, 2
sbb cx, byte 0 ; CX:AX == cluster - 2
mov bl, [bsSecPerClust]
sub bh, bh
xchg cx, ax ; AX:CX == cluster - 2
mul bx ; first handle high word
; DX must be 0 here
xchg ax, cx ; then low word
mul bx
add dx, cx ; DX:AX target sector
add ax, [data_start]
adc dx, [data_start + 2]
ret
; prints text after call to this function.
print_1char:
xor bx, bx ; video page 0
mov ah, 0x0E ; else print it
int 0x10 ; via TTY mode
print: pop si ; this is the first character
print1: lodsb ; get token
push si ; stack up potential return address
cmp al, 0 ; end of string?
jne print_1char ; until done
ret ; and jump to it
;input:
; DX:AX - 32-bit DOS sector number
; ES:BX - destination buffer
;output:
; ES:BX points one byte after the last byte read.
; DX:AX - next sector
;modify:
; ES if DI * bsBytesPerSec >= 65536, CX
readDisk:
read_next: push dx
push ax
;
; translate sector number to BIOS parameters
;
;
; abs = sector offset in track
; + head * sectPerTrack offset in cylinder
; + track * sectPerTrack * nHeads offset in platter
;
xchg ax, cx
mov al, [sectPerTrack]
mul byte [nHeads]
xchg ax, cx
; cx = nHeads * sectPerTrack <= 255*63
; dx:ax = abs
div cx
; ax = track, dx = sector + head * sectPertrack
xchg ax, dx
; dx = track, ax = sector + head * sectPertrack
div byte [sectPerTrack]
; dx = track, al = head, ah = sector
mov cx, dx
; cx = track, al = head, ah = sector
; the following manipulations are necessary in order to
; properly place parameters into registers.
; ch = cylinder number low 8 bits
; cl = 7-6: cylinder high two bits
; 5-0: sector
mov dh, al ; save head into dh for bios
xchg ch, cl ; set cyl no low 8 bits
ror cl, 1 ; move track high bits into
ror cl, 1 ; bits 7-6 (assumes top = 0)
inc ah ; sector offset from 1
or cl, ah ; merge sector into cylinder
mov ax, 0x0201
mov dl, [drive]
int 0x13
pop ax
pop dx
jnc read_ok ; jump if no error
xor ah, ah ; else, reset floppy
int 0x13
jmp short read_next
read_ok:
add bx, word [bsBytesPerSec]
jnc no_incr_es ; if overflow...
mov cx, es
add ch, 0x10 ; ...add 1000h to ES
mov es, cx
no_incr_es:
add ax,byte 1
adc dx,byte 0
ret
times 0x01f1-$+$$ db 0
filename db "KERNEL SYS",0,0
sign dw 0xAA55
|
programs/oeis/095/A095815.asm | karttu/loda | 0 | 96771 | <gh_stars>0
; A095815: n + largest digit of n.
; 2,4,6,8,10,12,14,16,18,11,12,14,16,18,20,22,24,26,28,22,23,24,26,28,30,32,34,36,38,33,34,35,36,38,40,42,44,46,48,44,45,46,47,48,50,52,54,56,58,55,56,57,58,59,60,62,64,66,68,66,67,68,69,70,71,72,74,76,78,77,78,79,80,81,82,83,84,86,88,88,89,90,91,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,108,101,102,104,106,108,110,112,114,116,118,111,112,114,116,118,120,122,124,126,128,122,123,124,126,128,130,132,134,136,138,133,134,135,136,138,140,142,144,146,148,144,145,146,147,148,150,152,154,156,158,155,156,157,158,159,160,162,164,166,168,166,167,168,169,170,171,172,174,176,178,177,178,179,180,181,182,183,184,186,188,188,189,190,191,192,193,194,195,196,198,199,200,201,202,203,204,205,206,207,208,202,203,204,206,208,210,212,214,216,218,212,213,214,216,218,220,222,224,226,228,222,223,224,226,228,230,232,234,236,238,233,234,235,236,238,240,242,244,246,248,244,245,246,247,248,250,252,254,256,258,255
mov $3,$0
add $0,1
lpb $0,1
mov $2,$0
div $0,10
mod $2,10
trn $1,$2
add $1,$2
lpe
add $1,1
add $1,$3
|
libsrc/_DEVELOPMENT/target/rc2014/driver/ram/c/sdcc/shadow_relocate_fastcall.asm | ahjelm/z88dk | 4 | 12777 | <filename>libsrc/_DEVELOPMENT/target/rc2014/driver/ram/c/sdcc/shadow_relocate_fastcall.asm<gh_stars>1-10
; void shadow_relocate(void * address) __z88dk_fastcall
SECTION smc_lib
PUBLIC _shadow_relocate_fastcall
EXTERN asm_push_di
EXTERN asm_pop_ei_jp
EXTERN asm_shadow_relocate
._shadow_relocate_fastcall
call asm_push_di
call asm_shadow_relocate
jp asm_pop_ei_jp
|
oeis/040/A040955.asm | neoneye/loda-programs | 11 | 244148 | ; A040955: Continued fraction for sqrt(987).
; Submitted by <NAME>
; 31,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
sub $1,2
div $1,5
mul $1,36
trn $1,$0
mov $0,$1
add $0,2
|
PIM/TD1_Algorithmique/pour_tantque.adb | Hathoute/ENSEEIHT | 1 | 8163 | <reponame>Hathoute/ENSEEIHT<gh_stars>1-10
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Pour_TantQue is
Debut: Integer;
Fin: Integer;
begin
-- Demander les valeurs de Debut et Fin
Get (Debut);
Get (Fin);
-- Afficher les entiers de Début à Fin
while Debut <= Fin loop
Put(Debut);
New_Line;
Debut := Debut + 1;
end loop;
end Pour_TantQue;
|
scripts/SMS/models_20210203/sat_34_20_6_3_3_2.als | eskang/alloy-maxsat-benchmark | 0 | 1448 |
abstract sig Task {
frags: set Frag,
r: Int,
d: Int,
first: Frag,
final: Frag,
deps: set Task
}
sig Completed in Task {}
one sig T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33 extends Task {}
fact {
frags =
T0 -> T0_0 + T0 -> T0_1 +
T1 -> T1_0 +
T2 -> T2_0 +
T3 -> T3_0 +
T4 -> T4_0 +
T5 -> T5_0 +
T6 -> T6_0 + T6 -> T6_1 +
T7 -> T7_0 + T7 -> T7_1 + T7 -> T7_2 +
T8 -> T8_0 + T8 -> T8_1 + T8 -> T8_2 +
T9 -> T9_0 + T9 -> T9_1 +
T10 -> T10_0 +
T11 -> T11_0 + T11 -> T11_1 +
T12 -> T12_0 +
T13 -> T13_0 + T13 -> T13_1 +
T14 -> T14_0 + T14 -> T14_1 +
T15 -> T15_0 +
T16 -> T16_0 +
T17 -> T17_0 +
T18 -> T18_0 + T18 -> T18_1 + T18 -> T18_2 +
T19 -> T19_0 + T19 -> T19_1 +
T20 -> T20_0 +
T21 -> T21_0 +
T22 -> T22_0 + T22 -> T22_1 +
T23 -> T23_0 + T23 -> T23_1 + T23 -> T23_2 +
T24 -> T24_0 + T24 -> T24_1 + T24 -> T24_2 +
T25 -> T25_0 +
T26 -> T26_0 + T26 -> T26_1 + T26 -> T26_2 +
T27 -> T27_0 + T27 -> T27_1 + T27 -> T27_2 +
T28 -> T28_0 +
T29 -> T29_0 +
T30 -> T30_0 +
T31 -> T31_0 + T31 -> T31_1 + T31 -> T31_2 +
T32 -> T32_0 +
T33 -> T33_0 + T33 -> T33_1 + T33 -> T33_2
r = T0 -> 6 + T1 -> 3 + T2 -> 7 + T3 -> 8 + T4 -> 17 + T5 -> 4 + T6 -> 9 + T7 -> 18 + T8 -> 17 + T9 -> 16 + T10 -> 17 + T11 -> 12 + T12 -> 0 + T13 -> 1 + T14 -> 18 + T15 -> 18 + T16 -> 18 + T17 -> 2 + T18 -> 5 + T19 -> 5 + T20 -> 3 + T21 -> 2 + T22 -> 11 + T23 -> 15 + T24 -> 9 + T25 -> 18 + T26 -> 14 + T27 -> 18 + T28 -> 1 + T29 -> 1 + T30 -> 18 + T31 -> 6 + T32 -> 5 + T33 -> 8
d = T0 -> 8 + T1 -> 4 + T2 -> 8 + T3 -> 23 + T4 -> 21 + T5 -> 13 + T6 -> 18 + T7 -> 36 + T8 -> 27 + T9 -> 28 + T10 -> 32 + T11 -> 18 + T12 -> 2 + T13 -> 7 + T14 -> 21 + T15 -> 33 + T16 -> 20 + T17 -> 5 + T18 -> 23 + T19 -> 10 + T20 -> 18 + T21 -> 4 + T22 -> 17 + T23 -> 33 + T24 -> 24 + T25 -> 30 + T26 -> 32 + T27 -> 26 + T28 -> 3 + T29 -> 4 + T30 -> 22 + T31 -> 18 + T32 -> 6 + T33 -> 11
first = T0 -> T0_0 + T1 -> T1_0 + T2 -> T2_0 + T3 -> T3_0 + T4 -> T4_0 + T5 -> T5_0 + T6 -> T6_0 + T7 -> T7_0 + T8 -> T8_0 + T9 -> T9_0 + T10 -> T10_0 + T11 -> T11_0 + T12 -> T12_0 + T13 -> T13_0 + T14 -> T14_0 + T15 -> T15_0 + T16 -> T16_0 + T17 -> T17_0 + T18 -> T18_0 + T19 -> T19_0 + T20 -> T20_0 + T21 -> T21_0 + T22 -> T22_0 + T23 -> T23_0 + T24 -> T24_0 + T25 -> T25_0 + T26 -> T26_0 + T27 -> T27_0 + T28 -> T28_0 + T29 -> T29_0 + T30 -> T30_0 + T31 -> T31_0 + T32 -> T32_0 + T33 -> T33_0
final = T0 -> T0_1 + T1 -> T1_0 + T2 -> T2_0 + T3 -> T3_0 + T4 -> T4_0 + T5 -> T5_0 + T6 -> T6_1 + T7 -> T7_2 + T8 -> T8_2 + T9 -> T9_1 + T10 -> T10_0 + T11 -> T11_1 + T12 -> T12_0 + T13 -> T13_1 + T14 -> T14_1 + T15 -> T15_0 + T16 -> T16_0 + T17 -> T17_0 + T18 -> T18_2 + T19 -> T19_1 + T20 -> T20_0 + T21 -> T21_0 + T22 -> T22_1 + T23 -> T23_2 + T24 -> T24_2 + T25 -> T25_0 + T26 -> T26_2 + T27 -> T27_2 + T28 -> T28_0 + T29 -> T29_0 + T30 -> T30_0 + T31 -> T31_2 + T32 -> T32_0 + T33 -> T33_2
deps =
T8 -> T24 +
T32 -> T13
}
abstract sig Frag {
s: Int,
c: Int,
prev: lone Frag
} {
s < 36
}
one sig T0_0,T0_1 extends Frag {}
one sig T1_0 extends Frag {}
one sig T2_0 extends Frag {}
one sig T3_0 extends Frag {}
one sig T4_0 extends Frag {}
one sig T5_0 extends Frag {}
one sig T6_0,T6_1 extends Frag {}
one sig T7_0,T7_1,T7_2 extends Frag {}
one sig T8_0,T8_1,T8_2 extends Frag {}
one sig T9_0,T9_1 extends Frag {}
one sig T10_0 extends Frag {}
one sig T11_0,T11_1 extends Frag {}
one sig T12_0 extends Frag {}
one sig T13_0,T13_1 extends Frag {}
one sig T14_0,T14_1 extends Frag {}
one sig T15_0 extends Frag {}
one sig T16_0 extends Frag {}
one sig T17_0 extends Frag {}
one sig T18_0,T18_1,T18_2 extends Frag {}
one sig T19_0,T19_1 extends Frag {}
one sig T20_0 extends Frag {}
one sig T21_0 extends Frag {}
one sig T22_0,T22_1 extends Frag {}
one sig T23_0,T23_1,T23_2 extends Frag {}
one sig T24_0,T24_1,T24_2 extends Frag {}
one sig T25_0 extends Frag {}
one sig T26_0,T26_1,T26_2 extends Frag {}
one sig T27_0,T27_1,T27_2 extends Frag {}
one sig T28_0 extends Frag {}
one sig T29_0 extends Frag {}
one sig T30_0 extends Frag {}
one sig T31_0,T31_1,T31_2 extends Frag {}
one sig T32_0 extends Frag {}
one sig T33_0,T33_1,T33_2 extends Frag {}
fact {
c =
T0_0 -> 1 + T0_1 -> 1 +
T1_0 -> 1 +
T2_0 -> 1 +
T3_0 -> 5 +
T4_0 -> 2 +
T5_0 -> 3 +
T6_0 -> 2 + T6_1 -> 1 +
T7_0 -> 3 + T7_1 -> 2 + T7_2 -> 1 +
T8_0 -> 3 + T8_1 -> 1 + T8_2 -> 1 +
T9_0 -> 4 + T9_1 -> 2 +
T10_0 -> 5 +
T11_0 -> 3 + T11_1 -> 3 +
T12_0 -> 1 +
T13_0 -> 1 + T13_1 -> 2 +
T14_0 -> 1 + T14_1 -> 2 +
T15_0 -> 5 +
T16_0 -> 1 +
T17_0 -> 3 +
T18_0 -> 2 + T18_1 -> 3 + T18_2 -> 1 +
T19_0 -> 2 + T19_1 -> 3 +
T20_0 -> 5 +
T21_0 -> 1 +
T22_0 -> 2 + T22_1 -> 4 +
T23_0 -> 3 + T23_1 -> 2 + T23_2 -> 1 +
T24_0 -> 3 + T24_1 -> 1 + T24_2 -> 1 +
T25_0 -> 6 +
T26_0 -> 2 + T26_1 -> 1 + T26_2 -> 3 +
T27_0 -> 1 + T27_1 -> 1 + T27_2 -> 2 +
T28_0 -> 1 +
T29_0 -> 3 +
T30_0 -> 4 +
T31_0 -> 3 + T31_1 -> 1 + T31_2 -> 2 +
T32_0 -> 1 +
T33_0 -> 1 + T33_1 -> 1 + T33_2 -> 1
prev =
T0_1 -> T0_0 +
T6_1 -> T6_0 +
T7_1 -> T7_0 + T7_2 -> T7_1 +
T8_1 -> T8_0 + T8_2 -> T8_1 +
T9_1 -> T9_0 +
T11_1 -> T11_0 +
T13_1 -> T13_0 +
T14_1 -> T14_0 +
T18_1 -> T18_0 + T18_2 -> T18_1 +
T19_1 -> T19_0 +
T22_1 -> T22_0 +
T23_1 -> T23_0 + T23_2 -> T23_1 +
T24_1 -> T24_0 + T24_2 -> T24_1 +
T26_1 -> T26_0 + T26_2 -> T26_1 +
T27_1 -> T27_0 + T27_2 -> T27_1 +
T31_1 -> T31_0 + T31_2 -> T31_1 +
T33_1 -> T33_0 + T33_2 -> T33_1
}
pred StartAfterRelease {
all t: Completed | t.first.s >= t.r
}
pred StartAfterPrevFrag {
all t: Completed, f1, f2: t.frags | f1 -> f2 in prev implies
f1.s >= plus[f2.s, f2.c]
}
pred SingleFrag {
all disj t1, t2: Completed, f1: t1.frags, f2: t2.frags |
f2.s >= plus[f1.s, f1.c] or f1.s >= plus[f2.s, f2.c]
}
pred TaskDep {
all t1: Completed, t2: t1.deps {
t1.first.s >= plus[t2.final.s, t2.final.c]
t2 in Completed
}
}
pred Deadline {
all t: Completed | t.d >= plus[t.final.s, t.final.c]
}
run {
StartAfterRelease
StartAfterPrevFrag
SingleFrag
TaskDep
Deadline
some Completed
} for 7 Int
|
third_party/antlr_grammars_v4/databank/databank.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 127 | 542 | /*
BSD License
Copyright (c) 2018, <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:
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 Tom Everett 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.
*/
/*
* http://archive.li/m3fki#selection-1331.0-1331.26
*/
grammar databank;
databank
: EOL* (datedseries | undatedseries) sample +
;
datedseries
: datatype dateline dateline
;
undatedseries
: dateline dateline
;
datatype
: ('-1' | '-4' | '-12') EOL
;
dateline
: number EOL
;
sample
: (number | 'NA') EOL?
;
number
: FLOATINGPOINT
;
FLOATINGPOINT
: NUMBER (E SIGN? NUMBER)?
;
fragment NUMBER
: ('0' .. '9') + ('.' ('0' .. '9')*)?
;
fragment E
: 'E' | 'e'
;
fragment SIGN
: ('+' | '-')
;
COMMENT
: '"c' ~ ["]* '"' ' '* EOL -> skip
;
EOL
: [\r\n] +
;
WS
: [ \t\r\n] -> skip
;
|
programs/oeis/037/A037236.asm | neoneye/loda | 22 | 179543 | ; A037236: Expansion of (3+2*x^2)/(1-x)^4.
; 3,12,32,68,125,208,322,472,663,900,1188,1532,1937,2408,2950,3568,4267,5052,5928,6900,7973,9152,10442,11848,13375,15028,16812,18732,20793,23000,25358,27872,30547,33388
mov $4,$0
add $0,1
mov $1,$0
mul $0,2
add $4,1
mov $3,$4
lpb $1
sub $1,1
add $2,$3
add $0,$2
add $3,2
lpe
|
4 - array indexado (com tipagem opcional)/TParser.g4 | melchisedech333/antlr4-experiments | 1 | 2539 | <reponame>melchisedech333/antlr4-experiments<filename>4 - array indexado (com tipagem opcional)/TParser.g4<gh_stars>1-10
parser grammar TParser;
options {
tokenVocab = TLexer;
}
@parser::postinclude {
#ifndef _WIN32
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
}
// Gramática.
main
: sentence EOF
;
sentence
: sentence expression
|
;
expression
: VAR variables END
;
variables
: definition
| definition SEPARATOR variables
;
definition
: VARIABLE ATTR value
| VARIABLE TYPE ATTR value
;
array
: ARRAY_OPEN ARRAY_CLOSE
| ARRAY_OPEN elements ARRAY_CLOSE
;
elements
: value
| value TYPE
| value SEPARATOR elements
| value TYPE SEPARATOR elements
;
value
: VARIABLE
| STRING
| INTEGER
| array
;
|
oeis/040/A040700.asm | neoneye/loda-programs | 11 | 171058 | <gh_stars>10-100
; A040700: Continued fraction for sqrt(727).
; Submitted by <NAME>(s1)
; 26,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
div $1,5
mul $1,21
add $0,$1
sub $0,2
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/valid1.adb | best08618/asylo | 7 | 26983 | <reponame>best08618/asylo
-- { dg-do run }
-- { dg-options "-gnatVi" }
procedure valid1 is
type m is range 0 .. 10;
for m'size use 8;
type r is record
a, b : m;
c, d, e, f : boolean;
end record;
pragma Pack (r);
for R'size use 20;
type G is array (1 .. 3, 1 .. 3) of R;
pragma Pack (G);
procedure h (c : m) is begin null; end;
GG : G := (others => (others => (2, 3, true, true, true, true)));
begin
h (GG (3, 2).a);
end;
|
stdlib-exts/Data/String/Instance.agda | WhatisRT/meta-cedille | 35 | 9555 | module Data.String.Instance where
open import Agda.Builtin.String
open import Class.Equality
open import Class.Monoid
open import Class.Show
open import Data.String renaming (_≟_ to _≟S_)
instance
String-Eq : Eq String
String-Eq = record { _≟_ = _≟S_ }
String-EqB : EqB String
String-EqB = record { _≣_ = primStringEquality }
String-Monoid : Monoid String
String-Monoid = record { mzero = "" ; _+_ = _++_ }
String-Show : Show String
String-Show = record { show = λ x -> x }
|
externals/mpir-3.0.0/mpn/x86_64w/mulmid_basecase.asm | JaminChan/eos_win | 12 | 240077 | ; PROLOGUE(mpn_mulmid_basecase)
;
; AMD64 mpn_mulmid_basecase
;
; Based on mul_basecase.asm from GMP 4.3.1, modifications are copyright
; (C) 2009, <NAME>. The original mul_basecase.asm was released under
; LGPLv3+, license terms reproduced below. These modifications are hereby
; released under the same terms.
;
; Windows Conversion Copyright 2010 Dr <NAME>
;
; Contributed to the GNU project by <NAME> and <NAME>.
;
; Copyright 2008 Free Software Foundation, Inc.
;
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published
; by the Free Software Foundation; either version 3 of the License, or (at
; your option) any later version.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
; License for more details.
;
; You should have received a copy of the GNU Lesser General Public License
; //www.gnu.org/licenses/.
;
; void mpn_mulmid_basecase(mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
%define reg_save_list rbx, rsi, rdi, rbp, r12, r13, r14, r15
%include 'yasm_mac.inc'
BITS 64
TEXT
xalign 16
WIN64_GCC_PROC mpn_mulmid_basecase, 5, frame
mov r15, rcx
lea r13, [rdx+1]
sub r13, r8
lea rdi, [rdi+r13*8]
cmp r13, 4
jc .29
lea rsi, [rsi+rdx*8]
test r8, 1
jz .10
.0: mov ebx, r13d
neg r13
mov rax, [rsi+r13*8]
mov r12, [r15]
mul r12
and r13, -4
mov r11, r13
and ebx, 3
jz .2
cmp ebx, 2
jc .3
jz .4
.1: mov r10, rax
mov rbx, rdx
lea r14, [rel .23]
jmp .8
xalign 16
.2: mov rbp, rax
mov r10, rdx
lea r14, [rel .20]
jmp .7
xalign 16
.3: add r11, 4
mov rcx, rax
mov rbp, rdx
mov r10d, 0
mov rax, [rsi+r11*8]
lea r14, [rel .21]
jmp .6
xalign 16
.4: mov rbx, rax
mov rcx, rdx
mov rax, [rsi+r11*8+24]
mov ebp, 0
mov r10d, 0
lea r14, [rel .22]
jmp .9
xalign 16
.5: mov [rdi+r11*8-16], rbx
add rcx, rax
mov rax, [rsi+r11*8]
adc rbp, rdx
.6: mov ebx, 0
mul r12
mov [rdi+r11*8-8], rcx
add rbp, rax
adc r10, rdx
.7: mov rax, [rsi+r11*8+8]
mul r12
mov [rdi+r11*8], rbp
add r10, rax
adc rbx, rdx
.8: mov rax, [rsi+r11*8+16]
mul r12
mov [rdi+r11*8+8], r10
mov ebp, 0
mov r10, rbp
add rbx, rax
mov rax, [rsi+r11*8+24]
mov rcx, rbp
adc rcx, rdx
.9: mul r12
add r11, 4
js .5
mov [rdi-16], rbx
add rcx, rax
mov [rdi-8], rcx
mov [rdi+8], rbp
adc rbp, rdx
mov [rdi], rbp
dec r8
jz .40
lea rsi, [rsi-8]
lea r15, [r15+8]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.10:mov ebx, r13d
neg r13
mov rax, [rsi+r13*8-8]
mov r12, [r15]
mov r9, [r15+8]
mul r9
and r13, -4
mov r11, r13
and ebx, 3
jz .12
cmp ebx, 2
jc .13
jz .14
.11:mov rcx, rax
mov rbp, rdx
lea r14, [rel .23]
jmp .17
xalign 16
.12:mov rbx, rax
mov rcx, rdx
lea r14, [rel .20]
jmp .16
xalign 16
.13:mov r10, rax
mov rbx, rdx
mov ecx, 0
lea r14, [rel .21]
jmp .19
xalign 16
.14:mov rbp, rax
mov r10, rdx
mov ebx, 0
mov rax, [rsi+r11*8+16]
lea r14, [rel .22]
jmp .18
xalign 16
.15:mov rax, [rsi+r11*8-8]
mul r9
add rbx, rax
adc rcx, rdx
.16:mov ebp, 0
mov rax, [rsi+r11*8]
mul r12
add rbx, rax
mov rax, [rsi+r11*8]
adc rcx, rdx
adc ebp, 0
mul r9
add rcx, rax
mov [rdi+r11*8], rbx
adc rbp, rdx
.17:mov rax, [rsi+r11*8+8]
mul r12
mov r10d, 0
add rcx, rax
adc rbp, rdx
mov ebx, 0
adc r10d, 0
mov rax, [rsi+r11*8+8]
mov [rdi+r11*8+8], rcx
mul r9
add rbp, rax
mov rax, [rsi+r11*8+16]
adc r10, rdx
.18:mov ecx, 0
mul r12
add rbp, rax
mov rax, [rsi+r11*8+16]
adc r10, rdx
adc ebx, 0
mul r9
add r10, rax
mov [rdi+r11*8+16], rbp
adc rbx, rdx
.19:mov rax, [rsi+r11*8+24]
mul r12
add r10, rax
adc rbx, rdx
adc ecx, 0
add r11, 4
mov [rdi+r11*8-8], r10
jnz .15
mov [rdi], rbx
mov [rdi+8], rcx
sub r8, 2
jz .40
lea r15, [r15+16]
lea rsi, [rsi-16]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.20:mov rax, [rsi+r11*8-8]
mul r9
mov rcx, rax
mov rbp, rdx
mov r10d, 0
jmp .25
xalign 16
.21:mov rax, [rsi+r11*8+16]
mul r9
mov rbx, rax
mov rcx, rdx
mov ebp, 0
mov rax, [rsi+r11*8+24]
jmp .28
xalign 16
.22:mov rax, [rsi+r11*8+8]
mul r9
mov r10, rax
mov rbx, rdx
mov ecx, 0
jmp .27
xalign 16
.23:mov rax, [rsi+r11*8]
mul r9
mov rbp, rax
mov r10, rdx
mov ebx, 0
mov ecx, 0
jmp .26
xalign 16
.24:mov r10d, 0
add rbx, rax
mov rax, [rsi+r11*8-8]
adc rcx, rdx
adc ebp, 0
mul r9
add [rdi+r11*8-8], rbx
adc rcx, rax
adc rbp, rdx
.25:mov rax, [rsi+r11*8]
mul r12
add rcx, rax
mov rax, [rsi+r11*8]
adc rbp, rdx
adc r10d, 0
mul r9
add [rdi+r11*8], rcx
mov ecx, 0
adc rbp, rax
mov ebx, 0
adc r10, rdx
.26:mov rax, [rsi+r11*8+8]
mul r12
add rbp, rax
mov rax, [rsi+r11*8+8]
adc r10, rdx
adc ebx, 0
mul r9
add [rdi+r11*8+8], rbp
adc r10, rax
adc rbx, rdx
.27:mov rax, [rsi+r11*8+16]
mul r12
add r10, rax
mov rax, [rsi+r11*8+16]
adc rbx, rdx
adc ecx, 0
mul r9
add [rdi+r11*8+16], r10
nop ; < not translated >
adc rbx, rax
mov ebp, 0
mov rax, [rsi+r11*8+24]
adc rcx, rdx
.28:mul r12
add r11, 4
jnz .24
add rbx, rax
adc rcx, rdx
adc ebp, 0
add [rdi-8], rbx
adc [rdi], rcx
adc [rdi+8], rbp
sub r8, 2
jz .40
lea r15, [r15+16]
lea rsi, [rsi-16]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.29:xor ebx, ebx
xor ecx, ecx
xor ebp, ebp
neg r13
mov eax, r8d
and eax, 3
jz .31
cmp eax, 2
jc .32
jz .33
.30:lea r15, [r15-8]
mov r10, r15
add r8, 1
mov r11, r8
lea r14, [rel .36]
jmp .36
.31:mov r10, r15
mov r11, r8
lea r14, [rip+0]
mov rax, [rsi+r11*8-8]
jmp .35
.32:lea r15, [r15+8]
mov r10, r15
add r8, 3
mov r11, r8
lea r14, [rip+0]
mov rax, [r10-8]
jmp .38
.33:lea r15, [r15-16]
mov r10, r15
add r8, 2
mov r11, r8
lea r14, [rip+0]
mov rax, [r10+16]
jmp .37
xalign 16
.34:add rbx, rax
adc rcx, rdx
mov rax, [rsi+r11*8-8]
adc rbp, 0
.35:mul qword [r10]
add rbx, rax
adc rcx, rdx
adc rbp, 0
.36:mov rax, [rsi+r11*8-16]
mul qword [r10+8]
add rbx, rax
mov rax, [r10+16]
adc rcx, rdx
adc rbp, 0
.37:mul qword [rsi+r11*8-24]
add rbx, rax
mov rax, [r10+24]
adc rcx, rdx
lea r10, [r10+32]
adc rbp, 0
.38:mul qword [rsi+r11*8-32]
sub r11, 4
jnz .34
add rbx, rax
adc rcx, rdx
adc rbp, 0
mov [rdi+r13*8], rbx
inc r13
jz .39
mov r11, r8
mov r10, r15
lea rsi, [rsi+8]
mov rbx, rcx
mov rcx, rbp
xor ebp, ebp
jmp r14
.39:mov [rdi], rcx
mov [rdi+8], rbp
.40:WIN64_GCC_END
end
|
ASM/src/mask_deequip.asm | kr3z/OoT-Randomizer | 0 | 170378 | <filename>ASM/src/mask_deequip.asm
; Check if equipped mask = item in child trade slot before de-equipping mask.
mask_check_trade_slot:
lui v1, 0x8012 ; Save Context pt. 1
lbu t7, 0x014F(t0) ; Equipped Mask Param
addiu v1, v1, 0xA5D0 ; Save Context pt. 2
addiu t7, t7, 0x23 ; Add 0x23 to equipped mask param to get item number.
lbu t8, 0x8B(v1) ; Item in Child Trade Slot
nop
beq t7, t8, @@return ; If they are equal, skip de-equipping the mask.
nop
jr ra
sb zero, 0x014F(t0) ; De-equip Mask
@@return:
jr ra
nop
|
oeis/163/A163605.asm | neoneye/loda-programs | 11 | 24986 | <reponame>neoneye/loda-programs
; A163605: a(n) = ((3+2*sqrt(2))*(5+sqrt(2))^n + (3-2*sqrt(2))*(5-sqrt(2))^n)/2.
; Submitted by <NAME>
; 3,19,121,773,4947,31691,203129,1302397,8352003,53564899,343552921,2203536533,14133648147,90655141211,581477504729,3729706799437,23923085385603,153447597468979,984245010820921,6313155366422693,40493918415345747,259736610725735531,1666005983704403129,10686117790352114077,68543040278319868803,439649693605100064259,2820007009649643660121,18088127143579135123253,116021110213849547049747,744184177836175362662651,4773356243443214044482329,30617326344200107103582317,196386069842807148012729603
mov $1,2
mov $3,3
lpb $0
sub $0,1
dif $1,2
mov $2,$3
mul $2,2
mul $3,6
add $3,$1
mul $1,8
add $1,$2
lpe
mov $0,$3
|
ScrollModus/_code/GlobalCode/enemyLogikLevelGlobal.asm | kosmonautdnb/TheLandsOfZador | 0 | 14054 | COLLECTABLE_DISAPPEAR_VELOCITY = $24
COLLECTABLE_TYPE_HEART = $00
COLLECTABLE_TYPE_DIAMOND = $01
COLLECTABLE_TYPE_STONE = $02
COLLECTABLE_TYPE_ITEM = $03
spritePointersForCollectables
dc.b SPRITEFRAMES_HEART
dc.b SPRITEFRAMES_DIAMOND
dc.b SPRITEFRAMES_SPARKLES
dc.b SPRITEFRAMES_ITEM
PLAYERSHOOT1_JUMP_VELOCITY = $0260
PLAYERSHOOT1_GRAVITY = $0020
PLAYERSHOOT1_FRAMES_DONE = $c0
;---------------------------------------------------------
;--- objects that can be collected ---
;---------------------------------------------------------
InitCollectable SUBROUTINE
ldy enemyAddPropertyIntern
lda spritePointersForCollectables,y
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
jsr enemyFlippedX
lda GameObjectFlags1,x
eor #$01
sta GameObjectSpriteFlippedX,x
tya
sta GameObjectVar1,x
lda #$00
sta GameObjectVar2,x ; off animation on/off
lda #$ff
sta GameObjectVar3,x ; off animation y move
sta GameObjectVar4,x ; off animation y move
lda #$1c
sta GameObjectVar5,x ; off animation duration
rts
HandleCollectable SUBROUTINE
lda GameObjectActiveCounter,x
clc
adc GameObjectXPosLo,x
lsr
lsr
lsr
and #$03
tay
lda threeFrameAnimation4,y
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectVar2,x
beq .notoffanimation
lda GameObjectYPosLoLo,x
clc
adc GameObjectVar3,x
sta GameObjectYPosLoLo,x
lda GameObjectYPosLo,x
adc GameObjectVar4,x
sta GameObjectYPosLo,x
lda GameObjectYPosHi,x
adc #$ff
sta GameObjectYPosHi,x
lda GameObjectVar3,x
sec
sbc #<COLLECTABLE_DISAPPEAR_VELOCITY
sta GameObjectVar3,x
lda GameObjectVar4,x
sbc #>COLLECTABLE_DISAPPEAR_VELOCITY
sta GameObjectVar4,x
lda GameObjectActiveCounter,x
lsr
lsr
lsr
lsr
and #$01
asl
sec
sbc #$01
jsr enemyMoveXNoCollision
dec GameObjectVar5,x
bne .notdone
txa
jsr removeEnemyFromLevel
.notdone
rts
.notoffanimation
lda GameObjectActiveCounter,x
and #31
clc
adc GameObjectXPosLo,x
clc
adc GameObjectXPosLo,x
and #31
lsr
lsr
lsr
lsr
and #$01
asl
sec
sbc #$01
jmp enemyMoveYNoCollision
;---------------------------------------------------------
;--- the shoot of the player ---
;---------------------------------------------------------
InitPlayerShot SUBROUTINE
lda #SPRITEFRAMES_PLAYERSHOT
sta GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectSpriteFlippedX + PLAYERGAMEOBJECT
and #$01
sta GameObjectFlags1,x
lda #GAMEOBJECT_COLLISIONTYPE_PLAYER_SHOT
sta GameObjectCollisionType,x
lda #<[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar1,x
lda #>[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar2,x
lda #$ff
sta GameObjectVar3,x
rts
;---------------------------------------------------------
;--- the player shot ---
;---------------------------------------------------------
HandlePlayerShot SUBROUTINE
lda #$01
sta playerShotActive
lda GameObjectActiveCounter,x
lsr
lsr
lsr
and #$01
clc
adc #SPRITEFRAMES_PLAYERSHOT
sta GameObjectSpriteImage,x
lda GameObjectActiveCounter,x
cmp #PLAYERSHOOT1_FRAMES_DONE
bne .dontdelete
lda enemyNr
jmp removeEnemyFromScreen
.dontdelete
; handle y movement
lda GameObjectYPosLoLo,x
clc
adc GameObjectVar1,x
sta GameObjectYPosLoLo,x
lda GameObjectYPosLo,x
adc GameObjectVar2,x
sta GameObjectYPosLo,x
lda GameObjectYPosHi,x
adc GameObjectVar3,x
sta GameObjectYPosHi,x
lda GameObjectVar1,x
clc
adc #<PLAYERSHOOT1_GRAVITY
sta GameObjectVar1,x
lda GameObjectVar2,x
adc #>PLAYERSHOOT1_GRAVITY
sta GameObjectVar2,x
lda GameObjectVar3,x
adc #$00
sta GameObjectVar3,x
jsr collisionEnemyDown
cmp #$00
beq .notcollidedDown
lda #SOUND_LITTLEJUMP
jsr triggerSound
lda #<[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar1,x
lda #>[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar2,x
lda #$ff
sta GameObjectVar3,x
.notcollidedDown
jsr collisionEnemyUp
cmp #$00
beq .notcollidedUp
lda #$00
sta GameObjectVar1,x
sta GameObjectVar2,x
sta GameObjectVar3,x
.notcollidedUp
lda GameObjectFlags1,x
bne .flipped
lda #$00
sta GameObjectSpriteFlippedX,x
lda #$01
jsr moveEnemyRightByAccu
jmp .checkFlip
.flipped
lda #$01
sta GameObjectSpriteFlippedX,x
lda #$01
jsr moveEnemyLeftByAccu
.checkFlip
cmp #$00
beq .notFlipped
lda #SOUND_LITTLEJUMP
jsr triggerSound
ldx enemyNr
lda GameObjectFlags1,x
eor #$01
sta GameObjectFlags1,x
.notFlipped
txa
tay
jmp eAddLazerParticlesY
;---------------------------------------------------------
;--- the explosion ---
;---------------------------------------------------------
HandleExplosion SUBROUTINE
lda #$03
jsr moveEnemyUpByAccu
ldx enemyNr
lda GameObjectVar1,x
;lsr
lsr
cmp #$04
bne .display
lda enemyNr
jmp removeEnemyFromLevel
.display
clc
adc #SPRITEFRAMES_EXPLOSION
sta GameObjectSpriteImage,x
inc GameObjectVar1,x
InitExplosion ; never called
rts
;---------------------------------------------------------
;--- the sparkles (for explosions) ---
;---------------------------------------------------------
InitSparkles SUBROUTINE
lda #SPRITEFRAMES_SPARKLES
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
lda enemyAddPropertyIntern
sta GameObjectVar1,x
rts
HandleSparkles SUBROUTINE
lda GameObjectActiveCounter,x
cmp #12
bne .notdeleted
lda #GAMEOBJECT_COLLISIONTYPE_FREE_ENEMY_SLOT
sta GameObjectCollisionType,x ; free enemy
rts
.notdeleted
lsr
lsr
and #$03
tay
lda threeFrameAnimation4,y
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectVar1,x
beq .normalfree
sta GameObjectSpriteImage,x
lda #$fe
jsr enemyMoveYNoCollision
.normalfree
lda #$fd
jmp enemyMoveYNoCollision
;---------------------------------------------------------
;--- initializes a schalter ---
;---------------------------------------------------------
InitSchalter SUBROUTINE
lda enemyAddPropertyIntern
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
lda enemyAddSpecialValue
sta GameObjectVar1,x
rts
HandleSchalter SUBROUTINE
lda GameObjectVar1,x
sec
sbc #SCHALTERENEMYTYPESTART
asl
tay
lda layers + 0,y
sta .read + 1
lda layers + 1,y
sta .read + 2
.read
lda $4444
and #$01
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
rts
|
programs/oeis/056/A056864.asm | neoneye/loda | 22 | 105468 | <gh_stars>10-100
; A056864: Nearest integer to n^2/10.
; 0,0,0,1,2,3,4,5,6,8,10,12,14,17,20,23,26,29,32,36,40,44,48,53,58,63,68,73,78,84,90,96,102,109,116,123,130,137,144,152,160,168,176,185,194,203,212,221,230,240,250,260,270,281,292,303,314,325
pow $0,2
add $0,5
div $0,10
|
oeis/109/A109630.asm | neoneye/loda-programs | 11 | 98254 | ; A109630: The winning position when playing the "eeny meeny miny moe" game with n players and eliminating every 8th player.
; 1,1,3,3,1,3,4,4,3,1,9,5,13,7,15,7,15,5,13,1,9,17,2,10,18,26,7,15,23,1,9,17,25,33,6,14,22,30,38,6,14,22,30,38,1,9,17,25,33,41,49,5,13,21,29,37,45,53,2,10,18,26,34,42,50,58,66,6,14,22,30,38,46,54,62,70,1,9,17,25
mov $2,1
lpb $0
sub $0,1
add $1,8
add $2,1
mod $1,$2
lpe
mov $0,$1
add $0,1
|
samples/prime.asm | SohamMalakar/Intel-8085 | 0 | 178040 | <reponame>SohamMalakar/Intel-8085
MVI A, 00
STA f200
LDA f100 // input
MOV L, A
RRC
ANI 7f
MOV D, A
MVI E, 00 // flag
MVI B, 01 // iterator
MVI C, 00 // counter
LOOP:
CMP B
JC OUT // if A < B, jump out
MOV A, L
CALL REM
MOV A, D
INR B
JMP LOOP
OUT: MOV A, C
CPI 01
JNZ NOT
INR E
MOV A, E
STA f200
NOT: HLT
REM:
MOV H, B
LOOP1:
CMP H
JC END // if A < H, jump out
SUB H
JMP LOOP1
END: CPI 00
JNZ NO
INR C
NO: RET
|
day22/day22.adb | thorstel/Advent-of-Code-2018 | 2 | 14009 | <gh_stars>1-10
with Ada.Assertions; use Ada.Assertions;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Priority_Queues;
procedure Day22 is
Max_Dim : constant Natural := 800;
Grid : array
(Natural range 0 .. Max_Dim, Natural range 0 .. Max_Dim) of Natural :=
(others => (others => 0));
Depth : Natural;
Target_X : Natural;
Target_Y : Natural;
function Geological_Index (X, Y : Natural) return Natural is
begin
if X = Target_X and Y = Target_Y then
return 0;
elsif Y = 0 then
return X * 16807;
elsif X = 0 then
return Y * 48271;
else
return Grid (X - 1, Y) * Grid (X, Y - 1);
end if;
end Geological_Index;
function Erosion_Level (X, Y : Natural) return Natural is
((Geological_Index (X, Y) + Depth) mod 20183);
File : File_Type;
begin
-- Input Handling
Open (File, In_File, "input.txt");
declare
Line1 : constant String := Get_Line (File);
Line2 : constant String := Get_Line (File);
Comma : Positive := Line2'First;
begin
Depth := Natural'Value (Line1 (8 .. Line1'Last));
while Comma <= Line2'Last loop
exit when Line2 (Comma) = ',';
Comma := Comma + 1;
end loop;
Assert (Comma < Line2'Last, "Invalid input!");
Target_X := Natural'Value (Line2 (9 .. Comma - 1));
Target_Y := Natural'Value (Line2 (Comma + 1 .. Line2'Last));
end;
Close (File);
-- Calculating the erosion levels for the grid.
for Y in Grid'Range (2) loop
for X in Grid'Range (1) loop
Grid (X, Y) := Erosion_Level (X, Y);
end loop;
end loop;
-- Changing grid from erosion Levels to terrain & part 1
declare
Risk_Level : Natural := 0;
begin
for Y in Grid'Range (2) loop
for X in Grid'Range (1) loop
Grid (X, Y) := Grid (X, Y) mod 3;
if X <= Target_X and Y <= Target_Y then
Risk_Level := Risk_Level + Grid (X, Y);
end if;
end loop;
end loop;
Put_Line ("Part 1 =" & Natural'Image (Risk_Level));
end;
-- Part 2
Dijkstra_Algorithm :
declare
type Tool_Type is (Torch, Climbing_Gear, Neither);
type Position is record
X : Integer;
Y : Integer;
end record;
type Node_Type is record
Visited : Boolean;
Distance : Natural;
end record;
type Queue_Element is record
X : Natural;
Y : Natural;
Tool : Tool_Type;
Distance : Natural;
end record;
function Can_Use (Tool : Tool_Type; Terrain : Natural) return Boolean is
begin
case Terrain is
when 0 => return Tool = Climbing_Gear or Tool = Torch;
when 1 => return Tool = Climbing_Gear or Tool = Neither;
when 2 => return Tool = Torch or Tool = Neither;
when others =>
raise Constraint_Error
with "Illegal terrain type:" & Natural'Image (Terrain);
end case;
end Can_Use;
function Get_Priority (Element : Queue_Element) return Natural is
(Element.Distance);
function Before (Left, Right : Natural) return Boolean is (Left < Right);
package QI is new Ada.Containers.Synchronized_Queue_Interfaces
(Element_Type => Queue_Element);
package PQ is new Ada.Containers.Unbounded_Priority_Queues
(Queue_Interfaces => QI, Queue_Priority => Natural);
use PQ;
use Ada.Containers;
Directions : constant array (Positive range <>) of Position :=
((1, 0), (-1, 0), (0, 1), (0, -1));
Nodes : array
(Natural range 0 .. Max_Dim,
Natural range 0 .. Max_Dim,
Tool_Type'Range) of Node_Type :=
(others => (others => (others => (False, 0))));
E : Queue_Element;
Q : Queue;
begin
Q.Enqueue ((0, 0, Torch, 0)); -- Start with torch equipped
while Q.Current_Use > 0 and not Nodes (Target_X, Target_Y, Torch).Visited
loop
Q.Dequeue (E);
if not Nodes (E.X, E.Y, E.Tool).Visited then
Nodes (E.X, E.Y, E.Tool).Visited := True;
Nodes (E.X, E.Y, E.Tool).Distance := E.Distance;
for Dir of Directions loop
if (E.X > 0 or Dir.X >= 0) and
(E.Y > 0 or Dir.Y >= 0) and
(E.X < Max_Dim or Dir.X <= 0) and
(E.Y < Max_Dim or Dir.Y <= 0)
then
declare
New_X : constant Natural := E.X + Dir.X;
New_Y : constant Natural := E.Y + Dir.Y;
begin
if Can_Use (E.Tool, Grid (New_X, New_Y)) and
not Nodes (New_X, New_Y, E.Tool).Visited
then
Q.Enqueue ((New_X, New_Y, E.Tool, E.Distance + 1));
end if;
end;
end if;
end loop;
for Tool in Tool_Type'Range loop
if not Nodes (E.X, E.Y, Tool).Visited and
Can_Use (Tool, Grid (E.X, E.Y))
then
Q.Enqueue ((E.X, E.Y, Tool, E.Distance + 7));
end if;
end loop;
end if;
end loop;
Put_Line
("Part 2 =" &
Natural'Image (Nodes (Target_X, Target_Y, Torch).Distance));
end Dijkstra_Algorithm;
end Day22;
|
oldstuff/tigcc/PolySnd/sources/statique/_Ptridle_voice1.asm | bcherry/bcherry | 3 | 16876 | <reponame>bcherry/bcherry<filename>oldstuff/tigcc/PolySnd/sources/statique/_Ptridle_voice1.asm
section ".data"
xdef pSnd_Ptridle_voice1
pSnd_Ptridle_voice1:
move.l a0,d0
tst.l d0
beq.s return_ptr_voice1
move.l d0,ptridle_voice1
bsr pSnd_SkipData_voice1
suba.l a0,a0
rts
return_ptr_voice1:
move.l ptridle_voice1,a0
rts |
programs/oeis/209/A209116.asm | jmorken/loda | 1 | 29599 | <reponame>jmorken/loda<gh_stars>1-10
; A209116: Number of 4-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero and avoiding the patterns z z+1 z+2 and z z-1 z-2.
; 5,22,55,120,221,362,559,816,1137,1538,2023,2596,3273,4058,4955,5980,7137,8430,9875,11476,13237,15174,17291,19592,22093,24798,27711,30848,34213,37810,41655,45752,50105,54730,59631,64812,70289,76066,82147,88548
mov $2,$0
mov $4,$0
add $4,1
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
mov $3,$0
add $0,2
add $3,$0
log $0,$0
mov $5,-3
gcd $5,$3
pow $3,2
sub $5,2
mul $5,2
add $5,1
sub $5,$3
mov $6,$0
trn $6,2
sub $6,$5
add $1,$6
lpe
|
code/5-S-6.asm | gdzhang2012/Assembly-Language-by-Wangshuang | 0 | 4899 | assume cs:code
code segment
mov ax,0ffffh
mov ds,ax
mov bx,0
mov dx,0
mov cx,12
s: mov al,[bx]
mov ah,0
add dx,ax
inc bx
loop s
mov ax,4c00h
int 21h
code ends
end
|
Student/examples/Correct/Subprograms/Hanoi.asm | SoftMoore/CPRL-Kt | 6 | 162659 | PROGRAM 4
BR L5
L0:
PROC 0
LDLADDR -10
LOADW
LDCINT 0
CMP
BLE L3
LDLADDR -10
LOADW
LDCINT 1
SUB
LDLADDR -6
LOAD2B
LDLADDR -2
LOAD2B
LDLADDR -4
LOAD2B
CALL L0
LDCSTR "Move a disk from "
PUTSTR
LDLADDR -6
LOAD2B
PUTCH
LDCSTR " to "
PUTSTR
LDLADDR -4
LOAD2B
PUTCH
PUTEOL
LDLADDR -10
LOADW
LDCINT 1
SUB
LDLADDR -2
LOAD2B
LDLADDR -4
LOAD2B
LDLADDR -6
LOAD2B
CALL L0
L3:
L4:
RET 10
L5:
LDCSTR "Enter number of disks to be moved: "
PUTSTR
LDGADDR 0
GETINT
STOREW
LDGADDR 0
LOADW
LDCCH 'A'
LDCCH 'B'
LDCCH 'C'
CALL L0
HALT
|
Lambda/Closure/Functional.agda | nad/codata | 1 | 12313 | ------------------------------------------------------------------------
-- Functional semantics for an untyped λ-calculus with constants
------------------------------------------------------------------------
module Lambda.Closure.Functional where
open import Category.Monad
open import Category.Monad.Partiality as Partiality
using (_⊥; never; OtherKind; other; steps)
open import Codata.Musical.Notation
open import Data.Empty using (⊥-elim)
open import Data.List hiding (lookup)
open import Data.Maybe hiding (_>>=_)
import Data.Maybe.Categorical as Maybe
open import Data.Nat
open import Data.Product
open import Data.Sum
open import Data.Vec using (Vec; []; _∷_; lookup)
open import Function
import Level
open import Relation.Binary using (module Preorder)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
open import Relation.Nullary.Negation
open Partiality._⊥
private
open module E {A : Set} = Partiality.Equality (_≡_ {A = A})
open module R {A : Set} =
Partiality.Reasoning (P.isEquivalence {A = A})
open import Lambda.Syntax
open Closure Tm
open import Lambda.VirtualMachine
open Functional
private
module VM = Closure Code
------------------------------------------------------------------------
-- A monad with partiality and failure
PF : RawMonad {f = Level.zero} (_⊥ ∘ Maybe)
PF = Maybe.monadT Partiality.monad
module PF where
open RawMonad PF public
fail : {A : Set} → Maybe A ⊥
fail = now nothing
_>>=-cong_ :
∀ {k} {A B : Set} {x₁ x₂ : Maybe A ⊥} {f₁ f₂ : A → Maybe B ⊥} →
Rel k x₁ x₂ → (∀ x → Rel k (f₁ x) (f₂ x)) →
Rel k (x₁ >>= f₁) (x₂ >>= f₂)
_>>=-cong_ {k} {f₁ = f₁} {f₂} x₁≈x₂ f₁≈f₂ =
Partiality._>>=-cong_ x₁≈x₂ helper
where
helper : ∀ {x y} → x ≡ y →
Rel k (maybe f₁ fail x) (maybe f₂ fail y)
helper {x = nothing} P.refl = fail ∎
helper {x = just x} P.refl = f₁≈f₂ x
associative :
{A B C : Set}
(x : Maybe A ⊥) (f : A → Maybe B ⊥) (g : B → Maybe C ⊥) →
(x >>= f >>= g) ≅ (x >>= λ y → f y >>= g)
associative x f g =
(x >>= f >>= g) ≅⟨ Partiality.associative P.refl x _ _ ⟩
(x >>=′ λ y → maybe f fail y >>= g) ≅⟨ Partiality._>>=-cong_ (x ∎) helper ⟩
(x >>= λ y → f y >>= g) ∎
where
open RawMonad Partiality.monad renaming (_>>=_ to _>>=′_)
helper : ∀ {y₁ y₂} → y₁ ≡ y₂ →
(maybe f fail y₁ >>= g) ≅ maybe (λ z → f z >>= g) fail y₂
helper {y₁ = nothing} P.refl = fail ∎
helper {y₁ = just y} P.refl = (f y >>= g) ∎
>>=-inversion-⇓ :
∀ {k} {A B : Set} x {f : A → Maybe B ⊥} {y} →
(x>>=f⇓ : (x >>= f) ⇓[ k ] just y) →
∃ λ z → ∃₂ λ (x⇓ : x ⇓[ k ] just z)
(fz⇓ : f z ⇓[ k ] just y) →
steps x⇓ + steps fz⇓ ≡ steps x>>=f⇓
>>=-inversion-⇓ x {f} x>>=f⇓
with Partiality.>>=-inversion-⇓ {_∼A_ = _≡_} P.refl x x>>=f⇓
... | (nothing , x↯ , now () , _)
... | (just z , x⇓ , fz⇓ , eq) = (z , x⇓ , fz⇓ , eq)
>>=-inversion-⇑ :
∀ {k} {A B : Set} x {f : A → Maybe B ⊥} →
(x >>= f) ⇑[ other k ] →
¬ ¬ (x ⇑[ other k ] ⊎
∃ λ y → x ⇓[ other k ] just y × f y ⇑[ other k ])
>>=-inversion-⇑ {k} x {f} x>>=f⇑ =
helper ⟨$⟩ Partiality.>>=-inversion-⇑ P.isEquivalence x x>>=f⇑
where
open RawMonad ¬¬-Monad renaming (_<$>_ to _⟨$⟩_)
helper : (_ ⊎ ∃ λ (y : Maybe _) → _) → _
helper (inj₁ x⇑ ) = inj₁ x⇑
helper (inj₂ (just y , x⇓,fy⇑) ) = inj₂ (y , x⇓,fy⇑)
helper (inj₂ (nothing , x↯,now∼never)) =
⊥-elim (Partiality.now≉never (proj₂ x↯,now∼never))
------------------------------------------------------------------------
-- A workaround for the limitations of guardedness
module Workaround where
data Maybe_⊥P : Set → Set₁ where
fail : ∀ {A} → Maybe A ⊥P
return : ∀ {A} (x : A) → Maybe A ⊥P
later : ∀ {A} (x : ∞ (Maybe A ⊥P)) → Maybe A ⊥P
_>>=_ : ∀ {A B} (x : Maybe A ⊥P) (f : A → Maybe B ⊥P) → Maybe B ⊥P
private
data Maybe_⊥W : Set → Set₁ where
fail : ∀ {A} → Maybe A ⊥W
return : ∀ {A} (x : A) → Maybe A ⊥W
later : ∀ {A} (x : Maybe A ⊥P) → Maybe A ⊥W
mutual
_>>=W_ : ∀ {A B} → Maybe A ⊥W → (A → Maybe B ⊥P) → Maybe B ⊥W
fail >>=W f = fail
return x >>=W f = whnf (f x)
later x >>=W f = later (x >>= f)
whnf : ∀ {A} → Maybe A ⊥P → Maybe A ⊥W
whnf fail = fail
whnf (return x) = return x
whnf (later x) = later (♭ x)
whnf (x >>= f) = whnf x >>=W f
mutual
private
⟪_⟫W : ∀ {A} → Maybe A ⊥W → Maybe A ⊥
⟪ fail ⟫W = PF.fail
⟪ return x ⟫W = PF.return x
⟪ later x ⟫W = later (♯ ⟪ x ⟫P)
⟪_⟫P : ∀ {A} → Maybe A ⊥P → Maybe A ⊥
⟪ p ⟫P = ⟪ whnf p ⟫W
-- The definitions above make sense. ⟪_⟫P is homomorphic with respect
-- to fail, return, later and _>>=_.
fail-hom : ∀ {A} → ⟪ fail {A = A} ⟫P ≅ PF.fail
fail-hom = PF.fail ∎
return-hom : ∀ {A} (x : A) → ⟪ return x ⟫P ≅ PF.return x
return-hom x = PF.return x ∎
later-hom : ∀ {A} (x : ∞ Maybe A ⊥P) →
⟪ later x ⟫P ≅ later (♯ ⟪ ♭ x ⟫P)
later-hom x = later (♯ (⟪ ♭ x ⟫P ∎))
mutual
private
>>=-homW : ∀ {A B} (x : Maybe A ⊥W) (f : A → Maybe B ⊥P) →
⟪ x >>=W f ⟫W ≅ PF._>>=_ ⟪ x ⟫W (λ y → ⟪ f y ⟫P)
>>=-homW fail f = PF.fail ∎
>>=-homW (return x) f = ⟪ f x ⟫P ∎
>>=-homW (later x) f = later (♯ >>=-hom x f)
>>=-hom : ∀ {A B} (x : Maybe A ⊥P) (f : A → Maybe B ⊥P) →
⟪ x >>= f ⟫P ≅ PF._>>=_ ⟪ x ⟫P (λ y → ⟪ f y ⟫P)
>>=-hom x f = >>=-homW (whnf x) f
open Workaround hiding (_>>=_)
------------------------------------------------------------------------
-- Semantics
infix 5 _∙_
-- Note that this definition gives us determinism "for free".
mutual
⟦_⟧′ : ∀ {n} → Tm n → Env n → Maybe Value ⊥P
⟦ con i ⟧′ ρ = return (con i)
⟦ var x ⟧′ ρ = return (lookup ρ x)
⟦ ƛ t ⟧′ ρ = return (ƛ t ρ)
⟦ t₁ · t₂ ⟧′ ρ = ⟦ t₁ ⟧′ ρ >>= λ v₁ →
⟦ t₂ ⟧′ ρ >>= λ v₂ →
v₁ ∙ v₂
where open Workaround
_∙_ : Value → Value → Maybe Value ⊥P
con i ∙ v₂ = fail
ƛ t₁ ρ ∙ v₂ = later (♯ (⟦ t₁ ⟧′ (v₂ ∷ ρ)))
⟦_⟧ : ∀ {n} → Tm n → Env n → Maybe Value ⊥
⟦ t ⟧ ρ = ⟪ ⟦ t ⟧′ ρ ⟫P
------------------------------------------------------------------------
-- Example
Ω-loops : ⟦ Ω ⟧ [] ≈ never
Ω-loops = later (♯ Ω-loops)
------------------------------------------------------------------------
-- Some lemmas
open PF hiding (_>>=_)
-- An abbreviation.
infix 5 _⟦·⟧_
_⟦·⟧_ : Maybe Value ⊥ → Maybe Value ⊥ → Maybe Value ⊥
v₁ ⟦·⟧ v₂ = v₁ >>= λ v₁ → v₂ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P
where open PF
-- _⟦·⟧_ preserves equality.
_⟦·⟧-cong_ : ∀ {k v₁₁ v₁₂ v₂₁ v₂₂} →
Rel k v₁₁ v₂₁ → Rel k v₁₂ v₂₂ →
Rel k (v₁₁ ⟦·⟧ v₁₂) (v₂₁ ⟦·⟧ v₂₂)
v₁₁≈v₂₁ ⟦·⟧-cong v₁₂≈v₂₂ =
v₁₁≈v₂₁ >>=-cong λ v₁ →
v₁₂≈v₂₂ >>=-cong λ v₂ →
⟪ v₁ ∙ v₂ ⟫P ∎
-- The semantics of application is compositional (with respect to the
-- syntactic equality which is used).
·-comp : ∀ {n} (t₁ t₂ : Tm n) {ρ} →
⟦ t₁ · t₂ ⟧ ρ ≅ ⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ
·-comp t₁ t₂ {ρ} =
⟦ t₁ · t₂ ⟧ ρ ≅⟨ >>=-hom (⟦ t₁ ⟧′ ρ) _ ⟩
PF._>>=_ (⟦ t₁ ⟧ ρ) (λ v₁ →
⟪ Workaround._>>=_ (⟦ t₂ ⟧′ ρ) (λ v₂ →
v₁ ∙ v₂) ⟫P) ≅⟨ ((⟦ t₁ ⟧ ρ ∎) >>=-cong λ _ →
>>=-hom (⟦ t₂ ⟧′ ρ) _) ⟩
⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ ∎
open PF
------------------------------------------------------------------------
-- Compiler correctness
module Correctness {k : OtherKind} where
infix 4 _≈P_ _≈W_
infixr 2 _≡⟨_⟩W_ _≈⟨_⟩P_ _≈⟨_⟩W_
mutual
data _≈P_ : Maybe VM.Value ⊥ → Maybe VM.Value ⊥ → Set where
_≈⟨_⟩P_ : ∀ x {y z} (x≈y : x ≈P y) (y≅z : y ≅ z) → x ≈P z
correct :
∀ {n} t {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(hyp : ∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩
≈W k v) →
exec ⟨ comp t c , s , comp-env ρ ⟩ ≈P (⟦ t ⟧ ρ >>= k)
data _≈W_ : Maybe VM.Value ⊥ → Maybe VM.Value ⊥ → Set where
⌈_⌉ : ∀ {x y} (x≈y : Rel (other k) x y) → x ≈W y
later : ∀ {x y} (x≈y : ♭ x ≈P ♭ y) → later x ≈W later y
laterˡ : ∀ {x y} (x≈y : ♭ x ≈W y) → later x ≈W y
_≡⟨_⟩W_ : ∀ x {y z} → x ≡ y → y ≈W z → x ≈W z
_ ≡⟨ P.refl ⟩W y≈z = y≈z
_≈⟨_⟩W_ : ∀ x {y z} → x ≈W y → y ≅ z → x ≈W z
._ ≈⟨ later x≈y ⟩W later y≅z = later (_ ≈⟨ x≈y ⟩P ♭ y≅z)
._ ≈⟨ laterˡ x≈y ⟩W y≅z = laterˡ (_ ≈⟨ x≈y ⟩W y≅z)
_ ≈⟨ ⌈ x≈y ⌉ ⟩W y≅z = ⌈ trans x≈y (Partiality.≅⇒ y≅z) ⌉
where trans = Preorder.trans (Partiality.preorder P.isPreorder _)
-- The relation _≈_ does not admit unrestricted use of transitivity
-- in corecursive proofs, so I have formulated the correctness proof
-- using a continuation. Note that the proof would perhaps be easier
-- if the semantics was also formulated in continuation-passing
-- style.
mutual
correctW :
∀ {n} t {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈W k v) →
exec ⟨ comp t c , s , comp-env ρ ⟩ ≈W (⟦ t ⟧ ρ >>= k)
correctW (con i) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (Lambda.Syntax.Closure.con i) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (con i) ⟩W
k (con i) ∎)
correctW (var x) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (lookup (comp-env ρ) x) ∷ s , comp-env ρ ⟩ ≡⟨ P.cong (λ v → exec ⟨ c , val v ∷ s , comp-env ρ ⟩) $ lookup-hom x ρ ⟩W
exec ⟨ c , val (comp-val (lookup ρ x)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (lookup ρ x) ⟩W
k (lookup ρ x) ∎)
correctW (ƛ t) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (comp-val (ƛ t ρ)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (ƛ t ρ) ⟩W
k (ƛ t ρ) ∎)
correctW (t₁ · t₂) {ρ} {c} {s} {k} hyp =
exec ⟨ comp t₁ (comp t₂ (app ∷ c)) , s , comp-env ρ ⟩ ≈⟨ correctW t₁ (λ v₁ → correctW t₂ (λ v₂ → ∙-correctW v₁ v₂ hyp)) ⟩W
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P >>= k) ≅⟨ ((⟦ t₁ ⟧ ρ ∎) >>=-cong λ _ → sym $ associative (⟦ t₂ ⟧ ρ) _ _) ⟩
(⟦ t₁ ⟧ ρ >>= λ v₁ → (⟦ t₂ ⟧ ρ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P) >>= k) ≅⟨ sym $ associative (⟦ t₁ ⟧ ρ) _ _ ⟩
(⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ >>= k) ≅⟨ sym (·-comp t₁ t₂ >>=-cong λ v → k v ∎) ⟩
(⟦ t₁ · t₂ ⟧ ρ >>= k) ∎
∙-correctW :
∀ {n} v₁ v₂ {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈W k v) →
exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≈W
(⟪ v₁ ∙ v₂ ⟫P >>= k)
∙-correctW (con i) v₂ _ = ⌈ PF.fail ∎ ⌉
∙-correctW (ƛ t₁ ρ₁) v₂ {ρ} {c} {s} {k} hyp =
exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val (ƛ t₁ ρ₁)) ∷ s , comp-env ρ ⟩ ≈⟨ later (
exec ⟨ comp t₁ [ ret ] , ret c (comp-env ρ) ∷ s , comp-env (v₂ ∷ ρ₁) ⟩ ≈⟨ correct t₁ (λ v → laterˡ (hyp v)) ⟩P
(⟦ t₁ ⟧ (v₂ ∷ ρ₁) >>= k) ∎) ⟩W
(⟪ ƛ t₁ ρ₁ ∙ v₂ ⟫P >>= k) ∎
whnf : ∀ {x y} → x ≈P y → x ≈W y
whnf (x ≈⟨ x≈y ⟩P y≅z) = x ≈⟨ whnf x≈y ⟩W y≅z
whnf (correct t hyp) = correctW t hyp
mutual
soundW : ∀ {x y} → x ≈W y → Rel (other k) x y
soundW ⌈ x≈y ⌉ = x≈y
soundW (later x≈y) = later (♯ soundP x≈y)
soundW (laterˡ x≈y) = laterˡ (soundW x≈y)
soundP : ∀ {x y} → x ≈P y → Rel (other k) x y
soundP x≈y = soundW (whnf x≈y)
-- Note that the equality that is used here is syntactic.
correct : ∀ t →
exec ⟨ comp t [] , [] , [] ⟩ ≈
(⟦ t ⟧ [] >>= λ v → PF.return (comp-val v))
correct t =
soundP $ Correctness.correct t (λ v → ⌈ PF.return (comp-val v) ∎ ⌉)
where open Correctness
|
alloy4fun_models/trashltl/models/17/436HghZxBWMFo2ERm.als | Kaixi26/org.alloytools.alloy | 0 | 3013 | open main
pred id436HghZxBWMFo2ERm_prop18 {
all p: Protected | always p not in Protected implies p in Trash
}
pred __repair { id436HghZxBWMFo2ERm_prop18 }
check __repair { id436HghZxBWMFo2ERm_prop18 <=> prop18o } |
Cubical/ZCohomology/Groups/Connected.agda | thomas-lamiaux/cubical | 1 | 16337 | {-# OPTIONS --safe #-}
module Cubical.ZCohomology.Groups.Connected where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.HLevels
open import Cubical.Data.Nat
open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +Comm to +ℤ-comm ; +Assoc to +ℤ-assoc)
open import Cubical.Data.Sigma hiding (_×_)
open import Cubical.HITs.SetTruncation as ST
open import Cubical.HITs.PropositionalTruncation as PT
open import Cubical.HITs.Truncation as T
open import Cubical.HITs.Nullification
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Instances.Int
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Homotopy.Connected
open import Cubical.ZCohomology.Base
open import Cubical.ZCohomology.GroupStructure
open import Cubical.ZCohomology.Groups.Unit
private
H⁰-connected-type : ∀ {ℓ} {A : Type ℓ} (a : A) → isConnected 2 A → Iso (coHom 0 A) ℤ
Iso.fun (H⁰-connected-type a con) = ST.rec isSetℤ λ f → f a
Iso.inv (H⁰-connected-type a con) b = ∣ (λ x → b) ∣₂
Iso.rightInv (H⁰-connected-type a con) b = refl
Iso.leftInv (H⁰-connected-type a con) =
ST.elim (λ _ → isOfHLevelPath 2 isSetSetTrunc _ _)
λ f → cong ∣_∣₂ (funExt λ x → T.rec₊ (isSetℤ _ _) (cong f) (isConnectedPath 1 con a x .fst))
open IsGroupHom
open Iso
H⁰-connected : ∀ {ℓ} {A : Type ℓ} (a : A) → ((x : A) → ∥ a ≡ x ∥₁) → GroupIso (coHomGr 0 A) ℤGroup
fun (fst (H⁰-connected a con)) = ST.rec isSetℤ (λ f → f a)
inv (fst (H⁰-connected a con)) b = ∣ (λ _ → b) ∣₂
rightInv (fst (H⁰-connected a con)) _ = refl
leftInv (fst (H⁰-connected a con)) =
ST.elim (λ _ → isProp→isSet (isSetSetTrunc _ _))
(λ f → cong ∣_∣₂ (funExt λ x → PT.rec (isSetℤ _ _) (cong f) (con x)))
snd (H⁰-connected a con) = makeIsGroupHom (ST.elim2 (λ _ _ → isProp→isSet (isSetℤ _ _)) λ x y → refl)
|
oeis/018/A018749.asm | neoneye/loda-programs | 11 | 90303 | ; A018749: Divisors of 968.
; Submitted by <NAME>
; 1,2,4,8,11,22,44,88,121,242,484,968
mov $1,1
lpb $0
sub $0,4
mul $1,11
lpe
lpb $0
sub $0,1
mul $1,2
lpe
mov $0,$1
|
oeis/028/A028057.asm | neoneye/loda-programs | 11 | 244016 | <reponame>neoneye/loda-programs
; A028057: Expansion of 1/((1-3x)(1-5x)(1-6x)(1-11x)).
; Submitted by <NAME>
; 1,25,408,5558,68999,813603,9315286,104854096,1168677477,12952000061,143075613044,1577575222314,17376397872835,191281848531799,2104964417048082,23159869359140612,254790508985373473,2802889182202991217,30832952040578234800,339169546346404999390
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
mul $1,6
sub $2,1
sub $0,$2
seq $0,17917 ; Expansion of 1/((1-3x)(1-5x)(1-11x)).
add $1,$0
lpe
mov $0,$1
|
programs/oeis/024/A024142.asm | neoneye/loda | 22 | 4070 | <filename>programs/oeis/024/A024142.asm<gh_stars>10-100
; A024142: 12^n-n^2.
; 1,11,140,1719,20720,248807,2985948,35831759,429981632,5159780271,61917364124,743008370567,8916100448112,106993205378903,1283918464548668,15407021574586143,184884258895036160,2218611106740436703,26623333280885243580,319479999370622926487,3833759992447475121776,46005119909369701465671,552061438912436417592860,6624737266949237011119599,79496847203390844133440960,953962166440690129601297807,11447545997288281555215580508,137370551967459378662586973479,1648446623609512543951043689712,19781359483314150527412524285111,237376313799769806328950291430524,2848515765597237675947403497176127,34182189187166852111368841966124032,410186270246002225336426103593499583
mov $1,12
pow $1,$0
pow $0,2
sub $1,$0
mov $0,$1
|
lab3/checkCondizioni.asm | samdsk/lab_arch2 | 0 | 81731 | <gh_stars>0
.data
msg_in: .asciiz "Inserisci un numero: "
msg_err: .asciiz "Errore"
.text
.globl main
main:
#A
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s0 $zero $v0
#B
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s1 $zero $v0
#C
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s2 $zero $v0
#If ( (a>=b) && (c!=0) )
bne $s0 $s1 A_B
j A_B_eq
A_B: slt $t0 $s1 $s0
bne $t0 1 ELSE
A_B_eq: beqz $s2 ELSE
add $a0 $s0 $s1
mul $a0 $a0 $s2
li $v0 1
syscall
j exit
ELSE:
la $a0 msg_err
li $v0 4
syscall
exit: #EXIT
li $v0 10
syscall |
programs/oeis/281/A281814.asm | jmorken/loda | 1 | 162551 | <filename>programs/oeis/281/A281814.asm
; A281814: Expansion of f(x, x^8) in powers of x where f(, ) is Ramanujan's general theta function.
; 1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0
mul $0,9
add $0,1
lpb $0
add $2,1
trn $0,$2
sub $0,3
lpe
lpb $0
sub $0,1
add $1,1
lpe
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_324_1316.asm | ljhsiun2/medusa | 9 | 241928 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rax
push %rbx
push %rdx
// Store
lea addresses_A+0x1cb69, %rax
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %r9
movq %r9, (%rax)
nop
sub $52975, %rdx
// Faulty Load
lea addresses_A+0xbdb9, %r9
nop
cmp $64025, %rbx
movups (%r9), %xmm4
vpextrq $1, %xmm4, %rdx
lea oracles, %r9
and $0xff, %rdx
shlq $12, %rdx
mov (%r9,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'00': 324}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
STLC/Operational.agda | TypesLogicsCats/STLC | 1 | 13652 | <reponame>TypesLogicsCats/STLC<gh_stars>1-10
{-# OPTIONS --safe --sized-types #-}
module STLC.Operational where
open import STLC.Operational.Base
|
tier-1/xcb/applet/demo/simple/simple.adb | charlie5/cBound | 2 | 11766 | <gh_stars>1-10
with xcb.Binding; use xcb.Binding;
with xcb.Pointers; use xcb.Pointers;
with xcb.xcb_Screen_t;
with xcb.xcb_screen_Iterator_t;
with xcb.xcb_void_cookie_t;
with xcb.xcb_generic_event_t;
with Swig; use Swig;
with Swig.Pointers;
with interfaces.C.Strings; use Interfaces, interfaces.C, interfaces.C.Strings;
with ada.Text_IO; use ada.Text_IO;
with ada.unchecked_Deallocation;
with Ada.unchecked_Conversion;
procedure Simple
is
the_Connection : xcb_connection_t_Pointer;
the_Screen : xcb.xcb_screen_t.Pointer;
the_screen_Id : swig.Pointers.int_Pointer := new c.int;
the_Window : xcb.xcb_window_t;
void_Cookie : xcb.xcb_void_cookie_t.item;
Status : C.int;
Mask : swig.uint32_t;
Values : swig.uint32_t_array (1 .. 2);
E : xcb.xcb_generic_event_t.Pointer;
use type xcb.xcb_generic_event_t.Pointer;
procedure free is new ada.Unchecked_Deallocation (xcb.xcb_generic_event_t.item, xcb.xcb_generic_event_t.Pointer);
function to_Flag is new ada.Unchecked_Conversion (xcb.xcb_event_mask_t, swig.uint32_t);
function to_Flag is new ada.Unchecked_Conversion (xcb.xcb_cw_t, swig.uint32_t);
begin
-- Open the connection to the X server.
--
the_Connection := xcb_connect (c.strings.null_Ptr, -- Use the DISPLAY environment variable as the default display name.
the_screen_Id);
-- Get the screen id.
--
the_Screen := xcb_setup_roots_iterator (xcb_get_setup (the_Connection)).data.all'access;
-- Display some screen details.
--
new_Line;
put_Line ("Informations of screen:" & Unsigned_32'image (the_Screen.root));
new_Line;
put_Line (" width :" & Unsigned_16'image (the_Screen.width_in_pixels ));
put_Line (" height :" & Unsigned_16'image (the_Screen.height_in_pixels));
put_Line (" white pixel:" & Unsigned_32'image (the_Screen.white_pixel ));
put_Line (" black pixel:" & Unsigned_32'image (the_Screen.black_pixel ));
new_Line;
-- Create the window.
--
-- Ask for our window's Id.
--
the_Window := xcb_generate_id (the_Connection);
Mask := to_Flag (xcb.XCB_CW_BACK_PIXEL) or to_Flag (xcb.XCB_CW_EVENT_MASK);
put_Line ("FLAG: " & swig.uint32_t'Image (Mask));
Values := (1 => the_Screen.white_pixel, 2 => to_Flag (xcb.XCB_EVENT_MASK_EXPOSURE));
void_Cookie := xcb_create_window (the_Connection,
Unsigned_8 (xcb.XCB_COPY_FROM_PARENT),
the_Window,
the_screen.Root,
0, 0,
150, 150,
10,
xcb.xcb_window_class_t'Pos (xcb.XCB_WINDOW_CLASS_INPUT_OUTPUT),
the_Screen.root_Visual,
Mask,
Values (1)'Address);
-- Map the window on the screen.
--
void_Cookie := xcb_map_window (the_Connection, the_Window);
-- Make sure commands are sent before we pause, so window is shown.
--
Status := xcb_flush (the_Connection);
loop
put_Line ("fetch event:");
E := xcb_wait_for_event (the_Connection);
exit when E = null;
put_Line ("Got event:" & integer'image (Integer (E.response_type)));
free (E);
end loop;
-- Close the X server connection.
--
xcb_disconnect (the_Connection);
new_Line;
put_Line ("End.");
end Simple;
|
source/web-html.adb | ytomino/web-ada | 2 | 27578 | <gh_stars>1-10
with System;
package body Web.HTML is
use type String_Maps.Cursor;
procedure By_Stream (Item : in String; Params : in System.Address) is
function To_Pointer (Value : System.Address)
return access Ada.Streams.Root_Stream_Type'Class
with Import, Convention => Intrinsic;
begin
String'Write (To_Pointer (Params), Item);
end By_Stream;
Alt_Quot : aliased constant String := """;
Alt_Apos : aliased constant String := "'";
Alt_LF : aliased constant String := " ";
procedure Write_In_Attribute_Internal (
Version : in HTML_Version;
Item : in String;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Alt : access constant String;
First : Positive := Item'First;
Last : Natural := First - 1;
I : Positive := Item'First;
begin
while I <= Item'Last loop
case Item (I) is
when '"' =>
Alt := Alt_Quot'Access;
goto FLUSH;
when ''' =>
Alt := Alt_Apos'Access;
goto FLUSH;
when Ada.Characters.Latin_1.LF =>
goto NEW_LINE;
when Ada.Characters.Latin_1.CR =>
if I < Item'Last
and then Item (I + 1) = Ada.Characters.Latin_1.LF
then
goto CONTINUE; -- skip
else
goto NEW_LINE;
end if;
when others =>
Last := I;
goto CONTINUE;
end case;
<<NEW_LINE>>
case Version is
when HTML =>
Alt := Line_Break'Access;
when XHTML =>
Alt := Alt_LF'Access;
end case;
<<FLUSH>>
if First <= Last then
Write (Item (First .. Last), Params);
end if;
Write (Alt.all, Params);
First := I + 1;
goto CONTINUE;
<<CONTINUE>>
I := I + 1;
end loop;
if First <= Last then
Write (Item (First .. Last), Params);
end if;
end Write_In_Attribute_Internal;
Alt_Sp : aliased constant String := " ";
Alt_Amp : aliased constant String := "&";
Alt_LT : aliased constant String := "<";
Alt_GT : aliased constant String := ">";
Alt_BRO : aliased constant String := "<br>";
Alt_BRS : aliased constant String := "<br />";
procedure Write_In_HTML_Internal (
Version : in HTML_Version;
Item : in String;
Pre : in Boolean;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Alt : access constant String;
First : Positive := Item'First;
Last : Natural := First - 1;
In_Spaces : Boolean := True;
Previous_In_Spaces : Boolean;
I : Positive := Item'First;
begin
while I <= Item'Last loop
Previous_In_Spaces := In_Spaces;
In_Spaces := False;
case Item (I) is
when ' ' =>
if not Pre
and then (
Previous_In_Spaces or else (I < Item'Last and then Item (I + 1) = ' '))
then
In_Spaces := True;
Alt := Alt_Sp'Access;
goto FLUSH;
else
Last := I;
goto CONTINUE;
end if;
when '&' =>
Alt := Alt_Amp'Access;
goto FLUSH;
when '<' =>
Alt := Alt_LT'Access;
goto FLUSH;
when '>' =>
Alt := Alt_GT'Access;
goto FLUSH;
when Ada.Characters.Latin_1.LF =>
goto NEW_LINE;
when Ada.Characters.Latin_1.CR =>
if I < Item'Last and then Item (I + 1) = Ada.Characters.Latin_1.LF then
goto CONTINUE; -- skip
else
goto NEW_LINE;
end if;
when others =>
Last := I;
goto CONTINUE;
end case;
<<NEW_LINE>>
if Pre then
Alt := Line_Break'Access;
else
case Version is
when HTML =>
Alt := Alt_BRO'Access;
when XHTML =>
Alt := Alt_BRS'Access;
end case;
end if;
<<FLUSH>>
if First <= Last then
Write (Item (First .. Last), Params);
end if;
Write (Alt.all, Params);
First := I + 1;
goto CONTINUE;
<<CONTINUE>>
I := I + 1;
end loop;
if First <= Last then
Write (Item (First .. Last), Params);
end if;
end Write_In_HTML_Internal;
procedure Write_Query_In_Attribute_Internal (
Version : in HTML_Version;
Item : in Query_Strings;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address)) is
begin
if not Item.Is_Empty then
declare
First : constant String_Maps.Cursor := Item.First;
Position : String_Maps.Cursor := First;
begin
while String_Maps.Has_Element (Position) loop
if Position = First then
Write ("?", Params);
else
Write ("&", Params);
end if;
Write_In_Attribute_Internal (Version, String_Maps.Key (Position), Params,
Write => Write);
Write ("=", Params);
Write_In_Attribute_Internal (Version, String_Maps.Element (Position), Params,
Write => Write);
String_Maps.Next (Position);
end loop;
end;
end if;
end Write_Query_In_Attribute_Internal;
procedure Write_Query_In_HTML_Internal (
Version : in HTML_Version;
Item : in Query_Strings;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Position : String_Maps.Cursor := Item.First;
begin
while String_Maps.Has_Element (Position) loop
Write ("<input type=""hidden"" name=""", Params);
Write_In_Attribute_Internal (Version, String_Maps.Key (Position), Params,
Write => Write);
Write (""" value=""", Params);
Write_In_Attribute_Internal (Version, String_Maps.Element (Position), Params,
Write => Write);
case Version is
when HTML =>
Write (""">", Params);
when XHTML =>
Write (""" />", Params);
end case;
String_Maps.Next (Position);
end loop;
end Write_Query_In_HTML_Internal;
Begin_Attribute : constant String := "=""";
End_Attribute : constant String := """";
-- implementation of input
function Checkbox_Value (S : String) return Boolean is
begin
return Equal_Case_Insensitive (S, L => "on");
end Checkbox_Value;
-- implementation of output
procedure Generic_Write_In_HTML (
Item : in String;
Pre : in Boolean := False)
is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_In_HTML_Internal (Version, Item, Pre, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_In_HTML;
procedure Write_In_HTML (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in String;
Pre : in Boolean := False)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_In_HTML_Internal (Version, Item, Pre, To_Address (Stream),
Write => By_Stream'Access);
end Write_In_HTML;
procedure Generic_Write_Begin_Attribute (Name : in String) is
begin
Write (Name);
Write (Begin_Attribute);
end Generic_Write_Begin_Attribute;
procedure Write_Begin_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Name : in String) is
begin
String'Write (Stream, Name);
String'Write (Stream, Begin_Attribute);
end Write_Begin_Attribute;
procedure Generic_Write_In_Attribute (Item : in String) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_In_Attribute_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_In_Attribute;
procedure Write_In_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in String)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_In_Attribute_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_In_Attribute;
procedure Generic_Write_End_Attribute is
begin
Write (End_Attribute);
end Generic_Write_End_Attribute;
procedure Write_End_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class) is
begin
String'Write (Stream, End_Attribute);
end Write_End_Attribute;
procedure Generic_Write_Query_In_HTML (Item : in Query_Strings) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_Query_In_HTML_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_Query_In_HTML;
procedure Write_Query_In_HTML (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in Query_Strings)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_Query_In_HTML_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_Query_In_HTML;
procedure Generic_Write_Query_In_Attribute (Item : in Query_Strings) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_Query_In_Attribute_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_Query_In_Attribute;
procedure Write_Query_In_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in Query_Strings)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_Query_In_Attribute_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_Query_In_Attribute;
end Web.HTML;
|
oeis/104/A104643.asm | neoneye/loda-programs | 11 | 101615 | ; A104643: Number of arrangements that can be formed by taking n distinct things out of 25.
; 1,25,600,13800,303600,6375600,127512000,2422728000,43609104000,741354768000,11861676288000,177925144320000,2490952020480000,32382376266240000,388588515194880000,4274473667143680000,42744736671436800000,384702630042931200000,3077621040343449600000,21543347282404147200000,129260083694424883200000,646300418472124416000000,2585201673888497664000000,7755605021665492992000000,15511210043330985984000000,15511210043330985984000000
add $0,1
mov $1,26
mov $4,2
lpb $0
sub $0,1
mov $3,$2
cmp $3,$2
cmp $3,0
sub $3,1
mul $4,$1
add $1,$3
lpe
mov $0,$4
div $0,52
|
oeis/121/A121627.asm | neoneye/loda-programs | 11 | 178046 | <filename>oeis/121/A121627.asm
; A121627: Real part of a complex operation analogous to the factorials.
; Submitted by <NAME>
; 1,0,-12,-96,-480,0,40320,645120,5806080,0,-1277337600,-30656102400,-398529331200,0,167382319104000,5356234211328000,91055981592576000,0,-62282291409321984000,-2491291656372879360000,-52317124783830466560000,0
mov $1,1
add $1,$0
mov $3,$0
lpb $3
mul $2,2
sub $2,$1
mul $1,$3
mul $2,$3
add $1,$2
sub $3,1
lpe
mov $0,$1
|
minibrainfuck.asm | DevAlone/BrainfuckMBR | 1 | 177588 | org 0x7C00; смещение, по которому будет лежать программа в оперативной памяти
; константы, описывающее место в памяти, куда пихаем данные для интерпретатора
bf_mem_seg equ 0x100
bf_mem_offset equ 0x0
bf_code_pos equ 0
bf_code_size equ 10000
bf_data_pos equ bf_code_size
bf_data_size equ 10000
VIDEO_PAGE equ 0
section .text
start:
mov ax, cs
mov ds, ax
%ifdef DEBUG
mov dx, 0
mov ax, 0000000011100011b
int 0x14
%endif
mov ax, 0x03; установить видео режим 0x0
int 0x10; вызываем прерывание
mov ax, 0x500; выбрать страницу видеопамяти 0x0
int 0x10
.main:
call clearScreen
;push word 0
mov dx, 0
call setCursor
;add sp, 2
; выводим стартовое сообщение
mov si, start_message
call print
; меняем сегменты данных
mov ax, bf_mem_seg
mov es, ax
mov ds, ax
; вводим программу
lea di, [bf_mem_offset +bf_code_pos]; куда пишем
xor cx, cx; счётчик записанных символов
.lp:
%ifdef DEBUG
; читаем из 0 serial port'а
mov ah, 0x02
mov dx, 0
int 0x14
%else
mov ah, 0x00; читаем символ
int 0x16
%endif
cmp al, 10; перенос строки
jz .endlp
cmp al, 13; возврат каретки
jz .endlp
; разрешаем только символы bf кода
; убрал т.к. это занимает аж 32 байта!
;cmp al, 43; +
;jz .print_sym
;cmp al, 45; -
;jz .print_sym
;cmp al, 46; .
;jz .print_sym
;cmp al, 44; ,
;jz .print_sym
;cmp al, 91; [
;jz .print_sym
;cmp al, 93; ]
;jz .print_sym
;cmp al, 60; <
;jz .print_sym
;cmp al, 62; >
;jz .print_sym
;jmp .do_not_print_sym
.print_sym:
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
; в al ascii код символа
mov [di], byte al
inc di
inc cx
.do_not_print_sym:
cmp cx, bf_code_size
jng .lp
.endlp:
mov [di+1], byte 0; пишем конец строки
cmp cx, 0
;если пользователь ничего не ввёл, ошибка
je .end_with_error
;; проверяем баланс скобок
lea di, [bf_mem_offset +bf_code_pos]; куда пишем
xor cx, cx
.br_balance_lp:
mov al, [di]
cmp al, 0
jz .end_br_balance_lp
cmp al, '['
jnz .else_if
inc cx
.else_if:
cmp al, ']'
jnz .end_if
dec cx
.end_if:
inc di
cmp cx, 0
jl .end_with_error
jmp .br_balance_lp
.end_br_balance_lp:
cmp cx, 0
jnz .end_with_error
; создаём массив для хранения данных и зануляем его
lea di, [bf_mem_offset +bf_data_pos]; тут будет храниться массив с которым работает bf
mov cx, bf_data_size
.data_null_lp:
mov [di], byte 0
inc di
loop .data_null_lp
; интерпретируем
call clearScreen
;push word 0
mov dx, 0
call setCursor
;add sp, 2
lea di, [bf_mem_offset+bf_data_pos]; массив
xor bx, bx; указатель на ячейку массива
lea si, [bf_mem_offset +bf_code_pos] ; откуда берём команды
.interpreter:
mov al, byte [si]; загружаем символ
cmp al, 0;
je .end_interpreter
cmp al, 43; +
je .C0
cmp al, 45; -
je .C1
cmp al, 62; >
je .C2
cmp al, 60; <
je .C3
cmp al, 46; .
je .C4
cmp al, 44; ,
je .C5
cmp al, 91; [
je .C6
cmp al, 93; ]
je .C7
jmp .def
.C0:; +
inc byte [di+bx]
jmp .sw_end
.C1:; -
dec byte [di+bx]
jmp .sw_end
.C2:; >
cmp bx, bf_data_size-1
jnl .sw_end; если >= size-1
inc bx; иначе увеличиваем номер ячейки
jmp .sw_end
.C3:; <
cmp bx, 0
je .sw_end; если ноль выходим
dec bx; иначе уменьшаем номер ячейки
jmp .sw_end
.C4:; .
pusha; пушим всё в стек, чтоб случайно не поломать bx, cx и прочие нужные регистры
; делаем интерапт биоса
mov al, [di+bx]
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
popa
jmp .sw_end
.C5:; ,
pusha
mov ah, 0x03; читаем позицию курсора
mov bh, VIDEO_PAGE; видео страница
int 0x10
;dh - строка
;dl - колонка
; положили в стек старые значения
push word dx
; перемещаем курсор в нижнюю строку экрана
;push word 0x1800; 24 строка 0 столбец
mov dx, 0x1800
call setCursor
;add sp, 2
push ds; запоминаем сегмент
mov ax, 0; меняем на нулевой, где хранятся все сообщения
;mov es, ax
mov ds, ax
;push word input_message
mov si, input_message
call print
;add sp, 2
pop ds
mov ah, 0x00; читаем символ
int 0x16
;cmp al, 0
;je .c5_end
;al
mov [di+bx], al; записываем в массив
; выводим его же
mov ah, 0x0E;
mov bh, VIDEO_PAGE;
int 0x10;
pop dx
call setCursor; исплользуются те значения, что были занесены в стек
;add sp, 2
.c5_end:
popa
jmp .sw_end
.C6:; [
cmp [di+bx], byte 0;
jnz .sw_end; если в текущей ячейке массива не ноль, выполняем то, что в теле цикла
; переходим на следующую ] с учётом вложенности
mov ax, 1; в прямом направлении
call loops_handler
dec si; на одну назад
jmp .sw_end
.C7:; ]
mov ax, -1; в обратном направлении
call loops_handler
jmp .sw_end
.def:
;jmp .error
.sw_end:
inc si
jmp .interpreter
.end_with_error:
mov bx, -1
jmp .end_prog
.end_interpreter:
mov bx, 0
.end_prog:
; возвращаем сегменты в прежнее состояние
push bx
mov ax, cs
mov es, ax; меняем сегмент памяти
mov ds, ax
; перемещаем курсор в нижнюю строку экрана
;push word 0x1800; 24 строка 0 столбец
mov dx, 0x1800
call setCursor
;add sp, 2
pop bx
cmp bx, 0
jz .no_error
;push word error_message
mov si, error_message
call print
;add sp, 2
.no_error:
;push finish_message
mov si, finish_message
call print
;add sp, 2
; ждём нажатия
mov ah, 0x00
int 0x16
jmp .main
.error:; пока не нужен
; handle error
;jmp .main
; end
; переходит на соответствующую скобку с учётом вложенности
; т.е. если в [si] находится '[', переходит на ']' и наоборот
; направление задаётся первым аргументом переданным через ax (1 или -1)
; меняет si
loops_handler:
;push bp
;mov bp, sp
enter 0, 0
push cx
xor cx, cx
.lp_br1:
cmp [si], byte '['
jnz .else_if1
inc cx
.else_if1:
cmp [si], byte ']'
jnz .end_if1
dec cx
.end_if1:
add si, ax
cmp cx, 0
jnz .lp_br1
pop cx
leave
;mov sp, bp
;pop bp
ret
; принимает адрес строки через si
print:
pusha
cld
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
.puts_loop:
lodsb; загружаем очередной символ в al
test al, al; если 0, выходим
jz .exit_loop
int 0x10; иначе вызываем функцию bios
jmp .puts_loop
.exit_loop:
popa
ret
clearScreen:
pusha
;ah = 0x06; листать окно вверх
;al = 0; очистить окно
mov ax, 0x0600;
; левый верхний угол
xor cx, cx
; правый нижний угол
;dh = 25
;dl = 80
mov dx, 0x2580
mov bh, 00000010b; цвет
int 0x10
popa
ret
; void setCursor(dword xy)
; принимает координаты через dx
setCursor:
; enter 0, 0
pusha
; устанавливаем курсор в 0 0
mov ah, 0x02
mov bh, VIDEO_PAGE; страница видеопамяти
;mov dx, [bp+2+2]; первый аргумент
;dh line
;dl collumn
int 0x10
popa
; leave
ret
; просто функция для отладки
debug:
pusha
mov al, '&'
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
jmp $
popa
ret
section .data
start_message db '$ ', 0
finish_message db 'press key to cont', 0
input_message db '> ', 0
error_message db 'err ', 0
;finish:
; times 512-finish-start db 0
; db 0x55, 0xAA; сигнатура загрузочного сектора
|
End of preview. Expand
in Data Studio
A clone of 'bigcode/starcoderdata' with 120k training rows and 30k validation rows
dataset_info: features: - name: max_stars_repo_path dtype: string - name: max_stars_repo_name dtype: string - name: max_stars_count dtype: int64 - name: id dtype: string - name: content dtype: string splits: - name: train num_bytes: 771306855.2 num_examples: 120000 - name: validation num_bytes: 192826713.8 num_examples: 30000 download_size: 327556480 dataset_size: 964133569.0 configs: - config_name: default data_files: - split: train path: data/train-* - split: validation path: data/validation-*
Dataset Card for Dataset Name
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
Dataset Details
Dataset Description
- Curated by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
Dataset Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Dataset Structure
[More Information Needed]
Dataset Creation
Curation Rationale
[More Information Needed]
Source Data
Data Collection and Processing
[More Information Needed]
Who are the source data producers?
[More Information Needed]
Annotations [optional]
Annotation process
[More Information Needed]
Who are the annotators?
[More Information Needed]
Personal and Sensitive Information
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users should be made aware of the risks, biases and limitations of the dataset. More information needed for further recommendations.
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Dataset Card Authors [optional]
[More Information Needed]
Dataset Card Contact
[More Information Needed]
- Downloads last month
- 28