text
stringlengths
1
1.05M
section .text global ft_write ft_write: mov rax, 1 syscall cmp rax, 0 jl ft_write_error ret ft_write_error: mov rax, -1 ret
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r14 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x761a, %rdi cmp %rbx, %rbx movb (%rdi), %r13b nop nop nop dec %r12 lea addresses_A_ht+0xd864, %r14 nop nop xor $57310, %r13 mov (%r14), %r10 add %rdi, %rdi lea addresses_normal_ht+0x18952, %rsi lea addresses_WT_ht+0x6076, %rdi nop nop nop nop nop cmp $33175, %r10 mov $7, %rcx rep movsq nop nop nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0x3908, %r10 nop nop sub $34341, %r14 mov (%r10), %edi nop add $64041, %r14 lea addresses_A_ht+0xe5b2, %rbx inc %rdi movb (%rbx), %r12b nop nop nop cmp $13207, %rcx lea addresses_UC_ht+0x9952, %r13 nop nop and %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm3 movups %xmm3, (%r13) nop nop and %rdi, %rdi lea addresses_WC_ht+0x18da, %r14 nop nop nop add %r13, %r13 movb $0x61, (%r14) nop xor $7878, %rcx lea addresses_WT_ht+0xc552, %rsi lea addresses_UC_ht+0x208c, %rdi clflush (%rsi) nop sub $25604, %rbx mov $110, %rcx rep movsq and %rsi, %rsi lea addresses_D_ht+0xd872, %r10 nop sub $60044, %rdi mov $0x6162636465666768, %rsi movq %rsi, (%r10) add $15158, %rcx lea addresses_normal_ht+0xf732, %r13 nop inc %r14 mov (%r13), %ecx nop nop nop nop and %rdi, %rdi lea addresses_A_ht+0x2b52, %r13 nop nop nop nop nop and %r14, %r14 movups (%r13), %xmm6 vpextrq $0, %xmm6, %r12 nop nop nop sub %r12, %r12 lea addresses_WT_ht+0x7892, %rsi lea addresses_A_ht+0x1a11e, %rdi nop nop nop nop sub %rbx, %rbx mov $103, %rcx rep movsw nop nop nop nop nop sub $61876, %r10 pop %rsi pop %rdi pop %rcx pop %rbx pop %r14 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r15 push %rax push %rbx push %rdi // Store mov $0xb92, %r13 nop nop nop nop sub $23093, %r12 movw $0x5152, (%r13) nop sub %rbx, %rbx // Load lea addresses_WT+0x1952, %r13 nop nop nop nop cmp $42221, %r12 movups (%r13), %xmm0 vpextrq $1, %xmm0, %r15 nop nop inc %rbx // Store lea addresses_WT+0xf152, %rdi xor %r14, %r14 mov $0x5152535455565758, %r15 movq %r15, %xmm5 movaps %xmm5, (%rdi) nop nop nop nop add $21564, %r13 // Store lea addresses_UC+0xc152, %r13 nop nop nop nop nop sub $9205, %r12 movw $0x5152, (%r13) nop nop nop xor %r14, %r14 // Faulty Load lea addresses_RW+0x1e952, %r13 nop nop nop nop nop inc %r14 movb (%r13), %r15b lea oracles, %rax and $0xff, %r15 shlq $12, %r15 mov (%rax,%r15,1), %r15 pop %rdi pop %rbx pop %rax pop %r15 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_P', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT', 'AVXalign': True, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': True, 'same': False, 'congruent': 5, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
/** * Marlin 3D Printer Firmware * * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 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, see <https://www.gnu.org/licenses/>. * */ /** * HAL PersistentStore for STM32F1 */ #ifdef __STM32F1__ #include "../../inc/MarlinConfig.h" #if USE_WIRED_EEPROM #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" #ifndef MARLIN_EEPROM_SIZE #error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM." #endif size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; } bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_start() { eeprom_init(); #if ENABLED(SPI_EEPROM) #if SPI_CHAN_EEPROM1 == 1 SET_OUTPUT(BOARD_SPI1_SCK_PIN); SET_OUTPUT(BOARD_SPI1_MOSI_PIN); SET_INPUT(BOARD_SPI1_MISO_PIN); SET_OUTPUT(SPI_EEPROM1_CS); #endif spiInit(0); #endif return true; } bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { while (size--) { uint8_t * const p = (uint8_t * const)pos; uint8_t v = *value; // EEPROM has only ~100,000 write cycles, // so only write bytes that have changed! if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); return true; } } crc16(crc, &v, 1); pos++; value++; } return false; } bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing && value) *value = c; crc16(crc, &c, 1); pos++; value++; } while (--size); return false; } #endif // USE_WIRED_EEPROM #endif // __STM32F1__
; A338588: a(n)/A002939(n+1) is the Kirchhoff index of the disjoint union of two complete graphs each on n and n+1 vertices with the empty graph on n+1 vertices. ; 2,77,334,881,1826,3277,5342,8129,11746,16301,21902,28657,36674,46061,56926,69377,83522,99469,117326,137201,159202,183437,210014,239041,270626,304877,341902,381809,424706,470701,519902 mov $1,$0 mul $0,36 add $0,2 mov $2,$1 add $2,1 pow $2,2 mul $0,$2 mul $0,5 div $0,10 add $0,1
#ifndef ISL_CXX_UnionPwAff_IMPL_H #define ISL_CXX_UnionPwAff_IMPL_H #include "isl/UnionPwAff.h" #include "isl/PwAff.hpp" #include "isl/Ctx.hpp" #include "isl/IslException.h" #include "isl/UnionPwMultiAff.hpp" #include <string> #include <cassert> namespace isl { inline isl_union_pw_aff *UnionPwAff::GetCopy() const { return isl_union_pw_aff_copy((isl_union_pw_aff *)This); } inline UnionPwAff &UnionPwAff::operator=(const UnionPwAff &Other) { isl_union_pw_aff *New = Other.GetCopy(); ctx = Other.Context(); isl_union_pw_aff_free((isl_union_pw_aff *)This); This = New; return *this; } inline UnionPwAff UnionPwAff::fromPwAff(const PwAff &pa) { const Ctx &_ctx = pa.Context(); _ctx.lock(); isl_union_pw_aff *That = isl_union_pw_aff_from_pw_aff((pa).GetCopy()); _ctx.unlock(); if (_ctx.hasError()) { handleError("isl_union_pw_aff_from_pw_aff returned a NULL pointer."); } return UnionPwAff(_ctx, That); } inline UnionPwAff UnionPwAff::readFromStr(const Ctx &ctx, std::string str) { const Ctx &_ctx = ctx.Context(); _ctx.lock(); isl_union_pw_aff *That = isl_union_pw_aff_read_from_str((ctx.Get()), str.c_str()); _ctx.unlock(); if (_ctx.hasError()) { handleError("isl_union_pw_aff_read_from_str returned a NULL pointer."); } return UnionPwAff(_ctx, That); } inline UnionPwAff::~UnionPwAff() { isl_union_pw_aff_free((isl_union_pw_aff *)This); This = nullptr; } /// rief Release ownership of the wrapped object. /// /// You are on your own now buddy. /// The wrapper cannot be used anymore after calling Give() /// ///@return the wrapped isl object. inline isl_union_pw_aff *UnionPwAff::Give() { isl_union_pw_aff *res = (isl_union_pw_aff *)This; This = nullptr; return res; } /// \brief Unwrap the stored isl object. /// \returns A the wrapped isl object. inline isl_union_pw_aff *UnionPwAff::Get() const { return (isl_union_pw_aff *)This; } inline UnionPwAff UnionPwAff::add(const UnionPwAff &upa2) const { ctx.lock(); isl_union_pw_aff * res = isl_union_pw_aff_add((*this).GetCopy(), (upa2).GetCopy()); ctx.unlock(); if (ctx.hasError()) { handleError("isl_union_pw_aff_add returned a NULL pointer."); } return UnionPwAff(ctx, res); } inline UnionPwAff UnionPwAff::pullbackUnionPwMultiAff(const UnionPwMultiAff &upma) const { ctx.lock(); isl_union_pw_aff * res = isl_union_pw_aff_pullback_union_pw_multi_aff((*this).GetCopy(), (upma).GetCopy()); ctx.unlock(); if (ctx.hasError()) { handleError("isl_union_pw_aff_pullback_union_pw_multi_aff returned a NULL pointer."); } return UnionPwAff(ctx, res); } inline std::string UnionPwAff::toStr() const { ctx.lock(); char * res = isl_union_pw_aff_to_str((*this).Get()); ctx.unlock(); std::string res_; if (ctx.hasError()) { handleError("isl_union_pw_aff_to_str returned a NULL pointer."); } res_ = res; free((void *)res); return res_; } inline UnionPwAff UnionPwAff::unionAdd(const UnionPwAff &upa2) const { ctx.lock(); isl_union_pw_aff * res = isl_union_pw_aff_union_add((*this).GetCopy(), (upa2).GetCopy()); ctx.unlock(); if (ctx.hasError()) { handleError("isl_union_pw_aff_union_add returned a NULL pointer."); } return UnionPwAff(ctx, res); } } // namespace isl #endif //ISL_CXX_UnionPwAff_IMPL_H
/* * GDevelop JS Platform * Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights * reserved. This project is released under the MIT License. */ #include "AudioExtension.h" #include "GDCore/CommonTools.h" #include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h" #include "GDCore/Extensions/Builtin/AllBuiltinExtensions.h" #include "GDCore/IDE/Project/ArbitraryResourceWorker.h" #include "GDCore/Tools/Localization.h" namespace gdjs { AudioExtension::AudioExtension() { gd::BuiltinExtensionsImplementer::ImplementsAudioExtension(*this); GetAllActions()["PlaySound"].SetFunctionName("gdjs.evtTools.sound.playSound"); GetAllActions()["PlaySoundCanal"].SetFunctionName( "gdjs.evtTools.sound.playSoundOnChannel"); GetAllActions()["PlayMusic"].SetFunctionName("gdjs.evtTools.sound.playMusic"); GetAllActions()["PlayMusicCanal"].SetFunctionName( "gdjs.evtTools.sound.playMusicOnChannel"); GetAllActions()["StopSoundCanal"].SetFunctionName( "gdjs.evtTools.sound.stopSoundOnChannel"); GetAllActions()["PauseSoundCanal"].SetFunctionName( "gdjs.evtTools.sound.pauseSoundOnChannel"); GetAllActions()["RePlaySoundCanal"].SetFunctionName( "gdjs.evtTools.sound.continueSoundOnChannel"); GetAllActions()["StopMusicCanal"].SetFunctionName( "gdjs.evtTools.sound.stopMusicOnChannel"); GetAllActions()["PauseMusicCanal"].SetFunctionName( "gdjs.evtTools.sound.pauseMusicOnChannel"); GetAllActions()["RePlayMusicCanal"].SetFunctionName( "gdjs.evtTools.sound.continueMusicOnChannel"); GetAllActions()["FadeMusicVolume"].SetFunctionName( "gdjs.evtTools.sound.fadeMusicVolume"); GetAllActions()["PreloadMusic"].SetFunctionName( "gdjs.evtTools.sound.preloadMusic"); GetAllActions()["PreloadSound"].SetFunctionName( "gdjs.evtTools.sound.preloadSound"); GetAllActions()["UnloadMusic"].SetFunctionName( "gdjs.evtTools.sound.unloadMusic"); GetAllActions()["UnloadSound"].SetFunctionName( "gdjs.evtTools.sound.unloadSound"); GetAllActions()["UnloadAllAudio"].SetFunctionName( "gdjs.evtTools.sound.unloadAllAudio"); GetAllActions()["FadeSoundVolume"].SetFunctionName( "gdjs.evtTools.sound.fadeSoundVolume"); GetAllConditions()["MusicPlaying"].SetFunctionName( "gdjs.evtTools.sound.isMusicOnChannelPlaying"); GetAllConditions()["MusicPaused"].SetFunctionName( "gdjs.evtTools.sound.isMusicOnChannelPaused"); GetAllConditions()["MusicStopped"].SetFunctionName( "gdjs.evtTools.sound.isMusicOnChannelStopped"); GetAllConditions()["SoundPlaying"].SetFunctionName( "gdjs.evtTools.sound.isSoundOnChannelPlaying"); GetAllConditions()["SoundPaused"].SetFunctionName( "gdjs.evtTools.sound.isSoundOnChannelPaused"); GetAllConditions()["SoundStopped"].SetFunctionName( "gdjs.evtTools.sound.isSoundOnChannelStopped"); GetAllActions()["ModGlobalVolume"] .SetFunctionName("gdjs.evtTools.sound.setGlobalVolume") .SetGetter("gdjs.evtTools.sound.getGlobalVolume"); GetAllConditions()["GlobalVolume"].SetFunctionName( "gdjs.evtTools.sound.getGlobalVolume"); GetAllExpressions()["GlobalVolume"].SetFunctionName( "gdjs.evtTools.sound.getGlobalVolume"); GetAllActions()["ModVolumeSoundCanal"] .SetFunctionName("gdjs.evtTools.sound.setSoundOnChannelVolume") .SetGetter("gdjs.evtTools.sound.getSoundOnChannelVolume"); GetAllActions()["ModVolumeMusicCanal"] .SetFunctionName("gdjs.evtTools.sound.setMusicOnChannelVolume") .SetGetter("gdjs.evtTools.sound.getMusicOnChannelVolume"); GetAllConditions()["SoundCanalVolume"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelVolume"); GetAllConditions()["MusicCanalVolume"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelVolume"); GetAllActions()["ModPlayingOffsetSoundChannel"] .SetFunctionName("gdjs.evtTools.sound.setSoundOnChannelPlayingOffset") .SetGetter("gdjs.evtTools.sound.getSoundOnChannelPlayingOffset"); GetAllActions()["ModPlayingOffsetMusicChannel"] .SetFunctionName("gdjs.evtTools.sound.setMusicOnChannelPlayingOffset") .SetGetter("gdjs.evtTools.sound.getMusicOnChannelPlayingOffset"); GetAllConditions()["SoundChannelPlayingOffset"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelPlayingOffset"); GetAllConditions()["MusicChannelPlayingOffset"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelPlayingOffset"); GetAllActions()["ModPitchSoundChannel"] .SetFunctionName("gdjs.evtTools.sound.setSoundOnChannelPitch") .SetGetter("gdjs.evtTools.sound.getSoundOnChannelPitch"); GetAllActions()["ModPitchMusicChannel"] .SetFunctionName("gdjs.evtTools.sound.setMusicOnChannelPitch") .SetGetter("gdjs.evtTools.sound.getMusicOnChannelPitch"); GetAllConditions()["SoundChannelPitch"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelPitch"); GetAllConditions()["MusicChannelPitch"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelPitch"); GetAllExpressions()["SoundChannelVolume"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelVolume"); GetAllExpressions()["MusicChannelVolume"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelVolume"); GetAllExpressions()["SoundChannelPlayingOffset"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelPlayingOffset"); GetAllExpressions()["MusicChannelPlayingOffset"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelPlayingOffset"); GetAllExpressions()["SoundChannelPitch"].SetFunctionName( "gdjs.evtTools.sound.getSoundOnChannelPitch"); GetAllExpressions()["MusicChannelPitch"].SetFunctionName( "gdjs.evtTools.sound.getMusicOnChannelPitch"); StripUnimplementedInstructionsAndExpressions(); } } // namespace gdjs
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D94 move.l D1, (A1)+ 004D96 dbra D0, $4d94 011770 move.b (A6,D1.w), ($c6,A3) 011776 movea.l (A7)+, A6 [123p+ C6] 02B98A move.b ($c6,A2), D0 02B98E mulu.w D0, D1 [123p+ C6] 02BABC move.b ($c6,A6), D0 02BAC0 mulu.w D0, D1 [123p+ C6] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
;****************************************************************************** ;* SSE-optimized functions for the DCA decoder ;* Copyright (C) 2012-2014 Christophe Gisquet <christophe.gisquet@gmail.com> ;* ;* This file is part of Libav. ;* ;* Libav 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. ;* ;* Libav 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 Libav; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA pf_inv16: times 4 dd 0x3D800000 ; 1/16 SECTION .text ; void decode_hf(float dst[DCA_SUBBANDS][8], const int32_t vq_num[DCA_SUBBANDS], ; const int8_t hf_vq[1024][32], intptr_t vq_offset, ; int32_t scale[DCA_SUBBANDS][2], intptr_t start, intptr_t end) %macro DECODE_HF 0 cglobal decode_hf, 6,6,5, dst, num, src, offset, scale, start, end lea srcq, [srcq + offsetq] shl startq, 2 mov offsetd, endm %define DICT offsetq shl offsetq, 2 mov endm, offsetq .loop: %if ARCH_X86_64 mov offsetd, [scaleq + 2 * startq] cvtsi2ss m0, offsetd %else cvtsi2ss m0, [scaleq + 2 * startq] %endif mov offsetd, [numq + startq] mulss m0, [pf_inv16] shl DICT, 5 shufps m0, m0, 0 %if cpuflag(sse2) %if cpuflag(sse4) pmovsxbd m1, [srcq + DICT + 0] pmovsxbd m2, [srcq + DICT + 4] %else movq m1, [srcq + DICT] punpcklbw m1, m1 mova m2, m1 punpcklwd m1, m1 punpckhwd m2, m2 psrad m1, 24 psrad m2, 24 %endif cvtdq2ps m1, m1 cvtdq2ps m2, m2 %else movd mm0, [srcq + DICT + 0] movd mm1, [srcq + DICT + 4] punpcklbw mm0, mm0 punpcklbw mm1, mm1 movq mm2, mm0 movq mm3, mm1 punpcklwd mm0, mm0 punpcklwd mm1, mm1 punpckhwd mm2, mm2 punpckhwd mm3, mm3 psrad mm0, 24 psrad mm1, 24 psrad mm2, 24 psrad mm3, 24 cvtpi2ps m1, mm0 cvtpi2ps m2, mm1 cvtpi2ps m3, mm2 cvtpi2ps m4, mm3 shufps m0, m0, 0 shufps m1, m3, q1010 shufps m2, m4, q1010 %endif mulps m1, m0 mulps m2, m0 mova [dstq + 8 * startq + 0], m1 mova [dstq + 8 * startq + 16], m2 add startq, 4 cmp startq, endm jl .loop .end: %if notcpuflag(sse2) emms %endif REP_RET %endmacro %if ARCH_X86_32 INIT_XMM sse DECODE_HF %endif INIT_XMM sse2 DECODE_HF INIT_XMM sse4 DECODE_HF ; %1=v0/v1 %2=in1 %3=in2 %macro FIR_LOOP 2-3 .loop%1: %define va m1 %define vb m2 %if %1 %define OFFSET 0 %else %define OFFSET NUM_COEF*count %endif ; for v0, incrementing and for v1, decrementing mova va, [cf0q + OFFSET] mova vb, [cf0q + OFFSET + 4*NUM_COEF] %if %0 == 3 mova m4, [cf0q + OFFSET + mmsize] mova m0, [cf0q + OFFSET + 4*NUM_COEF + mmsize] %endif mulps va, %2 mulps vb, %2 %if %0 == 3 mulps m4, %3 mulps m0, %3 addps va, m4 addps vb, m0 %endif ; va = va1 va2 va3 va4 ; vb = vb1 vb2 vb3 vb4 %if %1 SWAP va, vb %endif mova m4, va unpcklps va, vb ; va3 vb3 va4 vb4 unpckhps m4, vb ; va1 vb1 va2 vb2 addps m4, va ; va1+3 vb1+3 va2+4 vb2+4 movhlps vb, m4 ; va1+3 vb1+3 addps vb, m4 ; va0..4 vb0..4 movlps [outq + count], vb %if %1 sub cf0q, 8*NUM_COEF %endif add count, 8 jl .loop%1 %endmacro ; void dca_lfe_fir(float *out, float *in, float *coefs) %macro DCA_LFE_FIR 1 cglobal dca_lfe_fir%1, 3,3,6-%1, out, in, cf0 %define IN1 m3 %define IN2 m5 %define count inq %define NUM_COEF 4*(2-%1) %define NUM_OUT 32*(%1+1) movu IN1, [inq + 4 - 1*mmsize] shufps IN1, IN1, q0123 %if %1 == 0 movu IN2, [inq + 4 - 2*mmsize] shufps IN2, IN2, q0123 %endif mov count, -4*NUM_OUT add cf0q, 4*NUM_COEF*NUM_OUT add outq, 4*NUM_OUT ; compute v0 first %if %1 == 0 FIR_LOOP 0, IN1, IN2 %else FIR_LOOP 0, IN1 %endif shufps IN1, IN1, q0123 mov count, -4*NUM_OUT ; cf1 already correctly positioned add outq, 4*NUM_OUT ; outq now at out2 sub cf0q, 8*NUM_COEF %if %1 == 0 shufps IN2, IN2, q0123 FIR_LOOP 1, IN2, IN1 %else FIR_LOOP 1, IN1 %endif RET %endmacro INIT_XMM sse DCA_LFE_FIR 0 DCA_LFE_FIR 1 %macro SETZERO 1 %if cpuflag(sse2) && notcpuflag(avx) pxor %1, %1 %else xorps %1, %1, %1 %endif %endmacro %macro SHUF 3 %if cpuflag(avx) mova %3, [%2 - 16] vperm2f128 %1, %3, %3, 1 vshufps %1, %1, %1, q0123 %elif cpuflag(sse2) pshufd %1, [%2], q0123 %else mova %1, [%2] shufps %1, %1, q0123 %endif %endmacro %macro INNER_LOOP 1 ; reading backwards: ptr1 = synth_buf + j + i; ptr2 = synth_buf + j - i ;~ a += window[i + j] * (-synth_buf[15 - i + j]) ;~ b += window[i + j + 16] * (synth_buf[i + j]) SHUF m5, ptr2 + j + (15 - 3) * 4, m6 mova m6, [ptr1 + j] %if ARCH_X86_64 SHUF m11, ptr2 + j + (15 - 3) * 4 - mmsize, m12 mova m12, [ptr1 + j + mmsize] %endif %if cpuflag(fma3) fmaddps m2, m6, [win + %1 + j + 16 * 4], m2 fnmaddps m1, m5, [win + %1 + j], m1 %if ARCH_X86_64 fmaddps m8, m12, [win + %1 + j + mmsize + 16 * 4], m8 fnmaddps m7, m11, [win + %1 + j + mmsize], m7 %endif %else ; non-FMA mulps m6, m6, [win + %1 + j + 16 * 4] mulps m5, m5, [win + %1 + j] %if ARCH_X86_64 mulps m12, m12, [win + %1 + j + mmsize + 16 * 4] mulps m11, m11, [win + %1 + j + mmsize] %endif addps m2, m2, m6 subps m1, m1, m5 %if ARCH_X86_64 addps m8, m8, m12 subps m7, m7, m11 %endif %endif ; cpuflag(fma3) ;~ c += window[i + j + 32] * (synth_buf[16 + i + j]) ;~ d += window[i + j + 48] * (synth_buf[31 - i + j]) SHUF m6, ptr2 + j + (31 - 3) * 4, m5 mova m5, [ptr1 + j + 16 * 4] %if ARCH_X86_64 SHUF m12, ptr2 + j + (31 - 3) * 4 - mmsize, m11 mova m11, [ptr1 + j + mmsize + 16 * 4] %endif %if cpuflag(fma3) fmaddps m3, m5, [win + %1 + j + 32 * 4], m3 fmaddps m4, m6, [win + %1 + j + 48 * 4], m4 %if ARCH_X86_64 fmaddps m9, m11, [win + %1 + j + mmsize + 32 * 4], m9 fmaddps m10, m12, [win + %1 + j + mmsize + 48 * 4], m10 %endif %else ; non-FMA mulps m5, m5, [win + %1 + j + 32 * 4] mulps m6, m6, [win + %1 + j + 48 * 4] %if ARCH_X86_64 mulps m11, m11, [win + %1 + j + mmsize + 32 * 4] mulps m12, m12, [win + %1 + j + mmsize + 48 * 4] %endif addps m3, m3, m5 addps m4, m4, m6 %if ARCH_X86_64 addps m9, m9, m11 addps m10, m10, m12 %endif %endif ; cpuflag(fma3) sub j, 64 * 4 %endmacro ; void ff_synth_filter_inner_<opt>(float *synth_buf, float synth_buf2[32], ; const float window[512], float out[32], ; intptr_t offset, float scale) %macro SYNTH_FILTER 0 cglobal synth_filter_inner, 0, 6 + 4 * ARCH_X86_64, 7 + 6 * ARCH_X86_64, \ synth_buf, synth_buf2, window, out, off, scale %define scale m0 %if ARCH_X86_32 || WIN64 %if cpuflag(sse2) && notcpuflag(avx) movd scale, scalem SPLATD m0 %else VBROADCASTSS m0, scalem %endif ; Make sure offset is in a register and not on the stack %define OFFQ r4q %else SPLATD xmm0 %if cpuflag(avx) vinsertf128 m0, m0, xmm0, 1 %endif %define OFFQ offq %endif ; prepare inner counter limit 1 mov r5q, 480 sub r5q, offmp and r5q, -64 shl r5q, 2 %if ARCH_X86_32 || notcpuflag(avx) mov OFFQ, r5q %define i r5q mov i, 16 * 4 - (ARCH_X86_64 + 1) * mmsize ; main loop counter %else %define i 0 %define OFFQ r5q %endif %define buf2 synth_buf2q %if ARCH_X86_32 mov buf2, synth_buf2mp %endif .mainloop ; m1 = a m2 = b m3 = c m4 = d SETZERO m3 SETZERO m4 mova m1, [buf2 + i] mova m2, [buf2 + i + 16 * 4] %if ARCH_X86_32 %define ptr1 r0q %define ptr2 r1q %define win r2q %define j r3q mov win, windowm mov ptr1, synth_bufm %if ARCH_X86_32 || notcpuflag(avx) add win, i add ptr1, i %endif %else ; ARCH_X86_64 %define ptr1 r6q %define ptr2 r7q ; must be loaded %define win r8q %define j r9q SETZERO m9 SETZERO m10 mova m7, [buf2 + i + mmsize] mova m8, [buf2 + i + mmsize + 16 * 4] lea win, [windowq + i] lea ptr1, [synth_bufq + i] %endif mov ptr2, synth_bufmp ; prepare the inner loop counter mov j, OFFQ %if ARCH_X86_32 || notcpuflag(avx) sub ptr2, i %endif .loop1: INNER_LOOP 0 jge .loop1 mov j, 448 * 4 sub j, OFFQ jz .end sub ptr1, j sub ptr2, j add win, OFFQ ; now at j-64, so define OFFSET sub j, 64 * 4 .loop2: INNER_LOOP 64 * 4 jge .loop2 .end: %if ARCH_X86_32 mov buf2, synth_buf2m ; needed for next iteration anyway mov outq, outmp ; j, which will be set again during it %endif ;~ out[i] = a * scale; ;~ out[i + 16] = b * scale; mulps m1, m1, scale mulps m2, m2, scale %if ARCH_X86_64 mulps m7, m7, scale mulps m8, m8, scale %endif ;~ synth_buf2[i] = c; ;~ synth_buf2[i + 16] = d; mova [buf2 + i + 0 * 4], m3 mova [buf2 + i + 16 * 4], m4 %if ARCH_X86_64 mova [buf2 + i + 0 * 4 + mmsize], m9 mova [buf2 + i + 16 * 4 + mmsize], m10 %endif ;~ out[i] = a; ;~ out[i + 16] = a; mova [outq + i + 0 * 4], m1 mova [outq + i + 16 * 4], m2 %if ARCH_X86_64 mova [outq + i + 0 * 4 + mmsize], m7 mova [outq + i + 16 * 4 + mmsize], m8 %endif %if ARCH_X86_32 || notcpuflag(avx) sub i, (ARCH_X86_64 + 1) * mmsize jge .mainloop %endif RET %endmacro %if ARCH_X86_32 INIT_XMM sse SYNTH_FILTER %endif INIT_XMM sse2 SYNTH_FILTER INIT_YMM avx SYNTH_FILTER INIT_YMM fma3 SYNTH_FILTER
;*************************************************************************** ; PROGRAM: IOMap ; PURPOSE: Base addresses for I/O Map ; ASSEMBLER: TASM 3.2 ; LICENCE: The MIT Licence ; AUTHOR : MCook ; CREATE DATE : 19 June 15 ;*************************************************************************** ;I/O Map base addresses UARTBASE: .EQU $00 ;UART base address CFBASE: .EQU $20 ;CF Card base address
; A021972: Decimal expansion of 1/968. ; 0,0,1,0,3,3,0,5,7,8,5,1,2,3,9,6,6,9,4,2,1,4,8,7,6,0,3,3,0,5,7,8,5,1,2,3,9,6,6,9,4,2,1,4,8,7,6,0,3,3,0,5,7,8,5,1,2,3,9,6,6,9,4,2,1,4,8,7,6,0,3,3,0,5,7,8,5,1,2,3,9,6,6,9,4,2,1,4,8,7,6,0,3,3,0,5,7,8,5 add $0,1 mov $1,10 pow $1,$0 mul $1,7 div $1,6776 mod $1,10 mov $0,$1
// 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 "kudu/master/master_runner.h" #include <cstdint> #include <functional> #include <iostream> #include <memory> #include <set> #include <string> #include <utility> #include <vector> #include <boost/optional/optional.hpp> #include <gflags/gflags.h> #include <glog/logging.h> #include "kudu/client/client.h" #include "kudu/client/master_proxy_rpc.h" #include "kudu/common/common.pb.h" #include "kudu/common/wire_protocol.h" #include "kudu/common/wire_protocol.pb.h" #include "kudu/consensus/consensus.pb.h" #include "kudu/consensus/consensus.proxy.h" #include "kudu/consensus/consensus_meta_manager.h" #include "kudu/consensus/metadata.pb.h" #include "kudu/fs/fs_manager.h" #include "kudu/gutil/macros.h" #include "kudu/gutil/map-util.h" #include "kudu/gutil/ref_counted.h" #include "kudu/gutil/stl_util.h" #include "kudu/gutil/strings/join.h" #include "kudu/gutil/strings/substitute.h" #include "kudu/master/master.h" #include "kudu/master/master.pb.h" #include "kudu/master/master.proxy.h" #include "kudu/master/master_options.h" #include "kudu/master/sys_catalog.h" #include "kudu/rpc/messenger.h" #include "kudu/rpc/response_callback.h" #include "kudu/rpc/rpc.h" #include "kudu/rpc/rpc_controller.h" #include "kudu/tablet/metadata.pb.h" #include "kudu/tablet/tablet_metadata.h" #include "kudu/tablet/tablet_replica.h" #include "kudu/tserver/tablet_copy_client.h" #include "kudu/tserver/ts_tablet_manager.h" #include "kudu/util/async_util.h" #include "kudu/util/env.h" #include "kudu/util/flag_tags.h" #include "kudu/util/flags.h" #include "kudu/util/monotime.h" #include "kudu/util/net/net_util.h" #include "kudu/util/net/sockaddr.h" #include "kudu/util/pb_util.h" #include "kudu/util/version_info.h" using gflags::SET_FLAGS_DEFAULT; using kudu::client::KuduClientBuilder; using kudu::client::KuduClient; using kudu::client::KuduClientBuilder; using kudu::consensus::ConsensusServiceProxy; using kudu::consensus::ConsensusMetadataManager; using kudu::consensus::GetConsensusStateRequestPB; using kudu::consensus::GetConsensusStateResponsePB; using kudu::master::GetMasterRegistrationRequestPB; using kudu::master::GetMasterRegistrationResponsePB; using kudu::pb_util::SecureShortDebugString; using kudu::rpc::RpcController; using kudu::tablet::TabletDataState; using kudu::tablet::TabletMetadata; using kudu::tserver::TabletCopyClient; using kudu::tserver::TSTabletManager; using std::set; using std::string; using std::unique_ptr; using std::vector; using std::to_string; using strings::Substitute; DEFINE_bool(master_auto_join_cluster, true, "Whether Kudu Masters should automatically attempt " "to join existing an existing cluster, specified by the master addresses"); TAG_FLAG(master_auto_join_cluster, runtime); DEFINE_int64(master_auto_join_rpc_timeout_secs, 30, "The amount of time, in seconds, to use as a " "timeout when sending RPCs to add this Master to a cluster."); TAG_FLAG(master_auto_join_rpc_timeout_secs, runtime); DEFINE_int64(master_auto_join_retry_interval_secs, 5, "The interval, in seconds, with which to " "retry checks to determine whether this Master should be added to a cluster."); TAG_FLAG(master_auto_join_retry_interval_secs, runtime); DECLARE_bool(evict_failed_followers); DECLARE_bool(hive_metastore_sasl_enabled); DECLARE_string(master_addresses); DECLARE_string(keytab_file); DECLARE_bool(auto_rebalancing_enabled); DECLARE_bool(raft_prepare_replacement_before_eviction); namespace kudu { namespace master { namespace { // Validates that if the HMS is configured with SASL enabled, the server has a // keytab available. This doesn't use a GROUP_FLAG_VALIDATOR because this check // only needs to be run on a server. E.g. tools that run with the HMS don't need // to pass in a keytab. Status ValidateHiveMetastoreSaslEnabled() { if (FLAGS_hive_metastore_sasl_enabled && FLAGS_keytab_file.empty()) { return Status::ConfigurationError("When the Hive Metastore has SASL enabled " "(--hive_metastore_sasl_enabled), Kudu must be " "configured with a keytab (--keytab_file)."); } return Status::OK(); } // Verifies that: // - all masters are reachable, // - all masters agree on the term, // - there are no pending Raft configs, // - all masters agree on the Raft config index, // - there is a leader, and // - if we need to add 'local_uuid' to the Raft config, it is the only change // required to get the Raft config to match the UUIDs corresponding to // 'master_addrs'. // // Returns an error if there is a non-retriable error (e.g. there might be a // misconfiguration) and we should not attempt to retry this method. // // If OK is returned, sets 'needs_retry' to true if there is a potentially // transient error, in which case calling the method again may help. If no // retriable error was encountered, 'needs_retry' is set to false. // // Sets 'leader_hp' and 'local_hp' to the current master leader's hostport and // the local hostport respectively. Sets 'needs_add' to whether 'local_uuid' // should be added to the Raft config. These out-parameters should only be // used if OK is returned and 'needs_retry' is set to false. Status VerifyMastersGetHostPorts(const vector<HostPort>& master_addrs, const string& local_uuid, const std::shared_ptr<rpc::Messenger>& messenger, HostPort* leader_hp, HostPort* local_hp, bool* needs_retry, bool* needs_add) { vector<set<string>> each_remote_masters_master_uuids; set<string> fetched_uuids; int64_t current_term = -1; int64_t committed_config_index = -1; for (const auto& hp : master_addrs) { Sockaddr master_addr; Status s = SockaddrFromHostPort(hp, &master_addr); if (!s.ok()) { LOG(INFO) << Substitute("Error resolving master address for $0: $1", hp.ToString(), s.ToString()); *needs_retry = true; return Status::OK(); } // First, get the UUID of the remote master. GetMasterRegistrationRequestPB reg_req; GetMasterRegistrationResponsePB reg_resp; RpcController reg_rpc; MasterServiceProxy proxy(messenger, master_addr, master_addr.host()); s = proxy.GetMasterRegistration(reg_req, &reg_resp, &reg_rpc); if (!s.ok() || reg_resp.has_error()) { LOG(INFO) << Substitute("Error getting master registration for $0: $1, $2", master_addr.ToString(), s.ToString(), SecureShortDebugString(reg_resp)); *needs_retry = true; return Status::OK(); } const bool is_leader = reg_resp.role() == consensus::RaftPeerPB::LEADER; if (is_leader) { *leader_hp = hp; } // Skip the local master -- we only care about what the other masters // think, in case we should be trying to join their quorum. const auto& uuid = reg_resp.instance_id().permanent_uuid(); EmplaceIfNotPresent(&fetched_uuids, uuid); if (local_uuid == uuid) { *local_hp = hp; continue; } // Get the Raft config from the remote master to get their quorum's // UUIDs. RpcController rpc; GetConsensusStateRequestPB req; req.add_tablet_ids(SysCatalogTable::kSysCatalogTabletId); req.set_dest_uuid(uuid); req.set_report_health(consensus::INCLUDE_HEALTH_REPORT); GetConsensusStateResponsePB resp; ConsensusServiceProxy consensus_proxy(messenger, master_addr, master_addr.host()); s = consensus_proxy.GetConsensusState(req, &resp, &rpc); if (!s.ok() || resp.has_error()) { LOG(INFO) << Substitute("Error getting master consensus for $0: $1", master_addr.ToString(), s.ToString()); *needs_retry = true; return Status::OK(); } if (resp.tablets_size() != 1) { return Status::Corruption( Substitute("Error getting master consensus, expected one tablet but got $0: $1", resp.tablets_size(), SecureShortDebugString(resp))); } // Retry if the the masters don't agree on the current term. const auto& cstate = resp.tablets(0).cstate(); if (current_term == -1) { current_term = cstate.current_term(); } if (cstate.current_term() != current_term) { LOG(INFO) << Substitute("Existing masters have differing terms: $0 vs $1", current_term, cstate.current_term()); *needs_retry = true; return Status::OK(); } // Retry if there's a pending config -- presumably pending means it's // transient. if (cstate.has_pending_config()) { LOG(INFO) << Substitute("Existing masters have pending config: $0", SecureShortDebugString(cstate.pending_config())); *needs_retry = true; return Status::OK(); } // Retry if the masters don't agree on the current Raft config's index. if (committed_config_index == -1) { committed_config_index = cstate.committed_config().opid_index(); } if (cstate.committed_config().opid_index() != committed_config_index) { LOG(INFO) << Substitute("Existing masters have differing Raft config indexes: $0 vs $1", committed_config_index, cstate.committed_config().opid_index()); *needs_retry = true; return Status::OK(); } const auto& config = cstate.committed_config(); set<string> uuids; for (const auto& p : config.peers()) { EmplaceIfNotPresent(&uuids, p.permanent_uuid()); } each_remote_masters_master_uuids.emplace_back(std::move(uuids)); } if (!leader_hp->Initialized()) { LOG(INFO) << Substitute("No leader master found from master $0", local_uuid); *needs_retry = true; return Status::OK(); } // Ensure the Raft configs from each master match. If not, presumably it's // transient and should be retried. auto& raft_config_uuids = each_remote_masters_master_uuids[0]; for (int i = 1; i < each_remote_masters_master_uuids.size(); i++) { const auto& cur_uuids = each_remote_masters_master_uuids[i]; if (cur_uuids != raft_config_uuids) { set<string> set_diff; STLSetDifference(cur_uuids, raft_config_uuids, &set_diff); LOG(INFO) << Substitute("Remote masters have differing Raft configurations:" "[$0] vs [$1] (diff: [$2])", JoinStrings(cur_uuids, ","), JoinStrings(raft_config_uuids, ","), JoinStrings(set_diff, ",")); *needs_retry = true; return Status::OK(); } } // Ensure that if we need to add this master to the Raft config, it's the // only one we need to add. if (!ContainsKey(raft_config_uuids, local_uuid)) { EmplaceIfNotPresent(&raft_config_uuids, local_uuid); if (raft_config_uuids != fetched_uuids) { set<string> set_diff; STLSetDifference(fetched_uuids, raft_config_uuids, &set_diff); return Status::NotSupported(Substitute("Kudu only supports adding one master at a time; " "tentative Raft config doesn't match the UUIDs fetched from --master_addresses. " "Raft config + local UUID: [$0] vs fetched UUIDs: [$1], diff: [$2]", JoinStrings(raft_config_uuids, ","), JoinStrings(fetched_uuids, ","), JoinStrings(set_diff, ","))); } *needs_add = true; } else { *needs_add = false; } *needs_retry = false; return Status::OK(); } // Deletes the local system catalog tablet and performs a copy from 'src_hp'. Status ClearLocalSystemCatalogAndCopy(const HostPort& src_hp) { LOG(INFO) << "Clearing existing system tablet"; FsManager fs_manager(Env::Default(), FsManagerOpts()); RETURN_NOT_OK(fs_manager.Open()); scoped_refptr<ConsensusMetadataManager> cmeta_manager( new ConsensusMetadataManager(&fs_manager)); scoped_refptr<TabletMetadata> meta; RETURN_NOT_OK(TabletMetadata::Load(&fs_manager, SysCatalogTable::kSysCatalogTabletId, &meta)); RETURN_NOT_OK(TSTabletManager::DeleteTabletData( meta, cmeta_manager, TabletDataState::TABLET_DATA_DELETED, /*last_logged_opid*/boost::none)); LOG(INFO) << "Copying system tablet from " << src_hp.ToString(); std::shared_ptr<rpc::Messenger> messenger; RETURN_NOT_OK(rpc::MessengerBuilder("tablet_copy_client").Build(&messenger)); TabletCopyClient copy_client(SysCatalogTable::kSysCatalogTabletId, &fs_manager, cmeta_manager, messenger, nullptr /* no metrics */); RETURN_NOT_OK(copy_client.Start(src_hp, /*meta*/nullptr)); RETURN_NOT_OK(copy_client.FetchAll(/*tablet_replica*/nullptr)); return copy_client.Finish(); } } // anonymous namespace void SetMasterFlagDefaults() { constexpr int32_t kDefaultRpcServiceQueueLength = 100; // Reset some default values before parsing gflags. CHECK_NE("", SetCommandLineOptionWithMode( "rpc_bind_addresses", strings::Substitute("0.0.0.0:$0", Master::kDefaultPort).c_str(), SET_FLAGS_DEFAULT)); CHECK_NE("", SetCommandLineOptionWithMode( "webserver_port", to_string(Master::kDefaultWebPort).c_str(), SET_FLAGS_DEFAULT)); // Even in a small Kudu cluster, masters might be flooded with requests coming // from many clients (those like GetTableSchema are rather small and can be // processed fast, but it might be a bunch of them coming at once). // In addition, TSHeartbeatRequestPB from tablet servers are put into the same // RPC queue (see KUDU-2955). So, it makes sense to increase the default // setting for the RPC service queue length. CHECK_NE("", SetCommandLineOptionWithMode( "rpc_service_queue_length", to_string(kDefaultRpcServiceQueueLength).c_str(), SET_FLAGS_DEFAULT)); // Setting the default value of the 'force_block_cache_capacity' flag to // 'false' makes the corresponding group validator enforce proper settings // for the memory limit and the cfile cache capacity. CHECK_NE("", SetCommandLineOptionWithMode("force_block_cache_capacity", "false", SET_FLAGS_DEFAULT)); // A multi-node Master leader should not evict failed Master followers // because there is no-one to assign replacement servers in order to maintain // the desired replication factor. (It's not turtles all the way down!) CHECK_NE("", SetCommandLineOptionWithMode("evict_failed_followers", "false", SET_FLAGS_DEFAULT)); // SET_FLAGS_DEFAULT won't reset the flag value if it has previously been // set, instead it will only change the default. Because we want to ensure // evict_failed_followers is always false, we explicitly set the flag. FLAGS_evict_failed_followers = false; } Status RunMasterServer() { string nondefault_flags = GetNonDefaultFlags(); LOG(INFO) << "Master server non-default flags:\n" << nondefault_flags << '\n' << "Master server version:\n" << VersionInfo::GetAllVersionInfo(); RETURN_NOT_OK(ValidateHiveMetastoreSaslEnabled()); MasterOptions opts; unique_ptr<Master> server(new Master(opts)); RETURN_NOT_OK(server->Init()); RETURN_NOT_OK(server->Start()); const auto local_uuid = server->fs_manager()->uuid(); while (FLAGS_master_auto_join_cluster) { if (!opts.IsDistributed()) { // We definitely don't have to add a master if there's only one master // specified. break; } // Keep checking to see if the other masters think we are a part of their // Raft group. If so, we don't need to do anything. bool try_again = false; bool needs_add = false; HostPort leader_hp; HostPort local_hp; RETURN_NOT_OK(VerifyMastersGetHostPorts(opts.master_addresses(), local_uuid, server->messenger(), &leader_hp, &local_hp, &try_again, &needs_add)); // Something went wrong. Sleep for a bit and try later. if (try_again) { LOG(INFO) << "Couldn't verify the masters in the cluster. Trying again..."; SleepFor(MonoDelta::FromSeconds(FLAGS_master_auto_join_retry_interval_secs)); continue; } if (!needs_add) { // All the other masters think this master is a part of the quorum. // There's nothing left to do but run! break; } // The other masters don't see this master in their quorum. Add it now. LOG(INFO) << Substitute( "Detected that this master $0 is joining an existing cluster", local_uuid); // Send an add master RPC to the leader master. LOG(INFO) << Substitute("Initiating AddMaster RPC to add $0", local_hp.ToString()); vector<string> master_addrs; for (const auto& hp : opts.master_addresses()) { master_addrs.emplace_back(hp.ToString()); } client::sp::shared_ptr<KuduClient> client; RETURN_NOT_OK(KuduClientBuilder() .master_server_addrs(master_addrs) .Build(&client)); AddMasterRequestPB add_req; *add_req.mutable_rpc_addr() = HostPortToPB(local_hp); AddMasterResponsePB add_resp;; Synchronizer sync; client::internal::AsyncLeaderMasterRpc<AddMasterRequestPB, AddMasterResponsePB> add_rpc( MonoTime::Now() + MonoDelta::FromSeconds(FLAGS_master_auto_join_rpc_timeout_secs), client.get(), rpc::BackoffType::LINEAR, add_req, &add_resp, &MasterServiceProxy::AddMasterAsync, "AddMaster", sync.AsStatusCallback(), {MasterFeatures::DYNAMIC_MULTI_MASTER}); add_rpc.SendRpc(); Status s = sync.Wait(); bool master_already_present = add_resp.has_error() && add_resp.error().code() == master::MasterErrorPB::MASTER_ALREADY_PRESENT; if (!s.ok() && !master_already_present) { RETURN_NOT_OK_PREPEND(s, "Failed to perform AddMaster RPC"); } server->Shutdown(); // If we succeeded, wipe the system catalog on this node and initiate a // copy from another node. RETURN_NOT_OK(ClearLocalSystemCatalogAndCopy(leader_hp)); server.reset(new Master(opts)); RETURN_NOT_OK(server->Init()); RETURN_NOT_OK(server->Start()); break; } while (true) { SleepFor(MonoDelta::FromSeconds(60)); } } } // namespace master } // namespace kudu
; A193388: Sum of even divisors of phi(n). ; Submitted by Christian Krause ; 0,0,2,2,6,2,8,6,8,6,12,6,24,8,14,14,30,8,26,14,24,12,24,14,36,24,26,24,48,14,48,30,36,30,56,24,78,26,56,30,84,24,64,36,56,24,48,30,64,36,62,56,84,26,84,56,78,48,60,30,144,48,78,62,120,36,96,62,72,56,96,56,182,78,84,78,144,56,112,62,80,84,84,56,126,64,112,84,168,56,182,72,144,48,182,62,248,64,144,84 seq $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n. sub $0,1 seq $0,146076 ; Sum of even divisors of n. mul $0,2 div $0,4 mul $0,2
;; ;; Copyright (c) 2012-2018, Intel Corporation ;; ;; 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 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 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. ;; ;; In System V AMD64 ABI ;; calle saves: RBX, RBP, R12-R15 ;; Windows x64 ABI ;; calle saves: RBX, RBP, RDI, RSI, RSP, R12-R15 ;; ;; Registers: RAX RBX RCX RDX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15 ;; ----------------------------------------------------------- ;; Windows clobbers: RAX RCX RDX R8 ;; Windows preserves: RBX RBP RSI RDI R9 R10 R11 R12 R13 R14 R15 ;; ----------------------------------------------------------- ;; Linux clobbers: RAX RSI RDI R8 ;; Linux preserves: RBX RCX RDX RBP R9 R10 R11 R12 R13 R14 R15 ;; ----------------------------------------------------------- ;; ;; Linux/Windows clobbers: xmm0 - xmm15 ;; %include "include/os.asm" %include "job_aes_hmac.asm" %include "mb_mgr_datastruct.asm" %include "include/reg_sizes.asm" ;%define DO_DBGPRINT %include "include/dbgprint.asm" extern sha1_ni section .data default rel align 16 byteswap: ;ddq 0x0c0d0e0f08090a0b0405060700010203 dq 0x0405060700010203, 0x0c0d0e0f08090a0b one: dq 1 section .text %ifdef LINUX %define arg1 rdi %define arg2 rsi %else %define arg1 rcx %define arg2 rdx %endif %define state arg1 %define job arg2 %define len2 arg2 ; idx needs to be in rbx, rbp, r12-r15 %define idx rbp %define unused_lanes rbx %define lane_data rbx %define tmp2 rbx %define job_rax rax %define tmp1 rax %define size_offset rax %define tmp rax %define start_offset rax %define tmp3 arg1 %define extra_blocks arg2 %define p arg2 %define tmp4 r8 %define p2 r8 ; This routine clobbers rbx, rbp struc STACK _gpr_save: resq 4 _rsp_save: resq 1 endstruc %define APPEND(a,b) a %+ b ; JOB* flush_job_hmac_ni_sse(MB_MGR_HMAC_SHA_1_OOO *state) ; arg 1 : state MKGLOBAL(flush_job_hmac_ni_sse,function,internal) flush_job_hmac_ni_sse: mov rax, rsp sub rsp, STACK_size and rsp, -16 mov [rsp + _gpr_save + 8*0], rbx mov [rsp + _gpr_save + 8*1], rbp %ifndef LINUX mov [rsp + _gpr_save + 8*2], rsi mov [rsp + _gpr_save + 8*3], rdi %endif mov [rsp + _rsp_save], rax ; original SP DBGPRINTL "enter sha1-ni-sse flush" mov unused_lanes, [state + _unused_lanes] bt unused_lanes, 16+7 jc return_null ; find a lane with a non-null job, assume it is 0 then check 1 xor idx, idx cmp qword [state + _ldata + 1 * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0 cmovne idx, [rel one] DBGPRINTL64 "idx:", idx copy_lane_data: ; copy valid lane (idx) to empty lanes mov tmp, [state + _args_data_ptr + PTR_SZ*idx] movzx len2, word [state + _lens + idx*2] DBGPRINTL64 "ptr", tmp ; there are only two lanes so if one is empty it is easy to determine which one xor idx, 1 mov [state + _args_data_ptr + PTR_SZ*idx], tmp xor idx, 1 ; No need to find min length - only two lanes available cmp len2, 0 je len_is_0 ; Set length on both lanes to 0 mov dword [state + _lens], 0 ; "state" and "args" are the same address, arg1 ; len is arg2 call sha1_ni ; state is intact len_is_0: ; process completed job "idx" imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size lea lane_data, [state + _ldata + lane_data] mov DWORD(extra_blocks), [lane_data + _extra_blocks] cmp extra_blocks, 0 jne proc_extra_blocks cmp dword [lane_data + _outer_done], 0 jne end_loop proc_outer: mov dword [lane_data + _outer_done], 1 mov DWORD(size_offset), [lane_data + _size_offset] mov qword [lane_data + _extra_block + size_offset], 0 mov word [state + _lens + 2*idx], 1 DBGPRINTL64 "outer-block-index", idx lea tmp, [lane_data + _outer_block] DBGPRINTL64 "outer block ptr:", tmp mov [state + _args_data_ptr + PTR_SZ*idx], tmp ;; idx determines which column ;; read off from consecutive rows %if SHA1NI_DIGEST_ROW_SIZE != 20 %error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!" %endif lea p2, [idx + idx*4] movdqu xmm0, [state + _args_digest + p2*4] pshufb xmm0, [rel byteswap] mov DWORD(tmp), [state + _args_digest + p2*4 + 4*SHA1_DIGEST_WORD_SIZE] bswap DWORD(tmp) movdqa [lane_data + _outer_block], xmm0 mov [lane_data + _outer_block + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp) DBGPRINTL_XMM "sha1 outer hash input words[0-3]", xmm0 DBGPRINTL64 "sha1 outer hash input word 4", tmp mov job, [lane_data + _job_in_lane] mov tmp, [job + _auth_key_xor_opad] movdqu xmm0, [tmp] mov DWORD(tmp), [tmp + 4*SHA1_DIGEST_WORD_SIZE] movdqu [state + _args_digest + p2*4], xmm0 mov [state + _args_digest + p2*4 + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp) jmp copy_lane_data align 16 proc_extra_blocks: mov DWORD(start_offset), [lane_data + _start_offset] DBGPRINTL64 "extra blocks-start offset", start_offset mov [state + _lens + 2*idx], WORD(extra_blocks) DBGPRINTL64 "extra blocks-len", extra_blocks lea tmp, [lane_data + _extra_block + start_offset] DBGPRINTL64 "extra block ptr", tmp mov [state + _args_data_ptr + PTR_SZ*idx], tmp mov dword [lane_data + _extra_blocks], 0 jmp copy_lane_data return_null: xor job_rax, job_rax jmp return align 16 end_loop: mov job_rax, [lane_data + _job_in_lane] mov qword [lane_data + _job_in_lane], 0 or dword [job_rax + _status], STS_COMPLETED_HMAC mov unused_lanes, [state + _unused_lanes] shl unused_lanes, 8 or unused_lanes, idx mov [state + _unused_lanes], unused_lanes mov p, [job_rax + _auth_tag_output] ; copy 12 bytes %if SHA1NI_DIGEST_ROW_SIZE != 20 %error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!" %endif lea idx, [idx + idx*4] mov DWORD(tmp2), [state + _args_digest + idx*4 + 0*SHA1_DIGEST_WORD_SIZE] mov DWORD(tmp4), [state + _args_digest + idx*4 + 1*SHA1_DIGEST_WORD_SIZE] bswap DWORD(tmp2) bswap DWORD(tmp4) mov [p + 0*4], DWORD(tmp2) mov [p + 1*4], DWORD(tmp4) mov DWORD(tmp2), [state + _args_digest + idx*4 + 2*SHA1_DIGEST_WORD_SIZE] bswap DWORD(tmp2) mov [p + 2*4], DWORD(tmp2) cmp qword [job_rax + _auth_tag_output_len_in_bytes], 12 je clear_ret ;; copy remaining 8 bytes to return 20 byte digest mov DWORD(tmp2), [state + _args_digest + idx*4 + 3*SHA1_DIGEST_WORD_SIZE] mov DWORD(tmp4), [state + _args_digest + idx*4 + 4*SHA1_DIGEST_WORD_SIZE] bswap DWORD(tmp2) bswap DWORD(tmp4) mov [p + 3*4], DWORD(tmp2) mov [p + 4*4], DWORD(tmp4) clear_ret: %ifdef SAFE_DATA pxor xmm0, xmm0 ;; Clear digest (20B), outer_block (20B) and extra_block (64B) ;; of returned job and NULL jobs %assign I 0 %rep 2 cmp qword [state + _ldata + (I*_HMAC_SHA1_LANE_DATA_size) + _job_in_lane], 0 jne APPEND(skip_clear_,I) ;; Clear digest movdqu [state + _args_digest + I*20], xmm0 mov dword [state + _args_digest + I*20 + 16], 0 lea lane_data, [state + _ldata + (I*_HMAC_SHA1_LANE_DATA_size)] ;; Clear first 64 bytes of extra_block %assign offset 0 %rep 4 movdqa [lane_data + _extra_block + offset], xmm0 %assign offset (offset + 16) %endrep ;; Clear first 20 bytes of outer_block movdqa [lane_data + _outer_block], xmm0 mov dword [lane_data + _outer_block + 16], 0 APPEND(skip_clear_,I): %assign I (I+1) %endrep %endif ;; SAFE_DATA return: mov rbx, [rsp + _gpr_save + 8*0] mov rbp, [rsp + _gpr_save + 8*1] %ifndef LINUX mov rsi, [rsp + _gpr_save + 8*2] mov rdi, [rsp + _gpr_save + 8*3] %endif mov rsp, [rsp + _rsp_save] ; original SP ret %ifdef LINUX section .note.GNU-stack noalloc noexec nowrite progbits %endif
// Copyright 2015 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <cmath> #include "src/api-inl.h" #include "src/base/utils/random-number-generator.h" #include "src/builtins/builtins-promise-gen.h" #include "src/builtins/builtins-string-gen.h" #include "src/char-predicates.h" #include "src/code-factory.h" #include "src/code-stub-assembler.h" #include "src/compiler/node.h" #include "src/debug/debug.h" #include "src/heap/heap-inl.h" #include "src/isolate.h" #include "src/objects-inl.h" #include "src/objects/hash-table-inl.h" #include "src/objects/js-array-buffer-inl.h" #include "src/objects/js-array-inl.h" #include "src/objects/promise-inl.h" #include "test/cctest/compiler/code-assembler-tester.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { namespace internal { namespace compiler { namespace { using Label = CodeAssemblerLabel; using Variable = CodeAssemblerVariable; template <class T> using TVariable = TypedCodeAssemblerVariable<T>; Handle<String> MakeString(const char* str) { Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); return factory->InternalizeUtf8String(str); } Handle<String> MakeName(const char* str, int suffix) { EmbeddedVector<char, 128> buffer; SNPrintF(buffer, "%s%d", str, suffix); return MakeString(buffer.start()); } int sum9(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; } static int sum3(int a0, int a1, int a2) { return a0 + a1 + a2; } } // namespace TEST(CallCFunction9) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { Node* const fun_constant = m.ExternalConstant( ExternalReference::Create(reinterpret_cast<Address>(sum9))); MachineType type_intptr = MachineType::IntPtr(); Node* const result = m.CallCFunction9( type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, type_intptr, fun_constant, m.IntPtrConstant(0), m.IntPtrConstant(1), m.IntPtrConstant(2), m.IntPtrConstant(3), m.IntPtrConstant(4), m.IntPtrConstant(5), m.IntPtrConstant(6), m.IntPtrConstant(7), m.IntPtrConstant(8)); m.Return(m.SmiTag(result)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call().ToHandleChecked(); CHECK_EQ(36, Handle<Smi>::cast(result)->value()); } TEST(CallCFunction3WithCallerSavedRegisters) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { Node* const fun_constant = m.ExternalConstant( ExternalReference::Create(reinterpret_cast<Address>(sum3))); MachineType type_intptr = MachineType::IntPtr(); Node* const result = m.CallCFunction3WithCallerSavedRegisters( type_intptr, type_intptr, type_intptr, type_intptr, fun_constant, m.IntPtrConstant(0), m.IntPtrConstant(1), m.IntPtrConstant(2), kSaveFPRegs); m.Return(m.SmiTag(result)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call().ToHandleChecked(); CHECK_EQ(3, Handle<Smi>::cast(result)->value()); } namespace { void CheckToUint32Result(uint32_t expected, Handle<Object> result) { const int64_t result_int64 = NumberToInt64(*result); const uint32_t result_uint32 = NumberToUint32(*result); CHECK_EQ(static_cast<int64_t>(result_uint32), result_int64); CHECK_EQ(expected, result_uint32); // Ensure that the result is normalized to a Smi, i.e. a HeapNumber is only // returned if the result is not within Smi range. const bool expected_fits_into_intptr = static_cast<int64_t>(expected) <= static_cast<int64_t>(std::numeric_limits<intptr_t>::max()); if (expected_fits_into_intptr && Smi::IsValid(static_cast<intptr_t>(expected))) { CHECK(result->IsSmi()); } else { CHECK(result->IsHeapNumber()); } } } // namespace TEST(ToUint32) { Isolate* isolate(CcTest::InitIsolateOnce()); Factory* factory = isolate->factory(); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); const int kContextOffset = 2; Node* const context = m.Parameter(kNumParams + kContextOffset); Node* const input = m.Parameter(0); m.Return(m.ToUint32(context, input)); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); // clang-format off double inputs[] = { std::nan("-1"), std::nan("1"), std::nan("2"), -std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity(), -0.0, -0.001, -0.5, -0.999, -1.0, 0.0, 0.001, 0.5, 0.999, 1.0, -2147483647.9, -2147483648.0, -2147483648.5, -2147483648.9, // SmiMin. 2147483646.9, 2147483647.0, 2147483647.5, 2147483647.9, // SmiMax. -4294967295.9, -4294967296.0, -4294967296.5, -4294967297.0, // - 2^32. 4294967295.9, 4294967296.0, 4294967296.5, 4294967297.0, // 2^32. }; uint32_t expectations[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294967295, 0, 0, 0, 0, 1, 2147483649, 2147483648, 2147483648, 2147483648, 2147483646, 2147483647, 2147483647, 2147483647, 1, 0, 0, 4294967295, 4294967295, 0, 0, 1, }; // clang-format on STATIC_ASSERT(arraysize(inputs) == arraysize(expectations)); const int test_count = arraysize(inputs); for (int i = 0; i < test_count; i++) { Handle<Object> input_obj = factory->NewNumber(inputs[i]); Handle<HeapNumber> input_num; // Check with Smi input. if (input_obj->IsSmi()) { Handle<Smi> input_smi = Handle<Smi>::cast(input_obj); Handle<Object> result = ft.Call(input_smi).ToHandleChecked(); CheckToUint32Result(expectations[i], result); input_num = factory->NewHeapNumber(inputs[i]); } else { input_num = Handle<HeapNumber>::cast(input_obj); } // Check with HeapNumber input. { CHECK(input_num->IsHeapNumber()); Handle<Object> result = ft.Call(input_num).ToHandleChecked(); CheckToUint32Result(expectations[i], result); } } // A couple of final cases for ToNumber conversions. CheckToUint32Result(0, ft.Call(factory->undefined_value()).ToHandleChecked()); CheckToUint32Result(0, ft.Call(factory->null_value()).ToHandleChecked()); CheckToUint32Result(0, ft.Call(factory->false_value()).ToHandleChecked()); CheckToUint32Result(1, ft.Call(factory->true_value()).ToHandleChecked()); CheckToUint32Result( 42, ft.Call(factory->NewStringFromAsciiChecked("0x2A")).ToHandleChecked()); ft.CheckThrows(factory->match_symbol()); } namespace { void IsValidPositiveSmiCase(Isolate* isolate, intptr_t value) { const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.Return( m.SelectBooleanConstant(m.IsValidPositiveSmi(m.IntPtrConstant(value)))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); MaybeHandle<Object> maybe_handle = ft.Call(); bool expected = i::PlatformSmiTagging::IsValidSmi(value) && (value >= 0); if (expected) { CHECK(maybe_handle.ToHandleChecked()->IsTrue(isolate)); } else { CHECK(maybe_handle.ToHandleChecked()->IsFalse(isolate)); } } } // namespace TEST(IsValidPositiveSmi) { Isolate* isolate(CcTest::InitIsolateOnce()); IsValidPositiveSmiCase(isolate, -1); IsValidPositiveSmiCase(isolate, 0); IsValidPositiveSmiCase(isolate, 1); IsValidPositiveSmiCase(isolate, 0x3FFFFFFFU); IsValidPositiveSmiCase(isolate, 0xC0000000U); IsValidPositiveSmiCase(isolate, 0x40000000U); IsValidPositiveSmiCase(isolate, 0xBFFFFFFFU); typedef std::numeric_limits<int32_t> int32_limits; IsValidPositiveSmiCase(isolate, int32_limits::max()); IsValidPositiveSmiCase(isolate, int32_limits::min()); #ifdef V8_TARGET_ARCH_64_BIT IsValidPositiveSmiCase(isolate, static_cast<intptr_t>(int32_limits::max()) + 1); IsValidPositiveSmiCase(isolate, static_cast<intptr_t>(int32_limits::min()) - 1); #endif } TEST(FixedArrayAccessSmiIndex) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeStubAssembler m(asm_tester.state()); Handle<FixedArray> array = isolate->factory()->NewFixedArray(5); array->set(4, Smi::FromInt(733)); m.Return(m.LoadFixedArrayElement(m.HeapConstant(array), m.SmiTag(m.IntPtrConstant(4)), 0, CodeStubAssembler::SMI_PARAMETERS)); FunctionTester ft(asm_tester.GenerateCode()); MaybeHandle<Object> result = ft.Call(); CHECK_EQ(733, Handle<Smi>::cast(result.ToHandleChecked())->value()); } TEST(LoadHeapNumberValue) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeStubAssembler m(asm_tester.state()); Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1234); m.Return(m.SmiFromInt32(m.Signed( m.ChangeFloat64ToUint32(m.LoadHeapNumberValue(m.HeapConstant(number)))))); FunctionTester ft(asm_tester.GenerateCode()); MaybeHandle<Object> result = ft.Call(); CHECK_EQ(1234, Handle<Smi>::cast(result.ToHandleChecked())->value()); } TEST(LoadInstanceType) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeStubAssembler m(asm_tester.state()); Handle<HeapObject> undefined = isolate->factory()->undefined_value(); m.Return(m.SmiFromInt32(m.LoadInstanceType(m.HeapConstant(undefined)))); FunctionTester ft(asm_tester.GenerateCode()); MaybeHandle<Object> result = ft.Call(); CHECK_EQ(InstanceType::ODDBALL_TYPE, Handle<Smi>::cast(result.ToHandleChecked())->value()); } TEST(DecodeWordFromWord32) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate); CodeStubAssembler m(asm_tester.state()); class TestBitField : public BitField<unsigned, 3, 3> {}; m.Return(m.SmiTag( m.Signed(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2F))))); FunctionTester ft(asm_tester.GenerateCode()); MaybeHandle<Object> result = ft.Call(); // value = 00101111 // mask = 00111000 // result = 101 CHECK_EQ(5, Handle<Smi>::cast(result.ToHandleChecked())->value()); } TEST(JSFunction) { const int kNumParams = 3; // Receiver, left, right. Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.Return(m.SmiFromInt32( m.Int32Add(m.SmiToInt32(m.Parameter(1)), m.SmiToInt32(m.Parameter(2))))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); MaybeHandle<Object> result = ft.Call(isolate->factory()->undefined_value(), handle(Smi::FromInt(23), isolate), handle(Smi::FromInt(34), isolate)); CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); } TEST(ComputeIntegerHash) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.Return(m.SmiFromInt32(m.ComputeSeededHash(m.SmiUntag(m.Parameter(0))))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); base::RandomNumberGenerator rand_gen(FLAG_random_seed); for (int i = 0; i < 1024; i++) { int k = rand_gen.NextInt(Smi::kMaxValue); Handle<Smi> key(Smi::FromInt(k), isolate); Handle<Object> result = ft.Call(key).ToHandleChecked(); uint32_t hash = ComputeSeededHash(k, isolate->heap()->HashSeed()); Smi* expected = Smi::FromInt(hash & Smi::kMaxValue); CHECK_EQ(expected, Smi::cast(*result)); } } TEST(ToString) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.Return(m.ToString(m.Parameter(kNumParams + 2), m.Parameter(0))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> test_cases = isolate->factory()->NewFixedArray(5); Handle<FixedArray> smi_test = isolate->factory()->NewFixedArray(2); smi_test->set(0, Smi::FromInt(42)); Handle<String> str(isolate->factory()->InternalizeUtf8String("42")); smi_test->set(1, *str); test_cases->set(0, *smi_test); Handle<FixedArray> number_test = isolate->factory()->NewFixedArray(2); Handle<HeapNumber> num(isolate->factory()->NewHeapNumber(3.14)); number_test->set(0, *num); str = isolate->factory()->InternalizeUtf8String("3.14"); number_test->set(1, *str); test_cases->set(1, *number_test); Handle<FixedArray> string_test = isolate->factory()->NewFixedArray(2); str = isolate->factory()->InternalizeUtf8String("test"); string_test->set(0, *str); string_test->set(1, *str); test_cases->set(2, *string_test); Handle<FixedArray> oddball_test = isolate->factory()->NewFixedArray(2); oddball_test->set(0, ReadOnlyRoots(isolate).undefined_value()); str = isolate->factory()->InternalizeUtf8String("undefined"); oddball_test->set(1, *str); test_cases->set(3, *oddball_test); Handle<FixedArray> tostring_test = isolate->factory()->NewFixedArray(2); Handle<FixedArray> js_array_storage = isolate->factory()->NewFixedArray(2); js_array_storage->set(0, Smi::FromInt(1)); js_array_storage->set(1, Smi::FromInt(2)); Handle<JSArray> js_array = isolate->factory()->NewJSArray(2); JSArray::SetContent(js_array, js_array_storage); tostring_test->set(0, *js_array); str = isolate->factory()->InternalizeUtf8String("1,2"); tostring_test->set(1, *str); test_cases->set(4, *tostring_test); for (int i = 0; i < 5; ++i) { Handle<FixedArray> test = handle(FixedArray::cast(test_cases->get(i)), isolate); Handle<Object> obj = handle(test->get(0), isolate); Handle<String> expected = handle(String::cast(test->get(1)), isolate); Handle<Object> result = ft.Call(obj).ToHandleChecked(); CHECK(result->IsString()); CHECK(String::Equals(isolate, Handle<String>::cast(result), expected)); } } TEST(TryToName) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); enum Result { kKeyIsIndex, kKeyIsUnique, kBailout }; { Node* key = m.Parameter(0); Node* expected_result = m.Parameter(1); Node* expected_arg = m.Parameter(2); Label passed(&m), failed(&m); Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m); { Variable var_index(&m, MachineType::PointerRepresentation()); Variable var_unique(&m, MachineRepresentation::kTagged); m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &var_unique, &if_bailout); m.BIND(&if_keyisindex); m.GotoIfNot(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsIndex))), &failed); m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()), &passed, &failed); m.BIND(&if_keyisunique); m.GotoIfNot(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsUnique))), &failed); m.Branch(m.WordEqual(expected_arg, var_unique.value()), &passed, &failed); } m.BIND(&if_bailout); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), &passed, &failed); m.BIND(&passed); m.Return(m.BooleanConstant(true)); m.BIND(&failed); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> expect_index(Smi::FromInt(kKeyIsIndex), isolate); Handle<Object> expect_unique(Smi::FromInt(kKeyIsUnique), isolate); Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); { // TryToName(<zero smi>) => if_keyisindex: smi value. Handle<Object> key(Smi::kZero, isolate); ft.CheckTrue(key, expect_index, key); } { // TryToName(<positive smi>) => if_keyisindex: smi value. Handle<Object> key(Smi::FromInt(153), isolate); ft.CheckTrue(key, expect_index, key); } { // TryToName(<negative smi>) => if_keyisindex: smi value. // A subsequent bounds check needs to take care of this case. Handle<Object> key(Smi::FromInt(-1), isolate); ft.CheckTrue(key, expect_index, key); } { // TryToName(<heap number with int value>) => if_keyisindex: number. Handle<Object> key(isolate->factory()->NewHeapNumber(153)); Handle<Object> index(Smi::FromInt(153), isolate); ft.CheckTrue(key, expect_index, index); } { // TryToName(<true>) => if_keyisunique: "true". Handle<Object> key = isolate->factory()->true_value(); Handle<Object> unique = isolate->factory()->InternalizeUtf8String("true"); ft.CheckTrue(key, expect_unique, unique); } { // TryToName(<false>) => if_keyisunique: "false". Handle<Object> key = isolate->factory()->false_value(); Handle<Object> unique = isolate->factory()->InternalizeUtf8String("false"); ft.CheckTrue(key, expect_unique, unique); } { // TryToName(<null>) => if_keyisunique: "null". Handle<Object> key = isolate->factory()->null_value(); Handle<Object> unique = isolate->factory()->InternalizeUtf8String("null"); ft.CheckTrue(key, expect_unique, unique); } { // TryToName(<undefined>) => if_keyisunique: "undefined". Handle<Object> key = isolate->factory()->undefined_value(); Handle<Object> unique = isolate->factory()->InternalizeUtf8String("undefined"); ft.CheckTrue(key, expect_unique, unique); } { // TryToName(<symbol>) => if_keyisunique: <symbol>. Handle<Object> key = isolate->factory()->NewSymbol(); ft.CheckTrue(key, expect_unique, key); } { // TryToName(<internalized string>) => if_keyisunique: <internalized string> Handle<Object> key = isolate->factory()->InternalizeUtf8String("test"); ft.CheckTrue(key, expect_unique, key); } { // TryToName(<internalized number string>) => if_keyisindex: number. Handle<Object> key = isolate->factory()->InternalizeUtf8String("153"); Handle<Object> index(Smi::FromInt(153), isolate); ft.CheckTrue(key, expect_index, index); } { // TryToName(<internalized uncacheable number string>) => bailout Handle<Object> key = isolate->factory()->InternalizeUtf8String("4294967294"); ft.CheckTrue(key, expect_bailout); } { // TryToName(<non-internalized number string>) => if_keyisindex: number. Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("153"); uint32_t dummy; CHECK(key->AsArrayIndex(&dummy)); CHECK(key->HasHashCode()); CHECK(!key->IsInternalizedString()); Handle<Object> index(Smi::FromInt(153), isolate); ft.CheckTrue(key, expect_index, index); } { // TryToName(<number string without cached index>) => bailout. Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("153"); CHECK(!key->HasHashCode()); ft.CheckTrue(key, expect_bailout); } { // TryToName(<non-internalized string>) => bailout. Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); ft.CheckTrue(key, expect_bailout); } if (FLAG_thin_strings) { // TryToName(<thin string>) => internalized version. Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo"); Handle<String> internalized = isolate->factory()->InternalizeString(s); ft.CheckTrue(s, expect_unique, internalized); } if (FLAG_thin_strings) { // TryToName(<thin two-byte string>) => internalized version. uc16 array1[] = {2001, 2002, 2003}; Vector<const uc16> str1(array1); Handle<String> s = isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); Handle<String> internalized = isolate->factory()->InternalizeString(s); ft.CheckTrue(s, expect_unique, internalized); } } namespace { template <typename Dictionary> void TestEntryToIndex() { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { TNode<IntPtrT> entry = m.SmiUntag(m.Parameter(0)); TNode<IntPtrT> result = m.EntryToIndex<Dictionary>(entry); m.Return(m.SmiTag(result)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); // Test a wide range of entries but staying linear in the first 100 entries. for (int entry = 0; entry < Dictionary::kMaxCapacity; entry = entry * 1.01 + 1) { Handle<Object> result = ft.Call(handle(Smi::FromInt(entry), isolate)).ToHandleChecked(); CHECK_EQ(Dictionary::EntryToIndex(entry), Smi::ToInt(*result)); } } TEST(NameDictionaryEntryToIndex) { TestEntryToIndex<NameDictionary>(); } TEST(GlobalDictionaryEntryToIndex) { TestEntryToIndex<GlobalDictionary>(); } } // namespace namespace { template <typename Dictionary> void TestNameDictionaryLookup() { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); enum Result { kFound, kNotFound }; { TNode<Dictionary> dictionary = m.CAST(m.Parameter(0)); TNode<Name> unique_name = m.CAST(m.Parameter(1)); TNode<Smi> expected_result = m.CAST(m.Parameter(2)); TNode<Object> expected_arg = m.CAST(m.Parameter(3)); Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m); TVariable<IntPtrT> var_name_index(&m); m.NameDictionaryLookup<Dictionary>(dictionary, unique_name, &if_found, &var_name_index, &if_not_found); m.BIND(&if_found); m.GotoIfNot( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &failed); m.Branch( m.WordEqual(m.SmiUntag(m.CAST(expected_arg)), var_name_index.value()), &passed, &failed); m.BIND(&if_not_found); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), &passed, &failed); m.BIND(&passed); m.Return(m.BooleanConstant(true)); m.BIND(&failed); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> expect_found(Smi::FromInt(kFound), isolate); Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); Handle<Dictionary> dictionary = Dictionary::New(isolate, 40); PropertyDetails fake_details = PropertyDetails::Empty(); Factory* factory = isolate->factory(); Handle<Name> keys[] = { factory->InternalizeUtf8String("0"), factory->InternalizeUtf8String("42"), factory->InternalizeUtf8String("-153"), factory->InternalizeUtf8String("0.0"), factory->InternalizeUtf8String("4.2"), factory->InternalizeUtf8String(""), factory->InternalizeUtf8String("name"), factory->NewSymbol(), factory->NewPrivateSymbol(), }; for (size_t i = 0; i < arraysize(keys); i++) { Handle<Object> value = factory->NewPropertyCell(keys[i]); dictionary = Dictionary::Add(isolate, dictionary, keys[i], value, fake_details); } for (size_t i = 0; i < arraysize(keys); i++) { int entry = dictionary->FindEntry(isolate, keys[i]); int name_index = Dictionary::EntryToIndex(entry) + Dictionary::kEntryKeyIndex; CHECK_NE(Dictionary::kNotFound, entry); Handle<Object> expected_name_index(Smi::FromInt(name_index), isolate); ft.CheckTrue(dictionary, keys[i], expect_found, expected_name_index); } Handle<Name> non_existing_keys[] = { factory->InternalizeUtf8String("1"), factory->InternalizeUtf8String("-42"), factory->InternalizeUtf8String("153"), factory->InternalizeUtf8String("-1.0"), factory->InternalizeUtf8String("1.3"), factory->InternalizeUtf8String("a"), factory->InternalizeUtf8String("boom"), factory->NewSymbol(), factory->NewPrivateSymbol(), }; for (size_t i = 0; i < arraysize(non_existing_keys); i++) { int entry = dictionary->FindEntry(isolate, non_existing_keys[i]); CHECK_EQ(Dictionary::kNotFound, entry); ft.CheckTrue(dictionary, non_existing_keys[i], expect_not_found); } } } // namespace TEST(NameDictionaryLookup) { TestNameDictionaryLookup<NameDictionary>(); } TEST(GlobalDictionaryLookup) { TestNameDictionaryLookup<GlobalDictionary>(); } TEST(NumberDictionaryLookup) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); enum Result { kFound, kNotFound }; { TNode<NumberDictionary> dictionary = m.CAST(m.Parameter(0)); TNode<IntPtrT> key = m.SmiUntag(m.Parameter(1)); TNode<Smi> expected_result = m.CAST(m.Parameter(2)); TNode<Object> expected_arg = m.CAST(m.Parameter(3)); Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m); TVariable<IntPtrT> var_entry(&m); m.NumberDictionaryLookup(dictionary, key, &if_found, &var_entry, &if_not_found); m.BIND(&if_found); m.GotoIfNot( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &failed); m.Branch(m.WordEqual(m.SmiUntag(m.CAST(expected_arg)), var_entry.value()), &passed, &failed); m.BIND(&if_not_found); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), &passed, &failed); m.BIND(&passed); m.Return(m.BooleanConstant(true)); m.BIND(&failed); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> expect_found(Smi::FromInt(kFound), isolate); Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); const int kKeysCount = 1000; Handle<NumberDictionary> dictionary = NumberDictionary::New(isolate, kKeysCount); uint32_t keys[kKeysCount]; Handle<Object> fake_value(Smi::FromInt(42), isolate); PropertyDetails fake_details = PropertyDetails::Empty(); base::RandomNumberGenerator rand_gen(FLAG_random_seed); for (int i = 0; i < kKeysCount; i++) { int random_key = rand_gen.NextInt(Smi::kMaxValue); keys[i] = static_cast<uint32_t>(random_key); if (dictionary->FindEntry(isolate, keys[i]) != NumberDictionary::kNotFound) continue; dictionary = NumberDictionary::Add(isolate, dictionary, keys[i], fake_value, fake_details); } // Now try querying existing keys. for (int i = 0; i < kKeysCount; i++) { int entry = dictionary->FindEntry(isolate, keys[i]); CHECK_NE(NumberDictionary::kNotFound, entry); Handle<Object> key(Smi::FromInt(keys[i]), isolate); Handle<Object> expected_entry(Smi::FromInt(entry), isolate); ft.CheckTrue(dictionary, key, expect_found, expected_entry); } // Now try querying random keys which do not exist in the dictionary. for (int i = 0; i < kKeysCount;) { int random_key = rand_gen.NextInt(Smi::kMaxValue); int entry = dictionary->FindEntry(isolate, random_key); if (entry != NumberDictionary::kNotFound) continue; i++; Handle<Object> key(Smi::FromInt(random_key), isolate); ft.CheckTrue(dictionary, key, expect_not_found); } } TEST(TransitionLookup) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); enum Result { kFound, kNotFound }; class TempAssembler : public CodeStubAssembler { public: explicit TempAssembler(compiler::CodeAssemblerState* state) : CodeStubAssembler(state) {} void Generate() { TNode<TransitionArray> transitions = CAST(Parameter(0)); TNode<Name> name = CAST(Parameter(1)); TNode<Smi> expected_result = CAST(Parameter(2)); TNode<Object> expected_arg = CAST(Parameter(3)); Label passed(this), failed(this); Label if_found(this), if_not_found(this); TVARIABLE(IntPtrT, var_transition_index); TransitionLookup(name, transitions, &if_found, &var_transition_index, &if_not_found); BIND(&if_found); GotoIfNot(WordEqual(expected_result, SmiConstant(kFound)), &failed); Branch(WordEqual(expected_arg, SmiTag(var_transition_index.value())), &passed, &failed); BIND(&if_not_found); Branch(WordEqual(expected_result, SmiConstant(kNotFound)), &passed, &failed); BIND(&passed); Return(BooleanConstant(true)); BIND(&failed); Return(BooleanConstant(false)); } }; TempAssembler(asm_tester.state()).Generate(); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> expect_found(Smi::FromInt(kFound), isolate); Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); const int ATTRS_COUNT = (READ_ONLY | DONT_ENUM | DONT_DELETE) + 1; STATIC_ASSERT(ATTRS_COUNT == 8); const int kKeysCount = 300; Handle<Map> root_map = Map::Create(isolate, 0); Handle<Name> keys[kKeysCount]; base::RandomNumberGenerator rand_gen(FLAG_random_seed); Factory* factory = isolate->factory(); Handle<FieldType> any = FieldType::Any(isolate); for (int i = 0; i < kKeysCount; i++) { Handle<Name> name; if (i % 30 == 0) { name = factory->NewPrivateSymbol(); } else if (i % 10 == 0) { name = factory->NewSymbol(); } else { int random_key = rand_gen.NextInt(Smi::kMaxValue); name = MakeName("p", random_key); } keys[i] = name; bool is_private = name->IsPrivate(); PropertyAttributes base_attributes = is_private ? DONT_ENUM : NONE; // Ensure that all the combinations of cases are covered: // 1) there is a "base" attributes transition // 2) there are other non-base attributes transitions if ((i & 1) == 0) { CHECK(!Map::CopyWithField(isolate, root_map, name, any, base_attributes, PropertyConstness::kMutable, Representation::Tagged(), INSERT_TRANSITION) .is_null()); } if ((i & 2) == 0) { for (int j = 0; j < ATTRS_COUNT; j++) { PropertyAttributes attributes = static_cast<PropertyAttributes>(j); if (attributes == base_attributes) continue; // Don't add private symbols with enumerable attributes. if (is_private && ((attributes & DONT_ENUM) == 0)) continue; CHECK(!Map::CopyWithField(isolate, root_map, name, any, attributes, PropertyConstness::kMutable, Representation::Tagged(), INSERT_TRANSITION) .is_null()); } } } CHECK(root_map->raw_transitions() ->GetHeapObjectAssumeStrong() ->IsTransitionArray()); Handle<TransitionArray> transitions( TransitionArray::cast( root_map->raw_transitions()->GetHeapObjectAssumeStrong()), isolate); DCHECK(transitions->IsSortedNoDuplicates()); // Ensure we didn't overflow transition array and therefore all the // combinations of cases are covered. CHECK(TransitionsAccessor(isolate, root_map).CanHaveMoreTransitions()); // Now try querying keys. bool positive_lookup_tested = false; bool negative_lookup_tested = false; for (int i = 0; i < kKeysCount; i++) { Handle<Name> name = keys[i]; int transition_number = transitions->SearchNameForTesting(*name); if (transition_number != TransitionArray::kNotFound) { Handle<Smi> expected_value( Smi::FromInt(TransitionArray::ToKeyIndex(transition_number)), isolate); ft.CheckTrue(transitions, name, expect_found, expected_value); positive_lookup_tested = true; } else { ft.CheckTrue(transitions, name, expect_not_found); negative_lookup_tested = true; } } CHECK(positive_lookup_tested); CHECK(negative_lookup_tested); } namespace { void AddProperties(Handle<JSObject> object, Handle<Name> names[], size_t count) { Isolate* isolate = object->GetIsolate(); for (size_t i = 0; i < count; i++) { Handle<Object> value(Smi::FromInt(static_cast<int>(42 + i)), isolate); JSObject::AddProperty(isolate, object, names[i], value, NONE); } } Handle<AccessorPair> CreateAccessorPair(FunctionTester* ft, const char* getter_body, const char* setter_body) { Handle<AccessorPair> pair = ft->isolate->factory()->NewAccessorPair(); if (getter_body) { pair->set_getter(*ft->NewFunction(getter_body)); } if (setter_body) { pair->set_setter(*ft->NewFunction(setter_body)); } return pair; } void AddProperties(Handle<JSObject> object, Handle<Name> names[], size_t names_count, Handle<Object> values[], size_t values_count, int seed = 0) { Isolate* isolate = object->GetIsolate(); for (size_t i = 0; i < names_count; i++) { Handle<Object> value = values[(seed + i) % values_count]; if (value->IsAccessorPair()) { Handle<AccessorPair> pair = Handle<AccessorPair>::cast(value); Handle<Object> getter(pair->getter(), isolate); Handle<Object> setter(pair->setter(), isolate); JSObject::DefineAccessor(object, names[i], getter, setter, NONE).Check(); } else { JSObject::AddProperty(isolate, object, names[i], value, NONE); } } } } // namespace TEST(TryHasOwnProperty) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); enum Result { kFound, kNotFound, kBailout }; { Node* object = m.Parameter(0); Node* unique_name = m.Parameter(1); Node* expected_result = m.Parameter(2); Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m), if_bailout(&m); Node* map = m.LoadMap(object); Node* instance_type = m.LoadMapInstanceType(map); m.TryHasOwnProperty(object, map, instance_type, unique_name, &if_found, &if_not_found, &if_bailout); m.BIND(&if_found); m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &passed, &failed); m.BIND(&if_not_found); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), &passed, &failed); m.BIND(&if_bailout); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), &passed, &failed); m.BIND(&passed); m.Return(m.BooleanConstant(true)); m.BIND(&failed); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> expect_found(Smi::FromInt(kFound), isolate); Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); Factory* factory = isolate->factory(); Handle<Name> deleted_property_name = factory->InternalizeUtf8String("deleted"); Handle<Name> names[] = { factory->InternalizeUtf8String("a"), factory->InternalizeUtf8String("bb"), factory->InternalizeUtf8String("ccc"), factory->InternalizeUtf8String("dddd"), factory->InternalizeUtf8String("eeeee"), factory->InternalizeUtf8String(""), factory->InternalizeUtf8String("name"), factory->NewSymbol(), factory->NewPrivateSymbol(), }; std::vector<Handle<JSObject>> objects; { // Fast object, no inobject properties. int inobject_properties = 0; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names)); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Fast object, all inobject properties. int inobject_properties = arraysize(names) * 2; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names)); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Fast object, half inobject properties. int inobject_properties = arraysize(names) / 2; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names)); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Dictionary mode object. Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); Handle<JSObject> object = factory->NewJSObject(function); AddProperties(object, names, arraysize(names)); JSObject::NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0, "test"); JSObject::AddProperty(isolate, object, deleted_property_name, object, NONE); CHECK(JSObject::DeleteProperty(object, deleted_property_name, LanguageMode::kSloppy) .FromJust()); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK(object->map()->is_dictionary_map()); objects.push_back(object); } { // Global object. Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); JSFunction::EnsureHasInitialMap(function); function->initial_map()->set_instance_type(JS_GLOBAL_OBJECT_TYPE); function->initial_map()->set_is_prototype_map(true); function->initial_map()->set_is_dictionary_map(true); function->initial_map()->set_may_have_interesting_symbols(true); Handle<JSObject> object = factory->NewJSGlobalObject(function); AddProperties(object, names, arraysize(names)); JSObject::AddProperty(isolate, object, deleted_property_name, object, NONE); CHECK(JSObject::DeleteProperty(object, deleted_property_name, LanguageMode::kSloppy) .FromJust()); CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); CHECK(object->map()->is_dictionary_map()); objects.push_back(object); } { for (Handle<JSObject> object : objects) { for (size_t name_index = 0; name_index < arraysize(names); name_index++) { Handle<Name> name = names[name_index]; CHECK(JSReceiver::HasProperty(object, name).FromJust()); ft.CheckTrue(object, name, expect_found); } } } { Handle<Name> non_existing_names[] = { factory->NewSymbol(), factory->InternalizeUtf8String("ne_a"), factory->InternalizeUtf8String("ne_bb"), factory->NewPrivateSymbol(), factory->InternalizeUtf8String("ne_ccc"), factory->InternalizeUtf8String("ne_dddd"), deleted_property_name, }; for (Handle<JSObject> object : objects) { for (size_t key_index = 0; key_index < arraysize(non_existing_names); key_index++) { Handle<Name> name = non_existing_names[key_index]; CHECK(!JSReceiver::HasProperty(object, name).FromJust()); ft.CheckTrue(object, name, expect_not_found); } } } { Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); Handle<JSProxy> object = factory->NewJSProxy(function, objects[0]); CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); ft.CheckTrue(object, names[0], expect_bailout); } { Handle<JSObject> object = isolate->global_proxy(); CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); ft.CheckTrue(object, names[0], expect_bailout); } } TEST(TryGetOwnProperty) { Isolate* isolate(CcTest::InitIsolateOnce()); Factory* factory = isolate->factory(); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); Handle<Symbol> not_found_symbol = factory->NewSymbol(); Handle<Symbol> bailout_symbol = factory->NewSymbol(); { Node* object = m.Parameter(0); Node* unique_name = m.Parameter(1); Node* context = m.Parameter(kNumParams + 2); Variable var_value(&m, MachineRepresentation::kTagged); Label if_found(&m), if_not_found(&m), if_bailout(&m); Node* map = m.LoadMap(object); Node* instance_type = m.LoadMapInstanceType(map); m.TryGetOwnProperty(context, object, object, map, instance_type, unique_name, &if_found, &var_value, &if_not_found, &if_bailout); m.BIND(&if_found); m.Return(var_value.value()); m.BIND(&if_not_found); m.Return(m.HeapConstant(not_found_symbol)); m.BIND(&if_bailout); m.Return(m.HeapConstant(bailout_symbol)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Name> deleted_property_name = factory->InternalizeUtf8String("deleted"); Handle<Name> names[] = { factory->InternalizeUtf8String("bb"), factory->NewSymbol(), factory->InternalizeUtf8String("a"), factory->InternalizeUtf8String("ccc"), factory->InternalizeUtf8String("esajefe"), factory->NewPrivateSymbol(), factory->InternalizeUtf8String("eeeee"), factory->InternalizeUtf8String("p1"), factory->InternalizeUtf8String("acshw23e"), factory->InternalizeUtf8String(""), factory->InternalizeUtf8String("dddd"), factory->NewPrivateSymbol(), factory->InternalizeUtf8String("name"), factory->InternalizeUtf8String("p2"), factory->InternalizeUtf8String("p3"), factory->InternalizeUtf8String("p4"), factory->NewPrivateSymbol(), }; Handle<Object> values[] = { factory->NewFunctionForTest(factory->empty_string()), factory->NewSymbol(), factory->InternalizeUtf8String("a"), CreateAccessorPair(&ft, "() => 188;", "() => 199;"), factory->NewFunctionForTest(factory->InternalizeUtf8String("bb")), factory->InternalizeUtf8String("ccc"), CreateAccessorPair(&ft, "() => 88;", nullptr), handle(Smi::FromInt(1), isolate), factory->InternalizeUtf8String(""), CreateAccessorPair(&ft, nullptr, "() => 99;"), factory->NewHeapNumber(4.2), handle(Smi::FromInt(153), isolate), factory->NewJSObject( factory->NewFunctionForTest(factory->empty_string())), factory->NewPrivateSymbol(), }; STATIC_ASSERT(arraysize(values) < arraysize(names)); base::RandomNumberGenerator rand_gen(FLAG_random_seed); std::vector<Handle<JSObject>> objects; { // Fast object, no inobject properties. int inobject_properties = 0; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names), values, arraysize(values), rand_gen.NextInt()); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Fast object, all inobject properties. int inobject_properties = arraysize(names) * 2; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names), values, arraysize(values), rand_gen.NextInt()); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Fast object, half inobject properties. int inobject_properties = arraysize(names) / 2; Handle<Map> map = Map::Create(isolate, inobject_properties); Handle<JSObject> object = factory->NewJSObjectFromMap(map); AddProperties(object, names, arraysize(names), values, arraysize(values), rand_gen.NextInt()); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK_EQ(inobject_properties, object->map()->GetInObjectProperties()); CHECK(!object->map()->is_dictionary_map()); objects.push_back(object); } { // Dictionary mode object. Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); Handle<JSObject> object = factory->NewJSObject(function); AddProperties(object, names, arraysize(names), values, arraysize(values), rand_gen.NextInt()); JSObject::NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0, "test"); JSObject::AddProperty(isolate, object, deleted_property_name, object, NONE); CHECK(JSObject::DeleteProperty(object, deleted_property_name, LanguageMode::kSloppy) .FromJust()); CHECK_EQ(JS_OBJECT_TYPE, object->map()->instance_type()); CHECK(object->map()->is_dictionary_map()); objects.push_back(object); } { // Global object. Handle<JSGlobalObject> object = isolate->global_object(); AddProperties(object, names, arraysize(names), values, arraysize(values), rand_gen.NextInt()); JSObject::AddProperty(isolate, object, deleted_property_name, object, NONE); CHECK(JSObject::DeleteProperty(object, deleted_property_name, LanguageMode::kSloppy) .FromJust()); CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); CHECK(object->map()->is_dictionary_map()); objects.push_back(object); } // TODO(ishell): test proxy and interceptors when they are supported. { for (Handle<JSObject> object : objects) { for (size_t name_index = 0; name_index < arraysize(names); name_index++) { Handle<Name> name = names[name_index]; Handle<Object> expected_value = JSReceiver::GetProperty(isolate, object, name).ToHandleChecked(); Handle<Object> value = ft.Call(object, name).ToHandleChecked(); CHECK(expected_value->SameValue(*value)); } } } { Handle<Name> non_existing_names[] = { factory->NewSymbol(), factory->InternalizeUtf8String("ne_a"), factory->InternalizeUtf8String("ne_bb"), factory->NewPrivateSymbol(), factory->InternalizeUtf8String("ne_ccc"), factory->InternalizeUtf8String("ne_dddd"), deleted_property_name, }; for (Handle<JSObject> object : objects) { for (size_t key_index = 0; key_index < arraysize(non_existing_names); key_index++) { Handle<Name> name = non_existing_names[key_index]; Handle<Object> expected_value = JSReceiver::GetProperty(isolate, object, name).ToHandleChecked(); CHECK(expected_value->IsUndefined(isolate)); Handle<Object> value = ft.Call(object, name).ToHandleChecked(); CHECK_EQ(*not_found_symbol, *value); } } } { Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); Handle<JSProxy> object = factory->NewJSProxy(function, objects[0]); CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); Handle<Object> value = ft.Call(object, names[0]).ToHandleChecked(); // Proxies are not supported yet. CHECK_EQ(*bailout_symbol, *value); } { Handle<JSObject> object = isolate->global_proxy(); CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); // Global proxies are not supported yet. Handle<Object> value = ft.Call(object, names[0]).ToHandleChecked(); CHECK_EQ(*bailout_symbol, *value); } } namespace { void AddElement(Handle<JSObject> object, uint32_t index, Handle<Object> value, PropertyAttributes attributes = NONE) { JSObject::AddDataElement(object, index, value, attributes); } } // namespace TEST(TryLookupElement) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); enum Result { kFound, kAbsent, kNotFound, kBailout }; { Node* object = m.Parameter(0); Node* index = m.SmiUntag(m.Parameter(1)); Node* expected_result = m.Parameter(2); Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m), if_bailout(&m), if_absent(&m); Node* map = m.LoadMap(object); Node* instance_type = m.LoadMapInstanceType(map); m.TryLookupElement(object, map, instance_type, index, &if_found, &if_absent, &if_not_found, &if_bailout); m.BIND(&if_found); m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kFound))), &passed, &failed); m.BIND(&if_absent); m.Branch(m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kAbsent))), &passed, &failed); m.BIND(&if_not_found); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kNotFound))), &passed, &failed); m.BIND(&if_bailout); m.Branch( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kBailout))), &passed, &failed); m.BIND(&passed); m.Return(m.BooleanConstant(true)); m.BIND(&failed); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Factory* factory = isolate->factory(); Handle<Object> smi0(Smi::kZero, isolate); Handle<Object> smi1(Smi::FromInt(1), isolate); Handle<Object> smi7(Smi::FromInt(7), isolate); Handle<Object> smi13(Smi::FromInt(13), isolate); Handle<Object> smi42(Smi::FromInt(42), isolate); Handle<Object> expect_found(Smi::FromInt(kFound), isolate); Handle<Object> expect_absent(Smi::FromInt(kAbsent), isolate); Handle<Object> expect_not_found(Smi::FromInt(kNotFound), isolate); Handle<Object> expect_bailout(Smi::FromInt(kBailout), isolate); #define CHECK_FOUND(object, index) \ CHECK(JSReceiver::HasElement(object, index).FromJust()); \ ft.CheckTrue(object, smi##index, expect_found); #define CHECK_NOT_FOUND(object, index) \ CHECK(!JSReceiver::HasElement(object, index).FromJust()); \ ft.CheckTrue(object, smi##index, expect_not_found); #define CHECK_ABSENT(object, index) \ { \ bool success; \ Handle<Smi> smi(Smi::FromInt(index), isolate); \ LookupIterator it = \ LookupIterator::PropertyOrElement(isolate, object, smi, &success); \ CHECK(success); \ CHECK(!JSReceiver::HasProperty(&it).FromJust()); \ ft.CheckTrue(object, smi, expect_absent); \ } { Handle<JSArray> object = factory->NewJSArray(0, PACKED_SMI_ELEMENTS); AddElement(object, 0, smi0); AddElement(object, 1, smi0); CHECK_EQ(PACKED_SMI_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_NOT_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } { Handle<JSArray> object = factory->NewJSArray(0, HOLEY_SMI_ELEMENTS); AddElement(object, 0, smi0); AddElement(object, 13, smi0); CHECK_EQ(HOLEY_SMI_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_NOT_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } { Handle<JSArray> object = factory->NewJSArray(0, PACKED_ELEMENTS); AddElement(object, 0, smi0); AddElement(object, 1, smi0); CHECK_EQ(PACKED_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_NOT_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } { Handle<JSArray> object = factory->NewJSArray(0, HOLEY_ELEMENTS); AddElement(object, 0, smi0); AddElement(object, 13, smi0); CHECK_EQ(HOLEY_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_NOT_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } { Handle<JSTypedArray> object = factory->NewJSTypedArray(INT32_ELEMENTS, 2); Local<v8::ArrayBuffer> buffer = Utils::ToLocal(object->GetBuffer()); CHECK_EQ(INT32_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_FOUND(object, 1); CHECK_ABSENT(object, -10); CHECK_ABSENT(object, 13); CHECK_ABSENT(object, 42); v8::ArrayBuffer::Contents contents = buffer->Externalize(); buffer->Neuter(); isolate->array_buffer_allocator()->Free(contents.Data(), contents.ByteLength()); CHECK_ABSENT(object, 0); CHECK_ABSENT(object, 1); CHECK_ABSENT(object, -10); CHECK_ABSENT(object, 13); CHECK_ABSENT(object, 42); } { Handle<JSFunction> constructor = isolate->string_function(); Handle<JSObject> object = factory->NewJSObject(constructor); Handle<String> str = factory->InternalizeUtf8String("ab"); Handle<JSValue>::cast(object)->set_value(*str); AddElement(object, 13, smi0); CHECK_EQ(FAST_STRING_WRAPPER_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } { Handle<JSFunction> constructor = isolate->string_function(); Handle<JSObject> object = factory->NewJSObject(constructor); Handle<String> str = factory->InternalizeUtf8String("ab"); Handle<JSValue>::cast(object)->set_value(*str); AddElement(object, 13, smi0); JSObject::NormalizeElements(object); CHECK_EQ(SLOW_STRING_WRAPPER_ELEMENTS, object->map()->elements_kind()); CHECK_FOUND(object, 0); CHECK_FOUND(object, 1); CHECK_NOT_FOUND(object, 7); CHECK_FOUND(object, 13); CHECK_NOT_FOUND(object, 42); } // TODO(ishell): uncomment once NO_ELEMENTS kind is supported. // { // Handle<Map> map = Map::Create(isolate, 0); // map->set_elements_kind(NO_ELEMENTS); // Handle<JSObject> object = factory->NewJSObjectFromMap(map); // CHECK_EQ(NO_ELEMENTS, object->map()->elements_kind()); // // CHECK_NOT_FOUND(object, 0); // CHECK_NOT_FOUND(object, 1); // CHECK_NOT_FOUND(object, 7); // CHECK_NOT_FOUND(object, 13); // CHECK_NOT_FOUND(object, 42); // } #undef CHECK_FOUND #undef CHECK_NOT_FOUND { Handle<JSArray> handler = factory->NewJSArray(0); Handle<JSFunction> function = factory->NewFunctionForTest(factory->empty_string()); Handle<JSProxy> object = factory->NewJSProxy(function, handler); CHECK_EQ(JS_PROXY_TYPE, object->map()->instance_type()); ft.CheckTrue(object, smi0, expect_bailout); } { Handle<JSObject> object = isolate->global_object(); CHECK_EQ(JS_GLOBAL_OBJECT_TYPE, object->map()->instance_type()); ft.CheckTrue(object, smi0, expect_bailout); } { Handle<JSObject> object = isolate->global_proxy(); CHECK_EQ(JS_GLOBAL_PROXY_TYPE, object->map()->instance_type()); ft.CheckTrue(object, smi0, expect_bailout); } } TEST(AllocateJSObjectFromMap) { Isolate* isolate(CcTest::InitIsolateOnce()); Factory* factory = isolate->factory(); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { Node* map = m.Parameter(0); Node* properties = m.Parameter(1); Node* elements = m.Parameter(2); Node* result = m.AllocateJSObjectFromMap(map, properties, elements); m.Return(result); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Map> maps[] = { handle(isolate->object_function()->initial_map(), isolate), handle(isolate->array_function()->initial_map(), isolate), }; { Handle<FixedArray> empty_fixed_array = factory->empty_fixed_array(); Handle<PropertyArray> empty_property_array = factory->empty_property_array(); for (size_t i = 0; i < arraysize(maps); i++) { Handle<Map> map = maps[i]; Handle<JSObject> result = Handle<JSObject>::cast( ft.Call(map, empty_fixed_array, empty_fixed_array).ToHandleChecked()); CHECK_EQ(result->map(), *map); CHECK_EQ(result->property_array(), *empty_property_array); CHECK_EQ(result->elements(), *empty_fixed_array); CHECK(result->HasFastProperties()); #ifdef VERIFY_HEAP isolate->heap()->Verify(); #endif } } { // TODO(cbruni): handle in-object properties Handle<JSObject> object = Handle<JSObject>::cast( v8::Utils::OpenHandle(*CompileRun("var object = {a:1,b:2, 1:1, 2:2}; " "object"))); JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, "Normalize"); Handle<JSObject> result = Handle<JSObject>::cast( ft.Call(handle(object->map(), isolate), handle(object->property_dictionary(), isolate), handle(object->elements(), isolate)) .ToHandleChecked()); CHECK_EQ(result->map(), object->map()); CHECK_EQ(result->property_dictionary(), object->property_dictionary()); CHECK(!result->HasFastProperties()); #ifdef VERIFY_HEAP isolate->heap()->Verify(); #endif } #undef VERIFY } TEST(AllocateNameDictionary) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { Node* capacity = m.Parameter(0); Node* result = m.AllocateNameDictionary(m.SmiUntag(capacity)); m.Return(result); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); { for (int i = 0; i < 256; i = i * 1.1 + 1) { Handle<Object> result = ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked(); Handle<NameDictionary> dict = NameDictionary::New(isolate, i); // Both dictionaries should be memory equal. int size = FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize; CHECK_EQ(0, memcmp(*dict, *result, size)); } } } TEST(PopAndReturnConstant) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; const int kNumProgrammaticParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams - kNumProgrammaticParams); CodeStubAssembler m(asm_tester.state()); // Call a function that return |kNumProgramaticParams| parameters in addition // to those specified by the static descriptor. |kNumProgramaticParams| is // specified as a constant. m.PopAndReturn(m.Int32Constant(kNumProgrammaticParams), m.SmiConstant(Smi::FromInt(1234))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result; for (int test_count = 0; test_count < 100; ++test_count) { result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(1234), isolate), isolate->factory()->undefined_value(), isolate->factory()->undefined_value()) .ToHandleChecked(); CHECK_EQ(1234, Handle<Smi>::cast(result)->value()); } } TEST(PopAndReturnVariable) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; const int kNumProgrammaticParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams - kNumProgrammaticParams); CodeStubAssembler m(asm_tester.state()); // Call a function that return |kNumProgramaticParams| parameters in addition // to those specified by the static descriptor. |kNumProgramaticParams| is // passed in as a parameter to the function so that it can't be recongized as // a constant. m.PopAndReturn(m.SmiUntag(m.Parameter(1)), m.SmiConstant(Smi::FromInt(1234))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result; for (int test_count = 0; test_count < 100; ++test_count) { result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(1234), isolate), isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(kNumProgrammaticParams), isolate)) .ToHandleChecked(); CHECK_EQ(1234, Handle<Smi>::cast(result)->value()); } } TEST(OneToTwoByteStringCopy) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), String::ONE_BYTE_ENCODING, String::TWO_BYTE_ENCODING); m.Return(m.SmiConstant(Smi::FromInt(0))); Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); uc16 array[] = {1000, 1001, 1002, 1003, 1004}; Vector<const uc16> str(array); Handle<String> string2 = isolate->factory()->NewStringFromTwoByte(str).ToHandleChecked(); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); ft.Call(string1, string2); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], Handle<SeqTwoByteString>::cast(string2)->GetChars()[0]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], Handle<SeqTwoByteString>::cast(string2)->GetChars()[1]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[2], Handle<SeqTwoByteString>::cast(string2)->GetChars()[2]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[3], Handle<SeqTwoByteString>::cast(string2)->GetChars()[3]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[4], Handle<SeqTwoByteString>::cast(string2)->GetChars()[4]); } TEST(OneToOneByteStringCopy) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), String::ONE_BYTE_ENCODING, String::ONE_BYTE_ENCODING); m.Return(m.SmiConstant(Smi::FromInt(0))); Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); uint8_t array[] = {100, 101, 102, 103, 104}; Vector<const uint8_t> str(array); Handle<String> string2 = isolate->factory()->NewStringFromOneByte(str).ToHandleChecked(); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); ft.Call(string1, string2); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], Handle<SeqOneByteString>::cast(string2)->GetChars()[0]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], Handle<SeqOneByteString>::cast(string2)->GetChars()[1]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[2], Handle<SeqOneByteString>::cast(string2)->GetChars()[2]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[3], Handle<SeqOneByteString>::cast(string2)->GetChars()[3]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[4], Handle<SeqOneByteString>::cast(string2)->GetChars()[4]); } TEST(OneToOneByteStringCopyNonZeroStart) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(3), m.IntPtrConstant(2), String::ONE_BYTE_ENCODING, String::ONE_BYTE_ENCODING); m.Return(m.SmiConstant(Smi::FromInt(0))); Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); uint8_t array[] = {100, 101, 102, 103, 104}; Vector<const uint8_t> str(array); Handle<String> string2 = isolate->factory()->NewStringFromOneByte(str).ToHandleChecked(); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); ft.Call(string1, string2); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], Handle<SeqOneByteString>::cast(string2)->GetChars()[3]); CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], Handle<SeqOneByteString>::cast(string2)->GetChars()[4]); CHECK_EQ(100, Handle<SeqOneByteString>::cast(string2)->GetChars()[0]); CHECK_EQ(101, Handle<SeqOneByteString>::cast(string2)->GetChars()[1]); CHECK_EQ(102, Handle<SeqOneByteString>::cast(string2)->GetChars()[2]); } TEST(TwoToTwoByteStringCopy) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.CopyStringCharacters(m.Parameter(0), m.Parameter(1), m.IntPtrConstant(0), m.IntPtrConstant(0), m.IntPtrConstant(5), String::TWO_BYTE_ENCODING, String::TWO_BYTE_ENCODING); m.Return(m.SmiConstant(Smi::FromInt(0))); uc16 array1[] = {2000, 2001, 2002, 2003, 2004}; Vector<const uc16> str1(array1); Handle<String> string1 = isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); uc16 array2[] = {1000, 1001, 1002, 1003, 1004}; Vector<const uc16> str2(array2); Handle<String> string2 = isolate->factory()->NewStringFromTwoByte(str2).ToHandleChecked(); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); ft.Call(string1, string2); CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[0], Handle<SeqTwoByteString>::cast(string2)->GetChars()[0]); CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[1], Handle<SeqTwoByteString>::cast(string2)->GetChars()[1]); CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[2], Handle<SeqTwoByteString>::cast(string2)->GetChars()[2]); CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[3], Handle<SeqTwoByteString>::cast(string2)->GetChars()[3]); CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[4], Handle<SeqTwoByteString>::cast(string2)->GetChars()[4]); } TEST(Arguments) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); CodeStubArguments arguments(&m, m.IntPtrConstant(3)); CSA_ASSERT( &m, m.WordEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT( &m, m.WordEqual(arguments.AtIndex(1), m.SmiConstant(Smi::FromInt(13)))); CSA_ASSERT( &m, m.WordEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14)))); arguments.PopAndReturn(arguments.GetReceiver()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(12), isolate), Handle<Smi>(Smi::FromInt(13), isolate), Handle<Smi>(Smi::FromInt(14), isolate)) .ToHandleChecked(); CHECK_EQ(*isolate->factory()->undefined_value(), *result); } TEST(ArgumentsWithSmiConstantIndices) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, CodeStubAssembler::SMI_PARAMETERS); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(m.SmiConstant(0), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(m.SmiConstant(1), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(13)))); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(m.SmiConstant(2), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(14)))); arguments.PopAndReturn(arguments.GetReceiver()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(12), isolate), Handle<Smi>(Smi::FromInt(13), isolate), Handle<Smi>(Smi::FromInt(14), isolate)) .ToHandleChecked(); CHECK_EQ(*isolate->factory()->undefined_value(), *result); } TNode<Smi> NonConstantSmi(CodeStubAssembler* m, int value) { // Generate a SMI with the given value and feed it through a Phi so it can't // be inferred to be constant. Variable var(m, MachineRepresentation::kTagged, m->SmiConstant(value)); Label dummy_done(m); // Even though the Goto always executes, it will taint the variable and thus // make it appear non-constant when used later. m->GotoIf(m->Int32Constant(1), &dummy_done); var.Bind(m->SmiConstant(value)); m->Goto(&dummy_done); m->BIND(&dummy_done); // Ensure that the above hackery actually created a non-constant SMI. Smi* smi_constant; CHECK(!m->ToSmiConstant(var.value(), smi_constant)); return m->UncheckedCast<Smi>(var.value()); } TEST(ArgumentsWithSmiIndices) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, CodeStubAssembler::SMI_PARAMETERS); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 0), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 1), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(13)))); CSA_ASSERT(&m, m.WordEqual(arguments.AtIndex(NonConstantSmi(&m, 2), CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(Smi::FromInt(14)))); arguments.PopAndReturn(arguments.GetReceiver()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(12), isolate), Handle<Smi>(Smi::FromInt(13), isolate), Handle<Smi>(Smi::FromInt(14), isolate)) .ToHandleChecked(); CHECK_EQ(*isolate->factory()->undefined_value(), *result); } TEST(ArgumentsForEach) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); CodeStubArguments arguments(&m, m.IntPtrConstant(3)); TVariable<Smi> sum(&m); CodeAssemblerVariableList list({&sum}, m.zone()); sum = m.SmiConstant(0); arguments.ForEach(list, [&m, &sum](Node* arg) { sum = m.SmiAdd(sum.value(), m.CAST(arg)); }); arguments.PopAndReturn(sum.value()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), Handle<Smi>(Smi::FromInt(12), isolate), Handle<Smi>(Smi::FromInt(13), isolate), Handle<Smi>(Smi::FromInt(14), isolate)) .ToHandleChecked(); CHECK_EQ(Smi::FromInt(12 + 13 + 14), *result); } TEST(IsDebugActive) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); Label if_active(&m), if_not_active(&m); m.Branch(m.IsDebugActive(), &if_active, &if_not_active); m.BIND(&if_active); m.Return(m.TrueConstant()); m.BIND(&if_not_active); m.Return(m.FalseConstant()); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); CHECK(!isolate->debug()->is_active()); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); bool* debug_is_active = reinterpret_cast<bool*>( ExternalReference::debug_is_active_address(isolate).address()); // Cheat to enable debug (TODO: do this properly). *debug_is_active = true; result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).true_value(), *result); // Reset debug mode. *debug_is_active = false; } class AppendJSArrayCodeStubAssembler : public CodeStubAssembler { public: AppendJSArrayCodeStubAssembler(compiler::CodeAssemblerState* state, ElementsKind kind) : CodeStubAssembler(state), kind_(kind) {} void TestAppendJSArrayImpl(Isolate* isolate, CodeAssemblerTester* csa_tester, Object* o1, Object* o2, Object* o3, Object* o4, int initial_size, int result_size) { Handle<JSArray> array = isolate->factory()->NewJSArray( kind_, 2, initial_size, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); JSObject::SetElement(isolate, array, 0, Handle<Smi>(Smi::FromInt(1), isolate), LanguageMode::kSloppy) .Check(); JSObject::SetElement(isolate, array, 1, Handle<Smi>(Smi::FromInt(2), isolate), LanguageMode::kSloppy) .Check(); CodeStubArguments args(this, IntPtrConstant(kNumParams)); TVariable<IntPtrT> arg_index(this); Label bailout(this); arg_index = IntPtrConstant(0); Node* length = BuildAppendJSArray(kind_, HeapConstant(array), &args, &arg_index, &bailout); Return(length); BIND(&bailout); Return(SmiTag(IntPtrAdd(arg_index.value(), IntPtrConstant(2)))); FunctionTester ft(csa_tester->GenerateCode(), kNumParams); Handle<Object> result = ft.Call(Handle<Object>(o1, isolate), Handle<Object>(o2, isolate), Handle<Object>(o3, isolate), Handle<Object>(o4, isolate)) .ToHandleChecked(); CHECK_EQ(kind_, array->GetElementsKind()); CHECK_EQ(result_size, Handle<Smi>::cast(result)->value()); CHECK_EQ(result_size, Smi::ToInt(array->length())); Object* obj = *JSObject::GetElement(isolate, array, 2).ToHandleChecked(); HeapObject* undefined_value = ReadOnlyRoots(isolate).undefined_value(); CHECK_EQ(result_size < 3 ? undefined_value : o1, obj); obj = *JSObject::GetElement(isolate, array, 3).ToHandleChecked(); CHECK_EQ(result_size < 4 ? undefined_value : o2, obj); obj = *JSObject::GetElement(isolate, array, 4).ToHandleChecked(); CHECK_EQ(result_size < 5 ? undefined_value : o3, obj); obj = *JSObject::GetElement(isolate, array, 5).ToHandleChecked(); CHECK_EQ(result_size < 6 ? undefined_value : o4, obj); } static void TestAppendJSArray(Isolate* isolate, ElementsKind kind, Object* o1, Object* o2, Object* o3, Object* o4, int initial_size, int result_size) { CodeAssemblerTester asm_tester(isolate, kNumParams); AppendJSArrayCodeStubAssembler m(asm_tester.state(), kind); m.TestAppendJSArrayImpl(isolate, &asm_tester, o1, o2, o3, o4, initial_size, result_size); } private: static const int kNumParams = 4; ElementsKind kind_; }; TEST(BuildAppendJSArrayFastElement) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 6, 6); } TEST(BuildAppendJSArrayFastElementGrow) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 2, 6); } TEST(BuildAppendJSArrayFastSmiElement) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 6, 6); } TEST(BuildAppendJSArrayFastSmiElementGrow) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 2, 6); } TEST(BuildAppendJSArrayFastSmiElementObject) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), ReadOnlyRoots(isolate).undefined_value(), Smi::FromInt(6), 6, 4); } TEST(BuildAppendJSArrayFastSmiElementObjectGrow) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_SMI_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), ReadOnlyRoots(isolate).undefined_value(), Smi::FromInt(6), 2, 4); } TEST(BuildAppendJSArrayFastDoubleElements) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 6, 6); } TEST(BuildAppendJSArrayFastDoubleElementsGrow) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), Smi::FromInt(5), Smi::FromInt(6), 2, 6); } TEST(BuildAppendJSArrayFastDoubleElementsObject) { Isolate* isolate(CcTest::InitIsolateOnce()); AppendJSArrayCodeStubAssembler::TestAppendJSArray( isolate, PACKED_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), ReadOnlyRoots(isolate).undefined_value(), Smi::FromInt(6), 6, 4); } namespace { template <typename Stub, typename... Args> void Recompile(Args... args) { Stub stub(args...); stub.DeleteStubFromCacheForTesting(); stub.GetCode(); } } // namespace void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise, v8::Local<v8::Value> parentPromise) {} TEST(IsPromiseHookEnabled) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); m.Return( m.SelectBooleanConstant(m.IsPromiseHookEnabledOrHasAsyncEventDelegate())); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); isolate->SetPromiseHook(CustomPromiseHook); result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).true_value(), *result); isolate->SetPromiseHook(nullptr); result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); } TEST(AllocateAndInitJSPromise) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const promise = m.AllocateAndInitJSPromise(context); m.Return(promise); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result->IsJSPromise()); } TEST(AllocateAndSetJSPromise) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const promise = m.AllocateAndSetJSPromise( context, v8::Promise::kRejected, m.SmiConstant(1)); m.Return(promise); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result->IsJSPromise()); Handle<JSPromise> js_promise = Handle<JSPromise>::cast(result); CHECK_EQ(v8::Promise::kRejected, js_promise->status()); CHECK_EQ(Smi::FromInt(1), js_promise->result()); CHECK(!js_promise->has_handler()); } TEST(IsSymbol) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); Node* const symbol = m.Parameter(0); m.Return(m.SelectBooleanConstant(m.IsSymbol(symbol))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->NewSymbol()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).true_value(), *result); result = ft.Call(isolate->factory()->empty_string()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); } TEST(IsPrivateSymbol) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); Node* const symbol = m.Parameter(0); m.Return(m.SelectBooleanConstant(m.IsPrivateSymbol(symbol))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->NewSymbol()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); result = ft.Call(isolate->factory()->empty_string()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); result = ft.Call(isolate->factory()->NewPrivateSymbol()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).true_value(), *result); } TEST(PromiseHasHandler) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const promise = m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); m.Return(m.SelectBooleanConstant(m.PromiseHasHandler(promise))); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), *result); } TEST(CreatePromiseResolvingFunctionsContext) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); Node* const promise = m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); Node* const promise_context = m.CreatePromiseResolvingFunctionsContext( promise, m.BooleanConstant(false), native_context); m.Return(promise_context); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result->IsContext()); Handle<Context> context_js = Handle<Context>::cast(result); CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info()); CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context_js->extension()); CHECK_EQ(*isolate->native_context(), context_js->native_context()); CHECK(context_js->get(PromiseBuiltinsAssembler::kPromiseSlot)->IsJSPromise()); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), context_js->get(PromiseBuiltinsAssembler::kDebugEventSlot)); } TEST(CreatePromiseResolvingFunctions) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); Node* const promise = m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); Node *resolve, *reject; std::tie(resolve, reject) = m.CreatePromiseResolvingFunctions( promise, m.BooleanConstant(false), native_context); Node* const kSize = m.IntPtrConstant(2); TNode<FixedArray> const arr = m.Cast(m.AllocateFixedArray(PACKED_ELEMENTS, kSize)); m.StoreFixedArrayElement(arr, 0, resolve); m.StoreFixedArrayElement(arr, 1, reject); m.Return(arr); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result_obj = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result_obj->IsFixedArray()); Handle<FixedArray> result_arr = Handle<FixedArray>::cast(result_obj); CHECK(result_arr->get(0)->IsJSFunction()); CHECK(result_arr->get(1)->IsJSFunction()); } TEST(NewElementsCapacity) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate, 1); CodeStubAssembler m(asm_tester.state()); m.Return(m.SmiTag(m.CalculateNewElementsCapacity( m.SmiUntag(m.Parameter(0)), CodeStubAssembler::INTPTR_PARAMETERS))); FunctionTester ft(asm_tester.GenerateCode(), 1); Handle<Smi> test_value = Handle<Smi>(Smi::FromInt(0), isolate); Handle<Smi> result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(1), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(2), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(1025), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); } TEST(NewElementsCapacitySmi) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate, 1); CodeStubAssembler m(asm_tester.state()); m.Return(m.CalculateNewElementsCapacity(m.Parameter(0), CodeStubAssembler::SMI_PARAMETERS)); FunctionTester ft(asm_tester.GenerateCode(), 1); Handle<Smi> test_value = Handle<Smi>(Smi::FromInt(0), isolate); Handle<Smi> result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(1), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(2), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); test_value = Handle<Smi>(Smi::FromInt(1025), isolate); result_obj = ft.CallChecked<Smi>(test_value); CHECK_EQ( result_obj->value(), static_cast<int>(JSObject::NewElementsCapacity(test_value->value()))); } TEST(AllocateFunctionWithMapAndContext) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); Node* const promise = m.AllocateAndInitJSPromise(context, m.UndefinedConstant()); Node* promise_context = m.CreatePromiseResolvingFunctionsContext( promise, m.BooleanConstant(false), native_context); Node* resolve_info = m.LoadContextElement( native_context, Context::PROMISE_CAPABILITY_DEFAULT_RESOLVE_SHARED_FUN_INDEX); Node* const map = m.LoadContextElement( native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX); Node* const resolve = m.AllocateFunctionWithMapAndContext(map, resolve_info, promise_context); m.Return(resolve); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result_obj = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result_obj->IsJSFunction()); Handle<JSFunction> fun = Handle<JSFunction>::cast(result_obj); CHECK_EQ(ReadOnlyRoots(isolate).empty_property_array(), fun->property_array()); CHECK_EQ(ReadOnlyRoots(isolate).empty_fixed_array(), fun->elements()); CHECK_EQ(isolate->heap()->many_closures_cell(), fun->feedback_cell()); CHECK(!fun->has_prototype_slot()); CHECK_EQ(*isolate->promise_capability_default_resolve_shared_fun(), fun->shared()); CHECK_EQ(isolate->promise_capability_default_resolve_shared_fun()->GetCode(), fun->code()); } TEST(CreatePromiseGetCapabilitiesExecutorContext) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); Node* const map = m.LoadRoot(RootIndex::kPromiseCapabilityMap); Node* const capability = m.AllocateStruct(map); m.StoreObjectFieldNoWriteBarrier( capability, PromiseCapability::kPromiseOffset, m.UndefinedConstant()); m.StoreObjectFieldNoWriteBarrier( capability, PromiseCapability::kResolveOffset, m.UndefinedConstant()); m.StoreObjectFieldNoWriteBarrier(capability, PromiseCapability::kRejectOffset, m.UndefinedConstant()); Node* const executor_context = m.CreatePromiseGetCapabilitiesExecutorContext(capability, native_context); m.Return(executor_context); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result_obj = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result_obj->IsContext()); Handle<Context> context_js = Handle<Context>::cast(result_obj); CHECK_EQ(PromiseBuiltinsAssembler::kCapabilitiesContextLength, context_js->length()); CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info()); CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context_js->extension()); CHECK_EQ(*isolate->native_context(), context_js->native_context()); CHECK(context_js->get(PromiseBuiltinsAssembler::kCapabilitySlot) ->IsPromiseCapability()); } TEST(NewPromiseCapability) { Isolate* isolate(CcTest::InitIsolateOnce()); { // Builtin Promise const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const native_context = m.LoadNativeContext(context); Node* const promise_constructor = m.LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); Node* const debug_event = m.TrueConstant(); Node* const capability = m.CallBuiltin(Builtins::kNewPromiseCapability, context, promise_constructor, debug_event); m.Return(capability); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> result_obj = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result_obj->IsPromiseCapability()); Handle<PromiseCapability> result = Handle<PromiseCapability>::cast(result_obj); CHECK(result->promise()->IsJSPromise()); CHECK(result->resolve()->IsJSFunction()); CHECK(result->reject()->IsJSFunction()); CHECK_EQ(*isolate->promise_capability_default_reject_shared_fun(), JSFunction::cast(result->reject())->shared()); CHECK_EQ(*isolate->promise_capability_default_resolve_shared_fun(), JSFunction::cast(result->resolve())->shared()); Handle<JSFunction> callbacks[] = { handle(JSFunction::cast(result->resolve()), isolate), handle(JSFunction::cast(result->reject()), isolate)}; for (auto&& callback : callbacks) { Handle<Context> context(Context::cast(callback->context()), isolate); CHECK_EQ(isolate->native_context()->scope_info(), context->scope_info()); CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context->extension()); CHECK_EQ(*isolate->native_context(), context->native_context()); CHECK_EQ(PromiseBuiltinsAssembler::kPromiseContextLength, context->length()); CHECK_EQ(context->get(PromiseBuiltinsAssembler::kPromiseSlot), result->promise()); } } { // Custom Promise const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); PromiseBuiltinsAssembler m(asm_tester.state()); Node* const context = m.Parameter(kNumParams + 2); Node* const constructor = m.Parameter(1); Node* const debug_event = m.TrueConstant(); Node* const capability = m.CallBuiltin(Builtins::kNewPromiseCapability, context, constructor, debug_event); m.Return(capability); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<JSFunction> constructor_fn = Handle<JSFunction>::cast(v8::Utils::OpenHandle(*CompileRun( "(function FakePromise(executor) {" " var self = this;" " function resolve(value) { self.resolvedValue = value; }" " function reject(reason) { self.rejectedReason = reason; }" " executor(resolve, reject);" "})"))); Handle<Object> result_obj = ft.Call(isolate->factory()->undefined_value(), constructor_fn) .ToHandleChecked(); CHECK(result_obj->IsPromiseCapability()); Handle<PromiseCapability> result = Handle<PromiseCapability>::cast(result_obj); CHECK(result->promise()->IsJSObject()); Handle<JSObject> promise(JSObject::cast(result->promise()), isolate); CHECK_EQ(constructor_fn->prototype_or_initial_map(), promise->map()); CHECK(result->resolve()->IsJSFunction()); CHECK(result->reject()->IsJSFunction()); Handle<String> resolved_str = isolate->factory()->NewStringFromAsciiChecked("resolvedStr"); Handle<String> rejected_str = isolate->factory()->NewStringFromAsciiChecked("rejectedStr"); Handle<Object> argv1[] = {resolved_str}; Handle<Object> ret = Execution::Call(isolate, handle(result->resolve(), isolate), isolate->factory()->undefined_value(), 1, argv1) .ToHandleChecked(); Handle<Object> prop1 = JSReceiver::GetProperty(isolate, promise, "resolvedValue") .ToHandleChecked(); CHECK_EQ(*resolved_str, *prop1); Handle<Object> argv2[] = {rejected_str}; ret = Execution::Call(isolate, handle(result->reject(), isolate), isolate->factory()->undefined_value(), 1, argv2) .ToHandleChecked(); Handle<Object> prop2 = JSReceiver::GetProperty(isolate, promise, "rejectedReason") .ToHandleChecked(); CHECK_EQ(*rejected_str, *prop2); } } TEST(DirectMemoryTest8BitWord32Immediate) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); int8_t buffer[] = {1, 2, 4, 8, 17, 33, 65, 127}; const int element_count = 8; Label bad(&m); Node* buffer_node = m.IntPtrConstant(reinterpret_cast<intptr_t>(buffer)); for (size_t i = 0; i < element_count; ++i) { for (size_t j = 0; j < element_count; ++j) { Node* loaded = m.LoadBufferObject(buffer_node, static_cast<int>(i), MachineType::Uint8()); Node* masked = m.Word32And(loaded, m.Int32Constant(buffer[j])); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } } } m.Return(m.SmiConstant(1)); m.BIND(&bad); m.Return(m.SmiConstant(0)); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); CHECK_EQ(1, ft.CallChecked<Smi>()->value()); } TEST(DirectMemoryTest16BitWord32Immediate) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); int16_t buffer[] = {156, 2234, 4544, 8444, 1723, 3888, 658, 1278}; const int element_count = 8; Label bad(&m); Node* buffer_node = m.IntPtrConstant(reinterpret_cast<intptr_t>(buffer)); for (size_t i = 0; i < element_count; ++i) { for (size_t j = 0; j < element_count; ++j) { Node* loaded = m.LoadBufferObject(buffer_node, static_cast<int>(i * sizeof(int16_t)), MachineType::Uint16()); Node* masked = m.Word32And(loaded, m.Int32Constant(buffer[j])); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } } } m.Return(m.SmiConstant(1)); m.BIND(&bad); m.Return(m.SmiConstant(0)); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); CHECK_EQ(1, ft.CallChecked<Smi>()->value()); } TEST(DirectMemoryTest8BitWord32) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); int8_t buffer[] = {1, 2, 4, 8, 17, 33, 65, 127, 67, 38}; const int element_count = 10; Label bad(&m); Node* constants[element_count]; Node* buffer_node = m.IntPtrConstant(reinterpret_cast<intptr_t>(buffer)); for (size_t i = 0; i < element_count; ++i) { constants[i] = m.LoadBufferObject(buffer_node, static_cast<int>(i), MachineType::Uint8()); } for (size_t i = 0; i < element_count; ++i) { for (size_t j = 0; j < element_count; ++j) { Node* loaded = m.LoadBufferObject(buffer_node, static_cast<int>(i), MachineType::Uint8()); Node* masked = m.Word32And(loaded, constants[j]); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } masked = m.Word32And(constants[i], constants[j]); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } } } m.Return(m.SmiConstant(1)); m.BIND(&bad); m.Return(m.SmiConstant(0)); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); CHECK_EQ(1, ft.CallChecked<Smi>()->value()); } TEST(DirectMemoryTest16BitWord32) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 0; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); int16_t buffer[] = {1, 2, 4, 8, 12345, 33, 65, 255, 67, 3823}; const int element_count = 10; Label bad(&m); Node* constants[element_count]; Node* buffer_node1 = m.IntPtrConstant(reinterpret_cast<intptr_t>(buffer)); for (size_t i = 0; i < element_count; ++i) { constants[i] = m.LoadBufferObject(buffer_node1, static_cast<int>(i * sizeof(int16_t)), MachineType::Uint16()); } Node* buffer_node2 = m.IntPtrConstant(reinterpret_cast<intptr_t>(buffer)); for (size_t i = 0; i < element_count; ++i) { for (size_t j = 0; j < element_count; ++j) { Node* loaded = m.LoadBufferObject(buffer_node1, static_cast<int>(i * sizeof(int16_t)), MachineType::Uint16()); Node* masked = m.Word32And(loaded, constants[j]); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } // Force a memory access relative to a high-number register. loaded = m.LoadBufferObject(buffer_node2, static_cast<int>(i * sizeof(int16_t)), MachineType::Uint16()); masked = m.Word32And(loaded, constants[j]); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } masked = m.Word32And(constants[i], constants[j]); if ((buffer[j] & buffer[i]) != 0) { m.GotoIf(m.Word32Equal(masked, m.Int32Constant(0)), &bad); } else { m.GotoIf(m.Word32NotEqual(masked, m.Int32Constant(0)), &bad); } } } m.Return(m.SmiConstant(1)); m.BIND(&bad); m.Return(m.SmiConstant(0)); FunctionTester ft(asm_tester.GenerateCode(), kNumParams); CHECK_EQ(1, ft.CallChecked<Smi>()->value()); } TEST(LoadJSArrayElementsMap) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); Node* context = m.Parameter(kNumParams + 2); Node* native_context = m.LoadNativeContext(context); Node* kind = m.SmiToInt32(m.Parameter(0)); m.Return(m.LoadJSArrayElementsMap(kind, native_context)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); for (int kind = 0; kind <= HOLEY_DOUBLE_ELEMENTS; kind++) { Handle<Map> csa_result = ft.CallChecked<Map>(handle(Smi::FromInt(kind), isolate)); ElementsKind elements_kind = static_cast<ElementsKind>(kind); Handle<Map> result( isolate->native_context()->GetInitialJSArrayMap(elements_kind), isolate); CHECK_EQ(*csa_result, *result); } } TEST(AllocateStruct) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); { Node* map = m.Parameter(0); Node* result = m.AllocateStruct(map); m.Return(result); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Map> maps[] = { handle(ReadOnlyRoots(isolate).tuple3_map(), isolate), handle(ReadOnlyRoots(isolate).tuple2_map(), isolate), }; { for (size_t i = 0; i < 2; i++) { Handle<Map> map = maps[i]; Handle<Struct> result = Handle<Struct>::cast(ft.Call(map).ToHandleChecked()); CHECK_EQ(result->map(), *map); #ifdef VERIFY_HEAP isolate->heap()->Verify(); #endif } } } TEST(GotoIfNotWhiteSpaceOrLineTerminator) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); StringTrimAssembler m(asm_tester.state()); { // Returns true if whitespace, false otherwise. Label if_not_whitespace(&m); m.GotoIfNotWhiteSpaceOrLineTerminator(m.SmiToInt32(m.Parameter(0)), &if_not_whitespace); m.Return(m.TrueConstant()); m.BIND(&if_not_whitespace); m.Return(m.FalseConstant()); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<Object> true_value = ft.true_value(); Handle<Object> false_value = ft.false_value(); for (uc16 c = 0; c < 0xFFFF; c++) { Handle<Object> expected_value = WhiteSpaceOrLineTerminator::Is(c) ? true_value : false_value; ft.CheckCall(expected_value, handle(Smi::FromInt(c), isolate)); } } TEST(BranchIfNumberRelationalComparison) { Isolate* isolate(CcTest::InitIsolateOnce()); Factory* f = isolate->factory(); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); Label return_true(&m), return_false(&m); m.BranchIfNumberRelationalComparison(Operation::kGreaterThanOrEqual, m.Parameter(0), m.Parameter(1), &return_true, &return_false); m.BIND(&return_true); m.Return(m.BooleanConstant(true)); m.BIND(&return_false); m.Return(m.BooleanConstant(false)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); ft.CheckTrue(f->NewNumber(0), f->NewNumber(0)); ft.CheckTrue(f->NewNumber(1), f->NewNumber(0)); ft.CheckTrue(f->NewNumber(1), f->NewNumber(1)); ft.CheckFalse(f->NewNumber(0), f->NewNumber(1)); ft.CheckFalse(f->NewNumber(-1), f->NewNumber(0)); ft.CheckTrue(f->NewNumber(-1), f->NewNumber(-1)); ft.CheckTrue(f->NewNumber(-1), f->NewNumber(-1.5)); ft.CheckFalse(f->NewNumber(-1.5), f->NewNumber(-1)); ft.CheckTrue(f->NewNumber(-1.5), f->NewNumber(-1.5)); } TEST(IsNumberArrayIndex) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); TNode<Number> number = m.CAST(m.Parameter(0)); m.Return( m.SmiFromInt32(m.UncheckedCast<Int32T>(m.IsNumberArrayIndex(number)))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); double indices[] = {Smi::kMinValue, -11, -1, 0, 1, 2, Smi::kMaxValue, -11.0, -11.1, -2.0, -1.0, -0.0, 0.0, 0.00001, 0.1, 1, 2, Smi::kMinValue - 1.0, Smi::kMinValue + 1.0, Smi::kMinValue + 1.2, kMaxInt + 1.2, kMaxInt - 10.0, kMaxInt - 1.0, kMaxInt, kMaxInt + 1.0, kMaxInt + 10.0}; for (size_t i = 0; i < arraysize(indices); i++) { Handle<Object> index = isolate->factory()->NewNumber(indices[i]); uint32_t array_index; CHECK_EQ(index->ToArrayIndex(&array_index), (ft.CallChecked<Smi>(index)->value() == 1)); } } TEST(NumberMinMax) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester_min(isolate, kNumParams); { CodeStubAssembler m(asm_tester_min.state()); m.Return(m.NumberMin(m.Parameter(0), m.Parameter(1))); } FunctionTester ft_min(asm_tester_min.GenerateCode(), kNumParams); CodeAssemblerTester asm_tester_max(isolate, kNumParams); { CodeStubAssembler m(asm_tester_max.state()); m.Return(m.NumberMax(m.Parameter(0), m.Parameter(1))); } FunctionTester ft_max(asm_tester_max.GenerateCode(), kNumParams); // Test smi values. Handle<Smi> smi_1(Smi::FromInt(1), isolate); Handle<Smi> smi_2(Smi::FromInt(2), isolate); Handle<Smi> smi_5(Smi::FromInt(5), isolate); CHECK_EQ(ft_min.CallChecked<Smi>(smi_1, smi_2)->value(), 1); CHECK_EQ(ft_min.CallChecked<Smi>(smi_2, smi_1)->value(), 1); CHECK_EQ(ft_max.CallChecked<Smi>(smi_1, smi_2)->value(), 2); CHECK_EQ(ft_max.CallChecked<Smi>(smi_2, smi_1)->value(), 2); // Test double values. Handle<Object> double_a = isolate->factory()->NewNumber(2.5); Handle<Object> double_b = isolate->factory()->NewNumber(3.5); Handle<Object> nan = isolate->factory()->NewNumber(std::numeric_limits<double>::quiet_NaN()); Handle<Object> infinity = isolate->factory()->NewNumber(V8_INFINITY); CHECK_EQ(ft_min.CallChecked<HeapNumber>(double_a, double_b)->value(), 2.5); CHECK_EQ(ft_min.CallChecked<HeapNumber>(double_b, double_a)->value(), 2.5); CHECK_EQ(ft_min.CallChecked<HeapNumber>(infinity, double_a)->value(), 2.5); CHECK_EQ(ft_min.CallChecked<HeapNumber>(double_a, infinity)->value(), 2.5); CHECK(std::isnan(ft_min.CallChecked<HeapNumber>(nan, double_a)->value())); CHECK(std::isnan(ft_min.CallChecked<HeapNumber>(double_a, nan)->value())); CHECK_EQ(ft_max.CallChecked<HeapNumber>(double_a, double_b)->value(), 3.5); CHECK_EQ(ft_max.CallChecked<HeapNumber>(double_b, double_a)->value(), 3.5); CHECK_EQ(ft_max.CallChecked<HeapNumber>(infinity, double_a)->value(), V8_INFINITY); CHECK_EQ(ft_max.CallChecked<HeapNumber>(double_a, infinity)->value(), V8_INFINITY); CHECK(std::isnan(ft_max.CallChecked<HeapNumber>(nan, double_a)->value())); CHECK(std::isnan(ft_max.CallChecked<HeapNumber>(double_a, nan)->value())); // Mixed smi/double values. CHECK_EQ(ft_max.CallChecked<HeapNumber>(smi_1, double_b)->value(), 3.5); CHECK_EQ(ft_max.CallChecked<HeapNumber>(double_b, smi_1)->value(), 3.5); CHECK_EQ(ft_min.CallChecked<HeapNumber>(smi_5, double_b)->value(), 3.5); CHECK_EQ(ft_min.CallChecked<HeapNumber>(double_b, smi_5)->value(), 3.5); } TEST(NumberAddSub) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester_add(isolate, kNumParams); { CodeStubAssembler m(asm_tester_add.state()); m.Return(m.NumberAdd(m.Parameter(0), m.Parameter(1))); } FunctionTester ft_add(asm_tester_add.GenerateCode(), kNumParams); CodeAssemblerTester asm_tester_sub(isolate, kNumParams); { CodeStubAssembler m(asm_tester_sub.state()); m.Return(m.NumberSub(m.Parameter(0), m.Parameter(1))); } FunctionTester ft_sub(asm_tester_sub.GenerateCode(), kNumParams); // Test smi values. Handle<Smi> smi_1(Smi::FromInt(1), isolate); Handle<Smi> smi_2(Smi::FromInt(2), isolate); CHECK_EQ(ft_add.CallChecked<Smi>(smi_1, smi_2)->value(), 3); CHECK_EQ(ft_sub.CallChecked<Smi>(smi_2, smi_1)->value(), 1); // Test double values. Handle<Object> double_a = isolate->factory()->NewNumber(2.5); Handle<Object> double_b = isolate->factory()->NewNumber(3.0); CHECK_EQ(ft_add.CallChecked<HeapNumber>(double_a, double_b)->value(), 5.5); CHECK_EQ(ft_sub.CallChecked<HeapNumber>(double_a, double_b)->value(), -.5); // Test overflow. Handle<Smi> smi_max(Smi::FromInt(Smi::kMaxValue), isolate); Handle<Smi> smi_min(Smi::FromInt(Smi::kMinValue), isolate); CHECK_EQ(ft_add.CallChecked<HeapNumber>(smi_max, smi_1)->value(), static_cast<double>(Smi::kMaxValue) + 1); CHECK_EQ(ft_sub.CallChecked<HeapNumber>(smi_min, smi_1)->value(), static_cast<double>(Smi::kMinValue) - 1); // Test mixed smi/double values. CHECK_EQ(ft_add.CallChecked<HeapNumber>(smi_1, double_a)->value(), 3.5); CHECK_EQ(ft_add.CallChecked<HeapNumber>(double_a, smi_1)->value(), 3.5); CHECK_EQ(ft_sub.CallChecked<HeapNumber>(smi_1, double_a)->value(), -1.5); CHECK_EQ(ft_sub.CallChecked<HeapNumber>(double_a, smi_1)->value(), 1.5); } TEST(CloneEmptyFixedArray) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); m.Return(m.CloneFixedArray(m.Parameter(0))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->empty_fixed_array()); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(0, result->length()); CHECK_EQ(*(isolate->factory()->empty_fixed_array()), result); } TEST(CloneFixedArray) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); m.Return(m.CloneFixedArray(m.Parameter(0))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(5, result->length()); CHECK(result->get(0)->IsTheHole(isolate)); CHECK_EQ(Smi::cast(result->get(1))->value(), 1234); CHECK(result->get(2)->IsTheHole(isolate)); CHECK(result->get(3)->IsTheHole(isolate)); CHECK(result->get(4)->IsTheHole(isolate)); } TEST(CloneFixedArrayCOW) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); m.Return(m.CloneFixedArray(m.Parameter(0))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); source->set_map(ReadOnlyRoots(isolate).fixed_cow_array_map()); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(*source, result); } TEST(ExtractFixedArrayCOWForceCopy) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(0), nullptr, nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); source->set_map(ReadOnlyRoots(isolate).fixed_cow_array_map()); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_NE(*source, result); CHECK_EQ(5, result->length()); CHECK(result->get(0)->IsTheHole(isolate)); CHECK_EQ(Smi::cast(result->get(1))->value(), 1234); CHECK(result->get(2)->IsTheHole(isolate)); CHECK(result->get(3)->IsTheHole(isolate)); CHECK(result->get(4)->IsTheHole(isolate)); } TEST(ExtractFixedArraySimple) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; m.Return(m.ExtractFixedArray(m.Parameter(0), m.Parameter(1), m.Parameter(2), nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source, Handle<Smi>(Smi::FromInt(1), isolate), Handle<Smi>(Smi::FromInt(2), isolate)) .ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(2, result->length()); CHECK_EQ(Smi::cast(result->get(0))->value(), 1234); CHECK(result->get(1)->IsTheHole(isolate)); } TEST(ExtractFixedArraySimpleSmiConstant) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; m.Return(m.ExtractFixedArray(m.Parameter(0), m.SmiConstant(1), m.SmiConstant(2), nullptr, flags, CodeStubAssembler::SMI_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(2, result->length()); CHECK_EQ(Smi::cast(result->get(0))->value(), 1234); CHECK(result->get(1)->IsTheHole(isolate)); } TEST(ExtractFixedArraySimpleIntPtrConstant) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); CodeStubAssembler::ExtractFixedArrayFlags flags; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays; flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW; m.Return(m.ExtractFixedArray(m.Parameter(0), m.IntPtrConstant(1), m.IntPtrConstant(2), nullptr, flags, CodeStubAssembler::INTPTR_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(2, result->length()); CHECK_EQ(Smi::cast(result->get(0))->value(), 1234); CHECK(result->get(1)->IsTheHole(isolate)); } TEST(ExtractFixedArraySimpleIntPtrConstantNoDoubles) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); m.Return(m.ExtractFixedArray( m.Parameter(0), m.IntPtrConstant(1), m.IntPtrConstant(2), nullptr, CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays, CodeStubAssembler::INTPTR_PARAMETERS)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source).ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(2, result->length()); CHECK_EQ(Smi::cast(result->get(0))->value(), 1234); CHECK(result->get(1)->IsTheHole(isolate)); } TEST(ExtractFixedArraySimpleIntPtrParameters) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); Node* p1_untagged = m.SmiUntag(m.Parameter(1)); Node* p2_untagged = m.SmiUntag(m.Parameter(2)); m.Return(m.ExtractFixedArray(m.Parameter(0), p1_untagged, p2_untagged)); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Handle<FixedArray> source(isolate->factory()->NewFixedArrayWithHoles(5)); source->set(1, Smi::FromInt(1234)); Handle<Object> result_raw = ft.Call(source, Handle<Smi>(Smi::FromInt(1), isolate), Handle<Smi>(Smi::FromInt(2), isolate)) .ToHandleChecked(); FixedArray* result(FixedArray::cast(*result_raw)); CHECK_EQ(2, result->length()); CHECK_EQ(Smi::cast(result->get(0))->value(), 1234); CHECK(result->get(1)->IsTheHole(isolate)); Handle<FixedDoubleArray> source_double = Handle<FixedDoubleArray>::cast( isolate->factory()->NewFixedDoubleArray(5)); source_double->set(0, 10); source_double->set(1, 11); source_double->set(2, 12); source_double->set(3, 13); source_double->set(4, 14); Handle<Object> double_result_raw = ft.Call(source_double, Handle<Smi>(Smi::FromInt(1), isolate), Handle<Smi>(Smi::FromInt(2), isolate)) .ToHandleChecked(); FixedDoubleArray* double_result(FixedDoubleArray::cast(*double_result_raw)); CHECK_EQ(2, double_result->length()); CHECK_EQ(double_result->get_scalar(0), 11); CHECK_EQ(double_result->get_scalar(1), 12); } TEST(SingleInputPhiElimination) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); Variable temp1(&m, MachineRepresentation::kTagged); Variable temp2(&m, MachineRepresentation::kTagged); Label temp_label(&m, {&temp1, &temp2}); Label end_label(&m, {&temp1, &temp2}); temp1.Bind(m.Parameter(1)); temp2.Bind(m.Parameter(1)); m.Branch(m.WordEqual(m.Parameter(0), m.Parameter(1)), &end_label, &temp_label); temp1.Bind(m.Parameter(2)); temp2.Bind(m.Parameter(2)); m.BIND(&temp_label); m.Goto(&end_label); m.BIND(&end_label); m.Return(temp1.value()); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); // Generating code without an assert is enough to make sure that the // single-input phi is properly eliminated. } TEST(SmallOrderedHashMapAllocate) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); TNode<Smi> capacity = m.CAST(m.Parameter(0)); m.Return(m.AllocateSmallOrderedHashTable<SmallOrderedHashMap>( m.SmiToIntPtr(capacity))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); Factory* factory = isolate->factory(); int capacity = SmallOrderedHashMap::kMinCapacity; while (capacity <= SmallOrderedHashMap::kMaxCapacity) { Handle<SmallOrderedHashMap> expected = factory->NewSmallOrderedHashMap(capacity); Handle<Object> result_raw = ft.Call(Handle<Smi>(Smi::FromInt(capacity), isolate)).ToHandleChecked(); Handle<SmallOrderedHashMap> actual = Handle<SmallOrderedHashMap>( SmallOrderedHashMap::cast(*result_raw), isolate); CHECK_EQ(capacity, actual->Capacity()); CHECK_EQ(0, actual->NumberOfElements()); CHECK_EQ(0, actual->NumberOfDeletedElements()); CHECK_EQ(capacity / SmallOrderedHashMap::kLoadFactor, actual->NumberOfBuckets()); CHECK_EQ(0, memcmp(reinterpret_cast<void*>(expected->address()), reinterpret_cast<void*>(actual->address()), SmallOrderedHashMap::SizeFor(capacity))); #ifdef VERIFY_HEAP actual->SmallOrderedHashTableVerify(isolate); #endif capacity = capacity << 1; } #ifdef VERIFY_HEAP isolate->heap()->Verify(); #endif } TEST(SmallOrderedHashSetAllocate) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); { CodeStubAssembler m(asm_tester.state()); TNode<Smi> capacity = m.CAST(m.Parameter(0)); m.Return(m.AllocateSmallOrderedHashTable<SmallOrderedHashSet>( m.SmiToIntPtr(capacity))); } FunctionTester ft(asm_tester.GenerateCode(), kNumParams); int capacity = SmallOrderedHashSet::kMinCapacity; Factory* factory = isolate->factory(); while (capacity <= SmallOrderedHashSet::kMaxCapacity) { Handle<SmallOrderedHashSet> expected = factory->NewSmallOrderedHashSet(capacity); Handle<Object> result_raw = ft.Call(Handle<Smi>(Smi::FromInt(capacity), isolate)).ToHandleChecked(); Handle<SmallOrderedHashSet> actual = Handle<SmallOrderedHashSet>( SmallOrderedHashSet::cast(*result_raw), isolate); CHECK_EQ(capacity, actual->Capacity()); CHECK_EQ(0, actual->NumberOfElements()); CHECK_EQ(0, actual->NumberOfDeletedElements()); CHECK_EQ(capacity / SmallOrderedHashSet::kLoadFactor, actual->NumberOfBuckets()); CHECK_EQ(0, memcmp(reinterpret_cast<void*>(expected->address()), reinterpret_cast<void*>(actual->address()), SmallOrderedHashSet::SizeFor(capacity))); #ifdef VERIFY_HEAP actual->SmallOrderedHashTableVerify(isolate); #endif capacity = capacity << 1; } #ifdef VERIFY_HEAP isolate->heap()->Verify(); #endif } TEST(IsDoubleElementsKind) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 2; CodeAssemblerTester ft_tester(isolate, kNumParams); { CodeStubAssembler m(ft_tester.state()); m.Return(m.SmiFromInt32(m.UncheckedCast<Int32T>( m.IsDoubleElementsKind(m.SmiToInt32(m.Parameter(0)))))); } FunctionTester ft(ft_tester.GenerateCode(), kNumParams); CHECK_EQ( (*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(PACKED_DOUBLE_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 1); CHECK_EQ( (*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(HOLEY_DOUBLE_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 1); CHECK_EQ((*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(HOLEY_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 0); CHECK_EQ((*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(PACKED_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 0); CHECK_EQ((*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(PACKED_SMI_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 0); CHECK_EQ((*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(HOLEY_SMI_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 0); CHECK_EQ((*Handle<Smi>::cast( ft.Call(Handle<Smi>(Smi::FromInt(DICTIONARY_ELEMENTS), isolate)) .ToHandleChecked())) ->value(), 0); } TEST(TestCallBuiltinInlineTrampoline) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); const int kContextOffset = 2; Node* str = m.Parameter(0); Node* context = m.Parameter(kNumParams + kContextOffset); Node* index = m.SmiConstant(2); m.Return(m.CallStub(Builtins::CallableFor(isolate, Builtins::kStringRepeat), context, str, index)); AssemblerOptions options = AssemblerOptions::Default(isolate); options.inline_offheap_trampolines = true; options.use_pc_relative_calls_and_jumps = false; options.isolate_independent_code = false; FunctionTester ft(asm_tester.GenerateCode(options), kNumParams); MaybeHandle<Object> result = ft.Call(MakeString("abcdef")); CHECK(String::Equals(isolate, MakeString("abcdefabcdef"), Handle<String>::cast(result.ToHandleChecked()))); } TEST(TestCallBuiltinIndirectLoad) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; CodeAssemblerTester asm_tester(isolate, kNumParams); CodeStubAssembler m(asm_tester.state()); const int kContextOffset = 2; Node* str = m.Parameter(0); Node* context = m.Parameter(kNumParams + kContextOffset); Node* index = m.SmiConstant(2); m.Return(m.CallStub(Builtins::CallableFor(isolate, Builtins::kStringRepeat), context, str, index)); AssemblerOptions options = AssemblerOptions::Default(isolate); options.inline_offheap_trampolines = false; options.use_pc_relative_calls_and_jumps = false; options.isolate_independent_code = true; FunctionTester ft(asm_tester.GenerateCode(options), kNumParams); MaybeHandle<Object> result = ft.Call(MakeString("abcdef")); CHECK(String::Equals(isolate, MakeString("abcdefabcdef"), Handle<String>::cast(result.ToHandleChecked()))); } TEST(TestGotoIfDebugExecutionModeChecksSideEffects) { Isolate* isolate(CcTest::InitIsolateOnce()); CodeAssemblerTester asm_tester(isolate, 0); { CodeStubAssembler m(asm_tester.state()); Label is_true(&m), is_false(&m); m.GotoIfDebugExecutionModeChecksSideEffects(&is_true); m.Goto(&is_false); m.BIND(&is_false); m.Return(m.BooleanConstant(false)); m.BIND(&is_true); m.Return(m.BooleanConstant(true)); } FunctionTester ft(asm_tester.GenerateCode(), 0); CHECK(isolate->debug_execution_mode() != DebugInfo::kSideEffects); Handle<Object> result = ft.Call().ToHandleChecked(); CHECK(result->IsBoolean()); CHECK_EQ(false, result->BooleanValue(isolate)); isolate->debug()->StartSideEffectCheckMode(); CHECK(isolate->debug_execution_mode() == DebugInfo::kSideEffects); result = ft.Call().ToHandleChecked(); CHECK(result->IsBoolean()); CHECK_EQ(true, result->BooleanValue(isolate)); } } // namespace compiler } // namespace internal } // namespace v8
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r9 push %rbx push %rsi lea addresses_WT_ht+0xa110, %r14 clflush (%r14) nop nop nop add %r12, %r12 movb $0x61, (%r14) nop nop nop add $19084, %rsi lea addresses_normal_ht+0xae10, %r9 nop nop nop cmp $20421, %r12 mov (%r9), %r10d nop and %r12, %r12 lea addresses_A_ht+0x1a0f8, %r14 nop nop nop nop nop sub $33113, %rsi mov $0x6162636465666768, %r9 movq %r9, %xmm3 movups %xmm3, (%r14) nop nop nop add %r14, %r14 pop %rsi pop %rbx pop %r9 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r8 push %r9 push %rax push %rdi // Faulty Load lea addresses_UC+0x3f10, %rdi nop nop nop nop nop and $11675, %r10 mov (%rdi), %r8w lea oracles, %rax and $0xff, %r8 shlq $12, %r8 mov (%rax,%r8,1), %r8 pop %rdi pop %rax pop %r9 pop %r8 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_UC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_WC_ht+0x10f7, %rsi lea addresses_WT_ht+0x13cb7, %rdi nop nop nop xor $14554, %r8 mov $50, %rcx rep movsw nop nop nop nop cmp %rbp, %rbp lea addresses_UC_ht+0xc1b7, %r10 nop and %r14, %r14 mov $0x6162636465666768, %rdi movq %rdi, %xmm6 movups %xmm6, (%r10) cmp $11512, %rdi lea addresses_WC_ht+0x4897, %rsi nop nop nop cmp $20973, %rcx movups (%rsi), %xmm2 vpextrq $0, %xmm2, %rbp cmp $25089, %rsi lea addresses_normal_ht+0x197a7, %rsi lea addresses_D_ht+0x106b7, %rdi nop nop nop sub $34331, %r12 mov $7, %rcx rep movsl nop nop add %rsi, %rsi lea addresses_normal_ht+0x5c37, %rsi lea addresses_WC_ht+0x10f77, %rdi nop nop nop nop nop add %r10, %r10 mov $101, %rcx rep movsq add $16765, %r10 lea addresses_D_ht+0x30b7, %r14 add $37378, %rcx mov (%r14), %r12d nop cmp $30420, %r14 lea addresses_D_ht+0x1061f, %rsi lea addresses_UC_ht+0x66b7, %rdi nop nop nop sub $878, %rbp mov $34, %rcx rep movsb nop nop nop cmp $355, %rsi lea addresses_normal_ht+0x2fb7, %rbp add %rsi, %rsi mov (%rbp), %r8d nop nop add %rbp, %rbp lea addresses_A_ht+0x44b7, %r8 nop nop nop xor $25375, %rcx movl $0x61626364, (%r8) nop cmp %rdi, %rdi lea addresses_WT_ht+0x96f7, %rsi lea addresses_A_ht+0x1a537, %rdi nop and %r12, %r12 mov $8, %rcx rep movsw add %rbp, %rbp lea addresses_normal_ht+0x19ab7, %rbp nop nop nop sub %r8, %r8 mov (%rbp), %r12 nop add $7454, %rdi lea addresses_A_ht+0x1dbf6, %r8 nop nop nop nop nop sub %rcx, %rcx movw $0x6162, (%r8) nop nop nop nop nop sub %rbp, %rbp lea addresses_WT_ht+0x5c47, %r12 nop nop nop nop nop cmp %r10, %r10 mov $0x6162636465666768, %rcx movq %rcx, (%r12) nop nop nop sub $32656, %r14 pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_D+0x120f7, %rsi lea addresses_UC+0x18f9f, %rdi nop sub %r9, %r9 mov $63, %rcx rep movsb and $27292, %r13 // Store lea addresses_UC+0x57f7, %rcx nop cmp $43190, %rdx movl $0x51525354, (%rcx) nop nop nop nop and %rcx, %rcx // Faulty Load lea addresses_normal+0xa2b7, %rdx nop nop nop nop cmp $21186, %r9 vmovups (%rdx), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rcx lea oracles, %r13 and $0xff, %rcx shlq $12, %rcx mov (%r13,%rcx,1), %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'AVXalign': True, 'size': 2, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}} [Faulty Load] {'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 8}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
<% from pwnlib.shellcraft.amd64 import syscall, pushstr from pwnlib.shellcraft import common %> <%page args="filename, fd=1"/> <%docstring> Opens a file and writes its contents to the specified file descriptor. </%docstring> ${pushstr(filename)} ${syscall('SYS_open', 'rsp', 0, 'O_RDONLY')} ${syscall('SYS_sendfile', fd, 'rax', 0, 0x7fffffff)}
; A026625: a(n) = Sum_{k=0..floor(n/2)} A026615(n-k,k). ; Submitted by Christian Krause ; 1,1,2,4,7,13,21,36,58,96,155,253,409,664,1074,1740,2815,4557,7373,11932,19306,31240,50547,81789,132337,214128,346466,560596,907063,1467661,2374725,3842388,6217114,10059504,16276619,26336125,42612745,68948872,111561618,180510492,292072111,472582605,764654717,1237237324,2001892042,3239129368,5241021411,8480150781,13721172193,22201322976,35922495170,58123818148,94046313319,152170131469,246216444789,398386576260,644603021050,1042989597312,1687592618363,2730582215677,4418174834041,7148757049720 lpb $0 sub $0,1 add $1,$3 mul $3,$2 cmp $3,$2 add $3,1 mov $4,$2 add $2,$1 mov $1,$4 lpe max $2,1 mov $0,$2
; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozstopbits.asm,v 1.3 2016/06/27 21:25:36 dom Exp $ ; SECTION code_clib PUBLIC ozstopbits PUBLIC _ozstopbits ozstopbits: _ozstopbits: ld hl,2 add hl,sp in a,(43h) and 1+2+8+10h+20h+40h+80 or (hl) out (43h),a ret
; A131865: Partial sums of powers of 16. ; Submitted by Christian Krause ; 1,17,273,4369,69905,1118481,17895697,286331153,4581298449,73300775185,1172812402961,18764998447377,300239975158033,4803839602528529,76861433640456465,1229782938247303441,19676527011956855057,314824432191309680913,5037190915060954894609,80595054640975278313745,1289520874255604453019921,20632333988089671248318737,330117343809434739973099793,5281877500950955839569596689,84510040015215293433113547025,1352160640243444694929816752401,21634570243895115118877068038417,346153123902321841902033088614673 mov $1,16 pow $1,$0 mov $0,$1 div $0,15 mul $0,16 add $0,1
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: HMUI.ViewControllerTransitionHelpers #include "HMUI/ViewControllerTransitionHelpers.hpp" // Including type: System.Collections.Generic.IEnumerator`1 #include "System/Collections/Generic/IEnumerator_1.hpp" // Including type: HMUI.ViewController/AnimationDirection #include "HMUI/ViewController_AnimationDirection.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: HMUI namespace HMUI { // Skipping declaration: ViewController because it is already included! } // Completed forward declares // Type namespace: HMUI namespace HMUI { // Size: 0x3C #pragma pack(push, 1) // Autogenerated type: HMUI.ViewControllerTransitionHelpers/<DoDismissTransition>d__4 // [CompilerGeneratedAttribute] Offset: DF5E34 class ViewControllerTransitionHelpers::$DoDismissTransition$d__4 : public ::Il2CppObject/*, public System::Collections::Generic::IEnumerator_1<::Il2CppObject*>*/ { public: // private System.Int32 <>1__state // Size: 0x4 // Offset: 0x10 int $$1__state; // Field size check static_assert(sizeof(int) == 0x4); // Padding between fields: $$1__state and: $$2__current char __padding0[0x4] = {}; // private System.Object <>2__current // Size: 0x8 // Offset: 0x18 ::Il2CppObject* $$2__current; // Field size check static_assert(sizeof(::Il2CppObject*) == 0x8); // public HMUI.ViewController/AnimationDirection animationDirection // Size: 0x4 // Offset: 0x20 HMUI::ViewController::AnimationDirection animationDirection; // Field size check static_assert(sizeof(HMUI::ViewController::AnimationDirection) == 0x4); // Padding between fields: animationDirection and: toPresentViewController char __padding2[0x4] = {}; // public HMUI.ViewController toPresentViewController // Size: 0x8 // Offset: 0x28 HMUI::ViewController* toPresentViewController; // Field size check static_assert(sizeof(HMUI::ViewController*) == 0x8); // public HMUI.ViewController toDismissViewController // Size: 0x8 // Offset: 0x30 HMUI::ViewController* toDismissViewController; // Field size check static_assert(sizeof(HMUI::ViewController*) == 0x8); // public System.Single moveOffsetMultiplier // Size: 0x4 // Offset: 0x38 float moveOffsetMultiplier; // Field size check static_assert(sizeof(float) == 0x4); // Creating value type constructor for type: $DoDismissTransition$d__4 $DoDismissTransition$d__4(int $$1__state_ = {}, ::Il2CppObject* $$2__current_ = {}, HMUI::ViewController::AnimationDirection animationDirection_ = {}, HMUI::ViewController* toPresentViewController_ = {}, HMUI::ViewController* toDismissViewController_ = {}, float moveOffsetMultiplier_ = {}) noexcept : $$1__state{$$1__state_}, $$2__current{$$2__current_}, animationDirection{animationDirection_}, toPresentViewController{toPresentViewController_}, toDismissViewController{toDismissViewController_}, moveOffsetMultiplier{moveOffsetMultiplier_} {} // Creating interface conversion operator: operator System::Collections::Generic::IEnumerator_1<::Il2CppObject*> operator System::Collections::Generic::IEnumerator_1<::Il2CppObject*>() noexcept { return *reinterpret_cast<System::Collections::Generic::IEnumerator_1<::Il2CppObject*>*>(this); } // public System.Void .ctor(System.Int32 <>1__state) // Offset: 0x2372464 template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static ViewControllerTransitionHelpers::$DoDismissTransition$d__4* New_ctor(int $$1__state) { static auto ___internal__logger = ::Logger::get().WithContext("HMUI::ViewControllerTransitionHelpers::$DoDismissTransition$d__4::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<ViewControllerTransitionHelpers::$DoDismissTransition$d__4*, creationType>($$1__state))); } // private System.Void System.IDisposable.Dispose() // Offset: 0x2372B3C void System_IDisposable_Dispose(); // private System.Boolean MoveNext() // Offset: 0x2372B40 bool MoveNext(); // private System.Object System.Collections.Generic.IEnumerator<System.Object>.get_Current() // Offset: 0x2372BE0 ::Il2CppObject* System_Collections_Generic_IEnumerator$System_Object$_get_Current(); // private System.Void System.Collections.IEnumerator.Reset() // Offset: 0x2372BE8 void System_Collections_IEnumerator_Reset(); // private System.Object System.Collections.IEnumerator.get_Current() // Offset: 0x2372C48 ::Il2CppObject* System_Collections_IEnumerator_get_Current(); }; // HMUI.ViewControllerTransitionHelpers/<DoDismissTransition>d__4 #pragma pack(pop) static check_size<sizeof(ViewControllerTransitionHelpers::$DoDismissTransition$d__4), 56 + sizeof(float)> __HMUI_ViewControllerTransitionHelpers_$DoDismissTransition$d__4SizeCheck; static_assert(sizeof(ViewControllerTransitionHelpers::$DoDismissTransition$d__4) == 0x3C); } DEFINE_IL2CPP_ARG_TYPE(HMUI::ViewControllerTransitionHelpers::$DoDismissTransition$d__4*, "HMUI", "ViewControllerTransitionHelpers/<DoDismissTransition>d__4");
[BITS 64] %include "parameters.inc" extern exit global mul_float64 section .text mul_float64: push rbp mov rbx, ITERATIONS_mul_float64 mov rax, __float64__(1.0) mov rcx, __float64__(2.0) mov rdx, __float64__(3.0) mov rsi, __float64__(4.0) mov rdi, __float64__(5.0) mov r8, __float64__(6.0) mov r9, __float64__(7.0) mov r10, __float64__(8.0) mov r11, __float64__(9.0) mov r12, __float64__(10.0) mov r13, __float64__(11.0) mov r14, __float64__(12.0) mov r15, __float64__(13.0) .loop: mul rax xor rax, rax mul rcx xor rax, rax mul rdx xor rax, rax mul rsi xor rax, rax mul rdi xor rax, rax mul r8 xor rax, rax mul r9 xor rax, rax mul r10 xor rax, rax mul r11 xor rax, rax mul r12 xor rax, rax mul r13 xor rax, rax mul r14 xor rax, rax mul r15 xor rax, rax dec rbx jnz .loop .exit: lea rdi, [rel format] pop rbp xor rax, rax mov rax, ITERATIONS_mul_float64 mov rsi, 15 ; 13 mul + 1 dec + 1 loop mul rsi ret section .data format: db "%lu", 10, 0
menu_online_mode_anim_cursor: ; Frame 1 ANIM_FRAME_BEGIN(8) ANIM_SPRITE($fe, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $01, $fd) ANIM_SPRITE($fe, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $41, $02) ANIM_SPRITE($01, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $81, $fd) ANIM_SPRITE($01, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $c1, $02) ANIM_SPRITE($f9, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $01, $00) ANIM_SPRITE($06, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $81, $00) ANIM_FRAME_END ; Frame 2 ANIM_FRAME_BEGIN(8) ANIM_SPRITE($fd, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $01, $fc) ANIM_SPRITE($fd, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $41, $03) ANIM_SPRITE($02, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $81, $fc) ANIM_SPRITE($02, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $c1, $03) ANIM_SPRITE($f8, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $01, $00) ANIM_SPRITE($07, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $81, $00) ANIM_FRAME_END ; Frame 3 ANIM_FRAME_BEGIN(8) ANIM_SPRITE($fe, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $01, $fd) ANIM_SPRITE($fe, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $41, $02) ANIM_SPRITE($01, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $81, $fd) ANIM_SPRITE($01, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $c1, $02) ANIM_SPRITE($f9, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $01, $00) ANIM_SPRITE($06, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $81, $00) ANIM_FRAME_END ; Frame 4 ANIM_FRAME_BEGIN(8) ANIM_SPRITE($fd, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $01, $fc) ANIM_SPRITE($fd, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $41, $03) ANIM_SPRITE($02, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $81, $fc) ANIM_SPRITE($02, TILE_MENU_ONLINE_MODE_SPRITES_CORNER, $c1, $03) ANIM_SPRITE($fa, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $01, $00) ANIM_SPRITE($05, TILE_MENU_ONLINE_MODE_SPRITES_ARROW_VERTICAL, $81, $00) ANIM_FRAME_END ; End of animation ANIM_ANIMATION_END menu_online_mode_anim_ship: ; Frame 1 ANIM_FRAME_BEGIN(8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SHIP1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SHIP2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SHIP3, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SHIP4, $01, $00) ANIM_FRAME_END ; End of animation ANIM_ANIMATION_END menu_online_mode_anim_monster: ; Frame 1 ANIM_FRAME_BEGIN(16) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_TAIL1, $01, $f8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_HEAD1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(16) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_TAIL2, $01, $f8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_HEAD2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(16) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_TAIL3, $01, $f8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_HEAD3, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(16) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_TAIL4, $01, $f8) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_MONSTER_HEAD4, $01, $00) ANIM_FRAME_END ; End of animation ANIM_ANIMATION_END menu_online_mode_anim_satellite: .( DOT = 8 ANIM_FRAME_BEGIN(50) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(3*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(3*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(3*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE1, $01, $00) ANIM_FRAME_END ANIM_FRAME_BEGIN(1*DOT) ANIM_SPRITE($00, TILE_MENU_ONLINE_MODE_SPRITES_SATELLITE2, $01, $00) ANIM_FRAME_END ; End of animation ANIM_ANIMATION_END .)
; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; Wide resolution (int type parameters) version by Stefano Bodrato ; ; ; $Id: w_undraw.asm $ ; ; ; CALLER LINKAGE FOR FUNCTION POINTERS ; ----- void undraw(int x, int y, int x2, int y2) IF !__CPU_INTEL__ SECTION code_graphics PUBLIC undraw PUBLIC _undraw EXTERN undraw_callee EXTERN ASMDISP_UNDRAW_CALLEE .undraw ._undraw pop af pop de pop hl exx ; w_respixel and swapgfxbk must not use the alternate registers, no problem with w_line_r pop hl pop de push de push hl exx push hl push de ;exx push af ; ret addr jp undraw_callee + ASMDISP_UNDRAW_CALLEE ENDIF
;***************************************************************************** ;* x86-optimized AC-3 DSP functions ;* Copyright (c) 2011 Justin Ruggles ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg 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. ;* ;* FFmpeg 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 FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA ; 16777216.0f - used in ff_float_to_fixed24() pf_1_24: times 4 dd 0x4B800000 ; used in ff_ac3_compute_mantissa_size() cextern ac3_bap_bits pw_bap_mul1: dw 21846, 21846, 0, 32768, 21846, 21846, 0, 32768 pw_bap_mul2: dw 5, 7, 0, 7, 5, 7, 0, 7 ; used in ff_ac3_extract_exponents() pd_1: times 4 dd 1 pd_151: times 4 dd 151 SECTION .text ;----------------------------------------------------------------------------- ; void ff_ac3_exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs) ;----------------------------------------------------------------------------- %macro AC3_EXPONENT_MIN 0 cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset shl reuse_blksq, 8 jz .end LOOP_ALIGN .nextexp: mov offsetq, reuse_blksq mova m0, [expq+offsetq] sub offsetq, 256 LOOP_ALIGN .nextblk: PMINUB m0, [expq+offsetq], m1 sub offsetq, 256 jae .nextblk mova [expq], m0 add expq, mmsize sub expnq, mmsize jg .nextexp .end: REP_RET %endmacro %define LOOP_ALIGN INIT_MMX mmx AC3_EXPONENT_MIN %if HAVE_MMXEXT_EXTERNAL %define LOOP_ALIGN ALIGN 16 INIT_MMX mmxext AC3_EXPONENT_MIN %endif %if HAVE_SSE2_EXTERNAL INIT_XMM sse2 AC3_EXPONENT_MIN %endif %undef LOOP_ALIGN ;----------------------------------------------------------------------------- ; int ff_ac3_max_msb_abs_int16(const int16_t *src, int len) ; ; This function uses 2 different methods to calculate a valid result. ; 1) logical 'or' of abs of each element ; This is used for ssse3 because of the pabsw instruction. ; It is also used for mmx because of the lack of min/max instructions. ; 2) calculate min/max for the array, then or(abs(min),abs(max)) ; This is used for mmxext and sse2 because they have pminsw/pmaxsw. ;----------------------------------------------------------------------------- ; logical 'or' of 4 or 8 words in an mmx or xmm register into the low word %macro OR_WORDS_HORIZ 2 ; src, tmp %if cpuflag(sse2) movhlps %2, %1 por %1, %2 pshuflw %2, %1, q0032 por %1, %2 pshuflw %2, %1, q0001 por %1, %2 %elif cpuflag(mmxext) pshufw %2, %1, q0032 por %1, %2 pshufw %2, %1, q0001 por %1, %2 %else ; mmx movq %2, %1 psrlq %2, 32 por %1, %2 movq %2, %1 psrlq %2, 16 por %1, %2 %endif %endmacro %macro AC3_MAX_MSB_ABS_INT16 1 cglobal ac3_max_msb_abs_int16, 2,2,5, src, len pxor m2, m2 pxor m3, m3 .loop: %ifidn %1, min_max mova m0, [srcq] mova m1, [srcq+mmsize] pminsw m2, m0 pminsw m2, m1 pmaxsw m3, m0 pmaxsw m3, m1 %else ; or_abs %if notcpuflag(ssse3) mova m0, [srcq] mova m1, [srcq+mmsize] ABS2 m0, m1, m3, m4 %else ; ssse3 ; using memory args is faster for ssse3 pabsw m0, [srcq] pabsw m1, [srcq+mmsize] %endif por m2, m0 por m2, m1 %endif add srcq, mmsize*2 sub lend, mmsize ja .loop %ifidn %1, min_max ABS2 m2, m3, m0, m1 por m2, m3 %endif OR_WORDS_HORIZ m2, m0 movd eax, m2 and eax, 0xFFFF RET %endmacro INIT_MMX mmx AC3_MAX_MSB_ABS_INT16 or_abs INIT_MMX mmxext AC3_MAX_MSB_ABS_INT16 min_max INIT_XMM sse2 AC3_MAX_MSB_ABS_INT16 min_max INIT_XMM ssse3 AC3_MAX_MSB_ABS_INT16 or_abs ;----------------------------------------------------------------------------- ; macro used for ff_ac3_lshift_int16() and ff_ac3_rshift_int32() ;----------------------------------------------------------------------------- %macro AC3_SHIFT 3 ; l/r, 16/32, shift instruction, instruction set cglobal ac3_%1shift_int%2, 3, 3, 5, src, len, shift movd m0, shiftd .loop: mova m1, [srcq ] mova m2, [srcq+mmsize ] mova m3, [srcq+mmsize*2] mova m4, [srcq+mmsize*3] %3 m1, m0 %3 m2, m0 %3 m3, m0 %3 m4, m0 mova [srcq ], m1 mova [srcq+mmsize ], m2 mova [srcq+mmsize*2], m3 mova [srcq+mmsize*3], m4 add srcq, mmsize*4 sub lend, mmsize*32/%2 ja .loop .end: REP_RET %endmacro ;----------------------------------------------------------------------------- ; void ff_ac3_lshift_int16(int16_t *src, unsigned int len, unsigned int shift) ;----------------------------------------------------------------------------- INIT_MMX mmx AC3_SHIFT l, 16, psllw INIT_XMM sse2 AC3_SHIFT l, 16, psllw ;----------------------------------------------------------------------------- ; void ff_ac3_rshift_int32(int32_t *src, unsigned int len, unsigned int shift) ;----------------------------------------------------------------------------- INIT_MMX mmx AC3_SHIFT r, 32, psrad INIT_XMM sse2 AC3_SHIFT r, 32, psrad ;----------------------------------------------------------------------------- ; void ff_float_to_fixed24(int32_t *dst, const float *src, unsigned int len) ;----------------------------------------------------------------------------- ; The 3DNow! version is not bit-identical because pf2id uses truncation rather ; than round-to-nearest. INIT_MMX 3dnow cglobal float_to_fixed24, 3, 3, 0, dst, src, len movq m0, [pf_1_24] .loop: movq m1, [srcq ] movq m2, [srcq+8 ] movq m3, [srcq+16] movq m4, [srcq+24] pfmul m1, m0 pfmul m2, m0 pfmul m3, m0 pfmul m4, m0 pf2id m1, m1 pf2id m2, m2 pf2id m3, m3 pf2id m4, m4 movq [dstq ], m1 movq [dstq+8 ], m2 movq [dstq+16], m3 movq [dstq+24], m4 add srcq, 32 add dstq, 32 sub lend, 8 ja .loop femms RET INIT_XMM sse cglobal float_to_fixed24, 3, 3, 3, dst, src, len movaps m0, [pf_1_24] .loop: movaps m1, [srcq ] movaps m2, [srcq+16] mulps m1, m0 mulps m2, m0 cvtps2pi mm0, m1 movhlps m1, m1 cvtps2pi mm1, m1 cvtps2pi mm2, m2 movhlps m2, m2 cvtps2pi mm3, m2 movq [dstq ], mm0 movq [dstq+ 8], mm1 movq [dstq+16], mm2 movq [dstq+24], mm3 add srcq, 32 add dstq, 32 sub lend, 8 ja .loop emms RET INIT_XMM sse2 cglobal float_to_fixed24, 3, 3, 9, dst, src, len movaps m0, [pf_1_24] .loop: movaps m1, [srcq ] movaps m2, [srcq+16 ] movaps m3, [srcq+32 ] movaps m4, [srcq+48 ] %ifdef m8 movaps m5, [srcq+64 ] movaps m6, [srcq+80 ] movaps m7, [srcq+96 ] movaps m8, [srcq+112] %endif mulps m1, m0 mulps m2, m0 mulps m3, m0 mulps m4, m0 %ifdef m8 mulps m5, m0 mulps m6, m0 mulps m7, m0 mulps m8, m0 %endif cvtps2dq m1, m1 cvtps2dq m2, m2 cvtps2dq m3, m3 cvtps2dq m4, m4 %ifdef m8 cvtps2dq m5, m5 cvtps2dq m6, m6 cvtps2dq m7, m7 cvtps2dq m8, m8 %endif movdqa [dstq ], m1 movdqa [dstq+16 ], m2 movdqa [dstq+32 ], m3 movdqa [dstq+48 ], m4 %ifdef m8 movdqa [dstq+64 ], m5 movdqa [dstq+80 ], m6 movdqa [dstq+96 ], m7 movdqa [dstq+112], m8 add srcq, 128 add dstq, 128 sub lenq, 32 %else add srcq, 64 add dstq, 64 sub lenq, 16 %endif ja .loop REP_RET ;------------------------------------------------------------------------------ ; int ff_ac3_compute_mantissa_size(uint16_t mant_cnt[6][16]) ;------------------------------------------------------------------------------ %macro PHADDD4 2 ; xmm src, xmm tmp movhlps %2, %1 paddd %1, %2 pshufd %2, %1, 0x1 paddd %1, %2 %endmacro INIT_XMM sse2 cglobal ac3_compute_mantissa_size, 1, 2, 4, mant_cnt, sum movdqa m0, [mant_cntq ] movdqa m1, [mant_cntq+ 1*16] paddw m0, [mant_cntq+ 2*16] paddw m1, [mant_cntq+ 3*16] paddw m0, [mant_cntq+ 4*16] paddw m1, [mant_cntq+ 5*16] paddw m0, [mant_cntq+ 6*16] paddw m1, [mant_cntq+ 7*16] paddw m0, [mant_cntq+ 8*16] paddw m1, [mant_cntq+ 9*16] paddw m0, [mant_cntq+10*16] paddw m1, [mant_cntq+11*16] pmaddwd m0, [ac3_bap_bits ] pmaddwd m1, [ac3_bap_bits+16] paddd m0, m1 PHADDD4 m0, m1 movd sumd, m0 movdqa m3, [pw_bap_mul1] movhpd m0, [mant_cntq +2] movlpd m0, [mant_cntq+1*32+2] movhpd m1, [mant_cntq+2*32+2] movlpd m1, [mant_cntq+3*32+2] movhpd m2, [mant_cntq+4*32+2] movlpd m2, [mant_cntq+5*32+2] pmulhuw m0, m3 pmulhuw m1, m3 pmulhuw m2, m3 paddusw m0, m1 paddusw m0, m2 pmaddwd m0, [pw_bap_mul2] PHADDD4 m0, m1 movd eax, m0 add eax, sumd RET ;------------------------------------------------------------------------------ ; void ff_ac3_extract_exponents(uint8_t *exp, int32_t *coef, int nb_coefs) ;------------------------------------------------------------------------------ %macro PABSD 1-2 ; src/dst, unused %if cpuflag(ssse3) pabsd %1, %1 %else ; src/dst, tmp pxor %2, %2 pcmpgtd %2, %1 pxor %1, %2 psubd %1, %2 %endif %endmacro %macro AC3_EXTRACT_EXPONENTS 0 cglobal ac3_extract_exponents, 3, 3, 4, exp, coef, len add expq, lenq lea coefq, [coefq+4*lenq] neg lenq mova m2, [pd_1] mova m3, [pd_151] .loop: ; move 4 32-bit coefs to xmm0 mova m0, [coefq+4*lenq] ; absolute value PABSD m0, m1 ; convert to float and extract exponents pslld m0, 1 por m0, m2 cvtdq2ps m1, m0 psrld m1, 23 mova m0, m3 psubd m0, m1 ; move the lowest byte in each of 4 dwords to the low dword ; NOTE: We cannot just extract the low bytes with pshufb because the dword ; result for 16777215 is -1 due to float inaccuracy. Using packuswb ; clips this to 0, which is the correct exponent. packssdw m0, m0 packuswb m0, m0 movd [expq+lenq], m0 add lenq, 4 jl .loop REP_RET %endmacro %if HAVE_SSE2_EXTERNAL INIT_XMM sse2 AC3_EXTRACT_EXPONENTS %endif %if HAVE_SSSE3_EXTERNAL INIT_XMM ssse3 AC3_EXTRACT_EXPONENTS %endif
.size 8000 .text@50 jp ltimaint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: xor a, a ldff(0f), a ldff(ff), a ld a, fe ldff(05), a ldff(06), a ld a, 04 ldff(ff), a ld a, 04 ldff(07), a ei nop halt .text@1000 ltimaint: nop .text@11f3 ldff a, (0f) jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, 00 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles pop af ld b, a srl a srl a srl a srl a ld(9800), a ld a, b and a, 0f ld(9801), a ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f 00 00 08 08 22 22 41 41 7f 7f 41 41 41 41 41 41 00 00 7e 7e 41 41 41 41 7e 7e 41 41 41 41 7e 7e 00 00 3e 3e 41 41 40 40 40 40 40 40 41 41 3e 3e 00 00 7e 7e 41 41 41 41 41 41 41 41 41 41 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 40 40 40 40 7f 7f 40 40 40 40 40 40
; Copyright © 2021 by Brett Kuntz. All rights reserved. .686p .model flat, stdcall option casemap :none include gamedbg.inc include log.asm include output.asm include IDirect3DBaseTexture9.inc include IDirect3DCubeTexture9.inc include IDirect3DDevice9.inc include IDirect3DIndexBuffer9.inc include IDirect3DPixelShader9.inc include IDirect3DQuery9.inc include IDirect3DStateBlock9.inc include IDirect3DSurface9.inc include IDirect3DSwapChain9.inc include IDirect3DTexture9.inc include IDirect3DVertexBuffer9.inc include IDirect3DVertexDeclaration9.inc include IDirect3DVertexShader9.inc include IDirect3DVolumeTexture9.inc thread proto :dword masterhook proto HookVectorTableProc proto :dword, :dword, :dword HookVectorTable macro pAddr, pFunc, pHook invoke HookVectorTableProc, pAddr, addr pFunc, addr pHook endm .code ; ########################################################################## LibMain proc hint:dword, reason:dword, param:dword local device:dword local meminfo:MEMORY_BASIC_INFORMATION local pp[56]:byte local li:LARGE_INTEGER local cmd_line[512]:byte ; PRESERVE ESI .if reason == DLL_PROCESS_ATTACH ; Initialize Varibles or display, -1 lea edi, pp xor eax, eax mov ecx, (sizeof pp / 4) rep stosd or dword ptr [pp+24], 1 or dword ptr [pp+32], 1 ; Get Window Name & Handle invoke GetModuleFileName, hint, addr cmd_line, sizeof cmd_line lea edi, cmd_line or ecx, -1 add edi, eax push esi mov al, '\' std repnz scasb cld add edi, 2 mov esi, offset cfg_name mov ecx, sizeof cfg_name rep movsb pop esi invoke GetPrivateProfileString, addr appname, addr keyname, 0, addr wnd_name, sizeof wnd_name, addr cmd_line test eax, eax jz er invoke FindWindow, 0, addr wnd_name test eax, eax jnz sk invoke FindWindow, addr wnd_name, 0 test eax, eax jz er sk: mov hook_hwnd, eax ; Get CPU Frequency invoke QueryPerformanceFrequency, addr li mov eax, 1000 push eax fld1 fild qword ptr [li] fild dword ptr [esp] fdiv fdiv fstp tbyte ptr [cpu_freq] pop eax ; Get DLL Memory Ranges invoke loadlib test eax, eax jz er invoke getaddresses test eax, eax jz er invoke GetModuleHandle, addr d3dx9_29 add eax, 1000h mov ebx, eax mov d3dx_lower, eax invoke VirtualQuery, ebx, addr meminfo, sizeof MEMORY_BASIC_INFORMATION test eax, eax jz er add ebx, meminfo.RegionSize mov d3dx_upper, ebx invoke GetModuleHandle, addr dxprofilerdll add eax, 1000h mov ebx, eax mov dll_lower, eax invoke VirtualQuery, ebx, addr meminfo, sizeof MEMORY_BASIC_INFORMATION test eax, eax jz er add ebx, meminfo.RegionSize mov dll_upper, ebx invoke GetModuleHandle, addr d3d9dll test eax, eax jz er add eax, 1000h mov ebx, eax mov d3d9_lower, ebx invoke VirtualQuery, ebx, addr meminfo, sizeof MEMORY_BASIC_INFORMATION test eax, eax jz er mov ecx, ebx add ecx, meminfo.RegionSize mov d3d9_upper, ecx ; Hook D3D9 invoke VirtualProtect, ebx, meminfo.RegionSize, PAGE_READWRITE, addr device test eax, eax jz er sub ebx, 1000h invoke GetProcAddress, ebx, addr LDirect3DCreate9 test eax, eax jz er push 20h call eax test eax, eax jz er mov edi, eax lea ecx, device push ecx lea ecx, pp push ecx push 20h push hook_hwnd push 1 push 0 push edi mov eax, [edi] call dword ptr [eax+64] ; IDirect3D9->CreateDevice test eax, eax jnz er mov eax, device mov eax, [eax] add eax, 164 mov eax, [eax] mov ebx, eax add eax, 5 mov ecx, masterhook sub ecx, eax mov byte ptr [ebx], 0E8h ; Patch d3d9.dll mov dword ptr [ebx+1], ecx ; Patch d3d9.dll mov eax, device push eax mov eax, [eax] call dword ptr [eax+8] ; IDirect3DDevice9->Release test eax, eax jnz er push edi mov eax, [edi] call dword ptr [eax+8] ; IDirect3D9->Release test eax, eax jnz er ; Create Thread invoke CreateThread, 0, 0, addr thread, 0, 0, 0 test eax, eax jz er .endif mov eax, 1 ret er: invoke MessageBox, 0, addr errormsg, 0, MB_OK or MB_ICONEXCLAMATION or MB_SYSTEMMODAL xor eax, eax ret LibMain Endp ; ########################################################################## thread proc param:dword @@: invoke GetAsyncKeyState, VK_F1 .if eax == 0FFFF8001h not display .endif invoke GetAsyncKeyState, VK_F5 .if eax == 0FFFF8001h mov framedump, ONCREATEMODEL .endif invoke GetAsyncKeyState, VK_F6 .if eax == 0FFFF8001h mov framedump, ONCREATETEXTURE .endif invoke GetAsyncKeyState, VK_F7 .if eax == 0FFFF8001h mov framedump, ONCREATE .endif invoke GetAsyncKeyState, VK_F8 .if eax == 0FFFF8001h mov framedump, WAITING .endif invoke GetAsyncKeyState, VK_F9 .if eax == 0FFFF8001h invoke logheader mov tracedump, SET mov framedump, SET .endif invoke GetAsyncKeyState, VK_F10 .if eax == 0FFFF8001h and tracedump, UNSET and framedump, UNSET invoke logfooter .endif invoke Sleep, 0 jmp @B thread endp ; ########################################################################## OPTION PROLOGUE:NONE OPTION EPILOGUE:NONE HookVectorTableProc proc pAddr:dword, pFunc:dword, pHook:dword @@: mov eax, dword ptr [esp+4] mov eax, dword ptr [ecx+eax] cmp eax, dword ptr [esp+12] je mk cmp eax, dll_lower jb @F cmp eax, dll_upper jb mk @@: mov edx, dword ptr [esp+8] mov dword ptr [edx], eax mov edx, dword ptr [esp+4] mov eax, dword ptr [esp+12] mov dword ptr [ecx+edx], eax mk: ret 12 HookVectorTableProc endp OPTION PROLOGUE:PrologueDef OPTION EPILOGUE:EpilogueDef ; ########################################################################## masterhook proc pop eax push ebp mov ebp, esp push eax mov ecx, [ebp+8] mov ecx, [ecx] HookVectorTable QUERYINTERFACE, QueryInterface, QueryInterfaceHook HookVectorTable ADDREF, AddRef, AddRefHook HookVectorTable RELEASE, Release, ReleaseHook HookVectorTable TESTCOOPERATIVELEVEL, TestCooperativeLevel, TestCooperativeLevelHook HookVectorTable GETAVAILABLETEXTUREMEM, GetAvailableTextureMem, GetAvailableTextureMemHook HookVectorTable EVICTMANAGEDRESOURCES, EvictManagedResources, EvictManagedResourcesHook HookVectorTable GETDIRECT3D, GetDirect3D, GetDirect3DHook HookVectorTable GETDEVICECAPS, GetDeviceCaps, GetDeviceCapsHook HookVectorTable GETDISPLAYMODE, GetDisplayMode, GetDisplayModeHook HookVectorTable GETCREATIONPARAMETERS, GetCreationParameters, GetCreationParametersHook HookVectorTable SETCURSORPROPERTIES, SetCursorProperties, SetCursorPropertiesHook HookVectorTable SETCURSORPOSITION, SetCursorPosition, SetCursorPositionHook HookVectorTable SHOWCURSOR, xShowCursor, ShowCursorHook HookVectorTable CREATEADDITIONALSWAPCHAIN, CreateAdditionalSwapChain, CreateAdditionalSwapChainHook HookVectorTable GETSWAPCHAIN, GetSwapChain, GetSwapChainHook HookVectorTable GETNUMBEROFSWAPCHAINS, GetNumberOfSwapChains, GetNumberOfSwapChainsHook HookVectorTable RESET, Reset, ResetHook HookVectorTable PRESENT, Present, PresentHook HookVectorTable GETBACKBUFFER, GetBackBuffer, GetBackBufferHook HookVectorTable GETRASTERSTATUS, GetRasterStatus, GetRasterStatusHook HookVectorTable SETDIALOGBOXMODE, SetDialogBoxMode, SetDialogBoxModeHook HookVectorTable SETGAMMARAMP, SetGammaRamp, SetGammaRampHook HookVectorTable GETGAMMARAMP, GetGammaRamp, GetGammaRampHook HookVectorTable CREATETEXTURE, CreateTexture, CreateTextureHook HookVectorTable CREATEVOLUMETEXTURE, CreateVolumeTexture, CreateVolumeTextureHook HookVectorTable CREATECUBETEXTURE, CreateCubeTexture, CreateCubeTextureHook HookVectorTable CREATEVERTEXBUFFER, CreateVertexBuffer, CreateVertexBufferHook HookVectorTable CREATEINDEXBUFFER, CreateIndexBuffer, CreateIndexBufferHook HookVectorTable CREATERENDERTARGET, CreateRenderTarget, CreateRenderTargetHook HookVectorTable CREATEDEPTHSTENCILSURFACE, CreateDepthStencilSurface, CreateDepthStencilSurfaceHook HookVectorTable UPDATESURFACE, UpdateSurface, UpdateSurfaceHook HookVectorTable UPDATETEXTURE, UpdateTexture, UpdateTextureHook HookVectorTable GETRENDERTARGERDATA, GetRenderTargetData, GetRenderTargetDataHook HookVectorTable GETFRONTBUFFERDATA, GetFrontBufferData, GetFrontBufferDataHook HookVectorTable STRETCHRECT, StretchRect, StretchRectHook HookVectorTable COLORFILL, ColorFill, ColorFillHook HookVectorTable CREATEOFFSCREENPLAINSURFACE, CreateOffscreenPlainSurface, CreateOffscreenPlainSurfaceHook HookVectorTable SETRENDERTARGET, SetRenderTarget, SetRenderTargetHook HookVectorTable GETRENDERTARGET, GetRenderTarget, GetRenderTargetHook HookVectorTable SETDEPTHSTENCILSURFACE, SetDepthStencilSurface, SetDepthStencilSurfaceHook HookVectorTable GETDEPTHSTENCILSURFACE, GetDepthStencilSurface, GetDepthStencilSurfaceHook HookVectorTable BEGINSCENE, BeginScene, BeginSceneHook HookVectorTable ENDSCENE, EndScene, EndSceneHook HookVectorTable CLEAR, Clear, ClearHook HookVectorTable SETTRANSFORM, SetTransform, SetTransformHook HookVectorTable GETTRANSFORM, GetTransform, GetTransformHook HookVectorTable MULTIPLYTRANSFORM, MultiplyTransform, MultiplyTransformHook HookVectorTable SETVIEWPORT, SetViewport, SetViewportHook HookVectorTable GETVIEWPORT, GetViewport, GetViewportHook HookVectorTable SETMATERIAL, SetMaterial, SetMaterialHook HookVectorTable GETMATERIAL, GetMaterial, GetMaterialHook HookVectorTable SETLIGHT, SetLight, SetLightHook HookVectorTable GETLIGHT, GetLight, GetLightHook HookVectorTable LIGHTENABLE, LightEnable, LightEnableHook HookVectorTable GETLIGHTENABLE, GetLightEnable, GetLightEnableHook HookVectorTable SETCLIPPLANE, SetClipPlane, SetClipPlaneHook HookVectorTable GETCLIPPLANE, GetClipPlane, GetClipPlaneHook HookVectorTable SETRENDERSTATE, SetRenderState, SetRenderStateHook HookVectorTable GETRENDERSTATE, GetRenderState, GetRenderStateHook HookVectorTable CREATESTATEBLOCK, CreateStateBlock, CreateStateBlockHook HookVectorTable BEGINSTATEBLOCK, BeginStateBlock, BeginStateBlockHook HookVectorTable ENDSTATEBLOCK, EndStateBlock, EndStateBlockHook HookVectorTable SETCLIPSTATUS, SetClipStatus, SetClipStatusHook HookVectorTable GETCLIPSTATUS, GetClipStatus, GetClipStatusHook HookVectorTable GETTEXTURE, GetTexture, GetTextureHook HookVectorTable SETTEXTURE, SetTexture, SetTextureHook HookVectorTable GETTEXTURESTAGESTATE, GetTextureStageState, GetTextureStageStateHook HookVectorTable SETTEXTURESTAGESTATE, SetTextureStageState, SetTextureStageStateHook HookVectorTable GETSAMPLERSTATE, GetSamplerState, GetSamplerStateHook HookVectorTable SETSAMPLERSTATE, SetSamplerState, SetSamplerStateHook HookVectorTable VALIDATEDEVICE, ValidateDevice, ValidateDeviceHook HookVectorTable SETPALETTEENTRIES, SetPaletteEntries, SetPaletteEntriesHook HookVectorTable GETPALETTEENTRIES, GetPaletteEntries, GetPaletteEntriesHook HookVectorTable SETCURRENTTEXTUREPALETTE, SetCurrentTexturePalette, SetCurrentTexturePaletteHook HookVectorTable GETCURRENTTEXTUREPALETTE, GetCurrentTexturePalette, GetCurrentTexturePaletteHook HookVectorTable SETSCISSORRECT, SetScissorRect, SetScissorRectHook HookVectorTable GETSCISSORRECT, GetScissorRect, GetScissorRectHook HookVectorTable SETSOFTWAREVERTEXPROCESSING, SetSoftwareVertexProcessing, SetSoftwareVertexProcessingHook HookVectorTable GETSOFTWAREVERTEXPROCESSING, GetSoftwareVertexProcessing, GetSoftwareVertexProcessingHook HookVectorTable SETNPATCHMODE, SetNPatchMode, SetNPatchModeHook HookVectorTable GETNPATCHMODE, GetNPatchMode, GetNPatchModeHook HookVectorTable DRAWPRIMITIVE, DrawPrimitive, DrawPrimitiveHook HookVectorTable DRAWINDEXEDPRIMITIVE, DrawIndexedPrimitive, DrawIndexedPrimitiveHook HookVectorTable DRAWPRIMITIVEUP, DrawPrimitiveUP, DrawPrimitiveUPHook HookVectorTable DRAWINDEXEDPRIMITIVEUP, DrawIndexedPrimitiveUP, DrawIndexedPrimitiveUPHook HookVectorTable PROCESSVERTICES, ProcessVertices, ProcessVerticesHook HookVectorTable CREATEVERTEXDECLARATION, CreateVertexDeclaration, CreateVertexDeclarationHook HookVectorTable SETVERTEXDECLARATION, SetVertexDeclaration, SetVertexDeclarationHook HookVectorTable GETVERTEXDECLARATION, GetVertexDeclaration, GetVertexDeclarationHook HookVectorTable SETFVF, SetFVF, SetFVFHook HookVectorTable GETFVF, GetFVF, GetFVFHook HookVectorTable CREATEVERTEXSHADER, CreateVertexShader, CreateVertexShaderHook HookVectorTable SETVERTEXSHADER, SetVertexShader, SetVertexShaderHook HookVectorTable GETVERTEXSHADER, GetVertexShader, GetVertexShaderHook HookVectorTable SETVERTEXSHADERCONSTANTF, SetVertexShaderConstantF, SetVertexShaderConstantFHook HookVectorTable GETVERTEXSHADERCONSTANTF, GetVertexShaderConstantF, GetVertexShaderConstantFHook HookVectorTable SETVERTEXSHADERCONSTANTI, SetVertexShaderConstantI, SetVertexShaderConstantIHook HookVectorTable GETVERTEXSHADERCONSTANTI, GetVertexShaderConstantI, GetVertexShaderConstantIHook HookVectorTable SETVERTEXSHADERCONSTANTB, SetVertexShaderConstantB, SetVertexShaderConstantBHook HookVectorTable GETVERTEXSHADERCONSTANTB, GetVertexShaderConstantB, GetVertexShaderConstantBHook HookVectorTable SETSTREAMSOURCE, SetStreamSource, SetStreamSourceHook HookVectorTable GETSTREAMSOURCE, GetStreamSource, GetStreamSourceHook HookVectorTable SETSTREAMSOURCEFREQ, SetStreamSourceFreq, SetStreamSourceFreqHook HookVectorTable GETSTREAMSOURCEFREQ, GetStreamSourceFreq, GetStreamSourceFreqHook HookVectorTable SETINDICES, SetIndices, SetIndicesHook HookVectorTable GETINDICES, GetIndices, GetIndicesHook HookVectorTable CREATEPIXELSHADER, CreatePixelShader, CreatePixelShaderHook HookVectorTable SETPIXELSHADER, SetPixelShader, SetPixelShaderHook HookVectorTable GETPIXELSHADER, GetPixelShader, GetPixelShaderHook HookVectorTable SETPIXELSHADERCONSTANTF, SetPixelShaderConstantF, SetPixelShaderConstantFHook HookVectorTable GETPIXELSHADERCONSTANTF, GetPixelShaderConstantF, GetPixelShaderConstantFHook HookVectorTable SETPIXELSHADERCONSTANTI, SetPixelShaderConstantI, SetPixelShaderConstantIHook HookVectorTable GETPIXELSHADERCONSTANTI, GetPixelShaderConstantI, GetPixelShaderConstantIHook HookVectorTable SETPIXELSHADERCONSTANTB, SetPixelShaderConstantB, SetPixelShaderConstantBHook HookVectorTable GETPIXELSHADERCONSTANTB, GetPixelShaderConstantB, GetPixelShaderConstantBHook HookVectorTable DRAWRECTPATCH, DrawRectPatch, DrawRectPatchHook HookVectorTable DRAWTRIPATCH, DrawTriPatch, DrawTriPatchHook HookVectorTable DELETEPATCH, DeletePatch, DeletePatchHook HookVectorTable CREATEQUERY, CreateQuery, CreateQueryHook ret masterhook endp ; ########################################################################## PresentHook proc pThis:dword, pSourceRect:dword, pDestRect:dword, hDestWindowOverride:dword, pDirtyRegion:dword invoke d3dx_init, pThis invoke custom_output, pThis invoke Present, pThis, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion .if framedump == WAITING invoke logheader mov framedump, SET .elseif framedump == SET invoke log, 5, offset LPresent, dword ptr [ebp+4], eax, pThis, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion invoke logframetime .if tracedump == UNSET invoke logfooter mov framedump, UNSET .endif .endif ret PresentHook endp ; ########################################################################## BeginSceneHook proc pThis:dword invoke BeginScene, pThis .if framedump == SET invoke log, 1, offset LBeginScene, dword ptr [ebp+4], eax, pThis .endif ret BeginSceneHook endp ; ########################################################################## EndSceneHook proc pThis:dword invoke EndScene, pThis .if framedump == SET invoke log, 1, offset LEndScene, dword ptr [ebp+4], eax, pThis .endif ret EndSceneHook endp ; ########################################################################## SetCursorPositionHook proc pThis:dword, X:dword, Y:dword, Flags:dword invoke SetCursorPosition, pThis, X, Y, Flags .if framedump == SET invoke log, 4, offset LSetCursorPosition, dword ptr [ebp+4], eax, pThis, X, Y, Flags .endif ret SetCursorPositionHook endp ; ########################################################################## SetCursorPropertiesHook proc pThis:dword, XHotSpot:dword, YHotSpot:dword, pCursorBitmap:dword .if pCursorBitmap != 0 mov ecx, pCursorBitmap mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke SetCursorProperties, pThis, XHotSpot, YHotSpot, pCursorBitmap .if framedump == SET invoke log, 4, offset LSetCursorProperties, dword ptr [ebp+4], eax, pThis, XHotSpot, YHotSpot, pCursorBitmap .endif ret SetCursorPropertiesHook endp ; ########################################################################## SetTextureHook proc pThis:dword, Stage:dword, pTexture:dword .if pTexture != 0 mov ecx, pTexture mov ecx, [ecx] HookVectorTable btQUERYINTERFACE, btQueryInterface, btQueryInterfaceHook HookVectorTable btADDREF, btAddRef, btAddRefHook HookVectorTable btRELEASE, btRelease, btReleaseHook HookVectorTable btGETDEVICE, btGetDevice, btGetDeviceHook HookVectorTable btSETPRIVATEDATA, btSetPrivateData, btSetPrivateDataHook HookVectorTable btGETPRIVATEDATA, btGetPrivateData, btGetPrivateDataHook HookVectorTable btFREEPRIVATEDATA, btFreePrivateData, btFreePrivateDataHook HookVectorTable btSETPRIORITY, btSetPriority, btSetPriorityHook HookVectorTable btGETPRIORITY, btGetPriority, btGetPriorityHook HookVectorTable btPRELOAD, btPreLoad, btPreLoadHook HookVectorTable btGETTYPE, btGetType, btGetTypeHook HookVectorTable btSETLOD, btSetLOD, btSetLODHook HookVectorTable btGETLOD, btGetLOD, btGetLODHook HookVectorTable btGETLEVELCOUNT, btGetLevelCount, btGetLevelCountHook HookVectorTable btSETAUTOGENFILTERTYPE, btSetAutoGenFilterType, btSetAutoGenFilterTypeHook HookVectorTable btGETAUTOGENFILTERTYPE, btGetAutoGenFilterType, btGetAutoGenFilterTypeHook HookVectorTable btGENERATEMIPSUBLEVELS, btGenerateMipSubLevels, btGenerateMipSubLevelsHook .endif invoke SetTexture, pThis, Stage, pTexture .if framedump == SET invoke log, 3, offset LSetTexture, dword ptr [ebp+4], eax, pThis, Stage, pTexture .endif ret SetTextureHook endp ; ########################################################################## SetStreamSourceHook proc pThis:dword, StreamNumber:dword, pStreamData:dword, OffsetInBytes:dword, Stride:dword .if pStreamData != 0 mov ecx, pStreamData mov ecx, [ecx] HookVectorTable vlQUERYINTERFACE, vlQueryInterface, vlQueryInterfaceHook HookVectorTable vlADDREF, vlAddRef, vlAddRefHook HookVectorTable vlRELEASE, vlRelease, vlReleaseHook HookVectorTable vlGETDEVICE, vlGetDevice, vlGetDeviceHook HookVectorTable vlSETPRIVATEDATA, vlSetPrivateData, vlSetPrivateDataHook HookVectorTable vlGETPRIVATEDATA, vlGetPrivateData, vlGetPrivateDataHook HookVectorTable vlFREEPRIVATEDATA, vlFreePrivateData, vlFreePrivateDataHook HookVectorTable vlSETPRIORITY, vlSetPriority, vlSetPriorityHook HookVectorTable vlGETPRIORITY, vlGetPriority, vlGetPriorityHook HookVectorTable vlPRELOAD, vlPreLoad, vlPreLoadHook HookVectorTable vlGETTYPE, vlGetType, vlGetTypeHook HookVectorTable vlLOCK, vlLock, vlLockHook HookVectorTable vlUNLOCK, vlUnlock, vlUnlockHook HookVectorTable vlGETDESC, vlGetDesc, vlGetDescHook .endif invoke SetStreamSource, pThis, StreamNumber, pStreamData, OffsetInBytes, Stride .if framedump == SET invoke log, 5, offset LSetStreamSource, dword ptr [ebp+4], eax, pThis, StreamNumber, pStreamData, OffsetInBytes, Stride .endif ret SetStreamSourceHook endp ; ########################################################################## QueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke QueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset LQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret QueryInterfaceHook endp ; ########################################################################## AddRefHook proc pThis:dword invoke AddRef, pThis .if framedump == SET invoke log, 1, offset LAddRef, dword ptr [ebp+4], eax, pThis .endif ret AddRefHook endp ; ########################################################################## ReleaseHook proc pThis:dword invoke Release, pThis .if framedump == SET invoke log, 1, offset LRelease, dword ptr [ebp+4], eax, pThis .endif ret ReleaseHook endp ; ########################################################################## TestCooperativeLevelHook proc pThis:dword invoke TestCooperativeLevel, pThis .if framedump == SET invoke log, 1, offset LTestCooperativeLevel, dword ptr [ebp+4], eax, pThis .endif ret TestCooperativeLevelHook endp ; ########################################################################## GetAvailableTextureMemHook proc pThis:dword invoke GetAvailableTextureMem, pThis .if framedump == SET invoke log, 1, offset LGetAvailableTextureMem, dword ptr [ebp+4], eax, pThis .endif ret GetAvailableTextureMemHook endp ; ########################################################################## EvictManagedResourcesHook proc pThis:dword invoke EvictManagedResources, pThis .if framedump == SET invoke log, 1, offset LEvictManagedResources, dword ptr [ebp+4], eax, pThis .endif ret EvictManagedResourcesHook endp ; ########################################################################## GetDirect3DHook proc pThis:dword, ppD3D9:dword invoke GetDirect3D, pThis, ppD3D9 .if framedump == SET invoke log, 2, offset LGetDirect3D, dword ptr [ebp+4], eax, pThis, ppD3D9 .endif ret GetDirect3DHook endp ; ########################################################################## GetDeviceCapsHook proc pThis:dword, pCaps:dword invoke GetDeviceCaps, pThis, pCaps .if framedump == SET invoke log, 2, offset LGetDeviceCaps, dword ptr [ebp+4], eax, pThis, pCaps .endif ret GetDeviceCapsHook endp ; ########################################################################## GetDisplayModeHook proc pThis:dword, iSwapChain:dword, pMode:dword invoke GetDisplayMode, pThis, iSwapChain, pMode .if framedump == SET invoke log, 3, offset LGetDisplayMode, dword ptr [ebp+4], eax, pThis, iSwapChain, pMode .endif ret GetDisplayModeHook endp ; ########################################################################## GetCreationParametersHook proc pThis:dword, pParameters:dword invoke GetCreationParameters, pThis, pParameters .if framedump == SET invoke log, 2, offset LGetCreationParameters, dword ptr [ebp+4], eax, pThis, pParameters .endif ret GetCreationParametersHook endp ; ########################################################################## ShowCursorHook proc pThis:dword, bShow:dword invoke xShowCursor, pThis, bShow .if framedump == SET invoke log, 2, offset LShowCursor, dword ptr [ebp+4], eax, pThis, bShow .endif ret ShowCursorHook endp ; ########################################################################## CreateAdditionalSwapChainHook proc pThis:dword, pPresentationParameters:dword, pSwapChain:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateAdditionalSwapChain, pThis, pPresentationParameters, pSwapChain push eax mov ecx, pSwapChain mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable scQUERYINTERFACE, scQueryInterface, scQueryInterfaceHook HookVectorTable scADDREF, scAddRef, scAddRefHook HookVectorTable scRELEASE, scRelease, scReleaseHook HookVectorTable scPRESENT, scPresent, scPresentHook HookVectorTable scGETFRONTBUFFERDATA, scGetFrontBufferData, scGetFrontBufferDataHook HookVectorTable scGETBACKBUFFER, scGetBackBuffer, scGetBackBufferHook HookVectorTable scGETRASTERSTATUS, scGetRasterStatus, scGetRasterStatusHook HookVectorTable scGETDISPLAYMODE, scGetDisplayMode, scGetDisplayModeHook HookVectorTable scGETDEVICE, scGetDevice, scGetDeviceHook HookVectorTable scGETPRESENTPARAMETERS, scGetPresentParameters, scGetPresentParametersHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreateAdditionalSwapChain, dword ptr [ebp+4], eax, pThis, pPresentationParameters, pSwapChain .endif ret CreateAdditionalSwapChainHook endp ; ########################################################################## GetSwapChainHook proc pThis:dword, iSwapChain:dword, pSwapChain:dword invoke GetSwapChain, pThis, iSwapChain, pSwapChain push eax mov ecx, pSwapChain mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable scQUERYINTERFACE, scQueryInterface, scQueryInterfaceHook HookVectorTable scADDREF, scAddRef, scAddRefHook HookVectorTable scRELEASE, scRelease, scReleaseHook HookVectorTable scPRESENT, scPresent, scPresentHook HookVectorTable scGETFRONTBUFFERDATA, scGetFrontBufferData, scGetFrontBufferDataHook HookVectorTable scGETBACKBUFFER, scGetBackBuffer, scGetBackBufferHook HookVectorTable scGETRASTERSTATUS, scGetRasterStatus, scGetRasterStatusHook HookVectorTable scGETDISPLAYMODE, scGetDisplayMode, scGetDisplayModeHook HookVectorTable scGETDEVICE, scGetDevice, scGetDeviceHook HookVectorTable scGETPRESENTPARAMETERS, scGetPresentParameters, scGetPresentParametersHook .endif pop eax .if framedump == SET invoke log, 3, offset LGetSwapChain, dword ptr [ebp+4], eax, pThis, iSwapChain, pSwapChain .endif ret GetSwapChainHook endp ; ########################################################################## GetNumberOfSwapChainsHook proc pThis:dword invoke GetNumberOfSwapChains, pThis .if framedump == SET invoke log, 1, offset LGetNumberOfSwapChains, dword ptr [ebp+4], eax, pThis .endif ret GetNumberOfSwapChainsHook endp ; ########################################################################## ResetHook proc pThis:dword, pPresentationParameters:dword invoke d3dx_uninit invoke Reset, pThis, pPresentationParameters .if framedump == SET invoke log, 2, offset LReset, dword ptr [ebp+4], eax, pThis, pPresentationParameters .endif ret ResetHook endp ; ########################################################################## GetBackBufferHook proc pThis:dword, iSwapChain:dword, iBackBuffer:dword, pType:dword, ppBackBuffer:dword invoke GetBackBuffer, pThis, iSwapChain, iBackBuffer, pType, ppBackBuffer push eax mov ecx, ppBackBuffer mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 5, offset LGetBackBuffer, dword ptr [ebp+4], eax, pThis, iSwapChain, iBackBuffer, pType, ppBackBuffer .endif ret GetBackBufferHook endp ; ########################################################################## GetRasterStatusHook proc pThis:dword, iSwapChain:dword, pRasterStatus:dword invoke GetRasterStatus, pThis, iSwapChain, pRasterStatus .if framedump == SET invoke log, 3, offset LGetRasterStatus, dword ptr [ebp+4], eax, pThis, iSwapChain, pRasterStatus .endif ret GetRasterStatusHook endp ; ########################################################################## SetDialogBoxModeHook proc pThis:dword, bEnableDialogs:dword invoke SetDialogBoxMode, pThis, bEnableDialogs .if framedump == SET invoke log, 2, offset LSetDialogBoxMode, dword ptr [ebp+4], eax, pThis, bEnableDialogs .endif ret SetDialogBoxModeHook endp ; ########################################################################## SetGammaRampHook proc pThis:dword, iSwapChain:dword, Flags:dword, pRamp:dword invoke SetGammaRamp, pThis, iSwapChain, Flags, pRamp .if framedump == SET invoke log, 4, offset LSetGammaRamp, dword ptr [ebp+4], eax, pThis, iSwapChain, Flags, pRamp .endif ret SetGammaRampHook endp ; ########################################################################## GetGammaRampHook proc pThis:dword, iSwapChain:dword, pRamp:dword invoke GetGammaRamp, pThis, iSwapChain, pRamp .if framedump == SET invoke log, 3, offset LGetGammaRamp, dword ptr [ebp+4], eax, pThis, iSwapChain, pRamp .endif ret GetGammaRampHook endp ; ########################################################################## CreateTextureHook proc pThis:dword, pWidth:dword, Height:dword, Levels:dword, Usage:dword, Format:dword, Pool:dword, ppTexture:dword, pSharedHandle:dword .if framedump == ONCREATE || framedump == ONCREATETEXTURE mov framedump, SET invoke logheader .endif invoke CreateTexture, pThis, pWidth, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle push eax mov ecx, ppTexture mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable ttQUERYINTERFACE, ttQueryInterface, ttQueryInterfaceHook HookVectorTable ttADDREF, ttAddRef, ttAddRefHook HookVectorTable ttRELEASE, ttRelease, ttReleaseHook HookVectorTable ttGETDEVICE, ttGetDevice, ttGetDeviceHook HookVectorTable ttSETPRIVATEDATA, ttSetPrivateData, ttSetPrivateDataHook HookVectorTable ttGETPRIVATEDATA, ttGetPrivateData, ttGetPrivateDataHook HookVectorTable ttFREEPRIVATEDATA, ttFreePrivateData, ttFreePrivateDataHook HookVectorTable ttSETPRIORITY, ttSetPriority, ttSetPriorityHook HookVectorTable ttGETPRIORITY, ttGetPriority, ttGetPriorityHook HookVectorTable ttPRELOAD, ttPreLoad, ttPreLoadHook HookVectorTable ttGETTYPE, ttGetType, ttGetTypeHook HookVectorTable ttSETLOD, ttSetLOD, ttSetLODHook HookVectorTable ttGETLOD, ttGetLOD, ttGetLODHook HookVectorTable ttGETLEVELCOUNT, ttGetLevelCount, ttGetLevelCountHook HookVectorTable ttSETAUTOGENFILTERTYPE, ttSetAutoGenFilterType, ttSetAutoGenFilterTypeHook HookVectorTable ttGETAUTOGENFILTERTYPE, ttGetAutoGenFilterType, ttGetAutoGenFilterTypeHook HookVectorTable ttGENERATEMIPSUBLEVELS, ttGenerateMipSubLevels, ttGenerateMipSubLevelsHook HookVectorTable ttGETLEVELDESC, ttGetLevelDesc, ttGetLevelDescHook HookVectorTable ttGETSURFACELEVEL, ttGetSurfaceLevel, ttGetSurfaceLevelHook HookVectorTable ttLOCKRECT, ttLockRect, ttLockRectHook HookVectorTable ttUNLOCKRECT, ttUnlockRect, ttUnlockRectHook HookVectorTable ttADDDIRTYRECT, ttAddDirtyRect, ttAddDirtyRectHook .endif pop eax .if framedump == SET invoke log, 9, offset LCreateTexture, dword ptr [ebp+4], eax, pThis, pWidth, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle .endif ret CreateTextureHook endp ; ########################################################################## CreateVolumeTextureHook proc pThis:dword, pWidth:dword, Height:dword, Depth:dword, Levels:dword, Usage:dword, Format:dword, Pool:dword, ppVolumeTexture:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateVolumeTexture, pThis, pWidth, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle push eax mov ecx, ppVolumeTexture mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vaQUERYINTERFACE, vaQueryInterface, vaQueryInterfaceHook HookVectorTable vaADDREF, vaAddRef, vaAddRefHook HookVectorTable vaRELEASE, vaRelease, vaReleaseHook HookVectorTable vaGETDEVICE, vaGetDevice, vaGetDeviceHook HookVectorTable vaSETPRIVATEDATA, vaSetPrivateData, vaSetPrivateDataHook HookVectorTable vaGETPRIVATEDATA, vaGetPrivateData, vaGetPrivateDataHook HookVectorTable vaFREEPRIVATEDATA, vaFreePrivateData, vaFreePrivateDataHook HookVectorTable vaSETPRIORITY, vaSetPriority, vaSetPriorityHook HookVectorTable vaGETPRIORITY, vaGetPriority, vaGetPriorityHook HookVectorTable vaPRELOAD, vaPreLoad, vaPreLoadHook HookVectorTable vaGETTYPE, vaGetType, vaGetTypeHook HookVectorTable vaSETLOD, vaSetLOD, vaSetLODHook HookVectorTable vaGETLOD, vaGetLOD, vaGetLODHook HookVectorTable vaGETLEVELCOUNT, vaGetLevelCount, vaGetLevelCountHook HookVectorTable vaSETAUTOGENFILTERTYPE, vaSetAutoGenFilterType, vaSetAutoGenFilterTypeHook HookVectorTable vaGETAUTOGENFILTERTYPE, vaGetAutoGenFilterType, vaGetAutoGenFilterTypeHook HookVectorTable vaGENERATEMIPSUBLEVELS, vaGenerateMipSubLevels, vaGenerateMipSubLevelsHook HookVectorTable vaGETLEVELDESC, vaGetLevelDesc, vaGetLevelDescHook HookVectorTable vaGETVOLUMELEVEL, vaGetVolumeLevel, vaGetVolumeLevelHook HookVectorTable vaLOCKBOX, vaLockBox, vaLockBoxHook HookVectorTable vaUNLOCKBOX, vaUnlockBox, vaUnlockBoxHook HookVectorTable vaADDDIRTYBOX, vaAddDirtyBox, vaAddDirtyBoxHook .endif pop eax .if framedump == SET invoke log, 10, offset LCreateVolumeTexture, dword ptr [ebp+4], eax, pThis, pWidth, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle .endif ret CreateVolumeTextureHook endp ; ########################################################################## CreateCubeTextureHook proc pThis:dword, EdgeLength:dword, Levels:dword, Usage:dword, Format:dword, Pool:dword, ppCubeTexture:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateCubeTexture, pThis, EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle push eax mov ecx, ppCubeTexture mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable cxQUERYINTERFACE, cxQueryInterface, cxQueryInterfaceHook HookVectorTable cxADDREF, cxAddRef, cxAddRefHook HookVectorTable cxRELEASE, cxRelease, cxReleaseHook HookVectorTable cxGETDEVICE, cxGetDevice, cxGetDeviceHook HookVectorTable cxSETPRIVATEDATA, cxSetPrivateData, cxSetPrivateDataHook HookVectorTable cxGETPRIVATEDATA, cxGetPrivateData, cxGetPrivateDataHook HookVectorTable cxFREEPRIVATEDATA, cxFreePrivateData, cxFreePrivateDataHook HookVectorTable cxSETPRIORITY, cxSetPriority, cxSetPriorityHook HookVectorTable cxGETPRIORITY, cxGetPriority, cxGetPriorityHook HookVectorTable cxPRELOAD, cxPreLoad, cxPreLoadHook HookVectorTable cxGETTYPE, cxGetType, cxGetTypeHook HookVectorTable cxSETLOD, cxSetLOD, cxSetLODHook HookVectorTable cxGETLOD, cxGetLOD, cxGetLODHook HookVectorTable cxGETLEVELCOUNT, cxGetLevelCount, cxGetLevelCountHook HookVectorTable cxSETAUTOGENFILTERTYPE, cxSetAutoGenFilterType, cxSetAutoGenFilterTypeHook HookVectorTable cxGETAUTOGENFILTERTYPE, cxGetAutoGenFilterType, cxGetAutoGenFilterTypeHook HookVectorTable cxGENERATEMIPSUBLEVELS, cxGenerateMipSubLevels, cxGenerateMipSubLevelsHook HookVectorTable cxGETLEVELDESC, cxGetLevelDesc, cxGetLevelDescHook HookVectorTable cxGETCUBEMAPSURFACE, cxGetCubeMapSurface, cxGetCubeMapSurfaceHook HookVectorTable cxLOCKRECT, cxLockRect, cxLockRectHook HookVectorTable cxUNLOCKRECT, cxUnlockRect, cxUnlockRectHook HookVectorTable cxADDDIRTYRECT, cxAddDirtyRect, cxAddDirtyRectHook .endif pop eax .if framedump == SET invoke log, 8, offset LCreateCubeTexture, dword ptr [ebp+4], eax, pThis, EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle .endif ret CreateCubeTextureHook endp ; ########################################################################## CreateVertexBufferHook proc pThis:dword, pLength:dword, Usage:dword, FVF:dword, Pool:dword, ppVertexBuffer:dword, pSharedHandle:dword .if framedump == ONCREATE || framedump == ONCREATEMODEL mov framedump, SET invoke logheader .endif invoke CreateVertexBuffer, pThis, pLength, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle push eax mov ecx, ppVertexBuffer mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vlQUERYINTERFACE, vlQueryInterface, vlQueryInterfaceHook HookVectorTable vlADDREF, vlAddRef, vlAddRefHook HookVectorTable vlRELEASE, vlRelease, vlReleaseHook HookVectorTable vlGETDEVICE, vlGetDevice, vlGetDeviceHook HookVectorTable vlSETPRIVATEDATA, vlSetPrivateData, vlSetPrivateDataHook HookVectorTable vlGETPRIVATEDATA, vlGetPrivateData, vlGetPrivateDataHook HookVectorTable vlFREEPRIVATEDATA, vlFreePrivateData, vlFreePrivateDataHook HookVectorTable vlSETPRIORITY, vlSetPriority, vlSetPriorityHook HookVectorTable vlGETPRIORITY, vlGetPriority, vlGetPriorityHook HookVectorTable vlPRELOAD, vlPreLoad, vlPreLoadHook HookVectorTable vlGETTYPE, vlGetType, vlGetTypeHook HookVectorTable vlLOCK, vlLock, vlLockHook HookVectorTable vlUNLOCK, vlUnlock, vlUnlockHook HookVectorTable vlGETDESC, vlGetDesc, vlGetDescHook .endif pop eax .if framedump == SET invoke log, 7, offset LCreateVertexBuffer, dword ptr [ebp+4], eax, pThis, pLength, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle .endif ret CreateVertexBufferHook endp ; ########################################################################## CreateIndexBufferHook proc pThis:dword, pLength:dword, Usage:dword, Format:dword, Pool:dword, ppIndexBuffer:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateIndexBuffer, pThis, pLength, Usage, Format, Pool, ppIndexBuffer, pSharedHandle push eax mov ecx, ppIndexBuffer mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable ibQUERYINTERFACE, ibQueryInterface, ibQueryInterfaceHook HookVectorTable ibADDREF, ibAddRef, ibAddRefHook HookVectorTable ibRELEASE, ibRelease, ibReleaseHook HookVectorTable ibGETDEVICE, ibGetDevice, ibGetDeviceHook HookVectorTable ibSETPRIVATEDATA, ibSetPrivateData, ibSetPrivateDataHook HookVectorTable ibGETPRIVATEDATA, ibGetPrivateData, ibGetPrivateDataHook HookVectorTable ibFREEPRIVATEDATA, ibFreePrivateData, ibFreePrivateDataHook HookVectorTable ibSETPRIORITY, ibSetPriority, ibSetPriorityHook HookVectorTable ibGETPRIORITY, ibGetPriority, ibGetPriorityHook HookVectorTable ibPRELOAD, ibPreLoad, ibPreLoadHook HookVectorTable ibGETTYPE, ibGetType, ibGetTypeHook mov eax, dword ptr [ebp+4] .if eax < d3dx_lower || eax > d3dx_upper HookVectorTable ibLOCK, ibLock, ibLockHook .endif HookVectorTable ibUNLOCK, ibUnlock, ibUnlockHook HookVectorTable ibGETDESC, ibGetDesc, ibGetDescHook .endif pop eax .if framedump == SET invoke log, 7, offset LCreateIndexBuffer, dword ptr [ebp+4], eax, pThis, pLength, Usage, Format, Pool, ppIndexBuffer, pSharedHandle .endif ret CreateIndexBufferHook endp ; ########################################################################## CreateRenderTargetHook proc pThis:dword, pWidth:dword, Height:dword, Format:dword, MultiSample:dword, MultisampleQuality:dword, Lockable:dword, ppSurface:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateRenderTarget, pThis, pWidth, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle push eax mov ecx, ppSurface mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 9, offset LCreateRenderTarget, dword ptr [ebp+4], eax, pThis, pWidth, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle .endif ret CreateRenderTargetHook endp ; ########################################################################## CreateDepthStencilSurfaceHook proc pThis:dword, pWidth:dword, Height:dword, Format:dword, MultiSample:dword, MultisampleQuality:dword, Discard:dword, ppSurface:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateDepthStencilSurface, pThis, pWidth, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle push eax mov ecx, ppSurface mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 9, offset LCreateDepthStencilSurface, dword ptr [ebp+4], eax, pThis, pWidth, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle .endif ret CreateDepthStencilSurfaceHook endp ; ########################################################################## UpdateSurfaceHook proc pThis:dword, pSourceSurface:dword, pSourceRect:dword, pDestinationSurface:dword, pDestPoint:dword .if pSourceSurface != 0 mov ecx, pSourceSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif .if pDestinationSurface != 0 mov ecx, pDestinationSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke UpdateSurface, pThis, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint .if framedump == SET invoke log, 5, offset LUpdateSurface, dword ptr [ebp+4], eax, pThis, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint .endif ret UpdateSurfaceHook endp ; ########################################################################## UpdateTextureHook proc pThis:dword, pSourceTexture:dword, pDestinationTexture:dword .if pSourceTexture != 0 mov ecx, pSourceTexture mov ecx, [ecx] HookVectorTable btQUERYINTERFACE, btQueryInterface, btQueryInterfaceHook HookVectorTable btADDREF, btAddRef, btAddRefHook HookVectorTable btRELEASE, btRelease, btReleaseHook HookVectorTable btGETDEVICE, btGetDevice, btGetDeviceHook HookVectorTable btSETPRIVATEDATA, btSetPrivateData, btSetPrivateDataHook HookVectorTable btGETPRIVATEDATA, btGetPrivateData, btGetPrivateDataHook HookVectorTable btFREEPRIVATEDATA, btFreePrivateData, btFreePrivateDataHook HookVectorTable btSETPRIORITY, btSetPriority, btSetPriorityHook HookVectorTable btGETPRIORITY, btGetPriority, btGetPriorityHook HookVectorTable btPRELOAD, btPreLoad, btPreLoadHook HookVectorTable btGETTYPE, btGetType, btGetTypeHook HookVectorTable btSETLOD, btSetLOD, btSetLODHook HookVectorTable btGETLOD, btGetLOD, btGetLODHook HookVectorTable btGETLEVELCOUNT, btGetLevelCount, btGetLevelCountHook HookVectorTable btSETAUTOGENFILTERTYPE, btSetAutoGenFilterType, btSetAutoGenFilterTypeHook HookVectorTable btGETAUTOGENFILTERTYPE, btGetAutoGenFilterType, btGetAutoGenFilterTypeHook HookVectorTable btGENERATEMIPSUBLEVELS, btGenerateMipSubLevels, btGenerateMipSubLevelsHook .endif .if pDestinationTexture != 0 mov ecx, pDestinationTexture mov ecx, [ecx] HookVectorTable btQUERYINTERFACE, btQueryInterface, btQueryInterfaceHook HookVectorTable btADDREF, btAddRef, btAddRefHook HookVectorTable btRELEASE, btRelease, btReleaseHook HookVectorTable btGETDEVICE, btGetDevice, btGetDeviceHook HookVectorTable btSETPRIVATEDATA, btSetPrivateData, btSetPrivateDataHook HookVectorTable btGETPRIVATEDATA, btGetPrivateData, btGetPrivateDataHook HookVectorTable btFREEPRIVATEDATA, btFreePrivateData, btFreePrivateDataHook HookVectorTable btSETPRIORITY, btSetPriority, btSetPriorityHook HookVectorTable btGETPRIORITY, btGetPriority, btGetPriorityHook HookVectorTable btPRELOAD, btPreLoad, btPreLoadHook HookVectorTable btGETTYPE, btGetType, btGetTypeHook HookVectorTable btSETLOD, btSetLOD, btSetLODHook HookVectorTable btGETLOD, btGetLOD, btGetLODHook HookVectorTable btGETLEVELCOUNT, btGetLevelCount, btGetLevelCountHook HookVectorTable btSETAUTOGENFILTERTYPE, btSetAutoGenFilterType, btSetAutoGenFilterTypeHook HookVectorTable btGETAUTOGENFILTERTYPE, btGetAutoGenFilterType, btGetAutoGenFilterTypeHook HookVectorTable btGENERATEMIPSUBLEVELS, btGenerateMipSubLevels, btGenerateMipSubLevelsHook .endif invoke UpdateTexture, pThis, pSourceTexture, pDestinationTexture .if framedump == SET invoke log, 3, offset LUpdateTexture, dword ptr [ebp+4], eax, pThis, pSourceTexture, pDestinationTexture .endif ret UpdateTextureHook endp ; ########################################################################## GetRenderTargetDataHook proc pThis:dword, pRenderTarget:dword, pDestSurface:dword .if pRenderTarget != 0 mov ecx, pRenderTarget mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif .if pDestSurface != 0 mov ecx, pDestSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke GetRenderTargetData, pThis, pRenderTarget, pDestSurface .if framedump == SET invoke log, 3, offset LGetRenderTargetData, dword ptr [ebp+4], eax, pThis, pRenderTarget, pDestSurface .endif ret GetRenderTargetDataHook endp ; ########################################################################## GetFrontBufferDataHook proc pThis:dword, iSwapChain:dword, pDestSurface:dword .if pDestSurface != 0 mov ecx, pDestSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke GetFrontBufferData, pThis, iSwapChain, pDestSurface .if framedump == SET invoke log, 3, offset LGetFrontBufferData, dword ptr [ebp+4], eax, pThis, iSwapChain, pDestSurface .endif ret GetFrontBufferDataHook endp ; ########################################################################## StretchRectHook proc pThis:dword, pSourceSurface:dword, pSourceRect:dword, pDestSurface:dword, pDestRect:dword, Filter:dword .if pSourceSurface != 0 mov ecx, pSourceSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke StretchRect, pThis, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter .if framedump == SET invoke log, 6, offset LStretchRect, dword ptr [ebp+4], eax, pThis, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter .endif ret StretchRectHook endp ; ########################################################################## ColorFillHook proc pThis:dword, pSurface:dword, pRect:dword, color:dword .if pSurface != 0 mov ecx, pSurface mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke ColorFill, pThis, pSurface, pRect, color .if framedump == SET invoke log, 4, offset LColorFill, dword ptr [ebp+4], eax, pThis, pSurface, pRect, color .endif ret ColorFillHook endp ; ########################################################################## CreateOffscreenPlainSurfaceHook proc pThis:dword, pWidth:dword, Height:dword, Format:dword, Pool:dword, ppSurface:dword, pSharedHandle:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateOffscreenPlainSurface, pThis, pWidth, Height, Format, Pool, ppSurface, pSharedHandle push eax mov ecx, ppSurface mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 7, offset LCreateOffscreenPlainSurface, dword ptr [ebp+4], eax, pThis, pWidth, Height, Format, Pool, ppSurface, pSharedHandle .endif ret CreateOffscreenPlainSurfaceHook endp ; ########################################################################## SetRenderTargetHook proc pThis:dword, RenderTargetIndex:dword, pRenderTarget:dword invoke SetRenderTarget, pThis, RenderTargetIndex, pRenderTarget .if framedump == SET invoke log, 3, offset LSetRenderTarget, dword ptr [ebp+4], eax, pThis, RenderTargetIndex, pRenderTarget .endif ret SetRenderTargetHook endp ; ########################################################################## GetRenderTargetHook proc pThis:dword, RenderTargetIndex:dword, ppRenderTarget:dword invoke GetRenderTarget, pThis, RenderTargetIndex, ppRenderTarget push eax mov ecx, ppRenderTarget mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 3, offset LGetRenderTarget, dword ptr [ebp+4], eax, pThis, RenderTargetIndex, ppRenderTarget .endif ret GetRenderTargetHook endp ; ########################################################################## SetDepthStencilSurfaceHook proc pThis:dword, pNewZStencil:dword .if pNewZStencil != 0 mov ecx, pNewZStencil mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif invoke SetDepthStencilSurface, pThis, pNewZStencil .if framedump == SET invoke log, 2, offset LSetDepthStencilSurface, dword ptr [ebp+4], eax, pThis, pNewZStencil .endif ret SetDepthStencilSurfaceHook endp ; ########################################################################## GetDepthStencilSurfaceHook proc pThis:dword, ppZStencilSurface:dword invoke GetDepthStencilSurface, pThis, ppZStencilSurface push eax mov ecx, ppZStencilSurface mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable seQUERYINTERFACE, seQueryInterface, seQueryInterfaceHook HookVectorTable seADDREF, seAddRef, seAddRefHook HookVectorTable seRELEASE, seRelease, seReleaseHook HookVectorTable seGETDEVICE, seGetDevice, seGetDeviceHook HookVectorTable seSETPRIVATEDATA, seSetPrivateData, seSetPrivateDataHook HookVectorTable seGETPRIVATEDATA, seGetPrivateData, seGetPrivateDataHook HookVectorTable seFREEPRIVATEDATA, seFreePrivateData, seFreePrivateDataHook HookVectorTable seSETPRIORITY, seSetPriority, seSetPriorityHook HookVectorTable seGETPRIORITY, seGetPriority, seGetPriorityHook HookVectorTable sePRELOAD, sePreLoad, sePreLoadHook HookVectorTable seGETTYPE, seGetType, seGetTypeHook HookVectorTable seGETCONTAINER, seGetContainer, seGetContainerHook HookVectorTable seGETDESC, seGetDesc, seGetDescHook HookVectorTable seLOCKRECT, seLockRect, seLockRectHook HookVectorTable seUNLOCKRECT, seUnlockRect, seUnlockRectHook HookVectorTable seGETDC, seGetDC, seGetDCHook HookVectorTable seRELEASEDC, seReleaseDC, seReleaseDCHook .endif pop eax .if framedump == SET invoke log, 2, offset LGetDepthStencilSurface, dword ptr [ebp+4], eax, pThis, ppZStencilSurface .endif ret GetDepthStencilSurfaceHook endp ; ########################################################################## ClearHook proc pThis:dword, Count:dword, pRects:dword, Flags:dword, Color:dword, Z:dword, Stencil:dword invoke Clear, pThis, Count, pRects, Flags, Color, Z, Stencil .if framedump == SET invoke log, 7, offset LClear, dword ptr [ebp+4], eax, pThis, Count, pRects, Flags, Color, Z, Stencil .endif ret ClearHook endp ; ########################################################################## SetTransformHook proc pThis:dword, State:dword, pMatrix:dword invoke SetTransform, pThis, State, pMatrix .if framedump == SET invoke log, 3, offset LSetTransform, dword ptr [ebp+4], eax, pThis, State, pMatrix .endif ret SetTransformHook endp ; ########################################################################## GetTransformHook proc pThis:dword, State:dword, pMatrix:dword invoke GetTransform, pThis, State, pMatrix .if framedump == SET invoke log, 3, offset LGetTransform, dword ptr [ebp+4], eax, pThis, State, pMatrix .endif ret GetTransformHook endp ; ########################################################################## MultiplyTransformHook proc pThis:dword, State:dword, pMatrix:dword invoke MultiplyTransform, pThis, State, pMatrix .if framedump == SET invoke log, 3, offset LMultiplyTransform, dword ptr [ebp+4], eax, pThis, State, pMatrix .endif ret MultiplyTransformHook endp ; ########################################################################## SetViewportHook proc pThis:dword, pViewport:dword invoke SetViewport, pThis, pViewport .if framedump == SET invoke log, 2, offset LSetViewport, dword ptr [ebp+4], eax, pThis, pViewport .endif ret SetViewportHook endp ; ########################################################################## GetViewportHook proc pThis:dword, pViewport:dword invoke GetViewport, pThis, pViewport .if framedump == SET invoke log, 2, offset LGetViewport, dword ptr [ebp+4], eax, pThis, pViewport .endif ret GetViewportHook endp ; ########################################################################## SetMaterialHook proc pThis:dword, pMaterial:dword invoke SetMaterial, pThis, pMaterial .if framedump == SET invoke log, 2, offset LSetMaterial, dword ptr [ebp+4], eax, pThis, pMaterial .endif ret SetMaterialHook endp ; ########################################################################## GetMaterialHook proc pThis:dword, pMaterial:dword invoke GetMaterial, pThis, pMaterial .if framedump == SET invoke log, 2, offset LGetMaterial, dword ptr [ebp+4], eax, pThis, pMaterial .endif ret GetMaterialHook endp ; ########################################################################## SetLightHook proc pThis:dword, Index:dword, pLight:dword invoke SetLight, pThis, Index, pLight .if framedump == SET invoke log, 3, offset LSetLight, dword ptr [ebp+4], eax, pThis, Index, pLight .endif ret SetLightHook endp ; ########################################################################## GetLightHook proc pThis:dword, Index:dword, pLight:dword invoke GetLight, pThis, Index, pLight .if framedump == SET invoke log, 3, offset LGetLight, dword ptr [ebp+4], eax, pThis, Index, pLight .endif ret GetLightHook endp ; ########################################################################## LightEnableHook proc pThis:dword, Index:dword, Enable:dword invoke LightEnable, pThis, Index, Enable .if framedump == SET invoke log, 3, offset LLightEnable, dword ptr [ebp+4], eax, pThis, Index, Enable .endif ret LightEnableHook endp ; ########################################################################## GetLightEnableHook proc pThis:dword, Index:dword, pEnable:dword invoke GetLightEnable, pThis, Index, pEnable .if framedump == SET invoke log, 3, offset LGetLightEnable, dword ptr [ebp+4], eax, pThis, Index, pEnable .endif ret GetLightEnableHook endp ; ########################################################################## SetClipPlaneHook proc pThis:dword, Index:dword, pPlane:dword invoke SetClipPlane, pThis, Index, pPlane .if framedump == SET invoke log, 3, offset LSetClipPlane, dword ptr [ebp+4], eax, pThis, Index, pPlane .endif ret SetClipPlaneHook endp ; ########################################################################## GetClipPlaneHook proc pThis:dword, Index:dword, pPlane:dword invoke GetClipPlane, pThis, Index, pPlane .if framedump == SET invoke log, 3, offset LGetClipPlane, dword ptr [ebp+4], eax, pThis, Index, pPlane .endif ret GetClipPlaneHook endp ; ########################################################################## SetRenderStateHook proc pThis:dword, State:dword, Value:dword invoke SetRenderState, pThis, State, Value .if framedump == SET invoke log, 3, offset LSetRenderState, dword ptr [ebp+4], eax, pThis, State, Value .endif ret SetRenderStateHook endp ; ########################################################################## GetRenderStateHook proc pThis:dword, State:dword, pValue:dword invoke GetRenderState, pThis, State, pValue .if framedump == SET invoke log, 3, offset LGetRenderState, dword ptr [ebp+4], eax, pThis, State, pValue .endif ret GetRenderStateHook endp ; ########################################################################## CreateStateBlockHook proc pThis:dword, pType:dword, ppSB:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateStateBlock, pThis, pType, ppSB push eax mov ecx, ppSB mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable sbQUERYINTERFACE, sbQueryInterface, sbQueryInterfaceHook HookVectorTable sbADDREF, sbAddRef, sbAddRefHook HookVectorTable sbRELEASE, sbRelease, sbReleaseHook HookVectorTable sbGETDEVICE, sbGetDevice, sbGetDeviceHook HookVectorTable sbCAPTURE, sbCapture, sbCaptureHook HookVectorTable sbAPPLY, sbApply, sbApplyHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreateStateBlock, dword ptr [ebp+4], eax, pThis, pType, ppSB .endif ret CreateStateBlockHook endp ; ########################################################################## BeginStateBlockHook proc pThis:dword invoke BeginStateBlock, pThis .if framedump == SET invoke log, 1, offset LBeginStateBlock, dword ptr [ebp+4], eax, pThis .endif ret BeginStateBlockHook endp ; ########################################################################## EndStateBlockHook proc pThis:dword, ppSB:dword invoke EndStateBlock, pThis, ppSB push eax mov ecx, ppSB mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable sbQUERYINTERFACE, sbQueryInterface, sbQueryInterfaceHook HookVectorTable sbADDREF, sbAddRef, sbAddRefHook HookVectorTable sbRELEASE, sbRelease, sbReleaseHook HookVectorTable sbGETDEVICE, sbGetDevice, sbGetDeviceHook HookVectorTable sbCAPTURE, sbCapture, sbCaptureHook HookVectorTable sbAPPLY, sbApply, sbApplyHook .endif pop eax .if framedump == SET invoke log, 2, offset LEndStateBlock, dword ptr [ebp+4], eax, pThis, ppSB .endif ret EndStateBlockHook endp ; ########################################################################## SetClipStatusHook proc pThis:dword, pClipStatus:dword invoke SetClipStatus, pThis, pClipStatus .if framedump == SET invoke log, 2, offset LSetClipStatus, dword ptr [ebp+4], eax, pThis, pClipStatus .endif ret SetClipStatusHook endp ; ########################################################################## GetClipStatusHook proc pThis:dword, pClipStatus:dword invoke GetClipStatus, pThis, pClipStatus .if framedump == SET invoke log, 2, offset LGetClipStatus, dword ptr [ebp+4], eax, pThis, pClipStatus .endif ret GetClipStatusHook endp ; ########################################################################## GetTextureHook proc pThis:dword, Stage:dword, ppTexture:dword invoke GetTexture, pThis, Stage, ppTexture push eax mov ecx, ppTexture mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable btQUERYINTERFACE, btQueryInterface, btQueryInterfaceHook HookVectorTable btADDREF, btAddRef, btAddRefHook HookVectorTable btRELEASE, btRelease, btReleaseHook HookVectorTable btGETDEVICE, btGetDevice, btGetDeviceHook HookVectorTable btSETPRIVATEDATA, btSetPrivateData, btSetPrivateDataHook HookVectorTable btGETPRIVATEDATA, btGetPrivateData, btGetPrivateDataHook HookVectorTable btFREEPRIVATEDATA, btFreePrivateData, btFreePrivateDataHook HookVectorTable btSETPRIORITY, btSetPriority, btSetPriorityHook HookVectorTable btGETPRIORITY, btGetPriority, btGetPriorityHook HookVectorTable btPRELOAD, btPreLoad, btPreLoadHook HookVectorTable btGETTYPE, btGetType, btGetTypeHook HookVectorTable btSETLOD, btSetLOD, btSetLODHook HookVectorTable btGETLOD, btGetLOD, btGetLODHook HookVectorTable btGETLEVELCOUNT, btGetLevelCount, btGetLevelCountHook HookVectorTable btSETAUTOGENFILTERTYPE, btSetAutoGenFilterType, btSetAutoGenFilterTypeHook HookVectorTable btGETAUTOGENFILTERTYPE, btGetAutoGenFilterType, btGetAutoGenFilterTypeHook HookVectorTable btGENERATEMIPSUBLEVELS, btGenerateMipSubLevels, btGenerateMipSubLevelsHook .endif pop eax .if framedump == SET invoke log, 3, offset LGetTexture, dword ptr [ebp+4], eax, pThis, Stage, ppTexture .endif ret GetTextureHook endp ; ########################################################################## GetTextureStageStateHook proc pThis:dword, Stage:dword, pType:dword, pValue:dword invoke GetTextureStageState, pThis, Stage, pType, pValue .if framedump == SET invoke log, 4, offset LGetTextureStageState, dword ptr [ebp+4], eax, pThis, Stage, pType, pValue .endif ret GetTextureStageStateHook endp ; ########################################################################## SetTextureStageStateHook proc pThis:dword, Stage:dword, pType:dword, Value:dword invoke SetTextureStageState, pThis, Stage, pType, Value .if framedump == SET invoke log, 4, offset LSetTextureStageState, dword ptr [ebp+4], eax, pThis, Stage, pType, Value .endif ret SetTextureStageStateHook endp ; ########################################################################## GetSamplerStateHook proc pThis:dword, Sampler:dword, pType:dword, pValue:dword invoke GetSamplerState, pThis, Sampler, pType, pValue .if framedump == SET invoke log, 4, offset LGetSamplerState, dword ptr [ebp+4], eax, pThis, Sampler, pType, pValue .endif ret GetSamplerStateHook endp ; ########################################################################## SetSamplerStateHook proc pThis:dword, Sampler:dword, pType:dword, Value:dword invoke SetSamplerState, pThis, Sampler, pType, Value .if framedump == SET invoke log, 4, offset LSetSamplerState, dword ptr [ebp+4], eax, pThis, Sampler, pType, Value .endif ret SetSamplerStateHook endp ; ########################################################################## ValidateDeviceHook proc pThis:dword, pNumPasses:dword invoke ValidateDevice, pThis, pNumPasses .if framedump == SET invoke log, 2, offset LValidateDevice, dword ptr [ebp+4], eax, pThis, pNumPasses .endif ret ValidateDeviceHook endp ; ########################################################################## SetPaletteEntriesHook proc pThis:dword, PaletteNumber:dword, pEntries:dword invoke SetPaletteEntries, pThis, PaletteNumber, pEntries .if framedump == SET invoke log, 3, offset LSetPaletteEntries, dword ptr [ebp+4], eax, pThis, PaletteNumber, pEntries .endif ret SetPaletteEntriesHook endp ; ########################################################################## GetPaletteEntriesHook proc pThis:dword, PaletteNumber:dword, pEntries:dword invoke GetPaletteEntries, pThis, PaletteNumber, pEntries .if framedump == SET invoke log, 3, offset LGetPaletteEntries, dword ptr [ebp+4], eax, pThis, PaletteNumber, pEntries .endif ret GetPaletteEntriesHook endp ; ########################################################################## SetCurrentTexturePaletteHook proc pThis:dword, PaletteNumber:dword invoke SetCurrentTexturePalette, pThis, PaletteNumber .if framedump == SET invoke log, 2, offset LSetCurrentTexturePalette, dword ptr [ebp+4], eax, pThis, PaletteNumber .endif ret SetCurrentTexturePaletteHook endp ; ########################################################################## GetCurrentTexturePaletteHook proc pThis:dword, PaletteNumber:dword invoke GetCurrentTexturePalette, pThis, PaletteNumber .if framedump == SET invoke log, 2, offset LGetCurrentTexturePalette, dword ptr [ebp+4], eax, pThis, PaletteNumber .endif ret GetCurrentTexturePaletteHook endp ; ########################################################################## SetScissorRectHook proc pThis:dword, pRect:dword invoke SetScissorRect, pThis, pRect .if framedump == SET invoke log, 2, offset LSetScissorRect, dword ptr [ebp+4], eax, pThis, pRect .endif ret SetScissorRectHook endp ; ########################################################################## GetScissorRectHook proc pThis:dword, pRect:dword invoke GetScissorRect, pThis, pRect .if framedump == SET invoke log, 2, offset LGetScissorRect, dword ptr [ebp+4], eax, pThis, pRect .endif ret GetScissorRectHook endp ; ########################################################################## SetSoftwareVertexProcessingHook proc pThis:dword, bSoftware:dword invoke SetSoftwareVertexProcessing, pThis, bSoftware .if framedump == SET invoke log, 2, offset LSetSoftwareVertexProcessing, dword ptr [ebp+4], eax, pThis, bSoftware .endif ret SetSoftwareVertexProcessingHook endp ; ########################################################################## GetSoftwareVertexProcessingHook proc pThis:dword invoke GetSoftwareVertexProcessing, pThis .if framedump == SET invoke log, 1, offset LGetSoftwareVertexProcessing, dword ptr [ebp+4], eax, pThis .endif ret GetSoftwareVertexProcessingHook endp ; ########################################################################## SetNPatchModeHook proc pThis:dword, nSegments:dword invoke SetNPatchMode, pThis, nSegments .if framedump == SET invoke log, 2, offset LSetNPatchMode, dword ptr [ebp+4], eax, pThis, nSegments .endif ret SetNPatchModeHook endp ; ########################################################################## GetNPatchModeHook proc pThis:dword invoke GetNPatchMode, pThis .if framedump == SET invoke log, 1, offset LGetNPatchMode, dword ptr [ebp+4], eax, pThis .endif ret GetNPatchModeHook endp ; ########################################################################## DrawPrimitiveHook proc pThis:dword, PrimitiveType:dword, StartVertex:dword, PrimitiveCount:dword mov eax, PrimitiveCount add triangles, eax invoke DrawPrimitive, pThis, PrimitiveType, StartVertex, PrimitiveCount .if framedump == SET invoke log, 4, offset LDrawPrimitive, dword ptr [ebp+4], eax, pThis, PrimitiveType, StartVertex, PrimitiveCount .endif ret DrawPrimitiveHook endp ; ########################################################################## DrawIndexedPrimitiveHook proc pThis:dword, PrimitiveType:dword, BaseVertexIndex:dword, MinVertexIndex:dword, NumVertices:dword, startIndex:dword, primCount:dword mov eax, primCount add triangles, eax invoke DrawIndexedPrimitive, pThis, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount .if framedump == SET invoke log, 7, offset LDrawIndexedPrimitive, dword ptr [ebp+4], eax, pThis, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount .endif ret DrawIndexedPrimitiveHook endp ; ########################################################################## DrawPrimitiveUPHook proc pThis:dword, PrimitiveType:dword, PrimitiveCount:dword, pVertexStreamZeroData:dword, VertexStreamZeroStride:dword mov eax, PrimitiveCount add triangles, eax invoke DrawPrimitiveUP, pThis, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride .if framedump == SET invoke log, 5, offset LDrawPrimitiveUP, dword ptr [ebp+4], eax, pThis, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride .endif ret DrawPrimitiveUPHook endp ; ########################################################################## DrawIndexedPrimitiveUPHook proc pThis:dword, PrimitiveType:dword, MinVertexIndex:dword, NumVertices:dword, PrimitiveCount:dword, pIndexData:dword, IndexDataFormat:dword, pVertexStreamZeroData:dword, VertexStreamZeroStride:dword mov eax, PrimitiveCount add triangles, eax invoke DrawIndexedPrimitiveUP, pThis, PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride .if framedump == SET invoke log, 9, offset LDrawIndexedPrimitiveUP, dword ptr [ebp+4], eax, pThis, PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride .endif ret DrawIndexedPrimitiveUPHook endp ; ########################################################################## ProcessVerticesHook proc pThis:dword, SrcStartIndex:dword, DestIndex:dword, VertexCount:dword, pDestBuffer:dword, pVertexDecl:dword, Flags:dword .if pDestBuffer != 0 mov ecx, pDestBuffer mov ecx, [ecx] HookVectorTable vlQUERYINTERFACE, vlQueryInterface, vlQueryInterfaceHook HookVectorTable vlADDREF, vlAddRef, vlAddRefHook HookVectorTable vlRELEASE, vlRelease, vlReleaseHook HookVectorTable vlGETDEVICE, vlGetDevice, vlGetDeviceHook HookVectorTable vlSETPRIVATEDATA, vlSetPrivateData, vlSetPrivateDataHook HookVectorTable vlGETPRIVATEDATA, vlGetPrivateData, vlGetPrivateDataHook HookVectorTable vlFREEPRIVATEDATA, vlFreePrivateData, vlFreePrivateDataHook HookVectorTable vlSETPRIORITY, vlSetPriority, vlSetPriorityHook HookVectorTable vlGETPRIORITY, vlGetPriority, vlGetPriorityHook HookVectorTable vlPRELOAD, vlPreLoad, vlPreLoadHook HookVectorTable vlGETTYPE, vlGetType, vlGetTypeHook HookVectorTable vlLOCK, vlLock, vlLockHook HookVectorTable vlUNLOCK, vlUnlock, vlUnlockHook HookVectorTable vlGETDESC, vlGetDesc, vlGetDescHook .endif .if pVertexDecl != 0 mov ecx, pVertexDecl mov ecx, [ecx] HookVectorTable vdQUERYINTERFACE, vdQueryInterface, vdQueryInterfaceHook HookVectorTable vdADDREF, vdAddRef, vdAddRefHook HookVectorTable vdRELEASE, vdRelease, vdReleaseHook HookVectorTable vdGETDEVICE, vdGetDevice, vdGetDeviceHook HookVectorTable vdGETDECLARATION, vdGetDeclaration, vdGetDeclarationHook .endif invoke ProcessVertices, pThis, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags .if framedump == SET invoke log, 7, offset LProcessVertices, dword ptr [ebp+4], eax, pThis, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags .endif ret ProcessVerticesHook endp ; ########################################################################## CreateVertexDeclarationHook proc pThis:dword, pVertexElements:dword, ppDecl:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateVertexDeclaration, pThis, pVertexElements, ppDecl push eax mov ecx, ppDecl mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vdQUERYINTERFACE, vdQueryInterface, vdQueryInterfaceHook HookVectorTable vdADDREF, vdAddRef, vdAddRefHook HookVectorTable vdRELEASE, vdRelease, vdReleaseHook HookVectorTable vdGETDEVICE, vdGetDevice, vdGetDeviceHook HookVectorTable vdGETDECLARATION, vdGetDeclaration, vdGetDeclarationHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreateVertexDeclaration, dword ptr [ebp+4], eax, pThis, pVertexElements, ppDecl .endif ret CreateVertexDeclarationHook endp ; ########################################################################## SetVertexDeclarationHook proc pThis:dword, pDecl:dword .if pDecl != 0 mov ecx, pDecl mov ecx, [ecx] HookVectorTable vdQUERYINTERFACE, vdQueryInterface, vdQueryInterfaceHook HookVectorTable vdADDREF, vdAddRef, vdAddRefHook HookVectorTable vdRELEASE, vdRelease, vdReleaseHook HookVectorTable vdGETDEVICE, vdGetDevice, vdGetDeviceHook HookVectorTable vdGETDECLARATION, vdGetDeclaration, vdGetDeclarationHook .endif invoke SetVertexDeclaration, pThis, pDecl .if framedump == SET invoke log, 2, offset LSetVertexDeclaration, dword ptr [ebp+4], eax, pThis, pDecl .endif ret SetVertexDeclarationHook endp ; ########################################################################## GetVertexDeclarationHook proc pThis:dword, ppDecl:dword invoke GetVertexDeclaration, pThis, ppDecl push eax mov ecx, ppDecl mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vdQUERYINTERFACE, vdQueryInterface, vdQueryInterfaceHook HookVectorTable vdADDREF, vdAddRef, vdAddRefHook HookVectorTable vdRELEASE, vdRelease, vdReleaseHook HookVectorTable vdGETDEVICE, vdGetDevice, vdGetDeviceHook HookVectorTable vdGETDECLARATION, vdGetDeclaration, vdGetDeclarationHook .endif pop eax .if framedump == SET invoke log, 2, offset LGetVertexDeclaration, dword ptr [ebp+4], eax, pThis, ppDecl .endif ret GetVertexDeclarationHook endp ; ########################################################################## SetFVFHook proc pThis:dword, FVF:dword invoke SetFVF, pThis, FVF .if framedump == SET invoke log, 2, offset LSetFVF, dword ptr [ebp+4], eax, pThis, FVF .endif ret SetFVFHook endp ; ########################################################################## GetFVFHook proc pThis:dword, pFVF:dword invoke GetFVF, pThis, pFVF .if framedump == SET invoke log, 2, offset LGetFVF, dword ptr [ebp+4], eax, pThis, pFVF .endif ret GetFVFHook endp ; ########################################################################## CreateVertexShaderHook proc pThis:dword, pFunction:dword, ppShader:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateVertexShader, pThis, pFunction, ppShader push eax mov ecx, ppShader mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vsQUERYINTERFACE, vsQueryInterface, vsQueryInterfaceHook HookVectorTable vsADDREF, vsAddRef, vsAddRefHook HookVectorTable vsRELEASE, vsRelease, vsReleaseHook HookVectorTable vsGETDEVICE, vsGetDevice, vsGetDeviceHook HookVectorTable vsGETFUNCTION, vsGetFunction, vsGetFunctionHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreateVertexShader, dword ptr [ebp+4], eax, pThis, pFunction, ppShader .endif ret CreateVertexShaderHook endp ; ########################################################################## SetVertexShaderHook proc pThis:dword, pShader:dword .if pShader != 0 mov ecx, pShader mov ecx, [ecx] HookVectorTable vsQUERYINTERFACE, vsQueryInterface, vsQueryInterfaceHook HookVectorTable vsADDREF, vsAddRef, vsAddRefHook HookVectorTable vsRELEASE, vsRelease, vsReleaseHook HookVectorTable vsGETDEVICE, vsGetDevice, vsGetDeviceHook HookVectorTable vsGETFUNCTION, vsGetFunction, vsGetFunctionHook .endif invoke SetVertexShader, pThis, pShader .if framedump == SET invoke log, 2, offset LSetVertexShader, dword ptr [ebp+4], eax, pThis, pShader .endif ret SetVertexShaderHook endp ; ########################################################################## GetVertexShaderHook proc pThis:dword, ppShader:dword invoke GetVertexShader, pThis, ppShader push eax mov ecx, ppShader mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vsQUERYINTERFACE, vsQueryInterface, vsQueryInterfaceHook HookVectorTable vsADDREF, vsAddRef, vsAddRefHook HookVectorTable vsRELEASE, vsRelease, vsReleaseHook HookVectorTable vsGETDEVICE, vsGetDevice, vsGetDeviceHook HookVectorTable vsGETFUNCTION, vsGetFunction, vsGetFunctionHook .endif pop eax .if framedump == SET invoke log, 2, offset LGetVertexShader, dword ptr [ebp+4], eax, pThis, ppShader .endif ret GetVertexShaderHook endp ; ########################################################################## SetVertexShaderConstantFHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4fCount:dword invoke SetVertexShaderConstantF, pThis, StartRegister, pConstantData, Vector4fCount .if framedump == SET invoke log, 4, offset LSetVertexShaderConstantF, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4fCount .endif ret SetVertexShaderConstantFHook endp ; ########################################################################## GetVertexShaderConstantFHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4fCount:dword invoke GetVertexShaderConstantF, pThis, StartRegister, pConstantData, Vector4fCount .if framedump == SET invoke log, 4, offset LGetVertexShaderConstantF, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4fCount .endif ret GetVertexShaderConstantFHook endp ; ########################################################################## SetVertexShaderConstantIHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4iCount:dword invoke SetVertexShaderConstantI, pThis, StartRegister, pConstantData, Vector4iCount .if framedump == SET invoke log, 4, offset LSetVertexShaderConstantI, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4iCount .endif ret SetVertexShaderConstantIHook endp ; ########################################################################## GetVertexShaderConstantIHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4iCount:dword invoke GetVertexShaderConstantI, pThis, StartRegister, pConstantData, Vector4iCount .if framedump == SET invoke log, 4, offset LGetVertexShaderConstantI, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4iCount .endif ret GetVertexShaderConstantIHook endp ; ########################################################################## SetVertexShaderConstantBHook proc pThis:dword, StartRegister:dword, pConstantData:dword, BoolCount:dword invoke SetVertexShaderConstantB, pThis, StartRegister, pConstantData, BoolCount .if framedump == SET invoke log, 4, offset LSetVertexShaderConstantB, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, BoolCount .endif ret SetVertexShaderConstantBHook endp ; ########################################################################## GetVertexShaderConstantBHook proc pThis:dword, StartRegister:dword, pConstantData:dword, BoolCount:dword invoke GetVertexShaderConstantB, pThis, StartRegister, pConstantData, BoolCount .if framedump == SET invoke log, 4, offset LGetVertexShaderConstantB, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, BoolCount .endif ret GetVertexShaderConstantBHook endp ; ########################################################################## GetStreamSourceHook proc pThis:dword, StreamNumber:dword, ppStreamData:dword, pOffsetInBytes:dword, pStride:dword invoke GetStreamSource, pThis, StreamNumber, ppStreamData, pOffsetInBytes, pStride push eax mov ecx, ppStreamData mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable vlQUERYINTERFACE, vlQueryInterface, vlQueryInterfaceHook HookVectorTable vlADDREF, vlAddRef, vlAddRefHook HookVectorTable vlRELEASE, vlRelease, vlReleaseHook HookVectorTable vlGETDEVICE, vlGetDevice, vlGetDeviceHook HookVectorTable vlSETPRIVATEDATA, vlSetPrivateData, vlSetPrivateDataHook HookVectorTable vlGETPRIVATEDATA, vlGetPrivateData, vlGetPrivateDataHook HookVectorTable vlFREEPRIVATEDATA, vlFreePrivateData, vlFreePrivateDataHook HookVectorTable vlSETPRIORITY, vlSetPriority, vlSetPriorityHook HookVectorTable vlGETPRIORITY, vlGetPriority, vlGetPriorityHook HookVectorTable vlPRELOAD, vlPreLoad, vlPreLoadHook HookVectorTable vlGETTYPE, vlGetType, vlGetTypeHook HookVectorTable vlLOCK, vlLock, vlLockHook HookVectorTable vlUNLOCK, vlUnlock, vlUnlockHook HookVectorTable vlGETDESC, vlGetDesc, vlGetDescHook .endif pop eax .if framedump == SET invoke log, 5, offset LGetStreamSource, dword ptr [ebp+4], eax, pThis, StreamNumber, ppStreamData, pOffsetInBytes, pStride .endif ret GetStreamSourceHook endp ; ########################################################################## SetStreamSourceFreqHook proc pThis:dword, StreamNumber:dword, Setting:dword invoke SetStreamSourceFreq, pThis, StreamNumber, Setting .if framedump == SET invoke log, 3, offset LSetStreamSourceFreq, dword ptr [ebp+4], eax, pThis, StreamNumber, Setting .endif ret SetStreamSourceFreqHook endp ; ########################################################################## GetStreamSourceFreqHook proc pThis:dword, StreamNumber:dword, pSetting:dword invoke GetStreamSourceFreq, pThis, StreamNumber, pSetting .if framedump == SET invoke log, 3, offset LGetStreamSourceFreq, dword ptr [ebp+4], eax, pThis, StreamNumber, pSetting .endif ret GetStreamSourceFreqHook endp ; ########################################################################## SetIndicesHook proc pThis:dword, pIndexData:dword .if pIndexData != 0 mov ecx, pIndexData mov ecx, [ecx] HookVectorTable ibQUERYINTERFACE, ibQueryInterface, ibQueryInterfaceHook HookVectorTable ibADDREF, ibAddRef, ibAddRefHook HookVectorTable ibRELEASE, ibRelease, ibReleaseHook HookVectorTable ibGETDEVICE, ibGetDevice, ibGetDeviceHook HookVectorTable ibSETPRIVATEDATA, ibSetPrivateData, ibSetPrivateDataHook HookVectorTable ibGETPRIVATEDATA, ibGetPrivateData, ibGetPrivateDataHook HookVectorTable ibFREEPRIVATEDATA, ibFreePrivateData, ibFreePrivateDataHook HookVectorTable ibSETPRIORITY, ibSetPriority, ibSetPriorityHook HookVectorTable ibGETPRIORITY, ibGetPriority, ibGetPriorityHook HookVectorTable ibPRELOAD, ibPreLoad, ibPreLoadHook HookVectorTable ibGETTYPE, ibGetType, ibGetTypeHook mov eax, dword ptr [ebp+4] .if eax < d3dx_lower || eax > d3dx_upper HookVectorTable ibLOCK, ibLock, ibLockHook .endif HookVectorTable ibUNLOCK, ibUnlock, ibUnlockHook HookVectorTable ibGETDESC, ibGetDesc, ibGetDescHook .endif invoke SetIndices, pThis, pIndexData .if framedump == SET invoke log, 2, offset LSetIndices, dword ptr [ebp+4], eax, pThis, pIndexData .endif ret SetIndicesHook endp ; ########################################################################## GetIndicesHook proc pThis:dword, ppIndexData:dword invoke GetIndices, pThis, ppIndexData push eax mov ecx, ppIndexData mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable ibQUERYINTERFACE, ibQueryInterface, ibQueryInterfaceHook HookVectorTable ibADDREF, ibAddRef, ibAddRefHook HookVectorTable ibRELEASE, ibRelease, ibReleaseHook HookVectorTable ibGETDEVICE, ibGetDevice, ibGetDeviceHook HookVectorTable ibSETPRIVATEDATA, ibSetPrivateData, ibSetPrivateDataHook HookVectorTable ibGETPRIVATEDATA, ibGetPrivateData, ibGetPrivateDataHook HookVectorTable ibFREEPRIVATEDATA, ibFreePrivateData, ibFreePrivateDataHook HookVectorTable ibSETPRIORITY, ibSetPriority, ibSetPriorityHook HookVectorTable ibGETPRIORITY, ibGetPriority, ibGetPriorityHook HookVectorTable ibPRELOAD, ibPreLoad, ibPreLoadHook HookVectorTable ibGETTYPE, ibGetType, ibGetTypeHook mov eax, dword ptr [ebp+4] .if eax < d3dx_lower || eax > d3dx_upper HookVectorTable ibLOCK, ibLock, ibLockHook .endif HookVectorTable ibUNLOCK, ibUnlock, ibUnlockHook HookVectorTable ibGETDESC, ibGetDesc, ibGetDescHook .endif pop eax .if framedump == SET invoke log, 2, offset LGetIndices, dword ptr [ebp+4], eax, pThis, ppIndexData .endif ret GetIndicesHook endp ; ########################################################################## CreatePixelShaderHook proc pThis:dword, pFunction:dword, ppShader:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreatePixelShader, pThis, pFunction, ppShader push eax mov ecx, ppShader mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable psQUERYINTERFACE, psQueryInterface, psQueryInterfaceHook HookVectorTable psADDREF, psAddRef, psAddRefHook HookVectorTable psRELEASE, psRelease, psReleaseHook HookVectorTable psGETDEVICE, psGetDevice, psGetDeviceHook HookVectorTable psGETFUNCTION, psGetFunction, psGetFunctionHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreatePixelShader, dword ptr [ebp+4], eax, pThis, pFunction, ppShader .endif ret CreatePixelShaderHook endp ; ########################################################################## SetPixelShaderHook proc pThis:dword, pShader:dword .if pShader != 0 mov ecx, pShader mov ecx, [ecx] HookVectorTable psQUERYINTERFACE, psQueryInterface, psQueryInterfaceHook HookVectorTable psADDREF, psAddRef, psAddRefHook HookVectorTable psRELEASE, psRelease, psReleaseHook HookVectorTable psGETDEVICE, psGetDevice, psGetDeviceHook HookVectorTable psGETFUNCTION, psGetFunction, psGetFunctionHook .endif invoke SetPixelShader, pThis, pShader .if framedump == SET invoke log, 2, offset LSetPixelShader, dword ptr [ebp+4], eax, pThis, pShader .endif ret SetPixelShaderHook endp ; ########################################################################## GetPixelShaderHook proc pThis:dword, ppShader:dword invoke GetPixelShader, pThis, ppShader push eax mov ecx, ppShader mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable psQUERYINTERFACE, psQueryInterface, psQueryInterfaceHook HookVectorTable psADDREF, psAddRef, psAddRefHook HookVectorTable psRELEASE, psRelease, psReleaseHook HookVectorTable psGETDEVICE, psGetDevice, psGetDeviceHook HookVectorTable psGETFUNCTION, psGetFunction, psGetFunctionHook .endif pop eax .if framedump == SET invoke log, 2, offset LGetPixelShader, dword ptr [ebp+4], eax, pThis, ppShader .endif ret GetPixelShaderHook endp ; ########################################################################## SetPixelShaderConstantFHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4fCount:dword invoke SetPixelShaderConstantF, pThis, StartRegister, pConstantData, Vector4fCount .if framedump == SET invoke log, 4, offset LSetPixelShaderConstantF, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4fCount .endif ret SetPixelShaderConstantFHook endp ; ########################################################################## GetPixelShaderConstantFHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4fCount:dword invoke GetPixelShaderConstantF, pThis, StartRegister, pConstantData, Vector4fCount .if framedump == SET invoke log, 4, offset LGetPixelShaderConstantF, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4fCount .endif ret GetPixelShaderConstantFHook endp ; ########################################################################## SetPixelShaderConstantIHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4iCount:dword invoke SetPixelShaderConstantI, pThis, StartRegister, pConstantData, Vector4iCount .if framedump == SET invoke log, 4, offset LSetPixelShaderConstantI, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4iCount .endif ret SetPixelShaderConstantIHook endp ; ########################################################################## GetPixelShaderConstantIHook proc pThis:dword, StartRegister:dword, pConstantData:dword, Vector4iCount:dword invoke GetPixelShaderConstantI, pThis, StartRegister, pConstantData, Vector4iCount .if framedump == SET invoke log, 4, offset LGetPixelShaderConstantI, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, Vector4iCount .endif ret GetPixelShaderConstantIHook endp ; ########################################################################## SetPixelShaderConstantBHook proc pThis:dword, StartRegister:dword, pConstantData:dword, BoolCount:dword invoke SetPixelShaderConstantB, pThis, StartRegister, pConstantData, BoolCount .if framedump == SET invoke log, 4, offset LSetPixelShaderConstantB, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, BoolCount .endif ret SetPixelShaderConstantBHook endp ; ########################################################################## GetPixelShaderConstantBHook proc pThis:dword, StartRegister:dword, pConstantData:dword, BoolCount:dword invoke GetPixelShaderConstantB, pThis, StartRegister, pConstantData, BoolCount .if framedump == SET invoke log, 4, offset LGetPixelShaderConstantB, dword ptr [ebp+4], eax, pThis, StartRegister, pConstantData, BoolCount .endif ret GetPixelShaderConstantBHook endp ; ########################################################################## DrawRectPatchHook proc pThis:dword, Handle:dword, pNumSegs:dword, pRectPatchInfo:dword invoke DrawRectPatch, pThis, Handle, pNumSegs, pRectPatchInfo .if framedump == SET invoke log, 4, offset LDrawRectPatch, dword ptr [ebp+4], eax, pThis, Handle, pNumSegs, pRectPatchInfo .endif ret DrawRectPatchHook endp ; ########################################################################## DrawTriPatchHook proc pThis:dword, Handle:dword, pNumSegs:dword, pTriPatchInfo:dword invoke DrawTriPatch, pThis, Handle, pNumSegs, pTriPatchInfo .if framedump == SET invoke log, 4, offset LDrawTriPatch, dword ptr [ebp+4], eax, pThis, Handle, pNumSegs, pTriPatchInfo .endif ret DrawTriPatchHook endp ; ########################################################################## DeletePatchHook proc pThis:dword, Handle:dword invoke DeletePatch, pThis, Handle .if framedump == SET invoke log, 2, offset LDeletePatch, dword ptr [ebp+4], eax, pThis, Handle .endif ret DeletePatchHook endp ; ########################################################################## CreateQueryHook proc pThis:dword, pType:dword, ppQuery:dword .if framedump == ONCREATE mov framedump, SET invoke logheader .endif invoke CreateQuery, pThis, pType, ppQuery push eax mov ecx, ppQuery mov ecx, [ecx] .if ecx != 0 mov ecx, [ecx] HookVectorTable qxQUERYINTERFACE, qxQueryInterface, qxQueryInterfaceHook HookVectorTable qxADDREF, qxAddRef, qxAddRefHook HookVectorTable qxRELEASE, qxRelease, qxReleaseHook HookVectorTable qxGETDEVICE, qxGetDevice, qxGetDeviceHook HookVectorTable qxGETTYPE, qxGetType, qxGetTypeHook HookVectorTable qxGETDATASIZE, qxGetDataSize, qxGetDataSizeHook HookVectorTable qxISSUE, qxIssue, qxIssueHook HookVectorTable qxGETDATA, qxGetData, qxGetDataHook .endif pop eax .if framedump == SET invoke log, 3, offset LCreateQuery, dword ptr [ebp+4], eax, pThis, pType, ppQuery .endif ret CreateQueryHook endp ; ########################################################################## vsQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke vsQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset TQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret vsQueryInterfaceHook endp ; ########################################################################## vsAddRefHook proc pThis:dword invoke vsAddRef, pThis .if framedump == SET invoke log, 1, offset TAddRef, dword ptr [ebp+4], eax, pThis .endif ret vsAddRefHook endp ; ########################################################################## vsReleaseHook proc pThis:dword invoke vsRelease, pThis .if framedump == SET invoke log, 1, offset TRelease, dword ptr [ebp+4], eax, pThis .endif ret vsReleaseHook endp ; ########################################################################## vsGetDeviceHook proc pThis:dword, ppDevice:dword invoke vsGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset TGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vsGetDeviceHook endp ; ########################################################################## vsGetFunctionHook proc pThis:dword, pFunc:dword, pSizeOfData:dword invoke vsGetFunction, pThis, pFunc, pSizeOfData .if framedump == SET invoke log, 3, offset TGetFunction, dword ptr [ebp+4], eax, pThis, pFunc, pSizeOfData .endif ret vsGetFunctionHook endp ; ########################################################################## btQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke btQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset SQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret btQueryInterfaceHook endp ; ########################################################################## btAddRefHook proc pThis:dword invoke btAddRef, pThis .if framedump == SET invoke log, 1, offset SAddRef, dword ptr [ebp+4], eax, pThis .endif ret btAddRefHook endp ; ########################################################################## btReleaseHook proc pThis:dword invoke btRelease, pThis .if framedump == SET invoke log, 1, offset SRelease, dword ptr [ebp+4], eax, pThis .endif ret btReleaseHook endp ; ########################################################################## btGetDeviceHook proc pThis:dword, ppDevice:dword invoke btGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset SGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret btGetDeviceHook endp ; ########################################################################## btSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke btSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset SSetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret btSetPrivateDataHook endp ; ########################################################################## btGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke btGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset SGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret btGetPrivateDataHook endp ; ########################################################################## btFreePrivateDataHook proc pThis:dword, refguid:dword invoke btFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset SFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret btFreePrivateDataHook endp ; ########################################################################## btSetPriorityHook proc pThis:dword, PriorityNew:dword invoke btSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset SSetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret btSetPriorityHook endp ; ########################################################################## btGetPriorityHook proc pThis:dword invoke btGetPriority, pThis .if framedump == SET invoke log, 1, offset SGetPriority, dword ptr [ebp+4], eax, pThis .endif ret btGetPriorityHook endp ; ########################################################################## btPreLoadHook proc pThis:dword invoke btPreLoad, pThis .if framedump == SET invoke log, 1, offset SPreLoad, dword ptr [ebp+4], eax, pThis .endif ret btPreLoadHook endp ; ########################################################################## btGetTypeHook proc pThis:dword invoke btGetType, pThis .if framedump == SET invoke log, 1, offset SGetType, dword ptr [ebp+4], eax, pThis .endif ret btGetTypeHook endp ; ########################################################################## btSetLODHook proc pThis:dword, LODNew:dword invoke btSetLOD, pThis, LODNew .if framedump == SET invoke log, 2, offset SSetLOD, dword ptr [ebp+4], eax, pThis, LODNew .endif ret btSetLODHook endp ; ########################################################################## btGetLODHook proc pThis:dword invoke btGetLOD, pThis .if framedump == SET invoke log, 1, offset SGetLOD, dword ptr [ebp+4], eax, pThis .endif ret btGetLODHook endp ; ########################################################################## btGetLevelCountHook proc pThis:dword invoke btGetLevelCount, pThis .if framedump == SET invoke log, 1, offset SGetLevelCount, dword ptr [ebp+4], eax, pThis .endif ret btGetLevelCountHook endp ; ########################################################################## btSetAutoGenFilterTypeHook proc pThis:dword, FilterType:dword invoke btSetAutoGenFilterType, pThis, FilterType .if framedump == SET invoke log, 2, offset SSetAutoGenFilterType, dword ptr [ebp+4], eax, pThis, FilterType .endif ret btSetAutoGenFilterTypeHook endp ; ########################################################################## btGetAutoGenFilterTypeHook proc pThis:dword invoke btGetAutoGenFilterType, pThis .if framedump == SET invoke log, 1, offset SGetAutoGenFilterType, dword ptr [ebp+4], eax, pThis .endif ret btGetAutoGenFilterTypeHook endp ; ########################################################################## btGenerateMipSubLevelsHook proc pThis:dword invoke btGenerateMipSubLevels, pThis .if framedump == SET invoke log, 1, offset SGenerateMipSubLevels, dword ptr [ebp+4], eax, pThis .endif ret btGenerateMipSubLevelsHook endp ; ########################################################################## ttQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke ttQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset AQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret ttQueryInterfaceHook endp ; ########################################################################## ttAddRefHook proc pThis:dword invoke ttAddRef, pThis .if framedump == SET invoke log, 1, offset AAddRef, dword ptr [ebp+4], eax, pThis .endif ret ttAddRefHook endp ; ########################################################################## ttReleaseHook proc pThis:dword invoke ttRelease, pThis .if framedump == SET invoke log, 1, offset ARelease, dword ptr [ebp+4], eax, pThis .endif ret ttReleaseHook endp ; ########################################################################## ttGetDeviceHook proc pThis:dword, ppDevice:dword invoke ttGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset AGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret ttGetDeviceHook endp ; ########################################################################## ttSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke ttSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset ASetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret ttSetPrivateDataHook endp ; ########################################################################## ttGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke ttGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset AGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret ttGetPrivateDataHook endp ; ########################################################################## ttFreePrivateDataHook proc pThis:dword, refguid:dword invoke ttFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset AFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret ttFreePrivateDataHook endp ; ########################################################################## ttSetPriorityHook proc pThis:dword, PriorityNew:dword invoke ttSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset ASetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret ttSetPriorityHook endp ; ########################################################################## ttGetPriorityHook proc pThis:dword invoke ttGetPriority, pThis .if framedump == SET invoke log, 1, offset AGetPriority, dword ptr [ebp+4], eax, pThis .endif ret ttGetPriorityHook endp ; ########################################################################## ttPreLoadHook proc pThis:dword invoke ttPreLoad, pThis .if framedump == SET invoke log, 1, offset APreLoad, dword ptr [ebp+4], eax, pThis .endif ret ttPreLoadHook endp ; ########################################################################## ttGetTypeHook proc pThis:dword invoke ttGetType, pThis .if framedump == SET invoke log, 1, offset AGetType, dword ptr [ebp+4], eax, pThis .endif ret ttGetTypeHook endp ; ########################################################################## ttSetLODHook proc pThis:dword, LODNew:dword invoke ttSetLOD, pThis, LODNew .if framedump == SET invoke log, 2, offset ASetLOD, dword ptr [ebp+4], eax, pThis, LODNew .endif ret ttSetLODHook endp ; ########################################################################## ttGetLODHook proc pThis:dword invoke ttGetLOD, pThis .if framedump == SET invoke log, 1, offset AGetLOD, dword ptr [ebp+4], eax, pThis .endif ret ttGetLODHook endp ; ########################################################################## ttGetLevelCountHook proc pThis:dword invoke ttGetLevelCount, pThis .if framedump == SET invoke log, 1, offset AGetLevelCount, dword ptr [ebp+4], eax, pThis .endif ret ttGetLevelCountHook endp ; ########################################################################## ttSetAutoGenFilterTypeHook proc pThis:dword, FilterType:dword invoke ttSetAutoGenFilterType, pThis, FilterType .if framedump == SET invoke log, 2, offset ASetAutoGenFilterType, dword ptr [ebp+4], eax, pThis, FilterType .endif ret ttSetAutoGenFilterTypeHook endp ; ########################################################################## ttGetAutoGenFilterTypeHook proc pThis:dword invoke ttGetAutoGenFilterType, pThis .if framedump == SET invoke log, 1, offset AGetAutoGenFilterType, dword ptr [ebp+4], eax, pThis .endif ret ttGetAutoGenFilterTypeHook endp ; ########################################################################## ttGenerateMipSubLevelsHook proc pThis:dword invoke ttGenerateMipSubLevels, pThis .if framedump == SET invoke log, 1, offset AGenerateMipSubLevels, dword ptr [ebp+4], eax, pThis .endif ret ttGenerateMipSubLevelsHook endp ; ########################################################################## ttGetLevelDescHook proc pThis:dword, Level:dword, pDesc:dword invoke ttGetLevelDesc, pThis, Level, pDesc .if framedump == SET invoke log, 3, offset AGetLevelDesc, dword ptr [ebp+4], eax, pThis, Level, pDesc .endif ret ttGetLevelDescHook endp ; ########################################################################## ttGetSurfaceLevelHook proc pThis:dword, Level:dword, ppSurfaceLevel:dword invoke ttGetSurfaceLevel, pThis, Level, ppSurfaceLevel .if framedump == SET invoke log, 3, offset AGetSurfaceLevel, dword ptr [ebp+4], eax, pThis, Level, ppSurfaceLevel .endif ret ttGetSurfaceLevelHook endp ; ########################################################################## ttLockRectHook proc pThis:dword, Level:dword, pLockedRect:dword, pRect:dword, Flags:dword invoke ttLockRect, pThis, Level, pLockedRect, pRect, Flags .if framedump == SET invoke log, 5, offset ALockRect, dword ptr [ebp+4], eax, pThis, Level, pLockedRect, pRect, Flags .endif ret ttLockRectHook endp ; ########################################################################## ttUnlockRectHook proc pThis:dword, Level:dword invoke ttUnlockRect, pThis, Level .if framedump == SET invoke log, 2, offset AUnlockRect, dword ptr [ebp+4], eax, pThis, Level .endif ret ttUnlockRectHook endp ; ########################################################################## ttAddDirtyRectHook proc pThis:dword, pDirtyRect:dword invoke ttAddDirtyRect, pThis, pDirtyRect .if framedump == SET invoke log, 2, offset AAddDirtyRect, dword ptr [ebp+4], eax, pThis, pDirtyRect .endif ret ttAddDirtyRectHook endp ; ########################################################################## cxQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke cxQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset CQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret cxQueryInterfaceHook endp ; ########################################################################## cxAddRefHook proc pThis:dword invoke cxAddRef, pThis .if framedump == SET invoke log, 1, offset CAddRef, dword ptr [ebp+4], eax, pThis .endif ret cxAddRefHook endp ; ########################################################################## cxReleaseHook proc pThis:dword invoke cxRelease, pThis .if framedump == SET invoke log, 1, offset CRelease, dword ptr [ebp+4], eax, pThis .endif ret cxReleaseHook endp ; ########################################################################## cxGetDeviceHook proc pThis:dword, ppDevice:dword invoke cxGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset CGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret cxGetDeviceHook endp ; ########################################################################## cxSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke cxSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset CSetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret cxSetPrivateDataHook endp ; ########################################################################## cxGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke cxGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset CGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret cxGetPrivateDataHook endp ; ########################################################################## cxFreePrivateDataHook proc pThis:dword, refguid:dword invoke cxFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset CFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret cxFreePrivateDataHook endp ; ########################################################################## cxSetPriorityHook proc pThis:dword, PriorityNew:dword invoke cxSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset CSetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret cxSetPriorityHook endp ; ########################################################################## cxGetPriorityHook proc pThis:dword invoke cxGetPriority, pThis .if framedump == SET invoke log, 1, offset CGetPriority, dword ptr [ebp+4], eax, pThis .endif ret cxGetPriorityHook endp ; ########################################################################## cxPreLoadHook proc pThis:dword invoke cxPreLoad, pThis .if framedump == SET invoke log, 1, offset CPreLoad, dword ptr [ebp+4], eax, pThis .endif ret cxPreLoadHook endp ; ########################################################################## cxGetTypeHook proc pThis:dword invoke cxGetType, pThis .if framedump == SET invoke log, 1, offset CGetType, dword ptr [ebp+4], eax, pThis .endif ret cxGetTypeHook endp ; ########################################################################## cxSetLODHook proc pThis:dword, LODNew:dword invoke cxSetLOD, pThis, LODNew .if framedump == SET invoke log, 2, offset CSetLOD, dword ptr [ebp+4], eax, pThis, LODNew .endif ret cxSetLODHook endp ; ########################################################################## cxGetLODHook proc pThis:dword invoke cxGetLOD, pThis .if framedump == SET invoke log, 1, offset CGetLOD, dword ptr [ebp+4], eax, pThis .endif ret cxGetLODHook endp ; ########################################################################## cxGetLevelCountHook proc pThis:dword invoke cxGetLevelCount, pThis .if framedump == SET invoke log, 1, offset CGetLevelCount, dword ptr [ebp+4], eax, pThis .endif ret cxGetLevelCountHook endp ; ########################################################################## cxSetAutoGenFilterTypeHook proc pThis:dword, FilterType:dword invoke cxSetAutoGenFilterType, pThis, FilterType .if framedump == SET invoke log, 2, offset CSetAutoGenFilterType, dword ptr [ebp+4], eax, pThis, FilterType .endif ret cxSetAutoGenFilterTypeHook endp ; ########################################################################## cxGetAutoGenFilterTypeHook proc pThis:dword invoke cxGetAutoGenFilterType, pThis .if framedump == SET invoke log, 1, offset CGetAutoGenFilterType, dword ptr [ebp+4], eax, pThis .endif ret cxGetAutoGenFilterTypeHook endp ; ########################################################################## cxGenerateMipSubLevelsHook proc pThis:dword invoke cxGenerateMipSubLevels, pThis .if framedump == SET invoke log, 1, offset CGenerateMipSubLevels, dword ptr [ebp+4], eax, pThis .endif ret cxGenerateMipSubLevelsHook endp ; ########################################################################## cxGetLevelDescHook proc pThis:dword, Level:dword, pDesc:dword invoke cxGetLevelDesc, pThis, Level, pDesc .if framedump == SET invoke log, 3, offset CGetLevelDesc, dword ptr [ebp+4], eax, pThis, Level, pDesc .endif ret cxGetLevelDescHook endp ; ########################################################################## cxGetCubeMapSurfaceHook proc pThis:dword, FaceType:dword, Level:dword, ppCubeMapSurface:dword invoke cxGetCubeMapSurface, pThis, FaceType, Level, ppCubeMapSurface .if framedump == SET invoke log, 4, offset CGetCubeMapSurface, dword ptr [ebp+4], eax, pThis, FaceType, Level, ppCubeMapSurface .endif ret cxGetCubeMapSurfaceHook endp ; ########################################################################## cxLockRectHook proc pThis:dword, FaceType:dword, Level:dword, pLockedRect:dword, pRect:dword, Flags:dword invoke cxLockRect, pThis, FaceType, Level, pLockedRect, pRect, Flags .if framedump == SET invoke log, 6, offset CLockRect, dword ptr [ebp+4], eax, pThis, FaceType, Level, pLockedRect, pRect, Flags .endif ret cxLockRectHook endp ; ########################################################################## cxUnlockRectHook proc pThis:dword, FaceType:dword, Level:dword invoke cxUnlockRect, pThis, FaceType, Level .if framedump == SET invoke log, 3, offset CUnlockRect, dword ptr [ebp+4], eax, pThis, FaceType, Level .endif ret cxUnlockRectHook endp ; ########################################################################## cxAddDirtyRectHook proc pThis:dword, FaceType:dword, pDirtyRect:dword invoke cxAddDirtyRect, pThis, FaceType, pDirtyRect .if framedump == SET invoke log, 3, offset CAddDirtyRect, dword ptr [ebp+4], eax, pThis, FaceType, pDirtyRect .endif ret cxAddDirtyRectHook endp ; ########################################################################## ibQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke ibQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset EQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret ibQueryInterfaceHook endp ; ########################################################################## ibAddRefHook proc pThis:dword invoke ibAddRef, pThis .if framedump == SET invoke log, 1, offset EAddRef, dword ptr [ebp+4], eax, pThis .endif ret ibAddRefHook endp ; ########################################################################## ibReleaseHook proc pThis:dword invoke ibRelease, pThis .if framedump == SET invoke log, 1, offset ERelease, dword ptr [ebp+4], eax, pThis .endif ret ibReleaseHook endp ; ########################################################################## ibGetDeviceHook proc pThis:dword, ppDevice:dword invoke ibGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset EGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret ibGetDeviceHook endp ; ########################################################################## ibSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke ibSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset ESetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret ibSetPrivateDataHook endp ; ########################################################################## ibGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke ibGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset EGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret ibGetPrivateDataHook endp ; ########################################################################## ibFreePrivateDataHook proc pThis:dword, refguid:dword invoke ibFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset EFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret ibFreePrivateDataHook endp ; ########################################################################## ibSetPriorityHook proc pThis:dword, PriorityNew:dword invoke ibSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset ESetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret ibSetPriorityHook endp ; ########################################################################## ibGetPriorityHook proc pThis:dword invoke ibGetPriority, pThis .if framedump == SET invoke log, 1, offset EGetPriority, dword ptr [ebp+4], eax, pThis .endif ret ibGetPriorityHook endp ; ########################################################################## ibPreLoadHook proc pThis:dword invoke ibPreLoad, pThis .if framedump == SET invoke log, 1, offset EPreLoad, dword ptr [ebp+4], eax, pThis .endif ret ibPreLoadHook endp ; ########################################################################## ibGetTypeHook proc pThis:dword invoke ibGetType, pThis .if framedump == SET invoke log, 1, offset EGetType, dword ptr [ebp+4], eax, pThis .endif ret ibGetTypeHook endp ; ########################################################################## ibLockHook proc pThis:dword, OffsetToLock:dword, SizeToLock:dword, ppbData:dword, Flags:dword invoke ibLock, pThis, OffsetToLock, SizeToLock, ppbData, Flags .if framedump == SET invoke log, 5, offset ELock, dword ptr [ebp+4], eax, pThis, OffsetToLock, SizeToLock, ppbData, Flags .endif ret ibLockHook endp ; ########################################################################## ibUnlockHook proc pThis:dword invoke ibUnlock, pThis .if framedump == SET invoke log, 1, offset EUnlock, dword ptr [ebp+4], eax, pThis .endif ret ibUnlockHook endp ; ########################################################################## ibGetDescHook proc pThis:dword, pDesc:dword invoke ibGetDesc, pThis, pDesc .if framedump == SET invoke log, 2, offset EGetDesc, dword ptr [ebp+4], eax, pThis, pDesc .endif ret ibGetDescHook endp ; ########################################################################## psQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke psQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset ZQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret psQueryInterfaceHook endp ; ########################################################################## psAddRefHook proc pThis:dword invoke psAddRef, pThis .if framedump == SET invoke log, 1, offset ZAddRef, dword ptr [ebp+4], eax, pThis .endif ret psAddRefHook endp ; ########################################################################## psReleaseHook proc pThis:dword invoke psRelease, pThis .if framedump == SET invoke log, 1, offset ZRelease, dword ptr [ebp+4], eax, pThis .endif ret psReleaseHook endp ; ########################################################################## psGetDeviceHook proc pThis:dword, ppDevice:dword invoke psGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset ZGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret psGetDeviceHook endp ; ########################################################################## psGetFunctionHook proc pThis:dword, void:dword, pSizeOfData:dword invoke psGetFunction, pThis, void, pSizeOfData .if framedump == SET invoke log, 3, offset ZGetFunction, dword ptr [ebp+4], eax, pThis, void, pSizeOfData .endif ret psGetFunctionHook endp ; ########################################################################## qxQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke qxQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset HQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret qxQueryInterfaceHook endp ; ########################################################################## qxAddRefHook proc pThis:dword invoke qxAddRef, pThis .if framedump == SET invoke log, 1, offset HAddRef, dword ptr [ebp+4], eax, pThis .endif ret qxAddRefHook endp ; ########################################################################## qxReleaseHook proc pThis:dword invoke qxRelease, pThis .if framedump == SET invoke log, 1, offset HRelease, dword ptr [ebp+4], eax, pThis .endif ret qxReleaseHook endp ; ########################################################################## qxGetDeviceHook proc pThis:dword, ppDevice:dword invoke qxGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset HGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret qxGetDeviceHook endp ; ########################################################################## qxGetTypeHook proc pThis:dword invoke qxGetType, pThis .if framedump == SET invoke log, 1, offset HGetType, dword ptr [ebp+4], eax, pThis .endif ret qxGetTypeHook endp ; ########################################################################## qxGetDataSizeHook proc pThis:dword invoke qxGetDataSize, pThis .if framedump == SET invoke log, 1, offset HGetDataSize, dword ptr [ebp+4], eax, pThis .endif ret qxGetDataSizeHook endp ; ########################################################################## qxIssueHook proc pThis:dword, ppDevice:dword invoke qxIssue, pThis, ppDevice .if framedump == SET invoke log, 2, offset HIssue, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret qxIssueHook endp ; ########################################################################## qxGetDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke qxGetData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset HGetData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret qxGetDataHook endp ; ########################################################################## sbQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke sbQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset UQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret sbQueryInterfaceHook endp ; ########################################################################## sbAddRefHook proc pThis:dword invoke sbAddRef, pThis .if framedump == SET invoke log, 1, offset UAddRef, dword ptr [ebp+4], eax, pThis .endif ret sbAddRefHook endp ; ########################################################################## sbReleaseHook proc pThis:dword invoke sbRelease, pThis .if framedump == SET invoke log, 1, offset URelease, dword ptr [ebp+4], eax, pThis .endif ret sbReleaseHook endp ; ########################################################################## sbGetDeviceHook proc pThis:dword, ppDevice:dword invoke sbGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset UGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret sbGetDeviceHook endp ; ########################################################################## sbCaptureHook proc pThis:dword invoke sbCapture, pThis .if framedump == SET invoke log, 1, offset UCapture, dword ptr [ebp+4], eax, pThis .endif ret sbCaptureHook endp ; ########################################################################## sbApplyHook proc pThis:dword invoke sbApply, pThis .if framedump == SET invoke log, 1, offset UApply, dword ptr [ebp+4], eax, pThis .endif ret sbApplyHook endp ; ########################################################################## seQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke seQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset FQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret seQueryInterfaceHook endp ; ########################################################################## seAddRefHook proc pThis:dword invoke seAddRef, pThis .if framedump == SET invoke log, 1, offset FAddRef, dword ptr [ebp+4], eax, pThis .endif ret seAddRefHook endp ; ########################################################################## seReleaseHook proc pThis:dword invoke seRelease, pThis .if framedump == SET invoke log, 1, offset FRelease, dword ptr [ebp+4], eax, pThis .endif ret seReleaseHook endp ; ########################################################################## seGetDeviceHook proc pThis:dword, ppDevice:dword invoke seGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset FGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret seGetDeviceHook endp ; ########################################################################## seSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke seSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset FSetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret seSetPrivateDataHook endp ; ########################################################################## seGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke seGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset FGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret seGetPrivateDataHook endp ; ########################################################################## seFreePrivateDataHook proc pThis:dword, refguid:dword invoke seFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset FFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret seFreePrivateDataHook endp ; ########################################################################## seSetPriorityHook proc pThis:dword, PriorityNew:dword invoke seSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset FSetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret seSetPriorityHook endp ; ########################################################################## seGetPriorityHook proc pThis:dword invoke seGetPriority, pThis .if framedump == SET invoke log, 1, offset FGetPriority, dword ptr [ebp+4], eax, pThis .endif ret seGetPriorityHook endp ; ########################################################################## sePreLoadHook proc pThis:dword invoke sePreLoad, pThis .if framedump == SET invoke log, 1, offset FPreLoad, dword ptr [ebp+4], eax, pThis .endif ret sePreLoadHook endp ; ########################################################################## seGetTypeHook proc pThis:dword invoke seGetType, pThis .if framedump == SET invoke log, 1, offset FGetType, dword ptr [ebp+4], eax, pThis .endif ret seGetTypeHook endp ; ########################################################################## seGetContainerHook proc pThis:dword, riid:dword, ppContainer:dword invoke seGetContainer, pThis, riid, ppContainer .if framedump == SET invoke log, 3, offset FGetContainer, dword ptr [ebp+4], eax, pThis, riid, ppContainer .endif ret seGetContainerHook endp ; ########################################################################## seGetDescHook proc pThis:dword, pDesc:dword invoke seGetDesc, pThis, pDesc .if framedump == SET invoke log, 2, offset FGetDesc, dword ptr [ebp+4], eax, pThis, pDesc .endif ret seGetDescHook endp ; ########################################################################## seLockRectHook proc pThis:dword, pLockedRect:dword, pRect:dword, Flags:dword invoke seLockRect, pThis, pLockedRect, pRect, Flags .if framedump == SET invoke log, 4, offset FLockRect, dword ptr [ebp+4], eax, pThis, pLockedRect, pRect, Flags .endif ret seLockRectHook endp ; ########################################################################## seUnlockRectHook proc pThis:dword invoke seUnlockRect, pThis .if framedump == SET invoke log, 1, offset FUnlockRect, dword ptr [ebp+4], eax, pThis .endif ret seUnlockRectHook endp ; ########################################################################## seGetDCHook proc pThis:dword, phdc:dword invoke seGetDC, pThis, phdc .if framedump == SET invoke log, 2, offset FGetDC, dword ptr [ebp+4], eax, pThis, phdc .endif ret seGetDCHook endp ; ########################################################################## seReleaseDCHook proc pThis:dword, hdc:dword invoke seReleaseDC, pThis, hdc .if framedump == SET invoke log, 2, offset FReleaseDC, dword ptr [ebp+4], eax, pThis, hdc .endif ret seReleaseDCHook endp ; ########################################################################## scQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke scQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset VQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret scQueryInterfaceHook endp ; ########################################################################## scAddRefHook proc pThis:dword invoke scAddRef, pThis .if framedump == SET invoke log, 1, offset VAddRef, dword ptr [ebp+4], eax, pThis .endif ret scAddRefHook endp ; ########################################################################## scReleaseHook proc pThis:dword invoke scRelease, pThis .if framedump == SET invoke log, 1, offset VRelease, dword ptr [ebp+4], eax, pThis .endif ret scReleaseHook endp ; ########################################################################## scPresentHook proc pThis:dword, pSourceRect:dword, pDestRect:dword, hDestWindowOverride:dword, pDirtyRegion:dword, dwFlags:dword invoke scPresent, pThis, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags .if framedump == SET invoke log, 6, offset VPresent, dword ptr [ebp+4], eax, pThis, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags .endif ret scPresentHook endp ; ########################################################################## scGetFrontBufferDataHook proc pThis:dword, pDestSurface:dword invoke scGetFrontBufferData, pThis, pDestSurface .if framedump == SET invoke log, 2, offset VGetFrontBufferData, dword ptr [ebp+4], eax, pThis, pDestSurface .endif ret scGetFrontBufferDataHook endp ; ########################################################################## scGetBackBufferHook proc pThis:dword, iBackBuffer:dword, pType:dword, ppBackBuffer:dword invoke scGetBackBuffer, pThis, iBackBuffer, pType, ppBackBuffer .if framedump == SET invoke log, 4, offset VGetBackBuffer, dword ptr [ebp+4], eax, pThis, iBackBuffer, pType, ppBackBuffer .endif ret scGetBackBufferHook endp ; ########################################################################## scGetRasterStatusHook proc pThis:dword, pDestSurface:dword invoke scGetRasterStatus, pThis, pDestSurface .if framedump == SET invoke log, 2, offset VGetRasterStatus, dword ptr [ebp+4], eax, pThis, pDestSurface .endif ret scGetRasterStatusHook endp ; ########################################################################## scGetDisplayModeHook proc pThis:dword, pDestSurface:dword invoke scGetDisplayMode, pThis, pDestSurface .if framedump == SET invoke log, 2, offset VGetDisplayMode, dword ptr [ebp+4], eax, pThis, pDestSurface .endif ret scGetDisplayModeHook endp ; ########################################################################## scGetDeviceHook proc pThis:dword, pDestSurface:dword invoke scGetDevice, pThis, pDestSurface .if framedump == SET invoke log, 2, offset VGetDevice, dword ptr [ebp+4], eax, pThis, pDestSurface .endif ret scGetDeviceHook endp ; ########################################################################## scGetPresentParametersHook proc pThis:dword, pDestSurface:dword invoke scGetPresentParameters, pThis, pDestSurface .if framedump == SET invoke log, 2, offset VGetPresentParameters, dword ptr [ebp+4], eax, pThis, pDestSurface .endif ret scGetPresentParametersHook endp ; ########################################################################## vlQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke vlQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset DQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret vlQueryInterfaceHook endp ; ########################################################################## vlAddRefHook proc pThis:dword invoke vlAddRef, pThis .if framedump == SET invoke log, 1, offset DAddRef, dword ptr [ebp+4], eax, pThis .endif ret vlAddRefHook endp ; ########################################################################## vlReleaseHook proc pThis:dword invoke vlRelease, pThis .if framedump == SET invoke log, 1, offset DRelease, dword ptr [ebp+4], eax, pThis .endif ret vlReleaseHook endp ; ########################################################################## vlGetDeviceHook proc pThis:dword, ppDevice:dword invoke vlGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset DGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vlGetDeviceHook endp ; ########################################################################## vlSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke vlSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset DSetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret vlSetPrivateDataHook endp ; ########################################################################## vlGetPrivateDataHook proc pThis:dword, iBackBuffer:dword, pType:dword, ppBackBuffer:dword invoke vlGetPrivateData, pThis, iBackBuffer, pType, ppBackBuffer .if framedump == SET invoke log, 4, offset DGetPrivateData, dword ptr [ebp+4], eax, pThis, iBackBuffer, pType, ppBackBuffer .endif ret vlGetPrivateDataHook endp ; ########################################################################## vlFreePrivateDataHook proc pThis:dword, ppDevice:dword invoke vlFreePrivateData, pThis, ppDevice .if framedump == SET invoke log, 2, offset DFreePrivateData, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vlFreePrivateDataHook endp ; ########################################################################## vlSetPriorityHook proc pThis:dword, ppDevice:dword invoke vlSetPriority, pThis, ppDevice .if framedump == SET invoke log, 2, offset DSetPriority, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vlSetPriorityHook endp ; ########################################################################## vlGetPriorityHook proc pThis:dword invoke vlGetPriority, pThis .if framedump == SET invoke log, 1, offset DGetPriority, dword ptr [ebp+4], eax, pThis .endif ret vlGetPriorityHook endp ; ########################################################################## vlPreLoadHook proc pThis:dword invoke vlPreLoad, pThis .if framedump == SET invoke log, 1, offset DPreLoad, dword ptr [ebp+4], eax, pThis .endif ret vlPreLoadHook endp ; ########################################################################## vlGetTypeHook proc pThis:dword invoke vlGetType, pThis .if framedump == SET invoke log, 1, offset DGetType, dword ptr [ebp+4], eax, pThis .endif ret vlGetTypeHook endp ; ########################################################################## vlLockHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke vlLock, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset DLock, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret vlLockHook endp ; ########################################################################## vlUnlockHook proc pThis:dword invoke vlUnlock, pThis .if framedump == SET invoke log, 1, offset DUnlock, dword ptr [ebp+4], eax, pThis .endif ret vlUnlockHook endp ; ########################################################################## vlGetDescHook proc pThis:dword, ppDevice:dword invoke vlGetDesc, pThis, ppDevice .if framedump == SET invoke log, 2, offset DGetDesc, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vlGetDescHook endp ; ########################################################################## vdQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke vdQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset XQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret vdQueryInterfaceHook endp ; ########################################################################## vdAddRefHook proc pThis:dword invoke vdAddRef, pThis .if framedump == SET invoke log, 1, offset XAddRef, dword ptr [ebp+4], eax, pThis .endif ret vdAddRefHook endp ; ########################################################################## vdReleaseHook proc pThis:dword invoke vdRelease, pThis .if framedump == SET invoke log, 1, offset XRelease, dword ptr [ebp+4], eax, pThis .endif ret vdReleaseHook endp ; ########################################################################## vdGetDeviceHook proc pThis:dword, ppDevice:dword invoke vdGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset XGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vdGetDeviceHook endp ; ########################################################################## vdGetDeclarationHook proc pThis:dword, pElement:dword, pNumElements:dword invoke vdGetDeclaration, pThis, pElement, pNumElements .if framedump == SET invoke log, 3, offset XGetDeclaration, dword ptr [ebp+4], eax, pThis, pElement, pNumElements .endif ret vdGetDeclarationHook endp ; ########################################################################## vaQueryInterfaceHook proc pThis:dword, riid:dword, ppvObj:dword invoke vaQueryInterface, pThis, riid, ppvObj .if framedump == SET invoke log, 3, offset BQueryInterface, dword ptr [ebp+4], eax, pThis, riid, ppvObj .endif ret vaQueryInterfaceHook endp ; ########################################################################## vaAddRefHook proc pThis:dword invoke vaAddRef, pThis .if framedump == SET invoke log, 1, offset BAddRef, dword ptr [ebp+4], eax, pThis .endif ret vaAddRefHook endp ; ########################################################################## vaReleaseHook proc pThis:dword invoke vaRelease, pThis .if framedump == SET invoke log, 1, offset BRelease, dword ptr [ebp+4], eax, pThis .endif ret vaReleaseHook endp ; ########################################################################## vaGetDeviceHook proc pThis:dword, ppDevice:dword invoke vaGetDevice, pThis, ppDevice .if framedump == SET invoke log, 2, offset BGetDevice, dword ptr [ebp+4], eax, pThis, ppDevice .endif ret vaGetDeviceHook endp ; ########################################################################## vaSetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, SizeOfData:dword, Flags:dword invoke vaSetPrivateData, pThis, refguid, pData, SizeOfData, Flags .if framedump == SET invoke log, 5, offset BSetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, SizeOfData, Flags .endif ret vaSetPrivateDataHook endp ; ########################################################################## vaGetPrivateDataHook proc pThis:dword, refguid:dword, pData:dword, pSizeOfData:dword invoke vaGetPrivateData, pThis, refguid, pData, pSizeOfData .if framedump == SET invoke log, 4, offset BGetPrivateData, dword ptr [ebp+4], eax, pThis, refguid, pData, pSizeOfData .endif ret vaGetPrivateDataHook endp ; ########################################################################## vaFreePrivateDataHook proc pThis:dword, refguid:dword invoke vaFreePrivateData, pThis, refguid .if framedump == SET invoke log, 2, offset BFreePrivateData, dword ptr [ebp+4], eax, pThis, refguid .endif ret vaFreePrivateDataHook endp ; ########################################################################## vaSetPriorityHook proc pThis:dword, PriorityNew:dword invoke vaSetPriority, pThis, PriorityNew .if framedump == SET invoke log, 2, offset BSetPriority, dword ptr [ebp+4], eax, pThis, PriorityNew .endif ret vaSetPriorityHook endp ; ########################################################################## vaGetPriorityHook proc pThis:dword invoke vaGetPriority, pThis .if framedump == SET invoke log, 1, offset BGetPriority, dword ptr [ebp+4], eax, pThis .endif ret vaGetPriorityHook endp ; ########################################################################## vaPreLoadHook proc pThis:dword invoke vaPreLoad, pThis .if framedump == SET invoke log, 1, offset BPreLoad, dword ptr [ebp+4], eax, pThis .endif ret vaPreLoadHook endp ; ########################################################################## vaGetTypeHook proc pThis:dword invoke vaGetType, pThis .if framedump == SET invoke log, 1, offset BGetType, dword ptr [ebp+4], eax, pThis .endif ret vaGetTypeHook endp ; ########################################################################## vaSetLODHook proc pThis:dword invoke vaSetLOD, pThis .if framedump == SET invoke log, 1, offset BSetLOD, dword ptr [ebp+4], eax, pThis .endif ret vaSetLODHook endp ; ########################################################################## vaGetLODHook proc pThis:dword invoke vaGetLOD, pThis .if framedump == SET invoke log, 1, offset BGetLOD, dword ptr [ebp+4], eax, pThis .endif ret vaGetLODHook endp ; ########################################################################## vaGetLevelCountHook proc pThis:dword invoke vaGetLevelCount, pThis .if framedump == SET invoke log, 1, offset BGetLevelCount, dword ptr [ebp+4], eax, pThis .endif ret vaGetLevelCountHook endp ; ########################################################################## vaSetAutoGenFilterTypeHook proc pThis:dword, FilterType:dword invoke vaSetAutoGenFilterType, pThis, FilterType .if framedump == SET invoke log, 2, offset BSetAutoGenFilterType, dword ptr [ebp+4], eax, pThis, FilterType .endif ret vaSetAutoGenFilterTypeHook endp ; ########################################################################## vaGetAutoGenFilterTypeHook proc pThis:dword invoke vaGetAutoGenFilterType, pThis .if framedump == SET invoke log, 1, offset BGetAutoGenFilterType, dword ptr [ebp+4], eax, pThis .endif ret vaGetAutoGenFilterTypeHook endp ; ########################################################################## vaGenerateMipSubLevelsHook proc pThis:dword invoke vaGenerateMipSubLevels, pThis .if framedump == SET invoke log, 1, offset BGenerateMipSubLevels, dword ptr [ebp+4], eax, pThis .endif ret vaGenerateMipSubLevelsHook endp ; ########################################################################## vaGetLevelDescHook proc pThis:dword, Level:dword, pDesc:dword invoke vaGetLevelDesc, pThis, Level, pDesc .if framedump == SET invoke log, 3, offset BGetLevelDesc, dword ptr [ebp+4], eax, pThis, Level, pDesc .endif ret vaGetLevelDescHook endp ; ########################################################################## vaGetVolumeLevelHook proc pThis:dword, Level:dword, ppVolumeLevel:dword invoke vaGetVolumeLevel, pThis, Level, ppVolumeLevel .if framedump == SET invoke log, 3, offset BGetVolumeLevel, dword ptr [ebp+4], eax, pThis, Level, ppVolumeLevel .endif ret vaGetVolumeLevelHook endp ; ########################################################################## vaLockBoxHook proc pThis:dword, Level:dword, pLockedVolume:dword, pBox:dword, Flags:dword invoke vaLockBox, pThis, Level, pLockedVolume, pBox, Flags .if framedump == SET invoke log, 5, offset BLockBox, dword ptr [ebp+4], eax, pThis, Level, pLockedVolume, pBox, Flags .endif ret vaLockBoxHook endp ; ########################################################################## vaUnlockBoxHook proc pThis:dword, Level:dword invoke vaUnlockBox, pThis, Level .if framedump == SET invoke log, 2, offset BUnlockBox, dword ptr [ebp+4], eax, pThis, Level .endif ret vaUnlockBoxHook endp ; ########################################################################## vaAddDirtyBoxHook proc pThis:dword, pDirtyBox:dword invoke vaAddDirtyBox, pThis, pDirtyBox .if framedump == SET invoke log, 2, offset BAddDirtyBox, dword ptr [ebp+4], eax, pThis, pDirtyBox .endif ret vaAddDirtyBoxHook endp ; ########################################################################## End LibMain
// -------------------------------------------------------------------------- // OpenMS -- Open-Source Mass Spectrometry // -------------------------------------------------------------------------- // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, // ETH Zurich, and Freie Universitaet Berlin 2002-2017. // // This software is released under a three-clause BSD license: // * 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 any author or any participating institution // may be used to endorse or promote products derived from this software // without specific prior written permission. // For a full list of authors, refer to the file AUTHORS. // -------------------------------------------------------------------------- // 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 ANY OF THE AUTHORS OR THE CONTRIBUTING // INSTITUTIONS 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. // // -------------------------------------------------------------------------- // $Maintainer: Timo Sachsenberg $ // $Authors: Marc Sturm, Clemens Groepl, Chris Bielow $ // -------------------------------------------------------------------------- #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithm.h> // Derived classes are included here #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithmLabeled.h> #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithmUnlabeled.h> #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithmQT.h> #include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithmKD.h> #include <OpenMS/CONCEPT/Factory.h> using namespace std; namespace OpenMS { //register products here void FeatureGroupingAlgorithm::registerChildren() { Factory<FeatureGroupingAlgorithm>::registerProduct(FeatureGroupingAlgorithmLabeled::getProductName(), &FeatureGroupingAlgorithmLabeled::create); Factory<FeatureGroupingAlgorithm>::registerProduct(FeatureGroupingAlgorithmUnlabeled::getProductName(), &FeatureGroupingAlgorithmUnlabeled::create); Factory<FeatureGroupingAlgorithm>::registerProduct(FeatureGroupingAlgorithmQT::getProductName(), &FeatureGroupingAlgorithmQT::create); Factory<FeatureGroupingAlgorithm>::registerProduct(FeatureGroupingAlgorithmKD::getProductName(), &FeatureGroupingAlgorithmKD::create); } FeatureGroupingAlgorithm::FeatureGroupingAlgorithm() : DefaultParamHandler("FeatureGroupingAlgorithm") { } void FeatureGroupingAlgorithm::group(const vector<ConsensusMap>& maps, ConsensusMap& out) { LOG_WARN << "FeatureGroupingAlgorithm::group() does not support ConsensusMaps directly. Converting to FeatureMaps." << endl; vector<FeatureMap> maps_f; for (Size i = 0; i < maps.size(); ++i) { FeatureMap fm; MapConversion::convert(maps[i], true, fm); maps_f.push_back(fm); } // call FeatureMap version of group() group(maps_f, out); } void FeatureGroupingAlgorithm::transferSubelements(const vector<ConsensusMap>& maps, ConsensusMap& out) const { // accumulate file descriptions from the input maps: // cout << "Updating file descriptions..." << endl; out.getFileDescriptions().clear(); // mapping: (map index, original id) -> new id map<pair<Size, UInt64>, Size> mapid_table; for (Size i = 0; i < maps.size(); ++i) { const ConsensusMap& consensus = maps[i]; for (ConsensusMap::FileDescriptions::const_iterator desc_it = consensus.getFileDescriptions().begin(); desc_it != consensus.getFileDescriptions().end(); ++desc_it) { Size counter = mapid_table.size(); mapid_table[make_pair(i, desc_it->first)] = counter; out.getFileDescriptions()[counter] = desc_it->second; } } // look-up table: input map -> unique ID -> consensus feature // cout << "Creating look-up table..." << endl; vector<map<UInt64, ConsensusMap::ConstIterator> > feat_lookup(maps.size()); for (Size i = 0; i < maps.size(); ++i) { const ConsensusMap& consensus = maps[i]; for (ConsensusMap::ConstIterator feat_it = consensus.begin(); feat_it != consensus.end(); ++feat_it) { // do NOT use "id_lookup[i][feat_it->getUniqueId()] = feat_it;" here as // you will get "attempt to copy-construct an iterator from a singular // iterator" in STL debug mode: feat_lookup[i].insert(make_pair(feat_it->getUniqueId(), feat_it)); } } // adjust the consensus features: // cout << "Adjusting consensus features..." << endl; for (ConsensusMap::iterator cons_it = out.begin(); cons_it != out.end(); ++cons_it) { ConsensusFeature adjusted = ConsensusFeature( static_cast<BaseFeature>(*cons_it)); // remove sub-features for (ConsensusFeature::HandleSetType::const_iterator sub_it = cons_it->getFeatures().begin(); sub_it != cons_it->getFeatures().end(); ++sub_it) { UInt64 id = sub_it->getUniqueId(); Size map_index = sub_it->getMapIndex(); ConsensusMap::ConstIterator origin = feat_lookup[map_index][id]; for (ConsensusFeature::HandleSetType::const_iterator handle_it = origin->getFeatures().begin(); handle_it != origin->getFeatures().end(); ++handle_it) { FeatureHandle handle = *handle_it; Size new_id = mapid_table[make_pair(map_index, handle.getMapIndex())]; handle.setMapIndex(new_id); adjusted.insert(handle); } } *cons_it = adjusted; } } FeatureGroupingAlgorithm::~FeatureGroupingAlgorithm() { } }
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/06/pong/Pong.asm // The Pong game program was originally written in the high-level Jack language. // The Jack code was then translated by the Jack compiler into VM code. // The VM code was then translated by the VM translator into the Hack // assembly code shown here. @256 D=A @SP M=D @133 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_EQ D;JNE @SP A=M-1 M=-1 (END_EQ) @R15 A=M 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_GT D;JLE @SP A=M-1 M=-1 (END_GT) @R15 A=M 0;JMP @R15 M=D @SP AM=M-1 D=M A=A-1 D=M-D M=0 @END_LT D;JGE @SP A=M-1 M=-1 (END_LT) @R15 A=M 0;JMP @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 @SP A=M M=D @LCL D=M @SP AM=M+1 M=D @ARG D=M @SP AM=M+1 M=D @THIS D=M @SP AM=M+1 M=D @THAT D=M @SP AM=M+1 M=D @4 D=A @R13 D=D+M @SP D=M-D @ARG M=D @SP MD=M+1 @LCL M=D @R14 A=M 0;JMP @0 D=A @R13 M=D @sys.init D=A @R14 M=D @RET_ADDRESS_CALL0 D=A @95 0;JMP (RET_ADDRESS_CALL0) (ball.new) @15 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL1 D=A @95 0;JMP (RET_ADDRESS_CALL1) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @10 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @THIS D=M @11 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @12 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @THIS D=M @13 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @SP M=M+1 A=M-1 M=0 @THIS D=M @14 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.show D=A @R14 M=D @RET_ADDRESS_CALL2 D=A @95 0;JMP (RET_ADDRESS_CALL2) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (ball.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL3 D=A @95 0;JMP (RET_ADDRESS_CALL3) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ball.show) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL4 D=A @95 0;JMP (RET_ADDRESS_CALL4) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.draw D=A @R14 M=D @RET_ADDRESS_CALL5 D=A @95 0;JMP (RET_ADDRESS_CALL5) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ball.hide) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL6 D=A @95 0;JMP (RET_ADDRESS_CALL6) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.draw D=A @R14 M=D @RET_ADDRESS_CALL7 D=A @95 0;JMP (RET_ADDRESS_CALL7) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ball.draw) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL8 D=A @95 0;JMP (RET_ADDRESS_CALL8) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ball.getleft) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (ball.getright) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @54 0;JMP (ball.setdestination) @3 D=A (LOOP_ball.setdestination) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_ball.setdestination D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL9 D=A @95 0;JMP (RET_ADDRESS_CALL9) @SP AM=M-1 D=M @LCL A=M M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL10 D=A @95 0;JMP (RET_ADDRESS_CALL10) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT0 D=A @38 0;JMP (RET_ADDRESS_LT0) @THIS D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.setdestination$if_true0 D;JNE @ball.setdestination$if_false0 0;JMP (ball.setdestination$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT1 D=A @38 0;JMP (RET_ADDRESS_LT1) @THIS D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT2 D=A @38 0;JMP (RET_ADDRESS_LT2) @THIS D=M @9 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ball.setdestination$if_end0 0;JMP (ball.setdestination$if_false0) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT3 D=A @38 0;JMP (RET_ADDRESS_LT3) @THIS D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT4 D=A @38 0;JMP (RET_ADDRESS_LT4) @THIS D=M @9 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D (ball.setdestination$if_end0) @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL11 D=A @95 0;JMP (RET_ADDRESS_CALL11) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL12 D=A @95 0;JMP (RET_ADDRESS_CALL12) @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL13 D=A @95 0;JMP (RET_ADDRESS_CALL13) @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ball.move) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.hide D=A @R14 M=D @RET_ADDRESS_CALL14 D=A @95 0;JMP (RET_ADDRESS_CALL14) @SP AM=M-1 D=M @R5 M=D @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT5 D=A @38 0;JMP (RET_ADDRESS_LT5) @SP AM=M-1 D=M @ball.move$if_true0 D;JNE @ball.move$if_false0 0;JMP (ball.move$if_true0) @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @ball.move$if_end0 0;JMP (ball.move$if_false0) @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @THIS D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true1 D;JNE @ball.move$if_false1 0;JMP (ball.move$if_true1) @THIS D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true2 D;JNE @ball.move$if_false2 0;JMP (ball.move$if_true2) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M M=D @ball.move$if_end2 0;JMP (ball.move$if_false2) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 M=D (ball.move$if_end2) @ball.move$if_end1 0;JMP (ball.move$if_false1) @THIS D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true3 D;JNE @ball.move$if_false3 0;JMP (ball.move$if_true3) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M M=D @ball.move$if_end3 0;JMP (ball.move$if_false3) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 M=D (ball.move$if_end3) (ball.move$if_end1) (ball.move$if_end0) @THIS D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true4 D;JNE @ball.move$if_false4 0;JMP (ball.move$if_true4) @THIS D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true5 D;JNE @ball.move$if_false5 0;JMP (ball.move$if_true5) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 M=D @ball.move$if_end5 0;JMP (ball.move$if_false5) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M M=D (ball.move$if_end5) @ball.move$if_end4 0;JMP (ball.move$if_false4) @THIS D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ball.move$if_true6 D;JNE @ball.move$if_false6 0;JMP (ball.move$if_true6) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 M=D @ball.move$if_end6 0;JMP (ball.move$if_false6) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M M=D (ball.move$if_end6) (ball.move$if_end4) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT0 D=A @22 0;JMP (RET_ADDRESS_GT0) @SP A=M-1 M=!M @SP AM=M-1 D=M @ball.move$if_true7 D;JNE @ball.move$if_false7 0;JMP (ball.move$if_true7) @SP M=M+1 A=M-1 M=1 @THIS D=M @14 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D (ball.move$if_false7) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @11 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT6 D=A @38 0;JMP (RET_ADDRESS_LT6) @SP A=M-1 M=!M @SP AM=M-1 D=M @ball.move$if_true8 D;JNE @ball.move$if_false8 0;JMP (ball.move$if_true8) @2 D=A @SP AM=M+1 A=A-1 M=D @THIS D=M @14 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @11 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D (ball.move$if_false8) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @12 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT1 D=A @22 0;JMP (RET_ADDRESS_GT1) @SP A=M-1 M=!M @SP AM=M-1 D=M @ball.move$if_true9 D;JNE @ball.move$if_false9 0;JMP (ball.move$if_true9) @3 D=A @SP AM=M+1 A=A-1 M=D @THIS D=M @14 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @12 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D (ball.move$if_false9) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @13 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT7 D=A @38 0;JMP (RET_ADDRESS_LT7) @SP A=M-1 M=!M @SP AM=M-1 D=M @ball.move$if_true10 D;JNE @ball.move$if_false10 0;JMP (ball.move$if_true10) @4 D=A @SP AM=M+1 A=A-1 M=D @THIS D=M @14 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @THIS D=M @13 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D (ball.move$if_false10) @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.show D=A @R14 M=D @RET_ADDRESS_CALL15 D=A @95 0;JMP (RET_ADDRESS_CALL15) @SP AM=M-1 D=M @R5 M=D @THIS D=M @14 A=D+A D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (ball.bounce) @5 D=A (LOOP_ball.bounce) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_ball.bounce D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL16 D=A @95 0;JMP (RET_ADDRESS_CALL16) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL17 D=A @95 0;JMP (RET_ADDRESS_CALL17) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ0 D=A @6 0;JMP (RET_ADDRESS_EQ0) @SP AM=M-1 D=M @ball.bounce$if_true0 D;JNE @ball.bounce$if_false0 0;JMP (ball.bounce$if_true0) @10 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ball.bounce$if_end0 0;JMP (ball.bounce$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT8 D=A @38 0;JMP (RET_ADDRESS_LT8) @SP A=M-1 M=!M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @RET_ADDRESS_EQ1 D=A @6 0;JMP (RET_ADDRESS_EQ1) @SP AM=M-1 D=M A=A-1 M=D&M @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT9 D=A @38 0;JMP (RET_ADDRESS_LT9) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_EQ2 D=A @6 0;JMP (RET_ADDRESS_EQ2) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @ball.bounce$if_true1 D;JNE @ball.bounce$if_false1 0;JMP (ball.bounce$if_true1) @20 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ball.bounce$if_end1 0;JMP (ball.bounce$if_false1) @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D (ball.bounce$if_end1) (ball.bounce$if_end0) @THIS D=M @14 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @RET_ADDRESS_EQ3 D=A @6 0;JMP (RET_ADDRESS_EQ3) @SP AM=M-1 D=M @ball.bounce$if_true2 D;JNE @ball.bounce$if_false2 0;JMP (ball.bounce$if_true2) @506 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @50 D=A @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL18 D=A @95 0;JMP (RET_ADDRESS_CALL18) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL19 D=A @95 0;JMP (RET_ADDRESS_CALL19) @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL20 D=A @95 0;JMP (RET_ADDRESS_CALL20) @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @ball.bounce$if_end2 0;JMP (ball.bounce$if_false2) @THIS D=M @14 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ4 D=A @6 0;JMP (RET_ADDRESS_EQ4) @SP AM=M-1 D=M @ball.bounce$if_true3 D;JNE @ball.bounce$if_false3 0;JMP (ball.bounce$if_true3) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @50 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL21 D=A @95 0;JMP (RET_ADDRESS_CALL21) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL22 D=A @95 0;JMP (RET_ADDRESS_CALL22) @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL23 D=A @95 0;JMP (RET_ADDRESS_CALL23) @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @ball.bounce$if_end3 0;JMP (ball.bounce$if_false3) @THIS D=M @14 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ5 D=A @6 0;JMP (RET_ADDRESS_EQ5) @SP AM=M-1 D=M @ball.bounce$if_true4 D;JNE @ball.bounce$if_false4 0;JMP (ball.bounce$if_true4) @250 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @25 D=A @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL24 D=A @95 0;JMP (RET_ADDRESS_CALL24) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL25 D=A @95 0;JMP (RET_ADDRESS_CALL25) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL26 D=A @95 0;JMP (RET_ADDRESS_CALL26) @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @ball.bounce$if_end4 0;JMP (ball.bounce$if_false4) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @25 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL27 D=A @95 0;JMP (RET_ADDRESS_CALL27) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL28 D=A @95 0;JMP (RET_ADDRESS_CALL28) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL29 D=A @95 0;JMP (RET_ADDRESS_CALL29) @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (ball.bounce$if_end4) (ball.bounce$if_end3) (ball.bounce$if_end2) @THIS D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @ball.setdestination D=A @R14 M=D @RET_ADDRESS_CALL30 D=A @95 0;JMP (RET_ADDRESS_CALL30) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.new) @5 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL31 D=A @95 0;JMP (RET_ADDRESS_CALL31) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.show D=A @R14 M=D @RET_ADDRESS_CALL32 D=A @95 0;JMP (RET_ADDRESS_CALL32) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (bat.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL33 D=A @95 0;JMP (RET_ADDRESS_CALL33) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.show) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL34 D=A @95 0;JMP (RET_ADDRESS_CALL34) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.draw D=A @R14 M=D @RET_ADDRESS_CALL35 D=A @95 0;JMP (RET_ADDRESS_CALL35) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.hide) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL36 D=A @95 0;JMP (RET_ADDRESS_CALL36) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.draw D=A @R14 M=D @RET_ADDRESS_CALL37 D=A @95 0;JMP (RET_ADDRESS_CALL37) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.draw) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL38 D=A @95 0;JMP (RET_ADDRESS_CALL38) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.setdirection) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.getleft) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (bat.getright) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @54 0;JMP (bat.setwidth) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.hide D=A @R14 M=D @RET_ADDRESS_CALL39 D=A @95 0;JMP (RET_ADDRESS_CALL39) @SP AM=M-1 D=M @R5 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.show D=A @R14 M=D @RET_ADDRESS_CALL40 D=A @95 0;JMP (RET_ADDRESS_CALL40) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (bat.move) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @RET_ADDRESS_EQ6 D=A @6 0;JMP (RET_ADDRESS_EQ6) @SP AM=M-1 D=M @bat.move$if_true0 D;JNE @bat.move$if_false0 0;JMP (bat.move$if_true0) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT10 D=A @38 0;JMP (RET_ADDRESS_LT10) @SP AM=M-1 D=M @bat.move$if_true1 D;JNE @bat.move$if_false1 0;JMP (bat.move$if_true1) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M M=D (bat.move$if_false1) @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL41 D=A @95 0;JMP (RET_ADDRESS_CALL41) @SP AM=M-1 D=M @R5 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL42 D=A @95 0;JMP (RET_ADDRESS_CALL42) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL43 D=A @95 0;JMP (RET_ADDRESS_CALL43) @SP AM=M-1 D=M @R5 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL44 D=A @95 0;JMP (RET_ADDRESS_CALL44) @SP AM=M-1 D=M @R5 M=D @bat.move$if_end0 0;JMP (bat.move$if_false0) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT2 D=A @22 0;JMP (RET_ADDRESS_GT2) @SP AM=M-1 D=M @bat.move$if_true2 D;JNE @bat.move$if_false2 0;JMP (bat.move$if_true2) @511 D=A @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M M=D (bat.move$if_false2) @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL45 D=A @95 0;JMP (RET_ADDRESS_CALL45) @SP AM=M-1 D=M @R5 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL46 D=A @95 0;JMP (RET_ADDRESS_CALL46) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @1 D=A @R13 M=D @screen.setcolor D=A @R14 M=D @RET_ADDRESS_CALL47 D=A @95 0;JMP (RET_ADDRESS_CALL47) @SP AM=M-1 D=M @R5 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL48 D=A @95 0;JMP (RET_ADDRESS_CALL48) @SP AM=M-1 D=M @R5 M=D (bat.move$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (main.main) @SP AM=M+1 A=A-1 M=0 @0 D=A @R13 M=D @ponggame.newinstance D=A @R14 M=D @RET_ADDRESS_CALL49 D=A @95 0;JMP (RET_ADDRESS_CALL49) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @ponggame.getinstance D=A @R14 M=D @RET_ADDRESS_CALL50 D=A @95 0;JMP (RET_ADDRESS_CALL50) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ponggame.run D=A @R14 M=D @RET_ADDRESS_CALL51 D=A @95 0;JMP (RET_ADDRESS_CALL51) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ponggame.dispose D=A @R14 M=D @RET_ADDRESS_CALL52 D=A @95 0;JMP (RET_ADDRESS_CALL52) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ponggame.new) @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL53 D=A @95 0;JMP (RET_ADDRESS_CALL53) @SP AM=M-1 D=M @THIS M=D @0 D=A @R13 M=D @screen.clearscreen D=A @R14 M=D @RET_ADDRESS_CALL54 D=A @95 0;JMP (RET_ADDRESS_CALL54) @SP AM=M-1 D=M @R5 M=D @50 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @230 D=A @SP AM=M+1 A=A-1 M=D @229 D=A @SP AM=M+1 A=A-1 M=D @THIS D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @bat.new D=A @R14 M=D @RET_ADDRESS_CALL55 D=A @95 0;JMP (RET_ADDRESS_CALL55) @SP AM=M-1 D=M @THIS A=M M=D @253 D=A @SP AM=M+1 A=A-1 M=D @222 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @511 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @229 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @R13 M=D @ball.new D=A @R14 M=D @RET_ADDRESS_CALL56 D=A @95 0;JMP (RET_ADDRESS_CALL56) @SP AM=M-1 D=M @THIS A=M+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @400 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @3 D=A @R13 M=D @ball.setdestination D=A @R14 M=D @RET_ADDRESS_CALL57 D=A @95 0;JMP (RET_ADDRESS_CALL57) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @238 D=A @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @240 D=A @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawrectangle D=A @R14 M=D @RET_ADDRESS_CALL58 D=A @95 0;JMP (RET_ADDRESS_CALL58) @SP AM=M-1 D=M @R5 M=D @22 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL59 D=A @95 0;JMP (RET_ADDRESS_CALL59) @SP AM=M-1 D=M @R5 M=D @8 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL60 D=A @95 0;JMP (RET_ADDRESS_CALL60) @83 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL61 D=A @95 0;JMP (RET_ADDRESS_CALL61) @99 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL62 D=A @95 0;JMP (RET_ADDRESS_CALL62) @111 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL63 D=A @95 0;JMP (RET_ADDRESS_CALL63) @114 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL64 D=A @95 0;JMP (RET_ADDRESS_CALL64) @101 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL65 D=A @95 0;JMP (RET_ADDRESS_CALL65) @58 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL66 D=A @95 0;JMP (RET_ADDRESS_CALL66) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL67 D=A @95 0;JMP (RET_ADDRESS_CALL67) @48 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL68 D=A @95 0;JMP (RET_ADDRESS_CALL68) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL69 D=A @95 0;JMP (RET_ADDRESS_CALL69) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (ponggame.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.dispose D=A @R14 M=D @RET_ADDRESS_CALL70 D=A @95 0;JMP (RET_ADDRESS_CALL70) @SP AM=M-1 D=M @R5 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.dispose D=A @R14 M=D @RET_ADDRESS_CALL71 D=A @95 0;JMP (RET_ADDRESS_CALL71) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL72 D=A @95 0;JMP (RET_ADDRESS_CALL72) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ponggame.newinstance) @0 D=A @R13 M=D @ponggame.new D=A @R14 M=D @RET_ADDRESS_CALL73 D=A @95 0;JMP (RET_ADDRESS_CALL73) @SP AM=M-1 D=M @ponggame.0 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (ponggame.getinstance) @ponggame.0 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (ponggame.run) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D (ponggame.run$while_exp0) @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @ponggame.run$while_end0 D;JNE (ponggame.run$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ7 D=A @6 0;JMP (RET_ADDRESS_EQ7) @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP A=M-1 M=!M @SP AM=M-1 D=M @ponggame.run$while_end1 D;JNE @0 D=A @R13 M=D @keyboard.keypressed D=A @R14 M=D @RET_ADDRESS_CALL74 D=A @95 0;JMP (RET_ADDRESS_CALL74) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.move D=A @R14 M=D @RET_ADDRESS_CALL75 D=A @95 0;JMP (RET_ADDRESS_CALL75) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ponggame.moveball D=A @R14 M=D @RET_ADDRESS_CALL76 D=A @95 0;JMP (RET_ADDRESS_CALL76) @SP AM=M-1 D=M @R5 M=D @ponggame.run$while_exp1 0;JMP (ponggame.run$while_end1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @130 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ8 D=A @6 0;JMP (RET_ADDRESS_EQ8) @SP AM=M-1 D=M @ponggame.run$if_true0 D;JNE @ponggame.run$if_false0 0;JMP (ponggame.run$if_true0) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @2 D=A @R13 M=D @bat.setdirection D=A @R14 M=D @RET_ADDRESS_CALL77 D=A @95 0;JMP (RET_ADDRESS_CALL77) @SP AM=M-1 D=M @R5 M=D @ponggame.run$if_end0 0;JMP (ponggame.run$if_false0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @132 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ9 D=A @6 0;JMP (RET_ADDRESS_EQ9) @SP AM=M-1 D=M @ponggame.run$if_true1 D;JNE @ponggame.run$if_false1 0;JMP (ponggame.run$if_true1) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @bat.setdirection D=A @R14 M=D @RET_ADDRESS_CALL78 D=A @95 0;JMP (RET_ADDRESS_CALL78) @SP AM=M-1 D=M @R5 M=D @ponggame.run$if_end1 0;JMP (ponggame.run$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @140 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ10 D=A @6 0;JMP (RET_ADDRESS_EQ10) @SP AM=M-1 D=M @ponggame.run$if_true2 D;JNE @ponggame.run$if_false2 0;JMP (ponggame.run$if_true2) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D (ponggame.run$if_false2) (ponggame.run$if_end1) (ponggame.run$if_end0) (ponggame.run$while_exp2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ11 D=A @6 0;JMP (RET_ADDRESS_EQ11) @SP A=M-1 M=!M @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP A=M-1 M=!M @SP AM=M-1 D=M @ponggame.run$while_end2 D;JNE @0 D=A @R13 M=D @keyboard.keypressed D=A @R14 M=D @RET_ADDRESS_CALL79 D=A @95 0;JMP (RET_ADDRESS_CALL79) @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.move D=A @R14 M=D @RET_ADDRESS_CALL80 D=A @95 0;JMP (RET_ADDRESS_CALL80) @SP AM=M-1 D=M @R5 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ponggame.moveball D=A @R14 M=D @RET_ADDRESS_CALL81 D=A @95 0;JMP (RET_ADDRESS_CALL81) @SP AM=M-1 D=M @R5 M=D @ponggame.run$while_exp2 0;JMP (ponggame.run$while_end2) @ponggame.run$while_exp0 0;JMP (ponggame.run$while_end0) @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ponggame.run$if_true3 D;JNE @ponggame.run$if_false3 0;JMP (ponggame.run$if_true3) @10 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL82 D=A @95 0;JMP (RET_ADDRESS_CALL82) @SP AM=M-1 D=M @R5 M=D @9 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL83 D=A @95 0;JMP (RET_ADDRESS_CALL83) @71 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL84 D=A @95 0;JMP (RET_ADDRESS_CALL84) @97 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL85 D=A @95 0;JMP (RET_ADDRESS_CALL85) @109 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL86 D=A @95 0;JMP (RET_ADDRESS_CALL86) @101 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL87 D=A @95 0;JMP (RET_ADDRESS_CALL87) @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL88 D=A @95 0;JMP (RET_ADDRESS_CALL88) @79 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL89 D=A @95 0;JMP (RET_ADDRESS_CALL89) @118 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL90 D=A @95 0;JMP (RET_ADDRESS_CALL90) @101 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL91 D=A @95 0;JMP (RET_ADDRESS_CALL91) @114 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL92 D=A @95 0;JMP (RET_ADDRESS_CALL92) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL93 D=A @95 0;JMP (RET_ADDRESS_CALL93) @SP AM=M-1 D=M @R5 M=D (ponggame.run$if_false3) @SP M=M+1 A=M-1 M=0 @54 0;JMP (ponggame.moveball) @5 D=A (LOOP_ponggame.moveball) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_ponggame.moveball D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.move D=A @R14 M=D @RET_ADDRESS_CALL94 D=A @95 0;JMP (RET_ADDRESS_CALL94) @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT3 D=A @22 0;JMP (RET_ADDRESS_GT3) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ12 D=A @6 0;JMP (RET_ADDRESS_EQ12) @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @ponggame.moveball$if_true0 D;JNE @ponggame.moveball$if_false0 0;JMP (ponggame.moveball$if_true0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.getleft D=A @R14 M=D @RET_ADDRESS_CALL95 D=A @95 0;JMP (RET_ADDRESS_CALL95) @SP AM=M-1 D=M @LCL A=M+1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @bat.getright D=A @R14 M=D @RET_ADDRESS_CALL96 D=A @95 0;JMP (RET_ADDRESS_CALL96) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.getleft D=A @R14 M=D @RET_ADDRESS_CALL97 D=A @95 0;JMP (RET_ADDRESS_CALL97) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @ball.getright D=A @R14 M=D @RET_ADDRESS_CALL98 D=A @95 0;JMP (RET_ADDRESS_CALL98) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ13 D=A @6 0;JMP (RET_ADDRESS_EQ13) @SP AM=M-1 D=M @ponggame.moveball$if_true1 D;JNE @ponggame.moveball$if_false1 0;JMP (ponggame.moveball$if_true1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT4 D=A @22 0;JMP (RET_ADDRESS_GT4) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT11 D=A @38 0;JMP (RET_ADDRESS_LT11) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 M=D @THIS D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @ponggame.moveball$if_true2 D;JNE @ponggame.moveball$if_false2 0;JMP (ponggame.moveball$if_true2) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @RET_ADDRESS_LT12 D=A @38 0;JMP (RET_ADDRESS_LT12) @SP AM=M-1 D=M @ponggame.moveball$if_true3 D;JNE @ponggame.moveball$if_false3 0;JMP (ponggame.moveball$if_true3) @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M M=D @ponggame.moveball$if_end3 0;JMP (ponggame.moveball$if_false3) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @RET_ADDRESS_GT5 D=A @22 0;JMP (RET_ADDRESS_GT5) @SP AM=M-1 D=M @ponggame.moveball$if_true4 D;JNE @ponggame.moveball$if_false4 0;JMP (ponggame.moveball$if_true4) @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @LCL A=M M=D (ponggame.moveball$if_false4) (ponggame.moveball$if_end3) @THIS D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @bat.setwidth D=A @R14 M=D @RET_ADDRESS_CALL99 D=A @95 0;JMP (RET_ADDRESS_CALL99) @SP AM=M-1 D=M @R5 M=D @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 A=A+1 A=A+1 M=D @22 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @output.movecursor D=A @R14 M=D @RET_ADDRESS_CALL100 D=A @95 0;JMP (RET_ADDRESS_CALL100) @SP AM=M-1 D=M @R5 M=D @THIS D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL101 D=A @95 0;JMP (RET_ADDRESS_CALL101) @SP AM=M-1 D=M @R5 M=D (ponggame.moveball$if_false2) (ponggame.moveball$if_false1) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @ball.bounce D=A @R14 M=D @RET_ADDRESS_CALL102 D=A @95 0;JMP (RET_ADDRESS_CALL102) @SP AM=M-1 D=M @R5 M=D (ponggame.moveball$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (array.new) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT6 D=A @22 0;JMP (RET_ADDRESS_GT6) @SP A=M-1 M=!M @SP AM=M-1 D=M @array.new$if_true0 D;JNE @array.new$if_false0 0;JMP (array.new$if_true0) @2 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL103 D=A @95 0;JMP (RET_ADDRESS_CALL103) @SP AM=M-1 D=M @R5 M=D (array.new$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL104 D=A @95 0;JMP (RET_ADDRESS_CALL104) @54 0;JMP (array.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL105 D=A @95 0;JMP (RET_ADDRESS_CALL105) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (keyboard.init) @SP M=M+1 A=M-1 M=0 @54 0;JMP (keyboard.keypressed) @24576 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.peek D=A @R14 M=D @RET_ADDRESS_CALL106 D=A @95 0;JMP (RET_ADDRESS_CALL106) @54 0;JMP (keyboard.readchar) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @SP M=M+1 A=M-1 M=0 @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL107 D=A @95 0;JMP (RET_ADDRESS_CALL107) @SP AM=M-1 D=M @R5 M=D (keyboard.readchar$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ14 D=A @6 0;JMP (RET_ADDRESS_EQ14) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT7 D=A @22 0;JMP (RET_ADDRESS_GT7) @SP AM=M-1 D=M A=A-1 M=D|M @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readchar$while_end0 D;JNE @0 D=A @R13 M=D @keyboard.keypressed D=A @R14 M=D @RET_ADDRESS_CALL108 D=A @95 0;JMP (RET_ADDRESS_CALL108) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT8 D=A @22 0;JMP (RET_ADDRESS_GT8) @SP AM=M-1 D=M @keyboard.readchar$if_true0 D;JNE @keyboard.readchar$if_false0 0;JMP (keyboard.readchar$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D (keyboard.readchar$if_false0) @keyboard.readchar$while_exp0 0;JMP (keyboard.readchar$while_end0) @0 D=A @R13 M=D @string.backspace D=A @R14 M=D @RET_ADDRESS_CALL109 D=A @95 0;JMP (RET_ADDRESS_CALL109) @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL110 D=A @95 0;JMP (RET_ADDRESS_CALL110) @SP AM=M-1 D=M @R5 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL111 D=A @95 0;JMP (RET_ADDRESS_CALL111) @SP AM=M-1 D=M @R5 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (keyboard.readline) @5 D=A (LOOP_keyboard.readline) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_keyboard.readline D;JGT @80 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL112 D=A @95 0;JMP (RET_ADDRESS_CALL112) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL113 D=A @95 0;JMP (RET_ADDRESS_CALL113) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @string.newline D=A @R14 M=D @RET_ADDRESS_CALL114 D=A @95 0;JMP (RET_ADDRESS_CALL114) @SP AM=M-1 D=M @LCL A=M+1 M=D @0 D=A @R13 M=D @string.backspace D=A @R14 M=D @RET_ADDRESS_CALL115 D=A @95 0;JMP (RET_ADDRESS_CALL115) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (keyboard.readline$while_exp0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readline$while_end0 D;JNE @0 D=A @R13 M=D @keyboard.readchar D=A @R14 M=D @RET_ADDRESS_CALL116 D=A @95 0;JMP (RET_ADDRESS_CALL116) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ15 D=A @6 0;JMP (RET_ADDRESS_EQ15) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @keyboard.readline$if_true0 D;JNE @keyboard.readline$if_false0 0;JMP (keyboard.readline$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ16 D=A @6 0;JMP (RET_ADDRESS_EQ16) @SP AM=M-1 D=M @keyboard.readline$if_true1 D;JNE @keyboard.readline$if_false1 0;JMP (keyboard.readline$if_true1) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.eraselastchar D=A @R14 M=D @RET_ADDRESS_CALL117 D=A @95 0;JMP (RET_ADDRESS_CALL117) @SP AM=M-1 D=M @R5 M=D @keyboard.readline$if_end1 0;JMP (keyboard.readline$if_false1) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL118 D=A @95 0;JMP (RET_ADDRESS_CALL118) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (keyboard.readline$if_end1) (keyboard.readline$if_false0) @keyboard.readline$while_exp0 0;JMP (keyboard.readline$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (keyboard.readint) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @keyboard.readline D=A @R14 M=D @RET_ADDRESS_CALL119 D=A @95 0;JMP (RET_ADDRESS_CALL119) @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.intvalue D=A @R14 M=D @RET_ADDRESS_CALL120 D=A @95 0;JMP (RET_ADDRESS_CALL120) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.dispose D=A @R14 M=D @RET_ADDRESS_CALL121 D=A @95 0;JMP (RET_ADDRESS_CALL121) @SP AM=M-1 D=M @R5 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.init) @SP AM=M+1 A=A-1 M=0 @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL122 D=A @95 0;JMP (RET_ADDRESS_CALL122) @SP AM=M-1 D=M @math.1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL123 D=A @95 0;JMP (RET_ADDRESS_CALL123) @SP AM=M-1 D=M @math.0 M=D @SP M=M+1 A=M-1 M=0 @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (math.init$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT13 D=A @38 0;JMP (RET_ADDRESS_LT13) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.init$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @math.init$while_exp0 0;JMP (math.init$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (math.abs) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT14 D=A @38 0;JMP (RET_ADDRESS_LT14) @SP AM=M-1 D=M @math.abs$if_true0 D;JNE @math.abs$if_false0 0;JMP (math.abs$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @ARG A=M M=D (math.abs$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.multiply) @5 D=A (LOOP_math.multiply) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_math.multiply D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT15 D=A @38 0;JMP (RET_ADDRESS_LT15) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT9 D=A @22 0;JMP (RET_ADDRESS_GT9) @SP AM=M-1 D=M A=A-1 M=D&M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT10 D=A @22 0;JMP (RET_ADDRESS_GT10) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT16 D=A @38 0;JMP (RET_ADDRESS_LT16) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL124 D=A @95 0;JMP (RET_ADDRESS_CALL124) @SP AM=M-1 D=M @ARG A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL125 D=A @95 0;JMP (RET_ADDRESS_CALL125) @SP AM=M-1 D=M @ARG A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT17 D=A @38 0;JMP (RET_ADDRESS_LT17) @SP AM=M-1 D=M @math.multiply$if_true0 D;JNE @math.multiply$if_false0 0;JMP (math.multiply$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.multiply$if_false0) (math.multiply$while_exp0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT18 D=A @38 0;JMP (RET_ADDRESS_LT18) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.multiply$while_end0 D;JNE @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT11 D=A @22 0;JMP (RET_ADDRESS_GT11) @SP AM=M-1 D=M @math.multiply$if_true1 D;JNE @math.multiply$if_false1 0;JMP (math.multiply$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (math.multiply$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @ARG A=M M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @math.multiply$while_exp0 0;JMP (math.multiply$while_end0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @math.multiply$if_true2 D;JNE @math.multiply$if_false2 0;JMP (math.multiply$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M M=D (math.multiply$if_false2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.divide) @4 D=A (LOOP_math.divide) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_math.divide D;JGT @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ17 D=A @6 0;JMP (RET_ADDRESS_EQ17) @SP AM=M-1 D=M @math.divide$if_true0 D;JNE @math.divide$if_false0 0;JMP (math.divide$if_true0) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL126 D=A @95 0;JMP (RET_ADDRESS_CALL126) @SP AM=M-1 D=M @R5 M=D (math.divide$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT19 D=A @38 0;JMP (RET_ADDRESS_LT19) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT12 D=A @22 0;JMP (RET_ADDRESS_GT12) @SP AM=M-1 D=M A=A-1 M=D&M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT13 D=A @22 0;JMP (RET_ADDRESS_GT13) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT20 D=A @38 0;JMP (RET_ADDRESS_LT20) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL127 D=A @95 0;JMP (RET_ADDRESS_CALL127) @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL128 D=A @95 0;JMP (RET_ADDRESS_CALL128) @SP AM=M-1 D=M @ARG A=M M=D (math.divide$while_exp0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$while_end0 D;JNE @32767 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT21 D=A @38 0;JMP (RET_ADDRESS_LT21) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true1 D;JNE @math.divide$if_false1 0;JMP (math.divide$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT14 D=A @22 0;JMP (RET_ADDRESS_GT14) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true2 D;JNE @math.divide$if_false2 0;JMP (math.divide$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (math.divide$if_false2) (math.divide$if_false1) @math.divide$while_exp0 0;JMP (math.divide$while_end0) (math.divide$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT15 D=A @22 0;JMP (RET_ADDRESS_GT15) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT16 D=A @22 0;JMP (RET_ADDRESS_GT16) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.divide$if_true3 D;JNE @math.divide$if_false3 0;JMP (math.divide$if_true3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @ARG A=M M=D (math.divide$if_false3) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @math.divide$while_exp1 0;JMP (math.divide$while_end1) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @math.divide$if_true4 D;JNE @math.divide$if_false4 0;JMP (math.divide$if_true4) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M+1 M=D (math.divide$if_false4) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.sqrt) @4 D=A (LOOP_math.sqrt) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_math.sqrt D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT22 D=A @38 0;JMP (RET_ADDRESS_LT22) @SP AM=M-1 D=M @math.sqrt$if_true0 D;JNE @math.sqrt$if_false0 0;JMP (math.sqrt$if_true0) @4 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL129 D=A @95 0;JMP (RET_ADDRESS_CALL129) @SP AM=M-1 D=M @R5 M=D (math.sqrt$if_false0) @7 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (math.sqrt$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT17 D=A @22 0;JMP (RET_ADDRESS_GT17) @SP A=M-1 M=!M @SP AM=M-1 D=M @math.sqrt$while_end0 D;JNE @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @math.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL130 D=A @95 0;JMP (RET_ADDRESS_CALL130) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT18 D=A @22 0;JMP (RET_ADDRESS_GT18) @SP A=M-1 M=!M @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT23 D=A @38 0;JMP (RET_ADDRESS_LT23) @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @math.sqrt$if_true1 D;JNE @math.sqrt$if_false1 0;JMP (math.sqrt$if_true1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (math.sqrt$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @math.sqrt$while_exp0 0;JMP (math.sqrt$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.max) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT19 D=A @22 0;JMP (RET_ADDRESS_GT19) @SP AM=M-1 D=M @math.max$if_true0 D;JNE @math.max$if_false0 0;JMP (math.max$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.max$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (math.min) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT24 D=A @38 0;JMP (RET_ADDRESS_LT24) @SP AM=M-1 D=M @math.min$if_true0 D;JNE @math.min$if_false0 0;JMP (math.min$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D (math.min$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (memory.init) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @memory.0 M=D @2048 D=A @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @14334 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @2049 D=A @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @2050 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (memory.peek) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (memory.poke) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @memory.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (memory.alloc) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @RET_ADDRESS_LT25 D=A @38 0;JMP (RET_ADDRESS_LT25) @SP AM=M-1 D=M @memory.alloc$if_true0 D;JNE @memory.alloc$if_false0 0;JMP (memory.alloc$if_true0) @5 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL131 D=A @95 0;JMP (RET_ADDRESS_CALL131) @SP AM=M-1 D=M @R5 M=D (memory.alloc$if_false0) @2048 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (memory.alloc$while_exp0) @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT26 D=A @38 0;JMP (RET_ADDRESS_LT26) @SP A=M-1 M=!M @SP AM=M-1 D=M @memory.alloc$while_end0 D;JNE @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @memory.alloc$while_exp0 0;JMP (memory.alloc$while_end0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @16379 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT20 D=A @22 0;JMP (RET_ADDRESS_GT20) @SP AM=M-1 D=M @memory.alloc$if_true1 D;JNE @memory.alloc$if_false1 0;JMP (memory.alloc$if_true1) @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL132 D=A @95 0;JMP (RET_ADDRESS_CALL132) @SP AM=M-1 D=M @R5 M=D (memory.alloc$if_false1) @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @RET_ADDRESS_GT21 D=A @22 0;JMP (RET_ADDRESS_GT21) @SP AM=M-1 D=M @memory.alloc$if_true2 D;JNE @memory.alloc$if_false2 0;JMP (memory.alloc$if_true2) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @RET_ADDRESS_EQ18 D=A @6 0;JMP (RET_ADDRESS_EQ18) @SP AM=M-1 D=M @memory.alloc$if_true3 D;JNE @memory.alloc$if_false3 0;JMP (memory.alloc$if_true3) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @4 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @memory.alloc$if_end3 0;JMP (memory.alloc$if_false3) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (memory.alloc$if_end3) @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (memory.alloc$if_false2) @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @54 0;JMP (memory.dealloc) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=0 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ19 D=A @6 0;JMP (RET_ADDRESS_EQ19) @SP AM=M-1 D=M @memory.dealloc$if_true0 D;JNE @memory.dealloc$if_false0 0;JMP (memory.dealloc$if_true0) @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @memory.dealloc$if_end0 0;JMP (memory.dealloc$if_false0) @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP M=M+1 A=M-1 M=0 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @RET_ADDRESS_EQ20 D=A @6 0;JMP (RET_ADDRESS_EQ20) @SP AM=M-1 D=M @memory.dealloc$if_true1 D;JNE @memory.dealloc$if_false1 0;JMP (memory.dealloc$if_true1) @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @memory.dealloc$if_end1 0;JMP (memory.dealloc$if_false1) @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (memory.dealloc$if_end1) (memory.dealloc$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.init) @16384 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.4 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.0 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL133 D=A @95 0;JMP (RET_ADDRESS_CALL133) @SP AM=M-1 D=M @output.3 M=D @0 D=A @R13 M=D @output.initmap D=A @R14 M=D @RET_ADDRESS_CALL134 D=A @95 0;JMP (RET_ADDRESS_CALL134) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @output.createshiftedmap D=A @R14 M=D @RET_ADDRESS_CALL135 D=A @95 0;JMP (RET_ADDRESS_CALL135) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.initmap) @127 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL136 D=A @95 0;JMP (RET_ADDRESS_CALL136) @SP AM=M-1 D=M @output.5 M=D @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL137 D=A @95 0;JMP (RET_ADDRESS_CALL137) @SP AM=M-1 D=M @R5 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL138 D=A @95 0;JMP (RET_ADDRESS_CALL138) @SP AM=M-1 D=M @R5 M=D @33 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL139 D=A @95 0;JMP (RET_ADDRESS_CALL139) @SP AM=M-1 D=M @R5 M=D @34 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @20 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL140 D=A @95 0;JMP (RET_ADDRESS_CALL140) @SP AM=M-1 D=M @R5 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @18 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL141 D=A @95 0;JMP (RET_ADDRESS_CALL141) @SP AM=M-1 D=M @R5 M=D @36 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL142 D=A @95 0;JMP (RET_ADDRESS_CALL142) @SP AM=M-1 D=M @R5 M=D @37 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL143 D=A @95 0;JMP (RET_ADDRESS_CALL143) @SP AM=M-1 D=M @R5 M=D @38 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL144 D=A @95 0;JMP (RET_ADDRESS_CALL144) @SP AM=M-1 D=M @R5 M=D @39 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL145 D=A @95 0;JMP (RET_ADDRESS_CALL145) @SP AM=M-1 D=M @R5 M=D @40 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL146 D=A @95 0;JMP (RET_ADDRESS_CALL146) @SP AM=M-1 D=M @R5 M=D @41 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL147 D=A @95 0;JMP (RET_ADDRESS_CALL147) @SP AM=M-1 D=M @R5 M=D @42 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL148 D=A @95 0;JMP (RET_ADDRESS_CALL148) @SP AM=M-1 D=M @R5 M=D @43 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL149 D=A @95 0;JMP (RET_ADDRESS_CALL149) @SP AM=M-1 D=M @R5 M=D @44 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL150 D=A @95 0;JMP (RET_ADDRESS_CALL150) @SP AM=M-1 D=M @R5 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL151 D=A @95 0;JMP (RET_ADDRESS_CALL151) @SP AM=M-1 D=M @R5 M=D @46 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL152 D=A @95 0;JMP (RET_ADDRESS_CALL152) @SP AM=M-1 D=M @R5 M=D @47 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @32 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL153 D=A @95 0;JMP (RET_ADDRESS_CALL153) @SP AM=M-1 D=M @R5 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL154 D=A @95 0;JMP (RET_ADDRESS_CALL154) @SP AM=M-1 D=M @R5 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL155 D=A @95 0;JMP (RET_ADDRESS_CALL155) @SP AM=M-1 D=M @R5 M=D @50 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL156 D=A @95 0;JMP (RET_ADDRESS_CALL156) @SP AM=M-1 D=M @R5 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL157 D=A @95 0;JMP (RET_ADDRESS_CALL157) @SP AM=M-1 D=M @R5 M=D @52 D=A @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @26 D=A @SP AM=M+1 A=A-1 M=D @25 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL158 D=A @95 0;JMP (RET_ADDRESS_CALL158) @SP AM=M-1 D=M @R5 M=D @53 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL159 D=A @95 0;JMP (RET_ADDRESS_CALL159) @SP AM=M-1 D=M @R5 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL160 D=A @95 0;JMP (RET_ADDRESS_CALL160) @SP AM=M-1 D=M @R5 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL161 D=A @95 0;JMP (RET_ADDRESS_CALL161) @SP AM=M-1 D=M @R5 M=D @56 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL162 D=A @95 0;JMP (RET_ADDRESS_CALL162) @SP AM=M-1 D=M @R5 M=D @57 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL163 D=A @95 0;JMP (RET_ADDRESS_CALL163) @SP AM=M-1 D=M @R5 M=D @58 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL164 D=A @95 0;JMP (RET_ADDRESS_CALL164) @SP AM=M-1 D=M @R5 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL165 D=A @95 0;JMP (RET_ADDRESS_CALL165) @SP AM=M-1 D=M @R5 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL166 D=A @95 0;JMP (RET_ADDRESS_CALL166) @SP AM=M-1 D=M @R5 M=D @61 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL167 D=A @95 0;JMP (RET_ADDRESS_CALL167) @SP AM=M-1 D=M @R5 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @3 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL168 D=A @95 0;JMP (RET_ADDRESS_CALL168) @SP AM=M-1 D=M @R5 M=D @64 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL169 D=A @95 0;JMP (RET_ADDRESS_CALL169) @SP AM=M-1 D=M @R5 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL170 D=A @95 0;JMP (RET_ADDRESS_CALL170) @SP AM=M-1 D=M @R5 M=D @65 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL171 D=A @95 0;JMP (RET_ADDRESS_CALL171) @SP AM=M-1 D=M @R5 M=D @66 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL172 D=A @95 0;JMP (RET_ADDRESS_CALL172) @SP AM=M-1 D=M @R5 M=D @67 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL173 D=A @95 0;JMP (RET_ADDRESS_CALL173) @SP AM=M-1 D=M @R5 M=D @68 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL174 D=A @95 0;JMP (RET_ADDRESS_CALL174) @SP AM=M-1 D=M @R5 M=D @69 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL175 D=A @95 0;JMP (RET_ADDRESS_CALL175) @SP AM=M-1 D=M @R5 M=D @70 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL176 D=A @95 0;JMP (RET_ADDRESS_CALL176) @SP AM=M-1 D=M @R5 M=D @71 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @44 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL177 D=A @95 0;JMP (RET_ADDRESS_CALL177) @SP AM=M-1 D=M @R5 M=D @72 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL178 D=A @95 0;JMP (RET_ADDRESS_CALL178) @SP AM=M-1 D=M @R5 M=D @73 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL179 D=A @95 0;JMP (RET_ADDRESS_CALL179) @SP AM=M-1 D=M @R5 M=D @74 D=A @SP AM=M+1 A=A-1 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL180 D=A @95 0;JMP (RET_ADDRESS_CALL180) @SP AM=M-1 D=M @R5 M=D @75 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL181 D=A @95 0;JMP (RET_ADDRESS_CALL181) @SP AM=M-1 D=M @R5 M=D @76 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL182 D=A @95 0;JMP (RET_ADDRESS_CALL182) @SP AM=M-1 D=M @R5 M=D @77 D=A @SP AM=M+1 A=A-1 M=D @33 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL183 D=A @95 0;JMP (RET_ADDRESS_CALL183) @SP AM=M-1 D=M @R5 M=D @78 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL184 D=A @95 0;JMP (RET_ADDRESS_CALL184) @SP AM=M-1 D=M @R5 M=D @79 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL185 D=A @95 0;JMP (RET_ADDRESS_CALL185) @SP AM=M-1 D=M @R5 M=D @80 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL186 D=A @95 0;JMP (RET_ADDRESS_CALL186) @SP AM=M-1 D=M @R5 M=D @81 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @59 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL187 D=A @95 0;JMP (RET_ADDRESS_CALL187) @SP AM=M-1 D=M @R5 M=D @82 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL188 D=A @95 0;JMP (RET_ADDRESS_CALL188) @SP AM=M-1 D=M @R5 M=D @83 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL189 D=A @95 0;JMP (RET_ADDRESS_CALL189) @SP AM=M-1 D=M @R5 M=D @84 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL190 D=A @95 0;JMP (RET_ADDRESS_CALL190) @SP AM=M-1 D=M @R5 M=D @85 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL191 D=A @95 0;JMP (RET_ADDRESS_CALL191) @SP AM=M-1 D=M @R5 M=D @86 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL192 D=A @95 0;JMP (RET_ADDRESS_CALL192) @SP AM=M-1 D=M @R5 M=D @87 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL193 D=A @95 0;JMP (RET_ADDRESS_CALL193) @SP AM=M-1 D=M @R5 M=D @88 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL194 D=A @95 0;JMP (RET_ADDRESS_CALL194) @SP AM=M-1 D=M @R5 M=D @89 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL195 D=A @95 0;JMP (RET_ADDRESS_CALL195) @SP AM=M-1 D=M @R5 M=D @90 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @49 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @35 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL196 D=A @95 0;JMP (RET_ADDRESS_CALL196) @SP AM=M-1 D=M @R5 M=D @91 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL197 D=A @95 0;JMP (RET_ADDRESS_CALL197) @SP AM=M-1 D=M @R5 M=D @92 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=1 @3 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL198 D=A @95 0;JMP (RET_ADDRESS_CALL198) @SP AM=M-1 D=M @R5 M=D @93 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL199 D=A @95 0;JMP (RET_ADDRESS_CALL199) @SP AM=M-1 D=M @R5 M=D @94 D=A @SP AM=M+1 A=A-1 M=D @8 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL200 D=A @95 0;JMP (RET_ADDRESS_CALL200) @SP AM=M-1 D=M @R5 M=D @95 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL201 D=A @95 0;JMP (RET_ADDRESS_CALL201) @SP AM=M-1 D=M @R5 M=D @96 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL202 D=A @95 0;JMP (RET_ADDRESS_CALL202) @SP AM=M-1 D=M @R5 M=D @97 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @14 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL203 D=A @95 0;JMP (RET_ADDRESS_CALL203) @SP AM=M-1 D=M @R5 M=D @98 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL204 D=A @95 0;JMP (RET_ADDRESS_CALL204) @SP AM=M-1 D=M @R5 M=D @99 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL205 D=A @95 0;JMP (RET_ADDRESS_CALL205) @SP AM=M-1 D=M @R5 M=D @100 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @60 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL206 D=A @95 0;JMP (RET_ADDRESS_CALL206) @SP AM=M-1 D=M @R5 M=D @101 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL207 D=A @95 0;JMP (RET_ADDRESS_CALL207) @SP AM=M-1 D=M @R5 M=D @102 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @38 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL208 D=A @95 0;JMP (RET_ADDRESS_CALL208) @SP AM=M-1 D=M @R5 M=D @103 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL209 D=A @95 0;JMP (RET_ADDRESS_CALL209) @SP AM=M-1 D=M @R5 M=D @104 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL210 D=A @95 0;JMP (RET_ADDRESS_CALL210) @SP AM=M-1 D=M @R5 M=D @105 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @14 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL211 D=A @95 0;JMP (RET_ADDRESS_CALL211) @SP AM=M-1 D=M @R5 M=D @106 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @56 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL212 D=A @95 0;JMP (RET_ADDRESS_CALL212) @SP AM=M-1 D=M @R5 M=D @107 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL213 D=A @95 0;JMP (RET_ADDRESS_CALL213) @SP AM=M-1 D=M @R5 M=D @108 D=A @SP AM=M+1 A=A-1 M=D @14 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL214 D=A @95 0;JMP (RET_ADDRESS_CALL214) @SP AM=M-1 D=M @R5 M=D @109 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @29 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @43 D=A @SP AM=M+1 A=A-1 M=D @43 D=A @SP AM=M+1 A=A-1 M=D @43 D=A @SP AM=M+1 A=A-1 M=D @43 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL215 D=A @95 0;JMP (RET_ADDRESS_CALL215) @SP AM=M-1 D=M @R5 M=D @110 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @29 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL216 D=A @95 0;JMP (RET_ADDRESS_CALL216) @SP AM=M-1 D=M @R5 M=D @111 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL217 D=A @95 0;JMP (RET_ADDRESS_CALL217) @SP AM=M-1 D=M @R5 M=D @112 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @31 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL218 D=A @95 0;JMP (RET_ADDRESS_CALL218) @SP AM=M-1 D=M @R5 M=D @113 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL219 D=A @95 0;JMP (RET_ADDRESS_CALL219) @SP AM=M-1 D=M @R5 M=D @114 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @29 D=A @SP AM=M+1 A=A-1 M=D @55 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL220 D=A @95 0;JMP (RET_ADDRESS_CALL220) @SP AM=M-1 D=M @R5 M=D @115 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL221 D=A @95 0;JMP (RET_ADDRESS_CALL221) @SP AM=M-1 D=M @R5 M=D @116 D=A @SP AM=M+1 A=A-1 M=D @4 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @28 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL222 D=A @95 0;JMP (RET_ADDRESS_CALL222) @SP AM=M-1 D=M @R5 M=D @117 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @54 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL223 D=A @95 0;JMP (RET_ADDRESS_CALL223) @SP AM=M-1 D=M @R5 M=D @118 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL224 D=A @95 0;JMP (RET_ADDRESS_CALL224) @SP AM=M-1 D=M @R5 M=D @119 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @18 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL225 D=A @95 0;JMP (RET_ADDRESS_CALL225) @SP AM=M-1 D=M @R5 M=D @120 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @51 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @30 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL226 D=A @95 0;JMP (RET_ADDRESS_CALL226) @SP AM=M-1 D=M @R5 M=D @121 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @62 D=A @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @24 D=A @SP AM=M+1 A=A-1 M=D @15 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL227 D=A @95 0;JMP (RET_ADDRESS_CALL227) @SP AM=M-1 D=M @R5 M=D @122 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @63 D=A @SP AM=M+1 A=A-1 M=D @27 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @6 D=A @SP AM=M+1 A=A-1 M=D @51 D=A @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL228 D=A @95 0;JMP (RET_ADDRESS_CALL228) @SP AM=M-1 D=M @R5 M=D @123 D=A @SP AM=M+1 A=A-1 M=D @56 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @56 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL229 D=A @95 0;JMP (RET_ADDRESS_CALL229) @SP AM=M-1 D=M @R5 M=D @124 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL230 D=A @95 0;JMP (RET_ADDRESS_CALL230) @SP AM=M-1 D=M @R5 M=D @125 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @56 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @7 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL231 D=A @95 0;JMP (RET_ADDRESS_CALL231) @SP AM=M-1 D=M @R5 M=D @126 D=A @SP AM=M+1 A=A-1 M=D @38 D=A @SP AM=M+1 A=A-1 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @25 D=A @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @SP M=M+1 A=M-1 M=0 @12 D=A @R13 M=D @output.create D=A @R14 M=D @RET_ADDRESS_CALL232 D=A @95 0;JMP (RET_ADDRESS_CALL232) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.create) @SP AM=M+1 A=A-1 M=0 @11 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL233 D=A @95 0;JMP (RET_ADDRESS_CALL233) @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @3 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @4 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @5 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @6 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @7 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @8 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @9 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @10 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG D=M @11 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.createshiftedmap) @4 D=A (LOOP_output.createshiftedmap) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_output.createshiftedmap D;JGT @127 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL234 D=A @95 0;JMP (RET_ADDRESS_CALL234) @SP AM=M-1 D=M @output.6 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (output.createshiftedmap$while_exp0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @127 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT27 D=A @38 0;JMP (RET_ADDRESS_LT27) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.createshiftedmap$while_end0 D;JNE @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @11 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL235 D=A @95 0;JMP (RET_ADDRESS_CALL235) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (output.createshiftedmap$while_exp1) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT28 D=A @38 0;JMP (RET_ADDRESS_LT28) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.createshiftedmap$while_end1 D;JNE @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @256 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL236 D=A @95 0;JMP (RET_ADDRESS_CALL236) @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @output.createshiftedmap$while_exp1 0;JMP (output.createshiftedmap$while_end1) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ21 D=A @6 0;JMP (RET_ADDRESS_EQ21) @SP AM=M-1 D=M @output.createshiftedmap$if_true0 D;JNE @output.createshiftedmap$if_false0 0;JMP (output.createshiftedmap$if_true0) @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @output.createshiftedmap$if_end0 0;JMP (output.createshiftedmap$if_false0) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (output.createshiftedmap$if_end0) @output.createshiftedmap$while_exp0 0;JMP (output.createshiftedmap$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.getmap) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT29 D=A @38 0;JMP (RET_ADDRESS_LT29) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @126 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT22 D=A @22 0;JMP (RET_ADDRESS_GT22) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @output.getmap$if_true0 D;JNE @output.getmap$if_false0 0;JMP (output.getmap$if_true0) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @ARG A=M M=D (output.getmap$if_false0) @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.getmap$if_true1 D;JNE @output.getmap$if_false1 0;JMP (output.getmap$if_true1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @output.5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @output.getmap$if_end1 0;JMP (output.getmap$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @output.6 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (output.getmap$if_end1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (output.drawchar) @4 D=A (LOOP_output.drawchar) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_output.drawchar D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.getmap D=A @R14 M=D @RET_ADDRESS_CALL237 D=A @95 0;JMP (RET_ADDRESS_CALL237) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (output.drawchar$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @11 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT30 D=A @38 0;JMP (RET_ADDRESS_LT30) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.drawchar$while_end0 D;JNE @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.drawchar$if_true0 D;JNE @output.drawchar$if_false0 0;JMP (output.drawchar$if_true0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @256 D=A @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @output.drawchar$if_end0 0;JMP (output.drawchar$if_false0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D (output.drawchar$if_end0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @output.4 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @output.drawchar$while_exp0 0;JMP (output.drawchar$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.movecursor) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT31 D=A @38 0;JMP (RET_ADDRESS_LT31) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @22 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT23 D=A @22 0;JMP (RET_ADDRESS_GT23) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT32 D=A @38 0;JMP (RET_ADDRESS_LT32) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @63 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT24 D=A @22 0;JMP (RET_ADDRESS_GT24) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @output.movecursor$if_true0 D;JNE @output.movecursor$if_false0 0;JMP (output.movecursor$if_true0) @20 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL238 D=A @95 0;JMP (RET_ADDRESS_CALL238) @SP AM=M-1 D=M @R5 M=D (output.movecursor$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL239 D=A @95 0;JMP (RET_ADDRESS_CALL239) @SP AM=M-1 D=M @output.0 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @352 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL240 D=A @95 0;JMP (RET_ADDRESS_CALL240) @SP AM=M-1 D=M A=A-1 M=D+M @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @output.0 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL241 D=A @95 0;JMP (RET_ADDRESS_CALL241) @RET_ADDRESS_EQ22 D=A @6 0;JMP (RET_ADDRESS_EQ22) @SP AM=M-1 D=M @output.2 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL242 D=A @95 0;JMP (RET_ADDRESS_CALL242) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @0 D=A @R13 M=D @string.newline D=A @R14 M=D @RET_ADDRESS_CALL243 D=A @95 0;JMP (RET_ADDRESS_CALL243) @RET_ADDRESS_EQ23 D=A @6 0;JMP (RET_ADDRESS_EQ23) @SP AM=M-1 D=M @output.printchar$if_true0 D;JNE @output.printchar$if_false0 0;JMP (output.printchar$if_true0) @0 D=A @R13 M=D @output.println D=A @R14 M=D @RET_ADDRESS_CALL244 D=A @95 0;JMP (RET_ADDRESS_CALL244) @SP AM=M-1 D=M @R5 M=D @output.printchar$if_end0 0;JMP (output.printchar$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @0 D=A @R13 M=D @string.backspace D=A @R14 M=D @RET_ADDRESS_CALL245 D=A @95 0;JMP (RET_ADDRESS_CALL245) @RET_ADDRESS_EQ24 D=A @6 0;JMP (RET_ADDRESS_EQ24) @SP AM=M-1 D=M @output.printchar$if_true1 D;JNE @output.printchar$if_false1 0;JMP (output.printchar$if_true1) @0 D=A @R13 M=D @output.backspace D=A @R14 M=D @RET_ADDRESS_CALL246 D=A @95 0;JMP (RET_ADDRESS_CALL246) @SP AM=M-1 D=M @R5 M=D @output.printchar$if_end1 0;JMP (output.printchar$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL247 D=A @95 0;JMP (RET_ADDRESS_CALL247) @SP AM=M-1 D=M @R5 M=D @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @output.printchar$if_true2 D;JNE @output.printchar$if_false2 0;JMP (output.printchar$if_true2) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.0 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @output.1 M=D (output.printchar$if_false2) @output.0 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ25 D=A @6 0;JMP (RET_ADDRESS_EQ25) @SP AM=M-1 D=M @output.printchar$if_true3 D;JNE @output.printchar$if_false3 0;JMP (output.printchar$if_true3) @0 D=A @R13 M=D @output.println D=A @R14 M=D @RET_ADDRESS_CALL248 D=A @95 0;JMP (RET_ADDRESS_CALL248) @SP AM=M-1 D=M @R5 M=D @output.printchar$if_end3 0;JMP (output.printchar$if_false3) @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D (output.printchar$if_end3) (output.printchar$if_end1) (output.printchar$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printstring) @SP A=M M=0 AD=A+1 M=0 @SP M=D+1 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.length D=A @R14 M=D @RET_ADDRESS_CALL249 D=A @95 0;JMP (RET_ADDRESS_CALL249) @SP AM=M-1 D=M @LCL A=M+1 M=D (output.printstring$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT33 D=A @38 0;JMP (RET_ADDRESS_LT33) @SP A=M-1 M=!M @SP AM=M-1 D=M @output.printstring$while_end0 D;JNE @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.charat D=A @R14 M=D @RET_ADDRESS_CALL250 D=A @95 0;JMP (RET_ADDRESS_CALL250) @1 D=A @R13 M=D @output.printchar D=A @R14 M=D @RET_ADDRESS_CALL251 D=A @95 0;JMP (RET_ADDRESS_CALL251) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @output.printstring$while_exp0 0;JMP (output.printstring$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.printint) @output.3 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.setint D=A @R14 M=D @RET_ADDRESS_CALL252 D=A @95 0;JMP (RET_ADDRESS_CALL252) @SP AM=M-1 D=M @R5 M=D @output.3 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL253 D=A @95 0;JMP (RET_ADDRESS_CALL253) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.println) @output.1 D=M @SP AM=M+1 A=A-1 M=D @352 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.1 M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.0 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @8128 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ26 D=A @6 0;JMP (RET_ADDRESS_EQ26) @SP AM=M-1 D=M @output.println$if_true0 D;JNE @output.println$if_false0 0;JMP (output.println$if_true0) @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.1 M=D (output.println$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (output.backspace) @output.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.backspace$if_true0 D;JNE @output.backspace$if_false0 0;JMP (output.backspace$if_true0) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT25 D=A @22 0;JMP (RET_ADDRESS_GT25) @SP AM=M-1 D=M @output.backspace$if_true1 D;JNE @output.backspace$if_false1 0;JMP (output.backspace$if_true1) @output.0 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.0 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.1 M=D @output.backspace$if_end1 0;JMP (output.backspace$if_false1) @31 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.0 M=D @output.1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ27 D=A @6 0;JMP (RET_ADDRESS_EQ27) @SP AM=M-1 D=M @output.backspace$if_true2 D;JNE @output.backspace$if_false2 0;JMP (output.backspace$if_true2) @8128 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @output.1 M=D (output.backspace$if_false2) @output.1 D=M @SP AM=M+1 A=A-1 M=D @321 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @output.1 M=D (output.backspace$if_end1) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @output.2 M=D @output.backspace$if_end0 0;JMP (output.backspace$if_false0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @output.2 M=D (output.backspace$if_end0) @32 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.drawchar D=A @R14 M=D @RET_ADDRESS_CALL254 D=A @95 0;JMP (RET_ADDRESS_CALL254) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.init) @SP AM=M+1 A=A-1 M=0 @16384 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.1 M=D @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.2 M=D @17 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL255 D=A @95 0;JMP (RET_ADDRESS_CALL255) @SP AM=M-1 D=M @screen.0 M=D @SP M=M+1 A=M-1 M=0 @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (screen.init$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT34 D=A @38 0;JMP (RET_ADDRESS_LT34) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.init$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @screen.init$while_exp0 0;JMP (screen.init$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.clearscreen) @SP AM=M+1 A=A-1 M=0 (screen.clearscreen$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @8192 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT35 D=A @38 0;JMP (RET_ADDRESS_LT35) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.clearscreen$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.clearscreen$while_exp0 0;JMP (screen.clearscreen$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.updatelocation) @screen.2 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.updatelocation$if_true0 D;JNE @screen.updatelocation$if_false0 0;JMP (screen.updatelocation$if_true0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @screen.updatelocation$if_end0 0;JMP (screen.updatelocation$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @screen.1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D (screen.updatelocation$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.setcolor) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.2 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawpixel) @3 D=A (LOOP_screen.drawpixel) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawpixel D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT36 D=A @38 0;JMP (RET_ADDRESS_LT36) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT26 D=A @22 0;JMP (RET_ADDRESS_GT26) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT37 D=A @38 0;JMP (RET_ADDRESS_LT37) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT27 D=A @22 0;JMP (RET_ADDRESS_GT27) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawpixel$if_true0 D;JNE @screen.drawpixel$if_false0 0;JMP (screen.drawpixel$if_true0) @7 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL256 D=A @95 0;JMP (RET_ADDRESS_CALL256) @SP AM=M-1 D=M @R5 M=D (screen.drawpixel$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL257 D=A @95 0;JMP (RET_ADDRESS_CALL257) @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL258 D=A @95 0;JMP (RET_ADDRESS_CALL258) @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL259 D=A @95 0;JMP (RET_ADDRESS_CALL259) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL260 D=A @95 0;JMP (RET_ADDRESS_CALL260) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawconditional) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawconditional$if_true0 D;JNE @screen.drawconditional$if_false0 0;JMP (screen.drawconditional$if_true0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.drawpixel D=A @R14 M=D @RET_ADDRESS_CALL261 D=A @95 0;JMP (RET_ADDRESS_CALL261) @SP AM=M-1 D=M @R5 M=D @screen.drawconditional$if_end0 0;JMP (screen.drawconditional$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.drawpixel D=A @R14 M=D @RET_ADDRESS_CALL262 D=A @95 0;JMP (RET_ADDRESS_CALL262) @SP AM=M-1 D=M @R5 M=D (screen.drawconditional$if_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawline) @11 D=A (LOOP_screen.drawline) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawline D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT38 D=A @38 0;JMP (RET_ADDRESS_LT38) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT28 D=A @22 0;JMP (RET_ADDRESS_GT28) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT39 D=A @38 0;JMP (RET_ADDRESS_LT39) @SP AM=M-1 D=M A=A-1 M=D|M @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT29 D=A @22 0;JMP (RET_ADDRESS_GT29) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawline$if_true0 D;JNE @screen.drawline$if_false0 0;JMP (screen.drawline$if_true0) @8 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL263 D=A @95 0;JMP (RET_ADDRESS_CALL263) @SP AM=M-1 D=M @R5 M=D (screen.drawline$if_false0) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL264 D=A @95 0;JMP (RET_ADDRESS_CALL264) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @1 D=A @R13 M=D @math.abs D=A @R14 M=D @RET_ADDRESS_CALL265 D=A @95 0;JMP (RET_ADDRESS_CALL265) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT40 D=A @38 0;JMP (RET_ADDRESS_LT40) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT41 D=A @38 0;JMP (RET_ADDRESS_LT41) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 M=!M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT42 D=A @38 0;JMP (RET_ADDRESS_LT42) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawline$if_true1 D;JNE @screen.drawline$if_false1 0;JMP (screen.drawline$if_true1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 A=A+1 A=A+1 M=D (screen.drawline$if_false1) @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawline$if_true2 D;JNE @screen.drawline$if_false2 0;JMP (screen.drawline$if_true2) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT30 D=A @22 0;JMP (RET_ADDRESS_GT30) @LCL D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @screen.drawline$if_end2 0;JMP (screen.drawline$if_false2) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT31 D=A @22 0;JMP (RET_ADDRESS_GT31) @LCL D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D (screen.drawline$if_end2) @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL266 D=A @95 0;JMP (RET_ADDRESS_CALL266) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL267 D=A @95 0;JMP (RET_ADDRESS_CALL267) @LCL D=M @9 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL268 D=A @95 0;JMP (RET_ADDRESS_CALL268) @LCL D=M @10 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawconditional D=A @R14 M=D @RET_ADDRESS_CALL269 D=A @95 0;JMP (RET_ADDRESS_CALL269) @SP AM=M-1 D=M @R5 M=D (screen.drawline$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT43 D=A @38 0;JMP (RET_ADDRESS_LT43) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawline$while_end0 D;JNE @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT44 D=A @38 0;JMP (RET_ADDRESS_LT44) @SP AM=M-1 D=M @screen.drawline$if_true3 D;JNE @screen.drawline$if_false3 0;JMP (screen.drawline$if_true3) @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @screen.drawline$if_end3 0;JMP (screen.drawline$if_false3) @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @screen.drawline$if_true4 D;JNE @screen.drawline$if_false4 0;JMP (screen.drawline$if_true4) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @screen.drawline$if_end4 0;JMP (screen.drawline$if_false4) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawline$if_end4) (screen.drawline$if_end3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @3 D=A @R13 M=D @screen.drawconditional D=A @R14 M=D @RET_ADDRESS_CALL270 D=A @95 0;JMP (RET_ADDRESS_CALL270) @SP AM=M-1 D=M @R5 M=D @screen.drawline$while_exp0 0;JMP (screen.drawline$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawrectangle) @9 D=A (LOOP_screen.drawrectangle) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawrectangle D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT32 D=A @22 0;JMP (RET_ADDRESS_GT32) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT33 D=A @22 0;JMP (RET_ADDRESS_GT33) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT45 D=A @38 0;JMP (RET_ADDRESS_LT45) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT34 D=A @22 0;JMP (RET_ADDRESS_GT34) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT46 D=A @38 0;JMP (RET_ADDRESS_LT46) @SP AM=M-1 D=M A=A-1 M=D|M @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT35 D=A @22 0;JMP (RET_ADDRESS_GT35) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawrectangle$if_true0 D;JNE @screen.drawrectangle$if_false0 0;JMP (screen.drawrectangle$if_true0) @9 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL271 D=A @95 0;JMP (RET_ADDRESS_CALL271) @SP AM=M-1 D=M @R5 M=D (screen.drawrectangle$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL272 D=A @95 0;JMP (RET_ADDRESS_CALL272) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL273 D=A @95 0;JMP (RET_ADDRESS_CALL273) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL274 D=A @95 0;JMP (RET_ADDRESS_CALL274) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL275 D=A @95 0;JMP (RET_ADDRESS_CALL275) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL276 D=A @95 0;JMP (RET_ADDRESS_CALL276) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D (screen.drawrectangle$while_exp0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT36 D=A @22 0;JMP (RET_ADDRESS_GT36) @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawrectangle$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ28 D=A @6 0;JMP (RET_ADDRESS_EQ28) @SP AM=M-1 D=M @screen.drawrectangle$if_true1 D;JNE @screen.drawrectangle$if_false1 0;JMP (screen.drawrectangle$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL277 D=A @95 0;JMP (RET_ADDRESS_CALL277) @SP AM=M-1 D=M @R5 M=D @screen.drawrectangle$if_end1 0;JMP (screen.drawrectangle$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL278 D=A @95 0;JMP (RET_ADDRESS_CALL278) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawrectangle$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT47 D=A @38 0;JMP (RET_ADDRESS_LT47) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawrectangle$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL279 D=A @95 0;JMP (RET_ADDRESS_CALL279) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.drawrectangle$while_exp1 0;JMP (screen.drawrectangle$while_end1) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL280 D=A @95 0;JMP (RET_ADDRESS_CALL280) @SP AM=M-1 D=M @R5 M=D (screen.drawrectangle$if_end1) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @ARG A=M+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @screen.drawrectangle$while_exp0 0;JMP (screen.drawrectangle$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawhorizontal) @11 D=A (LOOP_screen.drawhorizontal) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawhorizontal D;JGT @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.min D=A @R14 M=D @RET_ADDRESS_CALL281 D=A @95 0;JMP (RET_ADDRESS_CALL281) @LCL D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.max D=A @R14 M=D @RET_ADDRESS_CALL282 D=A @95 0;JMP (RET_ADDRESS_CALL282) @LCL D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT37 D=A @22 0;JMP (RET_ADDRESS_GT37) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @256 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT48 D=A @38 0;JMP (RET_ADDRESS_LT48) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @512 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT49 D=A @38 0;JMP (RET_ADDRESS_LT49) @SP AM=M-1 D=M A=A-1 M=D&M @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @RET_ADDRESS_GT38 D=A @22 0;JMP (RET_ADDRESS_GT38) @SP AM=M-1 D=M A=A-1 M=D&M @SP AM=M-1 D=M @screen.drawhorizontal$if_true0 D;JNE @screen.drawhorizontal$if_false0 0;JMP (screen.drawhorizontal$if_true0) @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @2 D=A @R13 M=D @math.max D=A @R14 M=D @RET_ADDRESS_CALL283 D=A @95 0;JMP (RET_ADDRESS_CALL283) @LCL D=M @7 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.min D=A @R14 M=D @RET_ADDRESS_CALL284 D=A @95 0;JMP (RET_ADDRESS_CALL284) @LCL D=M @8 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL285 D=A @95 0;JMP (RET_ADDRESS_CALL285) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL D=M @7 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL286 D=A @95 0;JMP (RET_ADDRESS_CALL286) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @9 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL287 D=A @95 0;JMP (RET_ADDRESS_CALL287) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL D=M @8 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @16 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL288 D=A @95 0;JMP (RET_ADDRESS_CALL288) @SP AM=M-1 D=M A=A-1 M=M-D @LCL D=M @10 D=D+A @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @LCL D=M @9 A=D+A D=M @SP AM=M+1 A=A-1 M=D @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL D=M @10 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @screen.0 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @32 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL289 D=A @95 0;JMP (RET_ADDRESS_CALL289) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 A=A+1 A=A+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @6 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ29 D=A @6 0;JMP (RET_ADDRESS_EQ29) @SP AM=M-1 D=M @screen.drawhorizontal$if_true1 D;JNE @screen.drawhorizontal$if_false1 0;JMP (screen.drawhorizontal$if_true1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL290 D=A @95 0;JMP (RET_ADDRESS_CALL290) @SP AM=M-1 D=M @R5 M=D @screen.drawhorizontal$if_end1 0;JMP (screen.drawhorizontal$if_false1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @5 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL291 D=A @95 0;JMP (RET_ADDRESS_CALL291) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (screen.drawhorizontal$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT50 D=A @38 0;JMP (RET_ADDRESS_LT50) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawhorizontal$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP A=M-1 D=!M M=D+1 @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL292 D=A @95 0;JMP (RET_ADDRESS_CALL292) @SP AM=M-1 D=M @R5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @screen.drawhorizontal$while_exp0 0;JMP (screen.drawhorizontal$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @screen.updatelocation D=A @R14 M=D @RET_ADDRESS_CALL293 D=A @95 0;JMP (RET_ADDRESS_CALL293) @SP AM=M-1 D=M @R5 M=D (screen.drawhorizontal$if_end1) (screen.drawhorizontal$if_false0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawsymetric) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL294 D=A @95 0;JMP (RET_ADDRESS_CALL294) @SP AM=M-1 D=M @R5 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL295 D=A @95 0;JMP (RET_ADDRESS_CALL295) @SP AM=M-1 D=M @R5 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL296 D=A @95 0;JMP (RET_ADDRESS_CALL296) @SP AM=M-1 D=M @R5 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @R13 M=D @screen.drawhorizontal D=A @R14 M=D @RET_ADDRESS_CALL297 D=A @95 0;JMP (RET_ADDRESS_CALL297) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (screen.drawcircle) @3 D=A (LOOP_screen.drawcircle) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_screen.drawcircle D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT51 D=A @38 0;JMP (RET_ADDRESS_LT51) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT39 D=A @22 0;JMP (RET_ADDRESS_GT39) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT52 D=A @38 0;JMP (RET_ADDRESS_LT52) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT40 D=A @22 0;JMP (RET_ADDRESS_GT40) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawcircle$if_true0 D;JNE @screen.drawcircle$if_false0 0;JMP (screen.drawcircle$if_true0) @12 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL298 D=A @95 0;JMP (RET_ADDRESS_CALL298) @SP AM=M-1 D=M @R5 M=D (screen.drawcircle$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT53 D=A @38 0;JMP (RET_ADDRESS_LT53) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @511 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT41 D=A @22 0;JMP (RET_ADDRESS_GT41) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT54 D=A @38 0;JMP (RET_ADDRESS_LT54) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @255 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT42 D=A @22 0;JMP (RET_ADDRESS_GT42) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @screen.drawcircle$if_true1 D;JNE @screen.drawcircle$if_false1 0;JMP (screen.drawcircle$if_true1) @13 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL299 D=A @95 0;JMP (RET_ADDRESS_CALL299) @SP AM=M-1 D=M @R5 M=D (screen.drawcircle$if_false1) @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D @SP M=M+1 A=M-1 M=1 @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawsymetric D=A @R14 M=D @RET_ADDRESS_CALL300 D=A @95 0;JMP (RET_ADDRESS_CALL300) @SP AM=M-1 D=M @R5 M=D (screen.drawcircle$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT43 D=A @22 0;JMP (RET_ADDRESS_GT43) @SP A=M-1 M=!M @SP AM=M-1 D=M @screen.drawcircle$while_end0 D;JNE @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT55 D=A @38 0;JMP (RET_ADDRESS_LT55) @SP AM=M-1 D=M @screen.drawcircle$if_true2 D;JNE @screen.drawcircle$if_false2 0;JMP (screen.drawcircle$if_true2) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL301 D=A @95 0;JMP (RET_ADDRESS_CALL301) @SP AM=M-1 D=M A=A-1 M=D+M @3 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @screen.drawcircle$if_end2 0;JMP (screen.drawcircle$if_false2) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @2 D=A @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL302 D=A @95 0;JMP (RET_ADDRESS_CALL302) @SP AM=M-1 D=M A=A-1 M=D+M @5 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 M=D (screen.drawcircle$if_end2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @4 D=A @R13 M=D @screen.drawsymetric D=A @R14 M=D @RET_ADDRESS_CALL303 D=A @95 0;JMP (RET_ADDRESS_CALL303) @SP AM=M-1 D=M @R5 M=D @screen.drawcircle$while_exp0 0;JMP (screen.drawcircle$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.new) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.alloc D=A @R14 M=D @RET_ADDRESS_CALL304 D=A @95 0;JMP (RET_ADDRESS_CALL304) @SP AM=M-1 D=M @THIS M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT56 D=A @38 0;JMP (RET_ADDRESS_LT56) @SP AM=M-1 D=M @string.new$if_true0 D;JNE @string.new$if_false0 0;JMP (string.new$if_true0) @14 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL305 D=A @95 0;JMP (RET_ADDRESS_CALL305) @SP AM=M-1 D=M @R5 M=D (string.new$if_false0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT44 D=A @22 0;JMP (RET_ADDRESS_GT44) @SP AM=M-1 D=M @string.new$if_true1 D;JNE @string.new$if_false1 0;JMP (string.new$if_true1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL306 D=A @95 0;JMP (RET_ADDRESS_CALL306) @SP AM=M-1 D=M @THIS A=M+1 M=D (string.new$if_false1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS A=M M=D @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.dispose) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT45 D=A @22 0;JMP (RET_ADDRESS_GT45) @SP AM=M-1 D=M @string.dispose$if_true0 D;JNE @string.dispose$if_false0 0;JMP (string.dispose$if_true0) @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.dispose D=A @R14 M=D @RET_ADDRESS_CALL307 D=A @95 0;JMP (RET_ADDRESS_CALL307) @SP AM=M-1 D=M @R5 M=D (string.dispose$if_false0) @THIS D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @memory.dealloc D=A @R14 M=D @RET_ADDRESS_CALL308 D=A @95 0;JMP (RET_ADDRESS_CALL308) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.length) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.charat) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT57 D=A @38 0;JMP (RET_ADDRESS_LT57) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT46 D=A @22 0;JMP (RET_ADDRESS_GT46) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ30 D=A @6 0;JMP (RET_ADDRESS_EQ30) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @string.charat$if_true0 D;JNE @string.charat$if_false0 0;JMP (string.charat$if_true0) @15 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL309 D=A @95 0;JMP (RET_ADDRESS_CALL309) @SP AM=M-1 D=M @R5 M=D (string.charat$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.setcharat) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT58 D=A @38 0;JMP (RET_ADDRESS_LT58) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT47 D=A @22 0;JMP (RET_ADDRESS_GT47) @SP AM=M-1 D=M A=A-1 M=D|M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ31 D=A @6 0;JMP (RET_ADDRESS_EQ31) @SP AM=M-1 D=M A=A-1 M=D|M @SP AM=M-1 D=M @string.setcharat$if_true0 D;JNE @string.setcharat$if_false0 0;JMP (string.setcharat$if_true0) @16 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL310 D=A @95 0;JMP (RET_ADDRESS_CALL310) @SP AM=M-1 D=M @R5 M=D (string.setcharat$if_false0) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.appendchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ32 D=A @6 0;JMP (RET_ADDRESS_EQ32) @SP AM=M-1 D=M @string.appendchar$if_true0 D;JNE @string.appendchar$if_false0 0;JMP (string.appendchar$if_true0) @17 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL311 D=A @95 0;JMP (RET_ADDRESS_CALL311) @SP AM=M-1 D=M @R5 M=D (string.appendchar$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.eraselastchar) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ33 D=A @6 0;JMP (RET_ADDRESS_EQ33) @SP AM=M-1 D=M @string.eraselastchar$if_true0 D;JNE @string.eraselastchar$if_false0 0;JMP (string.eraselastchar$if_true0) @18 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL312 D=A @95 0;JMP (RET_ADDRESS_CALL312) @SP AM=M-1 D=M @R5 M=D (string.eraselastchar$if_false0) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.intvalue) @5 D=A (LOOP_string.intvalue) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_string.intvalue D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ34 D=A @6 0;JMP (RET_ADDRESS_EQ34) @SP AM=M-1 D=M @string.intvalue$if_true0 D;JNE @string.intvalue$if_false0 0;JMP (string.intvalue$if_true0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.intvalue$if_false0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=0 @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @45 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_EQ35 D=A @6 0;JMP (RET_ADDRESS_EQ35) @SP AM=M-1 D=M @string.intvalue$if_true1 D;JNE @string.intvalue$if_false1 0;JMP (string.intvalue$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 A=A+1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @LCL A=M M=D (string.intvalue$if_false1) (string.intvalue$while_exp0) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT59 D=A @38 0;JMP (RET_ADDRESS_LT59) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D&M @SP A=M-1 M=!M @SP AM=M-1 D=M @string.intvalue$while_end0 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @48 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT60 D=A @38 0;JMP (RET_ADDRESS_LT60) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @9 D=A @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_GT48 D=A @22 0;JMP (RET_ADDRESS_GT48) @SP AM=M-1 D=M A=A-1 M=D|M @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.intvalue$if_true2 D;JNE @string.intvalue$if_false2 0;JMP (string.intvalue$if_true2) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL313 D=A @95 0;JMP (RET_ADDRESS_CALL313) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (string.intvalue$if_false2) @string.intvalue$while_exp0 0;JMP (string.intvalue$while_end0) @LCL D=M @4 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.intvalue$if_true3 D;JNE @string.intvalue$if_false3 0;JMP (string.intvalue$if_true3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @LCL A=M+1 M=D (string.intvalue$if_false3) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.setint) @4 D=A (LOOP_string.setint) D=D-1 @SP AM=M+1 A=A-1 M=0 @LOOP_string.setint D;JGT @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ36 D=A @6 0;JMP (RET_ADDRESS_EQ36) @SP AM=M-1 D=M @string.setint$if_true0 D;JNE @string.setint$if_false0 0;JMP (string.setint$if_true0) @19 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL314 D=A @95 0;JMP (RET_ADDRESS_CALL314) @SP AM=M-1 D=M @R5 M=D (string.setint$if_false0) @6 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.new D=A @R14 M=D @RET_ADDRESS_CALL315 D=A @95 0;JMP (RET_ADDRESS_CALL315) @SP AM=M-1 D=M @LCL A=M+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT61 D=A @38 0;JMP (RET_ADDRESS_LT61) @SP AM=M-1 D=M @string.setint$if_true1 D;JNE @string.setint$if_false1 0;JMP (string.setint$if_true1) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP AM=M-1 D=M @LCL A=M+1 A=A+1 A=A+1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP A=M-1 D=!M M=D+1 @SP AM=M-1 D=M @ARG A=M+1 M=D (string.setint$if_false1) @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M+1 M=D (string.setint$while_exp0) @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT49 D=A @22 0;JMP (RET_ADDRESS_GT49) @SP A=M-1 M=!M @SP AM=M-1 D=M @string.setint$while_end0 D;JNE @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.divide D=A @R14 M=D @RET_ADDRESS_CALL316 D=A @95 0;JMP (RET_ADDRESS_CALL316) @SP AM=M-1 D=M @LCL A=M+1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @48 D=A @SP AM=M+1 A=A-1 M=D @ARG A=M+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @10 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @math.multiply D=A @R14 M=D @RET_ADDRESS_CALL317 D=A @95 0;JMP (RET_ADDRESS_CALL317) @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D @LCL A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @ARG A=M+1 M=D @string.setint$while_exp0 0;JMP (string.setint$while_end0) @LCL D=M @3 A=D+A D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @string.setint$if_true2 D;JNE @string.setint$if_false2 0;JMP (string.setint$if_true2) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @45 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @LCL A=M M=D (string.setint$if_false2) @THIS A=M D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT62 D=A @38 0;JMP (RET_ADDRESS_LT62) @SP AM=M-1 D=M @string.setint$if_true3 D;JNE @string.setint$if_false3 0;JMP (string.setint$if_true3) @19 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL318 D=A @95 0;JMP (RET_ADDRESS_CALL318) @SP AM=M-1 D=M @R5 M=D (string.setint$if_false3) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_EQ37 D=A @6 0;JMP (RET_ADDRESS_EQ37) @SP AM=M-1 D=M @string.setint$if_true4 D;JNE @string.setint$if_false4 0;JMP (string.setint$if_true4) @SP M=M+1 A=M-1 M=0 @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @48 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @string.setint$if_end4 0;JMP (string.setint$if_false4) @SP M=M+1 A=M-1 M=0 @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D (string.setint$while_exp1) @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @RET_ADDRESS_LT63 D=A @38 0;JMP (RET_ADDRESS_LT63) @SP A=M-1 M=!M @SP AM=M-1 D=M @string.setint$while_end1 D;JNE @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M A=A-1 M=M-D @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THAT M=D @THAT A=M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @R5 M=D @SP AM=M-1 D=M @THAT M=D @R5 D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT A=M M=D @THIS A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M @THIS A=M+1 A=A+1 M=D @string.setint$while_exp1 0;JMP (string.setint$while_end1) (string.setint$if_end4) @LCL A=M+1 A=A+1 D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @array.dispose D=A @R14 M=D @RET_ADDRESS_CALL319 D=A @95 0;JMP (RET_ADDRESS_CALL319) @SP AM=M-1 D=M @R5 M=D @SP M=M+1 A=M-1 M=0 @54 0;JMP (string.newline) @128 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.backspace) @129 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (string.doublequote) @34 D=A @SP AM=M+1 A=A-1 M=D @54 0;JMP (sys.init) @0 D=A @R13 M=D @memory.init D=A @R14 M=D @RET_ADDRESS_CALL320 D=A @95 0;JMP (RET_ADDRESS_CALL320) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @math.init D=A @R14 M=D @RET_ADDRESS_CALL321 D=A @95 0;JMP (RET_ADDRESS_CALL321) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @screen.init D=A @R14 M=D @RET_ADDRESS_CALL322 D=A @95 0;JMP (RET_ADDRESS_CALL322) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @output.init D=A @R14 M=D @RET_ADDRESS_CALL323 D=A @95 0;JMP (RET_ADDRESS_CALL323) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @keyboard.init D=A @R14 M=D @RET_ADDRESS_CALL324 D=A @95 0;JMP (RET_ADDRESS_CALL324) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @main.main D=A @R14 M=D @RET_ADDRESS_CALL325 D=A @95 0;JMP (RET_ADDRESS_CALL325) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @sys.halt D=A @R14 M=D @RET_ADDRESS_CALL326 D=A @95 0;JMP (RET_ADDRESS_CALL326) @SP AM=M-1 D=M @R5 M=D (sys.halt) (sys.halt$while_exp0) @SP M=M+1 A=M-1 M=0 @SP A=M-1 M=!M @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.halt$while_end0 D;JNE @sys.halt$while_exp0 0;JMP (sys.halt$while_end0) (sys.wait) @SP AM=M+1 A=A-1 M=0 @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_LT64 D=A @38 0;JMP (RET_ADDRESS_LT64) @SP AM=M-1 D=M @sys.wait$if_true0 D;JNE @sys.wait$if_false0 0;JMP (sys.wait$if_true0) @SP M=M+1 A=M-1 M=1 @1 D=A @R13 M=D @sys.error D=A @R14 M=D @RET_ADDRESS_CALL327 D=A @95 0;JMP (RET_ADDRESS_CALL327) @SP AM=M-1 D=M @R5 M=D (sys.wait$if_false0) (sys.wait$while_exp0) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT50 D=A @22 0;JMP (RET_ADDRESS_GT50) @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.wait$while_end0 D;JNE @50 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @LCL A=M M=D (sys.wait$while_exp1) @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=0 @RET_ADDRESS_GT51 D=A @22 0;JMP (RET_ADDRESS_GT51) @SP A=M-1 M=!M @SP AM=M-1 D=M @sys.wait$while_end1 D;JNE @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @LCL A=M M=D @sys.wait$while_exp1 0;JMP (sys.wait$while_end1) @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @SP M=M+1 A=M-1 M=1 @SP AM=M-1 D=M A=A-1 M=M-D @SP AM=M-1 D=M @ARG A=M M=D @sys.wait$while_exp0 0;JMP (sys.wait$while_end0) @SP M=M+1 A=M-1 M=0 @54 0;JMP (sys.error) @3 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @string.new D=A @R14 M=D @RET_ADDRESS_CALL328 D=A @95 0;JMP (RET_ADDRESS_CALL328) @69 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL329 D=A @95 0;JMP (RET_ADDRESS_CALL329) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL330 D=A @95 0;JMP (RET_ADDRESS_CALL330) @82 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @R13 M=D @string.appendchar D=A @R14 M=D @RET_ADDRESS_CALL331 D=A @95 0;JMP (RET_ADDRESS_CALL331) @1 D=A @R13 M=D @output.printstring D=A @R14 M=D @RET_ADDRESS_CALL332 D=A @95 0;JMP (RET_ADDRESS_CALL332) @SP AM=M-1 D=M @R5 M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @R13 M=D @output.printint D=A @R14 M=D @RET_ADDRESS_CALL333 D=A @95 0;JMP (RET_ADDRESS_CALL333) @SP AM=M-1 D=M @R5 M=D @0 D=A @R13 M=D @sys.halt D=A @R14 M=D @RET_ADDRESS_CALL334 D=A @95 0;JMP (RET_ADDRESS_CALL334) @SP AM=M-1 D=M @R5 M=D
; repeat-macros.asm *pragmapush list ; Save state of list pragma pragma nolist ; Turn off assembly listing and exclude from symbol list ifndef REPEAT_MACRO ; Load macro only once ; Set defaults in case repeat macro is never called to pass assembler ; checks. Otherwise assembler will stop with error "Conditions must ; be constant on pass 1" repeat_count set 0 repeat1_count set 0 repeat2_count set 0 repeat4_count set 0 repeat8_count set 0 repeat16_count set 0 repeat32_count set 0 ;------------------------------------------------------------------------------ ; Repeat a macro X number of times ; ; examples: ; 1) repeat 4,lsra ; repeat instruction "lsra" four times ; ; 2) copy_one_line macro ; an example of a macro to repeat ; lda ,u ; sta ,x ; abx ; endm ; repeat 100,copy_one_line ; repeat macro 100 times ; ; 3) repeat 4,lsra,rorb ; repeat combination up to 8 ; ;------------------------------------------------------------------------------ repeat macro *pragmapush list ; Save state of list pragma pragma nolist ; Turn off assembly listing and exclude from symbol list repeat_count set \1 ifne repeat_count ; test for zero repeat case repeat32_count set repeat_count/32 repeat_count set repeat_count-(repeat32_count*32) repeat16_count set repeat_count/16 repeat_count set repeat_count-(repeat16_count*16) repeat8_count set repeat_count/8 repeat_count set repeat_count-(repeat8_count*8) repeat4_count set repeat_count/4 repeat_count set repeat_count-(repeat4_count*4) repeat2_count set repeat_count/2 repeat1_count set repeat_count-(repeat2_count*2) ifne repeat32_count repeat32plus repeat32_count,\2,\3,\4,\5,\6,\7,\8,\9 endc ifne repeat16_count repeat16 \2,\3,\4,\5,\6,\7,\8,\9 endc ifne repeat8_count repeat8 \2,\3,\4,\5,\6,\7,\8,\9 endc ifne repeat4_count repeat4 \2,\3,\4,\5,\6,\7,\8,\9 endc ifne repeat2_count repeat2 \2,\3,\4,\5,\6,\7,\8,\9 endc ifne repeat1_count repeat1 \2,\3,\4,\5,\6,\7,\8,\9 endc endc *pragmapop list ; restore assembly listing to previous state endm repeat1 macro noexpand \1 \2 \3 \4 \5 \6 \7 \8 endm repeat2 macro noexpand repeat1 \1,\2,\3,\4,\5,\6,\7,\8 repeat1 \1,\2,\3,\4,\5,\6,\7,\8 endm repeat4 macro noexpand repeat2 \1,\2,\3,\4,\5,\6,\7,\8 repeat2 \1,\2,\3,\4,\5,\6,\7,\8 endm repeat8 macro noexpand repeat4 \1,\2,\3,\4,\5,\6,\7,\8 repeat4 \1,\2,\3,\4,\5,\6,\7,\8 endm repeat16 macro noexpand repeat8 \1,\2,\3,\4,\5,\6,\7,\8 repeat8 \1,\2,\3,\4,\5,\6,\7,\8 endm repeat32 macro noexpand repeat16 \1,\2,\3,\4,\5,\6,\7,\8 repeat16 \1,\2,\3,\4,\5,\6,\7,\8 endm repeat32plus macro noexpand repeat32 \2,\3,\4,\5,\6,\7,\8,\9 repeat32_count set \1-1 ifgt repeat32_count repeat32plus repeat32_count,\2,\3,\4,\5,\6,\7,\8,\9 endc endm REPEAT_MACRO equ 1 ; Set flag for macro being loaded endc *pragmapop list ; restore assembly listing to previous state
/* * Copyright (c) 2021, Intel Corporation * * 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. */ #include "MDF_FC_common_genx.h" _GENX_MAIN_ void Compute_Lumakey( CURBE_INPUT_OUTPUT, GLOBAL_BUFFER_INPUT_OUTPUT) { if (Buffer_Index) { uchar Mask_Index = cm_add<uchar>((Buffer_Index >> 4), -4, SAT); Mask_Index = Mask_Index << 2; Mask_Index = Mask_Index + ((Layer_Index & 0x80) >> 4); // Shift right Layer_Index 7 bits for sec half flag, left 3 bits for mask offset uchar Buffer_Index1 = (Buffer_Index & 0x0f) << 4; uchar Buffer_Index2 = (Buffer_Index >> 4) << 4; ushort LowLuma = LumakeyLowThreshold << 8; ushort HighLuma = LumakeyHighThreshold << 8; vector<ushort, 16> Lumakey_mask; ushort Temp_packed_mask; matrix <ushort, 1, 16> Compare_temp; /* Buffer layout after shuffle _________________________________________________ |_______Block0__________|_______Block1__________| |_______Block2__________|_______Block3__________| |_______Block4__________|_______Block5__________| |_______Block6__________|_______Block7__________| Write back buffer layout correlate to the block number#, each box stands for 1 GRF _______________________________________________ |____R0_________R1_____|____R2_________R3_____| |____G0_________G1_____|____G2_________G3_____| |____B0_________B1_____|____B2_________B3_____| |____A0_________A1_____|____A2_________A3_____| |____R4_________R5_____|____R6_________R7_____| |____G4_________G5_____|____G6_________G7_____| |____B4_________B5_____|____B6_________B7_____| |____A4_________A5_____|____A6_________A7_____| */ matrix_ref<ushort, 16, 16> WriteBackBuffer1 = DataBuffer.format<ushort, 96, 16>().select<16, 1, 16, 1>(Buffer_Index1, 0); matrix_ref<ushort, 16, 16> WriteBackBuffer2 = DataBuffer.format<ushort, 96, 16>().select<16, 1, 16, 1>(Buffer_Index2, 0); Compare_temp = WriteBackBuffer2.select<1, 1, 16, 1>(2, 0) & 0xFF00; Lumakey_mask = Compare_temp > HighLuma; Lumakey_mask |= Compare_temp < LowLuma; Temp_packed_mask = cm_pack_mask(Lumakey_mask); TempMask[Mask_Index] = Temp_packed_mask & TempMask[Mask_Index]; // U/V/A channels bottom half Compare_temp = WriteBackBuffer2.select<1, 1, 16, 1>(3, 0) & 0xFF00; Lumakey_mask = Compare_temp > HighLuma; Lumakey_mask |= Compare_temp < LowLuma; Temp_packed_mask = cm_pack_mask(Lumakey_mask); TempMask[Mask_Index + 1] = Temp_packed_mask & TempMask[Mask_Index + 1]; // U/V/A channels bottom half Compare_temp = WriteBackBuffer2.select<1, 1, 16, 1>(10, 0) & 0xFF00; Lumakey_mask = Compare_temp > HighLuma; Lumakey_mask |= Compare_temp < LowLuma; Temp_packed_mask = cm_pack_mask(Lumakey_mask); TempMask[Mask_Index + 2] = Temp_packed_mask & TempMask[Mask_Index + 2]; // U/V/A channels bottom half Compare_temp = WriteBackBuffer2.select<1, 1, 16, 1>(11, 0) & 0xFF00; Lumakey_mask = Compare_temp > HighLuma; Lumakey_mask |= Compare_temp < LowLuma; Temp_packed_mask = cm_pack_mask(Lumakey_mask); TempMask[Mask_Index + 3] = Temp_packed_mask & TempMask[Mask_Index + 3]; } }
; A074794: Number of numbers k <= n such that tau(k) == 1 (mod 3) where tau(k) = A000005(k) is the number of divisors of k. ; 1,1,1,1,1,2,2,3,3,4,4,4,4,5,6,6,6,6,6,6,7,8,8,8,8,9,10,10,10,10,10,10,11,12,13,13,13,14,15,15,15,15,15,15,15,16,16,17,17,17,18,18,18,18,19,19,20,21,21,21,21,22,22,23,24,24,24,24,25,25,25,25,25,26,26,26,27,27,27,28,28,29,29,29,30,31,32,32,32,32,33,33,34,35,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,38,39,39,39,40,40,40,41,42,43,43,44,45,45,46,46,46,46,47,47,47,47,48,49,49,49,49,49,49,49,50,51,52,52,53,54,54,54,54,54,54,54,54,54,55,55,55,56,57,57,58,59,59,59,59,60,60,61,61,61,61,61,61,61,61,62,63,64,64,64,64,64,65,65,66,66,67,67,67,67,67,67,67,68,68,68,68,68,68,68,69,70,71,71,72,73,73,74,75,76,76,76,77,78,79,80,81,82,83,83,84,84,84,84,84,85,85,85,85,85,85,85,85,85,86,86,87,87,87,87,87,87,87,87,87,87,88,88,89,89 mov $4,$0 mov $6,$0 add $6,1 lpb $6 clr $0,4 mov $0,$4 sub $6,1 sub $0,$6 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. add $1,3 mov $3,$0 mul $3,2 add $3,16 gcd $3,$1 add $2,$3 mov $1,$2 div $1,2 add $5,$1 lpe mov $1,$5
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 6, 0x90 POLY: .quad 0x1, 0xC200000000000000 TWOONE: .quad 0x1, 0x100000000 SHUF_CONST: .quad 0x8090a0b0c0d0e0f, 0x1020304050607 MASK1: .quad 0xffffffffffffffff, 0x0 MASK2: .quad 0x0, 0xffffffffffffffff INC_1: .quad 1,0 .p2align 6, 0x90 .globl AesGcmPrecompute_avx .type AesGcmPrecompute_avx, @function AesGcmPrecompute_avx: movdqu (%rsi), %xmm0 pshufb SHUF_CONST(%rip), %xmm0 movdqa %xmm0, %xmm4 psllq $(1), %xmm0 psrlq $(63), %xmm4 movdqa %xmm4, %xmm3 pslldq $(8), %xmm4 psrldq $(8), %xmm3 por %xmm4, %xmm0 pshufd $(36), %xmm3, %xmm4 pcmpeqd TWOONE(%rip), %xmm4 pand POLY(%rip), %xmm4 pxor %xmm4, %xmm0 movdqa %xmm0, %xmm1 pshufd $(78), %xmm1, %xmm5 pshufd $(78), %xmm0, %xmm3 pxor %xmm1, %xmm5 pxor %xmm0, %xmm3 pclmulqdq $(0), %xmm3, %xmm5 movdqa %xmm1, %xmm4 pclmulqdq $(0), %xmm0, %xmm1 pxor %xmm3, %xmm3 pclmulqdq $(17), %xmm0, %xmm4 pxor %xmm1, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm3 pslldq $(8), %xmm5 pxor %xmm3, %xmm4 pxor %xmm5, %xmm1 movdqa %xmm1, %xmm3 movdqa %xmm1, %xmm5 movdqa %xmm1, %xmm15 psllq $(63), %xmm3 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm3 pxor %xmm15, %xmm3 movdqa %xmm3, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm3 pxor %xmm5, %xmm1 pxor %xmm3, %xmm4 movdqa %xmm1, %xmm5 psrlq $(5), %xmm5 pxor %xmm1, %xmm5 psrlq $(1), %xmm5 pxor %xmm1, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm1 pxor %xmm4, %xmm1 movdqa %xmm1, %xmm2 pshufd $(78), %xmm2, %xmm5 pshufd $(78), %xmm1, %xmm3 pxor %xmm2, %xmm5 pxor %xmm1, %xmm3 pclmulqdq $(0), %xmm3, %xmm5 movdqa %xmm2, %xmm4 pclmulqdq $(0), %xmm1, %xmm2 pxor %xmm3, %xmm3 pclmulqdq $(17), %xmm1, %xmm4 pxor %xmm2, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm3 pslldq $(8), %xmm5 pxor %xmm3, %xmm4 pxor %xmm5, %xmm2 movdqa %xmm2, %xmm3 movdqa %xmm2, %xmm5 movdqa %xmm2, %xmm15 psllq $(63), %xmm3 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm3 pxor %xmm15, %xmm3 movdqa %xmm3, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm3 pxor %xmm5, %xmm2 pxor %xmm3, %xmm4 movdqa %xmm2, %xmm5 psrlq $(5), %xmm5 pxor %xmm2, %xmm5 psrlq $(1), %xmm5 pxor %xmm2, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm2 pxor %xmm4, %xmm2 movdqu %xmm0, (%rdi) movdqu %xmm1, (16)(%rdi) movdqu %xmm2, (32)(%rdi) vzeroupper ret .Lfe1: .size AesGcmPrecompute_avx, .Lfe1-(AesGcmPrecompute_avx) .p2align 6, 0x90 .globl AesGcmMulGcm_avx .type AesGcmMulGcm_avx, @function AesGcmMulGcm_avx: movdqa (%rdi), %xmm0 pshufb SHUF_CONST(%rip), %xmm0 movdqa (%rsi), %xmm1 pshufd $(78), %xmm0, %xmm4 pshufd $(78), %xmm1, %xmm2 pxor %xmm0, %xmm4 pxor %xmm1, %xmm2 pclmulqdq $(0), %xmm2, %xmm4 movdqa %xmm0, %xmm3 pclmulqdq $(0), %xmm1, %xmm0 pxor %xmm2, %xmm2 pclmulqdq $(17), %xmm1, %xmm3 pxor %xmm0, %xmm4 pxor %xmm3, %xmm4 palignr $(8), %xmm4, %xmm2 pslldq $(8), %xmm4 pxor %xmm2, %xmm3 pxor %xmm4, %xmm0 movdqa %xmm0, %xmm2 movdqa %xmm0, %xmm4 movdqa %xmm0, %xmm15 psllq $(63), %xmm2 psllq $(62), %xmm4 psllq $(57), %xmm15 pxor %xmm4, %xmm2 pxor %xmm15, %xmm2 movdqa %xmm2, %xmm4 pslldq $(8), %xmm4 psrldq $(8), %xmm2 pxor %xmm4, %xmm0 pxor %xmm2, %xmm3 movdqa %xmm0, %xmm4 psrlq $(5), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm4, %xmm0 pxor %xmm3, %xmm0 pshufb SHUF_CONST(%rip), %xmm0 movdqa %xmm0, (%rdi) vzeroupper ret .Lfe2: .size AesGcmMulGcm_avx, .Lfe2-(AesGcmMulGcm_avx) .p2align 6, 0x90 .globl AesGcmAuth_avx .type AesGcmAuth_avx, @function AesGcmAuth_avx: movdqa (%rdi), %xmm0 pshufb SHUF_CONST(%rip), %xmm0 movdqa (%rcx), %xmm1 movslq %edx, %rdx .p2align 6, 0x90 .Lauth_loopgas_3: movdqu (%rsi), %xmm2 pshufb SHUF_CONST(%rip), %xmm2 add $(16), %rsi pxor %xmm2, %xmm0 pshufd $(78), %xmm0, %xmm4 pshufd $(78), %xmm1, %xmm2 pxor %xmm0, %xmm4 pxor %xmm1, %xmm2 pclmulqdq $(0), %xmm2, %xmm4 movdqa %xmm0, %xmm3 pclmulqdq $(0), %xmm1, %xmm0 pxor %xmm2, %xmm2 pclmulqdq $(17), %xmm1, %xmm3 pxor %xmm0, %xmm4 pxor %xmm3, %xmm4 palignr $(8), %xmm4, %xmm2 pslldq $(8), %xmm4 pxor %xmm2, %xmm3 pxor %xmm4, %xmm0 movdqa %xmm0, %xmm2 movdqa %xmm0, %xmm4 movdqa %xmm0, %xmm15 psllq $(63), %xmm2 psllq $(62), %xmm4 psllq $(57), %xmm15 pxor %xmm4, %xmm2 pxor %xmm15, %xmm2 movdqa %xmm2, %xmm4 pslldq $(8), %xmm4 psrldq $(8), %xmm2 pxor %xmm4, %xmm0 pxor %xmm2, %xmm3 movdqa %xmm0, %xmm4 psrlq $(5), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm4, %xmm0 pxor %xmm3, %xmm0 sub $(16), %rdx jnz .Lauth_loopgas_3 pshufb SHUF_CONST(%rip), %xmm0 movdqa %xmm0, (%rdi) vzeroupper ret .Lfe3: .size AesGcmAuth_avx, .Lfe3-(AesGcmAuth_avx) .p2align 6, 0x90 .globl AesGcmEnc_avx .type AesGcmEnc_avx, @function AesGcmEnc_avx: push %rbx sub $(128), %rsp mov (152)(%rsp), %rax mov (160)(%rsp), %rbx mov (144)(%rsp), %rcx movdqa SHUF_CONST(%rip), %xmm4 movdqu (%rax), %xmm0 movdqu (%rbx), %xmm1 movdqu (%rcx), %xmm2 pshufb %xmm4, %xmm0 movdqa %xmm0, (%rsp) movdqa %xmm1, (16)(%rsp) pshufb %xmm4, %xmm2 pxor %xmm1, %xmm1 movdqa %xmm2, (32)(%rsp) movdqa %xmm1, (48)(%rsp) movdqa %xmm1, (64)(%rsp) movdqa %xmm1, (80)(%rsp) mov (168)(%rsp), %rbx movdqa (32)(%rbx), %xmm10 pshufd $(78), %xmm10, %xmm9 pxor %xmm10, %xmm9 movdqa %xmm9, (96)(%rsp) movslq %edx, %rdx mov %r9, %rcx mov %rdx, %rax and $(63), %rax and $(-64), %rdx jz .Lsingle_block_procgas_4 .p2align 6, 0x90 .Lblks4_loopgas_4: movdqa INC_1(%rip), %xmm6 movdqa SHUF_CONST(%rip), %xmm5 movdqa %xmm0, %xmm1 paddd %xmm6, %xmm1 movdqa %xmm1, %xmm2 paddd %xmm6, %xmm2 movdqa %xmm2, %xmm3 paddd %xmm6, %xmm3 movdqa %xmm3, %xmm4 paddd %xmm6, %xmm4 movdqa %xmm4, (%rsp) movdqa (%rcx), %xmm0 mov %rcx, %r10 pshufb %xmm5, %xmm1 pshufb %xmm5, %xmm2 pshufb %xmm5, %xmm3 pshufb %xmm5, %xmm4 pxor %xmm0, %xmm1 pxor %xmm0, %xmm2 pxor %xmm0, %xmm3 pxor %xmm0, %xmm4 movdqa (16)(%r10), %xmm0 add $(16), %r10 mov %r8d, %r11d sub $(1), %r11 .p2align 6, 0x90 .Lcipher4_loopgas_4: aesenc %xmm0, %xmm1 aesenc %xmm0, %xmm2 aesenc %xmm0, %xmm3 aesenc %xmm0, %xmm4 movdqa (16)(%r10), %xmm0 add $(16), %r10 dec %r11 jnz .Lcipher4_loopgas_4 aesenclast %xmm0, %xmm1 aesenclast %xmm0, %xmm2 aesenclast %xmm0, %xmm3 aesenclast %xmm0, %xmm4 movdqa (16)(%rsp), %xmm0 movdqa %xmm4, (16)(%rsp) movdqu (%rsi), %xmm4 movdqu (16)(%rsi), %xmm5 movdqu (32)(%rsi), %xmm6 movdqu (48)(%rsi), %xmm7 add $(64), %rsi pxor %xmm4, %xmm0 movdqu %xmm0, (%rdi) pshufb SHUF_CONST(%rip), %xmm0 pxor (32)(%rsp), %xmm0 pxor %xmm5, %xmm1 movdqu %xmm1, (16)(%rdi) pshufb SHUF_CONST(%rip), %xmm1 pxor (48)(%rsp), %xmm1 pxor %xmm6, %xmm2 movdqu %xmm2, (32)(%rdi) pshufb SHUF_CONST(%rip), %xmm2 pxor (64)(%rsp), %xmm2 pxor %xmm7, %xmm3 movdqu %xmm3, (48)(%rdi) pshufb SHUF_CONST(%rip), %xmm3 pxor (80)(%rsp), %xmm3 add $(64), %rdi cmp $(64), %rdx je .Lcombine_hashgas_4 movdqa MASK1(%rip), %xmm14 pshufd $(78), %xmm0, %xmm6 movdqa %xmm0, %xmm5 pxor %xmm0, %xmm6 pclmulqdq $(0), %xmm10, %xmm0 pshufd $(78), %xmm1, %xmm13 movdqa %xmm1, %xmm12 pxor %xmm1, %xmm13 pclmulqdq $(17), %xmm10, %xmm5 pclmulqdq $(0), %xmm9, %xmm6 pxor %xmm0, %xmm6 pxor %xmm5, %xmm6 pshufd $(78), %xmm6, %xmm4 movdqa %xmm4, %xmm6 pand MASK2(%rip), %xmm4 pand %xmm14, %xmm6 pxor %xmm4, %xmm0 pxor %xmm6, %xmm5 movdqa %xmm0, %xmm4 psllq $(1), %xmm0 pclmulqdq $(0), %xmm10, %xmm1 pxor %xmm4, %xmm0 psllq $(5), %xmm0 pxor %xmm4, %xmm0 psllq $(57), %xmm0 pshufd $(78), %xmm0, %xmm6 movdqa %xmm6, %xmm0 pclmulqdq $(17), %xmm10, %xmm12 pand %xmm14, %xmm6 pand MASK2(%rip), %xmm0 pxor %xmm4, %xmm0 pxor %xmm6, %xmm5 movdqa %xmm0, %xmm6 psrlq $(5), %xmm0 pclmulqdq $(0), %xmm9, %xmm13 pxor %xmm6, %xmm0 psrlq $(1), %xmm0 pxor %xmm6, %xmm0 psrlq $(1), %xmm0 pxor %xmm6, %xmm0 pxor %xmm5, %xmm0 pxor %xmm1, %xmm13 pxor %xmm12, %xmm13 pshufd $(78), %xmm13, %xmm11 movdqa %xmm11, %xmm13 pand MASK2(%rip), %xmm11 pand %xmm14, %xmm13 pxor %xmm11, %xmm1 pxor %xmm13, %xmm12 movdqa %xmm1, %xmm11 movdqa %xmm1, %xmm13 movdqa %xmm1, %xmm15 psllq $(63), %xmm11 psllq $(62), %xmm13 psllq $(57), %xmm15 pxor %xmm13, %xmm11 pxor %xmm15, %xmm11 movdqa %xmm11, %xmm13 pslldq $(8), %xmm13 psrldq $(8), %xmm11 pxor %xmm13, %xmm1 pxor %xmm11, %xmm12 movdqa %xmm1, %xmm13 psrlq $(5), %xmm13 pxor %xmm1, %xmm13 psrlq $(1), %xmm13 pxor %xmm1, %xmm13 psrlq $(1), %xmm13 pxor %xmm13, %xmm1 pxor %xmm12, %xmm1 pshufd $(78), %xmm2, %xmm6 movdqa %xmm2, %xmm5 pxor %xmm2, %xmm6 pclmulqdq $(0), %xmm10, %xmm2 pshufd $(78), %xmm3, %xmm13 movdqa %xmm3, %xmm12 pxor %xmm3, %xmm13 pclmulqdq $(17), %xmm10, %xmm5 pclmulqdq $(0), %xmm9, %xmm6 pxor %xmm2, %xmm6 pxor %xmm5, %xmm6 pshufd $(78), %xmm6, %xmm4 movdqa %xmm4, %xmm6 pand MASK2(%rip), %xmm4 pand %xmm14, %xmm6 pxor %xmm4, %xmm2 pxor %xmm6, %xmm5 movdqa %xmm2, %xmm4 psllq $(1), %xmm2 pclmulqdq $(0), %xmm10, %xmm3 pxor %xmm4, %xmm2 psllq $(5), %xmm2 pxor %xmm4, %xmm2 psllq $(57), %xmm2 pshufd $(78), %xmm2, %xmm6 movdqa %xmm6, %xmm2 pclmulqdq $(17), %xmm10, %xmm12 pand %xmm14, %xmm6 pand MASK2(%rip), %xmm2 pxor %xmm4, %xmm2 pxor %xmm6, %xmm5 movdqa %xmm2, %xmm6 psrlq $(5), %xmm2 pclmulqdq $(0), %xmm9, %xmm13 pxor %xmm6, %xmm2 psrlq $(1), %xmm2 pxor %xmm6, %xmm2 psrlq $(1), %xmm2 pxor %xmm6, %xmm2 pxor %xmm5, %xmm2 pxor %xmm3, %xmm13 pxor %xmm12, %xmm13 pshufd $(78), %xmm13, %xmm11 movdqa %xmm11, %xmm13 pand MASK2(%rip), %xmm11 pand %xmm14, %xmm13 pxor %xmm11, %xmm3 pxor %xmm13, %xmm12 movdqa %xmm3, %xmm11 movdqa %xmm3, %xmm13 movdqa %xmm3, %xmm15 psllq $(63), %xmm11 psllq $(62), %xmm13 psllq $(57), %xmm15 pxor %xmm13, %xmm11 pxor %xmm15, %xmm11 movdqa %xmm11, %xmm13 pslldq $(8), %xmm13 psrldq $(8), %xmm11 pxor %xmm13, %xmm3 pxor %xmm11, %xmm12 movdqa %xmm3, %xmm13 psrlq $(5), %xmm13 pxor %xmm3, %xmm13 psrlq $(1), %xmm13 pxor %xmm3, %xmm13 psrlq $(1), %xmm13 pxor %xmm13, %xmm3 pxor %xmm12, %xmm3 movdqa %xmm0, (32)(%rsp) movdqa %xmm1, (48)(%rsp) movdqa %xmm2, (64)(%rsp) movdqa %xmm3, (80)(%rsp) sub $(64), %rdx movdqa (%rsp), %xmm0 cmp $(64), %rdx jge .Lblks4_loopgas_4 .Lcombine_hashgas_4: movdqa (%rbx), %xmm8 movdqa (16)(%rbx), %xmm9 pshufd $(78), %xmm0, %xmm5 pshufd $(78), %xmm10, %xmm6 pxor %xmm0, %xmm5 pxor %xmm10, %xmm6 pclmulqdq $(0), %xmm6, %xmm5 movdqa %xmm0, %xmm4 pclmulqdq $(0), %xmm10, %xmm0 pxor %xmm6, %xmm6 pclmulqdq $(17), %xmm10, %xmm4 pxor %xmm0, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm6 pslldq $(8), %xmm5 pxor %xmm6, %xmm4 pxor %xmm5, %xmm0 movdqa %xmm0, %xmm6 movdqa %xmm0, %xmm5 movdqa %xmm0, %xmm15 psllq $(63), %xmm6 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm6 pxor %xmm15, %xmm6 movdqa %xmm6, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm6 pxor %xmm5, %xmm0 pxor %xmm6, %xmm4 movdqa %xmm0, %xmm5 psrlq $(5), %xmm5 pxor %xmm0, %xmm5 psrlq $(1), %xmm5 pxor %xmm0, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm0 pxor %xmm4, %xmm0 pshufd $(78), %xmm1, %xmm5 pshufd $(78), %xmm9, %xmm6 pxor %xmm1, %xmm5 pxor %xmm9, %xmm6 pclmulqdq $(0), %xmm6, %xmm5 movdqa %xmm1, %xmm4 pclmulqdq $(0), %xmm9, %xmm1 pxor %xmm6, %xmm6 pclmulqdq $(17), %xmm9, %xmm4 pxor %xmm1, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm6 pslldq $(8), %xmm5 pxor %xmm6, %xmm4 pxor %xmm5, %xmm1 movdqa %xmm1, %xmm6 movdqa %xmm1, %xmm5 movdqa %xmm1, %xmm15 psllq $(63), %xmm6 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm6 pxor %xmm15, %xmm6 movdqa %xmm6, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm6 pxor %xmm5, %xmm1 pxor %xmm6, %xmm4 movdqa %xmm1, %xmm5 psrlq $(5), %xmm5 pxor %xmm1, %xmm5 psrlq $(1), %xmm5 pxor %xmm1, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm1 pxor %xmm4, %xmm1 pshufd $(78), %xmm2, %xmm5 pshufd $(78), %xmm8, %xmm6 pxor %xmm2, %xmm5 pxor %xmm8, %xmm6 pclmulqdq $(0), %xmm6, %xmm5 movdqa %xmm2, %xmm4 pclmulqdq $(0), %xmm8, %xmm2 pxor %xmm6, %xmm6 pclmulqdq $(17), %xmm8, %xmm4 pxor %xmm2, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm6 pslldq $(8), %xmm5 pxor %xmm6, %xmm4 pxor %xmm5, %xmm2 movdqa %xmm2, %xmm6 movdqa %xmm2, %xmm5 movdqa %xmm2, %xmm15 psllq $(63), %xmm6 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm6 pxor %xmm15, %xmm6 movdqa %xmm6, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm6 pxor %xmm5, %xmm2 pxor %xmm6, %xmm4 movdqa %xmm2, %xmm5 psrlq $(5), %xmm5 pxor %xmm2, %xmm5 psrlq $(1), %xmm5 pxor %xmm2, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm2 pxor %xmm4, %xmm2 pxor %xmm1, %xmm3 pxor %xmm2, %xmm3 pshufd $(78), %xmm3, %xmm5 pshufd $(78), %xmm8, %xmm6 pxor %xmm3, %xmm5 pxor %xmm8, %xmm6 pclmulqdq $(0), %xmm6, %xmm5 movdqa %xmm3, %xmm4 pclmulqdq $(0), %xmm8, %xmm3 pxor %xmm6, %xmm6 pclmulqdq $(17), %xmm8, %xmm4 pxor %xmm3, %xmm5 pxor %xmm4, %xmm5 palignr $(8), %xmm5, %xmm6 pslldq $(8), %xmm5 pxor %xmm6, %xmm4 pxor %xmm5, %xmm3 movdqa %xmm3, %xmm6 movdqa %xmm3, %xmm5 movdqa %xmm3, %xmm15 psllq $(63), %xmm6 psllq $(62), %xmm5 psllq $(57), %xmm15 pxor %xmm5, %xmm6 pxor %xmm15, %xmm6 movdqa %xmm6, %xmm5 pslldq $(8), %xmm5 psrldq $(8), %xmm6 pxor %xmm5, %xmm3 pxor %xmm6, %xmm4 movdqa %xmm3, %xmm5 psrlq $(5), %xmm5 pxor %xmm3, %xmm5 psrlq $(1), %xmm5 pxor %xmm3, %xmm5 psrlq $(1), %xmm5 pxor %xmm5, %xmm3 pxor %xmm4, %xmm3 pxor %xmm0, %xmm3 movdqa %xmm3, (32)(%rsp) .Lsingle_block_procgas_4: test %rax, %rax jz .Lquitgas_4 .p2align 6, 0x90 .Lblk_loopgas_4: movdqa (%rsp), %xmm0 movdqa %xmm0, %xmm1 paddd INC_1(%rip), %xmm1 movdqa %xmm1, (%rsp) movdqa (%rcx), %xmm0 mov %rcx, %r10 pshufb SHUF_CONST(%rip), %xmm1 pxor %xmm0, %xmm1 movdqa (16)(%r10), %xmm0 add $(16), %r10 mov %r8d, %r11d sub $(1), %r11 .p2align 6, 0x90 .Lcipher_loopgas_4: aesenc %xmm0, %xmm1 movdqa (16)(%r10), %xmm0 add $(16), %r10 dec %r11 jnz .Lcipher_loopgas_4 aesenclast %xmm0, %xmm1 movdqa (16)(%rsp), %xmm0 movdqa %xmm1, (16)(%rsp) movdqu (%rsi), %xmm1 add $(16), %rsi pxor %xmm1, %xmm0 movdqu %xmm0, (%rdi) add $(16), %rdi pshufb SHUF_CONST(%rip), %xmm0 pxor (32)(%rsp), %xmm0 movdqa (%rbx), %xmm1 pshufd $(78), %xmm0, %xmm4 pshufd $(78), %xmm1, %xmm2 pxor %xmm0, %xmm4 pxor %xmm1, %xmm2 pclmulqdq $(0), %xmm2, %xmm4 movdqa %xmm0, %xmm3 pclmulqdq $(0), %xmm1, %xmm0 pxor %xmm2, %xmm2 pclmulqdq $(17), %xmm1, %xmm3 pxor %xmm0, %xmm4 pxor %xmm3, %xmm4 palignr $(8), %xmm4, %xmm2 pslldq $(8), %xmm4 pxor %xmm2, %xmm3 pxor %xmm4, %xmm0 movdqa %xmm0, %xmm2 movdqa %xmm0, %xmm4 movdqa %xmm0, %xmm15 psllq $(63), %xmm2 psllq $(62), %xmm4 psllq $(57), %xmm15 pxor %xmm4, %xmm2 pxor %xmm15, %xmm2 movdqa %xmm2, %xmm4 pslldq $(8), %xmm4 psrldq $(8), %xmm2 pxor %xmm4, %xmm0 pxor %xmm2, %xmm3 movdqa %xmm0, %xmm4 psrlq $(5), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm0, %xmm4 psrlq $(1), %xmm4 pxor %xmm4, %xmm0 pxor %xmm3, %xmm0 movdqa %xmm0, (32)(%rsp) sub $(16), %rax jg .Lblk_loopgas_4 .Lquitgas_4: movdqa (%rsp), %xmm0 movdqa (16)(%rsp), %xmm1 movdqa (32)(%rsp), %xmm2 mov (152)(%rsp), %rax mov (160)(%rsp), %rbx mov (144)(%rsp), %rcx pshufb SHUF_CONST(%rip), %xmm0 movdqu %xmm0, (%rax) movdqu %xmm1, (%rbx) pshufb SHUF_CONST(%rip), %xmm2 movdqu %xmm2, (%rcx) add $(128), %rsp vzeroupper pop %rbx ret .Lfe4: .size AesGcmEnc_avx, .Lfe4-(AesGcmEnc_avx) .p2align 6, 0x90 .globl AesGcmDec_avx .type AesGcmDec_avx, @function AesGcmDec_avx: push %rbx sub $(128), %rsp mov (152)(%rsp), %rax mov (160)(%rsp), %rbx mov (144)(%rsp), %rcx movdqa SHUF_CONST(%rip), %xmm4 movdqu (%rax), %xmm0 movdqu (%rbx), %xmm1 movdqu (%rcx), %xmm2 pshufb %xmm4, %xmm0 movdqa %xmm0, (%rsp) movdqa %xmm1, (16)(%rsp) pshufb %xmm4, %xmm2 pxor %xmm1, %xmm1 movdqa %xmm2, (32)(%rsp) movdqa %xmm1, (48)(%rsp) movdqa %xmm1, (64)(%rsp) movdqa %xmm1, (80)(%rsp) mov (168)(%rsp), %rbx movdqa (32)(%rbx), %xmm10 pshufd $(78), %xmm10, %xmm9 pxor %xmm10, %xmm9 movdqa %xmm9, (96)(%rsp) movslq %edx, %rdx mov %r9, %rcx mov %rdx, %rax and $(63), %rax and $(-64), %rdx jz .Lsingle_block_procgas_5 .p2align 6, 0x90 .Lblks4_loopgas_5: movdqa INC_1(%rip), %xmm6 movdqa SHUF_CONST(%rip), %xmm5 movdqa %xmm0, %xmm1 paddd INC_1(%rip), %xmm1 movdqa %xmm1, %xmm2 paddd INC_1(%rip), %xmm2 movdqa %xmm2, %xmm3 paddd INC_1(%rip), %xmm3 movdqa %xmm3, %xmm4 paddd INC_1(%rip), %xmm4 movdqa %xmm4, (%rsp) movdqa (%rcx), %xmm0 mov %rcx, %r10 pshufb %xmm5, %xmm1 pshufb %xmm5, %xmm2 pshufb %xmm5, %xmm3 pshufb %xmm5, %xmm4 pxor %xmm0, %xmm1 pxor %xmm0, %xmm2 pxor %xmm0, %xmm3 pxor %xmm0, %xmm4 movdqa (16)(%r10), %xmm0 add $(16), %r10 mov %r8d, %r11d sub $(1), %r11 .p2align 6, 0x90 .Lcipher4_loopgas_5: aesenc %xmm0, %xmm1 aesenc %xmm0, %xmm2 aesenc %xmm0, %xmm3 aesenc %xmm0, %xmm4 movdqa (16)(%r10), %xmm0 add $(16), %r10 dec %r11 jnz .Lcipher4_loopgas_5 aesenclast %xmm0, %xmm1 aesenclast %xmm0, %xmm2 aesenclast %xmm0, %xmm3 aesenclast %xmm0, %xmm4 movdqa (16)(%rsp), %xmm0 movdqa %xmm4, (16)(%rsp) movdqu (%rsi), %xmm4 movdqu (16)(%rsi), %xmm5 movdqu (32)(%rsi), %xmm6 movdqu (48)(%rsi), %xmm7 add $(64), %rsi pxor %xmm4, %xmm0 movdqu %xmm0, (%rdi) pshufb SHUF_CONST(%rip), %xmm4 pxor (32)(%rsp), %xmm4 pxor %xmm5, %xmm1 movdqu %xmm1, (16)(%rdi) pshufb SHUF_CONST(%rip), %xmm5 pxor (48)(%rsp), %xmm5 pxor %xmm6, %xmm2 movdqu %xmm2, (32)(%rdi) pshufb SHUF_CONST(%rip), %xmm6 pxor (64)(%rsp), %xmm6 pxor %xmm7, %xmm3 movdqu %xmm3, (48)(%rdi) pshufb SHUF_CONST(%rip), %xmm7 pxor (80)(%rsp), %xmm7 add $(64), %rdi cmp $(64), %rdx je .Lcombine_hashgas_5 movdqa MASK1(%rip), %xmm14 pshufd $(78), %xmm4, %xmm2 movdqa %xmm4, %xmm1 pxor %xmm4, %xmm2 pclmulqdq $(0), %xmm10, %xmm4 pshufd $(78), %xmm5, %xmm13 movdqa %xmm5, %xmm12 pxor %xmm5, %xmm13 pclmulqdq $(17), %xmm10, %xmm1 pclmulqdq $(0), %xmm9, %xmm2 pxor %xmm4, %xmm2 pxor %xmm1, %xmm2 pshufd $(78), %xmm2, %xmm0 movdqa %xmm0, %xmm2 pand MASK2(%rip), %xmm0 pand %xmm14, %xmm2 pxor %xmm0, %xmm4 pxor %xmm2, %xmm1 movdqa %xmm4, %xmm0 psllq $(1), %xmm4 pclmulqdq $(0), %xmm10, %xmm5 pxor %xmm0, %xmm4 psllq $(5), %xmm4 pxor %xmm0, %xmm4 psllq $(57), %xmm4 pshufd $(78), %xmm4, %xmm2 movdqa %xmm2, %xmm4 pclmulqdq $(17), %xmm10, %xmm12 pand %xmm14, %xmm2 pand MASK2(%rip), %xmm4 pxor %xmm0, %xmm4 pxor %xmm2, %xmm1 movdqa %xmm4, %xmm2 psrlq $(5), %xmm4 pclmulqdq $(0), %xmm9, %xmm13 pxor %xmm2, %xmm4 psrlq $(1), %xmm4 pxor %xmm2, %xmm4 psrlq $(1), %xmm4 pxor %xmm2, %xmm4 pxor %xmm1, %xmm4 pxor %xmm5, %xmm13 pxor %xmm12, %xmm13 pshufd $(78), %xmm13, %xmm11 movdqa %xmm11, %xmm13 pand MASK2(%rip), %xmm11 pand %xmm14, %xmm13 pxor %xmm11, %xmm5 pxor %xmm13, %xmm12 movdqa %xmm5, %xmm11 movdqa %xmm5, %xmm13 movdqa %xmm5, %xmm15 psllq $(63), %xmm11 psllq $(62), %xmm13 psllq $(57), %xmm15 pxor %xmm13, %xmm11 pxor %xmm15, %xmm11 movdqa %xmm11, %xmm13 pslldq $(8), %xmm13 psrldq $(8), %xmm11 pxor %xmm13, %xmm5 pxor %xmm11, %xmm12 movdqa %xmm5, %xmm13 psrlq $(5), %xmm13 pxor %xmm5, %xmm13 psrlq $(1), %xmm13 pxor %xmm5, %xmm13 psrlq $(1), %xmm13 pxor %xmm13, %xmm5 pxor %xmm12, %xmm5 pshufd $(78), %xmm6, %xmm2 movdqa %xmm6, %xmm1 pxor %xmm6, %xmm2 pclmulqdq $(0), %xmm10, %xmm6 pshufd $(78), %xmm7, %xmm13 movdqa %xmm7, %xmm12 pxor %xmm7, %xmm13 pclmulqdq $(17), %xmm10, %xmm1 pclmulqdq $(0), %xmm9, %xmm2 pxor %xmm6, %xmm2 pxor %xmm1, %xmm2 pshufd $(78), %xmm2, %xmm0 movdqa %xmm0, %xmm2 pand MASK2(%rip), %xmm0 pand %xmm14, %xmm2 pxor %xmm0, %xmm6 pxor %xmm2, %xmm1 movdqa %xmm6, %xmm0 psllq $(1), %xmm6 pclmulqdq $(0), %xmm10, %xmm7 pxor %xmm0, %xmm6 psllq $(5), %xmm6 pxor %xmm0, %xmm6 psllq $(57), %xmm6 pshufd $(78), %xmm6, %xmm2 movdqa %xmm2, %xmm6 pclmulqdq $(17), %xmm10, %xmm12 pand %xmm14, %xmm2 pand MASK2(%rip), %xmm6 pxor %xmm0, %xmm6 pxor %xmm2, %xmm1 movdqa %xmm6, %xmm2 psrlq $(5), %xmm6 pclmulqdq $(0), %xmm9, %xmm13 pxor %xmm2, %xmm6 psrlq $(1), %xmm6 pxor %xmm2, %xmm6 psrlq $(1), %xmm6 pxor %xmm2, %xmm6 pxor %xmm1, %xmm6 pxor %xmm7, %xmm13 pxor %xmm12, %xmm13 pshufd $(78), %xmm13, %xmm11 movdqa %xmm11, %xmm13 pand MASK2(%rip), %xmm11 pand %xmm14, %xmm13 pxor %xmm11, %xmm7 pxor %xmm13, %xmm12 movdqa %xmm7, %xmm11 movdqa %xmm7, %xmm13 movdqa %xmm7, %xmm15 psllq $(63), %xmm11 psllq $(62), %xmm13 psllq $(57), %xmm15 pxor %xmm13, %xmm11 pxor %xmm15, %xmm11 movdqa %xmm11, %xmm13 pslldq $(8), %xmm13 psrldq $(8), %xmm11 pxor %xmm13, %xmm7 pxor %xmm11, %xmm12 movdqa %xmm7, %xmm13 psrlq $(5), %xmm13 pxor %xmm7, %xmm13 psrlq $(1), %xmm13 pxor %xmm7, %xmm13 psrlq $(1), %xmm13 pxor %xmm13, %xmm7 pxor %xmm12, %xmm7 movdqa %xmm4, (32)(%rsp) movdqa %xmm5, (48)(%rsp) movdqa %xmm6, (64)(%rsp) movdqa %xmm7, (80)(%rsp) sub $(64), %rdx movdqa (%rsp), %xmm0 cmp $(64), %rdx jge .Lblks4_loopgas_5 .Lcombine_hashgas_5: movdqa (%rbx), %xmm8 movdqa (16)(%rbx), %xmm9 pshufd $(78), %xmm4, %xmm2 pshufd $(78), %xmm10, %xmm0 pxor %xmm4, %xmm2 pxor %xmm10, %xmm0 pclmulqdq $(0), %xmm0, %xmm2 movdqa %xmm4, %xmm1 pclmulqdq $(0), %xmm10, %xmm4 pxor %xmm0, %xmm0 pclmulqdq $(17), %xmm10, %xmm1 pxor %xmm4, %xmm2 pxor %xmm1, %xmm2 palignr $(8), %xmm2, %xmm0 pslldq $(8), %xmm2 pxor %xmm0, %xmm1 pxor %xmm2, %xmm4 movdqa %xmm4, %xmm0 movdqa %xmm4, %xmm2 movdqa %xmm4, %xmm15 psllq $(63), %xmm0 psllq $(62), %xmm2 psllq $(57), %xmm15 pxor %xmm2, %xmm0 pxor %xmm15, %xmm0 movdqa %xmm0, %xmm2 pslldq $(8), %xmm2 psrldq $(8), %xmm0 pxor %xmm2, %xmm4 pxor %xmm0, %xmm1 movdqa %xmm4, %xmm2 psrlq $(5), %xmm2 pxor %xmm4, %xmm2 psrlq $(1), %xmm2 pxor %xmm4, %xmm2 psrlq $(1), %xmm2 pxor %xmm2, %xmm4 pxor %xmm1, %xmm4 pshufd $(78), %xmm5, %xmm2 pshufd $(78), %xmm9, %xmm0 pxor %xmm5, %xmm2 pxor %xmm9, %xmm0 pclmulqdq $(0), %xmm0, %xmm2 movdqa %xmm5, %xmm1 pclmulqdq $(0), %xmm9, %xmm5 pxor %xmm0, %xmm0 pclmulqdq $(17), %xmm9, %xmm1 pxor %xmm5, %xmm2 pxor %xmm1, %xmm2 palignr $(8), %xmm2, %xmm0 pslldq $(8), %xmm2 pxor %xmm0, %xmm1 pxor %xmm2, %xmm5 movdqa %xmm5, %xmm0 movdqa %xmm5, %xmm2 movdqa %xmm5, %xmm15 psllq $(63), %xmm0 psllq $(62), %xmm2 psllq $(57), %xmm15 pxor %xmm2, %xmm0 pxor %xmm15, %xmm0 movdqa %xmm0, %xmm2 pslldq $(8), %xmm2 psrldq $(8), %xmm0 pxor %xmm2, %xmm5 pxor %xmm0, %xmm1 movdqa %xmm5, %xmm2 psrlq $(5), %xmm2 pxor %xmm5, %xmm2 psrlq $(1), %xmm2 pxor %xmm5, %xmm2 psrlq $(1), %xmm2 pxor %xmm2, %xmm5 pxor %xmm1, %xmm5 pshufd $(78), %xmm6, %xmm2 pshufd $(78), %xmm8, %xmm0 pxor %xmm6, %xmm2 pxor %xmm8, %xmm0 pclmulqdq $(0), %xmm0, %xmm2 movdqa %xmm6, %xmm1 pclmulqdq $(0), %xmm8, %xmm6 pxor %xmm0, %xmm0 pclmulqdq $(17), %xmm8, %xmm1 pxor %xmm6, %xmm2 pxor %xmm1, %xmm2 palignr $(8), %xmm2, %xmm0 pslldq $(8), %xmm2 pxor %xmm0, %xmm1 pxor %xmm2, %xmm6 movdqa %xmm6, %xmm0 movdqa %xmm6, %xmm2 movdqa %xmm6, %xmm15 psllq $(63), %xmm0 psllq $(62), %xmm2 psllq $(57), %xmm15 pxor %xmm2, %xmm0 pxor %xmm15, %xmm0 movdqa %xmm0, %xmm2 pslldq $(8), %xmm2 psrldq $(8), %xmm0 pxor %xmm2, %xmm6 pxor %xmm0, %xmm1 movdqa %xmm6, %xmm2 psrlq $(5), %xmm2 pxor %xmm6, %xmm2 psrlq $(1), %xmm2 pxor %xmm6, %xmm2 psrlq $(1), %xmm2 pxor %xmm2, %xmm6 pxor %xmm1, %xmm6 pxor %xmm5, %xmm7 pxor %xmm6, %xmm7 pshufd $(78), %xmm7, %xmm2 pshufd $(78), %xmm8, %xmm0 pxor %xmm7, %xmm2 pxor %xmm8, %xmm0 pclmulqdq $(0), %xmm0, %xmm2 movdqa %xmm7, %xmm1 pclmulqdq $(0), %xmm8, %xmm7 pxor %xmm0, %xmm0 pclmulqdq $(17), %xmm8, %xmm1 pxor %xmm7, %xmm2 pxor %xmm1, %xmm2 palignr $(8), %xmm2, %xmm0 pslldq $(8), %xmm2 pxor %xmm0, %xmm1 pxor %xmm2, %xmm7 movdqa %xmm7, %xmm0 movdqa %xmm7, %xmm2 movdqa %xmm7, %xmm15 psllq $(63), %xmm0 psllq $(62), %xmm2 psllq $(57), %xmm15 pxor %xmm2, %xmm0 pxor %xmm15, %xmm0 movdqa %xmm0, %xmm2 pslldq $(8), %xmm2 psrldq $(8), %xmm0 pxor %xmm2, %xmm7 pxor %xmm0, %xmm1 movdqa %xmm7, %xmm2 psrlq $(5), %xmm2 pxor %xmm7, %xmm2 psrlq $(1), %xmm2 pxor %xmm7, %xmm2 psrlq $(1), %xmm2 pxor %xmm2, %xmm7 pxor %xmm1, %xmm7 pxor %xmm4, %xmm7 movdqa %xmm7, (32)(%rsp) .Lsingle_block_procgas_5: test %rax, %rax jz .Lquitgas_5 .p2align 6, 0x90 .Lblk_loopgas_5: movdqa (%rsp), %xmm0 movdqa %xmm0, %xmm1 paddd INC_1(%rip), %xmm1 movdqa %xmm1, (%rsp) movdqa (%rcx), %xmm0 mov %rcx, %r10 pshufb SHUF_CONST(%rip), %xmm1 pxor %xmm0, %xmm1 movdqa (16)(%r10), %xmm0 add $(16), %r10 mov %r8d, %r11d sub $(1), %r11 .p2align 6, 0x90 .Lcipher_loopgas_5: aesenc %xmm0, %xmm1 movdqa (16)(%r10), %xmm0 add $(16), %r10 dec %r11 jnz .Lcipher_loopgas_5 aesenclast %xmm0, %xmm1 movdqa (16)(%rsp), %xmm0 movdqa %xmm1, (16)(%rsp) movdqu (%rsi), %xmm1 add $(16), %rsi pxor %xmm1, %xmm0 movdqu %xmm0, (%rdi) add $(16), %rdi pshufb SHUF_CONST(%rip), %xmm1 pxor (32)(%rsp), %xmm1 movdqa (%rbx), %xmm0 pshufd $(78), %xmm1, %xmm4 pshufd $(78), %xmm0, %xmm2 pxor %xmm1, %xmm4 pxor %xmm0, %xmm2 pclmulqdq $(0), %xmm2, %xmm4 movdqa %xmm1, %xmm3 pclmulqdq $(0), %xmm0, %xmm1 pxor %xmm2, %xmm2 pclmulqdq $(17), %xmm0, %xmm3 pxor %xmm1, %xmm4 pxor %xmm3, %xmm4 palignr $(8), %xmm4, %xmm2 pslldq $(8), %xmm4 pxor %xmm2, %xmm3 pxor %xmm4, %xmm1 movdqa %xmm1, %xmm2 movdqa %xmm1, %xmm4 movdqa %xmm1, %xmm15 psllq $(63), %xmm2 psllq $(62), %xmm4 psllq $(57), %xmm15 pxor %xmm4, %xmm2 pxor %xmm15, %xmm2 movdqa %xmm2, %xmm4 pslldq $(8), %xmm4 psrldq $(8), %xmm2 pxor %xmm4, %xmm1 pxor %xmm2, %xmm3 movdqa %xmm1, %xmm4 psrlq $(5), %xmm4 pxor %xmm1, %xmm4 psrlq $(1), %xmm4 pxor %xmm1, %xmm4 psrlq $(1), %xmm4 pxor %xmm4, %xmm1 pxor %xmm3, %xmm1 movdqa %xmm1, (32)(%rsp) sub $(16), %rax jg .Lblk_loopgas_5 .Lquitgas_5: movdqa (%rsp), %xmm0 movdqa (16)(%rsp), %xmm1 movdqa (32)(%rsp), %xmm2 mov (152)(%rsp), %rax mov (160)(%rsp), %rbx mov (144)(%rsp), %rcx pshufb SHUF_CONST(%rip), %xmm0 movdqu %xmm0, (%rax) movdqu %xmm1, (%rbx) pshufb SHUF_CONST(%rip), %xmm2 movdqu %xmm2, (%rcx) add $(128), %rsp vzeroupper pop %rbx ret .Lfe5: .size AesGcmDec_avx, .Lfe5-(AesGcmDec_avx)
.global s_prepare_buffers s_prepare_buffers: push %r14 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x30a7, %rsi lea addresses_D_ht+0x16321, %rdi nop nop nop nop nop add %rbp, %rbp mov $97, %rcx rep movsw cmp %rdi, %rdi lea addresses_UC_ht+0xa6eb, %rax nop nop nop nop sub %rdx, %rdx mov $0x6162636465666768, %r14 movq %r14, (%rax) nop nop nop nop nop and %rax, %rax lea addresses_D_ht+0xb0a7, %rdx nop nop nop nop sub %rcx, %rcx movw $0x6162, (%rdx) nop nop nop cmp $6502, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r14 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // Store lea addresses_PSE+0x1a64f, %r10 nop nop nop nop nop add $25631, %rdx movb $0x51, (%r10) nop nop nop nop cmp $21548, %rsi // REPMOV lea addresses_D+0x123ff, %rsi lea addresses_D+0xdbd9, %rdi nop nop nop and $34105, %r15 mov $32, %rcx rep movsq nop nop nop sub $17807, %r13 // Load lea addresses_normal+0x19417, %r10 nop xor %rdi, %rdi mov (%r10), %rdx nop nop nop nop sub %rdi, %rdi // Faulty Load lea addresses_normal+0x148a7, %rax nop and $7355, %r13 movb (%rax), %r15b lea oracles, %rdx and $0xff, %r15 shlq $12, %r15 mov (%rdx,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_PSE', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_D', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 1, 'same': False}} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 2, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
// remove all DUNE dependencies from Jakob Schenk's gridIteration.hh implementation // performance results are no longer hurt // merge version created from midg_cpp_modified and gridIteration.hh by Ayesha Afzal #include <array> #include <vector> #include <fstream> #include <sstream> #include <iostream> #include <string> #include <algorithm> #include <cmath> #include <cstddef> #include <chrono> #include <numeric> #include <HighPerMeshes.hpp> #include "data3dN03.hpp" //!< application-dependent discontinuous Galerkin's cubic order node information #include "RKCoeff.hpp" //!< application-dependent Runge-Kutta coefficients using namespace HPM; int main(int, char**) { HPM::drts::Runtime hpm { HPM::GetBuffer{} }; using CoordinateType = HPM::dataType::Coord3D; using RealType = HPM::dataType::Real; using Vec3D = HPM::dataType::Vec3D; using Mat3D = HPM::dataType::Mat3D; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Reading Configuration, DG and Mesh Files // ////////////////////////////////////////////////////////////////////////////////////////////////////////// auto maint1 = std::chrono::high_resolution_clock::now(); /** \brief read configuration file */ HPM::auxiliary::ConfigParser CFG("config.cfg"); const RealType startTime = CFG.GetValue<RealType>("StartTime"); //!< get the value of a user-specific starting time const RealType finalTime = CFG.GetValue<RealType>("FinalTime"); //!< get the value of a user-specific stop time /** \brief read mesh file */ const std::string meshFile = CFG.GetValue<std::string>("MeshFile"); //!< get the name of a user-specific mesh file using Mesh = HPM::mesh::Mesh<CoordinateType, HPM::entity::Simplex>; const Mesh mesh = Mesh::template CreateFromFile<HPM::auxiliary::GambitMeshFileReader>(meshFile); /** \brief read application-dependent discontinuous Galerkin's stuff */ constexpr std::size_t order = 3; using DG = DgNodes<RealType, Vec3D, order>; HPM::DG::DgNodesMap<DG, Mesh> DgNodeMap(mesh); // ////////////////////////////////////////////////////////////////////////////////////////////////////////// // // All three kernels (Maxwell's Surface Kernel, Maxwell's Volume Kernel, Runge-Kutta kernel) // // ////////////////////////////////////////////////////////////////////////////////////////////////////////// auto AllCells { mesh.GetEntityRange<Mesh::CellDimension>() } ; constexpr auto Dofs = ::HPM::dof::MakeDofs<0, 0, 0, DG::numVolNodes, 0>(); /** \brief load initial conditions for fields */ auto fieldH { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; auto fieldE { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; HPM::SequentialDispatcher body; body.Execute( HPM::ForEachEntity( AllCells, std::tuple(Write(Cell(fieldE))), [&] (const auto& cell, auto &&, auto lvs) { HPM::ForEach(DG::numVolNodes, [&](const auto& n) { auto& fieldE = dof::GetDofs<dof::Name::Cell>(std::get<0>(lvs)); const auto& nodeCoords = DG::LocalToGlobal(DG::referenceCoords[n], cell.GetTopology().GetNodes()); fieldE[n].y = sin(M_PI * nodeCoords.x) * sin(M_PI * nodeCoords.z); //!< initial conditions for y component of electric field }); }) ); /** \brief create storage for intermediate fields*/ auto resH { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; auto resE { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; auto rhsH { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; auto rhsE { hpm.GetBuffer<CoordinateType>(mesh, Dofs) }; auto maint2 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> setup_duration = maint2 - maint1; std::cout << "Setup time in seconds: " << setup_duration.count() << std::endl; double aggregate_time1 = 0.0, aggregate_time2 = 0.0, aggregate_time3 = 0.0; /** \brief outer time step loop, Runge-Kutta loop, maxwell's kernels (surface and volume) and Runge-Kutta kernel */ /** \brief determine time step size (polynomial order-based and algorithmic-specific) */ RealType timeStep = 1.0e6; HPM::ForEachEntity( AllCells, [&] (const auto& cell) { const RealType face_normal_scaling_factor = 2.0 / cell.GetGeometry().GetAbsJacobianDeterminant(); HPM::ForEachSubEntity(cell, [&](const auto& face){ timeStep = std::min(timeStep, 1.0 / (face.GetGeometry().GetNormal() * face_normal_scaling_factor).Norm()); }); }); timeStep = finalTime / floor(finalTime * (order + 1) * (order + 1)/(.5 * timeStep) ); std::cout << "time step: " << timeStep << std::endl; { auto t1 = std::chrono::high_resolution_clock::now(); /** \brief Maxwell's surface kernel */ auto surfaceKernelLoop = HPM::ForEachIncidence<2>( AllCells, std::tuple( Read(ContainingMeshElement(fieldH)), Read(ContainingMeshElement(fieldE)), Read(NeighboringMeshElementOrSelf(fieldH)), Read(NeighboringMeshElementOrSelf(fieldE)), Write(ContainingMeshElement(rhsH)), Write(ContainingMeshElement(rhsE))), [&](const auto &element, const auto &face, const auto&, auto &lvs) { const std::size_t face_index = face.GetTopology().GetLocalIndex(); const RealType face_normal_scaling_factor = 2.0 / element.GetGeometry().GetAbsJacobianDeterminant(); const Vec3D &face_normal = face.GetGeometry().GetNormal() * face_normal_scaling_factor; //!< get all normal coordinates for each face of an element const RealType Edg = face_normal.Norm() * 0.5; //!< get edge length for each face const Vec3D &face_unit_normal = face.GetGeometry().GetUnitNormal(); const auto &localMap{DgNodeMap.Get(element, face)}; HPM::ForEach(DG::NumSurfaceNodes, [&](const std::size_t m) { const auto &fieldH = dof::GetDofs<dof::Name::Cell>(std::get<0>(lvs)); const auto &fieldE = dof::GetDofs<dof::Name::Cell>(std::get<1>(lvs)); auto &NeighboringFieldH = dof::GetDofs<dof::Name::Cell>(std::get<2>(lvs)); auto &NeighboringFieldE = dof::GetDofs<dof::Name::Cell>(std::get<3>(lvs)); const Vec3D &dH = Edg * HPM::DG::Delta(fieldH, NeighboringFieldH, m, localMap); //!< fields differences const Vec3D &dE = Edg * HPM::DG::DirectionalDelta(fieldE, NeighboringFieldE, face, m, localMap); const Vec3D &flux_H = (dH - (dH*face_unit_normal) * face_unit_normal - CrossProduct(face_unit_normal, dE)); //!< fields fluxes const Vec3D &flux_E = (dE - (dE*face_unit_normal) * face_unit_normal + CrossProduct(face_unit_normal, dH)); auto &rhsH = dof::GetDofs<dof::Name::Cell>(std::get<4>(lvs)); auto &rhsE = dof::GetDofs<dof::Name::Cell>(std::get<5>(lvs)); HPM::ForEach(DG::numVolNodes, [&](const std::size_t n) { rhsH[n] += DG::LIFT[face_index][m][n] * flux_H; rhsE[n] += DG::LIFT[face_index][m][n] * flux_E; }); }); }); auto t2 = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> duration = t2 - t1; aggregate_time1 += duration.count(); t1 = std::chrono::high_resolution_clock::now(); /** \brief Maxwell's volume kernel */ auto volumeKernelLoop = HPM::ForEachEntity( AllCells, std::tuple( Read(Cell(fieldH)), Read(Cell(fieldE)), Cell(rhsH), Cell(rhsE)), [&](const auto &element, const auto&, auto &lvs) { const Mat3D &D = element.GetGeometry().GetInverseJacobian() * 2.0; HPM::ForEach(DG::numVolNodes, [&](const std::size_t n) { Mat3D derivative_E, derivative_H; //!< derivative of fields w.r.t reference coordinates const auto &fieldH = dof::GetDofs<dof::Name::Cell>(std::get<0>(lvs)); const auto &fieldE = dof::GetDofs<dof::Name::Cell>(std::get<1>(lvs)); HPM::ForEach(DG::numVolNodes, [&](const std::size_t m) { derivative_H += DyadicProduct(DG::derivative[n][m], fieldH[m]); derivative_E += DyadicProduct(DG::derivative[n][m], fieldE[m]); }); auto &rhsH = dof::GetDofs<dof::Name::Cell>(std::get<2>(lvs)); auto &rhsE = dof::GetDofs<dof::Name::Cell>(std::get<3>(lvs)); rhsH[n] += -Curl(D, derivative_E); //!< first half of right-hand-side of fields rhsE[n] += Curl(D, derivative_H); }); }); t2 = std::chrono::high_resolution_clock::now(); duration = t2 - t1; aggregate_time2 += duration.count(); t1 = std::chrono::high_resolution_clock::now(); /** \brief Runge-Kutta integrtion kernel */ auto rungeKuttaLoop = HPM::ForEachEntity( AllCells, std::tuple( Write(Cell(fieldH)), Write(Cell(fieldE)), Cell(rhsH), Cell(rhsE), Cell(resH), Cell(resE)), [&](const auto &, const auto &iter, auto &lvs) { const auto &RKstage = RungeKuttaCoeff<RealType>::rk4[iter % 5]; auto &fieldH = dof::GetDofs<dof::Name::Cell>(std::get<0>(lvs)); auto &fieldE = dof::GetDofs<dof::Name::Cell>(std::get<1>(lvs)); auto &rhsH = dof::GetDofs<dof::Name::Cell>(std::get<2>(lvs)); auto &rhsE = dof::GetDofs<dof::Name::Cell>(std::get<3>(lvs)); auto &resH = dof::GetDofs<dof::Name::Cell>(std::get<4>(lvs)); auto &resE = dof::GetDofs<dof::Name::Cell>(std::get<5>(lvs)); HPM::ForEach(DG::numVolNodes, [&](const std::size_t n) { resH[n] = RKstage[0] * resH[n] + timeStep * rhsH[n]; //!< residual fields resE[n] = RKstage[0] * resE[n] + timeStep * rhsE[n]; fieldH[n] += RKstage[1] * resH[n]; //!< updated fields fieldE[n] += RKstage[1] * resE[n]; rhsH[n] = 0.0; //TODO rhsE[n] = 0.0; }); }); body.Execute( HPM::iterator::Range<size_t> { static_cast<std::size_t>(((finalTime - startTime) / timeStep) * 5) }, surfaceKernelLoop, volumeKernelLoop, rungeKuttaLoop); t2 = std::chrono::high_resolution_clock::now(); duration = t2 - t1; aggregate_time3 += duration.count(); } std::cout << "Aggregate execution time for Surface kernel = " << aggregate_time1 * 1000 << " ms" << std::endl; std::cout << "Aggregate execution time for Volume kernel = " << aggregate_time2 * 1000 << " ms" << std::endl; std::cout << "Aggregate execution time for RK kernel = " << aggregate_time3 * 1000 << " ms" << std::endl; std::cout << "Aggregate all kernel execution time = " << (aggregate_time1 + aggregate_time2 + aggregate_time3) * 1000 << " ms" << std::endl; std::cout << "Individual Execution time of Surface kernel = " << (aggregate_time1 * 1000) / (finalTime / timeStep * 5) << " ms" << std::endl; std::cout << "Individual Execution time of Volume kernel = " << (aggregate_time2 * 1000) / (finalTime / timeStep * 5) << " ms" << std::endl; std::cout << "Individual Execution time of RK kernel = " << (aggregate_time3 * 1000) / (finalTime / timeStep * 5) << " ms" << std::endl; std::cout << "Individual all kernel execution time = " << ((aggregate_time1 + aggregate_time2 + aggregate_time3) * 1000) / (finalTime / timeStep * 5) << " ms" << std::endl; /** \brief find maximum & minimum values for Ey*/ double maxErrorEy = 0; double minEy = std::numeric_limits<RealType>::max(); double maxEy = std::numeric_limits<RealType>::lowest(); body.Execute( HPM::ForEachEntity( AllCells, std::tuple( Read(Cell(fieldE)) ), [&](const auto& element, auto&&, auto lvs) { const auto& fieldE = dof::GetDofs<dof::Name::Cell>(std::get<0>(lvs)); HPM::ForEach(DG::numVolNodes, [&] (const std::size_t n) { const auto& nodeCoords = DG::LocalToGlobal(DG::referenceCoords[n], element.GetTopology().GetNodes()); //!< reference to global nodal coordinates const RealType exactEy = sin(M_PI * nodeCoords.x) * sin(M_PI * nodeCoords.z) * cos(sqrt(2.) * M_PI * finalTime); //!< exact analytical electrical field value in y direction maxErrorEy = std::max(maxErrorEy, std::abs(exactEy - fieldE[n].y)); //!< maximum error in electrical field value in y direction minEy = std::min(minEy, fieldE[n].y); //!< minimum electric field value in y direction maxEy = std::max(maxEy, fieldE[n].y); }); }) ); std::cout << "\nt=" << finalTime << " Ey in [ " << minEy << ", " << maxEy << " ] with max nodal error " << maxErrorEy << std::endl; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Shutdown of the runtime system // ////////////////////////////////////////////////////////////////////////////////////////////////////////// return EXIT_SUCCESS; }
; =============================================================== ; Mar 2014 ; =============================================================== ; ; size_t b_vector_read_block(void *dst, size_t n, b_vector_t *v, size_t idx) ; ; Copy at most n bytes from the vector at index idx to address ; dst. Returns number of bytes actually copied, which may be ; less than n if the vector does not contain n bytes of data at ; idx. ; ; =============================================================== SECTION code_clib SECTION code_adt_b_vector PUBLIC asm_b_vector_read_block EXTERN asm_b_array_read_block defc asm_b_vector_read_block = asm_b_array_read_block ; enter : de'= void *dst ; hl = vector * ; de = n ; bc = idx ; ; exit : bc = idx ; de = n ; ; success ; ; hl = number of bytes read ; hl'= void *dst ; de'= ptr in dst to one byte after last one written ; carry reset ; ; fail if idx out of range ; ; hl = 0 ; de'= void *dst ; carry set, errno = EINVAL ; ; uses : af, bc, de, hl, bc', de', hl'
db 0 ; species ID placeholder db 60, 45, 50, 70, 80, 80 ; hp atk def spd sat sdf db BUG, FLYING ; type db 45 ; catch rate db 160 ; base exp db NO_ITEM, SILVERPOWDER ; items db GENDER_F50 ; gender ratio db 15 ; step cycles to hatch INCBIN "gfx/pokemon/butterfree/front.dimensions" db GROWTH_MEDIUM_FAST ; growth rate dn EGG_BUG, EGG_BUG ; egg groups db 70 ; happiness ; tm/hm learnset tmhm TOXIC, HIDDEN_POWER, SUNNY_DAY, HYPER_BEAM, PROTECT, RAIN_DANCE, GIGA_DRAIN, SAFEGUARD, FRUSTRATION, SOLARBEAM, RETURN, PSYCHIC_M, SHADOW_BALL, DOUBLE_TEAM, AERIAL_ACE, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, SKILL_SWAP, ROOST, ENERGY_BALL, ENDURE, SILVER_WIND, GIGA_IMPACT, FLASH, PSYCH_UP, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, DREAM_EATER, SWAGGER, U_TURN, SUBSTITUTE, DEFOG, AIR_CUTTER, OMINOUS_WIND, SIGNAL_BEAM, SNORE, SWIFT, TWISTER ; end
; multi-segment executable file template. data segment ; add your data here! pkey db "press any key...$" msg db "Enter A String... $" inputstring label byte max db 20 len db ? st1 db 20 dup(?) ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax ; add your code here lea dx, msg mov ah, 9h int 21h lea dx, inputstring mov ah,0Ah int 21h mov dh, 10 mov dl, 10 mov bh, 0 mov ah, 2h int 10h mov al, byte ptr st1 mov ah, 9h mov cx, 20 mov bl, 01110100b mov bh, 0 int 10h mov dh, 20 mov dl, 20 mov bh, 0 mov ah, 2h int 10h mov bl, len mov bh, 0 mov al, byte ptr st1[bx-1] mov ah, 9h mov cx, 30 mov bl, 01110001b mov bh, 0 int 10h ; Go To New Line lea dx, newline mov ah, 9h int 21h ; End My Code lea dx, pkey mov ah, 9 int 21h ; output string at ds:dx ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h ends end start ; set entry point and stop the assembler.
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 .p2align 5, 0x90 .globl e9_gf256_add .type e9_gf256_add, @function e9_gf256_add: push %r12 push %r13 push %r14 xor %r14, %r14 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 addq (%rdx), %r8 adcq (8)(%rdx), %r9 adcq (16)(%rdx), %r10 adcq (24)(%rdx), %r11 adc $(0), %r14 mov %r8, %rax mov %r9, %rdx mov %r10, %r12 mov %r11, %r13 subq (%rcx), %rax sbbq (8)(%rcx), %rdx sbbq (16)(%rcx), %r12 sbbq (24)(%rcx), %r13 sbb $(0), %r14 cmove %rax, %r8 cmove %rdx, %r9 cmove %r12, %r10 cmove %r13, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) mov %rdi, %rax vzeroupper pop %r14 pop %r13 pop %r12 ret .Lfe1: .size e9_gf256_add, .Lfe1-(e9_gf256_add) .p2align 5, 0x90 .globl e9_gf256_sub .type e9_gf256_sub, @function e9_gf256_sub: push %r12 push %r13 push %r14 xor %r14, %r14 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 subq (%rdx), %r8 sbbq (8)(%rdx), %r9 sbbq (16)(%rdx), %r10 sbbq (24)(%rdx), %r11 sbb $(0), %r14 mov %r8, %rax mov %r9, %rdx mov %r10, %r12 mov %r11, %r13 addq (%rcx), %rax adcq (8)(%rcx), %rdx adcq (16)(%rcx), %r12 adcq (24)(%rcx), %r13 test %r14, %r14 cmovne %rax, %r8 cmovne %rdx, %r9 cmovne %r12, %r10 cmovne %r13, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) mov %rdi, %rax vzeroupper pop %r14 pop %r13 pop %r12 ret .Lfe2: .size e9_gf256_sub, .Lfe2-(e9_gf256_sub) .p2align 5, 0x90 .globl e9_gf256_neg .type e9_gf256_neg, @function e9_gf256_neg: push %r12 push %r13 push %r14 xor %r14, %r14 xor %r8, %r8 xor %r9, %r9 xor %r10, %r10 xor %r11, %r11 subq (%rsi), %r8 sbbq (8)(%rsi), %r9 sbbq (16)(%rsi), %r10 sbbq (24)(%rsi), %r11 sbb $(0), %r14 mov %r8, %rax mov %r9, %rcx mov %r10, %r12 mov %r11, %r13 addq (%rdx), %rax adcq (8)(%rdx), %rcx adcq (16)(%rdx), %r12 adcq (24)(%rdx), %r13 test %r14, %r14 cmovne %rax, %r8 cmovne %rcx, %r9 cmovne %r12, %r10 cmovne %r13, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) mov %rdi, %rax vzeroupper pop %r14 pop %r13 pop %r12 ret .Lfe3: .size e9_gf256_neg, .Lfe3-(e9_gf256_neg) .p2align 5, 0x90 .globl e9_gf256_div2 .type e9_gf256_div2, @function e9_gf256_div2: push %r12 push %r13 push %r14 movq (%rsi), %r8 movq (8)(%rsi), %r9 movq (16)(%rsi), %r10 movq (24)(%rsi), %r11 xor %r14, %r14 xor %rsi, %rsi mov %r8, %rax mov %r9, %rcx mov %r10, %r12 mov %r11, %r13 addq (%rdx), %rax adcq (8)(%rdx), %rcx adcq (16)(%rdx), %r12 adcq (24)(%rdx), %r13 adc $(0), %r14 test $(1), %r8 cmovne %rax, %r8 cmovne %rcx, %r9 cmovne %r12, %r10 cmovne %r13, %r11 cmovne %r14, %rsi shrd $(1), %r9, %r8 shrd $(1), %r10, %r9 shrd $(1), %r11, %r10 shrd $(1), %rsi, %r11 movq %r8, (%rdi) movq %r9, (8)(%rdi) movq %r10, (16)(%rdi) movq %r11, (24)(%rdi) mov %rdi, %rax vzeroupper pop %r14 pop %r13 pop %r12 ret .Lfe4: .size e9_gf256_div2, .Lfe4-(e9_gf256_div2) .p2align 5, 0x90 .globl e9_gf256_mulm .type e9_gf256_mulm, @function e9_gf256_mulm: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 sub $(24), %rsp movq %rdi, (%rsp) mov %rdx, %rbx mov %rcx, %rdi movq %r8, (8)(%rsp) movq (%rbx), %r14 movq (8)(%rsp), %r15 movq (%rsi), %rax mul %r14 mov %rax, %r8 mov %rdx, %r9 imul %r8, %r15 movq (8)(%rsi), %rax mul %r14 add %rax, %r9 adc $(0), %rdx mov %rdx, %r10 movq (16)(%rsi), %rax mul %r14 add %rax, %r10 adc $(0), %rdx mov %rdx, %r11 movq (24)(%rsi), %rax mul %r14 add %rax, %r11 adc $(0), %rdx mov %rdx, %r12 xor %r13, %r13 movq (%rdi), %rax mul %r15 add %rax, %r8 adc $(0), %rdx mov %rdx, %r8 movq (8)(%rdi), %rax mul %r15 add %r8, %r9 adc $(0), %rdx add %rax, %r9 adc $(0), %rdx mov %rdx, %r8 movq (16)(%rdi), %rax mul %r15 add %r8, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %r8 movq (24)(%rdi), %rax mul %r15 add %r8, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx add %rdx, %r12 adc $(0), %r13 xor %r8, %r8 movq (8)(%rbx), %r14 movq (8)(%rsp), %r15 movq (%rsi), %rax mul %r14 add %rax, %r9 adc $(0), %rdx mov %rdx, %rcx imul %r9, %r15 movq (8)(%rsi), %rax mul %r14 add %rcx, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rsi), %rax mul %r14 add %rcx, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rsi), %rax mul %r14 add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc %rdx, %r13 adc $(0), %r8 movq (%rdi), %rax mul %r15 add %rax, %r9 adc $(0), %rdx mov %rdx, %r9 movq (8)(%rdi), %rax mul %r15 add %r9, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %r9 movq (16)(%rdi), %rax mul %r15 add %r9, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %r9 movq (24)(%rdi), %rax mul %r15 add %r9, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx add %rdx, %r13 adc $(0), %r8 xor %r9, %r9 movq (16)(%rbx), %r14 movq (8)(%rsp), %r15 movq (%rsi), %rax mul %r14 add %rax, %r10 adc $(0), %rdx mov %rdx, %rcx imul %r10, %r15 movq (8)(%rsi), %rax mul %r14 add %rcx, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rsi), %rax mul %r14 add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rsi), %rax mul %r14 add %rcx, %r13 adc $(0), %rdx add %rax, %r13 adc %rdx, %r8 adc $(0), %r9 movq (%rdi), %rax mul %r15 add %rax, %r10 adc $(0), %rdx mov %rdx, %r10 movq (8)(%rdi), %rax mul %r15 add %r10, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %r10 movq (16)(%rdi), %rax mul %r15 add %r10, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %r10 movq (24)(%rdi), %rax mul %r15 add %r10, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx add %rdx, %r8 adc $(0), %r9 xor %r10, %r10 movq (24)(%rbx), %r14 movq (8)(%rsp), %r15 movq (%rsi), %rax mul %r14 add %rax, %r11 adc $(0), %rdx mov %rdx, %rcx imul %r11, %r15 movq (8)(%rsi), %rax mul %r14 add %rcx, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %rcx movq (16)(%rsi), %rax mul %r14 add %rcx, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx mov %rdx, %rcx movq (24)(%rsi), %rax mul %r14 add %rcx, %r8 adc $(0), %rdx add %rax, %r8 adc %rdx, %r9 adc $(0), %r10 movq (%rdi), %rax mul %r15 add %rax, %r11 adc $(0), %rdx mov %rdx, %r11 movq (8)(%rdi), %rax mul %r15 add %r11, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %r11 movq (16)(%rdi), %rax mul %r15 add %r11, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx mov %rdx, %r11 movq (24)(%rdi), %rax mul %r15 add %r11, %r8 adc $(0), %rdx add %rax, %r8 adc $(0), %rdx add %rdx, %r9 adc $(0), %r10 xor %r11, %r11 movq (%rsp), %rsi mov %r12, %rax mov %r13, %rbx mov %r8, %rcx mov %r9, %rdx subq (%rdi), %rax sbbq (8)(%rdi), %rbx sbbq (16)(%rdi), %rcx sbbq (24)(%rdi), %rdx sbb $(0), %r10 cmovnc %rax, %r12 cmovnc %rbx, %r13 cmovnc %rcx, %r8 cmovnc %rdx, %r9 movq %r12, (%rsi) movq %r13, (8)(%rsi) movq %r8, (16)(%rsi) movq %r9, (24)(%rsi) mov %rsi, %rax add $(24), %rsp vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe5: .size e9_gf256_mulm, .Lfe5-(e9_gf256_mulm) .p2align 5, 0x90 .globl e9_gf256_sqrm .type e9_gf256_sqrm, @function e9_gf256_sqrm: push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 sub $(24), %rsp movq %rdi, (%rsp) mov %rdx, %rdi movq %rcx, (8)(%rsp) movq (%rsi), %rbx movq (8)(%rsi), %rax mul %rbx mov %rax, %r9 mov %rdx, %r10 movq (16)(%rsi), %rax mul %rbx add %rax, %r10 adc $(0), %rdx mov %rdx, %r11 movq (24)(%rsi), %rax mul %rbx add %rax, %r11 adc $(0), %rdx mov %rdx, %r12 movq (8)(%rsi), %rbx movq (16)(%rsi), %rax mul %rbx add %rax, %r11 adc $(0), %rdx mov %rdx, %rbp movq (24)(%rsi), %rax mul %rbx add %rax, %r12 adc $(0), %rdx add %rbp, %r12 adc $(0), %rdx mov %rdx, %r13 movq (16)(%rsi), %rbx movq (24)(%rsi), %rax mul %rbx add %rax, %r13 adc $(0), %rdx mov %rdx, %r14 xor %r15, %r15 shld $(1), %r14, %r15 shld $(1), %r13, %r14 shld $(1), %r12, %r13 shld $(1), %r11, %r12 shld $(1), %r10, %r11 shld $(1), %r9, %r10 shl $(1), %r9 movq (%rsi), %rax mul %rax mov %rax, %r8 add %rdx, %r9 adc $(0), %r10 movq (8)(%rsi), %rax mul %rax add %rax, %r10 adc %rdx, %r11 adc $(0), %r12 movq (16)(%rsi), %rax mul %rax add %rax, %r12 adc %rdx, %r13 adc $(0), %r14 movq (24)(%rsi), %rax mul %rax add %rax, %r14 adc %rdx, %r15 movq (8)(%rsp), %rcx imul %r8, %rcx movq (%rdi), %rax mul %rcx add %rax, %r8 adc $(0), %rdx mov %rdx, %r8 movq (8)(%rdi), %rax mul %rcx add %r8, %r9 adc $(0), %rdx add %rax, %r9 adc $(0), %rdx mov %rdx, %r8 movq (16)(%rdi), %rax mul %rcx add %r8, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %r8 movq (24)(%rdi), %rax mul %rcx add %r8, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx add %rdx, %r12 adc $(0), %r13 xor %r8, %r8 movq (8)(%rsp), %rcx imul %r9, %rcx movq (%rdi), %rax mul %rcx add %rax, %r9 adc $(0), %rdx mov %rdx, %r9 movq (8)(%rdi), %rax mul %rcx add %r9, %r10 adc $(0), %rdx add %rax, %r10 adc $(0), %rdx mov %rdx, %r9 movq (16)(%rdi), %rax mul %rcx add %r9, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %r9 movq (24)(%rdi), %rax mul %rcx add %r9, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx add %rdx, %r13 adc $(0), %r14 xor %r9, %r9 movq (8)(%rsp), %rcx imul %r10, %rcx movq (%rdi), %rax mul %rcx add %rax, %r10 adc $(0), %rdx mov %rdx, %r10 movq (8)(%rdi), %rax mul %rcx add %r10, %r11 adc $(0), %rdx add %rax, %r11 adc $(0), %rdx mov %rdx, %r10 movq (16)(%rdi), %rax mul %rcx add %r10, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %r10 movq (24)(%rdi), %rax mul %rcx add %r10, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx add %rdx, %r14 adc $(0), %r15 xor %r10, %r10 movq (8)(%rsp), %rcx imul %r11, %rcx movq (%rdi), %rax mul %rcx add %rax, %r11 adc $(0), %rdx mov %rdx, %r11 movq (8)(%rdi), %rax mul %rcx add %r11, %r12 adc $(0), %rdx add %rax, %r12 adc $(0), %rdx mov %rdx, %r11 movq (16)(%rdi), %rax mul %rcx add %r11, %r13 adc $(0), %rdx add %rax, %r13 adc $(0), %rdx mov %rdx, %r11 movq (24)(%rdi), %rax mul %rcx add %r11, %r14 adc $(0), %rdx add %rax, %r14 adc $(0), %rdx add %rdx, %r15 adc $(0), %r8 xor %r11, %r11 movq (%rsp), %rsi mov %r12, %rax mov %r13, %rbx mov %r14, %rcx mov %r15, %rdx subq (%rdi), %rax sbbq (8)(%rdi), %rbx sbbq (16)(%rdi), %rcx sbbq (24)(%rdi), %rdx sbb $(0), %r8 cmovnc %rax, %r12 cmovnc %rbx, %r13 cmovnc %rcx, %r14 cmovnc %rdx, %r15 movq %r12, (%rsi) movq %r13, (8)(%rsi) movq %r14, (16)(%rsi) movq %r15, (24)(%rsi) mov %rsi, %rax add $(24), %rsp vzeroupper pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe6: .size e9_gf256_sqrm, .Lfe6-(e9_gf256_sqrm)
.xlist include kernel.inc include newexe.inc include tdb.inc include pdb.inc include protect.inc .list NEWEPME = NEPRIVLIB ; flag saying Call WEP on exit externW pLocalHeap externW pStackTop DataBegin externB num_tasks externB graphics externB fBooting externB Kernel_flags externD Dos_Flag_Addr externB WOAName externW fLMdepth externW headPDB externW curTDB externW loadTDB externW Win_PDB externW topPDB externW hExeHead ;externW EMS_calc_swap_line externW WinFlags externW hGDI externW hUser ifdef WOW externW OFContinueSearch endif externD pMBoxProc externD pGetFreeSystemResources externD dressed_for_success externD lpGPChain ;** Diagnostic mode stuff externW fDiagMode externB szLoadStart externB szCRLF externB szLoadSuccess externB szLoadFail externB szFailCode externB szCodeString ; Look for module in Module Compatibilty section of win.ini szModuleCompatibility DB 'ModuleCompatibility',0 DataEnd externFP Yield externFP CreateTask externFP GlobalAlloc externFP GlobalSize externFP GlobalLock externFP GlobalUnlock externFP GlobalFree externFP LocalAlloc externFP LocalFree externFP LocalCountFree externFP LoadModule externFP lstrlen externFP _lclose externFP FreeModule externFP GetModuleHandle externFP LoadExeHeader externFP GetExePtr externFP GetProcAddress externFP MyOpenFile externFP FarGetCachedFileHandle externFP FarEntProcAddress externFP FlushCachedFileHandle externFP FarMyLock externFP FarMyFree externFP FarMyUpper externFP FarLoadSegment externFP FarDeleteTask externFP FarUnlinkObject externFP Far_genter externFP AllocSelector externFP FreeSelector externFP LongPtrAdd externFP GetProfileInt ifdef WOW externFP StartWOWTask externFP WowIsKnownDLL externFP LongPtrAddWOW externFP AllocSelectorWOW externFP WOWLoadModule externFP WowShutdownTimer externB fShutdownTimerStarted externB fExitOnLastApp externFP WowSyncTask endif ifdef FE_SB externFP FarMyIsDBCSLeadByte endif externFP FreeTDB ;** Diagnostic mode externFP DiagOutput sBegin CODE assumes CS,CODE assumes DS,NOTHING assumes ES,NOTHING sEnd CODE sBegin NRESCODE assumes CS,NRESCODE assumes DS,NOTHING assumes ES,NOTHING externB szProtectCap externB msgRealModeApp1 externB msgRealModeApp2 externNP MapDStoDATA externNP FindExeFile externNP FindExeInfo externNP AddModule externNP DelModule externNP GetInstance externNP IncExeUsage externNP DecExeUsage externNP AllocAllSegs externNP PreloadResources externNP StartProcAddress externNP StartLibrary externNP GetStackPtr externNP StartTask IFNDEF NO_APPLOADER externNP BootAppl ENDIF ;!NO_APPLOADER DOS_FLAG_EXEC_OPEN equ 1 SET_DOS_FLAG_EXEC_OPEN macro push es push bx mov es, Dos_Flag_Addr.sel mov bx, Dos_Flag_Addr.off or BYTE PTR es:[bx], DOS_FLAG_EXEC_OPEN pop bx pop es endm RESET_DOS_FLAG_EXEC_OPEN macro push es push bx mov es, Dos_Flag_Addr.sel mov bx, Dos_Flag_Addr.off and BYTE PTR es:[bx], NOT DOS_FLAG_EXEC_OPEN pop bx pop es endm ;-----------------------------------------------------------------------; ; OpenApplEnv ; ; Calls CreateTask ; ; Allocates temporary stack ; ; Arguments: ; ; ; ; Returns: ; ; ax = selector of load-time stack ; ; Error Returns: ; ; ax = 0 ; ; Registers Preserved: ; ; ; ; Registers Destroyed: ; ; ; ; Calls: ; ; ; ; History: ; ; ; ; Tue 16-Jan-1990 21:13:51 -by- David N. Weise [davidw] ; ; Ya know, it seems to me that most of the below ain't necessary ; ; for small frame EMS. But it's too late to change it now. ; ; ; ; Fri 07-Apr-1989 23:15:42 -by- David N. Weise [davidw] ; ; Added support for task ExeHeaders above The Line in Large ; ; Frame EMS. ; ; ; ; Tue Oct 20, 1987 07:48:51p -by- David N. Weise [davidw] ; ; Added this nifty comment block. ; ;-----------------------------------------------------------------------; LOADSTACKSIZE = 2048 assumes ds,nothing assumes es,nothing cProc OpenApplEnv,<PUBLIC,NEAR>,<ds,si,di> parmD lpPBlock parmW pExe parmW fWOA ; localW myCodeDS ; localW myCurTDB ; localW myLoadTDB cBegin ReSetKernelDS ; Assume DS:KRNLDS cCall CreateTask,<lpPBlock,pExe,fWOA> or ax,ax jz oae_done test kernel_flags,KF_pUID ; All done booting? jz oae_done xor ax,ax mov bx,LOADSTACKSIZE mov cx,(GA_ALLOC_LOW or GA_SHAREABLE) shl 8 or GA_ZEROINIT or GA_MOVEABLE cCall GlobalAlloc,<cx,ax,bx> or ax,ax jz oae_done cCall GlobalLock,<ax> mov ax,dx push es ; added 13 feb 1990 mov es,loadTDB mov es:[TDB_LibInitSeg],ax mov es:[TDB_LibInitOff],10h mov es,dx mov es:[pStackTop],12h pop es oae_done: cEnd ;-----------------------------------------------------------------------; ; CloseApplEnv ; ; ; ; ; ; Arguments: ; ; ; ; Returns: ; ; AX = hExe ; ; BX = ? ; ; DX = TDB ; ; ; ; Error Returns: ; ; ; ; Registers Preserved: ; ; ; ; Registers Destroyed: ; ; ..., ES, ... ; ; ; ; Calls: ; ; ; ; History: ; ; ; ; Fri 07-Apr-1989 23:15:42 -by- David N. Weise [davidw] ; ; Added support for task ExeHeaders above The Line in Large ; ; Frame EMS. ; ; ; ; Tue Oct 20, 1987 07:48:51p -by- David N. Weise [davidw] ; ; Added this nifty comment block. ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc CloseApplEnv,<PUBLIC,NEAR>,<ds,si,di> parmW hResult parmW hExe localW myCurTDB localW cae_temp localW myLoadTDB cBegin ReSetKernelDS ; Copy DS variables to stack, since we may need DS mov cx,curTDB mov myCurTDB,cx mov cx,loadTDB mov myLoadTDB,cx mov cae_temp, si mov ax, myLoadTDB or ax, ax ; Not set if LMCheckHeap failed jz cae_done mov ds, ax mov ax, ds:[TDB_LibInitSeg] or ax, ax jz cae_free_stack1 mov ds, ax cmp ds:[pStackTop], 12h jne cae_free_stack1 mov ds,myLoadTDB push ax cCall GlobalUnlock,<ax> call GlobalFree ; parameter pushed above cae_free_stack1: mov ds,myLoadTDB mov ds:[TDB_LibInitSeg],ax mov ds:[TDB_LibInitOff],10h ; Copy correct return address cae_done: SetKernelDSNRES xor dx,dx xchg loadTDB,dx ; Done loading this guy mov ax,hResult ; if hResult < 32, it's not a real cmp ax,LME_MAXERR ; handle, and in fact is the invalid jb cae_cleanup ; format return code. (11). mov es,dx ; Start this guy up! TDB_nEvents must be set here, and not before ; because message boxes may be put up if we can't find libraries, ; which would have caused this app to prematurely start. push es ifdef WOW cmp num_tasks, 1 ; First task? (except wowexec) jne @F ; branch if not first task cmp fExitOnLastApp, 0 ; Shared WOW? jne @F ; branch if not shared WOW cmp fShutdownTimerStarted, 1; Is the timer running? jne @F ; branch if not running cCall WowShutdownTimer, <0> ; stop shutdown timer mov fShutdownTimerStarted, 0 @@: endif mov es:[TDB_nEvents],1 inc num_tasks ; Do this here or get it wrong. test es:[TDB_flags],TDBF_OS2APP jz @F cmp dressed_for_success.sel,0 jz @F call dressed_for_success ifdef WOW ; Start Up the New Task @@: cCall StartWOWTask,<es,es:[TDB_taskSS],es:[TDB_taskSP]> or ax,ax ; Success ? jnz @f ; Yes mov hResult,ax ; No - Fake Out of Memory Error 0 ; No error matches failed to create thread pop dx ; restore TDB dec num_tasks ; jmps cae_cleanup ; endif; WOW @@: test kernel_flags,KF_pUID ; All done booting? jz @F ; If booting then don't yield. cCall WowSyncTask @@: assumes ds,nothing pop dx ; return TDB jmps cae_exit ; Failure case - undo the damage cae_cleanup: or dx,dx ; Did we even get a TDB? jz cae_exit ; No. mov ds,dx assumes ds,nothing mov ds:[TDB_sig],ax ; mark TDB as invalid cCall FarDeleteTask,<ds> mov es,ds:[TDB_PDB] mov dx,PDB_Chain mov bx,dataOffset HeadPDB ; Kernel PDB cCall FarUnlinkObject cCall FreeTDB cae_exit: xor ax,ax mov es,ax ; to avoid GP faults in pmode .386 mov fs, ax mov gs, ax .286 mov ax,hResult mov bx, cae_temp cEnd ;-----------------------------------------------------------------------; ; StartModule ; ; ; ; ; ; Arguments: ; ; ; ; Returns: ; ; AX = hExe or StartLibrary ; ; ; ; Error Returns: ; ; AX = 0 ; ; ; ; Registers Preserved: ; ; BX,DI,SI,DS ; ; ; ; Registers Destroyed: ; ; ; ; Calls: ; ; FarLoadSegment ; ; StartProcAddress ; ; StartLibrary ; ; ; ; History: ; ; ; ; Tue Jan 01, 1980 03:04:49p -by- David N. Weise [davidw] ; ; ReWrote it from C into assembly and added this nifty comment block. ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc StartModule,<PUBLIC,NEAR>,<di,si> parmW hPrev parmD lpPBlock parmW hExe parmW fh localD pf cBegin mov ax,hExe mov es,ax assumes es,nothing cmp es:[ne_csip].sel,0 jz start_it_up ; Make sure DGROUP loaded before we need to load the start segment. mov cx,es:[ne_autodata] jcxz start_it_up ; no automatic data segment cCall FarLoadSegment,<es,cx,fh,fh> or ax,ax jnz start_it_up ; auto DS loaded OK mov ax,fh inc ax jz sm_ret1 ; return NULL dec ax cCall _lclose,<ax> xor ax,ax sm_ret1: jmps sm_ret ; return NULL start_it_up: cCall StartProcAddress,<hExe,fh> ; just because it's preloaded mov pf.sel,dx ; doesn't mean it's still around! mov pf.off,ax or dx,ax push dx mov ax,fh cmp ax,-1 jz sm_nothing_to_close cCall _lclose,<ax> sm_nothing_to_close: pop dx mov es,hExe assumes es,nothing test es:[ne_flags],NENOTP jnz start_library or dx,dx jz nothing_to_start cCall GetStackPtr,<es> cCall StartTask,<hPrev,hExe,dx,ax,pf> jmps sm_ret start_library: mov es, hExe or es:[ne_flags], NEWEPME ; Need to call my WEP on exit cCall StartLibrary,<hExe,lpPBlock,pf> jmps sm_ret nothing_to_start: mov ax,hExe test es:[ne_flags],NENOTP jnz sm_ret xor ax,ax sm_ret: cEnd if 0 ; too late to include in 3.1, add for next Windows release (donc) cProc GetProcAddressRes, <PUBLIC, FAR>, <ds, si, di> parmW hExe parmD pname ; pass in Pascal string cBegin les di, [pname] ; ES:DI = name to find mov cx, 255 ; CH = 0 xor ax, ax push di repne scasb pop di jnz GPAR_fail not cl dec cl mov al, cl ; AX = length of name mov ds, [hExe] ; DS:SI = res name table mov bx, ds:[ne_restab] ; (actually DS:BX first time through) GPAR_nextsym: mov si, bx ; next entry to check mov cl, [si] ; string length jcxz GPAR_fail lea bx, [si+3] add bx, cx ; BX points to next (last + len + 3) cmp cx, ax jnz GPAR_nextsym ; length diff - no match inc si ; skip length byte push di rep cmpsb pop di jnz GPAR_nextsym lodsw ; get ordinal number ;if KDEBUG ; cCall FarEntProcAddress,<ds,ax,1> ;else cCall FarEntProcAddress,<ds,ax> ; I hate conditional assembly.... ;endif mov cx, ax or cx, dx jmps GPAR_exit GPAR_fail: xor ax, ax cwd GPAR_exit: cEnd endif ;-----------------------------------------------------------------------; ; CallWEP ; ; ; ; Call WEP of DLL if appropriate ; ; ; ; Arguments: ; ; HANDLE hExe = HEXE of module about to close ; ; WORD WEPVal = 0, 1 pass to WEP, 2 check for WEP ; ; ; ; Returns: ; ; AX = status ; ; ; ; Error Returns: ; ; AX = Not a DLL ; ; AX = No WEP ; ; AX = Module not started ; ;-----------------------------------------------------------------------; cProc CallWEP, <PUBLIC,FAR>, <ds> parmW hExe parmW WEPVal localV szExitProc,4 localD pExitProc localW bogusIBMAppSp cBegin mov ds, hExe ; Robustify this! CWErr = 1 mov ax, 1 ; exit code cmp ds:[ne_expver], 300h ; 3.0 libraries only jb CW_noWEP CWErr = CWErr+1 inc ax test ds:[ne_flags], NENOTP ; is it a DLL? jz CW_noWEP CWErr = CWErr+1 inc ax ; Font, etc cmp ds:[ne_cseg],0 jz CW_noWEP CWErr = CWErr+1 inc ax mov bx, ds:[ne_pautodata] ; Make sure auto data loaded or bx, bx jz @F test ds:[bx].ns_flags, NSLOADED jz CW_noWEP @@: CWErr = CWErr+1 inc ax NoWepErr = CWErr mov [szExitProc].lo, 'EW' ; If the module has a procedure mov [szExitProc].hi, 'P' ; named 'WEP', call it. lea bx, szExitProc push ax cCall GetProcAddress, <ds, ss, bx> mov [pExitProc].off, ax mov [pExitProc].sel, dx or ax, dx pop ax jnz CW_WEP CW_noWEP: jmps CW_noWEP1 CW_WEP: cmp WEPVAL,2 ; If I'm just looking for WEP jz CW_OK ; return 0 inc ax test ds:[ne_flags], NEWEPME ; don't call wep if libmain jz CW_noWEP ; wasn't called and ds:[ne_flags], NOT NEWEPME ; only call WEP once SetKernelDSNRES ; Save old GP chaine pusha push lpGPChain.sel push lpGPChain.off push cs push offset cw_BlowChunks mov lpGPChain.sel, ss ; and insert self in the chain mov lpGPChain.off, sp UnSetKernelDS mov ax, ss mov ds, ax mov es, ax mov bogusIBMAppSP,sp ; Save sp cause some apps (Hollywood) ; don't retf 2 correctly when we ; call their wep cCall pExitProc, <WEPVal> ; fSystemExit mov sp,bogusIBMAppSp add sp, 4 ; remove the CS:IP for error handler cw_BlowChunks: SetKernelDSNRES pop lpGPChain.off ; restore GPChain pop lpGPChain.sel popa UnSetKernelDS CW_OK: xor ax, ax CW_noWEP1: cmp WEPVAL, 2 ; if we checked for whining jnz CW_done or ax, ax ; if we found, then OK jz CW_done cmp ax, NoWepErr ; anything other than NoWep is OK jz CW_done xor ax, ax CW_done: cEnd ;-----------------------------------------------------------------------; ; LoadModule ; ; ; ; Loads a module or creates a new instance of an existing module. ; ; ; ; Arguments: ; ; FARP p = name of module or handle of existing module ; ; FARP lpPBlock = Parameter Block to pass to CreateTask ; ; ; ; Returns: ; ; AX = instance handle or module handle ; ; ; ; Error Returns: ; ;LME_MEM = 0 ; Out of memory ; ;LME_FNF = 2 ; File not found ;LME_LINKTASK = 5 ; can't link to task ; ;LME_LIBMDS = 6 ; lib can't have multiple data segments ; ;LME_VERS = 10 ; Wrong windows version ; ;LME_INVEXE = 11 ; Invalid exe ; ;LME_OS2 = 12 ; OS/2 app ; ;LME_DOS4 = 13 ; DOS 4 app ; ;LME_EXETYPE = 14 ; unknown exe type ; ;LME_RMODE = 15 ; not a pmode windows app ; ;LME_APPMDS = 16 ; multiple data segments in app ; ;LME_EMS = 17 ; scum app in l-frame EMS ; ;LME_PMODE = 18 ; not an rmode windows app ; ;LME_INVCOMP = 20 ; invalid DLL caused fail of EXE load ; ;LME_PE32 = 21 ; Windows Portable EXE app - let them load it ; ;LME_MAXERR = 32 ; for comparisons ; ; ; ; Registers Preserved: ; ; DI, SI, DS ; ; Registers Destroyed: ; ; BX, CX, DX, ES ; ; ; ; Calls: ; ; AllocAllSegs ; ; CreateInsider ; ; DecExeUsage ; ; DelModule ; ; FindExeFile ; ; FindExeInfo ; ; FreeModule ; ; GetExePtr ; ; GetInstance ; ; GetStringPtr ; ; IncExeUsage ; ; LoadExeHeader ; ; LoadModule ; ; FarLoadSegment ; ; lstrlen ; ; FarMyFree ; ; MyOpenFile ; ; PreloadResources ; ; StartModule ; ; _lclose ; ; ; ; History: ; ; Sun 12-Nov-1989 14:19:04 -by- David N. Weise [davidw] ; ; Added the check for win87em. ; ; ; ; Fri 07-Apr-1989 23:15:42 -by- David N. Weise [davidw] ; ; Added support for task ExeHeaders above The Line in Large ; ; Frame EMS. ; ; ; ; Tue Oct 13, 1987 05:00:00p -by- David J. Habib [davidhab] ; ; Added check for FAPI applications. ; ; ; ; Sat Jul 18, 1987 12:04:15p -by- David N. Weise [davidw] ; ; Added support for multiple instances in different EMS banks. ; ; ; ; Tue Jan 01, 1980 06:57:01p -by- David N. Weise [davidw] ; ; ReWrote it from C into assembly. ; ; ; ; Wed Sep 17, 1986 03:31:06p -by- Charles Whitmer [chuckwh] ; ; Modified the original LoadModule code to only allow INSIDERs to ; ; allocate segments for a new process. An INSIDER is a new process ; ; stub which bootstraps up a new instance of an application. ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc ILoadLibrary,<PUBLIC,FAR> parmD pLibName localV szExitProc,4 cBegin mov ax,-1 cCall <far ptr LoadModule>,<pLibName,ax,ax> cmp ax, LME_INVEXE ; Invalid format? jnz @F mov ax, LME_INVCOMP ; Invalid component @@: if KDEBUG SetKernelDSNRes cmp fBooting, 0 jne ll_fail ; No check while booting cmp ax, LME_MAXERR jb ll_fail ; No library, so no WEP() push ax ; Now check for WEP cCall GetExePtr,<ax> mov es, ax test es:[ne_flags],NEPROT ; ignore for OS/2 apps jnz ll_noWhine cmp es:[ne_usage], 0 jne ll_noWhine ; Only check on first load! push dx push ax cCall CallWEP,<ax,2> ; Just check for WEP, don't call it or ax, ax pop ax pop dx jz ll_noWhine trace_out "No WEP in library - > %AX0 %AX1" ; fkerror 0,<No WEP in library - >,ax,dx ll_noWhine: pop ax ; return value of LoadModule ll_fail: endif ; KDEBUG cEnd os2calls DB 'DOSCALLS' ; Used for FAPI detection mgxlib DB 'MGXLIB' ; Used for lib large entry table detection win87em DB 'WIN87EM.DLL',0 ; Used for win87em.exe detection assumes ds,nothing assumes es,nothing ?SAV5 = ?DOS5 ; Adobe Type Manager check the LoadModule ?DOS5 = 0 ; prolog and expects to see INC BP there... public LMAlreadyLoaded, LMLoadExeFile, LMCheckHeader, LMRamNMods public LMImports, LMSegs, LMLetsGo, LMPrevInstance, LMCleanUp cProc ILoadModule,<PUBLIC,FAR>,<di,si> parmD lpModuleName parmD lpPBlock localW fh ; close if failed localW pExe ; point to NE header in RAM ; localW hExe ; prev module if already loaded localW hResult ; temp return value localW hDepFail ; return of implicit link loads localW abortresult ; temp return value localW ffont ; flag if loading a *.fon localW fexe ; flag if loading a *.exe ifdef notyet localW dll ; flag if loading a *.dll endif localW hBlock ; fastload block from LoadExeHeader localW AllocAllSegsRet localW exe_type ; from LoadExeHeader localW hTDB ; dx from CloseApplEnv localW SavePDB ; save caller's pdb, switch to krnl's localW fWOA ; save flag if we're loading WOA ifdef WOW LocalD pszKnownDLLPath LocalW fKnownDLLOverride localW RefSelector localW LMHadPEDLL localW hPrevInstance ; previous 16-bit module handel with the same name endif localD FileOffset ; offset to start of ExeHdr localW OnHardDisk ; don't cache FH if on floppy localV namebuf,136 ; SIZE OPENSTRUC + 127 localW fModCompatFlags ; used by LMRamNMods cBegin SetKernelDSNRES mov al,Kernel_Flags[1] ; solve re-entrancy #10759 and ax,KF1_WINOLDAP mov fWOA,ax and Kernel_Flags[1],NOT KF1_WINOLDAP inc fLMdepth ; # current invocations ;** Log this entry only if in diagnostic mode mov ax, fDiagMode ; Only log if booting and diag mode and al, fBooting jz @F ;** Write out the string mov ax,dataOFFSET szLoadStart ; Write the string cCall DiagOutput, <ds,ax> push WORD PTR lpModuleName[2] push WORD PTR lpModuleName[0] cCall DiagOutput mov ax,dataOFFSET szCRLF cCall DiagOutput, <ds,ax> ; Zero out flags and handles @@: ifdef WOW mov LMHadPEDLL,0 mov hPrevInstance,0 lm_restart: endif xor ax,ax ; mov hExe,ax mov pExe,ax mov abortresult,ax ; default 0 == out of memory mov ffont,ax mov fexe,ax ifdef notyet mov dll,ax endif mov hBlock,ax mov hTDB,ax ; Set DOS_FLAG to EXEC_OPEN SET_DOS_FLAG_EXEC_OPEN ; Some flags are default -1 dec ax mov fh, ax mov SavePDB, ax ; First, see if we were passed in a handle in the filename les si,lpModuleName ; point to the file name mov ax,es or ax,ax ; Was a handle passed in low word? jnz @F cCall GetExePtr,<si> ; Valid handle? or ax, ax jnz prev_instance mov al, LME_FNF ; call this file not found?? jmp ilm_ret ; No handle, see if filename is already loaded @@: call LMAlreadyLoaded ; es:si -> modname on stack cmp ax, LME_MAXERR jb @F ; Not found, try to load it ; a 16-bit module with the same name is loaded ; if module is being loaded is a dll, use the loaded instance ; else if module is being loaded is a task ; if it is a 32-bit task then load it from disk ; else use the loaded instance ifdef WOW mov hPrevInstance, ax ; store previous instance handle mov ax,lpPBlock.off ; check if this is a dll or a task and ax,lpPBlock.sel inc ax jnz @F ; non-zero means it is a task ; so check first if it is a 16-bit task prev_instance_16task: mov ax, hPrevInstance endif prev_instance: call LMPrevInstance jmp ilm_ret ; Wasn't loaded, see if we can load it @@: call LMLoadExeFile ; fh in DI, AX = 0 or error code or ax, ax jz @F jmp ilm_ret ; can't find it - return error @@: ; Here to deal with a new library or task module. ; We found the file, now load and scan the header @@: lea si,namebuf cCall LoadExeHeader,<di,di,ss,si> ifdef WOW cmp ax,LME_PE jne @F ; If we find the module is a Win32 binary (PE), check to see ; if we're trying to load a task or DLL. If it's a DLL ; we will continue searching for a Win16 copy of this DLL ; on the path. If we're unsuccessful we'll eventually ; munge the file not found error code back to LME_PE. mov ax,lpPBlock.off and ax,lpPBlock.sel inc ax mov ax,LME_PE jnz @F ; have a PBlock, must be doing LoadModule cmp LMHadPEDLL,0 je lm_retry_pe mov LMHadPEDLL,0 mov OFContinueSearch,0 KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Found Win32 DLL again after continuing search." jmps ilm_ret @@: jmps @F lm_retry_pe: ; Tell OpenFile to restart last search at next search location. mov OFContinueSearch,1 mov LMHadPEDLL,1 KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Found Win32 DLL, continuing search for Win16 copy." ; Close open Win32 DLL file handle cCall My_lclose,<fh> ; Switch back to caller's PDB mov si, -1 xchg si, SavePDB mov Win_PDB, si or fh, -1 jmp lm_restart @@: endif cmp ax,LME_MAXERR jb ilm_ret ifdef WOW cmp hPrevInstance, 0 ; if there is a previous 16-bit task je @F ; cCall My_lclose,<fh> ; close opened file before invoking previous instance jmp prev_instance_16task endif ; Header is loaded, now see if valid for Windows @@: call LMCheckHeader cmp ax, LME_MAXERR jb ilm_ret ; Now allocate segs, check for special modules, etc @@: call LMRamNMods cmp ax, LME_MAXERR jb ilm_ret ; Load import libraries (scary code here) @@: call LMImports cmp ax, LME_MAXERR jb ilm_ret ; Load and relocate segments @@: call LMSegs cmp ax, LME_MAXERR jb ilm_ret ; Load resources, schedule execution @@: call LMLetsGo ; Everyone comes through ILM_RET - we free the fastload block, etc ilm_ret: call LMCleanUp jmp LoadModuleEnd abort_load0: pop fLMdepth abort_load: cmp fLMdepth, 1 ; If a recursive call, nothing jne abort_load_A ; has been incremented! cCall DecExeUsage,<pExe> abort_load_A: cCall My_lclose,<fh> mov es,pExe push es:[ne_flags] cCall DelModule,<es> mov pExe, 0 pop bx abort_load_B: ; If app, close environment test bx,NENOTP jnz lm_ab mov si, -1 xchg si, SavePDB ; Saved PDB? inc si jz @F ; nope. dec si mov Win_PDB, si ; yes, restore it @@: mov si, fLMdepth mov fLMdepth, 0 cCall CloseApplEnv,<abortresult,es> mov fLMdepth, bx lm_ab: mov ax, abortresult retn ; add sp, 2 ; jmps ilm_ret ; ax = abortresult. (0 normal, 11 fapi) ifdef WOW winspool db "WINSPOOL.EXE" ; Trying to Load Winspool ? size_winspool equ $-winspool db 0h ; NULL Terminate endif ;WOW ;---------------------------------------------------------------------- ; ; LMAlreadyLoaded - internal routine for LoadModule ; See if a module is already loaded by looking for the file name ; or the module name. ; Entry: ; ES:SI points to filename ; Exit: ; AX = handle of previous instance ; SS:SI -> uppercase filename ; Error: ; AX = error value < LME_MAXERR ; ;----------------------------------------------------------------------- LMAlreadyLoaded: ; We check if this Module is already loaded. To do so we get the ; name off of the end of the string, omitting the extension. krDebugOut <DEB_TRACE OR DEB_KrLoadMod>, "Loading @ES:SI" cCall lstrlen,<es,si> ; Get the length of the string. or ax,ax ; NULL string? jnz @F mov al,LME_FNF ; return file not found error retn ifdef FE_SB ; ; Backword search '\' or ':' is prohibited for DBCS version of ; Windows. Some DBCS 2nd byte may have '\' or ':'. So we search ; these characters from beginning of string. ; @@: cld mov bx,si delinator_loop_DBC: lods byte ptr es:[si] ; fetch a character test al,al jz found_end_DBC cmp al,"\" jz found_delinator_DBC cmp al,'/' jz found_delinator_DBC cmp al,":" jz found_delinator_DBC call FarMyIsDBCSLeadByte ; see if char is DBC... jc delinator_loop_DBC inc si ; skip 2nd byte of DBC jmp delinator_loop_DBC found_delinator_DBC: mov bx,si ; update delinator pointer jmp delinator_loop_DBC found_end_DBC: mov si, bx ; ES:SI -> beginning of name.. else @@: mov cx,ax add si,ax dec si ; ES:SI -> end of string std delineator_loop: ; look for beginning of name lods byte ptr es:[si] cmp al,"\" jz found_delineator cmp al,'/' jz found_delineator cmp al,":" jz found_delineator loop delineator_loop dec si found_delineator: ; ES:SI -> before name cld inc si inc si ; ES:SI -> beginning of name endif xor di,di xor bx,bx copy_name_loop: lods byte ptr es:[si] ; Copy and capitalize to temp buffer. or al,al jz got_EXE_name cmp al,"." jne @F lea bx,namebuf[di] ifdef notyet cmp dll, 0 ; Was it .DLL and failed to open it? jz @F ; no, no hacking mov byte ptr es:[si], 'E' ; yes, change it to .EXE mov word ptr es:[si+1],'EX' mov dll, 0 endif @@: ifdef FE_SB ; ; Do not capitalize if a character is DBC. ; call FarMyIsDBCSLeadByte jnc @F call FarMyUpper ; capitalize if SBC.. jmps is_a_SBC @@: mov namebuf[di],al inc di lods byte ptr es:[si] ; copy 2nd byte also is_a_SBC: mov namebuf[di],al else call FarMyUpper mov namebuf[di],al endif inc di jmps copy_name_loop ; Finally call FindExeInfo to see if it's already loaded! got_EXE_name: cmp namebuf[di][-2],'NO' ; .fons are allowed to be jnz @F ; non protect mode cmp namebuf[di][-4],'F.' jnz @F mov ffont,bp ; make non-zero @@: cmp namebuf[di][-2],'EX' ; .exes will not get jnz @F ; prompted cmp namebuf[di][-4],'E.' jnz @F mov fexe,bp ; make non-zero @@: ifdef NOTYET cmp namebuf[di][-2],'LL' jne @F cmp namebuf[di][-4],'D.' jne @F mov dll, di @@: endif ifdef WOW ; apps will expect to find WINSPOOL.DRV, which is a 32-bit driver. ; we need to intercept this and change it WINSPOOL.EXE, which is our 16-bit ; stub that contains a few entrypoints. if 0 ; Bitstreams's MakeUp extracts the printer driver from the [devices] ; section of win.ini the line looks like this: ; HP Laserjet Series II=winspool,FILE: ; and then it calls LoadLibrary(drivername) ie LoadLibrary("winspool") ; so we need to allow no extension when checking for "winspool" endif cmp namebuf[di][-2],'VR' jne checkfornoext cmp namebuf[di][-4],'D.' jne @f jmp short gotadrv checkfornoext: ; int 3 cmp di,8 jc @f cmp namebuf[di][-2],'LO' jne @f cmp namebuf[di][-4],'OP' jne @f cmp namebuf[di][-6],'SN' jne @f cmp namebuf[di][-8],'IW' jne @f ; the last 8 characters are 'WINSPOOL'. tack on '.EXE' and proceed. add di,4 mov namebuf[di][-2],'EX' ; Changed Uppercased String mov namebuf[di][-4],'E.' push cx mov lpModuleName.hi,cs lea cx,winspool ; mov lpModuleName.lo,cx pop cx jmp short @f gotadrv: push es push ds push si push cx push di smov es,ss lea di,namebuf[di][-(size_winspool)] smov ds,cs lea si,winspool mov cx,size_winspool-4 ; match WINSPOOL? rep cmpsb pop di jnz not_winspool mov namebuf[di][-2],'EX' ; Changed Uppercased String mov namebuf[di][-4],'E.' mov lpModuleName.hi,cs ; Used by Myopenfile below lea cx,winspool ; mov lpModuleName.lo,cx not_winspool: pop cx pop si pop ds pop es @@: endif; WOW mov namebuf[di],al ; Null terminate file name lea si,namebuf push bx cCall FindExeFile,<ss,si> pop bx or ax,ax jnz al_end or bx,bx ; extension specified? jz @F ; No, DI correct then sub bx,si ; DI = length of name portion mov di,bx @@: cCall FindExeInfo,<ss,si,di> al_end: retn ;---------------------------------------------------------------------- ; ; LMLoadExeFile - internal routine for LoadModule ; Try to open an EXE file ; Enter: ; SS:SI -> uppercase filename ; Exit: ; AX=0 ; DI = fh = handle of open EXE file ; Error: ; AX = error code ; Effects: ; Set Win_PDB to kernel PDB to open the file ; ;----------------------------------------------------------------------- ; if here then not yet loaded, see if we can open the file LMLoadExeFile: mov ax, topPDB xchg Win_PDB, ax ; Switch to Kernel's PDB, mov SavePDB, ax ; saving current PDB xor ax,ax ifdef notyet cmp dll, ax ; Don't prompt for .DLL, if it fails we jnz @F ; try for .EXE which we will prompt for endif cmp fexe,ax ; Don't prompt for EXE file jnz @F mov ax,OF_CANCEL ; If DLL, let them cancel mov es,curTDB test es:[TDB_ErrMode],08000h ; did app say not to prompt?? jnz @F mov ax,OF_CANCEL or OF_PROMPT @@: if SHARE_AWARE or ax, OF_NO_INHERIT or OF_SHARE_DENY_WRITE else or ax, OF_NO_INHERIT endif ifdef WOW ; Ask WOW32 to check the filename to see if it is ; a Known DLL, ; ; If it is, WowIsKnownDLL will point pszKnownDLLPath ; at a just-allocated buffer with the full path to ; the DLL in the system32 directory and return with ; AX nonzero. This buffer must be freed with a ; call to WowIsKnownDLL with the filename pointer ; zero, and pszKnownDLLPath as it was left by the ; first call to WowIsKnownDLL. ; ; If it's not a known DLL, pszKnownDLLPath will be ; NULL and AX will be zero. push ax cmp fBooting,0 ; Known DLLs take effect je lef_look_for_known_dll ; after booting is complete. mov fKnownDLLOverride,0 ; We're booting, make sure jmps lef_dll_not_known ; we know not to call ; WowIsKnownDLL the second time. lef_look_for_known_dll: push si smov es,ss lea bx,pszKnownDLLPath cCall WowIsKnownDLL,<lpModuleName,esbx> mov fKnownDLLOverride,ax cmp ax,0 pop si je lef_dll_not_known pop ax cCall MyOpenFile,<pszKnownDLLPath,ss,si,ax> jmps @f lef_dll_not_known: pop ax cCall MyOpenFile,<lpModuleName,ss,si,ax> @@: else cCall MyOpenFile,<lpModuleName,ss,si,ax> endif ifdef notyet mov di, dll or di, di jz no_second_chance cmp ax, -1 jne no_second_chance ; open succeeded xchg ax, SavePDB ; Restore original PDB (AX == -1) mov Win_PDB, ax les si, lpModuleName pop ax jmp pointer_to_name ; Start again! no_second_chance: endif xor dh, dh mov dl, ss:[si].opDisk mov OnHardDisk, dx mov fh,ax mov di,ax ; DI gets preserved, AX doesn't! inc ax ; -1 means error or invalid parsed file mov ax, 0 jnz @F ; OK, return 0 ; MyOpenFile failed mov ax,ss:[si].[opXtra] ; SI = &namebuf or ax,ax ; What is the error value? jnz @F mov ax,LME_FNF ; unknown, call it file not found @@: ifdef WOW push ax mov ax,fKnownDLLOverride cmp ax,0 je lef_no_need_to_free push bx push dx push di smov es,ss lea bx,pszKnownDLLPath cCall WowIsKnownDLL, <0,0,esbx> pop di pop dx pop bx lef_no_need_to_free: pop ax endif retn ;---------------------------------------------------------------------- ; ; LMCheckHeader - internal routine for LoadModule ; Loading new module - see if header values are OK ; Enter: ; ax = exeheader in RAM ; bx = 0 or FastLoad ram block selector ; cx = file offset of header ; dx = exe_type ; Exit: ; ; ;----------------------------------------------------------------------- LMCheckHeader: mov exe_type,dx mov hBlock,bx ; fast-load block mov pExe,ax ; exeheader in RAM mov es,ax mov ax, cx ; file offset of header mov cx, es:[ne_align] mov bx, ax ; BX:AX <= AX shl CL shl ax, cl neg cl add cl, 16 shr bx, cl mov FileOffset.sel, bx mov FileOffset.off, ax ; Is this module PMode-compatible? cmp es:[ne_expver],300h ; by definition jae @F test dh,NEINPROT ; by flag jnz @F cmp ffont,0 ; are we loading a font? jnz @F mov cx,ss lea bx,namebuf call WarnRealMode cmp ax,IDCANCEL jnz @F ; yes, user says so mov ax, LME_RMODE ; no, die you pig retn ifdef WOW @@: ; ; if WOA invoked by app (not fWOA) fail it ; cmp fWOA,0 ; fWOA jnz @F cld push si push di mov di, es:[ne_restab] inc di mov si, dataOffset WOAName mov cx, 4 repe cmpsw pop di pop si jnz @F mov ax, LME_WOAWOW32 retn endif ; Are we dynalinking to a task? @@: test es:[ne_flags],NENOTP jnz ch_not_a_process or es:[ne_flags],NEINST ; for safety sake mov ax,lpPBlock.off and ax,lpPBlock.sel inc ax jnz ch_new_application ; not linking mov ax, LME_LINKTASK retn ; Error if multiple instance EXE is a library module. ch_not_a_process: mov ax, 33 ; Any value > 32 test es:[ne_flags],NEPROT ; is it an OS/2 exe? jnz ch_ok ; windows doesn't do this right test es:[ne_flags],NEINST jz ch_ok mov ax, LME_LIBMDS ; I think this error code is wrong ch_ok: retn ; Create environment for new application task. ch_new_application: call LMCheckHeap or ax,ax jz @F cCall OpenApplEnv,<lpPBlock,pExe,fWOA> mov es,pExe or ax,ax ; AX is a selector, therefor > 32 jnz ch_ok @@: jmp abort_load_A ;---------------------------------------------------------------------- ; ; LMRamNMods - internal routine for LoadModule ; Load segments, check for special modules ; Enter: ; EX = pexe ; Exit: ; CX = number of import modules ; AX = status ; ; ;----------------------------------------------------------------------- LMRamNMods: push es cCall AddModule,<pExe> pop es or ax,ax jnz @F push es:[ne_flags] ; AddModule failed - out of memory mov dx,ne_pnextexe mov bx,dataOffset hExeHead call FarUnlinkObject pop bx jmp abort_load_B ; clean this up @@: cmp es:[ne_expver],400h jae rm_skip_modulecompat ; Look for Module in ModuleCompatibilty section ; and get its compat flags push es ; save es push ds push dataoffset szModuleCompatibility push es mov bx,es:[ne_restab] ; module name is 1st rsrc inc bx ; Skip length byte push bx xor ax, ax push ax ; default = 0 call GetProfileInt @@: pop es ; restore es ; Set the module's patch bit if the INI file says to. if KDEBUG test es:[ne_flagsothers], NEHASPATCH jz @F push ax mov ax, es:[ne_restab] inc ax krDebugOut DEB_TRACE,"ILoadModule: module patch bit for @es:ax already set, clearing it" pop ax @@: endif and es:[ne_flagsothers], not NEHASPATCH ; clear module patch bit ifdef WOW_x86 test ax, MCF_MODPATCH + MCF_MODPATCH_X86 else test ax, MCF_MODPATCH + MCF_MODPATCH_RISC endif jz rm_after_modpatch if KDEBUG push ax mov ax, es:[ne_restab] inc ax krDebugOut DEB_WARN,"ILoadModule: setting module patch bit for @es:ax" pop ax endif or es:[ne_flagsothers], NEHASPATCH rm_after_modpatch: ; See if we need to make the module's segments not discardable test ax, MCF_NODISCARD jz rm_after_nodiscard mov cx, es:[ne_cseg] ; cx = number of segs jcxz rm_after_nodiscard mov bx, es:[ne_segtab] ; es:bx = seg table start rm_loop: and es:[bx].ns_flags, not NSDISCARD ; clear the discard flag add bx, SIZE NEW_SEG1 ; es:bx = seg table next entry loop rm_loop rm_after_nodiscard: rm_skip_modulecompat: mov bx, -1 cCall FarGetCachedFileHandle,<es,bx,fh> ; Set file handle cache up mov fh, bx ; Use cached file handle from now xchg SavePDB, bx ; Back to original PDB (BX == -1) mov Win_PDB, bx @@: xor bx,bx mov hDepFail,-1 ; Assume success mov cx,es:[bx].ne_cmod jcxz @F test kernel_flags,KF_pUID ; All done booting? jnz @F ; Yes or es:[bx].ne_flags,NEALLOCHIGH ; No, GDI and USER are party ; dynlinks that can alloc high @@: xor ax,ax IFNDEF NO_APPLOADER test es:[ne_flags],NEAPPLOADER jnz rm_no_segs_to_alloc ENDIF cmp ax,es:[ne_cseg] jz rm_no_segs_to_alloc push es mov es:[ne_usage],1 cCall AllocAllSegs,<es> ; AX is count of segs pop es mov es:[ne_usage],8000h inc ax jnz @F jmp abort_load @@: dec ax rm_no_segs_to_alloc: mov AllocAllSegsRet, ax xor bx, bx mov di,es:[bx].ne_modtab ; ES:DI = pModIdx mov cx,es:[bx].ne_cmod or cx,cx jz lm_ret_ok ; this small chunk of code goes thru the imported names table ; and looks for DOSCALLS. if DOSCALLS is found, then the app ; is an FAPI "bound" application and not a windows app, and ; loadmodule should return an error for "invalid format". ; This will force it to run in a DOS box ; coming in: ; cx = cmod ; di = modtab test es:[bx].ne_flags,NENOTP ; only test apps, not libraries. jnz lm_ret_ok mov ax,exe_type ; UNKNOWN may be OS/2 in disguise. cmp al,NE_UNKNOWN jnz @F push ds smov ds,cs mov ax,8 mov si,NRESCODEoffset os2calls ; DS:SI = "DOSCALLS" call search_mod_dep_list pop ds jnc @F mov abortresult,LME_INVEXE ; store invalid format code for return jmp abort_load ; In order to make it easier on our ISV to migrate to pmode ; we must deal with win87em specially because the win 2.x ; version gp faults. Since we have never shipped them a clean ; one to ship with their apps we must compensate here. ; If we are loading a win 2.x app in pmode we force the load ; of win87em.dll. For compatibility in real mode we just load ; the one they would have gotten anyway. @@: cmp es:[bx].ne_expver,300h ; no special casing win3.0 apps jae rm_no_win87em_here push ds smov ds,cs mov ax,7 mov si,NRESCODEoffset win87em ; DS:SI = "WIN87EM" call search_mod_dep_list pop ds jnc rm_no_win87em_here push bx ; Load Win87em.dll push es cCall ILoadLibrary,<cs,si> cmp ax,LME_MAXERR jae @F mov hDepFail,ax @@: pop es pop bx rm_no_win87em_here: lm_ret_ok: mov di,es:[bx].ne_modtab ; ES:DI = pModIdx mov cx,es:[bx].ne_cmod ; What is AX? mov ax, es retn ;---------------------------------------------------------------------- ; ; LMImports - internal routine for LoadModule ; ;----------------------------------------------------------------------- LMImports: or cx, cx jnz im_inc_dependencies_loop jmp im_end_dependency_loop im_inc_dependencies_loop: push cx mov si,es:[di] push es or si,si jz im_next_dependencyj add si,es:[ne_imptab] ; ES:SI = pname xor ax,ax mov al,es:[si] ; get length of name inc si mov cx, ax mov bx, es ; pExe ;;;; Load the imported library. push ds ; Copy the name and .EXE to namebuf push di smov es,ss mov ds,bx UnSetKernelDS lea di,namebuf mov bx,di cld rep movsb mov byte ptr es:[di], 0 ; Null terminate push bx push es cCall GetModuleHandle,<es,bx> pop es pop bx or ax, ax jz @F pop di pop ds jmps im_imported_exe_already_loaded @@: cmp ds:[ne_expver], 300h ; USE .DLL for 3.0, .EXE for lower jae im_use_dll mov es:[di][0],"E." mov es:[di][2],"EX" jmps im_done_extension im_use_dll: mov word ptr ss:[di][0],"D." mov word ptr ss:[di][2],"LL" im_done_extension: mov byte ptr es:[di][4],0 pop di pop ds ResetKernelDS cCall ILoadLibrary,<ss,bx> cmp ax,LME_MAXERR jae im_imported_exe_loaded mov hDepFail,ax xor ax,ax im_next_dependencyj: jmps im_next_dependency im_imported_exe_already_loaded: ;;; push ax ;;; cCall IncExeUsage,<ax> ;;; pop ax im_imported_exe_loaded: cCall GetExePtr,<ax> mov es,ax assumes es,nothing ; assume that dep libraries or es:[ne_flags],NEALLOCHIGH ; are smart im_next_dependency: pop es assumes es,nothing mov es:[di],ax inc di inc di pop cx dec cx jz im_end_dependency_loop jmp im_inc_dependencies_loop im_end_dependency_loop: mov es:[ne_usage], 0 cmp fLMdepth, 1 jne @F push es ; Now set usage count of this cCall IncExeUsage,<es> ; module and dependants pop es @@: mov cx,hDepFail inc cx jz im_libs_ok dec cx mov abortresult,cx im_abort_loadj: jmp abort_load im_libs_ok: retn ;---------------------------------------------------------------------- ; ; LMSegs - internal routine for LoadModule ; ;----------------------------------------------------------------------- LMSegs: ; Do something about all those segments in the module. IFNDEF NO_APPLOADER test es:[ne_flags],NEAPPLOADER jz @F ;* * special boot for AppLoader push Win_PDB push fLMdepth mov fLMdepth, 0 mov ax, -1 cCall FarGetCachedFileHandle,<es,ax,ax> Save <es> cCall BootAppl,<es, ax> ;* returns BOOL cCall FlushCachedFileHandle,<es> pop fLMdepth pop Win_PDB or ax,ax jnz lms_done jmp abort_load ; retn @@: ENDIF ;!NO_APPLOADER mov cx, AllocAllSegsRet jcxz lms_done lms_preload_segments: mov si,es:[ne_segtab] ; ES:SI = pSeg mov cx,es:[ne_cseg] xor di,di lms_ps_loop: inc di test es:[si].ns_flags,NSPRELOAD jz lms_next_segment cmp es:[ne_align], 4 ; Must be at least paragraph aligned jb lms_ReadFromFile cmp hBlock, 0 jne lms_ReadFromMemory jmps lms_ReadFromFile lms_next_segment: add si,SIZE new_seg1 loop lms_ps_loop lms_done: retn lms_ReadFromFile: push cx push es cCall FarLoadSegment,<es,di,fh,fh> jmps lms_DoneLoad lms_ReadFromMemory: push cx push es cCall GlobalLock,<hBlock> or dx, dx jnz lms_still_here cCall GlobalFree,<hBlock> mov hBlock, 0 pop es pop cx jmps lms_ReadFromFile lms_still_here: ifdef WOW cCall AllocSelectorWOW,<dx> ; same as allocselector. but the mov RefSelector, dx ; new descriptor is not set. else cCall AllocSelector,<dx> endif pop es mov bx, es:[si].ns_sector xor dx, dx mov cx, es:[ne_align] push es @@: shl bx, 1 rcl dx, 1 loop @B sub bx, off_FileOffset sbb dx, seg_FileOffset push ax push es ifdef WOW ; same as longptradd. but the descriptor 'RefSelector' is used ; to set the descriptor of 'ax' cCall LongPtrAddWOW,<ax,cx,dx,bx, RefSelector, 1> ; (cx is 0) else cCall LongPtrAdd,<ax,cx,dx,bx> ; (cx is 0) endif pop es dec cx cCall FarLoadSegment,<es,di,dx,cx> pop cx push ax cCall FreeSelector,<cx> cCall GlobalUnlock,<hBlock> pop ax lms_DoneLoad: pop es pop cx or ax,ax jz lms_abort_load1 jmp lms_next_segment lms_abort_load1: jmp abort_load ;----------------------------------------------------------------------- ; ; LMLetsGo - ; ;----------------------------------------------------------------------- LMLetsGo: push es push Win_PDB ; Save current PDB push topPDB ; Set it to Kernel's pop Win_PDB mov ax, -1 cCall FarGetCachedFileHandle,<es,ax,ax> cmp hBlock,0 je lg_resFromFile cCall PreloadResources,<es,ax,hBlock,FileOffset> jmps lg_gotRes lg_resFromFile: xor dx, dx cCall PreloadResources,<es,ax,dx,dx,dx> lg_gotRes: pop Win_PDB ; Restore PDB pop es mov ax,lpPBlock.off mov dx,lpPBlock.sel and ax,dx inc ax jnz lg_huh mov lpPBlock.off,ax mov lpPBlock.sel,ax lg_huh: xor ax,ax ; free 0 push fLMdepth mov fLMdepth, 0 push es cCall StartModule,<ax,lpPBlock,es,fh> pop es mov hResult,ax or ax,ax jnz @F jmp abort_load0 @@: test es:[ne_flags],NENOTP jnz lg_not_a_process2 pop si cCall CloseApplEnv,<hResult,pExe> push bx mov hResult,ax mov hTDB,dx lg_not_a_process2: pop fLMdepth retn ;---------------------------------------------------------------------- ; ; LMPrevInstance - internal routine for LoadModule ; Load an app/dll if a previous instance in memory ; Entry: ; ax = handle of previous instance ; Exit: ; ax = status to return ; dx = hTDB = TDB ; Error: ; ax < LME_MAXERR ; ;----------------------------------------------------------------------- LMPrevInstance: mov es,ax mov dx,es:[ne_flags] mov si,ax mov pExe,ax ; why store in pExe and hExe? mov hResult,0 ; Error if dynamically linking to non-library module. mov ax,lpPBlock.off and ax,lpPBlock.sel inc ax jnz pi_app test dx,NENOTP jnz @F mov ax, LME_LINKTASK ; can't dynalink to a task retn @@: mov lpPBlock.off,ax ; AX == 0 mov lpPBlock.sel,ax pi_app: test dx,NEINST jnz @F jmp pi_not_inst @@: call LMCheckHeap or ax, ax jnz @F mov ax, LME_MEM ; Out of (gdi/user) memory retn @@: ifdef WOW ; ; if WOA invoked by app (not fWOA) fail it ; cmp fWOA,0 ; fWOA jnz pi_not_multiple_data cld push si push di mov di, es:[ne_restab] inc di mov si, dataOffset WOAName mov cx, 4 repe cmpsw pop di pop si jnz @F mov ax, LME_WOAWOW32 retn @@: endif ; We refuse to load multiple instances of apps that have ; multiple data segments. This is because we cannot do ; fixups to these other data segments. What happens is ; that the second copy of the app gets fixed up to the ; data segments of the first application. For the case ; of read-only data segments we make an exception since ; what does it matter who the segments belong to? mov ax, 2 ; if we have >= 2 dsegs we die mov es,si mov cx,es:[ne_cseg] mov bx,es:[ne_segtab] pi_next_seg: test es:[bx].ns_flags,NSDATA ; scum! this barely works! jz @F test es:[bx].ns_flags,NSERONLY jnz @F dec ax jnz @F ; two data segments is one too many! pi_mds: mov ax, LME_APPMDS retn @@: add bx,SIZE NEW_SEG1 loop pi_next_seg pi_not_multiple_data: ; Prepare the application cCall OpenApplEnv,<lpPBlock,si,fWOA> cCall GetInstance,<si> ; Why do we call this? mov di,ax cCall IncExeUsage,<si> cCall AllocAllSegs,<si> ; Can we get memory? inc ax jnz @F cCall DecExeUsage,<si> ; AllocAllSegs failed, Dec Usage jmps pi_mem ; Must have failed from no memory @@: mov ax,-1 cCall StartModule,<di,lpPBlock,si,ax> ; mov hResult,ax or ax,ax jnz @F mov es,si ; StartModule failed, FreeModule mov si,es:[ne_pautodata] cCall FreeModule,<es:[si].ns_handle> pi_mem: mov ax, LME_MEM retn @@: mov si, fLMdepth mov fLMdepth, 0 cCall CloseApplEnv,<ax,pExe> mov fLMdepth, bx mov hTDB,dx retn pi_not_inst: mov ax,es:[ne_autodata] ; Make sure data segment is loaded. or ax,ax jz @F or bx,-1 push es cCall FarLoadSegment,<es,ax,bx,bx> pop es or ax,ax jz pi_end ; yes, AX is already 0, but ... @@: push es ; for GetInstance cCall IncExeUsage,<es> cCall GetInstance ; ,<pExe> pi_end: retn ;---------------------------------------------------------------------- ; ; LMCleanUp - internal routine for LoadModule ; ;----------------------------------------------------------------------- LMCleanUp: ifdef WOW cmp LMHadPEDLL,0 je @F cmp ax, LME_MAXERR jae @F mov ax,LME_PE ; Reflect real error we tried to mask KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Could not find Win16 copy of Win32 DLL, returning LME_PE." @@: endif push ax ; save status for future cmp ax, LME_MAXERR jae @F cCall my_lclose,<fh> or fh, -1 ; Restore PDB if needed @@: mov ax, -1 xchg SavePDB, ax inc ax jz @F dec ax mov Win_PDB, ax ; Free FastLoad block if allocated @@: cmp hBlock,0 je @F cCall GlobalFree,<hBlock> mov hBlock,0 ; Free app environment if failure and this was an app @@: pop ax cmp ax,LME_MAXERR jae @F if KDEBUG cmp ax, LME_INVEXE ; invalid format (WinOldAp) jz cu_fred cmp ax, LME_PE ; Win32 Portable Exe - try to load it jz cu_fred push ax push bx push es les bx, lpModuleName KernelLogError <DBF_WARNING>,ERR_LOADMODULE,"Error 0x#ax loading @ES:BX" pop es pop bx pop ax endif cu_fred: cmp loadTDB,0 je @F mov bx,pExe cmp bx,LME_MAXERR ; Did we load an ExeHeader? jbe @F mov es,bx test es:[ne_flags],NENOTP jnz @F mov si, fLMdepth mov fLMdepth, 0 cCall CloseApplEnv,<ax,es> mov fLMdepth, bx ; shouldn't cache file handles on removable devices cause it ; makes share barf when the user swaps disks. this kills some ; install apps. CraigC 8/8/91 @@: push ax cmp ax, LME_MAXERR ; real? jbe @F cmp OnHardDisk, 0 ; is it on a removable device? jne @F cCall GetExePtr, <ax> ; get module handle cCall FlushCachedFileHandle, <ax> ; blow it off ;** Log this entry only if in diagnostic mode @@: cmp fDiagMode,0 ; Only log if in diag mode je LM_NoDiagExit cmp fBooting,0 ; Only log if booting je LM_NoDiagExit pop ax ; Get the return code early push ax pusha ; Save all the registers push ds push es ;** Write out the appropriate string mov si,ax ; Save the return value cmp ax,LME_MAXERR jae LM_DiagSuccess mov ax,dataOFFSET szLoadFail ; Write the string jmp SHORT LM_DiagOutput LM_DiagSuccess: mov ax,dataOFFSET szLoadSuccess ; Write the string LM_DiagOutput: cCall DiagOutput, <ds,ax> cCall DiagOutput, <lpModuleName> cmp si,LME_MAXERR ; Don't do this on success jae SHORT LM_DiagSuccessSkip ;** Log a message complete with the failure code mov ax,si ; Get the failure code shr al, 4 mov bx,dataOFFSET szCodeString ; Point to the second digit push NREScodeOffset afterHex call toHex mov ax, si inc bx toHex: and al,0fh ; Get low hex digit add al,'0' ; Convert to ASCII cmp al,'9' ; Letter? jbe @F ; Yes add al,'A' - '0' ; Make it a letter @@: mov [bx],al ; Save the digit retn afterHex: mov ax,dataOFFSET szFailCode ; Get the string 'Failure code is ' cCall DiagOutput, <ds,ax> LM_DiagSuccessSkip: mov ax,dataOFFSET szCRLF cCall DiagOutput, <ds,ax> pop es pop ds popa LM_NoDiagExit: pop ax dec fLMdepth mov dx,hTDB retn ;@@end ;shl_ax16: ; shift AX into DX:AX by cl bits ; mov dx, ax ; shl ax, cl ; neg cl ; add cl, 16 ; cl = 16 - cl ; shr dx, cl ; retn LoadModuleEnd: ; jmp here to clean up stack and RET ifdef WOW cmp ax, LME_MAXERR jb @F lmntex: jmp LoadModuleExit @@: ; ; Exec For Non 16 Bit Windows Apps ; ; ; WIN 32S App ? yes -> let NT load it ; cmp ax,LME_PE je LM_NTLoadModule ; ; if an app is spawning WOA (NOT our internal load-fWOA), ; Patch lpModuleName to -1 let NT load it ; cmp ax,LME_WOAWOW32 jne @F mov word ptr lpModuleName[2], -1 ; patch lpModuleName mov word ptr lpModuleName[0], -1 jmp short LM_NTLoadModule @@: ; Errors 11-15 -> let NT load it cmp ax,LME_RMODE jae lmntex cmp ax,LME_VERS jbe lmntex public LM_NTLoadModule LM_NTLoadModule: ; ; WOW Execs non-windows apps using WINOLDAP. ; ; First check for loading of a 32bit DLL. lpPBlock will be -1 ; in such a case. push ax mov ax,lpPBlock.off and ax,lpPBlock.sel inc ax pop ax jz LoadModuleExit ; ; This is an EXE, but the LME_PE failure code might have come from ; an implicitly linked DLL. If so, we don't want to try having ; Win32 lauch the win16 EXE, as it will just come back to us. ; cmp ax,LME_PE jne @F cmp ax,hDepFail je short LoadModuleExit @@: sub sp, 80 ; alloc space for cmdline mov di, sp smov es, ss mov word ptr es:[di], 0 ; set WindOldApp CmdLine to NULL regptr esdi,es,di cCall WowLoadModule,<lpModuleName, lpPBlock, esdi> ; ; if ax < 33 an error occurred ; cmp ax, 33 jb ex8 or Kernel_flags[1],KF1_WINOLDAP mov ax, ss les si,lpPBlock mov es:[si].lpcmdline.off,di mov es:[si].lpcmdline.sel,ax mov si,dataOffset WOAName regptr dssi,ds,si cCall LoadModule,<dssi, lpPBlock> cmp ax,32 ; check for error... jae ex8 ; ; LoadModule of WinOldApp failed ; Call WowLoadModule to clean up process handle ; push ax mov ax, ss regptr axdi,ax,di cCall WowLoadModule,<0, lpPBlock, axdi> pop ax cmp ax,2 ; file not found? jnz ex7 ; no, return error mov al, LME_WOAWOW32 ; flag WINOLDAP error ex7: or ax,ax ; out of memory? jnz ex8 mov ax,8h ; yes, return proper error code ex8: add sp,80 ; free space for cmdline endif; WOW LoadModuleExit: RESET_DOS_FLAG_EXEC_OPEN cEnd ?DOS5 = ?SAV5 ;-----------------------------------------------------------------------; ; My_lclose ; ; Close file handle if it isn't -1. ; ; Entry: ; ; Returns: ; ; Registers Destroyed: ; ; History: ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc My_lclose,<PUBLIC,NEAR> parmW fh cBegin mov ax,fh inc ax jz mlc_exit cCall _lclose,<fh> mlc_exit: cEnd ;-----------------------------------------------------------------------; ; WarnRealMode ; ; Trayf for files in the form "Insert WIN.EXE disk in drive A:" ; ; Entry: ; ; Returns: ; ; Registers Destroyed: ; ; History: ; Sat 07-Oct-1989 17:12:43 -by- David N. Weise [davidw] ; Wrote it! A month or so ago. ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc WarnRealMode,<PUBLIC,NEAR> cBegin nogen ReSetKernelDS push Win_PDB push fLMDepth cld mov ax,IDCANCEL ; assume booting test fBooting,1 jnz promptly_done cmp pMBoxProc.sel,0 ; is there a USER around yet? jz promptly_done push di push si push es mov es,cx ifdef FE_SB ;Japan and Korea declare that they need more space for DBCS msg. ;It sounds like this is one of common requirement for DBCS enabling ;although Taiwan doesn't claim she has the same requirement. ;I enclosed this code fragment under DBCS and it can be removed ;if somebody thinks it is not necessary. sub sp, 530 else sub sp,512 endif mov di,sp mov si,offset msgRealModeApp1 push ds smov ds,cs UnSetKernelDS call StartString smov ds,cs mov si,offset msgRealModeApp2 call Append pop ds ReSetKernelDS mov bx,sp xor ax,ax push ax ; Null hwnd push ss push bx ; (lpstr)text push cs mov ax,offset szProtectCap push ax ; (lpstr)caption mov ax,MB_OKCANCEL or MB_ICONEXCLAMATION or MB_DEFBUTTON2 or MB_SYSTEMMODAL push ax ; wType call [pMBoxProc] ; Call USER.MessageBox ifdef FE_SB add sp, 530 else add sp,512 endif pop es pop si pop di promptly_done: pop fLMDepth pop Win_PDB ret cEnd nogen assumes ds,nothing assumes es,nothing StartString: call Append ; append first string ; Now append the file name push di lea di,[bx].opFile ; skip past length, date, time call NResGetPureName ; strip off drive and directory smov ds,es mov si,di pop di ; Append ASCIIZ string to output buffer, DS:DX points to string assumes ds,nothing assumes es,nothing Append: lodsb stosb or al,al jnz Append dec di ret assumes ds,nothing assumes es,nothing ;-----------------------------------------------------------------------; ; NResGetPureName ; ; Returns a pointer the the filename off the end of a path ; ; Entry: ; ES:DI => path\filename ; Returns: ; ES:DI => filename ; Registers Destroyed: ; ; History: ; Wed 18-Oct-1989 20:01:25 -by- David N. Weise [davidw] ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc NResGetPureName,<PUBLIC,NEAR> cBegin nogen ifdef FE_SB ; ; It is not possible to search filename delimiter by backword search ; in case of DBCS version. so we use forword search instead. ; mov bx,di iup0: mov al,es:[di] test al,al ; end of string? jz iup2 ; jump if so inc di cmp al,'\' jz iup1 cmp al,'/' jz iup1 cmp al,':' jz iup1 call FarMyIsDBCSLeadByte ; see if char is DBC jc iup0 ; jump if not a DBC inc di ; skip to detemine 2nd byte of DBC jmp iup0 iup1: mov bx,di ; update purename candidate jmp iup0 iup2: mov di,bx ; di points purename pointer ret else cld xor al,al mov cx,-1 mov bx,di repne scasb inc cx inc cx neg cx iup0: cmp bx,di ; back to beginning of string? jz iup1 ; yes, di points to name mov al,es:[di-1] ; get next char cmp al,'\' ; next char a '\'? jz iup1 ; yes, di points to name cmp al,'/' ; next char a '/' jz iup1 cmp al,':' ; next char a ':' jz iup1 ; yes, di points to name dec di ; back up one jmp iup0 iup1: ret endif cEnd nogen ;-----------------------------------------------------------------------; ; search_mod_dep_list ; ; Searches the dependent module list for the passed in name. ; ; Entry: ; AX = length of name to search for ; CX = count of modules ; DS:SI => module name to search for ; ES:DI => module table ; Returns: ; ; Registers Preserved: ; AX,BX,CX,DI,SI,ES ; ; Registers Destroyed: ; ; History: ; Sat 07-Oct-1989 17:12:43 -by- David N. Weise [davidw] ; ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc search_mod_dep_list,<PUBLIC,NEAR> cBegin nogen push bx push cx push di mov bx,di search_mod_loop: mov di,es:[bx] ; es:di = offset into imptable add di,es:[ne_imptab] cmp es:[di],al ; does len of entry = sizeof(doscalls) jnz get_next_entry push cx ; cx holds count of module entries. push si inc di ; es:di = import module name mov cx,ax rep cmpsb pop si pop cx stc jz got_it get_next_entry: inc bx inc bx loop search_mod_loop clc got_it: pop di pop cx pop bx ret cEnd nogen ;-----------------------------------------------------------------------; ; LMCheckHeap ; ; This checks for 4K free space in both USER's and GDI's data ; segments. If this space does not exist then we will not load ; the app. This is better than the hose-bag way we did things ; under win 1 and 2. ; ; Entry: ; nothing ; ; Returns: ; AX != 0 lots o'space ; ; Registers Destroyed: ; BX,CX ; ; History: ; Sat 28-Oct-1989 17:49:09 -by- David N. Weise [davidw] ; Wrote it! ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing MIN_RSC = 10 cProc LMCheckHeap,<PUBLIC,NEAR>,<ds> cBegin SetKernelDSNRES ifdef WOW ; USER32 and GDI32 can deal with memory alloc no need check heaps on WOW mov ax,-1 ; WOW doesn't have GDI or User heaps else ; so don't check them. mov ax, MIN_RSC cmp word ptr pGetFreeSystemResources[2],0 jz @F cCall pGetFreeSystemResources,<0> cmp ax, MIN_RSC jae @F if kdebug ; test low memory code if DEBUG krDebugOut DEB_WARN, "Resources #ax% - this tests your error handling code" or al, 1 else xor ax, ax ; you failed - g'bye endif @@: endif ; WOW ReSetKernelDS cEnd if 0 cProc check_gdi_user_heap_space,<PUBLIC,NEAR> cBegin nogen ReSetKernelDS ifdef WOW ; USER32 and GDI32 can deal with memory alloc no need check heaps on WOW mov ax,-1 ; WOW doesn't have GDI or User heaps else ; so don't check them. cmp graphics,0 jz c_ret push dx push es push ds mov ds,hGDI UnSetKernelDS call checkit_bvakasha or ax,ax jz c_exit pop ds ReSetKernelDS push ds mov ds,hUser UnSetKernelDS call checkit_bvakasha c_exit: pop ds pop es pop dx c_ret: ret public checkit_bvakasha checkit_bvakasha: mov bx,ds:[ne_pautodata] cCall FarMyLock,<ds:[bx].ns_handle> mov ds,ax call LocalCountFree sub ax,4095 ja cguhs_exit neg ax mov bx,LA_MOVEABLE cCall LocalAlloc,<bx,ax> or ax,ax jz cguhs_exit free_User_piece: cCall LocalFree,<ax> mov ax,sp ; return non-zero cguhs_exit: endif ;WOW ret cEnd nogen endif ;-----------------------------------------------------------------------; ; GetHeapSpaces ; ; ; Entry: ; nothing ; ; Returns: ; AX = free space (bytes) of User heap assuming heap can grow to 64K ; DX = free space (bytes) of GDI heap assuming heap can grow to 64K ; Registers Destroyed: ; ; History: ; Wed 10-Jan-1990 22:27:38 -by- David N. Weise [davidw] ; Wrote it! ;-----------------------------------------------------------------------; assumes ds,nothing assumes es,nothing cProc GetHeapSpaces,<PUBLIC,FAR>,<di,si> parmW hInstance cBegin call MapDStoDATA ReSetKernelDS cCall FarMyLock,<hInstance> or ax,ax jz ghs_exit mov ds,ax cmp ds:[ne_magic],NEMAGIC jnz ghs_must_be_data mov bx,ds:[ne_pautodata] cCall FarMyLock,<ds:[bx].ns_handle> mov ds,ax ghs_must_be_data: call LocalCountFree mov si,ax cCall GlobalSize,<ds> neg ax add ax,si ; AX = size of free assuming 64K mov cx,si ; CX = size of free mov dx,-1 sub dx,ds:[pLocalHeap] ; DX = size of heap ghs_exit: cEnd ;-----------------------------------------------------------------------; ; IsROMModule ; ; Determines if an app with a given name is a ROM application ; ; Entry: ; Returns: ; Registers Destroyed: ; ; History: ; Wed 01-May-1991 13:11:38 -by- Craig A. Critchley [craigc] ; Wrote it! ;-----------------------------------------------------------------------; cProc IsROMModule, <FAR, PUBLIC> cBegin <nogen> xor ax, ax retf 6 cEnd <nogen> ;-----------------------------------------------------------------------; ; IsROMFile ; ; Determines if a file is in ROM ; ; Entry: ; Returns: ; Registers Destroyed: ; ; History: ; 8/8/91 -- vatsanp -- adapted this for true-type files in ROM ; from IsROMModule [ craigc] ; Wed 01-May-1991 13:11:38 -by- Craig A. Critchley [craigc] ; Wrote it! ;-----------------------------------------------------------------------; cProc IsROMFile, <FAR, PUBLIC> cBegin <nogen> xor ax, ax retf 6 cEnd <nogen> sEnd NRESCODE end
Route19Mons: db $00 db $05 db 5,TENTACOOL db 10,MANTYKE db 15,KRABBY db 15,MARILL db 10,CHINCHOU db 15,STARYU db 20,TENTACOOL db 30,HORSEA db 35,CARVANHA db 40,LAPRAS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: Text MODULE: TextUndo FILE: tuVariables.asm AUTHOR: Andrew Wilson, Jun 16, 1992 REVISION HISTORY: Name Date Description ---- ---- ----------- atw 6/16/92 Initial revision DESCRIPTION: $Id: tuVariables.asm,v 1.1 97/04/07 11:22:39 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; A126665: a(n) = -n^2 + 9n + 53. ; 53,61,67,71,73,73,71,67,61,53,43,31,17,1,-17,-37,-59,-83,-109,-137,-167,-199,-233,-269,-307,-347,-389,-433,-479,-527,-577,-629,-683,-739,-797,-857,-919,-983,-1049,-1117,-1187,-1259,-1333,-1409,-1487,-1567,-1649,-1733,-1819,-1907,-1997,-2089,-2183,-2279 mov $1,9 sub $1,$0 mul $1,$0 mul $1,2 add $1,118 div $1,2 sub $1,6 mov $0,$1
; A199107: 5*12^n-1. ; 4,59,719,8639,103679,1244159,14929919,179159039,2149908479,25798901759,309586821119,3715041853439,44580502241279,534966026895359,6419592322744319,77035107872931839,924421294475182079,11093055533702184959,133116666404426219519,1597399996853114634239,19168799962237375610879,230025599546848507330559,2760307194562182087966719,33123686334746185055600639,397484236016954220667207679,4769810832203450648006492159,57237729986441407776077905919,686852759837296893312934871039,8242233118047562719755218452479,98906797416570752637062621429759,1186881568998849031644751457157119,14242578827986188379737017485885439,170910945935834260556844209830625279 mov $1,12 pow $1,$0 mul $1,5 sub $1,1 mov $0,$1
; ; Old School Computer Architecture - interfacing FLOS ; Stefano Bodrato, 2011 ; ; Get pointer to device info table ; ; $Id: get_device_info.asm,v 1.2 2015/01/19 01:33:00 pauloscustodio Exp $ ; INCLUDE "flos.def" PUBLIC get_device_info get_device_info: jp kjt_get_device_info
; A069865: a(n) = Sum_{k = 0..n} C(n,k)^6. ; Submitted by Jamie Morken(s4) ; 1,2,66,1460,54850,2031252,86874564,3848298792,180295263810,8709958973540,433617084579316,22071658807720392,1145600816547477316,60423221241495866600,3231675487858598367240,174928470621208572186960,9568929614185118483080770,528312173436681791506408260,29410084375652468835825953700,1649306291835755062635565266600,93107634141997907386222914746100,5287775212638388029439405881544200,301944474035722816022868015938874600,17327711158778580532167569829987114000,998929514277820066081170252714511090500 mov $2,$0 lpb $0 sub $0,1 mov $3,$2 bin $3,$0 pow $3,6 add $1,$3 lpe mov $0,$1 add $0,1
MoveTutor: call FadeToMenu call ClearBGPalettes call ClearScreen call DelayFrame ld b, SCGB_PACKPALS call GetSGBLayout xor a ld [wItemAttributeParamBuffer], a call .GetMoveTutorMove ld [wNamedObjectIndexBuffer], a ld [wPutativeTMHMMove], a call GetMoveName call CopyName1 farcall ChooseMonToLearnTMHM jr c, .cancel jr .enter_loop .loop farcall ChooseMonToLearnTMHM_NoRefresh jr c, .cancel .enter_loop call CheckCanLearnMoveTutorMove jr nc, .loop xor a ; FALSE ld [wScriptVar], a jr .quit .cancel ld a, -1 ld [wScriptVar], a .quit call CloseSubmenu ret .GetMoveTutorMove: ld a, [wScriptVar] cp MOVETUTOR_FLAMETHROWER jr z, .flamethrower cp MOVETUTOR_THUNDERBOLT jr z, .thunderbolt ; MOVETUTOR_ICE_BEAM ld a, ICE_BEAM ret .flamethrower ld a, FLAMETHROWER ret .thunderbolt ld a, THUNDERBOLT ret CheckCanLearnMoveTutorMove: ld hl, .MenuHeader call LoadMenuHeader predef CanLearnTMHMMove push bc ld a, [wCurPartyMon] ld hl, wPartyMonNicknames call GetNick pop bc ld a, c and a jr nz, .can_learn push de ld de, SFX_WRONG call PlaySFX pop de ld a, BANK(Text_TMHMNotCompatible) ld hl, Text_TMHMNotCompatible call FarPrintText jr .didnt_learn .can_learn callfar KnowsMove jr c, .didnt_learn predef LearnMove ld a, b and a jr z, .didnt_learn ld c, HAPPINESS_LEARNMOVE callfar ChangeHappiness jr .learned .didnt_learn call ExitMenu and a ret .learned call ExitMenu scf ret .MenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
namespace itk { #if defined(VTK_TYPE_USE___INT64) constexpr __int64 NumericTraits<__int64>::ZeroValue() = 0; constexpr __int64 NumericTraits<__int64>::OneValue() = 1; const unsigned __int64 NumericTraits<unsigned __int64>::ZeroValue() = 0ui64; const unsigned __int64 NumericTraits<unsigned __int64>::OneValue() = 1ui64; #endif }; // namespace itk
; A004773: Numbers congruent to {0, 1, 2} mod 4: a(n) = floor(4*n/3). ; 0,1,2,4,5,6,8,9,10,12,13,14,16,17,18,20,21,22,24,25,26,28,29,30,32,33,34,36,37,38,40,41,42,44,45,46,48,49,50,52,53,54,56,57,58,60,61,62,64,65,66,68,69,70,72,73,74,76,77,78,80,81,82,84,85,86,88,89,90 mov $1,$0 mul $1,4 div $1,3
// Copyright (c) 2019 Álvaro Ceballos // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt /** * @file tdouble_ops.hpp * * @brief Macros for defining `tdouble` operators. */ #ifndef CYNODELIC_TESELA_DETAIL_TDOUBLE_OPS_HPP #define CYNODELIC_TESELA_DETAIL_TDOUBLE_OPS_HPP #include <cynodelic/tesela/config.hpp> #define CYNODELIC_TESELA_TDOUBLE_DEFINE_ARITHMETIC_OPERATOR(op) \ constexpr friend tdouble operator op(const tdouble& lhs,const tdouble& rhs) \ { \ return tdouble(lhs.data op rhs.data); \ } \ constexpr friend tdouble operator op(const tdouble& lhs,const value_type& rhs) \ { \ return tdouble(lhs.data op tdouble(rhs).data); \ } \ constexpr friend tdouble operator op(const value_type& lhs,const tdouble& rhs) \ { \ return tdouble(tdouble(lhs).data op rhs.data); \ } #define CYNODELIC_TESELA_TDOUBLE_DEFINE_COMPARISON_OPERATOR(op) \ constexpr friend bool operator op(const tdouble& lhs,const tdouble& rhs) \ { \ return lhs.data op rhs.data; \ } \ constexpr friend bool operator op(const tdouble& lhs,const value_type& rhs) \ { \ return lhs.data op rhs; \ } \ constexpr friend bool operator op(const value_type& lhs,const tdouble& rhs) \ { \ return lhs op rhs.data; \ } #define CYNODELIC_TESELA_TDOUBLE_DEFINE_COMPOUND_OPERATOR(cmp_op,op) \ template <typename T> \ tdouble& operator cmp_op(const T& rhs) \ { \ data = quantize(data op quantize(rhs)); \ return *this; \ } \ tdouble& operator cmp_op(const tdouble& rhs) \ { \ data = quantize(data op rhs.data); \ return *this; \ } #endif // CYNODELIC_TESELA_DETAIL_TDOUBLE_OPS_HPP
include "p12f629.inc" org 0 _temp EQU 0x22 init: clrf _temp bsf _temp, 1 main: rlf _temp, f btfss STATUS, C goto main nop goto init zero: nop END
;; ;; Copyright (c) 2020, Intel Corporation ;; ;; 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 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 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. ;; %define NUM_LANES 8 %define AES_CBC_ENC_X4 aes_cbc_enc_128_x8_sse %define FLUSH_JOB_AES_ENC flush_job_aes128_enc_x8_sse %include "sse/mb_mgr_aes_flush_sse.asm"
#include "defines.hpp" class ac_admin_menu { idd = 1234562; movingEnable = true; enableSimulation = true; class controls { //////////////////////////////////////////////////////// // GUI EDITOR OUTPUT START (by nathalie, v1.063, #Jupubo) //////////////////////////////////////////////////////// class admin_background: IGUIBack { idc = 2200; x = 0.181215 * safezoneW + safezoneX; y = 0.177022 * safezoneH + safezoneY; w = 0.637571 * safezoneW; h = 0.645958 * safezoneH; colorBackground[] = {-1,-1,-1,0.5}; }; class other_menus: RscCombo { idc = 2100; x = 0.611575 * safezoneW + safezoneX; y = 0.126024 * safezoneH + safezoneY; w = 0.207211 * safezoneW; h = 0.0339978 * safezoneH; }; class admin_menu_header: RscText { idc = 1000; text = "ARMA_AC : Admins Menu"; //--- ToDo: Localize; x = 0.181215 * safezoneW + safezoneX; y = 0.126024 * safezoneH + safezoneY; w = 0.43036 * safezoneW; h = 0.0339978 * safezoneH; colorBackground[] = {-1,-1,-1,0.8}; }; class players_list: RscListbox { idc = 1500; x = 0.189184 * safezoneW + safezoneX; y = 0.194021 * safezoneH + safezoneY; w = 0.255028 * safezoneW; h = 0.611961 * safezoneH; }; class kill_btn: RscButton { idc = 1602; text = "Kill"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.245016 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class RscText_1002: RscText { idc = 1002; text = "Actions for selected element : "; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.19402 * safezoneH + safezoneY; w = 0.350664 * safezoneW; h = 0.0339978 * safezoneH; colorBackground[] = {-1,-1,-1,0.2}; }; class tp_to_player_btn: RscButton { idc = 1600; text = "Teleport to player"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.296013 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class glue_btn: RscButton { idc = 1601; text = "Glue"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.34701 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class heal_btn: RscButton { idc = 1603; text = "Heal"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.245016 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class tp_player_btn: RscButton { idc = 1604; text = "Teleport player to you"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.296013 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; sizeEx = 0.8 * GUI_GRID_H; }; class remove_weapons_btn: RscButton { idc = 1605; text = "Remove gear"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.34701 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class repair_btn: RscButton { idc = 1606; text = "Repair Vehicle"; //--- ToDo: Localize; x = 0.707211 * safezoneW + safezoneX; y = 0.245016 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class spectate_btn: RscButton { idc = 1607; text = "Spectate"; //--- ToDo: Localize; x = 0.707211 * safezoneW + safezoneX; y = 0.296013 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class kick_player: RscButton { idc = 1608; text = "Kick"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.398007 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class ban_player: RscButton { idc = 1609; text = "Ban"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.398007 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class RscText_1003: RscText { idc = 1003; text = "Executable on you : "; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.466002 * safezoneH + safezoneY; w = 0.342694 * safezoneW; h = 0.0339978 * safezoneH; colorBackground[] = {-1,-1,-1,0.2}; }; class god_btn: RscButton { idc = 1610; text = "God Mode"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.516999 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class bullets_trace_btn: RscButton { idc = 1611; text = "Bullets trace"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.516999 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class armory_btn: RscButton { idc = 1612; text = "Armory"; //--- ToDo: Localize; x = 0.707211 * safezoneW + safezoneX; y = 0.516999 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class vehicle_god_btn: RscButton { idc = 1613; text = "Vehicle God Mode"; //--- ToDo: Localize; x = 0.452182 * safezoneW + safezoneX; y = 0.584994 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class camera_btn: RscButton { idc = 1614; text = "Free Camera"; //--- ToDo: Localize; x = 0.579696 * safezoneW + safezoneX; y = 0.584994 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; class map_teleport_btn: RscButton { idc = 1615; text = "Map Teleport"; //--- ToDo: Localize; x = 0.707211 * safezoneW + safezoneX; y = 0.584994 * safezoneH + safezoneY; w = 0.103605 * safezoneW; h = 0.0339978 * safezoneH; }; //////////////////////////////////////////////////////// // GUI EDITOR OUTPUT END //////////////////////////////////////////////////////// }; };
TITLE CVLINNUM - Copyright (c) SLR Systems 1994 INCLUDE MACROS INCLUDE SEGMENTS INCLUDE MODULES INCLUDE CVSTUFF if fg_pe INCLUDE PE_STRUC endif PUBLIC CV_LINNUMS_4 .DATA EXTERNDEF CV_TEMP_RECORD:BYTE EXTERNDEF CURNMOD_GINDEX:DWORD,EXETABLE:DWORD,BYTES_SO_FAR:DWORD,CV_HEADER_LOC:DWORD,HIGH_WATER:DWORD EXTERNDEF PE_BASE:DWORD EXTERNDEF SEGMOD_GARRAY:STD_PTR_S,SEGMENT_GARRAY:STD_PTR_S,MODULE_GARRAY:STD_PTR_S,CSEG_GARRAY:STD_PTR_S EXTERNDEF SRC_GARRAY:STD_PTR_S,MDB_GARRAY:STD_PTR_S,PE_OBJECT_GARRAY:STD_PTR_S EXTERNDEF CV_DWORD_ALIGN:DWORD .CODE PASS2_TEXT externdef free:proc externdef print_int:proc EXTERNDEF MOVE_TEXT_TO_OMF:PROC,HANDLE_CV_INDEX:PROC,RELEASE_SEGMENT:PROC,FLUSH_CV_TEMP:PROC EXTERNDEF MOVE_EAX_TO_EDX_FINAL:PROC,RELEASE_BLOCK:PROC,QSORT_LINNUMS:PROC,MOVE_LDATA_3:PROC EXTERNDEF GET_NEW_LOG_BLK:PROC,ALLOC_LOCAL:PROC,INIT_LOCAL_STORAGE:PROC,RELEASE_LOCAL_STORAGE:PROC EXTERNDEF _big_xdebug_write:proc,_cv_dword_align_rtn:proc CVLIN_STRUCT STRUC ; CV_OFFSET_BLOCKS_BP DD 64K/PAGE_SIZE*4 DUP(?) CV_LINNUM_BLOCKS_BP DD 64K/PAGE_SIZE*2 DUP(?) CV_LIN_BLK_BP DD ? CV_LIN_PHYS_BP DD ? CV_LIN_FACTOR_BP DD ? CV_SEG_NUMBER_BP DD ? CV_LSEG_GINDEX_BP DD ? CV_SEG_FRAME_BP DD ? CV_LN_STUFF_BP LINNUM_HEADER_TYPE<> CV_INPUT_BLK_PTR_BP DD ? CV_LINNUM_PTR_BP DD ? CV_LINNUM_PTR_LIMIT_BP DD ? CV_OFFSET_PTR_BP DD ? CV_OFFSET_PTR_LIMIT_BP DD ? CV_NEXT_LINNUM_BLK_BP DD ? CV_NEXT_OFFSET_BLK_BP DD ? CV_FIRST_OFFSET_BP DD ? CV_LAST_OFFSET_BP DD ? CV_LINE_COUNT_BP DD ? CV_BASEMOD_BP DD ? CV_M_FIRST_SRC_GINDEX_BP DD ? CV_M_FIRST_SRC_NUMBER_BP DD ? CV_M_FIRST_CSEGMOD_GINDEX_BP DD ? CV_M_SRC_COUNT_BP DD ? CV_M_CSEG_COUNT_BP DD ? CV_HELP_PTRS_BP DD ? CV_SEGMOD_EXPECTED_BP DD ? CV_OFFSET_SIZE_BP DD ? CV_OFFSET_MASK_BP DD ? CV_BLOCK_BASE_BP DD ? CV_INPUT_PTR_LIMIT_BP DD ? CVLIN_STRUCT ENDS FIX MACRO X X EQU ([EBP-SIZE CVLIN_STRUCT].(X&_BP)) ENDM FIX CV_OFFSET_BLOCKS FIX CV_LINNUM_BLOCKS FIX CV_LIN_BLK FIX CV_LIN_PHYS FIX CV_LIN_FACTOR FIX CV_SEG_NUMBER FIX CV_LSEG_GINDEX FIX CV_SEG_FRAME FIX CV_LN_STUFF FIX CV_INPUT_BLK_PTR FIX CV_LINNUM_PTR FIX CV_LINNUM_PTR_LIMIT FIX CV_OFFSET_PTR FIX CV_OFFSET_PTR_LIMIT FIX CV_NEXT_LINNUM_BLK FIX CV_NEXT_OFFSET_BLK FIX CV_FIRST_OFFSET FIX CV_LAST_OFFSET FIX CV_LINE_COUNT FIX CV_BASEMOD FIX CV_M_FIRST_SRC_GINDEX FIX CV_M_FIRST_SRC_NUMBER FIX CV_M_FIRST_CSEGMOD_GINDEX FIX CV_M_SRC_COUNT FIX CV_M_CSEG_COUNT FIX CV_HELP_PTRS FIX CV_SEGMOD_EXPECTED FIX CV_OFFSET_SIZE FIX CV_OFFSET_MASK FIX CV_BLOCK_BASE FIX CV_INPUT_PTR_LIMIT CV_LN_NEXT_LINNUM EQU CV_LN_STUFF._LN_NEXT_LINNUM CV_LN_BLOCK_BASE EQU CV_LN_STUFF._LN_BLOCK_BASE CV_LN_LENGTH EQU CV_LN_STUFF._LN_LENGTH CV_LN_TYPE EQU CV_LN_STUFF._LN_TYPE CV_LN_SRC_GINDEX EQU CV_LN_STUFF._LN_SRC_GINDEX HLP_STRUCT STRUC _HLP_LAST_LINHELP DD ? _HLP_FIRST_LINHELP DD ? HLP_STRUCT ENDS SRC_LIN_HELP STRUC _SLH_NEXT_HELP DD ? _SLH_FIRST_OFFSET DD ? _SLH_LAST_OFFSET DD ? _SLH_BASEMOD DD ? SRC_LIN_HELP ENDS CSEG_DESC_STRUCT STRUC _CSD_NEXT_CSD DD ? _CSD_START_OFFSET DD ? _CSD_END_OFFSET DD ? _CSD_SEG_GINDEX DD ? CSEG_DESC_STRUCT ENDS CV_LINNUMS_4 PROC ; ;OUTPUT LINE NUMBER INFO FOR THIS MODULE, CODEVIEW VERSION < 4.0 ; ;FIRST COPY ALL LINE NUMBERS FROM THIS MODULE TO EXETABLE ;SORT FOR EACH CSEGMOD INDIVIDUALLY ; MOV EAX,CURNMOD_GINDEX ;THIS MODULE CONVERT EAX,EAX,MODULE_GARRAY ASSUME EAX:PTR MODULE_STRUCT ; ;NOW, SEE IF ANY LINE NUMBERS THIS MODULE ; MOV ECX,[EAX]._M_MDB_GINDEX MOV AL,[EAX]._M_FLAGS ASSUME EAX:NOTHING TEST ECX,ECX JZ L9$ TEST AL,MASK M_SRCS_PRESENT JZ L9$ PUSHM EBP,EDI,ESI,EBX MOV EBP,ESP SUB ESP,SIZE CVLIN_STRUCT ASSUME EBP:PTR CVLIN_STRUCT CALL INIT_LOCAL_STORAGE CALL CV_DWORD_ALIGN MOV EAX,BYTES_SO_FAR ;SAVE FOR SECTION LENGTH MOV ESI,CURNMOD_GINDEX ;THIS MODULE PUSH EAX MOV CV_BASEMOD,EAX CONVERT ESI,ESI,MODULE_GARRAY ASSUME ESI:PTR MODULE_STRUCT MOV ESI,[ESI]._M_MDB_GINDEX CONVERT ESI,ESI,MDB_GARRAY ASSUME ESI:PTR MDB_STRUCT MOV EBX,[ESI]._MD_CSEG_COUNT MOV EAX,[ESI]._MD_SRC_COUNT TEST EBX,EBX JZ L99$ MOV CV_M_SRC_COUNT,EAX MOV CV_M_CSEG_COUNT,EBX MOV EAX,[ESI]._MD_FIRST_SRC_GINDEX MOV EBX,[ESI]._MD_FIRST_CSEGMOD_GINDEX ; ;CALCULATE SIZE OF HEADER ; MOV CV_M_FIRST_SRC_GINDEX,EAX CONVERT EAX,EAX,SRC_GARRAY ASSUME EAX:PTR SRC_STRUCT CALL INIT_HELP_COUNTS MOV ECX,[EAX]._SRC_NUMBER MOV EAX,CV_M_CSEG_COUNT MOV CV_M_FIRST_SRC_NUMBER,ECX ASSUME EAX:NOTHING ADD EAX,EAX MOV ECX,CV_M_SRC_COUNT SHL ECX,2 MOV EDX,EAX SHL EAX,2 ADD ECX,7 ADD EAX,EDX MOV EDX,BYTES_SO_FAR ADD EAX,ECX MOV CV_M_FIRST_CSEGMOD_GINDEX,EBX AND EAX,0FFFFFFFCH ADD EAX,EDX MOV BYTES_SO_FAR,EAX SUSPEND_CANCEL ;DISABLE CANCEL TILL I'M DONE CALL GET_NEW_LOG_BLK ;PLACE FOR SRC BEGINNING AND ENDING HELP PTRS MOV CV_HELP_PTRS,EAX MOV ECX,CV_M_SRC_COUNT MOV EDI,EAX XOR EAX,EAX SHL ECX,1 ;2 DWORDS PER SRC FILE ;<<>> seg fault here EDI=01C24000, ECX=2 REP STOSD MOV CV_SEG_NUMBER,EAX ;FORCE NEW RECORD MOV CV_LSEG_GINDEX,EAX MOV CV_SEGMOD_EXPECTED,EAX MOV HIGH_WATER,EAX ;MOV EAX,CV_M_FIRST_CSEGMOD_GINDEX ;JMP CHECK_CSEGMOD pop EAX push EBP push EAX mov EAX,CV_M_FIRST_CSEGMOD_GINDEX push EAX call _check_csegmod add ESP,12 add ESP,0E0h ;mov ESP,EBP POPM EBX,ESI,EDI,EBP ret L9$: RET L99$: CALL RELEASE_LOCAL_STORAGE MOV ESP,EBP POPM EBX,ESI,EDI,EBP RET ASSUME EDI:PTR CVL_STRUCT,ESI:NOTHING CV_LIN_SPEC: ; ;MAY CROSS BOUNDARIES ; CALL GET2 AND EAX,0FFFFH MOV [EDI]._CVL_LINNUM,EAX ;LINE # CALL GET2 MOV EDX,CV_OFFSET_SIZE AND EAX,0FFFFH CMP EDX,4 JZ L16_1 MOV EDX,EAX CALL GET2 SHL EAX,16 ADD EAX,EDX L16_1: ADD EAX,CV_LIN_FACTOR MOV EDX,CV_LN_SRC_GINDEX MOV [EDI]._CVL_OFFSET,EAX MOV [EDI]._CVL_SRC_GINDEX,EDX ADD EDI,SIZE CVL_STRUCT JMP LL_3 CSEGMOD_LOOP: ; ;START A NEW SEGMOD ; CALL CSEGMOD_START PUSH EAX ;NEXT CSEGMOD JMP CHECK_LINNUM LLIN_LOOP: ; ;START A NEW LINNUM RECORD ; MOV EAX,ECX CALL LINE_START ;INIT RECORD BUFFER, ;DX = OFFSET TO ADD, CX = # OF ITEMS, ;BX = 2 IF 32-BIT, ELSE 0 LINE_LOOP: CMP ESI,EBX ;AT LEAST 1 LEFT? JAE CV_LIN_SPEC MOV EAX,[ESI] ;LINE # ADD EDI,SIZEOF CVL_STRUCT AND EAX,0FFFFH MOV EDX,CV_OFFSET_MASK MOV [EDI-SIZE CVL_STRUCT]._CVL_LINNUM,EAX MOV EAX,[ESI+2] AND EAX,EDX MOV EDX,CV_LIN_FACTOR ADD EAX,EDX MOV EDX,CV_OFFSET_SIZE MOV [EDI-SIZE CVL_STRUCT]._CVL_OFFSET,EAX MOV EAX,CV_LN_SRC_GINDEX ADD ESI,EDX MOV [EDI-SIZE CVL_STRUCT]._CVL_SRC_GINDEX,EAX LL_3: CMP EDI,OFF CV_TEMP_RECORD+CV_TEMP_SIZE-SIZE CVL_STRUCT ;ROOM FOR AT LEAST 1 MORE? JAE L5$ L51$: DEC ECX JNZ LINE_LOOP JMP LINE_DONE L5$: PUSH ECX CALL FLUSH_LIN_TEMP POP ECX JMP L51$ LINE_DONE: CALL FLUSH_LIN_TEMP NEXT_LINE: ; ;DEC USAGE COUNT ; MOV EAX,CV_BLOCK_BASE MOV ECX,CV_LN_NEXT_LINNUM ;ANOTHER RECORD? DEC DPTR [EAX] JNZ NY_1 CALL RELEASE_SEGMENT NY_1: CHECK_LINNUM: TEST ECX,ECX JNZ LLIN_LOOP ASSUME EDI:NOTHING ; ;NO MORE LINES THIS SEGMOD, TRY NEXT ; POP EAX jmp CHECK_CSEGMOD public _check_csegmod _check_csegmod proc mov EAX,8[ESP] PUSHM EBP,EDI,ESI,EBX sub ESP,0E0h push EAX mov EAX,0E0h+4*5+4[ESP] mov EBP,0E0h+4*5+12[ESP] _check_csegmod endp CHECK_CSEGMOD: TEST EAX,EAX JNZ CSEGMOD_LOOP CALL HANDLE_SEGMOD_LINES ;FLUSH LINES FROM LAST SEGMOD ; ;NO MORE CODE SEGMODS, YOU ARE DONE ; CALL LINNUM_FLUSH ;FLUSH COUNT FROM LAST LINNUM TYPE CALL RELEASE_LOCAL_STORAGE MOV EAX,CV_HELP_PTRS ;CALL RELEASE_BLOCK push EAX call free add ESP,4 ; ;NOW OUTPUT INDEX ENTRY ; POP EAX ;OLD BYTES_SO_FAR (FOR INDEX) MOV ECX,127H CALL HANDLE_CV_INDEX CALL CV_DWORD_ALIGN add ESP,0E0h ;MOV ESP,EBP POPM EBX,ESI,EDI,EBP RESUME_CANCEL ;ALLOW CANCEL IF REQUESTED RET CV_LINNUMS_4 ENDP public _init_help_counts _init_help_counts proc mov EAX,4[ESP] _init_help_counts endp INIT_HELP_COUNTS PROC NEAR PRIVATE ASSUME EAX:PTR SRC_STRUCT PUSH EAX SUB ECX,ECX L1$: MOV [EAX]._SRC_LINHELP_COUNT,ECX MOV EAX,[EAX]._SRC_NEXT_GINDEX TEST EAX,EAX JNZ L1$ POP EAX RET ASSUME EAX:NOTHING INIT_HELP_COUNTS ENDP GET2 PROC NEAR PRIVATE ; ;GET NEXT TWO BYTES FROM INPUT STREAM ; LEA EAX,[EBX+6] CMP ESI,EAX JE L1$ MOV AX,WPTR [ESI] ADD ESI,2 RET L1$: MOV EAX,CV_BLOCK_BASE DEC DPTR [EAX] ;LAST ITEM IN BLOCK? MOV ESI,[EAX+4] MOV CV_BLOCK_BASE,ESI JNZ L2$ CALL RELEASE_SEGMENT L2$: LEA EBX,[ESI + PAGE_SIZE-6] MOV AX,WPTR [ESI+8] ADD ESI,10 RET GET2 ENDP LINE_START PROC NEAR PRIVATE ; ;EAX IS LOGICAL ADDRESS OF NEW LINNUM RECORD ; ;INIT RECORD BUFFER, ; ;RETURNS: ;DX = OFFSET TO ADD, CX = # OF ITEMS, ;BX = 2 IF 32-BIT, ELSE 0 ; ASSUME EAX:PTR LINNUM_HEADER_TYPE MOV ECX,[EAX]._LN_BLOCK_BASE MOV EDX,[EAX]._LN_NEXT_LINNUM MOV CV_LN_BLOCK_BASE,ECX MOV CV_BLOCK_BASE,ECX LEA EBX,[ECX+PAGE_SIZE-6] MOV CV_LN_NEXT_LINNUM,EDX MOV ECX,DPTR [EAX]._LN_LENGTH MOV EDX,[EAX]._LN_SRC_GINDEX MOV DPTR CV_LN_LENGTH,ECX MOV CV_LN_SRC_GINDEX,EDX LEA ESI,[EAX + SIZEOF LINNUM_HEADER_TYPE] ; ; ; MOV AL,CV_LN_TYPE MOV ECX,6 MOV EDX,-1 TEST AL,MASK BIT_32 JNZ L1$ MOV CL,4 MOV EDX,0FFFFH L1$: MOV CV_OFFSET_SIZE,ECX MOV CV_OFFSET_MASK,EDX ; ;CALCULATE # OF LINE #'S IN THIS RECORD ; MOV ECX,DPTR CV_LN_LENGTH MOV DL,CV_LN_TYPE AND ECX,0FFFFH AND DL,MASK BIT_32 MOV EAX,ECX JZ L91$ MOV ECX,6 XOR EDX,EDX DIV CX MOV EDI,OFF CV_TEMP_RECORD ;PLACE TO BUILD THIS RECORD MOV ECX,EAX RET L91$: SHR ECX,2 MOV EDI,OFF CV_TEMP_RECORD ;PLACE TO BUILD THIS RECORD RET LINE_START ENDP CSEGMOD_START PROC NEAR PRIVATE ; ;EAX IS SEGMOD ; ;RETURNS DX=OFFSET TO ADD TO EACH LINENUMBER ; EDI IS PLACE TO STORE LINE#, OFFSET#, AND SRCFILE# ; ESI IS VIRTUAL LINNUM RECORD ADDRESS ; MOV ECX,CV_SEGMOD_EXPECTED PUSH EBX CMP ECX,EAX JZ L0$ PUSH EAX CALL HANDLE_SEGMOD_LINES ;FLUSH LINES CAUSE WE ARE CHANGING HERE... POP EAX L0$: CONVERT EAX,EAX,SEGMOD_GARRAY ASSUME EAX:PTR SEGMOD_STRUCT MOV ECX,[EAX]._SM_NEXT_SEGMOD_GINDEX MOV EBX,[EAX]._SM_START MOV CV_SEGMOD_EXPECTED,ECX MOV ECX,[EAX]._SM_MODULE_CSEG_GINDEX MOV EAX,[EAX]._SM_BASE_SEG_GINDEX MOV EDX,CV_LSEG_GINDEX CMP EDX,EAX JZ L1$ PUSH ECX CALL CSEGMENT_START POP ECX L1$: MOV EAX,CV_SEG_FRAME CONVERT ECX,ECX,CSEG_GARRAY ASSUME ECX:PTR CSEG_STRUCT SUB EBX,EAX ;OVERALL OFFSET MAYBE MINUS FRAME MOV EAX,[ECX]._CSEG_NEXT_CSEGMOD_GINDEX MOV CV_LIN_FACTOR,EBX MOV ECX,[ECX]._CSEG_FIRST_LINNUM POP EBX RET ASSUME EAX:NOTHING,ECX:NOTHING CSEGMOD_START ENDP CSEGMENT_START PROC NEAR PRIVATE ; ;EAX IS NEW SEGMENT_GINDEX ; GETT CL,OUTPUT_PE MOV EDX,EAX OR CL,CL JZ L5$ CONVERT EAX,EAX,SEGMENT_GARRAY ASSUME EAX:PTR SEGMENT_STRUCT MOV EAX,[EAX]._SEG_PEOBJECT_NUMBER MOV ECX,CV_SEG_NUMBER CMP ECX,EAX JNZ L2$ MOV CV_LSEG_GINDEX,EDX RET L2$: PUSH EDX CALL HANDLE_SEGMOD_LINES ;FLUSH ANY PREVIOUS POP EAX MOV CV_LSEG_GINDEX,EAX CONVERT EAX,EAX,SEGMENT_GARRAY ASSUME EAX:PTR SEGMENT_STRUCT MOV ECX,[EAX]._SEG_PEOBJECT_NUMBER MOV EAX,[EAX]._SEG_PEOBJECT_GINDEX MOV CV_SEG_NUMBER,ECX MOV ECX,PE_BASE CONVERT EAX,EAX,PE_OBJECT_GARRAY ASSUME EAX:PTR PE_OBJECT_STRUCT ADD ECX,[EAX]._PEOBJECT_RVA MOV CV_SEG_FRAME,ECX RET L5$: PUSH EDX CALL HANDLE_SEGMOD_LINES ;FLUSH ANY PREVIOUS POP EAX MOV CV_LSEG_GINDEX,EAX CONVERT EAX,EAX,SEGMENT_GARRAY ASSUME EAX:PTR SEGMENT_STRUCT ; ;ALSO DEFINE SEG_INDEX FOR CV TYPE 2 ; MOV ECX,[EAX]._SEG_CV_NUMBER MOV EAX,[EAX]._SEG_OFFSET MOV CV_SEG_NUMBER,ECX MOV CV_SEG_FRAME,EAX RET CSEGMENT_START ENDP LINNUM_FLUSH PROC NEAR PRIVATE ; ;FLUSH ALL THIS NONSENSE ; ; ;FIRST, FLUSH ALL SRC DESCRIPTORS ; MOV EDX,CV_M_FIRST_SRC_NUMBER MOV ECX,CV_M_SRC_COUNT MOV EAX,CV_M_FIRST_SRC_GINDEX L1$: PUSHM ECX,EAX,EDX ; ;OUTPUT BASESRCLN FOR EACH LINHELP COUNT ; CALL SET_OUTPUT_PTRS CALL CV_DWORD_ALIGN POP EAX MOV EBX,CV_HELP_PTRS ASSUME EBX:PTR HLP_STRUCT PUSH EAX SUB EAX,CV_M_FIRST_SRC_NUMBER MOV EDX,BYTES_SO_FAR MOV ECX,CV_BASEMOD SUB EDX,ECX MOV ESI,[EBX+EAX*8]._HLP_FIRST_LINHELP MOV [EBX+EAX*8]._HLP_LAST_LINHELP,EDX JMP CHECK_LINHELP FIXIT: CALL SET_NEXT_OFFSET_BLOCK MOV EAX,CV_LINNUM_PTR MOV ECX,CV_LINNUM_PTR_LIMIT CMP EAX,ECX JNZ FIXIT_RET CALL SET_NEXT_LINNUM_BLOCK JMP FIXIT_RET ASSUME ESI:PTR SRC_LIN_HELP LINHELP_LOOP: MOV EAX,[ESI]._SLH_NEXT_HELP MOV EDI,CV_OFFSET_PTR PUSH EAX MOV EAX,[ESI]._SLH_FIRST_OFFSET MOV ECX,[ESI]._SLH_LAST_OFFSET MOV [EDI],EAX MOV EDX,CV_LINNUM_PTR MOV [EDI+4],ECX ADD EDI,8 MOV EAX,[ESI]._SLH_BASEMOD MOV CV_OFFSET_PTR,EDI MOV [EDX],EAX ADD EDX,4 MOV EAX,CV_OFFSET_PTR_LIMIT MOV CV_LINNUM_PTR,EDX CMP EDI,EAX POP ESI JZ FIXIT FIXIT_RET: CHECK_LINHELP: TEST ESI,ESI JNZ LINHELP_LOOP ; ;OK, NEED CSEGS, PAD, ALL BASESRCLN'S, ALL START-ENDS, AND FILE NAME ; POPM EAX,ESI MOV EDI,OFF CV_TEMP_RECORD+4 CONVERT ESI,ESI,SRC_GARRAY ASSUME ESI:PTR SRC_STRUCT MOV ECX,[ESI]._SRC_NEXT_GINDEX MOV EBX,[ESI]._SRC_LINHELP_COUNT PUSHM ECX,EAX MOV [EDI-4],EBX CALL FLUSH_CV_TEMP SHL EBX,2 ;LINHELP_COUNT LEA ECX,CV_LINNUM_BLOCKS MOV EAX,EBX push ECX push EAX call _big_xdebug_write add ESP,8 LEA ECX,CV_OFFSET_BLOCKS LEA EAX,[EBX*2] push ECX push EAX call _big_xdebug_write add ESP,8 MOV EDI,OFF CV_TEMP_RECORD LEA ESI,[ESI]._SRC_TEXT CALL MOVE_TEXT_TO_OMF CALL FLUSH_CV_TEMP POPM EDX,EAX POP ECX INC EDX ;SRC # OF NEXT ONE DEC ECX JNZ L1$ ; ;NOW NEED TO WRITE SRCMODULE HEADER RECORD ; CALL CV_DWORD_ALIGN MOV EAX,BYTES_SO_FAR MOV EDX,CV_BASEMOD PUSH EAX MOV EAX,CV_M_CSEG_COUNT SHL EAX,16 MOV ECX,CV_M_SRC_COUNT MOV EDI,OFF CV_TEMP_RECORD+4 MOV ESI,CV_HELP_PTRS ASSUME ESI:PTR HLP_STRUCT OR EAX,ECX MOV BYTES_SO_FAR,EDX MOV [EDI-4],EAX ; ;WRITE CX BASESRCFILES ; L5$: MOV EAX,[ESI]._HLP_LAST_LINHELP ADD ESI,SIZE HLP_STRUCT MOV [EDI],EAX ADD EDI,4 CMP EDI,OFF CV_TEMP_RECORD+CV_TEMP_SIZE-4 JA L51$ L52$: DEC ECX JNZ L5$ CALL FLUSH_CV_TEMP ; ;NOW WRITE A START-END FOR EACH CSEGMOD ; CALL SET_OUTPUT_PTRS MOV ESI,CV_M_FIRST_CSEGMOD_GINDEX L6$: CONVERT ESI,ESI,SEGMOD_GARRAY ASSUME ESI:PTR SEGMOD_STRUCT MOV ECX,[ESI]._SM_BASE_SEG_GINDEX ;STORE BASE SEGMENT INDEX # MOV EDI,CV_LINNUM_PTR MOV EAX,[ESI]._SM_START MOV EDX,ECX CONVERT ECX,ECX,SEGMENT_GARRAY ASSUME ECX:PTR SEGMENT_STRUCT MOV CV_FIRST_OFFSET,EAX MOV EAX,[ECX]._SEG_CV_NUMBER MOV [EDI],EAX ADD EDI,2 MOV CV_LINNUM_PTR,EDI GETT AL,OUTPUT_PE OR AL,AL JZ L65$ MOV EDI,[ECX]._SEG_PEOBJECT_GINDEX CALL LFLUSH_32 JMP L66$ L51$: CALL FLUSH_CV_TEMP JMP L52$ L65$: CALL LFLUSH_16 L66$: MOV EDI,CV_OFFSET_PTR ASSUME ECX:NOTHING CMP ECX,EAX JZ L62$ DEC ECX L62$: MOV [EDI],EAX MOV [EDI+4],ECX ADD EDI,8 TEST ESI,ESI MOV CV_OFFSET_PTR,EDI MOV EAX,CV_OFFSET_PTR_LIMIT JZ L69$ CMP EDI,EAX JNZ L6$ CALL SET_NEXT_OFFSET_BLOCK MOV EAX,CV_LINNUM_PTR MOV ECX,CV_LINNUM_PTR_LIMIT CMP EAX,ECX JNZ L6$ CALL SET_NEXT_LINNUM_BLOCK JMP L6$ L69$: ; ;NOW FLUSH THOSE ; MOV EAX,CV_M_CSEG_COUNT LEA ECX,CV_OFFSET_BLOCKS SHL EAX,3 push ECX push EAX call _big_xdebug_write add ESP,8 MOV EAX,CV_M_CSEG_COUNT LEA ECX,CV_LINNUM_BLOCKS ADD EAX,EAX push ECX push EAX call _big_xdebug_write add ESP,8 POP EBX call _cv_dword_align_rtn MOV BYTES_SO_FAR,EBX RET LINNUM_FLUSH ENDP LFLUSH_16 PROC NEAR ; ;NOW DEFINE LAST OFFSET ; MOV EAX,[ESI]._SM_LEN L1$: MOV ECX,[ESI]._SM_NEXT_SEGMOD_GINDEX MOV ESI,[ESI]._SM_MODULE_CSEG_GINDEX MOV CV_LAST_OFFSET,EAX CONVERT ESI,ESI,CSEG_GARRAY ASSUME ESI:PTR CSEG_STRUCT TEST ECX,ECX MOV ESI,[ESI]._CSEG_NEXT_CSEGMOD_GINDEX JZ L5$ CMP ECX,ESI JNZ L5$ CONVERT ESI,ESI,SEGMOD_GARRAY ASSUME ESI:PTR SEGMOD_STRUCT MOV EBX,[ESI]._SM_BASE_SEG_GINDEX MOV EAX,[ESI]._SM_LEN CMP EBX,EDX JZ L1$ MOV ESI,ECX L5$: CONVERT EDX,EDX,SEGMENT_GARRAY ASSUME EDX:PTR SEGMENT_STRUCT MOV EAX,CV_FIRST_OFFSET MOV EBX,[EDX]._SEG_OFFSET MOV ECX,CV_LAST_OFFSET MOV EDX,[EDX]._SEG_OFFSET SUB EAX,EBX SUB ECX,EDX RET LFLUSH_16 ENDP if fg_pe LFLUSH_32 PROC NEAR ; ;NOW DEFINE LAST OFFSET ; ;EDX IS SEGMENT GINDEX, EDI IS PEOBJECT GINDEX ; MOV EAX,[ESI]._SM_LEN L1$: MOV ECX,[ESI]._SM_NEXT_SEGMOD_GINDEX MOV ESI,[ESI]._SM_MODULE_CSEG_GINDEX MOV CV_LAST_OFFSET,EAX CONVERT ESI,ESI,CSEG_GARRAY ASSUME ESI:PTR CSEG_STRUCT TEST ECX,ECX MOV ESI,[ESI]._CSEG_NEXT_CSEGMOD_GINDEX JZ L5$ CMP ECX,ESI JNZ L5$ CONVERT ESI,ESI,SEGMOD_GARRAY ASSUME ESI:PTR SEGMOD_STRUCT MOV EBX,[ESI]._SM_BASE_SEG_GINDEX MOV EAX,[ESI]._SM_LEN CMP EBX,EDX JZ L1$ MOV EDX,EBX CONVERT EBX,EBX,SEGMENT_GARRAY ASSUME EBX:PTR SEGMENT_STRUCT MOV EBX,[EBX]._SEG_PEOBJECT_GINDEX CMP EBX,EDI JZ L1$ MOV ESI,ECX L5$: CONVERT EDI,EDI,PE_OBJECT_GARRAY ASSUME EDI:PTR PE_OBJECT_STRUCT MOV EAX,CV_FIRST_OFFSET MOV EBX,[EDI]._PEOBJECT_RVA MOV ECX,CV_LAST_OFFSET SUB EAX,EBX MOV EBX,[EDI]._PEOBJECT_RVA MOV EDX,PE_BASE SUB ECX,EBX SUB EAX,EDX SUB ECX,EDX RET ASSUME EDI:NOTHING LFLUSH_32 ENDP endif HANDLE_SEGMOD_LINES PROC NEAR ; ;FINISHED BUILDING ARRAY OF JUNK, NOW BUILD OUTPUT ARRAY ; ; 1. SORT LINNUMS BY ADDRESS ; 2. BUILD OUTPUT LINENUMBER TABLES ; ;TEMP STUFF IS IN EXETABLE ; PUSH EDI MOV EAX,HIGH_WATER TEST EAX,EAX JZ L9$ PUSHM ESI,EBX CALL QSORT_LINNUMS ;RETURNS # OF LINES IN AX ; ;NOW SCAN TABLE, OUTPUTTING OFFSETS VS LINENUMBERS, PER SRC_FILE ; MOV CV_LINE_COUNT,EAX CALL SET_INPUT_PTR ASSUME ESI:PTR CVL_STRUCT XOR EDX,EDX L1$: MOV ECX,[ESI]._CVL_SRC_GINDEX MOV EAX,[ESI]._CVL_OFFSET CMP ECX,EDX ;CHANGING SOURCE FILE? JNZ L5$ MOV ECX,[ESI]._CVL_LINNUM MOV CV_LAST_OFFSET,EAX TEST ECX,ECX JZ L4$ ;SKIP ZERO LINE NUMBER MOV EBX,CV_LINNUM_PTR MOV EDI,CV_OFFSET_PTR MOV WPTR [EBX],CX ADD EBX,2 MOV [EDI],EAX ADD EDI,4 MOV CV_LINNUM_PTR,EBX MOV CV_OFFSET_PTR,EDI MOV ECX,CV_OFFSET_PTR_LIMIT MOV EAX,CV_LINE_COUNT CMP ECX,EDI JZ L45$ L41$: ADD ESI,SIZE CVL_STRUCT DEC EAX MOV CV_LINE_COUNT,EAX JZ L8$ CMP ESI,CV_INPUT_PTR_LIMIT JNZ L1$ ; ;NEED TO UPDATE INPUT POINTER, AND MAYBE OUTPUT POINTERS ; PUSH EDX CALL SET_NEXT_INPUT_PTR POP EDX JMP L1$ L4$: MOV EAX,CV_LINE_COUNT JMP L41$ L9$: POP EDI RET L45$: PUSHM EDX,EAX CALL SET_NEXT_OFFSET_BLOCK POPM EAX,EDX CMP CV_LINNUM_PTR_LIMIT,EBX JNZ L4$ PUSHM EDX,EAX CALL SET_NEXT_LINNUM_BLOCK POPM EAX,EDX JMP L4$ L5$: ; ;CHANGED SOURCE FILES. UPDATE OLD ONE? ; TEST EDX,EDX JZ L6$ ;JUMP IF FIRST SOURCE FILE PUSH EAX CALL FLUSH_PREV_SRCFILE POP EAX L6$: MOV CV_FIRST_OFFSET,EAX CALL SET_OUTPUT_PTRS MOV EDX,[ESI]._CVL_SRC_GINDEX JMP L1$ ASSUME ESI:NOTHING L8$: MOV ECX,CV_INPUT_BLK_PTR ;RELEASE LAST INPUT BLOCK XOR EBX,EBX MOV EAX,[ECX] MOV [ECX],EBX CALL RELEASE_BLOCK CALL FLUSH_PREV_SRCFILE ;FLUSH ANY LINES BUFFERED POP EBX XOR EAX,EAX POPM ESI,EDI MOV HIGH_WATER,EAX RET ;GO PREPARE FOR MORE SEGMODS... HANDLE_SEGMOD_LINES ENDP SET_OUTPUT_PTRS PROC NEAR ; ;ALLOCATE AND SET UP OUTPUT POINTERS ; LEA ECX,CV_OFFSET_BLOCKS MOV CV_NEXT_OFFSET_BLK,ECX CALL SET_NEXT_OFFSET_BLOCK LEA ECX,CV_LINNUM_BLOCKS MOV CV_NEXT_LINNUM_BLK,ECX JMP SET_NEXT_LINNUM_BLOCK SET_OUTPUT_PTRS ENDP SET_NEXT_OFFSET_BLOCK PROC NEAR ; ; ; MOV ECX,CV_NEXT_OFFSET_BLK CALL GET_NEW_LOG_BLK MOV [ECX],EAX ADD ECX,4 MOV CV_OFFSET_PTR,EAX ADD EAX,PAGE_SIZE MOV CV_NEXT_OFFSET_BLK,ECX MOV CV_OFFSET_PTR_LIMIT,EAX RET SET_NEXT_OFFSET_BLOCK ENDP SET_NEXT_LINNUM_BLOCK PROC NEAR ; ; ; MOV ECX,CV_NEXT_LINNUM_BLK CALL GET_NEW_LOG_BLK MOV [ECX],EAX ADD ECX,4 MOV CV_LINNUM_PTR,EAX ADD EAX,PAGE_SIZE MOV CV_NEXT_LINNUM_BLK,ECX MOV CV_LINNUM_PTR_LIMIT,EAX RET SET_NEXT_LINNUM_BLOCK ENDP SET_INPUT_PTR PROC NEAR ; ; ; MOV ECX,OFF EXETABLE JMP SNIP_1 SET_INPUT_PTR ENDP SET_NEXT_INPUT_PTR PROC NEAR ; ; ; MOV ECX,CV_INPUT_BLK_PTR XOR EDX,EDX MOV EAX,[ECX] MOV [ECX],EDX ADD ECX,4 CALL RELEASE_BLOCK SNIP_1:: MOV EAX,[ECX] MOV CV_INPUT_BLK_PTR,ECX MOV ESI,EAX ADD EAX,PAGE_SIZE MOV CV_INPUT_PTR_LIMIT,EAX RET SET_NEXT_INPUT_PTR ENDP FLUSH_LIN_TEMP PROC NEAR ; ;CV_TEMP_RECORD MAY CONTAIN DATA, IF SO, FLUSH IT TO EXETABLE ; MOV ECX,EDI MOV EDI,OFF CV_TEMP_RECORD SUB ECX,EDI JZ L9$ MOV EDX,HIGH_WATER MOV EAX,EDI ADD HIGH_WATER,ECX JMP MOVE_LDATA_3 ;ES IS DGROUP ON RETURN L9$: RET FLUSH_LIN_TEMP ENDP FLUSH_PREV_SRCFILE PROC NEAR ; ;EDX IS SRC INDEX. FLUSH LINE #S FOR THAT FILE ; PUSHM EDI,ESI PUSH EBX MOV EBX,EDX CALL CV_DWORD_ALIGN MOV EAX,SIZE SRC_LIN_HELP CALL ALLOC_LOCAL CONVERT EBX,EBX,SRC_GARRAY ASSUME EBX:PTR SRC_STRUCT MOV EDX,[EBX]._SRC_NUMBER MOV ECX,CV_M_FIRST_SRC_NUMBER MOV ESI,CV_HELP_PTRS SUB EDX,ECX ASSUME ESI:PTR HLP_STRUCT MOV EDI,EAX ASSUME EDI:PTR SRC_LIN_HELP MOV ECX,[ESI+EDX*8]._HLP_LAST_LINHELP MOV [ESI+EDX*8]._HLP_LAST_LINHELP,EAX TEST ECX,ECX JZ L1$ MOV EDX,[EBX]._SRC_LINHELP_COUNT MOV [ECX],EDI INC EDX XOR EAX,EAX MOV [EBX]._SRC_LINHELP_COUNT,EDX JMP L19$ L1$: MOV EAX,1 MOV [ESI+EDX*8]._HLP_FIRST_LINHELP,EDI MOV [EBX]._SRC_LINHELP_COUNT,EAX DEC EAX L19$: MOV ECX,CV_FIRST_OFFSET MOV [EDI]._SLH_NEXT_HELP,EAX ;LINK TO NEXT MOV EAX,CV_LAST_OFFSET MOV [EDI]._SLH_FIRST_OFFSET,ECX MOV ECX,BYTES_SO_FAR MOV EDX,CV_BASEMOD SUB ECX,EDX MOV [EDI]._SLH_LAST_OFFSET,EAX MOV [EDI]._SLH_BASEMOD,ECX MOV EDI,OFF CV_TEMP_RECORD+4 ASSUME EDI:NOTHING ; ;OK, WRITE SEG_INDEX AND LINE_COUNT ; MOV EAX,CV_NEXT_LINNUM_BLK LEA EBX,CV_LINNUM_BLOCKS+4 SUB EAX,EBX MOV EBX,CV_LINNUM_PTR SHL EAX,PAGE_BITS-3 SUB EBX,CV_LINNUM_PTR_LIMIT ADD EBX,PAGE_SIZE SHR EBX,1 MOV ECX,CV_SEG_NUMBER SHL ECX,16 ADD EAX,EBX ;# OF LINE NUMBERS KEPT... PUSH EAX OR EAX,ECX ROR EAX,16 MOV [EDI-4],EAX CALL FLUSH_CV_TEMP POP EAX LEA ECX,CV_OFFSET_BLOCKS POP EBX PUSH EAX SHL EAX,2 ;4 BYTES PER OFFSET push ECX push EAX call _big_xdebug_write add ESP,8 POP EAX LEA ECX,CV_LINNUM_BLOCKS ADD EAX,EAX ;2 BYTES PER LINNUM push ECX push EAX call _big_xdebug_write add ESP,8 POPM ESI,EDI JMP CV_DWORD_ALIGN FLUSH_PREV_SRCFILE ENDP END
;######################################### ; project: "Print CF, ZF, OF, SF!" ## ; author: Krepak zorroxied Vitaliy ## ; FRTK 016 ## ; date: 17.02.2011 ## ; ## ;######################################### format PE entry main section '.idata' data import readable include "win32ax.inc" library msvcrt, 'MSVCRT.DLL' import msvcrt, \ printf, 'printf', \ puts, 'puts', \ getchar,'getchar',\ scanf, 'scanf', \ exit, 'exit' ;#########_DATA_SECTION_############################## section '.data' data readable writable ;##########_CONSTANTS_######## new_line = 0Ah bit_mask = 1b ;############ _hello db "Hello!", new_line, "The flags contain: ", 0 _cpy_flag db "0000", 0 _NULL db "0", 0 _TRUE db "1", 0 ;#########_DATA_SECTION_END_########################## ;################################### section '.text' code readable executable main: ;mov eax, 0FFFFFFFFh ;add eax, 4 call Print_Flags call [getchar] cinvoke exit, 0 ;################################### ;################################### ;################################### proc Print_Flags pushad pushfd pushfd pop eax push eax push eax push eax and eax, bit_mask ret endp ;############################## This is the function print # proc Print_Null pushad pushfd cinvoke printf, _NULL popfd popad ret endp ;################################### proc Print_True pushad pushfd cinvoke printf, _TRUE popfd popad ret endp
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/scdn/model/RefreshScdnObjectCachesRequest.h> using AlibabaCloud::Scdn::Model::RefreshScdnObjectCachesRequest; RefreshScdnObjectCachesRequest::RefreshScdnObjectCachesRequest() : RpcServiceRequest("scdn", "2017-11-15", "RefreshScdnObjectCaches") { setMethod(HttpRequest::Method::Post); } RefreshScdnObjectCachesRequest::~RefreshScdnObjectCachesRequest() {} std::string RefreshScdnObjectCachesRequest::getObjectPath()const { return objectPath_; } void RefreshScdnObjectCachesRequest::setObjectPath(const std::string& objectPath) { objectPath_ = objectPath; setParameter("ObjectPath", objectPath); } long RefreshScdnObjectCachesRequest::getOwnerId()const { return ownerId_; } void RefreshScdnObjectCachesRequest::setOwnerId(long ownerId) { ownerId_ = ownerId; setParameter("OwnerId", std::to_string(ownerId)); } std::string RefreshScdnObjectCachesRequest::getSecurityToken()const { return securityToken_; } void RefreshScdnObjectCachesRequest::setSecurityToken(const std::string& securityToken) { securityToken_ = securityToken; setParameter("SecurityToken", securityToken); } std::string RefreshScdnObjectCachesRequest::getObjectType()const { return objectType_; } void RefreshScdnObjectCachesRequest::setObjectType(const std::string& objectType) { objectType_ = objectType; setParameter("ObjectType", objectType); }
.size 8000 .text@100 jp lbegin .data@143 80 .text@150 lbegin: xor a, a ldff(24), a ldff(25), a ldff(26), a ld a, 80 ldff(26), a ld a, 3d ldff(16), a ld a, f0 ldff(17), a ld a, 00 ldff(18), a ld a, c7 ldff(19), a ld b, 05 ld c, 07 lwait: dec b jrnz lwait dec c jrnz lwait nop nop nop ldff a, (26) and a, 07 jp lprint .text@7000 lprint: push af ld b, 90 call lwaitly_b xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, 80 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles pop af ld(9800), a ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ldff a, (44) cmp a, b jrnz lwaitly_b ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10
; Routine to get HOTKEY key V2.01  1988 Tony Tebby QJUMP section hotkey xdef hot_gtky xref ut_gtnm1 include 'dev8_keys_err' ;+++ ; Get hotkey key into d7, and update name table pointer ; ; d1-d3 scratch ; d7 r (word) Hotkey ; a1/a2 scratch ; a3 cr name table pointer ;--- hot_gtky jsr ut_gtnm1 ; first string bne.s hgk_rts addq.l #8,a3 ; next one cmp.l a3,a5 ble.s hgk_ipar ; ... there is not one cmp.w #1,(a6,a1.l) ; one character only? bne.s hgk_ipar moveq #0,d7 move.b 2(a6,a1.l),d7 ; keep character tst.l d0 rts hgk_ipar moveq #err.ipar,d0 hgk_rts rts end
/* * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/block.hpp" #include "opto/cfgnode.hpp" #include "opto/chaitin.hpp" #include "opto/coalesce.hpp" #include "opto/connode.hpp" #include "opto/indexSet.hpp" #include "opto/machnode.hpp" #include "opto/matcher.hpp" #include "opto/regmask.hpp" //============================================================================= //------------------------------reset_uf_map----------------------------------- void PhaseChaitin::reset_uf_map( uint maxlrg ) { _maxlrg = maxlrg; // Force the Union-Find mapping to be at least this large _uf_map.extend(_maxlrg,0); // Initialize it to be the ID mapping. for( uint i=0; i<_maxlrg; i++ ) _uf_map.map(i,i); } //------------------------------compress_uf_map-------------------------------- // Make all Nodes map directly to their final live range; no need for // the Union-Find mapping after this call. void PhaseChaitin::compress_uf_map_for_nodes( ) { // For all Nodes, compress mapping uint unique = _names.Size(); for( uint i=0; i<unique; i++ ) { uint lrg = _names[i]; uint compressed_lrg = Find(lrg); if( lrg != compressed_lrg ) _names.map(i,compressed_lrg); } } //------------------------------Find------------------------------------------- // Straight out of Tarjan's union-find algorithm uint PhaseChaitin::Find_compress( uint lrg ) { uint cur = lrg; uint next = _uf_map[cur]; while( next != cur ) { // Scan chain of equivalences assert( next < cur, "always union smaller" ); cur = next; // until find a fixed-point next = _uf_map[cur]; } // Core of union-find algorithm: update chain of // equivalences to be equal to the root. while( lrg != next ) { uint tmp = _uf_map[lrg]; _uf_map.map(lrg, next); lrg = tmp; } return lrg; } //------------------------------Find------------------------------------------- // Straight out of Tarjan's union-find algorithm uint PhaseChaitin::Find_compress( const Node *n ) { uint lrg = Find_compress(_names[n->_idx]); _names.map(n->_idx,lrg); return lrg; } //------------------------------Find_const------------------------------------- // Like Find above, but no path compress, so bad asymptotic behavior uint PhaseChaitin::Find_const( uint lrg ) const { if( !lrg ) return lrg; // Ignore the zero LRG // Off the end? This happens during debugging dumps when you got // brand new live ranges but have not told the allocator yet. if( lrg >= _maxlrg ) return lrg; uint next = _uf_map[lrg]; while( next != lrg ) { // Scan chain of equivalences assert( next < lrg, "always union smaller" ); lrg = next; // until find a fixed-point next = _uf_map[lrg]; } return next; } //------------------------------Find------------------------------------------- // Like Find above, but no path compress, so bad asymptotic behavior uint PhaseChaitin::Find_const( const Node *n ) const { if( n->_idx >= _names.Size() ) return 0; // not mapped, usual for debug dump return Find_const( _names[n->_idx] ); } //------------------------------Union------------------------------------------ // union 2 sets together. void PhaseChaitin::Union( const Node *src_n, const Node *dst_n ) { uint src = Find(src_n); uint dst = Find(dst_n); assert( src, "" ); assert( dst, "" ); assert( src < _maxlrg, "oob" ); assert( dst < _maxlrg, "oob" ); assert( src < dst, "always union smaller" ); _uf_map.map(dst,src); } //------------------------------new_lrg---------------------------------------- void PhaseChaitin::new_lrg( const Node *x, uint lrg ) { // Make the Node->LRG mapping _names.extend(x->_idx,lrg); // Make the Union-Find mapping an identity function _uf_map.extend(lrg,lrg); } //------------------------------clone_projs------------------------------------ // After cloning some rematerialized instruction, clone any MachProj's that // follow it. Example: Intel zero is XOR, kills flags. Sparc FP constants // use G3 as an address temp. int PhaseChaitin::clone_projs( Block *b, uint idx, Node *con, Node *copy, uint &maxlrg ) { Block *bcon = _cfg._bbs[con->_idx]; uint cindex = bcon->find_node(con); Node *con_next = bcon->_nodes[cindex+1]; if( con_next->in(0) != con || !con_next->is_MachProj() ) return false; // No MachProj's follow // Copy kills after the cloned constant Node *kills = con_next->clone(); kills->set_req( 0, copy ); b->_nodes.insert( idx, kills ); _cfg._bbs.map( kills->_idx, b ); new_lrg( kills, maxlrg++ ); return true; } //------------------------------compact---------------------------------------- // Renumber the live ranges to compact them. Makes the IFG smaller. void PhaseChaitin::compact() { // Current the _uf_map contains a series of short chains which are headed // by a self-cycle. All the chains run from big numbers to little numbers. // The Find() call chases the chains & shortens them for the next Find call. // We are going to change this structure slightly. Numbers above a moving // wave 'i' are unchanged. Numbers below 'j' point directly to their // compacted live range with no further chaining. There are no chains or // cycles below 'i', so the Find call no longer works. uint j=1; uint i; for( i=1; i < _maxlrg; i++ ) { uint lr = _uf_map[i]; // Ignore unallocated live ranges if( !lr ) continue; assert( lr <= i, "" ); _uf_map.map(i, ( lr == i ) ? j++ : _uf_map[lr]); } if( false ) // PrintOptoCompactLiveRanges printf("Compacted %d LRs from %d\n",i-j,i); // Now change the Node->LR mapping to reflect the compacted names uint unique = _names.Size(); for( i=0; i<unique; i++ ) _names.map(i,_uf_map[_names[i]]); // Reset the Union-Find mapping reset_uf_map(j); } //============================================================================= //------------------------------Dump------------------------------------------- #ifndef PRODUCT void PhaseCoalesce::dump( Node *n ) const { // Being a const function means I cannot use 'Find' uint r = _phc.Find(n); tty->print("L%d/N%d ",r,n->_idx); } //------------------------------dump------------------------------------------- void PhaseCoalesce::dump() const { // I know I have a block layout now, so I can print blocks in a loop for( uint i=0; i<_phc._cfg._num_blocks; i++ ) { uint j; Block *b = _phc._cfg._blocks[i]; // Print a nice block header tty->print("B%d: ",b->_pre_order); for( j=1; j<b->num_preds(); j++ ) tty->print("B%d ", _phc._cfg._bbs[b->pred(j)->_idx]->_pre_order); tty->print("-> "); for( j=0; j<b->_num_succs; j++ ) tty->print("B%d ",b->_succs[j]->_pre_order); tty->print(" IDom: B%d/#%d\n", b->_idom ? b->_idom->_pre_order : 0, b->_dom_depth); uint cnt = b->_nodes.size(); for( j=0; j<cnt; j++ ) { Node *n = b->_nodes[j]; dump( n ); tty->print("\t%s\t",n->Name()); // Dump the inputs uint k; // Exit value of loop for( k=0; k<n->req(); k++ ) // For all required inputs if( n->in(k) ) dump( n->in(k) ); else tty->print("_ "); int any_prec = 0; for( ; k<n->len(); k++ ) // For all precedence inputs if( n->in(k) ) { if( !any_prec++ ) tty->print(" |"); dump( n->in(k) ); } // Dump node-specific info n->dump_spec(tty); tty->print("\n"); } tty->print("\n"); } } #endif //------------------------------combine_these_two------------------------------ // Combine the live ranges def'd by these 2 Nodes. N2 is an input to N1. void PhaseCoalesce::combine_these_two( Node *n1, Node *n2 ) { uint lr1 = _phc.Find(n1); uint lr2 = _phc.Find(n2); if( lr1 != lr2 && // Different live ranges already AND !_phc._ifg->test_edge_sq( lr1, lr2 ) ) { // Do not interfere LRG *lrg1 = &_phc.lrgs(lr1); LRG *lrg2 = &_phc.lrgs(lr2); // Not an oop->int cast; oop->oop, int->int, AND int->oop are OK. // Now, why is int->oop OK? We end up declaring a raw-pointer as an oop // and in general that's a bad thing. However, int->oop conversions only // happen at GC points, so the lifetime of the misclassified raw-pointer // is from the CheckCastPP (that converts it to an oop) backwards up // through a merge point and into the slow-path call, and around the // diamond up to the heap-top check and back down into the slow-path call. // The misclassified raw pointer is NOT live across the slow-path call, // and so does not appear in any GC info, so the fact that it is // misclassified is OK. if( (lrg1->_is_oop || !lrg2->_is_oop) && // not an oop->int cast AND // Compatible final mask lrg1->mask().overlap( lrg2->mask() ) ) { // Merge larger into smaller. if( lr1 > lr2 ) { uint tmp = lr1; lr1 = lr2; lr2 = tmp; Node *n = n1; n1 = n2; n2 = n; LRG *ltmp = lrg1; lrg1 = lrg2; lrg2 = ltmp; } // Union lr2 into lr1 _phc.Union( n1, n2 ); if (lrg1->_maxfreq < lrg2->_maxfreq) lrg1->_maxfreq = lrg2->_maxfreq; // Merge in the IFG _phc._ifg->Union( lr1, lr2 ); // Combine register restrictions lrg1->AND(lrg2->mask()); } } } //------------------------------coalesce_driver-------------------------------- // Copy coalescing void PhaseCoalesce::coalesce_driver( ) { verify(); // Coalesce from high frequency to low for( uint i=0; i<_phc._cfg._num_blocks; i++ ) coalesce( _phc._blks[i] ); } //------------------------------insert_copy_with_overlap----------------------- // I am inserting copies to come out of SSA form. In the general case, I am // doing a parallel renaming. I'm in the Named world now, so I can't do a // general parallel renaming. All the copies now use "names" (live-ranges) // to carry values instead of the explicit use-def chains. Suppose I need to // insert 2 copies into the same block. They copy L161->L128 and L128->L132. // If I insert them in the wrong order then L128 will get clobbered before it // can get used by the second copy. This cannot happen in the SSA model; // direct use-def chains get me the right value. It DOES happen in the named // model so I have to handle the reordering of copies. // // In general, I need to topo-sort the placed copies to avoid conflicts. // Its possible to have a closed cycle of copies (e.g., recirculating the same // values around a loop). In this case I need a temp to break the cycle. void PhaseAggressiveCoalesce::insert_copy_with_overlap( Block *b, Node *copy, uint dst_name, uint src_name ) { // Scan backwards for the locations of the last use of the dst_name. // I am about to clobber the dst_name, so the copy must be inserted // after the last use. Last use is really first-use on a backwards scan. uint i = b->end_idx()-1; while( 1 ) { Node *n = b->_nodes[i]; // Check for end of virtual copies; this is also the end of the // parallel renaming effort. if( n->_idx < _unique ) break; uint idx = n->is_Copy(); assert( idx || n->is_Con() || n->is_MachProj(), "Only copies during parallel renaming" ); if( idx && _phc.Find(n->in(idx)) == dst_name ) break; i--; } uint last_use_idx = i; // Also search for any kill of src_name that exits the block. // Since the copy uses src_name, I have to come before any kill. uint kill_src_idx = b->end_idx(); // There can be only 1 kill that exits any block and that is // the last kill. Thus it is the first kill on a backwards scan. i = b->end_idx()-1; while( 1 ) { Node *n = b->_nodes[i]; // Check for end of virtual copies; this is also the end of the // parallel renaming effort. if( n->_idx < _unique ) break; assert( n->is_Copy() || n->is_Con() || n->is_MachProj(), "Only copies during parallel renaming" ); if( _phc.Find(n) == src_name ) { kill_src_idx = i; break; } i--; } // Need a temp? Last use of dst comes after the kill of src? if( last_use_idx >= kill_src_idx ) { // Need to break a cycle with a temp uint idx = copy->is_Copy(); Node *tmp = copy->clone(); _phc.new_lrg(tmp,_phc._maxlrg++); // Insert new temp between copy and source tmp ->set_req(idx,copy->in(idx)); copy->set_req(idx,tmp); // Save source in temp early, before source is killed b->_nodes.insert(kill_src_idx,tmp); _phc._cfg._bbs.map( tmp->_idx, b ); last_use_idx++; } // Insert just after last use b->_nodes.insert(last_use_idx+1,copy); } //------------------------------insert_copies---------------------------------- void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { // We do LRGs compressing and fix a liveout data only here since the other // place in Split() is guarded by the assert which we never hit. _phc.compress_uf_map_for_nodes(); // Fix block's liveout data for compressed live ranges. for(uint lrg = 1; lrg < _phc._maxlrg; lrg++ ) { uint compressed_lrg = _phc.Find(lrg); if( lrg != compressed_lrg ) { for( uint bidx = 0; bidx < _phc._cfg._num_blocks; bidx++ ) { IndexSet *liveout = _phc._live->live(_phc._cfg._blocks[bidx]); if( liveout->member(lrg) ) { liveout->remove(lrg); liveout->insert(compressed_lrg); } } } } // All new nodes added are actual copies to replace virtual copies. // Nodes with index less than '_unique' are original, non-virtual Nodes. _unique = C->unique(); for( uint i=0; i<_phc._cfg._num_blocks; i++ ) { Block *b = _phc._cfg._blocks[i]; uint cnt = b->num_preds(); // Number of inputs to the Phi for( uint l = 1; l<b->_nodes.size(); l++ ) { Node *n = b->_nodes[l]; // Do not use removed-copies, use copied value instead uint ncnt = n->req(); for( uint k = 1; k<ncnt; k++ ) { Node *copy = n->in(k); uint cidx = copy->is_Copy(); if( cidx ) { Node *def = copy->in(cidx); if( _phc.Find(copy) == _phc.Find(def) ) n->set_req(k,def); } } // Remove any explicit copies that get coalesced. uint cidx = n->is_Copy(); if( cidx ) { Node *def = n->in(cidx); if( _phc.Find(n) == _phc.Find(def) ) { n->replace_by(def); n->set_req(cidx,NULL); b->_nodes.remove(l); l--; continue; } } if( n->is_Phi() ) { // Get the chosen name for the Phi uint phi_name = _phc.Find( n ); // Ignore the pre-allocated specials if( !phi_name ) continue; // Check for mismatch inputs to Phi for( uint j = 1; j<cnt; j++ ) { Node *m = n->in(j); uint src_name = _phc.Find(m); if( src_name != phi_name ) { Block *pred = _phc._cfg._bbs[b->pred(j)->_idx]; Node *copy; assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); // Rematerialize constants instead of copying them if( m->is_Mach() && m->as_Mach()->is_Con() && m->as_Mach()->rematerialize() ) { copy = m->clone(); // Insert the copy in the predecessor basic block pred->add_inst(copy); // Copy any flags as well _phc.clone_projs( pred, pred->end_idx(), m, copy, _phc._maxlrg ); } else { const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; copy = new (C) MachSpillCopyNode(m,*rm,*rm); // Find a good place to insert. Kinda tricky, use a subroutine insert_copy_with_overlap(pred,copy,phi_name,src_name); } // Insert the copy in the use-def chain n->set_req( j, copy ); _phc._cfg._bbs.map( copy->_idx, pred ); // Extend ("register allocate") the names array for the copy. _phc._names.extend( copy->_idx, phi_name ); } // End of if Phi names do not match } // End of for all inputs to Phi } else { // End of if Phi // Now check for 2-address instructions uint idx; if( n->is_Mach() && (idx=n->as_Mach()->two_adr()) ) { // Get the chosen name for the Node uint name = _phc.Find( n ); assert( name, "no 2-address specials" ); // Check for name mis-match on the 2-address input Node *m = n->in(idx); if( _phc.Find(m) != name ) { Node *copy; assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach"); // At this point it is unsafe to extend live ranges (6550579). // Rematerialize only constants as we do for Phi above. if( m->is_Mach() && m->as_Mach()->is_Con() && m->as_Mach()->rematerialize() ) { copy = m->clone(); // Insert the copy in the basic block, just before us b->_nodes.insert( l++, copy ); if( _phc.clone_projs( b, l, m, copy, _phc._maxlrg ) ) l++; } else { const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; copy = new (C) MachSpillCopyNode( m, *rm, *rm ); // Insert the copy in the basic block, just before us b->_nodes.insert( l++, copy ); } // Insert the copy in the use-def chain n->set_req(idx, copy ); // Extend ("register allocate") the names array for the copy. _phc._names.extend( copy->_idx, name ); _phc._cfg._bbs.map( copy->_idx, b ); } } // End of is two-adr // Insert a copy at a debug use for a lrg which has high frequency if( b->_freq < OPTO_DEBUG_SPLIT_FREQ || b->is_uncommon(_phc._cfg._bbs) ) { // Walk the debug inputs to the node and check for lrg freq JVMState* jvms = n->jvms(); uint debug_start = jvms ? jvms->debug_start() : 999999; uint debug_end = jvms ? jvms->debug_end() : 999999; for(uint inpidx = debug_start; inpidx < debug_end; inpidx++) { // Do not split monitors; they are only needed for debug table // entries and need no code. if( jvms->is_monitor_use(inpidx) ) continue; Node *inp = n->in(inpidx); uint nidx = _phc.n2lidx(inp); LRG &lrg = lrgs(nidx); // If this lrg has a high frequency use/def if( lrg._maxfreq >= _phc.high_frequency_lrg() ) { // If the live range is also live out of this block (like it // would be for a fast/slow idiom), the normal spill mechanism // does an excellent job. If it is not live out of this block // (like it would be for debug info to uncommon trap) splitting // the live range now allows a better allocation in the high // frequency blocks. // Build_IFG_virtual has converted the live sets to // live-IN info, not live-OUT info. uint k; for( k=0; k < b->_num_succs; k++ ) if( _phc._live->live(b->_succs[k])->member( nidx ) ) break; // Live in to some successor block? if( k < b->_num_succs ) continue; // Live out; do not pre-split // Split the lrg at this use const RegMask *rm = C->matcher()->idealreg2spillmask[inp->ideal_reg()]; Node *copy = new (C) MachSpillCopyNode( inp, *rm, *rm ); // Insert the copy in the use-def chain n->set_req(inpidx, copy ); // Insert the copy in the basic block, just before us b->_nodes.insert( l++, copy ); // Extend ("register allocate") the names array for the copy. _phc.new_lrg( copy, _phc._maxlrg++ ); _phc._cfg._bbs.map( copy->_idx, b ); //tty->print_cr("Split a debug use in Aggressive Coalesce"); } // End of if high frequency use/def } // End of for all debug inputs } // End of if low frequency safepoint } // End of if Phi } // End of for all instructions } // End of for all blocks } //============================================================================= //------------------------------coalesce--------------------------------------- // Aggressive (but pessimistic) copy coalescing of a single block // The following coalesce pass represents a single round of aggressive // pessimistic coalesce. "Aggressive" means no attempt to preserve // colorability when coalescing. This occasionally means more spills, but // it also means fewer rounds of coalescing for better code - and that means // faster compiles. // "Pessimistic" means we do not hit the fixed point in one pass (and we are // reaching for the least fixed point to boot). This is typically solved // with a few more rounds of coalescing, but the compiler must run fast. We // could optimistically coalescing everything touching PhiNodes together // into one big live range, then check for self-interference. Everywhere // the live range interferes with self it would have to be split. Finding // the right split points can be done with some heuristics (based on // expected frequency of edges in the live range). In short, it's a real // research problem and the timeline is too short to allow such research. // Further thoughts: (1) build the LR in a pass, (2) find self-interference // in another pass, (3) per each self-conflict, split, (4) split by finding // the low-cost cut (min-cut) of the LR, (5) edges in the LR are weighted // according to the GCM algorithm (or just exec freq on CFG edges). void PhaseAggressiveCoalesce::coalesce( Block *b ) { // Copies are still "virtual" - meaning we have not made them explicitly // copies. Instead, Phi functions of successor blocks have mis-matched // live-ranges. If I fail to coalesce, I'll have to insert a copy to line // up the live-ranges. Check for Phis in successor blocks. uint i; for( i=0; i<b->_num_succs; i++ ) { Block *bs = b->_succs[i]; // Find index of 'b' in 'bs' predecessors uint j=1; while( _phc._cfg._bbs[bs->pred(j)->_idx] != b ) j++; // Visit all the Phis in successor block for( uint k = 1; k<bs->_nodes.size(); k++ ) { Node *n = bs->_nodes[k]; if( !n->is_Phi() ) break; combine_these_two( n, n->in(j) ); } } // End of for all successor blocks // Check _this_ block for 2-address instructions and copies. uint cnt = b->end_idx(); for( i = 1; i<cnt; i++ ) { Node *n = b->_nodes[i]; uint idx; // 2-address instructions have a virtual Copy matching their input // to their output if( n->is_Mach() && (idx = n->as_Mach()->two_adr()) ) { MachNode *mach = n->as_Mach(); combine_these_two( mach, mach->in(idx) ); } } // End of for all instructions in block } //============================================================================= //------------------------------PhaseConservativeCoalesce---------------------- PhaseConservativeCoalesce::PhaseConservativeCoalesce( PhaseChaitin &chaitin ) : PhaseCoalesce(chaitin) { _ulr.initialize(_phc._maxlrg); } //------------------------------verify----------------------------------------- void PhaseConservativeCoalesce::verify() { #ifdef ASSERT _phc.set_was_low(); #endif } //------------------------------union_helper----------------------------------- void PhaseConservativeCoalesce::union_helper( Node *lr1_node, Node *lr2_node, uint lr1, uint lr2, Node *src_def, Node *dst_copy, Node *src_copy, Block *b, uint bindex ) { // Join live ranges. Merge larger into smaller. Union lr2 into lr1 in the // union-find tree _phc.Union( lr1_node, lr2_node ); // Single-def live range ONLY if both live ranges are single-def. // If both are single def, then src_def powers one live range // and def_copy powers the other. After merging, src_def powers // the combined live range. lrgs(lr1)._def = (lrgs(lr1).is_multidef() || lrgs(lr2).is_multidef() ) ? NodeSentinel : src_def; lrgs(lr2)._def = NULL; // No def for lrg 2 lrgs(lr2).Clear(); // Force empty mask for LRG 2 //lrgs(lr2)._size = 0; // Live-range 2 goes dead lrgs(lr1)._is_oop |= lrgs(lr2)._is_oop; lrgs(lr2)._is_oop = 0; // In particular, not an oop for GC info if (lrgs(lr1)._maxfreq < lrgs(lr2)._maxfreq) lrgs(lr1)._maxfreq = lrgs(lr2)._maxfreq; // Copy original value instead. Intermediate copies go dead, and // the dst_copy becomes useless. int didx = dst_copy->is_Copy(); dst_copy->set_req( didx, src_def ); // Add copy to free list // _phc.free_spillcopy(b->_nodes[bindex]); assert( b->_nodes[bindex] == dst_copy, "" ); dst_copy->replace_by( dst_copy->in(didx) ); dst_copy->set_req( didx, NULL); b->_nodes.remove(bindex); if( bindex < b->_ihrp_index ) b->_ihrp_index--; if( bindex < b->_fhrp_index ) b->_fhrp_index--; // Stretched lr1; add it to liveness of intermediate blocks Block *b2 = _phc._cfg._bbs[src_copy->_idx]; while( b != b2 ) { b = _phc._cfg._bbs[b->pred(1)->_idx]; _phc._live->live(b)->insert(lr1); } } //------------------------------compute_separating_interferences--------------- // Factored code from copy_copy that computes extra interferences from // lengthening a live range by double-coalescing. uint PhaseConservativeCoalesce::compute_separating_interferences(Node *dst_copy, Node *src_copy, Block *b, uint bindex, RegMask &rm, uint reg_degree, uint rm_size, uint lr1, uint lr2 ) { assert(!lrgs(lr1)._fat_proj, "cannot coalesce fat_proj"); assert(!lrgs(lr2)._fat_proj, "cannot coalesce fat_proj"); Node *prev_copy = dst_copy->in(dst_copy->is_Copy()); Block *b2 = b; uint bindex2 = bindex; while( 1 ) { // Find previous instruction bindex2--; // Chain backwards 1 instruction while( bindex2 == 0 ) { // At block start, find prior block assert( b2->num_preds() == 2, "cannot double coalesce across c-flow" ); b2 = _phc._cfg._bbs[b2->pred(1)->_idx]; bindex2 = b2->end_idx()-1; } // Get prior instruction assert(bindex2 < b2->_nodes.size(), "index out of bounds"); Node *x = b2->_nodes[bindex2]; if( x == prev_copy ) { // Previous copy in copy chain? if( prev_copy == src_copy)// Found end of chain and all interferences break; // So break out of loop // Else work back one in copy chain prev_copy = prev_copy->in(prev_copy->is_Copy()); } else { // Else collect interferences uint lidx = _phc.Find(x); // Found another def of live-range being stretched? if( lidx == lr1 ) return max_juint; if( lidx == lr2 ) return max_juint; // If we attempt to coalesce across a bound def if( lrgs(lidx).is_bound() ) { // Do not let the coalesced LRG expect to get the bound color rm.SUBTRACT( lrgs(lidx).mask() ); // Recompute rm_size rm_size = rm.Size(); //if( rm._flags ) rm_size += 1000000; if( reg_degree >= rm_size ) return max_juint; } if( rm.overlap(lrgs(lidx).mask()) ) { // Insert lidx into union LRG; returns TRUE if actually inserted if( _ulr.insert(lidx) ) { // Infinite-stack neighbors do not alter colorability, as they // can always color to some other color. if( !lrgs(lidx).mask().is_AllStack() ) { // If this coalesce will make any new neighbor uncolorable, // do not coalesce. if( lrgs(lidx).just_lo_degree() ) return max_juint; // Bump our degree if( ++reg_degree >= rm_size ) return max_juint; } // End of if not infinite-stack neighbor } // End of if actually inserted } // End of if live range overlaps } // End of else collect interferences for 1 node } // End of while forever, scan back for interferences return reg_degree; } //------------------------------update_ifg------------------------------------- void PhaseConservativeCoalesce::update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2) { // Some original neighbors of lr1 might have gone away // because the constrained register mask prevented them. // Remove lr1 from such neighbors. IndexSetIterator one(n_lr1); uint neighbor; LRG &lrg1 = lrgs(lr1); while ((neighbor = one.next()) != 0) if( !_ulr.member(neighbor) ) if( _phc._ifg->neighbors(neighbor)->remove(lr1) ) lrgs(neighbor).inc_degree( -lrg1.compute_degree(lrgs(neighbor)) ); // lr2 is now called (coalesced into) lr1. // Remove lr2 from the IFG. IndexSetIterator two(n_lr2); LRG &lrg2 = lrgs(lr2); while ((neighbor = two.next()) != 0) if( _phc._ifg->neighbors(neighbor)->remove(lr2) ) lrgs(neighbor).inc_degree( -lrg2.compute_degree(lrgs(neighbor)) ); // Some neighbors of intermediate copies now interfere with the // combined live range. IndexSetIterator three(&_ulr); while ((neighbor = three.next()) != 0) if( _phc._ifg->neighbors(neighbor)->insert(lr1) ) lrgs(neighbor).inc_degree( lrg1.compute_degree(lrgs(neighbor)) ); } //------------------------------record_bias------------------------------------ static void record_bias( const PhaseIFG *ifg, int lr1, int lr2 ) { // Tag copy bias here if( !ifg->lrgs(lr1)._copy_bias ) ifg->lrgs(lr1)._copy_bias = lr2; if( !ifg->lrgs(lr2)._copy_bias ) ifg->lrgs(lr2)._copy_bias = lr1; } //------------------------------copy_copy-------------------------------------- // See if I can coalesce a series of multiple copies together. I need the // final dest copy and the original src copy. They can be the same Node. // Compute the compatible register masks. bool PhaseConservativeCoalesce::copy_copy( Node *dst_copy, Node *src_copy, Block *b, uint bindex ) { if( !dst_copy->is_SpillCopy() ) return false; if( !src_copy->is_SpillCopy() ) return false; Node *src_def = src_copy->in(src_copy->is_Copy()); uint lr1 = _phc.Find(dst_copy); uint lr2 = _phc.Find(src_def ); // Same live ranges already? if( lr1 == lr2 ) return false; // Interfere? if( _phc._ifg->test_edge_sq( lr1, lr2 ) ) return false; // Not an oop->int cast; oop->oop, int->int, AND int->oop are OK. if( !lrgs(lr1)._is_oop && lrgs(lr2)._is_oop ) // not an oop->int cast return false; // Coalescing between an aligned live range and a mis-aligned live range? // No, no! Alignment changes how we count degree. if( lrgs(lr1)._fat_proj != lrgs(lr2)._fat_proj ) return false; // Sort; use smaller live-range number Node *lr1_node = dst_copy; Node *lr2_node = src_def; if( lr1 > lr2 ) { uint tmp = lr1; lr1 = lr2; lr2 = tmp; lr1_node = src_def; lr2_node = dst_copy; } // Check for compatibility of the 2 live ranges by // intersecting their allowed register sets. RegMask rm = lrgs(lr1).mask(); rm.AND(lrgs(lr2).mask()); // Number of bits free uint rm_size = rm.Size(); if (UseFPUForSpilling && rm.is_AllStack() ) { // Don't coalesce when frequency difference is large Block *dst_b = _phc._cfg._bbs[dst_copy->_idx]; Block *src_def_b = _phc._cfg._bbs[src_def->_idx]; if (src_def_b->_freq > 10*dst_b->_freq ) return false; } // If we can use any stack slot, then effective size is infinite if( rm.is_AllStack() ) rm_size += 1000000; // Incompatible masks, no way to coalesce if( rm_size == 0 ) return false; // Another early bail-out test is when we are double-coalescing and the // 2 copies are separated by some control flow. if( dst_copy != src_copy ) { Block *src_b = _phc._cfg._bbs[src_copy->_idx]; Block *b2 = b; while( b2 != src_b ) { if( b2->num_preds() > 2 ){// Found merge-point _phc._lost_opp_cflow_coalesce++; // extra record_bias commented out because Chris believes it is not // productive. Since we can record only 1 bias, we want to choose one // that stands a chance of working and this one probably does not. //record_bias( _phc._lrgs, lr1, lr2 ); return false; // To hard to find all interferences } b2 = _phc._cfg._bbs[b2->pred(1)->_idx]; } } // Union the two interference sets together into '_ulr' uint reg_degree = _ulr.lrg_union( lr1, lr2, rm_size, _phc._ifg, rm ); if( reg_degree >= rm_size ) { record_bias( _phc._ifg, lr1, lr2 ); return false; } // Now I need to compute all the interferences between dst_copy and // src_copy. I'm not willing visit the entire interference graph, so // I limit my search to things in dst_copy's block or in a straight // line of previous blocks. I give up at merge points or when I get // more interferences than my degree. I can stop when I find src_copy. if( dst_copy != src_copy ) { reg_degree = compute_separating_interferences(dst_copy, src_copy, b, bindex, rm, rm_size, reg_degree, lr1, lr2 ); if( reg_degree == max_juint ) { record_bias( _phc._ifg, lr1, lr2 ); return false; } } // End of if dst_copy & src_copy are different // ---- THE COMBINED LRG IS COLORABLE ---- // YEAH - Now coalesce this copy away assert( lrgs(lr1).num_regs() == lrgs(lr2).num_regs(), "" ); IndexSet *n_lr1 = _phc._ifg->neighbors(lr1); IndexSet *n_lr2 = _phc._ifg->neighbors(lr2); // Update the interference graph update_ifg(lr1, lr2, n_lr1, n_lr2); _ulr.remove(lr1); // Uncomment the following code to trace Coalescing in great detail. // //if (false) { // tty->cr(); // tty->print_cr("#######################################"); // tty->print_cr("union %d and %d", lr1, lr2); // n_lr1->dump(); // n_lr2->dump(); // tty->print_cr("resulting set is"); // _ulr.dump(); //} // Replace n_lr1 with the new combined live range. _ulr will use // n_lr1's old memory on the next iteration. n_lr2 is cleared to // send its internal memory to the free list. _ulr.swap(n_lr1); _ulr.clear(); n_lr2->clear(); lrgs(lr1).set_degree( _phc._ifg->effective_degree(lr1) ); lrgs(lr2).set_degree( 0 ); // Join live ranges. Merge larger into smaller. Union lr2 into lr1 in the // union-find tree union_helper( lr1_node, lr2_node, lr1, lr2, src_def, dst_copy, src_copy, b, bindex ); // Combine register restrictions lrgs(lr1).set_mask(rm); lrgs(lr1).compute_set_mask_size(); lrgs(lr1)._cost += lrgs(lr2)._cost; lrgs(lr1)._area += lrgs(lr2)._area; // While its uncommon to successfully coalesce live ranges that started out // being not-lo-degree, it can happen. In any case the combined coalesced // live range better Simplify nicely. lrgs(lr1)._was_lo = 1; // kinda expensive to do all the time //tty->print_cr("warning: slow verify happening"); //_phc._ifg->verify( &_phc ); return true; } //------------------------------coalesce--------------------------------------- // Conservative (but pessimistic) copy coalescing of a single block void PhaseConservativeCoalesce::coalesce( Block *b ) { // Bail out on infrequent blocks if( b->is_uncommon(_phc._cfg._bbs) ) return; // Check this block for copies. for( uint i = 1; i<b->end_idx(); i++ ) { // Check for actual copies on inputs. Coalesce a copy into its // input if use and copy's input are compatible. Node *copy1 = b->_nodes[i]; uint idx1 = copy1->is_Copy(); if( !idx1 ) continue; // Not a copy if( copy_copy(copy1,copy1,b,i) ) { i--; // Retry, same location in block PhaseChaitin::_conserv_coalesce++; // Collect stats on success continue; } /* do not attempt pairs. About 1/2 of all pairs can be removed by post-alloc. The other set are too few to bother. Node *copy2 = copy1->in(idx1); uint idx2 = copy2->is_Copy(); if( !idx2 ) continue; if( copy_copy(copy1,copy2,b,i) ) { i--; // Retry, same location in block PhaseChaitin::_conserv_coalesce_pair++; // Collect stats on success continue; } */ } }
/*========================================================================= Program: Visualization Toolkit Module: vtkPythonInterpreter.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkPythonInterpreter.h" #include "vtkPython.h" // this must be the first include. #include "vtkBuild.h" #include "vtkCommand.h" #include "vtkLogger.h" #include "vtkNew.h" #include "vtkObjectFactory.h" #include "vtkOutputWindow.h" #include "vtkPythonStdStreamCaptureHelper.h" #include "vtkResourceFileLocator.h" #include "vtkVersion.h" #include "vtkWeakPointer.h" #include <vtksys/SystemInformation.hxx> #include <vtksys/SystemTools.hxx> #include <algorithm> #include <csignal> #include <sstream> #include <string> #include <vector> #if PY_VERSION_HEX >= 0x03000000 #if defined(__APPLE__) && PY_VERSION_HEX < 0x03050000 extern "C" { extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char* s, Py_ssize_t size); } #endif #endif #if defined(_WIN32) && !defined(__CYGWIN__) #define VTK_PATH_SEPARATOR "\\" #else #define VTK_PATH_SEPARATOR "/" #endif #define VTKPY_DEBUG_MESSAGE(x) \ vtkVLog(vtkLogger::ConvertToVerbosity(vtkPythonInterpreter::GetLogVerbosity()), x) #define VTKPY_DEBUG_MESSAGE_VV(x) \ vtkVLog(vtkLogger::ConvertToVerbosity(vtkPythonInterpreter::GetLogVerbosity() + 1), x) #if defined(_WIN32) && !defined(__CYGWIN__) && defined(VTK_BUILD_SHARED_LIBS) && \ PY_VERSION_HEX >= 0x03080000 #define vtkPythonInterpreter_USE_DIRECTORY_COOKIE #endif namespace { template <class T> void strFree(T* foo) { delete[] foo; } template <class T> class PoolT { std::vector<T*> Strings; public: ~PoolT() { for (T* astring : this->Strings) { strFree(astring); } } T* push_back(T* val) { this->Strings.push_back(val); return val; } }; using StringPool = PoolT<char>; #if PY_VERSION_HEX >= 0x03000000 template <> void strFree(wchar_t* foo) { #if PY_VERSION_HEX >= 0x03050000 PyMem_RawFree(foo); #else PyMem_Free(foo); #endif } using WCharStringPool = PoolT<wchar_t>; #endif #if PY_VERSION_HEX >= 0x03000000 wchar_t* vtk_Py_DecodeLocale(const char* arg, size_t* size) { (void)size; #if PY_VERSION_HEX >= 0x03050000 return Py_DecodeLocale(arg, size); #elif defined(__APPLE__) return _Py_DecodeUTF8_surrogateescape(arg, strlen(arg)); #else return _Py_char2wchar(arg, size); #endif } #endif #if PY_VERSION_HEX >= 0x03000000 char* vtk_Py_EncodeLocale(const wchar_t* arg, size_t* size) { (void)size; #if PY_VERSION_HEX >= 0x03050000 return Py_EncodeLocale(arg, size); #else return _Py_wchar2char(arg, size); #endif } #endif std::vector<vtkWeakPointer<vtkPythonInterpreter>>* GlobalInterpreters; std::vector<std::string> PythonPaths; void NotifyInterpreters(unsigned long eventid, void* calldata = nullptr) { std::vector<vtkWeakPointer<vtkPythonInterpreter>>::iterator iter; for (iter = GlobalInterpreters->begin(); iter != GlobalInterpreters->end(); ++iter) { if (iter->GetPointer()) { iter->GetPointer()->InvokeEvent(eventid, calldata); } } } inline void vtkPrependPythonPath(const char* pathtoadd) { VTKPY_DEBUG_MESSAGE("adding module search path " << pathtoadd); vtkPythonScopeGilEnsurer gilEnsurer; PyObject* path = PySys_GetObject(const_cast<char*>("path")); #if PY_VERSION_HEX >= 0x03000000 PyObject* newpath = PyUnicode_FromString(pathtoadd); #else PyObject* newpath = PyString_FromString(pathtoadd); #endif // avoid adding duplicate paths. if (PySequence_Contains(path, newpath) == 0) { PyList_Insert(path, 0, newpath); } Py_DECREF(newpath); } } // Schwarz counter idiom for GlobalInterpreters object static unsigned int vtkPythonInterpretersCounter; vtkPythonGlobalInterpreters::vtkPythonGlobalInterpreters() { if (vtkPythonInterpretersCounter++ == 0) { GlobalInterpreters = new std::vector<vtkWeakPointer<vtkPythonInterpreter>>(); }; } vtkPythonGlobalInterpreters::~vtkPythonGlobalInterpreters() { if (--vtkPythonInterpretersCounter == 0) { delete GlobalInterpreters; GlobalInterpreters = nullptr; } } bool vtkPythonInterpreter::InitializedOnce = false; bool vtkPythonInterpreter::CaptureStdin = false; bool vtkPythonInterpreter::RedirectOutput = true; bool vtkPythonInterpreter::ConsoleBuffering = false; std::string vtkPythonInterpreter::StdErrBuffer; std::string vtkPythonInterpreter::StdOutBuffer; int vtkPythonInterpreter::LogVerbosity = vtkLogger::VERBOSITY_TRACE; vtkStandardNewMacro(vtkPythonInterpreter); //------------------------------------------------------------------------------ vtkPythonInterpreter::vtkPythonInterpreter() { GlobalInterpreters->push_back(this); } //------------------------------------------------------------------------------ vtkPythonInterpreter::~vtkPythonInterpreter() { // We need to check that GlobalInterpreters has not been deleted yet. It can be // deleted prior to a call to this destructor if another static object with a // reference to a vtkPythonInterpreter object deletes that object after // GlobalInterpreters has been destructed. It all depends on the destruction order // of the other static object and GlobalInterpreters. if (!GlobalInterpreters) { return; } std::vector<vtkWeakPointer<vtkPythonInterpreter>>::iterator iter; for (iter = GlobalInterpreters->begin(); iter != GlobalInterpreters->end(); ++iter) { if (*iter == this) { GlobalInterpreters->erase(iter); break; } } } //------------------------------------------------------------------------------ bool vtkPythonInterpreter::IsInitialized() { return (Py_IsInitialized() != 0); } //------------------------------------------------------------------------------ void vtkPythonInterpreter::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); } //------------------------------------------------------------------------------ bool vtkPythonInterpreter::Initialize(int initsigs /*=0*/) { if (Py_IsInitialized() == 0) { // guide the mechanism to locate Python standard library, if possible. vtkPythonInterpreter::SetupPythonPrefix(); Py_InitializeEx(initsigs); // setup default argv. Without this, code snippets that check `sys.argv` may // fail when run in embedded VTK Python environment. PySys_SetArgvEx(0, nullptr, 0); #ifdef VTK_PYTHON_FULL_THREADSAFE #if PY_VERSION_HEX < 0x03090000 // In Python 3.9 and higher, PyEval_ThreadsInitialized() and // PyEval_InitThreads() are deprecated and do nothing. // GIL initialization is handled by Py_InitializeEx(). int threadInit = PyEval_ThreadsInitialized(); if (!threadInit) { PyEval_InitThreads(); // initialize and acquire GIL } #endif // Always release GIL, as it has been acquired either by PyEval_InitThreads // prior to Python 3.7 or by Py_InitializeEx in Python 3.7 and after PyEval_SaveThread(); #endif #ifdef SIGINT // Put default SIGINT handler back after Py_Initialize/Py_InitializeEx. signal(SIGINT, SIG_DFL); #endif } if (!vtkPythonInterpreter::InitializedOnce) { vtkPythonInterpreter::InitializedOnce = true; // HACK: Calling PyRun_SimpleString for the first time for some reason results in // a "\n" message being generated which is causing the error dialog to // popup. So we flush that message out of the system before setting up the // callbacks. vtkPythonInterpreter::RunSimpleString(""); // Redirect Python's stdout and stderr and stdin - GIL protected operation if (vtkPythonInterpreter::RedirectOutput) { // Setup handlers for stdout/stdin/stderr. vtkPythonStdStreamCaptureHelper* wrapperOut = NewPythonStdStreamCaptureHelper(false); vtkPythonStdStreamCaptureHelper* wrapperErr = NewPythonStdStreamCaptureHelper(true); vtkPythonScopeGilEnsurer gilEnsurer; PySys_SetObject(const_cast<char*>("stdout"), reinterpret_cast<PyObject*>(wrapperOut)); PySys_SetObject(const_cast<char*>("stderr"), reinterpret_cast<PyObject*>(wrapperErr)); PySys_SetObject(const_cast<char*>("stdin"), reinterpret_cast<PyObject*>(wrapperOut)); Py_DECREF(wrapperOut); Py_DECREF(wrapperErr); } // We call this before processing any of Python paths added by the // application using `PrependPythonPath`. This ensures that application // specified paths are preferred to the ones `vtkPythonInterpreter` adds. vtkPythonInterpreter::SetupVTKPythonPaths(); for (size_t cc = 0; cc < PythonPaths.size(); cc++) { vtkPrependPythonPath(PythonPaths[cc].c_str()); } NotifyInterpreters(vtkCommand::EnterEvent); return true; } return false; } #ifdef vtkPythonInterpreter_USE_DIRECTORY_COOKIE static PyObject* DLLDirectoryCookie = nullptr; static void CloseDLLDirectoryCookie() { if (DLLDirectoryCookie) { if (PyObject_HasAttrString(DLLDirectoryCookie, "close")) { PyObject* result = PyObject_CallMethod(DLLDirectoryCookie, "close", nullptr); Py_XDECREF(result); } Py_XDECREF(DLLDirectoryCookie); DLLDirectoryCookie = nullptr; } } #endif //------------------------------------------------------------------------------ void vtkPythonInterpreter::Finalize() { if (Py_IsInitialized() != 0) { NotifyInterpreters(vtkCommand::ExitEvent); vtkPythonScopeGilEnsurer gilEnsurer(false, true); #ifdef vtkPythonInterpreter_USE_DIRECTORY_COOKIE CloseDLLDirectoryCookie(); #endif // Py_Finalize will take care of releasing gil Py_Finalize(); } } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetProgramName(const char* programname) { if (programname) { // From Python Docs: The argument should point to a zero-terminated character // string in static storage whose contents will not change for the duration of // the program's execution. No code in the Python interpreter will change the // contents of this storage. #if PY_VERSION_HEX >= 0x03000000 wchar_t* argv0 = vtk_Py_DecodeLocale(programname, nullptr); if (argv0 == nullptr) { fprintf(stderr, "Fatal vtkpython error: " "unable to decode the program name\n"); static wchar_t empty[1] = { 0 }; argv0 = empty; Py_SetProgramName(argv0); } else { static WCharStringPool wpool; Py_SetProgramName(wpool.push_back(argv0)); } #else static StringPool pool; Py_SetProgramName(pool.push_back(vtksys::SystemTools::DuplicateString(programname))); #endif } } //------------------------------------------------------------------------------ void vtkPythonInterpreter::PrependPythonPath(const char* dir) { if (!dir) { return; } std::string out_dir = dir; #if defined(_WIN32) && !defined(__CYGWIN__) // Convert slashes for this platform. std::replace(out_dir.begin(), out_dir.end(), '/', '\\'); #endif if (Py_IsInitialized() == 0) { // save path for future use. PythonPaths.push_back(out_dir); return; } // Append the path to the python sys.path object. vtkPrependPythonPath(out_dir.c_str()); } //------------------------------------------------------------------------------ void vtkPythonInterpreter::PrependPythonPath( const char* anchor, const char* landmark, bool add_landmark) { const std::vector<std::string> prefixes = { VTK_PYTHON_SITE_PACKAGES_SUFFIX #if defined(__APPLE__) // if in an App bundle, the `sitepackages` dir is <app_root>/Contents/Python , "Contents/Python" #endif , "." }; vtkNew<vtkResourceFileLocator> locator; locator->SetLogVerbosity(vtkPythonInterpreter::GetLogVerbosity() + 1); std::string path = locator->Locate(anchor, prefixes, landmark); if (!path.empty()) { if (add_landmark) { path = path + "/" + landmark; } vtkPythonInterpreter::PrependPythonPath(path.c_str()); } } //------------------------------------------------------------------------------ int vtkPythonInterpreter::PyMain(int argc, char** argv) { vtksys::SystemTools::EnableMSVCDebugHook(); int count_v = 0; for (int cc = 0; cc < argc; ++cc) { if (argv[cc] && strcmp(argv[cc], "-v") == 0) { ++count_v; } if (argv[cc] && strcmp(argv[cc], "-vv") == 0) { count_v += 2; } } if (count_v > 0) { // change the vtkPythonInterpreter's log verbosity. We only touch it // if the command line arguments explicitly requested a certain verbosity. vtkPythonInterpreter::SetLogVerbosity(vtkLogger::VERBOSITY_INFO); vtkLogger::SetStderrVerbosity(vtkLogger::ConvertToVerbosity(count_v - 1)); } vtkLogger::Init(argc, argv, nullptr); // since `-v` and `-vv` are parsed as Python verbosity flags // and not log verbosity flags. vtkPythonInterpreter::Initialize(1); #if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03070000 && PY_VERSION_HEX < 0x03080000 // Python 3.7.0 has a bug where Py_InitializeEx (called above) followed by // Py_Main (at the end of this block) causes a crash. Gracefully exit with // failure if we're using 3.7.0 and suggest getting the newest 3.7.x release. // See <https://gitlab.kitware.com/vtk/vtk/-/issues/17434> for details. { bool is_ok = true; vtkPythonScopeGilEnsurer gilEnsurer(false, true); PyObject* sys = PyImport_ImportModule("sys"); if (sys) { // XXX: Check sys.implementation.name == 'cpython'? PyObject* version_info = PyObject_GetAttrString(sys, "version_info"); if (version_info) { PyObject* major = PyObject_GetAttrString(version_info, "major"); PyObject* minor = PyObject_GetAttrString(version_info, "minor"); PyObject* micro = PyObject_GetAttrString(version_info, "micro"); auto py_number_cmp = [](PyObject* obj, long expected) { return obj && PyLong_Check(obj) && PyLong_AsLong(obj) == expected; }; // Only 3.7.0 has this issue. Any failures to get the version // information is OK; we'll just crash later anyways if the version is // bad. is_ok = !py_number_cmp(major, 3) || !py_number_cmp(minor, 7) || !py_number_cmp(micro, 0); Py_XDECREF(micro); Py_XDECREF(minor); Py_XDECREF(major); } Py_XDECREF(version_info); } Py_XDECREF(sys); if (!is_ok) { std::cerr << "Python 3.7.0 has a known issue that causes a crash with a " "specific API usage pattern. This has been fixed in 3.7.1 and all " "newer 3.7.x Python releases. Exiting now to avoid the crash." << std::endl; return 1; } } #endif // Need two copies of args, because programs might modify the first wchar_t** argvWide = new wchar_t*[argc]; wchar_t** argvWide2 = new wchar_t*[argc]; int argcWide = 0; for (int i = 0; i < argc; i++) { if (argv[i] && strcmp(argv[i], "--enable-bt") == 0) { vtksys::SystemInformation::SetStackTraceOnError(1); continue; } if (argv[i] && strcmp(argv[i], "-V") == 0) { // print out VTK version and let argument pass to Py_Main(). At which point, // Python will print its version and exit. cout << vtkVersion::GetVTKSourceVersion() << endl; } argvWide[argcWide] = vtk_Py_DecodeLocale(argv[i], nullptr); argvWide2[argcWide] = argvWide[argcWide]; if (argvWide[argcWide] == nullptr) { fprintf(stderr, "Fatal vtkpython error: " "unable to decode the command line argument #%i\n", i + 1); for (int k = 0; k < argcWide; k++) { PyMem_Free(argvWide2[k]); } delete[] argvWide; delete[] argvWide2; return 1; } argcWide++; } vtkPythonScopeGilEnsurer gilEnsurer(false, true); int res = Py_Main(argcWide, argvWide); for (int i = 0; i < argcWide; i++) { PyMem_Free(argvWide2[i]); } delete[] argvWide; delete[] argvWide2; return res; #else // process command line arguments to remove unhandled args. std::vector<char*> newargv; for (int i = 0; i < argc; ++i) { if (argv[i] && strcmp(argv[i], "--enable-bt") == 0) { vtksys::SystemInformation::SetStackTraceOnError(1); continue; } if (argv[i] && strcmp(argv[i], "-V") == 0) { // print out VTK version and let argument pass to Py_Main(). At which point, // Python will print its version and exit. cout << vtkVersion::GetVTKSourceVersion() << endl; } newargv.push_back(argv[i]); } vtkPythonScopeGilEnsurer gilEnsurer(false, true); return Py_Main(static_cast<int>(newargv.size()), &newargv[0]); #endif } //------------------------------------------------------------------------------ int vtkPythonInterpreter::RunSimpleString(const char* script) { vtkPythonInterpreter::Initialize(1); vtkPythonInterpreter::ConsoleBuffering = true; // The embedded python interpreter cannot handle DOS line-endings, see // http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=1167922 std::string buffer = script ? script : ""; buffer.erase(std::remove(buffer.begin(), buffer.end(), '\r'), buffer.end()); // The cast is necessary because PyRun_SimpleString() hasn't always been const-correct int pyReturn; { vtkPythonScopeGilEnsurer gilEnsurer; pyReturn = PyRun_SimpleString(const_cast<char*>(buffer.c_str())); } vtkPythonInterpreter::ConsoleBuffering = false; if (!vtkPythonInterpreter::StdErrBuffer.empty()) { vtkOutputWindow::GetInstance()->DisplayErrorText(vtkPythonInterpreter::StdErrBuffer.c_str()); NotifyInterpreters( vtkCommand::ErrorEvent, const_cast<char*>(vtkPythonInterpreter::StdErrBuffer.c_str())); vtkPythonInterpreter::StdErrBuffer.clear(); } if (!vtkPythonInterpreter::StdOutBuffer.empty()) { vtkOutputWindow::GetInstance()->DisplayText(vtkPythonInterpreter::StdOutBuffer.c_str()); NotifyInterpreters( vtkCommand::SetOutputEvent, const_cast<char*>(vtkPythonInterpreter::StdOutBuffer.c_str())); vtkPythonInterpreter::StdOutBuffer.clear(); } return pyReturn; } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetCaptureStdin(bool val) { vtkPythonInterpreter::CaptureStdin = val; } //------------------------------------------------------------------------------ bool vtkPythonInterpreter::GetCaptureStdin() { return vtkPythonInterpreter::CaptureStdin; } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetRedirectOutput(bool redirect) { vtkPythonInterpreter::RedirectOutput = redirect; } //------------------------------------------------------------------------------ bool vtkPythonInterpreter::GetRedirectOutput() { return vtkPythonInterpreter::RedirectOutput; } //------------------------------------------------------------------------------ void vtkPythonInterpreter::WriteStdOut(const char* txt) { if (vtkPythonInterpreter::ConsoleBuffering) { vtkPythonInterpreter::StdOutBuffer += std::string(txt); } else { vtkOutputWindow::GetInstance()->DisplayText(txt); NotifyInterpreters(vtkCommand::SetOutputEvent, const_cast<char*>(txt)); } } //------------------------------------------------------------------------------ void vtkPythonInterpreter::FlushStdOut() {} //------------------------------------------------------------------------------ void vtkPythonInterpreter::WriteStdErr(const char* txt) { if (vtkPythonInterpreter::ConsoleBuffering) { vtkPythonInterpreter::StdErrBuffer += std::string(txt); } else { vtkOutputWindow::GetInstance()->DisplayErrorText(txt); NotifyInterpreters(vtkCommand::ErrorEvent, const_cast<char*>(txt)); } } //------------------------------------------------------------------------------ void vtkPythonInterpreter::FlushStdErr() {} //------------------------------------------------------------------------------ vtkStdString vtkPythonInterpreter::ReadStdin() { if (!vtkPythonInterpreter::CaptureStdin) { vtkStdString string; cin >> string; return string; } vtkStdString string; NotifyInterpreters(vtkCommand::UpdateEvent, &string); return string; } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetupPythonPrefix() { using systools = vtksys::SystemTools; // Check Py_FrozenFlag global variable defined by Python to see if we're using // frozen Python. if (Py_FrozenFlag) { VTKPY_DEBUG_MESSAGE("`Py_FrozenFlag` is set. Skipping setting up of program path."); return; } std::string pythonlib = vtkGetLibraryPathForSymbol(Py_SetProgramName); if (pythonlib.empty()) { VTKPY_DEBUG_MESSAGE("static Python build or `Py_SetProgramName` library couldn't be found. " "Set `PYTHONHOME` if Python standard library fails to load."); return; } const std::string newprogramname = systools::GetFilenamePath(pythonlib) + VTK_PATH_SEPARATOR "vtkpython"; VTKPY_DEBUG_MESSAGE( "calling Py_SetProgramName(" << newprogramname << ") to aid in setup of Python prefix."); #if PY_VERSION_HEX >= 0x03000000 static WCharStringPool wpool; Py_SetProgramName(wpool.push_back(vtk_Py_DecodeLocale(newprogramname.c_str(), nullptr))); #else static StringPool pool; Py_SetProgramName(pool.push_back(systools::DuplicateString(newprogramname.c_str()))); #endif } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetupVTKPythonPaths() { // Check Py_FrozenFlag global variable defined by Python to see if we're using // frozen Python. if (Py_FrozenFlag) { VTKPY_DEBUG_MESSAGE("`Py_FrozenFlag` is set. Skipping locating of `vtk` package."); return; } using systools = vtksys::SystemTools; std::string vtklib = vtkGetLibraryPathForSymbol(GetVTKVersion); if (vtklib.empty()) { VTKPY_DEBUG_MESSAGE( "`GetVTKVersion` library couldn't be found. Will use `Py_GetProgramName` next."); } if (vtklib.empty()) { #if PY_VERSION_HEX >= 0x03000000 auto tmp = vtk_Py_EncodeLocale(Py_GetProgramName(), nullptr); vtklib = tmp; PyMem_Free(tmp); #else vtklib = Py_GetProgramName(); #endif } vtklib = systools::CollapseFullPath(vtklib); const std::string vtkdir = systools::GetFilenamePath(vtklib); #if defined(_WIN32) && !defined(__CYGWIN__) && defined(VTK_BUILD_SHARED_LIBS) // On Windows, based on how the executable is run, we end up failing to load // pyd files due to inability to load dependent dlls. This seems to overcome // the issue. if (!vtkdir.empty()) { #if PY_VERSION_HEX >= 0x03080000 vtkPythonScopeGilEnsurer gilEnsurer(false, true); CloseDLLDirectoryCookie(); PyObject* os = PyImport_ImportModule("os"); if (os) { PyObject* add_dll_directory = PyObject_GetAttrString(os, "add_dll_directory"); if (add_dll_directory && PyCallable_Check(add_dll_directory)) { PyObject* newpath = PyUnicode_FromString(vtkdir.c_str()); DLLDirectoryCookie = PyObject_CallFunctionObjArgs(add_dll_directory, newpath, nullptr); Py_XDECREF(newpath); } Py_XDECREF(add_dll_directory); } Py_XDECREF(os); #else std::string env_path; if (systools::GetEnv("PATH", env_path)) { env_path = vtkdir + ";" + env_path; } else { env_path = vtkdir; } systools::PutEnv(std::string("PATH=") + env_path); #endif } #endif #if defined(VTK_BUILD_SHARED_LIBS) vtkPythonInterpreter::PrependPythonPath(vtkdir.c_str(), "vtkmodules/__init__.py"); #else // since there may be other packages not zipped (e.g. mpi4py), we added path to _vtk.zip // to the search path as well. vtkPythonInterpreter::PrependPythonPath(vtkdir.c_str(), "_vtk.zip", /*add_landmark*/ false); vtkPythonInterpreter::PrependPythonPath(vtkdir.c_str(), "_vtk.zip", /*add_landmark*/ true); #endif } //------------------------------------------------------------------------------ void vtkPythonInterpreter::SetLogVerbosity(int val) { vtkPythonInterpreter::LogVerbosity = vtkLogger::ConvertToVerbosity(val); } //------------------------------------------------------------------------------ int vtkPythonInterpreter::GetLogVerbosity() { return vtkPythonInterpreter::LogVerbosity; } //------------------------------------------------------------------------------ int vtkPythonInterpreter::GetPythonVerboseFlag() { VTK_LEGACY_REPLACED_BODY( vtkPythonInterpreter::GetPythonVerboseFlag, "VTK 9.0", vtkPythonInterpreter::GetLogVerbosity); return vtkPythonInterpreter::LogVerbosity == vtkLogger::VERBOSITY_INFO ? 1 : 0; }
// Copyright (C) 2020 Intel Corporation // SPDX-License-Identifier: MIT #include <CL/sycl.hpp> #include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <numeric> #include <random> using namespace sycl; int main() { queue Q; const size_t N = 16; const size_t M = 16; range<2> stencil_range(N, M); range<2> alloc_range(N + 2, M + 2); std::vector<float> input(alloc_range.size()), output(alloc_range.size()); std::iota(input.begin(), input.end(), 1); std::fill(output.begin(), output.end(), 0); { buffer<float, 2> input_buf(input.data(), alloc_range); buffer<float, 2> output_buf(output.data(), alloc_range); Q.submit([&](handler& h) { accessor input{ input_buf, h }; accessor output{ output_buf, h }; // Compute the average of each cell and its immediate neighbors h.parallel_for(stencil_range, [=](id<2> idx) { int i = idx[0] + 1; int j = idx[1] + 1; float self = input[i][j]; float north = input[i - 1][j]; float east = input[i][j + 1]; float south = input[i + 1][j]; float west = input[i][j - 1]; output[i][j] = (self + north + east + south + west) / 5.0f; }); }); } // Check that all outputs match serial execution. bool passed = true; for (int i = 1; i < N + 1; ++i) { for (int j = 1; j < M + 1; ++j) { float self = input[i * (M + 2) + j]; float north = input[(i - 1) * (M + 2) + j]; float east = input[i * (M + 2) + (j + 1)]; float south = input[(i + 1) * (M + 2) + j]; float west = input[i * (M + 2) + (j - 1)]; float gold = (self + north + east + south + west) / 5.0f; if (std::abs(output[i * (M + 2) + j] - gold) >= 1.0E-06) { passed = false; } } } std::cout << ((passed) ? "SUCCESS" : "FAILURE") << "\n"; return (passed) ? 0 : 1; }
; A313721: Coordination sequence Gal.5.129.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Jamie Morken(s3) ; 1,5,10,15,20,24,29,34,39,44,49,54,59,64,68,73,78,83,88,93,98,103,108,112,117,122,127,132,137,142,147,152,156,161,166,171,176,181,186,191,196,200,205,210,215,220,225,230,235,240 mul $0,88 div $0,9 sub $0,1 div $0,2 add $0,1
; **************************************************************************************************************** ; **************************************************************************************************************** ; ; LET Command ; ; **************************************************************************************************************** ; **************************************************************************************************************** CMD_LET: ld (p1) ; look at first character xri '(' ; is it a ( (e.g. (H,L)) jz __CLE_HLIndirect ; ; Look for A-Z ; ld (p1) ccl adi 128-'A' ; will be +ve if (p1) < 'A' jp __CLE_SyntaxError1 adi 128-26 ; will be +ve if (p1) >= 26 jp __CLE_SyntaxError1 ld @1(p1) ; put address of variable on TOS, fetching. adi (Variables-'A') & 255 ; don't allocate it, yet, that's done st -2(p2) ; in target_acquired ldi 0 adi (Variables-'A') / 256 st -1(p2) jmp __CLE_TargetAcquired ; ; Errors ; __CLE_SyntaxError2: ld @2(p2) ; syntax error with pop. __CLE_SyntaxError1: ldi ERROR_Statement ; set error to statement xae ccl ; indicate error jmp CMD_LET-2 ; and jump back. ; ; Handle (H,L) on LHS ; __CLE_HLIndirect: lpi p3, EvaluateHL-1 ; evaluate (H,L) as a LHS xppc p3 jp CMD_LET-2 ; error occurred ; ; Save address on TOS (not allocated), check for = expression. ; __CLE_TargetAcquired: ld @-2(p2) ; store address is on top of stack. __CLE_FindEquals: ld (p1) ; check EOS jz __CLE_SyntaxError2 ld @1(p1) ; refetch and bump xri ' ' ; skip spaces jz __CLE_FindEquals xri ' '!'=' ; if not equals, syntax error jnz __CLE_SyntaxError2 lpi p3,EvaluateExpression-1 ; evaluate the RHS. xppc p3 ld @2(p2) ; pop save address storage, data still there. csa ; check CY/L jp CMD_LET-2 ; if CY/L = 0 the RHS caused an error. ld -2(p2) ; copy save address to P3. xpal p3 ld -1(p2) xpah p3 lde ; get expression result st (p3) ; save where it should go. scl ; executed successfully. jmp CMD_LET-2
use32 org 0x414d98 label fgets at 0x414bd8 label __acrt_iob_func at 0x41b180 fgets_patch: ; Standard cdecl prolog push ebp mov ebp, esp ; Get stdin stream push 0 call dword[__acrt_iob_func] add esp, 4 ; Forward the call to fgets push eax ; stdin push 128 ; max length of input push dword [ebp + 8] ; input buffer call fgets add esp, 4 * 3 ; restore the stack ; Standard cdecl epilog mov esp, ebp pop ebp ret
RESULTS_START EQU $c000 RESULTS_N_ROWS EQU 2 include "base.inc" ; This test verifies restarting the channel after ; triggering the NRx2 write glitch works as expected CorrectResults: db $20, $20, $20, $20, $20, $20, $20, $20 db $20, $20, $20, $20, $20, $20, $20, $00 SubTest: MACRO xor a ldh [rNR52], a cpl ldh [rNR52], a ld hl, rPCM12 ld a, $fc ldh [rNR23], a ld a, $80 ldh [rNR21], a ldh [rNR22], a ld a, $87 ldh [rNR24], a ld a, $28 ldh [rNR22], a ld a, $87 nops \2 ldh [rNR24], a nops \1 ld a, [hl] call StoreResult ENDM RunTest: ld de, $c000 SubTest $0, 12 SubTest $1, 12 SubTest $2, 12 SubTest $3, 12 SubTest $4, 12 SubTest $5, 12 SubTest $6, 12 SubTest $7, 12 SubTest $8, 12 SubTest $9, 12 SubTest $a, 12 SubTest $b, 12 SubTest $c, 12 SubTest $d, 12 SubTest $e, 12 SubTest $f, 12 ret StoreResult:: ld [de], a inc de ret CGB_MODE
; A133884: a(n) = binomial(n+4,n) mod 4. ; 1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3,3,1,1,0,0,0,0,1,1,3,3,2,2,2,2,3 add $0,4 bin $0,4 lpb $0,1 mod $0,4 lpe mov $1,$0
org 7c3eh call enter_vga ;*************** ;* LET'S GET FREAKY mov al,64h mov cx,0c82h ;lappy: rep stosb ; loop lappy ; mov al,32h mov cx,0780h ;lappy2: rep stosb ; loop lappy2 ;*************** ;* DECODER ;* decoder: ;es should be set up by enter_vga mov si,disk xor di,di ;zero di for 0,0 xy mov cx,33h ;length, in lines, of our image .lp: mov bl,[si] ;get x inc si ;keep incrementing our reading addr xor ax,ax xor dx,dx ;zero dx just in case of garbage lodsb ;calculate our position on every line to keep func size down mov dl,al shl ax,6 shl dx,8 add ax,dx ;(ax * 2^8) + (bx * 2^6) add al,bl ;add x to our row number mov di,ax ;[es:di] mov al,[si] ;set our colour inc si ;mlf originally used a colour table, but 256 is already a colour table. push cx ;store our line decrement counter xor cx,cx mov cl,[si] ;get our line len inc si .write_loop: stosb loop .write_loop pop cx loop .lp ;***Write our message, slow but SMALL. wrut: mov ah,02h xor bh,bh mov dh,03h mov dl,00h int 10h ;set our initial cursor position mov si,string .lp: mov ah,09h mov bh,14h mov bl,05h mov cx,01h lodsb or al,al jz .end int 10h ;write our character inc byte [.cursor] mov ah,02h xor bh,bh mov dh,03h mov dl,[.cursor] int 10h ;increment our cursor jmp .lp .cursor: db 0 .end: ;********END**** xor ah,ah int 16h jmp $ ;do a soft reboot here. ; call exit_vga ; mov ax,4c00h ; int 21h ;dos exit. used for org 100h tests. ;===nodisk.mlf ;body = 0ch ;hair = 2bh ;eyes = 4fh ;drk = 12h ;mth = 04h disk: db 06h,01h,0ch,01h,0ah,01h,0ch,01h db 06h,02h,2bh,04h,0ah,02h,0ch,01h db 03h,03h,2bh,07h,0ah,03h,0ch,01h,0bh,03h,2bh,02h db 02h,04h,2bh,06h,08h,04h,0ch,04h,0ch,04h,2bh,01h db 02h,05h,2bh,03h,05h,05h,0ch,02h,07h,05h,12h,02h,09h,05h,0ch,03h,0ch,05h,2bh,01h db 01h,06h,2bh,03h,04h,06h,0ch,03h,07h,06h,4fh,02h,09h,06h,12h,01h,0ah,06h,0ch,02h,0ch,06h,2bh,01h db 01h,07h,2bh,01h,03h,07h,0ch,04h,07h,07h,4fh,02h,09h,07h,12h,01h,0ah,07h,0ch,02h,0ch,07h,2bh,01h db 03h,08h,0ch,01h,04h,08h,04h,02h,06h,08h,0ch,02h,08h,08h,12h,01h,09h,08h,0ch,03h,0ch,08h,2bh,01h db 04h,09h,04h,02h,06h,09h,0ch,05h,0bh,09h,2bh,02h db 06h,0ah,0ch,05h,0bh,0ah,2bh,02h db 05h,0bh,0ch,05h,0ah,0bh,2bh,03h db 04h,0ch,0ch,05h,09h,0ch,0ch,03h db 04h,0dh,0ch,06h,0ah,0dh,2bh,01h,0bh,0dh,0ch,02h db 03h,0eh,0ch,08h,0bh,0eh,2bh,01h,0ch,0eh,0ch,02h db 03h,0fh,0ch,0ch db 00h,10h,0fh,0a0h,0a0h,10h,0fh,0a0h ;************** ;* FUNCTIONS ;* enter_vga: mov ax,0013h ;change into mode 13 int 10h push 0a000h ;set up [es:di] for printing to video memory pop es ret ;exit_vga: ; mov ax,0003h ;change into mode 03 (should be 80x25 16clr textmode) ; int 10h ; ret string: db 22h,"I am not a system disk!",22h,0
; A164583: a(n)=4^n*(2n + 1)^2. ; 1,36,400,3136,20736,123904,692224,3686400,18939904,94633984,462422016,2218786816,10485760000,48922361856,225754218496,1031865892864,4677219385344,21045339750400,94076963651584,418089296461824 mov $1,$0 mul $0,2 add $0,1 mov $2,2 pow $2,$1 mul $0,$2 pow $0,2
;Model Declaration IDEAL MODEL SMALL ;Using Small Model Arc STACK 100H ;Pre order 100H memory STACK P286 ;Enable All Command in 80286 with TASM ;Declaration Library that being used include 'graphfun.inc' include 'movesfun.inc' include 'bmpfun.inc' include 'iofun.inc' include 'sfx.inc' ;Data Segment DATASEG ; Error Messages byUser db 'Program closed by user.$' blank db 'Error no Output Detected.$' ;For Acessing Directories root@wd db '../' , 0 pieces@wd db 'gamefile' , 0 ;Selection Function sourcePos_sel dd 0 destPos_sel dd 0 step_sel dw 0 ; Winning Messages white@win db 'White won!$' black@win db 'Black won!$' ;Code Segment CODESEG ;Start Function START: ;Intializing mov ax, @data mov ds, ax ;Setting Work Directories mov ah, 3Bh mov dx, offset pieces@wd int 21h ;Call initialization of GUI call initBoard_en call initGraph_graph mov al, 14h call cleanScreen_graph call initsound call drawBoard_graph mov di, 7 mov si, 7 mov al, [markColor_graph] call markCube_graph mov [markerCol_io], di mov [markerRow_io], si ;Game Start game@start: mov [step_sel], 0 ;Getting Source Fucntion getSource@game: call getData_io push si push di inc [step_sel] push offset board_en call getOffset_en mov [sourceAddr_en], bx call validateSource_en jc invalid@game ;Getting Destination Functio getDest@game: call getData_io push si push di inc [step_sel] push offset board_en call getOffset_en mov [destAddr_en], bx call validateDest_en jc invalid@game mov si, [sourceAddr_en] mov di, [destAddr_en] call validateMove_en jc invalid@game cmp [byte di], 6 je white_won@game cmp [byte di], -6 je black_won@game call move_en mov cx, [step_sel] ;Always Updating Mark updateBoard@game: pop di pop si push cx call getColor_graph call drawCube_graph pop cx loop updateBoard@game ;Invalid Game Checking updateMark@game: mov di, [markerCol_io] mov si, [markerRow_io] mov al, [markColor_graph] call markCube_graph neg [turn_en] jmp game@start ;Invalid Game Checking invalid@game: add sp, [step_sel] add sp, [step_sel] mov di, [markerCol_io] mov si, [markerRow_io] mov al, 0Ch call markCube_graph jmp game@start ;White Won Function white_won@game: mov dx, offset white@win jmp exit_msg ;Black Won Function black_won@game: mov dx, offset black@win jmp exit_msg ;Exit Function EXIT: mov dx, offset blank exit_msg: ; Flush io buffer mov ah, 0Ch int 21h ; Text Mode mov ax, 2h int 10h ; Error Msg mov ah, 9h int 21h ; Restore WD mov ah, 3Bh mov dx, offset root@wd int 21h ; Terminate Program mov ax, 4c00h int 21h END START
// -*- C++ -*- // // ====================================================================== // // Brad T. Aagaard, U.S. Geological Survey // Charles A. Williams, GNS Science // Matthew G. Knepley, University at Buffalo // // This code was developed as part of the Computational Infrastructure // for Geodynamics (http://geodynamics.org). // // Copyright (c) 2010-2021 University of California, Davis // // See LICENSE.md for license information. // // ====================================================================== // /** * @file libsrc/testing/FieldTester.hh * * @brief General routines for C++ unit tests related to Field. */ #if !defined(pylith_testing_fieldtester_hh) #define pylith_testing_fieldtester_hh #include "pylith/testing/testingfwd.hh" // forward declarations #include "pylith/topology/Field.hh" // USES Field::SubfieldInfo #include "pylith/utils/petscfwd.h" // USES PetscFE #include "spatialdata/spatialdb/spatialdbfwd.hh" // USES SpatialDB class pylith::testing::FieldTester { // PUBLIC METHODS ////////////////////////////////////////////////////////////////////////////////////////////////// public: /** Check to make sure field matches spatial database. * * @param[in] field Field to check. * @param[in] fieldDB Spatial database describing field. * @param[in] lengthScale Length scale for nondimensionalization. * @returns L2 norm of difference between field and spatial database. */ static PylithReal checkFieldWithDB(const pylith::topology::Field& field, spatialdata::spatialdb::SpatialDB* fieldDB, const PylithReal lengthScale); /** Check that subfield information in field test subject matches expected subfield. * * @param field Field with subfields created by factory. * @param infoE Expected subfield info. */ static void checkSubfieldInfo(const pylith::topology::Field& field, const pylith::topology::Field::SubfieldInfo& infoE); // NOT IMPLEMENTED ////////////////////////////////////////////////////// private: FieldTester(void); ///< Not implemented. FieldTester(const FieldTester&); ///< Not implemented. const FieldTester& operator=(const FieldTester&); ///< Not implemented. }; // FieldTester #endif // pylith_testing_fieldtester_hh // End of file
Name: ys_mapdt.asm Type: file Size: 76124 Last-Modified: '2016-05-13T04:51:16Z' SHA-1: 269EB28C7D86438C24D5CB8A0D52CF004469401C Description: null
/******************************************************************************* * Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II * Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI * * Distributed under the Boost Software License, Version 1.0. * See accompanying file LICENSE.txt or copy at * http://www.boost.org/LICENSE_1_0.txt ******************************************************************************/ #ifndef NT2_SDK_SIMD_EXTENSIONS_NONE_HPP_INCLUDED #define NT2_SDK_SIMD_EXTENSIONS_NONE_HPP_INCLUDED #include <nt2/sdk/simd/meta/as_simd.hpp> #include <nt2/sdk/simd/meta/extension_of.hpp> #include <nt2/sdk/simd/meta/is_simd_specific.hpp> #if !defined(NT2_SIMD_DETECTED) NT2_WARNING(No SIMD extensions detected) #define NT2_NO_SIMD //////////////////////////////////////////////////////////////////////////////// // If no SIMD extension are set, we still need to align on 128 bits to allow // linking with SIMD enabled obejct files //////////////////////////////////////////////////////////////////////////////// #define NT2_SIMD_BYTES 16 #define NT2_SIMD_BITS 128 #define NT2_SIMD_STRING "none" #define NT2_SIMD_CARDINALS (1) #if defined(NT2_SIMD_TYPES) #define NT2_SIMD_TYPES #define NT2_SIMD_REAL #define NT2_SIMD_UNSIGNED_TYPES #define NT2_SIMD_SIGNED_TYPES #define NT2_SIMD_INTEGRAL_SIGNED_TYPES #define NT2_SIMD_INTEGRAL_UNSIGNED_TYPES #endif #endif #endif
; ; z88dk RS232 Function ; ; OSCA version ; ; unsigned char rs232_init() ; ; $Id: rs232_init.asm,v 1.2 2015/01/22 12:09:57 stefano Exp $ PUBLIC rs232_init INCLUDE "osca.def" rs232_init: xor a out (sys_timer),a ; timer to overflow every 0.004 secconds in a,(sys_serial_port) ; clear serial buffer flag by reading port ld hl,0 ;RS_ERR_OK; ret
GymStatues: ; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID ; if in a gym and don’t have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID ; else ret call EnableAutoTextBoxDrawing ld a, [wSpriteStateData1 + 9] cp SPRITE_FACING_UP ret nz ld hl, .BadgeFlags ld a, [wCurMap] ld b, a .loop ld a, [hli] cp $ff ret z cp b jr z, .match inc hl jr .loop .match ld b, [hl] ld a, [wBeatGymFlags] and b cp b tx_pre_id GymStatueText2 jr z, .haveBadge tx_pre_id GymStatueText1 .haveBadge jp PrintPredefTextID .BadgeFlags: db PEWTER_GYM, %00000001 db CERULEAN_GYM, %00000010 db VERMILION_GYM,%00000100 db CELADON_GYM, %00001000 db FUCHSIA_GYM, %00010000 db SAFFRON_GYM, %00100000 db CINNABAR_GYM, %01000000 db VIRIDIAN_GYM, %10000000 db $ff GymStatueText1: TX_FAR _GymStatueText1 db "@" GymStatueText2: TX_FAR _GymStatueText2 db "@" PrintBenchGuyText: call EnableAutoTextBoxDrawing ld hl, BenchGuyTextPointers ld a, [wCurMap] ld b, a .loop ld a, [hli] cp $ff ret z cp b jr z, .match inc hl inc hl jr .loop .match ld a, [hli] ld b, a ld a, [wSpriteStateData1 + 9] cp b jr nz, .loop ; player isn't facing left at the bench guy ld a, [hl] jp PrintPredefTextID ; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable BenchGuyTextPointers: db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT db_tx_pre ViridianCityPokecenterBenchGuyText db PEWTER_POKECENTER, SPRITE_FACING_LEFT db_tx_pre PewterCityPokecenterBenchGuyText db CERULEAN_POKECENTER, SPRITE_FACING_LEFT db_tx_pre CeruleanCityPokecenterBenchGuyText db LAVENDER_POKECENTER, SPRITE_FACING_LEFT db_tx_pre LavenderCityPokecenterBenchGuyText db VERMILION_POKECENTER, SPRITE_FACING_LEFT db_tx_pre VermilionCityPokecenterBenchGuyText db CELADON_POKECENTER, SPRITE_FACING_LEFT db_tx_pre CeladonCityPokecenterBenchGuyText db CELADON_HOTEL, SPRITE_FACING_LEFT db_tx_pre CeladonCityHotelText db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT db_tx_pre FuchsiaCityPokecenterBenchGuyText db CINNABAR_POKECENTER, SPRITE_FACING_LEFT db_tx_pre CinnabarIslandPokecenterBenchGuyText db SAFFRON_POKECENTER, SPRITE_FACING_LEFT db_tx_pre SaffronCityPokecenterBenchGuyText db MT_MOON_POKECENTER, SPRITE_FACING_LEFT db_tx_pre MtMoonPokecenterBenchGuyText db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT db_tx_pre RockTunnelPokecenterBenchGuyText db $FF ViridianCityPokecenterBenchGuyText: TX_FAR _ViridianCityPokecenterGuyText db "@" PewterCityPokecenterBenchGuyText: TX_FAR _PewterCityPokecenterGuyText db "@" CeruleanCityPokecenterBenchGuyText: TX_FAR _CeruleanPokecenterGuyText db "@" LavenderCityPokecenterBenchGuyText: TX_FAR _LavenderPokecenterGuyText db "@" MtMoonPokecenterBenchGuyText: TX_FAR _MtMoonPokecenterBenchGuyText db "@" RockTunnelPokecenterBenchGuyText: TX_FAR _RockTunnelPokecenterGuyText db "@" UnusedBenchGuyText1: TX_FAR _UnusedBenchGuyText1 db "@" UnusedBenchGuyText2: TX_FAR _UnusedBenchGuyText2 db "@" UnusedBenchGuyText3: TX_FAR _UnusedBenchGuyText3 db "@" VermilionCityPokecenterBenchGuyText: TX_FAR _VermilionPokecenterGuyText db "@" CeladonCityPokecenterBenchGuyText: TX_FAR _CeladonCityPokecenterGuyText db "@" FuchsiaCityPokecenterBenchGuyText: TX_FAR _FuchsiaCityPokecenterGuyText db "@" CinnabarIslandPokecenterBenchGuyText: TX_FAR _CinnabarPokecenterGuyText db "@" SaffronCityPokecenterBenchGuyText: TX_ASM CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI ld hl, SaffronCityPokecenterBenchGuyText2 jr nz, .asm_624f2 ld hl, SaffronCityPokecenterBenchGuyText1 .asm_624f2 call PrintText jp TextScriptEnd SaffronCityPokecenterBenchGuyText1: TX_FAR _SaffronCityPokecenterGuyText1 db "@" SaffronCityPokecenterBenchGuyText2: TX_FAR _SaffronCityPokecenterGuyText2 db "@" CeladonCityHotelText: TX_FAR _CeladonCityHotelText db "@" ret UnusedPredefText: db "@" PrintBookcaseText: call EnableAutoTextBoxDrawing tx_pre_jump BookcaseText BookcaseText: TX_FAR _BookcaseText db "@" OpenPokemonCenterPC: ld a, [wSpriteStateData1 + 9] cp SPRITE_FACING_UP ; check to see if player is facing up ret nz call EnableAutoTextBoxDrawing ld a, $1 ld [wAutoTextBoxDrawingControl], a tx_pre_jump PokemonCenterPCText PokemonCenterPCText: TX_POKECENTER_PC
copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D94 move.l D1, (A1)+ 004D96 dbra D0, $4d94 018D6C move.b ($bc,A6), D0 [123p+ AB] 018D70 beq $18d7a [123p+ BC] 018D76 move.b D0, ($bc,A6) 018D7A move.b ($b3,A6), D0 [123p+ BC] 019266 cmpi.b #$3, ($bc,A6) 01926C bcc $19fc6 [123p+ BC] 019270 move.b #$f, ($bc,A6) 019276 bra $192b8 [123p+ BC] 01940C move.b D0, ($bc,A6) 019410 jmp $95ce.l 019730 clr.b ($bc,A6) 019734 cmpi.b #$0, ($3,A6) [123p+ BC] 019822 clr.b ($bc,A6) 019826 jsr $1426.l 0198C0 clr.b ($bc,A6) 0198C4 move.b #$28, ($f8,A6) [123p+ BC] 01DEAE clr.b ($3330,A5) [123p+ A8] 01DEB2 clr.b ($3494,A5) [123p+ BC] 01DEBA clr.b ($34b0,A5) [123p+ A8] 01DEBE clr.b ($3614,A5) [123p+ BC] 01DEC6 clr.b ($3630,A5) [123p+ A8] 01DECA rts [123p+ BC] 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
Route2_h: db OVERWORLD ; tileset db ROUTE_2_HEIGHT, ROUTE_2_WIDTH ; dimensions (y, x) dw Route2_Blocks ; blocks dw Route2_TextPointers ; texts dw Route2_Script ; scripts db NORTH | SOUTH ; connections NORTH_MAP_CONNECTION ROUTE_2, PEWTER_CITY, -3, 2, PewterCity_Blocks SOUTH_MAP_CONNECTION ROUTE_2, VIRIDIAN_CITY, -3, 2, ViridianCity_Blocks, 1 dw Route2_Object ; objects
; A243305: a(n) = 2^phi(n)+1 = A066781(n)+1. ; 3,3,5,5,17,5,65,17,65,17,1025,17,4097,65,257,257,65537,65,262145,257,4097,1025,4194305,257,1048577,4097,262145,4097,268435457,257,1073741825,65537,1048577,65537,16777217,4097,68719476737,262145,16777217,65537,1099511627777,4097,4398046511105,1048577,16777217,4194305,70368744177665,65537,4398046511105,1048577,4294967297,16777217,4503599627370497,262145,1099511627777,16777217,68719476737,268435457 mov $1,2 cal $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n. sub $0,1 pow $1,$0 mul $1,2 add $1,1
; github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_64.tbl %define SYS_READ 0 %define SYS_WRITE 1 %define SYS_OPEN 2 %define SYS_EXIT 60 ; pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html %define STDIN 0 %define STDOUT 1 %define STDERR 2 ; pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html %define EXIT_SUCCESS 0 %define EXIT_FAILURE 1 ; Constants for better code readability %define NULL 0 %define isTrue 1 %define isFalse 0 ; ============================================================================= ; Arithematic instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - O_ADD ; Args - None ; Pre - Operand integers on top of stack ; Post - Sum of integers on top of stack ; Desc - Push (stack[-1] + stack[-2]) on stack ; ----------------------------------------------------------------------------- %macro O_ADD 0 POP RAX ; Get 'a' from stack POP RBX ; Get 'b' from stack ADD RAX, RBX ; Sum a + b PUSH RAX ; Push sum onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_SUB ; Args - None ; Pre - Operand integers on top of stack ; Post - Different of integers on top of stack ; Desc - Push (stack[-2] - stack[-1]) on stack ; ----------------------------------------------------------------------------- %macro O_SUB 0 POP RBX ; Get 'a' from stack POP RAX ; Get 'b' from stack SUB RAX, RBX ; Subtract a - b PUSH RAX ; Push difference onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_NEGATE ; Args - None ; Pre - Operand integer on top of stack ; Post - Negative of integer on stack ; Desc - Push negative of stack[-1] on stack ; ----------------------------------------------------------------------------- %macro O_NEGATE 0 POP RAX ; Get 'a' from stack NEG RAX ; Negate a PUSH RAX ; Push -(a) onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_MUL ; Args - None ; Pre - Operand integers on top of stack ; Post - Product of integers on top of stack ; Desc - Push (stack[-1] * stack[-2]) on stack ; ----------------------------------------------------------------------------- %macro O_MUL 0 POP RAX ; Get 'a' from stack POP RBX ; Get 'b' from stack IMUL RBX ; Multiply a * b PUSH RAX ; Push product onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_DIV ; Args - None ; Pre - Operand integers on top of stack ; Post - Quotient of integer division on stack ; Desc - Push (stack[-2] / stack[-1]) on stack ; ----------------------------------------------------------------------------- %macro O_DIV 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack XOR RDX, RDX ; Clear for division IDIV RBX ; Divide a / b PUSH RAX ; Push dividend onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_MOD ; Args - None ; Pre - Operand integers on top of stack ; Post - Remainder of integer division on stack ; Desc - Push (stack[-2] % stack[-1]) on stack ; ----------------------------------------------------------------------------- %macro O_MOD 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack XOR RDX, RDX ; Clear for division IDIV RBX ; Divide a / b PUSH RDX ; Push remainder onto stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_EQ ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-1] == stack[-2], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_EQ 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JNE %%a_neq_b PUSH isTrue ; a == b JMP %%end %%a_neq_b: PUSH isFalse ; a != b %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_NEQ ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-1] != stack[-2], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_NEQ 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JE %%a_eq_b PUSH isTrue ; a != b JMP %%end %%a_eq_b: PUSH isFalse ; a == b %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_LSS ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-2] < stack[-1], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_LSS 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JNL %%a_geq_b PUSH isTrue ; a < b JMP %%end %%a_geq_b: PUSH isFalse ; a >= b %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_GTR ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-2] > stack[-1], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_GTR 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JNG %%a_leq_b PUSH isTrue ; a > b JMP %%end %%a_leq_b: PUSH isFalse ; a <= b %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_LEQ ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-2] <= stack[-1], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_LEQ 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JG %%a_gtr_b PUSH isTrue ; a <= b JMP %%end %%a_gtr_b: PUSH isFalse ; a > b %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_GEQ ; Args - None ; Pre - Operand integers on top of stack ; Post - Integer comparison result on stack ; Desc - If stack[-2] >= stack[-1], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_GEQ 0 POP RBX ; Get 'b' from stack POP RAX ; Get 'a' from stack CMP RAX, RBX ; a ?? b JL %%a_less_b PUSH isTrue ; a >= b JMP %%end %%a_less_b: PUSH isFalse ; a < b %%end: %endmacro ; ============================================================================= ; Logical instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - O_AND ; Args - None ; Pre - Operand integers on top of stack ; Post - Logical AND result of integers on stack ; Desc - If stack[-1] && stack[-2], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_AND 0 POP RAX ; Get 'a' from stack POP RBX ; Get 'b' from stack AND RAX, RBX ; a && b JNZ %%a_and_b PUSH isFalse ; If (a && b) is zero, push isFalse .. JMP %%end %%a_and_b: PUSH isTrue ; .. else, push isTrue %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_OR ; Args - None ; Pre - Operand integers on top of stack ; Post - Logical OR result of integers on stack ; Desc - If stack[-1] || stack[-2], push isTrue on stack, else isFalse ; ----------------------------------------------------------------------------- %macro O_OR 0 POP RAX ; Get 'a' from stack POP RBX ; Get 'b' from stack OR RAX, RBX ; a || b JNZ %%a_or_b PUSH isFalse ; If (a || b) is zero, push isFalse .. JMP %%end %%a_or_b: PUSH isTrue ; .. else, push isTrue %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_NOT ; Args - None ; Pre - Operand integers on top of stack ; Post - Logical NOT result of integer on top of stack ; Desc - If stack[-1] is non-zero, push isFalse, if value is 0, push isTrue ; ----------------------------------------------------------------------------- %macro O_NOT 0 POP RAX ; Get integer from stack CMP RAX, 0 ; Compare value with 0 JNE %%nz PUSH isTrue ; If value is zero, push isTrue on stack .. JMP %%end %%nz: PUSH isFalse ; .. else, push isFalse on stack %%end: %endmacro ; ============================================================================= ; Data operation instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - _INPUT_ ; Args - None ; Pre - Prompt string index on top of stack ; Post - User input integer on top of stack ; Desc - Reads integer from user and pushes on top of stack ; ----------------------------------------------------------------------------- %macro _INPUT_ 0 O_PRTS ; Print prompt string with macro ; Read digits from STDIN and store in buffer 'bss0' in a loop until newline XOR R9, R9 ; R9 will hold number of characters read %%readi_start: MOV RDX, 1 ; Read 1 character .. MOV RDI, STDIN ; .. of user input from STDIN .. MOV RAX, SYS_READ ; .. with SYS_READ system call .. MOV RSI, char ; .. and save character to memory location 'char' SYSCALL ; Call kernel MOV AL, [char] ; Move character read into RAX CMP AL, 0ah ; If character is newline .. JE %%readi_end ; .. end reading user input MOV RAX, bss0 ; RAX points to buffer used for storage ADD RAX, R9 ; Increment address past current characters XOR RBX, RBX MOV BL, [char] ; Copy the character to the BL register MOV [EAX], BL ; Append character to the buffer 'bss0' INC R9 ; Increment number of characters JMP %%readi_start ; Read next character from screen %%readi_end: ; Convert digits in buffer 'bss0' to integer %%atoi: MOV RSI, bss0 ; RSI points to string to convert XOR RCX, RCX ; RCX will hold number of digits processed so far XOR RAX, RAX ; RAX will hold converted integer, starts off as 0 XOR RBX, RBX ; RBX will be used to convert ASCII to decimal XOR R8, R8 ; R8 will be the flag for negative value MOV BL, [RSI+RCX] ; Read in the first character &'bss0+0' CMP BL, 45 ; If char is not -ve sign .. JNE %%isPositive ; .. jump to label isPositive MOV R8, 1d ; .. else set negative integer flag INC RCX ; Move to second char in buffer DEC R9 ; Decrement number of digits to be processed .. JMP %%atoi_loop ; .. and convert string to integer %%isPositive: XOR R8, R8 ; Clear negative integer flag %%atoi_loop: XOR RBX, RBX MOV BL, [ESI+ECX] ; Read in ASCII character to convert CMP BL, 48 ; If char ASCII value less than 0 .. JL %%atoi_end ; .. jump to end CMP BL, 57 ; If char ASCII value greater than 9 .. JG %%atoi_end ; .. jump to end SUB BL, 48 ; Get decimal value from ASCII ADD RAX, RBX ; Add value to RAX DEC R9 ; Decrement number of digits to be processed CMP R9, 0 ; If no more digits to process .. JE %%atoi_end ; .. jump to end MOV RBX, 10 ; Multiply current value in RAX by 10 MUL RBX ; INC RCX ; Increment counter used for character address JMP %%atoi_loop ; Process next digit %%atoi_end: CMP R8, 1d ; If negative integer flag is not set .. JNE %%push_val ; .. jump to label push_val .. NEG RAX ; .. else negate value ; Push integer value on top of stack %%push_val: PUSH RAX ; Push result integer value to top of stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - _FETCH_ ; Args - Array index ; Pre - None ; Post - Push value at data[index] on top of stack ; Desc - Gets integer from array 'data[index]' and pushes it on top of stack ; ----------------------------------------------------------------------------- %macro _FETCH_ 1 MOV RAX,[data+(8*%1)] ; Get from [source] + (size) * index PUSH RAX ; Push integer on top of stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - _STORE_ ; Args - Array index ; Pre - Integer to store on top of stack ; Post - data[index] = integer at top of stack ; Desc - Stores integer from top of stack into array 'data' at given index ; ----------------------------------------------------------------------------- %macro _STORE_ 1 POP RAX ; Get integer to store MOV [data+(8*%1)],RAX ; Store in [destination] + (size) * index %endmacro ; ============================================================================= ; Logical instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - O_JZ ; Args - Label to jump to ; Pre - Value to compare with 0 on top of stack ; Post - None ; Desc - If top of stack is 0, jump to given label ; ----------------------------------------------------------------------------- %macro O_JZ 1 POP RAX ; Get value from top of stack .. CMP RAX, 0 ; .. and compare with zero JE %1 ; If value is zero, jump to given label %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_JNZ ; Args - Label to jump to ; Pre - Value to compare with 0 on top of stack ; Post - None ; Desc - If top of stack is non-zero, jump to given label ; ----------------------------------------------------------------------------- %macro O_JNZ 1 POP RAX ; Get value from top of stack .. CMP RAX, 0 ; .. and compare with zero JNE %1 ; If value is non-zero, jump to given label %endmacro ; ============================================================================= ; Print instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - O_PRTS ; Args - None ; Pre - strs[index] to print on top of stack ; Post - None ; Desc - Prints string at 'strs[index]' to STDOUT ; ----------------------------------------------------------------------------- %macro O_PRTS 0 POP RAX ; Get index of string to print from stack MOV RBX, 8d ; Add (index*8) to array address .. IMUL RBX ; .. to get string address MOV RSI, [strs+RAX] ; Get address of string to print MOV RDX, [lens+RAX] ; Get length of string to print MOV RAX, SYS_WRITE ; Use sys_write system call MOV RDI, STDOUT ; Output to stdout SYSCALL ; Call kernel CMP RDX, RAX ; If sys_write wrote expected number of bytes .. JE %%end ; .. return from macro HALT RAX ; .. else, exit with difference as code .. %%end: %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_PRTS ; Args - Char to print ; Pre - None ; Post - None ; Desc - Print given character to STDOUT ; ----------------------------------------------------------------------------- %macro O_PRTS 1 PUSH %1 ; Push char on stack MOV RAX, SYS_WRITE ; Use sys_write system call to print MOV RDI, STDOUT ; Output to stdout MOV RSI, RSP ; Print char on stack MOV RDX, 1 ; Length SYSCALL ; Call kernel CMP RAX, RDX ; If sys_write wrote expected number of bytes .. JE %%end ; .. return from macro HALT RAX ; .. else, exit with difference as code .. %%end: ADD RSP, 8 ; Remove char from stack %endmacro ; ----------------------------------------------------------------------------- ; Macro - O_PRTI ; Args - None ; Pre - Integer to print on top of stack ; Post - None ; Desc - Prints integer on top of stack to STDOUT ; ----------------------------------------------------------------------------- %macro O_PRTI 0 POP RAX ; Get integer from stack CMP RAX, 0 ; Check if number is negative JGE %%start ; If number is positive, print number PUSH RAX ; Backup number before printing -ve sign O_PRTS "-" ; Print '-' sign using macro POP RAX ; Restore number after printing -ve sign NEG RAX ; If number is negative, get positive value %%start: XOR RSI, RSI ; Zero out source index register %%loop: XOR RDX, RDX ; Zero out quotient register MOV RBX, 10d ; Keep dividing number by 10 DIV RBX ; to get remainder (digit) in RDX ADD RDX, 48d ; Add 48 to convert decimal to ASCII PUSH RDX ; Push digits on stack INC RSI ; Increment source index register MOV RBX, RSI ; Move number of digits to RBX, for printing CMP RAX, 0 ; If quotient is zero, all digits on stack JZ %%next ; If all digits on stack, print them JMP %%loop ; If quotient not zero, get next digit %%next: CMP RBX, 0 ; If source index (RBX) is zero, no more digits .. JZ %%exit ; .. to add to buffer MOV RAX, SYS_WRITE ; Use sys_write system call to print MOV RDI, STDOUT ; Output to stdout MOV RSI, RSP ; Print digit on stack MOV RDX, 1 ; Length 1 byte per digit SYSCALL ; Call kernel CMP RAX, 1 ; If sys_write wrote more/less bytes .. JNE %%error ; .. exit with difference as code DEC RBX ; Decrement source index after every digit ADD RSP, 8 ; Move to next digit JMP %%next ; Get next char to print %%error: HALT RAX %%exit: %endmacro ; ============================================================================= ; Execution instructions ; ============================================================================= ; ----------------------------------------------------------------------------- ; Macro - HALT ; Args - None ; Pre - None ; Post - None ; Desc - Runs SYS_EXIT system call with code - 0 ; ----------------------------------------------------------------------------- %macro HALT 0 MOV RAX, SYS_EXIT ; Use SYS_EXIT system call to exit .. MOV RDI, 0 ; .. with exit code 0 SYSCALL %endmacro ; ----------------------------------------------------------------------------- ; Macro - HALT ; Args - Exit code ; Pre - None ; Post - None ; Desc - Runs SYS_EXIT system call with given code ; ----------------------------------------------------------------------------- %macro HALT 1 MOV RAX, SYS_EXIT ; Use SYS_EXIT system call to exit .. MOV RDI, %1 ; .. with given argument as exit code SYSCALL %endmacro ; ============================================================================= ; Program instructions ; ============================================================================= SECTION .text global _start _start: NOP ;=== User code start ===; PUSH 0 O_PRTS PUSH 1 O_PRTS PUSH 2 O_PRTS PUSH 3 O_PRTS PUSH 4 _INPUT_ _STORE_ 0 HALT ;=== User code end ===; SECTION .bss bss0 RESB 255 ; reserve 255 bytes for user input SECTION .data char DB 0 ; Used for user input ;=== User variables ===; ; === Strings ===; msg0: DB "Text without a newline.", NULL len0 EQU $ - msg0 msg1: DB "Text ending with newline", 13, 10, "", NULL len1 EQU $ - msg1 msg2: DB "Text split bewteen ", 13, 10, " two lines.", 13, 10, "", NULL len2 EQU $ - msg2 msg3: DB "Printing consecutive newline characters ", 13, 10, "", 13, 10, " above.", NULL len3 EQU $ - msg3 msg4: DB "How many lines are printed?", 13, 10, "", NULL len4 EQU $ - msg4 strs: DQ msg0, msg1, msg2, msg3, msg4, lens: DQ len0, len1, len2, len3, len4, ; === Integers ===; data TIMES 1 DQ 0
; ;----------- GFX paging ------------- SECTION code_clib PUBLIC pixeladdress_MODE2 INCLUDE "target/spc1000/def/spc1000.def" ; Entry h = x ; l = y ; Exit: hl = address ; a = pixel number ; Uses: a, bc, de, hl .pixeladdress_MODE2 ; add y-times the nuber of bytes per line (32) ; or just multiply y by 32 and the add ld e,h ld h,0 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e ;4 pixels per byte srl e srl e ld d,0 add hl,de and 3 xor 3 ret
# standard Decaf preamble .text .align 2 .globl main _factorial: # BeginFunc 36 subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp subu $sp, $sp, 36 # decrement sp to make space for locals/temps # _tmp0 = 1 li $v0, 1 # load constant value 1 into $v0 sw $v0, -8($fp) # spill _tmp0 from $v0 to $fp-8 # _tmp1 = n < _tmp0 lw $v0, 4($fp) # fill n to $v0 from $fp+4 lw $v1, -8($fp) # fill _tmp0 to $v1 from $fp-8 slt $v0, $v0, $v1 sw $v0, -12($fp) # spill _tmp1 from $v0 to $fp-12 # _tmp2 = n == _tmp0 lw $v0, 4($fp) # fill n to $v0 from $fp+4 lw $v1, -8($fp) # fill _tmp0 to $v1 from $fp-8 seq $v0, $v0, $v1 sw $v0, -16($fp) # spill _tmp2 from $v0 to $fp-16 # _tmp3 = _tmp1 || _tmp2 lw $v0, -12($fp) # fill _tmp1 to $v0 from $fp-12 lw $v1, -16($fp) # fill _tmp2 to $v1 from $fp-16 or $v0, $v0, $v1 sw $v0, -20($fp) # spill _tmp3 from $v0 to $fp-20 # IfZ _tmp3 Goto _L0 lw $v0, -20($fp) # fill _tmp3 to $v0 from $fp-20 beqz $v0, _L0 # branch if _tmp3 is zero # _tmp4 = 1 li $v0, 1 # load constant value 1 into $v0 sw $v0, -24($fp) # spill _tmp4 from $v0 to $fp-24 # Return _tmp4 lw $v0, -24($fp) # fill _tmp4 to $v0 from $fp-24 move $v0, $v0 # assign return value into $v0 move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _L0: # _tmp5 = 1 li $v0, 1 # load constant value 1 into $v0 sw $v0, -28($fp) # spill _tmp5 from $v0 to $fp-28 # _tmp6 = n - _tmp5 lw $v0, 4($fp) # fill n to $v0 from $fp+4 lw $v1, -28($fp) # fill _tmp5 to $v1 from $fp-28 sub $v0, $v0, $v1 sw $v0, -32($fp) # spill _tmp6 from $v0 to $fp-32 # PushParam _tmp6 subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -32($fp) # fill _tmp6 to $v0 from $fp-32 sw $v0, 4($sp) # copy param value to stack # _tmp7 = LCall _factorial jal _factorial # jump to function move $v0, $v0 # copy function return value from $v0 sw $v0, -36($fp) # spill _tmp7 from $v0 to $fp-36 # PopParams 4 add $sp, $sp, 4 # pop params off stack # _tmp8 = n * _tmp7 lw $v0, 4($fp) # fill n to $v0 from $fp+4 lw $v1, -36($fp) # fill _tmp7 to $v1 from $fp-36 mul $v0, $v0, $v1 sw $v0, -40($fp) # spill _tmp8 from $v0 to $fp-40 # Return _tmp8 lw $v0, -40($fp) # fill _tmp8 to $v0 from $fp-40 move $v0, $v0 # assign return value into $v0 move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function main: # BeginFunc 48 subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp subu $sp, $sp, 48 # decrement sp to make space for locals/temps # _tmp9 = 1 li $v0, 1 # load constant value 1 into $v0 sw $v0, -12($fp) # spill _tmp9 from $v0 to $fp-12 # n = _tmp9 lw $v0, -12($fp) # fill _tmp9 to $v0 from $fp-12 sw $v0, -8($fp) # spill n from $v0 to $fp-8 _L1: # _tmp10 = 15 li $v0, 15 # load constant value 15 into $v0 sw $v0, -16($fp) # spill _tmp10 from $v0 to $fp-16 # _tmp11 = n < _tmp10 lw $v0, -8($fp) # fill n to $v0 from $fp-8 lw $v1, -16($fp) # fill _tmp10 to $v1 from $fp-16 slt $v0, $v0, $v1 sw $v0, -20($fp) # spill _tmp11 from $v0 to $fp-20 # _tmp12 = n == _tmp10 lw $v0, -8($fp) # fill n to $v0 from $fp-8 lw $v1, -16($fp) # fill _tmp10 to $v1 from $fp-16 seq $v0, $v0, $v1 sw $v0, -24($fp) # spill _tmp12 from $v0 to $fp-24 # _tmp13 = _tmp11 || _tmp12 lw $v0, -20($fp) # fill _tmp11 to $v0 from $fp-20 lw $v1, -24($fp) # fill _tmp12 to $v1 from $fp-24 or $v0, $v0, $v1 sw $v0, -28($fp) # spill _tmp13 from $v0 to $fp-28 # IfZ _tmp13 Goto _L2 lw $v0, -28($fp) # fill _tmp13 to $v0 from $fp-28 beqz $v0, _L2 # branch if _tmp13 is zero # _tmp14 = "Factorial(" .data # create string constant marked with label _string1: .asciiz "Factorial(" .text la $v0, _string1 # load label sw $v0, -32($fp) # spill _tmp14 from $v0 to $fp-32 # PushParam _tmp14 subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -32($fp) # fill _tmp14 to $v0 from $fp-32 sw $v0, 4($sp) # copy param value to stack # LCall _PrintString jal _PrintString # jump to function # PopParams 4 add $sp, $sp, 4 # pop params off stack # PushParam n subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -8($fp) # fill n to $v0 from $fp-8 sw $v0, 4($sp) # copy param value to stack # LCall _PrintInt jal _PrintInt # jump to function # PopParams 4 add $sp, $sp, 4 # pop params off stack # _tmp15 = ") = " .data # create string constant marked with label _string2: .asciiz ") = " .text la $v0, _string2 # load label sw $v0, -36($fp) # spill _tmp15 from $v0 to $fp-36 # PushParam _tmp15 subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -36($fp) # fill _tmp15 to $v0 from $fp-36 sw $v0, 4($sp) # copy param value to stack # LCall _PrintString jal _PrintString # jump to function # PopParams 4 add $sp, $sp, 4 # pop params off stack # PushParam n subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -8($fp) # fill n to $v0 from $fp-8 sw $v0, 4($sp) # copy param value to stack # _tmp16 = LCall _factorial jal _factorial # jump to function move $v0, $v0 # copy function return value from $v0 sw $v0, -40($fp) # spill _tmp16 from $v0 to $fp-40 # PopParams 4 add $sp, $sp, 4 # pop params off stack # PushParam _tmp16 subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -40($fp) # fill _tmp16 to $v0 from $fp-40 sw $v0, 4($sp) # copy param value to stack # LCall _PrintInt jal _PrintInt # jump to function # PopParams 4 add $sp, $sp, 4 # pop params off stack # _tmp17 = "\n" .data # create string constant marked with label _string3: .asciiz "\n" .text la $v0, _string3 # load label sw $v0, -44($fp) # spill _tmp17 from $v0 to $fp-44 # PushParam _tmp17 subu $sp, $sp, 4 # decrement sp to make space for param lw $v0, -44($fp) # fill _tmp17 to $v0 from $fp-44 sw $v0, 4($sp) # copy param value to stack # LCall _PrintString jal _PrintString # jump to function # PopParams 4 add $sp, $sp, 4 # pop params off stack # _tmp18 = 1 li $v0, 1 # load constant value 1 into $v0 sw $v0, -48($fp) # spill _tmp18 from $v0 to $fp-48 # _tmp19 = n + _tmp18 lw $v0, -8($fp) # fill n to $v0 from $fp-8 lw $v1, -48($fp) # fill _tmp18 to $v1 from $fp-48 add $v0, $v0, $v1 sw $v0, -52($fp) # spill _tmp19 from $v0 to $fp-52 # n = _tmp19 lw $v0, -52($fp) # fill _tmp19 to $v0 from $fp-52 sw $v0, -8($fp) # spill n from $v0 to $fp-8 # Goto _L1 b _L1 # unconditional branch _L2: # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _PrintInt: subu $sp, $sp, 8 # decrement sp to make space to save ra,fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp lw $a0, 4($fp) # fill a from $fp+4 # LCall _PrintInt li $v0, 1 syscall # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _ReadInteger: subu $sp, $sp, 8 # decrement sp to make space to save ra,fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp li $v0, 5 syscall # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _PrintBool: subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp lw $a0, 4($fp) # fill a from $fp+4 li $v0, 4 beq $a0, $0, PrintBoolFalse la $a0, _PrintBoolTrueString j PrintBoolEnd PrintBoolFalse: la $a0, _PrintBoolFalseString PrintBoolEnd: syscall # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function .data # create string constant marked with label _PrintBoolTrueString: .asciiz "true" .text .data # create string constant marked with label _PrintBoolFalseString: .asciiz "false" .text _PrintString: subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp lw $a0, 4($fp) # fill a from $fp+4 li $v0, 4 syscall # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _Alloc: subu $sp, $sp, 8 # decrement sp to make space to save ra,fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp lw $a0, 4($fp) # fill a from $fp+4 li $v0, 9 syscall # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _Halt: li $v0, 10 syscall # EndFunc _StringEqual: subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp lw $a0, 4($fp) # fill a from $fp+4 lw $a1, 8($fp) # fill a from $fp+8 beq $a0,$a1,Lrunt10 Lrunt12: lbu $v0,($a0) lbu $a2,($a1) bne $v0,$a2,Lrunt11 addiu $a0,$a0,1 addiu $a1,$a1,1 bne $v0,$0,Lrunt12 li $v0,1 j Lrunt10 Lrunt11: li $v0,0 Lrunt10: # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function _ReadLine: subu $sp, $sp, 8 # decrement sp to make space to save ra, fp sw $fp, 8($sp) # save fp sw $ra, 4($sp) # save ra addiu $fp, $sp, 8 # set up new fp li $a0, 101 li $v0, 9 syscall addi $a0, $v0, 0 li $v0, 8 li $a1,101 syscall addiu $v0,$a0,0 # pointer to begin of string Lrunt21: lb $a1,($a0) # load character at pointer addiu $a0,$a0,1 # forward pointer bnez $a1,Lrunt21 # loop until end of string is reached lb $a1,-2($a0) # load character before end of string li $a2,10 # newline character bneq $a1,$a2,Lrunt20 # do not remove last character if not newline sb $0,-2($a0) # Add the terminating character in its place Lrunt20: # EndFunc # (below handles reaching end of fn body with no explicit return) move $sp, $fp # pop callee frame off stack lw $ra, -4($fp) # restore saved ra lw $fp, 0($fp) # restore saved fp jr $ra # return from function
;------------------------------- ; examine.asm - NEX file header examinator for sjasmplus ; © Peter Helcmanovsky 2020, license: https://opensource.org/licenses/MIT ; ; Assembles with sjasmplus - https://github.com/z00m128/sjasmplus (v1.18.0+) ; Usage: sjasmplus --msg=war examine.asm -DNEX_FILE=\"some.nex\" ; ; The NEX file format: https://specnext.dev/wiki/NEX_file_format ; ; This is using sjasmplus macro-language at assembling time to load and display ; NEX file header data, edit the NEX file name here in the source ; before "assembling" to examine it, or use -DNEX_FILE=\"some.nex\" IFNDEF NEX_FILE DEFINE NEX_FILE "some.nex" ENDIF DEVICE ZXSPECTRUMNEXT : OPT -Wno-backslash ORG 0 INCBIN NEX_FILE, 0, 512 ; read only header into memory at ORG0 ; get real file length (can't be done with sj native directives, lua script needed) LUA ALLPASS fnameDef = sj.get_define("NEX_FILE") fnameFirst = string.char(string.byte(fnameDef)) fnameLast = string.char(string.byte(fnameDef,-1)) -- strip quotes/apostrophes from fnameDef (they are there for INCBIN in asm part) if fnameFirst == fnameLast and ('"' == fnameFirst or "'" == fnameFirst) then fnameDef = string.sub(fnameDef, 2, string.len(fnameDef)-1) end nexfile = io.open(fnameDef,"r") if nexfile then fsize = nexfile:seek("end") io.close(nexfile) sj.insert_label("NEX_SIZE", fsize) else sj.insert_label("NEX_SIZE", 0) end ENDLUA ASSERT 0 < NEX_SIZE ;------------------------------- ; internal struct definitions NEXLOAD_MAX_BANK EQU 112 NEXLOAD_LOADSCR_LAYER2 EQU 1 ; loads palette by default NEXLOAD_LOADSCR_ULA EQU 2 ; can't have palette NEXLOAD_LOADSCR_LORES EQU 4 ; loads palette by default NEXLOAD_LOADSCR_HIRES EQU 8 ; Timex HiRes (no palette) NEXLOAD_LOADSCR_HICOL EQU 16 ; Timex HiCol (no palette) NEXLOAD_LOADSCR_EXT2 EQU 64 ; activate extension LOADSCR2 field in V1.3 NEXLOAD_LOADSCR_NOPAL EQU 128 ; no palette for Layer2/Lores NEXLOAD_LOADSCR_HASPAL EQU NEXLOAD_LOADSCR_LAYER2|NEXLOAD_LOADSCR_LORES|NEXLOAD_LOADSCR_EXT2 NEXLOAD_LOADSCR2_NONE EQU 0 NEXLOAD_LOADSCR2_320x256x8 EQU 1 NEXLOAD_LOADSCR2_640x256x4 EQU 2 NEXLOAD_LOADSCR2_TILEMODE EQU 3 STRUCT NEXLOAD_FILE_VERSION DS 1, 'V' V_MAJOR DB '1' DS 1, '.' V_MINOR DB '3' ENDS STRUCT NEXLOAD_CORE_VERSION V_MAJOR DB 2 V_MINOR DB 0 V_SUBMINOR DB 0 ENDS STRUCT NEXLOAD_HEADER DS 1, 'N' DS 1, 'e' DS 1, 'x' DS 1, 't' NEXVERSION NEXLOAD_FILE_VERSION ; file version (V1.2 is current) RAMREQ DB ; 0 = 768k, 1 = 1792k NUMBANKS DB ; number of 16k banks to load (0..112) LOADSCR DB ; see NEXLOAD_LOADSCR constants (bitmask flags) BORDERCOL DB ; 0-7 SP DW ; stack pointer PC DW 0 ; entry point (in default MMU 16k mapping FF:5:2:0) (0=no start, only load) DS 2, 0 ; "NUMFILES" - obsolete, keep zeroed BANKS DS NEXLOAD_MAX_BANK, 0 ; 112 banks in total = 1.75MiB ; 0/1 false/true array LOADBAR DB 0 ; 0/1 show Layer2 progress bar LOADBARCOL DB 0 ; colour of progress bar LOADDELAY DB 0 ; delay after each bank is loaded (1/50th of sec) STARTDELAY DB 0 ; delay after whole file is loaded (before app entry) 1/50th PRESERVENEXTREG DB 0 ; 0/1: 0=reset NextRegs to almost-defaults, 1=keep them as they are COREVERSION NEXLOAD_CORE_VERSION ; required minimal core version HIRESCOL DB 0 ; Timex 512x192 mode colour for port 255 (bits 5-3) ENTRYBANK DB 0 ; Bank to page into C000..FFFF area before start of NEX code FILEHANDLERET DW 0 ; 0 = close file, 1..$3FFF = BC contains file handle ; $4000+ = file handle is written into memory at this address (after ENTRYBANK is paged in) ; V1.3 features EXPBUSDISABLE DB 0 ; 0 = disable expansion bus in NextReg $80, 1 = do not modify $80 HASCHECKSUM DB 0 ; 0 = no checksum, 1 = has CRC-32C (Castagnoli) checksum (see end of header CRC32C field) BANKSOFFSET DD 0 ; where in the file the first bank starts (mandatory value, only V1.0-V1.2 can have 0) ; Can be used in future by loaders to try to load even file versions unknown to them (or emus to speed up loading) - ; as BANKS + BANKSOFFSET should cover the "important" part of file, and between are loader screens/etc. ; but some SW may expect the initial state of machine to include the loader screens, so this may then break the SW CLIBUFFER DW 0 ; pointer to buffer for copy of original command line (after ENTRYBANK is paged in) CLIBUFFERSIZE DW 0 ; buffer size - the string is zero/enter/colon terminated if smaller, else truncated (no terminator) ; if CLIBUFFER is set, DE is initially set to the CLIBUFFER value (no length info, code must know) ; max buffer size is 2048, if the app needs longer argument lines, preserve banks which contain BASIC sysvars and edit line ; and search for the full line remaining in original position (locate by clibuffer content or sysvars) LOADSCR2 DB 0 ; when LOADSCR |= 64 ; 1 = Layer 2 320x256x8bpp (NOPAL flag from LOADSCR does apply): [512B palette +] 81920B data (HIRESCOL is L2 palette offset) ; 2 = Layer 2 640x256x4bpp (NOPAL flag from LOADSCR does apply): [512B palette +] 81920B data (HIRESCOL is L2 palette offset) ; 3 = Tilemode - config data are in TILESCRCONFIG array, (NOPAL flag from LOADSCR does apply): [512B palette] ; Tilemap data are expected to be stored in regular bank 5 - no specialized data block, bank 5 is first any way HASCOPPERCODE DB 0 ; 1 = copper code 2048B block after last screen block, starts Copper with %01 control code TILESCRCONFIG DS 4, 0 ; NextReg registers $6B, $6C, $6E, $6F values for Tilemode screen loader BIGL2BARPOSY DB 0 ; Y position (0..255) of loading bar for new Layer 2 320x256 and 640x256 modes RESERVED DS 508-NEXLOAD_HEADER.RESERVED,0 ; fill up with zeroes to size 512 CRC32C DD 0 ; little-endian uint32_t checksum value (for external tools, not used by loaders) ; the checksum is calculated as: file offset 512 -> <EOF>, then first 508 bytes (header w/o last 4B) ; last 4B of header (offset 508) will be the CRC-32C value itself (not included in CRC calculation) ; (expect most of the NEX files to omit the CRC value) (note the CRC covers also appended binary data) ENDS ASSERT 512 == NEXLOAD_HEADER ;------------------------------- ; examinator + display info head NEXLOAD_HEADER = $0000 ; use the structure to access the header data DISPLAY "Examining file: ",NEX_FILE IF 'eN' != { head } || 'tx' != { head+2 } DISPLAY "First four bytes are not \"Next\": ",/C,{b head+0},/C,{b head+1},/C,{b head+2},/C,{b head+3} ENDIF IF 'V' != {b head.NEXVERSION } || '.' != {b head.NEXVERSION+2 } DISPLAY "Weird file version, not \"Vx.y\": ",/C,{b head.NEXVERSION+0},/C,{b head.NEXVERSION+1},/C,{b head.NEXVERSION+2},/C,{b head.NEXVERSION+3} ELSE DISPLAY "File version: ",/C,{b head.NEXVERSION+1},".",/C,{b head.NEXVERSION+3} IF '1' == {b head.NEXVERSION+1} && '3' == {b head.NEXVERSION+3} DISPLAY "WARNING: V1.3 is unofficial extension by Ped7g, not supportted by NextZXOS .nexload" ENDIF ENDIF IF {b head.RAMREQ} : DEFINE+ RAMREQ_INFO " (1792ki)" : ELSE : DEFINE+ RAMREQ_INFO " (768ki)" : ENDIF DEFINE CORE_VERSION /D,{b head.COREVERSION.V_MAJOR},".",/D,{b head.COREVERSION.V_MINOR},".",/D,{b head.COREVERSION.V_SUBMINOR} DISPLAY "Required RAM: ",/D,{b head.RAMREQ},RAMREQ_INFO,", Required core version: ",CORE_VERSION IF 0 == {b head.COREVERSION.V_MAJOR} && {b head.COREVERSION.V_MINOR} DISPLAY "WARNING: seems the required core major/minor values are swapped" ENDIF palSize = 0 screenSize = 0 IF {b head.LOADSCR} IF {b head.LOADSCR} & NEXLOAD_LOADSCR_NOPAL DISPLAY "load screen: +no palette" ELSEIF {b head.LOADSCR} & NEXLOAD_LOADSCR_HASPAL DISPLAY "load screen: +palette" palSize = 512 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_LAYER2 DISPLAY "load screen: layer2 256x192 8bpp" screenSize = screenSize + 256*192 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_ULA DISPLAY "load screen: ULA 256x192 6912B" screenSize = screenSize + 6912 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_LORES DISPLAY "load screen: LoRes 128x96 8bpp" screenSize = screenSize + 128*96 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_HIRES DISPLAY "load screen: Timex HiRes 512x192 1bpp Color 0..7: ",/D,{b head.HIRESCOL}/8 screenSize = screenSize + 2*32*192 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_HICOL DISPLAY "load screen: Timex HiCol 256x192 8x1 attributes" screenSize = screenSize + 2*32*192 ENDIF IF {b head.LOADSCR} & NEXLOAD_LOADSCR_EXT2 DISPLAY "load screen: +V1.3 extensions (TODO to display)" ;TODO add V1.3 parsing ENDIF ELSE DISPLAY "No loading screen" ENDIF IF {b head.LOADBAR} DISPLAY "Border colour: ",/D,{b head.BORDERCOL},", show progress bar, colour: ",{b head.LOADBARCOL} ELSE DISPLAY "Border colour: ",/D,{b head.BORDERCOL},", no progress bar" ENDIF DISPLAY "Delay after each bank: ",/D,{b head.LOADDELAY},", before start: ",/D,{b head.STARTDELAY} IF {b head.PRESERVENEXTREG} : DEFINE+ PRESERVE_INFO " (preserve current)" : ELSE : DEFINE+ PRESERVE_INFO " (reset to NEX defaults)" : ENDIF DISPLAY "Preserve next registers: ",/D,{b head.PRESERVENEXTREG},PRESERVE_INFO IF 0 < palSize : DEFINE+ PAL_SIZE_INFO ," + ",/D,palSize," (pal)" : ELSE : DEFINE+ PAL_SIZE_INFO : ENDIF IF 0 < screenSize : DEFINE+ SCREEN_SIZE_INFO ," + ",/D,screenSize," (screen(s))" : ELSE : DEFINE+ SCREEN_SIZE_INFO : ENDIF banksSize = {b head.NUMBANKS}*(1<<14) IF 0 < banksSize : DEFINE+ BANKS_SIZE_INFO ," + ",/D,banksSize," (banks)" : ELSE : DEFINE+ BANKS_SIZE_INFO : ENDIF dataSize = NEX_SIZE - (512 + palSize + screenSize + banksSize) IF 0 < dataSize : DEFINE+ DATA_SIZE_INFO ," + ",/D,dataSize," (data)" : ELSE : DEFINE+ DATA_SIZE_INFO : ENDIF totalSize = 512 + palSize + screenSize + banksSize + dataSize DISPLAY "File size: 512 (header)" PAL_SIZE_INFO SCREEN_SIZE_INFO BANKS_SIZE_INFO DATA_SIZE_INFO," = ",/D,totalSize IF 0 < {head.PC} : DEFINE+ PCVAL_INFO /A,{head.PC} : ELSE : DEFINE+ PCVAL_INFO "no start" : ENDIF DISPLAY "PC = ",PCVAL_INFO, " | SP = ",/A,{head.SP} DISPLAY "Banks to load (counter): ",/D,{b head.NUMBANKS},", code-entry-bank ($C000): ",/D,{b head.ENTRYBANK} pcBank = (({head.PC}>>14) * 5) & 7 ; 0, 5, 2, 7 IF 7 == pcBank pcBank = {b head.ENTRYBANK} ENDIF spBank = (((({head.SP}-1)>>14)&3) * 5) & 7 ; 0, 5, 2, 7 WRT "SP-1" IF 7 == spBank spBank = {b head.ENTRYBANK} ENDIF bankI = 0 bankRangeB = -1 missingMemRequired = 0 DUP NEXLOAD_MAX_BANK + 1 IF 48 <= bankI && {b head.BANKS + bankI} && !{b head.RAMREQ} missingMemRequired = -1 ENDIF IF NEXLOAD_MAX_BANK == bankI || 5 == bankI || 2 == bankI || {b head.ENTRYBANK} == bankI || 8 == bankI || !{b head.BANKS + bankI} ; display previous range IF 0 <= bankRangeB IF (bankI - bankRangeB) < 3 ; 1 or 2 banks -> individual lines DUP (bankI - bankRangeB) DISPLAY "+ bank ",/D,bankRangeB bankRangeB = bankRangeB + 1 EDUP ELSE ; 3+ banks -> range line DISPLAY "+ banks ",/D,bankRangeB,"..",/D,bankI-1 ENDIF ENDIF bankRangeB = -1 ; reset range ; if one of the mapped banks with extra info (never displayed in range) -> display IF bankI < NEXLOAD_MAX_BANK && {b head.BANKS + bankI} DEFINE+ BANK_PC_INFO "" IF pcBank == bankI : DEFINE+ BANK_PC_INFO " <- PC -<" : ENDIF DEFINE+ BANK_SP_INFO "" IF spBank == bankI : DEFINE+ BANK_SP_INFO " [SP]" : ENDIF IF 8 == bankI : DEFINE+ BANK_INFO BANK_PC_INFO,BANK_SP_INFO," (WARNING: kills NextZXOS browser data)" : ENDIF IF 5 == bankI : DEFINE+ BANK_INFO " ($4000..$7FFF)",BANK_PC_INFO,BANK_SP_INFO," (WARNING: kills NextZXOS sysvars)" : ENDIF IF 2 == bankI : DEFINE+ BANK_INFO " ($8000..$BFFF)",BANK_PC_INFO,BANK_SP_INFO : ENDIF IF {b head.ENTRYBANK} == bankI : DEFINE+ BANK_INFO " ($C000..$FFFF)",BANK_PC_INFO,BANK_SP_INFO : ENDIF DISPLAY "+ bank ",/D,bankI,BANK_INFO ENDIF ELSEIF -1 == bankRangeB ; regular bank starting new range bankRangeB = bankI ENDIF bankI = bankI + 1 EDUP IF missingMemRequired DISPLAY "WARNING: the file contains bank 48 or higher, but does not have \"require 2MB\" flag set" ENDIF IF {head.FILEHANDLERET} IF {head.FILEHANDLERET} < $4000 DISPLAY "NEX file handle passed in BC" ELSE DISPLAY "NEX file handle written to: ",/A,{head.FILEHANDLERET} ENDIF ELSE DISPLAY "NEX file will be closed after load (no file handle passed)." ENDIF
INCLUDE "hardware.inc" ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- SECTION "VBlank Interrupt", ROM0[$0040] jp vblank_handle ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- SECTION "Header", ROM0[$0100] jp Start ;------------------------------------------------------------------------------- ;------------------------------------------------------------------------------- SECTION "Game code", ROM0[$0150] Start: di ; disable interrupts ld sp, $E000 ; setup stack .wait_vbl ; wait for vblank to properly disable lcd ld a,[rLY] ; removing this permanently fucks up the LCD cp $90 ; Wait for line 144 jr nz, .wait_vbl ; Turn lcd off ld a, 0 ld [rLCDC], a ; Shut sound down ld a, 0 ld [rNR52], a ; Clear memory ld hl, _RAM ld bc, $2000-2 ; watch out for stack call fill ; Clear HRAM ld hl, _HRAM ld bc, $fffe - $ff80 call fill ; Clear VRAM ld hl, _VRAM ld bc, $1800 call fill ; Copy DMA code to HRAM ld hl, _HRAM ; HRAM address is the destination ld de, dma_wait_code ld bc, 10 ; dma sub routine is 10 bytes long call copy ; Copy Fonts to VRAM ld hl, $9000 ld de, FontTiles ld bc, FontTilesEnd - FontTiles call copy ; Copy Sprites to VRAM ld hl, $83F0 ld de, sprites ld bc, 64 ; Each sprite is 16 bytes call copy ; Copy text to vram ld hl, $9800 ld de, HelloWorldStr call copyString ; OAM stuff ld a, 80 ; OAM table mirror is located at $C000, let's set up 1st sprite ld [$C000], a ; Y position ld a, 82 ld [$C001], a ; X position ld a, $3f ld [$C002], a ; Tile/Pattern Number ld a, %00000000 ld [$C003], a ; Attributes/Flags ld a, 80 ld [$C000 + 4], a ld a, 90 ld [$C001 + 4], a ld a, $41 ld [$C002 + 4], a ld a, %00000000 ld [$C003 + 4], a ld a, 88 ld [$C000 + 8], a ld a, 90 ld [$C001 + 8], a ld a, $42 ld [$C002 + 8], a ld a, %00000000 ld [$C003 + 8], a ld a, 88 ld [$C000 + 12], a ld a, 82 ld [$C001 + 12], a ld a, $40 ld [$C002 + 12], a ld a, %00000000 ld [$C003 + 12], a ; Init palette ld a, %11100100 ; 00 is white, 11 is black, the rest is gray ld [rBGP], a ld [rOBP0], a ld [rOBP1], a ; LCD initialization ld a, 0 ld [rIF], a ld [rLCDC], a ld [rSTAT], a ld [rSCX], a ld [rSCY], a ld [rLYC], a ld [rIE], a ld [rSCY], a ld [rSCX], a ; Enable LCD ld a, LCDCF_ON | LCDCF_OBJON | LCDCF_BGON ;ld a, %10000001 ld [rLCDC], a ; Enable vblank interrupts ld a, IEF_VBLANK ld [rIE], a ei ; Enable interrupts again ;------------------------------------------------------------------------------- .mainLoop ;------------------------------------------------------------------------------- halt ; sleep until an interrupt happens jp .mainLoop ;------------------------------------------------------------------------------- ; Tetris read keys function read_keys: ; @return: b -> raw state ; @return: c -> debounced state ;------------------------------------------------------------------------------- ld a, $20 ; get a, b, select, start ldh [rP1], a ldh a, [rP1] ldh a, [rP1] cpl ; Invert all the bits to make 1 mean pressed and $0f ; only keep the lower 4 bits, which has a, b, select and start swap a ; Swap nibbles ld b, a ld a, $10 ; get up, down, left, right ldh [rP1], a ldh a, [rP1] ldh a, [rP1] ldh a, [rP1] ldh a, [rP1] ldh a, [rP1] ldh a, [rP1] cpl ; Invert all the bits to make 1 mean pressed and $0f ; keep lower 4 bits, which has up, down, left and right or b ; combine the state of all keys into a byte ld b, a ; store it ldh a, [previous] ; xor b ; Check which keys changed and b ; Only keep the keys that were pressed (i.e. throw away the releases) ldh [current], a ; Store the current state ld c, a ; Copy debounced state to c ld a, b ; Copy current state to b ldh [previous], a ; Store previous state ld a, $30 ; reset rP1 ldh [rP1], a ret ;------------------------------------------------------------------------------- ; copies [bc] bytes from [de] to [dl] copy: ; @param: de -> source ; @param: bc -> byte count ; @param: hl -> destination ;------------------------------------------------------------------------------- ld a, [de] ; Grab 1 byte from the source ld [hli], a ; Place it at the destination inc de ; Move to next byte dec bc ; Decrement count ld a, b ; Check if count is 0, since `dec bc` doesn't update flags or c jr nz, copy ret ;------------------------------------------------------------------------------- ; Copies [de] to [hl] until a zero is found copyString: ; @param: de -> source ; @param: hl -> destination ;------------------------------------------------------------------------------- ld a, [de] ld [hli], a inc de and a ; Check if the byte we just copied is zero jr nz, copyString ; Continue if it's not ret ;------------------------------------------------------------------------------- ; Fill [bc] bytes starting from [hl] with the value in a fill: ; @param: a -> byte to fill with ; @param: hl -> destination address ; @param: bc -> size of area to fill ;------------------------------------------------------------------------------- inc b inc c jr .skip .fill ld [hl+], a .skip dec c jr nz, .fill dec b jr nz, .fill ret ;------------------------------------------------------------------------------- vblank_handle: call $FF80 ; copy OAM mirror table using DMA reti ;------------------------------------------------------------------------------- dma_wait_code: ;------------------------------------------------------------------------------- .run_dma ld a, $c0 ldh [$FF46], a ; start DMA transfer (starts right after instruction) ld a, $28 ; delay .wait: ; total 4x40 cycles, approx 160 μs dec a ; 1 cycle jr nz, .wait ; 3 cycles ret ;------------------------------------------------------------------------------- SECTION "Vars", HRAM[$FF8A] current: DS 1 ; Currently pressed keys previous: DS 1 ; Debounced keys ;------------------------------------------------------------------------------- SECTION "Font", ROM0 FontTiles: INCBIN "font.chr" FontTilesEnd: ;------------------------------------------------------------------------------- SECTION "Hello World string", ROM0 HelloWorldStr: db "Hello World", 0 sprites: db $00, $00, $00, $00, $07, $07, $0f, $0f, $1f, $1f, $1f, $1f, $19, $19, $11, $11 db $11, $11, $1f, $1f, $0e, $0e, $07, $07, $07, $07, $05, $05, $00, $00, $00, $00 db $00, $00, $00, $00, $f0, $f0, $f8, $f8, $fc, $fc, $fc, $fc, $cc, $cc, $c4, $c4 db $c4, $c4, $7c, $7c, $38, $38, $f0, $f0, $f0, $f0, $50, $50, $00, $00, $00, $00
; A023376: a(n+1) = a(n) converted to base 8 from base 4 (written in base 10). ; Submitted by Jon Maiga ; 4,8,16,64,512,8192,524288,268435456,4398046511104,9223372036854775808,19807040628566084398385987584,2787593149816327892691964784081045188247552,3291009114642412084309938365114701009965471731267159726697218048,133499189745056880149688856635597007162669032647290798121690100488888732861290034376435130433536,48777321098687378615337456715518223527321845979140174232174327494146433419058837814379782860367062049372295798771978482741374619988879457910784 seq $0,156623 ; Values of register b when register a becomes 0 for the two register machine {i[1], i[1], i[1], d[2,1], d[1,6], i[2], d[1,5], d[2,3]} add $0,1 mov $1,2 pow $1,$0 mov $0,$1
SECTION code_graphics PUBLIC xordrawr PUBLIC _xordrawr EXTERN xorplot EXTERN commondrawr ;void xordrawr(int x2, int y2) __smallc ;Note ints are actually uint8_t xordrawr: _xordrawr: ld hl,xorplot jp commondrawr
;;; Some vanilla bugfixes included in all VARIA seeds ;;; compile with asar arch snes.cpu lorom ;;; skips suits acquisition animation org $848717 rep 4 : nop ;;; fix to speed echoes bug when hell running org $91b629 db $01 ;;; disable GT code org $aac91c bra $3f ;;; Pause menu fixes : ;;; disable spacetime beam select in pause menu org $82b174 ldx #$0001 ;;; fix screw attack select in pause menu org $82b4c4 cpx #$000c ;;; In inventory menu, when having only a beam and a suit you have ;;; to press right+up to go from beam to suit. ;;; It's not natural, so fix it to only require right. org $82b000 ;; test of return of $B4B7 compare A and #$0000, ;; when no item found A==#$ffff, which sets the carry, ;; so when carry is clear it means that an item was found in misc. ;; if no item was found in misc, we check in boots then in suits, ;; so if an item is found in both boots and suits, as suits is ;; tested last the selection will be set on suits. bcc $64 ;;; fix morph ball in hidden chozo PLM org $84e8ce db $04 org $84ee02 db $04 ;;; To allow area transition blinking doors in rooms with no enemies, ;;; fixes enemies loading so that when there are no enemies, some values ;;; are still reset org $a08ae5 ;; hijack enemy list empty check jsr check_empty org $a0f820 check_empty: cmp #$ffff ; original empty enemy list check bne .end ; it not empty: return stz $0e4e ; nb of enemies in the room = 0 stz $0e52 ; nb of enemies needed to clear the room = 0 .end: rts warnpc $a0f830 ;;; Fixes for the extra save stations in area rando/random start : ;;; allow all possible save slots (needed for area rando extra stations) org $848d0c and #$001f ;;; For an unknown reason, the save station we put in main street ;;; sometimes (circumstances unclear) spawn two detection PLMs ;;; instead of one. These PLMs are supposed to precisely detect ;;; when Samus is standing on the save. When Samus does, it looks ;;; for a PLM at the same coordinates as itself, which is normally ;;; the actual save station PLM. ;;; But when two detection blocks are spawn, it detects the other detection ;;; block as being the save, and the save station doesn't work. ;;; Therefore, we add an extra check on PLM type to double check it has ;;; actually found the save station PLM. ;;; hijack in detection block PLM code when samus is ;;; positioned correctly org $84b5d4 search_loop_start: jmp save_station_check org $84b5d9 search_loop_cont: org $84b5df search_loop_found: ;;; some unused bank 84 space org $84858c save_station_check: cmp $1c87,x ; original block coord check beq .coords_ok jmp search_loop_cont .coords_ok: pha lda $1c37,x : cmp #$b76f ; check if PLM ID is save station beq .save_ok pla jmp search_loop_cont .save_ok: pla jmp search_loop_found ;;; end of unused space warnpc $8485b2
; A075747: Numbers n such that 210*n + 17 is prime. ; Submitted by Jon Maiga ; 0,1,3,4,6,7,8,9,14,15,18,19,20,22,26,28,30,32,33,36,41,42,44,45,46,47,52,56,57,58,62,64,66,67,70,72,75,77,79,81,84,86,87,90,96,99,100,101,103,105,106,108,109,110,111,112,113,114,123,125,127,129,131,132,133,139,142,143,145,146,149,150,151,157,160,161,164,165,166,169,172,175,178,179,182,183,185,191,196,197,198,200,201,202,205,207,212,216,217,224 mov $1,4 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,2 mov $3,$1 mul $3,3 add $3,4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,35 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 div $0,70
/***************************************************************************** * * * OpenNI 2.x Alpha * * Copyright (C) 2012 PrimeSense Ltd. * * * * This file is part of OpenNI. * * * * 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. * * * *****************************************************************************/ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include <XnIOFileStream.h> //--------------------------------------------------------------------------- // Code //--------------------------------------------------------------------------- XnIOFileStream::XnIOFileStream(const XnChar* pcsFileName, XnUInt32 nFlags) : m_pcsFileName(pcsFileName), m_nFlags(nFlags) { } XnStatus XnIOFileStream::Init() { XnStatus nRetVal = XN_STATUS_OK; nRetVal = xnOSOpenFile(m_pcsFileName, m_nFlags, &m_hFile); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); } XnStatus XnIOFileStream::Free() { return xnOSCloseFile(&m_hFile); } XnStatus XnIOFileStream::WriteData(const XnUChar *pData, XnUInt32 nDataSize) { return xnOSWriteFile(m_hFile, pData, nDataSize); } XnStatus XnIOFileStream::ReadData(XnUChar *pData, XnUInt32 nDataSize) { XnStatus nRetVal = XN_STATUS_OK; XnUInt32 nReadSize = nDataSize; nRetVal = xnOSReadFile(m_hFile, pData, &nReadSize); XN_IS_STATUS_OK(nRetVal); if (nReadSize != nDataSize) { return XN_STATUS_OS_FILE_READ_FAILED; } return (XN_STATUS_OK); } XnStatus XnIOFileStream::Tell(XnUInt64* pnOffset) { return xnOSTellFile64(m_hFile, pnOffset); } XnStatus XnIOFileStream::Seek(XnUInt64 nOffset) { return xnOSSeekFile64(m_hFile, XN_OS_SEEK_SET, nOffset); }
db DEX_BELLSPROUT ; pokedex id db 50 ; base hp db 75 ; base attack db 35 ; base defense db 40 ; base speed db 70 ; base special db GRASS ; species type 1 db POISON ; species type 2 db 255 ; catch rate db 84 ; base exp yield INCBIN "pic/bmon/bellsprout.pic",0,1 ; 55, sprite dimensions dw BellsproutPicFront dw BellsproutPicBack ; attacks known at lvl 0 db VINE_WHIP db GROWTH db 0 db 0 db 3 ; growth rate ; learnset tmlearn 3,6 tmlearn 9,10 tmlearn 20,21,22 tmlearn 31,32 tmlearn 33,34 tmlearn 44 tmlearn 50,51 db 0 ; padding
LDA F100 MVI H, 00 MOV B, A RRC MOV C, A LXI D, F200 LOOP: MOV A, B CALL REM DCR C JNZ LOOP LDA F300 MOV B, A MVI A, 00 LOOP2: ADD B DCR B JNZ LOOP2 MOV B, A LDA F100 MVI C, 01 CMP B JZ PERFECT DCR C PERFECT: MOV A, C STA F400 HLT REM: MOV L, C LOOP1: CMP L JC END SUB L JMP LOOP1 END: CPI 00 JNZ NO MOV A, C STAX D INX D INR H MOV A, H STA F300 NO: RET
;-------------------------------------------------------------------------------- ; OnLoadOW ;-------------------------------------------------------------------------------- OnLoadMap: JSL.l SetLWDWMap LDA $7EF2DB ; thing we wrote over RTL ;-------------------------------------------------------------------------------- OnDrawHud: JSL.l Draw4DigitRupees ;JSL.l DrawChallengeTimer ;JSL.l DrawGoalIndicator ;JSL.l DrawDungeonCompassCounts ;JSL.l SwapSpriteIfNecissary RTL ;-------------------------------------------------------------------------------- ;OnDungeonEntrance: ; STA $7EC172 ; thing we wrote over ;RTL ;-------------------------------------------------------------------------------- OnPlayerDead: PHA JSL.l SetDeathWorldChecked JSL.l SetSilverBowMode JSL.l RefreshRainAmmo PLA RTL ;-------------------------------------------------------------------------------- OnDungeonExit: STA $040C : STZ $04AC ; thing we wrote over PHA : PHP JSL.l HUD_RebuildLong JSL.l FloodGateResetInner JSL.l SetSilverBowMode PLP : PLA RTL ;-------------------------------------------------------------------------------- OnUncleItemGet: JSL Link_ReceiveItem LDA.l EscapeAssist BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : + LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA $7EF373 : + ; refill magic LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA $7EF375 : + ; refill bombs LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows LDA.b #70 : STA $7EF376 LDA.l ArrowMode : BEQ + LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; enable bow toggle REP #$20 ; set 16-bit accumulator LDA $7EF360 : !ADD.l FreeUncleItemAmount : STA $7EF360 ; rupee arrows, so also give the player some money to start SEP #$20 ; set 8-bit accumulator + RTL ;-------------------------------------------------------------------------------- OnAga2Defeated: JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first ;JSL.l IncrementAgahnim2Sword RTL ;-------------------------------------------------------------------------------- !RNG_ITEM_LOCK_IN = "$7F5090" OnFileLoad: LDA !FRESH_FILE_MARKER : BNE + JSL.l OnNewFile LDA.b #$FF : STA !FRESH_FILE_MARKER + JSL.l DoWorldFix JSL.l MasterSwordFollowerClear JSL.l InitOpenMode LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible LDA.l GenericKeys : BEQ + LDA $7EF38B : STA $7EF36F ; copy generic keys to key counter + JSL.l SetSilverBowMode JSL.l RefreshRainAmmo JSL.l SetEscapeAssist JSL.l mw_load_sram STZ !MULTIWORLD_PICKUP RTL ;-------------------------------------------------------------------------------- !RNG_ITEM_LOCK_IN = "$7F5090" OnNewFile: PHX : PHP REP #$20 ; set 16-bit accumulator LDA.l LinkStartingRupees : STA $7EF362 : STA $7EF360 LDA.l StartingTime : STA $7EF454 LDA.l StartingTime+2 : STA $7EF454+2 LDX.w #$00 : - ; copy over starting equipment LDA StartingEquipment, X : STA $7EF340, X INX : INX CPX.w #$004F : !BLT - SEP #$20 ; set 8-bit accumulator ;LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in LDA.l PreopenCurtains : BEQ + LDA.b #$80 : STA $7EF061 ; open aga tower curtain LDA.b #$80 : STA $7EF093 ; open skull woods curtain + LDA StartingSword : STA $7EF359 ; set starting sword type PLP : PLX RTL ;-------------------------------------------------------------------------------- OnInitFileSelect: ; LDA.b #$10 : STA $BC ; init sprite pointer - does nothing unless spriteswap.asm is included ; JSL.l SpriteSwap_SetSprite JSL.l EnableForceBlank RTL ;-------------------------------------------------------------------------------- OnLinkDamaged: JSL.l FlipperKill ;JSL.l OHKOTimer RTL ;-------------------------------------------------------------------------------- OnEnterWater: JSL.l RegisterWaterEntryScreen JSL.l MysteryWaterFunction LDX.b #$04 RTL ;-------------------------------------------------------------------------------- OnLinkDamagedFromPit: ;JSL.l OHKOTimer LDA.b #$14 : STA $11 ; thing we wrote over RTL ;-------------------------------------------------------------------------------- OnLinkDamagedFromPitOutdoors: ;JSL.l OHKOTimer ; make sure this is last RTL ;-------------------------------------------------------------------------------- !RNG_ITEM_LOCK_IN = "$7F5090" OnOWTransition: JSL.l FloodGateReset JSL.l FlipperFlag ;JSL.l StatTransitionCounter PHP SEP #$20 ; set 8-bit accumulator LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; clear lock-in PLP STZ !MULTIWORLD_PICKUP RTL ;-------------------------------------------------------------------------------- PreItemGet: LDA.b #$01 : STA !ITEM_BUSY ; mark item as busy RTL ;-------------------------------------------------------------------------------- PostItemGet: ;JSL.l MaybeWriteSRAMTrace RTL ;-------------------------------------------------------------------------------- PostItemAnimation: LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished LDA $7F50A0 : BEQ + STZ $1CF0 : STZ $1CF1 ; reset decompression buffer JSL.l Main_ShowTextMessage LDA.b #$00 : STA $7F50A0 + LDA.l config_multiworld BEQ + LDA !MULTIWORLD_DIALOG BNE .multiworldPickup + STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here BRA .end .multiworldPickup lda !MULTIWORLD_DIALOG cmp #$01 beq .multiworldGive cmp #$02 beq .multiworldGet stz !MULTIWORLD_DIALOG_ITEM stz !MULTIWORLD_DIALOG_PLAYER bra .noDialog .multiworldGet lda #$01 bra + .multiworldGive lda #$00 + sta $1cf0 ; Store multiworld dialog pointers lda #$80 sta $1cf1 jsl Main_ShowTextMessage .noDialog stz !MULTIWORLD_SWAP stz !MULTIWORLD_PICKUP stz !MULTIWORLD_GIVE_ITEM stz !MULTIWORLD_GIVE_PLAYER lda !MULTIWORLD_DIALOG cmp #$02 bne .giveItem STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here bra .end .giveItem PLA : PLA : PLA ; Pop return address off the stack STZ $02E9 : LDA $0C5E, X JML $08C505 ; If we're multiworld getting, skip ; all crazy events to get us things .end RTL ;-------------------------------------------------------------------------------- OnBeginSaveAndQuit: LDA.b #$01 STA.l !SRAM_SAVING ; Set saving flag to temporarily prevent soft reset LDA.b #$17 : STA $10 ; thing we wrote over. Go to save and quit module RTL ;--------------------------------------------------------------------------------
; A037544: Base-3 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,2. ; 1,5,17,52,158,476,1429,4289,12869,38608,115826,347480,1042441,3127325,9381977,28145932,84437798,253313396,759940189,2279820569,6839461709,20518385128,61555155386,184665466160,553996398481 add $0,1 mov $2,6 lpb $0,1 sub $0,1 mul $2,3 mov $1,$2 add $1,5 mov $2,$1 div $1,13 lpe
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %r9 push %rbx push %rsi lea addresses_WT_ht+0x1dfd2, %r15 xor $39981, %r9 movups (%r15), %xmm1 vpextrq $0, %xmm1, %r10 sub %rsi, %rsi lea addresses_normal_ht+0x12a72, %r8 nop sub $27939, %rbx mov $0x6162636465666768, %r13 movq %r13, %xmm6 vmovups %ymm6, (%r8) nop nop nop nop inc %r9 lea addresses_WC_ht+0xa152, %rsi clflush (%rsi) nop and %r8, %r8 mov (%rsi), %r15w nop nop xor $11269, %rbx lea addresses_UC_ht+0x13212, %r10 nop nop nop nop nop dec %rsi vmovups (%r10), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r9 cmp %r15, %r15 pop %rsi pop %rbx pop %r9 pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r9 push %rdi push %rdx push %rsi // Store mov $0x3273730000000f62, %rsi sub $33716, %r11 mov $0x5152535455565758, %r13 movq %r13, %xmm3 vmovups %ymm3, (%rsi) nop nop nop nop nop sub $60620, %rsi // Faulty Load lea addresses_normal+0xa1d2, %r14 nop nop nop nop add %rdi, %rdi mov (%r14), %r9w lea oracles, %r14 and $0xff, %r9 shlq $12, %r9 mov (%r14,%r9,1), %r9 pop %rsi pop %rdx pop %rdi pop %r9 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_NC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
// ----------------------------------------------------------------------------------------------------- // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md // ----------------------------------------------------------------------------------------------------- #include <gtest/gtest.h> #include <seqan3/std/ranges> #include <seqan3/io/detail/take_line_view.hpp> #include <seqan3/test/expect_range_eq.hpp> #include <seqan3/utility/views/single_pass_input.hpp> // ============================================================================ // test templates // ============================================================================ template <typename adaptor_t> void do_test(adaptor_t const & adaptor, std::string const & vec) { using namespace std::literals; // pipe notation EXPECT_RANGE_EQ("foo"sv, vec | adaptor); // function notation EXPECT_RANGE_EQ("foo"sv, adaptor(vec)); // combinability EXPECT_RANGE_EQ("fo"sv, vec | adaptor | std::views::take(2)); EXPECT_RANGE_EQ("rab"sv, vec | std::views::reverse | adaptor | std::views::take(3)); // consuming behaviour auto v4 = vec | seqan3::views::single_pass_input; auto v5 = std::move(v4) | adaptor; EXPECT_RANGE_EQ("foo"sv, v5); EXPECT_EQ('b', *begin(v5)); // not newline } template <typename adaptor_t> void do_concepts(adaptor_t const & adaptor) { std::string vec{"foo\nbar"}; EXPECT_TRUE(std::ranges::input_range<decltype(vec)>); EXPECT_TRUE(std::ranges::forward_range<decltype(vec)>); EXPECT_TRUE(std::ranges::bidirectional_range<decltype(vec)>); EXPECT_TRUE(std::ranges::random_access_range<decltype(vec)>); EXPECT_FALSE(std::ranges::view<decltype(vec)>); EXPECT_TRUE(std::ranges::sized_range<decltype(vec)>); EXPECT_TRUE(std::ranges::common_range<decltype(vec)>); EXPECT_TRUE(seqan3::const_iterable_range<decltype(vec)>); EXPECT_TRUE((std::ranges::output_range<decltype(vec), char>)); auto v1 = vec | adaptor; EXPECT_TRUE(std::ranges::input_range<decltype(v1)>); EXPECT_TRUE(std::ranges::forward_range<decltype(v1)>); EXPECT_TRUE(std::ranges::bidirectional_range<decltype(v1)>); EXPECT_TRUE(std::ranges::random_access_range<decltype(v1)>); EXPECT_TRUE(std::ranges::view<decltype(v1)>); EXPECT_FALSE(std::ranges::sized_range<decltype(v1)>); EXPECT_FALSE(std::ranges::common_range<decltype(v1)>); EXPECT_TRUE(seqan3::const_iterable_range<decltype(v1)>); EXPECT_TRUE((std::ranges::output_range<decltype(v1), char>)); auto v2 = vec | seqan3::views::single_pass_input | adaptor; EXPECT_TRUE(std::ranges::input_range<decltype(v2)>); EXPECT_FALSE(std::ranges::forward_range<decltype(v2)>); EXPECT_FALSE(std::ranges::bidirectional_range<decltype(v2)>); EXPECT_FALSE(std::ranges::random_access_range<decltype(v2)>); EXPECT_TRUE(std::ranges::view<decltype(v2)>); EXPECT_FALSE(std::ranges::sized_range<decltype(v2)>); EXPECT_FALSE(std::ranges::common_range<decltype(v2)>); EXPECT_FALSE(seqan3::const_iterable_range<decltype(v2)>); EXPECT_TRUE((std::ranges::output_range<decltype(v2), char>)); } // ============================================================================ // view_take_line // ============================================================================ TEST(view_take_line, unix_eol) { do_test(seqan3::detail::take_line, "foo\nbar"); } TEST(view_take_line, windows_eol) { do_test(seqan3::detail::take_line, "foo\r\nbar"); } TEST(view_take_line, no_eol) { using namespace std::literals; std::string vec{"foo"}; EXPECT_RANGE_EQ("foo"sv, vec | seqan3::detail::take_line); } TEST(view_take_line, eol_at_first_position) { using namespace std::literals; using sbt = std::istreambuf_iterator<char>; std::istringstream vec{"\n\nfoo"}; auto stream_view = std::ranges::subrange<decltype(sbt{vec}), decltype(sbt{})> {sbt{vec}, sbt{}}; EXPECT_RANGE_EQ(""sv, stream_view | seqan3::detail::take_line); EXPECT_RANGE_EQ("foo"sv, stream_view | seqan3::detail::take_line); } TEST(view_take_line, concepts) { do_concepts(seqan3::detail::take_line); } // ============================================================================ // view_take_line_or_throw // ============================================================================ TEST(view_take_line_or_throw, unix_eol) { do_test(seqan3::detail::take_line_or_throw, "foo\nbar"); } TEST(view_take_line_or_throw, windows_eol) { do_test(seqan3::detail::take_line_or_throw, "foo\r\nbar"); } TEST(view_take_line_or_throw, no_eol) { std::string vec{"foo"}; EXPECT_THROW(std::ranges::for_each(vec | seqan3::detail::take_line_or_throw, [](auto &&){}), seqan3::unexpected_end_of_input); } TEST(view_take_line_or_throw, concepts) { do_concepts(seqan3::detail::take_line_or_throw); } // ============================================================================ // bug // ============================================================================ TEST(view_take_line, reverse_bug) { using namespace std::literals; std::string vec{"foo\nbar"}; auto v1 = vec | seqan3::detail::take_line; EXPECT_RANGE_EQ("foo"sv, v1); EXPECT_TRUE(std::ranges::input_range<decltype(v1)>); EXPECT_TRUE(std::ranges::forward_range<decltype(v1)>); EXPECT_TRUE(std::ranges::bidirectional_range<decltype(v1)>); EXPECT_TRUE(std::ranges::random_access_range<decltype(v1)>); EXPECT_TRUE(std::ranges::view<decltype(v1)>); EXPECT_FALSE(std::ranges::sized_range<decltype(v1)>); EXPECT_FALSE(std::ranges::common_range<decltype(v1)>); EXPECT_TRUE(seqan3::const_iterable_range<decltype(v1)>); EXPECT_TRUE((std::ranges::output_range<decltype(v1), char>)); // No build failure, but wrong results: // auto v2 = v1 | std::views::reverse; // EXPECT_EQ("oof", std::string(v2)); }
; L0811.asm ssa nw goblin module ; Generated 04.26.2001 by mlevel ; Modified 04.26.2001 by Abe Pralle INCLUDE "Source/Defs.inc" INCLUDE "Source/Levels.inc" STATE_DEFUSED EQU 2 ;--------------------------------------------------------------------- SECTION "Level0811Section",ROMX ;--------------------------------------------------------------------- L0811_Contents:: DW L0811_Load DW L0811_Init DW L0811_Check DW L0811_Map ;--------------------------------------------------------------------- ; Load ;--------------------------------------------------------------------- L0811_Load: DW ((L0811_LoadFinished - L0811_Load2)) ;size L0811_Load2: call ParseMap ret L0811_LoadFinished: ;--------------------------------------------------------------------- ; Map ;--------------------------------------------------------------------- L0811_Map: INCBIN "Data/Levels/L0811_ssa_nw.lvl" ;--------------------------------------------------------------------- ; Init ;--------------------------------------------------------------------- L0811_Init: DW ((L0811_InitFinished - L0811_Init2)) ;size L0811_Init2: ld a,BANK(L0012_defused_gtx) ld [dialogBank],a call SetPressBDialog ldio a,[mapState] cp STATE_DEFUSED jr nz,.afterRemoveBomb ;remove bomb ld a,MAPBANK ldio [$ff70],a xor a ld hl,$d042 ld [hl+],a ld [hl],a ld hl,$d062 ld [hl+],a ld [hl],a .afterRemoveBomb ret L0811_InitFinished: ;--------------------------------------------------------------------- ; Check ;--------------------------------------------------------------------- L0811_Check: DW ((L0811_CheckFinished - L0811_Check2)) ;size L0811_Check2: call ((.checkAtBomb-L0811_Check2)+levelCheckRAM) ret .checkAtBomb ldio a,[mapState] cp STATE_DEFUSED ret z ld hl,((.checkHeroAtBomb-L0811_Check2)+levelCheckRAM) xor a call CheckEachHero ret .checkHeroAtBomb ld c,a call GetFirst call GetCurZone cp 2 jr z,.atBomb xor a ret .atBomb ld a,STATE_DEFUSED ldio [mapState],a call UpdateState ;remove bomb ld a,MAPBANK ldio [$ff70],a xor a ld hl,$d042 ld [hl+],a ld [hl],a ld hl,$d062 ld [hl+],a ld [hl],a ;check all defused ld d,0 ld a,LEVELSTATEBANK ldio [$ff70],a ld a,[levelState+$b8] cp 2 jr nz,.check2 inc d .check2 ld a,[levelState+$b9] cp 2 jr nz,.check3 inc d .check3 ld a,[levelState+$ba] cp 2 jr nz,.check4 inc d .check4 ld a,[levelState+$bb] cp 2 jr nz,.checkTotal inc d .checkTotal ;if 3 bombs were defused before this one then that's all ld a,d cp 3 jr nz,.bombsRemain ld hl,L0012_alldefused_gtx jr .dialog .bombsRemain ld hl,L0012_defused_gtx .dialog call MakeIdle ld de,((.afterDialog-L0811_Check2)+levelCheckRAM) call SetDialogSkip ld d,h ld e,l call SetSpeakerFromHeroIndex call ShowDialogAtBottom .afterDialog call ClearDialogSkipForward call MakeNonIdle ld a,1 ret L0811_CheckFinished: PRINT "0811 Script Sizes (Load/Init/Check) (of $500): " PRINT (L0811_LoadFinished - L0811_Load2) PRINT " / " PRINT (L0811_InitFinished - L0811_Init2) PRINT " / " PRINT (L0811_CheckFinished - L0811_Check2) PRINT "\n"
.386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\user32.inc includelib \masm32\lib\user32.lib .data BUFFER_LENGTH EQU 1024 szMessageBoxFormat BYTE "The result is %d", 0 szMessageBoxText BYTE 0 dup(BUFFER_LENGTH) .code start: main proc mov eax, 3 push eax call display_number_in_message_box mov ebx, 999 push ebx call display_number_in_message_box add eax, ebx push eax call display_number_in_message_box ret main endp display_number_in_message_box proc ;Create a string representation of the number mov eax, [esp + 4] invoke wsprintf, ADDR szMessageBoxText, ADDR szMessageBoxFormat, eax ;Display that string in a message box invoke MessageBoxA, NULL, ADDR szMessageBoxText, NULL, MB_OK ret 4 display_number_in_message_box endp end start
// Copyright 2022 Google LLC // // 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 // // https://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 "google/cloud/internal/curl_rest_client.h" #include "google/cloud/common_options.h" #include "google/cloud/credentials.h" #include "google/cloud/internal/absl_str_cat_quiet.h" #include "google/cloud/internal/absl_str_join_quiet.h" #include "google/cloud/internal/api_client_header.h" #include "google/cloud/internal/curl_handle_factory.h" #include "google/cloud/internal/curl_impl.h" #include "google/cloud/internal/curl_options.h" #include "google/cloud/internal/curl_rest_response.h" #include "google/cloud/internal/oauth2_google_credentials.h" #include "google/cloud/internal/rest_options.h" #include "google/cloud/internal/unified_rest_credentials.h" #include "google/cloud/log.h" #include "absl/strings/match.h" #include "absl/strings/strip.h" namespace google { namespace cloud { namespace rest_internal { GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN namespace { std::size_t constexpr kDefaultPooledCurlHandleFactorySize = 10; Status MakeRequestWithPayload( CurlImpl::HttpMethod http_method, RestRequest const& request, CurlImpl& impl, std::vector<absl::Span<char const>> const& payload) { // If no Content-Type is specified for the payload, default to // application/x-www-form-urlencoded and encode the payload accordingly before // making the request. auto content_type = request.GetHeader("Content-Type"); if (content_type.empty()) { std::string encoded_payload; impl.SetHeader("content-type: application/x-www-form-urlencoded"); std::string concatenated_payload; for (auto const& p : payload) { concatenated_payload += std::string(p.begin(), p.end()); } encoded_payload = impl.MakeEscapedString(concatenated_payload); if (!encoded_payload.empty()) { impl.SetHeader(absl::StrCat("content-length: ", encoded_payload.size())); } return impl.MakeRequest(http_method, {{encoded_payload.data(), encoded_payload.size()}}); } std::size_t content_length = 0; for (auto const& p : payload) { content_length += p.size(); } if (content_length > 0) { impl.SetHeader(absl::StrCat("content-length: ", content_length)); } return impl.MakeRequest(http_method, payload); } std::string FormatHostHeaderValue(absl::string_view hostname) { if (!absl::ConsumePrefix(&hostname, "https://")) { absl::ConsumePrefix(&hostname, "http://"); } return std::string(hostname.substr(0, hostname.find('/'))); } } // namespace std::string CurlRestClient::HostHeader(Options const& options, std::string const& endpoint) { // If this function returns an empty string libcurl will fill out the `Host: ` // header based on the URL. In most cases this is the correct value. The main // exception are applications using `VPC-SC`: // https://cloud.google.com/vpc/docs/configure-private-google-access // In those cases the application would target a URL like // `https://restricted.googleapis.com`, or `https://private.googleapis.com`, // or their own proxy, and need to provide the target's service host via the // AuthorityOption. auto const& auth = options.get<AuthorityOption>(); if (!auth.empty()) return absl::StrCat("Host: ", auth); if (absl::StrContains(endpoint, "googleapis.com")) { return absl::StrCat("Host: ", FormatHostHeaderValue(endpoint)); } return {}; } CurlRestClient::CurlRestClient(std::string endpoint_address, std::shared_ptr<CurlHandleFactory> factory, Options options) : endpoint_address_(std::move(endpoint_address)), handle_factory_(std::move(factory)), x_goog_api_client_header_("x-goog-api-client: " + google::cloud::internal::ApiClientHeader()), options_(std::move(options)) {} StatusOr<std::unique_ptr<CurlImpl>> CurlRestClient::CreateCurlImpl( RestRequest const& request) { auto handle = GetCurlHandle(handle_factory_); auto impl = absl::make_unique<CurlImpl>(std::move(handle), handle_factory_, options_); if (options_.has<UnifiedCredentialsOption>()) { auto credentials = MapCredentials(options_.get<UnifiedCredentialsOption>()); auto auth_header = credentials->AuthorizationHeader(); if (!auth_header.ok()) return std::move(auth_header).status(); impl->SetHeader(auth_header.value()); } impl->SetHeader(HostHeader(options_, endpoint_address_)); impl->SetHeader(x_goog_api_client_header_); impl->SetHeaders(request); RestRequest::HttpParameters additional_parameters; // The UserIp option has been deprecated in favor of quotaUser. Only add the // parameter if the option has been set. if (options_.has<UserIpOption>()) { auto user_ip = options_.get<UserIpOption>(); if (user_ip.empty()) user_ip = impl->LastClientIpAddress(); if (!user_ip.empty()) additional_parameters.emplace_back("userIp", user_ip); } impl->SetUrl(endpoint_address_, request, additional_parameters); return impl; } // While the similar implementations of all these HTTP verb methods suggest // refactoring is possible, there are some constraints that preclude it: // 1 Pimpl: only certain types from curl_impl.h can be forward declared for use // in CurlRestClient member function declarations. // 2 Access: CurlRestResponse constructor is private, CurlRestClient is a friend // CreateCurlImpl relies heavily on member variables. StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Delete( RestRequest const& request) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); auto response = (*impl)->MakeRequest(CurlImpl::HttpMethod::kDelete); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Get( RestRequest const& request) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); auto response = (*impl)->MakeRequest(CurlImpl::HttpMethod::kGet); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Patch( RestRequest const& request, std::vector<absl::Span<char const>> const& payload) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); Status response = MakeRequestWithPayload(CurlImpl::HttpMethod::kPatch, request, **impl, payload); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Post( RestRequest const& request, std::vector<absl::Span<char const>> const& payload) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); Status response = MakeRequestWithPayload(CurlImpl::HttpMethod::kPost, request, **impl, payload); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Post( RestRequest request, std::vector<std::pair<std::string, std::string>> const& form_data) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); std::string form_payload = absl::StrJoin( form_data, "&", [&](std::string* out, std::pair<std::string, std::string> const& i) { out->append( absl::StrCat(i.first, "=", (*impl)->MakeEscapedString(i.second))); }); request.AddHeader("content-type", "application/x-www-form-urlencoded"); Status response = MakeRequestWithPayload(CurlImpl::HttpMethod::kPost, request, **impl, {form_payload}); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } StatusOr<std::unique_ptr<RestResponse>> CurlRestClient::Put( RestRequest const& request, std::vector<absl::Span<char const>> const& payload) { auto impl = CreateCurlImpl(request); if (!impl.ok()) return impl.status(); Status response = MakeRequestWithPayload(CurlImpl::HttpMethod::kPut, request, **impl, payload); if (!response.ok()) return response; return {std::unique_ptr<CurlRestResponse>( new CurlRestResponse(options_, std::move(*impl)))}; } std::unique_ptr<RestClient> MakeDefaultRestClient(std::string endpoint_address, Options options) { auto factory = GetDefaultCurlHandleFactory(options); return std::unique_ptr<RestClient>(new CurlRestClient( std::move(endpoint_address), std::move(factory), std::move(options))); } std::unique_ptr<RestClient> MakePooledRestClient(std::string endpoint_address, Options options) { std::size_t pool_size = kDefaultPooledCurlHandleFactorySize; if (options.has<ConnectionPoolSizeOption>()) { pool_size = options.get<ConnectionPoolSizeOption>(); } auto factory = std::make_shared<PooledCurlHandleFactory>(pool_size, options); return std::unique_ptr<RestClient>(new CurlRestClient( std::move(endpoint_address), std::move(factory), std::move(options))); } GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } // namespace rest_internal } // namespace cloud } // namespace google
// gateway.cpp,v 1.6 2001/05/09 19:17:09 parsons Exp #include "test_dsi.h" #include "ace/Get_Opt.h" #include "ace/Task.h" ACE_RCSID(DSI_Gateway, server, "gateway.cpp,v 1.6 2001/05/09 19:17:09 parsons Exp") const char *ior = "file://test.ior"; int niterations = 5; int do_shutdown = 0; const char *ior_output_file = "gateway.ior"; int parse_args (int argc, char *argv[]) { ACE_Get_Opt get_opts (argc, argv, "xk:i:o:"); int c; while ((c = get_opts ()) != -1) switch (c) { case 'x': do_shutdown = 1; break; case 'k': ior = get_opts.optarg; break; case 'i': niterations = ACE_OS::atoi (get_opts.optarg); break; case 'o': ior_output_file = get_opts.optarg; break; case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " "-x " "-k <ior> " "-i <niterations> " "-o <iorfile> " "\n", argv [0]), -1); } // Indicates sucessful parsing of the command line return 0; } int main (int argc, char *argv[]) { ACE_TRY_NEW_ENV { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA", ACE_TRY_ENV); ACE_TRY_CHECK; if (CORBA::is_nil (poa_object.in ())) { ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); } PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in (), ACE_TRY_ENV); ACE_TRY_CHECK; PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (ACE_TRY_ENV); ACE_TRY_CHECK; poa_manager->activate (ACE_TRY_ENV); ACE_TRY_CHECK; if (parse_args (argc, argv) != 0) { return 1; } CORBA::Object_var object = orb->string_to_object (ior, ACE_TRY_ENV); ACE_TRY_CHECK; DSI_Simple_Server server_impl (orb.in (), object.in (), root_poa.in ()); PortableServer::ObjectId_var oid = root_poa->activate_object (&server_impl, ACE_TRY_ENV); ACE_TRY_CHECK; CORBA::Object_var server = root_poa->id_to_reference (oid.in (), ACE_TRY_ENV); ACE_TRY_CHECK; CORBA::String_var ior = orb->object_to_string (server.in (), ACE_TRY_ENV); ACE_TRY_CHECK; ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) { FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); } ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); } orb->run (ACE_TRY_ENV); ACE_TRY_CHECK; ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); } ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Gateway: exception caught - "); return 1; } ACE_ENDTRY; return 0; }
; A263390: a(3n) = n, otherwise a(n) = a(floor(2n/3)). ; 0,0,0,1,0,1,2,0,1,3,2,0,4,1,3,5,2,0,6,4,1,7,3,5,8,2,0,9,6,4,10,1,7,11,3,5,12,8,2,13,0,9,14,6,4,15,10,1,16,7,11,17,3,5,18,12,8,19,2,13,20,0,9,21,14,6,22,4,15,23,10,1,24,16,7,25 lpb $0,1 mov $2,$0 gcd $0,3 add $0,3 mul $0,$2 div $0,6 lpe mov $1,$0 div $1,3
; A040865: Continued fraction for sqrt(895). ; Submitted by Christian Krause ; 29,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10,1,58,1,10 gcd $0,262156 mul $0,42 mod $0,13 mul $0,2 mov $1,$0 sub $0,2 div $0,2 sub $1,4 add $0,$1 div $1,5 mul $1,22 trn $1,$0 mov $0,$1 add $0,1
; ; Small C z88 stdlib functions ; ; Return absolute value of long ; ; ----- ; $Id: labs_callee.asm,v 1.3 2015/01/19 01:33:22 pauloscustodio Exp $ PUBLIC labs_callee EXTERN l_long_neg PUBLIC ASMDISP_LABS_CALLEE .labs_callee pop af pop hl pop de push af .asmentry bit 7,d ret z jp l_long_neg DEFC ASMDISP_LABS_CALLEE = # asmentry - labs_callee