max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
oeis/021/A021203.asm | neoneye/loda-programs | 11 | 11735 | <reponame>neoneye/loda-programs
; A021203: Decimal expansion of 1/199.
; Submitted by <NAME>iga
; 0,0,5,0,2,5,1,2,5,6,2,8,1,4,0,7,0,3,5,1,7,5,8,7,9,3,9,6,9,8,4,9,2,4,6,2,3,1,1,5,5,7,7,8,8,9,4,4,7,2,3,6,1,8,0,9,0,4,5,2,2,6,1,3,0,6,5,3,2,6,6,3,3,1,6,5,8,2,9,1,4,5,7,2,8,6,4,3,2,1,6,0,8,0,4,0,2,0,1
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
div $2,20
mul $3,10
lpe
mov $0,$2
mod $0,10
|
arch/ARM/NXP/svd/lpc55s6x/nxp_svd-ctimer.ads | morbos/Ada_Drivers_Library | 2 | 9939 | -- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.CTIMER is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Interrupt Register. The IR can be written to clear interrupts. The IR
-- can be read to identify which of eight possible interrupt sources are
-- pending.
type IR_Register is record
-- Interrupt flag for match channel 0.
MR0INT : Boolean := False;
-- Interrupt flag for match channel 1.
MR1INT : Boolean := False;
-- Interrupt flag for match channel 2.
MR2INT : Boolean := False;
-- Interrupt flag for match channel 3.
MR3INT : Boolean := False;
-- Interrupt flag for capture channel 0 event.
CR0INT : Boolean := False;
-- Interrupt flag for capture channel 1 event.
CR1INT : Boolean := False;
-- Interrupt flag for capture channel 2 event.
CR2INT : Boolean := False;
-- Interrupt flag for capture channel 3 event.
CR3INT : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IR_Register use record
MR0INT at 0 range 0 .. 0;
MR1INT at 0 range 1 .. 1;
MR2INT at 0 range 2 .. 2;
MR3INT at 0 range 3 .. 3;
CR0INT at 0 range 4 .. 4;
CR1INT at 0 range 5 .. 5;
CR2INT at 0 range 6 .. 6;
CR3INT at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Counter enable.
type TCR_CEN_Field is
(
-- Disabled.The counters are disabled.
Disabled,
-- Enabled. The Timer Counter and Prescale Counter are enabled.
Enabled)
with Size => 1;
for TCR_CEN_Field use
(Disabled => 0,
Enabled => 1);
-- Counter reset.
type TCR_CRST_Field is
(
-- Disabled. Do nothing.
Disabled,
-- Enabled. The Timer Counter and the Prescale Counter are synchronously
-- reset on the next positive edge of the APB bus clock. The counters
-- remain reset until TCR[1] is returned to zero.
Enabled)
with Size => 1;
for TCR_CRST_Field use
(Disabled => 0,
Enabled => 1);
-- Timer Control Register. The TCR is used to control the Timer Counter
-- functions. The Timer Counter can be disabled or reset through the TCR.
type TCR_Register is record
-- Counter enable.
CEN : TCR_CEN_Field := NXP_SVD.CTIMER.Disabled;
-- Counter reset.
CRST : TCR_CRST_Field := NXP_SVD.CTIMER.Disabled;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TCR_Register use record
CEN at 0 range 0 .. 0;
CRST at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- Match Control Register
type MCR_Register is record
-- Interrupt on MR0: an interrupt is generated when MR0 matches the
-- value in the TC.
MR0I : Boolean := False;
-- Reset on MR0: the TC will be reset if MR0 matches it.
MR0R : Boolean := False;
-- Stop on MR0: the TC and PC will be stopped and TCR[0] will be set to
-- 0 if MR0 matches the TC.
MR0S : Boolean := False;
-- Interrupt on MR1: an interrupt is generated when MR1 matches the
-- value in the TC.
MR1I : Boolean := False;
-- Reset on MR1: the TC will be reset if MR1 matches it.
MR1R : Boolean := False;
-- Stop on MR1: the TC and PC will be stopped and TCR[0] will be set to
-- 0 if MR1 matches the TC.
MR1S : Boolean := False;
-- Interrupt on MR2: an interrupt is generated when MR2 matches the
-- value in the TC.
MR2I : Boolean := False;
-- Reset on MR2: the TC will be reset if MR2 matches it.
MR2R : Boolean := False;
-- Stop on MR2: the TC and PC will be stopped and TCR[0] will be set to
-- 0 if MR2 matches the TC.
MR2S : Boolean := False;
-- Interrupt on MR3: an interrupt is generated when MR3 matches the
-- value in the TC.
MR3I : Boolean := False;
-- Reset on MR3: the TC will be reset if MR3 matches it.
MR3R : Boolean := False;
-- Stop on MR3: the TC and PC will be stopped and TCR[0] will be set to
-- 0 if MR3 matches the TC.
MR3S : Boolean := False;
-- unspecified
Reserved_12_23 : HAL.UInt12 := 16#0#;
-- Reload MR0 with the contents of the Match 0 Shadow Register when the
-- TC is reset to zero (either via a match event or a write to bit 1 of
-- the TCR).
MR0RL : Boolean := False;
-- Reload MR1 with the contents of the Match 1 Shadow Register when the
-- TC is reset to zero (either via a match event or a write to bit 1 of
-- the TCR).
MR1RL : Boolean := False;
-- Reload MR2 with the contents of the Match 2 Shadow Register when the
-- TC is reset to zero (either via a match event or a write to bit 1 of
-- the TCR).
MR2RL : Boolean := False;
-- Reload MR3 with the contents of the Match 3 Shadow Register when the
-- TC is reset to zero (either via a match event or a write to bit 1 of
-- the TCR).
MR3RL : Boolean := False;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MCR_Register use record
MR0I at 0 range 0 .. 0;
MR0R at 0 range 1 .. 1;
MR0S at 0 range 2 .. 2;
MR1I at 0 range 3 .. 3;
MR1R at 0 range 4 .. 4;
MR1S at 0 range 5 .. 5;
MR2I at 0 range 6 .. 6;
MR2R at 0 range 7 .. 7;
MR2S at 0 range 8 .. 8;
MR3I at 0 range 9 .. 9;
MR3R at 0 range 10 .. 10;
MR3S at 0 range 11 .. 11;
Reserved_12_23 at 0 range 12 .. 23;
MR0RL at 0 range 24 .. 24;
MR1RL at 0 range 25 .. 25;
MR2RL at 0 range 26 .. 26;
MR3RL at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-- Match Register . MR can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR matches the TC.
-- Match Register . MR can be enabled through the MCR to reset the TC, stop
-- both the TC and PC, and/or generate an interrupt every time MR matches
-- the TC.
type MR_Registers is array (0 .. 3) of HAL.UInt32
with Volatile;
-- Capture Control Register. The CCR controls which edges of the capture
-- inputs are used to load the Capture Registers and whether or not an
-- interrupt is generated when a capture takes place.
type CCR_Register is record
-- Rising edge of capture channel 0: a sequence of 0 then 1 causes CR0
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP0RE : Boolean := False;
-- Falling edge of capture channel 0: a sequence of 1 then 0 causes CR0
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP0FE : Boolean := False;
-- Generate interrupt on channel 0 capture event: a CR0 load generates
-- an interrupt.
CAP0I : Boolean := False;
-- Rising edge of capture channel 1: a sequence of 0 then 1 causes CR1
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP1RE : Boolean := False;
-- Falling edge of capture channel 1: a sequence of 1 then 0 causes CR1
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP1FE : Boolean := False;
-- Generate interrupt on channel 1 capture event: a CR1 load generates
-- an interrupt.
CAP1I : Boolean := False;
-- Rising edge of capture channel 2: a sequence of 0 then 1 causes CR2
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP2RE : Boolean := False;
-- Falling edge of capture channel 2: a sequence of 1 then 0 causes CR2
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP2FE : Boolean := False;
-- Generate interrupt on channel 2 capture event: a CR2 load generates
-- an interrupt.
CAP2I : Boolean := False;
-- Rising edge of capture channel 3: a sequence of 0 then 1 causes CR3
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP3RE : Boolean := False;
-- Falling edge of capture channel 3: a sequence of 1 then 0 causes CR3
-- to be loaded with the contents of TC. 0 = disabled. 1 = enabled.
CAP3FE : Boolean := False;
-- Generate interrupt on channel 3 capture event: a CR3 load generates
-- an interrupt.
CAP3I : Boolean := False;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR_Register use record
CAP0RE at 0 range 0 .. 0;
CAP0FE at 0 range 1 .. 1;
CAP0I at 0 range 2 .. 2;
CAP1RE at 0 range 3 .. 3;
CAP1FE at 0 range 4 .. 4;
CAP1I at 0 range 5 .. 5;
CAP2RE at 0 range 6 .. 6;
CAP2FE at 0 range 7 .. 7;
CAP2I at 0 range 8 .. 8;
CAP3RE at 0 range 9 .. 9;
CAP3FE at 0 range 10 .. 10;
CAP3I at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-- Capture Register . CR is loaded with the value of TC when there is an event on the CAPn. input.
-- Capture Register . CR is loaded with the value of TC when there is an
-- event on the CAPn. input.
type CR_Registers is array (0 .. 3) of HAL.UInt32
with Volatile;
-- EMR_EM array
type EMR_EM_Field_Array is array (0 .. 3) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for EMR_EM
type EMR_EM_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- EM as a value
Val : HAL.UInt4;
when True =>
-- EM as an array
Arr : EMR_EM_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EMR_EM_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- External Match Control 0. Determines the functionality of External Match
-- 0.
type EMR_EMC0_Field is
(
-- Do Nothing.
Do_Nothing,
-- Clear. Clear the corresponding External Match bit/output to 0 (MAT0
-- pin is LOW if pinned out).
Clear,
-- Set. Set the corresponding External Match bit/output to 1 (MAT0 pin
-- is HIGH if pinned out).
Set,
-- Toggle. Toggle the corresponding External Match bit/output.
Toggle)
with Size => 2;
for EMR_EMC0_Field use
(Do_Nothing => 0,
Clear => 1,
Set => 2,
Toggle => 3);
-- External Match Control 1. Determines the functionality of External Match
-- 1.
type EMR_EMC1_Field is
(
-- Do Nothing.
Do_Nothing,
-- Clear. Clear the corresponding External Match bit/output to 0 (MAT1
-- pin is LOW if pinned out).
Clear,
-- Set. Set the corresponding External Match bit/output to 1 (MAT1 pin
-- is HIGH if pinned out).
Set,
-- Toggle. Toggle the corresponding External Match bit/output.
Toggle)
with Size => 2;
for EMR_EMC1_Field use
(Do_Nothing => 0,
Clear => 1,
Set => 2,
Toggle => 3);
-- External Match Control 2. Determines the functionality of External Match
-- 2.
type EMR_EMC2_Field is
(
-- Do Nothing.
Do_Nothing,
-- Clear. Clear the corresponding External Match bit/output to 0 (MAT2
-- pin is LOW if pinned out).
Clear,
-- Set. Set the corresponding External Match bit/output to 1 (MAT2 pin
-- is HIGH if pinned out).
Set,
-- Toggle. Toggle the corresponding External Match bit/output.
Toggle)
with Size => 2;
for EMR_EMC2_Field use
(Do_Nothing => 0,
Clear => 1,
Set => 2,
Toggle => 3);
-- External Match Control 3. Determines the functionality of External Match
-- 3.
type EMR_EMC3_Field is
(
-- Do Nothing.
Do_Nothing,
-- Clear. Clear the corresponding External Match bit/output to 0 (MAT3
-- pin is LOW if pinned out).
Clear,
-- Set. Set the corresponding External Match bit/output to 1 (MAT3 pin
-- is HIGH if pinned out).
Set,
-- Toggle. Toggle the corresponding External Match bit/output.
Toggle)
with Size => 2;
for EMR_EMC3_Field use
(Do_Nothing => 0,
Clear => 1,
Set => 2,
Toggle => 3);
-- External Match Register. The EMR controls the match function and the
-- external match pins.
type EMR_Register is record
-- External Match 0. This bit reflects the state of output MAT0, whether
-- or not this output is connected to a pin. When a match occurs between
-- the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do
-- nothing, as selected by EMR[5:4]. This bit is driven to the MAT pins
-- if the match function is selected via IOCON. 0 = LOW. 1 = HIGH.
EM : EMR_EM_Field := (As_Array => False, Val => 16#0#);
-- External Match Control 0. Determines the functionality of External
-- Match 0.
EMC0 : EMR_EMC0_Field := NXP_SVD.CTIMER.Do_Nothing;
-- External Match Control 1. Determines the functionality of External
-- Match 1.
EMC1 : EMR_EMC1_Field := NXP_SVD.CTIMER.Do_Nothing;
-- External Match Control 2. Determines the functionality of External
-- Match 2.
EMC2 : EMR_EMC2_Field := NXP_SVD.CTIMER.Do_Nothing;
-- External Match Control 3. Determines the functionality of External
-- Match 3.
EMC3 : EMR_EMC3_Field := NXP_SVD.CTIMER.Do_Nothing;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for EMR_Register use record
EM at 0 range 0 .. 3;
EMC0 at 0 range 4 .. 5;
EMC1 at 0 range 6 .. 7;
EMC2 at 0 range 8 .. 9;
EMC3 at 0 range 10 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
-- Counter/Timer Mode This field selects which rising APB bus clock edges
-- can increment Timer's Prescale Counter (PC), or clear PC and increment
-- Timer Counter (TC). Timer Mode: the TC is incremented when the Prescale
-- Counter matches the Prescale Register.
type CTCR_CTMODE_Field is
(
-- Timer Mode. Incremented every rising APB bus clock edge.
Timer,
-- Counter Mode rising edge. TC is incremented on rising edges on the
-- CAP input selected by bits 3:2.
Counter_Rising_Edge,
-- Counter Mode falling edge. TC is incremented on falling edges on the
-- CAP input selected by bits 3:2.
Counter_Falling_Edge,
-- Counter Mode dual edge. TC is incremented on both edges on the CAP
-- input selected by bits 3:2.
Counter_Dual_Edge)
with Size => 2;
for CTCR_CTMODE_Field use
(Timer => 0,
Counter_Rising_Edge => 1,
Counter_Falling_Edge => 2,
Counter_Dual_Edge => 3);
-- Count Input Select When bits 1:0 in this register are not 00, these bits
-- select which CAP pin is sampled for clocking. Note: If Counter mode is
-- selected for a particular CAPn input in the CTCR, the 3 bits for that
-- input in the Capture Control Register (CCR) must be programmed as 000.
-- However, capture and/or interrupt can be selected for the other 3 CAPn
-- inputs in the same timer.
type CTCR_CINSEL_Field is
(
-- Channel 0. CAPn.0 for CTIMERn
Channel_0,
-- Channel 1. CAPn.1 for CTIMERn
Channel_1,
-- Channel 2. CAPn.2 for CTIMERn
Channel_2,
-- Channel 3. CAPn.3 for CTIMERn
Channel_3)
with Size => 2;
for CTCR_CINSEL_Field use
(Channel_0 => 0,
Channel_1 => 1,
Channel_2 => 2,
Channel_3 => 3);
-- Edge select. When bit 4 is 1, these bits select which capture input edge
-- will cause the timer and prescaler to be cleared. These bits have no
-- effect when bit 4 is low. Values 0x2 to 0x3 and 0x6 to 0x7 are reserved.
type CTCR_SELCC_Field is
(
-- Channel 0 Rising Edge. Rising edge of the signal on capture channel 0
-- clears the timer (if bit 4 is set).
Channel_0_Rising,
-- Channel 0 Falling Edge. Falling edge of the signal on capture channel
-- 0 clears the timer (if bit 4 is set).
Channel_0_Falling,
-- Channel 1 Rising Edge. Rising edge of the signal on capture channel 1
-- clears the timer (if bit 4 is set).
Channel_1_Rising,
-- Channel 1 Falling Edge. Falling edge of the signal on capture channel
-- 1 clears the timer (if bit 4 is set).
Channel_1_Falling,
-- Channel 2 Rising Edge. Rising edge of the signal on capture channel 2
-- clears the timer (if bit 4 is set).
Channel_2_Rising,
-- Channel 2 Falling Edge. Falling edge of the signal on capture channel
-- 2 clears the timer (if bit 4 is set).
Channel_2_Falling)
with Size => 3;
for CTCR_SELCC_Field use
(Channel_0_Rising => 0,
Channel_0_Falling => 1,
Channel_1_Rising => 2,
Channel_1_Falling => 3,
Channel_2_Rising => 4,
Channel_2_Falling => 5);
-- Count Control Register. The CTCR selects between Timer and Counter mode,
-- and in Counter mode selects the signal and edge(s) for counting.
type CTCR_Register is record
-- Counter/Timer Mode This field selects which rising APB bus clock
-- edges can increment Timer's Prescale Counter (PC), or clear PC and
-- increment Timer Counter (TC). Timer Mode: the TC is incremented when
-- the Prescale Counter matches the Prescale Register.
CTMODE : CTCR_CTMODE_Field := NXP_SVD.CTIMER.Timer;
-- Count Input Select When bits 1:0 in this register are not 00, these
-- bits select which CAP pin is sampled for clocking. Note: If Counter
-- mode is selected for a particular CAPn input in the CTCR, the 3 bits
-- for that input in the Capture Control Register (CCR) must be
-- programmed as 000. However, capture and/or interrupt can be selected
-- for the other 3 CAPn inputs in the same timer.
CINSEL : CTCR_CINSEL_Field := NXP_SVD.CTIMER.Channel_0;
-- Setting this bit to 1 enables clearing of the timer and the prescaler
-- when the capture-edge event specified in bits 7:5 occurs.
ENCC : Boolean := False;
-- Edge select. When bit 4 is 1, these bits select which capture input
-- edge will cause the timer and prescaler to be cleared. These bits
-- have no effect when bit 4 is low. Values 0x2 to 0x3 and 0x6 to 0x7
-- are reserved.
SELCC : CTCR_SELCC_Field := NXP_SVD.CTIMER.Channel_0_Rising;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CTCR_Register use record
CTMODE at 0 range 0 .. 1;
CINSEL at 0 range 2 .. 3;
ENCC at 0 range 4 .. 4;
SELCC at 0 range 5 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- PWM mode enable for channel0.
type PWMC_PWMEN0_Field is
(
-- Match. CTIMERn_MAT0 is controlled by EM0.
Match,
-- PWM. PWM mode is enabled for CTIMERn_MAT0.
Pwm)
with Size => 1;
for PWMC_PWMEN0_Field use
(Match => 0,
Pwm => 1);
-- PWM mode enable for channel1.
type PWMC_PWMEN1_Field is
(
-- Match. CTIMERn_MAT01 is controlled by EM1.
Match,
-- PWM. PWM mode is enabled for CTIMERn_MAT1.
Pwm)
with Size => 1;
for PWMC_PWMEN1_Field use
(Match => 0,
Pwm => 1);
-- PWM mode enable for channel2.
type PWMC_PWMEN2_Field is
(
-- Match. CTIMERn_MAT2 is controlled by EM2.
Match,
-- PWM. PWM mode is enabled for CTIMERn_MAT2.
Pwm)
with Size => 1;
for PWMC_PWMEN2_Field use
(Match => 0,
Pwm => 1);
-- PWM mode enable for channel3. Note: It is recommended to use match
-- channel 3 to set the PWM cycle.
type PWMC_PWMEN3_Field is
(
-- Match. CTIMERn_MAT3 is controlled by EM3.
Match,
-- PWM. PWM mode is enabled for CT132Bn_MAT3.
Pwm)
with Size => 1;
for PWMC_PWMEN3_Field use
(Match => 0,
Pwm => 1);
-- PWM Control Register. This register enables PWM mode for the external
-- match pins.
type PWMC_Register is record
-- PWM mode enable for channel0.
PWMEN0 : PWMC_PWMEN0_Field := NXP_SVD.CTIMER.Match;
-- PWM mode enable for channel1.
PWMEN1 : PWMC_PWMEN1_Field := NXP_SVD.CTIMER.Match;
-- PWM mode enable for channel2.
PWMEN2 : PWMC_PWMEN2_Field := NXP_SVD.CTIMER.Match;
-- PWM mode enable for channel3. Note: It is recommended to use match
-- channel 3 to set the PWM cycle.
PWMEN3 : PWMC_PWMEN3_Field := NXP_SVD.CTIMER.Match;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PWMC_Register use record
PWMEN0 at 0 range 0 .. 0;
PWMEN1 at 0 range 1 .. 1;
PWMEN2 at 0 range 2 .. 2;
PWMEN3 at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Match Shadow Register
-- Match Shadow Register
type MSR_Registers is array (0 .. 3) of HAL.UInt32
with Volatile;
-----------------
-- Peripherals --
-----------------
-- Standard counter/timers (CTIMER0 to 4)
type CTIMER_Peripheral is record
-- Interrupt Register. The IR can be written to clear interrupts. The IR
-- can be read to identify which of eight possible interrupt sources are
-- pending.
IR : aliased IR_Register;
-- Timer Control Register. The TCR is used to control the Timer Counter
-- functions. The Timer Counter can be disabled or reset through the
-- TCR.
TCR : aliased TCR_Register;
-- Timer Counter
TC : aliased HAL.UInt32;
-- Prescale Register
PR : aliased HAL.UInt32;
-- Prescale Counter
PC : aliased HAL.UInt32;
-- Match Control Register
MCR : aliased MCR_Register;
-- Match Register . MR can be enabled through the MCR to reset the TC,
-- stop both the TC and PC, and/or generate an interrupt every time MR
-- matches the TC.
MR : aliased MR_Registers;
-- Capture Control Register. The CCR controls which edges of the capture
-- inputs are used to load the Capture Registers and whether or not an
-- interrupt is generated when a capture takes place.
CCR : aliased CCR_Register;
-- Capture Register . CR is loaded with the value of TC when there is an
-- event on the CAPn. input.
CR : aliased CR_Registers;
-- External Match Register. The EMR controls the match function and the
-- external match pins.
EMR : aliased EMR_Register;
-- Count Control Register. The CTCR selects between Timer and Counter
-- mode, and in Counter mode selects the signal and edge(s) for
-- counting.
CTCR : aliased CTCR_Register;
-- PWM Control Register. This register enables PWM mode for the external
-- match pins.
PWMC : aliased PWMC_Register;
-- Match Shadow Register
MSR : aliased MSR_Registers;
end record
with Volatile;
for CTIMER_Peripheral use record
IR at 16#0# range 0 .. 31;
TCR at 16#4# range 0 .. 31;
TC at 16#8# range 0 .. 31;
PR at 16#C# range 0 .. 31;
PC at 16#10# range 0 .. 31;
MCR at 16#14# range 0 .. 31;
MR at 16#18# range 0 .. 127;
CCR at 16#28# range 0 .. 31;
CR at 16#2C# range 0 .. 127;
EMR at 16#3C# range 0 .. 31;
CTCR at 16#70# range 0 .. 31;
PWMC at 16#74# range 0 .. 31;
MSR at 16#78# range 0 .. 127;
end record;
-- Standard counter/timers (CTIMER0 to 4)
CTIMER0_Periph : aliased CTIMER_Peripheral
with Import, Address => System'To_Address (16#40008000#);
-- Standard counter/timers (CTIMER0 to 4)
CTIMER1_Periph : aliased CTIMER_Peripheral
with Import, Address => System'To_Address (16#40009000#);
-- Standard counter/timers (CTIMER0 to 4)
CTIMER2_Periph : aliased CTIMER_Peripheral
with Import, Address => System'To_Address (16#40028000#);
-- Standard counter/timers (CTIMER0 to 4)
CTIMER3_Periph : aliased CTIMER_Peripheral
with Import, Address => System'To_Address (16#40029000#);
-- Standard counter/timers (CTIMER0 to 4)
CTIMER4_Periph : aliased CTIMER_Peripheral
with Import, Address => System'To_Address (16#4002A000#);
end NXP_SVD.CTIMER;
|
programs/oeis/085/A085279.asm | neoneye/loda | 22 | 13514 | <filename>programs/oeis/085/A085279.asm
; A085279: Expansion of (1 - 2*x - 2*x^2)/((1 - 2*x)*(1 - 3*x)).
; 1,3,7,17,43,113,307,857,2443,7073,20707,61097,181243,539633,1610707,4815737,14414443,43177793,129402307,387944777,1163310043,3488881553,10464547507,31389448217,94159956043,282463090913,847355718307,2542000046057,7625865920443,22877329325873,68631451106707,205893279578297,617677691251243,1853028778786433,5559077746424707,16677216059404937,50031613818476443,150094772735952593,450284180768904307,1350852267428805977,4052556252530604043,12157667658080184353,36473000775217297507,109418997927605381417,328256984986723122043,984770937367983321713,2954312776919577876307,8862938260389989451257,26588814640432479998443,79766443639822463284673,239299330356517436432707,717897989943652402455497,2153693967579157393681243,6461081898233872553673233,19383245685694418406278707,58149737039068856709354137,174449211081177773109098443,523347633171475725289367393,1570042899370311987792246307,4710128697822705587225027177,14130386092891656009371658043,42391158277522046523508127153,127173474830260296561310687507,381520424486169203665504674617,1144561273449284238959659248043,3433683820329405972805268192513,10301051460951324430268385474307,30903154382780186314510318216457,92709463148192984990941278236443,278128389444283807067644481883473,834385168332261125392574739998707,2503155504995602784557006808692697,7509466514984447170429585603471243,22528399544948619144805887165200033,67585198634836412701451922205172707,202755595904490348638424288034663337,608266787713433266983409906942280443
mov $2,1
mov $3,1
lpb $0
sub $0,1
add $1,$3
mul $2,2
mov $3,$1
add $3,$1
lpe
add $1,$2
mov $0,$1
|
source/code/error.asm | paulscottrobson/rpl-c | 1 | 177162 | ; *****************************************************************************
; *****************************************************************************
;
; Name : error.asm
; Purpose : Error Reporting
; Author : <NAME> (<EMAIL>)
; Date : 14th January 2020
;
; *****************************************************************************
; *****************************************************************************
; *****************************************************************************
;
; Error handler, entered via JSR, ASCIIZ message follows
;
; *****************************************************************************
ErrorHandler:
.if encode != 0 ; encode test doesn't cause sn error loop
.byte $FF
.endif
pla ; get message address
ply
inc a
bne _EHNoCarry
iny
_EHNoCarry:
jsr EXPrintString
ldy #1 ; check if there is a line #
lda (IP),y
iny
ora (IP),y
beq _EHNoLine
lda #_EHMsg2 & $FF ; print " at "
ldy #_EHMsg2 >> 8
jsr EXPrintString
ldy #2 ; print line number
lda (IP),y
pha
dey
lda (IP),y
ply
clc
jsr PrintYA
_EHNoLine:
lda #13
jsr ExternPrint
jmp WarmStartBlankStack ; S is indeterminate
_EHMsg2:.text " AT ",0 |
oeis/233/A233078.asm | neoneye/loda-programs | 11 | 178587 | <reponame>neoneye/loda-programs
; A233078: Number of n X 4 0..3 arrays with no element x(i,j) adjacent to value 3-x(i,j) horizontally or antidiagonally, top left element zero, and 1 appearing before 2 in row major order.
; 14,662,32414,1588262,77824814,3813415862,186857377214,9156011483462,448644562689614,21983583571791062,1077195595017762014,52782584155870338662,2586346623637646594414,126730984558244683126262,6209818243353989473186814,304281093924345484186153862,14909773602292928725121539214,730578906512353507530955421462,35798366419105321869016815651614,1754119954536160771581823966929062,85951877772271877807509374379524014,4211642010841322012567959344596676662,206370458531224778615830007885237156414
mov $1,49
pow $1,$0
div $1,48
mul $1,648
add $1,14
mov $0,$1
|
Beta.agda | iwilare/church-rosser | 5 | 2325 | <filename>Beta.agda<gh_stars>1-10
open import Data.Nat using (suc)
open import Substitution using (rename-subst-commute; subst-commute)
open import DeBruijn
infix 3 _—→_
data _—→_ : ∀ {n} → Term n → Term n → Set where
—→-ξₗ : ∀ {n} {M M′ N : Term n}
→ M —→ M′
---------------
→ M · N —→ M′ · N
—→-ξᵣ : ∀ {n} {M N N′ : Term n}
→ N —→ N′
---------------
→ M · N —→ M · N′
—→-ƛ : ∀ {n} {M M′ : Term (suc n)}
→ M —→ M′
-----------
→ ƛ M —→ ƛ M′
—→-β : ∀ {n} {M : Term (suc n)} {N : Term n}
--------------------
→ (ƛ M) · N —→ M [ N ]
infix 3 _—↠_
infixr 3 _—→⟨_⟩_
infix 4 _∎
data _—↠_ : ∀ {n} → Term n → Term n → Set where
_∎ : ∀ {n} (M : Term n)
------
→ M —↠ M
_—→⟨_⟩_ : ∀ {n} {L N : Term n} (M : Term n)
→ M —→ L
→ L —↠ N
------
→ M —↠ N
—↠-trans : ∀ {n} {M L N : Term n}
→ M —↠ L
→ L —↠ N
------
→ M —↠ N
—↠-trans (M ∎) M—↠M = M—↠M
—↠-trans (M —→⟨ M—→L′ ⟩ L′—↠L) L—↠N = M —→⟨ M—→L′ ⟩ (—↠-trans L′—↠L L—↠N )
—↠-congₗ : ∀ {n} {M M′ R : Term n}
→ M —↠ M′
---------------
→ M · R —↠ M′ · R
—↠-congₗ {M = M}{R = R} (M ∎) = M · R ∎
—↠-congₗ {M = M}{R = R} (M —→⟨ M—→L ⟩ L—↠M′) = M · R —→⟨ —→-ξₗ M—→L ⟩ —↠-congₗ L—↠M′
—↠-congᵣ : ∀ {n} {M M′ L : Term n}
→ M —↠ M′
---------------
→ L · M —↠ L · M′
—↠-congᵣ {M = M}{L = L} (M ∎) = L · M ∎
—↠-congᵣ {M = M}{L = L} (M —→⟨ M—→L ⟩ L—↠M′) = L · M —→⟨ —→-ξᵣ M—→L ⟩ —↠-congᵣ L—↠M′
—↠-cong-ƛ : ∀ {n} {M M′ : Term (suc n)}
→ M —↠ M′
-----------
→ ƛ M —↠ ƛ M′
—↠-cong-ƛ (M ∎) = ƛ M ∎
—↠-cong-ƛ (M —→⟨ M—→L ⟩ L—↠N′) = ƛ M —→⟨ —→-ƛ M—→L ⟩ —↠-cong-ƛ L—↠N′
—↠-cong : ∀ {n} {M M′ N N′ : Term n}
→ M —↠ M′
→ N —↠ N′
----------------
→ M · N —↠ M′ · N′
—↠-cong M—↠M′ N—↠N′ = —↠-trans (—↠-congₗ M—↠M′) (—↠-congᵣ N—↠N′)
|
Data/Nat/Even.agda | LaudateCorpus1/aaosl-agda | 9 | 6208 | <reponame>LaudateCorpus1/aaosl-agda<filename>Data/Nat/Even.agda
{- Formal verification of authenticated append-only skiplists in Agda, version 1.0.
Copyright (c) 2020 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
open import Data.Empty
open import Data.Nat
open import Data.Product
open import Data.Nat.Divisibility
open import Data.Nat.Properties
open import Relation.Nullary
open import Relation.Nullary.Negation
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.HeterogeneousEquality
using (_≅_; ≅-to-≡; ≡-to-≅; _≇_)
renaming (cong to ≅-cong; refl to ≅-refl; cong₂ to ≅-cong₂)
open import Function
-- This module proves a number of properties about even numbers.
-- We borrow some things from Data.Nat.Divisibility but specialize most
-- of them to divisibility-by-2.
module Data.Nat.Even where
open import AAOSL.Lemmas
Even : ℕ → Set
Even n = 2 ∣ n
even? : (n : ℕ) → Dec (Even n)
even? n = 2 ∣? n
Odd : ℕ → Set
Odd = ¬_ ∘ Even
even-irrelevant : ∀{n}(p q : Even n) → p ≡ q
even-irrelevant (divides q₁ e₁) (divides q₂ e₂)
with *2-injective q₁ q₂ (trans (sym e₁) e₂)
...| refl = cong (divides q₁) (≡-irrelevant e₁ e₂)
--------------------------------------------------
-- Properties about stepping and unstepping 'Even'
even-unstep : ∀ k → Even (2 + k) → Even k
even-unstep k (divides (suc q) e) = divides q (suc-injective (suc-injective e))
even-step : ∀ k → Even k → Even (2 + k)
even-step k (divides q₁ eq) = divides (1 + q₁) (cong (suc ∘ suc) eq)
-----------------------------
-- Properties of Even and Odd
mutual
even-odd-suc : ∀ k → Even k → Odd (suc k)
even-odd-suc zero x (divides q e) = ⊥-1≡m*2 q e
even-odd-suc (suc k) x x₁ = even-suc-odd (suc k) x₁ x
even-suc-odd : ∀ k → Even (suc k) → Odd k
even-suc-odd zero (divides q e) x₁ = ⊥-1≡m*2 q e
even-suc-odd (suc k) x x₁ = even-odd-suc k (even-unstep k x) x₁
mutual
odd-suc-suc : ∀ k → Odd k → Even (suc k)
odd-suc-suc zero x = ⊥-elim (x (divides 0 refl))
odd-suc-suc (suc k) x = even-step k (odd-pred-even (suc k) x)
odd-pred-even : ∀ k → Odd k → Even (pred k)
odd-pred-even zero x = ⊥-elim (x (divides 0 refl))
odd-pred-even (suc k) x with even? k
...| no imp = ⊥-elim (x (odd-suc-suc k imp))
...| yes prf = prf
-----------------------------
-- Properties of Even and _*_
*-preserve-even : ∀ k d → Even k → Even (k * d)
*-preserve-even k d = ∣m⇒∣m*n d
-----------------------------
-- Properties of Even and _≤_
even>0⇒>1 : ∀ {k} → 0 < k → Even k → 1 < k
even>0⇒>1 {0} ()
even>0⇒>1 {1} 0<k e = ⊥-elim ((even-odd-suc 0 (divides 0 refl)) e)
even>0⇒>1 {suc (suc k)} (s≤s z≤n) _ = s≤s (s≤s z≤n)
0<odd : ∀{d} → Odd d → 0 < d
0<odd {zero} imp = ⊥-elim (imp (divides zero refl))
0<odd {suc d} _ = s≤s z≤n
-----------------------------
-- Properties of Even and _∸_
even∸1-odd : ∀ {k} → 1 < k → Even k → Odd (k ∸ 1)
even∸1-odd {suc zero} 1<k ek = λ x → contradiction refl (<⇒≢ 1<k)
even∸1-odd {suc (suc k)} 1<k ek = λ x → even-suc-odd (suc k) ek x
odd∸1-even : ∀ {k} → Odd k → Even (k ∸ 1)
odd∸1-even {zero} ok = ⊥-elim (ok (divides 0 refl))
odd∸1-even {suc zero} ok = divides 0 refl
odd∸1-even {suc (suc k)} ok = odd-pred-even (suc (suc k)) ok
-----------------------------
-- Properties of Even and _^_
even-2^k : ∀ {k} → 0 < k → Even (2 ^ k)
even-2^k {suc k} x = *-preserve-even 2 (2 ^ k) (divides 1 refl)
odd-2^kd-1 : ∀ k d → 0 < k → 0 < d → ¬ Even (2 ^ k * d ∸ 1)
odd-2^kd-1 k d 0<k 0<d x
= even∸1-odd {2 ^ k * d} (pow*d>1 k d 0<k 0<d)
(*-preserve-even (2 ^ k) d (even-2^k 0<k))
x
----------------------------------------------------------------
-- Every natural number can be viewed as a power of two times
-- an odd number. We can witness that conversion in the from and
-- to functions below.
data Pow2 : ℕ → Set where
zero : Pow2 zero
pos : ∀ {n} l d → Odd d → n ≡ 2 ^ l * d → Pow2 n
pos-cong : ∀{n₁ n₂} (p : n₁ ≡ n₂)
→ ∀{d₁ d₂} (q : d₁ ≡ d₂)
→ (o₁ : Odd d₁)(o₂ : Odd d₂)
→ ∀{m} (r₁ : m ≡ 2 ^ n₁ * d₁) (r₂ : m ≡ 2 ^ n₂ * d₂)
→ pos n₁ d₁ o₁ r₁ ≡ pos n₂ d₂ o₂ r₂
pos-cong {n₁ = n} refl {d₁ = d} refl o₁ o₂ r₁ r₂
= cong₂ (pos n d) (fun-ext (λ x → ⊥-elim (o₁ x))) (≡-irrelevant r₁ r₂)
-- One must mark this as terminating. The recursive call
-- is made with 'quotient prf', and although we know it is
-- strictly smaller than (suc n), Agda can't infer it.
{-# TERMINATING #-}
to : (n : ℕ) → Pow2 n
to 0 = zero
to (suc n) with even? (suc n)
...| no odd = pos 0 (suc n) odd (cong suc (+-comm 0 n))
...| yes prf with to (quotient prf)
...| zero = ⊥-elim (1+n≢0 (_∣_.equality prf))
...| pos l d odd prf' = pos (suc l) d odd
(trans (_∣_.equality prf)
(trans (cong (λ x → x * 2) prf')
(a*b*2-lemma (2 ^ l) d)))
-- Converting from a Pow2 is trivial, since we kept the
-- original number there.
from : ∀{n} → Pow2 n → ℕ
from zero = zero
from (pos {n} _ _ _ _) = n
-- From and To form an isomorphism
-- TODO-1: Document and justify this pragma
{-# TERMINATING #-}
from-to-iso : ∀ n → from (to n) ≡ n
from-to-iso zero = refl
from-to-iso (suc n) with even? (suc n)
...| no odd = refl
...| yes prf with to (quotient prf)
...| zero = ⊥-elim (1+n≢0 (_∣_.equality prf))
...| pos l d odd prf' = refl
--------------------------------
-- Properties of to and equality
inj-to : ∀ {m n} → m ≡ n → to m ≅ to n
inj-to refl = ≅-refl
to-inj : ∀ {m n} → to m ≇ to n → m ≢ n
to-inj x x₁ = x (inj-to x₁)
---------------------------
-- Uniqueness of 2^k*d form
2^kd-≢-d : ∀{k d₁ d₂}
→ d₁ ≢ d₂
→ 2 ^ k * d₁ ≢ 2 ^ k * d₂
2^kd-≢-d {k} hip abs with 2^k-is-suc k
...| r , prf rewrite prf = hip (*-cancelˡ-≡ r abs)
2^kd-≢-k : ∀{k₁ k₂ d₁ d₂}
→ k₁ ≢ k₂
→ Odd d₁ → Odd d₂
→ 2 ^ k₁ * d₁ ≢ 2 ^ k₂ * d₂
2^kd-≢-k {zero} {zero} {d₁} {d₂} k₁≢k₂ o₁ o₂ e₁≡e₂ = k₁≢k₂ refl
2^kd-≢-k {zero} {suc k₂} {d₁} {d₂} k₁≢k₂ o₁ o₂ e₁≡e₂
rewrite +-identityʳ d₁
| *-assoc 2 (2 ^ k₂) d₂
| *-comm 2 (2 ^ k₂ * d₂) = o₁ (divides (2 ^ k₂ * d₂) e₁≡e₂)
2^kd-≢-k {suc k₁} {zero} {d₁} {d₂} k₁≢k₂ o₁ o₂ e₁≡e₂
rewrite +-identityʳ d₂
| *-assoc 2 (2 ^ k₁) d₁
| *-comm 2 (2 ^ k₁ * d₁) = o₂ (divides (2 ^ k₁ * d₁) (sym e₁≡e₂))
2^kd-≢-k {suc k₁} {suc k₂} {d₁} {d₂} k₁≢k₂ o₁ o₂ e₁≡e₂
rewrite *-assoc 2 (2 ^ k₁) d₁
| *-assoc 2 (2 ^ k₂) d₂ = *-cong-≢ 2 (s≤s z≤n) (2^kd-≢-k (suc-≢ k₁≢k₂) o₁ o₂) e₁≡e₂
----------------------
-- Correctness of 'to'
-- The trick to 2^kd is to use heterogeneous equality first.
-- The problem stems from the type of arguments of pos depending
-- on each other. Agda has trouble understanding that the different
-- ways to write 'n' are all equal. Hence, we abstract that away.
to-2^kd-≅ : ∀{n d} k → (o : Odd d)(p : n ≡ 2 ^ k * d)
→ to n ≅ pos k d o refl
to-2^kd-≅ {n} {d} k o p with to n
...| zero = ⊥-elim (0≢a*b-magic (1≤2^n k) (0<odd o) p)
to-2^kd-≅ {n} {d} k o p
| pos k₀ d₀ o₀ p₀
with k ≟ k₀
...| no abs = ⊥-elim (2^kd-≢-k abs o o₀ (trans (sym p) p₀))
...| yes refl
with d ≟ d₀
...| no abs = ⊥-elim (2^kd-≢-d {k₀} abs (trans (sym p) p₀))
to-2^kd-≅ {n} {d} .k₀ o p
| pos k₀ d₀ o₀ p₀ | yes refl | yes refl
rewrite fun-ext {f = o} {o₀} (λ x → ⊥-elim (o x)) | p
with p₀
...| refl = ≅-refl
-- And then, Agda is happy to understand it is equal after all.
to-2^kd : ∀{d} k → (o : Odd d) → to (2 ^ k * d) ≡ pos k d o refl
to-2^kd {d} k p = ≅-to-≡ (to-2^kd-≅ k p refl)
to-reduce : ∀ {m k d}
→ (mprf : m ≡ (2 ^ k) * d)
→ (od : Odd d)
→ to m ≡ pos k d od mprf
to-reduce {m} {k} {d} refl od = to-2^kd k od
|
3-mid/impact/source/3d/math/impact-d3-convex_hull_computer.adb | charlie5/lace | 20 | 11166 | <reponame>charlie5/lace<gh_stars>10-100
with interfaces.c.Pointers,
Swig.Pointers,
ada.Unchecked_Deallocation,
system.Address_to_Access_Conversions;
with Ada.Unchecked_Conversion;
with impact.d3.Vector;
-- with math.algebra.linear.d3;
with ada.containers.Generic_Array_Sort;
with impact.d3.Scalar;
package body impact.d3.convex_hull_Computer
is
use Math,
Interfaces;
--- Edge
--
default_Terminator : constant Edge := (others => -1);
package edge_Pointers is new interfaces.c.Pointers (Positive, Edge, Edges, default_Terminator);
subtype edge_Pointer is edge_Pointers.Pointer;
function getSourceVertex (Self : access Edge) return Integer
is
use edge_Pointers, Interfaces;
the_Edge : constant edge_Pointer := edge_Pointer (Self) + C.ptrdiff_t (Self.m_reverse);
begin
return the_Edge.targetVertex;
end getSourceVertex;
function getTargetVertex (Self : in Edge) return Integer
is
begin
return Self.targetVertex;
end getTargetVertex;
function getNextEdgeOfVertex (Self : access Edge) return Edge_view
is
use edge_Pointers, Interfaces;
the_Edge : constant edge_Pointer := edge_Pointer (Self) + C.ptrdiff_t (Self.next);
begin
return Edge_view (the_Edge);
end getNextEdgeOfVertex;
function getNextEdgeOfFace (Self : access Edge) return Edge_view
is
use edge_Pointers, Interfaces;
the_Edge : constant edge_Pointer := edge_Pointer (Self) + C.ptrdiff_t (Self.m_reverse);
begin
return the_Edge.getNextEdgeOfVertex;
end getNextEdgeOfFace;
function getReverseEdge (Self : access Edge) return Edge_view
is
use edge_Pointers, Interfaces;
begin
return Edge_view (edge_Pointer (Self) + C.ptrdiff_t (Self.m_reverse));
end getReverseEdge;
--- impact.d3.convex_hull_Computer
--
function compute (Self : access Item'Class; coords : access math.Real;
stride : in Integer;
count : in Integer;
shrink : in math.Real;
shrinkClamp : in math.Real) return math.Real
is
begin
return Self.compute (coords.all'Address, False, stride, count, shrink, shrinkClamp);
end compute;
function compute (Self : access Item'Class; coords : access Long_Float;
stride : in Integer;
count : in Integer;
shrink : in math.Real;
shrinkClamp : in math.Real) return math.Real
is
begin
return Self.compute (coords.all'Address, True, stride, count, shrink, shrinkClamp);
end compute;
--- Point64
--
function isZero (Self : in Point64'Class) return Boolean
is
begin
return Self.x = 0 and then Self.y = 0 and then Self.z = 0;
end isZero;
function dot (Self : in Point64'Class; b : in Point64'Class) return int64_t
is
begin
return Self.x * b.x + Self.y * b.y + Self.z * b.z;
end dot;
--- Point32
--
function to_Point32 (x, y, z : in int32_t) return Point32
is
begin
return (x, y, z, -1);
end to_Point32;
overriding function "=" (Self : in Point32; Other : in Point32) return Boolean
is
begin
return Self.x = Other.x and then Self.y = Other.y and then Self.z = Other.z;
end;
function isZero (Self : in Point32) return Boolean
is
begin
return Self.x = 0 and then Self.y = 0 and then Self.z = 0;
end isZero;
function cross (Self : in Point32'Class; b : in Point32'Class) return Point64
is
begin
return Point64'(int64_t (Self.y) * int64_t (b.z) - int64_t (Self.z) * int64_t (b.y),
int64_t (Self.z) * int64_t (b.x) - int64_t (Self.x) * int64_t (b.z),
int64_t (Self.x) * int64_t (b.y) - int64_t (Self.y) * int64_t (b.x));
end cross;
function cross (Self : in Point32'Class; b : in Point64'Class) return Point64
is
begin
return Point64'(int64_t (Self.y) * int64_t (b.z) - int64_t (Self.z) * int64_t (b.y),
int64_t (Self.z) * int64_t (b.x) - int64_t (Self.x) * int64_t (b.z),
int64_t (Self.x) * int64_t (b.y) - int64_t (Self.y) * int64_t (b.x));
end cross;
function dot (Self : in Point32; b : in Point32) return int64_t
is
begin
return int64_t (Self.x) * int64_t (b.x)
+ int64_t (Self.y) * int64_t (b.y)
+ int64_t (Self.z) * int64_t (b.z);
end dot;
function dot (Self : in Point32; b : in Point64'Class) return int64_t
is
begin
return int64_t (Self.x) * int64_t (b.x)
+ int64_t (Self.y) * int64_t (b.y)
+ int64_t (Self.z) * int64_t (b.z);
end dot;
function "+" (Self, b : in Point32) return Point32
is
begin
return to_Point32 (Self.x + b.x,
Self.y + b.y,
Self.z + b.z);
end;
function "-" (Self, b : in Point32) return Point32
is
begin
return to_Point32 (Self.x - b.x,
Self.y - b.y,
Self.z - b.z);
end;
--- Int128
--
type Int128 is tagged
record
low, high : uint64_t;
end record;
--- DMul
--
-- generic
-- type UWord is private;
-- type UHWord is private;
package DMul
is
procedure mul (a, b : in uint64_t; resLow, resHigh : out uint64_t);
procedure mul (a, b : in Int128; resLow, resHigh : out Int128);
private
function high (value : in uint64_t) return uint32_t;
function low (value : in uint64_t) return uint32_t;
function mul (a, b : in uint32_t) return uint64_t;
procedure shlHalf (value : in out uint64_t);
function high (value : in Int128) return uint64_t;
function low (value : in Int128) return uint64_t;
function mul (a, b : in uint64_t) return Int128;
procedure shlHalf (value : in out Int128);
end DMul;
function to_Int128 (low : in uint64_t) return Int128
is
begin
return (low, 0);
end to_Int128;
function to_Int128 (value : in int64_t) return Int128
is
Result : Int128;
begin
Result.low := uint64_t (value);
if Value >= 0 then
Result.high := 0;
else
Result.high := -1;
end if;
return Result;
end to_Int128;
function "-" (Self : in Int128'Class) return Int128
is
begin
if Self.low = 0 then
return (low => uint64_t (-int64_t (Self.low)),
high => not Self.high + 1);
else
return (low => uint64_t (-int64_t (Self.low)),
high => not Self.high + 0);
end if;
end;
function mul (a, b : in int64_t) return Int128
is
negative : Boolean := a < 0;
my_a : int64_t := a;
my_b : int64_t := b;
result : Int128;
begin
if negative then
my_a := -my_a;
end if;
if my_b < 0 then
negative := not negative;
my_b := -my_b;
end if;
DMul.mul (uint64_t (my_a), uint64_t (my_b), result.low, result.high);
if negative then
return -result;
else
return result;
end if;
end mul;
function mul (a, b : in uint64_t) return Int128
is
result : Int128;
begin
DMul.mul (a, b, result.low, result.high);
return result;
end mul;
function "+" (Self, b : in Int128) return Int128
is
lo : constant uint64_t := Self.low + b.low;
begin
if lo < Self.low then
return (low => lo,
high => Self.high + b.high + 1);
else
return (low => lo,
high => Self.high + b.high + 0);
end if;
end;
function "-" (Self, b : in Int128) return Int128
is
begin
return Self + (-b);
end;
procedure add (Self : in out Int128'Class; b : in Int128)
is
lo : constant uint64_t := Self.low + b.low;
begin
if lo < Self.low then
Self.high := Self.high + 1;
end if;
Self.low := lo;
Self.high := Self.high + b.high;
end add;
procedure inc (Self : in out Int128'Class)
is
begin
Self.low := Self.low + 1;
if Self.low = 0 then
Self.high := Self.high + 1;
end if;
end inc;
function "*" (Self : in Int128; b : in int64_t) return Int128
is
negative : Boolean := int64_t (Self.high) < 0;
a : Int128;
my_b : int64_t := b;
Result : Int128;
begin
if negative then
a := -Self;
else
a := Self;
end if;
if my_b < 0 then
negative := not negative;
my_b := -my_b;
end if;
result := mul (a.low, uint64_t (my_b));
result.high := result.high + a.high * uint64_t (my_b);
if negative then
return -result;
else
return result;
end if;
end;
function toScalar (Self : in Int128'Class) return math.Real
is
begin
if int64_t (Self.high) >= 0 then
return math.Real (Self.high) * (math.Real (16#1_0000_0000#) * math.Real (16#1_0000_0000#)) + math.Real (Self.low);
else
return -toScalar (-Self);
end if;
end toScalar;
function getSign (Self : in Int128'Class) return Integer
is
begin
if int64_t (Self.high) < 0 then
return -1;
else
if Self.high /= 0 or else Self.low /= 0 then
return 1;
else
return 0;
end if;
end if;
end getSign;
function "<" (Self : in Int128; b : in Int128) return Boolean
is
begin
return Self.high < b.high
or else ( Self.high = b.high
and then Self.low < b.low);
end;
function ucmp (Self : in Int128; b : in Int128) return Integer
is
begin
if Self.high < b.high then
return -1;
end if;
if Self.high > b.high then
return 1;
end if;
if Self.low < b.low then
return -1;
end if;
if Self.low > b.low then
return 1;
end if;
return 0;
end ucmp;
--- Rational64
--
function to_Rational64 (numerator, denominator : int64_t) return Rational64
is
Self : Rational64;
begin
if numerator > 0 then
Self.sign := 1;
Self.numerator := uint64_t (numerator);
elsif numerator < 0 then
Self.sign := -1;
Self.numerator := uint64_t (-numerator);
else
Self.sign := 0;
Self.numerator := 0;
end if;
if denominator > 0 then
Self.denominator := uint64_t (denominator);
elsif denominator < 0 then
Self.sign := -Self.sign;
Self.denominator := uint64_t (-denominator);
else
Self.denominator := 0;
end if;
return Self;
end to_Rational64;
function isNegativeInfinity (Self : in Rational64) return Boolean
is
begin
return Self.sign < 0 and then Self.denominator = 0;
end isNegativeInfinity;
function isNaN (Self : in Rational64) return Boolean
is
begin
return Self.sign = 0 and then Self.denominator = 0;
end isNaN;
function compare (Self, b : in Rational64) return Integer
is
begin
if Self.sign /= b.sign then
return Self.sign - b.sign;
elsif Self.sign = 0 then
return 0;
end if;
-- // return (numerator * b.denominator > b.numerator * denominator) ? sign : (numerator * b.denominator < b.numerator * denominator) ? -sign : 0;
return Self.sign * ucmp (mul (Self.numerator, b.denominator), mul (Self.denominator, b.numerator));
end compare;
function toScalar (Self : in Rational64) return math.Real
is
Value : math.Real;
begin
if Self.denominator = 0 then
Value := math.Infinity;
else
Value := math.Real (Self.numerator) / math.Real (Self.denominator);
end if;
return math.Real (Self.sign) * Value;
end toScalar;
--- Rational128
--
type Rational128 is tagged
record
numerator,
denominator : Int128;
sign : Integer;
isInt64 : Boolean;
end record;
function to_Rational128 (value : in int64_t) return Rational128
is
Self : Rational128;
begin
if value > 0 then
Self.sign := 1;
Self.numerator := to_Int128 (value);
elsif value < 0 then
Self.sign := -1;
Self.numerator := to_Int128 (-value);
else
Self.sign := 0;
Self.numerator := to_Int128 (uint64_t'(0));
end if;
Self.denominator := to_Int128 (uint64_t'(1));
Self.isInt64 := True;
return Self;
end to_Rational128;
function to_Rational128 (numerator, denominator : in Int128) return Rational128
is
Self : Rational128;
dsign : Integer;
begin
Self.sign := numerator.getSign;
if Self.sign >= 0 then
Self.numerator := numerator;
else
Self.numerator := -numerator;
end if;
dsign := denominator.getSign;
if dsign >= 0 then
Self.denominator := denominator;
else
Self.sign := -Self.sign;
Self.denominator := -denominator;
end if;
Self.isInt64 := False;
return Self;
end to_Rational128;
function compare (Self : in Rational128; b : in int64_t) return Integer
is
a : int64_t;
my_b : int64_t := b;
begin
if Self.isInt64 then
a := int64_t (Self.sign) * int64_t (Self.numerator.low);
if a > my_b then
return 1;
elsif a < b then
return -1;
else
return 0;
end if;
end if;
if my_b > 0 then
if Self.sign <= 0 then
return -1;
end if;
elsif my_b < 0 then
if Self.sign >= 0 then
return 1;
end if;
my_b := -my_b;
else
return Self.sign;
end if;
return ucmp (Self.numerator, Self.denominator * my_b) * Self.sign;
end compare;
function compare (Self : in Rational128; b : in Rational128) return Integer
is
cmp : Integer;
nbdLow, nbdHigh,
dbnLow, dbnHigh : Int128;
begin
if Self.sign /= b.sign then
return Self.sign - b.sign;
elsif Self.sign = 0 then
return 0;
end if;
if Self.isInt64 then
return -compare (b, int64_t (Self.sign) * int64_t (Self.numerator.low));
end if;
DMul.mul (Self.numerator, b.denominator, nbdLow, nbdHigh);
DMul.mul (Self.denominator, b.numerator, dbnLow, dbnHigh);
cmp := ucmp (nbdHigh, dbnHigh);
if cmp /= 0 then
return cmp * Self.sign;
end if;
return ucmp (nbdLow, dbnLow) * Self.sign;
end compare;
function toScalar (Self : in Rational128; b : in int64_t) return math.Real
is
pragma Unreferenced (b);
Value : math.Real;
begin
if Self.denominator.getSign = 0 then
Value := math.Infinity;
else
Value := Self.numerator.toScalar / Self.denominator.toScalar;
end if;
return math.Real (Self.sign) * Value;
end toScalar;
--- PointR128
--
type PointR128 is tagged
record
x, y, z : Int128;
denominator : Int128;
end record;
function xvalue (Self : in PointR128'Class) return math.Real
is
begin
return Self.x.toScalar / Self.denominator.toScalar;
end xvalue;
function yvalue (Self : in PointR128'Class) return math.Real
is
begin
return Self.y.toScalar / Self.denominator.toScalar;
end yvalue;
function zvalue (Self : in PointR128'Class) return math.Real
is
begin
return Self.z.toScalar / Self.denominator.toScalar;
end zvalue;
type Vertex is tagged;
type internal_Edge is tagged;
type Face is tagged;
type Vertex_view is access all Vertex;
type internal_Edge_view is access all internal_Edge;
type Face_view is access all Face;
--- Vertex
--
type Vertex is tagged
record
next : Vertex_view;
prev : Vertex_view;
edges : internal_Edge_view;
firstNearbyFace : Face_view;
lastNearbyFace : Face_view;
point128 : PointR128;
point : Point32;
copy : Integer := -1;
end record;
type Vertices is array (Positive range <>) of aliased Vertex;
null_Vertex : constant Vertex := (others => <>);
package vertex_Pointers is new interfaces.c.Pointers (Positive, Vertex, Vertices, null_Vertex);
subtype vertex_Pointer is vertex_Pointers.Pointer;
type internal_Edge is tagged
record
next,
prev : internal_Edge_view;
m_reverse : internal_Edge_view;
target : Vertex_view;
face : access convex_hull_Computer.Face;
copy : Integer;
end record;
type Face is tagged
record
next : Face_view;
nearbyVertex : Vertex_view;
nextWithSameNearbyVertex : Face_view;
origin,
dir0,
dir1 : Point32;
end record;
procedure destruct (Self : in out Vertex)
is
begin
null;
end destruct;
function next (Self : in Vertex) return Vertex_view
is
begin
return Self.next;
end next;
procedure set_next (Self : in out Vertex; To : in Vertex_view)
is
begin
Self.next := To;
end set_next;
function "-" (Self, b : in Vertex) return Point32
is
begin
return Self.point - b.point;
end;
function dot (Self : in Vertex; b : in Point64) return Rational128;
function dot (Self : in Vertex; b : in Point64) return Rational128
is
begin
if Self.point.index >= 0 then
return to_Rational128 (Self.point.dot (b));
else
return to_Rational128 (Self.point128.x * b.x + Self.point128.y * b.y + Self.point128.z * b.z,
Self.point128.denominator);
end if;
end dot;
function xvalue (Self : in Vertex) return math.Real
is
begin
if Self.point.index >= 0 then
return math.Real (Self.point.x);
else
return Self.point128.xvalue;
end if;
end xvalue;
function yvalue (Self : in Vertex) return math.Real
is
begin
if Self.point.index >= 0 then
return math.Real (Self.point.y);
else
return Self.point128.yvalue;
end if;
end yvalue;
function zvalue (Self : in Vertex) return math.Real
is
begin
if Self.point.index >= 0 then
return math.Real (Self.point.z);
else
return Self.point128.zvalue;
end if;
end zvalue;
procedure receiveNearbyFaces (Self : access Vertex; src : access Vertex)
is
f : access Face;
begin
if Self.lastNearbyFace /= null then
Self.lastNearbyFace.nextWithSameNearbyVertex := src.firstNearbyFace;
else
Self.firstNearbyFace := src.firstNearbyFace;
end if;
if src.lastNearbyFace /= null then
Self.lastNearbyFace := src.lastNearbyFace;
end if;
f := src.firstNearbyFace;
while f /= null loop
pragma Assert (f.nearbyVertex = src);
f.nearbyVertex := Self.all'Access;
f := f.nextWithSameNearbyVertex;
end loop;
src.firstNearbyFace := null;
src.lastNearbyFace := null;
end receiveNearbyFaces;
--- internal_Edge
--
procedure destruct (Self : in out internal_Edge)
is
begin
null;
end destruct;
procedure link (Self : access internal_Edge'Class; n : in internal_Edge_view)
is
pragma Assert (Self.m_reverse.target = n.m_reverse.target);
begin
Self.next := n;
n.prev := internal_Edge_view (Self); --.all'access;
end link;
function next (Self : in internal_Edge) return internal_Edge_view
is
begin
return Self.next;
end next;
procedure set_next (Self : in out internal_Edge; To : in internal_Edge_view)
is
begin
Self.next := To;
end set_next;
--- Face
--
procedure destruct (Self : in out Face)
is
begin
null;
end destruct;
procedure init (Self : access Face; a, b, c : in Vertex_view)
is
begin
Self.nearbyVertex := a;
Self.origin := a.point;
Self.dir0 := b.all - a.all;
Self.dir1 := c.all - a.all;
if a.lastNearbyFace /= null then
a.lastNearbyFace.nextWithSameNearbyVertex := Self.all'Access;
else
a.firstNearbyFace := Self.all'Access;
end if;
a.lastNearbyFace := Self.all'Access;
end init;
function getNormal (Self : in Face) return Point64
is
begin
return Point64 (cross (Self.dir0, Self.dir1));
end getNormal;
function next (Self : in Face) return Face_view
is
begin
return Self.next;
end next;
procedure set_next (Self : in out Face; To : in Face_view)
is
begin
Self.next := To;
end set_next;
--- DMul
--
package body DMul
is
function high (value : in uint64_t) return uint32_t
is
begin
return uint32_t (value / 2**32);
end high;
function low (value : in uint64_t) return uint32_t
is
begin
return uint32_t (value);
end low;
function mul (a, b : in uint32_t) return uint64_t
is
begin
return uint64_t (a) * uint64_t (b);
end mul;
procedure shlHalf (value : in out uint64_t)
is
begin
Value := Value * 2**32;
end shlHalf;
function high (value : in Int128) return uint64_t
is
begin
return value.high;
end high;
function low (value : in Int128) return uint64_t
is
begin
return value.low;
end low;
function mul (a, b : in uint64_t) return Int128
is
begin
return impact.d3.convex_Hull_Computer.mul (a, b);
end mul;
procedure shlHalf (value : in out Int128)
is
begin
value.high := value.low;
value.low := 0;
end shlHalf;
procedure mul (a, b : in uint64_t; resLow, resHigh : out uint64_t)
is
p00 : uint64_t := mul (low (a), low (b));
p01 : constant uint64_t := mul (low (a), high (b));
p10 : constant uint64_t := mul (high (a), low (b));
p11 : uint64_t := mul (high (a), high (b));
p0110 : uint64_t := uint64_t (low (p01)) + uint64_t (low (p10));
begin
p11 := p11 + uint64_t (high (p01));
p11 := p11 + uint64_t (high (p10));
p11 := p11 + uint64_t (high (p0110));
shlHalf (p0110);
p00 := p00 + p0110;
if p00 < p0110 then
p11 := p11 + 1;
end if;
resLow := p00;
resHigh := p11;
end mul;
procedure mul (a, b : in Int128; resLow, resHigh : out Int128)
is
p00 : Int128 := mul (low (a), low (b));
p01 : constant Int128 := mul (low (a), high (b));
p10 : constant Int128 := mul (high (a), low (b));
p11 : Int128 := mul (high (a), high (b));
p0110 : Int128 := to_Int128 (low (p01)) + to_Int128 (low (p10));
begin
p11.add (to_Int128 (high (p01)));
p11.add (to_Int128 (high (p10)));
p11.add (to_Int128 (high (p0110)));
shlHalf (p0110);
p00 := p00 + p0110;
if p00 < p0110 then
p11.inc;
end if;
resLow := p00;
resHigh := p11;
end mul;
-- procedure mul (a, b : in UWord; resLow, resHigh : out UWord)
-- is
-- p00 : UWord := mul (low (a), low (b));
-- p01 : UWord := mul (low (a), high (b));
-- p10 : UWord := mul (high (a), low (b));
-- p11 : UWord := mul (high (a), high (b));
-- p0110 : UWord := UWord (low (p01)) + UWord (low (p10));
-- begin
-- p11 := p11 + high (p01);
-- p11 := p11 + high (p10);
-- p11 := p11 + high (p0110);
--
-- shlHalf (p0110);
--
-- p00 := p00 + p0110;
--
-- if p00 < p0110 then
-- p11 := p11 + 1;
-- end if;
--
-- resLow := p00;
-- resHigh := p11;
-- end;
end DMul;
--- IntermediateHull
--
type IntermediateHull is
record
minXy, maxXy,
minYx, maxYx : Vertex_view;
end record;
--- Orientation
--
type Orientation is (NONE, CLOCKWISE, COUNTER_CLOCKWISE);
generic
type T is private;
type T_view is access all T;
with procedure set_next (Self : in out T; Now : in T_view);
package PoolArray
is
type Item is tagged private;
function to_PoolArray (size : in Integer) return Item;
procedure destruct (Self : in out Item);
function Next (Self : in Item) return access Item;
procedure Next_is (Self : in out Item; Now : access Item);
function init (Self : in Item) return T_view;
-- T* init()
private
type T_array is array (Positive range <>) of aliased T;
type T_array_view is access all T_array;
type Item is tagged
record
m_array : T_array_view;
size : Integer;
next : access Item;
end record;
end PoolArray;
package body PoolArray
is
function Next (Self : in Item) return access Item
is
begin
return Self.next;
end Next;
procedure Next_is (Self : in out Item; Now : access Item)
is
begin
Self.next := Now;
end Next_is;
function to_PoolArray (size : in Integer) return Item
is
Self : Item;
begin
Self.size := size;
Self.m_array := new T_array (1 .. size);
return Self;
end to_PoolArray;
procedure destruct (Self : in out Item)
is
procedure free is new ada.Unchecked_Deallocation (T_array, T_array_view);
begin
free (Self.m_array);
end destruct;
function init (Self : in Item) return T_view
is
begin
for i in 1 .. Self.size loop
if i + 1 <= Self.size then
set_next (Self.m_array (i), Self.m_array (i + 1)'Access);
else
set_next (Self.m_array (i), null);
end if;
end loop;
return Self.m_array (1)'Access;
end init;
end PoolArray;
--- Pool
--
generic
type T is private;
type T_view is access all T;
with procedure destruct (Self : in out T);
with procedure set_next (Self : in out T; Now : in T_view);
with function next (Self : in T) return T_view;
package Pool
is
-- type T_view is access all T;
type Item is tagged private;
procedure destruct (Self : in out Item);
procedure reset (Self : in out Item);
procedure setArraySize (Self : in out Item; arraySize : in Integer);
function newObject (Self : access Item) return access T;
procedure freeObject (Self : in out Item; object : in T_view);
private
package my_PoolArray is new PoolArray (T, T_view, set_Next);
type my_PoolArray_view is access all my_PoolArray.Item;
type Item is tagged
record
arrays : my_PoolArray_view;
nextArray : my_PoolArray_view;
freeObjects : T_view;
arraySize : Integer := 256;
end record;
end Pool;
package body Pool
is
procedure destruct (Self : in out Item)
is
p : my_PoolArray_view;
procedure free is new ada.Unchecked_Deallocation (my_PoolArray.item, my_PoolArray_view);
begin
while self.arrays /= null loop
p := Self.arrays;
Self.arrays := my_PoolArray_view (p.next);
p.destruct;
free (p);
end loop;
end destruct;
procedure reset (Self : in out Item)
is
begin
Self.nextArray := Self.arrays;
Self.freeObjects := null;
end reset;
procedure setArraySize (Self : in out Item; arraySize : in Integer)
is
begin
Self.arraySize := arraySize;
end setArraySize;
function newObject (Self : access Item) return access T
is
o : T_view := Self.freeObjects;
p : my_PoolArray_view;
begin
if o = null then
p := Self.nextArray;
if p /= null then
Self.nextArray := my_PoolArray_view (p.next);
else
p := new my_PoolArray.Item'(my_PoolArray.to_PoolArray (Self.arraySize));
p.next_is (Self.arrays);
Self.arrays := p;
end if;
o := T_view (p.init);
end if;
Self.freeObjects := T_view (next (o.all));
return o;
end newObject;
procedure freeObject (Self : in out Item; object : in T_view)
is
use my_PoolArray;
begin
destruct (object.all);
set_next (object.all, now => Self.freeObjects);
Self.freeObjects := object;
end freeObject;
end Pool;
--- Containers
--
package vertex_Pool is new Pool (Vertex, Vertex_view, destruct, set_next, next);
package edge_Pool is new Pool (internal_Edge, internal_Edge_view, destruct, set_next, next);
package face_Pool is new Pool (Face, Face_view, destruct, set_next, next);
package vertex_Vectors is new ada.containers.Vectors (Positive, Vertex_view);
subtype vertex_Vector is vertex_Vectors.Vector;
package face_Vectors is new ada.containers.Vectors (Positive, Face_view);
subtype face_Vector is face_Vectors.Vector;
--- Internal
--
type Internal is tagged
record
scaling,
center : math.Vector_3;
vertexPool : aliased vertex_Pool.item;
edgePool : aliased edge_Pool.item;
facePool : aliased face_Pool.item;
originalVertices : vertex_Vector;
mergeStamp,
minAxis,
medAxis,
maxAxis,
usedEdgePairs,
maxUsedEdgePairs : Integer;
vertexList : Vertex_view;
end record;
function mergeProjection (Self : access Internal'Class; h0, h1 : access IntermediateHull;
c0, c1 : access Vertex_view ) return Boolean;
function getOrientation (prev, next : access internal_Edge; s, t : in Point32) return Orientation
is
begin
pragma Assert (prev.m_reverse.target = next.m_reverse.target);
if prev.next = next then
if prev.prev = next then
declare
n : constant Point64 := t.cross (s);
m : constant Point64 := cross (prev.target.Point - next.m_reverse.target.Point, next.target.Point - next.m_reverse.target.Point);
pragma Assert (not m.isZero);
dot : constant int64_t := n.dot (m);
pragma Assert (dot /= 0);
begin
if dot > 0 then
return COUNTER_CLOCKWISE;
else
return CLOCKWISE;
end if;
end;
end if;
return COUNTER_CLOCKWISE;
elsif prev.prev = next then
return CLOCKWISE;
else
return NONE;
end if;
end getOrientation;
function findMaxAngle (Self : in Internal'Class; ccw : in Boolean;
start : in Vertex;
s : in Point32;
rxs : in Point64;
sxrxs : in Point64;
minCot : access Rational64) return access internal_Edge
is
minEdge : internal_Edge_view;
e : internal_Edge_view := start.edges;
begin
if e /= null then
loop
if e.copy > Self.mergeStamp then
declare
t : constant Point32 := e.target.Point - start.Point;
cot : constant Rational64 := to_Rational64 (t.dot (sxrxs),
t.dot (rxs));
begin
if cot.isNaN then
if ccw then
null; pragma Assert (t.dot (s) < 0);
else
null; pragma Assert (t.dot (s) > 0);
end if;
else
declare
cmp : constant Integer := cot.compare (minCot.all);
begin
if minEdge = null then
minCot.all := cot;
minEdge := e;
elsif cmp < 0 then
minCot.all := cot;
minEdge := e;
elsif cmp = 0
and then ccw = (getOrientation (minEdge, e, s, t) = COUNTER_CLOCKWISE)
then
minEdge := e;
end if;
end;
end if;
end;
end if;
e := e.next;
exit when e = start.edges;
end loop;
end if;
return minEdge;
end findMaxAngle;
procedure findEdgeForCoplanarFaces (Self : in out Internal'Class; c0, c1 : access Vertex;
e0, e1 : out internal_Edge_view;
stop0, stop1 : access Vertex)
is
start0 : constant internal_Edge_view := e0;
start1 : constant internal_Edge_view := e1;
function get_et0 return Point32
is
begin
if start0 /= null then return start0.target.point;
else return c0.point;
end if;
end get_et0;
function get_et1 return Point32
is
begin
if start1 /= null then return start1.target.point;
else return c1.point;
end if;
end get_et1;
et0 : Point32 := get_et0;
et1 : Point32 := get_et1;
s : constant Point32 := c1.point - c0.point;
function get_Start return internal_Edge_view
is
begin
if start0 /= null then return start0;
else return start1;
end if;
end get_Start;
normal : constant Point64 := cross (get_Start.target.point - c0.point, s);
dist : constant int64_t := c0.point.dot (normal); pragma Assert (start1 = null or else (start1.target.point.dot (normal) = dist));
perp : constant Point64 := s.cross (normal); pragma Assert (not perp.isZero);
maxDot0 : int64_t := et0.dot (perp);
maxDot1 : int64_t;
dx, dy : int64_t;
dot : int64_t;
e : internal_Edge_view;
begin
if e0 /= null then
while e0.target /= stop0
loop
e := e0.m_reverse.prev;
if e.target.point.dot (normal) < dist then
exit;
end if;
pragma Assert (e.target.point.dot (normal) = dist);
if e.copy = Self.mergeStamp then
exit;
end if;
dot := e.target.point.dot (perp);
if dot <= maxDot0 then
exit;
end if;
maxDot0 := dot;
e0 := e;
et0 := e.target.point;
end loop;
end if;
maxDot1 := et1.dot (perp);
if e1 /= null then
while e1.target /= stop1
loop
e := e1.m_reverse.next;
if e.target.point.dot (normal) < dist then
exit;
end if;
pragma Assert (e.target.point.dot (normal) = dist);
if e.copy = Self.mergeStamp then
exit;
end if;
dot := e.target.point.dot (perp);
if dot <= maxDot1 then
exit;
end if;
maxDot1 := dot;
e1 := e;
et1 := e.target.point;
end loop;
end if;
dx := maxDot1 - maxDot0;
if dx > 0 then
while True
loop
declare
f0, f1 : internal_Edge_view;
dx0, dy0 : int64_t;
dx1, dy1 : int64_t;
dxn : int64_t;
d1 : Point32;
Continue : Boolean := True;
function dot_is_negative (dxN, dyN : in int64_t) return Boolean -- tbd: better name
is
begin
if dxN = 0 then
return dyN < 0;
else
return dxN < 0
and then to_Rational64 (dyN, dxN).compare (to_Rational64 (dy, dx)) >= 0;
end if;
end dot_is_negative;
begin
dy := impact.d3.convex_hull_Computer.dot (et1 - et0, s);
if e0 /= null and then (e0.target /= stop0) then
f0 := e0.next.m_reverse;
if f0.copy > Self.mergeStamp then
dx0 := impact.d3.convex_hull_Computer.dot (f0.target.point - et0, perp);
dy0 := impact.d3.convex_hull_Computer.dot (f0.target.point - et0, s);
-- if (dx0 = 0) ? (dy0 < 0) : ((dx0 < 0) and then (Rational64(dy0, dx0).compare(Rational64(dy, dx)) >= 0)) then
if Dot_is_negative (dx0, dy0) then
et0 := f0.target.point;
dx := impact.d3.convex_hull_Computer.dot (et1 - et0, perp);
if e0 = start0 then
e0 := null;
else
e0 := f0;
end if;
continue := False;
end if;
end if;
end if;
if Continue then
if e1 /= null and then (e1.target /= stop1) then
f1 := e1.m_reverse.next;
if f1.copy > Self.mergeStamp then
d1 := f1.target.point - et1;
if d1.dot (normal) = 0 then
dx1 := d1.dot (perp);
dy1 := d1.dot (s);
dxn := impact.d3.convex_hull_Computer.dot (f1.target.point - et0, perp);
-- if dxn > 0 and then ((dx1 = 0) ? (dy1 < 0) : ((dx1 < 0) && (Rational64(dy1, dx1).compare(Rational64(dy, dx)) > 0))) then
if dxn > 0 and then Dot_is_negative (dx1, dy1) then
e1 := f1;
et1 := e1.target.point;
dx := dxn;
continue := False;
end if;
else
null; pragma Assert ((e1 = start1) and then (d1.dot (normal) < 0));
end if;
end if;
end if;
end if;
if continue then
exit;
end if;
end;
end loop;
elsif dx < 0 then
while True
loop
declare
dy : int64_t;
f0, f1 : internal_Edge_view;
dx0, dy0 : int64_t;
dx1, dy1 : int64_t;
dxn : int64_t;
d0 : Point32;
Continue : Boolean := True;
function dot_is_negative (dxN, dyN : in int64_t) return Boolean -- tbd: better name
is
begin
if dxN = 0 then
return dyN > 0;
else
return dxN < 0
and then to_Rational64 (dyN, dxN).compare (to_Rational64 (dy, dx)) <= 0;
end if;
end dot_is_negative;
begin
dy := impact.d3.convex_hull_Computer.dot (et1 - et0, s);
if e1 /= null and then (e1.target /= stop1) then
f1 := e1.prev.m_reverse;
if f1.copy > Self.mergeStamp then
dx1 := impact.d3.convex_hull_Computer.dot (f1.target.point - et1, perp);
dy1 := impact.d3.convex_hull_Computer.dot (f1.target.point - et1, s);
-- if (dx1 = 0) ? (dy1 > 0) : ((dx1 < 0) and then (Rational64(dy1, dx1).compare(Rational64(dy, dx)) <= 0)) then
if dot_is_negative (dx1, dy1) then
et1 := f1.target.point;
dx := impact.d3.convex_hull_Computer.dot (et1 - et0, perp);
if e1 = start1 then
e1 := null;
else
e1 := f1;
end if;
continue := False;
end if;
end if;
end if;
if Continue then
if e0 /= null and then (e0.target /= stop0) then
f0 := e0.m_reverse.prev;
if f0.copy > Self.mergeStamp then
d0 := f0.target.point - et0;
if d0.dot (normal) = 0 then
dx0 := d0.dot (perp);
dy0 := d0.dot (s);
dxn := impact.d3.convex_hull_Computer.dot (et1 - f0.target.point, perp);
-- if (dxn < 0) and then ((dx0 = 0) ? (dy0 > 0) : ((dx0 < 0) and then (Rational64(dy0, dx0).compare(Rational64(dy, dx)) < 0))) then
if dxn < 0 and then dot_is_negative (dx0, dy0) then
e0 := f0;
et0 := e0.target.point;
dx := dxn;
continue := True;
end if;
else
null; pragma Assert ((e0 = start0) and then (d0.dot (normal) < 0));
end if;
end if;
end if;
end if;
if Continue then
exit;
end if;
end;
end loop;
end if;
end findEdgeForCoplanarFaces;
function newEdgePair (Self : access Internal'Class; from, to : in Vertex_view) return internal_Edge_view
is
pragma Assert (from /= null and then to /= null);
e : constant internal_Edge_view := internal_Edge_view (Self.edgePool.newObject);
r : constant internal_Edge_view := internal_Edge_view (Self.edgePool.newObject);
begin
e.m_reverse := r;
r.m_reverse := e;
e.copy := Self.mergeStamp;
r.copy := Self.mergeStamp;
e.target := to;
r.target := from;
e.face := null;
r.face := null;
Self.usedEdgePairs := Self.usedEdgePairs + 1;
if Self.usedEdgePairs > Self.maxUsedEdgePairs then
Self.maxUsedEdgePairs := Self.usedEdgePairs;
end if;
return e;
end newEdgePair;
procedure removeEdgePair (Self : in out Internal'Class; edge : in internal_Edge_view)
is
use edge_Pool;
n : internal_Edge_view := internal_Edge_view (edge.next);
r : constant internal_Edge_view := internal_Edge_view (edge.m_reverse);
pragma Assert (edge.target /= null and then r.target /= null);
begin
if n /= edge then
n.prev := edge.prev;
edge.prev.next := n;
r.target.edges := n;
else
r.target.edges := null;
end if;
n := internal_Edge_view (r.next);
if n /= r then
n.prev := r.prev;
r.prev.next := n;
edge.target.edges := n;
else
edge.target.edges := null;
end if;
Self.edgePool.freeObject (edge);
Self.edgePool.freeObject (r);
Self.usedEdgePairs := Self.usedEdgePairs - 1;
end removeEdgePair;
procedure merge (Self : in out Internal'Class; h0, h1 : access IntermediateHull);
procedure merge (Self : in out Internal'Class; h0, h1 : access IntermediateHull)
is
c0, c1 : aliased Vertex_view;
toPrev0,
firstNew0,
toPrev1,
firstNew1 : internal_Edge_view;
pendingHead0,
pendingHead1,
pendingTail0,
pendingTail1 : internal_Edge_view;
prevPoint : Point32;
begin
null;
if not (h1.maxXy /= null) then
return;
end if;
if not (h0.maxXy /= null) then
h0.all := h1.all;
return;
end if;
Self.mergeStamp := Self.mergeStamp - 1;
if mergeProjection (Self'Access, h0, h1, c0'Access, c1'Access) then
declare
s : constant Point32 := c1.all - c0.all;
normal : constant Point64 := to_Point32 (0, 0, -1).cross (s);
t : constant Point64 := s.cross (normal); pragma Assert (not t.isZero);
e : internal_Edge_view := c0.edges;
start0,
start1 : internal_Edge_view;
the_dot : int64_t;
begin
if e /= null then
loop
the_dot := dot ((e.target.all - c0.all), normal); pragma Assert (the_dot <= 0);
if the_dot = 0
and then dot (e.target.all - c0.all, t) > 0
then
if start0 = null
or else getOrientation (start0, e, s, to_Point32 (0, 0, -1)) = CLOCKWISE
then
start0 := e;
end if;
end if;
e := e.next;
exit when e = c0.edges;
end loop;
end if;
e := c1.edges;
start1 := null;
if e /= null then
loop
the_dot := dot (e.target.all - c1.all, normal); pragma Assert (the_dot <= 0);
if the_dot = 0
and then dot (e.target.all - c1.all, t) > 0
then
if start1 = null
or else getOrientation (start1, e, s, to_Point32 (0, 0, -1)) = COUNTER_CLOCKWISE
then
start1 := e;
end if;
end if;
e := e.next;
exit when e = c1.edges;
end loop;
end if;
if start0 /= null
or else start1 /= null
then
findEdgeForCoplanarFaces (Self, c0, c1, start0, start1, null, null);
if start0 /= null then
c0 := start0.target;
end if;
if start1 /= null then
c1 := start1.target;
end if;
end if;
prevPoint := c1.point;
prevPoint.z := prevPoint.z + 1;
end;
else
prevPoint := c1.point;
prevPoint.x := prevPoint.x + 1;
end if;
declare
first0 : constant access Vertex := c0;
first1 : constant access Vertex := c1;
firstRun : Boolean := True;
s : Point32;
r : Point32;
rxs : Point64;
sxrxs : Point64;
minCot0 : aliased Rational64;
min0 : internal_Edge_view;
minCot1 : aliased Rational64;
min1 : internal_Edge_view;
e,
e0, e1 : internal_Edge_view;
cmp : Integer;
n : internal_Edge_view;
begin
loop
s := c1.all - c0.all;
r := prevPoint - c0.point;
rxs := r.cross (s);
sxrxs := s.cross (rxs);
minCot0 := to_Rational64 (0, 0);
min0 := findMaxAngle (Self, False, c0.all, s, rxs, sxrxs, minCot0'Access).all'Access;
minCot1 := to_Rational64 (0, 0);
min1 := findMaxAngle (Self, True, c1.all, s, rxs, sxrxs, minCot1'Access).all'Access;
if not (min0 = null)
and then min1 = null
then
e := Self.newEdgePair (c0, c1);
e.link (e);
c0.edges := e;
e := e.m_reverse;
e.link (e);
c1.edges := e;
return;
else
if min0 = null then cmp := +1;
elsif min1 = null then cmp := -1;
else cmp := minCot0.compare (minCot1);
end if;
-- cmp := !min0 ? 1 : !min1 ? -1 : minCot0.compare(minCot1);
if firstRun
or else ( (cmp >= 0 and then not isNegativeInfinity (minCot1))
or else (cmp < 0 and then not isNegativeInfinity (minCot0)))
then
e := Self.newEdgePair (c0, c1);
if pendingTail0 /= null then
pendingTail0.prev := e;
else
pendingHead0 := e;
end if;
e.next := pendingTail0;
pendingTail0 := e;
e := e.m_reverse;
if pendingTail1 /= null then
pendingTail1.next := e;
else
pendingHead1 := e;
end if;
e.prev := pendingTail1;
pendingTail1 := e;
end if;
e0 := min0;
e1 := min1;
if cmp = 0 then
Self.findEdgeForCoplanarFaces (c0, c1, e0, e1, null, null);
end if;
if cmp >= 0
and then e1 /= null
then
if toPrev1 /= null then
e := toPrev1.next;
n := null;
while e /= min1
loop
n := e.next;
removeEdgePair (Self, e);
e := n;
end loop;
-- for (Edge* e = toPrev1.next, *n = NULL; e != min1; e = n)
-- {
-- n := e.next;
-- removeEdgePair (e);
-- }
end if;
if pendingTail1 /= null then
if toPrev1 /= null then
toPrev1.link (pendingHead1);
else
min1.prev.link (pendingHead1);
firstNew1 := pendingHead1;
end if;
pendingTail1.link (min1);
pendingHead1 := null;
pendingTail1 := null;
elsif toPrev1 = null then
firstNew1 := min1;
end if;
prevPoint := c1.point;
c1 := e1.target;
toPrev1 := e1.m_reverse;
end if;
if cmp <= 0
and then e0 /= null
then
if toPrev0 /= null then
e := toPrev0.prev;
n := null;
while e /= min0
loop
n := e.prev;
Self.removeEdgePair (e);
e := n;
end loop;
-- for (Edge* e = toPrev0.prev, *n = NULL; e != min0; e = n)
-- {
-- n := e.prev;
-- removeEdgePair(e);
-- }
end if;
if pendingTail0 /= null then
if toPrev0 /= null then
pendingHead0.link (toPrev0);
else
pendingHead0.link (min0.next);
firstNew0 := pendingHead0;
end if;
min0.link (pendingTail0);
pendingHead0 := null;
pendingTail0 := null;
elsif toPrev0 = null then
firstNew0 := min0;
end if;
prevPoint := c0.point;
c0 := e0.target;
toPrev0 := e0.m_reverse;
end if;
end if;
if c0 = first0
and then c1 = first1
then
if toPrev0 = null then
pendingHead0.link (pendingTail0);
c0.edges := pendingTail0;
else
e := toPrev0.prev;
n := null;
while e /= firstNew0
loop
n := e.prev;
Self.removeEdgePair (e);
e := n;
end loop;
-- for (Edge* e = toPrev0.prev, *n = NULL; e != firstNew0; e = n)
-- {
-- n := e.prev;
-- removeEdgePair (e);
-- }
if pendingTail0 /= null then
pendingHead0.link (toPrev0);
firstNew0 .link (pendingTail0);
end if;
end if;
if toPrev1 = null then
pendingTail1.link (pendingHead1);
c1.edges := pendingTail1;
else
e := toPrev1.next;
n := null;
while e /= firstNew1
loop
n := e.next;
Self.removeEdgePair (e);
e := n;
end loop;
-- for (Edge* e = toPrev1.next, *n = NULL; e != firstNew1; e = n)
-- {
-- n := e.next;
-- removeEdgePair (e);
-- }
if pendingTail1 /= null then
toPrev1 .link (pendingHead1);
pendingTail1.link (firstNew1);
end if;
end if;
return;
end if;
firstRun := False;
end loop;
end;
end merge;
procedure computeInternal (Self : in out Internal'Class; start, finish : in Integer;
result : access IntermediateHull)
is
n : constant Integer := finish - start;
begin
if n = 0 then
result.minXy := null;
result.maxXy := null;
result.minYx := null;
result.maxYx := null;
return;
end if;
if n = 2 then
declare
use vertex_Pointers;
v : Vertex_view := Self.originalVertices.Element (start);
w : Vertex_view := Vertex_view (vertex_Pointer (v) + 1);
t : Vertex_view;
e : internal_Edge_view;
dx, dy : int32_t;
begin
if v.point /= w.point then
dx := v.point.x - w.point.x;
dy := v.point.y - w.point.y;
if dx = 0 and then dy = 0 then
if v.point.z > w.point.z then
t := w;
w := v;
v := t;
end if;
pragma Assert (v.point.z < w.point.z);
v.next := v;
v.prev := v;
result.minXy := v;
result.maxXy := v;
result.minYx := v;
result.maxYx := v;
else
v.next := w;
v.prev := w;
w.next := v;
w.prev := v;
if dx < 0 or else (dx = 0 and then dy < 0) then
result.minXy := v;
result.maxXy := w;
else
result.minXy := w;
result.maxXy := v;
end if;
if dy < 0 or else (dy = 0 and then dx < 0) then
result.minYx := v;
result.maxYx := w;
else
result.minYx := w;
result.maxYx := v;
end if;
end if;
e := Self.newEdgePair (v, w);
e.link (e);
v.edges := e;
e := e.m_reverse;
e.link (e);
w.edges := e;
return;
end if;
end;
end if;
if n = 1 or else n = 2 then -- lint -fallthrough
declare
v : constant Vertex_view := Self.originalVertices.Element (start);
begin
v.edges := null;
v.next := v;
v.prev := v;
result.minXy := v;
result.maxXy := v;
result.minYx := v;
result.maxYx := v;
return;
end;
end if;
declare
split0 : constant Integer := start + n / 2;
p : constant Point32 := Self.originalVertices.Element (split0 - 1).point;
split1 : Integer := split0;
hull1 : aliased IntermediateHull;
begin
while split1 < finish and then (Self.originalVertices.Element (split1).point = p)
loop
split1 := split1 + 1;
end loop;
Self.computeInternal (start, split0, result);
Self.computeInternal (split1, finish, hull1'Access);
merge (Self, result, hull1'Access);
end;
end computeInternal;
function mergeProjection (Self : access Internal'Class; h0, h1 : access IntermediateHull;
c0, c1 : access Vertex_view ) return Boolean
is
pragma Unreferenced (Self);
v0 : Vertex_view := h0.maxYx;
v1 : Vertex_view := h1.minYx;
v00,
v10 : Vertex_view;
sign : int32_t := 1;
begin
if v0.point.x = v1.point.x
and then v0.point.y = v1.point.y
then
declare
pragma Assert (v0.point.z < v1.point.z);
v1p : constant Vertex_view := v1.prev;
v1n : Vertex_view;
begin
if v1p = v1 then
c0.all := v0;
if v1.edges /= null then
pragma Assert (v1.edges.next = v1.edges);
v1 := v1.edges.target;
pragma Assert (v1.edges.next = v1.edges);
end if;
c1.all := v1;
return False;
end if;
v1n := v1.next;
v1p.next := v1n;
v1n.prev := v1p;
if v1 = h1.minXy then
if (v1n.point.x < v1p.point.x) or else ((v1n.point.x = v1p.point.x) and then (v1n.point.y < v1p.point.y)) then
h1.minXy := v1n;
else
h1.minXy := v1p;
end if;
end if;
if v1 = h1.maxXy then
if (v1n.point.x > v1p.point.x) or else ((v1n.point.x = v1p.point.x) and then (v1n.point.y > v1p.point.y)) then
h1.maxXy := v1n;
else
h1.maxXy := v1p;
end if;
end if;
end;
end if;
v0 := h0.maxXy;
v1 := h1.maxXy;
for side in 1 .. 2 loop
declare
dx : int32_t := (v1.point.x - v0.point.x) * sign;
dy : int32_t;
w0, w1 : Vertex_view;
dx0, dy0,
dx1, dy1,
dxn : int32_t;
continue : Boolean := False; -- for simulated C 'continue' statement.
begin
if dx > 0 then
loop
dy := v1.point.y - v0.point.y;
if side = 2 then
w0 := v0.next;
else
w0 := v0.prev;
end if;
if w0 /= v0 then
dx0 := (w0.point.x - v0.point.x) * sign;
dy0 := w0.point.y - v0.point.y;
if dy0 <= 0
and then ( dx0 = 0
or else ( dx0 < 0
and then dy0 * dx <= dy * dx0))
then
v0 := w0;
dx := (v1.point.x - v0.point.x) * sign;
continue := True;
end if;
end if;
if not continue then
if side = 2 then
w1 := v1.next;
else
w1 := v1.prev;
end if;
if w1 /= v1 then
dx1 := (w1.point.x - v1.point.x) * sign;
dy1 := w1.point.y - v1.point.y;
dxn := (w1.point.x - v0.point.x) * sign;
if dxn > 0
and then dy1 < 0
and then ( dx1 = 0
or else ( dx1 < 0
and then dy1 * dx < dy * dx1))
then
v1 := w1;
dx := dxn;
continue := True;
end if;
end if;
if not continue then
exit;
end if;
end if;
end loop;
elsif dx < 0 then
loop
dy := v1.point.y - v0.point.y;
if side = 2 then
w1 := v1.prev;
else
w1 := v1.next;
end if;
if w1 /= v1 then
dx1 := (w1.point.x - v1.point.x) * sign;
dy1 := w1.point.y - v1.point.y;
if (dy1 >= 0) and then ((dx1 = 0) or else ((dx1 < 0) and then (dy1 * dx <= dy * dx1))) then
v1 := w1;
dx := (v1.point.x - v0.point.x) * sign;
continue := True;
end if;
end if;
if not continue then
if side = 2 then
w0 := v0.prev;
else
w0 := v0.next;
end if;
if w0 /= v0 then
dx0 := (w0.point.x - v0.point.x) * sign;
dy0 := w0.point.y - v0.point.y;
dxn := (v1.point.x - w0.point.x) * sign;
if dxn < 0
and then dy0 > 0
and then ( dx0 = 0
or else ( dx0 < 0
and then dy0 * dx < dy * dx0))
then
v0 := w0;
dx := dxn;
continue := True;
end if;
end if;
if not continue then
exit;
end if;
end if;
end loop;
else
declare
x : constant int32_t := v0.point.x;
y0 : int32_t := v0.point.y;
y1 : int32_t;
t : Vertex_view;
begin
w0 := v0;
if side = 2 then
t := w0.next;
else
t := w0.prev;
end if;
while t /= v0
and then t.point.x = x
and then t.point.y <= y0
loop
w0 := t;
y0 := t.point.y;
end loop;
v0 := w0;
y1 := v1.point.y;
w1 := v1;
if side = 2 then
t := w1.prev;
else
t := w1.next;
end if;
while t /= v1
and then t.point.x = x
and then t.point.y >= y1
loop
w1 := t;
y1 := t.point.y;
end loop;
v1 := w1;
end;
end if;
if side = 0 then
v00 := v0;
v10 := v1;
v0 := h0.minXy;
v1 := h1.minXy;
sign := -1;
end if;
end;
end loop;
v0.prev := v1;
v1.next := v0;
v00.next := v10;
v10.prev := v00;
if h1.minXy.point.x < h0.minXy.point.x then
h0.minXy := h1.minXy;
end if;
if h1.maxXy.point.x >= h0.maxXy.point.x then
h0.maxXy := h1.maxXy;
end if;
h0.maxYx := h1.maxYx;
c0.all := v00;
c1.all := v10;
return True;
end mergeProjection;
function toBtVector (Self : in Internal; v : in Point32) return math.Vector_3;
function toBtVector (Self : in Internal; v : in Point32) return math.Vector_3
is
use math.Algebra.linear.d3;
p : Vector_3;
begin
p (Self.medAxis) := Real (v.x);
p (Self.maxAxis) := Real (v.y);
p (Self.minAxis) := Real (v.z);
return impact.d3.vector.Scaled (p, by => Self.scaling);
end toBtVector;
function getBtNormal (Self : in Internal; for_face : in Face) return math.Vector_3;
function getBtNormal (Self : in Internal; for_face : in Face) return math.Vector_3
is
use math.Algebra.linear.d3, impact.d3.Vector;
begin
return normalized (toBtVector (Self, for_Face.dir0) * toBtVector (Self, for_Face.dir1)); -- * <-. 'cross product'
end getBtNormal;
function shiftFace (Self : access Internal; the_face : access Face;
amount : in math.Real;
use_stack : in vertex_Vector) return Boolean;
function shiftFace (Self : access Internal; the_face : access Face;
amount : in math.Real;
use_stack : in vertex_Vector) return Boolean
is
use math.Vectors, ada.Containers;
the_Stack : vertex_Vector := use_stack;
origShift : Vector_3 := getBtNormal (Self.all, the_face.all) * (-amount);
shift : Point32;
normal : Point64;
origDot,
shiftedDot : int64_t;
shiftedOrigin : Point32;
intersection,
startEdge : internal_Edge_view;
optDot : Rational128;
cmp : Integer;
e : internal_Edge_view;
firstIntersection,
faceEdge,
firstFaceEdge : internal_Edge_view;
begin
if Self.scaling (1) /= 0.0 then origShift (1) := origShift (1) / Self.scaling (1); end if;
if Self.scaling (2) /= 0.0 then origShift (2) := origShift (2) / Self.scaling (2); end if;
if Self.scaling (3) /= 0.0 then origShift (3) := origShift (3) / Self.scaling (3); end if;
shift := to_Point32 (int32_t (origShift (Self.medAxis)),
int32_t (origShift (Self.maxAxis)),
int32_t (origShift (Self.minAxis)));
if isZero (shift) then
return True;
end if;
normal := getNormal (the_face.all);
origDot := the_face.origin.dot (normal);
shiftedOrigin := the_face.origin + shift;
shiftedDot := shiftedOrigin.dot (normal); pragma Assert (shiftedDot <= origDot);
if shiftedDot >= origDot then
return False;
end if;
startEdge := the_face.nearbyVertex.edges;
optDot := dot (the_face.nearbyVertex.all, normal);
cmp := compare (optDot, shiftedDot);
if cmp >= 0 then
e := startEdge;
loop
declare
dot : constant Rational128 := convex_hull_Computer.dot (e.target.all, normal); pragma Assert (compare (dot, origDot) <= 0);
c : Integer;
begin
if compare (dot, optDot) < 0 then
c := compare (dot, shiftedDot);
optDot := dot;
e := e.m_reverse;
startEdge := e;
if c < 0 then
intersection := e;
exit;
end if;
cmp := c;
end if;
end;
e := e.prev;
exit when e = startEdge;
end loop;
if intersection = null then
return False;
end if;
else
e := startEdge;
loop
declare
dot : constant Rational128 := convex_hull_Computer.dot (e.target.all, normal); pragma Assert (compare (dot, origDot) <= 0);
begin
if compare (dot, optDot) > 0 then
cmp := compare (dot, shiftedDot);
if cmp >= 0 then
intersection := e;
exit;
end if;
optDot := dot;
e := e.m_reverse;
startEdge := e;
end if;
end;
e := e.prev;
exit when e = startEdge;
end loop;
if intersection = null then
return True;
end if;
end if;
if cmp = 0 then
e := intersection.m_reverse.next;
while compare (dot (e.target.all, normal), shiftedDot) <= 0
loop
e := e.next;
if e = intersection.m_reverse then
return True;
end if;
end loop;
end if;
loop
if cmp = 0 then
e := intersection.m_reverse.next;
startEdge := e;
loop
if compare (dot (e.target.all, normal), shiftedDot) >= 0 then
exit;
end if;
intersection := e.m_reverse;
e := e.next;
if e = startEdge then
return True;
end if;
end loop;
end if;
if firstIntersection = null then
firstIntersection := intersection;
elsif intersection = firstIntersection then
exit;
end if;
declare
prevCmp : constant Integer := cmp;
prevIntersection : constant internal_Edge_view := intersection;
prevFaceEdge : constant internal_Edge_view := faceEdge;
removed : Vertex_view;
begin
e := intersection.m_reverse;
loop
e := e.m_reverse.prev; pragma Assert (e /= intersection.m_reverse);
cmp := compare (dot (e.target.all, normal), shiftedDot);
if cmp >= 0 then
intersection := e;
exit;
end if;
end loop;
if cmp > 0 then
removed := intersection.target;
e := intersection.m_reverse;
if e.prev = e then
removed.edges := null;
else
removed.edges := e.prev;
e.prev.link (e.next);
e .link (e);
end if;
declare
n0 : constant Point64 := getNormal (intersection.face.all);
n1 : constant Point64 := getNormal (intersection.m_reverse.face.all);
m00 : constant int64_t := the_face.dir0.dot (n0);
m01 : constant int64_t := the_face.dir1.dot (n0);
m10 : constant int64_t := the_face.dir0.dot (n1);
m11 : constant int64_t := the_face.dir1.dot (n1);
r0 : constant int64_t := dot ((intersection .face.origin - shiftedOrigin), n0);
r1 : constant int64_t := dot ((intersection.m_reverse.face.origin - shiftedOrigin), n1);
det : constant Int128 := mul (m00, m11) - mul (m01, m10); pragma Assert (det.getSign /= 0);
v : constant Vertex_view := Self.vertexPool.newObject.all'Access;
begin
v.point.index := -1;
v.copy := -1;
v.point128 := PointR128'(x =>
mul (int64_t (the_face.dir0.x) * r0, m11) - mul (int64_t (the_face.dir0.x) * r1, m01)
+ mul (int64_t (the_face.dir1.x) * r1, m00) - mul (int64_t (the_face.dir1.x) * r0, m10)
+ det * int64_t (shiftedOrigin.x),
y =>
mul (int64_t (the_face.dir0.y) * r0, m11) - mul (int64_t (the_face.dir0.y) * r1, m01)
+ mul (int64_t (the_face.dir1.y) * r1, m00) - mul (int64_t (the_face.dir1.y) * r0, m10)
+ det * int64_t (shiftedOrigin.y),
z =>
mul (int64_t (the_face.dir0.z) * r0, m11) - mul (int64_t (the_face.dir0.z) * r1, m01)
+ mul (int64_t (the_face.dir1.z) * r1, m00) - mul (int64_t (the_face.dir1.z) * r0, m10)
+ det * int64_t (shiftedOrigin.z),
denominator => det);
v.point.x := int32_t (v.point128.xvalue);
v.point.y := int32_t (v.point128.yvalue);
v.point.z := int32_t (v.point128.zvalue);
intersection.target := v;
v.edges := e;
the_stack.append (v);
the_stack.append (removed);
the_stack.append (null);
end;
end if;
if cmp /= 0
or else prevCmp /= 0
or else (prevIntersection.m_reverse.next.target /= intersection.target)
then
faceEdge := Self.newEdgePair (prevIntersection.target, intersection.target);
if prevCmp = 0 then
faceEdge.link (prevIntersection.m_reverse.next);
end if;
if prevCmp = 0 or else prevFaceEdge /= null then
prevIntersection.m_reverse.link (faceEdge);
end if;
if cmp = 0 then
intersection.m_reverse.prev.link (faceEdge.m_reverse);
end if;
faceEdge.m_reverse.link (intersection.m_reverse);
else
faceEdge := prevIntersection.m_reverse.next;
end if;
if prevFaceEdge /= null then
if prevCmp > 0 then
faceEdge.link (prevFaceEdge.m_reverse);
elsif faceEdge /= prevFaceEdge.m_reverse then
the_stack.append (prevFaceEdge.target);
while faceEdge.next /= prevFaceEdge.m_reverse
loop
declare
removed : constant Vertex_view := faceEdge.next.target;
begin
Self.removeEdgePair (faceEdge.next);
the_stack.append (removed);
end;
end loop;
the_stack.append (null);
end if;
end if;
faceEdge .face := the_face;
faceEdge.m_reverse.face := intersection.face;
if firstFaceEdge = null then
firstFaceEdge := faceEdge;
end if;
end;
end loop;
if cmp > 0 then
firstFaceEdge.m_reverse.target := faceEdge.target;
firstIntersection.m_reverse.link (firstFaceEdge);
firstFaceEdge .link (faceEdge.m_reverse);
elsif firstFaceEdge /= faceEdge.m_reverse then
the_stack.append (faceEdge.target);
while firstFaceEdge.next /= faceEdge.m_reverse
loop
declare
removed : constant Vertex_view := firstFaceEdge.next.target;
begin
Self.removeEdgePair (firstFaceEdge.next);
the_stack.append (removed);
end;
end loop;
the_stack.append (null);
end if;
pragma Assert (the_stack.Length > 0);
Self.vertexList := the_stack.Element (1);
declare
pos : Integer := 0;
the_end : Integer;
kept,
removed : Vertex_view;
deeper : Boolean;
begin
while pos < Integer (the_Stack.Length)
loop
the_end := Integer (the_Stack.Length);
while pos < the_end
loop
pos := pos + 1;
kept := the_Stack.Element (pos);
deeper := False;
pos := pos + 1;
removed := the_Stack.Element (pos);
while removed /= null
loop
receiveNearbyFaces (kept, removed);
while removed.edges /= null
loop
if not deeper then
deeper := True;
the_stack.append (kept);
end if;
the_stack.append (removed.edges.target);
Self.removeEdgePair (removed.edges);
end loop;
end loop;
if deeper then
the_stack.append (null);
end if;
end loop;
end loop;
end;
the_stack.clear;
the_face.origin := shiftedOrigin;
return True;
end shiftFace;
--- compute
--
function pointCmp (p, q : in Point32) return Boolean
is
begin
return p.y < q.y
or else ( p.y = q.y
and then ( p.x < q.x
or else ( p.x = q.x
and then p.z < q.z)));
end pointCmp;
package Conversions is new system.Address_to_Access_Conversions (c.unsigned_Char);
procedure compute (Self : in out Internal; coords : in system.Address;
doubleCoords : in Boolean;
stride : in Integer;
count : in Integer);
procedure compute (Self : in out Internal; coords : in system.Address;
doubleCoords : in Boolean;
stride : in Integer;
count : in Integer)
is
use impact.d3.Vector, swig.Pointers;
function to_double_Pointer is new ada.unchecked_Conversion (c_unsigned_char_Pointers.pointer, swig.pointers.double_Pointer);
function to_float_Pointer is new ada.unchecked_Conversion (c_unsigned_char_Pointers.pointer, swig.pointers.float_Pointer);
min : Vector_3 := (1.0e30, 1.0e30, 1.0e30);
max : Vector_3 := (-1.0e30, -1.0e30, -1.0e30);
ptr : c_unsigned_char_Pointers.pointer := conversions.to_Pointer (coords).all'Access;
-- ptr : access interfaces.c.char := coords;
-- const char* ptr = (const char*) coords;
s : Vector_3;
begin
if doubleCoords then
for i in 1 .. count
loop
declare
use swig.pointers.c_double_Pointers, c_unsigned_char_Pointers;
v : constant swig.pointers.double_Pointer := to_double_Pointer (ptr); -- const double* v = (const double*) ptr;
p : constant Vector_3 := (Real (double_Pointer (v + 0).all),
Real (double_Pointer (v + 1).all),
Real (double_Pointer (v + 2).all));
begin
ptr := ptr + C.ptrdiff_t (stride);
setMin (min, p);
setMax (max, p);
end;
end loop;
else
for i in 1 .. count
loop
declare
use swig.pointers.c_float_Pointers, c_unsigned_char_Pointers;
v : constant swig.pointers.float_Pointer := to_float_Pointer (ptr);
p : constant Vector_3 := (Real (float_Pointer (v + 0).all),
Real (float_Pointer (v + 1).all),
Real (float_Pointer (v + 2).all));
-- p : bullet.Vector_3 := ((v+0), (v+1), (v+2));
begin
ptr := ptr + C.ptrdiff_t (stride);
setMin (min, p);
setMax (max, p);
end;
end loop;
end if;
s := max - min;
Self.maxAxis := maxAxis (s);
Self.minAxis := minAxis (s);
if Self.minAxis = Self.maxAxis then
Self.minAxis := (Self.maxAxis + 1) mod 3;
end if;
Self.medAxis := 3 - Self.maxAxis - Self.minAxis;
s := s / 10216.0;
if ((Self.medAxis + 1) mod 3) /= Self.maxAxis then
s := -s;
end if;
Self.scaling := s;
if s (1) /= 0.0 then
s (1) := 1.0 / s (1);
end if;
if s (2) /= 0.0 then
s (2) := 1.0 / s (2);
end if;
if s (3) /= 0.0 then
s (3) := 1.0 / s (3);
end if;
Self.center := (min + max) * 0.5;
declare
type point_array is array (Positive range <>) of Point32;
points : point_array (1 .. Count);
procedure sort is new ada.containers.Generic_Array_Sort (Positive, Point32, point_array, pointCmp);
-- btAlignedObjectArray<Point32> points;
begin
-- points.resize (count);
-- ptr := (const char*) coords;
ptr := conversions.to_Pointer (coords).all'Access;
if doubleCoords then
for i in 1 .. count
loop
declare
use swig.pointers.c_double_Pointers, c_unsigned_char_Pointers;
v : constant swig.pointers.double_Pointer := to_double_Pointer (ptr); -- const double* v := (const double*) ptr;
p : Vector_3 := (Real (double_Pointer (v + 0).all),
Real (double_Pointer (v + 1).all),
Real (double_Pointer (v + 2).all));
begin
ptr := ptr + C.ptrdiff_t (stride);
p := Scaled (p - Self.center, by => s);
points (i).x := Integer_32 (p (Self.medAxis));
points (i).y := Integer_32 (p (Self.maxAxis));
points (i).z := Integer_32 (p (Self.minAxis));
points (i).index := i;
end;
end loop;
else
for i in 1 .. count
loop
declare
use math.algebra.linear.d3, swig.pointers.c_float_Pointers, c_unsigned_char_Pointers;
v : constant swig.pointers.float_Pointer := to_float_Pointer (ptr); -- const float* v = (const float*) ptr;
p : Vector_3 := (Real (float_Pointer (v + 0).all),
Real (float_Pointer (v + 1).all),
Real (float_Pointer (v + 2).all));
begin
ptr := ptr + C.ptrdiff_t (stride);
p := Scaled (p - Self.center, by => s);
points (i).x := Integer_32 (p (Self.medAxis));
points (i).y := Integer_32 (p (Self.maxAxis));
points (i).z := Integer_32 (p (Self.minAxis));
points (i).index := i;
end;
end loop;
end if;
sort (points);
Self.vertexPool.reset;
Self.vertexPool.setArraySize (count);
Self.originalVertices.set_Length (ada.containers.Count_type (count));
for i in 1 .. count
loop
declare
v : constant Vertex_view := Self.vertexPool.newObject.all'Access;
begin
v.edges := null;
v.point := points (i);
v.copy := -1;
Self.originalVertices.replace_Element (i, v);
end;
end loop;
Self.edgePool.reset;
Self.edgePool.setArraySize (6 * count);
Self.usedEdgePairs := 0;
Self.maxUsedEdgePairs := 0;
Self.mergeStamp := -3;
declare
hull : aliased IntermediateHull;
begin
Self.computeInternal (0, count, hull'Access);
Self.vertexList := hull.minXy;
end;
end;
end compute;
function getCoordinates (Self : in Internal; for_vertex : in Vertex) return math.Vector_3;
function getCoordinates (Self : in Internal; for_vertex : in Vertex) return math.Vector_3
is
use math.Vectors, math.Algebra.linear.d3;
p : Vector_3;
begin
p (Self.medAxis) := xvalue (for_Vertex);
p (Self.maxAxis) := yvalue (for_Vertex);
p (Self.minAxis) := zvalue (for_Vertex);
return impact.d3.vector.Scaled (p, by => Self.scaling) + Self.center;
end getCoordinates;
function getVertexCopy (vertex : Vertex_view; vertices : access vertex_Vector) return Integer
is
index : Integer := vertex.copy;
begin
if index < 0 then
vertices.append (vertex);
index := Integer (vertices.Length);
vertex.copy := index;
end if;
return index;
end getVertexCopy;
function shrink (Self : access Internal; amount : in math.Real;
clampAmount : in math.Real) return math.Real;
function shrink (Self : access Internal; amount : in math.Real;
clampAmount : in math.Real) return math.Real
is
use ada.Containers, vertex_Vectors;
stamp : Integer;
stack : vertex_Vector;
faces : face_Vector;
ref : Point32;
hullCenterX,
hullCenterY,
hullCenterZ,
volume : Int128;
begin
if Self.vertexList = null then
return 0.0;
end if;
Self.mergeStamp := Self.mergeStamp - 1;
stamp := Self.mergeStamp;
Self.vertexList.copy := stamp;
stack.append (Self.vertexList);
ref := Self.vertexList.point;
hullCenterX := (0, 0);
hullCenterY := (0, 0);
hullCenterZ := (0, 0);
volume := (0, 0);
while stack.Length > 0
loop
declare
v : constant Vertex_view := stack.last_Element; -- (stack.Length - 1);
e : internal_Edge_view := v.edges;
begin
stack.delete_Last;
if e /= null then
loop
if e.target.copy /= stamp then
e.target.copy := stamp;
stack.append (e.target);
end if;
if e.copy /= stamp then
declare
face : constant Face_view := Self.facePool.newObject.all'Access;
f : internal_Edge_view := e;
a, b : Vertex_view;
begin
init (face, e.target, e.m_reverse.prev.target, v);
faces.append (face);
loop
if a /= null
and then b /= null
then
declare
vol : constant int64_t := dot (v.point - ref,
cross (a.point - ref, b.point - ref));
pragma Assert (vol >= 0);
c : constant Point32 := v.point + a.point + b.point + ref;
begin
hullCenterX := hullCenterX + to_Int128 (vol * Int64_t (c.x));
hullCenterY := hullCenterY + to_Int128 (vol * Int64_t (c.y));
hullCenterZ := hullCenterZ + to_Int128 (vol * Int64_t (c.z));
volume := volume + to_Int128 (vol);
end;
end if;
pragma Assert (f.copy /= stamp);
f.copy := stamp;
f.face := face;
a := b;
b := f.target;
f := f.m_reverse.prev;
exit when f = e;
end loop;
end;
end if;
e := e.next;
exit when e = v.edges;
end loop;
end if;
end;
end loop;
if volume.getSign <= 0 then
return 0.0;
end if;
declare
use math.Vectors, Math, math.Algebra.linear;
use type C.unsigned;
hullCenter : Vector_3;
faceCount : Integer;
minDist : Real;
seed : C.unsigned;
the_Amount : Real := Amount;
begin
hullCenter (Self.medAxis) := hullCenterX.toScalar;
hullCenter (Self.maxAxis) := hullCenterY.toScalar;
hullCenter (Self.minAxis) := hullCenterZ.toScalar;
hullCenter := hullCenter / (4.0 * volume.toScalar);
hullCenter := Vector_3 (Scaled (math.Vector (hullCenter),
by => math.Vector (Self.scaling)));
faceCount := Integer (faces.Length);
if clampAmount > 0.0 then
minDist := impact.d3.Scalar.SIMD_INFINITY;
for i in 1 .. faceCount
loop
declare
normal : constant Vector_3 := getBtNormal (Self.all, faces.Element (i).all);
dist : constant Real := normal * (toBtVector (Self.all, faces.Element (i).origin) - hullCenter);
begin
if dist < minDist then
minDist := dist;
end if;
end;
end loop;
if minDist <= 0.0 then
return 0.0;
end if;
the_Amount := Real'Min (the_Amount, minDist * clampAmount);
end if;
seed := 243703;
for i in 1 .. faceCount
loop
faces.swap (i, Positive (seed mod c.unsigned (faceCount))); -- btSwap (faces (i), faces (seed mod faceCount));
seed := 1664525 * seed + 1013904223;
end loop;
for i in 1 .. faceCount
loop
if not shiftFace (Self, faces.Element (i), amount, stack) then
return -amount;
end if;
end loop;
return amount;
end;
end shrink;
-- tbd: <critical> check indices in arrays and vectors below !!!
function compute (Self : access Item'Class; coords : in system.Address;
doubleCoords : in Boolean;
stride : in Integer;
count : in Integer;
the_shrink : in math.Real;
shrinkClamp : in math.Real) return math.Real
is
hull : aliased Internal;
shift : Real;
oldVertices : aliased vertex_Vector;
copied : Integer;
unused : Integer;
pragma Unreferenced (unused);
begin
if count <= 0 then
Self.vertices.clear;
Self.edges.clear;
Self.faces.clear;
return 0.0;
end if;
compute (hull, coords, doubleCoords, stride, count);
shift := 0.0;
if the_shrink > 0.0 then
shift := shrink (hull'Access, the_shrink, shrinkClamp);
if shift < 0.0 then
Self.vertices.clear;
Self.edges.clear;
Self.faces.clear;
return shift;
end if;
end if;
-- Self.vertices.resize (0);
-- Self.edges.resize (0);
-- Self.faces.resize (0);
Self.vertices.clear;
Self.edges .clear;
Self.faces .clear;
unused := getVertexCopy (hull.vertexList, oldVertices'Access);
copied := 0;
while copied < Integer (oldVertices.Length)
loop
declare
v : constant Vertex_view := oldVertices.Element (copied);
firstEdge,
e : internal_Edge_view;
r : constant Edge_view := new Edge;
c : constant Edge_view := new Edge;
firstCopy,
prevCopy,
s : Integer;
begin
Self.vertices.append (getCoordinates (hull, v.all));
firstEdge := v.edges;
if firstEdge /= null then
firstCopy := -1;
prevCopy := -1;
e := firstEdge;
loop
if e.copy < 0 then
s := Integer (Self.edges.Length);
-- c := &edges[s];
-- r := &edges[s + 1];
e.copy := s;
e.m_reverse.copy := s + 1;
c.m_reverse := 1;
r.m_reverse := -1;
c.targetVertex := getVertexCopy (e.target, oldVertices'Access);
r.targetVertex := copied;
Self.edges.append (c);
Self.edges.append (r);
end if;
if prevCopy >= 0 then
declare
the_Edge : constant Edge_view := Self.edges.Element (e.copy);
begin
the_Edge.next := prevCopy - e.copy;
end;
else
firstCopy := e.copy;
end if;
prevCopy := e.copy;
e := e.next;
exit when e = firstEdge;
end loop;
declare
the_Edge : constant Edge_view := Self.edges.Element (firstCopy);
begin
the_Edge.next := prevCopy - firstCopy;
end;
end if;
copied := copied + 1;
end;
end loop;
for i in 1 .. copied
loop
declare
v : constant Vertex_view := oldVertices.Element (i);
firstEdge : constant internal_Edge_view := v.edges;
e, f : internal_Edge_view;
begin
if firstEdge /= null then
e := firstEdge;
loop
if e.copy >= 0 then
Self.faces.append (e.copy);
f := e;
loop
f.copy := -1;
f := f.m_reverse.prev;
exit when f = e;
end loop;
end if;
e := e.next;
exit when e = firstEdge;
end loop;
end if;
end;
end loop;
return shift;
end compute;
end impact.d3.convex_hull_Computer;
|
vp8/encoder/x86/fwalsh_sse2.asm | mrchapp/libvpx | 1 | 88759 | ;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
%include "vpx_ports/x86_abi_support.asm"
;void vp8_short_walsh4x4_sse2(short *input, short *output, int pitch)
global sym(vp8_short_walsh4x4_sse2)
sym(vp8_short_walsh4x4_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 3
push rsi
push rdi
; end prolog
mov rsi, arg(0)
mov rdi, arg(1)
movdqu xmm4, [rsi + 0] ;ip[4] ip[0]
movdqu xmm0, [rsi + 16] ;ip[12] ip[8]
pxor xmm7, xmm7
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; 13 12 11 10 03 02 01 00
;
; 33 32 31 30 23 22 21 20
;
movdqa xmm3, xmm4 ; 13 12 11 10 03 02 01 00
punpcklwd xmm4, xmm0 ; 23 03 22 02 21 01 20 00
punpckhwd xmm3, xmm0 ; 33 13 32 12 31 11 30 10
movdqa xmm1, xmm4 ; 23 03 22 02 21 01 20 00
punpcklwd xmm4, xmm3 ; 31 21 11 01 30 20 10 00
punpckhwd xmm1, xmm3 ; 33 23 13 03 32 22 12 02
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
movdqa xmm3, xmm4 ;ip[4] ip[0]
paddw xmm4, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
movdqa xmm5, xmm4
punpcklqdq xmm4, xmm3 ;d1 a1
punpckhqdq xmm5, xmm3 ;c1 b1
movdqa xmm1, xmm5 ;c1 b1
paddw xmm5, xmm4 ;dl+cl a1+b1 aka op[4] op[0]
psubw xmm4, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; 13 12 11 10 03 02 01 00
;
; 33 32 31 30 23 22 21 20
;
movdqa xmm0, xmm5 ; 13 12 11 10 03 02 01 00
punpcklwd xmm5, xmm4 ; 23 03 22 02 21 01 20 00
punpckhwd xmm0, xmm4 ; 33 13 32 12 31 11 30 10
movdqa xmm1, xmm5 ; 23 03 22 02 21 01 20 00
punpcklwd xmm5, xmm0 ; 31 21 11 01 30 20 10 00
punpckhwd xmm1, xmm0 ; 33 23 13 03 32 22 12 02
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pshufd xmm2, xmm1, 4eh ;ip[8] ip[12]
movdqa xmm3, xmm5 ;ip[4] ip[0]
paddw xmm5, xmm2 ;ip[4]+ip[8] ip[0]+ip[12] aka b1 a1
psubw xmm3, xmm2 ;ip[4]-ip[8] ip[0]-ip[12] aka c1 d1
movdqa xmm6, xmm5
punpcklqdq xmm5, xmm3 ;d1 a1
punpckhqdq xmm6, xmm3 ;c1 b1
movdqa xmm1, xmm6 ;c1 b1
paddw xmm6, xmm5 ;dl+cl a1+b1 aka op[4] op[0]
psubw xmm5, xmm1 ;d1-c1 a1-b1 aka op[12] op[8]
movdqa xmm0, xmm6 ;aka b2 a2
movdqa xmm1, xmm5 ;aka d2 c2
pcmpgtw xmm0, xmm7
pcmpgtw xmm1, xmm7
psrlw xmm0, 15
psrlw xmm1, 15
paddw xmm6, xmm0
paddw xmm5, xmm1
psraw xmm6, 1
psraw xmm5, 1
; a2 = a1 + b1;
; b2 = c1 + d1;
; c2 = a1 - b1;
; d2 = d1 - c1;
; a2 += (a2>0);
; b2 += (b2>0);
; c2 += (c2>0);
; d2 += (d2>0);
; op[0] = (a2)>>1;
; op[4] = (b2)>>1;
; op[8] = (c2)>>1;
; op[12]= (d2)>>1;
movdqu [rdi + 0], xmm6
movdqu [rdi + 16], xmm5
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
|
src/dql/DqlLexer.g4 | guneysus/predicate-builder | 1 | 5631 | lexer grammar DqlLexer;
SELECT : 'select' ;
ALL : '*' ;
SEMI_COLON : ';' ;
FROM : 'from' ;
TABLE_NAME :
([A-Z][A-Za-z]+)
;
WS: [\n\t\r]+ -> skip;
|
helloworld.asm | sidav/ASM-testing-ground | 0 | 161814 | <reponame>sidav/ASM-testing-ground
global _start
_start:
call _print_msg
mov eax, 1
mov ebx, 0
int 0x80
_print_chr: ; doesn't work
mov eax, 4
mov ebx, 1
mov edx, 1
int 0x80
ret
_print_msg: ; SPOILS eax, ebx, ecx, edx REGISTERS!
mov eax, 4; <- 4 means "WRITE" for syscall
mov ebx, 1; <- file descriptor (1 means "monitor")
mov ecx, esp
mov ecx, msg; <- address of string
mov edx, msglen; <- length of string
int 0x80; <- syscall
ret
;----------------------------------------------------------
section .data
msg: db "Линукс рулез, асм заебись",0x0A,0
msglen equ $-msg
|
engine/events/map_name_sign.asm | zavytar/pokecolorless | 0 | 87187 | MAP_NAME_SIGN_START EQU $60
ReturnFromMapSetupScript::
xor a
ldh [hBGMapMode], a
farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes
ret
; should have just been a fallthrough
.inefficient_farcall
ld a, [wMapGroup]
ld b, a
ld a, [wMapNumber]
ld c, a
call GetWorldMapLocation
ld [wCurLandmark], a
call .CheckNationalParkGate
jr z, .nationalparkgate
call GetMapEnvironment
cp GATE
jr nz, .not_gate
.nationalparkgate
ld a, -1
ld [wCurLandmark], a
.not_gate
ld hl, wEnteredMapFromContinue
bit 1, [hl]
res 1, [hl]
jr nz, .dont_do_map_sign
call .CheckMovingWithinLandmark
jr z, .dont_do_map_sign
ld a, [wCurLandmark]
ld [wPrevLandmark], a
call .CheckSpecialMap
jr z, .dont_do_map_sign
; Display for 60 frames
ld a, 60
ld [wLandmarkSignTimer], a
call LoadMapNameSignGFX
call InitMapNameFrame
farcall HDMATransfer_OnlyTopFourRows
ret
.dont_do_map_sign
ld a, [wCurLandmark]
ld [wPrevLandmark], a
ld a, $90
ldh [rWY], a
ldh [hWY], a
xor a
ldh [hLCDCPointer], a
ret
.CheckMovingWithinLandmark:
ld a, [wCurLandmark]
ld c, a
ld a, [wPrevLandmark]
cp c
ret z
cp SPECIAL_MAP
ret
.CheckSpecialMap:
; These landmarks do not get pop-up signs.
cp -1
ret z
cp SPECIAL_MAP
ret z
cp RADIO_TOWER
ret z
cp LAV_RADIO_TOWER
ret z
cp UNDERGROUND_PATH
ret z
cp INDIGO_PLATEAU
ret z
cp POWER_PLANT
ret z
ld a, 1
and a
ret
.CheckNationalParkGate:
; TODO: Uncomment this if you restore the Bug-Catching Contest.
ld a, [wMapGroup]
cp GROUP_NONE
ret nz
ld a, [wMapNumber]
cp MAP_NONE
ret z
cp MAP_NONE
ret
PlaceMapNameSign::
ld hl, wLandmarkSignTimer
ld a, [hl]
and a
jr z, .disappear
dec [hl]
cp 60
ret z
cp 59
jr nz, .skip2
call InitMapNameFrame
call PlaceMapNameCenterAlign
farcall HDMATransfer_OnlyTopFourRows
.skip2
ld a, $80
ld a, $70
ldh [rWY], a
ldh [hWY], a
ret
.disappear
ld a, $90
ldh [rWY], a
ldh [hWY], a
xor a
ldh [hLCDCPointer], a
ret
LoadMapNameSignGFX:
ld de, MapEntryFrameGFX
ld hl, vTiles2 tile MAP_NAME_SIGN_START
lb bc, BANK(MapEntryFrameGFX), 14
call Get2bpp
ret
InitMapNameFrame:
hlcoord 0, 0
ld b, 2
ld c, 18
call InitMapSignAttrMap
call PlaceMapNameFrame
ret
PlaceMapNameCenterAlign:
ld a, [wCurLandmark]
ld e, a
farcall GetLandmarkName
call .GetNameLength
ld a, SCREEN_WIDTH
sub c
srl a
ld b, $0
ld c, a
hlcoord 0, 2
add hl, bc
ld de, wStringBuffer1
call PlaceString
ret
.GetNameLength:
ld c, 0
push hl
ld hl, wStringBuffer1
.loop
ld a, [hli]
cp "@"
jr z, .stop
cp "%"
jr z, .loop
inc c
jr .loop
.stop
pop hl
ret
InitMapSignAttrMap:
ld de, wAttrMap - wTileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, PAL_BG_TEXT | PRIORITY
.loop
push bc
push hl
.inner_loop
ld [hli], a
dec c
jr nz, .inner_loop
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
jr nz, .loop
ret
PlaceMapNameFrame:
hlcoord 0, 0
; top left
ld a, MAP_NAME_SIGN_START + 1
ld [hli], a
; top row
ld a, MAP_NAME_SIGN_START + 2
call .FillTopBottom
; top right
ld a, MAP_NAME_SIGN_START + 4
ld [hli], a
; left, first line
ld a, MAP_NAME_SIGN_START + 5
ld [hli], a
; first line
call .FillMiddle
; right, first line
ld a, MAP_NAME_SIGN_START + 11
ld [hli], a
; left, second line
ld a, MAP_NAME_SIGN_START + 6
ld [hli], a
; second line
call .FillMiddle
; right, second line
ld a, MAP_NAME_SIGN_START + 12
ld [hli], a
; bottom left
ld a, MAP_NAME_SIGN_START + 7
ld [hli], a
; bottom
ld a, MAP_NAME_SIGN_START + 8
call .FillTopBottom
; bottom right
ld a, MAP_NAME_SIGN_START + 10
ld [hl], a
ret
.FillMiddle:
ld c, SCREEN_WIDTH - 2
ld a, MAP_NAME_SIGN_START + 13
.loop
ld [hli], a
dec c
jr nz, .loop
ret
.FillTopBottom:
ld c, (SCREEN_WIDTH - 2) / 4 + 1
jr .enterloop
.continueloop
ld [hli], a
ld [hli], a
.enterloop
inc a
ld [hli], a
ld [hli], a
dec a
dec c
jr nz, .continueloop
ret
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48_notsx.log_21829_644.asm | ljhsiun2/medusa | 9 | 172528 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xc9bb, %rsi
lea addresses_normal_ht+0x199eb, %rdi
nop
nop
add %rdx, %rdx
mov $47, %rcx
rep movsq
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_UC_ht+0x1b93b, %rax
cmp $2793, %rcx
mov (%rax), %r13
nop
sub %rdx, %rdx
lea addresses_normal_ht+0xc0bf, %rax
nop
dec %r10
movl $0x61626364, (%rax)
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0xfeb, %rcx
nop
nop
nop
nop
nop
and $25998, %rsi
movb $0x61, (%rcx)
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WC_ht+0x1a32b, %rax
nop
nop
nop
xor $5186, %r13
movw $0x6162, (%rax)
nop
nop
nop
nop
nop
cmp $44537, %rsi
lea addresses_WT_ht+0x1d7eb, %rsi
lea addresses_D_ht+0xc7eb, %rdi
nop
nop
nop
nop
inc %r15
mov $122, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $50731, %r13
lea addresses_WT_ht+0x19deb, %rcx
nop
and $35000, %r15
vmovups (%rcx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r10
nop
nop
add $29584, %r13
lea addresses_D_ht+0x1512b, %rsi
nop
and %r15, %r15
mov (%rsi), %edi
and $29306, %r10
lea addresses_A_ht+0xdd0b, %rdx
nop
nop
nop
nop
nop
sub %rsi, %rsi
mov $0x6162636465666768, %r15
movq %r15, %xmm4
and $0xffffffffffffffc0, %rdx
vmovntdq %ymm4, (%rdx)
nop
nop
sub $41338, %rsi
lea addresses_WC_ht+0x3c74, %rax
nop
inc %r10
movl $0x61626364, (%rax)
nop
nop
nop
nop
nop
mfence
lea addresses_WC_ht+0x1d66, %rcx
nop
nop
nop
and %r13, %r13
movl $0x61626364, (%rcx)
nop
add $40057, %rdi
lea addresses_D_ht+0x5aab, %rcx
nop
nop
nop
nop
nop
xor %rdx, %rdx
mov (%rcx), %r13
sub $40714, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0xd50b, %r12
clflush (%r12)
nop
nop
xor %rbx, %rbx
movw $0x5152, (%r12)
cmp %r10, %r10
// REPMOV
lea addresses_WC+0xb1eb, %rsi
lea addresses_UC+0x12beb, %rdi
mfence
mov $104, %rcx
rep movsb
nop
cmp $11587, %rsi
// Store
lea addresses_A+0x1bdeb, %rbp
nop
nop
nop
nop
nop
and $50350, %rdi
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
vmovups %ymm2, (%rbp)
nop
add $63269, %r12
// Store
lea addresses_RW+0x87eb, %rax
clflush (%rax)
nop
nop
nop
xor %rcx, %rcx
movw $0x5152, (%rax)
nop
dec %rax
// Store
mov $0x693, %rax
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %rsi
movq %rsi, %xmm7
vmovups %ymm7, (%rax)
nop
sub $10622, %rdi
// Store
mov $0x8eb, %rbx
cmp $22909, %r12
mov $0x5152535455565758, %r10
movq %r10, %xmm4
movups %xmm4, (%rbx)
nop
nop
nop
nop
nop
add %rbp, %rbp
// Load
mov $0x5188d90000000f9b, %rax
nop
nop
nop
nop
dec %rbp
mov (%rax), %si
nop
nop
and $42969, %rbp
// Faulty Load
lea addresses_RW+0x87eb, %rsi
nop
nop
nop
nop
xor %rcx, %rcx
movntdqa (%rsi), %xmm0
vpextrq $1, %xmm0, %rbx
lea oracles, %rax
and $0xff, %rbx
shlq $12, %rbx
mov (%rax,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_RW', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_P', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_P', 'congruent': 8}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_NC', 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_RW', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 5}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 5}}
{'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
*/
|
archive/agda-3/src/Test/Test2.agda | m0davis/oscar | 0 | 4397 | <gh_stars>0
{-# OPTIONS --allow-unsolved-metas #-} -- FIXME
open import Everything
module Test.Test2 where
failed-test test-functor-transextensionality test-the-test : ∀
{𝔬₁} {𝔒₁ : Ø 𝔬₁}
{𝔯₁} {_∼₁_ : 𝔒₁ → 𝔒₁ → Ø 𝔯₁}
{ℓ₁} {_∼̇₁_ : ∀ {x y} → x ∼₁ y → x ∼₁ y → Ø ℓ₁}
{ε₁ : Reflexivity.type _∼₁_}
{_↦₁_ : Transitivity.type _∼₁_}
{𝔬₂} {𝔒₂ : Ø 𝔬₂}
{𝔯₂} {_∼₂_ : 𝔒₂ → 𝔒₂ → Ø 𝔯₂}
{ℓ₂} {_∼̇₂_ : ∀ {x y} → x ∼₂ y → x ∼₂ y → Ø ℓ₂}
{ε₂ : Reflexivity.type _∼₂_}
{_↦₂_ : Transitivity.type _∼₂_}
{surjection : Surjection.type 𝔒₁ 𝔒₂}
{smap : Smap.type _∼₁_ _∼₂_ surjection surjection}
⦃ I : IsFunctor _∼₁_ _∼̇₁_ ε₁ _↦₁_ _∼₂_ _∼̇₂_ ε₂ _↦₂_ smap ⦄
⦃ J : IsFunctor _∼₁_ _∼̇₁_ ε₁ _↦₁_ _∼₂_ _∼̇₂_ ε₂ _↦₂_ smap ⦄
→ Transextensionality.type _∼₁_ _∼̇₁_ _↦₁_
failed-test = transextensionality
test-functor-transextensionality {_∼₁_ = _∼₁_} {_∼̇₁_ = _∼̇₁_} {_↦₁_ = _↦₁_} {{I}} = transextensionality {_∼_ = λ z z₁ → z ∼₁ z₁} {_∼̇_ = λ {x} {y} → _∼̇₁_ {x} {y}} {transitivity = λ {x y z} → _↦₁_ {x} {y} {z}} {{I .IsFunctor.`IsCategory₁ .IsCategory.`IsPrecategory .IsPrecategory.`𝓣ransextensionality}} -- FIXME can this be simplified?
test-the-test {_∼₁_ = _∼₁_} {_∼̇₁_ = _∼̇₁_} {_↦₁_ = _↦₁_} = test-functor-transextensionality {_∼₁_ = _∼₁_} {_∼̇₁_ = _∼̇₁_} {_↦₁_ = _↦₁_}
|
oeis/315/A315398.asm | neoneye/loda-programs | 11 | 85264 | ; A315398: Coordination sequence Gal.5.100.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,6,11,15,19,23,27,31,36,42,48,53,57,61,65,69,73,78,84,90,95,99,103,107,111,115,120,126,132,137,141,145,149,153,157,162,168,174,179,183,187,191,195,199,204,210,216,221,225,229
mov $5,$0
mul $0,2
add $0,6
mov $3,3
mov $4,10
lpb $0
mov $2,$0
sub $2,5
add $3,6
add $4,6
trn $2,$4
add $2,$3
mov $0,$2
lpe
sub $0,6
trn $0,1
lpb $5
add $0,4
sub $5,1
lpe
add $0,1
|
ds/nw/nw16/drv/dllentry.asm | npocmaka/Windows-Server-2003 | 17 | 161271 | PAGE,132
;***************************************************************************
;*
;* DLLENTRY.ASM
;*
;* VER.DLL Entry code
;*
;* This module generates a code segment called INIT_TEXT.
;* It initializes the local heap if one exists and then calls
;* the C routine LibMain() which should have the form:
;* BOOL FAR PASCAL LibMain(HANDLE hInstance,
;* WORD wDataSeg,
;* WORD cbHeap,
;* LPSTR lpszCmdLine);
;*
;* The result of the call to LibMain is returned to Windows.
;* The C routine should return TRUE if it completes initialization
;* successfully, FALSE if some error occurs.
;*
;**************************************************************************
INCLUDE CMACROS.INC
externFP <LIBMAIN> ;The C routine to be called
ifndef SEGNAME
SEGNAME equ <_TEXT> ; default seg name
endif
createSeg %SEGNAME, CodeSeg, word, public, CODE
sBegin CodeSeg ; this defines what seg this goes in
assumes cs,CodeSeg
?PLM=0 ;'C'naming
externA <_acrtused> ;Ensures that Win DLL startup code is linked
?PLM=1 ;'PASCAL' naming
externFP <LOCALINIT> ;Windows heap init routine
cProc LibEntry, <PUBLIC,FAR> ;Entry point into DLL
cBegin
push di ;Handle of the module instance
push ds ;Library data segment
push cx ;Heap size
push es ;Command line segment
push si ;Command line offset
;** If we have some heap then initialize it
jcxz callc ;Jump if no heap specified
;** Call the Windows function LocalInit() to set up the heap
;** LocalInit((LPSTR)start, WORD cbHeap);
xor ax,ax
cCall LOCALINIT <ds, ax, cx>
or ax,ax ;Did it do it ok ?
jz error ;Quit if it failed
;** Invoke the C routine to do any special initialization
callc:
call LIBMAIN ;Invoke the 'C' routine (result in AX)
jmp short exit ;LibMain is responsible for stack clean up
error:
pop si ;Clean up stack on a LocalInit error
pop es
pop cx
pop ds
pop di
exit:
cEnd
sEnd _thisseg
END LibEntry
|
oeis/228/A228920.asm | neoneye/loda-programs | 11 | 10804 | <reponame>neoneye/loda-programs<filename>oeis/228/A228920.asm
; A228920: Number of solutions to Sum_{i=1..n} x_i^2 == 0 (mod 4) with x_i in 0..3.
; Submitted by <NAME>
; 2,4,8,32,192,1024,4608,18432,69632,262144,1015808,4063232,16515072,67108864,270532608,1082130432,4311744512,17179869184,68585259008,274341036032,1098437885952,4398046511104,17600775979008,70403103916032,281543696187392,1125899906842624,4503049871556608,18012199486226432,72053195991416832,288230376151711744,1152956688978935808,4611826755915743232,18447025548686262272,73786976294838206464,295145653379539140608,1180582613518156562432,4722348468471135731712,18889465931478580854784
mul $0,2
mov $2,1
lpb $0
sub $0,2
sub $1,$3
mul $1,2
mul $2,2
add $2,$3
add $3,$1
mul $1,4
add $1,$2
mul $3,2
lpe
mov $0,$2
mul $0,2
|
libvpxbuild/vpx_config.asm | mearaj/libvpx | 1 | 95721 | <filename>libvpxbuild/vpx_config.asm
VPX_ARCH_ARM equ 0
VPX_ARCH_MIPS equ 0
VPX_ARCH_X86 equ 0
VPX_ARCH_X86_64 equ 1
VPX_ARCH_PPC equ 0
VPX_ARCH_LOONGARCH equ 0
HAVE_NEON equ 0
HAVE_NEON_ASM equ 0
HAVE_MIPS32 equ 0
HAVE_DSPR2 equ 0
HAVE_MSA equ 0
HAVE_MIPS64 equ 0
HAVE_MMX equ 1
HAVE_SSE equ 1
HAVE_SSE2 equ 1
HAVE_SSE3 equ 1
HAVE_SSSE3 equ 1
HAVE_SSE4_1 equ 1
HAVE_AVX equ 1
HAVE_AVX2 equ 1
HAVE_AVX512 equ 1
HAVE_VSX equ 0
HAVE_MMI equ 0
HAVE_LSX equ 0
HAVE_LASX equ 0
HAVE_VPX_PORTS equ 1
HAVE_PTHREAD_H equ 1
HAVE_UNISTD_H equ 1
CONFIG_DEPENDENCY_TRACKING equ 1
CONFIG_EXTERNAL_BUILD equ 0
CONFIG_INSTALL_DOCS equ 1
CONFIG_INSTALL_BINS equ 1
CONFIG_INSTALL_LIBS equ 1
CONFIG_INSTALL_SRCS equ 0
CONFIG_DEBUG equ 0
CONFIG_GPROF equ 0
CONFIG_GCOV equ 0
CONFIG_RVCT equ 0
CONFIG_GCC equ 1
CONFIG_MSVS equ 0
CONFIG_PIC equ 0
CONFIG_BIG_ENDIAN equ 0
CONFIG_CODEC_SRCS equ 0
CONFIG_DEBUG_LIBS equ 0
CONFIG_DEQUANT_TOKENS equ 0
CONFIG_DC_RECON equ 0
CONFIG_RUNTIME_CPU_DETECT equ 1
CONFIG_POSTPROC equ 1
CONFIG_VP9_POSTPROC equ 0
CONFIG_MULTITHREAD equ 1
CONFIG_INTERNAL_STATS equ 0
CONFIG_VP8_ENCODER equ 1
CONFIG_VP8_DECODER equ 1
CONFIG_VP9_ENCODER equ 1
CONFIG_VP9_DECODER equ 1
CONFIG_VP8 equ 1
CONFIG_VP9 equ 1
CONFIG_ENCODERS equ 1
CONFIG_DECODERS equ 1
CONFIG_STATIC_MSVCRT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_REALTIME_ONLY equ 0
CONFIG_ONTHEFLY_BITPACKING equ 0
CONFIG_ERROR_CONCEALMENT equ 0
CONFIG_SHARED equ 0
CONFIG_STATIC equ 1
CONFIG_SMALL equ 0
CONFIG_POSTPROC_VISUALIZER equ 0
CONFIG_OS_SUPPORT equ 1
CONFIG_UNIT_TESTS equ 1
CONFIG_WEBM_IO equ 1
CONFIG_LIBYUV equ 1
CONFIG_DECODE_PERF_TESTS equ 0
CONFIG_ENCODE_PERF_TESTS equ 0
CONFIG_MULTI_RES_ENCODING equ 0
CONFIG_TEMPORAL_DENOISING equ 1
CONFIG_VP9_TEMPORAL_DENOISING equ 0
CONFIG_CONSISTENT_RECODE equ 0
CONFIG_COEFFICIENT_RANGE_CHECKING equ 0
CONFIG_VP9_HIGHBITDEPTH equ 0
CONFIG_BETTER_HW_COMPATIBILITY equ 0
CONFIG_EXPERIMENTAL equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_ALWAYS_ADJUST_BPM equ 0
CONFIG_BITSTREAM_DEBUG equ 0
CONFIG_MISMATCH_DEBUG equ 0
CONFIG_FP_MB_STATS equ 0
CONFIG_EMULATE_HARDWARE equ 0
CONFIG_NON_GREEDY_MV equ 0
CONFIG_RATE_CTRL equ 0
|
Agda/coinductive-types.agda | tmoux/HoTT-Intro | 0 | 4817 | {-# OPTIONS --cubical #-}
open import 17-number-theory public
{- streams -}
record stream (A : Set) : Set where
coinductive
field
hd : A
tl : stream A
open stream public
from : ℕ → stream ℕ
hd (from n) = n
tl (from n) = from (succ-ℕ n)
map-stream : {A B : Set} → (A → B) → stream A → stream B
hd (map-stream f xs) = f (hd xs)
tl (map-stream f xs) = map-stream f (tl xs)
list-stream :
{A : Set} → stream A → ℕ → list A
list-stream xs zero-ℕ = nil
list-stream xs (succ-ℕ n) = cons (hd xs) (list-stream xs n)
record ℕ∞ : Set where
coinductive
field
pred∞ : coprod ℕ∞ unit
zero-ℕ∞ : ℕ∞
pred∞ zero-ℕ∞ = {!inr star!}
|
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/BGunit_set-d.asm | prismotizm/gigaleak | 0 | 87739 | <gh_stars>0
Name: BGunit_set-d.asm
Type: file
Size: 7032
Last-Modified: '1992-07-26T15:00:00Z'
SHA-1: 3EBD837C2D4DEF45C912C4313B754186AF936F83
Description: null
|
programs/oeis/157/A157622.asm | neoneye/loda | 22 | 15250 | <gh_stars>10-100
; A157622: 31250n - 9100.
; 22150,53400,84650,115900,147150,178400,209650,240900,272150,303400,334650,365900,397150,428400,459650,490900,522150,553400,584650,615900,647150,678400,709650,740900,772150,803400,834650,865900,897150,928400,959650,990900,1022150,1053400,1084650,1115900,1147150,1178400,1209650,1240900,1272150,1303400,1334650,1365900,1397150,1428400,1459650,1490900,1522150,1553400,1584650,1615900,1647150,1678400,1709650,1740900,1772150,1803400,1834650,1865900,1897150,1928400,1959650,1990900,2022150,2053400,2084650,2115900,2147150,2178400,2209650,2240900,2272150,2303400,2334650,2365900,2397150,2428400,2459650,2490900,2522150,2553400,2584650,2615900,2647150,2678400,2709650,2740900,2772150,2803400,2834650,2865900,2897150,2928400,2959650,2990900,3022150,3053400,3084650,3115900
mul $0,31250
add $0,22150
|
src/brackelib-queues.ads | bracke/brackelib | 1 | 12293 | <filename>src/brackelib-queues.ads
with Ada.Containers.Doubly_Linked_Lists;
use Ada.Containers;
generic
type T is private;
package Brackelib.Queues is
-- @summary
-- Implementation of the queue abstract data type
type Queue is limited private;
procedure Enqueue (Self : in out Queue; Item : T);
-- Adds an item to the end of the queue.
-- @param Self The queue
-- @param Item The item to be added
function Dequeue (Self : in out Queue) return T;
-- Removes the first item off the queue and returns it.
-- @param Self The queue
-- @return Item The first item is returned
-- @exception Queue_Empty Raised if the queue is empty and thus no item can be returned.
function Size (Self : Queue) return Integer;
-- Returns the number of items in the queue.
-- @param Self The queue
-- @return Count Number of items in the queue
function Is_Empty (Self : Queue) return Boolean;
-- Returns whether the queue is empty.
-- @param Self The queue
-- @return True If the queue is empty
procedure Clear (Self : in out Queue);
-- Removes all items from the queue.
-- @param Self The queue
Queue_Empty : Exception;
private
package Queue_Container is new Doubly_Linked_Lists(T);
use Queue_Container;
type Queue is record
Container: List;
end record;
end Brackelib.Queues; |
EjemplosASMs/leeint.asm | daxadal/programing-102 | 0 | 161801 | ; Codigo ASM para TPMV
; Tecnología de la Programación - FDI (UCM)
; <NAME>
;
; Pide al usuario que teclee un número y lo escribe
; por pantalla.
;
; El código es generado por un pequeño compilador de terceros.
;
JUMP 1
PUSH 3
STORE 1
PUSH 5
STORE 0
JUMP 325
LOAD 0
PUSH 2
ADD
LOAD 2
STOREIND
LOAD 0
PUSH 3
ADD
STORE 2
LOAD 0
PUSH 4
ADD
STORE 0
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 0
eq
not
BF 70
LOAD 0
PUSH 1
ADD
PUSH 45
STOREIND
LOAD 0
PUSH 3
ADD
DUP
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 10
DIV
STOREIND
POP
JUMP 6
LOAD 2
PUSH 1
ADD
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 10
DIV
STOREIND
PUSH 48
LOAD 2
PUSH 0
ADD
LOADIND
ADD
PUSH 10
LOAD 2
PUSH 1
ADD
LOADIND
MUL
SUB
OUT
JUMP 70
LOAD 2
PUSH 2
SUB
LOADIND
LOAD 2
PUSH 3
SUB
DUP
STORE 0
PUSH 2
ADD
LOADIND
STORE 2
JUMPIND
LOAD 0
PUSH 2
ADD
LOAD 2
STOREIND
LOAD 0
PUSH 3
ADD
STORE 2
LOAD 0
PUSH 3
ADD
STORE 0
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 0
EQ
BF 109
PUSH 48
PUSH 0
ADD
OUT
JUMP 125
LOAD 0
PUSH 1
ADD
PUSH 125
STOREIND
LOAD 0
PUSH 3
ADD
DUP
LOAD 2
PUSH 0
ADD
LOADIND
STOREIND
POP
JUMP 6
LOAD 2
PUSH 2
SUB
LOADIND
LOAD 2
PUSH 3
SUB
DUP
STORE 0
PUSH 2
ADD
LOADIND
STORE 2
JUMPIND
LOAD 0
PUSH 2
ADD
LOAD 2
STOREIND
LOAD 0
PUSH 3
ADD
STORE 2
LOAD 0
PUSH 2
ADD
STORE 0
PUSH 10
OUT
PUSH 13
OUT
LOAD 2
PUSH 2
SUB
LOADIND
LOAD 2
PUSH 3
SUB
DUP
STORE 0
PUSH 2
ADD
LOADIND
STORE 2
JUMPIND
LOAD 0
PUSH 2
ADD
LOAD 2
STOREIND
LOAD 0
PUSH 3
ADD
STORE 2
LOAD 0
PUSH 3
ADD
STORE 0
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 48
LT
DUP
BT 199
POP
LOAD 2
PUSH 0
ADD
LOADIND
PUSH 59
flip
LE
BF 206
LOAD 1
PUSH 0
ADD
PUSH 0
STOREIND
JUMP 211
LOAD 1
PUSH 0
ADD
PUSH 1
STOREIND
LOAD 2
PUSH 2
SUB
LOADIND
LOAD 2
PUSH 3
SUB
DUP
STORE 0
PUSH 2
ADD
LOADIND
STORE 2
JUMPIND
LOAD 0
PUSH 2
ADD
LOAD 2
STOREIND
LOAD 0
PUSH 3
ADD
STORE 2
LOAD 0
PUSH 4
ADD
STORE 0
LOAD 1
PUSH 1
ADD
PUSH 0
STOREIND
LOAD 2
PUSH 0
ADD
IN
STOREIND
LOAD 2
PUSH 1
ADD
PUSH 0
STOREIND
LOAD 2
PUSH 1
ADD
LOADIND
NOT
BF 311
LOAD 0
PUSH 1
ADD
PUSH 275
STOREIND
LOAD 0
PUSH 3
ADD
DUP
LOAD 2
PUSH 0
ADD
LOADIND
STOREIND
POP
JUMP 170
LOAD 1
PUSH 0
ADD
LOADIND
PUSH 1
EQ
BF 305
LOAD 1
PUSH 1
ADD
PUSH 10
LOAD 1
PUSH 1
ADD
LOADIND
MUL
LOAD 2
PUSH 0
ADD
LOADIND
ADD
PUSH 48
SUB
STOREIND
LOAD 2
PUSH 0
ADD
IN
STOREIND
JUMP 310
LOAD 2
PUSH 1
ADD
PUSH 1
STOREIND
JUMP 253
LOAD 2
PUSH 2
SUB
LOADIND
LOAD 2
PUSH 3
SUB
DUP
STORE 0
PUSH 2
ADD
LOADIND
STORE 2
JUMPIND
LOAD 0
PUSH 1
ADD
PUSH 331
STOREIND
JUMP 225
LOAD 0
PUSH 1
ADD
PUSH 347
STOREIND
LOAD 0
PUSH 3
ADD
DUP
LOAD 1
PUSH 1
ADD
LOADIND
STOREIND
POP
JUMP 84
LOAD 0
PUSH 1
ADD
PUSH 353
STOREIND
JUMP 139
HALT
|
oeis/332/A332176.asm | neoneye/loda-programs | 11 | 23098 | <reponame>neoneye/loda-programs<filename>oeis/332/A332176.asm
; A332176: a(n) = 7*(10^(2n+1)-1)/9 - 10^n.
; Submitted by <NAME>
; 6,767,77677,7776777,777767777,77777677777,7777776777777,777777767777777,77777777677777777,7777777776777777777,777777777767777777777,77777777777677777777777,7777777777776777777777777,777777777777767777777777777,77777777777777677777777777777,7777777777777776777777777777777
add $0,1
mov $1,10
pow $1,$0
mul $1,7
sub $1,4
bin $1,2
mov $0,$1
sub $0,2145
div $0,315
add $0,6
|
data/animated_objects_3e_2.asm | adhi-thirumala/EvoYellow | 16 | 21539 | YellowIntro_AnimatedObjectFramesData:
dw Unkn_fa100
dw Unkn_fa103
dw Unkn_fa10a
dw Unkn_fa111
dw Unkn_fa118
dw Unkn_fa11b
dw Unkn_fa11e
dw Unkn_fa121
dw Unkn_fa124
dw Unkn_fa127
dw Unkn_fa138
Unkn_fa100:
frame $00, 32
endanim
Unkn_fa103:
frame $01, 4
frame $02, 4
frame $03, 4
dorestart
Unkn_fa10a:
frame $04, 4
frame $05, 4
frame $06, 4
dorestart
Unkn_fa111:
frame $07, 4
frame $08, 4
frame $09, 4
dorestart
Unkn_fa118:
frame $0a, 32
endanim
Unkn_fa11b:
frame $0b, 32
endanim
Unkn_fa11e:
frame $0c, 32
endanim
Unkn_fa121:
frame $0d, 32
endanim
Unkn_fa124:
frame $0e, 32
endanim
Unkn_fa127:
frame $0f, 31
frame $11, 2
frame $0f, 2
frame $11, 2
frame $0f, 31
frame $11, 2
frame $0f, 23
frame $10, 32
endanim
Unkn_fa138:
frame $12, 4
frame $13, 4
dorestart
YellowIntro_AnimatedObjectOAMData:
dbw $00, Unkn_fa179
dbw $96, Unkn_fa17e
dbw $98, Unkn_fa17e
dbw $9a, Unkn_fa17e
dbw $0c, Unkn_fa18f
dbw $0e, Unkn_fa18f
dbw $3c, Unkn_fa18f
dbw $60, Unkn_fa1b0
dbw $70, Unkn_fa1b0
dbw $80, Unkn_fa1b0
dbw $90, Unkn_fa201
dbw $00, Unkn_fa201
dbw $06, Unkn_fa201
dbw $c6, Unkn_fa292
dbw $6d, Unkn_fa2f7
dbw $f0, Unkn_fa308
dbw $f4, Unkn_fa308
dbw $f8, Unkn_fa308
dbw $9c, Unkn_fa329
dbw $ec, Unkn_fa329
Unkn_fa179:
db 1
db $fc, $fc, $00, $00
Unkn_fa17e:
db 4
db $f8, $f8, $00, $00
db $f8, $00, $01, $00
db $00, $f8, $10, $00
db $00, $00, $11, $00
Unkn_fa18f:
db 8
db $f0, $f8, $00, $00
db $f0, $00, $01, $00
db $f8, $f8, $10, $00
db $f8, $00, $11, $00
db $00, $f8, $20, $00
db $00, $00, $20, $20
db $08, $f8, $21, $00
db $08, $00, $21, $20
Unkn_fa1b0:
db 20
db $e8, $f8, $00, $00
db $e8, $00, $01, $00
db $f0, $f8, $02, $00
db $f0, $00, $03, $00
db $f8, $f0, $04, $00
db $f8, $f8, $05, $00
db $f8, $00, $06, $00
db $f8, $08, $04, $20
db $00, $f0, $07, $00
db $00, $f8, $08, $00
db $00, $00, $08, $20
db $00, $08, $07, $20
db $08, $f0, $09, $00
db $08, $f8, $0a, $00
db $08, $00, $0a, $20
db $08, $08, $09, $20
db $10, $f0, $0b, $00
db $10, $f8, $0c, $00
db $10, $00, $0c, $20
db $10, $08, $0b, $20
Unkn_fa201:
db 36
db $e8, $e8, $00, $00
db $e8, $f0, $01, $00
db $e8, $f8, $02, $00
db $e8, $00, $03, $00
db $e8, $08, $04, $00
db $e8, $10, $05, $00
db $f0, $e8, $10, $00
db $f0, $f0, $11, $00
db $f0, $f8, $12, $00
db $f0, $00, $13, $00
db $f0, $08, $14, $00
db $f0, $10, $15, $00
db $f8, $e8, $20, $00
db $f8, $f0, $21, $00
db $f8, $f8, $22, $00
db $f8, $00, $23, $00
db $f8, $08, $24, $00
db $f8, $10, $25, $00
db $00, $e8, $30, $00
db $00, $f0, $31, $00
db $00, $f8, $32, $00
db $00, $00, $33, $00
db $00, $08, $34, $00
db $00, $10, $35, $00
db $08, $e8, $40, $00
db $08, $f0, $41, $00
db $08, $f8, $42, $00
db $08, $00, $43, $00
db $08, $08, $44, $00
db $08, $10, $45, $00
db $10, $e8, $50, $00
db $10, $f0, $51, $00
db $10, $f8, $52, $00
db $10, $00, $53, $00
db $10, $08, $54, $00
db $10, $10, $55, $00
Unkn_fa292:
db 25
db $ec, $f0, $00, $00
db $ec, $f8, $01, $00
db $ec, $00, $02, $00
db $ec, $08, $03, $00
db $ec, $10, $04, $00
db $f4, $f0, $05, $00
db $f4, $f8, $06, $00
db $f4, $00, $07, $00
db $f4, $08, $08, $00
db $f4, $10, $09, $00
db $fc, $f0, $10, $00
db $fc, $f8, $11, $00
db $fc, $00, $12, $00
db $fc, $08, $13, $00
db $fc, $10, $14, $00
db $04, $f0, $15, $00
db $04, $f8, $16, $00
db $04, $00, $17, $00
db $04, $08, $18, $00
db $04, $10, $19, $00
db $0c, $f0, $20, $00
db $0c, $f8, $21, $00
db $0c, $00, $22, $00
db $0c, $08, $23, $00
db $0c, $10, $24, $00
Unkn_fa2f7:
db 4
db $fc, $f0, $00, $00
db $fc, $f8, $01, $00
db $fc, $00, $01, $20
db $fc, $08, $00, $20
Unkn_fa308:
db 8
db $f8, $e8, $00, $10
db $f8, $f0, $01, $10
db $00, $e8, $02, $10
db $00, $f0, $03, $10
db $f8, $08, $01, $30
db $f8, $10, $00, $30
db $00, $08, $03, $30
db $00, $10, $02, $30
Unkn_fa329:
db 12
db $f8, $d8, $00, $10
db $f8, $e0, $01, $10
db $f8, $e8, $02, $10
db $00, $d8, $10, $10
db $00, $e0, $11, $10
db $00, $e8, $12, $10
db $f8, $10, $02, $30
db $f8, $18, $01, $30
db $f8, $20, $00, $30
db $00, $10, $12, $30
db $00, $18, $11, $30
db $00, $20, $10, $30
|
exercises/23_recursion.asm | Catherine22/Assembly | 0 | 166650 | ;Fact (n) = n * fact (n-1) for n > 0
STDIN equ 0
STDOUT equ 1
SYS_EXIT equ 1
SYS_READ equ 3
SYS_WRITE equ 4
section .data
msg db "Factorial 3 is: ", 0xA, 0xD
len equ $- msg
section .bss
fact resb 1
section .text
global main
main:
mov bx, 3 ;for calculating factorial 3
call proc_fact
add ax, 30h
mov [fact], ax
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, msg
mov edx, len
int 0x80
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, fact
mov edx, 1
int 0x80
mov eax, SYS_EXIT
int 0x80
proc_fact:
cmp bl, 1
jg proc_calculation
mov ax, 1
ret
proc_calculation:
dec bl
call proc_fact
inc bl
mul bl ;ax = al * bl
ret |
Cubical/Foundations/Everything.agda | cj-xu/cubical | 0 | 7628 | <reponame>cj-xu/cubical
{-# OPTIONS --cubical --safe #-}
module Cubical.Foundations.Everything where
-- Basic cubical prelude
open import Cubical.Foundations.Prelude public
-- Definition of Identity types and definitions of J, funExt,
-- univalence and propositional truncation using Id instead of Path
open import Cubical.Foundations.Id
hiding ( _≡_ ; _≡⟨_⟩_ ; _∎ )
renaming ( _≃_ to EquivId
; EquivContr to EquivContrId
; J to JId
; ap to apId
; equivFun to equivFunId
; equivCtr to equivCtrId
; fiber to fiberId
; funExt to funExtId
; isContr to isContrId
; isProp to isPropId
; isSet to isSetId
; isEquiv to isEquivId
; equivIsEquiv to equivIsEquivId
; refl to reflId
; ∥_∥ to propTruncId
; ∣_∣ to incId
; isPropIsContr to isPropIsContrId
; isPropIsEquiv to isPropIsEquivId
)
open import Cubical.Foundations.GroupoidLaws public
open import Cubical.Foundations.CartesianKanOps public
open import Cubical.Foundations.Function public
open import Cubical.Foundations.Equiv public
open import Cubical.Foundations.Equiv.Properties public
open import Cubical.Foundations.PathSplitEquiv public
open import Cubical.Foundations.BiInvEquiv public
open import Cubical.Foundations.FunExtEquiv public
open import Cubical.Foundations.HLevels public
open import Cubical.Foundations.Path public
open import Cubical.Foundations.Transport public
open import Cubical.Foundations.Univalence public
open import Cubical.Foundations.UnivalenceId public
open import Cubical.Foundations.GroupoidLaws public
open import Cubical.Foundations.Isomorphism public
open import Cubical.Foundations.Logic
open import Cubical.Foundations.HoTT-UF
|
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx_tty_z88dk/zx_01_output_fzx_tty_z88dk_30_up.asm | jpoikela/z88dk | 640 | 247468 |
SECTION code_driver
SECTION code_driver_terminal_output
PUBLIC zx_01_output_fzx_tty_z88dk_30_up
EXTERN zx_01_output_fzx_proc_move_up
defc zx_01_output_fzx_tty_z88dk_30_up = zx_01_output_fzx_proc_move_up
|
Cubical/Data/Unit/Base.agda | knrafto/cubical | 0 | 16940 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Data.Unit.Base where
-- Obtain Unit
open import Agda.Builtin.Unit public
renaming ( ⊤ to Unit )
|
shellcode/guardian.asm | rxOred/emp3r0r | 728 | 166146 | <reponame>rxOred/emp3r0r
BITS 64
section .text
global _start
_start:
;; fork
xor rax, rax
xor rdi, rdi
mov al, 0x39; syscall fork
syscall
cmp rax, 0x0; check return value
jg pause; int3 if in parent
watchdog:
;; fork to exec agent
xor rax, rax
xor rdi, rdi
mov al, 0x39; syscall fork
syscall
cmp rax, 0x0; check return value
je exec; exec if in child
wait4zombie:
;; wait to clean up zombies
xor rdi, rdi
mov rdi, rax
xor rsi, rsi
xor rdx, rdx
xor r10, r10
xor rax, rax
mov al, 0x3d
syscall
sleep:
;; sleep
xor rax, rax
mov al, 0x23; syscall nanosleep
push 10; sleep nano sec
push 20; sec
mov rdi, rsp
xor rsi, rsi
xor rdx, rdx
syscall
loop watchdog
exec:
;; char **envp
xor rdx, rdx
xor rax, rax
push rdx; '\0'
;; char *filename
;[push filename here]
;; char **argv
push rdx; '\0'
push rdi
mov rsi, rsp; argv[0]
push 0x3b; syscall execve
pop rax; ready to call
cdq
syscall
pause:
;; trap
int 0x3
; exit:
; ;; exit
; xor rax, rax
; xor rdi, rdi
; xor rsi, rsi
; mov al, 0x3c; syscall exit
; mov di, 0x0; exit code
; syscall
|
programs/oeis/106/A106352.asm | jmorken/loda | 1 | 101783 | ; A106352: Number of compositions of n into 3 parts such that no two adjacent parts are equal.
; 1,2,7,9,15,21,28,35,46,54,66,78,91,104,121,135,153,171,190,209,232,252,276,300,325,350,379,405,435,465,496,527,562,594,630,666,703,740,781,819,861,903,946,989,1036,1080,1128,1176,1225,1274,1327,1377,1431
mov $3,$0
add $3,1
mov $7,$0
lpb $3
mov $0,$7
sub $3,1
sub $0,$3
mov $2,$0
gcd $2,2
mov $4,$0
add $4,$2
sub $4,2
add $4,$2
mov $5,$0
mod $5,3
add $4,$5
add $4,4
mov $6,$4
sub $6,5
add $1,$6
lpe
|
programs/oeis/031/A031994.asm | karttu/loda | 0 | 8181 | ; A031994: Duplicate of A023751.
; 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,20,21,22,23,24,25,26,30,31,32,33,34,35,40,41,42,43
mov $2,$0
mov $0,0
mov $1,$2
mov $4,$2
lpb $2,1
lpb $4,1
add $3,$1
sub $4,$3
lpe
sub $2,3
add $2,$0
add $5,1
lpb $5,1
trn $5,$3
lpe
mov $0,$5
add $1,$5
trn $2,5
mov $3,0
lpe
|
notes/FOT/FOTC/Program/Mirror/TreeR/Induction/Acc/WellFoundedInduction.agda | asr/fotc | 11 | 15909 | ------------------------------------------------------------------------------
-- Well-founded induction on the relation TreeT
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOTC.Program.Mirror.TreeR.Induction.Acc.WellFoundedInduction
where
open import FOTC.Base
open import FOT.FOTC.Program.Mirror.Induction.Acc.WellFounded
open import FOT.FOTC.Program.Mirror.TreeR
open import FOTC.Program.Mirror.Type
------------------------------------------------------------------------------
-- The relation TreeR is well-founded.
postulate wf-TreeR : WellFounded TreeR
-- Well-founded induction on the relation TreeT.
wfInd-TreeR :
(P : D → Set) →
(∀ {t} → Tree t → (∀ {t'} → Tree t' → TreeR t' t → P t') → P t) →
∀ {t} → Tree t → P t
wfInd-TreeR P = WellFoundedInduction wf-TreeR
|
templates/amd64-386/structs.asm | going-digital/sointu | 76 | 165520 | <gh_stars>10-100
;-------------------------------------------------------------------------------
; unit struct
;-------------------------------------------------------------------------------
struc su_unit
.state resd 8
.ports resd 8
.size:
endstruc
;-------------------------------------------------------------------------------
; voice struct
;-------------------------------------------------------------------------------
struc su_voice
.note resd 1
.release resd 1
.inputs resd 8
.reserved resd 6 ; this is done to so the whole voice is 2^n long, see polyphonic player
.workspace resb 63 * su_unit.size
.size:
endstruc
;-------------------------------------------------------------------------------
; synthworkspace struct
;-------------------------------------------------------------------------------
struc su_synthworkspace
.curvoices resb 32 ; these are used by the multitrack player to store which voice is playing on which track
.left resd 1
.right resd 1
.aux resd 6 ; 3 auxiliary signals
.voices resb 32 * su_voice.size
.size:
endstruc
;-------------------------------------------------------------------------------
; su_delayline_wrk struct
;-------------------------------------------------------------------------------
struc su_delayline_wrk
.dcin resd 1
.dcout resd 1
.filtstate resd 1
.buffer resd 65536
.size:
endstruc
;-------------------------------------------------------------------------------
; su_sample_offset struct
;-------------------------------------------------------------------------------
struc su_sample_offset ; length conveniently 8 bytes, so easy to index
.start resd 1
.loopstart resw 1
.looplength resw 1
.size:
endstruc |
programs/oeis/017/A017199.asm | neoneye/loda | 22 | 2133 | ; A017199: a(n) = (9*n + 3)^3.
; 27,1728,9261,27000,59319,110592,185193,287496,421875,592704,804357,1061208,1367631,1728000,2146689,2628072,3176523,3796416,4492125,5268024,6128487,7077888,8120601,9261000,10503459,11852352,13312053,14886936,16581375,18399744,20346417,22425768,24642171,27000000,29503629,32157432,34965783,37933056,41063625,44361864,47832147,51478848,55306341,59319000,63521199,67917312,72511713,77308776,82312875,87528384,92959677,98611128,104487111,110592000,116930169,123505992,130323843,137388096,144703125,152273304,160103007,168196608,176558481,185193000,194104539,203297472,212776173,222545016,232608375,242970624,253636137,264609288,275894451,287496000,299418309,311665752,324242703,337153536,350402625,363994344,377933067,392223168,406869021,421875000,437245479,452984832,469097433,485587656,502459875,519718464,537367797,555412248,573856191,592704000,611960049,631628712,651714363,672221376,693154125,714516984
mul $0,9
add $0,3
pow $0,3
|
src/hestia-ports.adb | stcarrez/hestia | 2 | 11212 | -----------------------------------------------------------------------
-- hestia-ports -- Heat port control
-- Copyright (C) 2017, 2018 <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.
-----------------------------------------------------------------------
package body Hestia.Ports is
All_Zones : constant STM32.GPIO.GPIO_Points
:= (Zone1_Control, Zone2_Control, Zone3_Control, Zone4_Control, Zone5_Control, Zone6_Control);
Zones : Zone_Control_Array
:= (1 => (Mode => H_CONFORT,
Pos_Control => STM32.Device.PB4,
Neg_Control => STM32.Device.PA8),
2 => (Mode => H_CONFORT,
Pos_Control => STM32.Device.PH6,
Neg_Control => STM32.Device.PA15),
3 => (Mode => H_CONFORT,
Pos_Control => STM32.Device.PI0,
Neg_Control => STM32.Device.PB15));
-- ------------------------------
-- Set the zone.
-- ------------------------------
procedure Set_Zone (Zone : in Zone_Type;
Mode : in Control_Type) is
begin
Zones (Zone).Mode := Mode;
case Mode is
when H_CONFORT =>
Zones (Zone).Pos_Control.Clear;
Zones (Zone).Neg_Control.Clear;
when H_ECO =>
Zones (Zone).Pos_Control.Set;
Zones (Zone).Neg_Control.Set;
when H_HORS_GEL =>
Zones (Zone).Pos_Control.Clear;
Zones (Zone).Neg_Control.Set;
when H_STOPPED =>
Zones (Zone).Pos_Control.Set;
Zones (Zone).Neg_Control.Clear;
when others =>
null;
end case;
end Set_Zone;
-- ------------------------------
-- Initialize the heat control ports.
-- ------------------------------
procedure Initialize is
Configuration : STM32.GPIO.GPIO_Port_Configuration
:= (Mode => STM32.GPIO.Mode_Out,
Output_Type => STM32.GPIO.Push_Pull,
Speed => STM32.GPIO.Speed_100MHz,
Resistors => STM32.GPIO.Floating);
begin
STM32.Device.Enable_Clock (All_Zones);
STM32.GPIO.Configure_IO (All_Zones, Configuration);
end Initialize;
end Hestia.Ports;
|
ruby-antlr-hash-2-json/raw/Vec.g4 | msangel/playground | 0 | 270 | // antlr4 Vec.g4
// javac -cp ".:$(realpath ~/soft/antlr4/antlr-4.7.2-complete.jar):$CLASSPATH" Vec*.java
// grun Vec vec4
grammar Vec;
vec4: '[' ints[4] ']' ;
ints[int max]
locals [int i=1]
: INT ( ',' {$i++;} {$i<=$max}? INT )*
;
INT : [0-9]+ ;
WS : [ \t\r\n]+ -> skip ;
|
libsrc/osca/check_volume_format.asm | grancier/z180 | 0 | 165068 | ;
; Old School Computer Architecture - interfacing FLOS
; <NAME>, 2011
;
; $Id: check_volume_format.asm,v 1.3 2016/06/22 22:13:09 dom Exp $
;
INCLUDE "flos.def"
SECTION code_clib
PUBLIC check_volume_format
PUBLIC _check_volume_format
EXTERN flos_err
check_volume_format:
_check_volume_format:
call kjt_check_volume_format
jp flos_err
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_21829_1179.asm | ljhsiun2/medusa | 9 | 80960 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x9d1c, %rdi
nop
nop
nop
sub %r14, %r14
mov (%rdi), %r11
inc %r13
lea addresses_WT_ht+0x779c, %rsi
lea addresses_UC_ht+0x15714, %rdi
clflush (%rsi)
clflush (%rdi)
nop
cmp %r9, %r9
mov $3, %rcx
rep movsb
nop
nop
nop
nop
sub $120, %r14
lea addresses_WC_ht+0x1cc9c, %rsi
lea addresses_D_ht+0x13c9c, %rdi
nop
nop
cmp $37979, %r10
mov $115, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $57735, %rdi
lea addresses_D_ht+0x1585c, %r14
nop
nop
nop
nop
nop
mfence
mov (%r14), %r9w
xor %r13, %r13
lea addresses_UC_ht+0x1ae80, %rdi
nop
nop
dec %rcx
mov (%rdi), %r10
nop
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x1859c, %rsi
lea addresses_normal_ht+0x5084, %rdi
sub %r10, %r10
mov $9, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $54062, %r14
lea addresses_A_ht+0x1cd9c, %r14
clflush (%r14)
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, (%r14)
nop
nop
and $7209, %rsi
lea addresses_UC_ht+0x191e6, %rsi
lea addresses_D_ht+0x7d9c, %rdi
nop
nop
nop
nop
and $35886, %r11
mov $9, %rcx
rep movsb
nop
xor %r14, %r14
lea addresses_WC_ht+0x1868e, %rsi
lea addresses_D_ht+0x62ac, %rdi
nop
nop
nop
nop
nop
sub %r11, %r11
mov $81, %rcx
rep movsb
nop
mfence
lea addresses_D_ht+0x11d9c, %rsi
nop
nop
nop
nop
cmp %r14, %r14
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm0
vpextrq $1, %xmm0, %r10
nop
nop
nop
nop
cmp $18178, %r14
lea addresses_normal_ht+0xc99c, %rcx
nop
nop
nop
add $4301, %r13
mov $0x6162636465666768, %rsi
movq %rsi, (%rcx)
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0x6d0, %rsi
lea addresses_WT_ht+0x18adc, %rdi
nop
and %r14, %r14
mov $55, %rcx
rep movsq
nop
nop
nop
nop
add %r13, %r13
lea addresses_D_ht+0xf59c, %r14
xor $47432, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
nop
nop
cmp %r10, %r10
lea addresses_WC_ht+0x2c9c, %r10
xor %r14, %r14
movb (%r10), %r13b
cmp %r9, %r9
lea addresses_UC_ht+0x15138, %r14
nop
nop
nop
add %r10, %r10
vmovups (%r14), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %rdi
nop
nop
nop
cmp %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %r9
push %rax
push %rbp
push %rdi
// Store
lea addresses_WC+0x2a1c, %r9
nop
nop
nop
nop
sub %rdi, %rdi
mov $0x5152535455565758, %rax
movq %rax, (%r9)
nop
nop
nop
sub %r15, %r15
// Faulty Load
lea addresses_US+0x1e59c, %r14
nop
nop
nop
nop
cmp %r8, %r8
mov (%r14), %rbp
lea oracles, %rax
and $0xff, %rbp
shlq $12, %rbp
mov (%rax,%rbp,1), %rbp
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': True, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'src': {'NT': True, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'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
*/
|
source/math.asm | evanbowman/Red | 5 | 168791 | ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;;
;;; ASM Source code for Red GBC, by <NAME>, 2021
;;;
;;;
;;; The following licence covers the source code included in this file. The
;;; game's characters and artwork belong to <NAME>, and should not be used
;;; without permission.
;;;
;;;
;;; 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.
;;;
;;; 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.
;;;
;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;; Used for indexing into our world map. The map is 18 blocks wide and 16
;;; blocks tall. We assume here that inputs are less than 16. This code will
;;; not work correctly if you pass a y value greater than 15.
l16Mul18Fast:
;;; c - y value less than 16
;;; result in hl
;;; trashes b
ld h, 0
ld b, 0
;;; swap (aka left-shift by four for the x16 multiplication)
ld a, c
swap a
ld l, a
;;; Then, add twice, to reach x18
add hl, bc
add hl, bc
ret
|
examples/windController/agdaProof/AbstractRationals.agda | vehicle-lang/vehicle | 9 | 13691 |
module AbstractRationals where
open import Algebra
open import Data.Integer.Base using (+0)
open import Data.Maybe.Base using (just; nothing; decToMaybe)
open import Data.Rational.Base as ℚ public hiding (_+_; _*_; _-_)
open import Data.Rational.Properties as ℚ public
using (module ≤-Reasoning; <⇒≤)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality
open import Function.Base
open import Data.Product using (_×_; _,_)
open import Tactic.RingSolver.Core.AlmostCommutativeRing
open import Tactic.RingSolver.NonReflective (fromCommutativeRing ℚ.+-*-commutativeRing (λ x → decToMaybe (0ℚ ℚ.≟ x)))
open import RationalUtils as ℚ public using (2ℚ; 3ℚ)
infixl 7 _*_
infixl 6 _+_ _-_
abstract
_+_ : ℚ → ℚ → ℚ
_+_ = ℚ._+_
_*_ : ℚ → ℚ → ℚ
_*_ = ℚ._*_
_-_ : ℚ → ℚ → ℚ
_-_ = ℚ._-_
+-eq : _+_ ≡ ℚ._+_
+-eq = refl
*-eq : _*_ ≡ ℚ._*_
*-eq = refl
neg-eq : _-_ ≡ ℚ._-_
neg-eq = refl
p+q-p≡q : ∀ p q → p + q - p ≡ q
p+q-p≡q = ℚ.p+q-p≡q
p+q-q≡p : ∀ p q → p + q - q ≡ p
p+q-q≡p = ℚ.p+q-q≡p
p-q+q≡p : ∀ p q → p - q + q ≡ p
p-q+q≡p = ℚ.p-q+q≡p
p-[p+q]≡q : ∀ p q → p - (p + q) ≡ q
p-[p+q]≡q = ℚ.p-[p+q]≡q
∣p-q∣≤∣p∣+∣q∣ : ∀ p q → ∣ p - q ∣ ≤ ∣ p ∣ + ∣ q ∣
∣p-q∣≤∣p∣+∣q∣ = ℚ.∣p-q∣≤∣p∣+∣q∣
∣p∣≤q⇒-q≤p≤q : ∀ p {q} → ∣ p ∣ ≤ q → - q ≤ p × p ≤ q
∣p∣≤q⇒-q≤p≤q p = ℚ.∣p∣≤q⇒-q≤p≤q p
-p<q<p⇒∣q∣<p : ∀ {p q} → - p < q → q < p → ∣ q ∣ < p
-p<q<p⇒∣q∣<p = ℚ.-p<q<p⇒∣q∣<p
2*p≡p+p : ∀ p → 2ℚ * p ≡ p + p
2*p≡p+p = ℚ.2*p≡p+p
+-assoc : Associative _≡_ _+_
+-assoc = ℚ.+-assoc
+-monoˡ-≤ : ∀ r → (_+ r) Preserves _≤_ ⟶ _≤_
+-monoˡ-≤ = ℚ.+-monoˡ-≤
+-monoʳ-≤ : ∀ r → (_+_ r) Preserves _≤_ ⟶ _≤_
+-monoʳ-≤ = ℚ.+-monoʳ-≤
+-mono-≤ : _+_ Preserves₂ _≤_ ⟶ _≤_ ⟶ _≤_
+-mono-≤ = ℚ.+-mono-≤
*-monoʳ-≤ : ∀ r → Positive r → (r *_) Preserves _≤_ ⟶ _≤_
*-monoʳ-≤ = ℚ.*-monoʳ-≤
∣p+q∣≤∣p∣+∣q∣ : ∀ p q → ∣ p + q ∣ ≤ ∣ p ∣ + ∣ q ∣
∣p+q∣≤∣p∣+∣q∣ = ℚ.∣p+q∣≤∣p∣+∣q∣
∣p*q∣≡∣p∣*∣q∣ : ∀ p q → ∣ p * q ∣ ≡ ∣ p ∣ * ∣ q ∣
∣p*q∣≡∣p∣*∣q∣ = ℚ.∣p*q∣≡∣p∣*∣q∣
p<r-q⇒p+q<r : ∀ p q r → p < r - q → p + q < r
p<r-q⇒p+q<r = ℚ.p<r-q⇒p+q<r
2p+p≡3p : ∀ p → 2ℚ * p + p ≡ 3ℚ * p
2p+p≡3p p = begin-equality
2ℚ * p + p ≡⟨ cong (2ℚ * p +_) (sym (ℚ.*-identityˡ p)) ⟩
2ℚ * p + 1ℚ * p ≡⟨ sym (ℚ.*-distribʳ-+ p 2ℚ 1ℚ) ⟩
(2ℚ + 1ℚ) * p ∎
where open ≤-Reasoning
lem1 : ∀ a b c d e f g → a + (b + c) + d + (e + f + f - g) - (e + f + f - g) ≡
c + (a + f + (e + b + d + f)) - g - (f + f + (e - g))
lem1 = solve 7 (λ a b c d e f g → (a ⊕ (b ⊕ c) ⊕ d ⊕ (e ⊕ f ⊕ f ⊕ (⊝ g)) ⊕ (⊝ (e ⊕ f ⊕ f ⊕ (⊝ g))) ,
c ⊕ (a ⊕ f ⊕ (e ⊕ b ⊕ d ⊕ f)) ⊕ (⊝ g) ⊕ (⊝ (f ⊕ f ⊕ (e ⊕ (⊝ g)))))) refl
|
mpmclab/week 1/apj4.asm | apurvjain9999/Microprocessor-8085 | 0 | 11679 | <gh_stars>0
LDA 5000H
MOV B,A
LDA 5002H
;ADD B
STA 5004H
LDA 5001H
MOV C,A
LDA 5003H
ADC C
;STA 5005H
hlt |
programs/oeis/040/A040387.asm | jmorken/loda | 1 | 29424 | ; A040387: Continued fraction for sqrt(408).
; 20,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40,5,40
pow $0,4
mov $1,$0
trn $0,4
sub $0,4
gcd $1,$0
mul $1,5
|
oeis/157/A157881.asm | neoneye/loda-programs | 11 | 179260 | ; A157881: Expansion of 152*x^2 / (-x^3+1443*x^2-1443*x+1).
; Submitted by <NAME>
; 0,152,219336,316282512,456079163120,657665836936680,948353680783529592,1367525350024012735136,1971970606380945580536672,2843580246875973503121146040,4100440744024547410555112053160,5912832709303150490046968459510832,8526300666374398982100317963502566736,12294919648079174029038168456402241722632,17729265606229502575474056813814069061468760,25565588709263294634659560887351431184396229440,36865561189492064633676511325503949953830301383872,53160113669658847938466894671815808481992110199314136
mov $3,1
lpb $0
sub $0,1
mov $1,$3
mul $1,18
add $2,$1
add $2,$1
add $3,$2
lpe
pow $3,2
mov $0,$3
div $0,9
|
src/glfw/v3/glfw-api.ads | Roldak/OpenGLAda | 0 | 17558 | -- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with Interfaces.C.Strings;
with Interfaces.C.Pointers;
with System;
with Glfw.Input.Keys;
with Glfw.Input.Mouse;
with Glfw.Input.Joysticks;
with Glfw.Monitors;
with Glfw.Errors;
with Glfw.Enums;
with Glfw.Windows.Context;
private package Glfw.API is
-----------------------------------------------------------------------------
-- Types
-----------------------------------------------------------------------------
type Address_List is array (Positive range <>) of aliased System.Address;
pragma Convention (C, Address_List);
package Address_List_Pointers is new Interfaces.C.Pointers
(Positive, System.Address, Address_List, System.Null_Address);
package VMode_List_Pointers is new Interfaces.C.Pointers
(Positive, Monitors.Video_Mode, Monitors.Video_Mode_List, (others => 0));
package Axis_Position_List_Pointers is new Interfaces.C.Pointers
(Positive, Input.Joysticks.Axis_Position, Input.Joysticks.Axis_Positions,
0.0);
package Joystick_Button_State_List_Pointers is new Interfaces.C.Pointers
(Positive, Input.Joysticks.Joystick_Button_State,
Input.Joysticks.Joystick_Button_States, Input.Joysticks.Released);
type Unsigned_Short_List is array (Positive range <>) of aliased
Interfaces.C.unsigned_short;
package Unsigned_Short_List_Pointers is new Interfaces.C.Pointers
(Positive, Interfaces.C.unsigned_short, Unsigned_Short_List, 0);
type Raw_Gamma_Ramp is record
Red, Green, Blue : Unsigned_Short_List_Pointers.Pointer;
Size : Interfaces.C.unsigned;
end record;
pragma Convention (C, Raw_Gamma_Ramp);
-----------------------------------------------------------------------------
-- Callbacks
-----------------------------------------------------------------------------
type Error_Callback is access procedure (Code : Errors.Kind;
Description : C.Strings.chars_ptr);
type Window_Position_Callback is access procedure
(Window : System.Address; X, Y : C.int);
type Window_Size_Callback is access procedure
(Window : System.Address; Width, Height : C.int);
type Window_Close_Callback is access procedure
(Window : System.Address);
type Window_Refresh_Callback is access procedure
(Window : System.Address);
type Window_Focus_Callback is access procedure
(Window : System.Address; Focussed : Bool);
type Window_Iconify_Callback is access procedure
(Window : System.Address; Iconified : Bool);
type Framebuffer_Size_Callback is access procedure
(Window : System.Address; Width, Height : C.int);
type Mouse_Button_Callback is access procedure (Window : System.Address;
Button : Input.Mouse.Button;
State : Input.Button_State;
Mods : Input.Keys.Modifiers);
type Cursor_Position_Callback is access procedure
(Window : System.Address; X, Y : Input.Mouse.Coordinate);
type Cursor_Enter_Callback is access procedure
(Window : System.Address; Action : Input.Mouse.Enter_Action);
type Scroll_Callback is access procedure
(Window : System.Address; X, Y : Input.Mouse.Scroll_Offset);
type Key_Callback is access procedure (Window : System.Address;
Key : Input.Keys.Key;
Scancode : Input.Keys.Scancode;
Action : Input.Keys.Action;
Mods : Input.Keys.Modifiers);
type Character_Callback is access procedure
(Window : System.Address; Unicode_Char : Interfaces.C.unsigned);
type Monitor_Callback is access procedure
(Monitor : System.Address; Event : Monitors.Event);
pragma Convention (C, Error_Callback);
pragma Convention (C, Window_Position_Callback);
pragma Convention (C, Window_Size_Callback);
pragma Convention (C, Window_Close_Callback);
pragma Convention (C, Window_Refresh_Callback);
pragma Convention (C, Window_Focus_Callback);
pragma Convention (C, Window_Iconify_Callback);
pragma Convention (C, Framebuffer_Size_Callback);
pragma Convention (C, Mouse_Button_Callback);
pragma Convention (C, Cursor_Position_Callback);
pragma Convention (C, Cursor_Enter_Callback);
pragma Convention (C, Scroll_Callback);
pragma Convention (C, Key_Callback);
pragma Convention (C, Character_Callback);
pragma Convention (C, Monitor_Callback);
-----------------------------------------------------------------------------
-- Basics
-----------------------------------------------------------------------------
function Init return C.int;
pragma Import (Convention => C, Entity => Init,
External_Name => "glfwInit");
procedure Glfw_Terminate;
pragma Import (Convention => C, Entity => Glfw_Terminate,
External_Name => "glfwTerminate");
procedure Get_Version (Major, Minor, Revision : out C.int);
pragma Import (Convention => C, Entity => Get_Version,
External_Name => "glfwGetVersion");
function Get_Version_String return C.Strings.chars_ptr;
pragma Import (Convention => C, Entity => Get_Version_String,
External_Name => "glfwGetVersionString");
function Get_Time return C.double;
pragma Import (Convention => C, Entity => Get_Time,
External_Name => "glfwGetTime");
procedure Set_Time (Value : C.double);
pragma Import (Convention => C, Entity => Set_Time,
External_Name => "glfwSetTime");
procedure Sleep (Time : C.double);
pragma Import (Convention => C, Entity => Sleep,
External_Name => "glfwSleep");
function Extension_Supported (Name : C.char_array) return Bool;
pragma Import (Convention => C, Entity => Extension_Supported,
External_Name => "glfwExtensionSupported");
function Set_Error_Callback (CB_Fun : Error_Callback) return Error_Callback;
pragma Import (Convention => C, Entity => Set_Error_Callback,
External_Name => "glfwSetErrorCallback");
-----------------------------------------------------------------------------
-- Monitors
-----------------------------------------------------------------------------
function Get_Monitors (Count : access Interfaces.C.int)
return Address_List_Pointers.Pointer;
pragma Import (Convention => C, Entity => Get_Monitors,
External_Name => "glfwGetMonitors");
function Get_Primary_Monitor return System.Address;
pragma Import (Convention => C, Entity => Get_Primary_Monitor,
External_Name => "glfwGetPrimaryMonitor");
procedure Get_Monitor_Pos (Monitor : System.Address;
XPos, YPos : out Interfaces.C.int);
pragma Import (Convention => C, Entity => Get_Monitor_Pos,
External_Name => "glfwGetMonitorPos");
procedure Get_Monitor_Physical_Size (Monitor : System.Address;
Width, Height : out Interfaces.C.int);
pragma Import (Convention => C, Entity => Get_Monitor_Physical_Size,
External_Name => "glfwGetMonitorPhysicalSize");
function Get_Monitor_Name (Monitor : System.Address)
return Interfaces.C.Strings.chars_ptr;
pragma Import (Convention => C, Entity => Get_Monitor_Name,
External_Name => "glfwGetMonitorName");
function Set_Monitor_Callback (Monitor : System.Address;
CB_Fun : Monitor_Callback)
return Monitor_Callback;
pragma Import (Convention => C, Entity => Set_Monitor_Callback,
External_Name => "glfwSetMonitorCallback");
function Get_Video_Modes (Monitor : System.Address;
Count : access Interfaces.C.int)
return VMode_List_Pointers.Pointer;
pragma Import (Convention => C, Entity => Get_Video_Modes,
External_Name => "glfwGetVideoModes");
function Get_Video_Mode (Monitor : System.Address)
return access constant Monitors.Video_Mode;
pragma Import (Convention => C, Entity => Get_Video_Mode,
External_Name => "glfwGetVideoMode");
procedure Set_Gamma (Monitor : System.Address; Gamma : Interfaces.C.C_float);
pragma Import (Convention => C, Entity => Set_Gamma,
External_Name => "glfwSetGamma");
function Get_Gamma_Ramp (Monitor : System.Address)
return access constant Raw_Gamma_Ramp;
pragma Import (Convention => C, Entity => Get_Gamma_Ramp,
External_Name => "glfwGetGammaRamp");
procedure Set_Gamma_Ramp (Monitor : System.Address;
Value : access constant Raw_Gamma_Ramp);
pragma Import (Convention => C, Entity => Set_Gamma_Ramp,
External_Name => "glfwSetGammaRamp");
-----------------------------------------------------------------------------
-- Windows
-----------------------------------------------------------------------------
procedure Default_Window_Hints;
pragma Import (Convention => C, Entity => Default_Window_Hints,
External_Name => "glfwDefaultWindowHints");
procedure Window_Hint (Target : Glfw.Enums.Window_Hint; Info : C.int);
procedure Window_Hint (Target : Glfw.Enums.Window_Hint; Info : Bool);
procedure Window_Hint (Target : Glfw.Enums.Window_Hint;
Info : Windows.Context.OpenGL_Profile_Kind);
procedure Window_Hint (Target : Glfw.Enums.Window_Hint;
Info : Windows.Context.API_Kind);
procedure Window_Hint (Target : Glfw.Enums.Window_Hint;
Info : Glfw.Windows.Context.Robustness_Kind);
pragma Import (Convention => C, Entity => Window_Hint,
External_Name => "glfwWindowHint");
function Create_Window (Width, Height : Interfaces.C.int;
Title : Interfaces.C.char_array;
Monitor : System.Address;
Share : System.Address)
return System.Address;
pragma Import (Convention => C, Entity => Create_Window,
External_Name => "glfwCreateWindow");
procedure Destroy_Window (Window : System.Address);
pragma Import (Convention => C, Entity => Destroy_Window,
External_Name => "glfwDestroyWindow");
function Window_Should_Close (Window : System.Address)
return Bool;
pragma Import (Convention => C, Entity => Window_Should_Close,
External_Name => "glfwWindowShouldClose");
procedure Set_Window_Should_Close (Window : System.Address;
Value : Bool);
pragma Import (Convention => C, Entity => Set_Window_Should_Close,
External_Name => "glfwSetWindowShouldClose");
procedure Set_Window_Title (Window : System.Address;
Title : Interfaces.C.char_array);
pragma Import (Convention => C, Entity => Set_Window_Title,
External_Name => "glfwSetWindowTitle");
procedure Get_Window_Pos (Window : System.Address;
Xpos, Ypos : out Windows.Coordinate);
pragma Import (Convention => C, Entity => Get_Window_Pos,
External_Name => "glfwGetWindowPos");
procedure Set_Window_Pos (Window : System.Address;
Xpos, Ypos : Windows.Coordinate);
pragma Import (Convention => C, Entity => Set_Window_Pos,
External_Name => "glfwSetWindowPos");
procedure Get_Window_Size (Window : System.Address;
Width, Height : out Size);
pragma Import (Convention => C, Entity => Get_Window_Size,
External_Name => "glfwGetWindowSize");
procedure Set_Window_Size (Window : System.Address;
Width, Height : Size);
pragma Import (Convention => C, Entity => Set_Window_Size,
External_Name => "glfwSetWindowSize");
procedure Get_Framebuffer_Size (Window : System.Address;
Width, Height : out Size);
pragma Import (Convention => C, Entity => Get_Framebuffer_Size,
External_Name => "glfwGetFramebufferSize");
procedure Iconify_Window (Window : System.Address);
pragma Import (Convention => C, Entity => Iconify_Window,
External_Name => "glfwIconifyWindow");
procedure Restore_Window (Window : System.Address);
pragma Import (Convention => C, Entity => Restore_Window,
External_Name => "glfwRestoreWindow");
procedure Show_Window (Window : System.Address);
pragma Import (Convention => C, Entity => Show_Window,
External_Name => "glfwShowWindow");
procedure Hide_Window (Window : System.Address);
pragma Import (Convention => C, Entity => Hide_Window,
External_Name => "glfwHideWindow");
function Get_Window_Monitor (Window : System.Address) return System.Address;
pragma Import (Convention => C, Entity => Get_Window_Monitor,
External_Name => "glfwGetWindowMonitor");
function Get_Window_Attrib (Window : System.Address;
Attrib : Enums.Window_Info) return C.int;
function Get_Window_Attrib (Window : System.Address;
Attrib : Enums.Window_Info) return Bool;
function Get_Window_Attrib (Window : System.Address;
Attrib : Enums.Window_Info)
return Windows.Context.API_Kind;
function Get_Window_Attrib (Window : System.Address;
Attrib : Enums.Window_Info)
return Windows.Context.OpenGL_Profile_Kind;
function Get_Window_Attrib (Window : System.Address;
Attrib : Enums.Window_Info)
return Windows.Context.Robustness_Kind;
pragma Import (Convention => C, Entity => Get_Window_Attrib,
External_Name => "glfwGetWindowAttrib");
procedure Set_Window_User_Pointer (Window : System.Address;
Pointer : System.Address);
pragma Import (Convention => C, Entity => Set_Window_User_Pointer,
External_Name => "glfwSetWindowUserPointer");
function Get_Window_User_Pointer (Window : System.Address)
return System.Address;
pragma Import (Convention => C, Entity => Get_Window_User_Pointer,
External_Name => "glfwGetWindowUserPointer");
-- The callback setters in the C header are defined as returning the
-- previous callback pointer. This is rather low-level and not applicable
-- in the object-oriented interface of this binding. So we define the setters
-- as procedures, the return value will just get thrown away.
procedure Set_Window_Pos_Callback (Window : System.Address;
CB_Fun : Window_Position_Callback);
--return Window_Position_Callback;
pragma Import (Convention => C, Entity => Set_Window_Pos_Callback,
External_Name => "glfwSetWindowPosCallback");
procedure Set_Window_Size_Callback (Window : System.Address;
CB_Fun : Window_Size_Callback);
--return Window_Size_Callback;
pragma Import (Convention => C, Entity => Set_Window_Size_Callback,
External_Name => "glfwSetWindowSizeCallback");
procedure Set_Window_Close_Callback (Window : System.Address;
CB_Fun : Window_Close_Callback);
--return Window_Close_Callback;
pragma Import (Convention => C, Entity => Set_Window_Close_Callback,
External_Name => "glfwSetWindowCloseCallback");
procedure Set_Window_Refresh_Callback (Window : System.Address;
CB_Fun : Window_Refresh_Callback);
--return Window_Refresh_Callback;
pragma Import (Convention => C, Entity => Set_Window_Refresh_Callback,
External_Name => "glfwSetWindowRefreshCallback");
procedure Set_Window_Focus_Callback (Window : System.Address;
CB_Fun : Window_Focus_Callback);
--return Window_Focus_Callback;
pragma Import (Convention => C, Entity => Set_Window_Focus_Callback,
External_Name => "glfwSetWindowFocusCallback");
procedure Set_Window_Iconify_Callback (Window : System.Address;
CB_Fun : Window_Iconify_Callback);
--return Window_Iconify_Callback;
pragma Import (Convention => C, Entity => Set_Window_Iconify_Callback,
External_Name => "glfwSetWindowIconifyCallback");
procedure Set_Framebuffer_Size_Callback (Window : System.Address;
CB_Fun : Framebuffer_Size_Callback);
--return Framebuffer_Size_Callback;
pragma Import (Convention => C, Entity => Set_Framebuffer_Size_Callback,
External_Name => "glfwSetFramebufferSizeCallback");
-----------------------------------------------------------------------------
-- Input
-----------------------------------------------------------------------------
function Get_Input_Mode (Window : System.Address;
Mode : Enums.Input_Toggle) return Bool;
function Get_Input_Mode (Window : System.Address;
Mode : Enums.Input_Toggle)
return Input.Mouse.Cursor_Mode;
pragma Import (Convention => C, Entity => Get_Input_Mode,
External_Name => "glfwGetInputMode");
procedure Set_Input_Mode (Window : System.Address;
Mode : Input.Sticky_Toggle;
Value : Bool);
procedure Set_Input_Mode (Window : System.Address;
Mode : Enums.Input_Toggle;
Value : Input.Mouse.Cursor_Mode);
pragma Import (Convention => C, Entity => Set_Input_Mode,
External_Name => "glfwSetInputMode");
function Get_Key (Window : System.Address; Key : Input.Keys.Key)
return Input.Button_State;
pragma Import (Convention => C, Entity => Get_Key,
External_Name => "glfwGetKey");
function Get_Mouse_Button (Window : System.Address;
Button : Input.Mouse.Button)
return Input.Button_State;
pragma Import (Convention => C, Entity => Get_Mouse_Button,
External_Name => "glfwGetMouseButton");
procedure Get_Cursor_Pos (Window : System.Address;
Xpos, Ypos : out Input.Mouse.Coordinate);
pragma Import (Convention => C, Entity => Get_Cursor_Pos,
External_Name => "glfwGetCursorPos");
procedure Set_Cursor_Pos (Window : System.Address;
Xpos, Ypos : Input.Mouse.Coordinate);
pragma Import (Convention => C, Entity => Set_Cursor_Pos,
External_Name => "glfwSetCursorPos");
procedure Set_Key_Callback (Window : System.Address;
CB_Fun : Key_Callback);
--return Key_Callback
pragma Import (Convention => C, Entity => Set_Key_Callback,
External_Name => "glfwSetKeyCallback");
procedure Set_Char_Callback (Window : System.Address;
CB_Fun : Character_Callback);
--return Character_Callback;
pragma Import (Convention => C, Entity => Set_Char_Callback,
External_Name => "glfwSetCharCallback");
procedure Set_Mouse_Button_Callback (Window : System.Address;
CB_Fun : Mouse_Button_Callback);
--return Mouse_Button_Callback;
pragma Import (Convention => C, Entity => Set_Mouse_Button_Callback,
External_Name => "glfwSetMouseButtonCallback");
procedure Set_Cursor_Pos_Callback (Window : System.Address;
CB_Fun : Cursor_Position_Callback);
--return Cursor_Position_Callback;
pragma Import (Convention => C, Entity => Set_Cursor_Pos_Callback,
External_Name => "glfwSetCursorPosCallback");
procedure Set_Cursor_Enter_Callback (Window : System.Address;
CB_Fun : Cursor_Enter_Callback);
--return Cursor_Enter_Callback;
pragma Import (Convention => C, Entity => Set_Cursor_Enter_Callback,
External_Name => "glfwSetCursorEnterCallback");
procedure Set_Scroll_Callback (Window : System.Address;
CB_Fun : Scroll_Callback);
--return Scroll_Callback;
pragma Import (Convention => C, Entity => Set_Scroll_Callback,
External_Name => "glfwSetScrollCallback");
function Joystick_Present (Joy : Enums.Joystick_ID) return Bool;
pragma Import (Convention => C, Entity => Joystick_Present,
External_Name => "glfwJoystickPresent");
function Get_Joystick_Axes (Joy : Enums.Joystick_ID;
Count : access Interfaces.C.int)
return Axis_Position_List_Pointers.Pointer;
pragma Import (Convention => C, Entity => Get_Joystick_Axes,
External_Name => "glfwGetJoystickAxes");
function Get_Joystick_Buttons (Joy : Enums.Joystick_ID;
Count : access Interfaces.C.int)
return Joystick_Button_State_List_Pointers.Pointer;
pragma Import (Convention => C, Entity => Get_Joystick_Buttons,
External_Name => "glfwGetJoystickButtons");
function Get_Joystick_Name (Joy : Enums.Joystick_ID)
return Interfaces.C.Strings.chars_ptr;
pragma Import (Convention => C, Entity => Get_Joystick_Name,
External_Name => "glfwGetJoystickName");
procedure Poll_Events;
pragma Import (Convention => C, Entity => Poll_Events,
External_Name => "glfwPollEvents");
procedure Wait_Events;
pragma Import (Convention => C, Entity => Wait_Events,
External_Name => "glfwWaitEvents");
-----------------------------------------------------------------------------
-- Context
-----------------------------------------------------------------------------
procedure Make_Context_Current (Window : System.Address);
pragma Import (Convention => C, Entity => Make_Context_Current,
External_Name => "glfwMakeContextCurrent");
function Get_Current_Context return System.Address;
pragma Import (Convention => C, Entity => Get_Current_Context,
External_Name => "glfwGetCurrentContext");
procedure Swap_Buffers (Window : System.Address);
pragma Import (Convention => C, Entity => Swap_Buffers,
External_Name => "glfwSwapBuffers");
procedure Swap_Interval (Value : Windows.Context.Swap_Interval);
pragma Import (Convention => C, Entity => Swap_Interval,
External_Name => "glfwSwapInterval");
-----------------------------------------------------------------------------
-- Clipboard
-----------------------------------------------------------------------------
function Get_Clipboard_String (Window : System.Address)
return Interfaces.C.Strings.chars_ptr;
pragma Import (Convention => C, Entity => Get_Clipboard_String,
External_Name => "glfwGetClipboardString");
procedure Set_Clipboard_String (Window : System.Address;
Value : Interfaces.C.char_array);
pragma Import (Convention => C, Entity => Set_Clipboard_String,
External_Name => "glfwSetClipboardString");
end Glfw.API;
|
test/Succeed/Issue3655.agda | cruhland/agda | 1,989 | 9755 | <filename>test/Succeed/Issue3655.agda
open import Agda.Primitive
postulate
F : (a : Level) → Set a → Set a
P : (a : Level) (A : Set a) → F a A → Set a
p : (a : Level) (A : Set a) (x : F a A) → P a A x
Q : (a : Level) (A : Set a) → A → Set a
variable
a : Level
A : Set a
postulate
q : (x : F _ A) → Q a _ (p a A x)
q' : {a : Level} {A : Set a} (x : F a A) → Q a (P a A x) (p a A x)
q' {a} {A} = q {a} {A}
|
programs/oeis/131/A131403.asm | neoneye/loda | 22 | 173333 | <reponame>neoneye/loda<filename>programs/oeis/131/A131403.asm
; A131403: Row sums of triangle A131402.
; 1,2,5,10,21,44,93,196,411,856,1771,3642,7451,15178,30809,62358,125921,253800,510777,1026704,2061751,4137012,8295895,16627190,33311671,66716054,133582133,267407026,535206861,1071049316,2143127061,4287918172,8578528851,17161414288,34329877699,68671161138,137360777171,274751415010,549551145617,1099180467534,2198487427001,4397179522272,8794690204785,17589916238120,35180699465071,70362801747564,140727873301423,281459419226606,562924780883311,1125859176820526,2251733911125101,4503492994788202,9007026719598501,18014119341757148,36028345316096589,72056863167335668,144114005502396171,288228462707659720,576457656285911707,1152916495145283114,2305834903734618251,4611672903486748282,9223350816435060425,18446709738349196550,36893432591639032721,73786886403697780824,147573807142755916713,295147669841291903936,590295429573724233511,1180591004594368963236,2361182244526798848391,4722364869838579114982,9444730355800200570151,18889461708508424898758,37778925030047915896229,75557852670034921649698,151115709563039999255421,302231425958989244324180,604462862973857890417797,1208925743836504428418444,2417851516617676906189251,4835703080068810509313792,9671406235915745764915315,19342812594443072973053730,38685625387275852135618371,77371251095552991903970834,154742502710496977630186753,309485006261386236715352766,618970013882555748707929961,1237940029965287054148063696,2475880063490532940305555681,4951760132741200269352743512,9903520274802493759456547551,19807040564685215128405787868,39614081153770751087055329119,79228162347022050613847104478,158456324757924970497674408671,316912649619211358705065463390,633825299405665004389827772637,1267650599081933713469069037274
mov $1,$0
seq $0,167821 ; a(n) is the number of n-tosses having a run of 3 or more heads or a run of 3 or more tails for a fair coin (i.e., probability is a(n)/2^n).
add $0,$1
add $0,1
|
programs/oeis/298/A298032.asm | karttu/loda | 0 | 166543 | <reponame>karttu/loda
; A298032: Partial sums of A298031.
; 1,5,15,31,61,97,145,199,265,337,421,511,613,721,841,967,1105,1249,1405,1567,1741,1921,2113,2311,2521,2737,2965,3199,3445,3697,3961,4231,4513,4801,5101,5407,5725,6049,6385,6727,7081,7441,7813,8191,8581,8977,9385,9799,10225,10657,11101,11551,12013,12481,12961,13447,13945,14449,14965,15487,16021,16561,17113,17671,18241,18817,19405,19999,20605,21217,21841,22471,23113,23761,24421,25087,25765,26449,27145,27847,28561,29281,30013,30751,31501,32257,33025,33799,34585,35377,36181,36991,37813,38641,39481,40327,41185,42049,42925,43807,44701,45601,46513,47431,48361,49297,50245,51199,52165,53137,54121,55111,56113,57121,58141,59167,60205,61249,62305,63367,64441,65521,66613,67711,68821,69937,71065,72199,73345,74497,75661,76831,78013,79201,80401,81607,82825,84049,85285,86527,87781,89041,90313,91591,92881,94177,95485,96799,98125,99457,100801,102151,103513,104881,106261,107647,109045,110449,111865,113287,114721,116161,117613,119071,120541,122017,123505,124999,126505,128017,129541,131071,132613,134161,135721,137287,138865,140449,142045,143647,145261,146881,148513,150151,151801,153457,155125,156799,158485,160177,161881,163591,165313,167041,168781,170527,172285,174049,175825,177607,179401,181201,183013,184831,186661,188497,190345,192199,194065,195937,197821,199711,201613,203521,205441,207367,209305,211249,213205,215167,217141,219121,221113,223111,225121,227137,229165,231199,233245,235297,237361,239431,241513,243601,245701,247807,249925,252049,254185,256327,258481,260641,262813,264991,267181,269377,271585,273799,276025,278257
mov $3,$0
lpb $0,1
add $1,$0
sub $0,1
trn $0,1
sub $1,1
add $1,$0
add $1,$0
trn $1,2
lpe
mul $1,2
add $1,1
mov $2,1
mov $4,$3
lpb $2,1
add $1,$4
sub $2,1
lpe
mov $6,$3
lpb $6,1
add $5,$4
sub $6,1
lpe
mov $2,3
mov $4,$5
lpb $2,1
add $1,$4
sub $2,1
lpe
|
special_inserts.asm | msikma/Complete-Fire-Red-Upgrade | 0 | 18396 | <reponame>msikma/Complete-Fire-Red-Upgrade<gh_stars>0
.text
.align 2
.thumb
.include "../asm_defines.s"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Game Speed Up
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x890, 0xFF
main:
ldr r2, .SuperBits
ldrh r3, [r2]
mov r0, #1
bic r3, r0
strh r3, [r2]
loop_label:
swi #2
ldrh r3, [r2]
tst r3, r0
beq loop_label
bx lr
.align 2
.SuperBits: .word 0x0300310C
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Dynamic Overworld Palette - part of hook at 0x779c
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x779A, 0xff
.byte 0x0, 0x0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Change Bit
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x013144, 0xFF
HiddenAbilityChange1:
mov r1, r9
ldrb r1, [r1]
mul r1, r7
add r1, r8
ldr r0, [r1, #0x48] @personality
ldrh r2, [r1] @species
ldrb r1, [r1, #0x17]
lsr r1, r1, #0x7 @ability bit
bl HiddenAbilityChange1 + 0x2DC28 @0x08040D6C
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Limiters
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x21CFA, 0xFF
MaxLevelChange2:
.byte MAX_LEVEL
.org 0x21FB6, 0xFF
MaxLevelChange3:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Player
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x026E34, 0xFF
HiddenAbilityChange2:
ldrb r0, [r4, #0x0] @personality
mov r1, r6 @ability bit
mov r2, r5 @species
bl HiddenAbilityChange2 + 0x19F38 @0x08040D6C
lsl r0, r0, #0x0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Opponent
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x026ECC, 0xFF
HiddenAbilityChange3:
and r0, r1
cmp r0, #0x0
beq HiddenAbilityChange3 + 0x20
ldrb r0, [r4, #0x0] @personality
mov r1, r6 @ability bit
mov r2, r5 @species
bl HiddenAbilityChange3 + 0x19EA0 @0x08040D6C
lsl r0, r0, #0x0
cmp r0, #0x2B
beq HiddenAbilityChange3 + 0x20
mov r0, #0x1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Player
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x02A800, 0xFF
HiddenAbilityChange4_1:
mov r1, #0x41
bl HiddenAbilityChange4_1 + 0x153E8 @get_attr
mov r5, r0
mov r0, r4
mov r1, #0x2E
bl HiddenAbilityChange4_1 + 0x153E8 @get_attr
ldrb r4, [r4, #0x0] @lowest personality byte
lsl r0, r0, #0x18
orr r4, r0 @000000b 00000000 00000000 pppppppp
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Opponent
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x02A890, 0xFF
HiddenAbilityChange4_2:
lsl r0, r4, #0x18
lsr r0, r0, #0x18 @personality lowest byte
lsr r1, r4, #0x18 @ability bit
mov r2, r5 @species
bl HiddenAbilityChange4_2 + 0x164DC @0x08040D6C
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Limiter
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x32F6E, 0xFF
MaxLevelChange14:
.byte MAX_LEVEL - 1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Limiters
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x3E806, 0xFF
MaxLevelChange4:
.byte MAX_LEVEL
.org 0x3E872, 0xFF
MaxLevelChange5:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Determine Ability Bit
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x40D38, 0xFF
DetermineAbilityMain:
push {lr}
bl offset_to_ability
ldr r2, b_last_copied_ability
strb r0, [r2]
pop {r1}
bx r1
offset_to_ability:
push {r4-r5, lr}
mov r4, r0
mov r1, #0xB
bl DetermineAbilityMain - 0x1150 @0x3FBE8 @get_attr
lsl r5, r0, #0x10
lsr r5, r5, #0x10
mov r0, r4
mov r1, #0x2E
bl DetermineAbilityMain - 0x1150 @0x3FBE8 @get_attr
lsl r1, r0, #0x1F
ldr r0, [r4, #0x0]
mov r2, r5 @species
bl determine_ability
pop {r4-r5}
pop {r1}
bx r1
determine_and_copy:
push {lr}
bl determine_ability
ldr r2, b_last_copied_ability
strb r0, [r2]
pop {r1}
bx r1
determine_ability:
lsl r3, r2, #0x3
sub r3, r3, r2
lsl r3, r3, #0x2
ldr r2, base_stats_table
ldr r2, [r2]
add r3, r2, r3
cmp r1, #0x0
beq no_hidden
ldrb r2, [r3, #0x1A]
cmp r2, #0x0
bne copy_hidden
no_hidden:
lsl r0, r0, #0x1F
cmp r0, #0x0
beq first_slotted
ldrb r0, [r3, #0x17]
cmp r0, #0x0
beq first_slotted
bx lr
first_slotted:
ldrb r0, [r3, #0x16]
bx lr
copy_hidden:
mov r0, r2
bx lr
.align 2
base_stats_table: .word 0x80001BC
b_last_copied_ability: .word 0x02023D6A
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Summary Screen
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x041318, 0xFF
@poke summary info
HiddenAbilityChange5:
ldrh r2, [r7] @species
ldrb r1, [r7, #0x17]
lsr r1, r1, #0x7 @ability bit
ldrb r0, [r4, #0x0] @personality
bl HiddenAbilityChange5 - 0x5AC @ 0x08040D6C
add r1, r7, #0x4
strb r0, [r1, #0x1C]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Limiters
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x41834, 0xFF
MaxLevelChange6:
.byte MAX_LEVEL
.org 0x41B0E, 0xFF
MaxLevelChange13:
.byte MAX_LEVEL - 1
.org 0x41B1E, 0xFF
MaxLevelChange7:
.byte MAX_LEVEL, 0x29, 0x6, 0xD9, MAX_LEVEL
.org 0x420E8, 0xFF
MaxLevelChange9:
.byte MAX_LEVEL
.org 0x420EC, 0xFF
MaxLevelChange10:
.byte MAX_LEVEL
.org 0x4274E, 0xFF
MaxLevelChange11:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level - Limiter
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x45684, 0xFF
MaxLevelChange12:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Egg Hatching 1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x46CA0, 0xFF
HiddenAbilityEggHatching1:
mov r0, r6
mov r1, #0x2E
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Egg Hatching 2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x46D3C, 0xFF
HiddenAbilityEggHatching2:
mov r0, r5
mov r1, #0x2E
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Hack - Limiter
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x4A216, 0xFF
MaxLevelChange1:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Character Customization
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x5e152, 0xff
mov r1, #0x5
orr r0, r1
strb r0, [r4]
ldrb r0, [r5, #0x3]
strb r0, [r4, #0x1a]
.org 0x5e5d4, 0xff
.byte 0x8, 0x47 @ routine_ptr+1 at 5e5f4
.org 0x5e744, 0xff @ fix size
lsl r4, r4, #0x10
lsr r4, r4, #0x10
lsl r5, r5, #0x10
lsr r5, r5, #0x10
mov r0, #0x0
str r0, [sp, #0x20]
mov r1, r9
ldrb r0, [r1, #0x1]
ldrb r1, [r1, #0x3]
lsl r1, r1, #0x18
lsr r1, r1, #0x10
orr r0, r1
.org 0x5e8f0, 0xff @ change size
lsl r0, r0, #0x10
lsr r0, r0, #0x10
.org 0x5e962, 0xff
.hword 0x0
.org 0x5ea0a, 0xff @ fix createsprite
.word 0x0
.org 0x5ee84, 0xff @ fix link npcs
.byte 0x8, 0x47
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Dynamic Overworld Palettes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x5f093, 0xff @don't auto-load NPC palettes into slot 0 or 0xA
.byte 0xE0
.org 0x5f114, 0xff @don't reset pal slot during player animation or reflection
.hword 0x0
.org 0x5f4ba, 0xff @remove byte casts for NPC palette number
.byte 0x1, 0x0, 0x0, 0x0
.org 0x5f548, 0xff @remove byte casts for NPC palette number
.byte 0xc0, 0x0, 0x9, 0x49
.org 0x5f54c, 0xff @remove byte casts for NPC palette number
.byte 0x0, 0x0
.org 0x5f5d2, 0xff @remove byte casts for NPC palette number
.byte 0x2, 0x0, 0x0, 0x0
.org 0x5f5e8, 0xff @don't auto-load NPC palettes into slot 0 or 0xA
.byte 0x70, 0x47
.org 0x5f658, 0xff @don't auto-load NPC palettes into slot 0 or 0xA
.byte 0x70, 0x47
.org 0x79c18, 0xff @don't load rain palette on entering map
.byte 0x0, 0x25, 0xe, 0xe0
.org 0x7a31f, 0xff @don't treat slot 0xC as weather palette
.byte 0xe0
.org 0x7a85e, 0xff @make it compatible with daniilS' snowflakes routine
.byte 0x80, 0x18
.org 0x7a872, 0xff @make it compatible with daniilS' snowflakes routine
.byte 0x1, 0x22, 0x5, 0xe0
.org 0x7aae7, 0xff @don't record brightened slots
.byte 0xe0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Ghost Battle - Register Push
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x7F904, 0xff
.byte 0x10
.org 0x7f986, 0xff
.byte 0x10, 0xbd
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Triple Layer Blocks
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x9B868, 0xFF
.byte 0x2
.org 0x9B86E, 0xFF
.byte 0x2f, 0xd0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Dynamic Overworld Palettes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0xdaec4, 0xff @@don't auto-load NPC palettes into slot 0 or 0xA
.byte 0x70, 0x47
.org 0xdaf20, 0xff @don't auto-load NPC palettes into slot 0 or 0xA
.byte 0x70, 0x47
.org 0xdafb8, 0xff @don't reset pal slot during player animation or reflection
.hword 0x0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Remove TM Animation
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x11CA2C, 0xFF
.byte 0x00, 0xF0, 0x0E, 0xFA
.org 0x11CD9E, 0xFF
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xE0
.org 0x11CE6E, 0xFF
.byte 0x0, 0x0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Hack - Rare Candies
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x1262D2, 0xFF
MaxLevelRareCandies:
.byte MAX_LEVEL
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Hack - Summary Screen
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x136684, 0xFF
SummaryScreenExpDisplay1:
.byte MAX_LEVEL - 1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Hidden Abilities - Ability Names
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x1366EC, 0xFF
HiddenAbilityChange7:
lsl r4, r0, #0x10
ldr r0, [r6]
add r0, r8
ldrb r1, [r0, #0x0] @personality
orr r4, r1 @ssssssss ssssssss 00000000 pppppppp
mov r1, #0x2E
bl HiddenAbilityChange7 - 0xF6B04 @get_attr
lsl r0, r0, #0x18
lsr r1, r0, #0x18 @ability bit
lsl r0, r4, #0x18
lsr r0, r0, #0x18 @personality
lsr r2, r4, #0x10 @species
bl HiddenAbilityChange7 - 0xF5980 @ 0x08040D6C
lsl r0, r0, #0x18
lsr r4, r0, #0x18
ldr r0, [r6]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Max Level Hack - Summary Screen Exp Display
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x13A9DC, 0xFF
SummaryScreenExpDisplay2:
.byte MAX_LEVEL - 1, 0x2D, 0x0, 0xD9
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Dynamic Overworld Palettes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x1d9895, 0xff @don't load sand palette on healing
.byte 0x7, 0x9c, 0xbe, 0x3c, 0x8, 0x8d, 0x3b, 0x8, 0x8, 0x4
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Triple Layer Blocks
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x352F0B, 0xFF
.byte 0x70
.org 0x352F16, 0xFF
.byte 0x1C
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Multichoice Pointers
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x3E05B0, 0xFF
.word MULTICHOICE_STRING_LOADER
.word 0x2
.word MULTICHOICE_STRING_LOADER
.word 0x3
.word MULTICHOICE_STRING_LOADER
.word 0x4
.word MULTICHOICE_STRING_LOADER
.word 0x5
.word MULTICHOICE_STRING_LOADER
.word 0x6
.word MULTICHOICE_STRING_LOADER
.word 0x7
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Ghost Battle Fix
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x3fd35b, 0xff
.byte 0xfd, 0x6, 0xab, 0xfb, 0xfe, 0xff
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Dynamic Overworld Palettes
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.org 0x45fd52, 0xff @pal slot of scroll arrow in Fame Checker
.byte 0x9
|
DeepLPro.popclipext/deepl.applescript | rizumita/deepl_popclip_extension | 6 | 646 | set the clipboard to "{popclip text}"
tell application "DeepL"
activate
delay 0.2
tell application "System Events"
keystroke "0" using {command down}
keystroke "v" using {command down}
end tell
end tell
|
gcc-gcc-7_3_0-release/gcc/ada/exp_spark.adb | best08618/asylo | 7 | 26366 | <reponame>best08618/asylo
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ S P A R K --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. 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 COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Checks; use Checks;
with Einfo; use Einfo;
with Exp_Ch5; use Exp_Ch5;
with Exp_Dbug; use Exp_Dbug;
with Exp_Util; use Exp_Util;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Rtsfind; use Rtsfind;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
package body Exp_SPARK is
-----------------------
-- Local Subprograms --
-----------------------
procedure Expand_SPARK_Attribute_Reference (N : Node_Id);
-- Replace occurrences of System'To_Address by calls to
-- System.Storage_Elements.To_Address
procedure Expand_SPARK_N_Object_Renaming_Declaration (N : Node_Id);
-- Perform name evaluation for a renamed object
------------------
-- Expand_SPARK --
------------------
procedure Expand_SPARK (N : Node_Id) is
begin
case Nkind (N) is
-- Qualification of entity names in formal verification mode
-- is limited to the addition of a suffix for homonyms (see
-- Exp_Dbug.Qualify_Entity_Name). We used to qualify entity names
-- as full expansion does, but this was removed as this prevents the
-- verification back-end from using a short name for debugging and
-- user interaction. The verification back-end already takes care
-- of qualifying names when needed.
when N_Block_Statement
| N_Entry_Declaration
| N_Package_Body
| N_Package_Declaration
| N_Protected_Type_Declaration
| N_Subprogram_Body
| N_Task_Type_Declaration
=>
Qualify_Entity_Names (N);
when N_Expanded_Name
| N_Identifier
=>
Expand_SPARK_Potential_Renaming (N);
when N_Object_Renaming_Declaration =>
Expand_SPARK_N_Object_Renaming_Declaration (N);
-- Replace occurrences of System'To_Address by calls to
-- System.Storage_Elements.To_Address
when N_Attribute_Reference =>
Expand_SPARK_Attribute_Reference (N);
-- Loop iterations over arrays need to be expanded, to avoid getting
-- two names referring to the same object in memory (the array and
-- the iterator) in GNATprove, especially since both can be written
-- (thus possibly leading to interferences due to aliasing). No such
-- problem arises with quantified expressions over arrays, which are
-- dealt with specially in GNATprove.
when N_Loop_Statement =>
declare
Scheme : constant Node_Id := Iteration_Scheme (N);
begin
if Present (Scheme)
and then Present (Iterator_Specification (Scheme))
and then
Is_Iterator_Over_Array (Iterator_Specification (Scheme))
then
Expand_Iterator_Loop_Over_Array (N);
end if;
end;
-- In SPARK mode, no other constructs require expansion
when others =>
null;
end case;
end Expand_SPARK;
--------------------------------------
-- Expand_SPARK_Attribute_Reference --
--------------------------------------
procedure Expand_SPARK_Attribute_Reference (N : Node_Id) is
Aname : constant Name_Id := Attribute_Name (N);
Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname);
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
Expr : Node_Id;
begin
if Attr_Id = Attribute_To_Address then
-- Extract and convert argument to expected type for call
Expr :=
Make_Type_Conversion (Loc,
Subtype_Mark =>
New_Occurrence_Of (RTE (RE_Integer_Address), Loc),
Expression => Relocate_Node (First (Expressions (N))));
-- Replace attribute reference with call
Rewrite (N,
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of (RTE (RE_To_Address), Loc),
Parameter_Associations => New_List (Expr)));
Analyze_And_Resolve (N, Typ);
-- For attributes which return Universal_Integer, introduce a conversion
-- to the expected type with the appropriate check flags set.
elsif Attr_Id = Attribute_Alignment
or else Attr_Id = Attribute_Bit
or else Attr_Id = Attribute_Bit_Position
or else Attr_Id = Attribute_Descriptor_Size
or else Attr_Id = Attribute_First_Bit
or else Attr_Id = Attribute_Last_Bit
or else Attr_Id = Attribute_Length
or else Attr_Id = Attribute_Max_Size_In_Storage_Elements
or else Attr_Id = Attribute_Pos
or else Attr_Id = Attribute_Position
or else Attr_Id = Attribute_Range_Length
or else Attr_Id = Attribute_Object_Size
or else Attr_Id = Attribute_Size
or else Attr_Id = Attribute_Value_Size
or else Attr_Id = Attribute_VADS_Size
or else Attr_Id = Attribute_Aft
or else Attr_Id = Attribute_Max_Alignment_For_Allocation
then
-- If the expected type is Long_Long_Integer, there will be no check
-- flag as the compiler assumes attributes always fit in this type.
-- Since in SPARK_Mode we do not take Storage_Error into account, we
-- cannot make this assumption and need to produce a check.
-- ??? It should be enough to add this check for attributes 'Length
-- and 'Range_Length when the type is as big as Long_Long_Integer.
declare
Typ : Entity_Id := Empty;
begin
if Attr_Id = Attribute_Range_Length then
Typ := Etype (Prefix (N));
elsif Attr_Id = Attribute_Length then
Typ := Etype (Prefix (N));
declare
Indx : Node_Id;
J : Int;
begin
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
end if;
if No (Expressions (N)) then
J := 1;
else
J := UI_To_Int (Expr_Value (First (Expressions (N))));
end if;
Indx := First_Index (Typ);
while J > 1 loop
Next_Index (Indx);
J := J - 1;
end loop;
Typ := Etype (Indx);
end;
end if;
Apply_Universal_Integer_Attribute_Checks (N);
if Present (Typ)
and then RM_Size (Typ) = RM_Size (Standard_Long_Long_Integer)
then
Set_Do_Overflow_Check (N);
end if;
end;
end if;
end Expand_SPARK_Attribute_Reference;
------------------------------------------------
-- Expand_SPARK_N_Object_Renaming_Declaration --
------------------------------------------------
procedure Expand_SPARK_N_Object_Renaming_Declaration (N : Node_Id) is
begin
-- Unconditionally remove all side effects from the name
Evaluate_Name (Name (N));
end Expand_SPARK_N_Object_Renaming_Declaration;
-------------------------------------
-- Expand_SPARK_Potential_Renaming --
-------------------------------------
procedure Expand_SPARK_Potential_Renaming (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Ren_Id : constant Entity_Id := Entity (N);
Typ : constant Entity_Id := Etype (N);
Obj_Id : Node_Id;
begin
-- Replace a reference to a renaming with the actual renamed object
if Ekind (Ren_Id) in Object_Kind then
Obj_Id := Renamed_Object (Ren_Id);
if Present (Obj_Id) then
-- The renamed object is an entity when instantiating generics
-- or inlining bodies. In this case the renaming is part of the
-- mapping "prologue" which links actuals to formals.
if Nkind (Obj_Id) in N_Entity then
Rewrite (N, New_Occurrence_Of (Obj_Id, Loc));
-- Otherwise the renamed object denotes a name
else
Rewrite (N, New_Copy_Tree (Obj_Id, New_Sloc => Loc));
Reset_Analyzed_Flags (N);
end if;
Analyze_And_Resolve (N, Typ);
end if;
end if;
end Expand_SPARK_Potential_Renaming;
end Exp_SPARK;
|
usertests.asm | ShwetiMahajan/xv6_schedulersOS | 0 | 25219 |
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <validateint>:
printf(stdout, "sbrk test OK\n");
}
void
validateint(int *p)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
"int %2\n\t"
"mov %%ebx, %%esp" :
"=a" (res) :
"a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) :
"ebx");
}
3: 5d pop %ebp
4: c3 ret
5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000010 <rand>:
unsigned long randstate = 1;
unsigned int
rand()
{
randstate = randstate * 1664525 + 1013904223;
10: 69 05 10 59 00 00 0d imul $0x19660d,0x5910,%eax
17: 66 19 00
}
unsigned long randstate = 1;
unsigned int
rand()
{
1a: 55 push %ebp
1b: 89 e5 mov %esp,%ebp
randstate = randstate * 1664525 + 1013904223;
return randstate;
}
1d: 5d pop %ebp
unsigned long randstate = 1;
unsigned int
rand()
{
randstate = randstate * 1664525 + 1013904223;
1e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
23: a3 10 59 00 00 mov %eax,0x5910
return randstate;
}
28: c3 ret
29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000030 <bsstest>:
// does unintialized data start out zero?
char uninit[10000];
void
bsstest(void)
{
30: 55 push %ebp
31: 89 e5 mov %esp,%ebp
33: 83 ec 18 sub $0x18,%esp
int i;
printf(stdout, "bss test\n");
36: a1 0c 59 00 00 mov 0x590c,%eax
3b: c7 44 24 04 48 41 00 movl $0x4148,0x4(%esp)
42: 00
43: 89 04 24 mov %eax,(%esp)
46: e8 95 3d 00 00 call 3de0 <printf>
for(i = 0; i < sizeof(uninit); i++){
if(uninit[i] != '\0'){
4b: 80 3d c0 59 00 00 00 cmpb $0x0,0x59c0
52: 75 36 jne 8a <bsstest+0x5a>
54: b8 01 00 00 00 mov $0x1,%eax
59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
60: 80 b8 c0 59 00 00 00 cmpb $0x0,0x59c0(%eax)
67: 75 21 jne 8a <bsstest+0x5a>
bsstest(void)
{
int i;
printf(stdout, "bss test\n");
for(i = 0; i < sizeof(uninit); i++){
69: 83 c0 01 add $0x1,%eax
6c: 3d 10 27 00 00 cmp $0x2710,%eax
71: 75 ed jne 60 <bsstest+0x30>
if(uninit[i] != '\0'){
printf(stdout, "bss test failed\n");
exit();
}
}
printf(stdout, "bss test ok\n");
73: a1 0c 59 00 00 mov 0x590c,%eax
78: c7 44 24 04 63 41 00 movl $0x4163,0x4(%esp)
7f: 00
80: 89 04 24 mov %eax,(%esp)
83: e8 58 3d 00 00 call 3de0 <printf>
}
88: c9 leave
89: c3 ret
int i;
printf(stdout, "bss test\n");
for(i = 0; i < sizeof(uninit); i++){
if(uninit[i] != '\0'){
printf(stdout, "bss test failed\n");
8a: a1 0c 59 00 00 mov 0x590c,%eax
8f: c7 44 24 04 52 41 00 movl $0x4152,0x4(%esp)
96: 00
97: 89 04 24 mov %eax,(%esp)
9a: e8 41 3d 00 00 call 3de0 <printf>
exit();
9f: e8 04 3c 00 00 call 3ca8 <exit>
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <opentest>:
// simple file system tests
void
opentest(void)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 83 ec 18 sub $0x18,%esp
int fd;
printf(stdout, "open test\n");
b6: a1 0c 59 00 00 mov 0x590c,%eax
bb: c7 44 24 04 70 41 00 movl $0x4170,0x4(%esp)
c2: 00
c3: 89 04 24 mov %eax,(%esp)
c6: e8 15 3d 00 00 call 3de0 <printf>
fd = open("echo", 0);
cb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
d2: 00
d3: c7 04 24 7b 41 00 00 movl $0x417b,(%esp)
da: e8 09 3c 00 00 call 3ce8 <open>
if(fd < 0){
df: 85 c0 test %eax,%eax
e1: 78 37 js 11a <opentest+0x6a>
printf(stdout, "open echo failed!\n");
exit();
}
close(fd);
e3: 89 04 24 mov %eax,(%esp)
e6: e8 e5 3b 00 00 call 3cd0 <close>
fd = open("doesnotexist", 0);
eb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
f2: 00
f3: c7 04 24 93 41 00 00 movl $0x4193,(%esp)
fa: e8 e9 3b 00 00 call 3ce8 <open>
if(fd >= 0){
ff: 85 c0 test %eax,%eax
101: 79 31 jns 134 <opentest+0x84>
printf(stdout, "open doesnotexist succeeded!\n");
exit();
}
printf(stdout, "open test ok\n");
103: a1 0c 59 00 00 mov 0x590c,%eax
108: c7 44 24 04 be 41 00 movl $0x41be,0x4(%esp)
10f: 00
110: 89 04 24 mov %eax,(%esp)
113: e8 c8 3c 00 00 call 3de0 <printf>
}
118: c9 leave
119: c3 ret
int fd;
printf(stdout, "open test\n");
fd = open("echo", 0);
if(fd < 0){
printf(stdout, "open echo failed!\n");
11a: a1 0c 59 00 00 mov 0x590c,%eax
11f: c7 44 24 04 80 41 00 movl $0x4180,0x4(%esp)
126: 00
127: 89 04 24 mov %eax,(%esp)
12a: e8 b1 3c 00 00 call 3de0 <printf>
exit();
12f: e8 74 3b 00 00 call 3ca8 <exit>
}
close(fd);
fd = open("doesnotexist", 0);
if(fd >= 0){
printf(stdout, "open doesnotexist succeeded!\n");
134: a1 0c 59 00 00 mov 0x590c,%eax
139: c7 44 24 04 a0 41 00 movl $0x41a0,0x4(%esp)
140: 00
141: 89 04 24 mov %eax,(%esp)
144: e8 97 3c 00 00 call 3de0 <printf>
exit();
149: e8 5a 3b 00 00 call 3ca8 <exit>
14e: 66 90 xchg %ax,%ax
00000150 <argptest>:
wait();
printf(1, "uio test done\n");
}
void argptest()
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 83 ec 14 sub $0x14,%esp
int fd;
fd = open("init", O_RDONLY);
157: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
15e: 00
15f: c7 04 24 cc 41 00 00 movl $0x41cc,(%esp)
166: e8 7d 3b 00 00 call 3ce8 <open>
if (fd < 0) {
16b: 85 c0 test %eax,%eax
}
void argptest()
{
int fd;
fd = open("init", O_RDONLY);
16d: 89 c3 mov %eax,%ebx
if (fd < 0) {
16f: 78 45 js 1b6 <argptest+0x66>
printf(2, "open failed\n");
exit();
}
read(fd, sbrk(0) - 1, -1);
171: c7 04 24 00 00 00 00 movl $0x0,(%esp)
178: e8 b3 3b 00 00 call 3d30 <sbrk>
17d: 89 1c 24 mov %ebx,(%esp)
180: c7 44 24 08 ff ff ff movl $0xffffffff,0x8(%esp)
187: ff
188: 83 e8 01 sub $0x1,%eax
18b: 89 44 24 04 mov %eax,0x4(%esp)
18f: e8 2c 3b 00 00 call 3cc0 <read>
close(fd);
194: 89 1c 24 mov %ebx,(%esp)
197: e8 34 3b 00 00 call 3cd0 <close>
printf(1, "arg test passed\n");
19c: c7 44 24 04 de 41 00 movl $0x41de,0x4(%esp)
1a3: 00
1a4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ab: e8 30 3c 00 00 call 3de0 <printf>
}
1b0: 83 c4 14 add $0x14,%esp
1b3: 5b pop %ebx
1b4: 5d pop %ebp
1b5: c3 ret
void argptest()
{
int fd;
fd = open("init", O_RDONLY);
if (fd < 0) {
printf(2, "open failed\n");
1b6: c7 44 24 04 d1 41 00 movl $0x41d1,0x4(%esp)
1bd: 00
1be: c7 04 24 02 00 00 00 movl $0x2,(%esp)
1c5: e8 16 3c 00 00 call 3de0 <printf>
exit();
1ca: e8 d9 3a 00 00 call 3ca8 <exit>
1cf: 90 nop
000001d0 <uio>:
printf(1, "fsfull test finished\n");
}
void
uio()
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 83 ec 18 sub $0x18,%esp
ushort port = 0;
uchar val = 0;
int pid;
printf(1, "uio test\n");
1d6: c7 44 24 04 ef 41 00 movl $0x41ef,0x4(%esp)
1dd: 00
1de: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e5: e8 f6 3b 00 00 call 3de0 <printf>
pid = fork();
1ea: e8 b1 3a 00 00 call 3ca0 <fork>
if(pid == 0){
1ef: 83 f8 00 cmp $0x0,%eax
1f2: 74 1d je 211 <uio+0x41>
asm volatile("outb %0,%1"::"a"(val), "d" (port));
port = RTC_DATA;
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
printf(1, "uio: uio succeeded; test FAILED\n");
exit();
} else if(pid < 0){
1f4: 7c 42 jl 238 <uio+0x68>
printf (1, "fork failed\n");
exit();
}
wait();
1f6: e8 b5 3a 00 00 call 3cb0 <wait>
printf(1, "uio test done\n");
1fb: c7 44 24 04 f9 41 00 movl $0x41f9,0x4(%esp)
202: 00
203: c7 04 24 01 00 00 00 movl $0x1,(%esp)
20a: e8 d1 3b 00 00 call 3de0 <printf>
}
20f: c9 leave
210: c3 ret
pid = fork();
if(pid == 0){
port = RTC_ADDR;
val = 0x09; /* year */
/* http://wiki.osdev.org/Inline_Assembly/Examples */
asm volatile("outb %0,%1"::"a"(val), "d" (port));
211: ba 70 00 00 00 mov $0x70,%edx
216: b8 09 00 00 00 mov $0x9,%eax
21b: ee out %al,(%dx)
port = RTC_DATA;
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
21c: b2 71 mov $0x71,%dl
21e: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
21f: c7 44 24 04 6c 51 00 movl $0x516c,0x4(%esp)
226: 00
227: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22e: e8 ad 3b 00 00 call 3de0 <printf>
exit();
233: e8 70 3a 00 00 call 3ca8 <exit>
} else if(pid < 0){
printf (1, "fork failed\n");
238: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
23f: 00
240: c7 04 24 01 00 00 00 movl $0x1,(%esp)
247: e8 94 3b 00 00 call 3de0 <printf>
exit();
24c: e8 57 3a 00 00 call 3ca8 <exit>
251: eb 0d jmp 260 <forktest>
253: 90 nop
254: 90 nop
255: 90 nop
256: 90 nop
257: 90 nop
258: 90 nop
259: 90 nop
25a: 90 nop
25b: 90 nop
25c: 90 nop
25d: 90 nop
25e: 90 nop
25f: 90 nop
00000260 <forktest>:
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
int n, pid;
printf(1, "fork test\n");
264: 31 db xor %ebx,%ebx
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
266: 83 ec 14 sub $0x14,%esp
int n, pid;
printf(1, "fork test\n");
269: c7 44 24 04 08 42 00 movl $0x4208,0x4(%esp)
270: 00
271: c7 04 24 01 00 00 00 movl $0x1,(%esp)
278: e8 63 3b 00 00 call 3de0 <printf>
27d: eb 0e jmp 28d <forktest+0x2d>
27f: 90 nop
for(n=0; n<1000; n++){
pid = fork();
if(pid < 0)
break;
if(pid == 0)
280: 74 6a je 2ec <forktest+0x8c>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<1000; n++){
282: 83 c3 01 add $0x1,%ebx
285: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
28b: 74 4b je 2d8 <forktest+0x78>
pid = fork();
28d: e8 0e 3a 00 00 call 3ca0 <fork>
if(pid < 0)
292: 83 f8 00 cmp $0x0,%eax
295: 7d e9 jge 280 <forktest+0x20>
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
exit();
}
for(; n > 0; n--){
297: 85 db test %ebx,%ebx
299: 74 13 je 2ae <forktest+0x4e>
29b: 90 nop
29c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(wait() < 0){
2a0: e8 0b 3a 00 00 call 3cb0 <wait>
2a5: 85 c0 test %eax,%eax
2a7: 78 48 js 2f1 <forktest+0x91>
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
exit();
}
for(; n > 0; n--){
2a9: 83 eb 01 sub $0x1,%ebx
2ac: 75 f2 jne 2a0 <forktest+0x40>
2ae: 66 90 xchg %ax,%ax
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
2b0: e8 fb 39 00 00 call 3cb0 <wait>
2b5: 83 f8 ff cmp $0xffffffff,%eax
2b8: 75 50 jne 30a <forktest+0xaa>
printf(1, "wait got too many\n");
exit();
}
printf(1, "fork test OK\n");
2ba: c7 44 24 04 3a 42 00 movl $0x423a,0x4(%esp)
2c1: 00
2c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c9: e8 12 3b 00 00 call 3de0 <printf>
}
2ce: 83 c4 14 add $0x14,%esp
2d1: 5b pop %ebx
2d2: 5d pop %ebp
2d3: c3 ret
2d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid == 0)
exit();
}
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
2d8: c7 44 24 04 90 51 00 movl $0x5190,0x4(%esp)
2df: 00
2e0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2e7: e8 f4 3a 00 00 call 3de0 <printf>
exit();
2ec: e8 b7 39 00 00 call 3ca8 <exit>
}
for(; n > 0; n--){
if(wait() < 0){
printf(1, "wait stopped early\n");
2f1: c7 44 24 04 13 42 00 movl $0x4213,0x4(%esp)
2f8: 00
2f9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
300: e8 db 3a 00 00 call 3de0 <printf>
exit();
305: e8 9e 39 00 00 call 3ca8 <exit>
}
}
if(wait() != -1){
printf(1, "wait got too many\n");
30a: c7 44 24 04 27 42 00 movl $0x4227,0x4(%esp)
311: 00
312: c7 04 24 01 00 00 00 movl $0x1,(%esp)
319: e8 c2 3a 00 00 call 3de0 <printf>
exit();
31e: e8 85 39 00 00 call 3ca8 <exit>
323: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000330 <exitwait>:
}
// try to find any races between exit and wait
void
exitwait(void)
{
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 56 push %esi
334: 31 f6 xor %esi,%esi
336: 53 push %ebx
337: 83 ec 10 sub $0x10,%esp
33a: eb 17 jmp 353 <exitwait+0x23>
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
return;
}
if(pid){
340: 74 79 je 3bb <exitwait+0x8b>
if(wait() != pid){
342: e8 69 39 00 00 call 3cb0 <wait>
347: 39 c3 cmp %eax,%ebx
349: 75 35 jne 380 <exitwait+0x50>
void
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
34b: 83 c6 01 add $0x1,%esi
34e: 83 fe 64 cmp $0x64,%esi
351: 74 4d je 3a0 <exitwait+0x70>
pid = fork();
353: e8 48 39 00 00 call 3ca0 <fork>
if(pid < 0){
358: 83 f8 00 cmp $0x0,%eax
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
pid = fork();
35b: 89 c3 mov %eax,%ebx
if(pid < 0){
35d: 7d e1 jge 340 <exitwait+0x10>
printf(1, "fork failed\n");
35f: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
366: 00
367: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36e: e8 6d 3a 00 00 call 3de0 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
373: 83 c4 10 add $0x10,%esp
376: 5b pop %ebx
377: 5e pop %esi
378: 5d pop %ebp
379: c3 ret
37a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
return;
}
if(pid){
if(wait() != pid){
printf(1, "wait wrong pid\n");
380: c7 44 24 04 48 42 00 movl $0x4248,0x4(%esp)
387: 00
388: c7 04 24 01 00 00 00 movl $0x1,(%esp)
38f: e8 4c 3a 00 00 call 3de0 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
394: 83 c4 10 add $0x10,%esp
397: 5b pop %ebx
398: 5e pop %esi
399: 5d pop %ebp
39a: c3 ret
39b: 90 nop
39c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
} else {
exit();
}
}
printf(1, "exitwait ok\n");
3a0: c7 44 24 04 58 42 00 movl $0x4258,0x4(%esp)
3a7: 00
3a8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3af: e8 2c 3a 00 00 call 3de0 <printf>
}
3b4: 83 c4 10 add $0x10,%esp
3b7: 5b pop %ebx
3b8: 5e pop %esi
3b9: 5d pop %ebp
3ba: c3 ret
if(wait() != pid){
printf(1, "wait wrong pid\n");
return;
}
} else {
exit();
3bb: e8 e8 38 00 00 call 3ca8 <exit>
000003c0 <fsfull>:
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 57 push %edi
3c4: 56 push %esi
3c5: 53 push %ebx
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
3c6: 31 db xor %ebx,%ebx
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
3c8: 83 ec 5c sub $0x5c,%esp
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
3cb: c7 44 24 04 65 42 00 movl $0x4265,0x4(%esp)
3d2: 00
3d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3da: e8 01 3a 00 00 call 3de0 <printf>
3df: 90 nop
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3e0: b8 d3 4d 62 10 mov $0x10624dd3,%eax
3e5: 89 d9 mov %ebx,%ecx
3e7: f7 eb imul %ebx
3e9: c1 f9 1f sar $0x1f,%ecx
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
3ec: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
3f0: c6 45 ad 00 movb $0x0,-0x53(%ebp)
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3f4: c1 fa 06 sar $0x6,%edx
3f7: 29 ca sub %ecx,%edx
name[2] = '0' + (nfiles % 1000) / 100;
3f9: 69 f2 e8 03 00 00 imul $0x3e8,%edx,%esi
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3ff: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
402: 89 da mov %ebx,%edx
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
404: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
407: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
40c: c7 44 24 04 72 42 00 movl $0x4272,0x4(%esp)
413: 00
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
414: 29 f2 sub %esi,%edx
416: 89 d6 mov %edx,%esi
418: f7 ea imul %edx
name[3] = '0' + (nfiles % 100) / 10;
41a: b8 1f 85 eb 51 mov $0x51eb851f,%eax
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
41f: c1 fe 1f sar $0x1f,%esi
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
422: c7 04 24 01 00 00 00 movl $0x1,(%esp)
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
429: c1 fa 05 sar $0x5,%edx
42c: 29 f2 sub %esi,%edx
name[3] = '0' + (nfiles % 100) / 10;
42e: be 67 66 66 66 mov $0x66666667,%esi
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
433: 83 c2 30 add $0x30,%edx
436: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
439: f7 eb imul %ebx
43b: c1 fa 05 sar $0x5,%edx
43e: 29 ca sub %ecx,%edx
440: 6b fa 64 imul $0x64,%edx,%edi
443: 89 da mov %ebx,%edx
445: 29 fa sub %edi,%edx
447: 89 d0 mov %edx,%eax
449: 89 d7 mov %edx,%edi
44b: f7 ee imul %esi
name[4] = '0' + (nfiles % 10);
44d: 89 d8 mov %ebx,%eax
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
44f: c1 ff 1f sar $0x1f,%edi
452: c1 fa 02 sar $0x2,%edx
455: 29 fa sub %edi,%edx
457: 83 c2 30 add $0x30,%edx
45a: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
45d: f7 ee imul %esi
45f: c1 fa 02 sar $0x2,%edx
462: 29 ca sub %ecx,%edx
464: 8d 04 92 lea (%edx,%edx,4),%eax
467: 89 da mov %ebx,%edx
469: 01 c0 add %eax,%eax
46b: 29 c2 sub %eax,%edx
46d: 89 d0 mov %edx,%eax
46f: 83 c0 30 add $0x30,%eax
472: 88 45 ac mov %al,-0x54(%ebp)
name[5] = '\0';
printf(1, "writing %s\n", name);
475: 8d 45 a8 lea -0x58(%ebp),%eax
478: 89 44 24 08 mov %eax,0x8(%esp)
47c: e8 5f 39 00 00 call 3de0 <printf>
int fd = open(name, O_CREATE|O_RDWR);
481: 8d 55 a8 lea -0x58(%ebp),%edx
484: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
48b: 00
48c: 89 14 24 mov %edx,(%esp)
48f: e8 54 38 00 00 call 3ce8 <open>
if(fd < 0){
494: 85 c0 test %eax,%eax
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
int fd = open(name, O_CREATE|O_RDWR);
496: 89 c7 mov %eax,%edi
if(fd < 0){
498: 78 53 js 4ed <fsfull+0x12d>
printf(1, "open %s failed\n", name);
break;
49a: 31 f6 xor %esi,%esi
49c: eb 04 jmp 4a2 <fsfull+0xe2>
49e: 66 90 xchg %ax,%ax
int total = 0;
while(1){
int cc = write(fd, buf, 512);
if(cc < 512)
break;
total += cc;
4a0: 01 c6 add %eax,%esi
printf(1, "open %s failed\n", name);
break;
}
int total = 0;
while(1){
int cc = write(fd, buf, 512);
4a2: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
4a9: 00
4aa: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
4b1: 00
4b2: 89 3c 24 mov %edi,(%esp)
4b5: e8 0e 38 00 00 call 3cc8 <write>
if(cc < 512)
4ba: 3d ff 01 00 00 cmp $0x1ff,%eax
4bf: 7f df jg 4a0 <fsfull+0xe0>
break;
total += cc;
fsblocks++;
}
printf(1, "wrote %d bytes\n", total);
4c1: 89 74 24 08 mov %esi,0x8(%esp)
4c5: c7 44 24 04 8e 42 00 movl $0x428e,0x4(%esp)
4cc: 00
4cd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
4d4: e8 07 39 00 00 call 3de0 <printf>
close(fd);
4d9: 89 3c 24 mov %edi,(%esp)
4dc: e8 ef 37 00 00 call 3cd0 <close>
if(total == 0)
4e1: 85 f6 test %esi,%esi
4e3: 74 23 je 508 <fsfull+0x148>
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
4e5: 83 c3 01 add $0x1,%ebx
}
printf(1, "wrote %d bytes\n", total);
close(fd);
if(total == 0)
break;
}
4e8: e9 f3 fe ff ff jmp 3e0 <fsfull+0x20>
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
int fd = open(name, O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "open %s failed\n", name);
4ed: 8d 45 a8 lea -0x58(%ebp),%eax
4f0: 89 44 24 08 mov %eax,0x8(%esp)
4f4: c7 44 24 04 7e 42 00 movl $0x427e,0x4(%esp)
4fb: 00
4fc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
503: e8 d8 38 00 00 call 3de0 <printf>
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
508: b8 d3 4d 62 10 mov $0x10624dd3,%eax
50d: 89 d9 mov %ebx,%ecx
50f: f7 eb imul %ebx
511: c1 f9 1f sar $0x1f,%ecx
break;
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
514: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
518: c6 45 ad 00 movb $0x0,-0x53(%ebp)
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
51c: c1 fa 06 sar $0x6,%edx
51f: 29 ca sub %ecx,%edx
name[2] = '0' + (nfiles % 1000) / 100;
521: 69 f2 e8 03 00 00 imul $0x3e8,%edx,%esi
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
527: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
52a: 89 da mov %ebx,%edx
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
52c: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
52f: b8 1f 85 eb 51 mov $0x51eb851f,%eax
534: 29 f2 sub %esi,%edx
536: 89 d6 mov %edx,%esi
538: f7 ea imul %edx
name[3] = '0' + (nfiles % 100) / 10;
53a: b8 1f 85 eb 51 mov $0x51eb851f,%eax
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
53f: c1 fe 1f sar $0x1f,%esi
542: c1 fa 05 sar $0x5,%edx
545: 29 f2 sub %esi,%edx
name[3] = '0' + (nfiles % 100) / 10;
547: be 67 66 66 66 mov $0x66666667,%esi
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
54c: 83 c2 30 add $0x30,%edx
54f: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
552: f7 eb imul %ebx
554: c1 fa 05 sar $0x5,%edx
557: 29 ca sub %ecx,%edx
559: 6b fa 64 imul $0x64,%edx,%edi
55c: 89 da mov %ebx,%edx
55e: 29 fa sub %edi,%edx
560: 89 d0 mov %edx,%eax
562: 89 d7 mov %edx,%edi
564: f7 ee imul %esi
name[4] = '0' + (nfiles % 10);
566: 89 d8 mov %ebx,%eax
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
568: c1 ff 1f sar $0x1f,%edi
56b: c1 fa 02 sar $0x2,%edx
56e: 29 fa sub %edi,%edx
570: 83 c2 30 add $0x30,%edx
573: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
576: f7 ee imul %esi
578: c1 fa 02 sar $0x2,%edx
57b: 29 ca sub %ecx,%edx
57d: 8d 04 92 lea (%edx,%edx,4),%eax
580: 89 da mov %ebx,%edx
582: 01 c0 add %eax,%eax
name[5] = '\0';
unlink(name);
nfiles--;
584: 83 eb 01 sub $0x1,%ebx
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
587: 29 c2 sub %eax,%edx
589: 89 d0 mov %edx,%eax
58b: 83 c0 30 add $0x30,%eax
58e: 88 45 ac mov %al,-0x54(%ebp)
name[5] = '\0';
unlink(name);
591: 8d 45 a8 lea -0x58(%ebp),%eax
594: 89 04 24 mov %eax,(%esp)
597: e8 5c 37 00 00 call 3cf8 <unlink>
close(fd);
if(total == 0)
break;
}
while(nfiles >= 0){
59c: 83 fb ff cmp $0xffffffff,%ebx
59f: 0f 85 63 ff ff ff jne 508 <fsfull+0x148>
name[5] = '\0';
unlink(name);
nfiles--;
}
printf(1, "fsfull test finished\n");
5a5: c7 44 24 04 9e 42 00 movl $0x429e,0x4(%esp)
5ac: 00
5ad: c7 04 24 01 00 00 00 movl $0x1,(%esp)
5b4: e8 27 38 00 00 call 3de0 <printf>
}
5b9: 83 c4 5c add $0x5c,%esp
5bc: 5b pop %ebx
5bd: 5e pop %esi
5be: 5f pop %edi
5bf: 5d pop %ebp
5c0: c3 ret
5c1: eb 0d jmp 5d0 <bigwrite>
5c3: 90 nop
5c4: 90 nop
5c5: 90 nop
5c6: 90 nop
5c7: 90 nop
5c8: 90 nop
5c9: 90 nop
5ca: 90 nop
5cb: 90 nop
5cc: 90 nop
5cd: 90 nop
5ce: 90 nop
5cf: 90 nop
000005d0 <bigwrite>:
}
// test writes that are larger than the log.
void
bigwrite(void)
{
5d0: 55 push %ebp
5d1: 89 e5 mov %esp,%ebp
5d3: 56 push %esi
5d4: 53 push %ebx
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
5d5: bb f3 01 00 00 mov $0x1f3,%ebx
}
// test writes that are larger than the log.
void
bigwrite(void)
{
5da: 83 ec 10 sub $0x10,%esp
int fd, sz;
printf(1, "bigwrite test\n");
5dd: c7 44 24 04 b4 42 00 movl $0x42b4,0x4(%esp)
5e4: 00
5e5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
5ec: e8 ef 37 00 00 call 3de0 <printf>
unlink("bigwrite");
5f1: c7 04 24 c3 42 00 00 movl $0x42c3,(%esp)
5f8: e8 fb 36 00 00 call 3cf8 <unlink>
5fd: 8d 76 00 lea 0x0(%esi),%esi
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
600: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
607: 00
608: c7 04 24 c3 42 00 00 movl $0x42c3,(%esp)
60f: e8 d4 36 00 00 call 3ce8 <open>
if(fd < 0){
614: 85 c0 test %eax,%eax
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
616: 89 c6 mov %eax,%esi
if(fd < 0){
618: 0f 88 8e 00 00 00 js 6ac <bigwrite+0xdc>
printf(1, "cannot create bigwrite\n");
exit();
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
61e: 89 5c 24 08 mov %ebx,0x8(%esp)
622: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
629: 00
62a: 89 04 24 mov %eax,(%esp)
62d: e8 96 36 00 00 call 3cc8 <write>
if(cc != sz){
632: 39 c3 cmp %eax,%ebx
634: 75 55 jne 68b <bigwrite+0xbb>
printf(1, "cannot create bigwrite\n");
exit();
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
636: 89 5c 24 08 mov %ebx,0x8(%esp)
63a: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
641: 00
642: 89 34 24 mov %esi,(%esp)
645: e8 7e 36 00 00 call 3cc8 <write>
if(cc != sz){
64a: 39 d8 cmp %ebx,%eax
64c: 75 3d jne 68b <bigwrite+0xbb>
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
64e: 81 c3 d7 01 00 00 add $0x1d7,%ebx
if(cc != sz){
printf(1, "write(%d) ret %d\n", sz, cc);
exit();
}
}
close(fd);
654: 89 34 24 mov %esi,(%esp)
657: e8 74 36 00 00 call 3cd0 <close>
unlink("bigwrite");
65c: c7 04 24 c3 42 00 00 movl $0x42c3,(%esp)
663: e8 90 36 00 00 call 3cf8 <unlink>
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
668: 81 fb 07 18 00 00 cmp $0x1807,%ebx
66e: 75 90 jne 600 <bigwrite+0x30>
}
close(fd);
unlink("bigwrite");
}
printf(1, "bigwrite ok\n");
670: c7 44 24 04 f6 42 00 movl $0x42f6,0x4(%esp)
677: 00
678: c7 04 24 01 00 00 00 movl $0x1,(%esp)
67f: e8 5c 37 00 00 call 3de0 <printf>
}
684: 83 c4 10 add $0x10,%esp
687: 5b pop %ebx
688: 5e pop %esi
689: 5d pop %ebp
68a: c3 ret
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
if(cc != sz){
printf(1, "write(%d) ret %d\n", sz, cc);
68b: 89 44 24 0c mov %eax,0xc(%esp)
68f: 89 5c 24 08 mov %ebx,0x8(%esp)
693: c7 44 24 04 e4 42 00 movl $0x42e4,0x4(%esp)
69a: 00
69b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6a2: e8 39 37 00 00 call 3de0 <printf>
exit();
6a7: e8 fc 35 00 00 call 3ca8 <exit>
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigwrite\n");
6ac: c7 44 24 04 cc 42 00 movl $0x42cc,0x4(%esp)
6b3: 00
6b4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6bb: e8 20 37 00 00 call 3de0 <printf>
exit();
6c0: e8 e3 35 00 00 call 3ca8 <exit>
6c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000006d0 <unlinkread>:
}
// can I unlink a file and still read it?
void
unlinkread(void)
{
6d0: 55 push %ebp
6d1: 89 e5 mov %esp,%ebp
6d3: 56 push %esi
6d4: 53 push %ebx
6d5: 83 ec 10 sub $0x10,%esp
int fd, fd1;
printf(1, "unlinkread test\n");
6d8: c7 44 24 04 03 43 00 movl $0x4303,0x4(%esp)
6df: 00
6e0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6e7: e8 f4 36 00 00 call 3de0 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
6ec: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
6f3: 00
6f4: c7 04 24 14 43 00 00 movl $0x4314,(%esp)
6fb: e8 e8 35 00 00 call 3ce8 <open>
if(fd < 0){
700: 85 c0 test %eax,%eax
unlinkread(void)
{
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
702: 89 c3 mov %eax,%ebx
if(fd < 0){
704: 0f 88 fe 00 00 00 js 808 <unlinkread+0x138>
printf(1, "create unlinkread failed\n");
exit();
}
write(fd, "hello", 5);
70a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
711: 00
712: c7 44 24 04 39 43 00 movl $0x4339,0x4(%esp)
719: 00
71a: 89 04 24 mov %eax,(%esp)
71d: e8 a6 35 00 00 call 3cc8 <write>
close(fd);
722: 89 1c 24 mov %ebx,(%esp)
725: e8 a6 35 00 00 call 3cd0 <close>
fd = open("unlinkread", O_RDWR);
72a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
731: 00
732: c7 04 24 14 43 00 00 movl $0x4314,(%esp)
739: e8 aa 35 00 00 call 3ce8 <open>
if(fd < 0){
73e: 85 c0 test %eax,%eax
exit();
}
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
740: 89 c3 mov %eax,%ebx
if(fd < 0){
742: 0f 88 3d 01 00 00 js 885 <unlinkread+0x1b5>
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
748: c7 04 24 14 43 00 00 movl $0x4314,(%esp)
74f: e8 a4 35 00 00 call 3cf8 <unlink>
754: 85 c0 test %eax,%eax
756: 0f 85 10 01 00 00 jne 86c <unlinkread+0x19c>
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
75c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
763: 00
764: c7 04 24 14 43 00 00 movl $0x4314,(%esp)
76b: e8 78 35 00 00 call 3ce8 <open>
write(fd1, "yyy", 3);
770: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp)
777: 00
778: c7 44 24 04 71 43 00 movl $0x4371,0x4(%esp)
77f: 00
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
780: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
782: 89 04 24 mov %eax,(%esp)
785: e8 3e 35 00 00 call 3cc8 <write>
close(fd1);
78a: 89 34 24 mov %esi,(%esp)
78d: e8 3e 35 00 00 call 3cd0 <close>
if(read(fd, buf, sizeof(buf)) != 5){
792: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
799: 00
79a: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
7a1: 00
7a2: 89 1c 24 mov %ebx,(%esp)
7a5: e8 16 35 00 00 call 3cc0 <read>
7aa: 83 f8 05 cmp $0x5,%eax
7ad: 0f 85 a0 00 00 00 jne 853 <unlinkread+0x183>
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
7b3: 80 3d e0 80 00 00 68 cmpb $0x68,0x80e0
7ba: 75 7e jne 83a <unlinkread+0x16a>
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
7bc: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
7c3: 00
7c4: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
7cb: 00
7cc: 89 1c 24 mov %ebx,(%esp)
7cf: e8 f4 34 00 00 call 3cc8 <write>
7d4: 83 f8 0a cmp $0xa,%eax
7d7: 75 48 jne 821 <unlinkread+0x151>
printf(1, "unlinkread write failed\n");
exit();
}
close(fd);
7d9: 89 1c 24 mov %ebx,(%esp)
7dc: e8 ef 34 00 00 call 3cd0 <close>
unlink("unlinkread");
7e1: c7 04 24 14 43 00 00 movl $0x4314,(%esp)
7e8: e8 0b 35 00 00 call 3cf8 <unlink>
printf(1, "unlinkread ok\n");
7ed: c7 44 24 04 bc 43 00 movl $0x43bc,0x4(%esp)
7f4: 00
7f5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7fc: e8 df 35 00 00 call 3de0 <printf>
}
801: 83 c4 10 add $0x10,%esp
804: 5b pop %ebx
805: 5e pop %esi
806: 5d pop %ebp
807: c3 ret
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create unlinkread failed\n");
808: c7 44 24 04 1f 43 00 movl $0x431f,0x4(%esp)
80f: 00
810: c7 04 24 01 00 00 00 movl $0x1,(%esp)
817: e8 c4 35 00 00 call 3de0 <printf>
exit();
81c: e8 87 34 00 00 call 3ca8 <exit>
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
printf(1, "unlinkread write failed\n");
821: c7 44 24 04 a3 43 00 movl $0x43a3,0x4(%esp)
828: 00
829: c7 04 24 01 00 00 00 movl $0x1,(%esp)
830: e8 ab 35 00 00 call 3de0 <printf>
exit();
835: e8 6e 34 00 00 call 3ca8 <exit>
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
83a: c7 44 24 04 8c 43 00 movl $0x438c,0x4(%esp)
841: 00
842: c7 04 24 01 00 00 00 movl $0x1,(%esp)
849: e8 92 35 00 00 call 3de0 <printf>
exit();
84e: e8 55 34 00 00 call 3ca8 <exit>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
write(fd1, "yyy", 3);
close(fd1);
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
853: c7 44 24 04 75 43 00 movl $0x4375,0x4(%esp)
85a: 00
85b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
862: e8 79 35 00 00 call 3de0 <printf>
exit();
867: e8 3c 34 00 00 call 3ca8 <exit>
if(fd < 0){
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
86c: c7 44 24 04 57 43 00 movl $0x4357,0x4(%esp)
873: 00
874: c7 04 24 01 00 00 00 movl $0x1,(%esp)
87b: e8 60 35 00 00 call 3de0 <printf>
exit();
880: e8 23 34 00 00 call 3ca8 <exit>
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
if(fd < 0){
printf(1, "open unlinkread failed\n");
885: c7 44 24 04 3f 43 00 movl $0x433f,0x4(%esp)
88c: 00
88d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
894: e8 47 35 00 00 call 3de0 <printf>
exit();
899: e8 0a 34 00 00 call 3ca8 <exit>
89e: 66 90 xchg %ax,%ax
000008a0 <createdelete>:
}
// four processes create and delete different files in same directory
void
createdelete(void)
{
8a0: 55 push %ebp
8a1: 89 e5 mov %esp,%ebp
8a3: 57 push %edi
8a4: 56 push %esi
8a5: 53 push %ebx
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
8a6: 31 db xor %ebx,%ebx
}
// four processes create and delete different files in same directory
void
createdelete(void)
{
8a8: 83 ec 4c sub $0x4c,%esp
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
8ab: c7 44 24 04 cb 43 00 movl $0x43cb,0x4(%esp)
8b2: 00
8b3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8ba: e8 21 35 00 00 call 3de0 <printf>
for(pi = 0; pi < 4; pi++){
pid = fork();
8bf: e8 dc 33 00 00 call 3ca0 <fork>
if(pid < 0){
8c4: 83 f8 00 cmp $0x0,%eax
8c7: 0f 8c c7 01 00 00 jl a94 <createdelete+0x1f4>
8cd: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
8d0: 0f 84 e9 00 00 00 je 9bf <createdelete+0x11f>
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
for(pi = 0; pi < 4; pi++){
8d6: 83 c3 01 add $0x1,%ebx
8d9: 83 fb 04 cmp $0x4,%ebx
8dc: 75 e1 jne 8bf <createdelete+0x1f>
8de: 8d 75 c8 lea -0x38(%ebp),%esi
for(pi = 0; pi < 4; pi++){
wait();
}
name[0] = name[1] = name[2] = 0;
8e1: 31 ff xor %edi,%edi
exit();
}
}
for(pi = 0; pi < 4; pi++){
wait();
8e3: e8 c8 33 00 00 call 3cb0 <wait>
8e8: e8 c3 33 00 00 call 3cb0 <wait>
8ed: e8 be 33 00 00 call 3cb0 <wait>
8f2: e8 b9 33 00 00 call 3cb0 <wait>
}
name[0] = name[1] = name[2] = 0;
8f7: c6 45 ca 00 movb $0x0,-0x36(%ebp)
8fb: 89 75 c0 mov %esi,-0x40(%ebp)
8fe: 66 90 xchg %ax,%ax
for(i = 0; i < N; i++){
900: 8d 47 30 lea 0x30(%edi),%eax
903: 85 ff test %edi,%edi
905: 88 45 c4 mov %al,-0x3c(%ebp)
908: 0f 94 c0 sete %al
90b: 83 ff 09 cmp $0x9,%edi
90e: 0f 9f c2 setg %dl
911: bb 70 00 00 00 mov $0x70,%ebx
916: 89 d6 mov %edx,%esi
918: 09 c6 or %eax,%esi
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
91a: 8d 47 ff lea -0x1(%edi),%eax
91d: 89 45 bc mov %eax,-0x44(%ebp)
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
fd = open(name, 0);
920: 8b 55 c0 mov -0x40(%ebp),%edx
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
923: 0f b6 45 c4 movzbl -0x3c(%ebp),%eax
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
927: 88 5d c8 mov %bl,-0x38(%ebp)
name[1] = '0' + i;
fd = open(name, 0);
92a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
931: 00
932: 89 14 24 mov %edx,(%esp)
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
935: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
938: e8 ab 33 00 00 call 3ce8 <open>
if((i == 0 || i >= N/2) && fd < 0){
93d: 89 f2 mov %esi,%edx
93f: 84 d2 test %dl,%dl
941: 74 08 je 94b <createdelete+0xab>
943: 85 c0 test %eax,%eax
945: 0f 88 f6 00 00 00 js a41 <createdelete+0x1a1>
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
94b: 85 c0 test %eax,%eax
94d: 8d 76 00 lea 0x0(%esi),%esi
950: 0f 89 0b 01 00 00 jns a61 <createdelete+0x1c1>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
close(fd);
956: 83 c3 01 add $0x1,%ebx
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
959: 80 fb 74 cmp $0x74,%bl
95c: 75 c2 jne 920 <createdelete+0x80>
for(pi = 0; pi < 4; pi++){
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
95e: 83 c7 01 add $0x1,%edi
961: 83 ff 14 cmp $0x14,%edi
964: 75 9a jne 900 <createdelete+0x60>
966: 8b 75 c0 mov -0x40(%ebp),%esi
969: bf 70 00 00 00 mov $0x70,%edi
96e: 89 75 c4 mov %esi,-0x3c(%ebp)
971: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
978: 8d 77 c0 lea -0x40(%edi),%esi
97b: 31 db xor %ebx,%ebx
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + i;
97d: 89 fa mov %edi,%edx
name[1] = '0' + i;
97f: 89 f0 mov %esi,%eax
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + i;
981: 88 55 c8 mov %dl,-0x38(%ebp)
name[1] = '0' + i;
unlink(name);
984: 8b 55 c4 mov -0x3c(%ebp),%edx
close(fd);
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
987: 83 c3 01 add $0x1,%ebx
name[0] = 'p' + i;
name[1] = '0' + i;
98a: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
98d: 89 14 24 mov %edx,(%esp)
990: e8 63 33 00 00 call 3cf8 <unlink>
close(fd);
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
995: 83 fb 04 cmp $0x4,%ebx
998: 75 e3 jne 97d <createdelete+0xdd>
99a: 83 c7 01 add $0x1,%edi
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
99d: 89 f8 mov %edi,%eax
99f: 3c 84 cmp $0x84,%al
9a1: 75 d5 jne 978 <createdelete+0xd8>
name[1] = '0' + i;
unlink(name);
}
}
printf(1, "createdelete ok\n");
9a3: c7 44 24 04 ed 43 00 movl $0x43ed,0x4(%esp)
9aa: 00
9ab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
9b2: e8 29 34 00 00 call 3de0 <printf>
}
9b7: 83 c4 4c add $0x4c,%esp
9ba: 5b pop %ebx
9bb: 5e pop %esi
9bc: 5f pop %edi
9bd: 5d pop %ebp
9be: c3 ret
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
9bf: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
9c2: bf 01 00 00 00 mov $0x1,%edi
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
9c7: 88 5d c8 mov %bl,-0x38(%ebp)
9ca: 8d 75 c8 lea -0x38(%ebp),%esi
name[2] = '\0';
9cd: 31 db xor %ebx,%ebx
9cf: c6 45 ca 00 movb $0x0,-0x36(%ebp)
9d3: eb 0e jmp 9e3 <createdelete+0x143>
9d5: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < N; i++){
9d8: 83 ff 13 cmp $0x13,%edi
9db: 7f 7f jg a5c <createdelete+0x1bc>
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
name[2] = '\0';
9dd: 83 c3 01 add $0x1,%ebx
9e0: 83 c7 01 add $0x1,%edi
for(i = 0; i < N; i++){
name[1] = '0' + i;
9e3: 8d 43 30 lea 0x30(%ebx),%eax
9e6: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
9e9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
9f0: 00
9f1: 89 34 24 mov %esi,(%esp)
9f4: e8 ef 32 00 00 call 3ce8 <open>
if(fd < 0){
9f9: 85 c0 test %eax,%eax
9fb: 0f 88 ac 00 00 00 js aad <createdelete+0x20d>
printf(1, "create failed\n");
exit();
}
close(fd);
a01: 89 04 24 mov %eax,(%esp)
a04: e8 c7 32 00 00 call 3cd0 <close>
if(i > 0 && (i % 2 ) == 0){
a09: 85 db test %ebx,%ebx
a0b: 74 d0 je 9dd <createdelete+0x13d>
a0d: f6 c3 01 test $0x1,%bl
a10: 75 c6 jne 9d8 <createdelete+0x138>
name[1] = '0' + (i / 2);
a12: 89 d8 mov %ebx,%eax
a14: d1 f8 sar %eax
a16: 83 c0 30 add $0x30,%eax
a19: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
a1c: 89 34 24 mov %esi,(%esp)
a1f: e8 d4 32 00 00 call 3cf8 <unlink>
a24: 85 c0 test %eax,%eax
a26: 79 b0 jns 9d8 <createdelete+0x138>
printf(1, "unlink failed\n");
a28: c7 44 24 04 de 43 00 movl $0x43de,0x4(%esp)
a2f: 00
a30: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a37: e8 a4 33 00 00 call 3de0 <printf>
exit();
a3c: e8 67 32 00 00 call 3ca8 <exit>
a41: 8b 75 c0 mov -0x40(%ebp),%esi
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
a44: c7 44 24 04 b4 51 00 movl $0x51b4,0x4(%esp)
a4b: 00
a4c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a53: 89 74 24 08 mov %esi,0x8(%esp)
a57: e8 84 33 00 00 call 3de0 <printf>
exit();
a5c: e8 47 32 00 00 call 3ca8 <exit>
} else if((i >= 1 && i < N/2) && fd >= 0){
a61: 83 7d bc 08 cmpl $0x8,-0x44(%ebp)
a65: 76 0d jbe a74 <createdelete+0x1d4>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
close(fd);
a67: 89 04 24 mov %eax,(%esp)
a6a: e8 61 32 00 00 call 3cd0 <close>
a6f: e9 e2 fe ff ff jmp 956 <createdelete+0xb6>
a74: 8b 75 c0 mov -0x40(%ebp),%esi
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
printf(1, "oops createdelete %s did exist\n", name);
a77: c7 44 24 04 d8 51 00 movl $0x51d8,0x4(%esp)
a7e: 00
a7f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a86: 89 74 24 08 mov %esi,0x8(%esp)
a8a: e8 51 33 00 00 call 3de0 <printf>
exit();
a8f: e8 14 32 00 00 call 3ca8 <exit>
printf(1, "createdelete test\n");
for(pi = 0; pi < 4; pi++){
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
a94: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
a9b: 00
a9c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
aa3: e8 38 33 00 00 call 3de0 <printf>
exit();
aa8: e8 fb 31 00 00 call 3ca8 <exit>
name[2] = '\0';
for(i = 0; i < N; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
aad: c7 44 24 04 55 46 00 movl $0x4655,0x4(%esp)
ab4: 00
ab5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
abc: e8 1f 33 00 00 call 3de0 <printf>
exit();
ac1: e8 e2 31 00 00 call 3ca8 <exit>
ac6: 8d 76 00 lea 0x0(%esi),%esi
ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ad0 <createtest>:
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
ad0: 55 push %ebp
ad1: 89 e5 mov %esp,%ebp
ad3: 53 push %ebx
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
ad4: bb 30 00 00 00 mov $0x30,%ebx
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
ad9: 83 ec 14 sub $0x14,%esp
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
adc: a1 0c 59 00 00 mov 0x590c,%eax
ae1: c7 44 24 04 f8 51 00 movl $0x51f8,0x4(%esp)
ae8: 00
ae9: 89 04 24 mov %eax,(%esp)
aec: e8 ef 32 00 00 call 3de0 <printf>
name[0] = 'a';
af1: c6 05 e0 a0 00 00 61 movb $0x61,0xa0e0
name[2] = '\0';
af8: c6 05 e2 a0 00 00 00 movb $0x0,0xa0e2
aff: 90 nop
for(i = 0; i < 52; i++){
name[1] = '0' + i;
b00: 88 1d e1 a0 00 00 mov %bl,0xa0e1
fd = open(name, O_CREATE|O_RDWR);
close(fd);
b06: 83 c3 01 add $0x1,%ebx
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
b09: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
b10: 00
b11: c7 04 24 e0 a0 00 00 movl $0xa0e0,(%esp)
b18: e8 cb 31 00 00 call 3ce8 <open>
close(fd);
b1d: 89 04 24 mov %eax,(%esp)
b20: e8 ab 31 00 00 call 3cd0 <close>
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
b25: 80 fb 64 cmp $0x64,%bl
b28: 75 d6 jne b00 <createtest+0x30>
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
b2a: c6 05 e0 a0 00 00 61 movb $0x61,0xa0e0
name[2] = '\0';
b31: bb 30 00 00 00 mov $0x30,%ebx
b36: c6 05 e2 a0 00 00 00 movb $0x0,0xa0e2
b3d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < 52; i++){
name[1] = '0' + i;
b40: 88 1d e1 a0 00 00 mov %bl,0xa0e1
unlink(name);
b46: 83 c3 01 add $0x1,%ebx
b49: c7 04 24 e0 a0 00 00 movl $0xa0e0,(%esp)
b50: e8 a3 31 00 00 call 3cf8 <unlink>
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
b55: 80 fb 64 cmp $0x64,%bl
b58: 75 e6 jne b40 <createtest+0x70>
name[1] = '0' + i;
unlink(name);
}
printf(stdout, "many creates, followed by unlink; ok\n");
b5a: a1 0c 59 00 00 mov 0x590c,%eax
b5f: c7 44 24 04 20 52 00 movl $0x5220,0x4(%esp)
b66: 00
b67: 89 04 24 mov %eax,(%esp)
b6a: e8 71 32 00 00 call 3de0 <printf>
}
b6f: 83 c4 14 add $0x14,%esp
b72: 5b pop %ebx
b73: 5d pop %ebp
b74: c3 ret
b75: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000b80 <writetest1>:
printf(stdout, "small file test ok\n");
}
void
writetest1(void)
{
b80: 55 push %ebp
b81: 89 e5 mov %esp,%ebp
b83: 56 push %esi
b84: 53 push %ebx
b85: 83 ec 10 sub $0x10,%esp
int i, fd, n;
printf(stdout, "big files test\n");
b88: a1 0c 59 00 00 mov 0x590c,%eax
b8d: c7 44 24 04 fe 43 00 movl $0x43fe,0x4(%esp)
b94: 00
b95: 89 04 24 mov %eax,(%esp)
b98: e8 43 32 00 00 call 3de0 <printf>
fd = open("big", O_CREATE|O_RDWR);
b9d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
ba4: 00
ba5: c7 04 24 78 44 00 00 movl $0x4478,(%esp)
bac: e8 37 31 00 00 call 3ce8 <open>
if(fd < 0){
bb1: 85 c0 test %eax,%eax
{
int i, fd, n;
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
bb3: 89 c6 mov %eax,%esi
if(fd < 0){
bb5: 0f 88 7a 01 00 00 js d35 <writetest1+0x1b5>
printf(stdout, "error: creat big failed!\n");
exit();
bbb: 31 db xor %ebx,%ebx
bbd: 8d 76 00 lea 0x0(%esi),%esi
}
for(i = 0; i < MAXFILE; i++){
((int*)buf)[0] = i;
bc0: 89 1d e0 80 00 00 mov %ebx,0x80e0
if(write(fd, buf, 512) != 512){
bc6: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
bcd: 00
bce: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
bd5: 00
bd6: 89 34 24 mov %esi,(%esp)
bd9: e8 ea 30 00 00 call 3cc8 <write>
bde: 3d 00 02 00 00 cmp $0x200,%eax
be3: 0f 85 b2 00 00 00 jne c9b <writetest1+0x11b>
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++){
be9: 83 c3 01 add $0x1,%ebx
bec: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
bf2: 75 cc jne bc0 <writetest1+0x40>
printf(stdout, "error: write big file failed\n", i);
exit();
}
}
close(fd);
bf4: 89 34 24 mov %esi,(%esp)
bf7: e8 d4 30 00 00 call 3cd0 <close>
fd = open("big", O_RDONLY);
bfc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
c03: 00
c04: c7 04 24 78 44 00 00 movl $0x4478,(%esp)
c0b: e8 d8 30 00 00 call 3ce8 <open>
if(fd < 0){
c10: 85 c0 test %eax,%eax
}
}
close(fd);
fd = open("big", O_RDONLY);
c12: 89 c6 mov %eax,%esi
if(fd < 0){
c14: 0f 88 01 01 00 00 js d1b <writetest1+0x19b>
printf(stdout, "error: open big failed!\n");
exit();
c1a: 31 db xor %ebx,%ebx
c1c: eb 1d jmp c3b <writetest1+0xbb>
c1e: 66 90 xchg %ax,%ax
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512){
c20: 3d 00 02 00 00 cmp $0x200,%eax
c25: 0f 85 b0 00 00 00 jne cdb <writetest1+0x15b>
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
c2b: a1 e0 80 00 00 mov 0x80e0,%eax
c30: 39 d8 cmp %ebx,%eax
c32: 0f 85 81 00 00 00 jne cb9 <writetest1+0x139>
printf(stdout, "read content of block %d is %d\n",
n, ((int*)buf)[0]);
exit();
}
n++;
c38: 83 c3 01 add $0x1,%ebx
exit();
}
n = 0;
for(;;){
i = read(fd, buf, 512);
c3b: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
c42: 00
c43: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
c4a: 00
c4b: 89 34 24 mov %esi,(%esp)
c4e: e8 6d 30 00 00 call 3cc0 <read>
if(i == 0){
c53: 85 c0 test %eax,%eax
c55: 75 c9 jne c20 <writetest1+0xa0>
if(n == MAXFILE - 1){
c57: 81 fb 8b 00 00 00 cmp $0x8b,%ebx
c5d: 0f 84 96 00 00 00 je cf9 <writetest1+0x179>
n, ((int*)buf)[0]);
exit();
}
n++;
}
close(fd);
c63: 89 34 24 mov %esi,(%esp)
c66: e8 65 30 00 00 call 3cd0 <close>
if(unlink("big") < 0){
c6b: c7 04 24 78 44 00 00 movl $0x4478,(%esp)
c72: e8 81 30 00 00 call 3cf8 <unlink>
c77: 85 c0 test %eax,%eax
c79: 0f 88 d0 00 00 00 js d4f <writetest1+0x1cf>
printf(stdout, "unlink big failed\n");
exit();
}
printf(stdout, "big files ok\n");
c7f: a1 0c 59 00 00 mov 0x590c,%eax
c84: c7 44 24 04 9f 44 00 movl $0x449f,0x4(%esp)
c8b: 00
c8c: 89 04 24 mov %eax,(%esp)
c8f: e8 4c 31 00 00 call 3de0 <printf>
}
c94: 83 c4 10 add $0x10,%esp
c97: 5b pop %ebx
c98: 5e pop %esi
c99: 5d pop %ebp
c9a: c3 ret
}
for(i = 0; i < MAXFILE; i++){
((int*)buf)[0] = i;
if(write(fd, buf, 512) != 512){
printf(stdout, "error: write big file failed\n", i);
c9b: a1 0c 59 00 00 mov 0x590c,%eax
ca0: 89 5c 24 08 mov %ebx,0x8(%esp)
ca4: c7 44 24 04 28 44 00 movl $0x4428,0x4(%esp)
cab: 00
cac: 89 04 24 mov %eax,(%esp)
caf: e8 2c 31 00 00 call 3de0 <printf>
exit();
cb4: e8 ef 2f 00 00 call 3ca8 <exit>
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
printf(stdout, "read content of block %d is %d\n",
cb9: 89 44 24 0c mov %eax,0xc(%esp)
cbd: a1 0c 59 00 00 mov 0x590c,%eax
cc2: 89 5c 24 08 mov %ebx,0x8(%esp)
cc6: c7 44 24 04 48 52 00 movl $0x5248,0x4(%esp)
ccd: 00
cce: 89 04 24 mov %eax,(%esp)
cd1: e8 0a 31 00 00 call 3de0 <printf>
n, ((int*)buf)[0]);
exit();
cd6: e8 cd 2f 00 00 call 3ca8 <exit>
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
cdb: 89 44 24 08 mov %eax,0x8(%esp)
cdf: a1 0c 59 00 00 mov 0x590c,%eax
ce4: c7 44 24 04 7c 44 00 movl $0x447c,0x4(%esp)
ceb: 00
cec: 89 04 24 mov %eax,(%esp)
cef: e8 ec 30 00 00 call 3de0 <printf>
exit();
cf4: e8 af 2f 00 00 call 3ca8 <exit>
n = 0;
for(;;){
i = read(fd, buf, 512);
if(i == 0){
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
cf9: a1 0c 59 00 00 mov 0x590c,%eax
cfe: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp)
d05: 00
d06: c7 44 24 04 5f 44 00 movl $0x445f,0x4(%esp)
d0d: 00
d0e: 89 04 24 mov %eax,(%esp)
d11: e8 ca 30 00 00 call 3de0 <printf>
exit();
d16: e8 8d 2f 00 00 call 3ca8 <exit>
close(fd);
fd = open("big", O_RDONLY);
if(fd < 0){
printf(stdout, "error: open big failed!\n");
d1b: a1 0c 59 00 00 mov 0x590c,%eax
d20: c7 44 24 04 46 44 00 movl $0x4446,0x4(%esp)
d27: 00
d28: 89 04 24 mov %eax,(%esp)
d2b: e8 b0 30 00 00 call 3de0 <printf>
exit();
d30: e8 73 2f 00 00 call 3ca8 <exit>
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
d35: a1 0c 59 00 00 mov 0x590c,%eax
d3a: c7 44 24 04 0e 44 00 movl $0x440e,0x4(%esp)
d41: 00
d42: 89 04 24 mov %eax,(%esp)
d45: e8 96 30 00 00 call 3de0 <printf>
exit();
d4a: e8 59 2f 00 00 call 3ca8 <exit>
}
n++;
}
close(fd);
if(unlink("big") < 0){
printf(stdout, "unlink big failed\n");
d4f: a1 0c 59 00 00 mov 0x590c,%eax
d54: c7 44 24 04 8c 44 00 movl $0x448c,0x4(%esp)
d5b: 00
d5c: 89 04 24 mov %eax,(%esp)
d5f: e8 7c 30 00 00 call 3de0 <printf>
exit();
d64: e8 3f 2f 00 00 call 3ca8 <exit>
d69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d70 <writetest>:
printf(stdout, "open test ok\n");
}
void
writetest(void)
{
d70: 55 push %ebp
d71: 89 e5 mov %esp,%ebp
d73: 56 push %esi
d74: 53 push %ebx
d75: 83 ec 10 sub $0x10,%esp
int fd;
int i;
printf(stdout, "small file test\n");
d78: a1 0c 59 00 00 mov 0x590c,%eax
d7d: c7 44 24 04 ad 44 00 movl $0x44ad,0x4(%esp)
d84: 00
d85: 89 04 24 mov %eax,(%esp)
d88: e8 53 30 00 00 call 3de0 <printf>
fd = open("small", O_CREATE|O_RDWR);
d8d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
d94: 00
d95: c7 04 24 be 44 00 00 movl $0x44be,(%esp)
d9c: e8 47 2f 00 00 call 3ce8 <open>
if(fd >= 0){
da1: 85 c0 test %eax,%eax
{
int fd;
int i;
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
da3: 89 c6 mov %eax,%esi
if(fd >= 0){
da5: 0f 88 b1 01 00 00 js f5c <writetest+0x1ec>
printf(stdout, "creat small succeeded; ok\n");
dab: a1 0c 59 00 00 mov 0x590c,%eax
db0: 31 db xor %ebx,%ebx
db2: c7 44 24 04 c4 44 00 movl $0x44c4,0x4(%esp)
db9: 00
dba: 89 04 24 mov %eax,(%esp)
dbd: e8 1e 30 00 00 call 3de0 <printf>
dc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
dc8: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
dcf: 00
dd0: c7 44 24 04 fb 44 00 movl $0x44fb,0x4(%esp)
dd7: 00
dd8: 89 34 24 mov %esi,(%esp)
ddb: e8 e8 2e 00 00 call 3cc8 <write>
de0: 83 f8 0a cmp $0xa,%eax
de3: 0f 85 e9 00 00 00 jne ed2 <writetest+0x162>
printf(stdout, "error: write aa %d new file failed\n", i);
exit();
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
de9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
df0: 00
df1: c7 44 24 04 06 45 00 movl $0x4506,0x4(%esp)
df8: 00
df9: 89 34 24 mov %esi,(%esp)
dfc: e8 c7 2e 00 00 call 3cc8 <write>
e01: 83 f8 0a cmp $0xa,%eax
e04: 0f 85 e6 00 00 00 jne ef0 <writetest+0x180>
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
e0a: 83 c3 01 add $0x1,%ebx
e0d: 83 fb 64 cmp $0x64,%ebx
e10: 75 b6 jne dc8 <writetest+0x58>
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
exit();
}
}
printf(stdout, "writes ok\n");
e12: a1 0c 59 00 00 mov 0x590c,%eax
e17: c7 44 24 04 11 45 00 movl $0x4511,0x4(%esp)
e1e: 00
e1f: 89 04 24 mov %eax,(%esp)
e22: e8 b9 2f 00 00 call 3de0 <printf>
close(fd);
e27: 89 34 24 mov %esi,(%esp)
e2a: e8 a1 2e 00 00 call 3cd0 <close>
fd = open("small", O_RDONLY);
e2f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
e36: 00
e37: c7 04 24 be 44 00 00 movl $0x44be,(%esp)
e3e: e8 a5 2e 00 00 call 3ce8 <open>
if(fd >= 0){
e43: 85 c0 test %eax,%eax
exit();
}
}
printf(stdout, "writes ok\n");
close(fd);
fd = open("small", O_RDONLY);
e45: 89 c3 mov %eax,%ebx
if(fd >= 0){
e47: 0f 88 c1 00 00 00 js f0e <writetest+0x19e>
printf(stdout, "open small succeeded ok\n");
e4d: a1 0c 59 00 00 mov 0x590c,%eax
e52: c7 44 24 04 1c 45 00 movl $0x451c,0x4(%esp)
e59: 00
e5a: 89 04 24 mov %eax,(%esp)
e5d: e8 7e 2f 00 00 call 3de0 <printf>
} else {
printf(stdout, "error: open small failed!\n");
exit();
}
i = read(fd, buf, 2000);
e62: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp)
e69: 00
e6a: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
e71: 00
e72: 89 1c 24 mov %ebx,(%esp)
e75: e8 46 2e 00 00 call 3cc0 <read>
if(i == 2000){
e7a: 3d d0 07 00 00 cmp $0x7d0,%eax
e7f: 0f 85 a3 00 00 00 jne f28 <writetest+0x1b8>
printf(stdout, "read succeeded ok\n");
e85: a1 0c 59 00 00 mov 0x590c,%eax
e8a: c7 44 24 04 50 45 00 movl $0x4550,0x4(%esp)
e91: 00
e92: 89 04 24 mov %eax,(%esp)
e95: e8 46 2f 00 00 call 3de0 <printf>
} else {
printf(stdout, "read failed\n");
exit();
}
close(fd);
e9a: 89 1c 24 mov %ebx,(%esp)
e9d: e8 2e 2e 00 00 call 3cd0 <close>
if(unlink("small") < 0){
ea2: c7 04 24 be 44 00 00 movl $0x44be,(%esp)
ea9: e8 4a 2e 00 00 call 3cf8 <unlink>
eae: 85 c0 test %eax,%eax
eb0: 0f 88 8c 00 00 00 js f42 <writetest+0x1d2>
printf(stdout, "unlink small failed\n");
exit();
}
printf(stdout, "small file test ok\n");
eb6: a1 0c 59 00 00 mov 0x590c,%eax
ebb: c7 44 24 04 78 45 00 movl $0x4578,0x4(%esp)
ec2: 00
ec3: 89 04 24 mov %eax,(%esp)
ec6: e8 15 2f 00 00 call 3de0 <printf>
}
ecb: 83 c4 10 add $0x10,%esp
ece: 5b pop %ebx
ecf: 5e pop %esi
ed0: 5d pop %ebp
ed1: c3 ret
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
printf(stdout, "error: write aa %d new file failed\n", i);
ed2: a1 0c 59 00 00 mov 0x590c,%eax
ed7: 89 5c 24 08 mov %ebx,0x8(%esp)
edb: c7 44 24 04 68 52 00 movl $0x5268,0x4(%esp)
ee2: 00
ee3: 89 04 24 mov %eax,(%esp)
ee6: e8 f5 2e 00 00 call 3de0 <printf>
exit();
eeb: e8 b8 2d 00 00 call 3ca8 <exit>
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
ef0: a1 0c 59 00 00 mov 0x590c,%eax
ef5: 89 5c 24 08 mov %ebx,0x8(%esp)
ef9: c7 44 24 04 8c 52 00 movl $0x528c,0x4(%esp)
f00: 00
f01: 89 04 24 mov %eax,(%esp)
f04: e8 d7 2e 00 00 call 3de0 <printf>
exit();
f09: e8 9a 2d 00 00 call 3ca8 <exit>
close(fd);
fd = open("small", O_RDONLY);
if(fd >= 0){
printf(stdout, "open small succeeded ok\n");
} else {
printf(stdout, "error: open small failed!\n");
f0e: a1 0c 59 00 00 mov 0x590c,%eax
f13: c7 44 24 04 35 45 00 movl $0x4535,0x4(%esp)
f1a: 00
f1b: 89 04 24 mov %eax,(%esp)
f1e: e8 bd 2e 00 00 call 3de0 <printf>
exit();
f23: e8 80 2d 00 00 call 3ca8 <exit>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
} else {
printf(stdout, "read failed\n");
f28: a1 0c 59 00 00 mov 0x590c,%eax
f2d: c7 44 24 04 2c 43 00 movl $0x432c,0x4(%esp)
f34: 00
f35: 89 04 24 mov %eax,(%esp)
f38: e8 a3 2e 00 00 call 3de0 <printf>
exit();
f3d: e8 66 2d 00 00 call 3ca8 <exit>
}
close(fd);
if(unlink("small") < 0){
printf(stdout, "unlink small failed\n");
f42: a1 0c 59 00 00 mov 0x590c,%eax
f47: c7 44 24 04 63 45 00 movl $0x4563,0x4(%esp)
f4e: 00
f4f: 89 04 24 mov %eax,(%esp)
f52: e8 89 2e 00 00 call 3de0 <printf>
exit();
f57: e8 4c 2d 00 00 call 3ca8 <exit>
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
f5c: a1 0c 59 00 00 mov 0x590c,%eax
f61: c7 44 24 04 df 44 00 movl $0x44df,0x4(%esp)
f68: 00
f69: 89 04 24 mov %eax,(%esp)
f6c: e8 6f 2e 00 00 call 3de0 <printf>
exit();
f71: e8 32 2d 00 00 call 3ca8 <exit>
f76: 8d 76 00 lea 0x0(%esi),%esi
f79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000f80 <bigargtest>:
// does exec return an error if the arguments
// are larger than a page? or does it write
// below the stack and wreck the instructions/data?
void
bigargtest(void)
{
f80: 55 push %ebp
f81: 89 e5 mov %esp,%ebp
f83: 83 ec 18 sub $0x18,%esp
int pid, fd;
unlink("bigarg-ok");
f86: c7 04 24 8c 45 00 00 movl $0x458c,(%esp)
f8d: e8 66 2d 00 00 call 3cf8 <unlink>
pid = fork();
f92: e8 09 2d 00 00 call 3ca0 <fork>
if(pid == 0){
f97: 83 f8 00 cmp $0x0,%eax
f9a: 74 44 je fe0 <bigargtest+0x60>
f9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exec("echo", args);
printf(stdout, "bigarg test ok\n");
fd = open("bigarg-ok", O_CREATE);
close(fd);
exit();
} else if(pid < 0){
fa0: 0f 8c d0 00 00 00 jl 1076 <bigargtest+0xf6>
printf(stdout, "bigargtest: fork failed\n");
exit();
}
wait();
fa6: e8 05 2d 00 00 call 3cb0 <wait>
fd = open("bigarg-ok", 0);
fab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
fb2: 00
fb3: c7 04 24 8c 45 00 00 movl $0x458c,(%esp)
fba: e8 29 2d 00 00 call 3ce8 <open>
if(fd < 0){
fbf: 85 c0 test %eax,%eax
fc1: 0f 88 95 00 00 00 js 105c <bigargtest+0xdc>
printf(stdout, "bigarg test failed!\n");
exit();
}
close(fd);
fc7: 89 04 24 mov %eax,(%esp)
fca: e8 01 2d 00 00 call 3cd0 <close>
unlink("bigarg-ok");
fcf: c7 04 24 8c 45 00 00 movl $0x458c,(%esp)
fd6: e8 1d 2d 00 00 call 3cf8 <unlink>
}
fdb: c9 leave
fdc: c3 ret
fdd: 8d 76 00 lea 0x0(%esi),%esi
pid = fork();
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
args[i] = "bigargs test: failed\n ";
fe0: c7 04 85 20 59 00 00 movl $0x52b0,0x5920(,%eax,4)
fe7: b0 52 00 00
unlink("bigarg-ok");
pid = fork();
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
feb: 83 c0 01 add $0x1,%eax
fee: 83 f8 1f cmp $0x1f,%eax
ff1: 75 ed jne fe0 <bigargtest+0x60>
args[i] = "bigargs test: failed\n ";
args[MAXARG-1] = 0;
printf(stdout, "bigarg test\n");
ff3: a1 0c 59 00 00 mov 0x590c,%eax
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
args[i] = "bigargs test: failed\n ";
args[MAXARG-1] = 0;
ff8: c7 05 9c 59 00 00 00 movl $0x0,0x599c
fff: 00 00 00
printf(stdout, "bigarg test\n");
1002: c7 44 24 04 96 45 00 movl $0x4596,0x4(%esp)
1009: 00
100a: 89 04 24 mov %eax,(%esp)
100d: e8 ce 2d 00 00 call 3de0 <printf>
exec("echo", args);
1012: c7 44 24 04 20 59 00 movl $0x5920,0x4(%esp)
1019: 00
101a: c7 04 24 7b 41 00 00 movl $0x417b,(%esp)
1021: e8 ba 2c 00 00 call 3ce0 <exec>
printf(stdout, "bigarg test ok\n");
1026: a1 0c 59 00 00 mov 0x590c,%eax
102b: c7 44 24 04 a3 45 00 movl $0x45a3,0x4(%esp)
1032: 00
1033: 89 04 24 mov %eax,(%esp)
1036: e8 a5 2d 00 00 call 3de0 <printf>
fd = open("bigarg-ok", O_CREATE);
103b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
1042: 00
1043: c7 04 24 8c 45 00 00 movl $0x458c,(%esp)
104a: e8 99 2c 00 00 call 3ce8 <open>
close(fd);
104f: 89 04 24 mov %eax,(%esp)
1052: e8 79 2c 00 00 call 3cd0 <close>
exit();
1057: e8 4c 2c 00 00 call 3ca8 <exit>
exit();
}
wait();
fd = open("bigarg-ok", 0);
if(fd < 0){
printf(stdout, "bigarg test failed!\n");
105c: a1 0c 59 00 00 mov 0x590c,%eax
1061: c7 44 24 04 cc 45 00 movl $0x45cc,0x4(%esp)
1068: 00
1069: 89 04 24 mov %eax,(%esp)
106c: e8 6f 2d 00 00 call 3de0 <printf>
exit();
1071: e8 32 2c 00 00 call 3ca8 <exit>
printf(stdout, "bigarg test ok\n");
fd = open("bigarg-ok", O_CREATE);
close(fd);
exit();
} else if(pid < 0){
printf(stdout, "bigargtest: fork failed\n");
1076: a1 0c 59 00 00 mov 0x590c,%eax
107b: c7 44 24 04 b3 45 00 movl $0x45b3,0x4(%esp)
1082: 00
1083: 89 04 24 mov %eax,(%esp)
1086: e8 55 2d 00 00 call 3de0 <printf>
exit();
108b: e8 18 2c 00 00 call 3ca8 <exit>
00001090 <exectest>:
printf(stdout, "mkdir test ok\n");
}
void
exectest(void)
{
1090: 55 push %ebp
1091: 89 e5 mov %esp,%ebp
1093: 83 ec 18 sub $0x18,%esp
printf(stdout, "exec test\n");
1096: a1 0c 59 00 00 mov 0x590c,%eax
109b: c7 44 24 04 e1 45 00 movl $0x45e1,0x4(%esp)
10a2: 00
10a3: 89 04 24 mov %eax,(%esp)
10a6: e8 35 2d 00 00 call 3de0 <printf>
if(exec("echo", echoargv) < 0){
10ab: c7 44 24 04 f8 58 00 movl $0x58f8,0x4(%esp)
10b2: 00
10b3: c7 04 24 7b 41 00 00 movl $0x417b,(%esp)
10ba: e8 21 2c 00 00 call 3ce0 <exec>
10bf: 85 c0 test %eax,%eax
10c1: 78 02 js 10c5 <exectest+0x35>
printf(stdout, "exec echo failed\n");
exit();
}
}
10c3: c9 leave
10c4: c3 ret
void
exectest(void)
{
printf(stdout, "exec test\n");
if(exec("echo", echoargv) < 0){
printf(stdout, "exec echo failed\n");
10c5: a1 0c 59 00 00 mov 0x590c,%eax
10ca: c7 44 24 04 ec 45 00 movl $0x45ec,0x4(%esp)
10d1: 00
10d2: 89 04 24 mov %eax,(%esp)
10d5: e8 06 2d 00 00 call 3de0 <printf>
exit();
10da: e8 c9 2b 00 00 call 3ca8 <exit>
10df: 90 nop
000010e0 <validatetest>:
"ebx");
}
void
validatetest(void)
{
10e0: 55 push %ebp
10e1: 89 e5 mov %esp,%ebp
10e3: 56 push %esi
10e4: 53 push %ebx
int hi, pid;
uint p;
printf(stdout, "validate test\n");
10e5: 31 db xor %ebx,%ebx
"ebx");
}
void
validatetest(void)
{
10e7: 83 ec 10 sub $0x10,%esp
int hi, pid;
uint p;
printf(stdout, "validate test\n");
10ea: a1 0c 59 00 00 mov 0x590c,%eax
10ef: c7 44 24 04 fe 45 00 movl $0x45fe,0x4(%esp)
10f6: 00
10f7: 89 04 24 mov %eax,(%esp)
10fa: e8 e1 2c 00 00 call 3de0 <printf>
10ff: 90 nop
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){
if((pid = fork()) == 0){
1100: e8 9b 2b 00 00 call 3ca0 <fork>
1105: 85 c0 test %eax,%eax
1107: 89 c6 mov %eax,%esi
1109: 74 79 je 1184 <validatetest+0xa4>
// try to crash the kernel by passing in a badly placed integer
validateint((int*)p);
exit();
}
sleep(0);
110b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1112: e8 21 2c 00 00 call 3d38 <sleep>
sleep(0);
1117: c7 04 24 00 00 00 00 movl $0x0,(%esp)
111e: e8 15 2c 00 00 call 3d38 <sleep>
kill(pid);
1123: 89 34 24 mov %esi,(%esp)
1126: e8 ad 2b 00 00 call 3cd8 <kill>
wait();
112b: e8 80 2b 00 00 call 3cb0 <wait>
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
1130: 89 5c 24 04 mov %ebx,0x4(%esp)
1134: c7 04 24 0d 46 00 00 movl $0x460d,(%esp)
113b: e8 c8 2b 00 00 call 3d08 <link>
1140: 83 f8 ff cmp $0xffffffff,%eax
1143: 75 2a jne 116f <validatetest+0x8f>
uint p;
printf(stdout, "validate test\n");
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){
1145: 81 c3 00 10 00 00 add $0x1000,%ebx
114b: 81 fb 00 40 11 00 cmp $0x114000,%ebx
1151: 75 ad jne 1100 <validatetest+0x20>
printf(stdout, "link should not succeed\n");
exit();
}
}
printf(stdout, "validate ok\n");
1153: a1 0c 59 00 00 mov 0x590c,%eax
1158: c7 44 24 04 31 46 00 movl $0x4631,0x4(%esp)
115f: 00
1160: 89 04 24 mov %eax,(%esp)
1163: e8 78 2c 00 00 call 3de0 <printf>
}
1168: 83 c4 10 add $0x10,%esp
116b: 5b pop %ebx
116c: 5e pop %esi
116d: 5d pop %ebp
116e: c3 ret
kill(pid);
wait();
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
printf(stdout, "link should not succeed\n");
116f: a1 0c 59 00 00 mov 0x590c,%eax
1174: c7 44 24 04 18 46 00 movl $0x4618,0x4(%esp)
117b: 00
117c: 89 04 24 mov %eax,(%esp)
117f: e8 5c 2c 00 00 call 3de0 <printf>
exit();
1184: e8 1f 2b 00 00 call 3ca8 <exit>
1189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001190 <bigdir>:
}
// directory that uses indirect blocks
void
bigdir(void)
{
1190: 55 push %ebp
1191: 89 e5 mov %esp,%ebp
1193: 56 push %esi
1194: 53 push %ebx
1195: 83 ec 20 sub $0x20,%esp
int i, fd;
char name[10];
printf(1, "bigdir test\n");
1198: c7 44 24 04 3e 46 00 movl $0x463e,0x4(%esp)
119f: 00
11a0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
11a7: e8 34 2c 00 00 call 3de0 <printf>
unlink("bd");
11ac: c7 04 24 4b 46 00 00 movl $0x464b,(%esp)
11b3: e8 40 2b 00 00 call 3cf8 <unlink>
fd = open("bd", O_CREATE);
11b8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
11bf: 00
11c0: c7 04 24 4b 46 00 00 movl $0x464b,(%esp)
11c7: e8 1c 2b 00 00 call 3ce8 <open>
if(fd < 0){
11cc: 85 c0 test %eax,%eax
11ce: 0f 88 e6 00 00 00 js 12ba <bigdir+0x12a>
printf(1, "bigdir create failed\n");
exit();
}
close(fd);
11d4: 89 04 24 mov %eax,(%esp)
11d7: 31 db xor %ebx,%ebx
11d9: e8 f2 2a 00 00 call 3cd0 <close>
11de: 8d 75 ee lea -0x12(%ebp),%esi
11e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 500; i++){
name[0] = 'x';
name[1] = '0' + (i / 64);
11e8: 89 d8 mov %ebx,%eax
11ea: c1 f8 06 sar $0x6,%eax
11ed: 83 c0 30 add $0x30,%eax
11f0: 88 45 ef mov %al,-0x11(%ebp)
name[2] = '0' + (i % 64);
11f3: 89 d8 mov %ebx,%eax
11f5: 83 e0 3f and $0x3f,%eax
11f8: 83 c0 30 add $0x30,%eax
exit();
}
close(fd);
for(i = 0; i < 500; i++){
name[0] = 'x';
11fb: c6 45 ee 78 movb $0x78,-0x12(%ebp)
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
11ff: 88 45 f0 mov %al,-0x10(%ebp)
name[3] = '\0';
1202: c6 45 f1 00 movb $0x0,-0xf(%ebp)
if(link("bd", name) != 0){
1206: 89 74 24 04 mov %esi,0x4(%esp)
120a: c7 04 24 4b 46 00 00 movl $0x464b,(%esp)
1211: e8 f2 2a 00 00 call 3d08 <link>
1216: 85 c0 test %eax,%eax
1218: 75 6e jne 1288 <bigdir+0xf8>
printf(1, "bigdir create failed\n");
exit();
}
close(fd);
for(i = 0; i < 500; i++){
121a: 83 c3 01 add $0x1,%ebx
121d: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1223: 75 c3 jne 11e8 <bigdir+0x58>
printf(1, "bigdir link failed\n");
exit();
}
}
unlink("bd");
1225: c7 04 24 4b 46 00 00 movl $0x464b,(%esp)
122c: 66 31 db xor %bx,%bx
122f: e8 c4 2a 00 00 call 3cf8 <unlink>
1234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 500; i++){
name[0] = 'x';
name[1] = '0' + (i / 64);
1238: 89 d8 mov %ebx,%eax
123a: c1 f8 06 sar $0x6,%eax
123d: 83 c0 30 add $0x30,%eax
1240: 88 45 ef mov %al,-0x11(%ebp)
name[2] = '0' + (i % 64);
1243: 89 d8 mov %ebx,%eax
1245: 83 e0 3f and $0x3f,%eax
1248: 83 c0 30 add $0x30,%eax
}
}
unlink("bd");
for(i = 0; i < 500; i++){
name[0] = 'x';
124b: c6 45 ee 78 movb $0x78,-0x12(%ebp)
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
124f: 88 45 f0 mov %al,-0x10(%ebp)
name[3] = '\0';
1252: c6 45 f1 00 movb $0x0,-0xf(%ebp)
if(unlink(name) != 0){
1256: 89 34 24 mov %esi,(%esp)
1259: e8 9a 2a 00 00 call 3cf8 <unlink>
125e: 85 c0 test %eax,%eax
1260: 75 3f jne 12a1 <bigdir+0x111>
exit();
}
}
unlink("bd");
for(i = 0; i < 500; i++){
1262: 83 c3 01 add $0x1,%ebx
1265: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
126b: 75 cb jne 1238 <bigdir+0xa8>
printf(1, "bigdir unlink failed");
exit();
}
}
printf(1, "bigdir ok\n");
126d: c7 44 24 04 8d 46 00 movl $0x468d,0x4(%esp)
1274: 00
1275: c7 04 24 01 00 00 00 movl $0x1,(%esp)
127c: e8 5f 2b 00 00 call 3de0 <printf>
}
1281: 83 c4 20 add $0x20,%esp
1284: 5b pop %ebx
1285: 5e pop %esi
1286: 5d pop %ebp
1287: c3 ret
name[0] = 'x';
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
name[3] = '\0';
if(link("bd", name) != 0){
printf(1, "bigdir link failed\n");
1288: c7 44 24 04 64 46 00 movl $0x4664,0x4(%esp)
128f: 00
1290: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1297: e8 44 2b 00 00 call 3de0 <printf>
exit();
129c: e8 07 2a 00 00 call 3ca8 <exit>
name[0] = 'x';
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
name[3] = '\0';
if(unlink(name) != 0){
printf(1, "bigdir unlink failed");
12a1: c7 44 24 04 78 46 00 movl $0x4678,0x4(%esp)
12a8: 00
12a9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12b0: e8 2b 2b 00 00 call 3de0 <printf>
exit();
12b5: e8 ee 29 00 00 call 3ca8 <exit>
printf(1, "bigdir test\n");
unlink("bd");
fd = open("bd", O_CREATE);
if(fd < 0){
printf(1, "bigdir create failed\n");
12ba: c7 44 24 04 4e 46 00 movl $0x464e,0x4(%esp)
12c1: 00
12c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12c9: e8 12 2b 00 00 call 3de0 <printf>
exit();
12ce: e8 d5 29 00 00 call 3ca8 <exit>
12d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000012e0 <linkunlink>:
// another concurrent link/unlink/create test,
// to look for deadlocks.
void
linkunlink()
{
12e0: 55 push %ebp
12e1: 89 e5 mov %esp,%ebp
12e3: 57 push %edi
12e4: 56 push %esi
12e5: 53 push %ebx
12e6: 83 ec 2c sub $0x2c,%esp
int pid, i;
printf(1, "linkunlink test\n");
12e9: c7 44 24 04 98 46 00 movl $0x4698,0x4(%esp)
12f0: 00
12f1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12f8: e8 e3 2a 00 00 call 3de0 <printf>
unlink("x");
12fd: c7 04 24 75 4d 00 00 movl $0x4d75,(%esp)
1304: e8 ef 29 00 00 call 3cf8 <unlink>
pid = fork();
1309: e8 92 29 00 00 call 3ca0 <fork>
if(pid < 0){
130e: 85 c0 test %eax,%eax
int pid, i;
printf(1, "linkunlink test\n");
unlink("x");
pid = fork();
1310: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1313: 0f 88 b0 00 00 00 js 13c9 <linkunlink+0xe9>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
1319: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
131d: bf ab aa aa aa mov $0xaaaaaaab,%edi
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
1322: 19 db sbb %ebx,%ebx
1324: 31 f6 xor %esi,%esi
1326: 83 e3 60 and $0x60,%ebx
1329: 83 c3 01 add $0x1,%ebx
132c: eb 1b jmp 1349 <linkunlink+0x69>
132e: 66 90 xchg %ax,%ax
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
} else if((x % 3) == 1){
1330: 83 f8 01 cmp $0x1,%eax
1333: 74 7b je 13b0 <linkunlink+0xd0>
link("cat", "x");
} else {
unlink("x");
1335: c7 04 24 75 4d 00 00 movl $0x4d75,(%esp)
133c: e8 b7 29 00 00 call 3cf8 <unlink>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1341: 83 c6 01 add $0x1,%esi
1344: 83 fe 64 cmp $0x64,%esi
1347: 74 3f je 1388 <linkunlink+0xa8>
x = x * 1103515245 + 12345;
1349: 69 db 6d 4e c6 41 imul $0x41c64e6d,%ebx,%ebx
134f: 81 c3 39 30 00 00 add $0x3039,%ebx
if((x % 3) == 0){
1355: 89 d8 mov %ebx,%eax
1357: f7 e7 mul %edi
1359: 89 d8 mov %ebx,%eax
135b: d1 ea shr %edx
135d: 8d 14 52 lea (%edx,%edx,2),%edx
1360: 29 d0 sub %edx,%eax
1362: 75 cc jne 1330 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1364: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
136b: 00
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
136c: 83 c6 01 add $0x1,%esi
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
136f: c7 04 24 75 4d 00 00 movl $0x4d75,(%esp)
1376: e8 6d 29 00 00 call 3ce8 <open>
137b: 89 04 24 mov %eax,(%esp)
137e: e8 4d 29 00 00 call 3cd0 <close>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1383: 83 fe 64 cmp $0x64,%esi
1386: 75 c1 jne 1349 <linkunlink+0x69>
} else {
unlink("x");
}
}
if(pid)
1388: 8b 45 e4 mov -0x1c(%ebp),%eax
138b: 85 c0 test %eax,%eax
138d: 74 53 je 13e2 <linkunlink+0x102>
wait();
138f: e8 1c 29 00 00 call 3cb0 <wait>
else
exit();
printf(1, "linkunlink ok\n");
1394: c7 44 24 04 ad 46 00 movl $0x46ad,0x4(%esp)
139b: 00
139c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
13a3: e8 38 2a 00 00 call 3de0 <printf>
}
13a8: 83 c4 2c add $0x2c,%esp
13ab: 5b pop %ebx
13ac: 5e pop %esi
13ad: 5f pop %edi
13ae: 5d pop %ebp
13af: c3 ret
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
} else if((x % 3) == 1){
link("cat", "x");
13b0: c7 44 24 04 75 4d 00 movl $0x4d75,0x4(%esp)
13b7: 00
13b8: c7 04 24 a9 46 00 00 movl $0x46a9,(%esp)
13bf: e8 44 29 00 00 call 3d08 <link>
13c4: e9 78 ff ff ff jmp 1341 <linkunlink+0x61>
printf(1, "linkunlink test\n");
unlink("x");
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
13c9: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
13d0: 00
13d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
13d8: e8 03 2a 00 00 call 3de0 <printf>
exit();
13dd: e8 c6 28 00 00 call 3ca8 <exit>
}
if(pid)
wait();
else
exit();
13e2: e8 c1 28 00 00 call 3ca8 <exit>
13e7: 89 f6 mov %esi,%esi
13e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000013f0 <linktest>:
printf(1, "unlinkread ok\n");
}
void
linktest(void)
{
13f0: 55 push %ebp
13f1: 89 e5 mov %esp,%ebp
13f3: 53 push %ebx
13f4: 83 ec 14 sub $0x14,%esp
int fd;
printf(1, "linktest\n");
13f7: c7 44 24 04 bc 46 00 movl $0x46bc,0x4(%esp)
13fe: 00
13ff: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1406: e8 d5 29 00 00 call 3de0 <printf>
unlink("lf1");
140b: c7 04 24 c6 46 00 00 movl $0x46c6,(%esp)
1412: e8 e1 28 00 00 call 3cf8 <unlink>
unlink("lf2");
1417: c7 04 24 ca 46 00 00 movl $0x46ca,(%esp)
141e: e8 d5 28 00 00 call 3cf8 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
1423: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
142a: 00
142b: c7 04 24 c6 46 00 00 movl $0x46c6,(%esp)
1432: e8 b1 28 00 00 call 3ce8 <open>
if(fd < 0){
1437: 85 c0 test %eax,%eax
printf(1, "linktest\n");
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
1439: 89 c3 mov %eax,%ebx
if(fd < 0){
143b: 0f 88 26 01 00 00 js 1567 <linktest+0x177>
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
1441: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
1448: 00
1449: c7 44 24 04 39 43 00 movl $0x4339,0x4(%esp)
1450: 00
1451: 89 04 24 mov %eax,(%esp)
1454: e8 6f 28 00 00 call 3cc8 <write>
1459: 83 f8 05 cmp $0x5,%eax
145c: 0f 85 cd 01 00 00 jne 162f <linktest+0x23f>
printf(1, "write lf1 failed\n");
exit();
}
close(fd);
1462: 89 1c 24 mov %ebx,(%esp)
1465: e8 66 28 00 00 call 3cd0 <close>
if(link("lf1", "lf2") < 0){
146a: c7 44 24 04 ca 46 00 movl $0x46ca,0x4(%esp)
1471: 00
1472: c7 04 24 c6 46 00 00 movl $0x46c6,(%esp)
1479: e8 8a 28 00 00 call 3d08 <link>
147e: 85 c0 test %eax,%eax
1480: 0f 88 90 01 00 00 js 1616 <linktest+0x226>
printf(1, "link lf1 lf2 failed\n");
exit();
}
unlink("lf1");
1486: c7 04 24 c6 46 00 00 movl $0x46c6,(%esp)
148d: e8 66 28 00 00 call 3cf8 <unlink>
if(open("lf1", 0) >= 0){
1492: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1499: 00
149a: c7 04 24 c6 46 00 00 movl $0x46c6,(%esp)
14a1: e8 42 28 00 00 call 3ce8 <open>
14a6: 85 c0 test %eax,%eax
14a8: 0f 89 4f 01 00 00 jns 15fd <linktest+0x20d>
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
14ae: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
14b5: 00
14b6: c7 04 24 ca 46 00 00 movl $0x46ca,(%esp)
14bd: e8 26 28 00 00 call 3ce8 <open>
if(fd < 0){
14c2: 85 c0 test %eax,%eax
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
14c4: 89 c3 mov %eax,%ebx
if(fd < 0){
14c6: 0f 88 18 01 00 00 js 15e4 <linktest+0x1f4>
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
14cc: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
14d3: 00
14d4: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
14db: 00
14dc: 89 04 24 mov %eax,(%esp)
14df: e8 dc 27 00 00 call 3cc0 <read>
14e4: 83 f8 05 cmp $0x5,%eax
14e7: 0f 85 de 00 00 00 jne 15cb <linktest+0x1db>
printf(1, "read lf2 failed\n");
exit();
}
close(fd);
14ed: 89 1c 24 mov %ebx,(%esp)
14f0: e8 db 27 00 00 call 3cd0 <close>
if(link("lf2", "lf2") >= 0){
14f5: c7 44 24 04 ca 46 00 movl $0x46ca,0x4(%esp)
14fc: 00
14fd: c7 04 24 ca 46 00 00 movl $0x46ca,(%esp)
1504: e8 ff 27 00 00 call 3d08 <link>
1509: 85 c0 test %eax,%eax
150b: 0f 89 a1 00 00 00 jns 15b2 <linktest+0x1c2>
printf(1, "link lf2 lf2 succeeded! oops\n");
exit();
}
unlink("lf2");
1511: c7 04 24 ca 46 00 00 movl $0x46ca,(%esp)
1518: e8 db 27 00 00 call 3cf8 <unlink>
if(link("lf2", "lf1") >= 0){
151d: c7 44 24 04 c6 46 00 movl $0x46c6,0x4(%esp)
1524: 00
1525: c7 04 24 ca 46 00 00 movl $0x46ca,(%esp)
152c: e8 d7 27 00 00 call 3d08 <link>
1531: 85 c0 test %eax,%eax
1533: 79 64 jns 1599 <linktest+0x1a9>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
1535: c7 44 24 04 c6 46 00 movl $0x46c6,0x4(%esp)
153c: 00
153d: c7 04 24 92 4c 00 00 movl $0x4c92,(%esp)
1544: e8 bf 27 00 00 call 3d08 <link>
1549: 85 c0 test %eax,%eax
154b: 79 33 jns 1580 <linktest+0x190>
printf(1, "link . lf1 succeeded! oops\n");
exit();
}
printf(1, "linktest ok\n");
154d: c7 44 24 04 64 47 00 movl $0x4764,0x4(%esp)
1554: 00
1555: c7 04 24 01 00 00 00 movl $0x1,(%esp)
155c: e8 7f 28 00 00 call 3de0 <printf>
}
1561: 83 c4 14 add $0x14,%esp
1564: 5b pop %ebx
1565: 5d pop %ebp
1566: c3 ret
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "create lf1 failed\n");
1567: c7 44 24 04 ce 46 00 movl $0x46ce,0x4(%esp)
156e: 00
156f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1576: e8 65 28 00 00 call 3de0 <printf>
exit();
157b: e8 28 27 00 00 call 3ca8 <exit>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
printf(1, "link . lf1 succeeded! oops\n");
1580: c7 44 24 04 48 47 00 movl $0x4748,0x4(%esp)
1587: 00
1588: c7 04 24 01 00 00 00 movl $0x1,(%esp)
158f: e8 4c 28 00 00 call 3de0 <printf>
exit();
1594: e8 0f 27 00 00 call 3ca8 <exit>
exit();
}
unlink("lf2");
if(link("lf2", "lf1") >= 0){
printf(1, "link non-existant succeeded! oops\n");
1599: c7 44 24 04 b8 53 00 movl $0x53b8,0x4(%esp)
15a0: 00
15a1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15a8: e8 33 28 00 00 call 3de0 <printf>
exit();
15ad: e8 f6 26 00 00 call 3ca8 <exit>
exit();
}
close(fd);
if(link("lf2", "lf2") >= 0){
printf(1, "link lf2 lf2 succeeded! oops\n");
15b2: c7 44 24 04 2a 47 00 movl $0x472a,0x4(%esp)
15b9: 00
15ba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15c1: e8 1a 28 00 00 call 3de0 <printf>
exit();
15c6: e8 dd 26 00 00 call 3ca8 <exit>
if(fd < 0){
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "read lf2 failed\n");
15cb: c7 44 24 04 19 47 00 movl $0x4719,0x4(%esp)
15d2: 00
15d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15da: e8 01 28 00 00 call 3de0 <printf>
exit();
15df: e8 c4 26 00 00 call 3ca8 <exit>
exit();
}
fd = open("lf2", 0);
if(fd < 0){
printf(1, "open lf2 failed\n");
15e4: c7 44 24 04 08 47 00 movl $0x4708,0x4(%esp)
15eb: 00
15ec: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15f3: e8 e8 27 00 00 call 3de0 <printf>
exit();
15f8: e8 ab 26 00 00 call 3ca8 <exit>
exit();
}
unlink("lf1");
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
15fd: c7 44 24 04 90 53 00 movl $0x5390,0x4(%esp)
1604: 00
1605: c7 04 24 01 00 00 00 movl $0x1,(%esp)
160c: e8 cf 27 00 00 call 3de0 <printf>
exit();
1611: e8 92 26 00 00 call 3ca8 <exit>
exit();
}
close(fd);
if(link("lf1", "lf2") < 0){
printf(1, "link lf1 lf2 failed\n");
1616: c7 44 24 04 f3 46 00 movl $0x46f3,0x4(%esp)
161d: 00
161e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1625: e8 b6 27 00 00 call 3de0 <printf>
exit();
162a: e8 79 26 00 00 call 3ca8 <exit>
if(fd < 0){
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
printf(1, "write lf1 failed\n");
162f: c7 44 24 04 e1 46 00 movl $0x46e1,0x4(%esp)
1636: 00
1637: c7 04 24 01 00 00 00 movl $0x1,(%esp)
163e: e8 9d 27 00 00 call 3de0 <printf>
exit();
1643: e8 60 26 00 00 call 3ca8 <exit>
1648: 90 nop
1649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001650 <sbrktest>:
printf(1, "fork test OK\n");
}
void
sbrktest(void)
{
1650: 55 push %ebp
1651: 89 e5 mov %esp,%ebp
1653: 57 push %edi
1654: 56 push %esi
printf(stdout, "sbrk test\n");
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
1655: 31 f6 xor %esi,%esi
printf(1, "fork test OK\n");
}
void
sbrktest(void)
{
1657: 53 push %ebx
1658: 83 ec 7c sub $0x7c,%esp
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(stdout, "sbrk test\n");
165b: a1 0c 59 00 00 mov 0x590c,%eax
1660: c7 44 24 04 71 47 00 movl $0x4771,0x4(%esp)
1667: 00
1668: 89 04 24 mov %eax,(%esp)
166b: e8 70 27 00 00 call 3de0 <printf>
oldbrk = sbrk(0);
1670: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1677: e8 b4 26 00 00 call 3d30 <sbrk>
// can one sbrk() less than a page?
a = sbrk(0);
167c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(stdout, "sbrk test\n");
oldbrk = sbrk(0);
1683: 89 45 a4 mov %eax,-0x5c(%ebp)
// can one sbrk() less than a page?
a = sbrk(0);
1686: e8 a5 26 00 00 call 3d30 <sbrk>
168b: 89 c3 mov %eax,%ebx
168d: 8d 76 00 lea 0x0(%esi),%esi
int i;
for(i = 0; i < 5000; i++){
b = sbrk(1);
1690: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1697: e8 94 26 00 00 call 3d30 <sbrk>
if(b != a){
169c: 39 c3 cmp %eax,%ebx
169e: 0f 85 82 02 00 00 jne 1926 <sbrktest+0x2d6>
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
16a4: 83 c6 01 add $0x1,%esi
b = sbrk(1);
if(b != a){
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
exit();
}
*b = 1;
16a7: c6 03 01 movb $0x1,(%ebx)
a = b + 1;
16aa: 83 c3 01 add $0x1,%ebx
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
16ad: 81 fe 88 13 00 00 cmp $0x1388,%esi
16b3: 75 db jne 1690 <sbrktest+0x40>
exit();
}
*b = 1;
a = b + 1;
}
pid = fork();
16b5: e8 e6 25 00 00 call 3ca0 <fork>
if(pid < 0){
16ba: 85 c0 test %eax,%eax
exit();
}
*b = 1;
a = b + 1;
}
pid = fork();
16bc: 89 c6 mov %eax,%esi
if(pid < 0){
16be: 0f 88 d0 03 00 00 js 1a94 <sbrktest+0x444>
printf(stdout, "sbrk test fork failed\n");
exit();
}
c = sbrk(1);
16c4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c = sbrk(1);
if(c != a + 1){
16cb: 83 c3 01 add $0x1,%ebx
pid = fork();
if(pid < 0){
printf(stdout, "sbrk test fork failed\n");
exit();
}
c = sbrk(1);
16ce: e8 5d 26 00 00 call 3d30 <sbrk>
c = sbrk(1);
16d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
16da: e8 51 26 00 00 call 3d30 <sbrk>
if(c != a + 1){
16df: 39 d8 cmp %ebx,%eax
16e1: 0f 85 93 03 00 00 jne 1a7a <sbrktest+0x42a>
printf(stdout, "sbrk test failed post-fork\n");
exit();
}
if(pid == 0)
16e7: 85 f6 test %esi,%esi
16e9: 0f 84 86 03 00 00 je 1a75 <sbrktest+0x425>
16ef: 90 nop
exit();
wait();
16f0: e8 bb 25 00 00 call 3cb0 <wait>
// can one grow address space to something big?
#define BIG (100*1024*1024)
a = sbrk(0);
16f5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
16fc: e8 2f 26 00 00 call 3d30 <sbrk>
1701: 89 c3 mov %eax,%ebx
amt = (BIG) - (uint)a;
p = sbrk(amt);
1703: b8 00 00 40 06 mov $0x6400000,%eax
1708: 29 d8 sub %ebx,%eax
170a: 89 04 24 mov %eax,(%esp)
170d: e8 1e 26 00 00 call 3d30 <sbrk>
if (p != a) {
1712: 39 c3 cmp %eax,%ebx
1714: 0f 85 46 03 00 00 jne 1a60 <sbrktest+0x410>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
exit();
}
lastaddr = (char*) (BIG-1);
*lastaddr = 99;
171a: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
// can one de-allocate?
a = sbrk(0);
1721: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1728: e8 03 26 00 00 call 3d30 <sbrk>
c = sbrk(-4096);
172d: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
}
lastaddr = (char*) (BIG-1);
*lastaddr = 99;
// can one de-allocate?
a = sbrk(0);
1734: 89 c3 mov %eax,%ebx
c = sbrk(-4096);
1736: e8 f5 25 00 00 call 3d30 <sbrk>
if(c == (char*)0xffffffff){
173b: 83 f8 ff cmp $0xffffffff,%eax
173e: 0f 84 02 03 00 00 je 1a46 <sbrktest+0x3f6>
printf(stdout, "sbrk could not deallocate\n");
exit();
}
c = sbrk(0);
1744: c7 04 24 00 00 00 00 movl $0x0,(%esp)
174b: e8 e0 25 00 00 call 3d30 <sbrk>
if(c != a - 4096){
1750: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx
1756: 39 d0 cmp %edx,%eax
1758: 0f 85 c6 02 00 00 jne 1a24 <sbrktest+0x3d4>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
exit();
}
// can one re-allocate that page?
a = sbrk(0);
175e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1765: e8 c6 25 00 00 call 3d30 <sbrk>
c = sbrk(4096);
176a: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
exit();
}
// can one re-allocate that page?
a = sbrk(0);
1771: 89 c3 mov %eax,%ebx
c = sbrk(4096);
1773: e8 b8 25 00 00 call 3d30 <sbrk>
if(c != a || sbrk(0) != a + 4096){
1778: 39 c3 cmp %eax,%ebx
exit();
}
// can one re-allocate that page?
a = sbrk(0);
c = sbrk(4096);
177a: 89 c6 mov %eax,%esi
if(c != a || sbrk(0) != a + 4096){
177c: 0f 85 80 02 00 00 jne 1a02 <sbrktest+0x3b2>
1782: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1789: e8 a2 25 00 00 call 3d30 <sbrk>
178e: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx
1794: 39 d0 cmp %edx,%eax
1796: 0f 85 66 02 00 00 jne 1a02 <sbrktest+0x3b2>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
exit();
}
if(*lastaddr == 99){
179c: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
17a3: 0f 84 3f 02 00 00 je 19e8 <sbrktest+0x398>
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17a9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
c = sbrk(-(sbrk(0) - oldbrk));
if(c != a){
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
17b0: bb 00 00 00 80 mov $0x80000000,%ebx
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17b5: e8 76 25 00 00 call 3d30 <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
17ba: c7 04 24 00 00 00 00 movl $0x0,(%esp)
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17c1: 89 c6 mov %eax,%esi
c = sbrk(-(sbrk(0) - oldbrk));
17c3: e8 68 25 00 00 call 3d30 <sbrk>
17c8: 8b 55 a4 mov -0x5c(%ebp),%edx
17cb: 29 c2 sub %eax,%edx
17cd: 89 14 24 mov %edx,(%esp)
17d0: e8 5b 25 00 00 call 3d30 <sbrk>
if(c != a){
17d5: 39 c6 cmp %eax,%esi
17d7: 0f 85 e9 01 00 00 jne 19c6 <sbrktest+0x376>
17dd: 8d 76 00 lea 0x0(%esi),%esi
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
ppid = getpid();
17e0: e8 43 25 00 00 call 3d28 <getpid>
17e5: 89 c6 mov %eax,%esi
pid = fork();
17e7: e8 b4 24 00 00 call 3ca0 <fork>
if(pid < 0){
17ec: 83 f8 00 cmp $0x0,%eax
17ef: 0f 8c b7 01 00 00 jl 19ac <sbrktest+0x35c>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
17f5: 0f 84 84 01 00 00 je 197f <sbrktest+0x32f>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
17fb: 81 c3 50 c3 00 00 add $0xc350,%ebx
if(pid == 0){
printf(stdout, "oops could read %x = %x\n", a, *a);
kill(ppid);
exit();
}
wait();
1801: e8 aa 24 00 00 call 3cb0 <wait>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
1806: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx
180c: 75 d2 jne 17e0 <sbrktest+0x190>
wait();
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
180e: 8d 45 dc lea -0x24(%ebp),%eax
1811: 89 04 24 mov %eax,(%esp)
1814: e8 9f 24 00 00 call 3cb8 <pipe>
1819: 85 c0 test %eax,%eax
181b: 0f 85 45 01 00 00 jne 1966 <sbrktest+0x316>
printf(1, "pipe() failed\n");
exit();
1821: 31 db xor %ebx,%ebx
1823: 8d 7d b4 lea -0x4c(%ebp),%edi
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
1826: e8 75 24 00 00 call 3ca0 <fork>
182b: 85 c0 test %eax,%eax
182d: 89 c6 mov %eax,%esi
182f: 0f 84 a7 00 00 00 je 18dc <sbrktest+0x28c>
sbrk(BIG - (uint)sbrk(0));
write(fds[1], "x", 1);
// sit around until killed
for(;;) sleep(1000);
}
if(pids[i] != -1)
1835: 83 f8 ff cmp $0xffffffff,%eax
1838: 74 1a je 1854 <sbrktest+0x204>
read(fds[0], &scratch, 1);
183a: 8d 45 e7 lea -0x19(%ebp),%eax
183d: 89 44 24 04 mov %eax,0x4(%esp)
1841: 8b 45 dc mov -0x24(%ebp),%eax
1844: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
184b: 00
184c: 89 04 24 mov %eax,(%esp)
184f: e8 6c 24 00 00 call 3cc0 <read>
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
1854: 89 34 9f mov %esi,(%edi,%ebx,4)
// failed allocation?
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
1857: 83 c3 01 add $0x1,%ebx
185a: 83 fb 0a cmp $0xa,%ebx
185d: 75 c7 jne 1826 <sbrktest+0x1d6>
if(pids[i] != -1)
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
185f: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
1866: 30 db xor %bl,%bl
1868: e8 c3 24 00 00 call 3d30 <sbrk>
186d: 89 c6 mov %eax,%esi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if(pids[i] == -1)
186f: 8b 04 9f mov (%edi,%ebx,4),%eax
1872: 83 f8 ff cmp $0xffffffff,%eax
1875: 74 0d je 1884 <sbrktest+0x234>
continue;
kill(pids[i]);
1877: 89 04 24 mov %eax,(%esp)
187a: e8 59 24 00 00 call 3cd8 <kill>
wait();
187f: e8 2c 24 00 00 call 3cb0 <wait>
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
1884: 83 c3 01 add $0x1,%ebx
1887: 83 fb 0a cmp $0xa,%ebx
188a: 75 e3 jne 186f <sbrktest+0x21f>
if(pids[i] == -1)
continue;
kill(pids[i]);
wait();
}
if(c == (char*)0xffffffff){
188c: 83 fe ff cmp $0xffffffff,%esi
188f: 0f 84 b7 00 00 00 je 194c <sbrktest+0x2fc>
printf(stdout, "failed sbrk leaked memory\n");
exit();
}
if(sbrk(0) > oldbrk)
1895: c7 04 24 00 00 00 00 movl $0x0,(%esp)
189c: e8 8f 24 00 00 call 3d30 <sbrk>
18a1: 39 45 a4 cmp %eax,-0x5c(%ebp)
18a4: 73 19 jae 18bf <sbrktest+0x26f>
sbrk(-(sbrk(0) - oldbrk));
18a6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
18ad: e8 7e 24 00 00 call 3d30 <sbrk>
18b2: 8b 55 a4 mov -0x5c(%ebp),%edx
18b5: 29 c2 sub %eax,%edx
18b7: 89 14 24 mov %edx,(%esp)
18ba: e8 71 24 00 00 call 3d30 <sbrk>
printf(stdout, "sbrk test OK\n");
18bf: a1 0c 59 00 00 mov 0x590c,%eax
18c4: c7 44 24 04 28 48 00 movl $0x4828,0x4(%esp)
18cb: 00
18cc: 89 04 24 mov %eax,(%esp)
18cf: e8 0c 25 00 00 call 3de0 <printf>
}
18d4: 83 c4 7c add $0x7c,%esp
18d7: 5b pop %ebx
18d8: 5e pop %esi
18d9: 5f pop %edi
18da: 5d pop %ebp
18db: c3 ret
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
// allocate a lot of memory
sbrk(BIG - (uint)sbrk(0));
18dc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
18e3: e8 48 24 00 00 call 3d30 <sbrk>
18e8: ba 00 00 40 06 mov $0x6400000,%edx
18ed: 29 c2 sub %eax,%edx
18ef: 89 14 24 mov %edx,(%esp)
18f2: e8 39 24 00 00 call 3d30 <sbrk>
write(fds[1], "x", 1);
18f7: 8b 45 e0 mov -0x20(%ebp),%eax
18fa: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1901: 00
1902: c7 44 24 04 75 4d 00 movl $0x4d75,0x4(%esp)
1909: 00
190a: 89 04 24 mov %eax,(%esp)
190d: e8 b6 23 00 00 call 3cc8 <write>
1912: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
// sit around until killed
for(;;) sleep(1000);
1918: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp)
191f: e8 14 24 00 00 call 3d38 <sleep>
1924: eb f2 jmp 1918 <sbrktest+0x2c8>
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
b = sbrk(1);
if(b != a){
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
1926: 89 44 24 10 mov %eax,0x10(%esp)
192a: a1 0c 59 00 00 mov 0x590c,%eax
192f: 89 5c 24 0c mov %ebx,0xc(%esp)
1933: 89 74 24 08 mov %esi,0x8(%esp)
1937: c7 44 24 04 7c 47 00 movl $0x477c,0x4(%esp)
193e: 00
193f: 89 04 24 mov %eax,(%esp)
1942: e8 99 24 00 00 call 3de0 <printf>
exit();
1947: e8 5c 23 00 00 call 3ca8 <exit>
continue;
kill(pids[i]);
wait();
}
if(c == (char*)0xffffffff){
printf(stdout, "failed sbrk leaked memory\n");
194c: a1 0c 59 00 00 mov 0x590c,%eax
1951: c7 44 24 04 0d 48 00 movl $0x480d,0x4(%esp)
1958: 00
1959: 89 04 24 mov %eax,(%esp)
195c: e8 7f 24 00 00 call 3de0 <printf>
exit();
1961: e8 42 23 00 00 call 3ca8 <exit>
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
1966: c7 44 24 04 fe 47 00 movl $0x47fe,0x4(%esp)
196d: 00
196e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1975: e8 66 24 00 00 call 3de0 <printf>
exit();
197a: e8 29 23 00 00 call 3ca8 <exit>
if(pid < 0){
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
printf(stdout, "oops could read %x = %x\n", a, *a);
197f: 0f be 03 movsbl (%ebx),%eax
1982: 89 5c 24 08 mov %ebx,0x8(%esp)
1986: c7 44 24 04 e5 47 00 movl $0x47e5,0x4(%esp)
198d: 00
198e: 89 44 24 0c mov %eax,0xc(%esp)
1992: a1 0c 59 00 00 mov 0x590c,%eax
1997: 89 04 24 mov %eax,(%esp)
199a: e8 41 24 00 00 call 3de0 <printf>
kill(ppid);
199f: 89 34 24 mov %esi,(%esp)
19a2: e8 31 23 00 00 call 3cd8 <kill>
exit();
19a7: e8 fc 22 00 00 call 3ca8 <exit>
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
ppid = getpid();
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
19ac: a1 0c 59 00 00 mov 0x590c,%eax
19b1: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
19b8: 00
19b9: 89 04 24 mov %eax,(%esp)
19bc: e8 1f 24 00 00 call 3de0 <printf>
exit();
19c1: e8 e2 22 00 00 call 3ca8 <exit>
}
a = sbrk(0);
c = sbrk(-(sbrk(0) - oldbrk));
if(c != a){
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
19c6: 89 44 24 0c mov %eax,0xc(%esp)
19ca: a1 0c 59 00 00 mov 0x590c,%eax
19cf: 89 74 24 08 mov %esi,0x8(%esp)
19d3: c7 44 24 04 ac 54 00 movl $0x54ac,0x4(%esp)
19da: 00
19db: 89 04 24 mov %eax,(%esp)
19de: e8 fd 23 00 00 call 3de0 <printf>
exit();
19e3: e8 c0 22 00 00 call 3ca8 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
exit();
}
if(*lastaddr == 99){
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
19e8: a1 0c 59 00 00 mov 0x590c,%eax
19ed: c7 44 24 04 7c 54 00 movl $0x547c,0x4(%esp)
19f4: 00
19f5: 89 04 24 mov %eax,(%esp)
19f8: e8 e3 23 00 00 call 3de0 <printf>
exit();
19fd: e8 a6 22 00 00 call 3ca8 <exit>
// can one re-allocate that page?
a = sbrk(0);
c = sbrk(4096);
if(c != a || sbrk(0) != a + 4096){
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
1a02: a1 0c 59 00 00 mov 0x590c,%eax
1a07: 89 74 24 0c mov %esi,0xc(%esp)
1a0b: 89 5c 24 08 mov %ebx,0x8(%esp)
1a0f: c7 44 24 04 54 54 00 movl $0x5454,0x4(%esp)
1a16: 00
1a17: 89 04 24 mov %eax,(%esp)
1a1a: e8 c1 23 00 00 call 3de0 <printf>
exit();
1a1f: e8 84 22 00 00 call 3ca8 <exit>
printf(stdout, "sbrk could not deallocate\n");
exit();
}
c = sbrk(0);
if(c != a - 4096){
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
1a24: 89 44 24 0c mov %eax,0xc(%esp)
1a28: a1 0c 59 00 00 mov 0x590c,%eax
1a2d: 89 5c 24 08 mov %ebx,0x8(%esp)
1a31: c7 44 24 04 1c 54 00 movl $0x541c,0x4(%esp)
1a38: 00
1a39: 89 04 24 mov %eax,(%esp)
1a3c: e8 9f 23 00 00 call 3de0 <printf>
exit();
1a41: e8 62 22 00 00 call 3ca8 <exit>
// can one de-allocate?
a = sbrk(0);
c = sbrk(-4096);
if(c == (char*)0xffffffff){
printf(stdout, "sbrk could not deallocate\n");
1a46: a1 0c 59 00 00 mov 0x590c,%eax
1a4b: c7 44 24 04 ca 47 00 movl $0x47ca,0x4(%esp)
1a52: 00
1a53: 89 04 24 mov %eax,(%esp)
1a56: e8 85 23 00 00 call 3de0 <printf>
exit();
1a5b: e8 48 22 00 00 call 3ca8 <exit>
#define BIG (100*1024*1024)
a = sbrk(0);
amt = (BIG) - (uint)a;
p = sbrk(amt);
if (p != a) {
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
1a60: a1 0c 59 00 00 mov 0x590c,%eax
1a65: c7 44 24 04 dc 53 00 movl $0x53dc,0x4(%esp)
1a6c: 00
1a6d: 89 04 24 mov %eax,(%esp)
1a70: e8 6b 23 00 00 call 3de0 <printf>
exit();
1a75: e8 2e 22 00 00 call 3ca8 <exit>
exit();
}
c = sbrk(1);
c = sbrk(1);
if(c != a + 1){
printf(stdout, "sbrk test failed post-fork\n");
1a7a: a1 0c 59 00 00 mov 0x590c,%eax
1a7f: c7 44 24 04 ae 47 00 movl $0x47ae,0x4(%esp)
1a86: 00
1a87: 89 04 24 mov %eax,(%esp)
1a8a: e8 51 23 00 00 call 3de0 <printf>
exit();
1a8f: e8 14 22 00 00 call 3ca8 <exit>
*b = 1;
a = b + 1;
}
pid = fork();
if(pid < 0){
printf(stdout, "sbrk test fork failed\n");
1a94: a1 0c 59 00 00 mov 0x590c,%eax
1a99: c7 44 24 04 97 47 00 movl $0x4797,0x4(%esp)
1aa0: 00
1aa1: 89 04 24 mov %eax,(%esp)
1aa4: e8 37 23 00 00 call 3de0 <printf>
exit();
1aa9: e8 fa 21 00 00 call 3ca8 <exit>
1aae: 66 90 xchg %ax,%ax
00001ab0 <preempt>:
}
// meant to be run w/ at most two CPUs
void
preempt(void)
{
1ab0: 55 push %ebp
1ab1: 89 e5 mov %esp,%ebp
1ab3: 57 push %edi
1ab4: 56 push %esi
1ab5: 53 push %ebx
1ab6: 83 ec 2c sub $0x2c,%esp
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
1ab9: c7 44 24 04 36 48 00 movl $0x4836,0x4(%esp)
1ac0: 00
1ac1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ac8: e8 13 23 00 00 call 3de0 <printf>
pid1 = fork();
1acd: e8 ce 21 00 00 call 3ca0 <fork>
if(pid1 == 0)
1ad2: 85 c0 test %eax,%eax
{
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
pid1 = fork();
1ad4: 89 c7 mov %eax,%edi
if(pid1 == 0)
1ad6: 75 02 jne 1ada <preempt+0x2a>
1ad8: eb fe jmp 1ad8 <preempt+0x28>
1ada: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(;;)
;
pid2 = fork();
1ae0: e8 bb 21 00 00 call 3ca0 <fork>
if(pid2 == 0)
1ae5: 85 c0 test %eax,%eax
pid1 = fork();
if(pid1 == 0)
for(;;)
;
pid2 = fork();
1ae7: 89 c6 mov %eax,%esi
if(pid2 == 0)
1ae9: 75 02 jne 1aed <preempt+0x3d>
1aeb: eb fe jmp 1aeb <preempt+0x3b>
for(;;)
;
pipe(pfds);
1aed: 8d 45 e0 lea -0x20(%ebp),%eax
1af0: 89 04 24 mov %eax,(%esp)
1af3: e8 c0 21 00 00 call 3cb8 <pipe>
pid3 = fork();
1af8: e8 a3 21 00 00 call 3ca0 <fork>
if(pid3 == 0){
1afd: 85 c0 test %eax,%eax
if(pid2 == 0)
for(;;)
;
pipe(pfds);
pid3 = fork();
1aff: 89 c3 mov %eax,%ebx
if(pid3 == 0){
1b01: 75 4c jne 1b4f <preempt+0x9f>
close(pfds[0]);
1b03: 8b 45 e0 mov -0x20(%ebp),%eax
1b06: 89 04 24 mov %eax,(%esp)
1b09: e8 c2 21 00 00 call 3cd0 <close>
if(write(pfds[1], "x", 1) != 1)
1b0e: 8b 45 e4 mov -0x1c(%ebp),%eax
1b11: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1b18: 00
1b19: c7 44 24 04 75 4d 00 movl $0x4d75,0x4(%esp)
1b20: 00
1b21: 89 04 24 mov %eax,(%esp)
1b24: e8 9f 21 00 00 call 3cc8 <write>
1b29: 83 f8 01 cmp $0x1,%eax
1b2c: 74 14 je 1b42 <preempt+0x92>
printf(1, "preempt write error");
1b2e: c7 44 24 04 40 48 00 movl $0x4840,0x4(%esp)
1b35: 00
1b36: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b3d: e8 9e 22 00 00 call 3de0 <printf>
close(pfds[1]);
1b42: 8b 45 e4 mov -0x1c(%ebp),%eax
1b45: 89 04 24 mov %eax,(%esp)
1b48: e8 83 21 00 00 call 3cd0 <close>
1b4d: eb fe jmp 1b4d <preempt+0x9d>
for(;;)
;
}
close(pfds[1]);
1b4f: 8b 45 e4 mov -0x1c(%ebp),%eax
1b52: 89 04 24 mov %eax,(%esp)
1b55: e8 76 21 00 00 call 3cd0 <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
1b5a: 8b 45 e0 mov -0x20(%ebp),%eax
1b5d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
1b64: 00
1b65: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
1b6c: 00
1b6d: 89 04 24 mov %eax,(%esp)
1b70: e8 4b 21 00 00 call 3cc0 <read>
1b75: 83 f8 01 cmp $0x1,%eax
1b78: 74 1c je 1b96 <preempt+0xe6>
printf(1, "preempt read error");
1b7a: c7 44 24 04 54 48 00 movl $0x4854,0x4(%esp)
1b81: 00
1b82: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b89: e8 52 22 00 00 call 3de0 <printf>
printf(1, "wait... ");
wait();
wait();
wait();
printf(1, "preempt ok\n");
}
1b8e: 83 c4 2c add $0x2c,%esp
1b91: 5b pop %ebx
1b92: 5e pop %esi
1b93: 5f pop %edi
1b94: 5d pop %ebp
1b95: c3 ret
close(pfds[1]);
if(read(pfds[0], buf, sizeof(buf)) != 1){
printf(1, "preempt read error");
return;
}
close(pfds[0]);
1b96: 8b 45 e0 mov -0x20(%ebp),%eax
1b99: 89 04 24 mov %eax,(%esp)
1b9c: e8 2f 21 00 00 call 3cd0 <close>
printf(1, "kill... ");
1ba1: c7 44 24 04 67 48 00 movl $0x4867,0x4(%esp)
1ba8: 00
1ba9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1bb0: e8 2b 22 00 00 call 3de0 <printf>
kill(pid1);
1bb5: 89 3c 24 mov %edi,(%esp)
1bb8: e8 1b 21 00 00 call 3cd8 <kill>
kill(pid2);
1bbd: 89 34 24 mov %esi,(%esp)
1bc0: e8 13 21 00 00 call 3cd8 <kill>
kill(pid3);
1bc5: 89 1c 24 mov %ebx,(%esp)
1bc8: e8 0b 21 00 00 call 3cd8 <kill>
printf(1, "wait... ");
1bcd: c7 44 24 04 70 48 00 movl $0x4870,0x4(%esp)
1bd4: 00
1bd5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1bdc: e8 ff 21 00 00 call 3de0 <printf>
wait();
1be1: e8 ca 20 00 00 call 3cb0 <wait>
wait();
1be6: e8 c5 20 00 00 call 3cb0 <wait>
1beb: 90 nop
1bec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
wait();
1bf0: e8 bb 20 00 00 call 3cb0 <wait>
printf(1, "preempt ok\n");
1bf5: c7 44 24 04 79 48 00 movl $0x4879,0x4(%esp)
1bfc: 00
1bfd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1c04: e8 d7 21 00 00 call 3de0 <printf>
1c09: eb 83 jmp 1b8e <preempt+0xde>
1c0b: 90 nop
1c0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001c10 <pipe1>:
// simple fork and pipe read/write
void
pipe1(void)
{
1c10: 55 push %ebp
1c11: 89 e5 mov %esp,%ebp
1c13: 57 push %edi
1c14: 56 push %esi
1c15: 53 push %ebx
1c16: 83 ec 2c sub $0x2c,%esp
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
1c19: 8d 45 e0 lea -0x20(%ebp),%eax
1c1c: 89 04 24 mov %eax,(%esp)
1c1f: e8 94 20 00 00 call 3cb8 <pipe>
1c24: 85 c0 test %eax,%eax
1c26: 0f 85 3b 01 00 00 jne 1d67 <pipe1+0x157>
printf(1, "pipe() failed\n");
exit();
}
pid = fork();
1c2c: e8 6f 20 00 00 call 3ca0 <fork>
seq = 0;
if(pid == 0){
1c31: 83 f8 00 cmp $0x0,%eax
1c34: 0f 84 80 00 00 00 je 1cba <pipe1+0xaa>
printf(1, "pipe1 oops 1\n");
exit();
}
}
exit();
} else if(pid > 0){
1c3a: 0f 8e 40 01 00 00 jle 1d80 <pipe1+0x170>
close(fds[1]);
1c40: 8b 45 e4 mov -0x1c(%ebp),%eax
1c43: 31 ff xor %edi,%edi
1c45: be 01 00 00 00 mov $0x1,%esi
1c4a: 31 db xor %ebx,%ebx
1c4c: 89 04 24 mov %eax,(%esp)
1c4f: e8 7c 20 00 00 call 3cd0 <close>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
1c54: 8b 45 e0 mov -0x20(%ebp),%eax
1c57: 89 74 24 08 mov %esi,0x8(%esp)
1c5b: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
1c62: 00
1c63: 89 04 24 mov %eax,(%esp)
1c66: e8 55 20 00 00 call 3cc0 <read>
1c6b: 85 c0 test %eax,%eax
1c6d: 0f 8e a9 00 00 00 jle 1d1c <pipe1+0x10c>
1c73: 31 d2 xor %edx,%edx
1c75: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
1c78: 38 9a e0 80 00 00 cmp %bl,0x80e0(%edx)
1c7e: 75 1e jne 1c9e <pipe1+0x8e>
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
1c80: 83 c2 01 add $0x1,%edx
if((buf[i] & 0xff) != (seq++ & 0xff)){
1c83: 83 c3 01 add $0x1,%ebx
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
1c86: 39 d0 cmp %edx,%eax
1c88: 7f ee jg 1c78 <pipe1+0x68>
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
cc = cc * 2;
1c8a: 01 f6 add %esi,%esi
if(cc > sizeof(buf))
1c8c: ba 00 20 00 00 mov $0x2000,%edx
1c91: 81 fe 01 20 00 00 cmp $0x2001,%esi
1c97: 0f 43 f2 cmovae %edx,%esi
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
1c9a: 01 c7 add %eax,%edi
1c9c: eb b6 jmp 1c54 <pipe1+0x44>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
1c9e: c7 44 24 04 93 48 00 movl $0x4893,0x4(%esp)
1ca5: 00
1ca6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1cad: e8 2e 21 00 00 call 3de0 <printf>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
}
1cb2: 83 c4 2c add $0x2c,%esp
1cb5: 5b pop %ebx
1cb6: 5e pop %esi
1cb7: 5f pop %edi
1cb8: 5d pop %ebp
1cb9: c3 ret
exit();
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
1cba: 8b 45 e0 mov -0x20(%ebp),%eax
1cbd: 31 db xor %ebx,%ebx
1cbf: 89 04 24 mov %eax,(%esp)
1cc2: e8 09 20 00 00 call 3cd0 <close>
for(n = 0; n < 5; n++){
1cc7: 31 c0 xor %eax,%eax
1cc9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 1033; i++)
buf[i] = seq++;
1cd0: 8d 14 03 lea (%ebx,%eax,1),%edx
1cd3: 88 90 e0 80 00 00 mov %dl,0x80e0(%eax)
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
1cd9: 83 c0 01 add $0x1,%eax
1cdc: 3d 09 04 00 00 cmp $0x409,%eax
1ce1: 75 ed jne 1cd0 <pipe1+0xc0>
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
1ce3: 8b 45 e4 mov -0x1c(%ebp),%eax
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
1ce6: 81 c3 09 04 00 00 add $0x409,%ebx
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
1cec: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp)
1cf3: 00
1cf4: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
1cfb: 00
1cfc: 89 04 24 mov %eax,(%esp)
1cff: e8 c4 1f 00 00 call 3cc8 <write>
1d04: 3d 09 04 00 00 cmp $0x409,%eax
1d09: 0f 85 8a 00 00 00 jne 1d99 <pipe1+0x189>
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
1d0f: 81 fb 2d 14 00 00 cmp $0x142d,%ebx
1d15: 75 b0 jne 1cc7 <pipe1+0xb7>
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
printf(1, "pipe1 oops 3 total %d\n", total);
exit();
1d17: e8 8c 1f 00 00 call 3ca8 <exit>
total += n;
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
1d1c: 81 ff 2d 14 00 00 cmp $0x142d,%edi
1d22: 75 29 jne 1d4d <pipe1+0x13d>
printf(1, "pipe1 oops 3 total %d\n", total);
exit();
}
close(fds[0]);
1d24: 8b 45 e0 mov -0x20(%ebp),%eax
1d27: 89 04 24 mov %eax,(%esp)
1d2a: e8 a1 1f 00 00 call 3cd0 <close>
wait();
1d2f: e8 7c 1f 00 00 call 3cb0 <wait>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
1d34: c7 44 24 04 b8 48 00 movl $0x48b8,0x4(%esp)
1d3b: 00
1d3c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d43: e8 98 20 00 00 call 3de0 <printf>
1d48: e9 65 ff ff ff jmp 1cb2 <pipe1+0xa2>
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
printf(1, "pipe1 oops 3 total %d\n", total);
1d4d: 89 7c 24 08 mov %edi,0x8(%esp)
1d51: c7 44 24 04 a1 48 00 movl $0x48a1,0x4(%esp)
1d58: 00
1d59: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d60: e8 7b 20 00 00 call 3de0 <printf>
1d65: eb b0 jmp 1d17 <pipe1+0x107>
{
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
1d67: c7 44 24 04 fe 47 00 movl $0x47fe,0x4(%esp)
1d6e: 00
1d6f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d76: e8 65 20 00 00 call 3de0 <printf>
exit();
1d7b: e8 28 1f 00 00 call 3ca8 <exit>
exit();
}
close(fds[0]);
wait();
} else {
printf(1, "fork() failed\n");
1d80: c7 44 24 04 c2 48 00 movl $0x48c2,0x4(%esp)
1d87: 00
1d88: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d8f: e8 4c 20 00 00 call 3de0 <printf>
exit();
1d94: e8 0f 1f 00 00 call 3ca8 <exit>
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
printf(1, "pipe1 oops 1\n");
1d99: c7 44 24 04 85 48 00 movl $0x4885,0x4(%esp)
1da0: 00
1da1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1da8: e8 33 20 00 00 call 3de0 <printf>
exit();
1dad: e8 f6 1e 00 00 call 3ca8 <exit>
1db2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1db9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001dc0 <fourteen>:
printf(1, "bigfile test ok\n");
}
void
fourteen(void)
{
1dc0: 55 push %ebp
1dc1: 89 e5 mov %esp,%ebp
1dc3: 83 ec 18 sub $0x18,%esp
int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n");
1dc6: c7 44 24 04 d1 48 00 movl $0x48d1,0x4(%esp)
1dcd: 00
1dce: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1dd5: e8 06 20 00 00 call 3de0 <printf>
if(mkdir("12345678901234") != 0){
1dda: c7 04 24 0c 49 00 00 movl $0x490c,(%esp)
1de1: e8 2a 1f 00 00 call 3d10 <mkdir>
1de6: 85 c0 test %eax,%eax
1de8: 0f 85 92 00 00 00 jne 1e80 <fourteen+0xc0>
printf(1, "mkdir 12345678901234 failed\n");
exit();
}
if(mkdir("12345678901234/123456789012345") != 0){
1dee: c7 04 24 d0 54 00 00 movl $0x54d0,(%esp)
1df5: e8 16 1f 00 00 call 3d10 <mkdir>
1dfa: 85 c0 test %eax,%eax
1dfc: 0f 85 fb 00 00 00 jne 1efd <fourteen+0x13d>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
exit();
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
1e02: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
1e09: 00
1e0a: c7 04 24 20 55 00 00 movl $0x5520,(%esp)
1e11: e8 d2 1e 00 00 call 3ce8 <open>
if(fd < 0){
1e16: 85 c0 test %eax,%eax
1e18: 0f 88 c6 00 00 00 js 1ee4 <fourteen+0x124>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
exit();
}
close(fd);
1e1e: 89 04 24 mov %eax,(%esp)
1e21: e8 aa 1e 00 00 call 3cd0 <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
1e26: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1e2d: 00
1e2e: c7 04 24 90 55 00 00 movl $0x5590,(%esp)
1e35: e8 ae 1e 00 00 call 3ce8 <open>
if(fd < 0){
1e3a: 85 c0 test %eax,%eax
1e3c: 0f 88 89 00 00 00 js 1ecb <fourteen+0x10b>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
exit();
}
close(fd);
1e42: 89 04 24 mov %eax,(%esp)
1e45: e8 86 1e 00 00 call 3cd0 <close>
if(mkdir("12345678901234/12345678901234") == 0){
1e4a: c7 04 24 fd 48 00 00 movl $0x48fd,(%esp)
1e51: e8 ba 1e 00 00 call 3d10 <mkdir>
1e56: 85 c0 test %eax,%eax
1e58: 74 58 je 1eb2 <fourteen+0xf2>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
exit();
}
if(mkdir("123456789012345/12345678901234") == 0){
1e5a: c7 04 24 2c 56 00 00 movl $0x562c,(%esp)
1e61: e8 aa 1e 00 00 call 3d10 <mkdir>
1e66: 85 c0 test %eax,%eax
1e68: 74 2f je 1e99 <fourteen+0xd9>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
exit();
}
printf(1, "fourteen ok\n");
1e6a: c7 44 24 04 1b 49 00 movl $0x491b,0x4(%esp)
1e71: 00
1e72: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e79: e8 62 1f 00 00 call 3de0 <printf>
}
1e7e: c9 leave
1e7f: c3 ret
// DIRSIZ is 14.
printf(1, "fourteen test\n");
if(mkdir("12345678901234") != 0){
printf(1, "mkdir 12345678901234 failed\n");
1e80: c7 44 24 04 e0 48 00 movl $0x48e0,0x4(%esp)
1e87: 00
1e88: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e8f: e8 4c 1f 00 00 call 3de0 <printf>
exit();
1e94: e8 0f 1e 00 00 call 3ca8 <exit>
if(mkdir("12345678901234/12345678901234") == 0){
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
exit();
}
if(mkdir("123456789012345/12345678901234") == 0){
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
1e99: c7 44 24 04 4c 56 00 movl $0x564c,0x4(%esp)
1ea0: 00
1ea1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ea8: e8 33 1f 00 00 call 3de0 <printf>
exit();
1ead: e8 f6 1d 00 00 call 3ca8 <exit>
exit();
}
close(fd);
if(mkdir("12345678901234/12345678901234") == 0){
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
1eb2: c7 44 24 04 fc 55 00 movl $0x55fc,0x4(%esp)
1eb9: 00
1eba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ec1: e8 1a 1f 00 00 call 3de0 <printf>
exit();
1ec6: e8 dd 1d 00 00 call 3ca8 <exit>
exit();
}
close(fd);
fd = open("12345678901234/12345678901234/12345678901234", 0);
if(fd < 0){
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
1ecb: c7 44 24 04 c0 55 00 movl $0x55c0,0x4(%esp)
1ed2: 00
1ed3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1eda: e8 01 1f 00 00 call 3de0 <printf>
exit();
1edf: e8 c4 1d 00 00 call 3ca8 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
exit();
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
if(fd < 0){
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
1ee4: c7 44 24 04 50 55 00 movl $0x5550,0x4(%esp)
1eeb: 00
1eec: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ef3: e8 e8 1e 00 00 call 3de0 <printf>
exit();
1ef8: e8 ab 1d 00 00 call 3ca8 <exit>
if(mkdir("12345678901234") != 0){
printf(1, "mkdir 12345678901234 failed\n");
exit();
}
if(mkdir("12345678901234/123456789012345") != 0){
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
1efd: c7 44 24 04 f0 54 00 movl $0x54f0,0x4(%esp)
1f04: 00
1f05: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f0c: e8 cf 1e 00 00 call 3de0 <printf>
exit();
1f11: e8 92 1d 00 00 call 3ca8 <exit>
1f16: 8d 76 00 lea 0x0(%esi),%esi
1f19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001f20 <openiputtest>:
// for(i = 0; i < 10000; i++)
// yield();
// }
void
openiputtest(void)
{
1f20: 55 push %ebp
1f21: 89 e5 mov %esp,%ebp
1f23: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "openiput test\n");
1f26: a1 0c 59 00 00 mov 0x590c,%eax
1f2b: c7 44 24 04 28 49 00 movl $0x4928,0x4(%esp)
1f32: 00
1f33: 89 04 24 mov %eax,(%esp)
1f36: e8 a5 1e 00 00 call 3de0 <printf>
if(mkdir("oidir") < 0){
1f3b: c7 04 24 37 49 00 00 movl $0x4937,(%esp)
1f42: e8 c9 1d 00 00 call 3d10 <mkdir>
1f47: 85 c0 test %eax,%eax
1f49: 0f 88 9e 00 00 00 js 1fed <openiputtest+0xcd>
printf(stdout, "mkdir oidir failed\n");
exit();
}
pid = fork();
1f4f: e8 4c 1d 00 00 call 3ca0 <fork>
if(pid < 0){
1f54: 83 f8 00 cmp $0x0,%eax
1f57: 0f 8c aa 00 00 00 jl 2007 <openiputtest+0xe7>
1f5d: 8d 76 00 lea 0x0(%esi),%esi
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
1f60: 75 36 jne 1f98 <openiputtest+0x78>
int fd = open("oidir", O_RDWR);
1f62: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
1f69: 00
1f6a: c7 04 24 37 49 00 00 movl $0x4937,(%esp)
1f71: e8 72 1d 00 00 call 3ce8 <open>
if(fd >= 0){
1f76: 85 c0 test %eax,%eax
1f78: 78 6e js 1fe8 <openiputtest+0xc8>
printf(stdout, "open directory for write succeeded\n");
1f7a: a1 0c 59 00 00 mov 0x590c,%eax
1f7f: c7 44 24 04 80 56 00 movl $0x5680,0x4(%esp)
1f86: 00
1f87: 89 04 24 mov %eax,(%esp)
1f8a: e8 51 1e 00 00 call 3de0 <printf>
exit();
1f8f: e8 14 1d 00 00 call 3ca8 <exit>
1f94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
exit();
}
sleep(1);
1f98: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f9f: e8 94 1d 00 00 call 3d38 <sleep>
if(unlink("oidir") != 0){
1fa4: c7 04 24 37 49 00 00 movl $0x4937,(%esp)
1fab: e8 48 1d 00 00 call 3cf8 <unlink>
1fb0: 85 c0 test %eax,%eax
1fb2: 75 1c jne 1fd0 <openiputtest+0xb0>
printf(stdout, "unlink failed\n");
exit();
}
wait();
1fb4: e8 f7 1c 00 00 call 3cb0 <wait>
printf(stdout, "openiput test ok\n");
1fb9: a1 0c 59 00 00 mov 0x590c,%eax
1fbe: c7 44 24 04 51 49 00 movl $0x4951,0x4(%esp)
1fc5: 00
1fc6: 89 04 24 mov %eax,(%esp)
1fc9: e8 12 1e 00 00 call 3de0 <printf>
}
1fce: c9 leave
1fcf: c3 ret
}
exit();
}
sleep(1);
if(unlink("oidir") != 0){
printf(stdout, "unlink failed\n");
1fd0: a1 0c 59 00 00 mov 0x590c,%eax
1fd5: c7 44 24 04 de 43 00 movl $0x43de,0x4(%esp)
1fdc: 00
1fdd: 89 04 24 mov %eax,(%esp)
1fe0: e8 fb 1d 00 00 call 3de0 <printf>
1fe5: 8d 76 00 lea 0x0(%esi),%esi
exit();
1fe8: e8 bb 1c 00 00 call 3ca8 <exit>
{
int pid;
printf(stdout, "openiput test\n");
if(mkdir("oidir") < 0){
printf(stdout, "mkdir oidir failed\n");
1fed: a1 0c 59 00 00 mov 0x590c,%eax
1ff2: c7 44 24 04 3d 49 00 movl $0x493d,0x4(%esp)
1ff9: 00
1ffa: 89 04 24 mov %eax,(%esp)
1ffd: e8 de 1d 00 00 call 3de0 <printf>
exit();
2002: e8 a1 1c 00 00 call 3ca8 <exit>
}
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
2007: a1 0c 59 00 00 mov 0x590c,%eax
200c: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
2013: 00
2014: 89 04 24 mov %eax,(%esp)
2017: e8 c4 1d 00 00 call 3de0 <printf>
exit();
201c: e8 87 1c 00 00 call 3ca8 <exit>
2021: eb 0d jmp 2030 <iref>
2023: 90 nop
2024: 90 nop
2025: 90 nop
2026: 90 nop
2027: 90 nop
2028: 90 nop
2029: 90 nop
202a: 90 nop
202b: 90 nop
202c: 90 nop
202d: 90 nop
202e: 90 nop
202f: 90 nop
00002030 <iref>:
}
// test that iput() is called at the end of _namei()
void
iref(void)
{
2030: 55 push %ebp
2031: 89 e5 mov %esp,%ebp
2033: 53 push %ebx
int i, fd;
printf(1, "empty file name\n");
2034: 31 db xor %ebx,%ebx
}
// test that iput() is called at the end of _namei()
void
iref(void)
{
2036: 83 ec 14 sub $0x14,%esp
int i, fd;
printf(1, "empty file name\n");
2039: c7 44 24 04 63 49 00 movl $0x4963,0x4(%esp)
2040: 00
2041: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2048: e8 93 1d 00 00 call 3de0 <printf>
204d: 8d 76 00 lea 0x0(%esi),%esi
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
if(mkdir("irefd") != 0){
2050: c7 04 24 74 49 00 00 movl $0x4974,(%esp)
2057: e8 b4 1c 00 00 call 3d10 <mkdir>
205c: 85 c0 test %eax,%eax
205e: 0f 85 b2 00 00 00 jne 2116 <iref+0xe6>
printf(1, "mkdir irefd failed\n");
exit();
}
if(chdir("irefd") != 0){
2064: c7 04 24 74 49 00 00 movl $0x4974,(%esp)
206b: e8 a8 1c 00 00 call 3d18 <chdir>
2070: 85 c0 test %eax,%eax
2072: 0f 85 b7 00 00 00 jne 212f <iref+0xff>
printf(1, "chdir irefd failed\n");
exit();
}
mkdir("");
2078: c7 04 24 2d 51 00 00 movl $0x512d,(%esp)
207f: e8 8c 1c 00 00 call 3d10 <mkdir>
link("README", "");
2084: c7 44 24 04 2d 51 00 movl $0x512d,0x4(%esp)
208b: 00
208c: c7 04 24 a2 49 00 00 movl $0x49a2,(%esp)
2093: e8 70 1c 00 00 call 3d08 <link>
fd = open("", O_CREATE);
2098: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
209f: 00
20a0: c7 04 24 2d 51 00 00 movl $0x512d,(%esp)
20a7: e8 3c 1c 00 00 call 3ce8 <open>
if(fd >= 0)
20ac: 85 c0 test %eax,%eax
20ae: 78 08 js 20b8 <iref+0x88>
close(fd);
20b0: 89 04 24 mov %eax,(%esp)
20b3: e8 18 1c 00 00 call 3cd0 <close>
fd = open("xx", O_CREATE);
20b8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
20bf: 00
20c0: c7 04 24 74 4d 00 00 movl $0x4d74,(%esp)
20c7: e8 1c 1c 00 00 call 3ce8 <open>
if(fd >= 0)
20cc: 85 c0 test %eax,%eax
20ce: 78 08 js 20d8 <iref+0xa8>
close(fd);
20d0: 89 04 24 mov %eax,(%esp)
20d3: e8 f8 1b 00 00 call 3cd0 <close>
int i, fd;
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
20d8: 83 c3 01 add $0x1,%ebx
if(fd >= 0)
close(fd);
fd = open("xx", O_CREATE);
if(fd >= 0)
close(fd);
unlink("xx");
20db: c7 04 24 74 4d 00 00 movl $0x4d74,(%esp)
20e2: e8 11 1c 00 00 call 3cf8 <unlink>
int i, fd;
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
20e7: 83 fb 33 cmp $0x33,%ebx
20ea: 0f 85 60 ff ff ff jne 2050 <iref+0x20>
if(fd >= 0)
close(fd);
unlink("xx");
}
chdir("/");
20f0: c7 04 24 a9 49 00 00 movl $0x49a9,(%esp)
20f7: e8 1c 1c 00 00 call 3d18 <chdir>
printf(1, "empty file name OK\n");
20fc: c7 44 24 04 ab 49 00 movl $0x49ab,0x4(%esp)
2103: 00
2104: c7 04 24 01 00 00 00 movl $0x1,(%esp)
210b: e8 d0 1c 00 00 call 3de0 <printf>
}
2110: 83 c4 14 add $0x14,%esp
2113: 5b pop %ebx
2114: 5d pop %ebp
2115: c3 ret
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
if(mkdir("irefd") != 0){
printf(1, "mkdir irefd failed\n");
2116: c7 44 24 04 7a 49 00 movl $0x497a,0x4(%esp)
211d: 00
211e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2125: e8 b6 1c 00 00 call 3de0 <printf>
exit();
212a: e8 79 1b 00 00 call 3ca8 <exit>
}
if(chdir("irefd") != 0){
printf(1, "chdir irefd failed\n");
212f: c7 44 24 04 8e 49 00 movl $0x498e,0x4(%esp)
2136: 00
2137: c7 04 24 01 00 00 00 movl $0x1,(%esp)
213e: e8 9d 1c 00 00 call 3de0 <printf>
exit();
2143: e8 60 1b 00 00 call 3ca8 <exit>
2148: 90 nop
2149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00002150 <dirfile>:
printf(1, "rmdot ok\n");
}
void
dirfile(void)
{
2150: 55 push %ebp
2151: 89 e5 mov %esp,%ebp
2153: 53 push %ebx
2154: 83 ec 14 sub $0x14,%esp
int fd;
printf(1, "dir vs file\n");
2157: c7 44 24 04 bf 49 00 movl $0x49bf,0x4(%esp)
215e: 00
215f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2166: e8 75 1c 00 00 call 3de0 <printf>
fd = open("dirfile", O_CREATE);
216b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2172: 00
2173: c7 04 24 cc 49 00 00 movl $0x49cc,(%esp)
217a: e8 69 1b 00 00 call 3ce8 <open>
if(fd < 0){
217f: 85 c0 test %eax,%eax
2181: 0f 88 4e 01 00 00 js 22d5 <dirfile+0x185>
printf(1, "create dirfile failed\n");
exit();
}
close(fd);
2187: 89 04 24 mov %eax,(%esp)
218a: e8 41 1b 00 00 call 3cd0 <close>
if(chdir("dirfile") == 0){
218f: c7 04 24 cc 49 00 00 movl $0x49cc,(%esp)
2196: e8 7d 1b 00 00 call 3d18 <chdir>
219b: 85 c0 test %eax,%eax
219d: 0f 84 19 01 00 00 je 22bc <dirfile+0x16c>
printf(1, "chdir dirfile succeeded!\n");
exit();
}
fd = open("dirfile/xx", 0);
21a3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
21aa: 00
21ab: c7 04 24 05 4a 00 00 movl $0x4a05,(%esp)
21b2: e8 31 1b 00 00 call 3ce8 <open>
if(fd >= 0){
21b7: 85 c0 test %eax,%eax
21b9: 0f 89 e4 00 00 00 jns 22a3 <dirfile+0x153>
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
fd = open("dirfile/xx", O_CREATE);
21bf: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
21c6: 00
21c7: c7 04 24 05 4a 00 00 movl $0x4a05,(%esp)
21ce: e8 15 1b 00 00 call 3ce8 <open>
if(fd >= 0){
21d3: 85 c0 test %eax,%eax
21d5: 0f 89 c8 00 00 00 jns 22a3 <dirfile+0x153>
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
if(mkdir("dirfile/xx") == 0){
21db: c7 04 24 05 4a 00 00 movl $0x4a05,(%esp)
21e2: e8 29 1b 00 00 call 3d10 <mkdir>
21e7: 85 c0 test %eax,%eax
21e9: 0f 84 7c 01 00 00 je 236b <dirfile+0x21b>
printf(1, "mkdir dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile/xx") == 0){
21ef: c7 04 24 05 4a 00 00 movl $0x4a05,(%esp)
21f6: e8 fd 1a 00 00 call 3cf8 <unlink>
21fb: 85 c0 test %eax,%eax
21fd: 0f 84 4f 01 00 00 je 2352 <dirfile+0x202>
printf(1, "unlink dirfile/xx succeeded!\n");
exit();
}
if(link("README", "dirfile/xx") == 0){
2203: c7 44 24 04 05 4a 00 movl $0x4a05,0x4(%esp)
220a: 00
220b: c7 04 24 a2 49 00 00 movl $0x49a2,(%esp)
2212: e8 f1 1a 00 00 call 3d08 <link>
2217: 85 c0 test %eax,%eax
2219: 0f 84 1a 01 00 00 je 2339 <dirfile+0x1e9>
printf(1, "link to dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile") != 0){
221f: c7 04 24 cc 49 00 00 movl $0x49cc,(%esp)
2226: e8 cd 1a 00 00 call 3cf8 <unlink>
222b: 85 c0 test %eax,%eax
222d: 0f 85 ed 00 00 00 jne 2320 <dirfile+0x1d0>
printf(1, "unlink dirfile failed!\n");
exit();
}
fd = open(".", O_RDWR);
2233: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
223a: 00
223b: c7 04 24 92 4c 00 00 movl $0x4c92,(%esp)
2242: e8 a1 1a 00 00 call 3ce8 <open>
if(fd >= 0){
2247: 85 c0 test %eax,%eax
2249: 0f 89 b8 00 00 00 jns 2307 <dirfile+0x1b7>
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
224f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2256: 00
2257: c7 04 24 92 4c 00 00 movl $0x4c92,(%esp)
225e: e8 85 1a 00 00 call 3ce8 <open>
if(write(fd, "x", 1) > 0){
2263: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
226a: 00
226b: c7 44 24 04 75 4d 00 movl $0x4d75,0x4(%esp)
2272: 00
fd = open(".", O_RDWR);
if(fd >= 0){
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
2273: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2275: 89 04 24 mov %eax,(%esp)
2278: e8 4b 1a 00 00 call 3cc8 <write>
227d: 85 c0 test %eax,%eax
227f: 7f 6d jg 22ee <dirfile+0x19e>
printf(1, "write . succeeded!\n");
exit();
}
close(fd);
2281: 89 1c 24 mov %ebx,(%esp)
2284: e8 47 1a 00 00 call 3cd0 <close>
printf(1, "dir vs file OK\n");
2289: c7 44 24 04 95 4a 00 movl $0x4a95,0x4(%esp)
2290: 00
2291: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2298: e8 43 1b 00 00 call 3de0 <printf>
}
229d: 83 c4 14 add $0x14,%esp
22a0: 5b pop %ebx
22a1: 5d pop %ebp
22a2: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
fd = open("dirfile/xx", O_CREATE);
if(fd >= 0){
printf(1, "create dirfile/xx succeeded!\n");
22a3: c7 44 24 04 10 4a 00 movl $0x4a10,0x4(%esp)
22aa: 00
22ab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22b2: e8 29 1b 00 00 call 3de0 <printf>
exit();
22b7: e8 ec 19 00 00 call 3ca8 <exit>
printf(1, "create dirfile failed\n");
exit();
}
close(fd);
if(chdir("dirfile") == 0){
printf(1, "chdir dirfile succeeded!\n");
22bc: c7 44 24 04 eb 49 00 movl $0x49eb,0x4(%esp)
22c3: 00
22c4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22cb: e8 10 1b 00 00 call 3de0 <printf>
exit();
22d0: e8 d3 19 00 00 call 3ca8 <exit>
printf(1, "dir vs file\n");
fd = open("dirfile", O_CREATE);
if(fd < 0){
printf(1, "create dirfile failed\n");
22d5: c7 44 24 04 d4 49 00 movl $0x49d4,0x4(%esp)
22dc: 00
22dd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22e4: e8 f7 1a 00 00 call 3de0 <printf>
exit();
22e9: e8 ba 19 00 00 call 3ca8 <exit>
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
if(write(fd, "x", 1) > 0){
printf(1, "write . succeeded!\n");
22ee: c7 44 24 04 81 4a 00 movl $0x4a81,0x4(%esp)
22f5: 00
22f6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22fd: e8 de 1a 00 00 call 3de0 <printf>
exit();
2302: e8 a1 19 00 00 call 3ca8 <exit>
exit();
}
fd = open(".", O_RDWR);
if(fd >= 0){
printf(1, "open . for writing succeeded!\n");
2307: c7 44 24 04 c4 56 00 movl $0x56c4,0x4(%esp)
230e: 00
230f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2316: e8 c5 1a 00 00 call 3de0 <printf>
exit();
231b: e8 88 19 00 00 call 3ca8 <exit>
if(link("README", "dirfile/xx") == 0){
printf(1, "link to dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile") != 0){
printf(1, "unlink dirfile failed!\n");
2320: c7 44 24 04 69 4a 00 movl $0x4a69,0x4(%esp)
2327: 00
2328: c7 04 24 01 00 00 00 movl $0x1,(%esp)
232f: e8 ac 1a 00 00 call 3de0 <printf>
exit();
2334: e8 6f 19 00 00 call 3ca8 <exit>
if(unlink("dirfile/xx") == 0){
printf(1, "unlink dirfile/xx succeeded!\n");
exit();
}
if(link("README", "dirfile/xx") == 0){
printf(1, "link to dirfile/xx succeeded!\n");
2339: c7 44 24 04 a4 56 00 movl $0x56a4,0x4(%esp)
2340: 00
2341: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2348: e8 93 1a 00 00 call 3de0 <printf>
exit();
234d: e8 56 19 00 00 call 3ca8 <exit>
if(mkdir("dirfile/xx") == 0){
printf(1, "mkdir dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile/xx") == 0){
printf(1, "unlink dirfile/xx succeeded!\n");
2352: c7 44 24 04 4b 4a 00 movl $0x4a4b,0x4(%esp)
2359: 00
235a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2361: e8 7a 1a 00 00 call 3de0 <printf>
exit();
2366: e8 3d 19 00 00 call 3ca8 <exit>
if(fd >= 0){
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
if(mkdir("dirfile/xx") == 0){
printf(1, "mkdir dirfile/xx succeeded!\n");
236b: c7 44 24 04 2e 4a 00 movl $0x4a2e,0x4(%esp)
2372: 00
2373: c7 04 24 01 00 00 00 movl $0x1,(%esp)
237a: e8 61 1a 00 00 call 3de0 <printf>
exit();
237f: e8 24 19 00 00 call 3ca8 <exit>
2384: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
238a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00002390 <rmdot>:
printf(1, "fourteen ok\n");
}
void
rmdot(void)
{
2390: 55 push %ebp
2391: 89 e5 mov %esp,%ebp
2393: 83 ec 18 sub $0x18,%esp
printf(1, "rmdot test\n");
2396: c7 44 24 04 a5 4a 00 movl $0x4aa5,0x4(%esp)
239d: 00
239e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
23a5: e8 36 1a 00 00 call 3de0 <printf>
if(mkdir("dots") != 0){
23aa: c7 04 24 b1 4a 00 00 movl $0x4ab1,(%esp)
23b1: e8 5a 19 00 00 call 3d10 <mkdir>
23b6: 85 c0 test %eax,%eax
23b8: 0f 85 9a 00 00 00 jne 2458 <rmdot+0xc8>
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
23be: c7 04 24 b1 4a 00 00 movl $0x4ab1,(%esp)
23c5: e8 4e 19 00 00 call 3d18 <chdir>
23ca: 85 c0 test %eax,%eax
23cc: 0f 85 35 01 00 00 jne 2507 <rmdot+0x177>
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
23d2: c7 04 24 92 4c 00 00 movl $0x4c92,(%esp)
23d9: e8 1a 19 00 00 call 3cf8 <unlink>
23de: 85 c0 test %eax,%eax
23e0: 0f 84 08 01 00 00 je 24ee <rmdot+0x15e>
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
23e6: c7 04 24 91 4c 00 00 movl $0x4c91,(%esp)
23ed: e8 06 19 00 00 call 3cf8 <unlink>
23f2: 85 c0 test %eax,%eax
23f4: 0f 84 db 00 00 00 je 24d5 <rmdot+0x145>
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
23fa: c7 04 24 a9 49 00 00 movl $0x49a9,(%esp)
2401: e8 12 19 00 00 call 3d18 <chdir>
2406: 85 c0 test %eax,%eax
2408: 0f 85 ae 00 00 00 jne 24bc <rmdot+0x12c>
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
240e: c7 04 24 09 4b 00 00 movl $0x4b09,(%esp)
2415: e8 de 18 00 00 call 3cf8 <unlink>
241a: 85 c0 test %eax,%eax
241c: 0f 84 81 00 00 00 je 24a3 <rmdot+0x113>
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
2422: c7 04 24 27 4b 00 00 movl $0x4b27,(%esp)
2429: e8 ca 18 00 00 call 3cf8 <unlink>
242e: 85 c0 test %eax,%eax
2430: 74 58 je 248a <rmdot+0xfa>
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
2432: c7 04 24 b1 4a 00 00 movl $0x4ab1,(%esp)
2439: e8 ba 18 00 00 call 3cf8 <unlink>
243e: 85 c0 test %eax,%eax
2440: 75 2f jne 2471 <rmdot+0xe1>
printf(1, "unlink dots failed!\n");
exit();
}
printf(1, "rmdot ok\n");
2442: c7 44 24 04 5c 4b 00 movl $0x4b5c,0x4(%esp)
2449: 00
244a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2451: e8 8a 19 00 00 call 3de0 <printf>
}
2456: c9 leave
2457: c3 ret
void
rmdot(void)
{
printf(1, "rmdot test\n");
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
2458: c7 44 24 04 b6 4a 00 movl $0x4ab6,0x4(%esp)
245f: 00
2460: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2467: e8 74 19 00 00 call 3de0 <printf>
exit();
246c: e8 37 18 00 00 call 3ca8 <exit>
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
printf(1, "unlink dots failed!\n");
2471: c7 44 24 04 47 4b 00 movl $0x4b47,0x4(%esp)
2478: 00
2479: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2480: e8 5b 19 00 00 call 3de0 <printf>
exit();
2485: e8 1e 18 00 00 call 3ca8 <exit>
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
248a: c7 44 24 04 2f 4b 00 movl $0x4b2f,0x4(%esp)
2491: 00
2492: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2499: e8 42 19 00 00 call 3de0 <printf>
exit();
249e: e8 05 18 00 00 call 3ca8 <exit>
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
24a3: c7 44 24 04 10 4b 00 movl $0x4b10,0x4(%esp)
24aa: 00
24ab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24b2: e8 29 19 00 00 call 3de0 <printf>
exit();
24b7: e8 ec 17 00 00 call 3ca8 <exit>
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
24bc: c7 44 24 04 f9 4a 00 movl $0x4af9,0x4(%esp)
24c3: 00
24c4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24cb: e8 10 19 00 00 call 3de0 <printf>
exit();
24d0: e8 d3 17 00 00 call 3ca8 <exit>
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
24d5: c7 44 24 04 ea 4a 00 movl $0x4aea,0x4(%esp)
24dc: 00
24dd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24e4: e8 f7 18 00 00 call 3de0 <printf>
exit();
24e9: e8 ba 17 00 00 call 3ca8 <exit>
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
24ee: c7 44 24 04 dc 4a 00 movl $0x4adc,0x4(%esp)
24f5: 00
24f6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24fd: e8 de 18 00 00 call 3de0 <printf>
exit();
2502: e8 a1 17 00 00 call 3ca8 <exit>
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
2507: c7 44 24 04 c9 4a 00 movl $0x4ac9,0x4(%esp)
250e: 00
250f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2516: e8 c5 18 00 00 call 3de0 <printf>
exit();
251b: e8 88 17 00 00 call 3ca8 <exit>
00002520 <subdir>:
printf(1, "bigdir ok\n");
}
void
subdir(void)
{
2520: 55 push %ebp
2521: 89 e5 mov %esp,%ebp
2523: 53 push %ebx
2524: 83 ec 14 sub $0x14,%esp
int fd, cc;
printf(1, "subdir test\n");
2527: c7 44 24 04 66 4b 00 movl $0x4b66,0x4(%esp)
252e: 00
252f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2536: e8 a5 18 00 00 call 3de0 <printf>
unlink("ff");
253b: c7 04 24 ef 4b 00 00 movl $0x4bef,(%esp)
2542: e8 b1 17 00 00 call 3cf8 <unlink>
if(mkdir("dd") != 0){
2547: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
254e: e8 bd 17 00 00 call 3d10 <mkdir>
2553: 85 c0 test %eax,%eax
2555: 0f 85 07 06 00 00 jne 2b62 <subdir+0x642>
printf(1, "subdir mkdir dd failed\n");
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
255b: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2562: 00
2563: c7 04 24 c5 4b 00 00 movl $0x4bc5,(%esp)
256a: e8 79 17 00 00 call 3ce8 <open>
if(fd < 0){
256f: 85 c0 test %eax,%eax
if(mkdir("dd") != 0){
printf(1, "subdir mkdir dd failed\n");
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
2571: 89 c3 mov %eax,%ebx
if(fd < 0){
2573: 0f 88 d0 05 00 00 js 2b49 <subdir+0x629>
printf(1, "create dd/ff failed\n");
exit();
}
write(fd, "ff", 2);
2579: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
2580: 00
2581: c7 44 24 04 ef 4b 00 movl $0x4bef,0x4(%esp)
2588: 00
2589: 89 04 24 mov %eax,(%esp)
258c: e8 37 17 00 00 call 3cc8 <write>
close(fd);
2591: 89 1c 24 mov %ebx,(%esp)
2594: e8 37 17 00 00 call 3cd0 <close>
if(unlink("dd") >= 0){
2599: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
25a0: e8 53 17 00 00 call 3cf8 <unlink>
25a5: 85 c0 test %eax,%eax
25a7: 0f 89 83 05 00 00 jns 2b30 <subdir+0x610>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
exit();
}
if(mkdir("/dd/dd") != 0){
25ad: c7 04 24 a0 4b 00 00 movl $0x4ba0,(%esp)
25b4: e8 57 17 00 00 call 3d10 <mkdir>
25b9: 85 c0 test %eax,%eax
25bb: 0f 85 56 05 00 00 jne 2b17 <subdir+0x5f7>
printf(1, "subdir mkdir dd/dd failed\n");
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
25c1: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
25c8: 00
25c9: c7 04 24 c2 4b 00 00 movl $0x4bc2,(%esp)
25d0: e8 13 17 00 00 call 3ce8 <open>
if(fd < 0){
25d5: 85 c0 test %eax,%eax
if(mkdir("/dd/dd") != 0){
printf(1, "subdir mkdir dd/dd failed\n");
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
25d7: 89 c3 mov %eax,%ebx
if(fd < 0){
25d9: 0f 88 25 04 00 00 js 2a04 <subdir+0x4e4>
printf(1, "create dd/dd/ff failed\n");
exit();
}
write(fd, "FF", 2);
25df: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
25e6: 00
25e7: c7 44 24 04 e3 4b 00 movl $0x4be3,0x4(%esp)
25ee: 00
25ef: 89 04 24 mov %eax,(%esp)
25f2: e8 d1 16 00 00 call 3cc8 <write>
close(fd);
25f7: 89 1c 24 mov %ebx,(%esp)
25fa: e8 d1 16 00 00 call 3cd0 <close>
fd = open("dd/dd/../ff", 0);
25ff: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2606: 00
2607: c7 04 24 e6 4b 00 00 movl $0x4be6,(%esp)
260e: e8 d5 16 00 00 call 3ce8 <open>
if(fd < 0){
2613: 85 c0 test %eax,%eax
exit();
}
write(fd, "FF", 2);
close(fd);
fd = open("dd/dd/../ff", 0);
2615: 89 c3 mov %eax,%ebx
if(fd < 0){
2617: 0f 88 ce 03 00 00 js 29eb <subdir+0x4cb>
printf(1, "open dd/dd/../ff failed\n");
exit();
}
cc = read(fd, buf, sizeof(buf));
261d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
2624: 00
2625: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
262c: 00
262d: 89 04 24 mov %eax,(%esp)
2630: e8 8b 16 00 00 call 3cc0 <read>
if(cc != 2 || buf[0] != 'f'){
2635: 83 f8 02 cmp $0x2,%eax
2638: 0f 85 fe 02 00 00 jne 293c <subdir+0x41c>
263e: 80 3d e0 80 00 00 66 cmpb $0x66,0x80e0
2645: 0f 85 f1 02 00 00 jne 293c <subdir+0x41c>
printf(1, "dd/dd/../ff wrong content\n");
exit();
}
close(fd);
264b: 89 1c 24 mov %ebx,(%esp)
264e: e8 7d 16 00 00 call 3cd0 <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
2653: c7 44 24 04 26 4c 00 movl $0x4c26,0x4(%esp)
265a: 00
265b: c7 04 24 c2 4b 00 00 movl $0x4bc2,(%esp)
2662: e8 a1 16 00 00 call 3d08 <link>
2667: 85 c0 test %eax,%eax
2669: 0f 85 c7 03 00 00 jne 2a36 <subdir+0x516>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
exit();
}
if(unlink("dd/dd/ff") != 0){
266f: c7 04 24 c2 4b 00 00 movl $0x4bc2,(%esp)
2676: e8 7d 16 00 00 call 3cf8 <unlink>
267b: 85 c0 test %eax,%eax
267d: 0f 85 eb 02 00 00 jne 296e <subdir+0x44e>
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
2683: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
268a: 00
268b: c7 04 24 c2 4b 00 00 movl $0x4bc2,(%esp)
2692: e8 51 16 00 00 call 3ce8 <open>
2697: 85 c0 test %eax,%eax
2699: 0f 89 5f 04 00 00 jns 2afe <subdir+0x5de>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
exit();
}
if(chdir("dd") != 0){
269f: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
26a6: e8 6d 16 00 00 call 3d18 <chdir>
26ab: 85 c0 test %eax,%eax
26ad: 0f 85 32 04 00 00 jne 2ae5 <subdir+0x5c5>
printf(1, "chdir dd failed\n");
exit();
}
if(chdir("dd/../../dd") != 0){
26b3: c7 04 24 5a 4c 00 00 movl $0x4c5a,(%esp)
26ba: e8 59 16 00 00 call 3d18 <chdir>
26bf: 85 c0 test %eax,%eax
26c1: 0f 85 8e 02 00 00 jne 2955 <subdir+0x435>
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("dd/../../../dd") != 0){
26c7: c7 04 24 80 4c 00 00 movl $0x4c80,(%esp)
26ce: e8 45 16 00 00 call 3d18 <chdir>
26d3: 85 c0 test %eax,%eax
26d5: 0f 85 7a 02 00 00 jne 2955 <subdir+0x435>
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("./..") != 0){
26db: c7 04 24 8f 4c 00 00 movl $0x4c8f,(%esp)
26e2: e8 31 16 00 00 call 3d18 <chdir>
26e7: 85 c0 test %eax,%eax
26e9: 0f 85 2e 03 00 00 jne 2a1d <subdir+0x4fd>
printf(1, "chdir ./.. failed\n");
exit();
}
fd = open("dd/dd/ffff", 0);
26ef: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
26f6: 00
26f7: c7 04 24 26 4c 00 00 movl $0x4c26,(%esp)
26fe: e8 e5 15 00 00 call 3ce8 <open>
if(fd < 0){
2703: 85 c0 test %eax,%eax
if(chdir("./..") != 0){
printf(1, "chdir ./.. failed\n");
exit();
}
fd = open("dd/dd/ffff", 0);
2705: 89 c3 mov %eax,%ebx
if(fd < 0){
2707: 0f 88 81 05 00 00 js 2c8e <subdir+0x76e>
printf(1, "open dd/dd/ffff failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 2){
270d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
2714: 00
2715: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
271c: 00
271d: 89 04 24 mov %eax,(%esp)
2720: e8 9b 15 00 00 call 3cc0 <read>
2725: 83 f8 02 cmp $0x2,%eax
2728: 0f 85 47 05 00 00 jne 2c75 <subdir+0x755>
printf(1, "read dd/dd/ffff wrong len\n");
exit();
}
close(fd);
272e: 89 1c 24 mov %ebx,(%esp)
2731: e8 9a 15 00 00 call 3cd0 <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2736: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
273d: 00
273e: c7 04 24 c2 4b 00 00 movl $0x4bc2,(%esp)
2745: e8 9e 15 00 00 call 3ce8 <open>
274a: 85 c0 test %eax,%eax
274c: 0f 89 4e 02 00 00 jns 29a0 <subdir+0x480>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
exit();
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
2752: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2759: 00
275a: c7 04 24 da 4c 00 00 movl $0x4cda,(%esp)
2761: e8 82 15 00 00 call 3ce8 <open>
2766: 85 c0 test %eax,%eax
2768: 0f 89 19 02 00 00 jns 2987 <subdir+0x467>
printf(1, "create dd/ff/ff succeeded!\n");
exit();
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
276e: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2775: 00
2776: c7 04 24 ff 4c 00 00 movl $0x4cff,(%esp)
277d: e8 66 15 00 00 call 3ce8 <open>
2782: 85 c0 test %eax,%eax
2784: 0f 89 42 03 00 00 jns 2acc <subdir+0x5ac>
printf(1, "create dd/xx/ff succeeded!\n");
exit();
}
if(open("dd", O_CREATE) >= 0){
278a: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2791: 00
2792: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
2799: e8 4a 15 00 00 call 3ce8 <open>
279e: 85 c0 test %eax,%eax
27a0: 0f 89 0d 03 00 00 jns 2ab3 <subdir+0x593>
printf(1, "create dd succeeded!\n");
exit();
}
if(open("dd", O_RDWR) >= 0){
27a6: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
27ad: 00
27ae: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
27b5: e8 2e 15 00 00 call 3ce8 <open>
27ba: 85 c0 test %eax,%eax
27bc: 0f 89 d8 02 00 00 jns 2a9a <subdir+0x57a>
printf(1, "open dd rdwr succeeded!\n");
exit();
}
if(open("dd", O_WRONLY) >= 0){
27c2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
27c9: 00
27ca: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
27d1: e8 12 15 00 00 call 3ce8 <open>
27d6: 85 c0 test %eax,%eax
27d8: 0f 89 a3 02 00 00 jns 2a81 <subdir+0x561>
printf(1, "open dd wronly succeeded!\n");
exit();
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
27de: c7 44 24 04 6e 4d 00 movl $0x4d6e,0x4(%esp)
27e5: 00
27e6: c7 04 24 da 4c 00 00 movl $0x4cda,(%esp)
27ed: e8 16 15 00 00 call 3d08 <link>
27f2: 85 c0 test %eax,%eax
27f4: 0f 84 6e 02 00 00 je 2a68 <subdir+0x548>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
27fa: c7 44 24 04 6e 4d 00 movl $0x4d6e,0x4(%esp)
2801: 00
2802: c7 04 24 ff 4c 00 00 movl $0x4cff,(%esp)
2809: e8 fa 14 00 00 call 3d08 <link>
280e: 85 c0 test %eax,%eax
2810: 0f 84 39 02 00 00 je 2a4f <subdir+0x52f>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/ff", "dd/dd/ffff") == 0){
2816: c7 44 24 04 26 4c 00 movl $0x4c26,0x4(%esp)
281d: 00
281e: c7 04 24 c5 4b 00 00 movl $0x4bc5,(%esp)
2825: e8 de 14 00 00 call 3d08 <link>
282a: 85 c0 test %eax,%eax
282c: 0f 84 a0 01 00 00 je 29d2 <subdir+0x4b2>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
exit();
}
if(mkdir("dd/ff/ff") == 0){
2832: c7 04 24 da 4c 00 00 movl $0x4cda,(%esp)
2839: e8 d2 14 00 00 call 3d10 <mkdir>
283e: 85 c0 test %eax,%eax
2840: 0f 84 73 01 00 00 je 29b9 <subdir+0x499>
printf(1, "mkdir dd/ff/ff succeeded!\n");
exit();
}
if(mkdir("dd/xx/ff") == 0){
2846: c7 04 24 ff 4c 00 00 movl $0x4cff,(%esp)
284d: e8 be 14 00 00 call 3d10 <mkdir>
2852: 85 c0 test %eax,%eax
2854: 0f 84 02 04 00 00 je 2c5c <subdir+0x73c>
printf(1, "mkdir dd/xx/ff succeeded!\n");
exit();
}
if(mkdir("dd/dd/ffff") == 0){
285a: c7 04 24 26 4c 00 00 movl $0x4c26,(%esp)
2861: e8 aa 14 00 00 call 3d10 <mkdir>
2866: 85 c0 test %eax,%eax
2868: 0f 84 d5 03 00 00 je 2c43 <subdir+0x723>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
exit();
}
if(unlink("dd/xx/ff") == 0){
286e: c7 04 24 ff 4c 00 00 movl $0x4cff,(%esp)
2875: e8 7e 14 00 00 call 3cf8 <unlink>
287a: 85 c0 test %eax,%eax
287c: 0f 84 a8 03 00 00 je 2c2a <subdir+0x70a>
printf(1, "unlink dd/xx/ff succeeded!\n");
exit();
}
if(unlink("dd/ff/ff") == 0){
2882: c7 04 24 da 4c 00 00 movl $0x4cda,(%esp)
2889: e8 6a 14 00 00 call 3cf8 <unlink>
288e: 85 c0 test %eax,%eax
2890: 0f 84 7b 03 00 00 je 2c11 <subdir+0x6f1>
printf(1, "unlink dd/ff/ff succeeded!\n");
exit();
}
if(chdir("dd/ff") == 0){
2896: c7 04 24 c5 4b 00 00 movl $0x4bc5,(%esp)
289d: e8 76 14 00 00 call 3d18 <chdir>
28a2: 85 c0 test %eax,%eax
28a4: 0f 84 4e 03 00 00 je 2bf8 <subdir+0x6d8>
printf(1, "chdir dd/ff succeeded!\n");
exit();
}
if(chdir("dd/xx") == 0){
28aa: c7 04 24 71 4d 00 00 movl $0x4d71,(%esp)
28b1: e8 62 14 00 00 call 3d18 <chdir>
28b6: 85 c0 test %eax,%eax
28b8: 0f 84 21 03 00 00 je 2bdf <subdir+0x6bf>
printf(1, "chdir dd/xx succeeded!\n");
exit();
}
if(unlink("dd/dd/ffff") != 0){
28be: c7 04 24 26 4c 00 00 movl $0x4c26,(%esp)
28c5: e8 2e 14 00 00 call 3cf8 <unlink>
28ca: 85 c0 test %eax,%eax
28cc: 0f 85 9c 00 00 00 jne 296e <subdir+0x44e>
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(unlink("dd/ff") != 0){
28d2: c7 04 24 c5 4b 00 00 movl $0x4bc5,(%esp)
28d9: e8 1a 14 00 00 call 3cf8 <unlink>
28de: 85 c0 test %eax,%eax
28e0: 0f 85 e0 02 00 00 jne 2bc6 <subdir+0x6a6>
printf(1, "unlink dd/ff failed\n");
exit();
}
if(unlink("dd") == 0){
28e6: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
28ed: e8 06 14 00 00 call 3cf8 <unlink>
28f2: 85 c0 test %eax,%eax
28f4: 0f 84 b3 02 00 00 je 2bad <subdir+0x68d>
printf(1, "unlink non-empty dd succeeded!\n");
exit();
}
if(unlink("dd/dd") < 0){
28fa: c7 04 24 a1 4b 00 00 movl $0x4ba1,(%esp)
2901: e8 f2 13 00 00 call 3cf8 <unlink>
2906: 85 c0 test %eax,%eax
2908: 0f 88 86 02 00 00 js 2b94 <subdir+0x674>
printf(1, "unlink dd/dd failed\n");
exit();
}
if(unlink("dd") < 0){
290e: c7 04 24 8c 4c 00 00 movl $0x4c8c,(%esp)
2915: e8 de 13 00 00 call 3cf8 <unlink>
291a: 85 c0 test %eax,%eax
291c: 0f 88 59 02 00 00 js 2b7b <subdir+0x65b>
printf(1, "unlink dd failed\n");
exit();
}
printf(1, "subdir ok\n");
2922: c7 44 24 04 6e 4e 00 movl $0x4e6e,0x4(%esp)
2929: 00
292a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2931: e8 aa 14 00 00 call 3de0 <printf>
}
2936: 83 c4 14 add $0x14,%esp
2939: 5b pop %ebx
293a: 5d pop %ebp
293b: c3 ret
printf(1, "open dd/dd/../ff failed\n");
exit();
}
cc = read(fd, buf, sizeof(buf));
if(cc != 2 || buf[0] != 'f'){
printf(1, "dd/dd/../ff wrong content\n");
293c: c7 44 24 04 0b 4c 00 movl $0x4c0b,0x4(%esp)
2943: 00
2944: c7 04 24 01 00 00 00 movl $0x1,(%esp)
294b: e8 90 14 00 00 call 3de0 <printf>
exit();
2950: e8 53 13 00 00 call 3ca8 <exit>
if(chdir("dd/../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("dd/../../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
2955: c7 44 24 04 66 4c 00 movl $0x4c66,0x4(%esp)
295c: 00
295d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2964: e8 77 14 00 00 call 3de0 <printf>
exit();
2969: e8 3a 13 00 00 call 3ca8 <exit>
printf(1, "chdir dd/xx succeeded!\n");
exit();
}
if(unlink("dd/dd/ffff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
296e: c7 44 24 04 31 4c 00 movl $0x4c31,0x4(%esp)
2975: 00
2976: c7 04 24 01 00 00 00 movl $0x1,(%esp)
297d: e8 5e 14 00 00 call 3de0 <printf>
exit();
2982: e8 21 13 00 00 call 3ca8 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
exit();
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/ff/ff succeeded!\n");
2987: c7 44 24 04 e3 4c 00 movl $0x4ce3,0x4(%esp)
298e: 00
298f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2996: e8 45 14 00 00 call 3de0 <printf>
exit();
299b: e8 08 13 00 00 call 3ca8 <exit>
exit();
}
close(fd);
if(open("dd/dd/ff", O_RDONLY) >= 0){
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
29a0: c7 44 24 04 54 57 00 movl $0x5754,0x4(%esp)
29a7: 00
29a8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29af: e8 2c 14 00 00 call 3de0 <printf>
exit();
29b4: e8 ef 12 00 00 call 3ca8 <exit>
if(link("dd/ff", "dd/dd/ffff") == 0){
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
exit();
}
if(mkdir("dd/ff/ff") == 0){
printf(1, "mkdir dd/ff/ff succeeded!\n");
29b9: c7 44 24 04 77 4d 00 movl $0x4d77,0x4(%esp)
29c0: 00
29c1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29c8: e8 13 14 00 00 call 3de0 <printf>
exit();
29cd: e8 d6 12 00 00 call 3ca8 <exit>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/ff", "dd/dd/ffff") == 0){
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
29d2: c7 44 24 04 c4 57 00 movl $0x57c4,0x4(%esp)
29d9: 00
29da: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29e1: e8 fa 13 00 00 call 3de0 <printf>
exit();
29e6: e8 bd 12 00 00 call 3ca8 <exit>
write(fd, "FF", 2);
close(fd);
fd = open("dd/dd/../ff", 0);
if(fd < 0){
printf(1, "open dd/dd/../ff failed\n");
29eb: c7 44 24 04 f2 4b 00 movl $0x4bf2,0x4(%esp)
29f2: 00
29f3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29fa: e8 e1 13 00 00 call 3de0 <printf>
exit();
29ff: e8 a4 12 00 00 call 3ca8 <exit>
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create dd/dd/ff failed\n");
2a04: c7 44 24 04 cb 4b 00 movl $0x4bcb,0x4(%esp)
2a0b: 00
2a0c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a13: e8 c8 13 00 00 call 3de0 <printf>
exit();
2a18: e8 8b 12 00 00 call 3ca8 <exit>
if(chdir("dd/../../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("./..") != 0){
printf(1, "chdir ./.. failed\n");
2a1d: c7 44 24 04 94 4c 00 movl $0x4c94,0x4(%esp)
2a24: 00
2a25: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a2c: e8 af 13 00 00 call 3de0 <printf>
exit();
2a31: e8 72 12 00 00 call 3ca8 <exit>
exit();
}
close(fd);
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
2a36: c7 44 24 04 0c 57 00 movl $0x570c,0x4(%esp)
2a3d: 00
2a3e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a45: e8 96 13 00 00 call 3de0 <printf>
exit();
2a4a: e8 59 12 00 00 call 3ca8 <exit>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2a4f: c7 44 24 04 a0 57 00 movl $0x57a0,0x4(%esp)
2a56: 00
2a57: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a5e: e8 7d 13 00 00 call 3de0 <printf>
exit();
2a63: e8 40 12 00 00 call 3ca8 <exit>
if(open("dd", O_WRONLY) >= 0){
printf(1, "open dd wronly succeeded!\n");
exit();
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
2a68: c7 44 24 04 7c 57 00 movl $0x577c,0x4(%esp)
2a6f: 00
2a70: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a77: e8 64 13 00 00 call 3de0 <printf>
exit();
2a7c: e8 27 12 00 00 call 3ca8 <exit>
if(open("dd", O_RDWR) >= 0){
printf(1, "open dd rdwr succeeded!\n");
exit();
}
if(open("dd", O_WRONLY) >= 0){
printf(1, "open dd wronly succeeded!\n");
2a81: c7 44 24 04 53 4d 00 movl $0x4d53,0x4(%esp)
2a88: 00
2a89: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a90: e8 4b 13 00 00 call 3de0 <printf>
exit();
2a95: e8 0e 12 00 00 call 3ca8 <exit>
if(open("dd", O_CREATE) >= 0){
printf(1, "create dd succeeded!\n");
exit();
}
if(open("dd", O_RDWR) >= 0){
printf(1, "open dd rdwr succeeded!\n");
2a9a: c7 44 24 04 3a 4d 00 movl $0x4d3a,0x4(%esp)
2aa1: 00
2aa2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2aa9: e8 32 13 00 00 call 3de0 <printf>
exit();
2aae: e8 f5 11 00 00 call 3ca8 <exit>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/xx/ff succeeded!\n");
exit();
}
if(open("dd", O_CREATE) >= 0){
printf(1, "create dd succeeded!\n");
2ab3: c7 44 24 04 24 4d 00 movl $0x4d24,0x4(%esp)
2aba: 00
2abb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ac2: e8 19 13 00 00 call 3de0 <printf>
exit();
2ac7: e8 dc 11 00 00 call 3ca8 <exit>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/ff/ff succeeded!\n");
exit();
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/xx/ff succeeded!\n");
2acc: c7 44 24 04 08 4d 00 movl $0x4d08,0x4(%esp)
2ad3: 00
2ad4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2adb: e8 00 13 00 00 call 3de0 <printf>
exit();
2ae0: e8 c3 11 00 00 call 3ca8 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
exit();
}
if(chdir("dd") != 0){
printf(1, "chdir dd failed\n");
2ae5: c7 44 24 04 49 4c 00 movl $0x4c49,0x4(%esp)
2aec: 00
2aed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2af4: e8 e7 12 00 00 call 3de0 <printf>
exit();
2af9: e8 aa 11 00 00 call 3ca8 <exit>
if(unlink("dd/dd/ff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
2afe: c7 44 24 04 30 57 00 movl $0x5730,0x4(%esp)
2b05: 00
2b06: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b0d: e8 ce 12 00 00 call 3de0 <printf>
exit();
2b12: e8 91 11 00 00 call 3ca8 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
exit();
}
if(mkdir("/dd/dd") != 0){
printf(1, "subdir mkdir dd/dd failed\n");
2b17: c7 44 24 04 a7 4b 00 movl $0x4ba7,0x4(%esp)
2b1e: 00
2b1f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b26: e8 b5 12 00 00 call 3de0 <printf>
exit();
2b2b: e8 78 11 00 00 call 3ca8 <exit>
}
write(fd, "ff", 2);
close(fd);
if(unlink("dd") >= 0){
printf(1, "unlink dd (non-empty dir) succeeded!\n");
2b30: c7 44 24 04 e4 56 00 movl $0x56e4,0x4(%esp)
2b37: 00
2b38: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b3f: e8 9c 12 00 00 call 3de0 <printf>
exit();
2b44: e8 5f 11 00 00 call 3ca8 <exit>
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create dd/ff failed\n");
2b49: c7 44 24 04 8b 4b 00 movl $0x4b8b,0x4(%esp)
2b50: 00
2b51: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b58: e8 83 12 00 00 call 3de0 <printf>
exit();
2b5d: e8 46 11 00 00 call 3ca8 <exit>
printf(1, "subdir test\n");
unlink("ff");
if(mkdir("dd") != 0){
printf(1, "subdir mkdir dd failed\n");
2b62: c7 44 24 04 73 4b 00 movl $0x4b73,0x4(%esp)
2b69: 00
2b6a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b71: e8 6a 12 00 00 call 3de0 <printf>
exit();
2b76: e8 2d 11 00 00 call 3ca8 <exit>
if(unlink("dd/dd") < 0){
printf(1, "unlink dd/dd failed\n");
exit();
}
if(unlink("dd") < 0){
printf(1, "unlink dd failed\n");
2b7b: c7 44 24 04 5c 4e 00 movl $0x4e5c,0x4(%esp)
2b82: 00
2b83: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b8a: e8 51 12 00 00 call 3de0 <printf>
exit();
2b8f: e8 14 11 00 00 call 3ca8 <exit>
if(unlink("dd") == 0){
printf(1, "unlink non-empty dd succeeded!\n");
exit();
}
if(unlink("dd/dd") < 0){
printf(1, "unlink dd/dd failed\n");
2b94: c7 44 24 04 47 4e 00 movl $0x4e47,0x4(%esp)
2b9b: 00
2b9c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ba3: e8 38 12 00 00 call 3de0 <printf>
exit();
2ba8: e8 fb 10 00 00 call 3ca8 <exit>
if(unlink("dd/ff") != 0){
printf(1, "unlink dd/ff failed\n");
exit();
}
if(unlink("dd") == 0){
printf(1, "unlink non-empty dd succeeded!\n");
2bad: c7 44 24 04 e8 57 00 movl $0x57e8,0x4(%esp)
2bb4: 00
2bb5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bbc: e8 1f 12 00 00 call 3de0 <printf>
exit();
2bc1: e8 e2 10 00 00 call 3ca8 <exit>
if(unlink("dd/dd/ffff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(unlink("dd/ff") != 0){
printf(1, "unlink dd/ff failed\n");
2bc6: c7 44 24 04 32 4e 00 movl $0x4e32,0x4(%esp)
2bcd: 00
2bce: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bd5: e8 06 12 00 00 call 3de0 <printf>
exit();
2bda: e8 c9 10 00 00 call 3ca8 <exit>
if(chdir("dd/ff") == 0){
printf(1, "chdir dd/ff succeeded!\n");
exit();
}
if(chdir("dd/xx") == 0){
printf(1, "chdir dd/xx succeeded!\n");
2bdf: c7 44 24 04 1a 4e 00 movl $0x4e1a,0x4(%esp)
2be6: 00
2be7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bee: e8 ed 11 00 00 call 3de0 <printf>
exit();
2bf3: e8 b0 10 00 00 call 3ca8 <exit>
if(unlink("dd/ff/ff") == 0){
printf(1, "unlink dd/ff/ff succeeded!\n");
exit();
}
if(chdir("dd/ff") == 0){
printf(1, "chdir dd/ff succeeded!\n");
2bf8: c7 44 24 04 02 4e 00 movl $0x4e02,0x4(%esp)
2bff: 00
2c00: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c07: e8 d4 11 00 00 call 3de0 <printf>
exit();
2c0c: e8 97 10 00 00 call 3ca8 <exit>
if(unlink("dd/xx/ff") == 0){
printf(1, "unlink dd/xx/ff succeeded!\n");
exit();
}
if(unlink("dd/ff/ff") == 0){
printf(1, "unlink dd/ff/ff succeeded!\n");
2c11: c7 44 24 04 e6 4d 00 movl $0x4de6,0x4(%esp)
2c18: 00
2c19: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c20: e8 bb 11 00 00 call 3de0 <printf>
exit();
2c25: e8 7e 10 00 00 call 3ca8 <exit>
if(mkdir("dd/dd/ffff") == 0){
printf(1, "mkdir dd/dd/ffff succeeded!\n");
exit();
}
if(unlink("dd/xx/ff") == 0){
printf(1, "unlink dd/xx/ff succeeded!\n");
2c2a: c7 44 24 04 ca 4d 00 movl $0x4dca,0x4(%esp)
2c31: 00
2c32: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c39: e8 a2 11 00 00 call 3de0 <printf>
exit();
2c3e: e8 65 10 00 00 call 3ca8 <exit>
if(mkdir("dd/xx/ff") == 0){
printf(1, "mkdir dd/xx/ff succeeded!\n");
exit();
}
if(mkdir("dd/dd/ffff") == 0){
printf(1, "mkdir dd/dd/ffff succeeded!\n");
2c43: c7 44 24 04 ad 4d 00 movl $0x4dad,0x4(%esp)
2c4a: 00
2c4b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c52: e8 89 11 00 00 call 3de0 <printf>
exit();
2c57: e8 4c 10 00 00 call 3ca8 <exit>
if(mkdir("dd/ff/ff") == 0){
printf(1, "mkdir dd/ff/ff succeeded!\n");
exit();
}
if(mkdir("dd/xx/ff") == 0){
printf(1, "mkdir dd/xx/ff succeeded!\n");
2c5c: c7 44 24 04 92 4d 00 movl $0x4d92,0x4(%esp)
2c63: 00
2c64: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c6b: e8 70 11 00 00 call 3de0 <printf>
exit();
2c70: e8 33 10 00 00 call 3ca8 <exit>
if(fd < 0){
printf(1, "open dd/dd/ffff failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 2){
printf(1, "read dd/dd/ffff wrong len\n");
2c75: c7 44 24 04 bf 4c 00 movl $0x4cbf,0x4(%esp)
2c7c: 00
2c7d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c84: e8 57 11 00 00 call 3de0 <printf>
exit();
2c89: e8 1a 10 00 00 call 3ca8 <exit>
exit();
}
fd = open("dd/dd/ffff", 0);
if(fd < 0){
printf(1, "open dd/dd/ffff failed\n");
2c8e: c7 44 24 04 a7 4c 00 movl $0x4ca7,0x4(%esp)
2c95: 00
2c96: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c9d: e8 3e 11 00 00 call 3de0 <printf>
exit();
2ca2: e8 01 10 00 00 call 3ca8 <exit>
2ca7: 89 f6 mov %esi,%esi
2ca9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002cb0 <dirtest>:
}
printf(stdout, "many creates, followed by unlink; ok\n");
}
void dirtest(void)
{
2cb0: 55 push %ebp
2cb1: 89 e5 mov %esp,%ebp
2cb3: 83 ec 18 sub $0x18,%esp
printf(stdout, "mkdir test\n");
2cb6: a1 0c 59 00 00 mov 0x590c,%eax
2cbb: c7 44 24 04 79 4e 00 movl $0x4e79,0x4(%esp)
2cc2: 00
2cc3: 89 04 24 mov %eax,(%esp)
2cc6: e8 15 11 00 00 call 3de0 <printf>
if(mkdir("dir0") < 0){
2ccb: c7 04 24 85 4e 00 00 movl $0x4e85,(%esp)
2cd2: e8 39 10 00 00 call 3d10 <mkdir>
2cd7: 85 c0 test %eax,%eax
2cd9: 78 4b js 2d26 <dirtest+0x76>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0){
2cdb: c7 04 24 85 4e 00 00 movl $0x4e85,(%esp)
2ce2: e8 31 10 00 00 call 3d18 <chdir>
2ce7: 85 c0 test %eax,%eax
2ce9: 0f 88 85 00 00 00 js 2d74 <dirtest+0xc4>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0){
2cef: c7 04 24 91 4c 00 00 movl $0x4c91,(%esp)
2cf6: e8 1d 10 00 00 call 3d18 <chdir>
2cfb: 85 c0 test %eax,%eax
2cfd: 78 5b js 2d5a <dirtest+0xaa>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0){
2cff: c7 04 24 85 4e 00 00 movl $0x4e85,(%esp)
2d06: e8 ed 0f 00 00 call 3cf8 <unlink>
2d0b: 85 c0 test %eax,%eax
2d0d: 78 31 js 2d40 <dirtest+0x90>
printf(stdout, "unlink dir0 failed\n");
exit();
}
printf(stdout, "mkdir test ok\n");
2d0f: a1 0c 59 00 00 mov 0x590c,%eax
2d14: c7 44 24 04 d0 4e 00 movl $0x4ed0,0x4(%esp)
2d1b: 00
2d1c: 89 04 24 mov %eax,(%esp)
2d1f: e8 bc 10 00 00 call 3de0 <printf>
}
2d24: c9 leave
2d25: c3 ret
void dirtest(void)
{
printf(stdout, "mkdir test\n");
if(mkdir("dir0") < 0){
printf(stdout, "mkdir failed\n");
2d26: a1 0c 59 00 00 mov 0x590c,%eax
2d2b: c7 44 24 04 8a 4e 00 movl $0x4e8a,0x4(%esp)
2d32: 00
2d33: 89 04 24 mov %eax,(%esp)
2d36: e8 a5 10 00 00 call 3de0 <printf>
exit();
2d3b: e8 68 0f 00 00 call 3ca8 <exit>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0){
printf(stdout, "unlink dir0 failed\n");
2d40: a1 0c 59 00 00 mov 0x590c,%eax
2d45: c7 44 24 04 bc 4e 00 movl $0x4ebc,0x4(%esp)
2d4c: 00
2d4d: 89 04 24 mov %eax,(%esp)
2d50: e8 8b 10 00 00 call 3de0 <printf>
exit();
2d55: e8 4e 0f 00 00 call 3ca8 <exit>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0){
printf(stdout, "chdir .. failed\n");
2d5a: a1 0c 59 00 00 mov 0x590c,%eax
2d5f: c7 44 24 04 ab 4e 00 movl $0x4eab,0x4(%esp)
2d66: 00
2d67: 89 04 24 mov %eax,(%esp)
2d6a: e8 71 10 00 00 call 3de0 <printf>
exit();
2d6f: e8 34 0f 00 00 call 3ca8 <exit>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0){
printf(stdout, "chdir dir0 failed\n");
2d74: a1 0c 59 00 00 mov 0x590c,%eax
2d79: c7 44 24 04 98 4e 00 movl $0x4e98,0x4(%esp)
2d80: 00
2d81: 89 04 24 mov %eax,(%esp)
2d84: e8 57 10 00 00 call 3de0 <printf>
exit();
2d89: e8 1a 0f 00 00 call 3ca8 <exit>
2d8e: 66 90 xchg %ax,%ax
00002d90 <exitiputtest>:
}
// does exit() call iput(p->cwd) in a transaction?
void
exitiputtest(void)
{
2d90: 55 push %ebp
2d91: 89 e5 mov %esp,%ebp
2d93: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "exitiput test\n");
2d96: a1 0c 59 00 00 mov 0x590c,%eax
2d9b: c7 44 24 04 df 4e 00 movl $0x4edf,0x4(%esp)
2da2: 00
2da3: 89 04 24 mov %eax,(%esp)
2da6: e8 35 10 00 00 call 3de0 <printf>
pid = fork();
2dab: e8 f0 0e 00 00 call 3ca0 <fork>
if(pid < 0){
2db0: 83 f8 00 cmp $0x0,%eax
2db3: 7c 75 jl 2e2a <exitiputtest+0x9a>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
2db5: 75 39 jne 2df0 <exitiputtest+0x60>
if(mkdir("iputdir") < 0){
2db7: c7 04 24 05 4f 00 00 movl $0x4f05,(%esp)
2dbe: e8 4d 0f 00 00 call 3d10 <mkdir>
2dc3: 85 c0 test %eax,%eax
2dc5: 0f 88 93 00 00 00 js 2e5e <exitiputtest+0xce>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
2dcb: c7 04 24 05 4f 00 00 movl $0x4f05,(%esp)
2dd2: e8 41 0f 00 00 call 3d18 <chdir>
2dd7: 85 c0 test %eax,%eax
2dd9: 78 69 js 2e44 <exitiputtest+0xb4>
printf(stdout, "child chdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
2ddb: c7 04 24 02 4f 00 00 movl $0x4f02,(%esp)
2de2: e8 11 0f 00 00 call 3cf8 <unlink>
2de7: 85 c0 test %eax,%eax
2de9: 78 25 js 2e10 <exitiputtest+0x80>
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
exit();
2deb: e8 b8 0e 00 00 call 3ca8 <exit>
}
wait();
2df0: e8 bb 0e 00 00 call 3cb0 <wait>
printf(stdout, "exitiput test ok\n");
2df5: a1 0c 59 00 00 mov 0x590c,%eax
2dfa: c7 44 24 04 27 4f 00 movl $0x4f27,0x4(%esp)
2e01: 00
2e02: 89 04 24 mov %eax,(%esp)
2e05: e8 d6 0f 00 00 call 3de0 <printf>
}
2e0a: c9 leave
2e0b: c3 ret
2e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(chdir("iputdir") < 0){
printf(stdout, "child chdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
2e10: a1 0c 59 00 00 mov 0x590c,%eax
2e15: c7 44 24 04 0d 4f 00 movl $0x4f0d,0x4(%esp)
2e1c: 00
2e1d: 89 04 24 mov %eax,(%esp)
2e20: e8 bb 0f 00 00 call 3de0 <printf>
exit();
2e25: e8 7e 0e 00 00 call 3ca8 <exit>
printf(stdout, "exitiput test\n");
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
2e2a: a1 0c 59 00 00 mov 0x590c,%eax
2e2f: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
2e36: 00
2e37: 89 04 24 mov %eax,(%esp)
2e3a: e8 a1 0f 00 00 call 3de0 <printf>
exit();
2e3f: e8 64 0e 00 00 call 3ca8 <exit>
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
printf(stdout, "child chdir failed\n");
2e44: a1 0c 59 00 00 mov 0x590c,%eax
2e49: c7 44 24 04 ee 4e 00 movl $0x4eee,0x4(%esp)
2e50: 00
2e51: 89 04 24 mov %eax,(%esp)
2e54: e8 87 0f 00 00 call 3de0 <printf>
exit();
2e59: e8 4a 0e 00 00 call 3ca8 <exit>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
2e5e: a1 0c 59 00 00 mov 0x590c,%eax
2e63: c7 44 24 04 8a 4e 00 movl $0x4e8a,0x4(%esp)
2e6a: 00
2e6b: 89 04 24 mov %eax,(%esp)
2e6e: e8 6d 0f 00 00 call 3de0 <printf>
exit();
2e73: e8 30 0e 00 00 call 3ca8 <exit>
2e78: 90 nop
2e79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00002e80 <iputtest>:
int stdout = 1;
// does chdir() call iput(p->cwd) in a transaction?
void
iputtest(void)
{
2e80: 55 push %ebp
2e81: 89 e5 mov %esp,%ebp
2e83: 83 ec 18 sub $0x18,%esp
printf(stdout, "iput test\n");
2e86: a1 0c 59 00 00 mov 0x590c,%eax
2e8b: c7 44 24 04 2c 49 00 movl $0x492c,0x4(%esp)
2e92: 00
2e93: 89 04 24 mov %eax,(%esp)
2e96: e8 45 0f 00 00 call 3de0 <printf>
if(mkdir("iputdir") < 0){
2e9b: c7 04 24 05 4f 00 00 movl $0x4f05,(%esp)
2ea2: e8 69 0e 00 00 call 3d10 <mkdir>
2ea7: 85 c0 test %eax,%eax
2ea9: 78 4b js 2ef6 <iputtest+0x76>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
2eab: c7 04 24 05 4f 00 00 movl $0x4f05,(%esp)
2eb2: e8 61 0e 00 00 call 3d18 <chdir>
2eb7: 85 c0 test %eax,%eax
2eb9: 0f 88 85 00 00 00 js 2f44 <iputtest+0xc4>
printf(stdout, "chdir iputdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
2ebf: c7 04 24 02 4f 00 00 movl $0x4f02,(%esp)
2ec6: e8 2d 0e 00 00 call 3cf8 <unlink>
2ecb: 85 c0 test %eax,%eax
2ecd: 78 5b js 2f2a <iputtest+0xaa>
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
if(chdir("/") < 0){
2ecf: c7 04 24 a9 49 00 00 movl $0x49a9,(%esp)
2ed6: e8 3d 0e 00 00 call 3d18 <chdir>
2edb: 85 c0 test %eax,%eax
2edd: 78 31 js 2f10 <iputtest+0x90>
printf(stdout, "chdir / failed\n");
exit();
}
printf(stdout, "iput test ok\n");
2edf: a1 0c 59 00 00 mov 0x590c,%eax
2ee4: c7 44 24 04 55 49 00 movl $0x4955,0x4(%esp)
2eeb: 00
2eec: 89 04 24 mov %eax,(%esp)
2eef: e8 ec 0e 00 00 call 3de0 <printf>
}
2ef4: c9 leave
2ef5: c3 ret
iputtest(void)
{
printf(stdout, "iput test\n");
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
2ef6: a1 0c 59 00 00 mov 0x590c,%eax
2efb: c7 44 24 04 8a 4e 00 movl $0x4e8a,0x4(%esp)
2f02: 00
2f03: 89 04 24 mov %eax,(%esp)
2f06: e8 d5 0e 00 00 call 3de0 <printf>
exit();
2f0b: e8 98 0d 00 00 call 3ca8 <exit>
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
if(chdir("/") < 0){
printf(stdout, "chdir / failed\n");
2f10: a1 0c 59 00 00 mov 0x590c,%eax
2f15: c7 44 24 04 f9 4a 00 movl $0x4af9,0x4(%esp)
2f1c: 00
2f1d: 89 04 24 mov %eax,(%esp)
2f20: e8 bb 0e 00 00 call 3de0 <printf>
exit();
2f25: e8 7e 0d 00 00 call 3ca8 <exit>
if(chdir("iputdir") < 0){
printf(stdout, "chdir iputdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
2f2a: a1 0c 59 00 00 mov 0x590c,%eax
2f2f: c7 44 24 04 0d 4f 00 movl $0x4f0d,0x4(%esp)
2f36: 00
2f37: 89 04 24 mov %eax,(%esp)
2f3a: e8 a1 0e 00 00 call 3de0 <printf>
exit();
2f3f: e8 64 0d 00 00 call 3ca8 <exit>
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
printf(stdout, "chdir iputdir failed\n");
2f44: a1 0c 59 00 00 mov 0x590c,%eax
2f49: c7 44 24 04 39 4f 00 movl $0x4f39,0x4(%esp)
2f50: 00
2f51: 89 04 24 mov %eax,(%esp)
2f54: e8 87 0e 00 00 call 3de0 <printf>
exit();
2f59: e8 4a 0d 00 00 call 3ca8 <exit>
2f5e: 66 90 xchg %ax,%ax
00002f60 <bigfile>:
printf(1, "bigwrite ok\n");
}
void
bigfile(void)
{
2f60: 55 push %ebp
2f61: 89 e5 mov %esp,%ebp
2f63: 57 push %edi
2f64: 56 push %esi
2f65: 53 push %ebx
2f66: 83 ec 1c sub $0x1c,%esp
int fd, i, total, cc;
printf(1, "bigfile test\n");
2f69: c7 44 24 04 4f 4f 00 movl $0x4f4f,0x4(%esp)
2f70: 00
2f71: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f78: e8 63 0e 00 00 call 3de0 <printf>
unlink("bigfile");
2f7d: c7 04 24 6b 4f 00 00 movl $0x4f6b,(%esp)
2f84: e8 6f 0d 00 00 call 3cf8 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
2f89: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2f90: 00
2f91: c7 04 24 6b 4f 00 00 movl $0x4f6b,(%esp)
2f98: e8 4b 0d 00 00 call 3ce8 <open>
if(fd < 0){
2f9d: 85 c0 test %eax,%eax
int fd, i, total, cc;
printf(1, "bigfile test\n");
unlink("bigfile");
fd = open("bigfile", O_CREATE | O_RDWR);
2f9f: 89 c6 mov %eax,%esi
if(fd < 0){
2fa1: 0f 88 7f 01 00 00 js 3126 <bigfile+0x1c6>
printf(1, "cannot create bigfile");
exit();
2fa7: 31 db xor %ebx,%ebx
2fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
for(i = 0; i < 20; i++){
memset(buf, i, 600);
2fb0: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
2fb7: 00
2fb8: 89 5c 24 04 mov %ebx,0x4(%esp)
2fbc: c7 04 24 e0 80 00 00 movl $0x80e0,(%esp)
2fc3: e8 58 0b 00 00 call 3b20 <memset>
if(write(fd, buf, 600) != 600){
2fc8: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
2fcf: 00
2fd0: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
2fd7: 00
2fd8: 89 34 24 mov %esi,(%esp)
2fdb: e8 e8 0c 00 00 call 3cc8 <write>
2fe0: 3d 58 02 00 00 cmp $0x258,%eax
2fe5: 0f 85 09 01 00 00 jne 30f4 <bigfile+0x194>
fd = open("bigfile", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigfile");
exit();
}
for(i = 0; i < 20; i++){
2feb: 83 c3 01 add $0x1,%ebx
2fee: 83 fb 14 cmp $0x14,%ebx
2ff1: 75 bd jne 2fb0 <bigfile+0x50>
if(write(fd, buf, 600) != 600){
printf(1, "write bigfile failed\n");
exit();
}
}
close(fd);
2ff3: 89 34 24 mov %esi,(%esp)
2ff6: e8 d5 0c 00 00 call 3cd0 <close>
fd = open("bigfile", 0);
2ffb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3002: 00
3003: c7 04 24 6b 4f 00 00 movl $0x4f6b,(%esp)
300a: e8 d9 0c 00 00 call 3ce8 <open>
if(fd < 0){
300f: 85 c0 test %eax,%eax
exit();
}
}
close(fd);
fd = open("bigfile", 0);
3011: 89 c7 mov %eax,%edi
if(fd < 0){
3013: 0f 88 f4 00 00 00 js 310d <bigfile+0x1ad>
printf(1, "cannot open bigfile\n");
exit();
3019: 31 f6 xor %esi,%esi
301b: 31 db xor %ebx,%ebx
301d: eb 2f jmp 304e <bigfile+0xee>
301f: 90 nop
printf(1, "read bigfile failed\n");
exit();
}
if(cc == 0)
break;
if(cc != 300){
3020: 3d 2c 01 00 00 cmp $0x12c,%eax
3025: 0f 85 97 00 00 00 jne 30c2 <bigfile+0x162>
printf(1, "short read bigfile\n");
exit();
}
if(buf[0] != i/2 || buf[299] != i/2){
302b: 0f be 05 e0 80 00 00 movsbl 0x80e0,%eax
3032: 89 da mov %ebx,%edx
3034: d1 fa sar %edx
3036: 39 d0 cmp %edx,%eax
3038: 75 6f jne 30a9 <bigfile+0x149>
303a: 0f be 15 0b 82 00 00 movsbl 0x820b,%edx
3041: 39 d0 cmp %edx,%eax
3043: 75 64 jne 30a9 <bigfile+0x149>
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
3045: 81 c6 2c 01 00 00 add $0x12c,%esi
if(fd < 0){
printf(1, "cannot open bigfile\n");
exit();
}
total = 0;
for(i = 0; ; i++){
304b: 83 c3 01 add $0x1,%ebx
cc = read(fd, buf, 300);
304e: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp)
3055: 00
3056: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
305d: 00
305e: 89 3c 24 mov %edi,(%esp)
3061: e8 5a 0c 00 00 call 3cc0 <read>
if(cc < 0){
3066: 83 f8 00 cmp $0x0,%eax
3069: 7c 70 jl 30db <bigfile+0x17b>
printf(1, "read bigfile failed\n");
exit();
}
if(cc == 0)
306b: 75 b3 jne 3020 <bigfile+0xc0>
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
}
close(fd);
306d: 89 3c 24 mov %edi,(%esp)
3070: e8 5b 0c 00 00 call 3cd0 <close>
if(total != 20*600){
3075: 81 fe e0 2e 00 00 cmp $0x2ee0,%esi
307b: 0f 85 be 00 00 00 jne 313f <bigfile+0x1df>
printf(1, "read bigfile wrong total\n");
exit();
}
unlink("bigfile");
3081: c7 04 24 6b 4f 00 00 movl $0x4f6b,(%esp)
3088: e8 6b 0c 00 00 call 3cf8 <unlink>
printf(1, "bigfile test ok\n");
308d: c7 44 24 04 fa 4f 00 movl $0x4ffa,0x4(%esp)
3094: 00
3095: c7 04 24 01 00 00 00 movl $0x1,(%esp)
309c: e8 3f 0d 00 00 call 3de0 <printf>
}
30a1: 83 c4 1c add $0x1c,%esp
30a4: 5b pop %ebx
30a5: 5e pop %esi
30a6: 5f pop %edi
30a7: 5d pop %ebp
30a8: c3 ret
if(cc != 300){
printf(1, "short read bigfile\n");
exit();
}
if(buf[0] != i/2 || buf[299] != i/2){
printf(1, "read bigfile wrong data\n");
30a9: c7 44 24 04 c7 4f 00 movl $0x4fc7,0x4(%esp)
30b0: 00
30b1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30b8: e8 23 0d 00 00 call 3de0 <printf>
exit();
30bd: e8 e6 0b 00 00 call 3ca8 <exit>
exit();
}
if(cc == 0)
break;
if(cc != 300){
printf(1, "short read bigfile\n");
30c2: c7 44 24 04 b3 4f 00 movl $0x4fb3,0x4(%esp)
30c9: 00
30ca: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30d1: e8 0a 0d 00 00 call 3de0 <printf>
exit();
30d6: e8 cd 0b 00 00 call 3ca8 <exit>
}
total = 0;
for(i = 0; ; i++){
cc = read(fd, buf, 300);
if(cc < 0){
printf(1, "read bigfile failed\n");
30db: c7 44 24 04 9e 4f 00 movl $0x4f9e,0x4(%esp)
30e2: 00
30e3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30ea: e8 f1 0c 00 00 call 3de0 <printf>
exit();
30ef: e8 b4 0b 00 00 call 3ca8 <exit>
exit();
}
for(i = 0; i < 20; i++){
memset(buf, i, 600);
if(write(fd, buf, 600) != 600){
printf(1, "write bigfile failed\n");
30f4: c7 44 24 04 73 4f 00 movl $0x4f73,0x4(%esp)
30fb: 00
30fc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3103: e8 d8 0c 00 00 call 3de0 <printf>
exit();
3108: e8 9b 0b 00 00 call 3ca8 <exit>
}
close(fd);
fd = open("bigfile", 0);
if(fd < 0){
printf(1, "cannot open bigfile\n");
310d: c7 44 24 04 89 4f 00 movl $0x4f89,0x4(%esp)
3114: 00
3115: c7 04 24 01 00 00 00 movl $0x1,(%esp)
311c: e8 bf 0c 00 00 call 3de0 <printf>
exit();
3121: e8 82 0b 00 00 call 3ca8 <exit>
printf(1, "bigfile test\n");
unlink("bigfile");
fd = open("bigfile", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigfile");
3126: c7 44 24 04 5d 4f 00 movl $0x4f5d,0x4(%esp)
312d: 00
312e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3135: e8 a6 0c 00 00 call 3de0 <printf>
exit();
313a: e8 69 0b 00 00 call 3ca8 <exit>
}
total += cc;
}
close(fd);
if(total != 20*600){
printf(1, "read bigfile wrong total\n");
313f: c7 44 24 04 e0 4f 00 movl $0x4fe0,0x4(%esp)
3146: 00
3147: c7 04 24 01 00 00 00 movl $0x1,(%esp)
314e: e8 8d 0c 00 00 call 3de0 <printf>
exit();
3153: e8 50 0b 00 00 call 3ca8 <exit>
3158: 90 nop
3159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003160 <concreate>:
}
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
3160: 55 push %ebp
3161: 89 e5 mov %esp,%ebp
3163: 57 push %edi
3164: 56 push %esi
3165: 53 push %ebx
char name[14];
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
3166: 31 db xor %ebx,%ebx
}
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
3168: 83 ec 6c sub $0x6c,%esp
struct {
ushort inum;
char name[14];
} de;
printf(1, "concreate test\n");
316b: c7 44 24 04 0b 50 00 movl $0x500b,0x4(%esp)
3172: 00
3173: 8d 75 e5 lea -0x1b(%ebp),%esi
3176: c7 04 24 01 00 00 00 movl $0x1,(%esp)
317d: e8 5e 0c 00 00 call 3de0 <printf>
file[0] = 'C';
3182: c6 45 e5 43 movb $0x43,-0x1b(%ebp)
file[2] = '\0';
3186: c6 45 e7 00 movb $0x0,-0x19(%ebp)
318a: eb 4f jmp 31db <concreate+0x7b>
318c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
3190: b8 56 55 55 55 mov $0x55555556,%eax
3195: f7 eb imul %ebx
3197: 89 d8 mov %ebx,%eax
3199: c1 f8 1f sar $0x1f,%eax
319c: 29 c2 sub %eax,%edx
319e: 8d 04 52 lea (%edx,%edx,2),%eax
31a1: 89 da mov %ebx,%edx
31a3: 29 c2 sub %eax,%edx
31a5: 83 fa 01 cmp $0x1,%edx
31a8: 74 7e je 3228 <concreate+0xc8>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
link("C0", file);
} else {
fd = open(file, O_CREATE | O_RDWR);
31aa: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
31b1: 00
31b2: 89 34 24 mov %esi,(%esp)
31b5: e8 2e 0b 00 00 call 3ce8 <open>
if(fd < 0){
31ba: 85 c0 test %eax,%eax
31bc: 0f 88 53 02 00 00 js 3415 <concreate+0x2b5>
printf(1, "concreate create %s failed\n", file);
exit();
}
close(fd);
31c2: 89 04 24 mov %eax,(%esp)
31c5: e8 06 0b 00 00 call 3cd0 <close>
}
if(pid == 0)
31ca: 85 ff test %edi,%edi
31cc: 74 52 je 3220 <concreate+0xc0>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
31ce: 83 c3 01 add $0x1,%ebx
close(fd);
}
if(pid == 0)
exit();
else
wait();
31d1: e8 da 0a 00 00 call 3cb0 <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
31d6: 83 fb 28 cmp $0x28,%ebx
31d9: 74 6d je 3248 <concreate+0xe8>
file[1] = '0' + i;
31db: 8d 43 30 lea 0x30(%ebx),%eax
31de: 88 45 e6 mov %al,-0x1a(%ebp)
unlink(file);
31e1: 89 34 24 mov %esi,(%esp)
31e4: e8 0f 0b 00 00 call 3cf8 <unlink>
pid = fork();
31e9: e8 b2 0a 00 00 call 3ca0 <fork>
if(pid && (i % 3) == 1){
31ee: 85 c0 test %eax,%eax
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
31f0: 89 c7 mov %eax,%edi
if(pid && (i % 3) == 1){
31f2: 75 9c jne 3190 <concreate+0x30>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
31f4: b8 67 66 66 66 mov $0x66666667,%eax
31f9: f7 eb imul %ebx
31fb: 89 d8 mov %ebx,%eax
31fd: c1 f8 1f sar $0x1f,%eax
3200: d1 fa sar %edx
3202: 29 c2 sub %eax,%edx
3204: 8d 04 92 lea (%edx,%edx,4),%eax
3207: 89 da mov %ebx,%edx
3209: 29 c2 sub %eax,%edx
320b: 83 fa 01 cmp $0x1,%edx
320e: 75 9a jne 31aa <concreate+0x4a>
link("C0", file);
3210: 89 74 24 04 mov %esi,0x4(%esp)
3214: c7 04 24 1b 50 00 00 movl $0x501b,(%esp)
321b: e8 e8 0a 00 00 call 3d08 <link>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
i = de.name[1] - '0';
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
exit();
3220: e8 83 0a 00 00 call 3ca8 <exit>
3225: 8d 76 00 lea 0x0(%esi),%esi
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
3228: 83 c3 01 add $0x1,%ebx
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
link("C0", file);
322b: 89 74 24 04 mov %esi,0x4(%esp)
322f: c7 04 24 1b 50 00 00 movl $0x501b,(%esp)
3236: e8 cd 0a 00 00 call 3d08 <link>
close(fd);
}
if(pid == 0)
exit();
else
wait();
323b: e8 70 0a 00 00 call 3cb0 <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
3240: 83 fb 28 cmp $0x28,%ebx
3243: 75 96 jne 31db <concreate+0x7b>
3245: 8d 76 00 lea 0x0(%esi),%esi
exit();
else
wait();
}
memset(fa, 0, sizeof(fa));
3248: 8d 45 ac lea -0x54(%ebp),%eax
324b: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp)
3252: 00
3253: 8d 7d d4 lea -0x2c(%ebp),%edi
3256: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
325d: 00
325e: 89 04 24 mov %eax,(%esp)
3261: e8 ba 08 00 00 call 3b20 <memset>
fd = open(".", 0);
3266: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
326d: 00
326e: c7 04 24 92 4c 00 00 movl $0x4c92,(%esp)
3275: e8 6e 0a 00 00 call 3ce8 <open>
327a: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
3281: 89 c3 mov %eax,%ebx
3283: 90 nop
3284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = 0;
while(read(fd, &de, sizeof(de)) > 0){
3288: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
328f: 00
3290: 89 7c 24 04 mov %edi,0x4(%esp)
3294: 89 1c 24 mov %ebx,(%esp)
3297: e8 24 0a 00 00 call 3cc0 <read>
329c: 85 c0 test %eax,%eax
329e: 7e 40 jle 32e0 <concreate+0x180>
if(de.inum == 0)
32a0: 66 83 7d d4 00 cmpw $0x0,-0x2c(%ebp)
32a5: 74 e1 je 3288 <concreate+0x128>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
32a7: 80 7d d6 43 cmpb $0x43,-0x2a(%ebp)
32ab: 75 db jne 3288 <concreate+0x128>
32ad: 80 7d d8 00 cmpb $0x0,-0x28(%ebp)
32b1: 75 d5 jne 3288 <concreate+0x128>
i = de.name[1] - '0';
32b3: 0f be 45 d7 movsbl -0x29(%ebp),%eax
32b7: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
32ba: 83 f8 27 cmp $0x27,%eax
32bd: 0f 87 6f 01 00 00 ja 3432 <concreate+0x2d2>
printf(1, "concreate weird file %s\n", de.name);
exit();
}
if(fa[i]){
32c3: 80 7c 05 ac 00 cmpb $0x0,-0x54(%ebp,%eax,1)
32c8: 0f 85 9d 01 00 00 jne 346b <concreate+0x30b>
printf(1, "concreate duplicate file %s\n", de.name);
exit();
}
fa[i] = 1;
32ce: c6 44 05 ac 01 movb $0x1,-0x54(%ebp,%eax,1)
n++;
32d3: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
32d7: eb af jmp 3288 <concreate+0x128>
32d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
close(fd);
32e0: 89 1c 24 mov %ebx,(%esp)
32e3: e8 e8 09 00 00 call 3cd0 <close>
if(n != 40){
32e8: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
32ec: 0f 85 60 01 00 00 jne 3452 <concreate+0x2f2>
printf(1, "concreate not enough files in directory listing\n");
exit();
32f2: 31 db xor %ebx,%ebx
32f4: e9 8d 00 00 00 jmp 3386 <concreate+0x226>
32f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
if(((i % 3) == 0 && pid == 0) ||
3300: 83 f8 01 cmp $0x1,%eax
3303: 0f 85 b1 00 00 00 jne 33ba <concreate+0x25a>
3309: 85 ff test %edi,%edi
330b: 0f 84 a9 00 00 00 je 33ba <concreate+0x25a>
((i % 3) == 1 && pid != 0)){
close(open(file, 0));
3311: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3318: 00
3319: 89 34 24 mov %esi,(%esp)
331c: e8 c7 09 00 00 call 3ce8 <open>
3321: 89 04 24 mov %eax,(%esp)
3324: e8 a7 09 00 00 call 3cd0 <close>
close(open(file, 0));
3329: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3330: 00
3331: 89 34 24 mov %esi,(%esp)
3334: e8 af 09 00 00 call 3ce8 <open>
3339: 89 04 24 mov %eax,(%esp)
333c: e8 8f 09 00 00 call 3cd0 <close>
close(open(file, 0));
3341: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3348: 00
3349: 89 34 24 mov %esi,(%esp)
334c: e8 97 09 00 00 call 3ce8 <open>
3351: 89 04 24 mov %eax,(%esp)
3354: e8 77 09 00 00 call 3cd0 <close>
close(open(file, 0));
3359: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3360: 00
3361: 89 34 24 mov %esi,(%esp)
3364: e8 7f 09 00 00 call 3ce8 <open>
3369: 89 04 24 mov %eax,(%esp)
336c: e8 5f 09 00 00 call 3cd0 <close>
unlink(file);
unlink(file);
unlink(file);
unlink(file);
}
if(pid == 0)
3371: 85 ff test %edi,%edi
3373: 0f 84 a7 fe ff ff je 3220 <concreate+0xc0>
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
exit();
}
for(i = 0; i < 40; i++){
3379: 83 c3 01 add $0x1,%ebx
unlink(file);
}
if(pid == 0)
exit();
else
wait();
337c: e8 2f 09 00 00 call 3cb0 <wait>
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
exit();
}
for(i = 0; i < 40; i++){
3381: 83 fb 28 cmp $0x28,%ebx
3384: 74 5a je 33e0 <concreate+0x280>
file[1] = '0' + i;
3386: 8d 43 30 lea 0x30(%ebx),%eax
3389: 88 45 e6 mov %al,-0x1a(%ebp)
pid = fork();
338c: e8 0f 09 00 00 call 3ca0 <fork>
if(pid < 0){
3391: 85 c0 test %eax,%eax
exit();
}
for(i = 0; i < 40; i++){
file[1] = '0' + i;
pid = fork();
3393: 89 c7 mov %eax,%edi
if(pid < 0){
3395: 78 65 js 33fc <concreate+0x29c>
printf(1, "fork failed\n");
exit();
}
if(((i % 3) == 0 && pid == 0) ||
3397: b8 56 55 55 55 mov $0x55555556,%eax
339c: f7 eb imul %ebx
339e: 89 d8 mov %ebx,%eax
33a0: c1 f8 1f sar $0x1f,%eax
33a3: 29 c2 sub %eax,%edx
33a5: 89 d8 mov %ebx,%eax
33a7: 8d 14 52 lea (%edx,%edx,2),%edx
33aa: 29 d0 sub %edx,%eax
33ac: 0f 85 4e ff ff ff jne 3300 <concreate+0x1a0>
33b2: 85 ff test %edi,%edi
33b4: 0f 84 57 ff ff ff je 3311 <concreate+0x1b1>
close(open(file, 0));
close(open(file, 0));
close(open(file, 0));
close(open(file, 0));
} else {
unlink(file);
33ba: 89 34 24 mov %esi,(%esp)
33bd: e8 36 09 00 00 call 3cf8 <unlink>
unlink(file);
33c2: 89 34 24 mov %esi,(%esp)
33c5: e8 2e 09 00 00 call 3cf8 <unlink>
unlink(file);
33ca: 89 34 24 mov %esi,(%esp)
33cd: e8 26 09 00 00 call 3cf8 <unlink>
unlink(file);
33d2: 89 34 24 mov %esi,(%esp)
33d5: e8 1e 09 00 00 call 3cf8 <unlink>
33da: eb 95 jmp 3371 <concreate+0x211>
33dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exit();
else
wait();
}
printf(1, "concreate ok\n");
33e0: c7 44 24 04 70 50 00 movl $0x5070,0x4(%esp)
33e7: 00
33e8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
33ef: e8 ec 09 00 00 call 3de0 <printf>
}
33f4: 83 c4 6c add $0x6c,%esp
33f7: 5b pop %ebx
33f8: 5e pop %esi
33f9: 5f pop %edi
33fa: 5d pop %ebp
33fb: c3 ret
for(i = 0; i < 40; i++){
file[1] = '0' + i;
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
33fc: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
3403: 00
3404: c7 04 24 01 00 00 00 movl $0x1,(%esp)
340b: e8 d0 09 00 00 call 3de0 <printf>
exit();
3410: e8 93 08 00 00 call 3ca8 <exit>
} else if(pid == 0 && (i % 5) == 1){
link("C0", file);
} else {
fd = open(file, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "concreate create %s failed\n", file);
3415: 89 74 24 08 mov %esi,0x8(%esp)
3419: c7 44 24 04 1e 50 00 movl $0x501e,0x4(%esp)
3420: 00
3421: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3428: e8 b3 09 00 00 call 3de0 <printf>
exit();
342d: e8 76 08 00 00 call 3ca8 <exit>
if(de.inum == 0)
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
i = de.name[1] - '0';
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
3432: 8d 45 d6 lea -0x2a(%ebp),%eax
3435: 89 44 24 08 mov %eax,0x8(%esp)
3439: c7 44 24 04 3a 50 00 movl $0x503a,0x4(%esp)
3440: 00
3441: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3448: e8 93 09 00 00 call 3de0 <printf>
344d: e9 ce fd ff ff jmp 3220 <concreate+0xc0>
}
}
close(fd);
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
3452: c7 44 24 04 08 58 00 movl $0x5808,0x4(%esp)
3459: 00
345a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3461: e8 7a 09 00 00 call 3de0 <printf>
exit();
3466: e8 3d 08 00 00 call 3ca8 <exit>
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
exit();
}
if(fa[i]){
printf(1, "concreate duplicate file %s\n", de.name);
346b: 8d 45 d6 lea -0x2a(%ebp),%eax
346e: 89 44 24 08 mov %eax,0x8(%esp)
3472: c7 44 24 04 53 50 00 movl $0x5053,0x4(%esp)
3479: 00
347a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3481: e8 5a 09 00 00 call 3de0 <printf>
exit();
3486: e8 1d 08 00 00 call 3ca8 <exit>
348b: 90 nop
348c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00003490 <fourfiles>:
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
3490: 55 push %ebp
3491: 89 e5 mov %esp,%ebp
3493: 57 push %edi
3494: 56 push %esi
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
3495: be 7e 50 00 00 mov $0x507e,%esi
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
349a: 53 push %ebx
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
349b: 31 db xor %ebx,%ebx
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
349d: 83 ec 3c sub $0x3c,%esp
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
34a0: c7 44 24 04 84 50 00 movl $0x5084,0x4(%esp)
34a7: 00
for(pi = 0; pi < 4; pi++){
34a8: 8d 7d d8 lea -0x28(%ebp),%edi
// time, to test block allocation.
void
fourfiles(void)
{
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
34ab: c7 45 d8 7e 50 00 00 movl $0x507e,-0x28(%ebp)
34b2: c7 45 dc c7 46 00 00 movl $0x46c7,-0x24(%ebp)
34b9: c7 45 e0 cb 46 00 00 movl $0x46cb,-0x20(%ebp)
34c0: c7 45 e4 81 50 00 00 movl $0x5081,-0x1c(%ebp)
char *fname;
printf(1, "fourfiles test\n");
34c7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
34ce: e8 0d 09 00 00 call 3de0 <printf>
for(pi = 0; pi < 4; pi++){
fname = names[pi];
unlink(fname);
34d3: 89 34 24 mov %esi,(%esp)
34d6: e8 1d 08 00 00 call 3cf8 <unlink>
pid = fork();
34db: e8 c0 07 00 00 call 3ca0 <fork>
if(pid < 0){
34e0: 83 f8 00 cmp $0x0,%eax
34e3: 0f 8c 88 01 00 00 jl 3671 <fourfiles+0x1e1>
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
34e9: 0f 84 e8 00 00 00 je 35d7 <fourfiles+0x147>
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
for(pi = 0; pi < 4; pi++){
34ef: 83 c3 01 add $0x1,%ebx
34f2: 83 fb 04 cmp $0x4,%ebx
34f5: 74 05 je 34fc <fourfiles+0x6c>
34f7: 8b 34 9f mov (%edi,%ebx,4),%esi
34fa: eb d7 jmp 34d3 <fourfiles+0x43>
exit();
}
}
for(pi = 0; pi < 4; pi++){
wait();
34fc: e8 af 07 00 00 call 3cb0 <wait>
3501: bb 30 00 00 00 mov $0x30,%ebx
3506: e8 a5 07 00 00 call 3cb0 <wait>
350b: e8 a0 07 00 00 call 3cb0 <wait>
3510: e8 9b 07 00 00 call 3cb0 <wait>
3515: c7 45 d4 7e 50 00 00 movl $0x507e,-0x2c(%ebp)
}
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
351c: 8b 45 d4 mov -0x2c(%ebp),%eax
351f: 31 f6 xor %esi,%esi
3521: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3528: 00
3529: 89 04 24 mov %eax,(%esp)
352c: e8 b7 07 00 00 call 3ce8 <open>
3531: 89 c7 mov %eax,%edi
3533: 90 nop
3534: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
3538: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
353f: 00
3540: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
3547: 00
3548: 89 3c 24 mov %edi,(%esp)
354b: e8 70 07 00 00 call 3cc0 <read>
3550: 85 c0 test %eax,%eax
3552: 7e 1a jle 356e <fourfiles+0xde>
3554: 31 d2 xor %edx,%edx
3556: 66 90 xchg %ax,%ax
for(j = 0; j < n; j++){
if(buf[j] != '0'+i){
3558: 0f be 8a e0 80 00 00 movsbl 0x80e0(%edx),%ecx
355f: 39 d9 cmp %ebx,%ecx
3561: 75 5b jne 35be <fourfiles+0x12e>
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
3563: 83 c2 01 add $0x1,%edx
3566: 39 d0 cmp %edx,%eax
3568: 7f ee jg 3558 <fourfiles+0xc8>
if(buf[j] != '0'+i){
printf(1, "wrong char\n");
exit();
}
}
total += n;
356a: 01 c6 add %eax,%esi
356c: eb ca jmp 3538 <fourfiles+0xa8>
}
close(fd);
356e: 89 3c 24 mov %edi,(%esp)
3571: e8 5a 07 00 00 call 3cd0 <close>
if(total != 12*500){
3576: 81 fe 70 17 00 00 cmp $0x1770,%esi
357c: 0f 85 d2 00 00 00 jne 3654 <fourfiles+0x1c4>
printf(1, "wrong length %d\n", total);
exit();
}
unlink(fname);
3582: 8b 45 d4 mov -0x2c(%ebp),%eax
3585: 89 04 24 mov %eax,(%esp)
3588: e8 6b 07 00 00 call 3cf8 <unlink>
for(pi = 0; pi < 4; pi++){
wait();
}
for(i = 0; i < 2; i++){
358d: 83 fb 31 cmp $0x31,%ebx
3590: 75 1c jne 35ae <fourfiles+0x11e>
exit();
}
unlink(fname);
}
printf(1, "fourfiles ok\n");
3592: c7 44 24 04 c2 50 00 movl $0x50c2,0x4(%esp)
3599: 00
359a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
35a1: e8 3a 08 00 00 call 3de0 <printf>
}
35a6: 83 c4 3c add $0x3c,%esp
35a9: 5b pop %ebx
35aa: 5e pop %esi
35ab: 5f pop %edi
35ac: 5d pop %ebp
35ad: c3 ret
for(pi = 0; pi < 4; pi++){
wait();
}
for(i = 0; i < 2; i++){
35ae: 8b 45 dc mov -0x24(%ebp),%eax
35b1: bb 31 00 00 00 mov $0x31,%ebx
35b6: 89 45 d4 mov %eax,-0x2c(%ebp)
35b9: e9 5e ff ff ff jmp 351c <fourfiles+0x8c>
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
if(buf[j] != '0'+i){
printf(1, "wrong char\n");
35be: c7 44 24 04 a5 50 00 movl $0x50a5,0x4(%esp)
35c5: 00
35c6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
35cd: e8 0e 08 00 00 call 3de0 <printf>
exit();
35d2: e8 d1 06 00 00 call 3ca8 <exit>
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
35d7: 89 34 24 mov %esi,(%esp)
35da: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
35e1: 00
35e2: e8 01 07 00 00 call 3ce8 <open>
if(fd < 0){
35e7: 85 c0 test %eax,%eax
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
35e9: 89 c6 mov %eax,%esi
if(fd < 0){
35eb: 0f 88 99 00 00 00 js 368a <fourfiles+0x1fa>
printf(1, "create failed\n");
exit();
}
memset(buf, '0'+pi, 512);
35f1: 83 c3 30 add $0x30,%ebx
35f4: 89 5c 24 04 mov %ebx,0x4(%esp)
35f8: 31 db xor %ebx,%ebx
35fa: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
3601: 00
3602: c7 04 24 e0 80 00 00 movl $0x80e0,(%esp)
3609: e8 12 05 00 00 call 3b20 <memset>
360e: eb 08 jmp 3618 <fourfiles+0x188>
for(i = 0; i < 12; i++){
3610: 83 c3 01 add $0x1,%ebx
3613: 83 fb 0c cmp $0xc,%ebx
3616: 74 ba je 35d2 <fourfiles+0x142>
if((n = write(fd, buf, 500)) != 500){
3618: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp)
361f: 00
3620: c7 44 24 04 e0 80 00 movl $0x80e0,0x4(%esp)
3627: 00
3628: 89 34 24 mov %esi,(%esp)
362b: e8 98 06 00 00 call 3cc8 <write>
3630: 3d f4 01 00 00 cmp $0x1f4,%eax
3635: 74 d9 je 3610 <fourfiles+0x180>
printf(1, "write failed %d\n", n);
3637: 89 44 24 08 mov %eax,0x8(%esp)
363b: c7 44 24 04 94 50 00 movl $0x5094,0x4(%esp)
3642: 00
3643: c7 04 24 01 00 00 00 movl $0x1,(%esp)
364a: e8 91 07 00 00 call 3de0 <printf>
exit();
364f: e8 54 06 00 00 call 3ca8 <exit>
}
total += n;
}
close(fd);
if(total != 12*500){
printf(1, "wrong length %d\n", total);
3654: 89 74 24 08 mov %esi,0x8(%esp)
3658: c7 44 24 04 b1 50 00 movl $0x50b1,0x4(%esp)
365f: 00
3660: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3667: e8 74 07 00 00 call 3de0 <printf>
exit();
366c: e8 37 06 00 00 call 3ca8 <exit>
fname = names[pi];
unlink(fname);
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
3671: c7 44 24 04 bf 45 00 movl $0x45bf,0x4(%esp)
3678: 00
3679: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3680: e8 5b 07 00 00 call 3de0 <printf>
exit();
3685: e8 1e 06 00 00 call 3ca8 <exit>
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
368a: c7 44 24 04 55 46 00 movl $0x4655,0x4(%esp)
3691: 00
3692: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3699: e8 42 07 00 00 call 3de0 <printf>
exit();
369e: e8 05 06 00 00 call 3ca8 <exit>
36a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
36a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036b0 <sharedfd>:
// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
36b0: 55 push %ebp
36b1: 89 e5 mov %esp,%ebp
36b3: 57 push %edi
36b4: 56 push %esi
36b5: 53 push %ebx
36b6: 83 ec 3c sub $0x3c,%esp
int fd, pid, i, n, nc, np;
char buf[10];
printf(1, "sharedfd test\n");
36b9: c7 44 24 04 d0 50 00 movl $0x50d0,0x4(%esp)
36c0: 00
36c1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36c8: e8 13 07 00 00 call 3de0 <printf>
unlink("sharedfd");
36cd: c7 04 24 df 50 00 00 movl $0x50df,(%esp)
36d4: e8 1f 06 00 00 call 3cf8 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
36d9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
36e0: 00
36e1: c7 04 24 df 50 00 00 movl $0x50df,(%esp)
36e8: e8 fb 05 00 00 call 3ce8 <open>
if(fd < 0){
36ed: 85 c0 test %eax,%eax
char buf[10];
printf(1, "sharedfd test\n");
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
36ef: 89 c7 mov %eax,%edi
if(fd < 0){
36f1: 0f 88 2d 01 00 00 js 3824 <sharedfd+0x174>
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
36f7: e8 a4 05 00 00 call 3ca0 <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
36fc: 8d 75 de lea -0x22(%ebp),%esi
36ff: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
3706: 00
3707: 89 34 24 mov %esi,(%esp)
370a: 83 f8 01 cmp $0x1,%eax
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
370d: 89 45 d4 mov %eax,-0x2c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
3710: 19 c0 sbb %eax,%eax
3712: 31 db xor %ebx,%ebx
3714: 83 e0 f3 and $0xfffffff3,%eax
3717: 83 c0 70 add $0x70,%eax
371a: 89 44 24 04 mov %eax,0x4(%esp)
371e: e8 fd 03 00 00 call 3b20 <memset>
3723: eb 0e jmp 3733 <sharedfd+0x83>
3725: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < 1000; i++){
3728: 83 c3 01 add $0x1,%ebx
372b: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
3731: 74 2d je 3760 <sharedfd+0xb0>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
3733: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
373a: 00
373b: 89 74 24 04 mov %esi,0x4(%esp)
373f: 89 3c 24 mov %edi,(%esp)
3742: e8 81 05 00 00 call 3cc8 <write>
3747: 83 f8 0a cmp $0xa,%eax
374a: 74 dc je 3728 <sharedfd+0x78>
printf(1, "fstests: write sharedfd failed\n");
374c: c7 44 24 04 68 58 00 movl $0x5868,0x4(%esp)
3753: 00
3754: c7 04 24 01 00 00 00 movl $0x1,(%esp)
375b: e8 80 06 00 00 call 3de0 <printf>
break;
}
}
if(pid == 0)
3760: 8b 55 d4 mov -0x2c(%ebp),%edx
3763: 85 d2 test %edx,%edx
3765: 0f 84 07 01 00 00 je 3872 <sharedfd+0x1c2>
exit();
else
wait();
376b: e8 40 05 00 00 call 3cb0 <wait>
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
3770: 31 db xor %ebx,%ebx
}
if(pid == 0)
exit();
else
wait();
close(fd);
3772: 89 3c 24 mov %edi,(%esp)
fd = open("sharedfd", 0);
if(fd < 0){
3775: 31 ff xor %edi,%edi
}
if(pid == 0)
exit();
else
wait();
close(fd);
3777: e8 54 05 00 00 call 3cd0 <close>
fd = open("sharedfd", 0);
377c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3783: 00
3784: c7 04 24 df 50 00 00 movl $0x50df,(%esp)
378b: e8 58 05 00 00 call 3ce8 <open>
if(fd < 0){
3790: 85 c0 test %eax,%eax
if(pid == 0)
exit();
else
wait();
close(fd);
fd = open("sharedfd", 0);
3792: 89 45 d4 mov %eax,-0x2c(%ebp)
if(fd < 0){
3795: 0f 88 a5 00 00 00 js 3840 <sharedfd+0x190>
379b: 90 nop
379c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
37a0: 8b 45 d4 mov -0x2c(%ebp),%eax
37a3: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
37aa: 00
37ab: 89 74 24 04 mov %esi,0x4(%esp)
37af: 89 04 24 mov %eax,(%esp)
37b2: e8 09 05 00 00 call 3cc0 <read>
37b7: 85 c0 test %eax,%eax
37b9: 7e 26 jle 37e1 <sharedfd+0x131>
wait();
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
37bb: 31 c0 xor %eax,%eax
37bd: eb 14 jmp 37d3 <sharedfd+0x123>
37bf: 90 nop
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
if(buf[i] == 'c')
nc++;
if(buf[i] == 'p')
np++;
37c0: 80 fa 70 cmp $0x70,%dl
37c3: 0f 94 c2 sete %dl
37c6: 0f b6 d2 movzbl %dl,%edx
37c9: 01 d3 add %edx,%ebx
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
37cb: 83 c0 01 add $0x1,%eax
37ce: 83 f8 0a cmp $0xa,%eax
37d1: 74 cd je 37a0 <sharedfd+0xf0>
if(buf[i] == 'c')
37d3: 0f b6 14 06 movzbl (%esi,%eax,1),%edx
37d7: 80 fa 63 cmp $0x63,%dl
37da: 75 e4 jne 37c0 <sharedfd+0x110>
nc++;
37dc: 83 c7 01 add $0x1,%edi
37df: eb ea jmp 37cb <sharedfd+0x11b>
if(buf[i] == 'p')
np++;
}
}
close(fd);
37e1: 8b 45 d4 mov -0x2c(%ebp),%eax
37e4: 89 04 24 mov %eax,(%esp)
37e7: e8 e4 04 00 00 call 3cd0 <close>
unlink("sharedfd");
37ec: c7 04 24 df 50 00 00 movl $0x50df,(%esp)
37f3: e8 00 05 00 00 call 3cf8 <unlink>
if(nc == 10000 && np == 10000){
37f8: 81 fb 10 27 00 00 cmp $0x2710,%ebx
37fe: 75 56 jne 3856 <sharedfd+0x1a6>
3800: 81 ff 10 27 00 00 cmp $0x2710,%edi
3806: 75 4e jne 3856 <sharedfd+0x1a6>
printf(1, "sharedfd ok\n");
3808: c7 44 24 04 e8 50 00 movl $0x50e8,0x4(%esp)
380f: 00
3810: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3817: e8 c4 05 00 00 call 3de0 <printf>
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
exit();
}
}
381c: 83 c4 3c add $0x3c,%esp
381f: 5b pop %ebx
3820: 5e pop %esi
3821: 5f pop %edi
3822: 5d pop %ebp
3823: c3 ret
printf(1, "sharedfd test\n");
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
3824: c7 44 24 04 3c 58 00 movl $0x583c,0x4(%esp)
382b: 00
382c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3833: e8 a8 05 00 00 call 3de0 <printf>
printf(1, "sharedfd ok\n");
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
exit();
}
}
3838: 83 c4 3c add $0x3c,%esp
383b: 5b pop %ebx
383c: 5e pop %esi
383d: 5f pop %edi
383e: 5d pop %ebp
383f: c3 ret
else
wait();
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
3840: c7 44 24 04 88 58 00 movl $0x5888,0x4(%esp)
3847: 00
3848: c7 04 24 01 00 00 00 movl $0x1,(%esp)
384f: e8 8c 05 00 00 call 3de0 <printf>
return;
3854: eb c6 jmp 381c <sharedfd+0x16c>
close(fd);
unlink("sharedfd");
if(nc == 10000 && np == 10000){
printf(1, "sharedfd ok\n");
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
3856: 89 5c 24 0c mov %ebx,0xc(%esp)
385a: 89 7c 24 08 mov %edi,0x8(%esp)
385e: c7 44 24 04 f5 50 00 movl $0x50f5,0x4(%esp)
3865: 00
3866: c7 04 24 01 00 00 00 movl $0x1,(%esp)
386d: e8 6e 05 00 00 call 3de0 <printf>
exit();
3872: e8 31 04 00 00 call 3ca8 <exit>
3877: 89 f6 mov %esi,%esi
3879: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003880 <mem>:
printf(1, "exitwait ok\n");
}
void
mem(void)
{
3880: 55 push %ebp
3881: 89 e5 mov %esp,%ebp
3883: 57 push %edi
3884: 56 push %esi
3885: 53 push %ebx
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
ppid = getpid();
if((pid = fork()) == 0){
3886: 31 db xor %ebx,%ebx
printf(1, "exitwait ok\n");
}
void
mem(void)
{
3888: 83 ec 1c sub $0x1c,%esp
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
388b: c7 44 24 04 0a 51 00 movl $0x510a,0x4(%esp)
3892: 00
3893: c7 04 24 01 00 00 00 movl $0x1,(%esp)
389a: e8 41 05 00 00 call 3de0 <printf>
ppid = getpid();
389f: e8 84 04 00 00 call 3d28 <getpid>
38a4: 89 c6 mov %eax,%esi
if((pid = fork()) == 0){
38a6: e8 f5 03 00 00 call 3ca0 <fork>
38ab: 85 c0 test %eax,%eax
38ad: 74 0d je 38bc <mem+0x3c>
38af: 90 nop
38b0: eb 5f jmp 3911 <mem+0x91>
38b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
m1 = 0;
while((m2 = malloc(10001)) != 0){
*(char**)m2 = m1;
38b8: 89 18 mov %ebx,(%eax)
38ba: 89 c3 mov %eax,%ebx
printf(1, "mem test\n");
ppid = getpid();
if((pid = fork()) == 0){
m1 = 0;
while((m2 = malloc(10001)) != 0){
38bc: c7 04 24 11 27 00 00 movl $0x2711,(%esp)
38c3: e8 98 07 00 00 call 4060 <malloc>
38c8: 85 c0 test %eax,%eax
38ca: 75 ec jne 38b8 <mem+0x38>
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
38cc: 85 db test %ebx,%ebx
38ce: 74 10 je 38e0 <mem+0x60>
m2 = *(char**)m1;
38d0: 8b 3b mov (%ebx),%edi
free(m1);
38d2: 89 1c 24 mov %ebx,(%esp)
38d5: e8 f6 06 00 00 call 3fd0 <free>
38da: 89 fb mov %edi,%ebx
m1 = 0;
while((m2 = malloc(10001)) != 0){
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
38dc: 85 db test %ebx,%ebx
38de: 75 f0 jne 38d0 <mem+0x50>
m2 = *(char**)m1;
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
38e0: c7 04 24 00 50 00 00 movl $0x5000,(%esp)
38e7: e8 74 07 00 00 call 4060 <malloc>
if(m1 == 0){
38ec: 85 c0 test %eax,%eax
38ee: 74 30 je 3920 <mem+0xa0>
printf(1, "couldn't allocate mem?!!\n");
kill(ppid);
exit();
}
free(m1);
38f0: 89 04 24 mov %eax,(%esp)
38f3: e8 d8 06 00 00 call 3fd0 <free>
printf(1, "mem ok\n");
38f8: c7 44 24 04 2e 51 00 movl $0x512e,0x4(%esp)
38ff: 00
3900: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3907: e8 d4 04 00 00 call 3de0 <printf>
exit();
390c: e8 97 03 00 00 call 3ca8 <exit>
} else {
wait();
}
}
3911: 83 c4 1c add $0x1c,%esp
3914: 5b pop %ebx
3915: 5e pop %esi
3916: 5f pop %edi
3917: 5d pop %ebp
}
free(m1);
printf(1, "mem ok\n");
exit();
} else {
wait();
3918: e9 93 03 00 00 jmp 3cb0 <wait>
391d: 8d 76 00 lea 0x0(%esi),%esi
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
if(m1 == 0){
printf(1, "couldn't allocate mem?!!\n");
3920: c7 44 24 04 14 51 00 movl $0x5114,0x4(%esp)
3927: 00
3928: c7 04 24 01 00 00 00 movl $0x1,(%esp)
392f: e8 ac 04 00 00 call 3de0 <printf>
kill(ppid);
3934: 89 34 24 mov %esi,(%esp)
3937: e8 9c 03 00 00 call 3cd8 <kill>
exit();
393c: e8 67 03 00 00 call 3ca8 <exit>
3941: eb 0d jmp 3950 <main>
3943: 90 nop
3944: 90 nop
3945: 90 nop
3946: 90 nop
3947: 90 nop
3948: 90 nop
3949: 90 nop
394a: 90 nop
394b: 90 nop
394c: 90 nop
394d: 90 nop
394e: 90 nop
394f: 90 nop
00003950 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
3950: 55 push %ebp
3951: 89 e5 mov %esp,%ebp
3953: 83 e4 f0 and $0xfffffff0,%esp
3956: 83 ec 10 sub $0x10,%esp
printf(1, "usertests starting\n");
3959: c7 44 24 04 36 51 00 movl $0x5136,0x4(%esp)
3960: 00
3961: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3968: e8 73 04 00 00 call 3de0 <printf>
if(open("usertests.ran", 0) >= 0){
396d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3974: 00
3975: c7 04 24 4a 51 00 00 movl $0x514a,(%esp)
397c: e8 67 03 00 00 call 3ce8 <open>
3981: 85 c0 test %eax,%eax
3983: 78 1b js 39a0 <main+0x50>
printf(1, "already ran user tests -- rebuild fs.img\n");
3985: c7 44 24 04 b4 58 00 movl $0x58b4,0x4(%esp)
398c: 00
398d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3994: e8 47 04 00 00 call 3de0 <printf>
exit();
3999: e8 0a 03 00 00 call 3ca8 <exit>
399e: 66 90 xchg %ax,%ax
}
close(open("usertests.ran", O_CREATE));
39a0: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
39a7: 00
39a8: c7 04 24 4a 51 00 00 movl $0x514a,(%esp)
39af: e8 34 03 00 00 call 3ce8 <open>
39b4: 89 04 24 mov %eax,(%esp)
39b7: e8 14 03 00 00 call 3cd0 <close>
argptest();
39bc: e8 8f c7 ff ff call 150 <argptest>
createdelete();
39c1: e8 da ce ff ff call 8a0 <createdelete>
linkunlink();
39c6: e8 15 d9 ff ff call 12e0 <linkunlink>
39cb: 90 nop
39cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
concreate();
39d0: e8 8b f7 ff ff call 3160 <concreate>
fourfiles();
39d5: e8 b6 fa ff ff call 3490 <fourfiles>
sharedfd();
39da: e8 d1 fc ff ff call 36b0 <sharedfd>
39df: 90 nop
bigargtest();
39e0: e8 9b d5 ff ff call f80 <bigargtest>
bigwrite();
39e5: e8 e6 cb ff ff call 5d0 <bigwrite>
bigargtest();
39ea: e8 91 d5 ff ff call f80 <bigargtest>
39ef: 90 nop
bsstest();
39f0: e8 3b c6 ff ff call 30 <bsstest>
sbrktest();
39f5: e8 56 dc ff ff call 1650 <sbrktest>
validatetest();
39fa: e8 e1 d6 ff ff call 10e0 <validatetest>
39ff: 90 nop
opentest();
3a00: e8 ab c6 ff ff call b0 <opentest>
writetest();
3a05: e8 66 d3 ff ff call d70 <writetest>
writetest1();
3a0a: e8 71 d1 ff ff call b80 <writetest1>
3a0f: 90 nop
createtest();
3a10: e8 bb d0 ff ff call ad0 <createtest>
openiputtest();
3a15: e8 06 e5 ff ff call 1f20 <openiputtest>
exitiputtest();
3a1a: e8 71 f3 ff ff call 2d90 <exitiputtest>
3a1f: 90 nop
iputtest();
3a20: e8 5b f4 ff ff call 2e80 <iputtest>
mem();
3a25: e8 56 fe ff ff call 3880 <mem>
pipe1();
3a2a: e8 e1 e1 ff ff call 1c10 <pipe1>
3a2f: 90 nop
preempt();
3a30: e8 7b e0 ff ff call 1ab0 <preempt>
exitwait();
3a35: e8 f6 c8 ff ff call 330 <exitwait>
rmdot();
3a3a: e8 51 e9 ff ff call 2390 <rmdot>
3a3f: 90 nop
fourteen();
3a40: e8 7b e3 ff ff call 1dc0 <fourteen>
bigfile();
3a45: e8 16 f5 ff ff call 2f60 <bigfile>
subdir();
3a4a: e8 d1 ea ff ff call 2520 <subdir>
3a4f: 90 nop
linktest();
3a50: e8 9b d9 ff ff call 13f0 <linktest>
unlinkread();
3a55: e8 76 cc ff ff call 6d0 <unlinkread>
dirfile();
3a5a: e8 f1 e6 ff ff call 2150 <dirfile>
3a5f: 90 nop
iref();
3a60: e8 cb e5 ff ff call 2030 <iref>
forktest();
3a65: e8 f6 c7 ff ff call 260 <forktest>
bigdir(); // slow
3a6a: e8 21 d7 ff ff call 1190 <bigdir>
3a6f: 90 nop
uio();
3a70: e8 5b c7 ff ff call 1d0 <uio>
exectest();
3a75: e8 16 d6 ff ff call 1090 <exectest>
exit();
3a7a: e8 29 02 00 00 call 3ca8 <exit>
3a7f: 90 nop
00003a80 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
3a80: 55 push %ebp
3a81: 31 d2 xor %edx,%edx
3a83: 89 e5 mov %esp,%ebp
3a85: 8b 45 08 mov 0x8(%ebp),%eax
3a88: 53 push %ebx
3a89: 8b 5d 0c mov 0xc(%ebp),%ebx
3a8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
3a90: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
3a94: 88 0c 10 mov %cl,(%eax,%edx,1)
3a97: 83 c2 01 add $0x1,%edx
3a9a: 84 c9 test %cl,%cl
3a9c: 75 f2 jne 3a90 <strcpy+0x10>
;
return os;
}
3a9e: 5b pop %ebx
3a9f: 5d pop %ebp
3aa0: c3 ret
3aa1: eb 0d jmp 3ab0 <strcmp>
3aa3: 90 nop
3aa4: 90 nop
3aa5: 90 nop
3aa6: 90 nop
3aa7: 90 nop
3aa8: 90 nop
3aa9: 90 nop
3aaa: 90 nop
3aab: 90 nop
3aac: 90 nop
3aad: 90 nop
3aae: 90 nop
3aaf: 90 nop
00003ab0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3ab0: 55 push %ebp
3ab1: 89 e5 mov %esp,%ebp
3ab3: 8b 4d 08 mov 0x8(%ebp),%ecx
3ab6: 53 push %ebx
3ab7: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
3aba: 0f b6 01 movzbl (%ecx),%eax
3abd: 84 c0 test %al,%al
3abf: 75 14 jne 3ad5 <strcmp+0x25>
3ac1: eb 25 jmp 3ae8 <strcmp+0x38>
3ac3: 90 nop
3ac4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
3ac8: 83 c1 01 add $0x1,%ecx
3acb: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3ace: 0f b6 01 movzbl (%ecx),%eax
3ad1: 84 c0 test %al,%al
3ad3: 74 13 je 3ae8 <strcmp+0x38>
3ad5: 0f b6 1a movzbl (%edx),%ebx
3ad8: 38 d8 cmp %bl,%al
3ada: 74 ec je 3ac8 <strcmp+0x18>
3adc: 0f b6 db movzbl %bl,%ebx
3adf: 0f b6 c0 movzbl %al,%eax
3ae2: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3ae4: 5b pop %ebx
3ae5: 5d pop %ebp
3ae6: c3 ret
3ae7: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3ae8: 0f b6 1a movzbl (%edx),%ebx
3aeb: 31 c0 xor %eax,%eax
3aed: 0f b6 db movzbl %bl,%ebx
3af0: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3af2: 5b pop %ebx
3af3: 5d pop %ebp
3af4: c3 ret
3af5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3af9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b00 <strlen>:
uint
strlen(char *s)
{
3b00: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
3b01: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b03: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
3b05: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b07: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3b0a: 80 39 00 cmpb $0x0,(%ecx)
3b0d: 74 0c je 3b1b <strlen+0x1b>
3b0f: 90 nop
3b10: 83 c2 01 add $0x1,%edx
3b13: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3b17: 89 d0 mov %edx,%eax
3b19: 75 f5 jne 3b10 <strlen+0x10>
;
return n;
}
3b1b: 5d pop %ebp
3b1c: c3 ret
3b1d: 8d 76 00 lea 0x0(%esi),%esi
00003b20 <memset>:
void*
memset(void *dst, int c, uint n)
{
3b20: 55 push %ebp
3b21: 89 e5 mov %esp,%ebp
3b23: 8b 55 08 mov 0x8(%ebp),%edx
3b26: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3b27: 8b 4d 10 mov 0x10(%ebp),%ecx
3b2a: 8b 45 0c mov 0xc(%ebp),%eax
3b2d: 89 d7 mov %edx,%edi
3b2f: fc cld
3b30: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3b32: 89 d0 mov %edx,%eax
3b34: 5f pop %edi
3b35: 5d pop %ebp
3b36: c3 ret
3b37: 89 f6 mov %esi,%esi
3b39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b40 <strchr>:
char*
strchr(const char *s, char c)
{
3b40: 55 push %ebp
3b41: 89 e5 mov %esp,%ebp
3b43: 8b 45 08 mov 0x8(%ebp),%eax
3b46: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
3b4a: 0f b6 10 movzbl (%eax),%edx
3b4d: 84 d2 test %dl,%dl
3b4f: 75 11 jne 3b62 <strchr+0x22>
3b51: eb 15 jmp 3b68 <strchr+0x28>
3b53: 90 nop
3b54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3b58: 83 c0 01 add $0x1,%eax
3b5b: 0f b6 10 movzbl (%eax),%edx
3b5e: 84 d2 test %dl,%dl
3b60: 74 06 je 3b68 <strchr+0x28>
if(*s == c)
3b62: 38 ca cmp %cl,%dl
3b64: 75 f2 jne 3b58 <strchr+0x18>
return (char*)s;
return 0;
}
3b66: 5d pop %ebp
3b67: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
3b68: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
3b6a: 5d pop %ebp
3b6b: 90 nop
3b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3b70: c3 ret
3b71: eb 0d jmp 3b80 <atoi>
3b73: 90 nop
3b74: 90 nop
3b75: 90 nop
3b76: 90 nop
3b77: 90 nop
3b78: 90 nop
3b79: 90 nop
3b7a: 90 nop
3b7b: 90 nop
3b7c: 90 nop
3b7d: 90 nop
3b7e: 90 nop
3b7f: 90 nop
00003b80 <atoi>:
return r;
}
int
atoi(const char *s)
{
3b80: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
3b81: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
3b83: 89 e5 mov %esp,%ebp
3b85: 8b 4d 08 mov 0x8(%ebp),%ecx
3b88: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3b89: 0f b6 11 movzbl (%ecx),%edx
3b8c: 8d 5a d0 lea -0x30(%edx),%ebx
3b8f: 80 fb 09 cmp $0x9,%bl
3b92: 77 1c ja 3bb0 <atoi+0x30>
3b94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
3b98: 0f be d2 movsbl %dl,%edx
3b9b: 83 c1 01 add $0x1,%ecx
3b9e: 8d 04 80 lea (%eax,%eax,4),%eax
3ba1: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ba5: 0f b6 11 movzbl (%ecx),%edx
3ba8: 8d 5a d0 lea -0x30(%edx),%ebx
3bab: 80 fb 09 cmp $0x9,%bl
3bae: 76 e8 jbe 3b98 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
3bb0: 5b pop %ebx
3bb1: 5d pop %ebp
3bb2: c3 ret
3bb3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3bb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003bc0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
3bc0: 55 push %ebp
3bc1: 89 e5 mov %esp,%ebp
3bc3: 56 push %esi
3bc4: 8b 45 08 mov 0x8(%ebp),%eax
3bc7: 53 push %ebx
3bc8: 8b 5d 10 mov 0x10(%ebp),%ebx
3bcb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3bce: 85 db test %ebx,%ebx
3bd0: 7e 14 jle 3be6 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
3bd2: 31 d2 xor %edx,%edx
3bd4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
3bd8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3bdc: 88 0c 10 mov %cl,(%eax,%edx,1)
3bdf: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3be2: 39 da cmp %ebx,%edx
3be4: 75 f2 jne 3bd8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
3be6: 5b pop %ebx
3be7: 5e pop %esi
3be8: 5d pop %ebp
3be9: c3 ret
3bea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003bf0 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
3bf0: 55 push %ebp
3bf1: 89 e5 mov %esp,%ebp
3bf3: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
3bf6: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
3bf9: 89 5d f8 mov %ebx,-0x8(%ebp)
3bfc: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
3bff: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
3c04: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3c0b: 00
3c0c: 89 04 24 mov %eax,(%esp)
3c0f: e8 d4 00 00 00 call 3ce8 <open>
if(fd < 0)
3c14: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
3c16: 89 c3 mov %eax,%ebx
if(fd < 0)
3c18: 78 19 js 3c33 <stat+0x43>
return -1;
r = fstat(fd, st);
3c1a: 8b 45 0c mov 0xc(%ebp),%eax
3c1d: 89 1c 24 mov %ebx,(%esp)
3c20: 89 44 24 04 mov %eax,0x4(%esp)
3c24: e8 d7 00 00 00 call 3d00 <fstat>
close(fd);
3c29: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
3c2c: 89 c6 mov %eax,%esi
close(fd);
3c2e: e8 9d 00 00 00 call 3cd0 <close>
return r;
}
3c33: 89 f0 mov %esi,%eax
3c35: 8b 5d f8 mov -0x8(%ebp),%ebx
3c38: 8b 75 fc mov -0x4(%ebp),%esi
3c3b: 89 ec mov %ebp,%esp
3c3d: 5d pop %ebp
3c3e: c3 ret
3c3f: 90 nop
00003c40 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
3c40: 55 push %ebp
3c41: 89 e5 mov %esp,%ebp
3c43: 57 push %edi
3c44: 56 push %esi
3c45: 31 f6 xor %esi,%esi
3c47: 53 push %ebx
3c48: 83 ec 2c sub $0x2c,%esp
3c4b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
3c4e: eb 06 jmp 3c56 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
3c50: 3c 0a cmp $0xa,%al
3c52: 74 39 je 3c8d <gets+0x4d>
3c54: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
3c56: 8d 5e 01 lea 0x1(%esi),%ebx
3c59: 3b 5d 0c cmp 0xc(%ebp),%ebx
3c5c: 7d 31 jge 3c8f <gets+0x4f>
cc = read(0, &c, 1);
3c5e: 8d 45 e7 lea -0x19(%ebp),%eax
3c61: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3c68: 00
3c69: 89 44 24 04 mov %eax,0x4(%esp)
3c6d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3c74: e8 47 00 00 00 call 3cc0 <read>
if(cc < 1)
3c79: 85 c0 test %eax,%eax
3c7b: 7e 12 jle 3c8f <gets+0x4f>
break;
buf[i++] = c;
3c7d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3c81: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
3c85: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3c89: 3c 0d cmp $0xd,%al
3c8b: 75 c3 jne 3c50 <gets+0x10>
3c8d: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
3c8f: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
3c93: 89 f8 mov %edi,%eax
3c95: 83 c4 2c add $0x2c,%esp
3c98: 5b pop %ebx
3c99: 5e pop %esi
3c9a: 5f pop %edi
3c9b: 5d pop %ebp
3c9c: c3 ret
3c9d: 90 nop
3c9e: 90 nop
3c9f: 90 nop
00003ca0 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3ca0: b8 01 00 00 00 mov $0x1,%eax
3ca5: cd 40 int $0x40
3ca7: c3 ret
00003ca8 <exit>:
SYSCALL(exit)
3ca8: b8 02 00 00 00 mov $0x2,%eax
3cad: cd 40 int $0x40
3caf: c3 ret
00003cb0 <wait>:
SYSCALL(wait)
3cb0: b8 03 00 00 00 mov $0x3,%eax
3cb5: cd 40 int $0x40
3cb7: c3 ret
00003cb8 <pipe>:
SYSCALL(pipe)
3cb8: b8 04 00 00 00 mov $0x4,%eax
3cbd: cd 40 int $0x40
3cbf: c3 ret
00003cc0 <read>:
SYSCALL(read)
3cc0: b8 05 00 00 00 mov $0x5,%eax
3cc5: cd 40 int $0x40
3cc7: c3 ret
00003cc8 <write>:
SYSCALL(write)
3cc8: b8 10 00 00 00 mov $0x10,%eax
3ccd: cd 40 int $0x40
3ccf: c3 ret
00003cd0 <close>:
SYSCALL(close)
3cd0: b8 15 00 00 00 mov $0x15,%eax
3cd5: cd 40 int $0x40
3cd7: c3 ret
00003cd8 <kill>:
SYSCALL(kill)
3cd8: b8 06 00 00 00 mov $0x6,%eax
3cdd: cd 40 int $0x40
3cdf: c3 ret
00003ce0 <exec>:
SYSCALL(exec)
3ce0: b8 07 00 00 00 mov $0x7,%eax
3ce5: cd 40 int $0x40
3ce7: c3 ret
00003ce8 <open>:
SYSCALL(open)
3ce8: b8 0f 00 00 00 mov $0xf,%eax
3ced: cd 40 int $0x40
3cef: c3 ret
00003cf0 <mknod>:
SYSCALL(mknod)
3cf0: b8 11 00 00 00 mov $0x11,%eax
3cf5: cd 40 int $0x40
3cf7: c3 ret
00003cf8 <unlink>:
SYSCALL(unlink)
3cf8: b8 12 00 00 00 mov $0x12,%eax
3cfd: cd 40 int $0x40
3cff: c3 ret
00003d00 <fstat>:
SYSCALL(fstat)
3d00: b8 08 00 00 00 mov $0x8,%eax
3d05: cd 40 int $0x40
3d07: c3 ret
00003d08 <link>:
SYSCALL(link)
3d08: b8 13 00 00 00 mov $0x13,%eax
3d0d: cd 40 int $0x40
3d0f: c3 ret
00003d10 <mkdir>:
SYSCALL(mkdir)
3d10: b8 14 00 00 00 mov $0x14,%eax
3d15: cd 40 int $0x40
3d17: c3 ret
00003d18 <chdir>:
SYSCALL(chdir)
3d18: b8 09 00 00 00 mov $0x9,%eax
3d1d: cd 40 int $0x40
3d1f: c3 ret
00003d20 <dup>:
SYSCALL(dup)
3d20: b8 0a 00 00 00 mov $0xa,%eax
3d25: cd 40 int $0x40
3d27: c3 ret
00003d28 <getpid>:
SYSCALL(getpid)
3d28: b8 0b 00 00 00 mov $0xb,%eax
3d2d: cd 40 int $0x40
3d2f: c3 ret
00003d30 <sbrk>:
SYSCALL(sbrk)
3d30: b8 0c 00 00 00 mov $0xc,%eax
3d35: cd 40 int $0x40
3d37: c3 ret
00003d38 <sleep>:
SYSCALL(sleep)
3d38: b8 0d 00 00 00 mov $0xd,%eax
3d3d: cd 40 int $0x40
3d3f: c3 ret
00003d40 <set_tickets>:
SYSCALL(set_tickets)
3d40: b8 16 00 00 00 mov $0x16,%eax
3d45: cd 40 int $0x40
3d47: c3 ret
3d48: 90 nop
3d49: 90 nop
3d4a: 90 nop
3d4b: 90 nop
3d4c: 90 nop
3d4d: 90 nop
3d4e: 90 nop
3d4f: 90 nop
00003d50 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3d50: 55 push %ebp
3d51: 89 e5 mov %esp,%ebp
3d53: 57 push %edi
3d54: 89 cf mov %ecx,%edi
3d56: 56 push %esi
3d57: 89 c6 mov %eax,%esi
3d59: 53 push %ebx
3d5a: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3d5d: 8b 4d 08 mov 0x8(%ebp),%ecx
3d60: 85 c9 test %ecx,%ecx
3d62: 74 04 je 3d68 <printint+0x18>
3d64: 85 d2 test %edx,%edx
3d66: 78 68 js 3dd0 <printint+0x80>
neg = 1;
x = -xx;
} else {
x = xx;
3d68: 89 d0 mov %edx,%eax
3d6a: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3d71: 31 c9 xor %ecx,%ecx
3d73: 8d 5d d7 lea -0x29(%ebp),%ebx
3d76: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
3d78: 31 d2 xor %edx,%edx
3d7a: f7 f7 div %edi
3d7c: 0f b6 92 e7 58 00 00 movzbl 0x58e7(%edx),%edx
3d83: 88 14 0b mov %dl,(%ebx,%ecx,1)
3d86: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
3d89: 85 c0 test %eax,%eax
3d8b: 75 eb jne 3d78 <printint+0x28>
if(neg)
3d8d: 8b 45 c4 mov -0x3c(%ebp),%eax
3d90: 85 c0 test %eax,%eax
3d92: 74 08 je 3d9c <printint+0x4c>
buf[i++] = '-';
3d94: c6 44 0d d7 2d movb $0x2d,-0x29(%ebp,%ecx,1)
3d99: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
3d9c: 8d 79 ff lea -0x1(%ecx),%edi
3d9f: 90 nop
3da0: 0f b6 04 3b movzbl (%ebx,%edi,1),%eax
3da4: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3da7: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3dae: 00
3daf: 89 34 24 mov %esi,(%esp)
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3db2: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3db5: 8d 45 e7 lea -0x19(%ebp),%eax
3db8: 89 44 24 04 mov %eax,0x4(%esp)
3dbc: e8 07 ff ff ff call 3cc8 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3dc1: 83 ff ff cmp $0xffffffff,%edi
3dc4: 75 da jne 3da0 <printint+0x50>
putc(fd, buf[i]);
}
3dc6: 83 c4 4c add $0x4c,%esp
3dc9: 5b pop %ebx
3dca: 5e pop %esi
3dcb: 5f pop %edi
3dcc: 5d pop %ebp
3dcd: c3 ret
3dce: 66 90 xchg %ax,%ax
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
3dd0: 89 d0 mov %edx,%eax
3dd2: f7 d8 neg %eax
3dd4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
3ddb: eb 94 jmp 3d71 <printint+0x21>
3ddd: 8d 76 00 lea 0x0(%esi),%esi
00003de0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3de0: 55 push %ebp
3de1: 89 e5 mov %esp,%ebp
3de3: 57 push %edi
3de4: 56 push %esi
3de5: 53 push %ebx
3de6: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3de9: 8b 45 0c mov 0xc(%ebp),%eax
3dec: 0f b6 10 movzbl (%eax),%edx
3def: 84 d2 test %dl,%dl
3df1: 0f 84 c1 00 00 00 je 3eb8 <printf+0xd8>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
3df7: 8d 4d 10 lea 0x10(%ebp),%ecx
3dfa: 31 ff xor %edi,%edi
3dfc: 89 4d d4 mov %ecx,-0x2c(%ebp)
3dff: 31 db xor %ebx,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3e01: 8d 75 e7 lea -0x19(%ebp),%esi
3e04: eb 1e jmp 3e24 <printf+0x44>
3e06: 66 90 xchg %ax,%ax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
3e08: 83 fa 25 cmp $0x25,%edx
3e0b: 0f 85 af 00 00 00 jne 3ec0 <printf+0xe0>
3e11: 66 bf 25 00 mov $0x25,%di
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e15: 83 c3 01 add $0x1,%ebx
3e18: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
3e1c: 84 d2 test %dl,%dl
3e1e: 0f 84 94 00 00 00 je 3eb8 <printf+0xd8>
c = fmt[i] & 0xff;
if(state == 0){
3e24: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
3e26: 0f b6 d2 movzbl %dl,%edx
if(state == 0){
3e29: 74 dd je 3e08 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
3e2b: 83 ff 25 cmp $0x25,%edi
3e2e: 75 e5 jne 3e15 <printf+0x35>
if(c == 'd'){
3e30: 83 fa 64 cmp $0x64,%edx
3e33: 0f 84 3f 01 00 00 je 3f78 <printf+0x198>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
3e39: 83 fa 70 cmp $0x70,%edx
3e3c: 0f 84 a6 00 00 00 je 3ee8 <printf+0x108>
3e42: 83 fa 78 cmp $0x78,%edx
3e45: 0f 84 9d 00 00 00 je 3ee8 <printf+0x108>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
3e4b: 83 fa 73 cmp $0x73,%edx
3e4e: 66 90 xchg %ax,%ax
3e50: 0f 84 ba 00 00 00 je 3f10 <printf+0x130>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3e56: 83 fa 63 cmp $0x63,%edx
3e59: 0f 84 41 01 00 00 je 3fa0 <printf+0x1c0>
putc(fd, *ap);
ap++;
} else if(c == '%'){
3e5f: 83 fa 25 cmp $0x25,%edx
3e62: 0f 84 00 01 00 00 je 3f68 <printf+0x188>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3e68: 8b 4d 08 mov 0x8(%ebp),%ecx
3e6b: 89 55 cc mov %edx,-0x34(%ebp)
3e6e: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3e72: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3e79: 00
3e7a: 89 74 24 04 mov %esi,0x4(%esp)
3e7e: 89 0c 24 mov %ecx,(%esp)
3e81: e8 42 fe ff ff call 3cc8 <write>
3e86: 8b 55 cc mov -0x34(%ebp),%edx
3e89: 88 55 e7 mov %dl,-0x19(%ebp)
3e8c: 8b 45 08 mov 0x8(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e8f: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3e92: 31 ff xor %edi,%edi
3e94: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3e9b: 00
3e9c: 89 74 24 04 mov %esi,0x4(%esp)
3ea0: 89 04 24 mov %eax,(%esp)
3ea3: e8 20 fe ff ff call 3cc8 <write>
3ea8: 8b 45 0c mov 0xc(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3eab: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
3eaf: 84 d2 test %dl,%dl
3eb1: 0f 85 6d ff ff ff jne 3e24 <printf+0x44>
3eb7: 90 nop
putc(fd, c);
}
state = 0;
}
}
}
3eb8: 83 c4 3c add $0x3c,%esp
3ebb: 5b pop %ebx
3ebc: 5e pop %esi
3ebd: 5f pop %edi
3ebe: 5d pop %ebp
3ebf: c3 ret
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3ec0: 8b 45 08 mov 0x8(%ebp),%eax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
3ec3: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3ec6: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3ecd: 00
3ece: 89 74 24 04 mov %esi,0x4(%esp)
3ed2: 89 04 24 mov %eax,(%esp)
3ed5: e8 ee fd ff ff call 3cc8 <write>
3eda: 8b 45 0c mov 0xc(%ebp),%eax
3edd: e9 33 ff ff ff jmp 3e15 <printf+0x35>
3ee2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
3ee8: 8b 45 d4 mov -0x2c(%ebp),%eax
3eeb: b9 10 00 00 00 mov $0x10,%ecx
ap++;
3ef0: 31 ff xor %edi,%edi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
3ef2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3ef9: 8b 10 mov (%eax),%edx
3efb: 8b 45 08 mov 0x8(%ebp),%eax
3efe: e8 4d fe ff ff call 3d50 <printint>
3f03: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
3f06: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
3f0a: e9 06 ff ff ff jmp 3e15 <printf+0x35>
3f0f: 90 nop
} else if(c == 's'){
s = (char*)*ap;
3f10: 8b 55 d4 mov -0x2c(%ebp),%edx
ap++;
if(s == 0)
3f13: b9 e0 58 00 00 mov $0x58e0,%ecx
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
3f18: 8b 3a mov (%edx),%edi
ap++;
3f1a: 83 c2 04 add $0x4,%edx
3f1d: 89 55 d4 mov %edx,-0x2c(%ebp)
if(s == 0)
3f20: 85 ff test %edi,%edi
3f22: 0f 44 f9 cmove %ecx,%edi
s = "(null)";
while(*s != 0){
3f25: 0f b6 17 movzbl (%edi),%edx
3f28: 84 d2 test %dl,%dl
3f2a: 74 33 je 3f5f <printf+0x17f>
3f2c: 89 5d d0 mov %ebx,-0x30(%ebp)
3f2f: 8b 5d 08 mov 0x8(%ebp),%ebx
3f32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
s++;
3f38: 83 c7 01 add $0x1,%edi
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
3f3b: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3f3e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3f45: 00
3f46: 89 74 24 04 mov %esi,0x4(%esp)
3f4a: 89 1c 24 mov %ebx,(%esp)
3f4d: e8 76 fd ff ff call 3cc8 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
3f52: 0f b6 17 movzbl (%edi),%edx
3f55: 84 d2 test %dl,%dl
3f57: 75 df jne 3f38 <printf+0x158>
3f59: 8b 5d d0 mov -0x30(%ebp),%ebx
3f5c: 8b 45 0c mov 0xc(%ebp),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3f5f: 31 ff xor %edi,%edi
3f61: e9 af fe ff ff jmp 3e15 <printf+0x35>
3f66: 66 90 xchg %ax,%ax
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
3f68: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3f6c: e9 1b ff ff ff jmp 3e8c <printf+0xac>
3f71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
3f78: 8b 45 d4 mov -0x2c(%ebp),%eax
3f7b: b9 0a 00 00 00 mov $0xa,%ecx
ap++;
3f80: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
3f83: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3f8a: 8b 10 mov (%eax),%edx
3f8c: 8b 45 08 mov 0x8(%ebp),%eax
3f8f: e8 bc fd ff ff call 3d50 <printint>
3f94: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
3f97: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
3f9b: e9 75 fe ff ff jmp 3e15 <printf+0x35>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3fa0: 8b 55 d4 mov -0x2c(%ebp),%edx
putc(fd, *ap);
ap++;
3fa3: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3fa5: 8b 4d 08 mov 0x8(%ebp),%ecx
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3fa8: 8b 02 mov (%edx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3faa: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3fb1: 00
3fb2: 89 74 24 04 mov %esi,0x4(%esp)
3fb6: 89 0c 24 mov %ecx,(%esp)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3fb9: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3fbc: e8 07 fd ff ff call 3cc8 <write>
3fc1: 8b 45 0c mov 0xc(%ebp),%eax
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
3fc4: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
3fc8: e9 48 fe ff ff jmp 3e15 <printf+0x35>
3fcd: 90 nop
3fce: 90 nop
3fcf: 90 nop
00003fd0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
3fd0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3fd1: a1 a8 59 00 00 mov 0x59a8,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
3fd6: 89 e5 mov %esp,%ebp
3fd8: 57 push %edi
3fd9: 56 push %esi
3fda: 53 push %ebx
3fdb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
3fde: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3fe1: 39 c8 cmp %ecx,%eax
3fe3: 73 1d jae 4002 <free+0x32>
3fe5: 8d 76 00 lea 0x0(%esi),%esi
3fe8: 8b 10 mov (%eax),%edx
3fea: 39 d1 cmp %edx,%ecx
3fec: 72 1a jb 4008 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
3fee: 39 d0 cmp %edx,%eax
3ff0: 72 08 jb 3ffa <free+0x2a>
3ff2: 39 c8 cmp %ecx,%eax
3ff4: 72 12 jb 4008 <free+0x38>
3ff6: 39 d1 cmp %edx,%ecx
3ff8: 72 0e jb 4008 <free+0x38>
3ffa: 89 d0 mov %edx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3ffc: 39 c8 cmp %ecx,%eax
3ffe: 66 90 xchg %ax,%ax
4000: 72 e6 jb 3fe8 <free+0x18>
4002: 8b 10 mov (%eax),%edx
4004: eb e8 jmp 3fee <free+0x1e>
4006: 66 90 xchg %ax,%ax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
4008: 8b 71 04 mov 0x4(%ecx),%esi
400b: 8d 3c f1 lea (%ecx,%esi,8),%edi
400e: 39 d7 cmp %edx,%edi
4010: 74 19 je 402b <free+0x5b>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
4012: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
4015: 8b 50 04 mov 0x4(%eax),%edx
4018: 8d 34 d0 lea (%eax,%edx,8),%esi
401b: 39 ce cmp %ecx,%esi
401d: 74 23 je 4042 <free+0x72>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
401f: 89 08 mov %ecx,(%eax)
freep = p;
4021: a3 a8 59 00 00 mov %eax,0x59a8
}
4026: 5b pop %ebx
4027: 5e pop %esi
4028: 5f pop %edi
4029: 5d pop %ebp
402a: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
402b: 03 72 04 add 0x4(%edx),%esi
402e: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
4031: 8b 10 mov (%eax),%edx
4033: 8b 12 mov (%edx),%edx
4035: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
4038: 8b 50 04 mov 0x4(%eax),%edx
403b: 8d 34 d0 lea (%eax,%edx,8),%esi
403e: 39 ce cmp %ecx,%esi
4040: 75 dd jne 401f <free+0x4f>
p->s.size += bp->s.size;
4042: 03 51 04 add 0x4(%ecx),%edx
4045: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
4048: 8b 53 f8 mov -0x8(%ebx),%edx
404b: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
404d: a3 a8 59 00 00 mov %eax,0x59a8
}
4052: 5b pop %ebx
4053: 5e pop %esi
4054: 5f pop %edi
4055: 5d pop %ebp
4056: c3 ret
4057: 89 f6 mov %esi,%esi
4059: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00004060 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
4060: 55 push %ebp
4061: 89 e5 mov %esp,%ebp
4063: 57 push %edi
4064: 56 push %esi
4065: 53 push %ebx
4066: 83 ec 2c sub $0x2c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4069: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
406c: 8b 0d a8 59 00 00 mov 0x59a8,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4072: 83 c3 07 add $0x7,%ebx
4075: c1 eb 03 shr $0x3,%ebx
4078: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
407b: 85 c9 test %ecx,%ecx
407d: 0f 84 9b 00 00 00 je 411e <malloc+0xbe>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4083: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
4085: 8b 50 04 mov 0x4(%eax),%edx
4088: 39 d3 cmp %edx,%ebx
408a: 76 27 jbe 40b3 <malloc+0x53>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
408c: 8d 3c dd 00 00 00 00 lea 0x0(,%ebx,8),%edi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
4093: be 00 80 00 00 mov $0x8000,%esi
4098: 89 7d e4 mov %edi,-0x1c(%ebp)
409b: 90 nop
409c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
40a0: 3b 05 a8 59 00 00 cmp 0x59a8,%eax
40a6: 74 30 je 40d8 <malloc+0x78>
40a8: 89 c1 mov %eax,%ecx
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){
40aa: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
40ac: 8b 50 04 mov 0x4(%eax),%edx
40af: 39 d3 cmp %edx,%ebx
40b1: 77 ed ja 40a0 <malloc+0x40>
if(p->s.size == nunits)
40b3: 39 d3 cmp %edx,%ebx
40b5: 74 61 je 4118 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
40b7: 29 da sub %ebx,%edx
40b9: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
40bc: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
40bf: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
40c2: 89 0d a8 59 00 00 mov %ecx,0x59a8
return (void*)(p + 1);
40c8: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
40cb: 83 c4 2c add $0x2c,%esp
40ce: 5b pop %ebx
40cf: 5e pop %esi
40d0: 5f pop %edi
40d1: 5d pop %ebp
40d2: c3 ret
40d3: 90 nop
40d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
40d8: 8b 45 e4 mov -0x1c(%ebp),%eax
40db: 81 fb 00 10 00 00 cmp $0x1000,%ebx
40e1: bf 00 10 00 00 mov $0x1000,%edi
40e6: 0f 43 fb cmovae %ebx,%edi
40e9: 0f 42 c6 cmovb %esi,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
40ec: 89 04 24 mov %eax,(%esp)
40ef: e8 3c fc ff ff call 3d30 <sbrk>
if(p == (char*)-1)
40f4: 83 f8 ff cmp $0xffffffff,%eax
40f7: 74 18 je 4111 <malloc+0xb1>
return 0;
hp = (Header*)p;
hp->s.size = nu;
40f9: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
40fc: 83 c0 08 add $0x8,%eax
40ff: 89 04 24 mov %eax,(%esp)
4102: e8 c9 fe ff ff call 3fd0 <free>
return freep;
4107: 8b 0d a8 59 00 00 mov 0x59a8,%ecx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
410d: 85 c9 test %ecx,%ecx
410f: 75 99 jne 40aa <malloc+0x4a>
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){
if(p->s.size >= nunits){
4111: 31 c0 xor %eax,%eax
4113: eb b6 jmp 40cb <malloc+0x6b>
4115: 8d 76 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
4118: 8b 10 mov (%eax),%edx
411a: 89 11 mov %edx,(%ecx)
411c: eb a4 jmp 40c2 <malloc+0x62>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
411e: c7 05 a8 59 00 00 a0 movl $0x59a0,0x59a8
4125: 59 00 00
base.s.size = 0;
4128: b9 a0 59 00 00 mov $0x59a0,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
412d: c7 05 a0 59 00 00 a0 movl $0x59a0,0x59a0
4134: 59 00 00
base.s.size = 0;
4137: c7 05 a4 59 00 00 00 movl $0x0,0x59a4
413e: 00 00 00
4141: e9 3d ff ff ff jmp 4083 <malloc+0x23>
|
libsrc/osca/erase_file.asm | meesokim/z88dk | 0 | 162344 | <filename>libsrc/osca/erase_file.asm
;
; Old School Computer Architecture - interfacing FLOS
; <NAME>, 2011
;
; Like 'remove' but with a FLOS style error handling
;
; $Id: erase_file.asm,v 1.2 2015/01/19 01:33:00 pauloscustodio Exp $
;
INCLUDE "flos.def"
PUBLIC erase_file
EXTERN flos_err
erase_file:
; __FASTCALL__
call kjt_erase_file
jp flos_err
|
src/main/antlr4/imports/words.g4 | pcoppens/graphviz-antlr-compiler | 1 | 1523 | lexer grammar words;
// lexer rules
// Comments -> ignored
COMMENTS : ('/*' .*? '*/' | '//' ~'\n'* '\n' ) -> skip;
// Whitespaces -> ignored
NEWLINE: '\r'? '\n' -> skip ;
WS: [ \t]+ -> skip;
STRICT : 'strict';
GRAPH: 'graph';
DIGRAPH: 'digraph';
SUBGRAPH: 'subgraph';
NODE: 'node';
EDGE: 'edge';
UNDERSCORE: '_';
OPEN: '{';
CLOSE: '}';
SEMICOLON: ';';
COMMA: ',';
DBLPOINT: ':';
DASH:'--';
DDASH:'->';
N: 'n';
E: 'e';
NE: 'ne';
S: 's';
SE: 'se';
W: 'w';
SW: 'sw';
NW: 'nw';
C: 'c';
HTML: '<'.*? '>';
DOUBLE_QUOTED: '"'.*? '"';
NUMERAL:('-')?('.'(DIGIT)+ | (DIGIT)+ ('.'(DIGIT)*)? );
STRING: (LETTER|UNDERSCORE) (LETTER|UNDERSCORE | DIGIT)* ;
fragment LETTER: 'A'..'Z' | 'a'..'z' ;
fragment DIGIT: '0'..'9' ;
//fragment ULETTER: [\u200D - \u300D];
// handle characters which failed to match any other token
ErrorCharacter : . ; |
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2148.asm | ljhsiun2/medusa | 9 | 81102 | .global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1d7e6, %rax
nop
nop
nop
nop
nop
sub %r8, %r8
movl $0x61626364, (%rax)
and %r9, %r9
lea addresses_WC_ht+0x195a8, %rsi
lea addresses_D_ht+0xb7d6, %rdi
nop
nop
nop
nop
nop
and %rdx, %rdx
mov $46, %rcx
rep movsl
nop
sub %rcx, %rcx
lea addresses_UC_ht+0xf366, %rdi
nop
add %r9, %r9
and $0xffffffffffffffc0, %rdi
vmovntdqa (%rdi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %rax
nop
nop
and %rdx, %rdx
lea addresses_D_ht+0xa962, %rsi
lea addresses_D_ht+0x19d66, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor $22766, %r15
mov $127, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $55177, %rsi
lea addresses_D_ht+0x140e6, %rsi
lea addresses_A_ht+0x13466, %rdi
nop
sub %rax, %rax
mov $79, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %r9
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0x5166, %rdx
clflush (%rdx)
nop
nop
nop
and $14907, %rsi
mov $0x5152535455565758, %rdi
movq %rdi, (%rdx)
nop
nop
nop
nop
cmp %rdx, %rdx
// Store
lea addresses_normal+0xb42f, %r8
cmp %r13, %r13
movb $0x51, (%r8)
nop
add %r9, %r9
// Store
lea addresses_WC+0x8f46, %r12
nop
nop
nop
nop
nop
and $4982, %r9
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r12)
nop
nop
nop
nop
sub %rdi, %rdi
// Faulty Load
lea addresses_RW+0x4766, %r13
clflush (%r13)
sub $25622, %r8
mov (%r13), %r9
lea oracles, %rsi
and $0xff, %r9
shlq $12, %r9
mov (%rsi,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %r9
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'32': 21829}
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 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 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 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 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
*/
|
lib/target/cpc/classic/loader.asm | ahjelm/z88dk | 4 | 244463 | <reponame>ahjelm/z88dk<filename>lib/target/cpc/classic/loader.asm
;
; CPC bank loader, after @iratahack
;
EXTERN __DATA_END_tail
EXTERN __BANK_0_END_tail
EXTERN __BANK_1_END_tail
EXTERN __BANK_2_END_tail
EXTERN __BANK_3_END_tail
EXTERN __BANK_4_END_tail
EXTERN __BANK_5_END_tail
EXTERN __BANK_6_END_tail
EXTERN __BANK_7_END_tail
; Turn off tape messages
ld a,0
call cas_noisy
ld hl,__crt_loader_filename
find_ext:
ld a,(hl)
cp '.'
inc hl
jr nz,find_ext
inc hl
ld (extension),hl
; This may well contain the loading screen
ld hl,CRT_ORG_BANK_3
ld de,__BANK_3_END_tail - CRT_ORG_BANK_3
ld bc, $33c0 ;bank port, extension
call loadbank
; Probably part of the program as loaded, so not expected to be used
ld hl,CRT_ORG_BANK_0
ld de,__BANK_0_END_tail - CRT_ORG_BANK_0
ld bc,$30c0 ;Bank 0
call loadbank
ld hl,CRT_ORG_BANK_1
ld de,__BANK_1_END_tail - CRT_ORG_BANK_1
ld bc,$31c0 ;Bank 1
call loadbank
ld hl,CRT_ORG_BANK_4
ld de,__BANK_4_END_tail - CRT_ORG_BANK_4
ld bc,$34c4 ;Bank 4
call loadbank
ld hl,CRT_ORG_BANK_5
ld de,__BANK_5_END_tail - CRT_ORG_BANK_5
ld bc,$35c5 ;Bank 5
call loadbank
ld hl,CRT_ORG_BANK_6
ld de,__BANK_6_END_tail - CRT_ORG_BANK_6
ld bc,$36c6 ;Bank 6
call loadbank
ld hl,CRT_ORG_BANK_7
ld de,__BANK_7_END_tail - CRT_ORG_BANK_7
ld bc,$37c7 ;Bank 7
call loadbank
; Load bank2 into screen memory and copy across
; Loading into page2 will clobber ROM vectors
ld hl,49152
ld de,__BANK_2_END_tail - CRT_ORG_BANK_2
ld a,d
or e
ret z
ld bc,$32c0 ;Bank 2
call loadbank
di
ld hl,49152
ld de,$8000
ld bc,__BANK_2_END_tail - CRT_ORG_BANK_2
ldir
ret
; hl = address
; de = length
; c = bank page, b = extension character
loadbank:
ld a,d
or e
ret z
push hl
ld hl,(extension)
ld (hl),b
; Page in the bank
ld b,$7F ;gate array address
out (c),c
ld hl,__crt_loader_filename
call printit
pop de ;de = address to load
ld hl,__crt_loader_filename ;hl = filename
push hl
ld b,0
; Figure out length of filename
get_length:
ld a,(hl)
and a
jr z,length_found
inc hl
inc b
jr get_length
length_found:
pop hl
call cas_in_open ; Load address returned in DE
ex de, hl
call cas_in_direct
call cas_in_close
ld bc,$7fc0
out (c),c
ret
printit:
ld a, (hl)
inc hl
or a
ret z
call txt_output
jr printit
; Populated by appmake
PUBLIC __crt_loader_filename
extension:
defw 0
__crt_loader_filename:
defs 16
|
oeis/034/A034738.asm | neoneye/loda-programs | 11 | 240495 | <gh_stars>10-100
; A034738: Dirichlet convolution of b_n = 2^(n-1) with phi(n).
; Submitted by <NAME>(w3)
; 1,3,6,12,20,42,70,144,270,540,1034,2112,4108,8274,16440,32928,65552,131418,262162,524880,1048740,2098206,4194326,8391024,16777300,33558564,67109418,134226120,268435484,536888520,1073741854,2147516736,4294969404,8590000176,17179869560,34359874200,68719476772,137439215670,274877915208,549756339840,1099511627816,2199024320892,4398046511146,8796095121528,17592186078360,35184376283202,70368744177710,140737496814048,281474976711082,562949970200700,1125899906973792,2251799847248016,4503599627370548
add $0,1
mov $2,$0
lpb $0
mov $3,$0
sub $0,1
mov $4,$2
gcd $4,$3
mov $3,2
pow $3,$4
add $1,$3
lpe
mov $0,$1
div $0,2
|
src/SizedIO/coIOIOObject.agda | agda/ooAgda | 23 | 1280 | module SizedIO.coIOIOObject where
open import Data.Unit.Base
open import Data.Product
open import Data.String.Base
open import Size
open import SizedIO.Object
open import SizedIO.Base
open import SizedIO.Console
open import SizedIO.coIOIO
-- open import SizedIO.IOObject
record IOObject' (i : Size) (iface : Interface)(C : Set)(R : C → Set) : Set
where
coinductive
field
method : ∀{j : Size< i} (m : Method iface) →
IO j C R (Response iface m × IOObject' j iface C R)
open IOObject' public
-- An IO object is like a simple object,
-- but the method returns IO applied to the result type of a simple object
-- which means the method returns an IO program which when terminating
-- returns the result of the simple object
record coIO²Object (i : Size) (iface : Interface)
(Cin : Set)(Rin : Cin → Set)
(Cext : Set)(Rext : Cext → Set) : Set
where
coinductive
field
method' : ∀{j : Size< i} (m : Method iface) →
coIO²∞ ∞ Cin Rin Cext Rext
(Response iface m × coIO²Object j iface Cin Rin Cext Rext)
open coIO²Object public
selfrefIOObject : (i : Size) (iface : Interface)
(Cext : Set) (Rext : Cext → Set) → Set
selfrefIOObject i iface Cext Rext = coIO²Object i iface (Method iface)
(Response iface) Cext Rext
mutual
compileSelfRef : (i : Size) (iface : Interface)
(Cext : Set) (Rext : Cext → Set)
(obj : selfrefIOObject i iface Cext Rext) →
IOObject' i iface Cext Rext
IO.force (method (compileSelfRef i iface Cext Rext obj) {i'} m) {j} =
compileSelfRefaux i' j iface Cext Rext (Response iface m) (coIO²∞.force (method' obj {i'} m) j)
compileSelfRefaux :
(i : Size) (j : Size< i)
(iface : Interface) (let M = Method iface) (let R = Response iface)
(Cext : Set) (Rext : Cext → Set)
(A : Set)
(coObj : coIO² ∞ j M R Cext Rext (A × coIO²Object i iface M R Cext Rext))
→ IO' j Cext Rext (A × IOObject' i iface Cext Rext)
compileSelfRefaux i j iface Cext Rext A (coIO².return (r , obj)) = return' (r , compileSelfRef i iface Cext Rext obj)
compileSelfRefaux i j iface Cext Rext A (dof i' m f) = {! >>=!}
compileSelfRefaux i j iface Cext Rext A (do∞ c f) =
do' c (λ r → compileSelfRefaux'' i j iface Cext Rext A (f r))
compileSelfRefaux'' : (i : Size) (j : Size< i)
(iface : Interface) (let M = Method iface) (let R = Response iface)
(Cext : Set) (Rext : Cext → Set)
(A : Set)
(coObj : coIO²∞ j M R Cext Rext (A × coIO²Object i iface M R Cext Rext))
→ IO j Cext Rext (A × IOObject' i iface Cext Rext)
IO.force (compileSelfRefaux'' i j iface Cext Rext A coObj) {j''} = compileSelfRefaux i j'' iface Cext Rext A (coIO²∞.force coObj j'')
-- compileSelfRefaux'' i' j iface Cext Rext A coObj
-- = compileSelfRefaux' i' j iface Cext Rext A (coIO²∞.force coObj {!!})
{-
compileSelfRefaux' :
(i' : Size) (j : Size< i')
(iface : Interface) (let M = Methods iface) (let R = Responses iface)
(Cext : Set) (Rext : Cext → Set)
(A : Set)
(coObj : coIO² ∞ j M R Cext Rext (A × coIO²Object i' iface M R Cext Rext))
→ IO j Cext Rext (A × IOObject' i' iface Cext Rext)
IO.force (compileSelfRefaux' i' j iface Cext Rext A coObj) = compileSelfRefaux i' j iface Cext Rext A coObj
-}
{-
123;456hallo789
123;456hallo789
123;789hallo456
123;789hallo456
123;789456
123;789456
123;456789
123;456789
123;456789
123;456789
C-x r k -- kill rectangle
C-x r y -- yank rectangle
C-x r t -- text rectangle
-}
{-
M-x abbrev-mode
C-x ail
crosss
→
\
-}
-- method' obj {j'} m
{-
compileSelfRefaux : (j' : Size) (iface : Interface)
(Cext : Set) (Rext : Cext → Set)
(m : Methods iface)
( p : coIO²∞ ∞ (Methods iface)
(Responses iface) Cext Rext
(Responses iface m ×
coIO²Object j' iface (Methods iface)
(Responses iface) Cext Rext))
→ IO' j' Cext Rext
(Responses iface m ×
IOObject' j iface Cext Rext)IO' j' Cext Rext
(Responses iface m × IOObject' j iface Cext Rext)
-}
|
libsrc/_DEVELOPMENT/threads/mutex/c/sdcc_iy/spinlock_release.asm | jpoikela/z88dk | 640 | 1007 |
; void spinlock_release(char *spinlock)
SECTION code_clib
SECTION code_threads_mutex
PUBLIC _spinlock_release
EXTERN asm_spinlock_release
_spinlock_release:
pop af
pop hl
push hl
push af
jp asm_spinlock_release
|
3-mid/impact/source/3d/collision/narrowphase/impact-d3-collision-detector-discrete-gjk_pair.adb | charlie5/lace | 20 | 16154 | with impact.d3.Transform;
with impact.d3.Vector;
with impact.d3.Scalar;
-- #include "impact.d3.collision.Detector.discrete.gjk_pair.h"
-- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.h"
-- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.simplex_Solver.h"
-- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.convex_penetration_depth_Solver.h"
--
package body impact.d3.collision.Detector.discrete.gjk_pair
--
--
--
is
REL_ERROR2 : constant := 1.0e-6; -- Must be above the machine epsilon.
-- temp globals, to improve GJK/EPA/penetration calculations
--
gNumDeepPenetrationChecks : Integer := 0;
gNumGjkChecks : Integer := 0;
--- Forge
--
function to_gjk_pair_Detector (objectA, objectB : access impact.d3.Shape.convex.Item'Class;
simplexSolver : access impact.d3.collision.simplex_Solver.Item'Class;
penetrationDepthSolver : access impact.d3.collision.convex_penetration_depth_Solver.Item'Class) return Item
is
Self : Item;
begin
Self.m_cachedSeparatingAxis := (0.0, 1.0, 0.0);
Self.m_penetrationDepthSolver := penetrationDepthSolver;
Self.m_simplexSolver := simplexSolver;
Self.m_minkowskiA := objectA;
Self.m_minkowskiB := objectB;
Self.m_shapeTypeA := objectA.getShapeType;
Self.m_shapeTypeB := objectB.getShapeType;
Self.m_marginA := objectA.getMargin;
Self.m_marginB := objectB.getMargin;
Self.m_ignoreMargin := False;
Self.m_lastUsedMethod := -1;
Self.m_catchDegeneracies := True;
return Self;
end to_gjk_pair_Detector;
function to_gjk_pair_Detector (objectA, objectB : access impact.d3.Shape.convex.Item'Class;
shapeTypeA, shapeTypeB : in impact.d3.collision.Proxy.BroadphaseNativeTypes;
marginA, marginB : in math.Real;
simplexSolver : access impact.d3.collision.simplex_Solver.Item'Class;
penetrationDepthSolver : access impact.d3.collision.convex_penetration_depth_Solver.Item'Class) return Item
is
Self : Item;
begin
Self.m_cachedSeparatingAxis := (0.0, 1.0, 0.0);
Self.m_penetrationDepthSolver := penetrationDepthSolver;
Self.m_simplexSolver := simplexSolver;
Self.m_minkowskiA := objectA;
Self.m_minkowskiB := objectB;
Self.m_shapeTypeA := shapeTypeA;
Self.m_shapeTypeB := shapeTypeB;
Self.m_marginA := marginA;
Self.m_marginB := marginB;
Self.m_ignoreMargin := False;
Self.m_lastUsedMethod := -1;
Self.m_catchDegeneracies := True;
return Self;
end to_gjk_pair_Detector;
--- Attributes
--
procedure setMinkowskiA (Self : out Item; minkA : access impact.d3.Shape.convex.Item'Class)
is
begin
Self.m_minkowskiA := minkA;
end setMinkowskiA;
procedure setMinkowskiB (Self : out Item; minkB : access impact.d3.Shape.convex.Item'Class)
is
begin
Self.m_minkowskiB := minkB;
end setMinkowskiB;
procedure setCachedSeperatingAxis (Self : out Item; seperatingAxis : in math.Vector_3)
is
begin
Self.m_cachedSeparatingAxis := seperatingAxis;
end setCachedSeperatingAxis;
function getCachedSeparatingAxis (Self : in Item) return math.Vector_3
is
begin
return Self.m_cachedSeparatingAxis;
end getCachedSeparatingAxis;
function getCachedSeparatingDistance (Self : in Item) return math.Real
is
begin
return Self.m_cachedSeparatingDistance;
end getCachedSeparatingDistance;
procedure setPenetrationDepthSolver (Self : out Item; penetrationDepthSolver : access impact.d3.collision.convex_penetration_depth_Solver.Item'Class)
is
begin
Self.m_penetrationDepthSolver := penetrationDepthSolver;
end setPenetrationDepthSolver;
procedure setIgnoreMargin (Self : out Item; ignoreMargin : in Boolean)
is
begin
Self.m_ignoreMargin := ignoreMargin;
end setIgnoreMargin;
--- Operations
--
overriding procedure getClosestPoints (Self : in out Item; input : in impact.d3.collision.Detector.discrete.ClosestPointInput;
output : in out impact.d3.collision.Detector.discrete.Result'Class;
swapResults : in Boolean := False)
is
pragma Unreferenced (swapResults);
begin
Self.getClosestPointsNonVirtual (input, output);
end getClosestPoints;
procedure getClosestPointsNonVirtual (Self : in out Item'Class; input : in impact.d3.collision.Detector.discrete.ClosestPointInput;
output : in out impact.d3.collision.Detector.discrete.Result'Class)
is
use impact.d3.Transform;
distance : math.Real := 0.0;
normalInB : math.Vector_3 := (0.0, 0.0, 0.0);
pointOnA,
pointOnB : math.Vector_3;
localTransA : aliased Transform_3d := input.m_transformA;
localTransB : aliased Transform_3d := input.m_transformB;
positionOffset : constant math.Vector_3 := (getOrigin (localTransA) + getOrigin (localTransB)) * 0.5;
check2d : constant Boolean := Self.m_minkowskiA.isConvex2d and then Self.m_minkowskiB.isConvex2d;
marginA : math.Real := Self.m_marginA;
marginB : math.Real := Self.m_marginB;
gGjkMaxIter : constant Integer := 1000; -- this is to catch invalid input, perhaps check for #NaN?
begin
Self.m_cachedSeparatingDistance := 0.0;
getOrigin (localTransA'Unchecked_Access).all := getOrigin (localTransA) - positionOffset;
getOrigin (localTransB'Unchecked_Access).all := getOrigin (localTransB) - positionOffset;
-- localTransA.getOrigin() -= positionOffset;
-- localTransB.getOrigin() -= positionOffset;
gNumGjkChecks := gNumGjkChecks + 1;
if Self.m_ignoreMargin then -- for CCD we don't use margins
marginA := 0.0;
marginB := 0.0;
end if;
Self.m_curIter := 0;
Self.m_cachedSeparatingAxis := (0.0, 1.0, 0.0);
Self.m_degenerateSimplex := 0;
Self.m_lastUsedMethod := -1;
declare
isValid : Boolean := False;
checkSimplex : Boolean := False;
checkPenetration : constant Boolean := True;
squaredDistance : math.Real := BT_LARGE_FLOAT;
the_delta : math.Real := 0.0;
margin : math.Real := marginA + marginB;
begin
Self.m_simplexSolver.reset;
loop
declare
use linear_Algebra_3d, impact.d3.Vector, impact.d3.Scalar;
seperatingAxisInA : constant math.Vector_3 := -Self.m_cachedSeparatingAxis * getBasis (input.m_transformA);
seperatingAxisInB : constant math.Vector_3 := Self.m_cachedSeparatingAxis * getBasis (input.m_transformB);
pInA : constant math.Vector_3 := Self.m_minkowskiA.localGetSupportVertexWithoutMarginNonVirtual (seperatingAxisInA);
qInB : constant math.Vector_3 := Self.m_minkowskiB.localGetSupportVertexWithoutMarginNonVirtual (seperatingAxisInB);
pWorld : math.Vector_3 := localTransA * pInA;
qWorld : math.Vector_3 := localTransB * qInB;
w : math.Vector_3;
f0, f1 : math.Real;
newCachedSeparatingAxis : aliased math.Vector_3;
previousSquaredDistance : math.Real;
check : Boolean;
begin
if check2d then
pWorld (3) := 0.0;
qWorld (3) := 0.0;
end if;
w := pWorld - qWorld;
the_delta := dot (Self.m_cachedSeparatingAxis, w);
-- potential exit, they don't overlap
--
if the_delta > 0.0
and then the_delta * the_delta > squaredDistance * input.m_maximumDistanceSquared
then
Self.m_degenerateSimplex := 10;
checkSimplex := True;
-- // checkPenetration = false;
exit;
end if;
-- exit 0: the new point is already in the simplex, or we didn't come any closer
--
if Self.m_simplexSolver.inSimplex (w) then
Self.m_degenerateSimplex := 1;
checkSimplex := True;
exit;
end if;
-- are we getting any closer ?
f0 := squaredDistance - the_delta;
f1 := squaredDistance * REL_ERROR2;
if f0 <= f1 then
if f0 <= 0.0 then
Self.m_degenerateSimplex := 2;
else
Self.m_degenerateSimplex := 11;
end if;
checkSimplex := True;
exit;
end if;
-- add current vertex to simplex
Self.m_simplexSolver.addVertex (w, pWorld, qWorld);
-- calculate the closest point to the origin (update vector v)
--
if not Self.m_simplexSolver.closest (newCachedSeparatingAxis'Access) then
Self.m_degenerateSimplex := 3;
checkSimplex := True;
exit;
end if;
if length2 (newCachedSeparatingAxis) < REL_ERROR2 then
Self.m_cachedSeparatingAxis := newCachedSeparatingAxis;
Self.m_degenerateSimplex := 6;
checkSimplex := True;
exit;
end if;
previousSquaredDistance := squaredDistance;
squaredDistance := length2 (newCachedSeparatingAxis);
-- redundant m_simplexSolver->compute_points(pointOnA, pointOnB);
-- are we getting any closer ?
--
if previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance then
-- // m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
checkSimplex := True;
Self.m_degenerateSimplex := 12;
exit;
end if;
Self.m_cachedSeparatingAxis := newCachedSeparatingAxis;
-- degeneracy, this is typically due to invalid/uninitialized worldtransforms for a impact.d3.Object
--
if Self.m_curIter > gGjkMaxIter then
Self.m_curIter := Self.m_curIter + 1;
exit;
else
Self.m_curIter := Self.m_curIter + 1;
end if;
-- // bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex());
check := not Self.m_simplexSolver.fullSimplex;
if not check then
-- do we need this backup_closest here ?
-- m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
Self.m_degenerateSimplex := 13;
exit;
end if;
end;
end loop;
if checkSimplex then
declare
use impact.d3.Vector, impact.d3.Scalar, math.Functions;
lenSqr,
rlen,
s : math.Real;
begin
Self.m_simplexSolver.compute_points (pointOnA, pointOnB);
normalInB := Self.m_cachedSeparatingAxis;
lenSqr := length2 (Self.m_cachedSeparatingAxis);
-- valid normal
--
if lenSqr < 0.0001 then
Self.m_degenerateSimplex := 5;
end if;
if lenSqr > SIMD_EPSILON * SIMD_EPSILON then
rlen := 1.0 / sqRt (lenSqr);
normalInB := normalInB * rlen; -- normalize
s := sqRt (squaredDistance); pragma Assert (s > 0.0);
pointOnA := pointOnA - Self.m_cachedSeparatingAxis * (marginA / s);
pointOnB := pointOnB + Self.m_cachedSeparatingAxis * (marginB / s);
distance := (1.0 / rlen) - margin;
isValid := True;
Self.m_lastUsedMethod := 1;
else
Self.m_lastUsedMethod := 2;
end if;
end;
end if;
declare
use impact.d3.Vector, impact.d3.Scalar, math.Functions;
catchDegeneratePenetrationCase : constant Boolean := ( Self.m_catchDegeneracies
and then Self.m_penetrationDepthSolver /= null
and then Self.m_degenerateSimplex /= 0
and then ((distance + margin) < 0.01));
tmpPointOnA,
tmpPointOnB : aliased math.Vector_3;
distance2 : math.Real;
isValid2 : Boolean;
tmpNormalInB : math.Vector_3;
lenSqr : math.Real;
begin
-- // if (checkPenetration && !isValid)
if checkPenetration
and then ( not isValid
or else catchDegeneratePenetrationCase)
then
-- penetration case
-- if there is no way to handle penetrations, bail out
if Self.m_penetrationDepthSolver /= null then
-- Penetration depth case.
gNumDeepPenetrationChecks := gNumDeepPenetrationChecks + 1;
Self.m_cachedSeparatingAxis := (0.0, 0.0, 0.0);
isValid2 := Self.m_penetrationDepthSolver.calcPenDepth (Self.m_simplexSolver,
impact.d3.Shape.convex.view (Self.m_minkowskiA),
impact.d3.Shape.convex.view (Self.m_minkowskiB),
localTransA, localTransB,
Self.m_cachedSeparatingAxis'Access,
tmpPointOnA'Access, tmpPointOnB'Access);
if isValid2 then
tmpNormalInB := tmpPointOnB - tmpPointOnA;
lenSqr := length2 (tmpNormalInB);
if lenSqr <= SIMD_EPSILON * SIMD_EPSILON then
tmpNormalInB := Self.m_cachedSeparatingAxis;
lenSqr := length2 (Self.m_cachedSeparatingAxis);
end if;
if lenSqr > SIMD_EPSILON * SIMD_EPSILON then
tmpNormalInB := tmpNormalInB / sqRt (lenSqr);
distance2 := -length (tmpPointOnA - tmpPointOnB);
-- only replace valid penetrations when the result is deeper (check)
if not isValid
or else (distance2 < distance)
then
distance := distance2;
pointOnA := tmpPointOnA;
pointOnB := tmpPointOnB;
normalInB := tmpNormalInB;
isValid := True;
Self.m_lastUsedMethod := 3;
else
Self.m_lastUsedMethod := 8;
end if;
else
Self.m_lastUsedMethod := 9;
end if;
else
-- this is another degenerate case, where the initial GJK calculation reports a degenerate case
-- EPA reports no penetration, and the second GJK (using the supporting vector without margin)
-- reports a valid positive distance. Use the results of the second GJK instead of failing.
-- thanks to Jacob.Langford for the reproduction case
-- http://code.google.com/p/bullet/issues/detail?id=250
if length2 (Self.m_cachedSeparatingAxis) > 0.0 then
declare
distance2 : math.Real := length (tmpPointOnA - tmpPointOnB) - margin;
begin
-- only replace valid distances when the distance is less
if not isValid
or else distance2 < distance
then
distance := distance2;
pointOnA := tmpPointOnA;
pointOnB := tmpPointOnB;
pointOnA := pointOnA - Self.m_cachedSeparatingAxis * marginA;
pointOnB := pointOnB + Self.m_cachedSeparatingAxis * marginB;
normalInB := Self.m_cachedSeparatingAxis;
normalize (normalInB);
isValid := True;
Self.m_lastUsedMethod := 6;
else
Self.m_lastUsedMethod := 5;
end if;
end;
end if;
end if;
end if;
end if;
end;
if isValid
and then ( distance < 0.0
or else distance * distance < input.m_maximumDistanceSquared)
then
Self.m_cachedSeparatingAxis := normalInB;
Self.m_cachedSeparatingDistance := distance;
output.addContactPoint (normalInB,
pointOnB + positionOffset,
distance);
end if;
end;
end getClosestPointsNonVirtual;
end impact.d3.collision.Detector.discrete.gjk_pair;
-- #ifdef __SPU__
-- void impact.d3.collision.Detector.discrete.gjk_pair::getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
-- #else
-- void impact.d3.collision.Detector.discrete.gjk_pair::getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
-- #endif
-- {
-- m_cachedSeparatingDistance = 0.f;
--
-- impact.d3.Scalar distance=impact.d3.Scalar(0.);
-- impact.d3.Vector normalInB(impact.d3.Scalar(0.),impact.d3.Scalar(0.),impact.d3.Scalar(0.));
-- impact.d3.Vector pointOnA,pointOnB;
-- impact.d3.Transform localTransA = input.m_transformA;
-- impact.d3.Transform localTransB = input.m_transformB;
-- impact.d3.Vector positionOffset = (localTransA.getOrigin() + localTransB.getOrigin()) * impact.d3.Scalar(0.5);
-- localTransA.getOrigin() -= positionOffset;
-- localTransB.getOrigin() -= positionOffset;
--
-- bool check2d = m_minkowskiA->isConvex2d() && m_minkowskiB->isConvex2d();
--
-- impact.d3.Scalar marginA = m_marginA;
-- impact.d3.Scalar marginB = m_marginB;
--
-- gNumGjkChecks++;
--
-- #ifdef DEBUG_SPU_COLLISION_DETECTION
-- spu_printf("inside gjk\n");
-- #endif
-- //for CCD we don't use margins
-- if (m_ignoreMargin)
-- {
-- marginA = impact.d3.Scalar(0.);
-- marginB = impact.d3.Scalar(0.);
-- #ifdef DEBUG_SPU_COLLISION_DETECTION
-- spu_printf("ignoring margin\n");
-- #endif
-- }
--
-- m_curIter = 0;
-- int gGjkMaxIter = 1000;//this is to catch invalid input, perhaps check for #NaN?
-- m_cachedSeparatingAxis.setValue(0,1,0);
--
-- bool isValid = false;
-- bool checkSimplex = false;
-- bool checkPenetration = true;
-- m_degenerateSimplex = 0;
--
-- m_lastUsedMethod = -1;
--
-- {
-- impact.d3.Scalar squaredDistance = BT_LARGE_FLOAT;
-- impact.d3.Scalar delta = impact.d3.Scalar(0.);
--
-- impact.d3.Scalar margin = marginA + marginB;
--
--
--
-- m_simplexSolver->reset();
--
-- for ( ; ; )
-- //while (true)
-- {
--
-- impact.d3.Vector seperatingAxisInA = (-m_cachedSeparatingAxis)* input.m_transformA.getBasis();
-- impact.d3.Vector seperatingAxisInB = m_cachedSeparatingAxis* input.m_transformB.getBasis();
--
-- #if 1
--
-- impact.d3.Vector pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInA);
-- impact.d3.Vector qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInB);
--
-- // impact.d3.Vector pInA = localGetSupportingVertexWithoutMargin(m_shapeTypeA, m_minkowskiA, seperatingAxisInA,input.m_convexVertexData[0]);//, &featureIndexA);
-- // impact.d3.Vector qInB = localGetSupportingVertexWithoutMargin(m_shapeTypeB, m_minkowskiB, seperatingAxisInB,input.m_convexVertexData[1]);//, &featureIndexB);
--
-- #else
-- #ifdef __SPU__
-- impact.d3.Vector pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInA);
-- impact.d3.Vector qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInB);
-- #else
-- impact.d3.Vector pInA = m_minkowskiA->localGetSupportingVertexWithoutMargin(seperatingAxisInA);
-- impact.d3.Vector qInB = m_minkowskiB->localGetSupportingVertexWithoutMargin(seperatingAxisInB);
-- #ifdef TEST_NON_VIRTUAL
-- impact.d3.Vector pInAv = m_minkowskiA->localGetSupportingVertexWithoutMargin(seperatingAxisInA);
-- impact.d3.Vector qInBv = m_minkowskiB->localGetSupportingVertexWithoutMargin(seperatingAxisInB);
-- btAssert((pInAv-pInA).length() < 0.0001);
-- btAssert((qInBv-qInB).length() < 0.0001);
-- #endif //
-- #endif //__SPU__
-- #endif
--
--
-- impact.d3.Vector pWorld = localTransA(pInA);
-- impact.d3.Vector qWorld = localTransB(qInB);
--
-- #ifdef DEBUG_SPU_COLLISION_DETECTION
-- spu_printf("got local supporting vertices\n");
-- #endif
--
-- if (check2d)
-- {
-- pWorld[2] = 0.f;
-- qWorld[2] = 0.f;
-- }
--
-- impact.d3.Vector w = pWorld - qWorld;
-- delta = m_cachedSeparatingAxis.dot(w);
--
-- // potential exit, they don't overlap
-- if ((delta > impact.d3.Scalar(0.0)) && (delta * delta > squaredDistance * input.m_maximumDistanceSquared))
-- {
-- m_degenerateSimplex = 10;
-- checkSimplex=true;
-- //checkPenetration = false;
-- break;
-- }
--
-- //exit 0: the new point is already in the simplex, or we didn't come any closer
-- if (m_simplexSolver->inSimplex(w))
-- {
-- m_degenerateSimplex = 1;
-- checkSimplex = true;
-- break;
-- }
-- // are we getting any closer ?
-- impact.d3.Scalar f0 = squaredDistance - delta;
-- impact.d3.Scalar f1 = squaredDistance * REL_ERROR2;
--
-- if (f0 <= f1)
-- {
-- if (f0 <= impact.d3.Scalar(0.))
-- {
-- m_degenerateSimplex = 2;
-- } else
-- {
-- m_degenerateSimplex = 11;
-- }
-- checkSimplex = true;
-- break;
-- }
--
-- #ifdef DEBUG_SPU_COLLISION_DETECTION
-- spu_printf("addVertex 1\n");
-- #endif
-- //add current vertex to simplex
-- m_simplexSolver->addVertex(w, pWorld, qWorld);
-- #ifdef DEBUG_SPU_COLLISION_DETECTION
-- spu_printf("addVertex 2\n");
-- #endif
-- impact.d3.Vector newCachedSeparatingAxis;
--
-- //calculate the closest point to the origin (update vector v)
-- if (!m_simplexSolver->closest(newCachedSeparatingAxis))
-- {
-- m_degenerateSimplex = 3;
-- checkSimplex = true;
-- break;
-- }
--
-- if(newCachedSeparatingAxis.length2()<REL_ERROR2)
-- {
-- m_cachedSeparatingAxis = newCachedSeparatingAxis;
-- m_degenerateSimplex = 6;
-- checkSimplex = true;
-- break;
-- }
--
-- impact.d3.Scalar previousSquaredDistance = squaredDistance;
-- squaredDistance = newCachedSeparatingAxis.length2();
-- #if 0
-- ///warning: this termination condition leads to some problems in 2d test case see Bullet/Demos/Box2dDemo
-- if (squaredDistance>previousSquaredDistance)
-- {
-- m_degenerateSimplex = 7;
-- squaredDistance = previousSquaredDistance;
-- checkSimplex = false;
-- break;
-- }
-- #endif //
--
--
-- //redundant m_simplexSolver->compute_points(pointOnA, pointOnB);
--
-- //are we getting any closer ?
-- if (previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance)
-- {
-- // m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
-- checkSimplex = true;
-- m_degenerateSimplex = 12;
--
-- break;
-- }
--
-- m_cachedSeparatingAxis = newCachedSeparatingAxis;
--
-- //degeneracy, this is typically due to invalid/uninitialized worldtransforms for a impact.d3.Object
-- if (m_curIter++ > gGjkMaxIter)
-- {
-- #if defined(DEBUG) || defined (_DEBUG) || defined (DEBUG_SPU_COLLISION_DETECTION)
--
-- printf("impact.d3.collision.Detector.discrete.gjk_pair maxIter exceeded:%i\n",m_curIter);
-- printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
-- m_cachedSeparatingAxis.getX(),
-- m_cachedSeparatingAxis.getY(),
-- m_cachedSeparatingAxis.getZ(),
-- squaredDistance,
-- m_minkowskiA->getShapeType(),
-- m_minkowskiB->getShapeType());
--
-- #endif
-- break;
--
-- }
--
--
-- bool check = (!m_simplexSolver->fullSimplex());
-- //bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex());
--
-- if (!check)
-- {
-- //do we need this backup_closest here ?
-- // m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
-- m_degenerateSimplex = 13;
-- break;
-- }
-- }
--
-- if (checkSimplex)
-- {
-- m_simplexSolver->compute_points(pointOnA, pointOnB);
-- normalInB = m_cachedSeparatingAxis;
-- impact.d3.Scalar lenSqr =m_cachedSeparatingAxis.length2();
--
-- //valid normal
-- if (lenSqr < 0.0001)
-- {
-- m_degenerateSimplex = 5;
-- }
-- if (lenSqr > SIMD_EPSILON*SIMD_EPSILON)
-- {
-- impact.d3.Scalar rlen = impact.d3.Scalar(1.) / btSqrt(lenSqr );
-- normalInB *= rlen; //normalize
-- impact.d3.Scalar s = btSqrt(squaredDistance);
--
-- btAssert(s > impact.d3.Scalar(0.0));
-- pointOnA -= m_cachedSeparatingAxis * (marginA / s);
-- pointOnB += m_cachedSeparatingAxis * (marginB / s);
-- distance = ((impact.d3.Scalar(1.)/rlen) - margin);
-- isValid = true;
--
-- m_lastUsedMethod = 1;
-- } else
-- {
-- m_lastUsedMethod = 2;
-- }
-- }
--
-- bool catchDegeneratePenetrationCase =
-- (m_catchDegeneracies && m_penetrationDepthSolver && m_degenerateSimplex && ((distance+margin) < 0.01));
--
-- //if (checkPenetration && !isValid)
-- if (checkPenetration && (!isValid || catchDegeneratePenetrationCase ))
-- {
-- //penetration case
--
-- //if there is no way to handle penetrations, bail out
-- if (m_penetrationDepthSolver)
-- {
-- // Penetration depth case.
-- impact.d3.Vector tmpPointOnA,tmpPointOnB;
--
-- gNumDeepPenetrationChecks++;
-- m_cachedSeparatingAxis.setZero();
--
-- bool isValid2 = m_penetrationDepthSolver->calcPenDepth(
-- *m_simplexSolver,
-- m_minkowskiA,m_minkowskiB,
-- localTransA,localTransB,
-- m_cachedSeparatingAxis, tmpPointOnA, tmpPointOnB,
-- debugDraw,input.m_stackAlloc
-- );
--
--
-- if (isValid2)
-- {
-- impact.d3.Vector tmpNormalInB = tmpPointOnB-tmpPointOnA;
-- impact.d3.Scalar lenSqr = tmpNormalInB.length2();
-- if (lenSqr <= (SIMD_EPSILON*SIMD_EPSILON))
-- {
-- tmpNormalInB = m_cachedSeparatingAxis;
-- lenSqr = m_cachedSeparatingAxis.length2();
-- }
--
-- if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON))
-- {
-- tmpNormalInB /= btSqrt(lenSqr);
-- impact.d3.Scalar distance2 = -(tmpPointOnA-tmpPointOnB).length();
-- //only replace valid penetrations when the result is deeper (check)
-- if (!isValid || (distance2 < distance))
-- {
-- distance = distance2;
-- pointOnA = tmpPointOnA;
-- pointOnB = tmpPointOnB;
-- normalInB = tmpNormalInB;
-- isValid = true;
-- m_lastUsedMethod = 3;
-- } else
-- {
-- m_lastUsedMethod = 8;
-- }
-- } else
-- {
-- m_lastUsedMethod = 9;
-- }
-- } else
--
-- {
-- ///this is another degenerate case, where the initial GJK calculation reports a degenerate case
-- ///EPA reports no penetration, and the second GJK (using the supporting vector without margin)
-- ///reports a valid positive distance. Use the results of the second GJK instead of failing.
-- ///thanks to Jacob.Langford for the reproduction case
-- ///http://code.google.com/p/bullet/issues/detail?id=250
--
--
-- if (m_cachedSeparatingAxis.length2() > impact.d3.Scalar(0.))
-- {
-- impact.d3.Scalar distance2 = (tmpPointOnA-tmpPointOnB).length()-margin;
-- //only replace valid distances when the distance is less
-- if (!isValid || (distance2 < distance))
-- {
-- distance = distance2;
-- pointOnA = tmpPointOnA;
-- pointOnB = tmpPointOnB;
-- pointOnA -= m_cachedSeparatingAxis * marginA ;
-- pointOnB += m_cachedSeparatingAxis * marginB ;
-- normalInB = m_cachedSeparatingAxis;
-- normalInB.normalize();
-- isValid = true;
-- m_lastUsedMethod = 6;
-- } else
-- {
-- m_lastUsedMethod = 5;
-- }
-- }
-- }
--
-- }
--
-- }
-- }
--
--
--
-- if (isValid && ((distance < 0) || (distance*distance < input.m_maximumDistanceSquared)))
-- {
-- #if 0
-- ///some debugging
-- // if (check2d)
-- {
-- printf("n = %2.3f,%2.3f,%2.3f. ",normalInB[0],normalInB[1],normalInB[2]);
-- printf("distance = %2.3f exit=%d deg=%d\n",distance,m_lastUsedMethod,m_degenerateSimplex);
-- }
-- #endif
--
-- m_cachedSeparatingAxis = normalInB;
-- m_cachedSeparatingDistance = distance;
--
-- output.addContactPoint(
-- normalInB,
-- pointOnB+positionOffset,
-- distance);
--
-- }
--
--
-- }
|
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_1609.asm | ljhsiun2/medusa | 9 | 28595 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NC/_zr_/i3-7100_9_0xca_notsx.log_21829_1609.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1667b, %r12
nop
sub $12293, %r10
mov $0x6162636465666768, %r14
movq %r14, %xmm3
vmovups %ymm3, (%r12)
nop
nop
nop
inc %rax
lea addresses_D_ht+0xed83, %r8
nop
nop
nop
nop
add %r11, %r11
mov $0x6162636465666768, %r12
movq %r12, (%r8)
nop
nop
nop
nop
nop
and $27637, %r12
lea addresses_WC_ht+0xbf53, %r12
nop
sub %r14, %r14
movb (%r12), %r10b
nop
sub $32324, %rax
lea addresses_A_ht+0xc153, %rsi
lea addresses_UC_ht+0xa553, %rdi
xor %r14, %r14
mov $108, %rcx
rep movsw
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_D_ht+0x19953, %rsi
lea addresses_A_ht+0xb6c7, %rdi
nop
nop
nop
cmp %r12, %r12
mov $115, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %r10
lea addresses_WC_ht+0x5873, %rsi
lea addresses_normal_ht+0x20b, %rdi
nop
dec %rax
mov $7, %rcx
rep movsw
nop
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0x4253, %rcx
nop
nop
sub %rax, %rax
mov $0x6162636465666768, %r12
movq %r12, (%rcx)
nop
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0x18f53, %rsi
lea addresses_WT_ht+0xadc3, %rdi
nop
nop
nop
and $3104, %r11
mov $125, %rcx
rep movsb
nop
nop
nop
nop
and %r12, %r12
lea addresses_WC_ht+0x6b13, %rsi
lea addresses_D_ht+0x1efa3, %rdi
sub $56138, %r8
mov $50, %rcx
rep movsw
nop
nop
and %r11, %r11
lea addresses_A_ht+0x16a5f, %r12
add %r11, %r11
mov $0x6162636465666768, %r14
movq %r14, %xmm3
vmovups %ymm3, (%r12)
nop
nop
and %rax, %rax
lea addresses_normal_ht+0x953, %rsi
sub %rax, %rax
mov (%rsi), %r12w
cmp %rax, %rax
lea addresses_D_ht+0x4453, %rsi
lea addresses_D_ht+0x1ee39, %rdi
nop
nop
dec %r11
mov $122, %rcx
rep movsq
nop
nop
xor %rax, %rax
lea addresses_normal_ht+0x1a87d, %rsi
lea addresses_normal_ht+0x4403, %rdi
nop
sub %r10, %r10
mov $117, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %r8, %r8
lea addresses_A_ht+0xdba3, %r12
nop
nop
nop
nop
nop
xor %rsi, %rsi
mov (%r12), %r10
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
// Store
lea addresses_A+0x18433, %r9
nop
nop
nop
nop
nop
xor %rcx, %rcx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm2
vmovups %ymm2, (%r9)
nop
nop
nop
add %rcx, %rcx
// Faulty Load
mov $0x188bf50000000153, %rdx
dec %r11
mov (%rdx), %cx
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': True}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 1, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': True}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'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
*/
|
library/fmGUI_ManageDatabase/namesOfTOsOfWindowName.applescript | NYHTC/applescript-fm-helper | 1 | 2798 | <reponame>NYHTC/applescript-fm-helper<filename>library/fmGUI_ManageDatabase/namesOfTOsOfWindowName.applescript<gh_stars>1-10
-- namesOfTOsOfWindowName(someWindowName)
-- <NAME>, NYHTC
-- return the name of every table occurence of the specified window
(*
HISTORY:
1.2 - 2018-09-20 ( eshagdar ): FileMaker 17 has only version so talk to it by name.
1.1 - 2017-06-26 ( eshagdar ): cleaned up code
1.0 - 201x-xx-xx ( dshockley ): created.
*)
on run
tell application "FileMaker Pro Advanced" to set frontmostWindowName to name of window 1
namesOfTOsOfWindowName(frontmostWindowName)
end run
--------------------
-- START OF CODE
--------------------
on namesOfTOsOfWindowName(someWindowName)
-- version 1.1
tell application "FileMaker Pro Advanced"
set dbCount to count of every database
repeat with dbNum from 1 to dbCount
-- might not HAVE any windows:
try
set dbWindows to name of every window of database dbNum
if dbWindows contains someWindowName then return name of every table of database dbNum
end try
end repeat
end tell
error "Could not get namesOfTOsOfWindowName of window name specified: '" & someWindowName & "'"
end namesOfTOsOfWindowName
--------------------
-- END OF CODE
--------------------
|
mobile/fixed_words.asm | genterz/pokecross | 28 | 105396 | <gh_stars>10-100
; These functions seem to be related to the selection of preset phrases
; for use in mobile communications. Annoyingly, they separate the
; Battle Tower function above from the data it references.
Function11c05d:
ld a, e
or d
jr z, .error
ld a, e
and d
cp $ff
jr z, .error
push hl
call CopyMobileEZChatToC608
pop hl
call PlaceString
and a
ret
.error
ld c, l
ld b, h
scf
ret
Function11c075:
push de
ld a, c
call Function11c254
pop de
ld bc, wcd36
call Function11c08f
ret
Unreferenced_Function11c082:
push de
ld a, c
call Function11c254
pop de
ld bc, wcd36
call PrintEZChatBattleMessage
ret
Function11c08f:
ld l, e
ld h, d
push hl
ld a, 3
.loop
push af
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
push bc
call Function11c05d
jr c, .okay
inc bc
.okay
ld l, c
ld h, b
pop bc
pop af
dec a
jr nz, .loop
pop hl
ld de, 2 * SCREEN_WIDTH
add hl, de
ld a, $3
.loop2
push af
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
push bc
call Function11c05d
jr c, .okay2
inc bc
.okay2
ld l, c
ld h, b
pop bc
pop af
dec a
jr nz, .loop2
ret
PrintEZChatBattleMessage:
; Use up to 6 words from bc to print text starting at de.
; Preserve $cf63, $cf64
ld a, [wJumptableIndex]
ld l, a
ld a, [wcf64]
ld h, a
push hl
; reset value at c618 (not preserved)
ld hl, $c618
ld a, $0
ld [hli], a
; preserve de
push de
; $cf63 keeps track of which line we're on (0, 1, or 2)
; $cf64 keeps track of how much room we have left in the current line
xor a
ld [wJumptableIndex], a
ld a, 18
ld [wcf64], a
ld a, $6 ; up to 6 times
.loop
push af
; load the 2-byte word data pointed to by bc
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
; if $0000, we're done
or e
jr z, .done
; preserving hl and bc, get the length of the word
push hl
push bc
call CopyMobileEZChatToC608
call GetLengthOfWordAtC608
ld e, c
pop bc
pop hl
; if the functions return 0, we're done
ld a, e
or a
jr z, .done
.loop2
; e contains the length of the word
; add 1 for the space, unless we're at the start of the line
ld a, [wcf64]
cp 18
jr z, .skip_inc
inc e
.skip_inc
; if the word fits, put it on the same line
cp e
jr nc, .same_line
; otherwise, go to the next line
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
; if we're on line 2, insert "<NEXT>"
ld [hl], "<NEXT>"
rra
jr c, .got_line_terminator
; else, insert "<CONT>"
ld [hl], "<CONT>"
.got_line_terminator
inc hl
; init the next line, holding on to the same word
ld a, 18
ld [wcf64], a
dec e
jr .loop2
.same_line
; add the space, unless we're at the start of the line
cp 18
jr z, .skip_space
ld [hl], " "
inc hl
.skip_space
; deduct the length of the word
sub e
ld [wcf64], a
ld de, $c608
.place_string_loop
; load the string from de to hl
ld a, [de]
cp "@"
jr z, .done
inc de
ld [hli], a
jr .place_string_loop
.done
; next word?
pop af
dec a
jr nz, .loop
; we're finished, place "<DONE>"
ld [hl], "<DONE>"
; now, let's place the string from c618 to bc
pop bc
ld hl, $c618
call PlaceHLTextAtBC
; restore the original values of $cf63 and $cf64
pop hl
ld a, l
ld [wJumptableIndex], a
ld a, h
ld [wcf64], a
ret
GetLengthOfWordAtC608:
ld c, $0
ld hl, $c608
.loop
ld a, [hli]
cp "@"
ret z
inc c
jr .loop
CopyMobileEZChatToC608:
ldh a, [rSVBK]
push af
ld a, $1
ldh [rSVBK], a
ld a, "@"
ld hl, $c608
ld bc, NAME_LENGTH
call ByteFill
ld a, d
and a
jr z, .get_name
ld hl, MobileEZChatCategoryPointers
dec d
sla d
ld c, d
ld b, $0
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a
push bc
pop hl
ld c, e
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
ld bc, NAME_LENGTH_JAPANESE - 1
.copy_string
ld de, $c608
call CopyBytes
ld de, $c608
pop af
ldh [rSVBK], a
ret
.get_name
ld a, e
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld bc, MON_NAME_LENGTH - 1
jr .copy_string
Function11c1ab:
ldh a, [hInMenu]
push af
ld a, $1
ldh [hInMenu], a
call Function11c1b9
pop af
ldh [hInMenu], a
ret
Function11c1b9:
call .InitKanaMode
ldh a, [rSVBK]
push af
ld a, $5
ldh [rSVBK], a
call EZChat_MasterLoop
pop af
ldh [rSVBK], a
ret
.InitKanaMode:
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
ld [wcd23], a
ld [wcd20], a
ld [wcd21], a
ld [wcd22], a
ld [wcd35], a
ld [wcd2b], a
ld a, $ff
ld [wcd24], a
ld a, [wMenuCursorY]
dec a
call Function11c254
call ClearBGPalettes
call ClearSprites
call ClearScreen
call Function11d323
call SetPalettes
call DisableLCD
ld hl, GFX_11d67e
ld de, vTiles2
ld bc, $60
call CopyBytes
ld hl, LZ_11d6de
ld de, vTiles0
call Decompress
call EnableLCD
farcall ReloadMapPart
farcall ClearSpriteAnims
farcall LoadPokemonData
farcall Pokedex_ABCMode
ldh a, [rSVBK]
push af
ld a, $5
ldh [rSVBK], a
ld hl, $c6d0
ld de, wLYOverrides
ld bc, $100
call CopyBytes
pop af
ldh [rSVBK], a
call EZChat_GetCategoryWordsByKana
call EZChat_GetSeenPokemonByKana
ret
Function11c254:
push af
ld a, $4
call GetSRAMBank
ld hl, $a007
pop af
sla a
sla a
ld c, a
sla a
add c
ld c, a
ld b, $0
add hl, bc
ld de, wcd36
ld bc, 12
call CopyBytes
call CloseSRAM
ret
EZChat_ClearBottom12Rows:
ld a, " "
hlcoord 0, 6
ld bc, (SCREEN_HEIGHT - 6) * SCREEN_WIDTH
call ByteFill
ret
EZChat_MasterLoop:
.loop
call JoyTextDelay
ldh a, [hJoyPressed]
ldh [hJoypadPressed], a
ld a, [wJumptableIndex]
bit 7, a
jr nz, .exit
call .DoJumptableFunction
farcall PlaySpriteAnimations
farcall ReloadMapPart
jr .loop
.exit
farcall ClearSpriteAnims
call ClearSprites
ret
.DoJumptableFunction:
jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .SpawnObjects ; 00
dw .InitRAM ; 01
dw Function11c35f ; 02
dw Function11c373 ; 03
dw Function11c3c2 ; 04
dw Function11c3ed ; 05
dw Function11c52c ; 06
dw Function11c53d ; 07
dw Function11c658 ; 08
dw Function11c675 ; 09
dw Function11c9bd ; 0a
dw Function11c9c3 ; 0b
dw Function11caad ; 0c
dw Function11cab3 ; 0d
dw Function11cb52 ; 0e
dw Function11cb66 ; 0f
dw Function11cbf5 ; 10
dw Function11ccef ; 11
dw Function11cd04 ; 12
dw Function11cd20 ; 13
dw Function11cd54 ; 14
dw Function11ce0b ; 15
dw Function11ce2b ; 16
.SpawnObjects:
depixel 3, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
depixel 8, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $1
ld [hl], a
depixel 9, 2, 2, 0
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $3
ld [hl], a
depixel 10, 16
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $4
ld [hl], a
depixel 10, 4
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $5
ld [hl], a
depixel 10, 2
ld a, SPRITE_ANIM_INDEX_EZCHAT_CURSOR
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $2
ld [hl], a
ld hl, wcd23
set 1, [hl]
set 2, [hl]
jp Function11cfb5
.InitRAM:
ld a, $9
ld [wcd2d], a
ld a, $2
ld [wcd2e], a
ld [wcd2f], a
ld [wcd30], a
ld de, wcd2d
call Function11cfce
jp Function11cfb5
Function11c35f:
ld hl, wcd2f
inc [hl]
inc [hl]
dec hl
dec hl
dec [hl]
push af
ld de, wcd2d
call Function11cfce
pop af
ret nz
jp Function11cfb5
Function11c373:
ld hl, wcd30
inc [hl]
inc [hl]
dec hl
dec hl
dec [hl]
push af
ld de, wcd2d
call Function11cfce
pop af
ret nz
call Function11c38a
jp Function11cfb5
Function11c38a:
ld hl, Unknown_11c986
ld bc, wcd36
ld a, $6
.asm_11c392
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
push de
pop hl
ld a, [bc]
inc bc
ld e, a
ld a, [bc]
inc bc
ld d, a
push bc
or e
jr z, .asm_11c3af
ld a, e
and d
cp $ff
jr z, .asm_11c3af
call Function11c05d
jr .asm_11c3b5
.asm_11c3af
ld de, String_11c3bc
call PlaceString
.asm_11c3b5
pop bc
pop hl
pop af
dec a
jr nz, .asm_11c392
ret
String_11c3bc:
db "ーーーーー@"
Function11c3c2:
call EZChat_ClearBottom12Rows
ld de, Unknown_11cfbe
call Function11d035
hlcoord 1, 7
ld de, String_11c4db
call PlaceString
hlcoord 1, 16
ld de, String_11c51b
call PlaceString
call Function11c4be
ld hl, wcd23
set 0, [hl]
ld hl, wcd24
res 0, [hl]
call Function11cfb5
Function11c3ed:
ld hl, wcd20 ; wcd20
ld de, hJoypadPressed
ld a, [de]
and $8
jr nz, .asm_11c426
ld a, [de]
and $2
jr nz, .asm_11c41a
ld a, [de]
and $1
jr nz, .asm_11c42c
ld de, hJoyLast
ld a, [de]
and $40
jr nz, .asm_11c47c
ld a, [de]
and $80
jr nz, .asm_11c484
ld a, [de]
and $20
jr nz, .asm_11c48c
ld a, [de]
and $10
jr nz, .asm_11c498
ret
.asm_11c41a
call PlayClickSFX
.asm_11c41d
ld hl, wcd24
set 0, [hl]
ld a, $c
jr .asm_11c475
.asm_11c426
ld a, $8
ld [wcd20], a ; wcd20
ret
.asm_11c42c
ld a, [wcd20] ; wcd20
cp $6
jr c, .asm_11c472
sub $6
jr z, .asm_11c469
dec a
jr z, .asm_11c41d
ld hl, wcd36
ld c, $c
xor a
.asm_11c440
or [hl]
inc hl
dec c
jr nz, .asm_11c440
and a
jr z, .asm_11c460
ld de, Unknown_11cfba
call Function11cfce
decoord 1, 2
ld bc, wcd36
call Function11c08f
ld hl, wcd24
set 0, [hl]
ld a, $e
jr .asm_11c475
.asm_11c460
ld hl, wcd24
set 0, [hl]
ld a, $11
jr .asm_11c475
.asm_11c469
ld hl, wcd24
set 0, [hl]
ld a, $a
jr .asm_11c475
.asm_11c472
call Function11c4a5
.asm_11c475
ld [wJumptableIndex], a
call PlayClickSFX
ret
.asm_11c47c
ld a, [hl]
cp $3
ret c
sub $3
jr .asm_11c4a3
.asm_11c484
ld a, [hl]
cp $6
ret nc
add $3
jr .asm_11c4a3
.asm_11c48c
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
dec a
jr .asm_11c4a3
.asm_11c498
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
inc a
.asm_11c4a3
ld [hl], a
ret
Function11c4a5:
ld hl, wcd23
res 0, [hl]
ld a, [wcd2b]
and a
jr nz, .asm_11c4b7
xor a
ld [wcd21], a
ld a, $6
ret
.asm_11c4b7
xor a
ld [wcd22], a
ld a, $15
ret
Function11c4be:
ld a, $1
hlcoord 0, 6, wAttrMap
ld bc, $a0
call ByteFill
ld a, $7
hlcoord 0, 14, wAttrMap
ld bc, $28
call ByteFill
farcall ReloadMapPart
ret
String_11c4db:
db "6つのことば¯くみあわせます"
next "かえたいところ¯えらぶと でてくる"
next "ことばのグループから いれかえたい"
next "たんご¯えらんでください"
db "@"
String_11c51b:
db "ぜんぶけす やめる けってい@"
Function11c52c:
call EZChat_ClearBottom12Rows
call EZChat_PlaceCategoryNames
call Function11c618
ld hl, wcd24
res 1, [hl]
call Function11cfb5
Function11c53d:
ld hl, wcd21
ld de, hJoypadPressed
ld a, [de]
and START
jr nz, .start
ld a, [de]
and SELECT
jr nz, .select
ld a, [de]
and B_BUTTON
jr nz, .b
ld a, [de]
and A_BUTTON
jr nz, .a
ld de, hJoyLast
ld a, [de]
and D_UP
jr nz, .up
ld a, [de]
and D_DOWN
jr nz, .down
ld a, [de]
and D_LEFT
jr nz, .left
ld a, [de]
and D_RIGHT
jr nz, .right
ret
.a
ld a, [wcd21]
cp 15
jr c, .got_category
sub $f
jr z, .done
dec a
jr z, .mode
jr .b
.start
ld hl, wcd24
set 0, [hl]
ld a, $8
ld [wcd20], a ; wcd20
.b
ld a, $4
jr .go_to_function
.select
ld a, [wcd2b]
xor $1
ld [wcd2b], a
ld a, $15
jr .go_to_function
.mode
ld a, $13
jr .go_to_function
.got_category
ld a, $8
.go_to_function
ld hl, wcd24
set 1, [hl]
ld [wJumptableIndex], a
call PlayClickSFX
ret
.done
ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
.up
ld a, [hl]
cp $3
ret c
sub $3
jr .finish_dpad
.down
ld a, [hl]
cp $f
ret nc
add $3
jr .finish_dpad
.left
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
cp $9
ret z
cp $c
ret z
cp $f
ret z
dec a
jr .finish_dpad
.right
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
cp $b
ret z
cp $e
ret z
cp $11
ret z
inc a
.finish_dpad
ld [hl], a
ret
EZChat_PlaceCategoryNames:
ld de, MobileEZChatCategoryNames
ld bc, Coords_11c63a
ld a, 15
.loop
push af
ld a, [bc]
inc bc
ld l, a
ld a, [bc]
inc bc
ld h, a
push bc
call PlaceString
; The category names are padded with "@".
; To find the next category, the system must
; find the first character at de that is not "@".
.find_next_string_loop
inc de
ld a, [de]
cp "@"
jr z, .find_next_string_loop
pop bc
pop af
dec a
jr nz, .loop
hlcoord 1, 17
ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
ret
Function11c618:
ld a, $2
hlcoord 0, 6, wAttrMap
ld bc, $c8
call ByteFill
farcall ReloadMapPart
ret
EZChatString_Stop_Mode_Cancel:
db "けす モード やめる@"
Coords_11c63a:
dwcoord 1, 7
dwcoord 7, 7
dwcoord 13, 7
dwcoord 1, 9
dwcoord 7, 9
dwcoord 13, 9
dwcoord 1, 11
dwcoord 7, 11
dwcoord 13, 11
dwcoord 1, 13
dwcoord 7, 13
dwcoord 13, 13
dwcoord 1, 15
dwcoord 7, 15
dwcoord 13, 15
Function11c658:
call EZChat_ClearBottom12Rows
call Function11c770
ld de, Unknown_11cfc2
call Function11d035
call Function11c9ab
call Function11c7bc
call Function11c86e
ld hl, wcd24
res 3, [hl]
call Function11cfb5
Function11c675:
ld hl, wMobileCommsJumptableIndex
ld de, hJoypadPressed
ld a, [de]
and A_BUTTON
jr nz, .a
ld a, [de]
and B_BUTTON
jr nz, .b
ld a, [de]
and START
jr nz, .start
ld a, [de]
and SELECT
jr z, .select
ld a, [wcd26]
and a
ret z
sub $c
jr nc, .asm_11c699
xor a
.asm_11c699
ld [wcd26], a
jr .asm_11c6c4
.start
ld hl, wcd28
ld a, [wcd26]
add $c
cp [hl]
ret nc
ld [wcd26], a
ld a, [hl]
ld b, a
ld hl, wMobileCommsJumptableIndex
ld a, [wcd26]
add [hl]
jr c, .asm_11c6b9
cp b
jr c, .asm_11c6c4
.asm_11c6b9
ld a, [wcd28]
ld hl, wcd26
sub [hl]
dec a
ld [wMobileCommsJumptableIndex], a
.asm_11c6c4
call Function11c992
call Function11c7bc
call Function11c86e
ret
.select
ld de, hJoyLast
ld a, [de]
and D_UP
jr nz, .asm_11c708
ld a, [de]
and D_DOWN
jr nz, .asm_11c731
ld a, [de]
and D_LEFT
jr nz, .asm_11c746
ld a, [de]
and D_RIGHT
jr nz, .asm_11c755
ret
.a
call Function11c8f6
ld a, $4
ld [wcd35], a
jr .asm_11c6fc
.b
ld a, [wcd2b]
and a
jr nz, .asm_11c6fa
ld a, $6
jr .asm_11c6fc
.asm_11c6fa
ld a, $15
.asm_11c6fc
ld [wJumptableIndex], a
ld hl, wcd24
set 3, [hl]
call PlayClickSFX
ret
.asm_11c708
ld a, [hl]
cp $3
jr c, .asm_11c711
sub $3
jr .asm_11c76e
.asm_11c711
ld a, [wcd26]
sub $3
ret c
ld [wcd26], a
jr .asm_11c6c4
.asm_11c71c
ld hl, wcd28
ld a, [wcd26]
add $c
ret c
cp [hl]
ret nc
ld a, [wcd26]
add $3
ld [wcd26], a
jr .asm_11c6c4
.asm_11c731
ld a, [wcd28]
ld b, a
ld a, [wcd26]
add [hl]
add $3
cp b
ret nc
ld a, [hl]
cp $9
jr nc, .asm_11c71c
add $3
jr .asm_11c76e
.asm_11c746
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
cp $9
ret z
dec a
jr .asm_11c76e
.asm_11c755
ld a, [wcd28]
ld b, a
ld a, [wcd26]
add [hl]
inc a
cp b
ret nc
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
cp $b
ret z
inc a
.asm_11c76e
ld [hl], a
ret
Function11c770:
xor a
ld [wMobileCommsJumptableIndex], a
ld [wcd26], a
ld [wcd27], a
ld a, [wcd2b]
and a
jr nz, .cd2b_is_nonzero
ld a, [wcd21]
and a
jr z, .cd21_is_zero
; load from data array
dec a
sla a
ld hl, MobileEZChatData_WordAndPageCounts
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld [wcd28], a
ld a, [hl]
.load
ld [wcd29], a
ret
.cd21_is_zero
; compute from [wc7d2]
ld a, [wc7d2]
ld [wcd28], a
.div_12
ld c, 12
call SimpleDivide
and a
jr nz, .no_need_to_floor
dec b
.no_need_to_floor
ld a, b
jr .load
.cd2b_is_nonzero
; compute from [c6a8 + 2 * [cd22]]
ld hl, $c6a8 ; $c68a + 30
ld a, [wcd22]
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hl]
ld [wcd28], a
jr .div_12
Function11c7bc:
ld bc, Unknown_11c854
ld a, [wcd2b]
and a
jr nz, .asm_11c814
ld a, [wcd21]
ld d, a
and a
jr z, .asm_11c7e9
ld a, [wcd26]
ld e, a
.asm_11c7d0
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
ret z
push bc
push de
call Function11c05d
pop de
pop bc
inc e
ld a, [wcd28]
cp e
jr nz, .asm_11c7d0
ret
.asm_11c7e9
ld hl, wListPointer
ld a, [wcd26]
ld e, a
add hl, de
.asm_11c7f1
push de
ld a, [hli]
ld e, a
ld d, $0
push hl
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
jr z, .asm_11c811
push bc
call Function11c05d
pop bc
pop hl
pop de
inc e
ld a, [wcd28]
cp e
jr nz, .asm_11c7f1
ret
.asm_11c811
pop hl
pop de
ret
.asm_11c814
ld hl, $c648
ld a, [wcd22]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
push de
pop hl
ld a, [wcd26]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [wcd26]
ld e, a
.asm_11c831
push de
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
jr z, .asm_11c851
push bc
call Function11c05d
pop bc
pop hl
pop de
inc e
ld a, [wcd28]
cp e
jr nz, .asm_11c831
ret
.asm_11c851
pop hl
pop de
ret
Unknown_11c854:
dwcoord 2, 8
dwcoord 8, 8
dwcoord 14, 8
dwcoord 2, 10
dwcoord 8, 10
dwcoord 14, 10
dwcoord 2, 12
dwcoord 8, 12
dwcoord 14, 12
dwcoord 2, 14
dwcoord 8, 14
dwcoord 14, 14
dw -1
Function11c86e:
ld a, [wcd26]
and a
jr z, .asm_11c88a
hlcoord 2, 17
ld de, MobileString_Prev
call PlaceString
hlcoord 6, 17
ld c, $3
xor a
.asm_11c883
ld [hli], a
inc a
dec c
jr nz, .asm_11c883
jr .asm_11c895
.asm_11c88a
hlcoord 2, 17
ld c, $7
ld a, $7f
.asm_11c891
ld [hli], a
dec c
jr nz, .asm_11c891
.asm_11c895
ld hl, wcd28
ld a, [wcd26]
add $c
jr c, .asm_11c8b7
cp [hl]
jr nc, .asm_11c8b7
hlcoord 16, 17
ld de, MobileString_Next
call PlaceString
hlcoord 11, 17
ld a, $3
ld c, a
.asm_11c8b1
ld [hli], a
inc a
dec c
jr nz, .asm_11c8b1
ret
.asm_11c8b7
hlcoord 17, 16
ld a, $7f
ld [hl], a
hlcoord 11, 17
ld c, $7
.asm_11c8c2
ld [hli], a
dec c
jr nz, .asm_11c8c2
ret
BCD2String:
inc a
push af
and $f
ldh [hDividend], a
pop af
and $f0
swap a
ldh [hDividend + 1], a
xor a
ldh [hDividend + 2], a
push hl
farcall Function11a80c
pop hl
ld a, [wcd63]
add "0"
ld [hli], a
ld a, [wcd62]
add "0"
ld [hli], a
ret
MobileString_Page:
db "ぺージ@"
MobileString_Prev:
db "まえ@"
MobileString_Next:
db "つぎ@"
Function11c8f6:
ld a, [wcd20] ; wcd20
call Function11c95d
push hl
ld a, [wcd2b]
and a
jr nz, .asm_11c938
ld a, [wcd21]
ld d, a
and a
jr z, .asm_11c927
ld hl, wcd26
ld a, [wMobileCommsJumptableIndex]
add [hl]
.asm_11c911
ld e, a
.asm_11c912
pop hl
push de
call Function11c05d
pop de
ld a, [wcd20] ; wcd20
ld c, a
ld b, $0
ld hl, wcd36
add hl, bc
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ret
.asm_11c927
ld hl, wcd26
ld a, [wMobileCommsJumptableIndex]
add [hl]
ld c, a
ld b, $0
ld hl, wListPointer
add hl, bc
ld a, [hl]
jr .asm_11c911
.asm_11c938
ld hl, $c648
ld a, [wcd22]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
push de
pop hl
ld a, [wcd26]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [wMobileCommsJumptableIndex]
ld e, a
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
jr .asm_11c912
Function11c95d:
sla a
ld c, a
ld b, 0
ld hl, Unknown_11c986
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a
push bc
push bc
pop hl
ld a, $5
ld c, a
ld a, $7f
.asm_11c972
ld [hli], a
dec c
jr nz, .asm_11c972
dec hl
ld bc, -20
add hl, bc
ld a, $5
ld c, a
ld a, $7f
.asm_11c980
ld [hld], a
dec c
jr nz, .asm_11c980
pop hl
ret
Unknown_11c986:
dwcoord 1, 2
dwcoord 7, 2
dwcoord 13, 2
dwcoord 1, 4
dwcoord 7, 4
dwcoord 13, 4
Function11c992:
ld a, $8
hlcoord 2, 7
.asm_11c997
push af
ld a, $7f
push hl
ld bc, $11
call ByteFill
pop hl
ld bc, $14
add hl, bc
pop af
dec a
jr nz, .asm_11c997
ret
Function11c9ab:
ld a, $7
hlcoord 0, 6, wAttrMap
ld bc, $c8
call ByteFill
farcall ReloadMapPart
ret
Function11c9bd:
ld de, String_11ca38
call Function11ca7f
Function11c9c3:
ld hl, wcd2a
ld de, hJoypadPressed
ld a, [de]
and $1
jr nz, .asm_11c9de
ld a, [de]
and $2
jr nz, .asm_11c9e9
ld a, [de]
and $40
jr nz, .asm_11c9f7
ld a, [de]
and $80
jr nz, .asm_11c9fc
ret
.asm_11c9de
ld a, [hl]
and a
jr nz, .asm_11c9e9
call Function11ca5e
xor a
ld [wcd20], a ; wcd20
.asm_11c9e9
ld hl, wcd24
set 4, [hl]
ld a, $4
ld [wJumptableIndex], a
call PlayClickSFX
ret
.asm_11c9f7
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11c9fc
ld a, [hl]
and a
ret nz
inc [hl]
ret
Function11ca01:
hlcoord 14, 7, wAttrMap
ld de, $14
ld a, $5
ld c, a
.asm_11ca0a
push hl
ld a, $6
ld b, a
ld a, $7
.asm_11ca10
ld [hli], a
dec b
jr nz, .asm_11ca10
pop hl
add hl, de
dec c
jr nz, .asm_11ca0a
Function11ca19:
hlcoord 0, 12, wAttrMap
ld de, $14
ld a, $6
ld c, a
.asm_11ca22
push hl
ld a, $14
ld b, a
ld a, $7
.asm_11ca28
ld [hli], a
dec b
jr nz, .asm_11ca28
pop hl
add hl, de
dec c
jr nz, .asm_11ca22
farcall ReloadMapPart
ret
String_11ca38:
db "とうろくちゅう<NO>あいさつ¯ぜんぶ"
next "けしても よろしいですか?@"
String_11ca57:
db "はい"
next "いいえ@"
Function11ca5e:
xor a
.loop
push af
call Function11ca6a
pop af
inc a
cp $6
jr nz, .loop
ret
Function11ca6a:
ld hl, wcd36
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld [hl], b
inc hl
ld [hl], b
call Function11c95d
ld de, String_11c3bc
call PlaceString
ret
Function11ca7f:
push de
ld de, Unknown_11cfc6
call Function11cfce
ld de, Unknown_11cfca
call Function11cfce
hlcoord 1, 14
pop de
call PlaceString
hlcoord 16, 8
ld de, String_11ca57
call PlaceString
call Function11ca01
ld a, $1
ld [wcd2a], a
ld hl, wcd24
res 4, [hl]
call Function11cfb5
ret
Function11caad:
ld de, String_11cb1c
call Function11ca7f
Function11cab3:
ld hl, wcd2a
ld de, hJoypadPressed
ld a, [de]
and $1
jr nz, .asm_11cace
ld a, [de]
and $2
jr nz, .asm_11caf9
ld a, [de]
and $40
jr nz, .asm_11cb12
ld a, [de]
and $80
jr nz, .asm_11cb17
ret
.asm_11cace
call PlayClickSFX
ld a, [hl]
and a
jr nz, .asm_11cafc
ld a, [wcd35]
and a
jr z, .asm_11caf3
cp $ff
jr z, .asm_11caf3
ld a, $ff
ld [wcd35], a
hlcoord 1, 14
ld de, String_11cb31
call PlaceString
ld a, $1
ld [wcd2a], a
ret
.asm_11caf3
ld hl, wJumptableIndex
set 7, [hl]
ret
.asm_11caf9
call PlayClickSFX
.asm_11cafc
ld hl, wcd24
set 4, [hl]
ld a, $4
ld [wJumptableIndex], a
ld a, [wcd35]
cp $ff
ret nz
ld a, $1
ld [wcd35], a
ret
.asm_11cb12
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11cb17
ld a, [hl]
and a
ret nz
inc [hl]
ret
String_11cb1c:
db "あいさつ<NO>とうろく¯ちゅうし"
next "しますか?@"
String_11cb31:
db "とうろくちゅう<NO>あいさつ<WA>ほぞん"
next "されません<GA>よろしい ですか?@"
Function11cb52:
ld hl, Unknown_11cc01
ld a, [wMenuCursorY]
.asm_11cb58
dec a
jr z, .asm_11cb5f
inc hl
inc hl
jr .asm_11cb58
.asm_11cb5f
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
call Function11ca7f
Function11cb66:
ld hl, wcd2a
ld de, hJoypadPressed
ld a, [de]
and $1
jr nz, .asm_11cb81
ld a, [de]
and $2
jr nz, .asm_11cbd7
ld a, [de]
and $40
jr nz, .asm_11cbeb
ld a, [de]
and $80
jr nz, .asm_11cbf0
ret
.asm_11cb81
ld a, [hl]
and a
jr nz, .asm_11cbd4
ld a, $4
call GetSRAMBank
ld hl, $a007
ld a, [wMenuCursorY]
dec a
sla a
sla a
ld c, a
sla a
add c
ld c, a
ld b, $0
add hl, bc
ld de, wcd36
ld c, $c
.asm_11cba2
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_11cba2
call CloseSRAM
call PlayClickSFX
ld de, Unknown_11cfc6
call Function11cfce
ld hl, Unknown_11cc7e
ld a, [wMenuCursorY]
.asm_11cbba
dec a
jr z, .asm_11cbc1
inc hl
inc hl
jr .asm_11cbba
.asm_11cbc1
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
hlcoord 1, 14
call PlaceString
ld hl, wJumptableIndex
inc [hl]
inc hl
ld a, $10
ld [hl], a
ret
.asm_11cbd4
call PlayClickSFX
.asm_11cbd7
ld de, Unknown_11cfba
call Function11cfce
call Function11c38a
ld hl, wcd24
set 4, [hl]
ld a, $4
ld [wJumptableIndex], a
ret
.asm_11cbeb
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11cbf0
ld a, [hl]
and a
ret nz
inc [hl]
ret
Function11cbf5:
call WaitSFX
ld hl, wcf64
dec [hl]
ret nz
dec hl
set 7, [hl]
ret
Unknown_11cc01:
dw String_11cc09
dw String_11cc23
dw String_11cc42
dw String_11cc60
String_11cc09:
db "じこしょうかい は"
next "この あいさつで いいですか?@"
String_11cc23:
db "たいせん <GA>はじまるとき は"
next "この あいさつで いいですか?@"
String_11cc42:
db "たいせん <NI>かったとき は"
next "この あいさつで いいですか?@"
String_11cc60:
db "たいせん <NI>まけたとき は"
next "この あいさつで いいですか?@"
Unknown_11cc7e:
dw String_11cc86
dw String_11cc9d
dw String_11ccb9
dw String_11ccd4
String_11cc86:
db "じこしょうかい の"
next "あいさつ¯とうろくした!@"
String_11cc9d:
db "たいせん <GA>はじまるとき の"
next "あいさつ¯とうろくした!@"
String_11ccb9:
db "たいせん <NI>かったとき の"
next "あいさつ¯とうろくした!@"
String_11ccd4:
db "たいせん <NI>まけたとき の"
next "あいさつ¯とうろくした!@"
Function11ccef:
ld de, Unknown_11cfc6
call Function11cfce
hlcoord 1, 14
ld de, String_11cd10
call PlaceString
call Function11ca19
call Function11cfb5
Function11cd04:
ld de, hJoypadPressed
ld a, [de]
and a
ret z
ld a, $4
ld [wJumptableIndex], a
ret
String_11cd10:
db "なにか ことば¯いれてください@"
Function11cd20:
call EZChat_ClearBottom12Rows
ld de, Unknown_11cfc6
call Function11cfce
hlcoord 1, 14
ld a, [wcd2b]
ld [wcd2c], a
and a
jr nz, .asm_11cd3a
ld de, String_11cdc7
jr .asm_11cd3d
.asm_11cd3a
ld de, String_11cdd9
.asm_11cd3d
call PlaceString
hlcoord 4, 8
ld de, String_11cdf5
call PlaceString
call Function11cdaa
ld hl, wcd24
res 5, [hl]
call Function11cfb5
Function11cd54:
ld hl, wcd2c
ld de, hJoypadPressed
ld a, [de]
and A_BUTTON
jr nz, .asm_11cd6f
ld a, [de]
and B_BUTTON
jr nz, .asm_11cd73
ld a, [de]
and D_UP
jr nz, .asm_11cd8b
ld a, [de]
and D_DOWN
jr nz, .asm_11cd94
ret
.asm_11cd6f
ld a, [hl]
ld [wcd2b], a
.asm_11cd73
ld a, [wcd2b]
and a
jr nz, .asm_11cd7d
ld a, $6
jr .asm_11cd7f
.asm_11cd7d
ld a, $15
.asm_11cd7f
ld [wJumptableIndex], a
ld hl, wcd24
set 5, [hl]
call PlayClickSFX
ret
.asm_11cd8b
ld a, [hl]
and a
ret z
dec [hl]
ld de, String_11cdc7
jr .asm_11cd9b
.asm_11cd94
ld a, [hl]
and a
ret nz
inc [hl]
ld de, String_11cdd9
.asm_11cd9b
push de
ld de, Unknown_11cfc6
call Function11cfce
pop de
hlcoord 1, 14
call PlaceString
ret
Function11cdaa:
ld a, $2
hlcoord 0, 6, wAttrMap
ld bc, 6 * SCREEN_WIDTH
call ByteFill
ld a, $7
hlcoord 0, 12, wAttrMap
ld bc, 4 * SCREEN_WIDTH
call ByteFill
farcall ReloadMapPart
ret
String_11cdc7:
; Words will be displayed by category
db "ことば¯しゅるいべつに"
next "えらべます@"
String_11cdd9:
; Words will be displayed in alphabetical order
db "ことば¯アイウエオ の"
next "じゅんばんで ひょうじ します@"
String_11cdf5:
db "しゅるいべつ モード" ; Category mode
next "アイウエオ モード@" ; ABC mode
Function11ce0b:
call EZChat_ClearBottom12Rows
hlcoord 1, 7
ld de, String_11cf79
call PlaceString
hlcoord 1, 17
ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
call Function11c618
ld hl, wcd24
res 2, [hl]
call Function11cfb5
Function11ce2b:
ld a, [wcd22]
sla a
sla a
ld c, a
ld b, 0
ld hl, Unknown_11ceb9
add hl, bc
ld de, hJoypadPressed
ld a, [de]
and START
jr nz, .start
ld a, [de]
and SELECT
jr nz, .select
ld a, [de]
and A_BUTTON
jr nz, .a
ld a, [de]
and B_BUTTON
jr nz, .b
ld de, hJoyLast
ld a, [de]
and D_UP
jr nz, .up
ld a, [de]
and D_DOWN
jr nz, .down
ld a, [de]
and D_LEFT
jr nz, .left
ld a, [de]
and D_RIGHT
jr nz, .right
ret
.a
ld a, [wcd22]
cp NUM_KANA
jr c, .place
sub NUM_KANA
jr z, .done
dec a
jr z, .mode
jr .b
.start
ld hl, wcd24
set 0, [hl]
ld a, $8
ld [wcd20], a ; wcd20
.b
ld a, $4
jr .load
.select
ld a, [wcd2b]
xor $1
ld [wcd2b], a
ld a, $6
jr .load
.place
ld a, $8
jr .load
.mode
ld a, $13
.load
ld [wJumptableIndex], a
ld hl, wcd24
set 2, [hl]
call PlayClickSFX
ret
.done
ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
.left
inc hl
.down
inc hl
.right
inc hl
.up
ld a, [hl]
cp $ff
ret z
ld [wcd22], a
ret
Unknown_11ceb9:
; up left down right
db $ff, $01
db $05, $ff
db $ff, $02
db $06, $00
db $ff, $03
db $07, $01
db $ff, $04
db $08, $02
db $ff, $14
db $09, $03
db $00, $06
db $0a, $ff
db $01, $07
db $0b, $05
db $02, $08
db $0c, $06
db $03, $09
db $0d, $07
db $04, $19
db $0e, $08
db $05, $0b
db $0f, $ff
db $06, $0c
db $10, $0a
db $07, $0d
db $11, $0b
db $08, $0e
db $12, $0c
db $09, $1e
db $13, $0d
db $0a, $10
db $2d, $ff
db $0b, $11
db $2d, $0f
db $0c, $12
db $2d, $10
db $0d, $13
db $2d, $11
db $0e, $26
db $2d, $12
db $ff, $15
db $19, $04
db $ff, $16
db $1a, $14
db $ff, $17
db $1b, $15
db $ff, $18
db $1c, $16
db $ff, $23
db $1d, $17
db $14, $1a
db $1e, $09
db $15, $1b
db $1f, $19
db $16, $1c
db $20, $1a
db $17, $1d
db $21, $1b
db $18, $2b
db $22, $1c
db $19, $1f
db $26, $0e
db $1a, $20
db $27, $1e
db $1b, $21
db $28, $1f
db $1c, $22
db $29, $20
db $1d, $2c
db $2a, $21
db $ff, $24
db $2b, $18
db $ff, $25
db $2b, $23
db $ff, $ff
db $2b, $24
db $1e, $27
db $2e, $13
db $1f, $28
db $2e, $26
db $20, $29
db $2e, $27
db $21, $2a
db $2e, $28
db $22, $ff
db $2e, $29
db $23, $ff
db $2c, $1d
db $2b, $ff
db $2f, $22
db $0f, $2e
db $ff, $ff
db $26, $2f
db $ff, $2d
db $2c, $ff
db $ff, $2e
String_11cf79:
; Hiragana table
db "あいうえお なにぬねの や ゆ よ"
next "かきくけこ はひふへほ わ"
next "さしすせそ まみむめも そのた"
next "たちつてと らりるれろ"
db "@"
Function11cfb5:
ld hl, wJumptableIndex
inc [hl]
ret
Unknown_11cfba:
db 0, 0 ; start coords
db 20, 6 ; end coords
Unknown_11cfbe:
db 0, 14 ; start coords
db 20, 4 ; end coords
Unknown_11cfc2:
db 0, 6 ; start coords
db 20, 10 ; end coords
Unknown_11cfc6:
db 0, 12 ; start coords
db 20, 6 ; end coords
Unknown_11cfca:
db 14, 7 ; start coords
db 6, 5 ; end coords
Function11cfce:
hlcoord 0, 0
ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
.add_n_times
jr z, .done_add_n_times
add hl, bc
dec a
jr .add_n_times
.done_add_n_times
pop af
ld c, a
ld b, 0
add hl, bc
push hl
ld a, $79
ld [hli], a
ld a, [de]
inc de
dec a
dec a
jr z, .skip_fill
ld c, a
ld a, $7a
.fill_loop
ld [hli], a
dec c
jr nz, .fill_loop
.skip_fill
ld a, $7b
ld [hl], a
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
ld a, [de]
dec de
dec a
dec a
jr z, .skip_section
ld b, a
.loop
push hl
ld a, $7c
ld [hli], a
ld a, [de]
dec a
dec a
jr z, .skip_row
ld c, a
ld a, $7f
.row_loop
ld [hli], a
dec c
jr nz, .row_loop
.skip_row
ld a, $7c
ld [hl], a
pop hl
push bc
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .loop
.skip_section
ld a, $7d
ld [hli], a
ld a, [de]
dec a
dec a
jr z, .skip_remainder
ld c, a
ld a, $7a
.final_loop
ld [hli], a
dec c
jr nz, .final_loop
.skip_remainder
ld a, $7e
ld [hl], a
ret
Function11d035:
hlcoord 0, 0
ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
.add_n_times
jr z, .done_add_n_times
add hl, bc
dec a
jr .add_n_times
.done_add_n_times
pop af
ld c, a
ld b, $0
add hl, bc
push hl
ld a, $79
ld [hl], a
pop hl
push hl
ld a, [de]
dec a
inc de
ld c, a
add hl, bc
ld a, $7b
ld [hl], a
call .AddNMinusOneTimes
ld a, $7e
ld [hl], a
pop hl
push hl
call .AddNMinusOneTimes
ld a, $7d
ld [hl], a
pop hl
push hl
inc hl
push hl
call .AddNMinusOneTimes
pop bc
dec de
ld a, [de]
cp $2
jr z, .skip
dec a
dec a
.loop
push af
ld a, $7a
ld [hli], a
ld [bc], a
inc bc
pop af
dec a
jr nz, .loop
.skip
pop hl
ld bc, $14
add hl, bc
push hl
ld a, [de]
dec a
ld c, a
ld b, $0
add hl, bc
pop bc
inc de
ld a, [de]
cp $2
ret z
push bc
dec a
dec a
ld c, a
ld b, a
ld de, $14
.loop2
ld a, $7c
ld [hl], a
add hl, de
dec c
jr nz, .loop2
pop hl
.loop3
ld a, $7c
ld [hl], a
add hl, de
dec b
jr nz, .loop3
ret
.AddNMinusOneTimes:
ld a, [de]
dec a
ld bc, SCREEN_WIDTH
.add_n_minus_one_times
add hl, bc
dec a
jr nz, .add_n_minus_one_times
ret
AnimateEZChatCursor:
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
ld e, a
ld d, 0
ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
dw .zero
dw .one
dw .two
dw .three
dw .four
dw .five
dw .six
dw .seven
dw .eight
dw .nine
dw .ten
.zero
ld a, [wcd20] ; wcd20
sla a
ld hl, .Coords_Zero
ld e, $1
jr .load
.one
ld a, [wcd21]
sla a
ld hl, .Coords_One
ld e, $2
jr .load
.two
ld hl, .FramesetsIDs_Two
ld a, [wcd22]
ld e, a
ld d, $0
add hl, de
ld a, [hl]
call ReinitSpriteAnimFrame
ld a, [wcd22]
sla a
ld hl, .Coords_Two
ld e, $4
jr .load
.three
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_2
call ReinitSpriteAnimFrame
ld a, [wMobileCommsJumptableIndex]
sla a
ld hl, .Coords_Three
ld e, $8
.load
push de
ld e, a
ld d, $0
add hl, de
push hl
pop de
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
pop de
ld a, e
call .UpdateObjectFlags
ret
.four
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_2
call ReinitSpriteAnimFrame
ld a, [wcd2a]
sla a
ld hl, .Coords_Four
ld e, $10
jr .load
.five
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_2
call ReinitSpriteAnimFrame
ld a, [wcd2c]
sla a
ld hl, .Coords_Five
ld e, $20
jr .load
.six
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_5
call ReinitSpriteAnimFrame
; X = [wcd4a] * 8 + 24
ld a, [wcd4a]
sla a
sla a
sla a
add $18
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
; Y = 48
ld a, $30
ld [hl], a
ld a, $1
ld e, a
call .UpdateObjectFlags
ret
.seven
ld a, [wEZChatCursorYCoord]
cp $4
jr z, .cursor0
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3
jr .got_frameset
.cursor0
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_1
.got_frameset
call ReinitSpriteAnimFrame
ld a, [wEZChatCursorYCoord]
cp $4
jr z, .asm_11d1b1
; X = [wEZChatCursorXCoord] * 8 + 32
ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
add $20
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
; Y = [wEZChatCursorYCoord] * 16 + 72
ld a, [wEZChatCursorYCoord]
sla a
sla a
sla a
sla a
add $48
ld [hl], a
ld a, $2
ld e, a
call .UpdateObjectFlags
ret
.asm_11d1b1
; X = [wEZChatCursorXCoord] * 40 + 24
ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
ld e, a
sla a
sla a
add e
add $18
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
; Y = 138
ld a, $8a
ld [hl], a
ld a, $2
ld e, a
call .UpdateObjectFlags
ret
.nine
ld d, -13 * 8
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_7
jr .eight_nine_load
.eight
ld d, 2 * 8
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_6
.eight_nine_load
push de
call ReinitSpriteAnimFrame
ld a, [wcd4a]
sla a
sla a
sla a
ld e, a
sla a
add e
add 8 * 8
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hld], a
pop af
ld [hl], a
ld a, $4
ld e, a
call .UpdateObjectFlags
ret
.ten
ld a, SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_1
call ReinitSpriteAnimFrame
ld a, $8
ld e, a
call .UpdateObjectFlags
ret
.Coords_Zero:
dbpixel 1, 3, 5, 2
dbpixel 7, 3, 5, 2
dbpixel 13, 3, 5, 2
dbpixel 1, 5, 5, 2
dbpixel 7, 5, 5, 2
dbpixel 13, 5, 5, 2
dbpixel 1, 17, 5, 2
dbpixel 7, 17, 5, 2
dbpixel 13, 17, 5, 2
.Coords_One:
dbpixel 1, 8, 5, 2
dbpixel 7, 8, 5, 2
dbpixel 13, 8, 5, 2
dbpixel 1, 10, 5, 2
dbpixel 7, 10, 5, 2
dbpixel 13, 10, 5, 2
dbpixel 1, 12, 5, 2
dbpixel 7, 12, 5, 2
dbpixel 13, 12, 5, 2
dbpixel 1, 14, 5, 2
dbpixel 7, 14, 5, 2
dbpixel 13, 14, 5, 2
dbpixel 1, 16, 5, 2
dbpixel 7, 16, 5, 2
dbpixel 13, 16, 5, 2
dbpixel 1, 18, 5, 2
dbpixel 7, 18, 5, 2
dbpixel 13, 18, 5, 2
.Coords_Two:
dbpixel 2, 9 ; 00
dbpixel 3, 9 ; 01
dbpixel 4, 9 ; 02
dbpixel 5, 9 ; 03
dbpixel 6, 9 ; 04
dbpixel 2, 11 ; 05
dbpixel 3, 11 ; 06
dbpixel 4, 11 ; 07
dbpixel 5, 11 ; 08
dbpixel 6, 11 ; 09
dbpixel 2, 13 ; 0a
dbpixel 3, 13 ; 0b
dbpixel 4, 13 ; 0c
dbpixel 5, 13 ; 0d
dbpixel 6, 13 ; 0e
dbpixel 2, 15 ; 0f
dbpixel 3, 15 ; 10
dbpixel 4, 15 ; 11
dbpixel 5, 15 ; 12
dbpixel 6, 15 ; 13
dbpixel 8, 9 ; 14
dbpixel 9, 9 ; 15
dbpixel 10, 9 ; 16
dbpixel 11, 9 ; 17
dbpixel 12, 9 ; 18
dbpixel 8, 11 ; 19
dbpixel 9, 11 ; 1a
dbpixel 10, 11 ; 1b
dbpixel 11, 11 ; 1c
dbpixel 12, 11 ; 1d
dbpixel 8, 13 ; 1e
dbpixel 9, 13 ; 1f
dbpixel 10, 13 ; 20
dbpixel 11, 13 ; 21
dbpixel 12, 13 ; 22
dbpixel 14, 9 ; 23
dbpixel 16, 9 ; 24
dbpixel 18, 9 ; 25
dbpixel 8, 15 ; 26
dbpixel 9, 15 ; 27
dbpixel 10, 15 ; 28
dbpixel 11, 15 ; 29
dbpixel 12, 15 ; 2a
dbpixel 14, 11 ; 2b
dbpixel 14, 13 ; 2c
dbpixel 1, 18, 5, 2 ; 2d
dbpixel 7, 18, 5, 2 ; 2e
dbpixel 13, 18, 5, 2 ; 2f
.Coords_Three:
dbpixel 2, 10
dbpixel 8, 10
dbpixel 14, 10
dbpixel 2, 12
dbpixel 8, 12
dbpixel 14, 12
dbpixel 2, 14
dbpixel 8, 14
dbpixel 14, 14
dbpixel 2, 16
dbpixel 8, 16
dbpixel 14, 16
.Coords_Four:
dbpixel 16, 10
dbpixel 16, 12
.Coords_Five:
dbpixel 4, 10
dbpixel 4, 12
.FramesetsIDs_Two:
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 00
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 01
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 02
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 03
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 04
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 05
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 06
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 07
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 08
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 09
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0a
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0b
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0c
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0d
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0e
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 0f
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 10
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 11
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 12
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 13
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 14
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 15
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 16
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 17
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 18
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 19
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1a
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1b
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1c
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1d
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1e
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 1f
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 20
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 21
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 22
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 23
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 24
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 25
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 26
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 27
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 28
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 29
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 2a
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_3 ; 2b
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_4 ; 2c
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_1 ; 2d
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_1 ; 2e
db SPRITE_ANIM_FRAMESET_EZCHAT_CURSOR_1 ; 2f
.UpdateObjectFlags:
ld hl, wcd24
and [hl]
jr nz, .update_y_offset
ld a, e
ld hl, wcd23
and [hl]
jr z, .reset_y_offset
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
ld a, [hl]
and a
jr z, .flip_bit_0
dec [hl]
ret
.flip_bit_0
ld a, $0
ld [hld], a
ld a, $1
xor [hl]
ld [hl], a
and a
jr nz, .update_y_offset
.reset_y_offset
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
xor a
ld [hl], a
ret
.update_y_offset
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, $b0
sub [hl]
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
ret
Function11d323:
ldh a, [rSVBK]
push af
ld a, $5
ldh [rSVBK], a
ld hl, Palette_11d33a
ld de, wBGPals1
ld bc, 16 palettes
call CopyBytes
pop af
ldh [rSVBK], a
ret
Palette_11d33a:
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 16, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 23, 17, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
EZChat_GetSeenPokemonByKana:
ldh a, [rSVBK]
push af
ld hl, $c648
ld a, LOW(w5_d800)
ld [wcd2d], a
ld [hli], a
ld a, HIGH(w5_d800)
ld [wcd2e], a
ld [hl], a
ld a, LOW(EZChat_SortedPokemon)
ld [wcd2f], a
ld a, HIGH(EZChat_SortedPokemon)
ld [wcd30], a
ld a, LOW($c6a8)
ld [wcd31], a
ld a, HIGH($c6a8)
ld [wcd32], a
ld a, LOW($c64a)
ld [wcd33], a
ld a, HIGH($c64a)
ld [wcd34], a
ld hl, EZChat_SortedWords
ld a, (EZChat_SortedWords.End - EZChat_SortedWords) / 4
.MasterLoop:
push af
; read row
; offset
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
; size
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
; save the pointer to the next row
push hl
; add de to w3_d000
ld hl, w3_d000
add hl, de
; recover de from wcd2d (default: w5_d800)
ld a, [wcd2d]
ld e, a
ld a, [wcd2e]
ld d, a
; save bc for later
push bc
.loop1
; copy 2*bc bytes from 3:hl to 5:de
ld a, $3
ldh [rSVBK], a
ld a, [hli]
push af
ld a, $5
ldh [rSVBK], a
pop af
ld [de], a
inc de
ld a, $3
ldh [rSVBK], a
ld a, [hli]
push af
ld a, $5
ldh [rSVBK], a
pop af
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .loop1
; recover the pointer from wcd2f (default: EZChat_SortedPokemon)
ld a, [wcd2f]
ld l, a
ld a, [wcd30]
ld h, a
; copy the pointer from [hl] to bc
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
; store the pointer to the next pointer back in wcd2f
ld a, l
ld [wcd2f], a
ld a, h
ld [wcd30], a
; push pop that pointer to hl
push bc
pop hl
ld c, $0
.loop2
; Have you seen this Pokemon?
ld a, [hl]
cp $ff
jr z, .done
call .CheckSeenMon
jr nz, .next
; If not, skip it.
inc hl
jr .loop2
.next
; If so, append it to the list at 5:de, and increase the count.
ld a, [hli]
ld [de], a
inc de
xor a
ld [de], a
inc de
inc c
jr .loop2
.done
; Remember the original value of bc from the table?
; Well, the stack remembers it, and it's popping it to hl.
pop hl
; Add the number of seen Pokemon from the list.
ld b, $0
add hl, bc
; Push pop to bc.
push hl
pop bc
; Load the pointer from [wcd31] (default: $c6a8)
ld a, [wcd31]
ld l, a
ld a, [wcd32]
ld h, a
; Save the quantity from bc to [hl]
ld a, c
ld [hli], a
ld a, b
ld [hli], a
; Save the new value of hl to [wcd31]
ld a, l
ld [wcd31], a
ld a, h
ld [wcd32], a
; Recover the pointer from [wcd33] (default: $c64a)
ld a, [wcd33]
ld l, a
ld a, [wcd34]
ld h, a
; Save the current value of de there
ld a, e
ld [wcd2d], a
ld [hli], a
ld a, d
ld [wcd2e], a
; Save the new value of hl back to [wcd33]
ld [hli], a
ld a, l
ld [wcd33], a
ld a, h
ld [wcd34], a
; Next row
pop hl
pop af
dec a
jr z, .ExitMasterLoop
jp .MasterLoop
.ExitMasterLoop:
pop af
ldh [rSVBK], a
ret
.CheckSeenMon:
push hl
push bc
push de
dec a
ld hl, rSVBK
ld e, $1
ld [hl], e
call CheckSeenMon
ld hl, rSVBK
ld e, $5
ld [hl], e
pop de
pop bc
pop hl
ret
EZChat_GetCategoryWordsByKana:
ldh a, [rSVBK]
push af
ld a, $3
ldh [rSVBK], a
; load pointers
ld hl, MobileEZChatCategoryPointers
ld bc, MobileEZChatData_WordAndPageCounts
; init WRAM registers
xor a
ld [wcd2d], a
inc a
ld [wcd2e], a
; enter the first loop
ld a, 14
.loop1
push af
; load the pointer to the category
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
; skip to the attributes
ld hl, NAME_LENGTH_JAPANESE - 1
add hl, de
; get the number of words in the category
ld a, [bc] ; number of entries to copy
inc bc
inc bc
push bc
.loop2
push af
push hl
; load offset at [hl]
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
; add to w3_d000
ld hl, w3_d000
add hl, de
; copy from wcd2d and increment [wcd2d] in place
ld a, [wcd2d]
ld [hli], a
inc a
ld [wcd2d], a
; copy from wcd2e
ld a, [wcd2e]
ld [hl], a
; next entry
pop hl
ld de, 8
add hl, de
pop af
dec a
jr nz, .loop2
; reset and go to next category
ld hl, wcd2d
xor a
ld [hli], a
inc [hl]
pop bc
pop hl
pop af
dec a
jr nz, .loop1
pop af
ldh [rSVBK], a
ret
INCLUDE "data/pokemon/ezchat_order.asm"
GFX_11d67e:
INCBIN "gfx/pokedex/select_start.2bpp"
LZ_11d6de:
INCBIN "gfx/pokedex/slowpoke.2bpp.lz"
MobileEZChatCategoryNames:
; Fixed message categories
db "ポケモン@@" ; 00
db "タイプ@@@" ; 01
db "あいさつ@@" ; 02
db "ひと@@@@" ; 03
db "バトル@@@" ; 04
db "こえ@@@@" ; 05
db "かいわ@@@" ; 06
db "きもち@@@" ; 07
db "じょうたい@" ; 08
db "せいかつ@@" ; 09
db "しゅみ@@@" ; 0a
db "こうどう@@" ; 0b
db "じかん@@@" ; 0c
db "むすび@@@" ; 0d
db "あれこれ@@" ; 0e
MobileEZChatCategoryPointers:
; entries correspond to EZCHAT_* constants
dw .Types ; 01
dw .Greetings ; 02
dw .People ; 03
dw .Battle ; 04
dw .Exclamations ; 05
dw .Conversation ; 06
dw .Feelings ; 07
dw .Conditions ; 08
dw .Life ; 09
dw .Hobbies ; 0a
dw .Actions ; 0b
dw .Time ; 0c
dw .Farewells ; 0d
dw .ThisAndThat ; 0e
.Types:
db "あく@@@", $26, $0, $0
db "いわ@@@", $aa, $0, $0
db "エスパー@", $da, $0, $0
db "かくとう@", $4e, $1, $0
db "くさ@@@", $ba, $1, $0
db "ゴースト@", $e4, $1, $0
db "こおり@@", $e6, $1, $0
db "じめん@@", $68, $2, $0
db "タイプ@@", $e8, $2, $0
db "でんき@@", $8e, $3, $0
db "どく@@@", $ae, $3, $0
db "ドラゴン@", $bc, $3, $0
db "ノーマル@", $22, $4, $0
db "はがね@@", $36, $4, $0
db "ひこう@@", $5e, $4, $0
db "ほのお@@", $b2, $4, $0
db "みず@@@", $f4, $4, $0
db "むし@@@", $12, $5, $0
.Greetings:
db "ありがと@", $58, $0, $0
db "ありがとう", $5a, $0, $0
db "いくぜ!@", $80, $0, $0
db "いくよ!@", $82, $0, $0
db "いくわよ!", $84, $0, $0
db "いやー@@", $a6, $0, $0
db "おっす@@", $a, $1, $0
db "おはつです", $22, $1, $0
db "おめでとう", $2a, $1, $0
db "ごめん@@", $f8, $1, $0
db "ごめんよ@", $fa, $1, $0
db "こらっ@@", $fc, $1, $0
db "こんちは!", $a, $2, $0
db "こんにちは", $10, $2, $0
db "さようなら", $28, $2, $0
db "サンキュー", $2e, $2, $0
db "さんじょう", $30, $2, $0
db "しっけい@", $48, $2, $0
db "しつれい@", $4c, $2, $0
db "じゃーね@", $6c, $2, $0
db "すいません", $8c, $2, $0
db "それじゃ@", $ca, $2, $0
db "どうも@@", $a6, $3, $0
db "なんじゃ@", $ee, $3, $0
db "ハーイ@@", $2c, $4, $0
db "はいはい@", $32, $4, $0
db "バイバイ@", $34, $4, $0
db "へイ@@@", $8a, $4, $0
db "またね@@", $de, $4, $0
db "もしもし@", $32, $5, $0
db "やあ@@@", $3e, $5, $0
db "やっほー@", $4e, $5, $0
db "よう@@@", $62, $5, $0
db "ようこそ@", $64, $5, $0
db "よろしく@", $80, $5, $0
db "らっしゃい", $94, $5, $0
.People:
db "あいて@@", $1c, $0, $0
db "あたし@@", $36, $0, $0
db "あなた@@", $40, $0, $0
db "あなたが@", $42, $0, $0
db "あなたに@", $44, $0, $0
db "あなたの@", $46, $0, $0
db "あなたは@", $48, $0, $0
db "あなたを@", $4a, $0, $0
db "おかあさん", $e8, $0, $0
db "おじいさん", $fc, $0, $0
db "おじさん@", $2, $1, $0
db "おとうさん", $e, $1, $0
db "おとこのこ", $10, $1, $0
db "おとな@@", $14, $1, $0
db "おにいさん", $16, $1, $0
db "おねえさん", $18, $1, $0
db "おばあさん", $1c, $1, $0
db "おばさん@", $20, $1, $0
db "おれさま@", $34, $1, $0
db "おんなのこ", $3a, $1, $0
db "ガール@@", $40, $1, $0
db "かぞく@@", $52, $1, $0
db "かのじょ@", $72, $1, $0
db "かれ@@@", $7c, $1, $0
db "きみ@@@", $9a, $1, $0
db "きみが@@", $9c, $1, $0
db "きみに@@", $9e, $1, $0
db "きみの@@", $a0, $1, $0
db "きみは@@", $a2, $1, $0
db "きみを@@", $a4, $1, $0
db "ギャル@@", $ae, $1, $0
db "きょうだい", $b2, $1, $0
db "こども@@", $f0, $1, $0
db "じぶん@@", $54, $2, $0
db "じぶんが@", $56, $2, $0
db "じぶんに@", $58, $2, $0
db "じぶんの@", $5a, $2, $0
db "じぶんは@", $5c, $2, $0
db "じぶんを@", $5e, $2, $0
db "だれ@@@", $18, $3, $0
db "だれか@@", $1a, $3, $0
db "だれが@@", $1c, $3, $0
db "だれに@@", $1e, $3, $0
db "だれの@@", $20, $3, $0
db "だれも@@", $22, $3, $0
db "だれを@@", $24, $3, $0
db "ちゃん@@", $38, $3, $0
db "ともだち@", $b8, $3, $0
db "なかま@@", $d4, $3, $0
db "ひと@@@", $62, $4, $0
db "ボーイ@@", $98, $4, $0
db "ボク@@@", $a0, $4, $0
db "ボクが@@", $a2, $4, $0
db "ボクに@@", $a4, $4, $0
db "ボクの@@", $a6, $4, $0
db "ボクは@@", $a8, $4, $0
db "ボクを@@", $aa, $4, $0
db "みんな@@", $4, $5, $0
db "みんなが@", $6, $5, $0
db "みんなに@", $8, $5, $0
db "みんなの@", $a, $5, $0
db "みんなは@", $c, $5, $0
db "ライバル@", $8a, $5, $0
db "わたし@@", $c2, $5, $0
db "わたしが@", $c4, $5, $0
db "わたしに@", $c6, $5, $0
db "わたしの@", $c8, $5, $0
db "わたしは@", $ca, $5, $0
db "わたしを@", $cc, $5, $0
.Battle:
db "あいしょう", $18, $0, $0
db "いけ!@@", $88, $0, $0
db "いちばん@", $96, $0, $0
db "かくご@@", $4c, $1, $0
db "かたせて@", $54, $1, $0
db "かち@@@", $56, $1, $0
db "かつ@@@", $58, $1, $0
db "かった@@", $60, $1, $0
db "かったら@", $62, $1, $0
db "かって@@", $64, $1, $0
db "かてない@", $66, $1, $0
db "かてる@@", $68, $1, $0
db "かなわない", $70, $1, $0
db "きあい@@", $84, $1, $0
db "きめた@@", $a8, $1, $0
db "きりふだ@", $b6, $1, $0
db "くらえ@@", $c2, $1, $0
db "こい!@@", $da, $1, $0
db "こうげき@", $e0, $1, $0
db "こうさん@", $e2, $1, $0
db "こんじょう", $8, $2, $0
db "さいのう@", $16, $2, $0
db "さくせん@", $1a, $2, $0
db "さばき@@", $22, $2, $0
db "しょうぶ@", $7e, $2, $0
db "しょうり@", $80, $2, $0
db "せめ@@@", $b4, $2, $0
db "センス@@", $b6, $2, $0
db "たいせん@", $e6, $2, $0
db "たたかい@", $f6, $2, $0
db "ちから@@", $32, $3, $0
db "チャレンジ", $36, $3, $0
db "つよい@@", $58, $3, $0
db "つよすぎ@", $5a, $3, $0
db "つらい@@", $5c, $3, $0
db "つらかった", $5e, $3, $0
db "てかげん@", $6c, $3, $0
db "てき@@@", $6e, $3, $0
db "てんさい@", $90, $3, $0
db "でんせつ@", $94, $3, $0
db "トレーナー", $c6, $3, $0
db "にげ@@@", $4, $4, $0
db "ぬるい@@", $10, $4, $0
db "ねらう@@", $16, $4, $0
db "バトル@@", $4a, $4, $0
db "ファイト@", $72, $4, $0
db "ふっかつ@", $78, $4, $0
db "ポイント@", $94, $4, $0
db "ポケモン@", $ac, $4, $0
db "ほんき@@", $bc, $4, $0
db "まいった!", $c4, $4, $0
db "まけ@@@", $c8, $4, $0
db "まけたら@", $ca, $4, $0
db "まけて@@", $cc, $4, $0
db "まける@@", $ce, $4, $0
db "まもり@@", $ea, $4, $0
db "みかた@@", $f2, $4, $0
db "みとめない", $fe, $4, $0
db "みとめる@", $0, $5, $0
db "むてき@@", $16, $5, $0
db "もらった!", $3c, $5, $0
db "よゆう@@", $7a, $5, $0
db "よわい@@", $82, $5, $0
db "よわすぎ@", $84, $5, $0
db "らくしょう", $8e, $5, $0
db "りーダー@", $9e, $5, $0
db "ルール@@", $a0, $5, $0
db "レべル@@", $a6, $5, $0
db "わざ@@@", $be, $5, $0
.Exclamations:
db "!@@@@", $0, $0, $0
db "!!@@@", $2, $0, $0
db "!?@@@", $4, $0, $0
db "?@@@@", $6, $0, $0
db "⋯@@@@", $8, $0, $0
db "⋯!@@@", $a, $0, $0
db "⋯⋯⋯@@", $c, $0, $0
db "ー@@@@", $e, $0, $0
db "ーーー@@", $10, $0, $0
db "あーあ@@", $14, $0, $0
db "あーん@@", $16, $0, $0
db "あははー@", $52, $0, $0
db "あら@@@", $54, $0, $0
db "いえ@@@", $72, $0, $0
db "イエス@@", $74, $0, $0
db "うう@@@", $ac, $0, $0
db "うーん@@", $ae, $0, $0
db "うおー!@", $b0, $0, $0
db "うおりゃー", $b2, $0, $0
db "うひょー@", $bc, $0, $0
db "うふふ@@", $be, $0, $0
db "うわー@@", $ca, $0, $0
db "うわーん@", $cc, $0, $0
db "ええ@@@", $d2, $0, $0
db "えー@@@", $d4, $0, $0
db "えーん@@", $d6, $0, $0
db "えへへ@@", $dc, $0, $0
db "おいおい@", $e0, $0, $0
db "おお@@@", $e2, $0, $0
db "おっと@@", $c, $1, $0
db "がーん@@", $42, $1, $0
db "キャー@@", $aa, $1, $0
db "ギャー@@", $ac, $1, $0
db "ぐふふふふ", $bc, $1, $0
db "げっ@@@", $ce, $1, $0
db "しくしく@", $3e, $2, $0
db "ちえっ@@", $2e, $3, $0
db "てへ@@@", $86, $3, $0
db "ノー@@@", $20, $4, $0
db "はあー@@", $2a, $4, $0
db "はい@@@", $30, $4, $0
db "はっはっは", $48, $4, $0
db "ひいー@@", $56, $4, $0
db "ひゃあ@@", $6a, $4, $0
db "ふっふっふ", $7c, $4, $0
db "ふにゃ@@", $7e, $4, $0
db "ププ@@@", $80, $4, $0
db "ふふん@@", $82, $4, $0
db "ふん@@@", $88, $4, $0
db "へっへっへ", $8e, $4, $0
db "へへー@@", $90, $4, $0
db "ほーほほほ", $9c, $4, $0
db "ほら@@@", $b6, $4, $0
db "まあ@@@", $c0, $4, $0
db "むきー!!", $10, $5, $0
db "むふー@@", $18, $5, $0
db "むふふ@@", $1a, $5, $0
db "むむ@@@", $1c, $5, $0
db "よーし@@", $6a, $5, $0
db "よし!@@", $72, $5, $0
db "ラララ@@", $98, $5, $0
db "わーい@@", $ac, $5, $0
db "わーん!!", $b0, $5, $0
db "ワオ@@@", $b2, $5, $0
db "わっ!!@", $ce, $5, $0
db "わははは!", $d0, $5, $0
.Conversation:
db "あのね@@", $50, $0, $0
db "あんまり@", $6e, $0, $0
db "いじわる@", $8e, $0, $0
db "うそ@@@", $b6, $0, $0
db "うむ@@@", $c4, $0, $0
db "おーい@@", $e4, $0, $0
db "おすすめ@", $6, $1, $0
db "おばかさん", $1e, $1, $0
db "かなり@@", $6e, $1, $0
db "から@@@", $7a, $1, $0
db "きぶん@@", $98, $1, $0
db "けど@@@", $d6, $1, $0
db "こそ@@@", $ea, $1, $0
db "こと@@@", $ee, $1, $0
db "さあ@@@", $12, $2, $0
db "さっぱり@", $1e, $2, $0
db "さて@@@", $20, $2, $0
db "じゅうぶん", $72, $2, $0
db "すぐ@@@", $94, $2, $0
db "すごく@@", $98, $2, $0
db "すこしは@", $9a, $2, $0
db "すっっごい", $a0, $2, $0
db "ぜーんぜん", $b0, $2, $0
db "ぜったい@", $b2, $2, $0
db "それで@@", $ce, $2, $0
db "だけ@@@", $f2, $2, $0
db "だって@@", $fc, $2, $0
db "たぶん@@", $6, $3, $0
db "たら@@@", $14, $3, $0
db "ちょー@@", $3a, $3, $0
db "ちょっと@", $3c, $3, $0
db "ったら@@", $4e, $3, $0
db "って@@@", $50, $3, $0
db "ていうか@", $62, $3, $0
db "でも@@@", $88, $3, $0
db "どうしても", $9c, $3, $0
db "とうぜん@", $a0, $3, $0
db "どうぞ@@", $a2, $3, $0
db "とりあえず", $be, $3, $0
db "なあ@@@", $cc, $3, $0
db "なんて@@", $f4, $3, $0
db "なんでも@", $fc, $3, $0
db "なんとか@", $fe, $3, $0
db "には@@@", $8, $4, $0
db "バッチり@", $46, $4, $0
db "ばりばり@", $52, $4, $0
db "ほど@@@", $b0, $4, $0
db "ほんと@@", $be, $4, $0
db "まさに@@", $d0, $4, $0
db "マジ@@@", $d2, $4, $0
db "マジで@@", $d4, $4, $0
db "まったく@", $e4, $4, $0
db "まで@@@", $e6, $4, $0
db "まるで@@", $ec, $4, $0
db "ムード@@", $e, $5, $0
db "むしろ@@", $14, $5, $0
db "めちゃ@@", $24, $5, $0
db "めっぽう@", $28, $5, $0
db "もう@@@", $2c, $5, $0
db "モード@@", $2e, $5, $0
db "もっと@@", $36, $5, $0
db "もはや@@", $38, $5, $0
db "やっと@@", $4a, $5, $0
db "やっぱり@", $4c, $5, $0
db "より@@@", $7c, $5, $0
db "れば@@@", $a4, $5, $0
.Feelings:
db "あいたい@", $1a, $0, $0
db "あそびたい", $32, $0, $0
db "いきたい@", $7c, $0, $0
db "うかれて@", $b4, $0, $0
db "うれしい@", $c6, $0, $0
db "うれしさ@", $c8, $0, $0
db "エキサイト", $d8, $0, $0
db "えらい@@", $de, $0, $0
db "おかしい@", $ec, $0, $0
db "オッケー@", $8, $1, $0
db "かえりたい", $48, $1, $0
db "がっくし@", $5a, $1, $0
db "かなしい@", $6c, $1, $0
db "がんばって", $80, $1, $0
db "きがしない", $86, $1, $0
db "きがする@", $88, $1, $0
db "ききたい@", $8a, $1, $0
db "きになる@", $90, $1, $0
db "きのせい@", $96, $1, $0
db "きらい@@", $b4, $1, $0
db "くやしい@", $be, $1, $0
db "くやしさ@", $c0, $1, $0
db "さみしい@", $24, $2, $0
db "ざんねん@", $32, $2, $0
db "しあわせ@", $36, $2, $0
db "したい@@", $44, $2, $0
db "したくない", $46, $2, $0
db "しまった@", $64, $2, $0
db "しょんぼり", $82, $2, $0
db "すき@@@", $92, $2, $0
db "だいきらい", $da, $2, $0
db "たいくつ@", $dc, $2, $0
db "だいじ@@", $de, $2, $0
db "だいすき@", $e4, $2, $0
db "たいへん@", $ea, $2, $0
db "たのしい@", $0, $3, $0
db "たのしすぎ", $2, $3, $0
db "たべたい@", $8, $3, $0
db "ダメダメ@", $e, $3, $0
db "たりない@", $16, $3, $0
db "ちくしょー", $34, $3, $0
db "どうしよう", $9e, $3, $0
db "ドキドキ@", $ac, $3, $0
db "ナイス@@", $d0, $3, $0
db "のみたい@", $26, $4, $0
db "びっくり@", $60, $4, $0
db "ふあん@@", $74, $4, $0
db "ふらふら@", $86, $4, $0
db "ほしい@@", $ae, $4, $0
db "ボロボロ@", $b8, $4, $0
db "まだまだ@", $e0, $4, $0
db "まてない@", $e8, $4, $0
db "まんぞく@", $f0, $4, $0
db "みたい@@", $f8, $4, $0
db "めずらしい", $22, $5, $0
db "メラメラ@", $2a, $5, $0
db "やだ@@@", $46, $5, $0
db "やったー@", $48, $5, $0
db "やばい@@", $50, $5, $0
db "やばすぎる", $52, $5, $0
db "やられた@", $54, $5, $0
db "やられて@", $56, $5, $0
db "よかった@", $6e, $5, $0
db "ラブラブ@", $96, $5, $0
db "ロマン@@", $a8, $5, $0
db "ろんがい@", $aa, $5, $0
db "わから@@", $b4, $5, $0
db "わかり@@", $b6, $5, $0
db "わくわく@", $ba, $5, $0
.Conditions:
db "あつい@@", $38, $0, $0
db "あった@@", $3a, $0, $0
db "あり@@@", $56, $0, $0
db "ある@@@", $5e, $0, $0
db "あわてて@", $6a, $0, $0
db "いい@@@", $70, $0, $0
db "いか@@@", $76, $0, $0
db "イカス@@", $78, $0, $0
db "いきおい@", $7a, $0, $0
db "いける@@", $8a, $0, $0
db "いじょう@", $8c, $0, $0
db "いそがしい", $90, $0, $0
db "いっしょに", $9a, $0, $0
db "いっぱい@", $9c, $0, $0
db "いない@@", $a0, $0, $0
db "いや@@@", $a4, $0, $0
db "いる@@@", $a8, $0, $0
db "うまい@@", $c0, $0, $0
db "うまく@@", $c2, $0, $0
db "おおきい@", $e6, $0, $0
db "おくれ@@", $f2, $0, $0
db "おしい@@", $fa, $0, $0
db "おもしろい", $2c, $1, $0
db "おもしろく", $2e, $1, $0
db "かっこいい", $5c, $1, $0
db "かわいい@", $7e, $1, $0
db "かんぺき@", $82, $1, $0
db "けっこう@", $d0, $1, $0
db "げんき@@", $d8, $1, $0
db "こわい@@", $6, $2, $0
db "さいこう@", $14, $2, $0
db "さむい@@", $26, $2, $0
db "さわやか@", $2c, $2, $0
db "しかたない", $38, $2, $0
db "すごい@@", $96, $2, $0
db "すごすぎ@", $9c, $2, $0
db "すてき@@", $a4, $2, $0
db "たいした@", $e0, $2, $0
db "だいじょぶ", $e2, $2, $0
db "たかい@@", $ec, $2, $0
db "ただしい@", $f8, $2, $0
db "だめ@@@", $c, $3, $0
db "ちいさい@", $2c, $3, $0
db "ちがう@@", $30, $3, $0
db "つかれ@@", $48, $3, $0
db "とくい@@", $b0, $3, $0
db "とまらない", $b6, $3, $0
db "ない@@@", $ce, $3, $0
db "なかった@", $d2, $3, $0
db "なし@@@", $d8, $3, $0
db "なって@@", $dc, $3, $0
db "はやい@@", $50, $4, $0
db "ひかる@@", $5a, $4, $0
db "ひくい@@", $5c, $4, $0
db "ひどい@@", $64, $4, $0
db "ひとりで@", $66, $4, $0
db "ひま@@@", $68, $4, $0
db "ふそく@@", $76, $4, $0
db "へた@@@", $8c, $4, $0
db "まちがって", $e2, $4, $0
db "やさしい@", $42, $5, $0
db "よく@@@", $70, $5, $0
db "よわって@", $86, $5, $0
db "らく@@@", $8c, $5, $0
db "らしい@@", $90, $5, $0
db "わるい@@", $d4, $5, $0
.Life:
db "アルバイト", $64, $0, $0
db "うち@@@", $ba, $0, $0
db "おかね@@", $ee, $0, $0
db "おこづかい", $f4, $0, $0
db "おふろ@@", $24, $1, $0
db "がっこう@", $5e, $1, $0
db "きねん@@", $92, $1, $0
db "グループ@", $c6, $1, $0
db "ゲット@@", $d2, $1, $0
db "こうかん@", $de, $1, $0
db "しごと@@", $40, $2, $0
db "しゅぎょう", $74, $2, $0
db "じゅぎょう", $76, $2, $0
db "じゅく@@", $78, $2, $0
db "しんか@@", $88, $2, $0
db "ずかん@@", $90, $2, $0
db "せいかつ@", $ae, $2, $0
db "せんせい@", $b8, $2, $0
db "センター@", $ba, $2, $0
db "タワー@@", $28, $3, $0
db "つうしん@", $40, $3, $0
db "テスト@@", $7e, $3, $0
db "テレビ@@", $8c, $3, $0
db "でんわ@@", $96, $3, $0
db "どうぐ@@", $9a, $3, $0
db "トレード@", $c4, $3, $0
db "なまえ@@", $e8, $3, $0
db "ニュース@", $a, $4, $0
db "にんき@@", $c, $4, $0
db "パーティー", $2e, $4, $0
db "べんきょう", $92, $4, $0
db "マシン@@", $d6, $4, $0
db "めいし@@", $1e, $5, $0
db "メッセージ", $26, $5, $0
db "もようがえ", $3a, $5, $0
db "ゆめ@@@", $5a, $5, $0
db "ようちえん", $66, $5, $0
db "ラジオ@@", $92, $5, $0
db "ワールド@", $ae, $5, $0
.Hobbies:
db "アイドル@", $1e, $0, $0
db "アニメ@@", $4c, $0, $0
db "うた@@@", $b8, $0, $0
db "えいが@@", $d0, $0, $0
db "おかし@@", $ea, $0, $0
db "おしゃべり", $4, $1, $0
db "おままごと", $28, $1, $0
db "おもちゃ@", $30, $1, $0
db "おんがく@", $38, $1, $0
db "カード@@", $3e, $1, $0
db "かいもの@", $46, $1, $0
db "グルメ@@", $c8, $1, $0
db "ゲーム@@", $cc, $1, $0
db "ざっし@@", $1c, $2, $0
db "さんぽ@@", $34, $2, $0
db "じてんしゃ", $50, $2, $0
db "しゅみ@@", $7a, $2, $0
db "スポーツ@", $a8, $2, $0
db "ダイエット", $d8, $2, $0
db "たからもの", $f0, $2, $0
db "たび@@@", $4, $3, $0
db "ダンス@@", $2a, $3, $0
db "つり@@@", $60, $3, $0
db "デート@@", $6a, $3, $0
db "でんしゃ@", $92, $3, $0
db "ぬいぐるみ", $e, $4, $0
db "パソコン@", $3e, $4, $0
db "はな@@@", $4c, $4, $0
db "ヒーロー@", $58, $4, $0
db "ひるね@@", $6e, $4, $0
db "ヒロイン@", $70, $4, $0
db "ぼうけん@", $96, $4, $0
db "ボード@@", $9a, $4, $0
db "ボール@@", $9e, $4, $0
db "ほん@@@", $ba, $4, $0
db "マンガ@@", $ee, $4, $0
db "やくそく@", $40, $5, $0
db "やすみ@@", $44, $5, $0
db "よてい@@", $74, $5, $0
.Actions:
db "あう@@@", $20, $0, $0
db "あきらめ@", $24, $0, $0
db "あげる@@", $28, $0, $0
db "あせる@@", $2e, $0, $0
db "あそび@@", $30, $0, $0
db "あそぶ@@", $34, $0, $0
db "あつめ@@", $3e, $0, $0
db "あるき@@", $60, $0, $0
db "あるく@@", $62, $0, $0
db "いく@@@", $7e, $0, $0
db "いけ@@@", $86, $0, $0
db "おき@@@", $f0, $0, $0
db "おこり@@", $f6, $0, $0
db "おこる@@", $f8, $0, $0
db "おしえ@@", $fe, $0, $0
db "おしえて@", $0, $1, $0
db "おねがい@", $1a, $1, $0
db "おぼえ@@", $26, $1, $0
db "かえる@@", $4a, $1, $0
db "がまん@@", $74, $1, $0
db "きく@@@", $8c, $1, $0
db "きたえ@@", $8e, $1, $0
db "きめ@@@", $a6, $1, $0
db "くる@@@", $c4, $1, $0
db "さがし@@", $18, $2, $0
db "さわぎ@@", $2a, $2, $0
db "した@@@", $42, $2, $0
db "しって@@", $4a, $2, $0
db "して@@@", $4e, $2, $0
db "しない@@", $52, $2, $0
db "しまう@@", $60, $2, $0
db "じまん@@", $66, $2, $0
db "しらない@", $84, $2, $0
db "しる@@@", $86, $2, $0
db "しんじて@", $8a, $2, $0
db "する@@@", $aa, $2, $0
db "たべる@@", $a, $3, $0
db "つかう@@", $42, $3, $0
db "つかえ@@", $44, $3, $0
db "つかって@", $46, $3, $0
db "できない@", $70, $3, $0
db "できる@@", $72, $3, $0
db "でない@@", $84, $3, $0
db "でる@@@", $8a, $3, $0
db "なげる@@", $d6, $3, $0
db "なやみ@@", $ea, $3, $0
db "ねられ@@", $18, $4, $0
db "ねる@@@", $1a, $4, $0
db "のがし@@", $24, $4, $0
db "のむ@@@", $28, $4, $0
db "はしり@@", $3a, $4, $0
db "はしる@@", $3c, $4, $0
db "はたらき@", $40, $4, $0
db "はたらく@", $42, $4, $0
db "はまって@", $4e, $4, $0
db "ぶつけ@@", $7a, $4, $0
db "ほめ@@@", $b4, $4, $0
db "みせて@@", $f6, $4, $0
db "みて@@@", $fc, $4, $0
db "みる@@@", $2, $5, $0
db "めざす@@", $20, $5, $0
db "もって@@", $34, $5, $0
db "ゆずる@@", $58, $5, $0
db "ゆるす@@", $5c, $5, $0
db "ゆるせ@@", $5e, $5, $0
db "られない@", $9a, $5, $0
db "られる@@", $9c, $5, $0
db "わかる@@", $b8, $5, $0
db "わすれ@@", $c0, $5, $0
.Time:
db "あき@@@", $22, $0, $0
db "あさ@@@", $2a, $0, $0
db "あした@@", $2c, $0, $0
db "いちにち@", $94, $0, $0
db "いつか@@", $98, $0, $0
db "いつも@@", $9e, $0, $0
db "いま@@@", $a2, $0, $0
db "えいえん@", $ce, $0, $0
db "おととい@", $12, $1, $0
db "おわり@@", $36, $1, $0
db "かようび@", $78, $1, $0
db "きのう@@", $94, $1, $0
db "きょう@@", $b0, $1, $0
db "きんようび", $b8, $1, $0
db "げつようび", $d4, $1, $0
db "このあと@", $f4, $1, $0
db "このまえ@", $f6, $1, $0
db "こんど@@", $c, $2, $0
db "じかん@@", $3c, $2, $0
db "じゅうねん", $70, $2, $0
db "すいようび", $8e, $2, $0
db "スタート@", $9e, $2, $0
db "ずっと@@", $a2, $2, $0
db "ストップ@", $a6, $2, $0
db "そのうち@", $c4, $2, $0
db "ついに@@", $3e, $3, $0
db "つぎ@@@", $4a, $3, $0
db "どようび@", $ba, $3, $0
db "なつ@@@", $da, $3, $0
db "にちようび", $6, $4, $0
db "はじめ@@", $38, $4, $0
db "はる@@@", $54, $4, $0
db "ひる@@@", $6c, $4, $0
db "ふゆ@@@", $84, $4, $0
db "まいにち@", $c6, $4, $0
db "もくようび", $30, $5, $0
db "よなか@@", $76, $5, $0
db "よる@@@", $7e, $5, $0
db "らいしゅう", $88, $5, $0
.Farewells:
db "いたします", $92, $0, $0
db "おります@", $32, $1, $0
db "か!?@@", $3c, $1, $0
db "かい?@@", $44, $1, $0
db "かしら?@", $50, $1, $0
db "かな?@@", $6a, $1, $0
db "かも@@@", $76, $1, $0
db "くれ@@@", $ca, $1, $0
db "ございます", $e8, $1, $0
db "しがち@@", $3a, $2, $0
db "します@@", $62, $2, $0
db "じゃ@@@", $6a, $2, $0
db "じゃん@@", $6e, $2, $0
db "しよう@@", $7c, $2, $0
db "ぜ!@@@", $ac, $2, $0
db "ぞ!@@@", $bc, $2, $0
db "た@@@@", $d4, $2, $0
db "だ@@@@", $d6, $2, $0
db "だからね@", $ee, $2, $0
db "だぜ@@@", $f4, $2, $0
db "だった@@", $fa, $2, $0
db "だね@@@", $fe, $2, $0
db "だよ@@@", $10, $3, $0
db "だよねー!", $12, $3, $0
db "だわ@@@", $26, $3, $0
db "ッス@@@", $4c, $3, $0
db "ってかんじ", $52, $3, $0
db "っぱなし@", $54, $3, $0
db "つもり@@", $56, $3, $0
db "ていない@", $64, $3, $0
db "ている@@", $66, $3, $0
db "でーす!@", $68, $3, $0
db "でした@@", $74, $3, $0
db "でしょ?@", $76, $3, $0
db "でしょー!", $78, $3, $0
db "です@@@", $7a, $3, $0
db "ですか?@", $7c, $3, $0
db "ですよ@@", $80, $3, $0
db "ですわ@@", $82, $3, $0
db "どうなの?", $a4, $3, $0
db "どうよ?@", $a8, $3, $0
db "とかいって", $aa, $3, $0
db "なの@@@", $e0, $3, $0
db "なのか@@", $e2, $3, $0
db "なのだ@@", $e4, $3, $0
db "なのよ@@", $e6, $3, $0
db "なんだね@", $f2, $3, $0
db "なんです@", $f8, $3, $0
db "なんてね@", $fa, $3, $0
db "ね@@@@", $12, $4, $0
db "ねー@@@", $14, $4, $0
db "の@@@@", $1c, $4, $0
db "の?@@@", $1e, $4, $0
db "ばっかり@", $44, $4, $0
db "まーす!@", $c2, $4, $0
db "ます@@@", $d8, $4, $0
db "ますわ@@", $da, $4, $0
db "ません@@", $dc, $4, $0
db "みたいな@", $fa, $4, $0
db "よ!@@@", $60, $5, $0
db "よー@@@", $68, $5, $0
db "よーん@@", $6c, $5, $0
db "よね@@@", $78, $5, $0
db "るよ@@@", $a2, $5, $0
db "わけ@@@", $bc, $5, $0
db "わよ!@@", $d2, $5, $0
.ThisAndThat:
db "ああ@@@", $12, $0, $0
db "あっち@@", $3c, $0, $0
db "あの@@@", $4e, $0, $0
db "ありゃ@@", $5c, $0, $0
db "あれ@@@", $66, $0, $0
db "あれは@@", $68, $0, $0
db "あんな@@", $6c, $0, $0
db "こう@@@", $dc, $1, $0
db "こっち@@", $ec, $1, $0
db "この@@@", $f2, $1, $0
db "こりゃ@@", $fe, $1, $0
db "これ@@@", $0, $2, $0
db "これだ!@", $2, $2, $0
db "これは@@", $4, $2, $0
db "こんな@@", $e, $2, $0
db "そう@@@", $be, $2, $0
db "そっち@@", $c0, $2, $0
db "その@@@", $c2, $2, $0
db "そりゃ@@", $c6, $2, $0
db "それ@@@", $c8, $2, $0
db "それだ!@", $cc, $2, $0
db "それは@@", $d0, $2, $0
db "そんな@@", $d2, $2, $0
db "どう@@@", $98, $3, $0
db "どっち@@", $b2, $3, $0
db "どの@@@", $b4, $3, $0
db "どりゃ@@", $c0, $3, $0
db "どれ@@@", $c2, $3, $0
db "どれを@@", $c8, $3, $0
db "どんな@@", $ca, $3, $0
db "なに@@@", $de, $3, $0
db "なんか@@", $ec, $3, $0
db "なんだ@@", $f0, $3, $0
db "なんで@@", $f6, $3, $0
db "なんなんだ", $0, $4, $0
db "なんの@@", $2, $4, $0
MobileEZChatData_WordAndPageCounts:
macro_11f220: MACRO
; parameter: number of words
db \1
; 12 words per page (0-based indexing)
x = \1 / 12
if \1 % 12 == 0
x = x + -1
endc
db x
ENDM
macro_11f220 18 ; 01: Types
macro_11f220 36 ; 02: Greetings
macro_11f220 69 ; 03: People
macro_11f220 69 ; 04: Battle
macro_11f220 66 ; 05: Exclamations
macro_11f220 66 ; 06: Conversation
macro_11f220 69 ; 07: Feelings
macro_11f220 66 ; 08: Conditions
macro_11f220 39 ; 09: Life
macro_11f220 39 ; 0a: Hobbies
macro_11f220 69 ; 0b: Actions
macro_11f220 39 ; 0c: Time
macro_11f220 66 ; 0d: Farewells
macro_11f220 36 ; 0e: ThisAndThat
EZChat_SortedWords:
; Addresses in WRAM bank 3 where EZChat words beginning
; with the given kana are sorted in memory, and the pre-
; allocated size for each.
; These arrays are expanded dynamically to accomodate
; any Pokemon you've seen that starts with each kana.\
macro_11f23c: MACRO
dw x - w3_d000, \1
x = x + 2 * \1
ENDM
x = $d012
macro_11f23c $2f ; a
macro_11f23c $1e ; i
macro_11f23c $11 ; u
macro_11f23c $09 ; e
macro_11f23c $2e ; o
macro_11f23c $24 ; ka_ga
macro_11f23c $1b ; ki_gi
macro_11f23c $09 ; ku_gu
macro_11f23c $07 ; ke_ge
macro_11f23c $1c ; ko_go
macro_11f23c $12 ; sa_za
macro_11f23c $2b ; shi_ji
macro_11f23c $10 ; su_zu
macro_11f23c $08 ; se_ze
macro_11f23c $0c ; so_zo
macro_11f23c $2c ; ta_da
macro_11f23c $09 ; chi_dhi
macro_11f23c $12 ; tsu_du
macro_11f23c $1b ; te_de
macro_11f23c $1a ; to_do
macro_11f23c $1c ; na
macro_11f23c $05 ; ni
macro_11f23c $02 ; nu
macro_11f23c $05 ; ne
macro_11f23c $07 ; no
macro_11f23c $16 ; ha_ba_pa
macro_11f23c $0e ; hi_bi_pi
macro_11f23c $0c ; fu_bu_pu
macro_11f23c $05 ; he_be_pe
macro_11f23c $16 ; ho_bo_po
macro_11f23c $19 ; ma
macro_11f23c $0e ; mi
macro_11f23c $08 ; mu
macro_11f23c $07 ; me
macro_11f23c $09 ; mo
macro_11f23c $0d ; ya
macro_11f23c $04 ; yu
macro_11f23c $14 ; yo
macro_11f23c $0b ; ra
macro_11f23c $01 ; ri
macro_11f23c $02 ; ru
macro_11f23c $02 ; re
macro_11f23c $02 ; ro
macro_11f23c $15 ; wa
x = $d000
macro_11f23c $09 ; end
.End
|
firmware/bsl/lib-qpc/ports/ucos2/watcom/ucos2.86/os_cpu_a.asm | AmuletGroup/amulet-project | 20 | 18688 | ;********************************************************************************************************
; uC/OS-II
; The Real-Time Kernel
;
; (c) Copyright 1992-2002, <NAME>, Weston, FL
; All Rights Reserved
;
;
; 80x86/80x88 Specific code
; LARGE MEMORY MODEL
;
; Borland Turbo Assembler 3.1
; (IBM/PC Compatible Target)
;
; File : OS_CPU_A.ASM
; By : <NAME>
; Updated By : <NAME>
;********************************************************************************************************
;********************************************************************************************************
; PUBLIC and EXTERNAL REFERENCES
;********************************************************************************************************
PUBLIC _OSTickISR
PUBLIC _OSStartHighRdy
PUBLIC _OSCtxSw
PUBLIC _OSIntCtxSw
PUBLIC _OSCPUDisable
PUBLIC _OSCPUEnable
PUBLIC _OSCPUSaveSR
PUBLIC _OSCPURestoreSR
EXTRN _OSIntExit:FAR
EXTRN _OSTimeTick:FAR
EXTRN _OSTaskSwHook:FAR
EXTRN _OSIntNesting:BYTE
EXTRN _OSTickDOSCtr:BYTE
EXTRN _OSPrioHighRdy:BYTE
EXTRN _OSPrioCur:BYTE
EXTRN _OSRunning:BYTE
EXTRN _OSTCBCur:DWORD
EXTRN _OSTCBHighRdy:DWORD
.MODEL LARGE
.CODE
.186
PAGE ; /*$PAGE*/
;*********************************************************************************************************
;
; void OSCPUDisable(void)
;
;*********************************************************************************************************
_OSCPUDisable PROC FAR
CLI ; clear the I flag
RET ; return to the caller
_OSCPUDisable ENDP
;*********************************************************************************************************
;
; void OSCPUDisable(void)
;
;*********************************************************************************************************
_OSCPUEnable PROC FAR
STI ; set the I flag
RET ; return to the caller
_OSCPUEnable ENDP
;*********************************************************************************************************
;
; int OSCPUSaveSR(void)
;
;*********************************************************************************************************
_OSCPUSaveSR PROC FAR
PUSHF ; push the flags
POP AX ; pop the flags into the return value AX
CLI ; clear the I flag
RET ; return to the caller
_OSCPUSaveSR ENDP
;*********************************************************************************************************
;
; void OSCPURestoreSR(int key)
;
;*********************************************************************************************************
_OSCPURestoreSR PROC FAR
PUSH BP
MOV BP,SP
MOV AX, WORD PTR[BP+6]
PUSH AX
POPF
POP BP
RET
_OSCPURestoreSR ENDP
;*********************************************************************************************************
; START MULTITASKING
; void OSStartHighRdy(void)
;
; The stack frame is assumed to look as follows:
;
; OSTCBHighRdy->OSTCBStkPtr --> DS (Low memory)
; ES
; DI
; SI
; BP
; SP
; BX
; DX
; CX
; AX
; OFFSET of task code address
; SEGMENT of task code address
; Flags to load in PSW
; OFFSET of task code address
; SEGMENT of task code address
; OFFSET of 'pdata'
; SEGMENT of 'pdata' (High memory)
;
; Note : OSStartHighRdy() MUST:
; a) Call OSTaskSwHook() then,
; b) Set OSRunning to TRUE,
; c) Switch to the highest priority task.
;*********************************************************************************************************
_OSStartHighRdy PROC FAR
MOV AX, SEG _OSTCBHighRdy ; Reload DS
MOV DS, AX ;
;
CALL FAR PTR _OSTaskSwHook ; Call user defined task switch hook
;
MOV AL, 1 ; OSRunning = TRUE;
MOV BYTE PTR DS:_OSRunning, AL ; (Indicates that multitasking has started)
;
LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy->OSTCBStkPtr
MOV SS, ES:[BX+2] ;
MOV SP, ES:[BX+0] ;
;
POP DS ; Load task's context
POP ES ;
POPA ;
;
IRET ; Run task
_OSStartHighRdy ENDP
PAGE ; /*$PAGE*/
;*********************************************************************************************************
; PERFORM A CONTEXT SWITCH (From task level)
; void OSCtxSw(void)
;
; Note(s): 1) Upon entry,
; OSTCBCur points to the OS_TCB of the task to suspend
; OSTCBHighRdy points to the OS_TCB of the task to resume
;
; 2) The stack frame of the task to suspend looks as follows:
;
; SP -> OFFSET of task to suspend (Low memory)
; SEGMENT of task to suspend
; PSW of task to suspend (High memory)
;
; 3) The stack frame of the task to resume looks as follows:
;
; OSTCBHighRdy->OSTCBStkPtr --> DS (Low memory)
; ES
; DI
; SI
; BP
; SP
; BX
; DX
; CX
; AX
; OFFSET of task code address
; SEGMENT of task code address
; Flags to load in PSW (High memory)
;*********************************************************************************************************
_OSCtxSw PROC FAR
;
PUSHA ; Save current task's context
PUSH ES ;
PUSH DS ;
;
MOV AX, SEG _OSTCBCur ; Reload DS in case it was altered
MOV DS, AX ;
;
LES BX, DWORD PTR DS:_OSTCBCur ; OSTCBCur->OSTCBStkPtr = SS:SP
MOV ES:[BX+2], SS ;
MOV ES:[BX+0], SP ;
;
CALL FAR PTR _OSTaskSwHook ; Call user defined task switch hook
;
MOV AX, WORD PTR DS:_OSTCBHighRdy+2 ; OSTCBCur = OSTCBHighRdy
MOV DX, WORD PTR DS:_OSTCBHighRdy ;
MOV WORD PTR DS:_OSTCBCur+2, AX ;
MOV WORD PTR DS:_OSTCBCur, DX ;
;
MOV AL, BYTE PTR DS:_OSPrioHighRdy ; OSPrioCur = OSPrioHighRdy
MOV BYTE PTR DS:_OSPrioCur, AL ;
;
LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy->OSTCBStkPtr
MOV SS, ES:[BX+2] ;
MOV SP, ES:[BX] ;
;
POP DS ; Load new task's context
POP ES ;
POPA ;
;
IRET ; Return to new task
;
_OSCtxSw ENDP
PAGE ; /*$PAGE*/
;*********************************************************************************************************
; PERFORM A CONTEXT SWITCH (From an ISR)
; void OSIntCtxSw(void)
;
; Note(s): 1) Upon entry,
; OSTCBCur points to the OS_TCB of the task to suspend
; OSTCBHighRdy points to the OS_TCB of the task to resume
;
; 2) The stack frame of the task to suspend looks as follows:
;
; OSTCBCur->OSTCBStkPtr ------> DS (Low memory)
; ES
; DI
; SI
; BP
; SP
; BX
; DX
; CX
; AX
; OFFSET of task code address
; SEGMENT of task code address
; Flags to load in PSW (High memory)
;
;
; 3) The stack frame of the task to resume looks as follows:
;
; OSTCBHighRdy->OSTCBStkPtr --> DS (Low memory)
; ES
; DI
; SI
; BP
; SP
; BX
; DX
; CX
; AX
; OFFSET of task code address
; SEGMENT of task code address
; Flags to load in PSW (High memory)
;*********************************************************************************************************
_OSIntCtxSw PROC FAR
;
CALL FAR PTR _OSTaskSwHook ; Call user defined task switch hook
;
MOV AX, SEG _OSTCBCur ; Reload DS in case it was altered
MOV DS, AX ;
;
MOV AX, WORD PTR DS:_OSTCBHighRdy+2 ; OSTCBCur = OSTCBHighRdy
MOV DX, WORD PTR DS:_OSTCBHighRdy ;
MOV WORD PTR DS:_OSTCBCur+2, AX ;
MOV WORD PTR DS:_OSTCBCur, DX ;
;
MOV AL, BYTE PTR DS:_OSPrioHighRdy ; OSPrioCur = OSPrioHighRdy
MOV BYTE PTR DS:_OSPrioCur, AL
;
LES BX, DWORD PTR DS:_OSTCBHighRdy ; SS:SP = OSTCBHighRdy->OSTCBStkPtr
MOV SS, ES:[BX+2] ;
MOV SP, ES:[BX] ;
;
POP DS ; Load new task's context
POP ES ;
POPA ;
;
IRET ; Return to new task
;
_OSIntCtxSw ENDP
PAGE ; /*$PAGE*/
;*********************************************************************************************************
; HANDLE TICK ISR
;
; Description: This function is called 199.99 times per second or, 11 times faster than the normal DOS
; tick rate of 18.20648 Hz. Thus every 11th time, the normal DOS tick handler is called.
; This is called chaining. 10 times out of 11, however, the interrupt controller on the PC
; must be cleared to allow for the next interrupt.
;
; Arguments : none
;
; Returns : none
;
; Note(s) : The following C-like pseudo-code describe the operation being performed in the code below.
;
; Save all registers on the current task's stack;
; OSIntNesting++;
; if (OSIntNesting == 1) {
; OSTCBCur->OSTCBStkPtr = SS:SP
; }
; OSTickDOSCtr--;
; if (OSTickDOSCtr == 0) {
; OSTickDOSCtr = 11;
; INT 81H; Chain into DOS every 54.925 mS
; (Interrupt will be cleared by DOS)
; } else {
; Send EOI to PIC; Clear tick interrupt by sending an End-Of-Interrupt to the 8259
; PIC (Priority Interrupt Controller)
; }
; OSTimeTick(); Notify uC/OS-II that a tick has occured
; OSIntExit(); Notify uC/OS-II about end of ISR
; Restore all registers that were save on the current task's stack;
; Return from Interrupt;
;*********************************************************************************************************
;
_OSTickISR PROC FAR
;
PUSHA ; Save interrupted task's context
PUSH ES
PUSH DS
;
MOV AX, SEG(_OSIntNesting) ; Reload DS
MOV DS, AX
INC BYTE PTR DS:_OSIntNesting ; Notify uC/OS-II of ISR
;
CMP BYTE PTR DS:_OSIntNesting, 1 ; if (OSIntNesting == 1)
JNE SHORT _OSTickISR1
MOV AX, SEG(_OSTCBCur) ; Reload DS
MOV DS, AX
LES BX, DWORD PTR DS:_OSTCBCur ; OSTCBCur->OSTCBStkPtr = SS:SP
MOV ES:[BX+2], SS ;
MOV ES:[BX+0], SP ;
;
_OSTickISR1:
MOV AX, SEG(_OSTickDOSCtr) ; Reload DS
MOV DS, AX
DEC BYTE PTR DS:_OSTickDOSCtr
CMP BYTE PTR DS:_OSTickDOSCtr, 0
JNE SHORT _OSTickISR2 ; Every 11 ticks (~199.99 Hz), chain into DOS
;
MOV BYTE PTR DS:_OSTickDOSCtr, 11
INT 081H ; Chain into DOS's tick ISR
JMP SHORT _OSTickISR3
_OSTickISR2:
MOV AL, 20H ; Move EOI code into AL.
MOV DX, 20H ; Address of 8259 PIC in DX.
OUT DX, AL ; Send EOI to PIC if not processing DOS timer.
;
_OSTickISR3:
CALL FAR PTR _OSTimeTick ; Process system tick
;
CALL FAR PTR _OSIntExit ; Notify uC/OS-II of end of ISR
;
POP DS ; Restore interrupted task's context
POP ES
POPA
;
IRET ; Return to interrupted task
;
_OSTickISR ENDP
;
;
END
|
oeis/020/A020111.asm | neoneye/loda-programs | 11 | 105448 | <filename>oeis/020/A020111.asm
; A020111: Ceiling of GAMMA(n+5/9)/GAMMA(5/9).
; Submitted by <NAME>
; 1,1,1,3,8,36,199,1303,9844,84217,804739,8494461,98158214,1232430909,16706285647,243169268857,3782633071104,62623591954943,1099391947653438,20399828362013788,398929976857158504
mov $1,1
mov $3,1
lpb $0
mov $2,$0
sub $0,1
mul $2,18
sub $2,8
mul $1,$2
mul $3,18
lpe
add $3,1
div $1,$3
mov $0,$1
add $0,1
|
tests/test-1-simpleloops.86.asm | sporiyano/rgat | 381 | 101779 | <gh_stars>100-1000
;basic sanity check with a few external calls
global main
section .text
main:
mov ecx, 100
loop1:
mov eax, 20
mov ebx, 10
xchg eax, ebx
dec ecx
jnz loop1
mov ecx, 1000
jmp loop2
loop2:
mov eax, 20
mov ebx, 10
xchg eax, ebx
dec ecx
jnz loop2
mov ecx, 10000
jmp loop3
loop3:
mov eax, 20
mov ebx, 10
xchg eax, ebx
dec ecx
jnz loop3
mov ecx, 100000
jmp loop4
loop4:
mov eax, 20
mov ebx, 10
xchg eax, ebx
dec ecx
jnz loop4
mov ecx, 10000000
jmp loop5
loop5:
mov eax, 20
mov ebx, 10
xchg eax, ebx
dec ecx
jnz loop5
inc ecx
inc ecx
inc ecx
inc ecx
jmp end
inc esi
inc esi
inc esi
inc esi
end:
xor ecx, ecx
ret
|
Semester 5/Microprocessors/exp3-B.asm | atharva8300/Engineering-Practical-Experiments | 7 | 162866 | ;HEX to BCD
.model small
.data
m1 db 10, 13, "Equivalent BCD no. is: $"
no dw 0ffffh
.code
Disp macro xx
mov ah, 09
lea dx, xx
int 21h
endm
.startup
Disp m1
mov cl, 0
mov ax, no
mov bx, 0ah
back:
mov dx, 0
div bx
push dx
inc cl
cmp ax, 0
jnz back
back1:
pop dx
add dl, 30h
mov ah, 02
int 21h
dec cl
jnz back1
.exit
end
|
data/formal/express.g4 | w0rm/steputils | 16 | 657 | /*
Created: 2020-01-13
Copyright (c) 2020 <NAME>
License: MIT License
Based on: iso-10303-11--2004.bnf
Author: mozman <<EMAIL>>
*/
grammar express;
attribute_ref :
attribute_id ;
constant_ref :
constant_id ;
entity_ref :
entity_id ;
enumeration_ref :
enumeration_id ;
function_ref :
function_id ;
parameter_ref :
parameter_id ;
procedure_ref :
procedure_id ;
rule_label_ref :
rule_label_id ;
rule_ref :
rule_id ;
schema_ref :
schema_id ;
subtype_constraint_ref :
subtype_constraint_id ;
type_label_ref :
type_label_id ;
type_ref :
type_id ;
variable_ref :
variable_id ;
abstract_entity_declaration :
ABSTRACT ;
abstract_supertype :
ABSTRACT SUPERTYPE ';' ;
abstract_supertype_declaration :
ABSTRACT SUPERTYPE subtype_constraint? ;
actual_parameter_list :
'(' parameter ( ',' parameter )* ')' ;
add_like_op
: '+'
| '-'
| OR
| XOR
;
aggregate_initializer :
'[' (element ( ',' element )* )? ']' ;
aggregate_source :
simple_expression ;
aggregate_type :
AGGREGATE ( ':' type_label )? OF parameter_type ;
aggregation_types
: array_type
| bag_type
| list_type
| set_type
;
algorithm_head :
declaration* constant_decl? local_decl? ;
alias_stmt :
ALIAS variable_id FOR general_ref qualifier* ';' stmt+ END_ALIAS ';' ;
array_type :
ARRAY bound_spec OF OPTIONAL? UNIQUE? instantiable_type ;
assignment_stmt :
general_ref qualifier* ':=' expression ';' ;
attribute_decl
: attribute_id
| redeclared_attribute
;
attribute_id :
SIMPLE_ID ;
attribute_qualifier :
'.' attribute_ref ;
bag_type :
BAG bound_spec? OF instantiable_type ;
binary_type :
BINARY width_spec? ;
boolean_type :
BOOLEAN ;
bound_1 :
numeric_expression ;
bound_2 :
numeric_expression ;
bound_spec :
'[' bound_1 ':' bound_2 ']' ;
built_in_constant
: CONST_E
| PI
| SELF
| '?'
;
built_in_function
: ABS
| ACOS
| ASIN
| ATAN
| BLENGTH
| COS
| EXISTS
| EXP
| FORMAT
| HIBOUND
| HIINDEX
| LENGTH
| LOBOUND
| LOINDEX
| LOG
| LOG2
| LOG10
| NVL
| ODD
| ROLESOF
| SIN
| SIZEOF
| SQRT
| TAN
| TYPEOF
| USEDIN
| VALUE
| VALUE_IN
| VALUE_UNIQUE
;
built_in_procedure
: INSERT
| REMOVE
;
case_action :
case_label ( ',' case_label )* ':' stmt ;
case_label :
expression ;
case_stmt :
CASE selector OF case_action* (OTHERWISE ':' stmt)? END_CASE ';' ;
compound_stmt :
BEGIN stmt+ END ';' ;
concrete_types
: aggregation_types
| simple_types
| type_ref
;
constant_body :
constant_id ':' instantiable_type ':=' expression ';' ;
constant_decl :
CONSTANT constant_body+ END_CONSTANT ';' ;
constant_factor
: built_in_constant
| constant_ref
;
constant_id : SIMPLE_ID ;
constructed_types
: enumeration_type
| select_type
;
declaration
: entity_decl
| function_decl
| procedure_decl
| subtype_constraint_decl
| type_decl
;
derived_attr :
attribute_decl ':' parameter_type ':=' expression ';' ;
derive_clause :
DERIVE derived_attr+ ;
domain_rule :
(rule_label_id ':')? expression ;
element :
expression ( ':' repetition )? ;
entity_body :
explicit_attr* derive_clause? inverse_clause? unique_clause? where_clause? ;
entity_constructor :
entity_ref '(' ( expression ( ',' expression )* )? ')' ;
entity_decl :
entity_head entity_body END_ENTITY ';' ;
entity_head :
ENTITY entity_id subsuper ';' ;
entity_id :
SIMPLE_ID ;
enumeration_extension :
BASED_ON type_ref ( WITH enumeration_items )? ;
enumeration_id :
SIMPLE_ID ;
enumeration_items :
'(' enumeration_id ( ',' enumeration_id )* ')' ;
enumeration_reference :
( type_ref '.' )? enumeration_ref ;
enumeration_type :
EXTENSIBLE? ENUMERATION ( ( OF enumeration_items ) | enumeration_extension )? ;
escape_stmt :
ESCAPE ';' ;
explicit_attr :
attribute_decl ( ',' attribute_decl )? ':' OPTIONAL? parameter_type ';' ;
expression :
simple_expression ( rel_op_extended simple_expression )? ;
factor :
simple_factor ( '**' simple_factor )? ;
formal_parameter :
parameter_id ( ',' parameter_id )* ':' parameter_type ;
function_call :
( built_in_function | function_ref ) actual_parameter_list? ;
function_decl :
function_head algorithm_head stmt+ END_FUNCTION ';' ;
function_head :
FUNCTION function_id ( '(' formal_parameter ( ';' formal_parameter )* ')' )? ':' parameter_type ';' ;
function_id :
SIMPLE_ID ;
generalized_types
: aggregate_type
| general_aggregation_types
| generic_entity_type
| generic_type
;
general_aggregation_types
: general_array_type
| general_bag_type
| general_list_type
| general_set_type
;
general_array_type : ARRAY bound_spec? OF OPTIONAL? UNIQUE? parameter_type ;
general_bag_type : BAG bound_spec? OF parameter_type ;
general_list_type : LIST bound_spec? OF UNIQUE? parameter_type ;
general_ref
: parameter_ref
| variable_ref
;
general_set_type :
SET bound_spec? OF parameter_type ;
generic_entity_type :
GENERIC_ENTITY ( ':' type_label )? ;
generic_type :
GENERIC ( ':' type_label )? ;
group_qualifier :
'\\' entity_ref ;
if_stmt :
IF logical_expression THEN stmt+ ( ELSE stmt+ )? END_IF ';' ;
increment :
numeric_expression ;
increment_control :
variable_id ':=' bound_1 TO bound_2 ( BY increment )? ;
index :
numeric_expression ;
index_1 :
index ;
index_2 :
index ;
index_qualifier :
'[' index_1 ( ':' index_2 )? ']' ;
instantiable_type
: concrete_types
| entity_ref
;
integer_type :
INTEGER ;
interface_specification
: reference_clause
| use_clause
;
interval :
'{' interval_low interval_op interval_item interval_op interval_high '}' ;
interval_high :
simple_expression ;
interval_item :
simple_expression ;
interval_low :
simple_expression ;
interval_op
: '<'
| '<='
;
inverse_attr :
attribute_decl ':' ( ( SET | BAG ) bound_spec? OF )? entity_ref FOR ( entity_ref '.' )? attribute_ref ';' ;
inverse_clause :
INVERSE inverse_attr+ ;
list_type :
LIST bound_spec? OF UNIQUE? instantiable_type ;
literal
: BINARY_LITERAL
| logical_literal
| REAL_LITERAL
| INTEGER_LITERAL
| string_literal
;
local_decl :
LOCAL local_variable+ END_LOCAL ';' ;
local_variable :
variable_id ( ',' variable_id )* ':' parameter_type ( ':=' expression )? ';' ;
logical_expression :
expression ;
logical_literal
: FALSE
| TRUE
| UNKNOWN
;
logical_type :
LOGICAL ;
multiplication_like_op
: '*'
| '/'
| DIV
| MOD
| AND
| '||'
;
named_types
: entity_ref
| type_ref
;
named_type_or_rename :
named_types ( AS ( entity_id | type_id ) )? ;
null_stmt :
';' ;
number_type :
NUMBER ;
numeric_expression :
simple_expression ;
one_of :
ONEOF '(' supertype_expression ( ',' supertype_expression )* ')' ;
parameter :
expression ;
parameter_id :
SIMPLE_ID ;
parameter_type
: generalized_types
| named_types
| simple_types
;
population :
entity_ref ;
precision_spec :
numeric_expression ;
primary
: literal
| ( qualifiable_factor qualifier* )
;
procedure_call_stmt :
( built_in_procedure | procedure_ref ) actual_parameter_list+ ';' ;
procedure_decl :
procedure_head algorithm_head stmt* END_PROCEDURE ';' ;
procedure_head :
PROCEDURE procedure_id ( '(' VAR? formal_parameter ( ';' VAR? formal_parameter )* ')' )? ';' ;
procedure_id :
SIMPLE_ID ;
qualifiable_factor
: attribute_ref
| constant_factor
| function_call
| general_ref
| population
;
qualified_attribute :
SELF group_qualifier attribute_qualifier ;
qualifier
: attribute_qualifier
| group_qualifier
| index_qualifier
;
query_expression :
QUERY '(' variable_id '<*' aggregate_source '|' logical_expression ')' ;
real_type :
REAL ( '(' precision_spec ')' )? ;
redeclared_attribute :
qualified_attribute ( RENAMED attribute_id )? ;
referenced_attribute
: attribute_ref
| qualified_attribute
;
reference_clause :
REFERENCE FROM schema_ref ( '(' resource_or_rename ( ',' resource_or_rename )* ')' )? ';' ;
rel_op
: '<'
| '>'
| '<='
| '>='
| '<>'
| '='
| ':<>:'
| ':=:'
;
rel_op_extended
: rel_op
| IN
| LIKE
;
rename_id
: constant_id
| entity_id
| function_id
| procedure_id
| type_id
;
repeat_control :
increment_control? while_control? until_control? ;
repeat_stmt :
REPEAT repeat_control ';' stmt+ END_REPEAT ';' ;
repetition :
numeric_expression ;
resource_or_rename :
resource_ref ( AS rename_id )? ;
resource_ref
: constant_ref
| entity_ref
| function_ref
| procedure_ref
| type_ref
;
return_stmt :
RETURN ( '(' expression ')' )? ';' ;
rule_decl :
rule_head algorithm_head stmt* where_clause END_RULE ';' ;
rule_head :
RULE rule_id FOR '(' entity_ref ( ',' entity_ref )* ')' ';' ;
rule_id :
SIMPLE_ID ;
rule_label_id :
SIMPLE_ID ;
schema_body :
interface_specification* constant_decl? ( declaration | rule_decl )* ;
schema_decl :
SCHEMA schema_id schema_version_id? ';' schema_body END_SCHEMA ';' ;
schema_id :
SIMPLE_ID ;
schema_version_id :
string_literal ;
selector :
expression ;
select_extension :
BASED_ON type_ref ( WITH select_list )? ;
select_list :
'(' named_types ( ',' named_types )* ')' ;
select_type :
( EXTENSIBLE GENERIC_ENTITY? )? SELECT ( select_list | select_extension )? ;
set_type :
SET bound_spec? OF instantiable_type ;
simple_expression :
term (add_like_op term )* ;
simple_factor
: aggregate_initializer
| entity_constructor
| enumeration_reference
| interval
| query_expression
| ( unary_op? ( '(' expression ')' | primary ) ) ;
simple_types
: binary_type
| boolean_type
| integer_type
| logical_type
| number_type
| real_type
| string_type
;
skip_stmt :
SKIP_ ';' ;
stmt : alias_stmt
| assignment_stmt
| case_stmt
| compound_stmt
| escape_stmt
| if_stmt
| null_stmt
| procedure_call_stmt
| repeat_stmt
| return_stmt
| skip_stmt ;
string_literal
: SIMPLE_STRING_LITERAL
| ENCODED_STRING_LITERAL
;
string_type :
STRING width_spec? ;
subsuper :
supertype_constraint? subtype_declaration? ;
subtype_constraint :
OF '(' supertype_expression ')' ;
subtype_constraint_body :
abstract_supertype? total_over? ( supertype_expression ';' )? ;
subtype_constraint_decl :
subtype_constraint_head subtype_constraint_body END_SUBTYPE_CONSTRAINT ';' ;
subtype_constraint_head :
SUBTYPE_CONSTRAINT subtype_constraint_id FOR entity_ref ';' ;
subtype_constraint_id :
SIMPLE_ID ;
subtype_declaration :
SUBTYPE OF '(' entity_ref ( ',' entity_ref )* ')' ;
supertype_constraint
: abstract_entity_declaration
| abstract_supertype_declaration
| supertype_rule
;
supertype_expression :
supertype_factor ( ANDOR supertype_factor )* ;
supertype_factor :
supertype_term ( AND supertype_term )* ;
supertype_rule :
SUPERTYPE subtype_constraint ;
supertype_term
: entity_ref
| one_of
| '(' supertype_expression ')'
;
syntax :
schema_decl+ ;
term :
factor ( multiplication_like_op factor )* ;
total_over :
TOTAL_OVER '(' entity_ref ( ',' entity_ref )* ')' ';' ;
type_decl :
TYPE type_id '=' underlying_type ';' where_clause? END_TYPE ';' ;
type_id :
SIMPLE_ID ;
type_label
: type_label_id
| type_label_ref
;
type_label_id :
SIMPLE_ID ;
unary_op
: '+'
| '-'
| NOT
;
underlying_type
: concrete_types
| constructed_types
;
unique_clause :
UNIQUE (unique_rule ';')+ ;
unique_rule :
( rule_label_id ':' )? referenced_attribute ( ',' referenced_attribute )* ;
until_control :
UNTIL logical_expression ;
use_clause :
USE FROM schema_ref ( '(' named_type_or_rename ( ',' named_type_or_rename )* ')' )? ';' ;
variable_id :
SIMPLE_ID ;
where_clause :
WHERE (domain_rule ';')+ ;
while_control :
WHILE logical_expression ;
width :
numeric_expression ;
width_spec :
'(' width ')' FIXED? ;
ABS : 'ABS' ;
ABSTRACT : 'ABSTRACT' ;
ACOS : 'ACOS' ;
AGGREGATE : 'AGGREGATE' ;
ALIAS : 'ALIAS' ;
AND : 'AND' ;
ANDOR : 'ANDOR' ;
ARRAY : 'ARRAY' ;
AS : 'AS' ;
ASIN : 'ASIN' ;
ATAN : 'ATAN' ;
BAG : 'BAG' ;
BASED_ON : 'BASED_ON' ;
BEGIN : 'BEGIN' ;
BINARY : 'BINARY' ;
BLENGTH : 'BLENGTH' ;
BOOLEAN : 'BOOLEAN' ;
BY : 'BY' ;
CASE : 'CASE' ;
CONSTANT : 'CONSTANT' ;
CONST_E : 'CONST_E' ;
COS : 'COS' ;
DERIVE : 'DERIVE' ;
DIV : 'DIV' ;
ELSE : 'ELSE' ;
END : 'END' ;
END_ALIAS : 'END_ALIAS' ;
END_CASE : 'END_CASE' ;
END_CONSTANT : 'END_CONSTANT' ;
END_ENTITY : 'END_ENTITY' ;
END_FUNCTION : 'END_FUNCTION' ;
END_IF : 'END_IF' ;
END_LOCAL : 'END_LOCAL' ;
END_PROCEDURE : 'END_PROCEDURE' ;
END_REPEAT : 'END_REPEAT' ;
END_RULE : 'END_RULE' ;
END_SCHEMA : 'END_SCHEMA' ;
END_SUBTYPE_CONSTRAINT : 'END_SUBTYPE_CONSTRAINT' ;
END_TYPE : 'END_TYPE' ;
ENTITY : 'ENTITY' ;
ENUMERATION : 'ENUMERATION' ;
ESCAPE : 'ESCAPE' ;
EXISTS : 'EXISTS' ;
EXTENSIBLE : 'EXTENSIBLE' ;
EXP : 'EXP' ;
FALSE : 'FALSE' ;
FIXED : 'FIXED' ;
FOR : 'FOR' ;
FORMAT : 'FORMAT' ;
FROM : 'FROM' ;
FUNCTION : 'FUNCTION' ;
GENERIC : 'GENERIC' ;
GENERIC_ENTITY : 'GENERIC_ENTITY' ;
HIBOUND : 'HIBOUND' ;
HIINDEX : 'HIINDEX' ;
IF : 'IF' ;
IN : 'IN' ;
INSERT : 'INSERT' ;
INTEGER : 'INTEGER' ;
INVERSE : 'INVERSE' ;
LENGTH : 'LENGTH' ;
LIKE : 'LIKE' ;
LIST : 'LIST' ;
LOBOUND : 'LOBOUND' ;
LOCAL : 'LOCAL' ;
LOG : 'LOG' ;
LOG10 : 'LOG10' ;
LOG2 : 'LOG2' ;
LOGICAL : 'LOGICAL' ;
LOINDEX : 'LOINDEX' ;
MOD : 'MOD' ;
NOT : 'NOT' ;
NUMBER : 'NUMBER' ;
NVL : 'NVL' ;
ODD : 'ODD' ;
OF : 'OF' ;
ONEOF : 'ONEOF' ;
OPTIONAL : 'OPTIONAL' ;
OR : 'OR' ;
OTHERWISE : 'OTHERWISE' ;
PI : 'PI' ;
PROCEDURE : 'PROCEDURE' ;
QUERY : 'QUERY' ;
REAL : 'REAL' ;
REFERENCE : 'REFERENCE' ;
REMOVE : 'REMOVE' ;
RENAMED : 'RENAMED' ;
REPEAT : 'REPEAT' ;
RETURN : 'RETURN' ;
ROLESOF : 'ROLESOF' ;
RULE : 'RULE' ;
SCHEMA : 'SCHEMA' ;
SELECT : 'SELECT' ;
SELF : 'SELF' ;
SET : 'SET' ;
SIN : 'SIN' ;
SIZEOF : 'SIZEOF' ;
SKIP_ : 'SKIP' ;
SQRT : 'SQRT' ;
STRING : 'STRING' ;
SUBTYPE : 'SUBTYPE' ;
SUBTYPE_CONSTRAINT : 'SUBTYPE_CONSTRAINT' ;
SUPERTYPE : 'SUPERTYPE' ;
TAN : 'TAN' ;
THEN : 'THEN' ;
TO : 'TO' ;
TOTAL_OVER : 'TOTAL_OVER' ;
TRUE : 'TRUE' ;
TYPE : 'TYPE' ;
TYPEOF : 'TYPEOF' ;
UNIQUE : 'UNIQUE' ;
UNKNOWN : 'UNKNOWN' ;
UNTIL : 'UNTIL' ;
USE : 'USE' ;
USEDIN : 'USEDIN' ;
VALUE : 'VALUE' ;
VALUE_IN : 'VALUE_IN' ;
VALUE_UNIQUE : 'VALUE_UNIQUE' ;
VAR : 'VAR' ;
WHERE : 'WHERE' ;
WHILE : 'WHILE' ;
WITH : 'WITH' ;
XOR : 'XOR' ;
BINARY_LITERAL : '%' [01]+ ;
ENCODED_STRING_LITERAL : '"' [0-9a-fA-F]+ '"' ;
INTEGER_LITERAL : [0-9]+ ;
REAL_LITERAL : INTEGER_LITERAL | ([0-9]+ '.' [0-9]* (('e'|'E') [+-]? [0-9]+)?) ;
SIMPLE_ID : [a-zA-Z] ([a-zA-Z0-9_])* ;
QUOTECHAR : '\'';
SIMPLE_STRING_LITERAL : QUOTECHAR .*? QUOTECHAR ;
COMMENTS : '(*' .*? '*)' -> skip ;
TAIL_REMARK : '--' .*? [\r\n]+ -> skip;
WS : [ \t\r\n]+ -> skip ;
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_648.asm | ljhsiun2/medusa | 9 | 82407 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x3c08, %rsi
lea addresses_normal_ht+0x193fb, %rdi
nop
add %r15, %r15
mov $64, %rcx
rep movsl
nop
nop
nop
nop
dec %rdx
lea addresses_A_ht+0x49c3, %rsi
lea addresses_WT_ht+0x105ec, %rdi
nop
nop
nop
nop
sub $56854, %r10
mov $126, %rcx
rep movsb
nop
nop
nop
nop
inc %rcx
lea addresses_normal_ht+0x1dbb8, %rcx
nop
nop
nop
nop
nop
sub $7654, %rbx
vmovups (%rcx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdx
nop
nop
nop
nop
cmp %rbx, %rbx
lea addresses_D_ht+0x16a98, %rsi
lea addresses_A_ht+0x12e38, %rdi
nop
add %r8, %r8
mov $39, %rcx
rep movsb
nop
nop
nop
cmp $38894, %rdi
lea addresses_A_ht+0x1d6b8, %rsi
lea addresses_normal_ht+0x1e9b8, %rdi
nop
nop
nop
cmp $12231, %r8
mov $111, %rcx
rep movsw
nop
sub %r15, %r15
lea addresses_WT_ht+0x4138, %r10
add %r8, %r8
mov (%r10), %di
nop
cmp $28439, %r8
lea addresses_WT_ht+0x6ea1, %rbx
nop
nop
nop
sub $5, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
movups %xmm2, (%rbx)
nop
nop
nop
nop
nop
add %r15, %r15
lea addresses_A_ht+0x538, %rsi
lea addresses_WC_ht+0xd7b8, %rdi
nop
and %r10, %r10
mov $122, %rcx
rep movsq
nop
nop
nop
add %r10, %r10
lea addresses_D_ht+0x19948, %rdx
sub $54112, %rbx
movb $0x61, (%rdx)
nop
nop
nop
nop
nop
lfence
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %rax
push %rcx
push %rdi
// Store
lea addresses_RW+0x1f5b8, %r14
nop
nop
xor $61077, %rcx
movw $0x5152, (%r14)
nop
nop
nop
nop
dec %rdi
// Faulty Load
lea addresses_PSE+0x171b8, %r15
nop
inc %r10
vmovntdqa (%r15), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rax
lea oracles, %rcx
and $0xff, %rax
shlq $12, %rax
mov (%rcx,%rax,1), %rax
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 8}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'}
{'45': 21280, '46': 181, '49': 362, '00': 3, '44': 2, 'e1': 1}
00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 46 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45
*/
|
examples/outdated-and-incorrect/iird/IIRD.agda | asr/agda-kanso | 1 | 12133 | <filename>examples/outdated-and-incorrect/iird/IIRD.agda
module IIRD where
open import LF
-- A code for an IIRD (captures both general and restricted IIRDs)
-- I - index set
-- D - return type of the recursive component
-- E - generalised return type of the recursive component (including the index)
-- for restricted IIRD E = D i for an external i
-- and for general IIRD E = (i : I) × D i
-- The intuition is that restricted IIRD are parameterised over the index,
-- whereas general IIRD compute their indices.
data OP (I : Set)(D : I -> Set1)(E : Set1) : Set1 where
-- Nullary constructor, contains the result of the recursive component
ι : E -> OP I D E
-- Non-recursive argument A, following arguments may depend on this argument.
-- To code multi-constructor datatypes, the first argument is the name of the
-- constructor and γ does the appropriate case-split on the name.
σ : (A : Set)(γ : A -> OP I D E) -> OP I D E
-- Recursive argument
-- A - assumptions, for instance lim : (Nat -> Ord) -> Ord, where A = Nat
-- i - the index of the inductive occurrence
-- γ - the rest of the arguments, may depend on the result of calling the
-- recursive function on the inductive argument
δ : (A : Set)(i : A -> I)(γ : ((a : A) -> D (i a)) -> OP I D E) -> OP I D E
-- Helper function. The definition is simple, but the type is not.
_«_×_» : {A B : Set}{C : B -> Set}{D : B -> Set1}
(f : (b : B) -> C b -> D b)
(g : A -> B)(h : (a : A) -> C (g a)) ->
(a : A) -> D (g a)
f « g × h » = \a -> f (g a) (h a)
-- The type of constructor arguments. Parameterised over
-- U - the inductive type
-- T - the recursive function
-- This is the F of the simple polynomial type μF
Ku : {I : Set}{D : I -> Set1}{E : Set1} -> OP I D E ->
(U : I -> Set)(T : (i : I) -> U i -> D i) -> Set
Ku (ι e) U T = One
Ku (σ A γ) U T = A × \a -> Ku (γ a) U T
Ku (δ A i γ) U T = ((a : A) -> U (i a)) × \g -> Ku (γ (T « i × g »)) U T
-- The recursive function. As with Ku this is only the top-level structure.
-- To get the real function there is a recursive knot to be tied.
Kt : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
Ku γ U T -> E
Kt (ι e) U T ★ = e
Kt (σ A γ) U T < a | b > = Kt (γ a) U T b
Kt (δ A i γ) U T < g | b > = Kt (γ (T « i × g »)) U T b
-- The assumptions of a particular inductive occurrence in a value.
KIArg : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
Ku γ U T -> Set
KIArg (ι e) U T ★ = Zero
KIArg (σ A γ) U T < a | b > = KIArg (γ a) U T b
KIArg (δ A i γ) U T < g | b > = A + KIArg (γ (T « i × g »)) U T b
-- Given the assumptions of an inductive occurence in a value we can compute
-- its index.
KIArg→I : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
(a : Ku γ U T) -> KIArg γ U T a -> I
KIArg→I (ι e) U T ★ ()
KIArg→I (σ A γ) U T < a | b > c = KIArg→I (γ a) U T b c
KIArg→I (δ A i γ) U T < g | b > (inl a) = i a
KIArg→I (δ A i γ) U T < g | b > (inr a) = KIArg→I (γ (T « i × g »)) U T b a
-- Given the assumptions of an inductive occurrence in a value we can compute
-- its value.
KIArg→U : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
(a : Ku γ U T)(v : KIArg γ U T a) -> U (KIArg→I γ U T a v)
KIArg→U (ι e) U T ★ ()
KIArg→U (σ A γ) U T < a | b > c = KIArg→U (γ a) U T b c
KIArg→U (δ A i γ) U T < g | b > (inl a) = g a
KIArg→U (δ A i γ) U T < g | b > (inr a) = KIArg→U (γ (T « i × g »)) U T b a
-- The type of induction hypotheses. Basically
-- forall assumptions, the predicate holds for an inductive occurrence with
-- those assumptions
KIH : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
(F : (i : I) -> U i -> Set1)(a : Ku γ U T) -> Set1
KIH γ U T F a = (v : KIArg γ U T a) -> F (KIArg→I γ U T a v) (KIArg→U γ U T a v)
-- If we can prove a predicate F for any values, we can construct the inductive
-- hypotheses for a given value.
-- Termination note: g will only be applied to values smaller than a
Kmap : {I : Set}{D : I -> Set1}{E : Set1}
(γ : OP I D E)(U : I -> Set)(T : (i : I) -> U i -> D i) ->
(F : (i : I) -> U i -> Set1)
(g : (i : I)(u : U i) -> F i u)
(a : Ku γ U T) -> KIH γ U T F a
Kmap γ U T F g a = \v -> g (KIArg→I γ U T a v) (KIArg→U γ U T a v)
-- Things needed for general IIRD
OPg : (I : Set)(D : I -> Set1) -> Set1
OPg I D = OP I D (I ×' D)
Gu : {I : Set}{D : I -> Set1}(γ : OPg I D)(U : I -> Set)(T : (i : I) -> U i -> D i) -> Set
Gu γ U T = Ku γ U T
Gi : {I : Set}{D : I -> Set1}(γ : OPg I D)(U : I -> Set)(T : (i : I) -> U i -> D i)
(a : Gu γ U T) -> I
Gi γ U T a = π₀' (Kt γ U T a)
Gt : {I : Set}{D : I -> Set1}(γ : OPg I D)(U : I -> Set)(T : (i : I) -> U i -> D i)
(a : Gu γ U T) -> D (Gi γ U T a)
Gt γ U T a = π₁' (Kt γ U T a)
-- Things needed for restricted IIRD
OPr : (I : Set)(D : I -> Set1) -> Set1
OPr I D = (i : I) -> OP I D (D i)
Hu : {I : Set}{D : I -> Set1}
(γ : OPr I D)(U : I -> Set)(T : (i : I) -> U i -> D i)
(i : I) -> Set
Hu γ U T i = Ku (γ i) U T
Ht : {I : Set}{D : I -> Set1}
(γ : OPr I D)(U : I -> Set)(T : (i : I) -> U i -> D i)
(i : I)(a : Hu γ U T i) -> D i
Ht γ U T i a = Kt (γ i) U T a
|
Task/Balanced-brackets/Ada/balanced-brackets.ada | LaudateCorpus1/RosettaCodeData | 1 | 19413 | with Ada.Numerics.Discrete_Random;
with Ada.Text_IO;
with Ada.Strings.Fixed;
procedure Brackets is
package Random_Positive is new Ada.Numerics.Discrete_Random (Positive);
Positive_Generator : Random_Positive.Generator;
procedure Swap (Left, Right : in out Character) is
Temp : constant Character := Left;
begin
Left := Right;
Right := Temp;
end Swap;
function Generate_Brackets (Bracket_Count : Natural;
Opening_Bracket : Character := '[';
Closing_Bracket : Character := ']')
return String is
use Ada.Strings.Fixed;
All_Brackets : String := Bracket_Count * Opening_Bracket & Bracket_Count * Closing_Bracket;
begin
for I in All_Brackets'Range loop
Swap (All_Brackets (I), All_Brackets (Random_Positive.Random (Positive_Generator) mod (Bracket_Count * 2) + 1));
end loop;
return All_Brackets;
end Generate_Brackets;
function Check_Brackets (Test : String;
Opening_Bracket : Character := '[';
Closing_Bracket : Character := ']')
return Boolean is
Open : Natural := 0;
begin
for I in Test'Range loop
if Test (I) = Opening_Bracket then
Open := Open + 1;
elsif Test (I) = Closing_Bracket then
if Open = 0 then
return False;
else
Open := Open - 1;
end if;
end if;
end loop;
return True;
end Check_Brackets;
begin
Random_Positive.Reset (Positive_Generator);
Ada.Text_IO.Put_Line ("Brackets");
for I in 0 .. 4 loop
for J in 0 .. I loop
declare
My_String : constant String := Generate_Brackets (I);
begin
Ada.Text_IO.Put_Line (My_String & ": " & Boolean'Image (Check_Brackets (My_String)));
end;
end loop;
end loop;
end Brackets;
|
good morning/good morning.asm | SREEHARIR/POV-Clock | 0 | 88721 | <reponame>SREEHARIR/POV-Clock<gh_stars>0
_elay_us:
;good morning.c,51 :: void elay_us(int n) //Delay function for variable time delay
;good morning.c,53 :: while (n--)
L_elay_us0:
MOVF FARG_elay_us_n+0, 0
MOVWF R0
MOVF FARG_elay_us_n+1, 0
MOVWF R1
MOVLW 1
SUBWF FARG_elay_us_n+0, 1
MOVLW 0
SUBWFB FARG_elay_us_n+1, 1
MOVF R0, 0
IORWF R1, 0
BTFSC STATUS+0, 2
GOTO L_elay_us1
;good morning.c,55 :: delay_us(1);
NOP
;good morning.c,56 :: }
GOTO L_elay_us0
L_elay_us1:
;good morning.c,57 :: }
L_end_elay_us:
RETURN 0
; end of _elay_us
_time:
;good morning.c,59 :: int time() //Calculating time for each revolution
;good morning.c,61 :: int t=0;
CLRF time_t_L0+0
CLRF time_t_L0+1
;good morning.c,62 :: if(PORTA.F0==0x00)
BTFSC PORTA+0, 0
GOTO L_time2
;good morning.c,64 :: while(PORTA.F0==0x00);
L_time3:
BTFSC PORTA+0, 0
GOTO L_time4
GOTO L_time3
L_time4:
;good morning.c,65 :: while(PORTA.F0==0xff)
L_time5:
BTFSS PORTA+0, 0
GOTO L_time6
;good morning.c,67 :: t=t+1;
INFSNZ time_t_L0+0, 1
INCF time_t_L0+1, 1
;good morning.c,68 :: delay_us(1);
NOP
;good morning.c,69 :: }
GOTO L_time5
L_time6:
;good morning.c,70 :: return t;
MOVF time_t_L0+0, 0
MOVWF R0
MOVF time_t_L0+1, 0
MOVWF R1
GOTO L_end_time
;good morning.c,71 :: }
L_time2:
;good morning.c,72 :: }
L_end_time:
RETURN 0
; end of _time
_show:
;good morning.c,74 :: void show(int image[],int t) //Displaying the letter
;good morning.c,76 :: int b1=0;
CLRF show_b1_L0+0
CLRF show_b1_L0+1
;good morning.c,77 :: for(b1=0;b1<=len;b1++)
CLRF show_b1_L0+0
CLRF show_b1_L0+1
L_show7:
MOVLW 128
XORWF _len+1, 0
MOVWF R0
MOVLW 128
XORWF show_b1_L0+1, 0
SUBWF R0, 0
BTFSS STATUS+0, 2
GOTO L__show89
MOVF show_b1_L0+0, 0
SUBWF _len+0, 0
L__show89:
BTFSS STATUS+0, 0
GOTO L_show8
;good morning.c,79 :: elay_us(t);
MOVF FARG_show_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_show_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,80 :: PORTB=image[b1];
MOVF show_b1_L0+0, 0
MOVWF R0
MOVF show_b1_L0+1, 0
MOVWF R1
RLCF R0, 1
BCF R0, 0
RLCF R1, 1
MOVF R0, 0
ADDWF FARG_show_image+0, 0
MOVWF FSR0
MOVF R1, 0
ADDWFC FARG_show_image+1, 0
MOVWF FSR0H
MOVF POSTINC0+0, 0
MOVWF PORTB+0
;good morning.c,77 :: for(b1=0;b1<=len;b1++)
INFSNZ show_b1_L0+0, 1
INCF show_b1_L0+1, 1
;good morning.c,81 :: }
GOTO L_show7
L_show8:
;good morning.c,82 :: PORTB=0b00000000;
CLRF PORTB+0
;good morning.c,83 :: }
L_end_show:
RETURN 0
; end of _show
_hello_world:
;good morning.c,85 :: void hello_world(int t)
;good morning.c,87 :: show(HH,t);
MOVLW _HH+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_HH+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,88 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,89 :: show(EE,t);
MOVLW _EE+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_EE+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,90 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,91 :: show(LL,t);
MOVLW _LL+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_LL+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,92 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,93 :: show(LL,t);
MOVLW _LL+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_LL+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,94 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,95 :: show(OO,t);
MOVLW _OO+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_OO+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,96 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,97 :: show(space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,98 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,99 :: show(WW,t);
MOVLW _WW+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_WW+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,100 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,101 :: show(OO,t);
MOVLW _OO+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_OO+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,102 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,103 :: show(RR,t);
MOVLW _RR+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_RR+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,104 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,105 :: show(LL,t);
MOVLW _LL+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_LL+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,106 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,107 :: show(DD,t);
MOVLW _DD+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_DD+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,108 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,109 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,110 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,111 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,112 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,113 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,114 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,115 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,116 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,117 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,118 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,119 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,120 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,121 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,122 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,123 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,124 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,125 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_show_t+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,126 :: elay_us(t);
MOVF FARG_hello_world_t+0, 0
MOVWF FARG_elay_us_n+0
MOVF FARG_hello_world_t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,127 :: }
L_end_hello_world:
RETURN 0
; end of _hello_world
_main:
;good morning.c,129 :: void main()
;good morning.c,131 :: TRISA=0xFF;
MOVLW 255
MOVWF TRISA+0
;good morning.c,132 :: TRISB=0x00;
CLRF TRISB+0
;good morning.c,133 :: PORTB=0x00;
CLRF PORTB+0
;good morning.c,134 :: TRISC.RC6 = 0x00; //TX pin set as output
BCF TRISC+0, 6
;good morning.c,135 :: TRISC.RC7 = 0xFF; //RX pin set as input
BSF TRISC+0, 7
;good morning.c,136 :: UART1_Init(9600);
BSF BAUDCON+0, 3, 0
CLRF SPBRGH+0
MOVLW 106
MOVWF SPBRG+0
BSF TXSTA+0, 2, 0
CALL _UART1_Init+0, 0
;good morning.c,137 :: delay_us(100); //Delay for UART to become stable
MOVLW 34
MOVWF R13, 0
L_main10:
DECFSZ R13, 1, 1
BRA L_main10
;good morning.c,138 :: while(1)
L_main11:
;good morning.c,141 :: if (UART1_Data_Ready()) // Bluetooth data recieve
CALL _UART1_Data_Ready+0, 0
MOVF R0, 1
BTFSC STATUS+0, 2
GOTO L_main13
;good morning.c,143 :: ch[size1] = UART1_Read();
MOVLW _ch+0
ADDWF _size1+0, 0
MOVWF FLOC__main+0
MOVLW hi_addr(_ch+0)
ADDWFC _size1+1, 0
MOVWF FLOC__main+1
CALL _UART1_Read+0, 0
MOVFF FLOC__main+0, FSR1
MOVFF FLOC__main+1, FSR1H
MOVF R0, 0
MOVWF POSTINC1+0
;good morning.c,144 :: ch[size1+1] = '\0';
MOVLW 1
ADDWF _size1+0, 0
MOVWF R0
MOVLW 0
ADDWFC _size1+1, 0
MOVWF R1
MOVLW _ch+0
ADDWF R0, 0
MOVWF FSR1
MOVLW hi_addr(_ch+0)
ADDWFC R1, 0
MOVWF FSR1H
CLRF POSTINC1+0
;good morning.c,145 :: size1++;
INFSNZ _size1+0, 1
INCF _size1+1, 1
;good morning.c,146 :: if(size1>=20)
MOVLW 128
XORWF _size1+1, 0
MOVWF R0
MOVLW 128
SUBWF R0, 0
BTFSS STATUS+0, 2
GOTO L__main92
MOVLW 20
SUBWF _size1+0, 0
L__main92:
BTFSS STATUS+0, 0
GOTO L_main14
;good morning.c,148 :: size1=0;
CLRF _size1+0
CLRF _size1+1
;good morning.c,149 :: }
L_main14:
;good morning.c,150 :: }
L_main13:
;good morning.c,162 :: t=30; //calculating time delay
MOVLW 30
MOVWF _t+0
MOVLW 0
MOVWF _t+1
;good morning.c,168 :: if(size1==0)
MOVLW 0
XORWF _size1+1, 0
BTFSS STATUS+0, 2
GOTO L__main93
MOVLW 0
XORWF _size1+0, 0
L__main93:
BTFSS STATUS+0, 2
GOTO L_main15
;good morning.c,170 :: hello_world(t);
MOVF _t+0, 0
MOVWF FARG_hello_world_t+0
MOVF _t+1, 0
MOVWF FARG_hello_world_t+1
CALL _hello_world+0, 0
;good morning.c,171 :: }
GOTO L_main16
L_main15:
;good morning.c,175 :: for(i=0;i<20;i++)
CLRF _i+0
CLRF _i+1
L_main17:
MOVLW 128
XORWF _i+1, 0
MOVWF R0
MOVLW 128
SUBWF R0, 0
BTFSS STATUS+0, 2
GOTO L__main94
MOVLW 20
SUBWF _i+0, 0
L__main94:
BTFSC STATUS+0, 0
GOTO L_main18
;good morning.c,177 :: switch(ch[i]) //Identifing the letter
MOVLW _ch+0
ADDWF _i+0, 0
MOVWF FLOC__main+0
MOVLW hi_addr(_ch+0)
ADDWFC _i+1, 0
MOVWF FLOC__main+1
GOTO L_main20
;good morning.c,179 :: case 'a':
L_main22:
;good morning.c,180 :: case 'A':
L_main23:
;good morning.c,182 :: show(AA,t);
MOVLW _AA+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_AA+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,183 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,184 :: break;
GOTO L_main21
;good morning.c,186 :: case 'b':
L_main24:
;good morning.c,187 :: case 'B':
L_main25:
;good morning.c,189 :: show(BB,t);
MOVLW _BB+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_BB+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,190 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,191 :: break;
GOTO L_main21
;good morning.c,193 :: case 'c':
L_main26:
;good morning.c,194 :: case 'C':
L_main27:
;good morning.c,196 :: show(CC,t);
MOVLW _CC+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_CC+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,197 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,198 :: break;
GOTO L_main21
;good morning.c,200 :: case 'd':
L_main28:
;good morning.c,201 :: case 'D':
L_main29:
;good morning.c,203 :: show(DD,t);
MOVLW _DD+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_DD+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,204 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,205 :: break;
GOTO L_main21
;good morning.c,207 :: case 'e':
L_main30:
;good morning.c,208 :: case 'E':
L_main31:
;good morning.c,210 :: show(EE,t);
MOVLW _EE+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_EE+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,211 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,212 :: break;
GOTO L_main21
;good morning.c,214 :: case 'f':
L_main32:
;good morning.c,215 :: case 'F':
L_main33:
;good morning.c,217 :: show(FF,t);
MOVLW _FF+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_FF+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,218 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,219 :: break;
GOTO L_main21
;good morning.c,221 :: case 'g':
L_main34:
;good morning.c,222 :: case 'G':
L_main35:
;good morning.c,224 :: show(GG,t);
MOVLW _GG+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_GG+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,225 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,226 :: break;
GOTO L_main21
;good morning.c,228 :: case 'h':
L_main36:
;good morning.c,229 :: case 'H':
L_main37:
;good morning.c,231 :: show(HH,t);
MOVLW _HH+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_HH+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,232 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,233 :: break;
GOTO L_main21
;good morning.c,235 :: case 'i':
L_main38:
;good morning.c,236 :: case 'I':
L_main39:
;good morning.c,238 :: show(II,t);
MOVLW _II+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_II+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,239 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,240 :: break;
GOTO L_main21
;good morning.c,242 :: case 'j':
L_main40:
;good morning.c,243 :: case 'J':
L_main41:
;good morning.c,245 :: show(JJ,t);
MOVLW _JJ+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_JJ+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,246 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,247 :: break;
GOTO L_main21
;good morning.c,249 :: case 'k':
L_main42:
;good morning.c,250 :: case 'K':
L_main43:
;good morning.c,252 :: show(KK,t);
MOVLW _KK+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_KK+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,253 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,254 :: break;
GOTO L_main21
;good morning.c,256 :: case 'l':
L_main44:
;good morning.c,257 :: case 'L':
L_main45:
;good morning.c,259 :: show(LL,t);
MOVLW _LL+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_LL+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,260 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,261 :: break;
GOTO L_main21
;good morning.c,263 :: case 'm':
L_main46:
;good morning.c,264 :: case 'M':
L_main47:
;good morning.c,266 :: show(MM,t);
MOVLW _MM+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_MM+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,267 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,268 :: break;
GOTO L_main21
;good morning.c,270 :: case 'n':
L_main48:
;good morning.c,271 :: case 'N':
L_main49:
;good morning.c,273 :: show(NN,t);
MOVLW _NN+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_NN+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,274 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,275 :: break;
GOTO L_main21
;good morning.c,277 :: case 'o':
L_main50:
;good morning.c,278 :: case 'O':
L_main51:
;good morning.c,280 :: show(OO,t);
MOVLW _OO+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_OO+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,281 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,282 :: break;
GOTO L_main21
;good morning.c,284 :: case 'p':
L_main52:
;good morning.c,285 :: case 'P':
L_main53:
;good morning.c,287 :: show(PP,t);
MOVLW _PP+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_PP+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,288 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,289 :: break;
GOTO L_main21
;good morning.c,291 :: case 'q':
L_main54:
;good morning.c,292 :: case 'Q':
L_main55:
;good morning.c,294 :: show(QQ,t);
MOVLW _QQ+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_QQ+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,295 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,296 :: break;
GOTO L_main21
;good morning.c,298 :: case 'r':
L_main56:
;good morning.c,299 :: case 'R':
L_main57:
;good morning.c,301 :: show(RR,t);
MOVLW _RR+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_RR+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,302 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,303 :: break;
GOTO L_main21
;good morning.c,305 :: case 's':
L_main58:
;good morning.c,306 :: case 'S':
L_main59:
;good morning.c,308 :: show(SS,t);
MOVLW _SS+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_SS+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,309 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,310 :: break;
GOTO L_main21
;good morning.c,312 :: case 't':
L_main60:
;good morning.c,313 :: case 'T':
L_main61:
;good morning.c,315 :: show(TT,t);
MOVLW _TT+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_TT+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,316 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,317 :: break;
GOTO L_main21
;good morning.c,319 :: case 'u':
L_main62:
;good morning.c,320 :: case 'U':
L_main63:
;good morning.c,322 :: show(UU,t);
MOVLW _UU+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_UU+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,323 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,324 :: break;
GOTO L_main21
;good morning.c,326 :: case 'v':
L_main64:
;good morning.c,327 :: case 'V':
L_main65:
;good morning.c,329 :: show(VV,t);
MOVLW _VV+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_VV+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,330 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,331 :: break;
GOTO L_main21
;good morning.c,333 :: case 'w':
L_main66:
;good morning.c,334 :: case 'W':
L_main67:
;good morning.c,336 :: show(WW,t);
MOVLW _WW+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_WW+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,337 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,338 :: break;
GOTO L_main21
;good morning.c,340 :: case 'x':
L_main68:
;good morning.c,341 :: case 'X':
L_main69:
;good morning.c,343 :: show(XX,t);
MOVLW _XX+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_XX+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,344 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,345 :: break;
GOTO L_main21
;good morning.c,347 :: case 'y':
L_main70:
;good morning.c,348 :: case 'Y':
L_main71:
;good morning.c,350 :: show(YY,t);
MOVLW _YY+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_YY+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,351 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,352 :: break;
GOTO L_main21
;good morning.c,354 :: case 'z':
L_main72:
;good morning.c,355 :: case 'Z':
L_main73:
;good morning.c,357 :: show(ZZ,t);
MOVLW _ZZ+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_ZZ+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,358 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,359 :: break;
GOTO L_main21
;good morning.c,361 :: case ' ':
L_main74:
;good morning.c,363 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,364 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,365 :: break;
GOTO L_main21
;good morning.c,367 :: case '0':
L_main75:
;good morning.c,369 :: show(Zero,t);
MOVLW _Zero+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Zero+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,370 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,371 :: break;
GOTO L_main21
;good morning.c,373 :: case '1':
L_main76:
;good morning.c,375 :: show(One,t);
MOVLW _One+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_One+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,376 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,377 :: break;
GOTO L_main21
;good morning.c,379 :: case '2':
L_main77:
;good morning.c,381 :: show(Two,t);
MOVLW _Two+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Two+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,382 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,383 :: break;
GOTO L_main21
;good morning.c,385 :: case '3':
L_main78:
;good morning.c,387 :: show(Three,t);
MOVLW _Three+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Three+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,388 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,389 :: break;
GOTO L_main21
;good morning.c,391 :: case '4':
L_main79:
;good morning.c,393 :: show(Four,t);
MOVLW _Four+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Four+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,394 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,395 :: break;
GOTO L_main21
;good morning.c,397 :: case '5':
L_main80:
;good morning.c,399 :: show(Five,t);
MOVLW _Five+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Five+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,400 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,401 :: break;
GOTO L_main21
;good morning.c,403 :: case '6':
L_main81:
;good morning.c,405 :: show(Six,t);
MOVLW _Six+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Six+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,406 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,407 :: break;
GOTO L_main21
;good morning.c,409 :: case '7':
L_main82:
;good morning.c,411 :: show(Seven,t);
MOVLW _Seven+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Seven+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,412 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,413 :: break;
GOTO L_main21
;good morning.c,415 :: case '8':
L_main83:
;good morning.c,417 :: show(Eight,t);
MOVLW _Eight+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Eight+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,418 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,419 :: break;
GOTO L_main21
;good morning.c,421 :: case '9':
L_main84:
;good morning.c,423 :: show(Nine,t);
MOVLW _Nine+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Nine+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,424 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,425 :: break;
GOTO L_main21
;good morning.c,427 :: default:
L_main85:
;good morning.c,429 :: show(Space,t);
MOVLW _Space+0
MOVWF FARG_show_image+0
MOVLW hi_addr(_Space+0)
MOVWF FARG_show_image+1
MOVF _t+0, 0
MOVWF FARG_show_t+0
MOVF _t+1, 0
MOVWF FARG_show_t+1
CALL _show+0, 0
;good morning.c,430 :: elay_us(t);
MOVF _t+0, 0
MOVWF FARG_elay_us_n+0
MOVF _t+1, 0
MOVWF FARG_elay_us_n+1
CALL _elay_us+0, 0
;good morning.c,431 :: break;
GOTO L_main21
;good morning.c,433 :: }
L_main20:
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 97
BTFSC STATUS+0, 2
GOTO L_main22
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 65
BTFSC STATUS+0, 2
GOTO L_main23
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 98
BTFSC STATUS+0, 2
GOTO L_main24
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 66
BTFSC STATUS+0, 2
GOTO L_main25
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 99
BTFSC STATUS+0, 2
GOTO L_main26
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 67
BTFSC STATUS+0, 2
GOTO L_main27
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 100
BTFSC STATUS+0, 2
GOTO L_main28
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 68
BTFSC STATUS+0, 2
GOTO L_main29
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 101
BTFSC STATUS+0, 2
GOTO L_main30
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 69
BTFSC STATUS+0, 2
GOTO L_main31
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 102
BTFSC STATUS+0, 2
GOTO L_main32
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 70
BTFSC STATUS+0, 2
GOTO L_main33
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 103
BTFSC STATUS+0, 2
GOTO L_main34
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 71
BTFSC STATUS+0, 2
GOTO L_main35
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 104
BTFSC STATUS+0, 2
GOTO L_main36
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 72
BTFSC STATUS+0, 2
GOTO L_main37
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 105
BTFSC STATUS+0, 2
GOTO L_main38
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 73
BTFSC STATUS+0, 2
GOTO L_main39
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 106
BTFSC STATUS+0, 2
GOTO L_main40
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 74
BTFSC STATUS+0, 2
GOTO L_main41
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 107
BTFSC STATUS+0, 2
GOTO L_main42
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 75
BTFSC STATUS+0, 2
GOTO L_main43
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 108
BTFSC STATUS+0, 2
GOTO L_main44
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 76
BTFSC STATUS+0, 2
GOTO L_main45
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 109
BTFSC STATUS+0, 2
GOTO L_main46
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 77
BTFSC STATUS+0, 2
GOTO L_main47
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 110
BTFSC STATUS+0, 2
GOTO L_main48
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 78
BTFSC STATUS+0, 2
GOTO L_main49
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 111
BTFSC STATUS+0, 2
GOTO L_main50
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 79
BTFSC STATUS+0, 2
GOTO L_main51
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 112
BTFSC STATUS+0, 2
GOTO L_main52
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 80
BTFSC STATUS+0, 2
GOTO L_main53
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 113
BTFSC STATUS+0, 2
GOTO L_main54
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 81
BTFSC STATUS+0, 2
GOTO L_main55
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 114
BTFSC STATUS+0, 2
GOTO L_main56
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 82
BTFSC STATUS+0, 2
GOTO L_main57
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 115
BTFSC STATUS+0, 2
GOTO L_main58
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 83
BTFSC STATUS+0, 2
GOTO L_main59
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 116
BTFSC STATUS+0, 2
GOTO L_main60
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 84
BTFSC STATUS+0, 2
GOTO L_main61
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 117
BTFSC STATUS+0, 2
GOTO L_main62
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 85
BTFSC STATUS+0, 2
GOTO L_main63
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 118
BTFSC STATUS+0, 2
GOTO L_main64
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 86
BTFSC STATUS+0, 2
GOTO L_main65
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 119
BTFSC STATUS+0, 2
GOTO L_main66
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 87
BTFSC STATUS+0, 2
GOTO L_main67
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 120
BTFSC STATUS+0, 2
GOTO L_main68
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 88
BTFSC STATUS+0, 2
GOTO L_main69
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 121
BTFSC STATUS+0, 2
GOTO L_main70
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 89
BTFSC STATUS+0, 2
GOTO L_main71
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 122
BTFSC STATUS+0, 2
GOTO L_main72
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 90
BTFSC STATUS+0, 2
GOTO L_main73
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 32
BTFSC STATUS+0, 2
GOTO L_main74
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 48
BTFSC STATUS+0, 2
GOTO L_main75
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 49
BTFSC STATUS+0, 2
GOTO L_main76
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 50
BTFSC STATUS+0, 2
GOTO L_main77
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 51
BTFSC STATUS+0, 2
GOTO L_main78
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 52
BTFSC STATUS+0, 2
GOTO L_main79
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 53
BTFSC STATUS+0, 2
GOTO L_main80
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 54
BTFSC STATUS+0, 2
GOTO L_main81
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 55
BTFSC STATUS+0, 2
GOTO L_main82
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 56
BTFSC STATUS+0, 2
GOTO L_main83
MOVFF FLOC__main+0, FSR0
MOVFF FLOC__main+1, FSR0H
MOVF POSTINC0+0, 0
XORLW 57
BTFSC STATUS+0, 2
GOTO L_main84
GOTO L_main85
L_main21:
;good morning.c,175 :: for(i=0;i<20;i++)
INFSNZ _i+0, 1
INCF _i+1, 1
;good morning.c,434 :: }
GOTO L_main17
L_main18:
;good morning.c,438 :: }
L_main16:
;good morning.c,439 :: }
GOTO L_main11
;good morning.c,440 :: }
L_end_main:
GOTO $+0
; end of _main
|
src/Internals/protypo-code_trees-interpreter-compiled_functions.ads | fintatarta/protypo | 0 | 22851 | <reponame>fintatarta/protypo
with Protypo.Api.Engine_Values.Handlers;
with Protypo.Api.Engine_Values.Parameter_Lists;
private package Protypo.Code_Trees.Interpreter.Compiled_Functions is
-- type Compiled_Function is
-- new Api.Engine_Values.Function_Interface
-- with
-- private;
type Compiled_Function is
new Api.Engine_Values.handlers.Function_Interface
with
record
Function_Body : Node_Vectors.Vector;
Parameters : Parameter_Specs;
Status : Interpreter_Access;
end record;
overriding function Process (Fun : Compiled_Function;
Parameter : Engine_Value_vectors.Vector)
return Engine_Value_vectors.Vector;
overriding function Signature (Fun : Compiled_Function)
return Api.Engine_Values.Parameter_Lists.Parameter_Signature;
-- function Create (Function_Body : Node_Vectors.Vector) return Integer;
end Protypo.Code_Trees.Interpreter.Compiled_Functions;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/wide_boolean_pkg.adb | best08618/asylo | 7 | 281 | <reponame>best08618/asylo
package body Wide_Boolean_Pkg is
procedure Modify (LH : in out TUINT32; LB : in out TBOOL) is
begin
LH := 16#12345678#;
LB := TRUE;
end;
end Wide_Boolean_Pkg;
|
core/lib/groups/Isomorphism.agda | timjb/HoTT-Agda | 0 | 7207 | <reponame>timjb/HoTT-Agda
{-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.Equivalence2
open import lib.Function2
open import lib.NType2
open import lib.types.Group
open import lib.types.Pi
open import lib.types.Subtype
open import lib.types.Truncation
open import lib.groups.Homomorphism
open import lib.groups.SubgroupProp
module lib.groups.Isomorphism where
GroupStructureIso : ∀ {i j} {GEl : Type i} {HEl : Type j}
(GS : GroupStructure GEl) (HS : GroupStructure HEl) → Type (lmax i j)
GroupStructureIso GS HS = Σ (GroupStructureHom GS HS) (λ φ → is-equiv (GroupStructureHom.f φ))
infix 30 _≃ᴳˢ_ -- [ˢ] for structures
_≃ᴳˢ_ = GroupStructureIso
GroupIso : ∀ {i j} (G : Group i) (H : Group j) → Type (lmax i j)
GroupIso G H = Σ (G →ᴳ H) (λ φ → is-equiv (GroupHom.f φ))
infix 30 _≃ᴳ_
_≃ᴳ_ = GroupIso
≃ᴳˢ-to-≃ᴳ : ∀ {i j} {G : Group i} {H : Group j}
→ (Group.group-struct G ≃ᴳˢ Group.group-struct H) → (G ≃ᴳ H)
≃ᴳˢ-to-≃ᴳ (φ , φ-is-equiv) = →ᴳˢ-to-→ᴳ φ , φ-is-equiv
≃-to-≃ᴳ : ∀ {i j} {G : Group i} {H : Group j} (e : Group.El G ≃ Group.El H)
→ preserves-comp (Group.comp G) (Group.comp H) (–> e) → G ≃ᴳ H
≃-to-≃ᴳ (f , f-is-equiv) pres-comp = group-hom f pres-comp , f-is-equiv
≃-to-≃ᴳˢ : ∀ {i j} {GEl : Type i} {HEl : Type j}
{GS : GroupStructure GEl} {HS : GroupStructure HEl} (e : GEl ≃ HEl)
→ preserves-comp (GroupStructure.comp GS) (GroupStructure.comp HS) (–> e)
→ GS ≃ᴳˢ HS
≃-to-≃ᴳˢ (f , f-is-equiv) pres-comp = group-structure-hom f pres-comp , f-is-equiv
private
inverse-preserves-comp : ∀ {i j} {A : Type i} {B : Type j}
(A-comp : A → A → A) (B-comp : B → B → B) {f : A → B} (f-ie : is-equiv f)
→ preserves-comp A-comp B-comp f
→ preserves-comp B-comp A-comp (is-equiv.g f-ie)
inverse-preserves-comp Ac Bc ie pc b₁ b₂ = let open is-equiv ie in
ap2 (λ w₁ w₂ → g (Bc w₁ w₂)) (! (f-g b₁)) (! (f-g b₂))
∙ ! (ap g (pc (g b₁) (g b₂)))
∙ g-f (Ac (g b₁) (g b₂))
module GroupStructureIso {i j} {GEl : Type i} {HEl : Type j}
{GS : GroupStructure GEl} {HS : GroupStructure HEl}
(iso : GroupStructureIso GS HS) where
f-shom : GS →ᴳˢ HS
f-shom = fst iso
open GroupStructureHom {GS = GS} {HS = HS} f-shom public
f-is-equiv : is-equiv f
f-is-equiv = snd iso
open is-equiv f-is-equiv public
f-equiv : GEl ≃ HEl
f-equiv = f , f-is-equiv
g-shom : HS →ᴳˢ GS
g-shom = group-structure-hom g (inverse-preserves-comp (GroupStructure.comp GS) (GroupStructure.comp HS) f-is-equiv pres-comp)
g-is-equiv : is-equiv g
g-is-equiv = is-equiv-inverse f-is-equiv
g-equiv : HEl ≃ GEl
g-equiv = g , g-is-equiv
module GroupIso {i j} {G : Group i} {H : Group j} (iso : GroupIso G H) where
f-hom : G →ᴳ H
f-hom = fst iso
open GroupHom {G = G} {H = H} f-hom public
f-is-equiv : is-equiv f
f-is-equiv = snd iso
open is-equiv f-is-equiv public
f-equiv : Group.El G ≃ Group.El H
f-equiv = f , f-is-equiv
g-hom : H →ᴳ G
g-hom = group-hom g (inverse-preserves-comp (Group.comp G) (Group.comp H) f-is-equiv pres-comp)
g-is-equiv : is-equiv g
g-is-equiv = is-equiv-inverse f-is-equiv
g-equiv : Group.El H ≃ Group.El G
g-equiv = g , g-is-equiv
idiso : ∀ {i} (G : Group i) → (G ≃ᴳ G)
idiso G = idhom G , idf-is-equiv _
idsiso : ∀ {i} {GEl : Type i} (GS : GroupStructure GEl) → (GS ≃ᴳˢ GS)
idsiso GS = idshom GS , idf-is-equiv _
{- equality of isomomorphisms -}
abstract
group-hom=-to-iso= : ∀ {i j} {G : Group i} {H : Group j} {φ ψ : G ≃ᴳ H}
→ GroupIso.f-hom φ == GroupIso.f-hom ψ → φ == ψ
group-hom=-to-iso= = Subtype=-out (is-equiv-prop ∘sub GroupHom.f)
group-iso= : ∀ {i j} {G : Group i} {H : Group j} {φ ψ : G ≃ᴳ H}
→ GroupIso.f φ == GroupIso.f ψ → φ == ψ
group-iso= {H = H} p = group-hom=-to-iso= $ group-hom= p
{- compositions -}
infixr 80 _∘eᴳˢ_ _∘eᴳ_
_∘eᴳˢ_ : ∀ {i j k} {GEl : Type i} {HEl : Type j} {KEl : Type k}
{GS : GroupStructure GEl} {HS : GroupStructure HEl} {KS : GroupStructure KEl}
→ HS ≃ᴳˢ KS → GS ≃ᴳˢ HS → GS ≃ᴳˢ KS
(φ₂ , ie₂) ∘eᴳˢ (φ₁ , ie₁) = (φ₂ ∘ᴳˢ φ₁ , ie₂ ∘ise ie₁)
_∘eᴳ_ : ∀ {i j k} {G : Group i} {H : Group j} {K : Group k}
→ H ≃ᴳ K → G ≃ᴳ H → G ≃ᴳ K
(φ₂ , ie₂) ∘eᴳ (φ₁ , ie₁) = (φ₂ ∘ᴳ φ₁ , ie₂ ∘ise ie₁)
infixr 10 _≃ᴳˢ⟨_⟩_ _≃ᴳ⟨_⟩_
infix 15 _≃ᴳˢ∎ _≃ᴳ∎
_≃ᴳˢ⟨_⟩_ : ∀ {i j k} {GEl : Type i} {HEl : Type j} {KEl : Type k}
(GS : GroupStructure GEl) {HS : GroupStructure HEl} {KS : GroupStructure KEl}
→ GS ≃ᴳˢ HS → HS ≃ᴳˢ KS → GS ≃ᴳˢ KS
GS ≃ᴳˢ⟨ e₁ ⟩ e₂ = e₂ ∘eᴳˢ e₁
_≃ᴳ⟨_⟩_ : ∀ {i j k} (G : Group i) {H : Group j} {K : Group k}
→ G ≃ᴳ H → H ≃ᴳ K → G ≃ᴳ K
G ≃ᴳ⟨ e₁ ⟩ e₂ = e₂ ∘eᴳ e₁
_≃ᴳˢ∎ : ∀ {i} {GEl : Type i} (GS : GroupStructure GEl) → (GS ≃ᴳˢ GS)
_≃ᴳˢ∎ = idsiso
_≃ᴳ∎ : ∀ {i} (G : Group i) → (G ≃ᴳ G)
_≃ᴳ∎ = idiso
infixl 120 _⁻¹ᴳˢ _⁻¹ᴳ
_⁻¹ᴳˢ : ∀ {i j} {GEl : Type i} {HEl : Type j} {GS : GroupStructure GEl} {HS : GroupStructure HEl}
→ GS ≃ᴳˢ HS → HS ≃ᴳˢ GS
_⁻¹ᴳˢ {GS = GS} {HS} (φ , ie) = GroupStructureIso.g-shom (φ , ie) , is-equiv-inverse ie
_⁻¹ᴳ : ∀ {i j} {G : Group i} {H : Group j} → G ≃ᴳ H → H ≃ᴳ G
_⁻¹ᴳ {G = G} {H = H} (φ , ie) = GroupIso.g-hom (φ , ie) , is-equiv-inverse ie
{- mimicking notations for equivalences -}
–>ᴳ : ∀ {i j} {G : Group i} {H : Group j} → (G ≃ᴳ H) → (G →ᴳ H)
–>ᴳ = GroupIso.f-hom
<–ᴳ : ∀ {i j} {G : Group i} {H : Group j} → (G ≃ᴳ H) → (H →ᴳ G)
<–ᴳ = GroupIso.g-hom
{- univalence -}
module _ {i} {G H : Group i} (iso : GroupIso G H) where
private
module G = Group G
module H = Group H
open module φ = GroupIso {G = G} {H = H} iso
El= = ua f-equiv
private
ap3-lemma : ∀ {i j k l} {C : Type i} {D : C → Type j} {E : C → Type k}
{F : Type l} {c₁ c₂ : C} {d₁ : D c₁} {d₂ : D c₂} {e₁ : E c₁} {e₂ : E c₂}
(f : (c : C) → D c → E c → F) (p : c₁ == c₂)
→ (d₁ == d₂ [ D ↓ p ]) → (e₁ == e₂ [ E ↓ p ])
→ (f c₁ d₁ e₁ == f c₂ d₂ e₂)
ap3-lemma f idp idp idp = idp
ap3-lemma-El : ∀ {i} {G H : Group i}
(p : Group.El G == Group.El H)
(q : Group.El-level G == Group.El-level H [ _ ↓ p ])
(r : Group.group-struct G == Group.group-struct H [ _ ↓ p ])
→ ap Group.El (ap3-lemma (λ a b c → group a {{b}} c) p q r) == p
ap3-lemma-El idp idp idp = idp
{- a homomorphism which is an equivalence gives a path between groups -}
abstract
uaᴳ : G == H
uaᴳ =
ap3-lemma (λ a b c → group a {{b}} c)
El=
prop-has-all-paths-↓
(↓-group-structure= El= ident= inv= comp=)
where
ident= : G.ident == H.ident [ (λ C → C) ↓ El= ]
ident= = ↓-idf-ua-in _ pres-ident
inv= : G.inv == H.inv [ (λ C → C → C) ↓ El= ]
inv= =
↓-→-from-transp $ λ= λ a →
transport (λ C → C) El= (G.inv a)
=⟨ to-transp (↓-idf-ua-in _ idp) ⟩
f (G.inv a)
=⟨ pres-inv a ⟩
H.inv (f a)
=⟨ ap H.inv (! (to-transp (↓-idf-ua-in _ idp))) ⟩
H.inv (transport (λ C → C) El= a) =∎
comp=' : (a : G.El)
→ G.comp a == H.comp (f a) [ (λ C → C → C) ↓ El= ]
comp=' a =
↓-→-from-transp $ λ= λ b →
transport (λ C → C) El= (G.comp a b)
=⟨ to-transp (↓-idf-ua-in _ idp) ⟩
f (G.comp a b)
=⟨ pres-comp a b ⟩
H.comp (f a) (f b)
=⟨ ! (to-transp (↓-idf-ua-in _ idp))
|in-ctx (λ w → H.comp (f a) w) ⟩
H.comp (f a) (transport (λ C → C) El= b) =∎
comp= : G.comp == H.comp [ (λ C → C → C → C) ↓ El= ]
comp= =
↓-→-from-transp $ λ= λ a →
transport (λ C → C → C) El= (G.comp a)
=⟨ to-transp (comp=' a) ⟩
H.comp (f a)
=⟨ ! (to-transp (↓-idf-ua-in _ idp)) |in-ctx (λ w → H.comp w) ⟩
H.comp (transport (λ C → C) El= a) =∎
-- XXX This stretches the naming convention a little bit.
El=-β : ap Group.El uaᴳ == El=
El=-β = ap3-lemma-El El= _ _
{- homomorphism from equality of groups -}
abstract
transp-El-pres-comp : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ preserves-comp (Group.comp (B a₁)) (Group.comp (B a₂)) (transport (Group.El ∘ B) p)
transp-El-pres-comp B idp g₁ g₂ = idp
transp!-El-pres-comp : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ preserves-comp (Group.comp (B a₂)) (Group.comp (B a₁)) (transport! (Group.El ∘ B) p)
transp!-El-pres-comp B idp h₁ h₂ = idp
transportᴳ : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ (B a₁ →ᴳ B a₂)
transportᴳ B p = record {f = transport (Group.El ∘ B) p; pres-comp = transp-El-pres-comp B p}
transport!ᴳ : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ (B a₂ →ᴳ B a₁)
transport!ᴳ B p = record {f = transport! (Group.El ∘ B) p; pres-comp = transp!-El-pres-comp B p}
abstract
transpᴳ-is-iso : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ is-equiv (GroupHom.f (transportᴳ B p))
transpᴳ-is-iso B idp = idf-is-equiv _
transp!ᴳ-is-iso : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ is-equiv (GroupHom.f (transport!ᴳ B p))
transp!ᴳ-is-iso B idp = idf-is-equiv _
transportᴳ-iso : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ B a₁ ≃ᴳ B a₂
transportᴳ-iso B p = transportᴳ B p , transpᴳ-is-iso B p
transport!ᴳ-iso : ∀ {i j} {A : Type i} (B : A → Group j) {a₁ a₂ : A} (p : a₁ == a₂)
→ B a₂ ≃ᴳ B a₁
transport!ᴳ-iso B p = transport!ᴳ B p , transp!ᴳ-is-iso B p
coeᴳ : ∀ {i} {G H : Group i} → G == H → (G →ᴳ H)
coeᴳ = transportᴳ (idf _)
coe!ᴳ : ∀ {i} {G H : Group i} → G == H → (H →ᴳ G)
coe!ᴳ = transport!ᴳ (idf _)
coeᴳ-iso : ∀ {i} {G H : Group i} → G == H → G ≃ᴳ H
coeᴳ-iso = transportᴳ-iso (idf _)
coe!ᴳ-iso : ∀ {i} {G H : Group i} → G == H → H ≃ᴳ G
coe!ᴳ-iso = transport!ᴳ-iso (idf _)
abstract
coeᴳ-β : ∀ {i} {G H : Group i} (iso : G ≃ᴳ H)
→ coeᴳ (uaᴳ iso) == GroupIso.f-hom iso
coeᴳ-β iso = group-hom= $
ap coe (El=-β iso)
∙ λ= (coe-β (GroupIso.f-equiv iso))
-- triviality
iso-preserves-trivial : ∀ {i j} {G : Group i} {H : Group j}
→ G ≃ᴳ H → is-trivialᴳ G → is-trivialᴳ H
iso-preserves-trivial iso G-is-trivial h =
! (GroupIso.f-g iso h)
∙ ap (GroupIso.f iso) (G-is-trivial _)
∙ GroupIso.pres-ident iso
iso-preserves'-trivial : ∀ {i j} {G : Group i} {H : Group j}
→ G ≃ᴳ H → is-trivialᴳ H → is-trivialᴳ G
iso-preserves'-trivial iso H-is-trivial g =
! (GroupIso.g-f iso g)
∙ ap (GroupIso.g iso) (H-is-trivial _)
∙ GroupHom.pres-ident (GroupIso.g-hom iso)
-- a surjective and injective homomorphism is an isomorphism
module _ {i j} {G : Group i} {H : Group j} (φ : G →ᴳ H)
(surj : is-surjᴳ φ) (inj : is-injᴳ φ) where
private
module G = Group G
module H = Group H
module φ = GroupHom φ
abstract
instance
image-prop : (h : H.El) → is-prop (hfiber φ.f h)
image-prop h = all-paths-is-prop λ {(g₁ , p₁) (g₂ , p₂) →
pair= (inj g₁ g₂ (p₁ ∙ ! p₂)) prop-has-all-paths-↓}
surjᴳ-and-injᴳ-is-equiv : is-equiv φ.f
surjᴳ-and-injᴳ-is-equiv = contr-map-is-equiv
(λ h → let (g₁ , p₁) = Trunc-rec (idf _) (surj h) in
has-level-in ((g₁ , p₁) , (λ {(g₂ , p₂) →
pair= (inj g₁ g₂ (p₁ ∙ ! p₂))
prop-has-all-paths-↓})))
surjᴳ-and-injᴳ-iso : G ≃ᴳ H
surjᴳ-and-injᴳ-iso = φ , surjᴳ-and-injᴳ-is-equiv
-- isomorphisms preserve abelianess.
module _ {i} {G H : Group i} (iso : G ≃ᴳ H) (G-abelian : is-abelian G) where
private
module G = Group G
module H = Group H
open GroupIso iso
abstract
iso-preserves-abelian : is-abelian H
iso-preserves-abelian h₁ h₂ =
H.comp h₁ h₂
=⟨ ap2 H.comp (! $ f-g h₁) (! $ f-g h₂) ⟩
H.comp (f (g h₁)) (f (g h₂))
=⟨ ! $ pres-comp (g h₁) (g h₂) ⟩
f (G.comp (g h₁) (g h₂))
=⟨ G-abelian (g h₁) (g h₂) |in-ctx f ⟩
f (G.comp (g h₂) (g h₁))
=⟨ pres-comp (g h₂) (g h₁) ⟩
H.comp (f (g h₂)) (f (g h₁))
=⟨ ap2 H.comp (f-g h₂) (f-g h₁) ⟩
H.comp h₂ h₁
=∎
pre∘ᴳ-iso : ∀ {i j k} {G : Group i} {H : Group j} (K : AbGroup k)
→ (G ≃ᴳ H) → (hom-group H K ≃ᴳ hom-group G K)
pre∘ᴳ-iso K iso = ≃-to-≃ᴳ (equiv to from to-from from-to) to-pres-comp where
to = GroupHom.f (pre∘ᴳ-hom K (–>ᴳ iso))
to-pres-comp = GroupHom.pres-comp (pre∘ᴳ-hom K (–>ᴳ iso))
from = GroupHom.f (pre∘ᴳ-hom K (<–ᴳ iso))
abstract
to-from : ∀ φ → to (from φ) == φ
to-from φ = group-hom= $ λ= λ g → ap (GroupHom.f φ) (GroupIso.g-f iso g)
from-to : ∀ φ → from (to φ) == φ
from-to φ = group-hom= $ λ= λ h → ap (GroupHom.f φ) (GroupIso.f-g iso h)
post∘ᴳ-iso : ∀ {i j k} (G : Group i) (H : AbGroup j) (K : AbGroup k)
→ (AbGroup.grp H ≃ᴳ AbGroup.grp K) → (hom-group G H ≃ᴳ hom-group G K)
post∘ᴳ-iso G H K iso = ≃-to-≃ᴳ (equiv to from to-from from-to) to-pres-comp where
to = GroupHom.f (post∘ᴳ-hom G H K (–>ᴳ iso))
to-pres-comp = GroupHom.pres-comp (post∘ᴳ-hom G H K(–>ᴳ iso))
from = GroupHom.f (post∘ᴳ-hom G K H (<–ᴳ iso))
abstract
to-from : ∀ φ → to (from φ) == φ
to-from φ = group-hom= $ λ= λ g → GroupIso.f-g iso (GroupHom.f φ g)
from-to : ∀ φ → from (to φ) == φ
from-to φ = group-hom= $ λ= λ h → GroupIso.g-f iso (GroupHom.f φ h)
|
programs/oeis/159/A159915.asm | neoneye/loda | 22 | 177313 | <filename>programs/oeis/159/A159915.asm
; A159915: a(n) = floor((n+1)/4)*floor(n/2).
; 0,0,0,1,2,2,3,6,8,8,10,15,18,18,21,28,32,32,36,45,50,50,55,66,72,72,78,91,98,98,105,120,128,128,136,153,162,162,171,190,200,200,210,231,242,242,253,276,288,288,300,325,338,338,351,378,392,392,406,435,450,450
mov $1,$0
div $0,2
add $1,1
div $1,4
mul $0,$1
|
src/dbgviewhook/gateway.asm | VollRagm/DiscordDbg | 12 | 96633 | <filename>src/dbgviewhook/gateway.asm<gh_stars>10-100
.model flat, C
Hook PROTO stdcall :DWORD
PUBLIC gateway
.code
gateway PROC C
push ecx
push eax
push esi ; esi contains the text and should be the arg
call Hook ; call our hook
pop eax
pop ecx
mov [ebp-120h], word ptr 5 ; original opcodes
ret ; return
gateway ENDP
END |
alloy4fun_models/trainstlt/models/3/xE5DyyN2EH4B9vJcv.als | Kaixi26/org.alloytools.alloy | 0 | 2154 | open main
pred idxE5DyyN2EH4B9vJcv_prop4 {
always all t: Train | always lone Train.pos
}
pred __repair { idxE5DyyN2EH4B9vJcv_prop4 }
check __repair { idxE5DyyN2EH4B9vJcv_prop4 <=> prop4o } |
programs/oeis/156/A156331.asm | neoneye/loda | 22 | 162862 | ; A156331: a(n)=8*A154811(n).
; 8,16,40,32,56,64,64,56,32,40,16,8,8,16,40,32,56,64,64,56,32,40,16,8,8,16,40,32,56,64,64,56,32,40,16,8,8,16,40,32,56,64,64,56,32,40,16,8,8,16,40,32,56,64,64,56,32,40,16,8,8,16,40,32,56,64,64,56,32,40,16,8,8,16,40
seq $0,154811 ; a(n) = Fibonacci(2n+1) mod 9.
mul $0,8
|
code/ValiantRefinement.agda | DSLsofMath/ValiantAgda | 3 | 5149 | open import Relation.Binary.PropositionalEquality using (_≡_; refl)
import Relation.Binary.EqReasoning as EqReasoning
open import Algebra.FunctionProperties using (LeftZero; RightZero)
open import Algebra.Structures using (module IsCommutativeMonoid;
IsCommutativeMonoid)
open import Data.Product
-- just to avoid clash with other commas
open import Data.Unit
import OrderLemmas
import Level
open import SemiNearRingRecords
open import Preliminaries
module ValiantRefinement where
record ClosedSemiNearRing : Set₁ where -- \structure{3}{|ClosedSemiNearRing|}
field
snr2 : SemiNearRing2 -- includes |s|, |u| and corresponding operations
open SemiNearRing2 snr2
Q : u → u → Set -- \structure{3.1}{Quadratic equation |Q| + properties}
Q w c = w +u c *u c ≃u c
Closure : u -> u -> Set
Closure w c = Least _≤u_ (Q w) c
field
entireQ : Entire Q
closure : u → u -- \structure{3.2}{Closure function and correctness}
closure = fun entireQ
closureHasAll : ∀ {w : u} → Q w (closure w)
closureHasAll = correct entireQ
field -- \structure{3.3}{Function for |L| and its correctness}
entireL : Entire3 L
completion : u → s → u → s
completion = fun3 entireL
completionHasAll : ∀ {a y b} → L a y b (completion a y b)
completionHasAll = correct3 entireL
field -- \structure{3.4}{Ordering properties of |L| and |Q|}
uniqueL : UniqueL
congL : CongL
completionMono : ∀ {a a' y y' b b'} → a ≤u a' → y ≤s y' → b ≤u b' →
completion a y b ≤s completion a' y' b'
closureIsLeast : {w : u} -> LowerBound _≤u_ (Q w) (closure w)
open OrderLemmas snr public
completionIsLeast : ∀ (a : u) (y : s) (b : u) -> LowerBounds (L a y b) (completion a y b)
completionIsLeast a y b z p = ≃sTo≤s (uniqueL completionHasAll p)
open SemiNearRing2 snr2 public
-- \structure{4}{2-by-2 block matrix, preserving |ClosedSemiNearRing|}
Square : ClosedSemiNearRing -> ClosedSemiNearRing
Square csnr = CSNR where
open ClosedSemiNearRing csnr
record S : Set where -- \structure{4.1}{Square matrix}
constructor ⟨_,_,_,_⟩
field
s00 : s; s01 : s
s10 : s; s11 : s
infix 4 ⟨_,_,_,_⟩
record U : Set where -- \structure{4.2}{Upper triangular matrix}
constructor ⟨_,_,•,_⟩
field
uu00 : u; us01 : s;
uu11 : u
infix 4 ⟨_,_,•,_⟩
_+S_ : S → S → S
_+S_ ⟨ a , b , c , d ⟩
⟨ a' , b' , c' , d' ⟩ =
⟨ a +s a' , b +s b' , c +s c' , d +s d' ⟩
_*S_ : S → S → S
_*S_ ⟨ a , b ,
c , d ⟩ ⟨ a' , b' ,
c' , d' ⟩ = ⟨ (a *s a') +s (b *s c') , (a *s b') +s (b *s d')
, (c *s a') +s (d *s c') , (c *s b') +s (d *s d') ⟩
infixl 6 _+S_
infixl 7 _*S_
zerS : S
zerS = ⟨ zers , zers ,
zers , zers ⟩
_+U_ : U → U → U
_+U_ ⟨ xl , xm ,•, xr ⟩ ⟨ yl , ym ,•, yr ⟩ = ⟨ xl +u yl , xm +s ym ,•, xr +u yr ⟩
_*U_ : U → U → U
_*U_ ⟨ xl , xm
,•, xr ⟩ ⟨ yl , ym
,•, yr ⟩ = ⟨ xl *u yl , xl u*s ym +s xm s*u yr
,•, xr *u yr ⟩
_≃S_ : S → S → Set
_≃S_ ⟨ a , b , c , d ⟩ ⟨ a' , b' , c' , d' ⟩ = (a ≃s a') × (b ≃s b')
× (c ≃s c') × (d ≃s d')
infix 4 _≃S_
U2S : U → S
U2S ⟨ uu00 , us01 ,•, uu11 ⟩ = ⟨ u2s uu00 , us01 ,
zers , u2s uu11 ⟩
reflS : {x : S} → x ≃S x -- \structure{4.3}{Laws}
reflS = refls , refls ,
refls , refls
symS : {i j : S} → i ≃S j → j ≃S i
symS (p00 , p01 , p10 , p11) = ( syms p00 , syms p01 , syms p10 , syms p11 )
transS : {i j k : S} → i ≃S j → j ≃S k → i ≃S k
transS (p00 , p01 , p10 , p11) (q00 , q01 , q10 , q11) =
( transs p00 q00 , transs p01 q01 , transs p10 q10 , transs p11 q11 )
assocS : (x y z : S) → (x +S y) +S z ≃S x +S (y +S z)
assocS ⟨ x00 , x01 , x10 , x11 ⟩
⟨ y00 , y01 , y10 , y11 ⟩
⟨ z00 , z01 , z10 , z11 ⟩ =
( assocs x00 y00 z00 , assocs x01 y01 z01 ,
assocs x10 y10 z10 , assocs x11 y11 z11 )
_<+S>_ : {a1 a2 b1 b2 : S} → a1 ≃S a2 → b1 ≃S b2 → a1 +S b1 ≃S a2 +S b2
_<+S>_ (p00 , p01 , p10 , p11) (q00 , q01 , q10 , q11) =
( (p00 <+> q00) , (p01 <+> q01) ,
(p10 <+> q10) , (p11 <+> q11) )
_<*S>_ : {x1 y1 x2 y2 : S} → x1 ≃S x2 → y1 ≃S y2 → x1 *S y1 ≃S x2 *S y2
_<*S>_ (p00 , p01 , p10 , p11) (q00 , q01 , q10 , q11) =
( (p00 <*> q00) <+> (p01 <*> q10) , (p00 <*> q01) <+> (p01 <*> q11) ,
(p10 <*> q00) <+> (p11 <*> q10) , (p10 <*> q01) <+> (p11 <*> q11) )
swapMid : ∀ {a b c d} → (a +s b) +s (c +s d)
≃s (a +s c) +s (b +s d)
swapMid {a} {b} {c} {d}
= begin
(a +s b) +s (c +s d)
≈⟨ assocs _ _ _ ⟩
a +s (b +s (c +s d))
≈⟨ refls <+> sym (assocs _ _ _) ⟩
a +s ((b +s c) +s d)
≈⟨ refls <+> (comms _ _ <+> refls) ⟩
a +s ((c +s b) +s d)
≈⟨ refls <+> (assocs _ _ _) ⟩
a +s (c +s (b +s d))
≈⟨ sym (assocs _ _ _) ⟩
(a +s c) +s (b +s d)
∎
where open EqReasoning sSetoid
distlS : (x y z : S) → x *S (y +S z) ≃S x *S y +S x *S z
distlS _ _ _ = distrHelp , distrHelp , distrHelp , distrHelp
where distrHelp : ∀ {a b c d e f} → a *s (b +s c) +s d *s (e +s f)
≃s (a *s b +s d *s e) +s (a *s c +s d *s f)
distrHelp = transs (distl _ _ _ <+> distl _ _ _) swapMid
distrS : (x y z : S) → (y +S z) *S x ≃S y *S x +S z *S x
distrS _ _ _ = distrHelp , distrHelp , distrHelp , distrHelp
where distrHelp : ∀ {a b c d e f} → (a +s b) *s c +s (d +s e) *s f
≃s (a *s c +s d *s f) +s (b *s c +s e *s f)
distrHelp = transs (distr _ _ _ <+> distr _ _ _) swapMid
identityˡS : (x : S) → zerS +S x ≃S x
identityˡS ⟨ s00 , s01 , s10 , s11 ⟩ = identityˡs s00 , identityˡs s01 , identityˡs s10 , identityˡs s11
commS : (x y : S) → x +S y ≃S y +S x
commS ⟨ x00 , x01 , x10 , x11 ⟩ ⟨ y00 , y01 , y10 , y11 ⟩ = (comms x00 y00 , comms x01 y01 ,
comms x10 y10 , comms x11 y11 )
idemS : (x : S) → x +S x ≃S x
idemS ⟨ x00 , x01 , x10 , x11 ⟩ = ( idem x00 , idem x01 , idem x10 , idem x11 )
open import ZeroLemmas snr
zeroˡS : LeftZero _≃S_ zerS _*S_
zeroˡS ⟨ s00 , s01 , s10 , s11 ⟩ = ( zeroˡLemma s00 s10 , zeroˡLemma s01 s11 , zeroˡLemma s00 s10 , zeroˡLemma s01 s11)
zeroʳS : RightZero _≃S_ zerS _*S_
zeroʳS ⟨ s00 , s01 , s10 , s11 ⟩ = ( zeroʳLemma s00 s01 , zeroʳLemma s00 s01 , zeroʳLemma s10 s11 , zeroʳLemma s10 s11)
isCommMonS : IsCommutativeMonoid _≃S_ _+S_ zerS
isCommMonS = record {
isSemigroup = record {
isEquivalence = record { refl = reflS; sym = symS; trans = transS };
assoc = assocS;
∙-cong = _<+S>_ };
identityˡ = identityˡS;
comm = commS }
SNR : SemiNearRingRecords.SemiNearRing
SNR = record {
s = S;
zers = zerS;
_+s_ = _+S_;
_≃s_ = _≃S_;
isCommMon = isCommMonS;
_*s_ = _*S_;
zeroˡ = zeroˡS;
zeroʳ = zeroʳS;
_<*>_ = _<*S>_;
distr = distrS;
distl = distlS;
idem = idemS
}
SNR2 : SemiNearRing2
SNR2 = record {
snr = SNR ;
u = U;
_+u_ = _+U_;
_*u_ = _*U_;
u2s = U2S }
_≃U_ : U → U → Set
_≃U_ = SemiNearRing2._≃u_ SNR2
_U*S_ : U → S → S
_U*S_ = SemiNearRing2._u*s_ SNR2
_S*U_ : S → U → S
_S*U_ = SemiNearRing2._s*u_ SNR2
congU : ∀ {x1 x2 y1 y2 z1 z2} → x1 ≃u x2 → y1 ≃s y2 → z1 ≃u z2 →
⟨ x1 , y1 ,•, z1 ⟩ ≃U ⟨ x2 , y2 ,•, z2 ⟩
congU p1 p2 p3 = (p1 , p2 , refls , p3)
congS : ∀ {x1 x2 y1 y2 z1 z2 w1 w2} →
x1 ≃s x2 → y1 ≃s y2 → z1 ≃s z2 → w1 ≃s w2 →
⟨ x1 , y1 , z1 , w1 ⟩ ≃S ⟨ x2 , y2 , z2 , w2 ⟩
congS p1 p2 p3 p4 = (p1 , p2 , p3 , p4)
QU = \ W C -> (W +U (C *U C)) ≃U C -- \structure{4.4}{Lifting |Q| and its proof}
entireQStep : ∀ W -> ∃ (QU W)
entireQStep W = C , proof where
C : U
C = _
open EqReasoning (SemiNearRing2.uSetoid SNR2)
proof : (W +U (C *U C)) ≃U C
proof = begin
(W +U (C *U C))
≡⟨ refl ⟩ -- expand matrix components
let ⟨ A , Y ,•, B ⟩ = W
⟨ A' , Y' ,•, B' ⟩ = C in
⟨ A , Y ,•, B ⟩ +U (⟨ A' , Y' ,•, B' ⟩ *U ⟨ A' , Y' ,•, B' ⟩)
≡⟨ refl ⟩ -- expand definition of |*U|
⟨ A , Y ,•, B ⟩ +U ⟨ A' *u A' , (A' u*s Y' +s Y' s*u B')
,•, B' *u B' ⟩
≡⟨ refl ⟩ -- by def. of |+U|
⟨ A +u A' *u A' , Y +s (A' u*s Y' +s Y' s*u B')
,•, B +u B' *u B' ⟩
≈⟨ congU closureHasAll completionHasAll closureHasAll ⟩
⟨ A' , Y' ,•, B' ⟩
≡⟨ refl ⟩
C
∎
entireQStep2 : ∀ W -> ∃ (QU W)
entireQStep2 W = C , proof where
C : U
C = let ⟨ A , Y ,•, B ⟩ = W
(A' , proofA) = entireQ A
(B' , proofB) = entireQ B
(Y' , proofY) = entireL A' Y B'
in ⟨ A' , Y' ,•, B' ⟩
open EqReasoning (SemiNearRing2.uSetoid SNR2)
proof : (W +U (C *U C)) ≃U C
proof = congU closureHasAll completionHasAll closureHasAll
_≤U_ = SemiNearRing2._≤u_ SNR2 -- \structure{4.5}{Lifting orders and their properties}
_≤S_ = SemiNearRing2._≤s_ SNR2
closureIsLeastS : ∀ {W} -> LowerBound _≤U_ (QU W) (fun entireQStep W)
closureIsLeastS Z QUWZ =
let ⟨ z00 , z01 ,•, z11 ⟩ = Z -- every matrix |Z|
( p00 , p01 , _ , p11) = QUWZ -- which satisfies |(QU W Z)|
q10 = identityˡs zers
q00 = closureIsLeast z00 p00 -- is bigger than |C = fun entireQStep W|
q11 = closureIsLeast z11 p11
vs01 = completionIsLeast _ _ _ z01 p01
mono01 = completionMono q00 (≃sTo≤s refls) q11
in ( q00 , ≤s-trans mono01 vs01
, q10 , q11 )
-- \structure{4.6}{Lifting the proof of |L|}
entireLS : ∀ (A : U) (Y : S) (B : U) → ∃ (\ X → Y +S (A U*S X +S X S*U B) ≃S X)
entireLS A Y B = X , proof where
X : S
X = _ -- filled in by unification with |Y +S (U2S A *S X +S X *S U2S B)|
proof : Y +S (U2S A *S X +S X *S U2S B) ≃S X
open EqReasoning (SemiNearRing2.sSetoid SNR2)
proof = -- continued below to fit the width of the paper (it is still in the |where| clause)
begin
(Y +S (A U*S X +S X S*U B) )
≡⟨ refl ⟩ -- name the components
let ⟨ a00 , a01 ,•, a11 ⟩ = A
⟨ b00 , b01 ,•, b11 ⟩ = B
⟨ y00 , y01 , y10 , y11 ⟩ = Y
⟨ x00 , x01 , x10 , x11 ⟩ = X
in Y +S (A U*S X +S X S*U B)
≡⟨ refl ⟩ -- expand |U*S| and |S*U| and use components
let AU*SX = ⟨ a00 u*s x00 +s a01 *s x10 , a00 u*s x01 +s a01 *s x11
, zers *s x00 +s a11 u*s x10 , zers *s x01 +s a11 u*s x11 ⟩
XS*UB = ⟨ x00 s*u b00 +s x01 *s zers , x00 *s b01 +s x01 s*u b11
, x10 s*u b00 +s x11 *s zers , x10 *s b01 +s x11 s*u b11 ⟩
in Y +S (AU*SX +S XS*UB)
≡⟨ refl ⟩ -- Expand |≃S|, |+S| and collect components
⟨ y00 +s ( (a00 u*s x00 +s a01 *s x10) +s (x00 s*u b00 +s x01 *s zers) )
, y01 +s ( (a00 u*s x01 +s a01 *s x11) +s (x00 *s b01 +s x01 s*u b11 ) )
, y10 +s ( (zers *s x00 +s a11 u*s x10) +s (x10 s*u b00 +s x11 *s zers) )
, y11 +s ( (zers *s x01 +s a11 u*s x11) +s (x10 *s b01 +s x11 s*u b11 ) ) ⟩
≈⟨ congS zeroLemma00 zeroLemma01 zeroLemma10 zeroLemma11 ⟩
-- assoc. and comm. of +; zero absorption.
⟨ y00 +s a01 *s x10 +s (a00 u*s x00 +s x00 s*u b00)
, y01 +s a01 *s x11 +s x00 *s b01 +s (a00 u*s x01 +s x01 s*u b11)
, y10 +s (a11 u*s x10 +s x10 s*u b00)
, y11 +s x10 *s b01 +s (a11 u*s x11 +s x11 s*u b11) ⟩
≈⟨ congS completionHasAll completionHasAll completionHasAll completionHasAll ⟩
⟨ x00 , x01 , x10 , x11 ⟩
≡⟨ refl ⟩
X
∎
uniqueLS : SemiNearRing2.UniqueL SNR2 -- \structure{4.7}{Proofs for ordering |L|-solutions}
uniqueLS (p00 , p01 , p10 , p11) (q00 , q01 , q10 , q11) = eq00 , eq01 , eq10 , eq11
where mutual
s00 = congL (refls <+> (refls <*> sym eq10))
s11 = congL (refls <+> (sym eq10 <*> refls))
s01 = congL ((refls <+> (refls <*> sym eq11)) <+> (sym eq00 <*> refls))
r10 = trans (sym zeroLemma10) q10
r00 = s00 ( trans (sym zeroLemma00) q00)
r11 = s11 ( trans (sym zeroLemma11) q11)
r01 = s01 ( trans (sym zeroLemma01) q01)
eq10 = uniqueL (trans (sym zeroLemma10) p10) r10
eq00 = uniqueL (trans (sym zeroLemma00) p00) r00
eq11 = uniqueL (trans (sym zeroLemma11) p11) r11
eq01 = uniqueL (trans (sym zeroLemma01) p01) r01
completionMonoS : ∀ {a a' y y' b b'} → a ≤U a' → y ≤S y' → b ≤U b' →
proj₁ (entireLS a y b) ≤S proj₁ (entireLS a' y' b')
completionMonoS (p00 , p01 , p10 , p11) (q00 , q01 , q10 , q11)
(r00 , r01 , r10 , r11) = m00 , m01 , m10 , m11
where m10 = completionMono p11 q10 r00
m00 = completionMono p00 (q00 [+] p01 [*] m10) r00
m11 = completionMono p11 (q11 [+] m10 [*] r01) r11
m01 = completionMono p00 (q01 [+] p01 [*] m11 [+] m00 [*] r01) r11
congLS : SemiNearRing2.CongL SNR2
congLS P Q = transS (symS P <+S> reflS) Q
CSNR : ClosedSemiNearRing
CSNR = record {
snr2 = SNR2;
entireQ = entireQStep ;
closureIsLeast = closureIsLeastS ;
entireL = entireLS;
uniqueL = uniqueLS ;
congL = congLS ;
completionMono = completionMonoS }
module Knot where
-- open import Data.Nat
OneByOne : SemiNearRing -> ClosedSemiNearRing
OneByOne snr = record {
snr2 = snr2;
entireQ = entireQBase;
entireL = entireLBase;
closureIsLeast = leastQBase;
completionMono = \ _ w<w' _ → w<w';
uniqueL = \p q → transs (syms p) (transs (zeroˡʳLemma _ _ _) (transs (syms (zeroˡʳLemma _ _ _)) q));
congL = \p q → transs (syms p <+> refls) q
}
where open SemiNearRing snr using (zers)
snr2 = record { snr = snr; u = ⊤; _+u_ = \ _ _ → tt;
u2s = \ _ → zers; _*u_ = \ _ _ → tt }
open SemiNearRing snr using (s; _≃s_; refls; _+s_; _*s_; identityˡs; syms; transs; _<+>_)
open SemiNearRing2 snr2 using (_+u_; _*u_; _≃u_)
entireQBase : ∀ (w : ⊤) → ∃ \(c : ⊤) → w +u c *u c ≃u c
entireQBase tt = _ , refls
open SemiNearRing2 snr2 using (_s*u_; _u*s_)
open import ZeroLemmas snr -- \structure{5.1}{Base case for |L|}
entireLBase : (a : ⊤) (y : s) (b : ⊤) → ∃ (\ x → y +s (a u*s x +s x s*u b) ≃s x)
entireLBase tt y tt = y , zeroˡʳLemma y y y
leastQBase = \ _ _ → identityˡs zers -- \structure{5.2}{Base case for least |Q| }
open import Data.Nat
Mat : ℕ → SemiNearRing → ClosedSemiNearRing -- \structure{6}{Top level recursion for matrices}
Mat zero el = OneByOne el
Mat (suc n) el = Square (Mat n el)
Upper : ℕ → SemiNearRing → Set
Upper n el = ClosedSemiNearRing.u (Mat n el)
-- \structure{6.1}{Top level algorithm extraction}
valiantAlgorithm : (el : SemiNearRing) → ∀ n → Upper n el → Upper n el
valiantAlgorithm el n u = ClosedSemiNearRing.closure (Mat n el) u
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/init13.ads | best08618/asylo | 7 | 25852 | <reponame>best08618/asylo<gh_stars>1-10
with Ada.Numerics; use Ada.Numerics;
with System;
package Init13 is
type Complex is record
R : Float;
I : Float;
end record;
pragma Complex_Representation (Complex);
type R1 is record
F : Complex;
end record;
for R1'Bit_Order use System.Low_Order_First;
for R1'Scalar_Storage_Order use System.Low_Order_First;
for R1 use record
F at 0 range 0 .. 63;
end record;
type R2 is record
F : Complex;
end record;
for R2'Bit_Order use System.High_Order_First;
for R2'Scalar_Storage_Order use System.High_Order_First;
for R2 use record
F at 0 range 0 .. 63;
end record;
My_R1 : constant R1 := (F => (Pi, -Pi));
My_R2 : constant R2 := (F => (Pi, -Pi));
end Init13;
|
programs/oeis/248/A248825.asm | neoneye/loda | 22 | 29955 | ; A248825: n^2 + 1 - (-1)^n.
; 0,3,4,11,16,27,36,51,64,83,100,123,144,171,196,227,256,291,324,363,400,443,484,531,576,627,676,731,784,843,900,963,1024,1091,1156,1227,1296,1371,1444,1523,1600,1683,1764,1851,1936,2027,2116
mov $1,$0
pow $0,2
mod $1,2
add $0,$1
add $0,$1
|
src/drivers/adabase-driver-base-sqlite.adb | jrmarino/AdaBase | 30 | 20685 | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
package body AdaBase.Driver.Base.SQLite is
---------------
-- execute --
---------------
overriding
function execute (driver : SQLite_Driver; sql : String)
return Affected_Rows
is
trsql : String := CT.trim_sql (sql);
nquery : Natural := CT.count_queries (trsql);
aborted : constant Affected_Rows := 0;
err1 : constant CT.Text :=
CT.SUS ("ACK! Execution attempted on inactive connection");
err2 : constant String :=
"Driver is configured to allow only one query at " &
"time, but this SQL contains multiple queries: ";
begin
if not driver.connection_active then
-- Fatal attempt to query an unccnnected database
driver.log_problem (category => execution,
message => err1,
break => True);
return aborted;
end if;
if nquery > 1 and then not driver.trait_multiquery_enabled then
-- Fatal attempt to execute multiple queries when it's not permitted
driver.log_problem (category => execution,
message => CT.SUS (err2 & trsql),
break => True);
return aborted;
end if;
declare
result : Affected_Rows;
begin
-- SQLITE3 execute supports multiquery in all cases, so it is not
-- necessary to loop through subqueries. We send the trimmed
-- compound query as it was received.
driver.connection.execute (trsql);
driver.log_nominal (execution, CT.SUS (trsql));
result := driver.connection.rows_affected_by_execution;
return result;
exception
when ACS.QUERY_FAIL =>
driver.log_problem (category => execution,
message => CT.SUS (trsql),
pull_codes => True);
return aborted;
end;
end execute;
------------------------------------------------------------------------
-- ROUTINES OF ALL DRIVERS NOT COVERED BY INTERFACES (TECH REASON) --
------------------------------------------------------------------------
-------------
-- query --
-------------
function query (driver : SQLite_Driver; sql : String)
return ASS.SQLite_statement is
begin
return driver.private_statement (sql => sql, prepared => False);
end query;
---------------
-- prepare --
---------------
function prepare (driver : SQLite_Driver; sql : String)
return ASS.SQLite_statement is
begin
return driver.private_statement (sql => sql, prepared => True);
end prepare;
--------------------
-- query_select --
--------------------
function query_select (driver : SQLite_Driver;
distinct : Boolean := False;
tables : String;
columns : String;
conditions : String := blankstring;
groupby : String := blankstring;
having : String := blankstring;
order : String := blankstring;
null_sort : Null_Priority := native;
limit : Trax_ID := 0;
offset : Trax_ID := 0)
return ASS.SQLite_statement is
begin
return driver.private_statement
(prepared => False,
sql => driver.sql_assemble (distinct => distinct,
tables => tables,
columns => columns,
conditions => conditions,
groupby => groupby,
having => having,
order => order,
null_sort => null_sort,
limit => limit,
offset => offset));
end query_select;
----------------------
-- prepare_select --
----------------------
function prepare_select (driver : SQLite_Driver;
distinct : Boolean := False;
tables : String;
columns : String;
conditions : String := blankstring;
groupby : String := blankstring;
having : String := blankstring;
order : String := blankstring;
null_sort : Null_Priority := native;
limit : Trax_ID := 0;
offset : Trax_ID := 0)
return ASS.SQLite_statement is
begin
return driver.private_statement
(prepared => True,
sql => driver.sql_assemble (distinct => distinct,
tables => tables,
columns => columns,
conditions => conditions,
groupby => groupby,
having => having,
order => order,
null_sort => null_sort,
limit => limit,
offset => offset));
end prepare_select;
------------------------------------------------------------------------
-- PRIVATE ROUTINES NOT COVERED BY INTERFACES --
------------------------------------------------------------------------
------------------
-- initialize --
------------------
overriding
procedure initialize (Object : in out SQLite_Driver)
is
begin
Object.connection := Object.local_connection'Unchecked_Access;
Object.dialect := driver_sqlite;
end initialize;
-----------------------
-- private_connect --
-----------------------
overriding
procedure private_connect (driver : out SQLite_Driver;
database : String;
username : String;
password : String;
hostname : String := blankstring;
socket : String := blankstring;
port : Posix_Port := portless)
is
err1 : constant CT.Text :=
CT.SUS ("ACK! Reconnection attempted on active connection");
nom : constant CT.Text :=
CT.SUS ("Connection to " & database & " database succeeded.");
begin
if driver.connection_active then
driver.log_problem (category => execution,
message => err1);
return;
end if;
driver.connection.connect (database => database,
username => username,
password => password,
socket => socket,
hostname => hostname,
port => port);
driver.connection_active := driver.connection.all.connected;
driver.log_nominal (category => connecting, message => nom);
exception
when Error : others =>
driver.log_problem
(category => connecting,
break => True,
message => CT.SUS (ACS.EX.Exception_Message (X => Error)));
end private_connect;
-------------------------
-- private_statement --
-------------------------
function private_statement (driver : SQLite_Driver;
sql : String;
prepared : Boolean)
return ASS.SQLite_statement
is
stype : AID.ASB.Stmt_Type := AID.ASB.direct_statement;
logcat : Log_Category := execution;
err1 : constant CT.Text :=
CT.SUS ("ACK! Query attempted on inactive connection");
duplicate : aliased String := sql;
begin
if prepared then
stype := AID.ASB.prepared_statement;
logcat := statement_preparation;
end if;
if driver.connection_active then
declare
statement : ASS.SQLite_statement
(type_of_statement => stype,
log_handler => logger'Access,
sqlite_conn => ACS.SQLite_Connection_Access
(driver.connection),
initial_sql => duplicate'Unchecked_Access,
con_error_mode => driver.trait_error_mode,
con_case_mode => driver.trait_column_case,
con_max_blob => driver.trait_max_blob_size);
begin
if not prepared then
if statement.successful then
driver.log_nominal
(category => logcat,
message => CT.SUS ("query succeeded," &
statement.rows_returned'Img & " rows returned"));
else
driver.log_nominal (category => execution,
message => CT.SUS ("Query failed!"));
end if;
end if;
return statement;
exception
when RES : others =>
-- Fatal attempt to prepare a statement
-- Logged already by stmt initialization
-- Should be internally marked as unsuccessful
return statement;
end;
else
-- Fatal attempt to query an unconnected database
driver.log_problem (category => logcat,
message => err1,
break => True);
end if;
-- We never get here, the driver.log_problem throws exception first
raise ACS.STMT_NOT_VALID
with "failed to return SQLite statement";
end private_statement;
------------------------
-- query_drop_table --
------------------------
overriding
procedure query_drop_table (driver : SQLite_Driver;
tables : String;
when_exists : Boolean := False;
cascade : Boolean := False)
is
sql : CT.Text;
AR : Affected_Rows;
begin
if CT.contains (tables, ",") then
driver.log_problem
(category => execution,
message => CT.SUS ("Multiple tables detected -- SQLite" &
" can only drop one table at a time : " & tables));
return;
end if;
case when_exists is
when True => sql := CT.SUS ("DROP TABLE IF EXISTS " & tables);
when False => sql := CT.SUS ("DROP TABLE " & tables);
end case;
if cascade then
driver.log_nominal
(category => note,
message => CT.SUS ("Requested CASCADE has no effect on SQLite"));
end if;
AR := driver.execute (sql => CT.USS (sql));
exception
when ACS.QUERY_FAIL =>
driver.log_problem (category => execution,
message => sql,
pull_codes => True);
end query_drop_table;
-------------------------
-- query_clear_table --
-------------------------
overriding
procedure query_clear_table (driver : SQLite_Driver;
table : String)
is
-- SQLite has no "truncate" commands
sql : constant String := "DELETE FROM " & table;
AR : Affected_Rows;
begin
AR := driver.execute (sql => sql);
exception
when ACS.QUERY_FAIL =>
driver.log_problem (category => execution,
message => CT.SUS (sql),
pull_codes => True);
end query_clear_table;
--------------------
-- sql_assemble --
--------------------
function sql_assemble (driver : SQLite_Driver;
distinct : Boolean := False;
tables : String;
columns : String;
conditions : String := blankstring;
groupby : String := blankstring;
having : String := blankstring;
order : String := blankstring;
null_sort : Null_Priority := native;
limit : Trax_ID := 0;
offset : Trax_ID := 0) return String
is
vanilla : String := assembly_common_select
(distinct, tables, columns, conditions, groupby, having, order);
begin
if null_sort /= native then
driver.log_nominal
(category => execution,
message => CT.SUS ("Note that NULLS FIRST/LAST is not " &
"supported by SQLite so the null_sort setting is ignored"));
end if;
if limit > 0 then
if offset > 0 then
return vanilla & " LIMIT" & limit'Img & " OFFSET" & offset'Img;
else
return vanilla & " LIMIT" & limit'Img;
end if;
end if;
return vanilla;
end sql_assemble;
-----------------------------
-- call_stored_procedure --
-----------------------------
function call_stored_procedure (driver : SQLite_Driver;
stored_procedure : String;
proc_arguments : String)
return ASS.SQLite_statement is
begin
raise ACS.UNSUPPORTED_BY_SQLITE
with "SQLite does not have the capability of stored procedures";
return driver.query ("this never runs.");
end call_stored_procedure;
end AdaBase.Driver.Base.SQLite;
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_xr/CiscoXr_community_set.g4 | adiapel/batfish | 1 | 3411 | <reponame>adiapel/batfish
parser grammar CiscoXr_community_set;
import CiscoXr_common;
options {
tokenVocab = CiscoXrLexer;
}
community_set_stanza
:
COMMUNITY_SET name = community_set_name NEWLINE
community_set_elem_list END_SET NEWLINE
;
community_set_elem_list
:
// no elements
| elems += community_set_elem (COMMA elems += community_set_elem)*
;
community_set_elem
:
ASTERISK
| literal_community
| hi = community_set_elem_half COLON lo = community_set_elem_half
| DFA_REGEX COMMUNITY_SET_REGEX
| IOS_REGEX COMMUNITY_SET_REGEX
;
community_set_elem_half
:
ASTERISK
| value = uint16
| BRACKET_LEFT first = uint16 DOTDOT last = uint16 BRACKET_RIGHT
| PRIVATE_AS
;
|
Class Exercises/Problem 11.a51 | pronoym99/Microcontrollers-and-Applications | 1 | 165960 | <filename>Class Exercises/Problem 11.a51
;program to load the accumulator with 55h and complememt the accumulator 700 times
org 0000h
mov a,#55h ;required content moved to accumulator
mov r0,#46h ;counter 1=70d
next:mov r1,#0ah ;counter 2=10d
here:cpl a ;complementation
djnz r1,here ;count 70 times
djnz r0,next ;count 70 times a total of 10 times
end
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/derived_type4.adb | best08618/asylo | 7 | 27379 | <gh_stars>1-10
-- { dg-do compile }
procedure Derived_Type4 is
type Root (D : Positive) is record
S : String (1 .. D);
end record;
subtype Short is Positive range 1 .. 10;
type Derived (N : Short := 1) is new Root (D => N);
Obj : Derived;
begin
Obj := (N => 5, S => "Hello");
end;
|
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_number_tail_long.asm | meesokim/z88dk | 0 | 24005 |
SECTION code_stdio
PUBLIC __stdio_scanf_number_tail_long
__stdio_scanf_number_tail_long:
; enter : bc = long *p
; dehl = long
;
; carry flag state set by strtol / strtoul
;
; carry reset, number is valid
;
; carry set, number valid only if dehl != 0
jr nc, number_valid
ld a,d
or e
or h
or l
jr z, number_invalid
number_valid:
; enter : bc = long *p
; dehl = long
; WRITE LONG TO LONG *P
ld a,b
or c
ret z ; if assignment is suppressed
exx
inc hl ; items assigned++
exx
push de ; save MSW of long
ex de,hl ; de = LSW of long
ld l,c
ld h,b ; hl = long *p
ld (hl),e
inc hl
ld (hl),d
inc hl
pop de ; de = MSW of long
ld (hl),e
inc hl
ld (hl),d ; *p = long
ret
number_invalid:
scf
ret
|
src/generateInputList.asm | NEPETAISCUTE/simon-gameboy | 1 | 5623 |
TIMER_DISPLAY_MAX EQU $0050
SECTION "input generator", ROM0
generateInputList::
ld a, [wInputLength]
ld c, a
ld de, wInputList
ld a, [wLevel]
cp a, 4
jr nc, .generationLoopHard
.generationLoopEasy:
push bc
call rand
pop bc
ld b, a
swap a
add a, b
adc a, 1
swap a
and %00000011
ld b, 1
call LoopShiftLeft
ld a, b
ld [de], a
inc de
dec c
jr nz, .generationLoopEasy
jr .end
.generationLoopHard:
push bc
call rand
pop bc
;apparently this algorithm is the same as A%15, i still don't understand exactly how it works, but it's fine
ld b, a
swap a
add a, b
adc a, 1
swap a
and %00001111
inc a
ld [de], a
inc de
dec c
jr nz, .generationLoopHard
.end:
xor a, a
ld [wIsGeneratingNewInput], a
ld hl, TIMER_DISPLAY_MAX
ld a, h
ld [wTimerDisplay], a
ld a, l
ld [wTimerDisplay+1], a
|
MdePkg/Library/BaseLib/X64/FlushCacheLine.nasm | nicklela/edk2 | 3,861 | 13663 | ;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; FlushCacheLine.Asm
;
; Abstract:
;
; AsmFlushCacheLine function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; VOID *
; EFIAPI
; AsmFlushCacheLine (
; IN VOID *LinearAddress
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmFlushCacheLine)
ASM_PFX(AsmFlushCacheLine):
clflush [rcx]
mov rax, rcx
ret
|
msx/apps/libraries/msxdos/msxdos_set_time.asm | zoggins/yellow-msx-series-for-rc2014 | 19 | 246315 | include "msxdos.inc"
; extern uint8_t msxdosSetTime(uint8_t hour, uint8_t minutes, uint8_t seconds, uint8_t centiseconds);
PUBLIC _msxdosSetTime
_msxdosSetTime:
PUSH IX
LD IX, 0
ADD IX, SP
LD H, (IX+4) ; HOUR
LD L, (IX+5) ; MINUTES
LD D, (IX+6) ; SECONDS
LD E, (IX+7) ; CENTI-SECONDS
ld c, $2D
CALL BDOS
LD L, A
POP IX
RET
|
tmp1/c55x-sim2/foo/Debug/i2s.asm | jwestmoreland/eZdsp-DBG-sim | 1 | 173594 | ;*******************************************************************************
;* TMS320C55x C/C++ Codegen PC v4.4.1 *
;* Date/Time created: Sat Oct 06 06:37:14 2018 *
;*******************************************************************************
.compiler_opts --hll_source=on --mem_model:code=flat --mem_model:data=large --object_format=coff --silicon_core_3_3 --symdebug:dwarf
.mmregs
.cpl_on
.arms_on
.c54cm_off
.asg AR6, FP
.asg XAR6, XFP
.asg DPH, MDP
.model call=c55_std
.model mem=large
.noremark 5002 ; code respects overwrite rules
;*******************************************************************************
;* GLOBAL FILE PARAMETERS *
;* *
;* Architecture : TMS320C55x *
;* Optimizing for : Speed *
;* Memory : Large Model (23-Bit Data Pointers) *
;* Calls : Normal Library ASM calls *
;* Debug Info : Standard TI Debug Information *
;*******************************************************************************
$C$DW$CU .dwtag DW_TAG_compile_unit
.dwattr $C$DW$CU, DW_AT_name("../src/i2s.c")
.dwattr $C$DW$CU, DW_AT_producer("TMS320C55x C/C++ Codegen PC v4.4.1 Copyright (c) 1996-2012 Texas Instruments Incorporated")
.dwattr $C$DW$CU, DW_AT_TI_version(0x01)
.dwattr $C$DW$CU, DW_AT_comp_dir("F:\eZdsp_DBG\tmp1\c55x-sim2\foo\Debug")
;******************************************************************************
;* CINIT RECORDS *
;******************************************************************************
.sect ".cinit"
.align 1
.field 1,16
.field _Buf_Address+0,24
.field 0,8
.field 0,16 ; _Buf_Address @ 0
$C$DW$1 .dwtag DW_TAG_subprogram, DW_AT_name("i2s0_read_CR")
.dwattr $C$DW$1, DW_AT_TI_symbol_name("_i2s0_read_CR")
.dwattr $C$DW$1, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$1, DW_AT_declaration
.dwattr $C$DW$1, DW_AT_external
$C$DW$2 .dwtag DW_TAG_subprogram, DW_AT_name("i2s0_write_CR")
.dwattr $C$DW$2, DW_AT_TI_symbol_name("_i2s0_write_CR")
.dwattr $C$DW$2, DW_AT_declaration
.dwattr $C$DW$2, DW_AT_external
$C$DW$3 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$3, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$2
$C$DW$4 .dwtag DW_TAG_subprogram, DW_AT_name("i2s0_write_SRGR")
.dwattr $C$DW$4, DW_AT_TI_symbol_name("_i2s0_write_SRGR")
.dwattr $C$DW$4, DW_AT_declaration
.dwattr $C$DW$4, DW_AT_external
$C$DW$5 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$5, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$4
$C$DW$6 .dwtag DW_TAG_subprogram, DW_AT_name("i2s0_write_INT_MASK")
.dwattr $C$DW$6, DW_AT_TI_symbol_name("_i2s0_write_INT_MASK")
.dwattr $C$DW$6, DW_AT_declaration
.dwattr $C$DW$6, DW_AT_external
$C$DW$7 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$7, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$6
$C$DW$8 .dwtag DW_TAG_subprogram, DW_AT_name("i2s2_read_CR")
.dwattr $C$DW$8, DW_AT_TI_symbol_name("_i2s2_read_CR")
.dwattr $C$DW$8, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$8, DW_AT_declaration
.dwattr $C$DW$8, DW_AT_external
$C$DW$9 .dwtag DW_TAG_subprogram, DW_AT_name("i2s2_write_CR")
.dwattr $C$DW$9, DW_AT_TI_symbol_name("_i2s2_write_CR")
.dwattr $C$DW$9, DW_AT_declaration
.dwattr $C$DW$9, DW_AT_external
$C$DW$10 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$10, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$9
$C$DW$11 .dwtag DW_TAG_subprogram, DW_AT_name("i2s2_write_SRGR")
.dwattr $C$DW$11, DW_AT_TI_symbol_name("_i2s2_write_SRGR")
.dwattr $C$DW$11, DW_AT_declaration
.dwattr $C$DW$11, DW_AT_external
$C$DW$12 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$12, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$11
$C$DW$13 .dwtag DW_TAG_subprogram, DW_AT_name("i2s2_write_INT_MASK")
.dwattr $C$DW$13, DW_AT_TI_symbol_name("_i2s2_write_INT_MASK")
.dwattr $C$DW$13, DW_AT_declaration
.dwattr $C$DW$13, DW_AT_external
$C$DW$14 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$14, DW_AT_type(*$C$DW$T$19)
.dwendtag $C$DW$13
.global _I2S_RCV_L
.bss _I2S_RCV_L,48,0,0
$C$DW$15 .dwtag DW_TAG_variable, DW_AT_name("I2S_RCV_L")
.dwattr $C$DW$15, DW_AT_TI_symbol_name("_I2S_RCV_L")
.dwattr $C$DW$15, DW_AT_location[DW_OP_addr _I2S_RCV_L]
.dwattr $C$DW$15, DW_AT_type(*$C$DW$T$24)
.dwattr $C$DW$15, DW_AT_external
.global _I2S_RCV_R
.bss _I2S_RCV_R,48,0,0
$C$DW$16 .dwtag DW_TAG_variable, DW_AT_name("I2S_RCV_R")
.dwattr $C$DW$16, DW_AT_TI_symbol_name("_I2S_RCV_R")
.dwattr $C$DW$16, DW_AT_location[DW_OP_addr _I2S_RCV_R]
.dwattr $C$DW$16, DW_AT_type(*$C$DW$T$24)
.dwattr $C$DW$16, DW_AT_external
.global _Buf_Address
.bss _Buf_Address,1,0,0
$C$DW$17 .dwtag DW_TAG_variable, DW_AT_name("Buf_Address")
.dwattr $C$DW$17, DW_AT_TI_symbol_name("_Buf_Address")
.dwattr $C$DW$17, DW_AT_location[DW_OP_addr _Buf_Address]
.dwattr $C$DW$17, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$17, DW_AT_external
; F:\t\cc5p5\ccsv5\tools\compiler\c5500_4.4.1\bin\acp55.exe -@f:\\AppData\\Local\\Temp\\0322412
.sect ".text"
.align 4
.global _set_i2s2_master
$C$DW$18 .dwtag DW_TAG_subprogram, DW_AT_name("set_i2s2_master")
.dwattr $C$DW$18, DW_AT_low_pc(_set_i2s2_master)
.dwattr $C$DW$18, DW_AT_high_pc(0x00)
.dwattr $C$DW$18, DW_AT_TI_symbol_name("_set_i2s2_master")
.dwattr $C$DW$18, DW_AT_external
.dwattr $C$DW$18, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$18, DW_AT_TI_begin_file("../src/i2s.c")
.dwattr $C$DW$18, DW_AT_TI_begin_line(0x37)
.dwattr $C$DW$18, DW_AT_TI_begin_column(0x08)
.dwattr $C$DW$18, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../src/i2s.c",line 56,column 1,is_stmt,address _set_i2s2_master
.dwfde $C$DW$CIE, _set_i2s2_master
;*******************************************************************************
;* FUNCTION NAME: set_i2s2_master *
;* *
;* Function Uses Regs : T0,SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (1 return address/alignment) *
;* (1 local values) *
;* Min System Stack : 1 word *
;*******************************************************************************
_set_i2s2_master:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
$C$DW$19 .dwtag DW_TAG_variable, DW_AT_name("temp")
.dwattr $C$DW$19, DW_AT_TI_symbol_name("_temp")
.dwattr $C$DW$19, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$19, DW_AT_location[DW_OP_bregx 0x24 0]
.dwpsn file "../src/i2s.c",line 57,column 12,is_stmt
MOV #0, *SP(#0) ; |57|
.dwpsn file "../src/i2s.c",line 59,column 2,is_stmt
MOV #16, *SP(#0) ; |59|
.dwpsn file "../src/i2s.c",line 60,column 2,is_stmt
OR #0x0082, *SP(#0) ; |60|
.dwpsn file "../src/i2s.c",line 61,column 5,is_stmt
MOV *SP(#0), T0 ; |61|
$C$DW$20 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$20, DW_AT_low_pc(0x00)
.dwattr $C$DW$20, DW_AT_name("_i2s2_write_CR")
.dwattr $C$DW$20, DW_AT_TI_call
CALL #_i2s2_write_CR ; |61|
; call occurs [#_i2s2_write_CR] ; |61|
.dwpsn file "../src/i2s.c",line 62,column 5,is_stmt
$C$DW$21 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$21, DW_AT_low_pc(0x00)
.dwattr $C$DW$21, DW_AT_name("_i2s2_read_CR")
.dwattr $C$DW$21, DW_AT_TI_call
CALL #_i2s2_read_CR ; |62|
; call occurs [#_i2s2_read_CR] ; |62|
MOV T0, *SP(#0) ; |62|
.dwpsn file "../src/i2s.c",line 64,column 2,is_stmt
MOV #16, *SP(#0) ; |64|
.dwpsn file "../src/i2s.c",line 65,column 2,is_stmt
OR #0x0005, *SP(#0) ; |65|
.dwpsn file "../src/i2s.c",line 66,column 5,is_stmt
MOV *SP(#0), T0 ; |66|
$C$DW$22 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$22, DW_AT_low_pc(0x00)
.dwattr $C$DW$22, DW_AT_name("_i2s2_write_SRGR")
.dwattr $C$DW$22, DW_AT_TI_call
CALL #_i2s2_write_SRGR ; |66|
; call occurs [#_i2s2_write_SRGR] ; |66|
.dwpsn file "../src/i2s.c",line 69,column 5,is_stmt
$C$DW$23 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$23, DW_AT_low_pc(0x00)
.dwattr $C$DW$23, DW_AT_name("_i2s2_write_INT_MASK")
.dwattr $C$DW$23, DW_AT_TI_call
CALL #_i2s2_write_INT_MASK ; |69|
|| MOV #0, T0
; call occurs [#_i2s2_write_INT_MASK] ; |69|
.dwpsn file "../src/i2s.c",line 80,column 5,is_stmt
MOV #0, T0
.dwpsn file "../src/i2s.c",line 81,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$24 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$24, DW_AT_low_pc(0x00)
.dwattr $C$DW$24, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$18, DW_AT_TI_end_file("../src/i2s.c")
.dwattr $C$DW$18, DW_AT_TI_end_line(0x51)
.dwattr $C$DW$18, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$18
.sect ".text"
.align 4
.global _set_i2s0_master
$C$DW$25 .dwtag DW_TAG_subprogram, DW_AT_name("set_i2s0_master")
.dwattr $C$DW$25, DW_AT_low_pc(_set_i2s0_master)
.dwattr $C$DW$25, DW_AT_high_pc(0x00)
.dwattr $C$DW$25, DW_AT_TI_symbol_name("_set_i2s0_master")
.dwattr $C$DW$25, DW_AT_external
.dwattr $C$DW$25, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$25, DW_AT_TI_begin_file("../src/i2s.c")
.dwattr $C$DW$25, DW_AT_TI_begin_line(0x56)
.dwattr $C$DW$25, DW_AT_TI_begin_column(0x08)
.dwattr $C$DW$25, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../src/i2s.c",line 87,column 1,is_stmt,address _set_i2s0_master
.dwfde $C$DW$CIE, _set_i2s0_master
;*******************************************************************************
;* FUNCTION NAME: set_i2s0_master *
;* *
;* Function Uses Regs : T0,SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (1 return address/alignment) *
;* (1 local values) *
;* Min System Stack : 1 word *
;*******************************************************************************
_set_i2s0_master:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
$C$DW$26 .dwtag DW_TAG_variable, DW_AT_name("temp")
.dwattr $C$DW$26, DW_AT_TI_symbol_name("_temp")
.dwattr $C$DW$26, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$26, DW_AT_location[DW_OP_bregx 0x24 0]
.dwpsn file "../src/i2s.c",line 88,column 12,is_stmt
MOV #0, *SP(#0) ; |88|
.dwpsn file "../src/i2s.c",line 90,column 2,is_stmt
MOV #16, *SP(#0) ; |90|
.dwpsn file "../src/i2s.c",line 91,column 2,is_stmt
OR #0x0082, *SP(#0) ; |91|
.dwpsn file "../src/i2s.c",line 92,column 5,is_stmt
MOV *SP(#0), T0 ; |92|
$C$DW$27 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$27, DW_AT_low_pc(0x00)
.dwattr $C$DW$27, DW_AT_name("_i2s0_write_CR")
.dwattr $C$DW$27, DW_AT_TI_call
CALL #_i2s0_write_CR ; |92|
; call occurs [#_i2s0_write_CR] ; |92|
.dwpsn file "../src/i2s.c",line 93,column 5,is_stmt
$C$DW$28 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$28, DW_AT_low_pc(0x00)
.dwattr $C$DW$28, DW_AT_name("_i2s0_read_CR")
.dwattr $C$DW$28, DW_AT_TI_call
CALL #_i2s0_read_CR ; |93|
; call occurs [#_i2s0_read_CR] ; |93|
MOV T0, *SP(#0) ; |93|
.dwpsn file "../src/i2s.c",line 95,column 2,is_stmt
MOV #16, *SP(#0) ; |95|
.dwpsn file "../src/i2s.c",line 96,column 2,is_stmt
OR #0x0005, *SP(#0) ; |96|
.dwpsn file "../src/i2s.c",line 97,column 5,is_stmt
MOV *SP(#0), T0 ; |97|
$C$DW$29 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$29, DW_AT_low_pc(0x00)
.dwattr $C$DW$29, DW_AT_name("_i2s0_write_SRGR")
.dwattr $C$DW$29, DW_AT_TI_call
CALL #_i2s0_write_SRGR ; |97|
; call occurs [#_i2s0_write_SRGR] ; |97|
.dwpsn file "../src/i2s.c",line 100,column 5,is_stmt
$C$DW$30 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$30, DW_AT_low_pc(0x00)
.dwattr $C$DW$30, DW_AT_name("_i2s0_write_INT_MASK")
.dwattr $C$DW$30, DW_AT_TI_call
CALL #_i2s0_write_INT_MASK ; |100|
|| MOV #0, T0
; call occurs [#_i2s0_write_INT_MASK] ; |100|
.dwpsn file "../src/i2s.c",line 111,column 5,is_stmt
MOV #0, T0
.dwpsn file "../src/i2s.c",line 112,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$31 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$31, DW_AT_low_pc(0x00)
.dwattr $C$DW$31, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$25, DW_AT_TI_end_file("../src/i2s.c")
.dwattr $C$DW$25, DW_AT_TI_end_line(0x70)
.dwattr $C$DW$25, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$25
.sect ".text"
.align 4
.global _set_i2s0_slave
$C$DW$32 .dwtag DW_TAG_subprogram, DW_AT_name("set_i2s0_slave")
.dwattr $C$DW$32, DW_AT_low_pc(_set_i2s0_slave)
.dwattr $C$DW$32, DW_AT_high_pc(0x00)
.dwattr $C$DW$32, DW_AT_TI_symbol_name("_set_i2s0_slave")
.dwattr $C$DW$32, DW_AT_external
.dwattr $C$DW$32, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$32, DW_AT_TI_begin_file("../src/i2s.c")
.dwattr $C$DW$32, DW_AT_TI_begin_line(0x72)
.dwattr $C$DW$32, DW_AT_TI_begin_column(0x08)
.dwattr $C$DW$32, DW_AT_TI_max_frame_size(0x02)
.dwpsn file "../src/i2s.c",line 115,column 1,is_stmt,address _set_i2s0_slave
.dwfde $C$DW$CIE, _set_i2s0_slave
;*******************************************************************************
;* FUNCTION NAME: set_i2s0_slave *
;* *
;* Function Uses Regs : T0,SP,M40,SATA,SATD,RDM,FRCT,SMUL *
;* Stack Frame : Compact (No Frame Pointer, w/ debug) *
;* Total Frame Size : 2 words *
;* (1 return address/alignment) *
;* (1 local values) *
;* Min System Stack : 1 word *
;*******************************************************************************
_set_i2s0_slave:
.dwcfi cfa_offset, 1
.dwcfi save_reg_to_mem, 91, -1
AADD #-1, SP
.dwcfi cfa_offset, 2
$C$DW$33 .dwtag DW_TAG_variable, DW_AT_name("temp")
.dwattr $C$DW$33, DW_AT_TI_symbol_name("_temp")
.dwattr $C$DW$33, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$33, DW_AT_location[DW_OP_bregx 0x24 0]
.dwpsn file "../src/i2s.c",line 116,column 12,is_stmt
MOV #0, *SP(#0) ; |116|
.dwpsn file "../src/i2s.c",line 118,column 2,is_stmt
MOV #16, *SP(#0) ; |118|
.dwpsn file "../src/i2s.c",line 119,column 2,is_stmt
OR #0x0080, *SP(#0) ; |119|
.dwpsn file "../src/i2s.c",line 120,column 5,is_stmt
MOV *SP(#0), T0 ; |120|
$C$DW$34 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$34, DW_AT_low_pc(0x00)
.dwattr $C$DW$34, DW_AT_name("_i2s0_write_CR")
.dwattr $C$DW$34, DW_AT_TI_call
CALL #_i2s0_write_CR ; |120|
; call occurs [#_i2s0_write_CR] ; |120|
.dwpsn file "../src/i2s.c",line 121,column 5,is_stmt
$C$DW$35 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$35, DW_AT_low_pc(0x00)
.dwattr $C$DW$35, DW_AT_name("_i2s0_read_CR")
.dwattr $C$DW$35, DW_AT_TI_call
CALL #_i2s0_read_CR ; |121|
; call occurs [#_i2s0_read_CR] ; |121|
MOV T0, *SP(#0) ; |121|
.dwpsn file "../src/i2s.c",line 124,column 5,is_stmt
$C$DW$36 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$36, DW_AT_low_pc(0x00)
.dwattr $C$DW$36, DW_AT_name("_i2s0_write_INT_MASK")
.dwattr $C$DW$36, DW_AT_TI_call
CALL #_i2s0_write_INT_MASK ; |124|
|| MOV #0, T0
; call occurs [#_i2s0_write_INT_MASK] ; |124|
.dwpsn file "../src/i2s.c",line 135,column 5,is_stmt
MOV #0, T0
.dwpsn file "../src/i2s.c",line 136,column 1,is_stmt
AADD #1, SP
.dwcfi cfa_offset, 1
$C$DW$37 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$37, DW_AT_low_pc(0x00)
.dwattr $C$DW$37, DW_AT_TI_return
RET
; return occurs
.dwattr $C$DW$32, DW_AT_TI_end_file("../src/i2s.c")
.dwattr $C$DW$32, DW_AT_TI_end_line(0x88)
.dwattr $C$DW$32, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$32
;******************************************************************************
;* UNDEFINED EXTERNAL REFERENCES *
;******************************************************************************
.global _i2s0_read_CR
.global _i2s0_write_CR
.global _i2s0_write_SRGR
.global _i2s0_write_INT_MASK
.global _i2s2_read_CR
.global _i2s2_write_CR
.global _i2s2_write_SRGR
.global _i2s2_write_INT_MASK
;*******************************************************************************
;* TYPE INFORMATION *
;*******************************************************************************
$C$DW$T$4 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$4, DW_AT_encoding(DW_ATE_boolean)
.dwattr $C$DW$T$4, DW_AT_name("bool")
.dwattr $C$DW$T$4, DW_AT_byte_size(0x01)
$C$DW$T$5 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$5, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$5, DW_AT_name("signed char")
.dwattr $C$DW$T$5, DW_AT_byte_size(0x01)
$C$DW$T$6 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$6, DW_AT_encoding(DW_ATE_unsigned_char)
.dwattr $C$DW$T$6, DW_AT_name("unsigned char")
.dwattr $C$DW$T$6, DW_AT_byte_size(0x01)
$C$DW$T$7 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$7, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$7, DW_AT_name("wchar_t")
.dwattr $C$DW$T$7, DW_AT_byte_size(0x01)
$C$DW$T$8 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$8, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$8, DW_AT_name("short")
.dwattr $C$DW$T$8, DW_AT_byte_size(0x01)
$C$DW$T$9 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$9, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$9, DW_AT_name("unsigned short")
.dwattr $C$DW$T$9, DW_AT_byte_size(0x01)
$C$DW$T$19 .dwtag DW_TAG_typedef, DW_AT_name("Uint16")
.dwattr $C$DW$T$19, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$T$19, DW_AT_language(DW_LANG_C)
$C$DW$T$24 .dwtag DW_TAG_array_type
.dwattr $C$DW$T$24, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$T$24, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$24, DW_AT_byte_size(0x30)
$C$DW$38 .dwtag DW_TAG_subrange_type
.dwattr $C$DW$38, DW_AT_upper_bound(0x2f)
.dwendtag $C$DW$T$24
$C$DW$T$10 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$10, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$10, DW_AT_name("int")
.dwattr $C$DW$T$10, DW_AT_byte_size(0x01)
$C$DW$T$11 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$11, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$11, DW_AT_name("unsigned int")
.dwattr $C$DW$T$11, DW_AT_byte_size(0x01)
$C$DW$T$12 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$12, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$12, DW_AT_name("long")
.dwattr $C$DW$T$12, DW_AT_byte_size(0x02)
$C$DW$T$13 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$13, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$13, DW_AT_name("unsigned long")
.dwattr $C$DW$T$13, DW_AT_byte_size(0x02)
$C$DW$T$14 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$14, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$14, DW_AT_name("long long")
.dwattr $C$DW$T$14, DW_AT_byte_size(0x04)
.dwattr $C$DW$T$14, DW_AT_bit_size(0x28)
.dwattr $C$DW$T$14, DW_AT_bit_offset(0x18)
$C$DW$T$15 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$15, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$15, DW_AT_name("unsigned long long")
.dwattr $C$DW$T$15, DW_AT_byte_size(0x04)
.dwattr $C$DW$T$15, DW_AT_bit_size(0x28)
.dwattr $C$DW$T$15, DW_AT_bit_offset(0x18)
$C$DW$T$16 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$16, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$16, DW_AT_name("float")
.dwattr $C$DW$T$16, DW_AT_byte_size(0x02)
$C$DW$T$17 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$17, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$17, DW_AT_name("double")
.dwattr $C$DW$T$17, DW_AT_byte_size(0x02)
$C$DW$T$18 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$18, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$18, DW_AT_name("long double")
.dwattr $C$DW$T$18, DW_AT_byte_size(0x02)
.dwattr $C$DW$CU, DW_AT_language(DW_LANG_C)
;***************************************************************
;* DWARF CIE ENTRIES *
;***************************************************************
$C$DW$CIE .dwcie 91
.dwcfi cfa_register, 36
.dwcfi cfa_offset, 0
.dwcfi undefined, 0
.dwcfi undefined, 1
.dwcfi undefined, 2
.dwcfi undefined, 3
.dwcfi undefined, 4
.dwcfi undefined, 5
.dwcfi undefined, 6
.dwcfi undefined, 7
.dwcfi undefined, 8
.dwcfi undefined, 9
.dwcfi undefined, 10
.dwcfi undefined, 11
.dwcfi undefined, 12
.dwcfi undefined, 13
.dwcfi same_value, 14
.dwcfi same_value, 15
.dwcfi undefined, 16
.dwcfi undefined, 17
.dwcfi undefined, 18
.dwcfi undefined, 19
.dwcfi undefined, 20
.dwcfi undefined, 21
.dwcfi undefined, 22
.dwcfi undefined, 23
.dwcfi undefined, 24
.dwcfi undefined, 25
.dwcfi same_value, 26
.dwcfi same_value, 27
.dwcfi same_value, 28
.dwcfi same_value, 29
.dwcfi same_value, 30
.dwcfi same_value, 31
.dwcfi undefined, 32
.dwcfi undefined, 33
.dwcfi undefined, 34
.dwcfi undefined, 35
.dwcfi undefined, 36
.dwcfi undefined, 37
.dwcfi undefined, 38
.dwcfi undefined, 39
.dwcfi undefined, 40
.dwcfi undefined, 41
.dwcfi undefined, 42
.dwcfi undefined, 43
.dwcfi undefined, 44
.dwcfi undefined, 45
.dwcfi undefined, 46
.dwcfi undefined, 47
.dwcfi undefined, 48
.dwcfi undefined, 49
.dwcfi undefined, 50
.dwcfi undefined, 51
.dwcfi undefined, 52
.dwcfi undefined, 53
.dwcfi undefined, 54
.dwcfi undefined, 55
.dwcfi undefined, 56
.dwcfi undefined, 57
.dwcfi undefined, 58
.dwcfi undefined, 59
.dwcfi undefined, 60
.dwcfi undefined, 61
.dwcfi undefined, 62
.dwcfi undefined, 63
.dwcfi undefined, 64
.dwcfi undefined, 65
.dwcfi undefined, 66
.dwcfi undefined, 67
.dwcfi undefined, 68
.dwcfi undefined, 69
.dwcfi undefined, 70
.dwcfi undefined, 71
.dwcfi undefined, 72
.dwcfi undefined, 73
.dwcfi undefined, 74
.dwcfi undefined, 75
.dwcfi undefined, 76
.dwcfi undefined, 77
.dwcfi undefined, 78
.dwcfi undefined, 79
.dwcfi undefined, 80
.dwcfi undefined, 81
.dwcfi undefined, 82
.dwcfi undefined, 83
.dwcfi undefined, 84
.dwcfi undefined, 85
.dwcfi undefined, 86
.dwcfi undefined, 87
.dwcfi undefined, 88
.dwcfi undefined, 89
.dwcfi undefined, 90
.dwcfi undefined, 91
.dwendentry
;***************************************************************
;* DWARF REGISTER MAP *
;***************************************************************
$C$DW$39 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0")
.dwattr $C$DW$39, DW_AT_location[DW_OP_reg0]
$C$DW$40 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0")
.dwattr $C$DW$40, DW_AT_location[DW_OP_reg1]
$C$DW$41 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0_G")
.dwattr $C$DW$41, DW_AT_location[DW_OP_reg2]
$C$DW$42 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1")
.dwattr $C$DW$42, DW_AT_location[DW_OP_reg3]
$C$DW$43 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1")
.dwattr $C$DW$43, DW_AT_location[DW_OP_reg4]
$C$DW$44 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1_G")
.dwattr $C$DW$44, DW_AT_location[DW_OP_reg5]
$C$DW$45 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2")
.dwattr $C$DW$45, DW_AT_location[DW_OP_reg6]
$C$DW$46 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2")
.dwattr $C$DW$46, DW_AT_location[DW_OP_reg7]
$C$DW$47 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2_G")
.dwattr $C$DW$47, DW_AT_location[DW_OP_reg8]
$C$DW$48 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3")
.dwattr $C$DW$48, DW_AT_location[DW_OP_reg9]
$C$DW$49 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3")
.dwattr $C$DW$49, DW_AT_location[DW_OP_reg10]
$C$DW$50 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3_G")
.dwattr $C$DW$50, DW_AT_location[DW_OP_reg11]
$C$DW$51 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T0")
.dwattr $C$DW$51, DW_AT_location[DW_OP_reg12]
$C$DW$52 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T1")
.dwattr $C$DW$52, DW_AT_location[DW_OP_reg13]
$C$DW$53 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T2")
.dwattr $C$DW$53, DW_AT_location[DW_OP_reg14]
$C$DW$54 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T3")
.dwattr $C$DW$54, DW_AT_location[DW_OP_reg15]
$C$DW$55 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0")
.dwattr $C$DW$55, DW_AT_location[DW_OP_reg16]
$C$DW$56 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR0")
.dwattr $C$DW$56, DW_AT_location[DW_OP_reg17]
$C$DW$57 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1")
.dwattr $C$DW$57, DW_AT_location[DW_OP_reg18]
$C$DW$58 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR1")
.dwattr $C$DW$58, DW_AT_location[DW_OP_reg19]
$C$DW$59 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2")
.dwattr $C$DW$59, DW_AT_location[DW_OP_reg20]
$C$DW$60 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR2")
.dwattr $C$DW$60, DW_AT_location[DW_OP_reg21]
$C$DW$61 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3")
.dwattr $C$DW$61, DW_AT_location[DW_OP_reg22]
$C$DW$62 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR3")
.dwattr $C$DW$62, DW_AT_location[DW_OP_reg23]
$C$DW$63 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4")
.dwattr $C$DW$63, DW_AT_location[DW_OP_reg24]
$C$DW$64 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR4")
.dwattr $C$DW$64, DW_AT_location[DW_OP_reg25]
$C$DW$65 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5")
.dwattr $C$DW$65, DW_AT_location[DW_OP_reg26]
$C$DW$66 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR5")
.dwattr $C$DW$66, DW_AT_location[DW_OP_reg27]
$C$DW$67 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6")
.dwattr $C$DW$67, DW_AT_location[DW_OP_reg28]
$C$DW$68 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR6")
.dwattr $C$DW$68, DW_AT_location[DW_OP_reg29]
$C$DW$69 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7")
.dwattr $C$DW$69, DW_AT_location[DW_OP_reg30]
$C$DW$70 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR7")
.dwattr $C$DW$70, DW_AT_location[DW_OP_reg31]
$C$DW$71 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FP")
.dwattr $C$DW$71, DW_AT_location[DW_OP_regx 0x20]
$C$DW$72 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XFP")
.dwattr $C$DW$72, DW_AT_location[DW_OP_regx 0x21]
$C$DW$73 .dwtag DW_TAG_TI_assign_register, DW_AT_name("PC")
.dwattr $C$DW$73, DW_AT_location[DW_OP_regx 0x22]
$C$DW$74 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SP")
.dwattr $C$DW$74, DW_AT_location[DW_OP_regx 0x23]
$C$DW$75 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XSP")
.dwattr $C$DW$75, DW_AT_location[DW_OP_regx 0x24]
$C$DW$76 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BKC")
.dwattr $C$DW$76, DW_AT_location[DW_OP_regx 0x25]
$C$DW$77 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK03")
.dwattr $C$DW$77, DW_AT_location[DW_OP_regx 0x26]
$C$DW$78 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK47")
.dwattr $C$DW$78, DW_AT_location[DW_OP_regx 0x27]
$C$DW$79 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST0")
.dwattr $C$DW$79, DW_AT_location[DW_OP_regx 0x28]
$C$DW$80 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST1")
.dwattr $C$DW$80, DW_AT_location[DW_OP_regx 0x29]
$C$DW$81 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST2")
.dwattr $C$DW$81, DW_AT_location[DW_OP_regx 0x2a]
$C$DW$82 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST3")
.dwattr $C$DW$82, DW_AT_location[DW_OP_regx 0x2b]
$C$DW$83 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP")
.dwattr $C$DW$83, DW_AT_location[DW_OP_regx 0x2c]
$C$DW$84 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP05")
.dwattr $C$DW$84, DW_AT_location[DW_OP_regx 0x2d]
$C$DW$85 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP67")
.dwattr $C$DW$85, DW_AT_location[DW_OP_regx 0x2e]
$C$DW$86 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC0")
.dwattr $C$DW$86, DW_AT_location[DW_OP_regx 0x2f]
$C$DW$87 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0")
.dwattr $C$DW$87, DW_AT_location[DW_OP_regx 0x30]
$C$DW$88 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0_H")
.dwattr $C$DW$88, DW_AT_location[DW_OP_regx 0x31]
$C$DW$89 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0")
.dwattr $C$DW$89, DW_AT_location[DW_OP_regx 0x32]
$C$DW$90 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0_H")
.dwattr $C$DW$90, DW_AT_location[DW_OP_regx 0x33]
$C$DW$91 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRS1")
.dwattr $C$DW$91, DW_AT_location[DW_OP_regx 0x34]
$C$DW$92 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC1")
.dwattr $C$DW$92, DW_AT_location[DW_OP_regx 0x35]
$C$DW$93 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1")
.dwattr $C$DW$93, DW_AT_location[DW_OP_regx 0x36]
$C$DW$94 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1_H")
.dwattr $C$DW$94, DW_AT_location[DW_OP_regx 0x37]
$C$DW$95 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1")
.dwattr $C$DW$95, DW_AT_location[DW_OP_regx 0x38]
$C$DW$96 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1_H")
.dwattr $C$DW$96, DW_AT_location[DW_OP_regx 0x39]
$C$DW$97 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CSR")
.dwattr $C$DW$97, DW_AT_location[DW_OP_regx 0x3a]
$C$DW$98 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RPTC")
.dwattr $C$DW$98, DW_AT_location[DW_OP_regx 0x3b]
$C$DW$99 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDP")
.dwattr $C$DW$99, DW_AT_location[DW_OP_regx 0x3c]
$C$DW$100 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XCDP")
.dwattr $C$DW$100, DW_AT_location[DW_OP_regx 0x3d]
$C$DW$101 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN0")
.dwattr $C$DW$101, DW_AT_location[DW_OP_regx 0x3e]
$C$DW$102 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN1")
.dwattr $C$DW$102, DW_AT_location[DW_OP_regx 0x3f]
$C$DW$103 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA01")
.dwattr $C$DW$103, DW_AT_location[DW_OP_regx 0x40]
$C$DW$104 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA23")
.dwattr $C$DW$104, DW_AT_location[DW_OP_regx 0x41]
$C$DW$105 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA45")
.dwattr $C$DW$105, DW_AT_location[DW_OP_regx 0x42]
$C$DW$106 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA67")
.dwattr $C$DW$106, DW_AT_location[DW_OP_regx 0x43]
$C$DW$107 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSAC")
.dwattr $C$DW$107, DW_AT_location[DW_OP_regx 0x44]
$C$DW$108 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CARRY")
.dwattr $C$DW$108, DW_AT_location[DW_OP_regx 0x45]
$C$DW$109 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC1")
.dwattr $C$DW$109, DW_AT_location[DW_OP_regx 0x46]
$C$DW$110 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC2")
.dwattr $C$DW$110, DW_AT_location[DW_OP_regx 0x47]
$C$DW$111 .dwtag DW_TAG_TI_assign_register, DW_AT_name("M40")
.dwattr $C$DW$111, DW_AT_location[DW_OP_regx 0x48]
$C$DW$112 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SXMD")
.dwattr $C$DW$112, DW_AT_location[DW_OP_regx 0x49]
$C$DW$113 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ARMS")
.dwattr $C$DW$113, DW_AT_location[DW_OP_regx 0x4a]
$C$DW$114 .dwtag DW_TAG_TI_assign_register, DW_AT_name("C54CM")
.dwattr $C$DW$114, DW_AT_location[DW_OP_regx 0x4b]
$C$DW$115 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATA")
.dwattr $C$DW$115, DW_AT_location[DW_OP_regx 0x4c]
$C$DW$116 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATD")
.dwattr $C$DW$116, DW_AT_location[DW_OP_regx 0x4d]
$C$DW$117 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RDM")
.dwattr $C$DW$117, DW_AT_location[DW_OP_regx 0x4e]
$C$DW$118 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FRCT")
.dwattr $C$DW$118, DW_AT_location[DW_OP_regx 0x4f]
$C$DW$119 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SMUL")
.dwattr $C$DW$119, DW_AT_location[DW_OP_regx 0x50]
$C$DW$120 .dwtag DW_TAG_TI_assign_register, DW_AT_name("INTM")
.dwattr $C$DW$120, DW_AT_location[DW_OP_regx 0x51]
$C$DW$121 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0LC")
.dwattr $C$DW$121, DW_AT_location[DW_OP_regx 0x52]
$C$DW$122 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1LC")
.dwattr $C$DW$122, DW_AT_location[DW_OP_regx 0x53]
$C$DW$123 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2LC")
.dwattr $C$DW$123, DW_AT_location[DW_OP_regx 0x54]
$C$DW$124 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3LC")
.dwattr $C$DW$124, DW_AT_location[DW_OP_regx 0x55]
$C$DW$125 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4LC")
.dwattr $C$DW$125, DW_AT_location[DW_OP_regx 0x56]
$C$DW$126 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5LC")
.dwattr $C$DW$126, DW_AT_location[DW_OP_regx 0x57]
$C$DW$127 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6LC")
.dwattr $C$DW$127, DW_AT_location[DW_OP_regx 0x58]
$C$DW$128 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7LC")
.dwattr $C$DW$128, DW_AT_location[DW_OP_regx 0x59]
$C$DW$129 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDPLC")
.dwattr $C$DW$129, DW_AT_location[DW_OP_regx 0x5a]
$C$DW$130 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CIE_RETA")
.dwattr $C$DW$130, DW_AT_location[DW_OP_regx 0x5b]
.dwendtag $C$DW$CU
|
programs/oeis/189/A189749.asm | karttu/loda | 0 | 102706 | ; A189749: a(1)=5, a(2)=5, a(n)=5*a(n-1) + 5*a(n-2).
; 5,5,50,275,1625,9500,55625,325625,1906250,11159375,65328125,382437500,2238828125,13106328125,76725781250,449160546875,2629431640625,15392960937500,90111962890625,527524619140625,3088182910156250,18078537646484375
mul $0,2
mov $1,2
mov $2,2
lpb $0,1
sub $0,2
add $1,2
mov $3,$2
sub $2,1
add $2,$1
mov $1,$3
mul $2,5
lpe
div $1,23
mul $1,45
add $1,5
|
Cubical/Algebra/CommRing/QuotientRing.agda | thomas-lamiaux/cubical | 1 | 7060 | {-# OPTIONS --safe #-}
module Cubical.Algebra.CommRing.QuotientRing where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Structure
open import Cubical.Foundations.Powerset
open import Cubical.Data.Nat
open import Cubical.Data.FinData
open import Cubical.HITs.SetQuotients using ([_]; squash/; elimProp2)
open import Cubical.HITs.PropositionalTruncation as PT
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.CommRing.Ideal
open import Cubical.Algebra.CommRing.FGIdeal
open import Cubical.Algebra.CommRing.Kernel
open import Cubical.Algebra.Ring
import Cubical.Algebra.Ring.QuotientRing as Ring
private
variable
ℓ ℓ' : Level
_/_ : (R : CommRing ℓ) → (I : IdealsIn R) → CommRing ℓ
R / I =
fst asRing , commringstr _ _ _ _ _
(iscommring (RingStr.isRing (snd asRing))
(elimProp2 (λ _ _ → squash/ _ _)
commEq))
where
asRing = (CommRing→Ring R) Ring./ (CommIdeal→Ideal I)
_·/_ : fst asRing → fst asRing → fst asRing
_·/_ = RingStr._·_ (snd asRing)
commEq : (x y : fst R) → ([ x ] ·/ [ y ]) ≡ ([ y ] ·/ [ x ])
commEq x y i = [ CommRingStr.·Comm (snd R) x y i ]
[_]/ : {R : CommRing ℓ} {I : IdealsIn R} → (a : fst R) → fst (R / I)
[ a ]/ = [ a ]
module Quotient-FGideal-CommRing-Ring
(A : CommRing ℓ)
(B : Ring ℓ')
(g : RingHom (CommRing→Ring A) B)
{n : ℕ}
(v : FinVec ⟨ A ⟩ n)
(gnull : (k : Fin n) → g $ v k ≡ RingStr.0r (snd B))
where
open RingStr (snd B) using (0r)
zeroOnGeneratedIdeal : (x : ⟨ A ⟩) → x ∈ fst (generatedIdeal A v) → g $ x ≡ 0r
zeroOnGeneratedIdeal x x∈FGIdeal =
PT.elim
(λ _ → isSetRing B (g $ x) 0r)
(λ {(α , isLC) → subst _ (sym isLC) (cancelLinearCombination A B g _ α v gnull)})
x∈FGIdeal
inducedHom : RingHom (CommRing→Ring (A / (generatedIdeal _ v))) B
inducedHom = Ring.UniversalProperty.inducedHom (CommRing→Ring A) (CommIdeal→Ideal ideal) g zeroOnGeneratedIdeal
where ideal = generatedIdeal A v
module Quotient-FGideal-CommRing-CommRing
(A : CommRing ℓ)
(B : CommRing ℓ')
(g : CommRingHom A B)
{n : ℕ}
(v : FinVec ⟨ A ⟩ n)
(gnull : (k : Fin n) → g $ v k ≡ CommRingStr.0r (snd B))
where
inducedHom : CommRingHom (A / (generatedIdeal _ v)) B
inducedHom = Quotient-FGideal-CommRing-Ring.inducedHom A (CommRing→Ring B) g v gnull
quotientHom : (R : CommRing ℓ) → (I : IdealsIn R) → CommRingHom R (R / I)
quotientHom R I = Ring.quotientHom (CommRing→Ring R) (CommIdeal→Ideal I)
module _ {R : CommRing ℓ} (I : IdealsIn R) where
private
π = quotientHom R I
kernel≡I : kernelIdeal R (R / I) π ≡ I
kernel≡I = cong Ideal→CommIdeal (Ring.kernel≡I (CommIdeal→Ideal I))
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1407.asm | ljhsiun2/medusa | 9 | 81955 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %rax
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xc71f, %r8
nop
nop
nop
nop
nop
sub $29027, %r13
movb (%r8), %r10b
cmp $34170, %rdi
lea addresses_normal_ht+0xdefb, %rax
nop
nop
nop
nop
xor $41336, %rdx
and $0xffffffffffffffc0, %rax
movaps (%rax), %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
nop
and %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r9
push %rbp
push %rdi
// Store
lea addresses_WC+0x145fb, %r10
nop
and %r13, %r13
movb $0x51, (%r10)
cmp $38590, %rdi
// Faulty Load
lea addresses_WT+0x1adfb, %rbp
nop
nop
add %r9, %r9
movups (%rbp), %xmm5
vpextrq $0, %xmm5, %r14
lea oracles, %rbp
and $0xff, %r14
shlq $12, %r14
mov (%rbp,%r14,1), %r14
pop %rdi
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
testsuite/ubivm/output/group_8.asm | alexgarzao/UOP | 0 | 2445 | <reponame>alexgarzao/UOP
.constant_pool
.const 0 string [start]
.const 1 string [constructor]
.const 2 string [Inserindo informacoes]
.const 3 int [1]
.const 4 string [io.writeln]
.const 5 string [MeuContexto]
.const 6 string [key 1]
.const 7 string [key 2]
.const 8 string [key 3]
.const 9 string [key 4]
.const 10 string [res1]
.const 11 string [res2]
.const 12 string [res3]
.const 13 string [res4]
.const 14 int [4]
.const 15 string [key x]
.const 16 string [resx]
.const 17 string [Informacoes inseridas: ]
.const 18 int [2]
.end
.entity start
.valid_context_when (always)
.method constructor
ldconst 2 --> [Inserindo informacoes]
ldconst 3 --> [1]
lcall 4 --> [io.writeln]
ldconst 5 --> [MeuContexto]
ldconst 6 --> [key 1]
ldconst 7 --> [key 2]
ldconst 8 --> [key 3]
ldconst 9 --> [key 4]
ldconst 10 --> [res1]
ldconst 11 --> [res2]
ldconst 12 --> [res3]
ldconst 13 --> [res4]
ldconst 14 --> [4]
ldconst 14 --> [4]
cpublish
ldconst 5 --> [MeuContexto]
ldconst 6 --> [key 1]
ldconst 7 --> [key 2]
ldconst 8 --> [key 3]
ldconst 15 --> [key x]
ldconst 10 --> [res1]
ldconst 11 --> [res2]
ldconst 12 --> [res3]
ldconst 16 --> [resx]
ldconst 14 --> [4]
ldconst 14 --> [4]
cpublish
ldconst 17 --> [Informacoes inseridas: ]
ldconst 5 --> [MeuContexto]
ldconst 6 --> [key 1]
ldconst 7 --> [key 2]
ldconst 8 --> [key 3]
ldconst 9 --> [key 4]
ldconst 14 --> [4]
cget
ldconst 18 --> [2]
lcall 4 --> [io.writeln]
ldconst 17 --> [Informacoes inseridas: ]
ldconst 5 --> [MeuContexto]
ldconst 6 --> [key 1]
ldconst 7 --> [key 2]
ldconst 8 --> [key 3]
ldconst 15 --> [key x]
ldconst 14 --> [4]
cget
ldconst 18 --> [2]
lcall 4 --> [io.writeln]
exit
.end
.end
|
libsrc/_DEVELOPMENT/arch/zx/bifrost_l/c/sdcc/BIFROSTL_showTilePosL.asm | jpoikela/z88dk | 640 | 26564 | <reponame>jpoikela/z88dk
; ----------------------------------------------------------------
; Z88DK INTERFACE LIBRARY FOR THE BIFROST* ENGINE - RELEASE 1.2/L
;
; See "bifrost_l.h" for further details
; ----------------------------------------------------------------
; void BIFROSTL_showTilePosL(unsigned char row, unsigned char col)
SECTION code_clib
SECTION code_bifrost_l
PUBLIC _BIFROSTL_showTilePosL
EXTERN asm_BIFROSTL_showTilePosL
_BIFROSTL_showTilePosL:
ld hl,2
add hl,sp
ld d,(hl) ; D = row
inc hl
ld e,(hl) ; E = col
jp asm_BIFROSTL_showTilePosL
|
dosshell/shell/winidle.asm | minblock/msdos | 0 | 4549 | ;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
;
; Tell forces greater than ourselves that we are idle so we
; don't pig up system time doing nothing. 1680 call is for
; Windows 3.0+ and OS/2, int 28 for TSRS, and int 15 is for
; power savings(see PC convertible tech ref)
;
?WIN = 0 ;Not windows;
?PLM = 1 ;DO use pl/m
include cmacros.inc
sBegin data
sEnd data
sBegin code
assumes cs, code
assumes ds, data
cProc GlobalIdle, PUBLIC , <si,di,ds,es>
cBegin GlobalIdle
;;; do windows and dos idle calls.
;;; BX,CX are only filled in as signatures just in case
;;; some-one needs to know
mov bx,0FEEDh
mov cx,0FACEh
mov ax,1680h
int 2Fh
mov bx,0FEEDh
mov cx,0FACEh
int 28h
;;;Power down
mov ax,4100h ;;; wait until any event
xor bx,bx ;;; no time limit
int 15h
cEnd GlobalIdle
sEnd code
end
|
kill.asm | niknikniknik/nunix | 0 | 103746 |
_kill: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
if(argc < 1){
14: 83 3b 00 cmpl $0x0,(%ebx)
17: 7f 17 jg 30 <main+0x30>
printf(2, "usage: kill pid...\n");
19: 83 ec 08 sub $0x8,%esp
1c: 68 f8 07 00 00 push $0x7f8
21: 6a 02 push $0x2
23: e8 1c 04 00 00 call 444 <printf>
28: 83 c4 10 add $0x10,%esp
exit();
2b: e8 97 02 00 00 call 2c7 <exit>
}
for(i=1; i<argc; i++)
30: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
37: eb 2d jmp 66 <main+0x66>
kill(atoi(argv[i]));
39: 8b 45 f4 mov -0xc(%ebp),%eax
3c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
43: 8b 43 04 mov 0x4(%ebx),%eax
46: 01 d0 add %edx,%eax
48: 8b 00 mov (%eax),%eax
4a: 83 ec 0c sub $0xc,%esp
4d: 50 push %eax
4e: e8 e2 01 00 00 call 235 <atoi>
53: 83 c4 10 add $0x10,%esp
56: 83 ec 0c sub $0xc,%esp
59: 50 push %eax
5a: e8 98 02 00 00 call 2f7 <kill>
5f: 83 c4 10 add $0x10,%esp
if(argc < 1){
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
62: 83 45 f4 01 addl $0x1,-0xc(%ebp)
66: 8b 45 f4 mov -0xc(%ebp),%eax
69: 3b 03 cmp (%ebx),%eax
6b: 7c cc jl 39 <main+0x39>
kill(atoi(argv[i]));
exit();
6d: e8 55 02 00 00 call 2c7 <exit>
00000072 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
72: 55 push %ebp
73: 89 e5 mov %esp,%ebp
75: 57 push %edi
76: 53 push %ebx
asm volatile("cld; rep stosb" :
77: 8b 4d 08 mov 0x8(%ebp),%ecx
7a: 8b 55 10 mov 0x10(%ebp),%edx
7d: 8b 45 0c mov 0xc(%ebp),%eax
80: 89 cb mov %ecx,%ebx
82: 89 df mov %ebx,%edi
84: 89 d1 mov %edx,%ecx
86: fc cld
87: f3 aa rep stos %al,%es:(%edi)
89: 89 ca mov %ecx,%edx
8b: 89 fb mov %edi,%ebx
8d: 89 5d 08 mov %ebx,0x8(%ebp)
90: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
93: 5b pop %ebx
94: 5f pop %edi
95: 5d pop %ebp
96: c3 ret
00000097 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
97: 55 push %ebp
98: 89 e5 mov %esp,%ebp
9a: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
9d: 8b 45 08 mov 0x8(%ebp),%eax
a0: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
a3: 90 nop
a4: 8b 45 08 mov 0x8(%ebp),%eax
a7: 8d 50 01 lea 0x1(%eax),%edx
aa: 89 55 08 mov %edx,0x8(%ebp)
ad: 8b 55 0c mov 0xc(%ebp),%edx
b0: 8d 4a 01 lea 0x1(%edx),%ecx
b3: 89 4d 0c mov %ecx,0xc(%ebp)
b6: 0f b6 12 movzbl (%edx),%edx
b9: 88 10 mov %dl,(%eax)
bb: 0f b6 00 movzbl (%eax),%eax
be: 84 c0 test %al,%al
c0: 75 e2 jne a4 <strcpy+0xd>
;
return os;
c2: 8b 45 fc mov -0x4(%ebp),%eax
}
c5: c9 leave
c6: c3 ret
000000c7 <strcmp>:
int
strcmp(const char *p, const char *q)
{
c7: 55 push %ebp
c8: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
ca: eb 08 jmp d4 <strcmp+0xd>
p++, q++;
cc: 83 45 08 01 addl $0x1,0x8(%ebp)
d0: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
d4: 8b 45 08 mov 0x8(%ebp),%eax
d7: 0f b6 00 movzbl (%eax),%eax
da: 84 c0 test %al,%al
dc: 74 10 je ee <strcmp+0x27>
de: 8b 45 08 mov 0x8(%ebp),%eax
e1: 0f b6 10 movzbl (%eax),%edx
e4: 8b 45 0c mov 0xc(%ebp),%eax
e7: 0f b6 00 movzbl (%eax),%eax
ea: 38 c2 cmp %al,%dl
ec: 74 de je cc <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
ee: 8b 45 08 mov 0x8(%ebp),%eax
f1: 0f b6 00 movzbl (%eax),%eax
f4: 0f b6 d0 movzbl %al,%edx
f7: 8b 45 0c mov 0xc(%ebp),%eax
fa: 0f b6 00 movzbl (%eax),%eax
fd: 0f b6 c0 movzbl %al,%eax
100: 29 c2 sub %eax,%edx
102: 89 d0 mov %edx,%eax
}
104: 5d pop %ebp
105: c3 ret
00000106 <strlen>:
uint
strlen(char *s)
{
106: 55 push %ebp
107: 89 e5 mov %esp,%ebp
109: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
10c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
113: eb 04 jmp 119 <strlen+0x13>
115: 83 45 fc 01 addl $0x1,-0x4(%ebp)
119: 8b 55 fc mov -0x4(%ebp),%edx
11c: 8b 45 08 mov 0x8(%ebp),%eax
11f: 01 d0 add %edx,%eax
121: 0f b6 00 movzbl (%eax),%eax
124: 84 c0 test %al,%al
126: 75 ed jne 115 <strlen+0xf>
;
return n;
128: 8b 45 fc mov -0x4(%ebp),%eax
}
12b: c9 leave
12c: c3 ret
0000012d <memset>:
void*
memset(void *dst, int c, uint n)
{
12d: 55 push %ebp
12e: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
130: 8b 45 10 mov 0x10(%ebp),%eax
133: 50 push %eax
134: ff 75 0c pushl 0xc(%ebp)
137: ff 75 08 pushl 0x8(%ebp)
13a: e8 33 ff ff ff call 72 <stosb>
13f: 83 c4 0c add $0xc,%esp
return dst;
142: 8b 45 08 mov 0x8(%ebp),%eax
}
145: c9 leave
146: c3 ret
00000147 <strchr>:
char*
strchr(const char *s, char c)
{
147: 55 push %ebp
148: 89 e5 mov %esp,%ebp
14a: 83 ec 04 sub $0x4,%esp
14d: 8b 45 0c mov 0xc(%ebp),%eax
150: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
153: eb 14 jmp 169 <strchr+0x22>
if(*s == c)
155: 8b 45 08 mov 0x8(%ebp),%eax
158: 0f b6 00 movzbl (%eax),%eax
15b: 3a 45 fc cmp -0x4(%ebp),%al
15e: 75 05 jne 165 <strchr+0x1e>
return (char*)s;
160: 8b 45 08 mov 0x8(%ebp),%eax
163: eb 13 jmp 178 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
165: 83 45 08 01 addl $0x1,0x8(%ebp)
169: 8b 45 08 mov 0x8(%ebp),%eax
16c: 0f b6 00 movzbl (%eax),%eax
16f: 84 c0 test %al,%al
171: 75 e2 jne 155 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
173: b8 00 00 00 00 mov $0x0,%eax
}
178: c9 leave
179: c3 ret
0000017a <gets>:
char*
gets(char *buf, int max)
{
17a: 55 push %ebp
17b: 89 e5 mov %esp,%ebp
17d: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
180: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
187: eb 44 jmp 1cd <gets+0x53>
cc = read(0, &c, 1);
189: 83 ec 04 sub $0x4,%esp
18c: 6a 01 push $0x1
18e: 8d 45 ef lea -0x11(%ebp),%eax
191: 50 push %eax
192: 6a 00 push $0x0
194: e8 46 01 00 00 call 2df <read>
199: 83 c4 10 add $0x10,%esp
19c: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
19f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1a3: 7f 02 jg 1a7 <gets+0x2d>
break;
1a5: eb 31 jmp 1d8 <gets+0x5e>
buf[i++] = c;
1a7: 8b 45 f4 mov -0xc(%ebp),%eax
1aa: 8d 50 01 lea 0x1(%eax),%edx
1ad: 89 55 f4 mov %edx,-0xc(%ebp)
1b0: 89 c2 mov %eax,%edx
1b2: 8b 45 08 mov 0x8(%ebp),%eax
1b5: 01 c2 add %eax,%edx
1b7: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1bb: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1bd: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1c1: 3c 0a cmp $0xa,%al
1c3: 74 13 je 1d8 <gets+0x5e>
1c5: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1c9: 3c 0d cmp $0xd,%al
1cb: 74 0b je 1d8 <gets+0x5e>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1cd: 8b 45 f4 mov -0xc(%ebp),%eax
1d0: 83 c0 01 add $0x1,%eax
1d3: 3b 45 0c cmp 0xc(%ebp),%eax
1d6: 7c b1 jl 189 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1d8: 8b 55 f4 mov -0xc(%ebp),%edx
1db: 8b 45 08 mov 0x8(%ebp),%eax
1de: 01 d0 add %edx,%eax
1e0: c6 00 00 movb $0x0,(%eax)
return buf;
1e3: 8b 45 08 mov 0x8(%ebp),%eax
}
1e6: c9 leave
1e7: c3 ret
000001e8 <stat>:
int
stat(char *n, struct stat *st)
{
1e8: 55 push %ebp
1e9: 89 e5 mov %esp,%ebp
1eb: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1ee: 83 ec 08 sub $0x8,%esp
1f1: 6a 00 push $0x0
1f3: ff 75 08 pushl 0x8(%ebp)
1f6: e8 0c 01 00 00 call 307 <open>
1fb: 83 c4 10 add $0x10,%esp
1fe: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
201: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
205: 79 07 jns 20e <stat+0x26>
return -1;
207: b8 ff ff ff ff mov $0xffffffff,%eax
20c: eb 25 jmp 233 <stat+0x4b>
r = fstat(fd, st);
20e: 83 ec 08 sub $0x8,%esp
211: ff 75 0c pushl 0xc(%ebp)
214: ff 75 f4 pushl -0xc(%ebp)
217: e8 03 01 00 00 call 31f <fstat>
21c: 83 c4 10 add $0x10,%esp
21f: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
222: 83 ec 0c sub $0xc,%esp
225: ff 75 f4 pushl -0xc(%ebp)
228: e8 c2 00 00 00 call 2ef <close>
22d: 83 c4 10 add $0x10,%esp
return r;
230: 8b 45 f0 mov -0x10(%ebp),%eax
}
233: c9 leave
234: c3 ret
00000235 <atoi>:
int
atoi(const char *s)
{
235: 55 push %ebp
236: 89 e5 mov %esp,%ebp
238: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
23b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
242: eb 25 jmp 269 <atoi+0x34>
n = n*10 + *s++ - '0';
244: 8b 55 fc mov -0x4(%ebp),%edx
247: 89 d0 mov %edx,%eax
249: c1 e0 02 shl $0x2,%eax
24c: 01 d0 add %edx,%eax
24e: 01 c0 add %eax,%eax
250: 89 c1 mov %eax,%ecx
252: 8b 45 08 mov 0x8(%ebp),%eax
255: 8d 50 01 lea 0x1(%eax),%edx
258: 89 55 08 mov %edx,0x8(%ebp)
25b: 0f b6 00 movzbl (%eax),%eax
25e: 0f be c0 movsbl %al,%eax
261: 01 c8 add %ecx,%eax
263: 83 e8 30 sub $0x30,%eax
266: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
269: 8b 45 08 mov 0x8(%ebp),%eax
26c: 0f b6 00 movzbl (%eax),%eax
26f: 3c 2f cmp $0x2f,%al
271: 7e 0a jle 27d <atoi+0x48>
273: 8b 45 08 mov 0x8(%ebp),%eax
276: 0f b6 00 movzbl (%eax),%eax
279: 3c 39 cmp $0x39,%al
27b: 7e c7 jle 244 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
27d: 8b 45 fc mov -0x4(%ebp),%eax
}
280: c9 leave
281: c3 ret
00000282 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
282: 55 push %ebp
283: 89 e5 mov %esp,%ebp
285: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
28e: 8b 45 0c mov 0xc(%ebp),%eax
291: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
294: eb 17 jmp 2ad <memmove+0x2b>
*dst++ = *src++;
296: 8b 45 fc mov -0x4(%ebp),%eax
299: 8d 50 01 lea 0x1(%eax),%edx
29c: 89 55 fc mov %edx,-0x4(%ebp)
29f: 8b 55 f8 mov -0x8(%ebp),%edx
2a2: 8d 4a 01 lea 0x1(%edx),%ecx
2a5: 89 4d f8 mov %ecx,-0x8(%ebp)
2a8: 0f b6 12 movzbl (%edx),%edx
2ab: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ad: 8b 45 10 mov 0x10(%ebp),%eax
2b0: 8d 50 ff lea -0x1(%eax),%edx
2b3: 89 55 10 mov %edx,0x10(%ebp)
2b6: 85 c0 test %eax,%eax
2b8: 7f dc jg 296 <memmove+0x14>
*dst++ = *src++;
return vdst;
2ba: 8b 45 08 mov 0x8(%ebp),%eax
}
2bd: c9 leave
2be: c3 ret
000002bf <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2bf: b8 01 00 00 00 mov $0x1,%eax
2c4: cd 40 int $0x40
2c6: c3 ret
000002c7 <exit>:
SYSCALL(exit)
2c7: b8 02 00 00 00 mov $0x2,%eax
2cc: cd 40 int $0x40
2ce: c3 ret
000002cf <wait>:
SYSCALL(wait)
2cf: b8 03 00 00 00 mov $0x3,%eax
2d4: cd 40 int $0x40
2d6: c3 ret
000002d7 <pipe>:
SYSCALL(pipe)
2d7: b8 04 00 00 00 mov $0x4,%eax
2dc: cd 40 int $0x40
2de: c3 ret
000002df <read>:
SYSCALL(read)
2df: b8 05 00 00 00 mov $0x5,%eax
2e4: cd 40 int $0x40
2e6: c3 ret
000002e7 <write>:
SYSCALL(write)
2e7: b8 10 00 00 00 mov $0x10,%eax
2ec: cd 40 int $0x40
2ee: c3 ret
000002ef <close>:
SYSCALL(close)
2ef: b8 15 00 00 00 mov $0x15,%eax
2f4: cd 40 int $0x40
2f6: c3 ret
000002f7 <kill>:
SYSCALL(kill)
2f7: b8 06 00 00 00 mov $0x6,%eax
2fc: cd 40 int $0x40
2fe: c3 ret
000002ff <exec>:
SYSCALL(exec)
2ff: b8 07 00 00 00 mov $0x7,%eax
304: cd 40 int $0x40
306: c3 ret
00000307 <open>:
SYSCALL(open)
307: b8 0f 00 00 00 mov $0xf,%eax
30c: cd 40 int $0x40
30e: c3 ret
0000030f <mknod>:
SYSCALL(mknod)
30f: b8 11 00 00 00 mov $0x11,%eax
314: cd 40 int $0x40
316: c3 ret
00000317 <unlink>:
SYSCALL(unlink)
317: b8 12 00 00 00 mov $0x12,%eax
31c: cd 40 int $0x40
31e: c3 ret
0000031f <fstat>:
SYSCALL(fstat)
31f: b8 08 00 00 00 mov $0x8,%eax
324: cd 40 int $0x40
326: c3 ret
00000327 <link>:
SYSCALL(link)
327: b8 13 00 00 00 mov $0x13,%eax
32c: cd 40 int $0x40
32e: c3 ret
0000032f <mkdir>:
SYSCALL(mkdir)
32f: b8 14 00 00 00 mov $0x14,%eax
334: cd 40 int $0x40
336: c3 ret
00000337 <chdir>:
SYSCALL(chdir)
337: b8 09 00 00 00 mov $0x9,%eax
33c: cd 40 int $0x40
33e: c3 ret
0000033f <dup>:
SYSCALL(dup)
33f: b8 0a 00 00 00 mov $0xa,%eax
344: cd 40 int $0x40
346: c3 ret
00000347 <getpid>:
SYSCALL(getpid)
347: b8 0b 00 00 00 mov $0xb,%eax
34c: cd 40 int $0x40
34e: c3 ret
0000034f <sbrk>:
SYSCALL(sbrk)
34f: b8 0c 00 00 00 mov $0xc,%eax
354: cd 40 int $0x40
356: c3 ret
00000357 <sleep>:
SYSCALL(sleep)
357: b8 0d 00 00 00 mov $0xd,%eax
35c: cd 40 int $0x40
35e: c3 ret
0000035f <uptime>:
SYSCALL(uptime)
35f: b8 0e 00 00 00 mov $0xe,%eax
364: cd 40 int $0x40
366: c3 ret
00000367 <trace>:
SYSCALL(trace)
367: b8 16 00 00 00 mov $0x16,%eax
36c: cd 40 int $0x40
36e: c3 ret
0000036f <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
36f: 55 push %ebp
370: 89 e5 mov %esp,%ebp
372: 83 ec 18 sub $0x18,%esp
375: 8b 45 0c mov 0xc(%ebp),%eax
378: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
37b: 83 ec 04 sub $0x4,%esp
37e: 6a 01 push $0x1
380: 8d 45 f4 lea -0xc(%ebp),%eax
383: 50 push %eax
384: ff 75 08 pushl 0x8(%ebp)
387: e8 5b ff ff ff call 2e7 <write>
38c: 83 c4 10 add $0x10,%esp
}
38f: c9 leave
390: c3 ret
00000391 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
391: 55 push %ebp
392: 89 e5 mov %esp,%ebp
394: 53 push %ebx
395: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
398: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
39f: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3a3: 74 17 je 3bc <printint+0x2b>
3a5: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3a9: 79 11 jns 3bc <printint+0x2b>
neg = 1;
3ab: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3b2: 8b 45 0c mov 0xc(%ebp),%eax
3b5: f7 d8 neg %eax
3b7: 89 45 ec mov %eax,-0x14(%ebp)
3ba: eb 06 jmp 3c2 <printint+0x31>
} else {
x = xx;
3bc: 8b 45 0c mov 0xc(%ebp),%eax
3bf: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3c2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3c9: 8b 4d f4 mov -0xc(%ebp),%ecx
3cc: 8d 41 01 lea 0x1(%ecx),%eax
3cf: 89 45 f4 mov %eax,-0xc(%ebp)
3d2: 8b 5d 10 mov 0x10(%ebp),%ebx
3d5: 8b 45 ec mov -0x14(%ebp),%eax
3d8: ba 00 00 00 00 mov $0x0,%edx
3dd: f7 f3 div %ebx
3df: 89 d0 mov %edx,%eax
3e1: 0f b6 80 60 0a 00 00 movzbl 0xa60(%eax),%eax
3e8: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
3ec: 8b 5d 10 mov 0x10(%ebp),%ebx
3ef: 8b 45 ec mov -0x14(%ebp),%eax
3f2: ba 00 00 00 00 mov $0x0,%edx
3f7: f7 f3 div %ebx
3f9: 89 45 ec mov %eax,-0x14(%ebp)
3fc: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
400: 75 c7 jne 3c9 <printint+0x38>
if(neg)
402: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
406: 74 0e je 416 <printint+0x85>
buf[i++] = '-';
408: 8b 45 f4 mov -0xc(%ebp),%eax
40b: 8d 50 01 lea 0x1(%eax),%edx
40e: 89 55 f4 mov %edx,-0xc(%ebp)
411: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
416: eb 1d jmp 435 <printint+0xa4>
putc(fd, buf[i]);
418: 8d 55 dc lea -0x24(%ebp),%edx
41b: 8b 45 f4 mov -0xc(%ebp),%eax
41e: 01 d0 add %edx,%eax
420: 0f b6 00 movzbl (%eax),%eax
423: 0f be c0 movsbl %al,%eax
426: 83 ec 08 sub $0x8,%esp
429: 50 push %eax
42a: ff 75 08 pushl 0x8(%ebp)
42d: e8 3d ff ff ff call 36f <putc>
432: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
435: 83 6d f4 01 subl $0x1,-0xc(%ebp)
439: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
43d: 79 d9 jns 418 <printint+0x87>
putc(fd, buf[i]);
}
43f: 8b 5d fc mov -0x4(%ebp),%ebx
442: c9 leave
443: c3 ret
00000444 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
444: 55 push %ebp
445: 89 e5 mov %esp,%ebp
447: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
44a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
451: 8d 45 0c lea 0xc(%ebp),%eax
454: 83 c0 04 add $0x4,%eax
457: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
45a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
461: e9 59 01 00 00 jmp 5bf <printf+0x17b>
c = fmt[i] & 0xff;
466: 8b 55 0c mov 0xc(%ebp),%edx
469: 8b 45 f0 mov -0x10(%ebp),%eax
46c: 01 d0 add %edx,%eax
46e: 0f b6 00 movzbl (%eax),%eax
471: 0f be c0 movsbl %al,%eax
474: 25 ff 00 00 00 and $0xff,%eax
479: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
47c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
480: 75 2c jne 4ae <printf+0x6a>
if(c == '%'){
482: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
486: 75 0c jne 494 <printf+0x50>
state = '%';
488: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
48f: e9 27 01 00 00 jmp 5bb <printf+0x177>
} else {
putc(fd, c);
494: 8b 45 e4 mov -0x1c(%ebp),%eax
497: 0f be c0 movsbl %al,%eax
49a: 83 ec 08 sub $0x8,%esp
49d: 50 push %eax
49e: ff 75 08 pushl 0x8(%ebp)
4a1: e8 c9 fe ff ff call 36f <putc>
4a6: 83 c4 10 add $0x10,%esp
4a9: e9 0d 01 00 00 jmp 5bb <printf+0x177>
}
} else if(state == '%'){
4ae: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4b2: 0f 85 03 01 00 00 jne 5bb <printf+0x177>
if(c == 'd'){
4b8: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4bc: 75 1e jne 4dc <printf+0x98>
printint(fd, *ap, 10, 1);
4be: 8b 45 e8 mov -0x18(%ebp),%eax
4c1: 8b 00 mov (%eax),%eax
4c3: 6a 01 push $0x1
4c5: 6a 0a push $0xa
4c7: 50 push %eax
4c8: ff 75 08 pushl 0x8(%ebp)
4cb: e8 c1 fe ff ff call 391 <printint>
4d0: 83 c4 10 add $0x10,%esp
ap++;
4d3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4d7: e9 d8 00 00 00 jmp 5b4 <printf+0x170>
} else if(c == 'x' || c == 'p'){
4dc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4e0: 74 06 je 4e8 <printf+0xa4>
4e2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4e6: 75 1e jne 506 <printf+0xc2>
printint(fd, *ap, 16, 0);
4e8: 8b 45 e8 mov -0x18(%ebp),%eax
4eb: 8b 00 mov (%eax),%eax
4ed: 6a 00 push $0x0
4ef: 6a 10 push $0x10
4f1: 50 push %eax
4f2: ff 75 08 pushl 0x8(%ebp)
4f5: e8 97 fe ff ff call 391 <printint>
4fa: 83 c4 10 add $0x10,%esp
ap++;
4fd: 83 45 e8 04 addl $0x4,-0x18(%ebp)
501: e9 ae 00 00 00 jmp 5b4 <printf+0x170>
} else if(c == 's'){
506: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
50a: 75 43 jne 54f <printf+0x10b>
s = (char*)*ap;
50c: 8b 45 e8 mov -0x18(%ebp),%eax
50f: 8b 00 mov (%eax),%eax
511: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
514: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
518: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
51c: 75 07 jne 525 <printf+0xe1>
s = "(null)";
51e: c7 45 f4 0c 08 00 00 movl $0x80c,-0xc(%ebp)
while(*s != 0){
525: eb 1c jmp 543 <printf+0xff>
putc(fd, *s);
527: 8b 45 f4 mov -0xc(%ebp),%eax
52a: 0f b6 00 movzbl (%eax),%eax
52d: 0f be c0 movsbl %al,%eax
530: 83 ec 08 sub $0x8,%esp
533: 50 push %eax
534: ff 75 08 pushl 0x8(%ebp)
537: e8 33 fe ff ff call 36f <putc>
53c: 83 c4 10 add $0x10,%esp
s++;
53f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
543: 8b 45 f4 mov -0xc(%ebp),%eax
546: 0f b6 00 movzbl (%eax),%eax
549: 84 c0 test %al,%al
54b: 75 da jne 527 <printf+0xe3>
54d: eb 65 jmp 5b4 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
54f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
553: 75 1d jne 572 <printf+0x12e>
putc(fd, *ap);
555: 8b 45 e8 mov -0x18(%ebp),%eax
558: 8b 00 mov (%eax),%eax
55a: 0f be c0 movsbl %al,%eax
55d: 83 ec 08 sub $0x8,%esp
560: 50 push %eax
561: ff 75 08 pushl 0x8(%ebp)
564: e8 06 fe ff ff call 36f <putc>
569: 83 c4 10 add $0x10,%esp
ap++;
56c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
570: eb 42 jmp 5b4 <printf+0x170>
} else if(c == '%'){
572: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
576: 75 17 jne 58f <printf+0x14b>
putc(fd, c);
578: 8b 45 e4 mov -0x1c(%ebp),%eax
57b: 0f be c0 movsbl %al,%eax
57e: 83 ec 08 sub $0x8,%esp
581: 50 push %eax
582: ff 75 08 pushl 0x8(%ebp)
585: e8 e5 fd ff ff call 36f <putc>
58a: 83 c4 10 add $0x10,%esp
58d: eb 25 jmp 5b4 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
58f: 83 ec 08 sub $0x8,%esp
592: 6a 25 push $0x25
594: ff 75 08 pushl 0x8(%ebp)
597: e8 d3 fd ff ff call 36f <putc>
59c: 83 c4 10 add $0x10,%esp
putc(fd, c);
59f: 8b 45 e4 mov -0x1c(%ebp),%eax
5a2: 0f be c0 movsbl %al,%eax
5a5: 83 ec 08 sub $0x8,%esp
5a8: 50 push %eax
5a9: ff 75 08 pushl 0x8(%ebp)
5ac: e8 be fd ff ff call 36f <putc>
5b1: 83 c4 10 add $0x10,%esp
}
state = 0;
5b4: 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++){
5bb: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5bf: 8b 55 0c mov 0xc(%ebp),%edx
5c2: 8b 45 f0 mov -0x10(%ebp),%eax
5c5: 01 d0 add %edx,%eax
5c7: 0f b6 00 movzbl (%eax),%eax
5ca: 84 c0 test %al,%al
5cc: 0f 85 94 fe ff ff jne 466 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
5d2: c9 leave
5d3: c3 ret
000005d4 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5d4: 55 push %ebp
5d5: 89 e5 mov %esp,%ebp
5d7: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5da: 8b 45 08 mov 0x8(%ebp),%eax
5dd: 83 e8 08 sub $0x8,%eax
5e0: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5e3: a1 7c 0a 00 00 mov 0xa7c,%eax
5e8: 89 45 fc mov %eax,-0x4(%ebp)
5eb: eb 24 jmp 611 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5ed: 8b 45 fc mov -0x4(%ebp),%eax
5f0: 8b 00 mov (%eax),%eax
5f2: 3b 45 fc cmp -0x4(%ebp),%eax
5f5: 77 12 ja 609 <free+0x35>
5f7: 8b 45 f8 mov -0x8(%ebp),%eax
5fa: 3b 45 fc cmp -0x4(%ebp),%eax
5fd: 77 24 ja 623 <free+0x4f>
5ff: 8b 45 fc mov -0x4(%ebp),%eax
602: 8b 00 mov (%eax),%eax
604: 3b 45 f8 cmp -0x8(%ebp),%eax
607: 77 1a ja 623 <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)
609: 8b 45 fc mov -0x4(%ebp),%eax
60c: 8b 00 mov (%eax),%eax
60e: 89 45 fc mov %eax,-0x4(%ebp)
611: 8b 45 f8 mov -0x8(%ebp),%eax
614: 3b 45 fc cmp -0x4(%ebp),%eax
617: 76 d4 jbe 5ed <free+0x19>
619: 8b 45 fc mov -0x4(%ebp),%eax
61c: 8b 00 mov (%eax),%eax
61e: 3b 45 f8 cmp -0x8(%ebp),%eax
621: 76 ca jbe 5ed <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
623: 8b 45 f8 mov -0x8(%ebp),%eax
626: 8b 40 04 mov 0x4(%eax),%eax
629: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
630: 8b 45 f8 mov -0x8(%ebp),%eax
633: 01 c2 add %eax,%edx
635: 8b 45 fc mov -0x4(%ebp),%eax
638: 8b 00 mov (%eax),%eax
63a: 39 c2 cmp %eax,%edx
63c: 75 24 jne 662 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
63e: 8b 45 f8 mov -0x8(%ebp),%eax
641: 8b 50 04 mov 0x4(%eax),%edx
644: 8b 45 fc mov -0x4(%ebp),%eax
647: 8b 00 mov (%eax),%eax
649: 8b 40 04 mov 0x4(%eax),%eax
64c: 01 c2 add %eax,%edx
64e: 8b 45 f8 mov -0x8(%ebp),%eax
651: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
654: 8b 45 fc mov -0x4(%ebp),%eax
657: 8b 00 mov (%eax),%eax
659: 8b 10 mov (%eax),%edx
65b: 8b 45 f8 mov -0x8(%ebp),%eax
65e: 89 10 mov %edx,(%eax)
660: eb 0a jmp 66c <free+0x98>
} else
bp->s.ptr = p->s.ptr;
662: 8b 45 fc mov -0x4(%ebp),%eax
665: 8b 10 mov (%eax),%edx
667: 8b 45 f8 mov -0x8(%ebp),%eax
66a: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
66c: 8b 45 fc mov -0x4(%ebp),%eax
66f: 8b 40 04 mov 0x4(%eax),%eax
672: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
679: 8b 45 fc mov -0x4(%ebp),%eax
67c: 01 d0 add %edx,%eax
67e: 3b 45 f8 cmp -0x8(%ebp),%eax
681: 75 20 jne 6a3 <free+0xcf>
p->s.size += bp->s.size;
683: 8b 45 fc mov -0x4(%ebp),%eax
686: 8b 50 04 mov 0x4(%eax),%edx
689: 8b 45 f8 mov -0x8(%ebp),%eax
68c: 8b 40 04 mov 0x4(%eax),%eax
68f: 01 c2 add %eax,%edx
691: 8b 45 fc mov -0x4(%ebp),%eax
694: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
697: 8b 45 f8 mov -0x8(%ebp),%eax
69a: 8b 10 mov (%eax),%edx
69c: 8b 45 fc mov -0x4(%ebp),%eax
69f: 89 10 mov %edx,(%eax)
6a1: eb 08 jmp 6ab <free+0xd7>
} else
p->s.ptr = bp;
6a3: 8b 45 fc mov -0x4(%ebp),%eax
6a6: 8b 55 f8 mov -0x8(%ebp),%edx
6a9: 89 10 mov %edx,(%eax)
freep = p;
6ab: 8b 45 fc mov -0x4(%ebp),%eax
6ae: a3 7c 0a 00 00 mov %eax,0xa7c
}
6b3: c9 leave
6b4: c3 ret
000006b5 <morecore>:
static Header*
morecore(uint nu)
{
6b5: 55 push %ebp
6b6: 89 e5 mov %esp,%ebp
6b8: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
6bb: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6c2: 77 07 ja 6cb <morecore+0x16>
nu = 4096;
6c4: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6cb: 8b 45 08 mov 0x8(%ebp),%eax
6ce: c1 e0 03 shl $0x3,%eax
6d1: 83 ec 0c sub $0xc,%esp
6d4: 50 push %eax
6d5: e8 75 fc ff ff call 34f <sbrk>
6da: 83 c4 10 add $0x10,%esp
6dd: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6e0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6e4: 75 07 jne 6ed <morecore+0x38>
return 0;
6e6: b8 00 00 00 00 mov $0x0,%eax
6eb: eb 26 jmp 713 <morecore+0x5e>
hp = (Header*)p;
6ed: 8b 45 f4 mov -0xc(%ebp),%eax
6f0: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
6f3: 8b 45 f0 mov -0x10(%ebp),%eax
6f6: 8b 55 08 mov 0x8(%ebp),%edx
6f9: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
6fc: 8b 45 f0 mov -0x10(%ebp),%eax
6ff: 83 c0 08 add $0x8,%eax
702: 83 ec 0c sub $0xc,%esp
705: 50 push %eax
706: e8 c9 fe ff ff call 5d4 <free>
70b: 83 c4 10 add $0x10,%esp
return freep;
70e: a1 7c 0a 00 00 mov 0xa7c,%eax
}
713: c9 leave
714: c3 ret
00000715 <malloc>:
void*
malloc(uint nbytes)
{
715: 55 push %ebp
716: 89 e5 mov %esp,%ebp
718: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
71b: 8b 45 08 mov 0x8(%ebp),%eax
71e: 83 c0 07 add $0x7,%eax
721: c1 e8 03 shr $0x3,%eax
724: 83 c0 01 add $0x1,%eax
727: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
72a: a1 7c 0a 00 00 mov 0xa7c,%eax
72f: 89 45 f0 mov %eax,-0x10(%ebp)
732: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
736: 75 23 jne 75b <malloc+0x46>
base.s.ptr = freep = prevp = &base;
738: c7 45 f0 74 0a 00 00 movl $0xa74,-0x10(%ebp)
73f: 8b 45 f0 mov -0x10(%ebp),%eax
742: a3 7c 0a 00 00 mov %eax,0xa7c
747: a1 7c 0a 00 00 mov 0xa7c,%eax
74c: a3 74 0a 00 00 mov %eax,0xa74
base.s.size = 0;
751: c7 05 78 0a 00 00 00 movl $0x0,0xa78
758: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
75b: 8b 45 f0 mov -0x10(%ebp),%eax
75e: 8b 00 mov (%eax),%eax
760: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
763: 8b 45 f4 mov -0xc(%ebp),%eax
766: 8b 40 04 mov 0x4(%eax),%eax
769: 3b 45 ec cmp -0x14(%ebp),%eax
76c: 72 4d jb 7bb <malloc+0xa6>
if(p->s.size == nunits)
76e: 8b 45 f4 mov -0xc(%ebp),%eax
771: 8b 40 04 mov 0x4(%eax),%eax
774: 3b 45 ec cmp -0x14(%ebp),%eax
777: 75 0c jne 785 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
779: 8b 45 f4 mov -0xc(%ebp),%eax
77c: 8b 10 mov (%eax),%edx
77e: 8b 45 f0 mov -0x10(%ebp),%eax
781: 89 10 mov %edx,(%eax)
783: eb 26 jmp 7ab <malloc+0x96>
else {
p->s.size -= nunits;
785: 8b 45 f4 mov -0xc(%ebp),%eax
788: 8b 40 04 mov 0x4(%eax),%eax
78b: 2b 45 ec sub -0x14(%ebp),%eax
78e: 89 c2 mov %eax,%edx
790: 8b 45 f4 mov -0xc(%ebp),%eax
793: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
796: 8b 45 f4 mov -0xc(%ebp),%eax
799: 8b 40 04 mov 0x4(%eax),%eax
79c: c1 e0 03 shl $0x3,%eax
79f: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7a2: 8b 45 f4 mov -0xc(%ebp),%eax
7a5: 8b 55 ec mov -0x14(%ebp),%edx
7a8: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7ab: 8b 45 f0 mov -0x10(%ebp),%eax
7ae: a3 7c 0a 00 00 mov %eax,0xa7c
return (void*)(p + 1);
7b3: 8b 45 f4 mov -0xc(%ebp),%eax
7b6: 83 c0 08 add $0x8,%eax
7b9: eb 3b jmp 7f6 <malloc+0xe1>
}
if(p == freep)
7bb: a1 7c 0a 00 00 mov 0xa7c,%eax
7c0: 39 45 f4 cmp %eax,-0xc(%ebp)
7c3: 75 1e jne 7e3 <malloc+0xce>
if((p = morecore(nunits)) == 0)
7c5: 83 ec 0c sub $0xc,%esp
7c8: ff 75 ec pushl -0x14(%ebp)
7cb: e8 e5 fe ff ff call 6b5 <morecore>
7d0: 83 c4 10 add $0x10,%esp
7d3: 89 45 f4 mov %eax,-0xc(%ebp)
7d6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7da: 75 07 jne 7e3 <malloc+0xce>
return 0;
7dc: b8 00 00 00 00 mov $0x0,%eax
7e1: eb 13 jmp 7f6 <malloc+0xe1>
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){
7e3: 8b 45 f4 mov -0xc(%ebp),%eax
7e6: 89 45 f0 mov %eax,-0x10(%ebp)
7e9: 8b 45 f4 mov -0xc(%ebp),%eax
7ec: 8b 00 mov (%eax),%eax
7ee: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
7f1: e9 6d ff ff ff jmp 763 <malloc+0x4e>
}
7f6: c9 leave
7f7: c3 ret
|
ANTLR/JSONLDGraphGenerator/fuente/GrammarjsonldParser.g4 | Alvarohf/University-work | 0 | 3206 | <reponame>Alvarohf/University-work<gh_stars>0
parser grammar GrammarjsonldParser;
options {
tokenVocab = GrammarjsonldLexer;
language=Java;
}
@header{
package fuente;
}
//Root node for json parsing
json: OPENBRACKET (context COMMA)? graphs CLOSEBRACKET;
//-----------------------CONTEXT---------------------------
//Context is formed by xsd, languageProperty, property, class and relationship items.
//Context parse
context:CONTEXT COLON OPENBRACKET ((xsd|languageProperty|contextClass|contextProperty|contextRelationship) COMMA?)+ CLOSEBRACKET;
//Language property wich is composed by id, language, gender, number and wordtype
languageProperty: LANGUAGEPROPERTY COLON OPENBRACKET contextId language gender number wordType CLOSEBRACKET;
//Parameters of the language property
language: LANGUAGE COLON OPENBRACKET contextType CLOSEBRACKET COMMA?;
gender: GENDER COLON OPENBRACKET contextType CLOSEBRACKET COMMA?;
number:NUMBER COLON OPENBRACKET contextType CLOSEBRACKET COMMA?;
wordType:WORDTYPE COLON OPENBRACKET contextType CLOSEBRACKET COMMA?;
//xsd
xsd: XSD COLON STRING;
//Context property wich is composed by id, name, label, optional, typeOf, isList, MultiplicityMin, MultiplicityMax, usedBy and LanguageData fields
contextProperty: PROPERTY COLON OPENBRACKET ((contextId|contextName|contextTypeOf|contextLabel|contextIsList|contextOptional|contextMultiplicityMax|contextMultiplicityMin|contextUsedBy|contextLanguageData)COMMA? )* CLOSEBRACKET;
//Parameters of the property
contextId:ID COLON value COMMA;
contextName:NAME COLON OPENBRACKET ((contextType|contextMandatory)COMMA?)* CLOSEBRACKET;
contextOptional:OPTIONAL COLON OPENBRACKET ((contextType|contextMandatory|contextValue)COMMA?)* CLOSEBRACKET;
contextTypeOf: TYPEOF COLON OPENBRACKET ((contextType|contextMandatory)COMMA?)* CLOSEBRACKET;
contextMultiplicityMax:MULTIPLICITYMAX COLON OPENBRACKET ((contextType|contextMandatory|contextValue)COMMA?)* CLOSEBRACKET;
contextMultiplicityMin:MULTIPLICITYMIN COLON OPENBRACKET ((contextType|contextMandatory|contextValue)COMMA?)* CLOSEBRACKET;
contextIsList:ISLIST COLON OPENBRACKET ((contextType|contextMandatory|contextValue)COMMA?)* CLOSEBRACKET;
contextLabel:LABEL COLON OPENBRACKET ((contextType|contextMandatory|contextContainer)COMMA?)* CLOSEBRACKET;
contextUsedBy:USEDBY COLON OPENBRACKET ((contextMandatory|contextId|contextContainer)COMMA?)* CLOSEBRACKET;
contextLanguageData:LANGUAGEDATA COLON OPENBRACKET ((contextMandatory|contextId|contextContainer)COMMA?)* CLOSEBRACKET;
//Context class wich is formed by id, name, label, inherits and properties
contextClass: CONTEXTCLASS COLON OPENBRACKET ((contextId|contextName|contextLabel|contextInherits|contextProperties|contextOid) COMMA?)* CLOSEBRACKET;
//Parameters of the class
contextInherits: INHERITS COLON OPENBRACKET ((contextMandatory|contextId)COMMA?)* CLOSEBRACKET;
contextProperties:PROPERTIES COLON OPENBRACKET ((contextMandatory|contextId|contextContainer)COMMA?)* CLOSEBRACKET;
contextOid:OID COLON OPENBRACKET ((contextType|contextMandatory)COMMA?)* CLOSEBRACKET;
//Context relationship wich is composed by id, name, label, from, to, reverseName, labelReverseName and properties
contextRelationship:RELATIONSHIP COLON OPENBRACKET ((contextId|contextName|contextLabel|contextFrom|contextTo|contextReverseName|contextLabelReverseName|contextProperties)COMMA?)* CLOSEBRACKET;
//Parameters of the relationship
contextFrom:FROM COLON OPENBRACKET ((contextMandatory|contextId)COMMA?)* CLOSEBRACKET;
contextTo:TO COLON OPENBRACKET ((contextMandatory|contextId)COMMA?)* CLOSEBRACKET;
contextReverseName:REVERSENAME COLON OPENBRACKET ((contextMandatory|contextType)COMMA?)* CLOSEBRACKET;
contextLabelReverseName: REVERSELABEL COLON OPENBRACKET ((contextType|contextMandatory|contextContainer)COMMA?)* CLOSEBRACKET;
//Context general parameters that are used by all of the parameters
contextType: CONTEXTTYPE COLON value;
contextValue: VALUE COLON (STRING|booleanValue);
contextContainer: CONTAINER COLON STRING;
contextMandatory: MANDATORY COLON booleanValue;
//-----------------------GRAPHS---------------------------
//All the graphs that are in the json
graphs: STRING COLON SQUAREOPENBRACKET graph* SQUARECLOSEBRACKET;
//Individual graph with name and type
graph: OPENBRACKET value COLON OPENBRACKET graphType CLOSEBRACKET CLOSEBRACKET COMMA?;
//Graph type with its graph
graphType: GRAPHTYPE COLON SQUAREOPENBRACKET (classObject|relationship|property)* SQUARECLOSEBRACKET;
//Property wich is composed by id, name, label, optional, typeOf, isList, MultiplicityMin, MultiplicityMax, usedBy and LanguageData fields
property:OPENBRACKET id (name|typeOf|label|isList|optional|multiplicityMax|multiplicityMin|usedBy|languageData)* CLOSEBRACKET COMMA?;
//Components of property
id:ID COLON value COMMA;
name: NAME COLON value COMMA;
typeOf: TYPEOF COLON value COMMA?;
label:LABEL COLON OPENBRACKET reference COMMA? (reference COMMA?)* CLOSEBRACKET COMMA?;
isList: ISLIST COLON booleanValue COMMA?;
booleanValue: TRUE|FALSE;
optional:OPTIONAL COLON booleanValue COMMA?;
multiplicityMax: MULTIPLICITYMAX COLON value COMMA?;
multiplicityMin:MULTIPLICITYMIN COLON value COMMA?;
usedBy:USEDBY COLON SQUAREOPENBRACKET value COMMA? (value COMMA?)* SQUARECLOSEBRACKET COMMA?;
languageData:LANGUAGEDATA COLON SQUAREOPENBRACKET value COMMA? (value COMMA?)* SQUARECLOSEBRACKET COMMA?;
//We have to create this to avoid conflicts between reserved names and custom names
reference: STRING COLON value;
value: STRING | PROPERTIES | LANGUAGE | NAME;
//Class wich is formed by id, name, label, inherits and properties
classObject: OPENBRACKET id (name|oid|label|inherits|properties)* CLOSEBRACKET COMMA?;
inherits:INHERITS COLON value COMMA?;
properties:PROPERTIES COLON SQUAREOPENBRACKET value COMMA? (value COMMA?)* SQUARECLOSEBRACKET COMMA?;
oid: OID COLON SQUAREOPENBRACKET value? COMMA? (value COMMA?)* SQUARECLOSEBRACKET COMMA?;
//Relationship defined in the graph wich is composed by id, name, label, from, to, reverseName, labelReverseName and properties
relationship:OPENBRACKET id (name|reverseName|label|labelReverseName|from|to|properties)* CLOSEBRACKET COMMA?;
reverseName:REVERSENAME COLON value COMMA?;
labelReverseName:REVERSELABEL COLON OPENBRACKET reference COMMA? (reference COMMA?)* CLOSEBRACKET COMMA?;
from:FROM COLON value COMMA;
to:TO COLON value COMMA?;
|
quit-iterm.scpt | JonathanBuchh/AppleScripts | 0 | 2792 | <filename>quit-iterm.scpt
tell application "iTerm"
quit
end tell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.