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 |
|---|---|---|---|---|
src/ada/src/comms/uxas-comms-transport.ads | VVCAS-Sean/OpenUxAS | 88 | 13932 | <filename>src/ada/src/comms/uxas-comms-transport.ads
package UxAS.Comms.Transport is
type Transport_Base is abstract tagged limited record
-- these are public member data in the C++ version so they are visible
-- in this base class (even if extensions are private, as they should
-- be)
Entity_Id : UInt32;
Service_Id : UInt32;
end record;
end UxAS.Comms.Transport;
|
test/Succeed/Issue759.agda | shlevy/agda | 1,989 | 8887 | <reponame>shlevy/agda
-- Andreas, 2012-11-18: abstract record values
module Issue759 where
import Common.Level
abstract
record Wrap (A : Set) : Set where
field wrapped : A
open Wrap public
wrap : {A : Set} → A → Wrap A
wrap a = record { wrapped = a }
-- caused 'Not in Scope: recCon-NOT-PRINTED'
-- during eta-contraction in serialization
-- should work now
|
Global/Get-Keychain-Access-Passwords.applescript | boisy/AppleScripts | 116 | 4117 | -- @description
-- Handler to return keychain access items
-- Feel free to reuse this with whatever passwords you'd like
--
on getKeychain(keychainItemName)
do shell script "security 2>&1 >/dev/null find-generic-password -gl " & quoted form of keychainItemName & " | awk '{print $2}'"
if result is not "SecKeychainSearchCopyNext:" then
return (text 2 thru -2 of result)
else
display alert ("No " & keychainItemName & " keychain found!") ¬
message ("Press OK to set up a " & keychainItemName & " keychain, this is a one time step.") as critical ¬
buttons {"Cancel", "OK"} ¬
default button ("OK") ¬
cancel button "Cancel"
tell application "Keychain Access" to activate
delay 2
tell application "System Events"
tell process "Keychain Access"
set accountName to short user name of (system info)
keystroke "n" using {command down}
delay 1.5
set the clipboard to keychainItemName
keystroke "v" using {command down}
delay 1
keystroke tab
delay 1
set the clipboard to accountName
keystroke "v" using {command down}
delay 1
keystroke tab
display alert ("Almost Done") ¬
message ("Type in your " & keychainItemName & " password into the password field and click Add. Once it's saved run the script again.") as critical ¬
buttons {"Cancel", "OK"} ¬
default button ("OK") ¬
cancel button "Cancel"
end tell
end tell
return missing value
end if
end getKeychain
|
src/main/antlr4/com/api/jsonata4java/expressions/path/generated/PathExpressionParser.g4 | markmelville/JSONata4Java | 1 | 2140 | <gh_stars>1-10
/**
* (c) Copyright 2018, 2019 IBM Corporation
* 1 New Orchard Road,
* Armonk, New York, 10504-1722
* United States
* +1 914 499 1900
* support: <NAME> <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* Grammar defining the subset of JSONata we support on the LHS of mapping expressions */
parser grammar PathExpressionParser;
options {tokenVocab = PathExpressionLexer;}
expr
: id array_index* ((PATH_DELIM rhs=expr)|EOF) # path
;
id
: BACK_QUOTED_ID (txt=BACK_QUOTE_CONTENT) BACK_QUOTE_EXIT
| txt=NON_BACK_QUOTED_ID;
array_index
: ARR_OPEN (NUMBER) ARR_CLOSE; |
cfg/export.ads | cosmo83/multiapps-cli-plugin | 0 | 24716 | <reponame>cosmo83/multiapps-cli-plugin<gh_stars>0
artifacts builderVersion:"1.1", {
version "${buildBaseVersion}", {
group "${groupId}", {
artifact "${artifactId}", {
file "${genroot}/out/mta_plugin_linux_amd64", classifier: "linux", extension: "bin"
file "${genroot}/out/mta_plugin_darwin_amd64", classifier: "darwin", extension: "bin"
file "${genroot}/out/mta_plugin_windows_amd64.exe", classifier: "windows", extension: "exe"
}
}
}
}
|
src/gate3_glib.ads | Blady-Com/Gate3 | 1 | 3067 | <filename>src/gate3_glib.ads
-----------------------------------------------------------------------
--
-- simple XML Parser using glib & utilities
--
-----------------------------------------------------------------------
with Glib.Xml_Int; use Glib.Xml_Int;
pragma Elaborate_All (Glib.Xml_Int);
package Gate3_Glib is
-- utility functions
function To_Ada (S : String; Separator : Character := '_') return String;
-- Convert S by adding a separator before each upper case character.
-- Also put in upper case each character following a separator.
function Find_Top_Object (N : Node_Ptr) return Node_Ptr;
-- Find a node in the ancestors of N that represents a root object.
end Gate3_Glib;
|
volume_monitor/firmware/m62419fp_spi.asm | mullets/vwradio | 45 | 179852 | ;M62419FP Interrupt-Driven SPI Receiver
;
;The M62419FP uses a 14-bit SPI command. Since 14 is not a multiple of 8, it
;can't be received by the hardware SPI. This code uses bit-banging: a pin
;change interrupt fires for the clock edges and the ISR accumulates the bits.
;
;There are 3 buffers used in this code. The ISR uses packet_isr_buf to
;accumulate SPI bits received. When a complete packet is received, it moves
;the packet into packet_rx_buf. The main loop waits for a new packet in
;packet_rx_buf and then transfers it into packet_work_buf. The work buffer is
;used by all code in the main loop. This allows receiving a new command while
;the main loop is still processing the last one. The main loop should call
;spi_get_packet (below) and then operate only on packet_work_buf.
;
;Registers reserved for the ISR that may not be used by any other code:
; R21, R22
spi_init:
;Set up for receiving M62419FP commands on interrupt.
;Destroy R16.
;
;Set PIN1, PINA0 as input
in r16, DDRA
andi r16, ~((1 << PINA1) | (1 << PINA0))
out DDRA, r16
;Set pin change enable mask 0 for PA1 (PCINT1) only
ldi r16, (1 << PCINT1)
sts PCMSK0, r16
;Enable interrupts from pin change group 0 only
ldi r16, (1 << PCIE0)
sts PCICR, r16
;Clear locations used by ISR to collect SPI bits
ldi r16, 14 ;Set initial count = 14 bits to receive
sts packet_bitcount, r16
clr r16
sts packet_isr_buf, r16 ;Clear low data byte
sts packet_isr_buf+1, r16 ;Clear high data byte
;Clear latest packet received (ISR writes complete packet to this buffer)
clr r16
sts packet_rx_buf, r16
sts packet_rx_buf+1, r16
ret
spi_isr_pcint0:
;PCINT0 Pin Change Group 0 Interrupt Service Routine
;Fires for any change on PA1 (M62419FP CLK).
;R21 and R22 are destroyed by this ISR.
;
in r21, PINA ;Read port immediately (SREG unaffected)
in r22, SREG ;Preserve SREG
sbrs r21, PINA1 ;Skip next instruction if CLK=1
rjmp spi_isr_done ;Nothing to do; it was a falling edge.
;This is a rising edge and the DAT bit is valid.
asr r21 ;Shift DAT bit (PINA0) into the carry
lds r21, packet_isr_buf ;Shift carry into low byte
rol r21
sts packet_isr_buf, r21
lds r21, packet_isr_buf+1 ;Shift carry into high byte
rol r21
sts packet_isr_buf+1, r21
;Check if a complete packet has been received.
lds r21, packet_bitcount ;Decrement number of bits remaining
dec r21
sts packet_bitcount, r21
brne spi_isr_done ;More bits? Nothing more to do this time.
;A complete packet has been received.
;Transfer packet_isr_buf -> packet_rx_buf
lds r21, packet_isr_buf
sts packet_rx_buf, r21 ;Save low byte
lds r21, packet_isr_buf+1
ori r21, 0b10000000 ;Set unused bit to indicate packet complete
sts packet_rx_buf+1, r21 ;Save high byte
;Set up for next time.
ldi r21, 14 ;Set initial count = 14 bits to receive
sts packet_bitcount, r21
clr r21
sts packet_isr_buf, r21 ;Clear low data byte
sts packet_isr_buf+1, r21 ;Clear high data byte
spi_isr_done:
out SREG, r22 ;Restore SREG
reti
spi_get_packet:
;Check if a new packet has been received by the ISR, if so then move
;it into the work buffer. Destroys R16, R17, R18.
;
;Stores the packet at Y-pointer (if a packet is available).
;Carry set = packet ready, Carry clear = no packet.
;
;Check for a new packet
lds r16, packet_rx_buf+1 ;Load high byte
clc ;Carry clear = no packet
sbrs r16, 7 ;Skip next if bit 7 indicates packet complete
ret ;No packet yet
;A packet is available in packet_rx_buf
;Read it into R16+R17 and then clear packet_rx_buf for the next packet
;Interrupts disabled to prevent race if a new byte is received during copy
clr r18
cli
lds r16, packet_rx_buf
lds r17, packet_rx_buf+1
sts packet_rx_buf, r18
sts packet_rx_buf+1, r18
sei
;Copy the received 14-bit packet into the work buffer at Y
st Y, r16 ;Copy low byte
andi r17, 0b00111111 ;Zero out non-data bits of high byte
std Y+1, r17 ;Copy high byte
sec ;Carry set = packet received
ret
|
src/resources/sound_extend.asm | h1romas4/z88dk-msx-template | 5 | 14550 | ; license:MIT License
; copyright-holders:<NAME>
_sound_extend:
DB 0
DW _sound_extend_trk1
DW _sound_extend_trk2
DW _sound_extend_trk3
_sound_extend_trk1:
DB 201, %10, 200, 14 , 20 , 15 , 200, 0 , 0 , 5 , 200, 14 , 20 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 20 , 5 , 200, 0 , 0 , 5 , 200, 14 , 20 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 20 , 30 , 22 , 30 , 24 , 50
DB 255
_sound_extend_trk2:
DB 201, %10, 200, 14 , 60 , 15 , 200, 0 , 0 , 5 , 200, 14 , 60 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 60 , 5 , 200, 0 , 0 , 5 , 200, 14 , 60 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 60 , 30 , 62 , 30 , 64 , 50
DB 255
_sound_extend_trk3:
DB 201, %10, 200, 14 , 56 , 15 , 200, 0 , 0 , 5 , 200, 14 , 56 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 56 , 5 , 200, 0 , 0 , 5 , 200, 14 , 56 , 5 , 200, 0
DB 0 , 5 , 200, 14 , 56 , 30 , 58 , 30 , 60 , 50
DB 255
|
csl/src/vectors.asm | ksteensig/dsp-guitar-multieffects | 1 | 172325 | <reponame>ksteensig/dsp-guitar-multieffects<filename>csl/src/vectors.asm
;* ============================================================================
;* Copyright (c) 2008-2012 Texas Instruments Incorporated.
;*
;* Redistribution and use in source and binary forms, with or without
;* modification, are permitted provided that the following conditions
;* are met:
;*
;* Redistributions of source code must retain the above copyright
;* notice, this list of conditions and the following disclaimer.
;*
;* Redistributions in binary form must reproduce the above copyright
;* notice, this list of conditions and the following disclaimer in the
;* documentation and/or other materials provided with the
;* distribution.
;*
;* Neither the name of Texas Instruments Incorporated nor the names of
;* its contributors may be used to endorse or promote products derived
;* from this software without specific prior written permission.
;*
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*
;*/
;Module: INTC
;File: vectors.asm - vector table
;**************************************************************************
;;**************************************************************************
.C54CM_off
.CPL_off
.ARMS_off
;**********************************************************************************
; predefined stack operation modes
;**********************************************************************************
; USE_RETA : 2x16-bit fast return mode (RETA used)
; NO_RETA : 2x16-bit slow return mode (RETA not used)
; C54X_STK : 32-bit fast return mode
;**********************************************************************************
.ref _c_int00
;.ref _sarISR
.def RST
;**********************************************************************************
.sect "vectors"
.align 256
.global _VECSTART
;**********************************************************************************
_VECSTART:
RST: .ivec reset_isr, USE_RETA ; Reset / Software Interrupt #0
NMI: .ivec nmi_isr ; Nonmaskable Interrupt
INT0: .ivec int0_isr ; External User Interrupt #0
INT1: .ivec int1_isr ; External User Interrupt #1
TINT: .ivec tim_isr ; Timer #0 / Software Interrupt #4
PROG0: .ivec i2s0_mmc0_tx_isr ; Programmable 0 Interrupt
UART: .ivec uart_isr ; IIS #1 Receive Interrupt
PROG1: .ivec i2s0_mmc0_rx_isr ; Programmable 1 Interrupt
DMA: .ivec dma_isr ; DMA Interrupt
PROG2: .ivec i2s1_mmc1_tx_isr ; Programmable 2 Interrupt
COPROCFFT: .ivec coprocfft_isr ; Coprocessor FFT Module Interrupt
PROG3: .ivec i2s1_mmc1_rx_isr ; Programmable 3 Interrupt
LCD: .ivec lcd_isr ; LCD Interrupt
SARADC: .ivec saradc_isr ; SAR ADC Interrupt
XMT2: .ivec i2s2_tx_isr ; I2S2 Tx Interrupt
RCV2: .ivec i2s2_rx_isr ; I2S2 Rx Interrupt
XMT3: .ivec i2s3_tx_isr ; I2S3 Tx Interrupt
RCV3: .ivec i2s3_rx_isr ; I2S3 Rx Interrupt
RTC: .ivec rtc_isr ; RTC interrupt
SPI: .ivec spi_isr ; SPI Receive Interrupt
USB: .ivec usb_isr ; USB Transmit Interrupt
GPIO: .ivec gpio_isr ; GPIO Interrupt
EMIF: .ivec emif_error_isr ; EMIF Error Interrupt
I2C: .ivec i2c_isr ; IIC interrupt
BERR: .ivec berr_isr ; Bus Error Interrupt
DLOG: .ivec dlog_isr ; Emulation Interrupt - DLOG
RTOS: .ivec rtos_isr ; Emulation Interrupt - RTOS
RTDXRCV: .ivec rtdxrcv_isr ; Emulation Interrupt - RTDX receive
RTDXXMT: .ivec rtdxxmt_isr ; Emulation Interrupt - RTDX transmit
EMUINT: .ivec emuint_isr ; Emulation monitor mode interrupt
SINT30: .ivec sint30_isr ; Software Interrupt #30
SINT31: .ivec sint31_isr ; Software Interrupt #31
.text
reset_isr:
; *port(#0x1C01) = #0x0 ; Clear idles
bit (ST1, #11) = #1 ; Disable interrupts
@IVPD_L = #(RST >> 8) || mmap()
@IVPH_L = #(RST >> 8) || mmap()
bit(ST3,#7) = #0 ; Clear bus error interrupts
@#IFR0_L = #0xFFFF || mmap() ; clear all pending interrupts
@#IFR1_L = #0xFFFF || mmap()
;**********************************************************************************
; Reset all peripherals
;**********************************************************************************
*port(#0x1C04) = 0x20
nop_16
*port(#0x1C05) = 0x00FF ; Reset all peripherals
nop_16
goto _c_int00
nmi_isr: goto nmi_isr
int0_isr: goto int0_isr
int1_isr: goto int1_isr
tim_isr: goto tim_isr
i2s0_mmc0_tx_isr: goto i2s0_mmc0_tx_isr
uart_isr: goto uart_isr
i2s0_mmc0_rx_isr: goto i2s0_mmc0_rx_isr
dma_isr: goto dma_isr
i2s1_mmc1_tx_isr: goto i2s1_mmc1_tx_isr
coprocfft_isr: goto coprocfft_isr
i2s1_mmc1_rx_isr: goto i2s1_mmc1_rx_isr
lcd_isr: goto lcd_isr
saradc_isr: goto saradc_isr
i2s2_tx_isr: goto i2s2_tx_isr
i2s2_rx_isr: goto i2s2_rx_isr
i2s3_tx_isr: goto i2s3_tx_isr
i2s3_rx_isr: goto i2s3_rx_isr
rtc_isr: goto rtc_isr
spi_isr: goto spi_isr
usb_isr: goto usb_isr
gpio_isr: goto gpio_isr
emif_error_isr: goto emif_error_isr
i2c_isr: goto i2c_isr
berr_isr:
bit(ST3,#7) = #0 ; Clear bus error interrupts
goto berr_isr
dlog_isr: goto dlog_isr
rtos_isr: goto rtos_isr
rtdxrcv_isr: goto rtdxrcv_isr
rtdxxmt_isr: goto rtdxxmt_isr
emuint_isr: goto emuint_isr
sint30_isr: goto sint30_isr
sint31_isr: goto sint31_isr
.text
********************************************************************************
** Name : no_isr **
** **
** Purpose : Spurious interrupt handler **
** **
** Author : **
** **
********************************************************************************
no_isr: goto no_isr
|
test/Succeed/Issue2090.agda | alhassy/agda | 3 | 6247 | {-# OPTIONS --rewriting #-}
open import Agda.Primitive
postulate
_↦_ : ∀ {i} {A : Set i} → A → A → Set i
idr : ∀ {i} {A : Set i} {a : A} → a ↦ a
{-# BUILTIN REWRITE _↦_ #-}
postulate
_==_ : ∀ {i} {A : Set i} → A → A → Set i
idp : ∀ {i} {A : Set i} {a : A} → a == a
postulate
HetEq : ∀ {i} {A B : Set i} (e : A == B) (a : A) (b : B) → Set i
HetEq↦ : ∀ {i} {A : Set i} (a b : A) → HetEq idp a b ↦ (a == b)
{-# REWRITE HetEq↦ #-}
HetEq↦2 : ∀ {i j} {A : Set i} {B : Set j} (u v : A → B) → HetEq idp u v ↦ (u == v)
HetEq↦2 u v = idr
|
data/mapObjects/ssanne7.asm | adhi-thirumala/EvoYellow | 16 | 241265 | <reponame>adhi-thirumala/EvoYellow
SSAnne7Object:
db $c ; border block
db $1 ; warps
db $7, $0, $8, SS_ANNE_2
db $2 ; signs
db $1, $4, $2 ; SSAnne7Text2
db $2, $1, $3 ; SSAnne7Text3
db $1 ; objects
object SPRITE_SS_CAPTAIN, $4, $2, STAY, UP, $1 ; person
; warp-to
EVENT_DISP SS_ANNE_7_WIDTH, $7, $0 ; SS_ANNE_2
|
grammar/CarbonLexer.g4 | pensono/CarbonIntrepreter | 0 | 5319 | lexer grammar CarbonLexer;
// Whitespace and comments
WS: [ \t\r\n\u000C]+ -> skip;
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN);
REG: 'reg';
LABEL: Letter (Letter | Digit)*;
NUMBER: Digit (Letter | Digit)*;
STRING: '"' (~["\\\r\n] | '\\n')*? '"';
SYMBOL1: '*' | '/' ; // To support multiple levels of precedence
SYMBOL2: '+' | '&' | '<' | '>';
SYMBOL3: ';';
// GRAMMAR: GrammarPart;
LEFT_CURLY: '{';
RIGHT_CURLY: '}';
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
COMMA: ',';
DOT: '.';
SEMI: ';';
EQUALS: '=';
LEFT_SQUARE: '[';
RIGHT_SQUARE: ']';
COLON: ':';
MINUS: '-';
QUOTE: '"';
PIPE: '|';
// Fragment rules
fragment Digit
: [0-9]
;
fragment Letter
: [a-zA-Z$_] // these are the "java letters" below 0x7F
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
;
//fragment SymbolPart // Part of a symbol
// : [\p{Symbol}^{}.()[]|,:=;]
// ;
//fragment GrammarPart // Characters used for the language itself
// : [{}.()[],|:=;]
// ; |
system.ads | mgrojo/adalib | 15 | 9790 | <filename>system.ads
-- Standard Ada library specification
-- Copyright (c) 2003-2018 <NAME> <<EMAIL>>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
package System is
pragma Pure (System);
type Name is (implementation_defined);
-- implementation_defined-enumeration-type;
System_Name : constant Name := implementation_defined;
-- System-Dependent Named Numbers:
Min_Int : constant := root_integer'First;
Max_Int : constant := root_integer'Last;
Max_Binary_Modulus : constant := implementation_defined;
Max_Nonbinary_Modulus : constant := implementation_defined;
Max_Base_Digits : constant := root_real'Digits;
Max_Digits : constant := implementation_defined;
Max_Mantissa : constant := implementation_defined;
Fine_Delta : constant := implementation_defined;
Tick : constant := implementation_defined;
-- Storage-related Declarations:
type Address is private; -- implementation_defined;
Null_Address : constant Address;
Storage_Unit : constant := implementation_defined;
Word_Size : constant := implementation_defined * Storage_Unit;
Memory_Size : constant := implementation_defined;
-- Address Comparison:
function "<" (Left, Right : Address) return Boolean;
function "<=" (Left, Right : Address) return Boolean;
function ">" (Left, Right : Address) return Boolean;
function ">=" (Left, Right : Address) return Boolean;
function "=" (Left, Right : Address) return Boolean;
-- function "/=" (Left, Right : Address) return Boolean;
-- "/=" is implicitly defined
pragma Convention (Intrinsic, "<");
pragma Convention (Intrinsic, "<=");
pragma Convention (Intrinsic, ">");
pragma Convention (Intrinsic, ">=");
pragma Convention (Intrinsic, "=");
-- and so on for all language-defined subprograms in this package
-- Other System-Dependent Declarations:
type Bit_Order is (High_Order_First, Low_Order_First);
Default_Bit_Order : constant Bit_Order := implementation_defined;
-- Priority-related declarations (see D.1):
subtype Any_Priority is
Integer range implementation_defined .. implementation_defined;
subtype Priority is
Any_Priority range Any_Priority'First .. implementation_defined;
subtype Interrupt_Priority is Any_Priority
range Priority'Last + 1 .. Any_Priority'Last;
Default_Priority : constant Priority :=
(Priority'First + Priority'Last) / 2;
private
pragma Import (Ada, Address);
pragma Import (Ada, Null_Address);
pragma Import (Intrinsic, "<");
pragma Import (Intrinsic, "<=");
pragma Import (Intrinsic, ">");
pragma Import (Intrinsic, ">=");
pragma Import (Intrinsic, "=");
end System;
|
bead/bead2/3/Garden_Pkg.adb | balintsoos/LearnAda | 0 | 29052 | with Ada.Integer_Text_IO, tools;
use Ada.Integer_Text_IO, tools;
package body Garden_Pkg is
package Position_Generator is new Random_Generator(Position);
function GetRandPos return Position is
begin
return Position_Generator.GetRandom;
end GetRandPos;
function GetField(pos : Position) return Boolean is
begin
return Fields(pos);
end GetField;
task body Mantis is
pos : Position := GetRandPos;
alive : Boolean := true;
procedure Jump is
begin
pos := GetRandPos;
Output.Puts("Mantis jumped - pos:" & Position'Image(pos), 1);
end Jump;
procedure Poisoned is
begin
alive := false;
Output.Puts("Mantis died - pos:" & Position'Image(pos), 1);
numberOfMantises := numberOfMantises - 1;
end Poisoned;
begin
Output.Puts("Mantis created - pos:" & Position'Image(pos), 1);
while alive and John'Callable loop
if GetField(pos) = true then
Poisoned;
else
Jump;
if GetField(pos) = true then
Poisoned;
end if;
end if;
delay 0.1;
end loop;
end Mantis;
task body Gardener is
pos : Position := GetRandPos;
procedure SprayField is
begin
Fields(pos) := true;
Output.Puts("Gardener sprayed - pos:" & Position'Image(pos), 1);
end SprayField;
procedure SprayAbsorbed is
begin
for i in Position'Range loop
Fields(i) := false;
end loop;
Output.Puts("Spray absorbed", 1);
end SprayAbsorbed;
begin
Output.Puts("Gardener created - pos:" & Position'Image(pos), 1);
while numberOfMantises > 0 loop
pos := GetRandPos;
SprayField;
delay 0.2;
SprayAbsorbed;
end loop;
end Gardener;
procedure Start is
numberOfLarvae : Natural;
begin
Output.Puts("Number of mantise larvae:", 0);
Get(numberOfLarvae);
numberOfMantises := numberOfLarvae + 1;
declare
mantises : Mantis_Array(1 .. numberOfMantises);
procedure createMantises is
begin
for i in 1 .. numberOfMantises loop
mantises(i) := new Mantis;
end loop;
end createMantises;
procedure createFields is
begin
for i in Position'Range loop
Fields(i) := false;
end loop;
end createFields;
begin
John := new Gardener;
createFields;
createMantises;
end;
end Start;
end Garden_Pkg;
|
rom/src/assets.asm | Gegel85/GBCGoogleMaps | 0 | 81995 | <filename>rom/src/assets.asm
SECTION "Assets", ROMX[$6000], BANK[1]
; The fonts used.
textAssets::
incbin "assets/font.fx"
textAssetsEnd::
wifiAssets::
incbin "assets/wifi_status.fx"
wifiAssetsEnd::
googleLogoLeft::
incbin "assets/google_logo_left.cfx"
googleLogoLeftEnd::
googleLogoRight::
incbin "assets/google_logo_right.cfx"
googleLogoRightEnd::
tilemap::
incbin "assets/tilemap.cfx"
tilemapEnd:: |
oeis/344/A344057.asm | neoneye/loda-programs | 11 | 2115 | ; A344057: a(n) = (2*n)! / CatalanNumber(n - 1) for n >= 1 and a(0) = 1.
; Submitted by <NAME>
; 1,2,24,360,8064,259200,11404800,660441600,48771072000,4477184409600,500391198720000,66920738734080000,10554356508917760000,1938789402181632000000,410402940653807861760000,99180710658003566592000000,27141314475238493257728000000
mov $1,2
mov $2,1
mov $3,1
lpb $0
mul $1,$0
mul $2,$0
sub $0,1
mov $3,$2
add $2,$1
mul $3,$1
lpe
mov $0,$3
|
src/postgresql/ado-statements-postgresql.adb | My-Colaborations/ada-ado | 0 | 4267 | -----------------------------------------------------------------------
-- ado-statements-postgresql -- Postgresql query statements
-- Copyright (C) 2018, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces.C;
with Interfaces.C.Strings;
with Ada.Unchecked_Conversion;
with Util.Log;
with Util.Log.Loggers;
with ADO.C;
with ADO.Sessions;
with ADO.Dialects;
with PQ.Perfect_Hash;
package body ADO.Statements.Postgresql is
use type Interfaces.C.Strings.chars_ptr;
use type PQ.PGresult_Access;
use type PQ.ExecStatusType;
use type ADO.Schemas.Class_Mapping_Access;
use type ADO.Schemas.Column_Index;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ADO.Statements.Postgresql");
type Dialect is new ADO.Dialects.Dialect with null record;
-- Check if the string is a reserved keyword.
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean;
-- Append the item in the buffer escaping some characters if necessary.
-- The default implementation only escapes the single quote ' by doubling them.
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in String);
-- Append the item in the buffer escaping some characters if necessary
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref);
-- Append the boolean item in the buffer.
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in Boolean);
-- Get the quote character to escape an identifier.
overriding
function Get_Identifier_Quote (D : in Dialect) return Character;
Postgresql_Dialect : aliased Dialect;
-- Execute the SQL query on the given Postgresql connection.
-- Returns the query execution status
function Execute (Connection : in PQ.PGconn_Access;
Query : in String) return PQ.PGresult_Access;
function Get_Affected_Rows (Result : in PQ.PGresult_Access) return Natural;
-- ------------------------------
-- Check if the string is a reserved keyword.
-- ------------------------------
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean is
pragma Unreferenced (D);
begin
return PQ.Perfect_Hash.Is_Keyword (Name);
end Is_Reserved;
-- ------------------------------
-- Get the quote character to escape an identifier.
-- ------------------------------
overriding
function Get_Identifier_Quote (D : in Dialect) return Character is
pragma Unreferenced (D);
begin
return '"';
end Get_Identifier_Quote;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary.
-- The default implementation only escapes the single quote ' by doubling them.
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in String) is
pragma Unreferenced (D);
C : Character;
begin
Append (Buffer, 'E');
Append (Buffer, ''');
for I in Item'Range loop
C := Item (I);
case C is
when ASCII.NUL =>
Append (Buffer, '\');
Append (Buffer, '0');
when ASCII.CR =>
Append (Buffer, '\');
Append (Buffer, 'r');
when ASCII.LF =>
Append (Buffer, '\');
Append (Buffer, 'n');
when '\' | ''' | '"' =>
Append (Buffer, '\');
Append (Buffer, C);
when others =>
Append (Buffer, C);
end case;
end loop;
Append (Buffer, ''');
end Escape_Sql;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref) is
pragma Unreferenced (D);
use type Ada.Streams.Stream_Element;
Hex : constant String := "0123456789ABCDEF";
C : Ada.Streams.Stream_Element;
Blob : constant ADO.Blob_Accessor := Item.Value;
begin
Append (Buffer, "BYTEA(E'\\x");
for I in Blob.Data'Range loop
C := Blob.Data (I);
Append (Buffer, Hex (1 + Natural (C / 16)));
Append (Buffer, Hex (1 + Natural (C mod 16)));
end loop;
Append (Buffer, "')");
end Escape_Sql;
-- ------------------------------
-- Append the boolean item in the buffer.
-- ------------------------------
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in Boolean) is
pragma Unreferenced (D);
begin
Append (Buffer, (if Item then "TRUE" else "FALSE"));
end Escape_Sql;
function Get_Affected_Rows (Result : in PQ.PGresult_Access) return Natural is
Count : PQ.chars_ptr;
begin
if PQ.PQresultStatus (Result) /= PQ.PGRES_COMMAND_OK then
return 0;
end if;
Count := PQ.PQcmdTuples (Result);
declare
Val : constant String := Interfaces.C.Strings.Value (Count);
begin
if Val'Length = 0 then
return 0;
else
return Natural'Value (Val);
end if;
exception
when Constraint_Error =>
Log.Info ("Affected rows is not a number: {0}", Val);
return 0;
end;
end Get_Affected_Rows;
-- ------------------------------
-- Execute the SQL query on the given Postgresql connection.
-- Returns the query execution status
-- ------------------------------
function Execute (Connection : in PQ.PGconn_Access;
Query : in String) return PQ.PGresult_Access is
use type PQ.PGconn_Access;
Sql : constant ADO.C.String_Ptr := ADO.C.To_String_Ptr (Query);
Result : PQ.PGresult_Access;
Status : PQ.ExecStatusType;
begin
Log.Debug ("Execute {0}", Query);
if Connection = PQ.Null_PGconn then
Log.Warn ("Database connection is closed");
raise ADO.Sessions.Session_Error with "Database connection is closed";
end if;
-- Execute the query
Result := PQ.PQexec (Connection, ADO.C.To_C (Sql));
Status := PQ.PQresultStatus (Result);
case Status is
when PQ.PGRES_COMMAND_OK | PQ.PGRES_TUPLES_OK =>
null;
when others =>
declare
Error : constant Strings.chars_ptr := PQ.PQresultErrorMessage (Result);
Msg : constant String := Strings.Value (Error);
begin
Log.Error ("Error: {0}", Msg);
PQ.PQclear (Result);
raise ADO.Statements.SQL_Error with "SQL error: " & Msg;
end;
end case;
return Result;
end Execute;
-- ------------------------------
-- Delete statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Delete_Statement;
Result : out Natural) is
begin
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => "DELETE FROM ");
ADO.SQL.Append_Name (Target => Stmt.Query.SQL, Name => Stmt.Table.Table.all);
if Stmt.Query.Has_Join then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Join);
end if;
if Stmt.Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.Query.Expand;
Delete_Result : PQ.PGresult_Access;
begin
Delete_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Delete_Result);
PQ.PQclear (Delete_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Deleted {0} rows", Natural'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create the delete statement
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is
Result : constant Postgresql_Delete_Statement_Access := new Postgresql_Delete_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Query := Result.Delete_Query'Access;
Result.Delete_Query.Set_Dialect (Postgresql_Dialect'Access);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Update statement
-- ------------------------------
-- Execute the query
overriding
procedure Execute (Stmt : in out Postgresql_Update_Statement) is
Result : Integer;
begin
Postgresql_Update_Statement'Class (Stmt).Execute (Result);
end Execute;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Update_Statement;
Result : out Integer) is
begin
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "UPDATE ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " SET ");
ADO.SQL.Append_Fields (Update => Stmt.This_Query);
if Stmt.This_Query.Has_Join then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join);
end if;
if Stmt.This_Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Update_Result : PQ.PGresult_Access;
begin
Update_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Update_Result);
PQ.PQclear (Update_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Updated {0} rows", Integer'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create an update statement.
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is
Result : constant Postgresql_Update_Statement_Access := new Postgresql_Update_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Insert statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Insert_Statement;
Result : out Integer) is
begin
if Stmt.Table /= null then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "INSERT INTO ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " (");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => False);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ") VALUES(");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => True);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ")");
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Insert_Result : PQ.PGresult_Access;
begin
Insert_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Insert_Result);
PQ.PQclear (Insert_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Inserted {0} rows", Integer'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create an insert statement.
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is
Result : constant Postgresql_Insert_Statement_Access := new Postgresql_Insert_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
ADO.SQL.Set_Insert_Mode (Result.This_Query);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Query statement for Postgresql
-- ------------------------------
-- ------------------------------
-- Get a column field address.
-- If the query was not executed, raises Invalid_Statement
-- If the column is out of bound, raises Constraint_Error
-- ------------------------------
function Get_Field (Query : in Postgresql_Query_Statement'Class;
Column : in Natural) return chars_ptr is
Result : PQ.chars_ptr;
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "Null statement";
end if;
if Column >= Query.Max_Column then
Log.Warn ("Column {0} is not valid", Natural'Image (Column));
raise Invalid_Column with "Invalid column" & Natural'Image (Column);
end if;
if PQ.PQgetisnull (Query.Result, Query.Row, Interfaces.C.int (Column)) = 1 then
Log.Warn ("Null column {0} in row {1}", Natural'Image (Column),
Interfaces.C.int'Image (Query.Row));
raise Invalid_Type with "Null column";
end if;
Result := PQ.PQgetvalue (Query.Result, Query.Row, Interfaces.C.int (Column));
return ADO.Statements.To_Chars_Ptr (Result);
end Get_Field;
-- ------------------------------
-- Get a column field length.
-- If the query was not executed, raises Invalid_Statement
-- If the column is out of bound, raises Constraint_Error
-- ------------------------------
function Get_Field_Length (Query : in Postgresql_Query_Statement'Class;
Column : in Natural) return Natural is
begin
if Query.Row >= Query.Row_Count then
raise Invalid_Statement with "Null statement";
end if;
if Column >= Query.Max_Column then
Log.Warn ("Column {0} is not valid", Natural'Image (Column));
raise Invalid_Column with "Invalid column" & Natural'Image (Column);
end if;
return Natural (PQ.PQgetlength (Query.Result, Query.Row, Interfaces.C.int (Column)));
end Get_Field_Length;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Query_Statement) is
begin
if Stmt.This_Query.Has_Join then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join);
end if;
if Stmt.This_Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter);
end if;
if Stmt.Result /= PQ.Null_PGresult then
PQ.PQclear (Stmt.Result);
Stmt.Result := PQ.Null_PGresult;
end if;
declare
Expanded_Query : constant String := Stmt.Query.Expand;
Status : PQ.ExecStatusType;
begin
-- Execute the query
Stmt.Result := Execute (Stmt.Connection, Expanded_Query);
-- Report an error if the query failed
Status := PQ.PQresultStatus (Stmt.Result);
if Status /= PQ.PGRES_TUPLES_OK and Status /= PQ.PGRES_COMMAND_OK then
declare
Message : constant String := Strings.Value (PQ.PQerrorMessage (Stmt.Connection));
begin
Log.Error ("Query failed: '{0}'", Expanded_Query);
Log.Error (" with error: '{0}'", Message);
raise ADO.Statements.SQL_Error with "Query failed: " & Message;
end;
end if;
Stmt.Row := 0;
Stmt.Row_Count := PQ.PQntuples (Stmt.Result);
Stmt.Max_Column := Natural (PQ.PQnfields (Stmt.Result));
end;
end Execute;
-- ------------------------------
-- Get the number of rows returned by the query
-- ------------------------------
overriding
function Get_Row_Count (Query : in Postgresql_Query_Statement) return Natural is
begin
return Natural (Query.Row_Count);
end Get_Row_Count;
-- ------------------------------
-- Returns True if there is more data (row) to fetch
-- ------------------------------
overriding
function Has_Elements (Query : in Postgresql_Query_Statement) return Boolean is
begin
return Query.Row < Query.Row_Count;
end Has_Elements;
-- ------------------------------
-- Fetch the next row
-- ------------------------------
overriding
procedure Next (Query : in out Postgresql_Query_Statement) is
begin
if Query.Row < Query.Row_Count then
Query.Row := Query.Row + 1;
else
Log.Warn ("Next has no more element in the result set.");
end if;
end Next;
-- ------------------------------
-- Returns true if the column <b>Column</b> is null.
-- ------------------------------
overriding
function Is_Null (Query : in Postgresql_Query_Statement;
Column : in Natural) return Boolean is
begin
if Query.Result = PQ.Null_PGresult then
return True;
end if;
if Column >= Query.Max_Column or Query.Row >= Query.Row_Count then
return True;
end if;
return PQ.PQgetisnull (Query.Result, Query.Row, Interfaces.C.int (Column)) = 1;
end Is_Null;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Int64</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Int64 (Query : Postgresql_Query_Statement;
Column : Natural) return Int64 is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Integer";
else
return Get_Int64 (Field);
end if;
end Get_Int64;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Long_Float</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Double (Query : Postgresql_Query_Statement;
Column : Natural) return Long_Float is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Long_Float";
else
return Get_Double (Field);
end if;
end Get_Double;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Boolean</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Boolean (Query : Postgresql_Query_Statement;
Column : Natural) return Boolean is
Field : chars_ptr := Query.Get_Field (Column);
C : Character;
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Boolean";
end if;
C := Field.all;
Field := Field + 1;
case C is
when '0' =>
if Field.all /= ASCII.NUL then
raise Invalid_Type with "Invalid boolean value";
end if;
return False;
when '1' =>
if Field.all /= ASCII.NUL then
raise Invalid_Type with "Invalid boolean value";
end if;
return True;
when 'T' | 't' =>
C := Field.all;
if C = ASCII.NUL then
return True;
end if;
if C /= 'r' and C /= 'R' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'u' and C /= 'U' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'e' and C /= 'E' then
raise Invalid_Type with "Invalid boolean value";
end if;
return True;
when 'F' | 'f' =>
C := Field.all;
if C = ASCII.NUL then
return False;
end if;
if C /= 'a' and C /= 'A' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'l' and C /= 'L' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 's' and C /= 'S' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'e' and C /= 'E' then
raise Invalid_Type with "Invalid boolean value";
end if;
return False;
when others =>
raise Invalid_Type with "Invalid boolean value";
end case;
end Get_Boolean;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Unbounded_String (Query : Postgresql_Query_Statement;
Column : Natural) return Unbounded_String is
Field : chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to String";
end if;
declare
Result : Unbounded_String;
C : Character;
begin
loop
C := Field.all;
exit when C = ASCII.NUL;
Append (Result, C);
Field := Field + 1;
end loop;
return Result;
end;
end Get_Unbounded_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_String (Query : Postgresql_Query_Statement;
Column : Natural) return String is
begin
return To_String (Query.Get_Unbounded_String (Column));
end Get_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Blob</b> reference.
-- ------------------------------
overriding
function Get_Blob (Query : in Postgresql_Query_Statement;
Column : in Natural) return ADO.Blob_Ref is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field /= null then
return Get_Blob (Size => Query.Get_Field_Length (Column),
Data => Field);
else
return Null_Blob;
end if;
end Get_Blob;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Time (Query : Postgresql_Query_Statement;
Column : Natural) return Ada.Calendar.Time is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
return ADO.Statements.Get_Time (Field);
end Get_Time;
-- ------------------------------
-- Get the column type
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Column_Type (Query : Postgresql_Query_Statement;
Column : Natural)
return ADO.Schemas.Column_Type is
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
if Column >= Query.Max_Column then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
end if;
return ADO.Schemas.T_UNKNOWN;
end Get_Column_Type;
-- ------------------------------
-- Get the column name
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Column_Name (Query : in Postgresql_Query_Statement;
Column : in Natural)
return String is
Name : PQ.chars_ptr;
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
if Column >= Query.Max_Column then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
end if;
Name := PQ.PQfname (Query.Result, Interfaces.C.int (Column));
if Name = Interfaces.C.Strings.Null_Ptr then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
else
return Interfaces.C.Strings.Value (Name);
end if;
end Get_Column_Name;
-- ------------------------------
-- Get the number of columns in the result.
-- ------------------------------
overriding
function Get_Column_Count (Query : in Postgresql_Query_Statement)
return Natural is
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
return Query.Max_Column;
end Get_Column_Count;
overriding
procedure Finalize (Query : in out Postgresql_Query_Statement) is
begin
if Query.Result /= PQ.Null_PGresult then
PQ.PQclear (Query.Result);
Query.Result := PQ.Null_PGresult;
end if;
end Finalize;
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is
Result : constant Postgresql_Query_Statement_Access := new Postgresql_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
if Table /= null then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "SELECT ");
for I in Table.Members'Range loop
if I > Table.Members'First then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => ", ");
end if;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "o.");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Members (I).all);
end loop;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " FROM ");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Table.all);
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " AS o ");
end if;
return Result.all'Access;
end Create_Statement;
function Create_Statement (Database : in PQ.PGconn_Access;
Query : in String)
return Query_Statement_Access is
Result : constant Postgresql_Query_Statement_Access := new Postgresql_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
Append (Query => Result.all, SQL => Query);
return Result.all'Access;
end Create_Statement;
end ADO.Statements.Postgresql;
|
src/asf-components-widgets-likes.adb | Letractively/ada-asf | 0 | 15977 | <reponame>Letractively/ada-asf
-----------------------------------------------------------------------
-- components-widgets-likes -- Social Likes Components
-- Copyright (C) 2013, 2014 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Locales;
with Util.Beans.Objects;
with Util.Strings.Tokenizers;
-- GNAT bug, the with clause is necessary to call Get_Global on the application.
pragma Warnings (Off, "*is not referenced");
with ASF.Applications.Main;
pragma Warnings (On, "*is not referenced");
with ASF.Requests;
with ASF.Contexts.Writer;
package body ASF.Components.Widgets.Likes is
FB_LAYOUT_ATTR : aliased constant String := "data-layout";
FB_SHOW_FACES_ATTR : aliased constant String := "data-show-faces";
FB_WIDTH_ATTR : aliased constant String := "data-width";
FB_ACTION_ATTR : aliased constant String := "data-action";
FB_FONT_ATTR : aliased constant String := "data-font";
FB_COlORSCHEME_ATTR : aliased constant String := "data-colorscheme";
FB_REF_ATTR : aliased constant String := "data-ref";
FB_KIDS_ATTR : aliased constant String := "data-kid_directed_site";
FB_SEND_ATTR : aliased constant String := "data-send";
TW_VIA_ATTR : aliased constant String := "data-via";
TW_COUNT_ATTR : aliased constant String := "data-count";
TW_SIZE_ATTR : aliased constant String := "data-size";
TW_COUNTURL_ATTR : aliased constant String := "data-counturl";
TW_TEXT_ATTR : aliased constant String := "data-text";
TW_RELATED_ATTR : aliased constant String := "data-related";
TW_LANG_ATTR : aliased constant String := "data-lang";
TW_HASHTAGS_ATTR : aliased constant String := "data-hashtags";
G_ANNOTATION_ATTR : aliased constant String := "data-annotation";
G_WIDTH_ATTR : aliased constant String := "data-width";
FACEBOOK_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
FACEBOOK_SCRIPT_ATTRIBUTE : constant String := "asf.widgets.facebook.script";
GOOGLE_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
GOOGLE_SCRIPT_ATTRIBUTE : constant String := "asf.widgets.google.script";
TWITTER_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
TWITTER_SCRIPT_ATTRIBUTE : constant String := "asf.widgets.twitter.script";
type Like_Generator_Binding is record
Name : Util.Strings.Name_Access;
Generator : Like_Generator_Access;
end record;
type Like_Generator_Array is array (1 .. MAX_LIKE_GENERATOR) of Like_Generator_Binding;
FB_NAME : aliased constant String := "facebook";
FB_GENERATOR : aliased Facebook_Like_Generator;
G_NAME : aliased constant String := "google+";
G_GENERATOR : aliased Google_Like_Generator;
TWITTER_NAME : aliased constant String := "twitter";
TWITTER_GENERATOR : aliased Twitter_Like_Generator;
Generators : Like_Generator_Array := (1 => (FB_NAME'Access, FB_GENERATOR'Access),
2 => (G_NAME'Access, G_GENERATOR'Access),
3 => (TWITTER_NAME'Access, TWITTER_GENERATOR'Access),
others => (null, null));
-- ------------------------------
-- Render the facebook like button according to the component attributes.
-- ------------------------------
overriding
procedure Render_Like (Generator : in Facebook_Like_Generator;
UI : in UILike'Class;
Href : in String;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
pragma Unreferenced (Generator);
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
Request : constant ASF.Requests.Request_Access := Context.Get_Request;
begin
if not Context.Is_Ajax_Request and then
Util.Beans.Objects.Is_Null (Request.Get_Attribute (FACEBOOK_SCRIPT_ATTRIBUTE)) then
Request.Set_Attribute (FACEBOOK_SCRIPT_ATTRIBUTE, Util.Beans.Objects.To_Object (True));
Writer.Queue_Script ("(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0];"
& "if (d.getElementById(id)) return;"
& "js = d.createElement(s); js.id = id;js.async=true;"
& "js.src = ""//connect.facebook.net/");
Writer.Queue_Script (Util.Locales.To_String (Context.Get_Locale));
Writer.Queue_Script ("/all.js#xfbml=1&;appId=");
declare
App_Id : constant String
:= Context.Get_Application.Get_Config (P_Facebook_App_Id.P);
begin
if App_Id'Length = 0 then
UI.Log_Error ("The facebook client application id is empty");
UI.Log_Error ("Please, configure the '{0}' property "
& "in the application", P_Facebook_App_Id.PARAM_NAME);
else
Writer.Queue_Script (App_Id);
end if;
end;
Writer.Queue_Script (""";fjs.parentNode.insertBefore(js, fjs);"
& "}(document, 'script', 'facebook-jssdk'));");
Writer.Start_Element ("div");
Writer.Write_Attribute ("id", "fb-root");
Writer.End_Element ("div");
end if;
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "fb-like");
Writer.Write_Attribute ("data-href", Href);
UI.Render_Attributes (Context, FACEBOOK_ATTRIBUTE_NAMES, Writer);
Writer.End_Element ("div");
end Render_Like;
-- ------------------------------
-- Google like generator
-- ------------------------------
overriding
procedure Render_Like (Generator : in Google_Like_Generator;
UI : in UILike'Class;
Href : in String;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
pragma Unreferenced (Generator);
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
Request : constant ASF.Requests.Request_Access := Context.Get_Request;
begin
if not Context.Is_Ajax_Request and then
Util.Beans.Objects.Is_Null (Request.Get_Attribute (GOOGLE_SCRIPT_ATTRIBUTE)) then
Request.Set_Attribute (GOOGLE_SCRIPT_ATTRIBUTE, Util.Beans.Objects.To_Object (True));
Writer.Queue_Include_Script ("https://apis.google.com/js/plusone.js");
end if;
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "g-plusone");
Writer.Write_Attribute ("data-href", Href);
UI.Render_Attributes (Context, GOOGLE_ATTRIBUTE_NAMES, Writer);
Writer.End_Element ("div");
end Render_Like;
-- ------------------------------
-- Tweeter like generator
-- ------------------------------
overriding
procedure Render_Like (Generator : in Twitter_Like_Generator;
UI : in UILike'Class;
Href : in String;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
pragma Unreferenced (Generator);
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
Request : constant ASF.Requests.Request_Access := Context.Get_Request;
Lang : constant String := Util.Locales.Get_ISO3_Language (Context.Get_Locale);
begin
if not Context.Is_Ajax_Request and then
Util.Beans.Objects.Is_Null (Request.Get_Attribute (TWITTER_SCRIPT_ATTRIBUTE)) then
Request.Set_Attribute (TWITTER_SCRIPT_ATTRIBUTE, Util.Beans.Objects.To_Object (True));
Writer.Queue_Script ("!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],"
& "p=/^http:/.test(d.location)?'http':'https';"
& "if(!d.getElementById(id)){js=d.createElement(s);js.id=id;"
& "js.src=p+'://platform.twitter.com/widgets.js';"
& "fjs.parentNode.insertBefore(js,fjs);}}"
& "(document, 'script', 'twitter-wjs');");
end if;
Writer.Start_Element ("a");
Writer.Write_Attribute ("href", "https://twitter.com/share");
Writer.Write_Attribute ("class", "twitter-share-button");
Writer.Write_Attribute ("data-url", Href);
Writer.Write_Attribute ("data-lang", Lang);
UI.Render_Attributes (Context, TWITTER_ATTRIBUTE_NAMES, Writer);
Writer.Write_Text ("Tweet");
Writer.End_Element ("a");
end Render_Like;
-- ------------------------------
-- Get the link to submit in the like action.
-- ------------------------------
function Get_Link (UI : in UILike;
Context : in ASF.Contexts.Faces.Faces_Context'Class) return String is
Href : constant String := UI.Get_Attribute ("href", Context, "");
begin
if Href'Length > 0 then
return Href;
else
return Context.Get_Request.Get_Request_URI;
end if;
end Get_Link;
-- ------------------------------
-- Render an image with the source link created from an email address to the Gravatars service.
-- ------------------------------
overriding
procedure Encode_Begin (UI : in UILike;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
begin
if UI.Is_Rendered (Context) then
declare
Writer : constant Contexts.Writer.Response_Writer_Access
:= Context.Get_Response_Writer;
Kind : constant String := UI.Get_Attribute ("type", Context, "");
Href : constant String := UILike'Class (UI).Get_Link (Context);
Style : constant String := UI.Get_Attribute ("style", Context, "");
Class : constant String := UI.Get_Attribute ("styleClass", Context, "");
procedure Render (Name : in String; Done : out Boolean);
procedure Render (Name : in String;
Done : out Boolean) is
use type Util.Strings.Name_Access;
begin
Done := False;
for I in Generators'Range loop
exit when Generators (I).Name = null;
if Generators (I).Name.all = Name then
Writer.Start_Element ("div");
if Style'Length > 0 then
Writer.Write_Attribute ("style", Style);
end if;
if Class'Length > 0 then
Writer.Write_Attribute ("class", Class);
end if;
Generators (I).Generator.Render_Like (UI, Href, Context);
Writer.End_Element ("div");
return;
end if;
end loop;
UI.Log_Error ("Like type {0} is not recognized", Name);
end Render;
begin
if Kind'Length = 0 then
UI.Log_Error ("The like type is empty.");
else
Util.Strings.Tokenizers.Iterate_Tokens (Content => Kind, Pattern => ",",
Process => Render'Access);
end if;
end;
end if;
end Encode_Begin;
-- ------------------------------
-- Register the like generator under the given name.
-- ------------------------------
procedure Register_Like (Name : in Util.Strings.Name_Access;
Generator : in Like_Generator_Access) is
use type Util.Strings.Name_Access;
begin
for I in Generators'Range loop
if Generators (I).Name = null then
Generators (I).Name := Name;
Generators (I).Generator := Generator;
return;
end if;
end loop;
end Register_Like;
begin
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_LAYOUT_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_SHOW_FACES_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_WIDTH_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_ACTION_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_FONT_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_COlORSCHEME_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_REF_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_KIDS_ATTR'Access);
FACEBOOK_ATTRIBUTE_NAMES.Insert (FB_SEND_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_SIZE_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_COUNT_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_VIA_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_COUNTURL_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_TEXT_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_RELATED_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_LANG_ATTR'Access);
TWITTER_ATTRIBUTE_NAMES.Insert (TW_HASHTAGS_ATTR'Access);
GOOGLE_ATTRIBUTE_NAMES.Insert (G_ANNOTATION_ATTR'Access);
GOOGLE_ATTRIBUTE_NAMES.Insert (G_WIDTH_ATTR'Access);
end ASF.Components.Widgets.Likes;
|
Appendices/Appendix_D_Command-Line Debugging Assembly with GDB/Program_D.1/x86_64/Program_D.1_Linux_NASM.asm | chen150182055/Assembly | 272 | 98307 | ; Program D.1
; sum - NASM (64-bit) on Linux
; Copyright (c) 2019 Hall & Slonka
; nasm -f elf64 -o sum.o -l sum.lst sum.asm
; ld -e _main -melf_x86_64 -o sum sum.o
section .data
num1: dq 2
num2: dq 4
section .text
global _main, _sum
_main:
mov rax, 10
dec rax
mov rbx, 5
lea rdi, [rel num1]
lea rsi, [rel num2]
call _sum
add rax, rbx
dec rax
mov rax, 60
xor rdi, rdi
syscall
_sum:
push rbp
mov rbp, rsp
push rbx
mov rax, [rdi]
add rax, [rsi]
pop rbx
pop rbp
ret
|
programs/oeis/080/A080639.asm | karttu/loda | 1 | 168118 | ; A080639: a(1) = 1; for n>1, a(n) is taken to be the smallest integer greater than a(n-1) which is consistent with the condition "for n>1, n is a member of the sequence if and only if a(n) is even".
; 1,2,5,7,8,9,10,12,14,16,17,18,19,20,21,22,24,26,28,30,32,34,35,36,37,38,39,40,41,42,43,44,45,46,48,50,52,54,56,58,60,62,64,66,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,96
sub $0,1
cal $0,79000 ; a(n) is taken to be the smallest positive integer greater than a(n-1) which is consistent with the condition "n is a member of the sequence if and only if a(n) is odd".
mov $1,$0
add $1,1
|
Assembly/Project/Includes.asm | Myself086/Project-Nested | 338 | 105252 |
.fix "Stuff"
.outfile "Nothing.smc"
Game "Empty ", 0x00, 0x00
.else
{
.nowrite
}
Game "Empty ", 0x00, 0x00
{
.outfile "Project_Nested.smc"
// ---------------------------------------------------------------------------
// Files with no direct writing
.include "Project/Variables.asm"
.include "Project/Macros.asm"
.include "Project/WDM.asm"
// ---------------------------------------------------------------------------
// Header
.include "Project/Header.asm"
// ---------------------------------------------------------------------------
// Bank 80: Various code including start-up
.addr 0x808000, 0x80feff
// Interpret_Indirect.asm is first in the bank because it starts with a page alignment
// Must be in the same bank as Interpret_and_Inline.asm and can't be bank 0x00 nor HiROM banks
.include "Project/Interpret_Indirect.asm"
.include "Project/Interpret_and_Inline.asm"
.include "Project/Chr.asm"
.include "Project/IO.asm"
.def IO__BANK 0x80
.def Interpret__BANK 0x80
// ---------------------------------------------------------------------------
// Bank c0: ROM information and various code not depending on ROM DB
.addr 0xc00000, 0xc07fff
.include "Project/RomInfo.asm"
// Sound
Spc_Code_Start:
.fix "Sound"
.offsetfrom 0x0400
.includeSPC "Project/Spc700/Spc.asm"
.offsetend
.fix "Stuff"
Spc_Code_End:
.include "Project/Gui.asm"
.include "Project/Gui.StringFormat.asm"
.include "Project/JMPiList.asm"
// Exception data must be at the end of the bank and in the same bank as Gui
ExceptionData_Start:
ExceptionData:
// ---------------------------------------------------------------------------
// Bank 81
.addr 0x818000, 0x81fffe
.include "Project/Main.asm"
.include "Project/Gfx_Interrupt.asm"
// Recompiler, opcode tables and mappers must be in the same bank
.include "Project/Recompiler.asm"
.include "Project/OpcodeTables.asm"
.include "Project/Mappers/Mapper1.asm"
.include "Project/Mappers/Mapper2.asm"
.include "Project/Mappers/Mapper3.asm"
.include "Project/Mappers/Mapper4.asm"
.include "Project/Mappers/Mapper7.asm"
// Memory management
.include "Project/Array.asm"
.include "Project/Memory.asm"
.include "Project/Dictionary.asm"
// Static recompiler code
.include "Project/Feedback.asm"
.include "Project/StaticRec.asm"
// Low level emulation
.include "Project/Interpreter.asm"
.include "Project/Cop.asm"
.include "Project/Hdma.asm"
.include "Project/Sound.asm"
.include "Project/Patch.asm"
// Trap unsupported mappers
[0x81ffff] = 0x00
// ---------------------------------------------------------------------------
// Bank c1: Unlinked calls recompiled ahead of time
// Origins: [0] = Original return, [2] = Original destination
.def StaticRec_Origins 0xc10000
// ---------------------------------------------------------------------------
// Bank c2: Unrolled indirect JMP
.addr 0xc20000, 0xc2ffff
JMPiU_Start:
.include "Project/JMPiUnrolled.asm"
// ---------------------------------------------------------------------------
// Bank 82: Static recompiler call tables (no static data)
.addr 0xc30000, 0xc3ffff
StaticRec_Tables:
// 256 arrays containing 16-bit address and 16-bit length
// Each sub array contains (same format as known calls in RAM):
// [0] 24-bit for the original address
// [3] 24-bit new call address
// [6] 16-bit recompiler flags
// ---------------------------------------------------------------------------
// Final ROM size
.finalsize 0x030000
// ---------------------------------------------------------------------------
}
|
src/app/AppLogOffsetReset.asm | jhm-ciberman/calculator-asm | 2 | 161083 | <gh_stars>1-10
proc AppLogOffsetReset
mov [_gr_log_offset], 0
ret
endp |
Relatorios/Tarefa 07/Resolucao/codigo/programa14.asm | RafaelAmauri/Arquitetura-de-Computadores-2 | 0 | 13070 | <reponame>RafaelAmauri/Arquitetura-de-Computadores-2
.data
valor: .word 4
.text
ori $t0, $zero, 0x1001 # t0 = 0x1001
sll $t0, $t0, 16 # t0 = 0x10010000
lw $s0, 0($t0) # Pegando primeiro valor da memória
andi $t1, $s0, 1 # Verificando se termina com 1, se for é ímpar
beqz $t1, PAR # Se for par saltará direto para
sw $t1, 4($t0) # Salvar o resultado da operação no primeiro espaço livre da memória
j FINALIZAR # Terminar o programa
PAR:
sw $t1, 4($t0) # Salvar o resultado da operação no primeiro espaço livre da memória
FINALIZAR:
J FINALIZAR # FInalizar o programa |
AssemblyExamples/01a_hello_world_syscall/01a_hello.asm | jude-arokiam-uoit/csci-2050-assembly-examples | 1 | 167875 | section .data
message db "This is a message from Linux assembly!", 0ah, 0dh
section .text
global _start
; more system calls are provided in:
; http://syscalls.kernelgrok.com/
_start:
; print the message
mov rax, 1 ; syscall number for sys_write()
mov rdi, 1 ; standard output
mov rsi, message ; what to print
mov rdx, 40 ; how many characters to print
syscall
; exit
mov rax, 60 ; syscall number for sys_exit()
mov rdi, 0 ; exit code (0 means success)
syscall
|
oeis/337/A337420.asm | neoneye/loda-programs | 11 | 24890 | ; A337420: a(n) = Sum_{k=0..n} (-n)^(n-k) * binomial(2*k,k) * binomial(2*n,2*k).
; Submitted by <NAME>
; 1,1,-14,-7,1222,-14873,26196,3522955,-110841786,2088947819,-15869398244,-823790768205,55262757020956,-2199333670723343,65894251730104552,-1235877788883794355,-18904175519674543546,3743957841955101437667,-268850524243738610546292,14826380281246309472525851
mov $1,1
mov $2,1
mov $3,$0
add $3,1
add $3,$0
mov $4,1
lpb $3
sub $3,1
mul $1,$3
mul $2,-1
sub $3,1
mul $1,$3
add $5,$4
div $1,$5
mul $2,$0
add $2,$1
add $4,2
lpe
mov $0,$2
|
samples/nes/common/anm.asm | 0x8BitDev/MAPeD-SPReD | 23 | 96670 | <reponame>0x8BitDev/MAPeD-SPReD
;###############################################
;
; Copyright 2018-2019 0x8BitDev ( MIT license )
;
;###############################################
;
; Animation functions
; LIMITATION: max 32 frames in animation
;
.struct runtime_anm_data
curr_tick .byte ; 0
num_ticks .byte ; 1 num ticks to change a frame
curr_frame .byte ; 2
num_frames .byte ; 3 num frames to loop an animation
loop_frame .byte ; 4
frames_ptr .word ; 5
.endstruct
.struct static_anm_data
num_ticks .byte
num_frames .byte
loop_frame .byte
frames_ptr .word
.endstruct
.struct frame_data
gfx_ptr .word
data_size .byte
chr_id .byte
.endstruct
.segment "ZP"
anm_pos_x: .res 1
anm_pos_y: .res 1
ppu_sprite_CHR_bank: .res 1
.scope inner_vars
tick_frame: .res 1
tmp_anm_addr: .res 2
.endscope
.segment "CODE"
; *** animation data init ***
; IN:
; X - LOW byte of anm data
; Y - HIGH byte of anm data
; data_addr - address at which animation will be initialized
anm_init:
stx inner_vars::tmp_anm_addr
sty inner_vars::tmp_anm_addr + 1
lda #$00
ldy #runtime_anm_data::curr_tick
sta (<data_addr), y
ldy #runtime_anm_data::curr_frame
sta (<data_addr), y
ldy #static_anm_data::num_ticks
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::num_ticks
sta (<data_addr), y
ldy #static_anm_data::num_frames
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::num_frames
sta (<data_addr), y
ldy #static_anm_data::loop_frame
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::loop_frame
sta (<data_addr), y
ldy #static_anm_data::frames_ptr
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::frames_ptr
sta (<data_addr), y
ldy #static_anm_data::frames_ptr + 1
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::frames_ptr + 1
sta (<data_addr), y
rts
; *** update animation frame and load address of a current frame into the inner_vars::tmp_anm_addr ***
; IN:
; X - LOW byte of anm addr
; Y - HIGH byte of anm addr
; OUT:
; inner_vars::tmp_anm_addr - current animation frame address
anm_update:
jsr _anm_get_updated_frame_ind
; A - current anm frame
; A *= 4 ( .sizeof( frame_data ) )
clc
rol a
rol a
; add offset to frames start address
ldy #runtime_anm_data::frames_ptr
adc (<inner_vars::tmp_anm_addr), y
pha
iny
lda #$00
adc (<inner_vars::tmp_anm_addr), y
; save the result to the inner_vars::tmp_anm_addr
sta inner_vars::tmp_anm_addr + 1
pla
sta inner_vars::tmp_anm_addr
rts
; *** get index of a current updated frame ***
; IN:
; X - LOW byte of anm addr
; Y - HIGH byte of anm addr
; OUT:
; A - current frame index
_anm_get_updated_frame_ind:
; save animation address
stx inner_vars::tmp_anm_addr
sty inner_vars::tmp_anm_addr + 1
ldy #runtime_anm_data::curr_tick
lda (<inner_vars::tmp_anm_addr), y ; A - current tick
tax
inx ; inc tick counter
stx inner_vars::tick_frame ; save to the temp var
ldy #runtime_anm_data::num_ticks
lda (<inner_vars::tmp_anm_addr), y ; A - number of ticks to change the frame
cmp inner_vars::tick_frame ; tick - A
beq _switch_frame ; if _tick == delay_ticks -> go to the next frame
ldy #runtime_anm_data::curr_tick
lda inner_vars::tick_frame
sta (<inner_vars::tmp_anm_addr), y ; save new tick value
ldy #runtime_anm_data::curr_frame
lda (<inner_vars::tmp_anm_addr), y ; get current frame value
rts
_switch_frame:
ldy #runtime_anm_data::curr_tick
lda #$00
sta (<inner_vars::tmp_anm_addr), y ; save the new tick value
;iny
ldy #runtime_anm_data::curr_frame
lda (<inner_vars::tmp_anm_addr), y ; get current frame value
tax
inx
stx inner_vars::tick_frame ; save new frame value
ldy #runtime_anm_data::num_frames
lda (<inner_vars::tmp_anm_addr), y ; get the MAX number of animation frames
cmp inner_vars::tick_frame
bne _save_next_frame
ldy #runtime_anm_data::loop_frame ; begin animation from loop frame
lda (<inner_vars::tmp_anm_addr), y
ldy #runtime_anm_data::curr_frame
sta (<inner_vars::tmp_anm_addr), y
rts
_save_next_frame:
ldy #runtime_anm_data::curr_frame
lda inner_vars::tick_frame
sta (<inner_vars::tmp_anm_addr), y
rts |
test/arch/HDpi.asm | yunxu1019/efront | 1 | 93077 | <filename>test/arch/HDpi.asm
.386
.Model Flat, StdCall
Option Casemap :None
__UNICODE__ equ 1
;部分代码来自http://www.voidcn.com/article/p-rzrbrmkt-bxe.html
Include windows.inc
Include user32.inc
Include kernel32.inc
Include gdi32.inc
includelib gdi32.lib
IncludeLib user32.lib
IncludeLib kernel32.lib
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
.DATA
classname db "RULER"
shcorName db "shcore.dll",0
dpiName db a"SetProcessDpiAwareness",0
menuName db "屏幕尺子",0
qxName db "切换方向",0
bzName db "帮助",0
tcLabel db "退出",0
bfhd db "%d",0
vertical dw 0
toggle dd 0
buffer db 100 dup(0)
opacity dd 180
dpi dd 96
helptxt db 适配高分屏的尺子:用鼠标滚轮可以改
db 变透明度
.DATA?
hmenu dd ?
hpen dd ?
hpen1 dd ?
hpen2 dd ?
.CODE
START:
@@:
invoke LoadLibraryW,offset shcorName
invoke GetProcAddress,eax,offset dpiName
.if eax != 0
push DWORD ptr 2
call eax
invoke GetDC,0
.if vertical==0
invoke GetDeviceCaps,eax,LOGPIXELSX
.else
invoke GetDeviceCaps,eax,LOGPIXELSY
.endif
mov dpi,eax
.endif
invoke GetModuleHandle,NULL
invoke WinMain,eax,NULL,NULL,SW_SHOWDEFAULT
.if toggle==1
mov toggle,0
jmp @B
.endif
invoke ExitProcess,0
WinMain proc hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,CmdShow:DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL hwnd :HWND
LOCAL rect :RECT
mov wc.cbSize,sizeof WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc,offset WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,offset classname
invoke LoadIcon,hInst,100
mov wc.hIcon,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
mov wc.hIconSm,0
invoke RegisterClassEx, ADDR wc
invoke GetDesktopWindow
mov ecx,eax
invoke GetClientRect,ecx,addr rect
mov ecx,rect.right
mov edx,rect.bottom
mov eax,dpi
shl eax,2
sub ecx,eax
shr eax,2
sub edx,eax
shr ecx,1
shr edx,1
shl eax,2
.if vertical!=0
invoke CreateWindowEx,0,addr classname,addr classname,WS_POPUP or WS_SIZEBOX,ecx,edx,dpi,eax,NULL,NULL,hInst,NULL
.else
invoke CreateWindowEx,0,addr classname,addr classname,WS_POPUP or WS_SIZEBOX,ecx,edx,eax,dpi,NULL,NULL,hInst,NULL
.endif
mov hwnd,eax
invoke ShowWindow,hwnd,SW_SHOWNORMAL
invoke UpdateWindow,hwnd
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hwnd:DWORD,umsg:DWORD,wparam :DWORD,lparam :DWORD
LOCAL hdc :HDC
LOCAL ps :PAINTSTRUCT
LOCAL rect :RECT
LOCAL pos :POINT
LOCAL coord:DWORD
LOCAL xcm :DWORD
.if umsg==WM_CREATE
invoke GetWindowLong,hwnd,GWL_EXSTYLE
or eax,80000h
invoke SetWindowLong,hwnd,GWL_EXSTYLE,eax
invoke SetLayeredWindowAttributes,hwnd,0,opacity,2
invoke SetWindowPos,hwnd,HWND_TOPMOST,0,0,0,0,SWP_SHOWWINDOW or SWP_NOMOVE or SWP_NOSIZE
invoke CreatePopupMenu
mov hmenu,eax
invoke AppendMenu,hmenu,MF_GRAYED,0,offset menuName
invoke AppendMenu,hmenu,MF_SEPARATOR,0,0
invoke AppendMenu,hmenu,0,1,offset qxName
invoke AppendMenu,hmenu,0,2,offset bzName
invoke AppendMenu,hmenu,0,3,offset tcLabel
invoke CreatePen,PS_SOLID,0,0AAAAAAH
mov hpen1,eax
invoke CreatePen,PS_DASH,0,0
mov hpen2,eax
.elseif umsg==WM_DESTROY
invoke DestroyMenu,hmenu
invoke DeleteObject,hpen1
invoke DeleteObject,hpen2
invoke PostQuitMessage,0
.elseif umsg==WM_CONTEXTMENU
invoke GetCursorPos,addr pos
invoke TrackPopupMenu,hmenu,0,pos.x,pos.y,0,hwnd,0
.elseif umsg==WM_KEYDOWN
;.if wparam==VK_F1 || wparam==VK_ESCAPE
invoke SendMessage,hwnd,WM_CONTEXTMENU,0,0
;.endif
.elseif umsg==WM_LBUTTONDOWN
invoke SendMessage,hwnd,WM_SYSCOMMAND,0F012H,0
.elseif umsg==WM_MOUSEWHEEL
mov eax,wparam
and eax,80000000H
.if eax==0
add opacity,20
.if opacity>255
mov opacity,255
.endif
.else
sub opacity,20
.if opacity<60
mov opacity,60
.endif
.endif
invoke SetLayeredWindowAttributes,hwnd,0,opacity,2
.elseif umsg==WM_COMMAND
mov eax,wparam
.if ax==1
mov toggle,1
not vertical
invoke DestroyWindow,hwnd
.elseif ax==2
invoke MessageBox,0,addr helptxt,offset bzName,0
.elseif ax==3
invoke DestroyWindow,hwnd
.endif
.elseif umsg==WM_PAINT
invoke BeginPaint,hwnd,addr ps
mov hdc,eax
invoke SetMapMode,hdc,MM_LOMETRIC
invoke GetClientRect,hwnd,addr rect
mov ecx,10
mov xcm,0
.if vertical==0
.while ecx<=10000
mov coord,ecx
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
invoke SelectObject,hdc,hpen1
mov hpen,eax
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke SelectObject,hdc,hpen2
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
invoke SelectObject,hdc,hpen1
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
add coord,10
invoke MoveToEx,hdc,coord,0,0
invoke LineTo,hdc,coord,-10000
invoke SelectObject,hdc,hpen
invoke wsprintf,addr buffer,offset bfhd,xcm
invoke lstrlen,addr buffer
sub coord,100
invoke TextOut,hdc,coord,-20,addr buffer,eax
inc xcm
add coord,100
mov ecx,coord
.endw
.else
.while ecx<=10000
mov coord,ecx
neg coord
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
invoke SelectObject,hdc,hpen1
mov hpen,eax
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke SelectObject,hdc,hpen2
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
invoke SelectObject,hdc,hpen1
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
sub coord,10
invoke MoveToEx,hdc,0,coord,0
invoke LineTo,hdc,10000,coord
invoke SelectObject,hdc,hpen
invoke wsprintf,addr buffer,offset bfhd,xcm
invoke lstrlen,addr buffer
add coord,110
invoke TextOut,hdc,30,coord,addr buffer,eax
inc xcm
sub coord,110
neg coord
mov ecx,coord
.endw
.endif
invoke EndPaint,hwnd,addr ps
.else
invoke DefWindowProc,hwnd,umsg,wparam,lparam
.endif
ret
WndProc endp
END START |
src/main/antlr4/io/tiler/internal/queries/grammar/Query.g4 | tiler-project/tiler | 1 | 2650 | <filename>src/main/antlr4/io/tiler/internal/queries/grammar/Query.g4
grammar Query;
query : fromClause
whereClause?
groupClause?
aggregateClause?
(metricSelectClause metricSortClause?)?
(pointSelectClause pointSortClause?)? ;
fromClause : FROM exprs+=metricExpr (',' exprs+=metricExpr)* ;
whereClause : WHERE expr ;
groupClause : GROUP fields+=ID (',' fields+=ID)* ;
aggregateClause : AGGREGATE namedExprs+=namedExpr (',' namedExprs+=namedExpr)* ;
pointSelectClause : POINT namedExprs+=namedExpr (',' namedExprs+=namedExpr)* ;
pointSortClause : SORT sortExprs+=sortExpr (',' sortExprs+=sortExpr)* ;
metricSelectClause : METRIC namedExprs+=namedExpr (',' namedExprs+=namedExpr)* ;
metricSortClause : SORT sortExprs+=sortExpr (',' sortExprs+=sortExpr)* ;
expr : ID # Field
| constant=(BOOLEAN | INTEGER | STRING | TIME_PERIOD | REGEX) # Constant
| func=ID '(' (exprs+=expr (',' exprs+=expr)*)? ')' # Func
| op=EXCLAMATION_MARK expr # UnaryOp
| expr op=(ASTERISK | FORWARD_SLASH) expr # BinaryOp
| expr op=(PLUS | MINUS) expr # BinaryOp
| expr op=(LESS_THAN | GREATER_THAN | LESS_THAN_OR_EQUALS | GREATER_THAN_OR_EQUALS) expr # BinaryOp
| expr op=(EQUALS | NOT_EQUALS) expr # BinaryOp
| expr op=REGEX_FIND expr # BinaryOp
| expr op=(AND | OR) expr # BinaryOp
| '(' expr ')' # Parentheses
;
metricExpr : ID
| REGEX ;
namedExpr : ID
| expr AS ID ;
sortExpr : expr sortDirection=(ASC | DESC)?;
FROM : 'from' ;
WHERE : 'where' ;
GROUP : 'group' ;
AGGREGATE : 'aggregate' ;
POINT : 'point' ;
METRIC : 'metric' ;
SORT : 'sort' ;
AS : 'as' ;
ASC : 'asc' ;
DESC : 'desc' ;
EXCLAMATION_MARK : '!' ;
ASTERISK : '*' ;
FORWARD_SLASH : '/' ;
PLUS : '+' ;
MINUS : '-' ;
LESS_THAN : '<' ;
GREATER_THAN : '>' ;
LESS_THAN_OR_EQUALS : '<=' ;
GREATER_THAN_OR_EQUALS : '>=' ;
EQUALS : '==' ;
NOT_EQUALS : '!=' ;
REGEX_FIND : '~=' ;
AND : '&&' ;
OR : '||' ;
BOOLEAN : ('true'|'false') ;
INTEGER : ('0'|[1-9][0-9]*|'-0'|'-'[1-9][0-9]*) ;
STRING : '\'' ('\\\''|~['])* '\''
| '"' ('\\"'|~["])* '"';
TIME_PERIOD : [1-9][0-9]*[usmhdw] ;
REGEX : '/' ('\\/'|~[/])* '/' [dixmsuU]* ;
ID : [a-zA-Z_] [a-zA-Z_\-0-9]* ('.' [a-zA-Z_] [a-zA-Z_\-0-9]*)* ;
WS : [ \t\r\n]+ -> skip ;
|
src/plfa/part1/AuxDefs.agda | abolotina/plfa.github.io | 0 | 10502 | module AuxDefs where
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
zero + n = n
(suc m) + n = suc (m + n)
data Bool : Set where
true : Bool
false : Bool
data Comparison : Set where
less : Comparison
equal : Comparison
greater : Comparison
_<_ : ℕ → ℕ → Bool
zero < y = true
suc x < zero = false
suc x < suc y = x < y
|
deBruijn/Substitution/Data/Application/Application221.agda | nad/dependently-typed-syntax | 5 | 4063 | <gh_stars>1-10
------------------------------------------------------------------------
-- Lemmas related to application of substitutions
------------------------------------------------------------------------
open import Data.Universe.Indexed
module deBruijn.Substitution.Data.Application.Application221
{i u e} {Uni : IndexedUniverse i u e}
where
import deBruijn.Context; open deBruijn.Context Uni
open import deBruijn.Substitution.Data.Application.Application21
open import deBruijn.Substitution.Data.Basics
open import deBruijn.Substitution.Data.Map
open import deBruijn.Substitution.Data.Simple
open import Function using (_$_)
open import Level using (_⊔_)
import Relation.Binary.PropositionalEquality as P
open P.≡-Reasoning
-- Lemmas related to application.
record Application₂₂₁
{t₁} {T₁ : Term-like t₁}
{t₂} {T₂ : Term-like t₂}
-- Simple substitutions for the first kind of terms.
(simple₁ : Simple T₁)
-- Simple substitutions for the second kind of terms.
(simple₂ : Simple T₂)
-- A translation from the first to the second kind of terms.
(trans : [ T₁ ⟶⁼ T₂ ])
: Set (i ⊔ u ⊔ e ⊔ t₁ ⊔ t₂) where
open Term-like T₂ using ([_]) renaming (_⊢_ to _⊢₂_; _≅-⊢_ to _≅-⊢₂_)
open Simple simple₁
using ()
renaming ( wk to wk₁; wk[_] to wk₁[_]; wk-subst to wk-subst₁
; _↑ to _↑₁; _↑_ to _↑₁_; _↑⁺_ to _↑⁺₁_; _↑⁺⋆_ to _↑⁺⋆₁_
)
open Simple simple₂
using ()
renaming ( var to var₂
; weaken to weaken₂; weaken[_] to weaken₂[_]
; wk[_] to wk₂[_]
; wk-subst to wk-subst₂; wk-subst[_] to wk-subst₂[_]
; _↑ to _↑₂
)
field
application₂₁ : Application₂₁ simple₁ simple₂ trans
open Application₂₁ application₂₁
field
-- Lifts equalities valid for all variables and liftings to
-- arbitrary terms.
var-/⊢⋆-↑⁺⋆-⇒-/⊢⋆-↑⁺⋆ :
∀ {Γ Δ} {ρ̂ : Γ ⇨̂ Δ} (ρs₁ : Subs T₁ ρ̂) (ρs₂ : Subs T₁ ρ̂) →
(∀ Γ⁺ {σ} (x : Γ ++⁺ Γ⁺ ∋ σ) →
var₂ · x /⊢⋆ ρs₁ ↑⁺⋆₁ Γ⁺ ≅-⊢₂ var₂ · x /⊢⋆ ρs₂ ↑⁺⋆₁ Γ⁺) →
∀ Γ⁺ {σ} (t : Γ ++⁺ Γ⁺ ⊢₂ σ) →
t /⊢⋆ ρs₁ ↑⁺⋆₁ Γ⁺ ≅-⊢₂ t /⊢⋆ ρs₂ ↑⁺⋆₁ Γ⁺
-- The wk substitution and the weaken function are equivalent.
/⊢-wk : ∀ {Γ σ τ} (t : Γ ⊢₂ τ) →
t /⊢ wk₁[ σ ] ≅-⊢₂ weaken₂[ σ ] · t
abstract
-- wk-subst is equivalent to composition with wk.
∘-wk : ∀ {Γ Δ σ} {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T₂ ρ̂) →
ρ ∘ wk₁[ σ ] ≅-⇨ wk-subst₂[ σ ] ρ
∘-wk ρ = begin
[ map (app wk₁) ρ ] ≡⟨ map-cong-ext₁ P.refl /⊢-wk (P.refl {x = [ ρ ]}) ⟩
[ map weaken₂ ρ ] ∎
-- The wk substitution commutes (modulo lifting etc.) with any
-- other.
--
-- TODO: Prove this lemma using /⊢-/⊢-wk?
wk-∘-↑ : ∀ {Γ Δ} σ {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T₁ ρ̂) →
map trans ρ ∘ wk₁[ σ / ρ ] ≅-⇨ wk₂[ σ ] ∘ ρ ↑₁
wk-∘-↑ σ ρ = extensionality P.refl λ x → begin
[ x /∋ map trans ρ ∘ wk₁ ] ≡⟨ /∋-cong (P.refl {x = [ x ]}) (∘-wk (map trans ρ)) ⟩
[ x /∋ wk-subst₂ (map trans ρ) ] ≡⟨ P.sym $ Simple.suc-/∋-↑ simple₂ σ x (map trans ρ) ⟩
[ suc[ σ ] x /∋ map trans ρ ↑₂ ] ≡⟨ /∋-cong (P.refl {x = [ suc[ σ ] x ]}) (P.sym $ map-trans-↑ ρ) ⟩
[ suc[ σ ] x /∋ map trans (ρ ↑₁) ] ≡⟨ /∋-map (suc[ σ ] x) trans (ρ ↑₁) ⟩
[ trans · (suc[ σ ] x /∋ ρ ↑₁) ] ≡⟨ P.sym $ var-/⊢ (suc[ σ ] x) (ρ ↑₁) ⟩
[ var₂ · suc[ σ ] x /⊢ ρ ↑₁ ] ≡⟨ /⊢-cong (P.sym $ Simple./∋-wk simple₂ {σ = σ} x) (P.refl {x = [ ρ ↑₁ ]}) ⟩
[ x /∋ wk₂[ σ ] /⊢ ρ ↑₁ ] ≡⟨ P.sym $ /∋-∘ x wk₂[ σ ] (ρ ↑₁) ⟩
[ x /∋ wk₂[ σ ] ∘ ρ ↑₁ ] ∎
-- A variant of suc-/∋-↑.
var-suc-/⊢-↑ :
∀ {Γ Δ} σ {τ} {ρ̂ : Γ ⇨̂ Δ} (x : Γ ∋ τ) (ρ : Sub T₁ ρ̂) →
var₂ · suc[ σ ] x /⊢ ρ ↑₁ ≅-⊢₂
var₂ · x /⊢ ρ /⊢ wk₁[ σ / ρ ]
var-suc-/⊢-↑ σ x ρ =
let lemma₁ = begin
[ x /∋ map trans ρ ] ≡⟨ /∋-map x trans ρ ⟩
[ trans · (x /∋ ρ) ] ≡⟨ P.sym $ var-/⊢ x ρ ⟩
[ var₂ · x /⊢ ρ ] ∎
lemma₂ = begin
[ map trans (wk-subst₁ ρ) ] ≡⟨ map-trans-wk-subst ρ ⟩
[ wk-subst₂ (map trans ρ) ] ≡⟨ P.sym $ ∘-wk (map trans ρ) ⟩
[ map trans ρ ∘ wk₁ ] ∎
in begin
[ var₂ · suc[ σ ] x /⊢ ρ ↑₁ ] ≡⟨ var-/⊢ (suc[ σ ] x) (ρ ↑₁) ⟩
[ trans · (suc[ σ ] x /∋ ρ ↑₁) ] ≡⟨ trans-cong (Simple.suc-/∋-↑ simple₁ σ x ρ) ⟩
[ trans · (x /∋ wk-subst₁ ρ) ] ≡⟨ P.sym $ /∋-map x trans (wk-subst₁ ρ) ⟩
[ x /∋ map trans (wk-subst₁ ρ) ] ≡⟨ /∋-cong (P.refl {x = [ x ]}) lemma₂ ⟩
[ x /∋ map trans ρ ∘ wk₁ ] ≡⟨ /∋-∘ x (map trans ρ) wk₁ ⟩
[ x /∋ map trans ρ /⊢ wk₁ ] ≡⟨ /⊢-cong lemma₁ (P.refl {x = [ wk₁ ]}) ⟩
[ var₂ · x /⊢ ρ /⊢ wk₁ ] ∎
private
-- wk ↑⁺ Γ⁺ and wk commute (more or less).
--
-- This lemma is an instance of /⊢-/⊢-wk, which is proved below
-- using, among other things, this lemma.
/⊢-wk-↑⁺-/⊢-wk :
∀ {Γ} σ Γ⁺ τ {υ} (t : Γ ++⁺ Γ⁺ ⊢₂ υ) →
let wk-σ = wk₁[ σ ] ↑⁺₁ Γ⁺ in
t /⊢ wk-σ /⊢ wk₁[ τ / wk-σ ] ≅-⊢₂
t /⊢ wk₁ /⊢ wk₁[ σ ] ↑⁺₁ (Γ⁺ ▻ τ)
/⊢-wk-↑⁺-/⊢-wk σ Γ⁺ τ t = var-/⊢⋆-↑⁺⋆-⇒-/⊢⋆-↑⁺⋆
(ε ▻ wk₁[ σ ] ↑⁺₁ Γ⁺ ▻ wk₁[ τ / wk₁ ↑⁺₁ Γ⁺ ])
(ε ▻ wk₁ ▻ wk₁ ↑⁺₁ (Γ⁺ ▻ τ))
(λ Γ⁺⁺ x → begin
[ var₂ · x /⊢⋆ (ε ▻ wk₁ ↑⁺₁ Γ⁺ ▻ wk₁) ↑⁺⋆₁ Γ⁺⁺ ] ≡⟨ /⊢⋆-ε-▻-▻-↑⁺⋆ Γ⁺⁺ (var₂ · x) (wk₁ ↑⁺₁ Γ⁺) wk₁ ⟩
[ var₂ · x /⊢ wk₁ ↑⁺₁ Γ⁺ ↑⁺₁ Γ⁺⁺ /⊢
wk₁ ↑⁺₁ (Γ⁺⁺ /⁺ wk₁ ↑⁺₁ Γ⁺) ] ≡⟨ /⊢-cong (var-/⊢-wk-↑⁺-↑⁺ Γ⁺ Γ⁺⁺ x) P.refl ⟩
[ var₂ · (lift (lift weaken∋ Γ⁺) Γ⁺⁺ · x) /⊢
wk₁ ↑⁺₁ (Γ⁺⁺ /⁺ wk₁ ↑⁺₁ Γ⁺) ] ≡⟨ var-/⊢-wk-↑⁺ (Γ⁺⁺ /⁺ wk₁ ↑⁺₁ Γ⁺)
(lift (lift weaken∋ Γ⁺) Γ⁺⁺ · x) ⟩
[ var₂ · (lift weaken∋ (Γ⁺⁺ /⁺ wk₁ ↑⁺₁ Γ⁺) ·
(lift (lift weaken∋ Γ⁺) Γ⁺⁺ · x)) ] ≡⟨ Simple.var-cong simple₂
(lift-weaken∋-lift-lift-weaken∋ σ Γ⁺ τ Γ⁺⁺ x) ⟩
[ var₂ · (lift (lift weaken∋ (Γ⁺ ▻ τ)) (Γ⁺⁺ /⁺ wk₁) ·
(lift weaken∋ Γ⁺⁺ · x)) ] ≡⟨ P.sym $ var-/⊢-wk-↑⁺-↑⁺ (Γ⁺ ▻ τ) (Γ⁺⁺ /⁺ wk₁)
(lift weaken∋ Γ⁺⁺ · x) ⟩
[ var₂ · (lift weaken∋ Γ⁺⁺ · x) /⊢
wk₁[ σ ] ↑⁺₁ (Γ⁺ ▻ τ) ↑⁺₁ (Γ⁺⁺ /⁺ wk₁) ] ≡⟨ P.sym $ /⊢-cong (var-/⊢-wk-↑⁺ Γ⁺⁺ x) P.refl ⟩
[ var₂ · x /⊢ wk₁ ↑⁺₁ Γ⁺⁺ /⊢
wk₁[ σ ] ↑⁺₁ (Γ⁺ ▻ τ) ↑⁺₁ (Γ⁺⁺ /⁺ wk₁) ] ≡⟨ P.sym $ /⊢⋆-ε-▻-▻-↑⁺⋆ Γ⁺⁺ (var₂ · x) wk₁
(wk₁[ σ ] ↑⁺₁ (Γ⁺ ▻ τ)) ⟩
[ var₂ · x /⊢⋆ (ε ▻ wk₁ ▻ wk₁[ σ ] ↑⁺₁ (Γ⁺ ▻ τ)) ↑⁺⋆₁ Γ⁺⁺ ] ∎)
ε t
-- Another lemma used in the proof of /⊢-/⊢-wk.
var-/⊢-↑⁺-/⊢-wk-↑⁺ :
∀ {Γ Δ} σ {ρ̂ : Γ ⇨̂ Δ} (ρ : Sub T₁ ρ̂) Γ⁺ {υ} (x : Γ ++⁺ Γ⁺ ∋ υ) →
var₂ · x /⊢ ρ ↑⁺₁ Γ⁺ /⊢ wk₁[ σ / ρ ] ↑⁺₁ (Γ⁺ /⁺ ρ) ≅-⊢₂
var₂ · (lift weaken∋[ σ ] Γ⁺ · x) /⊢ ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁)
var-/⊢-↑⁺-/⊢-wk-↑⁺ σ ρ ε x = P.sym $ var-suc-/⊢-↑ σ x ρ
var-/⊢-↑⁺-/⊢-wk-↑⁺ σ ρ (Γ⁺ ▻ τ) zero = begin
[ var₂ · zero /⊢ ρ ↑⁺₁ (Γ⁺ ▻ τ) /⊢ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ] ≡⟨ /⊢-cong (zero-/⊢-↑ τ (ρ ↑⁺₁ Γ⁺))
(P.refl {x = [ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ]}) ⟩
[ var₂ · zero /⊢ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ] ≡⟨ zero-/⊢-↑ (τ / ρ ↑⁺₁ Γ⁺) (wk₁ ↑⁺₁ (Γ⁺ /⁺ ρ)) ⟩
[ var₂ · zero ] ≡⟨ Simple.var-cong simple₂
(zero-cong (/̂-↑̂⁺-/̂-ŵk-↑̂⁺ σ ⟦ ρ ⟧⇨ Γ⁺ τ)) ⟩
[ var₂ · zero ] ≡⟨ P.sym $ zero-/⊢-↑ (τ / wk₁ ↑⁺₁ Γ⁺)
(ρ ↑₁ σ ↑⁺₁ (Γ⁺ /⁺ wk₁)) ⟩
[ var₂ · zero /⊢ ρ ↑₁ σ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ wk₁) ] ∎
var-/⊢-↑⁺-/⊢-wk-↑⁺ σ ρ (Γ⁺ ▻ τ) (suc x) = begin
[ var₂ · suc x /⊢ ρ ↑⁺₁ (Γ⁺ ▻ τ) /⊢ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ] ≡⟨ /⊢-cong (var-suc-/⊢-↑ τ x (ρ ↑⁺₁ Γ⁺))
(P.refl {x = [ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ]}) ⟩
[ var₂ · x /⊢ ρ ↑⁺₁ Γ⁺ /⊢ wk₁ /⊢ wk₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ ρ) ] ≡⟨ P.sym $ /⊢-wk-↑⁺-/⊢-wk (σ / ρ) (Γ⁺ /⁺ ρ) (τ / ρ ↑⁺₁ Γ⁺)
(var₂ · x /⊢ ρ ↑⁺₁ Γ⁺) ⟩
[ var₂ · x /⊢ ρ ↑⁺₁ Γ⁺ /⊢ wk₁[ σ / ρ ] ↑⁺₁ (Γ⁺ /⁺ ρ)
/⊢ wk₁[ τ / ρ ↑⁺₁ Γ⁺ / wk₁ ↑⁺₁ (Γ⁺ /⁺ ρ) ] ] ≡⟨ /⊢-cong
(var-/⊢-↑⁺-/⊢-wk-↑⁺ σ ρ Γ⁺ x)
(Simple.wk-cong simple₁ (/̂-↑̂⁺-/̂-ŵk-↑̂⁺ σ ⟦ ρ ⟧⇨ Γ⁺ τ)) ⟩
[ var₂ · (lift weaken∋[ σ ] Γ⁺ · x) /⊢
ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁) /⊢ wk₁ ] ≡⟨ P.sym $ var-suc-/⊢-↑ (τ / wk₁ ↑⁺₁ Γ⁺)
(lift weaken∋[ σ ] Γ⁺ · x)
(ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁)) ⟩
[ var₂ · suc (lift weaken∋[ σ ] Γ⁺ · x) /⊢
ρ ↑₁ ↑⁺₁ ((Γ⁺ ▻ τ) /⁺ wk₁) ] ∎
-- The wk substitution commutes (modulo lifting etc.) with any
-- other.
/⊢-/⊢-wk : ∀ {Γ Δ} σ {τ} {ρ̂ : Γ ⇨̂ Δ} (t : Γ ⊢₂ τ) (ρ : Sub T₁ ρ̂) →
t /⊢ ρ /⊢ wk₁[ σ / ρ ] ≅-⊢₂ t /⊢ wk₁[ σ ] /⊢ ρ ↑₁
/⊢-/⊢-wk σ t ρ = var-/⊢⋆-↑⁺⋆-⇒-/⊢⋆-↑⁺⋆
(ε ▻ ρ ▻ wk₁)
(ε ▻ wk₁[ σ ] ▻ ρ ↑₁)
(λ Γ⁺ x → begin
[ var₂ · x /⊢⋆ (ε ▻ ρ ▻ wk₁) ↑⁺⋆₁ Γ⁺ ] ≡⟨ /⊢⋆-ε-▻-▻-↑⁺⋆ Γ⁺ (var₂ · x) ρ wk₁ ⟩
[ var₂ · x /⊢ ρ ↑⁺₁ Γ⁺ /⊢ wk₁ ↑⁺₁ (Γ⁺ /⁺ ρ) ] ≡⟨ var-/⊢-↑⁺-/⊢-wk-↑⁺ σ ρ Γ⁺ x ⟩
[ var₂ · (lift weaken∋[ σ ] Γ⁺ · x) /⊢ ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁) ] ≡⟨ /⊢-cong (P.sym $ var-/⊢-wk-↑⁺ {σ = σ} Γ⁺ x)
(P.refl {x = [ ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁) ]}) ⟩
[ var₂ · x /⊢ wk₁[ σ ] ↑⁺₁ Γ⁺ /⊢ ρ ↑₁ ↑⁺₁ (Γ⁺ /⁺ wk₁) ] ≡⟨ P.sym $ /⊢⋆-ε-▻-▻-↑⁺⋆ Γ⁺ (var₂ · x) wk₁[ σ ] (ρ ↑₁) ⟩
[ var₂ · x /⊢⋆ (ε ▻ wk₁[ σ ] ▻ ρ ↑₁) ↑⁺⋆₁ Γ⁺ ] ∎) ε t
open Application₂₁ application₂₁ public
|
test/Succeed/Issue3167prop.agda | cruhland/agda | 1,989 | 3944 | -- Andreas, 2018-09-12, issue #3167-2: --(no-)prop option
--
-- A local --prop option should override a global --no-prop flag.
-- Issue3167prop.flags has --no-prop.
{-# OPTIONS --prop #-}
-- The following depends on Prop enabled
data _≡_ {a} {A : Prop a} (x : A) : A → Prop a where
refl : x ≡ x
data P : Prop where
a b : P
test : (x y : P) → x ≡ y
test x y = refl
|
setoid-cats/Category/CategoryCons.agda | heades/AUGL | 0 | 1842 | <reponame>heades/AUGL<gh_stars>0
----------------------------------------------------------------------
-- This file contains constructions of new categories from existing --
-- categories. --
----------------------------------------------------------------------
module Category.CategoryCons where
open import Level
open import Data.Product
open import Setoid.Total
open import Category.Category
open SetoidFun
-- The product of two categories.
_●_ : {l₁ l₂ : Level} → (ℂ₁ : Cat {l₁}) → (ℂ₂ : Cat {l₂}) → Cat {l₁ ⊔ l₂}
ℂ₁ ● ℂ₂ = record {
Obj = (Obj ℂ₁) × (Obj ℂ₂);
Hom = λ A B → (Hom ℂ₁ (proj₁ A) (proj₁ B)) ●ₛ ((Hom ℂ₂ (proj₂ A) (proj₂ B)));
comp = λ {A} {B} {C} → (comp ℂ₁) ●b (comp ℂ₂);
id = λ {A} → (id ℂ₁) , (id ℂ₂);
assocPf = λ {A} {B} {C} {D} {f} {g} {h} → (assocPf ℂ₁) , (assocPf ℂ₂);
idPf = λ {A} {B} {f} → (idPf ℂ₁) , (idPf ℂ₂) }
|
data/mapHeaders/Route16Gate1F.asm | AmateurPanda92/pokemon-rby-dx | 9 | 20854 | <gh_stars>1-10
Route16Gate1F_h:
db GATE ; tileset
db ROUTE_16_GATE_1F_HEIGHT, ROUTE_16_GATE_1F_WIDTH ; dimensions (y, x)
dw Route16Gate1F_Blocks ; blocks
dw Route16Gate1F_TextPointers ; texts
dw Route16Gate1F_Script ; scripts
db 0 ; connections
dw Route16Gate1F_Object ; objects
|
ctfft.adb | adrianhoe/adactfft | 0 | 28757 | --------------------------------------------------------------------------------
-- * Body name ctfft.adb
-- * Project name ctffttest
-- *
-- * Version 1.0
-- * Last update 11/5/08
-- *
-- * Created by <NAME> on 11/5/08.
-- * Copyright (c) 2008 AdaStar Informatics http://adastarinformatics.com
-- * All rights reserved.
-- *
--------------------------------------------------------------------------------
with Ada.Text_Io, Ada.Integer_Text_Io;
use Ada.Text_Io, Ada.Integer_Text_Io;
with Ada.Numerics, Ada.Numerics.Generic_Elementary_Functions;
use Ada.Numerics;
with Vector;
use Vector, Vector.Complex_Types;
package body Ctfft is
package Math is new Ada.Numerics.Generic_Elementary_Functions (Real_Number);
use Math;
Two_Pi : constant := 2.0 * Pi;
procedure Swap (A, B : in out Complex_Number) is
T : Complex_Number;
begin
T := A;
A := B;
B := T;
end Swap;
procedure Scramble (Xc : in out Complex_Vector_Type) is
N, J, K : Integer;
begin
N := Xc'Length;
J := 1;
for I in 1 .. N - 1 loop
if I < J then
Put (I); Put (","); Put (J);
New_Line;
Swap (Xc (I), Xc (J));
end if;
K := N / 2;
while K < J loop
J := J - K;
K := K / 2;
end loop;
J := J + K;
end loop;
end Scramble;
procedure Compute_Fft (Xc : in out Complex_Vector_Type) is
M, N, I : Integer;
Xt, ω : Complex_Number;
φ : Real_Number;
begin
N := Xc'Length;
M := 1;
Put_Line (" M J I I+M");
Put_Line ("---------- ------------ ----------- -----------");
while M < N loop
for J in 1 .. M loop
φ := Two_Pi * Real_Number (J - 1) / Real_Number (2 * M);
ω := (Cos (φ), -Sin (φ));
I := J;
while I < N loop
Put (M); Put (","); Put (J); Put (","); Put (I); Put (","); Put (I + M);
New_Line;
Xt := Xc (I + M) * ω;
Xc (I + M) := Xc (I) - Xt;
Xc (I) := Xc (I) + Xt;
I := I + M * 2;
end loop;
end loop;
M := M * 2;
end loop;
end Compute_Fft;
procedure Fft (X : in out Real_Vector_Type) is
Xc : Complex_Vector_Type (X'Range);
R : constant Complex_Number := (1.0, 0.0);
begin
for I in X'Range loop
Xc (I) := R * X (I);
end loop;
Scramble (Xc);
Compute_Fft (Xc);
for I in X'Range loop
X (I) := abs Xc (I);
end loop;
end Fft;
end Ctfft;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_231_601.asm | ljhsiun2/medusa | 9 | 88640 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %rbp
// Faulty Load
lea addresses_RW+0x5f62, %r14
nop
nop
nop
nop
nop
add $34245, %rbp
mov (%r14), %r15
lea oracles, %r14
and $0xff, %r15
shlq $12, %r15
mov (%r14,%r15,1), %r15
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'32': 231}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
src/instruction-test/io.asm | brgmnn/uob-cpu-simulator | 0 | 89916 | <reponame>brgmnn/uob-cpu-simulator
# basic file io
mov r0,#20
io.read r0
io.read q0
io.write r0
io.putc #10
io.putc #104
io.putc #101
io.putc #108
io.putc #108
io.putc #111 |
src/Line_Array/src/line_arrays-regexp_classifiers.adb | fintatarta/eugen | 0 | 30450 | <filename>src/Line_Array/src/line_arrays-regexp_classifiers.adb
pragma Ada_2012;
package body Line_Arrays.Regexp_Classifiers is
---------
-- Add --
---------
procedure Add (To : in out Classifier_Type;
Regexp : String;
Callback : Callback_Type)
is
Matcher : constant Gnat.Regpat.Pattern_Matcher := Gnat.Regpat.Compile (Regexp);
begin
To.Exprs.Append (New_Item => Regexp_Descriptor'(Size => Matcher.Size,
Matcher => Matcher,
Callback => Callback));
end Add;
-----------------
-- Add_Default --
-----------------
procedure Add_Default
(To : in out Classifier_Type; Callback : Callback_Type)
is
begin
if To.Default /= null then
raise Double_Default;
end if;
To.Default := Callback;
end Add_Default;
------------
-- Create --
------------
function Create (Regexps : Regexp_Array) return Classifier_Type
is
Result : Classifier_Type;
begin
for R of Regexps loop
if Is_Default (R) then
Result.Add_Default (R.Callback);
else
Result.Add (Regexp => To_String (R.Regexp),
Callback => R.Callback);
end if;
end loop;
return Result;
end Create;
--------------
-- Classify --
--------------
function Classify
(Classifier : Classifier_Type; Line : String) return Classified_Line
is
use Gnat.Regpat;
begin
for Regexp of Classifier.Exprs loop
declare
Matched : Match_Array (0 .. Paren_Count (Regexp.Matcher));
begin
Gnat.Regpat.Match (Self => Regexp.Matcher,
Data => Line,
Matches => Matched);
if Matched (0) /= No_Match then
return Regexp.Callback (Line, Matched);
end if;
end;
end loop;
if Classifier.Default = null then
raise Constraint_Error;
else
declare
Matched : constant Match_Array (0 .. 0) :=
(0 => Match_Location'(First => Line'First,
Last => Line'Last));
begin
return Classifier.Default (Line, Matched);
end;
end if;
end Classify;
end Line_Arrays.Regexp_Classifiers;
|
alloy4fun_models/trainstlt/models/10/jAwPgEKuT2KaGjseH.als | Kaixi26/org.alloytools.alloy | 0 | 697 | <filename>alloy4fun_models/trainstlt/models/10/jAwPgEKuT2KaGjseH.als
open main
pred idjAwPgEKuT2KaGjseH_prop11 {
always (all t:pos.Track | once (t.pos in Entry))
}
pred __repair { idjAwPgEKuT2KaGjseH_prop11 }
check __repair { idjAwPgEKuT2KaGjseH_prop11 <=> prop11o } |
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1885.asm | ljhsiun2/medusa | 9 | 172679 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x19fd5, %rsi
nop
cmp %r10, %r10
movw $0x6162, (%rsi)
nop
nop
nop
add $43850, %rbx
lea addresses_WT_ht+0x1493d, %r11
nop
nop
nop
nop
nop
xor $33216, %r10
movb (%r11), %cl
nop
nop
nop
xor $37793, %rcx
lea addresses_D_ht+0x197d5, %r15
xor %rbp, %rbp
movups (%r15), %xmm5
vpextrq $0, %xmm5, %r11
nop
nop
and %rsi, %rsi
lea addresses_normal_ht+0x8501, %rsi
lea addresses_UC_ht+0xf7f8, %rdi
nop
nop
nop
nop
sub $4708, %rbx
mov $42, %rcx
rep movsb
nop
nop
nop
and %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
// Store
lea addresses_WC+0x8065, %r12
xor $30199, %rbp
movw $0x5152, (%r12)
nop
nop
nop
nop
nop
xor $43263, %r13
// Store
lea addresses_WC+0x1106, %r12
nop
and %r15, %r15
mov $0x5152535455565758, %rax
movq %rax, (%r12)
nop
nop
nop
nop
nop
dec %r12
// Load
lea addresses_D+0x1a6f5, %r13
nop
nop
nop
add $43573, %rcx
movb (%r13), %r12b
nop
nop
nop
nop
dec %rax
// Faulty Load
lea addresses_WC+0xad5, %r15
nop
nop
sub $40586, %rdi
movups (%r15), %xmm4
vpextrq $1, %xmm4, %r13
lea oracles, %rcx
and $0xff, %r13
shlq $12, %r13
mov (%rcx,%r13,1), %r13
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/026/A026041.asm | karttu/loda | 1 | 88994 | ; A026041: a(n) = d(n)/2, where d = A026040.
; 12,20,32,49,72,102,140,187,244,312,392,485,592,714,852,1007,1180,1372,1584,1817,2072,2350,2652,2979,3332,3712,4120,4557,5024,5522,6052,6615,7212,7844,8512,9217,9960,10742,11564,12427,13332,14280,15272,16309,17392,18522,19700,20927,22204,23532,24912,26345,27832,29374,30972,32627,34340,36112,37944,39837,41792,43810,45892,48039,50252,52532,54880,57297,59784,62342,64972,67675,70452,73304,76232,79237,82320,85482,88724,92047,95452,98940,102512,106169,109912,113742,117660,121667,125764,129952,134232,138605,143072,147634,152292,157047,161900,166852,171904,177057,182312,187670,193132,198699,204372,210152,216040,222037,228144,234362,240692,247135,253692,260364,267152,274057,281080,288222,295484,302867,310372,318000,325752,333629,341632,349762,358020,366407,374924,383572,392352,401265,410312,419494,428812,438267,447860,457592,467464,477477,487632,497930,508372,518959,529692,540572,551600,562777,574104,585582,597212,608995,620932,633024,645272,657677,670240,682962,695844,708887,722092,735460,748992,762689,776552,790582,804780,819147,833684,848392,863272,878325,893552,908954,924532,940287,956220,972332,988624,1005097,1021752,1038590,1055612,1072819,1090212,1107792,1125560,1143517,1161664,1180002,1198532,1217255,1236172,1255284,1274592,1294097,1313800,1333702,1353804,1374107,1394612,1415320,1436232,1457349,1478672,1500202,1521940,1543887,1566044,1588412,1610992,1633785,1656792,1680014,1703452,1727107,1750980,1775072,1799384,1823917,1848672,1873650,1898852,1924279,1949932,1975812,2001920,2028257,2054824,2081622,2108652,2135915,2163412,2191144,2219112,2247317,2275760,2304442,2333364,2362527,2391932,2421580,2451472,2481609,2511992,2542622,2573500,2604627,2636004,2667632
add $0,4
mov $1,$0
bin $1,3
add $1,$0
add $1,$0
|
oeis/265/A265802.asm | neoneye/loda-programs | 11 | 162980 | ; A265802: Coefficient of x^2 in minimal polynomial of the continued fraction [1^n,4,1,1,1,...], where 1^n means n ones.
; Submitted by <NAME>(s2)
; 1,11,19,59,145,389,1009,2651,6931,18155,47521,124421,325729,852779,2232595,5845019,15302449,40062341,104884561,274591355,718889491,1882077131,4927341889,12899948549,33772503745,88417562699,231480184339,606022990331,1586588786641,4153743369605,10874641322161,28470180596891,74535900468499,195137520808619,510876661957345,1337492465063429,3501600733232929,9167309734635371,24000328470673171,62833675677384155,164500698561479281,430668420007053701,1127504561459681809,2951845264371991739
mov $3,3
lpb $0
sub $0,1
add $1,1
add $2,$3
add $3,$2
mov $4,$1
mov $1,$3
sub $1,$4
lpe
mov $0,$1
mul $0,2
add $0,1
|
smsq/qxl/nd.asm | olifink/smsqe | 0 | 173974 | <reponame>olifink/smsqe<gh_stars>0
; SMS2 QXL card ND drivers
section header
xref smsq_end
header_base
dc.l nd_base-header_base ; length of header
dc.l 0 ; module length unknown
dc.l smsq_end-nd_base ; loaded length
dc.l 0 ; checksum
dc.l 0 ; always select
dc.b 1 ; 1 level down
dc.b 0
dc.w smsq_name-*
smsq_name
dc.w 20,'SMSQ QXL Net Driver '
dc.l ' '
dc.w $200a
section base
xref nd_qxl
nd_base
jmp nd_qxl
end
|
libsrc/debug/z80rabbit.asm | grancier/z180 | 0 | 18290 | ; *
; * General Z80 debugging functions
; *
; * Stefano 25/6/2009
; *
; * TRUE if we're running on a rabbit.
; * extern int __LIB__ z80rabbit(void);
; *
; * $Id: z80rabbit.asm,v 1.3 2016/03/06 21:45:13 dom Exp $
; *
SECTION code_clib
PUBLIC z80rabbit
PUBLIC _z80rabbit
z80rabbit:
_z80rabbit:
ld hl,0
ld de,1
push de
defb $ed
defb $54 ; ex (sp),hl ONLY IF we're on a Rabbic Control Module
nop ; this could help z80 clones not to hurt too much
nop
pop de
ret
|
src/generated/console_drawing_h.ads | csb6/libtcod-ada | 0 | 5400 | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with console_h;
with Interfaces.C.Extensions;
limited with color_h;
with error_h;
package console_drawing_h is
-- BSD 3-Clause License
-- *
-- * Copyright © 2008-2021, Jice and the libtcod contributors.
-- * 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 the copyright holder nor the names of its
-- * contributors may be used to endorse or promote products derived from
-- * this software without specific prior written permission.
-- *
-- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- * POSSIBILITY OF SUCH DAMAGE.
--
--*
-- * Draw a rectangle onto a console.
-- *
-- * \param con A console pointer.
-- * \param x The starting region, the left-most position being 0.
-- * \param y The starting region, the top-most position being 0.
-- * \param rw The width of the rectangle.
-- * \param rh The height of the rectangle.
-- * \param clear If true the drawing region will be filled with spaces.
-- * \param flag The blending flag to use.
--
procedure TCOD_console_rect
(con : access console_h.TCOD_Console;
x : int;
y : int;
w : int;
h : int;
clear : Extensions.bool;
flag : console_h.TCOD_bkgnd_flag_t) -- console_drawing.h:50
with Import => True,
Convention => C,
External_Name => "TCOD_console_rect";
--*
-- * Draw a horizontal line using the default colors.
-- *
-- * \param con A console pointer.
-- * \param x The starting X coordinate, the left-most position being 0.
-- * \param y The starting Y coordinate, the top-most position being 0.
-- * \param l The width of the line.
-- * \param flag The blending flag.
-- *
-- * This function makes assumptions about the fonts character encoding.
-- * It will fail if the font encoding is not `cp437`.
--
procedure TCOD_console_hline
(con : access console_h.TCOD_Console;
x : int;
y : int;
l : int;
flag : console_h.TCOD_bkgnd_flag_t) -- console_drawing.h:63
with Import => True,
Convention => C,
External_Name => "TCOD_console_hline";
--*
-- * Draw a vertical line using the default colors.
-- *
-- * \param con A console pointer.
-- * \param x The starting X coordinate, the left-most position being 0.
-- * \param y The starting Y coordinate, the top-most position being 0.
-- * \param l The height of the line.
-- * \param flag The blending flag.
-- *
-- * This function makes assumptions about the fonts character encoding.
-- * It will fail if the font encoding is not `cp437`.
--
procedure TCOD_console_vline
(con : access console_h.TCOD_Console;
x : int;
y : int;
l : int;
flag : console_h.TCOD_bkgnd_flag_t) -- console_drawing.h:76
with Import => True,
Convention => C,
External_Name => "TCOD_console_vline";
-- Next functions are provisional unless given an added version.
--*
-- * Place a single tile on a `console` at `x`,`y`.
-- *
-- * If `ch` is 0 then the character code will not be updated.
-- *
-- * If `fg`,`bg` is NULL then their respective colors will not be updated.
--
-- procedure TCOD_console_put_rgb
-- (console : access console_h.TCOD_Console;
-- x : int;
-- y : int;
-- ch : int;
-- fg : access constant color_h.TCOD_color_t;
-- bg : access constant color_h.TCOD_color_t;
-- flag : console_h.TCOD_bkgnd_flag_t) -- console_drawing.h:85
-- with Import => True,
-- Convention => C,
-- External_Name => "TCOD_console_put_rgb";
--*
-- * Draw a rectangle on a `console` with a shape of `x`,`y`,`width`,`height`.
-- *
-- * If `ch` is 0 then the character code will not be updated.
-- *
-- * If `fg`,`bg` is NULL then their respective colors will not be updated.
--
-- procedure TCOD_console_draw_rect_rgb
-- (console : access console_h.TCOD_Console;
-- x : int;
-- y : int;
-- width : int;
-- height : int;
-- ch : int;
-- fg : access constant color_h.TCOD_color_t;
-- bg : access constant color_h.TCOD_color_t;
-- flag : console_h.TCOD_bkgnd_flag_t) -- console_drawing.h:100
-- with Import => True,
-- Convention => C,
-- External_Name => "TCOD_console_draw_rect_rgb";
--*
-- Draw a decorated frame onto `console` with the shape of `x`, `y`, `width`,
-- `height`.
-- `decoration[9]` is an optional array of Unicode codepoints. If left as
-- NULL then a single-pipe decoration is used by default.
-- If `decoration[9]` is given the codepoints are used for the edges, corners,
-- and fill of the frame in this order:
-- 0 1 2
-- 3 4 5
-- 6 7 8
-- If `fg` or `bg` is NULL then their respective colors will not be updated.
-- If `clear` is true then the inner area of the frame is filled with the
-- inner decoraction, which is typically space.
--
function TCOD_console_draw_frame_rgb
(con : access console_h.TCOD_Console;
x : int;
y : int;
width : int;
height : int;
decoration : access int;
fg : access constant color_h.TCOD_ColorRGB;
bg : access constant color_h.TCOD_ColorRGB;
flag : console_h.TCOD_bkgnd_flag_t;
clear : Extensions.bool) return error_h.TCOD_Error -- console_drawing.h:129
with Import => True,
Convention => C,
External_Name => "TCOD_console_draw_frame_rgb";
-- extern "C"
end console_drawing_h;
|
cards/bn5/ItemCards/136-E013 Atsuki's Festival of Flames.asm | RockmanEXEZone/MMBN-Mod-Card-Kit | 10 | 96078 | <reponame>RockmanEXEZone/MMBN-Mod-Card-Kit<filename>cards/bn5/ItemCards/136-E013 Atsuki's Festival of Flames.asm
.include "defaults_item.asm"
table_file_jp equ "exe5-utf8.tbl"
table_file_en equ "bn5-utf8.tbl"
game_code_len equ 3
game_code equ 0x4252424A // BRBJ
game_code_2 equ 0x42524245 // BRBE
game_code_3 equ 0x42524250 // BRBP
card_type equ 0
card_id equ 13
card_no equ "013"
card_sub equ "Item Card 013"
card_sub_x equ 62
card_desc_len equ 2
card_desc_1 equ "Atsuki's Festival"
card_desc_2 equ "of Flames"
card_desc_3 equ ""
card_name_jp_full equ "火村アツキのメラメラ祭り"
card_name_jp_game equ "ひむらアツキのメラメラまつり"
card_name_en_full equ "Atsuki's Festival of Flames"
card_name_en_game equ "Atsuki's Festival of Flames"
card_game_desc_jp_len equ 3
card_game_desc_jp_1 equ "ひむらアツキのメラメラまつり!"
card_game_desc_jp_2 equ "ブラックボムZ、"
card_game_desc_jp_3 equ "メテオアース1T、",0xE7,0x00,0xF2,"カキゲンキン*を手に入れた!"
card_game_desc_en_len equ 3
card_game_desc_en_1 equ "Atsuki's Festival of"
card_game_desc_en_2 equ "Flames! Got BlkBomb Z,"
card_game_desc_en_3 equ "Astroid1 T & AntiFire *!" |
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_31_1863.asm | ljhsiun2/medusa | 9 | 96095 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_31_1863.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x865c, %r10
nop
nop
nop
nop
nop
and %rdx, %rdx
movw $0x6162, (%r10)
nop
nop
sub %rdi, %rdi
lea addresses_WC_ht+0x192d4, %rsi
lea addresses_D_ht+0x17a5c, %rdi
sub $36697, %rbx
mov $38, %rcx
rep movsb
nop
and %rcx, %rcx
lea addresses_A_ht+0x173dc, %rdi
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, (%rdi)
nop
and $42617, %r14
lea addresses_normal_ht+0x7eec, %rsi
lea addresses_WT_ht+0x1c4dc, %rdi
clflush (%rsi)
clflush (%rdi)
dec %rax
mov $103, %rcx
rep movsb
nop
nop
and $28777, %rsi
lea addresses_normal_ht+0x165fc, %rsi
lea addresses_WC_ht+0x1ca5c, %rdi
clflush (%rsi)
nop
nop
nop
cmp $33017, %r10
mov $64, %rcx
rep movsb
add $35125, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x1baac, %rsi
lea addresses_US+0x1825c, %rdi
nop
sub $64123, %r13
mov $107, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp %rbp, %rbp
// Faulty Load
lea addresses_D+0x1fa5c, %r13
nop
nop
add $13486, %r11
vmovups (%r13), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_US', 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'36': 31}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
programs/oeis/131/A131242.asm | neoneye/loda | 22 | 23701 | ; A131242: Partial sums of A059995: a(n) = sum_{k=0..n} floor(k/10).
; 0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,30,33,36,39,42,45,48,51,54,57,60,64,68,72,76,80,84,88,92,96,100,105,110,115,120,125,130,135,140,145,150,156,162,168,174,180,186,192,198,204,210,217,224,231,238,245,252,259,266,273,280,288,296,304,312,320,328,336,344,352,360,369,378,387,396,405,414,423,432,441,450
add $0,1
lpb $0
sub $0,10
add $1,$0
lpe
mov $0,$1
|
list4/task1/src/railway.ads | luk9400/nsi | 0 | 14798 | package Railway with SPARK_Mode is
type One_Signal_State is (Red, Green);
type Route_Type is (Route_Left_Middle,
Route_Middle_Right,
Route_Right_Middle,
Route_Middle_Left,
Route_Enter_Left,
Route_Leave_Right,
Route_Enter_Right,
Route_Leave_Left);
type One_Segment_State is (Occupied_Standing,
Occupied_Moving_Left,
Occupied_Moving_Right,
Reserved_Moving_From_Left,
Reserved_Moving_From_Right,
Free);
type Segment_State_Type is
record
Left,
Middle,
Right : One_Segment_State;
end record;
type Signal_State_Type is
record
Left_Middle,
Middle_Left,
Middle_Right,
Right_Middle: One_Signal_State;
end record;
Segment_State : Segment_State_Type := (others => Free);
Signal_State : Signal_State_Type := (others => Green);
function Correct_Signals return Boolean
is
(
(if Signal_State.Left_Middle = Green then
Segment_State.Left = Occupied_Moving_Right and
Segment_State.Middle = Reserved_Moving_From_Left) and then
(if Signal_state.Middle_Left = Green then
Segment_State.Middle = Occupied_Moving_Left and
Segment_State.Left = Reserved_Moving_From_Right) and then
(if Signal_state.Middle_Right = Green then
Segment_State.Middle = Occupied_Moving_Right and
Segment_State.Right = Reserved_Moving_From_Left) and then
(if Signal_state.Right_Middle = Green then
Segment_State.Right = Occupied_Moving_Left and
Segment_State.Middle = Reserved_Moving_From_Right));
function Correct_Segments return Boolean
is
(
(if Segment_State.Left /= Reserved_Moving_From_Right then
Signal_State.Middle_Left = Red) and
(if Segment_State.Middle /= Reserved_Moving_From_Left then
Signal_State.Left_Middle = Red) and
(if Segment_State.Middle /= Reserved_Moving_From_Right then
Signal_State.Right_Middle = Red) and
(if Segment_State.Right /= Reserved_Moving_From_Left then
Signal_State.Middle_Right = Red));
procedure Open_Route (Route: in Route_Type; Success: out Boolean)
with
Pre => Correct_Signals and Correct_Segments,
Global => (In_Out => (Segment_State, Signal_State)),
Depends => ((Segment_State, Success) => (Route, Segment_State),
Signal_State => (Segment_State, Route, Signal_State)),
Post => Correct_Signals and Correct_Segments;
procedure Move_Train (Route: in Route_Type; Success: out Boolean)
with
Pre => Correct_Signals and Correct_Segments,
Global => (In_Out => (Segment_State, Signal_State)),
Depends => ((Segment_State, Success) => (Route, Segment_State),
Signal_State => (Segment_State, Route, Signal_State)),
Post => Correct_Signals and Correct_Segments;
end Railway;
|
libsrc/graphics/retrofit/xordrawr_callee.asm | jpoikela/z88dk | 640 | 167246 | <reponame>jpoikela/z88dk
;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
;
; $Id: xordrawr_callee.asm $
;
;
; CALLER LINKAGE FOR FUNCTION POINTERS
; ----- void xordrawr(int x2, int y2)
SECTION code_graphics
PUBLIC xordrawr_callee
PUBLIC _xordrawr_callee
EXTERN xordrawr
.xordrawr_callee
._xordrawr_callee
pop af ; ret addr
pop bc
pop de
push af ; ret addr
push de
push bc
call xordrawr
pop bc
pop bc
ret
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_vrrp.g4 | jeffkala/batfish | 0 | 5087 | parser grammar CiscoXr_vrrp;
import CiscoXr_common;
options {
tokenVocab = CiscoXrLexer;
}
router_vrrp
:
VRRP NEWLINE
(
vrrp_interface
)*
;
vrrp_interface
:
NO? INTERFACE iface = interface_name NEWLINE
(
vi_address_family
)* NEWLINE?
;
vi_address_family
:
NO? ADDRESS_FAMILY IPV4 NEWLINE
(
viaf_vrrp
)*
;
viaf_vrrp
:
NO? VRRP groupnum = uint_legacy NEWLINE
(
viafv_address
| viafv_null
| viafv_preempt
| viafv_priority
)*
;
viafv_address
:
ADDRESS address = IP_ADDRESS NEWLINE
;
viafv_null
:
NO?
(
TIMERS
| TRACK
) null_rest_of_line
;
viafv_preempt
:
PREEMPT
(
DELAY delay = uint_legacy
) NEWLINE
;
viafv_priority
:
PRIORITY priority = uint_legacy NEWLINE
; |
libsrc/interrupts/im2/im2_Init.asm | jpoikela/z88dk | 640 | 85186 | <filename>libsrc/interrupts/im2/im2_Init.asm
; void __FASTCALL__ im2_Init_callee(void *tableaddr)
; 04.2004, 02.2008 aralbrec
SECTION code_clib
PUBLIC im2_Init
PUBLIC _im2_Init
.im2_Init
._im2_Init
; enter : hl = address of im2 vector table
ld a,h
ld i,a
im 2
ret
|
oeis/272/A272630.asm | neoneye/loda-programs | 11 | 165813 | ; A272630: a(n) = binomial(3*prime(n), prime(n)) - 3*binomial(2*prime(n), prime(n)) + 3.
; Submitted by <NAME>
; 0,27,2250,105987,191420427,8091223647,14764068268068,636877933530303,1202912275541006163,101416777765228668135243,4470228055779262703971971,387215990724249198145972139532,763815804413169191825705670410076,33986135421741862065520464883016403,67497197121492156001507939338110977443,6013413491452369134558296068393202183685303,539183567152776376679525088028387600696777815843,24161769937626751008057184144394247372051654241107,2180925763550779007578215516228259167881774806640288103
seq $0,6093 ; a(n) = prime(n) - 1.
seq $0,115246 ; Number of different ways to select n elements from three sets of n elements such that there is at least one element from each set.
|
oeis/138/A138691.asm | neoneye/loda-programs | 11 | 7996 | ; A138691: Numbers of the form 68+p^2 (where p is a prime).
; Submitted by <NAME>(s3)
; 72,77,93,117,189,237,357,429,597,909,1029,1437,1749,1917,2277,2877,3549,3789,4557,5109,5397,6309,6957,7989,9477,10269,10677,11517,11949,12837,16197,17229,18837,19389,22269,22869,24717,26637,27957,29997,32109,32829,36549,37317,38877,39669,44589,49797,51597,52509,54357,57189,58149,63069,66117,69237,72429,73509,76797,79029,80157,85917,94317,96789,98037,100557,109629,113637,120477,121869,124677,128949,134757,139197,143709,146757,151389,157677,160869,167349,175629,177309,185829,187557,192789,196317
mul $0,2
max $0,1
seq $0,173919 ; Numbers that are prime or one less than a prime.
pow $0,2
add $0,68
|
bb-runtimes/examples/rpi2-mandel/main.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 17183 | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2016-2017, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Real_Time; use Ada.Real_Time;
with Video; use Video;
with Mandel; use Mandel;
with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control;
procedure Main is
T : Time;
begin
Put_Line ("*******");
Init_Video;
Put_Line ("Waiting for screen...");
-- Wait for screen on.
T := Clock + Seconds (1);
delay until T;
Put_Line ("Starting...");
loop
-- Start tasks.
for I in 1 .. Nbr_Tasks loop
Set_True (Starts (I));
end loop;
-- Wait until tasks are completed.
for I in 1 .. Nbr_Tasks loop
Suspend_Until_True (Wait (I));
end loop;
-- Display time.
for I in Times'Range loop
Put ("CPU#");
Put (Natural'Image (I));
Put (":");
Put (Natural'Image (Times (I) / Milliseconds (1)));
Put_Line (" ms");
end loop;
New_Line;
delay until Clock + Seconds (5);
end loop;
end Main;
|
06.sumOfSeries.asm | tamim87/Assembly-Samples | 0 | 21952 | <filename>06.sumOfSeries.asm
;sum of series using loop
org 100h
mov cx,10 ;store 10 into cx to control the flow of loop
for:
mov ax,cx ;storing the current number into ax
mul ax ;multiplying the number with itself
add sum,ax ;add the multiplied number to sum
loop for ;loop instruction
ret
sum dw 0 ;using sum to store the result |
codec/common/x86/mc_luma.asm | gpatil/openh264 | 1 | 94623 | ;*!
;* \copy
;* Copyright (c) 2009-2013, Cisco Systems
;* All rights reserved.
;*
;* Redistribution and use in source and binary forms, with or without
;* modification, are permitted provided that the following conditions
;* are met:
;*
;* * Redistributions of source code must retain the above copyright
;* notice, this list of conditions and the following disclaimer.
;*
;* * Redistributions in binary form must reproduce the above copyright
;* notice, this list of conditions and the following disclaimer in
;* the documentation and/or other materials provided with the
;* distribution.
;*
;* 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.
;*
;*
;* mc_luma.asm
;*
;* Abstract
;* sse2 motion compensation
;*
;* History
;* 17/08/2009 Created
;*
;*
;*************************************************************************/
%include "asm_inc.asm"
;*******************************************************************************
; Local Data (Read Only)
;*******************************************************************************
SECTION .rodata align=16
;*******************************************************************************
; Various memory constants (trigonometric values or rounding values)
;*******************************************************************************
ALIGN 16
h264_w0x10:
dw 16, 16, 16, 16
ALIGN 16
h264_w0x10_1:
dw 16, 16, 16, 16, 16, 16, 16, 16
ALIGN 16
h264_mc_hc_32:
dw 32, 32, 32, 32, 32, 32, 32, 32
;*******************************************************************************
; Code
;*******************************************************************************
SECTION .text
;*******************************************************************************
; void McHorVer20WidthEq4_mmx( const uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight)
;*******************************************************************************
WELS_EXTERN McHorVer20WidthEq4_mmx
%assign push_num 0
LOAD_5_PARA
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
sub r0, 2
WELS_Zero mm7
movq mm6, [h264_w0x10]
.height_loop:
movd mm0, [r0]
punpcklbw mm0, mm7
movd mm1, [r0+5]
punpcklbw mm1, mm7
movd mm2, [r0+1]
punpcklbw mm2, mm7
movd mm3, [r0+4]
punpcklbw mm3, mm7
movd mm4, [r0+2]
punpcklbw mm4, mm7
movd mm5, [r0+3]
punpcklbw mm5, mm7
paddw mm2, mm3
paddw mm4, mm5
psllw mm4, 2
psubw mm4, mm2
paddw mm0, mm1
paddw mm0, mm4
psllw mm4, 2
paddw mm0, mm4
paddw mm0, mm6
psraw mm0, 5
packuswb mm0, mm7
movd [r2], mm0
add r0, r1
add r2, r3
dec r4
jnz .height_loop
WELSEMMS
LOAD_5_PARA_POP
ret
;*******************************************************************************
; Macros and other preprocessor constants
;*******************************************************************************
%macro SSE_LOAD_8P 3
movq %1, %3
punpcklbw %1, %2
%endmacro
%macro FILTER_HV_W8 9
paddw %1, %6
movdqa %8, %3
movdqa %7, %2
paddw %1, [h264_w0x10_1]
paddw %8, %4
paddw %7, %5
psllw %8, 2
psubw %8, %7
paddw %1, %8
psllw %8, 2
paddw %1, %8
psraw %1, 5
WELS_Zero %8
packuswb %1, %8
movq %9, %1
%endmacro
;*******************************************************************************
; Code
;*******************************************************************************
SECTION .text
;***********************************************************************
; void McHorVer22Width8HorFirst_sse2(const int16_t *pSrc,
; int16_t iSrcStride,
; uint8_t *pDst,
; int32_t iDstStride
; int32_t iHeight
; )
;***********************************************************************
WELS_EXTERN McHorVer22Width8HorFirst_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
pxor xmm7, xmm7
sub r0, r1 ;;;;;;;;need more 5 lines.
sub r0, r1
.yloop_width_8:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
movdqa [r2], xmm0
add r0, r1
add r2, r3
dec r4
jnz .yloop_width_8
POP_XMM
LOAD_5_PARA_POP
ret
;*******************************************************************************
; void McHorVer20WidthEq8_sse2( const uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight,
; );
;*******************************************************************************
WELS_EXTERN McHorVer20WidthEq8_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
lea r0, [r0-2] ;pSrc -= 2;
pxor xmm7, xmm7
movdqa xmm6, [h264_w0x10_1]
.y_loop:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [r2], xmm0
lea r2, [r2+r3]
lea r0, [r0+r1]
dec r4
jnz near .y_loop
POP_XMM
LOAD_5_PARA_POP
ret
;*******************************************************************************
; void McHorVer20WidthEq16_sse2( const uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight,
; );
;*******************************************************************************
WELS_EXTERN McHorVer20WidthEq16_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
lea r0, [r0-2] ;pSrc -= 2;
pxor xmm7, xmm7
movdqa xmm6, [h264_w0x10_1]
.y_loop:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [r2], xmm0
movq xmm0, [r0+8]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5+8]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1+8]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4+8]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2+8]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3+8]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [r2+8], xmm0
lea r2, [r2+r3]
lea r0, [r0+r1]
dec r4
jnz near .y_loop
POP_XMM
LOAD_5_PARA_POP
ret
;*******************************************************************************
; void McHorVer02WidthEq8_sse2( const uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight )
;*******************************************************************************
WELS_EXTERN McHorVer02WidthEq8_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
sub r0, r1
sub r0, r1
WELS_Zero xmm7
SSE_LOAD_8P xmm0, xmm7, [r0]
SSE_LOAD_8P xmm1, xmm7, [r0+r1]
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm2, xmm7, [r0]
SSE_LOAD_8P xmm3, xmm7, [r0+r1]
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm4, xmm7, [r0]
SSE_LOAD_8P xmm5, xmm7, [r0+r1]
.start:
FILTER_HV_W8 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r4
jz near .xx_exit
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm6, xmm7, [r0]
FILTER_HV_W8 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, [r2+r3]
dec r4
jz near .xx_exit
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm7, xmm0, [r0+r1]
FILTER_HV_W8 xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [r2]
dec r4
jz near .xx_exit
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm0, xmm1, [r0]
FILTER_HV_W8 xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, [r2+r3]
dec r4
jz near .xx_exit
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm1, xmm2, [r0+r1]
FILTER_HV_W8 xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, [r2]
dec r4
jz near .xx_exit
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm2, xmm3, [r0]
FILTER_HV_W8 xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, [r2+r3]
dec r4
jz near .xx_exit
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm3, xmm4, [r0+r1]
FILTER_HV_W8 xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, [r2]
dec r4
jz near .xx_exit
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm4, xmm5, [r0]
FILTER_HV_W8 xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, [r2+r3]
dec r4
jz near .xx_exit
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm5, xmm6, [r0+r1]
jmp near .start
.xx_exit:
POP_XMM
LOAD_5_PARA_POP
ret
;***********************************************************************
; Code
;***********************************************************************
SECTION .text
;***********************************************************************
; void McHorVer02Height9Or17_sse2( const uint8_t *pSrc,
; int32_t iSrcStride,
; uint8_t *pDst,
; int32_t iDstStride,
; int32_t iWidth,
; int32_t iHeight )
;***********************************************************************
WELS_EXTERN McHorVer02Height9Or17_sse2
%assign push_num 0
LOAD_6_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
SIGN_EXTENSION r5, r5d
%ifndef X86_32
push r12
push r13
push r14
mov r12, r0
mov r13, r2
mov r14, r5
%endif
shr r4, 3
sub r0, r1
sub r0, r1
.xloop:
WELS_Zero xmm7
SSE_LOAD_8P xmm0, xmm7, [r0]
SSE_LOAD_8P xmm1, xmm7, [r0+r1]
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm2, xmm7, [r0]
SSE_LOAD_8P xmm3, xmm7, [r0+r1]
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm4, xmm7, [r0]
SSE_LOAD_8P xmm5, xmm7, [r0+r1]
FILTER_HV_W8 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm6, xmm7, [r0]
movdqa xmm0,xmm1
movdqa xmm1,xmm2
movdqa xmm2,xmm3
movdqa xmm3,xmm4
movdqa xmm4,xmm5
movdqa xmm5,xmm6
add r2, r3
sub r0, r1
.start:
FILTER_HV_W8 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm6, xmm7, [r0]
FILTER_HV_W8 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm7, xmm0, [r0+r1]
FILTER_HV_W8 xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm0, xmm1, [r0]
FILTER_HV_W8 xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm1, xmm2, [r0+r1]
FILTER_HV_W8 xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm2, xmm3, [r0]
FILTER_HV_W8 xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm3, xmm4, [r0+r1]
FILTER_HV_W8 xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
SSE_LOAD_8P xmm4, xmm5, [r0]
FILTER_HV_W8 xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
SSE_LOAD_8P xmm5, xmm6, [r0+r1]
jmp near .start
.x_loop_dec:
dec r4
jz near .xx_exit
%ifdef X86_32
mov r0, arg1
mov r2, arg3
mov r5, arg6
%else
mov r0, r12
mov r2, r13
mov r5, r14
%endif
sub r0, r1
sub r0, r1
add r0, 8
add r2, 8
jmp near .xloop
.xx_exit:
%ifndef X86_32
pop r14
pop r13
pop r12
%endif
POP_XMM
LOAD_6_PARA_POP
ret
;***********************************************************************
; void McHorVer20Width9Or17_sse2( const uint8_t *pSrc,
; int32_t iSrcStride,
; uint8_t *pDst,
; int32_t iDstStride,
; int32_t iWidth,
; int32_t iHeight
; );
;***********************************************************************
WELS_EXTERN McHorVer20Width9Or17_sse2
%assign push_num 0
LOAD_6_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
SIGN_EXTENSION r5, r5d
sub r0, 2
pxor xmm7, xmm7
cmp r4, 9
jne near .width_17
.yloop_width_9:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
movdqa xmm7, xmm2
paddw xmm7, xmm3
movdqa xmm6, xmm4
paddw xmm6, xmm5
psllw xmm6, 2
psubw xmm6, xmm7
paddw xmm0, xmm1
paddw xmm0, xmm6
psllw xmm6, 2
paddw xmm0, xmm6
paddw xmm0, [h264_w0x10_1]
psraw xmm0, 5
packuswb xmm0, xmm0
movd [r2], xmm0
pxor xmm7, xmm7
movq xmm0, [r0+6]
punpcklbw xmm0, xmm7
paddw xmm4, xmm1
paddw xmm5, xmm3
psllw xmm5, 2
psubw xmm5, xmm4
paddw xmm2, xmm0
paddw xmm2, xmm5
psllw xmm5, 2
paddw xmm2, xmm5
paddw xmm2, [h264_w0x10_1]
psraw xmm2, 5
packuswb xmm2, xmm2
movq [r2+1], xmm2
add r0, r1
add r2, r3
dec r5
jnz .yloop_width_9
POP_XMM
LOAD_6_PARA_POP
ret
.width_17:
.yloop_width_17:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, [h264_w0x10_1]
psraw xmm0, 5
packuswb xmm0, xmm0
movq [r2], xmm0
movq xmm0, [r0+8]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5+8]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1+8]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4+8]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2+8]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3+8]
punpcklbw xmm5, xmm7
movdqa xmm7, xmm2
paddw xmm7, xmm3
movdqa xmm6, xmm4
paddw xmm6, xmm5
psllw xmm6, 2
psubw xmm6, xmm7
paddw xmm0, xmm1
paddw xmm0, xmm6
psllw xmm6, 2
paddw xmm0, xmm6
paddw xmm0, [h264_w0x10_1]
psraw xmm0, 5
packuswb xmm0, xmm0
movd [r2+8], xmm0
pxor xmm7, xmm7
movq xmm0, [r0+6+8]
punpcklbw xmm0, xmm7
paddw xmm4, xmm1
paddw xmm5, xmm3
psllw xmm5, 2
psubw xmm5, xmm4
paddw xmm2, xmm0
paddw xmm2, xmm5
psllw xmm5, 2
paddw xmm2, xmm5
paddw xmm2, [h264_w0x10_1]
psraw xmm2, 5
packuswb xmm2, xmm2
movq [r2+9], xmm2
add r0, r1
add r2, r3
dec r5
jnz .yloop_width_17
POP_XMM
LOAD_6_PARA_POP
ret
;***********************************************************************
;void McHorVer22HorFirst_sse2
; (const uint8_t *pSrc,
; int32_t iSrcStride,
; uint8_t * pTap,
; int32_t iTapStride,
; int32_t iWidth,int32_t iHeight);
;***********************************************************************
WELS_EXTERN McHorVer22HorFirst_sse2
%assign push_num 0
LOAD_6_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
SIGN_EXTENSION r5, r5d
pxor xmm7, xmm7
sub r0, r1 ;;;;;;;;need more 5 lines.
sub r0, r1
cmp r4, 9
jne near .width_17
.yloop_width_9:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
movdqa xmm7, xmm2
paddw xmm7, xmm3
movdqa xmm6, xmm4
paddw xmm6, xmm5
psllw xmm6, 2
psubw xmm6, xmm7
paddw xmm0, xmm1
paddw xmm0, xmm6
psllw xmm6, 2
paddw xmm0, xmm6
movd [r2], xmm0
pxor xmm7, xmm7
movq xmm0, [r0+6]
punpcklbw xmm0, xmm7
paddw xmm4, xmm1
paddw xmm5, xmm3
psllw xmm5, 2
psubw xmm5, xmm4
paddw xmm2, xmm0
paddw xmm2, xmm5
psllw xmm5, 2
paddw xmm2, xmm5
movq [r2+2], xmm2
movhps [r2+2+8], xmm2
add r0, r1
add r2, r3
dec r5
jnz .yloop_width_9
POP_XMM
LOAD_6_PARA_POP
ret
.width_17:
.yloop_width_17:
movq xmm0, [r0]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
movdqa [r2], xmm0
movq xmm0, [r0+8]
punpcklbw xmm0, xmm7
movq xmm1, [r0+5+8]
punpcklbw xmm1, xmm7
movq xmm2, [r0+1+8]
punpcklbw xmm2, xmm7
movq xmm3, [r0+4+8]
punpcklbw xmm3, xmm7
movq xmm4, [r0+2+8]
punpcklbw xmm4, xmm7
movq xmm5, [r0+3+8]
punpcklbw xmm5, xmm7
movdqa xmm7, xmm2
paddw xmm7, xmm3
movdqa xmm6, xmm4
paddw xmm6, xmm5
psllw xmm6, 2
psubw xmm6, xmm7
paddw xmm0, xmm1
paddw xmm0, xmm6
psllw xmm6, 2
paddw xmm0, xmm6
movd [r2+16], xmm0
pxor xmm7, xmm7
movq xmm0, [r0+6+8]
punpcklbw xmm0, xmm7
paddw xmm4, xmm1
paddw xmm5, xmm3
psllw xmm5, 2
psubw xmm5, xmm4
paddw xmm2, xmm0
paddw xmm2, xmm5
psllw xmm5, 2
paddw xmm2, xmm5
movq [r2+18], xmm2
movhps [r2+18+8], xmm2
add r0, r1
add r2, r3
dec r5
jnz .yloop_width_17
POP_XMM
LOAD_6_PARA_POP
ret
%macro FILTER_VER 9
paddw %1, %6
movdqa %7, %2
movdqa %8, %3
paddw %7, %5
paddw %8, %4
psubw %1, %7
psraw %1, 2
paddw %1, %8
psubw %1, %7
psraw %1, 2
paddw %8, %1
paddw %8, [h264_mc_hc_32]
psraw %8, 6
packuswb %8, %8
movq %9, %8
%endmacro
;***********************************************************************
;void McHorVer22Width8VerLastAlign_sse2(
; const uint8_t *pTap,
; int32_t iTapStride,
; uint8_t * pDst,
; int32_t iDstStride,
; int32_t iWidth,
; int32_t iHeight);
;***********************************************************************
WELS_EXTERN McHorVer22Width8VerLastAlign_sse2
%assign push_num 0
LOAD_6_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
SIGN_EXTENSION r5, r5d
%ifndef X86_32
push r12
push r13
push r14
mov r12, r0
mov r13, r2
mov r14, r5
%endif
shr r4, 3
.width_loop:
movdqa xmm0, [r0]
movdqa xmm1, [r0+r1]
lea r0, [r0+2*r1]
movdqa xmm2, [r0]
movdqa xmm3, [r0+r1]
lea r0, [r0+2*r1]
movdqa xmm4, [r0]
movdqa xmm5, [r0+r1]
FILTER_VER xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
lea r0, [r0+2*r1]
movdqa xmm6, [r0]
movdqa xmm0, xmm1
movdqa xmm1, xmm2
movdqa xmm2, xmm3
movdqa xmm3, xmm4
movdqa xmm4, xmm5
movdqa xmm5, xmm6
add r2, r3
sub r0, r1
.start:
FILTER_VER xmm0,xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqa xmm6, [r0]
FILTER_VER xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqa xmm7, [r0+r1]
FILTER_VER xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqa xmm0, [r0]
FILTER_VER xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqa xmm1, [r0+r1]
FILTER_VER xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,[r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqa xmm2, [r0]
FILTER_VER xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqa xmm3, [r0+r1]
FILTER_VER xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,[r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqa xmm4, [r0]
FILTER_VER xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,xmm6, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqa xmm5, [r0+r1]
jmp near .start
.x_loop_dec:
dec r4
jz near .exit
%ifdef X86_32
mov r0, arg1
mov r2, arg3
mov r5, arg6
%else
mov r0, r12
mov r2, r13
mov r5, r14
%endif
add r0, 16
add r2, 8
jmp .width_loop
.exit:
%ifndef X86_32
pop r14
pop r13
pop r12
%endif
POP_XMM
LOAD_6_PARA_POP
ret
;***********************************************************************
;void McHorVer22Width8VerLastUnAlign_sse2(
; const uint8_t *pTap,
; int32_t iTapStride,
; uint8_t * pDst,
; int32_t iDstStride,
; int32_t iWidth,
; int32_t iHeight);
;***********************************************************************
WELS_EXTERN McHorVer22Width8VerLastUnAlign_sse2
%assign push_num 0
LOAD_6_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
SIGN_EXTENSION r4, r4d
SIGN_EXTENSION r5, r5d
%ifndef X86_32
push r12
push r13
push r14
mov r12, r0
mov r13, r2
mov r14, r5
%endif
shr r4, 3
.width_loop:
movdqu xmm0, [r0]
movdqu xmm1, [r0+r1]
lea r0, [r0+2*r1]
movdqu xmm2, [r0]
movdqu xmm3, [r0+r1]
lea r0, [r0+2*r1]
movdqu xmm4, [r0]
movdqu xmm5, [r0+r1]
FILTER_VER xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
lea r0, [r0+2*r1]
movdqu xmm6, [r0]
movdqa xmm0, xmm1
movdqa xmm1, xmm2
movdqa xmm2, xmm3
movdqa xmm3, xmm4
movdqa xmm4, xmm5
movdqa xmm5, xmm6
add r2, r3
sub r0, r1
.start:
FILTER_VER xmm0,xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqu xmm6, [r0]
FILTER_VER xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqu xmm7, [r0+r1]
FILTER_VER xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqu xmm0, [r0]
FILTER_VER xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqu xmm1, [r0+r1]
FILTER_VER xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,[r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqu xmm2, [r0]
FILTER_VER xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,[r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqu xmm3, [r0+r1]
FILTER_VER xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,[r2]
dec r5
jz near .x_loop_dec
lea r0, [r0+2*r1]
movdqu xmm4, [r0]
FILTER_VER xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,xmm6, [r2+r3]
dec r5
jz near .x_loop_dec
lea r2, [r2+2*r3]
movdqu xmm5, [r0+r1]
jmp near .start
.x_loop_dec:
dec r4
jz near .exit
%ifdef X86_32
mov r0, arg1
mov r2, arg3
mov r5, arg6
%else
mov r0, r12
mov r2, r13
mov r5, r14
%endif
add r0, 16
add r2, 8
jmp .width_loop
.exit:
%ifndef X86_32
pop r14
pop r13
pop r12
%endif
POP_XMM
LOAD_6_PARA_POP
ret
|
programs/oeis/110/A110349.asm | jmorken/loda | 1 | 8545 | <reponame>jmorken/loda
; A110349: a(n) = n + (n+1) + (n-1) + (n+2) + (n-2) ... n terms.
; 1,5,9,18,25,39,49,68,81,105,121,150,169,203,225,264,289,333,361,410,441,495,529,588,625,689,729,798,841,915,961,1040,1089,1173,1225,1314,1369,1463,1521,1620,1681,1785,1849,1958,2025,2139,2209,2328,2401,2525,2601,2730,2809,2943,3025,3164,3249,3393,3481,3630,3721,3875,3969,4128,4225,4389,4489,4658,4761,4935,5041,5220,5329,5513,5625,5814,5929,6123,6241,6440,6561,6765,6889,7098,7225,7439,7569,7788,7921,8145,8281,8510,8649,8883,9025,9264,9409,9653,9801,10050,10201,10455,10609,10868,11025,11289,11449,11718,11881,12155,12321,12600,12769,13053,13225,13514,13689,13983,14161,14460,14641,14945,15129,15438,15625,15939,16129,16448,16641,16965,17161,17490,17689,18023,18225,18564,18769,19113,19321,19670,19881,20235,20449,20808,21025,21389,21609,21978,22201,22575,22801,23180,23409,23793,24025,24414,24649,25043,25281,25680,25921,26325,26569,26978,27225,27639,27889,28308,28561,28985,29241,29670,29929,30363,30625,31064,31329,31773,32041,32490,32761,33215,33489,33948,34225,34689,34969,35438,35721,36195,36481,36960,37249,37733,38025,38514,38809,39303,39601,40100,40401,40905,41209,41718,42025,42539,42849,43368,43681,44205,44521,45050,45369,45903,46225,46764,47089,47633,47961,48510,48841,49395,49729,50288,50625,51189,51529,52098,52441,53015,53361,53940,54289,54873,55225,55814,56169,56763,57121,57720,58081,58685,59049,59658,60025,60639,61009,61628,62001,62625
mov $2,$0
mul $0,2
add $0,4
mov $1,1
lpb $0
trn $0,4
add $1,$0
add $1,$2
lpe
|
std/mem.asm | mossx-dev/Mycore | 0 | 98137 | <filename>std/mem.asm
;; Author: <NAME>
;; Date: 14-Oct-21
%ifndef _Mycelium_std_mem_
%define _Mycelium_std_mem_
%include "std/sys.asm"
%include "std/exception.asm"
mmap#shared: equ 0x1
mmap#private: equ 0x2
mmap#shared_validate: equ 0x3
; Args
; rax: amount of memory in bytes
; Returns
; rsi: pointer to allocated memory
mem~allocate:
push rcx
push r8
push r9
push r10
push r11
mov rsi, rax ; len = rax
mov rax, sys~id~mmap
xor rdi, rdi ; addr = NULL
mov rdx, 7 ; prot = PROT_READ|PROT_WRITE
mov r10, mmap#private | 0x20 ; flags = MAP_PRIVATE|MAP_ANON
mov r8, -1 ; fd = -1
xor r9, r9 ; offset = 0 (4096*0)
syscall ; make call
mov rsi, rax
pop r11
pop r10
pop r9
pop r8
pop rcx
ret
; Args
; rax: pointer to the buffer
; rbx: length of the buffer
; Returns
; void
mem~deallocate:
push r11
mov rdi, rax
mov rsi, rbx
mov rax, sys~id~munmap
syscall
pop r11
ret
; Args
; rax: pointer to the current buffer
; rbx: current size
; rcx: new size
; Returns
; rax: new pointer (same as rax if not moved)
mem~reallocate:
mov rdi, rax
mov rsi, rbx
mov rdx, rcx
mov r10, 0x1 ; Flags = MREMAP_MAYMOVE
mov rax, sys~id~mremap
syscall
cmp rax, 0
jg .return
mov rax, exception~runtime~bad_allocation
call exception~runtime~throw
.return:
ret
%endif ; ifdef guard
|
devices/devices-magtape6026.adb | SMerrony/dgemua | 2 | 5680 | -- MIT License
-- Copyright (c) 2021 <NAME>
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO;
with Debug_Logs; use Debug_Logs;
with Devices;
with Devices.Bus;
with Memory;
with Memory_Channels; use Memory_Channels;
with Status_Monitor;
package body Devices.Magtape6026 is
protected body Drives is
procedure Init is
begin
Devices.Bus.Actions.Set_Reset_Proc (Devices.MTB, Reset'Access);
Devices.Bus.Actions.Set_Data_In_Proc (Devices.MTB, Data_In'Access);
Devices.Bus.Actions.Set_Data_Out_Proc (Devices.MTB, Data_Out'Access);
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady;
State.Status_Reg_2 := SR_2_PE_Mode;
Status_Sender.Start;
end Init;
procedure Reset is
begin
for Tape in 0 .. Max_Tapes loop
if State.Image_Attached(Tape) then
Rewind (State.SIMH_File(Tape));
end if;
end loop;
-- BOT is an error state!
State.Status_Reg_1 := SR_1_Error or SR_1_HiDensity or SR_1_9Track or SR_1_BOT or SR_1_StatusChanged or SR_1_UnitReady;
State.Status_Reg_2 := SR_2_PE_Mode;
State.Mem_Addr_Reg := 0;
State.Neg_Word_Count := 0;
State.Current_Unit := 0;
Loggers.Debug_Print (Mt_Log, "Unit reset via bus Reset call");
end Reset;
procedure Attach (Unit : in Natural; Image_Name : in String; OK : out Boolean) is
begin
-- Open (File => Img_File, Mode => In_File, Name => Image_Name);
Open (File => State.SIMH_File(Unit), Mode => In_File, Name => Image_Name);
State.Image_Filename(Unit) := To_Unbounded_String(Image_Name);
State.Image_Attached(Unit) := true;
State.Status_Reg_1 := SR_1_Error or SR_1_HiDensity or SR_1_9Track or SR_1_BOT or SR_1_StatusChanged or SR_1_UnitReady;
State.Status_Reg_2 := SR_2_PE_Mode;
Devices.Bus.Actions.Set_Image_Attached (Devices.MTB, Image_Name);
OK := true;
exception
when Error : others =>
Loggers.Debug_Print (Debug_Log, "WARNING: Could not open SimH tape image due to " &
Exception_Information (Error));
OK := false;
end Attach;
procedure Detach (Unit : in Natural) is
begin
Close (File => State.SIMH_File(Unit));
State.Image_Filename(Unit) := Null_Unbounded_String;
State.Image_Attached(Unit) := false;
State.Status_Reg_1 := SR_1_Error or SR_1_HiDensity or SR_1_9Track or SR_1_BOT or SR_1_StatusChanged or SR_1_UnitReady;
State.Status_Reg_2 := SR_2_PE_Mode;
Devices.Bus.Actions.Set_Image_Detached (Devices.MTB);
end Detach;
procedure Do_Command is
Hdr, Trailer : Dword_T;
Img_Stream : Stream_Access;
RC : Mt_Stat;
begin
-- currently only supporting one drive (Unit 0)...
if State.Current_Unit /= 0 then
Loggers.Debug_Print (Mt_Log, "WARNING: Command issued for Unit #" & State.Current_Unit'Image);
State.Status_Reg_1 := SR_1_Error or SR_1_Illegal;
State.Status_Reg_2 := SR_2_Error;
return;
end if;
case State.Current_Cmd is
when Read =>
Loggers.Debug_Print (Mt_Log, "DEBUG: *READ* command - Unit:" & State.Current_Unit'Image &
" Word Count: " & State.Neg_Word_Count'Image &
" Location: " & State.Mem_Addr_Reg'Image);
Img_Stream := stream(State.SIMH_File(State.Current_Unit));
Read_Meta_Data (Img_Stream, Hdr);
if Hdr = Mtr_Tmk then
Loggers.Debug_Print (Mt_Log, "WARNING: Header is EOF (Tape Mark) Indicator");
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_EOF or SR_1_Error;
else
declare
Tape_Rec : Mt_Rec(0..Integer(Hdr));
W : Natural := 0;
Wd : Word_T;
begin
Read_Record_Data (Img_Stream, Natural(Hdr), Tape_Rec);
while W < Natural(Hdr) loop
Wd := Word_From_Bytes(Tape_Rec(W), Tape_Rec(W+1));
W := W + 2;
BMC_DCH.Write_Word_DCH_Chan(State.Mem_Addr_Reg, Wd);
State.Neg_Word_Count := State.Neg_Word_Count + 1;
exit when State.Neg_Word_Count = 0;
end loop;
Read_Meta_Data (Img_Stream, Trailer);
Loggers.Debug_Print (Mt_Log, "DEBUG: " & W'Image & " bytes loaded");
Loggers.Debug_Print (Mt_Log, "DEBUG: Read SimH Trailer: " & Trailer'Image);
-- TODO Need to verify how status should be set here...
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_StatusChanged or SR_1_UnitReady;
end;
end if;
when Rewind =>
Loggers.Debug_Print (Mt_Log, "DEBUG: *REWIND* command - Unit:" & State.Current_Unit'Image);
Rewind (State.SIMH_File(State.Current_Unit));
State.Status_Reg_1 := SR_1_Error or SR_1_HiDensity or SR_1_9Track or SR_1_StatusChanged or SR_1_UnitReady or SR_1_BOT;
when Space_Fwd =>
Loggers.Debug_Print (Mt_Log, "DEBUG: *SPACE FORWARD* command - Unit:" & State.Current_Unit'Image);
Img_Stream := stream(State.SIMH_File(State.Current_Unit));
if State.Neg_Word_Count = 0 then -- one whole file
RC := Space_Forward (Img_Stream, 0);
-- according to the simH source, MA should be set to # files/recs skipped
-- can't find any reference to this in the Periph Pgmrs Guide but it lets INSTL
-- progress further...
-- It seems to need the two's complement of the number...
State.Mem_Addr_Reg := 16#ffff_ffff#;
if RC = OK then
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_EOF or SR_1_Error;
else
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_EOT or SR_1_StatusChanged;
end if;
else
RC := Space_Forward (Img_Stream, Integer(State.Neg_Word_Count));
case RC is
when OK =>
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_StatusChanged;
when Tmk =>
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_EOF or SR_1_StatusChanged or SR_1_Error;
when InvRec =>
State.Status_Reg_1 := SR_1_HiDensity or SR_1_9Track or SR_1_UnitReady or SR_1_DataError or SR_1_StatusChanged or SR_1_Error;
when others =>
raise Unexpected_Return_Code with "from SimH Space Forward command";
end case;
State.Mem_Addr_Reg := Phys_Addr_T(State.Neg_Word_Count);
end if;
when others =>
Loggers.Debug_Print (Mt_Log, "WARNING: Command not yet implemented: " & State.Current_Cmd'Image);
raise Not_Yet_Implemented with "MTB Command " & State.Current_Cmd'Image;
end case;
end Do_Command;
procedure Handle_Flag ( IO_Flag : IO_Flag_T) is
begin
case IO_Flag is
when S =>
Loggers.Debug_Print (Mt_Log, "... S flag set");
if State.Current_Cmd /= Rewind then
Devices.Bus.States.Set_Busy (Devices.MTB, true);
end if;
Devices.Bus.States.Set_Done (Devices.MTB, false);
Do_Command;
Devices.Bus.States.Set_Busy (Devices.MTB, false);
Devices.Bus.States.Set_Done (Devices.MTB, true);
when C =>
Loggers.Debug_Print (Mt_Log, "... C flag set");
Devices.Bus.States.Set_Busy (Devices.MTB, false);
Devices.Bus.States.Set_Done (Devices.MTB, false);
when P => -- 'Reserved...'
Loggers.Debug_Print (Mt_Log, "WARNING: P flag set - 'Reserved' command");
when None =>
null;
end case;
end Handle_Flag;
-- Data_In is called from Bus to implement DIx from the mt device
procedure Data_In (ABC : in IO_Reg_T; IO_Flag : in IO_Flag_T; Datum : out Word_T) is
begin
case ABC is
when A => -- Read status register 1 - see p.IV-18 of Peripherals guide
Datum := State.Status_Reg_1;
Loggers.Debug_Print (Mt_Log, "DIA - Read SR1 - returning: " & Datum'Image);
when B => --Read memory addr register 1 - see p.IV-19 of Peripherals guide
Datum := Word_T(State.Mem_Addr_Reg and 16#0000_ffff#);
Loggers.Debug_Print (Mt_Log, "DIB - Read MA - returning: " & Datum'Image);
when C => -- Read status register 2 - see p.IV-18 of Peripherals guide
Datum := State.Status_Reg_2;
Loggers.Debug_Print (Mt_Log, "DIC - Read SR2 - returning: " & Datum'Image);
when others => null;
end case;
Handle_Flag (IO_Flag);
end Data_In;
procedure Data_Out (Datum : in Word_T; ABC : in IO_Reg_T; IO_Flag : in IO_Flag_T) is
begin
case ABC is
when A => -- specify Command and Drive - p.IV-17
-- which command?
for C in Cmd_T'Range loop
if (Datum and Cmd_Mask) = Commands(C) then
State.Current_Cmd := C;
exit;
end if;
end loop;
--which unit?
State.Current_Unit := Natural(Datum and 16#0007#);
Loggers.Debug_Print (Mt_Log, "INFO: DOA - Specify Command: " & State.Current_Cmd'Image &
" Unit: " & State.Current_Unit'Image);
when B =>
State.Mem_Addr_Reg := Phys_Addr_T (Datum);
Loggers.Debug_Print (Mt_Log, "INFO: DOB - Mem Addr set to: " & State.Mem_Addr_Reg'Image);
when C =>
State.Neg_Word_Count := Word_To_Integer_16(Datum);
Loggers.Debug_Print (Mt_Log, "INFO: DOC - Neg. Word Count set to : " & State.Neg_Word_Count'Image);
when N => -- TODO
Loggers.Debug_Print (Mt_Log, "WARNING: NIO - Flag is : " & Datum'Image );
when others => null;
end case;
Handle_Flag (IO_Flag);
end Data_Out;
function Get_Image_Name (Unit : in Natural) return String is
begin
return To_String (State.Image_Filename(Unit));
end Get_Image_Name;
function Get_Status return Status_Rec is
Status : Status_Rec;
begin
Status.Image_Attached := State.Image_Attached;
Status.Image_Filename := State.Image_Filename;
Status.Mem_Addr_Reg := State.Mem_Addr_Reg;
Status.Current_Cmd := State.Current_Cmd;
Status.Status_Reg_1 := State.Status_Reg_1;
Status.Status_Reg_2 := State.Status_Reg_2;
return Status;
end Get_Status;
-- Load_TBOOT - This proc fakes the ROM/SCP boot-from-tape routine.
-- Rather than copying a ROM (how?) and executing that, we simply mimic its basic actions...
-- * Load file 0 from tape (1 x 2k block)
-- * Put the loaded code at physical location 0
procedure Load_TBOOT is
Unit : constant Integer := 0;
Img_Stream : Stream_Access;
Hdr, Trailer : Dword_T;
TBOOT_Rec : Mt_Rec(0..2047); -- TBOOT Block is always 2KB
TBOOT_Size_W : Integer;
Byte_0, Byte_1 : Byte_T;
B_Wd : Word_T;
Mem_Ix : Integer := 0;
begin
Loggers.Debug_Print (Mt_Log, "Load_TBOOT called" );
Rewind (State.SIMH_File(Unit));
Loggers.Debug_Print (Mt_Log, "... Tape rewound" );
Img_Stream := stream(State.SIMH_File(Unit));
Read_Loop:
loop
Read_Meta_Data (Img_Stream, Hdr);
case Hdr is
when Mtr_Tmk =>
exit Read_Loop;
when others =>
TBOOT_Size_W := Integer(Hdr) / 2;
Read_Record_Data (Img_Stream, Natural(Hdr), TBOOT_Rec);
for Wd_Ix in 0 .. TBOOT_Size_W - 1 loop
Byte_1 := TBOOT_Rec(Wd_Ix * 2);
Byte_0 := TBOOT_Rec((Wd_Ix * 2) + 1);
B_Wd := Shift_Left(Word_T(Byte_1), 8) or Word_T(Byte_0);
Memory.RAM.Write_Word(Phys_Addr_T(Mem_Ix + Wd_Ix), B_Wd);
end loop;
Mem_Ix := Mem_Ix + TBOOT_Size_W;
Read_Meta_Data (Img_Stream , Trailer);
if Hdr /= Trailer then
Loggers.Debug_Print (Mt_Log, "ERROR: Load_TBOOT - Mismatched trailer record");
end if;
end case;
end loop Read_Loop;
Rewind (State.SIMH_File(Unit));
Loggers.Debug_Print (Mt_Log, "Load_TBOOT completed" );
end Load_TBOOT;
end Drives;
task body Status_Sender is
Status : Status_Rec;
begin
accept Start do
Ada.Text_IO.Put_line ("INFO: MTB Status Sender started");
end Start;
loop
Status := Drives.Get_Status;
Status_Monitor.Monitor.MTB_Update (Status);
delay 0.5;
end loop;
end Status_Sender;
end Devices.Magtape6026; |
oeis/105/A105930.asm | neoneye/loda-programs | 11 | 1341 | <filename>oeis/105/A105930.asm
; A105930: Starting position of the n-th prime in the almost-natural numbers sequence A007376.
; Submitted by <NAME>
; 2,3,5,7,12,16,24,28,36,48,52,64,72,76,84,96,108,112,124,132,136,148,156,168,184,193,199,211,217,229,271,283,301,307,337,343,361,379,391,409,427,433,463,469,481,487,523,559,571,577,589,607,613,643,661,679
seq $0,6093 ; a(n) = prime(n) - 1.
seq $0,117804 ; Natural position of n in the string 12345678910111213....
|
oeis/115/A115332.asm | neoneye/loda-programs | 11 | 16425 | <gh_stars>10-100
; A115332: E.g.f: exp(x/(1-5*x))/sqrt(1-25*x^2).
; Submitted by <NAME>
; 1,1,36,256,11236,181476,9461776,251412736,15256202256,574194155536,39891552832576,1953973812658176,153336819846991936,9264773325882888256,812060124489852846336,58352827798669641650176
mov $3,1
lpb $0
mul $1,$0
sub $0,1
mov $2,$3
add $3,$1
mov $1,5
mul $1,$2
lpe
pow $3,2
mov $0,$3
|
Task/Averages-Pythagorean-means/AppleScript/averages-pythagorean-means-1.applescript | LaudateCorpus1/RosettaCodeData | 1 | 890 | <reponame>LaudateCorpus1/RosettaCodeData
-- arithmetic_mean :: [Number] -> Number
on arithmetic_mean(xs)
-- sum :: Number -> Number -> Number
script sum
on |λ|(accumulator, x)
accumulator + x
end |λ|
end script
foldl(sum, 0, xs) / (length of xs)
end arithmetic_mean
-- geometric_mean :: [Number] -> Number
on geometric_mean(xs)
-- product :: Number -> Number -> Number
script product
on |λ|(accumulator, x)
accumulator * x
end |λ|
end script
foldl(product, 1, xs) ^ (1 / (length of xs))
end geometric_mean
-- harmonic_mean :: [Number] -> Number
on harmonic_mean(xs)
-- addInverse :: Number -> Number -> Number
script addInverse
on |λ|(accumulator, x)
accumulator + (1 / x)
end |λ|
end script
(length of xs) / (foldl(addInverse, 0, xs))
end harmonic_mean
-- TEST -----------------------------------------------------------------------
on run
set {A, G, H} to ap({arithmetic_mean, geometric_mean, harmonic_mean}, ¬
{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}})
{values:{arithmetic:A, geometric:G, harmonic:H}, inequalities:¬
{|A >= G|:A ≥ G}, |G >= H|:G ≥ H}
end run
-- GENERIC FUNCTIONS ----------------------------------------------------------
-- A list of functions applied to a list of arguments
-- (<*> | ap) :: [(a -> b)] -> [a] -> [b]
on ap(fs, xs)
set {nf, nx} to {length of fs, length of xs}
set acc to {}
repeat with i from 1 to nf
tell mReturn(item i of fs)
repeat with j from 1 to nx
set end of acc to |λ|(contents of (item j of xs))
end repeat
end tell
end repeat
return acc
end ap
-- foldl :: (a -> b -> a) -> a -> [b] -> a
on foldl(f, startValue, xs)
tell mReturn(f)
set v to startValue
set lng to length of xs
repeat with i from 1 to lng
set v to |λ|(v, item i of xs, i, xs)
end repeat
return v
end tell
end foldl
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
|
programs/oeis/262/A262734.asm | jmorken/loda | 1 | 24701 | ; A262734: Period 16: repeat (1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2).
; 1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8
add $0,1
lpb $0
sub $0,16
pow $1,$1
lpe
mul $0,2
mul $1,2
trn $1,$0
add $1,4
mul $1,2
add $1,$0
sub $1,10
div $1,2
add $1,1
|
programs/oeis/166/A166539.asm | neoneye/loda | 22 | 94754 | <filename>programs/oeis/166/A166539.asm<gh_stars>10-100
; A166539: a(n) = (10*n + 7*(-1)^n + 5)/4.
; 2,8,7,13,12,18,17,23,22,28,27,33,32,38,37,43,42,48,47,53,52,58,57,63,62,68,67,73,72,78,77,83,82,88,87,93,92,98,97,103,102,108,107,113,112,118,117,123,122,128,127,133,132,138,137,143,142,148,147,153,152,158,157,163,162,168,167,173,172,178,177,183,182,188,187,193,192,198,197,203,202,208,207,213,212,218,217,223,222,228,227,233,232,238,237,243,242,248,247,253
mov $1,32
add $1,$0
div $0,2
mul $0,7
mul $1,6
sub $1,$0
sub $1,190
mov $0,$1
|
patches/koala/code/disasm/koala_fix_nondos.asm | fcatrin/a8tools | 3 | 6768 |
; fix invalid DOS call when used wihout DOS
org $33A7
nop
nop
nop
|
lib/sub/fill-screen.asm | c64lib/common | 7 | 27324 | <gh_stars>1-10
#import "../invoke.asm"
#import "../math.asm"
/*
* Fills given 1024 bytes of memory with given byte.
* IN:
* A - value
* Stack WORD - address
* OUT:
* none
* MOD: A, X
*/
.namespace c64lib {
fillScreen: {
sta value + 1
invokeStackBegin(returnPtr)
pullParamWList(List().add(sta0 + 1, sta1 + 1, sta2 + 1, sta3 + 1))
add16($0100, sta1 + 1)
add16($0200, sta2 + 1)
add16($0300, sta3 + 1)
value: lda #$00
ldx #$00
loop:
sta0: sta $ffff, x
sta1: sta $ffff, x
sta2: sta $ffff, x
sta3: sta $ffff, x
inx
bne loop
invokeStackEnd(returnPtr)
rts
// local vars
returnPtr: .word 0
}
}
|
code/editor/sheet/edit-player.asm | abekermsx/skooted | 3 | 14463 | <reponame>abekermsx/skooted
edit_player:
call get_player_location
ld (sheet_xy),de
ld hl,edit_player_functions
jp edit
edit_player_functions:
dw edit_player_blink_sprite
dw edit_player_restore_sprite
dw edit_player_put_player
dw edit_sheet_delete_pattern
edit_player_put_player:
ld de,(sheet_xy)
call set_player_location
call remove_enemy_at_location
call remove_item_at_location
call remove_heart_at_location
call get_pattern_at_location
cp 5
jr c,edit_player_put_player1
xor a
call set_pattern_at_location
edit_player_put_player1:
ld de,(sheet_xy)
call print_pattern_xy
call print_player_sprite
ret
edit_player_blink_sprite:
call get_player_location
ld hl,(sheet_xy)
call DCOMPR
jr nz,edit_player_blink_sprite2
ld de,14 * 256
edit_player_blink_sprite2:
ld a,SPRITE.PLAYER
call print_sprite_at_location
ld a,(JIFFY)
and 15
cp 8
ld de,(sheet_xy)
jr c,edit_player_show_cursor_sprite2
edit_player_hide_cursor_sprite:
ld de,14 * 256
edit_player_show_cursor_sprite2:
ld a,SPRITE.CURSOR
call print_sprite_at_location
ret
edit_player_restore_sprite:
call get_player_location
ld a,SPRITE.PLAYER
call print_sprite_at_location
jr edit_player_hide_cursor_sprite
|
oeis/117/A117852.asm | neoneye/loda-programs | 11 | 89392 | ; A117852: Mirror image of A098473 formatted as a triangular array.
; Submitted by <NAME>
; 1,2,1,6,4,1,20,18,6,1,70,80,36,8,1,252,350,200,60,10,1,924,1512,1050,400,90,12,1,3432,6468,5292,2450,700,126,14,1,12870,27456,25872,14112,4900,1120,168,16,1,48620,115830,123552,77616,31752,8820,1680,216,18,1,184756,486200,579150,411840,194040,63504,14700,2400,270,20,1,705432,2032316,2674100,2123550,1132560,426888,116424,23100,3300,330,22,1,2704156,8465184,12193896,10696400,6370650,2718144,853776,199584,34650,4400,396,24,1,10400600,35154028,55023696,52840216,34763300,16563690,5889312,1585584
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
bin $1,$0
mov $0,2
mul $0,$2
bin $0,$2
mul $1,16
mul $1,$0
mov $0,$1
div $0,16
|
src/giza-timers.adb | Fabien-Chouteau/Giza | 7 | 8171 | ------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2015 <NAME> (<EMAIL>) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Ada.Real_Time.Timing_Events; use Ada.Real_Time.Timing_Events;
with Giza.GUI; use Giza.GUI;
with System;
package body Giza.Timers is
type Wrapper;
type Wrapper_Access is access all Wrapper;
type Wrapper is record
Event : Timer_Event_Not_Null_Ref;
Timeout : Time;
Next : Wrapper_Access := null;
end record;
procedure Free is new Ada.Unchecked_Deallocation
(Object => Wrapper, Name => Wrapper_Access);
TE : Timing_Event;
----------
-- Sync --
----------
protected Sync is
pragma Priority (System.Interrupt_Priority'Last);
entry Wait;
procedure Wakeup (Event : in out Timing_Event);
procedure Insert (Item : Wrapper_Access);
function Next_Timeout return Time;
procedure Pop (Item : out Wrapper_Access);
private
Triggered : Boolean := False;
List : Wrapper_Access := null;
end Sync;
----------
-- Sync --
----------
protected body Sync is
entry Wait when Triggered is
begin
Triggered := False;
end Wait;
procedure Wakeup (Event : in out Timing_Event) is
pragma Unreferenced (Event);
begin
Triggered := True;
end Wakeup;
procedure Insert (Item : Wrapper_Access) is
Prev, Curr : Wrapper_Access := null;
begin
if List = null or else List.Timeout >= Item.Timeout then
Item.Next := List;
List := Item;
Set_Handler (Event => TE,
At_Time => List.Timeout,
Handler => Sync.Wakeup'Access);
else
Prev := List;
Curr := List;
while Curr /= null and then Curr.Timeout < Item.Timeout loop
Prev := Curr;
Curr := Curr.Next;
end loop;
Prev.Next := Item;
Item.Next := Curr;
end if;
end Insert;
function Next_Timeout return Time is
begin
return (if List /= null then
List.Timeout
else
Time_Last);
end Next_Timeout;
procedure Pop (Item : out Wrapper_Access) is
begin
-- Remove from list
Item := List;
List := List.Next;
end Pop;
end Sync;
---------------
-- Set_Timer --
---------------
procedure Set_Timer
(Timer : Timer_Event_Not_Null_Ref;
Timeout : Time)
is
Item : constant Wrapper_Access :=
new Wrapper'(Event => Timer, Timeout => Timeout, Next => null);
begin
Sync.Insert (Item);
end Set_Timer;
----------------
-- Timer_Task --
----------------
task Timer_Task is
end Timer_Task;
task body Timer_Task is
Now : Time;
Tmp : Wrapper_Access;
begin
loop
Sync.Wait;
-- back from timeout
Now := Clock;
while Sync.Next_Timeout < Now loop
Sync.Pop (Tmp);
if Tmp /= null then
Emit (Event_Not_Null_Ref (Tmp.Event));
-- Destroy wrapper
Free (Tmp);
end if;
end loop;
Set_Handler (Event => TE,
At_Time => Sync.Next_Timeout,
Handler => Sync.Wakeup'Access);
end loop;
end Timer_Task;
end Giza.Timers;
|
KickAssembler/Examples/KoalaShower/KoalaShower.asm | hculpan/6502-sbc | 0 | 166519 | /*---------------------------------------------------------------
KOALA SHOWER
This code displays the Koala picture in the file picture.prg
---------------------------------------------------------------*/
.var picture = LoadBinary("picture.prg", BF_KOALA)
:BasicUpstart2(start)
start:
lda #$38
sta $d018
lda #$d8
sta $d016
lda #$3b
sta $d011
lda #0
sta $d020
lda #picture.getBackgroundColor()
sta $d021
ldx #0
!loop:
.for (var i=0; i<4; i++) {
lda colorRam+i*$100,x
sta $d800+i*$100,x
}
inx
bne !loop-
jmp *
.pc = $0c00 "ScreenRam" .fill picture.getScreenRamSize(), picture.getScreenRam(i)
.pc = $1c00 "ColorRam:" colorRam: .fill picture.getColorRamSize(), picture.getColorRam(i)
.pc = $2000 "Bitmap" .fill picture.getBitmapSize(), picture.getBitmap(i)
|
source/league/ucd/matreshka-internals-unicode-ucd-core_0025.ads | svn2github/matreshka | 24 | 2898 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0025 is
pragma Preelaborate;
Group_0025 : aliased constant Core_Second_Stage
:= (16#4C# .. 16#4F# => -- 254C .. 254F
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#74# => -- 2574
(Other_Symbol, Neutral,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#75# .. 16#7F# => -- 2575 .. 257F
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#90# .. 16#91# => -- 2590 .. 2591
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#96# .. 16#9F# => -- 2596 .. 259F
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A0# .. 16#A1# => -- 25A0 .. 25A1
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#A2# => -- 25A2
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#AA# .. 16#AD# => -- 25AA .. 25AD
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#AE# .. 16#B1# => -- 25AE .. 25B1
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B2# .. 16#B3# => -- 25B2 .. 25B3
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B4# .. 16#B5# => -- 25B4 .. 25B5
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B6# => -- 25B6
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B7# => -- 25B7
(Math_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B8# .. 16#BB# => -- 25B8 .. 25BB
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#BC# .. 16#BD# => -- 25BC .. 25BD
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#BE# .. 16#BF# => -- 25BE .. 25BF
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#C0# => -- 25C0
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#C1# => -- 25C1
(Math_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#C2# .. 16#C5# => -- 25C2 .. 25C5
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#C6# .. 16#C7# => -- 25C6 .. 25C7
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#C9# => -- 25C9
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#CA# => -- 25CA
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#CB# => -- 25CB
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#CC# .. 16#CD# => -- 25CC .. 25CD
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#CF# .. 16#D1# => -- 25CF .. 25D1
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#D2# .. 16#D3# => -- 25D2 .. 25D3
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#D4# .. 16#E1# => -- 25D4 .. 25E1
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#E2# => -- 25E2
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#E4# => -- 25E4
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#E6# => -- 25E6
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#E7# .. 16#EC# => -- 25E7 .. 25EC
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Other_Math
| Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#ED# .. 16#EE# => -- 25ED .. 25EE
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#F0# .. 16#F7# => -- 25F0 .. 25F7
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#F8# .. 16#FF# => -- 25F8 .. 25FF
(Math_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
others =>
(Other_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0025;
|
lib/run-last-terminal-command.scpt | paulatbipsync/run-last-terminal-command | 0 | 728 | tell application "Terminal"
repeat with w in windows
repeat with t in tabs of w
if selected in t then
do script "!!" in t
return
end if
end repeat
end repeat
do script "!!"
end tell
|
programs/oeis/106/A106612.asm | karttu/loda | 0 | 97843 | ; A106612: a(n) = numerator of n/(n+11).
; 0,1,2,3,4,5,6,7,8,9,10,1,12,13,14,15,16,17,18,19,20,21,2,23,24,25,26,27,28,29,30,31,32,3,34,35,36,37,38,39,40,41,42,43,4,45,46,47,48,49,50,51,52,53,54,5,56,57,58,59,60,61,62,63,64,65,6,67,68,69,70,71,72,73,74,75,76,7,78,79,80,81,82,83,84,85,86,87,8,89,90,91,92,93,94,95,96,97,98,9,100,101,102,103,104,105,106,107,108,109,10,111,112,113,114,115,116,117,118,119,120,11,122,123,124,125,126,127,128,129,130,131,12,133,134,135,136,137,138,139,140,141,142,13,144,145,146,147,148,149,150,151,152,153,14,155,156,157,158,159,160,161,162,163,164,15,166,167,168,169,170,171,172,173,174,175,16,177,178,179,180,181,182,183,184,185,186,17,188,189,190,191,192,193,194,195,196,197,18,199,200,201,202,203,204,205,206,207,208,19,210,211,212,213,214,215,216,217,218,219,20,221,222,223,224,225,226,227,228,229,230,21,232,233,234,235,236,237,238,239,240,241,22,243,244,245,246,247,248,249
mov $1,$0
gcd $0,11
div $1,$0
|
demo/adainclude/s-taskin.adb | e3l6/SSMDev | 0 | 21386 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2013, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Ravenscar/HI-E and Ravenscar/full version of this package
pragma Restrictions (No_Elaboration_Code);
-- For Ravenscar/HI-E, this restriction is simply an optimization.
-- For Ravenscar/full, this restriction is required because the Initialize
-- procedure is called by s-init before the elaboration.
pragma Polling (Off);
-- Turn off polling, we do not want ATC polling to take place during tasking
-- operations. It causes infinite loops and other problems.
with System.Task_Primitives.Operations;
-- used for Self
with System.Secondary_Stack;
-- used for SS_Init
-- Default_Secondary_Stack_Size
package body System.Tasking is
use System.Secondary_Stack;
use System.Multiprocessors;
------------------------
-- Local Declarations --
------------------------
Main_Priority : Integer := Unspecified_Priority;
pragma Export (C, Main_Priority, "__gl_main_priority");
-- Priority associated with the environment task. By default, its value is
-- undefined, and can be set by using pragma Priority in the main program.
Main_CPU : Integer := Unspecified_CPU;
pragma Export (C, Main_CPU, "__gl_main_cpu");
-- Affinity associated with the environment task. By default, its value is
-- undefined, and can be set by using pragma CPU in the main program.
-- Switching the environment task to the right CPU is left to the user.
Environment_Task : array (Multiprocessors.CPU) of
aliased Ada_Task_Control_Block (Entry_Num => 0);
-- ATCB for the environment tasks. The environment task for the main CPU
-- is the real one, while the others are phantom tasks only present to
-- correctly handle interrupts (changing the current priority). The name
-- is of this array is 'Environment_Task' so that there is a nice display
-- of the environmental task in GDB (which uses the suffix of the symbol).
-------------------
-- Get_Sec_Stack --
-------------------
function Get_Sec_Stack return Address is
begin
return Self.Common.Compiler_Data.Sec_Stack_Addr;
end Get_Sec_Stack;
---------------------
-- Initialize_ATCB --
---------------------
procedure Initialize_ATCB
(Task_Entry_Point : Task_Procedure_Access;
Task_Arg : System.Address;
Base_Priority : System.Any_Priority;
Base_CPU : System.Multiprocessors.CPU_Range;
Task_Info : System.Task_Info.Task_Info_Type;
Stack_Address : System.Address;
Stack_Size : System.Parameters.Size_Type;
T : Task_Id;
Success : out Boolean)
is
begin
T.Common.State := Unactivated;
-- Initialize T.Common.LL
Task_Primitives.Operations.Initialize_TCB (T, Success);
if not Success then
return;
end if;
T.Common.Base_Priority := Base_Priority;
T.Common.Base_CPU := Base_CPU;
T.Common.Protected_Action_Nesting := 0;
T.Common.Task_Arg := Task_Arg;
T.Common.Task_Entry_Point := Task_Entry_Point;
T.Common.Task_Info := Task_Info;
T.Common.Compiler_Data.Pri_Stack_Info.Start_Address :=
Stack_Address;
T.Common.Compiler_Data.Pri_Stack_Info.Size :=
Storage_Elements.Storage_Offset
(Parameters.Adjust_Storage_Size (Stack_Size));
end Initialize_ATCB;
----------------
-- Initialize --
----------------
Secondary_Stack : aliased Storage_Elements.Storage_Array
(1 .. Storage_Elements.Storage_Offset
(Default_Secondary_Stack_Size));
for Secondary_Stack'Alignment use Standard'Maximum_Alignment;
pragma Warnings (Off, Secondary_Stack);
Initialized : Boolean := False;
-- Used to prevent multiple calls to Initialize
procedure Initialize is
Base_Priority : Any_Priority;
Base_CPU : System.Multiprocessors.CPU;
Success : Boolean;
pragma Warnings (Off, Success);
CPU_Not_In_Range : Boolean := False;
begin
if Initialized then
return;
end if;
Initialized := True;
-- Legal values of CPU are the special Unspecified_CPU value which is
-- inserted by the compiler for tasks without CPU aspect, and those in
-- the range of CPU_Range but no greater than Number_Of_CPUs. Otherwise
-- the task is defined to have failed, and it becomes a completed task
-- (RM D.16(14/3)).
if Main_CPU /= Unspecified_CPU
and then (Main_CPU < Integer (System.Multiprocessors.CPU_Range'First)
or else
Main_CPU > Integer (System.Multiprocessors.CPU_Range'Last)
or else
Main_CPU > Integer (System.Multiprocessors.Number_Of_CPUs))
then
-- Invalid CPU, will raise Tasking_Error after the environment task
-- is initialized (as exception propagation is supported in full
-- ravenscar profile)
CPU_Not_In_Range := True;
-- Use the default CPU as Main_CPU
Base_CPU := CPU'First;
else
Base_CPU :=
(if Main_CPU = Unspecified_CPU
or else CPU_Range (Main_CPU) = Not_A_Specific_CPU
then CPU'First -- Default CPU
else CPU (Main_CPU));
end if;
-- Set Main_CPU with the selected CPU value
-- (instead of Unspecified_CPU or Not_A_Specific_CPU)
Main_CPU := Integer (Base_CPU);
if Main_Priority = Unspecified_Priority then
Base_Priority := Default_Priority;
else
Base_Priority := Main_Priority;
end if;
Initialize_ATCB
(null, Null_Address, Base_Priority, Base_CPU,
Task_Info.Unspecified_Task_Info, Null_Address, 0,
Environment_Task (Base_CPU)'Access, Success);
Task_Primitives.Operations.Initialize
(Environment_Task (Base_CPU)'Access);
-- Note: we used to set the priority at this point, but it is already
-- done in Enter_Task via s-taprop.Initialize.
Environment_Task (Base_CPU).Common.State := Runnable;
Environment_Task (Base_CPU).Entry_Call.Self :=
Environment_Task (Base_CPU)'Access;
-- Initialize the secondary stack
Environment_Task (Base_CPU).Common.Compiler_Data.Sec_Stack_Addr :=
Secondary_Stack'Address;
SS_Init (Secondary_Stack'Address, Default_Secondary_Stack_Size);
-- No fall back handler by default
Fall_Back_Handler := null;
-- Deferred exception if CPU is invalid
if CPU_Not_In_Range then
raise Tasking_Error with "Main CPU not in range";
end if;
end Initialize;
----------------------
-- Initialize_Slave --
----------------------
procedure Initialize_Slave (CPU_Id : CPU) is
Base_Priority : constant Any_Priority := System.Any_Priority'First;
Success : Boolean;
pragma Warnings (Off, Success);
begin
-- Initialize a fake environment task for this slave CPU
Initialize_ATCB
(null, Null_Address, Base_Priority, CPU_Id,
Task_Info.Unspecified_Task_Info, Null_Address, 0,
Environment_Task (CPU_Id)'Access, Success);
Task_Primitives.Operations.Initialize_Slave
(Environment_Task (CPU_Id)'Access);
Task_Primitives.Operations.Set_Priority
(Environment_Task (CPU_Id)'Access, Base_Priority);
Environment_Task (CPU_Id).Entry_Call.Self :=
Environment_Task (CPU_Id)'Access;
-- The task has no code to execute and will stay in an unactivated state
Environment_Task (CPU_Id).Common.State := Unactivated;
-- This call to the sleep procedure will force the current CPU to start
-- execution of its tasks.
Task_Primitives.Operations.Sleep
(Environment_Task (CPU_Id)'Access, Unactivated);
end Initialize_Slave;
----------
-- Self --
----------
function Self return Task_Id renames System.Task_Primitives.Operations.Self;
-------------------
-- Set_Sec_Stack --
-------------------
procedure Set_Sec_Stack (Stk : Address) is
begin
Self.Common.Compiler_Data.Sec_Stack_Addr := Stk;
end Set_Sec_Stack;
------------------
-- Storage_Size --
------------------
function Storage_Size (T : Task_Id) return System.Parameters.Size_Type is
begin
return
System.Parameters.Size_Type
(T.Common.Compiler_Data.Pri_Stack_Info.Size);
end Storage_Size;
end System.Tasking;
|
awa/plugins/awa-mail/src/awa-mail-clients-files.ads | My-Colaborations/ada-awa | 81 | 27835 | -----------------------------------------------------------------------
-- awa-mail-clients-files -- Mail client dump/file implementation
-- Copyright (C) 2012, 2014, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Util.Properties;
with Util.Concurrent.Counters;
-- The <b>AWA.Mail.Clients.Files</b> package provides a dump implementation of the
-- mail client interfaces on top of raw system files.
package AWA.Mail.Clients.Files is
NAME : constant String := "file";
-- ------------------------------
-- Mail Message
-- ------------------------------
-- The <b>File_Mail_Message</b> represents a mail message that is written on a file in
-- in specific directory.
type File_Mail_Message is new Mail_Message with private;
type File_Mail_Message_Access is access all File_Mail_Message'Class;
-- Set the <tt>From</tt> part of the message.
overriding
procedure Set_From (Message : in out File_Mail_Message;
Name : in String;
Address : in String);
-- Add a recipient for the message.
overriding
procedure Add_Recipient (Message : in out File_Mail_Message;
Kind : in Recipient_Type;
Name : in String;
Address : in String);
-- Set the subject of the message.
overriding
procedure Set_Subject (Message : in out File_Mail_Message;
Subject : in String);
-- Set the body of the message.
overriding
procedure Set_Body (Message : in out File_Mail_Message;
Content : in Unbounded_String;
Alternative : in Unbounded_String;
Content_Type : in String);
-- Add an attachment with the given content.
overriding
procedure Add_Attachment (Message : in out File_Mail_Message;
Content : in Unbounded_String;
Content_Id : in String;
Content_Type : in String);
overriding
procedure Add_File_Attachment (Message : in out File_Mail_Message;
Filename : in String;
Content_Id : in String;
Content_Type : in String);
-- Send the email message.
overriding
procedure Send (Message : in out File_Mail_Message);
-- ------------------------------
-- Mail Manager
-- ------------------------------
-- The <b>Mail_Manager</b> is the entry point to create a new mail message
-- and be able to send it.
type File_Mail_Manager is limited new Mail_Manager with private;
type File_Mail_Manager_Access is access all File_Mail_Manager'Class;
-- Create a file based mail manager and configure it according to the properties.
function Create_Manager (Props : in Util.Properties.Manager'Class) return Mail_Manager_Access;
-- Create a new mail message.
overriding
function Create_Message (Manager : in File_Mail_Manager) return Mail_Message_Access;
private
type File_Mail_Message is new Mail_Message with record
Manager : File_Mail_Manager_Access;
From : Ada.Strings.Unbounded.Unbounded_String;
To : Ada.Strings.Unbounded.Unbounded_String;
Cc : Ada.Strings.Unbounded.Unbounded_String;
Bcc : Ada.Strings.Unbounded.Unbounded_String;
Subject : Ada.Strings.Unbounded.Unbounded_String;
Message : Ada.Strings.Unbounded.Unbounded_String;
Html : Ada.Strings.Unbounded.Unbounded_String;
Attachments : Ada.Strings.Unbounded.Unbounded_String;
end record;
type File_Mail_Manager is limited new Mail_Manager with record
Self : File_Mail_Manager_Access;
Path : Ada.Strings.Unbounded.Unbounded_String;
Index : Util.Concurrent.Counters.Counter;
end record;
end AWA.Mail.Clients.Files;
|
9.asm | AsadKhalil/Assembly_x86 | 0 | 161700 | <filename>9.asm
[org 0x0100]
jmp start
invertscr:
mov ax, 0xb800 ;moving video base in ax
mov es, ax ;pointing es to video base
mov di, 0 ;pointing di to the top left coloumn
mov cx, 0 ;intializing cx with 0
mov dx, 25 ;total rows
outterloop:
add cx, 160
mov bx, 0 ;for counting number of elements in stack
innerloop:
mov ax, [es:di]
push ax
add di, 2 ;adding 2 in di to move to the next char
inc bx ;updating number of elements in stack
cmp di, cx ;has the whole line been added in the stack
jnz innerloop
mov ax, di
sub ax, 160
mov si, ax ;entering ending position of line in si
invert:
;inverting the line
pop ax
mov [es: si], ax
dec bx
add si, 2
cmp bx, 0
jnz invert
dec dx ;updating number of rows left to be inverted
cmp dx, 0
jnz outterloop
ret
start:
call invertscr
finish:
mov ax, 0x04c00
int 21h |
assets/as-hdr.applescript | doekman/osagitfilter | 29 | 1276 | <reponame>doekman/osagitfilter<filename>assets/as-hdr.applescript
#@osa-lang:AppleScript
on run (arg)
-- Some unicode test in Dutch
log "Skiën ⛷ kost veel €"
end run
|
libsrc/graphics/point.asm | jpoikela/z88dk | 38 | 168109 | ;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Stubs Written by <NAME> - 30/9/98
;
;
; $Id: point.asm $
;
; CALLER LINKAGE FOR FUNCTION POINTERS
; ----- void point(int x, int y)
;Result is true/false
SECTION code_graphics
PUBLIC point
PUBLIC _point
EXTERN point_callee
EXTERN ASMDISP_POINT_CALLEE
.point
._point
pop af ; ret addr
pop hl ; y
pop de
push de
push hl
ld h,e ; x
push af ; ret addr
jp point_callee + ASMDISP_POINT_CALLEE
|
FoldingText.lbaction/Contents/Scripts/marked.scpt | raguay/MyLaunchBarActions | 29 | 636 | property pTitle : "Open FoldingText file in Marked"
property pVer : "0.02"
property pAuthor : "<NAME>"
property pblnPositionWindows : true -- Set this to false to disable the window positioning at the end of the script
tell application "FoldingText"
set lstDocs to documents
if lstDocs = {} then return
set {strName, oFile} to {name, file} of item 1 of lstDocs
activate
if oFile is missing value then
display dialog "The document: " & return & return & strName & ¬
return & return & "needs to be saved before Marked can preview it." buttons {"OK"} ¬
default button "OK" with title pTitle & " ver. " & pVer
return
end if
end tell
---- Marked
tell application "Marked 2.app"
activate
open oFile
end tell
-- Try to position windows left and right (to disable this, if it doesn't suit your workflow or yourscreen setup,
-- set pblnPositionWindows at the top of the script to false )
if pblnPositionWindows then
set lngWidth to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print$2}'")
set lngHeight to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print$4}'")
set lngHalf to lngWidth / 2
set lngHeight to lngHeight - 22
tell application id "sevs"
tell process "Marked" to tell window 1 to set {position, size} to {{lngHalf, 22}, {lngHalf,lngHeight}}
tell process "FoldingText" to tell window 1 to set {position, size} to {{0, 22}, {lngHalf,lngHeight}}
end tell
end if |
Transynther/x86/_processed/NC/_ht_zr_/i7-8650U_0xd2.log_21829_1229.asm | ljhsiun2/medusa | 9 | 13381 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1c824, %rbx
clflush (%rbx)
inc %r10
mov (%rbx), %rdx
nop
nop
nop
nop
inc %r11
lea addresses_WT_ht+0x16c24, %rbx
clflush (%rbx)
nop
nop
nop
nop
cmp %r12, %r12
movb (%rbx), %al
nop
sub %rdx, %rdx
lea addresses_normal_ht+0x1ee4b, %r11
nop
nop
nop
nop
sub $54271, %rdi
movups (%r11), %xmm3
vpextrq $1, %xmm3, %r10
nop
sub $39895, %rbx
lea addresses_WC_ht+0xec54, %r12
nop
add $62052, %rdi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm6
movups %xmm6, (%r12)
nop
nop
nop
nop
nop
dec %rax
lea addresses_D_ht+0x5ce4, %rdx
nop
nop
nop
nop
and $36381, %r12
movb (%rdx), %bl
add %rdi, %rdi
lea addresses_A_ht+0x12824, %rsi
lea addresses_A_ht+0x3f74, %rdi
nop
nop
nop
cmp $5198, %r10
mov $45, %rcx
rep movsb
nop
sub %rsi, %rsi
lea addresses_normal_ht+0x3824, %rax
nop
nop
nop
nop
nop
add $31306, %rdx
movl $0x61626364, (%rax)
nop
cmp $27799, %rdx
lea addresses_normal_ht+0x1c824, %r10
nop
nop
nop
nop
nop
and $13697, %rbx
vmovups (%r10), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
nop
nop
nop
nop
and $57326, %rcx
lea addresses_UC_ht+0x190a4, %rdi
nop
nop
nop
xor %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm1
movups %xmm1, (%rdi)
nop
nop
nop
cmp $61465, %rdi
lea addresses_D_ht+0x1b624, %rdi
nop
nop
and $38769, %r11
movw $0x6162, (%rdi)
nop
nop
inc %rsi
lea addresses_UC_ht+0x3b24, %rsi
lea addresses_WC_ht+0x1dda4, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $49, %rcx
rep movsw
nop
nop
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x174fc, %r11
nop
dec %rax
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
vmovups %ymm5, (%r11)
and $36409, %rdi
lea addresses_WC_ht+0x1a344, %rsi
lea addresses_A_ht+0xe324, %rdi
cmp $52688, %rax
mov $2, %rcx
rep movsq
nop
sub $10885, %rcx
lea addresses_WT_ht+0xb464, %rax
and $38132, %rbx
movl $0x61626364, (%rax)
nop
nop
nop
nop
cmp $6602, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %rbx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_US+0x1b95c, %r10
nop
nop
cmp $19393, %rdx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm5
movups %xmm5, (%r10)
nop
nop
nop
nop
add $55345, %r10
// Faulty Load
mov $0x7e6db60000000824, %r11
nop
nop
add $45272, %rbx
movups (%r11), %xmm3
vpextrq $1, %xmm3, %r10
lea oracles, %rbx
and $0xff, %r10
shlq $12, %r10
mov (%rbx,%r10,1), %r10
pop %rsi
pop %rdx
pop %rdi
pop %rbx
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'00': 21724, '44': 41, '48': 47, '45': 17}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
zombie.asm | dmansilva/OSProject03 | 0 | 91130 |
_zombie: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 10 sub $0x10,%esp
if(fork() > 0)
9: e8 62 02 00 00 call 270 <fork>
e: 85 c0 test %eax,%eax
10: 7e 0c jle 1e <main+0x1e>
sleep(5); // Let child exit before parent.
12: c7 04 24 05 00 00 00 movl $0x5,(%esp)
19: e8 ea 02 00 00 call 308 <sleep>
exit();
1e: e8 55 02 00 00 call 278 <exit>
23: 90 nop
00000024 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
24: 55 push %ebp
25: 89 e5 mov %esp,%ebp
27: 57 push %edi
28: 53 push %ebx
asm volatile("cld; rep stosb" :
29: 8b 4d 08 mov 0x8(%ebp),%ecx
2c: 8b 55 10 mov 0x10(%ebp),%edx
2f: 8b 45 0c mov 0xc(%ebp),%eax
32: 89 cb mov %ecx,%ebx
34: 89 df mov %ebx,%edi
36: 89 d1 mov %edx,%ecx
38: fc cld
39: f3 aa rep stos %al,%es:(%edi)
3b: 89 ca mov %ecx,%edx
3d: 89 fb mov %edi,%ebx
3f: 89 5d 08 mov %ebx,0x8(%ebp)
42: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
45: 5b pop %ebx
46: 5f pop %edi
47: 5d pop %ebp
48: c3 ret
00000049 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
49: 55 push %ebp
4a: 89 e5 mov %esp,%ebp
4c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
4f: 8b 45 08 mov 0x8(%ebp),%eax
52: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
55: 90 nop
56: 8b 45 08 mov 0x8(%ebp),%eax
59: 8d 50 01 lea 0x1(%eax),%edx
5c: 89 55 08 mov %edx,0x8(%ebp)
5f: 8b 55 0c mov 0xc(%ebp),%edx
62: 8d 4a 01 lea 0x1(%edx),%ecx
65: 89 4d 0c mov %ecx,0xc(%ebp)
68: 8a 12 mov (%edx),%dl
6a: 88 10 mov %dl,(%eax)
6c: 8a 00 mov (%eax),%al
6e: 84 c0 test %al,%al
70: 75 e4 jne 56 <strcpy+0xd>
;
return os;
72: 8b 45 fc mov -0x4(%ebp),%eax
}
75: c9 leave
76: c3 ret
00000077 <strcmp>:
int
strcmp(const char *p, const char *q)
{
77: 55 push %ebp
78: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
7a: eb 06 jmp 82 <strcmp+0xb>
p++, q++;
7c: ff 45 08 incl 0x8(%ebp)
7f: ff 45 0c incl 0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
82: 8b 45 08 mov 0x8(%ebp),%eax
85: 8a 00 mov (%eax),%al
87: 84 c0 test %al,%al
89: 74 0e je 99 <strcmp+0x22>
8b: 8b 45 08 mov 0x8(%ebp),%eax
8e: 8a 10 mov (%eax),%dl
90: 8b 45 0c mov 0xc(%ebp),%eax
93: 8a 00 mov (%eax),%al
95: 38 c2 cmp %al,%dl
97: 74 e3 je 7c <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
99: 8b 45 08 mov 0x8(%ebp),%eax
9c: 8a 00 mov (%eax),%al
9e: 0f b6 d0 movzbl %al,%edx
a1: 8b 45 0c mov 0xc(%ebp),%eax
a4: 8a 00 mov (%eax),%al
a6: 0f b6 c0 movzbl %al,%eax
a9: 29 c2 sub %eax,%edx
ab: 89 d0 mov %edx,%eax
}
ad: 5d pop %ebp
ae: c3 ret
000000af <strlen>:
uint
strlen(char *s)
{
af: 55 push %ebp
b0: 89 e5 mov %esp,%ebp
b2: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
b5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
bc: eb 03 jmp c1 <strlen+0x12>
be: ff 45 fc incl -0x4(%ebp)
c1: 8b 55 fc mov -0x4(%ebp),%edx
c4: 8b 45 08 mov 0x8(%ebp),%eax
c7: 01 d0 add %edx,%eax
c9: 8a 00 mov (%eax),%al
cb: 84 c0 test %al,%al
cd: 75 ef jne be <strlen+0xf>
;
return n;
cf: 8b 45 fc mov -0x4(%ebp),%eax
}
d2: c9 leave
d3: c3 ret
000000d4 <memset>:
void*
memset(void *dst, int c, uint n)
{
d4: 55 push %ebp
d5: 89 e5 mov %esp,%ebp
d7: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
da: 8b 45 10 mov 0x10(%ebp),%eax
dd: 89 44 24 08 mov %eax,0x8(%esp)
e1: 8b 45 0c mov 0xc(%ebp),%eax
e4: 89 44 24 04 mov %eax,0x4(%esp)
e8: 8b 45 08 mov 0x8(%ebp),%eax
eb: 89 04 24 mov %eax,(%esp)
ee: e8 31 ff ff ff call 24 <stosb>
return dst;
f3: 8b 45 08 mov 0x8(%ebp),%eax
}
f6: c9 leave
f7: c3 ret
000000f8 <strchr>:
char*
strchr(const char *s, char c)
{
f8: 55 push %ebp
f9: 89 e5 mov %esp,%ebp
fb: 83 ec 04 sub $0x4,%esp
fe: 8b 45 0c mov 0xc(%ebp),%eax
101: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
104: eb 12 jmp 118 <strchr+0x20>
if(*s == c)
106: 8b 45 08 mov 0x8(%ebp),%eax
109: 8a 00 mov (%eax),%al
10b: 3a 45 fc cmp -0x4(%ebp),%al
10e: 75 05 jne 115 <strchr+0x1d>
return (char*)s;
110: 8b 45 08 mov 0x8(%ebp),%eax
113: eb 11 jmp 126 <strchr+0x2e>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
115: ff 45 08 incl 0x8(%ebp)
118: 8b 45 08 mov 0x8(%ebp),%eax
11b: 8a 00 mov (%eax),%al
11d: 84 c0 test %al,%al
11f: 75 e5 jne 106 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
121: b8 00 00 00 00 mov $0x0,%eax
}
126: c9 leave
127: c3 ret
00000128 <gets>:
char*
gets(char *buf, int max)
{
128: 55 push %ebp
129: 89 e5 mov %esp,%ebp
12b: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
12e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
135: eb 49 jmp 180 <gets+0x58>
cc = read(0, &c, 1);
137: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
13e: 00
13f: 8d 45 ef lea -0x11(%ebp),%eax
142: 89 44 24 04 mov %eax,0x4(%esp)
146: c7 04 24 00 00 00 00 movl $0x0,(%esp)
14d: e8 3e 01 00 00 call 290 <read>
152: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
155: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
159: 7f 02 jg 15d <gets+0x35>
break;
15b: eb 2c jmp 189 <gets+0x61>
buf[i++] = c;
15d: 8b 45 f4 mov -0xc(%ebp),%eax
160: 8d 50 01 lea 0x1(%eax),%edx
163: 89 55 f4 mov %edx,-0xc(%ebp)
166: 89 c2 mov %eax,%edx
168: 8b 45 08 mov 0x8(%ebp),%eax
16b: 01 c2 add %eax,%edx
16d: 8a 45 ef mov -0x11(%ebp),%al
170: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
172: 8a 45 ef mov -0x11(%ebp),%al
175: 3c 0a cmp $0xa,%al
177: 74 10 je 189 <gets+0x61>
179: 8a 45 ef mov -0x11(%ebp),%al
17c: 3c 0d cmp $0xd,%al
17e: 74 09 je 189 <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
180: 8b 45 f4 mov -0xc(%ebp),%eax
183: 40 inc %eax
184: 3b 45 0c cmp 0xc(%ebp),%eax
187: 7c ae jl 137 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
189: 8b 55 f4 mov -0xc(%ebp),%edx
18c: 8b 45 08 mov 0x8(%ebp),%eax
18f: 01 d0 add %edx,%eax
191: c6 00 00 movb $0x0,(%eax)
return buf;
194: 8b 45 08 mov 0x8(%ebp),%eax
}
197: c9 leave
198: c3 ret
00000199 <stat>:
int
stat(char *n, struct stat *st)
{
199: 55 push %ebp
19a: 89 e5 mov %esp,%ebp
19c: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
19f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1a6: 00
1a7: 8b 45 08 mov 0x8(%ebp),%eax
1aa: 89 04 24 mov %eax,(%esp)
1ad: e8 06 01 00 00 call 2b8 <open>
1b2: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1b5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1b9: 79 07 jns 1c2 <stat+0x29>
return -1;
1bb: b8 ff ff ff ff mov $0xffffffff,%eax
1c0: eb 23 jmp 1e5 <stat+0x4c>
r = fstat(fd, st);
1c2: 8b 45 0c mov 0xc(%ebp),%eax
1c5: 89 44 24 04 mov %eax,0x4(%esp)
1c9: 8b 45 f4 mov -0xc(%ebp),%eax
1cc: 89 04 24 mov %eax,(%esp)
1cf: e8 fc 00 00 00 call 2d0 <fstat>
1d4: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
1d7: 8b 45 f4 mov -0xc(%ebp),%eax
1da: 89 04 24 mov %eax,(%esp)
1dd: e8 be 00 00 00 call 2a0 <close>
return r;
1e2: 8b 45 f0 mov -0x10(%ebp),%eax
}
1e5: c9 leave
1e6: c3 ret
000001e7 <atoi>:
int
atoi(const char *s)
{
1e7: 55 push %ebp
1e8: 89 e5 mov %esp,%ebp
1ea: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
1ed: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
1f4: eb 24 jmp 21a <atoi+0x33>
n = n*10 + *s++ - '0';
1f6: 8b 55 fc mov -0x4(%ebp),%edx
1f9: 89 d0 mov %edx,%eax
1fb: c1 e0 02 shl $0x2,%eax
1fe: 01 d0 add %edx,%eax
200: 01 c0 add %eax,%eax
202: 89 c1 mov %eax,%ecx
204: 8b 45 08 mov 0x8(%ebp),%eax
207: 8d 50 01 lea 0x1(%eax),%edx
20a: 89 55 08 mov %edx,0x8(%ebp)
20d: 8a 00 mov (%eax),%al
20f: 0f be c0 movsbl %al,%eax
212: 01 c8 add %ecx,%eax
214: 83 e8 30 sub $0x30,%eax
217: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
21a: 8b 45 08 mov 0x8(%ebp),%eax
21d: 8a 00 mov (%eax),%al
21f: 3c 2f cmp $0x2f,%al
221: 7e 09 jle 22c <atoi+0x45>
223: 8b 45 08 mov 0x8(%ebp),%eax
226: 8a 00 mov (%eax),%al
228: 3c 39 cmp $0x39,%al
22a: 7e ca jle 1f6 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
22c: 8b 45 fc mov -0x4(%ebp),%eax
}
22f: c9 leave
230: c3 ret
00000231 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
231: 55 push %ebp
232: 89 e5 mov %esp,%ebp
234: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
237: 8b 45 08 mov 0x8(%ebp),%eax
23a: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
23d: 8b 45 0c mov 0xc(%ebp),%eax
240: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
243: eb 16 jmp 25b <memmove+0x2a>
*dst++ = *src++;
245: 8b 45 fc mov -0x4(%ebp),%eax
248: 8d 50 01 lea 0x1(%eax),%edx
24b: 89 55 fc mov %edx,-0x4(%ebp)
24e: 8b 55 f8 mov -0x8(%ebp),%edx
251: 8d 4a 01 lea 0x1(%edx),%ecx
254: 89 4d f8 mov %ecx,-0x8(%ebp)
257: 8a 12 mov (%edx),%dl
259: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
25b: 8b 45 10 mov 0x10(%ebp),%eax
25e: 8d 50 ff lea -0x1(%eax),%edx
261: 89 55 10 mov %edx,0x10(%ebp)
264: 85 c0 test %eax,%eax
266: 7f dd jg 245 <memmove+0x14>
*dst++ = *src++;
return vdst;
268: 8b 45 08 mov 0x8(%ebp),%eax
}
26b: c9 leave
26c: c3 ret
26d: 90 nop
26e: 90 nop
26f: 90 nop
00000270 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
270: b8 01 00 00 00 mov $0x1,%eax
275: cd 40 int $0x40
277: c3 ret
00000278 <exit>:
SYSCALL(exit)
278: b8 02 00 00 00 mov $0x2,%eax
27d: cd 40 int $0x40
27f: c3 ret
00000280 <wait>:
SYSCALL(wait)
280: b8 03 00 00 00 mov $0x3,%eax
285: cd 40 int $0x40
287: c3 ret
00000288 <pipe>:
SYSCALL(pipe)
288: b8 04 00 00 00 mov $0x4,%eax
28d: cd 40 int $0x40
28f: c3 ret
00000290 <read>:
SYSCALL(read)
290: b8 05 00 00 00 mov $0x5,%eax
295: cd 40 int $0x40
297: c3 ret
00000298 <write>:
SYSCALL(write)
298: b8 10 00 00 00 mov $0x10,%eax
29d: cd 40 int $0x40
29f: c3 ret
000002a0 <close>:
SYSCALL(close)
2a0: b8 15 00 00 00 mov $0x15,%eax
2a5: cd 40 int $0x40
2a7: c3 ret
000002a8 <kill>:
SYSCALL(kill)
2a8: b8 06 00 00 00 mov $0x6,%eax
2ad: cd 40 int $0x40
2af: c3 ret
000002b0 <exec>:
SYSCALL(exec)
2b0: b8 07 00 00 00 mov $0x7,%eax
2b5: cd 40 int $0x40
2b7: c3 ret
000002b8 <open>:
SYSCALL(open)
2b8: b8 0f 00 00 00 mov $0xf,%eax
2bd: cd 40 int $0x40
2bf: c3 ret
000002c0 <mknod>:
SYSCALL(mknod)
2c0: b8 11 00 00 00 mov $0x11,%eax
2c5: cd 40 int $0x40
2c7: c3 ret
000002c8 <unlink>:
SYSCALL(unlink)
2c8: b8 12 00 00 00 mov $0x12,%eax
2cd: cd 40 int $0x40
2cf: c3 ret
000002d0 <fstat>:
SYSCALL(fstat)
2d0: b8 08 00 00 00 mov $0x8,%eax
2d5: cd 40 int $0x40
2d7: c3 ret
000002d8 <link>:
SYSCALL(link)
2d8: b8 13 00 00 00 mov $0x13,%eax
2dd: cd 40 int $0x40
2df: c3 ret
000002e0 <mkdir>:
SYSCALL(mkdir)
2e0: b8 14 00 00 00 mov $0x14,%eax
2e5: cd 40 int $0x40
2e7: c3 ret
000002e8 <chdir>:
SYSCALL(chdir)
2e8: b8 09 00 00 00 mov $0x9,%eax
2ed: cd 40 int $0x40
2ef: c3 ret
000002f0 <dup>:
SYSCALL(dup)
2f0: b8 0a 00 00 00 mov $0xa,%eax
2f5: cd 40 int $0x40
2f7: c3 ret
000002f8 <getpid>:
SYSCALL(getpid)
2f8: b8 0b 00 00 00 mov $0xb,%eax
2fd: cd 40 int $0x40
2ff: c3 ret
00000300 <sbrk>:
SYSCALL(sbrk)
300: b8 0c 00 00 00 mov $0xc,%eax
305: cd 40 int $0x40
307: c3 ret
00000308 <sleep>:
SYSCALL(sleep)
308: b8 0d 00 00 00 mov $0xd,%eax
30d: cd 40 int $0x40
30f: c3 ret
00000310 <uptime>:
SYSCALL(uptime)
310: b8 0e 00 00 00 mov $0xe,%eax
315: cd 40 int $0x40
317: c3 ret
00000318 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
318: 55 push %ebp
319: 89 e5 mov %esp,%ebp
31b: 83 ec 18 sub $0x18,%esp
31e: 8b 45 0c mov 0xc(%ebp),%eax
321: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
324: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
32b: 00
32c: 8d 45 f4 lea -0xc(%ebp),%eax
32f: 89 44 24 04 mov %eax,0x4(%esp)
333: 8b 45 08 mov 0x8(%ebp),%eax
336: 89 04 24 mov %eax,(%esp)
339: e8 5a ff ff ff call 298 <write>
}
33e: c9 leave
33f: c3 ret
00000340 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 56 push %esi
344: 53 push %ebx
345: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
348: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
34f: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
353: 74 17 je 36c <printint+0x2c>
355: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
359: 79 11 jns 36c <printint+0x2c>
neg = 1;
35b: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
362: 8b 45 0c mov 0xc(%ebp),%eax
365: f7 d8 neg %eax
367: 89 45 ec mov %eax,-0x14(%ebp)
36a: eb 06 jmp 372 <printint+0x32>
} else {
x = xx;
36c: 8b 45 0c mov 0xc(%ebp),%eax
36f: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
372: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
379: 8b 4d f4 mov -0xc(%ebp),%ecx
37c: 8d 41 01 lea 0x1(%ecx),%eax
37f: 89 45 f4 mov %eax,-0xc(%ebp)
382: 8b 5d 10 mov 0x10(%ebp),%ebx
385: 8b 45 ec mov -0x14(%ebp),%eax
388: ba 00 00 00 00 mov $0x0,%edx
38d: f7 f3 div %ebx
38f: 89 d0 mov %edx,%eax
391: 8a 80 08 0a 00 00 mov 0xa08(%eax),%al
397: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
39b: 8b 75 10 mov 0x10(%ebp),%esi
39e: 8b 45 ec mov -0x14(%ebp),%eax
3a1: ba 00 00 00 00 mov $0x0,%edx
3a6: f7 f6 div %esi
3a8: 89 45 ec mov %eax,-0x14(%ebp)
3ab: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3af: 75 c8 jne 379 <printint+0x39>
if(neg)
3b1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3b5: 74 10 je 3c7 <printint+0x87>
buf[i++] = '-';
3b7: 8b 45 f4 mov -0xc(%ebp),%eax
3ba: 8d 50 01 lea 0x1(%eax),%edx
3bd: 89 55 f4 mov %edx,-0xc(%ebp)
3c0: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
3c5: eb 1e jmp 3e5 <printint+0xa5>
3c7: eb 1c jmp 3e5 <printint+0xa5>
putc(fd, buf[i]);
3c9: 8d 55 dc lea -0x24(%ebp),%edx
3cc: 8b 45 f4 mov -0xc(%ebp),%eax
3cf: 01 d0 add %edx,%eax
3d1: 8a 00 mov (%eax),%al
3d3: 0f be c0 movsbl %al,%eax
3d6: 89 44 24 04 mov %eax,0x4(%esp)
3da: 8b 45 08 mov 0x8(%ebp),%eax
3dd: 89 04 24 mov %eax,(%esp)
3e0: e8 33 ff ff ff call 318 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3e5: ff 4d f4 decl -0xc(%ebp)
3e8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3ec: 79 db jns 3c9 <printint+0x89>
putc(fd, buf[i]);
}
3ee: 83 c4 30 add $0x30,%esp
3f1: 5b pop %ebx
3f2: 5e pop %esi
3f3: 5d pop %ebp
3f4: c3 ret
000003f5 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3f5: 55 push %ebp
3f6: 89 e5 mov %esp,%ebp
3f8: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
3fb: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
402: 8d 45 0c lea 0xc(%ebp),%eax
405: 83 c0 04 add $0x4,%eax
408: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
40b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
412: e9 77 01 00 00 jmp 58e <printf+0x199>
c = fmt[i] & 0xff;
417: 8b 55 0c mov 0xc(%ebp),%edx
41a: 8b 45 f0 mov -0x10(%ebp),%eax
41d: 01 d0 add %edx,%eax
41f: 8a 00 mov (%eax),%al
421: 0f be c0 movsbl %al,%eax
424: 25 ff 00 00 00 and $0xff,%eax
429: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
42c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
430: 75 2c jne 45e <printf+0x69>
if(c == '%'){
432: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
436: 75 0c jne 444 <printf+0x4f>
state = '%';
438: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
43f: e9 47 01 00 00 jmp 58b <printf+0x196>
} else {
putc(fd, c);
444: 8b 45 e4 mov -0x1c(%ebp),%eax
447: 0f be c0 movsbl %al,%eax
44a: 89 44 24 04 mov %eax,0x4(%esp)
44e: 8b 45 08 mov 0x8(%ebp),%eax
451: 89 04 24 mov %eax,(%esp)
454: e8 bf fe ff ff call 318 <putc>
459: e9 2d 01 00 00 jmp 58b <printf+0x196>
}
} else if(state == '%'){
45e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
462: 0f 85 23 01 00 00 jne 58b <printf+0x196>
if(c == 'd'){
468: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
46c: 75 2d jne 49b <printf+0xa6>
printint(fd, *ap, 10, 1);
46e: 8b 45 e8 mov -0x18(%ebp),%eax
471: 8b 00 mov (%eax),%eax
473: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
47a: 00
47b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
482: 00
483: 89 44 24 04 mov %eax,0x4(%esp)
487: 8b 45 08 mov 0x8(%ebp),%eax
48a: 89 04 24 mov %eax,(%esp)
48d: e8 ae fe ff ff call 340 <printint>
ap++;
492: 83 45 e8 04 addl $0x4,-0x18(%ebp)
496: e9 e9 00 00 00 jmp 584 <printf+0x18f>
} else if(c == 'x' || c == 'p'){
49b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
49f: 74 06 je 4a7 <printf+0xb2>
4a1: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4a5: 75 2d jne 4d4 <printf+0xdf>
printint(fd, *ap, 16, 0);
4a7: 8b 45 e8 mov -0x18(%ebp),%eax
4aa: 8b 00 mov (%eax),%eax
4ac: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
4b3: 00
4b4: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
4bb: 00
4bc: 89 44 24 04 mov %eax,0x4(%esp)
4c0: 8b 45 08 mov 0x8(%ebp),%eax
4c3: 89 04 24 mov %eax,(%esp)
4c6: e8 75 fe ff ff call 340 <printint>
ap++;
4cb: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4cf: e9 b0 00 00 00 jmp 584 <printf+0x18f>
} else if(c == 's'){
4d4: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
4d8: 75 42 jne 51c <printf+0x127>
s = (char*)*ap;
4da: 8b 45 e8 mov -0x18(%ebp),%eax
4dd: 8b 00 mov (%eax),%eax
4df: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
4e2: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
4e6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4ea: 75 09 jne 4f5 <printf+0x100>
s = "(null)";
4ec: c7 45 f4 bb 07 00 00 movl $0x7bb,-0xc(%ebp)
while(*s != 0){
4f3: eb 1c jmp 511 <printf+0x11c>
4f5: eb 1a jmp 511 <printf+0x11c>
putc(fd, *s);
4f7: 8b 45 f4 mov -0xc(%ebp),%eax
4fa: 8a 00 mov (%eax),%al
4fc: 0f be c0 movsbl %al,%eax
4ff: 89 44 24 04 mov %eax,0x4(%esp)
503: 8b 45 08 mov 0x8(%ebp),%eax
506: 89 04 24 mov %eax,(%esp)
509: e8 0a fe ff ff call 318 <putc>
s++;
50e: ff 45 f4 incl -0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
511: 8b 45 f4 mov -0xc(%ebp),%eax
514: 8a 00 mov (%eax),%al
516: 84 c0 test %al,%al
518: 75 dd jne 4f7 <printf+0x102>
51a: eb 68 jmp 584 <printf+0x18f>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
51c: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
520: 75 1d jne 53f <printf+0x14a>
putc(fd, *ap);
522: 8b 45 e8 mov -0x18(%ebp),%eax
525: 8b 00 mov (%eax),%eax
527: 0f be c0 movsbl %al,%eax
52a: 89 44 24 04 mov %eax,0x4(%esp)
52e: 8b 45 08 mov 0x8(%ebp),%eax
531: 89 04 24 mov %eax,(%esp)
534: e8 df fd ff ff call 318 <putc>
ap++;
539: 83 45 e8 04 addl $0x4,-0x18(%ebp)
53d: eb 45 jmp 584 <printf+0x18f>
} else if(c == '%'){
53f: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
543: 75 17 jne 55c <printf+0x167>
putc(fd, c);
545: 8b 45 e4 mov -0x1c(%ebp),%eax
548: 0f be c0 movsbl %al,%eax
54b: 89 44 24 04 mov %eax,0x4(%esp)
54f: 8b 45 08 mov 0x8(%ebp),%eax
552: 89 04 24 mov %eax,(%esp)
555: e8 be fd ff ff call 318 <putc>
55a: eb 28 jmp 584 <printf+0x18f>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
55c: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
563: 00
564: 8b 45 08 mov 0x8(%ebp),%eax
567: 89 04 24 mov %eax,(%esp)
56a: e8 a9 fd ff ff call 318 <putc>
putc(fd, c);
56f: 8b 45 e4 mov -0x1c(%ebp),%eax
572: 0f be c0 movsbl %al,%eax
575: 89 44 24 04 mov %eax,0x4(%esp)
579: 8b 45 08 mov 0x8(%ebp),%eax
57c: 89 04 24 mov %eax,(%esp)
57f: e8 94 fd ff ff call 318 <putc>
}
state = 0;
584: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
58b: ff 45 f0 incl -0x10(%ebp)
58e: 8b 55 0c mov 0xc(%ebp),%edx
591: 8b 45 f0 mov -0x10(%ebp),%eax
594: 01 d0 add %edx,%eax
596: 8a 00 mov (%eax),%al
598: 84 c0 test %al,%al
59a: 0f 85 77 fe ff ff jne 417 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5a0: c9 leave
5a1: c3 ret
5a2: 90 nop
5a3: 90 nop
000005a4 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5a4: 55 push %ebp
5a5: 89 e5 mov %esp,%ebp
5a7: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5aa: 8b 45 08 mov 0x8(%ebp),%eax
5ad: 83 e8 08 sub $0x8,%eax
5b0: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5b3: a1 24 0a 00 00 mov 0xa24,%eax
5b8: 89 45 fc mov %eax,-0x4(%ebp)
5bb: eb 24 jmp 5e1 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5bd: 8b 45 fc mov -0x4(%ebp),%eax
5c0: 8b 00 mov (%eax),%eax
5c2: 3b 45 fc cmp -0x4(%ebp),%eax
5c5: 77 12 ja 5d9 <free+0x35>
5c7: 8b 45 f8 mov -0x8(%ebp),%eax
5ca: 3b 45 fc cmp -0x4(%ebp),%eax
5cd: 77 24 ja 5f3 <free+0x4f>
5cf: 8b 45 fc mov -0x4(%ebp),%eax
5d2: 8b 00 mov (%eax),%eax
5d4: 3b 45 f8 cmp -0x8(%ebp),%eax
5d7: 77 1a ja 5f3 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5d9: 8b 45 fc mov -0x4(%ebp),%eax
5dc: 8b 00 mov (%eax),%eax
5de: 89 45 fc mov %eax,-0x4(%ebp)
5e1: 8b 45 f8 mov -0x8(%ebp),%eax
5e4: 3b 45 fc cmp -0x4(%ebp),%eax
5e7: 76 d4 jbe 5bd <free+0x19>
5e9: 8b 45 fc mov -0x4(%ebp),%eax
5ec: 8b 00 mov (%eax),%eax
5ee: 3b 45 f8 cmp -0x8(%ebp),%eax
5f1: 76 ca jbe 5bd <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
5f3: 8b 45 f8 mov -0x8(%ebp),%eax
5f6: 8b 40 04 mov 0x4(%eax),%eax
5f9: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
600: 8b 45 f8 mov -0x8(%ebp),%eax
603: 01 c2 add %eax,%edx
605: 8b 45 fc mov -0x4(%ebp),%eax
608: 8b 00 mov (%eax),%eax
60a: 39 c2 cmp %eax,%edx
60c: 75 24 jne 632 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
60e: 8b 45 f8 mov -0x8(%ebp),%eax
611: 8b 50 04 mov 0x4(%eax),%edx
614: 8b 45 fc mov -0x4(%ebp),%eax
617: 8b 00 mov (%eax),%eax
619: 8b 40 04 mov 0x4(%eax),%eax
61c: 01 c2 add %eax,%edx
61e: 8b 45 f8 mov -0x8(%ebp),%eax
621: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
624: 8b 45 fc mov -0x4(%ebp),%eax
627: 8b 00 mov (%eax),%eax
629: 8b 10 mov (%eax),%edx
62b: 8b 45 f8 mov -0x8(%ebp),%eax
62e: 89 10 mov %edx,(%eax)
630: eb 0a jmp 63c <free+0x98>
} else
bp->s.ptr = p->s.ptr;
632: 8b 45 fc mov -0x4(%ebp),%eax
635: 8b 10 mov (%eax),%edx
637: 8b 45 f8 mov -0x8(%ebp),%eax
63a: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
63c: 8b 45 fc mov -0x4(%ebp),%eax
63f: 8b 40 04 mov 0x4(%eax),%eax
642: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
649: 8b 45 fc mov -0x4(%ebp),%eax
64c: 01 d0 add %edx,%eax
64e: 3b 45 f8 cmp -0x8(%ebp),%eax
651: 75 20 jne 673 <free+0xcf>
p->s.size += bp->s.size;
653: 8b 45 fc mov -0x4(%ebp),%eax
656: 8b 50 04 mov 0x4(%eax),%edx
659: 8b 45 f8 mov -0x8(%ebp),%eax
65c: 8b 40 04 mov 0x4(%eax),%eax
65f: 01 c2 add %eax,%edx
661: 8b 45 fc mov -0x4(%ebp),%eax
664: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
667: 8b 45 f8 mov -0x8(%ebp),%eax
66a: 8b 10 mov (%eax),%edx
66c: 8b 45 fc mov -0x4(%ebp),%eax
66f: 89 10 mov %edx,(%eax)
671: eb 08 jmp 67b <free+0xd7>
} else
p->s.ptr = bp;
673: 8b 45 fc mov -0x4(%ebp),%eax
676: 8b 55 f8 mov -0x8(%ebp),%edx
679: 89 10 mov %edx,(%eax)
freep = p;
67b: 8b 45 fc mov -0x4(%ebp),%eax
67e: a3 24 0a 00 00 mov %eax,0xa24
}
683: c9 leave
684: c3 ret
00000685 <morecore>:
static Header*
morecore(uint nu)
{
685: 55 push %ebp
686: 89 e5 mov %esp,%ebp
688: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
68b: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
692: 77 07 ja 69b <morecore+0x16>
nu = 4096;
694: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
69b: 8b 45 08 mov 0x8(%ebp),%eax
69e: c1 e0 03 shl $0x3,%eax
6a1: 89 04 24 mov %eax,(%esp)
6a4: e8 57 fc ff ff call 300 <sbrk>
6a9: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6ac: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6b0: 75 07 jne 6b9 <morecore+0x34>
return 0;
6b2: b8 00 00 00 00 mov $0x0,%eax
6b7: eb 22 jmp 6db <morecore+0x56>
hp = (Header*)p;
6b9: 8b 45 f4 mov -0xc(%ebp),%eax
6bc: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
6bf: 8b 45 f0 mov -0x10(%ebp),%eax
6c2: 8b 55 08 mov 0x8(%ebp),%edx
6c5: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
6c8: 8b 45 f0 mov -0x10(%ebp),%eax
6cb: 83 c0 08 add $0x8,%eax
6ce: 89 04 24 mov %eax,(%esp)
6d1: e8 ce fe ff ff call 5a4 <free>
return freep;
6d6: a1 24 0a 00 00 mov 0xa24,%eax
}
6db: c9 leave
6dc: c3 ret
000006dd <malloc>:
void*
malloc(uint nbytes)
{
6dd: 55 push %ebp
6de: 89 e5 mov %esp,%ebp
6e0: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6e3: 8b 45 08 mov 0x8(%ebp),%eax
6e6: 83 c0 07 add $0x7,%eax
6e9: c1 e8 03 shr $0x3,%eax
6ec: 40 inc %eax
6ed: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
6f0: a1 24 0a 00 00 mov 0xa24,%eax
6f5: 89 45 f0 mov %eax,-0x10(%ebp)
6f8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
6fc: 75 23 jne 721 <malloc+0x44>
base.s.ptr = freep = prevp = &base;
6fe: c7 45 f0 1c 0a 00 00 movl $0xa1c,-0x10(%ebp)
705: 8b 45 f0 mov -0x10(%ebp),%eax
708: a3 24 0a 00 00 mov %eax,0xa24
70d: a1 24 0a 00 00 mov 0xa24,%eax
712: a3 1c 0a 00 00 mov %eax,0xa1c
base.s.size = 0;
717: c7 05 20 0a 00 00 00 movl $0x0,0xa20
71e: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
721: 8b 45 f0 mov -0x10(%ebp),%eax
724: 8b 00 mov (%eax),%eax
726: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
729: 8b 45 f4 mov -0xc(%ebp),%eax
72c: 8b 40 04 mov 0x4(%eax),%eax
72f: 3b 45 ec cmp -0x14(%ebp),%eax
732: 72 4d jb 781 <malloc+0xa4>
if(p->s.size == nunits)
734: 8b 45 f4 mov -0xc(%ebp),%eax
737: 8b 40 04 mov 0x4(%eax),%eax
73a: 3b 45 ec cmp -0x14(%ebp),%eax
73d: 75 0c jne 74b <malloc+0x6e>
prevp->s.ptr = p->s.ptr;
73f: 8b 45 f4 mov -0xc(%ebp),%eax
742: 8b 10 mov (%eax),%edx
744: 8b 45 f0 mov -0x10(%ebp),%eax
747: 89 10 mov %edx,(%eax)
749: eb 26 jmp 771 <malloc+0x94>
else {
p->s.size -= nunits;
74b: 8b 45 f4 mov -0xc(%ebp),%eax
74e: 8b 40 04 mov 0x4(%eax),%eax
751: 2b 45 ec sub -0x14(%ebp),%eax
754: 89 c2 mov %eax,%edx
756: 8b 45 f4 mov -0xc(%ebp),%eax
759: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
75c: 8b 45 f4 mov -0xc(%ebp),%eax
75f: 8b 40 04 mov 0x4(%eax),%eax
762: c1 e0 03 shl $0x3,%eax
765: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
768: 8b 45 f4 mov -0xc(%ebp),%eax
76b: 8b 55 ec mov -0x14(%ebp),%edx
76e: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
771: 8b 45 f0 mov -0x10(%ebp),%eax
774: a3 24 0a 00 00 mov %eax,0xa24
return (void*)(p + 1);
779: 8b 45 f4 mov -0xc(%ebp),%eax
77c: 83 c0 08 add $0x8,%eax
77f: eb 38 jmp 7b9 <malloc+0xdc>
}
if(p == freep)
781: a1 24 0a 00 00 mov 0xa24,%eax
786: 39 45 f4 cmp %eax,-0xc(%ebp)
789: 75 1b jne 7a6 <malloc+0xc9>
if((p = morecore(nunits)) == 0)
78b: 8b 45 ec mov -0x14(%ebp),%eax
78e: 89 04 24 mov %eax,(%esp)
791: e8 ef fe ff ff call 685 <morecore>
796: 89 45 f4 mov %eax,-0xc(%ebp)
799: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
79d: 75 07 jne 7a6 <malloc+0xc9>
return 0;
79f: b8 00 00 00 00 mov $0x0,%eax
7a4: eb 13 jmp 7b9 <malloc+0xdc>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7a6: 8b 45 f4 mov -0xc(%ebp),%eax
7a9: 89 45 f0 mov %eax,-0x10(%ebp)
7ac: 8b 45 f4 mov -0xc(%ebp),%eax
7af: 8b 00 mov (%eax),%eax
7b1: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
7b4: e9 70 ff ff ff jmp 729 <malloc+0x4c>
}
7b9: c9 leave
7ba: c3 ret
|
Sources/Toggle_PP5_PWM_Buzzer_AssemProg.asm | billhhh/hcs12-dragon12 | 0 | 243709 | <filename>Sources/Toggle_PP5_PWM_Buzzer_AssemProg.asm
;Toggling PP5 to sound the buzzer using PWM (pulse width modulation) on Dragon12 Plus Trainer Board
;The J26 jumper selection allows to SPK_SEL (speaker selection) to be PT5, PP5 (PWM chan 5) or DACB output
;When the Dragon12 board is shipped the J26 jumper is set for PT5 of PORTT speaker/buzzer selection (Default setting).
;Because of this PT5 jumper setting you hear the speaker sound when the board is RESET
;This program toggles PP5 to sound the speaker/buzzer using the PWM of channel 5.
;Modified from Example 17-13 Mazidi & Causey HCS12 book. See Chapter 17 for PWM discussion
;Written and tested by <NAME>
;Before you run this program MAKE SURE YOU MOVE THE JUMPER ON J26 FROM PT5 TO PP5
;AFTER YOU RUN THIS PROGRAM MAKE SURE TO MOVE THE JUMPER BACK TO PT5.
;OTHERWISE UPON RESETING THE BOARD YOU WILL NOT HEAR THE SPEAKER/BUZZER SOUND
ABSENTRY Entry ; for absolute assembly: mark this as application entry point
; Include derivative-specific definitions
INCLUDE 'mc9s12dp256.inc' ;CPU used by Dragon12+ board
;code section
ORG $4000 ;Flash ROM address for Dragon12+
Entry:
LDS #$4000 ;Stack
MOVB #$04, PWMPRCLK ;ClockA=Fbus/2**4=24MHz/16=1.5MHz
MOVB #125, PWMSCLA ;ClockSA=1.5MHz/2x125=1.5Mhz/250=6000Hz
MOVB #$20, PWMCLK ;Use clockSA for chan 5 PWM
MOVB #$20,PWMPOL ;high then low for polarity
MOVB #$0,PWMCAE ;left aligned
MOVB #$0, PWMCTL ;8-bit chan,pwm during feeze and wait
MOVB #100, PWMPER5 ;PWM_Freq=ClockSA/100=6000 Hz/100=60 Hz. CHANGE THIS
MOVB #50, PWMDTY5 ;50% duty cycle AND THIS TO GET DIFFERENT SOUND
MOVB #0,PWMCNT5 ;start the counter with zero (optional)
BSET PWME,%00100000 ;enable chan 5 PWM
BRA $
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000
|
Src/Ant32/factorial.asm | geoffthorpe/ant-architecture | 0 | 22574 | # factorial.asm
#
# A program to recursively compute the factorial of 4.
main:
# Set up the stack and frame pointers. (This is usually done
# by the executive, but this is included here in order to make
# this example stand-alone.)
lc sp, 0x80002000
lc fp, 0x80002000
# To compute factorial(4), push the 4 on the stack and then
# use "call" to invoke the factorial function. In this
# program, since we're not using any registers other than g1
# (outside of the factorial function), we don't need to
# preserve anything. We don't even care about the original
# value of g1 when the function returns.
lc g1, 4
push g1
call $factorial
pop g1
main_des:
halt
# The factorial function:
# Computes factorial (X) as factorial (X-1) * X, with the base case
# that the factorial of 0 is 1. Takes a single argument X, accessible
# at fp + 8.
#
# Assumes that X is positive or zero. If negative, pathological
# misery will result. Try it if you want to see what stack overflow
# looks like...
factorial:
entry 0
ld4 g1, fp, 8 # g1 gets a copy of the current X
jezi g1, $factorial_basecase
factorial_recurse:
subi g2, g1, 1 # decrement X
push g1 # preserve g1
push g2 # push the arg (X-1) and call factorial...
call $factorial
pop g2 # pop the arg (restoring g2).
pop g1 # restore g1.
mul g0, g0, g1 # compute X * factorial (X-1),
return g0 # and return it.
factorial_basecase:
return 1
|
programs/oeis/134/A134638.asm | neoneye/loda | 22 | 10105 | ; A134638: Row sums of triangle A134637.
; 1,8,28,76,182,406,868,1808,3706,7522,15176,30508,61198,122606,245452,491176,982658,1965658,3931696,7863812,15728086,31456678,62913908,125828416,251657482,503315666,1006632088,2013264988,4026530846,8053062622,16106126236,32212253528,64424508178,128849017546,257698036352,515396074036,1030792149478,2061584300438,4123168602436,8246337206512,16492674414746,32985348831298,65970697664488,131941395330956,263882790663982,527765581330126,1055531162662508,2111062325327368,4222124650657186,8444249301316922,16888498602636496,33776997205275748,67553994410554358,135107988821111686,270215977642226452,540431955284456096,1080863910568915498,2161727821137834418,4323455642275672376,8646911284551348412,17293822569102700606,34587645138205405118,69175290276410814268,138350580552821632696,276701161105643269682,553402322211286543786,1106804644422573092128,2213609288845146188948,4427218577690292382726,8854437155380584770422,17708874310761169545956,35417748621522339097168,70835497243044678199738,141670994486089356405026,283341988972178712815752,566683977944357425637356,1133367955888714851280718,2266735911777429702567598,4533471823554859405141516,9066943647109718810289512,18133887294219437620585666,36267774588438875241178138,72535549176877750482363248,145071098353755500964733636,290142196707511001929474582,580284393415022003858956646,1160568786830044007717920948,2321137573660088015435849728,4642275147320176030871707466,9284550294640352061743423122,18569100589280704123486854616,37138201178561408246973717788,74276402357122816493947444318,148552804714245632987894897566,297105609428491265975789804252,594211218856982531951579617816,1188422437713965063903159245138,2376844875427930127806318499978,4753689750855860255612637009856,9507379501711720511225274029812
mov $2,3
mov $3,3
lpb $0
sub $0,1
add $3,1
add $3,$2
add $1,$3
add $2,2
mul $3,2
lpe
add $1,1
mov $0,$1
|
oeis/010/A010068.asm | neoneye/loda-programs | 11 | 164600 | ; A010068: a(n+1) = a(n) + sum of digits in base 6 representation of a(n).
; Submitted by <NAME>(m4)
; 1,2,4,8,11,17,24,28,36,37,39,43,46,52,59,68,76,82,89,98,106,117,124,133,141,152,159,168,176,187,194,203,216,217,219,223,226,232,239,248,256,262,269,278,286,297,304,313,321,332,339,348,356,367,374,383,396,402,409,418,431,447,454,463,471,477,484,493,501,512,519,528,536,547,554,563,576,582,589,598,611,627,639,653,661,667,674,683,696,702,709,718,731,742,754,768,776,787,799,808
mov $2,1
lpb $0
mov $3,$2
lpb $3
add $2,1
lpb $1,7
dif $3,6
lpe
sub $3,1
lpe
sub $0,1
lpe
mov $0,$2
|
SpreadSheet/SpreadSheet/SprShtDLL/SprWin.asm | maul-esel/FormsFramework | 10 | 173775 | <reponame>maul-esel/FormsFramework<gh_stars>1-10
.code
DrawCurPos proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD,hDC:HDC,lpRect:DWORD
LOCAL buffer[16]:BYTE
mov ebx,lpSheet
mov esi,lpWin
mov edx,[esi].WIN.ccol
mov ecx,[esi].WIN.crow
mov buffer,0
.if edx!=[esi].WIN.mcol || ecx!=[esi].WIN.mrow
invoke FindCell,ebx,[esi].WIN.mcol,0
lea eax,[eax].COLDTA.fmt.tpe[3]
invoke StrCpy,addr buffer,eax
invoke StrLen,addr buffer
invoke DwToAscii,[esi].WIN.mrow,addr buffer[eax]
invoke StrLen,addr buffer
mov word ptr buffer[eax],':'
.endif
invoke FindCell,ebx,[esi].WIN.ccol,0
lea eax,[eax].COLDTA.fmt.tpe[3]
invoke lstrcat,addr buffer,eax
invoke StrLen,addr buffer
invoke DwToAscii,[esi].WIN.crow,addr buffer[eax]
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_SINGLELINE
ret
DrawCurPos endp
DrawCellText proc uses ebx esi edi,lpSheet:DWORD,lpWin:DWORD,hDC:HDC,lpRect:DWORD
LOCAL buffer[512]:BYTE
mov ebx,lpSheet
mov esi,lpWin
invoke FindCell,ebx,[esi].WIN.ccol,[esi].WIN.crow
.if eax
mov edi,eax
mov al,[edi].COLDTA.fmt.tpe
mov dl,al
and dl,0F0h
and al,TPE_TYPEMASK
.if al==TPE_TEXT || al==TPE_TEXTMULTILINE || al==TPE_HYPERLINK; || al==TPE_BUTTON or TPE_TEXT || al==TPE_WIDEBUTTON or TPE_TEXT
invoke DrawText,hDC,addr [edi].COLDTA.fmt.tpe[1],-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_INTEGER && dl==TPE_DATE
mov edx,dword ptr [edi].COLDTA.fmt.tpe[1]
invoke DateToString,ebx,edx,addr buffer,sizeof buffer
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_INTEGER || al==TPE_CHECKBOX || al==TPE_COMBOBOX || al==TPE_OWNERDRAWINTEGER
invoke DwToAscii,dword ptr [edi].COLDTA.fmt.tpe[1],addr buffer
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_FLOAT
invoke FpToAscii,addr [edi].COLDTA.fmt.tpe[1],addr buffer,FALSE
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_FORMULA
invoke DecompFormula,addr [edi].COLDTA.fmt.tpe[1+10],addr buffer
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_GRAPH
invoke DecompFormula,addr [edi].COLDTA.fmt.tpe[1+4],addr buffer
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.elseif al==TPE_OWNERDRAWBLOB
movzx eax,word ptr [edi].COLDTA.fmt.tpe[1]
invoke wsprintf,addr buffer,addr szBlob,eax
invoke DrawText,hDC,addr buffer,-1,lpRect,DT_LEFT or DT_BOTTOM or DT_SINGLELINE
.endif
.endif
ret
DrawCellText endp
DrawInput proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
LOCAL rect:RECT
LOCAL hDC:HDC
LOCAL mDC:HDC
mov ebx,lpSheet
mov eax,[ebx].SHEET.winst
and eax,SPS_STATUS
.if eax
mov esi,lpWin
invoke GetDC,[ebx].SHEET.hwnd
mov hDC,eax
invoke GetClientRect,[ebx].SHEET.hwnd,addr rect
mov eax,STATUSHT
test [ebx].SHEET.winst,SPS_GRIDMODE
je @f
shr eax,1
@@:
.if [ebx].SHEET.fedt
sub eax,INPHT
.endif
mov rect.bottom,eax
invoke CreateCompatibleDC,hDC
mov mDC,eax
invoke CreateCompatibleBitmap,hDC,rect.right,rect.bottom
push eax
invoke SelectObject,mDC,eax
push eax
invoke SelectObject,mDC,[ebx].SHEET.ofont.hfont
push eax
invoke SetBkMode,mDC,TRANSPARENT
invoke GetStockObject,LTGRAY_BRUSH
invoke FillRect,mDC,addr rect,eax
invoke SetTextColor,mDC,0
invoke MoveToEx,mDC,0,rect.top,NULL
invoke LineTo,mDC,rect.right,rect.top
inc rect.left
inc rect.top
dec rect.bottom
test [ebx].SHEET.winst,SPS_GRIDMODE
jne @f
invoke DrawCurPos,ebx,esi,mDC,addr rect
@@:
.if ![ebx].SHEET.fedt
invoke DrawCellText,ebx,esi,mDC,addr rect
.endif
invoke GetClientRect,[ebx].SHEET.hwnd,addr rect
mov eax,STATUSHT
test [ebx].SHEET.winst,SPS_GRIDMODE
je @f
shr eax,1
@@:
mov edx,rect.bottom
sub edx,eax
.if [ebx].SHEET.fedt
sub eax,INPHT
.endif
mov rect.bottom,eax
invoke BitBlt,hDC,0,edx,rect.right,rect.bottom,mDC,0,0,SRCCOPY
;Font
pop eax
invoke SelectObject,mDC,eax
;Bitmap
pop eax
invoke SelectObject,mDC,eax
;Bitmap
pop eax
invoke DeleteObject,eax
invoke DeleteDC,mDC
invoke ReleaseDC,[ebx].SHEET.hwnd,hDC
.endif
ret
DrawInput endp
DrawWin proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
LOCAL rect:RECT
LOCAL rect1:RECT
LOCAL rect2:RECT
mov ebx,lpSheet
xor ecx,ecx
.while ecx<=[ebx].SHEET.gfmt.nrows
push ecx
mov esi,[ebx].SHEET.lprowmem
lea esi,[esi+ecx*4]
mov esi,[esi]
.if esi
mov eax,[esi].ROWDTA.len
.if eax
add esi,sizeof ROWDTA-4
Nx2:
movzx eax,[esi].COLDTA.len
.if eax
.if [esi].COLDTA.expx || [esi].COLDTA.expy
or [esi].COLDTA.state,STATE_REDRAW
.endif
add esi,eax
jmp Nx2
.endif
.endif
.endif
pop ecx
inc ecx
.endw
mov esi,lpWin
mov [ebx].SHEET.ty,0
invoke GetCellRect,ebx,esi,[esi].WIN.lcol,[esi].WIN.lrow,addr rect
invoke GetCellRect,ebx,esi,[esi].WIN.tcol,[esi].WIN.trow,addr rect1
mov eax,[esi].WIN.trow
mov [ebx].SHEET.tr,eax
mov eax,rect1.top
mov [ebx].SHEET.ty,eax
mov eax,rect.right
sub rect1.left,eax
sub rect1.right,eax
mov eax,rect.bottom
sub rect1.top,eax
sub rect1.bottom,eax
;Draw scroll area
mov edx,[esi].WIN.trow
.while TRUE
mov ecx,[esi].WIN.tcol
.while TRUE
push ecx
push edx
;Cell Rect
push ecx
push edx
invoke GetCellRect,ebx,esi,ecx,edx,addr rect2
mov eax,rect1.left
sub rect2.left,eax
sub rect2.right,eax
mov eax,rect1.top
sub rect2.top,eax
sub rect2.bottom,eax
pop edx
pop ecx
invoke DrawCell,ebx,esi,ecx,edx,addr rect2
pop edx
pop ecx
.break .if eax
inc ecx
.endw
.break .if eax>=8
inc edx
.endw
;Draw locked area
mov edx,0
.while edx<=[esi].WIN.lrow
mov ecx,0
.while ecx<=[esi].WIN.lcol
push ecx
push edx
;Cell Rect
push ecx
push edx
invoke GetCellRect,ebx,esi,ecx,edx,addr rect
pop edx
pop ecx
invoke DrawCell,ebx,esi,ecx,edx,addr rect
pop edx
pop ecx
.break .if eax
inc ecx
.endw
.break .if eax>=8
inc edx
.endw
;Draw locked rows area
mov edx,0
.while edx<=[esi].WIN.lrow
mov ecx,[esi].WIN.tcol
.while TRUE
push ecx
push edx
;Cell Rect
push ecx
push edx
invoke GetCellRect,ebx,esi,ecx,edx,addr rect2
mov eax,rect1.left
sub rect2.left,eax
sub rect2.right,eax
pop edx
pop ecx
invoke DrawCell,ebx,esi,ecx,edx,addr rect2
pop edx
pop ecx
.break .if eax
inc ecx
.endw
.break .if eax>=8
inc edx
.endw
;Draw locked cols area
mov edx,[esi].WIN.trow
.while TRUE
mov ecx,0
.while ecx<=[esi].WIN.lcol
push ecx
push edx
;Cell Rect
push ecx
push edx
invoke GetCellRect,ebx,esi,ecx,edx,addr rect2
mov eax,rect1.top
sub rect2.top,eax
sub rect2.bottom,eax
pop edx
pop ecx
invoke DrawCell,ebx,esi,ecx,edx,addr rect2
pop edx
pop ecx
.break .if eax
inc ecx
.endw
.break .if eax>=8
inc edx
.endw
ret
DrawWin endp
CreateWin proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
mov ebx,lpSheet
mov esi,lpWin
mov eax,[ebx].SHEET.winst
mov edx,WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS
test eax,SPS_VSCROLL
je @f
or edx,WS_VSCROLL
@@:
test eax,SPS_HSCROLL
je @f
or edx,WS_HSCROLL
@@:
invoke CreateWindowEx,NULL,offset szClassNameSheetWin,NULL,edx,0,0,0,0,[ebx].SHEET.hwnd,[esi].WIN.nwin,hInstance,0
mov [esi].WIN.hwin,eax
push eax
invoke SetFocus,eax
pop eax
ret
CreateWin endp
CreateVSplit proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
LOCAL rect:RECT
LOCAL sbs:DWORD
mov ebx,lpSheet
mov esi,lpWin
mov sbs,0
mov eax,[ebx].SHEET.winst
test eax,SPS_VSCROLL
je @f
mov sbs,SBSIZE
@@:
mov eax,[esi].WIN.nwin
mov edx,[esi+sizeof WIN].WIN.act
.if eax<WINMAX-1
mov eax,[esi].WIN.ccol
.if eax>[esi].WIN.tcol && edx==-1
invoke GetRealCellRect,ebx,esi,addr rect
mov edx,esi
add edx,sizeof WIN
mov eax,rect.left
add eax,sbs
add eax,[esi].WIN.rect.left
mov [edx].WIN.rect.left,eax
mov eax,[esi].WIN.rect.top
mov [edx].WIN.rect.top,eax
mov eax,[esi].WIN.ccol
mov [edx].WIN.ccol,eax
mov [edx].WIN.mcol,eax
mov [edx].WIN.tcol,eax
mov eax,[esi].WIN.crow
mov [edx].WIN.crow,eax
mov [edx].WIN.mrow,eax
mov eax,[esi].WIN.trow
mov [edx].WIN.trow,eax
mov eax,[esi].WIN.lrow
mov [edx].WIN.lrow,eax
mov [esi].WIN.act,0
mov [edx].WIN.act,1
mov [edx].WIN.sync,0
or [esi].WIN.sync,1
mov esi,edx
inc [ebx].SHEET.nwin
invoke CreateWin,ebx,esi
invoke SendMessage,[ebx].SHEET.hwnd,WM_SIZE,0,0
invoke SetFocus,[esi].WIN.hwin
.endif
.endif
ret
CreateVSplit endp
CreateHSplit proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
LOCAL rect:RECT
LOCAL sbs:DWORD
mov ebx,lpSheet
mov esi,lpWin
mov sbs,0
mov eax,[ebx].SHEET.winst
test eax,SPS_HSCROLL
je @f
mov sbs,SBSIZE
@@:
mov eax,[esi].WIN.nwin
mov edx,[esi+sizeof WIN].WIN.act
.if eax<WINMAX-1 && edx==-1
mov eax,[esi].WIN.crow
.if eax>[esi].WIN.trow
invoke GetRealCellRect,ebx,esi,addr rect
mov edx,esi
add edx,sizeof WIN
mov eax,rect.top
add eax,sbs
add eax,[esi].WIN.rect.top
mov [edx].WIN.rect.top,eax
mov eax,[esi].WIN.rect.left
mov [edx].WIN.rect.left,eax
mov eax,[esi].WIN.crow
mov [edx].WIN.crow,eax
mov [edx].WIN.mrow,eax
mov [edx].WIN.trow,eax
mov eax,[esi].WIN.ccol
mov [edx].WIN.ccol,eax
mov [edx].WIN.mcol,eax
mov eax,[esi].WIN.tcol
mov [edx].WIN.tcol,eax
mov eax,[esi].WIN.lcol
mov [edx].WIN.lcol,eax
mov [esi].WIN.act,0
mov [edx].WIN.act,1
mov [edx].WIN.sync,0
or [esi].WIN.sync,2
mov esi,edx
inc [ebx].SHEET.nwin
invoke CreateWin,ebx,esi
invoke SendMessage,[ebx].SHEET.hwnd,WM_SIZE,0,0
invoke SetFocus,[esi].WIN.hwin
.endif
.endif
ret
CreateHSplit endp
CloseSplit proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD
LOCAL nWin:DWORD
mov ebx,lpSheet
mov esi,lpWin
mov eax,[ebx].SHEET.nwin
.if eax
mov eax,esi
add eax,sizeof WIN
mov eax,[eax].WIN.act
.if eax==-1
mov edx,esi
sub edx,sizeof WIN
mov [edx].WIN.sync,0
invoke DestroyWindow,[esi].WIN.hwin
dec [ebx].SHEET.nwin
mov [esi].WIN.act,-1
xor eax,eax
mov [esi].WIN.tcol,eax
mov [esi].WIN.trow,eax
mov [esi].WIN.ccol,eax
mov [esi].WIN.crow,eax
mov [esi].WIN.mcol,eax
mov [esi].WIN.mrow,eax
mov [esi].WIN.lcol,eax
mov [esi].WIN.lrow,eax
mov edx,esi
sub edx,sizeof WIN
invoke SetFocus,[edx].WIN.hwin
invoke SendMessage,[ebx].SHEET.hwnd,WM_SIZE,0,0
.endif
.endif
ret
CloseSplit endp
SyncSplitt proc uses ebx esi,lpSheet:DWORD,lpWin:DWORD,fSplitt:DWORD
mov eax,[ebx].SHEET.nwin
.if eax
mov edx,esi
sub edx,sizeof WIN
.if fSplitt
mov eax,[esi].WIN.rect.top
.if eax==[edx].WIN.rect.top
or [edx].WIN.sync,1
.else
or [edx].WIN.sync,2
.endif
.else
mov eax,[esi].WIN.rect.top
.if eax==[edx].WIN.rect.top
and [edx].WIN.sync,-1 xor 1
.else
and [edx].WIN.sync,-1 xor 2
.endif
.endif
.endif
ret
SyncSplitt endp
|
bb-runtimes/examples/monitor/armv7a/trap_handler.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 4056 | ------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
pragma Warnings (Off, "* internal GNAT unit");
with System.Text_IO; use System.Text_IO;
pragma Warnings (On, "* internal GNAT unit");
with System.Machine_Code; use System.Machine_Code;
with Ada.Unchecked_Conversion;
package body Trap_Handler is
procedure Put (Item : Character);
procedure Put (Item : String);
procedure New_Line;
procedure Get (C : out Character);
procedure Put_Hex4 (V : Unsigned_32);
procedure Put_Hex1 (V : Unsigned_8);
procedure Put_02 (N : Natural);
Hex_Digits : constant array (0 .. 15) of Character := "0123456789abcdef";
procedure Put (Item : Character) is
begin
while not System.Text_IO.Is_Tx_Ready loop
null;
end loop;
System.Text_IO.Put (Item);
end Put;
procedure Put (Item : String) is
begin
for J in Item'Range loop
Put (Item (J));
end loop;
end Put;
procedure New_Line is
begin
if System.Text_IO.Use_Cr_Lf_For_New_Line then
Put (ASCII.CR);
end if;
Put (ASCII.LF);
end New_Line;
procedure Put_Hex4 (V : Unsigned_32) is
Res : String (1 .. 8);
begin
for I in Res'Range loop
Res (I) :=
Hex_Digits (Natural (Shift_Right (V, 4 * (8 - I)) and 15));
end loop;
Put (Res);
end Put_Hex4;
procedure Put_Hex1 (V : Unsigned_8) is
Res : String (1 .. 2);
begin
for I in Res'Range loop
Res (I) := Hex_Digits (Natural (Shift_Right (V, 4 * (2 - I)) and 15));
end loop;
Put (Res);
end Put_Hex1;
procedure Put_02 (N : Natural) is
Res : String (1 .. 2);
begin
Res (1) := Character'Val (48 + N / 10);
Res (2) := Character'Val (48 + N mod 10);
Put (Res);
end Put_02;
procedure Get (C : out Character) is
begin
while not Is_Rx_Ready loop
null;
end loop;
C := System.Text_IO.Get;
end Get;
pragma Unreferenced (Put_Hex1, Get);
function Get_CPSR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrs %0,cpsr",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_CPSR;
function Get_SPSR return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrs %0,spsr",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_SPSR;
procedure Set_TLB_Data_Read_Operation_Reg (V : Unsigned_32) is
begin
Asm ("mcr p15, #3, %0, c15, c4, #2",
Inputs => Unsigned_32'Asm_Input ("r", V),
Volatile => True);
end Set_TLB_Data_Read_Operation_Reg;
function Get_Data_Register_0 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #3, %0, c15, c0, #0",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Data_Register_0;
function Get_Data_Register_1 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #3, %0, c15, c0, #1",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Data_Register_1;
function Get_Data_Register_2 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #3, %0, c15, c0, #2",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Data_Register_2;
function Get_Data_Register_3 return Unsigned_32
is
Res : Unsigned_32;
begin
Asm ("mrc p15, #3, %0, c15, c0, #3",
Outputs => Unsigned_32'Asm_Output ("=r", Res),
Volatile => True);
return Res;
end Get_Data_Register_3;
procedure Traps_Handler (Ctxt : Trap_Context_Acc; Num : Natural)
is
function To_Unsigned_32 is new Ada.Unchecked_Conversion
(Trap_Context_Acc, Unsigned_32);
begin
-- Initialize console in case of very early crash
if not Initialized then
Initialize;
end if;
for I in 0 .. 14 loop
if I mod 4 /= 0 then
Put (' ');
end if;
if I = 13 then
Put ("SP:");
elsif I = 14 then
Put ("LR:");
else
Put_02 (I);
Put (':');
end if;
Put_Hex4 (Ctxt.R (I));
if (I mod 4) = 3 then
New_Line;
end if;
end loop;
Put (" PC:");
Put_Hex4 (Ctxt.PC);
New_Line;
Put ("SPSR:");
Put_Hex4 (Get_SPSR);
Put (" CPSR:");
Put_Hex4 (Get_CPSR);
Put (" CurSP:");
Put_Hex4 (To_Unsigned_32 (Ctxt));
Put (" Trap #");
Put_02 (Num);
New_Line;
if (Get_CPSR and 16#1f#) = 16#16# then
Put ("TLB: PA VA");
New_Line;
for I in Unsigned_32 range 0 .. 3 loop
for J in Unsigned_32 range 0 .. 127 loop
declare
function SL (V : Unsigned_32; S : Natural) return Unsigned_32
renames Shift_Left;
function SR (V : Unsigned_32; S : Natural) return Unsigned_32
renames Shift_Right;
En : constant Unsigned_32 := I * 2**30 + J;
D0, D1, D2 : Unsigned_32;
begin
Set_TLB_Data_Read_Operation_Reg (I * 2**30 + J);
D0 := Get_Data_Register_0;
if (D0 and 1) = 1 then
D2 := Get_Data_Register_2;
D1 := Get_Data_Register_1;
Put_Hex4 (En);
Put (": ");
Put_Hex4 (Get_Data_Register_3);
Put (' ');
Put_Hex4 (D2);
Put (' ');
Put_Hex4 (D1);
Put (' ');
Put_Hex4 (D0);
Put (" ");
Put_Hex4 (SL (SR (D2 and 16#3fff_fffc#, 2), 12));
Put (' ');
Put_Hex4 (SL (SR (D0 and 16#7fff_fffc#, 2), 12));
Put (' ');
case SR (D1, 24) and 7 is
when 2#000#
| 2#001# => Put (" 4K");
when 2#010#
| 2#011# => Put ("64K");
when 2#100# => Put (" 1M");
when 2#101# => Put (" 2M");
when 2#110# => Put ("16M");
when 2#111# => Put (".5G");
when others => null;
end case;
New_Line;
end if;
end;
end loop;
end loop;
end if;
loop
null;
end loop;
end Traps_Handler;
procedure Undef_Trap_Mon;
pragma Import (C, Undef_Trap_Mon, "__gnat_undef_trap_mon");
procedure Smc_Trap_Mon;
pragma Import (C, Smc_Trap_Mon, "__gnat_smc_trap_mon");
procedure Pabt_Trap_Mon;
pragma Import (C, Pabt_Trap_Mon, "__gnat_pabt_trap_mon");
procedure Dabt_Trap_Mon;
pragma Import (C, Dabt_Trap_Mon, "__gnat_dabt_trap_mon");
procedure Irq_Trap_Mon;
pragma Import (C, Irq_Trap_Mon, "__gnat_irq_trap_mon");
procedure Fiq_Trap_Mon;
pragma Import (C, Fiq_Trap_Mon, "__gnat_fiq_trap_mon");
procedure Smc_Switch_Mon;
pragma Import (C, Smc_Switch_Mon, "__gnat_smc_switch_mon");
procedure Install_Monitor_Handlers
is
use System;
Except : array (0 .. 7) of Unsigned_32
with Import, Volatile, Address => System'To_Address (0);
Vectors : array (0 .. 7) of Address
with Import, Volatile, Address => System'To_Address (16#20#);
Ldr_Pc_Pc_20 : constant Unsigned_32 := 16#e59ff018#;
begin
Except (0 .. 7) := (others => Ldr_Pc_Pc_20);
Vectors (0 .. 7) := (Null_Address,
Undef_Trap_Mon'Address,
Smc_Trap_Mon'Address,
Pabt_Trap_Mon'Address,
Dabt_Trap_Mon'Address,
Null_Address,
Irq_Trap_Mon'Address,
Fiq_Trap_Mon'Address);
for I in 0 .. 7 loop
-- DCCIMVAC
Asm ("mcr p15, #0, %0, c7, c14, #1",
Inputs => Address'Asm_Input ("r", Except (I)'Address),
Volatile => True);
-- ICIMVAU
Asm ("mcr p15, #0, %0, c7, c5, #1",
Inputs => Address'Asm_Input ("r", Except (I)'Address),
Volatile => True);
end loop;
Asm ("dsb", Volatile => True);
Asm ("isb", Volatile => True);
if False then
-- That doesn't work if cache is enabled!
Put ("Switch to monitor from cpsr ");
Put_Hex4 (Get_CPSR);
New_Line;
declare
R : Unsigned_32;
begin
Vectors (2) := Smc_Switch_Mon'Address;
Asm ("mov %0, sp",
Outputs => Unsigned_32'Asm_Output ("=r", R),
Volatile => True);
Put ("SP=");
Put_Hex4 (R);
Asm ("dsb; isb; smc #0; mov %0, r1",
Outputs => Unsigned_32'Asm_Output ("=r", R),
Volatile => True,
Clobber => "r1, r2");
Put (" R=");
Put_Hex4 (R);
Asm ("mov %0, sp",
Outputs => Unsigned_32'Asm_Output ("=r", R),
Volatile => True);
Put (" SP=");
Put_Hex4 (R);
New_Line;
end;
Vectors (2) := Smc_Trap_Mon'Address;
end if;
end Install_Monitor_Handlers;
end Trap_Handler;
|
english_support_package.ads | ddugovic/words | 4 | 10304 | with Text_IO;
with Direct_IO;
with Strings_Package; use Strings_Package;
with LATIN_FILE_NAMES; use LATIN_FILE_NAMES;
with Inflections_Package; use Inflections_Package;
with Dictionary_Package; use Dictionary_Package;
with WORD_SUPPORT_PACKAGE; use WORD_SUPPORT_PACKAGE;
package ENGLISH_SUPPORT_PACKAGE is
EWORD_SIZE : constant := 24;
AUX_WORD_SIZE : constant := 12;
LINE_NUMBER_WIDTH : constant := 10;
PRIORITY_WIDTH : constant := 3;
subtype EWORD is STRING(1..EWORD_SIZE);
NULL_EWORD : EWORD := (others => ' ');
subtype AUXWORD is STRING(1..AUX_WORD_SIZE);
NULL_AUXWORD : AUXWORD := (others => ' ');
subtype PRIORITY_TYPE is INTEGER range 0..99;
NUMBER_OF_EWORDS : INTEGER := 0;
type EWDS_RECORD is
record
W : EWORD := NULL_EWORD;
AUX : AUXWORD := NULL_AUXWORD;
N : INTEGER := 0;
POFS : PART_OF_SPEECH_TYPE := X;
FREQ : FREQUENCY_TYPE := X;
SEMI : INTEGER := 0;
KIND : INTEGER := 0;
RANK : INTEGER := 0;
end record;
NULL_EWDS_RECORD : EWDS_RECORD := ((others => ' '),
(others => ' '), 0, X, X, 0, 0, 0);
type EWDS_ARRAY is array (POSITIVE range <>) of EWDS_RECORD;
package EWDS_DIRECT_IO is new DIRECT_IO(EWDS_RECORD);
package EWDS_RECORD_IO is
DEFAULT_WIDTH : NATURAL;
procedure GET(F : in TEXT_IO.FILE_TYPE; P : out EWDS_RECORD);
procedure GET(P : out EWDS_RECORD);
procedure PUT(F : in TEXT_IO.FILE_TYPE; P : in EWDS_RECORD);
procedure PUT(P : in EWDS_RECORD);
procedure GET(S : in STRING; P : out EWDS_RECORD;
LAST : out INTEGER);
procedure PUT(S : out STRING; P : in EWDS_RECORD);
end EWDS_RECORD_IO;
ENGLISH_DICTIONARY_AVAILABLE : array (DICTIONARY_KIND) of BOOLEAN := (FALSE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -- don't SEARCH
FALSE, FALSE, FALSE, FALSE);
EWDS_FILE : EWDS_DIRECT_IO.FILE_TYPE;
end ENGLISH_SUPPORT_PACKAGE;
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_1_1421.asm | ljhsiun2/medusa | 9 | 94157 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_1_1421.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x170ee, %rdi
nop
nop
nop
dec %r9
mov (%rdi), %r10
nop
nop
nop
add %rbp, %rbp
lea addresses_UC_ht+0x1952e, %rsi
lea addresses_WC_ht+0x59ee, %rdi
nop
nop
nop
nop
xor %r14, %r14
mov $121, %rcx
rep movsq
inc %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rsi
// Store
mov $0x180025000000049e, %rcx
nop
nop
and $48970, %r12
mov $0x5152535455565758, %r8
movq %r8, %xmm4
vmovntdq %ymm4, (%rcx)
// Exception!!!
nop
mov (0), %rcx
nop
nop
and %rcx, %rcx
// Store
lea addresses_A+0x18eae, %rbx
nop
sub %r9, %r9
mov $0x5152535455565758, %r12
movq %r12, %xmm6
vmovups %ymm6, (%rbx)
nop
nop
inc %r9
// Store
lea addresses_US+0x61ee, %r8
nop
nop
xor %rbx, %rbx
mov $0x5152535455565758, %r12
movq %r12, %xmm2
movups %xmm2, (%r8)
nop
nop
nop
sub %rcx, %rcx
// Load
mov $0x4b45da00000008ce, %r12
nop
nop
and $49697, %r8
mov (%r12), %ebp
nop
xor %r9, %r9
// Faulty Load
lea addresses_A+0x119ee, %rbx
nop
nop
and $53702, %rcx
movups (%rbx), %xmm5
vpextrq $1, %xmm5, %r9
lea oracles, %rbp
and $0xff, %r9
shlq $12, %r9
mov (%rbp,%r9,1), %r9
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': True}}
{'00': 1}
00
*/
|
banklib.asm | traidna/MUMPS-TI99-4A | 0 | 9806 | GoBank: ; r1 = 6002,6000 BANK0, BANK1
; r2 = address in bank to jump to
;
li r0,004E0h
mov r0,@SWBANK
mov r1,@SWBANK+2
li r0,00460h
mov r0,@SWBANK+4
mov r2,@SWBANK+6
b @SWBANK
|
oeis/197/A197986.asm | neoneye/loda-programs | 11 | 163533 | ; A197986: Round((n+1/n)^3).
; 8,16,37,77,141,235,364,536,756,1030,1364,1764,2236,2786,3420,4144,4964,5886,6916,8060,9324,10714,12236,13896,15700,17654,19764,22036,24476,27090,29884,32864,36036,39406,42980,46764,50764,54986,59436,64120,69044,74214,79636,85316,91260,97474,103964,110736,117796,125150,132804,140764,149036,157626,166540,175784,185364,195286,205556,216180,227164,238514,250236,262336,274820,287694,300964,314636,328716,343210,358124,373464,389236,405446,422100,439204,456764,474786,493276,512240,531684,551614,572036
mov $2,$0
mov $5,$0
div $0,2
mov $1,4
trn $1,$0
lpb $2
lpb $0
sub $0,1
lpe
div $1,2
mul $2,$0
lpe
add $1,4
mov $3,$5
mul $3,6
add $1,$3
mov $4,$5
mul $4,$5
mov $3,$4
mul $3,3
add $1,$3
mul $4,$5
add $1,$4
mov $0,$1
|
extensions-contrib/influx-extensions/src/main/antlr4/io/druid/data/input/influx/InfluxLineProtocol.g4 | kskalski/druid | 1 | 802 | /** Based on v1.4 from their docs
at https://docs.influxdata.com/influxdb/v1.4/write_protocols/line_protocol_tutorial/
**/
grammar InfluxLineProtocol;
lines
: line ('\n' line)* '\n'? EOF
;
line
: identifier (',' tag_set)? ' ' field_set (' ' timestamp)?
;
timestamp
: NUMBER
;
field_set
: field_pair (',' field_pair)*
;
tag_set
: tag_pair (',' tag_pair)*
;
tag_pair
: identifier '=' identifier
;
field_pair
: identifier '=' field_value
;
identifier
: IDENTIFIER_STRING | NUMBER | BOOLEAN
;
field_value
: QUOTED_STRING | NUMBER | BOOLEAN
;
eol
: NEWLINE | EOF
;
NEWLINE
: '\n'
;
NUMBER
: '-'? INT ('.' [0-9] +) ? 'i'?
;
BOOLEAN
: 'TRUE' | 'true' | 'True' | 't' | 'T' | 'FALSE' | 'False' | 'false' | 'F' | 'f'
;
QUOTED_STRING
: '"' (StringFieldEscapeSequence | ~(["\\]) )* '"'
;
IDENTIFIER_STRING
: (IdentifierEscapeSequence | ~([,= \n\\]) )+
;
fragment IdentifierEscapeSequence
: '\\' [,= \\]
;
fragment StringFieldEscapeSequence
: '\\' ["\\]
;
fragment INT
: '0' | [1-9] [0-9]*
;
|
expr/src/main/antlr4/com/groupon/lex/metrics/timeseries/parser/Expression.g4 | groupon/monsoon | 32 | 814 | parser grammar Expression;
options {
tokenVocab=ExpressionLexer;
}
import ExprBnf;
@header {
import com.groupon.lex.metrics.timeseries.TimeSeriesMetricExpression;
}
expr returns [ TimeSeriesMetricExpression s ]
: s1=expression EOF
{ $s = $s1.s; }
;
|
project/src/interrupts_hpp.ads | corentingay/ada_epita | 0 | 21506 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package interrupts_hpp is
type Interrupt is
(VBLANK,
LCD_STATUS,
TIMER,
SERIAL,
JOYPAD);
pragma Convention (C, Interrupt); -- ./interrupts.hpp:3
end interrupts_hpp;
|
Code/macros.asm | LeifBloomquist/VICMIDI | 7 | 240819 |
; ==============================================================
; Macro wrapping the fast hex poke
; ==============================================================
MAC HEXPOKE
lda #<{1} ; Low byte
sta $22
lda #>{1} ; High byte
sta $23
lda {2} ; Note - address
jsr hexstr
ENDM
; ==============================================================
; Macro to position the cursor
; ==============================================================
MAC PLOT
ldy #{1}
ldx #{2}
clc
jsr $E50A ; PLOT - same on 64 and VIC
ENDM
; ==============================================================
; Macro to print a string
; ==============================================================
MAC PRINTSTRING
ldy #>{0}
lda #<{0}
jsr STROUT
ENDM
; ==============================================================
; Macro to print a byte (Hex)
; ==============================================================
MAC PRINTBYTE
ldx #$00
ldy #$0F
lda {0}
jsr printnum
ENDM
|
tests/listing/sld/sldopt.asm | fengjixuchui/sjasmplus | 220 | 5333 | DEVICE ZXSPECTRUMNEXT
ORG $8000
daa ; some eol comments with keyword1 included
nop ; some eol comment without any keyword
; full line comment with keyword2 included (line without code)
; full line without any keyword, but wrong cased Keyword2 (SLD keywords are case sensitive)
label1: DB 1,"b",3 ; some keyword3 here
label2: DB 4,"e",6 ; keyword none here
SLDOPT COMMENT keyword1, keyword2 ; SLDOPT is global directive
SLDOPT COMMENT keyword2, keyword3 ; and keywords could be added over multiple lines
ret ; some keyword1 also after SLDOPT specified (should not matter)
nop ; some eol comment without any keyword
MMU 6, 100
DISP 50000, 100
cpl ; keyword2 in displacement block (displaced address reported)
ENT
ORG 60000
MACRO MEMGUARD
defb 0 ; WPMEM keyword1
nop ; keyword3
ENDM
MEMGUARD
someData: dw 1234
MEMGUARD
; syntax error
SLDOPT INVALID whatever
SLDOPT COMMENT @@@ ; invalid keyword (must roughly fit rules of valid labels)
SLDOPT COMMENT
SLDOPT
|
apps/bootloader/bootloader.adb | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 16432 | <reponame>ekoeppen/MSP430_Generic_Ada_Drivers
with System.Machine_Code; use System.Machine_Code;
with System; use System;
with Interfaces; use Interfaces;
with MSP430_SVD; use MSP430_SVD;
with Flash;
with Board;
package body Bootloader is
Line : array (Unsigned_16 range 0 .. 47) of Unsigned_8;
Write_Addr : Unsigned_16;
Count : Unsigned_8;
User_Vector_Address : constant Unsigned_16 := 16#FFBE#;
Reset_Vector_Address : constant Unsigned_16 := 16#FFFE#;
Bootloader_Address : constant Unsigned_16 := 16#FC00#;
Vector_Segment_Address : constant Unsigned_16 := 16#FE00#;
Flash_Segment_Size : constant Unsigned_16 := 512;
package UART renames Board.UART;
procedure Erase is
Addr : Unsigned_16 := 16#C000#;
Saved_Vector : Unsigned_16;
Saved_Code : array (Unsigned_16 range 0 .. 127) of Unsigned_16;
begin
for I in Saved_Code'Range loop
Saved_Code (I) := Flash.Read (I * 2 + Vector_Segment_Address);
end loop;
Saved_Vector := Flash.Read (Reset_Vector_Address);
Flash.Unlock;
Flash.Erase (Vector_Segment_Address);
while Addr < Bootloader_Address loop
Flash.Erase (Addr);
Addr := Addr + Flash_Segment_Size;
end loop;
Flash.Enable_Write;
Flash.Write (Reset_Vector_Address, Saved_Vector);
for I in Saved_Code'Range loop
Flash.Write (I * 2 + Vector_Segment_Address, Saved_Code (I));
end loop;
Flash.Lock;
end Erase;
pragma Linker_Section (Erase, ".text.lower");
function Nibble (N : Unsigned_8) return Unsigned_8 is
begin
return (if N >= 65 then N - 65 + 10 else N - 48);
end Nibble;
function From_Hex (I : Unsigned_16) return Unsigned_8 is
begin
return 16 * Nibble (Line (I)) + Nibble (Line (I + 1));
end From_Hex;
procedure Write is
Value : Unsigned_16;
J : Unsigned_16;
begin
Flash.Unlock;
Flash.Enable_Write;
J := 9;
for I in Unsigned_16 range 1 .. Unsigned_16 (Count) / 2 loop
Value := Unsigned_16 (From_Hex (J)) +
256 * Unsigned_16 (From_Hex (J + 2));
if Write_Addr = Reset_Vector_Address then
Flash.Write (User_Vector_Address, Value);
else
Flash.Write (Write_Addr, Value);
end if;
J := J + 4;
Write_Addr := Write_Addr + Unsigned_16 (2);
end loop;
Flash.Lock;
end Write;
procedure Read_Lines is
Record_Type : Unsigned_8;
XON : constant Byte := 17;
XOFF : constant Byte := 19;
begin
loop
UART.Transmit (XON);
for I in Line'Range loop
Line (I) := Unsigned_8 (UART.Receive);
exit when Line (I) = 10;
end loop;
UART.Transmit (XOFF);
Count := From_Hex (1);
Write_Addr := Unsigned_16 (From_Hex (3)) * 256 + Unsigned_16 (From_Hex (5));
Record_Type := From_Hex (7);
case Record_Type is
when 16#00# => Write;
when 16#80# => Flash.Erase (Write_Addr);
when others => null;
end case;
end loop;
end Read_Lines;
procedure Start is
begin
Board.Init;
UART.Transmit (Character'Pos ('?'));
for J in 1 .. 12 loop
for I in 0 .. Unsigned_16'Last loop
if UART.Data_Available and then UART.Receive = Character'Pos ('f') then
while UART.Data_Available loop UART.Transmit (UART.Receive); end loop;
Flash.Init;
Erase;
Read_Lines;
end if;
end loop;
end loop;
if Flash.Read (User_Vector_Address) /= 16#FFFF# then
Asm ("mov #0xffbe, r8", Volatile => True);
Asm ("mov.b #0x60, &0x56", Volatile => True);
Asm ("mov.b #0x87, &0x57", Volatile => True);
Asm ("mov #0x5a00, &0x120", Volatile => True);
Asm ("br 0(r8)", Volatile => True);
end if;
end Start;
procedure Start_1 is
begin
Board.Init;
Flash.Init;
Erase;
Read_Lines;
loop null; end loop;
end Start_1;
end Bootloader;
|
thirdparty/adasdl/thin/adasdl/AdaSDL_framebuff/sdltests/testsem_sprogs.adb | Lucretia/old_nehe_ada95 | 0 | 22638 |
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by <NAME> - www.libsdl.org --
-- translation made by <NAME> - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with Interfaces.C.Strings;
with Ada.Unchecked_Conversion;
with SDL.Timer;
with SDL.Types; use SDL.Types;
with Ada.Text_IO; use Ada.Text_IO;
package body TestSem_Sprogs is
package T renames SDL.Timer;
function To_int is
new Ada.Unchecked_Conversion (System.Address, C.int);
-- ======================================
function ThreadFunc (data : System.Address) return C.int
is
begin
while alive loop
M.SemWait (sem);
Put_Line ("Thread number " & C.int'Image (To_int (data)) &
" has got the semaphore (value = " &
Uint32'Image (M.SemValue (sem)) & ")!");
T.SDL_Delay (200);
M.SemPost (sem);
Put_Line ("Thread number " & C.int'Image (To_int (data)) &
" has released the semaphore (value = " &
Uint32'Image (M.SemValue (sem)) & ")!");
T.SDL_Delay (1); -- For the scheduler
end loop;
Put_Line ("Thread number " & C.int'Image (To_int (data)) & " exiting");
return 0;
end ThreadFunc;
-- ======================================
procedure killed (sig : C.int) is
begin
alive := False;
end killed;
-- ======================================
end TestSem_Sprogs;
|
alloy4fun_models/trashltl/main.als | Kaixi26/org.alloytools.alloy | 0 | 3854 | <reponame>Kaixi26/org.alloytools.alloy
module Main
var sig File {
var link : lone File
}
var sig Trash in File {}
var sig Protected in File {}
pred prop1o {
no Trash + Protected
}
pred prop2o {
no File
some File'
}
pred prop3o {
always some File
}
pred prop4o {
eventually some Trash
}
pred prop5o {
eventually some f:File | f not in File'
}
pred prop6o {
always all f:Trash | always f in Trash
}
pred prop7o {
eventually some Protected
}
pred prop8o {
always all l : link.File | eventually l in Trash
}
pred prop9o {
always no Protected & Trash
}
pred prop10o {
always Protected' = Protected
}
pred prop11o {
always all f: File | f not in Protected implies f in Protected'
}
pred prop12o {
eventually some f : File | always f in Trash
}
pred prop13o {
always all f : Trash | once f not in Trash
}
pred prop14o {
always all f : Protected | f in Trash implies after f not in Protected
}
pred prop15o {
always all f : File | eventually f in Trash
}
pred prop16o {
always all f : Protected | historically f in Protected
}
pred prop17o {
always all f : Trash | f not in File'
}
pred prop18o {
always all f : Protected | f not in Protected' implies f in Trash
}
pred prop19o {
always all f : Protected | f in Protected until f in Trash
}
pred prop20o {
always all f:Trash | f in Trash since f not in Protected
}
|
src/main/antlr/com/harmoneye/music/chord/gen/ChordLabels.g4 | bzamecnik/chord-labels-java | 0 | 4055 | /**
* Grammar for chord labels
*
* <NAME> al. (2005).
* Symbolic representation of musical chords: a proposed syntax for text
* annotations. Proceedings of 6th International Conference on Music
* Information Retrieval.
*
* Syntax of Chord Notation in Backus-Naur Form:
*
* <chord> ::= <root> ":" <shorthand> ["("<degree-list>")"]["/"<degree>]
* | <root> ":" "("<degree-list>")" ["/"<degree>]
* | <root> ["/"<degree>] | "N"
* <root> ::= <natural> | <root> <modifier>
* <natural> ::= A|B|C|D|E|F|G
* <modifier> ::= b|#
* <degree-list> ::= ["*"] <degree> ["," <degree-list>]
* <degree> ::= <interval> | <modifier> <degree>
* <interval> ::= 1|2|3|4|5|6|7|8|9|10|11|12|13
* <shorthand> ::= maj|min|dim|aug|maj7|min7|7|dim7|hdim7
* |minmaj7|maj6|min6|9|maj9|min9|sus4
*/
grammar ChordLabels;
@header {
package com.harmoneye.music.chord.gen;
}
timedChords: timedChord*;
timedChord: startTime WS_SEP endTime WS_SEP chord;
startTime: TIME;
endTime: TIME;
chords: chord+;
chord: root (SEPARATOR (components | shorthand components?))? bass? | NO_CHORD;
root: natural modifier*;
natural: NATURAL;
modifier: MODIFIER;
shorthand: SHORTHAND | INTERVAL;
components: '(' component (',' component)* ')';
component: missing? degree;
missing: MISSING;
degree: modifier* interval;
interval: INTERVAL;
bass: ('/' degree);
NATURAL: ('A'..'G');
MODIFIER: FLAT | SHARP;
FLAT: 'b';
SHARP: '#';
INTERVAL: [1-9] | '1' [0-3];
// plain numeric shorthands are already matched to INTERVALs and cannot be reused
SHORTHAND: 'maj' | 'min' | 'dim' | 'aug' | 'maj7' | 'min7' | 'dim7'
| 'hdim7' | 'minmaj7' | 'maj6' | 'min6' | 'maj9' | 'min9' | 'sus4' | 'sus2';
MISSING: '*';
NO_CHORD: 'N';
SEPARATOR: ':';
TIME: [0-9]+ ('.' [0-9]+)?;
WS_SEP: [ \t];
COMMENT: {getCharPositionInLine()==0}? '#' ~[\r\n]* -> skip;
WS: [\n\r]+ -> skip;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.