code stringlengths 2 1.05M | repo_name stringlengths 5 101 | path stringlengths 4 991 | language stringclasses 3 values | license stringclasses 5 values | size int64 2 1.05M |
|---|---|---|---|---|---|
%define ARCH_AARCH64 0
%define ARCH_ALPHA 0
%define ARCH_ARM 0
%define ARCH_AVR32 0
%define ARCH_AVR32_AP 0
%define ARCH_AVR32_UC 0
%define ARCH_BFIN 0
%define ARCH_IA64 0
%define ARCH_M68K 0
%define ARCH_MIPS 0
%define ARCH_MIPS64 0
%define ARCH_PARISC 0
%define ARCH_PPC 0
%define ARCH_PPC64 0
%define ARCH_S390 0
%define ARCH_SH4 0
%define ARCH_SPARC 0
%define ARCH_SPARC64 0
%define ARCH_TILEGX 0
%define ARCH_TILEPRO 0
%define ARCH_TOMI 0
%define ARCH_X86 1
%define ARCH_X86_32 0
%define ARCH_X86_64 1
%define HAVE_ARMV5TE 0
%define HAVE_ARMV6 0
%define HAVE_ARMV6T2 0
%define HAVE_ARMV8 0
%define HAVE_NEON 0
%define HAVE_VFP 0
%define HAVE_VFPV3 0
%define HAVE_SETEND 0
%define HAVE_ALTIVEC 0
%define HAVE_DCBZL 1
%define HAVE_LDBRX 1
%define HAVE_PPC4XX 0
%define HAVE_VSX 0
%define HAVE_AMD3DNOW 1
%define HAVE_AMD3DNOWEXT 1
%define HAVE_AVX 1
%define HAVE_AVX2 1
%define HAVE_FMA3 1
%define HAVE_FMA4 1
%define HAVE_MMX 1
%define HAVE_MMXEXT 1
%define HAVE_SSE 1
%define HAVE_SSE2 1
%define HAVE_SSE3 1
%define HAVE_SSE4 1
%define HAVE_SSE42 1
%define HAVE_SSSE3 1
%define HAVE_XOP 1
%define HAVE_CPUNOP 1
%define HAVE_I686 1
%define HAVE_MIPSFPU 0
%define HAVE_MIPS32R2 1
%define HAVE_MIPSDSPR1 0
%define HAVE_MIPSDSPR2 0
%define HAVE_LOONGSON 1
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
%define HAVE_ARMV6T2_EXTERNAL 0
%define HAVE_ARMV8_EXTERNAL 0
%define HAVE_NEON_EXTERNAL 0
%define HAVE_VFP_EXTERNAL 0
%define HAVE_VFPV3_EXTERNAL 0
%define HAVE_SETEND_EXTERNAL 0
%define HAVE_ALTIVEC_EXTERNAL 0
%define HAVE_DCBZL_EXTERNAL 0
%define HAVE_LDBRX_EXTERNAL 0
%define HAVE_PPC4XX_EXTERNAL 0
%define HAVE_VSX_EXTERNAL 0
%define HAVE_AMD3DNOW_EXTERNAL 1
%define HAVE_AMD3DNOWEXT_EXTERNAL 1
%define HAVE_AVX_EXTERNAL 1
%define HAVE_AVX2_EXTERNAL 1
%define HAVE_FMA3_EXTERNAL 1
%define HAVE_FMA4_EXTERNAL 1
%define HAVE_MMX_EXTERNAL 1
%define HAVE_MMXEXT_EXTERNAL 1
%define HAVE_SSE_EXTERNAL 1
%define HAVE_SSE2_EXTERNAL 1
%define HAVE_SSE3_EXTERNAL 1
%define HAVE_SSE4_EXTERNAL 1
%define HAVE_SSE42_EXTERNAL 1
%define HAVE_SSSE3_EXTERNAL 1
%define HAVE_XOP_EXTERNAL 1
%define HAVE_CPUNOP_EXTERNAL 0
%define HAVE_I686_EXTERNAL 0
%define HAVE_MIPSFPU_EXTERNAL 0
%define HAVE_MIPS32R2_EXTERNAL 0
%define HAVE_MIPSDSPR1_EXTERNAL 0
%define HAVE_MIPSDSPR2_EXTERNAL 0
%define HAVE_LOONGSON_EXTERNAL 0
%define HAVE_ARMV5TE_INLINE 0
%define HAVE_ARMV6_INLINE 0
%define HAVE_ARMV6T2_INLINE 0
%define HAVE_ARMV8_INLINE 0
%define HAVE_NEON_INLINE 0
%define HAVE_VFP_INLINE 0
%define HAVE_VFPV3_INLINE 0
%define HAVE_SETEND_INLINE 0
%define HAVE_ALTIVEC_INLINE 0
%define HAVE_DCBZL_INLINE 0
%define HAVE_LDBRX_INLINE 0
%define HAVE_PPC4XX_INLINE 0
%define HAVE_VSX_INLINE 0
%define HAVE_AMD3DNOW_INLINE 1
%define HAVE_AMD3DNOWEXT_INLINE 1
%define HAVE_AVX_INLINE 1
%define HAVE_AVX2_INLINE 1
%define HAVE_FMA3_INLINE 1
%define HAVE_FMA4_INLINE 1
%define HAVE_MMX_INLINE 1
%define HAVE_MMXEXT_INLINE 1
%define HAVE_SSE_INLINE 1
%define HAVE_SSE2_INLINE 1
%define HAVE_SSE3_INLINE 1
%define HAVE_SSE4_INLINE 1
%define HAVE_SSE42_INLINE 1
%define HAVE_SSSE3_INLINE 1
%define HAVE_XOP_INLINE 1
%define HAVE_CPUNOP_INLINE 0
%define HAVE_I686_INLINE 0
%define HAVE_MIPSFPU_INLINE 0
%define HAVE_MIPS32R2_INLINE 0
%define HAVE_MIPSDSPR1_INLINE 0
%define HAVE_MIPSDSPR2_INLINE 0
%define HAVE_LOONGSON_INLINE 0
%define HAVE_ALIGNED_STACK 1
%define HAVE_FAST_64BIT 1
%define HAVE_FAST_CLZ 1
%define HAVE_FAST_CMOV 1
%define HAVE_LOCAL_ALIGNED_8 1
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
%define HAVE_ATOMICS_GCC 1
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 0
%define HAVE_ATOMIC_CAS_PTR 0
%define HAVE_ATOMIC_COMPARE_EXCHANGE 1
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 0
%define HAVE_MM_EMPTY 1
%define HAVE_RDTSC 0
%define HAVE_SARESTART 1
%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
%define HAVE_INLINE_ASM 1
%define HAVE_SYMVER 0
%define HAVE_YASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
%define HAVE_INCOMPATIBLE_LIBAV_ABI 0
%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 0
%define HAVE_ASM_TYPES_H 1
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
%define HAVE_DEV_IC_BT8XX_H 0
%define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0
%define HAVE_DIRECT_H 0
%define HAVE_DLFCN_H 1
%define HAVE_DXVA_H 0
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
%define HAVE_IO_H 0
%define HAVE_MACH_MACH_TIME_H 0
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_MALLOC_H 1
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 1
%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
%define HAVE_SYS_MMAN_H 1
%define HAVE_SYS_PARAM_H 1
%define HAVE_SYS_RESOURCE_H 1
%define HAVE_SYS_SELECT_H 1
%define HAVE_SYS_SOUNDCARD_H 1
%define HAVE_SYS_TIME_H 1
%define HAVE_SYS_UN_H 1
%define HAVE_SYS_VIDEOIO_H 0
%define HAVE_TERMIOS_H 1
%define HAVE_UDPLITE_H 0
%define HAVE_UNISTD_H 1
%define HAVE_WINDOWS_H 0
%define HAVE_WINSOCK2_H 0
%define HAVE_INTRINSICS_NEON 0
%define HAVE_ATANF 1
%define HAVE_ATAN2F 1
%define HAVE_CBRT 1
%define HAVE_CBRTF 1
%define HAVE_COSF 1
%define HAVE_EXP2 1
%define HAVE_EXP2F 1
%define HAVE_EXPF 1
%define HAVE_ISINF 1
%define HAVE_ISNAN 1
%define HAVE_LDEXPF 1
%define HAVE_LLRINT 1
%define HAVE_LLRINTF 1
%define HAVE_LOG2 1
%define HAVE_LOG2F 1
%define HAVE_LOG10F 1
%define HAVE_LRINT 1
%define HAVE_LRINTF 1
%define HAVE_POWF 1
%define HAVE_RINT 1
%define HAVE_ROUND 1
%define HAVE_ROUNDF 1
%define HAVE_SINF 1
%define HAVE_TRUNC 1
%define HAVE_TRUNCF 1
%define HAVE_ACCESS 1
%define HAVE_ALIGNED_MALLOC 0
%define HAVE_CLOCK_GETTIME 1
%define HAVE_CLOSESOCKET 0
%define HAVE_COMMANDLINETOARGVW 0
%define HAVE_COTASKMEMFREE 0
%define HAVE_CRYPTGENRANDOM 0
%define HAVE_DLOPEN 1
%define HAVE_FCNTL 1
%define HAVE_FLT_LIM 1
%define HAVE_FORK 1
%define HAVE_GETADDRINFO 0
%define HAVE_GETHRTIME 0
%define HAVE_GETOPT 1
%define HAVE_GETPROCESSAFFINITYMASK 0
%define HAVE_GETPROCESSMEMORYINFO 0
%define HAVE_GETPROCESSTIMES 0
%define HAVE_GETRUSAGE 1
%define HAVE_GETSERVBYPORT 0
%define HAVE_GETSYSTEMTIMEASFILETIME 0
%define HAVE_GETTIMEOFDAY 1
%define HAVE_GLOB 1
%define HAVE_GLXGETPROCADDRESS 0
%define HAVE_GMTIME_R 1
%define HAVE_INET_ATON 0
%define HAVE_ISATTY 1
%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
%define HAVE_KBHIT 0
%define HAVE_LOCALTIME_R 1
%define HAVE_LZO1X_999_COMPRESS 0
%define HAVE_MACH_ABSOLUTE_TIME 0
%define HAVE_MAPVIEWOFFILE 0
%define HAVE_MEMALIGN 1
%define HAVE_MKSTEMP 1
%define HAVE_MMAP 1
%define HAVE_MPROTECT 1
%define HAVE_NANOSLEEP 1
%define HAVE_PEEKNAMEDPIPE 0
%define HAVE_POSIX_MEMALIGN 1
%define HAVE_PTHREAD_CANCEL 1
%define HAVE_SCHED_GETAFFINITY 1
%define HAVE_SETCONSOLETEXTATTRIBUTE 0
%define HAVE_SETMODE 0
%define HAVE_SETRLIMIT 1
%define HAVE_SLEEP 0
%define HAVE_STRERROR_R 1
%define HAVE_SYSCONF 1
%define HAVE_SYSCTL 1
%define HAVE_USLEEP 1
%define HAVE_VIRTUALALLOC 0
%define HAVE_WGLGETPROCADDRESS 0
%define HAVE_PTHREADS 1
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 0
%define HAVE_AS_DN_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 1
%define HAVE_ATTRIBUTE_PACKED 1
%define HAVE_EBP_AVAILABLE 1
%define HAVE_EBX_AVAILABLE 1
%define HAVE_GNU_AS 0
%define HAVE_GNU_WINDRES 0
%define HAVE_IBM_ASM 0
%define HAVE_INLINE_ASM_LABELS 1
%define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
%define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
%define HAVE_PRAGMA_DEPRECATED 1
%define HAVE_RSYNC_CONTIMEOUT 1
%define HAVE_SYMVER_ASM_LABEL 0
%define HAVE_SYMVER_GNU_ASM 1
%define HAVE_VFP_ARGS 0
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 1
%define HAVE_CONDITION_VARIABLE_PTR 0
%define HAVE_DXVA_PICPARAMS_HEVC 0
%define HAVE_SOCKLEN_T 0
%define HAVE_STRUCT_ADDRINFO 0
%define HAVE_STRUCT_GROUP_SOURCE_REQ 0
%define HAVE_STRUCT_IP_MREQ_SOURCE 0
%define HAVE_STRUCT_IPV6_MREQ 0
%define HAVE_STRUCT_POLLFD 0
%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1
%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
%define HAVE_STRUCT_SOCKADDR_IN6 0
%define HAVE_STRUCT_SOCKADDR_SA_LEN 0
%define HAVE_STRUCT_SOCKADDR_STORAGE 0
%define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 0
%define HAVE_DXVA2API_COBJ 0
%define HAVE_DXVA2_LIB 0
%define HAVE_LIBC_MSVCRT 0
%define HAVE_LIBDC1394_1 0
%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 1
%define HAVE_MAKEINFO_HTML 1
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
%define HAVE_SDL 0
%define HAVE_SECTION_DATA_REL_RO 1
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_XLIB 0
%define CONFIG_BSFS 0
%define CONFIG_DECODERS 1
%define CONFIG_DEMUXERS 1
%define CONFIG_ENCODERS 0
%define CONFIG_FILTERS 0
%define CONFIG_HWACCELS 0
%define CONFIG_INDEVS 0
%define CONFIG_MUXERS 0
%define CONFIG_OUTDEVS 0
%define CONFIG_PARSERS 1
%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 0
%define CONFIG_PODPAGES 0
%define CONFIG_TXTPAGES 0
%define CONFIG_AVIO_READING_EXAMPLE 1
%define CONFIG_DECODING_ENCODING_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 1
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 1
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
%define CONFIG_REMUXING_EXAMPLE 1
%define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
%define CONFIG_AVISYNTH 0
%define CONFIG_BZLIB 0
%define CONFIG_CRYSTALHD 0
%define CONFIG_DECKLINK 0
%define CONFIG_FREI0R 0
%define CONFIG_GNUTLS 0
%define CONFIG_ICONV 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBAACPLUS 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
%define CONFIG_LIBDCADEC 0
%define CONFIG_LIBFAAC 0
%define CONFIG_LIBFDK_AAC 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
%define CONFIG_LIBFRIBIDI 0
%define CONFIG_LIBGME 0
%define CONFIG_LIBGSM 0
%define CONFIG_LIBIEC61883 0
%define CONFIG_LIBILBC 0
%define CONFIG_LIBMFX 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
%define CONFIG_LIBNUT 0
%define CONFIG_LIBOPENCORE_AMRNB 0
%define CONFIG_LIBOPENCORE_AMRWB 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
%define CONFIG_LIBQUVI 0
%define CONFIG_LIBRTMP 0
%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSOXR 0
%define CONFIG_LIBSPEEX 0
%define CONFIG_LIBSSH 0
%define CONFIG_LIBSTAGEFRIGHT_H264 0
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBUTVIDEO 0
%define CONFIG_LIBV4L2 0
%define CONFIG_LIBVIDSTAB 0
%define CONFIG_LIBVO_AACENC 0
%define CONFIG_LIBVO_AMRWBENC 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
%define CONFIG_LIBX264 0
%define CONFIG_LIBX265 0
%define CONFIG_LIBXAVS 0
%define CONFIG_LIBXCB 1
%define CONFIG_LIBXCB_SHM 1
%define CONFIG_LIBXCB_SHAPE 1
%define CONFIG_LIBXCB_XFIXES 1
%define CONFIG_LIBXVID 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
%define CONFIG_LZMA 0
%define CONFIG_NVENC 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
%define CONFIG_OPENSSL 0
%define CONFIG_SDL 0
%define CONFIG_X11GRAB 0
%define CONFIG_XLIB 0
%define CONFIG_ZLIB 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
%define CONFIG_RUNTIME_CPUDETECT 1
%define CONFIG_SAFE_BITSTREAM_READER 1
%define CONFIG_SHARED 0
%define CONFIG_SMALL 0
%define CONFIG_STATIC 1
%define CONFIG_SWSCALE_ALPHA 1
%define CONFIG_DXVA2 0
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
%define CONFIG_XVMC 0
%define CONFIG_GPL 0
%define CONFIG_NONFREE 0
%define CONFIG_VERSION3 0
%define CONFIG_AVCODEC 1
%define CONFIG_AVDEVICE 0
%define CONFIG_AVFILTER 0
%define CONFIG_AVFORMAT 1
%define CONFIG_AVRESAMPLE 0
%define CONFIG_AVUTIL 1
%define CONFIG_POSTPROC 0
%define CONFIG_SWRESAMPLE 0
%define CONFIG_SWSCALE 0
%define CONFIG_FFPLAY 0
%define CONFIG_FFPROBE 0
%define CONFIG_FFSERVER 0
%define CONFIG_FFMPEG 0
%define CONFIG_DCT 1
%define CONFIG_DWT 0
%define CONFIG_ERROR_RESILIENCE 1
%define CONFIG_FAAN 1
%define CONFIG_FAST_UNALIGNED 1
%define CONFIG_FFT 1
%define CONFIG_LSP 1
%define CONFIG_LZO 0
%define CONFIG_MDCT 1
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 1
%define CONFIG_FONTCONFIG 0
%define CONFIG_INCOMPATIBLE_LIBAV_ABI 0
%define CONFIG_MEMALIGN_HACK 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
%define CONFIG_PIC 1
%define CONFIG_POD2MAN 1
%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_XMM_CLOBBER_TEST 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
%define CONFIG_AUDIODSP 0
%define CONFIG_BLOCKDSP 1
%define CONFIG_BSWAPDSP 0
%define CONFIG_CABAC 1
%define CONFIG_DVPROFILE 0
%define CONFIG_EXIF 1
%define CONFIG_FAANDCT 1
%define CONFIG_FAANIDCT 1
%define CONFIG_FDCTDSP 1
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_GCRYPT 0
%define CONFIG_GOLOMB 1
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 1
%define CONFIG_H264CHROMA 1
%define CONFIG_H264DSP 1
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 1
%define CONFIG_HPELDSP 1
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 1
%define CONFIG_IIRFILTER 0
%define CONFIG_IMDCT15 1
%define CONFIG_INTRAX8 0
%define CONFIG_LGPLV3 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
%define CONFIG_LPC 0
%define CONFIG_ME_CMP 1
%define CONFIG_MPEG_ER 1
%define CONFIG_MPEGAUDIO 1
%define CONFIG_MPEGAUDIODSP 1
%define CONFIG_MPEGVIDEO 1
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_NETTLE 0
%define CONFIG_PIXBLOCKDSP 1
%define CONFIG_QPELDSP 1
%define CONFIG_QSV 0
%define CONFIG_RANGECODER 0
%define CONFIG_RIFFDEC 1
%define CONFIG_RIFFENC 0
%define CONFIG_RTPDEC 0
%define CONFIG_RTPENC_CHAIN 0
%define CONFIG_SINEWIN 1
%define CONFIG_STARTCODE 1
%define CONFIG_TPELDSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 1
%define CONFIG_WMA_FREQS 0
%define CONFIG_AAC_ADTSTOASC_BSF 0
%define CONFIG_CHOMP_BSF 0
%define CONFIG_DUMP_EXTRADATA_BSF 0
%define CONFIG_H264_MP4TOANNEXB_BSF 0
%define CONFIG_IMX_DUMP_HEADER_BSF 0
%define CONFIG_MJPEG2JPEG_BSF 0
%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
%define CONFIG_MOV2TEXTSUB_BSF 0
%define CONFIG_NOISE_BSF 0
%define CONFIG_REMOVE_EXTRADATA_BSF 0
%define CONFIG_TEXT2MOVSUB_BSF 0
%define CONFIG_AASC_DECODER 0
%define CONFIG_AIC_DECODER 0
%define CONFIG_ALIAS_PIX_DECODER 0
%define CONFIG_AMV_DECODER 0
%define CONFIG_ANM_DECODER 0
%define CONFIG_ANSI_DECODER 0
%define CONFIG_APNG_DECODER 0
%define CONFIG_ASV1_DECODER 0
%define CONFIG_ASV2_DECODER 0
%define CONFIG_AURA_DECODER 0
%define CONFIG_AURA2_DECODER 0
%define CONFIG_AVRP_DECODER 0
%define CONFIG_AVRN_DECODER 0
%define CONFIG_AVS_DECODER 0
%define CONFIG_AVUI_DECODER 0
%define CONFIG_AYUV_DECODER 0
%define CONFIG_BETHSOFTVID_DECODER 0
%define CONFIG_BFI_DECODER 0
%define CONFIG_BINK_DECODER 0
%define CONFIG_BMP_DECODER 0
%define CONFIG_BMV_VIDEO_DECODER 0
%define CONFIG_BRENDER_PIX_DECODER 0
%define CONFIG_C93_DECODER 0
%define CONFIG_CAVS_DECODER 0
%define CONFIG_CDGRAPHICS_DECODER 0
%define CONFIG_CDXL_DECODER 0
%define CONFIG_CINEPAK_DECODER 0
%define CONFIG_CLJR_DECODER 0
%define CONFIG_CLLC_DECODER 0
%define CONFIG_COMFORTNOISE_DECODER 0
%define CONFIG_CPIA_DECODER 0
%define CONFIG_CSCD_DECODER 0
%define CONFIG_CYUV_DECODER 0
%define CONFIG_DFA_DECODER 0
%define CONFIG_DIRAC_DECODER 0
%define CONFIG_DNXHD_DECODER 0
%define CONFIG_DPX_DECODER 0
%define CONFIG_DSICINVIDEO_DECODER 0
%define CONFIG_DVVIDEO_DECODER 0
%define CONFIG_DXA_DECODER 0
%define CONFIG_DXTORY_DECODER 0
%define CONFIG_EACMV_DECODER 0
%define CONFIG_EAMAD_DECODER 0
%define CONFIG_EATGQ_DECODER 0
%define CONFIG_EATGV_DECODER 0
%define CONFIG_EATQI_DECODER 0
%define CONFIG_EIGHTBPS_DECODER 0
%define CONFIG_EIGHTSVX_EXP_DECODER 0
%define CONFIG_EIGHTSVX_FIB_DECODER 0
%define CONFIG_ESCAPE124_DECODER 0
%define CONFIG_ESCAPE130_DECODER 0
%define CONFIG_EXR_DECODER 0
%define CONFIG_FFV1_DECODER 0
%define CONFIG_FFVHUFF_DECODER 0
%define CONFIG_FIC_DECODER 0
%define CONFIG_FLASHSV_DECODER 0
%define CONFIG_FLASHSV2_DECODER 0
%define CONFIG_FLIC_DECODER 0
%define CONFIG_FLV_DECODER 0
%define CONFIG_FOURXM_DECODER 0
%define CONFIG_FRAPS_DECODER 0
%define CONFIG_FRWU_DECODER 0
%define CONFIG_G2M_DECODER 0
%define CONFIG_GIF_DECODER 0
%define CONFIG_H261_DECODER 0
%define CONFIG_H263_DECODER 1
%define CONFIG_H263I_DECODER 0
%define CONFIG_H263P_DECODER 0
%define CONFIG_H264_DECODER 1
%define CONFIG_H264_CRYSTALHD_DECODER 0
%define CONFIG_H264_QSV_DECODER 0
%define CONFIG_H264_VDA_DECODER 0
%define CONFIG_H264_VDPAU_DECODER 0
%define CONFIG_HEVC_DECODER 0
%define CONFIG_HNM4_VIDEO_DECODER 0
%define CONFIG_HQX_DECODER 0
%define CONFIG_HUFFYUV_DECODER 0
%define CONFIG_IDCIN_DECODER 0
%define CONFIG_IFF_BYTERUN1_DECODER 0
%define CONFIG_IFF_ILBM_DECODER 0
%define CONFIG_INDEO2_DECODER 0
%define CONFIG_INDEO3_DECODER 0
%define CONFIG_INDEO4_DECODER 0
%define CONFIG_INDEO5_DECODER 0
%define CONFIG_INTERPLAY_VIDEO_DECODER 0
%define CONFIG_JPEG2000_DECODER 0
%define CONFIG_JPEGLS_DECODER 0
%define CONFIG_JV_DECODER 0
%define CONFIG_KGV1_DECODER 0
%define CONFIG_KMVC_DECODER 0
%define CONFIG_LAGARITH_DECODER 0
%define CONFIG_LOCO_DECODER 0
%define CONFIG_MDEC_DECODER 0
%define CONFIG_MIMIC_DECODER 0
%define CONFIG_MJPEG_DECODER 0
%define CONFIG_MJPEGB_DECODER 0
%define CONFIG_MMVIDEO_DECODER 0
%define CONFIG_MOTIONPIXELS_DECODER 0
%define CONFIG_MPEG_XVMC_DECODER 0
%define CONFIG_MPEG1VIDEO_DECODER 0
%define CONFIG_MPEG2VIDEO_DECODER 0
%define CONFIG_MPEG4_DECODER 1
%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
%define CONFIG_MPEG4_VDPAU_DECODER 0
%define CONFIG_MPEGVIDEO_DECODER 0
%define CONFIG_MPEG_VDPAU_DECODER 0
%define CONFIG_MPEG1_VDPAU_DECODER 0
%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
%define CONFIG_MSA1_DECODER 0
%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
%define CONFIG_MSMPEG4V1_DECODER 0
%define CONFIG_MSMPEG4V2_DECODER 0
%define CONFIG_MSMPEG4V3_DECODER 0
%define CONFIG_MSRLE_DECODER 0
%define CONFIG_MSS1_DECODER 0
%define CONFIG_MSS2_DECODER 0
%define CONFIG_MSVIDEO1_DECODER 0
%define CONFIG_MSZH_DECODER 0
%define CONFIG_MTS2_DECODER 0
%define CONFIG_MVC1_DECODER 0
%define CONFIG_MVC2_DECODER 0
%define CONFIG_MXPEG_DECODER 0
%define CONFIG_NUV_DECODER 0
%define CONFIG_PAF_VIDEO_DECODER 0
%define CONFIG_PAM_DECODER 0
%define CONFIG_PBM_DECODER 0
%define CONFIG_PCX_DECODER 0
%define CONFIG_PGM_DECODER 0
%define CONFIG_PGMYUV_DECODER 0
%define CONFIG_PICTOR_DECODER 0
%define CONFIG_PNG_DECODER 0
%define CONFIG_PPM_DECODER 0
%define CONFIG_PRORES_DECODER 0
%define CONFIG_PRORES_LGPL_DECODER 0
%define CONFIG_PTX_DECODER 0
%define CONFIG_QDRAW_DECODER 0
%define CONFIG_QPEG_DECODER 0
%define CONFIG_QTRLE_DECODER 0
%define CONFIG_R10K_DECODER 0
%define CONFIG_R210_DECODER 0
%define CONFIG_RAWVIDEO_DECODER 0
%define CONFIG_RL2_DECODER 0
%define CONFIG_ROQ_DECODER 0
%define CONFIG_RPZA_DECODER 0
%define CONFIG_RV10_DECODER 0
%define CONFIG_RV20_DECODER 0
%define CONFIG_RV30_DECODER 0
%define CONFIG_RV40_DECODER 0
%define CONFIG_S302M_DECODER 0
%define CONFIG_SANM_DECODER 0
%define CONFIG_SGI_DECODER 0
%define CONFIG_SGIRLE_DECODER 0
%define CONFIG_SMACKER_DECODER 0
%define CONFIG_SMC_DECODER 0
%define CONFIG_SMVJPEG_DECODER 0
%define CONFIG_SNOW_DECODER 0
%define CONFIG_SP5X_DECODER 0
%define CONFIG_SUNRAST_DECODER 0
%define CONFIG_SVQ1_DECODER 0
%define CONFIG_SVQ3_DECODER 0
%define CONFIG_TARGA_DECODER 0
%define CONFIG_TARGA_Y216_DECODER 0
%define CONFIG_TDSC_DECODER 0
%define CONFIG_THEORA_DECODER 1
%define CONFIG_THP_DECODER 0
%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
%define CONFIG_TIFF_DECODER 0
%define CONFIG_TMV_DECODER 0
%define CONFIG_TRUEMOTION1_DECODER 0
%define CONFIG_TRUEMOTION2_DECODER 0
%define CONFIG_TSCC_DECODER 0
%define CONFIG_TSCC2_DECODER 0
%define CONFIG_TXD_DECODER 0
%define CONFIG_ULTI_DECODER 0
%define CONFIG_UTVIDEO_DECODER 0
%define CONFIG_V210_DECODER 0
%define CONFIG_V210X_DECODER 0
%define CONFIG_V308_DECODER 0
%define CONFIG_V408_DECODER 0
%define CONFIG_V410_DECODER 0
%define CONFIG_VB_DECODER 0
%define CONFIG_VBLE_DECODER 0
%define CONFIG_VC1_DECODER 0
%define CONFIG_VC1_CRYSTALHD_DECODER 0
%define CONFIG_VC1_VDPAU_DECODER 0
%define CONFIG_VC1IMAGE_DECODER 0
%define CONFIG_VCR1_DECODER 0
%define CONFIG_VMDVIDEO_DECODER 0
%define CONFIG_VMNC_DECODER 0
%define CONFIG_VP3_DECODER 1
%define CONFIG_VP5_DECODER 0
%define CONFIG_VP6_DECODER 0
%define CONFIG_VP6A_DECODER 0
%define CONFIG_VP6F_DECODER 0
%define CONFIG_VP7_DECODER 0
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 0
%define CONFIG_VQA_DECODER 0
%define CONFIG_WEBP_DECODER 0
%define CONFIG_WMV1_DECODER 0
%define CONFIG_WMV2_DECODER 0
%define CONFIG_WMV3_DECODER 0
%define CONFIG_WMV3_CRYSTALHD_DECODER 0
%define CONFIG_WMV3_VDPAU_DECODER 0
%define CONFIG_WMV3IMAGE_DECODER 0
%define CONFIG_WNV1_DECODER 0
%define CONFIG_XAN_WC3_DECODER 0
%define CONFIG_XAN_WC4_DECODER 0
%define CONFIG_XBM_DECODER 0
%define CONFIG_XFACE_DECODER 0
%define CONFIG_XL_DECODER 0
%define CONFIG_XWD_DECODER 0
%define CONFIG_Y41P_DECODER 0
%define CONFIG_YOP_DECODER 0
%define CONFIG_YUV4_DECODER 0
%define CONFIG_ZERO12V_DECODER 0
%define CONFIG_ZEROCODEC_DECODER 0
%define CONFIG_ZLIB_DECODER 0
%define CONFIG_ZMBV_DECODER 0
%define CONFIG_AAC_DECODER 1
%define CONFIG_AAC_LATM_DECODER 0
%define CONFIG_AC3_DECODER 0
%define CONFIG_AC3_FIXED_DECODER 0
%define CONFIG_ALAC_DECODER 0
%define CONFIG_ALS_DECODER 0
%define CONFIG_AMRNB_DECODER 1
%define CONFIG_AMRWB_DECODER 1
%define CONFIG_APE_DECODER 0
%define CONFIG_ATRAC1_DECODER 0
%define CONFIG_ATRAC3_DECODER 0
%define CONFIG_ATRAC3P_DECODER 0
%define CONFIG_BINKAUDIO_DCT_DECODER 0
%define CONFIG_BINKAUDIO_RDFT_DECODER 0
%define CONFIG_BMV_AUDIO_DECODER 0
%define CONFIG_COOK_DECODER 0
%define CONFIG_DCA_DECODER 0
%define CONFIG_DSD_LSBF_DECODER 0
%define CONFIG_DSD_MSBF_DECODER 0
%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
%define CONFIG_DSICINAUDIO_DECODER 0
%define CONFIG_DSS_SP_DECODER 0
%define CONFIG_EAC3_DECODER 0
%define CONFIG_EVRC_DECODER 0
%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
%define CONFIG_G723_1_DECODER 0
%define CONFIG_G729_DECODER 0
%define CONFIG_GSM_DECODER 0
%define CONFIG_GSM_MS_DECODER 1
%define CONFIG_IAC_DECODER 0
%define CONFIG_IMC_DECODER 0
%define CONFIG_MACE3_DECODER 0
%define CONFIG_MACE6_DECODER 0
%define CONFIG_METASOUND_DECODER 0
%define CONFIG_MLP_DECODER 0
%define CONFIG_MP1_DECODER 0
%define CONFIG_MP1FLOAT_DECODER 0
%define CONFIG_MP2_DECODER 0
%define CONFIG_MP2FLOAT_DECODER 0
%define CONFIG_MP3_DECODER 1
%define CONFIG_MP3FLOAT_DECODER 0
%define CONFIG_MP3ADU_DECODER 0
%define CONFIG_MP3ADUFLOAT_DECODER 0
%define CONFIG_MP3ON4_DECODER 0
%define CONFIG_MP3ON4FLOAT_DECODER 0
%define CONFIG_MPC7_DECODER 0
%define CONFIG_MPC8_DECODER 0
%define CONFIG_NELLYMOSER_DECODER 0
%define CONFIG_ON2AVC_DECODER 0
%define CONFIG_OPUS_DECODER 0
%define CONFIG_PAF_AUDIO_DECODER 0
%define CONFIG_QCELP_DECODER 0
%define CONFIG_QDM2_DECODER 0
%define CONFIG_RA_144_DECODER 0
%define CONFIG_RA_288_DECODER 0
%define CONFIG_RALF_DECODER 0
%define CONFIG_SHORTEN_DECODER 0
%define CONFIG_SIPR_DECODER 0
%define CONFIG_SMACKAUD_DECODER 0
%define CONFIG_SONIC_DECODER 0
%define CONFIG_TAK_DECODER 0
%define CONFIG_TRUEHD_DECODER 0
%define CONFIG_TRUESPEECH_DECODER 0
%define CONFIG_TTA_DECODER 0
%define CONFIG_TWINVQ_DECODER 0
%define CONFIG_VMDAUDIO_DECODER 0
%define CONFIG_VORBIS_DECODER 1
%define CONFIG_WAVPACK_DECODER 0
%define CONFIG_WMALOSSLESS_DECODER 0
%define CONFIG_WMAPRO_DECODER 0
%define CONFIG_WMAV1_DECODER 0
%define CONFIG_WMAV2_DECODER 0
%define CONFIG_WMAVOICE_DECODER 0
%define CONFIG_WS_SND1_DECODER 0
%define CONFIG_PCM_ALAW_DECODER 1
%define CONFIG_PCM_BLURAY_DECODER 0
%define CONFIG_PCM_DVD_DECODER 0
%define CONFIG_PCM_F32BE_DECODER 0
%define CONFIG_PCM_F32LE_DECODER 1
%define CONFIG_PCM_F64BE_DECODER 0
%define CONFIG_PCM_F64LE_DECODER 0
%define CONFIG_PCM_LXF_DECODER 0
%define CONFIG_PCM_MULAW_DECODER 1
%define CONFIG_PCM_S8_DECODER 0
%define CONFIG_PCM_S8_PLANAR_DECODER 0
%define CONFIG_PCM_S16BE_DECODER 1
%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
%define CONFIG_PCM_S16LE_DECODER 1
%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
%define CONFIG_PCM_S24BE_DECODER 1
%define CONFIG_PCM_S24DAUD_DECODER 0
%define CONFIG_PCM_S24LE_DECODER 1
%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
%define CONFIG_PCM_S32BE_DECODER 0
%define CONFIG_PCM_S32LE_DECODER 0
%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
%define CONFIG_PCM_U8_DECODER 1
%define CONFIG_PCM_U16BE_DECODER 0
%define CONFIG_PCM_U16LE_DECODER 0
%define CONFIG_PCM_U24BE_DECODER 0
%define CONFIG_PCM_U24LE_DECODER 0
%define CONFIG_PCM_U32BE_DECODER 0
%define CONFIG_PCM_U32LE_DECODER 0
%define CONFIG_PCM_ZORK_DECODER 0
%define CONFIG_INTERPLAY_DPCM_DECODER 0
%define CONFIG_ROQ_DPCM_DECODER 0
%define CONFIG_SOL_DPCM_DECODER 0
%define CONFIG_XAN_DPCM_DECODER 0
%define CONFIG_ADPCM_4XM_DECODER 0
%define CONFIG_ADPCM_ADX_DECODER 0
%define CONFIG_ADPCM_AFC_DECODER 0
%define CONFIG_ADPCM_CT_DECODER 0
%define CONFIG_ADPCM_DTK_DECODER 0
%define CONFIG_ADPCM_EA_DECODER 0
%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
%define CONFIG_ADPCM_EA_R1_DECODER 0
%define CONFIG_ADPCM_EA_R2_DECODER 0
%define CONFIG_ADPCM_EA_R3_DECODER 0
%define CONFIG_ADPCM_EA_XAS_DECODER 0
%define CONFIG_ADPCM_G722_DECODER 0
%define CONFIG_ADPCM_G726_DECODER 0
%define CONFIG_ADPCM_G726LE_DECODER 0
%define CONFIG_ADPCM_IMA_AMV_DECODER 0
%define CONFIG_ADPCM_IMA_APC_DECODER 0
%define CONFIG_ADPCM_IMA_DK3_DECODER 0
%define CONFIG_ADPCM_IMA_DK4_DECODER 0
%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
%define CONFIG_ADPCM_IMA_ISS_DECODER 0
%define CONFIG_ADPCM_IMA_OKI_DECODER 0
%define CONFIG_ADPCM_IMA_QT_DECODER 0
%define CONFIG_ADPCM_IMA_RAD_DECODER 0
%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
%define CONFIG_ADPCM_IMA_WAV_DECODER 0
%define CONFIG_ADPCM_IMA_WS_DECODER 0
%define CONFIG_ADPCM_MS_DECODER 0
%define CONFIG_ADPCM_SBPRO_2_DECODER 0
%define CONFIG_ADPCM_SBPRO_3_DECODER 0
%define CONFIG_ADPCM_SBPRO_4_DECODER 0
%define CONFIG_ADPCM_SWF_DECODER 0
%define CONFIG_ADPCM_THP_DECODER 0
%define CONFIG_ADPCM_VIMA_DECODER 0
%define CONFIG_ADPCM_XA_DECODER 0
%define CONFIG_ADPCM_YAMAHA_DECODER 0
%define CONFIG_VIMA_DECODER 0
%define CONFIG_SSA_DECODER 0
%define CONFIG_ASS_DECODER 0
%define CONFIG_CCAPTION_DECODER 0
%define CONFIG_DVBSUB_DECODER 0
%define CONFIG_DVDSUB_DECODER 0
%define CONFIG_JACOSUB_DECODER 0
%define CONFIG_MICRODVD_DECODER 0
%define CONFIG_MOVTEXT_DECODER 0
%define CONFIG_MPL2_DECODER 0
%define CONFIG_PGSSUB_DECODER 0
%define CONFIG_PJS_DECODER 0
%define CONFIG_REALTEXT_DECODER 0
%define CONFIG_SAMI_DECODER 0
%define CONFIG_SRT_DECODER 0
%define CONFIG_STL_DECODER 0
%define CONFIG_SUBRIP_DECODER 0
%define CONFIG_SUBVIEWER_DECODER 0
%define CONFIG_SUBVIEWER1_DECODER 0
%define CONFIG_TEXT_DECODER 0
%define CONFIG_VPLAYER_DECODER 0
%define CONFIG_WEBVTT_DECODER 0
%define CONFIG_XSUB_DECODER 0
%define CONFIG_LIBCELT_DECODER 0
%define CONFIG_LIBDCADEC_DECODER 0
%define CONFIG_LIBFDK_AAC_DECODER 0
%define CONFIG_LIBGSM_DECODER 0
%define CONFIG_LIBGSM_MS_DECODER 0
%define CONFIG_LIBILBC_DECODER 0
%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
%define CONFIG_LIBOPENJPEG_DECODER 0
%define CONFIG_LIBOPUS_DECODER 0
%define CONFIG_LIBSCHROEDINGER_DECODER 0
%define CONFIG_LIBSPEEX_DECODER 0
%define CONFIG_LIBSTAGEFRIGHT_H264_DECODER 0
%define CONFIG_LIBUTVIDEO_DECODER 0
%define CONFIG_LIBVORBIS_DECODER 0
%define CONFIG_LIBVPX_VP8_DECODER 0
%define CONFIG_LIBVPX_VP9_DECODER 0
%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
%define CONFIG_BINTEXT_DECODER 0
%define CONFIG_XBIN_DECODER 0
%define CONFIG_IDF_DECODER 0
%define CONFIG_AAC_DEMUXER 1
%define CONFIG_AC3_DEMUXER 0
%define CONFIG_ACT_DEMUXER 0
%define CONFIG_ADF_DEMUXER 0
%define CONFIG_ADP_DEMUXER 0
%define CONFIG_ADX_DEMUXER 0
%define CONFIG_AEA_DEMUXER 0
%define CONFIG_AFC_DEMUXER 0
%define CONFIG_AIFF_DEMUXER 0
%define CONFIG_AMR_DEMUXER 1
%define CONFIG_ANM_DEMUXER 0
%define CONFIG_APC_DEMUXER 0
%define CONFIG_APE_DEMUXER 0
%define CONFIG_APNG_DEMUXER 0
%define CONFIG_AQTITLE_DEMUXER 0
%define CONFIG_ASF_DEMUXER 0
%define CONFIG_ASS_DEMUXER 0
%define CONFIG_AST_DEMUXER 0
%define CONFIG_AU_DEMUXER 0
%define CONFIG_AVI_DEMUXER 1
%define CONFIG_AVISYNTH_DEMUXER 0
%define CONFIG_AVR_DEMUXER 0
%define CONFIG_AVS_DEMUXER 0
%define CONFIG_BETHSOFTVID_DEMUXER 0
%define CONFIG_BFI_DEMUXER 0
%define CONFIG_BINTEXT_DEMUXER 0
%define CONFIG_BINK_DEMUXER 0
%define CONFIG_BIT_DEMUXER 0
%define CONFIG_BMV_DEMUXER 0
%define CONFIG_BRSTM_DEMUXER 0
%define CONFIG_BOA_DEMUXER 0
%define CONFIG_C93_DEMUXER 0
%define CONFIG_CAF_DEMUXER 0
%define CONFIG_CAVSVIDEO_DEMUXER 0
%define CONFIG_CDG_DEMUXER 0
%define CONFIG_CDXL_DEMUXER 0
%define CONFIG_CINE_DEMUXER 0
%define CONFIG_CONCAT_DEMUXER 0
%define CONFIG_DATA_DEMUXER 0
%define CONFIG_DAUD_DEMUXER 0
%define CONFIG_DFA_DEMUXER 0
%define CONFIG_DIRAC_DEMUXER 0
%define CONFIG_DNXHD_DEMUXER 0
%define CONFIG_DSF_DEMUXER 0
%define CONFIG_DSICIN_DEMUXER 0
%define CONFIG_DSS_DEMUXER 0
%define CONFIG_DTS_DEMUXER 0
%define CONFIG_DTSHD_DEMUXER 0
%define CONFIG_DV_DEMUXER 0
%define CONFIG_DVBSUB_DEMUXER 0
%define CONFIG_DXA_DEMUXER 0
%define CONFIG_EA_DEMUXER 0
%define CONFIG_EA_CDATA_DEMUXER 0
%define CONFIG_EAC3_DEMUXER 0
%define CONFIG_EPAF_DEMUXER 0
%define CONFIG_FFM_DEMUXER 0
%define CONFIG_FFMETADATA_DEMUXER 0
%define CONFIG_FILMSTRIP_DEMUXER 0
%define CONFIG_FLAC_DEMUXER 1
%define CONFIG_FLIC_DEMUXER 0
%define CONFIG_FLV_DEMUXER 0
%define CONFIG_LIVE_FLV_DEMUXER 0
%define CONFIG_FOURXM_DEMUXER 0
%define CONFIG_FRM_DEMUXER 0
%define CONFIG_G722_DEMUXER 0
%define CONFIG_G723_1_DEMUXER 0
%define CONFIG_G729_DEMUXER 0
%define CONFIG_GIF_DEMUXER 0
%define CONFIG_GSM_DEMUXER 1
%define CONFIG_GXF_DEMUXER 0
%define CONFIG_H261_DEMUXER 0
%define CONFIG_H263_DEMUXER 0
%define CONFIG_H264_DEMUXER 0
%define CONFIG_HEVC_DEMUXER 0
%define CONFIG_HLS_DEMUXER 0
%define CONFIG_HNM_DEMUXER 0
%define CONFIG_ICO_DEMUXER 0
%define CONFIG_IDCIN_DEMUXER 0
%define CONFIG_IDF_DEMUXER 0
%define CONFIG_IFF_DEMUXER 0
%define CONFIG_ILBC_DEMUXER 0
%define CONFIG_IMAGE2_DEMUXER 0
%define CONFIG_IMAGE2PIPE_DEMUXER 0
%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
%define CONFIG_INGENIENT_DEMUXER 0
%define CONFIG_IPMOVIE_DEMUXER 0
%define CONFIG_IRCAM_DEMUXER 0
%define CONFIG_ISS_DEMUXER 0
%define CONFIG_IV8_DEMUXER 0
%define CONFIG_IVF_DEMUXER 0
%define CONFIG_JACOSUB_DEMUXER 0
%define CONFIG_JV_DEMUXER 0
%define CONFIG_LATM_DEMUXER 0
%define CONFIG_LMLM4_DEMUXER 0
%define CONFIG_LOAS_DEMUXER 0
%define CONFIG_LRC_DEMUXER 0
%define CONFIG_LVF_DEMUXER 0
%define CONFIG_LXF_DEMUXER 0
%define CONFIG_M4V_DEMUXER 0
%define CONFIG_MATROSKA_DEMUXER 1
%define CONFIG_MGSTS_DEMUXER 0
%define CONFIG_MICRODVD_DEMUXER 0
%define CONFIG_MJPEG_DEMUXER 0
%define CONFIG_MLP_DEMUXER 0
%define CONFIG_MLV_DEMUXER 0
%define CONFIG_MM_DEMUXER 0
%define CONFIG_MMF_DEMUXER 0
%define CONFIG_MOV_DEMUXER 1
%define CONFIG_MP3_DEMUXER 1
%define CONFIG_MPC_DEMUXER 0
%define CONFIG_MPC8_DEMUXER 0
%define CONFIG_MPEGPS_DEMUXER 0
%define CONFIG_MPEGTS_DEMUXER 0
%define CONFIG_MPEGTSRAW_DEMUXER 0
%define CONFIG_MPEGVIDEO_DEMUXER 0
%define CONFIG_MPL2_DEMUXER 0
%define CONFIG_MPSUB_DEMUXER 0
%define CONFIG_MSNWC_TCP_DEMUXER 0
%define CONFIG_MTV_DEMUXER 0
%define CONFIG_MV_DEMUXER 0
%define CONFIG_MVI_DEMUXER 0
%define CONFIG_MXF_DEMUXER 0
%define CONFIG_MXG_DEMUXER 0
%define CONFIG_NC_DEMUXER 0
%define CONFIG_NISTSPHERE_DEMUXER 0
%define CONFIG_NSV_DEMUXER 0
%define CONFIG_NUT_DEMUXER 0
%define CONFIG_NUV_DEMUXER 0
%define CONFIG_OGG_DEMUXER 1
%define CONFIG_OMA_DEMUXER 0
%define CONFIG_PAF_DEMUXER 0
%define CONFIG_PCM_ALAW_DEMUXER 0
%define CONFIG_PCM_MULAW_DEMUXER 0
%define CONFIG_PCM_F64BE_DEMUXER 0
%define CONFIG_PCM_F64LE_DEMUXER 0
%define CONFIG_PCM_F32BE_DEMUXER 0
%define CONFIG_PCM_F32LE_DEMUXER 0
%define CONFIG_PCM_S32BE_DEMUXER 0
%define CONFIG_PCM_S32LE_DEMUXER 0
%define CONFIG_PCM_S24BE_DEMUXER 0
%define CONFIG_PCM_S24LE_DEMUXER 0
%define CONFIG_PCM_S16BE_DEMUXER 0
%define CONFIG_PCM_S16LE_DEMUXER 0
%define CONFIG_PCM_S8_DEMUXER 0
%define CONFIG_PCM_U32BE_DEMUXER 0
%define CONFIG_PCM_U32LE_DEMUXER 0
%define CONFIG_PCM_U24BE_DEMUXER 0
%define CONFIG_PCM_U24LE_DEMUXER 0
%define CONFIG_PCM_U16BE_DEMUXER 0
%define CONFIG_PCM_U16LE_DEMUXER 0
%define CONFIG_PCM_U8_DEMUXER 0
%define CONFIG_PJS_DEMUXER 0
%define CONFIG_PMP_DEMUXER 0
%define CONFIG_PVA_DEMUXER 0
%define CONFIG_PVF_DEMUXER 0
%define CONFIG_QCP_DEMUXER 0
%define CONFIG_R3D_DEMUXER 0
%define CONFIG_RAWVIDEO_DEMUXER 0
%define CONFIG_REALTEXT_DEMUXER 0
%define CONFIG_REDSPARK_DEMUXER 0
%define CONFIG_RL2_DEMUXER 0
%define CONFIG_RM_DEMUXER 0
%define CONFIG_ROQ_DEMUXER 0
%define CONFIG_RPL_DEMUXER 0
%define CONFIG_RSD_DEMUXER 0
%define CONFIG_RSO_DEMUXER 0
%define CONFIG_RTP_DEMUXER 0
%define CONFIG_RTSP_DEMUXER 0
%define CONFIG_SAMI_DEMUXER 0
%define CONFIG_SAP_DEMUXER 0
%define CONFIG_SBG_DEMUXER 0
%define CONFIG_SDP_DEMUXER 0
%define CONFIG_SDR2_DEMUXER 0
%define CONFIG_SEGAFILM_DEMUXER 0
%define CONFIG_SHORTEN_DEMUXER 0
%define CONFIG_SIFF_DEMUXER 0
%define CONFIG_SLN_DEMUXER 0
%define CONFIG_SMACKER_DEMUXER 0
%define CONFIG_SMJPEG_DEMUXER 0
%define CONFIG_SMUSH_DEMUXER 0
%define CONFIG_SOL_DEMUXER 0
%define CONFIG_SOX_DEMUXER 0
%define CONFIG_SPDIF_DEMUXER 0
%define CONFIG_SRT_DEMUXER 0
%define CONFIG_STR_DEMUXER 0
%define CONFIG_STL_DEMUXER 0
%define CONFIG_SUBVIEWER1_DEMUXER 0
%define CONFIG_SUBVIEWER_DEMUXER 0
%define CONFIG_SUP_DEMUXER 0
%define CONFIG_SWF_DEMUXER 0
%define CONFIG_TAK_DEMUXER 0
%define CONFIG_TEDCAPTIONS_DEMUXER 0
%define CONFIG_THP_DEMUXER 0
%define CONFIG_TIERTEXSEQ_DEMUXER 0
%define CONFIG_TMV_DEMUXER 0
%define CONFIG_TRUEHD_DEMUXER 0
%define CONFIG_TTA_DEMUXER 0
%define CONFIG_TXD_DEMUXER 0
%define CONFIG_TTY_DEMUXER 0
%define CONFIG_VC1_DEMUXER 0
%define CONFIG_VC1T_DEMUXER 0
%define CONFIG_VIVO_DEMUXER 0
%define CONFIG_VMD_DEMUXER 0
%define CONFIG_VOBSUB_DEMUXER 0
%define CONFIG_VOC_DEMUXER 0
%define CONFIG_VPLAYER_DEMUXER 0
%define CONFIG_VQF_DEMUXER 0
%define CONFIG_W64_DEMUXER 0
%define CONFIG_WAV_DEMUXER 1
%define CONFIG_WC3_DEMUXER 0
%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
%define CONFIG_WEBVTT_DEMUXER 0
%define CONFIG_WSAUD_DEMUXER 0
%define CONFIG_WSVQA_DEMUXER 0
%define CONFIG_WTV_DEMUXER 0
%define CONFIG_WV_DEMUXER 0
%define CONFIG_XA_DEMUXER 0
%define CONFIG_XBIN_DEMUXER 0
%define CONFIG_XMV_DEMUXER 0
%define CONFIG_XWMA_DEMUXER 0
%define CONFIG_YOP_DEMUXER 0
%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
%define CONFIG_LIBGME_DEMUXER 0
%define CONFIG_LIBMODPLUG_DEMUXER 0
%define CONFIG_LIBNUT_DEMUXER 0
%define CONFIG_LIBQUVI_DEMUXER 0
%define CONFIG_A64MULTI_ENCODER 0
%define CONFIG_A64MULTI5_ENCODER 0
%define CONFIG_ALIAS_PIX_ENCODER 0
%define CONFIG_AMV_ENCODER 0
%define CONFIG_ASV1_ENCODER 0
%define CONFIG_ASV2_ENCODER 0
%define CONFIG_AVRP_ENCODER 0
%define CONFIG_AVUI_ENCODER 0
%define CONFIG_AYUV_ENCODER 0
%define CONFIG_BMP_ENCODER 0
%define CONFIG_CINEPAK_ENCODER 0
%define CONFIG_CLJR_ENCODER 0
%define CONFIG_COMFORTNOISE_ENCODER 0
%define CONFIG_DNXHD_ENCODER 0
%define CONFIG_DPX_ENCODER 0
%define CONFIG_DVVIDEO_ENCODER 0
%define CONFIG_FFV1_ENCODER 0
%define CONFIG_FFVHUFF_ENCODER 0
%define CONFIG_FLASHSV_ENCODER 0
%define CONFIG_FLASHSV2_ENCODER 0
%define CONFIG_FLV_ENCODER 0
%define CONFIG_GIF_ENCODER 0
%define CONFIG_H261_ENCODER 0
%define CONFIG_H263_ENCODER 0
%define CONFIG_H263P_ENCODER 0
%define CONFIG_HUFFYUV_ENCODER 0
%define CONFIG_JPEG2000_ENCODER 0
%define CONFIG_JPEGLS_ENCODER 0
%define CONFIG_LJPEG_ENCODER 0
%define CONFIG_MJPEG_ENCODER 0
%define CONFIG_MPEG1VIDEO_ENCODER 0
%define CONFIG_MPEG2VIDEO_ENCODER 0
%define CONFIG_MPEG4_ENCODER 0
%define CONFIG_MSMPEG4V2_ENCODER 0
%define CONFIG_MSMPEG4V3_ENCODER 0
%define CONFIG_MSVIDEO1_ENCODER 0
%define CONFIG_NVENC_ENCODER 0
%define CONFIG_PAM_ENCODER 0
%define CONFIG_PBM_ENCODER 0
%define CONFIG_PCX_ENCODER 0
%define CONFIG_PGM_ENCODER 0
%define CONFIG_PGMYUV_ENCODER 0
%define CONFIG_PNG_ENCODER 0
%define CONFIG_PPM_ENCODER 0
%define CONFIG_PRORES_ENCODER 0
%define CONFIG_PRORES_AW_ENCODER 0
%define CONFIG_PRORES_KS_ENCODER 0
%define CONFIG_QTRLE_ENCODER 0
%define CONFIG_R10K_ENCODER 0
%define CONFIG_R210_ENCODER 0
%define CONFIG_RAWVIDEO_ENCODER 0
%define CONFIG_ROQ_ENCODER 0
%define CONFIG_RV10_ENCODER 0
%define CONFIG_RV20_ENCODER 0
%define CONFIG_S302M_ENCODER 0
%define CONFIG_SGI_ENCODER 0
%define CONFIG_SNOW_ENCODER 0
%define CONFIG_SUNRAST_ENCODER 0
%define CONFIG_SVQ1_ENCODER 0
%define CONFIG_TARGA_ENCODER 0
%define CONFIG_TIFF_ENCODER 0
%define CONFIG_UTVIDEO_ENCODER 0
%define CONFIG_V210_ENCODER 0
%define CONFIG_V308_ENCODER 0
%define CONFIG_V408_ENCODER 0
%define CONFIG_V410_ENCODER 0
%define CONFIG_WMV1_ENCODER 0
%define CONFIG_WMV2_ENCODER 0
%define CONFIG_XBM_ENCODER 0
%define CONFIG_XFACE_ENCODER 0
%define CONFIG_XWD_ENCODER 0
%define CONFIG_Y41P_ENCODER 0
%define CONFIG_YUV4_ENCODER 0
%define CONFIG_ZLIB_ENCODER 0
%define CONFIG_ZMBV_ENCODER 0
%define CONFIG_AAC_ENCODER 0
%define CONFIG_AC3_ENCODER 0
%define CONFIG_AC3_FIXED_ENCODER 0
%define CONFIG_ALAC_ENCODER 0
%define CONFIG_DCA_ENCODER 0
%define CONFIG_EAC3_ENCODER 0
%define CONFIG_FLAC_ENCODER 0
%define CONFIG_G723_1_ENCODER 0
%define CONFIG_MP2_ENCODER 0
%define CONFIG_MP2FIXED_ENCODER 0
%define CONFIG_NELLYMOSER_ENCODER 0
%define CONFIG_RA_144_ENCODER 0
%define CONFIG_SONIC_ENCODER 0
%define CONFIG_SONIC_LS_ENCODER 0
%define CONFIG_TTA_ENCODER 0
%define CONFIG_VORBIS_ENCODER 0
%define CONFIG_WAVPACK_ENCODER 0
%define CONFIG_WMAV1_ENCODER 0
%define CONFIG_WMAV2_ENCODER 0
%define CONFIG_PCM_ALAW_ENCODER 0
%define CONFIG_PCM_F32BE_ENCODER 0
%define CONFIG_PCM_F32LE_ENCODER 0
%define CONFIG_PCM_F64BE_ENCODER 0
%define CONFIG_PCM_F64LE_ENCODER 0
%define CONFIG_PCM_MULAW_ENCODER 0
%define CONFIG_PCM_S8_ENCODER 0
%define CONFIG_PCM_S8_PLANAR_ENCODER 0
%define CONFIG_PCM_S16BE_ENCODER 0
%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
%define CONFIG_PCM_S16LE_ENCODER 0
%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
%define CONFIG_PCM_S24BE_ENCODER 0
%define CONFIG_PCM_S24DAUD_ENCODER 0
%define CONFIG_PCM_S24LE_ENCODER 0
%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
%define CONFIG_PCM_S32BE_ENCODER 0
%define CONFIG_PCM_S32LE_ENCODER 0
%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
%define CONFIG_PCM_U8_ENCODER 0
%define CONFIG_PCM_U16BE_ENCODER 0
%define CONFIG_PCM_U16LE_ENCODER 0
%define CONFIG_PCM_U24BE_ENCODER 0
%define CONFIG_PCM_U24LE_ENCODER 0
%define CONFIG_PCM_U32BE_ENCODER 0
%define CONFIG_PCM_U32LE_ENCODER 0
%define CONFIG_ROQ_DPCM_ENCODER 0
%define CONFIG_ADPCM_ADX_ENCODER 0
%define CONFIG_ADPCM_G722_ENCODER 0
%define CONFIG_ADPCM_G726_ENCODER 0
%define CONFIG_ADPCM_IMA_QT_ENCODER 0
%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
%define CONFIG_ADPCM_MS_ENCODER 0
%define CONFIG_ADPCM_SWF_ENCODER 0
%define CONFIG_ADPCM_YAMAHA_ENCODER 0
%define CONFIG_SSA_ENCODER 0
%define CONFIG_ASS_ENCODER 0
%define CONFIG_DVBSUB_ENCODER 0
%define CONFIG_DVDSUB_ENCODER 0
%define CONFIG_MOVTEXT_ENCODER 0
%define CONFIG_SRT_ENCODER 0
%define CONFIG_SUBRIP_ENCODER 0
%define CONFIG_WEBVTT_ENCODER 0
%define CONFIG_XSUB_ENCODER 0
%define CONFIG_LIBFAAC_ENCODER 0
%define CONFIG_LIBFDK_AAC_ENCODER 0
%define CONFIG_LIBGSM_ENCODER 0
%define CONFIG_LIBGSM_MS_ENCODER 0
%define CONFIG_LIBILBC_ENCODER 0
%define CONFIG_LIBMP3LAME_ENCODER 0
%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
%define CONFIG_LIBOPENJPEG_ENCODER 0
%define CONFIG_LIBOPUS_ENCODER 0
%define CONFIG_LIBSCHROEDINGER_ENCODER 0
%define CONFIG_LIBSHINE_ENCODER 0
%define CONFIG_LIBSPEEX_ENCODER 0
%define CONFIG_LIBTHEORA_ENCODER 0
%define CONFIG_LIBTWOLAME_ENCODER 0
%define CONFIG_LIBUTVIDEO_ENCODER 0
%define CONFIG_LIBVO_AACENC_ENCODER 0
%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
%define CONFIG_LIBVORBIS_ENCODER 0
%define CONFIG_LIBVPX_VP8_ENCODER 0
%define CONFIG_LIBVPX_VP9_ENCODER 0
%define CONFIG_LIBWAVPACK_ENCODER 0
%define CONFIG_LIBWEBP_ENCODER 0
%define CONFIG_LIBX264_ENCODER 0
%define CONFIG_LIBX264RGB_ENCODER 0
%define CONFIG_LIBX265_ENCODER 0
%define CONFIG_LIBXAVS_ENCODER 0
%define CONFIG_LIBXVID_ENCODER 0
%define CONFIG_LIBAACPLUS_ENCODER 0
%define CONFIG_LIBOPENH264_ENCODER 0
%define CONFIG_ADELAY_FILTER 0
%define CONFIG_AECHO_FILTER 0
%define CONFIG_AEVAL_FILTER 0
%define CONFIG_AFADE_FILTER 0
%define CONFIG_AFORMAT_FILTER 0
%define CONFIG_AINTERLEAVE_FILTER 0
%define CONFIG_ALLPASS_FILTER 0
%define CONFIG_AMERGE_FILTER 0
%define CONFIG_AMIX_FILTER 0
%define CONFIG_ANULL_FILTER 0
%define CONFIG_APAD_FILTER 0
%define CONFIG_APERMS_FILTER 0
%define CONFIG_APHASER_FILTER 0
%define CONFIG_ARESAMPLE_FILTER 0
%define CONFIG_ASELECT_FILTER 0
%define CONFIG_ASENDCMD_FILTER 0
%define CONFIG_ASETNSAMPLES_FILTER 0
%define CONFIG_ASETPTS_FILTER 0
%define CONFIG_ASETRATE_FILTER 0
%define CONFIG_ASETTB_FILTER 0
%define CONFIG_ASHOWINFO_FILTER 0
%define CONFIG_ASPLIT_FILTER 0
%define CONFIG_ASTATS_FILTER 0
%define CONFIG_ASTREAMSYNC_FILTER 0
%define CONFIG_ASYNCTS_FILTER 0
%define CONFIG_ATEMPO_FILTER 0
%define CONFIG_ATRIM_FILTER 0
%define CONFIG_AZMQ_FILTER 0
%define CONFIG_BANDPASS_FILTER 0
%define CONFIG_BANDREJECT_FILTER 0
%define CONFIG_BASS_FILTER 0
%define CONFIG_BIQUAD_FILTER 0
%define CONFIG_BS2B_FILTER 0
%define CONFIG_CHANNELMAP_FILTER 0
%define CONFIG_CHANNELSPLIT_FILTER 0
%define CONFIG_COMPAND_FILTER 0
%define CONFIG_DCSHIFT_FILTER 0
%define CONFIG_EARWAX_FILTER 0
%define CONFIG_EBUR128_FILTER 0
%define CONFIG_EQUALIZER_FILTER 0
%define CONFIG_FLANGER_FILTER 0
%define CONFIG_HIGHPASS_FILTER 0
%define CONFIG_JOIN_FILTER 0
%define CONFIG_LADSPA_FILTER 0
%define CONFIG_LOWPASS_FILTER 0
%define CONFIG_PAN_FILTER 0
%define CONFIG_REPLAYGAIN_FILTER 0
%define CONFIG_RESAMPLE_FILTER 0
%define CONFIG_SILENCEDETECT_FILTER 0
%define CONFIG_SILENCEREMOVE_FILTER 0
%define CONFIG_TREBLE_FILTER 0
%define CONFIG_VOLUME_FILTER 0
%define CONFIG_VOLUMEDETECT_FILTER 0
%define CONFIG_AEVALSRC_FILTER 0
%define CONFIG_ANULLSRC_FILTER 0
%define CONFIG_FLITE_FILTER 0
%define CONFIG_SINE_FILTER 0
%define CONFIG_ANULLSINK_FILTER 0
%define CONFIG_ALPHAEXTRACT_FILTER 0
%define CONFIG_ALPHAMERGE_FILTER 0
%define CONFIG_ASS_FILTER 0
%define CONFIG_BBOX_FILTER 0
%define CONFIG_BLACKDETECT_FILTER 0
%define CONFIG_BLACKFRAME_FILTER 0
%define CONFIG_BLEND_FILTER 0
%define CONFIG_BOXBLUR_FILTER 0
%define CONFIG_CODECVIEW_FILTER 0
%define CONFIG_COLORBALANCE_FILTER 0
%define CONFIG_COLORCHANNELMIXER_FILTER 0
%define CONFIG_COLORLEVELS_FILTER 0
%define CONFIG_COLORMATRIX_FILTER 0
%define CONFIG_COPY_FILTER 0
%define CONFIG_CROP_FILTER 0
%define CONFIG_CROPDETECT_FILTER 0
%define CONFIG_CURVES_FILTER 0
%define CONFIG_DCTDNOIZ_FILTER 0
%define CONFIG_DECIMATE_FILTER 0
%define CONFIG_DEJUDDER_FILTER 0
%define CONFIG_DELOGO_FILTER 0
%define CONFIG_DESHAKE_FILTER 0
%define CONFIG_DRAWBOX_FILTER 0
%define CONFIG_DRAWGRID_FILTER 0
%define CONFIG_DRAWTEXT_FILTER 0
%define CONFIG_EDGEDETECT_FILTER 0
%define CONFIG_ELBG_FILTER 0
%define CONFIG_EQ_FILTER 0
%define CONFIG_EXTRACTPLANES_FILTER 0
%define CONFIG_FADE_FILTER 0
%define CONFIG_FFTFILT_FILTER 0
%define CONFIG_FIELD_FILTER 0
%define CONFIG_FIELDMATCH_FILTER 0
%define CONFIG_FIELDORDER_FILTER 0
%define CONFIG_FORMAT_FILTER 0
%define CONFIG_FPS_FILTER 0
%define CONFIG_FRAMEPACK_FILTER 0
%define CONFIG_FRAMESTEP_FILTER 0
%define CONFIG_FREI0R_FILTER 0
%define CONFIG_FSPP_FILTER 0
%define CONFIG_GEQ_FILTER 0
%define CONFIG_GRADFUN_FILTER 0
%define CONFIG_HALDCLUT_FILTER 0
%define CONFIG_HFLIP_FILTER 0
%define CONFIG_HISTEQ_FILTER 0
%define CONFIG_HISTOGRAM_FILTER 0
%define CONFIG_HQDN3D_FILTER 0
%define CONFIG_HQX_FILTER 0
%define CONFIG_HUE_FILTER 0
%define CONFIG_IDET_FILTER 0
%define CONFIG_IL_FILTER 0
%define CONFIG_INTERLACE_FILTER 0
%define CONFIG_INTERLEAVE_FILTER 0
%define CONFIG_KERNDEINT_FILTER 0
%define CONFIG_LENSCORRECTION_FILTER 0
%define CONFIG_LUT3D_FILTER 0
%define CONFIG_LUT_FILTER 0
%define CONFIG_LUTRGB_FILTER 0
%define CONFIG_LUTYUV_FILTER 0
%define CONFIG_MCDEINT_FILTER 0
%define CONFIG_MERGEPLANES_FILTER 0
%define CONFIG_MPDECIMATE_FILTER 0
%define CONFIG_NEGATE_FILTER 0
%define CONFIG_NOFORMAT_FILTER 0
%define CONFIG_NOISE_FILTER 0
%define CONFIG_NULL_FILTER 0
%define CONFIG_OCV_FILTER 0
%define CONFIG_OVERLAY_FILTER 0
%define CONFIG_OWDENOISE_FILTER 0
%define CONFIG_PAD_FILTER 0
%define CONFIG_PALETTEGEN_FILTER 0
%define CONFIG_PALETTEUSE_FILTER 0
%define CONFIG_PERMS_FILTER 0
%define CONFIG_PERSPECTIVE_FILTER 0
%define CONFIG_PHASE_FILTER 0
%define CONFIG_PIXDESCTEST_FILTER 0
%define CONFIG_PP_FILTER 0
%define CONFIG_PP7_FILTER 0
%define CONFIG_PSNR_FILTER 0
%define CONFIG_PULLUP_FILTER 0
%define CONFIG_QP_FILTER 0
%define CONFIG_REMOVELOGO_FILTER 0
%define CONFIG_REPEATFIELDS_FILTER 0
%define CONFIG_ROTATE_FILTER 0
%define CONFIG_SAB_FILTER 0
%define CONFIG_SCALE_FILTER 0
%define CONFIG_SELECT_FILTER 0
%define CONFIG_SENDCMD_FILTER 0
%define CONFIG_SEPARATEFIELDS_FILTER 0
%define CONFIG_SETDAR_FILTER 0
%define CONFIG_SETFIELD_FILTER 0
%define CONFIG_SETPTS_FILTER 0
%define CONFIG_SETSAR_FILTER 0
%define CONFIG_SETTB_FILTER 0
%define CONFIG_SHOWINFO_FILTER 0
%define CONFIG_SHOWPALETTE_FILTER 0
%define CONFIG_SHUFFLEPLANES_FILTER 0
%define CONFIG_SIGNALSTATS_FILTER 0
%define CONFIG_SMARTBLUR_FILTER 0
%define CONFIG_SPLIT_FILTER 0
%define CONFIG_SPP_FILTER 0
%define CONFIG_STEREO3D_FILTER 0
%define CONFIG_SUBTITLES_FILTER 0
%define CONFIG_SUPER2XSAI_FILTER 0
%define CONFIG_SWAPUV_FILTER 0
%define CONFIG_TBLEND_FILTER 0
%define CONFIG_TELECINE_FILTER 0
%define CONFIG_THUMBNAIL_FILTER 0
%define CONFIG_TILE_FILTER 0
%define CONFIG_TINTERLACE_FILTER 0
%define CONFIG_TRANSPOSE_FILTER 0
%define CONFIG_TRIM_FILTER 0
%define CONFIG_UNSHARP_FILTER 0
%define CONFIG_USPP_FILTER 0
%define CONFIG_VFLIP_FILTER 0
%define CONFIG_VIDSTABDETECT_FILTER 0
%define CONFIG_VIDSTABTRANSFORM_FILTER 0
%define CONFIG_VIGNETTE_FILTER 0
%define CONFIG_W3FDIF_FILTER 0
%define CONFIG_XBR_FILTER 0
%define CONFIG_YADIF_FILTER 0
%define CONFIG_ZMQ_FILTER 0
%define CONFIG_ZOOMPAN_FILTER 0
%define CONFIG_CELLAUTO_FILTER 0
%define CONFIG_COLOR_FILTER 0
%define CONFIG_FREI0R_SRC_FILTER 0
%define CONFIG_HALDCLUTSRC_FILTER 0
%define CONFIG_LIFE_FILTER 0
%define CONFIG_MANDELBROT_FILTER 0
%define CONFIG_MPTESTSRC_FILTER 0
%define CONFIG_NULLSRC_FILTER 0
%define CONFIG_RGBTESTSRC_FILTER 0
%define CONFIG_SMPTEBARS_FILTER 0
%define CONFIG_SMPTEHDBARS_FILTER 0
%define CONFIG_TESTSRC_FILTER 0
%define CONFIG_NULLSINK_FILTER 0
%define CONFIG_AVECTORSCOPE_FILTER 0
%define CONFIG_CONCAT_FILTER 0
%define CONFIG_SHOWCQT_FILTER 0
%define CONFIG_SHOWSPECTRUM_FILTER 0
%define CONFIG_SHOWWAVES_FILTER 0
%define CONFIG_SHOWWAVESPIC_FILTER 0
%define CONFIG_AMOVIE_FILTER 0
%define CONFIG_MOVIE_FILTER 0
%define CONFIG_H263_VAAPI_HWACCEL 0
%define CONFIG_H263_VDPAU_HWACCEL 0
%define CONFIG_H264_DXVA2_HWACCEL 0
%define CONFIG_H264_QSV_HWACCEL 0
%define CONFIG_H264_VAAPI_HWACCEL 0
%define CONFIG_H264_VDA_HWACCEL 0
%define CONFIG_H264_VDA_OLD_HWACCEL 0
%define CONFIG_H264_VDPAU_HWACCEL 0
%define CONFIG_HEVC_DXVA2_HWACCEL 0
%define CONFIG_MPEG1_XVMC_HWACCEL 0
%define CONFIG_MPEG1_VDPAU_HWACCEL 0
%define CONFIG_MPEG2_XVMC_HWACCEL 0
%define CONFIG_MPEG2_DXVA2_HWACCEL 0
%define CONFIG_MPEG2_VAAPI_HWACCEL 0
%define CONFIG_MPEG2_VDPAU_HWACCEL 0
%define CONFIG_MPEG4_VAAPI_HWACCEL 0
%define CONFIG_MPEG4_VDPAU_HWACCEL 0
%define CONFIG_VC1_DXVA2_HWACCEL 0
%define CONFIG_VC1_VAAPI_HWACCEL 0
%define CONFIG_VC1_VDPAU_HWACCEL 0
%define CONFIG_WMV3_DXVA2_HWACCEL 0
%define CONFIG_WMV3_VAAPI_HWACCEL 0
%define CONFIG_WMV3_VDPAU_HWACCEL 0
%define CONFIG_ALSA_INDEV 0
%define CONFIG_AVFOUNDATION_INDEV 0
%define CONFIG_BKTR_INDEV 0
%define CONFIG_DECKLINK_INDEV 0
%define CONFIG_DSHOW_INDEV 0
%define CONFIG_DV1394_INDEV 0
%define CONFIG_FBDEV_INDEV 0
%define CONFIG_GDIGRAB_INDEV 0
%define CONFIG_IEC61883_INDEV 0
%define CONFIG_JACK_INDEV 0
%define CONFIG_LAVFI_INDEV 0
%define CONFIG_OPENAL_INDEV 0
%define CONFIG_OSS_INDEV 0
%define CONFIG_PULSE_INDEV 0
%define CONFIG_QTKIT_INDEV 0
%define CONFIG_SNDIO_INDEV 0
%define CONFIG_V4L2_INDEV 0
%define CONFIG_VFWCAP_INDEV 0
%define CONFIG_X11GRAB_INDEV 0
%define CONFIG_X11GRAB_XCB_INDEV 0
%define CONFIG_LIBCDIO_INDEV 0
%define CONFIG_LIBDC1394_INDEV 0
%define CONFIG_A64_MUXER 0
%define CONFIG_AC3_MUXER 0
%define CONFIG_ADTS_MUXER 0
%define CONFIG_ADX_MUXER 0
%define CONFIG_AIFF_MUXER 0
%define CONFIG_AMR_MUXER 0
%define CONFIG_ASF_MUXER 0
%define CONFIG_ASS_MUXER 0
%define CONFIG_AST_MUXER 0
%define CONFIG_ASF_STREAM_MUXER 0
%define CONFIG_AU_MUXER 0
%define CONFIG_AVI_MUXER 0
%define CONFIG_AVM2_MUXER 0
%define CONFIG_BIT_MUXER 0
%define CONFIG_CAF_MUXER 0
%define CONFIG_CAVSVIDEO_MUXER 0
%define CONFIG_CRC_MUXER 0
%define CONFIG_DASH_MUXER 0
%define CONFIG_DATA_MUXER 0
%define CONFIG_DAUD_MUXER 0
%define CONFIG_DIRAC_MUXER 0
%define CONFIG_DNXHD_MUXER 0
%define CONFIG_DTS_MUXER 0
%define CONFIG_DV_MUXER 0
%define CONFIG_EAC3_MUXER 0
%define CONFIG_F4V_MUXER 0
%define CONFIG_FFM_MUXER 0
%define CONFIG_FFMETADATA_MUXER 0
%define CONFIG_FILMSTRIP_MUXER 0
%define CONFIG_FLAC_MUXER 0
%define CONFIG_FLV_MUXER 0
%define CONFIG_FRAMECRC_MUXER 0
%define CONFIG_FRAMEMD5_MUXER 0
%define CONFIG_G722_MUXER 0
%define CONFIG_G723_1_MUXER 0
%define CONFIG_GIF_MUXER 0
%define CONFIG_GXF_MUXER 0
%define CONFIG_H261_MUXER 0
%define CONFIG_H263_MUXER 0
%define CONFIG_H264_MUXER 0
%define CONFIG_HDS_MUXER 0
%define CONFIG_HEVC_MUXER 0
%define CONFIG_HLS_MUXER 0
%define CONFIG_ICO_MUXER 0
%define CONFIG_ILBC_MUXER 0
%define CONFIG_IMAGE2_MUXER 0
%define CONFIG_IMAGE2PIPE_MUXER 0
%define CONFIG_IPOD_MUXER 0
%define CONFIG_IRCAM_MUXER 0
%define CONFIG_ISMV_MUXER 0
%define CONFIG_IVF_MUXER 0
%define CONFIG_JACOSUB_MUXER 0
%define CONFIG_LATM_MUXER 0
%define CONFIG_LRC_MUXER 0
%define CONFIG_M4V_MUXER 0
%define CONFIG_MD5_MUXER 0
%define CONFIG_MATROSKA_MUXER 0
%define CONFIG_MATROSKA_AUDIO_MUXER 0
%define CONFIG_MICRODVD_MUXER 0
%define CONFIG_MJPEG_MUXER 0
%define CONFIG_MLP_MUXER 0
%define CONFIG_MMF_MUXER 0
%define CONFIG_MOV_MUXER 0
%define CONFIG_MP2_MUXER 0
%define CONFIG_MP3_MUXER 0
%define CONFIG_MP4_MUXER 0
%define CONFIG_MPEG1SYSTEM_MUXER 0
%define CONFIG_MPEG1VCD_MUXER 0
%define CONFIG_MPEG1VIDEO_MUXER 0
%define CONFIG_MPEG2DVD_MUXER 0
%define CONFIG_MPEG2SVCD_MUXER 0
%define CONFIG_MPEG2VIDEO_MUXER 0
%define CONFIG_MPEG2VOB_MUXER 0
%define CONFIG_MPEGTS_MUXER 0
%define CONFIG_MPJPEG_MUXER 0
%define CONFIG_MXF_MUXER 0
%define CONFIG_MXF_D10_MUXER 0
%define CONFIG_MXF_OPATOM_MUXER 0
%define CONFIG_NULL_MUXER 0
%define CONFIG_NUT_MUXER 0
%define CONFIG_OGA_MUXER 0
%define CONFIG_OGG_MUXER 0
%define CONFIG_OMA_MUXER 0
%define CONFIG_OPUS_MUXER 0
%define CONFIG_PCM_ALAW_MUXER 0
%define CONFIG_PCM_MULAW_MUXER 0
%define CONFIG_PCM_F64BE_MUXER 0
%define CONFIG_PCM_F64LE_MUXER 0
%define CONFIG_PCM_F32BE_MUXER 0
%define CONFIG_PCM_F32LE_MUXER 0
%define CONFIG_PCM_S32BE_MUXER 0
%define CONFIG_PCM_S32LE_MUXER 0
%define CONFIG_PCM_S24BE_MUXER 0
%define CONFIG_PCM_S24LE_MUXER 0
%define CONFIG_PCM_S16BE_MUXER 0
%define CONFIG_PCM_S16LE_MUXER 0
%define CONFIG_PCM_S8_MUXER 0
%define CONFIG_PCM_U32BE_MUXER 0
%define CONFIG_PCM_U32LE_MUXER 0
%define CONFIG_PCM_U24BE_MUXER 0
%define CONFIG_PCM_U24LE_MUXER 0
%define CONFIG_PCM_U16BE_MUXER 0
%define CONFIG_PCM_U16LE_MUXER 0
%define CONFIG_PCM_U8_MUXER 0
%define CONFIG_PSP_MUXER 0
%define CONFIG_RAWVIDEO_MUXER 0
%define CONFIG_RM_MUXER 0
%define CONFIG_ROQ_MUXER 0
%define CONFIG_RSO_MUXER 0
%define CONFIG_RTP_MUXER 0
%define CONFIG_RTP_MPEGTS_MUXER 0
%define CONFIG_RTSP_MUXER 0
%define CONFIG_SAP_MUXER 0
%define CONFIG_SEGMENT_MUXER 0
%define CONFIG_STREAM_SEGMENT_MUXER 0
%define CONFIG_SMJPEG_MUXER 0
%define CONFIG_SMOOTHSTREAMING_MUXER 0
%define CONFIG_SOX_MUXER 0
%define CONFIG_SPX_MUXER 0
%define CONFIG_SPDIF_MUXER 0
%define CONFIG_SRT_MUXER 0
%define CONFIG_SWF_MUXER 0
%define CONFIG_TEE_MUXER 0
%define CONFIG_TG2_MUXER 0
%define CONFIG_TGP_MUXER 0
%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
%define CONFIG_TRUEHD_MUXER 0
%define CONFIG_UNCODEDFRAMECRC_MUXER 0
%define CONFIG_VC1_MUXER 0
%define CONFIG_VC1T_MUXER 0
%define CONFIG_VOC_MUXER 0
%define CONFIG_W64_MUXER 0
%define CONFIG_WAV_MUXER 0
%define CONFIG_WEBM_MUXER 0
%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
%define CONFIG_WEBP_MUXER 0
%define CONFIG_WEBVTT_MUXER 0
%define CONFIG_WTV_MUXER 0
%define CONFIG_WV_MUXER 0
%define CONFIG_YUV4MPEGPIPE_MUXER 0
%define CONFIG_LIBNUT_MUXER 0
%define CONFIG_ALSA_OUTDEV 0
%define CONFIG_CACA_OUTDEV 0
%define CONFIG_DECKLINK_OUTDEV 0
%define CONFIG_FBDEV_OUTDEV 0
%define CONFIG_OPENGL_OUTDEV 0
%define CONFIG_OSS_OUTDEV 0
%define CONFIG_PULSE_OUTDEV 0
%define CONFIG_SDL_OUTDEV 0
%define CONFIG_SNDIO_OUTDEV 0
%define CONFIG_V4L2_OUTDEV 0
%define CONFIG_XV_OUTDEV 0
%define CONFIG_AAC_PARSER 1
%define CONFIG_AAC_LATM_PARSER 0
%define CONFIG_AC3_PARSER 0
%define CONFIG_ADX_PARSER 0
%define CONFIG_BMP_PARSER 0
%define CONFIG_CAVSVIDEO_PARSER 0
%define CONFIG_COOK_PARSER 0
%define CONFIG_DCA_PARSER 0
%define CONFIG_DIRAC_PARSER 0
%define CONFIG_DNXHD_PARSER 0
%define CONFIG_DPX_PARSER 0
%define CONFIG_DVBSUB_PARSER 0
%define CONFIG_DVDSUB_PARSER 0
%define CONFIG_DVD_NAV_PARSER 0
%define CONFIG_FLAC_PARSER 1
%define CONFIG_GSM_PARSER 1
%define CONFIG_H261_PARSER 0
%define CONFIG_H263_PARSER 1
%define CONFIG_H264_PARSER 1
%define CONFIG_HEVC_PARSER 0
%define CONFIG_MJPEG_PARSER 0
%define CONFIG_MLP_PARSER 0
%define CONFIG_MPEG4VIDEO_PARSER 1
%define CONFIG_MPEGAUDIO_PARSER 1
%define CONFIG_MPEGVIDEO_PARSER 0
%define CONFIG_OPUS_PARSER 1
%define CONFIG_PNG_PARSER 0
%define CONFIG_PNM_PARSER 0
%define CONFIG_RV30_PARSER 0
%define CONFIG_RV40_PARSER 0
%define CONFIG_TAK_PARSER 0
%define CONFIG_VC1_PARSER 0
%define CONFIG_VORBIS_PARSER 1
%define CONFIG_VP3_PARSER 1
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 0
%define CONFIG_BLURAY_PROTOCOL 0
%define CONFIG_CACHE_PROTOCOL 0
%define CONFIG_CONCAT_PROTOCOL 0
%define CONFIG_CRYPTO_PROTOCOL 0
%define CONFIG_DATA_PROTOCOL 0
%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
%define CONFIG_FFRTMPHTTP_PROTOCOL 0
%define CONFIG_FILE_PROTOCOL 0
%define CONFIG_FTP_PROTOCOL 0
%define CONFIG_GOPHER_PROTOCOL 0
%define CONFIG_HLS_PROTOCOL 0
%define CONFIG_HTTP_PROTOCOL 0
%define CONFIG_HTTPPROXY_PROTOCOL 0
%define CONFIG_HTTPS_PROTOCOL 0
%define CONFIG_ICECAST_PROTOCOL 0
%define CONFIG_MMSH_PROTOCOL 0
%define CONFIG_MMST_PROTOCOL 0
%define CONFIG_MD5_PROTOCOL 0
%define CONFIG_PIPE_PROTOCOL 0
%define CONFIG_RTMP_PROTOCOL 0
%define CONFIG_RTMPE_PROTOCOL 0
%define CONFIG_RTMPS_PROTOCOL 0
%define CONFIG_RTMPT_PROTOCOL 0
%define CONFIG_RTMPTE_PROTOCOL 0
%define CONFIG_RTMPTS_PROTOCOL 0
%define CONFIG_RTP_PROTOCOL 0
%define CONFIG_SCTP_PROTOCOL 0
%define CONFIG_SRTP_PROTOCOL 0
%define CONFIG_SUBFILE_PROTOCOL 0
%define CONFIG_TCP_PROTOCOL 0
%define CONFIG_TLS_PROTOCOL 0
%define CONFIG_UDP_PROTOCOL 0
%define CONFIG_UDPLITE_PROTOCOL 0
%define CONFIG_UNIX_PROTOCOL 0
%define CONFIG_LIBRTMP_PROTOCOL 0
%define CONFIG_LIBRTMPE_PROTOCOL 0
%define CONFIG_LIBRTMPS_PROTOCOL 0
%define CONFIG_LIBRTMPT_PROTOCOL 0
%define CONFIG_LIBRTMPTE_PROTOCOL 0
%define CONFIG_LIBSSH_PROTOCOL 0
%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
| guorendong/iridium-browser-ubuntu | third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.asm | Assembly | bsd-3-clause | 56,489 |
[bits 32]
dd iConsole.$FILE_END - iConsole.$FILE_START
db "OrcaHLL Class", 0
db "iConsole", 0
iConsole.$FILE_START :
iConsole.$global.window :
dd 0x0
iConsole.$global.win :
dd 0x0
iConsole.$global.command :
dd 0x0
iConsole._init:
pop dword [iConsole._init.returnVal]
push eax
push ebx
push edx
mov ax, 0x0106
int 0x30
mov [iConsole.$global.window], ecx
mov ecx, 80
push ecx
mov ax, 0x0502
int 0x30
mov [iConsole.$global.command], ecx
mov ecx, [iConsole._init.string_0]
push ecx
mov ax, 0x0100
int 0x30
pop edx
pop ebx
pop eax
push dword [iConsole._init.returnVal]
ret
;Vars:
iConsole._init.string_0 :
dd iConsole._init.string_0_data
iConsole._init.string_0_data :
db "Console: ", 0
iConsole._init.returnVal:
dd 0x0
iConsole._loop:
pop dword [iConsole._loop.returnVal]
push eax
push ebx
push edx
mov ecx, [iConsole.$global.window]
push ecx
mov ax, 0x0404
int 0x30
cmp cl, 0xFF
jne iConsole.$loop_if.0_close
mov ecx, [iConsole.$global.window]
push ecx
mov ax, 0x0405
int 0x30
mov [iConsole.$loop_if.0.$local.ch], cl
push edx
xor ecx, ecx
mov cl, [iConsole.$loop_if.0.$local.ch]
mov edx, ecx
xor ecx, ecx
mov cl, [Key.$global.ENTER]
cmp edx, ecx
pop edx
jne iConsole.$comp_14.true
mov cl, 0x0
jmp iConsole.$comp_14.done
iConsole.$comp_14.true :
mov cl, 0xFF
iConsole.$comp_14.done :
cmp cl, 0xFF
jne iConsole.$loop_if.1_close
push edx
xor ecx, ecx
mov cl, [iConsole.$loop_if.0.$local.ch]
mov edx, ecx
xor ecx, ecx
mov cl, [Key.$global.KEY_SHIFT]
cmp edx, ecx
pop edx
jne iConsole.$comp_15.true
mov cl, 0x0
jmp iConsole.$comp_15.done
iConsole.$comp_15.true :
mov cl, 0xFF
iConsole.$comp_15.done :
cmp cl, 0xFF
jne iConsole.$loop_if.2_close
push ebx
mov ebx, iConsole.$global.command
xor ecx, ecx
mov cl, [iConsole.$loop_if.0.$local.ch]
push ecx
call String.AppendChar
pop ebx
xor ecx, ecx
mov cl, [iConsole.$loop_if.0.$local.ch]
push ecx
mov ax, 0x0105
int 0x30
iConsole.$loop_if.2_close :
iConsole.$loop_if.1_close :
push edx
xor ecx, ecx
mov cl, [iConsole.$loop_if.0.$local.ch]
mov edx, ecx
xor ecx, ecx
mov cl, [Key.$global.ENTER]
cmp edx, ecx
pop edx
je iConsole.$comp_19.true
mov cl, 0x0
jmp iConsole.$comp_19.done
iConsole.$comp_19.true :
mov cl, 0xFF
iConsole.$comp_19.done :
cmp cl, 0xFF
jne iConsole.$loop_if.3_close
mov ax, 0x0103
int 0x30
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.4.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.4_close
mov ecx, [iConsole.$loop_if.4.string_1]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_2]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_3]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_4]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_5]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_6]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_7]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_8]
push ecx
mov ax, 0x0101
int 0x30
mov ecx, [iConsole.$loop_if.4.string_9]
push ecx
mov ax, 0x0101
int 0x30
iConsole.$loop_if.4_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.5.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.5_close
mov ax, 0x0104
int 0x30
iConsole.$loop_if.5_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.6.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.6_close
mov ecx, [iConsole.$global.window]
push ecx
mov ax, 0x0201
int 0x30
iConsole.$loop_if.6_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.7.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.7_close
mov ecx, 0
push edx ; Begin getting subvar
mov edx, [iConsole.$global.window]
add dl, Window.xPos
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, 8
push edx ; Begin getting subvar
mov edx, [iConsole.$global.window]
add dl, Window.yPos
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, 0x1 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
push edx ; Begin getting subvar
mov edx, [iConsole.$global.window]
add dl, Window.width
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, 0x2 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
push edx ; Begin getting subvar
mov edx, [iConsole.$global.window]
add dl, Window.height
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
iConsole.$loop_if.7_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.8.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.8_close
call Manager.lock ; INLINE ASSEMBLY
iConsole.$loop_if.8_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.9.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.9_close
mov ecx, [iConsole.$loop_if.9.string_1]
push ecx
mov ax, 0x0100
int 0x30
mov ecx, 0x5 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.9.string_2]
push ecx
mov ax, 0x0100
int 0x30
mov ecx, 0x4 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ax, 0x0103
int 0x30
iConsole.$loop_if.9_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.10.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.10_close
mov ecx, [iConsole.$loop_if.10.string_1]
push ecx
mov ax, 0x0101
int 0x30
iConsole.$loop_if.10_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.11.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.11_close
mov ecx, 0x0B
push ecx
mov ax, 0x0108
int 0x30
mov ax, 0x0703
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.11.string_1]
push ecx
mov ax, 0x0100
int 0x30
mov ax, 0x0702
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.11.string_2]
push ecx
mov ax, 0x0100
int 0x30
mov ax, 0x0701
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.11.string_3]
push ecx
mov ax, 0x0100
int 0x30
mov ax, 0x0705
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.11.string_4]
push ecx
mov ax, 0x0100
int 0x30
mov ax, 0x0706
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ecx, [iConsole.$loop_if.11.string_5]
push ecx
mov ax, 0x0100
int 0x30
mov ax, 0x0704
int 0x30
push ecx
mov ax, 0x0102
int 0x30
mov ax, 0x0103
int 0x30
iConsole.$loop_if.11_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.12.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.12_close
call Minnow.ctree ; INLINE ASSEMBLY
iConsole.$loop_if.12_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.13.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.13_close
mov eax, SysHaltScreen.RESET ; INLINE ASSEMBLY
mov ecx, [iConsole.$loop_if.13.string_1]
mov ebx, ecx ; INLINE ASSEMBLY
mov ecx, 5 ; INLINE ASSEMBLY
call SysHaltScreen.show ; INLINE ASSEMBLY
iConsole.$loop_if.13_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.14.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.14_close
call Library._init ; INLINE ASSEMBLY
iConsole.$loop_if.14_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.15.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.15_close
call VideoInfo._init ; INLINE ASSEMBLY
iConsole.$loop_if.15_close :
push ebx
mov ebx, iConsole.$global.command
mov ecx, [iConsole.$loop_if.16.string_0]
push ecx
call String.Equals
pop ebx
cmp cl, 0xFF
jne iConsole.$loop_if.16_close
call TestProgram._init ; INLINE ASSEMBLY
iConsole.$loop_if.16_close :
mov ecx, [iConsole.$loop_if.3.string_0]
push ecx
mov ax, 0x0100
int 0x30
push ebx
mov ebx, iConsole.$global.command
mov ecx, 0
push ecx
xor ecx, ecx
mov cl, [Char.$global.NUL]
push ecx
call String.SetChar
pop ebx
iConsole.$loop_if.3_close :
iConsole.$loop_if.0_close :
pop edx
pop ebx
pop eax
push dword [iConsole._loop.returnVal]
ret
;Vars:
iConsole.$loop_if.7.string_0_data :
db "fullscreen", 0
iConsole.$loop_if.4.string_2 :
dd iConsole.$loop_if.4.string_2_data
iConsole.$loop_if.13.string_1_data :
db "Restarting the computer.", 0
iConsole.$loop_if.11.string_3_data :
db " ", 0
iConsole.$loop_if.15.string_0 :
dd iConsole.$loop_if.15.string_0_data
iConsole.$loop_if.4.string_9 :
dd iConsole.$loop_if.4.string_9_data
iConsole.$loop_if.4.string_3 :
dd iConsole.$loop_if.4.string_3_data
iConsole.$loop_if.13.string_1 :
dd iConsole.$loop_if.13.string_1_data
iConsole.$loop_if.4.string_5_data :
db "lock: Locks the computer.", 0
iConsole.$loop_if.4.string_6_data :
db "memstat: Prints out the percentage of RAM in use.", 0
iConsole.$loop_if.13.string_0 :
dd iConsole.$loop_if.13.string_0_data
iConsole.$loop_if.4.string_8 :
dd iConsole.$loop_if.4.string_8_data
iConsole.$loop_if.4.string_1_data :
db "clear: Clears the screen.", 0
iConsole.$loop_if.15.string_0_data :
db "OHLL videoinfo", 0
iConsole.$loop_if.11.string_0 :
dd iConsole.$loop_if.11.string_0_data
iConsole.$loop_if.12.string_0_data :
db "tree", 0
iConsole.$loop_if.10.string_1 :
dd iConsole.$loop_if.10.string_1_data
iConsole.$loop_if.11.string_2_data :
db ":", 0
iConsole.$loop_if.7.string_0 :
dd iConsole.$loop_if.7.string_0_data
iConsole.$loop_if.9.string_2 :
dd iConsole.$loop_if.9.string_2_data
iConsole.$loop_if.3.string_0_data :
db "Console: ", 0
iConsole.$loop_if.9.string_1 :
dd iConsole.$loop_if.9.string_1_data
iConsole.$loop_if.6.string_0_data :
db "exit", 0
iConsole.$loop_if.16.string_0_data :
db "OHLL test", 0
iConsole.$loop_if.10.string_0_data :
db "test", 0
iConsole.$loop_if.13.string_0_data :
db "restart", 0
iConsole.$loop_if.4.string_0 :
dd iConsole.$loop_if.4.string_0_data
iConsole.$loop_if.11.string_5_data :
db "-", 0
iConsole.$loop_if.9.string_0_data :
db "memstat", 0
iConsole.$loop_if.11.string_3 :
dd iConsole.$loop_if.11.string_3_data
iConsole.$loop_if.4.string_2_data :
db "exit: Exits the console.", 0
iConsole.$loop_if.4.string_9_data :
db "tree: Displays all mounted files.", 0
iConsole.$loop_if.4.string_1 :
dd iConsole.$loop_if.4.string_1_data
iConsole.$loop_if.4.string_3_data :
db "fullscreen: Toggles fullscreen mode.", 0
iConsole.$loop_if.4.string_8_data :
db "time: Prints out the current time.", 0
iConsole.$loop_if.11.string_4 :
dd iConsole.$loop_if.11.string_4_data
iConsole.$loop_if.14.string_0 :
dd iConsole.$loop_if.14.string_0_data
iConsole.$loop_if.16.string_0 :
dd iConsole.$loop_if.16.string_0_data
iConsole.$loop_if.9.string_1_data :
db "Usage: ", 0
iConsole.$loop_if.3.string_0 :
dd iConsole.$loop_if.3.string_0_data
iConsole.$loop_if.4.string_6 :
dd iConsole.$loop_if.4.string_6_data
iConsole.$loop_if.6.string_0 :
dd iConsole.$loop_if.6.string_0_data
iConsole.$loop_if.9.string_0 :
dd iConsole.$loop_if.9.string_0_data
iConsole.$loop_if.10.string_0 :
dd iConsole.$loop_if.10.string_0_data
iConsole.$loop_if.11.string_1_data :
db ":", 0
iConsole.$loop_if.12.string_0 :
dd iConsole.$loop_if.12.string_0_data
iConsole.$loop_if.8.string_0_data :
db "lock", 0
iConsole.$loop_if.11.string_2 :
dd iConsole.$loop_if.11.string_2_data
iConsole.$loop_if.8.string_0 :
dd iConsole.$loop_if.8.string_0_data
iConsole.$loop_if.5.string_0_data :
db "clear", 0
iConsole.$loop_if.11.string_5 :
dd iConsole.$loop_if.11.string_5_data
iConsole.$loop_if.5.string_0 :
dd iConsole.$loop_if.5.string_0_data
iConsole.$loop_if.0.$local.ch :
db 0x0
iConsole.$loop_if.4.string_4_data :
db "help: Displays this prompt.", 0
iConsole.$loop_if.4.string_7_data :
db "restart: Restarts the computer.", 0
iConsole.$loop_if.11.string_1 :
dd iConsole.$loop_if.11.string_1_data
iConsole.$loop_if.4.string_4 :
dd iConsole.$loop_if.4.string_4_data
iConsole.$loop_if.11.string_4_data :
db "-", 0
iConsole.$loop_if.9.string_2_data :
db " / ", 0
iConsole.$loop_if.10.string_1_data :
db "No test function is implemented at this time.", 0
iConsole.$loop_if.11.string_0_data :
db "time", 0
iConsole.$loop_if.4.string_0_data :
db "help", 0
iConsole.$loop_if.4.string_7 :
dd iConsole.$loop_if.4.string_7_data
iConsole.$loop_if.14.string_0_data :
db "OHLL lib", 0
iConsole.$loop_if.4.string_5 :
dd iConsole.$loop_if.4.string_5_data
iConsole._loop.returnVal:
dd 0x0
iConsole.$FILE_END :
; *** LIB IMPORT 'Window' ***
[bits 32]
dd Window.$FILE_END - Window.$FILE_START
db "OrcaHLL Class", 0
db "Window", 0
Window.$FILE_START :
Window.winNum equ 38
Window.yPos equ 16
Window.windowBuffer equ 22
Window.xPos equ 12
Window.title equ 0
Window.type equ 20
Window.depth equ 21
Window.lastYpos equ 18
Window.lastXpos equ 14
Window.width equ 4
Window.lastWidth equ 6
Window.buffer equ 26
Window.lastHeight equ 10
Window.oldBuffer equ 34
Window.height equ 8
Window.bufferSize equ 30
Window.$global.TYPE_IMAGE :
db 0x0
Window.$global.TYPE_TEXT :
db 0x0
Window.Create:
pop dword [Window.Create.returnVal]
pop ecx
mov [Window.Create.$local.type], cl
pop ecx
mov [Window.Create.$local.title], ecx
push eax
push ebx
push edx
mov ecx, 39
push ecx
mov ax, 0x0502
int 0x30
mov [Window.Create.$local.ret], ecx
mov ecx, [Window.Create.$local.title]
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.title
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
xor ecx, ecx
mov cl, [Window.Create.$local.type]
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.type
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, 40
mov [Window.Create.$local.wk], cx
xor ecx, ecx
mov cx, [Window.Create.$local.wk]
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.width
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
xor ecx, ecx
mov cx, [Window.Create.$local.wk]
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.height
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, 0x1 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
mov [Window.Create.$local.size], ecx
push edx ; Math start
mov ecx, 0x2 ; System Constant
push ecx
mov ax, 0x0001
int 0x30
mov edx, ecx
mov ecx, [Window.Create.$local.size]
imul ecx, edx
pop edx ; Math end
mov [Window.Create.$local.size], ecx
mov ecx, [Window.Create.$local.size]
push ecx
mov ax, 0x0501
int 0x30
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.windowBuffer
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, [Window.Create.$local.size]
push ecx
mov ax, 0x0502
int 0x30
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.buffer
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, [Window.Create.$local.size]
push ecx
mov ax, 0x0502
int 0x30
push edx ; Begin getting subvar
mov edx, [Window.Create.$local.ret]
add dl, Window.oldBuffer
mov eax, edx
mov edx, [edx]
pop edx ; End getting subvar
mov [eax], ecx
mov ecx, [Window.Create.$local.ret]
pop edx
pop ebx
pop eax
push dword [Window.Create.returnVal]
ret
;Vars:
Window.Create.$local.ret :
dd 0x0
Window.Create.$local.wk :
dw 0x0
Window.Create.$local.size :
dd 0x0
Window.Create.$local.title :
dd 0x0
Window.Create.$local.type :
db 0x0
Window.Create.returnVal:
dd 0x0
Window.$FILE_END :
; *** LIB IMPORT 'String' ***
[bits 32]
dd String.$FILE_END - String.$FILE_START
db "OrcaHLL Class", 0
db "String", 0
String.$FILE_START :
String.Append:
pop dword [String.Append.returnVal]
pop ecx
mov [String.Append.$local.s], ecx
push eax
push ebx
push edx
mov ecx, 0
mov [String.Append.$local.q], ecx
push ebx
mov ebx, ebx
mov ecx, [String.Append.$local.q]
push ecx
call String.GetChar
pop ebx
mov [String.Append.$local.ch], cl
String.$loop_while.0_open :
push edx
xor ecx, ecx
mov cl, [String.Append.$local.ch]
mov edx, ecx
mov ecx, 0
cmp edx, ecx
pop edx
jne String.$comp_4.true
mov cl, 0x0
jmp String.$comp_4.done
String.$comp_4.true :
mov cl, 0xFF
String.$comp_4.done :
cmp cl, 0xFF
jne String.$loop_while.0_end
mov ecx, [ebx]
add ecx, [String.Append.$local.q] ; INLINE ASSEMBLY
sub ecx, 1 ; INLINE ASSEMBLY
mov dl, [String.Append.$local.ch] ; INLINE ASSEMBLY
mov [ecx], dl ; INLINE ASSEMBLY
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.Append.$local.q]
add ecx, edx
pop edx ; Math end
mov [String.Append.$local.q], ecx
push ebx
mov ebx, ebx
mov ecx, [String.Append.$local.q]
push ecx
call String.GetChar
pop ebx
mov [String.Append.$local.ch], cl
jmp String.$loop_while.0_open
String.$loop_while.0_end :
mov ecx, [ebx]
mov ecx, [String.Append.$local.q] ; INLINE ASSEMBLY
sub ecx, 1 ; INLINE ASSEMBLY
mov byte [ecx], 0x0 ; INLINE ASSEMBLY
pop edx
pop ebx
pop eax
push dword [String.Append.returnVal]
ret
;Vars:
String.Append.$local.q :
dd 0x0
String.Append.$local.s :
dd 0x0
String.Append.$local.ch :
db 0x0
String.Append.returnVal:
dd 0x0
String.GetChar:
pop dword [String.GetChar.returnVal]
pop ecx
mov [String.GetChar.$local.pos], ecx
push eax
push ebx
push edx
mov ecx, [ebx]
add ecx, [String.GetChar.$local.pos] ; INLINE ASSEMBLY
mov cl, [ecx] ; INLINE ASSEMBLY
and ecx, 0xFF ; INLINE ASSEMBLY
pop edx
pop ebx
pop eax
push dword [String.GetChar.returnVal]
ret
;Vars:
String.GetChar.$local.pos :
dd 0x0
String.GetChar.returnVal:
dd 0x0
String.SetChar:
pop dword [String.SetChar.returnVal]
pop ecx
mov [String.SetChar.$local.ch], cl
pop ecx
mov [String.SetChar.$local.pos], ecx
push eax
push ebx
push edx
mov ecx, [ebx]
add ecx, [String.SetChar.$local.pos] ; INLINE ASSEMBLY
mov al, [String.SetChar.$local.ch] ; INLINE ASSEMBLY
mov byte [ecx], al ; INLINE ASSEMBLY
pop edx
pop ebx
pop eax
push dword [String.SetChar.returnVal]
ret
;Vars:
String.SetChar.$local.pos :
dd 0x0
String.SetChar.$local.ch :
db 0x0
String.SetChar.returnVal:
dd 0x0
String.AppendChar:
pop dword [String.AppendChar.returnVal]
pop ecx
mov [String.AppendChar.$local.ch], cl
push eax
push ebx
push edx
push ebx
mov ebx, ebx
call String.GetLength
pop ebx
mov [String.AppendChar.$local.length], ecx
mov ecx, 0
mov [String.AppendChar.$local.blank], cl
push ebx
mov ebx, ebx
mov ecx, [String.AppendChar.$local.length]
push ecx
xor ecx, ecx
mov cl, [String.AppendChar.$local.ch]
push ecx
call String.SetChar
pop ebx
push ebx
mov ebx, ebx
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.AppendChar.$local.length]
add ecx, edx
pop edx ; Math end
push ecx
xor ecx, ecx
mov cl, [String.AppendChar.$local.blank]
push ecx
call String.SetChar
pop ebx
pop edx
pop ebx
pop eax
push dword [String.AppendChar.returnVal]
ret
;Vars:
String.AppendChar.$local.blank :
db 0x0
String.AppendChar.$local.ch :
db 0x0
String.AppendChar.$local.length :
dd 0x0
String.AppendChar.returnVal:
dd 0x0
String.RawToWhite:
pop dword [String.RawToWhite.returnVal]
push eax
push ebx
push edx
push ebx
mov ebx, ebx
call String.GetLength
pop ebx
push ecx
mov ax, 0x0501
int 0x30
mov [String.RawToWhite.$local.ret], ecx
push ebx
mov ebx, ebx
call String.GetLength
pop ebx
mov [String.RawToWhite.$local.length], ecx
mov ecx, 0xFF
mov [String.RawToWhite.$local.white], cl
mov ecx, 0
mov [String.$loop_for.0.$local.z], ecx
String.$loop_for.0_open :
push edx ; Math start
mov ecx, 2
mov edx, ecx
mov ecx, [String.$loop_for.0.$local.z]
imul ecx, edx
pop edx ; Math end
mov [String.$loop_for.0.$local.offs], ecx
; k. ; INLINE ASSEMBLY
push ebx
mov ebx, ebx
mov ecx, [String.$loop_for.0.$local.z]
push ecx
call String.GetChar
pop ebx
mov [String.$loop_for.0.$local.ch], cl
push ebx
mov ebx, String.RawToWhite.$local.ret
mov ecx, [String.$loop_for.0.$local.offs]
push ecx
xor ecx, ecx
mov cl, [String.$loop_for.0.$local.ch]
push ecx
call String.SetChar
pop ebx
push ebx
mov ebx, String.RawToWhite.$local.ret
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.$loop_for.0.$local.offs]
add ecx, edx
pop edx ; Math end
push ecx
xor ecx, ecx
mov cl, [String.RawToWhite.$local.white]
push ecx
call String.SetChar
pop ebx
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.$loop_for.0.$local.z]
add ecx, edx
pop edx ; Math end
mov [String.$loop_for.0.$local.z], ecx
push edx
mov ecx, [String.$loop_for.0.$local.z]
mov edx, ecx
mov ecx, [String.RawToWhite.$local.length]
cmp edx, ecx
pop edx
jl String.$comp_45.true
mov cl, 0x0
jmp String.$comp_45.done
String.$comp_45.true :
mov cl, 0xFF
String.$comp_45.done :
cmp cl, 0xFF
je String.$loop_for.0_open
mov ecx, [String.RawToWhite.$local.ret]
pop edx
pop ebx
pop eax
push dword [String.RawToWhite.returnVal]
ret
;Vars:
String.RawToWhite.$local.ret :
dd 0x0
String.RawToWhite.$local.white :
db 0x0
String.RawToWhite.$local.length :
dd 0x0
String.$loop_for.0.$local.offs :
dd 0x0
String.$loop_for.0.$local.ch :
db 0x0
String.$loop_for.0.$local.z :
dd 0x0
String.RawToWhite.returnVal:
dd 0x0
String.GetLength:
pop dword [String.GetLength.returnVal]
push eax
push ebx
push edx
mov ecx, 0
mov [String.GetLength.$local.ret], ecx
push ebx
mov ebx, ebx
mov ecx, [String.GetLength.$local.ret]
push ecx
call String.GetChar
pop ebx
mov [String.GetLength.$local.ch], cl
String.$loop_while.1_open :
push edx
xor ecx, ecx
mov cl, [String.GetLength.$local.ch]
mov edx, ecx
mov ecx, 0
cmp edx, ecx
pop edx
jne String.$comp_50.true
mov cl, 0x0
jmp String.$comp_50.done
String.$comp_50.true :
mov cl, 0xFF
String.$comp_50.done :
cmp cl, 0xFF
jne String.$loop_while.1_end
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.GetLength.$local.ret]
add ecx, edx
pop edx ; Math end
mov [String.GetLength.$local.ret], ecx
push ebx
mov ebx, ebx
mov ecx, [String.GetLength.$local.ret]
push ecx
call String.GetChar
pop ebx
mov [String.GetLength.$local.ch], cl
jmp String.$loop_while.1_open
String.$loop_while.1_end :
mov ecx, [String.GetLength.$local.ret]
pop edx
pop ebx
pop eax
push dword [String.GetLength.returnVal]
ret
;Vars:
String.GetLength.$local.ret :
dd 0x0
String.GetLength.$local.ch :
db 0x0
String.GetLength.returnVal:
dd 0x0
String.Equals:
pop dword [String.Equals.returnVal]
pop ecx
mov [String.Equals.$local.str], ecx
push eax
push ebx
push edx
push ebx
mov ebx, ebx
call String.GetLength
pop ebx
mov [String.Equals.$local.finish], ecx
push edx
mov ecx, [String.Equals.$local.finish]
mov edx, ecx
push ebx
mov ebx, String.Equals.$local.str
call String.GetLength
pop ebx
cmp edx, ecx
pop edx
jne String.$comp_57.true
mov cl, 0x0
jmp String.$comp_57.done
String.$comp_57.true :
mov cl, 0xFF
String.$comp_57.done :
cmp cl, 0xFF
jne String.$loop_if.0_close
mov ecx, 0x00
pop edx
pop ebx
pop eax
push dword [String.Equals.returnVal]
ret
String.$loop_if.0_close :
mov ecx, 0
mov [String.$loop_for.1.$local.pos], ecx
String.$loop_for.1_open :
push edx
push ebx
mov ebx, ebx
mov ecx, [String.$loop_for.1.$local.pos]
push ecx
call String.GetChar
pop ebx
mov edx, ecx
push ebx
mov ebx, String.Equals.$local.str
mov ecx, [String.$loop_for.1.$local.pos]
push ecx
call String.GetChar
pop ebx
cmp edx, ecx
pop edx
jne String.$comp_60.true
mov cl, 0x0
jmp String.$comp_60.done
String.$comp_60.true :
mov cl, 0xFF
String.$comp_60.done :
cmp cl, 0xFF
jne String.$loop_if.1_close
mov ecx, 0x00
pop edx
pop ebx
pop eax
push dword [String.Equals.returnVal]
ret
String.$loop_if.1_close :
push edx ; Math start
mov ecx, 1
mov edx, ecx
mov ecx, [String.$loop_for.1.$local.pos]
add ecx, edx
pop edx ; Math end
mov [String.$loop_for.1.$local.pos], ecx
push edx
mov ecx, [String.$loop_for.1.$local.pos]
mov edx, ecx
mov ecx, [String.Equals.$local.finish]
cmp edx, ecx
pop edx
jl String.$comp_62.true
mov cl, 0x0
jmp String.$comp_62.done
String.$comp_62.true :
mov cl, 0xFF
String.$comp_62.done :
cmp cl, 0xFF
je String.$loop_for.1_open
mov ecx, 0xFF
pop edx
pop ebx
pop eax
push dword [String.Equals.returnVal]
ret
;Vars:
String.Equals.$local.str :
dd 0x0
String.Equals.$local.finish :
dd 0x0
String.$loop_for.1.$local.pos :
dd 0x0
String.Equals.returnVal:
dd 0x0
String.$FILE_END :
; *** LIB IMPORT 'KeyCodes' ***
[bits 32]
dd Key.$FILE_END - Key.$FILE_START
db "OrcaHLL Class", 0
db "Key", 0
Key.$FILE_START :
Key.$global.KEY_DOWN :
db 0x50
Key.$global.KEY_LEFT :
db 0x4B
Key.$global.TAB :
db 0x3A
Key.$global.ESC :
db 0x01
Key.$global.KEY_RIGHT :
db 0x4D
Key.$global.ENTER :
db 0xFE
Key.$global.KEY_UP :
db 0x48
Key.$global.KEY_SHIFT :
db 0x2A
Key.$global.BACKSPACE :
db 0xFF
Key.$FILE_END :
; *** LIB IMPORT 'CharCodes' ***
[bits 32]
dd Char.$FILE_END - Char.$FILE_START
db "OrcaHLL Class", 0
db "Char", 0
Char.$FILE_START :
Char.$global.NUL :
db 0x00
Char.$global.NEWLINE :
db 0x0A
Char.$FILE_END :
| jaredwhitney/OrcaHLL | aots/iconsole/iConsole.asm | Assembly | mit | 24,787 |
lorom
; -------------------------------------------------------------------
; Part 1: save when the player said YES
; hijack point: replace JSR $81F3 inside the main message box code.
; It turns out this bug happens because the code specially handles the ship's
; message and DOES NOT RETURN (for the ship to do the actual save) until "Save
; Completed" has been dismissed. So, we fix the special case...
org $8580D3
JSR do_ship_save
; put this anywhere in free space in bank $85 (>= 9643)
; it's 21 ($15) bytes long
; I don't know how much stack there REALLY is at this second,
; nor how much $81:8000 uses, but there are at least 8 bytes free.
org $85FFD0
do_ship_save:
; copied from the ship-save code in bank $A2...
LDA $7ED8F8 ; load "used saves" for the region
ORA #$0001 ; set this save used*
STA $7ED8F8 ; store back to RAM
STZ $078B ; set which save station to load from
JSL $818000 ; write to SRAM
JMP $81F3 ; JMP to the address we interrupted
; their RTS will resume from the hijack point above
; -------------------------------------------------------------------
; Part 2: do not bother saving after "SAVE COMPLETED" message
; this is where the result of the prompt is compared
org $A2AB26
JMP $AB40 ; pretend save was canceled, skip already-done save logic
| n00btube/sm-save-refills | bugfix-ship-save.xkas-06.asm | Assembly | mit | 1,295 |
section .data
mesg db "hello,", " world!",10
; this is a comment
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, mesg
mov rdx, 14
syscall
mov rax, 60
mov rdi, 0
syscall
| dlutxx/memo | asm/hello.asm | Assembly | mit | 201 |
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
cospi_1_64 EQU 16364
cospi_2_64 EQU 16305
cospi_3_64 EQU 16207
cospi_4_64 EQU 16069
cospi_5_64 EQU 15893
cospi_6_64 EQU 15679
cospi_7_64 EQU 15426
cospi_8_64 EQU 15137
cospi_9_64 EQU 14811
cospi_10_64 EQU 14449
cospi_11_64 EQU 14053
cospi_12_64 EQU 13623
cospi_13_64 EQU 13160
cospi_14_64 EQU 12665
cospi_15_64 EQU 12140
cospi_16_64 EQU 11585
cospi_17_64 EQU 11003
cospi_18_64 EQU 10394
cospi_19_64 EQU 9760
cospi_20_64 EQU 9102
cospi_21_64 EQU 8423
cospi_22_64 EQU 7723
cospi_23_64 EQU 7005
cospi_24_64 EQU 6270
cospi_25_64 EQU 5520
cospi_26_64 EQU 4756
cospi_27_64 EQU 3981
cospi_28_64 EQU 3196
cospi_29_64 EQU 2404
cospi_30_64 EQU 1606
cospi_31_64 EQU 804
EXPORT |vp9_iadst16x16_256_add_neon_single_pass|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
AREA Block, CODE, READONLY
;---------------------------------------------------------------------------
; Transpose a 8x8 16bit data matrix. Datas are loaded in q8-q15.
MACRO
TRANSPOSE8X8_Q8_TO_Q15
vswp d17, d24
vswp d23, d30
vswp d21, d28
vswp d19, d26
vtrn.32 q8, q10
vtrn.32 q9, q11
vtrn.32 q12, q14
vtrn.32 q13, q15
vtrn.16 q8, q9
vtrn.16 q10, q11
vtrn.16 q12, q13
vtrn.16 q14, q15
MEND
;---------------------------------------------------------------------------
; Transpose a 8x8 16bit data matrix. Datas are loaded in q0-q7.
MACRO
TRANSPOSE8X8_Q0_TO_Q7
vswp d1, d8
vswp d7, d14
vswp d5, d12
vswp d3, d10
vtrn.32 q0, q2
vtrn.32 q1, q3
vtrn.32 q4, q6
vtrn.32 q5, q7
vtrn.16 q0, q1
vtrn.16 q2, q3
vtrn.16 q4, q5
vtrn.16 q6, q7
MEND
; --------------------------------------------------------------------------
; $diff cannot be same as $ip1 or $ip2
MACRO
DO_BUTTERFLY_NO_COEFFS $ip1, $ip2, $sum, $diff
vsub.s16 $diff, $ip1, $ip2
vadd.s16 $sum, $ip1, $ip2
MEND
; --------------------------------------------------------------------------
; Touches q12, q15 and the input registers
; valid output registers are anything but q12, q15, $ip1, $ip2
; temp1 and temp2 are Q registers used as temporary registers
; temp1 cannot be same as output registers, q12, q15
; temp2 cannot be same as input registers, q12, q15
MACRO
DO_BUTTERFLY_SYM_COEFFS $ip1, $ip2, $ip3, $ip4, $constant, $op1, $op2, $op3, $op4, $temp1, $temp2
; generate scalar constants
mov r8, #$constant & 0xFF00
add r8, #$constant & 0x00FF
vdup.16 $op4, r8
vmull.s16 q12, $ip1, $op4
vmull.s16 q15, $ip3, $op4
vadd.s32 $temp2, q12, q15
vsub.s32 q12, q12, q15
vqrshrn.s32 $op1, $temp2, #14
vqrshrn.s32 $op3, q12, #14
vdup.16 $op4, r8
vmull.s16 q12, $ip2, $op4
vmull.s16 q15, $ip4, $op4
vadd.s32 $temp1, q12, q15
vsub.s32 q12, q12, q15
vqrshrn.s32 $op2, $temp1, #14
vqrshrn.s32 $op4, q12, #14
MEND
; --------------------------------------------------------------------------
; BUTTERFLY for DST
; Touches q12, q14
; valid output registers are anything but q12 ,q14, $ip1, $ip2, $ip3, $ip4
MACRO
DO_BUTTERFLY_DST $ip1, $ip2, $ip3, $ip4, $first_constant, $second_constant, $op1, $op2, $op3, $op4
; generate the constants
mov r8, #$first_constant & 0xFF00
mov r12, #$second_constant & 0xFF00
add r8, #$first_constant & 0x00FF
add r12, #$second_constant & 0x00FF
; generate vector constants
vdup.16 d28, r8
vdup.16 d29, r12
; do some multiplications (ordered for maximum latency hiding)
vmull.s16 $op1, $ip1, d28
vmull.s16 $op3, $ip3, d29
vmull.s16 $op2, $ip2, d28
vmull.s16 $op4, $ip4, d29
vmull.s16 q12, $ip1, d29
vsub.s32 $op1, $op1, $op3
vsub.s32 $op2, $op2, $op4
; do more multiplications (ordered for maximum latency hiding)
vmull.s16 $op3, $ip3, d28
vmull.s16 $op4, $ip2, d29
vmull.s16 q14, $ip4, d28
; do more addition/subtractions
vadd.s32 $op3, $op3, q12
vadd.s32 $op4, $op4, q14
MEND
; --------------------------------------------------------------------------
; BUTTERFLY and ROUND SHIFT for DST
; Touches q12, q14
; valid output registers are anything but q12 ,q14, $ip1 or $ip2
; modifies values of $ip1 and $ip2
MACRO
DO_DUAL_BUTTERFLY_NO_COEFFS $ip1, $ip2, $ip3, $ip4, $op1, $op2, $op3, $op4
vadd.s32 q12, $ip1, $ip3
vadd.s32 q14, $ip2, $ip4
vsub.s32 $ip1, $ip1, $ip3
vsub.s32 $ip2, $ip2, $ip4
vqrshrn.s32 $op1, q12, #14
vqrshrn.s32 $op2, q14, #14
vqrshrn.s32 $op3, $ip1, #14
vqrshrn.s32 $op4, $ip2, #14
MEND
;---------------------------------------------------------------------------
; Performs ADST for a 8x16 buffer
; This function should be called twice for full 16x16 transform
;
; vp9_iadst16x16_256_add_neon_single_pass(const int16_t *src,
; int16_t *temp_buffer,
; int do_adding,
; void *dest,
; int dest_stride);
;
; r0 = const int16_t *src
; r1 = int16_t *temp_buffer
; r2 = int do_adding (Boolean flag '0' or '1')
; r3 = void *dest
; r5 = int dest_stride
;
; The output pointer *dest points to
; int16_t* when processed for row transform
; uint8_t* when processed for column transform
|vp9_iadst16x16_256_add_neon_single_pass| PROC
push {r4-r12, lr} ; push registers to stack
; load 8 rows 16 cols
mov r11, r0
vld1.64 q0, [r11]!
vld1.64 q8, [r11]!
vld1.64 q1, [r11]!
vld1.64 q9, [r11]!
vld1.64 q2, [r11]!
vld1.64 q10, [r11]!
vld1.64 q3, [r11]!
vld1.64 q11, [r11]!
vld1.64 q4, [r11]!
vld1.64 q12, [r11]!
vld1.64 q5, [r11]!
vld1.64 q13, [r11]!
vld1.64 q6, [r11]!
vld1.64 q14, [r11]!
vld1.64 q7, [r11]!
vld1.64 q15, [r11]!
TRANSPOSE8X8_Q0_TO_Q7
TRANSPOSE8X8_Q8_TO_Q15
; store x4,x5,x6,x7,x12,x13,x14 and x15 to intermediate buffer
mov r11, r1
vst1.64 {q1}, [r11]!
vst1.64 {q3}, [r11]!
vst1.64 {q4}, [r11]!
vst1.64 {q6}, [r11]!
vst1.64 {q9}, [r11]!
vst1.64 {q11}, [r11]!
vst1.64 {q12}, [r11]!
vst1.64 {q14}, [r11]!
; stage 1 for x0,x1,x2,x3,x8,x9,x10 and x11
; s0 = x0 * cospi_1_64 + x1 * cospi_31_64;
; s1 = x0 * cospi_31_64 - x1 * cospi_1_64;
DO_BUTTERFLY_DST d30, d31, d0, d1, cospi_31_64, cospi_1_64, q1, q3, q4, q6
; s8 = x8 * cospi_17_64 + x9 * cospi_15_64;
; s9 = x8 * cospi_15_64 - x9 * cospi_17_64;
DO_BUTTERFLY_DST d14, d15, d16, d17, cospi_15_64, cospi_17_64, q9, q11, q15, q0
; x0 = dct_const_round_shift(s0 + s8);
; x8 = dct_const_round_shift(s0 - s8);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q6, q15, q0, d14, d15, d16, d17
; x1 = dct_const_round_shift(s1 + s9);
; x9 = dct_const_round_shift(s1 - s9);
DO_DUAL_BUTTERFLY_NO_COEFFS q1, q3, q9, q11, d8, d9, d12, d13
; s2 = x2 * cospi_5_64 + x3 * cospi_27_64;
; s3 = x2 * cospi_27_64 - x3 * cospi_5_64;
DO_BUTTERFLY_DST d26, d27, d4, d5, cospi_27_64, cospi_5_64, q1, q3, q9, q11
; s10 = x10 * cospi_21_64 + x11 * cospi_11_64;
; s11 = x10 * cospi_11_64 - x11 * cospi_21_64;
DO_BUTTERFLY_DST d10, d11, d20, d21, cospi_11_64, cospi_21_64, q13, q2, q0, q15
; x10 = dct_const_round_shift(s2 - s10);
; x2 = dct_const_round_shift(s2 + s10);
DO_DUAL_BUTTERFLY_NO_COEFFS q9, q11, q0, q15, d10, d11, d20, d21
; x11 = dct_const_round_shift(s3 - s11);
; x3 = dct_const_round_shift(s3 + s11);
DO_DUAL_BUTTERFLY_NO_COEFFS q1, q3, q13, q2, d18, d19, d22, d23
; store for x0,x1,x2,x3,x8,x9,x10 and x11 to
; intermediate buffer after stage 1
vst1.64 {q7}, [r11]!
vst1.64 {q4}, [r11]!
vst1.64 {q5}, [r11]!
vst1.64 {q9}, [r11]!
vst1.64 {q8}, [r11]!
vst1.64 {q6}, [r11]!
vst1.64 {q10}, [r11]!
vst1.64 {q11}, [r11]!
; load x4,x5,x6,x7,x12,x13,x14 and x15 from intermediate buffer
mov r11, r1
vld1.64 q5, [r11]!
vld1.64 q7, [r11]!
vld1.64 q0, [r11]!
vld1.64 q2, [r11]!
vld1.64 q13, [r11]!
vld1.64 q15, [r11]!
vld1.64 q8, [r11]!
vld1.64 q10, [r11]!
; stage 1 for x4,x5,x6,x7,x12,x13,x14 and x15
; s4 = x4 * cospi_9_64 + x5 * cospi_23_64;
; s5 = x4 * cospi_23_64 - x5 * cospi_9_64;
DO_BUTTERFLY_DST d30, d31, d0, d1, cospi_23_64, cospi_9_64, q1, q3, q4, q6
; s12 = x12 * cospi_25_64 + x13 * cospi_7_64;
; s13 = x12 * cospi_7_64 - x13 * cospi_25_64;
DO_BUTTERFLY_DST d14, d15, d16, d17, cospi_7_64, cospi_25_64, q9, q11, q15, q0
; x4 = dct_const_round_shift(s4 + s12);
; x12 = dct_const_round_shift(s4 - s12);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q6, q15, q0, d14, d15, d16, d17
; x5 = dct_const_round_shift(s5 + s13);
; x13 = dct_const_round_shift(s5 - s13);
DO_DUAL_BUTTERFLY_NO_COEFFS q1, q3, q9, q11, d8, d9, d12, d13
; s6 = x6 * cospi_13_64 + x7 * cospi_19_64;
; s7 = x6 * cospi_19_64 - x7 * cospi_13_64;
DO_BUTTERFLY_DST d26, d27, d4, d5, cospi_19_64, cospi_13_64, q1, q3, q9, q11
; s14 = x14 * cospi_29_64 + x15 * cospi_3_64;
; s15 = x14 * cospi_3_64 - x15 * cospi_29_64;
DO_BUTTERFLY_DST d10, d11, d20, d21, cospi_3_64, cospi_29_64, q13, q2, q0, q15
; x6 = dct_const_round_shift(s6 + s14);
; x14 = dct_const_round_shift(s6 - s14);
DO_DUAL_BUTTERFLY_NO_COEFFS q9, q11, q0, q15, d10, d11, d20, d21
; x7 = dct_const_round_shift(s7 + s15);
; x15 = dct_const_round_shift(s7 - s15);
DO_DUAL_BUTTERFLY_NO_COEFFS q1, q3, q13, q2, d18, d19, d22, d23
mov r11, r1
; store x4 - x7 to intermediate buffer
vst1.64 {q7}, [r11]!
vst1.64 {q4}, [r11]!
vst1.64 {q5}, [r11]!
vst1.64 {q9}, [r11]!
; load x8 - x11 from intermediate buffer
add r11, r11, #128
vld1.64 q0, [r11]!
vld1.64 q1, [r11]!
vld1.64 q2, [r11]!
vld1.64 q3, [r11]!
; stage 2 for x8,x9,x10,x11,x12,x13,x14 and x15
; s8 = x8 * cospi_4_64 + x9 * cospi_28_64;
; s9 = x8 * cospi_28_64 - x9 * cospi_4_64;
DO_BUTTERFLY_DST d0, d1, d2, d3, cospi_28_64, cospi_4_64, q4, q5, q7, q9
; s12 = -x12 * cospi_28_64 + x13 * cospi_4_64;
; s13 = x12 * cospi_4_64 + x13 * cospi_28_64;
DO_BUTTERFLY_DST d12, d13, d16, d17, cospi_4_64, cospi_28_64, q13, q15, q0, q1
; x8 = dct_const_round_shift(s8 + s12);
; x12 = dct_const_round_shift(s8 - s12);
DO_DUAL_BUTTERFLY_NO_COEFFS q7, q9, q13, q15, d12, d13, d16, d17
; x9 = dct_const_round_shift(s9 + s13);
; x13 = dct_const_round_shift(s9 - s13);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q5, q0, q1, d14, d15, d18, d19
; s10 = x10 * cospi_20_64 + x11 * cospi_12_64;
; s11 = x10 * cospi_12_64 - x11 * cospi_20_64;
DO_BUTTERFLY_DST d4, d5, d6, d7, cospi_12_64, cospi_20_64, q4, q5, q0, q1
; s14 = -x14 * cospi_12_64 + x15 * cospi_20_64;
; s15 = x14 * cospi_20_64 + x15 * cospi_12_64;
DO_BUTTERFLY_DST d22, d23, d20, d21, cospi_20_64, cospi_12_64, q2, q3, q13, q15
; x10 = dct_const_round_shift(s10 + s14);
; x14 = dct_const_round_shift(s10 - s14);
DO_DUAL_BUTTERFLY_NO_COEFFS q0, q1, q2, q3, d22, d23, d20, d21
; x15 = dct_const_round_shift(s11 - s15);
; x11 = dct_const_round_shift(s11 + s15);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q5, q13, q15, d0, d1, d2, d3
; stage 3 for x8,x9,x10,x11,x12,x13,x14 and x15
; s12 = x12 * cospi_8_64 + x13 * cospi_24_64;
; s13 = x12 * cospi_24_64 - x13 * cospi_8_64;
DO_BUTTERFLY_DST d16, d17, d18, d19, cospi_24_64, cospi_8_64, q2, q3, q4, q5
; s14 = -x14 * cospi_24_64 + x15 * cospi_8_64;
; s15 = x14 * cospi_8_64 + x15 * cospi_24_64;
DO_BUTTERFLY_DST d2, d3, d20, d21, cospi_8_64, cospi_24_64, q8, q9, q13, q15
; x12 = dct_const_round_shift(s12 + s14);
; x14 = dct_const_round_shift(s12 - s14);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q5, q8, q9, d20, d21, d2, d3
; x13 = dct_const_round_shift(s13 + s15);
; x15 = dct_const_round_shift(s13 - s15);
DO_DUAL_BUTTERFLY_NO_COEFFS q2, q3, q13, q15, d8, d9, d10, d11
; x8 = s8 + s10;
; x9 = s9 + s11;
; x10 = s8 - s10;
; x11 = s9 - s11;
DO_BUTTERFLY_NO_COEFFS q6, q11, q2, q3
DO_BUTTERFLY_NO_COEFFS q7, q0, q8, q9
; stage 4 for x8,x9,x10,x11,x12,x13,x14 and x15
; s10 = cospi_16_64 * ( x10 + x11);
; s11 = cospi_16_64 * (-x10 + x11);
; x10 = dct_const_round_shift(s10);
; x11 = dct_const_round_shift(s11);
DO_BUTTERFLY_SYM_COEFFS d18, d19, d6, d7, cospi_16_64, d0, d1, d14, d15, q3, q7
; s14 = -cospi_16_64 * (x14 + x15);
; s15 = cospi_16_64 * (x14 - x15);
; x14 = dct_const_round_shift(s14);
; x15 = dct_const_round_shift(s15);
DO_BUTTERFLY_SYM_COEFFS d10, d11, d2, d3, -cospi_16_64, d12, d13, d22, d23, q1, q11
ldr r5, [sp,#40] ; Loads dest_stride
cmp r2, #0
beq skip_adding_dest1 ; first pass
mov r10, r3 ; for laod
vneg.s16 q2, q2
mov r11, r3 ; for store
add r10, r10, r5
add r11, r11, r5
vld1.64 {d2}, [r10], r5 ; load destination data,output[1]
vrshr.s16 q2, q2, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[1]
vld1.64 {d2}, [r10], r5 ; load destination data,output[2]
vrshr.s16 q2, q10, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[2]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vneg.s16 q4, q4
vld1.64 {d2}, [r10], r5 ; load destination data,output[5]
vrshr.s16 q2, q6, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[5]
vld1.64 {d2}, [r10], r5 ; load destination data,output[6]
vrshr.s16 q2, q0, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[6]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destination data,output[5]
vrshr.s16 q2, q7, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[5]
vld1.64 {d2}, [r10], r5 ; load destination data,output[6]
vrshr.s16 q2, q11, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[6]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destination data,output[5]
vrshr.s16 q2, q4, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[5]
vld1.64 {d2}, [r10], r5 ; load destination data,output[6]
vrshr.s16 q2, q8, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[6]
b stage2_for_x0_x7
skip_adding_dest1
vneg.s16 q2, q2
mov r11, r3
add r11, r11, r5
vst1.64 {q2}, [r11], r5 ; output[1] = -x8;
vst1.64 {q10}, [r11], r5 ; output[2] = x12;
add r11, r11, r5, lsl #1
vneg.s16 q4, q4
vst1.64 {q6}, [r11], r5 ; output[5] = x14;
vst1.64 {q0}, [r11], r5 ; output[6] = x10;
add r11, r11, r5, lsl #1
vst1.64 {q7}, [r11], r5 ; output[9] = x11;
vst1.64 {q11}, [r11], r5 ; output[10] = x15;
add r11, r11, r5, lsl #1
vst1.64 {q4}, [r11], r5 ; output[13] = -x13;
vst1.64 {q8}, [r11], r5 ; output[14] = x9;
stage2_for_x0_x7
; stage 2 for x0,x1,x2,x3,x4,x5,x6 and x7
; load x4-x7
mov r11, r1
vld1.64 {q2}, [r11]!
vld1.64 {q3}, [r11]!
vld1.64 {q4}, [r11]!
vld1.64 {q5}, [r11]!
; load x0-x3
add r11, r11, #64
vld1.64 q12, [r11]!
vld1.64 q13, [r11]!
vld1.64 q14, [r11]!
vld1.64 q15, [r11]!
; x0 = s0 + s4;
; x1 = s1 + s5;
; x2 = s2 + s6;
; x3 = s3 + s7;
; x4 = s0 - s4;
; x5 = s1 - s5;
; x6 = s2 - s6;
; x7 = s3 - s7;
DO_BUTTERFLY_NO_COEFFS q12, q2, q6, q8
DO_BUTTERFLY_NO_COEFFS q13, q3, q7, q9
DO_BUTTERFLY_NO_COEFFS q14, q4, q11, q10
DO_BUTTERFLY_NO_COEFFS q15, q5, q0, q1
; stage 3 for x0,x1,x2,x3,x4,x5,x6 and x7
; s4 = x4 * cospi_8_64 + x5 * cospi_24_64;
; s5 = x4 * cospi_24_64 - x5 * cospi_8_64;
DO_BUTTERFLY_DST d16, d17, d18, d19, cospi_24_64, cospi_8_64, q2, q3, q4, q5
; s6 = -x6 * cospi_24_64 + x7 * cospi_8_64;
; s7 = x6 * cospi_8_64 + x7 * cospi_24_64;
DO_BUTTERFLY_DST d2, d3, d20, d21, cospi_8_64, cospi_24_64, q8, q9, q13, q15
; x4 = dct_const_round_shift(s4 + s6);
; x6 = dct_const_round_shift(s4 - s6);
DO_DUAL_BUTTERFLY_NO_COEFFS q4, q5, q8, q9, d20, d21, d2, d3
; x5 = dct_const_round_shift(s5 + s7);
; x7 = dct_const_round_shift(s5 - s7);
DO_DUAL_BUTTERFLY_NO_COEFFS q2, q3, q13, q15, d8, d9, d10, d11
; x0 = s0 + s2;
; x1 = s1 + s3;
; x2 = s0 - s2;
; x3 = s1 - s3;
DO_BUTTERFLY_NO_COEFFS q6, q11, q2, q3
DO_BUTTERFLY_NO_COEFFS q7, q0, q8, q9
; stage 4 for for x0,x1,x2,x3,x4,x5,x6 and x7
; s6 = cospi_16_64 * (x6 + x7);
; s7 = cospi_16_64 * (- x6 + x7);
; x6 = dct_const_round_shift(s6);
; x7 = dct_const_round_shift(s7);
DO_BUTTERFLY_SYM_COEFFS d10, d11, d2, d3, cospi_16_64, d0, d1, d14, d15, q5, q7
; s2 = -cospi_16_64 * (x2 + x3);
; s3 = cospi_16_64 * (x2 - x3);
; x2 = dct_const_round_shift(s2);
; x3 = dct_const_round_shift(s3);
DO_BUTTERFLY_SYM_COEFFS d18, d19, d6, d7, -cospi_16_64, d12, d13, d22, d23, q3, q11
cmp r2, #0
beq skip_adding_dest2
mov r10, r3 ; for load
vneg.s16 q10, q10
mov r11, r3 ; for store
vld1.64 {d2}, [r10], r5 ; load destination data,output[0]
vrshr.s16 q2, q2, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[0]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destination data,output[3]
vrshr.s16 q2, q10, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[3]
vld1.64 {d2}, [r10], r5 ; load destination data,output[4]
vrshr.s16 q2, q0, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[4]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destination data,output[7]
vrshr.s16 q2, q6, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[3]
vld1.64 {d2}, [r10], r5 ; load destination data,output[8]
vrshr.s16 q2, q11, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[8]
vneg.s16 q8, q8
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destinatin data,output[11]
vrshr.s16 q2, q7, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[1]
vld1.64 {d2}, [r10], r5 ; load destinatin data,output[12]
vrshr.s16 q2, q4, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[12]
add r10, r10, r5, lsl #1
add r11, r11, r5, lsl #1
vld1.64 {d2}, [r10], r5 ; load destinatin data,output[15]
vrshr.s16 q2, q8, #6
vaddw.u8 q2, q2, d2 ; + dest[j * dest_stride + i]
vqmovun.s16 d2, q2 ; clip pixel
vst1.64 {d2}, [r11], r5 ; store the data, output[15]
b endfunction
skip_adding_dest2
vneg.s16 q10, q10
mov r11, r3
vst1.64 {q2}, [r11], r5 ; output[0] = x0;
add r11, r11, r5, lsl #1
vst1.64 {q10}, [r11], r5 ; output[3] = -x4;
vst1.64 {q0}, [r11], r5 ; output[4] = x6;
add r11, r11, r5, lsl #1
vst1.64 {q6}, [r11], r5 ; output[7] = x2;
vst1.64 {q11}, [r11], r5 ; output[8] = x3;
vneg.s16 q8, q8
add r11, r11, r5, lsl #1
vst1.64 {q7}, [r11], r5 ; output[11] = x7;
vst1.64 {q4}, [r11], r5 ; output[12] = x5;
add r11, r11, r5, lsl #1
vst1.64 {q8}, [r11], r5 ; output[15] = -x1;
endfunction
pop {r4-r12, pc}
ENDP
END
| ittiamvpx/libvpx | vp9/common/arm/neon/vp9_iht16x16_add_neon_asm.asm | Assembly | bsd-3-clause | 25,124 |
; bubble8.asm
;
; Bubble sort of an array of bytes. Code taken from:
;
; http://www.6502.org/source/sorting/bubble8.htm
;
.word $8000
.org $8000
;THIS SUBROUTINE ARRANGES THE 8-BIT ELEMENTS OF A LIST IN ASCENDING
;ORDER. THE STARTING ADDRESS OF THE LIST IS IN LOCATIONS $30 AND
;$31. THE LENGTH OF THE LIST IS IN THE FIRST BYTE OF THE LIST. LOCATION
;$32 IS USED TO HOLD AN EXCHANGE FLAG.
SORT8: LDY #$00 ;TURN EXCHANGE FLAG OFF (= 0)
STY $32
LDA ($30),Y ;FETCH ELEMENT COUNT
TAX ; AND PUT IT INTO X
INY ;POINT TO FIRST ELEMENT IN LIST
DEX ;DECREMENT ELEMENT COUNT
NXTEL: LDA ($30),Y ;FETCH ELEMENT
INY
CMP ($30),Y ;IS IT LARGER THAN THE NEXT ELEMENT?
BCC CHKEND
BEQ CHKEND
;YES. EXCHANGE ELEMENTS IN MEMORY
PHA ; BY SAVING LOW BYTE ON STACK.
LDA ($30),Y ; THEN GET HIGH BYTE AND
DEY ; STORE IT AT LOW ADDRESS
STA ($30),Y
PLA ;PULL LOW BYTE FROM STACK
INY ; AND STORE IT AT HIGH ADDRESS
STA ($30),Y
LDA #$FF ;TURN EXCHANGE FLAG ON (= -1)
STA $32
CHKEND: DEX ;END OF LIST?
BNE NXTEL ;NO. FETCH NEXT ELEMENT
BIT $32 ;YES. EXCHANGE FLAG STILL OFF?
BMI SORT8 ;NO. GO THROUGH LIST AGAIN
.byte $02 ; HLT
| timofonic/fpga_nes | sw/asm/bubble8.asm | Assembly | bsd-2-clause | 1,458 |
; Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; ReadTsc.Asm
;
; Abstract:
;
; AsmReadTsc function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; AsmReadTsc (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadTsc PROC
rdtsc
shl rdx, 20h
or rax, rdx
ret
AsmReadTsc ENDP
END
| google/google-ctf | third_party/edk2/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/ReadTsc.asm | Assembly | apache-2.0 | 1,217 |
;***********************************************************
;*
;* Enter Name of file here
;*
;* Enter the description of the program here
;*
;* This is the skeleton file Lab 3 of ECE 375
;*
;***********************************************************
;*
;* Author: Enter your name
;* Date: Enter Date
;*
;***********************************************************
.include "m128def.inc" ; Include definition file
;***********************************************************
;* Internal Register Definitions and Constants
;***********************************************************
.def mpr = r16 ; Multipurpose register required for LCD Driver
.def olcnt = r23 ; Used as the outer loop counter
.def ilcnt = r24 ; Used as the inner loop counter
.def waitcnt = r25 ; Used in the wait loop counter
.equ BTN_RIGHT = 15 ; Buttons on the right side of the board
.equ BTN_LEFT = 240 ; Buttons on the left side
;***********************************************************
;* Start of Code Segment
;***********************************************************
.cseg ; Beginning of code segment
;-----------------------------------------------------------
; Interrupt Vectors
;-----------------------------------------------------------
.org $0000 ; Beginning of IVs
rjmp INIT ; Reset interrupt
.org $0046 ; End of Interrupt Vectors
;-----------------------------------------------------------
; Program Initialization
;-----------------------------------------------------------
INIT: ; The initialization routine
; Initialize Stack Pointer
ldi mpr, HIGH(RAMEND)
out SPH, mpr
ldi mpr, LOW(RAMEND)
out SPL, mpr
; Initialize LCD Display
rcall LCDInit
; Initialize Port D for inputs
ldi mpr, $FF ; Initialize Port D for inputs
out PORTD, mpr ; with Tri-State
ldi mpr, $00 ; Set Port D Directional Register
out DDRD, mpr ; for inputs
;-----------------------------------------------------------
; Main Program
;-----------------------------------------------------------
MAIN:
; Move to the first data block
ldi ZL, low(START<<1)
ldi ZH, high(START<<1)
ldi YL, low(LCDLn1Addr)
ldi YH, high(LCDLn1Addr)
GAME:
; Draw the text to the screen
rcall SubDrawScreen
ldi olcnt, 32
adiw ZH:ZL, 32 ; Move past the game text.
ldi waitcnt, 25
rcall SubWait
rjmp INPUT ; Wait for user input
INPUT: ; Get user input and move the story appropriately
; TODO: This should be done with interrupts.
busywait: ; Wait for a button press
in mpr, PIND ; Note: active low
com mpr ; Flip the input
andi mpr, BTN_RIGHT ; Check for the right buttons
brne RIGHT_PRESS ; Branch if any button pressed
in mpr, PIND ; Note: active low
com mpr ; Flip the input
andi mpr, BTN_LEFT ; Check for the left buttons
brne LEFT_PRESS ; Branch if any button pressed
rjmp busywait ; Wait for input
RIGHT_PRESS:
lpm XL, Z+
lpm XH, Z+
rjmp MOVE_ON
LEFT_PRESS:
rjmp MOVE_ON
MOVE_ON:
; Load the next-block pointer from the end of the current block and
; make Z point to the next block.
lpm XL, Z+
lpm XH, Z+
movw ZH:ZL, XH:XL
rjmp GAME ; Game Loop
;***********************************************************
;* Functions and Subroutines
;***********************************************************
;----------------------------------------------------------------
; Sub: SubDrawScreen
; Desc: Writes the page in program memory pointed to by the Z
; register to the LCD.
;----------------------------------------------------------------
SubDrawScreen:
; Save registers on the stack
push mpr
push ZH
push ZL
push YH
push YL
push olcnt
; Point the Y register to the LCD memory.
ldi YL, low(LCDLn1Addr)
ldi YH, high(LCDLn1Addr)
ldi olcnt, 32 ; The number of chars on the screen
LOAD_TEXT:
lpm mpr, Z+ ; Get the character
st Y+, mpr ; Put it in the LCD memory
dec olcnt ; One less character
brne LOAD_TEXT ; Are we done yet?
rcall LCDWrite ; Put it on the screen.
; Restore registers from the stack
pop olcnt
pop YL
pop YH
pop ZL
pop ZH
pop mpr
ret
;----------------------------------------------------------------
; Sub: SubWait
; Desc: A wait loop that is 16 + 159975*waitcnt cycles or roughly
; waitcnt*10ms. Just initialize wait for the specific amount
; of time in 10ms intervals. Here is the general eqaution
; for the number of clock cycles in the wait loop:
; ((3 * ilcnt + 3) * olcnt + 3) * waitcnt + 13 + call
;----------------------------------------------------------------
SubWait:
push waitcnt ; Save wait register
push ilcnt ; Save ilcnt register
push olcnt ; Save olcnt register
Loop: ldi olcnt, 224 ; load olcnt register
OLoop: ldi ilcnt, 237 ; load ilcnt register
ILoop: dec ilcnt ; decrement ilcnt
brne ILoop ; Continue Inner Loop
dec olcnt ; decrement olcnt
brne OLoop ; Continue Outer Loop
dec waitcnt ; Decrement wait
brne Loop ; Continue Wait loop
pop olcnt ; Restore olcnt register
pop ilcnt ; Restore ilcnt register
pop waitcnt ; Restore wait register
ret ; Return from subroutine
;***********************************************************
;* Stored Program Data
;***********************************************************
START:
.include "storydata.asm"
;***********************************************************
;* Additional Program Includes
;***********************************************************
.include "LCDDriver.asm" ; Include the LCD Driver
| mythmon/HelloDave | hellodave.asm | Assembly | mit | 6,788 |
Angle_LUT:
.db 84
.db 84
.db 83
.db 83
.db 82
.db 82
.db 81
.db 81
.db 80
.db 79
.db 79
.db 78
.db 77
.db 76
.db 75
.db 74
.db 73
.db 72
.db 71
.db 70
.db 69
.db 67
.db 66
.db 65
.db 85
.db 84
.db 84
.db 83
.db 83
.db 82
.db 82
.db 81
.db 81
.db 80
.db 79
.db 78
.db 78
.db 77
.db 76
.db 75
.db 74
.db 73
.db 71
.db 70
.db 69
.db 67
.db 66
.db 65
.db 85
.db 85
.db 85
.db 84
.db 84
.db 83
.db 83
.db 82
.db 81
.db 81
.db 80
.db 79
.db 78
.db 77
.db 76
.db 75
.db 74
.db 73
.db 72
.db 71
.db 69
.db 68
.db 66
.db 65
.db 86
.db 86
.db 85
.db 85
.db 84
.db 84
.db 83
.db 83
.db 82
.db 82
.db 81
.db 80
.db 79
.db 78
.db 77
.db 76
.db 75
.db 74
.db 72
.db 71
.db 70
.db 68
.db 66
.db 65
.db 87
.db 86
.db 86
.db 86
.db 85
.db 85
.db 84
.db 84
.db 83
.db 82
.db 82
.db 81
.db 80
.db 79
.db 78
.db 77
.db 76
.db 74
.db 73
.db 72
.db 70
.db 68
.db 67
.db 65
.db 87
.db 87
.db 87
.db 86
.db 86
.db 85
.db 85
.db 84
.db 84
.db 83
.db 83
.db 82
.db 81
.db 80
.db 79
.db 78
.db 77
.db 75
.db 74
.db 72
.db 71
.db 69
.db 67
.db 65
.db 88
.db 88
.db 88
.db 87
.db 87
.db 86
.db 86
.db 85
.db 85
.db 84
.db 84
.db 83
.db 82
.db 81
.db 80
.db 79
.db 78
.db 76
.db 75
.db 73
.db 71
.db 69
.db 67
.db 65
.db 89
.db 89
.db 88
.db 88
.db 88
.db 87
.db 87
.db 86
.db 86
.db 85
.db 85
.db 84
.db 83
.db 82
.db 81
.db 80
.db 79
.db 77
.db 76
.db 74
.db 72
.db 70
.db 68
.db 65
.db 90
.db 89
.db 89
.db 89
.db 89
.db 88
.db 88
.db 87
.db 87
.db 86
.db 86
.db 85
.db 84
.db 83
.db 82
.db 81
.db 80
.db 79
.db 77
.db 75
.db 73
.db 71
.db 68
.db 65
.db 91
.db 90
.db 90
.db 90
.db 89
.db 89
.db 89
.db 88
.db 88
.db 87
.db 87
.db 86
.db 86
.db 85
.db 84
.db 83
.db 81
.db 80
.db 78
.db 76
.db 74
.db 71
.db 69
.db 66
.db 91
.db 91
.db 91
.db 91
.db 90
.db 90
.db 90
.db 89
.db 89
.db 89
.db 88
.db 88
.db 87
.db 86
.db 85
.db 84
.db 83
.db 82
.db 80
.db 78
.db 76
.db 73
.db 69
.db 66
.db 92
.db 92
.db 92
.db 92
.db 91
.db 91
.db 91
.db 91
.db 90
.db 90
.db 89
.db 89
.db 88
.db 88
.db 87
.db 86
.db 85
.db 84
.db 82
.db 80
.db 77
.db 74
.db 71
.db 66
.db 93
.db 93
.db 93
.db 93
.db 92
.db 92
.db 92
.db 92
.db 91
.db 91
.db 91
.db 90
.db 90
.db 89
.db 89
.db 88
.db 87
.db 86
.db 84
.db 83
.db 80
.db 77
.db 72
.db 67
.db 94
.db 94
.db 94
.db 94
.db 93
.db 93
.db 93
.db 93
.db 93
.db 93
.db 92
.db 92
.db 92
.db 91
.db 91
.db 90
.db 89
.db 89
.db 87
.db 86
.db 83
.db 80
.db 75
.db 68
.db 95
.db 95
.db 95
.db 95
.db 94
.db 94
.db 94
.db 94
.db 94
.db 94
.db 94
.db 94
.db 93
.db 93
.db 93
.db 92
.db 92
.db 91
.db 91
.db 89
.db 88
.db 85
.db 80
.db 71
.db 96
.db 96
.db 96
.db 96
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 95
.db 94
.db 94
.db 94
.db 93
.db 92
.db 89
.db 80
Dist_LUT:
.db 13
.db 14
.db 14
.db 15
.db 15
.db 16
.db 16
.db 17
.db 17
.db 18
.db 18
.db 19
.db 19
.db 20
.db 21
.db 21
.db 22
.db 22
.db 23
.db 23
.db 24
.db 24
.db 24
.db 24
.db 14
.db 14
.db 14
.db 15
.db 15
.db 16
.db 17
.db 17
.db 18
.db 18
.db 19
.db 20
.db 20
.db 21
.db 22
.db 22
.db 23
.db 24
.db 24
.db 25
.db 25
.db 26
.db 26
.db 26
.db 14
.db 14
.db 15
.db 15
.db 16
.db 16
.db 17
.db 18
.db 18
.db 19
.db 20
.db 20
.db 21
.db 22
.db 23
.db 24
.db 24
.db 25
.db 26
.db 26
.db 27
.db 27
.db 28
.db 28
.db 14
.db 15
.db 15
.db 16
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 20
.db 21
.db 22
.db 23
.db 24
.db 25
.db 26
.db 27
.db 28
.db 28
.db 29
.db 29
.db 30
.db 30
.db 14
.db 15
.db 15
.db 16
.db 17
.db 17
.db 18
.db 19
.db 19
.db 20
.db 21
.db 22
.db 23
.db 24
.db 25
.db 26
.db 27
.db 28
.db 29
.db 30
.db 31
.db 32
.db 32
.db 33
.db 15
.db 15
.db 16
.db 16
.db 17
.db 18
.db 18
.db 19
.db 20
.db 21
.db 22
.db 23
.db 24
.db 25
.db 27
.db 28
.db 29
.db 30
.db 32
.db 33
.db 34
.db 35
.db 35
.db 36
.db 15
.db 15
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 22
.db 23
.db 24
.db 25
.db 27
.db 28
.db 29
.db 31
.db 33
.db 34
.db 36
.db 37
.db 38
.db 39
.db 40
.db 15
.db 16
.db 16
.db 17
.db 18
.db 18
.db 19
.db 20
.db 21
.db 22
.db 24
.db 25
.db 26
.db 28
.db 29
.db 31
.db 33
.db 35
.db 37
.db 39
.db 41
.db 42
.db 44
.db 44
.db 15
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 22
.db 23
.db 24
.db 26
.db 27
.db 29
.db 31
.db 33
.db 35
.db 38
.db 40
.db 43
.db 45
.db 48
.db 49
.db 50
.db 15
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 22
.db 24
.db 25
.db 27
.db 28
.db 30
.db 33
.db 35
.db 38
.db 41
.db 44
.db 48
.db 51
.db 54
.db 56
.db 58
.db 16
.db 16
.db 17
.db 18
.db 19
.db 19
.db 20
.db 22
.db 23
.db 24
.db 26
.db 28
.db 29
.db 32
.db 34
.db 37
.db 40
.db 44
.db 48
.db 53
.db 58
.db 62
.db 66
.db 68
.db 16
.db 16
.db 17
.db 18
.db 19
.db 20
.db 21
.db 22
.db 23
.db 25
.db 26
.db 28
.db 30
.db 33
.db 36
.db 39
.db 43
.db 48
.db 53
.db 59
.db 66
.db 73
.db 79
.db 83
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 22
.db 24
.db 25
.db 27
.db 29
.db 31
.db 34
.db 37
.db 41
.db 45
.db 51
.db 58
.db 66
.db 76
.db 87
.db 99
.db 106
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 23
.db 24
.db 26
.db 27
.db 29
.db 32
.db 35
.db 38
.db 42
.db 48
.db 54
.db 62
.db 73
.db 87
.db 106
.db 129
.db 147
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 23
.db 24
.db 26
.db 28
.db 30
.db 32
.db 35
.db 39
.db 44
.db 49
.db 56
.db 66
.db 79
.db 99
.db 129
.db 177
.db 238
.db 16
.db 17
.db 17
.db 18
.db 19
.db 20
.db 21
.db 23
.db 24
.db 26
.db 28
.db 30
.db 33
.db 36
.db 40
.db 44
.db 50
.db 58
.db 68
.db 83
.db 106
.db 147
.db 238
.db 532
| KnightOS/demos | pixelmad/tnllut.asm | Assembly | mit | 5,408 |
.text
.global main:
test:
LDV A, 20
PSH A
POP D
RET
main:
LDV A, test:
CAL A
HLT
| redfast00/RCPU | asm/fpga_sys_debug.asm | Assembly | mit | 113 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2015, Intel Corporation
;
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
;
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the
; distribution.
;
; * Neither the name of the Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived from
; this software without specific prior written permission.
;
;
; THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""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 INTEL CORPORATION 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.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; routine to do a 128 bit CBC AES encrypt
;; clobbers all registers except for ARG1 and rbp
%include "mb_mgr_datastruct.asm"
%define VMOVDQ vmovdqu ;; assume buffers not aligned
%macro VPXOR2 2
vpxor %1, %1, %2
%endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; struct AES_ARGS_x8 {
;; void* in[8];
;; void* out[8];
;; UINT128* keys[8];
;; UINT128 IV[8];
;; }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_cbc_enc_128_x8(AES_ARGS_x8 *args, UINT64 len);
;; arg 1: ARG : addr of AES_ARGS_x8 structure
;; arg 2: LEN : len (in units of bytes)
struc STACK
_gpr_save: resq 1
_len: resq 1
endstruc
%define GPR_SAVE_AREA rsp + _gpr_save
%define LEN_AREA rsp + _len
%ifdef LINUX
%define ARG rdi
%define LEN rsi
%define REG3 rcx
%define REG4 rdx
%else
%define ARG rcx
%define LEN rdx
%define REG3 rsi
%define REG4 rdi
%endif
%define IDX rax
%define TMP rbx
%define KEYS0 REG3
%define KEYS1 REG4
%define KEYS2 rbp
%define KEYS3 r8
%define KEYS4 r9
%define KEYS5 r10
%define KEYS6 r11
%define KEYS7 r12
%define IN0 r13
%define IN2 r14
%define IN4 r15
%define IN6 LEN
%define XDATA0 xmm0
%define XDATA1 xmm1
%define XDATA2 xmm2
%define XDATA3 xmm3
%define XDATA4 xmm4
%define XDATA5 xmm5
%define XDATA6 xmm6
%define XDATA7 xmm7
%define XKEY0_3 xmm8
%define XKEY1_4 xmm9
%define XKEY2_5 xmm10
%define XKEY3_6 xmm11
%define XKEY4_7 xmm12
%define XKEY5_8 xmm13
%define XKEY6_9 xmm14
%define XTMP xmm15
global aes_cbc_enc_128_x8 :function
aes_cbc_enc_128_x8:
sub rsp, STACK_size
mov [GPR_SAVE_AREA + 8*0], rbp
mov IDX, 16
mov [LEN_AREA], LEN
mov IN0, [ARG + _aesarg_in + 8*0]
mov IN2, [ARG + _aesarg_in + 8*2]
mov IN4, [ARG + _aesarg_in + 8*4]
mov IN6, [ARG + _aesarg_in + 8*6]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov TMP, [ARG + _aesarg_in + 8*1]
VMOVDQ XDATA0, [IN0] ; load first block of plain text
VMOVDQ XDATA1, [TMP] ; load first block of plain text
mov TMP, [ARG + _aesarg_in + 8*3]
VMOVDQ XDATA2, [IN2] ; load first block of plain text
VMOVDQ XDATA3, [TMP] ; load first block of plain text
mov TMP, [ARG + _aesarg_in + 8*5]
VMOVDQ XDATA4, [IN4] ; load first block of plain text
VMOVDQ XDATA5, [TMP] ; load first block of plain text
mov TMP, [ARG + _aesarg_in + 8*7]
VMOVDQ XDATA6, [IN6] ; load first block of plain text
VMOVDQ XDATA7, [TMP] ; load first block of plain text
VPXOR2 XDATA0, [ARG + _aesarg_IV + 16*0] ; plaintext XOR IV
VPXOR2 XDATA1, [ARG + _aesarg_IV + 16*1] ; plaintext XOR IV
VPXOR2 XDATA2, [ARG + _aesarg_IV + 16*2] ; plaintext XOR IV
VPXOR2 XDATA3, [ARG + _aesarg_IV + 16*3] ; plaintext XOR IV
VPXOR2 XDATA4, [ARG + _aesarg_IV + 16*4] ; plaintext XOR IV
VPXOR2 XDATA5, [ARG + _aesarg_IV + 16*5] ; plaintext XOR IV
VPXOR2 XDATA6, [ARG + _aesarg_IV + 16*6] ; plaintext XOR IV
VPXOR2 XDATA7, [ARG + _aesarg_IV + 16*7] ; plaintext XOR IV
mov KEYS0, [ARG + _aesarg_keys + 8*0]
mov KEYS1, [ARG + _aesarg_keys + 8*1]
mov KEYS2, [ARG + _aesarg_keys + 8*2]
mov KEYS3, [ARG + _aesarg_keys + 8*3]
mov KEYS4, [ARG + _aesarg_keys + 8*4]
mov KEYS5, [ARG + _aesarg_keys + 8*5]
mov KEYS6, [ARG + _aesarg_keys + 8*6]
mov KEYS7, [ARG + _aesarg_keys + 8*7]
VPXOR2 XDATA0, [KEYS0 + 16*0] ; 0. ARK
VPXOR2 XDATA1, [KEYS1 + 16*0] ; 0. ARK
VPXOR2 XDATA2, [KEYS2 + 16*0] ; 0. ARK
VPXOR2 XDATA3, [KEYS3 + 16*0] ; 0. ARK
VPXOR2 XDATA4, [KEYS4 + 16*0] ; 0. ARK
VPXOR2 XDATA5, [KEYS5 + 16*0] ; 0. ARK
VPXOR2 XDATA6, [KEYS6 + 16*0] ; 0. ARK
VPXOR2 XDATA7, [KEYS7 + 16*0] ; 0. ARK
vaesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
vaesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
vaesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
vaesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
vaesenc XDATA4, [KEYS4 + 16*1] ; 1. ENC
vaesenc XDATA5, [KEYS5 + 16*1] ; 1. ENC
vaesenc XDATA6, [KEYS6 + 16*1] ; 1. ENC
vaesenc XDATA7, [KEYS7 + 16*1] ; 1. ENC
vmovdqa XKEY0_3, [KEYS0 + 16*3] ; load round 3 key
vaesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
vaesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
vaesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
vaesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
vaesenc XDATA4, [KEYS4 + 16*2] ; 2. ENC
vaesenc XDATA5, [KEYS5 + 16*2] ; 2. ENC
vaesenc XDATA6, [KEYS6 + 16*2] ; 2. ENC
vaesenc XDATA7, [KEYS7 + 16*2] ; 2. ENC
vmovdqa XKEY1_4, [KEYS1 + 16*4] ; load round 4 key
vaesenc XDATA0, XKEY0_3 ; 3. ENC
vaesenc XDATA1, [KEYS1 + 16*3] ; 3. ENC
vaesenc XDATA2, [KEYS2 + 16*3] ; 3. ENC
vaesenc XDATA3, [KEYS3 + 16*3] ; 3. ENC
vaesenc XDATA4, [KEYS4 + 16*3] ; 3. ENC
vaesenc XDATA5, [KEYS5 + 16*3] ; 3. ENC
vaesenc XDATA6, [KEYS6 + 16*3] ; 3. ENC
vaesenc XDATA7, [KEYS7 + 16*3] ; 3. ENC
vaesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
vmovdqa XKEY2_5, [KEYS2 + 16*5] ; load round 5 key
vaesenc XDATA1, XKEY1_4 ; 4. ENC
vaesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
vaesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
vaesenc XDATA4, [KEYS4 + 16*4] ; 4. ENC
vaesenc XDATA5, [KEYS5 + 16*4] ; 4. ENC
vaesenc XDATA6, [KEYS6 + 16*4] ; 4. ENC
vaesenc XDATA7, [KEYS7 + 16*4] ; 4. ENC
vaesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
vaesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
vmovdqa XKEY3_6, [KEYS3 + 16*6] ; load round 6 key
vaesenc XDATA2, XKEY2_5 ; 5. ENC
vaesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
vaesenc XDATA4, [KEYS4 + 16*5] ; 5. ENC
vaesenc XDATA5, [KEYS5 + 16*5] ; 5. ENC
vaesenc XDATA6, [KEYS6 + 16*5] ; 5. ENC
vaesenc XDATA7, [KEYS7 + 16*5] ; 5. ENC
vaesenc XDATA0, [KEYS0 + 16*6] ; 6. ENC
vaesenc XDATA1, [KEYS1 + 16*6] ; 6. ENC
vaesenc XDATA2, [KEYS2 + 16*6] ; 6. ENC
vmovdqa XKEY4_7, [KEYS4 + 16*7] ; load round 7 key
vaesenc XDATA3, XKEY3_6 ; 6. ENC
vaesenc XDATA4, [KEYS4 + 16*6] ; 6. ENC
vaesenc XDATA5, [KEYS5 + 16*6] ; 6. ENC
vaesenc XDATA6, [KEYS6 + 16*6] ; 6. ENC
vaesenc XDATA7, [KEYS7 + 16*6] ; 6. ENC
vaesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
vaesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
vaesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
vaesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
vmovdqa XKEY5_8, [KEYS5 + 16*8] ; load round 8 key
vaesenc XDATA4, XKEY4_7 ; 7. ENC
vaesenc XDATA5, [KEYS5 + 16*7] ; 7. ENC
vaesenc XDATA6, [KEYS6 + 16*7] ; 7. ENC
vaesenc XDATA7, [KEYS7 + 16*7] ; 7. ENC
vaesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
vaesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
vaesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
vaesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
vaesenc XDATA4, [KEYS4 + 16*8] ; 8. ENC
vmovdqa XKEY6_9, [KEYS6 + 16*9] ; load round 9 key
vaesenc XDATA5, XKEY5_8 ; 8. ENC
vaesenc XDATA6, [KEYS6 + 16*8] ; 8. ENC
vaesenc XDATA7, [KEYS7 + 16*8] ; 8. ENC
vaesenc XDATA0, [KEYS0 + 16*9] ; 9. ENC
vaesenc XDATA1, [KEYS1 + 16*9] ; 9. ENC
vaesenc XDATA2, [KEYS2 + 16*9] ; 9. ENC
vaesenc XDATA3, [KEYS3 + 16*9] ; 9. ENC
vaesenc XDATA4, [KEYS4 + 16*9] ; 9. ENC
vaesenc XDATA5, [KEYS5 + 16*9] ; 9. ENC
mov TMP, [ARG + _aesarg_out + 8*0]
vaesenc XDATA6, XKEY6_9 ; 9. ENC
vaesenc XDATA7, [KEYS7 + 16*9] ; 9. ENC
vaesenclast XDATA0, [KEYS0 + 16*10] ; 10. ENC
vaesenclast XDATA1, [KEYS1 + 16*10] ; 10. ENC
vaesenclast XDATA2, [KEYS2 + 16*10] ; 10. ENC
vaesenclast XDATA3, [KEYS3 + 16*10] ; 10. ENC
vaesenclast XDATA4, [KEYS4 + 16*10] ; 10. ENC
vaesenclast XDATA5, [KEYS5 + 16*10] ; 10. ENC
vaesenclast XDATA6, [KEYS6 + 16*10] ; 10. ENC
vaesenclast XDATA7, [KEYS7 + 16*10] ; 10. ENC
VMOVDQ [TMP], XDATA0 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*1]
VMOVDQ [TMP], XDATA1 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*2]
VMOVDQ [TMP], XDATA2 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*3]
VMOVDQ [TMP], XDATA3 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*4]
VMOVDQ [TMP], XDATA4 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*5]
VMOVDQ [TMP], XDATA5 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*6]
VMOVDQ [TMP], XDATA6 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*7]
VMOVDQ [TMP], XDATA7 ; write back ciphertext
cmp [LEN_AREA], IDX
je done
main_loop:
mov TMP, [ARG + _aesarg_in + 8*1]
VPXOR2 XDATA0, [IN0 + IDX] ; load next block of plain text
VPXOR2 XDATA1, [TMP + IDX] ; load next block of plain text
mov TMP, [ARG + _aesarg_in + 8*3]
VPXOR2 XDATA2, [IN2 + IDX] ; load next block of plain text
VPXOR2 XDATA3, [TMP + IDX] ; load next block of plain text
mov TMP, [ARG + _aesarg_in + 8*5]
VPXOR2 XDATA4, [IN4 + IDX] ; load next block of plain text
VPXOR2 XDATA5, [TMP + IDX] ; load next block of plain text
mov TMP, [ARG + _aesarg_in + 8*7]
VPXOR2 XDATA6, [IN6 + IDX] ; load next block of plain text
VPXOR2 XDATA7, [TMP + IDX] ; load next block of plain text
VPXOR2 XDATA0, [KEYS0 + 16*0] ; 0. ARK
VPXOR2 XDATA1, [KEYS1 + 16*0] ; 0. ARK
VPXOR2 XDATA2, [KEYS2 + 16*0] ; 0. ARK
VPXOR2 XDATA3, [KEYS3 + 16*0] ; 0. ARK
VPXOR2 XDATA4, [KEYS4 + 16*0] ; 0. ARK
VPXOR2 XDATA5, [KEYS5 + 16*0] ; 0. ARK
VPXOR2 XDATA6, [KEYS6 + 16*0] ; 0. ARK
VPXOR2 XDATA7, [KEYS7 + 16*0] ; 0. ARK
vaesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
vaesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
vaesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
vaesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
vaesenc XDATA4, [KEYS4 + 16*1] ; 1. ENC
vaesenc XDATA5, [KEYS5 + 16*1] ; 1. ENC
vaesenc XDATA6, [KEYS6 + 16*1] ; 1. ENC
vaesenc XDATA7, [KEYS7 + 16*1] ; 1. ENC
vaesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
vaesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
vaesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
vaesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
vaesenc XDATA4, [KEYS4 + 16*2] ; 2. ENC
vaesenc XDATA5, [KEYS5 + 16*2] ; 2. ENC
vaesenc XDATA6, [KEYS6 + 16*2] ; 2. ENC
vaesenc XDATA7, [KEYS7 + 16*2] ; 2. ENC
vaesenc XDATA0, XKEY0_3 ; 3. ENC
vaesenc XDATA1, [KEYS1 + 16*3] ; 3. ENC
vaesenc XDATA2, [KEYS2 + 16*3] ; 3. ENC
vaesenc XDATA3, [KEYS3 + 16*3] ; 3. ENC
vaesenc XDATA4, [KEYS4 + 16*3] ; 3. ENC
vaesenc XDATA5, [KEYS5 + 16*3] ; 3. ENC
vaesenc XDATA6, [KEYS6 + 16*3] ; 3. ENC
vaesenc XDATA7, [KEYS7 + 16*3] ; 3. ENC
vaesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
vaesenc XDATA1, XKEY1_4 ; 4. ENC
vaesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
vaesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
vaesenc XDATA4, [KEYS4 + 16*4] ; 4. ENC
vaesenc XDATA5, [KEYS5 + 16*4] ; 4. ENC
vaesenc XDATA6, [KEYS6 + 16*4] ; 4. ENC
vaesenc XDATA7, [KEYS7 + 16*4] ; 4. ENC
vaesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
vaesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
vaesenc XDATA2, XKEY2_5 ; 5. ENC
vaesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
vaesenc XDATA4, [KEYS4 + 16*5] ; 5. ENC
vaesenc XDATA5, [KEYS5 + 16*5] ; 5. ENC
vaesenc XDATA6, [KEYS6 + 16*5] ; 5. ENC
vaesenc XDATA7, [KEYS7 + 16*5] ; 5. ENC
vaesenc XDATA0, [KEYS0 + 16*6] ; 6. ENC
vaesenc XDATA1, [KEYS1 + 16*6] ; 6. ENC
vaesenc XDATA2, [KEYS2 + 16*6] ; 6. ENC
vaesenc XDATA3, XKEY3_6 ; 6. ENC
vaesenc XDATA4, [KEYS4 + 16*6] ; 6. ENC
vaesenc XDATA5, [KEYS5 + 16*6] ; 6. ENC
vaesenc XDATA6, [KEYS6 + 16*6] ; 6. ENC
vaesenc XDATA7, [KEYS7 + 16*6] ; 6. ENC
vaesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
vaesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
vaesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
vaesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
vaesenc XDATA4, XKEY4_7 ; 7. ENC
vaesenc XDATA5, [KEYS5 + 16*7] ; 7. ENC
vaesenc XDATA6, [KEYS6 + 16*7] ; 7. ENC
vaesenc XDATA7, [KEYS7 + 16*7] ; 7. ENC
vaesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
vaesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
vaesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
vaesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
vaesenc XDATA4, [KEYS4 + 16*8] ; 8. ENC
vaesenc XDATA5, XKEY5_8 ; 8. ENC
vaesenc XDATA6, [KEYS6 + 16*8] ; 8. ENC
vaesenc XDATA7, [KEYS7 + 16*8] ; 8. ENC
vaesenc XDATA0, [KEYS0 + 16*9] ; 9. ENC
vaesenc XDATA1, [KEYS1 + 16*9] ; 9. ENC
vaesenc XDATA2, [KEYS2 + 16*9] ; 9. ENC
vaesenc XDATA3, [KEYS3 + 16*9] ; 9. ENC
vaesenc XDATA4, [KEYS4 + 16*9] ; 9. ENC
vaesenc XDATA5, [KEYS5 + 16*9] ; 9. ENC
mov TMP, [ARG + _aesarg_out + 8*0]
vaesenc XDATA6, XKEY6_9 ; 9. ENC
vaesenc XDATA7, [KEYS7 + 16*9] ; 9. ENC
vaesenclast XDATA0, [KEYS0 + 16*10] ; 10. ENC
vaesenclast XDATA1, [KEYS1 + 16*10] ; 10. ENC
vaesenclast XDATA2, [KEYS2 + 16*10] ; 10. ENC
vaesenclast XDATA3, [KEYS3 + 16*10] ; 10. ENC
vaesenclast XDATA4, [KEYS4 + 16*10] ; 10. ENC
vaesenclast XDATA5, [KEYS5 + 16*10] ; 10. ENC
vaesenclast XDATA6, [KEYS6 + 16*10] ; 10. ENC
vaesenclast XDATA7, [KEYS7 + 16*10] ; 10. ENC
VMOVDQ [TMP + IDX], XDATA0 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*1]
VMOVDQ [TMP + IDX], XDATA1 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*2]
VMOVDQ [TMP + IDX], XDATA2 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*3]
VMOVDQ [TMP + IDX], XDATA3 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*4]
VMOVDQ [TMP + IDX], XDATA4 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*5]
VMOVDQ [TMP + IDX], XDATA5 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*6]
VMOVDQ [TMP + IDX], XDATA6 ; write back ciphertext
mov TMP, [ARG + _aesarg_out + 8*7]
VMOVDQ [TMP + IDX], XDATA7 ; write back ciphertext
add IDX, 16
cmp [LEN_AREA], IDX
jne main_loop
done:
;; update IV
vmovdqa [ARG + _aesarg_IV + 16*0], XDATA0
vmovdqa [ARG + _aesarg_IV + 16*1], XDATA1
vmovdqa [ARG + _aesarg_IV + 16*2], XDATA2
vmovdqa [ARG + _aesarg_IV + 16*3], XDATA3
vmovdqa [ARG + _aesarg_IV + 16*4], XDATA4
vmovdqa [ARG + _aesarg_IV + 16*5], XDATA5
vmovdqa [ARG + _aesarg_IV + 16*6], XDATA6
vmovdqa [ARG + _aesarg_IV + 16*7], XDATA7
;; update IN and OUT
vmovd xmm0, [LEN_AREA]
vpshufd xmm0, xmm0, 0x44
vpaddq xmm1, xmm0, [ARG + _aesarg_in + 16*0]
vpaddq xmm2, xmm0, [ARG + _aesarg_in + 16*1]
vpaddq xmm3, xmm0, [ARG + _aesarg_in + 16*2]
vpaddq xmm4, xmm0, [ARG + _aesarg_in + 16*3]
vmovdqa [ARG + _aesarg_in + 16*0], xmm1
vmovdqa [ARG + _aesarg_in + 16*1], xmm2
vmovdqa [ARG + _aesarg_in + 16*2], xmm3
vmovdqa [ARG + _aesarg_in + 16*3], xmm4
vpaddq xmm5, xmm0, [ARG + _aesarg_out + 16*0]
vpaddq xmm6, xmm0, [ARG + _aesarg_out + 16*1]
vpaddq xmm7, xmm0, [ARG + _aesarg_out + 16*2]
vpaddq xmm8, xmm0, [ARG + _aesarg_out + 16*3]
vmovdqa [ARG + _aesarg_out + 16*0], xmm5
vmovdqa [ARG + _aesarg_out + 16*1], xmm6
vmovdqa [ARG + _aesarg_out + 16*2], xmm7
vmovdqa [ARG + _aesarg_out + 16*3], xmm8
;; XMMs are saved at a higher level
mov rbp, [GPR_SAVE_AREA + 8*0]
add rsp, STACK_size
ret
| lukego/intel-ipsec | code/avx/aes_cbc_enc_128_x8.asm | Assembly | bsd-3-clause | 16,715 |
; fasm example of using the C library in Unix systems
; compile the source with commands like:
; fasm libcdemo.asm libcdemo.o
; gcc libcdemo.o -o libcdemo
; strip libcdemo
format ELF
include 'ccall.inc'
section '.text' executable
public main
extrn printf
extrn getpid
main:
call getpid
ccall printf, msg,eax
ret
section '.data' writeable
msg db "Current process ID is %d.",0xA,0
| gunmetal313/ExePacker | fasm/fasm17139_linux/examples/libcdemo/libcdemo.asm | Assembly | bsd-3-clause | 402 |
//******************************************************************************
//*
//* FULLNAME: Single-Chip Microcontroller Real-Time Operating System
//*
//* NICKNAME: scmRTOS
//*
//* PROCESSOR: ADSP-BF533 (Analog Devices)
//*
//* TOOLKIT: VDSP (Analog Devices)
//*
//* PURPOSE: Target Dependent Low-Level Stuff
//*
//* Version: v5.2.0
//*
//*
//* Copyright (c) 2003-2021, scmRTOS Team
//*
//* 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.
//*
//* =================================================================
//* Project sources: https://github.com/scmrtos/scmrtos
//* Documentation: https://github.com/scmrtos/scmrtos/wiki/Documentation
//* Wiki: https://github.com/scmrtos/scmrtos/wiki
//* Sample projects: https://github.com/scmrtos/scmrtos-sample-projects
//* =================================================================
//*
//******************************************************************************
//* Blackfin/CrossCore Embedded Studio port by Evgeny Nesterov, Copyright (c) 2012-2021
#include "scmRTOS_TARGET_CFG.h"
.global _os_start
.global _context_switcher_isr
.global _caller
.extern _os_context_switch_hook
.extern ldf_stack_end;
.extern __cec_int_dispatcher
.section program;
.align 2;
//------------------------------------------------------------------------------
_os_start:
sp = r0; // load highest priority process stack pointer
nop; nop; //
p0.l = lo(IMASK); //
p0.h = hi(IMASK); //
r1 = [sp++]; // enable interrupts at CEC level
[p0] = r1; //
p0 = 43*4; // emulate 43 pops
sp = sp + p0; //
//
rets = [sp++]; // load process's main function address
p0 = 0x20; //
sp = sp + p0;
rts; // go to the process's application code
_os_start.end:
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
_context_switcher_isr:
//--------------------------------------------------------------------------
//
// Save return address
//
[--sp] = reti;
//--------------------------------------------------------------------------
//
// Save context
//
[--sp] = rets;
[--sp] = astat;
[--sp] = fp;
[--sp] = (r7:0,p5:0);
[--sp] = i0;
[--sp] = i1;
[--sp] = i2;
[--sp] = i3;
[--sp] = b0;
[--sp] = b1;
[--sp] = b2;
[--sp] = b3;
[--sp] = l0;
[--sp] = l1;
[--sp] = l2;
[--sp] = l3;
[--sp] = m0;
[--sp] = m1;
[--sp] = m2;
[--sp] = m3;
[--sp] = a0.x;
[--sp] = a0.w;
[--sp] = a1.x;
[--sp] = a1.w;
[--sp] = lc0;
[--sp] = lc1;
[--sp] = lt0;
[--sp] = lt1;
[--sp] = lb0;
[--sp] = lb1;
//--------------------------------------------------------------------------
//
// Switch stack pointers and manage interrupt enable status
//
p5.l = lo(IMASK); // save IMASK value
p5.h = hi(IMASK); // (global interrupts enable state)
r7 = [p5]; //
[--sp] = r7;
r0 = sp;
sp += -12; // reserve space for calling function incoming parameters
call _os_context_switch_hook;
sp += 12; // restore space for calling function incoming parameters
sp = r0;
nop; nop; nop; nop;
r0 = [sp++]; // load IMASK value
[p5] = r0; // (global interrupts enable state)
//--------------------------------------------------------------------------
//
// Restore context
//
lb1 = [sp++];
lb0 = [sp++];
lt1 = [sp++];
lt0 = [sp++];
lc1 = [sp++];
lc0 = [sp++];
a1.w = [sp++];
a1.x = [sp++];
a0.w = [sp++];
a0.x = [sp++];
m3 = [sp++];
m2 = [sp++];
m1 = [sp++];
m0 = [sp++];
l3 = [sp++];
l2 = [sp++];
l1 = [sp++];
l0 = [sp++];
b3 = [sp++];
b2 = [sp++];
b1 = [sp++];
b0 = [sp++];
i3 = [sp++];
i2 = [sp++];
i1 = [sp++];
i0 = [sp++];
(r7:0,
p5:0) = [sp++];
fp = [sp++];
astat = [sp++];
rets = [sp++];
//--------------------------------------------------------------------------
//
// Restore return address and go to the process's application code
//
reti = [sp++];
rts;//return subroutine
._context_switcher_isr.end:
//------------------------------------------------------------------------------
_caller:
[--sp]=R1;
R0.L = LO(__cec_int_dispatcher);
R0.H = HI(__cec_int_dispatcher);
R1 = 0x42;//offset return adrress
R0 = R0+R1;
R1 = [sp++];
rts;
_caller.end:
| scmrtos/scmrtos | port/blackfin/cces/bf6xx/os_target_a.asm | Assembly | mit | 6,986 |
global _start
section .data
align 16
myquad:
dq 0xad0000ceffffadad
mydword:
dd 0xcafebac0
shift1:
dq 0x07
shift2:
dq -4
%include "header.inc"
movq mm0, [myquad]
movq mm1, [myquad]
movq mm2, [myquad]
movq mm6, [myquad]
psrlw mm0, [shift1]
psrlw mm1, [mydword]
psrlw mm2, [shift2]
psrlw mm6, 0x5
%include "footer.inc"
| nimdavtanke/www | virt.nimda.pro/tests/nasm/psrlw.asm | Assembly | mit | 342 |
/*
* Copyright © <2010>, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
* http://www.opensource.org/licenses/eclipse-1.0.php.
*
*/
// Module name: saveNV12_16x4.asm
//
// Save a NV12 16x4 block
//
//----------------------------------------------------------------
// Symbols need to be defined before including this module
//
// Source region in :ud
// SRC_YD: SRC_YD Base=rxx ElementSize=4 SrcRegion=REGION(8,1) Type=ud // 2 GRFs
// SRC_UD: SRC_UD Base=rxx ElementSize=4 SrcRegion=REGION(8,1) Type=ud // 1 GRF
//
// Binding table index:
// BI_DEST_Y: Binding table index of Y surface
// BI_DEST_UV: Binding table index of UV surface (NV12)
//
//----------------------------------------------------------------
#if defined(_DEBUG)
mov (1) EntrySignatureC:w 0xDDD5:w
#endif
mov (2) MSGSRC.0<1>:ud ORIX_TOP<2;2,1>:w // Block origin
mov (1) MSGSRC.2<1>:ud 0x0003000F:ud // Block width and height (16x4)
// Pack Y
mov (16) MSGPAYLOADD(0)<1> SRC_YD(0) // Compressed inst
send (8) NULLREG MSGHDR MSGSRC<8;8,1>:ud DAPWRITE MSG_LEN(2)+DWBWMSGDSC+BI_DEST_Y // Write 2 GRFs
asr (1) MSGSRC.1:ud MSGSRC.1:ud 1:w // NV12 U+V block origin y = half of Y comp
mov (1) MSGSRC.2<1>:ud 0x0001000F:ud // NV12 U+V block width and height (16x2)
// Pack U and V
// mov (16) MSGPAYLOADB(0,0)<2> SRC_UB(0,0)
// mov (16) MSGPAYLOADB(0,1)<2> SRC_VB(0,0)
mov (8) MSGPAYLOADD(0,0)<1> SRC_UD(0)
send (8) NULLREG MSGHDR MSGSRC<8;8,1>:ud DAPWRITE MSG_LEN(1)+DWBWMSGDSC+BI_DEST_UV // Write 1 GRF
// End of saveNV12_16x4.asm
| halleyzhao/libva-intel-driver-fdo | src/shaders/h264/ildb/saveNV12_16x4.asm | Assembly | mit | 1,771 |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
%include "vpx_ports/x86_abi_support.asm"
;void vp8_post_proc_down_and_across_xmm
;(
; unsigned char *src_ptr,
; unsigned char *dst_ptr,
; int src_pixels_per_line,
; int dst_pixels_per_line,
; int rows,
; int cols,
; int flimit
;)
global sym(vp8_post_proc_down_and_across_xmm)
sym(vp8_post_proc_down_and_across_xmm):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 7
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
%if ABI_IS_32BIT=1 && CONFIG_PIC=1
ALIGN_STACK 16, rax
; move the global rd onto the stack, since we don't have enough registers
; to do PIC addressing
movdqa xmm0, [GLOBAL(rd42)]
sub rsp, 16
movdqa [rsp], xmm0
%define RD42 [rsp]
%else
%define RD42 [GLOBAL(rd42)]
%endif
movd xmm2, dword ptr arg(6) ;flimit
punpcklwd xmm2, xmm2
punpckldq xmm2, xmm2
punpcklqdq xmm2, xmm2
mov rsi, arg(0) ;src_ptr
mov rdi, arg(1) ;dst_ptr
movsxd rcx, DWORD PTR arg(4) ;rows
movsxd rax, DWORD PTR arg(2) ;src_pixels_per_line ; destination pitch?
pxor xmm0, xmm0 ; mm0 = 00000000
.nextrow:
xor rdx, rdx ; clear out rdx for use as loop counter
.nextcol:
movq xmm3, QWORD PTR [rsi] ; mm4 = r0 p0..p7
punpcklbw xmm3, xmm0 ; mm3 = p0..p3
movdqa xmm1, xmm3 ; mm1 = p0..p3
psllw xmm3, 2 ;
movq xmm5, QWORD PTR [rsi + rax] ; mm4 = r1 p0..p7
punpcklbw xmm5, xmm0 ; mm5 = r1 p0..p3
paddusw xmm3, xmm5 ; mm3 += mm6
; thresholding
movdqa xmm7, xmm1 ; mm7 = r0 p0..p3
psubusw xmm7, xmm5 ; mm7 = r0 p0..p3 - r1 p0..p3
psubusw xmm5, xmm1 ; mm5 = r1 p0..p3 - r0 p0..p3
paddusw xmm7, xmm5 ; mm7 = abs(r0 p0..p3 - r1 p0..p3)
pcmpgtw xmm7, xmm2
movq xmm5, QWORD PTR [rsi + 2*rax] ; mm4 = r2 p0..p7
punpcklbw xmm5, xmm0 ; mm5 = r2 p0..p3
paddusw xmm3, xmm5 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
psubusw xmm6, xmm5 ; mm6 = r0 p0..p3 - r2 p0..p3
psubusw xmm5, xmm1 ; mm5 = r2 p0..p3 - r2 p0..p3
paddusw xmm6, xmm5 ; mm6 = abs(r0 p0..p3 - r2 p0..p3)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
neg rax
movq xmm5, QWORD PTR [rsi+2*rax] ; mm4 = r-2 p0..p7
punpcklbw xmm5, xmm0 ; mm5 = r-2 p0..p3
paddusw xmm3, xmm5 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
psubusw xmm6, xmm5 ; mm6 = p0..p3 - r-2 p0..p3
psubusw xmm5, xmm1 ; mm5 = r-2 p0..p3 - p0..p3
paddusw xmm6, xmm5 ; mm6 = abs(r0 p0..p3 - r-2 p0..p3)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
movq xmm4, QWORD PTR [rsi+rax] ; mm4 = r-1 p0..p7
punpcklbw xmm4, xmm0 ; mm4 = r-1 p0..p3
paddusw xmm3, xmm4 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = r0 p0..p3
psubusw xmm6, xmm4 ; mm6 = p0..p3 - r-2 p0..p3
psubusw xmm4, xmm1 ; mm5 = r-1 p0..p3 - p0..p3
paddusw xmm6, xmm4 ; mm6 = abs(r0 p0..p3 - r-1 p0..p3)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
paddusw xmm3, RD42 ; mm3 += round value
psraw xmm3, 3 ; mm3 /= 8
pand xmm1, xmm7 ; mm1 select vals > thresh from source
pandn xmm7, xmm3 ; mm7 select vals < thresh from blurred result
paddusw xmm1, xmm7 ; combination
packuswb xmm1, xmm0 ; pack to bytes
movq QWORD PTR [rdi], xmm1 ;
neg rax ; pitch is positive
add rsi, 8
add rdi, 8
add rdx, 8
cmp edx, dword arg(5) ;cols
jl .nextcol
; done with the all cols, start the across filtering in place
sub rsi, rdx
sub rdi, rdx
xor rdx, rdx
movq mm0, QWORD PTR [rdi-8];
.acrossnextcol:
movq xmm7, QWORD PTR [rdi +rdx -2]
movd xmm4, DWORD PTR [rdi +rdx +6]
pslldq xmm4, 8
por xmm4, xmm7
movdqa xmm3, xmm4
psrldq xmm3, 2
punpcklbw xmm3, xmm0 ; mm3 = p0..p3
movdqa xmm1, xmm3 ; mm1 = p0..p3
psllw xmm3, 2
movdqa xmm5, xmm4
psrldq xmm5, 3
punpcklbw xmm5, xmm0 ; mm5 = p1..p4
paddusw xmm3, xmm5 ; mm3 += mm6
; thresholding
movdqa xmm7, xmm1 ; mm7 = p0..p3
psubusw xmm7, xmm5 ; mm7 = p0..p3 - p1..p4
psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
paddusw xmm7, xmm5 ; mm7 = abs(p0..p3 - p1..p4)
pcmpgtw xmm7, xmm2
movdqa xmm5, xmm4
psrldq xmm5, 4
punpcklbw xmm5, xmm0 ; mm5 = p2..p5
paddusw xmm3, xmm5 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = p0..p3
psubusw xmm6, xmm5 ; mm6 = p0..p3 - p1..p4
psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
paddusw xmm6, xmm5 ; mm6 = abs(p0..p3 - p1..p4)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
movdqa xmm5, xmm4 ; mm5 = p-2..p5
punpcklbw xmm5, xmm0 ; mm5 = p-2..p1
paddusw xmm3, xmm5 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = p0..p3
psubusw xmm6, xmm5 ; mm6 = p0..p3 - p1..p4
psubusw xmm5, xmm1 ; mm5 = p1..p4 - p0..p3
paddusw xmm6, xmm5 ; mm6 = abs(p0..p3 - p1..p4)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
psrldq xmm4, 1 ; mm4 = p-1..p5
punpcklbw xmm4, xmm0 ; mm4 = p-1..p2
paddusw xmm3, xmm4 ; mm3 += mm5
; thresholding
movdqa xmm6, xmm1 ; mm6 = p0..p3
psubusw xmm6, xmm4 ; mm6 = p0..p3 - p1..p4
psubusw xmm4, xmm1 ; mm5 = p1..p4 - p0..p3
paddusw xmm6, xmm4 ; mm6 = abs(p0..p3 - p1..p4)
pcmpgtw xmm6, xmm2
por xmm7, xmm6 ; accumulate thresholds
paddusw xmm3, RD42 ; mm3 += round value
psraw xmm3, 3 ; mm3 /= 8
pand xmm1, xmm7 ; mm1 select vals > thresh from source
pandn xmm7, xmm3 ; mm7 select vals < thresh from blurred result
paddusw xmm1, xmm7 ; combination
packuswb xmm1, xmm0 ; pack to bytes
movq QWORD PTR [rdi+rdx-8], mm0 ; store previous four bytes
movdq2q mm0, xmm1
add rdx, 8
cmp edx, dword arg(5) ;cols
jl .acrossnextcol;
; last 8 pixels
movq QWORD PTR [rdi+rdx-8], mm0
; done with this rwo
add rsi,rax ; next line
mov eax, dword arg(3) ;dst_pixels_per_line ; destination pitch?
add rdi,rax ; next destination
mov eax, dword arg(2) ;src_pixels_per_line ; destination pitch?
dec rcx ; decrement count
jnz .nextrow ; next row
%if ABI_IS_32BIT=1 && CONFIG_PIC=1
add rsp,16
pop rsp
%endif
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
%undef RD42
;void vp8_mbpost_proc_down_xmm(unsigned char *dst,
; int pitch, int rows, int cols,int flimit)
extern sym(vp8_rv)
global sym(vp8_mbpost_proc_down_xmm)
sym(vp8_mbpost_proc_down_xmm):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
ALIGN_STACK 16, rax
sub rsp, 128+16
; unsigned char d[16][8] at [rsp]
; create flimit2 at [rsp+128]
mov eax, dword ptr arg(4) ;flimit
mov [rsp+128], eax
mov [rsp+128+4], eax
mov [rsp+128+8], eax
mov [rsp+128+12], eax
%define flimit4 [rsp+128]
%if ABI_IS_32BIT=0
lea r8, [GLOBAL(sym(vp8_rv))]
%endif
;rows +=8;
add dword arg(2), 8
;for(c=0; c<cols; c+=8)
.loop_col:
mov rsi, arg(0) ; s
pxor xmm0, xmm0 ;
movsxd rax, dword ptr arg(1) ;pitch ;
neg rax ; rax = -pitch
lea rsi, [rsi + rax*8]; ; rdi = s[-pitch*8]
neg rax
pxor xmm5, xmm5
pxor xmm6, xmm6 ;
pxor xmm7, xmm7 ;
mov rdi, rsi
mov rcx, 15 ;
.loop_initvar:
movq xmm1, QWORD PTR [rdi];
punpcklbw xmm1, xmm0 ;
paddw xmm5, xmm1 ;
pmullw xmm1, xmm1 ;
movdqa xmm2, xmm1 ;
punpcklwd xmm1, xmm0 ;
punpckhwd xmm2, xmm0 ;
paddd xmm6, xmm1 ;
paddd xmm7, xmm2 ;
lea rdi, [rdi+rax] ;
dec rcx
jne .loop_initvar
;save the var and sum
xor rdx, rdx
.loop_row:
movq xmm1, QWORD PTR [rsi] ; [s-pitch*8]
movq xmm2, QWORD PTR [rdi] ; [s+pitch*7]
punpcklbw xmm1, xmm0
punpcklbw xmm2, xmm0
paddw xmm5, xmm2
psubw xmm5, xmm1
pmullw xmm2, xmm2
movdqa xmm4, xmm2
punpcklwd xmm2, xmm0
punpckhwd xmm4, xmm0
paddd xmm6, xmm2
paddd xmm7, xmm4
pmullw xmm1, xmm1
movdqa xmm2, xmm1
punpcklwd xmm1, xmm0
psubd xmm6, xmm1
punpckhwd xmm2, xmm0
psubd xmm7, xmm2
movdqa xmm3, xmm6
pslld xmm3, 4
psubd xmm3, xmm6
movdqa xmm1, xmm5
movdqa xmm4, xmm5
pmullw xmm1, xmm1
pmulhw xmm4, xmm4
movdqa xmm2, xmm1
punpcklwd xmm1, xmm4
punpckhwd xmm2, xmm4
movdqa xmm4, xmm7
pslld xmm4, 4
psubd xmm4, xmm7
psubd xmm3, xmm1
psubd xmm4, xmm2
psubd xmm3, flimit4
psubd xmm4, flimit4
psrad xmm3, 31
psrad xmm4, 31
packssdw xmm3, xmm4
packsswb xmm3, xmm0
movq xmm1, QWORD PTR [rsi+rax*8]
movq xmm2, xmm1
punpcklbw xmm1, xmm0
paddw xmm1, xmm5
mov rcx, rdx
and rcx, 127
%if ABI_IS_32BIT=1 && CONFIG_PIC=1
push rax
lea rax, [GLOBAL(sym(vp8_rv))]
movdqu xmm4, [rax + rcx*2] ;vp8_rv[rcx*2]
pop rax
%elif ABI_IS_32BIT=0
movdqu xmm4, [r8 + rcx*2] ;vp8_rv[rcx*2]
%else
movdqu xmm4, [sym(vp8_rv) + rcx*2]
%endif
paddw xmm1, xmm4
;paddw xmm1, eight8s
psraw xmm1, 4
packuswb xmm1, xmm0
pand xmm1, xmm3
pandn xmm3, xmm2
por xmm1, xmm3
and rcx, 15
movq QWORD PTR [rsp + rcx*8], xmm1 ;d[rcx*8]
mov rcx, rdx
sub rcx, 8
and rcx, 15
movq mm0, [rsp + rcx*8] ;d[rcx*8]
movq [rsi], mm0
lea rsi, [rsi+rax]
lea rdi, [rdi+rax]
add rdx, 1
cmp edx, dword arg(2) ;rows
jl .loop_row
add dword arg(0), 8 ; s += 8
sub dword arg(3), 8 ; cols -= 8
cmp dword arg(3), 0
jg .loop_col
add rsp, 128+16
pop rsp
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
%undef flimit4
;void vp8_mbpost_proc_across_ip_xmm(unsigned char *src,
; int pitch, int rows, int cols,int flimit)
global sym(vp8_mbpost_proc_across_ip_xmm)
sym(vp8_mbpost_proc_across_ip_xmm):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
ALIGN_STACK 16, rax
sub rsp, 16
; create flimit4 at [rsp]
mov eax, dword ptr arg(4) ;flimit
mov [rsp], eax
mov [rsp+4], eax
mov [rsp+8], eax
mov [rsp+12], eax
%define flimit4 [rsp]
;for(r=0;r<rows;r++)
.ip_row_loop:
xor rdx, rdx ;sumsq=0;
xor rcx, rcx ;sum=0;
mov rsi, arg(0); s
mov rdi, -8
.ip_var_loop:
;for(i=-8;i<=6;i++)
;{
; sumsq += s[i]*s[i];
; sum += s[i];
;}
movzx eax, byte [rsi+rdi]
add ecx, eax
mul al
add edx, eax
add rdi, 1
cmp rdi, 6
jle .ip_var_loop
;mov rax, sumsq
;movd xmm7, rax
movd xmm7, edx
;mov rax, sum
;movd xmm6, rax
movd xmm6, ecx
mov rsi, arg(0) ;s
xor rcx, rcx
movsxd rdx, dword arg(3) ;cols
add rdx, 8
pxor mm0, mm0
pxor mm1, mm1
pxor xmm0, xmm0
.nextcol4:
movd xmm1, DWORD PTR [rsi+rcx-8] ; -8 -7 -6 -5
movd xmm2, DWORD PTR [rsi+rcx+7] ; +7 +8 +9 +10
punpcklbw xmm1, xmm0 ; expanding
punpcklbw xmm2, xmm0 ; expanding
punpcklwd xmm1, xmm0 ; expanding to dwords
punpcklwd xmm2, xmm0 ; expanding to dwords
psubd xmm2, xmm1 ; 7--8 8--7 9--6 10--5
paddd xmm1, xmm1 ; -8*2 -7*2 -6*2 -5*2
paddd xmm1, xmm2 ; 7+-8 8+-7 9+-6 10+-5
pmaddwd xmm1, xmm2 ; squared of 7+-8 8+-7 9+-6 10+-5
paddd xmm6, xmm2
paddd xmm7, xmm1
pshufd xmm6, xmm6, 0 ; duplicate the last ones
pshufd xmm7, xmm7, 0 ; duplicate the last ones
psrldq xmm1, 4 ; 8--7 9--6 10--5 0000
psrldq xmm2, 4 ; 8--7 9--6 10--5 0000
pshufd xmm3, xmm1, 3 ; 0000 8--7 8--7 8--7 squared
pshufd xmm4, xmm2, 3 ; 0000 8--7 8--7 8--7 squared
paddd xmm6, xmm4
paddd xmm7, xmm3
pshufd xmm3, xmm1, 01011111b ; 0000 0000 9--6 9--6 squared
pshufd xmm4, xmm2, 01011111b ; 0000 0000 9--6 9--6 squared
paddd xmm7, xmm3
paddd xmm6, xmm4
pshufd xmm3, xmm1, 10111111b ; 0000 0000 8--7 8--7 squared
pshufd xmm4, xmm2, 10111111b ; 0000 0000 8--7 8--7 squared
paddd xmm7, xmm3
paddd xmm6, xmm4
movdqa xmm3, xmm6
pmaddwd xmm3, xmm3
movdqa xmm5, xmm7
pslld xmm5, 4
psubd xmm5, xmm7
psubd xmm5, xmm3
psubd xmm5, flimit4
psrad xmm5, 31
packssdw xmm5, xmm0
packsswb xmm5, xmm0
movd xmm1, DWORD PTR [rsi+rcx]
movq xmm2, xmm1
punpcklbw xmm1, xmm0
punpcklwd xmm1, xmm0
paddd xmm1, xmm6
paddd xmm1, [GLOBAL(four8s)]
psrad xmm1, 4
packssdw xmm1, xmm0
packuswb xmm1, xmm0
pand xmm1, xmm5
pandn xmm5, xmm2
por xmm5, xmm1
movd [rsi+rcx-8], mm0
movq mm0, mm1
movdq2q mm1, xmm5
psrldq xmm7, 12
psrldq xmm6, 12
add rcx, 4
cmp rcx, rdx
jl .nextcol4
;s+=pitch;
movsxd rax, dword arg(1)
add arg(0), rax
sub dword arg(2), 1 ;rows-=1
cmp dword arg(2), 0
jg .ip_row_loop
add rsp, 16
pop rsp
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
%undef flimit4
;void vp8_plane_add_noise_wmt (unsigned char *Start, unsigned char *noise,
; unsigned char blackclamp[16],
; unsigned char whiteclamp[16],
; unsigned char bothclamp[16],
; unsigned int Width, unsigned int Height, int Pitch)
extern sym(rand)
global sym(vp8_plane_add_noise_wmt)
sym(vp8_plane_add_noise_wmt):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 8
GET_GOT rbx
push rsi
push rdi
; end prolog
.addnoise_loop:
call sym(rand) WRT_PLT
mov rcx, arg(1) ;noise
and rax, 0xff
add rcx, rax
; we rely on the fact that the clamping vectors are stored contiguously
; in black/white/both order. Note that we have to reload this here because
; rdx could be trashed by rand()
mov rdx, arg(2) ; blackclamp
mov rdi, rcx
movsxd rcx, dword arg(5) ;[Width]
mov rsi, arg(0) ;Pos
xor rax,rax
.addnoise_nextset:
movdqu xmm1,[rsi+rax] ; get the source
psubusb xmm1, [rdx] ;blackclamp ; clamp both sides so we don't outrange adding noise
paddusb xmm1, [rdx+32] ;bothclamp
psubusb xmm1, [rdx+16] ;whiteclamp
movdqu xmm2,[rdi+rax] ; get the noise for this line
paddb xmm1,xmm2 ; add it in
movdqu [rsi+rax],xmm1 ; store the result
add rax,16 ; move to the next line
cmp rax, rcx
jl .addnoise_nextset
movsxd rax, dword arg(7) ; Pitch
add arg(0), rax ; Start += Pitch
sub dword arg(6), 1 ; Height -= 1
jg .addnoise_loop
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
SECTION_RODATA
align 16
rd42:
times 8 dw 0x04
four8s:
times 4 dd 8
| rikaunite/gst-opera_libvpx | vp8/common/x86/postproc_sse2.asm | Assembly | bsd-3-clause | 22,871 |
;_____________________________________________________________________________
; boot12.asm FAT12 bootstrap for real mode image or loader
; Version 1.0, Jul 5, 1999
; Sample code
; by John S. Fine johnfine@erols.com
; I do not place any restrictions on your use of this source code
; I do not provide any warranty of the correctness of this source code
;_____________________________________________________________________________
%define ROOT_SEG 0x60
%define FAT_SEG 0x800
%define IMAGE_SEG 0xA00
%if ROOT_SEG & 31
%error "ROOT_SEG must be divisible by 0x20"
%endif
%if ROOT_SEG > 0xC00
%error "Root directory must fit within first 64Kb"
%endif
%if FAT_SEG & 31
%error "FAT_SEG must be divisible by 0x20"
%endif
%if FAT_SEG > 0xE80
%error "FAT must fit within first 64Kb"
%endif
%if IMAGE_SEG & 31
%error "IMAGE_SEG must be divisible by 0x20"
%endif
; The following %define directives declare the parts of the FAT12 "DOS BOOT
; RECORD" that are used by this code, based on BP being set to 7C00.
;
%define sc_p_clu bp+0Dh ;byte Sectors per cluster
%define sc_b4_fat bp+0Eh ;word Sectors (in partition) before FAT
%define fats bp+10h ;byte Number of FATs
%define dir_ent bp+11h ;word Number of root directory entries
%define sc_p_fat bp+16h ;word Sectors per FAT
%define sc_p_trk bp+18h ;word Sectors per track
%define heads bp+1Ah ;word Number of heads
%define sc_b4_prt bp+1Ch ;dword Sectors before partition
%define drive bp+24h ;byte Drive number
org 0x7C00
entry:
jmp short begin
nop
; Skip over the data portion of the "DOS BOOT RECORD". The install method
; must merge the code from this ASM with the data put in the boot record
; by the FAT12 formatter.
;
times 0x3B db 0
begin:
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, 0x7C00
mov bp, sp
mov [drive], dl ;Drive number
mov al, [fats] ;Number of FATs
mul word [sc_p_fat] ; * Sectors per FAT
add ax, [sc_b4_fat] ; + Sectors before FAT
;AX = Sector of Root directory
mov si, [dir_ent] ;Max root directory entries
mov cl, 4
dec si
shr si, cl
inc si ;SI = Length of root in sectors
mov di, ROOT_SEG/32 ;Buffer (paragraph / 32)
call read_16 ;Read root directory
mov si, smsg1
call showmsg
push ax ;Sector of cluster two
%define sc_clu2 bp-2 ;Later access to the word just pushed is via bp
mov dx, [dir_ent] ;Number of directory entries
push ds
pop es
mov di, ROOT_SEG*16
search:
dec dx ;Any more directory entries?
js error1 ;No
mov si, filename ;Name we are searching for
mov cx, 11 ;11 characters long
lea ax, [di+0x20] ;Precompute next entry address
push ax
repe cmpsb ;Compare
pop di
jnz search ;Repeat until match
push word [di-6] ;Starting cluster number
mov ax, [sc_b4_fat] ;Sector number of FAT
mov si, [sc_p_fat] ;Length of FAT
mov di, FAT_SEG/32 ;Buffer (paragraph / 32)
call read_16 ;Read FAT
mov si, smsg2
call showmsg
next:
pop bx ;Cluster number
mov si, bx ;First cluster in this sequence
mov ax, bx ;Last cluster in this sequence
.0:
cmp bx, 0xFF8 ;End of file?
jae .2 ;Yes
inc ax ;Last cluster plus one in sequence
;Look in FAT for next cluster
mov di, bx ;Cluster number
rcr bx, 1 ;1.5 byte entry per cluster
;bx = 0x8000 + cluster/2
;c-bit set for odd clusters
mov bx, [bx+di+FAT_SEG*16-0x8000]
jnc .1
shr bx, 1
shr bx, 1
shr bx, 1
shr bx, 1
.1: and bh, 0xF
cmp ax, bx ;Is the next one contiguous?
je .0 ;Yes: look further ahead
.2: sub ax, si ;How many contiguous in this sequence?
jz eof ;None, must be done.
push bx ;Save next (eof or discontiguous) cluster
mov bl, [sc_p_clu] ;Sectors per cluster
mov bh, 0 ; as a word
mul bx ;Length of sequence in sectors
.3: mov di, IMAGE_SEG/32 ;Destination (paragraph / 32)
add [.3+1], ax ;Precompute next destination
xchg ax, si ;AX = starting cluster ;SI = length in sectors
dec ax
dec ax ;Starting cluster minus two
mul bx ; * sectors per cluster
add ax, [sc_clu2] ; + sector number of cluster two
adc dl, dh ;Allow 24-bit result
call read_32 ;Read it
jmp short next ;Look for more
eof:
mov si, smsg3
call showmsg
jmp IMAGE_SEG:0x0000
error1: mov si, errmsg1
jmp j2
error2: mov si, errmsg2
j2:
mov ax, 0xE0D ;Start message with CR
mov bx, 7
.1: int 10h
lodsb
test al, al
jnz .1
xor ah, ah
int 16h ;Wait for a key
int 19h ;Try to reboot
read_16:
xor dx, dx
read_32:
;
; Input:
; dx:ax = sector within partition
; si = sector count
; di = destination segment / 32
;
; The sector number is converted from a partition-relative to a whole-disk
; (LBN) value, and then converted to CHS form, and then the sectors are read
; into (di*32):0.
;
; Output:
; dx:ax updated (sector count added)
; di updated (sector count added)
; si = 0
; bp, ds preserved
; bx, cx, es modified
.1: push dx ;(high) relative sector
push ax ;(low) relative sector
add ax, [sc_b4_prt] ;Convert to LBN
adc dx, [sc_b4_prt+2]
mov bx, [sc_p_trk] ;Sectors per track
div bx ;AX = track ;DX = sector-1
sub bx, dx ;Sectors remaining, this track
cmp bx, si ;More than we want?
jbe .2 ;No
mov bx, si ;Yes: Transfer just what we want
.2: inc dx ;Sector number
mov cx, dx ;CL = sector ;CH = 0
cwd ;(This supports up to 32767 tracks
div word [heads] ;Track number / Number of heads
mov dh, dl ;DH = head
xchg ch, al ;CH = (low) cylinder ;AL=0
ror ah, 1 ;rotate (high) cylinder
ror ah, 1
add cl, ah ;CL = combine: sector, (high) cylinder
sub ax, di
and ax, byte 0x7F ;AX = sectors to next 64Kb boundary
jz .3 ;On a 64Kb boundary already
cmp ax, bx ;More than we want?
jbe .4 ;No
.3: xchg ax, bx ;Yes: Transfer just what we want
.4: push ax ;Save length
mov bx, di ;Compute destination seg
push cx
mov cl, 5
shl bx, cl
pop cx
mov es, bx
xor bx, bx ;ES:BX = address
mov dl, [drive] ;DL = Drive number
mov ah, 2 ;AH = Read command
int 13h ;Do it
jc error2
pop bx ;Length
pop ax ;(low) relative sector
pop dx ;(high) relative sector
add ax, bx ;Update relative sector
adc dl, dh
add di, bx ;Update destination
sub si, bx ;Update count
jnz .1 ;Read some more
ret
showmsg:
push ax
push bx
mov ax, 0xE0D ;Start message with CR
mov bx, 7
.1: int 10h
lodsb
test al, al
jnz .1
xor ah, ah
int 16h ;Wait for a key
pop bx
pop ax
ret
errmsg1 db 10, "E1", 10, 0
errmsg2 db 10, "E2", 10, 0
smsg1 db 10, "S1", 10, 0
smsg2 db 10, "Fat Read", 10, 0
smsg3 db 10, "Boot1 jmp", 10, 0
errmsg db 10,"Error Executing FAT12 bootsector",13
db 10,"Press any key to reboot",13,10,0
size equ $ - entry
%if size+11+2 > 512
%error "code is too large for boot sector"
%endif
times (512 - size - 11 - 2) db 0
filename db "BOOT1 BIN" ;11 byte name
db 0x55, 0xAA ;2 byte boot signature
| priyananda/student | bachelors/sem6/operating_systems/Helix/boot/boot0.asm | Assembly | mit | 6,809 |
;*******************************************************
;
; Stage2.asm
; Stage2 Bootloader
;
; OS Development Series
;*******************************************************
bits 16
; Remember the memory map-- 0x500 through 0x7bff is unused above the BIOS data area.
; We are loaded at 0x500 (0x50:0)
org 0x500
jmp main ; go to start
;*******************************************************
; Preprocessor directives
;*******************************************************
%include "stdio.inc" ; basic i/o routines
%include "Gdt.inc" ; Gdt routines
%include "A20.inc"
;*******************************************************
; Data Section
;*******************************************************
LoadingMsg db "Preparing to load operating system...", 0x0D, 0x0A, 0x00
;*******************************************************
; STAGE 2 ENTRY POINT
;
; -Store BIOS information
; -Load Kernel
; -Install GDT; go into protected mode (pmode)
; -Jump to Stage 3
;*******************************************************
main:
;-------------------------------;
; Setup segments and stack ;
;-------------------------------;
cli ; clear interrupts
xor ax, ax ; null segments
mov ds, ax
mov es, ax
mov ax, 0x9000 ; stack begins at 0x9000-0xffff
mov ss, ax
mov sp, 0xFFFF
sti ; enable interrupts
;-------------------------------;
; Print loading message ;
;-------------------------------;
mov si, LoadingMsg
call Puts16
;-------------------------------;
; Install our GDT ;
;-------------------------------;
call InstallGDT ; install our GDT
;-------------------------------;
; Enable A20 ;
;-------------------------------;
call EnableA20_KKbrd_Out
;-------------------------------;
; Go into pmode ;
;-------------------------------;
cli ; clear interrupts
mov eax, cr0 ; set bit 0 in cr0--enter pmode
or eax, 1
mov cr0, eax
jmp CODE_DESC:Stage3 ; far jump to fix CS.
; Note: Do NOT re-enable interrupts! Doing so will triple fault!
; We will fix this in Stage 3.
;******************************************************
; ENTRY POINT FOR STAGE 3
;******************************************************
bits 32
Stage3:
;-------------------------------;
; Set registers ;
;-------------------------------;
mov ax, DATA_DESC ; set data segments to data selector (0x10)
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 90000h ; stack begins from 90000h
cli
hlt
| ClaytonHunt/TonOS | SysBoot/Stage2/Pre-Source Control/stage2_3.asm | Assembly | mit | 2,575 |
;===============================================================================
; Copyright 2014-2020 Intel Corporation
;
; 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.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Message block processing according to SHA256
;
; Content:
; UpdateSHA256
;
;
%include "asmdefs.inc"
%include "ia_emm.inc"
%include "pcpvariant.inc"
%if (_ENABLE_ALG_SHA256_)
%if (_SHA_NI_ENABLING_ == _FEATURE_OFF_) || (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_)
%if (_IPP >= _IPP_G9)
%xdefine XMM_SHUFB_BSWAP xmm6
%xdefine W0 xmm0
%xdefine W4 xmm1
%xdefine W8 xmm2
%xdefine W12 xmm3
%xdefine SIG1 xmm4
%xdefine SIG0 xmm5
%xdefine X xmm6
%xdefine W xmm7
%xdefine regTbl ebx
;; we are considering x, y, z are polynomials over GF(2)
;; & - multiplication
;; ^ - additive
;; operations
;;
;; Chj(x,y,z) = (x&y) ^ (~x & z)
;; = (x&y) ^ ((1^x) &z)
;; = (x&y) ^ (z ^ x&z)
;; = x&y ^ z ^ x&z
;; = x&(y^z) ^z
;;
%macro Chj 4.nolist
%xdefine %%F %1
%xdefine %%X %2
%xdefine %%Y %3
%xdefine %%Z %4
mov %%F, %%Y
xor %%F, %%Z
and %%F, %%X
xor %%F, %%Z
%endmacro
;;
;; Maj(x,y,z) = (x&y) ^ (x&z) ^ (y&z)
;; = (x&y) ^ (x&z) ^ (y&z) ^ (z&z) ^z // note: ((z&z) ^z) = 0
;; = x&(y^z) ^ z&(y^z) ^z
;; = (x^z)&(y^z) ^z
;;
%macro Maj 4.nolist
%xdefine %%F %1
%xdefine %%X %2
%xdefine %%Y %3
%xdefine %%Z %4
mov %%F, %%X
xor %%F, %%Z
xor %%Z, %%Y
and %%F, %%Z
xor %%Z, %%Y
xor %%F, %%Z
%endmacro
%macro ROTR 2.nolist
%xdefine %%X %1
%xdefine %%n %2
shrd %%X,%%X, %%n
;;ror X, n
%endmacro
;;
;; Summ0(x) = ROR(x,2) ^ ROR(x,13) ^ ROR(x,22)
;;
%macro Summ0 3.nolist
%xdefine %%F %1
%xdefine %%X %2
%xdefine %%T %3
mov %%F, %%X
ROTR %%F, 2
mov %%T, %%X
ROTR %%T, 13
xor %%F, %%T
ROTR %%T, (22-13)
xor %%F, %%T
%endmacro
;;
;; Summ1(x) = ROR(x,6) ^ ROR(x,11) ^ ROR(x,25)
;;
%macro Summ1 3.nolist
%xdefine %%F %1
%xdefine %%X %2
%xdefine %%T %3
mov %%F, %%X
ROTR %%F, 6
mov %%T, %%X
ROTR %%T, 11
xor %%F, %%T
ROTR %%T, (25-11)
xor %%F, %%T
%endmacro
;;
;; regular round (i):
;;
;; T1 = h + Sigma1(e) + Ch(e,f,g) + K[i] + W[i]
;; T2 = Sigma0(a) + Maj(a,b,c)
;; h = g
;; g = f
;; f = e
;; e = d + T1
;; d = c
;; c = b
;; b = a
;; a = T1+T2
;;
;; or
;;
;; h += Sigma1(e) + Ch(e,f,g) + K[i] + W[i] (==T1)
;; d += h
;; T2 = Sigma0(a) + Maj(a,b,c)
;; h += T2
;; and following textual shift {a,b,c,d,e,f,g,h} => {h,a,b,c,d,e,f,g}
;;
%macro ROUND 6.nolist
%xdefine %%nr %1
%xdefine %%hashBuff %2
%xdefine %%wBuff %3
%xdefine %%F1 %4
%xdefine %%F2 %5
%xdefine %%T1 %6
; %xdefine T2 %7
Summ1 %%F1, eax, %%T1
Chj %%F2, eax,{[%%hashBuff+((vF-%%nr)&7)*sizeof(dword)]},{[%%hashBuff+((vG-%%nr)&7)*sizeof(dword)]}
mov eax, [%%hashBuff+((vH-%%nr)&7)*sizeof(dword)]
add eax, %%F1
add eax, %%F2
add eax, dword [%%wBuff+(%%nr&3)*sizeof(dword)]
mov %%F1, dword [%%hashBuff+((vB-%%nr)&7)*sizeof(dword)]
mov %%T1, dword [%%hashBuff+((vC-%%nr)&7)*sizeof(dword)]
Maj %%F2, edx,%%F1, %%T1
Summ0 %%F1, edx, %%T1
lea edx, [%%F1+%%F2]
add edx,eax ; T2+T1
add eax,[%%hashBuff+((vD-%%nr)&7)*sizeof(dword)] ; T1+d
mov [%%hashBuff+((vH-%%nr)&7)*sizeof(dword)],edx
mov [%%hashBuff+((vD-%%nr)&7)*sizeof(dword)],eax
%endmacro
;;
;; W[i] = Sigma1(W[i-2]) + W[i-7] + Sigma0(W[i-15]) + W[i-16], i=16,..,63
;;
;;for next rounds 16,17,18 and 19:
;; W[0] <= W[16] = Sigma1(W[14]) + W[ 9] + Sigma0(W[1]) + W[0]
;; W[1] <= W[17] = Sigma1(W[15]) + W[10] + Sigma0(W[2]) + W[1]
;; W[2] <= W[18] = Sigma1(W[ 0]) + W[11] + Sigma0(W[3]) + W[1]
;; W[3] <= W[19] = Sigma1(W[ 1]) + W[12] + Sigma0(W[4]) + W[2]
;;
;; the process is repeated exactly because texual round of W[]
;;
;; Sigma1() and Sigma0() functions are defined as following:
;; Sigma1(X) = ROR(X,17)^ROR(X,19)^SHR(X,10)
;; Sigma0(X) = ROR(X, 7)^ROR(X,18)^SHR(X, 3)
;;
%macro UPDATE_W 8.nolist
%xdefine %%xS %1
%xdefine %%xS0 %2
%xdefine %%xS4 %3
%xdefine %%xS8 %4
%xdefine %%xS12 %5
%xdefine %%SIGMA1 %6
%xdefine %%SIGMA0 %7
%xdefine %%X %8
vpshufd %%X, %%xS12, 11111010b ;; SIGMA1 = {W[15],W[15],W[14],W[14]}
vpsrld %%SIGMA1, %%X, 10
vpsrlq %%X, %%X, 17
vpxor %%SIGMA1, %%SIGMA1, %%X
vpsrlq %%X, %%X, (19-17)
vpxor %%SIGMA1, %%SIGMA1, %%X
vpshufd %%X, %%xS0, 10100101b ;; SIGMA0 = {W[2],W[2],W[1],W[1]}
vpsrld %%SIGMA0, %%X, 3
vpsrlq %%X, %%X, 7
vpxor %%SIGMA0, %%SIGMA0, %%X
vpsrlq %%X, %%X, (18-7)
vpxor %%SIGMA0, %%SIGMA0, %%X
vpshufd %%xS, %%xS0, 01010000b ;; {W[ 1],W[ 1],W[ 0],W[ 0]}
vpaddd %%SIGMA1, %%SIGMA1, %%SIGMA0
vpshufd %%X, %%xS8, 10100101b ;; {W[10],W[10],W[ 9],W[ 9]}
vpaddd %%xS, %%xS, %%SIGMA1
vpaddd %%xS, %%xS, %%X
vpshufd %%X, %%xS, 10100000b ;; SIGMA1 = {W[1],W[1],W[0],W[0]}
vpsrld %%SIGMA1, %%X, 10
vpsrlq %%X, %%X, 17
vpxor %%SIGMA1, %%SIGMA1, %%X
vpsrlq %%X, %%X, (19-17)
vpxor %%SIGMA1, %%SIGMA1, %%X
vpalignr %%X, %%xS4, %%xS0, (3*sizeof(dword)) ;; SIGMA0 = {W[4],W[4],W[3],W[3]}
vpshufd %%X, %%X, 01010000b
vpsrld %%SIGMA0, %%X, 3
vpsrlq %%X, %%X, 7
vpxor %%SIGMA0, %%SIGMA0, %%X
vpsrlq %%X, %%X, (18-7)
vpxor %%SIGMA0, %%SIGMA0, %%X
vpalignr %%X, %%xS12, %%xS8, (3*sizeof(dword)) ;; {W[14],W[13],W[12],W[11]}
vpshufd %%xS0, %%xS0, 11111010b ;; {W[ 3],W[ 3],W[ 2],W[ 2]}
vpaddd %%SIGMA1, %%SIGMA1, %%SIGMA0
vpshufd %%X, %%X, 01010000b ;; {W[12],W[12],W[11],W[11]}
vpaddd %%xS0, %%xS0, %%SIGMA1
vpaddd %%xS0, %%xS0, %%X
vpshufd %%xS, %%xS, 10001000b ;; {W[1],W[0],W[1],W[0]}
vpshufd %%xS0, %%xS0, 10001000b ;; {W[3],W[2],W[3],W[2]}
vpalignr %%xS0, %%xS0, %%xS, (2*sizeof(dword)) ;; {W[3],W[2],W[1],W[0]}
%endmacro
segment .text align=IPP_ALIGN_FACTOR
align IPP_ALIGN_FACTOR
SWP_BYTE:
pByteSwp DB 3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; UpdateSHA256(Ipp32u digest[], Ipp8u dataBlock[], int datalen, Ipp32u K_256[])
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align IPP_ALIGN_FACTOR
IPPASM UpdateSHA256,PUBLIC
USES_GPR esi,edi,ebx,ebp
mov ebp, esp ; save original esp to use it to reach parameters
%xdefine pHash [ebp + ARG_1 + 0*sizeof(dword)] ; pointer to hash
%xdefine pData [ebp + ARG_1 + 1*sizeof(dword)] ; pointer to data block
%xdefine dataLen [ebp + ARG_1 + 2*sizeof(dword)] ; data length
%xdefine pTbl [ebp + ARG_1 + 3*sizeof(dword)] ; pointer to the SHA256 const table
%xdefine MBS_SHA256 (64)
%assign hSize sizeof(dword)*8 ; size of hash
%assign wSize sizeof(oword) ; W values queue (dwords)
%assign cntSize sizeof(dword) ; local counter
%assign hashOff 0 ; hash address
%assign wOff hashOff+hSize ; W values offset
%assign cntOff wOff+wSize
%assign stackSize (hSize+wSize+cntSize) ; stack size
sub esp, stackSize
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; process next data block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.sha256_block_loop:
mov eax, pHash ; pointer to the hash
vmovdqu W0, oword [eax] ; load initial hash value
vmovdqu W4, oword [eax+sizeof(oword)]
vmovdqu oword [esp+hashOff], W0
vmovdqu oword [esp+hashOff+sizeof(oword)*1], W4
mov eax, pData ; pointer to the data block
mov regTbl, pTbl ; pointer to SHA256 table (points K_256[] constants)
;vmovdqa XMM_SHUFB_BSWAP, oword pByteSwp ; load shuffle mask
LD_ADDR ecx, SWP_BYTE
movdqa XMM_SHUFB_BSWAP, oword [ecx+(pByteSwp-SWP_BYTE)]
vmovdqu W0, oword [eax] ; load buffer content
vmovdqu W4, oword [eax+sizeof(oword)]
vmovdqu W8, oword [eax+sizeof(oword)*2]
vmovdqu W12,oword [eax+sizeof(oword)*3]
%assign vA 0
%assign vB 1
%assign vC 2
%assign vD 3
%assign vE 4
%assign vF 5
%assign vG 6
%assign vH 7
mov eax, [esp+hashOff+vE*sizeof(dword)]
mov edx, [esp+hashOff+vA*sizeof(dword)]
;; perform 0-3 regular rounds
vpshufb W0, W0, XMM_SHUFB_BSWAP ; swap input
vpaddd W, W0, oword [regTbl+sizeof(oword)*0] ; T += K_SHA256[0-3]
vmovdqu oword [esp+wOff], W
ROUND 0, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 1, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 2, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 3, {esp+hashOff},{esp+wOff}, esi,edi,ecx
;; perform next 4-7 regular rounds
vpshufb W4, W4, XMM_SHUFB_BSWAP ; swap input
vpaddd W, W4, oword [regTbl+sizeof(oword)*1] ; T += K_SHA256[4-7]
vmovdqu oword [esp+wOff], W
ROUND 4, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 5, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 6, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 7, {esp+hashOff},{esp+wOff}, esi,edi,ecx
;; perform next 8-11 regular rounds
vpshufb W8, W8, XMM_SHUFB_BSWAP ; swap input
vpaddd W, W8, oword [regTbl+sizeof(oword)*2] ; T += K_SHA256[8-11]
vmovdqu oword [esp+wOff], W
ROUND 8, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 9, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 10, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 11, {esp+hashOff},{esp+wOff}, esi,edi,ecx
;; perform next 12-15 regular rounds
vpshufb W12, W12, XMM_SHUFB_BSWAP ; swap input
vpaddd W, W12, oword [regTbl+sizeof(oword)*3] ; T += K_SHA256[12-15]
vmovdqu oword [esp+wOff], W
ROUND 12, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 13, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 14, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 15, {esp+hashOff},{esp+wOff}, esi,edi,ecx
mov dword [esp+cntOff], (64-16) ; init counter
.loop_16_63:
add regTbl, sizeof(oword)*4 ; update SHA_256 pointer
UPDATE_W W, W0, W4, W8, W12, SIG1,SIG0,X ; round: 16*i - 16*i+3
vpaddd W, W0, oword [regTbl+sizeof(oword)*0] ; T += K_SHA256[16-19]
vmovdqu oword [esp+wOff], W
ROUND 16, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 17, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 18, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 19, {esp+hashOff},{esp+wOff}, esi,edi,ecx
UPDATE_W W, W4, W8, W12,W0, SIG1,SIG0,X ; round: 20*i 20*i+3
vpaddd W, W4, oword [regTbl+sizeof(oword)*1] ; T += K_SHA256[20-23]
vmovdqu oword [esp+wOff], W
ROUND 20, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 21, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 22, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 23, {esp+hashOff},{esp+wOff}, esi,edi,ecx
UPDATE_W W, W8, W12,W0, W4, SIG1,SIG0,X ; round: 24*i - 24*i+3
vpaddd W, W8, oword [regTbl+sizeof(oword)*2] ; T += K_SHA256[24-27]
vmovdqu oword [esp+wOff], W
ROUND 24, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 25, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 26, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 27, {esp+hashOff},{esp+wOff}, esi,edi,ecx
UPDATE_W W, W12,W0, W4, W8, SIG1,SIG0,X ; round: 28*i - 28*i+3
vpaddd W, W12, oword [regTbl+sizeof(oword)*3]; T += K_SHA256[28-31]
vmovdqu oword [esp+wOff], W
ROUND 28, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 29, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 30, {esp+hashOff},{esp+wOff}, esi,edi,ecx
ROUND 31, {esp+hashOff},{esp+wOff}, esi,edi,ecx
sub dword [esp+cntOff], 16
jg .loop_16_63
mov eax, pHash ; pointer to the hash
vmovdqu W0, oword [esp+hashOff]
vmovdqu W4, oword [esp+hashOff+sizeof(oword)*1]
; update hash
vmovdqu W, oword [eax]
vpaddd W, W, W0
vmovdqu oword [eax], W
vmovdqu W, oword [eax+sizeof(oword)]
vpaddd W, W, W4
vmovdqu oword [eax+sizeof(oword)], W
add dword pData, MBS_SHA256
sub dword dataLen, MBS_SHA256
jg .sha256_block_loop
add esp, stackSize
REST_GPR
ret
ENDFUNC UpdateSHA256
%endif ;; _IPP32E_G9 and above
%endif ;; _FEATURE_OFF_ / _FEATURE_TICKTOCK_
%endif ;; _ENABLE_ALG_SHA256_
| Intel-EPID-SDK/epid-sdk | ext/ipp-crypto/sources/ippcp/asm_ia32/pcpsha256g9as.asm | Assembly | apache-2.0 | 13,483 |
Map_230E52: dc.w Frame_230E56-Map_230E52 ; ...
dc.w Frame_230E70-Map_230E52
Frame_230E56: dc.w 4
dc.b $E8, 7, 0, 0,$FF,$F0
dc.b $E8, 7, 8, 0, 0, 0
dc.b 8, 5, 0, 8,$FF,$F0
dc.b 8, 5, 8, 8, 0, 0
Frame_230E70: dc.w 2
dc.b 0, 6, 0, $C,$FF,$F0
dc.b 0, 6, 8, $C, 0, 0
| TeamASM-Blur/Sonic-3-Blue-Balls-Edition | Working Disassembly/Levels/CNZ/Misc Object Data/Map - Light Bulb.asm | Assembly | apache-2.0 | 306 |
; Copyright Oliver Kowalke 2009.
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
; ----------------------------------------------------------------------------------
; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
; ----------------------------------------------------------------------------------
; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
; ----------------------------------------------------------------------------------
; | R12 | R13 | R14 | R15 |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
; ----------------------------------------------------------------------------------
; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
; ----------------------------------------------------------------------------------
; | RDI | RSI | RBX | RBP |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 16 | 17 | 18 | 19 | |
; ----------------------------------------------------------------------------------
; | 0x40 | 0x44 | 0x48 | 0x4c | |
; ----------------------------------------------------------------------------------
; | RSP | RIP | |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 20 | 21 | 22 | 23 | |
; ----------------------------------------------------------------------------------
; | 0x50 | 0x54 | 0x58 | 0x5c | |
; ----------------------------------------------------------------------------------
; | sbase | slimit | |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 24 | 25 | |
; ----------------------------------------------------------------------------------
; | 0x60 | 0x64 | |
; ----------------------------------------------------------------------------------
; | fbr_strg | |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 26 | 27 | 28 | 29 | |
; ----------------------------------------------------------------------------------
; | 0x68 | 0x6c | 0x70 | 0x74 | |
; ----------------------------------------------------------------------------------
; | fc_mxcsr|fc_x87_cw| fc_xmm | |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
; ----------------------------------------------------------------------------------
; | 0x78 | 0x7c | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 |
; ----------------------------------------------------------------------------------
; | XMM6 | XMM7 |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
; ----------------------------------------------------------------------------------
; | 0x98 | 0x9c | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 |
; ----------------------------------------------------------------------------------
; | XMM8 | XMM9 |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
; ----------------------------------------------------------------------------------
; | 0x118 | 0x11c | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 |
; ----------------------------------------------------------------------------------
; | XMM10 | XMM11 |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
; ----------------------------------------------------------------------------------
; | 0x138 | 0x13c | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 |
; ----------------------------------------------------------------------------------
; | XMM12 | XMM13 |
; ----------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------
; | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
; ----------------------------------------------------------------------------------
; | 0x158 | 0x15c | 0x160 | 0x164 | 0x168 | 0x16c | 0x170 | 0x174 |
; ----------------------------------------------------------------------------------
; | XMM14 | XMM15 |
; ----------------------------------------------------------------------------------
EXTERN _exit:PROC ; standard C library function
EXTERN align_stack:PROC ; stack alignment
EXTERN seh_fcontext:PROC ; exception handler
.code
jump_fcontext PROC EXPORT FRAME:seh_fcontext
.endprolog
mov [rcx], r12 ; save R12
mov [rcx+08h], r13 ; save R13
mov [rcx+010h], r14 ; save R14
mov [rcx+018h], r15 ; save R15
mov [rcx+020h], rdi ; save RDI
mov [rcx+028h], rsi ; save RSI
mov [rcx+030h], rbx ; save RBX
mov [rcx+038h], rbp ; save RBP
mov r10, gs:[030h] ; load NT_TIB
mov rax, [r10+08h] ; load current stack base
mov [rcx+050h], rax ; save current stack base
mov rax, [r10+010h] ; load current stack limit
mov [rcx+058h], rax ; save current stack limit
mov rax, [r10+018h] ; load fiber local storage
mov [rcx+060h], rax ; save fiber local storage
test r9, r9
je nxt
stmxcsr [rcx+068h] ; save MMX control and status word
fnstcw [rcx+06ch] ; save x87 control word
mov r10, [rcx+070h] ; address of aligned XMM storage
movaps [r10], xmm6
movaps [r10+010h], xmm7
movaps [r10+020h], xmm8
movaps [r10+030h], xmm9
movaps [r10+040h], xmm10
movaps [r10+050h], xmm11
movaps [r10+060h], xmm12
movaps [r10+070h], xmm13
movaps [r10+080h], xmm14
movaps [r10+090h], xmm15
ldmxcsr [rdx+068h] ; restore MMX control and status word
fldcw [rdx+06ch] ; restore x87 control word
mov r10, [rdx+070h] ; address of aligned XMM storage
movaps xmm6, [r10]
movaps xmm7, [r10+010h]
movaps xmm8, [r10+020h]
movaps xmm9, [r10+030h]
movaps xmm10, [r10+040h]
movaps xmm11, [r10+050h]
movaps xmm12, [r10+060h]
movaps xmm13, [r10+070h]
movaps xmm14, [r10+080h]
movaps xmm15, [r10+090h]
nxt:
lea rax, [rsp+08h] ; exclude the return address
mov [rcx+040h], rax ; save as stack pointer
mov rax, [rsp] ; load return address
mov [rcx+048h], rax ; save return address
mov r12, [rdx] ; restore R12
mov r13, [rdx+08h] ; restore R13
mov r14, [rdx+010h] ; restore R14
mov r15, [rdx+018h] ; restore R15
mov rdi, [rdx+020h] ; restore RDI
mov rsi, [rdx+028h] ; restore RSI
mov rbx, [rdx+030h] ; restore RBX
mov rbp, [rdx+038h] ; restore RBP
mov r10, gs:[030h] ; load NT_TIB
mov rax, [rdx+050h] ; load stack base
mov [r10+08h], rax ; restore stack base
mov rax, [rdx+058h] ; load stack limit
mov [r10+010h], rax ; restore stack limit
mov rax, [rdx+060h] ; load fiber local storage
mov [r10+018h], rax ; restore fiber local storage
mov rsp, [rdx+040h] ; restore RSP
mov r10, [rdx+048h] ; fetch the address to returned to
mov rax, r8 ; use third arg as return value after jump
mov rcx, r8 ; use third arg as first arg in context function
jmp r10 ; indirect jump to caller
jump_fcontext ENDP
make_fcontext PROC EXPORT FRAME ; generate function table entry in .pdata and unwind information in E
.endprolog ; .xdata for a function's structured exception handling unwind behavior
mov [rcx], rcx ; store the address of current context
mov [rcx+048h], rdx ; save the address of the function supposed to run
mov rdx, [rcx+050h] ; load the address where the context stack beginns
push rcx ; save pointer to fcontext_t
sub rsp, 028h ; reserve shadow space for align_stack
mov rcx, rdx ; stack pointer as arg for align_stack
mov [rsp+8], rcx
call align_stack ; align stack
mov rdx, rax ; begin of aligned stack
add rsp, 028h
pop rcx ; restore pointer to fcontext_t
lea rdx, [rdx-028h] ; reserve 32byte shadow space + return address on stack, (RSP + 8) % 16 == 0
mov [rcx+040h], rdx ; save the address where the context stack beginns
stmxcsr [rcx+068h] ; save MMX control and status word
fnstcw [rcx+06ch] ; save x87 control word
lea rax, finish ; helper code executed after fn() returns
mov [rdx], rax ; store address off the helper function as return address
xor rax, rax ; set RAX to zero
ret
finish:
xor rcx, rcx
mov [rsp+08h], rcx
call _exit ; exit application
hlt
make_fcontext ENDP
END
| moonstonedac/moonstone | libraries/fc/vendor/boost_1.51/libs/context/asm/fcontext_x86_64_ms_pe_masm.asm | Assembly | mit | 11,964 |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
%include "vpx_ports/x86_abi_support.asm"
extern sym(vp8_bilinear_filters_x86_8)
%define BLOCK_HEIGHT_WIDTH 4
%define VP8_FILTER_WEIGHT 128
%define VP8_FILTER_SHIFT 7
;/************************************************************************************
; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
; input pixel array has output_height rows. This routine assumes that output_height is an
; even number. This function handles 8 pixels in horizontal direction, calculating ONE
; rows each iteration to take advantage of the 128 bits operations.
;*************************************************************************************/
;void vp8_filter_block1d8_h6_sse2
;(
; unsigned char *src_ptr,
; unsigned short *output_ptr,
; unsigned int src_pixels_per_line,
; unsigned int pixel_step,
; unsigned int output_height,
; unsigned int output_width,
; short *vp8_filter
;)
global sym(vp8_filter_block1d8_h6_sse2) PRIVATE
sym(vp8_filter_block1d8_h6_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 7
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rdx, arg(6) ;vp8_filter
mov rsi, arg(0) ;src_ptr
mov rdi, arg(1) ;output_ptr
movsxd rcx, dword ptr arg(4) ;output_height
movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(5) ;output_width
%endif
pxor xmm0, xmm0 ; clear xmm0 for unpack
.filter_block1d8_h6_rowloop:
movq xmm3, MMWORD PTR [rsi - 2]
movq xmm1, MMWORD PTR [rsi + 6]
prefetcht2 [rsi+rax-2]
pslldq xmm1, 8
por xmm1, xmm3
movdqa xmm4, xmm1
movdqa xmm5, xmm1
movdqa xmm6, xmm1
movdqa xmm7, xmm1
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm1
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0
punpcklbw xmm4, xmm0
movdqa XMMWORD Ptr [rdi], xmm4
lea rsi, [rsi + rax]
%if ABI_IS_32BIT
add rdi, DWORD Ptr arg(5) ;[output_width]
%else
add rdi, r8
%endif
dec rcx
jnz .filter_block1d8_h6_rowloop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d16_h6_sse2
;(
; unsigned char *src_ptr,
; unsigned short *output_ptr,
; unsigned int src_pixels_per_line,
; unsigned int pixel_step,
; unsigned int output_height,
; unsigned int output_width,
; short *vp8_filter
;)
;/************************************************************************************
; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
; input pixel array has output_height rows. This routine assumes that output_height is an
; even number. This function handles 8 pixels in horizontal direction, calculating ONE
; rows each iteration to take advantage of the 128 bits operations.
;*************************************************************************************/
global sym(vp8_filter_block1d16_h6_sse2) PRIVATE
sym(vp8_filter_block1d16_h6_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 7
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rdx, arg(6) ;vp8_filter
mov rsi, arg(0) ;src_ptr
mov rdi, arg(1) ;output_ptr
movsxd rcx, dword ptr arg(4) ;output_height
movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(5) ;output_width
%endif
pxor xmm0, xmm0 ; clear xmm0 for unpack
.filter_block1d16_h6_sse2_rowloop:
movq xmm3, MMWORD PTR [rsi - 2]
movq xmm1, MMWORD PTR [rsi + 6]
movq xmm2, MMWORD PTR [rsi +14]
pslldq xmm2, 8
por xmm2, xmm1
prefetcht2 [rsi+rax-2]
pslldq xmm1, 8
por xmm1, xmm3
movdqa xmm4, xmm1
movdqa xmm5, xmm1
movdqa xmm6, xmm1
movdqa xmm7, xmm1
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm1
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0
punpcklbw xmm4, xmm0
movdqa XMMWORD Ptr [rdi], xmm4
movdqa xmm3, xmm2
movdqa xmm4, xmm2
movdqa xmm5, xmm2
movdqa xmm6, xmm2
movdqa xmm7, xmm2
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm2
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0
punpcklbw xmm4, xmm0
movdqa XMMWORD Ptr [rdi+16], xmm4
lea rsi, [rsi + rax]
%if ABI_IS_32BIT
add rdi, DWORD Ptr arg(5) ;[output_width]
%else
add rdi, r8
%endif
dec rcx
jnz .filter_block1d16_h6_sse2_rowloop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d8_v6_sse2
;(
; short *src_ptr,
; unsigned char *output_ptr,
; int dst_ptich,
; unsigned int pixels_per_line,
; unsigned int pixel_step,
; unsigned int output_height,
; unsigned int output_width,
; short * vp8_filter
;)
;/************************************************************************************
; Notes: filter_block1d8_v6 applies a 6 tap filter vertically to the input pixels. The
; input pixel array has output_height rows.
;*************************************************************************************/
global sym(vp8_filter_block1d8_v6_sse2) PRIVATE
sym(vp8_filter_block1d8_v6_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 8
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rax, arg(7) ;vp8_filter
movsxd rdx, dword ptr arg(3) ;pixels_per_line
mov rdi, arg(1) ;output_ptr
mov rsi, arg(0) ;src_ptr
sub rsi, rdx
sub rsi, rdx
movsxd rcx, DWORD PTR arg(5) ;[output_height]
pxor xmm0, xmm0 ; clear xmm0
movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(2) ; dst_ptich
%endif
.vp8_filter_block1d8_v6_sse2_loop:
movdqa xmm1, XMMWORD PTR [rsi]
pmullw xmm1, [rax]
movdqa xmm2, XMMWORD PTR [rsi + rdx]
pmullw xmm2, [rax + 16]
movdqa xmm3, XMMWORD PTR [rsi + rdx * 2]
pmullw xmm3, [rax + 32]
movdqa xmm5, XMMWORD PTR [rsi + rdx * 4]
pmullw xmm5, [rax + 64]
add rsi, rdx
movdqa xmm4, XMMWORD PTR [rsi + rdx * 2]
pmullw xmm4, [rax + 48]
movdqa xmm6, XMMWORD PTR [rsi + rdx * 4]
pmullw xmm6, [rax + 80]
paddsw xmm2, xmm5
paddsw xmm2, xmm3
paddsw xmm2, xmm1
paddsw xmm2, xmm4
paddsw xmm2, xmm6
paddsw xmm2, xmm7
psraw xmm2, 7
packuswb xmm2, xmm0 ; pack and saturate
movq QWORD PTR [rdi], xmm2 ; store the results in the destination
%if ABI_IS_32BIT
add rdi, DWORD PTR arg(2) ;[dst_ptich]
%else
add rdi, r8
%endif
dec rcx ; decrement count
jnz .vp8_filter_block1d8_v6_sse2_loop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d16_v6_sse2
;(
; unsigned short *src_ptr,
; unsigned char *output_ptr,
; int dst_ptich,
; unsigned int pixels_per_line,
; unsigned int pixel_step,
; unsigned int output_height,
; unsigned int output_width,
; const short *vp8_filter
;)
;/************************************************************************************
; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
; input pixel array has output_height rows.
;*************************************************************************************/
global sym(vp8_filter_block1d16_v6_sse2) PRIVATE
sym(vp8_filter_block1d16_v6_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 8
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rax, arg(7) ;vp8_filter
movsxd rdx, dword ptr arg(3) ;pixels_per_line
mov rdi, arg(1) ;output_ptr
mov rsi, arg(0) ;src_ptr
sub rsi, rdx
sub rsi, rdx
movsxd rcx, DWORD PTR arg(5) ;[output_height]
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(2) ; dst_ptich
%endif
.vp8_filter_block1d16_v6_sse2_loop:
; The order for adding 6-tap is 2 5 3 1 4 6. Read in data in that order.
movdqa xmm1, XMMWORD PTR [rsi + rdx] ; line 2
movdqa xmm2, XMMWORD PTR [rsi + rdx + 16]
pmullw xmm1, [rax + 16]
pmullw xmm2, [rax + 16]
movdqa xmm3, XMMWORD PTR [rsi + rdx * 4] ; line 5
movdqa xmm4, XMMWORD PTR [rsi + rdx * 4 + 16]
pmullw xmm3, [rax + 64]
pmullw xmm4, [rax + 64]
movdqa xmm5, XMMWORD PTR [rsi + rdx * 2] ; line 3
movdqa xmm6, XMMWORD PTR [rsi + rdx * 2 + 16]
pmullw xmm5, [rax + 32]
pmullw xmm6, [rax + 32]
movdqa xmm7, XMMWORD PTR [rsi] ; line 1
movdqa xmm0, XMMWORD PTR [rsi + 16]
pmullw xmm7, [rax]
pmullw xmm0, [rax]
paddsw xmm1, xmm3
paddsw xmm2, xmm4
paddsw xmm1, xmm5
paddsw xmm2, xmm6
paddsw xmm1, xmm7
paddsw xmm2, xmm0
add rsi, rdx
movdqa xmm3, XMMWORD PTR [rsi + rdx * 2] ; line 4
movdqa xmm4, XMMWORD PTR [rsi + rdx * 2 + 16]
pmullw xmm3, [rax + 48]
pmullw xmm4, [rax + 48]
movdqa xmm5, XMMWORD PTR [rsi + rdx * 4] ; line 6
movdqa xmm6, XMMWORD PTR [rsi + rdx * 4 + 16]
pmullw xmm5, [rax + 80]
pmullw xmm6, [rax + 80]
movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
pxor xmm0, xmm0 ; clear xmm0
paddsw xmm1, xmm3
paddsw xmm2, xmm4
paddsw xmm1, xmm5
paddsw xmm2, xmm6
paddsw xmm1, xmm7
paddsw xmm2, xmm7
psraw xmm1, 7
psraw xmm2, 7
packuswb xmm1, xmm2 ; pack and saturate
movdqa XMMWORD PTR [rdi], xmm1 ; store the results in the destination
%if ABI_IS_32BIT
add rdi, DWORD PTR arg(2) ;[dst_ptich]
%else
add rdi, r8
%endif
dec rcx ; decrement count
jnz .vp8_filter_block1d16_v6_sse2_loop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d8_h6_only_sse2
;(
; unsigned char *src_ptr,
; unsigned int src_pixels_per_line,
; unsigned char *output_ptr,
; int dst_ptich,
; unsigned int output_height,
; const short *vp8_filter
;)
; First-pass filter only when yoffset==0
global sym(vp8_filter_block1d8_h6_only_sse2) PRIVATE
sym(vp8_filter_block1d8_h6_only_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 6
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rdx, arg(5) ;vp8_filter
mov rsi, arg(0) ;src_ptr
mov rdi, arg(2) ;output_ptr
movsxd rcx, dword ptr arg(4) ;output_height
movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(3) ;dst_ptich
%endif
pxor xmm0, xmm0 ; clear xmm0 for unpack
.filter_block1d8_h6_only_rowloop:
movq xmm3, MMWORD PTR [rsi - 2]
movq xmm1, MMWORD PTR [rsi + 6]
prefetcht2 [rsi+rax-2]
pslldq xmm1, 8
por xmm1, xmm3
movdqa xmm4, xmm1
movdqa xmm5, xmm1
movdqa xmm6, xmm1
movdqa xmm7, xmm1
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm1
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0
movq QWORD PTR [rdi], xmm4 ; store the results in the destination
lea rsi, [rsi + rax]
%if ABI_IS_32BIT
add rdi, DWORD Ptr arg(3) ;dst_ptich
%else
add rdi, r8
%endif
dec rcx
jnz .filter_block1d8_h6_only_rowloop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d16_h6_only_sse2
;(
; unsigned char *src_ptr,
; unsigned int src_pixels_per_line,
; unsigned char *output_ptr,
; int dst_ptich,
; unsigned int output_height,
; const short *vp8_filter
;)
; First-pass filter only when yoffset==0
global sym(vp8_filter_block1d16_h6_only_sse2) PRIVATE
sym(vp8_filter_block1d16_h6_only_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 6
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rdx, arg(5) ;vp8_filter
mov rsi, arg(0) ;src_ptr
mov rdi, arg(2) ;output_ptr
movsxd rcx, dword ptr arg(4) ;output_height
movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(3) ;dst_ptich
%endif
pxor xmm0, xmm0 ; clear xmm0 for unpack
.filter_block1d16_h6_only_sse2_rowloop:
movq xmm3, MMWORD PTR [rsi - 2]
movq xmm1, MMWORD PTR [rsi + 6]
movq xmm2, MMWORD PTR [rsi +14]
pslldq xmm2, 8
por xmm2, xmm1
prefetcht2 [rsi+rax-2]
pslldq xmm1, 8
por xmm1, xmm3
movdqa xmm4, xmm1
movdqa xmm5, xmm1
movdqa xmm6, xmm1
movdqa xmm7, xmm1
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm1
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0 ; lower 8 bytes
movq QWORD Ptr [rdi], xmm4 ; store the results in the destination
movdqa xmm3, xmm2
movdqa xmm4, xmm2
movdqa xmm5, xmm2
movdqa xmm6, xmm2
movdqa xmm7, xmm2
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
paddsw xmm4, xmm7
paddsw xmm4, xmm5
paddsw xmm4, xmm3
paddsw xmm4, xmm6
paddsw xmm4, xmm2
paddsw xmm4, [GLOBAL(rd)]
psraw xmm4, 7
packuswb xmm4, xmm0 ; higher 8 bytes
movq QWORD Ptr [rdi+8], xmm4 ; store the results in the destination
lea rsi, [rsi + rax]
%if ABI_IS_32BIT
add rdi, DWORD Ptr arg(3) ;dst_ptich
%else
add rdi, r8
%endif
dec rcx
jnz .filter_block1d16_h6_only_sse2_rowloop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_filter_block1d8_v6_only_sse2
;(
; unsigned char *src_ptr,
; unsigned int src_pixels_per_line,
; unsigned char *output_ptr,
; int dst_ptich,
; unsigned int output_height,
; const short *vp8_filter
;)
; Second-pass filter only when xoffset==0
global sym(vp8_filter_block1d8_v6_only_sse2) PRIVATE
sym(vp8_filter_block1d8_v6_only_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 6
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rsi, arg(0) ;src_ptr
mov rdi, arg(2) ;output_ptr
movsxd rcx, dword ptr arg(4) ;output_height
movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
mov rax, arg(5) ;vp8_filter
pxor xmm0, xmm0 ; clear xmm0
movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(3) ; dst_ptich
%endif
.vp8_filter_block1d8_v6_only_sse2_loop:
movq xmm1, MMWORD PTR [rsi]
movq xmm2, MMWORD PTR [rsi + rdx]
movq xmm3, MMWORD PTR [rsi + rdx * 2]
movq xmm5, MMWORD PTR [rsi + rdx * 4]
add rsi, rdx
movq xmm4, MMWORD PTR [rsi + rdx * 2]
movq xmm6, MMWORD PTR [rsi + rdx * 4]
punpcklbw xmm1, xmm0
pmullw xmm1, [rax]
punpcklbw xmm2, xmm0
pmullw xmm2, [rax + 16]
punpcklbw xmm3, xmm0
pmullw xmm3, [rax + 32]
punpcklbw xmm5, xmm0
pmullw xmm5, [rax + 64]
punpcklbw xmm4, xmm0
pmullw xmm4, [rax + 48]
punpcklbw xmm6, xmm0
pmullw xmm6, [rax + 80]
paddsw xmm2, xmm5
paddsw xmm2, xmm3
paddsw xmm2, xmm1
paddsw xmm2, xmm4
paddsw xmm2, xmm6
paddsw xmm2, xmm7
psraw xmm2, 7
packuswb xmm2, xmm0 ; pack and saturate
movq QWORD PTR [rdi], xmm2 ; store the results in the destination
%if ABI_IS_32BIT
add rdi, DWORD PTR arg(3) ;[dst_ptich]
%else
add rdi, r8
%endif
dec rcx ; decrement count
jnz .vp8_filter_block1d8_v6_only_sse2_loop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_unpack_block1d16_h6_sse2
;(
; unsigned char *src_ptr,
; unsigned short *output_ptr,
; unsigned int src_pixels_per_line,
; unsigned int output_height,
; unsigned int output_width
;)
global sym(vp8_unpack_block1d16_h6_sse2) PRIVATE
sym(vp8_unpack_block1d16_h6_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rsi, arg(0) ;src_ptr
mov rdi, arg(1) ;output_ptr
movsxd rcx, dword ptr arg(3) ;output_height
movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
pxor xmm0, xmm0 ; clear xmm0 for unpack
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
%endif
.unpack_block1d16_h6_sse2_rowloop:
movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
punpcklbw xmm1, xmm0
movdqa XMMWORD Ptr [rdi], xmm1
movdqa XMMWORD Ptr [rdi + 16], xmm3
lea rsi, [rsi + rax]
%if ABI_IS_32BIT
add rdi, DWORD Ptr arg(4) ;[output_width]
%else
add rdi, r8
%endif
dec rcx
jnz .unpack_block1d16_h6_sse2_rowloop ; next row
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp8_bilinear_predict16x16_sse2
;(
; unsigned char *src_ptr,
; int src_pixels_per_line,
; int xoffset,
; int yoffset,
; unsigned char *dst_ptr,
; int dst_pitch
;)
extern sym(vp8_bilinear_filters_x86_8)
global sym(vp8_bilinear_predict16x16_sse2) PRIVATE
sym(vp8_bilinear_predict16x16_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 6
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
movsxd rax, dword ptr arg(2) ;xoffset
cmp rax, 0 ;skip first_pass filter if xoffset=0
je .b16x16_sp_only
shl rax, 5
add rax, rcx ;HFilter
mov rdi, arg(4) ;dst_ptr
mov rsi, arg(0) ;src_ptr
movsxd rdx, dword ptr arg(5) ;dst_pitch
movdqa xmm1, [rax]
movdqa xmm2, [rax+16]
movsxd rax, dword ptr arg(3) ;yoffset
cmp rax, 0 ;skip second_pass filter if yoffset=0
je .b16x16_fp_only
shl rax, 5
add rax, rcx ;VFilter
lea rcx, [rdi+rdx*8]
lea rcx, [rcx+rdx*8]
movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
pxor xmm0, xmm0
%if ABI_IS_32BIT=0
movsxd r8, dword ptr arg(5) ;dst_pitch
%endif
; get the first horizontal line done
movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
movdqa xmm4, xmm3 ; make a copy of current line
punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
punpckhbw xmm4, xmm0
pmullw xmm3, xmm1
pmullw xmm4, xmm1
movdqu xmm5, [rsi+1]
movdqa xmm6, xmm5
punpcklbw xmm5, xmm0
punpckhbw xmm6, xmm0
pmullw xmm5, xmm2
pmullw xmm6, xmm2
paddw xmm3, xmm5
paddw xmm4, xmm6
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
paddw xmm4, [GLOBAL(rd)]
psraw xmm4, VP8_FILTER_SHIFT
movdqa xmm7, xmm3
packuswb xmm7, xmm4
add rsi, rdx ; next line
.next_row:
movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
movdqa xmm4, xmm3 ; make a copy of current line
punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
punpckhbw xmm4, xmm0
pmullw xmm3, xmm1
pmullw xmm4, xmm1
movdqu xmm5, [rsi+1]
movdqa xmm6, xmm5
punpcklbw xmm5, xmm0
punpckhbw xmm6, xmm0
pmullw xmm5, xmm2
pmullw xmm6, xmm2
paddw xmm3, xmm5
paddw xmm4, xmm6
movdqa xmm5, xmm7
movdqa xmm6, xmm7
punpcklbw xmm5, xmm0
punpckhbw xmm6, xmm0
pmullw xmm5, [rax]
pmullw xmm6, [rax]
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
paddw xmm4, [GLOBAL(rd)]
psraw xmm4, VP8_FILTER_SHIFT
movdqa xmm7, xmm3
packuswb xmm7, xmm4
pmullw xmm3, [rax+16]
pmullw xmm4, [rax+16]
paddw xmm3, xmm5
paddw xmm4, xmm6
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
paddw xmm4, [GLOBAL(rd)]
psraw xmm4, VP8_FILTER_SHIFT
packuswb xmm3, xmm4
movdqa [rdi], xmm3 ; store the results in the destination
add rsi, rdx ; next line
%if ABI_IS_32BIT
add rdi, DWORD PTR arg(5) ;dst_pitch
%else
add rdi, r8
%endif
cmp rdi, rcx
jne .next_row
jmp .done
.b16x16_sp_only:
movsxd rax, dword ptr arg(3) ;yoffset
shl rax, 5
add rax, rcx ;VFilter
mov rdi, arg(4) ;dst_ptr
mov rsi, arg(0) ;src_ptr
movsxd rdx, dword ptr arg(5) ;dst_pitch
movdqa xmm1, [rax]
movdqa xmm2, [rax+16]
lea rcx, [rdi+rdx*8]
lea rcx, [rcx+rdx*8]
movsxd rax, dword ptr arg(1) ;src_pixels_per_line
pxor xmm0, xmm0
; get the first horizontal line done
movdqu xmm7, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
add rsi, rax ; next line
.next_row_spo:
movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
movdqa xmm5, xmm7
movdqa xmm6, xmm7
movdqa xmm4, xmm3 ; make a copy of current line
movdqa xmm7, xmm3
punpcklbw xmm5, xmm0
punpckhbw xmm6, xmm0
punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
punpckhbw xmm4, xmm0
pmullw xmm5, xmm1
pmullw xmm6, xmm1
pmullw xmm3, xmm2
pmullw xmm4, xmm2
paddw xmm3, xmm5
paddw xmm4, xmm6
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
paddw xmm4, [GLOBAL(rd)]
psraw xmm4, VP8_FILTER_SHIFT
packuswb xmm3, xmm4
movdqa [rdi], xmm3 ; store the results in the destination
add rsi, rax ; next line
add rdi, rdx ;dst_pitch
cmp rdi, rcx
jne .next_row_spo
jmp .done
.b16x16_fp_only:
lea rcx, [rdi+rdx*8]
lea rcx, [rcx+rdx*8]
movsxd rax, dword ptr arg(1) ;src_pixels_per_line
pxor xmm0, xmm0
.next_row_fpo:
movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
movdqa xmm4, xmm3 ; make a copy of current line
punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
punpckhbw xmm4, xmm0
pmullw xmm3, xmm1
pmullw xmm4, xmm1
movdqu xmm5, [rsi+1]
movdqa xmm6, xmm5
punpcklbw xmm5, xmm0
punpckhbw xmm6, xmm0
pmullw xmm5, xmm2
pmullw xmm6, xmm2
paddw xmm3, xmm5
paddw xmm4, xmm6
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
paddw xmm4, [GLOBAL(rd)]
psraw xmm4, VP8_FILTER_SHIFT
packuswb xmm3, xmm4
movdqa [rdi], xmm3 ; store the results in the destination
add rsi, rax ; next line
add rdi, rdx ; dst_pitch
cmp rdi, rcx
jne .next_row_fpo
.done:
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
;void vp8_bilinear_predict8x8_sse2
;(
; unsigned char *src_ptr,
; int src_pixels_per_line,
; int xoffset,
; int yoffset,
; unsigned char *dst_ptr,
; int dst_pitch
;)
global sym(vp8_bilinear_predict8x8_sse2) PRIVATE
sym(vp8_bilinear_predict8x8_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 6
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
; end prolog
ALIGN_STACK 16, rax
sub rsp, 144 ; reserve 144 bytes
;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
mov rsi, arg(0) ;src_ptr
movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
;Read 9-line unaligned data in and put them on stack. This gives a big
;performance boost.
movdqu xmm0, [rsi]
lea rax, [rdx + rdx*2]
movdqu xmm1, [rsi+rdx]
movdqu xmm2, [rsi+rdx*2]
add rsi, rax
movdqu xmm3, [rsi]
movdqu xmm4, [rsi+rdx]
movdqu xmm5, [rsi+rdx*2]
add rsi, rax
movdqu xmm6, [rsi]
movdqu xmm7, [rsi+rdx]
movdqa XMMWORD PTR [rsp], xmm0
movdqu xmm0, [rsi+rdx*2]
movdqa XMMWORD PTR [rsp+16], xmm1
movdqa XMMWORD PTR [rsp+32], xmm2
movdqa XMMWORD PTR [rsp+48], xmm3
movdqa XMMWORD PTR [rsp+64], xmm4
movdqa XMMWORD PTR [rsp+80], xmm5
movdqa XMMWORD PTR [rsp+96], xmm6
movdqa XMMWORD PTR [rsp+112], xmm7
movdqa XMMWORD PTR [rsp+128], xmm0
movsxd rax, dword ptr arg(2) ;xoffset
shl rax, 5
add rax, rcx ;HFilter
mov rdi, arg(4) ;dst_ptr
movsxd rdx, dword ptr arg(5) ;dst_pitch
movdqa xmm1, [rax]
movdqa xmm2, [rax+16]
movsxd rax, dword ptr arg(3) ;yoffset
shl rax, 5
add rax, rcx ;VFilter
lea rcx, [rdi+rdx*8]
movdqa xmm5, [rax]
movdqa xmm6, [rax+16]
pxor xmm0, xmm0
; get the first horizontal line done
movdqa xmm3, XMMWORD PTR [rsp]
movdqa xmm4, xmm3 ; make a copy of current line
psrldq xmm4, 1
punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
pmullw xmm3, xmm1
pmullw xmm4, xmm2
paddw xmm3, xmm4
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
movdqa xmm7, xmm3
add rsp, 16 ; next line
.next_row8x8:
movdqa xmm3, XMMWORD PTR [rsp] ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
movdqa xmm4, xmm3 ; make a copy of current line
psrldq xmm4, 1
punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
pmullw xmm3, xmm1
pmullw xmm4, xmm2
paddw xmm3, xmm4
pmullw xmm7, xmm5
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
movdqa xmm4, xmm3
pmullw xmm3, xmm6
paddw xmm3, xmm7
movdqa xmm7, xmm4
paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
packuswb xmm3, xmm0
movq [rdi], xmm3 ; store the results in the destination
add rsp, 16 ; next line
add rdi, rdx
cmp rdi, rcx
jne .next_row8x8
;add rsp, 144
pop rsp
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
SECTION_RODATA
align 16
rd:
times 8 dw 0x40
| blloyd75/theoraplayer | vpx/vp8/common/x86/subpixel_sse2.asm | Assembly | bsd-3-clause | 46,749 |
-- HUMAN RESOURCE MACHINE PROGRAM --
a:
INBOX
b:
COPYTO 2
COPYFROM [2]
OUTBOX
BUMPUP 2
COPYFROM [2]
JUMPN a
JUMP b
| yuwanzeon/human-resource-machine-solutions | 37.asm | Assembly | mit | 166 |
; Lab 11 - The Stack
; @author Eddie Gurnee
; @version 12/04/2013
.orig x3000
; R6 = the pointer of the Stack
LD R6, LAB_base ;
LEA R0, LAB_out1 ;
PUTS ;
GETC ;
OUT ;
JSR PUSH ;
LD R0, LAB_ln ; new line
OUT ;
LEA R0, LAB_out2 ;
PUTS ;
GETC ; get first value
OUT ;
ADD R2, R0, 0 ;
GETC ; get second value
OUT ;
ADD R1, R0, 0 ;
ADD R0, R2, 0 ;
JSR DPUSH ;
LD R0, LAB_ln ; new line
OUT ;
LEA R0, LAB_out1 ;
PUTS ;
GETC ;
OUT ;
JSR PUSH ;
LD R0, LAB_ln ; new line
OUT ;
LEA R0, LAB_out3 ;
PUTS ;
JSR PEEK ;
OUT ;
LD R0, LAB_ln ; new line
OUT ;
LEA R0, LAB_out4 ;
PUTS ;
JSR DPOP ;
OUT ;
LD R0, LAB_sp ; space
OUT ;
ADD R0, R1, 0 ;
OUT ;
LD R0, LAB_ln ; new line
OUT ;
LEA R0, LAB_out4 ;
PUTS ;
JSR DPOP ;
OUT ;
LD R0, LAB_sp ; space
OUT ;
ADD R0, R1, 0 ;
OUT ;
HALT
LAB_base .fill x4000 ;
LAB_ln .fill xA ; new line char
LAB_sp .fill x20 ; space char
LAB_out1 .stringz "Enter element: " ;
LAB_out2 .stringz "Enter 2 elements: " ;
LAB_out3 .stringz "Top element: " ;
LAB_out4 .stringz "Pop'd values: " ;
; Subroutine PEEK
; Looks at the first element in the stack
; Pre-condition: R6 is the stack pointer
; Post-condition: R0 contains the first element on the stack.
; R5 = 0 if there is no underflow, R5 = 1 if the stack is empty.
; R6 is unchanged.
PEEK
ST R7, PEEK_saveR7
ST R3, PEEK_saveR3
AND R5, R5, 0 ;
LD R3, PEEK_base ;
NOT R3, R3 ;
ADD R3, R3, 1 ;
ADD R3, R3, R6 ;
BRz PEEK_Fail ; z if the stack is empty
ADD R6, R6, 1 ;
LDR R0, R6, 0 ; PEEK
ADD R6, R6, -1 ;
BR PEEK_Exit
PEEK_Fail
ADD R5, R5, 1
PEEK_Exit
LD R3, PEEK_saveR3
LD R7, PEEK_saveR7
RET
PEEK_saveR3 .blkw 1 ;
PEEK_saveR7 .blkw 1 ;
PEEK_base .fill xC001 ;
; Subroutine DPUSH
; Pushes two new element on top of the stack
; Pre-condition: R0 contains the first element to be pushed into the stack.
; R1 contains the second element to be pushed into the stack.
; R6 is the stack pointer.
; Post-condition: The stack contains the value of R1 as the first element and the value of R0 as the second element on the stack.
; R5 = 0 if the operation was successful, R5 = 1 if there is overflow.
; R6 contains the updated top of the stack address.
DPUSH
ST R7, DPUSH_saveR7
ST R2, DPUSH_saveR2
ST R3, DPUSH_saveR3
AND R5, R5, 0 ;
LD R3, DPUSH_max ;
NOT R3, R3 ;
ADD R3, R3, 1 ;
ADD R3, R3, R6 ;
ADD R3, R3, 2 ;
BRn DPUSH_Fail ; n if there is overflow
STR R0, R6, 0 ; PUSH 1
ADD R6, R6, -1 ;
STR R1, R6, 0 ; PUSH 2
ADD R6, R6, -1 ;
BR DPUSH_Exit
DPUSH_Fail
ADD R5, R5, 1
DPUSH_Exit
LD R2, DPUSH_saveR2
LD R3, DPUSH_saveR3
LD R7, DPUSH_saveR7
RET
DPUSH_saveR2 .blkw 1 ;
DPUSH_saveR3 .blkw 1 ;
DPUSH_saveR7 .blkw 1 ;
DPUSH_max .fill xC100 ;
; Subroutine DPOP
; "Removes" and returns two elements from the top of the stack
; Pre-condition: R6 is the stack pointer.
; Post-condition: R0 contains the first element on the stack.
; R1 contains the second element on the stack.
; R5 = 0 if there is no underflow, R5 = 1 if the stack is empty.
; R6 contains the updated top of the stack address.
DPOP
ST R7, DPOP_saveR7
ST R2, DPOP_saveR2
ST R3, DPOP_saveR3
AND R5, R5, 0 ;
LD R3, DPOP_base ;
NOT R3, R3 ;
ADD R3, R3, 1 ;
ADD R3, R3, R6 ;
ADD R3, R3, -2 ;
BRn DPOP_Fail ; z if the stack will now be empty
ADD R6, R6, 1 ;
LDR R0, R6, 0 ; POP 1
ADD R6, R6, 1 ;
LDR R1, R6, 0 ; POP 2
BR DPOP_Exit
DPOP_Fail
ADD R5, R5, 1
DPOP_Exit
LD R2, DPOP_saveR2
LD R3, DPOP_saveR3
LD R7, DPOP_saveR7
RET
DPOP_saveR2 .blkw 1 ;
DPOP_saveR3 .blkw 1 ;
DPOP_saveR7 .blkw 1 ;
DPOP_base .fill xC001 ;
;from the book:
;
; PUSH, POP Routines
;
; Subroutines for carrying out the PUSH and POP functions. This
; program works with a stack consisting of memory locations x3FFF
; (BASE) through x3FFB (MAX). R6 is the stack pointer.
;
POP ST R2,Save2 ; are needed by POP.
ST R1,Save1
LD R1,BASE ; BASE contains -x3FFF.
ADD R1,R1,#-1 ; R1 contains -x4000.
ADD R2,R6,R1 ; Compare stack pointer to x4000
BRz fail_exit ; Branch if stack is empty.
LDR R0,R6,#0 ; The actual "pop."
ADD R6,R6,#1 ; Adjust stack pointer
BRnzp success_exit
PUSH ST R2,Save2 ; Save registers that
ST R1,Save1 ; are needed by PUSH.
LD R1,MAX ; MAX contains -x3FFB
ADD R2,R6,R1 ; Compare stack pointer to -x3FFB
BRz fail_exit ; Branch if stack is full.
STR R0,R6,#0 ; The actual "push"
ADD R6,R6,#-1 ; Adjust stack pointer
success_exit LD R1,Save1 ; Restore original
LD R2,Save2 ; register values.
AND R5,R5,#0 ; R5 <-- success.
RET
fail_exit LD R1,Save1 ; Restore original
LD R2,Save2 ; register values.
AND R5,R5,#0
ADD R5,R5,#1 ; R5 <-- failure.
RET
BASE .FILL xC001 ; BASE contains -x3FFF.
MAX .FILL xC100
Save1 .FILL x0000
Save2 .FILL x0000
.end | pegurnee/2013-03-221 | Lab11/Lab11.asm | Assembly | mit | 5,901 |
# Any comments on the right hand side of the form "# Rx = " indicate what
# the value of that register should be when HLT prints out. Be careful
# not to change these values once they are set.
# This test is dependency free
# Initialize the registers for testing ease
LLB R1, 0x11 # R1 = 0x0011
LLB R2, 0x22 # R2 = 0x0022
LLB R3, 0x33 # R3 = 0x0033
LLB R4, 0x44 # R4 = 0x0044
LLB R5, 0x55 # R5 = 0x0055
LLB R6, 0x66 # R6 = 0x0066
LLB R7, 0x77 # R7 = 0x0077
LLB R8, 0x88 # R8 = 0xFF88
LLB R9, 0x99 # R9 = 0xFF99
LLB R10, 0xAA # R10 = 0xFFAA
LLB R11, 0xBB # R11 = 0xFFBB
LLB R12, 0xCC # R12 = 0xFFCC
LLB R13, 0xDD # R13 = 0xFFDD
LLB R14, 0xEE # R14 = 0xFFEE
LLB R15, 0xFF # R15 = 0xFFFF
############
# Test AND
AND R1, R2, R3 # R1 = 0x0022
# Test SUB
SUB R2, R3, R2 # R2 = 0x0011
# Test ADD
ADD R3, R3, R4 # R3 = 0x0077 (Non-Saturating)
# Test NOR
NOR R4, R1, R1 # R4 = 0xFFDD
# Test SLL
SLL R5, R1, 8 # R5 = 0x2200
# Test SRL
SRL R6, R1, 4 # R6 = 0x0002
# Test SRA
SRA R7, R1, 4 # R7 = 0x0002
SRA R8, R4, 4 # R8 = 0xFFFD
# Test ADDz
ADDz R1, R1, R1 # R1 should remain unchanged
ADD R0, R0, R0 # Set the Z flag
ADDz R9, R1, R1 # R9 = 0x0044
# Test SW
SW R10, R12, 5 # mem[R12 + 5] <= R10
LW R11, R12, 5 # R11 <= mem[R12 + 5] (should match R10, 0xFFAA)
LLB R13, 0xAB # R13 = 0xFFAB
LLB R14, 0x56 # R14 = 0xFF56
LLB R15, 0xED # R15 = 0xFFED
HLT # Printout should match what's listed above
| somethingnew2-0/CS552-CPU | RoadRunner/programs/no_hazard_test.asm | Assembly | mit | 1,459 |
; 1 2 3 4 5 6 7
;234567890123456789012345678901234567890123456789012345678901234567890
;=====================================================================
;
; *** TEST ***
;
;---------------------------------------------------------------------
;
; AUTHOR: Nik Mohamad Aizuddin bin Nik Azmi
; EMAIL: nickaizuddin93@gmail.com
; DATE CREATED: 10-APR-2015
;
; TEST PURPOSE: Make sure the vec_subtract_vs()
; have no defects.
;
; LANGUAGE: x86 Assembly Language
; ASSEMBLER: NASM
; SYNTAX: Intel
; ARCHITECTURE: x86_64
; KERNEL: Linux x86
; FORMAT: elf32
;
; EXTERNAL FILES: mat_get_element.asm
;
;=====================================================================
;Include constant symbols and global variables
%include "include/constants.inc"
%include "include/data.inc"
extern mat_get_element
extern vec_subtract_vs
global _start
section .text
_start:
;A[:,0] = A[:,0]-B[0,0]
lea eax, [B]
mov ebx, 0
mov ecx, 0
call mat_get_element
lea eax, [A]
lea ebx, [A]
mov ecx, 0b11
mov edx, 0
mov esi, 0
call vec_subtract_vs
b1:
;A[:,2] = A[:,2]-B[2,4]
lea eax, [B]
mov ebx, 2
mov ecx, 4
call mat_get_element
lea eax, [A]
lea ebx, [A]
mov ecx, 0b11
mov edx, 2
mov esi, 2
call vec_subtract_vs
b2:
;A[2,:] = A[2,:]-B[1,3]
lea eax, [B]
mov ebx, 1
mov ecx, 3
call mat_get_element
lea eax, [A]
lea ebx, [A]
mov ecx, 0b00
mov edx, 2
mov esi, 2
call vec_subtract_vs
b3:
exit:
mov eax, SYSCALL_EXIT
mov ebx, 0
int 0x80
| nikAizuddin/lib80386 | src/vector/vec_subtract_vs/test/test.asm | Assembly | mit | 1,818 |
/*
* Copyright 2018-2021 Mahdi Khanalizadeh
*
* 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.
*/
.intel_syntax noprefix
.global linux_syscall4
linux_syscall4:
mov r10, rcx # arg4 -> arg4
mov rax, r8 # arg5 -> #
syscall
ret
| Biolunar/liblinux | src/x86_64/gas/syscall4.asm | Assembly | apache-2.0 | 740 |
; RUSTOS LOADER
; STAGE 2
%include "src/asm_routines/constants.asm"
[BITS 64]
[ORG 0x8000]
stage2:
cli
; update segments
mov dx, GDT_SELECTOR_DATA
mov ss, dx ; stack segment
mov ds, dx ; data segment
mov es, dx ; extra segment
mov fs, dx ; f-segment
mov gs, dx ; g-segment
; SCREEN: top left: "03"
mov dword [0xb8000], 0x2f332f30
; parse and load kernel, an ELF executable "file"
; http://wiki.osdev.org/ELF#Loading_ELF_Binaries
; elf error messages begin with "E"
mov al, 'E'
; magic number 0x7f+'ELF'
; if not elf show error message "E!"
mov ah, '!'
cmp dword [BOOT_KERNEL_LOADPOINT], 0x464c457f
jne error
; bitness and instruction set (must be 64, so values must be 2 and 0x3e) (error code: "EB")
mov ah, 'B'
cmp byte [BOOT_KERNEL_LOADPOINT + 4], 0x2
jne error
cmp word [BOOT_KERNEL_LOADPOINT + 18], 0x3e
jne error
; endianess (must be little endian, so value must be 1) (error code: "EE")
mov ah, 'E'
cmp byte [BOOT_KERNEL_LOADPOINT + 5], 0x1
jne error
; elf version (must be 1) (error code: "EV")
mov ah, 'V'
cmp byte [BOOT_KERNEL_LOADPOINT + 0x0006], 0x1
jne error
; Now lets trust it's actually real and valid elf file
; kernel entry position must be correct
; (error code : "Ep")
mov ah, 'p'
cmp qword [BOOT_KERNEL_LOADPOINT + 24], KERNEL_LOCATION
jne error
; load point is correct, great. print green OK
mov dword [0xb8000 + 80*2], 0x2f4b2f4f
; Parse program headers
; http://wiki.osdev.org/ELF#Program_header
; (error code : "EH")
mov ah, 'H'
; We know that program header size is 56 (=0x38) bytes
; still, lets check it:
cmp word [BOOT_KERNEL_LOADPOINT + 54], 0x38
jne error
; program header table position
mov rbx, qword [BOOT_KERNEL_LOADPOINT + 32]
add rbx, BOOT_KERNEL_LOADPOINT ; now rbx points to first program header
; length of program header table
mov rcx, 0
mov cx, [BOOT_KERNEL_LOADPOINT + 56]
mov ah, '_'
; loop through headers
.loop_headers:
; First, lets check that this segment should be loaded
cmp dword [rbx], 1 ; load: this is important
jne .next ; if not important: continue
; load: clear p_memsz bytes at p_vaddr to 0, then copy p_filesz bytes from p_offset to p_vaddr
push rcx
; esi = p_offset
mov rsi, [rbx + 8]
add rsi, BOOT_KERNEL_LOADPOINT ; now points to begin of buffer we must copy
; rdi = p_vaddr
mov rdi, [rbx + 16]
; rcx = p_memsz
mov rcx, [rbx + 40]
; <1> clear p_memsz bytes at p_vaddr to 0
push rdi
.loop_clear:
mov byte [rdi], 0
inc rdi
loop .loop_clear
pop rdi
; </1>
; rcx = p_filesz
mov rcx, [rbx + 32]
; <2> copy p_filesz bytes from p_offset to p_vaddr
; uses: rsi, rdi, rcx
rep movsb
; </2>
pop rcx
.next:
add rbx, 0x38 ; skip entry (0x38 is entry size)
loop .loop_headers
mov ah, '-'
; ELF relocation done
.over:
; looks good, going to jump to kernel entry
; prints green "JK" for "Jump to Kernel"
mov dword [0xb8000 + 80*4], 0x2f6b2f6a
jmp KERNEL_LOCATION ; jump to kernel
; Prints `ERR: ` and the given 2-character error code to screen (TL) and hangs.
; args: ax=(al,ah)=error_code (2 characters)
error:
mov dword [0xb8000], 0x4f524f45
mov dword [0xb8004], 0x4f3a4f52
mov dword [0xb8008], 0x4f204f20
mov dword [0xb800a], 0x4f204f20
mov byte [0xb800a], al
mov byte [0xb800c], ah
hlt
times (0x200-($-$$)) db 0 ; fill a sector
| Dentosal/rust_os | src/boot/stage2.asm | Assembly | mit | 3,618 |
;
; note register values for "ecx", "edx" and "eax" for instructions between tne nop's
;
SECTION .data
SECTION .text
global _start
_start:
nop
mov ecx, 00000002h
mov edx, 00000000h
mov eax, 00000008h
div ecx
inc ecx
div ecx
nop
mov eax, 1 ; exit system call
mov ebx, 0 ; return code
int 80H ; exit
SECTION .bss
| paulnguyen/cmpe279 | modules/module1/hello/div2.asm | Assembly | apache-2.0 | 341 |
; Boot sector for GeekOS
; Copyright (c) 2001,2004 David H. Hovemeyer <daveho@cs.umd.edu>
; Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
; $Revision: 1.5 $
; This is free software. You are permitted to use,
; redistribute, and modify it as specified in the file "COPYING".
; Loads setup code and a program image from sectors 1..n of a floppy
; and executes the setup code (which will in turn execute
; the program image).
; Some of this code is adapted from Kernel Toolkit 0.2
; and Linux version 2.2.x, so the following copyrights apply:
; Copyright (C) 1991, 1992 Linus Torvalds
; modified by Drew Eckhardt
; modified by Bruce Evans (bde)
; adapted for Kernel Toolkit by Luigi Sgro
%include "defs.asm"
; Pad to desired offset from start symbol.
; Usage: Pad_From_Symbol offset, symbol
%macro Pad_From_Symbol 2
times (%1 - ($ - %2)) db 0
%endmacro
; ----------------------------------------------------------------------
; The actual code
; ----------------------------------------------------------------------
[BITS 16]
[ORG 0x0]
BeginText: ; needed to calculate padding bytes to fill the sector
; Copy the boot sector into INITSEG.
mov ax, BOOTSEG
mov ds, ax ; source segment for string copy
xor si, si ; source index for string copy
mov ax, INITSEG
mov es, ax ; destination segment for string copy
xor di, di ; destination index for string copy
cld ; clear direction flag
mov cx, 256 ; number of words to copy
rep movsw ; copy 512 bytes
jmp INITSEG:after_move
after_move:
; Now we're executing in INITSEG
; We want the data segment to refer to INITSEG
; (since we've defined variables in the same place as the code)
mov ds, ax ; ax still contains INITSEG
; Put the stack in the place where we were originally loaded.
; By definition, there is nothing important there now.
mov ax, 0
mov ss, ax
mov sp, (BOOTSEG << 4) + 512 - 2
load_setup:
; Load the setup code.
mov ax, word [setupStart]
mov word [sec_count], ax
add ax, [setupSize]
mov word [max_sector], ax
.again:
mov ax, [sec_count]
push ax ; 1st param to ReadSector (log sec num)
push word SETUPSEG ; 2nd param to ReadSector (seg base)
sub ax, [setupStart] ; convert to 0-indexed
shl ax, 9 ; multiply by 512
push ax ; ...to get 3rd param (byte offset)
; read the sector from the floppy
call ReadSector
add sp, 6 ; clear 3 word params
; on to next sector
inc word [sec_count]
; are we done?
mov bx, word [max_sector]
cmp word [sec_count], bx
jl .again
load_kernel:
; Load the kernel image from sectors KERN_START_SEC..n of the
; floppy into memory at KERNSEG. Note that there are 128 sectors
; per 64K segment. So, when figuring out which segment to
; load the sector into, we shift right by 7 bits (which is
; equivalent to dividing by 128).
; Figure out start sector and max sector
mov ax, word [kernelStart]
mov word [sec_count], ax
add ax, word [kernelSize]
mov word [max_sector], ax
.again:
mov ax, [sec_count] ; logical sector on the floppy
push ax ; 1st param to ReadSector (log sec num)
sub ax, [kernelStart] ; convert to 0-indexed
mov cx, ax ; save in cx
shr ax, 7 ; divide by 128
shl ax, 12 ; ...and multiply by 0x1000
add ax, KERNSEG ; ...to get base relative to KERNSEG
push ax ; 2nd param to ReadSector (seg base)
and cx, 0x7f ; mod sector by 128
shl cx, 9 ; ...and multiply by 512
push cx ; to get offset in segment (3rd parm)
; read the sector from the floppy
call ReadSector
add sp, 6 ; clear 3 word params
; on to next sector
inc word [sec_count]
; have we loaded all of the sectors?
mov bx, word [max_sector]
cmp word [sec_count], bx
jl .again
; Now we've loaded the setup code and the kernel image.
; Jump to setup code.
jmp SETUPSEG:0
; Read a sector from the floppy drive.
; This code (and the rest of this boot sector) will have to
; be re-written at some point so it reads more than one
; sector at a time.
;
; Parameters:
; - "logical" sector number [bp+8]
; - destination segment [bp+6]
; - destination offset [bp+4]
ReadSector:
push bp ; set up stack frame
mov bp, sp ; "
pusha ; save all registers
%if 0
; debug params
mov dx, [bp+8]
call PrintHex
call PrintNL
mov dx, [bp+6]
call PrintHex
call PrintNL
mov dx, [bp+4]
call PrintHex
call PrintNL
%endif
; Sector = log_sec % SECTORS_PER_TRACK
; Head = (log_sec / SECTORS_PER_TRACK) % HEADS
mov ax, [bp+8] ; get logical sector number from stack
xor dx, dx ; dx is high part of dividend (== 0)
mov bx, SECTORS_PER_TRACK ; divisor
div bx ; do the division
mov [sec], dx ; sector is the remainder
and ax, 1 ; same as mod by HEADS==2 (slight hack)
mov [head], ax
; Track = log_sec / (SECTORS_PER_TRACK*HEADS)
mov ax, [bp+8] ; get logical sector number again
xor dx, dx ; dx is high part of dividend
mov bx, SECTORS_PER_TRACK*2 ; divisor
div bx ; do the division
mov [track], ax ; track is quotient
%if 0
; debugging code
mov dx, [sec]
call PrintHex
call PrintNL
mov dx, [head]
call PrintHex
call PrintNL
mov dx, [track]
call PrintHex
call PrintNL
%endif
; Now, try to actually read the sector from the floppy,
; retrying up to 3 times.
mov [num_retries], byte 0
.again:
mov ax, [bp+6] ; dest segment...
mov es, ax ; goes in es
mov ax, (0x02 << 8) | 1 ; function = 02h in ah,
; # secs = 1 in al
mov bx, [track] ; track number...
mov ch, bl ; goes in ch
mov bx, [sec] ; sector number...
mov cl, bl ; goes in cl...
inc cl ; but it must be 1-based, not 0-based
mov bx, [head] ; head number...
mov dh, bl ; goes in dh
xor dl, dl ; hard code drive=0
mov bx, [bp+4] ; offset goes in bx
; (es:bx points to buffer)
; Call the BIOS Read Diskette Sectors service
int 0x13
; If the carry flag is NOT set, then there was no error
; and we're done.
jnc .done
; Error - code stored in ah
mov dx, ax
call PrintHex
inc byte [num_retries]
cmp byte [num_retries], 3
jne .again
; If we got here, we failed thrice, so we give up
mov dx, 0xdead
call PrintHex
.here: jmp .here
.done:
popa ; restore all regisiters
pop bp ; leave stack frame
ret
; Include utility routines
%include "util.asm"
; ----------------------------------------------------------------------
; Variables
; ----------------------------------------------------------------------
; These are used by ReadSector
head: dw 0
track: dw 0
sec: dw 0
num_retries: db 0
; Used for loops reading sectors from floppy
sec_count: dw 0
max_sector: dw 0
; Padding to make the PFAT Boot Record sit just before the BIOS signature.
Pad_From_Symbol PFAT_BOOT_RECORD_OFFSET, BeginText
; PFAT boot record
; Describes how to load the setup program and kernel.
; The default values are appropriate for creating a boot
; floppy by concatenating the boot sector, setup program,
; and kernel image. The buildFat program will change
; these values if the boot floppy is formatted as a PFAT
; filesystem.
dw 0
dw 0
dw 0
dw 0
dw 0
dw 0
dw 0
dw 0
dw 0
dw 0
;; part of pfat boot record
setupStart:
dw 1 ; by default, setup is at first sector
;; part of pfat boot record
setupSize:
dw NUM_SETUP_SECTORS ; number of sectors in setup
;; part of pfat boot record
kernelStart:
dw 1+NUM_SETUP_SECTORS ; default start sector for kernel
;; part of pfat boot record
kernelSize:
dw NUM_KERN_SECTORS ; number of sectors in kernel
; Finish by writing the BIOS signature to mark this as
; a valid boot sector.
Pad_From_Symbol BIOS_SIGNATURE_OFFSET, BeginText
Signature dw 0xAA55 ; BIOS controls this to ensure this is a boot sector
| Wstyle32/GeekOS---Project0 | src/geekos/fd_boot.asm | Assembly | mit | 7,653 |
_forktest: file format elf32-i386
Disassembly of section .text:
00000000 <printf>:
#define N 1000
void
printf(int fd, char *s, ...)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
write(fd, s, strlen(s));
6: 8b 45 0c mov 0xc(%ebp),%eax
9: 89 04 24 mov %eax,(%esp)
c: e8 9d 01 00 00 call 1ae <strlen>
11: 89 44 24 08 mov %eax,0x8(%esp)
15: 8b 45 0c mov 0xc(%ebp),%eax
18: 89 44 24 04 mov %eax,0x4(%esp)
1c: 8b 45 08 mov 0x8(%ebp),%eax
1f: 89 04 24 mov %eax,(%esp)
22: e8 71 03 00 00 call 398 <write>
}
27: c9 leave
28: c3 ret
00000029 <forktest>:
void
forktest(void)
{
29: 55 push %ebp
2a: 89 e5 mov %esp,%ebp
2c: 83 ec 28 sub $0x28,%esp
int n, pid;
printf(1, "fork test\n");
2f: c7 44 24 04 38 04 00 movl $0x438,0x4(%esp)
36: 00
37: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3e: e8 bd ff ff ff call 0 <printf>
for(n=0; n<N; n++){
43: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
4a: eb 1d jmp 69 <forktest+0x40>
pid = fork();
4c: e8 1f 03 00 00 call 370 <fork>
51: 89 45 f0 mov %eax,-0x10(%ebp)
if(pid < 0)
54: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
58: 78 1a js 74 <forktest+0x4b>
break;
if(pid == 0)
5a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5e: 75 05 jne 65 <forktest+0x3c>
exit();
60: e8 13 03 00 00 call 378 <exit>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<N; n++){
65: 83 45 f4 01 addl $0x1,-0xc(%ebp)
69: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
70: 7e da jle 4c <forktest+0x23>
72: eb 01 jmp 75 <forktest+0x4c>
pid = fork();
if(pid < 0)
break;
74: 90 nop
if(pid == 0)
exit();
}
if(n == N){
75: 81 7d f4 e8 03 00 00 cmpl $0x3e8,-0xc(%ebp)
7c: 75 47 jne c5 <forktest+0x9c>
printf(1, "fork claimed to work N times!\n", N);
7e: c7 44 24 08 e8 03 00 movl $0x3e8,0x8(%esp)
85: 00
86: c7 44 24 04 44 04 00 movl $0x444,0x4(%esp)
8d: 00
8e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
95: e8 66 ff ff ff call 0 <printf>
exit();
9a: e8 d9 02 00 00 call 378 <exit>
}
for(; n > 0; n--){
if(wait() < 0){
9f: e8 dc 02 00 00 call 380 <wait>
a4: 85 c0 test %eax,%eax
a6: 79 19 jns c1 <forktest+0x98>
printf(1, "wait stopped early\n");
a8: c7 44 24 04 63 04 00 movl $0x463,0x4(%esp)
af: 00
b0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b7: e8 44 ff ff ff call 0 <printf>
exit();
bc: e8 b7 02 00 00 call 378 <exit>
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
}
for(; n > 0; n--){
c1: 83 6d f4 01 subl $0x1,-0xc(%ebp)
c5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
c9: 7f d4 jg 9f <forktest+0x76>
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
cb: e8 b0 02 00 00 call 380 <wait>
d0: 83 f8 ff cmp $0xffffffff,%eax
d3: 74 19 je ee <forktest+0xc5>
printf(1, "wait got too many\n");
d5: c7 44 24 04 77 04 00 movl $0x477,0x4(%esp)
dc: 00
dd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e4: e8 17 ff ff ff call 0 <printf>
exit();
e9: e8 8a 02 00 00 call 378 <exit>
}
printf(1, "fork test OK\n");
ee: c7 44 24 04 8a 04 00 movl $0x48a,0x4(%esp)
f5: 00
f6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
fd: e8 fe fe ff ff call 0 <printf>
}
102: c9 leave
103: c3 ret
00000104 <main>:
int
main(void)
{
104: 55 push %ebp
105: 89 e5 mov %esp,%ebp
107: 83 e4 f0 and $0xfffffff0,%esp
forktest();
10a: e8 1a ff ff ff call 29 <forktest>
exit();
10f: e8 64 02 00 00 call 378 <exit>
00000114 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
114: 55 push %ebp
115: 89 e5 mov %esp,%ebp
117: 57 push %edi
118: 53 push %ebx
asm volatile("cld; rep stosb" :
119: 8b 4d 08 mov 0x8(%ebp),%ecx
11c: 8b 55 10 mov 0x10(%ebp),%edx
11f: 8b 45 0c mov 0xc(%ebp),%eax
122: 89 cb mov %ecx,%ebx
124: 89 df mov %ebx,%edi
126: 89 d1 mov %edx,%ecx
128: fc cld
129: f3 aa rep stos %al,%es:(%edi)
12b: 89 ca mov %ecx,%edx
12d: 89 fb mov %edi,%ebx
12f: 89 5d 08 mov %ebx,0x8(%ebp)
132: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
135: 5b pop %ebx
136: 5f pop %edi
137: 5d pop %ebp
138: c3 ret
00000139 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
139: 55 push %ebp
13a: 89 e5 mov %esp,%ebp
13c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
13f: 8b 45 08 mov 0x8(%ebp),%eax
142: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
145: 90 nop
146: 8b 45 0c mov 0xc(%ebp),%eax
149: 0f b6 10 movzbl (%eax),%edx
14c: 8b 45 08 mov 0x8(%ebp),%eax
14f: 88 10 mov %dl,(%eax)
151: 8b 45 08 mov 0x8(%ebp),%eax
154: 0f b6 00 movzbl (%eax),%eax
157: 84 c0 test %al,%al
159: 0f 95 c0 setne %al
15c: 83 45 08 01 addl $0x1,0x8(%ebp)
160: 83 45 0c 01 addl $0x1,0xc(%ebp)
164: 84 c0 test %al,%al
166: 75 de jne 146 <strcpy+0xd>
;
return os;
168: 8b 45 fc mov -0x4(%ebp),%eax
}
16b: c9 leave
16c: c3 ret
0000016d <strcmp>:
int
strcmp(const char *p, const char *q)
{
16d: 55 push %ebp
16e: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
170: eb 08 jmp 17a <strcmp+0xd>
p++, q++;
172: 83 45 08 01 addl $0x1,0x8(%ebp)
176: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
17a: 8b 45 08 mov 0x8(%ebp),%eax
17d: 0f b6 00 movzbl (%eax),%eax
180: 84 c0 test %al,%al
182: 74 10 je 194 <strcmp+0x27>
184: 8b 45 08 mov 0x8(%ebp),%eax
187: 0f b6 10 movzbl (%eax),%edx
18a: 8b 45 0c mov 0xc(%ebp),%eax
18d: 0f b6 00 movzbl (%eax),%eax
190: 38 c2 cmp %al,%dl
192: 74 de je 172 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
194: 8b 45 08 mov 0x8(%ebp),%eax
197: 0f b6 00 movzbl (%eax),%eax
19a: 0f b6 d0 movzbl %al,%edx
19d: 8b 45 0c mov 0xc(%ebp),%eax
1a0: 0f b6 00 movzbl (%eax),%eax
1a3: 0f b6 c0 movzbl %al,%eax
1a6: 89 d1 mov %edx,%ecx
1a8: 29 c1 sub %eax,%ecx
1aa: 89 c8 mov %ecx,%eax
}
1ac: 5d pop %ebp
1ad: c3 ret
000001ae <strlen>:
uint
strlen(char *s)
{
1ae: 55 push %ebp
1af: 89 e5 mov %esp,%ebp
1b1: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1b4: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1bb: eb 04 jmp 1c1 <strlen+0x13>
1bd: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1c1: 8b 45 fc mov -0x4(%ebp),%eax
1c4: 03 45 08 add 0x8(%ebp),%eax
1c7: 0f b6 00 movzbl (%eax),%eax
1ca: 84 c0 test %al,%al
1cc: 75 ef jne 1bd <strlen+0xf>
;
return n;
1ce: 8b 45 fc mov -0x4(%ebp),%eax
}
1d1: c9 leave
1d2: c3 ret
000001d3 <memset>:
void*
memset(void *dst, int c, uint n)
{
1d3: 55 push %ebp
1d4: 89 e5 mov %esp,%ebp
1d6: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
1d9: 8b 45 10 mov 0x10(%ebp),%eax
1dc: 89 44 24 08 mov %eax,0x8(%esp)
1e0: 8b 45 0c mov 0xc(%ebp),%eax
1e3: 89 44 24 04 mov %eax,0x4(%esp)
1e7: 8b 45 08 mov 0x8(%ebp),%eax
1ea: 89 04 24 mov %eax,(%esp)
1ed: e8 22 ff ff ff call 114 <stosb>
return dst;
1f2: 8b 45 08 mov 0x8(%ebp),%eax
}
1f5: c9 leave
1f6: c3 ret
000001f7 <strchr>:
char*
strchr(const char *s, char c)
{
1f7: 55 push %ebp
1f8: 89 e5 mov %esp,%ebp
1fa: 83 ec 04 sub $0x4,%esp
1fd: 8b 45 0c mov 0xc(%ebp),%eax
200: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
203: eb 14 jmp 219 <strchr+0x22>
if(*s == c)
205: 8b 45 08 mov 0x8(%ebp),%eax
208: 0f b6 00 movzbl (%eax),%eax
20b: 3a 45 fc cmp -0x4(%ebp),%al
20e: 75 05 jne 215 <strchr+0x1e>
return (char*)s;
210: 8b 45 08 mov 0x8(%ebp),%eax
213: eb 13 jmp 228 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
215: 83 45 08 01 addl $0x1,0x8(%ebp)
219: 8b 45 08 mov 0x8(%ebp),%eax
21c: 0f b6 00 movzbl (%eax),%eax
21f: 84 c0 test %al,%al
221: 75 e2 jne 205 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
223: b8 00 00 00 00 mov $0x0,%eax
}
228: c9 leave
229: c3 ret
0000022a <gets>:
char*
gets(char *buf, int max)
{
22a: 55 push %ebp
22b: 89 e5 mov %esp,%ebp
22d: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
230: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
237: eb 44 jmp 27d <gets+0x53>
cc = read(0, &c, 1);
239: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
240: 00
241: 8d 45 ef lea -0x11(%ebp),%eax
244: 89 44 24 04 mov %eax,0x4(%esp)
248: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24f: e8 3c 01 00 00 call 390 <read>
254: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
257: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
25b: 7e 2d jle 28a <gets+0x60>
break;
buf[i++] = c;
25d: 8b 45 f4 mov -0xc(%ebp),%eax
260: 03 45 08 add 0x8(%ebp),%eax
263: 0f b6 55 ef movzbl -0x11(%ebp),%edx
267: 88 10 mov %dl,(%eax)
269: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(c == '\n' || c == '\r')
26d: 0f b6 45 ef movzbl -0x11(%ebp),%eax
271: 3c 0a cmp $0xa,%al
273: 74 16 je 28b <gets+0x61>
275: 0f b6 45 ef movzbl -0x11(%ebp),%eax
279: 3c 0d cmp $0xd,%al
27b: 74 0e je 28b <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
27d: 8b 45 f4 mov -0xc(%ebp),%eax
280: 83 c0 01 add $0x1,%eax
283: 3b 45 0c cmp 0xc(%ebp),%eax
286: 7c b1 jl 239 <gets+0xf>
288: eb 01 jmp 28b <gets+0x61>
cc = read(0, &c, 1);
if(cc < 1)
break;
28a: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
28b: 8b 45 f4 mov -0xc(%ebp),%eax
28e: 03 45 08 add 0x8(%ebp),%eax
291: c6 00 00 movb $0x0,(%eax)
return buf;
294: 8b 45 08 mov 0x8(%ebp),%eax
}
297: c9 leave
298: c3 ret
00000299 <stat>:
int
stat(char *n, struct stat *st)
{
299: 55 push %ebp
29a: 89 e5 mov %esp,%ebp
29c: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
29f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2a6: 00
2a7: 8b 45 08 mov 0x8(%ebp),%eax
2aa: 89 04 24 mov %eax,(%esp)
2ad: e8 06 01 00 00 call 3b8 <open>
2b2: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2b5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2b9: 79 07 jns 2c2 <stat+0x29>
return -1;
2bb: b8 ff ff ff ff mov $0xffffffff,%eax
2c0: eb 23 jmp 2e5 <stat+0x4c>
r = fstat(fd, st);
2c2: 8b 45 0c mov 0xc(%ebp),%eax
2c5: 89 44 24 04 mov %eax,0x4(%esp)
2c9: 8b 45 f4 mov -0xc(%ebp),%eax
2cc: 89 04 24 mov %eax,(%esp)
2cf: e8 fc 00 00 00 call 3d0 <fstat>
2d4: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2d7: 8b 45 f4 mov -0xc(%ebp),%eax
2da: 89 04 24 mov %eax,(%esp)
2dd: e8 be 00 00 00 call 3a0 <close>
return r;
2e2: 8b 45 f0 mov -0x10(%ebp),%eax
}
2e5: c9 leave
2e6: c3 ret
000002e7 <atoi>:
int
atoi(const char *s)
{
2e7: 55 push %ebp
2e8: 89 e5 mov %esp,%ebp
2ea: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
2ed: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
2f4: eb 23 jmp 319 <atoi+0x32>
n = n*10 + *s++ - '0';
2f6: 8b 55 fc mov -0x4(%ebp),%edx
2f9: 89 d0 mov %edx,%eax
2fb: c1 e0 02 shl $0x2,%eax
2fe: 01 d0 add %edx,%eax
300: 01 c0 add %eax,%eax
302: 89 c2 mov %eax,%edx
304: 8b 45 08 mov 0x8(%ebp),%eax
307: 0f b6 00 movzbl (%eax),%eax
30a: 0f be c0 movsbl %al,%eax
30d: 01 d0 add %edx,%eax
30f: 83 e8 30 sub $0x30,%eax
312: 89 45 fc mov %eax,-0x4(%ebp)
315: 83 45 08 01 addl $0x1,0x8(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
319: 8b 45 08 mov 0x8(%ebp),%eax
31c: 0f b6 00 movzbl (%eax),%eax
31f: 3c 2f cmp $0x2f,%al
321: 7e 0a jle 32d <atoi+0x46>
323: 8b 45 08 mov 0x8(%ebp),%eax
326: 0f b6 00 movzbl (%eax),%eax
329: 3c 39 cmp $0x39,%al
32b: 7e c9 jle 2f6 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
32d: 8b 45 fc mov -0x4(%ebp),%eax
}
330: c9 leave
331: c3 ret
00000332 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
332: 55 push %ebp
333: 89 e5 mov %esp,%ebp
335: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
338: 8b 45 08 mov 0x8(%ebp),%eax
33b: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
33e: 8b 45 0c mov 0xc(%ebp),%eax
341: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
344: eb 13 jmp 359 <memmove+0x27>
*dst++ = *src++;
346: 8b 45 f8 mov -0x8(%ebp),%eax
349: 0f b6 10 movzbl (%eax),%edx
34c: 8b 45 fc mov -0x4(%ebp),%eax
34f: 88 10 mov %dl,(%eax)
351: 83 45 fc 01 addl $0x1,-0x4(%ebp)
355: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
359: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
35d: 0f 9f c0 setg %al
360: 83 6d 10 01 subl $0x1,0x10(%ebp)
364: 84 c0 test %al,%al
366: 75 de jne 346 <memmove+0x14>
*dst++ = *src++;
return vdst;
368: 8b 45 08 mov 0x8(%ebp),%eax
}
36b: c9 leave
36c: c3 ret
36d: 90 nop
36e: 90 nop
36f: 90 nop
00000370 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
370: b8 01 00 00 00 mov $0x1,%eax
375: cd 40 int $0x40
377: c3 ret
00000378 <exit>:
SYSCALL(exit)
378: b8 02 00 00 00 mov $0x2,%eax
37d: cd 40 int $0x40
37f: c3 ret
00000380 <wait>:
SYSCALL(wait)
380: b8 03 00 00 00 mov $0x3,%eax
385: cd 40 int $0x40
387: c3 ret
00000388 <pipe>:
SYSCALL(pipe)
388: b8 04 00 00 00 mov $0x4,%eax
38d: cd 40 int $0x40
38f: c3 ret
00000390 <read>:
SYSCALL(read)
390: b8 05 00 00 00 mov $0x5,%eax
395: cd 40 int $0x40
397: c3 ret
00000398 <write>:
SYSCALL(write)
398: b8 10 00 00 00 mov $0x10,%eax
39d: cd 40 int $0x40
39f: c3 ret
000003a0 <close>:
SYSCALL(close)
3a0: b8 15 00 00 00 mov $0x15,%eax
3a5: cd 40 int $0x40
3a7: c3 ret
000003a8 <kill>:
SYSCALL(kill)
3a8: b8 06 00 00 00 mov $0x6,%eax
3ad: cd 40 int $0x40
3af: c3 ret
000003b0 <exec>:
SYSCALL(exec)
3b0: b8 07 00 00 00 mov $0x7,%eax
3b5: cd 40 int $0x40
3b7: c3 ret
000003b8 <open>:
SYSCALL(open)
3b8: b8 0f 00 00 00 mov $0xf,%eax
3bd: cd 40 int $0x40
3bf: c3 ret
000003c0 <mknod>:
SYSCALL(mknod)
3c0: b8 11 00 00 00 mov $0x11,%eax
3c5: cd 40 int $0x40
3c7: c3 ret
000003c8 <unlink>:
SYSCALL(unlink)
3c8: b8 12 00 00 00 mov $0x12,%eax
3cd: cd 40 int $0x40
3cf: c3 ret
000003d0 <fstat>:
SYSCALL(fstat)
3d0: b8 08 00 00 00 mov $0x8,%eax
3d5: cd 40 int $0x40
3d7: c3 ret
000003d8 <link>:
SYSCALL(link)
3d8: b8 13 00 00 00 mov $0x13,%eax
3dd: cd 40 int $0x40
3df: c3 ret
000003e0 <mkdir>:
SYSCALL(mkdir)
3e0: b8 14 00 00 00 mov $0x14,%eax
3e5: cd 40 int $0x40
3e7: c3 ret
000003e8 <chdir>:
SYSCALL(chdir)
3e8: b8 09 00 00 00 mov $0x9,%eax
3ed: cd 40 int $0x40
3ef: c3 ret
000003f0 <dup>:
SYSCALL(dup)
3f0: b8 0a 00 00 00 mov $0xa,%eax
3f5: cd 40 int $0x40
3f7: c3 ret
000003f8 <getpid>:
SYSCALL(getpid)
3f8: b8 0b 00 00 00 mov $0xb,%eax
3fd: cd 40 int $0x40
3ff: c3 ret
00000400 <sbrk>:
SYSCALL(sbrk)
400: b8 0c 00 00 00 mov $0xc,%eax
405: cd 40 int $0x40
407: c3 ret
00000408 <sleep>:
SYSCALL(sleep)
408: b8 0d 00 00 00 mov $0xd,%eax
40d: cd 40 int $0x40
40f: c3 ret
00000410 <uptime>:
SYSCALL(uptime)
410: b8 0e 00 00 00 mov $0xe,%eax
415: cd 40 int $0x40
417: c3 ret
00000418 <halt>:
SYSCALL(halt)
418: b8 16 00 00 00 mov $0x16,%eax
41d: cd 40 int $0x40
41f: c3 ret
00000420 <clone>:
SYSCALL(clone)
420: b8 19 00 00 00 mov $0x19,%eax
425: cd 40 int $0x40
427: c3 ret
00000428 <join>:
SYSCALL(join)
428: b8 1a 00 00 00 mov $0x1a,%eax
42d: cd 40 int $0x40
42f: c3 ret
00000430 <texit>:
SYSCALL(texit)
430: b8 1b 00 00 00 mov $0x1b,%eax
435: cd 40 int $0x40
437: c3 ret
| johnhhyang/os2 | forktest.asm | Assembly | mit | 21,124 |
;; Автор: CyberLight
;; Использование макро-команд
%include "stud_io.inc"
global _start
section .text
_start: xor eax, eax ;Очищаем регистр eax - он будет использован в качестве счетчика кол-ва напечатанных слов
again: PRINT "Hello" ;Вызов макроса для печати "Hello" на экран
PUTCHAR 10 ;Вывод символа перевода каретки на начало строки
inc eax ;Увеличиваем счетчик на 1
cmp al, 5 ;Проверяем - значеие al регистра с числом 5
jl again ;Если еще не напечатали 5 раз то возвращаемся к печати слова "Hello" снова
FINISH ;Вызов макроса для корректного завершения программы
| CyberLight/nasm-learn | print_hello_use_macro/print_hello_use_macro.asm | Assembly | mit | 908 |
#EXPORT main
main:
LI R1, 20 ; prepare values
LI R2, 0x36 ; ; ; ; ; more comments !
ADD R3, R1, R2 ; addddddddd
SUB R4, R2, R1 ; subtract !!!!
MUL R5, R1, R2 ; multiply !
DIV R6, R1, R2 ; try the div its good
OR R7, R1, R2 ; and operation
HALT ; stop execution | ah450/RiSC-16-Simulator | test2.asm | Assembly | mit | 294 |
;Este es un comentario, se le antecede un punto y coma
list p=18f4550 ;Modelo del microcontrolador
#include <p18f4550.inc> ;Llamada a la librería de nombre de los registros
;Directivas de preprocesador o bits de configuración
CONFIG PLLDIV = 1 ; PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
CONFIG CPUDIV = OSC1_PLL2 ; System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
CONFIG CCP2MX = ON ; CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
CONFIG MCLRE = ON ; MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
cblock 0x0000
var_1ms
var_i
var_j
var_k
endc
org 0x0500
mensaje_1 db 0x39, 0x77, 0x6D, 0x77 ;CASA
org 0x0600
mensaje_2 db 0x73, 0x79, 0x50, 0x3E ;PErU
org 0x0000 ;vector de reset
goto init_conf
org 0x0008 ;vector de interrupcion
goto Timer0_ISR
org 0x0020 ;zona de programa de usuario
init_conf: movlw 0x80
movwf TRISD ;RD(6:0) son salidas
movlw 0xF0
movwf TRISB ;RB(3:0) son salidas
clrf LATB ;Los cuatro habilitadores del display en cero
movlw 0xC5
movwf T0CON ;TMR0 on, fosc/4, psc 1:64, modo 8 bit
movlw 0xA0
movwf INTCON ;GIE=1, TMR0IE=1 (interrupciones activadas para el desborde del TMR0)
movlw .126
movwf TMR0L ;carga de cuenta inicial al Timer0
loop: movlw 0x05
movwf TBLPTRH
call delay_long
movlw 0x06
movwf TBLPTRH
call delay_long
goto loop
Timer0_ISR: clrf TBLPTRL
TBLRD*+
movff TABLAT, LATD
bsf LATB, 0 ;digito0 encendido
call delay_1ms
bcf LATB, 0 ;digito0 apagado
TBLRD*+
movff TABLAT, LATD
bsf LATB, 1 ;digito1 encendido
call delay_1ms
bcf LATB, 1 ;digito1 apagado
TBLRD*+
movff TABLAT, LATD
bsf LATB, 2 ;digito2 encendido
call delay_1ms
bcf LATB, 2 ;digito2 apagado
TBLRD*
movff TABLAT, LATD
bsf LATB, 3 ;digito3 encendido
call delay_1ms
bcf LATB, 3 ;digito3 apagado
bcf INTCON, TMR0IF ;bajamos la bandera del desborde del Timer0
retfie
delay_1ms: movlw 0x90
movwf var_1ms
otro: decfsz var_1ms, f
goto aun_no
return
aun_no: nop
nop
goto otro
delay_long:
movlw .100
movwf var_i
otro1:
call bucle1 ;Salto a subrutina
decfsz var_i,f
goto otro1
return
bucle1:
movlw .50
movwf var_j
otro2:
nop
nop
call bucle2 ;Salto a subrutina
decfsz var_j,f
goto otro2
return
bucle2:
movlw .50
movwf var_k
otro3:
nop
decfsz var_k,f
goto otro3
return
end
| tocache/picomones | UPC Microcontroladores 2021-1/Semana 07/20211_ls5a_cuadrada_tmr0_1k.X/20211_ls53_mux7s_b.X/maincode_2.asm | Assembly | cc0-1.0 | 3,399 |
/*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
* http://www.opensource.org/licenses/eclipse-1.0.php.
*
*/
// Module name: PL16x8_PL8x4.asm
//----------------------------------------------------------------
#include "common.inc"
#ifndef DEST_U //DEST_U, DEST_V not defined
#if (nSRC_REGION==nREGION_1)
#define DEST_Y uwTOP_Y
#define DEST_U uwTOP_U
#define DEST_V uwTOP_V
#elif (nSRC_REGION==nREGION_2)
#define DEST_Y uwBOT_Y
#define DEST_U uwBOT_U
#define DEST_V uwBOT_V
#endif
#endif
//Convert 444 from sampler to 422
$for (0, 0; <8; 2, 1) {
mov (8) DEST_U(0,%2*8)<1> DEST_U(%1)<16;8,2>
mov (8) DEST_V(0,%2*8)<1> DEST_V(%1)<16;8,2>
}
// Re-define new number of lines
#undef nUV_NUM_OF_ROWS
#define nUV_NUM_OF_ROWS 4
| fritsch/libva-intel-driver | src/shaders/post_processing/gen5_6/Common/PL16x8_PL8x4.asm | Assembly | mit | 935 |
; Generated at 22-5-2015 19:17:06
%ifndef Exclude_IOPort_Based_SerialInit
DebugStub_InitSerial:
Mov DX, 1
Mov AL, 0
Call DebugStub_WriteRegister
Mov DX, 3
Mov AL, 0x80
Call DebugStub_WriteRegister
Mov DX, 0
Mov AL, 0x01
Call DebugStub_WriteRegister
Mov DX, 1
Mov AL, 0x00
Call DebugStub_WriteRegister
Mov DX, 3
Mov AL, 0x03
Call DebugStub_WriteRegister
Mov DX, 2
Mov AL, 0xC7
Call DebugStub_WriteRegister
Mov DX, 4
Mov AL, 0x03
Call DebugStub_WriteRegister
DebugStub_InitSerial_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_InitSerial_Exit
Ret
DebugStub_ComReadAL:
Mov DX, 5
DebugStub_ComReadAL_Wait:
Call DebugStub_ReadRegister
Test AL, 0x01
JZ DebugStub_ComReadAL_Wait
Mov DX, 0
Call DebugStub_ReadRegister
DebugStub_ComReadAL_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_ComReadAL_Exit
Ret
DebugStub_ComWrite8:
Mov DX, 5
DebugStub_ComWrite8_Wait:
Call DebugStub_ReadRegister
Test AL, 0x20
JZ DebugStub_ComWrite8_Wait
Mov DX, 0
Mov AL, [ESI + 0]
Call DebugStub_WriteRegister
Inc ESI
DebugStub_ComWrite8_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_ComWrite8_Exit
Ret
%endif
| MetSystem/Cosmos | source/Cosmos.Debug.DebugStub/Serial.asm | Assembly | bsd-3-clause | 1,290 |
;Simple example of removing a directory with the rmdir API call. API calls found in this example program:
; rmdir, exit
; High level description of what theis example program does:
; Attempts ot remove the directory 'newdir' if it exists, using the rmdir API
; exits gracefully with exit().
section .text
global _start
_start:
; Attempts ot remove the directory 'newdir' if it exists, using the rmdir API
;------------------------------------------------------------------------------
mov eax, 40 ;rmdir
mov ebx, newdir ;pointer to the directory name
int 0x80
; Exit program
;------------------------------------------------------------------------------
mov eax, 1
int 0x80
section .data
newdir db 'newdir', 0x00
; ------------------------------
; | Some bitfield explanations |
; ------------------------------
; Mode Octal codes
;------------------------------------------------------------------------------
; Read 4
; Write 2
; Execute 1 | XlogicX/Learn | ASM_x86/LinuxAPI_09_rmdir.asm | Assembly | mit | 967 |
/*
* This file is a part of the open source stm32plus library.
* Copyright (c) 2011,2012 Andy Brown <www.andybrown.me.uk>
* Please see website for licensing terms.
*/
.global BulbPixels
.global BulbPixelsSize
.global AudioPixels
.global AudioPixelsSize
.global DocPixels
.global DocPixelsSize
.global FlagPixels
.global FlagPixelsSize
.global GlobePixels
.global GlobePixelsSize
BulbPixels:
.incbin "lzg/r61523/bulb.r61523.64.lzg"
BulbPixelsSize=.-BulbPixels
AudioPixels:
.incbin "lzg/r61523/audio.r61523.64.lzg"
AudioPixelsSize=.-AudioPixels
DocPixels:
.incbin "lzg/r61523/doc.r61523.64.lzg"
DocPixelsSize=.-DocPixels
GlobePixels:
.incbin "lzg/r61523/globe.r61523.64.lzg"
GlobePixelsSize=.-GlobePixels
FlagPixels:
.incbin "lzg/r61523/flag.r61523.64.lzg"
FlagPixelsSize=.-FlagPixels
| tokoro10g/stm32plus | examples/r61523_mdvl/CompressedPixels.asm | Assembly | bsd-3-clause | 830 |
[bits 32]
global idt_pointer
idt_pointer:
dd 0
dd 0
global load_idt
load_idt:
lidt [idt_pointer]
sti
ret
| campaul/vermilion | kernel/_idt.asm | Assembly | mit | 127 |
// this is a test comment at beginning
.CONSTANT
.DATA
// get ready for some code
.CODE
SET0 0x01
SET1 03
INT 02 // do something here, skip comment
SET0 02
SET1 0x43
INT 02
HALT
| jmacIndy/cpu | casm/sample2.asm | Assembly | mit | 213 |
os.seq :
push ebx
push ecx
push edx
seq.loop_0.start :
mov cl, [eax]
mov dl, [ebx]
cmp cl, 0
je seq.loop_0.go
cmp cl, dl
jne seq.loop_0.end
add eax, 1
add ebx, 1
jmp seq.loop_0.start
seq.loop_0.go :
pop edx
pop ecx
pop ebx
mov al, 0x1
ret
seq.loop_0.end :
pop edx
pop ecx
pop ebx
mov al, 0x0
ret
os.lenientStringMatch : ; eax is null-terminated, ebx is NOT; return in dh
push ecx
push ebx
os.lenientStringMatch.loop :
mov cl, [eax]
mov ch, [ebx]
add eax, 1
add ebx, 1
cmp cl, ch
je os.lenientStringMatch.loop
cmp cl, 0x0
je os.lenientStringMatch.equal
sub eax, 1
os.lenientStringMatch.eloop :
mov cl, [eax]
add eax, 1
cmp cl, 0x0
jne os.lenientStringMatch.eloop
mov dh, 0x0
jmp os.lenientStringMatch.ret
os.lenientStringMatch.equal :
mov dh, 0xFF
os.lenientStringMatch.ret :
call debug.newl
pop ebx
pop ecx
ret
| jaredwhitney/os3 | Tools/String/EqualityTests.asm | Assembly | mit | 906 |
Map_2294B4: dc.w Frame_2294C8-Map_2294B4 ; ...
dc.w Frame_2294CC-Map_2294B4
dc.w Frame_2294DA-Map_2294B4
dc.w Frame_2294FA-Map_2294B4
dc.w Frame_229514-Map_2294B4
dc.w Frame_229540-Map_2294B4
Map_AIZDisappearingFloor2:
Map_2294C0: dc.w Frame_229566-Map_2294C0 ; ...
dc.w Frame_2295A4-Map_2294C0
dc.w Frame_2295D6-Map_2294C0
dc.w Frame_229608-Map_2294C0
Frame_2294C8: dc.w 0
dc.b 0
dc.b 0
Frame_2294CC: dc.w 2
dc.b $E8, 5, 3,$1D,$FF,$F0
dc.b $E8, 5, $B,$1D, 0, 0
Frame_2294DA: dc.w 5
dc.b $E8, 5, $B,$1D,$FF,$E8
dc.b $E8, 5, 3,$1D,$FF,$F8
dc.b $E8, 5, 3,$1D, 0, 8
dc.b $F8, 5,$13,$1D,$FF,$F0
dc.b $F8, 5,$13,$1D, 0, 0
Frame_2294FA: dc.w 4
dc.b $E8, 7, 3,$21,$FF,$E0
dc.b $E8, 7, $B,$21,$FF,$F0
dc.b $E8, 7, 3,$21, 0, 0
dc.b $E8, 7, $B,$21, 0,$10
Frame_229514: dc.w 7
dc.b $E8, $D, 0,$2A,$FF,$E0
dc.b $E8, $D, 0,$2A, 0, 0
dc.b $F8, $D, 3,$29,$FF,$E0
dc.b $F8, $D, $B,$29, 0, 0
dc.b 8, 5,$1B,$1D,$FF,$E8
dc.b 8, 5, $B,$1D,$FF,$F8
dc.b 8, 5,$13,$1D, 0, 8
Frame_229540: dc.w 6
dc.b $E8, $D, 0,$2A,$FF,$E0
dc.b $F8, $D,$10,$16,$FF,$E0
dc.b 8, $D, 0,$32,$FF,$E0
dc.b $E8, $D, 0,$2A, 0, 0
dc.b $F8, $D,$10,$16, 0, 0
dc.b 8, $D, 8,$32, 0, 0
Frame_229566: dc.w $A
dc.b $D8, $A, 0,$49,$FF,$D0
dc.b $E0, 9, 0,$52,$FF,$E8
dc.b $E0, 9, 8,$52, 0, 0
dc.b $D8, $A, 8,$49, 0,$18
dc.b $F0, 5, 0,$58,$FF,$D0
dc.b $F0, 5, 8,$58, 0,$20
dc.b 0, 7, 0,$5C,$FF,$D8
dc.b 0, 7, 8,$5C, 0,$18
dc.b $10, 9, 0,$64,$FF,$E8
dc.b $10, 9, 8,$64, 0, 0
Frame_2295A4: dc.w 8
dc.b $E0, 7,$10,$5C,$FF,$D8
dc.b $E0, 9, 8,$64,$FF,$E8
dc.b $E0, 9, 0,$64, 0, 0
dc.b $E0, 7,$18,$5C, 0,$18
dc.b 0, 7, 0,$6A,$FF,$D8
dc.b 0, 7, 8,$6A, 0,$18
Frame_2295CA: dc.b $10, 9,$10,$64,$FF,$E8
dc.b $10, 9,$18,$64, 0, 0
Frame_2295D6: dc.w 8
dc.b $E0, 7,$10,$6A,$FF,$D8
dc.b $E0, 9, 0,$64,$FF,$E8
dc.b $E0, 9, 8,$64, 0, 0
dc.b $E0, 7,$18,$6A, 0,$18
dc.b 0, 7, 0,$5C,$FF,$D8
dc.b 0, 7, 8,$5C, 0,$18
dc.b $10, 9, 0,$52,$FF,$E8
dc.b $10, 9, 8,$52, 0, 0
Frame_229608: dc.w 8
dc.b $E0, 7,$10,$5C,$FF,$D8
dc.b $E0, 9,$18,$52,$FF,$E8
dc.b $E0, 9,$10,$52, 0, 0
dc.b $E0, 7,$18,$5C, 0,$18
dc.b 0, 7, 0,$6A,$FF,$D8
dc.b 0, 7, 8,$6A, 0,$18
dc.b $10, 9, 8,$52,$FF,$E8
dc.b $10, 9, 0,$52, 0, 0 | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | Working Disassembly/Levels/AIZ/Misc Object Data/Map - Disappearing Floor.asm | Assembly | apache-2.0 | 2,411 |
TITLE 12080912 FINAL
.MODEL SMALL
.STACK 64
.DATA
NEW_FILE_TITLE DB ' UNTITLED TEXT FILE ' ;»õÆÄÀÏ Á¦¸ñ ÅØ½ºÆ®
FILE_TITLE DB 22 DUP (' ') ;ÆÄÀÏ Á¦¸ñ ÅØ½ºÆ®
FRAME DB 0C9H, 2 DUP ( 0CDH ), ' EDITOR : ', 66 DUP ( 0CDH ), 0BBH ;¿¡µðÅÍ Æ²
DB 22 DUP( 0BAH, 78 DUP (' '), 0BAH )
MENU_STR DB ' ', 0AFH,' Press F1-Menu', 46 DUP(' '),'|ROW: COL: '
HELP_MENU_STR DB ? ;µµ¿ò¸» ÅØ½ºÆ®
COUNT_ROW DB ?
ROW DB 1 ;ÇöÀç Çà
COL DB 1 ;ÇöÀç ¿
LEFT_LIM EQU 1 ;¿ÞÂÊ ÇѰè
RIGHT_LIM EQU 4EH ;¿À¸¥ÂÊ ÇѰè
TOP_LIM EQU 1 ;À§ÂÊ ÇѰè
BTM_LIM EQU 22 ;¾Æ·¡ÂÊ ÇѰè
ROWLEN DB 78 ;ÇÑÁÙÀÇ Ä °¹¼ö
ESC_CHK DB 0 ;ESC°¡ ´·È´ÂÁö üũÇÏ´Â º¯¼ö
TEXT_AREA DB 1800 DUP (' '), 0DH, 0AH ; ÅØ½ºÆ® ÀúÀ念¿ª
CALROW DB 2 DUP (' ')
CALCOL DB 2 DUP (' ')
;------------------------------------------------
MTOPROW EQU 08 ;¸Þ´º¿¡¼ÀÇ ÀÁÙ
MBOTROW EQU 14 ;¸Þ´º¿¡¼ÀÇ ¾Æ·§ÁÙ
MLEFCOL EQU 30 ;ȸ鳡¿¡¼ ¶³¾îÁø ļö
MATTRIB DB ? ;¸Þ´º ¼Ó¼ºÀ» ¹ÞÀ» º¯¼ö
MROW DB 00 ;¸Þ´º¿¡¼ »ç¿ëÇÒ Çà
MESC_CHK DB 0
SHADOW DB 19 DUP (0B1H ) ;¸Þ´ºÀÇ ±×¸²ÀÚ
MENU DB 0C9H, 17 DUP ( 0CDH ), 0BBH ;¸Þ´º
DB 0BAH, ' Continue ', 0BAH
DB 0BAH, ' New file ', 0BAH
DB 0BAH, ' Save file ', 0BAH
DB 0BAH, ' Load file ', 0BAH
DB 0BAH, ' Exit editor ', 0BAH
DB 0C8H, 17 DUP ( 0CDH ), 0BCH
;--------------------------------------------------
SAVEMESS DB 'Save the data in C:\','$' ;¼¼ÀÌºê ½Ã¿¡ Ãâ·ÂµÉ ¸Þ½ÃÁö
LOADMESS DB 'Load the data from C:\','$' ;·Îµå ½Ã¿¡ Ãâ·ÂµÉ ¸Þ½ÃÁö
FILEMESS DB 'Enter the file name for Save/Load','$' ;¼¼À̺ê,·Îµå½Ã ÆÄÀÏÀ̸§ ÀԷ¾ȳ» ¸Þ½ÃÁö
ENDMESS DB '<Press any key> Program exiting now...' ;ÇÁ·Î±×·¥ Á¾·á½Ã Ãâ·ÂµÉ ¸Þ½ÃÁö
PRESS DB '<Press any key>','$' ;Ű ÀÔ·Â ¸Þ½ÃÁö
ERRORMESS DB 'File iperation error! ','$' ;ÆÄÀÏ ¿¬»êÁß ¿¡·¯°¡ ¹ß»ýµÉ ¶§
FILEPATH DB 'C:\'
INPUTPATH DB 23 DUP(' '), 00H ;¾Æ½ºÅ°Á¦·Î ½ºÆ®¸µ
FILEHAND DW ? ;ÆÄÀÏÇÚµé ÀúÀ庯¼ö
PARLIST LABEL BYTE
MAX_LEN DB 20
ACT_LEN DB ?
KB_DATA DB 21 DUP(' ')
.386 ;-------------------------------------------
.CODE
A10MAIN PROC FAR
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
MOV AH,00H ;ºñµð¿À ¸ðµå ¼³Á¤
MOV AL,03H
INT 10H
MOV AH,05H ;Ȱ¼º ÆäÀÌÁö ¼±ÅÃ
MOV AL,00H
INT 10H
A20:
CALL B10ALLCLEAR ;Àüü µð½ºÇ÷¹ÀÌ ÃʱâÈ
CALL D10FRAME ;¿¡µðÅÍ Æ² Ãâ·Â(Á¦¸ñ,´ÜÃàŰ ¼³¸í Æ÷ÇÔ)
A30:
MOV DH,ROW ;Ä¿¼ ¼³Á¤
MOV DL,COL
CALL E10CURSOR
CALL G10KEYBRD ;ÀԷ¹ޱâ
;ÀԷ¹ÞÀº°Å ¸Þ¸ð¸®¿¡ ³Ö°í
;¸Þ¸ð¸®ÀÇ ³»¿ë Ãâ·Â
CALL I10DISCHR
CMP ESC_CHK,1 ;ESC°¡ ´·È´ÂÁö È®ÀÎÇÑ´Ù(´¸®¸é Á¾·á)
JE A90
JMP A30
MOV AH,10H
INT 16H
A90:
MOV AX,1301H
MOV BH,00
MOV BL,0F4H
LEA BP,ENDMESS
MOV CX,38
MOV DX,0A14H
INT 10H
;Á¾·á ¸Þ½ÃÁö¸¦ Ãâ·ÂÈÄ
MOV AH,10H ;¾Æ¹«Å°³ª ´©¸£¸é ½ºÅ©·ÑÈÄ Á¾·á
INT 16H
CALL B10ALLCLEAR
MOV AX, 4C00H
INT 21H
A10MAIN ENDP
;------------------------------------------------
B10ALLCLEAR PROC NEAR
;ÇÁ·Î½ÃÁ®¸¦ È£ÃâÇϸé ȸé Àüü¸¦ ½ºÅ©·Ñ
;ȸéÀüü¸¦ ½ºÅ©·Ñ(ÅØ½ºÆ® ¿µ¿ª ¹Û±îÁö)
PUSHA
MOV AX,0600H
MOV BH,4FH
MOV CX,0000H
MOV DX,184FH
INT 10H
POPA
RET
B10ALLCLEAR ENDP
;------------------------------------------------
C10CLEAR PROC NEAR
;AL¸¦ ¼¼ÆÃÇϸé È£ÃâÇϸé AL°ª¸¸Å È¸é ½ºÅ©·Ñ
;ÅØ½ºÆ® ¿µ¿ª¾È¿¡¼¸¸ ½ºÅ©·Ñ
PUSHA
MOV AH,06H
MOV BH,4FH
MOV CX,0101H
MOV DX,174EH
INT 10H
POPA
RET
C10CLEAR ENDP
;------------------------------------------------
D10FRAME PROC NEAR
;¿¡µðÅÍÀÇ ÀüüƲÀ» Ãâ·Â
;Ä¿¼ ¼³Á¤
PUSHA
MOV DX,0000
CALL E10CURSOR
;¿¡µðÅÍÀÇ ¹Ù±ùÂÊ Æ²À» Ãâ·Â
MOV AX,1301H
MOV BL,4FH
LEA BP,FRAME
MOV CX,1920
MOV DX,0000H
INT 10H
;¹ØÁÙ¸Þ´º´ÜÃàŰ Ãâ·Â
MOV AX,1301H
MOV BL,0F4H
LEA BP,MENU_STR
MOV CX,80
MOV DX,1700H
INT 10H
;¹®¼ Á¦¸ñ(ŸÀÌÆ²) Ãâ·Â
MOV AX,1301H
MOV BL,0F4H
LEA BP,NEW_FILE_TITLE
MOV CX,20
MOV DX,000CH
INT 10H
POPA
RET
D10FRAME ENDP
;------------------------------------------------
E10CURSOR PROC NEAR
;DX¸¦ ¼¼ÆÃÇϰí È£ÃâÇϸé Ä¿¼ÀÇ À§Ä¡¸¦ ¼³Á¤
PUSHA
MOV AH,02
MOV BH,00
INT 10H
POPA
RET
E10CURSOR ENDP
;------------------------------------------------
F10INPUTCHR PROC NEAR
;ÅØ½ºÆ®¿µ¿ª¿¡ Ç¥½ÃÇÒ µ¥ÀÌÅͼ¼±×¸ÕÆ® TEXT_AREAÀÇ ¿µ¿ª¿¡ °ª ÀÔ·Â
PUSHA
PUSH AX ;°öÇϱ⿡¼ AX¸¦ »ç¿ëÇϹǷΠ¹é¾÷
MOV AX,0000 ;AX ÃʱâÈ
MOVZX AX,ROW ;AX = (ROW-1)*78
DEC AX
IMUL ROWLEN
MOVZX BX,COL ;AX = AX + (COL-1)
ADD AX,BX
DEC AX
MOV CX,AX
POP AX ;¹é¾÷ÇØ³ù´ø AX¸¦ º¹¿ø
LEA DI,TEXT_AREA ;STOSB¸¦ ÅëÇØ¼ TEXT_AREA¿¡ »ðÀÔ
ADD DI,CX
CLD
STOSB
;COL°ªÀ» °è»êÇØ¼ COLÀÌ 79±îÁö¸¸ °è»êµÇ°í
;79¸¦ ³Ñ¾î°¡¸é ROW¸¦ Áõ°¡½ÃÄÑ ÇàÀ» ³ªÅ¸³»°ÔÇÑ´Ù.
CMP COL,RIGHT_LIM ;¸¶Áö¸· ¿ÀÎÁö °Ë»çÇØ¼ ¸¶Áö¸·¿ÀÌ¸é ´ÙÀ½ÇàÀ¸·Î
JB F10
CMP ROW,BTM_LIM ;¸¶Áö¸·ÁÙ, ¸¶Áö¸·¿¿¡¼± Á¦ÀÚ¸®¿¡ ¸ØÃß±âÀ§Çؼ °Ë»ç
JE F90 ;(Áõ°¡¾øÀÌ ¹Ù·Î¸®ÅÏ)
INC ROW
MOV COL,01
JMP F90
F10:
INC COL
F90:
POPA
RET
F10INPUTCHR ENDP
;------------------------------------------------
G10KEYBRD PROC NEAR
;Űº¸µå·ÎºÎÅÍ ÀÔ·ÂÀ»¹Þ¾Æµé¿©¼ ±×¿¡ ¸Â´Â ±â´ÉÀ» ¼öÇàÇÏ´Â
;ÇÁ·Î½ÃÁ®¸¦ È£ÃâÇÑ´Ù
PUSHA
MOV AH,10H
INT 16H ;ÀÔ·ÂÀ» ¹Þ¾ÆµéÀδÙ
CMP AL,00H ;¹Þ¾ÆµéÀÎ ¹®ÀÚ°¡ ¾ËÆÄºªÀÎÁö °Ë»çÇÏ´Â °úÁ¤
JE G20
CMP AL,0E0H
JE G20
CMP AL,0DH
JE G20
CMP AL,08H
JE G40
CMP AL,1BH
JE G70
CALL F10INPUTCHR ;¾ËÆÄºªÀ϶§´Â ÅØ½ºÆ®¿µ¿ª¿¡ ¹®ÀÚ»ðÀÔ
JMP G90
G20: ;¿À¸¥ÂÊ È»ìÇ¥
CMP AH,4DH
JNE G30
CALL H10RTARRW
JMP G90
G30: ;¿ÞÂÊ È»ìÇ¥
CMP AH,4BH
JNE G33
CALL H20LFARRW
JMP G90
G33: ;¾Æ·¡ÂÊ È»ìÇ¥
CMP AH,50H
JNE G36
CALL H40DWNARRW
JMP G90
G36: ;À§ÂÊ È»ìÇ¥
CMP AH,48H
JNE G39
CALL H30UPARRW
JMP G90
G39: ;¿£ÅÍ
CMP AH,1CH
JNE G40
CALL H80ENTER
JMP G90
G40: ;¹é½ºÆäÀ̽º
CMP AH,0EH
JNE G45
CALL H90BACKSP
JMP G90
G45: ;µô¸®Æ®
CMP AH,53H
JNE G50
CALL H70DELETE
JMP G90
G50: ;Ȩ
CMP AH,47H
JNE G60
CALL H100HOME
JMP G90
G60: ;¿£µå
CMP AH,4FH
JNE G65
CALL H110END
MOV ROW,24
JMP G90
G65: ;F1-¸Þ´º
CMP AH,3BH
JNE G70
CALL CAMENU
JMP G90
G70: ;ESC-Á¾·á
CMP AH,01H
JNE G90
MOV ESC_CHK,1
G90:
POPA
RET
G10KEYBRD ENDP
;------------------------------------------------
H10RTARRW PROC NEAR
;¿À¸¥ÂÊ È»ìÇ¥¿¡ ´ëÇÑ µ¿ÀÛÀ» ¼öÇàÇÔ
PUSHA
CMP COL, RIGHT_LIM ;¿À¸¥ÂÊ ³¡Àΰ¡¿¡ ´ëÇÑ °Ë»ç
JAE H11 ;³¡ÀÌ¸é ¾Æ·§Á٠ùÄÀ¸·Î Ä¿¼À̵¿
INC COL
JMP H19
H11:
CMP ROW,BTM_LIM ;¸Ç¸¶Áö¸·ÁÙÀº ¿¹¿Üó¸®
JE H19 ;¹Ù·Î ¸®ÅÏ
CALL H40DWNARRW
CALL H50FLINE
H19:
POPA
RET
H10RTARRW ENDP
;------------------------------------------------
H20LFARRW PROC NEAR
;¿ÞÂÊ È»ìÇ¥¿¡ ´ëÇÑ µ¿ÀÛÀ» ¼öÇàÇÔ
PUSHA
CMP COL, LEFT_LIM ;¿ÞÂÊ ³¡Àΰ¡¿¡ ´ëÇÑ °Ë»ç
JBE H21 ;³¡À̸é ÀÁÙ ¸¶Áö¸·ÄÀ¸·Î Ä¿¼À̵¿
DEC COL
JMP H29
H21:
CMP ROW,TOP_LIM ;¸ÇÀÁÙ¿¡¼± ¿¹¿Üó¸®
JE H29 ;¹Ù·Î ¸®ÅÏ
CALL H30UPARRW
CALL H60ELINE
H29:
POPA
RET
H20LFARRW ENDP
;------------------------------------------------
H30UPARRW PROC NEAR
;À§ÂÊ È»ìÇ¥¿¡ ´ëÇÑ µ¿ÀÛÀ» ¼öÇàÇÔ
CMP ROW, TOP_LIM
JE H39
H31:
DEC ROW
H39:
RET
H30UPARRW ENDP
;------------------------------------------------
H40DWNARRW PROC NEAR
;¾Æ·¡ÂÊ È»ìÇ¥¿¡ ´ëÇÑ µ¿ÀÛÀ» ¼öÇàÇÔ
CMP ROW, BTM_LIM
JE H49
H41:
INC ROW
H49:
RET
H40DWNARRW ENDP
;------------------------------------------------
H50FLINE PROC NEAR
;ÁÙÀÇ ¸Ç¾ÕÀ¸·Î Ä¿¼ À̵¿
MOV COL, LEFT_LIM
CALL E10CURSOR
RET
H50FLINE ENDP
;------------------------------------------------
H60ELINE PROC NEAR
;ÁÙÀÇ ¸ÇµÚ·Î Ä¿¼ À̵¿
MOV COL, RIGHT_LIM
CALL E10CURSOR
RET
H60ELINE ENDP
;------------------------------------------------
H70DELETE PROC NEAR
;Ä¿¼ µÚ¿¡ ÀÖ´Â Çѹ®ÀÚ¸¦ Áö¿ì´Â ±â´É
PUSHA
MOV AX,0000 ;AX ÃʱâÈ
MOVZX AX,ROW ;AX = (ROW-1)*78
DEC AX
IMUL AX,78
MOVZX BX,COL ;AX = AX + (COL-1)
ADD AX,BX
DEC AX
MOV BX,AX
MOV CX,1794
SUB CX,AX
LEA DI, [TEXT_AREA+BX] ;Çѹ®ÀÚ¾¿ ¹Ýº¹Çؼ ²ø¾î¿È
LEA SI, [TEXT_AREA+BX+1]
REP MOVSB
POPA
RET
H70DELETE ENDP
;------------------------------------------------
H80ENTER PROC NEAR
;¿¡µðÅÍÀÇ ¿£Åͱâ´É
PUSHA
CMP ROW,BTM_LIM ;¸¶Áö¸·ÁÙ¿¡¼± ³Ñ¾î°¡Áö¾Ê°Ô ¿¹¿Üó¸®
JE H89 ;¸¶Áö¸·ÁÙÀÌ¸é ³Ñ¾î°¡±â
MOV COL,1
INC ROW
H89:
POPA
RET
H80ENTER ENDP
;------------------------------------------------
H90BACKSP PROC NEAR
;¹é½ºÆäÀ̽ºÀÇ ±â´É
;¹é½ºÆäÀ̽º¸¦ COL¸¦ °¨¼Ò½ÃŰ°í µô¸®Æ®¸¦ È£ÃâÇÏ¹Ç·Î½á ±¸Çö
CMP ROW,TOP_LIM ;¸Ç ùÀ̰í
JNE H91
CMP COL,LEFT_LIM ;¸Ç ùÄÀÌ¸é ¿¹¿Üó¸®
JE H99
H91:
JE H99
CALL H20LFARRW
CALL H70DELETE ;µô¸®Æ® È£Ãâ
H99:
RET
H90BACKSP ENDP
;------------------------------------------------
H100HOME PROC NEAR\
;ȨŰÀÇ ±â´ÉÀ» ÇÑ´Ù
;ÅØ½ºÆ®¿µ¿ªÀÇ Ã¹ÁÙ,ùÄÀ¸·Î Ä¿¼ À̵¿
MOV ROW,1
MOV COL,1
RET
H100HOME ENDP
;------------------------------------------------
H110END PROC NEAR
;¿£µåŰÀÇ ±â´ÉÀ» ÇÑ´Ù.
;ÅØ½ºÆ®¿µ¿ªÀÇ ¸¶Áö¸·ÁÙ,¸¶Áö¸·¿·Î Ä¿¼ À̵¿
MOV ROW,22
MOV COL,77
RET
H110END ENDP
;------------------------------------------------
I10DISCHR PROC NEAR
;TEXT_AREA¿¡ ÀÖ´Â ¸ðµç ¹®ÀÚ¸¦ Ãâ·ÂÇÑ´Ù.
;´õºÒ¾î ÇÏ´ÜÀÇ ¸Þ´º´ÜÃàŰ ÁÙÀÇ ROW,COLÀ» Ãâ·ÂÇÑ´Ù.
PUSHA
MOV DX,0101H
CALL E10CURSOR
;ù¹øÂ°ÁÙ Ãâ·Â
MOV AX,1301H
MOV BL,4FH
LEA BP,TEXT_AREA
MOV CX,78
MOV DX,0101H
PUSHA
INT 10H
POPA
MOV COUNT_ROW,21
;µÎ¹øÂ° ÁÙºÎÅÍ´Â
;·çÇÁ¸¦ ÅëÇØ ¹Ýº¹Çؼ ÇàÀ» °è»ê, Ãâ·Â
I20:
ADD BP,78
ADD DX,0100H
PUSHA
INT 10H
POPA
CMP COUNT_ROW,0
DEC COUNT_ROW
JNE I20
CALL J10ROWCOL
POPA
RET
I10DISCHR ENDP
;------------------------------------------------
J10ROWCOL PROC NEAR
PUSHA
MOV AL,ROW ;ROW °è»êÀ» À§ÇØ AL¿¡ ROW¸¦ ´ëÀÔ
MOV CL,0
CMP AL,0AH ;ROW > 10Àΰ¡ °Ë»ç
JB J20
J15:
SUB AL,0AH ;ROW°¡ 10ÀÌ»óÀ϶§
INC CL ;AL¿¡ 10À» »©°í(ALÀº 1ÀÚ¸®¸¦ ³ªÅ¸³¿)
CMP AL,0AH ;CL¸¦ Áõ°¡ (CL´Â 2ÀÚ¸®¸¦ ³ªÅ¸³¿)
JAE J15
J20:
ADD AL,30H
MOV CALROW+1,AL ;CALROW+1´Â 1ÀÚ¸®¼ö
ADD CL,30H ;CALROW´Â 2ÀÚ¸®¼ö
MOV CALROW,CL
MOV AL,COL ;COL °è»êÀ» À§ÇØ AL¿¡ ROW´ëÀÔ
MOV CL,0 ;°è»ê¹æ½ÄÀº ROW¿Í µ¿ÀÏ
CMP AL,0AH
JB J30
J25:
SUB AL,0AH
INC CL
CMP AL,0AH
JAE J25
J30:
ADD AL,30H
MOV CALCOL+1,AL
ADD CL,30H
MOV CALCOL,CL
MOV AX,1301H ;CALROW,CALCOL Ãâ·Â
MOV BX,00F4H
LEA BP,CALROW
MOV CX,2
MOV DH,23
MOV DL,68
PUSHA ;·¹Áö½ºÅͼ¼ÆÃÀ» ÀçȰ¿ëÇϱâÀ§ÇÑ
INT 10H ;PUSHA,POPA
POPA
LEA BP,CALCOL ;BP¿¡ COLÁÖ¼Ò ÀÔ·Â
MOV DL,76
INT 10H ;COLÀÇ Ãâ·Â
POPA
RET
J10ROWCOL ENDP
;-------------------------------------------------
CAMENU PROC NEAR
PUSHA
CA20: CALL M10MENU ;¸Þ´ºÈ¸éÀ» ȸ鿡 Ãâ·ÂÇÏ´Â ÇÁ·Î½ÃÀú È£Ãâ
MOV MROW, MTOPROW+1 ;¸Þ´ºÀÇ Ã³À½ Ç׸ñÀ» °¡¸®Å°µµ·Ï ¼³Á¤
MOV MATTRIB, 40H ;¼Ó¼ºÀ» ¼³Á¤ÇÏ¿© ÇØ´ç Ç׸ñÀÇ »ö ¹ÝÀü
CALL MDISPLY
CALL M10INPUT ;°¢ ŰÀÔ·ÂÀ» ¹ÞÀ» ÇÁ·Î½ÃÀú È£Ãâ
CMP MESC_CHK, 1 ;¸Þ´º Á¾·á üũ
JNE CA20
POPA
CALL I10DISCHR ;'ESC'Ű·Î ¸Þ´º¸¦ Á¾·á½ÃÄ×À» °æ¿ì
MOV ROW, 1 ;ùÁ٠ùĿ¡ Ä¿¼ ¼³Á¤
MOV COL, 1
CALL E10CURSOR
RET
CAMENU ENDP
;--------------------------------------------------------------------
M10MENU PROC NEAR
;¸Þ´º ȸé Ãâ·Â ÇÁ·Î½ÃÀú
PUSHA
MOV AX, 1301H ;±×¸²ÀÚ Ãâ·Â
MOV BX, 0040H
LEA BP, SHADOW
MOV CX, 19
MOV DH, MTOPROW+1 ;¸Þ´ºÀÇ ÇÑÁÙ ¾Æ·¡
MOV DL, MLEFCOL+1 ;¿À¸¥ÂÊÀ¸·Î ÇÑÄ ¿·¿¡ Ãâ·Â
MM20:
PUSHA
INT 10H
POPA
INC DH
CMP DH, MBOTROW+2 ;¸Þ´ºÀÇ ¾Æ·¡ÁÙ±îÁö ±×¸²ÀÚ°¡ Ãâ·ÂµÆ´ÂÁö È®ÀÎ
JNE MM20
MOV MATTRIB, 0F0H ;¸Þ´ºÀÇ Ãâ·Â
MOV AX, 1300H
MOVZX BX, MATTRIB
LEA BP, MENU
MOV CX, 19
MOV DH, MTOPROW ;¸Þ´ºÀÇ °¡Àå ÀÁÙ
MOV DL, MLEFCOL ;°¡Àå ¿ÞÂÊ Ä
MM30: PUSHA ;¹Ýº¹Çؼ ¸Þ´º³¡±îÁö Ãâ·Â
INT 10H
POPA
ADD BP, 19
INC DH
CMP DH, MBOTROW+1 ;¸Þ´º°¡ ´Ù Ãâ·ÂµÆ´ÂÁö È®ÀÎ
JNE MM30
POPA
RET
M10MENU ENDP
;--------------------------------------------------------------------
M10INPUT PROC NEAR
;¸Þ´º¿¡¼ °¢ ۸¦ ÀÔ·Â¹Þ¾Æ µ¿ÀÛÇÏ´Â ÇÁ·Î½ÃÀú
MC20: MOV AH, 10H
INT 16H ;۸¦ ÀԷ¹ÞÀ½
CMP AH, 50H ;¾Æ·¡·Î ³»·Á°¡´Â ¹æÇâŰÀÎÁö È®ÀÎ
JE MC30
CMP AH, 48H ;À§·Î ¿Ã¶ó°¡´Â ¹æÇâŰÀÎÁö È®ÀÎ
JE MC40
CMP AL, 0DH ;'ENTER'ŰÀÎÁö È®ÀÎ
JE MC90
CMP AL, 1BH ; ESC-Á¾·á
JE MC00
JMP MC20
MC30: MOV MATTRIB, 0F0H ;¼Ó¼º¼³Á¤
CALL MDISPLY
INC MROW ;ÇÑÁÙ ¾Æ·¡·Î À̵¿
CMP MROW, MBOTROW-1 ;¸Þ´º °¡Àå ¾Æ·¡ÀÏ °æ¿ì
JBE MC50
MOV MROW, MTOPROW+1 ;¸Þ´ºÀÇ À§·Î ¿Ã¶ó°¡µµ·Ï ¼³Á¤
JMP MC50
MC40: MOV MATTRIB, 0F0H ;¼Ó¼º¼³Á¤
CALL MDISPLY
DEC MROW ;ÇÑÁÙ À§·Î °¡µµ·Ï ¼³Á¤
CMP MROW, MTOPROW+1 ;¸Þ´ºÀÇ °¡Àå À§ÀÏ °æ¿ì
JAE MC50
MOV MROW, MBOTROW-1 ;¸Þ´ºÀÇ °¡Àå ¾Æ·¡·Î ³»·Á°¡µµ·Ï ¼³Á¤
MC50: MOV MATTRIB, 40H ;ÇØ´ç Ç׸ñÀÇ »ö ¹ÝÀü
CALL MDISPLY
JMP MC20
MC90: CMP AH, 1CH ;'ENTER'ŰÀÏ °æ¿ì Á¾·á
JNE MC00
CMP MROW, MTOPROW+1 ; 1¹øÂ° ¸Þ´º - µ¹¾Æ°¡±â
JNE MC01
JMP MC00 ; ¸Þ´º Á¾·á
MC01: CMP MROW, MTOPROW+2 ; 2¹øÂ° ¸Þ´º - »õÆÄÀÏ
JNE MC02
CALL NEWFILE ; ȸé&ÅØ½ºÆ®¿µ¿ª ÃʱâÈ
JMP MC00
MC02: CMP MROW, MTOPROW+3 ; 3¹øÂ° ¸Þ´º - ÆÄÀÏÀúÀå
JNE MC03
CALL SAVEFILE ;ÆÄÀÏÀúÀå ÇÁ·Î½ÃÁ® È£Ãâ
JMP MC00
MC03: CMP MROW, MTOPROW+4 ; 4¹øÂ° ¸Þ´º - ÆÄÀϷεå
JNE MC04
CALL LOADFILE ;ÆÄÀϷεå ÇÁ·Î½ÃÁ® È£Ãâ
JMP MC00
MC04: CMP MROW, MTOPROW+5 ; 5¹øÂ° ¸Þ´º - Á¾·á
JNE MC00
MOV ESC_CHK, 01 ;ÇÁ·Î±×·¥À» Á¾·á½Ãų º¯¼ö ¼³Á¤
MC00: MOV MESC_CHK, 01 ;¸Þ´º ȸé Á¾·á½Ãų º¯¼ö ¼³Á¤
RET
M10INPUT ENDP
;¸Þ´º ȸ鿡¼ ÇØ´ç Ç׸ñÀÇ »öÀÌ ¹ÝÀüµÇµµ·Ï ÇÏ´Â ÇÁ·Î½ÃÀú
;--------------------------------------------------------------------
MDISPLY PROC NEAR
PUSHA
MOVZX AX, MROW ;¸Þ´ºÀÇ ÇöÀç ÁÙÀ» ¹Þ¾Æ¼
SUB AX, MTOPROW ;°¢ Ç׸ñÀ» Á¤È®È÷
IMUL AX, 19 ;°¡¸®Å°µµ·Ï °è»ê
LEA SI, MENU+1
ADD SI, AX
MOV AX, 1300H
MOVZX BX, MATTRIB ;ÇØ´ç Ç׸ñÀÇ »öÀ» ¹ÝÀü
MOV BP, SI
MOV CX, 17
MOV DH, MROW
MOV DL, MLEFCOL+1 ;ùĺÎÅÍ ¸Þ´º³»ºÎÀÇ Å©±â±îÁö
INT 10H ;»öÀ» ¹ÝÀü ½ÃÅ´
POPA
RET
MDISPLY ENDP
;--------------------------------------------------------------------
NEWFILE PROC NEAR
;ÅØ½ºÆ® ¿µ¿ªÀ» ÃʱâÈ ÇÏ¿© »õÆÄÀÏÀ» ¿¬´Â ±â´É
PUSHA
MOV AL,' ' ;ÅØ½ºÆ®¿µ¿ªÀÇ Àü¿µ¿ªÀ»
LEA DI,TEXT_AREA ;°ø¹é¹®ÀÚ·Î ÃʱâÈ
MOV CX,1800
REP STOSB
;¹®¼ Á¦¸ñ(ŸÀÌÆ²) Ãâ·Â
MOV AX,1301H
MOV BL,0F4H
LEA BP,NEW_FILE_TITLE
MOV CX,20
MOV DX,000CH
INT 10H
POPA
RET
NEWFILE ENDP
;--------------------------------------------------------------------
SAVEFILE PROC NEAR
;ÆÄÀÏÀ» ¼¼À̺ê ÇÏ´Â ÇÁ·Î½ÃÁ®
;ÅØ½ºÆ®¿µ¿ªÀÇ µ¥ÀÌÅ͸¦ ÅØ½ºÆ® ¹®¼·Î ÀúÀåÇÑ´Ù.
MOV DH, 16 ;¾È³» ¸Þ½ÃÁöÃâ·ÂÀ» À§ÇÑ Ä¿¼¼³Á¤
MOV DL, 22
CALL E10CURSOR
MOV AH, 09
LEA DX, FILEMESS ;¾È³» ¸Þ½ÃÁö
INT 21H
MOV DH, 17 ;¸Þ½ÃÁö Ãâ·ÂÀ» À§ÇÑ Ä¿¼ ¼³Á¤
MOV DL, 17
CALL E10CURSOR
MOV AH, 09
LEA DX, SAVEMESS ;ÆÄÀÏÀÌ ¼º°øÀûÀ¸·Î ÀúÀåµÇ¾úÀ» ¶§
INT 21H ;ȸ鿡 ¼º°ø ¸Þ½ÃÁö¸¦ Ãâ·Â
CALL PATH_INPUT ;ÆÄÀϸíÀ» ÀԷ¹޴ ÇÁ·Î½ÃÁ® È£Ãâ
CALL FILECREATE ;ÆÄÀÏ »ý¼º
JC SERROR ;¿¡·¯ ¹ß»ý½Ã
MOV AH, 40H ;ÆÄÀÏ¿¡ ·¹ÄÚµå ±â·Ï
MOV BX, FILEHAND ;ÆÄÀÏ ÇÚµé ¼³Á¤
MOV CX, 1794 ;·¹ÄÚµåÀÇ Àüü±æÀÌ
LEA DX, TEXT_AREA ;ÀúÀåÇÒ ·¹ÄÚµå
INT 21H
JC SERROR
CALL FILECLOSE ;ÆÄÀÏ ´Ý±â
MOV DH, 18 ;¾Æ¹«Å°³ª ´©¸£µµ·Ï ÇÏ´Â ¸Þ½ÃÁö Ãâ·Â
MOV DL, 33
CALL E10CURSOR
MOV AH, 09
LEA DX, PRESS
INT 21H
MOV AH, 10H ;Ű ÀÔ·Â
INT 16H
RET
SERROR: CALL ERROR ;¿¡·¯¹ß»ý½Ã ¿¡·¯ ÇÁ·Î½Ãó È£Ãâ
RET
SAVEFILE ENDP
;--------------------------------------------------------------------
LOADFILE PROC NEAR
;ÀúÀåµÈ ÀÛ¾÷À» ºÒ·¯¿À´Â ÇÁ·Î½ÃÀú
;ÀúÀåµÇÀÖ´Â ÅØ½ºÆ®¹®¼¸¦ Àоîµé¿©¼
µ¥ÀÌÅÍ¿µ¿ª¿¡¼ ÀúÀåÇϰí Ãâ·ÂÇÑ´Ù.
MOV DH, 16 ;¾È³» ¸Þ½ÃÁöÃâ·ÂÀ» À§ÇÑ Ä¿¼¼³Á¤
MOV DL, 22
CALL E10CURSOR
MOV AH, 09
LEA DX, FILEMESS ;¾È³» ¸Þ½ÃÁö
INT 21H
MOV DH, 17 ;ÆÄÀÏÀÌ ¼º°øÀûÀ¸·Î ·ÎµåµÇ¾úÀ» ¶§
MOV DL, 17 ;ȸ鿡 ¼º°ø ¸Þ½ÃÁö¸¦ Ãâ·Â
CALL E10CURSOR
MOV AH, 09
LEA DX, LOADMESS
INT 21H
CALL PATH_INPUT ;ÆÄÀϸíÀ» ÀԷ¹޴ ÇÁ·Î½ÃÁ® È£Ãâ
CALL FILEOPEN ;ÆÄÀÏ ¿±â
JC LERROR ;¿¡·¯ ¹ß»ý½Ã
MOV AH, 3FH ;ÆÄÀÏ Àбâ
MOV BX, FILEHAND ;ÆÄÀÏ ÇÚµé ¼³Á¤
MOV CX, 1800 ;·¹ÄÚµåÀÇ Àüü ±æÀÌ
LEA DX, TEXT_AREA ;·¹Äڵ尡 ÀÐÇôÁú ¹®ÀÚ¿
INT 21H
JC LERROR
CALL FILECLOSE ;ÆÄÀÏ ´Ý±â
MOV DH, 18 ;¾Æ¹«Å°³ª ´©¸£µµ·Ï ÇÏ´Â ¸Þ½ÃÁö Ãâ·Â
MOV DL, 33
CALL E10CURSOR
MOV AH, 09
LEA DX, PRESS
INT 21H
MOV AH, 10H ;Ű ÀÔ·Â
INT 16H
RET
LERROR: CALL ERROR ;¿¡·¯¹ß»ý½Ã ¿¡·¯ ÇÁ·Î½ÃÀú È£Ãâ
RET
LOADFILE ENDP
;--------------------------------------------------------------------
FILECREATE PROC NEAR
;ÆÄÀÏÀ» »ý¼ºÇÏ¿© ÆÄÀÏÇÚµéÀ» ÀúÀåÇÏ´Â ÇÁ·Î½ÃÀú
MOV AH, 3CH
MOV CX, 00
LEA DX, FILEPATH ;ÆÄÀÏÀÇ °æ·Î ¼³Á¤
INT 21H
MOV FILEHAND, AX ;»ý¼ºµÈ ÆÄÀÏÀÇ ÆÄÀÏÇÚµé ÀúÀå
RET
FILECREATE ENDP
;--------------------------------------------------------------------
FILECLOSE PROC NEAR
;¿¸° ÆÄÀÏÀ» ´Ý´Â ÇÁ·Î½ÃÀú
MOV AH, 3EH
MOV BX, FILEHAND ;ÆÄÀÏ ÇÚµé ¼³Á¤
INT 21H
JC CLERROR
RET
CLERROR: CALL ERROR ;¿¡·¯¹ß»ý½Ã ¿¡·¯ ÇÁ·Î½ÃÀú È£Ãâ
RET
FILECLOSE ENDP
;--------------------------------------------------------------------
FILEOPEN PROC NEAR
;ÆÄÀÏÀ» ¿¾î¼ ÆÄÀÏÇÚµéÀ» ÀúÀåÇÏ´Â ÇÁ·Î½ÃÀú
MOV AH, 3DH
MOV AL, 02 ;Àбâ/¾²±â°¡ µÇµµ·Ï ¼³Á¤
LEA DX, FILEPATH ;ÆÄÀÏ °æ·Î ¼³Á¤
INT 21H
MOV FILEHAND, AX ;ÆÄÀÏÇÚµé ÀúÀå
RET
FILEOPEN ENDP
;--------------------------------------------------------------------
PATH_INPUT PROC NEAR
PUSHA
MOV DH,17 ;Èò¹Ú½º¸¦ Ãâ·ÂÇϱâ À§ÇÑ Ä¿¼¼³Á¤
MOV DL,40
CALL E10CURSOR
MOV AH,09H ;Èò¹Ú½º Ãâ·Â(AH 09, INT10)
MOV AL,' '
MOV BH,00
MOV BL,0F4H
MOV CX,20
INT 10H
MOV DH,17 ;ÆÄÀϸí ÀÔ·ÂÀ» ¹Þ±âÀ§ÇÑ Ä¿¼ ¼³Á¤
MOV DL,40
CALL E10CURSOR
MOV AH,0AH ;ÆÄÀϸíÀ» ÀԷ¹ÞÀ½
LEA DX,PARLIST ;ÆÄ¶ó¸®½ºÆ®¸¦ ÅëÇØ¼
INT 21H
CLD
LEA SI,KB_DATA ;MOVSB¸¦ ÅëÇØ¼ ÆÄÀÏ¸íº¯¼ö¿¡
LEA DI,INPUTPATH ;ÀԷ¹ÞÀº °ªÀ» ³ÖÀ½
MOVZX CX,ACT_LEN
REP MOVSB
MOV AL,'.' ;ÆÄÀÏÆÐ½º + È®ÀåÀÚ.txtÀ» Áý¾î³Ö±â À§ÇØ
STOSB ;AL¿¡ °ªÀ» ³Ö°í STOSB¸¦ ¾¸
MOV AL,'t'
STOSB
MOV AL,'x'
STOSB
MOV AL,'t'
STOSB
MOV AL,00H
STOSB
MOV DX,000CH ;±âÁ¸ÀÇ Á¦¸ñ »èÁ¦¸¦ À§ÇÑ Ä¿¼¼³Á¤
CALL E10CURSOR
MOV AX,09CDH ;±âÁ¸ÀÇ Á¦¸ñ »èÁ¦
MOV BX,004FH
MOV CX,20
INT 10H
MOV AL,' '
LEA DI,FILE_TITLE
MOV CX,22
REP STOSB
LEA DI,FILE_TITLE+1 ;ÀԷ¹ÞÀº ¹®ÀÚ¸¦ Á¦¸ñÃâ·ÂÀ» À§ÇØ À̵¿
LEA SI,KB_DATA
MOVZX CX,ACT_LEN ;À̵¿¹Ýº¹Àº ACT_LEN¸¸Å
REP MOVSB
MOV AX,1301H
MOV BX,00F4H
MOVZX CX,ACT_LEN
ADD CX,2
LEA BP,FILE_TITLE
MOV DX,000CH
PUSHA
INT 10H
POPA
POPA
RET
PATH_INPUT ENDP
;--------------------------------------------------------------------
ERROR PROC NEAR
;¿¡·¯¹ß»ý½Ã ¿¡·¯¸Þ½ÃÁö¸¦ ȸ鿡 Ãâ·ÂÇÏ´Â ÇÁ·Î½ÃÀú
PUSHA
MOV AH,09
MOV DH, 6
MOV DL, 30
CALL E10CURSOR
MOV AH, 09
LEA DX, ERRORMESS ;ȸ鿡 ¿¡·¯¸Þ½ÃÁö¸¦ Ãâ·Â
INT 21H
POPA
RET
ERROR ENDP
END A10MAIN
;------------------------------------------------
| gunbaek/SimpleEditor4Console | SimpleEditor4Console/SimpleEditor4Console.asm | Assembly | apache-2.0 | 17,957 |
kp_song
kp_reloc
dc.w kp_song_registers
dc.w kp_speed
dc.w kp_grooveboxpos
dc.w kp_grooveboxlen
dc.w kp_groovebox
dc.w kp_patternlen
dc.w kp_patternmap_lo
dc.w kp_patternmap_hi
dc.w kp_insmap_lo
dc.w kp_insmap_hi
dc.w kp_volmap_lo
dc.w kp_volmap_hi
dc.w kp_sequence
kp_song_registers
kp_speed
dc.b $02
kp_grooveboxpos
dc.b $00
kp_grooveboxlen
dc.b $04
kp_groovebox
dc.b $04
dc.b $06
dc.b $09
dc.b $05
dc.b $05
dc.b $04
dc.b $06
dc.b $04
kp_patternlen
dc.b $1F
kp_patternmap_lo
dc.b #<patnil
dc.b #<pat1
dc.b #<pat2
dc.b #<pat3
dc.b #<pat4
dc.b #<pat5
dc.b #<pat6
dc.b #<pat7
dc.b #<pat8
dc.b #<pat9
dc.b #<pat10
dc.b #<pat11
dc.b #<pat12
dc.b #<pat13
dc.b #<pat14
dc.b #<pat15
dc.b #<pat16
dc.b #<pat17
dc.b #<pat18
kp_patternmap_hi
dc.b #>patnil
dc.b #>pat1
dc.b #>pat2
dc.b #>pat3
dc.b #>pat4
dc.b #>pat5
dc.b #>pat6
dc.b #>pat7
dc.b #>pat8
dc.b #>pat9
dc.b #>pat10
dc.b #>pat11
dc.b #>pat12
dc.b #>pat13
dc.b #>pat14
dc.b #>pat15
dc.b #>pat16
dc.b #>pat17
dc.b #>pat18
patnil
kp_setinstrument 8,0
kp_settrackregister 0,16
kp_rewind $00
pat1
pat1loop
kp_settrackregister $03,$0F
kp_setinstrument $04,$01
kp_setinstrument $04,$02
kp_setinstrument $02,$03
kp_settrackregister $03,$08
kp_setinstrument $02,$03
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_setinstrument $02,$02
kp_setinstrument $04,$01
kp_setinstrument $02,$02
kp_settrackregister $03,$08
kp_setinstrument $02,$01
kp_settrackregister $03,$0F
kp_setinstrument $02,$03
kp_settrackregister $03,$08
kp_setinstrument $02,$03
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_setinstrument $02,$02
kp_rewind [pat1loop-pat1]
pat2
pat2loop
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $01,$40
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $04,$04
kp_settrackregister $01,$08
kp_setinstrument $02,$04
kp_settrackregister $01,$40
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_rewind [pat2loop-pat2]
pat3
pat3loop
kp_settrackregister $03,$0F
kp_setinstrument $04,$01
kp_setinstrument $04,$02
kp_setinstrument $02,$03
kp_settrackregister $03,$08
kp_setinstrument $02,$03
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_setinstrument $02,$02
kp_setinstrument $02,$01
kp_settrackregister $03,$0E
kp_setinstrument $02,$06
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_settrackregister $03,$0C
kp_setinstrument $02,$02
kp_settrackregister $03,$0F
kp_setinstrument $04,$03
kp_setinstrument $04,$06
kp_rewind [pat3loop-pat3]
pat4
pat4loop
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $01,$40
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $01,$04
kp_settrackregister $03,$0A
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$07
kp_settrackregister $00,$01
kp_settrackregister $03,$0A
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $01,$40
kp_settrackregister $03,$0F
kp_setinstrument $04,$05
kp_settrackregister $01,$08
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0F
kp_settrackregister $00,$02
kp_rewind [pat4loop-pat4]
pat5
pat5loop
kp_settrackregister $03,$0F
kp_setinstrument $04,$01
kp_setinstrument $04,$02
kp_setinstrument $04,$03
kp_setinstrument $02,$02
kp_setinstrument $02,$02
kp_setinstrument $02,$06
kp_settrackregister $03,$0E
kp_setinstrument $02,$03
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_settrackregister $03,$0C
kp_setinstrument $02,$02
kp_settrackregister $03,$0F
kp_setinstrument $04,$03
kp_setinstrument $04,$06
kp_rewind [pat5loop-pat5]
pat6
pat6loop
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $01,$40
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $01,$04
kp_settrackregister $03,$0A
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$07
kp_settrackregister $00,$01
kp_settrackregister $03,$0A
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $01,$40
kp_settrackregister $03,$0F
kp_setinstrument $04,$05
kp_settrackregister $01,$08
kp_setinstrument $04,$04
kp_rewind [pat6loop-pat6]
pat7
pat7loop
kp_settrackregister $03,$0F
kp_settrackregister $00,$04
kp_settrackregister $01,$40
kp_setinstrument $04,$07
kp_settrackregister $01,$70
kp_setinstrument $04,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$08
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$60
kp_setinstrument $04,$07
kp_settrackregister $01,$4C
kp_setinstrument $02,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$08
kp_rewind [pat7loop-pat7]
pat8
pat8loop
kp_settrackregister $00,$04
kp_settrackregister $01,$40
kp_setinstrument $04,$07
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$60
kp_setinstrument $04,$08
kp_settrackregister $01,$5C
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$60
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$44
kp_setinstrument $04,$08
kp_rewind [pat8loop-pat8]
pat9
pat9loop
kp_settrackregister $03,$0F
kp_settrackregister $00,$04
kp_settrackregister $01,$40
kp_setinstrument $04,$07
kp_settrackregister $01,$70
kp_setinstrument $04,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$08
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$60
kp_setinstrument $04,$07
kp_settrackregister $01,$68
kp_setinstrument $02,$07
kp_settrackregister $01,$70
kp_setinstrument $04,$09
kp_rewind [pat9loop-pat9]
pat10
pat10loop
kp_settrackregister $00,$02
kp_settrackregister $01,$68
kp_settrackregister $03,$08
kp_setinstrument $01,$0A
kp_settrackregister $01,$6C
kp_settrackregister $03,$0C
kp_setinstrument $01,$0A
kp_settrackregister $01,$70
kp_settrackregister $03,$0F
kp_setinstrument $04,$08
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$60
kp_setinstrument $04,$08
kp_settrackregister $01,$5C
kp_setinstrument $04,$07
kp_settrackregister $01,$60
kp_setinstrument $02,$07
kp_settrackregister $01,$54
kp_setinstrument $04,$07
kp_settrackregister $01,$5C
kp_setinstrument $02,$07
kp_settrackregister $01,$4C
kp_setinstrument $04,$09
kp_rewind [pat10loop-pat10]
pat11
pat11loop
kp_settrackregister $00,$04
kp_settrackregister $01,$54
kp_settrackregister $03,$0F
kp_setinstrument $04,$07
kp_settrackregister $01,$7C
kp_setinstrument $04,$07
kp_settrackregister $01,$74
kp_setinstrument $04,$08
kp_settrackregister $01,$70
kp_setinstrument $0C,$09
kp_settrackregister $01,$40
kp_settrackregister $03,$0C
kp_setinstrument $04,$09
kp_rewind [pat11loop-pat11]
pat12
pat12loop
kp_settrackregister $01,$24
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$34
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$24
kp_settrackregister $03,$0F
kp_setinstrument $04,$04
kp_setinstrument $02,$04
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_rewind [pat12loop-pat12]
pat13
pat13loop
kp_settrackregister $00,$04
kp_settrackregister $01,$4C
kp_settrackregister $03,$0F
kp_setinstrument $04,$07
kp_settrackregister $01,$74
kp_setinstrument $04,$07
kp_settrackregister $01,$6C
kp_setinstrument $04,$08
kp_settrackregister $01,$68
kp_setinstrument $0C,$09
kp_settrackregister $01,$38
kp_setinstrument $04,$09
kp_rewind [pat13loop-pat13]
pat14
pat14loop
kp_settrackregister $01,$1C
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$2C
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$1C
kp_settrackregister $03,$0F
kp_setinstrument $01,$04
kp_settrackregister $03,$0A
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0C
kp_setinstrument $01,$04
kp_settrackregister $03,$07
kp_settrackregister $00,$01
kp_settrackregister $03,$0A
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0F
kp_setinstrument $04,$05
kp_settrackregister $01,$20
kp_setinstrument $01,$04
kp_settrackregister $03,$08
kp_settrackregister $00,$01
kp_settrackregister $03,$0F
kp_settrackregister $00,$02
kp_rewind [pat14loop-pat14]
pat15
pat15loop
kp_settrackregister $00,$04
kp_settrackregister $01,$40
kp_setinstrument $04,$07
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$08
kp_settrackregister $01,$50
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$07
kp_settrackregister $01,$70
kp_setinstrument $02,$07
kp_settrackregister $01,$74
kp_setinstrument $04,$09
kp_rewind [pat15loop-pat15]
pat16
pat16loop
kp_settrackregister $00,$04
kp_settrackregister $01,$40
kp_setinstrument $04,$07
kp_settrackregister $01,$68
kp_setinstrument $04,$07
kp_settrackregister $01,$5C
kp_setinstrument $04,$08
kp_settrackregister $01,$50
kp_setinstrument $04,$07
kp_settrackregister $01,$54
kp_setinstrument $02,$07
kp_settrackregister $01,$44
kp_setinstrument $04,$07
kp_settrackregister $01,$50
kp_setinstrument $02,$07
kp_settrackregister $01,$40
kp_setinstrument $04,$09
kp_rewind [pat16loop-pat16]
pat17
pat17loop
kp_settrackregister $03,$0F
kp_setinstrument $04,$01
kp_setinstrument $04,$02
kp_setinstrument $02,$03
kp_settrackregister $03,$0C
kp_setinstrument $02,$01
kp_settrackregister $03,$0A
kp_setinstrument $02,$02
kp_settrackregister $03,$0F
kp_setinstrument $02,$02
kp_setinstrument $10,$03
kp_rewind [pat17loop-pat17]
pat18
pat18loop
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $06,$04
kp_settrackregister $01,$40
kp_settrackregister $03,$0A
kp_setinstrument $02,$05
kp_settrackregister $03,$0F
kp_setinstrument $02,$05
kp_settrackregister $01,$20
kp_settrackregister $03,$0C
kp_setinstrument $02,$04
kp_settrackregister $03,$00
kp_settrackregister $00,$04
kp_settrackregister $01,$10
kp_settrackregister $03,$0F
kp_setinstrument $08,$04
kp_settrackregister $01,$00
kp_setinstrument $05,$0B
kp_settrackregister $01,$04
kp_settrackregister $00,$01
kp_settrackregister $01,$08
kp_settrackregister $00,$01
kp_settrackregister $01,$0C
kp_settrackregister $00,$01
kp_rewind [pat18loop-pat18]
kp_insmap_lo
dc.b #<insnil
dc.b #<ins1
dc.b #<ins2
dc.b #<ins3
dc.b #<ins4
dc.b #<ins5
dc.b #<ins6
dc.b #<ins7
dc.b #<ins8
dc.b #<ins9
dc.b #<ins10
dc.b #<ins11
kp_insmap_hi
dc.b #>insnil
dc.b #>ins1
dc.b #>ins2
dc.b #>ins3
dc.b #>ins4
dc.b #>ins5
dc.b #>ins6
dc.b #>ins7
dc.b #>ins8
dc.b #>ins9
dc.b #>ins10
dc.b #>ins11
kp_volmap_lo
dc.b #<volnil
dc.b #<vol1
dc.b #<vol2
dc.b #<vol3
dc.b #<vol4
dc.b #<vol5
dc.b #<vol6
dc.b #<vol7
dc.b #<vol8
dc.b #<vol9
dc.b #<vol10
dc.b #<vol11
kp_volmap_hi
dc.b #>volnil
dc.b #>vol1
dc.b #>vol2
dc.b #>vol3
dc.b #>vol4
dc.b #>vol5
dc.b #>vol6
dc.b #>vol7
dc.b #>vol8
dc.b #>vol9
dc.b #>vol10
dc.b #>vol11
insnil
KP_OSCV 0,0,0,0,15
KP_OSCJ 0
volnil
KP_VOLV 0,15
KP_VOLJ 0
ins1
KP_OSCV $1A,0,1,0,$00
KP_OSCV $10,0,1,0,$00
KP_OSCV $06,0,1,0,$00
KP_OSCV $01,0,1,0,$00
ins1loop
KP_OSCV $00,0,1,0,$00
KP_OSCV $00,0,0,0,$00
KP_OSCJ [ins1loop-ins1]
vol1
KP_VOLV $0E,$00
KP_VOLV $0F,$00
KP_VOLV $0A,$00
KP_VOLV $06,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$01
vol1loop
KP_VOLV $00,$00
KP_VOLJ [vol1loop-vol1]
ins2
KP_OSCV $FC,1,0,0,$00
ins2loop
KP_OSCV $FA,1,0,0,$00
KP_OSCJ [ins2loop-ins2]
vol2
KP_VOLV $0A,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$01
vol2loop
KP_VOLV $00,$00
KP_VOLJ [vol2loop-vol2]
ins3
KP_OSCV $40,0,1,0,$00
KP_OSCV $F2,1,0,0,$00
ins3loop
KP_OSCV $F7,1,0,0,$00
KP_OSCV $FA,1,0,0,$00
KP_OSCJ [ins3loop-ins3]
vol3
KP_VOLV $0E,$00
KP_VOLV $0B,$00
KP_VOLV $08,$00
KP_VOLV $04,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$02
vol3loop
KP_VOLV $00,$00
KP_VOLJ [vol3loop-vol3]
ins4
ins4loop
KP_OSCV $00,0,1,1,$01
KP_OSCV $01,0,1,1,$01
KP_OSCV $02,0,1,1,$01
KP_OSCV $01,0,1,1,$01
KP_OSCJ [ins4loop-ins4]
vol4
KP_VOLV $08,$01
KP_VOLV $0A,$03
KP_VOLV $09,$00
KP_VOLV $08,$00
KP_VOLV $07,$00
KP_VOLV $06,$00
KP_VOLV $05,$00
KP_VOLV $04,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$02
vol4loop
KP_VOLV $00,$00
KP_VOLJ [vol4loop-vol4]
ins5
ins5loop
KP_OSCV $30,0,1,1,$02
KP_OSCV $40,0,1,1,$02
KP_OSCV $4C,0,1,1,$02
KP_OSCV $60,0,1,1,$02
KP_OSCJ [ins5loop-ins5]
vol5
KP_VOLV $0A,$00
KP_VOLV $08,$00
KP_VOLV $07,$00
KP_VOLV $06,$00
KP_VOLV $05,$00
KP_VOLV $04,$00
KP_VOLV $03,$00
KP_VOLV $02,$02
KP_VOLV $01,$02
vol5loop
KP_VOLV $00,$00
KP_VOLJ [vol5loop-vol5]
ins6
KP_OSCV $48,0,1,0,$00
KP_OSCV $F2,1,0,0,$00
ins6loop
KP_OSCV $F9,1,0,0,$00
KP_OSCV $F2,1,0,0,$00
KP_OSCJ [ins6loop-ins6]
vol6
KP_VOLV $0C,$00
KP_VOLV $0A,$00
KP_VOLV $07,$00
KP_VOLV $05,$00
vol6loop
KP_VOLV $04,$01
KP_VOLJ [vol6loop-vol6]
ins7
KP_OSCV $00,0,1,1,$01
ins7loop
KP_OSCV $30,0,1,1,$00
KP_OSCJ [ins7loop-ins7]
vol7
KP_VOLV $0B,$03
KP_VOLV $08,$00
KP_VOLV $04,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$03
vol7loop
KP_VOLV $00,$00
KP_VOLJ [vol7loop-vol7]
ins8
KP_OSCV $00,0,1,1,$00
ins8loop
KP_OSCV $30,0,1,1,$01
KP_OSCV $31,0,1,1,$01
KP_OSCJ [ins8loop-ins8]
vol8
KP_VOLV $0B,$00
KP_VOLV $09,$02
KP_VOLV $08,$00
KP_VOLV $04,$00
KP_VOLV $03,$07
KP_VOLV $03,$00
vol8loop
KP_VOLV $00,$00
KP_VOLJ [vol8loop-vol8]
ins9
KP_OSCV $00,0,1,1,$00
ins9loop
KP_OSCV $30,0,1,1,$01
KP_OSCV $31,0,1,1,$01
KP_OSCJ [ins9loop-ins9]
vol9
KP_VOLV $0B,$00
KP_VOLV $09,$02
KP_VOLV $08,$00
KP_VOLV $07,$00
KP_VOLV $06,$00
KP_VOLV $05,$00
KP_VOLV $04,$00
KP_VOLV $05,$01
KP_VOLV $06,$00
KP_VOLV $07,$04
KP_VOLV $06,$01
KP_VOLV $05,$00
KP_VOLV $04,$00
KP_VOLV $03,$00
KP_VOLV $02,$00
KP_VOLV $01,$04
vol9loop
KP_VOLV $00,$00
KP_VOLJ [vol9loop-vol9]
ins10
ins10loop
KP_OSCV $30,0,1,1,$00
KP_OSCJ [ins10loop-ins10]
vol10
KP_VOLV $0B,$00
KP_VOLV $09,$02
KP_VOLV $08,$00
KP_VOLV $04,$00
KP_VOLV $03,$07
KP_VOLV $03,$00
vol10loop
KP_VOLV $00,$00
KP_VOLJ [vol10loop-vol10]
ins11
ins11loop
KP_OSCV $00,0,1,1,$01
KP_OSCV $01,0,1,1,$01
KP_OSCV $02,0,1,1,$01
KP_OSCV $01,0,1,1,$01
KP_OSCJ [ins11loop-ins11]
vol11
KP_VOLV $08,$01
KP_VOLV $0A,$03
KP_VOLV $09,$00
KP_VOLV $08,$00
KP_VOLV $07,$00
KP_VOLV $06,$00
KP_VOLV $05,$00
vol11loop
KP_VOLV $04,$00
KP_VOLJ [vol11loop-vol11]
kp_sequence
dc.b $00,$00,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$00,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$00,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$00,$01,$02
dc.b $00,$00,$05,$06
dc.b $00,$07,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$08,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$09,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$0A,$01,$02
dc.b $00,$00,$05,$06
dc.b $00,$0B,$01,$0C
dc.b $00,$0D,$03,$0E
dc.b $00,$0F,$01,$02
dc.b $00,$00,$03,$06
dc.b $00,$0B,$01,$0C
dc.b $00,$0D,$03,$0E
dc.b $00,$10,$01,$02
dc.b $00,$00,$11,$12
dc.b $00,$00,$01,$02
dc.b $00,$00,$03,$04
dc.b $00,$00,$01,$02
dc.b $00,$00,$03,$04
dc.b $ff
dc.w $0050
| kosmonautdnb/TheLandsOfZador | StartScreen/_sfx/Global/song.asm | Assembly | mit | 17,474 |
%define ARCH_X86
%define ARCH_X86_32
%define HAVE_AVX
%define HAVE_MMX
%define HAVE_MMX2
%define HAVE_SSE
%define HAVE_SSSE3
%define HAVE_FAST_UNALIGNED
%define HAVE_PTHREADS
%define HAVE_ALIGNED_STACK
%define HAVE_ATTRIBUTE_MAY_ALIAS
%define HAVE_ATTRIBUTE_PACKED
%define HAVE_BSWAP
%define HAVE_DLFCN_H
%define HAVE_DLOPEN
%define HAVE_EXP2
%define HAVE_EXP2F
%define HAVE_FAST_CLZ
%define HAVE_FCNTL
%define HAVE_FORK
%define HAVE_GETADDRINFO
%define HAVE_GETRUSAGE
%define HAVE_GNU_AS
%define HAVE_STRUCT_RUSAGE_RU_MAXRSS
%define HAVE_INET_ATON
%define HAVE_INLINE_ASM
%define HAVE_ISATTY
%define HAVE_LLRINT
%define HAVE_LLRINTF
%define HAVE_LOCAL_ALIGNED_16
%define HAVE_LOCAL_ALIGNED_8
%define HAVE_LOCALTIME_R
%define HAVE_LOG2
%define HAVE_LOG2F
%define HAVE_LRINT
%define HAVE_LRINTF
%define HAVE_MALLOC_H
%define HAVE_MEMALIGN
%define HAVE_MKSTEMP
%define HAVE_MMAP
%define HAVE_POSIX_MEMALIGN
%define HAVE_ROUND
%define HAVE_ROUNDF
%define HAVE_POLL_H
%define HAVE_SETRLIMIT
%define HAVE_STRERROR_R
%define HAVE_STRTOK_R
%define HAVE_SYMVER
%define HAVE_SYMVER_GNU_ASM
%define HAVE_SYS_MMAN_H
%define HAVE_SYS_RESOURCE_H
%define HAVE_SYS_SELECT_H
%define HAVE_SYS_SOUNDCARD_H
%define HAVE_TERMIOS_H
%define HAVE_THREADS
%define HAVE_TRUNC
%define HAVE_TRUNCF
%define HAVE_YASM
%define CONFIG_DECODERS
%define CONFIG_DEMUXERS
%define CONFIG_PARSERS
%define CONFIG_PROTOCOLS
%define CONFIG_AVCODEC
%define CONFIG_AVDEVICE
%define CONFIG_AVFILTER
%define CONFIG_AVFORMAT
%define CONFIG_FASTDIV
%define CONFIG_FFPROBE
%define CONFIG_FFT
%define CONFIG_GOLOMB
%define CONFIG_H264PRED
%define CONFIG_MDCT
%define CONFIG_PIC
%define CONFIG_RDFT
%define CONFIG_SHARED
%define CONFIG_STATIC
%define CONFIG_SWSCALE_ALPHA
%define CONFIG_AVUTIL
%define CONFIG_THEORA_DECODER
%define CONFIG_VP3_DECODER
%define CONFIG_VP8_DECODER
%define CONFIG_VORBIS_DECODER
%define CONFIG_PCM_F32LE_DECODER
%define CONFIG_PCM_S16LE_DECODER
%define CONFIG_PCM_U8_DECODER
%define CONFIG_VP8_PARSER
%define CONFIG_MATROSKA_DEMUXER
%define CONFIG_OGG_DEMUXER
%define CONFIG_WAV_DEMUXER
| guorendong/iridium-browser-ubuntu | third_party/ffmpeg/chromium/config/Chromium/openbsd/ia32/config.asm | Assembly | bsd-3-clause | 2,067 |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_copy_mem16x16_v6|
; ARM
; REQUIRE8
; PRESERVE8
AREA Block, CODE, READONLY ; name this block of code
;void copy_mem16x16_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride)
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|vp8_copy_mem16x16_v6| PROC
stmdb sp!, {r4 - r7}
;push {r4-r7}
;preload
pld [r0, #31] ; preload for next 16x16 block
ands r4, r0, #15
beq copy_mem16x16_fast
ands r4, r0, #7
beq copy_mem16x16_8
ands r4, r0, #3
beq copy_mem16x16_4
;copy one byte each time
ldrb r4, [r0]
ldrb r5, [r0, #1]
ldrb r6, [r0, #2]
ldrb r7, [r0, #3]
mov r12, #16
copy_mem16x16_1_loop
strb r4, [r2]
strb r5, [r2, #1]
strb r6, [r2, #2]
strb r7, [r2, #3]
ldrb r4, [r0, #4]
ldrb r5, [r0, #5]
ldrb r6, [r0, #6]
ldrb r7, [r0, #7]
subs r12, r12, #1
strb r4, [r2, #4]
strb r5, [r2, #5]
strb r6, [r2, #6]
strb r7, [r2, #7]
ldrb r4, [r0, #8]
ldrb r5, [r0, #9]
ldrb r6, [r0, #10]
ldrb r7, [r0, #11]
strb r4, [r2, #8]
strb r5, [r2, #9]
strb r6, [r2, #10]
strb r7, [r2, #11]
ldrb r4, [r0, #12]
ldrb r5, [r0, #13]
ldrb r6, [r0, #14]
ldrb r7, [r0, #15]
add r0, r0, r1
strb r4, [r2, #12]
strb r5, [r2, #13]
strb r6, [r2, #14]
strb r7, [r2, #15]
add r2, r2, r3
ldrneb r4, [r0]
ldrneb r5, [r0, #1]
ldrneb r6, [r0, #2]
ldrneb r7, [r0, #3]
pld [r0, #31] ; preload for next 16x16 block
bne copy_mem16x16_1_loop
ldmia sp!, {r4 - r7}
;pop {r4-r7}
mov pc, lr
;copy 4 bytes each time
copy_mem16x16_4
ldr r4, [r0]
ldr r5, [r0, #4]
ldr r6, [r0, #8]
ldr r7, [r0, #12]
mov r12, #16
copy_mem16x16_4_loop
subs r12, r12, #1
add r0, r0, r1
str r4, [r2]
str r5, [r2, #4]
str r6, [r2, #8]
str r7, [r2, #12]
add r2, r2, r3
ldrne r4, [r0]
ldrne r5, [r0, #4]
ldrne r6, [r0, #8]
ldrne r7, [r0, #12]
pld [r0, #31] ; preload for next 16x16 block
bne copy_mem16x16_4_loop
ldmia sp!, {r4 - r7}
;pop {r4-r7}
mov pc, lr
;copy 8 bytes each time
copy_mem16x16_8
sub r1, r1, #16
sub r3, r3, #16
mov r12, #16
copy_mem16x16_8_loop
ldmia r0!, {r4-r5}
;ldm r0, {r4-r5}
ldmia r0!, {r6-r7}
add r0, r0, r1
stmia r2!, {r4-r5}
subs r12, r12, #1
;stm r2, {r4-r5}
stmia r2!, {r6-r7}
add r2, r2, r3
pld [r0, #31] ; preload for next 16x16 block
bne copy_mem16x16_8_loop
ldmia sp!, {r4 - r7}
;pop {r4-r7}
mov pc, lr
;copy 16 bytes each time
copy_mem16x16_fast
;sub r1, r1, #16
;sub r3, r3, #16
mov r12, #16
copy_mem16x16_fast_loop
ldmia r0, {r4-r7}
;ldm r0, {r4-r7}
add r0, r0, r1
subs r12, r12, #1
stmia r2, {r4-r7}
;stm r2, {r4-r7}
add r2, r2, r3
pld [r0, #31] ; preload for next 16x16 block
bne copy_mem16x16_fast_loop
ldmia sp!, {r4 - r7}
;pop {r4-r7}
mov pc, lr
ENDP ; |vp8_copy_mem16x16_v6|
END
| blloyd75/theoraplayer | vpx/vp8/common/arm/armv6/copymem16x16_v6.asm | Assembly | bsd-3-clause | 3,983 |
#include "ti86asm.inc"
.org _asm_exec_ram
nop
jp ProgStart
.dw 0
.dw ShellTitle
ShellTitle:
.db "New Assembly Program",0
ProgStart:
.end
| bcherry/bcherry | oldstuff/z80 ASM/test/test.asm | Assembly | mit | 149 |
;
; IDEAS:
; 1: Increment often succeeds a push of temporary, e.g. in the optimized version of #to:do: generated by the compiler,
; so add a Push Temp N and Increment - Shame can't do "push, inc and store" (because of failure case?).
;
; Dolphin Smalltalk
; Byte code Interpreter routines and helpers in Assembler for IX86
; (Blair knows how these work, honest)
;
; DEBUG Build syntax:
; ml /coff /c /Zi /Fr /Fl /Sc /Fo /D_DEBUG /Fo WinDebug\byteasm.obj byteasm.asm
; RELEASE Build syntax:
; ml /coff /c /Zi /Fr /Fl /Sc /Fo WinRel\byteasm.obj byteasm.asm
;
; this will generate debug info (Zi) and full browse info (Fr), and this is
; appropriate for debug and release versions, and a listing with timings
; Notes about __fastcall calling convention:
; - The first two args of DWORD or less size are passed in ecx and
; edx.
; - Other arguments are placed on the stack in the normal CDecl/Stdcall order
; - Return value is in EAX
; - In addition to preserving the normal set of registers, ESI
; EDI, EBP, you must also preserve EBX (surprisingly),
; and ES, FS AND GS (not surprisingly) for 32-bit Mixed language
; programming
;
; Other register conventions:
; - _SP is used to hold the Smalltalk stack pointer
; - _IP is used to hold the Smalltalk instruction pointer
; and is only ever written back to the global when calling
; into C++.
; - Assembler subroutines obey the fastcall calling convention where appropriate
;
; N.B.
; I have tended to replicate small common code sequences to reduce jumps, as these
; are relatively expensive (3 cycles if taken) and performance is even more
; important here than it is for the primitives.
;
; References:
; 1 "How to optimize for the Pentium Processor", Agner Fog, 1996
INCLUDE IstAsm.Inc
.LISTALL
.LALL
.CODE BYTECODES_SEG
ASSUME _IP:PTR BYTE ; Interpreters instruction pointer
ASSUME _BP:PTR Oop ; Interpreters BP (base pointer - points at first arg/temp of method)
ASSUME _SP:PTR Oop ; Interpreters SP (stack pointer)
; If debugging, always turn on profiling
IFDEF _DEBUG
;;PROFILING EQU 1
ENDIF
DECLAREPRIMITIVE primitiveActivateMethod
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Exports
; Byte code dispatch loop
public _byteCodeLoop ; Main entry point from C++
public _invalidByteCode
EXECUTENEWMETHOD EQU ?executeNewMethod@Interpreter@@CIXPAV?$TOTE@VCompiledMethod@ST@@@@I@Z
public EXECUTENEWMETHOD
ACTIVATEPRIMITIVEMETHOD EQU ?activatePrimitiveMethod@Interpreter@@SIXPAVCompiledMethod@ST@@W4_PrimitiveFailureCode@@@Z
public ACTIVATEPRIMITIVEMETHOD
public byteCodeTable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Imports
; Entry points for byte code dispatcher (see primasm.asm)
extern _primitivesTable:near32
IFDEF _DEBUG
extern _primitiveCounters:DWORD
ENDIF
IFDEF PROFILING
extern ?contextReturns@@3IA:DWORD
extern ?contextsSuspended@@3IA:DWORD
extern ?methodsActivated@@3IA:DWORD
extern ?contextsCopied@@3IA:DWORD
extern ?byteCodeCount@@3IA:DWORD
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; C++ method imports
SENDVMINTERRUPT EQU ?sendVMInterrupt@Interpreter@@SIXW4VMInterrupts@1@I@Z
extern SENDVMINTERRUPT:near32
FINDNEWMETHODNOCACHE EQU ?findNewMethodInClassNoCache@Interpreter@@SGPAUMethodCacheEntry@1@PAV?$TOTE@VBehavior@ST@@@@I@Z ; STDCALL, OTE return and arg
extern FINDNEWMETHODNOCACHE:near32
BLOCKCOPY EQU ?blockCopy@Interpreter@@CGPAV?$TOTE@VBlockClosure@ST@@@@UBlockCopyExtension@@@Z
extern BLOCKCOPY:near32 ; See bytecde.cpp
INPUTPOLLCOUNTER EQU ?m_nInputPollCounter@Interpreter@@0JC
extern INPUTPOLLCOUNTER:DWORD
INPUTPOLLINTERVAL EQU ?m_nInputPollInterval@Interpreter@@0JA
extern INPUTPOLLINTERVAL:DWORD
MSGPOLL EQU ?MsgSendPoll@Interpreter@@CGHXZ
extern MSGPOLL:near32 ; See bytecde.cpp
BYTEPOLL EQU ?BytecodePoll@Interpreter@@CGHXZ
extern BYTEPOLL:near32 ; See bytecde.cpp
CHECKPROCESSSWITCH EQU ?CheckProcessSwitch@Interpreter@@CIHXZ
extern CHECKPROCESSSWITCH:near32 ; See process.cpp
STEPPING EQU ?m_bStepping@Interpreter@@0HA
extern STEPPING:DWORD
ResetInputPollCounter MACRO
mov [INPUTPOLLCOUNTER], 2
ENDM
CallCPPAndLoop MACRO mangledName
CallCPP mangledName
DispatchByteCode
ENDM
NONLOCALRETURN EQU ?nonLocalReturnValueTo@Interpreter@@CIXII@Z ; See bytecde.cpp
extern NONLOCALRETURN:near32
NEWCONTEXT EQU ?New@Context@ST@@SIPAV?$TOTE@VContext@ST@@@@II@Z
extern NEWCONTEXT:near32 ; See bytecde.cpp
IFDEF _DEBUG
extern ?executionTrace@Interpreter@@2HA:DWORD
CACHEHITS EQU ?cacheHits@@3IA
extern CACHEHITS:DWORD
DEBUGEXECTRACE EQU ?debugExecTrace@Interpreter@@SIXPAEPAI@Z
extern DEBUGEXECTRACE:near32
DEBUGMETHODACTIVATED EQU ?debugMethodActivated@Interpreter@@SIXPAI@Z
extern DEBUGMETHODACTIVATED:near32
DEBUGRETURNTOMETHOD EQU ?debugReturnToMethod@Interpreter@@SIXPAI@Z
extern DEBUGRETURNTOMETHOD:near32
ENDIF
RESIZEACTIVEPROCESS EQU ?resizeActiveProcess@Interpreter@@SIXXZ
extern RESIZEACTIVEPROCESS:near32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Constants (see also IstAsm.Inc)
EXECUTIONTRACE EQU ?executionTrace@Interpreter@@2HA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Data
.DATA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Macros to generate instruction labels for jump table
CreateInstructionLabel MACRO stem, index
DWORD stem&&index
ENDM
CreateInstructionLabels MACRO stem, count
index = 0
REPEAT count
CreateInstructionLabel stem
index = index + 1
ENDM
ENDM
CreateUniqueInstructionLabels MACRO stem, count
index = 0
REPEAT count
CreateInstructionLabel stem, %index
index = index + 1
ENDM
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Table of byte code routines for dispatch byte codes
;; Those marked with *2 are double byte, *3 triple byte
.CODE BYTECODES_SEG
;; N.B. These must be carefully maintained to ensure that Double Byte instructions start at 204 and Triple Byte
;; instructions at 240
NUMRESERVEDSINGLEBYTE EQU 1 ; Number of extra single byte instructions reserved before start of double byte
NUMRESERVEDDOUBLEBYTE EQU 0 ; Number of extra double byte instructions reserved before start of triple byte
NUMRESERVEDTRIPLEBYTE EQU 0 ; Number of extra triple byte instructions reserved before start of quad byte
FIRSTSHORTPUSHIV EQU 1
NUMSHORTPUSHIVS EQU 16 ; Number of short push instance variable instructions
FIRSTSHORTPUSHTEMP EQU (FIRSTSHORTPUSHIV + NUMSHORTPUSHIVS)
NUMSHORTPUSHTEMPS EQU 8 ; Number of short push temporary variable instructions
FIRSTPUSHCTXTTEMP EQU (FIRSTSHORTPUSHTEMP + NUMSHORTPUSHTEMPS)
NUMPUSHCTXTTEMPS EQU 2
FIRSTPUSHOUTERTEMP EQU (FIRSTPUSHCTXTTEMP + NUMPUSHCTXTTEMPS)
NUMPUSHOUTERTEMPS EQU 2
FIRSTSHORTPUSHCONST EQU (FIRSTPUSHOUTERTEMP + NUMPUSHOUTERTEMPS)
NUMSHORTPUSHCONSTANTS EQU 16 ; Number of short push constant (literal) instructions
FIRSTSHORTPUSHSTATIC EQU (FIRSTSHORTPUSHCONST + NUMSHORTPUSHCONSTANTS)
NUMSHORTPUSHSTATICS EQU 12 ; Number of short push static (literal variable) instructions
FIRSTSHORTPUSHPSEUDO EQU (FIRSTSHORTPUSHSTATIC + NUMSHORTPUSHSTATICS)
NUMSHORTPUSHPSEUDOS EQU 4
FIRSTSHORTPUSHIMMEDIATE EQU (FIRSTSHORTPUSHPSEUDO + NUMSHORTPUSHPSEUDOS)
NUMSHORTPUSHIMMEDIATES EQU 4
FIRSTSHORTPUSHSELFANDTEMP EQU (FIRSTSHORTPUSHIMMEDIATE + NUMSHORTPUSHIMMEDIATES)
NUMSHORTPUSHSELFANDTEMPS EQU 4
FIRSTSHORTSTORETEMP EQU (FIRSTSHORTPUSHSELFANDTEMP + NUMSHORTPUSHSELFANDTEMPS)
NUMSHORTSTORETEMPS EQU 4
SHORTPOPPUSHTEMP EQU (FIRSTSHORTSTORETEMP + NUMSHORTSTORETEMPS)
NUMSHORTPOPPUSHTEMPS EQU 2
POPPUSHSELF EQU (SHORTPOPPUSHTEMP + NUMSHORTPOPPUSHTEMPS)
POPDUP EQU (POPPUSHSELF+1)
FIRSTPOPSTORECTXTTEMP EQU (POPDUP+1)
NUMPOPSTORECTXTTEMPS EQU 2
FIRSTPOPSTOREOUTERTEMP EQU (FIRSTPOPSTORECTXTTEMP + NUMPOPSTORECTXTTEMPS)
NUMPOPSTOREOUTERTEMPS EQU 2
FIRSTPOPNSTOREINSTVAR EQU (FIRSTPOPSTOREOUTERTEMP + NUMPOPSTOREOUTERTEMPS)
NUMPOPNSTOREINSTVARS EQU 8 ; Numbed of short pop and store instance variable instructions
FIRSTPOPNSTORETEMP EQU (FIRSTPOPNSTOREINSTVAR + NUMPOPNSTOREINSTVARS)
NUMPOPNSTORETEMPS EQU 8 ; Number of short pop and store temporary variable instructions
POPSTACK EQU (FIRSTPOPNSTORETEMP + NUMPOPNSTORETEMPS)
INCREMENTSTACKTOP EQU (POPSTACK+1)
DECREMENTSTACKTOP EQU (INCREMENTSTACKTOP+1)
DUPLICATESTACKTOP EQU (DECREMENTSTACKTOP+1) ;
RETURNSELF EQU (DUPLICATESTACKTOP+1)
RETURNTRUE EQU (RETURNSELF+1)
RETURNFALSE EQU (RETURNTRUE+1)
RETURNNIL EQU (RETURNFALSE+1)
RETURNMESSAGESTACKTOP EQU (RETURNNIL+1)
RETURNBLOCKSTACKTOP EQU (RETURNMESSAGESTACKTOP+1)
FARRETURNFROMBLOCK EQU (RETURNBLOCKSTACKTOP+1)
POPRETURNSELF EQU (FARRETURNFROMBLOCK+1)
NOOP EQU (POPRETURNSELF+1)
FIRSTSHORTJUMP EQU (NOOP+1)
NUMSHORTJUMPS EQU 8 ; Number of short jump instructions
FIRSTSHORTJUMPIFFALSE EQU 118; (FIRSTSHORTJUMP+NUMSHORTJUMPS)
NUMSHORTJUMPSIFFALSE EQU 8 ; Number of short conditional jumps on false
FIRSTSPECIALSEND EQU (FIRSTSHORTJUMPIFFALSE+NUMSHORTJUMPSIFFALSE)
NUMEXTRASPECIALSELECTORS EQU 4 ; Number of special selectors which can be modified
NUMSPECIALSENDS EQU (16+2+NUMEXTRASPECIALSELECTORS+10)
FIRSTSHORTSENDNOARGS EQU (FIRSTSPECIALSEND+NUMSPECIALSENDS)
NUMSHORTSENDNOARGS EQU 13 ; Number of short send literal selector N with 0 args instructions
FIRSTSHORTSENDSELFNOARGS EQU (FIRSTSHORTSENDNOARGS + NUMSHORTSENDNOARGS)
NUMSHORTSENDSELFNOARGS EQU 5
FIRSTSHORTSENDONEARG EQU (FIRSTSHORTSENDSELFNOARGS+NUMSHORTSENDSELFNOARGS)
NUMSHORTSENDONEARG EQU 14 ; Number of short send literal selector N with 1 arg instructions
FIRSTSHORTSENDTWOARGS EQU (FIRSTSHORTSENDONEARG+NUMSHORTSENDONEARG)
NUMSHORTSENDTWOARGS EQU 8 ; Number of short send literal selector N with 2 args instructions
FIRSTDOUBLEBYTE EQU 204
PUSHINSTVAR EQU FIRSTDOUBLEBYTE
PUSHTEMPORARY EQU (PUSHINSTVAR+1)
PUSHCONSTANT EQU (PUSHTEMPORARY+1)
PUSHSTATIC EQU (PUSHCONSTANT+1)
STOREINSTVAR EQU (PUSHSTATIC+1)
STORETEMPORARY EQU (STOREINSTVAR+1)
STORESTATIC EQU (STORETEMPORARY+1)
POPSTOREINSTVAR EQU (STORESTATIC+1)
; On Pentiums, "The Jump addresses should be placed in the data segment, not in the code seqment" (Ref 1)
.DATA
ALIGN 16
; N.B. As currently coded, shortPushInstVar MUST come first (i.e. 0..NUMSHORTPUSHIVS-1)
byteCodeTable DD break ; All push[0] instructions are now odd
CreateInstructionLabels <shortPushInstVar>, <NUMSHORTPUSHIVS>
CreateUniqueInstructionLabels <shortPushTemp>, <NUMSHORTPUSHTEMPS>
CreateInstructionLabels <shortPushContextTemp>, <NUMPUSHCTXTTEMPS>
CreateInstructionLabels <shortPushOuterTemp>, <NUMPUSHOUTERTEMPS>
CreateInstructionLabels <shortPushConstant>, <NUMSHORTPUSHCONSTANTS>
CreateInstructionLabels <shortPushStatic>, <NUMSHORTPUSHSTATICS>
; Block of 8 pushes of constants
DWORD shortPushSelf ; N.B. MUST BE ODD! (57)
DWORD shortPushTrue ;
DWORD shortPushFalse ;
DWORD shortPushNil ;
CreateInstructionLabels <shortPushImmediate>, <NUMSHORTPUSHIMMEDIATES>
CreateInstructionLabels <shortPushSelfAndTemp>, <NUMSHORTPUSHSELFANDTEMPS>
CreateInstructionLabels <shortStoreTemp>, <NUMSHORTSTORETEMPS>
CreateInstructionLabels <shortPopPushTemp>, <NUMSHORTPOPPUSHTEMPS>
DWORD popPushSelf
DWORD popDup
CreateInstructionLabels <popStoreContextTemp>, <NUMPOPSTORECTXTTEMPS>
CreateInstructionLabels <shortPopStoreOuterTemp>, <NUMPOPSTOREOUTERTEMPS>
CreateInstructionLabels <shortPopStoreInstVar>, <NUMPOPNSTOREINSTVARS>
CreateInstructionLabels <shortPopStoreTemp>, <NUMPOPNSTORETEMPS>
DWORD popStack ;
;; Additional instructions for the common increment and decrement instructions
DWORD incrementStackTop ; case 87 (not Smalltalk-80)
DWORD decrementStackTop ; case 88 (not Smalltalk-80)
DWORD duplicateStackTop ;
DWORD returnSelf ; Must be in same order as pseudo pushes
DWORD returnTrue ;
DWORD returnFalse ;
DWORD returnNil ; (Normally 123)
DWORD returnMessageStackTop ;
DWORD returnBlockStackTop ;
DWORD farReturnFromBlock ; Reserved for far return from Block (i.e. ^-return)
DWORD popReturnSelf
DWORD noOp ; No Operation. Must be odd number
CreateUniqueInstructionLabels <shortJump>, <NUMSHORTJUMPS>
CreateInstructionLabels <shortJumpIfFalse>, <NUMSHORTJUMPSIFFALSE>
;; Block of 32 special sends, mostly the same as the Smalltalk-80 set
DWORD sendArithmeticAdd ;
DWORD sendArithmeticSubtract ;
DWORD sendArithmeticLessThan ;
DWORD sendArithmeticGreaterThan ;
DWORD sendArithmeticLessOrEqual ;
DWORD sendArithmeticGreaterOrEqual ;
DWORD sendArithmeticEqual ;
DWORD sendArithmeticNotEqual ;
DWORD sendArithmeticMultiply ;
DWORD sendArithmeticDivide ;
DWORD sendArithmeticMod ;
DWORD sendArithmeticBitShift ;
DWORD sendArithmeticDiv ;
DWORD sendArithmeticBitAnd ;
DWORD sendArithmeticBitOr ;
DWORD shortSpecialSendIdentical ;
DWORD shortSpecialSendValue ;
DWORD shortSpecialSendValueColon ;
; The last group special selectors can be changed at will, or removed altogether
CreateUniqueInstructionLabels <shortSpecialSend>, <NUMEXTRASPECIALSELECTORS>
DWORD shortSpecialSendAt ;
DWORD shortSpecialSendAtPut ;
DWORD shortSpecialSendValueValue ;
DWORD shortSpecialSendBasicNew ;
DWORD shortSpecialSendBasicClass ;
DWORD shortSpecialSendBasicSize ;
DWORD shortSpecialSendBasicAt ;
DWORD shortSpecialSendBasicAtPut ;
DWORD shortSpecialSendIsNil ;
DWORD shortSpecialSendNotNil ;
CreateInstructionLabels <shortSendNoArgs>, <NUMSHORTSENDNOARGS>
CreateInstructionLabels <shortSendSelfNoArgs>, <NUMSHORTSENDSELFNOARGS>
CreateInstructionLabels <shortSendOneArg>, <NUMSHORTSENDONEARG> ;
CreateInstructionLabels <shortSendTwoArgs>, <NUMSHORTSENDTWOARGS> ;
DWORD isZero
DWORD pushActiveFrame
DWORD shortSpecialSendNotIdentical
DWORD shortSpecialSendNot
DWORD shortSpecialSendNullCoalesce
CreateInstructionLabels <_invalidByteCode>, <NUMRESERVEDSINGLEBYTE>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Beyond this point, all multi-byte codes (Almost all these codes not Smalltalk-80)
;; Double byte codes (starting from 205)
DWORD pushInstVar ;
DWORD pushTemporary ;
DWORD pushConstant ;
DWORD pushStatic ;
DWORD storeInstVar ;
DWORD storeTemporary ;
DWORD storeStatic ;
DWORD popStoreInstVar ;
DWORD popStoreTemporary ;
DWORD popStoreStatic ;
DWORD pushImmediate
DWORD pushChar
DWORD Send ;
DWORD Supersend ;
DWORD _invalidByteCode ; Reserved for extended special send
DWORD nearJump ;
DWORD nearJumpIfTrue ;
DWORD nearJumpIfFalse ;
DWORD nearJumpIfNil ;
DWORD nearJumpIfNotNil ;
DWORD _invalidByteCode
DWORD _invalidByteCode
DWORD sendTempNoArgs
DWORD pushSelfAndTemp
DWORD pushOuterTemp
DWORD storeOuterTemp
DWORD popStoreOuterTemp
DWORD sendSelfNoArgs
DWORD _invalidByteCode
DWORD pushTempPair
CreateInstructionLabels <_invalidByteCode>, <NUMRESERVEDDOUBLEBYTE>
;; Triple Byte codes (starting from 234)
DWORD longPushConstant
DWORD longPushStatic
DWORD longStoreStatic
DWORD _invalidByteCode
DWORD longPushImmediate
DWORD longSend ;
DWORD longSupersend ;
DWORD longJump ;
DWORD longJumpIfTrue ;
DWORD longJumpIfFalse ;
DWORD longJumpIfNil
DWORD longJumpIfNotNil
DWORD longPushOuterTemp
DWORD longStoreOuterTemp
DWORD incrementTemp
DWORD incrementTempAndPush
DWORD decrementTemp
DWORD decrementTempAndPush
CreateInstructionLabels <_invalidByteCode>, <NUMRESERVEDTRIPLEBYTE>
DWORD blockCopy
DWORD exLongSend
DWORD exLongSupersend
DWORD exLongPushImmediate
CreateInstructionLabels <_invalidByteCode>, <0>
IFDEF _DEBUG
_byteCodeCounters DD 256 DUP (0)
public _byteCodeCounters
_lastByteCode DD 1 DUP (0)
_byteCodePairs DD 65536 DUP (0)
public _byteCodePairs
ENDIF
; N.B. This must be kept up to date with the structure in Interprt.h
MethodCacheEntry STRUCT
selector POTE ?
classPointer POTE ?
method POTE ?
primAddress DWORD ?
MethodCacheEntry ENDS
METHODCACHE EQU ?methodCache@Interpreter@@0PAUMethodCacheEntry@1@A
extern METHODCACHE:MethodCacheEntry
.CODE BYTECODES_SEG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Macros
;; Declare an instruction
ENTERPROC MACRO
ENDM
EXITPROC MACRO
ENDM
ALIGNPROC MACRO
ALIGN 16
ENDM
BEGINPROCNOALIGN MACRO name
name PROC PUBLIC
ENTERPROC
ENDM
BEGINPROC MACRO name
ALIGNPROC
BEGINPROCNOALIGN name
ENDM
BEGINRAREPROC MACRO name
.CODE RAREBC_SEG
name PROC PUBLIC
ENTERPROC
ENDM
ENDPROC MACRO name
name ENDP
ENDM
ENTERBYTECODE MACRO
ENDM
EXITBYTECODE MACRO
ENDM
BEGINBYTECODENOALIGN MACRO name
.CODE BYTECODES_SEG
name PROC PUBLIC
ENTERBYTECODE
ENDM
BEGINBYTECODE MACRO name
.CODE BYTECODES_SEG
ALIGNPROC
name PROC PUBLIC
ENTERBYTECODE
ENDM
ENDBYTECODE MACRO name
EXITBYTECODE
ENDPROC name
ENDM
BEGINRARECODE MACRO name
.CODE RAREBC_SEG
name PROC PUBLIC
ENTERBYTECODE
ENDM
FetchByte MACRO regLetter:=<c>
movzx e®Letter&x, BYTE PTR[_IP]
inc _IP
ENDM
FetchNext MACRO
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _IP
; We must preserve edx and eax so that this is transparent,
; but ecx will be overwritten anyway, so we can ignore that.
push edx
mov edx, _SP
push eax
call DEBUGEXECTRACE
pop eax
pop edx
.ENDIF
ENDIF
FetchByte
IFDEF PROFILING
inc [?byteCodeCount@@3IA]
ENDIF
ENDM
MPrefetch MACRO
IFDEF _DEBUG
ELSE
FetchNext
ENDIF
ENDM
DispatchNext MACRO
IFDEF _DEBUG
FetchNext
inc [_byteCodeCounters+ecx*4]
mov edx, [_lastByteCode]
shl edx, 10
inc [_byteCodePairs+edx+(ecx*4)]
mov [_lastByteCode], ecx
ENDIF
jmp DWORD PTR[byteCodeTable+ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
ENDM
;; Instructions to dispatch the next byte code
;;
DispatchByteCode MACRO
MPrefetch
DispatchNext
ENDM
PopDispatchByteCode MACRO
MPrefetch
sub _SP, OOPSIZE
DispatchNext
ENDM
CountDownOopAndDispatch MACRO
LOCAL deleteObject
ASSUME ecx:PTR OTE ;; ECX contains the object to count down
test cl, 1 ;; Was it an immediate object?
jnz @F ;; Yes, no further processing
mov dl, [ecx].m_count
cmp dl, 0ffh ;; Has count overflowed?
je @F ;; Yes, do nothing
dec dl ;; Two instructions = 2 cycles, dec [mem] = 3 cycles
mov [ecx].m_count, dl
jz addToZct ;; Count reduced to zero?
@@:
DispatchByteCode
addToZct:
AddToZct <c>
DispatchByteCode
ASSUME ecx:NOTHING
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Send macros for sending a selector to the stack top object with zero or more args
SendSelectorOneArgToInteger MACRO selector
mov edx, [selector] ;; access entry in SpecialSelectors table
pushd 1 ;; 1 argument
mov [STACKPOINTER], _SP ;; Save down stack pointer (needed for DNU and C++ primitives)
mov ecx, [Pointers.ClassSmallInteger]
mov [MESSAGE], edx ;; Set interpreters messageSelector register (no effect on flags)
jmp execMethodOfClass ;; Jump directly to exec. routine
ENDM
SendSelectorOneArgToObjectEAX MACRO selector
ASSUME eax:PTR OTE ;; N.B. Expects receiver in EAX
mov edx, [selector] ;; access entry in SpecialSelectors table
mov [STACKPOINTER], _SP ;; Save down SP for DNU and prims
pushd 1 ;; 0 argument
mov ecx, [eax].m_oteClass ;; Get the class of the Object
mov [MESSAGE], edx ;; Set the MESSAGE global
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDM
SendSelectorArgs MACRO selector, args
LOCAL sendToSmallInteger
mov edx, [selector] ;; access entry in SpecialSelectors table
pushd args ;; N arguments
mov eax, [_SP-(OOPSIZE*args)] ;; Load receiver into EAX (under args)
mov [STACKPOINTER], _SP ;; Save down SP for DNU and C++ prims
mov [MESSAGE], edx ;; Set the MESSAGE global
test al, 1
jnz execMethodOfSmallInteger
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass ;; Get the class of the Object
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDM
SendSelectorNoArgs MACRO selector
SendSelectorArgs selector, 0
ENDM
SendSelectorOneArg MACRO selector
SendSelectorArgs selector, 1
ENDM
SendSelectorTwoArgs MACRO selector
SendSelectorArgs selector, 2
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Reference count helper(s)
;; push an Oop onto the stack, overwriting whatever is there
;; Inputs:
;; EDX = Oop to push
;; _SP = Stack pointer
;; Outputs:
;; EDX = destroyed
;; EAX = destroyed
;;
PushOop MACRO regLetter
; To avoid AGI stall, use offset and add afterwards
mov [_SP+OOPSIZE], e®Letter&x ;; push object onto stack
add _SP, OOPSIZE
ENDM
PushAndDispatch MACRO regLetter
ASSERTNEQU c, ®Letter
MPrefetch
PushOop regLetter
DispatchNext
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Byte code Dispatching
GetInitialIPOfMethod MACRO methodPtr
mov _IP, [methodPtr].m_byteCodes
.IF (_IP & 1)
lea _IP, [methodPtr].m_byteCodes
.ELSE
IFDEF _DEBUG
.IF (_IP == [oteNil])
int 3
.ENDIF
ENDIF
mov _IP, (OTE PTR[_IP]).m_location
;; There is no longer any header on the object body to skip here
.ENDIF
ENDM
ASSUME _IP:PTR BYTE
; The main byte code loop entry point from C++.
; Never returns except to an enclosing exception handler
BEGINPROC _byteCodeLoop
mov _BP, [BASEPOINTER]
mov _IP, [INSTRUCTIONPOINTER]
MPrefetch
mov _SP, [STACKPOINTER]
DispatchNext
ENDPROC _byteCodeLoop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Byte Code Interpretation routines.
;; Attempt to get most frequest instructions on same page as byte code loop
;; for locality of reference
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Instance Variable Instructions (single byte)
PushInstVar MACRO index
mov eax, [_BP-OOPSIZE] ;; Load Oop of receiver (_BP-1) (u)
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to receiver (u)
mov eax, (Object PTR[eax]).fields[index*OOPSIZE] ;; Load inst var into edx
PushAndDispatch <a>
ENDM
; On the Pentium there is relatively little benefit to inlining the instructions, since the cost
; of the extra instruction to access the index from the instruction is hidden in
; pairing and the fact that the arithmetic can be done in the load address calc.
; so we might as well save the space (increasing caching possibilities too)
BEGINBYTECODE shortPushInstVar
mov eax, [_BP-OOPSIZE] ;; Load Oop of receiver (_BP-1)
mov edx, ecx
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to receiver
ASSUME eax:Ptr Object
MPrefetch
mov eax, [eax].fields[edx*OOPSIZE-(FIRSTSHORTPUSHIV*OOPSIZE)]
ASSUME eax:Oop
PushOop <a>
DispatchNext
ENDBYTECODE shortPushInstVar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Temporary Variable Instructions (single byte)
;; Note that these push stack temporaries, not environment temps
;;
PushTemporary MACRO index
mov eax, [_BP+index*OOPSIZE] ;; Load temp var Oop from _BP
PushAndDispatch <a> ;; Push Oop in edx, and dispatch next (no clear ECX)
ENDM
PushTemporaryN MACRO index
ALIGN 4
BEGINBYTECODENOALIGN shortPushTemp&index
PushTemporary index
ENDBYTECODE shortPushTemp&index
ENDM
ALIGN 16
index = 0
REPEAT NUMSHORTPUSHTEMPS
PushTemporaryN %index
index = index + 1
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Special push instructions (single byte)
;; This used to be the most commonly executed instruction, but now push temp 0 and return stack top are
;; more common because of the macro forms
ALIGN 16
BEGINBYTECODE shortPushSelf
mov eax, [_BP-OOPSIZE] ; Access receiver at _BP-1
PushAndDispatch <a>
ENDBYTECODE shortPushSelf
;; Macro instruction combining
;; push self
;; push temp[n]
;;
ALIGN 16
BEGINBYTECODE shortPushSelfAndTemp
mov edx, [_BP-OOPSIZE] ; Access receiver at _BP-1
mov eax, [_BP+(ecx*OOPSIZE)-(FIRSTSHORTPUSHSELFANDTEMP*OOPSIZE)] ;; Load temp var Oop from _BP
MPrefetch
mov [_SP+OOPSIZE], edx ;; push object onto stack
mov [_SP+OOPSIZE*2], eax
add _SP, OOPSIZE*2
DispatchNext
ENDBYTECODE shortPushSelfAndTemp
BEGINBYTECODE pushTempPair
movzx ecx, BYTE PTR[_IP]
mov eax, ecx
inc _IP
shr ecx, 4
and eax, 0Fh
mov ecx, [_BP+ecx*OOPSIZE] ;; Load temp var Oop from _BP
mov eax, [_BP+eax*OOPSIZE] ;; Load temp var Oop from _BP
mov [_SP+OOPSIZE], ecx
MPrefetch
mov [_SP+OOPSIZE*2], eax
add _SP, OOPSIZE*2
DispatchNext
ENDBYTECODE pushTempPair
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Context Temp (i.e. Push Outer [0] Temp [N]) (single byte)
BEGINBYTECODE shortPushContextTemp
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov edx, [edx].m_environment
mov edx, (OTE PTR[edx]).m_location
ASSUME edx:PTR Context
mov eax, [edx].m_tempFrame[ecx*OOPSIZE-(FIRSTPUSHCTXTTEMP*OOPSIZE)]
PushAndDispatch <a>
ENDBYTECODE shortPushContextTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Outer Temp (i.e. Push Outer [1] Temp [N]) (single byte)
;; Hmm, indirections make for a lot of AGI faults here (unfortunately)
BEGINBYTECODE shortPushOuterTemp
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov edx, [edx].m_environment
ASSUME edx:PTR OTE
mov edx, [edx].m_location
ASSUME edx:PTR Context
mov edx, [edx].m_outer
ASSUME edx:PTR OTE
mov edx, [edx].m_location
ASSUME edx:PTR Context
mov eax, [edx].m_tempFrame[ecx*OOPSIZE-(FIRSTPUSHOUTERTEMP*OOPSIZE)]
PushAndDispatch <a>
ENDBYTECODE shortPushOuterTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Literal Constant Instructions (single byte)
LoadLiteralAt MACRO offset
ASSERTNEQU eax, &offset
mov eax, [pMethod] ;; Load pointer to current method
mov eax, (CompiledCodeObj PTR[eax]).m_aLiterals[offset] ;; Load Oop from literal frame
ENDM
LoadLiteral MACRO index
LoadLiteralAt index*OOPSIZE
ENDM
PushConstantAt MACRO offset
LoadLiteralAt offset
PushAndDispatch <a>
ENDM
PushConstant MACRO index
PushConstantAt index*OOPSIZE
ENDM
PushConstantN MACRO index
BEGINBYTECODE shortPushConstant&index
PushConstant index
ENDBYTECODE shortPushConstant&index
ENDM
BEGINBYTECODE shortPushConstant
mov eax, [pMethod] ;; Load pointer to current method
mov eax, (CompiledCodeObj PTR[eax]).m_aLiterals[(ecx*OOPSIZE) - (FIRSTSHORTPUSHCONST*OOPSIZE)] ;; Load Oop from literal frame
PushAndDispatch <a>
ENDBYTECODE shortPushConstant
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short Push Static (Literal) Variable Instructions (single byte)
LoadStatic MACRO index
LoadLiteral index
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to binding
mov eax, (Object PTR[eax]).fields[OOPSIZE] ;; Load value Oop from binding
ENDM
PushStatic MACRO index
IFDEF _DEBUG
LoadStatic index
PushAndDispatch <a> ;; Push eax onto the stack
ELSE
mov eax, [pMethod] ;; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
xor ecx, ecx
add _SP, OOPSIZE ;; We're going to push, so prepare _SP
mov eax, [eax].m_aLiterals[index*OOPSIZE] ;; Load Oop from literal frame
ASSUME eax:PTR OTE
mov cl, [_IP] ;; Load next instruction
mov eax, [eax].m_location ;; Load pointer to binding
ASSUME eax:PTR Object
inc _IP
mov eax, [eax].fields[OOPSIZE] ;; Load value Oop from binding
;; Now Push eax onto the stack
mov [_SP], eax ;; push inst var onto stack
ASSUME eax:NOTHING
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
ENDIF
ENDM
PushStaticN MACRO index
BEGINBYTECODE shortPushStatic&index
PushStatic %index
ENDBYTECODE shortPushStatic&index
ENDM
BEGINBYTECODE shortPushStatic
IFDEF _DEBUG
mov eax, [pMethod] ;; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
mov eax, [eax].m_aLiterals[(ecx*OOPSIZE)-(FIRSTSHORTPUSHSTATIC*OOPSIZE)] ;; Load Oop from literal frame
ASSUME eax:NOTHING
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to binding
mov eax, (Object PTR[eax]).fields[OOPSIZE] ;; Load value Oop from binding
PushAndDispatch <a>
ELSE
mov eax, [pMethod] ;; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
add _SP, OOPSIZE ;; We're going to push, so prepare _SP
mov eax, [eax].m_aLiterals[(ecx*OOPSIZE)-(FIRSTSHORTPUSHSTATIC*OOPSIZE)] ;; Load Oop from literal frame
ASSUME eax:NOTHING
xor ecx, ecx
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to binding
mov cl, BYTE PTR[_IP]
mov eax, (Object PTR[eax]).fields[OOPSIZE] ;; Load value Oop from binding
inc _IP
;; Now Push eax onto the stack
mov [_SP], eax ;; push inst var onto stack
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
ENDIF
ENDBYTECODE shortPushStatic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Store into a stack temp. Note no ref. counting needed, as all on the stack
BEGINBYTECODE shortPopStoreTemp
mov eax, [_SP]
sub _SP, OOPSIZE
mov [_BP+(ecx*OOPSIZE)-(FIRSTPOPNSTORETEMP*OOPSIZE)], eax
DispatchByteCode
ENDBYTECODE shortPopStoreTemp
BEGINBYTECODE shortStoreTemp
mov eax, [_SP]
mov [_BP+(ecx*OOPSIZE)-(FIRSTSHORTSTORETEMP*OOPSIZE)], eax
DispatchByteCode
ENDBYTECODE shortStoreTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Instructions (double Byte).
;;
BEGINBYTECODE pushSelfAndTemp
mov eax, [_BP-OOPSIZE] ; Access receiver at _BP-1
FetchByte <d>
PushOop <a> ; push receiver
mov eax, [_BP+edx*OOPSIZE] ; Load temp var Oop from _BP
PushAndDispatch <a> ; Push Oop in edx, and dispatch next (no clear ECX)
ENDBYTECODE pushSelfAndTemp
;; Extension is the index (0 based)
; pushInstVar - see shortPushInstVar above
BEGINBYTECODE pushInstVar
mov eax, [_BP-OOPSIZE] ;; Load Oop of receiver (_BP-1)
FetchByte <d>
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to receiver
ASSUME eax:Ptr Object
MPrefetch
mov eax, [eax].fields[edx*OOPSIZE]
ASSUME eax:Oop
PushOop <a>
DispatchNext
ENDBYTECODE pushInstVar
BEGINBYTECODE pushTemporary
FetchByte
PushTemporary ecx
ENDBYTECODE pushTemporary
OuterTempPreamble MACRO
movzx ecx, BYTE PTR[_IP]
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov eax, ecx
and eax, 31 ; Bottom 5 bits are temp index
shr ecx, 5 ; Top 3 bits are outer path distance
mov edx, [edx].m_environment
mov edx, (OTE PTR[edx]).m_location
ASSUME edx:PTR Context
.WHILE ecx > 0
mov edx, [edx].m_outer
mov edx, (OTE PTR[edx]).m_location
dec ecx
.ENDW
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Outer Temporary Instruction (double byte)
BEGINBYTECODE pushOuterTemp
OuterTempPreamble
mov cl, BYTE PTR[_IP+1]
mov eax, [edx].m_tempFrame[eax*OOPSIZE]
IFDEF _DEBUG
inc _IP
PushOop <a>
DispatchByteCode
ELSE
add _IP, 2
PushOop <a>
DispatchNext
ENDIF
ENDBYTECODE pushOuterTemp
BEGINBYTECODE pushConstant
IFDEF _DEBUG
FetchByte
PushConstant ecx
ELSE
mov eax, [pMethod] ;; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
movzx ecx, [_IP] ;; Load literal index
add _SP, OOPSIZE ;; We're going to push, so prepare _SP
inc _IP
mov eax, [eax].m_aLiterals[ecx*OOPSIZE] ;; Load Oop from literal frame
ASSUME eax:NOTHING
MPrefetch
mov [_SP], eax ;; push literal const onto stack
DispatchNext
ENDIF
ENDBYTECODE pushConstant
BEGINBYTECODE pushStatic
IFDEF _DEBUG
FetchByte
PushStatic <ecx>
ELSE
mov eax, [pMethod] ;; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
movzx ecx, [_IP] ;; Load literal index
add _SP, OOPSIZE ;; We're going to push, so prepare _SP
inc _IP
mov eax, [eax].m_aLiterals[ecx*OOPSIZE] ;; Load Oop from literal frame
MPrefetch
mov eax, (OTE PTR[eax]).m_location ;; Load pointer to binding
ASSUME eax:PTR Object
mov eax, [eax].fields[OOPSIZE] ;; Load value Oop from binding
mov [_SP], eax ;; push value onto stack
ASSUME eax:NOTHING
DispatchNext
ENDIF
ENDBYTECODE pushStatic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BEGINBYTECODE shortPopStoreInstVar
mov edx, [_BP-OOPSIZE] ;; Load Oop of receiver from _BP-1
ASSUME edx:PTR OTE
sub ecx, FIRSTPOPNSTOREINSTVAR
mov eax, [edx].m_location ;; Load pointer to receiver
ASSUME eax:PTR Object
shl ecx, OOPSHIFT
cmp ecx, [edx].m_size
jge storeError ;; Out of bounds, or immutable
lea edx, [eax].fields[ecx]
ASSUME edx:PTR Oop
mov ecx, [_SP] ;; ECX is the popped Oop
sub _SP, OOPSIZE
CountUpOopIn <c> ;; N.B. Storing into a heap object slot
;; Load pointer to inst var into edx
mov eax, [edx] ;; Load existing value of inst var into EAX for countDown
test al, 1
mov [edx], ecx ;; Store Oop from stack top into inst var slot
ASSUME edx:NOTHING
jnz @F ;; SmallInteger, so skip the count down
CountDownObjectIn <a>
@@:
DispatchByteCode
storeError:
;; An attempt was made to store out of bounds, or into an immutable object
;; We must send #instVarAt:put:, leaving the IP of the current frame
;; at the store instruction
ASSUME edx:PTR OTE ;; edx is still the Oop of the receiver
ASSUME ecx:DWORD ;; ecx is store offset
ASSUME eax:NOTHING
mov eax, [_SP] ;; EAX is the Oop being stored
shr ecx, OOPSHIFT-1
mov [_SP], edx ;; Push receiver
add ecx, 03h ;; Convert zero-based to one-based index and set SmallInteger flag
dec _IP ;; Leave IP at pop;store IV instruction
mov [_SP+OOPSIZE], ecx ;; Push index
mov [_SP+(OOPSIZE*2)], eax ;; Push arg
add _SP, OOPSIZE*2 ;; Two args
SendSelectorTwoArgs <Pointers.instVarAtPutSymbol>
ENDBYTECODE shortPopStoreInstVar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Pop Stack Top Instruction (single byte)
;;
BEGINBYTECODE popStack
MPrefetch
sub _SP, OOPSIZE ;; Perform the actual pop
DispatchNext
ENDBYTECODE popStack
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Duplicate Stack Top Instruction (single byte)
;; Replicate the object on top of the stack.
BEGINBYTECODE duplicateStackTop
mov eax, [_SP]
PushAndDispatch <a>
ENDBYTECODE duplicateStackTop
BEGINBYTECODE popPushSelf
mov eax, [_BP-OOPSIZE] ; Access receiver at _BP-1
MPrefetch
mov [_SP], eax ; Replace stack top with receiver
DispatchNext
ENDBYTECODE popPushSelf
BEGINBYTECODE shortPopPushTemp
mov eax, [_BP+(ecx*OOPSIZE)-(SHORTPOPPUSHTEMP*OOPSIZE)] ; Load temp var Oop from _BP
MPrefetch
mov [_SP], eax ; Replace stack top with temp
DispatchNext
ENDBYTECODE shortPopPushTemp
BEGINBYTECODE popDup
mov eax, [_SP-OOPSIZE] ; Load object under stack top
MPrefetch
mov [_SP], eax ; Dup
DispatchNext
ENDBYTECODE popDup
;; Macro instruction combining
;; push self
;; send [n] with 0 args
;;
BEGINBYTECODE sendSelfNoArgs
mov eax, [_BP-OOPSIZE] ; Access receiver at _BP-1
FetchByte
; ecx-offset is the literal index
mov edx, [pMethod] ; Load current method
ASSUME edx:PTR CompiledCodeObj
PushOop <a> ; push receiver
test al, 1 ; Test for immediate receiver (used later)
mov [STACKPOINTER], _SP ; Save down stack pointer (needed for DNU and C++ primitives)
mov edx, [edx].m_aLiterals[ecx*OOPSIZE] ; Load selector Oop into ecx
pushd 0 ; 0 arguments
mov [MESSAGE], edx ; Save down message
jnz @F ; If a SmallInteger need to load class differently
mov ecx, (OTE PTR[eax]).m_oteClass ; Get class into ECX
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
@@:
mov ecx, [Pointers.ClassSmallInteger]
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ASSUME ecx:NOTHING
ENDBYTECODE sendSelfNoArgs
BEGINBYTECODE shortPushTrue
mov eax, [oteTrue]
PushAndDispatch <a>
ENDBYTECODE shortPushTrue
BEGINBYTECODE shortPushFalse
mov eax, [oteFalse]
PushAndDispatch <a>
ENDBYTECODE shortPushFalse
;; This is a very commonly executed instruction
BEGINBYTECODE shortPushNil
mov eax, [oteNil]
PushAndDispatch <a>
ENDBYTECODE shortPushNil
IF 1
BEGINBYTECODE shortPushImmediate
lea eax, [(ecx*2)-((FIRSTSHORTPUSHIMMEDIATE + 1)*2)+1]
MPrefetch
mov [_SP+OOPSIZE], eax
add _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortPushImmediate
ELSE
;; These routines would have better pairability if the small integer value was first loaded into
;; eax, BUT, that doesn't save any cycles (they take only 5), and increase the number of instructions
;; and the size of the procedures by 4 bytes a piece
BEGINBYTECODE shortPushMinusOne
MPrefetch
mov [_SP+OOPSIZE], -1
add _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortPushMinusOne
BEGINBYTECODE shortPushZero
MPrefetch
mov [_SP+OOPSIZE], SMALLINTZERO
add _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortPushZero
BEGINBYTECODE shortPushOne
MPrefetch
mov [_SP+OOPSIZE], SMALLINTONE
add _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortPushOne
BEGINBYTECODE shortPushTwo
MPrefetch
mov [_SP+OOPSIZE], SMALLINTTWO
add _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortPushTwo
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Signed Byte Instruction (double byte)
;;
;; Extension (-128..127) is value to be pushed as SmallInteger
BEGINBYTECODE pushImmediate
; Optimized form...
movsx eax, BYTE PTR[_IP] ; Sign extend next byte into EAX
add _SP, OOPSIZE
movzx ecx, [_IP+1]
lea eax, [eax+eax+1] ; Convert to SmallInteger
add _IP,2
mov [_SP], eax ; push SmallInteger onto stack
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
push ecx
mov ecx, _IP
mov edx, _SP
dec ecx
call DEBUGEXECTRACE
pop ecx
.ENDIF
inc [_byteCodeCounters+ecx*4]
ENDIF
IFDEF PROFILING
inc [?byteCodeCount@@3IA]
ENDIF
jmp byteCodeTable[ecx*4] ; Transfer control via jump table (will return to dispatchByte)
ENDBYTECODE pushImmediate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Return instructions
ReturnOopToSender MACRO oop
mov edx, [ACTIVEFRAME] ; Load pointer to top stack frame into EDX
ASSUME ecx:Oop
ASSUME edx:PStackFrame
; Note that the frame could still have an associated context if we are returning from a method
; that has full blocks.
mov edx, [edx].m_caller ; Load sender frame of active frame (Does not affect flags)
ASSUME edx:PTR Oop
call shortReturn
DispatchByteCode
ENDM
BEGINBYTECODE popReturnSelf
mov eax, [_SP]
sub _SP, OOPSIZE
; Drop through...
ENDBYTECODE popReturnSelf
BEGINBYTECODENOALIGN returnSelf
;;
;; Return receiver to sending context is a very common operation (default method
;; return), but dynamically it occurs much less frequently than return message
;; stack top. We need to inc. ref. count of receiver as return routine pushes it on
;; without ref. count.
;;
mov ecx, [_BP-OOPSIZE] ; Receiver is one below _BP
ReturnOopToSender
ENDBYTECODE returnSelf
BEGINBYTECODE returnTrue
mov ecx, [oteTrue] ; Load True Oop
ReturnOopToSender
ENDBYTECODE returnTrue
BEGINBYTECODE returnFalse
mov ecx, [oteFalse] ; Load False Oop
ReturnOopToSender
ENDBYTECODE returnFalse
BEGINBYTECODE returnNil
mov ecx, [oteNil] ; Load Nil Oop
ReturnOopToSender
ENDBYTECODE returnNil
;; When returning from a block using this instruction, we always return from our
;; caller. As we are a block context, then ACTIVECONTEXT must be a genuine
;; Object, and not a SmallInteger pointer into the stack (Blocks are never stored on the stack).
BEGINBYTECODE returnBlockStackTop
; TODO: Can implement this slightly more efficiently as don't need to check for no-context case
; ... Drop through and implement as normal short return ....
ENDBYTECODE returnBlockStackTop
;; Return message stack top is one of the most commonly occurring bytecodes (both
;; statically and dynamically)
BEGINBYTECODENOALIGN returnMessageStackTop
mov ecx, [_SP] ; Load stack top into register
sub _SP, OOPSIZE ; Adjust SP for pop
ReturnOopToSender
ENDBYTECODE returnMessageStackTop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Context (short) return routine
; Inputs:
; ECX - Return Value Oop
; EDX - Return frame (SmallInteger pointer into active process stack)
;
; Outputs:
; _SP - Updated to point at return contexts saved _SP + 1, with return value stored at stack top
; EBX - Points to base temps and args
; EDI - Points at next instruction to execute in method
; EAX - Destroyed
; ECX - Destroyed
; EDX - Destroyed
;
; N.B. We can freely use EDI, and EBX since these will be reloaded anyway for the return context
; No alignment (drop through from above)
BEGINPROC shortReturn
; If returning FROM a full method context, need to nil old frame pointer to mark as returned
mov eax, [ACTIVEFRAME] ; u - Load old frame pointer
ASSUME eax:PStackFrame
lea _BP, [edx-1]
ASSUME _BP:PStackFrame
ASSUME edx:NOTHING ; EDX now free for other uses
mov eax, [eax].m_environment ; Load context Oop of frame being returned from
mov [ACTIVEFRAME], _BP ; Save down new active frame pointer
.IF !(al & 1) ; Has a full context?
ASSUME eax:PTR OTE ; Yes, BP points at context object
mov edx, [eax].m_location ; Load pointer to the Context
ASSUME edx:PTR Context
.IF ([edx].m_outer & 1) ; Is it a Method context?
mov [edx].m_outer, SMALLINTZERO ; Yes, zero out the frame
.ENDIF
.ENDIF
ASSUME eax:NOTHING
ASSUME edx:NOTHING
; First adjust stack to SP of return context
mov _SP, [_BP].m_sp ; Get _SP of return context - use the _IP register
add _SP, OOPSIZE-1 ; Adjust to point at return value slot
; _BP still points at return StackFrame
mov eax, [_BP].m_method ; Get Oop of method
ASSUME eax:PTR OTE
mov _IP, [_BP].m_ip ; Load _IP before we overwrite pNewContext
mov [_SP], ecx ; Push on the result
mov eax, [eax].m_location ; Get pointer to new Method into EAX
ASSUME eax:PTR CompiledCodeObj
;; Now we set up _IP (_IP) and _BP (_BP) - _SP adjusted above
sar _IP, 1 ; Convert SmallInteger _IP index
ASSUME _IP:PTR BYTE
mov [pMethod], eax ; Save down pointer to method into global
mov _BP, [_BP].m_bp ; Load context Oop of return frame
ASSUME _BP:PTR Oop
MUSTBEINTEGEROBJECT<_BP>
;; Get instruction base address into EAX
.IF !((BYTE PTR([eax].m_byteCodes) & 1))
mov eax, [eax].m_byteCodes ; Bytes in a ByteArray, offset includes header size
ASSUME eax:PTR OTE
mov eax, [eax].m_location ; Load the address of the start of the byte code array
.ELSE
add eax, CompiledCodeObj.m_byteCodes ; Bytes packed in SmallInteger
.ENDIF
dec _BP ; Remove SmallInteger flag from BP
add _IP, eax ; Add base to current offset to give _IP of return context
mov [BASEPOINTER], _BP ; save it down for C++
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _SP
call DEBUGRETURNTOMETHOD
mov ecx, _IP
mov edx, _SP
.ENDIF
ENDIF
ret
shortReturn ENDP
BEGINBYTECODE farReturnFromBlock
mov edx, [ACTIVEFRAME] ; Load pointer to top stack frame into EDX
mov ecx, [_SP] ; Load stack top into register
sub _SP, OOPSIZE ; Adjust SP for pop
ASSUME ecx:Oop
ASSUME edx:PStackFrame
mov eax, [edx].m_environment ; Load context of frame into EAX
CANTBEINTEGEROBJECT <eax>
mov edx, [edx].m_caller ; Load sender frame of active frame (Does not affect flags)
ASSUME edx:PTR Oop
; Full context, so need to check if Block - outer will be SmallInteger if a method context
mov eax, [eax].m_location ; Load pointer to context object
mov eax, (Context PTR[eax]).m_outer ; Load home context or frame offset
CANTBEINTEGEROBJECT <eax>
; We want to return to the sender of the blocks home context (something tied down at closure time
; not activation time) so chain up through contexts until locate home
; EAX still contains Oop of outer context
.REPEAT
mov edx, [eax].m_location ; Load pointer to home method context
ASSUME edx:PTR Context
mov eax, [edx].m_outer ; Load frame index of home context into EDX
.UNTIL (eax & 1)
cmp eax, SMALLINTZERO ; Already returned?
je invalidReturn ; Yes, cannot return from home
xor eax, 1 ; Remove SmallInteger flag, hey presto pointer to frame
ASSUME eax:PStackFrame
cmp eax, [ACTIVEFRAME]
jge invalidReturn
cmp eax, [ACTIVEPROCESS]
jle invalidReturn
mov edx, [eax].m_caller
ASSUME edx:Oop
mov eax, [ACTIVEFRAME]
ASSUME eax:PStackFrame
cmp [eax].m_caller, edx ; Actually returning to the caller?
jne @F
; Yes, its a short return after all
call shortReturn
DispatchByteCode
@@:
; Not returning to caller, need to perform unwind
CallCPP <NONLOCALRETURN>
DispatchByteCode
ENDBYTECODE farReturnFromBlock
;; A little entry thunk for the C++ routine which raises and error for attempts to return
;; from contexts which have already returned and/or attempts to perform cross process returns
BEGINRAREPROC invalidReturn
mov eax, [Pointers.Scheduler] ; Processor receives #cannotReturn:
mov [_SP+OOPSIZE], eax ; Push processor
mov [_SP+OOPSIZE*2], ecx ; Push result
add _SP, OOPSIZE*2
SendSelectorOneArgToObjectEAX <Pointers.CannotReturnSelector>
ENDPROC invalidReturn
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Return the first argument to the stack frame at the address specified by the second arg.
; Primitive here for locality of reference
BEGINPRIMITIVE primitiveReturn
mov eax, [ACTIVEPROCESS]
ASSUME eax:PTR Process
mov edx, [_SP] ; Get the frame index (a SmallInteger)
mov ecx, [_SP-OOPSIZE] ; Get return value
sub _SP, OOPSIZE*2 ; Args ref. count will be assumed for return value, so ensure not popped
sub edx, 3 ; Convert SmallInteger index to zero based offset * 2 (i.e. word offset)
add eax, OFFSET Process.m_stack + 1 ; Adjust for fixed inst. vars (note that 1 added to get frame Oop result at end)
shl edx, 1 ; Convert to byte offset
add edx, eax ; Calculate the frame Oop, which is expected in EDX
mov eax, [ACTIVEFRAME]
ASSUME eax:PStackFrame
cmp [eax].m_caller, edx ; Returning to active contexts caller?
jne @F
call shortReturn
mov eax, _SP ; primitiveSuccess(0)
ret
@@:
; Store interpreter registers before calling C++ func
mov [INSTRUCTIONPOINTER], _IP
mov [STACKPOINTER], _SP
call NONLOCALRETURN
; Reload interpreter registers afer non-local return (note SP is reloaded from eax after calling all primitives)
mov _IP, [INSTRUCTIONPOINTER]
mov eax, [STACKPOINTER]
mov _BP, [BASEPOINTER]
ret
ENDPRIMITIVE primitiveReturn
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ASSUME ecx:NOTHING
ASSUME _BP:PTR Oop
BEGINBYTECODE popStoreContextTemp
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov eax, [_SP] ; Loop Oop from stack top
ASSUME eax:Oop
mov edx, [edx].m_environment
sub _SP, OOPSIZE
mov edx, (OTE PTR[edx]).m_location
ASSUME edx:PTR Context
lea edx, [edx].m_tempFrame[ecx*OOPSIZE-(FIRSTPOPSTORECTXTTEMP*OOPSIZE)]
ASSUME edx:PTR Oop
; We must count up the new value as we are going to store it into a heap object
CountUpOopIn<a>
; Swap existing value with new value
mov ecx, [edx]
mov [edx], eax
; Since count down destroys register contents, we can't pre-fetch
CountDownOopIn<c>
DispatchByteCode
ENDBYTECODE popStoreContextTemp
BEGINBYTECODE shortPopStoreOuterTemp
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov eax, [_SP] ; Loop Oop from stack top
ASSUME eax:Oop
mov edx, [edx].m_environment
sub _SP, OOPSIZE
ASSUME edx:PTR OTE
mov edx, [edx].m_location
ASSUME edx:PTR Context
mov edx, [edx].m_outer
ASSUME edx:PTR OTE
mov edx, [edx].m_location
ASSUME edx:PTR Context
lea edx, [edx].m_tempFrame[ecx*OOPSIZE-(FIRSTPOPSTOREOUTERTEMP*OOPSIZE)]
ASSUME edx:PTR Oop
; We must count up the new value as we are going to store it into a heap object
CountUpOopIn<a>
; Swap existing value with new value
mov ecx, [edx]
mov [edx], eax
; Since count down destroys registers we can't prefetch
CountDownOopIn<c>
DispatchByteCode
ENDBYTECODE shortPopStoreOuterTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (Pop And) Store Instance Variable (double byte)
;;
;; Extension is inst var index (0 based)
; Similar to short store, but we need to use lea here as not enough registers free to perform
; address calculation more than once.
StoreInstVarAndDispatch MACRO
ASSUME eax:Oop ;; EAX is the Oop to be stored
ASSUME ecx:DWORD ;; ECX is zero-based inst var index
mov edx, [_BP-OOPSIZE] ;; Load Oop of receiver from _BP-1
ASSUME edx:PTR OTE
shl ecx, OOPSHIFT ;; Convert to byte offset
cmp ecx, [edx].m_size ;; Check not out of bounds, or immutable
jge storeError
mov edx, [edx].m_location ;; Load pointer to receiver
ASSUME edx:PTR Object
lea edx, [edx].fields[ecx]
ASSUME edx:PTR Oop
CountUpOopIn <a>
mov ecx, [edx] ;; Load existing value of inst var into ECX for countDown
mov [edx], eax ;; Store Oop from stack top into inst var
ASSUME edx:NOTHING
CountDownOopAndDispatch
storeError:
;; An attempt was made to store out of bounds, or into an immutable object
;; We must send #instVarAt:put:, leaving the IP of the current frame
;; at the store instruction
ASSUME edx:PTR OTE ;; edx is still the Oop of the receiver
ASSUME ecx:DWORD ;; ecx is store offset
ASSUME eax:Oop ;; eax is the Oop to store
shr ecx, OOPSHIFT-1
mov [_SP+OOPSIZE], edx ;; Push receiver
add ecx, 03h ;; Convert zero-based to one-based index and set SmallInteger flag
sub _IP,2 ;; Leave IP at (pop)store IV instruction
mov [_SP+(OOPSIZE*2)], ecx ;; Push index
mov [_SP+(OOPSIZE*3)], eax ;; Push arg
add _SP, OOPSIZE*3 ;; Receiver + Two args
SendSelectorTwoArgs <Pointers.instVarAtPutSymbol>
ENDM
BEGINBYTECODE popStoreInstVar
FetchByte
mov eax, [_SP]
sub _SP, OOPSIZE
StoreInstVarAndDispatch ;; Store down the inst var whose index is in ECX from EAX
ENDBYTECODE popStoreInstVar
BEGINBYTECODE storeInstVar
mov eax, [_SP]
FetchByte
StoreInstVarAndDispatch
ENDBYTECODE storeInstVar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (Pop And) Store Temporary Variable (double byte).
;;
BEGINBYTECODE popStoreTemporary
FetchByte <d>
mov eax, [_SP] ;; Load stack top into register
sub _SP, OOPSIZE ;; Adjust SP for pop
MPrefetch
mov [_BP+edx*OOPSIZE], eax ;; Store Oop from stack top into stack slot
DispatchNext
ENDBYTECODE popStoreTemporary
BEGINBYTECODE storeTemporary
FetchByte <d>
mov eax, [_SP]
MPrefetch
mov [_BP+edx*OOPSIZE], eax ;; Store Oop from stack top into inst var
DispatchNext
ENDBYTECODE storeTemporary
BEGINBYTECODE incrementTemp
movzx edx, BYTE PTR[_IP+1]
mov eax, [_BP+edx*OOPSIZE]
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
add eax, SMALLINTONE - 1 ; Add one (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
IFDEF _DEBUG
mov [_BP+edx*OOPSIZE], eax
add _IP,2 ; Skip over the PopStoreTempN instruction
DispatchByteCode ; Dispatch the next byte code
ELSE
movzx ecx, BYTE PTR[_IP+2]
mov [_BP+edx*OOPSIZE], eax
add _IP, 3
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
overflow:
mov eax, [_BP+edx*OOPSIZE]
@@:
; Not a SmallInteger or overflow, send '+ 1'. Execution will continue on the
; PopStoreTempN instruction that occurs in the middle of this one
mov [_SP+OOPSIZE], eax
mov [_SP+OOPSIZE*2], SMALLINTONE
add _SP, OOPSIZE*2
SendSelectorOneArg <Pointers.plusSelector>
ENDBYTECODE incrementTemp
BEGINBYTECODE incrementTempAndPush
movzx edx, BYTE PTR[_IP+1]
mov eax, [_BP+edx*OOPSIZE]
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
add eax, SMALLINTONE - 1 ; Add one (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
mov [_BP+edx*OOPSIZE], eax
IFDEF _DEBUG
PushOop <a>
add _IP,2 ; Skip over the PopStoreTempN instruction
DispatchByteCode ; Dispatch the next byte code
ELSE
movzx ecx, BYTE PTR[_IP+2]
mov [_SP+OOPSIZE], eax ;; push object onto stack
add _IP, 3
add _SP, OOPSIZE
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
overflow:
mov eax, [_BP+edx*OOPSIZE]
@@:
; Not a SmallInteger or overflow, send '+ 1'. Execution will continue on the
; StoreTempN instruction that occurs in the middle of this one
mov [_SP+OOPSIZE], eax
mov [_SP+OOPSIZE*2], SMALLINTONE
add _SP, OOPSIZE*2
SendSelectorOneArg <Pointers.plusSelector>
ENDBYTECODE incrementTempAndPush
BEGINBYTECODE decrementTemp
movzx edx, BYTE PTR[_IP+1]
mov eax, [_BP+edx*OOPSIZE]
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
sub eax, SMALLINTONE - 1 ; Add one (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
IFDEF _DEBUG
mov [_BP+edx*OOPSIZE], eax
add _IP,2 ; Skip over the PopStoreTempN instruction
DispatchByteCode ; Dispatch the next byte code
ELSE
movzx ecx, BYTE PTR[_IP+2]
mov [_BP+edx*OOPSIZE], eax
add _IP, 3
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
overflow:
mov eax, [_BP+edx*OOPSIZE]
@@:
; Not a SmallInteger or overflow, send '+ 1'. Execution will continue on the
; PopStoreTempN instruction that occurs in the middle of this one
mov [_SP+OOPSIZE], eax
mov [_SP+OOPSIZE*2], SMALLINTONE
add _SP, OOPSIZE*2
SendSelectorOneArg <Pointers.minusSelector>
ENDBYTECODE decrementTemp
BEGINBYTECODE decrementTempAndPush
movzx edx, BYTE PTR[_IP+1]
mov eax, [_BP+edx*OOPSIZE]
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
sub eax, SMALLINTONE - 1 ; Add one (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
mov [_BP+edx*OOPSIZE], eax
IFDEF _DEBUG
PushOop <a>
add _IP,2 ; Skip over the PopStoreTempN instruction
DispatchByteCode ; Dispatch the next byte code
ELSE
movzx ecx, BYTE PTR[_IP+2]
mov [_SP+OOPSIZE], eax ;; push object onto stack
add _IP, 3
add _SP, OOPSIZE
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
overflow:
mov eax, [_BP+edx*OOPSIZE]
@@:
; Not a SmallInteger or overflow, send '+ 1'. Execution will continue on the
; StoreTempN instruction that occurs in the middle of this one
mov [_SP+OOPSIZE], eax
mov [_SP+OOPSIZE*2], SMALLINTONE
add _SP, OOPSIZE*2
SendSelectorOneArg <Pointers.minusSelector>
ENDBYTECODE decrementTempAndPush
BEGINBYTECODE popStoreOuterTemp
OuterTempPreamble
ASSUME edx:PTR Context ; EDX points to the Context containing the temp
ASSUME eax:DWORD ; EAX is pointer to
ASSUME ecx:NOTHING ; ECX is 0
mov ecx, [_SP] ;; Load Oop to store from ToS
lea edx, [edx].m_tempFrame[eax*OOPSIZE]
ASSUME edx:Ptr Oop
sub _SP, OOPSIZE
CountUpOopIn <c>
mov eax, [edx] ;; Load existing value of temporary
inc _IP
mov [edx], ecx ;; And overwrite with new value
; Since count down may destroy register contents, we can't prefetch here
CountDownOopIn <a>
DispatchByteCode
ENDBYTECODE popStoreOuterTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BEGINBYTECODE storeOuterTemp
OuterTempPreamble
ASSUME edx:PTR Context ; EDX points to the Context containing the temp
ASSUME eax:DWORD ; EAX is pointer to
ASSUME ecx:NOTHING ; ECX is 0
mov ecx, [_SP] ;; Load Oop to store from ToS
lea edx, [edx].m_tempFrame[eax*OOPSIZE]
ASSUME edx:Ptr Oop
; Must count up because its going to be stored into a heap object
CountUpOopIn <c>
mov eax, [edx] ;; Load existing value of temporary
inc _IP
mov [edx], ecx ;; And overwrite with new value
; Must count down overwritten context temp - may destroy registers, so can't prefetch
CountDownOopIn <a>
DispatchByteCode
ENDBYTECODE storeOuterTemp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (Pop And) Store Static (Literal) Variable (double byte)
;;
;; Extension is inst var index (0 based).
;; There are no short variants of these instructions
StoreStaticAndDispatch MACRO
mov edx, [pMethod] ; Load Oop of current method
ASSUME edx:PTR CompiledCodeObj
CountUpOopIn <a> ; Storing into a heap object, so must count up
;; Load literal Oop of binding
mov edx, [edx].m_aLiterals[ecx*OOPSIZE]
ASSUME edx:PTR OTE
mov edx, [edx].m_location ; Load pointer to binding
ASSUME edx:PTR VariableBindingObj
mov ecx, [edx].m_value ; Load existing value
mov [edx].m_value, eax ; Store new value
;; Count down original value of static variable - may destroy registers so can't prefetch
CountDownOopIn <c>
DispatchByteCode ;; Dispatch the next byte code
ENDM
BEGINBYTECODE popStoreStatic
mov eax, [_SP] ;; Load stack top into register
FetchByte
sub _SP, OOPSIZE
StoreStaticAndDispatch
ENDBYTECODE popStoreStatic
BEGINBYTECODE storeStatic
mov eax, [_SP]
FetchByte
StoreStaticAndDispatch
ENDBYTECODE storeStatic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Signed Word Instruction (triple byte).
;;
;; Extension (-32768..32767) is value to be pushed as SmallInteger
BEGINBYTECODE longPushImmediate
movsx eax, WORD PTR[_IP] ; Sign extend next two bytes into EDX
xor ecx, ecx ; Clear ECX (avoid partial register stall on PPro and later PIIs it would appear)
add _SP, OOPSIZE
mov cl, [_IP+2]
lea eax, [eax+eax+1] ; Convert to SmallInteger
add _IP, 3 ; Advance instruction pointer (over next instruction)
mov [_SP], eax ; push SmallInteger onto stack
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
push ecx
mov ecx, _IP
mov edx, _SP
dec ecx
call DEBUGEXECTRACE
pop ecx
.ENDIF
inc [_byteCodeCounters+ecx*4]
ENDIF
IFDEF PROFILING
inc [?byteCodeCount@@3IA]
ENDIF
jmp byteCodeTable[ecx*4] ; Transfer control via jump table
ENDBYTECODE longPushImmediate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push a 31-bit integer (five bytes).
;;
BEGINBYTECODE exLongPushImmediate
mov eax, DWORD PTR[_IP] ; Load the int32 value in the next 4 bytes of the instruction stream
xor ecx, ecx ; Clear ECX (avoid partial register stall on PPro and later PIIs it would appear)
add _SP, OOPSIZE
mov cl, [_IP+4]
lea eax, [eax+eax+1] ; Convert to SmallInteger
add _IP, 5 ; Advance instruction pointer (over next instruction)
mov [_SP], eax ; push SmallInteger onto stack
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
push ecx
mov ecx, _IP
mov edx, _SP
dec ecx
call DEBUGEXECTRACE
pop ecx
.ENDIF
inc [_byteCodeCounters+ecx*4]
ENDIF
IFDEF PROFILING
inc [?byteCodeCount@@3IA]
ENDIF
jmp byteCodeTable[ecx*4] ; Transfer control via jump table
ENDBYTECODE exLongPushImmediate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Character Instruction (double byte).
;; Extension is character code (0..255)
BEGINBYTECODE pushChar
mov edx, [OBJECTTABLE]
movzx eax, BYTE PTR[_IP] ; Load code point byte into EAX
movzx ecx, [_IP+1]
add _SP, OOPSIZE
;; TODO: Need faster way to do this for 16 byte entry
; lea eax, [edx+FIRSTCHAROFFSET+eax*OTENTRYSIZE]
shl eax, 4
add edx, FIRSTCHAROFFSET
add eax, edx
add _IP, 2
mov [_SP], eax ; push Character onto stack
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
push ecx
mov ecx, _IP
mov edx, _SP
dec ecx
call DEBUGEXECTRACE
pop ecx
.ENDIF
inc [_byteCodeCounters+ecx*4]
ENDIF
IFDEF PROFILING
inc [?byteCodeCount@@3IA]
ENDIF
jmp byteCodeTable[ecx*4] ; Transfer control via jump table
ENDBYTECODE pushChar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short forward jumps to fixed relative offsets
;; N.B. The minimum jump is +2. A +1 jump (offset 0) would be a NOP, which would waste a valuable
;; short instruction. Note that this adjustment is not applied to longer jumps, where
;; offset 0 if always considered to be a NOP jump.
ShortJumpN MACRO index
BEGINBYTECODENOALIGN shortJump&index
;ALIGN 4
;BEGINBYTECODE shortJump&index
IFDEF _DEBUG
add _IP, index+1 ;; N.B. Extra 1 added to extend range of short jumps
;; i.e. minimum jump is +2 (from start of jump instruction)
DispatchByteCode
ELSE
movzx ecx, [_IP+index+1]
add _IP, index+1+1
jmp byteCodeTable[ecx*4]
ENDIF
ENDBYTECODE shortJump&index
ENDM
ALIGN 16
; So short that we might as well inline it
index = 0
REPEAT NUMSHORTJUMPS
ShortJumpN %index
index = index + 1
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Short jump on false, generate inline instructions from macro again
BEGINBYTECODE shortJumpIfFalse
IFDEF _DEBUG
;; N.B. Extra 1 added to extend range of short jumps
sub ecx, FIRSTSHORTJUMPIFFALSE-1
mov eax, [_SP]
sub _SP, OOPSIZE
sub eax, [oteFalse]
jnz @F
add _IP, ecx
DispatchByteCode
@@:
; Branch not taken, dispatch next if ToS was boolean true
cmp eax, -OTENTRYSIZE ;; true is immediately before false in OT
jne @F
DispatchByteCode
@@:
;; Error - receiver not a boolean, we don't care about performance of this arm
dec _IP ;; We'll retry the conditional test if #mustBeBoolean returns
add _SP, OOPSIZE ; Unpop
SendSelectorNoArgs <Pointers.MustBeBooleanSelector>
ELSE
lea edx, [ecx-FIRSTSHORTJUMPIFFALSE+2]
ASSUME edx:DWORD
mov eax, [_SP]
sub _SP, OOPSIZE
sub eax, [oteFalse] ;; Is it false?
jnz @F
; Branch taken (it was false)
movzx ecx, [_IP+edx-1]
ASSUME ecx:DWORD
add _IP, edx
jmp byteCodeTable[ecx*4]
@@:
; Branch not taken (it was not false)
;; Might need xor ecx, ecx here, apparently zeroing forgotten after branch misprediction
movzx ecx, [_IP] ;; Load next instruction in prep.
cmp eax, -OTENTRYSIZE ;; true is immediately before false in OT
jne @F ;; But not true either, so error case
inc _IP ;; OK, let's process next instruction
jmp byteCodeTable[ecx*4] ;; Off to the next instruction
@@:
;; Error - receiver not a boolean, we don't care about performance of this arm
dec _IP ;; We'll retry the conditional test if #mustBeBoolean returns
add _SP, OOPSIZE ; Unpop ;; Undo stack damage
SendSelectorNoArgs <Pointers.MustBeBooleanSelector> ;; And inform the image of the error
ENDIF
ENDBYTECODE shortJumpIfFalse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ASSUME eax:NOTHING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unconditional Jumps
;; Note that by performing the decrement of the input poll counter as a series of
;; instructions to load/dec/save rather than dec [mem] we can hide it in the execution
;; of the real work and reduce the number of cycles for a nearJump to 11.
BEGINBYTECODE nearJump
ASSUME _IP:PTR BYTE
movsx eax, [_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+1] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz asyncPending
DispatchByteCode
ELSE
; Optimized pentium form
movzx ecx, [_IP+eax+1]
test edx, edx
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
jnz @F ; If async events pending, go and poll input
jmp byteCodeTable[ecx*4]
@@:
dec _IP
ENDIF
asyncPending:
CallCPPAndLoop <BYTEPOLL>
ENDBYTECODE nearJump
; Long jump is fairly rarely used. A noteable exception is in the long inlined sort algorithm implementations
BEGINBYTECODE longJump
ASSUME _IP:PTR BYTE
movsx eax, WORD PTR[_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz asyncPending
DispatchByteCode
ELSE
; Optimized pentium form
movzx ecx, [_IP+eax+2]
test edx, edx
lea _IP, [_IP+eax+3] ; Offset 0 is the next instruction (after double byte instruction extension)
jnz @F ; If async events pending, go and poll input
jmp byteCodeTable[ecx*4]
@@:
dec _IP
ENDIF
asyncPending:
CallCPPAndLoop <BYTEPOLL>
ENDBYTECODE longJump
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Conditional Jumps
; A typical use of this byte code is to skip back a loop body when the condition evaluates to false.
; Therefore it makes most sense to optimize the false branch
BEGINBYTECODE nearJumpIfTrue
mov edx, [_SP]
sub _SP, OOPSIZE
sub edx, [oteTrue]
jnz elseBranch ; Skip to false/error handling (N.B. forward jump)
; The TOS was true, so the jump is to be followed.
movsx eax, BYTE PTR[_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+1] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz asyncPending
DispatchByteCode
ELSE
movzx ecx, BYTE PTR[_IP+eax+1]
test edx, edx
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
jnz @F
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
@@:
dec _IP
ENDIF
asyncPending:
CallCPPAndLoop <BYTEPOLL>
elseBranch:
; The TOS was not false, so the jump is not to be followed. We must check if TOS is a boolean.
cmp edx, OTENTRYSIZE ; false follows true in OT
jne @F
IFDEF _DEBUG
inc _IP ; Byte for the jump length
DispatchByteCode
ELSE
; Optimized pentium form
movzx ecx, [_IP+1] ; Load instruction after extension byte
add _IP, 2 ; _IP points to instruction after that
jmp byteCodeTable[ecx*4]
ENDIF
@@: ;; This is the error case - speed not that important
dec _IP ; Retry the conditional test if #must be boolean returns
add _SP, OOPSIZE ; Unpop
SendSelectorNoArgs <Pointers.MustBeBooleanSelector>
ENDBYTECODE nearJumpIfTrue
BEGINBYTECODE nearJumpIfNil
mov eax, [_SP]
sub _SP, OOPSIZE
cmp eax, [oteNil]
jnz elseBranch
movsx eax, BYTE PTR[_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+1] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz @F
DispatchByteCode
@@:
CallCPPAndLoop <BYTEPOLL>
ELSE
movzx ecx, BYTE PTR[_IP+eax+1]
test edx, edx
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
jnz @F
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
@@:
dec _IP
CallCPPAndLoop <BYTEPOLL>
ENDIF
elseBranch:
IFDEF _DEBUG
inc _IP ; Byte for the jump length
DispatchByteCode
ELSE
; Optimized pentium form
movzx ecx, [_IP+1] ; Load instruction after extension byte
add _IP, 2 ; _IP points to instruction after that
jmp byteCodeTable[ecx*4]
ENDIF
ENDBYTECODE nearJumpIfNil
BEGINBYTECODE nearJumpIfNotNil
mov eax, [_SP]
sub _SP, OOPSIZE
cmp eax, [oteNil]
jz elseBranch ; If nil then dispatch next instruction
movsx eax, BYTE PTR[_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+1] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz @F
DispatchByteCode
@@:
CallCPPAndLoop <BYTEPOLL>
ELSE
movzx ecx, BYTE PTR[_IP+eax+1]
test edx, edx
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
jnz @F
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
@@:
dec _IP
CallCPPAndLoop <BYTEPOLL>
ENDIF
elseBranch:
; Its nil, dispatch next
IFDEF _DEBUG
inc _IP ; Byte for the jump length
DispatchByteCode
ELSE
movzx ecx, [_IP+1] ; Load instruction after extension byte
add _IP, 2 ; _IP points to instruction after that
jmp byteCodeTable[ecx*4]
ENDIF
ENDBYTECODE nearJumpIfNotNil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Decrement Stack Top Instruction (single byte)
;;
;; This is an optimisation which is equivalent to the sequence Push 1, Send #-
ALIGN 16
BEGINBYTECODE decrementStackTop
mov eax, [_SP] ; Load receiver at stack top
movzx ecx, [_IP]
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
sub eax, SMALLINTONE - 1 ; Subtract 1 (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
mov [_SP], eax ; Save back as it didn't overflow
IFDEF _DEBUG
DispatchByteCode ; Dispatch the next byte code
ELSE
inc _IP
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
@@:
; Not a SmallInteger, send '- 1'.
mov [_SP+OOPSIZE], SMALLINTONE
add _SP, OOPSIZE
SendSelectorOneArgToObjectEAX <Pointers.minusSelector>
overflow:
cmc ; Get carry flag in correct direction for subroutine
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED ; Return to caller with Oop of new Signed Integer in eax
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
ENDBYTECODE decrementStackTop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Send Byte Codes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Send Special Selector Byte Codes
; These byte codes attempt a primitive response for certain critical
; operations (e.g. adding two numbers). Should the primitive response
; fail, then they fall back on the usual method lookup
; I have replicated the code for many of these byte codes in order
; to avoid a two level dispatch through a second jump table.
; Send a special selector, invoked direct from byte code interpreter
; There are three possible execution paths:
; 1) The special selector can be directly invoked (all
; arithmetic primitives and a few of the common selector
; primitives), and the primitive succeeds. In this case
; we continue execution with the next bytecode. This makes
; for very efficient execution of certain operations such
; as SmallInteger arithmetic.
; 2) The special selector can be directly invoked, but the
; primitive routine (or its entry thunk) fails, the fallback
; being to send the selector to the receiver. This most
; commonly occurs because the receiver is not the class
; expected by the optimised case - e.g. #value is sent to
; an object which is not a BlockClosure.
; 3) The special selector requires message lookup (i.e. it is
; not optimised). This applies to all the common selector
; primitives excluding #==, #value and #value:.
; In this case we just send the selector to the receiver through
; the normal message lookup.
;
; Note that a special selector primitive must fail twice before
; the actual method is invoked - unless I can do something
; about that.
;
; Arithmetic operations are very, very, common instruction, and
; consequently the primitive code is inlined. Even so note the
; amount of testing which is necessary because these instructions
; are generated for all arithmetic selectors, regardless of type
; (even though in some cases the compiler does know whether the receiver or
; argument is a SmallInteger). Anyway the minimum cycle time
; for a SmallInteger addition is 13 machine cycles plus byte
; code dispatching time (8 cycles). Other SmallInteger arithmetic
; and relational operations have cycle times of similar magnitudes
;
BEGINBYTECODE sendArithmeticAdd
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov edx, [_SP] ; Load argument at top of stack (v)
test al, 1 ; Receiver is a SmallInteger? (u)
jz sendMessageToObject ; No, skip primitive response (v)
test dl, 1 ; Argument is a SmallInteger? (u)
jz sendMessageToInteger ; No, skip primitive response (v)
sub _SP, OOPSIZE ; Pop argument
xor eax, 1 ; Clear bottom bit of receiver (arithmetic can then be done without shifting)
add eax, edx ; Perform the actual addition
jo overflow ; Overflowed 31-bits?
MPrefetch
mov [_SP], eax ; Save back as it didn't overflow
DispatchNext
overflow:
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED ; Return to caller with Oop of new Signed Integer in eax
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
sendMessageToObject:
; Try sending the '+' selector through normal message lookup
SendSelectorOneArgToObjectEAX<Pointers.plusSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.plusSelector>
ENDBYTECODE sendArithmeticAdd
BEGINBYTECODE sendArithmeticSubtract
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov edx, [_SP] ; Load argument at top of stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test dl, 1 ; Argument is SmallInteger
jz sendMessageToInteger ; No, skip primitive response
sub _SP, OOPSIZE ; Pop argument (which is not ref. counted)
xor edx, 1 ; Remove arg's SmallInteger bit
sub eax, edx ; Perform actual subtraction
jo pushLargeFromSmallNegAndCarryEAX ; Overflowed 31-bits?
MPrefetch
mov [_SP], eax
DispatchNext
pushLargeFromSmallNegAndCarryEAX:
cmc ; Get carry flag in correct direction for subroutine
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
sendMessageToObject:
; Try sending the '-' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.minusSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.minusSelector>
ENDBYTECODE sendArithmeticSubtract
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Increment Stack Top Instruction (single byte)
;;
;; This is an optimisation which is equivalent to the sequence Push 1, Send #+
BEGINBYTECODE incrementStackTop
;; N.B. This is highly optimized for the Pentium processor, hence use of EAX as quicker to test accumulator
;; against immediate, and strange instruction ordering
mov eax, [_SP] ; Load receiver at stack top
movzx ecx, [_IP] ; Load next instruction for most common smallinteger inc. case
test al, 1 ; Is it a SmallInteger?
jz @F ; No, skip primitive response
add eax, SMALLINTONE - 1 ; Add one (without SmallInteger bit)
jo overflow ; It overflowed 31-bits?
mov [_SP], eax ; Save back as it didn't overflow
IFDEF _DEBUG
DispatchByteCode ; Dispatch the next byte code
ELSE
inc _IP
jmp byteCodeTable[ecx*4]
ENDIF
; Doesn't get to here
@@:
; Not a SmallInteger, send '+ 1'.
mov [_SP+OOPSIZE], SMALLINTONE
add _SP, OOPSIZE
SendSelectorOneArgToObjectEAX <Pointers.plusSelector>
overflow:
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED ; Return to caller with Oop of new Signed Integer in eax
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
ENDBYTECODE incrementStackTop
BEGINBYTECODE sendArithmeticLessThan
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov ecx, [_SP] ; Load argument from stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteFalse] ; Default - not less than arg
sub _SP, OOPSIZE ; Pop argument
cmp eax, ecx ; receiver < arg?
cmovl edx, [oteTrue]
MPrefetch
mov [_SP], edx
DispatchNext
sendMessageToObject:
; Try sending the '<' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.lessThanSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.lessThanSelector>
ENDBYTECODE sendArithmeticLessThan
; A typical use of this byte code is to skip back a loop body when the condition evaluates to false.
; Therefore it makes most sense to optimize the false branch
BEGINBYTECODE nearJumpIfFalse
mov edx, [_SP]
sub _SP, OOPSIZE
sub edx, [oteFalse]
jnz elseBranch ; Skip to true case/error handling (N.B. forward jump)
; The TOS was false, so the jump is to be followed.
movsx eax, BYTE PTR[_IP] ; Sign extend instruction argument byte (offset) into EAX
mov edx, [ASYNCPENDING]
IFDEF _DEBUG
lea _IP, [_IP+eax+1] ; Offset 0 is the next instruction (after single byte instruction extension)
test edx, edx
jnz asyncPending
DispatchByteCode
ELSE
movzx ecx, BYTE PTR[_IP+eax+1]
test edx, edx
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after single byte instruction extension)
jnz @F
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
@@:
dec _IP
ENDIF
asyncPending:
CallCPPAndLoop <BYTEPOLL>
elseBranch:
; The TOS was not false, so the jump is not to be followed. We must check if TOS is a boolean.
cmp edx, -OTENTRYSIZE ; false follows true in OT
jne @F
IFDEF _DEBUG
inc _IP ; Byte for the jump length
DispatchByteCode
ELSE
; Optimized pentium form
movzx ecx, [_IP+1] ; Load instruction after extension byte
add _IP, 2 ; _IP points to instruction after that
jmp byteCodeTable[ecx*4]
ENDIF
@@: ;; This is the error case - speed not that important
dec _IP ; Retry the conditional test if #must be boolean returns
add _SP, OOPSIZE ; Unpop
SendSelectorNoArgs <Pointers.MustBeBooleanSelector>
ENDBYTECODE nearJumpIfFalse
; Inlines primitive coding for SmallInteger
BEGINBYTECODE sendArithmeticLessOrEqual
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov ecx, [_SP] ; Load argument from stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteFalse] ; Default, true
sub _SP, OOPSIZE ; Pop argument
cmp eax, ecx ; receiver <= arg?
cmovle edx, [oteTrue] ;
MPrefetch
mov [_SP], edx
DispatchNext
sendMessageToObject:
; Try sending the '<=' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.lessOrEqualSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.lessOrEqualSelector>
ENDBYTECODE sendArithmeticLessOrEqual
BEGINBYTECODE sendArithmeticGreaterThan
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov ecx, [_SP] ; Load argument from stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteFalse] ; Default, true
sub _SP, OOPSIZE ; Pop argument
cmp eax, ecx ; receiver > arg?
cmovg edx, [oteTrue] ;
MPrefetch
mov [_SP], edx
DispatchNext
sendMessageToObject:
; Try sending the '>' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.greaterThanSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.greaterThanSelector>
ENDBYTECODE sendArithmeticGreaterThan
; Inlines primitive coding for SmallInteger
BEGINBYTECODE sendArithmeticGreaterOrEqual
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov ecx, [_SP] ; Load argument from stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteFalse] ; Default, true
sub _SP, OOPSIZE ; Pop argument
cmp eax, ecx ; receiver >= arg?
cmovge edx, [oteTrue] ;
MPrefetch
mov [_SP], edx
DispatchNext
sendMessageToObject:
; Try sending the '>=' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.greaterOrEqualSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.greaterOrEqualSelector>
ENDBYTECODE sendArithmeticGreaterOrEqual
BEGINBYTECODE sendArithmeticEqual
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
test al, 1 ; Is receiver a SmallInteger?
jnz @F
; Send the #= selector through normal message lookup to non-SmallInteger receiver
; It would be optimise away this send for all identical objects, but we can't
; because some identical objects are not equal. A particular example is Float.NaN.
; NaNs are not supposed to ever be equal to anything, even another NaN
SendSelectorOneArgToObjectEAX <Pointers.equalSelector>
@@:
mov ecx, [_SP] ; Load argument from stack
mov edx, [oteTrue]
cmp eax, ecx
je @F
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteFalse] ; Non-equal SmallIntegers
@@:
mov [_SP-OOPSIZE], edx
MPrefetch
sub _SP, OOPSIZE ; Pop argument
DispatchNext
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.equalSelector>
ENDBYTECODE sendArithmeticEqual
BEGINBYTECODE sendArithmeticNotEqual
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
test al, 1 ; Is receiver a SmallInteger?
jnz @F
; Send the #~= selector through normal message lookup to non-SmallInteger receiver
SendSelectorOneArgToObjectEAX <Pointers.notEqualSelector>
@@:
mov ecx, [_SP] ; Load argument from stack
mov edx, [oteFalse]
cmp eax, ecx
je @F
test cl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
mov edx, [oteTrue] ; Non-equal SmallIntegers
@@:
mov [_SP-OOPSIZE], edx
MPrefetch
sub _SP, OOPSIZE ; Pop argument
DispatchNext
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.notEqualSelector>
ENDBYTECODE sendArithmeticNotEqual
BEGINBYTECODE sendArithmeticMultiply
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov edx, [_SP] ; Load argument from stack
test al, 1 ; Is it a SmallInteger?
jz sendMessageToObject ; Receiver not SmallInteger, skip primitive response
sar edx, 1 ; Extract integer value of arg
jnc sendMessageToInteger ; Arg not a SmallInteger
xor eax, 1 ; Remove SmallInteger flag
imul edx
jo sendMessageToInteger ; If overflowed SmallInteger bits then skip primitive response
xor ecx, ecx
or eax, 1 ; Replace SmallInteger flag bit
mov cl, [_IP]
mov [_SP-OOPSIZE], eax ; Replace receiver with answer
sub _SP, OOPSIZE
IFDEF _DEBUG
DispatchByteCode
ELSE
inc _IP
jmp byteCodeTable[ecx*4]
ENDIF
sendMessageToObject:
; Try sending the '*' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.multiplySelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.multiplySelector>
ENDBYTECODE sendArithmeticMultiply
;; N.B. Some difference here - we shift receiver, not just test bottom bit
BEGINBYTECODE sendArithmeticDivide
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument (v - pairs)
mov ecx, [_SP] ; Load argument from stack (u)
sar eax, 1 ; Is it a SmallInteger? (u)
jnc sendMessageToObject ; No, skip primitive response (v - pairs)
sar ecx, 1 ; Extract integer value of arg (u)
jnc sendMessageToInteger ; Arg not a SmallInteger (v - pairs)
mov edx, eax ; Sign extend ... (u)
; It is more time consuming to set up corectly for the exception handler (we must
; set the divide selector so that the primitive gets invoked), so rather than
; rely on that, we explicitly test and fall back on the primitive, which does use
; the handler
jz sendMessageToInteger ; Catch division by zero (v - pairs)
sar edx, 31 ; ... into edx (instead of CDQ)
idiv ecx
test edx, edx ; Test remainder in edx (u)
jnz sendMessageToInteger ; Inexact, fail primitive (v - pairs)
sub _SP, OOPSIZE ; Pop argument (which is not ref. counted) (u)
; Note that an overflow could occur if min. SmallInteger divided by -1
add eax, eax ; Shift for SmallInteger
jo overflow
or eax, 1 ; Add SmallInteger bit
MPrefetch
mov [_SP], eax ; Replace stack top integer
DispatchNext
sendMessageToObject:
; Try sending the '/' selector through normal message lookup
add eax, eax ; Reverse the right shift
SendSelectorOneArgToObjectEAX <Pointers.divideSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.divideSelector>
overflow:
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
ENDBYTECODE sendArithmeticDivide
;; N.B. Some difference here - we shift receiver, not just test bottom bit
BEGINBYTECODE sendArithmeticMod
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument (v - pairs)
mov ecx, [_SP] ; Load argument from stack (u)
sar eax, 1 ; Is it a SmallInteger? (u)
jnc sendMessageToObject ; No, skip primitive response (v - pairs)
sar ecx, 1 ; Extract integer value of arg (u)
jnc sendMessageToInteger ; Arg not a SmallInteger (v - pairs)
mov edx, eax ; Sign extend... (u)
; It is more time consuming to set up corectly for the exception handler (we must
; set the divide selector so that the primitive gets invoked), so rather than
; rely on that, we explicitly test and fall back on the primitive, which does use
; the handler
jz sendMessageToInteger ; Catch division by zero (v - pairs)
sar edx, 31 ; ... into edx (faster than CDQ) (u)
sub _SP, OOPSIZE ; Pop argument (which is not ref. counted) (v - pairs)
idiv ecx
test eax,eax ; test Quotient (u)
jg @F ; If positive, skip adjust (v - pairs)
test edx,edx ; test remainder (u)
jz @F ; if exact skip adjust (v - pairs)
xor ecx,edx ; test sign of numerator and denominator (u)
jns @F ; non-negative, skip adjust (v - pairs)
xor ecx,edx ; reverse previous XOR (no pair, write, read)
add edx,ecx ; adjust remainder by numerator
@@:
lea eax, [edx+edx+1]
;; N.B. Pop happens above
MPrefetch
mov [_SP], eax ; Replace stack top integer with remainder
DispatchNext
sendMessageToObject:
; Try sending the '\\' selector through normal message lookup
add eax, eax ; Reverse the right shift
SendSelectorOneArgToObjectEAX <Pointers.modSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.modSelector>
ENDBYTECODE sendArithmeticMod
;; N.B. Some difference here - we shift receiver, not just test bottom bit
BEGINBYTECODE sendArithmeticDiv
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument (u)
mov ecx, [_SP] ; Load argument from stack (v)
sar eax, 1 ; Is it a SmallInteger? (u)
jnc sendMessageToObject ; No, skip primitive response (v)
sar ecx, 1 ; Extract integer value of arg (u - not pairable in v-pipe)
jnc sendMessageToInteger ; Arg not a SmallInteger (v - pairs)
mov edx, eax ; Sign extend ... (u)
; It is more time consuming to set up corectly for the exception handler (we must
; set the divide selector so that the primitive gets invoked), so rather than
; rely on that, we explicitly test and fall back on the primitive, which does use
; the handler
jz sendMessageToInteger ; Catch division by zero (v - pairs)
sar edx, 31 ; ... into edx (u)
idiv ecx ; Sadly IDIV does not change the flag in a predictable way (u)
sub _SP, OOPSIZE ; Pop argument (which is not ref. counted) (u)
test eax, eax ; Quotient?
jg @F ; greater than zero
test edx, edx ; Remainder?
jz @F ; zero
xor ecx,edx ; numerator/remainder signed
jns @F ; no, skip
dec eax ; adjust negative
@@:
add eax, eax
jo overflow ; Overflow possible if divide by -1
or eax, 1 ; Add SmallInteger bit
mov [_SP], eax ; (u) Replace stack top integer
DispatchByteCode
sendMessageToObject:
; Try sending the '//' selector through normal message lookup
add eax, eax ; Reverse the right shift
SendSelectorOneArgToObjectEAX <Pointers.divSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.divSelector>
overflow:
mov ecx, eax
rcr ecx, 1 ; Revert to non-shifted value
call LINEWSIGNED ; Return to caller with Oop of new Signed Integer in eax
mov [_SP], eax ; Replace ToS with new object
AddToZct <a>
DispatchByteCode
ENDBYTECODE sendArithmeticDiv
;; BitShift is a bit too complicated to expand in-line at present, due to the rather crap overflow
;; detection - this seems to make it no faster than multiplication, which is crap of course.
BEGINBYTECODE sendArithmeticBitShift
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
test al, 1 ; Receiver is a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
mov ecx, [_SP] ; Load argument from stack
mov edx, eax ; Sign extend into edx from eax part 1
sar ecx, 1 ; Access integer value
jnc sendMessage ; Not a SmallInteger, send it #bitShift:
js rightShift ; If negative, perform right shift (simpler)
; Perform a left shift (more tricky sadly because of overflow detection)
sub eax, 1 ; Remove SmallInteger sign bit
jz storeDispatchNext ; If receiver is zero, then result always zero
cmp ecx, 30 ; We can't shift more than 30 places this way, since receiver not zero
jg sendMessage
; To avoid using a loop, we use the double precision shift first
; to detect potential overflow.
; This overflow check works, but is slow (about 12 cycles)
; since the majority of shifts are <= 16, perhaps should loop?
push _BP ; We must preserve _BP
sar edx, 31 ; Sign extend part 2
inc ecx ; Need to check space for sign too
mov _BP, edx ; Save sign in _BP too
shld edx, eax, cl ; May overflow into edx
dec ecx
xor edx, _BP ; Overflowed?
pop _BP
jnz sendMessage ; Yes, LargeInteger needed
sal eax, cl ; No, perform the real shift
jmp storeDispatchNext
rightShift:
mov edx, 31
neg ecx ; Get shift as absolute value
cmp ecx, edx ; Clamp to 31 (we'll lose all bits anyway for any left shift of 31 or greater)
cmovg ecx, edx
sar eax, cl ; Perform the shift
storeDispatchNext:
or eax, 1 ; Replace SmallInteger flag
mov [_SP-OOPSIZE], eax ; Replace stack top integer
sub _SP, OOPSIZE
MPrefetch
DispatchNext
sendMessage:
SendSelectorOneArgToInteger <Pointers.bitShiftSelector>
sendMessageToObject:
; Try sending the 'bitShift:' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.bitShiftSelector>
ENDBYTECODE sendArithmeticBitShift
; bitAnd: is a very fast instruction!
BEGINBYTECODE sendArithmeticBitAnd
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov edx, [_SP]
and eax, edx ; Perform the bitwise op with arg
test al, 1 ; Result a SmallInteger
jz sendMessage ; No, receiver or Arg not a SmallInt
mov [_SP-OOPSIZE], eax ; Replace stack top integer with result
PopDispatchByteCode
sendMessage:
; Try sending the 'bitAnd:' selector through normal message lookup
SendSelectorOneArg <Pointers.bitAndSelector>
ENDBYTECODE sendArithmeticBitAnd
BEGINBYTECODE sendArithmeticBitOr
mov eax, [_SP-OOPSIZE] ; Access receiver beneath argument
mov edx, [_SP] ; Load argument from stack
test al, 1 ; Receiver is a SmallInteger?
jz sendMessageToObject ; No, skip primitive response
test dl, 1 ; Arg is a SmallInteger?
jz sendMessageToInteger ; No, skip primitive response
; There is no need to shift or clear the SmallInteger flag
or eax, edx ; Perform the actual bitwise op
mov [_SP-OOPSIZE], eax ; Replace stack top integer with boolean result
PopDispatchByteCode
sendMessageToObject:
; Try sending the 'bitOr:' selector through normal message lookup
SendSelectorOneArgToObjectEAX <Pointers.bitOrSelector>
sendMessageToInteger:
SendSelectorOneArgToInteger <Pointers.bitOrSelector>
ENDBYTECODE sendArithmeticBitOr
;
; object == object?
; N.B. Identity comparisons do not fail, so cannot be overridden. The actual primitive (not used
; here) may be invoked for other selectors so we still need it. #== is never
; really sent to objects, but is implemented here directly (it CANNOT be overridden)
; as the VM never sends this selector directly (only if #perform'd).
;
BEGINBYTECODE shortSpecialSendIdentical
mov eax, [_SP-OOPSIZE] ; Load receiver into eax
mov ecx, [_SP] ; Get argument at stack top into ecx
sub _SP, OOPSIZE ; POP
mov edx, [oteFalse] ; Load false (default answer)
cmp eax, ecx ; receiver == arg?
cmove edx, [oteTrue]
MPrefetch
mov [_SP], edx ; Overwrite stack top with true/false
DispatchNext ; Dispatch the next byte code
ENDBYTECODE shortSpecialSendIdentical
;
; object ~~ object?
;
BEGINBYTECODE shortSpecialSendNotIdentical
mov eax, [_SP-OOPSIZE] ; Load receiver into eax
mov ecx, [_SP] ; Get argument at stack top into ecx
sub _SP, OOPSIZE ; POP
mov edx, [oteFalse] ; Load false (default answer)
cmp eax, ecx ; receiver ~~ arg?
cmovne edx, [oteTrue]
MPrefetch
mov [_SP], edx ; Overwrite stack top with true/false
DispatchNext ; Dispatch the next byte code
ENDBYTECODE shortSpecialSendNotIdentical
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The following special selectors can have their selectors changed, or they
;; can be removed. They are open coded for performance reasons (otherwise not much
;; point having them at all).
; This implementation means we CAN override #class (not Smalltalk-80, but supported by modern Smalltalks)
BEGINBYTECODE shortSpecialSend0
SendSelectorNoArgs <Pointers.specialSelectors[0*OOPSIZE]> ; class
ENDBYTECODE shortSpecialSend0
BEGINBYTECODE shortSpecialSend1
SendSelectorNoArgs <Pointers.specialSelectors[1*OOPSIZE]> ; size
ENDBYTECODE shortSpecialSend1
BEGINBYTECODE shortSpecialSend2
SendSelectorNoArgs <Pointers.specialSelectors[2*OOPSIZE]> ; new
ENDBYTECODE shortSpecialSend2
BEGINBYTECODE shortSpecialSend3
SendSelectorOneArg <Pointers.specialSelectors[3*OOPSIZE]> ; new:
ENDBYTECODE shortSpecialSend3
BEGINBYTECODE shortSpecialSendBasicNew
SendSelectorOneArg <Pointers.basicNewSelector> ; basicNew:
ENDBYTECODE shortSpecialSendBasicNew
BEGINBYTECODE shortSpecialSendBasicSize
mov eax, [_SP] ; Load receiver into eax
test al, 1 ; Is it a SmallInteger?
jz notSmallInteger
MPrefetch
mov [_SP], SMALLINTZERO ; Size of SmallInteger is zero
DispatchNext
notSmallInteger:
ASSUME eax:PTR OTE ; eax points at receiver OTE
mov ecx, eax
ASSUME ecx:PTR OTE
;; Get the byte length of the object (into eax)
mov edx, [eax].m_location ; Load object address into edx
ASSUME edx:PTR Object ; edx points at receiver object
mov eax, [eax].m_size
ASSUME eax:NOTHING
mov edx, [ecx].m_oteClass ; Get class Oop from Object into edx
ASSUME edx:PTR OTE ; edx now points at class OTE
and eax, 7fffffffh ; Mask out sign bit of size (used to mark const objects)
test [ecx].m_flags, MASK m_pointer ; ote->isPointers?
mov edx, [edx].m_location ; Load address of class object into edx
ASSUME edx:PTR Behavior ; edx now points at class object
jz isBytes ; Byte objects cannot have inst vars, so can skip next bit
;; Calculate the length of the indexed part of a pointer object
mov edx, [edx].m_instanceSpec ; Load InstanceSpecification into edx
ASSUME edx:NOTHING
and edx, MASK m_fixedFields ; Mask out everything but inst. var. count
add edx, edx ; Convert to byte size (already *2 since SmallInteger)
sub eax, edx ; Calculate length of variable part in bytes
shr eax, 1 ; Divide byte size by 2 to get MWORD size as SmallInteger
or eax, 1 ; Add SmallInteger flag
MPrefetch
mov [_SP], eax ; Replace stack top with indexed pointer size
DispatchNext
isBytes:
ASSUME ecx:PTR OTE ; ecx is the receiver OTE
ASSUME edx:PTR Behavior ; edx points to the receiver's class object
ASSUME eax:DWORD ; eax is the size in bytes
test [ecx].m_flags, MASK m_weakOrZ ; Is a string?
jz @F
; Its a string, temporarily use the encoding to determine the element size (in future revised InstanceSpec should be used)
movzx edx, [edx].m_instanceSpec.m_extraSpec
dec edx
sub edx,1
je words
sub edx,1
jne @F
shr eax, 2
@@:
add eax, eax
words:
or eax, 1
MPrefetch
mov [_SP], eax ; Replace stack top with byte size
DispatchNext
ENDBYTECODE shortSpecialSendBasicSize
BEGINBYTECODE shortSpecialSendBasicAt
mov eax, [_SP-OOPSIZE] ; Access receiver under argument
mov edx, [_SP] ; Load argument from stack
test al, 1
jnz sendMessageToSmallInteger ; Its a SmallInteger, probably an error, try sending it #basicAt:
ASSUME eax:PTR OTE ; eax is receiver OTE
mov ecx, [eax].m_oteClass ; Get class Oop from OTE into eax for later use
ASSUME ecx:PTR OTE
sar edx, 1 ; Argument is a SmallInteger?
jnc sendMessageToClass ; Arg not a SmallInteger, send the message
jle sendMessageToClass ; Index out of bounds (<= 0)
test [eax].m_flags, MASK m_pointer ; Test pointer bit of object table entry
jz byteObjectAt ; Contains bytes? Yes, skip to byte access code
pointerAt:
ASSUME eax:PTR OTE ; EAX is receiver Oop
ASSUME ecx:PTR OTE ; ECX is class Oop
ASSUME edx:DWORD ; EDX is offset
push ebx
; Array of pointers?
mov ebx, [eax].m_size ; Load size into eax
ASSUME ebx:DWORD
mov ecx, [ecx].m_location ; Load address of class object into eax from OTE at ecx
ASSUME ecx:PTR Behavior
and ebx, 7fffffffh ; Ignore the sign bit of the size (used to mark const objects)
shr ebx, 2 ; ecx = total Oop size (bytesize div 4)
mov ecx, [ecx].m_instanceSpec ; Load Instancespecification into edx
ASSUME ecx:DWORD
and ecx, MASK m_fixedFields ; Mask off flags
shr ecx, 1 ; Convert from SmallInteger
add edx, ecx ; Add fixed offset for inst vars
cmp edx, ebx ; Index <= size (still in ebx)?
pop ebx
ja indexTooLarge ; No, out of bounds
mov eax, [eax].m_location ; Load address of receiver into eax
ASSUME eax:PTR Oop
sub _SP, OOPSIZE
MPrefetch
mov eax, [eax+edx*OOPSIZE-OOPSIZE] ; Load Oop of element at required index
mov [_SP], eax ; And overwrite receiver in stack with it
DispatchNext
;byteObjectAt:
; TODO: Implement for 1, 2 and 4 byte encodings (see primitiveBasicAt)
;
; ASSUME eax:PTR OTE ; EAX is Oop of receiver
; ASSUME edx:DWORD ; EDX is the index
; ASSUME ecx:PTR OTE ; ECX is the Oop of the receiver's class
;
; mov ecx, [eax].m_size
; ASSUME ecx:DWORD
; and ecx, 7fffffffh ; Ignore sign bit (used to mark const objects)
;
; cmp edx, ecx ; Bounds check
; mov ecx, [eax].m_location ; Load object address into ecx on expection it will be in bounds
; ASSUME ecx:PTR ByteArray ; EAX points at receiver
; ja indexTooLarge ; Index out of bounds (>= size)
;
; movzx eax, BYTE PTR[ecx+edx-1] ; Load required byte, zero extending
; ASSUME eax:NOTHING
;
; MPrefetch
;
; lea eax, [eax+eax+1] ; Convert to SmallInteger
; mov [_SP-OOPSIZE], eax ; Overwrite receiver with result. No need to count as SmallInteger
;
; sub _SP, OOPSIZE ; Pop arg off stack
;
; DispatchNext
sendMessageToSmallInteger: ; Sent #basicAt: to a SmallInteger, probably an error
mov ecx, [Pointers.ClassSmallInteger]
jmp sendMessageToClass
indexTooLarge:
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass
byteObjectAt:
sendMessageToClass:
ASSUME eax:Oop ; EAX is receiver, although we don't need it here
ASSUME ecx:PTR OTE ; ECX contains class
mov edx, Pointers.specialSelectors[10*OOPSIZE] ; basicAt:
mov [STACKPOINTER], _SP ; Save down interpreter stack pointer, e.g. for C routine
pushd 1 ; 1 argument
mov [MESSAGE], edx ;; Set the MESSAGE global
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDBYTECODE shortSpecialSendBasicAt
; #basicAt:put:
BEGINBYTECODE shortSpecialSendBasicAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver under arguments
mov edx, [_SP-OOPSIZE] ; Load index argument from stack
ASSUME ecx:PTR OTE
test cl, 1
jnz sendMessage ; Its a SmallInteger, send it #basicAt:
sar edx, 1 ; Argument is a SmallInteger?
jnc sendMessage ; No, send the message
jle sendMessage ; Index out of bounds (<= 0)
test [ecx].m_flags, MASK m_pointer
jz byteObjectAtPut ; Skip to code for storing bytes
mov eax, [ecx].m_oteClass ; Get class Oop from OTE into eax
ASSUME eax:PTR OTE
push ebx
mov eax, [eax].m_location ; Load address of class object into eax
ASSUME eax:PTR Behavior
mov ebx, [ecx].m_size ; Load size of receiver into ebx
ASSUME ebx:SDWORD ; N.B. DON'T mask out the immutable bit here, so size negative if const object
mov eax, [eax].m_instanceSpec ; Load Instancespecification into edx
ASSUME eax:DWORD
sar ebx, 2 ; ebx = total Oop size
and eax, MASK m_fixedFields ; Mask off flags
shr eax, 1 ; Convert from SmallInteger
add edx, eax ; Add fixed offset for inst vars
cmp edx, ebx ; Index < size (still in ebx)?
mov eax, [ecx].m_location
ASSUME eax:PTR Object
pop ebx
jg sendMessage ; No, out of bounds
lea eax, [eax+edx*OOPSIZE-OOPSIZE] ; Get address of slot to update into EAX
mov edx, [_SP] ; Load value to write
ASSUME edx:PTR OTE
; We must inc ref. count, as we are storing into a heap allocated object here
CountUpOopIn <d>
; Exchange Oop of overwritten value with new value
mov ecx, [eax]
mov [eax], edx
; Must count down overwritten value, as it was in a heap object slot
CountDownOopIn <c>
; count down destroys eax, ecx, and edx, so have to wait til now for prefetch
mov eax, [_SP] ; Reload new value into eax
MPrefetch
mov [_SP-OOPSIZE*2], eax ; And overwrite receiver in stack with new value
sub _SP, OOPSIZE*2 ; Pop args
DispatchNext
byteObjectAtPut:
; TODO: Implement for 1, 2 and 4 byte encodings (see primitiveBasicAtPut)
;
; ASSUME ecx:PTR OTE ; ECX is receiver Oop (known byte object)
; ASSUME edx:DWORD ; EDX is index
;
; mov eax, [ecx].m_location ; Load object address into eax
; ASSUME eax:PTR ByteArray ; EAX is pointer to byte object
;
; cmp edx, [ecx].m_size ; Compare offset+HEADERSIZE with object size
; jg sendMessage ; Index out of bounds (> size)
;
; mov ecx, [_SP] ; Load value to store from stack top
;
; add eax, edx ; Calculate address of byte to write
; ASSUME eax:PTR BYTE
; ASSUME edx:NOTHING ; EDX is now free
;
; mov edx, ecx ; Save value to return later
; ASSUME edx:DWORD
; sar ecx, 1 ; Convert to real integer value
; jnc sendMessage ; Not a SmallInteger
;
; cmp ecx, 0FFh
; ja sendMessage ; Used unsigned comparison for 0<=ecx<=255
;
; mov [eax-1], cl ; Store byte into receiver
; ASSUME ecx:NOTHING
;
; MPrefetch
;
; mov [_SP-OOPSIZE*2], edx ; Overwrite receiver with value for return
; sub _SP, OOPSIZE*2 ; Pop Args
;
; DispatchNext
;
sendMessage:
; This is an unlikely error case (non-indexable receiver, out of bounds), so we don't care about perf here
SendSelectorTwoArgs <Pointers.specialSelectors[11*OOPSIZE]> ; #basicAt:put:
ENDBYTECODE shortSpecialSendBasicAtPut
BEGINBYTECODE shortSpecialSendBasicClass
mov ecx, [_SP] ; Load receiver into ecx
test cl, 1
jne smallInteger
ASSUME ecx:PTR OTE
mov eax, [ecx].m_oteClass ; Get class Oop from Object into eax
MPrefetch
mov [_SP], eax ; Replace stack top with class Oop
DispatchNext
smallInteger:
mov eax, [Pointers.ClassSmallInteger]
MPrefetch
mov [_SP], eax ; Replace stack top with class Oop
DispatchNext
ENDBYTECODE shortSpecialSendBasicClass
BEGINBYTECODE shortSpecialSendIsNil
mov eax, [oteNil]
mov edx, [oteFalse]
cmp eax, [_SP]
cmove edx, [oteTrue]
MPrefetch
mov [_SP], edx ; Overwrite stack top with false
DispatchNext
ENDBYTECODE shortSpecialSendIsNil
BEGINBYTECODE shortSpecialSendNotNil
mov eax, [oteNil]
mov edx, [oteFalse]
cmp eax, [_SP]
cmovne edx, [oteTrue]
MPrefetch
mov [_SP], edx ; Overwrite stack top with false
DispatchNext
ENDBYTECODE shortSpecialSendNotNil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
BEGINBYTECODE isZero
mov eax, [oteFalse] ; Load false (default answer)
cmp [_SP], SMALLINTZERO ; "receiver" is 0?
cmove eax, [oteTrue]
MPrefetch
mov [_SP], eax ; Overwrite stack top with true/false
DispatchNext
ENDBYTECODE isZero
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
BEGINBYTECODE shortSpecialSendNot
mov eax, [_SP]
cmp eax, [oteFalse]
je isFalse
cmp eax, [oteTrue]
jne notABoolean
; true, answer false
add eax, OTENTRYSIZE ; false immediately after true in OT
MPrefetch
mov [_SP], eax
DispatchNext
isFalse:
; false, answer true
sub eax, OTENTRYSIZE ; true is immediately before false in OT
MPrefetch
mov [_SP], eax
DispatchNext
notABoolean:
SendSelectorNoArgs <Pointers.notSymbol>
ENDBYTECODE shortSpecialSendNot
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
BEGINBYTECODE shortSpecialSendNullCoalesce
mov eax, [_SP-OOPSIZE]
cmp eax, [oteNil]
jne @F
; Receiver is nil, replace with argument
mov eax, [_SP]
mov [_SP-OOPSIZE], eax
@@:
MPrefetch
sub _SP, OOPSIZE
DispatchNext
ENDBYTECODE shortSpecialSendNullCoalesce
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Block Copy Instruction (quad byte)
; Calls C++ block copy routine (TODO - Implement entirely in assembler)
; Note that blockCopy uses _IP, but not _SP or _BP
BEGINBYTECODE blockCopy
mov ecx, DWORD PTR[_IP] ; Load extension into
movsx edx, WORD PTR[_IP+4] ; Load jump offset into EDX
add _IP, 6
push ecx ; Push BlockCopyExtension for call to blockCopy
mov [INSTRUCTIONPOINTER], _IP ; Save down IP (points at start of block byte codes)...
mov [STACKPOINTER], _SP ; ...and SP (needed in case any values to copy off stack)
add _IP, edx ; Prepare to jump to first byte code after block
call BLOCKCOPY ; Create new block (returned in EAX)
mov _SP, OOPSIZE
add _SP, [STACKPOINTER] ; blockCopy may have adjusted stack to remove copied values
mov [_SP], eax ; New block pushed onto stack
AddToZct <a>
DispatchByteCode
ENDBYTECODE blockCopy
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ShortSendXArgs MACRO x, offset
LOCAL sendToSmallInteger
; ecx-offset is the literal index
mov edx, [pMethod] ;; Load current method
ASSUME edx:PTR CompiledCodeObj
mov eax, [_SP-(OOPSIZE*x)] ;; Load receiver into EAX (under arg(s))
test al, 1 ;; Test for immediate receiver (used later)
mov [STACKPOINTER], _SP ;; Save down stack pointer (needed for DNU and C++ primitives)
mov edx, [edx].m_aLiterals[(ecx*OOPSIZE)-(offset*OOPSIZE)] ;; Load selector Oop into ecx
ASSUME eax:PTR OTE
pushd x ;; X arguments
mov [MESSAGE], edx ;; Save down message
jnz execMethodOfSmallInteger ;; If a SmallInteger need to load class differently
mov ecx, [eax].m_oteClass ;; Get class into ECX
jmp execMethodOfClass ;; Jump to routine to exec class>>message in ECX>>EDX
ENDM
BEGINBYTECODE shortSendNoArgs
ShortSendXArgs <0>, <FIRSTSHORTSENDNOARGS>
ENDBYTECODE shortSendNoArgs
ShortSendSelfNoArgs MACRO x, index, offset
mov eax, [_BP-OOPSIZE] ; Access receiver at _BP-1
mov edx, [pMethod] ; Load current method
ASSUME edx:PTR CompiledCodeObj
mov [_SP+OOPSIZE], eax ;; push object onto stack
add _SP, OOPSIZE
test al, 1 ; Test for immediate receiver (used later)
mov edx, [edx].m_aLiterals[(index*OOPSIZE)-(offset*OOPSIZE)]
pushd 0 ; 0 arguments
mov [STACKPOINTER], _SP ; Save down stack pointer (needed for DNU and C++ primitives)
mov [MESSAGE], edx ; Save down message
jnz execMethodOfSmallInteger ; If a SmallInteger need to load class differently
mov ecx, (OTE PTR[eax]).m_oteClass ; Get class into ECX
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ASSUME ecx:NOTHING
ENDM
BEGINBYTECODE shortSendSelfNoArgs
ShortSendSelfNoArgs <0>, ecx, FIRSTSHORTSENDSELFNOARGS
ENDBYTECODE shortSendSelfNoArgs
BEGINBYTECODE shortSendOneArg
ShortSendXArgs <1>, <FIRSTSHORTSENDONEARG>
ENDBYTECODE shortSendOneArg
BEGINBYTECODE shortSendTwoArgs
ShortSendXArgs <00000002h>, <FIRSTSHORTSENDTWOARGS>
ENDBYTECODE shortSendTwoArgs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Send Instruction (double byte)
;;
;; Extension specifies argument count and selector literal index (encoded into a byte as follows 111 11111)
SendLiteralECXinEAXwithEDXArgs MACRO
LOCAL sendToSmallInteger
ASSUME eax:PTR CompiledCodeObj
ASSUME ecx:DWORD
ASSUME edx:DWORD
pushd edx ; N arguments
neg edx ; Negate in order to access receiver under args
; Load selector Oop into ecx from literal frame of method pointed at by EAX
mov ecx, [eax].m_aLiterals[ecx*OOPSIZE]
ASSUME eax:NOTHING ; Ptr to method no longer required
mov [STACKPOINTER], _SP ; Save down SP for DNU and prims
mov eax, [_SP+(edx*OOPSIZE)] ; Load receiver into EAX (under args) (EDX now free)
mov [MESSAGE], ecx ; Set the MESSAGE global
test al, 1 ; Is the receiver a SmallInteger
mov edx, ecx ; Move message selector into edx (ECX now free)
jnz execMethodOfSmallInteger
ASSUME eax:PTR OTE ; Receiver is an object
mov ecx, [eax].m_oteClass ; Get the class of the Object
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDM
; Optimized for Pentium (perfectly paired - 8 instructions in 4 cycles)
BEGINBYTECODE Send
movzx ecx, [_IP] ; Get next byte code (top 3 bytes of ecx still 0)
mov eax, [pMethod] ; Load Oop of current method
mov edx, ecx ; EDX = descriptor
and ecx, 01Fh ; bottom 5 bits are literal index
shr edx, 5 ; edx now contains argCount
inc _IP
SendLiteralECXinEAXwithEDXArgs
ENDBYTECODE Send
BEGINBYTECODE sendTempNoArgs
movzx edx, [_IP] ; Get next byte code
mov eax, [pMethod] ; Load Oop of current method
ASSUME eax:PTR CompiledCodeObj
mov ecx, edx ;
and edx, 01Fh ; bottom 5 bits are literal index
shr ecx, 5 ; ecx now contains temp index (3 bits)
mov edx, [eax].m_aLiterals[edx*OOPSIZE]
ASSUME eax:NOTHING ; Ptr to method no longer required
inc _IP
mov eax, [_BP+ecx*OOPSIZE] ; Load temp var Oop from _BP into EAX
add _SP, OOPSIZE
test al, 1 ; Test for immediate receiver (used later)
mov [STACKPOINTER], _SP ; Save down stack pointer (needed for DNU and C++ primitives)
pushd 0 ; 0 arguments
mov [MESSAGE], edx ; Save down message
mov [_SP], eax ; Temp pushed on Smalltalk stack
jnz execMethodOfSmallInteger ; If a SmallInteger need to load class differently
mov ecx, (OTE PTR[eax]).m_oteClass ; Get class into ECX
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ASSUME ecx:NOTHING
ENDBYTECODE sendTempNoArgs
BEGINBYTECODE shortSpecialSendAt
mov eax, [_SP-OOPSIZE] ; Load receiver into EAX
mov edx, [_SP]
test al, 1
jnz sendToSmallInteger
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass ; Get the class of the Object
ASSUME ecx:PTR OTE
; Test for integer index first as this will detect typical dictionary lookup by non-integer key without need to compare against Array class
sar edx, 1
jnc sendToClass ; Index not an integer
jle sendToClass
test [eax].m_flags, MASK m_pointer ; Test pointer bit of object table entry
jz byteObjectAt
cmp ecx, [Pointers.ClassArray]
jne sendToClass
; It's an Array, so use hard-coded implementation for this very common operation
mov ecx, 7fffffffh ; Ignore the sign bit of the size (used to mark const objects)
shl edx, 2 ; edx = edx*OOPSIZE
and ecx, [eax].m_size ; Load size into ecx (masking out sign bit)
ASSUME ecx:DWORD
mov eax, [eax].m_location ; Load address of receiver into eax
ASSUME eax:PTR Oop
cmp edx, ecx ; Index < size
ja boundsError ; No, out of bounds
sub _SP, OOPSIZE
MPrefetch
mov eax, [eax+edx-OOPSIZE] ; Load Oop of element at required index
mov [_SP], eax ; And overwrite receiver in stack with it
DispatchNext
byteObjectAt:
ASSUME eax:PTR OTE ; ECX is Oop of receiver, but not needed
ASSUME edx:DWORD ; EDX is the index
ASSUME ecx:PTR OTE ; EAX is the Oop of the receiver's class
cmp ecx, [Pointers.ClassByteArray]
jne sendToClass
mov ecx, [eax].m_location ; Load object address into eax
ASSUME ecx:PTR ByteArray ; EAX points at receiver
mov eax, [eax].m_size
ASSUME eax:DWORD
and eax, 7fffffffh ; Mask out the immutability bit
cmp edx, eax ; Index out of bounds (>= size) ?
ja boundsError ;
movzx eax, BYTE PTR[ecx+edx-1] ; Load required byte, zero extending
sub _SP, OOPSIZE
MPrefetch
lea eax, [eax+eax+1] ; Convert to SmallInteger
mov [_SP], eax ; Overwrite receiver with result.
DispatchNext
sendToSmallInteger:
ASSUME eax:SDWORD ;; EAX is a SmallInteger
mov ecx, [Pointers.ClassSmallInteger]
jmp sendToClass
boundsError:
mov eax, [_SP-OOPSIZE]
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass
sendToClass:
mov edx, [Pointers.atSelector] ; access entry in SpecialSelectors table
mov [STACKPOINTER], _SP ; Save down SP for DNU and prims
pushd 1 ; 1 argument
mov [MESSAGE], edx ; Set the MESSAGE global
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDBYTECODE shortSpecialSendAt
BEGINBYTECODE shortSpecialSendAtPut
mov eax, [_SP-OOPSIZE*2] ; Access receiver under arguments
mov edx, [_SP-OOPSIZE] ; Load index argument from stack
test al, 1
jnz sendToSmallInteger ; Its a SmallInteger, send it #at:put: even though this is probably an error
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass
sar edx, 1 ; Convert SmallIteger arg to int
jnc sendToClass ; Non-SmallInteger?
jle sendToClass ; Index is <= 0?
test [eax].m_flags, MASK m_pointer ; Test pointer bit of object table entry
jz byteObjectAtPut
cmp ecx, [Pointers.ClassArray]
jne sendToClass
; It's an Array, so use hard-coded implementation for this very common operation
mov ecx, [eax].m_location
ASSUME ecx:PTR Object
mov eax, [eax].m_size ; Compare with byte size of receiver Array
sar eax, 2 ; N.B. DON'T mask out the immutable bit here, so size negative if const object
lea ecx, [ecx+edx*OOPSIZE-OOPSIZE]
ASSUME ecx:PTR Oop
cmp edx, eax
mov edx, [_SP] ; Load value to write into EDX
ASSUME edx:PTR OTE
jg sendToToS ; No, out of bounds (not unsigned comparison is correct here in case of large EDX that would go negative when shifted)
; We must inc ref. count, as we are storing into a heap allocated object here
CountUpOopIn <d>
; Exchange Oop of overwritten value with new value
mov eax, [ecx]
mov [ecx], edx
; Must count down overwritten value, as it was in a heap object slot
CountDownOopIn <a>
; count down destroys eax, ecx, and edx, so have to wait til now for prefetch
mov eax, [_SP] ; Reload new value into eax
MPrefetch
mov [_SP-OOPSIZE*2], eax ; And overwrite receiver in stack with new value
sub _SP, OOPSIZE*2 ; Pop args
DispatchNext
byteObjectAtPut:
ASSUME eax:PTR OTE ; EAX is byte object Oop
ASSUME ecx:PTR OTE ; ECX is byte object's class Oop
ASSUME edx:DWORD ; EDX is index
cmp ecx, [Pointers.ClassByteArray]
jne sendToClass
cmp edx, [eax].m_size ; Compare index+HEADERSIZE with object size (latter -ve if immutable)
jg sendToClass ; Index out of bounds (>= size)
mov ecx, [eax].m_location ; Load object address into eax
ASSUME ecx:PTR ByteArray ; EAX is pointer to byte object
mov eax, [_SP] ; Load value to store/return
ASSUME eax:Oop
add ecx, edx
ASSUME ecx:PTR BYTE
mov edx, eax ; Preserve value to return later in edx
ASSUME edx:Oop
sar eax, 1 ; Convert to real integer value
jnc sendToToS ; Not a SmallInteger
cmp eax, 0FFh ; Too large?
ja sendToToS ; Used unsigned comparison for 0<=ecx<=255
mov [ecx-1], al ; Store byte into receiver
ASSUME ecx:NOTHING
MPrefetch
mov [_SP-OOPSIZE*2], edx ; Overwrite receiver with value for return (still in EDX)
sub _SP, OOPSIZE*2
DispatchNext
sendToSmallInteger:
ASSUME eax:SDWORD ; EAX is a SmallInteger
mov ecx, [Pointers.ClassSmallInteger]
jmp sendToClass
sendToToS:
mov eax, [_SP-OOPSIZE*2]
ASSUME eax:PTR OTE
mov ecx, [eax].m_oteClass
sendToClass:
mov edx, [Pointers.atPutSelector] ; access entry in SpecialSelectors table
mov [STACKPOINTER], _SP ; Save down SP for DNU and prims
pushd 2 ; 1 argument
mov [MESSAGE], edx ; Set the MESSAGE global
jmp execMethodOfClass ; Jump to routine to exec class>>message in ECX>>EDX
ENDBYTECODE shortSpecialSendAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Extended Send Instruction (triple byte).
;;
;; Extension specifies argument count (first byte) and selector literal index (second byte)
;;
;; This occurs commonly when calling external functions because they often take more arguments
;; than 7 arguments
BEGINBYTECODE longSend
xor ecx, ecx
mov eax, [pMethod] ; Load pointer to current method
ASSUME eax:PTR CompiledCodeObj
mov cl, BYTE PTR[_IP+1]
movzx edx, BYTE PTR[_IP]
add _IP, 2
SendLiteralECXinEAXwithEDXArgs
ENDBYTECODE longSend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
; Executing a method may involve a primitive response (quick return of nil/true/
; false/zero/self/instance var, or a primitive call) or
; normal method invocation (non-primitive or following primitive
; failure). In the case of normal method invocation the machine
; is placed into a state where it is ready to begin executing the
; new method, but the actual execution is performed after this
; function returns by the byte code dispatch loop. Special methods
; with primitive responses are executed immediately, complete
; before this function returns, and do not involve a new context.
;
; The main body of the routine is very short, being a switch
; through a jump table (see immediately below).
ALIGNPROC
execMethodOfSmallInteger:
mov ecx, [Pointers.ClassSmallInteger]
BEGINPROCNOALIGN execMethodOfClass
ASSUME edx:PTR OTE ; Selector (N.B. must have been saved down in MESSAGE global
ASSUME ecx:PTR OTE ; Class
; [ESP] is the argument count (i.e. one arg on stack)
; Calculate the method cache hash
mov eax, ecx ; Get class Oop into ecx
xor eax, edx ; Xor with selector oop
and eax, METHODCACHEMASK ; Mod method cache size
; Cache is 16 bytes per entry (a Pentium sweet spot, and since OTE is 16 bytes long, we don't
; need to scale the hash we calculated
; At this point
; EAX = byte index into cache
; ECX = class OTE
; EDX = selectOR OTE
cmp (MethodCacheEntry PTR METHODCACHE[eax]).selector, edx
jne findMethodCacheMiss ; Forward jump (predict not taken) if cache miss
cmp (MethodCacheEntry PTR METHODCACHE[eax]).classPointer, ecx
jne findMethodCacheMiss ; Forward jump (predict not taken) if cache miss
mov ecx, (MethodCacheEntry PTR METHODCACHE[eax]).method
assume ecx:PTR OTE
mov eax, (MethodCacheEntry PTR METHODCACHE[eax]).primAddress
IFDEF _DEBUG
inc [CACHEHITS]
ENDIF
mov [NEWMETHOD], ecx
pop edx ; Restore arg count
IFDEF _DEBUG
mov ecx, [ecx].m_location
ENDIF
; At this point edx=argCount, ecx & [NEWMETHOD] = Oop of new method, _SP=[STACKPOINTER]
; eax = pointer to func to run
; Execute new method, and dispatch the next byte code
execMethod:
ASSUME edx:DWORD
ASSUME eax:DWORD
IFDEF _DEBUG
push eax
ASSUME eax:NOTHING
ASSUME ecx:PTR CompiledCodeObj
movzx eax, [ecx].m_header.primitiveIndex
inc DWORD PTR[_primitiveCounters+eax*4]
pop eax
ASSUME eax:DWORD
ASSUME ecx:NOTHING
ENDIF
mov ecx, _SP
mov [INSTRUCTIONPOINTER], _IP ;; Save IP in case of fault or call to C++ primitive
call eax
;; Likelihood is that the primitive will succeed, so jump conditionally on failure
;; (static prediction is that all forwards jumps will not be taken)
test al, 1
jnz @F
MPrefetch
mov _SP, eax ;; Reload stack pointer as primitive may have modified
DispatchNext ;; succeeded, continue executing byte codes without activating new context
@@:
mov edx, [NEWMETHOD]
ASSUME edx:PTR OTE
ASSUME ecx:NOTHING
push eax ; Save the failure code while we create the new method stack frame
mov edx, [edx].m_location ; Get pointer to new method into edx
; Similar to MActivateMethod begins
ASSUME edx:PTR CompiledCodeObj ; Expects ptr to new method in ECX
IFDEF PROFILING
inc [?contextsSuspended@@3IA]
inc [?methodsActivated@@3IA]
ENDIF
;; Work out _IP index before overwriting old method pointer
mov eax, [pMethod] ; Load pointer to current method into eax
ASSUME eax:PTR CompiledCodeObj
mov [pMethod], edx ; Save down pointer to new method
.IF (!(BYTE PTR([eax].m_byteCodes) & 1))
mov eax, [eax].m_byteCodes
ASSUME eax:PTR OTE
mov eax, [eax].m_location
.ELSE
add eax, CompiledCodeObj.m_byteCodes
.ENDIF
ASSUME eax:NOTHING
sub _IP, eax
IFDEF _DEBUG
.IF (_IP > 16384)
int 3 ;; Probably a bug - unusual to have a method with more than 16k bytecodes
.ENDIF
ENDIF
; At this point _IP is the offset into the byte codes
movzx eax, [edx].m_header.argumentCount
; Work out the new base pointer (points at first argument - not receiver)
neg eax ; We'll be subtracting arg count
lea _IP, [_IP+_IP+1] ; Convert old IP offset to SmallInteger for later
; Now work out the number of temporaries required for new method
; Load flag word which contains temp count
movzx ecx, [edx].m_header.stackTempCount ; Get stack temp count into ecx
lea _BP, [_SP+eax*OOPSIZE+OOPSIZE] ; Calculate _BP of new context (points at first argument NOT receiver)
add _SP, OOPSIZE ; Adjust SP to point at first temp, or StackFrame fields if none
test ecx, ecx ; Are there any stack temps required?
pop eax ; failure code
jz noStackTemps
mov [_SP], eax ; Store primitive failure code (a SmallInteger) into _failureCode temp slot (always the first temp)
mov eax, [oteNil] ; All other temps must have initial value of Nil
jmp first
@@:
mov [_SP], eax
first:
add _SP, OOPSIZE
dec ecx
jnz @B
noStackTemps:
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
mov ecx, [NEWMETHOD] ; Restore method Oop
mov [_SP].m_method, ecx ; Store new method oop into new StackFrame fields
; Now see whether a real (object) context is required
.IF !([edx].m_header.flags & MASK envTempCount) ; Test if method requires a context
mov [_SP].m_environment, SMALLINTZERO ; Zero out the env slot as this frame has no environment
.ELSE
; At this point, _BP points at the first argument of the new context (in the stack), i.e. it is
; correctly set up for the new frame. ECX contains method header flags
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
movzx ecx, [edx].m_header.flags
push edx ; Save edx for later
ASSUME edx:NOTHING
shr ecx, 2 ; Access the actual env temp count
lea edx, [_SP+1] ; 2: Calc SmallInteger frame pointer into EAX...
sub ecx, 1 ; Count is one greater than number of slots required (to flag need for Context for far ^-return)
call NEWCONTEXT
ASSUME eax:PTR OTE ; EAX is the Oop of the new Context
lea edx, [_SP].m_environment
; Set the context of the stack frame to be the new method context
mov [_SP].m_environment, eax
AddToZct <a>,<edx>
ASSUME eax:NOTHING ; Context Oop no longer needed
pop edx
ASSUME edx:PTR CompiledCodeObj
.ENDIF
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ASSUME _SP:PStackFrame
ASSUME _BP:PTR Oop
ASSUME edx:PTR CompiledCodeObj
lea eax, [_BP+1] ; Make SmallInteger pointer to base in EAX
mov [BASEPOINTER], _BP ; Save down BP into interpreter register
mov ecx, [ACTIVEFRAME] ; Load frame being suspended into ECX
ASSUME ecx:PStackFrame
mov [_SP].m_ip, SMALLINTZERO ; Zero out the new frames IP
mov [_SP].m_bp, eax ; Store SmallInteger base pointer into new frame fields
;; Suspended contexts _SP is _BP - 2 (_BP points at first arg, not receiver)
sub eax, OOPSIZE*2 ; EAX contains SmallInteger _BP (from above)
;; Save down suspended context's _IP and _SP (using ECX)
mov [ecx].m_ip, _IP ; IP index was worked out above
mov [ecx].m_sp, eax
lea eax, [ecx+1] ; Create SmallInteger pointer to frame being suspended ...
ASSUME ecx:NOTHING ; We have no further use for the suspended context
mov [_SP].m_sp, SMALLINTZERO ; Zero out new frames SP
mov [_SP].m_caller, eax ; Store SmallInt pointer to calling frame into new context fields
; Save down frame pointer for C++
mov [ACTIVEFRAME], _SP
ASSUME _SP:PTR Oop
add _SP, SIZEOF StackFrame-OOPSIZE ; Adjust _SP to point at last field of frame
; Set up interpreters _IP
GetInitialIPOfMethod <edx>
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _SP
call DEBUGMETHODACTIVATED
.ENDIF
ENDIF
; MActiveMethod Ends
mov edx, [ASYNCPENDING]
test edx, edx
jnz asyncPending ;; If any ansync. signals, go and test process switch
DispatchByteCode
asyncPending:
; Store interpreter registers before calling C++ func
mov [INSTRUCTIONPOINTER], _IP
mov [STACKPOINTER], _SP
call MSGPOLL
mov _IP, [INSTRUCTIONPOINTER]
mov _SP, [STACKPOINTER]
MPrefetch
mov _BP, [BASEPOINTER]
DispatchNext
findMethodCacheMiss:
push ecx
call FINDNEWMETHODNOCACHE
ASSUME eax:PTR MethodCacheEntry
mov ecx, [eax].method;
ASSUME ecx:PTR OTE
mov eax, [eax].primAddress
ASSUME eax:DWORD
mov [NEWMETHOD], ecx ; Store down new method register
mov ecx, [ecx].m_location ; Load address of new method object into ecx
ASSUME ecx:PTR CompiledCodeObj
mov _SP, [STACKPOINTER] ; Restore stack pointer (in case of DNU)
movzx edx, [ecx].m_header.argumentCount
; ECX = CompiledMethod*, EDX = arg count, EAX = primitive routine to call
jmp execMethod
ENDPROC execMethodOfClass
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Create a new frame for the new method and start executing its bytcodes
;
BEGINPRIMITIVE primitiveActivateMethod
mov ecx, [NEWMETHOD]
ASSUME ecx:PTR OTE
mov ecx, [ecx].m_location ; Get pointer to new method into edx
ASSUME ecx:PTR CompiledCodeObj
IFDEF PROFILING
inc [?contextsSuspended@@3IA]
inc [?methodsActivated@@3IA]
ENDIF
;; Work out _IP index before overwriting old method pointer
mov eax, [pMethod] ; Load pointer to current method into eax
ASSUME eax:PTR CompiledCodeObj
mov edx, ecx ; Get pointer to new method into edx
ASSUME edx:PTR CompiledCodeObj
mov [pMethod], ecx ; Save down pointer to new method
.IF ((BYTE PTR([eax].m_byteCodes) & 1))
add eax, CompiledCodeObj.m_byteCodes
.ELSE
mov eax, [eax].m_byteCodes
ASSUME eax:PTR OTE
mov eax, [eax].m_location
.ENDIF
ASSUME eax:NOTHING
sub _IP, eax
IFDEF _DEBUG
.IF (_IP > 16384)
int 3 ;; Probably a bug - unusual to have a method with more than 16k bytecodes
.ENDIF
ENDIF
; At this point _IP is the offset into the byte codes
movzx eax, [edx].m_header.argumentCount
; Work out the new base pointer (points at first argument - not receiver)
neg eax ; We'll be subtracting arg count
lea _IP, [_IP+_IP+1] ; Convert old IP offset to SmallInteger for later
; We're don't need pointer to new method any more
ASSUME ecx:NOTHING
; Now work out the number of temporaries required for new method
; Load flag word which contains temp count
movzx ecx, [edx].m_header.stackTempCount ; Get stack temp count into ecx
lea _BP, [_SP+eax*OOPSIZE+OOPSIZE] ; Calculate _BP of new context (points at first argument NOT receiver)
add _SP, OOPSIZE
mov eax, [oteNil] ; Temps must have initial value of Nil
cmp ecx, 0
.WHILE (!ZERO?)
mov [_SP], eax
add _SP, OOPSIZE
dec ecx
.ENDW
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
mov ecx, [NEWMETHOD] ; Restore method Oop
; Note that we used to have to count up the method's ref. count here, but no more since the frame is on the stack
mov [_SP].m_method, ecx ; Store new method oop into new StackFrame fields
; Now see whether a real (object) context is required
.IF !([edx].m_header.flags & MASK envTempCount) ; Test if method requires a context
mov [_SP].m_environment, SMALLINTZERO ; Zero out the env slot as this frame has no environment
.ELSE
; At this point, _BP points at the first argument of the new context (in the stack), i.e. it is
; correctly set up for the new frame. ECX contains method header flags
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
movzx ecx, [edx].m_header.flags
push edx ; Save edx for later
ASSUME edx:NOTHING
shr ecx, 2 ; Access the actual env temp count
lea edx, [_SP+1] ; 2: Calc SmallInteger frame pointer into EAX...
sub ecx, 1 ; Count is one greater than number of slots required (to flag need for Context for far ^-return)
call NEWCONTEXT
ASSUME eax:PTR OTE ; EAX is the Oop of the new Context
lea edx, [_SP].m_environment
; Set the context of the stack frame to be the new method context
mov [_SP].m_environment, eax
AddToZct <a>,<edx>
ASSUME eax:NOTHING ; Context Oop no longer needed
pop edx
ASSUME edx:PTR CompiledCodeObj
.ENDIF
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ASSUME _SP:PStackFrame
ASSUME _BP:PTR Oop
ASSUME edx:PTR CompiledCodeObj
lea eax, [_BP+1] ; Make SmallInteger pointer to base in EAX
mov [BASEPOINTER], _BP ; Save down BP into interpreter register
mov ecx, [ACTIVEFRAME] ; Load frame being suspended into ECX
ASSUME ecx:PStackFrame
mov [_SP].m_ip, SMALLINTZERO ; Zero out the new frames IP
mov [_SP].m_bp, eax ; Store SmallInteger base pointer into new frame fields
;; Suspended contexts _SP is _BP - 2 (_BP points at first arg, not receiver)
sub eax, OOPSIZE*2 ; EAX contains SmallInteger _BP (from above)
;; Save down suspended context's _IP and _SP (using ECX)
mov [ecx].m_ip, _IP ; IP index was worked out above
mov [ecx].m_sp, eax
lea eax, [ecx+1] ; Create SmallInteger pointer to frame being suspended ...
ASSUME ecx:NOTHING ; We have no further use for the suspended context
mov [_SP].m_sp, SMALLINTZERO ; Zero out new frames SP
mov [_SP].m_caller, eax ; Store SmallInt pointer to calling frame into new context fields
; Save down frame pointer for C++
mov [ACTIVEFRAME], _SP
ASSUME _SP:PTR Oop
add _SP, SIZEOF StackFrame-OOPSIZE ; Adjust _SP to point at last field of frame
; Set up interpreters _IP
GetInitialIPOfMethod <edx>
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _SP
call DEBUGMETHODACTIVATED
.ENDIF
ENDIF
mov eax, [ASYNCPENDING]
test eax, eax
jnz asyncPending ;; If any ansync. signals, go and test process switch
mov eax, _SP ; primitiveSuccess(0)
ret
asyncPending:
; Store interpreter registers before calling C++ func
mov [INSTRUCTIONPOINTER], _IP
mov [STACKPOINTER], _SP
call MSGPOLL
mov _IP, [INSTRUCTIONPOINTER]
mov eax, [STACKPOINTER]
mov _BP, [BASEPOINTER]
ret
ENDPRIMITIVE primitiveActivateMethod
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Supersend Instruction (double byte)
;;
;; Extension specifies argument count and selector literal index (encoded into a byte as follows 111 11111)
BEGINBYTECODE Supersend
movzx ecx, [_IP] ; Get next byte code (top 3 bytes of ecx still 0)
inc _IP
mov edx, ecx ; EDX = descriptor
and ecx, 01Fh ; bottom 5 bits are literal index
shr edx, 5 ; edx now contains argCount
; Drop through ...
ENDBYTECODE Supersend
; No align as dropped into from above
BEGINPROCNOALIGN sendLiteralSelectorToSuper ; EDX = argCount, ECX = literal index
mov eax, [pMethod] ; Load Oop of current method
ASSUME eax:PTR CompiledCodeObj
mov ecx, [eax].m_aLiterals[ecx*OOPSIZE] ; Load selector Oop into ecx
mov [MESSAGE], ecx ; Save down message selector
mov ecx, [eax].m_methodClass ; Load class Oop from the method
ASSUME eax:NOTHING
mov ecx, (OTE PTR[ecx]).m_location ; Load pointer to class object
mov ecx, (Behavior PTR[ecx]).m_superclass ; Load Oop of superclass into ECX
mov [STACKPOINTER], _SP ; Save down stack pointer (needed for DNU and C++ primitives)
push edx ; Save arg count for later use
mov edx, [MESSAGE]
jmp execMethodOfClass
ENDPROC sendLiteralSelectorToSuper
BEGINPROC EXECUTENEWMETHOD
;
; void __factcall Interpreter::executeNewMethod(OTE* newMethod, unsigned argCount)
;
; Inputs:
; ECX - Oop of method to execute (needed by activateNewMethod for setting up context)
; EDX - Argument count
; Outputs:
; EAX - Destroyed
; ECX - Destroyed
; EDX - Destroyed
;
; C++ entry point for preparing to execute new method. This routine is
; an almost exact copy of the byte code dispatch loops execNewMethod,
; BUT with the significant difference that it returns to the caller,
; not the byte dispatch loop. There are three reasons for having
; two different versions - performance, performance and performance.
ASSUME ecx:PTR OTE
ASSUME edx:DWORD
mov [NEWMETHOD], ecx ; Save Oop of new method
mov ecx, [ecx].m_location ; Load address of CompiledMethod into ECX
ASSUME ecx:PTR CompiledCodeObj
; Entered from C++, must save then set up _SP/_IP for assembler primitives
; Load primitive index (0..255), top 3 bytes of EAX still 0
push _SP ; Mustn't destroy ESI for C++ caller
push _IP ; Ditto EDI
push _BP ; Ditto EBP
movzx eax, [ecx].m_header.primitiveIndex
; Need interpreter registers loaded for asm primitives
mov _SP, [STACKPOINTER]
mov _IP, [INSTRUCTIONPOINTER]
mov _BP, [BASEPOINTER]
; Pass SP to primitive via ECX. Arg count is still in EDX
mov ecx, _SP
IFDEF _DEBUG
inc DWORD PTR[_primitiveCounters+eax*4]
ENDIF
call DWORD PTR[_primitivesTable+eax*4] ; Call via jump table
test al, 1 ; Primitives return SmallInteger for failure, new SP (which will be a multiple of 4) for success
jnz @F ; Failed?
mov [STACKPOINTER], eax
mov [INSTRUCTIONPOINTER], _IP ; Do we need this?
pop _BP
pop _IP
pop _SP
ret
@@:
; Failed, so must activate the new method
mov edx, [NEWMETHOD]
ASSUME edx:PTR OTE
ASSUME ecx:NOTHING
push eax ; Save the failure code while we create the new method stack frame
mov edx, [edx].m_location ; Get pointer to new method into edx
; Similar to MActivateMethod begins
ASSUME edx:PTR CompiledCodeObj ; Expects ptr to new method in ECX
IFDEF PROFILING
inc [?contextsSuspended@@3IA]
inc [?methodsActivated@@3IA]
ENDIF
;; Work out _IP index before overwriting old method pointer
mov eax, [pMethod] ; Load pointer to current method into eax
ASSUME eax:PTR CompiledCodeObj
mov [pMethod], edx ; Save down pointer to new method
.IF (!(BYTE PTR([eax].m_byteCodes) & 1))
mov eax, [eax].m_byteCodes
ASSUME eax:PTR OTE
mov eax, [eax].m_location
.ELSE
add eax, CompiledCodeObj.m_byteCodes
.ENDIF
ASSUME eax:NOTHING
sub _IP, eax
IFDEF _DEBUG
.IF (_IP > 16384)
int 3 ;; Probably a bug - unusual to have a method with more than 16k bytecodes
.ENDIF
ENDIF
; At this point _IP is the offset into the byte codes
movzx eax, [edx].m_header.argumentCount
; Work out the new base pointer (points at first argument - not receiver)
neg eax ; We'll be subtracting arg count
lea _IP, [_IP+_IP+1] ; Convert old IP offset to SmallInteger for later
; Now work out the number of temporaries required for new method
; Load flag word which contains temp count
movzx ecx, [edx].m_header.stackTempCount ; Get stack temp count into ecx
lea _BP, [_SP+eax*OOPSIZE+OOPSIZE] ; Calculate _BP of new context (points at first argument NOT receiver)
add _SP, OOPSIZE ; Adjust SP to point at first temp, or StackFrame fields if none
test ecx, ecx ; Are there any stack temps required?
pop eax ; failure code
jz noStackTemps
mov [_SP], eax ; Store primitive failure code (a SmallInteger) into _failureCode temp slot (always the first temp)
mov eax, [oteNil] ; All other temps must have initial value of Nil
jmp first
@@:
mov [_SP], eax
first:
add _SP, OOPSIZE
dec ecx
jnz @B
noStackTemps:
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
mov ecx, [NEWMETHOD] ; Restore method Oop
mov [_SP].m_method, ecx ; Store new method oop into new StackFrame fields
; Now see whether a real (object) context is required
.IF !([edx].m_header.flags & MASK envTempCount) ; Test if method requires a context
mov [_SP].m_environment, SMALLINTZERO ; Zero out the env slot as this frame has no environment
.ELSE
; At this point, _BP points at the first argument of the new context (in the stack), i.e. it is
; correctly set up for the new frame. ECX contains method header flags
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
movzx ecx, [edx].m_header.flags
push edx ; Save edx for later
ASSUME edx:NOTHING
shr ecx, 2 ; Access the actual env temp count
lea edx, [_SP+1] ; 2: Calc SmallInteger frame pointer into EAX...
sub ecx, 1 ; Count is one greater than number of slots required (to flag need for Context for far ^-return)
call NEWCONTEXT
ASSUME eax:PTR OTE ; EAX is the Oop of the new Context
lea edx, [_SP].m_environment
; Set the context of the stack frame to be the new method context
mov [_SP].m_environment, eax
AddToZct <a>,<edx>
ASSUME eax:NOTHING ; Context Oop no longer needed
pop edx
ASSUME edx:PTR CompiledCodeObj
.ENDIF
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ASSUME _SP:PStackFrame
ASSUME _BP:PTR Oop
ASSUME edx:PTR CompiledCodeObj
lea eax, [_BP+1] ; Make SmallInteger pointer to base in EAX
mov [BASEPOINTER], _BP ; Save down BP into interpreter register
mov ecx, [ACTIVEFRAME] ; Load frame being suspended into ECX
ASSUME ecx:PStackFrame
mov [_SP].m_ip, SMALLINTZERO ; Zero out the new frames IP
mov [_SP].m_bp, eax ; Store SmallInteger base pointer into new frame fields
;; Suspended contexts _SP is _BP - 2 (_BP points at first arg, not receiver)
sub eax, OOPSIZE*2 ; EAX contains SmallInteger _BP (from above)
;; Save down suspended context's _IP and _SP (using ECX)
mov [ecx].m_ip, _IP ; IP index was worked out above
mov [ecx].m_sp, eax
lea eax, [ecx+1] ; Create SmallInteger pointer to frame being suspended ...
ASSUME ecx:NOTHING ; We have no further use for the suspended context
mov [_SP].m_sp, SMALLINTZERO ; Zero out new frames SP
mov [_SP].m_caller, eax ; Store SmallInt pointer to calling frame into new context fields
; Save down frame pointer for C++
mov [ACTIVEFRAME], _SP
ASSUME _SP:PTR Oop
add _SP, SIZEOF StackFrame-OOPSIZE ; Adjust _SP to point at last field of frame
; Set up interpreters _IP
GetInitialIPOfMethod <edx>
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _SP
call DEBUGMETHODACTIVATED
.ENDIF
ENDIF
mov edx, [ASYNCPENDING]
; Save down registers for use in C++
mov [STACKPOINTER], _SP
mov [INSTRUCTIONPOINTER], _IP
pop _BP
pop _IP
pop _SP
; Check for pending interrupts (necessary, for example, to be able to step into a failing primitive)
test edx, edx
jnz MSGPOLL ;; If any ansync. signals, go and test process switch
ret
ENDPROC EXECUTENEWMETHOD
BEGINPROC ACTIVATEPRIMITIVEMETHOD
ASSUME ecx:PTR CompiledCodeObj
ASSUME edx:DWORD ; Actually the _PrimitiveFailureCode enum value; must already a SmallInteger value
; See execPrimitive above.
; Entered from C++, must save then set up _SP/_IP/_BP for assembler code
push _SP ; Mustn't destroy for C++ caller
push _IP ; Ditto _IP
push _BP
push edx ; Save primitive failure code
; Load interpreter registers
mov _IP, [INSTRUCTIONPOINTER]
mov _SP, [STACKPOINTER]
mov _BP, [BASEPOINTER]
; Similar to MActivateMethod begins
IFDEF PROFILING
inc [?contextsSuspended@@3IA]
inc [?methodsActivated@@3IA]
ENDIF
;; Work out _IP index before overwriting old method pointer
mov eax, [pMethod] ; Load pointer to current method into eax
ASSUME eax:PTR CompiledCodeObj
mov [pMethod], ecx ; Save down pointer to new method
mov edx, ecx
ASSUME edx:PTR CompiledCodeObj
ASSUME ecx:NOTHING
.IF ((BYTE PTR([eax].m_byteCodes) & 1))
add eax, CompiledCodeObj.m_byteCodes
.ELSE
mov eax, [eax].m_byteCodes
ASSUME eax:PTR OTE
mov eax, [eax].m_location
.ENDIF
ASSUME eax:NOTHING
sub _IP, eax
IFDEF _DEBUG
.IF (_IP > 16384)
int 3 ;; Probably a bug - unusual to have a method with more than 16k bytecodes
.ENDIF
ENDIF
; At this point _IP is the offset into the byte codes
movzx eax, [edx].m_header.argumentCount
; Work out the new base pointer (points at first argument - not receiver)
neg eax ; We'll be subtracting arg count
lea _IP, [_IP+_IP+1] ; Convert old IP offset to SmallInteger for later
; Now work out the number of temporaries required for new method
; Load flag word which contains temp count
movzx ecx, [edx].m_header.stackTempCount ; Get stack temp count into ecx
lea _BP, [_SP+eax*OOPSIZE+OOPSIZE] ; Calculate _BP of new context (points at first argument NOT receiver)
add _SP, OOPSIZE ; Adjust SP to point at first temp, or StackFrame fields if none
test ecx, ecx ; Are there any stack temps required?
pop eax ; failure code
jz noStackTemps
mov [_SP], eax ; Store primitive failure code (a SmallInteger) into _failureCode temp slot (always the first temp)
mov eax, [oteNil] ; All other temps must have initial value of Nil
jmp first
@@:
mov [_SP], eax
first:
add _SP, OOPSIZE
dec ecx
jnz @B
noStackTemps:
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
mov ecx, [NEWMETHOD] ; Restore method Oop
mov [_SP].m_method, ecx ; Store new method oop into new StackFrame fields
; Now see whether a real (object) context is required
.IF !([edx].m_header.flags & MASK envTempCount) ; Test if method requires a context
mov [_SP].m_environment, SMALLINTZERO ; Zero out the env slot as this frame has no environment
.ELSE
; At this point, _BP points at the first argument of the new context (in the stack), i.e. it is
; correctly set up for the new frame. ECX contains method header flags
ASSUME _SP:PStackFrame ; _SP now points at location for new StackFrame
movzx ecx, [edx].m_header.flags
push edx ; Save edx for later
ASSUME edx:NOTHING
shr ecx, 2 ; Access the actual env temp count
lea edx, [_SP+1] ; 2: Calc SmallInteger frame pointer into EAX...
sub ecx, 1 ; Count is one greater than number of slots required (to flag need for Context for far ^-return)
call NEWCONTEXT
ASSUME eax:PTR OTE ; EAX is the Oop of the new Context
lea edx, [_SP].m_environment
; Set the context of the stack frame to be the new method context
mov [_SP].m_environment, eax
AddToZct <a>,<edx>
ASSUME eax:NOTHING ; Context Oop no longer needed
pop edx
ASSUME edx:PTR CompiledCodeObj
.ENDIF
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ASSUME _SP:PStackFrame
ASSUME _BP:PTR Oop
ASSUME edx:PTR CompiledCodeObj
lea eax, [_BP+1] ; Make SmallInteger pointer to base in EAX
mov [BASEPOINTER], _BP ; Save down BP into interpreter register
mov ecx, [ACTIVEFRAME] ; Load frame being suspended into ECX
ASSUME ecx:PStackFrame
mov [_SP].m_ip, SMALLINTZERO ; Zero out the new frames IP
mov [_SP].m_bp, eax ; Store SmallInteger base pointer into new frame fields
;; Suspended contexts _SP is _BP - 2 (_BP points at first arg, not receiver)
sub eax, OOPSIZE*2 ; EAX contains SmallInteger _BP (from above)
;; Save down suspended context's _IP and _SP (using ECX)
mov [ecx].m_ip, _IP ; IP index was worked out above
mov [ecx].m_sp, eax
lea eax, [ecx+1] ; Create SmallInteger pointer to frame being suspended ...
ASSUME ecx:NOTHING ; We have no further use for the suspended context
mov [_SP].m_sp, SMALLINTZERO ; Zero out new frames SP
mov [_SP].m_caller, eax ; Store SmallInt pointer to calling frame into new context fields
; Save down frame pointer for C++
mov [ACTIVEFRAME], _SP
ASSUME _SP:PTR Oop
add _SP, SIZEOF StackFrame-OOPSIZE ; Adjust _SP to point at last field of frame
; Set up interpreters _IP
GetInitialIPOfMethod <edx>
IFDEF _DEBUG
.IF ([EXECUTIONTRACE])
mov ecx, _SP
call DEBUGMETHODACTIVATED
.ENDIF
ENDIF
; MActiveMethod Ends
; Store interpreter registers
mov [INSTRUCTIONPOINTER], _IP
mov [STACKPOINTER], _SP
pop _BP
pop _IP
pop _SP
ret
ENDPROC ACTIVATEPRIMITIVEMETHOD
; Send the 0 argument selector #value.
; Optimise for zero arg blocks to bypass message lookup.
BEGINBYTECODE shortSpecialSendValue
mov eax, [_SP] ; Access the receiver
test al, 1
jnz sendMessage ; Its a SmallInteger, send it #value
ASSUME eax:PTR OTE ; EAX is the Oop of the receiving block (we hope)
mov ecx, eax
ASSUME ecx:PTR OTE ; ECX is the Oop of the receiving block (we hope)
mov edx, [eax].m_location ; Load pointer to block into EDX
ASSUME edx:PTR BlockClosure
mov eax, [Pointers.ClassBlockClosure]
cmp eax, [ecx].m_oteClass ; Is it a block?
jne sendMessage ; No, send it #value
cmp [edx].m_info.argumentCount, 0
jne sendMessage
; _SP is pointing at the block (no args), which activateBlock will overwrite with the receiver from the closure.
lea _BP, [_SP+OOPSIZE] ; Set up new frame base pointer for activateBlock (points at [receiver+1])
; To invoke activateBlock: ECX is Oop of Block, EDX is pointer to block
call activateBlock
DispatchByteCode
sendMessage:
SendSelectorNoArgs <Pointers.valueSelector>
ENDBYTECODE shortSpecialSendValue
; Send the 1 argument selector #value.
; Optimise for one arg blocks to bypass message lookup.
BEGINBYTECODE shortSpecialSendValueColon
mov eax, [_SP-OOPSIZE] ; Load receiver block into EAX
test al, 1 ; SmallInteger?
jnz sendMessage ; Yes, skip to send
ASSUME eax:PTR OTE
mov ecx, eax
ASSUME ecx:PTR OTE ; ECX and EAX are now receiver block
mov edx, [eax].m_location ; Load pointer to block into EDX
ASSUME edx:PTR BlockClosure
mov eax, [Pointers.ClassBlockClosure] ; Is it a block
cmp eax, [ecx].m_oteClass
ASSUME eax:NOTHING
jne sendMessage ; No, send it #value
cmp [edx].m_info.argumentCount, 1
jne sendMessage ; Arg. count not one, must fail
; activateBlock expects _BP to be set up
mov _BP, _SP ; _BP points at first (and only) arg
; At this point _BP points at [receiver+1]
; _SP points at TOS
; ecx is the block being activated
; edx points at the block body
call activateBlock
DispatchByteCode
sendMessage:
SendSelectorOneArg <Pointers.valueColonSelector>
ENDBYTECODE shortSpecialSendValueColon
; Send the 2 argument selector #value:value:.
; Optimise for two arg blocks to bypass message lookup.
BEGINBYTECODE shortSpecialSendValueValue
mov eax, [_SP-OOPSIZE*2] ; Load receiver block into EAX
test al, 1 ; SmallInteger?
jnz sendMessage ; Yes, skip to send
ASSUME eax:PTR OTE
mov ecx, eax
ASSUME ecx:PTR OTE ; Copy receiver into ECX
mov edx, [eax].m_location ; Load pointer to block into EDX
ASSUME edx:PTR BlockClosure
mov eax, [Pointers.ClassBlockClosure] ; Is receiver a block
cmp eax, [ecx].m_oteClass
jne sendMessage ; No, send it #value:value:
cmp [edx].m_info.argumentCount, 2
jne sendMessage ; Arg. count not two, must fail
; activateBlock expects pointer to position to store stack frame in BP
lea _BP, [_SP-OOPSIZE] ; _BP should point at first arg, which is at TOS-1
; At this point _BP points at [receiver+1]
; _SP points at TOS
; ecx is the block being activated
; edx points at the block body
call activateBlock
DispatchByteCode
sendMessage:
SendSelectorArgs <Pointers.valueValueSelector>, <2> ; value:value:
ENDBYTECODE shortSpecialSendValueValue
; Activate the block in ECX creating a new frame at _SP in the stack. _BP is set up for new frame
BEGINPROC activateBlock
ASSUME ecx:PTR OTE ; Oop of block to be activiated
ASSUME edx:PTR BlockClosure ; Ptr to the block to be activated
add _SP, OOPSIZE
mov eax, [ecx].m_size ; Load size into eax
and eax, 7fffffffh ; Mask out the immutability bit
ASSUME ecx:NOTHING
; Now push any copied values onto the stack, again no ref. counting needed...
sub eax, SIZEOF BlockClosure
.IF (!ZERO?)
; Push copied values
push eax
shr eax, 2
@@:
mov ecx, [edx].m_copiedValues[eax*OOPSIZE-OOPSIZE]
mov [_SP+eax*OOPSIZE-OOPSIZE], ecx
sub eax, 1
jnz @B
pop eax
add _SP, eax
.ENDIF
movzx eax, [edx].m_info.stackTempsCount
.IF (eax != 0)
; Allocate and initialize the stack temps to nil
mov ecx, [oteNil]
@@:
mov [_SP], ecx
add _SP, OOPSIZE
sub eax, 1
jnz @B
.ENDIF
; _SP now points at the location for the new stack frame
ASSUME _SP:PStackFrame
; eax and ecx free again
ASSUME ecx:NOTHING
ASSUME eax:NOTHING
; edx still pointer to the block
ASSUME edx:PTR BlockClosure
movzx ecx, [edx].m_info.envTempsCount
.IF (ecx == 0)
; No env temps (the common case)
mov eax, [_BP-OOPSIZE] ; Reload the BlockClosure OTE
ASSUME eax:PTR OTE
; The environment ref in this case is the block itself (it has no shared temps),
; We are only really using this slot as a way to keep a ref. to the block to prevent
; it being GC'd and for the debugger. I wonder do we still need to do this?
mov [_SP].m_environment, eax
.ELSE
mov eax, [edx].m_method ; Load method Oop into ECX from block
mov edx, [edx].m_outer ; Load outer for Context::New (block is
mov [_SP].m_method, eax ; Store method down into frame so that it is value should we need to reconcile Zct
call NEWCONTEXT
ASSUME eax:PTR OTE
lea edx, [_SP].m_environment
; The environment ref. in the frame is in this case a real context
mov [_SP].m_environment, eax
AddToZct <a>,<edx>
mov eax, [_SP].m_environment ; Reload env OTE
ASSUME eax:PTR OTE
mov ecx, [eax].m_location
ASSUME ecx:PTR Context
mov edx, [_BP-OOPSIZE] ; Reload the BlockClosure OTE
ASSUME edx:PTR OTE
CountUpObjectIn <d>
mov [ecx].m_block, edx ; Save pointer to block into context (just ref. counted)
mov edx, [edx].m_location
ASSUME edx:PTR BlockClosure ; Ptr to the block to be activated
.ENDIF
; Now overwrite the block itself in the stack with the receiver captured at time of closure
mov eax, [edx].m_receiver
ASSUME eax:Oop
mov [_BP-OOPSIZE], eax
mov eax, [ACTIVEFRAME] ; Load pointer to current active frame into ECX
ASSUME eax:PStackFrame
mov ecx, SMALLINTZERO
ASSUME ecx:Oop
; Overwrite any existing values in the IP and SP slots of the frame
mov [_SP].m_ip, ecx
mov [_SP].m_sp, ecx
; Calc SP of suspended context, its can be calc'd off BP of new frame
; (_BP - 1 slot for receiver, - 1 to offset to last slot of caller frame)
lea ecx, [_BP-(OOPSIZE*2-1)] ; Leave it odd to mark as SmallInteger
mov [ACTIVEFRAME], _SP ; Store down new active frame
mov [eax].m_sp, ecx ; Store SP into suspended frame
; Calculate current _IP to store down in deactivated context
GetIPOffsetUsing <ecx>
lea ecx, [eax+1] ; Create a SmallInteger pointer to current active frame
mov [_SP].m_caller, ecx ; Save down caller frame SmallInteger pointer into stack frame
lea ecx, [_BP+1]
lea _IP, [_IP+_IP+1] ; Convert _IP to SmallInteger
mov [eax].m_ip, _IP ; Saved down _IP at time of suspension
ASSUME eax:NOTHING ; We've now finished with the old frame
mov [_SP].m_bp, ecx
;; Retrieve the new _IP
mov _IP, [edx].m_initialIP ; Get the initial IP from block being activated
mov ecx, [edx].m_method ; Load method Oop into ECX from block
ASSUME ecx:PTR OTE ; Finished with the block
ASSUME edx:NOTHING ; Finished with pointer to block body
;; EDX is now a pointer to home context, _SP points at new frame
mov [_SP].m_method, ecx ; Save down method into frame (as well), no ref count as ref from stack
ASSUME _SP:PTR Oop ; New frame now fully set up
add _SP, SIZEOF StackFrame-OOPSIZE ; _SP should point at last used slot in stack (i.e. last slot of frame)
sar _IP, 1 ; u - Convert initial IP to real integer value
mov ecx, [ecx].m_location ; v - Get pointer to method
ASSUME ecx:PTR CompiledCodeObj
mov [pMethod], ecx
; Set up instruction pointer (currently contains index into bytecodes of block initial IP)
mov edx, [ecx].m_byteCodes
.IF (edx & 1)
ASSUME edx:DWORD
lea edx, [ecx].m_byteCodes
add _IP, edx
.ELSE
ASSUME edx:PTR OTE
;; There is no longer any header on the object body to skip here
add _IP, [edx].m_location
.ENDIF
ASSUME ecx:NOTHING ; Finished with bytecodes Oop
ASSUME edx:NOTHING
dec _IP ; Adjust IP from index to offset
mov [BASEPOINTER], _BP ; ... Save down BP into interpreter global for C++
; Necessary to permit debug break on entry to block
mov eax, [ASYNCPENDING]
test eax, eax
jnz @F ;; If any ansync. signals, go and test process switch
ret
@@:
CallCPP <MSGPOLL>
ret
ENDPROC activateBlock
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Some long and rarely used instructions that are present for completeness
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Long Jumps (triple byte)
;; These are very rarely used
BEGINRARECODE longJumpIfTrue
mov edx, [_SP]
sub _SP, OOPSIZE
sub edx, [oteTrue]
jnz @F
movsx eax, WORD PTR[_IP] ; Sign extend instruction argument word (offset) into EAX
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after double byte of instruction extension)
DispatchByteCode
@@:
add _IP, SIZEOF WORD ; Adjust IP to point at next instruction
cmp edx, OTENTRYSIZE ; false is next Oop after true
jne @F
; it was false, so dispatch next
DispatchByteCode
@@: ; Errorneous attempt to branch on non-boolean object
sub _IP, 1+SIZEOF WORD ;; We'll retry the conditional test if #mustBeBoolean returns
add _SP, OOPSIZE ; Unpop
SendSelectorNoArgs <Pointers.MustBeBooleanSelector>
ENDBYTECODE longJumpIfTrue
BEGINRARECODE longJumpIfFalse
mov edx, [_SP]
sub _SP, OOPSIZE
sub edx, [oteFalse]
jnz @F
movsx eax, WORD PTR[_IP] ; Sign extend instruction argument word (offset) into EAX
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after double byte of instruction extension)
DispatchByteCode
@@:
add _IP, SIZEOF WORD ; Adjust IP to point at next instruction
cmp edx, -OTENTRYSIZE ; true is Oop before false
jne @F ; Not a boolean?
; it was true, so dispatch next
DispatchByteCode
@@: ; Errorneous attempt to branch on non-boolean object
sub _IP, 1+SIZEOF WORD
add _SP, OOPSIZE ; Unpop
SendSelectorNoArgs <Pointers.MustBeBooleanSelector>
ENDBYTECODE longJumpIfFalse
BEGINRARECODE longJumpIfNil
mov edx, [_SP]
sub _SP, OOPSIZE
cmp edx, [oteNil]
jne @F
movsx eax, WORD PTR[_IP] ; Sign extend instruction argument word (offset) into EAX
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after double byte of instruction extension)
DispatchByteCode
@@:
add _IP, SIZEOF WORD ; Adjust IP to point at next instruction
; it was not nil, so dispatch next
DispatchByteCode
ENDBYTECODE longJumpIfNil
BEGINRARECODE longJumpIfNotNil
mov edx, [_SP]
sub _SP, OOPSIZE
cmp edx, [oteNil]
je @F
movsx eax, WORD PTR[_IP] ; Sign extend instruction argument word (offset) into EAX
lea _IP, [_IP+eax+2] ; Offset 0 is the next instruction (after double byte of instruction extension)
DispatchByteCode
@@:
add _IP, SIZEOF WORD ; Adjust IP to point at next instruction
; it was nil, so dispatch next
DispatchByteCode
ENDBYTECODE longJumpIfNotNil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Extended Supersend Instruction (triple byte).
;;
;; Extension specifies argument count (first byte) and selector literal index (second byte)
;; This byte code is very, very, rarely used
BEGINRARECODE longSupersend
IFDEF _DEBUG
FetchByte <d> ; argCount = next byte code
FetchByte ; literal index = next byte code
jmp sendLiteralSelectorToSuper ; Use code shared with singleExtendedSuperBytecode
ELSE
xor ecx, ecx
movzx edx, BYTE PTR[_IP] ; argCount = first byte code
mov cl, BYTE PTR[_IP+1] ; literal index = last byte code
add _IP, 2
jmp sendLiteralSelectorToSuper ; Use code shared with singleExtendedSuperBytecode
ENDIF
ENDBYTECODE longSupersend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Double Extended Supersend Instruction (quad byte).
;;
;; Extension specifies argument count (first byte) and selector literal index (last two bytes)
;; This byte code is very, very, very, rarely used
BEGINRARECODE exLongSupersend
movzx edx, BYTE PTR[_IP] ; argCount = first byte code
movzx ecx, WORD PTR[_IP+1] ; literal index = last byte codes
add _IP, 3
jmp sendLiteralSelectorToSuper ; Use code shared with singleExtendedSuperBytecode
ENDBYTECODE exLongSupersend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Double Extended Send Instruction (quad byte).
;;
;; Extension specifies argument count(first byte) and selector literal index (last two bytes)
BEGINRARECODE exLongSend
mov eax, [pMethod] ; Load pointer to current method
ASSUME eax: PTR CompiledCodeObj
movzx ecx, WORD PTR[_IP+1]
movzx edx, BYTE PTR[_IP]
add _IP, 3
SendLiteralECXinEAXwithEDXArgs
ASSUME eax:NOTHING
ENDBYTECODE exLongSend
BEGINRARECODE longStoreStatic
mov eax, [_SP]
movzx ecx, WORD PTR[_IP]
add _IP, 2
StoreStaticAndDispatch
ENDBYTECODE longStoreStatic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Long Push Instructions (triple byte).
;;
;; Extension is the index (0 based)
BEGINRARECODE longPushConstant
movzx ecx, WORD PTR[_IP]
add _IP, 2
LoadLiteral ecx
PushAndDispatch <a>
ENDBYTECODE longPushConstant
BEGINRARECODE longPushStatic
movzx ecx, WORD PTR[_IP]
add _IP, 2
LoadStatic ecx
PushAndDispatch <a>
ENDBYTECODE longPushStatic
LOuterTempPreamble MACRO
mov cl, BYTE PTR[_IP]
movzx eax, BYTE PTR[_IP+1]
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov edx, [edx].m_environment
mov edx, (OTE PTR[edx]).m_location
ASSUME edx:PTR Context
.WHILE ecx > 0
mov edx, [edx].m_outer
mov edx, (OTE PTR[edx]).m_location
dec ecx
.ENDW
ENDM
BEGINRARECODE longPushOuterTemp
LOuterTempPreamble
; Preload next bytecode in anticipation of dispatch
mov cl, BYTE PTR[_IP+2]
mov eax, [edx].m_tempFrame[eax*OOPSIZE]
IFDEF _DEBUG
add _IP, 2
PushOop <a>
DispatchByteCode
ELSE
add _IP, 3
mov [_SP+OOPSIZE], eax ;; push outer temp var onto stack
ASSUME eax:NOTHING
add _SP, OOPSIZE
jmp byteCodeTable[ecx*4] ;; Transfer control via jump table (will return to dispatchByte)
ENDIF
ENDBYTECODE longPushOuterTemp
BEGINRARECODE longStoreOuterTemp
LOuterTempPreamble
ASSUME edx:PTR Context ; EDX points to the Context containing the temp
ASSUME eax:DWORD ; EAX is pointer to
ASSUME ecx:NOTHING ; ECX is 0
mov ecx, [_SP] ;; Load Oop to store from ToS
lea edx, [edx].m_tempFrame[eax*OOPSIZE]
ASSUME edx:Ptr Oop
CountUpOopIn <c> ;; Must count up as stored into a Context object
mov eax, [edx] ;; Load existing value of temporary
mov [edx], ecx ;; And overwrite with new value
add _IP, 2
CountDownOopIn <a> ;; Must count down Context temps
DispatchByteCode
ENDBYTECODE longStoreOuterTemp
BEGINRARECODE noOp
DispatchByteCode
ENDBYTECODE noOp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Push Active Frame Instruction (single byte)
BEGINRARECODE pushActiveFrame
; Save down the current active process' size based on the current SP
mov eax, _SP
ASSUME eax:DWORD
mov edx, [ACTIVEPROCESS]
ASSUME edx:PTR Process ; EAX is now a pointer to the active context's fields
; "Resize" the active process (i.e. update its size to reflect the current top of stack)
mov ecx, [OTEACTIVEPROCESS]
ASSUME ecx:PTR OTE
sub eax, edx
add eax, OOPSIZE ; size = end - start + 1
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EAX is now a pointer to the active context's fields
mov [ecx].m_size, eax
; Save down _SP of the current active context (may be useful, but only approximate)
lea eax, [_SP+1]
mov [edx].m_sp, eax
ASSUME edx:NOTHING
or edx, 1 ; Make active frame address a SmallInteger pointer
PushAndDispatch <d> ; And push it on to the stack before continuing
ENDBYTECODE pushActiveFrame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is the debug break byte code (0)
BEGINRARECODE break
mov edx, [ACTIVEFRAME]
ASSUME edx:PStackFrame ; EDX is now a pointer to the active context's fields
; Save down _SP of the current active context (may be useful, but only approximate)
mov [STEPPING], FALSE ; Prevent any single step interrupt!
mov ecx, HALTINTERRUPT ; Load interrupt number to send
ResetInputPollCounter
or edx, 1 ; Make it a SmallInteger pointer to the frame
CallCPPAndLoop <SENDVMINTERRUPT>
ASSUME edx:NOTHING
ENDBYTECODE break
; This routine invoked when an unrecognised byte code number is
; encountered, and if you want to know what it is, its index is
; in AL.
BEGINRARECODE _invalidByteCode
int 3 ; Exit to debugger
DispatchByteCode
ENDBYTECODE _invalidByteCode
END ;; Thats all folks
| objectarts/Dolphin | Core/DolphinVM/byteasm.asm | Assembly | mit | 168,031 |
*NAME OC-2 (main_sw - starter)
*TIME:24.00
*EXPRESS
*PAGE:999,LIST
*LIBRA:23
*DISC:705/SYSTEM,LCROSS
*FILE:LIB,67
*FILE:MEM,30,W
*PERSO:67
*TAKE TAPE:67
* *DISC:705/SYSTEM,WORKIN
* *FILE:LCROSS - PERSO ACCEMБЛEP+ЗAГPYЗЧИK+ЭMYЛЯTOP
* *FILE:ASSEM - OПИCAHИE И TEKCTЫ ACCEMБЛEPA И ЗAГPYЗЧИKA
* *FILE:EXMEM - ПAMЯTЬ ДЛЯ MOДYЛEЙ ЗAГPYЗKИ
* *FILE:EML - TEKCTЫ ЭMYЛЯTOPA (ЗOHA=1)
* *FILE:OS - MAKPOCЫ ( 0 ) И TEKCTЫ O C ( 120 )
*CALL FICMEMOR
*NO LIST
*CALL ZMACRO
MAIN_SW:NAME QF
;
;****************************************************
;* *
;* BXOДЫ B OПEPAЦИOHHYЮ CИCTEMY *
;* И BЫXOДЫ ИЗ HEE *
;* OT ПPEPЫBAHИЙ И ЭKCTPAKOДOB *
;* *
;****************************************************
;*
;* AДPEC HAЧAЛA ПEPEKЛЮЧATEЛЯ ПPEPЫBAHИЙ ФИKCИPOBAH
;* B COOTBETCTBYЮЩИX MИKPOПPOГPAMMAX. CEЙЧAC OH
;* PABEH FFF8 0800 ( 514-Й MAT.ЛИCT ). ДAЛEE
;* ДAETCЯ PACПPEДEЛEHИE B OTHOCИTEЛЬHЫX AДPECAX :
;*
;* 00:3F - ПPEPЫBAHИЯ 1:64
;* 40 - ГЛOБAЛЬHЫЙ CEMAФOP ПAMЯTИ
;* 50 - ЭKCTPAKOДЫ HOBOГO PEЖИMA
;* 51 - ЭKCTPAKOДЫ CTAPOГO PEЖИMA (БЭCM-6)
;* 52 - ЭKCTPAKOДЫ И HEKOTOPЫE KOMAHДЫ CBC
;* 53 - ЗAПPEЩEHHЫE KOMAHДЫ (OCH.ФOPMAT)
;* 5F - KOHTPOЛЬHAЯ CYMMA ДИCПETЧEPA
;* 60 - BXOД ПOCЛE OБЩEГO CБPOCA MAШИHЫ
;*
;*
;* K A P T A B И P T Y A Л Ь H O Й П A M Я T И
;* ===============================================
;*
;* AДPEC CTP. HAЗHAЧEHИE ФИЗ.
;* -----:------:--------------------------------:
;* 00000 000 : ПAMЯTЬ БЭCM-ЗAДAЧИ (32K) :
;* 07FFF 01F : :
;* 027 : БЫBШИE ФOPMAЛЬHЫE ЛИCTЫ DD-89 :
;* 028 : KATAЛOГ "БAPAБAHOB" И S-ФAЙЛOB :
;* 029 : ПAMЯTЬ ДЛЯ "MБ" И S-ФAЙЛOB :
;* 7FFFF 1FF : :
;* :--------------------------------:
;* 80000 200 : ПPИHAДЛEЖAЩИЙ ПOЛЬЗOBATEЛЮ :
;* 201 : ЭKЗEMПЛЯP ЭKCTPAKOДOB 50 И 64 :
;* :--------------------------------:
;* 80800 202 : BXOДЫ B CИCTEMY OT ПPEPЫBAHИЙ : 0
;* : ДAЛEE - PEЗИДEHTHAЯ ЧACTЬ OC :
;* : ( C-OБЛACTЬ ) :
;* : ......... :C-1
;* :--------------------------------:
;* : БЛOK ИHИЦИAЛИЗAЦИИ CИCTEMЫ :C+V
;* : ДAЛEE - HEPEЗИДEHT OC, CПИCOK :
;* : ЗAГPYЗKИ(1), ЭKCTPAKOДЫ БЭCM(2):
;* : TECTAY(1), ДA MAЛO ЛИ EЩE ЧTO. :
;* : PAБOЧИE ЛИCTЫ CИCT.ПPOЦECCOB :
;* :--------------------------------:
;* E0000 380 : ЛИЧHЫЙ БYФEPHЫЙ ПYЛ ПPOЦECCA :
;* : БYФEPA ДЛЯ PAБOTЫ C ФAЙЛAMИ. :
;* :--------------------------------:
;* F0000 3C0 : ЗOHA CBЯЗИ C ПYЛЬT.ПPOЦECCOPOM :3C0
;* :--------------------------------:
;* F0C00 3C3 : ПAMЯTЬ ДЛЯ БAЙTOBЫX MACCИBOB : C
;* : ( V-OБЛACTЬ PEЗИДEHTA OC ) :C+V-1
;* :--------------------------------:
;* FE000 3F8 : ПAMЯTЬ ДЛЯ CYГYБO БИTOBЫX ШKAЛ :
;* : (ИCПOЛЬЗYETCЯ HEPEЗИДEHTAMИ) :
;* :--------------------------------:
;* FF800 3FE : ИHФOPMAЦИOHHOE ПOЛE ПPOЦECCA И :
;* : EГO BOЗMOЖHOE ПPOДOЛЖEHИE :
;* FFFFF 3FF :--------------------------------:
;
;
CHEKSUMM:ENTRY QF
;
IFP
;
;........ COCTAB PEЗИДEHTA OC :
; =====================
; CHAЧAЛA OПИCЫBAEM COMMON-БЛOKИ, ЧTOБЫ PAБOЧИE
; ЯЧEЙKИ ПOДПPOГPAMM ПPИXOДИЛИCЬ HA KOHEЦ V-OБЛ.
; COMMON-Ы ГPYЗЯTCЯ HAЧИHAЯ C MAT.AДPECA F0000 И
; B COBOKYПHOCTИ COCTABЛЯЮT V-OБЛACTЬ PEЗИДEHTA.
;
; ЗATEM OПИCЫBAEM ПOДПPOГPAMMЫ, KOTOPЫE COCTABЛЯ-
; ЮT C-OБЛACTЬ. OHИ ГPYЗЯTCЯ C @80800. C METKИ
; "NONRSDNT" HAЧИHAETCЯ HEPEЗИДEHTHAЯ ЧACTЬ.
; ПOCЛEДHИMИ OПИCAHЫ FREE_C - KOHEЦ C-OБЛACTИ
; И FREE_V - KOHEЦ V-OБЛACTИ.
;
ЫЫ_ЫЫ:LCB (65000) ; BЫXOД HA F0000
OБMOЧ
;
IF_DISP:PCB (1024)
INTSTAK:EQU IF_DISP + @1C0
FATA
;
PCW
SEMAF
TPP
TIMESTD:LCB (1) ; BPEMЯ ЗAПYCKA
ATQUE:LCB (QPROC-QCPU-QCPU) ; OЧ. AB-TAЙMEPOB
CODE
;
MAINBLCS:SUBP QF ; Я Д P O
EXTINTER:SUBP QF ; BHEШ.ПPEP.
PROGINT:SUBP QF ; ПPOГP.ПPEP.
STEPINT:SUBP QF ; ШAГOBЫE ПPEP.
INTERMEM:SUBP QF ; ПPEP: 1:4
INTERTIM:SUBP QF ; ПPEP.ПO TAЙMEPY
INT8:SUBP QF
INT10:SUBP QF
INT11:SUBP QF
INT12:SUBP QF
INT13:SUBP QF
INT15:SUBP QF
INT16:SUBP QF
INT19:SUBP QF
INT20:SUBP QF
INT21:SUBP QF
INT22:SUBP QF
INT23:SUBP QF
ERROR:SUBP QF
GIVGROUP:SUBP QF
OЧEPEДЬ:SUBP QF
HEAP:SUBP QF
CREVENT:SUBP QF
KOHCOЛЬ:SUBP QF
CDEF
POPGRUP:SUBP QF
SEMDOWN:SUBP QF
DATE:SUBP QF
DHEX8:SUBP QF
WAITTEST:SUBP QF ; "ЖДY"
SWING:SUBP QF
D_DRIVER:SUBP QF
EXTRACOD:SUBP QF ; ЭKCTPAKOДЫ HOBЫE
BESMEXTR:SUBP QF ; ЭKCTPAKOДЫ CTAPЫE
ERRMACRO:SUBP QF ; ДИAГHOCTИKA
RES_END:CCB (0)
;
RSDNT2:PCCB (0)
STARTER:SUBP QF ; ПYCK ПPOЦECCOPA
TTANAL:SUBP QF ;
NONRSDNT:PCCB (0)
;
FREE_C:PCCB (0) ; KOHEЦ C-OБЛ.
FREE_V:PCB (0) ; KOHEЦ V-OБЛ.
;
GROUP
MODIF
N:EQU 1 ; HOM.ПPEP.
VOL_C:EQU FREE_C-BEGIN>>10
VOL_V:EQU FREE_V-BUZY_V>>10
;
CMD
;
;
; П P E P Ы B A H И Я :
; *********************
;
; ПPOЦECCOP ПEPEKЛЮЧAETCЯ HA 0-Ю ГPYППY PEГИCTPOB
; ПPEЖHEE COCTOЯHИE ЭTИX PEГИCTPOB HECYЩECTBEHHO.
; YCTAHABЛИBAЮTCЯ: БПHП,БBП,PД,POA,БЗO,БЗЗ,ПOП.
; YCTAHABЛИBAЮTCЯ ЗAHOBO CЛEДYЮЩИE PEГИCTPЫ :
;
; TN - HOMEP ПPEPBAHHOГO ПPOЦECCA
; NG - HOMEP AKTИBHOЙ ГPYППЫ EГO PEГИCTPOB
; P1 - KOПИЯ PEГИCTPA PEЖИMOB ПPEPB.ПPOЦECCA
; P2 - KOПИЯ PACШИPEHИЯ PEГИCTPA PEЖИMOB
; RI - MAT.AДPEC KOMAHДЫ, BЫЗBABШEЙ ПPEPЫBAHИE
; PA - ФИЗ.AДPEC KOMAHДЫ, BЫЗBABШEЙ ПPEPЫBAHИE
; IA - MAT.AДPEC OПEPAHДA, BЫЗBABШEГO ПPEPЫBAHИE
; CA - KOД OПEPAЦИИ APБИTPA
; S - YKAЗATEЛЬ CTEKA B PAБ.ПOЛE ПPEPB.ПPOЦECCA.
;
; HOMEPA И ПPИЧИHЫ ПPEPЫBAHИЙ :
; =============================
; (*) - ПPEPЫBAHИЯ OTPAБATЫBAЮTCЯ БEЗ BMEШATEЛЬCTBA OC.
;
; 01 (01) - OTCYTCTBYЮЩИЙ БЛOK ПAMЯTИ
; 02 (02) - MHOГOKPATHAЯ OШИБKA
; 03 (03) - TIME-OUT ПPИ OБPAЩEHИИ K OЗY
; 04 (04) - TIME-OUT ПPИ OБPAЩEHИИ K ШИHE ДAHHЫX
; 05 (05) - ПPOГPAMMHOE ПPEPЫBAHИE
;
; 07 (07) - OTCYTCTBYЮЩИЙ AДPEC ПAMЯTИ
; 08 (08) - OTPИЦATEЛЬHЫЙ HOMEP CTPAHИЦЫ Y KOMAHДЫ
; 09 (09) - OTPИЦATEЛЬHЫЙ HOMEP CTPAHИЦЫ Y OПEPAHДA
; 0A (10) - ПPOГPAMMHAЯ ИHTEPПPETAЦИЯ TEГA KOMAHДЫ
; 0B (11) - ПPOГPAMMHAЯ ИHTEPПPETAЦИЯ TEГA OПEPAHДA
; 0C (12) - ЗAЩИTA AДPECA ПPИ ЧTEHИИ
; 0D (13) - KOHTPOЛЬ KOMAHДЫ
; * 0E (14) - MATEMATИЧECKИЙ AДPEC = 0
; 0F (15) - ЧYЖOЙ PП ПPИ ЧTEHИИ/ЗAПИCИ OПEPAHДA
; 10 (16) - ЧYЖOЙ PП ПPИ BЫБOPKE KOMAHДЫ
; 11 (17) - ЗAЩИTA CTPAHИЦЫ ПO OБPAЩEHИЮ
; 12 (18) - ЗAЩИTA CTPAHИЦЫ ПO ЗAПИCИ
; 13 (19) - ЗAЩИTA BЫБOPKИ KOMAHДЫ
; 14 (20) - ЗAЩИTA ПEPEДAЧИ YПPABЛEHИЯ
; 15 (21) - ЗAЩИTA AДPECA ПPИ ЗAПИCИ
; 16 (22) - ЧYЖOЙ CYMMATOP
; 17 (23) - ЧYЖOЙ OПEPAHД
; * 18 (24) - ЗAПPOC MOДИФИKAЦИИ ПPИOPИTETOB CTPAHИЦ
; * 19 (25) - OCTAHOB ПPИ COBПAДEHИИ AДPECOB (ПП)
; * 1A (26) - TIME-OUT ПPИ БЛOKИPOBKE BHEШ.ПPEPЫBAHИЙ
; 1B (27) - BHEШHИE ПPEPЫBAHИЯ
; * 1C (28) - HALT ПO KOMAHДE ИЛИ ЗAПPOCY OT ПП
; 1D (29) - ШAГOBOE ПPEPЫBAHИE
; * 1E (30) - OБPAЩEHИE БЛOKA CBЯЗИ C ПП
; * 1F (31) - MЛAДШИE PAЗPЯДЫ CB-ЧACOB PABHЫ 0
; * 20 (32) - MЛAДШИE PAЗPЯДЫ CB-TAЙMEPA PABHЫ 0
; 21 (33) - ПEPEПOЛHEHИE
; 22 (34) - ПEPEПOЛHEHИE ПOPЯДKA БЭCM-6
; 23 (35) - ДEЛEHИE HA 0
; 24 (36) - ПEPEПOЛHEHИE ПOЛЯ YПPЯTЫBAHИЯ
; 25 (37) - HEЗAKOHHЫЙ OПEPAHД
; 26 (38) - BЫБOPKA KOMAHДЫ ПO MAT.AДPECY 0
;
;MOZY=80800 ; - MAIN_SW
;
BEGIN:N VTM 1
JMP INTERMEM
:N VTM 2
JMP INTERMEM
:N VTM 3
JMP INTERMEM
:N VTM 4
JMP INTERMEM
:N VTM 5
JMP EXTINTER
:HLT 6 ; - PEЗEPB
IJP
:N VTM 7
JMP ERROR
:N VTM 8
JMP INT8
:N VTM 9
JMP ERROR
:N VTM 10
JMP INT10
:N VTM 11
JMP INT11
:N VTM 12
JMP INT12
:N VTM 13
JMP INT13
:HLT 14 ; - ПCEBДO
IJP
:N VTM 15
JMP INT15
:N VTM 16
JMP INT16
:N VTM 17
JMP ERROR
:N VTM 18
JMP ERROR
:N VTM 19
JMP INT19
:N VTM 20
JMP INT20
:N VTM 21
JMP INT21
:N VTM 22
JMP INT22
:N VTM 23
JMP INT23
:HLT 24 ; - ПCEBДO
IJP
:HLT 25 ; - ПCEBДO
IJP
:HLT 26 ; - ПCEBДO
IJP
:N VTM 27
JMP EXTINTER
:HLT 28
IJP
:N VTM 29
JMP STEPINT
:HLT 30 ; - ПCEBДO
IJP
:HLT 31 ; - ПCEBДO
IJP
:HLT 32 ; - ПCEBДO
IJP
:N VTM 33
JMP ERROR
:N VTM 34
JMP ERROR
:N VTM 35
JMP ERROR
:N VTM 36
JMP ERROR
:N VTM 37
JMP ERROR
:N VTM 38
JMP ERROR
:HLT 39 ; - PEЗEPB
:HLT 40
:HLT 41
:HLT 42
:HLT 43
:HLT 44
:HLT 45
:HLT 46
:HLT 47
:HLT 48
:HLT 49
:HLT 50
:HLT 51
:HLT 52
:HLT 53
:HLT 54
:HLT 55
:HLT 56
:HLT 57
:HLT 58
:HLT 59
:HLT 60
:HLT 61
:HLT 62
:HLT 63
:HLT 64
IJP
;
S_MEM:ATX ; CEMAФOP
ATX ; ПAMЯTИ
;
:ATX 0
ATX @A2
;
:ATX 0 ; ДЛИHA PEЗИДEHTA
ATX RES_END - BEGIN
:ATX 0 ; PAЗMEP C-OБЛ.
ATX FREE_C - BEGIN
:ATX 0 ; PAЗMEP C+V
ATX FREE_V-BUZY_V + FREE_C-BEGIN
;
:ATX 0 ; 45 - ДATA OC
:ATX 0 ; 46:48 - ПOЛHOE
:ATX 0 ; ИMЯ ФAЙЛA
:ATX 0 ; C ДИCПETЧEPOM
;
:ATX 0 ; 49 - PEЗEPB
:ATX 0 ; 4A
:ATX 0 ; 4B
:ATX 0 ; 4C
:ATX 0 ; 4D
:ATX 0 ; 4E
:ATX 0 ; 4F
;
;
; Э K C T P A K O Д Ы :
; *********************
;
:JMP EXTRACOD ; HOBЫE
:JMP BESMEXTR ; CTAPЫE
:JMP BESMEXTR ; CBC
:JMP BESMEXTR ; ЗAПP.KOM.
:ATX ; 54 - PEЗEPB
:ATX ; 55
:ATX ; 56
:ATX ; 57
:ATX ; 58
:ATX ; 59
:ATX ; 5A
;
CHEKSUMM:
UTA
14 VTM FREE_C-BEGIN-1
:14 ARX BEGIN
14 VRM *
AEU -1
13 JAEQ
HLT -1
13 JMP
;
:ATX 0 ; 5F ; - KOHTP.CYMMA
ATX 0
;
; O Б Щ И Й C T A P T C И C T E M Ы :
; =======================================
;
; ПEPBЫM CTAPTYET ПPOЦECCOP C HOMEPOM N=0.
; OH И ПOДГOTABЛИBAET K PAБOTE BCЮ ПAMЯTЬ.
; OCTAЛЬHЫE ПPOЦECCOPЫ ПPИBOДЯT B ПOPЯДOK
; TOЛЬKO CBOИ COБCTBEHHЫE PEГИCTPЫ.
;
; CTAPTOBЫЙ ПPOЦECC ПOЛYЧAET TOT ЖE HOMEP
; (N+QCPU) И TY ЖE ГPYППY PEГИCTPOB (1-Ю),
; ЧTO И ЖДYЩИЙ TECT HA N-M ПPOЦECCOPE.
;
;
:UTA 1<<5
WMOD @1818 ; ГPYППA=1
ATI NG
UTA @F1FC
ASFT -10
NG WMOD PP
SETR PД+БЧOП+БПTЧ+БЧC+БПИHT+БBП+БПTЗ+БЗЗ+БЗO+POA+БПHП
CLRR ББЧ+БППY+PШ+ПOП+БП
UTA 0 ; TEГ PEЗ-TA
NG WMOD PPP
RMOD @1C1A
ATI CP ; N CPU
CP UTA QCPU
WMOD @1819 ; ПPOЦECC = N+QCPU
NG WMOD GRBOSS ; И B ГPYППY
ATI TN
UTA PP_LIST<<10 +@3FF
WMOD REFERS>>10 & @3FF + @400
UTA -1 ; ПOCЛ."ФИЗ.AДP."
WMOD PP_MASK>>10 & @3FF + @400
WMOD @1C15 ; TAЙMEP
ASFT 32+3 ; CBOБ.ГPYППЫ:
WMOD TAIL ; 3:32
CP MSFT -3
CP UTA INTSTAK ; MAГAЗИH
CP MSFT 3 ; ДЛЯ ПPEPЫBAHИЙ
WMOD 15 ;
A+U QCPU<<3
WMOD SPRADR
UTA
14 VTM GRBOSS-TIMER ; MИHИM.
:14 WMOD TIMER ; ПOДГOTOBKA
14 VRM * ; 0-Й ГPYППЫ
WMOD @1802 ; ГAШ.ГPП
CP JMNE ZR
;
; БЛOKИPOBAHИE ПYЛЬT-ПPOЦECCOPA
;
ATX PP_MASK
ATX HEADS
ATX HEADS+1
ATX HEADS+2
ATX HEADS+3
ATX S_MEM
;
; OБHYЛEHИE ГPYПП 2:31, PП, OЗYПC
;
ZR:1 VTM 64-@17FF
CLRR БBП
:1 WMOD @17FF
1 VLM *
;
; ПPИПИCKA PEЗИДEHTA И БЛOKA CBЯЗИ C ПП
;
UTA PP_LIST<<10 +@3FF
WMOD OБM_OЧ>>10 +@400
A+U @400
WMOD OБM_OЧ>>10 +@401
UTA -1
WMOD OБM_OЧ>>10 +@402
2 VTM 1-VOL_C
UTA @2FF ; ЗAПPET ЗAПИCИ
:2 WMOD FREE_C>>10 +@3FF
A+U @400
2 VLM *-1
2 VTM 1-VOL_V
AOU @3FF ; PAЗP.ЗAПИCИ
:2 WMOD FREE_V>>10 +@3FF
A+U @400
2 VLM *-1
CPUSH
13 VTM STARTER
JMP CHEKSUMM
;
END
STARTER:NAME QF
;
PCW
NEW_PRT:SUBP QF
KOHCOЛЬ:SUBP QF
SETQ:SUBP QF
ERRMACRO:SUBP QF
CHEKSUMM:SUBP QF
DATE:SUBP QF
TIME:SUBP QF
WEEKDAY:SUBP QF
VMD
OБMOЧ
CODE
TPP
FATA
TIMESTD:LCB (1) ; BPEMЯ ЗAПYCKA
RES_END:CCB (0)
VOL_C:EQU FREE_C-MAIN_SW>>10
VOL_V:EQU FREE_V-BUZY_V>>10
PSYS
SPORT
IFP
GROUP
MODIF
PCBIT
RRBIT
;
CONST
;
SFATR
;
; TEГИ PEЗYЛЬTATA ДЛЯ CИCT.ПPOЦECCOB:
;
TEGS:HEX 0000 0010 2040 0000
;
CTABLES:
; КЛАССЫ ASCII - СИМВОЛОВ :
; ----------------------------
; 0 : цифры 0-9
; 1 : псевдобуквы ( @, _, ... )
; 2 : большие латинские буквы
; 3 : малые латинские
; 4 : большие русские
; 5 : малые русские
; FF : разделители традиционные (+ - . , скобки...)
; FE : прочие разделители
; FC : псевдографика
;
HEX FEFE FEFE FEFE FEFE
HEX FEFE FEFE FEFE FEFE
HEX FEFE FEFE FEFE FEFE
HEX FEFE FEFE FEFE FEFE
;
HEX FFFF FFFF FFFF FFFF
HEX FFFF FFFF FFFF FFFF
HEX 0000 0000 0000 0000
HEX 0000 FFFF FFFF FFFF
; @ A B ... Z ... _
HEX 0102 0202 0202 0202
HEX 0202 0202 0202 0202
HEX 0202 0202 0202 0202
HEX 0202 02FF FFFF FF01
; ' a b ... z ...
HEX FF03 0303 0303 0303
HEX 0303 0303 0303 0303
HEX 0303 0303 0303 0303
HEX 0303 03FF FFFF FFFF
; А ... Я
HEX 0404 0404 0404 0404
HEX 0404 0404 0404 0404
HEX 0404 0404 0404 0404
HEX 0404 0404 0404 0404
; а ... п ...
HEX 0505 0505 0505 0505
HEX 0505 0505 0505 0505
HEX FCFC FCFC FCFC FCFC
HEX FCFC FCFC FCFC FCFC
;
HEX FCFC FCFC FCFC FCFC
HEX FCFC FCFC FCFC FCFC
HEX FCFC FCFC FCFC FCFC
HEX FCFC FCFC FCFC FCFC
; р ... я ...
HEX 0505 0505 0505 0505
HEX 0505 0505 0505 0505
HEX FEFE FEFE FEFE FEFE
HEX FEFE FEFE FEFE FEFE
;
;
; ПEPEKOДИPOBOЧHЫE TAБЛИЦЫ :
;
; ПPЯMЫE TAБЛИЦЫ C BXOДOM ПO KOДY ИCXOДHOГO БAЙTA
; HECYЩECTBYЮЩИE CИMBOЛЫ ЗAMEHЯЮTCЯ HA CИMBOЛ "!"
; KOДИPOBKA MKБ COBПAДAET C AЛЬTEPHATИBHЫM ASCII.
;
; I. M K Б ---> I S O
; ================
; 000-137 (1:1)
HEX 0001 0203 0405 0607
HEX 0809 0A0B 0C0D 0E0F
HEX 1c11 1213 1415 1617
HEX 1619 1A1B 1C1D 261e
;
HEX 2021 2223 2425 2627
HEX 2829 2A2B 2C2D 2E2F
HEX 3031 3233 3435 3637
HEX 3839 3A3B 3C3D 3E3F
;
HEX 4041 4243 4445 4647
HEX 4849 4A4B 4C4D 4E4F
HEX 5051 5253 5455 5657
HEX 5859 5A5B 5C5D 5E5F
; 140-177 (MAЛЫE ЛAT.)
HEX 2741 4243 4445 4647
HEX 4849 4A4B 4C4D 4E4F
HEX 5051 5253 5455 5657
HEX 5859 5A5B 5C5D 5E5F
; 200-237 (БOЛЬШИE PYCCKИE)
HEX 4162 4267 6445 767A
HEX 696A 4B6C 4D48 4F70
HEX 5043 5459 6658 637E
HEX 7B7D 7879 787C 6071
; 240-277 (MAЛЫE PYCCKИE 1)
HEX 4162 4267 6445 767A
HEX 696A 4B6C 4D48 4F70
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 211f
; 300-337 (ПCEBДOГPAФИKA)
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
; 340-377 (MAЛЫE PYCCKИE 2)
HEX 5043 5459 6658 637E
HEX 7B7D 7879 787C 6071
HEX 4545 3E3C 2121 2121
HEX 2121 2121 2121 2121
;
; II. I S O ---> M K Б
; =================
; 000-137 (1:1)
HEX 0001 0203 049a 2a07
HEX 0809 0A0B 0C0D f3f2
HEX 2711 0013 147E 1845
HEX 23f8 f627 10f0 1fbf
;
HEX 2021 2223 2425 fe27
HEX 2829 2A2B 2C2D 2E2F
HEX 3031 3233 3435 3637
HEX 3839 3A3B 3C3D 3E3F
;
HEX 4041 4243 4445 4647
HEX 4849 4A4B 4C4D 4E4F
HEX 5051 5253 5455 5657
HEX 5859 5A5B 5C5D 5E5F
; 140-177 (PYCCKИE-->БOЛЬШИE)
HEX 9E41 8196 8445 9483
HEX 5888 894B 8B4D 484F
HEX 8F9F 5043 5459 8642
HEX 9C9B 8798 9D99 977F
; 200-377 (OTCYTCTBYЮT)
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
; III. Г O C T ---> M K Б
; ====================
; 000-037 (ЦИФPЫ И ЗHAKИ)
;
HEX 3031 3233 3435 3637
HEX 3839 2B2D 2F2C 2E20
HEX 4518 2829 2A3D 3B5B
HEX 5D2A 2727 233C 3E3A
; 040-077 (PYCCKИE И "D")
HEX 4181 4283 8445 8687
HEX 8889 4B8B 4D48 4F8F
HEX 5043 5459 9458 9697
HEX 9899 9B9C 9D9E 9F44
; 100-137 (ЛATЫHЬ И ЗHAKИ)
HEX 4647 494A 4C4E 5152
HEX 5355 5657 5A5C f3f2
HEX 1f26 10BF f6f0 2524
HEX B3c4 5F21 229A 4027
; 140-377 (OTCYTCTBYЮЩИE)
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
HEX 2121 2121 2121 2121
;
;
; IV. I S O ---> Г О С Т
; ====================
;
; управляющие символы:
HEX 0f0f 0f0f 0f3b 140f
HEX 0f0f 7e0f 0f7e 4e4f
HEX 1b0f 0f0f 0f4d 1110
HEX 1c5e 541b 5255 5053
; 040-077 (ЦИФРЫ И ЗНАКИ)
HEX 0F5b 5c0f 5756 511b
HEX 1213 190A 0d0b 0e0c
HEX 0001 0203 0405 0607
HEX 0809 1f16 1d15 1e5b
; 100-137 (ЛATЫHЬ И ЗHAKИ)
HEX 5720 2231 3f25 4041
HEX 2d42 432a 442c 452e
HEX 3046 4748 3249 4a4b
HEX 3533 4c17 0f18 595a
; 140-177 (РУССКИЕ БУКВЫ)
HEX 3d20 2136 2425 3423
HEX 3528 292a 2b2c 2d2e
HEX 2f3e 3031 3233 2622
HEX 3b3a 2738 3c39 370f
;
CMD
;
;MOZY=81400 ; - STARTER
;
; OБHYЛEHИE ПAMЯTИ. ЗAOДHO BЫЯCHИM EE PAЗMEP.
;
STARTER:UTA -1
WMOD TIMER ; 0-group
CP JMNE READYMEM
UTA
ATX S_MEM
ATX OSCSUM
XTA NEWCSUM ; ДЛЯ CYMMИPO-
UTY 9 ; BAHИЯ TOЛЬKO
TTX CHEKSUMM ; PEЗИДEHTA
CPUSH
NEWCSUM:UTA
14 VTM RES_END-MAIN_SW-1
:14 ARX MAIN_SW
14 VRM *
AEU -1
ATX OSCSUM
;
; HNDLSC1 - ШKAЛA "UN", OCTABШИXCЯ
; OTKPЫTЫMИ ПPИ ПEPEBЫЗOBE CИCTEMЫ.
;
1 VTM VOL_C - 1023+64
2 VTM 3
:XTA SFATR+7
AEX SF_ATR+7
:JANE *+1 ; 1-Й BЫЗOB
2 UTC HNDLSC
:XTA
2 ATX HNDLSC1
:2 VRM *-3
2 VTMF TEMPO ; BPEM.ШKAЛA
2 UTM VOL_C
UTA NOMEM ; ПEPEXBAT
WMOD PAПY ; ПPEP: 1-4
UTA -1
ATX TEMPO
LZPAG:1 UTA 1023-64
ASFT -10
AOU @3FF
WMOD @401 ; 1 MAT.ЛИCT
UTA
UTY
14 VTM 1023
:14 TTX 1024
14 VRM *
WMOD @401
2 SETF ; ЛИCT ECTЬ
ELZPAG:2 UTM 1
1 VLM LZPAG
UTA
WMOD @401
WMOD PAПY
;
; ИHИЦИAЛИЗAЦИЯ БЛOKA CBЯЗИ C П П :
;
2 VTM 1023
:2 ATX REFERS
2 VRM *
2 VTM 2-MAXJOB
15 VTM REFERS
:A+U 1
2 ATB QUE<<3 +MAXJOB-2
2 VLM *-1
UTA HEADS-REFERS
UTS QUE-REFERS
UTS JOB-REFERS
UTS CON_IN-REFERS
UTS CON_OUT-REFERS
UTS LO
UTS
ATX ASTIMER
;
; ШKAЛY ПAMЯTИ - HA CBOE MECTO
;
1 VTM 15
MOVSCM:1 XTA TEMPO
1 ATX SC_MEM
:JAEQ *+3
2 JMNE *+2
1 MTJ 2
2 MSFT -6
:UTA
1 ATX TEMPO
:1 VRM MOVSCM
2 UTA 64
ATX QPAGE ; ЧИСЛО ЛИСТОВ
2 UTA 63
ATX RES_PAGE ; РЕЗЕРВ
JMP ITPR
;
NOMEM:2 CLRF ; ЛИCTA HET !
UTA NOMEM
WMOD PAПY ; ПOДЗAKAЗ
JMP ELZPAG
;
; HAЧAЛЬHAЯ TAБЛИЦA ПPИOPИTETOB ПPOЦECCOB :
; (Y ПEPBЫX QCPU ПPOЦECCOB OHИ HYЛEBЫE !)
;
ITPR:UTA
1 VTM QPROC-QCPU-1
:A+U @10000
1 ATX TABPRT+QCPU
1 VRM *-1
1 VTM LAST_SYS-N_WINDOW
:1 XTA TABPRT+N_WINDOW
AON 64-51 ; KЛACC = 4
1 ATX TABPRT+N_WINDOW
1 VRM *-1
;
; ПPИBЯЗKA ЖДYЩИX TECTOB K ПPOЦECCOPAM :
;
1 VTM QCPU-1
:1 UTA 1
1 ATB NCPU+N_WAIT
UTA 1
1 ATB NGROUP+N_WAIT
1 VRM *-2
;
; ИHИЦИAЛИЗAЦИЯ YПPABЛЯЮЩИX CЛOB :
;
15 VTM PCW
1 VTM QCPU-1
NTA IF_ABS
:15 ATX ; ПPOЦECCOPЫ
1 VRM *
RMOD IF_DISP>>10 + @400
AAU @7FC00
A+U @200
AON P_SYST
AON B_BRAN
1 VTM LAST_SYS-N_WAIT
:15 ATX
A+U 64
1 VRM *-1
;
; ИHИЦИAЛИЗAЦИЯ PAБOЧИX OБЛACTEЙ ИП ДИCПETЧEPA
;
1 VTM LAST_SYS-N_WAIT
IFINIT:1 XTA PCW+QCPU
AAU @3FF
A+U IF_DISP
ATI 2
UTA -1
2 ATX 1 ; TAЙMEP
2 UTA 32
AAX =H0000 0000 FFFF FFFF
2 ATX 2 ; PAПY
2 UTA 4
ASFT -32
2 AOX 2
2 ATX 2 ; SPRADR
2 UTA 32-6
ASFT -32
2 ATX 16+7 ; И15
NTA 32-PД
AON 32-POA
14 VTMB TEGS
1 J+M 14
14 AOB ; + TEГ PEЗ-TA
2 ATX 16+9 ; PP,PPP
1 XTA ADR
2 ATX 16+8 ; CЧAC
1 VRM IFINIT
JMP IFINIT1
;
ADR:15 REF WAITTEST
:15 REF WAITTEST
; ECЛИ QCPU>2 - ДOБABИTЬ ЗДECЬ ЖДYЩИX TECTOB !!!
:15 REF NEW_PRT
:15 REF SWING
:15 REF D_DRIVER
:15 REF TTANAL
;
A2S:15 REF RETSTEC
15 REF SAVREG+16
;
;
; ИHИЦИAЛИЗAЦИЯ OБЩEЙ ЧACTИ IF_DISP:
;
IFINIT1:
TN ПPИП
XTA =HFFFF FFFF 0000 0000
ATX IFTIMER
XTA A2S
ATX ASTEC
XTA =H7FFF FFFF 0000 0000
ATX KVANT
UTA ERRMACRO
1 VTM 63
:1 ATH VECTOR<<1
1 VRM *
UTA @FFF00
1 VTM -5
:1 ATX TQUE+5
A+U 1
1 VLM *-1
;
; HAЧ.COCT. TMP,TPP COOTBETCTBYЮT ПPИПИCKE
;
1 VTM @3FF
INITMP:1 RMOD @400
ASFT 8
ASFT -2
1 ATQ DTMP<<2
ASFT 4
ATI W
A-L QPAGE
JAGE EINITMP
1 RMOD @400
AAU @300
ATI NP
ITA 1
ASFT -16
NP AOU @FF
W ATH TPP<<1
EINITMP:1 VRM INITMP
; HEPEЗИДEHTЫ + LOADLIST + ЭKCTPAKOДЫ БЭCM + TECT
UTA 8
NP VTM NONRSDNT>>10 & @3FF
1 VTM WMSP-NONRSDNT>>10 -1
:NP ATQ DTMP<<2
NP UTM 1
1 VRM *-1
; PAБOЧИE ЛИCTЫ CИCTEMHЫX ПPOЦECCOB
UTA @F ; OHИ ЛИЧHЫE!
1 VTM LAST_SYS
NP VTM WSPAG
:NP ATQ DTMP<<2
NP UTM 1
1 VRM *-1
; Имя корневой директории :
XTA ="D:\BESM6"
ATX MAIN_DIR
XTA =Z"\"
ATX MAIN_DIR+1
;
; HAЧAЛЬHOE COCTOЯHИE OЧEPEДИ ГOTOBЫX ПPOЦECCOB
;
UTA N_WAIT
ATB RDQUE
NP VTM N_SWING+1
RDQ0:NP UTM -1
NP XTA PCW
AON READY_
NP ATX PCW
I VTM
RR VTM RDQ0
ITA NP
AEU N_WAIT
JANE SETQ
;
; ПEPEПИCЬ TAБЛИЦ KOДИPOBOK :
;
1 VTM 128+15
:1 XTA CTABLES
UTY 8 ; ЗAПPET ЗAПИCИ
1 TTX CODE
1 VRM *-1
;
; ATPИБYTЫ CПEЦ-ФAЙЛOB :
;
1 VTM 7
:1 XTA SF_ATR
1 ATX SFATR
1 VRM *-1
;
; GET DATE AND TIME FROM IBM/PC
; RETURN IBM/PC HANDLES 6-11 :
;
1 VTMF HNDLSC1
XTA =H0102 0000 0000 0000
AOU TEMPO-MAIN_SW
ATX JOB
XTA =H0084 0006 0000 0000
ATX JOB+1
UTA
ATX PP_MASK
ATB QUE<<3 +2
XTA =Z"CLOCK$"
ATX TEMPO
XTA MAIN_SW+@1A
ATX OLDVECT
XTA NEWVECT
UTY 9
TTX MAIN_SW+@1A
CPUSH
UTA 1
13 VJM TODIS
UTA 3
13 VJM TODIS
BTA JOB<<3 +2
A+I 1 ; ЭTOT ФAЙЛ
ATI 13 ; TOЖE OTMETИM
13 SETF ; B HNDLSC !
13 VTMB TEMPO
13 BTA 4
ATI 3 ; CEKYHДЫ
13 BTA 1
ASFT -8
13 AOB ; ДEHЬ
A+U 18993
A*U 24
ATI 14
13 BTA 3 ; ЧACЫ
A+I 14
A*U 60
ATI 14
13 BTA 2 ; MИHYTЫ
A+I 14
A*U 60
A+I 3
A*L =1000000
ATX TIMESTD
AEU -1 ; ПOЛH.ВРЕМЯ
ATX CLOCK ; (B MKCEK.)
UTA
ATX TEMPO
;
2 VTM 255
13 VTM ERHAND
RHAND:2 UTC
1 FTA
13 JAEQ
2 UTC
1 CLRF ; - ГAШEHИE
ITA 2
ATB JOB<<3 +2
UTA
;
TODIS:ATB JOB<<3 +8 ; KOП
UTA @80
ATB JOB<<3 +3 ; READY
UTA
WMOD @1802
14 VTM
UTA 1
ATB HEADS<<3 +2
:14 XTA JOB
14 AAN 64-39
14 JAEQ *-1
14 UTA
14 ATB HEADS<<3 +2
14 WMOD @1802
14 ATX PPINF
13 JMP
OLDVECT:ATX
NEWVECT:UTA
JMP *+1
:WMOD @1802
CPUSH
IJP
;
ERHAND:2 VRM RHAND
XTA OLDVECT
UTY 9
TTX MAIN_SW+@1A
UTA 3
ATB QUE<<3 +2
UTA @E
ATX PP_MASK
CPUSH
;
;
; CTPYKTYPA CПИCKOB ПPИOPИTETOB ФИЗ.ЛИCTOB:
;
; 1000:13FF 1400:17FF
; OЗYПC-0 OЗYПC-1
; :-----------:-----------:
; 0 : MINP( L ) : MAXP( F ) :
; :-----------:-----------:
; 1 : NC ( 0 ) : 0 :
; :-----------:-----------:
; : 0 ....... 0 :
; :-----------:-----------:
; F : 0 : F+1 :
; :-----------:-----------:
; F+1: F : F+2 :
; :-----------:-----------:
; F+2: F+1 : F+3 :
; :-----------:-----------
; ...........
; :-----------:-----------:
; L-1: L-2 : L :
; :-----------:-----------:
; L : L-1 : 0 :
; :-----------:-----------:
; ЗДECЬ F - HOMEP ПEPBOГO CBOБOДHOГO ФИЗ.ЛИCTA,
; L - HOMEP ПOCЛEДHEГO CYЩECTBYЮЩEГO ФИЗ.ЛИCTA
; ПPOЧИE CЛOBA OЗYПC ЗAПOЛHEHЫ HYЛЯMИ.
;
;
; ИHИЦИAЛИЗAЦИЯ TAБЛИЦ ФИЗ.ПAMЯTИ
; ЛИCTЫ, ЗAHЯTЫE PEЗИДEHTOM, ИЗЫMAЮTCЯ ИЗ ШKAЛЫ
;
READYMEM:
14 VTMF SC_MEM
1 VTM NONRSDNT-MAIN_SW>>10 -1
:1 UTC
14 CLRF
1 VRM *-1
1 VTM VOL_V -1
:1 UTC VOL_C
14 CLRF
1 VRM *-1
14 CLRF PP_LIST
14 CLRF PP_LIST+1
WTC QPAGE
5 VTM -1
2 VTM
3 VTM
;
LPAG:14 FTA
JANE FREE
3 HTA TPP<<1
:AON 64-15 ; - ФИKCAЦИЯ
CP JMEQ *+3 ; БЫЛ "0"
3 AEH TPP<<1
JAEQ ELPAG ; HE ИЗM.
3 HTA TPP<<1
HLT 1 ;
:3 ATH TPP<<1
JMP ELPAG
;
FREE:ITA 1
ASFT -10
2 WMOD @1000 ; LOW
UTA
3 ATH TPP<<1
ITA 3
ASFT -10
2 WMOD @1400 ; HIGH
2 MTJ 1
3 MTJ 2
ELPAG:3 UTM 1
14 UTM 1
5 VRM LPAG
ITA 1
ASFT -10
2 WMOD @1000
ITA 2
ASFT -10
WMOD @1000 ; MINP
UTA
2 WMOD @1400
WMOD PAПY
;
CPUSH
TN ПPИП
15 VTM BUF
XTA ="'@0A''@0D'OC ДYБ"
XTS ="HA OT "
XTS OSDATE
ITS CP
ASFT -16
AOX =". ЦП-0. "
XTS ="CEГOДHЯ "
UTS -1
RR VJM WEEKDAY
UTS -1
RR VJM DATE
UTS -1
RR VJM TIME
ASFT 8
AAU @F0000
AOX =" '0''0''0''0''0' "
XTS ="Озу:0000"
15 MTJ I
I MSFT -3
XTS QPAGE
J VTM 3
TODEC4:A/U 10
15 ATX
I BTA 7
AOY
I STB 7
I UTM -1
J VRM TODEC4
UTA @0D0A
ASFT -48
15 ATX
I VTM BUF
RR VJM KOHCOЛЬ ; j=0 !!!
UTA 6 ; YXOД B "ЖДY"
PINT
;
TEMPO:ATX ; 16*24 = 1024
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX ; 9
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
HNDLSC1:ATX ; 4*64 = 256
ATX
:ATX
ATX
:ATX
ATX
:ATX
ATX
;
END
*END F
| besm6/micro-besm | os/os2.asm | Assembly | mit | 26,575 |
.rsset $0010
game_state: .rs 1 ; x10 Game state
game_UNUSED: .rs 1 ; x11
game_scroll: .rs 2 ; x12 X or Y scroll position within a zone
game_zone: .rs 1 ; x14 Zone ID currently in
game_zone_screen: .rs 1 ; x15 Screen to span in the zone. Used only for loading
game_zone_dir: .rs 1 ; x16 Zone direction
game_zone_size: .rs 1 ; x17 Zone size, starting at x,y going in direction
game_zone_pos: .rs 2 ; x18 Zone position in world map
game_zone_pData: .rs 2 ; x1A Pointer to zone data
game_zone_pTiles0: .rs 2 ; x1C Pointer to zone tiles data
game_zone_pTiles1: .rs 2 ; x1E Pointer to zone tiles data
game_zone_pTiles2: .rs 2 ; x20 Pointer to zone tiles data
game_zone_pTiles3: .rs 2 ; x22 Pointer to zone tiles data
game_zone_palette: .rs 16 ; x24 Currently used palette
game_pPalettes: .rs 2 ; x34 All palettes pointer. 32 x 4 colours
GAME_STATE_LOADING_SECTION .func 0
GAME_STATE_PLAY .func 0
.bank 0
.include "src/tiles.asm"
;-----------------------------------------------------------------------------------------
; Initialize method for the game
;-----------------------------------------------------------------------------------------
OnInit:
pha
jsr ppu_Off ; Begin loading
lda #5 ; We start at section 0
sta game_zone
lda #0 ; In screen 0
sta game_zone_screen
jsr tiles_loadSection
jsr ppu_On ; Done loading
LOAD_ADDR game_zone_palette, tmp1 ; Default palette
jsr ppu_SetPal0
LOAD_ADDR palWorld1_sprites, tmp1
jsr ppu_SetPal1
lda #BG_PATTERN1() ; Our background tiles are on the second pattern
jsr ppu_SetBGPattern
pla
rts
;-----------------------------------------------------------------------------------------
; Game main loop. This is called every frame by the engine
;-----------------------------------------------------------------------------------------
.bank 0
OnFrame:
;lda game_scroll ; Scroll X 1 per frame
;clc
;adc #1
;sta game_scroll
;sta $00
;lda game_scroll + 1
;adc #0
;sta game_scroll + 1
;sta $01
;jsr ppu_SetScrolling
rts
;-----------------------------------------------------------------------------------------
; Include game data
;-----------------------------------------------------------------------------------------
.include "src/data.asm"
| Daivuk/NESEngine | src/game.asm | Assembly | mit | 2,555 |
.data # Program at 3.1
.byte 102 # StringLiteral at 14.13
.byte 117 # StringLiteral at 14.13
.byte 110 # StringLiteral at 14.13
.byte 0 # StringLiteral at 14.13
.word CLASS_String # StringLiteral at 14.13
.word 2 # StringLiteral at 14.13
.word -3 # StringLiteral at 14.13
strLit_16: # StringLiteral at 14.13
.byte 32 # StringLiteral at 20.22
.byte 0 # StringLiteral at 20.22
.byte 0 # StringLiteral at 20.22
.byte 0 # StringLiteral at 20.22
.word CLASS_String # StringLiteral at 20.22
.word 2 # StringLiteral at 20.22
.word -1 # StringLiteral at 20.22
strLit_51: # StringLiteral at 20.22
.byte 10 # StringLiteral at 22.18
.byte 0 # StringLiteral at 22.18
.byte 0 # StringLiteral at 22.18
.byte 0 # StringLiteral at 22.18
.word CLASS_String # StringLiteral at 22.18
.word 2 # StringLiteral at 22.18
.word -1 # StringLiteral at 22.18
strLit_59: # StringLiteral at 22.18
.byte 10 # StringLiteral at 36.23
.byte 0 # StringLiteral at 36.23
.byte 0 # StringLiteral at 36.23
.byte 0 # StringLiteral at 36.23
.word CLASS_String # StringLiteral at 36.23
.word 2 # StringLiteral at 36.23
.word -1 # StringLiteral at 36.23
strLit_100: # StringLiteral at 36.23
# ENTER NODE # Call at 0.0
# ENTER NODE # NewObject at 0.0
subu $sp, $sp, 4 # NewObject at 0.0
sw $zero, ($sp) # NewObject at 0.0
# EXIT NODE # NewObject at 0.0
jal fcn_4_main # Call at 0.0
# EXIT NODE # Call at 0.0
# ENTER NODE # Call at 5.19
# ENTER NODE # NewObject at 5.9
subu $sp, $sp, 4 # NewObject at 5.9
sw $zero, ($sp) # NewObject at 5.9
# EXIT NODE # NewObject at 5.9
jal fcn_103_run # Call at 5.19
# EXIT NODE # Call at 5.19
# ENTER NODE # IntegerLiteral at 13.13
subu $sp, $sp, 8 # IntegerLiteral at 13.13
sw $s5, 4($sp) # IntegerLiteral at 13.13
li $t0, 3 # IntegerLiteral at 13.13
sw $t0, ($sp) # IntegerLiteral at 13.13
# EXIT NODE # IntegerLiteral at 13.13
# ENTER NODE # StringLiteral at 14.13
subu $sp, $sp, 4 # StringLiteral at 14.13
la $t0, strLit_16 # StringLiteral at 14.13
sw $t0, ($sp) # StringLiteral at 14.13
# EXIT NODE # StringLiteral at 14.13
# ENTER NODE # LocalVarDecl at 15.18
# ENTER NODE # IntegerLiteral at 15.22
subu $sp, $sp, 8 # IntegerLiteral at 15.22
sw $s5, 4($sp) # IntegerLiteral at 15.22
li $t0, 0 # IntegerLiteral at 15.22
sw $t0, ($sp) # IntegerLiteral at 15.22
# EXIT NODE # IntegerLiteral at 15.22
# EXIT NODE # LocalVarDecl at 15.18
# ENTER NODE # LocalVarDecl at 16.21
# EXIT NODE # LocalVarDecl at 16.21
# ENTER NODE # LocalVarDecl at 17.17
# ENTER NODE # IntegerLiteral at 17.21
subu $sp, $sp, 8 # IntegerLiteral at 17.21
sw $s5, 4($sp) # IntegerLiteral at 17.21
li $t0, 78 # IntegerLiteral at 17.21
sw $t0, ($sp) # IntegerLiteral at 17.21
# EXIT NODE # IntegerLiteral at 17.21
# EXIT NODE # LocalVarDecl at 17.17
# ENTER NODE # IntegerLiteral at 18.21
subu $sp, $sp, 8 # IntegerLiteral at 18.21
sw $s5, 4($sp) # IntegerLiteral at 18.21
li $t0, 0 # IntegerLiteral at 18.21
sw $t0, ($sp) # IntegerLiteral at 18.21
# EXIT NODE # IntegerLiteral at 18.21
# ENTER NODE # Call at 19.13
# ENTER NODE # This at 19.13
subu $sp, $sp, 4 # This at 19.13
sw $s2, ($sp) # This at 19.13
# EXIT NODE # This at 19.13
# ENTER NODE # Plus at 19.23
lw $t0, ($sp) # Plus at 19.23
lw $t1, 8($sp) # Plus at 19.23
addu $t0, $t0, $t1 # Plus at 19.23
addu $sp, $sp, 8 # Plus at 19.23
sw $t0, ($sp) # Plus at 19.23
# EXIT NODE # Plus at 19.23
jalprintInt_Lib # Call at 19.13
# EXIT NODE # Call at 19.13
# ENTER NODE # Call at 20.13
# ENTER NODE # This at 20.13
subu $sp, $sp, 4 # This at 20.13
sw $s2, ($sp) # This at 20.13
# EXIT NODE # This at 20.13
# ENTER NODE # StringLiteral at 20.22
subu $sp, $sp, 4 # StringLiteral at 20.22
la $t0, strLit_51 # StringLiteral at 20.22
sw $t0, ($sp) # StringLiteral at 20.22
# EXIT NODE # StringLiteral at 20.22
jalprintStr_Lib # Call at 20.13
# EXIT NODE # Call at 20.13
# ENTER NODE # Plus at 15.33
# ENTER NODE # IntegerLiteral at 15.33
subu $sp, $sp, 8 # IntegerLiteral at 15.33
sw $s5, 4($sp) # IntegerLiteral at 15.33
li $t0, 1 # IntegerLiteral at 15.33
sw $t0, ($sp) # IntegerLiteral at 15.33
# EXIT NODE # IntegerLiteral at 15.33
lw $t0, ($sp) # Plus at 15.33
lw $t1, 8($sp) # Plus at 15.33
addu $t0, $t0, $t1 # Plus at 15.33
addu $sp, $sp, 8 # Plus at 15.33
sw $t0, ($sp) # Plus at 15.33
# EXIT NODE # Plus at 15.33
# ENTER NODE # Call at 22.9
# ENTER NODE # This at 22.9
subu $sp, $sp, 4 # This at 22.9
sw $s2, ($sp) # This at 22.9
# EXIT NODE # This at 22.9
# ENTER NODE # StringLiteral at 22.18
subu $sp, $sp, 4 # StringLiteral at 22.18
la $t0, strLit_59 # StringLiteral at 22.18
sw $t0, ($sp) # StringLiteral at 22.18
# EXIT NODE # StringLiteral at 22.18
jalprintStr_Lib # Call at 22.9
# EXIT NODE # Call at 22.9
# ENTER NODE # Plus at 23.10
# ENTER NODE # IntegerLiteral at 23.10
subu $sp, $sp, 8 # IntegerLiteral at 23.10
sw $s5, 4($sp) # IntegerLiteral at 23.10
li $t0, 1 # IntegerLiteral at 23.10
sw $t0, ($sp) # IntegerLiteral at 23.10
# EXIT NODE # IntegerLiteral at 23.10
lw $t0, ($sp) # Plus at 23.10
lw $t1, 8($sp) # Plus at 23.10
addu $t0, $t0, $t1 # Plus at 23.10
addu $sp, $sp, 8 # Plus at 23.10
sw $t0, ($sp) # Plus at 23.10
# EXIT NODE # Plus at 23.10
# ENTER NODE # Plus at 24.10
# ENTER NODE # IntegerLiteral at 24.10
subu $sp, $sp, 8 # IntegerLiteral at 24.10
sw $s5, 4($sp) # IntegerLiteral at 24.10
li $t0, 1 # IntegerLiteral at 24.10
sw $t0, ($sp) # IntegerLiteral at 24.10
# EXIT NODE # IntegerLiteral at 24.10
lw $t0, ($sp) # Plus at 24.10
lw $t1, 8($sp) # Plus at 24.10
addu $t0, $t0, $t1 # Plus at 24.10
addu $sp, $sp, 8 # Plus at 24.10
sw $t0, ($sp) # Plus at 24.10
# EXIT NODE # Plus at 24.10
# ENTER NODE # LocalVarDecl at 31.13
# ENTER NODE # NewObject at 31.17
subu $sp, $sp, 4 # NewObject at 31.17
sw $zero, ($sp) # NewObject at 31.17
# EXIT NODE # NewObject at 31.17
# EXIT NODE # LocalVarDecl at 31.13
# ENTER NODE # Call at 32.11
# ENTER NODE # IntegerLiteral at 32.16
subu $sp, $sp, 8 # IntegerLiteral at 32.16
sw $s5, 4($sp) # IntegerLiteral at 32.16
li $t0, 33 # IntegerLiteral at 32.16
sw $t0, ($sp) # IntegerLiteral at 32.16
# EXIT NODE # IntegerLiteral at 32.16
jal fcn_73_test # Call at 32.11
# EXIT NODE # Call at 32.11
# ENTER NODE # Plus at 34.10
# ENTER NODE # IntegerLiteral at 34.10
subu $sp, $sp, 8 # IntegerLiteral at 34.10
sw $s5, 4($sp) # IntegerLiteral at 34.10
li $t0, 1 # IntegerLiteral at 34.10
sw $t0, ($sp) # IntegerLiteral at 34.10
# EXIT NODE # IntegerLiteral at 34.10
lw $t0, ($sp) # Plus at 34.10
lw $t1, 8($sp) # Plus at 34.10
addu $t0, $t0, $t1 # Plus at 34.10
addu $sp, $sp, 8 # Plus at 34.10
sw $t0, ($sp) # Plus at 34.10
# EXIT NODE # Plus at 34.10
# ENTER NODE # Call at 35.14
# ENTER NODE # This at 35.9
subu $sp, $sp, 4 # This at 35.9
sw $s2, ($sp) # This at 35.9
# EXIT NODE # This at 35.9
jalprintInt_Lib # Call at 35.14
# EXIT NODE # Call at 35.14
# ENTER NODE # Call at 36.14
# ENTER NODE # This at 36.9
subu $sp, $sp, 4 # This at 36.9
sw $s2, ($sp) # This at 36.9
# EXIT NODE # This at 36.9
# ENTER NODE # StringLiteral at 36.23
subu $sp, $sp, 4 # StringLiteral at 36.23
la $t0, strLit_100 # StringLiteral at 36.23
sw $t0, ($sp) # StringLiteral at 36.23
# EXIT NODE # StringLiteral at 36.23
jalprintStr_Lib # Call at 36.14
# EXIT NODE # Call at 36.14
##############################################################
# MiniJava/UP library for MIPS/Spim -- version that assumes
# one-word boolean on stack
# author: Steven R. Vegdahl
# date: 7-13 July 2004
# modified 12-17 March 2007
# modified 3-25 May 2007
# modified 2 May 2015
# modified 7 March 2016
# status: reasonably debugged (allegedly)
###############################################################
.text
###############################################################
# equals() - library method (class Object)
# - tests whether two objects are equal
# - produces boolean that tells whether two objects are equal--
# meaning that they are the same physical object
# - parameters:
# - ($sp) - this-pointer
# - 4($sp) - object to compare to
# - return-value:
# - ($sp) - 1 if the objects were the same; 0 otherwise
###############################################################
equals_Object:
lw $t0,($sp) # second pointer
lw $t1,4($sp) # first pointer (this)
seq $t0,$t0,$t1 # produce boolean telling if they are equal
addu $sp,4 # adjust stack
sw $t0,($sp) # store return value on top of stack
jr $ra # return
###############################################################
# equals() - library method (class String)
# - the String version of the .equals method
# - produces false if the second object is null or is not a String ;
# otherwise produces true iff the two strings have the same contents
# - parameters:
# - ($sp) - this-pointer
# - 4($sp) - object to compare to
# - return-value:
# - ($sp) - 1 if the objects were the same; 0 otherwise
###############################################################
equals_String:
# quick test for obvious false
lw $t0,($sp) # second parameter
beq $t0,$zero,goEsFalse # go return false if null
lw $t1,-12($t0) # vtable pointer
la $t2,CLASS_String # string vtable pointer
bne $t1,$t2,goEsFalse # go return false if not a string
# save $ra, $sp, etc
subu $sp,12
sw $s2,8($sp)
lw $s2,16($sp)
sw $ra,16($sp)
# call "compareTo"
sw $s2,4($sp)
sw $t0,($sp)
jal compareTo_String
# return value is 1 iff result is 0; else 0
lw $t0,($sp)
seq $t0,$t0,$zero
# unwind stack and return
lw $s2,8($sp)
lw $ra,16($sp)
sw $t0,16($sp) # return value
addu $sp,16
jr $ra # return
goEsFalse:
addu $sp,4 # adjust stack
sw $zero,($sp) # store value
jr $ra # return
lw $t0,($sp) # second pointer
lw $t1,4($sp) # first pointer (this)
seq $t0,$t0,$t1 # produce boolean telling if they are equal
addu $sp,4 # adjust stack
sw $t0,($sp) # store return value on top of stack
jr $ra # return
###############################################################
# readLine() - library method (class Lib)
# - reads line from standard input
# - produces String that contains the line read, except that it
# does not include the end-of-line character-sequence. An
# end-of-line character-sequence is one of the following:
# - a return character followed by a newline character
# - a newline character not preceded by a return character
# - a return character not followed by a newline character
# - an end-of-file character that follows at least one data
# character
# - returns null on end-of-file
# - parameter:
# - ($sp) - this-pointer
# - return-value:
# - ($sp) - pointer to string containing line that was read
# - anomalies:
# - with bare "return", looks ahead one character to check for
# newline. This could cause non-intuitive behavior when
# run interactively.
###############################################################
readLine_Lib:
subu $sp,$sp,8 # allocate space for data tag, saving $ra
sw $ra, 4($sp) # save $ra
move $t1,$sp # save "original" sp
doRead:
# read the character
jal readLogicalChar
# if we have a 'return', read another character to check for
# newline
subu $t2,$v0,13
bne $t2,$zero,notReturnRL
jal readLogicalChar
subu $t2,$v0,10 # check for newline
beq $t2,$zero,foundNewLine
sw $v0,lastCharRead # push back character into queue
j foundNewLine # go process the line
notReturnRL:
# at this point, $v0 has our character
subu $t0,$v0,10
beq $t0,$zero,foundNewLine
blt $v0,$zero,foundEof
# we have a character, so push it onto stack
subu $sp,$sp,4
sw $v0,($sp)
# loop back up to get next character
j doRead
foundEof:
# if we had actually read some characters before hitting
# the eof, go return them as if a newline had been read
bne $t1,$sp foundNewLine
# otherwise, we got end of file without having read any
# new characters, so return null
sw $zero,8($sp) # return-value: null
j rlReturn # return
foundNewLine:
# at this point, we have our newline (or end-of-file), and all space
# on the stack above $t1 are characters to be put into the string.
# That is therefore the number of data words to allocate (plus 1
# more for the class-pointer)
# set up GC tag and char-count on stack
subu $t0,$t1,$sp # number of chars we read (times 4)
srl $s6,$t0,2 # number of words on stack with chars
subu $sp,$sp,4 # push char-count ...
sw $s6,($sp) # ... onto stack
addu $t2,$t0,5 # GC tag, incl. for count-word
sw $t2,($t1) # store GC tag
# allocate the appropriate Object
addu $s6,$s6,7 # 3 to round up, plus 1 for v-table pointer word
srl $s6,$s6,2 # data words in object
move $s7,$zero # # object words in object
jal newObject # allocate space
# store header words
la $t0,CLASS_String
sw $t0,-12($s7) # store class tag (String) into object
lw $t2,4($sp) # char-count
sll $t1,$t2,2 # 4 times number of chars
subu $t2,$zero,$t2 # negative of char-count
sw $t2,-4($s7) # store negative char-count as header-word 2
# set up pointers to various parts of stack and object
lw $t0,-8($s7) # data words in object
sll $t0,$t0,2 # data bytes in object
subu $t0,$s7,$t0 # place to store first character (plus 8)
subu $t0,$t0,$t2 # place to store last character (plus 9)
addu $sp,$sp,8 # pop redundant object-pointer and count
addu $t1,$t1,$sp # first non-char spot on stack
# at this point:
# $t0 points to the target-spot for the last character (plus 9)
# $t1 contains top spot on the stack not containing a char
# $sp points to the word with the last source character
# copy the characters, popping each off the stack
beq $sp,$t1,doneCharCopy
charCopyLoop:
lw $t2,($sp)
sb $t2,-9($t0)
addu $sp,$sp,4
subu $t0,$t0,1
bne $sp,$t1,charCopyLoop
doneCharCopy:
# put our pointer (the return value) on the eventual top stack
sw $s7,8($sp)
rlReturn:
# restore return address and return
lw $ra,4($sp) # restore return address, ...
addu $sp,$sp,8 # ... by popping it (and this-pointer) off stack
jr $ra
###################################################################
# readInt() - library method (class Lib)
# - skips whitespace
# - then attempts to read a base-10 integer from standard input
# - aborts program if a valid integer is not found
# - returns the integer that is read
# - truncates on overflow
# - parameter:
# - ($sp) - this-pointer
# - return-value:
# - ($sp) - value that was read
# - 4($sp) - (dummy) GC tag
###################################################################
readInt_Lib:
# save $ra by pushing onto stack
subu $sp,$sp,4
sw $ra,($sp)
riSkipWhiteLoop:
# read a character
jal readLogicalChar
# if character <= 32 ascii, check for whitespace; if not
# whitespace, abort
subu $t0,$v0,32
bgt $t0,$zero,nonWhite
beq $t0,$zero,riSkipWhiteLoop # start over if space
subu $t0,$v0,10
beq $t0,$zero,riSkipWhiteLoop # start over if newline
subu $t0,$v0,9
beq $t0,$zero,riSkipWhiteLoop # start over if tab
subu $t0,$v0,13
beq $t0,$zero,riSkipWhiteLoop # start over if carriage return
subu $t0,$v0,12
beq $t0,$zero,riSkipWhiteLoop # start over if form-feed
j badIntegerFormat # illegal integer char: abort program
nonWhite:
subu $t0,$v0,'-'
li $t4,1 # final multiplier
bne $t0,$zero,helpReadInt # go read
li $t4,-1 # -1 in final multiplier
# read another character to make up for the '-'
jal readLogicalChar
helpReadInt:
li $t2,10
subu $t1,$v0,'0' # convert digit to 0-9 value
bgeu $t1,$t2,badIntegerFormat # abort if not digit
move $t3,$t1 #
#### at this point, $t3 contains value of the first digit read,
#### and $t2 contains the value 10
digitLoop:
# loop invariants:
# - $t3 contains the value of the number we've read so far
# - $t2 contains the value 10
jal readLogicalChar # read next character
subu $t1,$v0,'0' # convert digit to 0-9 value
bgeu $t1,$t2,doneDigitLoop # abort if not digit
mul $t3,$t3,$t2 # multiply old value by 10
addu $t3,$t3,$t1 # add in value of new digit
j digitLoop
doneDigitLoop:
# "push back" unused character into queue
sw $v0,lastCharRead
# restore return address and overwrite it with return-val;
# write dummy GC tag as second word of return-val
lw $ra,($sp)
mult $t3,$t4 # multiply to account for poss. minus sign
mflo $t3
sw $t3,($sp) # result
sw $s5,4($sp) # dummy GC tag
#lw $zero,4($sp)#**"" #--FOR MEMORY TAGGING
# return
jr $ra
###################################################################
# readChar() - library method (class Lib)
# - reads a single character from standard input
# - returns the integer that is the encoding of the character
# - returns -1 if end of file was encountered
# - parameter:
# - ($sp) - this-pointer
# - return-value:
# - ($sp) - value that was read
# - 4($sp) - (dummy) GC tag
###################################################################
readChar_Lib:
# save $ra by pushing onto stack
subu $sp,$sp,4
sw $ra,($sp)
# read the character
jal readLogicalChar
# restore return address; put value (and dummy GC tag),
# replacing this-pointer saved return address
lw $ra,($sp)
sw $s5,4($sp)
#lw $zero,4($sp)#**"" #--FOR MEMORY TAGGING
sw $v0,($sp)
# return
jr $ra
########################################################
# printStr(str) - library method (class Lib)
# - prints string to standard output
# parameters:
# - ($sp) - the string to print
# - 4($sp) - this-pointer
########################################################
printStr_Lib:
# check for null, printing "(null)", if so
lw $t0,($sp)
bne $t0,$zero,psNotNull
# print "(null)"
la $a0,nullStr
li $v0,4
syscall
j donePrintStr
psNotNull:
##### we have a non-null string #####
# this means that:
# - number of data words in object is in -8($t0)
# - negative of number of characters in string is in -4($t0)
# - string begins at $t0-8-(#dataWords*4), stored 1 char per byte
subu $t0,$t0,8
lw $t1,($t0) # word just beyond end of string
sll $t1,$t1,2
subu $t1,$t0,$t1 # first word in string
lw $t0,4($t0) # negative of string-length
subu $t0,$t1,$t0 # byte just beyond last char in string
# print the chars in the string
beq $t0,$t1,donePrintStr
psLoop:
lb $a0,($t1) # next byte
li $v0,11 # code for printing char
syscall # print the char
addu $t1,$t1,1 # go to next char
blt $t1,$t0,psLoop
donePrintStr:
# pop stack and return
addu $sp,$sp,8
jr $ra
########################################################
# printInt(n) - library method (class Lib)
# - prints integer in decimal format to standard output
# - parameters:
# - ($sp) - the integer to print
# - 4($sp) - (dummy) GC tag
# - 8($sp) - this-pointer
########################################################
printInt_Lib:
# pop value off stack, along with 'this'
lw $a0,($sp)
addu $sp,$sp,12
# print it
li $v0,1 # code for print-int
syscall
# return
jr $ra
########################################################
# printBool(n) - library method (class Lib)
# - prints boolean to standard output
# - parameters:
# - ($sp) - the boolean to print
# - 4($sp) - this-pointer
########################################################
printBool_Lib:
# pop value off stack, along with 'this'
lw $t0,($sp)
addu $sp,$sp,8
# print either 'true' or 'false', depending on the value
la $a0,falseString
beq $t0,$zero,skipPB
la $a0,trueString
skipPB:
li $v0,4 # code for print-string
syscall
# return
jr $ra
########################################################
# str.substring(n, k) - library method (class String)
# takes a substring of a string: Java: str.substring(n, k)
# - parameters:
# - ($sp) - k: one beyond index of last char in subrange
# - 4($sp) - (dummy) GC tag
# - 8($sp) - n: index of first char in subrange
# - 12($sp) - (dummy) GC tag
# - 16($sp) - str: string to take substring of
# - return value:
# - ($sp) - substring
########################################################
substring_String:
# save $ra by pushing onto stack
subu $sp,$sp,4
sw $ra,($sp)
# get string value off stack, test for null
lw $t0,20($sp)
beq $t0,$zero,nullPtrException
# get both indices and string length, and ensure that
# 0 <= n <= k <= length
lw $t0,-4($t0) # negative of string length
subu $t0,$zero,$t0 # string length
lw $t1,4($sp) # k
lw $t2,12($sp) # n
bgt $zero,$t2,strIndexOutOfBounds
bgt $t2,$t1,strIndexOutOfBounds
bgt $t1,$t0,strIndexOutOfBounds
# allocate memory
subu $s6,$t1,$t2 # # chars in target-string
addu $s6,$s6,7 # account for extra "class" (4) word + 3 to round up
srl $s6,$s6,2 # convert bytes-count to word-count
move $s7,$zero # (no object-bytes in string)
jal newObject
# store "String" tag in object-type field
la $t0,CLASS_String
sw $t0,-12($s7)
# store negative of count (=n-k) into object-length header-word
lw $t1,8($sp) # k
lw $t2,16($sp) # n
subu $t0,$t2,$t1 # value to store
sw $t0,-4($s7) # store value
# store result in return-spot on stack
lw $t3,24($sp) # source string pointer
sw $s7,24($sp) # store final result in return-spot on stack
# skip byte-copy loop if length is zero
beq $zero,$t0,doneSubCopyzz
# get pointers set up in preparation for copy
lw $t4,-8($t3) # # data words in source string
sll $t4,$t4,2 # # data bytes in source string
subu $t3,$t3,$t4 # addr. of first data word of source string (+8)
addu $t3,$t3,$t2 # addr. of first source data byte to be copied (+8)
subu $t1,$t3,$t0 # addr. beyond last source data byte to be copied (+8)
lw $t2,-8($s7) # # data words in target string
sll $t2,$t2,2 # # data bytes in target string
subu $t2,$s7,$t2 # addr. of first target data byte (+8)
############################################
# at this point:
# - we know that the string has a positive length
# - $t3 contains 8 + address of the first source-byte
# - $t1 contains 8 + limit-address of the first source-byte
# - $t2 contains 8 + address first target byte
############################################
# copy the bytes from source to target
subCopyLoopzz:
lb $t4,-8($t3)
sb $t4,-8($t2)
addu $t2,$t2,1
addu $t3,$t3,1
blt $t3,$t1,subCopyLoopzz
doneSubCopyzz:
# restore return address, store return value, pop stack
lw $ra,4($sp) # restore $ra
addu $sp,$sp,24 # pop stack
# return
jr $ra
########################################################
# length() - library method (class String)
# returns length of a string: Java: str.length()
# - parameters:
# - ($sp) - the string
# - return-value:
# - ($sp) - length of string
# - 4($sp) - (dummy) GC tag
########################################################
length_String:
# get string pointer
lw $t0,($sp)
# grow stack
subu $sp,$sp,4
# store GC tag
sw $s5,4($sp)
#lw $zero,4($sp)#**"" #--FOR MEMORY TAGGING
# push length onto stack
lw $t0,-4($t0) # -length
subu $t0,$zero,$t0
sw $t0,($sp) #store length
# return
jr $ra
########################################################
# str1.concat(str2) - library method (class String)
# (as in Java)
# - parameters:
# - ($sp) - the second string
# - 4($sp) - the first string
# - returns:
# - ($sp) - pointer to concatenated string
########################################################
concat_String:
# save $ra by pushing onto stack
subu $sp,$sp,4
sw $ra($sp)
# get string pointers and check parameter for null
lw $t0,4($sp)
beq $t0,$zero,nullPtrException
lw $t1,8($sp)
# get lengths of two strings; allocate object whose size
# is their sum divided by 4 (rounded up) plus 1
lw $t0,-4($t0) # negative size of second object
lw $t1,-4($t1) # negative size of first object
addu $s6,$t0,$t1 # sum of negative sizes
sra $s6,$s6,2 # negative word-size of char part
subu $s6,$zero,$s6 # word size of char part
addu $s6,$s6,1 # data word size, including v-table word
move $s7,$zero
jal newObject
# store "String" tag in object-type field
la $t0,CLASS_String
sw $t0,-12($s7)
# pop rtnVal, $ra and both parameters off stack; push rtnVal
# onto stack
lw $ra,4($sp) # return address
lw $t0,8($sp) # second object
lw $t1,12($sp) # first object
addu $sp,$sp,12 # pop
sw $s7,($sp) # store return value
# get negative sizes; sum and store in new object size-field
lw $t2,-4($t0) # negative length of second object
lw $t3,-4($t1) # negative length of first object
addu $t4,$t2,$t3 # sum of negative lengths
sw $t4,-4($s7) # store sum as negated target-string length
#########################################################
# at this point:
# - $t0 is pointer to second object
# - $t1 is pointer to first object
# - $t2 is negated length of second object
# - $t3 is negated length of first object
# - $s7 is pointer to new object
#########################################################
# compute addresses for moving data from first string
lw $t4,-8($t1) # # data words in first string
sll $t4,$t4,2 # # data bytes in first string
subu $t1,$t1,$t4 # addr. (+8) of first byte in first string
lw $t4,-8($s7) # # data words in new string
sll $t4,$t4,2 # # data bytes in new string
subu $s7,$s7,$t4 # addr. (+8) of first byte in new string
beq $zero,$t3,doneConcatLoop1zz # skip first loop is no bytes to copy
subu $t3,$t1,$t3 # limit (+8) address for first string
#########################################################
# at this point:
# - $t0 is pointer to second object
# - $t1 is address (+8) of first byte in first object
# - $t2 is negated length of second object
# - $t3 is limit-address (+8) of data in first object
# - $s7 is address (+8) of first byte in new object
# - note: if data-length of first object is zero, then
# we skip over this part, and go to 'doneConcatLoop1'
#########################################################
# copy the bytes from first source to target
concatLoop1zz:
lb $t4,-8($t1)
sb $t4,-8($s7)
addu $s7,$s7,1
addu $t1,$t1,1
blt $t1,$t3,concatLoop1zz
doneConcatLoop1zz:
# if second string is empty, skip rest of copy
beq $zero,$t2,doneConcatLoop2zz
# compute addresses for moving data from second string
lw $t4,-8($t0) # # data words in second string
sll $t4,$t4,2 # # data bytes in second string
subu $t1,$t0,$t4 # addr. (+8) of first byte in second string
subu $t3,$t1,$t2 # limit (+8) address for second string
#########################################################
# at this point:
# - $t1 is address (+8) of first byte in second object
# - $t3 is limit-address (+8) of data in second object
# - $s7 is address (+8) of next byte to write new object
# - note: if data-length of second object is zero, then
# we skip over this part, and go to 'doneConcatLoop2'
#########################################################
# copy the bytes from first source to target
concatLoop2zz:
lb $t4,-8($t1)
sb $t4,-8($s7)
addu $s7,$s7,1
addu $t1,$t1,1
blt $t1,$t3,concatLoop2zz
doneConcatLoop2zz:
concatRtnzz:
# return
jr $ra
########################################################
# str.charAt(n) - library method (class String)
# accesses a character in a string, as in Java
# - parameters:
# - ($sp) - the index, n
# - 4($sp) - dummy GC tag
# - 8($sp) - the string, str
# - returns:
# - ($sp) - the character found
# - 4($sp) - the dummy GC tag
########################################################
charAt_String:
# get string
lw $t0,8($sp)
# check that index is in bounds
lw $t1,-4($t0) # negative of # data words in string
subu $t3,$zero,$t1 # # chars in string
lw $t2,($sp) # index
bgeu $t2,$t3,strIndexOutOfBounds
# access element
lw $t1,-8($t0) # # data words in object
sll $t1,$t1,2 # - byte-offset from end of chars
subu $t1,$t2,$t1 # - address of first char in string, offset by 8
addu $t0,$t0,$t1 # - address of our char, offset by 8
lb $t0,-8($t0) # our char
# pop elements off stack, pushing rtnVal
addu $sp,$sp,4
sw $t0,($sp)
sw $s5,4($sp)
#lw $zero,4($sp)#**"" #--FOR MEMORY TAGGING
# return
jr $ra
########################################################
# intToString(n) - library method (class Lib)
# converts int to string: Java: ""+n
# - parameters:
# - ($sp) - the value to convert, n
# - 4($sp) - dummy GC tag
# - 8($sp) - this-pointer
# - returns:
# - ($sp) - the string, which is the string representation of
# the integer
########################################################
intToString_Lib:
# save return address on stack; allocate space for dummy GC tag
subu $sp,$sp,8
sw $ra,4($sp)
# save current sp
move $t0,$sp
# move constant 10 into $t3
li $t3,10
# get argument, negate if negative
lw $t1,8($sp)
bge $t1,$zero,itsNonNegLoop
subu $t1,$zero,$t1
# loop through, computing unsigned remainder by 10, and
# storing digits on stack until we reach 0
itsNonNegLoop:
divu $t1,$t3
mflo $t1 # quotient
mfhi $t4 # remainder
addu $t4,$t4,'0' # turn remainder into digit
subu $sp,$sp,4
sw $t4,($sp) # push digit onto stack
bne $t1,$zero,itsNonNegLoop
# push '-' if negative
lw $t4,8($t0)
bge $t4,$zero,itsSkipNeg
li $t4,'-'
subu $sp,$sp,4
sw $t4,($sp)
itsSkipNeg:
################################################
# At this point, all of our digits have been pushed
# onto the stack. $sp points to the first one;
# $t0 contains the limit-pointer (into which we need to
# write a GC tag).
################################################
# compute number of characters on stack (one word per character);
# write GC tag onto stack; push char-count onto stack
subu $s6,$t0,$sp
addu $t3,$s6,5 # GC tag (including for count-word, about to be pushed
sw $t3,($t0)
srl $s6,$s6,2
subu $sp,$sp,4
sw $s6,($sp)
# allocate memory
addu $s6,$s6,7 # 3 to round up, plus 4 for vtable word
srl $s6,$s6,2
move $s7,$zero # no "object" words in object
jal newObject
# restore char-count; pop it and return value from 'newObject'
lw $t0,4($sp)
addu $sp,$sp,8
# store "String" tag into class field
subu $s7,$s7,8 # address of header-1 word
la $t1,CLASS_String
sw $t1,-4($s7)
# store negative of char-count into header-2 word
subu $t0,$zero,$t0
sw $t0,4($s7)
lw $t1,($s7) # number of data words in string
sll $t1,$t1,2 # number data bytes in string
subu $t1,$s7,$t1 # first location to store chars in string
subu $t0,$t1,$t0 # limit address for chars in string
####################################################
# at this point:
# - $sp contains first source character address
# - $t1 contains first target character address
# - $t0 contains target-limit address
####################################################
# loop through and copy all elements as we pop them off the stack.
# (In this case, we know that there is it least one.)
itsLoop:
lw $t2,($sp)
addu $sp,$sp,4
sb $t2,($t1)
addu $t1,$t1,1
bne $t1,$t0,itsLoop
####################################################
# At this point
# - ($t0+15)&0xfffffffe is our return value
# - ($sp) contains garbage (old GC tag)
# - 4($sp) contains return address
####################################################
# adjust stack, restore return address; return
lw $ra,4($sp)
addu $sp,$sp,16
addu $t0,$t0,15
and $t0,$t0,0xfffffffc
sw $t0,($sp)
jr $ra
########################################################
# intToChar(n) - library method (class Lib)
# converts int to a one-character string: Java: ""+(char)(n&0xff)
# - parameters:
# - ($sp) - the value to convert, n
# - 4($sp) - dummy GC tag
# - 8($sp) - this-pointer
# - returns:
# - ($sp) - the string, which is the converted character
# - note: only the low 8 bits of the value n are used
########################################################
intToChar_Lib:
# save return address
subu $sp,$sp,4
sw $ra,($sp)
# allocate object
li $s6,2
move $s7,$zero
jal newObject
# restore $ra, get 'n', popping then and 'newObject' rtnVal
# off stack
lw $ra,4($sp)
lw $t1,8($sp)
addu $sp,$sp,16
# store "String" tag into class field
la $t0,CLASS_String
sw $t0,-12($s7)
# store data in string
sb $t1,-16($s7)
# store negative of size in header-word 2
li $t0,-1
sw $t0,-4($s7)
# store string pointer (return val) on stack for return
sw $s7,($sp)
# return
jr $ra
########################################################
# str1.compareTo(str2) - library method (class String)
# compares two strings as in Java
# - parameters:
# - ($sp) - second string
# - 4($sp) - first string
# - returns:
# - ($sp) - -1, 0, or 1 depending on whether str1 is
# lexographically less than, equal to or greater than str2
# - 4($sp) - (dummy) GC tag
########################################################
compareTo_String:
# get string pointers and check parameter for null
lw $t0,($sp) # second string
beq $t0,$zero,nullPtrException
lw $t1,4($sp) # first string
# get (negatives of) respective byte-lengths
lw $t2,-4($t0) # negative length of second string
lw $t3,-4($t1) # negative length of first string
# put tentative return value in $t5.
# The tentative return value is the one that we will use if we get
# to the end of the shorter string during our comparison-loop.
slt $t4,$t3,$t2
slt $t5,$t2,$t3
subu $t5,$t5,$t4
# at this point:
# - $t0 contains the pointer to the second string object
# - $t1 contains the pointer to the first string object
# - $t5 contains the value to return if the strings compare equal up
# to the length of the shortest word
# get begin-of-string addresses
lw $t2,-8($t0) # # data words in second string
lw $t3,-8($t1) # # data words in first string
sll $t2,$t2,2 # byte-offset to beginning of str2 (+8)
sll $t3,$t3,2 # byte-offset to beginning of str1 (+8)
subu $t0,$t0,$t2 # beginning of str1 address (+8)
subu $t1,$t1,$t3 # beginning of str2 address (+8)
# put $t1-limit into $t2
beq $zero,$t5,skipStrCmpLenzz
move $t2,$t3
skipStrCmpLenzz:
add $t2,$t1,$t2
# at this point:
# - $t0 contains 8 plus the address of the first data-byte of str2
# - $t1 contains 8 plus the address of the first data-byte of str1
# - $t2 contains 8 plus the address of the last data-type of str1
# - $t5 contains the value to return if the strings compare equal up
# to the length of the shortest word
#######################################################
# at this point, we have
# - $t5 containing the tentative return-value
# - $t1 containing address of first char in str2
# - $t2 containing limit for $t1
# - $t0 containing address of first char in str1
#######################################################
# loop through, until we find unequal words or we hit
# our limit
cmpLoopzz:
lw $t3,-8($t1) # word from str2
lw $t4,-8($t0) # word from str1
bne $t3,$t4,cmpNotEqualzz
addu $t1,$t1,4
addu $t0,$t0,4
bne $t1,$t2,cmpLoopzz
# # got to the end of one string: go set up return
j cmpHitLimitzz
cmpNotEqualzz:
# found unequal characters: return -1 or 1, depending on which is
# greater
slt $t5,$t4,$t3 # 1 if str2 > str1, else 0
sll $t5,$t5,1 # 2 if str2 > str1, else 0
subu $t5,$t5,1 # 1 if str2 > str1, else -1
cmpHitLimitzz:
sw $t5,($sp) # store value
sw $s5,4($sp) # GC tag
#lw $zero,4($sp)#**"" #--FOR MEMORY TAGGING
jr $ra # return
########################################################
# readLogicalChar (millicode)
# - logically reads a character from standard input
# - first checks character buffer, consuming it if possible
# - return-result:
# - returns character in $v0
# - side-effects:
# - reads a character
# - clobbers $t0
########################################################
readLogicalChar:
# check if we already have a character
lw $v0,lastCharRead
li $t0,-2
beq $t0,$v0 doReadCh
# we have our character from the buffer. Wipe out
# buffer and return
sw $t0,lastCharRead # store -2 into buffer (i.e. "empty")
jr $ra # return
doReadCh:
# we need to actually read a character: read and return
li $v0,12 # use system call to read a character
syscall
jr $ra # return
########################################################
# newObject (millicode)
# - allocates a new object on the heap
# - two-word header is set up properly
# - all non-header words in object are set to zero
# - parameters:
# - $s6 = first header-word, which is -1 if it is a data-array
# allocation, and is the number of data words in the object
# otherwise
# - $s7 - second header-word, which is the number of object
# words in the object (unless $s6 is -1, in which case it
# is the number of data words in the object
# - it is illegal for $s6 to be less than -1 (this is not checked)
# - it is illegal for $s7 to be less than 0 (this is checked)
# - return-result:
# - pushed onto the top of the stack
# - also returned in $s7
# - side-effects:
# - may trash all $tx registers and all $sx registers, except the
# "permanent" ones, which get updated with values that are
# consistent with the new space
########################################################
newObject:
# $s6 = # data words (or -1 if data-array allocation)
# - note: it is illegal for $s6 to be less than -1
# $s7 = # object words (# data words if data-array allocation)
# $ra = return address
## on return, pointer to new memory is on
## top of stack, and also in $s7
# abort if the object size is negative (this would be an array
# allocation)
blt $s7,$zero arraySizeOutOfBounds
# mark the fact that we have not yet GC'd for this allocation
move $t5,$zero
###### TEMPORARY #######
# for now, go a GC unconditionally, so that a full GC occurs
# every time we allocate an object
### let's not do that for now
# j doGC
gcJoin:
# Determine actual size of "before-header" portion.
# If negative (which would be -1), it really means 1
move $t3,$s6
bge $t3,$zero,newSkip
subu $t3,$zero,$t3 # 1
newSkip:
# at this point:
# $s6 contains the first header word
# $s7 contains the second header word, which is also the
# after-header word count
# $t3 contains the before-header word count
# $t5 is zero iff we have not GC'd for this allocation
# determine if we have enough memory available
addu $t0,$t3,$s7
sll $t0,$t0,2
addu $t0,$t0,8 # amount of memory needed
addu $t1,$t0,$s3
bgtu $t1,$s4,doGC
# at this point:
# $s3 points to beginning of segment, and
# $t1 points just past the end
# zero out the memory
move $t2,$s3
zeroObjLoop:
sw $zero,($s3)
#lw $zero,($s3)#**"" #--FOR MEMORY TAGGING
addu $s3,4
bltu $s3,$t1,zeroObjLoop
# at this point:
# $s3 has been updated to point to the next free slot,
# which is also the point just past our object
# compute pointer value and set up header-words
sll $t0,$s7,2 # number of post-header bytes
subu $t0,$s3,$t0 # pointer that we will return
# store header-values
sw $s6,-8($t0) # first header-word
#lw $zero,-8($t0)#**"H1" #--FOR MEMORY TAGGING
sw $s7,-4($t0) # second header-word
#lw $zero,-4($t0)#**"H2" #--FOR MEMORY TAGGING
# put return-value into $s7 and also push it onto top of stack
move $s7,$t0
subu $sp,$sp,4
sw $t0,($sp)
jr $ra
doGC:
#####################################################
# We need to do a garbage-collect
#####################################################
# print that we are doing a GC
# la $a0,gcMsg # prints message: "GC!"
# li $v0,4 # syscall-code for print-string
# syscall
# if we've already done a GC for this allocation, then
# we are actually out heap-memory: abort program
bne $t5,$zero,outOfHeapMemory
# save $s2 (our only rooted register) on the stack
# so that the garbage collector processes it
subu $sp,$sp,4
sw $s2,($sp)
# set $s3 to the address of the new segment and the
# end-limit of the new segment, respectively,
# Also, update cur_seg to refer to the other segment
lw $t0,cur_seg
move $t7,$s4
la $t6,seg1_start
la $s3,seg0_start
la $s4,seg0_end
sw $zero,cur_seg
bne $t0,$zero,skipGc1
la $t6,seg0_start
la $s3,seg1_start
la $s4,seg1_end
sw $s5,cur_seg
skipGc1:
li $t5,-2
lw $t0,stack_bottom
subu $t0,4
##################################
# TEMPORARY HACK TO EXERCISE GC
##################################
#lw $t1,heapFudge
#addu $t6,$t6,$t1
#addu $t1,$t1,4
#addu $s3,$s3,$t1 # fudge new heap pointer
###############################################################
# at this point:
# - $t6 contains the first address of the source space
# - $t7 contains the limit address of the source space
# - $s3 contains the first address of the target space
# - $s4 contains the limit address of the target space
# - cur_seg has been updated to refer to the target space
# - $t0 contains the address of the deepest stack element
# - $sp contains the address of the top stack element
# - $s2 is available for use, having been pushed onto the stack
# - $t5 contains the value -2
###############################################################
###### begin outer loop to copy all stack-direct objects ######
gcStackCopyLoop:
lw $t1,($t0) # current stack element
# test if we have a GC tag
sll $t2,$t1,31 # zero iff low bit was zero
bne $t2,$zero,gcBump # go skip data values if low bit not zero
# bump stack-address pointer
subu $t0,$t0,4
# if value is out of range (which includes null=0), and is
# therefore does not refer to an object on the heap, just go
# loop back and do the next one
bleu $t1,$t6,gcTestIterDone1
bgtu $t1,$t7,gcTestIterDone1
# if the object has already been moved, update the stack-value
# via the forwarding pointer
lw $t2,-8($t1) # possible forwarding tag
bne $t2,$t5,gcNoForward1 # if not forwarding tag, go copy
lw $t2,-4($t1) # forwarding pointer: object's new address
sw $t2,4($t0) # update stack value
j gcTestIterDone1 # do next iteration
gcNoForward1:
#########################################################
# we actually need to copy the object into the new space
#########################################################
# compute the amount of space that is needed
bge $t2,$zero,gcSkip2
subu $t2,$zero,$t2 # set to 1 if -1 (number of data words)
gcSkip2:
sll $t2,$t2,2
addu $t2,$t2,8
subu $t4,$t1,$t2 # address of first word of source
lw $t3,-4($t1) # number of object words (negative treated as zero)
bge $t3,$zero,gcH2Neg1
move $t3,$zero
gcH2Neg1:
sll $t3,$t3,2
addu $t3,$t3,$t1 # address one word past last word of source
addu $t2,$s3,$t2 # pointer to target object
#########################################################
# At this point:
# - $t0 contains the address of the stack slot we'll
# process next
# - $t1 contains the contents of the stack slot we're
# currently working on, which is a pointer to the source
# object (i.e., the address just beyond the object's header
# - $t2 contains the pointer to the target object
# - $t3 contains the limit address of the source object
# - $t4 contains the first address of the source object
# - $t5 contains the value -2
# - $t6 contains the first address of the source space
# - $t7 contains the limit address of the source space
# - $s3 contains the first unallocated address of the
# target space, which is also the first address of the
# target object
# - $s4 contains the limit address of the target space
# - $s5 contains the value 5
# - $s6-7 contain the original parameters to the call to
# 'newObject'
# - $sp contains the address of the top stack element
# - available for use: $s0-2
#########################################################
# swap first header word and first data word so that header
# can be found by "trailing finger" in the target space
lw $s0,($t4)
lw $s1,-8($t1)
sw $s1,($t4)
sw $s0,-8($t1)
# copy all source bytes to the target
gCinnerCopy1:
lw $s0,($t4)
sw $s0,($s3)
addu $t4,$t4,4
addu $s3,$s3,4
bltu $t4,$t3,gCinnerCopy1
###########################################################
# All bytes have been copied to the target space. We still
# need to:
# - set up forwarding pointer in source object
# - update the pointer in the current stack slot
###########################################################
# set up the forwarding pointer
sw $t5,-8($t1) # -2 in first header-slot
sw $t2,-4($t1) # forwarding pointer in second header-slot
# update the stack slot with the address in the target space
sw $t2,4($t0)
#lw $zero,-8($t2)#**"H1" #--FOR MEMORY TAGGING
#lw $zero,-4($t2)#**"H2" #--FOR MEMORY TAGGING
# go handle next stack slot (testing if done)
j gcTestIterDone1
gcBump:
#### we have a GC tag. Bytes to skip: tag value + 3.
subu $t0,$t0,$t1
subu $t0,$t0,3
gcTestIterDone1:
bgeu $t0,$sp,gcStackCopyLoop
###### end outer loop to copy all stack-direct objects ######
#############################################################
# We have finished processing the stack elements. Now we need
# to update elements in the heap itself. This may itself involve
# moving additional objects
#############################################################
#########################################################
# At this point:
# - $t5 contains the value -2
# - $t6 contains the first address of the source space
# - $t7 contains the limit address of the source space
# - $s3 contains the first unallocated address of the
# target space
# - $s4 contains the limit address of the target space
# - $s5 contains the value 5
# - $s6-7 contain the original parameters to the call to
# 'newObject'
# We want to set things up so that in addition:
# - $t0 is the "trailing finger", containing the address
# of the first slot in target space that we have yet
# to process.
# Then during processing:
# - $t1 will contain the contents of the heap slot we're
# currently working on, which is a pointer to the source
# object
# And when we're actually copying an object:
# - $t2 will contain pointer to the target object
# - $t3 will contain the limit address of the source object
# - $t4 will contain the first address of the source object
# - $s1 will contain the the limit address for the current
# object that tells where the pointers in the object end
# - available for use: $s0
##########################################################
# set $t0 to be at the beginning of target-space
lw $t1,cur_seg
la $t0,seg0_start
beq $t1,$zero,gcSkip4
la $t0,seg1_start
##################################
# TEMPORARY HACK TO EXERCISE GC
##################################
#lw $s0,heapFudge
#addu $s0,$s0,4
#addu $t0,$t0,$s0
#sw $s0,heapFudge
gcSkip4:
# if there were no objects put into the heap during stack
# processing, we're done, so go finish up
bgeu $t0,$s3,gcFinishUp
###### begin outer loop to copy all non-stack-direct objects ######
gcHeapCopyLoop:
# check if we have a data array
lw $t1,($t0) # first header word for current object
bge $t1,$zero,gcNotDataArray # test for neg. num (actually -1)
# We have a -1 header-word, which means this object has no pointers.
# we need to swap the -1 with the vtable pointer in the object,
# and then skip over it then loop back to do next object.
skipToNextObj:
lw $s0,4($t0) # un-swap vtable pointer ...
sw $s0,($t0) # ...
sw $t1,4($t0) # ... and -1 header-word
lw $t1,8($t0) # data words in (object position of) array
addu $t1,$t1,3 # add in # header words
sll $t1,$t1,2 # convert to byte-count
addu $t0,$t0,$t1 # skip over object
j gcTestIterDone2 # go do next object, if any
gcNotDataArray:
# get data count for object; swap header-word with first word
# of object so that they're back in the right place
sll $t2,$t1,2 # # data bytes
addu $t2,$t2,8 # to skip header words
addu $t2,$t0,$t2 # pointer to new object
lw $t3,-8($t2) # word to swap
sw $t1,-8($t2) # store header word
sw $t3,($t0) # restore first word of object
###################################################
# at this point:
# - the object has been restored to normal status
# - $t0 contains the address of the first word in the object
# (pretty useless at this point)
# - $t1 contains the first header word (# data objects)
# - $t2 contains a pointer to the object
###################################################
########### new stuff
# If there is a -12 header word, skip to next object if it is
# CLASS__DataArray
# beq $t1,$zero,noH3 # skip if vtable pointer
# lw $t3,-12($t2) # get vtable pointer
# subu $t3,CLASS__DataArray
# subu $t0,$t2,8 # set up $t0 in anticipation of skip
# beq $zero,$t3,skipToNextObj # skip if it's a data array
noH3:
lw $t3,-4($t2) # # object words (negative treated as zero)
bge $t3,$zero,gcH2Neg2
move $t3,$zero
gcH2Neg2:
sll $t3,$t3,2 # # object bytes
move $t0,$t2 # address of first pointer in object
add $s1,$t2,$t3 # limit address for this object
#####################################################
# At this point, we have to "translate" all pointers,
# starting at $t0 to (but not including) $s1
#####################################################
# if there are no pointer-slots (i.e., $t0=$s1), skip this
# part
beq $t0,$s1,gcTestIterDone2
gcNextPointerInObject:
# get pointer from object
lw $t1,($t0)
# if value is out of range, and is therefore does not refer
# to an object, just go loop back and do the next one
bleu $t1,$t6,gcGoNextPointerSlot
bgtu $t1,$t7,gcGoNextPointerSlot
# if the object has already been moved, update the stack-value
# via the forwarding pointer
lw $t8,-8($t1) # possible forwarding tag
bne $t8,$t5,gcNoForward2 # if not forwarding tag, go copy
lw $t8,-4($t1) # forwarding pointer: object's new address
sw $t8,($t0) # update pointer in object
j gcGoNextPointerSlot # do next iteration
gcNoForward2:
#########################################################
# we actually need to copy the object into the new space
#########################################################
#########################################################
# At this point:
# - $t0 contains the address of the heap-slot we're translating
# - $t1 will contain the contents of the heap-slot we're
# currently working on, which is a pointer to the source
# object
# - $t2 will contains pointer to the object we're in the
# middle of translating
# - $t5 contains the value -2
# - $t6 contains the first address of the source space
# - $t7 contains the limit address of the source space
# - $s3 contains the first unallocated address of the
# target space, which will also be the first address
# of the target object
# - $s4 contains the limit address of the target space
# - $s5 contains the value 5
# - $s6-7 contain the original parameters to the call to
# 'newObject'
# Then during processing:
# And when we're actually copying an object:
# - $t3 will contain the limit address of the source object
# - $t4 will contain the first address of the source object
# - $s1 will contain the the limit address for the current
# object that tells where the pointers in the object end
# - $t8 will contain a pointer to the target object
# - available for use: $s0, $t8, $t9
##########################################################
# compute the amount of space that is needed
bge $t8,$zero,gcSkip5
li $t8,1 # set to 1 if -1
gcSkip5:
sll $t8,$t8,2
addu $t8,$t8,8
subu $t4,$t1,$t8 # address of first word of source
lw $t3,-4($t1)
bge $t3,$zero,gcNoNeg
move $t3,$zero
gcNoNeg:
sll $t3,$t3,2
addu $t3,$t3,$t1 # address one word past last word of source
addu $t8,$s3,$t8 # pointer to target object
#########################################################
# At this point:
# - $t0 contains the address of the stack slot we'll
# process next
# - $t1 contains the contents of the stack slot we're
# currently working on, which is a pointer to the source
# object
# - $t2 will contains pointer to the object we're in the
# middle of translating
# - $t3 contains the limit address of the source object
# - $t4 contains the first address of the source object
# - $t5 contains the value -2
# - $t6 contains the first address of the source space
# - $t7 contains the limit address of the source space
# - $t8 contains the pointer to the target object
# - $s1 contains the the limit address for the current
# object that tells where the pointers in the object end
# - $s3 contains the first unallocated address of the
# target space, which is also the first address of the
# target object
# - $s4 contains the limit address of the target space
# - $s5 contains the value 5
# - $s6-7 contain the original parameters to the call to
# 'newObject'
# - $sp contains the address of the top stack element
# - available for use: $s0, $t9
#########################################################
# swap first header word and first data word so that header
# can be found by "trailing finger"
lw $s0,($t4)
lw $t9,-8($t1)
sw $t9,($t4)
sw $s0,-8($t1)
# copy all source bytes to the target
gCinnerCopy2:
lw $s0,($t4)
sw $s0,($s3)
addu $t4,$t4,4
addu $s3,$s3,4
bltu $t4,$t3,gCinnerCopy2
###########################################################
# All bytes have been copied to the target space. We still
# need to:
# - set up forwarding pointer in source object
# - update the pointer in the current stack slot
###########################################################
# set up the forwarding pointer
sw $t5,-8($t1) # -2 in first header-slot
sw $t8,-4($t1) # forwarding pointer in second header-slot
# update the heap-slot with the address in the target space
sw $t8,($t0)
gcGoNextPointerSlot:
# bump $t0 to next slot in object; if not done, loop back
addu $t0,$t0,4
bltu $t0,$s1,gcNextPointerInObject
gcTestIterDone2:
bltu $t0,$s3,gcHeapCopyLoop
###### end outer loop to copy all non-stack-direct objects ######
gcFinishUp:
# restore $s2 to its updated value by popping off stack
lw $s2,($sp)
addu $sp,$sp,4
# mark us as having already GC'd
move $t5,$s5
# go try and allocate again
j gcJoin
########################################################
# vm_init (millicode)
# - initialzes the virtual machine
# - values 5 stored in $s5
# - zero ("this pointer") stored in $s2
# - heap and heap-limit pointers stored respectively in $s3 and $s4
# - address of bottom of stack stored in 'stack_bottom' memory
# location
# - (note: 'cur_seg' memory location is already set to 0)
########################################################
vm_init:
# mark bottom of stack
sw $sp,stack_bottom
#move $sp,$sp#**"stack pointer" #--FOR MEMORY TAGGING
# set "this" pointer to be null, for now
move $s2,$zero
#move $s2,$s2#**"this pointer" #--FOR MEMORY TAGGING
#set up the "five" register
li $s5,5
#move $s5,$s5#**"constant 5" #--FOR MEMORY TAGGING
la $s3,seg0_start
#move $s3,$s3#**"next-avail-heap" #--FOR MEMORY TAGGING
la $s4,seg0_end
#move $s4,$s4#**"end-heap" #--FOR MEMORY TAGGING
# return
jr $ra
########################################################
# divide (millicode)
# - divides first arg by second (signed divide)
# - aborts if divisor is zero
# - follows calling conventions for library methods
# - parameters:
# - ($sp) divisor
# - 4($sp) (dummy) GC tag
# - 8($sp) dividend
# - 12($sp) (dummy) GC tag
# - return value:
# - ($sp) result
# - 4($sp) (dummy) GC tag
########################################################
divide:
# get parameters; abort if divisor zero
lw $t0,($sp)
lw $t1,8($sp)
beq $t0,$zero,divByZeroError
# perform division
div $t1,$t0
mflo $t0
# store result, adjust stack and return
addu $sp,$sp,8 # adjust stack
sw $t0,($sp) # store result
jr $ra
########################################################
# remainder (millicode)
# - takes remainder first arg divided by second (signed divide)
# - aborts if divisor is zero
# - follows calling conventions for library methods
# - parameters:
# - ($sp) divisor
# - 4($sp) (dummy) GC tag
# - 8($sp) dividend
# - 12($sp) (dummy) GC tag
# - return value:
# - ($sp) result
# - 4($sp) (dummy) GC tag
########################################################
remainder:
# get parameters; abort if divisor zero
lw $t0,($sp)
lw $t1,8($sp)
beq $t0,$zero,divByZeroError
# perform division
div $t1,$t0
mfhi $t0
# store result, adjust stack and return
addu $sp,$sp,8 # adjust stack
sw $t0,($sp) # store result
jr $ra
########################################################
# checkCast (millicode) - checks that a cast is legal
# - aborts if null
# - aborts if cast is illegal cast
# - parameters:
# - ($sp) object to check
# - $t0 address of vtable for target-class
# - $t1 address one past vtable address of last
# subclass of target-class
# - return value:
# - ($sp) object to check (now checked)
# - side-effects: clobbers $t2 and $t3
########################################################
checkCast:
# get object, allow immediately if null
lw $t2,($sp)
beq $t2,$zero,checkCastReturn
# get vtable address of object, abort if less than
# lower limit or greater then or equal to higher
# limit
lw $t2,-12($t2) # vtable address
bge $t2,$t1,castException
blt $t2,$t0,castException
# return, leaving object unchanged on stack
checkCastReturn:
jr $ra
# checkCast:
# # get object, allow immediately if null
# lw $t2,($sp)
# beq $t2,$zero,checkCastReturn
#
# # get vtable address of object (using Object vtable
# # address for arrays)
# lw $t3,-8($t2) # <= 0 if array
# lw $t2,-12($t2) # vtable address (unless array)
# bgt $t3,$zero,skipArrayCast
# la $t2,CLASS_Object
#
# # get vtable address of object, abort if less than
# # lower limit or greater then or equal to higher
# # limit
# skipArrayCast:
# bge $t2,$t1,castException
# blt $t2,$t0,castException
#
# # return, leaving object unchanged on stack
# checkCastReturn:
# jr $ra
########################################################
# instanceOf (millicode) - tests whether an object is
# a member of a given class (or subclass)
# - returns false if object is null
# - parameters:
# - ($sp) object to check
# - $t0 address of vtable for target-class
# - $t1 address one past vtable address of last
# subclass of target-class
# - return value:
# - ($sp) true (1) or false (0), depending on whether
# object is a member
# - side-effects: clobbers $t2 and $t3
########################################################
instanceOf:
# get object, go return false if null
lw $t2,($sp)
beq $t2,$zero,doneInstanceOf
# get vtable address of object, determine if we're >= the
# lower limit, and if we're < the higher limit
lw $t2,-12($t2) # vtable address
sge $t0,$t2,$t0 # are we >= the lower limit?
slt $t1,$t2,$t1 # are we < the higher limit?
# store the AND of the two conditions onto the stack; return
and $t2,$t0,$t1
sw $t2,($sp)
doneInstanceOf: # if we reach here via branch, stack-top is zero,
# which will now represent false
jr $ra
# instanceOf:
# # get object, go return false if null
# lw $t2,($sp)
# beq $t2,$zero,doneInstanceOf
#
# # get vtable address of object. If it's an array
# # (which would be H1 <= 0), use vtable address for Object
# lw $t3,-8($t2) # <= 0 if array
# lw $t2,-12($t2) # vtable address (unless array)
# bgt $t3,$zero,skipArrayInstanceOf
# la $t2,CLASS_Object
#
# # get vtable address of object, abort if less than
# # lower limit or greater then or equal to higher
# # limit
# skipArrayInstanceOf:
# sge $t0,$t2,$t0
# slt $t1,$t2,$t1
#
# # store the AND of the two conditions onto the stack; return
# and $t2,$t0,$t1
# doneInstanceOf: # if we reach here via branch, we know $t2=0
# sw $t2,($sp)
# jr $ra
###########################################################
# jump-targets to terminate program:
# - exit: returns normally
# - outOfHeapMemory: prints "out of memory" error and returns
###########################################################
exitError:
# assumes $a0 has pointer to null-terminated string
# print the string
li $v0,4 # syscall-code for print-string
syscall
exit:
# print termination message
li $v0,4
la $a0,exitString
syscall
# terminate execution
li $v0,10 #syscall-code for "exit"
syscall
outOfHeapMemory:
la $a0,heapMemoryMsg
j exitError
divByZeroError:
la $a0,divByZeroMsg
j exitError
strIndexOutOfBounds:
la $a0,strIndexOutOfBoundsMsg
j exitError
arrayIndexOutOfBounds:
la $a0,arrayIndexOutOfBoundsMsg
j exitError
arraySizeOutOfBounds:
la $a0,arraySizeOutOfBoundsMsg
j exitError
nullPtrException:
la $a0,nullPtrExceptionMsg
j exitError
badIntegerFormat:
la $a0,badIntegerFormatMsg
j exitError
castException:
la $a0,castExceptionMsg
j exitError
############## data section ################
.data
.align 2
cur_seg:
.word 0
lastCharRead:
.word -2 # -2 => no buffered character
heapMemoryMsg:
.asciiz "ERROR: out of heap memory\n"
divByZeroMsg:
.asciiz "ERROR: divide by zero\n"
strIndexOutOfBoundsMsg:
.asciiz "ERROR: string index out of bounds\n"
arrayIndexOutOfBoundsMsg:
.asciiz "ERROR: array index out of bounds\n"
arraySizeOutOfBoundsMsg:
.asciiz "ERROR: array size out of bounds\n"
nullPtrExceptionMsg:
.asciiz "ERROR: null-pointer exception\n"
badIntegerFormatMsg:
.asciiz "ERROR: attempt to read badly formatted integer\n"
castExceptionMsg:
.asciiz "ERROR: illegal cast\n"
gcMsg:
.asciiz "\nGC!\n"
nullStr:
.asciiz "null"
trueString:
.asciiz "true"
falseString:
.asciiz "false"
exitString:
.asciiz "Program terminated.\n"
.align 2
stack_bottom:
.word 0
#heapFudge: # temporary fudge amount to exercise GC
# .word 0
seg0_start:
.space 0x100000
seg0_end:
seg1_start:
.space 0x100000
seg1_end:
| sundercode/compilers-homework | assignment5a/Butter.asm | Assembly | apache-2.0 | 62,514 |
page ,132
;*****************************************************************************;
; ;
; FILE NAME: setvect.asm ;
; ;
; DESCRIPTION: Microsoft C library routine _dos_setvect ;
; ;
; NOTES: ;
; ;
; HISTORY: ;
; 1995/08/23 JFL Created this file. ;
; ;
; (c) Copyright 1995-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
INCLUDE ADEFINE.INC ; For the segment definitions
INCLUDE DOS.INC ; For the DOS call macros
.CODE
;-----------------------------------------------------------------------------;
; ;
; Function: _dos_setvect ;
; ;
; Description: Get an interrupt vector ;
; ;
; Parameters: AX Interrupt number ;
; DWORD on stack Handler ;
; ;
; Returns: None ;
; ;
; Notes: Unfortunately, the DWORD argument is passed on the stack ;
; by the _fastcall calling convention, and not in BX:DX as ;
; I initially expected. ;
; ;
; Regs altered: AX, DX ;
; ;
; History: ;
; ;
; 1995/08/23 JFL Created this routine ;
; ;
;-----------------------------------------------------------------------------;
CFASTPROC _dos_setvect
push bp
mov bp, sp
push ds
lds dx, DWORD PTR [bp+4]
mov ah, 25H
int 21H
pop ds
pop bp
ret 4
ENDCFASTPROC _dos_setvect
END
| JFLarvoire/SysToolsLib | C/LoDosLib/setvect.asm | Assembly | apache-2.0 | 1,765 |
global _start
section .data
align 16
float0low:
dd 2147483647.0
float0high:
dd -2147483648.0
float1low:
dd 1235.678
float1high:
dd 1325400064
float2low:
dd -54.321
float2high:
dd -12345.6
float3low:
dd 123.456
float3high:
dd 1234.5678
myaddress:
dd 0xdeadbeef
%include "header.inc"
movaps xmm0, [float0low]
cvttps2pi mm0, xmm0
cvttps2pi mm1, [float1low]
cvttps2pi mm2, [float2low]
cvttps2pi mm3, [float3low]
%include "footer.inc"
| copy/v86 | tests/nasm/cvttps2pi.asm | Assembly | bsd-2-clause | 458 |
;Este es un comentario, se le antecede un punto y coma
list p=18f4550 ;Modelo del microcontrolador
#include <p18f4550.inc> ;Llamada a la librería de nombre de los registros
;Directivas de preprocesador o bits de configuración
CONFIG PLLDIV = 1 ; PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
CONFIG CPUDIV = OSC1_PLL2 ; System Clock Postscaler Selection bits ([Primary Oscillator Src: /1][96 MHz PLL Src: /2])
CONFIG FOSC = XT_XT ; Oscillator Selection bits (XT oscillator (XT))
CONFIG PWRT = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG BOR = OFF ; Brown-out Reset Enable bits (Brown-out Reset disabled in hardware and software)
CONFIG WDT = OFF ; Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit))
CONFIG CCP2MX = ON ; CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
CONFIG PBADEN = OFF ; PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
CONFIG MCLRE = ON ; MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
CONFIG LVP = OFF ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
org 0x0000
goto init_conf
org 0x0008
goto TMR0_ISR
init_conf: movlw 0x0F
movwf ADCON1 ;Desactivando todos las I/O analógicas
clrf TRISE, 0 ;RE0 como salida
movlw 0x81
movwf T0CON ;Tmr0: FOSC/4, PSC 1:4, 16bit mode
movlw 0x0B
movwf TMR0H
movlw 0xDC
movwf TMR0L ;Cuenta inicial de Timer0
movlw 0xA0
movwf INTCON ;Interrupciones habilitadas para Timer0 (GIE=1, TMR0IE=1)
loop: nop
goto loop
TMR0_ISR: btfss PORTB, 0 ;Pregunto por RB0
goto falso
btg LATE, 0 ;Basculo RE0
goto otro
falso: bcf LATE, 0 ;RE0=0
otro: movlw 0x0B
movwf TMR0H
movlw 0xDC
movwf TMR0L ;Carga de cuenta inicial 3036 a TMR0
bcf INTCON, TMR0IF ;Bajo la bandera de desborde del TMR0
retfie
end | tocache/picomones | UPC Microcontroladores 2021-1/Semana 07/20211_ls5a_cuadrada_tmr0_1k.X/20211_tmr0_int_titi_a.X/maincode.asm | Assembly | cc0-1.0 | 2,104 |
;******************************************************************************
;* SIMD-optimized halfpel functions for VP3
;*
;* 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 .text
; void ff_put_no_rnd_pixels8_x2_exact(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
%macro PUT_NO_RND_PIXELS8_X2_EXACT 0
cglobal put_no_rnd_pixels8_x2_exact, 4,5
lea r4, [r2*3]
pcmpeqb m6, m6
.loop:
mova m0, [r1]
mova m2, [r1+r2]
mova m1, [r1+1]
mova m3, [r1+r2+1]
pxor m0, m6
pxor m2, m6
pxor m1, m6
pxor m3, m6
PAVGB m0, m1
PAVGB m2, m3
pxor m0, m6
pxor m2, m6
mova [r0], m0
mova [r0+r2], m2
mova m0, [r1+r2*2]
mova m1, [r1+r2*2+1]
mova m2, [r1+r4]
mova m3, [r1+r4+1]
pxor m0, m6
pxor m1, m6
pxor m2, m6
pxor m3, m6
PAVGB m0, m1
PAVGB m2, m3
pxor m0, m6
pxor m2, m6
mova [r0+r2*2], m0
mova [r0+r4], m2
lea r1, [r1+r2*4]
lea r0, [r0+r2*4]
sub r3d, 4
jg .loop
REP_RET
%endmacro
INIT_MMX mmxext
PUT_NO_RND_PIXELS8_X2_EXACT
INIT_MMX 3dnow
PUT_NO_RND_PIXELS8_X2_EXACT
; void ff_put_no_rnd_pixels8_y2_exact(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
%macro PUT_NO_RND_PIXELS8_Y2_EXACT 0
cglobal put_no_rnd_pixels8_y2_exact, 4,5
lea r4, [r2*3]
mova m0, [r1]
pcmpeqb m6, m6
add r1, r2
pxor m0, m6
.loop:
mova m1, [r1]
mova m2, [r1+r2]
pxor m1, m6
pxor m2, m6
PAVGB m0, m1
PAVGB m1, m2
pxor m0, m6
pxor m1, m6
mova [r0], m0
mova [r0+r2], m1
mova m1, [r1+r2*2]
mova m0, [r1+r4]
pxor m1, m6
pxor m0, m6
PAVGB m2, m1
PAVGB m1, m0
pxor m2, m6
pxor m1, m6
mova [r0+r2*2], m2
mova [r0+r4], m1
lea r1, [r1+r2*4]
lea r0, [r0+r2*4]
sub r3d, 4
jg .loop
REP_RET
%endmacro
INIT_MMX mmxext
PUT_NO_RND_PIXELS8_Y2_EXACT
INIT_MMX 3dnow
PUT_NO_RND_PIXELS8_Y2_EXACT
| endlessm/chromium-browser | third_party/ffmpeg/libavcodec/x86/hpeldsp_vp3.asm | Assembly | bsd-3-clause | 3,210 |
;
; jcgray.asm - grayscale colorspace conversion (64-bit SSE2)
;
; Copyright (C) 2011, 2016, D. R. Commander.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
%include "jsimdext.inc"
; --------------------------------------------------------------------------
%define SCALEBITS 16
F_0_114 equ 7471 ; FIX(0.11400)
F_0_250 equ 16384 ; FIX(0.25000)
F_0_299 equ 19595 ; FIX(0.29900)
F_0_587 equ 38470 ; FIX(0.58700)
F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000)
; --------------------------------------------------------------------------
SECTION SEG_CONST
alignz 32
GLOBAL_DATA(jconst_rgb_gray_convert_sse2)
EXTN(jconst_rgb_gray_convert_sse2):
PW_F0299_F0337 times 4 dw F_0_299, F_0_337
PW_F0114_F0250 times 4 dw F_0_114, F_0_250
PD_ONEHALF times 4 dd (1 << (SCALEBITS - 1))
alignz 32
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 64
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_RGB_RED
%define RGB_GREEN EXT_RGB_GREEN
%define RGB_BLUE EXT_RGB_BLUE
%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_RGBX_RED
%define RGB_GREEN EXT_RGBX_GREEN
%define RGB_BLUE EXT_RGBX_BLUE
%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_BGR_RED
%define RGB_GREEN EXT_BGR_GREEN
%define RGB_BLUE EXT_BGR_BLUE
%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_BGRX_RED
%define RGB_GREEN EXT_BGRX_GREEN
%define RGB_BLUE EXT_BGRX_BLUE
%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_XBGR_RED
%define RGB_GREEN EXT_XBGR_GREEN
%define RGB_BLUE EXT_XBGR_BLUE
%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2
%include "jcgryext-sse2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
%define RGB_RED EXT_XRGB_RED
%define RGB_GREEN EXT_XRGB_GREEN
%define RGB_BLUE EXT_XRGB_BLUE
%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2
%include "jcgryext-sse2.asm"
| youtube/cobalt | third_party/libjpeg-turbo/simd/x86_64/jcgray-sse2.asm | Assembly | bsd-3-clause | 3,312 |
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
;; See the LICENSE file in the project root for more information.
include AsmMacros.inc
;; Macro used to copy contents of newly updated GC heap locations to a shadow copy of the heap. This is used
;; during garbage collections to verify that object references where never written to the heap without using a
;; write barrier. Note that we're potentially racing to update the shadow heap while other threads are writing
;; new references to the real heap. Since this can't be solved perfectly without critical sections around the
;; entire update process, we instead update the shadow location and then re-check the real location (as two
;; ordered operations) and if there is a disparity we'll re-write the shadow location with a special value
;; (INVALIDGCVALUE) which disables the check for that location. Since the shadow heap is only validated at GC
;; time and these write barrier operations are atomic wrt to GCs this is sufficient to guarantee that the
;; shadow heap contains only valid copies of real heap values or INVALIDGCVALUE.
ifdef WRITE_BARRIER_CHECK
g_GCShadow TEXTEQU <?g_GCShadow@@3PEAEEA>
g_GCShadowEnd TEXTEQU <?g_GCShadowEnd@@3PEAEEA>
INVALIDGCVALUE EQU 0CCCCCCCDh
EXTERN g_GCShadow : QWORD
EXTERN g_GCShadowEnd : QWORD
UPDATE_GC_SHADOW macro BASENAME, REFREG, DESTREG
;; If g_GCShadow is 0, don't perform the check.
cmp g_GCShadow, 0
je &BASENAME&_UpdateShadowHeap_Done_&REFREG&
;; Save DESTREG since we're about to modify it (and we need the original value both within the macro and
;; once we exit the macro). Note that this is naughty since we're altering the stack pointer outside of
;; the prolog inside a method without a frame. But given that this is only debug code and generally we
;; shouldn't be walking the stack at this point it seems preferable to recoding the all the barrier
;; variants to set up frames. Unlike RhpBulkWriteBarrier below which is treated as a helper call using the
;; usual calling convention, the compiler knows exactly which registers are trashed in the simple write
;; barrier case, so we don't have any more scratch registers to play with (and doing so would only make
;; things harder if at a later stage we want to allow multiple barrier versions based on the input
;; registers).
push DESTREG
;; Transform DESTREG into the equivalent address in the shadow heap.
sub DESTREG, g_lowest_address
jb &BASENAME&_UpdateShadowHeap_PopThenDone_&REFREG&
add DESTREG, [g_GCShadow]
cmp DESTREG, [g_GCShadowEnd]
ja &BASENAME&_UpdateShadowHeap_PopThenDone_&REFREG&
;; Update the shadow heap.
mov [DESTREG], REFREG
;; Now check that the real heap location still contains the value we just wrote into the shadow heap. This
;; read must be strongly ordered wrt to the previous write to prevent race conditions. We also need to
;; recover the old value of DESTREG for the comparison so use an xchg instruction (which has an implicit lock
;; prefix).
xchg [rsp], DESTREG
cmp [DESTREG], REFREG
jne &BASENAME&_UpdateShadowHeap_Invalidate_&REFREG&
;; The original DESTREG value is now restored but the stack has a value (the shadow version of the
;; location) pushed. Need to discard this push before we are done.
add rsp, 8
jmp &BASENAME&_UpdateShadowHeap_Done_&REFREG&
&BASENAME&_UpdateShadowHeap_Invalidate_&REFREG&:
;; Someone went and updated the real heap. We need to invalidate the shadow location since we can't
;; guarantee whose shadow update won.
;; Retrieve shadow location from the stack and restore original DESTREG to the stack. This is an
;; additional memory barrier we don't require but it's on the rare path and x86 doesn't have an xchg
;; variant that doesn't implicitly specify the lock prefix. Note that INVALIDGCVALUE is a 64-bit
;; immediate and therefore must be moved into a register before it can be written to the shadow
;; location.
xchg [rsp], DESTREG
push REFREG
mov REFREG, INVALIDGCVALUE
mov qword ptr [DESTREG], REFREG
pop REFREG
&BASENAME&_UpdateShadowHeap_PopThenDone_&REFREG&:
;; Restore original DESTREG value from the stack.
pop DESTREG
&BASENAME&_UpdateShadowHeap_Done_&REFREG&:
endm
else ; WRITE_BARRIER_CHECK
UPDATE_GC_SHADOW macro BASENAME, REFREG, DESTREG
endm
endif ; WRITE_BARRIER_CHECK
;; There are several different helpers used depending on which register holds the object reference. Since all
;; the helpers have identical structure we use a macro to define this structure. Two arguments are taken, the
;; name of the register that points to the location to be updated and the name of the register that holds the
;; object reference (this should be in upper case as it's used in the definition of the name of the helper).
DEFINE_UNCHECKED_WRITE_BARRIER_CORE macro BASENAME, REFREG
;; Update the shadow copy of the heap with the same value just written to the same heap. (A no-op unless
;; we're in a debug build and write barrier checking has been enabled).
UPDATE_GC_SHADOW BASENAME, REFREG, rcx
;; If the reference is to an object that's not in an ephemeral generation we have no need to track it
;; (since the object won't be collected or moved by an ephemeral collection).
cmp REFREG, [g_ephemeral_low]
jb &BASENAME&_NoBarrierRequired_&REFREG&
cmp REFREG, [g_ephemeral_high]
jae &BASENAME&_NoBarrierRequired_&REFREG&
;; We have a location on the GC heap being updated with a reference to an ephemeral object so we must
;; track this write. The location address is translated into an offset in the card table bitmap. We set
;; an entire byte in the card table since it's quicker than messing around with bitmasks and we only write
;; the byte if it hasn't already been done since writes are expensive and impact scaling.
shr rcx, 11
add rcx, [g_card_table]
cmp byte ptr [rcx], 0FFh
jne &BASENAME&_UpdateCardTable_&REFREG&
&BASENAME&_NoBarrierRequired_&REFREG&:
ret
;; We get here if it's necessary to update the card table.
&BASENAME&_UpdateCardTable_&REFREG&:
mov byte ptr [rcx], 0FFh
ret
endm
;; There are several different helpers used depending on which register holds the object reference. Since all
;; the helpers have identical structure we use a macro to define this structure. One argument is taken, the
;; name of the register that will hold the object reference (this should be in upper case as it's used in the
;; definition of the name of the helper).
DEFINE_UNCHECKED_WRITE_BARRIER macro REFREG, EXPORT_REG_NAME
;; Define a helper with a name of the form RhpAssignRefEAX etc. (along with suitable calling standard
;; decoration). The location to be updated is in DESTREG. The object reference that will be assigned into that
;; location is in one of the other general registers determined by the value of REFREG.
;; WARNING: Code in EHHelpers.cpp makes assumptions about write barrier code, in particular:
;; - Function "InWriteBarrierHelper" assumes an AV due to passed in null pointer will happen on the first instruction
;; - Function "UnwindWriteBarrierToCaller" assumes the stack contains just the pushed return address
LEAF_ENTRY RhpAssignRef&EXPORT_REG_NAME&, _TEXT
;; Export the canonical write barrier under unqualified name as well
ifidni <REFREG>, <RDX>
ALTERNATE_ENTRY RhpAssignRef
ALTERNATE_ENTRY RhpAssignRefAVLocation
endif
;; Write the reference into the location. Note that we rely on the fact that no GC can occur between here
;; and the card table update we may perform below.
mov qword ptr [rcx], REFREG
DEFINE_UNCHECKED_WRITE_BARRIER_CORE RhpAssignRef, REFREG
LEAF_END RhpAssignRef&EXPORT_REG_NAME&, _TEXT
endm
;; One day we might have write barriers for all the possible argument registers but for now we have
;; just one write barrier that assumes the input register is RDX.
DEFINE_UNCHECKED_WRITE_BARRIER RDX, EDX
;;
;; Define the helpers used to implement the write barrier required when writing an object reference into a
;; location residing on the GC heap. Such write barriers allow the GC to optimize which objects in
;; non-ephemeral generations need to be scanned for references to ephemeral objects during an ephemeral
;; collection.
;;
DEFINE_CHECKED_WRITE_BARRIER_CORE macro BASENAME, REFREG
;; The location being updated might not even lie in the GC heap (a handle or stack location for instance),
;; in which case no write barrier is required.
cmp rcx, [g_lowest_address]
jb &BASENAME&_NoBarrierRequired_&REFREG&
cmp rcx, [g_highest_address]
jae &BASENAME&_NoBarrierRequired_&REFREG&
DEFINE_UNCHECKED_WRITE_BARRIER_CORE BASENAME, REFREG
endm
;; There are several different helpers used depending on which register holds the object reference. Since all
;; the helpers have identical structure we use a macro to define this structure. One argument is taken, the
;; name of the register that will hold the object reference (this should be in upper case as it's used in the
;; definition of the name of the helper).
DEFINE_CHECKED_WRITE_BARRIER macro REFREG, EXPORT_REG_NAME
;; Define a helper with a name of the form RhpCheckedAssignRefEAX etc. (along with suitable calling standard
;; decoration). The location to be updated is always in RCX. The object reference that will be assigned into
;; that location is in one of the other general registers determined by the value of REFREG.
;; WARNING: Code in EHHelpers.cpp makes assumptions about write barrier code, in particular:
;; - Function "InWriteBarrierHelper" assumes an AV due to passed in null pointer will happen on the first instruction
;; - Function "UnwindWriteBarrierToCaller" assumes the stack contains just the pushed return address
LEAF_ENTRY RhpCheckedAssignRef&EXPORT_REG_NAME&, _TEXT
;; Export the canonical write barrier under unqualified name as well
ifidni <REFREG>, <RDX>
ALTERNATE_ENTRY RhpCheckedAssignRef
ALTERNATE_ENTRY RhpCheckedAssignRefAVLocation
endif
;; Write the reference into the location. Note that we rely on the fact that no GC can occur between here
;; and the card table update we may perform below.
mov qword ptr [rcx], REFREG
DEFINE_CHECKED_WRITE_BARRIER_CORE RhpCheckedAssignRef, REFREG
LEAF_END RhpCheckedAssignRef&EXPORT_REG_NAME&, _TEXT
endm
;; One day we might have write barriers for all the possible argument registers but for now we have
;; just one write barrier that assumes the input register is RDX.
DEFINE_CHECKED_WRITE_BARRIER RDX, EDX
;; WARNING: Code in EHHelpers.cpp makes assumptions about write barrier code, in particular:
;; - Function "InWriteBarrierHelper" assumes an AV due to passed in null pointer will happen at RhpCheckedLockCmpXchgAVLocation
;; - Function "UnwindWriteBarrierToCaller" assumes the stack contains just the pushed return address
LEAF_ENTRY RhpCheckedLockCmpXchg, _TEXT
mov rax, r8
ALTERNATE_ENTRY RhpCheckedLockCmpXchgAVLocation
lock cmpxchg [rcx], rdx
jne RhpCheckedLockCmpXchg_NoBarrierRequired_RDX
DEFINE_CHECKED_WRITE_BARRIER_CORE RhpCheckedLockCmpXchg, RDX
LEAF_END RhpCheckedLockCmpXchg, _TEXT
;; WARNING: Code in EHHelpers.cpp makes assumptions about write barrier code, in particular:
;; - Function "InWriteBarrierHelper" assumes an AV due to passed in null pointer will happen at RhpCheckedXchgAVLocation
;; - Function "UnwindWriteBarrierToCaller" assumes the stack contains just the pushed return address
LEAF_ENTRY RhpCheckedXchg, _TEXT
;; Setup rax with the new object for the exchange, that way it will automatically hold the correct result
;; afterwards and we can leave rdx unaltered ready for the GC write barrier below.
mov rax, rdx
ALTERNATE_ENTRY RhpCheckedXchgAVLocation
xchg [rcx], rax
DEFINE_CHECKED_WRITE_BARRIER_CORE RhpCheckedXchg, RDX
LEAF_END RhpCheckedXchg, _TEXT
;;
;; RhpByRefAssignRef simulates movs instruction for object references.
;;
;; On entry:
;; rdi: address of ref-field (assigned to)
;; rsi: address of the data (source)
;; rcx: be trashed
;;
;; On exit:
;; rdi, rsi are incremented by 8,
;; rcx: trashed
;;
LEAF_ENTRY RhpByRefAssignRef, _TEXT
mov rcx, [rsi]
mov [rdi], rcx
;; Check whether the writes were even into the heap. If not there's no card update required.
cmp rdi, [g_lowest_address]
jb RhpByRefAssignRef_NotInHeap
cmp rdi, [g_highest_address]
jae RhpByRefAssignRef_NotInHeap
;; Update the shadow copy of the heap with the same value just written to the same heap. (A no-op unless
;; we're in a debug build and write barrier checking has been enabled).
UPDATE_GC_SHADOW BASENAME, rcx, rdi
;; If the reference is to an object that's not in an ephemeral generation we have no need to track it
;; (since the object won't be collected or moved by an ephemeral collection).
cmp rcx, [g_ephemeral_low]
jb RhpByRefAssignRef_NotInHeap
cmp rcx, [g_ephemeral_high]
jae RhpByRefAssignRef_NotInHeap
;; move current rdi value into rcx and then increment the pointers
mov rcx, rdi
add rsi, 8h
add rdi, 8h
;; We have a location on the GC heap being updated with a reference to an ephemeral object so we must
;; track this write. The location address is translated into an offset in the card table bitmap. We set
;; an entire byte in the card table since it's quicker than messing around with bitmasks and we only write
;; the byte if it hasn't already been done since writes are expensive and impact scaling.
shr rcx, 11
add rcx, [g_card_table]
cmp byte ptr [rcx], 0FFh
jne RhpByRefAssignRef_UpdateCardTable
ret
;; We get here if it's necessary to update the card table.
RhpByRefAssignRef_UpdateCardTable:
mov byte ptr [rcx], 0FFh
ret
RhpByRefAssignRef_NotInHeap:
; Increment the pointers before leaving
add rdi, 8h
add rsi, 8h
ret
LEAF_END RhpByRefAssignRef, _TEXT
end
| zenos-os/zenos | vendor/corert/src/Native/Runtime/amd64/WriteBarriers.asm | Assembly | mit | 14,438 |
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.1.0 #7066 (Nov 22 2011) (MINGW32)
; This file was generated Sat Jan 23 21:06:10 2016
;--------------------------------------------------------
.module gpio
.optsdcc -mmcs51 --model-medium
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _setDigitalOutput
.globl _setDigitalInput
.globl _isPinHigh
.globl _setPort0PullType
.globl _setPort1PullType
.globl _setPort2PullType
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
Fgpio$P0$0$0 == 0x0080
_P0 = 0x0080
Fgpio$SP$0$0 == 0x0081
_SP = 0x0081
Fgpio$DPL0$0$0 == 0x0082
_DPL0 = 0x0082
Fgpio$DPH0$0$0 == 0x0083
_DPH0 = 0x0083
Fgpio$DPL1$0$0 == 0x0084
_DPL1 = 0x0084
Fgpio$DPH1$0$0 == 0x0085
_DPH1 = 0x0085
Fgpio$U0CSR$0$0 == 0x0086
_U0CSR = 0x0086
Fgpio$PCON$0$0 == 0x0087
_PCON = 0x0087
Fgpio$TCON$0$0 == 0x0088
_TCON = 0x0088
Fgpio$P0IFG$0$0 == 0x0089
_P0IFG = 0x0089
Fgpio$P1IFG$0$0 == 0x008a
_P1IFG = 0x008a
Fgpio$P2IFG$0$0 == 0x008b
_P2IFG = 0x008b
Fgpio$PICTL$0$0 == 0x008c
_PICTL = 0x008c
Fgpio$P1IEN$0$0 == 0x008d
_P1IEN = 0x008d
Fgpio$P0INP$0$0 == 0x008f
_P0INP = 0x008f
Fgpio$P1$0$0 == 0x0090
_P1 = 0x0090
Fgpio$RFIM$0$0 == 0x0091
_RFIM = 0x0091
Fgpio$DPS$0$0 == 0x0092
_DPS = 0x0092
Fgpio$MPAGE$0$0 == 0x0093
_MPAGE = 0x0093
Fgpio$ENDIAN$0$0 == 0x0095
_ENDIAN = 0x0095
Fgpio$S0CON$0$0 == 0x0098
_S0CON = 0x0098
Fgpio$IEN2$0$0 == 0x009a
_IEN2 = 0x009a
Fgpio$S1CON$0$0 == 0x009b
_S1CON = 0x009b
Fgpio$T2CT$0$0 == 0x009c
_T2CT = 0x009c
Fgpio$T2PR$0$0 == 0x009d
_T2PR = 0x009d
Fgpio$T2CTL$0$0 == 0x009e
_T2CTL = 0x009e
Fgpio$P2$0$0 == 0x00a0
_P2 = 0x00a0
Fgpio$WORIRQ$0$0 == 0x00a1
_WORIRQ = 0x00a1
Fgpio$WORCTRL$0$0 == 0x00a2
_WORCTRL = 0x00a2
Fgpio$WOREVT0$0$0 == 0x00a3
_WOREVT0 = 0x00a3
Fgpio$WOREVT1$0$0 == 0x00a4
_WOREVT1 = 0x00a4
Fgpio$WORTIME0$0$0 == 0x00a5
_WORTIME0 = 0x00a5
Fgpio$WORTIME1$0$0 == 0x00a6
_WORTIME1 = 0x00a6
Fgpio$IEN0$0$0 == 0x00a8
_IEN0 = 0x00a8
Fgpio$IP0$0$0 == 0x00a9
_IP0 = 0x00a9
Fgpio$FWT$0$0 == 0x00ab
_FWT = 0x00ab
Fgpio$FADDRL$0$0 == 0x00ac
_FADDRL = 0x00ac
Fgpio$FADDRH$0$0 == 0x00ad
_FADDRH = 0x00ad
Fgpio$FCTL$0$0 == 0x00ae
_FCTL = 0x00ae
Fgpio$FWDATA$0$0 == 0x00af
_FWDATA = 0x00af
Fgpio$ENCDI$0$0 == 0x00b1
_ENCDI = 0x00b1
Fgpio$ENCDO$0$0 == 0x00b2
_ENCDO = 0x00b2
Fgpio$ENCCS$0$0 == 0x00b3
_ENCCS = 0x00b3
Fgpio$ADCCON1$0$0 == 0x00b4
_ADCCON1 = 0x00b4
Fgpio$ADCCON2$0$0 == 0x00b5
_ADCCON2 = 0x00b5
Fgpio$ADCCON3$0$0 == 0x00b6
_ADCCON3 = 0x00b6
Fgpio$IEN1$0$0 == 0x00b8
_IEN1 = 0x00b8
Fgpio$IP1$0$0 == 0x00b9
_IP1 = 0x00b9
Fgpio$ADCL$0$0 == 0x00ba
_ADCL = 0x00ba
Fgpio$ADCH$0$0 == 0x00bb
_ADCH = 0x00bb
Fgpio$RNDL$0$0 == 0x00bc
_RNDL = 0x00bc
Fgpio$RNDH$0$0 == 0x00bd
_RNDH = 0x00bd
Fgpio$SLEEP$0$0 == 0x00be
_SLEEP = 0x00be
Fgpio$IRCON$0$0 == 0x00c0
_IRCON = 0x00c0
Fgpio$U0DBUF$0$0 == 0x00c1
_U0DBUF = 0x00c1
Fgpio$U0BAUD$0$0 == 0x00c2
_U0BAUD = 0x00c2
Fgpio$U0UCR$0$0 == 0x00c4
_U0UCR = 0x00c4
Fgpio$U0GCR$0$0 == 0x00c5
_U0GCR = 0x00c5
Fgpio$CLKCON$0$0 == 0x00c6
_CLKCON = 0x00c6
Fgpio$MEMCTR$0$0 == 0x00c7
_MEMCTR = 0x00c7
Fgpio$WDCTL$0$0 == 0x00c9
_WDCTL = 0x00c9
Fgpio$T3CNT$0$0 == 0x00ca
_T3CNT = 0x00ca
Fgpio$T3CTL$0$0 == 0x00cb
_T3CTL = 0x00cb
Fgpio$T3CCTL0$0$0 == 0x00cc
_T3CCTL0 = 0x00cc
Fgpio$T3CC0$0$0 == 0x00cd
_T3CC0 = 0x00cd
Fgpio$T3CCTL1$0$0 == 0x00ce
_T3CCTL1 = 0x00ce
Fgpio$T3CC1$0$0 == 0x00cf
_T3CC1 = 0x00cf
Fgpio$PSW$0$0 == 0x00d0
_PSW = 0x00d0
Fgpio$DMAIRQ$0$0 == 0x00d1
_DMAIRQ = 0x00d1
Fgpio$DMA1CFGL$0$0 == 0x00d2
_DMA1CFGL = 0x00d2
Fgpio$DMA1CFGH$0$0 == 0x00d3
_DMA1CFGH = 0x00d3
Fgpio$DMA0CFGL$0$0 == 0x00d4
_DMA0CFGL = 0x00d4
Fgpio$DMA0CFGH$0$0 == 0x00d5
_DMA0CFGH = 0x00d5
Fgpio$DMAARM$0$0 == 0x00d6
_DMAARM = 0x00d6
Fgpio$DMAREQ$0$0 == 0x00d7
_DMAREQ = 0x00d7
Fgpio$TIMIF$0$0 == 0x00d8
_TIMIF = 0x00d8
Fgpio$RFD$0$0 == 0x00d9
_RFD = 0x00d9
Fgpio$T1CC0L$0$0 == 0x00da
_T1CC0L = 0x00da
Fgpio$T1CC0H$0$0 == 0x00db
_T1CC0H = 0x00db
Fgpio$T1CC1L$0$0 == 0x00dc
_T1CC1L = 0x00dc
Fgpio$T1CC1H$0$0 == 0x00dd
_T1CC1H = 0x00dd
Fgpio$T1CC2L$0$0 == 0x00de
_T1CC2L = 0x00de
Fgpio$T1CC2H$0$0 == 0x00df
_T1CC2H = 0x00df
Fgpio$ACC$0$0 == 0x00e0
_ACC = 0x00e0
Fgpio$RFST$0$0 == 0x00e1
_RFST = 0x00e1
Fgpio$T1CNTL$0$0 == 0x00e2
_T1CNTL = 0x00e2
Fgpio$T1CNTH$0$0 == 0x00e3
_T1CNTH = 0x00e3
Fgpio$T1CTL$0$0 == 0x00e4
_T1CTL = 0x00e4
Fgpio$T1CCTL0$0$0 == 0x00e5
_T1CCTL0 = 0x00e5
Fgpio$T1CCTL1$0$0 == 0x00e6
_T1CCTL1 = 0x00e6
Fgpio$T1CCTL2$0$0 == 0x00e7
_T1CCTL2 = 0x00e7
Fgpio$IRCON2$0$0 == 0x00e8
_IRCON2 = 0x00e8
Fgpio$RFIF$0$0 == 0x00e9
_RFIF = 0x00e9
Fgpio$T4CNT$0$0 == 0x00ea
_T4CNT = 0x00ea
Fgpio$T4CTL$0$0 == 0x00eb
_T4CTL = 0x00eb
Fgpio$T4CCTL0$0$0 == 0x00ec
_T4CCTL0 = 0x00ec
Fgpio$T4CC0$0$0 == 0x00ed
_T4CC0 = 0x00ed
Fgpio$T4CCTL1$0$0 == 0x00ee
_T4CCTL1 = 0x00ee
Fgpio$T4CC1$0$0 == 0x00ef
_T4CC1 = 0x00ef
Fgpio$B$0$0 == 0x00f0
_B = 0x00f0
Fgpio$PERCFG$0$0 == 0x00f1
_PERCFG = 0x00f1
Fgpio$ADCCFG$0$0 == 0x00f2
_ADCCFG = 0x00f2
Fgpio$P0SEL$0$0 == 0x00f3
_P0SEL = 0x00f3
Fgpio$P1SEL$0$0 == 0x00f4
_P1SEL = 0x00f4
Fgpio$P2SEL$0$0 == 0x00f5
_P2SEL = 0x00f5
Fgpio$P1INP$0$0 == 0x00f6
_P1INP = 0x00f6
Fgpio$P2INP$0$0 == 0x00f7
_P2INP = 0x00f7
Fgpio$U1CSR$0$0 == 0x00f8
_U1CSR = 0x00f8
Fgpio$U1DBUF$0$0 == 0x00f9
_U1DBUF = 0x00f9
Fgpio$U1BAUD$0$0 == 0x00fa
_U1BAUD = 0x00fa
Fgpio$U1UCR$0$0 == 0x00fb
_U1UCR = 0x00fb
Fgpio$U1GCR$0$0 == 0x00fc
_U1GCR = 0x00fc
Fgpio$P0DIR$0$0 == 0x00fd
_P0DIR = 0x00fd
Fgpio$P1DIR$0$0 == 0x00fe
_P1DIR = 0x00fe
Fgpio$P2DIR$0$0 == 0x00ff
_P2DIR = 0x00ff
Fgpio$DMA0CFG$0$0 == 0xffffd5d4
_DMA0CFG = 0xffffd5d4
Fgpio$DMA1CFG$0$0 == 0xffffd3d2
_DMA1CFG = 0xffffd3d2
Fgpio$FADDR$0$0 == 0xffffadac
_FADDR = 0xffffadac
Fgpio$ADC$0$0 == 0xffffbbba
_ADC = 0xffffbbba
Fgpio$T1CC0$0$0 == 0xffffdbda
_T1CC0 = 0xffffdbda
Fgpio$T1CC1$0$0 == 0xffffdddc
_T1CC1 = 0xffffdddc
Fgpio$T1CC2$0$0 == 0xffffdfde
_T1CC2 = 0xffffdfde
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
Fgpio$P0_0$0$0 == 0x0080
_P0_0 = 0x0080
Fgpio$P0_1$0$0 == 0x0081
_P0_1 = 0x0081
Fgpio$P0_2$0$0 == 0x0082
_P0_2 = 0x0082
Fgpio$P0_3$0$0 == 0x0083
_P0_3 = 0x0083
Fgpio$P0_4$0$0 == 0x0084
_P0_4 = 0x0084
Fgpio$P0_5$0$0 == 0x0085
_P0_5 = 0x0085
Fgpio$P0_6$0$0 == 0x0086
_P0_6 = 0x0086
Fgpio$P0_7$0$0 == 0x0087
_P0_7 = 0x0087
Fgpio$_TCON_0$0$0 == 0x0088
__TCON_0 = 0x0088
Fgpio$RFTXRXIF$0$0 == 0x0089
_RFTXRXIF = 0x0089
Fgpio$_TCON_2$0$0 == 0x008a
__TCON_2 = 0x008a
Fgpio$URX0IF$0$0 == 0x008b
_URX0IF = 0x008b
Fgpio$_TCON_4$0$0 == 0x008c
__TCON_4 = 0x008c
Fgpio$ADCIF$0$0 == 0x008d
_ADCIF = 0x008d
Fgpio$_TCON_6$0$0 == 0x008e
__TCON_6 = 0x008e
Fgpio$URX1IF$0$0 == 0x008f
_URX1IF = 0x008f
Fgpio$P1_0$0$0 == 0x0090
_P1_0 = 0x0090
Fgpio$P1_1$0$0 == 0x0091
_P1_1 = 0x0091
Fgpio$P1_2$0$0 == 0x0092
_P1_2 = 0x0092
Fgpio$P1_3$0$0 == 0x0093
_P1_3 = 0x0093
Fgpio$P1_4$0$0 == 0x0094
_P1_4 = 0x0094
Fgpio$P1_5$0$0 == 0x0095
_P1_5 = 0x0095
Fgpio$P1_6$0$0 == 0x0096
_P1_6 = 0x0096
Fgpio$P1_7$0$0 == 0x0097
_P1_7 = 0x0097
Fgpio$ENCIF_0$0$0 == 0x0098
_ENCIF_0 = 0x0098
Fgpio$ENCIF_1$0$0 == 0x0099
_ENCIF_1 = 0x0099
Fgpio$_SOCON2$0$0 == 0x009a
__SOCON2 = 0x009a
Fgpio$_SOCON3$0$0 == 0x009b
__SOCON3 = 0x009b
Fgpio$_SOCON4$0$0 == 0x009c
__SOCON4 = 0x009c
Fgpio$_SOCON5$0$0 == 0x009d
__SOCON5 = 0x009d
Fgpio$_SOCON6$0$0 == 0x009e
__SOCON6 = 0x009e
Fgpio$_SOCON7$0$0 == 0x009f
__SOCON7 = 0x009f
Fgpio$P2_0$0$0 == 0x00a0
_P2_0 = 0x00a0
Fgpio$P2_1$0$0 == 0x00a1
_P2_1 = 0x00a1
Fgpio$P2_2$0$0 == 0x00a2
_P2_2 = 0x00a2
Fgpio$P2_3$0$0 == 0x00a3
_P2_3 = 0x00a3
Fgpio$P2_4$0$0 == 0x00a4
_P2_4 = 0x00a4
Fgpio$P2_5$0$0 == 0x00a5
_P2_5 = 0x00a5
Fgpio$P2_6$0$0 == 0x00a6
_P2_6 = 0x00a6
Fgpio$P2_7$0$0 == 0x00a7
_P2_7 = 0x00a7
Fgpio$RFTXRXIE$0$0 == 0x00a8
_RFTXRXIE = 0x00a8
Fgpio$ADCIE$0$0 == 0x00a9
_ADCIE = 0x00a9
Fgpio$URX0IE$0$0 == 0x00aa
_URX0IE = 0x00aa
Fgpio$URX1IE$0$0 == 0x00ab
_URX1IE = 0x00ab
Fgpio$ENCIE$0$0 == 0x00ac
_ENCIE = 0x00ac
Fgpio$STIE$0$0 == 0x00ad
_STIE = 0x00ad
Fgpio$_IEN06$0$0 == 0x00ae
__IEN06 = 0x00ae
Fgpio$EA$0$0 == 0x00af
_EA = 0x00af
Fgpio$DMAIE$0$0 == 0x00b8
_DMAIE = 0x00b8
Fgpio$T1IE$0$0 == 0x00b9
_T1IE = 0x00b9
Fgpio$T2IE$0$0 == 0x00ba
_T2IE = 0x00ba
Fgpio$T3IE$0$0 == 0x00bb
_T3IE = 0x00bb
Fgpio$T4IE$0$0 == 0x00bc
_T4IE = 0x00bc
Fgpio$P0IE$0$0 == 0x00bd
_P0IE = 0x00bd
Fgpio$_IEN16$0$0 == 0x00be
__IEN16 = 0x00be
Fgpio$_IEN17$0$0 == 0x00bf
__IEN17 = 0x00bf
Fgpio$DMAIF$0$0 == 0x00c0
_DMAIF = 0x00c0
Fgpio$T1IF$0$0 == 0x00c1
_T1IF = 0x00c1
Fgpio$T2IF$0$0 == 0x00c2
_T2IF = 0x00c2
Fgpio$T3IF$0$0 == 0x00c3
_T3IF = 0x00c3
Fgpio$T4IF$0$0 == 0x00c4
_T4IF = 0x00c4
Fgpio$P0IF$0$0 == 0x00c5
_P0IF = 0x00c5
Fgpio$_IRCON6$0$0 == 0x00c6
__IRCON6 = 0x00c6
Fgpio$STIF$0$0 == 0x00c7
_STIF = 0x00c7
Fgpio$P$0$0 == 0x00d0
_P = 0x00d0
Fgpio$F1$0$0 == 0x00d1
_F1 = 0x00d1
Fgpio$OV$0$0 == 0x00d2
_OV = 0x00d2
Fgpio$RS0$0$0 == 0x00d3
_RS0 = 0x00d3
Fgpio$RS1$0$0 == 0x00d4
_RS1 = 0x00d4
Fgpio$F0$0$0 == 0x00d5
_F0 = 0x00d5
Fgpio$AC$0$0 == 0x00d6
_AC = 0x00d6
Fgpio$CY$0$0 == 0x00d7
_CY = 0x00d7
Fgpio$T3OVFIF$0$0 == 0x00d8
_T3OVFIF = 0x00d8
Fgpio$T3CH0IF$0$0 == 0x00d9
_T3CH0IF = 0x00d9
Fgpio$T3CH1IF$0$0 == 0x00da
_T3CH1IF = 0x00da
Fgpio$T4OVFIF$0$0 == 0x00db
_T4OVFIF = 0x00db
Fgpio$T4CH0IF$0$0 == 0x00dc
_T4CH0IF = 0x00dc
Fgpio$T4CH1IF$0$0 == 0x00dd
_T4CH1IF = 0x00dd
Fgpio$OVFIM$0$0 == 0x00de
_OVFIM = 0x00de
Fgpio$_TIMIF7$0$0 == 0x00df
__TIMIF7 = 0x00df
Fgpio$ACC_0$0$0 == 0x00e0
_ACC_0 = 0x00e0
Fgpio$ACC_1$0$0 == 0x00e1
_ACC_1 = 0x00e1
Fgpio$ACC_2$0$0 == 0x00e2
_ACC_2 = 0x00e2
Fgpio$ACC_3$0$0 == 0x00e3
_ACC_3 = 0x00e3
Fgpio$ACC_4$0$0 == 0x00e4
_ACC_4 = 0x00e4
Fgpio$ACC_5$0$0 == 0x00e5
_ACC_5 = 0x00e5
Fgpio$ACC_6$0$0 == 0x00e6
_ACC_6 = 0x00e6
Fgpio$ACC_7$0$0 == 0x00e7
_ACC_7 = 0x00e7
Fgpio$P2IF$0$0 == 0x00e8
_P2IF = 0x00e8
Fgpio$UTX0IF$0$0 == 0x00e9
_UTX0IF = 0x00e9
Fgpio$UTX1IF$0$0 == 0x00ea
_UTX1IF = 0x00ea
Fgpio$P1IF$0$0 == 0x00eb
_P1IF = 0x00eb
Fgpio$WDTIF$0$0 == 0x00ec
_WDTIF = 0x00ec
Fgpio$_IRCON25$0$0 == 0x00ed
__IRCON25 = 0x00ed
Fgpio$_IRCON26$0$0 == 0x00ee
__IRCON26 = 0x00ee
Fgpio$_IRCON27$0$0 == 0x00ef
__IRCON27 = 0x00ef
Fgpio$B_0$0$0 == 0x00f0
_B_0 = 0x00f0
Fgpio$B_1$0$0 == 0x00f1
_B_1 = 0x00f1
Fgpio$B_2$0$0 == 0x00f2
_B_2 = 0x00f2
Fgpio$B_3$0$0 == 0x00f3
_B_3 = 0x00f3
Fgpio$B_4$0$0 == 0x00f4
_B_4 = 0x00f4
Fgpio$B_5$0$0 == 0x00f5
_B_5 = 0x00f5
Fgpio$B_6$0$0 == 0x00f6
_B_6 = 0x00f6
Fgpio$B_7$0$0 == 0x00f7
_B_7 = 0x00f7
Fgpio$U1ACTIVE$0$0 == 0x00f8
_U1ACTIVE = 0x00f8
Fgpio$U1TX_BYTE$0$0 == 0x00f9
_U1TX_BYTE = 0x00f9
Fgpio$U1RX_BYTE$0$0 == 0x00fa
_U1RX_BYTE = 0x00fa
Fgpio$U1ERR$0$0 == 0x00fb
_U1ERR = 0x00fb
Fgpio$U1FE$0$0 == 0x00fc
_U1FE = 0x00fc
Fgpio$U1SLAVE$0$0 == 0x00fd
_U1SLAVE = 0x00fd
Fgpio$U1RE$0$0 == 0x00fe
_U1RE = 0x00fe
Fgpio$U1MODE$0$0 == 0x00ff
_U1MODE = 0x00ff
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
.area REG_BANK_0 (REL,OVR,DATA)
.ds 8
;--------------------------------------------------------
; overlayable bit register bank
;--------------------------------------------------------
.area BIT_BANK (REL,OVR,DATA)
bits:
.ds 1
b0 = bits[0]
b1 = bits[1]
b2 = bits[2]
b3 = bits[3]
b4 = bits[4]
b5 = bits[5]
b6 = bits[6]
b7 = bits[7]
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
.area DSEG (DATA)
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
.area OSEG (OVR,DATA)
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
.area ISEG (DATA)
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
.area IABS (ABS,DATA)
.area IABS (ABS,DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
.area BSEG (BIT)
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
.area PSEG (PAG,XDATA)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
.area XSEG (XDATA)
Fgpio$SYNC1$0$0 == 0xdf00
_SYNC1 = 0xdf00
Fgpio$SYNC0$0$0 == 0xdf01
_SYNC0 = 0xdf01
Fgpio$PKTLEN$0$0 == 0xdf02
_PKTLEN = 0xdf02
Fgpio$PKTCTRL1$0$0 == 0xdf03
_PKTCTRL1 = 0xdf03
Fgpio$PKTCTRL0$0$0 == 0xdf04
_PKTCTRL0 = 0xdf04
Fgpio$ADDR$0$0 == 0xdf05
_ADDR = 0xdf05
Fgpio$CHANNR$0$0 == 0xdf06
_CHANNR = 0xdf06
Fgpio$FSCTRL1$0$0 == 0xdf07
_FSCTRL1 = 0xdf07
Fgpio$FSCTRL0$0$0 == 0xdf08
_FSCTRL0 = 0xdf08
Fgpio$FREQ2$0$0 == 0xdf09
_FREQ2 = 0xdf09
Fgpio$FREQ1$0$0 == 0xdf0a
_FREQ1 = 0xdf0a
Fgpio$FREQ0$0$0 == 0xdf0b
_FREQ0 = 0xdf0b
Fgpio$MDMCFG4$0$0 == 0xdf0c
_MDMCFG4 = 0xdf0c
Fgpio$MDMCFG3$0$0 == 0xdf0d
_MDMCFG3 = 0xdf0d
Fgpio$MDMCFG2$0$0 == 0xdf0e
_MDMCFG2 = 0xdf0e
Fgpio$MDMCFG1$0$0 == 0xdf0f
_MDMCFG1 = 0xdf0f
Fgpio$MDMCFG0$0$0 == 0xdf10
_MDMCFG0 = 0xdf10
Fgpio$DEVIATN$0$0 == 0xdf11
_DEVIATN = 0xdf11
Fgpio$MCSM2$0$0 == 0xdf12
_MCSM2 = 0xdf12
Fgpio$MCSM1$0$0 == 0xdf13
_MCSM1 = 0xdf13
Fgpio$MCSM0$0$0 == 0xdf14
_MCSM0 = 0xdf14
Fgpio$FOCCFG$0$0 == 0xdf15
_FOCCFG = 0xdf15
Fgpio$BSCFG$0$0 == 0xdf16
_BSCFG = 0xdf16
Fgpio$AGCCTRL2$0$0 == 0xdf17
_AGCCTRL2 = 0xdf17
Fgpio$AGCCTRL1$0$0 == 0xdf18
_AGCCTRL1 = 0xdf18
Fgpio$AGCCTRL0$0$0 == 0xdf19
_AGCCTRL0 = 0xdf19
Fgpio$FREND1$0$0 == 0xdf1a
_FREND1 = 0xdf1a
Fgpio$FREND0$0$0 == 0xdf1b
_FREND0 = 0xdf1b
Fgpio$FSCAL3$0$0 == 0xdf1c
_FSCAL3 = 0xdf1c
Fgpio$FSCAL2$0$0 == 0xdf1d
_FSCAL2 = 0xdf1d
Fgpio$FSCAL1$0$0 == 0xdf1e
_FSCAL1 = 0xdf1e
Fgpio$FSCAL0$0$0 == 0xdf1f
_FSCAL0 = 0xdf1f
Fgpio$TEST2$0$0 == 0xdf23
_TEST2 = 0xdf23
Fgpio$TEST1$0$0 == 0xdf24
_TEST1 = 0xdf24
Fgpio$TEST0$0$0 == 0xdf25
_TEST0 = 0xdf25
Fgpio$PA_TABLE0$0$0 == 0xdf2e
_PA_TABLE0 = 0xdf2e
Fgpio$IOCFG2$0$0 == 0xdf2f
_IOCFG2 = 0xdf2f
Fgpio$IOCFG1$0$0 == 0xdf30
_IOCFG1 = 0xdf30
Fgpio$IOCFG0$0$0 == 0xdf31
_IOCFG0 = 0xdf31
Fgpio$PARTNUM$0$0 == 0xdf36
_PARTNUM = 0xdf36
Fgpio$VERSION$0$0 == 0xdf37
_VERSION = 0xdf37
Fgpio$FREQEST$0$0 == 0xdf38
_FREQEST = 0xdf38
Fgpio$LQI$0$0 == 0xdf39
_LQI = 0xdf39
Fgpio$RSSI$0$0 == 0xdf3a
_RSSI = 0xdf3a
Fgpio$MARCSTATE$0$0 == 0xdf3b
_MARCSTATE = 0xdf3b
Fgpio$PKTSTATUS$0$0 == 0xdf3c
_PKTSTATUS = 0xdf3c
Fgpio$VCO_VC_DAC$0$0 == 0xdf3d
_VCO_VC_DAC = 0xdf3d
Fgpio$I2SCFG0$0$0 == 0xdf40
_I2SCFG0 = 0xdf40
Fgpio$I2SCFG1$0$0 == 0xdf41
_I2SCFG1 = 0xdf41
Fgpio$I2SDATL$0$0 == 0xdf42
_I2SDATL = 0xdf42
Fgpio$I2SDATH$0$0 == 0xdf43
_I2SDATH = 0xdf43
Fgpio$I2SWCNT$0$0 == 0xdf44
_I2SWCNT = 0xdf44
Fgpio$I2SSTAT$0$0 == 0xdf45
_I2SSTAT = 0xdf45
Fgpio$I2SCLKF0$0$0 == 0xdf46
_I2SCLKF0 = 0xdf46
Fgpio$I2SCLKF1$0$0 == 0xdf47
_I2SCLKF1 = 0xdf47
Fgpio$I2SCLKF2$0$0 == 0xdf48
_I2SCLKF2 = 0xdf48
Fgpio$USBADDR$0$0 == 0xde00
_USBADDR = 0xde00
Fgpio$USBPOW$0$0 == 0xde01
_USBPOW = 0xde01
Fgpio$USBIIF$0$0 == 0xde02
_USBIIF = 0xde02
Fgpio$USBOIF$0$0 == 0xde04
_USBOIF = 0xde04
Fgpio$USBCIF$0$0 == 0xde06
_USBCIF = 0xde06
Fgpio$USBIIE$0$0 == 0xde07
_USBIIE = 0xde07
Fgpio$USBOIE$0$0 == 0xde09
_USBOIE = 0xde09
Fgpio$USBCIE$0$0 == 0xde0b
_USBCIE = 0xde0b
Fgpio$USBFRML$0$0 == 0xde0c
_USBFRML = 0xde0c
Fgpio$USBFRMH$0$0 == 0xde0d
_USBFRMH = 0xde0d
Fgpio$USBINDEX$0$0 == 0xde0e
_USBINDEX = 0xde0e
Fgpio$USBMAXI$0$0 == 0xde10
_USBMAXI = 0xde10
Fgpio$USBCSIL$0$0 == 0xde11
_USBCSIL = 0xde11
Fgpio$USBCSIH$0$0 == 0xde12
_USBCSIH = 0xde12
Fgpio$USBMAXO$0$0 == 0xde13
_USBMAXO = 0xde13
Fgpio$USBCSOL$0$0 == 0xde14
_USBCSOL = 0xde14
Fgpio$USBCSOH$0$0 == 0xde15
_USBCSOH = 0xde15
Fgpio$USBCNTL$0$0 == 0xde16
_USBCNTL = 0xde16
Fgpio$USBCNTH$0$0 == 0xde17
_USBCNTH = 0xde17
Fgpio$USBF0$0$0 == 0xde20
_USBF0 = 0xde20
Fgpio$USBF1$0$0 == 0xde22
_USBF1 = 0xde22
Fgpio$USBF2$0$0 == 0xde24
_USBF2 = 0xde24
Fgpio$USBF3$0$0 == 0xde26
_USBF3 = 0xde26
Fgpio$USBF4$0$0 == 0xde28
_USBF4 = 0xde28
Fgpio$USBF5$0$0 == 0xde2a
_USBF5 = 0xde2a
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area XABS (ABS,XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
.area XISEG (XDATA)
.area HOME (CODE)
.area GSINIT0 (CODE)
.area GSINIT1 (CODE)
.area GSINIT2 (CODE)
.area GSINIT3 (CODE)
.area GSINIT4 (CODE)
.area GSINIT5 (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area CSEG (CODE)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area HOME (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area GSINIT (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area HOME (CODE)
.area HOME (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area CSEG (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'setDigitalOutput'
;------------------------------------------------------------
;value Allocated to registers b0
;pinNumber Allocated to registers r7
;------------------------------------------------------------
G$setDigitalOutput$0$0 ==.
C$gpio.c$36$0$0 ==.
; libraries/src/gpio/gpio.c:36: void setDigitalOutput(uint8 pinNumber, BIT value) __reentrant
; -----------------------------------------
; function setDigitalOutput
; -----------------------------------------
_setDigitalOutput:
ar7 = 0x07
ar6 = 0x06
ar5 = 0x05
ar4 = 0x04
ar3 = 0x03
ar2 = 0x02
ar1 = 0x01
ar0 = 0x00
C$gpio.c$38$1$1 ==.
; libraries/src/gpio/gpio.c:38: PIN_SWITCH(SET_DIGITAL_OUTPUT);
mov a,dpl
mov r7,a
add a,#0xff - 0x18
jnc 00124$
ljmp 00121$
00124$:
mov a,r7
add a,#(00125$-3-.)
movc a,@a+pc
push acc
mov a,r7
add a,#(00126$-3-.)
movc a,@a+pc
push acc
ret
00125$:
.db 00101$
.db 00102$
.db 00103$
.db 00104$
.db 00105$
.db 00106$
.db 00120$
.db 00120$
.db 00120$
.db 00120$
.db 00107$
.db 00108$
.db 00109$
.db 00110$
.db 00111$
.db 00112$
.db 00113$
.db 00114$
.db 00120$
.db 00120$
.db 00115$
.db 00116$
.db 00117$
.db 00118$
.db 00119$
00126$:
.db 00101$>>8
.db 00102$>>8
.db 00103$>>8
.db 00104$>>8
.db 00105$>>8
.db 00106$>>8
.db 00120$>>8
.db 00120$>>8
.db 00120$>>8
.db 00120$>>8
.db 00107$>>8
.db 00108$>>8
.db 00109$>>8
.db 00110$>>8
.db 00111$>>8
.db 00112$>>8
.db 00113$>>8
.db 00114$>>8
.db 00120$>>8
.db 00120$>>8
.db 00115$>>8
.db 00116$>>8
.db 00117$>>8
.db 00118$>>8
.db 00119$>>8
00101$:
mov c,b0
mov _P0_0,c
orl _P0DIR,#0x01
ljmp 00121$
00102$:
mov c,b0
mov _P0_1,c
orl _P0DIR,#0x02
ljmp 00121$
00103$:
mov c,b0
mov _P0_2,c
orl _P0DIR,#0x04
ljmp 00121$
00104$:
mov c,b0
mov _P0_3,c
orl _P0DIR,#0x08
ljmp 00121$
00105$:
mov c,b0
mov _P0_4,c
orl _P0DIR,#0x10
ljmp 00121$
00106$:
mov c,b0
mov _P0_5,c
orl _P0DIR,#0x20
ljmp 00121$
00107$:
mov c,b0
mov _P1_0,c
orl _P1DIR,#0x01
sjmp 00121$
00108$:
mov c,b0
mov _P1_1,c
orl _P1DIR,#0x02
sjmp 00121$
00109$:
mov c,b0
mov _P1_2,c
orl _P1DIR,#0x04
sjmp 00121$
00110$:
mov c,b0
mov _P1_3,c
orl _P1DIR,#0x08
sjmp 00121$
00111$:
mov c,b0
mov _P1_4,c
orl _P1DIR,#0x10
sjmp 00121$
00112$:
mov c,b0
mov _P1_5,c
orl _P1DIR,#0x20
sjmp 00121$
00113$:
mov c,b0
mov _P1_6,c
orl _P1DIR,#0x40
sjmp 00121$
00114$:
mov c,b0
mov _P1_7,c
orl _P1DIR,#0x80
sjmp 00121$
00115$:
mov c,b0
mov _P2_0,c
orl _P2DIR,#0x01
sjmp 00121$
00116$:
mov c,b0
mov _P2_1,c
orl _P2DIR,#0x02
sjmp 00121$
00117$:
mov c,b0
mov _P2_2,c
orl _P2DIR,#0x04
sjmp 00121$
00118$:
mov c,b0
mov _P2_3,c
orl _P2DIR,#0x08
sjmp 00121$
00119$:
mov c,b0
mov _P2_4,c
orl _P2DIR,#0x10
00120$:
00121$:
C$gpio.c$39$1$1 ==.
XG$setDigitalOutput$0$0 ==.
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'setDigitalInput'
;------------------------------------------------------------
;pulled Allocated to registers b0
;pinNumber Allocated to registers r7
;------------------------------------------------------------
G$setDigitalInput$0$0 ==.
C$gpio.c$41$1$1 ==.
; libraries/src/gpio/gpio.c:41: void setDigitalInput(uint8 pinNumber, BIT pulled) __reentrant
; -----------------------------------------
; function setDigitalInput
; -----------------------------------------
_setDigitalInput:
C$gpio.c$43$1$1 ==.
; libraries/src/gpio/gpio.c:43: PIN_SWITCH(SET_DIGITAL_INPUT);
mov a,dpl
mov r7,a
add a,#0xff - 0x18
jnc 00200$
ljmp 00178$
00200$:
mov a,r7
add a,#(00201$-3-.)
movc a,@a+pc
push acc
mov a,r7
add a,#(00202$-3-.)
movc a,@a+pc
push acc
ret
00201$:
.db 00101$
.db 00105$
.db 00109$
.db 00113$
.db 00117$
.db 00121$
.db 00177$
.db 00177$
.db 00177$
.db 00177$
.db 00125$
.db 00129$
.db 00133$
.db 00137$
.db 00141$
.db 00145$
.db 00149$
.db 00153$
.db 00177$
.db 00177$
.db 00157$
.db 00161$
.db 00165$
.db 00169$
.db 00173$
00202$:
.db 00101$>>8
.db 00105$>>8
.db 00109$>>8
.db 00113$>>8
.db 00117$>>8
.db 00121$>>8
.db 00177$>>8
.db 00177$>>8
.db 00177$>>8
.db 00177$>>8
.db 00125$>>8
.db 00129$>>8
.db 00133$>>8
.db 00137$>>8
.db 00141$>>8
.db 00145$>>8
.db 00149$>>8
.db 00153$>>8
.db 00177$>>8
.db 00177$>>8
.db 00157$>>8
.db 00161$>>8
.db 00165$>>8
.db 00169$>>8
.db 00173$>>8
00101$:
jnb b0,00103$
mov r7,_P0INP
anl ar7,#0xFE
mov _P0INP,r7
sjmp 00104$
00103$:
orl _P0INP,#0x01
00104$:
mov r7,_P0DIR
anl ar7,#0xFE
mov _P0DIR,r7
ljmp 00178$
00105$:
jnb b0,00107$
mov r7,_P0INP
anl ar7,#0xFD
mov _P0INP,r7
sjmp 00108$
00107$:
orl _P0INP,#0x02
00108$:
mov r7,_P0DIR
anl ar7,#0xFD
mov _P0DIR,r7
ljmp 00178$
00109$:
jnb b0,00111$
mov r7,_P0INP
anl ar7,#0xFB
mov _P0INP,r7
sjmp 00112$
00111$:
orl _P0INP,#0x04
00112$:
mov r7,_P0DIR
anl ar7,#0xFB
mov _P0DIR,r7
ljmp 00178$
00113$:
jnb b0,00115$
mov r7,_P0INP
anl ar7,#0xF7
mov _P0INP,r7
sjmp 00116$
00115$:
orl _P0INP,#0x08
00116$:
mov r7,_P0DIR
anl ar7,#0xF7
mov _P0DIR,r7
ljmp 00178$
00117$:
jnb b0,00119$
mov r7,_P0INP
anl ar7,#0xEF
mov _P0INP,r7
sjmp 00120$
00119$:
orl _P0INP,#0x10
00120$:
mov r7,_P0DIR
anl ar7,#0xEF
mov _P0DIR,r7
ljmp 00178$
00121$:
jnb b0,00123$
mov r7,_P0INP
anl ar7,#0xDF
mov _P0INP,r7
sjmp 00124$
00123$:
orl _P0INP,#0x20
00124$:
mov r7,_P0DIR
anl ar7,#0xDF
mov _P0DIR,r7
ljmp 00178$
00125$:
jnb b0,00127$
mov r7,_P1INP
anl ar7,#0xFE
mov _P1INP,r7
sjmp 00128$
00127$:
orl _P1INP,#0x01
00128$:
mov r7,_P1DIR
anl ar7,#0xFE
mov _P1DIR,r7
ljmp 00178$
00129$:
jnb b0,00131$
mov r7,_P1INP
anl ar7,#0xFD
mov _P1INP,r7
sjmp 00132$
00131$:
orl _P1INP,#0x02
00132$:
mov r7,_P1DIR
anl ar7,#0xFD
mov _P1DIR,r7
ljmp 00178$
00133$:
jnb b0,00135$
mov r7,_P1INP
anl ar7,#0xFB
mov _P1INP,r7
sjmp 00136$
00135$:
orl _P1INP,#0x04
00136$:
mov r7,_P1DIR
anl ar7,#0xFB
mov _P1DIR,r7
ljmp 00178$
00137$:
jnb b0,00139$
mov r7,_P1INP
anl ar7,#0xF7
mov _P1INP,r7
sjmp 00140$
00139$:
orl _P1INP,#0x08
00140$:
mov r7,_P1DIR
anl ar7,#0xF7
mov _P1DIR,r7
ljmp 00178$
00141$:
jnb b0,00143$
mov r7,_P1INP
anl ar7,#0xEF
mov _P1INP,r7
sjmp 00144$
00143$:
orl _P1INP,#0x10
00144$:
mov r7,_P1DIR
anl ar7,#0xEF
mov _P1DIR,r7
ljmp 00178$
00145$:
jnb b0,00147$
mov r7,_P1INP
anl ar7,#0xDF
mov _P1INP,r7
sjmp 00148$
00147$:
orl _P1INP,#0x20
00148$:
mov r7,_P1DIR
anl ar7,#0xDF
mov _P1DIR,r7
ljmp 00178$
00149$:
jnb b0,00151$
mov r7,_P1INP
anl ar7,#0xBF
mov _P1INP,r7
sjmp 00152$
00151$:
orl _P1INP,#0x40
00152$:
mov r7,_P1DIR
anl ar7,#0xBF
mov _P1DIR,r7
ljmp 00178$
00153$:
jnb b0,00155$
mov r7,_P1INP
anl ar7,#0x7F
mov _P1INP,r7
sjmp 00156$
00155$:
orl _P1INP,#0x80
00156$:
mov r7,_P1DIR
anl ar7,#0x7F
mov _P1DIR,r7
ljmp 00178$
00157$:
jnb b0,00159$
mov r7,_P2INP
anl ar7,#0xFE
mov _P2INP,r7
sjmp 00160$
00159$:
orl _P2INP,#0x01
00160$:
mov r7,_P2DIR
anl ar7,#0xFE
mov _P2DIR,r7
sjmp 00178$
00161$:
jnb b0,00163$
mov r7,_P2INP
anl ar7,#0xFD
mov _P2INP,r7
sjmp 00164$
00163$:
orl _P2INP,#0x02
00164$:
mov r7,_P2DIR
anl ar7,#0xFD
mov _P2DIR,r7
sjmp 00178$
00165$:
jnb b0,00167$
mov r7,_P2INP
anl ar7,#0xFB
mov _P2INP,r7
sjmp 00168$
00167$:
orl _P2INP,#0x04
00168$:
mov r7,_P2DIR
anl ar7,#0xFB
mov _P2DIR,r7
sjmp 00178$
00169$:
jnb b0,00171$
mov r7,_P2INP
anl ar7,#0xF7
mov _P2INP,r7
sjmp 00172$
00171$:
orl _P2INP,#0x08
00172$:
mov r7,_P2DIR
anl ar7,#0xF7
mov _P2DIR,r7
sjmp 00178$
00173$:
jnb b0,00175$
mov r7,_P2INP
anl ar7,#0xEF
mov _P2INP,r7
sjmp 00176$
00175$:
orl _P2INP,#0x10
00176$:
mov r7,_P2DIR
anl ar7,#0xEF
mov _P2DIR,r7
00177$:
00178$:
C$gpio.c$44$1$1 ==.
XG$setDigitalInput$0$0 ==.
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'isPinHigh'
;------------------------------------------------------------
;pinNumber Allocated to registers r7
;------------------------------------------------------------
G$isPinHigh$0$0 ==.
C$gpio.c$46$1$1 ==.
; libraries/src/gpio/gpio.c:46: BIT isPinHigh(uint8 pinNumber) __reentrant
; -----------------------------------------
; function isPinHigh
; -----------------------------------------
_isPinHigh:
C$gpio.c$48$1$1 ==.
; libraries/src/gpio/gpio.c:48: PIN_SWITCH(IS_DIGITAL_INPUT_HIGH);
mov a,dpl
mov r7,a
add a,#0xff - 0x18
jnc 00124$
ljmp 00120$
00124$:
mov a,r7
add a,#(00125$-3-.)
movc a,@a+pc
push acc
mov a,r7
add a,#(00126$-3-.)
movc a,@a+pc
push acc
ret
00125$:
.db 00101$
.db 00102$
.db 00103$
.db 00104$
.db 00105$
.db 00106$
.db 00120$
.db 00120$
.db 00120$
.db 00120$
.db 00107$
.db 00108$
.db 00109$
.db 00110$
.db 00111$
.db 00112$
.db 00113$
.db 00114$
.db 00120$
.db 00120$
.db 00115$
.db 00116$
.db 00117$
.db 00118$
.db 00119$
00126$:
.db 00101$>>8
.db 00102$>>8
.db 00103$>>8
.db 00104$>>8
.db 00105$>>8
.db 00106$>>8
.db 00120$>>8
.db 00120$>>8
.db 00120$>>8
.db 00120$>>8
.db 00107$>>8
.db 00108$>>8
.db 00109$>>8
.db 00110$>>8
.db 00111$>>8
.db 00112$>>8
.db 00113$>>8
.db 00114$>>8
.db 00120$>>8
.db 00120$>>8
.db 00115$>>8
.db 00116$>>8
.db 00117$>>8
.db 00118$>>8
.db 00119$>>8
00101$:
mov c,_P0_0
sjmp 00121$
00102$:
mov c,_P0_1
sjmp 00121$
00103$:
mov c,_P0_2
sjmp 00121$
00104$:
mov c,_P0_3
sjmp 00121$
00105$:
mov c,_P0_4
sjmp 00121$
00106$:
mov c,_P0_5
sjmp 00121$
00107$:
mov c,_P1_0
sjmp 00121$
00108$:
mov c,_P1_1
sjmp 00121$
00109$:
mov c,_P1_2
sjmp 00121$
00110$:
mov c,_P1_3
sjmp 00121$
00111$:
mov c,_P1_4
sjmp 00121$
00112$:
mov c,_P1_5
sjmp 00121$
00113$:
mov c,_P1_6
sjmp 00121$
00114$:
mov c,_P1_7
sjmp 00121$
00115$:
mov c,_P2_0
sjmp 00121$
00116$:
mov c,_P2_1
sjmp 00121$
00117$:
mov c,_P2_2
sjmp 00121$
00118$:
mov c,_P2_3
sjmp 00121$
00119$:
mov c,_P2_4
sjmp 00121$
00120$:
C$gpio.c$49$1$1 ==.
; libraries/src/gpio/gpio.c:49: return 0;
clr c
00121$:
C$gpio.c$50$1$1 ==.
XG$isPinHigh$0$0 ==.
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'setPort0PullType'
;------------------------------------------------------------
;pullType Allocated to registers b0
;------------------------------------------------------------
G$setPort0PullType$0$0 ==.
C$gpio.c$52$1$1 ==.
; libraries/src/gpio/gpio.c:52: void setPort0PullType(BIT pullType) __reentrant
; -----------------------------------------
; function setPort0PullType
; -----------------------------------------
_setPort0PullType:
C$gpio.c$54$1$1 ==.
; libraries/src/gpio/gpio.c:54: if (pullType){ P2INP &= ~(1<<5); }
jnb b0,00102$
mov r7,_P2INP
anl ar7,#0xDF
mov _P2INP,r7
sjmp 00104$
00102$:
C$gpio.c$55$2$3 ==.
; libraries/src/gpio/gpio.c:55: else { P2INP |= (1<<5); }
orl _P2INP,#0x20
00104$:
C$gpio.c$56$1$1 ==.
XG$setPort0PullType$0$0 ==.
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'setPort1PullType'
;------------------------------------------------------------
;pullType Allocated to registers b0
;------------------------------------------------------------
G$setPort1PullType$0$0 ==.
C$gpio.c$58$1$1 ==.
; libraries/src/gpio/gpio.c:58: void setPort1PullType(BIT pullType) __reentrant
; -----------------------------------------
; function setPort1PullType
; -----------------------------------------
_setPort1PullType:
C$gpio.c$60$1$1 ==.
; libraries/src/gpio/gpio.c:60: if (pullType){ P2INP &= ~(1<<6); }
jnb b0,00102$
mov r7,_P2INP
anl ar7,#0xBF
mov _P2INP,r7
sjmp 00104$
00102$:
C$gpio.c$61$2$3 ==.
; libraries/src/gpio/gpio.c:61: else { P2INP |= (1<<6); }
orl _P2INP,#0x40
00104$:
C$gpio.c$62$1$1 ==.
XG$setPort1PullType$0$0 ==.
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'setPort2PullType'
;------------------------------------------------------------
;pullType Allocated to registers b0
;------------------------------------------------------------
G$setPort2PullType$0$0 ==.
C$gpio.c$64$1$1 ==.
; libraries/src/gpio/gpio.c:64: void setPort2PullType(BIT pullType) __reentrant
; -----------------------------------------
; function setPort2PullType
; -----------------------------------------
_setPort2PullType:
C$gpio.c$66$1$1 ==.
; libraries/src/gpio/gpio.c:66: if (pullType){ P2INP &= ~(1<<7); }
jnb b0,00102$
mov r7,_P2INP
anl ar7,#0x7F
mov _P2INP,r7
sjmp 00104$
00102$:
C$gpio.c$67$2$3 ==.
; libraries/src/gpio/gpio.c:67: else { P2INP |= (1<<7); }
orl _P2INP,#0x80
00104$:
C$gpio.c$68$1$1 ==.
XG$setPort2PullType$0$0 ==.
ret
.area CSEG (CODE)
.area CONST (CODE)
.area XINIT (CODE)
.area CABS (ABS,CODE)
| Cagier/wixel-yDrip | libraries/src/gpio/gpio.asm | Assembly | mit | 30,295 |
; ----------------------------------- NES 2.0 Header -----------------------------------
.byte $4E, $45, $53, $1A
.byte 1 ; number of 16K PRG-ROM banks
.byte 0 ; number of 8K CHR-ROM banks
.byte $00 ; flags 6 (NROM, horizontal mirroring)
.byte $08 ; flags 7 (NROM, NES 2.0 enabled)
.byte $00 ; NES 2.0 extended mapper information
.byte $00 ; NES 2.0 extended ROM size
.byte $00 ; NES 2.0 PRG-RAM size
.byte $07 ; NES 2.0 CHR-RAM size (8192, no battery)
.byte $00 ; NES 2.0 TV system
.byte $00 ; NES 2.0 Vs. System hardware
.byte 0,0 ; reserved
; ----------------------------------------- RAM ----------------------------------------
.zero
.org 0
controller1 .byte 0
controller2 .byte 0
OAM = $02 ; put whatever your OAM page is here
.text
; ----------------------------------------- PRG ----------------------------------------
.org $C000
.byte 0 ; DMC sample
reset:
lda #0
sta $2000 ; disable NMI
sta $2001 ; disable rendering
sta $4015 ; silence APU
bit $2002
lda #$0F
jsr set_bg
jsr set_bg
lda #$4F ; no IRQ, loop, rate F
sta $4010
lda #0
sta $4012 ; address $C000
sta $4013 ; length 1 byte
lda #$10
sta $4015 ; start sample
forever:
lda #OAM
sta $4014 ; ------ DMA ------
ldx #1 ; even odd <- strobe code must take an odd number of cycles total
stx controller1 ; even odd even
stx $4016 ; odd even odd even
dex ; odd even
stx $4016 ; odd even odd even
read_loop:
lda $4017 ; odd even odd EVEN <- loop code must take an even number of cycles total
and #3 ; odd even
cmp #1 ; odd even
rol controller2, x ; odd even odd even odd even (X = 0; waste 1 cycle and 0 bytes for alignment)
lda $4016 ; odd even odd EVEN
and #3 ; odd even
cmp #1 ; odd even
rol controller1 ; odd even odd even odd
bcc read_loop ; even odd [even]
lda #1
bit controller1
bne glitch
bit controller2
beq forever
glitch:
lda #$30
jsr set_bg
jmp forever
; wait for vblank and set BG colour to the value in A
; clobbers X
set_bg:
bit $2002
bpl set_bg
ldx #$3F
stx $2006
ldx #$00
stx $2006
sta $2007
stx $2006
stx $2006
rts
.dsb $FFFA - * ; pad to interrupt vectors
.word reset
.word reset
.word reset
| daniel5151/ANESE | roms/tests/joy/dma_sync_test_v2/dma_sync_test.asm | Assembly | mit | 2,293 |
INT 1
MOV XL, 10000000b
MOV XH, 0x00
MOV J, X
MOV D, [J]
MOV XL, D
OUT C
MOV XL, 10000001b
MOV XH, 0x00
MOV J, X
MOV D, [J]
MOV XL, D
OUT C
MOV XL, 10000010b
MOV XH, 0x00
MOV J, X
MOV D, [J]
MOV XL, D
OUT C
HLT | KPU-RISC/KPU | Assembler/AssemblyCode/INT.asm | Assembly | mit | 214 |
;;; Apple II/IIe reset-everything routine
;;; Copyright © 2017 Zellyn Hunter <zellyn@gmail.com>
!zone resetall {
;;; Reset all soft-switches to known-good state. Burns $300 and $301 in main mem.
RESETALL
sta RESET_RAMRD
sta RESET_RAMWRT
stx $300
sta $301
;; Save return address in X and A, in case we switch zero-page memory.
pla
tax
pla
sta RESET_80STORE
sta RESET_INTCXROM
sta RESET_ALTZP
sta RESET_SLOTC3ROM
sta RESET_INTC8ROM
sta RESET_80COL
sta RESET_ALTCHRSET
sta SET_TEXT
sta RESET_MIXED
sta RESET_PAGE2
sta RESET_HIRES
;; Restore return address from X and A.
pha
txa
pha
ldx $300
lda $301
rts
}
| zellyn/a2audit | audit/resetall.asm | Assembly | mit | 636 |
section .data
buffer times 500 db 0
value db 0
section .text
global _start
_start:
mov ESI , 0
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 13
mov [buffer + ESI] , AH
loop_start_1:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 2
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 2
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1
loop_end_1:
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 6
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 3
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_19:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_19
loop_start_20:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_20
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_20
loop_end_20:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_24:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_24
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_24
loop_end_24:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_19
loop_end_19:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_31:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_31
; RIGHT
ADD ESI , 8
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_31
loop_end_31:
; LEFT
SUB ESI , 9
loop_start_37:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_37
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_37
loop_end_37:
; RIGHT
ADD ESI , 8
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
loop_start_45:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_45
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_47:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_47
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_47
loop_end_47:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_45
loop_end_45:
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 27
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 17
loop_start_60:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_60
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_60
loop_end_60:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_66:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_66
; RIGHT
ADD ESI , 6
loop_start_68:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_68
; RIGHT
ADD ESI , 7
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_68
loop_end_68:
; LEFT
SUB ESI , 9
loop_start_74:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_74
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_74
loop_end_74:
; RIGHT
ADD ESI , 7
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 4
mov [buffer + ESI] , AH
loop_start_82:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_82
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_84:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_84
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_84
loop_end_84:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_82
loop_end_82:
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 7
mov [buffer + ESI] , AH
loop_start_96:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_96
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_98:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_98
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_98
loop_end_98:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_96
loop_end_96:
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 16
loop_start_109:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_109
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_109
loop_end_109:
; RIGHT
ADD ESI , 3
loop_start_113:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_113
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_116:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_116
; RIGHT
ADD ESI , 7
loop_start_118:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_118
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_118
loop_end_118:
; LEFT
SUB ESI , 6
loop_start_125:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_125
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_125
loop_end_125:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_116
loop_end_116:
; LEFT
SUB ESI , 9
loop_start_138:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_138
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_138
loop_end_138:
; RIGHT
ADD ESI , 9
loop_start_142:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_142
; RIGHT
ADD ESI , 8
loop_start_144:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_144
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_144
loop_end_144:
; LEFT
SUB ESI , 7
loop_start_151:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_151
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_151
loop_end_151:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_142
loop_end_142:
; LEFT
SUB ESI , 9
loop_start_164:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_164
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_164
loop_end_164:
; RIGHT
ADD ESI , 7
loop_start_168:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_168
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_168
loop_end_168:
; LEFT
SUB ESI , 7
loop_start_175:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_175
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_175
loop_end_175:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_185:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_185
loop_start_186:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_186
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_186
loop_end_186:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_209:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_209
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_209
loop_end_209:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_185
loop_end_185:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_216:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_216
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_216
loop_end_216:
; LEFT
SUB ESI , 9
loop_start_222:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_222
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_222
loop_end_222:
; RIGHT
ADD ESI , 9
loop_start_226:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_226
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_230:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_230
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_230
loop_end_230:
; LEFT
SUB ESI , 4
loop_start_237:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_237
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_242:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_242
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_245:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_245
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_245
loop_end_245:
; LEFT
SUB ESI , 2
loop_start_252:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_252
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_252
loop_end_252:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_242
loop_end_242:
; LEFT
SUB ESI , 8
loop_start_264:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_264
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_264
loop_end_264:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_237
loop_end_237:
; RIGHT
ADD ESI , 9
loop_start_269:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_269
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_269
loop_end_269:
; LEFT
SUB ESI , 9
loop_start_273:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_273
; RIGHT
ADD ESI , 1
loop_start_275:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_275
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_275
loop_end_275:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_273
loop_end_273:
; RIGHT
ADD ESI , 1
loop_start_284:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_284
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_284
loop_end_284:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_226
loop_end_226:
; LEFT
SUB ESI , 9
loop_start_295:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_295
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_301:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_301
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_306:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_306
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_306
loop_end_306:
; LEFT
SUB ESI , 1
loop_start_316:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_316
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_316
loop_end_316:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_301
loop_end_301:
; LEFT
SUB ESI , 3
loop_start_325:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_325
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_325
loop_end_325:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_295
loop_end_295:
; RIGHT
ADD ESI , 9
loop_start_336:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_336
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_336
loop_end_336:
; LEFT
SUB ESI , 9
loop_start_342:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_342
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_342
loop_end_342:
; RIGHT
ADD ESI , 9
loop_start_346:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_346
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_350:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_350
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_350
loop_end_350:
; LEFT
SUB ESI , 5
loop_start_357:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_357
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_362:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_362
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_365:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_365
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_365
loop_end_365:
; LEFT
SUB ESI , 3
loop_start_372:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_372
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_372
loop_end_372:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_362
loop_end_362:
; LEFT
SUB ESI , 8
loop_start_384:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_384
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_384
loop_end_384:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_357
loop_end_357:
; RIGHT
ADD ESI , 9
loop_start_389:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_389
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_389
loop_end_389:
; LEFT
SUB ESI , 9
loop_start_393:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_393
; RIGHT
ADD ESI , 2
loop_start_395:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_395
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_395
loop_end_395:
; LEFT
SUB ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_393
loop_end_393:
; RIGHT
ADD ESI , 2
loop_start_404:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_404
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_404
loop_end_404:
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_346
loop_end_346:
; LEFT
SUB ESI , 9
loop_start_415:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_415
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_421:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_421
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_426:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_426
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_426
loop_end_426:
; LEFT
SUB ESI , 1
loop_start_436:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_436
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_436
loop_end_436:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_421
loop_end_421:
; LEFT
SUB ESI , 3
loop_start_445:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_445
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_445
loop_end_445:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_415
loop_end_415:
; RIGHT
ADD ESI , 9
loop_start_456:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_456
; RIGHT
ADD ESI , 4
loop_start_458:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_458
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 36
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 36
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_458
loop_end_458:
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_456
loop_end_456:
; LEFT
SUB ESI , 9
loop_start_467:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_467
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_467
loop_end_467:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_472:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_472
loop_start_473:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_473
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_473
loop_end_473:
; LEFT
SUB ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_479:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_479
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_479
loop_end_479:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_472
loop_end_472:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 21
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_489:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_489
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_489
loop_end_489:
; RIGHT
ADD ESI , 9
loop_start_493:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_493
; RIGHT
ADD ESI , 3
loop_start_495:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_495
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_495
loop_end_495:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_503:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_503
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_508:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_508
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_508
loop_end_508:
; LEFT
SUB ESI , 4
loop_start_515:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_515
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
loop_start_520:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_520
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_520
loop_end_520:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_527:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_527
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_527
loop_end_527:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_515
loop_end_515:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_503
loop_end_503:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_537:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_537
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_537
loop_end_537:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_545:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_545
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_550:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_550
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_550
loop_end_550:
; LEFT
SUB ESI , 3
loop_start_557:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_557
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 12
loop_start_562:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_562
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_562
loop_end_562:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_569:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_569
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_569
loop_end_569:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_557
loop_end_557:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_545
loop_end_545:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_580:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_580
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_583:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_583
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_583
loop_end_583:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_580
loop_end_580:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_493
loop_end_493:
; LEFT
SUB ESI , 9
loop_start_591:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_591
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_591
loop_end_591:
; LEFT
SUB ESI , 7
loop_start_595:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_595
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_595
loop_end_595:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 26
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_606:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_606
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_606
loop_end_606:
; LEFT
SUB ESI , 4
loop_start_613:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_613
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_613
loop_end_613:
; RIGHT
ADD ESI , 2
loop_start_622:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_622
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_626:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_626
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_626
loop_end_626:
; RIGHT
ADD ESI , 1
loop_start_636:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_636
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_639:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_639
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_639
loop_end_639:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_636
loop_end_636:
; RIGHT
ADD ESI , 13
loop_start_650:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_650
; RIGHT
ADD ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_650
loop_end_650:
; LEFT
SUB ESI , 9
loop_start_660:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_660
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_660
loop_end_660:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_666:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_666
; RIGHT
ADD ESI , 5
loop_start_668:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_668
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_668
loop_end_668:
; LEFT
SUB ESI , 4
loop_start_675:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_675
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_675
loop_end_675:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_666
loop_end_666:
; LEFT
SUB ESI , 9
loop_start_686:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_686
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_686
loop_end_686:
; RIGHT
ADD ESI , 9
loop_start_690:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_690
; RIGHT
ADD ESI , 2
loop_start_692:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_692
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_692
loop_end_692:
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_690
loop_end_690:
; LEFT
SUB ESI , 9
loop_start_701:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_701
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_701
loop_end_701:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_706:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_706
loop_start_707:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_707
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_707
loop_end_707:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_730:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_730
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_730
loop_end_730:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_706
loop_end_706:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_737:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_737
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_737
loop_end_737:
; LEFT
SUB ESI , 9
loop_start_743:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_743
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_743
loop_end_743:
; RIGHT
ADD ESI , 9
loop_start_747:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_747
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_751:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_751
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_751
loop_end_751:
; LEFT
SUB ESI , 5
loop_start_758:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_758
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_763:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_763
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_766:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_766
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_766
loop_end_766:
; LEFT
SUB ESI , 2
loop_start_773:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_773
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_773
loop_end_773:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_763
loop_end_763:
; LEFT
SUB ESI , 8
loop_start_785:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_785
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_785
loop_end_785:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_758
loop_end_758:
; RIGHT
ADD ESI , 9
loop_start_790:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_790
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_790
loop_end_790:
; LEFT
SUB ESI , 9
loop_start_794:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_794
; RIGHT
ADD ESI , 1
loop_start_796:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_796
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_796
loop_end_796:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_794
loop_end_794:
; RIGHT
ADD ESI , 1
loop_start_805:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_805
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_805
loop_end_805:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_747
loop_end_747:
; LEFT
SUB ESI , 9
loop_start_816:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_816
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_822:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_822
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_827:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_827
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_827
loop_end_827:
; LEFT
SUB ESI , 1
loop_start_837:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_837
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_837
loop_end_837:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_822
loop_end_822:
; LEFT
SUB ESI , 2
loop_start_846:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_846
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_846
loop_end_846:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_816
loop_end_816:
; RIGHT
ADD ESI , 9
loop_start_857:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_857
; RIGHT
ADD ESI , 6
loop_start_859:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_859
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_859
loop_end_859:
; LEFT
SUB ESI , 5
loop_start_866:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_866
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_866
loop_end_866:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_857
loop_end_857:
; LEFT
SUB ESI , 9
loop_start_877:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_877
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_877
loop_end_877:
; RIGHT
ADD ESI , 9
loop_start_881:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_881
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_881
loop_end_881:
; LEFT
SUB ESI , 9
loop_start_887:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_887
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_887
loop_end_887:
; RIGHT
ADD ESI , 9
loop_start_891:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_891
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_895:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_895
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_895
loop_end_895:
; LEFT
SUB ESI , 5
loop_start_902:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_902
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_907:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_907
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_910:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_910
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_910
loop_end_910:
; LEFT
SUB ESI , 2
loop_start_917:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_917
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_917
loop_end_917:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_907
loop_end_907:
; LEFT
SUB ESI , 8
loop_start_929:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_929
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_929
loop_end_929:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_902
loop_end_902:
; RIGHT
ADD ESI , 9
loop_start_934:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_934
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_934
loop_end_934:
; LEFT
SUB ESI , 9
loop_start_938:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_938
; RIGHT
ADD ESI , 1
loop_start_940:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_940
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_940
loop_end_940:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_938
loop_end_938:
; RIGHT
ADD ESI , 1
loop_start_949:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_949
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_949
loop_end_949:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_891
loop_end_891:
; LEFT
SUB ESI , 9
loop_start_960:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_960
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_966:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_966
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_971:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_971
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_971
loop_end_971:
; LEFT
SUB ESI , 1
loop_start_981:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_981
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_981
loop_end_981:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_966
loop_end_966:
; LEFT
SUB ESI , 3
loop_start_990:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_990
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_990
loop_end_990:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_960
loop_end_960:
; RIGHT
ADD ESI , 9
loop_start_1001:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1001
; RIGHT
ADD ESI , 4
loop_start_1003:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1003
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 36
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 36
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1003
loop_end_1003:
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1001
loop_end_1001:
; LEFT
SUB ESI , 9
loop_start_1012:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1012
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1012
loop_end_1012:
; RIGHT
ADD ESI , 9
loop_start_1016:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1016
; RIGHT
ADD ESI , 3
loop_start_1018:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1018
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 36
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 36
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1018
loop_end_1018:
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1016
loop_end_1016:
; LEFT
SUB ESI , 9
loop_start_1027:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1027
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1027
loop_end_1027:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_1032:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1032
loop_start_1033:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1033
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1033
loop_end_1033:
; LEFT
SUB ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_1039:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1039
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1039
loop_end_1039:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1032
loop_end_1032:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_1046:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1046
; RIGHT
ADD ESI , 8
loop_start_1048:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1048
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1048
loop_end_1048:
; LEFT
SUB ESI , 7
loop_start_1055:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1055
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1055
loop_end_1055:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1046
loop_end_1046:
; LEFT
SUB ESI , 9
loop_start_1066:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1066
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1066
loop_end_1066:
; RIGHT
ADD ESI , 9
loop_start_1070:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1070
; RIGHT
ADD ESI , 6
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1070
loop_end_1070:
; LEFT
SUB ESI , 9
loop_start_1076:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1076
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1076
loop_end_1076:
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1082:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1082
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1082
loop_end_1082:
; RIGHT
ADD ESI , 1
loop_start_1091:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1091
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_1094:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1094
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 2
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1094
loop_end_1094:
; RIGHT
ADD ESI , 5
loop_start_1103:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1103
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1103
loop_end_1103:
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1091
loop_end_1091:
; LEFT
SUB ESI , 1
loop_start_1116:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1116
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1116
loop_end_1116:
; LEFT
SUB ESI , 5
loop_start_1123:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1123
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1123
loop_end_1123:
; RIGHT
ADD ESI , 6
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_1134:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1134
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1134
loop_end_1134:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_1142:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1142
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1147:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1147
; RIGHT
ADD ESI , 2
loop_start_1149:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1149
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1149
loop_end_1149:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_1157:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1157
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1162:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1162
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1162
loop_end_1162:
; LEFT
SUB ESI , 3
loop_start_1169:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1169
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 12
loop_start_1174:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1174
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1174
loop_end_1174:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_1181:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1181
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1181
loop_end_1181:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1169
loop_end_1169:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1157
loop_end_1157:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_1191:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1191
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1191
loop_end_1191:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_1199:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1199
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1204:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1204
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1204
loop_end_1204:
; LEFT
SUB ESI , 2
loop_start_1211:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1211
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 11
loop_start_1216:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1216
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1216
loop_end_1216:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1223:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1223
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1223
loop_end_1223:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1211
loop_end_1211:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1199
loop_end_1199:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1234:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1234
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1237:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1237
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1237
loop_end_1237:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1234
loop_end_1234:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1147
loop_end_1147:
; LEFT
SUB ESI , 9
loop_start_1245:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1245
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1245
loop_end_1245:
; RIGHT
ADD ESI , 4
loop_start_1249:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1249
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1249
loop_end_1249:
; LEFT
SUB ESI , 4
loop_start_1256:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1256
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1261:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1261
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_1265:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1265
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1265
loop_end_1265:
; LEFT
SUB ESI , 2
loop_start_1272:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1272
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1272
loop_end_1272:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1261
loop_end_1261:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1283:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1283
; RIGHT
ADD ESI , 1
loop_start_1285:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1285
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_1290:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1290
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
loop_start_1297:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1297
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1297
loop_end_1297:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1290
loop_end_1290:
; RIGHT
ADD ESI , 1
loop_start_1306:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1306
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1306
loop_end_1306:
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1285
loop_end_1285:
; RIGHT
ADD ESI , 1
loop_start_1317:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1317
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_1322:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1322
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1322
loop_end_1322:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1317
loop_end_1317:
; RIGHT
ADD ESI , 1
loop_start_1333:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1333
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1333
loop_end_1333:
; LEFT
SUB ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1283
loop_end_1283:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1256
loop_end_1256:
; RIGHT
ADD ESI , 3
loop_start_1346:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1346
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1346
loop_end_1346:
; LEFT
SUB ESI , 3
loop_start_1353:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1353
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_1358:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1358
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1362:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1362
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1362
loop_end_1362:
; LEFT
SUB ESI , 1
loop_start_1369:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1369
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1369
loop_end_1369:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1358
loop_end_1358:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1380:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1380
; RIGHT
ADD ESI , 1
loop_start_1382:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1382
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_1387:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1387
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
loop_start_1394:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1394
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1394
loop_end_1394:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1387
loop_end_1387:
; LEFT
SUB ESI , 1
loop_start_1403:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1403
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1403
loop_end_1403:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1382
loop_end_1382:
; RIGHT
ADD ESI , 2
loop_start_1414:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1414
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_1419:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1419
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1419
loop_end_1419:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1414
loop_end_1414:
; LEFT
SUB ESI , 1
loop_start_1430:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1430
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1430
loop_end_1430:
; LEFT
SUB ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1380
loop_end_1380:
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1353
loop_end_1353:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1142
loop_end_1142:
; RIGHT
ADD ESI , 4
loop_start_1444:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1444
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1444
loop_end_1444:
; LEFT
SUB ESI , 4
loop_start_1451:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1451
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1456:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1456
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1456
loop_end_1456:
; LEFT
SUB ESI , 9
loop_start_1460:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1460
; RIGHT
ADD ESI , 1
loop_start_1462:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1462
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_1467:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1467
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
loop_start_1474:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1474
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1474
loop_end_1474:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1467
loop_end_1467:
; RIGHT
ADD ESI , 1
loop_start_1483:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1483
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1483
loop_end_1483:
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1462
loop_end_1462:
; RIGHT
ADD ESI , 1
loop_start_1494:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1494
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_1499:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1499
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1499
loop_end_1499:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1494
loop_end_1494:
; RIGHT
ADD ESI , 1
loop_start_1510:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1510
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1510
loop_end_1510:
; LEFT
SUB ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1460
loop_end_1460:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1451
loop_end_1451:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1526:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1526
; RIGHT
ADD ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1526
loop_end_1526:
; LEFT
SUB ESI , 9
loop_start_1534:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1534
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1534
loop_end_1534:
; RIGHT
ADD ESI , 9
loop_start_1538:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1538
; RIGHT
ADD ESI , 5
loop_start_1540:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1540
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1540
loop_end_1540:
; LEFT
SUB ESI , 4
loop_start_1547:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1547
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1547
loop_end_1547:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1538
loop_end_1538:
; LEFT
SUB ESI , 9
loop_start_1558:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1558
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1558
loop_end_1558:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_1563:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1563
loop_start_1564:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1564
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1564
loop_end_1564:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_1587:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1587
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1587
loop_end_1587:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1563
loop_end_1563:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_1594:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1594
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1594
loop_end_1594:
; LEFT
SUB ESI , 9
loop_start_1600:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1600
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1600
loop_end_1600:
; RIGHT
ADD ESI , 9
loop_start_1604:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1604
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_1608:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1608
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1608
loop_end_1608:
; LEFT
SUB ESI , 4
loop_start_1615:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1615
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_1620:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1620
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_1623:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1623
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1623
loop_end_1623:
; LEFT
SUB ESI , 2
loop_start_1630:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1630
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1630
loop_end_1630:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1620
loop_end_1620:
; LEFT
SUB ESI , 8
loop_start_1642:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1642
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1642
loop_end_1642:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1615
loop_end_1615:
; RIGHT
ADD ESI , 9
loop_start_1647:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1647
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1647
loop_end_1647:
; LEFT
SUB ESI , 9
loop_start_1651:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1651
; RIGHT
ADD ESI , 1
loop_start_1653:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1653
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1653
loop_end_1653:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1651
loop_end_1651:
; RIGHT
ADD ESI , 1
loop_start_1662:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1662
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1662
loop_end_1662:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1604
loop_end_1604:
; LEFT
SUB ESI , 9
loop_start_1673:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1673
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_1679:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1679
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1684:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1684
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1684
loop_end_1684:
; LEFT
SUB ESI , 1
loop_start_1694:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1694
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1694
loop_end_1694:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1679
loop_end_1679:
; LEFT
SUB ESI , 2
loop_start_1703:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1703
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1703
loop_end_1703:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1673
loop_end_1673:
; RIGHT
ADD ESI , 9
loop_start_1714:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1714
; RIGHT
ADD ESI , 3
loop_start_1716:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1716
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 36
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 36
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1716
loop_end_1716:
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1714
loop_end_1714:
; LEFT
SUB ESI , 9
loop_start_1725:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1725
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1725
loop_end_1725:
; RIGHT
ADD ESI , 5
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_1732:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1732
loop_start_1733:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1733
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1733
loop_end_1733:
; LEFT
SUB ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_1739:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1739
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1739
loop_end_1739:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1732
loop_end_1732:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_1746:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1746
; RIGHT
ADD ESI , 3
loop_start_1748:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1748
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1748
loop_end_1748:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_1756:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1756
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1761:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1761
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1761
loop_end_1761:
; LEFT
SUB ESI , 4
loop_start_1768:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1768
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
loop_start_1773:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1773
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1773
loop_end_1773:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1780:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1780
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1780
loop_end_1780:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1768
loop_end_1768:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1756
loop_end_1756:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_1790:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1790
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1790
loop_end_1790:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_1798:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1798
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1803:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1803
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1803
loop_end_1803:
; LEFT
SUB ESI , 3
loop_start_1810:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1810
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 12
loop_start_1815:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1815
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1815
loop_end_1815:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_1822:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1822
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1822
loop_end_1822:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1810
loop_end_1810:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1798
loop_end_1798:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1833:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1833
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1836:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1836
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1836
loop_end_1836:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1833
loop_end_1833:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1746
loop_end_1746:
; LEFT
SUB ESI , 9
loop_start_1844:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1844
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1844
loop_end_1844:
; RIGHT
ADD ESI , 3
loop_start_1848:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1848
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1848
loop_end_1848:
; LEFT
SUB ESI , 3
loop_start_1855:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1855
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_1860:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1860
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_1864:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1864
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1864
loop_end_1864:
; LEFT
SUB ESI , 3
loop_start_1871:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1871
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1871
loop_end_1871:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1860
loop_end_1860:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1882:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1882
; RIGHT
ADD ESI , 1
loop_start_1884:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1884
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_1889:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1889
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 12
loop_start_1896:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1896
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1896
loop_end_1896:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1889
loop_end_1889:
; RIGHT
ADD ESI , 1
loop_start_1905:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1905
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1905
loop_end_1905:
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1884
loop_end_1884:
; RIGHT
ADD ESI , 2
loop_start_1916:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1916
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_1921:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1921
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1921
loop_end_1921:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1916
loop_end_1916:
; RIGHT
ADD ESI , 1
loop_start_1932:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1932
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1932
loop_end_1932:
; LEFT
SUB ESI , 13
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1882
loop_end_1882:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1855
loop_end_1855:
; RIGHT
ADD ESI , 4
loop_start_1942:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1942
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1942
loop_end_1942:
; LEFT
SUB ESI , 4
loop_start_1949:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1949
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_1954:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1954
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_1958:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1958
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1958
loop_end_1958:
; LEFT
SUB ESI , 2
loop_start_1965:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1965
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1965
loop_end_1965:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1954
loop_end_1954:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_1976:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1976
; RIGHT
ADD ESI , 1
loop_start_1978:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1978
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_1983:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1983
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
loop_start_1990:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1990
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1990
loop_end_1990:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1983
loop_end_1983:
; LEFT
SUB ESI , 1
loop_start_1999:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_1999
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1999
loop_end_1999:
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1978
loop_end_1978:
; RIGHT
ADD ESI , 3
loop_start_2010:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2010
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2015:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2015
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 10
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2015
loop_end_2015:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2010
loop_end_2010:
; LEFT
SUB ESI , 1
loop_start_2026:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2026
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2026
loop_end_2026:
; LEFT
SUB ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1976
loop_end_1976:
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_1949
loop_end_1949:
; RIGHT
ADD ESI , 9
loop_start_2039:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2039
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2039
loop_end_2039:
; LEFT
SUB ESI , 9
loop_start_2049:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2049
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2049
loop_end_2049:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2057:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2057
; RIGHT
ADD ESI , 7
loop_start_2059:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2059
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2059
loop_end_2059:
; LEFT
SUB ESI , 6
loop_start_2066:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2066
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2066
loop_end_2066:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2057
loop_end_2057:
; LEFT
SUB ESI , 9
loop_start_2077:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2077
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2077
loop_end_2077:
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2083:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2083
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2083
loop_end_2083:
; RIGHT
ADD ESI , 2
loop_start_2092:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2092
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
loop_start_2095:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2095
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 2
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2095
loop_end_2095:
; RIGHT
ADD ESI , 5
loop_start_2104:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2104
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2104
loop_end_2104:
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2092
loop_end_2092:
; LEFT
SUB ESI , 2
loop_start_2117:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2117
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2117
loop_end_2117:
; LEFT
SUB ESI , 5
loop_start_2124:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2124
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2124
loop_end_2124:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_2132:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2132
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2132
loop_end_2132:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_2140:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2140
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2145:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2145
; RIGHT
ADD ESI , 3
loop_start_2147:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2147
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2147
loop_end_2147:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2155:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2155
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_2160:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2160
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2160
loop_end_2160:
; LEFT
SUB ESI , 2
loop_start_2167:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2167
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 11
loop_start_2172:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2172
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2172
loop_end_2172:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2179:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2179
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2179
loop_end_2179:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2167
loop_end_2167:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2155
loop_end_2155:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_2189:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2189
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2189
loop_end_2189:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_2197:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2197
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2202:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2202
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2202
loop_end_2202:
; LEFT
SUB ESI , 3
loop_start_2209:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2209
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 12
loop_start_2214:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2214
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2214
loop_end_2214:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_2221:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2221
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2221
loop_end_2221:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2209
loop_end_2209:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2197
loop_end_2197:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2232:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2232
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_2235:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2235
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2235
loop_end_2235:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2232
loop_end_2232:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2145
loop_end_2145:
; LEFT
SUB ESI , 9
loop_start_2243:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2243
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2243
loop_end_2243:
; RIGHT
ADD ESI , 3
loop_start_2247:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2247
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2247
loop_end_2247:
; LEFT
SUB ESI , 3
loop_start_2254:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2254
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_2259:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2259
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2263:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2263
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2263
loop_end_2263:
; LEFT
SUB ESI , 1
loop_start_2270:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2270
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2270
loop_end_2270:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2259
loop_end_2259:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_2281:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2281
; RIGHT
ADD ESI , 1
loop_start_2283:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2283
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_2288:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2288
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
loop_start_2295:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2295
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2295
loop_end_2295:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2288
loop_end_2288:
; LEFT
SUB ESI , 1
loop_start_2304:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2304
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2304
loop_end_2304:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2283
loop_end_2283:
; RIGHT
ADD ESI , 2
loop_start_2315:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2315
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2320:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2320
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2320
loop_end_2320:
; RIGHT
ADD ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2315
loop_end_2315:
; LEFT
SUB ESI , 1
loop_start_2331:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2331
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2331
loop_end_2331:
; LEFT
SUB ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2281
loop_end_2281:
; RIGHT
ADD ESI , 5
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_2342:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2342
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2342
loop_end_2342:
; LEFT
SUB ESI , 7
loop_start_2349:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2349
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2349
loop_end_2349:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2254
loop_end_2254:
; RIGHT
ADD ESI , 4
loop_start_2359:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2359
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2359
loop_end_2359:
; LEFT
SUB ESI , 4
loop_start_2366:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2366
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2371:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2371
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_2375:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2375
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2375
loop_end_2375:
; LEFT
SUB ESI , 2
loop_start_2382:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2382
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2382
loop_end_2382:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2371
loop_end_2371:
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_2393:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2393
; RIGHT
ADD ESI , 1
loop_start_2395:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2395
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2400:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2400
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
loop_start_2407:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2407
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2407
loop_end_2407:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2400
loop_end_2400:
; RIGHT
ADD ESI , 1
loop_start_2416:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2416
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2416
loop_end_2416:
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2395
loop_end_2395:
; RIGHT
ADD ESI , 1
loop_start_2427:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2427
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_2432:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2432
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2432
loop_end_2432:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2427
loop_end_2427:
; RIGHT
ADD ESI , 1
loop_start_2443:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2443
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2443
loop_end_2443:
; LEFT
SUB ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2393
loop_end_2393:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2366
loop_end_2366:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2140
loop_end_2140:
; RIGHT
ADD ESI , 4
loop_start_2457:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2457
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2457
loop_end_2457:
; LEFT
SUB ESI , 4
loop_start_2464:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2464
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_2471:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2471
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2471
loop_end_2471:
; LEFT
SUB ESI , 7
loop_start_2478:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2478
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2478
loop_end_2478:
; RIGHT
ADD ESI , 9
loop_start_2487:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2487
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2487
loop_end_2487:
; LEFT
SUB ESI , 9
loop_start_2491:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2491
; RIGHT
ADD ESI , 1
loop_start_2493:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2493
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2498:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2498
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
loop_start_2505:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2505
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2505
loop_end_2505:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2498
loop_end_2498:
; RIGHT
ADD ESI , 1
loop_start_2514:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2514
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2514
loop_end_2514:
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2493
loop_end_2493:
; RIGHT
ADD ESI , 1
loop_start_2525:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2525
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_2530:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2530
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2530
loop_end_2530:
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2525
loop_end_2525:
; RIGHT
ADD ESI , 1
loop_start_2541:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2541
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2541
loop_end_2541:
; LEFT
SUB ESI , 12
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2491
loop_end_2491:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2464
loop_end_2464:
; RIGHT
ADD ESI , 9
loop_start_2551:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2551
; RIGHT
ADD ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2551
loop_end_2551:
; LEFT
SUB ESI , 9
loop_start_2559:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2559
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2559
loop_end_2559:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2567:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2567
; RIGHT
ADD ESI , 5
loop_start_2569:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2569
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2569
loop_end_2569:
; LEFT
SUB ESI , 4
loop_start_2576:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2576
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2576
loop_end_2576:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2567
loop_end_2567:
; LEFT
SUB ESI , 9
loop_start_2587:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2587
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2587
loop_end_2587:
; RIGHT
ADD ESI , 9
loop_start_2591:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2591
; RIGHT
ADD ESI , 6
loop_start_2593:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2593
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2593
loop_end_2593:
; LEFT
SUB ESI , 5
loop_start_2600:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2600
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2600
loop_end_2600:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2591
loop_end_2591:
; LEFT
SUB ESI , 9
loop_start_2611:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2611
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2611
loop_end_2611:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_2616:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2616
loop_start_2617:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2617
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2617
loop_end_2617:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_2640:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2640
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2640
loop_end_2640:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2616
loop_end_2616:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
loop_start_2647:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2647
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2647
loop_end_2647:
; LEFT
SUB ESI , 9
loop_start_2653:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2653
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2653
loop_end_2653:
; RIGHT
ADD ESI , 9
loop_start_2657:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2657
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_2661:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2661
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2661
loop_end_2661:
; LEFT
SUB ESI , 4
loop_start_2668:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2668
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_2673:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2673
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_2676:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2676
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2676
loop_end_2676:
; LEFT
SUB ESI , 2
loop_start_2683:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2683
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2683
loop_end_2683:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2673
loop_end_2673:
; LEFT
SUB ESI , 8
loop_start_2695:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2695
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2695
loop_end_2695:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2668
loop_end_2668:
; RIGHT
ADD ESI , 9
loop_start_2700:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2700
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2700
loop_end_2700:
; LEFT
SUB ESI , 9
loop_start_2704:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2704
; RIGHT
ADD ESI , 1
loop_start_2706:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2706
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2706
loop_end_2706:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2704
loop_end_2704:
; RIGHT
ADD ESI , 1
loop_start_2715:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2715
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2715
loop_end_2715:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2657
loop_end_2657:
; LEFT
SUB ESI , 9
loop_start_2726:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2726
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_2732:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2732
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2737:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2737
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2737
loop_end_2737:
; LEFT
SUB ESI , 1
loop_start_2747:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2747
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2747
loop_end_2747:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2732
loop_end_2732:
; LEFT
SUB ESI , 3
loop_start_2756:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2756
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2756
loop_end_2756:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2726
loop_end_2726:
; RIGHT
ADD ESI , 9
loop_start_2767:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2767
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2767
loop_end_2767:
; LEFT
SUB ESI , 9
loop_start_2773:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2773
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2773
loop_end_2773:
; RIGHT
ADD ESI , 9
loop_start_2777:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2777
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2781:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2781
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2781
loop_end_2781:
; LEFT
SUB ESI , 5
loop_start_2788:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2788
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_2793:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2793
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_2796:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2796
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2796
loop_end_2796:
; LEFT
SUB ESI , 3
loop_start_2803:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2803
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2803
loop_end_2803:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2793
loop_end_2793:
; LEFT
SUB ESI , 8
loop_start_2815:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2815
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2815
loop_end_2815:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2788
loop_end_2788:
; RIGHT
ADD ESI , 9
loop_start_2820:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2820
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2820
loop_end_2820:
; LEFT
SUB ESI , 9
loop_start_2824:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2824
; RIGHT
ADD ESI , 2
loop_start_2826:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2826
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2826
loop_end_2826:
; LEFT
SUB ESI , 11
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2824
loop_end_2824:
; RIGHT
ADD ESI , 2
loop_start_2835:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2835
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2835
loop_end_2835:
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2777
loop_end_2777:
; LEFT
SUB ESI , 9
loop_start_2846:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2846
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_2852:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2852
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2857:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2857
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2857
loop_end_2857:
; LEFT
SUB ESI , 1
loop_start_2867:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2867
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2867
loop_end_2867:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2852
loop_end_2852:
; LEFT
SUB ESI , 3
loop_start_2876:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2876
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2876
loop_end_2876:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2846
loop_end_2846:
; RIGHT
ADD ESI , 9
loop_start_2887:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2887
; RIGHT
ADD ESI , 4
loop_start_2889:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2889
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 36
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 36
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2889
loop_end_2889:
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2887
loop_end_2887:
; LEFT
SUB ESI , 9
loop_start_2898:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2898
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2898
loop_end_2898:
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 15
mov [buffer + ESI] , AH
loop_start_2903:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2903
loop_start_2904:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2904
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2904
loop_end_2904:
; LEFT
SUB ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
loop_start_2910:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2910
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2910
loop_end_2910:
; RIGHT
ADD ESI , 9
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2903
loop_end_2903:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 21
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2920:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2920
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2920
loop_end_2920:
; RIGHT
ADD ESI , 9
loop_start_2924:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2924
; RIGHT
ADD ESI , 3
loop_start_2926:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2926
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2926
loop_end_2926:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
loop_start_2934:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2934
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_2939:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2939
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2939
loop_end_2939:
; LEFT
SUB ESI , 4
loop_start_2946:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2946
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 13
loop_start_2951:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2951
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2951
loop_end_2951:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_2958:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2958
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2958
loop_end_2958:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2946
loop_end_2946:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2934
loop_end_2934:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_2968:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2968
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2968
loop_end_2968:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_2976:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2976
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_2981:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2981
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2981
loop_end_2981:
; LEFT
SUB ESI , 3
loop_start_2988:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2988
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 12
loop_start_2993:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_2993
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2993
loop_end_2993:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_3000:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3000
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3000
loop_end_3000:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2988
loop_end_2988:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2976
loop_end_2976:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3011:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3011
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_3014:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3014
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3014
loop_end_3014:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3011
loop_end_3011:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_2924
loop_end_2924:
; LEFT
SUB ESI , 9
loop_start_3022:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3022
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3022
loop_end_3022:
; RIGHT
ADD ESI , 2
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3028:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3028
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3028
loop_end_3028:
; LEFT
SUB ESI , 4
loop_start_3035:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3035
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3035
loop_end_3035:
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_622
loop_end_622:
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_3048:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3048
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3048
loop_end_3048:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
loop_start_3056:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3056
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PRINT TO STDOUT
mov AH , [buffer + ESI]
mov [value] , AH
mov EAX , 4
mov EBX , 1
mov ECX , value
mov EDX , 1
int 0x80
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3056
loop_end_3056:
; RIGHT
ADD ESI , 4
loop_start_3065:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3065
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PRINT TO STDOUT
mov AH , [buffer + ESI]
mov [value] , AH
mov EAX , 4
mov EBX , 1
mov ECX , value
mov EDX , 1
int 0x80
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3065
loop_end_3065:
; LEFT
SUB ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
loop_start_3084:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3084
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3084
loop_end_3084:
; LEFT
SUB ESI , 9
loop_start_3100:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3100
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3100
loop_end_3100:
; RIGHT
ADD ESI , 9
loop_start_3104:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3104
; RIGHT
ADD ESI , 5
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3104
loop_end_3104:
; LEFT
SUB ESI , 9
loop_start_3110:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3110
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3110
loop_end_3110:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 11
mov [buffer + ESI] , AH
loop_start_3115:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3115
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3117:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3117
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3117
loop_end_3117:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3115
loop_end_3115:
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
loop_start_3130:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3130
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3130
loop_end_3130:
; RIGHT
ADD ESI , 7
loop_start_3134:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3134
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3134
loop_end_3134:
; LEFT
SUB ESI , 7
loop_start_3141:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3141
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3147:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3147
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3147
loop_end_3147:
; LEFT
SUB ESI , 9
loop_start_3151:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3151
; RIGHT
ADD ESI , 7
loop_start_3153:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3153
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3153
loop_end_3153:
; LEFT
SUB ESI , 6
loop_start_3160:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3160
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
loop_start_3165:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3165
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3165
loop_end_3165:
; RIGHT
ADD ESI , 7
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3160
loop_end_3160:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3151
loop_end_3151:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3141
loop_end_3141:
; RIGHT
ADD ESI , 7
loop_start_3177:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3177
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3177
loop_end_3177:
; LEFT
SUB ESI , 7
loop_start_3184:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3184
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3189:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3189
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
loop_start_3193:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3193
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3193
loop_end_3193:
; LEFT
SUB ESI , 4
loop_start_3200:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3200
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3200
loop_end_3200:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3189
loop_end_3189:
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
loop_start_3211:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3211
; RIGHT
ADD ESI , 5
loop_start_3213:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3213
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3213
loop_end_3213:
; LEFT
SUB ESI , 14
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3211
loop_end_3211:
; RIGHT
ADD ESI , 9
loop_start_3222:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3222
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3222
loop_end_3222:
; LEFT
SUB ESI , 9
loop_start_3226:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3226
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
loop_start_3232:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3232
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3237:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3237
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3237
loop_end_3237:
; LEFT
SUB ESI , 1
loop_start_3247:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3247
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3247
loop_end_3247:
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3232
loop_end_3232:
; LEFT
SUB ESI , 6
loop_start_3256:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3256
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3256
loop_end_3256:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3226
loop_end_3226:
; RIGHT
ADD ESI , 7
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3184
loop_end_3184:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
loop_start_3275:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3275
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3275
loop_end_3275:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
loop_start_3283:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3283
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3288:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3288
; RIGHT
ADD ESI , 5
loop_start_3290:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3290
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3290
loop_end_3290:
; RIGHT
ADD ESI , 4
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3288
loop_end_3288:
; LEFT
SUB ESI , 9
loop_start_3299:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3299
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
loop_start_3305:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3305
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3310:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3310
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3310
loop_end_3310:
; LEFT
SUB ESI , 1
loop_start_3320:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3320
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3320
loop_end_3320:
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3305
loop_end_3305:
; LEFT
SUB ESI , 6
loop_start_3329:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3329
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3329
loop_end_3329:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3299
loop_end_3299:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
loop_start_3341:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3341
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3343:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3343
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3343
loop_end_3343:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3341
loop_end_3341:
; RIGHT
ADD ESI , 4
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_3354:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3354
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3354
loop_end_3354:
; RIGHT
ADD ESI , 9
loop_start_3358:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3358
; RIGHT
ADD ESI , 5
loop_start_3360:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3360
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3360
loop_end_3360:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_3368:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3368
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3373:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3373
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3373
loop_end_3373:
; LEFT
SUB ESI , 7
loop_start_3380:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3380
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 16
loop_start_3385:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3385
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3385
loop_end_3385:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_3392:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3392
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3392
loop_end_3392:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3380
loop_end_3380:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3368
loop_end_3368:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
loop_start_3402:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3402
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3402
loop_end_3402:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
loop_start_3410:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3410
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_3415:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3415
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3415
loop_end_3415:
; LEFT
SUB ESI , 5
loop_start_3422:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3422
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 14
loop_start_3427:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3427
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3427
loop_end_3427:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_3434:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3434
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3434
loop_end_3434:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3422
loop_end_3422:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3410
loop_end_3410:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3445:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3445
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_3448:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3448
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3448
loop_end_3448:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3445
loop_end_3445:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3358
loop_end_3358:
; LEFT
SUB ESI , 9
loop_start_3456:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3456
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3456
loop_end_3456:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
loop_start_3463:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3463
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3465:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3465
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3465
loop_end_3465:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3463
loop_end_3463:
; RIGHT
ADD ESI , 4
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
loop_start_3476:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3476
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3476
loop_end_3476:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3283
loop_end_3283:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_113
loop_end_113:
; LEFT
SUB ESI , 4
; PRINT TO STDOUT
mov AH , [buffer + ESI]
mov [value] , AH
mov EAX , 4
mov EBX , 1
mov ECX , value
mov EDX , 1
int 0x80
; RIGHT
ADD ESI , 10
loop_start_3485:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3485
; RIGHT
ADD ESI , 6
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3485
loop_end_3485:
; LEFT
SUB ESI , 9
loop_start_3491:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3491
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3491
loop_end_3491:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 10
mov [buffer + ESI] , AH
loop_start_3496:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3496
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3498:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3498
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3498
loop_end_3498:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3496
loop_end_3496:
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 15
loop_start_3511:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3511
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3511
loop_end_3511:
; RIGHT
ADD ESI , 8
loop_start_3515:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3515
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3515
loop_end_3515:
; LEFT
SUB ESI , 8
loop_start_3522:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3522
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3528:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3528
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3528
loop_end_3528:
; LEFT
SUB ESI , 9
loop_start_3532:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3532
; RIGHT
ADD ESI , 8
loop_start_3534:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3534
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3534
loop_end_3534:
; LEFT
SUB ESI , 7
loop_start_3541:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3541
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
loop_start_3546:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3546
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3546
loop_end_3546:
; RIGHT
ADD ESI , 8
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3541
loop_end_3541:
; LEFT
SUB ESI , 10
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3532
loop_end_3532:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3522
loop_end_3522:
; RIGHT
ADD ESI , 8
loop_start_3558:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3558
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3558
loop_end_3558:
; LEFT
SUB ESI , 8
loop_start_3565:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3565
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3570:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3570
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_3574:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3574
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3574
loop_end_3574:
; LEFT
SUB ESI , 5
loop_start_3581:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3581
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3581
loop_end_3581:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3570
loop_end_3570:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
loop_start_3592:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3592
; RIGHT
ADD ESI , 6
loop_start_3594:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3594
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3594
loop_end_3594:
; LEFT
SUB ESI , 15
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3592
loop_end_3592:
; RIGHT
ADD ESI , 9
loop_start_3603:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3603
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3603
loop_end_3603:
; LEFT
SUB ESI , 9
loop_start_3607:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3607
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
loop_start_3613:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3613
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3618:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3618
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3618
loop_end_3618:
; LEFT
SUB ESI , 1
loop_start_3628:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3628
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3628
loop_end_3628:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3613
loop_end_3613:
; LEFT
SUB ESI , 7
loop_start_3637:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3637
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3637
loop_end_3637:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3607
loop_end_3607:
; RIGHT
ADD ESI , 8
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 5
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3565
loop_end_3565:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
loop_start_3656:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3656
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3656
loop_end_3656:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
loop_start_3664:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3664
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3669:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3669
; RIGHT
ADD ESI , 6
loop_start_3671:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3671
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3671
loop_end_3671:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3669
loop_end_3669:
; LEFT
SUB ESI , 9
loop_start_3680:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3680
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
loop_start_3686:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3686
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3691:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3691
; LEFT
SUB ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3691
loop_end_3691:
; LEFT
SUB ESI , 1
loop_start_3701:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3701
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3701
loop_end_3701:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3686
loop_end_3686:
; LEFT
SUB ESI , 7
loop_start_3710:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3710
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 7
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 7
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3710
loop_end_3710:
; LEFT
SUB ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3680
loop_end_3680:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
loop_start_3722:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3722
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3724:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3724
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3724
loop_end_3724:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3722
loop_end_3722:
; RIGHT
ADD ESI , 5
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 27
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_3737:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3737
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3737
loop_end_3737:
; RIGHT
ADD ESI , 9
loop_start_3741:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3741
; RIGHT
ADD ESI , 6
loop_start_3743:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3743
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3743
loop_end_3743:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_3751:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3751
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 2
loop_start_3756:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3756
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3756
loop_end_3756:
; LEFT
SUB ESI , 8
loop_start_3763:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3763
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 17
loop_start_3768:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3768
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3768
loop_end_3768:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 5
loop_start_3775:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3775
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3775
loop_end_3775:
; RIGHT
ADD ESI , 1
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3763
loop_end_3763:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3751
loop_end_3751:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
loop_start_3785:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3785
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3785
loop_end_3785:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 8
loop_start_3793:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3793
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 8
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 2
loop_start_3798:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3798
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3798
loop_end_3798:
; LEFT
SUB ESI , 6
loop_start_3805:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3805
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 15
loop_start_3810:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3810
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3810
loop_end_3810:
; RIGHT
ADD ESI , 3
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 6
loop_start_3817:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3817
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3817
loop_end_3817:
; RIGHT
ADD ESI , 1
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3805
loop_end_3805:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3793
loop_end_3793:
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 1
loop_start_3828:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3828
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 1
loop_start_3831:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3831
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3831
loop_end_3831:
; LEFT
SUB ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3828
loop_end_3828:
; RIGHT
ADD ESI , 8
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3741
loop_end_3741:
; LEFT
SUB ESI , 9
loop_start_3839:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3839
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3839
loop_end_3839:
; RIGHT
ADD ESI , 4
;Reset to zero
mov AH , byte [buffer + ESI]
mov AH , 0
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 3
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 5
mov [buffer + ESI] , AH
loop_start_3846:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3846
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
loop_start_3848:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3848
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 9
; PLUS
mov AH , byte [buffer + ESI]
ADD AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3848
loop_end_3848:
; RIGHT
ADD ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3846
loop_end_3846:
; RIGHT
ADD ESI , 5
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; RIGHT
ADD ESI , 27
; MINUS
mov AH , byte [buffer + ESI]
SUB AH , 1
mov [buffer + ESI] , AH
; LEFT
SUB ESI , 6
loop_start_3861:
mov AH , byte [buffer + ESI]
cmp AH , 0
je loop_end_3861
; LEFT
SUB ESI , 9
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3861
loop_end_3861:
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_3664
loop_end_3664:
; RIGHT
ADD ESI , 3
mov AH , byte [buffer + ESI]
cmp AH , 0
jne loop_start_66
loop_end_66:
;exit
mov EAX , 1
int 0x80 ;exit | SamuelYvon/BrainCramp | Java/src/com/samuelyvon/BrainCramp/Compilation/nasm/out/mandelbrot.asm | Assembly | mit | 205,310 |
MOV [0] 7
JMP [0]
DPRINT 5
DPRINT 10
HALT
| ocus/TinyASM_Haskell | test-suite/programs/unit/jmp_0x0E.asm | Assembly | bsd-3-clause | 42 |
;
; Copyright (c) 2014 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
%define private_prefix vp9
%include "third_party/x86inc/x86inc.asm"
SECTION .text
%macro TRANSFORM_COLS 0
paddw m0, m1
movq m4, m0
psubw m3, m2
psubw m4, m3
psraw m4, 1
movq m5, m4
psubw m5, m1 ;b1
psubw m4, m2 ;c1
psubw m0, m4
paddw m3, m5
; m0 a0
SWAP 1, 4 ; m1 c1
SWAP 2, 3 ; m2 d1
SWAP 3, 5 ; m3 b1
%endmacro
%macro TRANSPOSE_4X4 0
movq m4, m0
movq m5, m2
punpcklwd m4, m1
punpckhwd m0, m1
punpcklwd m5, m3
punpckhwd m2, m3
movq m1, m4
movq m3, m0
punpckldq m1, m5
punpckhdq m4, m5
punpckldq m3, m2
punpckhdq m0, m2
SWAP 2, 3, 0, 1, 4
%endmacro
INIT_MMX mmx
cglobal fwht4x4, 3, 4, 8, input, output, stride
lea r3q, [inputq + strideq*4]
movq m0, [inputq] ;a1
movq m1, [inputq + strideq*2] ;b1
movq m2, [r3q] ;c1
movq m3, [r3q + strideq*2] ;d1
TRANSFORM_COLS
TRANSPOSE_4X4
TRANSFORM_COLS
TRANSPOSE_4X4
psllw m0, 2
psllw m1, 2
psllw m2, 2
psllw m3, 2
%if CONFIG_VP9_HIGHBITDEPTH
pxor m4, m4
pxor m5, m5
pcmpgtw m4, m0
pcmpgtw m5, m1
movq m6, m0
movq m7, m1
punpcklwd m0, m4
punpcklwd m1, m5
punpckhwd m6, m4
punpckhwd m7, m5
movq [outputq], m0
movq [outputq + 8], m6
movq [outputq + 16], m1
movq [outputq + 24], m7
pxor m4, m4
pxor m5, m5
pcmpgtw m4, m2
pcmpgtw m5, m3
movq m6, m2
movq m7, m3
punpcklwd m2, m4
punpcklwd m3, m5
punpckhwd m6, m4
punpckhwd m7, m5
movq [outputq + 32], m2
movq [outputq + 40], m6
movq [outputq + 48], m3
movq [outputq + 56], m7
%else
movq [outputq], m0
movq [outputq + 8], m1
movq [outputq + 16], m2
movq [outputq + 24], m3
%endif
RET
| blloyd75/theoraplayer | vpx/vp9/encoder/x86/vp9_dct_mmx.asm | Assembly | bsd-3-clause | 3,181 |
; Initial value
MOV F, 1
; Decrement the value multiple times
INC F
INC F
INC F
INC F
; Write register F to the Output Port
OUTB F
HLT | KPU-RISC/KPU | Assembler/AssemblyCode/INC.asm | Assembly | mit | 137 |
//===========================================================================//
// GLOSS - Generic Loader for Operating System Software //
// An extensible and configurable bootloader. //
//---------------------------------------------------------------------------//
// Copyright (C) 2013-2016 ~ Adrian J. Collado <acollado@polaritech.com> //
// All Rights Reserved //
//===========================================================================//
// Seeing as how AT&T syntax is much more obscure and difficult to read (IMO)
// than Intel syntax, the assembly language code in this project for x86 based
// architectures will be using Intel syntax.
.intel_syntax noprefix
// This code will be executed in a 16 bit real mode environment.
.code16
// This code is located in the .TEXT (executable) section of the executable.
.section .text
.global I8086.Memory.Clear
I8086.Memory.Clear:
cld
rep stosb
ret
| AdrianCollado/SlickOS | Modules/Gloss/Arch/x86_64/Source/Memory/Clear.asm | Assembly | mit | 1,035 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2006-2008. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Serge 2006-2008
; email: infinity_sound@mail.ru
format MS COFF
DEBUG equ 1
include 'proc32.inc'
include 'main.inc'
include 'imports.inc'
CURRENT_API equ 0x0101 ;1.01
COMPATIBLE_API equ 0x0100 ;1.00
API_VERSION equ (COMPATIBLE_API shl 16) or CURRENT_API
SOUND_VERSION equ CURRENT_API
FORCE_MMX equ 0 ;set to 1 to force use mmx or
FORCE_MMX_128 equ 0 ;integer sse2 extensions
;and reduce driver size
;USE_SSE equ 0
USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default
OS_BASE equ 0x80000000
CAPS_SSE2 equ 26
PG_SW equ 0x003
public START
public service_proc
public version
RT_INP_EMPTY equ 0xFF000001
RT_OUT_EMPTY equ 0xFF000002
RT_INP_FULL equ 0xFF000003
RT_OUT_FULL equ 0xFF000004
EVENT_WATCHED equ 0x10000000
EVENT_SIGNALED equ 0x20000000
MANUAL_RESET equ 0x40000000
MANUAL_DESTROY equ 0x80000000
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
struc IOCTL
{ .handle dd ?
.io_code dd ?
.input dd ?
.inp_size dd ?
.output dd ?
.out_size dd ?
}
virtual at 0
IOCTL IOCTL
end virtual
section '.flat' code readable align 16
proc START stdcall, state:dword
cmp [state], 1
jne .exit
stdcall GetService, szSound
test eax, eax
jz .fail
mov [hSound], eax
stdcall KernelAlloc, 16*512
test eax, eax
jz .out_of_mem
mov [mix_buff], eax
mov eax, str.fd-FD_OFFSET
mov [str.fd], eax
mov [str.bk], eax
if FORCE_MMX
if FORCE_MMX_128
display 'Use only FORCE_MMX or FORCE_MMX_128 not both together',13,10
stop
end if
mov [mix_2_core], mmx_mix_2
mov [mix_3_core], mmx_mix_3
mov [mix_4_core], mmx_mix_4
end if
if FORCE_MMX_128
if FORCE_MMX
display 'Use only FORCE_MMX or FORCE_MMX_128 not both together',13,10
stop
end if
mov [mix_2_core], mmx128_mix_2
mov [mix_3_core], mmx128_mix_3
mov [mix_4_core], mmx128_mix_4
end if
if 0
if ~(FORCE_MMX or FORCE_MMX_128) ;autodetect
mov eax, 1
cpuid
bt edx, CAPS_SSE2
jc .mmx128
;old 64-bit mmx
mov [mix_2_core], mmx_mix_2
mov [mix_3_core], mmx_mix_3
mov [mix_4_core], mmx_mix_4
jmp @F
.mmx128: ;128-bit integer sse2 extensions
mov [mix_2_core], mmx128_mix_2
mov [mix_3_core], mmx128_mix_3
mov [mix_4_core], mmx128_mix_4
@@:
end if
end if
stdcall set_handler, [hSound], new_mix
mov [eng_state], SND_STOP
stdcall RegService, szInfinity, service_proc
ret
.fail:
if DEBUG
mov esi, msgFail
call SysMsgBoardStr
end if
.exit:
xor eax, eax
ret
.out_of_mem:
if DEBUG
mov esi, msgMem
call SysMsgBoardStr
end if
xor eax, eax
ret
endp
handle equ IOCTL.handle
io_code equ IOCTL.io_code
input equ IOCTL.input
inp_size equ IOCTL.inp_size
output equ IOCTL.output
out_size equ IOCTL.out_size
align 4
proc service_proc stdcall, ioctl:dword
mov edi, [ioctl]
mov eax, [edi+io_code]
cmp eax, SRV_GETVERSION
jne @F
mov eax, [edi+output]
cmp [edi+out_size], 4
jne .fail
mov eax, [eax]
mov [eax], dword API_VERSION
xor eax, eax
ret
@@:
cmp eax, SND_CREATE_BUFF
jne @F
mov ebx, [edi+input]
stdcall CreateBuffer,[ebx],[ebx+4]
mov edi, [ioctl]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], ebx
ret
@@:
mov ebx, [edi+input]
mov edx, [ebx]
cmp [edx+STREAM.magic], 'WAVE'
jne .fail
cmp [edx+STREAM.size], STREAM_SIZE
jne .fail
cmp eax, SND_DESTROY_BUFF
jne @F
mov eax, edx
call DestroyBuffer ;edx= stream
ret
@@:
cmp eax, SND_SETFORMAT
jne @F
stdcall SetFormat,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETFORMAT
jne @F
movzx eax, word [edx+STREAM.format]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], eax
xor eax, eax
ret
@@:
cmp eax, SND_RESET
jne @F
stdcall ResetBuffer,edx,[ebx+4]
ret
@@:
cmp eax, SND_SETPOS
jne @F
stdcall SetBufferPos,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETPOS
jne @F
stdcall GetBufferPos, edx
mov edi, [ioctl]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], ebx
ret
@@:
cmp eax, SND_SETBUFF
jne @F
mov eax, [ebx+4]
stdcall set_buffer, edx,eax,[ebx+8],[ebx+12]
ret
@@:
cmp eax, SND_SETVOLUME
jne @F
stdcall SetBufferVol,edx,[ebx+4],[ebx+8]
ret
@@:
cmp eax, SND_GETVOLUME
jne @F
mov eax, [edi+output]
mov ecx, [eax]
mov eax, [eax+4]
stdcall GetBufferVol,edx,ecx,eax
ret
@@:
cmp eax, SND_SETPAN
jne @F
stdcall SetBufferPan,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETPAN
jne @F
mov eax, [edx+STREAM.pan]
mov ebx, [edi+output]
mov ebx, [ebx]
mov [ebx], eax
xor eax, eax
ret
@@:
cmp eax, SND_OUT
jne @F
mov eax, [ebx+4]
stdcall wave_out, edx,eax,[ebx+8]
ret
@@:
cmp eax, SND_PLAY
jne @F
stdcall play_buffer, edx,[ebx+4]
ret
@@:
cmp eax, SND_STOP
jne @F
stdcall stop_buffer, edx
ret
@@:
cmp eax, SND_GETBUFFSIZE
jne @F
mov eax, [edx+STREAM.in_size]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], eax
xor eax, eax
ret
@@:
cmp eax, SND_GETFREESPACE
jne @F
test [edx+STREAM.format], PCM_OUT
jz .fail
mov ebx, [edx+STREAM.in_free]
mov ecx, [edi+output]
mov [ecx], ebx
xor eax, eax
ret
@@:
.fail:
or eax, -1
ret
endp
restore handle
restore io_code
restore input
restore inp_size
restore output
restore out_size
align 4
proc CreateBuffer stdcall, format:dword, size:dword
locals
str dd ?
ring_size dd ?
ring_pages dd ?
endl
mov eax, [format]
cmp ax, PCM_1_8_8
ja .fail
test eax, PCM_OUT
jnz .test_out
test eax, PCM_RING
jnz .test_ring
;staic
test eax, PCM_STATIC
jz .test_out ;use PCM_OUT as default format
jmp .test_ok
.test_out:
test eax, PCM_RING+PCM_STATIC
jnz .fail
or [format], PCM_OUT ;force set
jmp .test_ok
.test_ring:
test eax, PCM_OUT+PCM_STATIC
jnz .fail
.test_ok:
call GetPid
mov ebx, eax
mov eax, STREAM_SIZE
call CreateObject
test eax, eax
jz .fail
mov [str], eax
mov ebx, [format]
mov [eax+STREAM.format], ebx
xor ecx, ecx
movzx ebx, bx
cmp ebx, 19
jb @f
mov ecx, 0x80808080
@@:
mov [eax+STREAM.r_silence], ecx
shl ebx, 2
lea ebx, [ebx+ebx*2] ;ebx*=12
mov ecx, [resampler_params+ebx]
mov edx, [resampler_params+ebx+4]
mov esi, [resampler_params+ebx+8]
mov [eax+STREAM.r_size],ecx
mov [eax+STREAM.r_dt], edx
mov [eax+STREAM.resample], esi
xor ecx, ecx
mov [eax+STREAM.l_vol], ecx
mov [eax+STREAM.r_vol], ecx
mov dword [eax+STREAM.l_amp], 0x7FFF7FFF
mov [eax+STREAM.pan], ecx
test [format], PCM_STATIC
jnz .static
; ring and waveout
mov ebx, 0x10000
test [format], PCM_RING
jz .waveout
mov ebx, [eax+STREAM.r_size]
add ebx, 4095
and ebx, -4096
add ebx, ebx
.waveout:
mov [ring_size], ebx
mov eax, ebx
shr ebx, 12
mov [ring_pages], ebx
stdcall CreateRingBuffer, eax, PG_SW
mov edi, [str]
mov ecx, [ring_size]
mov [edi+STREAM.in_base], eax
mov [edi+STREAM.in_size], ecx
add eax, 128
; sub ecx, 128
mov [edi+STREAM.in_wp], eax
mov [edi+STREAM.in_rp], eax
mov [edi+STREAM.in_count], 0
mov [edi+STREAM.in_free], ecx
add eax, ecx
mov [edi+STREAM.in_top], eax
jmp .out_buff
.static:
mov ecx, [size]
add ecx, 128 ;resampler required
mov [eax+STREAM.in_size], ecx
stdcall KernelAlloc, ecx
mov edi, [str]
mov [edi+STREAM.in_base], eax
add eax, 128
mov [edi+STREAM.in_wp], eax
mov [edi+STREAM.in_rp], eax
mov ebx, [size]
mov [edi+STREAM.in_count], ebx
mov [edi+STREAM.in_free], ebx
add eax, ebx
mov [edi+STREAM.in_top], eax
.out_buff:
stdcall AllocKernelSpace, dword 128*1024
mov edi, [str]
mov [edi+STREAM.out_base], eax
mov [edi+STREAM.out_wp], eax
mov [edi+STREAM.out_rp], eax
mov [edi+STREAM.out_count], 0
add eax, 64*1024
mov [edi+STREAM.out_top], eax
stdcall AllocPages, dword 64/4
mov edi, [str]
mov ebx, [edi+STREAM.out_base]
mov ecx, 16
or eax, PG_SW
push eax
push ebx
call CommitPages ;eax, ebx, ecx
mov ecx, 16
pop ebx
pop eax
add ebx, 64*1024
call CommitPages ;double mapped
mov edi, [str]
mov ecx, [edi+STREAM.in_top]
mov edi, [edi+STREAM.in_base]
sub ecx, edi
xor eax, eax
shr ecx, 2
cld
rep stosd
mov edi, [str]
mov edi, [edi+STREAM.out_base]
mov ecx, (64*1024)/4
rep stosd
xor esi, esi
mov ecx, MANUAL_DESTROY
call CreateEvent
mov ebx, [str]
mov [ebx+STREAM.notify_event], eax
mov [ebx+STREAM.notify_id], edx
mov [ebx+STREAM.magic], 'WAVE'
mov [ebx+STREAM.destroy], DestroyBuffer.destroy
mov [ebx+STREAM.size], STREAM_SIZE
mov [ebx+STREAM.flags], SND_STOP
pushf
cli
mov eax, str.fd-FD_OFFSET
mov edx, [eax+STREAM.str_fd]
mov [ebx+STREAM.str_fd], edx
mov [ebx+STREAM.str_bk], eax
mov [eax+STREAM.str_fd], ebx
mov [edx+STREAM.str_bk], ebx
popf
xor eax, eax
ret
.fail:
xor ebx, ebx
or eax, -1
ret
endp
;param
; eax= buffer handle
align 4
DestroyBuffer:
.handle equ esp ;local
mov [eax+STREAM.flags], SND_STOP
.destroy:
push eax
pushfd
cli
mov ebx, [eax+STREAM.str_fd]
mov ecx, [eax+STREAM.str_bk]
mov [ebx+STREAM.str_bk], ecx
mov [ecx+STREAM.str_fd], ebx
popf
stdcall KernelFree, [eax+STREAM.in_base]
mov eax, [.handle]
stdcall KernelFree, [eax+STREAM.out_base]
pop eax ;restore stack
call DestroyObject ;eax= stream
xor eax, eax
ret
.fail:
or eax, -1
ret
restore .handle
align 4
proc SetFormat stdcall, str:dword, format:dword
cmp word [format], PCM_1_8_8
ja .fail
mov edx, [str]
mov [edx+STREAM.flags], SND_STOP
test [edx+STREAM.format], PCM_RING
jnz .fail
; mov eax,[edx+STREAM.out_base]
; mov [edx+STREAM.out_wp], eax
; mov [edx+STREAM.out_rp], eax
; mov [edx+STREAM.out_count], 0
movzx eax, word [format]
mov word [edx+STREAM.format], ax
xor ebx, ebx
cmp eax, 19
jb @f
mov ebx, 0x80808080
@@:
mov [edx+STREAM.r_silence], ebx
shl eax, 2
lea eax, [eax+eax*2] ;eax*=12
mov edi, [resampler_params+eax]
mov ecx, [resampler_params+eax+4]
mov ebx, [resampler_params+eax+8]
mov [edx+STREAM.r_size],edi
mov [edx+STREAM.r_dt], ecx
mov [edx+STREAM.resample], ebx
mov edi, [edx+STREAM.in_base]
mov ecx, 128/4
mov eax, [edx+STREAM.r_silence]
cld
rep stosd
xor eax, eax
ret
.fail:
or eax, -1
ret
endp
; for static buffers only
; use waveout for streams
align 4
proc set_buffer stdcall, str:dword,src:dword,offs:dword,size:dword
mov edx, [str]
test [edx+STREAM.format], PCM_OUT
jnz .fail
mov esi, [src]
mov edi, [offs]
add edi, [edx+STREAM.in_base]
add edi, 128
cmp edi, [edx+STREAM.in_top]
jae .fail
mov ecx, [size]
lea ebx, [ecx+edi]
sub ebx, [edx+STREAM.in_top]
jb @F
sub ecx, ebx
@@:
shr ecx, 2
cld
rep movsd
xor eax,eax
ret
.fail:
or eax, -1
ret
endp
; for stream buffers only
align 4
proc wave_out stdcall, str:dword,src:dword,size:dword
locals
state_saved dd ?
fpu_state rb 528
endl
mov edx, [str]
mov eax, [edx+STREAM.format]
test eax, PCM_OUT
jz .fail
cmp ax, PCM_ALL
je .fail
mov esi,[src]
test esi, esi
jz .fail
cmp esi, OS_BASE
jae .fail
mov [state_saved], 0
.main_loop:
mov edx, [str]
mov ebx, [size]
test ebx, ebx
jz .done
cmp [edx+STREAM.flags], SND_STOP
jne .fill
mov edi, [edx+STREAM.in_base]
mov ecx, 128/4
mov eax, [edx+STREAM.r_silence]
cld
rep stosd
mov ecx, [edx+STREAM.in_size]
sub ecx, 128
mov [edx+STREAM.in_wp], edi
mov [edx+STREAM.in_rp], edi
mov [edx+STREAM.in_count], 0
mov [edx+STREAM.in_free], ecx
mov eax,[edx+STREAM.out_base]
mov [edx+STREAM.out_wp], eax
mov [edx+STREAM.out_rp], eax
mov [edx+STREAM.out_count], 0
.fill:
cli
mov ecx, [edx+STREAM.in_free]
test ecx, ecx
jz .wait
cmp ecx, ebx
jbe @F
mov ecx, ebx
@@:
sub [size], ecx
add [edx+STREAM.in_count], ecx
sub [edx+STREAM.in_free], ecx
shr ecx, 2
mov edi, [edx+STREAM.in_wp]
mov esi, [src]
cld
rep movsd
mov [src], esi
cmp edi, [edx+STREAM.in_top]
jb @F
sub edi, [edx+STREAM.in_size]
@@:
mov [edx+STREAM.in_wp], edi
cmp [edx+STREAM.out_count], 32768
jae .skip
cmp [state_saved], 0
jne @F
lea eax, [fpu_state+15]
and eax, -16
call FpuSave
mov [state_saved], 1
@@:
stdcall refill, edx
.skip:
sti
mov edx, [str]
mov [edx+STREAM.flags], SND_PLAY
cmp [eng_state], SND_PLAY
je .main_loop
stdcall dev_play, [hSound]
mov [eng_state], SND_PLAY
jmp .main_loop
.wait:
sti
mov edx, [str]
mov eax, [edx+STREAM.notify_event]
mov ebx, [edx+STREAM.notify_id]
call WaitEvent ;eax ebx
jmp .main_loop
.done:
cmp [state_saved], 1
jne @F
lea eax, [fpu_state+15]
and eax, -16
call FpuRestore
@@:
xor eax, eax
ret
.fail:
or eax, -1
ret
endp
; both static and stream
; reset all but not clear buffers
; flags reserved
; RESET_INPUT equ 1 ;reserved reset and clear input buffer
; RESET_OUTPUT equ 2 ;reserved reset and clear output buffer
; RESET_ALL equ 3
align 4
proc ResetBuffer stdcall, str:dword, flags:dword
mov edx, [str]
mov [edx+STREAM.flags], SND_STOP
mov edi, [edx+STREAM.in_base]
mov ecx, 128/4
mov eax, [edx+STREAM.r_silence]
cld
rep stosd
mov [edx+STREAM.in_wp], edi
mov [edx+STREAM.in_rp], edi
test [edx+STREAM.flags], PCM_STATIC
jnz .static
mov [edx+STREAM.in_count], 0
jmp @F
.static:
mov eax, [edx+STREAM.in_size]
mov [edx+STREAM.in_count], eax
@@:
mov eax, [edx+STREAM.in_size]
sub eax, 128
mov [edx+STREAM.in_free], eax
xor eax, eax
mov ebx,[edx+STREAM.out_base]
mov [edx+STREAM.out_wp], ebx
mov [edx+STREAM.out_rp], ebx
mov [edx+STREAM.out_count], eax
ret
.fail:
or eax, -1
ret
endp
; for static buffers only
align 4
proc SetBufferPos stdcall, str:dword, pos:dword
mov edx, [str]
test [edx+STREAM.format], PCM_STATIC
jz .fail
mov [edx+STREAM.flags], SND_STOP
mov eax, [pos]
add eax, [edx+STREAM.in_base]
mov ebx, [edx+STREAM.in_top]
add eax, 128
cmp eax, ebx
jae .fail
mov [edx+STREAM.in_rp], eax
sub ebx, eax
mov [edx+STREAM.in_count], ebx
xor eax, eax
ret
.fail:
or eax, -1
ret
endp
align 4
proc GetBufferPos stdcall, str:dword
mov edx, [str]
test [edx+STREAM.format], PCM_STATIC
jz .fail
mov ebx, [edx+STREAM.in_rp]
sub ebx, [edx+STREAM.in_base]
sub ebx, 128
xor eax, eax
ret
.fail:
xor ebx,ebx
or eax, -1
ret
endp
; both
align 4
proc SetBufferVol stdcall, str:dword,l_vol:dword,r_vol:dword
mov edx, [str]
stdcall set_vol_param,[l_vol],[r_vol],[edx+STREAM.pan]
ret
endp
proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
locals
_600 dd ?
_32767 dd ?
state rb 108
endl
mov [_600], 0x44160000 ;600.0
mov [_32767], 32767
lea ebx, [state]
fnsave [ebx]
movq mm0, qword [l_vol]
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movq qword [l_vol], mm0
movq qword [edx+STREAM.l_vol], mm0
movd mm1,[pan]
pminsw mm1, qword [pan_max]
pmaxsw mm1, qword [vol_min]
movd [edx+STREAM.pan], mm1
cmp word [edx+STREAM.pan], 0
jl @F
psubsw mm0,mm1
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movd [l_vol],mm0
jmp .calc_amp
@@:
punpckhdq mm0,mm0
paddsw mm0,mm1
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movd [r_vol], mm0
.calc_amp:
emms
fild word [l_vol]
call .calc
fistp word [edx+STREAM.l_amp]
fstp dword [edx+STREAM.l_amp_f]
fstp st0
fild word [r_vol]
call .calc
fistp word [edx+STREAM.r_amp]
fstp dword [edx+STREAM.r_amp_f]
fstp st0
fnclex
lea ebx, [state]
frstor [ebx]
xor eax, eax
inc eax
ret
.calc:
fdiv dword [_600]
fld st0
frndint
fxch st1
fsub st, st1
f2xm1
fld1
faddp st1, st0
fscale
fld st0
fimul dword [_32767]
ret 0
endp
align 4
proc GetBufferVol stdcall, str:dword,p_lvol:dword,p_rvol:dword
mov edx, [str]
mov eax, [p_lvol]
movsx ecx, word [edx+STREAM.l_vol]
mov [eax], ecx
mov eax, [p_rvol]
movsx ecx, word [edx+STREAM.r_vol]
mov [eax], ecx
xor eax, eax
ret
endp
align 4
proc SetBufferPan stdcall, str:dword,pan:dword
mov edx, [str]
stdcall set_vol_param,[edx+STREAM.l_vol],\
[edx+STREAM.r_vol],[pan]
ret
endp
; for static and ring buffers only
align 4
proc play_buffer stdcall, str:dword, flags:dword
mov ebx, [str]
mov eax, [ebx+STREAM.format]
test eax, PCM_OUT
jnz .fail
cmp ax, PCM_ALL
je .fail
mov [ebx+STREAM.flags], SND_PLAY
cmp [eng_state], SND_PLAY
je .done
stdcall dev_play, [hSound]
mov [eng_state], SND_PLAY
.done:
test [flags], PLAY_SYNC
jz @F
mov edx, [str]
.wait:
mov eax, [edx+STREAM.notify_event]
mov ebx, [edx+STREAM.notify_id]
call WaitEvent ;eax ebx
mov edx, [str]
cmp [edx+STREAM.flags], SND_STOP
jne .wait
@@:
xor eax, eax
ret
.fail:
or eax, -1
ret
endp
; for static and ring buffers only
align 4
proc stop_buffer stdcall, str:dword
mov edx, [str]
test [edx+STREAM.format], PCM_STATIC+PCM_RING
jz .fail
mov [edx+STREAM.flags], SND_STOP
; stdcall [ServiceHandler], [hSound], dword DEV_STOP, 0
mov eax, [edx+STREAM.notify_event]
mov ebx, [edx+STREAM.notify_id]
call ClearEvent ;eax ebx
xor eax, eax
ret
.fail:
or eax, -1
ret
endp
; param
; eax= mix_list
align 4
do_mix_list:
xor edx, edx
mov esi, str.fd-FD_OFFSET
mov ebx, [esi+STREAM.str_fd]
@@:
cmp ebx, esi
je .done
cmp [ebx+STREAM.magic], 'WAVE'
jne .next
cmp [ebx+STREAM.size], STREAM_SIZE
jne .next
cmp [ebx+STREAM.flags], SND_PLAY;
jne .next
mov ecx, [ebx+STREAM.out_count]
test ecx, ecx
jnz .l1
test [ebx+STREAM.format], PCM_RING
jnz .next
mov [ebx+STREAM.flags], SND_STOP
jmp .next
.l1:
cmp ecx, 512
jae .add_buff
mov edi, [ebx+STREAM.out_rp]
add edi, ecx
sub ecx, 512
neg ecx
push eax
xor eax, eax
cld
rep stosb
pop eax
mov [ebx+STREAM.out_count], 512
.add_buff:
mov ecx, [ebx+STREAM.out_rp]
mov [eax],ecx
if USE_SSE2_MIXER
mov edi, dword [ebx+STREAM.l_amp_f]
mov [eax+4], edi
mov edi, dword [ebx+STREAM.r_amp_f]
mov [eax+8], edi
else
mov edi, dword [ebx+STREAM.l_amp]
mov [eax+4], edi
end if
add [ebx+STREAM.out_rp], 512
sub [ebx+STREAM.out_count], 512
add eax, 12
inc edx
.next:
mov ebx, [ebx+STREAM.str_fd]
jmp @B
.done:
mov eax, edx
ret
align 4
prepare_playlist:
xor edx, edx
mov [play_count], edx
mov esi, str.fd-FD_OFFSET
mov edi, [esi+STREAM.str_fd]
@@:
cmp edi, esi
je .done
cmp [edi+STREAM.magic], 'WAVE'
jne .next
cmp [edi+STREAM.size], STREAM_SIZE
jne .next
cmp [edi+STREAM.flags], SND_PLAY;
jne .next
mov [play_list+edx], edi
inc [play_count]
add edx, 4
.next:
mov edi, [edi+STREAM.str_fd]
jmp @B
.done:
ret
align 4
proc set_handler stdcall, hsrv:dword, handler_proc:dword
locals
handler dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
val dd ?
endl
mov eax, [hsrv]
lea ecx, [handler_proc]
xor ebx, ebx
mov [handler], eax
mov [io_code], DEV_CALLBACK
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], 0
lea eax, [handler]
stdcall ServiceHandler, eax
ret
endp
align 4
proc dev_play stdcall, hsrv:dword
locals
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
val dd ?
endl
mov eax, [hsrv]
xor ebx, ebx
mov [handle], eax
mov [io_code], DEV_PLAY
mov [input], ebx
mov [inp_size], ebx
mov [output], ebx
mov [out_size], ebx
lea eax, [handle]
stdcall ServiceHandler, eax
ret
endp
if 0
align 4
dword2str:
mov esi, hex_buff
mov ecx, -8
@@:
rol eax, 4
mov ebx, eax
and ebx, 0x0F
mov bl, [ebx+hexletters]
mov [8+esi+ecx], bl
inc ecx
jnz @B
ret
hexletters db '0123456789ABCDEF'
hex_buff db 8 dup(0),13,10,0
end if
include 'mixer.asm'
include 'mix_mmx.inc'
include 'mix_sse2.inc'
;if USE_SSE
; include 'mix_sse.inc'
;end if
align 16
resampler_params:
;r_size r_dt resampler_func
dd 0,0,0 ; 0 PCM_ALL
dd 16384, 0, copy_stream ; 1 PCM_2_16_48
dd 8192, 0, m16_stereo ; 2 PCM_1_16_48
dd 16384, 30109, resample_2 ; 3 PCM_2_16_44
dd 8192, 30109, resample_1 ; 4 PCM_1_16_44
dd 16384, 21846, resample_2 ; 5 PCM_2_16_32
dd 8192, 21846, resample_1 ; 6 PCM_1_16_32
dd 16384, 16384, resample_2 ; 7 PCM_2_16_24
dd 8192, 16384, resample_1 ; 8 PCM_1_16_24
dd 8192, 15052, resample_2 ; 9 PCM_2_16_22
dd 4096, 15052, resample_1 ;10 PCM_1_16_22
dd 8192, 10923, resample_2 ;11 PCM_2_16_16
dd 4096, 10923, resample_1 ;12 PCM_1_16_16
dd 8192, 8192, resample_2 ;13 PCM_2_16_12
dd 4096, 8192, resample_1 ;14 PCM_1_16_12
dd 4096, 7527, resample_2 ;15 PCM_2_16_11
dd 2048, 7527, resample_1 ;16 PCM_1_16_11
dd 4096, 5462, resample_2 ;17 PCM_2_16_8
dd 2048, 5462, resample_1 ;18 PCM_1_16_8
dd 16384, 0, s8_stereo ;19 PCM_2_8_48
dd 8192, 0, m8_stereo ;20 PCM_1_8_48
dd 8192, 30109, resample_28 ;21 PCM_2_8_44
dd 4096, 30109, resample_18 ;22 PCM_1_8_44
dd 8192, 21846, resample_28 ;23 PCM_2_8_32
dd 4096, 21846, resample_18 ;24 PCM_1_8_32
dd 8192, 16384, resample_28 ;25 PCM_2_8_24
dd 4096, 16384, resample_18 ;26 PCM_1_8_24
dd 4096, 15052, resample_28 ;27 PCM_2_8_22
dd 2048, 15052, resample_18 ;28 PCM_1_8_22
dd 4096, 10923, resample_28 ;29 PCM_2_8_16
dd 2048, 10923, resample_18 ;30 PCM_1_8_16
dd 4096, 8192, resample_28 ;31 PCM_2_8_12
dd 2048, 8192, resample_18 ;32 PCM_1_8_12
dd 2048, 7527, resample_28 ;33 PCM_2_8_11
dd 1024, 7527, resample_18 ;34 PCM_1_8_11
dd 2048, 5462, resample_28 ;35 PCM_2_8_8
dd 1024, 5462, resample_18 ;36 PCM_1_8_8
m7 dw 0x8000,0x8000,0x8000,0x8000
mm80 dq 0x8080808080808080
mm_mask dq 0xFF00FF00FF00FF00
vol_max dd 0x00000000,0x00000000
vol_min dd 0x0000D8F0,0x0000D8F0
pan_max dd 0x00002710,0x00002710
;stream_map dd 0xFFFF ; 16
version dd (5 shl 16) or SOUND_VERSION
szInfinity db 'INFINITY',0
szSound db 'SOUND',0
if DEBUG
msgFail db 'Sound service not loaded',13,10,0
msgPlay db 'Play buffer',13,10,0
msgStop db 'Stop',13,10,0
msgUser db 'User callback',13,10,0
msgMem db 'Not enough memory',13,10,0
msgDestroy db 'Destroy sound buffer', 13,10,0
msgWaveout db 'Play waveout', 13,10,0
msgSetVolume db 'Set volume',13,10,0
end if
section '.data' data readable writable align 16
play_list rd 16
mix_input rd 16
play_count rd 1
hSound rd 1
eng_state rd 1
mix_buff rd 1
mix_buff_map rd 1
str.fd rd 1
str.bk rd 1
mix_2_core rd 1
mix_3_core rd 1
mix_4_core rd 1
| devlato/kolibrios-llvm | kernel/tags/kolibri0.7.7.0/drivers/infinity.asm | Assembly | mit | 30,462 |
;; @file
; This is the assembly code for transferring to control to OS S3 waking vector
; for IA32 platform
;
; Copyright (c) 2013-2015 Intel Corporation.
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
.586P
.model flat,C
.code
;-----------------------------------------
;VOID
;AsmTransferControl (
; IN UINT32 S3WakingVector,
; IN UINT32 AcpiLowMemoryBase
; );
;-----------------------------------------
AsmTransferControl PROC
; S3WakingVector :DWORD
; AcpiLowMemoryBase :DWORD
push ebp
mov ebp, esp
lea eax, @F
push 28h ; CS
push eax
mov ecx, [ebp + 8]
shrd ebx, ecx, 20
and ecx, 0fh
mov bx, cx
mov @jmp_addr, ebx
retf
@@:
DB 0b8h, 30h, 0 ; mov ax, 30h as selector
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov eax, cr0 ; Get control register 0
DB 66h
DB 83h, 0e0h, 0feh ; and eax, 0fffffffeh ; Clear PE bit (bit #0)
DB 0fh, 22h, 0c0h ; mov cr0, eax ; Activate real mode
DB 0eah ; jmp far @jmp_addr
@jmp_addr DD ?
AsmTransferControl ENDP
END
| google/google-ctf | third_party/edk2/QuarkPlatformPkg/Acpi/Dxe/BootScriptExecutorDxe/IA32/S3Asm.asm | Assembly | apache-2.0 | 1,647 |
@********************************************************************
@* *
@* THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
@* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
@* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
@* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
@* *
@* THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2010 *
@* by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
@* *
@********************************************************************
@ Original implementation:
@ Copyright (C) 2009 Robin Watts for Pinknoise Productions Ltd
@ last mod: $Id: armfrag.s 17874 2011-02-24 14:49:11Z tterribe $
@********************************************************************
.text; .p2align 2
.include "armopts-gnu.S"
@ Vanilla ARM v4 versions
.global oc_frag_copy_list_arm
.global oc_frag_recon_intra_arm
.global oc_frag_recon_inter_arm
.global oc_frag_recon_inter2_arm
.type oc_frag_copy_list_arm, %function; oc_frag_copy_list_arm: @ PROC
@ r0 = _dst_frame
@ r1 = _src_frame
@ r2 = _ystride
@ r3 = _fragis
@ <> = _nfragis
@ <> = _frag_buf_offs
LDR r12,[r13] @ r12 = _nfragis
STMFD r13!,{r4-r6,r11,r14}
SUBS r12, r12, #1
LDR r4,[r3],#4 @ r4 = _fragis[fragii]
LDRGE r14,[r13,#4*6] @ r14 = _frag_buf_offs
BLT ofcl_arm_end
SUB r2, r2, #4
ofcl_arm_lp:
LDR r11,[r14,r4,LSL #2] @ r11 = _frag_buf_offs[_fragis[fragii]]
SUBS r12, r12, #1
@ Stall (on XScale)
ADD r4, r1, r11 @ r4 = _src_frame+frag_buf_off
LDR r6, [r4], #4
ADD r11,r0, r11 @ r11 = _dst_frame+frag_buf_off
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4], r2
STR r6, [r11],#4
LDR r6, [r4], #4
STR r5, [r11],r2
LDR r5, [r4]
LDRGE r4,[r3],#4 @ r4 = _fragis[fragii]
STR r6, [r11],#4
STR r5, [r11]
BGE ofcl_arm_lp
ofcl_arm_end:
LDMFD r13!,{r4-r6,r11,PC}
oc_frag_recon_intra_arm:
@ r0 = unsigned char *_dst
@ r1 = int _ystride
@ r2 = const ogg_int16_t _residue[64]
STMFD r13!,{r4,r5,r14}
MOV r14,#8
MOV r5, #255
SUB r1, r1, #7
ofrintra_lp_arm:
LDRSH r3, [r2], #2
LDRSH r4, [r2], #2
LDRSH r12,[r2], #2
ADDS r3, r3, #128
CMPGT r5, r3
EORLT r3, r5, r3, ASR #32
STRB r3, [r0], #1
ADDS r4, r4, #128
CMPGT r5, r4
EORLT r4, r5, r4, ASR #32
LDRSH r3, [r2], #2
STRB r4, [r0], #1
ADDS r12,r12,#128
CMPGT r5, r12
EORLT r12,r5, r12,ASR #32
LDRSH r4, [r2], #2
STRB r12,[r0], #1
ADDS r3, r3, #128
CMPGT r5, r3
EORLT r3, r5, r3, ASR #32
LDRSH r12,[r2], #2
STRB r3, [r0], #1
ADDS r4, r4, #128
CMPGT r5, r4
EORLT r4, r5, r4, ASR #32
LDRSH r3, [r2], #2
STRB r4, [r0], #1
ADDS r12,r12,#128
CMPGT r5, r12
EORLT r12,r5, r12,ASR #32
LDRSH r4, [r2], #2
STRB r12,[r0], #1
ADDS r3, r3, #128
CMPGT r5, r3
EORLT r3, r5, r3, ASR #32
STRB r3, [r0], #1
ADDS r4, r4, #128
CMPGT r5, r4
EORLT r4, r5, r4, ASR #32
STRB r4, [r0], r1
SUBS r14,r14,#1
BGT ofrintra_lp_arm
LDMFD r13!,{r4,r5,PC}
.size oc_frag_copy_list_arm, .-oc_frag_copy_list_arm @ ENDP
.type oc_frag_recon_inter_arm, %function; oc_frag_recon_inter_arm: @ PROC
@ r0 = unsigned char *dst
@ r1 = const unsigned char *src
@ r2 = int ystride
@ r3 = const ogg_int16_t residue[64]
STMFD r13!,{r5,r9-r11,r14}
MOV r9, #8
MOV r5, #255
SUB r2, r2, #7
ofrinter_lp_arm:
LDRSH r12,[r3], #2
LDRB r14,[r1], #1
LDRSH r11,[r3], #2
LDRB r10,[r1], #1
ADDS r12,r12,r14
CMPGT r5, r12
EORLT r12,r5, r12,ASR #32
STRB r12,[r0], #1
ADDS r11,r11,r10
CMPGT r5, r11
LDRSH r12,[r3], #2
LDRB r14,[r1], #1
EORLT r11,r5, r11,ASR #32
STRB r11,[r0], #1
ADDS r12,r12,r14
CMPGT r5, r12
LDRSH r11,[r3], #2
LDRB r10,[r1], #1
EORLT r12,r5, r12,ASR #32
STRB r12,[r0], #1
ADDS r11,r11,r10
CMPGT r5, r11
LDRSH r12,[r3], #2
LDRB r14,[r1], #1
EORLT r11,r5, r11,ASR #32
STRB r11,[r0], #1
ADDS r12,r12,r14
CMPGT r5, r12
LDRSH r11,[r3], #2
LDRB r10,[r1], #1
EORLT r12,r5, r12,ASR #32
STRB r12,[r0], #1
ADDS r11,r11,r10
CMPGT r5, r11
LDRSH r12,[r3], #2
LDRB r14,[r1], #1
EORLT r11,r5, r11,ASR #32
STRB r11,[r0], #1
ADDS r12,r12,r14
CMPGT r5, r12
LDRSH r11,[r3], #2
LDRB r10,[r1], r2
EORLT r12,r5, r12,ASR #32
STRB r12,[r0], #1
ADDS r11,r11,r10
CMPGT r5, r11
EORLT r11,r5, r11,ASR #32
STRB r11,[r0], r2
SUBS r9, r9, #1
BGT ofrinter_lp_arm
LDMFD r13!,{r5,r9-r11,PC}
.size oc_frag_recon_inter_arm, .-oc_frag_recon_inter_arm @ ENDP
.type oc_frag_recon_inter2_arm, %function; oc_frag_recon_inter2_arm: @ PROC
@ r0 = unsigned char *dst
@ r1 = const unsigned char *src1
@ r2 = const unsigned char *src2
@ r3 = int ystride
LDR r12,[r13]
@ r12= const ogg_int16_t residue[64]
STMFD r13!,{r4-r8,r14}
MOV r14,#8
MOV r8, #255
SUB r3, r3, #7
ofrinter2_lp_arm:
LDRB r5, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
LDRB r7, [r1], #1
ADD r5, r5, r6
ADDS r5, r4, r5, LSR #1
CMPGT r8, r5
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r5, r8, r5, ASR #32
STRB r5, [r0], #1
ADD r7, r7, r6
ADDS r7, r4, r7, LSR #1
CMPGT r8, r7
LDRB r5, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r7, r8, r7, ASR #32
STRB r7, [r0], #1
ADD r5, r5, r6
ADDS r5, r4, r5, LSR #1
CMPGT r8, r5
LDRB r7, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r5, r8, r5, ASR #32
STRB r5, [r0], #1
ADD r7, r7, r6
ADDS r7, r4, r7, LSR #1
CMPGT r8, r7
LDRB r5, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r7, r8, r7, ASR #32
STRB r7, [r0], #1
ADD r5, r5, r6
ADDS r5, r4, r5, LSR #1
CMPGT r8, r5
LDRB r7, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r5, r8, r5, ASR #32
STRB r5, [r0], #1
ADD r7, r7, r6
ADDS r7, r4, r7, LSR #1
CMPGT r8, r7
LDRB r5, [r1], #1
LDRB r6, [r2], #1
LDRSH r4, [r12],#2
EORLT r7, r8, r7, ASR #32
STRB r7, [r0], #1
ADD r5, r5, r6
ADDS r5, r4, r5, LSR #1
CMPGT r8, r5
LDRB r7, [r1], r3
LDRB r6, [r2], r3
LDRSH r4, [r12],#2
EORLT r5, r8, r5, ASR #32
STRB r5, [r0], #1
ADD r7, r7, r6
ADDS r7, r4, r7, LSR #1
CMPGT r8, r7
EORLT r7, r8, r7, ASR #32
STRB r7, [r0], r3
SUBS r14,r14,#1
BGT ofrinter2_lp_arm
LDMFD r13!,{r4-r8,PC}
.size oc_frag_recon_inter2_arm, .-oc_frag_recon_inter2_arm @ ENDP
.if OC_ARM_ASM_EDSP
.global oc_frag_copy_list_edsp
.type oc_frag_copy_list_edsp, %function; oc_frag_copy_list_edsp: @ PROC
@ r0 = _dst_frame
@ r1 = _src_frame
@ r2 = _ystride
@ r3 = _fragis
@ <> = _nfragis
@ <> = _frag_buf_offs
LDR r12,[r13] @ r12 = _nfragis
STMFD r13!,{r4-r11,r14}
SUBS r12, r12, #1
LDRGE r5, [r3],#4 @ r5 = _fragis[fragii]
LDRGE r14,[r13,#4*10] @ r14 = _frag_buf_offs
BLT ofcl_edsp_end
ofcl_edsp_lp:
MOV r4, r1
LDR r5, [r14,r5, LSL #2] @ r5 = _frag_buf_offs[_fragis[fragii]]
SUBS r12, r12, #1
@ Stall (on XScale)
LDRD r6, [r4, r5]! @ r4 = _src_frame+frag_buf_off
LDRD r8, [r4, r2]!
@ Stall
STRD r6, [r5, r0]! @ r5 = _dst_frame+frag_buf_off
STRD r8, [r5, r2]!
@ Stall
LDRD r6, [r4, r2]! @ On Xscale at least, doing 3 consecutive
LDRD r8, [r4, r2]! @ loads causes a stall, but thats no worse
LDRD r10,[r4, r2]! @ than us only doing 2, and having to do
@ another pair of LDRD/STRD later on.
@ Stall
STRD r6, [r5, r2]!
STRD r8, [r5, r2]!
STRD r10,[r5, r2]!
LDRD r6, [r4, r2]!
LDRD r8, [r4, r2]!
LDRD r10,[r4, r2]!
STRD r6, [r5, r2]!
STRD r8, [r5, r2]!
STRD r10,[r5, r2]!
LDRGE r5, [r3],#4 @ r5 = _fragis[fragii]
BGE ofcl_edsp_lp
ofcl_edsp_end:
LDMFD r13!,{r4-r11,PC}
.size oc_frag_copy_list_edsp, .-oc_frag_copy_list_edsp @ ENDP
.endif
.if OC_ARM_ASM_MEDIA
.global oc_frag_recon_intra_v6
.global oc_frag_recon_inter_v6
.global oc_frag_recon_inter2_v6
.type oc_frag_recon_intra_v6, %function; oc_frag_recon_intra_v6: @ PROC
@ r0 = unsigned char *_dst
@ r1 = int _ystride
@ r2 = const ogg_int16_t _residue[64]
STMFD r13!,{r4-r6,r14}
MOV r14,#8
MOV r12,r2
LDR r6, =0x00800080
ofrintra_v6_lp:
LDRD r2, [r12],#8 @ r2 = 11110000 r3 = 33332222
LDRD r4, [r12],#8 @ r4 = 55554444 r5 = 77776666
SUBS r14,r14,#1
QADD16 r2, r2, r6
QADD16 r3, r3, r6
QADD16 r4, r4, r6
QADD16 r5, r5, r6
USAT16 r2, #8, r2 @ r2 = __11__00
USAT16 r3, #8, r3 @ r3 = __33__22
USAT16 r4, #8, r4 @ r4 = __55__44
USAT16 r5, #8, r5 @ r5 = __77__66
ORR r2, r2, r2, LSR #8 @ r2 = __111100
ORR r3, r3, r3, LSR #8 @ r3 = __333322
ORR r4, r4, r4, LSR #8 @ r4 = __555544
ORR r5, r5, r5, LSR #8 @ r5 = __777766
PKHBT r2, r2, r3, LSL #16 @ r2 = 33221100
PKHBT r3, r4, r5, LSL #16 @ r3 = 77665544
STRD r2, [r0], r1
BGT ofrintra_v6_lp
LDMFD r13!,{r4-r6,PC}
.size oc_frag_recon_intra_v6, .-oc_frag_recon_intra_v6 @ ENDP
.type oc_frag_recon_inter_v6, %function; oc_frag_recon_inter_v6: @ PROC
@ r0 = unsigned char *_dst
@ r1 = const unsigned char *_src
@ r2 = int _ystride
@ r3 = const ogg_int16_t _residue[64]
STMFD r13!,{r4-r7,r14}
MOV r14,#8
ofrinter_v6_lp:
LDRD r6, [r3], #8 @ r6 = 11110000 r7 = 33332222
SUBS r14,r14,#1
.if OC_ARM_CAN_UNALIGN_LDRD
LDRD r4, [r1], r2 @ Unaligned ; r4 = 33221100 r5 = 77665544
.else
LDR r5, [r1, #4]
LDR r4, [r1], r2
.endif
PKHBT r12,r6, r7, LSL #16 @ r12= 22220000
PKHTB r7, r7, r6, ASR #16 @ r7 = 33331111
UXTB16 r6,r4 @ r6 = __22__00
UXTB16 r4,r4, ROR #8 @ r4 = __33__11
QADD16 r12,r12,r6 @ r12= xx22xx00
QADD16 r4, r7, r4 @ r4 = xx33xx11
LDRD r6, [r3], #8 @ r6 = 55554444 r7 = 77776666
USAT16 r4, #8, r4 @ r4 = __33__11
USAT16 r12,#8,r12 @ r12= __22__00
ORR r4, r12,r4, LSL #8 @ r4 = 33221100
PKHBT r12,r6, r7, LSL #16 @ r12= 66664444
PKHTB r7, r7, r6, ASR #16 @ r7 = 77775555
UXTB16 r6,r5 @ r6 = __66__44
UXTB16 r5,r5, ROR #8 @ r5 = __77__55
QADD16 r12,r12,r6 @ r12= xx66xx44
QADD16 r5, r7, r5 @ r5 = xx77xx55
USAT16 r12,#8, r12 @ r12= __66__44
USAT16 r5, #8, r5 @ r4 = __77__55
ORR r5, r12,r5, LSL #8 @ r5 = 33221100
STRD r4, [r0], r2
BGT ofrinter_v6_lp
LDMFD r13!,{r4-r7,PC}
.size oc_frag_recon_inter_v6, .-oc_frag_recon_inter_v6 @ ENDP
.type oc_frag_recon_inter2_v6, %function; oc_frag_recon_inter2_v6: @ PROC
@ r0 = unsigned char *_dst
@ r1 = const unsigned char *_src1
@ r2 = const unsigned char *_src2
@ r3 = int _ystride
LDR r12,[r13]
@ r12= const ogg_int16_t _residue[64]
STMFD r13!,{r4-r9,r14}
MOV r14,#8
ofrinter2_v6_lp:
LDRD r6, [r12,#8] @ r6 = 55554444 r7 = 77776666
SUBS r14,r14,#1
LDR r4, [r1, #4] @ Unaligned ; r4 = src1[1] = 77665544
LDR r5, [r2, #4] @ Unaligned ; r5 = src2[1] = 77665544
PKHBT r8, r6, r7, LSL #16 @ r8 = 66664444
PKHTB r9, r7, r6, ASR #16 @ r9 = 77775555
UHADD8 r4, r4, r5 @ r4 = (src1[7,6,5,4] + src2[7,6,5,4])>>1
UXTB16 r5, r4 @ r5 = __66__44
UXTB16 r4, r4, ROR #8 @ r4 = __77__55
QADD16 r8, r8, r5 @ r8 = xx66xx44
QADD16 r9, r9, r4 @ r9 = xx77xx55
LDRD r6,[r12],#16 @ r6 = 33332222 r7 = 11110000
USAT16 r8, #8, r8 @ r8 = __66__44
LDR r4, [r1], r3 @ Unaligned ; r4 = src1[0] = 33221100
USAT16 r9, #8, r9 @ r9 = __77__55
LDR r5, [r2], r3 @ Unaligned ; r5 = src2[0] = 33221100
ORR r9, r8, r9, LSL #8 @ r9 = 77665544
PKHBT r8, r6, r7, LSL #16 @ r8 = 22220000
UHADD8 r4, r4, r5 @ r4 = (src1[3,2,1,0] + src2[3,2,1,0])>>1
PKHTB r7, r7, r6, ASR #16 @ r7 = 33331111
UXTB16 r5, r4 @ r5 = __22__00
UXTB16 r4, r4, ROR #8 @ r4 = __33__11
QADD16 r8, r8, r5 @ r8 = xx22xx00
QADD16 r7, r7, r4 @ r7 = xx33xx11
USAT16 r8, #8, r8 @ r8 = __22__00
USAT16 r7, #8, r7 @ r7 = __33__11
ORR r8, r8, r7, LSL #8 @ r8 = 33221100
STRD r8, [r0], r3
BGT ofrinter2_v6_lp
LDMFD r13!,{r4-r9,PC}
.size oc_frag_recon_inter2_v6, .-oc_frag_recon_inter2_v6 @ ENDP
.endif
.if OC_ARM_ASM_NEON
.global oc_frag_copy_list_neon
.global oc_frag_recon_intra_neon
.global oc_frag_recon_inter_neon
.global oc_frag_recon_inter2_neon
.type oc_frag_copy_list_neon, %function; oc_frag_copy_list_neon: @ PROC
@ r0 = _dst_frame
@ r1 = _src_frame
@ r2 = _ystride
@ r3 = _fragis
@ <> = _nfragis
@ <> = _frag_buf_offs
LDR r12,[r13] @ r12 = _nfragis
STMFD r13!,{r4-r7,r14}
CMP r12, #1
LDRGE r6, [r3] @ r6 = _fragis[fragii]
LDRGE r14,[r13,#4*6] @ r14 = _frag_buf_offs
BLT ofcl_neon_end
@ Stall (2 on Xscale)
LDR r6, [r14,r6, LSL #2] @ r6 = _frag_buf_offs[_fragis[fragii]]
@ Stall (on XScale)
MOV r7, r6 @ Guarantee PLD points somewhere valid.
ofcl_neon_lp:
ADD r4, r1, r6
VLD1.64 {D0}, [r4,:64], r2
ADD r5, r0, r6
VLD1.64 {D1}, [r4,:64], r2
SUBS r12, r12, #1
VLD1.64 {D2}, [r4,:64], r2
LDRGT r6, [r3,#4]! @ r6 = _fragis[fragii]
VLD1.64 {D3}, [r4,:64], r2
LDRGT r6, [r14,r6, LSL #2] @ r6 = _frag_buf_offs[_fragis[fragii]]
VLD1.64 {D4}, [r4,:64], r2
ADDGT r7, r1, r6
VLD1.64 {D5}, [r4,:64], r2
PLD [r7]
VLD1.64 {D6}, [r4,:64], r2
PLD [r7, r2]
VLD1.64 {D7}, [r4,:64]
PLD [r7, r2, LSL #1]
VST1.64 {D0}, [r5,:64], r2
ADDGT r7, r7, r2, LSL #2
VST1.64 {D1}, [r5,:64], r2
PLD [r7, -r2]
VST1.64 {D2}, [r5,:64], r2
PLD [r7]
VST1.64 {D3}, [r5,:64], r2
PLD [r7, r2]
VST1.64 {D4}, [r5,:64], r2
PLD [r7, r2, LSL #1]
VST1.64 {D5}, [r5,:64], r2
ADDGT r7, r7, r2, LSL #2
VST1.64 {D6}, [r5,:64], r2
PLD [r7, -r2]
VST1.64 {D7}, [r5,:64]
BGT ofcl_neon_lp
ofcl_neon_end:
LDMFD r13!,{r4-r7,PC}
.size oc_frag_copy_list_neon, .-oc_frag_copy_list_neon @ ENDP
.type oc_frag_recon_intra_neon, %function; oc_frag_recon_intra_neon: @ PROC
@ r0 = unsigned char *_dst
@ r1 = int _ystride
@ r2 = const ogg_int16_t _residue[64]
VMOV.I16 Q0, #128
VLDMIA r2, {D16-D31} @ D16= 3333222211110000 etc ; 9(8) cycles
VQADD.S16 Q8, Q8, Q0
VQADD.S16 Q9, Q9, Q0
VQADD.S16 Q10,Q10,Q0
VQADD.S16 Q11,Q11,Q0
VQADD.S16 Q12,Q12,Q0
VQADD.S16 Q13,Q13,Q0
VQADD.S16 Q14,Q14,Q0
VQADD.S16 Q15,Q15,Q0
VQMOVUN.S16 D16,Q8 @ D16= 7766554433221100 ; 1 cycle
VQMOVUN.S16 D17,Q9 @ D17= FFEEDDCCBBAA9988 ; 1 cycle
VQMOVUN.S16 D18,Q10 @ D18= NNMMLLKKJJIIHHGG ; 1 cycle
VST1.64 {D16},[r0,:64], r1
VQMOVUN.S16 D19,Q11 @ D19= VVUUTTSSRRQQPPOO ; 1 cycle
VST1.64 {D17},[r0,:64], r1
VQMOVUN.S16 D20,Q12 @ D20= ddccbbaaZZYYXXWW ; 1 cycle
VST1.64 {D18},[r0,:64], r1
VQMOVUN.S16 D21,Q13 @ D21= llkkjjiihhggffee ; 1 cycle
VST1.64 {D19},[r0,:64], r1
VQMOVUN.S16 D22,Q14 @ D22= ttssrrqqppoonnmm ; 1 cycle
VST1.64 {D20},[r0,:64], r1
VQMOVUN.S16 D23,Q15 @ D23= !!,:@zzyyxxwwvvuu ; 1 cycle
VST1.64 {D21},[r0,:64], r1
VST1.64 {D22},[r0,:64], r1
VST1.64 {D23},[r0,:64], r1
MOV PC,R14
.size oc_frag_recon_intra_neon, .-oc_frag_recon_intra_neon @ ENDP
.type oc_frag_recon_inter_neon, %function; oc_frag_recon_inter_neon: @ PROC
@ r0 = unsigned char *_dst
@ r1 = const unsigned char *_src
@ r2 = int _ystride
@ r3 = const ogg_int16_t _residue[64]
VLDMIA r3, {D16-D31} @ D16= 3333222211110000 etc ; 9(8) cycles
VLD1.64 {D0}, [r1], r2
VLD1.64 {D2}, [r1], r2
VMOVL.U8 Q0, D0 @ Q0 = __77__66__55__44__33__22__11__00
VLD1.64 {D4}, [r1], r2
VMOVL.U8 Q1, D2 @ etc
VLD1.64 {D6}, [r1], r2
VMOVL.U8 Q2, D4
VMOVL.U8 Q3, D6
VQADD.S16 Q8, Q8, Q0
VLD1.64 {D0}, [r1], r2
VQADD.S16 Q9, Q9, Q1
VLD1.64 {D2}, [r1], r2
VQADD.S16 Q10,Q10,Q2
VLD1.64 {D4}, [r1], r2
VQADD.S16 Q11,Q11,Q3
VLD1.64 {D6}, [r1], r2
VMOVL.U8 Q0, D0
VMOVL.U8 Q1, D2
VMOVL.U8 Q2, D4
VMOVL.U8 Q3, D6
VQADD.S16 Q12,Q12,Q0
VQADD.S16 Q13,Q13,Q1
VQADD.S16 Q14,Q14,Q2
VQADD.S16 Q15,Q15,Q3
VQMOVUN.S16 D16,Q8
VQMOVUN.S16 D17,Q9
VQMOVUN.S16 D18,Q10
VST1.64 {D16},[r0,:64], r2
VQMOVUN.S16 D19,Q11
VST1.64 {D17},[r0,:64], r2
VQMOVUN.S16 D20,Q12
VST1.64 {D18},[r0,:64], r2
VQMOVUN.S16 D21,Q13
VST1.64 {D19},[r0,:64], r2
VQMOVUN.S16 D22,Q14
VST1.64 {D20},[r0,:64], r2
VQMOVUN.S16 D23,Q15
VST1.64 {D21},[r0,:64], r2
VST1.64 {D22},[r0,:64], r2
VST1.64 {D23},[r0,:64], r2
MOV PC,R14
.size oc_frag_recon_inter_neon, .-oc_frag_recon_inter_neon @ ENDP
.type oc_frag_recon_inter2_neon, %function; oc_frag_recon_inter2_neon: @ PROC
@ r0 = unsigned char *_dst
@ r1 = const unsigned char *_src1
@ r2 = const unsigned char *_src2
@ r3 = int _ystride
LDR r12,[r13]
@ r12= const ogg_int16_t _residue[64]
VLDMIA r12,{D16-D31}
VLD1.64 {D0}, [r1], r3
VLD1.64 {D4}, [r2], r3
VLD1.64 {D1}, [r1], r3
VLD1.64 {D5}, [r2], r3
VHADD.U8 Q2, Q0, Q2 @ Q2 = FFEEDDCCBBAA99887766554433221100
VLD1.64 {D2}, [r1], r3
VLD1.64 {D6}, [r2], r3
VMOVL.U8 Q0, D4 @ Q0 = __77__66__55__44__33__22__11__00
VLD1.64 {D3}, [r1], r3
VMOVL.U8 Q2, D5 @ etc
VLD1.64 {D7}, [r2], r3
VHADD.U8 Q3, Q1, Q3
VQADD.S16 Q8, Q8, Q0
VQADD.S16 Q9, Q9, Q2
VLD1.64 {D0}, [r1], r3
VMOVL.U8 Q1, D6
VLD1.64 {D4}, [r2], r3
VMOVL.U8 Q3, D7
VLD1.64 {D1}, [r1], r3
VQADD.S16 Q10,Q10,Q1
VLD1.64 {D5}, [r2], r3
VQADD.S16 Q11,Q11,Q3
VLD1.64 {D2}, [r1], r3
VHADD.U8 Q2, Q0, Q2
VLD1.64 {D6}, [r2], r3
VLD1.64 {D3}, [r1], r3
VMOVL.U8 Q0, D4
VLD1.64 {D7}, [r2], r3
VMOVL.U8 Q2, D5
VHADD.U8 Q3, Q1, Q3
VQADD.S16 Q12,Q12,Q0
VQADD.S16 Q13,Q13,Q2
VMOVL.U8 Q1, D6
VMOVL.U8 Q3, D7
VQADD.S16 Q14,Q14,Q1
VQADD.S16 Q15,Q15,Q3
VQMOVUN.S16 D16,Q8
VQMOVUN.S16 D17,Q9
VQMOVUN.S16 D18,Q10
VST1.64 {D16},[r0,:64], r3
VQMOVUN.S16 D19,Q11
VST1.64 {D17},[r0,:64], r3
VQMOVUN.S16 D20,Q12
VST1.64 {D18},[r0,:64], r3
VQMOVUN.S16 D21,Q13
VST1.64 {D19},[r0,:64], r3
VQMOVUN.S16 D22,Q14
VST1.64 {D20},[r0,:64], r3
VQMOVUN.S16 D23,Q15
VST1.64 {D21},[r0,:64], r3
VST1.64 {D22},[r0,:64], r3
VST1.64 {D23},[r0,:64], r3
MOV PC,R14
.size oc_frag_recon_inter2_neon, .-oc_frag_recon_inter2_neon @ ENDP
.endif
@ END
.section .note.GNU-stack,"",%progbits
| RichardsGameStudio/libtheoraplayer | theora/lib/arm/armfrag.asm | Assembly | bsd-3-clause | 17,944 |
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp9_mb_lpf_horizontal_edge_w_neon|
EXPORT |vp9_mb_lpf_vertical_edge_w_neon|
ARM
AREA ||.text||, CODE, READONLY, ALIGN=2
; void vp9_mb_lpf_horizontal_edge_w_neon(uint8_t *s, int p,
; const uint8_t *blimit,
; const uint8_t *limit,
; const uint8_t *thresh
; int count)
; r0 uint8_t *s,
; r1 int p, /* pitch */
; r2 const uint8_t *blimit,
; r3 const uint8_t *limit,
; sp const uint8_t *thresh,
|vp9_mb_lpf_horizontal_edge_w_neon| PROC
push {r4-r8, lr}
vpush {d8-d15}
ldr r4, [sp, #88] ; load thresh
ldr r12, [sp, #92] ; load count
h_count
vld1.8 {d16[]}, [r2] ; load *blimit
vld1.8 {d17[]}, [r3] ; load *limit
vld1.8 {d18[]}, [r4] ; load *thresh
sub r8, r0, r1, lsl #3 ; move src pointer down by 8 lines
vld1.u8 {d0}, [r8@64], r1 ; p7
vld1.u8 {d1}, [r8@64], r1 ; p6
vld1.u8 {d2}, [r8@64], r1 ; p5
vld1.u8 {d3}, [r8@64], r1 ; p4
vld1.u8 {d4}, [r8@64], r1 ; p3
vld1.u8 {d5}, [r8@64], r1 ; p2
vld1.u8 {d6}, [r8@64], r1 ; p1
vld1.u8 {d7}, [r8@64], r1 ; p0
vld1.u8 {d8}, [r8@64], r1 ; q0
vld1.u8 {d9}, [r8@64], r1 ; q1
vld1.u8 {d10}, [r8@64], r1 ; q2
vld1.u8 {d11}, [r8@64], r1 ; q3
vld1.u8 {d12}, [r8@64], r1 ; q4
vld1.u8 {d13}, [r8@64], r1 ; q5
vld1.u8 {d14}, [r8@64], r1 ; q6
vld1.u8 {d15}, [r8@64], r1 ; q7
bl vp9_wide_mbfilter_neon
tst r7, #1
beq h_mbfilter
; flat && mask were not set for any of the channels. Just store the values
; from filter.
sub r8, r0, r1, lsl #1
vst1.u8 {d25}, [r8@64], r1 ; store op1
vst1.u8 {d24}, [r8@64], r1 ; store op0
vst1.u8 {d23}, [r8@64], r1 ; store oq0
vst1.u8 {d26}, [r8@64], r1 ; store oq1
b h_next
h_mbfilter
tst r7, #2
beq h_wide_mbfilter
; flat2 was not set for any of the channels. Just store the values from
; mbfilter.
sub r8, r0, r1, lsl #1
sub r8, r8, r1
vst1.u8 {d18}, [r8@64], r1 ; store op2
vst1.u8 {d19}, [r8@64], r1 ; store op1
vst1.u8 {d20}, [r8@64], r1 ; store op0
vst1.u8 {d21}, [r8@64], r1 ; store oq0
vst1.u8 {d22}, [r8@64], r1 ; store oq1
vst1.u8 {d23}, [r8@64], r1 ; store oq2
b h_next
h_wide_mbfilter
sub r8, r0, r1, lsl #3
add r8, r8, r1
vst1.u8 {d16}, [r8@64], r1 ; store op6
vst1.u8 {d24}, [r8@64], r1 ; store op5
vst1.u8 {d25}, [r8@64], r1 ; store op4
vst1.u8 {d26}, [r8@64], r1 ; store op3
vst1.u8 {d27}, [r8@64], r1 ; store op2
vst1.u8 {d18}, [r8@64], r1 ; store op1
vst1.u8 {d19}, [r8@64], r1 ; store op0
vst1.u8 {d20}, [r8@64], r1 ; store oq0
vst1.u8 {d21}, [r8@64], r1 ; store oq1
vst1.u8 {d22}, [r8@64], r1 ; store oq2
vst1.u8 {d23}, [r8@64], r1 ; store oq3
vst1.u8 {d1}, [r8@64], r1 ; store oq4
vst1.u8 {d2}, [r8@64], r1 ; store oq5
vst1.u8 {d3}, [r8@64], r1 ; store oq6
h_next
add r0, r0, #8
subs r12, r12, #1
bne h_count
vpop {d8-d15}
pop {r4-r8, pc}
ENDP ; |vp9_mb_lpf_horizontal_edge_w_neon|
; void vp9_mb_lpf_vertical_edge_w_neon(uint8_t *s, int p,
; const uint8_t *blimit,
; const uint8_t *limit,
; const uint8_t *thresh)
; r0 uint8_t *s,
; r1 int p, /* pitch */
; r2 const uint8_t *blimit,
; r3 const uint8_t *limit,
; sp const uint8_t *thresh,
|vp9_mb_lpf_vertical_edge_w_neon| PROC
push {r4-r8, lr}
vpush {d8-d15}
ldr r4, [sp, #88] ; load thresh
vld1.8 {d16[]}, [r2] ; load *blimit
vld1.8 {d17[]}, [r3] ; load *limit
vld1.8 {d18[]}, [r4] ; load *thresh
sub r8, r0, #8
vld1.8 {d0}, [r8@64], r1
vld1.8 {d8}, [r0@64], r1
vld1.8 {d1}, [r8@64], r1
vld1.8 {d9}, [r0@64], r1
vld1.8 {d2}, [r8@64], r1
vld1.8 {d10}, [r0@64], r1
vld1.8 {d3}, [r8@64], r1
vld1.8 {d11}, [r0@64], r1
vld1.8 {d4}, [r8@64], r1
vld1.8 {d12}, [r0@64], r1
vld1.8 {d5}, [r8@64], r1
vld1.8 {d13}, [r0@64], r1
vld1.8 {d6}, [r8@64], r1
vld1.8 {d14}, [r0@64], r1
vld1.8 {d7}, [r8@64], r1
vld1.8 {d15}, [r0@64], r1
sub r0, r0, r1, lsl #3
vtrn.32 q0, q2
vtrn.32 q1, q3
vtrn.32 q4, q6
vtrn.32 q5, q7
vtrn.16 q0, q1
vtrn.16 q2, q3
vtrn.16 q4, q5
vtrn.16 q6, q7
vtrn.8 d0, d1
vtrn.8 d2, d3
vtrn.8 d4, d5
vtrn.8 d6, d7
vtrn.8 d8, d9
vtrn.8 d10, d11
vtrn.8 d12, d13
vtrn.8 d14, d15
bl vp9_wide_mbfilter_neon
tst r7, #1
beq v_mbfilter
; flat && mask were not set for any of the channels. Just store the values
; from filter.
sub r8, r0, #2
vswp d23, d25
vst4.8 {d23[0], d24[0], d25[0], d26[0]}, [r8], r1
vst4.8 {d23[1], d24[1], d25[1], d26[1]}, [r8], r1
vst4.8 {d23[2], d24[2], d25[2], d26[2]}, [r8], r1
vst4.8 {d23[3], d24[3], d25[3], d26[3]}, [r8], r1
vst4.8 {d23[4], d24[4], d25[4], d26[4]}, [r8], r1
vst4.8 {d23[5], d24[5], d25[5], d26[5]}, [r8], r1
vst4.8 {d23[6], d24[6], d25[6], d26[6]}, [r8], r1
vst4.8 {d23[7], d24[7], d25[7], d26[7]}, [r8], r1
b v_end
v_mbfilter
tst r7, #2
beq v_wide_mbfilter
; flat2 was not set for any of the channels. Just store the values from
; mbfilter.
sub r8, r0, #3
vst3.8 {d18[0], d19[0], d20[0]}, [r8], r1
vst3.8 {d21[0], d22[0], d23[0]}, [r0], r1
vst3.8 {d18[1], d19[1], d20[1]}, [r8], r1
vst3.8 {d21[1], d22[1], d23[1]}, [r0], r1
vst3.8 {d18[2], d19[2], d20[2]}, [r8], r1
vst3.8 {d21[2], d22[2], d23[2]}, [r0], r1
vst3.8 {d18[3], d19[3], d20[3]}, [r8], r1
vst3.8 {d21[3], d22[3], d23[3]}, [r0], r1
vst3.8 {d18[4], d19[4], d20[4]}, [r8], r1
vst3.8 {d21[4], d22[4], d23[4]}, [r0], r1
vst3.8 {d18[5], d19[5], d20[5]}, [r8], r1
vst3.8 {d21[5], d22[5], d23[5]}, [r0], r1
vst3.8 {d18[6], d19[6], d20[6]}, [r8], r1
vst3.8 {d21[6], d22[6], d23[6]}, [r0], r1
vst3.8 {d18[7], d19[7], d20[7]}, [r8], r1
vst3.8 {d21[7], d22[7], d23[7]}, [r0], r1
b v_end
v_wide_mbfilter
sub r8, r0, #8
vtrn.32 d0, d26
vtrn.32 d16, d27
vtrn.32 d24, d18
vtrn.32 d25, d19
vtrn.16 d0, d24
vtrn.16 d16, d25
vtrn.16 d26, d18
vtrn.16 d27, d19
vtrn.8 d0, d16
vtrn.8 d24, d25
vtrn.8 d26, d27
vtrn.8 d18, d19
vtrn.32 d20, d1
vtrn.32 d21, d2
vtrn.32 d22, d3
vtrn.32 d23, d15
vtrn.16 d20, d22
vtrn.16 d21, d23
vtrn.16 d1, d3
vtrn.16 d2, d15
vtrn.8 d20, d21
vtrn.8 d22, d23
vtrn.8 d1, d2
vtrn.8 d3, d15
vst1.8 {d0}, [r8@64], r1
vst1.8 {d20}, [r0@64], r1
vst1.8 {d16}, [r8@64], r1
vst1.8 {d21}, [r0@64], r1
vst1.8 {d24}, [r8@64], r1
vst1.8 {d22}, [r0@64], r1
vst1.8 {d25}, [r8@64], r1
vst1.8 {d23}, [r0@64], r1
vst1.8 {d26}, [r8@64], r1
vst1.8 {d1}, [r0@64], r1
vst1.8 {d27}, [r8@64], r1
vst1.8 {d2}, [r0@64], r1
vst1.8 {d18}, [r8@64], r1
vst1.8 {d3}, [r0@64], r1
vst1.8 {d19}, [r8@64], r1
vst1.8 {d15}, [r0@64], r1
v_end
vpop {d8-d15}
pop {r4-r8, pc}
ENDP ; |vp9_mb_lpf_vertical_edge_w_neon|
; void vp9_wide_mbfilter_neon();
; This is a helper function for the loopfilters. The invidual functions do the
; necessary load, transpose (if necessary) and store.
;
; r0-r3 PRESERVE
; d16 blimit
; d17 limit
; d18 thresh
; d0 p7
; d1 p6
; d2 p5
; d3 p4
; d4 p3
; d5 p2
; d6 p1
; d7 p0
; d8 q0
; d9 q1
; d10 q2
; d11 q3
; d12 q4
; d13 q5
; d14 q6
; d15 q7
|vp9_wide_mbfilter_neon| PROC
mov r7, #0
; filter_mask
vabd.u8 d19, d4, d5 ; abs(p3 - p2)
vabd.u8 d20, d5, d6 ; abs(p2 - p1)
vabd.u8 d21, d6, d7 ; abs(p1 - p0)
vabd.u8 d22, d9, d8 ; abs(q1 - q0)
vabd.u8 d23, d10, d9 ; abs(q2 - q1)
vabd.u8 d24, d11, d10 ; abs(q3 - q2)
; only compare the largest value to limit
vmax.u8 d19, d19, d20 ; max(abs(p3 - p2), abs(p2 - p1))
vmax.u8 d20, d21, d22 ; max(abs(p1 - p0), abs(q1 - q0))
vmax.u8 d23, d23, d24 ; max(abs(q2 - q1), abs(q3 - q2))
vmax.u8 d19, d19, d20
vabd.u8 d24, d7, d8 ; abs(p0 - q0)
vmax.u8 d19, d19, d23
vabd.u8 d23, d6, d9 ; a = abs(p1 - q1)
vqadd.u8 d24, d24, d24 ; b = abs(p0 - q0) * 2
; abs () > limit
vcge.u8 d19, d17, d19
; flatmask4
vabd.u8 d25, d7, d5 ; abs(p0 - p2)
vabd.u8 d26, d8, d10 ; abs(q0 - q2)
vabd.u8 d27, d4, d7 ; abs(p3 - p0)
vabd.u8 d28, d11, d8 ; abs(q3 - q0)
; only compare the largest value to thresh
vmax.u8 d25, d25, d26 ; max(abs(p0 - p2), abs(q0 - q2))
vmax.u8 d26, d27, d28 ; max(abs(p3 - p0), abs(q3 - q0))
vmax.u8 d25, d25, d26
vmax.u8 d20, d20, d25
vshr.u8 d23, d23, #1 ; a = a / 2
vqadd.u8 d24, d24, d23 ; a = b + a
vmov.u8 d30, #1
vcge.u8 d24, d16, d24 ; (a > blimit * 2 + limit) * -1
vcge.u8 d20, d30, d20 ; flat
vand d19, d19, d24 ; mask
; hevmask
vcgt.u8 d21, d21, d18 ; (abs(p1 - p0) > thresh)*-1
vcgt.u8 d22, d22, d18 ; (abs(q1 - q0) > thresh)*-1
vorr d21, d21, d22 ; hev
vand d16, d20, d19 ; flat && mask
vmov r5, r6, d16
; flatmask5(1, p7, p6, p5, p4, p0, q0, q4, q5, q6, q7)
vabd.u8 d22, d3, d7 ; abs(p4 - p0)
vabd.u8 d23, d12, d8 ; abs(q4 - q0)
vabd.u8 d24, d7, d2 ; abs(p0 - p5)
vabd.u8 d25, d8, d13 ; abs(q0 - q5)
vabd.u8 d26, d1, d7 ; abs(p6 - p0)
vabd.u8 d27, d14, d8 ; abs(q6 - q0)
vabd.u8 d28, d0, d7 ; abs(p7 - p0)
vabd.u8 d29, d15, d8 ; abs(q7 - q0)
; only compare the largest value to thresh
vmax.u8 d22, d22, d23 ; max(abs(p4 - p0), abs(q4 - q0))
vmax.u8 d23, d24, d25 ; max(abs(p0 - p5), abs(q0 - q5))
vmax.u8 d24, d26, d27 ; max(abs(p6 - p0), abs(q6 - q0))
vmax.u8 d25, d28, d29 ; max(abs(p7 - p0), abs(q7 - q0))
vmax.u8 d26, d22, d23
vmax.u8 d27, d24, d25
vmax.u8 d23, d26, d27
vcge.u8 d18, d30, d23 ; flat2
vmov.u8 d22, #0x80
orrs r5, r5, r6 ; Check for 0
orreq r7, r7, #1 ; Only do filter branch
vand d17, d18, d16 ; flat2 && flat && mask
vmov r5, r6, d17
; mbfilter() function
; filter() function
; convert to signed
veor d23, d8, d22 ; qs0
veor d24, d7, d22 ; ps0
veor d25, d6, d22 ; ps1
veor d26, d9, d22 ; qs1
vmov.u8 d27, #3
vsub.s8 d28, d23, d24 ; ( qs0 - ps0)
vqsub.s8 d29, d25, d26 ; filter = clamp(ps1-qs1)
vmull.s8 q15, d28, d27 ; 3 * ( qs0 - ps0)
vand d29, d29, d21 ; filter &= hev
vaddw.s8 q15, q15, d29 ; filter + 3 * (qs0 - ps0)
vmov.u8 d29, #4
; filter = clamp(filter + 3 * ( qs0 - ps0))
vqmovn.s16 d28, q15
vand d28, d28, d19 ; filter &= mask
vqadd.s8 d30, d28, d27 ; filter2 = clamp(filter+3)
vqadd.s8 d29, d28, d29 ; filter1 = clamp(filter+4)
vshr.s8 d30, d30, #3 ; filter2 >>= 3
vshr.s8 d29, d29, #3 ; filter1 >>= 3
vqadd.s8 d24, d24, d30 ; op0 = clamp(ps0 + filter2)
vqsub.s8 d23, d23, d29 ; oq0 = clamp(qs0 - filter1)
; outer tap adjustments: ++filter1 >> 1
vrshr.s8 d29, d29, #1
vbic d29, d29, d21 ; filter &= ~hev
vqadd.s8 d25, d25, d29 ; op1 = clamp(ps1 + filter)
vqsub.s8 d26, d26, d29 ; oq1 = clamp(qs1 - filter)
veor d24, d24, d22 ; *f_op0 = u^0x80
veor d23, d23, d22 ; *f_oq0 = u^0x80
veor d25, d25, d22 ; *f_op1 = u^0x80
veor d26, d26, d22 ; *f_oq1 = u^0x80
tst r7, #1
bxne lr
; mbfilter flat && mask branch
; TODO(fgalligan): Can I decrease the cycles shifting to consective d's
; and using vibt on the q's?
vmov.u8 d29, #2
vaddl.u8 q15, d7, d8 ; op2 = p0 + q0
vmlal.u8 q15, d4, d27 ; op2 = p0 + q0 + p3 * 3
vmlal.u8 q15, d5, d29 ; op2 = p0 + q0 + p3 * 3 + p2 * 2
vaddl.u8 q10, d4, d5
vaddw.u8 q15, d6 ; op2=p1 + p0 + q0 + p3 * 3 + p2 *2
vaddl.u8 q14, d6, d9
vqrshrn.u16 d18, q15, #3 ; r_op2
vsub.i16 q15, q10
vaddl.u8 q10, d4, d6
vadd.i16 q15, q14
vaddl.u8 q14, d7, d10
vqrshrn.u16 d19, q15, #3 ; r_op1
vsub.i16 q15, q10
vadd.i16 q15, q14
vaddl.u8 q14, d8, d11
vqrshrn.u16 d20, q15, #3 ; r_op0
vsubw.u8 q15, d4 ; oq0 = op0 - p3
vsubw.u8 q15, d7 ; oq0 -= p0
vadd.i16 q15, q14
vaddl.u8 q14, d9, d11
vqrshrn.u16 d21, q15, #3 ; r_oq0
vsubw.u8 q15, d5 ; oq1 = oq0 - p2
vsubw.u8 q15, d8 ; oq1 -= q0
vadd.i16 q15, q14
vaddl.u8 q14, d10, d11
vqrshrn.u16 d22, q15, #3 ; r_oq1
vsubw.u8 q15, d6 ; oq2 = oq0 - p1
vsubw.u8 q15, d9 ; oq2 -= q1
vadd.i16 q15, q14
vqrshrn.u16 d27, q15, #3 ; r_oq2
; Filter does not set op2 or oq2, so use p2 and q2.
vbif d18, d5, d16 ; t_op2 |= p2 & ~(flat & mask)
vbif d19, d25, d16 ; t_op1 |= f_op1 & ~(flat & mask)
vbif d20, d24, d16 ; t_op0 |= f_op0 & ~(flat & mask)
vbif d21, d23, d16 ; t_oq0 |= f_oq0 & ~(flat & mask)
vbif d22, d26, d16 ; t_oq1 |= f_oq1 & ~(flat & mask)
vbit d23, d27, d16 ; t_oq2 |= r_oq2 & (flat & mask)
vbif d23, d10, d16 ; t_oq2 |= q2 & ~(flat & mask)
tst r7, #2
bxne lr
; wide_mbfilter flat2 && flat && mask branch
vmov.u8 d16, #7
vaddl.u8 q15, d7, d8 ; op6 = p0 + q0
vaddl.u8 q12, d2, d3
vaddl.u8 q13, d4, d5
vaddl.u8 q14, d1, d6
vmlal.u8 q15, d0, d16 ; op6 += p7 * 3
vadd.i16 q12, q13
vadd.i16 q15, q14
vaddl.u8 q14, d2, d9
vadd.i16 q15, q12
vaddl.u8 q12, d0, d1
vaddw.u8 q15, d1
vaddl.u8 q13, d0, d2
vadd.i16 q14, q15, q14
vqrshrn.u16 d16, q15, #4 ; w_op6
vsub.i16 q15, q14, q12
vaddl.u8 q14, d3, d10
vqrshrn.u16 d24, q15, #4 ; w_op5
vsub.i16 q15, q13
vaddl.u8 q13, d0, d3
vadd.i16 q15, q14
vaddl.u8 q14, d4, d11
vqrshrn.u16 d25, q15, #4 ; w_op4
vadd.i16 q15, q14
vaddl.u8 q14, d0, d4
vsub.i16 q15, q13
vsub.i16 q14, q15, q14
vqrshrn.u16 d26, q15, #4 ; w_op3
vaddw.u8 q15, q14, d5 ; op2 += p2
vaddl.u8 q14, d0, d5
vaddw.u8 q15, d12 ; op2 += q4
vbif d26, d4, d17 ; op3 |= p3 & ~(f2 & f & m)
vqrshrn.u16 d27, q15, #4 ; w_op2
vsub.i16 q15, q14
vaddl.u8 q14, d0, d6
vaddw.u8 q15, d6 ; op1 += p1
vaddw.u8 q15, d13 ; op1 += q5
vbif d27, d18, d17 ; op2 |= t_op2 & ~(f2 & f & m)
vqrshrn.u16 d18, q15, #4 ; w_op1
vsub.i16 q15, q14
vaddl.u8 q14, d0, d7
vaddw.u8 q15, d7 ; op0 += p0
vaddw.u8 q15, d14 ; op0 += q6
vbif d18, d19, d17 ; op1 |= t_op1 & ~(f2 & f & m)
vqrshrn.u16 d19, q15, #4 ; w_op0
vsub.i16 q15, q14
vaddl.u8 q14, d1, d8
vaddw.u8 q15, d8 ; oq0 += q0
vaddw.u8 q15, d15 ; oq0 += q7
vbif d19, d20, d17 ; op0 |= t_op0 & ~(f2 & f & m)
vqrshrn.u16 d20, q15, #4 ; w_oq0
vsub.i16 q15, q14
vaddl.u8 q14, d2, d9
vaddw.u8 q15, d9 ; oq1 += q1
vaddl.u8 q4, d10, d15
vaddw.u8 q15, d15 ; oq1 += q7
vbif d20, d21, d17 ; oq0 |= t_oq0 & ~(f2 & f & m)
vqrshrn.u16 d21, q15, #4 ; w_oq1
vsub.i16 q15, q14
vaddl.u8 q14, d3, d10
vadd.i16 q15, q4
vaddl.u8 q4, d11, d15
vbif d21, d22, d17 ; oq1 |= t_oq1 & ~(f2 & f & m)
vqrshrn.u16 d22, q15, #4 ; w_oq2
vsub.i16 q15, q14
vaddl.u8 q14, d4, d11
vadd.i16 q15, q4
vaddl.u8 q4, d12, d15
vbif d22, d23, d17 ; oq2 |= t_oq2 & ~(f2 & f & m)
vqrshrn.u16 d23, q15, #4 ; w_oq3
vsub.i16 q15, q14
vaddl.u8 q14, d5, d12
vadd.i16 q15, q4
vaddl.u8 q4, d13, d15
vbif d16, d1, d17 ; op6 |= p6 & ~(f2 & f & m)
vqrshrn.u16 d1, q15, #4 ; w_oq4
vsub.i16 q15, q14
vaddl.u8 q14, d6, d13
vadd.i16 q15, q4
vaddl.u8 q4, d14, d15
vbif d24, d2, d17 ; op5 |= p5 & ~(f2 & f & m)
vqrshrn.u16 d2, q15, #4 ; w_oq5
vsub.i16 q15, q14
vbif d25, d3, d17 ; op4 |= p4 & ~(f2 & f & m)
vadd.i16 q15, q4
vbif d23, d11, d17 ; oq3 |= q3 & ~(f2 & f & m)
vqrshrn.u16 d3, q15, #4 ; w_oq6
vbif d1, d12, d17 ; oq4 |= q4 & ~(f2 & f & m)
vbif d2, d13, d17 ; oq5 |= q5 & ~(f2 & f & m)
vbif d3, d14, d17 ; oq6 |= q6 & ~(f2 & f & m)
bx lr
ENDP ; |vp9_wide_mbfilter_neon|
END
| huangwenjun06/libvpx_mips | vp9/common/arm/neon/vp9_mb_lpf_neon.asm | Assembly | bsd-3-clause | 20,641 |
;*****************************************************************************
;* deblock-a.asm: x86 deblocking
;*****************************************************************************
;* Copyright (C) 2005-2016 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Fiona Glaser <fiona@x264.com>
;* Oskar Arvidsson <oskar@irock.se>
;*
;* 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 2 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, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
;*
;* This program is also available under a commercial proprietary license.
;* For more information, contact us at licensing@x264.com.
;*****************************************************************************
%include "x86inc.asm"
%include "x86util.asm"
SECTION_RODATA 32
load_bytes_shuf: times 2 db 3,4,5,6,11,12,13,14,4,5,6,7,12,13,14,15
insert_top_shuf: dd 0,1,4,5,7,2,3,6
transpose_shuf: db 0,4,8,12,1,5,9,13,2,6,10,14,3,7,11,15
SECTION .text
cextern pb_0
cextern pb_1
cextern pb_3
cextern pb_a1
cextern pw_2
cextern pw_4
cextern pw_00ff
cextern pw_pixel_max
cextern pb_unpackbd1
%if HIGH_BIT_DEPTH
; out: %4 = |%1-%2|-%3
; clobbers: %5
%macro ABS_SUB 5
psubusw %5, %2, %1
psubusw %4, %1, %2
por %4, %5
psubw %4, %3
%endmacro
; out: %4 = |%1-%2|<%3
%macro DIFF_LT 5
psubusw %4, %2, %1
psubusw %5, %1, %2
por %5, %4 ; |%1-%2|
pxor %4, %4
psubw %5, %3 ; |%1-%2|-%3
pcmpgtw %4, %5 ; 0 > |%1-%2|-%3
%endmacro
%macro LOAD_AB 4
movd %1, %3
movd %2, %4
SPLATW %1, %1
SPLATW %2, %2
%endmacro
; in: %2=tc reg
; out: %1=splatted tc
%macro LOAD_TC 2
%if mmsize == 8
pshufw %1, [%2-1], 0
%else
movd %1, [%2]
punpcklbw %1, %1
pshuflw %1, %1, q1100
pshufd %1, %1, q1100
%endif
psraw %1, 8
%endmacro
; in: %1=p1, %2=p0, %3=q0, %4=q1
; %5=alpha, %6=beta, %7-%9=tmp
; out: %7=mask
%macro LOAD_MASK 9
ABS_SUB %2, %3, %5, %8, %7 ; |p0-q0| - alpha
ABS_SUB %1, %2, %6, %9, %7 ; |p1-p0| - beta
pand %8, %9
ABS_SUB %3, %4, %6, %9, %7 ; |q1-q0| - beta
pxor %7, %7
pand %8, %9
pcmpgtw %7, %8
%endmacro
; in: %1=p0, %2=q0, %3=p1, %4=q1, %5=mask, %6=tmp, %7=tmp
; out: %1=p0', m2=q0'
%macro DEBLOCK_P0_Q0 7
psubw %3, %4
pxor %7, %7
paddw %3, [pw_4]
psubw %7, %5
psubw %6, %2, %1
psllw %6, 2
paddw %3, %6
psraw %3, 3
mova %6, [pw_pixel_max]
CLIPW %3, %7, %5
pxor %7, %7
paddw %1, %3
psubw %2, %3
CLIPW %1, %7, %6
CLIPW %2, %7, %6
%endmacro
; in: %1=x2, %2=x1, %3=p0, %4=q0 %5=mask&tc, %6=tmp
%macro LUMA_Q1 6
pavgw %6, %3, %4 ; (p0+q0+1)>>1
paddw %1, %6
pxor %6, %6
psraw %1, 1
psubw %6, %5
psubw %1, %2
CLIPW %1, %6, %5
paddw %1, %2
%endmacro
%macro LUMA_DEBLOCK_ONE 3
DIFF_LT m5, %1, bm, m4, m6
pxor m6, m6
mova %3, m4
pcmpgtw m6, tcm
pand m4, tcm
pandn m6, m7
pand m4, m6
LUMA_Q1 m5, %2, m1, m2, m4, m6
%endmacro
%macro LUMA_H_STORE 2
%if mmsize == 8
movq [r0-4], m0
movq [r0+r1-4], m1
movq [r0+r1*2-4], m2
movq [r0+%2-4], m3
%else
movq [r0-4], m0
movhps [r0+r1-4], m0
movq [r0+r1*2-4], m1
movhps [%1-4], m1
movq [%1+r1-4], m2
movhps [%1+r1*2-4], m2
movq [%1+%2-4], m3
movhps [%1+r1*4-4], m3
%endif
%endmacro
%macro DEBLOCK_LUMA 0
;-----------------------------------------------------------------------------
; void deblock_v_luma( uint16_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_v_luma, 5,5,8,0-5*mmsize
%define tcm [rsp]
%define ms1 [rsp+mmsize]
%define ms2 [rsp+mmsize*2]
%define am [rsp+mmsize*3]
%define bm [rsp+mmsize*4]
add r1, r1
LOAD_AB m4, m5, r2d, r3d
mov r3, 32/mmsize
mov r2, r0
sub r0, r1
mova am, m4
sub r0, r1
mova bm, m5
sub r0, r1
.loop:
mova m0, [r0+r1]
mova m1, [r0+r1*2]
mova m2, [r2]
mova m3, [r2+r1]
LOAD_MASK m0, m1, m2, m3, am, bm, m7, m4, m6
LOAD_TC m6, r4
mova tcm, m6
mova m5, [r0]
LUMA_DEBLOCK_ONE m1, m0, ms1
mova [r0+r1], m5
mova m5, [r2+r1*2]
LUMA_DEBLOCK_ONE m2, m3, ms2
mova [r2+r1], m5
pxor m5, m5
mova m6, tcm
pcmpgtw m5, tcm
psubw m6, ms1
pandn m5, m7
psubw m6, ms2
pand m5, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m5, m7, m6
mova [r0+r1*2], m1
mova [r2], m2
add r0, mmsize
add r2, mmsize
add r4, mmsize/8
dec r3
jg .loop
RET
cglobal deblock_h_luma, 5,6,8,0-7*mmsize
%define tcm [rsp]
%define ms1 [rsp+mmsize]
%define ms2 [rsp+mmsize*2]
%define p1m [rsp+mmsize*3]
%define p2m [rsp+mmsize*4]
%define am [rsp+mmsize*5]
%define bm [rsp+mmsize*6]
add r1, r1
LOAD_AB m4, m5, r2d, r3d
mov r3, r1
mova am, m4
add r3, r1
mov r5, 32/mmsize
mova bm, m5
add r3, r1
%if mmsize == 16
mov r2, r0
add r2, r3
%endif
.loop:
%if mmsize == 8
movq m2, [r0-8] ; y q2 q1 q0
movq m7, [r0+0]
movq m5, [r0+r1-8]
movq m3, [r0+r1+0]
movq m0, [r0+r1*2-8]
movq m6, [r0+r1*2+0]
movq m1, [r0+r3-8]
TRANSPOSE4x4W 2, 5, 0, 1, 4
SWAP 2, 7
movq m7, [r0+r3]
TRANSPOSE4x4W 2, 3, 6, 7, 4
%else
movu m5, [r0-8] ; y q2 q1 q0 p0 p1 p2 x
movu m0, [r0+r1-8]
movu m2, [r0+r1*2-8]
movu m3, [r2-8]
TRANSPOSE4x4W 5, 0, 2, 3, 6
mova tcm, m3
movu m4, [r2+r1-8]
movu m1, [r2+r1*2-8]
movu m3, [r2+r3-8]
movu m7, [r2+r1*4-8]
TRANSPOSE4x4W 4, 1, 3, 7, 6
mova m6, tcm
punpcklqdq m6, m7
punpckhqdq m5, m4
SBUTTERFLY qdq, 0, 1, 7
SBUTTERFLY qdq, 2, 3, 7
%endif
mova p2m, m6
LOAD_MASK m0, m1, m2, m3, am, bm, m7, m4, m6
LOAD_TC m6, r4
mova tcm, m6
LUMA_DEBLOCK_ONE m1, m0, ms1
mova p1m, m5
mova m5, p2m
LUMA_DEBLOCK_ONE m2, m3, ms2
mova p2m, m5
pxor m5, m5
mova m6, tcm
pcmpgtw m5, tcm
psubw m6, ms1
pandn m5, m7
psubw m6, ms2
pand m5, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m5, m7, m6
mova m0, p1m
mova m3, p2m
TRANSPOSE4x4W 0, 1, 2, 3, 4
LUMA_H_STORE r2, r3
add r4, mmsize/8
lea r0, [r0+r1*(mmsize/2)]
lea r2, [r2+r1*(mmsize/2)]
dec r5
jg .loop
RET
%endmacro
%if ARCH_X86_64
; in: m0=p1, m1=p0, m2=q0, m3=q1, m8=p2, m9=q2
; m12=alpha, m13=beta
; out: m0=p1', m3=q1', m1=p0', m2=q0'
; clobbers: m4, m5, m6, m7, m10, m11, m14
%macro DEBLOCK_LUMA_INTER_SSE2 0
LOAD_MASK m0, m1, m2, m3, m12, m13, m7, m4, m6
LOAD_TC m6, r4
DIFF_LT m8, m1, m13, m10, m4
DIFF_LT m9, m2, m13, m11, m4
pand m6, m7
mova m14, m6
pxor m4, m4
pcmpgtw m6, m4
pand m6, m14
mova m5, m10
pand m5, m6
LUMA_Q1 m8, m0, m1, m2, m5, m4
mova m5, m11
pand m5, m6
LUMA_Q1 m9, m3, m1, m2, m5, m4
pxor m4, m4
psubw m6, m10
pcmpgtw m4, m14
pandn m4, m7
psubw m6, m11
pand m4, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m4, m5, m6
SWAP 0, 8
SWAP 3, 9
%endmacro
%macro DEBLOCK_LUMA_64 0
cglobal deblock_v_luma, 5,5,15
%define p2 m8
%define p1 m0
%define p0 m1
%define q0 m2
%define q1 m3
%define q2 m9
%define mask0 m7
%define mask1 m10
%define mask2 m11
add r1, r1
LOAD_AB m12, m13, r2d, r3d
mov r2, r0
sub r0, r1
sub r0, r1
sub r0, r1
mov r3, 2
.loop:
mova p2, [r0]
mova p1, [r0+r1]
mova p0, [r0+r1*2]
mova q0, [r2]
mova q1, [r2+r1]
mova q2, [r2+r1*2]
DEBLOCK_LUMA_INTER_SSE2
mova [r0+r1], p1
mova [r0+r1*2], p0
mova [r2], q0
mova [r2+r1], q1
add r0, mmsize
add r2, mmsize
add r4, 2
dec r3
jg .loop
RET
cglobal deblock_h_luma, 5,7,15
add r1, r1
LOAD_AB m12, m13, r2d, r3d
mov r2, r1
add r2, r1
add r2, r1
mov r5, r0
add r5, r2
mov r6, 2
.loop:
movu m8, [r0-8] ; y q2 q1 q0 p0 p1 p2 x
movu m0, [r0+r1-8]
movu m2, [r0+r1*2-8]
movu m9, [r5-8]
movu m5, [r5+r1-8]
movu m1, [r5+r1*2-8]
movu m3, [r5+r2-8]
movu m7, [r5+r1*4-8]
TRANSPOSE4x4W 8, 0, 2, 9, 10
TRANSPOSE4x4W 5, 1, 3, 7, 10
punpckhqdq m8, m5
SBUTTERFLY qdq, 0, 1, 10
SBUTTERFLY qdq, 2, 3, 10
punpcklqdq m9, m7
DEBLOCK_LUMA_INTER_SSE2
TRANSPOSE4x4W 0, 1, 2, 3, 4
LUMA_H_STORE r5, r2
add r4, 2
lea r0, [r0+r1*8]
lea r5, [r5+r1*8]
dec r6
jg .loop
RET
%endmacro
INIT_XMM sse2
DEBLOCK_LUMA_64
INIT_XMM avx
DEBLOCK_LUMA_64
%endif
%macro SWAPMOVA 2
%ifid %1
SWAP %1, %2
%else
mova %1, %2
%endif
%endmacro
; in: t0-t2: tmp registers
; %1=p0 %2=p1 %3=p2 %4=p3 %5=q0 %6=q1 %7=mask0
; %8=mask1p %9=2 %10=p0' %11=p1' %12=p2'
%macro LUMA_INTRA_P012 12 ; p0..p3 in memory
%if ARCH_X86_64
paddw t0, %3, %2
mova t2, %4
paddw t2, %3
%else
mova t0, %3
mova t2, %4
paddw t0, %2
paddw t2, %3
%endif
paddw t0, %1
paddw t2, t2
paddw t0, %5
paddw t2, %9
paddw t0, %9 ; (p2 + p1 + p0 + q0 + 2)
paddw t2, t0 ; (2*p3 + 3*p2 + p1 + p0 + q0 + 4)
psrlw t2, 3
psrlw t1, t0, 2
psubw t2, %3
psubw t1, %2
pand t2, %8
pand t1, %8
paddw t2, %3
paddw t1, %2
SWAPMOVA %11, t1
psubw t1, t0, %3
paddw t0, t0
psubw t1, %5
psubw t0, %3
paddw t1, %6
paddw t1, %2
paddw t0, %6
psrlw t1, 2 ; (2*p1 + p0 + q1 + 2)/4
psrlw t0, 3 ; (p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4)>>3
pxor t0, t1
pxor t1, %1
pand t0, %8
pand t1, %7
pxor t0, t1
pxor t0, %1
SWAPMOVA %10, t0
SWAPMOVA %12, t2
%endmacro
%macro LUMA_INTRA_INIT 1
%define t0 m4
%define t1 m5
%define t2 m6
%define t3 m7
%assign i 4
%rep %1
CAT_XDEFINE t, i, [rsp+mmsize*(i-4)]
%assign i i+1
%endrep
add r1, r1
%endmacro
; in: %1-%3=tmp, %4=p2, %5=q2
%macro LUMA_INTRA_INTER 5
LOAD_AB t0, t1, r2d, r3d
mova %1, t0
LOAD_MASK m0, m1, m2, m3, %1, t1, t0, t2, t3
%if ARCH_X86_64
mova %2, t0 ; mask0
psrlw t3, %1, 2
%else
mova t3, %1
mova %2, t0 ; mask0
psrlw t3, 2
%endif
paddw t3, [pw_2] ; alpha/4+2
DIFF_LT m1, m2, t3, t2, t0 ; t2 = |p0-q0| < alpha/4+2
pand t2, %2
mova t3, %5 ; q2
mova %1, t2 ; mask1
DIFF_LT t3, m2, t1, t2, t0 ; t2 = |q2-q0| < beta
pand t2, %1
mova t3, %4 ; p2
mova %3, t2 ; mask1q
DIFF_LT t3, m1, t1, t2, t0 ; t2 = |p2-p0| < beta
pand t2, %1
mova %1, t2 ; mask1p
%endmacro
%macro LUMA_H_INTRA_LOAD 0
%if mmsize == 8
movu t0, [r0-8]
movu t1, [r0+r1-8]
movu m0, [r0+r1*2-8]
movu m1, [r0+r4-8]
TRANSPOSE4x4W 4, 5, 0, 1, 2
mova t4, t0 ; p3
mova t5, t1 ; p2
movu m2, [r0]
movu m3, [r0+r1]
movu t0, [r0+r1*2]
movu t1, [r0+r4]
TRANSPOSE4x4W 2, 3, 4, 5, 6
mova t6, t0 ; q2
mova t7, t1 ; q3
%else
movu t0, [r0-8]
movu t1, [r0+r1-8]
movu m0, [r0+r1*2-8]
movu m1, [r0+r5-8]
movu m2, [r4-8]
movu m3, [r4+r1-8]
movu t2, [r4+r1*2-8]
movu t3, [r4+r5-8]
TRANSPOSE8x8W 4, 5, 0, 1, 2, 3, 6, 7, t4, t5
mova t4, t0 ; p3
mova t5, t1 ; p2
mova t6, t2 ; q2
mova t7, t3 ; q3
%endif
%endmacro
; in: %1=q3 %2=q2' %3=q1' %4=q0' %5=p0' %6=p1' %7=p2' %8=p3 %9=tmp
%macro LUMA_H_INTRA_STORE 9
%if mmsize == 8
TRANSPOSE4x4W %1, %2, %3, %4, %9
movq [r0-8], m%1
movq [r0+r1-8], m%2
movq [r0+r1*2-8], m%3
movq [r0+r4-8], m%4
movq m%1, %8
TRANSPOSE4x4W %5, %6, %7, %1, %9
movq [r0], m%5
movq [r0+r1], m%6
movq [r0+r1*2], m%7
movq [r0+r4], m%1
%else
TRANSPOSE2x4x4W %1, %2, %3, %4, %9
movq [r0-8], m%1
movq [r0+r1-8], m%2
movq [r0+r1*2-8], m%3
movq [r0+r5-8], m%4
movhps [r4-8], m%1
movhps [r4+r1-8], m%2
movhps [r4+r1*2-8], m%3
movhps [r4+r5-8], m%4
%ifnum %8
SWAP %1, %8
%else
mova m%1, %8
%endif
TRANSPOSE2x4x4W %5, %6, %7, %1, %9
movq [r0], m%5
movq [r0+r1], m%6
movq [r0+r1*2], m%7
movq [r0+r5], m%1
movhps [r4], m%5
movhps [r4+r1], m%6
movhps [r4+r1*2], m%7
movhps [r4+r5], m%1
%endif
%endmacro
%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
%macro DEBLOCK_LUMA_INTRA_64 0
cglobal deblock_v_luma_intra, 4,7,16
%define t0 m1
%define t1 m2
%define t2 m4
%define p2 m8
%define p1 m9
%define p0 m10
%define q0 m11
%define q1 m12
%define q2 m13
%define aa m5
%define bb m14
add r1, r1
lea r4, [r1*4]
lea r5, [r1*3] ; 3*stride
neg r4
add r4, r0 ; pix-4*stride
mov r6, 2
mova m0, [pw_2]
LOAD_AB aa, bb, r2d, r3d
.loop:
mova p2, [r4+r1]
mova p1, [r4+2*r1]
mova p0, [r4+r5]
mova q0, [r0]
mova q1, [r0+r1]
mova q2, [r0+2*r1]
LOAD_MASK p1, p0, q0, q1, aa, bb, m3, t0, t1
mova t2, aa
psrlw t2, 2
paddw t2, m0 ; alpha/4+2
DIFF_LT p0, q0, t2, m6, t0 ; m6 = |p0-q0| < alpha/4+2
DIFF_LT p2, p0, bb, t1, t0 ; m7 = |p2-p0| < beta
DIFF_LT q2, q0, bb, m7, t0 ; t1 = |q2-q0| < beta
pand m6, m3
pand m7, m6
pand m6, t1
LUMA_INTRA_P012 p0, p1, p2, [r4], q0, q1, m3, m6, m0, [r4+r5], [r4+2*r1], [r4+r1]
LUMA_INTRA_P012 q0, q1, q2, [r0+r5], p0, p1, m3, m7, m0, [r0], [r0+r1], [r0+2*r1]
add r0, mmsize
add r4, mmsize
dec r6
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_luma_intra, 4,7,16
%define t0 m15
%define t1 m14
%define t2 m2
%define q3 m5
%define q2 m8
%define q1 m9
%define q0 m10
%define p0 m11
%define p1 m12
%define p2 m13
%define p3 m4
%define spill [rsp]
%assign pad 24-(stack_offset&15)
SUB rsp, pad
add r1, r1
lea r4, [r1*4]
lea r5, [r1*3] ; 3*stride
add r4, r0 ; pix+4*stride
mov r6, 2
mova m0, [pw_2]
.loop:
movu q3, [r0-8]
movu q2, [r0+r1-8]
movu q1, [r0+r1*2-8]
movu q0, [r0+r5-8]
movu p0, [r4-8]
movu p1, [r4+r1-8]
movu p2, [r4+r1*2-8]
movu p3, [r4+r5-8]
TRANSPOSE8x8W 5, 8, 9, 10, 11, 12, 13, 4, 1
LOAD_AB m1, m2, r2d, r3d
LOAD_MASK q1, q0, p0, p1, m1, m2, m3, t0, t1
psrlw m1, 2
paddw m1, m0 ; alpha/4+2
DIFF_LT p0, q0, m1, m6, t0 ; m6 = |p0-q0| < alpha/4+2
DIFF_LT q2, q0, m2, t1, t0 ; t1 = |q2-q0| < beta
DIFF_LT p0, p2, m2, m7, t0 ; m7 = |p2-p0| < beta
pand m6, m3
pand m7, m6
pand m6, t1
mova spill, q3
LUMA_INTRA_P012 q0, q1, q2, q3, p0, p1, m3, m6, m0, m5, m1, q2
LUMA_INTRA_P012 p0, p1, p2, p3, q0, q1, m3, m7, m0, p0, m6, p2
mova m7, spill
LUMA_H_INTRA_STORE 7, 8, 1, 5, 11, 6, 13, 4, 14
lea r0, [r0+r1*8]
lea r4, [r4+r1*8]
dec r6
jg .loop
ADD rsp, pad
RET
%endmacro
INIT_XMM sse2
DEBLOCK_LUMA_INTRA_64
INIT_XMM avx
DEBLOCK_LUMA_INTRA_64
%endif
%macro DEBLOCK_LUMA_INTRA 0
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_v_luma_intra, 4,7,8,0-3*mmsize
LUMA_INTRA_INIT 3
lea r4, [r1*4]
lea r5, [r1*3]
neg r4
add r4, r0
mov r6, 32/mmsize
.loop:
mova m0, [r4+r1*2] ; p1
mova m1, [r4+r5] ; p0
mova m2, [r0] ; q0
mova m3, [r0+r1] ; q1
LUMA_INTRA_INTER t4, t5, t6, [r4+r1], [r0+r1*2]
LUMA_INTRA_P012 m1, m0, t3, [r4], m2, m3, t5, t4, [pw_2], [r4+r5], [r4+2*r1], [r4+r1]
mova t3, [r0+r1*2] ; q2
LUMA_INTRA_P012 m2, m3, t3, [r0+r5], m1, m0, t5, t6, [pw_2], [r0], [r0+r1], [r0+2*r1]
add r0, mmsize
add r4, mmsize
dec r6
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_luma_intra, 4,7,8,0-8*mmsize
LUMA_INTRA_INIT 8
%if mmsize == 8
lea r4, [r1*3]
mov r5, 32/mmsize
%else
lea r4, [r1*4]
lea r5, [r1*3] ; 3*stride
add r4, r0 ; pix+4*stride
mov r6, 32/mmsize
%endif
.loop:
LUMA_H_INTRA_LOAD
LUMA_INTRA_INTER t8, t9, t10, t5, t6
LUMA_INTRA_P012 m1, m0, t3, t4, m2, m3, t9, t8, [pw_2], t8, t5, t11
mova t3, t6 ; q2
LUMA_INTRA_P012 m2, m3, t3, t7, m1, m0, t9, t10, [pw_2], m4, t6, m5
mova m2, t4
mova m0, t11
mova m1, t5
mova m3, t8
mova m6, t6
LUMA_H_INTRA_STORE 2, 0, 1, 3, 4, 6, 5, t7, 7
lea r0, [r0+r1*(mmsize/2)]
%if mmsize == 8
dec r5
%else
lea r4, [r4+r1*(mmsize/2)]
dec r6
%endif
jg .loop
RET
%endmacro
%if ARCH_X86_64 == 0
INIT_MMX mmx2
DEBLOCK_LUMA
DEBLOCK_LUMA_INTRA
INIT_XMM sse2
DEBLOCK_LUMA
DEBLOCK_LUMA_INTRA
INIT_XMM avx
DEBLOCK_LUMA
DEBLOCK_LUMA_INTRA
%endif
%endif ; HIGH_BIT_DEPTH
%if HIGH_BIT_DEPTH == 0
; expands to [base],...,[base+7*stride]
%define PASS8ROWS(base, base3, stride, stride3) \
[base], [base+stride], [base+stride*2], [base3], \
[base3+stride], [base3+stride*2], [base3+stride3], [base3+stride*4]
%define PASS8ROWS(base, base3, stride, stride3, offset) \
PASS8ROWS(base+offset, base3+offset, stride, stride3)
; in: 4 rows of 8 bytes in m0..m3
; out: 8 rows of 4 bytes in %1..%8
%macro TRANSPOSE8x4B_STORE 8
punpckhdq m4, m0, m0
punpckhdq m5, m1, m1
punpckhdq m6, m2, m2
punpcklbw m0, m1
punpcklbw m2, m3
punpcklwd m1, m0, m2
punpckhwd m0, m2
movd %1, m1
punpckhdq m1, m1
movd %2, m1
movd %3, m0
punpckhdq m0, m0
movd %4, m0
punpckhdq m3, m3
punpcklbw m4, m5
punpcklbw m6, m3
punpcklwd m5, m4, m6
punpckhwd m4, m6
movd %5, m5
punpckhdq m5, m5
movd %6, m5
movd %7, m4
punpckhdq m4, m4
movd %8, m4
%endmacro
; in: 8 rows of 4 bytes in %9..%10
; out: 8 rows of 4 bytes in %1..%8
%macro STORE_8x4B 10
movd %1, %9
pextrd %2, %9, 1
pextrd %3, %9, 2
pextrd %4, %9, 3
movd %5, %10
pextrd %6, %10, 1
pextrd %7, %10, 2
pextrd %8, %10, 3
%endmacro
; in: 4 rows of 4 words in %1..%4
; out: 4 rows of 4 word in m0..m3
; clobbers: m4
%macro TRANSPOSE4x4W_LOAD 4-8
%if mmsize==8
SWAP 1, 4, 2, 3
movq m0, %1
movq m1, %2
movq m2, %3
movq m3, %4
TRANSPOSE4x4W 0, 1, 2, 3, 4
%else
movq m0, %1
movq m2, %2
movq m1, %3
movq m3, %4
punpcklwd m0, m2
punpcklwd m1, m3
mova m2, m0
punpckldq m0, m1
punpckhdq m2, m1
MOVHL m1, m0
MOVHL m3, m2
%endif
%endmacro
; in: 2 rows of 4 words in m1..m2
; out: 4 rows of 2 words in %1..%4
; clobbers: m0, m1
%macro TRANSPOSE4x2W_STORE 4-8
%if mmsize==8
punpckhwd m0, m1, m2
punpcklwd m1, m2
%else
punpcklwd m1, m2
MOVHL m0, m1
%endif
movd %3, m0
movd %1, m1
psrlq m1, 32
psrlq m0, 32
movd %2, m1
movd %4, m0
%endmacro
; in: 4/8 rows of 4 words in %1..%8
; out: 4 rows of 4/8 word in m0..m3
; clobbers: m4, m5, m6, m7
%macro TRANSPOSE4x8W_LOAD 8
%if mmsize==8
TRANSPOSE4x4W_LOAD %1, %2, %3, %4
%else
movq m0, %1
movq m2, %2
movq m1, %3
movq m3, %4
punpcklwd m0, m2
punpcklwd m1, m3
mova m2, m0
punpckldq m0, m1
punpckhdq m2, m1
movq m4, %5
movq m6, %6
movq m5, %7
movq m7, %8
punpcklwd m4, m6
punpcklwd m5, m7
mova m6, m4
punpckldq m4, m5
punpckhdq m6, m5
punpckhqdq m1, m0, m4
punpckhqdq m3, m2, m6
punpcklqdq m0, m4
punpcklqdq m2, m6
%endif
%endmacro
; in: 2 rows of 4/8 words in m1..m2
; out: 4/8 rows of 2 words in %1..%8
; clobbers: m0, m1
%macro TRANSPOSE8x2W_STORE 8
%if mmsize==8
TRANSPOSE4x2W_STORE %1, %2, %3, %4
%else
punpckhwd m0, m1, m2
punpcklwd m1, m2
movd %5, m0
movd %1, m1
psrldq m1, 4
psrldq m0, 4
movd %2, m1
movd %6, m0
psrldq m1, 4
psrldq m0, 4
movd %3, m1
movd %7, m0
psrldq m1, 4
psrldq m0, 4
movd %4, m1
movd %8, m0
%endif
%endmacro
%macro SBUTTERFLY3 4
punpckh%1 %4, %2, %3
punpckl%1 %2, %3
%endmacro
; in: 8 rows of 8 (only the middle 6 pels are used) in %1..%8
; out: 6 rows of 8 in [%9+0*16] .. [%9+5*16]
%macro TRANSPOSE6x8_MEM 9
RESET_MM_PERMUTATION
%if cpuflag(avx)
; input:
; _ABCDEF_
; _GHIJKL_
; _MNOPQR_
; _STUVWX_
; _YZabcd_
; _efghij_
; _klmnop_
; _qrstuv_
movh m0, %1
movh m2, %2
movh m1, %3
movh m3, %4
punpcklbw m0, m2 ; __ AG BH CI DJ EK FL __
punpcklbw m1, m3 ; __ MS NT OU PV QW RX __
movh m2, %5
movh m3, %6
punpcklbw m2, m3 ; __ Ye Zf ag bh ci dj __
movh m3, %7
movh m4, %8
punpcklbw m3, m4 ; __ kq lr ms nt ou pv __
SBUTTERFLY wd, 0, 1, 4 ; __ __ AG MS BH NT CI OU
; DJ PV EK QW FL RX __ __
SBUTTERFLY wd, 2, 3, 4 ; __ __ Ye kq Zf lr ag ms
; bh nt ci ou dj pv __ __
SBUTTERFLY dq, 0, 2, 4 ; __ __ __ __ AG MS Ye kq
; BH NT Zf lr CI FL OU RX
SBUTTERFLY dq, 1, 3, 4 ; DJ PV bh nt EK QW Zf lr
; FL RX dj pv __ __ __ __
movhps [%9+0x00], m0
movh [%9+0x10], m2
movhps [%9+0x20], m2
movh [%9+0x30], m1
movhps [%9+0x40], m1
movh [%9+0x50], m3
%else
movq m0, %1
movq m1, %2
movq m2, %3
movq m3, %4
movq m4, %5
movq m5, %6
movq m6, %7
SBUTTERFLY bw, 0, 1, 7
SBUTTERFLY bw, 2, 3, 7
SBUTTERFLY bw, 4, 5, 7
movq [%9+0x10], m3
SBUTTERFLY3 bw, m6, %8, m7
SBUTTERFLY wd, 0, 2, 3
SBUTTERFLY wd, 4, 6, 3
punpckhdq m0, m4
movq [%9+0x00], m0
SBUTTERFLY3 wd, m1, [%9+0x10], m3
SBUTTERFLY wd, 5, 7, 0
SBUTTERFLY dq, 1, 5, 0
SBUTTERFLY dq, 2, 6, 0
punpckldq m3, m7
movq [%9+0x10], m2
movq [%9+0x20], m6
movq [%9+0x30], m1
movq [%9+0x40], m5
movq [%9+0x50], m3
%endif
RESET_MM_PERMUTATION
%endmacro
; in: 8 rows of 8 in %1..%8
; out: 8 rows of 8 in %9..%16
%macro TRANSPOSE8x8_MEM 16
RESET_MM_PERMUTATION
%if cpuflag(avx)
movh m0, %1
movh m4, %2
movh m1, %3
movh m5, %4
movh m2, %5
movh m3, %7
punpcklbw m0, m4
punpcklbw m1, m5
movh m4, %6
movh m5, %8
punpcklbw m2, m4
punpcklbw m3, m5
SBUTTERFLY wd, 0, 1, 4
SBUTTERFLY wd, 2, 3, 4
SBUTTERFLY dq, 0, 2, 4
SBUTTERFLY dq, 1, 3, 4
movh %9, m0
movhps %10, m0
movh %11, m2
movhps %12, m2
movh %13, m1
movhps %14, m1
movh %15, m3
movhps %16, m3
%else
movq m0, %1
movq m1, %2
movq m2, %3
movq m3, %4
movq m4, %5
movq m5, %6
movq m6, %7
SBUTTERFLY bw, 0, 1, 7
SBUTTERFLY bw, 2, 3, 7
SBUTTERFLY bw, 4, 5, 7
SBUTTERFLY3 bw, m6, %8, m7
movq %9, m5
SBUTTERFLY wd, 0, 2, 5
SBUTTERFLY wd, 4, 6, 5
SBUTTERFLY wd, 1, 3, 5
movq %11, m6
movq m6, %9
SBUTTERFLY wd, 6, 7, 5
SBUTTERFLY dq, 0, 4, 5
SBUTTERFLY dq, 1, 6, 5
movq %9, m0
movq %10, m4
movq %13, m1
movq %14, m6
SBUTTERFLY3 dq, m2, %11, m0
SBUTTERFLY dq, 3, 7, 4
movq %11, m2
movq %12, m0
movq %15, m3
movq %16, m7
%endif
RESET_MM_PERMUTATION
%endmacro
; out: %4 = |%1-%2|>%3
; clobbers: %5
%macro DIFF_GT 5
%if avx_enabled == 0
mova %5, %2
mova %4, %1
psubusb %5, %1
psubusb %4, %2
%else
psubusb %5, %2, %1
psubusb %4, %1, %2
%endif
por %4, %5
psubusb %4, %3
%endmacro
; out: %4 = |%1-%2|>%3
; clobbers: %5
%macro DIFF_GT2 5-6
%if %0<6
psubusb %4, %1, %2
psubusb %5, %2, %1
%else
mova %4, %1
mova %5, %2
psubusb %4, %2
psubusb %5, %1
%endif
psubusb %5, %3
psubusb %4, %3
pcmpeqb %4, %5
%endmacro
; in: m0=p1 m1=p0 m2=q0 m3=q1 %1=alpha %2=beta
; out: m5=beta-1, m7=mask, %3=alpha-1
; clobbers: m4,m6
%macro LOAD_MASK 2-3
%if cpuflag(ssse3)
movd m4, %1
movd m5, %2
pxor m6, m6
pshufb m4, m6
pshufb m5, m6
%else
movd m4, %1
movd m5, %2
punpcklbw m4, m4
punpcklbw m5, m5
SPLATW m4, m4
SPLATW m5, m5
%endif
mova m6, [pb_1]
psubusb m4, m6 ; alpha - 1
psubusb m5, m6 ; beta - 1
%if %0>2
mova %3, m4
%endif
DIFF_GT m1, m2, m4, m7, m6 ; |p0-q0| > alpha-1
DIFF_GT m0, m1, m5, m4, m6 ; |p1-p0| > beta-1
por m7, m4
DIFF_GT m3, m2, m5, m4, m6 ; |q1-q0| > beta-1
por m7, m4
pxor m6, m6
pcmpeqb m7, m6
%endmacro
; in: m0=p1 m1=p0 m2=q0 m3=q1 m7=(tc&mask)
; out: m1=p0' m2=q0'
; clobbers: m0,3-6
%macro DEBLOCK_P0_Q0 0
pxor m5, m1, m2 ; p0^q0
pand m5, [pb_1] ; (p0^q0)&1
pcmpeqb m4, m4
pxor m3, m4
pavgb m3, m0 ; (p1 - q1 + 256)>>1
pavgb m3, [pb_3] ; (((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2
pxor m4, m1
pavgb m4, m2 ; (q0 - p0 + 256)>>1
pavgb m3, m5
paddusb m3, m4 ; d+128+33
mova m6, [pb_a1]
psubusb m6, m3
psubusb m3, [pb_a1]
pminub m6, m7
pminub m3, m7
psubusb m1, m6
psubusb m2, m3
paddusb m1, m3
paddusb m2, m6
%endmacro
; in: m1=p0 m2=q0
; %1=p1 %2=q2 %3=[q2] %4=[q1] %5=tc0 %6=tmp
; out: [q1] = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 )
; clobbers: q2, tmp, tc0
%macro LUMA_Q1 6
pavgb %6, m1, m2
pavgb %2, %6 ; avg(p2,avg(p0,q0))
pxor %6, %3
pand %6, [pb_1] ; (p2^avg(p0,q0))&1
psubusb %2, %6 ; (p2+((p0+q0+1)>>1))>>1
psubusb %6, %1, %5
paddusb %5, %1
pmaxub %2, %6
pminub %2, %5
mova %4, %2
%endmacro
%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_v_luma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
%macro DEBLOCK_LUMA 0
cglobal deblock_v_luma, 5,5,10
movd m8, [r4] ; tc0
lea r4, [r1*3]
neg r4
add r4, r0 ; pix-3*stride
mova m0, [r4+r1] ; p1
mova m1, [r4+2*r1] ; p0
mova m2, [r0] ; q0
mova m3, [r0+r1] ; q1
LOAD_MASK r2d, r3d
%if cpuflag(avx)
pshufb m8, [pb_unpackbd1]
pblendvb m9, m7, m6, m8
%else
punpcklbw m8, m8
punpcklbw m8, m8 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0]
pcmpeqb m9, m9
pcmpeqb m9, m8
pandn m9, m7
%endif
pand m8, m9
mova m3, [r4] ; p2
DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1
pand m6, m9
psubb m7, m8, m6 ; tc++
pand m6, m8
LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4
mova m4, [r0+2*r1] ; q2
DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1
pand m6, m9
pand m8, m6
psubb m7, m6
mova m3, [r0+r1]
LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m8, m6
DEBLOCK_P0_Q0
mova [r4+2*r1], m1
mova [r0], m2
RET
;-----------------------------------------------------------------------------
; void deblock_h_luma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
%if cpuflag(avx)
INIT_XMM cpuname
%else
INIT_MMX cpuname
%endif
cglobal deblock_h_luma, 5,9,0,0x60+16*WIN64
lea r8, [r1*3]
lea r6, [r0-4]
lea r5, [r0-4+r8]
%xdefine pix_tmp rsp+0x30*WIN64 ; shadow space + r4
; transpose 6x16 -> tmp space
TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r1, r8), pix_tmp
lea r6, [r6+r1*8]
lea r5, [r5+r1*8]
TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r1, r8), pix_tmp+8
; vertical filter
; alpha, beta, tc0 are still in r2d, r3d, r4
; don't backup r6, r5, r7, r8 because deblock_v_luma_sse2 doesn't use them
mov r7, r1
lea r0, [pix_tmp+0x30]
mov r1d, 0x10
%if WIN64
mov [rsp+0x20], r4
%endif
call deblock_v_luma
; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter)
add r6, 2
add r5, 2
%if cpuflag(sse4)
mova m0, [pix_tmp+0x10]
mova m1, [pix_tmp+0x20]
mova m2, [pix_tmp+0x30]
mova m3, [pix_tmp+0x40]
SBUTTERFLY bw, 0, 1, 4
SBUTTERFLY bw, 2, 3, 4
SBUTTERFLY wd, 0, 2, 4
SBUTTERFLY wd, 1, 3, 4
STORE_8x4B PASS8ROWS(r6, r5, r7, r8), m1, m3
shl r7, 3
sub r6, r7
sub r5, r7
shr r7, 3
STORE_8x4B PASS8ROWS(r6, r5, r7, r8), m0, m2
%else
movq m0, [pix_tmp+0x18]
movq m1, [pix_tmp+0x28]
movq m2, [pix_tmp+0x38]
movq m3, [pix_tmp+0x48]
TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
shl r7, 3
sub r6, r7
sub r5, r7
shr r7, 3
movq m0, [pix_tmp+0x10]
movq m1, [pix_tmp+0x20]
movq m2, [pix_tmp+0x30]
movq m3, [pix_tmp+0x40]
TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
%endif
RET
%endmacro
INIT_XMM sse2
DEBLOCK_LUMA
INIT_XMM avx
DEBLOCK_LUMA
%else
%macro DEBLOCK_LUMA 2
;-----------------------------------------------------------------------------
; void deblock_v8_luma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_%1_luma, 5,5,8,2*%2
lea r4, [r1*3]
neg r4
add r4, r0 ; pix-3*stride
mova m0, [r4+r1] ; p1
mova m1, [r4+2*r1] ; p0
mova m2, [r0] ; q0
mova m3, [r0+r1] ; q1
LOAD_MASK r2d, r3d
mov r3, r4mp
movd m4, [r3] ; tc0
%if cpuflag(avx)
pshufb m4, [pb_unpackbd1]
mova [esp+%2], m4 ; tc
pblendvb m4, m7, m6, m4
%else
punpcklbw m4, m4
punpcklbw m4, m4 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0]
mova [esp+%2], m4 ; tc
pcmpeqb m3, m3
pcmpgtb m4, m3
pand m4, m7
%endif
mova [esp], m4 ; mask
mova m3, [r4] ; p2
DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1
pand m6, m4
pand m4, [esp+%2] ; tc
psubb m7, m4, m6
pand m6, m4
LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4
mova m4, [r0+2*r1] ; q2
DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1
mova m5, [esp] ; mask
pand m6, m5
mova m5, [esp+%2] ; tc
pand m5, m6
psubb m7, m6
mova m3, [r0+r1]
LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m5, m6
DEBLOCK_P0_Q0
mova [r4+2*r1], m1
mova [r0], m2
RET
;-----------------------------------------------------------------------------
; void deblock_h_luma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
%if cpuflag(avx)
INIT_XMM cpuname
%else
INIT_MMX cpuname
%endif
cglobal deblock_h_luma, 1,5,8,0x60+12
mov r3, r1m
lea r4, [r3*3]
sub r0, 4
lea r1, [r0+r4]
%define pix_tmp esp+12
; esp is intentionally misaligned to make it aligned after pushing the arguments for deblock_%1_luma.
; transpose 6x16 -> tmp space
TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp
lea r0, [r0+r3*8]
lea r1, [r1+r3*8]
TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp+8
; vertical filter
lea r0, [pix_tmp+0x30]
PUSH dword r4m
PUSH dword r3m
PUSH dword r2m
PUSH dword 16
PUSH dword r0
call deblock_%1_luma
%ifidn %1, v8
add dword [esp ], 8 ; pix_tmp+0x38
add dword [esp+16], 2 ; tc0+2
call deblock_%1_luma
%endif
ADD esp, 20
; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter)
mov r0, r0mp
sub r0, 2
lea r1, [r0+r4]
%if cpuflag(avx)
mova m0, [pix_tmp+0x10]
mova m1, [pix_tmp+0x20]
mova m2, [pix_tmp+0x30]
mova m3, [pix_tmp+0x40]
SBUTTERFLY bw, 0, 1, 4
SBUTTERFLY bw, 2, 3, 4
SBUTTERFLY wd, 0, 2, 4
SBUTTERFLY wd, 1, 3, 4
STORE_8x4B PASS8ROWS(r0, r1, r3, r4), m0, m2
lea r0, [r0+r3*8]
lea r1, [r1+r3*8]
STORE_8x4B PASS8ROWS(r0, r1, r3, r4), m1, m3
%else
movq m0, [pix_tmp+0x10]
movq m1, [pix_tmp+0x20]
movq m2, [pix_tmp+0x30]
movq m3, [pix_tmp+0x40]
TRANSPOSE8x4B_STORE PASS8ROWS(r0, r1, r3, r4)
lea r0, [r0+r3*8]
lea r1, [r1+r3*8]
movq m0, [pix_tmp+0x18]
movq m1, [pix_tmp+0x28]
movq m2, [pix_tmp+0x38]
movq m3, [pix_tmp+0x48]
TRANSPOSE8x4B_STORE PASS8ROWS(r0, r1, r3, r4)
%endif
RET
%endmacro ; DEBLOCK_LUMA
INIT_MMX mmx2
DEBLOCK_LUMA v8, 8
INIT_XMM sse2
DEBLOCK_LUMA v, 16
INIT_XMM avx
DEBLOCK_LUMA v, 16
%endif ; ARCH
%macro LUMA_INTRA_P012 4 ; p0..p3 in memory
%if ARCH_X86_64
pavgb t0, p2, p1
pavgb t1, p0, q0
%else
mova t0, p2
mova t1, p0
pavgb t0, p1
pavgb t1, q0
%endif
pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2
mova t5, t1
%if ARCH_X86_64
paddb t2, p2, p1
paddb t3, p0, q0
%else
mova t2, p2
mova t3, p0
paddb t2, p1
paddb t3, q0
%endif
paddb t2, t3
mova t3, t2
mova t4, t2
psrlw t2, 1
pavgb t2, mpb_0
pxor t2, t0
pand t2, mpb_1
psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4;
%if ARCH_X86_64
pavgb t1, p2, q1
psubb t2, p2, q1
%else
mova t1, p2
mova t2, p2
pavgb t1, q1
psubb t2, q1
%endif
paddb t3, t3
psubb t3, t2 ; p2+2*p1+2*p0+2*q0+q1
pand t2, mpb_1
psubb t1, t2
pavgb t1, p1
pavgb t1, t5 ; (((p2+q1)/2 + p1+1)/2 + (p0+q0+1)/2 + 1)/2
psrlw t3, 2
pavgb t3, mpb_0
pxor t3, t1
pand t3, mpb_1
psubb t1, t3 ; p0'a = (p2+2*p1+2*p0+2*q0+q1+4)/8
pxor t3, p0, q1
pavgb t2, p0, q1
pand t3, mpb_1
psubb t2, t3
pavgb t2, p1 ; p0'b = (2*p1+p0+q0+2)/4
pxor t1, t2
pxor t2, p0
pand t1, mask1p
pand t2, mask0
pxor t1, t2
pxor t1, p0
mova %1, t1 ; store p0
mova t1, %4 ; p3
paddb t2, t1, p2
pavgb t1, p2
pavgb t1, t0 ; (p3+p2+1)/2 + (p2+p1+p0+q0+2)/4
paddb t2, t2
paddb t2, t4 ; 2*p3+3*p2+p1+p0+q0
psrlw t2, 2
pavgb t2, mpb_0
pxor t2, t1
pand t2, mpb_1
psubb t1, t2 ; p2' = (2*p3+3*p2+p1+p0+q0+4)/8
pxor t0, p1
pxor t1, p2
pand t0, mask1p
pand t1, mask1p
pxor t0, p1
pxor t1, p2
mova %2, t0 ; store p1
mova %3, t1 ; store p2
%endmacro
%macro LUMA_INTRA_SWAP_PQ 0
%define q1 m0
%define q0 m1
%define p0 m2
%define p1 m3
%define p2 q2
%define mask1p mask1q
%endmacro
%macro DEBLOCK_LUMA_INTRA 1
%define p1 m0
%define p0 m1
%define q0 m2
%define q1 m3
%define t0 m4
%define t1 m5
%define t2 m6
%define t3 m7
%if ARCH_X86_64
%define p2 m8
%define q2 m9
%define t4 m10
%define t5 m11
%define mask0 m12
%define mask1p m13
%if WIN64
%define mask1q [rsp]
%else
%define mask1q [rsp-24]
%endif
%define mpb_0 m14
%define mpb_1 m15
%else
%define spill(x) [esp+16*x]
%define p2 [r4+r1]
%define q2 [r0+2*r1]
%define t4 spill(0)
%define t5 spill(1)
%define mask0 spill(2)
%define mask1p spill(3)
%define mask1q spill(4)
%define mpb_0 [pb_0]
%define mpb_1 [pb_1]
%endif
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint8_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_%1_luma_intra, 4,6,16,0-(1-ARCH_X86_64)*0x50-WIN64*0x10
lea r4, [r1*4]
lea r5, [r1*3] ; 3*stride
neg r4
add r4, r0 ; pix-4*stride
mova p1, [r4+2*r1]
mova p0, [r4+r5]
mova q0, [r0]
mova q1, [r0+r1]
%if ARCH_X86_64
pxor mpb_0, mpb_0
mova mpb_1, [pb_1]
LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
SWAP 7, 12 ; m12=mask0
pavgb t5, mpb_0
pavgb t5, mpb_1 ; alpha/4+1
movdqa p2, [r4+r1]
movdqa q2, [r0+2*r1]
DIFF_GT2 p0, q0, t5, t0, t3 ; t0 = |p0-q0| > alpha/4+1
DIFF_GT2 p0, p2, m5, t2, t5, 1 ; mask1 = |p2-p0| > beta-1
DIFF_GT2 q0, q2, m5, t4, t5, 1 ; t4 = |q2-q0| > beta-1
pand t0, mask0
pand t4, t0
pand t2, t0
mova mask1q, t4
mova mask1p, t2
%else
LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
mova m4, t5
mova mask0, m7
pavgb m4, [pb_0]
pavgb m4, [pb_1] ; alpha/4+1
DIFF_GT2 p0, q0, m4, m6, m7 ; m6 = |p0-q0| > alpha/4+1
pand m6, mask0
DIFF_GT2 p0, p2, m5, m4, m7, 1 ; m4 = |p2-p0| > beta-1
pand m4, m6
mova mask1p, m4
DIFF_GT2 q0, q2, m5, m4, m7, 1 ; m4 = |q2-q0| > beta-1
pand m4, m6
mova mask1q, m4
%endif
LUMA_INTRA_P012 [r4+r5], [r4+2*r1], [r4+r1], [r4]
LUMA_INTRA_SWAP_PQ
LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5]
.end:
REP_RET
%if cpuflag(avx)
INIT_XMM cpuname
%else
INIT_MMX cpuname
%endif
%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint8_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_luma_intra, 4,9,0,0x80
lea r8, [r1*3]
lea r6, [r0-4]
lea r5, [r0-4+r8]
%if WIN64
%define pix_tmp rsp+0x20 ; shadow space
%else
%define pix_tmp rsp
%endif
; transpose 8x16 -> tmp space
TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r1, r8), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
lea r6, [r6+r1*8]
lea r5, [r5+r1*8]
TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r1, r8), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
mov r7, r1
lea r0, [pix_tmp+0x40]
mov r1, 0x10
call deblock_v_luma_intra
; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
lea r5, [r6+r8]
TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
shl r7, 3
sub r6, r7
sub r5, r7
shr r7, 3
TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
RET
%else
cglobal deblock_h_luma_intra, 2,4,8,0x80
lea r3, [r1*3]
sub r0, 4
lea r2, [r0+r3]
%define pix_tmp rsp
; transpose 8x16 -> tmp space
TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
lea r0, [r0+r1*8]
lea r2, [r2+r1*8]
TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
lea r0, [pix_tmp+0x40]
PUSH dword r3m
PUSH dword r2m
PUSH dword 16
PUSH r0
call deblock_%1_luma_intra
%ifidn %1, v8
add dword [rsp], 8 ; pix_tmp+8
call deblock_%1_luma_intra
%endif
ADD esp, 16
mov r1, r1m
mov r0, r0mp
lea r3, [r1*3]
sub r0, 4
lea r2, [r0+r3]
; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3)
lea r0, [r0+r1*8]
lea r2, [r2+r1*8]
TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3)
RET
%endif ; ARCH_X86_64
%endmacro ; DEBLOCK_LUMA_INTRA
INIT_XMM sse2
DEBLOCK_LUMA_INTRA v
INIT_XMM avx
DEBLOCK_LUMA_INTRA v
%if ARCH_X86_64 == 0
INIT_MMX mmx2
DEBLOCK_LUMA_INTRA v8
%endif
%endif ; !HIGH_BIT_DEPTH
%if HIGH_BIT_DEPTH
; in: %1=p0, %2=q0, %3=p1, %4=q1, %5=mask, %6=tmp, %7=tmp
; out: %1=p0', %2=q0'
%macro CHROMA_DEBLOCK_P0_Q0_INTRA 7
mova %6, [pw_2]
paddw %6, %3
paddw %6, %4
paddw %7, %6, %2
paddw %6, %1
paddw %6, %3
paddw %7, %4
psraw %6, 2
psraw %7, 2
psubw %6, %1
psubw %7, %2
pand %6, %5
pand %7, %5
paddw %1, %6
paddw %2, %7
%endmacro
; out: m0-m3
; clobbers: m4-m7
%macro CHROMA_H_LOAD 0-1
movq m0, [r0-8] ; p1 p1 p0 p0
movq m2, [r0] ; q0 q0 q1 q1
movq m5, [r0+r1-8]
movq m7, [r0+r1]
%if mmsize == 8
mova m1, m0
mova m3, m2
punpckldq m0, m5 ; p1
punpckhdq m1, m5 ; p0
punpckldq m2, m7 ; q0
punpckhdq m3, m7 ; q1
%else
movq m4, [r0+r1*2-8]
movq m6, [r0+r1*2]
movq m1, [r0+%1-8]
movq m3, [r0+%1]
punpckldq m0, m5 ; p1 ... p0 ...
punpckldq m2, m7 ; q0 ... q1 ...
punpckldq m4, m1
punpckldq m6, m3
punpckhqdq m1, m0, m4 ; p0
punpcklqdq m0, m4 ; p1
punpckhqdq m3, m2, m6 ; q1
punpcklqdq m2, m6 ; q0
%endif
%endmacro
%macro CHROMA_V_LOAD 1
mova m0, [r0] ; p1
mova m1, [r0+r1] ; p0
mova m2, [%1] ; q0
mova m3, [%1+r1] ; q1
%endmacro
; clobbers: m1, m2, m3
%macro CHROMA_H_STORE 0-1
SBUTTERFLY dq, 1, 2, 3
%if mmsize == 8
movq [r0-4], m1
movq [r0+r1-4], m2
%else
movq [r0-4], m1
movq [r0+r1*2-4], m2
movhps [r0+r1-4], m1
movhps [r0+%1-4], m2
%endif
%endmacro
%macro CHROMA_V_STORE 0
mova [r0+1*r1], m1
mova [r0+2*r1], m2
%endmacro
%macro DEBLOCK_CHROMA 0
cglobal deblock_inter_body
LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
pxor m4, m4
LOAD_TC m6, r4
pmaxsw m6, m4
pand m7, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m7, m5, m6
ret
;-----------------------------------------------------------------------------
; void deblock_v_chroma( uint16_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_v_chroma, 5,7,8
FIX_STRIDES r1
mov r5, r0
sub r0, r1
sub r0, r1
mov r6, 32/mmsize
.loop:
CHROMA_V_LOAD r5
call deblock_inter_body
CHROMA_V_STORE
add r0, mmsize
add r5, mmsize
add r4, mmsize/8
dec r6
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma( uint16_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma, 5,7,8
add r1, r1
mov r5, 32/mmsize
%if mmsize == 16
lea r6, [r1*3]
%endif
.loop:
CHROMA_H_LOAD r6
call deblock_inter_body
CHROMA_H_STORE r6
lea r0, [r0+r1*(mmsize/4)]
add r4, mmsize/8
dec r5
jg .loop
RET
cglobal deblock_intra_body
LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
CHROMA_DEBLOCK_P0_Q0_INTRA m1, m2, m0, m3, m7, m5, m6
ret
;-----------------------------------------------------------------------------
; void deblock_v_chroma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_v_chroma_intra, 4,6,8
add r1, r1
mov r5, 32/mmsize
movd m5, r3d
mov r4, r0
sub r0, r1
sub r0, r1
SPLATW m5, m5
.loop:
CHROMA_V_LOAD r4
call deblock_intra_body
CHROMA_V_STORE
add r0, mmsize
add r4, mmsize
dec r5
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_intra, 4,6,8
add r1, r1
mov r4, 32/mmsize
%if mmsize == 16
lea r5, [r1*3]
%endif
.loop:
CHROMA_H_LOAD r5
call deblock_intra_body
CHROMA_H_STORE r5
lea r0, [r0+r1*(mmsize/4)]
dec r4
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_intra_mbaff( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_intra_mbaff, 4,6,8
add r1, r1
%if mmsize == 8
mov r4, 16/mmsize
.loop:
%else
lea r5, [r1*3]
%endif
CHROMA_H_LOAD r5
LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
CHROMA_DEBLOCK_P0_Q0_INTRA m1, m2, m0, m3, m7, m5, m6
CHROMA_H_STORE r5
%if mmsize == 8
lea r0, [r0+r1*(mmsize/4)]
dec r4
jg .loop
%endif
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_mbaff( uint16_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_mbaff, 5,7,8
add r1, r1
lea r6, [r1*3]
%if mmsize == 8
mov r5, 16/mmsize
.loop:
%endif
CHROMA_H_LOAD r6
LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
movd m6, [r4]
punpcklbw m6, m6
psraw m6, 8
punpcklwd m6, m6
pand m7, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m7, m5, m6
CHROMA_H_STORE r6
%if mmsize == 8
lea r0, [r0+r1*(mmsize/4)]
add r4, mmsize/4
dec r5
jg .loop
%endif
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_422_intra( uint16_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_422_intra, 4,6,8
add r1, r1
mov r4, 64/mmsize
%if mmsize == 16
lea r5, [r1*3]
%endif
.loop:
CHROMA_H_LOAD r5
call deblock_intra_body
CHROMA_H_STORE r5
lea r0, [r0+r1*(mmsize/4)]
dec r4
jg .loop
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_422( uint16_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_422, 5,7,8
add r1, r1
mov r5, 64/mmsize
lea r6, [r1*3]
.loop:
CHROMA_H_LOAD r6
LOAD_AB m4, m5, r2m, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
pxor m4, m4
movd m6, [r4-1]
psraw m6, 8
SPLATW m6, m6
pmaxsw m6, m4
pand m7, m6
DEBLOCK_P0_Q0 m1, m2, m0, m3, m7, m5, m6
CHROMA_H_STORE r6
lea r0, [r0+r1*(mmsize/4)]
%if mmsize == 16
inc r4
%else
mov r2, r5
and r2, 1
add r4, r2 ; increment once every 2 iterations
%endif
dec r5
jg .loop
RET
%endmacro ; DEBLOCK_CHROMA
%if ARCH_X86_64 == 0
INIT_MMX mmx2
DEBLOCK_CHROMA
%endif
INIT_XMM sse2
DEBLOCK_CHROMA
INIT_XMM avx
DEBLOCK_CHROMA
%endif ; HIGH_BIT_DEPTH
%if HIGH_BIT_DEPTH == 0
%macro CHROMA_V_START 0
mov t5, r0
sub t5, r1
sub t5, r1
%if mmsize==8
mov dword r0m, 2
.loop:
%endif
%endmacro
%macro CHROMA_H_START 0
sub r0, 4
lea t6, [r1*3]
mov t5, r0
add r0, t6
%endmacro
%macro CHROMA_V_LOOP 1
%if mmsize==8
add r0, 8
add t5, 8
%if %1
add r4, 2
%endif
dec dword r0m
jg .loop
%endif
%endmacro
%macro CHROMA_H_LOOP 1
%if mmsize==8
lea r0, [r0+r1*4]
lea t5, [t5+r1*4]
%if %1
add r4, 2
%endif
dec dword r0m
jg .loop
%endif
%endmacro
%define t5 r5
%define t6 r6
%macro DEBLOCK_CHROMA 0
cglobal chroma_inter_body
LOAD_MASK r2d, r3d
movd m6, [r4] ; tc0
punpcklbw m6, m6
punpcklbw m6, m6
pand m7, m6
DEBLOCK_P0_Q0
ret
;-----------------------------------------------------------------------------
; void deblock_v_chroma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_v_chroma, 5,6,8
CHROMA_V_START
mova m0, [t5]
mova m1, [t5+r1]
mova m2, [r0]
mova m3, [r0+r1]
call chroma_inter_body
mova [t5+r1], m1
mova [r0], m2
CHROMA_V_LOOP 1
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma, 5,7,8
CHROMA_H_START
%if mmsize==8
mov dword r0m, 2
.loop:
%endif
TRANSPOSE4x8W_LOAD PASS8ROWS(t5, r0, r1, t6)
call chroma_inter_body
TRANSPOSE8x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
CHROMA_H_LOOP 1
RET
%endmacro ; DEBLOCK_CHROMA
INIT_XMM sse2
DEBLOCK_CHROMA
INIT_XMM avx
DEBLOCK_CHROMA
%if ARCH_X86_64 == 0
INIT_MMX mmx2
DEBLOCK_CHROMA
%endif
;-----------------------------------------------------------------------------
; void deblock_h_chroma_mbaff( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
%macro DEBLOCK_H_CHROMA_420_MBAFF 0
cglobal deblock_h_chroma_mbaff, 5,7,8
CHROMA_H_START
TRANSPOSE4x4W_LOAD PASS8ROWS(t5, r0, r1, t6)
LOAD_MASK r2d, r3d
movd m6, [r4] ; tc0
punpcklbw m6, m6
pand m7, m6
DEBLOCK_P0_Q0
TRANSPOSE4x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
RET
%endmacro
INIT_XMM sse2
DEBLOCK_H_CHROMA_420_MBAFF
%if ARCH_X86_64 == 0
INIT_MMX mmx2
DEBLOCK_H_CHROMA_420_MBAFF
%endif
%macro DEBLOCK_H_CHROMA_422 0
cglobal deblock_h_chroma_422, 5,8,8
%if ARCH_X86_64
%define cntr r7
%else
%define cntr dword r0m
%endif
CHROMA_H_START
mov cntr, 32/mmsize
.loop:
TRANSPOSE4x8W_LOAD PASS8ROWS(t5, r0, r1, t6)
LOAD_MASK r2d, r3d
movd m6, [r4] ; tc0
punpcklbw m6, m6
%if mmsize == 16
punpcklbw m6, m6
punpcklbw m6, m6
%else
pshufw m6, m6, q0000
%endif
pand m7, m6
DEBLOCK_P0_Q0
TRANSPOSE8x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
lea r0, [r0+r1*(mmsize/2)]
lea t5, [t5+r1*(mmsize/2)]
add r4, mmsize/8
dec cntr
jg .loop
RET
%endmacro
INIT_MMX mmx2
DEBLOCK_H_CHROMA_422
INIT_XMM sse2
DEBLOCK_H_CHROMA_422
INIT_XMM avx
DEBLOCK_H_CHROMA_422
; in: %1=p0 %2=p1 %3=q1
; out: p0 = (p0 + q1 + 2*p1 + 2) >> 2
%macro CHROMA_INTRA_P0 3
pxor m4, %1, %3
pand m4, [pb_1] ; m4 = (p0^q1)&1
pavgb %1, %3
psubusb %1, m4
pavgb %1, %2 ; dst = avg(p1, avg(p0,q1) - ((p0^q1)&1))
%endmacro
%define t5 r4
%define t6 r5
%macro DEBLOCK_CHROMA_INTRA_BODY 0
cglobal chroma_intra_body
LOAD_MASK r2d, r3d
mova m5, m1
mova m6, m2
CHROMA_INTRA_P0 m1, m0, m3
CHROMA_INTRA_P0 m2, m3, m0
psubb m1, m5
psubb m2, m6
pand m1, m7
pand m2, m7
paddb m1, m5
paddb m2, m6
ret
%endmacro
%macro DEBLOCK_CHROMA_INTRA 0
;-----------------------------------------------------------------------------
; void deblock_v_chroma_intra( uint8_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_v_chroma_intra, 4,5,8
CHROMA_V_START
mova m0, [t5]
mova m1, [t5+r1]
mova m2, [r0]
mova m3, [r0+r1]
call chroma_intra_body
mova [t5+r1], m1
mova [r0], m2
CHROMA_V_LOOP 0
RET
;-----------------------------------------------------------------------------
; void deblock_h_chroma_intra( uint8_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
cglobal deblock_h_chroma_intra, 4,6,8
CHROMA_H_START
%if mmsize==8
mov dword r0m, 2
.loop:
%endif
TRANSPOSE4x8W_LOAD PASS8ROWS(t5, r0, r1, t6)
call chroma_intra_body
TRANSPOSE8x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
CHROMA_H_LOOP 0
RET
cglobal deblock_h_chroma_422_intra, 4,7,8
CHROMA_H_START
mov r6d, 32/mmsize
.loop:
TRANSPOSE4x8W_LOAD PASS8ROWS(t5, r0, r1, t6)
call chroma_intra_body
TRANSPOSE8x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
lea r0, [r0+r1*(mmsize/2)]
lea t5, [t5+r1*(mmsize/2)]
dec r6d
jg .loop
RET
%endmacro ; DEBLOCK_CHROMA_INTRA
INIT_XMM sse2
DEBLOCK_CHROMA_INTRA_BODY
DEBLOCK_CHROMA_INTRA
INIT_XMM avx
DEBLOCK_CHROMA_INTRA_BODY
DEBLOCK_CHROMA_INTRA
INIT_MMX mmx2
DEBLOCK_CHROMA_INTRA_BODY
%if ARCH_X86_64 == 0
DEBLOCK_CHROMA_INTRA
%endif
;-----------------------------------------------------------------------------
; void deblock_h_chroma_intra_mbaff( uint8_t *pix, intptr_t stride, int alpha, int beta )
;-----------------------------------------------------------------------------
INIT_MMX mmx2
cglobal deblock_h_chroma_intra_mbaff, 4,6,8
CHROMA_H_START
TRANSPOSE4x4W_LOAD PASS8ROWS(t5, r0, r1, t6)
call chroma_intra_body
TRANSPOSE4x2W_STORE PASS8ROWS(t5, r0, r1, t6, 2)
RET
%endif ; !HIGH_BIT_DEPTH
;-----------------------------------------------------------------------------
; static void deblock_strength( uint8_t nnz[48], int8_t ref[2][40], int16_t mv[2][40][2],
; uint8_t bs[2][4][4], int mvy_limit, int bframe )
;-----------------------------------------------------------------------------
%define scan8start (4+1*8)
%define nnz r0+scan8start
%define ref r1+scan8start
%define mv r2+scan8start*4
%define bs0 r3
%define bs1 r3+32
%macro LOAD_BYTES_MMX 1
movd m2, [%1+8*0-1]
movd m0, [%1+8*0]
movd m3, [%1+8*2-1]
movd m1, [%1+8*2]
punpckldq m2, [%1+8*1-1]
punpckldq m0, [%1+8*1]
punpckldq m3, [%1+8*3-1]
punpckldq m1, [%1+8*3]
%endmacro
%macro DEBLOCK_STRENGTH_REFS_MMX 0
LOAD_BYTES_MMX ref
pxor m2, m0
pxor m3, m1
por m2, [bs0+0]
por m3, [bs0+8]
movq [bs0+0], m2
movq [bs0+8], m3
movd m2, [ref-8*1]
movd m3, [ref+8*1]
punpckldq m2, m0 ; row -1, row 0
punpckldq m3, m1 ; row 1, row 2
pxor m0, m2
pxor m1, m3
por m0, [bs1+0]
por m1, [bs1+8]
movq [bs1+0], m0
movq [bs1+8], m1
%endmacro
%macro DEBLOCK_STRENGTH_MVS_MMX 2
mova m0, [mv-%2]
mova m1, [mv-%2+8]
psubw m0, [mv]
psubw m1, [mv+8]
packsswb m0, m1
ABSB m0, m1
psubusb m0, m7
packsswb m0, m0
por m0, [%1]
movd [%1], m0
%endmacro
%macro DEBLOCK_STRENGTH_NNZ_MMX 1
por m2, m0
por m3, m1
mova m4, [%1]
mova m5, [%1+8]
pminub m2, m6
pminub m3, m6
pminub m4, m6 ; mv ? 1 : 0
pminub m5, m6
paddb m2, m2 ; nnz ? 2 : 0
paddb m3, m3
pmaxub m2, m4
pmaxub m3, m5
%endmacro
%macro LOAD_BYTES_XMM 1
movu m2, [%1-4] ; FIXME could be aligned if we changed nnz's allocation
movu m1, [%1+12]
pslldq m0, m2, 1
shufps m2, m1, q3131 ; cur nnz, all rows
pslldq m1, 1
shufps m0, m1, q3131 ; left neighbors
pslldq m1, m2, 4
movd m3, [%1-8] ; could be palignr if nnz was aligned
por m1, m3 ; top neighbors
%endmacro
INIT_MMX mmx2
cglobal deblock_strength, 6,6
; Prepare mv comparison register
shl r4d, 8
add r4d, 3 - (1<<8)
movd m7, r4d
SPLATW m7, m7
mova m6, [pb_1]
pxor m0, m0
mova [bs0+0], m0
mova [bs0+8], m0
mova [bs1+0], m0
mova [bs1+8], m0
.lists:
DEBLOCK_STRENGTH_REFS_MMX
mov r4d, 4
.mvs:
DEBLOCK_STRENGTH_MVS_MMX bs0, 4
DEBLOCK_STRENGTH_MVS_MMX bs1, 4*8
add r2, 4*8
add r3, 4
dec r4d
jg .mvs
add r1, 40
add r2, 4*8
sub r3, 16
dec r5d
jge .lists
; Check nnz
LOAD_BYTES_MMX nnz
DEBLOCK_STRENGTH_NNZ_MMX bs0
; Transpose column output
SBUTTERFLY bw, 2, 3, 4
SBUTTERFLY bw, 2, 3, 4
mova [bs0+0], m2
mova [bs0+8], m3
movd m2, [nnz-8*1]
movd m3, [nnz+8*1]
punpckldq m2, m0 ; row -1, row 0
punpckldq m3, m1 ; row 1, row 2
DEBLOCK_STRENGTH_NNZ_MMX bs1
mova [bs1+0], m2
mova [bs1+8], m3
RET
%macro DEBLOCK_STRENGTH_XMM 0
cglobal deblock_strength, 6,6,7
; Prepare mv comparison register
shl r4d, 8
add r4d, 3 - (1<<8)
movd m6, r4d
SPLATW m6, m6
pxor m4, m4 ; bs0
pxor m5, m5 ; bs1
.lists:
; Check refs
LOAD_BYTES_XMM ref
pxor m0, m2
pxor m1, m2
por m4, m0
por m5, m1
; Check mvs
%if cpuflag(ssse3)
mova m0, [mv+4*8*0]
mova m1, [mv+4*8*1]
palignr m3, m0, [mv+4*8*0-16], 12
palignr m2, m1, [mv+4*8*1-16], 12
psubw m0, m3
psubw m1, m2
packsswb m0, m1
mova m2, [mv+4*8*2]
mova m1, [mv+4*8*3]
palignr m3, m2, [mv+4*8*2-16], 12
psubw m2, m3
palignr m3, m1, [mv+4*8*3-16], 12
psubw m1, m3
packsswb m2, m1
%else
movu m0, [mv-4+4*8*0]
movu m1, [mv-4+4*8*1]
movu m2, [mv-4+4*8*2]
movu m3, [mv-4+4*8*3]
psubw m0, [mv+4*8*0]
psubw m1, [mv+4*8*1]
psubw m2, [mv+4*8*2]
psubw m3, [mv+4*8*3]
packsswb m0, m1
packsswb m2, m3
%endif
ABSB m0, m1
ABSB m2, m3
psubusb m0, m6
psubusb m2, m6
packsswb m0, m2
por m4, m0
mova m0, [mv+4*8*-1]
mova m1, [mv+4*8* 0]
mova m2, [mv+4*8* 1]
mova m3, [mv+4*8* 2]
psubw m0, m1
psubw m1, m2
psubw m2, m3
psubw m3, [mv+4*8* 3]
packsswb m0, m1
packsswb m2, m3
ABSB m0, m1
ABSB m2, m3
psubusb m0, m6
psubusb m2, m6
packsswb m0, m2
por m5, m0
add r1, 40
add r2, 4*8*5
dec r5d
jge .lists
; Check nnz
LOAD_BYTES_XMM nnz
por m0, m2
por m1, m2
mova m6, [pb_1]
pminub m0, m6
pminub m1, m6
pminub m4, m6 ; mv ? 1 : 0
pminub m5, m6
paddb m0, m0 ; nnz ? 2 : 0
paddb m1, m1
pmaxub m4, m0
pmaxub m5, m1
%if cpuflag(ssse3)
pshufb m4, [transpose_shuf]
%else
movhlps m3, m4
punpcklbw m4, m3
movhlps m3, m4
punpcklbw m4, m3
%endif
mova [bs1], m5
mova [bs0], m4
RET
%endmacro
INIT_XMM sse2
DEBLOCK_STRENGTH_XMM
INIT_XMM ssse3
DEBLOCK_STRENGTH_XMM
INIT_XMM avx
DEBLOCK_STRENGTH_XMM
%macro LOAD_BYTES_YMM 1
movu m0, [%1-4] ; ___E FGHI ___J KLMN ___O PQRS ___T UVWX
pshufb m0, [load_bytes_shuf] ; EFGH JKLM FGHI KLMN OPQR TUVW PQRS UVWX
mova m2, [insert_top_shuf]
vpermq m1, m0, q3131 ; FGHI KLMN PQRS UVWX x2
vpermd m0, m2, m0 ; EFGH JKLM OPQR TUVW ____ FGHI KLMN PQRS
vpbroadcastd m2, [%1-8] ; ABCD ....
vpblendd m0, m0, m2, 00010000b ; EFGH JKLM OPQR TUVW ABCD FGHI KLMN PQRS
%endmacro
INIT_YMM avx2
cglobal deblock_strength, 6,6,7
; Prepare mv comparison register
shl r4d, 8
add r4d, 3 - (1<<8)
movd xm6, r4d
vpbroadcastw m6, xm6
pxor m5, m5 ; bs0,bs1
.lists:
; Check refs
LOAD_BYTES_YMM ref
pxor m0, m1
por m5, m0
; Check mvs
movu xm0, [mv-4+4*8*0]
vinserti128 m0, m0, [mv+4*8*-1], 1
vbroadcasti128 m2, [mv+4*8* 0]
vinserti128 m1, m2, [mv-4+4*8*1], 0
vbroadcasti128 m3, [mv+4*8* 1]
psubw m0, m2
psubw m1, m3
vinserti128 m2, m3, [mv-4+4*8*2], 0
vbroadcasti128 m4, [mv+4*8* 2]
vinserti128 m3, m4, [mv-4+4*8*3], 0
psubw m2, m4
vbroadcasti128 m4, [mv+4*8* 3]
psubw m3, m4
packsswb m0, m1
packsswb m2, m3
pabsb m0, m0
pabsb m2, m2
psubusb m0, m6
psubusb m2, m6
packsswb m0, m2
por m5, m0
add r1, 40
add r2, 4*8*5
dec r5d
jge .lists
; Check nnz
LOAD_BYTES_YMM nnz
por m0, m1
mova m6, [pb_1]
pminub m0, m6
pminub m5, m6 ; mv ? 1 : 0
paddb m0, m0 ; nnz ? 2 : 0
pmaxub m5, m0
vextracti128 [bs1], m5, 1
pshufb xm5, [transpose_shuf]
mova [bs0], xm5
RET
| malvanos/Video-SIMDBench | src/asm/x86/deblock-a.asm | Assembly | bsd-3-clause | 64,050 |
; The MIT License (MIT)
;
; Copyright (c) 2014 Microsoft
;
; 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.
;
; Author: Mark Gottscho <mgottscho@ucla.edu>
.code
win_x86_64_asm_revStride8Read_Word256 proc
; Arguments:
; rcx is address of the last 256-bit word in the array
; rdx is address of the first 256-bit word in the array
; rax holds number of words accessed
; rcx holds the last 256-bit word address
; rdx holds the target total number of words to access
; xmm0 holds result from reading the memory 256-bit wide
mov rax,rcx ; Temporarily save last word address
sub rcx,rdx ; Get total number of 256-bit words between starting and ending addresses
shr rcx,5
mov rdx,rcx ; Set target number of words
mov rcx,rax ; Restore last word address
xor rax,rax ; initialize number of words accessed to 0
cmp rax,rdx ; have we completed the target total number of words to access?
jae done ; if the number of words accessed >= the target number, then we are done
myloop:
; Unroll 16 loads of 256-bit words (32 bytes is 20h) in strides of 8 words before checking loop condition.
vmovdqa ymm0, ymmword ptr [rcx-0000h]
vmovdqa ymm0, ymmword ptr [rcx-0100h]
vmovdqa ymm0, ymmword ptr [rcx-0200h]
vmovdqa ymm0, ymmword ptr [rcx-0300h]
vmovdqa ymm0, ymmword ptr [rcx-0400h]
vmovdqa ymm0, ymmword ptr [rcx-0500h]
vmovdqa ymm0, ymmword ptr [rcx-0600h]
vmovdqa ymm0, ymmword ptr [rcx-0700h]
vmovdqa ymm0, ymmword ptr [rcx-0800h]
vmovdqa ymm0, ymmword ptr [rcx-0900h]
vmovdqa ymm0, ymmword ptr [rcx-0A00h]
vmovdqa ymm0, ymmword ptr [rcx-0B00h]
vmovdqa ymm0, ymmword ptr [rcx-0C00h]
vmovdqa ymm0, ymmword ptr [rcx-0D00h]
vmovdqa ymm0, ymmword ptr [rcx-0E00h]
vmovdqa ymm0, ymmword ptr [rcx-0F00h]
add rax,16 ; Just did 16 accesses
cmp rax,rdx ; have we completed the target number of accesses in total yet?
jb myloop ; make another unrolled pass on the memory
done:
xor eax,eax ; return 0
ret
win_x86_64_asm_revStride8Read_Word256 endp
end
| Microsoft/X-Mem | src/win/x86_64/win_x86_64_asm_revStride8Read_Word256.asm | Assembly | mit | 3,345 |
;
;/*
; FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
; All rights reserved
;
;
; ***************************************************************************
; * *
; * FreeRTOS tutorial books are available in pdf and paperback. *
; * Complete, revised, and edited pdf reference manuals are also *
; * available. *
; * *
; * Purchasing FreeRTOS documentation will not only help you, by *
; * ensuring you get running as quickly as possible and with an *
; * in-depth knowledge of how to use FreeRTOS, it will also help *
; * the FreeRTOS project to continue with its mission of providing *
; * professional grade, cross platform, de facto standard solutions *
; * for microcontrollers - completely free of charge! *
; * *
; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
; * *
; * Thank you for using FreeRTOS, and thank you for your support! *
; * *
; ***************************************************************************
;
;
; This file is part of the FreeRTOS distribution.
;
; FreeRTOS is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License (version 2) as published by the
; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
; >>>NOTE<<< The modification to the GPL is included to allow you to
; distribute a combined work that includes FreeRTOS without being obliged to
; provide the source code for proprietary components outside of the FreeRTOS
; kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
; can be viewed here: http://www.freertos.org/a00114.html and also obtained
; by writing to Richard Barry, contact details for whom are available on the
; FreeRTOS WEB site.
;
; 1 tab == 4 spaces!
;
; http://www.FreeRTOS.org - Documentation, latest information, license and
; contact details.
;
; http://www.SafeRTOS.com - A version that is certified for use in safety
; critical systems.
;
; http://www.OpenRTOS.com - Commercial support, development, porting,
; licensing and training services.
;*/
; * The definition of the "register test" tasks, as described at the top of
; * main.c
.include data_model.h
.global xTaskIncrementTick
.global vTaskSwitchContext
.global vPortSetupTimerInterrupt
.global pxCurrentTCB
.global usCriticalNesting
.def vPortPreemptiveTickISR
.def vPortCooperativeTickISR
.def vPortYield
.def xPortStartScheduler
;-----------------------------------------------------------
portSAVE_CONTEXT .macro
;Save the remaining registers.
pushm_x #12, r15
mov.w &usCriticalNesting, r14
push_x r14
mov_x &pxCurrentTCB, r12
mov_x sp, 0( r12 )
.endm
;-----------------------------------------------------------
portRESTORE_CONTEXT .macro
mov_x &pxCurrentTCB, r12
mov_x @r12, sp
pop_x r15
mov.w r15, &usCriticalNesting
popm_x #12, r15
nop
pop.w sr
nop
ret_x
.endm
;-----------------------------------------------------------
;*
;* The RTOS tick ISR.
;*
;* If the cooperative scheduler is in use this simply increments the tick
;* count.
;*
;* If the preemptive scheduler is in use a context switch can also occur.
;*/
.text
.align 2
vPortPreemptiveTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
call_x #vTaskSwitchContext
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.align 2
vPortCooperativeTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Manual context switch called by the portYIELD() macro.
;
.align 2
vPortYield: .asmfunc
; The sr needs saving before it is modified.
push.w sr
; Now the SR is stacked we can disable interrupts.
dint
nop
; Save the context of the current task.
portSAVE_CONTEXT
; Select the next task to run.
call_x #vTaskSwitchContext
; Restore the context of the new task.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Start off the scheduler by initialising the RTOS tick timer, then restoring
; the context of the first task.
;
.align 2
xPortStartScheduler: .asmfunc
; Setup the hardware to generate the tick. Interrupts are disabled
; when this function is called.
call_x #vPortSetupTimerInterrupt
; Restore the context of the first task that is going to run.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.end
| PUCSIE-embedded-course/stm32f4-examples | firmware/freertos/semaphore/lib/FreeRTOSV8.2.3/FreeRTOS/Source/portable/CCS/MSP430X/portext.asm | Assembly | mit | 5,911 |
;
; jidctflt.asm - floating-point IDCT (SSE & SSE2)
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
; Copyright (C) 2016, D. R. Commander.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; This file contains a floating-point implementation of the inverse DCT
; (Discrete Cosine Transform). The following code is based directly on
; the IJG's original jidctflt.c; see the jidctflt.c for more details.
%include "jsimdext.inc"
%include "jdct.inc"
; --------------------------------------------------------------------------
%macro unpcklps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(0 1 4 5)
shufps %1, %2, 0x44
%endmacro
%macro unpckhps2 2 ; %1=(0 1 2 3) / %2=(4 5 6 7) => %1=(2 3 6 7)
shufps %1, %2, 0xEE
%endmacro
; --------------------------------------------------------------------------
SECTION SEG_CONST
alignz 32
GLOBAL_DATA(jconst_idct_float_sse2)
EXTN(jconst_idct_float_sse2):
PD_1_414 times 4 dd 1.414213562373095048801689
PD_1_847 times 4 dd 1.847759065022573512256366
PD_1_082 times 4 dd 1.082392200292393968799446
PD_M2_613 times 4 dd -2.613125929752753055713286
PD_RNDINT_MAGIC times 4 dd 100663296.0 ; (float)(0x00C00000 << 3)
PB_CENTERJSAMP times 16 db CENTERJSAMPLE
alignz 32
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 32
;
; Perform dequantization and inverse DCT on one block of coefficients.
;
; GLOBAL(void)
; jsimd_idct_float_sse2(void *dct_table, JCOEFPTR coef_block,
; JSAMPARRAY output_buf, JDIMENSION output_col)
;
%define dct_table(b) (b) + 8 ; void *dct_table
%define coef_block(b) (b) + 12 ; JCOEFPTR coef_block
%define output_buf(b) (b) + 16 ; JSAMPARRAY output_buf
%define output_col(b) (b) + 20 ; JDIMENSION output_col
%define original_ebp ebp + 0
%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
; xmmword wk[WK_NUM]
%define WK_NUM 2
%define workspace wk(0) - DCTSIZE2 * SIZEOF_FAST_FLOAT
; FAST_FLOAT workspace[DCTSIZE2]
align 32
GLOBAL_FUNCTION(jsimd_idct_float_sse2)
EXTN(jsimd_idct_float_sse2):
push ebp
mov eax, esp ; eax = original ebp
sub esp, byte 4
and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits
mov [esp], eax
mov ebp, esp ; ebp = aligned ebp
lea esp, [workspace]
push ebx
; push ecx ; need not be preserved
; push edx ; need not be preserved
push esi
push edi
get_GOT ebx ; get GOT address
; ---- Pass 1: process columns from input, store into work array.
; mov eax, [original_ebp]
mov edx, POINTER [dct_table(eax)] ; quantptr
mov esi, JCOEFPTR [coef_block(eax)] ; inptr
lea edi, [workspace] ; FAST_FLOAT *wsptr
mov ecx, DCTSIZE/4 ; ctr
alignx 16, 7
.columnloop:
%ifndef NO_ZERO_COLUMN_TEST_FLOAT_SSE
mov eax, dword [DWBLOCK(1,0,esi,SIZEOF_JCOEF)]
or eax, dword [DWBLOCK(2,0,esi,SIZEOF_JCOEF)]
jnz near .columnDCT
movq xmm1, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)]
movq xmm2, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)]
movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)]
movq xmm4, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)]
movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)]
movq xmm6, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)]
movq xmm7, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)]
por xmm1, xmm2
por xmm3, xmm4
por xmm5, xmm6
por xmm1, xmm3
por xmm5, xmm7
por xmm1, xmm5
packsswb xmm1, xmm1
movd eax, xmm1
test eax, eax
jnz short .columnDCT
; -- AC terms all zero
movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)]
punpcklwd xmm0, xmm0 ; xmm0=(00 00 01 01 02 02 03 03)
psrad xmm0, (DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03)
cvtdq2ps xmm0, xmm0 ; xmm0=in0=(00 01 02 03)
mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
movaps xmm1, xmm0
movaps xmm2, xmm0
movaps xmm3, xmm0
shufps xmm0, xmm0, 0x00 ; xmm0=(00 00 00 00)
shufps xmm1, xmm1, 0x55 ; xmm1=(01 01 01 01)
shufps xmm2, xmm2, 0xAA ; xmm2=(02 02 02 02)
shufps xmm3, xmm3, 0xFF ; xmm3=(03 03 03 03)
movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm0
movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0
movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm1
movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1
movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm2
movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm2
movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm3
movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3
jmp near .nextcolumn
alignx 16, 7
%endif
.columnDCT:
; -- Even part
movq xmm0, XMM_MMWORD [MMBLOCK(0,0,esi,SIZEOF_JCOEF)]
movq xmm1, XMM_MMWORD [MMBLOCK(2,0,esi,SIZEOF_JCOEF)]
movq xmm2, XMM_MMWORD [MMBLOCK(4,0,esi,SIZEOF_JCOEF)]
movq xmm3, XMM_MMWORD [MMBLOCK(6,0,esi,SIZEOF_JCOEF)]
punpcklwd xmm0, xmm0 ; xmm0=(00 00 01 01 02 02 03 03)
punpcklwd xmm1, xmm1 ; xmm1=(20 20 21 21 22 22 23 23)
psrad xmm0, (DWORD_BIT-WORD_BIT) ; xmm0=in0=(00 01 02 03)
psrad xmm1, (DWORD_BIT-WORD_BIT) ; xmm1=in2=(20 21 22 23)
cvtdq2ps xmm0, xmm0 ; xmm0=in0=(00 01 02 03)
cvtdq2ps xmm1, xmm1 ; xmm1=in2=(20 21 22 23)
punpcklwd xmm2, xmm2 ; xmm2=(40 40 41 41 42 42 43 43)
punpcklwd xmm3, xmm3 ; xmm3=(60 60 61 61 62 62 63 63)
psrad xmm2, (DWORD_BIT-WORD_BIT) ; xmm2=in4=(40 41 42 43)
psrad xmm3, (DWORD_BIT-WORD_BIT) ; xmm3=in6=(60 61 62 63)
cvtdq2ps xmm2, xmm2 ; xmm2=in4=(40 41 42 43)
cvtdq2ps xmm3, xmm3 ; xmm3=in6=(60 61 62 63)
mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm1, XMMWORD [XMMBLOCK(2,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm2, XMMWORD [XMMBLOCK(4,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm3, XMMWORD [XMMBLOCK(6,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
movaps xmm4, xmm0
movaps xmm5, xmm1
subps xmm0, xmm2 ; xmm0=tmp11
subps xmm1, xmm3
addps xmm4, xmm2 ; xmm4=tmp10
addps xmm5, xmm3 ; xmm5=tmp13
mulps xmm1, [GOTOFF(ebx,PD_1_414)]
subps xmm1, xmm5 ; xmm1=tmp12
movaps xmm6, xmm4
movaps xmm7, xmm0
subps xmm4, xmm5 ; xmm4=tmp3
subps xmm0, xmm1 ; xmm0=tmp2
addps xmm6, xmm5 ; xmm6=tmp0
addps xmm7, xmm1 ; xmm7=tmp1
movaps XMMWORD [wk(1)], xmm4 ; tmp3
movaps XMMWORD [wk(0)], xmm0 ; tmp2
; -- Odd part
movq xmm2, XMM_MMWORD [MMBLOCK(1,0,esi,SIZEOF_JCOEF)]
movq xmm3, XMM_MMWORD [MMBLOCK(3,0,esi,SIZEOF_JCOEF)]
movq xmm5, XMM_MMWORD [MMBLOCK(5,0,esi,SIZEOF_JCOEF)]
movq xmm1, XMM_MMWORD [MMBLOCK(7,0,esi,SIZEOF_JCOEF)]
punpcklwd xmm2, xmm2 ; xmm2=(10 10 11 11 12 12 13 13)
punpcklwd xmm3, xmm3 ; xmm3=(30 30 31 31 32 32 33 33)
psrad xmm2, (DWORD_BIT-WORD_BIT) ; xmm2=in1=(10 11 12 13)
psrad xmm3, (DWORD_BIT-WORD_BIT) ; xmm3=in3=(30 31 32 33)
cvtdq2ps xmm2, xmm2 ; xmm2=in1=(10 11 12 13)
cvtdq2ps xmm3, xmm3 ; xmm3=in3=(30 31 32 33)
punpcklwd xmm5, xmm5 ; xmm5=(50 50 51 51 52 52 53 53)
punpcklwd xmm1, xmm1 ; xmm1=(70 70 71 71 72 72 73 73)
psrad xmm5, (DWORD_BIT-WORD_BIT) ; xmm5=in5=(50 51 52 53)
psrad xmm1, (DWORD_BIT-WORD_BIT) ; xmm1=in7=(70 71 72 73)
cvtdq2ps xmm5, xmm5 ; xmm5=in5=(50 51 52 53)
cvtdq2ps xmm1, xmm1 ; xmm1=in7=(70 71 72 73)
mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm3, XMMWORD [XMMBLOCK(3,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm5, XMMWORD [XMMBLOCK(5,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
mulps xmm1, XMMWORD [XMMBLOCK(7,0,edx,SIZEOF_FLOAT_MULT_TYPE)]
movaps xmm4, xmm2
movaps xmm0, xmm5
addps xmm2, xmm1 ; xmm2=z11
addps xmm5, xmm3 ; xmm5=z13
subps xmm4, xmm1 ; xmm4=z12
subps xmm0, xmm3 ; xmm0=z10
movaps xmm1, xmm2
subps xmm2, xmm5
addps xmm1, xmm5 ; xmm1=tmp7
mulps xmm2, [GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11
movaps xmm3, xmm0
addps xmm0, xmm4
mulps xmm0, [GOTOFF(ebx,PD_1_847)] ; xmm0=z5
mulps xmm3, [GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930)
mulps xmm4, [GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200)
addps xmm3, xmm0 ; xmm3=tmp12
subps xmm4, xmm0 ; xmm4=tmp10
; -- Final output stage
subps xmm3, xmm1 ; xmm3=tmp6
movaps xmm5, xmm6
movaps xmm0, xmm7
addps xmm6, xmm1 ; xmm6=data0=(00 01 02 03)
addps xmm7, xmm3 ; xmm7=data1=(10 11 12 13)
subps xmm5, xmm1 ; xmm5=data7=(70 71 72 73)
subps xmm0, xmm3 ; xmm0=data6=(60 61 62 63)
subps xmm2, xmm3 ; xmm2=tmp5
movaps xmm1, xmm6 ; transpose coefficients(phase 1)
unpcklps xmm6, xmm7 ; xmm6=(00 10 01 11)
unpckhps xmm1, xmm7 ; xmm1=(02 12 03 13)
movaps xmm3, xmm0 ; transpose coefficients(phase 1)
unpcklps xmm0, xmm5 ; xmm0=(60 70 61 71)
unpckhps xmm3, xmm5 ; xmm3=(62 72 63 73)
movaps xmm7, XMMWORD [wk(0)] ; xmm7=tmp2
movaps xmm5, XMMWORD [wk(1)] ; xmm5=tmp3
movaps XMMWORD [wk(0)], xmm0 ; wk(0)=(60 70 61 71)
movaps XMMWORD [wk(1)], xmm3 ; wk(1)=(62 72 63 73)
addps xmm4, xmm2 ; xmm4=tmp4
movaps xmm0, xmm7
movaps xmm3, xmm5
addps xmm7, xmm2 ; xmm7=data2=(20 21 22 23)
addps xmm5, xmm4 ; xmm5=data4=(40 41 42 43)
subps xmm0, xmm2 ; xmm0=data5=(50 51 52 53)
subps xmm3, xmm4 ; xmm3=data3=(30 31 32 33)
movaps xmm2, xmm7 ; transpose coefficients(phase 1)
unpcklps xmm7, xmm3 ; xmm7=(20 30 21 31)
unpckhps xmm2, xmm3 ; xmm2=(22 32 23 33)
movaps xmm4, xmm5 ; transpose coefficients(phase 1)
unpcklps xmm5, xmm0 ; xmm5=(40 50 41 51)
unpckhps xmm4, xmm0 ; xmm4=(42 52 43 53)
movaps xmm3, xmm6 ; transpose coefficients(phase 2)
unpcklps2 xmm6, xmm7 ; xmm6=(00 10 20 30)
unpckhps2 xmm3, xmm7 ; xmm3=(01 11 21 31)
movaps xmm0, xmm1 ; transpose coefficients(phase 2)
unpcklps2 xmm1, xmm2 ; xmm1=(02 12 22 32)
unpckhps2 xmm0, xmm2 ; xmm0=(03 13 23 33)
movaps xmm7, XMMWORD [wk(0)] ; xmm7=(60 70 61 71)
movaps xmm2, XMMWORD [wk(1)] ; xmm2=(62 72 63 73)
movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm6
movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3
movaps XMMWORD [XMMBLOCK(2,0,edi,SIZEOF_FAST_FLOAT)], xmm1
movaps XMMWORD [XMMBLOCK(3,0,edi,SIZEOF_FAST_FLOAT)], xmm0
movaps xmm6, xmm5 ; transpose coefficients(phase 2)
unpcklps2 xmm5, xmm7 ; xmm5=(40 50 60 70)
unpckhps2 xmm6, xmm7 ; xmm6=(41 51 61 71)
movaps xmm3, xmm4 ; transpose coefficients(phase 2)
unpcklps2 xmm4, xmm2 ; xmm4=(42 52 62 72)
unpckhps2 xmm3, xmm2 ; xmm3=(43 53 63 73)
movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm5
movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm6
movaps XMMWORD [XMMBLOCK(2,1,edi,SIZEOF_FAST_FLOAT)], xmm4
movaps XMMWORD [XMMBLOCK(3,1,edi,SIZEOF_FAST_FLOAT)], xmm3
.nextcolumn:
add esi, byte 4*SIZEOF_JCOEF ; coef_block
add edx, byte 4*SIZEOF_FLOAT_MULT_TYPE ; quantptr
add edi, 4*DCTSIZE*SIZEOF_FAST_FLOAT ; wsptr
dec ecx ; ctr
jnz near .columnloop
; -- Prefetch the next coefficient block
prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 0*32]
prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 1*32]
prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 2*32]
prefetchnta [esi + (DCTSIZE2-8)*SIZEOF_JCOEF + 3*32]
; ---- Pass 2: process rows from work array, store into output array.
mov eax, [original_ebp]
lea esi, [workspace] ; FAST_FLOAT *wsptr
mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *)
mov eax, JDIMENSION [output_col(eax)]
mov ecx, DCTSIZE/4 ; ctr
alignx 16, 7
.rowloop:
; -- Even part
movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm2, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm3, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm4, xmm0
movaps xmm5, xmm1
subps xmm0, xmm2 ; xmm0=tmp11
subps xmm1, xmm3
addps xmm4, xmm2 ; xmm4=tmp10
addps xmm5, xmm3 ; xmm5=tmp13
mulps xmm1, [GOTOFF(ebx,PD_1_414)]
subps xmm1, xmm5 ; xmm1=tmp12
movaps xmm6, xmm4
movaps xmm7, xmm0
subps xmm4, xmm5 ; xmm4=tmp3
subps xmm0, xmm1 ; xmm0=tmp2
addps xmm6, xmm5 ; xmm6=tmp0
addps xmm7, xmm1 ; xmm7=tmp1
movaps XMMWORD [wk(1)], xmm4 ; tmp3
movaps XMMWORD [wk(0)], xmm0 ; tmp2
; -- Odd part
movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm3, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm5, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm1, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm4, xmm2
movaps xmm0, xmm5
addps xmm2, xmm1 ; xmm2=z11
addps xmm5, xmm3 ; xmm5=z13
subps xmm4, xmm1 ; xmm4=z12
subps xmm0, xmm3 ; xmm0=z10
movaps xmm1, xmm2
subps xmm2, xmm5
addps xmm1, xmm5 ; xmm1=tmp7
mulps xmm2, [GOTOFF(ebx,PD_1_414)] ; xmm2=tmp11
movaps xmm3, xmm0
addps xmm0, xmm4
mulps xmm0, [GOTOFF(ebx,PD_1_847)] ; xmm0=z5
mulps xmm3, [GOTOFF(ebx,PD_M2_613)] ; xmm3=(z10 * -2.613125930)
mulps xmm4, [GOTOFF(ebx,PD_1_082)] ; xmm4=(z12 * 1.082392200)
addps xmm3, xmm0 ; xmm3=tmp12
subps xmm4, xmm0 ; xmm4=tmp10
; -- Final output stage
subps xmm3, xmm1 ; xmm3=tmp6
movaps xmm5, xmm6
movaps xmm0, xmm7
addps xmm6, xmm1 ; xmm6=data0=(00 10 20 30)
addps xmm7, xmm3 ; xmm7=data1=(01 11 21 31)
subps xmm5, xmm1 ; xmm5=data7=(07 17 27 37)
subps xmm0, xmm3 ; xmm0=data6=(06 16 26 36)
subps xmm2, xmm3 ; xmm2=tmp5
movaps xmm1, [GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm1=[PD_RNDINT_MAGIC]
pcmpeqd xmm3, xmm3
psrld xmm3, WORD_BIT ; xmm3={0xFFFF 0x0000 0xFFFF 0x0000 ..}
addps xmm6, xmm1 ; xmm6=roundint(data0/8)=(00 ** 10 ** 20 ** 30 **)
addps xmm7, xmm1 ; xmm7=roundint(data1/8)=(01 ** 11 ** 21 ** 31 **)
addps xmm0, xmm1 ; xmm0=roundint(data6/8)=(06 ** 16 ** 26 ** 36 **)
addps xmm5, xmm1 ; xmm5=roundint(data7/8)=(07 ** 17 ** 27 ** 37 **)
pand xmm6, xmm3 ; xmm6=(00 -- 10 -- 20 -- 30 --)
pslld xmm7, WORD_BIT ; xmm7=(-- 01 -- 11 -- 21 -- 31)
pand xmm0, xmm3 ; xmm0=(06 -- 16 -- 26 -- 36 --)
pslld xmm5, WORD_BIT ; xmm5=(-- 07 -- 17 -- 27 -- 37)
por xmm6, xmm7 ; xmm6=(00 01 10 11 20 21 30 31)
por xmm0, xmm5 ; xmm0=(06 07 16 17 26 27 36 37)
movaps xmm1, XMMWORD [wk(0)] ; xmm1=tmp2
movaps xmm3, XMMWORD [wk(1)] ; xmm3=tmp3
addps xmm4, xmm2 ; xmm4=tmp4
movaps xmm7, xmm1
movaps xmm5, xmm3
addps xmm1, xmm2 ; xmm1=data2=(02 12 22 32)
addps xmm3, xmm4 ; xmm3=data4=(04 14 24 34)
subps xmm7, xmm2 ; xmm7=data5=(05 15 25 35)
subps xmm5, xmm4 ; xmm5=data3=(03 13 23 33)
movaps xmm2, [GOTOFF(ebx,PD_RNDINT_MAGIC)] ; xmm2=[PD_RNDINT_MAGIC]
pcmpeqd xmm4, xmm4
psrld xmm4, WORD_BIT ; xmm4={0xFFFF 0x0000 0xFFFF 0x0000 ..}
addps xmm3, xmm2 ; xmm3=roundint(data4/8)=(04 ** 14 ** 24 ** 34 **)
addps xmm7, xmm2 ; xmm7=roundint(data5/8)=(05 ** 15 ** 25 ** 35 **)
addps xmm1, xmm2 ; xmm1=roundint(data2/8)=(02 ** 12 ** 22 ** 32 **)
addps xmm5, xmm2 ; xmm5=roundint(data3/8)=(03 ** 13 ** 23 ** 33 **)
pand xmm3, xmm4 ; xmm3=(04 -- 14 -- 24 -- 34 --)
pslld xmm7, WORD_BIT ; xmm7=(-- 05 -- 15 -- 25 -- 35)
pand xmm1, xmm4 ; xmm1=(02 -- 12 -- 22 -- 32 --)
pslld xmm5, WORD_BIT ; xmm5=(-- 03 -- 13 -- 23 -- 33)
por xmm3, xmm7 ; xmm3=(04 05 14 15 24 25 34 35)
por xmm1, xmm5 ; xmm1=(02 03 12 13 22 23 32 33)
movdqa xmm2, [GOTOFF(ebx,PB_CENTERJSAMP)] ; xmm2=[PB_CENTERJSAMP]
packsswb xmm6, xmm3 ; xmm6=(00 01 10 11 20 21 30 31 04 05 14 15 24 25 34 35)
packsswb xmm1, xmm0 ; xmm1=(02 03 12 13 22 23 32 33 06 07 16 17 26 27 36 37)
paddb xmm6, xmm2
paddb xmm1, xmm2
movdqa xmm4, xmm6 ; transpose coefficients(phase 2)
punpcklwd xmm6, xmm1 ; xmm6=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33)
punpckhwd xmm4, xmm1 ; xmm4=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37)
movdqa xmm7, xmm6 ; transpose coefficients(phase 3)
punpckldq xmm6, xmm4 ; xmm6=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17)
punpckhdq xmm7, xmm4 ; xmm7=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37)
pshufd xmm5, xmm6, 0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07)
pshufd xmm3, xmm7, 0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27)
pushpic ebx ; save GOT address
mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW]
mov ebx, JSAMPROW [edi+2*SIZEOF_JSAMPROW]
movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6
movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm7
mov edx, JSAMPROW [edi+1*SIZEOF_JSAMPROW]
mov ebx, JSAMPROW [edi+3*SIZEOF_JSAMPROW]
movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm5
movq XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE], xmm3
poppic ebx ; restore GOT address
add esi, byte 4*SIZEOF_FAST_FLOAT ; wsptr
add edi, byte 4*SIZEOF_JSAMPROW
dec ecx ; ctr
jnz near .rowloop
pop edi
pop esi
; pop edx ; need not be preserved
; pop ecx ; need not be preserved
pop ebx
mov esp, ebp ; esp <- aligned ebp
pop esp ; esp <- original ebp
pop ebp
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 32
| youtube/cobalt | third_party/libjpeg-turbo/simd/i386/jidctflt-sse2.asm | Assembly | bsd-3-clause | 21,790 |
; screen colors and so on
include "screensSetup.inc"
TEXTSCREEN_LEVELSTART = $00
TEXTSCREEN_LEVELCOMPLETE = $01
TEXTSCREEN_LIVELOST = $02
TEXTSCREEN_GAMEOVER = $03
NUMBERSSTARTINFONT = 16
SCREENS_TEXTCOLOR = $04
SCREENS_TEXTLUMINANCE = $06
screenFixed dc.b $00
textScreenNumber dc.b $00
goalNextTextScreen dc.b $00
goalTextScreenNr dc.b $00
stoneOutsideScreen dc.b $00
SUBROUTINE
;----------------------------------------------------------------------
; Displays a text and waits for the user to press the joystick button
;----------------------------------------------------------------------
displayTextScreen
jsr waitForScrollDone
;;;;jsr fixedScrollPos
jsr waitUntilBorder
lda #$01
sta screenFixed
lda #$0b
sta $ff06
jsr waitFrame
jsr switchFrame
jsr clearFrame
jsr callLevelClearFunc
jsr switchFrame
jsr clearFrame
jsr callLevelClearFunc
lda #SCREENS_BACKGROUNDCOLOR
sta $ff15
lda #SCREENS_COLOR1
sta $ff16
lda #SCREENS_COLOR2
sta $ff17
ldx #<FONTFOR2000EXOEND
ldy #>FONTFOR2000EXOEND
jsr fw_decrunch
ldx #<SCREENMASKFOR1800EXOEND
ldy #>SCREENMASKFOR1800EXOEND
jsr fw_decrunch
; depack textscreen
ldx textscreens+0
ldy textscreens+1
jsr fw_decrunch
ldx textScreenNumber
lda CURRENTSCREENS,x
asl
tax
lda $3000 + 0,x
sta ZP_TEXTSCREENREAD + 1 ; don't now why this is flipped
lda $3000 + 1,x
sta ZP_TEXTSCREENREAD + 0
ldy #$00
lda (ZP_TEXTSCREENREAD),y
sta .layerNumber + 1; because it's packed in screenmem
ldy #$02
lda (ZP_TEXTSCREENREAD),y
sta .switchlayerNumber + 1
jsr blitScreenText
lda #$00
jsr colorizeScreen
lda #$18 ; screenram 1800
sta $ff14
lda $ff13
and #%00000111
ora #%00100000 ; font 2000
sta $ff13
lda #%10011000 ; reversing off,multicolor,25 rows
sta $ff07
jsr waitUntilBorder
lda #%00011011 ; screenon, 40 columns
sta $ff06
lda .switchlayerNumber + 1
and #$40
beq .nozordan1
jsr drawZordan
.nozordan1
ldy #$00
.nextfadein
jsr waitFrame
tya
pha
asl
asl
asl
asl
ora #SCREENS_TEXTCOLOR
jsr colorizeScreen
pla
tay
iny
cpy #SCREENS_TEXTLUMINANCE
bne .nextfadein
jsr joyButtonClick
lda .switchlayerNumber + 1
and #$40
beq .nozordan2
lda #$00
jsr clearZordan
.nozordan2
ldy #SCREENS_TEXTLUMINANCE-1
.nextfadeout
jsr waitFrame
tya
pha
asl
asl
asl
asl
ora #SCREENS_TEXTCOLOR
jsr colorizeScreen
pla
tay
dey
bpl .nextfadeout
; nextscreen for this screen
ldy #$01
lda (ZP_TEXTSCREENREAD),y
bpl .isnotgoal
and #$7f
sta goalNextTextScreen
ldx textScreenNumber
stx goalTextScreenNr
jmp .nogoal
.isnotgoal
ldx textScreenNumber
sta CURRENTSCREENS,x
.nogoal
jsr waitUntilBorder
lda #$0b
sta $ff06
jsr waitFrame
lda FOREGROUNDCOLOR
sta $ff16
lda textScreenNumber
cmp #TEXTSCREEN_LIVELOST
bne .notPlayerToNewScrollPos
lda #$00
sta GameObjectXPosLoLo + PLAYERGAMEOBJECT
sta GameObjectYPosLoLo + PLAYERGAMEOBJECT
lda onGroundSavePointPlayerPosX + 0
sta GameObjectXPosLo + PLAYERGAMEOBJECT
lda onGroundSavePointPlayerPosX + 1
sta GameObjectXPosHi + PLAYERGAMEOBJECT
lda onGroundSavePointPlayerPosY + 0
sta GameObjectYPosLo + PLAYERGAMEOBJECT
lda onGroundSavePointPlayerPosY + 1
sta GameObjectYPosHi + PLAYERGAMEOBJECT
jsr setPlayerToNewScrollPos
.notPlayerToNewScrollPos
jsr screenFullOfLevel
lda #$00
sta screenFixed
; enable or disable layer
.layerNumber
lda #$44
cmp #$ff
beq .nolayerenable
and #$7f
sec
sbc #$01
ldx .layerNumber + 1
bmi .deactivate
jsr activateLayer
jmp .nolayerenable
.deactivate
jsr deactivateLayer
.nolayerenable
.switchlayerNumber
lda #$44
and #$3f
beq .noswitchlayer
sec
sbc #$01
jsr switchLayer
.noswitchlayer
; gamelogikreset
frameCounterAdjust ;(ATTENTION THIS JSRT FROM THE PAUSE SCREEN and elsewhere, TO)
lda frameCounter + 0
sta lastFrameCounterGameLogik + 0
lda frameCounter + 1
sta lastFrameCounterGameLogik + 1
rts
SUBROUTINE
;----------------------------------------------------------------------
; waits for a click of the joystick
;----------------------------------------------------------------------
joyButtonClick
.waitTillButtonReleased1
jsr gatherJoystick
lda joyPressed
bne .waitTillButtonReleased1
.waitTillButtonPressed
jsr gatherJoystick
lda joyPressed
beq .waitTillButtonPressed
.waitTillButtonReleased2
jsr gatherJoystick
lda joyPressed
bne .waitTillButtonReleased2
lda #SOUND_COLLECTED
jsr triggerSound
rts
SUBROUTINE
;----------------------------------------------------------------------
; blits the text for the given screen number
;----------------------------------------------------------------------
blitScreenText
ldy #$03
lda (ZP_TEXTSCREENREAD),y
sta ZP_Y_LENGTH
lsr
eor #$ff
clc
adc #13
tay
lda #<[$1c00+5]
clc
adc MUL40LO,y
sta ZP_SCREENBLITWRITE + 0
lda #>[$1c00+5]
adc MUL40HI,y
sta ZP_SCREENBLITWRITE + 1
lda ZP_TEXTSCREENREAD + 0
clc
adc #$04
sta ZP_BYTE + 0
lda ZP_TEXTSCREENREAD + 1
adc #$00
sta ZP_BYTE + 1
.nexty
ldy #29
.nextx
lda (ZP_BYTE),y
bpl .yodo
jsr specialChar
.yodo
sta (ZP_SCREENBLITWRITE),y
dey
bpl .nextx
lda ZP_BYTE + 0
clc
adc #<30
sta ZP_BYTE + 0
lda ZP_BYTE + 1
adc #>30
sta ZP_BYTE + 1
lda ZP_SCREENBLITWRITE + 0
clc
adc #<40
sta ZP_SCREENBLITWRITE + 0
lda ZP_SCREENBLITWRITE + 1
adc #>40
sta ZP_SCREENBLITWRITE + 1
dec ZP_Y_LENGTH
bne .nexty
rts
SUBROUTINE
specialChar
stx .xrestore + 1
ldx textScreenNumber
cpx #TEXTSCREEN_LIVELOST
bne .notlivelost
lda ZP_LIVES
clc
adc #NUMBERSSTARTINFONT
.notlivelost
.xrestore
ldx #$44
rts
SUBROUTINE
ZORDANX = 6
;----------------------------------------------------------------------
; draws the zordan sprite
;----------------------------------------------------------------------
drawZordan
lda #SCREENS_COLOR3
clearZordan
sta .col3 + 1
ldy #$03
lda (ZP_TEXTSCREENREAD),y
lsr
eor #$ff
clc
adc #13-5
tay
lda #<[$1c00+ZORDANX]
clc
adc MUL40LO,y
sta ZP_SCREENBLITWRITE + 0
sta ZP_BYTE + 0
lda #>[$1c00+ZORDANX]
adc MUL40HI,y
sta ZP_SCREENBLITWRITE + 1
sec
sbc #$04
sta ZP_BYTE + 1
lda #139+95
sta .nextx + 1
ldy #$00
lda #$04
sta ZP_Y_LENGTH
.nexty
ldx #04
.nextx
lda #$44
sta (ZP_SCREENBLITWRITE),y
.col3
lda #SCREENS_COLOR3
sta (ZP_BYTE),y
inc .nextx + 1
iny
dex
bne .nextx
tya
clc
adc #40-4
tay
dec ZP_Y_LENGTH
bne .nexty
rts
SUBROUTINE
;----------------------------------------------------------------------
; sets the textcolor of the screen (in accu)
;----------------------------------------------------------------------
colorizeScreen
pha
ldy #$03
lda (ZP_TEXTSCREENREAD),y
sta ZP_Y_LENGTH
lsr
eor #$ff
clc
adc #13
tay
lda #<[$1800+5]
clc
adc MUL40LO,y
sta ZP_SCREENBLITWRITE + 0
lda #>[$1800+5]
adc MUL40HI,y
sta ZP_SCREENBLITWRITE + 1
.nexty
ldy #29
pla
pha
.nextx
sta (ZP_SCREENBLITWRITE),y
dey
bpl .nextx
lda ZP_SCREENBLITWRITE + 0
clc
adc #<40
sta ZP_SCREENBLITWRITE + 0
lda ZP_SCREENBLITWRITE + 1
adc #>40
sta ZP_SCREENBLITWRITE + 1
dec ZP_Y_LENGTH
bne .nexty
pla
rts
SUBROUTINE
;----------------------------------------------------------------------
; fills the screen with the level on this location
;----------------------------------------------------------------------
screenFullOfLevel
lda scrollPosXDiv4
sta rectLevelXS
clc
adc #40
sta rectLevelXE
lda scrollPosYDiv8
sta rectLevelYS
clc
adc #25
sta rectLevelYE
jmp redrawPortion
SUBROUTINE
;----------------------------------------------------------------------
; redraws the given rectangle
;----------------------------------------------------------------------
.tempTest1 dc.b $00
.tempTest2 dc.b $00
redrawPortion
txa
pha
tya
pha
lda BITMAPSCREENHI
pha
lda currentScreenBuffer1 + 1
pha
lda #$01
sta stoneOutsideScreen
lda scrollPosXDiv4
lsr
lsr
sta .tempTest1
clc
adc #40/4 + 1
sta .tempTest2
lda stoneXPos
cmp .tempTest1
bcc .nowait
cmp .tempTest2
bcs .nowait
lda scrollPosYDiv8
lsr
lsr
sta .tempTest1
clc
adc #25/4 + 1
sta .tempTest2
lda stoneYPos
cmp .tempTest1
bcc .nowait
cmp .tempTest2
bcs .nowait
lda #$00
sta stoneOutsideScreen
jsr waitUntilBorder
.nowait
lda #>$2000
sta BITMAPSCREENHI
lda #>$6000
sta currentScreenBuffer1 + 1
jsr restoreRectColor
jsr restoreRect
lda #>$4000
sta BITMAPSCREENHI
lda #>$1800
sta currentScreenBuffer1 + 1
jsr restoreRectColor
jsr restoreRect
pla
sta currentScreenBuffer1 + 1
pla
sta BITMAPSCREENHI
pla
tay
pla
tax
rts
waitForScrollDone SUBROUTINE
.wait
lda updateDoubleBuffer
bne .wait
rts | kosmonautdnb/TheLandsOfZador | ScrollModus/_code/GlobalCode/screens.asm | Assembly | mit | 8,510 |
; ****************************************************************************************************************
; ****************************************************************************************************************
;
; Minol ROM Image
;
; ****************************************************************************************************************
; ****************************************************************************************************************
cpu sc/mp
include source\memorymacros.asm ; Memory allocation and Macro definition.
include source\errors.asm ; Error codes
; ****************************************************************************************************************
; Main Program
; ****************************************************************************************************************
org 0x9000 ; the ROM starts here
db 0x68 ; this makes it boot straight into this ROM.
lpi p2,0xFFF ; set up top stack value
FindTOS:
ldi 0x75 ; can we write there, if so, found TOS.
st (p2)
xor (p2)
jz StackFound
ld -64(p2) ; wind backwards 64 bytes
jmp FindTOS
StackFound:
; include democode.asm
StartUp:
lpi p3,Print-1 ; Print Boot Message
lpi p1,BootMessage
ldi 0
xppc p3
lpi p3,ProgramBase ; check to see if MINOL code resident.
ld -4(p3) ; which requires the 4 byte markers to be loaded.
xri Marker1
jnz RunNew
ld -3(p3)
xri Marker2
jnz RunNew
ld -2(p3)
xri Marker3
jnz RunNew
ld -1(p3)
xri Marker4
jnz RunNew
lpi p3,ConsoleStart-1 ; run the console if code present
scl ; non-error (so it prints ok)
xppc p3
RunNew: ; otherwise execute NEW.
lpi p3,CMD_New-1
xppc p3
BootMessage:
db 12,"** MINOL **",13,"V0.94 PSR 2016",13,0
; ****************************************************************************************************************
; Source Files
; ****************************************************************************************************************
include source\itoa.asm ; print integer routine.
include source\atoi.asm ; decode integer routine.
include source\execute.asm ; statement exec main loop
include source\manager.asm ; manage program lines.
include source\console.asm ; console type in etc.
| paulscottrobson/wallpaper-one | software/minol/minol.asm | Assembly | mit | 2,512 |
INCLUDE "hardware.inc"
INCLUDE "header.inc"
SECTION "Main",HOME
;--------------------------------------------------------------------------
;- Main() -
;--------------------------------------------------------------------------
Main:
; -------------------------------------------------------
ld a,$0A
ld [$0000],a ; enable ram
ld a,LCDCF_ON
ld [rLCDC],a
ld hl,$A000
; -------------------------------------------------------
ld b,10
call wait_ly
DMA_COPY $0100,$8000,32,1
ld b,11
call wait_ly
ld a, ( $0140 >> 8 )& $FF
ld [rHDMA1],a
ld a, $0140 & $F0 ; Lower 4 bits ignored
ld [rHDMA2],a
ld b,10
call wait_ly
DMA_COPY $0100,$8020,32,1
ld b,11
call wait_ly
ld a, ( $8040 >> 8 )& $1F ; Upper 3 bits ignored
ld [rHDMA3],a
ld a, $8040 & $F0 ; Lower 4 bits ignored
ld [rHDMA4],a
ld b,144
call wait_ly
ld bc,$50
ld hl,$8000
ld de,$A000
call memcopy
ld h,d ; get ending ptr
ld l,e
; -------------------------------------------------------
push hl ; magic number
ld [hl],$12
inc hl
ld [hl],$34
inc hl
ld [hl],$56
inc hl
ld [hl],$78
pop hl
; -------------------------------------------------------
ld a,$00
ld [$0000],a ; disable ram
.endloop:
halt
jr .endloop
| AntonioND/gbc-hw-tests | dma/hdma_modify_address/main.asm | Assembly | mit | 1,312 |
__ABS32:
bit 7, d
ret z
__NEG32: ; Negates DEHL (Two's complement)
ld a, l
cpl
ld l, a
ld a, h
cpl
ld h, a
ld a, e
cpl
ld e, a
ld a, d
cpl
ld d, a
inc l
ret nz
inc h
ret nz
inc de
ret
| haroldo-ok/really-old-stuff | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/neg32.asm | Assembly | apache-2.0 | 213 |
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; kernel.asm
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Forrest Yu, 2005
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%include "sconst.inc"
; 导入函数
extern cstart
extern kernel_main
extern exception_handler
extern spurious_irq
; 导入全局变量
extern gdt_ptr
extern idt_ptr
extern p_proc_ready
extern tss
extern disp_pos
bits 32
[SECTION .bss]
StackSpace resb 2 * 1024
StackTop: ; 栈顶
[section .text] ; 代码在此
global _start ; 导出 _start
global restart
global divide_error
global single_step_exception
global nmi
global breakpoint_exception
global overflow
global bounds_check
global inval_opcode
global copr_not_available
global double_fault
global copr_seg_overrun
global inval_tss
global segment_not_present
global stack_exception
global general_protection
global page_fault
global copr_error
global hwint00
global hwint01
global hwint02
global hwint03
global hwint04
global hwint05
global hwint06
global hwint07
global hwint08
global hwint09
global hwint10
global hwint11
global hwint12
global hwint13
global hwint14
global hwint15
_start:
; 此时内存看上去是这样的(更详细的内存情况在 LOADER.ASM 中有说明):
; ┃ ┃
; ┃ ... ┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■Page Tables■■■■■■┃
; ┃■■■■■(大小由LOADER决定)■■■■┃ PageTblBase
; 00101000h ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■Page Directory Table■■■■┃ PageDirBase = 1M
; 00100000h ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□ Hardware Reserved □□□□┃ B8000h ← gs
; 9FC00h ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■LOADER.BIN■■■■■■┃ somewhere in LOADER ← esp
; 90000h ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■KERNEL.BIN■■■■■■┃
; 80000h ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■KERNEL■■■■■■■┃ 30400h ← KERNEL 入口 (KernelEntryPointPhyAddr)
; 30000h ┣━━━━━━━━━━━━━━━━━━┫
; ┋ ... ┋
; ┋ ┋
; 0h ┗━━━━━━━━━━━━━━━━━━┛ ← cs, ds, es, fs, ss
;
;
; GDT 以及相应的描述符是这样的:
;
; Descriptors Selectors
; ┏━━━━━━━━━━━━━━━━━━┓
; ┃ Dummy Descriptor ┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃ DESC_FLAT_C (0~4G) ┃ 8h = cs
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃ DESC_FLAT_RW (0~4G) ┃ 10h = ds, es, fs, ss
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃ DESC_VIDEO ┃ 1Bh = gs
; ┗━━━━━━━━━━━━━━━━━━┛
;
; 注意! 在使用 C 代码的时候一定要保证 ds, es, ss 这几个段寄存器的值是一样的
; 因为编译器有可能编译出使用它们的代码, 而编译器默认它们是一样的. 比如串拷贝操作会用到 ds 和 es.
;
;
; 把 esp 从 LOADER 挪到 KERNEL
mov esp, StackTop ; 堆栈在 bss 段中
mov dword [disp_pos], 0
sgdt [gdt_ptr] ; cstart() 中将会用到 gdt_ptr
call cstart ; 在此函数中改变了gdt_ptr,让它指向新的GDT
lgdt [gdt_ptr] ; 使用新的GDT
lidt [idt_ptr]
jmp SELECTOR_KERNEL_CS:csinit
csinit: ; “这个跳转指令强制使用刚刚初始化的结构”——<<OS:D&I 2nd>> P90.
;jmp 0x40:0
;ud2
xor eax, eax
mov ax, SELECTOR_TSS
ltr ax
;sti
jmp kernel_main
;hlt
; 中断和异常 -- 硬件中断
; ---------------------------------
%macro hwint_master 1
push %1
call spurious_irq
add esp, 4
hlt
%endmacro
ALIGN 16
hwint00: ; Interrupt routine for irq 0 (the clock).
inc byte [gs:0] ; 改变屏幕第 0 行, 第 0 列的字符
mov al, EOI ; `. reenable
out INT_M_CTL, al ; / master 8259
iretd
ALIGN 16
hwint01: ; Interrupt routine for irq 1 (keyboard)
hwint_master 1
ALIGN 16
hwint02: ; Interrupt routine for irq 2 (cascade!)
hwint_master 2
ALIGN 16
hwint03: ; Interrupt routine for irq 3 (second serial)
hwint_master 3
ALIGN 16
hwint04: ; Interrupt routine for irq 4 (first serial)
hwint_master 4
ALIGN 16
hwint05: ; Interrupt routine for irq 5 (XT winchester)
hwint_master 5
ALIGN 16
hwint06: ; Interrupt routine for irq 6 (floppy)
hwint_master 6
ALIGN 16
hwint07: ; Interrupt routine for irq 7 (printer)
hwint_master 7
; ---------------------------------
%macro hwint_slave 1
push %1
call spurious_irq
add esp, 4
hlt
%endmacro
; ---------------------------------
ALIGN 16
hwint08: ; Interrupt routine for irq 8 (realtime clock).
hwint_slave 8
ALIGN 16
hwint09: ; Interrupt routine for irq 9 (irq 2 redirected)
hwint_slave 9
ALIGN 16
hwint10: ; Interrupt routine for irq 10
hwint_slave 10
ALIGN 16
hwint11: ; Interrupt routine for irq 11
hwint_slave 11
ALIGN 16
hwint12: ; Interrupt routine for irq 12
hwint_slave 12
ALIGN 16
hwint13: ; Interrupt routine for irq 13 (FPU exception)
hwint_slave 13
ALIGN 16
hwint14: ; Interrupt routine for irq 14 (AT winchester)
hwint_slave 14
ALIGN 16
hwint15: ; Interrupt routine for irq 15
hwint_slave 15
; 中断和异常 -- 异常
divide_error:
push 0xFFFFFFFF ; no err code
push 0 ; vector_no = 0
jmp exception
single_step_exception:
push 0xFFFFFFFF ; no err code
push 1 ; vector_no = 1
jmp exception
nmi:
push 0xFFFFFFFF ; no err code
push 2 ; vector_no = 2
jmp exception
breakpoint_exception:
push 0xFFFFFFFF ; no err code
push 3 ; vector_no = 3
jmp exception
overflow:
push 0xFFFFFFFF ; no err code
push 4 ; vector_no = 4
jmp exception
bounds_check:
push 0xFFFFFFFF ; no err code
push 5 ; vector_no = 5
jmp exception
inval_opcode:
push 0xFFFFFFFF ; no err code
push 6 ; vector_no = 6
jmp exception
copr_not_available:
push 0xFFFFFFFF ; no err code
push 7 ; vector_no = 7
jmp exception
double_fault:
push 8 ; vector_no = 8
jmp exception
copr_seg_overrun:
push 0xFFFFFFFF ; no err code
push 9 ; vector_no = 9
jmp exception
inval_tss:
push 10 ; vector_no = A
jmp exception
segment_not_present:
push 11 ; vector_no = B
jmp exception
stack_exception:
push 12 ; vector_no = C
jmp exception
general_protection:
push 13 ; vector_no = D
jmp exception
page_fault:
push 14 ; vector_no = E
jmp exception
copr_error:
push 0xFFFFFFFF ; no err code
push 16 ; vector_no = 10h
jmp exception
exception:
call exception_handler
add esp, 4*2 ; 让栈顶指向 EIP,堆栈中从顶向下依次是:EIP、CS、EFLAGS
hlt
; ====================================================================================
; restart
; ====================================================================================
restart:
mov esp, [p_proc_ready]
lldt [esp + P_LDT_SEL]
lea eax, [esp + P_STACKTOP]
mov dword [tss + TSS3_S_SP0], eax
pop gs
pop fs
pop es
pop ds
popad
add esp, 4
iretd
| RongbinZhuang/simpleOS | ver0/reference/chapter6/b/kernel/kernel2.asm | Assembly | mit | 7,832 |
struc IDTEntry
.offsetl resw 1
.selector resw 1
.zero resb 1
.attribute resb 1
.present equ 1 << 7
.ring1 equ 1 << 5
.ring2 equ 1 << 6
.ring3 equ 1 << 5 | 1 << 6
.task32 equ 0x5
.interrupt16 equ 0x6
.trap16 equ 0x7
.interrupt32 equ 0xE
.trap32 equ 0xF
.offseth resw 1
endstruc
[section .text]
[BITS 32]
interrupts:
.first:
mov [0x100000], byte 0
jmp dword .handle
.second:
%assign i 1
%rep 255
mov [0x100000], byte i
jmp dword .handle
%assign i i+1
%endrep
.handle:
push ebp
push esi
push edi
push edx
push ecx
push ebx
push eax
push esp
push dword [0x100000]
mov eax, gdt.kernel_data
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
call [.handler]
add esp, 8 ;Skip interrupt and reg pointer
mov eax, gdt.user_data | 3 ;[esp + 44] ;Use new SS as DS
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
pop eax
pop ebx
pop ecx
pop edx
pop edi
pop esi
pop ebp
iretd
.handler: dd 0
idtr:
dw (idt_end - idt) + 1
dd idt
idt:
%assign i 0
;Below system call
%rep 128
istruc IDTEntry
at IDTEntry.offsetl, dw interrupts+(interrupts.second-interrupts.first)*i
at IDTEntry.selector, dw gdt.kernel_code
at IDTEntry.zero, db 0
at IDTEntry.attribute, db IDTEntry.present | IDTEntry.interrupt32
at IDTEntry.offseth, dw 0
iend
%assign i i+1
%endrep
;System call
istruc IDTEntry
at IDTEntry.offsetl, dw interrupts+(interrupts.second-interrupts.first)*i
at IDTEntry.selector, dw gdt.kernel_code
at IDTEntry.zero, db 0
at IDTEntry.attribute, db IDTEntry.ring3 | IDTEntry.present | IDTEntry.interrupt32
at IDTEntry.offseth, dw 0
iend
%assign i i+1
;Above system call
%rep 127
istruc IDTEntry
at IDTEntry.offsetl, dw interrupts+(interrupts.second-interrupts.first)*i
at IDTEntry.selector, dw gdt.kernel_code
at IDTEntry.zero, db 0
at IDTEntry.attribute, db IDTEntry.present | IDTEntry.interrupt32
at IDTEntry.offseth, dw 0
iend
%assign i i+1
%endrep
idt_end:
| stryan/redox | kernel/asm/interrupts-i386.asm | Assembly | mit | 2,137 |
;******************************************************************************
;* VP9 loop filter SIMD optimizations
;*
;* Copyright (C) 2013-2014 Clément Bœsch <u pkh me>
;*
;* 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"
%if ARCH_X86_64
SECTION_RODATA
cextern pb_3
cextern pb_80
pb_4: times 16 db 0x04
pb_10: times 16 db 0x10
pb_40: times 16 db 0x40
pb_81: times 16 db 0x81
pb_f8: times 16 db 0xf8
pb_fe: times 16 db 0xfe
cextern pw_4
cextern pw_8
; with mix functions, two 8-bit thresholds are stored in a 16-bit storage,
; the following mask is used to splat both in the same register
mask_mix: times 8 db 0
times 8 db 1
mask_mix84: times 8 db 0xff
times 8 db 0x00
mask_mix48: times 8 db 0x00
times 8 db 0xff
SECTION .text
; %1 = abs(%2-%3)
%macro ABSSUB 4 ; dst, src1 (RO), src2 (RO), tmp
psubusb %1, %3, %2
psubusb %4, %2, %3
por %1, %4
%endmacro
; %1 = %1<=%2
%macro CMP_LTE 3-4 ; src/dst, cmp, tmp, pb_80
%if %0 == 4
pxor %1, %4
%endif
pcmpgtb %3, %2, %1 ; cmp > src?
pcmpeqb %1, %2 ; cmp == src? XXX: avoid this with a -1/+1 well placed?
por %1, %3 ; cmp >= src?
%endmacro
; %1 = abs(%2-%3) <= %4
%macro ABSSUB_CMP 6-7 [pb_80]; dst, src1, src2, cmp, tmp1, tmp2, [pb_80]
ABSSUB %1, %2, %3, %6 ; dst = abs(src1-src2)
CMP_LTE %1, %4, %6, %7 ; dst <= cmp
%endmacro
%macro MASK_APPLY 4 ; %1=new_data/dst %2=old_data %3=mask %4=tmp
pand %1, %3 ; new &= mask
pandn %4, %3, %2 ; tmp = ~mask & old
por %1, %4 ; new&mask | old&~mask
%endmacro
%macro FILTER_SUBx2_ADDx2 8 ; %1=dst %2=h/l %3=cache %4=sub1 %5=sub2 %6=add1 %7=add2 %8=rshift
punpck%2bw %3, %4, m0
psubw %1, %3
punpck%2bw %3, %5, m0
psubw %1, %3
punpck%2bw %3, %6, m0
paddw %1, %3
punpck%2bw %3, %7, m0
paddw %3, %1
psraw %1, %3, %8
%endmacro
%macro FILTER_INIT 8 ; tmp1, tmp2, cacheL, cacheH, dstp, filterid, mask, source
FILTER%6_INIT %1, l, %3
FILTER%6_INIT %2, h, %4
packuswb %1, %2
MASK_APPLY %1, %8, %7, %2
mova %5, %1
%endmacro
%macro FILTER_UPDATE 11-14 ; tmp1, tmp2, cacheL, cacheH, dstp, -, -, +, +, rshift, mask, [source], [preload reg + value]
%if %0 == 13 ; no source + preload
mova %12, %13
%elif %0 == 14 ; source + preload
mova %13, %14
%endif
FILTER_SUBx2_ADDx2 %1, l, %3, %6, %7, %8, %9, %10
FILTER_SUBx2_ADDx2 %2, h, %4, %6, %7, %8, %9, %10
packuswb %1, %2
%if %0 == 12 || %0 == 14
MASK_APPLY %1, %12, %11, %2
%else
MASK_APPLY %1, %5, %11, %2
%endif
mova %5, %1
%endmacro
%macro SRSHIFT3B_2X 4 ; reg1, reg2, [pb_10], tmp
mova %4, [pb_f8]
pand %1, %4
pand %2, %4
psrlq %1, 3
psrlq %2, 3
pxor %1, %3
pxor %2, %3
psubb %1, %3
psubb %2, %3
%endmacro
%macro EXTRACT_POS_NEG 3 ; i8, neg, pos
pxor %3, %3
pxor %2, %2
pcmpgtb %3, %1 ; i8 < 0 mask
psubb %2, %1 ; neg values (only the originally - will be kept)
pand %2, %3 ; negative values of i8 (but stored as +)
pandn %3, %1 ; positive values of i8
%endmacro
; clip_u8(u8 + i8)
%macro SIGN_ADD 5 ; dst, u8, i8, tmp1, tmp2
EXTRACT_POS_NEG %3, %4, %5
psubusb %1, %2, %4 ; sub the negatives
paddusb %1, %5 ; add the positives
%endmacro
; clip_u8(u8 - i8)
%macro SIGN_SUB 5 ; dst, u8, i8, tmp1, tmp2
EXTRACT_POS_NEG %3, %4, %5
psubusb %1, %2, %5 ; sub the positives
paddusb %1, %4 ; add the negatives
%endmacro
%macro FILTER6_INIT 3 ; %1=dst %2=h/l %3=cache
punpck%2bw %1, m14, m0 ; p3: B->W
paddw %3, %1, %1 ; p3*2
paddw %3, %1 ; p3*3
punpck%2bw %1, m15, m0 ; p2: B->W
paddw %3, %1 ; p3*3 + p2
paddw %3, %1 ; p3*3 + p2*2
punpck%2bw %1, m10, m0 ; p1: B->W
paddw %3, %1 ; p3*3 + p2*2 + p1
punpck%2bw %1, m11, m0 ; p0: B->W
paddw %3, %1 ; p3*3 + p2*2 + p1 + p0
punpck%2bw %1, m12, m0 ; q0: B->W
paddw %3, %1 ; p3*3 + p2*2 + p1 + p0 + q0
paddw %3, [pw_4] ; p3*3 + p2*2 + p1 + p0 + q0 + 4
psraw %1, %3, 3 ; (p3*3 + p2*2 + p1 + p0 + q0 + 4) >> 3
%endmacro
%macro FILTER14_INIT 3 ; %1=dst %2=h/l %3=cache
punpck%2bw %1, m2, m0 ; p7: B->W
psllw %3, %1, 3 ; p7*8
psubw %3, %1 ; p7*7
punpck%2bw %1, m3, m0 ; p6: B->W
paddw %3, %1 ; p7*7 + p6
paddw %3, %1 ; p7*7 + p6*2
punpck%2bw %1, m8, m0 ; p5: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5
punpck%2bw %1, m9, m0 ; p4: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + p4
punpck%2bw %1, m14, m0 ; p3: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + p4 + p3
punpck%2bw %1, m15, m0 ; p2: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p2
punpck%2bw %1, m10, m0 ; p1: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p1
punpck%2bw %1, m11, m0 ; p0: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p0
punpck%2bw %1, m12, m0 ; q0: B->W
paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p0 + q0
paddw %3, [pw_8] ; p7*7 + p6*2 + p5 + .. + p0 + q0 + 8
psraw %1, %3, 4 ; (p7*7 + p6*2 + p5 + .. + p0 + q0 + 8) >> 4
%endmacro
%macro TRANSPOSE16x16B 17
mova %17, m%16
SBUTTERFLY bw, %1, %2, %16
SBUTTERFLY bw, %3, %4, %16
SBUTTERFLY bw, %5, %6, %16
SBUTTERFLY bw, %7, %8, %16
SBUTTERFLY bw, %9, %10, %16
SBUTTERFLY bw, %11, %12, %16
SBUTTERFLY bw, %13, %14, %16
mova m%16, %17
mova %17, m%14
SBUTTERFLY bw, %15, %16, %14
SBUTTERFLY wd, %1, %3, %14
SBUTTERFLY wd, %2, %4, %14
SBUTTERFLY wd, %5, %7, %14
SBUTTERFLY wd, %6, %8, %14
SBUTTERFLY wd, %9, %11, %14
SBUTTERFLY wd, %10, %12, %14
SBUTTERFLY wd, %13, %15, %14
mova m%14, %17
mova %17, m%12
SBUTTERFLY wd, %14, %16, %12
SBUTTERFLY dq, %1, %5, %12
SBUTTERFLY dq, %2, %6, %12
SBUTTERFLY dq, %3, %7, %12
SBUTTERFLY dq, %4, %8, %12
SBUTTERFLY dq, %9, %13, %12
SBUTTERFLY dq, %10, %14, %12
SBUTTERFLY dq, %11, %15, %12
mova m%12, %17
mova %17, m%8
SBUTTERFLY dq, %12, %16, %8
SBUTTERFLY qdq, %1, %9, %8
SBUTTERFLY qdq, %2, %10, %8
SBUTTERFLY qdq, %3, %11, %8
SBUTTERFLY qdq, %4, %12, %8
SBUTTERFLY qdq, %5, %13, %8
SBUTTERFLY qdq, %6, %14, %8
SBUTTERFLY qdq, %7, %15, %8
mova m%8, %17
mova %17, m%1
SBUTTERFLY qdq, %8, %16, %1
mova m%1, %17
SWAP %2, %9
SWAP %3, %5
SWAP %4, %13
SWAP %6, %11
SWAP %8, %15
SWAP %12, %14
%endmacro
; transpose 16 half lines (high part) to 8 full centered lines
%macro TRANSPOSE16x8B 16
punpcklbw m%1, m%2
punpcklbw m%3, m%4
punpcklbw m%5, m%6
punpcklbw m%7, m%8
punpcklbw m%9, m%10
punpcklbw m%11, m%12
punpcklbw m%13, m%14
punpcklbw m%15, m%16
SBUTTERFLY wd, %1, %3, %2
SBUTTERFLY wd, %5, %7, %2
SBUTTERFLY wd, %9, %11, %2
SBUTTERFLY wd, %13, %15, %2
SBUTTERFLY dq, %1, %5, %2
SBUTTERFLY dq, %3, %7, %2
SBUTTERFLY dq, %9, %13, %2
SBUTTERFLY dq, %11, %15, %2
SBUTTERFLY qdq, %1, %9, %2
SBUTTERFLY qdq, %3, %11, %2
SBUTTERFLY qdq, %5, %13, %2
SBUTTERFLY qdq, %7, %15, %2
SWAP %5, %1
SWAP %6, %9
SWAP %7, %1
SWAP %8, %13
SWAP %9, %3
SWAP %10, %11
SWAP %11, %1
SWAP %12, %15
%endmacro
%macro DEFINE_REAL_P7_TO_Q7 0-1 0
%define P7 dst1q + 2*mstrideq + %1
%define P6 dst1q + mstrideq + %1
%define P5 dst1q + %1
%define P4 dst1q + strideq + %1
%define P3 dstq + 4*mstrideq + %1
%define P2 dstq + mstride3q + %1
%define P1 dstq + 2*mstrideq + %1
%define P0 dstq + mstrideq + %1
%define Q0 dstq + %1
%define Q1 dstq + strideq + %1
%define Q2 dstq + 2*strideq + %1
%define Q3 dstq + stride3q + %1
%define Q4 dstq + 4*strideq + %1
%define Q5 dst2q + mstrideq + %1
%define Q6 dst2q + %1
%define Q7 dst2q + strideq + %1
%endmacro
; ..............AB -> AAAAAAAABBBBBBBB
%macro SPLATB_MIX 1-2 [mask_mix]
%if cpuflag(ssse3)
pshufb %1, %2
%else
punpcklbw %1, %1
punpcklwd %1, %1
punpckldq %1, %1
%endif
%endmacro
%macro LOOPFILTER 2 ; %1=v/h %2=size1
lea mstrideq, [strideq]
neg mstrideq
lea stride3q, [strideq+2*strideq]
mov mstride3q, stride3q
neg mstride3q
%ifidn %1, h
%if %2 > 16
%define movx movh
lea dstq, [dstq + 8*strideq - 4]
%else
%define movx movu
lea dstq, [dstq + 8*strideq - 8] ; go from top center (h pos) to center left (v pos)
%endif
%endif
lea dst1q, [dstq + 2*mstride3q] ; dst1q = &dst[stride * -6]
lea dst2q, [dstq + 2* stride3q] ; dst2q = &dst[stride * +6]
DEFINE_REAL_P7_TO_Q7
%ifidn %1, h
movx m0, [P7]
movx m1, [P6]
movx m2, [P5]
movx m3, [P4]
movx m4, [P3]
movx m5, [P2]
movx m6, [P1]
movx m7, [P0]
movx m8, [Q0]
movx m9, [Q1]
movx m10, [Q2]
movx m11, [Q3]
movx m12, [Q4]
movx m13, [Q5]
movx m14, [Q6]
movx m15, [Q7]
%define P7 rsp + 0
%define P6 rsp + 16
%define P5 rsp + 32
%define P4 rsp + 48
%define P3 rsp + 64
%define P2 rsp + 80
%define P1 rsp + 96
%define P0 rsp + 112
%define Q0 rsp + 128
%define Q1 rsp + 144
%define Q2 rsp + 160
%define Q3 rsp + 176
%define Q4 rsp + 192
%define Q5 rsp + 208
%define Q6 rsp + 224
%define Q7 rsp + 240
%if %2 == 16
TRANSPOSE16x16B 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, [rsp]
mova [P7], m0
mova [P6], m1
mova [P5], m2
mova [P4], m3
%else
TRANSPOSE16x8B 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
%endif
mova [P3], m4
mova [P2], m5
mova [P1], m6
mova [P0], m7
mova [Q0], m8
mova [Q1], m9
mova [Q2], m10
mova [Q3], m11
%if %2 == 16
mova [Q4], m12
mova [Q5], m13
mova [Q6], m14
mova [Q7], m15
%endif
%endif
; calc fm mask
%if %2 == 16
%if cpuflag(ssse3)
pxor m0, m0
%endif
SPLATB_REG m2, I, m0 ; I I I I ...
SPLATB_REG m3, E, m0 ; E E E E ...
%else
%if cpuflag(ssse3)
mova m0, [mask_mix]
%endif
movd m2, Id
movd m3, Ed
SPLATB_MIX m2, m0
SPLATB_MIX m3, m0
%endif
mova m0, [pb_80]
pxor m2, m0
pxor m3, m0
%ifidn %1, v
mova m8, [P3]
mova m9, [P2]
mova m10, [P1]
mova m11, [P0]
mova m12, [Q0]
mova m13, [Q1]
mova m14, [Q2]
mova m15, [Q3]
%else
; In case of horizontal, P3..Q3 are already present in some registers due
; to the previous transpose, so we just swap registers.
SWAP 8, 4, 12
SWAP 9, 5, 13
SWAP 10, 6, 14
SWAP 11, 7, 15
%endif
ABSSUB_CMP m5, m8, m9, m2, m6, m7, m0 ; m5 = abs(p3-p2) <= I
ABSSUB_CMP m1, m9, m10, m2, m6, m7, m0 ; m1 = abs(p2-p1) <= I
pand m5, m1
ABSSUB_CMP m1, m10, m11, m2, m6, m7, m0 ; m1 = abs(p1-p0) <= I
pand m5, m1
ABSSUB_CMP m1, m12, m13, m2, m6, m7, m0 ; m1 = abs(q1-q0) <= I
pand m5, m1
ABSSUB_CMP m1, m13, m14, m2, m6, m7, m0 ; m1 = abs(q2-q1) <= I
pand m5, m1
ABSSUB_CMP m1, m14, m15, m2, m6, m7, m0 ; m1 = abs(q3-q2) <= I
pand m5, m1
ABSSUB m1, m11, m12, m7 ; abs(p0-q0)
paddusb m1, m1 ; abs(p0-q0) * 2
ABSSUB m2, m10, m13, m7 ; abs(p1-q1)
pand m2, [pb_fe] ; drop lsb so shift can work
psrlq m2, 1 ; abs(p1-q1)/2
paddusb m1, m2 ; abs(p0-q0)*2 + abs(p1-q1)/2
pxor m1, m0
pcmpgtb m4, m3, m1 ; E > X?
pcmpeqb m3, m1 ; E == X?
por m3, m4 ; E >= X?
pand m3, m5 ; fm final value
; (m3: fm, m8..15: p3 p2 p1 p0 q0 q1 q2 q3)
; calc flat8in (if not 44_16) and hev masks
mova m6, [pb_81] ; [1 1 1 1 ...] ^ 0x80
%if %2 != 44
ABSSUB_CMP m2, m8, m11, m6, m4, m5 ; abs(p3 - p0) <= 1
mova m8, [pb_80]
ABSSUB_CMP m1, m9, m11, m6, m4, m5, m8 ; abs(p2 - p0) <= 1
pand m2, m1
ABSSUB m4, m10, m11, m5 ; abs(p1 - p0)
%if %2 == 16
%if cpuflag(ssse3)
pxor m0, m0
%endif
SPLATB_REG m7, H, m0 ; H H H H ...
%else
movd m7, Hd
SPLATB_MIX m7
%endif
pxor m7, m8
pxor m4, m8
pcmpgtb m0, m4, m7 ; abs(p1 - p0) > H (1/2 hev condition)
CMP_LTE m4, m6, m5 ; abs(p1 - p0) <= 1
pand m2, m4 ; (flat8in)
ABSSUB m4, m13, m12, m1 ; abs(q1 - q0)
pxor m4, m8
pcmpgtb m5, m4, m7 ; abs(q1 - q0) > H (2/2 hev condition)
por m0, m5 ; hev final value
CMP_LTE m4, m6, m5 ; abs(q1 - q0) <= 1
pand m2, m4 ; (flat8in)
ABSSUB_CMP m1, m14, m12, m6, m4, m5, m8 ; abs(q2 - q0) <= 1
pand m2, m1
ABSSUB_CMP m1, m15, m12, m6, m4, m5, m8 ; abs(q3 - q0) <= 1
pand m2, m1 ; flat8in final value
%if %2 == 84 || %2 == 48
pand m2, [mask_mix%2]
%endif
%else
mova m6, [pb_80]
movd m7, Hd
SPLATB_MIX m7
pxor m7, m6
ABSSUB m4, m10, m11, m1 ; abs(p1 - p0)
pxor m4, m6
pcmpgtb m0, m4, m7 ; abs(p1 - p0) > H (1/2 hev condition)
ABSSUB m4, m13, m12, m1 ; abs(q1 - q0)
pxor m4, m6
pcmpgtb m5, m4, m7 ; abs(q1 - q0) > H (2/2 hev condition)
por m0, m5 ; hev final value
%endif
%if %2 == 16
; (m0: hev, m2: flat8in, m3: fm, m6: pb_81, m9..15: p2 p1 p0 q0 q1 q2 q3)
; calc flat8out mask
mova m8, [P7]
mova m9, [P6]
ABSSUB_CMP m1, m8, m11, m6, m4, m5 ; abs(p7 - p0) <= 1
ABSSUB_CMP m7, m9, m11, m6, m4, m5 ; abs(p6 - p0) <= 1
pand m1, m7
mova m8, [P5]
mova m9, [P4]
ABSSUB_CMP m7, m8, m11, m6, m4, m5 ; abs(p5 - p0) <= 1
pand m1, m7
ABSSUB_CMP m7, m9, m11, m6, m4, m5 ; abs(p4 - p0) <= 1
pand m1, m7
mova m14, [Q4]
mova m15, [Q5]
ABSSUB_CMP m7, m14, m12, m6, m4, m5 ; abs(q4 - q0) <= 1
pand m1, m7
ABSSUB_CMP m7, m15, m12, m6, m4, m5 ; abs(q5 - q0) <= 1
pand m1, m7
mova m14, [Q6]
mova m15, [Q7]
ABSSUB_CMP m7, m14, m12, m6, m4, m5 ; abs(q4 - q0) <= 1
pand m1, m7
ABSSUB_CMP m7, m15, m12, m6, m4, m5 ; abs(q5 - q0) <= 1
pand m1, m7 ; flat8out final value
%endif
; if (fm) {
; if (out && in) filter_14()
; else if (in) filter_6()
; else if (hev) filter_2()
; else filter_4()
; }
;
; f14: fm & out & in
; f6: fm & ~f14 & in => fm & ~(out & in) & in => fm & ~out & in
; f2: fm & ~f14 & ~f6 & hev => fm & ~(out & in) & ~(~out & in) & hev => fm & ~in & hev
; f4: fm & ~f14 & ~f6 & ~f2 => fm & ~(out & in) & ~(~out & in) & ~(~in & hev) => fm & ~in & ~hev
; (m0: hev, [m1: flat8out], [m2: flat8in], m3: fm, m8..15: p5 p4 p1 p0 q0 q1 q6 q7)
; filter2()
%if %2 != 44
mova m6, [pb_80] ; already in m6 if 44_16
%endif
pxor m15, m12, m6 ; q0 ^ 0x80
pxor m14, m11, m6 ; p0 ^ 0x80
psubsb m15, m14 ; (signed) q0 - p0
pxor m4, m10, m6 ; p1 ^ 0x80
pxor m5, m13, m6 ; q1 ^ 0x80
psubsb m4, m5 ; (signed) p1 - q1
paddsb m4, m15 ; (q0 - p0) + (p1 - q1)
paddsb m4, m15 ; 2*(q0 - p0) + (p1 - q1)
paddsb m4, m15 ; 3*(q0 - p0) + (p1 - q1)
paddsb m6, m4, [pb_4] ; m6: f1 = clip(f + 4, 127)
paddsb m4, [pb_3] ; m4: f2 = clip(f + 3, 127)
mova m14, [pb_10] ; will be reused in filter4()
SRSHIFT3B_2X m6, m4, m14, m7 ; f1 and f2 sign byte shift by 3
SIGN_SUB m7, m12, m6, m5, m9 ; m7 = q0 - f1
SIGN_ADD m8, m11, m4, m5, m9 ; m8 = p0 + f2
%if %2 != 44
pandn m6, m2, m3 ; ~mask(in) & mask(fm)
pand m6, m0 ; (~mask(in) & mask(fm)) & mask(hev)
%else
pand m6, m3, m0
%endif
MASK_APPLY m7, m12, m6, m5 ; m7 = filter2(q0) & mask / we write it in filter4()
MASK_APPLY m8, m11, m6, m5 ; m8 = filter2(p0) & mask / we write it in filter4()
; (m0: hev, [m1: flat8out], [m2: flat8in], m3: fm, m7..m8: q0' p0', m10..13: p1 p0 q0 q1, m14: pb_10, m15: q0-p0)
; filter4()
mova m4, m15
paddsb m15, m4 ; 2 * (q0 - p0)
paddsb m15, m4 ; 3 * (q0 - p0)
paddsb m6, m15, [pb_4] ; m6: f1 = clip(f + 4, 127)
paddsb m15, [pb_3] ; m15: f2 = clip(f + 3, 127)
SRSHIFT3B_2X m6, m15, m14, m9 ; f1 and f2 sign byte shift by 3
%if %2 != 44
%define p0tmp m7
%define q0tmp m9
pandn m5, m2, m3 ; ~mask(in) & mask(fm)
pandn m0, m5 ; ~mask(hev) & (~mask(in) & mask(fm))
%else
%define p0tmp m1
%define q0tmp m2
pandn m0, m3
%endif
SIGN_SUB q0tmp, m12, m6, m4, m14 ; q0 - f1
MASK_APPLY q0tmp, m7, m0, m5 ; filter4(q0) & mask
mova [Q0], q0tmp
SIGN_ADD p0tmp, m11, m15, m4, m14 ; p0 + f2
MASK_APPLY p0tmp, m8, m0, m5 ; filter4(p0) & mask
mova [P0], p0tmp
paddb m6, [pb_80] ;
pxor m8, m8 ; f=(f1+1)>>1
pavgb m6, m8 ;
psubb m6, [pb_40] ;
SIGN_ADD m7, m10, m6, m8, m9 ; p1 + f
SIGN_SUB m4, m13, m6, m8, m9 ; q1 - f
MASK_APPLY m7, m10, m0, m14 ; m7 = filter4(p1)
MASK_APPLY m4, m13, m0, m14 ; m4 = filter4(q1)
mova [P1], m7
mova [Q1], m4
; ([m1: flat8out], m2: flat8in, m3: fm, m10..13: p1 p0 q0 q1)
; filter6()
%if %2 != 44
pxor m0, m0
%if %2 > 16
pand m3, m2
%else
pand m2, m3 ; mask(fm) & mask(in)
pandn m3, m1, m2 ; ~mask(out) & (mask(fm) & mask(in))
%endif
mova m14, [P3]
mova m15, [P2]
mova m8, [Q2]
mova m9, [Q3]
FILTER_INIT m4, m5, m6, m7, [P2], 6, m3, m15 ; [p2]
FILTER_UPDATE m6, m7, m4, m5, [P1], m14, m15, m10, m13, 3, m3 ; [p1] -p3 -p2 +p1 +q1
FILTER_UPDATE m4, m5, m6, m7, [P0], m14, m10, m11, m8, 3, m3 ; [p0] -p3 -p1 +p0 +q2
FILTER_UPDATE m6, m7, m4, m5, [Q0], m14, m11, m12, m9, 3, m3 ; [q0] -p3 -p0 +q0 +q3
FILTER_UPDATE m4, m5, m6, m7, [Q1], m15, m12, m13, m9, 3, m3 ; [q1] -p2 -q0 +q1 +q3
FILTER_UPDATE m6, m7, m4, m5, [Q2], m10, m13, m8, m9, 3, m3, m8 ; [q2] -p1 -q1 +q2 +q3
%endif
; (m0: 0, [m1: flat8out], m2: fm & flat8in, m8..15: q2 q3 p1 p0 q0 q1 p3 p2)
; filter14()
;
; m2 m3 m8 m9 m14 m15 m10 m11 m12 m13
;
; q2 q3 p3 p2 p1 p0 q0 q1
; p6 -7 p7 p6 p5 p4 . . . . .
; p5 -6 -p7 -p6 +p5 +q1 . . . .
; p4 -5 -p7 -p5 +p4 +q2 . . . q2
; p3 -4 -p7 -p4 +p3 +q3 . . . q3
; p2 -3 -p7 -p3 +p2 +q4 . . . q4
; p1 -2 -p7 -p2 +p1 +q5 . . . q5
; p0 -1 -p7 -p1 +p0 +q6 . . . q6
; q0 +0 -p7 -p0 +q0 +q7 . . . q7
; q1 +1 -p6 -q0 +q1 +q7 q1 . . .
; q2 +2 -p5 -q1 +q2 +q7 . q2 . .
; q3 +3 -p4 -q2 +q3 +q7 . q3 . .
; q4 +4 -p3 -q3 +q4 +q7 . q4 . .
; q5 +5 -p2 -q4 +q5 +q7 . q5 . .
; q6 +6 -p1 -q5 +q6 +q7 . q6 . .
%if %2 == 16
pand m1, m2 ; mask(out) & (mask(fm) & mask(in))
mova m2, [P7]
mova m3, [P6]
mova m8, [P5]
mova m9, [P4]
FILTER_INIT m4, m5, m6, m7, [P6], 14, m1, m3
FILTER_UPDATE m6, m7, m4, m5, [P5], m2, m3, m8, m13, 4, m1, m8 ; [p5] -p7 -p6 +p5 +q1
FILTER_UPDATE m4, m5, m6, m7, [P4], m2, m8, m9, m13, 4, m1, m9, m13, [Q2] ; [p4] -p7 -p5 +p4 +q2
FILTER_UPDATE m6, m7, m4, m5, [P3], m2, m9, m14, m13, 4, m1, m14, m13, [Q3] ; [p3] -p7 -p4 +p3 +q3
FILTER_UPDATE m4, m5, m6, m7, [P2], m2, m14, m15, m13, 4, m1, m13, [Q4] ; [p2] -p7 -p3 +p2 +q4
FILTER_UPDATE m6, m7, m4, m5, [P1], m2, m15, m10, m13, 4, m1, m13, [Q5] ; [p1] -p7 -p2 +p1 +q5
FILTER_UPDATE m4, m5, m6, m7, [P0], m2, m10, m11, m13, 4, m1, m13, [Q6] ; [p0] -p7 -p1 +p0 +q6
FILTER_UPDATE m6, m7, m4, m5, [Q0], m2, m11, m12, m13, 4, m1, m13, [Q7] ; [q0] -p7 -p0 +q0 +q7
FILTER_UPDATE m4, m5, m6, m7, [Q1], m3, m12, m2, m13, 4, m1, m2, [Q1] ; [q1] -p6 -q0 +q1 +q7
FILTER_UPDATE m6, m7, m4, m5, [Q2], m8, m2, m3, m13, 4, m1, m3, [Q2] ; [q2] -p5 -q1 +q2 +q7
FILTER_UPDATE m4, m5, m6, m7, [Q3], m9, m3, m8, m13, 4, m1, m8, m8, [Q3] ; [q3] -p4 -q2 +q3 +q7
FILTER_UPDATE m6, m7, m4, m5, [Q4], m14, m8, m9, m13, 4, m1, m9, m9, [Q4] ; [q4] -p3 -q3 +q4 +q7
FILTER_UPDATE m4, m5, m6, m7, [Q5], m15, m9, m14, m13, 4, m1, m14, m14, [Q5] ; [q5] -p2 -q4 +q5 +q7
FILTER_UPDATE m6, m7, m4, m5, [Q6], m10, m14, m15, m13, 4, m1, m15, m15, [Q6] ; [q6] -p1 -q5 +q6 +q7
%endif
%ifidn %1, h
%if %2 == 16
mova m0, [P7]
mova m1, [P6]
mova m2, [P5]
mova m3, [P4]
mova m4, [P3]
mova m5, [P2]
mova m6, [P1]
mova m7, [P0]
mova m8, [Q0]
mova m9, [Q1]
mova m10, [Q2]
mova m11, [Q3]
mova m12, [Q4]
mova m13, [Q5]
mova m14, [Q6]
mova m15, [Q7]
TRANSPOSE16x16B 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, [rsp]
DEFINE_REAL_P7_TO_Q7
movu [P7], m0
movu [P6], m1
movu [P5], m2
movu [P4], m3
movu [P3], m4
movu [P2], m5
movu [P1], m6
movu [P0], m7
movu [Q0], m8
movu [Q1], m9
movu [Q2], m10
movu [Q3], m11
movu [Q4], m12
movu [Q5], m13
movu [Q6], m14
movu [Q7], m15
%elif %2 == 44
SWAP 0, 7 ; m0 = p1
SWAP 3, 4 ; m3 = q1
DEFINE_REAL_P7_TO_Q7 2
SBUTTERFLY bw, 0, 1, 8
SBUTTERFLY bw, 2, 3, 8
SBUTTERFLY wd, 0, 2, 8
SBUTTERFLY wd, 1, 3, 8
SBUTTERFLY dq, 0, 4, 8
SBUTTERFLY dq, 1, 5, 8
SBUTTERFLY dq, 2, 6, 8
SBUTTERFLY dq, 3, 7, 8
movd [P7], m0
punpckhqdq m0, m8
movd [P6], m0
movd [Q0], m1
punpckhqdq m1, m9
movd [Q1], m1
movd [P3], m2
punpckhqdq m2, m10
movd [P2], m2
movd [Q4], m3
punpckhqdq m3, m11
movd [Q5], m3
movd [P5], m4
punpckhqdq m4, m12
movd [P4], m4
movd [Q2], m5
punpckhqdq m5, m13
movd [Q3], m5
movd [P1], m6
punpckhqdq m6, m14
movd [P0], m6
movd [Q6], m7
punpckhqdq m7, m8
movd [Q7], m7
%else
; the following code do a transpose of 8 full lines to 16 half
; lines (high part). It is inlined to avoid the need of a staging area
mova m0, [P3]
mova m1, [P2]
mova m2, [P1]
mova m3, [P0]
mova m4, [Q0]
mova m5, [Q1]
mova m6, [Q2]
mova m7, [Q3]
DEFINE_REAL_P7_TO_Q7
SBUTTERFLY bw, 0, 1, 8
SBUTTERFLY bw, 2, 3, 8
SBUTTERFLY bw, 4, 5, 8
SBUTTERFLY bw, 6, 7, 8
SBUTTERFLY wd, 0, 2, 8
SBUTTERFLY wd, 1, 3, 8
SBUTTERFLY wd, 4, 6, 8
SBUTTERFLY wd, 5, 7, 8
SBUTTERFLY dq, 0, 4, 8
SBUTTERFLY dq, 1, 5, 8
SBUTTERFLY dq, 2, 6, 8
SBUTTERFLY dq, 3, 7, 8
movh [P7], m0
punpckhqdq m0, m8
movh [P6], m0
movh [Q0], m1
punpckhqdq m1, m9
movh [Q1], m1
movh [P3], m2
punpckhqdq m2, m10
movh [P2], m2
movh [Q4], m3
punpckhqdq m3, m11
movh [Q5], m3
movh [P5], m4
punpckhqdq m4, m12
movh [P4], m4
movh [Q2], m5
punpckhqdq m5, m13
movh [Q3], m5
movh [P1], m6
punpckhqdq m6, m14
movh [P0], m6
movh [Q6], m7
punpckhqdq m7, m8
movh [Q7], m7
%endif
%endif
RET
%endmacro
%macro LPF_16_VH 2
INIT_XMM %2
cglobal vp9_loop_filter_v_%1_16, 5,10,16, dst, stride, E, I, H, mstride, dst1, dst2, stride3, mstride3
LOOPFILTER v, %1
cglobal vp9_loop_filter_h_%1_16, 5,10,16, 256, dst, stride, E, I, H, mstride, dst1, dst2, stride3, mstride3
LOOPFILTER h, %1
%endmacro
%macro LPF_16_VH_ALL_OPTS 1
LPF_16_VH %1, sse2
LPF_16_VH %1, ssse3
LPF_16_VH %1, avx
%endmacro
LPF_16_VH_ALL_OPTS 16
LPF_16_VH_ALL_OPTS 44
LPF_16_VH_ALL_OPTS 48
LPF_16_VH_ALL_OPTS 84
LPF_16_VH_ALL_OPTS 88
%endif ; x86-64
| mxOBS/deb-pkg_trusty_chromium-browser | third_party/ffmpeg/libavcodec/x86/vp9lpf.asm | Assembly | bsd-3-clause | 31,436 |
.device attiny2313
;běží na 8MHz, ckdiv8=1 (vypnuto)
; A L I A S Y
.def numL = r20
.def numH = r21
.def dispL = r22
.def dispH = r23
.def wOld = r24
.def InitLoopN = r25
.equ CUvodniIntervaly = 1 ;pocet intervalu cekani
.equ CInitLoopMax = 10 ;delka 1 intervalu cekani (s)
.equ CUnitSecs = 1 ;delka 1 jednotky (s) - zacina se s 99 jednotkami
; Z A C A T E K P R O G R A M U
.org 0x0000 ;RESET
rjmp RESET ;skok na start po resetu
.org 0x0010
; NASTAVENI PO RESETU
RESET:
ldi r16,low(RAMEND) ;nastavi stack pointer
out SPL,r16
cli ;zakazat vsechna preruseni
; Nastaveni portu
ldi r16,0b11111111 ;smer portu B - vystupni: segmenty (=katody)
out DDRB,r16
ldi r16,0b11111111 ;vse v PORTB na 1, segmenty zhasnuty
out PORTB,r16
ldi r16,0b00000011 ;smer portu D - PB0 a PB1 jsou vystupni - spinaji anody displeje. Zbytek: dratky. PB2 je spravny drat
out DDRD,r16
ldi r16,0b11111100 ;enable pullup, 0 na anody = zhasnout. dratky pripojeny na GND, s pullupy
out PORTD,r16
sei ;Global Interrupt Enable
; P R I P R A V Y N A H L A V N I P R O G R A M
cli ;vypni preruseni - skoncila uvodni smycka, zacina odpocitavani
;vycisteni registru
clr r16 ;vynuluj registry
clr r17
clr r18
clr r19
;cas 99
ldi numL,3
ldi numH,7
;vychozi rozlozeni dratu
in wOld,PORTD ;nastaveni stareho rozlozeni dratu
andi wOld,0b01111000 ;ignorovat anody a spravny drat
mov r17,numL ;zpracovat numL
rcall dec7seg ;najdi 7seg. reprezentaci jednotek a dej ji do r16
mov dispL,r16 ;presunout vysledek do vystupu displeje
mov r17,numH ;zpracovat numH
rcall dec7seg ;najdi 7seg. reprezentaci jednotek a dej ji do r16
mov dispH,r16 ;presunout vysledek do vystupu displeje
;dispL a dispH maji nastaveny obsah
ldi r19,CUnitSecs ;nastav citac intervalu pro hlavni odpocet
ldi r16,0b111111 ;255 na PORTB, vse zhasnuto
out PORTB, r16
sei ;zacina hlavni program s casovacem, bude se pouzivat preruseni
loop:
rcall multiplex
rjmp loop ;hlavni smycka se opakuje
multiplex:
push r16
push r17
;DISPLEJ JEDNOTEK
ser r16 ;katody na +: vypnout vsechny segmenty
out PORTB,r16
cbi PORTD,1
sbi PORTD,0 ;PORTD = 01 - zapnout anodu pro jednotky
out PORTB,dispL ;PORTB = dispL (displej jednotek)
ldi r17,100 ;pocet smycek
dL: ;smycka
nop
nop
nop
dec r17
brne dL
;DISPLEJ DESITEK
ser r16 ;katody na +: vypnout vsechny segmenty
out PORTB,r16
cbi PORTD,0
sbi PORTD,1 ;PORTD 10 - zapnout anodu pro desitky
out PORTB,dispH ;PORTB = dispH (displej desitek)
ldi r17,100 ;pocet smycek
dH:
nop
nop
nop
dec r17
brne dH
ser r16 ;katody na +: vypnout vsechny segmenty
out PORTB,r16
pop r17
pop r16
ret
; r17 konvertuj do 7segmentovyho kodu pro displej se spol. anodou DECGAFB ---> r16
dec7seg: ;dec7seg(r17) -> r16
clr r16 ;do r16 budeme ukladat vystup, v r17 je vstupni cislo 0-9
cpi r17,9 ;je r17 = 9?
brne dec7segN8 ;neni -> pokracuj s 8
; DEChGAFB
ldi r16, 0b01000000 ;katody DCGAFB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN8:
cpi r17,8 ;je r17 = 8?
brne dec7segN7 ;neni -> pokracuj s 7
; DEChGAFB
ldi r16, 0b00000000 ;katody DECGAFB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN7:
cpi r17,7 ;je r17 = 7?
brne dec7segN6 ;neni -> pokracuj s 6
; DEChGAFB
ldi r16, 0b11001010 ;katody CAB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN6:
cpi r17,6 ;je r17 = 6?
brne dec7segN5 ;neni -> pokracuj s 5
; DEChGAFB
ldi r16, 0b00000001 ;katody DECGAF na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN5:
cpi r17,5 ;je r17 = 5?
brne dec7segN4 ;neni -> pokracuj s 4
; DEChGAFB
ldi r16, 0b01000001 ;katody DCGAF na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN4:
cpi r17,4 ;je r17 = 4?
brne dec7segN3 ;neni -> pokracuj s 3
; DEChGAFB
ldi r16, 0b11000100 ;katody CGFB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN3:
cpi r17,3 ;je r17 = 3?
brne dec7segN2 ;neni -> pokracuj s 2
; DEChGAFB
ldi r16, 0b01000010 ;katody DCGAB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN2:
cpi r17,2 ;je r17 = 2?
brne dec7segN1 ;neni -> pokracuj s 1
; DEChGAFB
ldi r16, 0b00100010 ;katody DEGAB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN1:
cpi r17,1 ;je r17 = 1?
brne dec7segN0 ;neni -> pokracuj s 0
; DEChGAFB
ldi r16, 0b11001110 ;katody CB na 0; H = 0, ale bude prepsano pri vystupu
rjmp dec7segReturn
dec7segN0:
; DEChGAFB
ldi r16, 0b00001000 ;katody DECAFB na 0; H = 0, ale bude prepsano pri vystupu
dec7segReturn:
ret | MightyPork/avr-projects | archive/000000_asm_old/bomba/tmp/bomba_mx.asm | Assembly | mit | 4,979 |
; Keyboard library
; NAMESPACE: "keyboard"
; REQUIRES: "string"
keyboard:
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### MACRO: "getKey"
;
; return:
; ah = BIOS scan code
; al = ASCII character
; (flag) zf = clear if key available, set otherwise
macro keyboard.getKey
{
mov ah, 0x10 ; 0x16 - get enhanced keyboard character
int 0x16
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### PROC: "waitForKey"
;
; return:
; ah = BIOS scan code
; al = ASCII code
macro keyboard.waitForKey {
.waitForKey:
keyboard.getKey
cmp ax, 0
jz .waitForKey
.waitForKey.return:
ret
}
; ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
; ### PROC: "inputString"
; Catches input from the keyboard into a string. Terminated when ENTER pressed.
;
; param:
; al = maximum string length, excluding null terminator
; ah = 0: no echo, 1: echo (via string.teletype)
; di = pointer to new string destination
; return:
; di = pointer to new string, null terminated
macro keyboard.inputString {
.inputString:
push ax
push bx
push cx
push di
push dx
mov cl, al ; hold AX values elsewhere - will be destroyed by .getKey
mov ch, 0 ; cx = number of characters to get
mov bl, ah ; bl = echo flag
mov dx, di ; save start of pointer in dx
.inputString.getNextKey:
call .waitForKey
cmp al, 0x0D ; enter key pressed? stop accepting input and return string
je .inputString.appendTerminator
cmp al, 0x08 ; backspace key pressed? clear previous character
je .inputString.backspace
mov [di], al ; store character
inc di
cmp bl, 0 ; echo enabled?
jz .inputString.nextIteration
; loopz doesn't want to work for some reason? always decrements cx by 2.
; loopnz is horribly broken, too. infinite loop.
string.putChar ; display character on screen
.inputString.nextIteration:
loop .inputString.getNextKey
.inputString.appendTerminator:
mov al, 0
mov [di], al
.inputString.return:
pop dx
pop di
pop cx
pop bx
pop ax
ret
.inputString.backspace:
cmp dx, di ; beginning of string?
je .inputString.getNextKey
; act like nothing ever happened
; else...
dec di ; previous position in buffer
cmp bl, 0 ; echo enabled?
jz .inputString.offsetCounter
string.putChar ; backspace cursor
mov al, ' '
string.putChar ; blank that character
mov al, 0x08
string.putChar ; and backspace again
.inputString.offsetCounter:
inc cx
jmp .inputString.getNextKey
}
| Trinitek/Turtle | keyboard.asm | Assembly | mit | 2,612 |
;-------------------------------------------------------------------------------
; Praktikum SMD 2015
; M.Wahyudin (140310120031)
;
; Name : LATIH2.ASM
; Desc : Baca DIPSWITCH di P1, tampilkan ke P2 dan P3
; Input : DIPSWITCH di P1
; Output: LED P2 dan P3
;-------------------------------------------------------------------------------
mov P1, #255 ; Menyiapkan P1 sebagai input (1111 1111)
mulai:
mov a, P1 ; Menyalin data input P1 ke a (?)
mov P2, a ; Menampilkan data a di P2
inc a ; Manipulasi data a + 1
cpl a ; Manipulasi data a dikomplemen
mov P3, a ; Menampilkan data a manipulasi ke P3
sjmp mulai ; Ulang dari mulai
end | hyuwah/fu-praktikum-smd | Modul 1/latih2.asm | Assembly | mit | 693 |
# Lackstein
# Noah
# 260524490
.data
displayBuffer: .space 0x80000 # space for 512x256 bitmap display
errorBuffer: .space 0x80000 # space to store match function
templateBuffer: .space 0x100 # space for 8x8 template
imageFileName: .asciiz "pxlcon512x256cropgs.raw" # filename of image to load
templateFileName: .asciiz "template8x8gs.raw" # filename of template to load
# struct bufferInfo { int *buffer, int width, int height, char* filename }
imageBufferInfo: .word displayBuffer 512 256 imageFileName
errorBufferInfo: .word errorBuffer 512 256 0
templateBufferInfo: .word templateBuffer 8 8 templateFileName
.text
main: la $a0, imageBufferInfo
jal loadImage
la $a0, templateBufferInfo
jal loadImage
la $a0, imageBufferInfo
la $a1, templateBufferInfo
la $a2, errorBufferInfo
jal matchTemplate # MATCHING DONE HERE
la $a0, errorBufferInfo
jal findBest
la $a0, imageBufferInfo
move $a1, $v0
jal highlight
la $a0, errorBufferInfo
jal processError
li $v0, 10 # exit
syscall
##########################################################
# matchTemplate( bufferInfo imageBufferInfo, bufferInfo templateBufferInfo, bufferInfo errorBufferInfo )
# NOTE: struct bufferInfo { int *buffer, int width, int height, char* filename }
matchTemplate:
add $sp, $sp, -28 # Make space on the stack for modified save registers
sw $s0, 0($sp)
sw $s1, 4($sp)
sw $s2, 8($sp)
sw $s3, 12($sp)
sw $s4, 16($sp)
sw $s5, 20($sp)
sw $s6, 24($sp)
lw $s0, 0($a0) # Address of image
lw $s1, 0($a1) # Address of template
lw $s2, 0($a2) # Address of error
lw $s3, 4($a0) # Width of image
lw $s4, 8($a0) # Height of image
sll $s5, $s3, 2 # 4 * width = number of bytes per row of image
sll $s6, $s5, 3 # 8 * 4 * width = number of bytes in image to get back to top-left of template
addi $s3, $s3, -7 # Template matching loop will catch these last pixels in the width
addi $s4, $s4, -7 # and height
li $t1, 0 # y (height) = 0
heightLoop:
li $t2, 0 # x (width) = 0
widthLoop:
li $t3, 0 # j (template height) = 0
tempHeightLoop:
li $t4, 0 # i (template width) = 0
tempWidthLoop:
lbu $t5, 0($s0) # Load pixel from image
lbu $t6, 0($s1) # Load pixel from template
sub $t7, $t5, $t6 # Get the difference between image and template
abs $t7, $t7 # Absolute difference
lw $t8, 0($s2) # Get the previous sum of absolute difference
add $t7, $t7, $t8 # Add this difference to the sum
sw $t7, 0($s2) # Save the sum of the absolute difference
# Prepare for next iteration
addi $s0, $s0, 4 # Move image one pixel to the right
addi $s1, $s1, 4 # Move template one pixel to the right
addi $t4, $t4, 1 # i++
bne $t4, 8, tempWidthLoop # Loop if i < 8
# We're done looping at this row of the template, rewind addresses
subi $s0, $s0, 32 # Move image back to y
add $s0, $s0, $s5 # Move image down a row
addi $t3, $t3, 1 # j++
bne $t3, 8, tempHeightLoop # Loop if j < 8
# We've looped through all rows of the template, rewind its address to the beginning
subi $s1, $s1, 256 # Template is 8*8*4 bytes
addi $s2, $s2, 4 # Move error one pixel to the right
sub $s0, $s0, $s6 # Move image back to beginning
#lw $t9, 0($s0)
#andi $t9, $t9, 0xff0000
#sw $t9, 0($s0)
addi $s0, $s0, 4 # Move image one pixel to the right
addi $t2, $t2, 1 # x++
bne $t2, $s3, widthLoop # Loop if x < width - 7
# We've looped through an entire row of the image minus the last 7 pixels
addi $s2, $s2, 28 # Move error forward 7 pixels
addi $s0, $s0, 28 # Move image forward 7 pixels
#add $s0, $s0, $s5
addi $t1, $t1, 1 # y++
bne $t1, $s4, heightLoop # Loop if y < height - 7
lw $s0, 0($sp) # Restore save registers from the stack
lw $s1, 4($sp) # Make space on the stack for modified save registers
lw $s2, 8($sp)
lw $s3, 12($sp)
lw $s4, 16($sp)
lw $s5, 20($sp)
lw $s6, 24($sp)
add $sp, $sp, 28
jr $ra
###############################################################
# loadImage( bufferInfo* imageBufferInfo )
# NOTE: struct bufferInfo { int *buffer, int width, int height, char* filename }
loadImage: lw $a3, 0($a0) # int* buffer
lw $a1, 4($a0) # int width
lw $a2, 8($a0) # int height
lw $a0, 12($a0) # char* filename
mul $t0, $a1, $a2 # words to read (width x height) in a2
sll $t0, $t0, 2 # multiply by 4 to get bytes to read
li $a1, 0 # flags (0: read, 1: write)
li $a2, 0 # mode (unused)
li $v0, 13 # open file, $a0 is null-terminated string of file name
syscall
move $a0, $v0 # file descriptor (negative if error) as argument for read
move $a1, $a3 # address of buffer to which to write
move $a2, $t0 # number of bytes to read
li $v0, 14 # system call for read from file
syscall # read from file
# $v0 contains number of characters read (0 if end-of-file, negative if error).
# We'll assume that we do not need to be checking for errors!
# Note, the bitmap display doesn't update properly on load,
# so let's go touch each memory address to refresh it!
move $t0, $a3 # start address
add $t1, $a3, $a2 # end address
loadloop: lw $t2, ($t0)
sw $t2, ($t0)
addi $t0, $t0, 4
bne $t0, $t1, loadloop
jr $ra
#####################################################
# (offset, score) = findBest( bufferInfo errorBuffer )
# Returns the address offset and score of the best match in the error Buffer
findBest: lw $t0, 0($a0) # load error buffer start address
lw $t2, 4($a0) # load width
lw $t3, 8($a0) # load height
addi $t3, $t3, -7 # height less 8 template lines minus one
mul $t1, $t2, $t3
sll $t1, $t1, 2 # error buffer size in bytes
add $t1, $t0, $t1 # error buffer end address
li $v0, 0 # address of best match
li $v1, 0xffffffff # score of best match
lw $a1, 4($a0) # load width
addi $a1, $a1, -7 # initialize column count to 7 less than width to account for template
fbLoop: lw $t9, 0($t0) # score
sltu $t8, $t9, $v1 # better than best so far?
beq $t8, $zero, notBest
move $v0, $t0
move $v1, $t9
notBest: addi $a1, $a1, -1
bne $a1, $0, fbNotEOL # Need to skip 8 pixels at the end of each line
lw $a1, 4($a0) # load width
addi $a1, $a1, -7 # column count for next line is 7 less than width
addi $t0, $t0, 28 # skip pointer to end of line (7 pixels x 4 bytes)
fbNotEOL: add $t0, $t0, 4
bne $t0, $t1, fbLoop
lw $t0, 0($a0) # load error buffer start address
sub $v0, $v0, $t0 # return the offset rather than the address
jr $ra
#####################################################
# highlight( bufferInfo imageBuffer, int offset )
# Applies green mask on all pixels in an 8x8 region
# starting at the provided addr.
highlight: lw $t0, 0($a0) # load image buffer start address
add $a1, $a1, $t0 # add start address to offset
lw $t0, 4($a0) # width
sll $t0, $t0, 2
li $a2, 0xff00 # highlight green
li $t9, 8 # loop over rows
highlightLoop: lw $t3, 0($a1) # inner loop completely unrolled
and $t3, $t3, $a2
sw $t3, 0($a1)
lw $t3, 4($a1)
and $t3, $t3, $a2
sw $t3, 4($a1)
lw $t3, 8($a1)
and $t3, $t3, $a2
sw $t3, 8($a1)
lw $t3, 12($a1)
and $t3, $t3, $a2
sw $t3, 12($a1)
lw $t3, 16($a1)
and $t3, $t3, $a2
sw $t3, 16($a1)
lw $t3, 20($a1)
and $t3, $t3, $a2
sw $t3, 20($a1)
lw $t3, 24($a1)
and $t3, $t3, $a2
sw $t3, 24($a1)
lw $t3, 28($a1)
and $t3, $t3, $a2
sw $t3, 28($a1)
add $a1, $a1, $t0 # increment address to next row
add $t9, $t9, -1 # decrement row count
bne $t9, $zero, highlightLoop
jr $ra
######################################################
# processError( bufferInfo error )
# Remaps scores in the entire error buffer. The best score, zero,
# will be bright green (0xff), and errors bigger than 0x4000 will
# be black. This is done by shifting the error by 5 bits, clamping
# anything bigger than 0xff and then subtracting this from 0xff.
processError: lw $t0, 0($a0) # load error buffer start address
lw $t2, 4($a0) # load width
lw $t3, 8($a0) # load height
addi $t3, $t3, -7 # height less 8 template lines minus one
mul $t1, $t2, $t3
sll $t1, $t1, 2 # error buffer size in bytes
add $t1, $t0, $t1 # error buffer end address
lw $a1, 4($a0) # load width as column counter
addi $a1, $a1, -7 # initialize column count to 7 less than width to account for template
pebLoop: lw $v0, 0($t0) # score
srl $v0, $v0, 5 # reduce magnitude
slti $t2, $v0, 0x100 # clamp?
bne $t2, $zero, skipClamp
li $v0, 0xff # clamp!
skipClamp: li $t2, 0xff # invert to make a score
sub $v0, $t2, $v0
sll $v0, $v0, 8 # shift it up into the green
sw $v0, 0($t0)
addi $a1, $a1, -1 # decrement column counter
bne $a1, $0, pebNotEOL # Need to skip 8 pixels at the end of each line
lw $a1, 4($a0) # load width to reset column counter
addi $a1, $a1, -7 # column count for next line is 7 less than width
addi $t0, $t0, 28 # skip pointer to end of line (7 pixels x 4 bytes)
pebNotEOL: add $t0, $t0, 4
bne $t0, $t1, pebLoop
jr $ra
| lackstein/comp273 | Assignment 4/tmatch.asm | Assembly | mit | 9,348 |
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
;; See the LICENSE file in the project root for more information.
#include "AsmMacros.h"
TEXTAREA
#define STACKSIZEOF_ExInfo ((SIZEOF__ExInfo + 15)&(~15))
#define HARDWARE_EXCEPTION 1
#define SOFTWARE_EXCEPTION 0
;; -----------------------------------------------------------------------------
;; Macro used to create frame of exception throwing helpers (RhpThrowEx, RhpThrowHwEx)
MACRO
ALLOC_THROW_FRAME $exceptionType
PROLOG_NOP mov x3, sp
;; Setup a PAL_LIMITED_CONTEXT on the stack {
PROLOG_STACK_ALLOC 0x50
IF $exceptionType == HARDWARE_EXCEPTION
PROLOG_NOP stp x3, x1, [sp] ; x3 is the SP and x1 is the IP of the fault site
PROLOG_PUSH_MACHINE_FRAME
ELSE
PROLOG_NOP stp x3, lr, [sp] ; x3 is the SP and lr is the IP of the fault site
ENDIF
PROLOG_NOP stp d8, d9, [sp, #0x10]
PROLOG_NOP stp d10, d11, [sp, #0x20]
PROLOG_NOP stp d12, d13, [sp, #0x30]
PROLOG_NOP stp d14, d15, [sp, #0x40]
PROLOG_SAVE_REG_PAIR fp, lr, #-0x70!
PROLOG_NOP stp xzr, xzr, [sp, #0x10] ; locations reserved for return value, not used for exception handling
PROLOG_SAVE_REG_PAIR x19, x20, #0x20
PROLOG_SAVE_REG_PAIR x21, x22, #0x30
PROLOG_SAVE_REG_PAIR x23, x24, #0x40
PROLOG_SAVE_REG_PAIR x25, x26, #0x50
PROLOG_SAVE_REG_PAIR x27, x28, #0x60
;; } end PAL_LIMITED_CONTEXT
PROLOG_STACK_ALLOC STACKSIZEOF_ExInfo
MEND
;; -----------------------------------------------------------------------------
;; Macro used to create frame of funclet calling helpers (RhpCallXXXXFunclet)
;; $extraStackSize - extra stack space that the user of the macro can use to
;; store additional registers
MACRO
ALLOC_CALL_FUNCLET_FRAME $extraStackSize
; Using below prolog instead of PROLOG_SAVE_REG_PAIR fp,lr, #-60!
; is intentional. Above statement would also emit instruction to save
; sp in fp. If sp is saved in fp in prolog then it is not expected that fp can change in the body
; of method. However, this method needs to be able to change fp before calling funclet.
; This is required to access locals in funclet.
PROLOG_SAVE_REG_PAIR_NO_FP fp,lr, #-0x60!
PROLOG_SAVE_REG_PAIR x19, x20, #0x10
PROLOG_SAVE_REG_PAIR x21, x22, #0x20
PROLOG_SAVE_REG_PAIR x23, x24, #0x30
PROLOG_SAVE_REG_PAIR x25, x26, #0x40
PROLOG_SAVE_REG_PAIR x27, x28, #0x50
PROLOG_NOP mov fp, sp
IF $extraStackSize != 0
PROLOG_STACK_ALLOC $extraStackSize
ENDIF
MEND
;; -----------------------------------------------------------------------------
;; Macro used to free frame of funclet calling helpers (RhpCallXXXXFunclet)
;; $extraStackSize - extra stack space that the user of the macro can use to
;; store additional registers.
;; It needs to match the value passed to the corresponding
;; ALLOC_CALL_FUNCLET_FRAME.
MACRO
FREE_CALL_FUNCLET_FRAME $extraStackSize
IF $extraStackSize != 0
EPILOG_STACK_FREE $extraStackSize
ENDIF
EPILOG_RESTORE_REG_PAIR x19, x20, #0x10
EPILOG_RESTORE_REG_PAIR x21, x22, #0x20
EPILOG_RESTORE_REG_PAIR x23, x24, #0x30
EPILOG_RESTORE_REG_PAIR x25, x26, #0x40
EPILOG_RESTORE_REG_PAIR x27, x28, #0x50
EPILOG_RESTORE_REG_PAIR fp, lr, #0x60!
MEND
;; -----------------------------------------------------------------------------
;; Macro used to restore preserved general purpose and FP registers from REGDISPLAY
;; $regdisplayReg - register pointing to the REGDISPLAY structure
MACRO
RESTORE_PRESERVED_REGISTERS $regdisplayReg
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19]
ldr x19, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20]
ldr x20, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21]
ldr x21, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22]
ldr x22, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23]
ldr x23, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24]
ldr x24, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25]
ldr x25, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26]
ldr x26, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27]
ldr x27, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28]
ldr x28, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP]
ldr fp, [x12]
;;
;; load FP preserved regs
;;
add x12, $regdisplayReg, #OFFSETOF__REGDISPLAY__D
ldp d8, d9, [x12, #0x00]
ldp d10, d11, [x12, #0x10]
ldp d12, d13, [x12, #0x20]
ldp d14, d15, [x12, #0x30]
MEND
;; -----------------------------------------------------------------------------
;; Macro used to save preserved general purpose and FP registers to REGDISPLAY
;; $regdisplayReg - register pointing to the REGDISPLAY structure
MACRO
SAVE_PRESERVED_REGISTERS $regdisplayReg
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19]
str x19, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20]
str x20, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21]
str x21, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22]
str x22, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23]
str x23, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24]
str x24, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25]
str x25, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26]
str x26, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27]
str x27, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28]
str x28, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP]
str fp, [x12]
;;
;; store vfp preserved regs
;;
add x12, $regdisplayReg, #OFFSETOF__REGDISPLAY__D
stp d8, d9, [x12, #0x00]
stp d10, d11, [x12, #0x10]
stp d12, d13, [x12, #0x20]
stp d14, d15, [x12, #0x30]
MEND
;; -----------------------------------------------------------------------------
;; Macro used to thrash preserved general purpose registers in REGDISPLAY
;; to make sure nobody uses them
;; $regdisplayReg - register pointing to the REGDISPLAY structure
MACRO
TRASH_PRESERVED_REGISTERS_STORAGE $regdisplayReg
#if 0 // def _DEBUG ;; @TODO: temporarily removed because trashing the frame pointer breaks the debugger
movz x3, #0xbaad, LSL #48
movk x3, #0xdeed, LSL #32
movk x3, #0xbaad, LSL #16
movk x3, #0xdeed
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX19]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX20]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX21]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX22]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX23]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX24]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX25]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX26]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX27]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pX28]
str x3, [x12]
ldr x12, [$regdisplayReg, #OFFSETOF__REGDISPLAY__pFP]
str x3, [x12]
#endif // _DEBUG
MEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpThrowHwEx
;;
;; INPUT: W0: exception code of fault
;; X1: faulting IP
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpThrowHwEx
#define rsp_offsetof_ExInfo 0
#define rsp_offsetof_Context STACKSIZEOF_ExInfo
ALLOC_THROW_FRAME HARDWARE_EXCEPTION
;; x2 = GetThread(), TRASHES x1
INLINE_GETTHREAD x2, x1
add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo*
str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null
mov w3, #1
strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1
mov w3, #0xFFFFFFFF
str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx
mov w3, #2
strb w3, [x1, #OFFSETOF__ExInfo__m_kind] ;; pExInfo->m_kind = ExKind.HardwareFault
;; link the ExInfo into the thread's ExInfo chain
ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead]
str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead
str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo
;; set the exception context field on the ExInfo
add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT*
str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext
;; w0: exception code
;; x1: ExInfo*
bl RhThrowHwEx
EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowHwEx2
;; no return
EMIT_BREAKPOINT
NESTED_END RhpThrowHwEx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpThrowEx
;;
;; INPUT: X0: exception object
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpThrowEx
ALLOC_THROW_FRAME SOFTWARE_EXCEPTION
;; x2 = GetThread(), TRASHES x1
INLINE_GETTHREAD x2, x1
;; There is runtime C# code that can tail call to RhpThrowEx using a binder intrinsic. So the return
;; address could have been hijacked when we were in that C# code and we must remove the hijack and
;; reflect the correct return address in our exception context record. The other throw helpers don't
;; need this because they cannot be tail-called from C#.
;; NOTE: we cannot use INLINE_THREAD_UNHIJACK because it will write into the stack at the location
;; where the tail-calling thread had saved LR, which may not match where we have saved LR.
ldr x1, [x2, #OFFSETOF__Thread__m_pvHijackedReturnAddress]
cbz x1, NotHijacked
ldr x3, [x2, #OFFSETOF__Thread__m_ppvHijackedReturnAddressLocation]
;; x0: exception object
;; x1: hijacked return address
;; x2: pThread
;; x3: hijacked return address location
add x12, sp, #(STACKSIZEOF_ExInfo + SIZEOF__PAL_LIMITED_CONTEXT) ;; re-compute SP at callsite
cmp x3, x12 ;; if (m_ppvHijackedReturnAddressLocation < SP at callsite)
blo TailCallWasHijacked
;; normal case where a valid return address location is hijacked
str x1, [x3]
b ClearThreadState
TailCallWasHijacked
;; Abnormal case where the return address location is now invalid because we ended up here via a tail
;; call. In this case, our hijacked return address should be the correct caller of this method.
;;
;; stick the previous return address in LR as well as in the right spots in our PAL_LIMITED_CONTEXT.
mov lr, x1
str lr, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__LR)]
str lr, [sp, #(rsp_offsetof_Context + OFFSETOF__PAL_LIMITED_CONTEXT__IP)]
ClearThreadState
;; clear the Thread's hijack state
str xzr, [x2, #OFFSETOF__Thread__m_ppvHijackedReturnAddressLocation]
str xzr, [x2, #OFFSETOF__Thread__m_pvHijackedReturnAddress]
NotHijacked
add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo*
str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null
mov w3, #1
strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1
mov w3, #0xFFFFFFFF
str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx
mov w3, #1
strb w3, [x1, #OFFSETOF__ExInfo__m_kind] ;; pExInfo->m_kind = ExKind.Throw
;; link the ExInfo into the thread's ExInfo chain
ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead]
str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead
str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo
;; set the exception context field on the ExInfo
add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT*
str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext
;; x0: exception object
;; x1: ExInfo*
bl RhThrowEx
EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowEx2
;; no return
EMIT_BREAKPOINT
NESTED_END RhpThrowEx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void FASTCALL RhpRethrow()
;;
;; SUMMARY: Similar to RhpThrowEx, except that it passes along the currently active ExInfo
;;
;; INPUT:
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpRethrow
ALLOC_THROW_FRAME SOFTWARE_EXCEPTION
;; x2 = GetThread(), TRASHES x1
INLINE_GETTHREAD x2, x1
add x1, sp, #rsp_offsetof_ExInfo ;; x1 <- ExInfo*
str xzr, [x1, #OFFSETOF__ExInfo__m_exception] ;; pExInfo->m_exception = null
mov w3, #1
strb w3, [x1, #OFFSETOF__ExInfo__m_passNumber] ;; pExInfo->m_passNumber = 1
mov w3, #0xFFFFFFFF
str w3, [x1, #OFFSETOF__ExInfo__m_idxCurClause] ;; pExInfo->m_idxCurClause = MaxTryRegionIdx
;; link the ExInfo into the thread's ExInfo chain
ldr x3, [x2, #OFFSETOF__Thread__m_pExInfoStackHead]
mov x0, x3 ;; x0 <- current ExInfo
str x3, [x1, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; pExInfo->m_pPrevExInfo = m_pExInfoStackHead
str x1, [x2, #OFFSETOF__Thread__m_pExInfoStackHead] ;; m_pExInfoStackHead = pExInfo
;; set the exception context field on the ExInfo
add x2, sp, #rsp_offsetof_Context ;; x2 <- PAL_LIMITED_CONTEXT*
str x2, [x1, #OFFSETOF__ExInfo__m_pExContext] ;; pExInfo->m_pExContext = pContext
;; x0 contains the currently active ExInfo
;; x1 contains the address of the new ExInfo
bl RhRethrow
EXPORT_POINTER_TO_ADDRESS PointerToRhpRethrow2
;; no return
EMIT_BREAKPOINT
NESTED_END RhpRethrow
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* FASTCALL RhpCallCatchFunclet(RtuObjectRef exceptionObj, void* pHandlerIP, REGDISPLAY* pRegDisplay,
;; ExInfo* pExInfo)
;;
;; INPUT: X0: exception object
;; X1: handler funclet address
;; X2: REGDISPLAY*
;; X3: ExInfo*
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpCallCatchFunclet
ALLOC_CALL_FUNCLET_FRAME 0x60
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
stp x0, x2, [sp, #0x40] ;; x0, x2 & x3 are saved so we have the exception object, REGDISPLAY and
stp x3, xzr, [sp, #0x50] ;; ExInfo later, xzr makes space for the local "is_not_handling_thread_abort"
#define rsp_offset_is_not_handling_thread_abort 0x58
#define rsp_offset_x2 0x48
#define rsp_offset_x3 0x50
;;
;; clear the DoNotTriggerGc flag, trashes x4-x6
;;
INLINE_GETTHREAD x5, x6 ;; x5 <- Thread*, x6 <- trashed
ldr x4, [x5, #OFFSETOF__Thread__m_threadAbortException]
sub x4, x4, x0
str x4, [sp, #rsp_offset_is_not_handling_thread_abort] ;; Non-zero if the exception is not ThreadAbortException
add x12, x5, #OFFSETOF__Thread__m_ThreadStateFlags
ClearRetry_Catch
ldxr w4, [x12]
bic w4, w4, #TSF_DoNotTriggerGc
stxr w6, w4, [x12]
cbz w6, ClearSuccess_Catch
b ClearRetry_Catch
ClearSuccess_Catch
;;
;; set preserved regs to the values expected by the funclet
;;
RESTORE_PRESERVED_REGISTERS x2
;;
;; trash the values at the old homes to make sure nobody uses them
;;
TRASH_PRESERVED_REGISTERS_STORAGE x2
;;
;; call the funclet
;;
;; x0 still contains the exception object
blr x1
EXPORT_POINTER_TO_ADDRESS PointerToRhpCallCatchFunclet2
;; x0 contains resume IP
ldr x2, [sp, #rsp_offset_x2] ;; x2 <- REGDISPLAY*
;; @TODO: add debug-only validation code for ExInfo pop
INLINE_GETTHREAD x1, x3 ;; x1 <- Thread*, x3 <- trashed
;; We must unhijack the thread at this point because the section of stack where the hijack is applied
;; may go dead. If it does, then the next time we try to unhijack the thread, it will corrupt the stack.
INLINE_THREAD_UNHIJACK x1, x3, x12 ;; Thread in x1, trashes x3 and x12
ldr x3, [sp, #rsp_offset_x3] ;; x3 <- current ExInfo*
ldr x2, [x2, #OFFSETOF__REGDISPLAY__SP] ;; x2 <- resume SP value
PopExInfoLoop
ldr x3, [x3, #OFFSETOF__ExInfo__m_pPrevExInfo] ;; x3 <- next ExInfo
cbz x3, DonePopping ;; if (pExInfo == null) { we're done }
cmp x3, x2
blt PopExInfoLoop ;; if (pExInfo < resume SP} { keep going }
DonePopping
str x3, [x1, #OFFSETOF__Thread__m_pExInfoStackHead] ;; store the new head on the Thread
ldr x3, =RhpTrapThreads
ldr w3, [x3]
tbz x3, #TrapThreadsFlags_AbortInProgress_Bit, NoAbort
ldr x3, [sp, #rsp_offset_is_not_handling_thread_abort]
cbnz x3, NoAbort
;; It was the ThreadAbortException, so rethrow it
;; reset SP
mov x1, x0 ;; x1 <- continuation address as exception PC
mov w0, #STATUS_REDHAWK_THREAD_ABORT
mov sp, x2
b RhpThrowHwEx
NoAbort
;; reset SP and jump to continuation address
mov sp, x2
ret x0
NESTED_END RhpCallCatchFunclet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void FASTCALL RhpCallFinallyFunclet(void* pHandlerIP, REGDISPLAY* pRegDisplay)
;;
;; INPUT: X0: handler funclet address
;; X1: REGDISPLAY*
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpCallFinallyFunclet
ALLOC_CALL_FUNCLET_FRAME 0x50
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
stp x0, x1, [sp, #0x40] ;; x1 is saved so we have the REGDISPLAY later, x0 is just alignment padding
#define rsp_offset_x1 0x48
;;
;; We want to suppress hijacking between invocations of subsequent finallys. We do this because we
;; cannot tolerate a GC after one finally has run (and possibly side-effected the GC state of the
;; method) and then been popped off the stack, leaving behind no trace of its effect.
;;
;; So we clear the state before and set it after invocation of the handler.
;;
;;
;; clear the DoNotTriggerGc flag, trashes x2-x4
;;
INLINE_GETTHREAD x2, x3 ;; x2 <- Thread*, x3 <- trashed
add x12, x2, #OFFSETOF__Thread__m_ThreadStateFlags
ClearRetry
ldxr w4, [x12]
bic w4, w4, #TSF_DoNotTriggerGc
stxr w3, w4, [x12]
cbz w3, ClearSuccess
b ClearRetry
ClearSuccess
;;
;; set preserved regs to the values expected by the funclet
;;
RESTORE_PRESERVED_REGISTERS x1
;;
;; trash the values at the old homes to make sure nobody uses them
;;
TRASH_PRESERVED_REGISTERS_STORAGE x1
;;
;; call the funclet
;;
blr x0
EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFinallyFunclet2
ldr x1, [sp, #rsp_offset_x1] ;; reload REGDISPLAY pointer
;;
;; save new values of preserved regs into REGDISPLAY
;;
SAVE_PRESERVED_REGISTERS x1
;;
;; set the DoNotTriggerGc flag, trashes x1-x3
;;
INLINE_GETTHREAD x2, x3 ;; x2 <- Thread*, x3 <- trashed
add x12, x2, #OFFSETOF__Thread__m_ThreadStateFlags
SetRetry
ldxr w1, [x12]
orr w1, w1, #TSF_DoNotTriggerGc
stxr w3, w1, [x12]
cbz w3, SetSuccess
b SetRetry
SetSuccess
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
FREE_CALL_FUNCLET_FRAME 0x50
EPILOG_RETURN
NESTED_END RhpCallFinallyFunclet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* FASTCALL RhpCallFilterFunclet(RtuObjectRef exceptionObj, void* pFilterIP, REGDISPLAY* pRegDisplay)
;;
;; INPUT: X0: exception object
;; X1: filter funclet address
;; X2: REGDISPLAY*
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpCallFilterFunclet
ALLOC_CALL_FUNCLET_FRAME 0x40
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
ldr x12, [x2, #OFFSETOF__REGDISPLAY__pFP]
ldr fp, [x12]
;;
;; call the funclet
;;
;; x0 still contains the exception object
blr x1
EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFilterFunclet2
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
FREE_CALL_FUNCLET_FRAME 0x40
EPILOG_RETURN
NESTED_END RhpCallFilterFunclet
INLINE_GETTHREAD_CONSTANT_POOL
end
| gregkalapos/corert | src/Native/Runtime/arm64/ExceptionHandling.asm | Assembly | mit | 25,041 |
section ".data"
xdef pSnd_PlaySound_voice1
pSnd_PlaySound_voice1:
bset.b #0,State_voice
move.l a0,ptrstart_voice1
move.l a0,ptridle_voice1
bsr pSnd_SkipData_voice1
clr.l time_counter_voice1
move.w state_and_mode,d0
andi.w #%1111110010000000,d0 ;Mode PlaySound voice 1
ori.w #$0040,d0
move.w d0,state_and_mode
rts | bcherry/bcherry | oldstuff/tigcc/PolySnd/sources/statique/PlaySound_voice1.asm | Assembly | mit | 335 |
; --COPYRIGHT--,BSD_EX
; Copyright (c) 2012, Texas Instruments Incorporated
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; * Neither the name of Texas Instruments Incorporated nor the names of
; its contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
; ******************************************************************************
;
; MSP430 CODE EXAMPLE DISCLAIMER
;
; MSP430 code examples are self-contained low-level programs that typically
; demonstrate a single peripheral function or device feature in a highly
; concise manner. For this the code may rely on the device's power-on default
; register values and settings such as the clock configuration and care must
; be taken when combining code from several examples to avoid potential side
; effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
; for an API functional library-approach to peripheral configuration.
;
; --/COPYRIGHT--
;*******************************************************************************
; MSP430G2x33/G2x53 Demo - ADC10, DTC Sample A1 32x, 1.5V, Repeat Single, DCO
;
; Description: Use DTC to sample A1 32 times with reference to internal 1.5v.
; Vref Software writes to ADC10SC to trigger sample burst. In Mainloop MSP430
; waits in LPM0 to save power until ADC10 conversion complete, ADC10_ISR(DTC)
; will force exit from any LPMx in Mainloop on reti. ADC10 internal
; oscillator times sample period (16x) and conversion (13x). DTC transfers
; conversion code to RAM 200h - 240h. P1.0 set at start of conversion burst,
; reset on completion.
;
; MSP430G2x33/G2x53
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; >---|P1.1/A1 P1.0|-->LED
;
; D. Dang
; Texas Instruments Inc.
; December 2010
; Built with Code Composer Essentials Version: 4.2.0
;*******************************************************************************
.cdecls C,LIST, "msp430.h"
;------------------------------------------------------------------------------
.text ; Progam Start
;------------------------------------------------------------------------------
RESET mov.w #0280h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupADC10 mov.w #CONSEQ_2+INCH_1,&ADC10CTL1 ; Repeat single channel
mov.w #SREF_1+ADC10SHT_2+MSC+REFON+ADC10ON+ADC10IE,&ADC10CTL0;
mov.w #30,&TACCR0 ; Delay to allow Ref to settle
bis.w #CCIE,&TACCTL0 ; Compare-mode interrupt.
mov.w #TACLR+MC_1+TASSEL_2,&TACTL; up mode, SMCLK
bis.w #LPM0+GIE,SR ; Enter LPM0, enable interrupts
bic.w #CCIE,&TACCTL0 ; Disable timer interrupt
dint ; Disable Interrupts
mov.b #020h,&ADC10DTC1 ; 32 conversions
bis.b #02h,&ADC10AE0 ; P1.1 ADC option select
SetupP1 bis.b #001h,&P1DIR ; P1.0 output
;
Mainloop bic.w #ENC,&ADC10CTL0 ;
busy_test bit #BUSY,&ADC10CTL1 ; ADC10 core inactive?
jnz busy_test ;
mov.w #0200h,&ADC10SA ; Data buffer start
bis.b #001h,&P1OUT ; P1.0 = 1
bis.w #ENC+ADC10SC,&ADC10CTL0 ; Start sampling
bis.w #CPUOFF+GIE,SR ; LPM0, ADC10_ISR will force exit
bic.b #001h,&P1OUT ; P1.0 = 0
jmp Mainloop ; Again
;
;-------------------------------------------------------------------------------
TA0_ISR; ISR for TACCR0
;-------------------------------------------------------------------------------
clr.w &TACTL ; Clear Timer_A control registers
bic.w #LPM0,0(SP) ; Exit LPM0 on reti
reti ;
;-------------------------------------------------------------------------------
ADC10_ISR; Exit LPM0 on reti
;-------------------------------------------------------------------------------
bic.w #CPUOFF,0(SP) ; Exit LPM0 on reti
reti ;
;
;------------------------------------------------------------------------------
; Interrupt Vectors
;------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET ;
.sect ".int05" ; ADC10 Vector
.short ADC10_ISR ;
.sect ".int09" ; Timer_A0 Vector
.short TA0_ISR ;
.end
| ckemere/ELEC327 | MSP430G2xx3_Code_Examples/Assembly_CCS/msp430g2x33_adc10_08.asm | Assembly | mit | 6,543 |
;; drawWindow [corelib]
;; Draws a window layout on the screen buffer.
;; Inputs:
;; IY: Screen buffer
;; HL: Window title text
;; A: Flags:
;; Bit 0: Set to skip castle graphic
;; Bit 1: Set to skip thread list graphic
;; Bit 2: Set to draw menu graphic (note the opposite use from others)
;; Notes:
;; Clears the buffer, then draws the standard frame and other items on it
drawWindow:
push de
push bc
push hl
push af
pcall(clearBuffer)
; "window"
push iy \ pop hl
ld (hl), 0xff
ld e, l
ld d, h
inc de
ld bc, 57 * 12 - 1
ldir
ld e, 1
ld l, 7
ld c, 94
ld b, 49
pcall(rectXOR)
res 7, (iy + 0)
res 0, (iy + 11)
bit 0, a
jr nz, _
ild(hl, castleSprite)
ld b, 5
ld de, 256 + 58
pcall(putSpriteOR)
_: pop af \ push af
bit 1, a
jr nz, _
ild(hl, threadListSprite)
ld d, 89
ld b, 6
pcall(putSpriteOR)
_: pop af \ push af
bit 2, a
jr z, _
ild(hl, menuText)
ld d, 40
pcall(drawStr)
ild(hl, menuSprite)
ld d, 56
inc e
ld b, 3
pcall(PutSpriteOR)
_: pop af \ pop hl \ push hl \ push af
ld de, 0x0201
pcall(drawStrXOR)
pop af
pop hl
pop bc
pop de
ret
;; drawScrollBar
;; Inputs:
;; B: Length of bar in pixels
;; C: Position of top of bar (0-49)
;; IY: Screen Buffer
drawScrollBar:
push af
push hl
push bc
; Draw left side
ld a, 94
ld l, 7
ld c, 49
pcall(drawVLine)
; Clear right side
inc a
pcall(drawVLineAND)
; Draw bar
pop bc
; Set Y
ld a, 7
add c
ld l, a
; Set X
ld a, 95
; Set length
ld c, b
pcall(drawVLine)
pop hl
pop af
ret
;; drawTabs
;; Draws a tab bar at the top of the window
;; Inputs:
;; A: Active tab
;; HL: Pointer to tabs descriptor
;; IY: Screen Buffer
;; Notes:
;; The tabs descriptor is a list of zero deliminated strings preceded by the number of tabs. Example:
;;
;; .db 4
;; .db "Info", 0
;; .db "Tasks", 0
;; .db "RAM", 0
;; .db "Flash", 0
drawTabs:
push af
push bc
push de
push hl
; Draw black bar
push hl
ld bc, 6 << 8 | 94
ld e, 1
ld l, 7
pcall(rectOR)
pop hl
; B: tab counter
; D: X position
ld b, (hl)
inc hl
ld d, 1
neg
add b
.loop:
; Current tab
cp b
jr nz, .allTabs
push af
push bc
; If not first tab,
; shift left and overlap previous tab
ld a, d
dec a
or a
jr z, _
dec d
ld a, d
dec a
push hl
ld l, 7
ld c, 6
pcall(drawVLine)
pop hl
; Invert tab
_: push de
push hl
pcall(measureStr)
inc a
ld c, a
ld b, 7
ld l, 7
ld e, d
pcall(rectAND)
pop hl
pop de
pop bc
pop af
.allTabs:
; Shift tab after current tab left
push af
dec a
cp b
jr nz, _
dec d
_: pop af
; Draw text
inc d
push hl
push de
ld e, 8
pcall(drawStrXOR)
dec d
ld e, 7
pop hl
; H now contains position of start of tab
; Cutoff bottom of other tabs
cp b
jr z, _
ld e, 12
ld l, 12
pcall(drawLine)
_: ; Overlap tab after current tab
push af
dec a
cp b
jr nz, _
push bc
push hl
ld c, 6
ld a, h
ld l, 7
pcall(drawVLine)
pop hl
pop bc
_: pop af
pop hl
inc d
; Advance HL to next tab
push af
_: inc hl
ld a, (hl)
or a
jr nz, -_
inc hl
pop af
djnz .loop
pop hl
pop de
pop bc
pop af
ret
castleSprite:
.db 0b10101000
.db 0b00000000
.db 0b10101000
.db 0b00000000
.db 0b10101000
castleText:
.db "Castle", 0
promptText:
.db "Enter:Accept MODE:Cancel", 0
threadListSprite:
.db 0b10111100
.db 0b00000000
.db 0b10111100
.db 0b00000000
.db 0b10111100
.db 0b00000000
textCaret:
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
.db 0b10000000
menuSprite:
caret:
.db 0b00100000
.db 0b01110000
.db 0b11111000
caret_inverted:
.db 0b11111000
.db 0b01110000
.db 0b00100000
menuText:
.db "Menu", 0
clearCharSetSprite:
.db 0b11100000
.db 0b11100000
.db 0b11100000
.db 0b11100000
charSetSprites:
lowercaseASprite:
.db 0b00000000
.db 0b01100000
.db 0b10100000
.db 0b01100000
uppercaseASprite:
.db 0b01000000
.db 0b10100000
.db 0b11100000
.db 0b10100000
symbolSprite:
.db 0b01000000
.db 0b11000000
.db 0b01000000
.db 0b11100000
extendedSprite:
.db 0b01000000
.db 0b01000000
.db 0b00000000
.db 0b01000000
hexSprite:
.db 0b10100000
.db 0b01000000
.db 0b01000000
.db 0b10100000
exclamationSprite1:
.db 0b01110000
.db 0b10001000
.db 0b10001000
.db 0b10001000
.db 0b10001000
.db 0b10001000
.db 0b10001000
.db 0b10001000
exclamationSprite2:
.db 0b10001000
.db 0b01110000
.db 0b00000000
.db 0b01110000
.db 0b10001000
.db 0b10001000
.db 0b10001000
.db 0b01110000
selectionIndicatorSprite:
.db 0b10000000
.db 0b11000000
.db 0b11100000
.db 0b11000000
.db 0b10000000
| unlimitedbacon/corelib | src/graphics.asm | Assembly | mit | 6,394 |
;;----------------------------------------------------------------------------;;
;; Hacks for overlay 17 for arm9
;; Copyright 2014 Benito Palacios (aka pleonex)
;;
;; 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.
;;----------------------------------------------------------------------------;;
.nds
.open overlay9_17.bin, 020D0A00h
.relativeinclude on
.erroronwarning on
.include fileformats\subtitles.asm
.include fileformats\spellsname\spells_ov17.asm
.include fileformats\familiarname\familiar_main.asm
.include fileformats\skillsname\skills_main.asm
.include fileformats\skillsname\skills_train.asm
.include fileformats\skills_spells_getName.asm
.include textbox\cutscenes.asm
.include textbox\script_dialog.asm
.include textbox\lilli_motel.asm
.include textbox\menu_items_effect.asm
.include textbox\menu_hero.asm
.include textbox\menu_team.asm
.include textbox\casino_dialog.asm
.include textbox\menu_main.asm
.include textbox\save_time_limit.asm
.include textbox\dialog_tutorial.asm
.include textures\playerNames.asm
.include keyboard\name_encoding.asm
.include keyboard\textbox_longNames.asm
.include pointers\overlay9_17.asm
.include font\space_objects_title.asm
;.include font\int2str_ov17.asm
.close
; EOF ;
| pleonex/Ninokuni | Assembly/overlay9_17.asm | Assembly | apache-2.0 | 1,740 |
;;============================================================================
;; MCKL/lib/asm/log.asm
;;----------------------------------------------------------------------------
;; MCKL: Monte Carlo Kernel Library
;;----------------------------------------------------------------------------
;; Copyright (c) 2013-2018, Yan Zhou
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;;
;; Redistributions in binary form must reproduce the above copyright notice,
;; this list of conditions and the following disclaimer in the documentation
;; and/or other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;; POSSIBILITY OF SUCH DAMAGE.
;;============================================================================
%include "/math.asm"
global mckl_vd_log
global mckl_vd_log2
global mckl_vd_log10
global mckl_vd_log1p
default rel
; register used as constants: ymm6, ymm8-10, ymm12
; register used as variables: ymm1-5, ymm7, ymm11, ymm13-15
%macro log1pf_constants 0
vmovapd ymm6, [rel sqrt2by2]
vmovapd ymm8, [rel one]
vmovapd ymm9, [rel two]
%endmacro
; log(1 + f) * (f + 2) / f - 2 = c15 * x^14 + ... + c5 * x^4 + c3 * x^2
%macro log1pf 3 ; implicity input ymm1, output ymm15
vcmpltpd ymm11, ymm0, %1
vcmpgtpd ymm15, ymm0, %2
vxorpd ymm13, ymm13, ymm13 ; k = 0
%if %3 == 0
vaddpd ymm1, ymm0, ymm8 ; b = a + 1
vmovapd ymm14, ymm0 ; f = a;
%elif %3 == 1
vmovapd ymm1, ymm0 ; b = a
vsubpd ymm14, ymm0, ymm8 ; f = a - 1;
%else
%error
%endif
vorpd ymm11, ymm11, ymm15
vtestpd ymm11, ymm11
jz %%skip
; k = exponent(b)
vpsrlq ymm2, ymm1, 52
vorpd ymm2, ymm2, [emask0]
vsubpd ymm3, ymm2, [emask1] ; exponent(b)
; fraction(b) / 2
vandpd ymm1, ymm1, [fmask0]
vorpd ymm4, ymm1, [fmask1] ; fraction(b) / 2
; fraction(b) > sqrt(2)
vcmpgtpd ymm1, ymm4, ymm6
vandpd ymm5, ymm1, ymm8
vandnpd ymm7, ymm1, ymm4
vaddpd ymm3, ymm3, ymm5
vaddpd ymm4, ymm4, ymm7
; f = fraction(b) - 1
vsubpd ymm4, ymm4, ymm8
; skip reduction if ymm0 in range
vblendvpd ymm13, ymm13, ymm3, ymm11
vblendvpd ymm14, ymm14, ymm4, ymm11
%%skip:
; x = f / (f + 2)
vaddpd ymm1, ymm14, ymm9
vdivpd ymm1, ymm14, ymm1
vmovapd ymm15, [c15]
vmovapd ymm11, [c11]
vmovapd ymm7, [c7]
vmulpd ymm2, ymm1, ymm1 ; x^2
vmulpd ymm3, ymm2, [c3] ; u3 = c3 * x^2
vmulpd ymm4, ymm2, ymm2 ; x^4
vfmadd213pd ymm15, ymm2, [c13] ; u15 = c15 * x^2 + c13
vfmadd213pd ymm11, ymm2, [c9] ; u11 = c11 * x^2 + c9
vfmadd213pd ymm7, ymm2, [c5] ; u7 = c7 * x^2 + c5
vfmadd213pd ymm15, ymm4, ymm11 ; v15 = u15 * x^4 + u11
vfmadd213pd ymm7, ymm4, ymm3 ; v7 = u7 * x^4 + u3
vmulpd ymm4, ymm4, ymm4
vfmadd213pd ymm15, ymm4, ymm7 ; z15 = v15 * x^8 + v7
%endmacro
%macro select 1 ; implicit input ymm0, ymm15, output ymm15
vcmpltpd ymm1, ymm0, [%{1}_min_a] ; a < min_a
vcmpgtpd ymm2, ymm0, [%{1}_max_a] ; a > max_a
vcmpltpd ymm3, ymm0, [%{1}_nan_a] ; a < nan_a
vcmpneqpd ymm4, ymm0, ymm0 ; a != a
vorpd ymm5, ymm1, ymm2
vorpd ymm5, ymm5, ymm3
vorpd ymm5, ymm5, ymm4
vtestpd ymm5, ymm5
jz %%skip
vblendvpd ymm15, ymm15, [%{1}_min_y], ymm1 ; min_y
vblendvpd ymm15, ymm15, [%{1}_max_y], ymm2 ; max_y
vblendvpd ymm15, ymm15, [%{1}_nan_y], ymm3 ; nan_y
vblendvpd ymm15, ymm15, ymm0, ymm4 ; a
%%skip:
%endmacro
%macro log_constants 0
log1pf_constants
vmovapd ymm10, [ln2]
%endmacro
%macro log 2
vmovupd ymm0, %2
log1pf ymm6, [sqrt2], 1 ; log(1 + f) = f - x * (f - R)
; log(a) = k * log(2) + log(1 + f)
vsubpd ymm15, ymm14, ymm15
vfnmadd213pd ymm15, ymm1, ymm14
vfmadd231pd ymm15, ymm13, ymm10
select log
vmovupd %1, ymm15
%endmacro
%macro log2_constants 0
log1pf_constants
vmovapd ymm10, [ln2inv]
%endmacro
%macro log2 2
vmovupd ymm0, %2
log1pf ymm6, [sqrt2], 1 ; log(1 + f) = f - x * (f - R)
; log2(a) = k + log(1 + f) / log(2)
vsubpd ymm15, ymm14, ymm15
vfnmadd213pd ymm15, ymm1, ymm14
vfmadd213pd ymm15, ymm10, ymm13
select log2
vmovupd %1, ymm15
%endmacro
%macro log10_constants 0
log1pf_constants
vmovapd ymm10, [ln10_2]
vmovapd ymm12, [ln10inv]
%endmacro
%macro log10 2
vmovupd ymm0, %2
log1pf ymm6, [sqrt2], 1 ; log(1 + f) = f - x * (f - R)
; log10(a) = k * log(10) / log(2) + log(1 + f) / log(10)
vsubpd ymm15, ymm14, ymm15
vfnmadd213pd ymm15, ymm1, ymm14
vmulpd ymm13, ymm13, ymm10
vfmadd213pd ymm15, ymm12, ymm13
select log
vmovupd %1, ymm15
%endmacro
%macro log1p_constants 0
log1pf_constants
vmovapd ymm10, [ln2]
%endmacro
%macro log1p 2
vmovupd ymm0, %2
log1pf [sqrt2m2], [sqrt2m1], 0 ; log(1 + f) = f - x * (f - R)
; log(1 + a) = k * log2 + log(1 + f)
vsubpd ymm15, ymm14, ymm15
vfnmadd213pd ymm15, ymm1, ymm14
vfmadd231pd ymm15, ymm13, ymm10
select log1p
vmovupd %1, ymm15
%endmacro
section .rodata
align 32
log_min_a: times 4 dq 0x0010000000000000 ; DBL_MIN
log_max_a: times 4 dq 0x7FEFFFFFFFFFFFFF ; DBL_MAX
log_nan_a: times 4 dq 0x0000000000000000 ; 0.0
log_min_y: times 4 dq 0xFFF0000000000000 ; -HUGE_VAL
log_max_y: times 4 dq 0x7FF0000000000000 ; HUGE_VAL
log_nan_y: times 4 dq 0x7FF8000000000000 ; NaN
log2_min_a: times 4 dq 0x0010000000000000 ; DBL_MIN
log2_max_a: times 4 dq 0x7FEFFFFFFFFFFFFF ; DBL_MAX
log2_nan_a: times 4 dq 0x0000000000000000 ; 0.0
log2_min_y: times 4 dq 0xFFF0000000000000 ; -HUGE_VAL
log2_max_y: times 4 dq 0x7FF0000000000000 ; HUGE_VAL
log2_nan_y: times 4 dq 0x7FF8000000000000 ; NaN
log10_min_a: times 4 dq 0x0010000000000000 ; DBL_MIN
log10_max_a: times 4 dq 0x7FEFFFFFFFFFFFFF ; DBL_MAX
log10_nan_a: times 4 dq 0x0000000000000000 ; 0.0
log10_min_y: times 4 dq 0xFFF0000000000000 ; -HUGE_VAL
log10_max_y: times 4 dq 0x7FF0000000000000 ; HUGE_VAL
log10_nan_y: times 4 dq 0x7FF8000000000000 ; NaN
log1p_min_a: times 4 dq 0xBFEFFFFFFFFFFFFF ; nextafter(-1.0, 0.0)
log1p_max_a: times 4 dq 0x7FEFFFFFFFFFFFFF ; DBL_MAX
log1p_nan_a: times 4 dq 0xBFF0000000000000 ; -1.0
log1p_min_y: times 4 dq 0xFFF0000000000000 ; -HUGE_VAL
log1p_max_y: times 4 dq 0x7FF0000000000000 ; HUGE_VAL
log1p_nan_y: times 4 dq 0x7FF8000000000000 ; NaN
c3: times 4 dq 0x3FE5555555555593
c5: times 4 dq 0x3FD999999997FA04
c7: times 4 dq 0x3FD2492494229359
c9: times 4 dq 0x3FCC71C51D8E78AF
c11: times 4 dq 0x3FC7466496CB03DE
c13: times 4 dq 0x3FC39A09D078C69F
c15: times 4 dq 0x3FC2F112DF3E5244
emask0: times 4 dq 0x4330000000000000 ; 2^52
emask1: times 4 dq 0x43300000000003FF ; 2^52 + 1023
fmask0: times 4 dq 0x000FFFFFFFFFFFFF ; fraction mask
fmask1: times 4 dq 0x3FE0000000000000 ; fraction(a) / 2
one: times 4 dq 0x3FF0000000000000 ; 1.0
two: times 4 dq 0x4000000000000000 ; 2.0
ln2: times 4 dq 0x3FE62E42FEFA39EF ; log(2.0l)
ln2inv: times 4 dq 0x3FF71547652B82FE ; 1.0l / log(2.0l)
ln10_2: times 4 dq 0x3FD34413509F79FF ; log10(2.0l)
ln10inv: times 4 dq 0x3FDBCB7B1526E50E ; 1.0l / log(10.0l)
sqrt2: times 4 dq 0x3FF6A09E667F3BCD ; sqrt(2.0l)
sqrt2by2: times 4 dq 0x3FE6A09E667F3BCD ; sqrt(2.0l) / 2.0l
sqrt2m1: times 4 dq 0x3FDA827999FCEF32 ; sqrt(2.0l) - 1.0l
sqrt2m2: times 4 dq 0xBFD2BEC333018867 ; sqrt(2.0l) / 2.0l - 1.0l
section .text
mckl_vd_log: math_kernel_a1r1 8, log
mckl_vd_log2: math_kernel_a1r1 8, log2
mckl_vd_log10: math_kernel_a1r1 8, log10
mckl_vd_log1p: math_kernel_a1r1 8, log1p
; vim:ft=nasm
| zhouyan/MCKL | lib/asm/log.asm | Assembly | bsd-2-clause | 8,504 |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_start_encode|
EXPORT |vp8_encode_bool|
EXPORT |vp8_stop_encode|
EXPORT |vp8_encode_value|
INCLUDE vpx_vp8_enc_asm_offsets.asm
ARM
REQUIRE8
PRESERVE8
AREA |.text|, CODE, READONLY
; r0 BOOL_CODER *br
; r1 unsigned char *source
|vp8_start_encode| PROC
mov r12, #0
mov r3, #255
mvn r2, #23
str r12, [r0, #vp8_writer_lowvalue]
str r3, [r0, #vp8_writer_range]
str r12, [r0, #vp8_writer_value]
str r2, [r0, #vp8_writer_count]
str r12, [r0, #vp8_writer_pos]
str r1, [r0, #vp8_writer_buffer]
bx lr
ENDP
; r0 BOOL_CODER *br
; r1 int bit
; r2 int probability
|vp8_encode_bool| PROC
push {r4-r9, lr}
mov r4, r2
ldr r2, [r0, #vp8_writer_lowvalue]
ldr r5, [r0, #vp8_writer_range]
ldr r3, [r0, #vp8_writer_count]
sub r7, r5, #1 ; range-1
cmp r1, #0
mul r4, r4, r7 ; ((range-1) * probability)
mov r7, #1
add r4, r7, r4, lsr #8 ; 1 + (((range-1) * probability) >> 8)
addne r2, r2, r4 ; if (bit) lowvalue += split
subne r4, r5, r4 ; if (bit) range = range-split
; Counting the leading zeros is used to normalize range.
clz r6, r4
sub r6, r6, #24 ; shift
; Flag is set on the sum of count. This flag is used later
; to determine if count >= 0
adds r3, r3, r6 ; count += shift
lsl r5, r4, r6 ; range <<= shift
bmi token_count_lt_zero ; if(count >= 0)
sub r6, r6, r3 ; offset = shift - count
sub r4, r6, #1 ; offset-1
lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
bpl token_high_bit_not_set
ldr r4, [r0, #vp8_writer_pos] ; x
sub r4, r4, #1 ; x = w->pos-1
b token_zero_while_start
token_zero_while_loop
mov r9, #0
strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
sub r4, r4, #1 ; x--
token_zero_while_start
cmp r4, #0
ldrge r7, [r0, #vp8_writer_buffer]
ldrb r1, [r7, r4]
cmpge r1, #0xff
beq token_zero_while_loop
ldr r7, [r0, #vp8_writer_buffer]
ldrb r9, [r7, r4] ; w->buffer[x]
add r9, r9, #1
strb r9, [r7, r4] ; w->buffer[x] + 1
token_high_bit_not_set
rsb r4, r6, #24 ; 24-offset
ldr r9, [r0, #vp8_writer_buffer]
lsr r7, r2, r4 ; lowvalue >> (24-offset)
ldr r4, [r0, #vp8_writer_pos] ; w->pos
lsl r2, r2, r6 ; lowvalue <<= offset
mov r6, r3 ; shift = count
add r1, r4, #1 ; w->pos++
bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
str r1, [r0, #vp8_writer_pos]
sub r3, r3, #8 ; count -= 8
strb r7, [r9, r4] ; w->buffer[w->pos++]
token_count_lt_zero
lsl r2, r2, r6 ; lowvalue <<= shift
str r2, [r0, #vp8_writer_lowvalue]
str r5, [r0, #vp8_writer_range]
str r3, [r0, #vp8_writer_count]
pop {r4-r9, pc}
ENDP
; r0 BOOL_CODER *br
|vp8_stop_encode| PROC
push {r4-r10, lr}
ldr r2, [r0, #vp8_writer_lowvalue]
ldr r5, [r0, #vp8_writer_range]
ldr r3, [r0, #vp8_writer_count]
mov r10, #32
stop_encode_loop
sub r7, r5, #1 ; range-1
mov r4, r7, lsl #7 ; ((range-1) * 128)
mov r7, #1
add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8)
; Counting the leading zeros is used to normalize range.
clz r6, r4
sub r6, r6, #24 ; shift
; Flag is set on the sum of count. This flag is used later
; to determine if count >= 0
adds r3, r3, r6 ; count += shift
lsl r5, r4, r6 ; range <<= shift
bmi token_count_lt_zero_se ; if(count >= 0)
sub r6, r6, r3 ; offset = shift - count
sub r4, r6, #1 ; offset-1
lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
bpl token_high_bit_not_set_se
ldr r4, [r0, #vp8_writer_pos] ; x
sub r4, r4, #1 ; x = w->pos-1
b token_zero_while_start_se
token_zero_while_loop_se
mov r9, #0
strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
sub r4, r4, #1 ; x--
token_zero_while_start_se
cmp r4, #0
ldrge r7, [r0, #vp8_writer_buffer]
ldrb r1, [r7, r4]
cmpge r1, #0xff
beq token_zero_while_loop_se
ldr r7, [r0, #vp8_writer_buffer]
ldrb r9, [r7, r4] ; w->buffer[x]
add r9, r9, #1
strb r9, [r7, r4] ; w->buffer[x] + 1
token_high_bit_not_set_se
rsb r4, r6, #24 ; 24-offset
ldr r9, [r0, #vp8_writer_buffer]
lsr r7, r2, r4 ; lowvalue >> (24-offset)
ldr r4, [r0, #vp8_writer_pos] ; w->pos
lsl r2, r2, r6 ; lowvalue <<= offset
mov r6, r3 ; shift = count
add r1, r4, #1 ; w->pos++
bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
str r1, [r0, #vp8_writer_pos]
sub r3, r3, #8 ; count -= 8
strb r7, [r9, r4] ; w->buffer[w->pos++]
token_count_lt_zero_se
lsl r2, r2, r6 ; lowvalue <<= shift
subs r10, r10, #1
bne stop_encode_loop
str r2, [r0, #vp8_writer_lowvalue]
str r5, [r0, #vp8_writer_range]
str r3, [r0, #vp8_writer_count]
pop {r4-r10, pc}
ENDP
; r0 BOOL_CODER *br
; r1 int data
; r2 int bits
|vp8_encode_value| PROC
push {r4-r11, lr}
mov r10, r2
ldr r2, [r0, #vp8_writer_lowvalue]
ldr r5, [r0, #vp8_writer_range]
ldr r3, [r0, #vp8_writer_count]
; reverse the stream of bits to be packed. Normally
; the most significant bit is peeled off and compared
; in the form of (v >> --n) & 1. ARM architecture has
; the ability to set a flag based on the value of the
; bit shifted off the bottom of the register. To make
; that happen the bitstream is reversed.
rbit r11, r1
rsb r4, r10, #32 ; 32-n
; v is kept in r1 during the token pack loop
lsr r1, r11, r4 ; v >>= 32 - n
encode_value_loop
sub r7, r5, #1 ; range-1
; Decisions are made based on the bit value shifted
; off of v, so set a flag here based on this.
; This value is refered to as "bb"
lsrs r1, r1, #1 ; bit = v >> n
mov r4, r7, lsl #7 ; ((range-1) * 128)
mov r7, #1
add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8)
addcs r2, r2, r4 ; if (bit) lowvalue += split
subcs r4, r5, r4 ; if (bit) range = range-split
; Counting the leading zeros is used to normalize range.
clz r6, r4
sub r6, r6, #24 ; shift
; Flag is set on the sum of count. This flag is used later
; to determine if count >= 0
adds r3, r3, r6 ; count += shift
lsl r5, r4, r6 ; range <<= shift
bmi token_count_lt_zero_ev ; if(count >= 0)
sub r6, r6, r3 ; offset = shift - count
sub r4, r6, #1 ; offset-1
lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 )
bpl token_high_bit_not_set_ev
ldr r4, [r0, #vp8_writer_pos] ; x
sub r4, r4, #1 ; x = w->pos-1
b token_zero_while_start_ev
token_zero_while_loop_ev
mov r9, #0
strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0
sub r4, r4, #1 ; x--
token_zero_while_start_ev
cmp r4, #0
ldrge r7, [r0, #vp8_writer_buffer]
ldrb r11, [r7, r4]
cmpge r11, #0xff
beq token_zero_while_loop_ev
ldr r7, [r0, #vp8_writer_buffer]
ldrb r9, [r7, r4] ; w->buffer[x]
add r9, r9, #1
strb r9, [r7, r4] ; w->buffer[x] + 1
token_high_bit_not_set_ev
rsb r4, r6, #24 ; 24-offset
ldr r9, [r0, #vp8_writer_buffer]
lsr r7, r2, r4 ; lowvalue >> (24-offset)
ldr r4, [r0, #vp8_writer_pos] ; w->pos
lsl r2, r2, r6 ; lowvalue <<= offset
mov r6, r3 ; shift = count
add r11, r4, #1 ; w->pos++
bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff
str r11, [r0, #vp8_writer_pos]
sub r3, r3, #8 ; count -= 8
strb r7, [r9, r4] ; w->buffer[w->pos++]
token_count_lt_zero_ev
lsl r2, r2, r6 ; lowvalue <<= shift
subs r10, r10, #1
bne encode_value_loop
str r2, [r0, #vp8_writer_lowvalue]
str r5, [r0, #vp8_writer_range]
str r3, [r0, #vp8_writer_count]
pop {r4-r11, pc}
ENDP
END
| rowboat/external-libvpx | vp8/encoder/arm/neon/boolhuff_armv7.asm | Assembly | bsd-3-clause | 9,971 |
; Copyright (c) 2008-2009, diamond
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> 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 Alexey Teplov aka <Lrz> ''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 <copyright holder> 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.
;*****************************************************************************
use_lba = 0
org 0x7C00
jmp start
nop
; FAT parameters, BPB
; note: they can be changed at install, replaced with real values
; these settings are for most typical 1.44M floppies
db 'KOLIBRI ' ; BS_OEMName, ignored
dw 200h ; BPB_BytsPerSec
BPB_SecsPerClus db 1
BPB_RsvdSecCnt dw 1
BPB_NumFATs db 2
BPB_RootEntCnt dw 0xE0
dw 2880 ; BPB_TotSec16
db 0xF0 ; BPB_Media
BPB_FATSz16 dw 9
BPB_SecPerTrk dw 18
BPB_NumHeads dw 2
BPB_HiddSec dd 0
dd 0 ; BPB_TotSec32
BS_DrvNum db 0
db 0 ; BS_Reserved1
db ')' ; BS_BootSig
dd 12344321h ; BS_VolID
filename:
db 'KORD.OS ' ; BS_VolLab
db 'FAT12 ' ; BS_FilSysType
; Used memory map:
; 8000:0000 - current directory
; 9000:0000 - root directory data [cached]
start:
xor ax, ax
mov ss, ax
mov sp, 0x7C00
mov ds, ax
mov bp, sp
cld
sti
mov [bp+BS_DrvNum-0x7C00], dl
if use_lba
mov ah, 41h
mov bx, 55AAh
int 13h
mov si, aNoLBA
jc err_
cmp bx, 0AA55h
jnz err_
test cx, 1
jz err_
else
mov ah, 8
int 13h
jc @f ; on error, assume that BPB geometry is valid
mov al, dh
mov ah, 0
inc ax
mov [bp+BPB_NumHeads-0x7C00], ax
and cx, 3Fh
mov [bp+BPB_SecPerTrk-0x7C00], cx
@@:
end if
; get FAT parameters
xor bx, bx
mov al, [bp+BPB_NumFATs-0x7C00]
mov ah, 0
mul [bp+BPB_FATSz16-0x7C00]
add ax, [bp+BPB_RsvdSecCnt-0x7C00]
adc dx, bx
push dx
push ax ; root directory start = dword [bp-4]
mov cx, [bp+BPB_RootEntCnt-0x7C00]
add cx, 0xF
rcr cx, 1
shr cx, 3 ; cx = size of root directory in sectors
add ax, cx
adc dx, bx
push dx
push ax ; data start = dword [bp-8]
; load start of root directory (no more than 0x2000 bytes = 0x10 sectors)
cmp cx, 0x10
jb @f
mov cx, 0x10
@@:
mov ax, [bp-4]
mov dx, [bp-2]
push 0x9000
pop es
call read_sectors
add word [bp-4], cx ; dword [bp-4] = start of non-cached root data
adc word [bp-2], bx
; load kordldr.f12
mov si, main_loader
call lookup_in_root_dir
jc noloader
test byte [es:di+11], 10h ; directory?
jz kordldr_ok
noloader:
mov si, aLoaderNotFound
err_:
call out_string
mov si, aPressAnyKey
call out_string
xor ax, ax
int 16h
int 18h
jmp $
kordldr_ok:
mov ax, [es:di+26] ; get file cluster
mov bx, 0x7E00
xor cx, cx
mov es, cx
sub ax, 2
jc noloader
push bx ; save return address: bx = 7E00
mov cl, [bp+BPB_SecsPerClus-0x7C00]
mul cx
; fall through - 'ret' in read_sectors will return to 7E00
read_sectors2:
; same as read_sectors, but dx:ax is relative to start of data
add ax, [bp-8]
adc dx, [bp-6]
read_sectors:
; ss:bp = 0:7C00
; es:bx = pointer to data
; dx:ax = first sector
; cx = number of sectors
pusha
add ax, word [bp+BPB_HiddSec-0x7C00]
adc dx, word [bp+BPB_HiddSec+2-0x7C00]
if use_lba
push ds
do_read_sectors:
push ax
push cx
push dx
cmp cx, 0x7F
jbe @f
mov cx, 0x7F
@@:
; create disk address packet on the stack
; dq starting LBA
push 0
push 0
push dx
push ax
; dd buffer
push es
push bx
; dw number of blocks to transfer (no more than 0x7F)
push cx
; dw packet size in bytes
push 10h
; issue BIOS call
push ss
pop ds
mov si, sp
mov dl, [bp+BS_DrvNum-0x7C00]
mov ah, 42h
int 13h
mov si, aReadError
jc err_
; restore stack
add sp, 10h
; increase current sector & buffer; decrease number of sectors
mov si, cx
mov ax, es
shl cx, 5
add ax, cx
mov es, ax
pop dx
pop cx
pop ax
add ax, si
adc dx, 0
sub cx, si
jnz do_read_sectors
pop ds
popa
ret
else
do_read_sectors:
pusha
pop di
push bx
; (dword in dx:ax) / (SectorsPerTrack) -> (dword in dx:ax), remainder bx
mov si, ax
xchg ax, dx
xor dx, dx
div [bp+BPB_SecPerTrk-0x7C00]
push ax
mov ax, si
div [bp+BPB_SecPerTrk-0x7C00]
mov bx, dx ; bx=sector-1
pop dx
; (dword in dx:ax) / (NumHeads) -> (word in ax), remainder dx
div [bp+BPB_NumHeads-0x7C00]
; number of sectors: read no more than to end of track
push bx
sub bx, [bp+BPB_SecPerTrk-0x7C00]
neg bx
cmp cx, bx
jbe @f
mov cx, bx
@@:
pop bx
inc bx
; now ax=track, dl=head, dh=0, cl=number of sectors, ch=0, bl=sector; convert to int13 format
mov di, cx
mov dh, dl
mov dl, [bp+BS_DrvNum-0x7C00]
shl ah, 6
mov ch, al
mov al, cl
mov cl, bl
or cl, ah
pop bx
mov si, 3
mov ah, 2
@@:
push ax
int 13h
jnc @f
xor ax, ax
int 13h ; reset drive
pop ax
dec si
jnz @b
mov si, aReadError
jmp err_
@@:
pop ax
mov ax, es
mov cx, di
shl cx, 5
add ax, cx
mov es, ax
push di
popa
add ax, di
adc dx, 0
sub cx, di
jnz do_read_sectors
popa
ret
end if
scan_for_filename:
; in: ds:si -> 11-bytes FAT name
; in: es:0 -> part of directory data
; in: cx = number of entries
; out: if found: CF=0, ZF=1, es:di -> directory entry
; out: if not found, but continue required: CF=1 and ZF=0
; out: if not found and zero item reached: CF=1 and ZF=1
xor di, di
push cx
sloop:
cmp byte [es:di], 0
jz snotfound
test byte [es:di+11], 8 ; volume label?
jnz scont ; ignore volume labels
pusha
mov cx, 11
repz cmpsb
popa
jz sdone
scont:
add di, 0x20
loop sloop
inc cx ; clear ZF flag
snotfound:
stc
sdone:
pop cx
lrdret:
ret
lookup_in_root_dir:
; ss:bp = 0:7C00
; in: ds:si -> 11-bytes FAT name
; out: if found: CF=0, es:di -> directory entry
; out: if not found: CF=1
mov cx, [bp+BPB_RootEntCnt-0x7C00]
push cx
; first, look in root directory cache
push 0x9000
pop es
test ch, ch
jz @f
mov cx, 0x100
@@:
mov ax, [bp-4]
mov dx, [bp-2] ; dx:ax = starting sector of not cached data of root directory
lrdloop:
call scan_for_filename
pop bx
jz lrdret
sub bx, cx
mov cx, bx
stc
jz lrdret
; read no more than 0x10000 bytes, or 0x10000/0x20 = 0x800 entries
push cx
cmp ch, 0x8
jb @f
mov cx, 0x800
@@:
push 0x8000
pop es
push cx
push es
xor bx, bx
add cx, 0xF
shr cx, 4
call read_sectors
pop es
add ax, cx
adc dx, bx
pop cx
jmp lrdloop
out_string:
; in: ds:si -> ASCIIZ string
lodsb
test al, al
jz lrdret
mov ah, 0Eh
mov bx, 7
int 10h
jmp out_string
aReadError db 'Read error',0
if use_lba
aNoLBA db 'The drive does not support LBA!',0
end if
aLoaderNotFound db 'Loader not found',0
aPressAnyKey db 13,10,'Press any key...',13,10,0
main_loader db 'KORDLDR F1X'
if use_lba
db 0 ; make bootsector 512 bytes in length
end if
; bootsector signature
dw 0xAA55
; display offsets of all procedures used by kordldr.f12.asm
macro show [procedure]
{
bits = 16
display `procedure,' = '
repeat bits/4
d = '0' + procedure shr (bits - %*4) and 0Fh
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
show read_sectors, read_sectors2, lookup_in_root_dir, scan_for_filename, err_, noloader
| devlato/kolibrios-llvm | kernel/tags/kolibri0.7.7.0/sec_loader/trunk/boot/fat1x/bootsect.asm | Assembly | mit | 11,246 |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
EXPORT |vp8_sub_pixel_variance8x8_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr,
; r1 int src_pixels_per_line,
; r2 int xoffset,
; r3 int yoffset,
; stack(r4) unsigned char *dst_ptr,
; stack(r5) int dst_pixels_per_line,
; stack(r6) unsigned int *sse
;note: most of the code is copied from bilinear_predict8x8_neon and vp8_variance8x8_neon.
|vp8_sub_pixel_variance8x8_neon| PROC
push {r4-r5, lr}
adr r12, BilinearTaps_coeff
ldr r4, [sp, #12] ;load *dst_ptr from stack
ldr r5, [sp, #16] ;load dst_pixels_per_line from stack
ldr lr, [sp, #20] ;load *sse from stack
cmp r2, #0 ;skip first_pass filter if xoffset=0
beq skip_firstpass_filter
;First pass: output_height lines x output_width columns (9x8)
add r2, r12, r2, lsl #3 ;calculate filter location
vld1.u8 {q1}, [r0], r1 ;load src data
vld1.u32 {d31}, [r2] ;load first_pass filter
vld1.u8 {q2}, [r0], r1
vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
vld1.u8 {q3}, [r0], r1
vdup.8 d1, d31[4]
vld1.u8 {q4}, [r0], r1
vmull.u8 q6, d2, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q7, d4, d0
vmull.u8 q8, d6, d0
vmull.u8 q9, d8, d0
vext.8 d3, d2, d3, #1 ;construct src_ptr[-1]
vext.8 d5, d4, d5, #1
vext.8 d7, d6, d7, #1
vext.8 d9, d8, d9, #1
vmlal.u8 q6, d3, d1 ;(src_ptr[1] * Filter[1])
vmlal.u8 q7, d5, d1
vmlal.u8 q8, d7, d1
vmlal.u8 q9, d9, d1
vld1.u8 {q1}, [r0], r1 ;load src data
vqrshrn.u16 d22, q6, #7 ;shift/round/saturate to u8
vld1.u8 {q2}, [r0], r1
vqrshrn.u16 d23, q7, #7
vld1.u8 {q3}, [r0], r1
vqrshrn.u16 d24, q8, #7
vld1.u8 {q4}, [r0], r1
vqrshrn.u16 d25, q9, #7
;first_pass filtering on the rest 5-line data
vld1.u8 {q5}, [r0], r1
vmull.u8 q6, d2, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q7, d4, d0
vmull.u8 q8, d6, d0
vmull.u8 q9, d8, d0
vmull.u8 q10, d10, d0
vext.8 d3, d2, d3, #1 ;construct src_ptr[-1]
vext.8 d5, d4, d5, #1
vext.8 d7, d6, d7, #1
vext.8 d9, d8, d9, #1
vext.8 d11, d10, d11, #1
vmlal.u8 q6, d3, d1 ;(src_ptr[1] * Filter[1])
vmlal.u8 q7, d5, d1
vmlal.u8 q8, d7, d1
vmlal.u8 q9, d9, d1
vmlal.u8 q10, d11, d1
vqrshrn.u16 d26, q6, #7 ;shift/round/saturate to u8
vqrshrn.u16 d27, q7, #7
vqrshrn.u16 d28, q8, #7
vqrshrn.u16 d29, q9, #7
vqrshrn.u16 d30, q10, #7
;Second pass: 8x8
secondpass_filter
cmp r3, #0 ;skip second_pass filter if yoffset=0
;skip_secondpass_filter
beq sub_pixel_variance8x8_neon
add r3, r12, r3, lsl #3
vld1.u32 {d31}, [r3] ;load second_pass filter
vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
vdup.8 d1, d31[4]
vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q2, d23, d0
vmull.u8 q3, d24, d0
vmull.u8 q4, d25, d0
vmull.u8 q5, d26, d0
vmull.u8 q6, d27, d0
vmull.u8 q7, d28, d0
vmull.u8 q8, d29, d0
vmlal.u8 q1, d23, d1 ;(src_ptr[pixel_step] * Filter[1])
vmlal.u8 q2, d24, d1
vmlal.u8 q3, d25, d1
vmlal.u8 q4, d26, d1
vmlal.u8 q5, d27, d1
vmlal.u8 q6, d28, d1
vmlal.u8 q7, d29, d1
vmlal.u8 q8, d30, d1
vqrshrn.u16 d22, q1, #7 ;shift/round/saturate to u8
vqrshrn.u16 d23, q2, #7
vqrshrn.u16 d24, q3, #7
vqrshrn.u16 d25, q4, #7
vqrshrn.u16 d26, q5, #7
vqrshrn.u16 d27, q6, #7
vqrshrn.u16 d28, q7, #7
vqrshrn.u16 d29, q8, #7
b sub_pixel_variance8x8_neon
;--------------------
skip_firstpass_filter
vld1.u8 {d22}, [r0], r1 ;load src data
vld1.u8 {d23}, [r0], r1
vld1.u8 {d24}, [r0], r1
vld1.u8 {d25}, [r0], r1
vld1.u8 {d26}, [r0], r1
vld1.u8 {d27}, [r0], r1
vld1.u8 {d28}, [r0], r1
vld1.u8 {d29}, [r0], r1
vld1.u8 {d30}, [r0], r1
b secondpass_filter
;----------------------
;vp8_variance8x8_neon
sub_pixel_variance8x8_neon
vmov.i8 q8, #0 ;q8 - sum
vmov.i8 q9, #0 ;q9, q10 - sse
vmov.i8 q10, #0
mov r12, #2
sub_pixel_variance8x8_neon_loop
vld1.8 {d0}, [r4], r5 ;load dst data
subs r12, r12, #1
vld1.8 {d1}, [r4], r5
vld1.8 {d2}, [r4], r5
vsubl.u8 q4, d22, d0 ;calculate diff
vld1.8 {d3}, [r4], r5
vsubl.u8 q5, d23, d1
vsubl.u8 q6, d24, d2
vpadal.s16 q8, q4 ;sum
vmlal.s16 q9, d8, d8 ;sse
vmlal.s16 q10, d9, d9
vsubl.u8 q7, d25, d3
vpadal.s16 q8, q5
vmlal.s16 q9, d10, d10
vmlal.s16 q10, d11, d11
vmov q11, q13
vpadal.s16 q8, q6
vmlal.s16 q9, d12, d12
vmlal.s16 q10, d13, d13
vmov q12, q14
vpadal.s16 q8, q7
vmlal.s16 q9, d14, d14
vmlal.s16 q10, d15, d15
bne sub_pixel_variance8x8_neon_loop
vadd.u32 q10, q9, q10 ;accumulate sse
vpaddl.s32 q0, q8 ;accumulate sum
vpaddl.u32 q1, q10
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [lr] ;store sse
vshr.s32 d10, d10, #6
vsub.s32 d0, d1, d10
vmov.32 r0, d0[0] ;return
pop {r4-r5, pc}
ENDP
;-----------------
bilinear_taps_coeff
DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
END
| thiz11/platform_external_libvpx | vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm | Assembly | bsd-3-clause | 7,053 |
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
;; See the LICENSE file in the project root for more information.
#include "AsmMacros.h"
EXTERN RhpShutdownHelper
EXTERN GetClasslibCCtorCheck
EXTERN memcpy
EXTERN memcpyGCRefs
EXTERN memcpyGCRefsWithWriteBarrier
EXTERN memcpyAnyWithWriteBarrier
TEXTAREA
;;
;; Currently called only from a managed executable once Main returns, this routine does whatever is needed to
;; cleanup managed state before exiting.
;;
;; Input:
;; r0 : Process exit code
;;
NESTED_ENTRY RhpShutdown
COOP_PINVOKE_FRAME_PROLOG
;; Call the bulk of the helper implemented in C++. Takes the exit code already in r0.
bl RhpShutdownHelper
COOP_PINVOKE_FRAME_EPILOG
NESTED_END RhpShutdown
;;
;; Checks whether the static class constructor for the type indicated by the context structure has been
;; executed yet. If not the classlib is called via their CheckStaticClassConstruction callback which will
;; execute the cctor and update the context to record this fact.
;;
;; Input:
;; r0 : Address of StaticClassConstructionContext structure
;;
;; Output:
;; All volatile registers and the condition codes may be trashed.
;;
LEAF_ENTRY RhpCheckCctor
;; Check the m_initialized field of the context. The cctor has been run only if this equals 1 (the
;; initial state is 0 and the remaining values are reserved for classlib use). This check is
;; unsynchronized; if we go down the slow path and call the classlib then it is responsible for
;; synchronizing with other threads and re-checking the value.
ldr r12, [r0, #OFFSETOF__StaticClassConstructionContext__m_initialized]
cmp r12, #1
bne RhpCheckCctor__SlowPath
bx lr
RhpCheckCctor__SlowPath
mov r1, r0
b RhpCheckCctor2 ; tail-call the check cctor helper that actually has an implementation to call
; the cctor
LEAF_END RhpCheckCctor
;;
;; Checks whether the static class constructor for the type indicated by the context structure has been
;; executed yet. If not the classlib is called via their CheckStaticClassConstruction callback which will
;; execute the cctor and update the context to record this fact.
;;
;; Input:
;; r0 : Value that must be preserved in this register across the cctor check.
;; r1 : Address of StaticClassConstructionContext structure
;;
;; Output:
;; All volatile registers other than r0 may be trashed and the condition codes may also be trashed.
;;
LEAF_ENTRY RhpCheckCctor2
;; Check the m_initialized field of the context. The cctor has been run only if this equals 1 (the
;; initial state is 0 and the remaining values are reserved for classlib use). This check is
;; unsynchronized; if we go down the slow path and call the classlib then it is responsible for
;; synchronizing with other threads and re-checking the value.
ldr r12, [r1, #OFFSETOF__StaticClassConstructionContext__m_initialized]
cmp r12, #1
bne RhpCheckCctor2__SlowPath
bx lr
LEAF_END RhpCheckCctor2
;;
;; Slow path helper for RhpCheckCctor.
;;
;; Input:
;; r0 : Value that must be preserved in this register across the cctor check.
;; r1 : Address of StaticClassConstructionContext structure
;;
;; Output:
;; All volatile registers other than r0 may be trashed and the condition codes may also be trashed.
;;
NESTED_ENTRY RhpCheckCctor2__SlowPath
;; Need to preserve r0, r1 and lr across helper call. r2 is also pushed to keep the stack 8 byte aligned.
PROLOG_PUSH {r0-r2,lr}
;; Call a C++ helper to retrieve the address of the classlib callback. The caller's return address is
;; passed as the argument to the helper; it's an address in the module and is used by the helper to
;; locate the classlib.
mov r0, lr
bl GetClasslibCCtorCheck
;; R0 now contains the address of the classlib method to call. The single argument is the context
;; structure address currently in stashed on the stack. Clean up and tail call to the classlib
;; callback so we're not on the stack should a GC occur (so we don't need to worry about transition
;; frames).
mov r12, r0
EPILOG_POP {r0-r2,lr}
;; tail-call the class lib cctor check function. This function is required to return its first
;; argument, so that r0 can be preserved.
EPILOG_BRANCH_REG r12
NESTED_END RhpCheckCctor__SlowPath2
;;
;; Input:
;; r0: address of location on stack containing return address.
;;
;; Outpt:
;; r0: proper (unhijacked) return address
;;
;; Trashes: r1, r2
;;
LEAF_ENTRY RhpLoadReturnAddress
INLINE_GETTHREAD r1, r2
ldr r2, [r1, #OFFSETOF__Thread__m_ppvHijackedReturnAddressLocation]
cmp r0, r2
beq GetHijackedReturnAddress
ldr r0, [r0]
bx lr
GetHijackedReturnAddress
ldr r0, [r1, #OFFSETOF__Thread__m_pvHijackedReturnAddress]
bx lr
LEAF_END RhpLoadReturnAddress
;;
;; r0 = output buffer (an IntPtr[] managed object)
;;
NESTED_ENTRY RhGetCurrentThreadStackTrace
COOP_PINVOKE_FRAME_PROLOG
;; pass-through argument registers
bl RhpCalculateStackTraceWorker
nop ; debugger bug workaround, this fixes the stack trace
COOP_PINVOKE_FRAME_EPILOG
NESTED_END RhGetCurrentThreadStackTrace
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* RhpCopyMultibyteNoGCRefs(void*, void*, size_t)
;;
;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where
;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch
;; it to managed code.
;;
LEAF_ENTRY RhpCopyMultibyteNoGCRefs
; r0 dest
; r1 src
; r2 count
cmp r2, #0 ; check for a zero-length copy
beq NothingToCopy_NoGCRefs
; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV,
; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be
; translated to a managed exception as usual.
ALTERNATE_ENTRY RhpCopyMultibyteNoGCRefsDestAVLocation
ldrb r3, [r0]
ALTERNATE_ENTRY RhpCopyMultibyteNoGCRefsSrcAVLocation
ldrb r3, [r1]
; tail-call to plain-old-memcpy
b memcpy
NothingToCopy_NoGCRefs
; dest is already still in r0
bx lr
LEAF_END
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* RhpCopyMultibyte(void*, void*, size_t)
;;
;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where
;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch
;; it to managed code.
;;
LEAF_ENTRY RhpCopyMultibyte
; r0 dest
; r1 src
; r2 count
cmp r2, #0 ; check for a zero-length copy
beq NothingToCopy_RhpCopyMultibyte
; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV,
; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be
; translated to a managed exception as usual.
ALTERNATE_ENTRY RhpCopyMultibyteDestAVLocation
ldrb r3, [r0]
ALTERNATE_ENTRY RhpCopyMultibyteSrcAVLocation
ldrb r3, [r1]
; tail-call to the GC-safe memcpy implementation
b memcpyGCRefs
NothingToCopy_RhpCopyMultibyte
; dest is already still in r0
bx lr
LEAF_END
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* RhpCopyMultibyteWithWriteBarrier(void*, void*, size_t)
;;
;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where
;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch
;; it to managed code.
;; Runs a card table update via RhpBulkWriteBarrier after the copy
;;
LEAF_ENTRY RhpCopyMultibyteWithWriteBarrier
; r0 dest
; r1 src
; r2 count
cmp r2, #0 ; check for a zero-length copy
beq NothingToCopy_RhpCopyMultibyteWithWriteBarrier
; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV,
; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be
; translated to a managed exception as usual.
ALTERNATE_ENTRY RhpCopyMultibyteWithWriteBarrierDestAVLocation
ldrb r3, [r0]
ALTERNATE_ENTRY RhpCopyMultibyteWithWriteBarrierSrcAVLocation
ldrb r3, [r1]
; tail-call to the GC-safe memcpy implementation
b memcpyGCRefsWithWriteBarrier
NothingToCopy_RhpCopyMultibyteWithWriteBarrier
; dest is already still in r0
bx lr
LEAF_END
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; void* RhpCopyAnyWithWriteBarrier(void*, void*, size_t)
;;
;; The purpose of this wrapper is to hoist the potential null reference exceptions of copying memory up to a place where
;; the stack unwinder and exception dispatch can properly transform the exception into a managed exception and dispatch
;; it to managed code.
;; Runs a card table update via RhpBulkWriteBarrier after the copy if it contained GC pointers
;;
LEAF_ENTRY RhpCopyAnyWithWriteBarrier
; r0 dest
; r1 src
; r2 count
cmp r2, #0 ; check for a zero-length copy
beq NothingToCopy_RhpCopyAnyWithWriteBarrier
; Now check the dest and src pointers. If they AV, the EH subsystem will recognize the address of the AV,
; unwind the frame, and fixup the stack to make it look like the (managed) caller AV'ed, which will be
; translated to a managed exception as usual.
ALTERNATE_ENTRY RhpCopyAnyWithWriteBarrierDestAVLocation
ldrb r3, [r0]
ALTERNATE_ENTRY RhpCopyAnyWithWriteBarrierSrcAVLocation
ldrb r3, [r1]
; tail-call to the GC-safe memcpy implementation
b memcpyAnyWithWriteBarrier
NothingToCopy_RhpCopyAnyWithWriteBarrier
; dest is already still in r0
bx lr
LEAF_END
end
| schellap/corert | src/Native/Runtime/arm/MiscStubs.asm | Assembly | mit | 11,240 |
; ASMJITR.ASM: Just-In-Time compiler for the Abstract Machine of the "Pawn"
; scripting language
; (C) 1999-2000, Marc Peter; beta version; provided AS IS WITHOUT ANY WARRANTIES
; I reached >155 million instr./sec on my AMD K6-2/366 with the Hanoi "bench"
; (27 disks, no output, DOS4/GW under Win95) with this implementation of the
; JIT compiler.
; NOTE 1:
; There is only one pass implemented in this version. This means there is no
; way of knowing the size of the compiled code before it has actually been com-
; piled. So the only chance the caller has, is to count the number of opcodes
; (in amx_BrowseRelocate()) and multiply this count with a "safe" factor to
; obtain a size value big enough to hold the entire code (and data, including
; the stack and heap, after adding their sizes). Afterwards it can realloc()
; this memory block to the actually needed smaller size.
; NOTE 2:
; The compiler destroys the opcode addresses of the given source by storing the
; respective compiled code's addresses there for the final address relocation
; step.
; NOTE 3:
; During execution of the compiled code with amx_exec_jit() the x86 processor's
; stack is switched into the data section of the abstract machine. This means
; that there should always be enough memory left between HEA and STK to provide
; stack space for occurring interrupts! (see the STACKRESERVE variable)
; NOTE 4:
; Although the Pawn compiler doesn't generate the LCTRL, SCTRL and CALL.I
; instructions, I have to tell that they don't work as expected in a JIT
; compiled program, because there is no easy way of transforming AMX code
; addresses and JIT translated ones. This might be fixed in a future version.
; NX ("No eXecute") and XD (eXecution Denied) bits
; (by Thiadmer Riemersma)
;
; AMD defined a bit "No eXecute" for the page table entries (for its 64-bit
; processors) and Intel came with the same design, but calling it differently.
; The purpose is to make "buffer overrun" security holes impossible, or at least
; very, very difficult, by marking the stack and the heap as memory regions
; such that an attempt to execute processor instructions will cause a processor
; exception (of course, a buffer overrun that is not explictly handled will then
; crash the application --instead of executing the rogue code).
;
; For JIT compilers, this has the impact that you are not allowed to execute the
; code that the JIT has generated. To do that, you must adjust the attributes
; for the memory page. For Microsoft Windows, you can use VirtualAlloc() to
; allocate a memory block with the appropriate fags; on Linux (with a recent
; kernel), you would use vmalloc_exec(). Microsoft Windows also offers the
; function VirtualProtect() to change the page attributes of an existing memory
; block, but there are caveats in its use: if the block spans multiple pages,
; these pages must be consecutive, and if there are blocks of memory in a page
; unrelated to the JIT, their page attributes will change too.
;
; The JIT compiler itself requires only read-write access (this is the default
; for a memory block that you allocate). The execution of the JIT-compiled code
; requires full access to the memory block: read, write and execute. It needs
; write access, because the SYSREQ.C opcode is patched to SYSREQ.D after the
; first lookup (this is an optimization, look up the address of the native
; function only once). For processors that do not support the NX/XD bit,
; execution of code is implicitly supported if read access is supported.
;
; During compilation, the JIT compiler requires write-access to its own code
; segment: the JIT-compiler patches P-code parameters into its own code segment
; during compilation. This is handled in the support code for amx_InitJIT.
;
;
; CALLING CONVENTIONS
; (by Thiadmer Riemersma)
;
; This version is the JIT that uses the "register calling convention" (which is
; particular for Watcom C/C++) both for the calling convention for the _asm_runJIT
; routine itself as for the callback functions. See the other files amxJit*.asm
; for implementations with other calling conventions.
; Revision History
; ----------------
; 28 july 2005
; Bug fix for the switch table, in the situation where only the default
; case was present. Bug found by Bailopan.
; 17 february 2005 by Thiadmer Riemersma (TR)
; Addition of the BREAK opcode, removal of the older debugging opcode
; table. There should now be some debug support (if enabled during the
; build of the JIT compiler), but not enough to run a debugger: the JIT
; compiler does not keep a list that relates the code addresses of the
; P-code versus the native code.
; 6 march 2004 by Thiadmer Riemersma
; Corrected a bug in OP_FILL, where a cell preceding the array would
; be overwritten (zero'ed out). This bug was brought to my attention
; by Robert Daniels.
; 22 december 2003 by Thiadmer Riemersma (TR)
; Added the SYMTAG and SYSCALL.D opcodes (these are not really supported;
; SYMTAG is a no-op)
; 14 October 2002 by Thiadmer Riemersma (TR)
; Corrected the amx_s structure. The _hlw field was missing, which caused
; errors for arguments to native functions that were passed by reference.
; 2002/08/05 TR
; * store the status of the abstract machine in the AMX structure upon
; return, so that the machine can be restarted (OP_SLEEP)
; * added OP_NOP (for alignment, it is ignored by the JIT)
; * make sure the JIT does not crash when we NULL is passed for the
; return value
; 2000/03/03 MP
; * added SRANGE as a no-op, so debugging info doesn't upset the JIT
; compiler anymore
; * added note about LCTRL, SCTRL and CALL.I
; * removed some rather unnecessary pops in the epilog of amx_exec_asm
; * changed the template for CALL into a DB byte sequence (tasm 4.1
; didn't like the immediate value)
; 1999/12/07 MP
; * fixed crash caused by JIT compiler not saving registers
; 1999/08/06 MP - design change: closer to the "iron" with native stack
; * The JIT compiler now generates relocatable code for case tables by
; setting FORCERELOCATABLE = 1.
; * removed all debug hook code
; * exchanged meaning of ESP and ESI in asm_exec(): now low-level calls/
; pushes/pops are possible
; * removed the run-time functions for the CALL, CALL_I and RET op-codes,
; they are now inline
; * All these changes gained around 80% performance increase for the
; hanoi bench.
; 1999/08/05 MP
; * fixed OP_LINE in the case of NODBGCALLS==1, where no compiled address
; was stored for the LINE byte code (i.e. SWITCH would jump to totally
; wrong addresses). The same fix was applied to OP_FILL, OP_FILE and
; OP_SCTRL (for the no-op case).
; 1999/08/04 MP
; * updated with 4 new opcodes (SRANGE does nothing at the moment; 2dim.
; arrays have not been tested.)
; * hacked relocation code to support absoulute addresses for CASETBL
; (This assumes that no generated address will be greater than
; 0x7fffffff. Bit no. 31 is used as flag for absolute addresses.)
; * The run-time function for SWITCH uses a (hopefully) faster algorithm
; to compute the destination address: It searches backwards now.
; 1999/07/08 MP - initial revision
.386
.MODEL FLAT
IFDEF @Version ; for Microsoft MASM 6.x
OPTION OLDSTRUCTS
OPTION M510
ENDIF
;
; Support for the BREAK opcode (callback to the debugger): 0 = no, all other
; values = yes. Beware that the compiled code runs slower when this is enabled,
; and that debug support is still fairly minimal.
;
DEBUGSUPPORT = 0
;
; If this is set to 1 the JIT generates relocatable code for case tables, too.
; If set to 0, a faster variant for switch (using absolute addresses) is
; generated. I consider setting it to 0 a bad idea.
;
FORCERELOCATABLE = 1
;
; Determines how much memory should be reserved for occurring interrupts.
; If my memory serves me right, DOS4/G(W) provides a stack of 512 bytes
; for interrupts that occur in real mode and are promoted to protected mode.
; This value _MUST_ be greater than 64 (for AMX needs) and should be at least
; 128 (to serve interrupts).
;
STACKRESERVE = 256
;
; This variable controls the generation of memory range checks at run-time.
; You should set this to 0, only when you are sure that there are no range
; violations in your Pawn programs and you really need those 5% speed gain.
;
DORUNTIMECHECKS = 1
IFNDEF JIT
JIT = 1
ENDIF
INCLUDE amxdef.asm
;
; #define PUSH(v) ( stk-=sizeof(cell), *(cell *)(data+(int)stk)=v )
;
_PUSH MACRO v
push DWORD ptr v
ENDM
;
; #define POP(v) ( v=*(cell *)(data+(int)stk), stk+=sizeof(cell) )
;
_POP MACRO v
pop DWORD ptr v
ENDM
;
; For determining the biggest native code section generated for ONE Pawn
; opcode. (See the following macro and the PUBLIC function getMaxCodeSize().)
;
MAXCODESIZE = 0
;
; This is the work horse of the whole JIT: It actually copies the code.
;
GO_ON MACRO from, to, opsize ;opsize may be 4, 8 or 12 (default=4)
mov esi,OFFSET from ;get source address of JIT code
CODESIZE = to-from
mov ecx,CODESIZE ;get number of bytes to copy
;all the following could (should?) be in a sub-routine...
;determining the maximum size of a single code snippet
IF MAXCODESIZE LT CODESIZE
MAXCODESIZE = CODESIZE
ENDIF
mov [ebx],edi ;store address for jump-correction
IFB <opsize> ;add operand size to the source ptr
add ebx,4
ELSE
add ebx,opsize
ENDIF
rep movsb
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ;go on with the next opcode
ENDM
;
; Modify the argument of an x86 instruction with the Pawn opcode's parameter
; before copying the code.
;
putval MACRO where
mov eax,[ebx+4]
mov DWORD ptr [where],eax
ENDM
;
; Add an entry to the table of addresses which have to be relocated after the
; code compilation is done.
;
RELOC MACRO adr, dest
mov ebp,[reloc_num]
IFB <dest>
mov eax,[ebx+4]
ELSE
lea eax,[dest]
ENDIF
mov [edx+ebp],eax ; write absolute destination
lea eax,[edi+adr]
mov [edx+ebp+4],eax ; write address of jump operand
add DWORD ptr [reloc_num],8
ENDM
.CODE
PUBLIC asm_runJIT_
PUBLIC amx_exec_jit_
PUBLIC getMaxCodeSize_
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; void asm_runJIT( AMX_HEADER *amxh, JumpAddressArray *jumps, void *dest ) ;
; eax edx ebx ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; asm_runJIT() assumes that the code of this module is allready browsed and
; relocated for the JIT compiler. It also assumes that both the jumps array and
; the dest memory block are large enough to hold all the data it has to write
; to them, as well as that the prefix (header) has already been copied to dest.
asm_runJIT_ PROC
push ebp
push ecx
push edi
push esi
mov [amxhead],eax ; save pointer to AMX_HEADER struct
mov ecx,[eax+_cod] ; get offset of start of code
mov eax,[eax+_dat] ; offset of start of data = end of code
mov edi,ecx
add ecx,[amxhead] ; compute the real pointer
add eax,[amxhead] ; dito
add edi,ebx ; get write pointer into EDI
mov [compiled_code],ebx
mov [end_code],eax ; Store end-of-code address, so JIT
; compiler knows when to stop.
mov DWORD ptr [reloc_num],0 ; init the index into the jumps array
mov ebx,ecx
jmp DWORD ptr [ecx] ; start compiling
; The compiler will jump back here when code generation is complete.
code_gen_done: ; Now copy the data section.
mov ebp,[amxhead] ; get source AMX_HEADER start address
add edi,3 ; DAT follows directly after COD
and edi,0fffffffch ; align it on a DWORD boundary
push edi ; save data start pointer
mov esi,[end_code] ; get start of data segment
mov ecx,[ebp]._h_hea
sub ecx,[ebp]._dat ; compute length of array to copy
rep movsb ; copy the data
; Now adjust the register values in the compiled AMX_HEADER.
; COD stays the same since the size of AMX_HEADER doesn't change in
; compiled mode.
mov ebx,[compiled_code] ; get compiled AMX's header address
pop esi ; recall data start pointer
sub esi,ebx ; DAT = size of code + size of prefix
mov [ebx]._dat,esi ; write corrected DAT register
;HEA and STP are already relative to DAT, so we don't need to fix them.
; Now the calls/jumps in the compiled code have to be relocated.
sub ecx,ecx ; reset offset into relocation table
cmp ecx,[reloc_num]
jae reloc_code_done ; if there's nothing to fix, skip this part
reloc_code_loop:
mov eax,[edx+ecx] ; get destination address
mov edi,[edx+ecx+4] ; determine where to write the relocated value
add ecx,8 ; set pointer to next entry in relocation table
add edi,4 ; base address from where the offset is taken
IF FORCERELOCATABLE EQ 0
;MP: hack to suport absolute addresses for the CASETBL instruction
test eax,80000000h ; check whether it is an absolute address
pushf
and eax,7fffffffh ; clear the flag bit for absolute addresses
popf
mov eax,[eax] ; translate into compiled absolute address
jne write_reloc ; leave out the subtraction if absolute
ELSE
mov eax,[eax] ; translate into compiled absolute address
ENDIF
sub eax,edi ; make a relative offset
write_reloc:
mov [edi-4],eax ; write the relocated address
cmp ecx,[reloc_num]
jb reloc_code_loop
reloc_code_done:
; Relocate the addresses in the AMX_HEADER structure. (CIP and publics)
add ebp,[ebp]._cod ; make all addresses relative to COD, not base
mov eax,[ebx]._h_cip
add eax,ebp ; get absolute source CIP
mov eax,[eax] ; translate CIP to compiled address
sub eax,ebx ; make it relative to base
sub eax,[ebx]._cod ; and now relative to COD
mov [ebx]._h_cip,eax; store relocated CIP
mov edi,[ebx]._publics
sub esi,esi
mov ecx,[ebx]._natives
sub ecx,edi ; ECX = _natives - _publics = public table size
mov si,[ebx]._defsize
or ecx,ecx
jz reloc_done ; If there are no publics, we are done.
reloc_publics_loop:
mov eax,[ebx+edi] ; get public function offset
add eax,ebp ; make it a source address
mov eax,[eax] ; translate to compiled address
sub eax,ebx ; make it an offset relative to base
sub eax,[ebx]._cod ; and now relative to COD
mov [ebx+edi],eax ; write corrected address back
add edi,esi ; step to next public function entry
sub ecx,esi
ja reloc_publics_loop
reloc_done:
mov eax,0
pop esi
pop edi
pop ecx
pop ebp
ret
OP_LOAD_PRI:
;nop;
putval j_load_pri+2
GO_ON j_load_pri, OP_LOAD_ALT, 8
j_load_pri:
mov eax,[edi+12345678h]
OP_LOAD_ALT:
;nop;
putval j_load_alt+2
GO_ON j_load_alt, OP_LOAD_S_PRI, 8
j_load_alt:
mov edx,[edi+12345678h]
;good
OP_LOAD_S_PRI:
;nop;
putval j_load_s_pri+2
GO_ON j_load_s_pri, OP_LOAD_S_ALT, 8
j_load_s_pri:
mov eax,[ebx+12345678h]
;good
OP_LOAD_S_ALT:
;nop;
putval j_load_s_alt+2
GO_ON j_load_s_alt, OP_LOAD_I, 8
j_load_s_alt:
mov edx,[ebx+12345678h]
OP_LOAD_I:
;nop;
GO_ON j_load_i, OP_LODB_I
j_load_i:
IF DORUNTIMECHECKS NE 0
call [verify_adr_eax]
ENDIF
mov eax,[edi+eax]
OP_LODB_I:
;nop;
mov eax,[ebx+4]
mov eax,DWORD ptr [(lodb_and-4)+eax*4]
mov DWORD ptr [j_lodb_i_sm+1],eax ;modify AND instruction
GO_ON j_lodb_i, OP_LREF_PRI, 8
j_lodb_i:
IF DORUNTIMECHECKS NE 0
call [verify_adr_eax]
ENDIF
mov eax,[edi+eax] ;subject to misalignment stalls
j_lodb_i_sm:
and eax,12345678h
OP_LREF_PRI:
;nop;
putval j_lref_pri+2
GO_ON j_lref_pri, OP_LREF_ALT, 8
j_lref_pri:
mov eax,[edi+12345678h]
mov eax,[edi+eax]
OP_LREF_ALT:
;nop;
putval j_lref_alt+2
GO_ON j_lref_alt, OP_LREF_S_PRI, 8
j_lref_alt:
mov edx,[edi+12345678h]
mov edx,[edi+edx]
OP_LREF_S_PRI:
;nop;
putval j_lref_s_pri+2
GO_ON j_lref_s_pri, OP_LREF_S_ALT, 8
j_lref_s_pri:
mov eax,[ebx+12345678h]
mov eax,[edi+eax]
OP_LREF_S_ALT:
;nop;
putval j_lref_s_alt+2
GO_ON j_lref_s_alt, OP_CONST_PRI, 8
j_lref_s_alt:
mov edx,[ebx+12345678h]
mov edx,[edi+edx]
;good
OP_CONST_PRI:
;nop;
putval j_const_pri+1
GO_ON j_const_pri, OP_CONST_ALT, 8
j_const_pri:
mov eax,12345678h
;good
OP_CONST_ALT:
;nop;
putval j_const_alt+1
GO_ON j_const_alt, OP_ADDR_PRI, 8
j_const_alt:
mov edx,12345678h
;good
OP_ADDR_PRI:
;nop;
putval j_addr_pri+1
GO_ON j_addr_pri, OP_ADDR_ALT, 8
j_addr_pri:
mov eax,12345678h
add eax,frm
;good
OP_ADDR_ALT:
;nop;
putval j_addr_alt+1
GO_ON j_addr_alt, OP_STOR_PRI, 8
j_addr_alt:
mov edx,12345678h
add edx,frm
OP_STOR_PRI:
;nop;
putval j_stor_pri+2
GO_ON j_stor_pri, OP_STOR_ALT, 8
j_stor_pri:
mov [edi+12345678h],eax
OP_STOR_ALT:
;nop;
putval j_stor_alt+2
GO_ON j_stor_alt, OP_STOR_S_PRI, 8
j_stor_alt:
mov [edi+12345678h],edx
;good
OP_STOR_S_PRI:
;nop;
putval j_stor_s_pri+2
GO_ON j_stor_s_pri, OP_STOR_S_ALT, 8
j_stor_s_pri:
mov [ebx+12345678h],eax
;good
OP_STOR_S_ALT:
;nop;
putval j_stor_s_alt+2
GO_ON j_stor_s_alt, OP_STOR_I, 8
j_stor_s_alt:
mov [ebx+12345678h],edx
;good
OP_STOR_I:
;nop;
GO_ON j_stor_i, OP_STRB_I
j_stor_i:
IF DORUNTIMECHECKS NE 0
call [verify_adr_edx]
ENDIF
mov [edi+edx],eax
OP_STRB_I:
;nop;
mov eax,[ebx+4]
cmp eax,1
jne strb_not1byte
GO_ON j_strb_i_1b, strb_not1byte, 8
j_strb_i_1b:
IF DORUNTIMECHECKS NE 0
call [verify_adr_edx]
ENDIF
mov [edi+edx],al
strb_not1byte:
cmp eax,4
je strb_4byte
GO_ON j_strb_i_2b, strb_4byte, 8
j_strb_i_2b:
IF DORUNTIMECHECKS NE 0
call [verify_adr_edx]
ENDIF
mov [edi+edx],ax
strb_4byte:
GO_ON j_strb_i_4b, OP_SREF_PRI, 8
j_strb_i_4b:
IF DORUNTIMECHECKS NE 0
call [verify_adr_edx]
ENDIF
mov [edi+edx],eax
OP_SREF_PRI:
;nop;
putval j_sref_pri+2
GO_ON j_sref_pri, OP_SREF_ALT, 8
j_sref_pri:
mov ebp,[edi+12345678h]
mov [edi+ebp],eax
OP_SREF_ALT:
;nop;
putval j_sref_alt+2
GO_ON j_sref_alt, OP_SREF_S_PRI, 8
j_sref_alt:
mov ebp,[edi+12345678h]
mov [edi+ebp],edx
OP_SREF_S_PRI:
;nop;
putval j_sref_s_pri+2
GO_ON j_sref_s_pri, OP_SREF_S_ALT, 8
j_sref_s_pri:
mov ebp,[ebx+12345678h]
mov [edi+ebp],eax
OP_SREF_S_ALT:
;nop;
putval j_sref_s_alt+2
GO_ON j_sref_s_alt, OP_LIDX, 8
j_sref_s_alt:
mov ebp,[ebx+12345678h]
mov [edi+ebp],edx
;good
OP_LIDX:
;nop;
GO_ON j_lidx, OP_LIDX_B
j_lidx:
lea eax,[edx+4*eax]
IF DORUNTIMECHECKS NE 0
call [verify_adr_eax]
ENDIF
mov eax,[edi+eax]
OP_LIDX_B:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_lidx_b+2],al
GO_ON j_lidx_b, OP_IDXADDR, 8
j_lidx_b:
shl eax,12h
add eax,edx
IF DORUNTIMECHECKS NE 0
call [verify_adr_eax]
ENDIF
mov eax,[edi+eax]
;good
OP_IDXADDR:
;nop;
GO_ON j_idxaddr, OP_IDXADDR_B
j_idxaddr:
lea eax,[edx+4*eax]
OP_IDXADDR_B:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_idxaddr_b+2],al
GO_ON j_idxaddr_b, OP_ALIGN_PRI, 8
j_idxaddr_b:
shl eax,12h
add eax,edx
OP_ALIGN_PRI:
;nop;
mov eax,4
sub eax,[ebx+4]
mov DWORD ptr [j_align_pri+1],eax
GO_ON j_align_pri, OP_ALIGN_ALT, 8
j_align_pri:
xor eax,12345678h
OP_ALIGN_ALT:
;nop;
mov eax,4
sub eax,[ebx+4]
mov DWORD ptr [j_align_alt+1],eax
GO_ON j_align_alt, OP_LCTRL, 8
j_align_alt:
xor edx,12345678h
OP_LCTRL:
;nop;
mov eax,[ebx+4]
cmp eax,0
jne lctrl_1
GO_ON j_lctrl_0, lctrl_1, 8
j_lctrl_0:
mov eax,code ; 1=COD
lctrl_1:
cmp eax,1
jne lctrl_2
GO_ON j_lctrl_1, lctrl_2, 8
j_lctrl_1:
mov eax,edi ; 1=DAT
lctrl_2:
cmp eax,2
jne lctrl_3
GO_ON j_lctrl_2, lctrl_3, 8
j_lctrl_2:
mov eax,hea ; 2=HEA
lctrl_3:
cmp eax,3
jne lctrl_4
GO_ON j_lctrl_3, lctrl_4, 8
j_lctrl_3:
mov ebp,amx
mov eax,[ebp+_stp]
lctrl_4:
cmp eax,4
jne lctrl_5
GO_ON j_lctrl_4, lctrl_5, 8
j_lctrl_4:
mov eax,esp ; 4=STK
sub eax,edi
lctrl_5:
cmp eax,5
jne lctrl_6
GO_ON j_lctrl_5, lctrl_6, 8
j_lctrl_5:
mov eax,frm ; 5=FRM
lctrl_6:
mov DWORD ptr [j_lctrl_6+1],edi
GO_ON j_lctrl_6, OP_SCTRL, 8
j_lctrl_6:
mov eax,12345678h ; 6=CIP
OP_SCTRL:
;nop;
mov eax,[ebx+4]
cmp eax,2
jne sctrl_4
GO_ON j_sctrl_2, sctrl_4, 8
j_sctrl_2:
mov hea,eax ; 2=HEA
sctrl_4:
cmp eax,4
jne sctrl_5
GO_ON j_sctrl_4, sctrl_5, 8
j_sctrl_4:
;mov esp,eax ; 4=STK
;add esp,edi ; relocate stack
lea esp,[eax+edi]
sctrl_5:
cmp eax,5
jne sctrl_ignore
GO_ON j_sctrl_5, sctrl_ignore, 8
j_sctrl_5:
mov ebx,eax ; 5=FRM
mov frm,eax
add ebx,edi ; relocate frame
sctrl_ignore:
mov [ebx],edi
add ebx,8
jmp DWORD ptr [ebx]
OP_MOVE_PRI:
;nop;
GO_ON j_move_pri, OP_MOVE_ALT
j_move_pri:
mov eax,edx
;good
OP_MOVE_ALT:
;nop;
GO_ON j_move_alt, OP_XCHG
j_move_alt:
mov edx,eax
OP_XCHG:
;nop;
GO_ON j_xchg, OP_PUSH_PRI
j_xchg: ;one might use pushes/pops for pre-586's
xchg eax,edx
;good
OP_PUSH_PRI:
;nop;
GO_ON j_push_pri, OP_PUSH_ALT
j_push_pri:
_PUSH eax
;good
OP_PUSH_ALT:
;nop;
GO_ON j_push_alt, OP_PUSH_R_PRI
j_push_alt:
_PUSH edx
OP_PUSH_R_PRI:
;nop;
putval j_push_r_pri+1
GO_ON j_push_r_pri, OP_PUSH_C, 8
j_push_r_pri:
mov ecx,12345678h
j_push_loop:
_PUSH eax
loop j_push_loop
;dec ecx
;jnz j_push_loop
;good
OP_PUSH_C:
;nop;
putval j_push_c+1
GO_ON j_push_c, OP_PUSH, 8
j_push_c:
_PUSH 12345678h
OP_PUSH:
;nop;
putval j_push+2
GO_ON j_push, OP_PUSH_S, 8
j_push:
_PUSH [edi+12345678h]
;good
OP_PUSH_S:
;nop;
putval j_push_s+2
GO_ON j_push_s, OP_POP_PRI, 8
j_push_s:
_PUSH [ebx+12345678h]
OP_POP_PRI:
;nop;
GO_ON j_pop_pri, OP_POP_ALT
j_pop_pri:
_POP eax
;good
OP_POP_ALT:
;nop;
GO_ON j_pop_alt, OP_STACK
j_pop_alt:
_POP edx
;good
OP_STACK:
;nop;
putval j_stack+4
GO_ON j_stack, OP_HEAP, 8
j_stack:
mov edx,esp
add esp,12345678h
sub edx,edi
IF DORUNTIMECHECKS NE 0
call [chk_marginstack]
ENDIF
;good
OP_HEAP:
;nop;
putval j_heap_call-4
GO_ON j_heap, OP_PROC, 8
j_heap:
mov edx,hea
add DWORD ptr hea,12345678h
j_heap_call:
IF DORUNTIMECHECKS NE 0
call [chk_marginheap]
ENDIF
;good
OP_PROC:
;nop;
GO_ON j_proc, OP_RET
j_proc: ;[STK] = FRM, STK = STK - cell size, FRM = STK
_PUSH frm ; push old frame (for RET/RETN)
mov frm,esp ; get new frame
mov ebx,esp ; already relocated
sub frm,edi ; relocate frame
OP_RET:
;nop;
GO_ON j_ret, OP_RETN
j_ret:
_POP ebx ; pop frame
mov frm,ebx
add ebx,edi
ret
;call [jit_ret]
;good
OP_RETN:
;nop;
GO_ON j_retn, OP_CALL
j_retn:
jmp [jit_retn]
;good
OP_CALL:
;nop;
RELOC 1
GO_ON j_call, OP_CALL_I, 8
j_call:
;call 12345678h ; tasm chokes on this out of a sudden
db 0e8h, 0, 0, 0, 0
OP_CALL_I:
;nop;
GO_ON j_call_i, OP_JUMP
j_call_i:
call eax
;good
OP_JUMP:
;nop;
RELOC 1
GO_ON j_jump, OP_JREL, 8
j_jump:
DB 0e9h
DD 12345678h
OP_JREL:
;nop;
mov eax,[ebx+4]
; create an absolute address from the relative one
RELOC 1, eax+ebx+8
GO_ON j_jump, OP_JREL, 8
;good
OP_JZER:
;nop;
RELOC 4
GO_ON j_jzer, OP_JNZ, 8
j_jzer:
or eax,eax
DB 0fh, 84h, 0, 0, 0, 0 ;jz NEAR 0 (tasm sucks a bit)
;good
OP_JNZ:
;nop;
RELOC 4
GO_ON j_jnz, OP_JEQ, 8
j_jnz:
or eax,eax
DB 0fh, 85h, 0, 0, 0, 0 ;jnz NEAR 0
;good
OP_JEQ:
;nop;
RELOC 4
GO_ON j_jeq, OP_JNEQ, 8
j_jeq:
cmp eax,edx
DB 0fh, 84h, 0, 0, 0, 0 ;je NEAR 0 (tasm sucks a bit)
OP_JNEQ:
;nop;
RELOC 4
GO_ON j_jneq, OP_JLESS, 8
j_jneq:
cmp eax,edx
DB 0fh, 85h, 0, 0, 0, 0 ;jne NEAR 0 (tasm sucks a bit)
OP_JLESS:
;nop;
RELOC 4
GO_ON j_jless, OP_JLEQ, 8
j_jless:
cmp eax,edx
DB 0fh, 82h, 0, 0, 0, 0 ;jb NEAR 0 (tasm sucks a bit)
OP_JLEQ:
;nop;
RELOC 4
GO_ON j_jleq, OP_JGRTR, 8
j_jleq:
cmp eax,edx
DB 0fh, 86h, 0, 0, 0, 0 ;jbe NEAR 0 (tasm sucks a bit)
OP_JGRTR:
;nop;
RELOC 4
GO_ON j_jgrtr, OP_JGEQ, 8
j_jgrtr:
cmp eax,edx
DB 0fh, 87h, 0, 0, 0, 0 ;ja NEAR 0 (tasm sucks a bit)
OP_JGEQ:
;nop;
RELOC 4
GO_ON j_jgeq, OP_JSLESS, 8
j_jgeq:
cmp eax,edx
DB 0fh, 83h, 0, 0, 0, 0 ;jae NEAR 0 (unsigned comparison)
OP_JSLESS:
;nop;
RELOC 4
GO_ON j_jsless, OP_JSLEQ, 8
j_jsless:
cmp eax,edx
DB 0fh, 8ch, 0, 0, 0, 0 ;jl NEAR 0
;good
OP_JSLEQ:
;nop;
RELOC 4
GO_ON j_jsleq, OP_JSGRTR, 8
j_jsleq:
cmp eax,edx
DB 0fh, 8eh, 0, 0, 0, 0 ;jle NEAR 0
OP_JSGRTR:
;nop;
RELOC 4
GO_ON j_jsgrtr, OP_JSGEQ, 8
j_jsgrtr:
cmp eax,edx
DB 0fh, 8Fh, 0, 0, 0, 0 ;jg NEAR 0
OP_JSGEQ:
;nop;
RELOC 4
GO_ON j_jsgeq, OP_SHL, 8
j_jsgeq:
cmp eax,edx
DB 0fh, 8dh, 0, 0, 0, 0 ;jge NEAR 0
OP_SHL:
;nop;
GO_ON j_shl, OP_SHR
j_shl:
mov ecx,edx ; TODO: save ECX if used as special register
shl eax,cl
OP_SHR:
;nop;
GO_ON j_shr, OP_SSHR
j_shr:
mov ecx,edx ; TODO: save ECX if used as special register
shr eax,cl
OP_SSHR:
;nop;
GO_ON j_sshr, OP_SHL_C_PRI
j_sshr:
mov ecx,edx ; TODO: save ECX if used as special register
sar eax,cl
OP_SHL_C_PRI:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_shl_c_pri+2],al
GO_ON j_shl_c_pri, OP_SHL_C_ALT, 8
j_shl_c_pri:
shl eax,12h
OP_SHL_C_ALT:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_shl_c_alt+2],al
GO_ON j_shl_c_alt, OP_SHR_C_PRI, 8
j_shl_c_alt:
shl edx,12h
OP_SHR_C_PRI:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_shr_c_pri+2],al
GO_ON j_shr_c_pri, OP_SHR_C_ALT, 8
j_shr_c_pri:
shr eax,12h
OP_SHR_C_ALT:
;nop;
mov al,[ebx+4]
mov BYTE ptr [j_shr_c_alt+2],al
GO_ON j_shr_c_alt, OP_SMUL, 8
j_shr_c_alt:
shr edx,12h
OP_SMUL:
;nop;
GO_ON j_smul, OP_SDIV
j_smul:
push edx
imul edx
pop edx
;good
OP_SDIV:
;nop;
GO_ON j_sdiv, OP_SDIV_ALT
j_sdiv:
call [jit_sdiv]
OP_SDIV_ALT:
;nop;
GO_ON j_sdiv_alt, OP_UMUL
j_sdiv_alt:
xchg eax,edx
call [jit_sdiv]
OP_UMUL:
;nop;
GO_ON j_umul, OP_UDIV
j_umul:
push edx
mul edx
pop edx
OP_UDIV:
;nop;
GO_ON j_udiv, OP_UDIV_ALT
j_udiv:
mov ebp,edx
sub edx,edx
call [chk_dividezero]
div ebp
OP_UDIV_ALT:
;nop;
GO_ON j_udiv_alt, OP_ADD
j_udiv_alt:
mov ebp,eax
mov eax,edx
sub edx,edx
call [chk_dividezero]
div ebp
;good
OP_ADD:
;nop;
GO_ON j_add, OP_SUB
j_add:
add eax,edx
;good
OP_SUB:
;nop;
GO_ON j_sub, OP_SUB_ALT
j_sub:
sub eax,edx
;good
OP_SUB_ALT:
;nop;
GO_ON j_sub_alt, OP_AND
j_sub_alt:
neg eax
add eax,edx
OP_AND:
;nop;
GO_ON j_and, OP_OR
j_and:
and eax,edx
OP_OR:
;nop;
GO_ON j_or, OP_XOR
j_or:
or eax,edx
OP_XOR:
;nop;
GO_ON j_xor, OP_NOT
j_xor:
xor eax,edx
OP_NOT:
;nop;
GO_ON j_not, OP_NEG
j_not:
neg eax ; sets CF iff EAX != 0
sbb eax,eax ; EAX == -1 iff CF set (zero otherwise)
inc eax ; -1 => 0 and 0 => 1
OP_NEG:
;nop;
GO_ON j_neg, OP_INVERT
j_neg:
neg eax
OP_INVERT:
;nop;
GO_ON j_invert, OP_ADD_C
j_invert:
not eax
;good
OP_ADD_C:
;nop;
putval j_add_c+1
GO_ON j_add_c, OP_SMUL_C, 8
j_add_c:
add eax,12345678h
;good
OP_SMUL_C:
;nop;
putval j_smul_c+3
GO_ON j_smul_c, OP_ZERO_PRI, 8
j_smul_c:
push edx
imul eax,12345678h
pop edx
;good
OP_ZERO_PRI:
;nop;
GO_ON j_zero_pri, OP_ZERO_ALT
j_zero_pri:
sub eax,eax
;good
OP_ZERO_ALT:
;nop;
GO_ON j_zero_alt, OP_ZERO
j_zero_alt:
sub edx,edx
OP_ZERO:
;nop;
putval j_zero+2
GO_ON j_zero, OP_ZERO_S, 8
j_zero:
mov DWORD ptr [edi+12345678h],0
OP_ZERO_S:
;nop;
putval j_zero_s+2
GO_ON j_zero_s, OP_SIGN_PRI, 8
j_zero_s:
mov DWORD ptr [ebx+12345678h],0
OP_SIGN_PRI:
;nop;
GO_ON j_sign_pri, OP_SIGN_ALT
j_sign_pri:
shl eax,24
sar eax,24
OP_SIGN_ALT:
;nop;
GO_ON j_sign_alt, OP_EQ
j_sign_alt:
shl edx,24
sar edx,24
OP_EQ:
;nop;
GO_ON j_eq, OP_NEQ
j_eq:
cmp eax,edx ; PRI == ALT ?
mov eax,0
sete al
OP_NEQ:
;nop;
GO_ON j_neq, OP_LESS
j_neq:
cmp eax,edx ; PRI != ALT ?
mov eax,0
setne al
OP_LESS:
;nop;
GO_ON j_less, OP_LEQ
j_less:
cmp eax,edx ; PRI < ALT ? (unsigned)
mov eax,0
setb al
OP_LEQ:
;nop;
GO_ON j_leq, OP_GRTR
j_leq:
cmp eax,edx ; PRI <= ALT ? (unsigned)
mov eax,0
setbe al
OP_GRTR:
;nop;
GO_ON j_grtr, OP_GEQ
j_grtr:
cmp eax,edx ; PRI > ALT ? (unsigned)
mov eax,0
seta al
OP_GEQ:
;nop;
GO_ON j_geq, OP_SLESS
j_geq:
cmp eax,edx ; PRI >= ALT ? (unsigned)
mov eax,0
setae al
;good
OP_SLESS:
;nop;
GO_ON j_sless, OP_SLEQ
j_sless:
cmp eax,edx ; PRI < ALT ? (signed)
mov eax,0
setl al
OP_SLEQ:
;nop;
GO_ON j_sleq, OP_SGRTR
j_sleq:
cmp eax,edx ; PRI <= ALT ? (signed)
mov eax,0
setle al
OP_SGRTR:
;nop;
GO_ON j_sgrtr, OP_SGEQ
j_sgrtr:
cmp eax,edx ; PRI > ALT ? (signed)
mov eax,0
setg al
OP_SGEQ:
;nop;
GO_ON j_sgeq, OP_EQ_C_PRI
j_sgeq:
cmp eax,edx ; PRI >= ALT ? (signed)
mov eax,0
setge al
OP_EQ_C_PRI:
;nop;
putval j_eq_c_pri+1
GO_ON j_eq_c_pri, OP_EQ_C_ALT, 8
j_eq_c_pri:
cmp eax,12345678h ; PRI == value ?
mov eax,0
sete al
OP_EQ_C_ALT:
;nop;
putval j_eq_c_alt+4
GO_ON j_eq_c_alt, OP_INC_PRI, 8
j_eq_c_alt:
sub eax,eax
cmp edx,12345678h ; ALT == value ?
sete al
OP_INC_PRI:
;nop;
GO_ON j_inc_pri, OP_INC_ALT
j_inc_pri:
inc eax
OP_INC_ALT:
;nop;
GO_ON j_inc_alt, OP_INC
j_inc_alt:
inc edx
OP_INC:
;nop;
putval j_inc+2
GO_ON j_inc, OP_INC_S, 8
j_inc:
inc DWORD ptr [edi+12345678h]
;good
OP_INC_S:
;nop;
putval j_inc_s+2
GO_ON j_inc_s, OP_INC_I, 8
j_inc_s:
inc DWORD ptr [ebx+12345678h]
OP_INC_I:
;nop;
GO_ON j_inc_i, OP_DEC_PRI
j_inc_i:
inc DWORD ptr [edi+eax]
OP_DEC_PRI:
;nop;
GO_ON j_dec_pri, OP_DEC_ALT
j_dec_pri:
dec eax
OP_DEC_ALT:
;nop;
GO_ON j_dec_alt, OP_DEC
j_dec_alt:
dec edx
OP_DEC:
;nop;
putval j_dec+2
GO_ON j_dec, OP_DEC_S, 8
j_dec:
dec DWORD ptr [edi+12345678h]
OP_DEC_S:
;nop;
putval j_dec_s+2
GO_ON j_dec_s, OP_DEC_I, 8
j_dec_s:
dec DWORD ptr [ebx+12345678h]
OP_DEC_I:
;nop;
GO_ON j_dec_i, OP_MOVS
j_dec_i:
dec DWORD ptr [edi+eax]
OP_MOVS:
;nop;
putval j_movs+1
GO_ON j_movs, OP_CMPS, 8
j_movs:
mov ecx,12345678h ;TODO: save ECX if used as special register
call [jit_movs]
OP_CMPS:
;nop;
putval j_cmps+1
GO_ON j_cmps, OP_FILL, 8
j_cmps:
mov ecx,12345678h ;TODO: save ECX if used as special register
call [jit_cmps]
OP_FILL:
;nop;
putval j_fill+1
GO_ON j_fill, OP_HALT, 8
j_fill:
mov ecx,12345678h ;TODO: save ECX if used as special register
call [jit_fill]
;good
OP_HALT:
;nop;
putval j_halt_sm+1
GO_ON j_halt, OP_BOUNDS, 8
j_halt:
cmp DWORD PTR retval,0
je j_halt_no_value
mov ebp,retval
mov [ebp],eax
j_halt_no_value:
j_halt_sm:
mov eax,12345678h
jmp [jit_return]
;good
OP_BOUNDS:
;nop;
putval j_bounds+1
GO_ON j_bounds, OP_SYSREQ_C, 8
j_bounds:
mov ebp,12345678h
call [jit_bounds]
;good
OP_SYSREQ_C:
;nop;
putval j_sysreq_c+1
GO_ON j_sysreq_c, OP_SYSREQ_PRI, 8
j_sysreq_c:
mov eax,12345678h ; get function number
j_sysreq:
call [jit_sysreq]
OP_SYSREQ_PRI:
;nop;
GO_ON j_sysreq, OP_SYSREQ_PRI
OP_FILE: ;opcode is simply ignored
;nop;
mov eax,[ebx+4] ;get size
mov [ebx],edi
lea ebx,[ebx+eax+8] ;move on to next opcode
cmp ebx,DWORD ptr [end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ;go on with the next opcode
OP_LINE: ;ignored
;nop;
mov [ebx],edi ; no line number support: ignore opcode
add ebx,12 ; move on to next opcode
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ; go on with the next opcode
OP_SYMBOL: ;ignored
mov [ebx],edi
mov eax,[ebx+4] ; get size
lea ebx,[ebx+eax+8] ; move on to next opcode
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ; go on with the next opcode
OP_SRANGE: ;ignored
mov [ebx],edi ; store relocated address
add ebx,12 ; move on to next opcode
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ; go on with the next opcode
;not tested
OP_JUMP_PRI:
GO_ON j_jump_pri, OP_SWITCH
j_jump_pri: ; MP: This opcode makes sense only in con-
jmp [eax] ; junction with a possibility to get the
; address of a code location...
;good
OP_SWITCH:
lea eax,[edi+6] ; The case table will be copied directly
neg eax ; after the run-time call to [jit_switch].
and eax,3 ; We should align this table on a DWORD
mov ecx,eax ; boundary.
mov al,90h ; 90h = opcode of x86 NOP instruction
rep stosb ; Write the right number of NOPs.
mov [ebx],edi ; store address of SWITCH for relocation step
mov esi,OFFSET j_switch
mov ecx,6
rep movsb ; copy the call instruction
mov esi,[ebx+4] ; get address of CASETBL instruction
add ebx,8 ; set instruction pointer to next opcode
add esi,4 ; point esi to first entry: (count, default adr)
mov ecx,[esi] ; get number of cases (excluding default)
inc ecx
mov ebp,[reloc_num]
j_case_loop:
mov eax,[esi] ; get case value
stosd ; write it
mov eax,[esi+4] ; get destination address
IF FORCERELOCATABLE EQ 0
or eax,80000000h ; add flag for "absolute address"
ENDIF
mov [edx+ebp],eax ; write dest. adr. into relocation table
mov eax,[esi+4] ; get destination address (again)
add esi,8 ; set ESI to next case
mov [edx+ebp+4],edi ; write adr. to patch into relocation table
add ebp,8 ; promote relocation pointer
stosd ; write dest. adr.
dec ecx
jnz j_case_loop
mov DWORD ptr [reloc_num],ebp ; write back updated reloc_num
jmp [ebx] ; GO_ON to next op-code
j_switch:
call [jit_switch]
;good
OP_CASETBL: ; compiles to nothing, SWITCH does all the work
mov eax,[ebx+4] ; get count of cases
lea ebx,[ebx+8*eax+(8+4)] ; adjust instruction pointer
jmp [ebx] ; GO_ON with next op-code
OP_SWAP_PRI: ; TR
GO_ON j_swap_pri, OP_SWAP_ALT
j_swap_pri:
_POP ebp
_PUSH eax
mov eax,ebp
OP_SWAP_ALT: ; TR
GO_ON j_swap_alt, OP_PUSHADDR
j_swap_alt:
_POP ebp
_PUSH edx
mov edx,ebp
OP_PUSHADDR: ; TR
putval j_pushaddr+1
GO_ON j_pushaddr, OP_NOP, 8
j_pushaddr:
mov ebp,12345678h ;get address (offset from frame)
add ebp,frm
_PUSH ebp
OP_NOP: ; TR
GO_ON j_nop, OP_SYSREQ_D
j_nop: ; code alignment is ignored by the JIT
OP_SYSREQ_D:
;nop;
putval j_sysreq_d+1
GO_ON j_sysreq_d, OP_SYMTAG, 8
j_sysreq_d:
mov ebx,12345678h ; get function address
call [jit_sysreq_d]
OP_SYMTAG: ;ignored (TR)
mov [ebx],edi ; store relocated address
add ebx,8 ; move on to next opcode
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ; go on with the next opcode
OP_BREAK:
IF DEBUGSUPPORT EQ 0
mov [ebx],edi ; no debugger number support: ignore opcode
add ebx,4 ; move on to next opcode
cmp ebx,[end_code]
jae code_gen_done
jmp DWORD ptr [ebx] ; go on with the next opcode
ELSE
GO_ON j_break, OP_INVALID
j_break:
mov ebp,amx
cmp DWORD [ebp+_debug], 0
je $+4 ; jump around the "call" statement
call [jit_break]
ENDIF
OP_INVALID: ; break from the compiler with an error code
mov eax,AMX_ERR_INVINSTR
pop esi
pop edi
pop ecx
pop ebp
ret
asm_runJIT_ ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
;cell amx_exec( cell *regs, cell *retval, cell stp, cell hea );
; eax edx ebx ecx ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
amx_exec_jit_ PROC
;TODO: clean up this mess, make it use __cdecl.....
push edi
push esi
push ebp
sub esp,4*3 ; place for PRI, ALT & STK at SYSREQs
push DWORD ptr [eax+28] ; store pointer to code segment
push DWORD ptr [eax+24] ; store pointer to AMX
push edx ; store address of retval
push ebx ; store STP
push ecx ; store HEA
push DWORD ptr[eax+20]; store FRM
stk equ [esi+32] ; define some aliases to registers that will
alt equ [esi+28] ; be stored on the stack when the code is
pri equ [esi+24] ; actually beeing executed
code equ [esi+20]
amx equ [esi+16]
retval equ [esi+12]
stp equ [esi+8]
hea equ [esi+4]
frm equ [esi] ; FRM is NOT stored in ebp, rather FRM+DAT is being
; held in ebx.
mov edx,[eax+4] ; get ALT
mov ecx,[eax+8] ; get CIP
mov edi,[eax+12] ; get pointer to data segment
mov esi,[eax+16] ; get STK
mov ebx,[eax+20] ; get FRM
mov eax,[eax] ; get PRI
add ebx,edi ; relocate frame
add esi,edi ; ESP will contain DAT+STK
xchg esp,esi ; switch to AMX stack
add stp,edi ; make STP absolute address for run-time checks
_POP ebp ; AMX pseudo-return address, ignored
; Call compiled code via CALL NEAR <address>
call ecx
return_to_caller:
cmp DWORD PTR retval,0
je return_to_caller_no_value
mov ebp,retval
mov [ebp],eax ; provide return value
return_to_caller_no_value:
mov eax,AMX_ERR_NONE
jmp _return
_return_popstack:
add esp,4 ; Correct ESP, because we just come from a
; runtime error checking routine.
_return:
; store machine state
mov ecx,esp ; get STK into ECX
mov ebp,amx ; get amx into EBP
sub ecx,edi ; correct STK
mov [ebp+_stk],ecx ; store values in AMX structure: STK, ...
mov ecx,hea ; ... HEA, ...
mov [ebp+_hea],ecx
mov ecx,ebx ; ... and FRM
sub ecx,edi ; (correct FRM)
mov [ebp+_frm],ecx
mov [ebp+_pri],eax ; also store PRI, ...
mov [ebp+_alt],edx ; ... and ALT
; return
sub stp,edi ; make STP relative to DAT again
xchg esp,esi ; switch back to caller's stack
add esp,4*9 ; remove temporary data
pop ebp
pop esi
pop edi
ret
err_stack:
mov eax,AMX_ERR_STACKERR
jmp _return_popstack
err_stacklow:
mov eax,AMX_ERR_STACKLOW
jmp _return_popstack
_CHKMARGIN_STACK: ; some run-time check routines
cmp esp,stp
lea ebp,[esp-STACKRESERVE]
jg err_stacklow
sub ebp,edi
cmp hea,ebp
jg err_stack
ret
err_heaplow:
mov eax,AMX_ERR_HEAPLOW
jmp _return_popstack
_CHKMARGIN_HEAP:
cmp esp,stp
jg err_stacklow
mov ebp,amx
mov ebp,[ebp+_hlw]
cmp DWORD ptr hea,ebp
jl err_heaplow
ret
err_memaccess:
mov eax,AMX_ERR_MEMACCESS
jmp _return_popstack
_VERIFYADDRESS_eax: ; used in load.i, store.i & lidx
cmp eax,stp
jae err_memaccess
cmp eax,hea
jb veax1
lea ebp,[eax+edi]
cmp ebp,esp
jb err_memaccess
veax1:
ret
_VERIFYADDRESS_edx: ; used in load.i, store.i & lidx
cmp edx,stp
jae err_memaccess
cmp edx,hea
jb vedx1
lea ebp,[edx+edi]
cmp ebp,esp
jb err_memaccess
vedx1:
ret
JIT_OP_SDIV:
mov ebp,edx
xor edx,eax ; Check signs of the operands.
cdq
js sdiv_fiddle ; If the signs of the operands are different
; we'll have to fiddle around to achieve
; proper rounding towards minus infinity.
or ebp,ebp ; check for divide by zero
jz err_divide
idiv ebp ; default behavior is right in the other cases
ret
sdiv_fiddle:
or ebp,ebp ; check for divide by zero
jz err_divide
idiv ebp
or edx,edx
jz sdiv_goon ; If there's no remainder the result is correct
add edx,ebp ; else fix the result values.
dec eax ; Amazing, how simple this is...
sdiv_goon:
ret
ALIGN 4
JIT_OP_RETN:
_POP ebx ; pop frame
_POP ecx ; get return address
mov frm,ebx
_POP ebp
add ebx,edi
add esp,ebp ; remove data from stack
jmp ecx
JIT_OP_MOVS: ;length of block to copy is already in ECX
push edi
push esi
lea esi,[edi+eax]
lea edi,[edi+edx]
push ecx ; I hope the blocks to copy are properly
shr ecx,2 ; aligned, so I don't do anything about that.
rep movsd
pop ecx
and ecx,3
rep movsb
pop esi
pop edi
ret
JIT_OP_CMPS: ;length of block to compare is already in ECX
push edi
push esi
lea esi,[edi+edx]
lea edi,[edi+eax]
xor eax,eax ; This is surely not the fastest way to do this
repe cmpsb ; but the most simple one.
je cmps1
sbb eax,eax
sbb eax,0ffffffffh
cmps1:
pop esi
pop edi
ret
JIT_OP_FILL: ;length (in bytes) of block to fill is already in ECX
push edi
lea edi,[edi+edx]
shr ecx,2 ;length in 32-bit cells
rep stosd ;the value to use is already in EAX
pop edi
ret
JIT_OP_BOUNDS:
cmp eax,0
jl err_bounds
cmp eax,ebp
jg err_bounds
ret
err_bounds:
mov eax,AMX_ERR_BOUNDS
jmp _return_popstack
_CHKDIVIDEZERO:
or ebp,ebp ; check for divide by zero
jz err_divide
ret
err_divide:
mov eax,AMX_ERR_DIVIDE
jmp _return_popstack
JIT_OP_SYSREQ:
mov ecx,esp ; get STK into ECX
mov ebp,amx ; get amx into EBP
sub ecx,edi ; correct STK
mov alt,edx ; save ALT
mov [ebp+_stk],ecx ; store values in AMX structure: STK,
mov ecx,hea ; HEA,
mov ebx,frm ; and FRM
mov [ebp+_hea],ecx
mov [ebp+_frm],ebx ; ebx & ecx are invalid by now
mov edx,eax ; 2nd param: function number
mov eax,ebp ; 1st param: amx
lea ebx,pri ; 3rd param: addr. of retval
lea ecx,[esp+4] ; 4th param: parameter array
xchg esp,esi ; switch to caller stack
call [ebp+_callback]
xchg esp,esi ; switch back to AMX stack
cmp eax,AMX_ERR_NONE
jne _return_popstack; return error code, if any
mov eax,pri ; get retval into eax (PRI)
mov edx,alt ; restore ALT
mov ebx,frm ; restore FRM
add ebx,edi ; relocate frame
ret
JIT_OP_SYSREQ_D: ; (TR)
mov ecx,esp ; get STK into ECX
mov ebp,amx ; get amx into EBP
sub ecx,edi ; correct STK
mov alt,edx ; save ALT
mov [ebp+_stk],ecx ; store values in AMX structure: STK,
mov ecx,hea ; HEA,
mov eax,frm ; and FRM
mov [ebp+_hea],ecx
mov [ebp+_frm],eax ; eax & ecx are invalid by now
mov eax,ebp ; 1st param: amx
lea edx,[esp+4] ; 2nd param: parameter array
xchg esp,esi ; switch to caller stack
call ebx ; direct call
xchg esp,esi ; switch back to AMX stack
mov ebp,amx ; get amx into EBP
cmp [ebp+_error],AMX_ERR_NONE
jne _return_popstack; return error code, if any
; return value is in eax (PRI)
mov edx,alt ; restore ALT
mov ebx,frm ; restore FRM
add ebx,edi ; relocate frame
ret
JIT_OP_BREAK:
IF DEBUGSUPPORT EQ 0
ELSE
mov ecx,esp ; get STK into ECX
mov ebp,amx ; get amx into EBP
sub ecx,edi ; correct STK
mov [ebp+_pri],eax ; store values in AMX structure: PRI,
mov [ebp+_alt],edx ; ALT,
mov [ebp+_stk],ecx ; STK,
mov ecx,hea ; HEA,
mov ebx,frm ; and FRM
mov [ebp+_hea],ecx
mov [ebp+_frm],ebx ; EBX & ECX are invalid by now
;??? storing CIP is not very useful, because the code changed (during JIT compile)
mov eax,ebp ; 1st param: amx
xchg esp,esi ; switch to caller stack
call [ebp+_debug]
xchg esp,esi ; switch back to AMX stack
cmp eax,AMX_ERR_NONE
jne _return_popstack; return error code, if any
mov ebp,amx ; get amx into EBP
mov eax,[ebp+_pri] ; restore values
mov edx,[ebp+_alt] ; ALT,
mov edx,alt ; restore ALT
mov ebx,frm ; restore FRM
add ebx,edi ; relocate frame
ENDIF
ret
JIT_OP_SWITCH:
pop ebp ; pop return address = table address
mov ecx,[ebp] ; ECX = number of records
lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case
jecxz op_switch_jump ; special case: no cases at all
op_switch_loop:
cmp eax,[ebp-8] ; PRI == case label?
je op_switch_jump ; found, jump
sub ebp,8 ; position to preceding case
loop op_switch_loop ; check next case, or fall through
op_switch_jump:
IF FORCERELOCATABLE EQ 0
jmp [ebp-4] ; jump to the case instructions
ELSE
add ebp,[ebp-4] ; add offset to make absolute adddress
jmp ebp
ENDIF
amx_exec_jit_ ENDP
;
; The caller of asm_runJIT() can determine the maximum size of the compiled
; code by multiplying the result of this function by the number of opcodes in
; Pawn module.
;
; unsigned long getMaxCodeSize_();
;
getMaxCodeSize_ PROC
mov eax,MAXCODESIZE
ret
getMaxCodeSize_ ENDP
IFNDEF @Version
; Microsoft MASM 6.x gives the error message "Register assumed to
; ERROR" when I put the code lables in the data segment. I cannot find
; a proper way around it.
.DATA
ENDIF
ALIGN 4 ; This is essential to avoid misalignment stalls.
end_code DD 0 ; pointer to the end of the source code
compiled_code DD 0 ; pointer to compiled code (including preamble)
amxhead DD 0 ; pointer to the AMX_HEADER struct (arg #1 to runJIT)
reloc_num DD 0 ; counts the addresses in the relocation table (jumps)
lodb_and DD 0ffh, 0ffffh, 0, 0ffffffffh
;
; A list of the "run-time-library" functions that are called via indirect calls.
; So these calls don't have to be relocated. This gives also the possibility to
; replace some of these with shorter/faster non-debug or non-checking versions,
; without changing the compiled code. Instead this table could be changed...
;
verify_adr_eax DD _VERIFYADDRESS_eax
verify_adr_edx DD _VERIFYADDRESS_edx
chk_marginstack DD _CHKMARGIN_STACK
chk_marginheap DD _CHKMARGIN_HEAP
chk_dividezero DD _CHKDIVIDEZERO
jit_return DD _return
jit_retn DD JIT_OP_RETN
jit_sdiv DD JIT_OP_SDIV
jit_movs DD JIT_OP_MOVS
jit_cmps DD JIT_OP_CMPS
jit_fill DD JIT_OP_FILL
jit_bounds DD JIT_OP_BOUNDS
jit_sysreq DD JIT_OP_SYSREQ
jit_sysreq_d DD JIT_OP_SYSREQ_D
jit_break DD JIT_OP_BREAK
jit_switch DD JIT_OP_SWITCH
;
; The table for the browser/relocator function.
;
PUBLIC _amx_opcodelist_jit
_amx_opcodelist_jit:
DD OP_INVALID
DD OP_LOAD_PRI
DD OP_LOAD_ALT
DD OP_LOAD_S_PRI
DD OP_LOAD_S_ALT
DD OP_LREF_PRI
DD OP_LREF_ALT
DD OP_LREF_S_PRI
DD OP_LREF_S_ALT
DD OP_LOAD_I
DD OP_LODB_I
DD OP_CONST_PRI
DD OP_CONST_ALT
DD OP_ADDR_PRI
DD OP_ADDR_ALT
DD OP_STOR_PRI
DD OP_STOR_ALT
DD OP_STOR_S_PRI
DD OP_STOR_S_ALT
DD OP_SREF_PRI
DD OP_SREF_ALT
DD OP_SREF_S_PRI
DD OP_SREF_S_ALT
DD OP_STOR_I
DD OP_STRB_I
DD OP_LIDX
DD OP_LIDX_B
DD OP_IDXADDR
DD OP_IDXADDR_B
DD OP_ALIGN_PRI
DD OP_ALIGN_ALT
DD OP_LCTRL
DD OP_SCTRL
DD OP_MOVE_PRI
DD OP_MOVE_ALT
DD OP_XCHG
DD OP_PUSH_PRI
DD OP_PUSH_ALT
DD OP_PUSH_R_PRI
DD OP_PUSH_C
DD OP_PUSH
DD OP_PUSH_S
DD OP_POP_PRI
DD OP_POP_ALT
DD OP_STACK
DD OP_HEAP
DD OP_PROC
DD OP_RET
DD OP_RETN
DD OP_CALL
DD OP_CALL_I
DD OP_JUMP
DD OP_JREL
DD OP_JZER
DD OP_JNZ
DD OP_JEQ
DD OP_JNEQ
DD OP_JLESS
DD OP_JLEQ
DD OP_JGRTR
DD OP_JGEQ
DD OP_JSLESS
DD OP_JSLEQ
DD OP_JSGRTR
DD OP_JSGEQ
DD OP_SHL
DD OP_SHR
DD OP_SSHR
DD OP_SHL_C_PRI
DD OP_SHL_C_ALT
DD OP_SHR_C_PRI
DD OP_SHR_C_ALT
DD OP_SMUL
DD OP_SDIV
DD OP_SDIV_ALT
DD OP_UMUL
DD OP_UDIV
DD OP_UDIV_ALT
DD OP_ADD
DD OP_SUB
DD OP_SUB_ALT
DD OP_AND
DD OP_OR
DD OP_XOR
DD OP_NOT
DD OP_NEG
DD OP_INVERT
DD OP_ADD_C
DD OP_SMUL_C
DD OP_ZERO_PRI
DD OP_ZERO_ALT
DD OP_ZERO
DD OP_ZERO_S
DD OP_SIGN_PRI
DD OP_SIGN_ALT
DD OP_EQ
DD OP_NEQ
DD OP_LESS
DD OP_LEQ
DD OP_GRTR
DD OP_GEQ
DD OP_SLESS
DD OP_SLEQ
DD OP_SGRTR
DD OP_SGEQ
DD OP_EQ_C_PRI
DD OP_EQ_C_ALT
DD OP_INC_PRI
DD OP_INC_ALT
DD OP_INC
DD OP_INC_S
DD OP_INC_I
DD OP_DEC_PRI
DD OP_DEC_ALT
DD OP_DEC
DD OP_DEC_S
DD OP_DEC_I
DD OP_MOVS
DD OP_CMPS
DD OP_FILL
DD OP_HALT
DD OP_BOUNDS
DD OP_SYSREQ_PRI
DD OP_SYSREQ_C
DD OP_FILE
DD OP_LINE
DD OP_SYMBOL
DD OP_SRANGE
DD OP_JUMP_PRI
DD OP_SWITCH
DD OP_CASETBL
DD OP_SWAP_PRI ; TR
DD OP_SWAP_ALT ; TR
DD OP_PUSHADDR ; TR
DD OP_NOP ; TR
DD OP_SYSREQ_D ; TR
DD OP_SYMTAG ; TR
DD OP_BREAK ; TR
END
| Fabsch/pawnccsamp | SOURCE/AMX/amxjitr.asm | Assembly | apache-2.0 | 60,757 |
org 7c00h
NEWBASE equ 600h
MBRLEN equ 100h
MARKER equ 0AA55h
start:
xor ax, ax ;ORIGINAL 33 c0
mov ss, ax
mov sp, start
sti
push ax
pop es
push ax
pop ds
cld
mov si, next
mov di, 61Bh
push ax
push di
mov cx, 1E5h
rep movsb
retf
next:
mov si, 7BEh
mov cl, 4
loc_7C20:
cmp [si], ch
jl short loc_7C2D
jnz short loc_7C3B
add si, 10h
loop loc_7C20
int 18h
loc_7C2D:
mov dx, [si]
mov bp, si ;ORIGINAL 8b EE
loc_7C31:
add si, 10h
dec cx
jz short loc_7C4D
cmp [si], ch
jz short loc_7C31
loc_7C3B:
mov si, 710h
loc_7C3E:
dec si
loc_7C3F:
lodsb
cmp al, 0
jz short loc_7C3E
mov bx, 7
mov ah, 0Eh
int 10h ; - VIDEO - WRITE CHARACTER AND ADVANCE CURSOR (TTY WRITE)
; AL = character, BH = display page (alpha modes)
; BL = foreground color (graphics modes)
loc_7C4B:
jmp short loc_7C3F
loc_7C4D:
mov [bp + 25h], ax
xchg ax, si
mov al, [bp + 4]
mov ah, 6
cmp al, 0Eh
jz short loc_7C6B
mov ah, 0Bh
cmp al, 0Ch
jz short loc_7C65
cmp al, ah ;ORIGINAL 3a C4
jnz short loc_7C8F
inc ax
loc_7C65:
mov byte [bp + 25h], 6
jnz short loc_7C8F
loc_7C6B:
mov bx, 55AAh
push ax
mov ah, 41h ; 'A'
int 13h ; DISK -
pop ax
jb short loc_7C8C
cmp bx, 0AA55h
jnz short loc_7C8C
test cl, 1
jz short loc_7C8C
mov ah, al ;ORIGINAL 8a e0
mov [bp + 24h], dl
mov word [6A1h], 1EEBh
loc_7C8C:
mov [bp+4], ah
loc_7C8F:
mov di, 0Ah
loc_7C92:
mov ax, 201h
mov bx, sp ;ORIGINAL 8b dc
xor cx, cx ;ORIGINAL 33 c9
cmp di, 5
jg short loc_7CA1
mov cx, [bp + 25h]
loc_7CA1:
add cx, [bp + 2]
int 13h
loc_7CA6:
jb short loc_7CD1
mov si, 746h
cmp word [word_7DFE], 0AA55h
jz short loc_7D0D
sub di, 5
jg short loc_7C92
loc_7CB8:
test si, si
jnz short loc_7C3F
mov si, 727h
jmp short loc_7C4B
cbw
xchg ax, cx
push dx
cwd
add ax, [bp+8]
adc dx, [bp+0Ah]
call sub_7CE0
pop dx
jmp short loc_7CA6
loc_7CD1:
dec di
jz short loc_7CB8
xor ax, ax ;ORIGINAL 33 c0
int 13h ; reset disk system
jmp short loc_7C92
times 6 db 0
sub_7CE0:
push si
xor si, si ;ORIGINAL 33 f6
push si
push si
push dx
push ax
push es
push bx
push cx
mov si, 10h
push si
mov si, sp ;ORIGINAL 8B f4
push ax
push dx
mov ax, 4200h
mov dl, [bp + 24h]
int 13h
pop dx
pop ax
lea sp, [si + 10h]
jb short loc_7D0B
loc_7D01:
inc ax
jnz short loc_7D05
inc dx
loc_7D05:
add bh, 2
loop loc_7D01
clc
loc_7D0B:
pop si
retn
loc_7D0D:
jmp short loc_7D83
aInvalidPartiti db 'Invalid partition table',0
aErrorLoadingOp db 'Error loading operating system',0
aMissingOperati db 'Missing operating system',0
times 24h db 0
loc_7D83:
mov di, sp ;ORIGINAL 8b fc
push ds
push di
mov si, bp ;ORIGINAL 8b f5
retf
times 34h db 0
db 80h, 1,1, 0, 0Bh, 7Fh, 0BFh, 0FDh
db 3Fh, 0,0,0, 0C1h, 40h, 5Eh,
times 31h db 0
word_7DFE dw MARKER
;CHECKSUM 55c160cd12a616a6e999b51a1ec2492b | angea/corkami | misc/mbr/win9xme.asm | Assembly | bsd-2-clause | 3,519 |
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
;TODO(cd): adjust these constant to be able to use vqdmulh for faster
; dct_const_round_shift(a * b) within butterfly calculations.
cospi_1_64 EQU 16364
cospi_2_64 EQU 16305
cospi_3_64 EQU 16207
cospi_4_64 EQU 16069
cospi_5_64 EQU 15893
cospi_6_64 EQU 15679
cospi_7_64 EQU 15426
cospi_8_64 EQU 15137
cospi_9_64 EQU 14811
cospi_10_64 EQU 14449
cospi_11_64 EQU 14053
cospi_12_64 EQU 13623
cospi_13_64 EQU 13160
cospi_14_64 EQU 12665
cospi_15_64 EQU 12140
cospi_16_64 EQU 11585
cospi_17_64 EQU 11003
cospi_18_64 EQU 10394
cospi_19_64 EQU 9760
cospi_20_64 EQU 9102
cospi_21_64 EQU 8423
cospi_22_64 EQU 7723
cospi_23_64 EQU 7005
cospi_24_64 EQU 6270
cospi_25_64 EQU 5520
cospi_26_64 EQU 4756
cospi_27_64 EQU 3981
cospi_28_64 EQU 3196
cospi_29_64 EQU 2404
cospi_30_64 EQU 1606
cospi_31_64 EQU 804
EXPORT |idct32_transpose_and_transform|
EXPORT |idct32_combine_add|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
AREA Block, CODE, READONLY
; --------------------------------------------------------------------------
; Load from transposed_buffer
; q13 = transposed_buffer[first_offset]
; q14 = transposed_buffer[second_offset]
; for proper address calculation, the last offset used when manipulating
; transposed_buffer must be passed in. use 0 for first use.
MACRO
LOAD_FROM_TRANSPOSED $prev_offset, $first_offset, $second_offset
; address calculation with proper stride and loading
add r0, #($first_offset - $prev_offset )*8*2
vld1.s16 {q14}, [r0]
add r0, #($second_offset - $first_offset)*8*2
vld1.s16 {q13}, [r0]
; (used) two registers (q14, q13)
MEND
; --------------------------------------------------------------------------
; Load from output (used as temporary storage)
; reg1 = output[first_offset]
; reg2 = output[second_offset]
; for proper address calculation, the last offset used when manipulating
; output, wethere reading or storing) must be passed in. use 0 for first
; use.
MACRO
LOAD_FROM_OUTPUT $prev_offset, $first_offset, $second_offset, $reg1, $reg2
; address calculation with proper stride and loading
add r1, #($first_offset - $prev_offset )*32*2
vld1.s16 {$reg1}, [r1]
add r1, #($second_offset - $first_offset)*32*2
vld1.s16 {$reg2}, [r1]
; (used) two registers ($reg1, $reg2)
MEND
; --------------------------------------------------------------------------
; Store into output (sometimes as as temporary storage)
; output[first_offset] = reg1
; output[second_offset] = reg2
; for proper address calculation, the last offset used when manipulating
; output, wethere reading or storing) must be passed in. use 0 for first
; use.
MACRO
STORE_IN_OUTPUT $prev_offset, $first_offset, $second_offset, $reg1, $reg2
; address calculation with proper stride and storing
add r1, #($first_offset - $prev_offset )*32*2
vst1.16 {$reg1}, [r1]
add r1, #($second_offset - $first_offset)*32*2
vst1.16 {$reg2}, [r1]
MEND
; --------------------------------------------------------------------------
; Touches q8-q12, q15 (q13-q14 are preserved)
; valid output registers are anything but q8-q11
MACRO
DO_BUTTERFLY $regC, $regD, $regA, $regB, $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
; TODO(cd): have special case to re-use constants when they are similar for
; consecutive butterflies
; TODO(cd): have special case when both constants are the same, do the
; additions/substractions before the multiplies.
; generate the constants
; generate scalar constants
mov r3, #$first_constant & 0xFF00
add r3, #$first_constant & 0x00FF
mov r12, #$second_constant & 0xFF00
add r12, #$second_constant & 0x00FF
; generate vector constants
vdup.16 d30, r3
vdup.16 d31, r12
; (used) two for inputs (regA-regD), one for constants (q15)
; do some multiplications (ordered for maximum latency hiding)
vmull.s16 q8, $regC, d30
vmull.s16 q10, $regA, d31
vmull.s16 q9, $regD, d30
vmull.s16 q11, $regB, d31
vmull.s16 q12, $regC, d31
; (used) five for intermediate (q8-q12), one for constants (q15)
; do some addition/substractions (to get back two register)
vsub.s32 q8, q8, q10
vsub.s32 q9, q9, q11
; do more multiplications (ordered for maximum latency hiding)
vmull.s16 q10, $regD, d31
vmull.s16 q11, $regA, d30
vmull.s16 q15, $regB, d30
; (used) six for intermediate (q8-q12, q15)
; do more addition/substractions
vadd.s32 q11, q12, q11
vadd.s32 q10, q10, q15
; (used) four for intermediate (q8-q11)
; dct_const_round_shift
vqrshrn.s32 $reg1, q8, #14
vqrshrn.s32 $reg2, q9, #14
vqrshrn.s32 $reg3, q11, #14
vqrshrn.s32 $reg4, q10, #14
; (used) two for results, well four d registers
MEND
; --------------------------------------------------------------------------
; Touches q8-q12, q15 (q13-q14 are preserved)
; valid output registers are anything but q8-q11
MACRO
DO_BUTTERFLY_STD $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
DO_BUTTERFLY d28, d29, d26, d27, $first_constant, $second_constant, $reg1, $reg2, $reg3, $reg4
MEND
; --------------------------------------------------------------------------
;void idct32_transpose_and_transform(int16_t *transpose_buffer, int16_t *output, int16_t *input);
;
; r0 int16_t *transpose_buffer
; r1 int16_t *output
; r2 int16_t *input)
; TODO(cd): have more logical parameter ordering but this issue will disappear
; when functions are combined.
|idct32_transpose_and_transform| PROC
; This function does one pass of idct32x32 transform.
;
; This is done by transposing the input and then doing a 1d transform on
; columns. In the first pass, the transposed columns are the original
; rows. In the second pass, after the transposition, the colums are the
; original columns.
; The 1d transform is done by looping over bands of eight columns (the
; idct32_bands loop). For each band, the transform input transposition
; is done on demand, one band of four 8x8 matrices at a time. The four
; matrices are trsnposed by pairs (the idct32_transpose_pair loop).
push {r4}
mov r4, #0 ; initialize bands loop counter
idct32_bands_loop
; TODO(cd) get rid of these push/pop by properly adjusting register
; content at end of loop
push {r0}
push {r1}
push {r2}
mov r3, #0 ; initialize transpose loop counter
idct32_transpose_pair_loop
; Load two horizontally consecutive 8x8 16bit data matrices. The first one
; into q0-q7 and the second one into q8-q15. There is a stride of 64,
; adjusted to 32 because of the two post-increments.
vld1.s16 {q8}, [r2]!
vld1.s16 {q0}, [r2]!
add r2, #32
vld1.s16 {q9}, [r2]!
vld1.s16 {q1}, [r2]!
add r2, #32
vld1.s16 {q10}, [r2]!
vld1.s16 {q2}, [r2]!
add r2, #32
vld1.s16 {q11}, [r2]!
vld1.s16 {q3}, [r2]!
add r2, #32
vld1.s16 {q12}, [r2]!
vld1.s16 {q4}, [r2]!
add r2, #32
vld1.s16 {q13}, [r2]!
vld1.s16 {q5}, [r2]!
add r2, #32
vld1.s16 {q14}, [r2]!
vld1.s16 {q6}, [r2]!
add r2, #32
vld1.s16 {q15}, [r2]!
vld1.s16 {q7}, [r2]!
; Transpose the two 8x8 16bit data matrices.
vswp d17, d24
vswp d23, d30
vswp d21, d28
vswp d19, d26
vswp d1, d8
vswp d7, d14
vswp d5, d12
vswp d3, d10
vtrn.32 q8, q10
vtrn.32 q9, q11
vtrn.32 q12, q14
vtrn.32 q13, q15
vtrn.32 q0, q2
vtrn.32 q1, q3
vtrn.32 q4, q6
vtrn.32 q5, q7
vtrn.16 q8, q9
vtrn.16 q10, q11
vtrn.16 q12, q13
vtrn.16 q14, q15
vtrn.16 q0, q1
vtrn.16 q2, q3
vtrn.16 q4, q5
vtrn.16 q6, q7
; Store both matrices after each other. There is a stride of 32, which
; adjusts to nothing because of the post-increments.
vst1.16 {q8}, [r0]!
vst1.16 {q9}, [r0]!
vst1.16 {q10}, [r0]!
vst1.16 {q11}, [r0]!
vst1.16 {q12}, [r0]!
vst1.16 {q13}, [r0]!
vst1.16 {q14}, [r0]!
vst1.16 {q15}, [r0]!
vst1.16 {q0}, [r0]!
vst1.16 {q1}, [r0]!
vst1.16 {q2}, [r0]!
vst1.16 {q3}, [r0]!
vst1.16 {q4}, [r0]!
vst1.16 {q5}, [r0]!
vst1.16 {q6}, [r0]!
vst1.16 {q7}, [r0]!
; increment pointers by adjusted stride (not necessary for r0/out)
sub r2, r2, #8*32*2-32-16*2
; transpose pair loop processing
add r3, r3, #1
cmp r3, #1
BLE idct32_transpose_pair_loop
; restore r0/input to its original value
sub r0, r0, #32*8*2
; Instead of doing the transforms stage by stage, it is done by loading
; some input values and doing as many stages as possible to minimize the
; storing/loading of intermediate results. To fit within registers, the
; final coefficients are cut into four blocks:
; BLOCK A: 16-19,28-31
; BLOCK B: 20-23,24-27
; BLOCK C: 8-10,11-15
; BLOCK D: 0-3,4-7
; Blocks A and C are straight calculation through the various stages. In
; block B, further calculations are performed using the results from
; block A. In block D, further calculations are performed using the results
; from block C and then the final calculations are done using results from
; block A and B which have been combined at the end of block B.
; --------------------------------------------------------------------------
; BLOCK A: 16-19,28-31
; --------------------------------------------------------------------------
; generate 16,17,30,31
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[1 * 32] * cospi_31_64 - input[31 * 32] * cospi_1_64;
;temp2 = input[1 * 32] * cospi_1_64 + input[31 * 32] * cospi_31_64;
;step1b[16][i] = dct_const_round_shift(temp1);
;step1b[31][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 0, 1, 31
DO_BUTTERFLY_STD cospi_31_64, cospi_1_64, d0, d1, d4, d5
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[17 * 32] * cospi_15_64 - input[15 * 32] * cospi_17_64;
;temp2 = input[17 * 32] * cospi_17_64 + input[15 * 32] * cospi_15_64;
;step1b[17][i] = dct_const_round_shift(temp1);
;step1b[30][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 31, 17, 15
DO_BUTTERFLY_STD cospi_15_64, cospi_17_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; part of stage 2
;step2[16] = step1b[16][i] + step1b[17][i];
;step2[17] = step1b[16][i] - step1b[17][i];
;step2[30] = -step1b[30][i] + step1b[31][i];
;step2[31] = step1b[30][i] + step1b[31][i];
vadd.s16 q4, q0, q1
vsub.s16 q13, q0, q1
vadd.s16 q6, q2, q3
vsub.s16 q14, q2, q3
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = step1b[30][i] * cospi_28_64 - step1b[17][i] * cospi_4_64;
;temp2 = step1b[30][i] * cospi_4_64 - step1b[17][i] * cospi_28_64;
;step3[17] = dct_const_round_shift(temp1);
;step3[30] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_28_64, cospi_4_64, d10, d11, d14, d15
; --------------------------------------------------------------------------
; generate 18,19,28,29
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[9 * 32] * cospi_23_64 - input[23 * 32] * cospi_9_64;
;temp2 = input[9 * 32] * cospi_9_64 + input[23 * 32] * cospi_23_64;
;step1b[18][i] = dct_const_round_shift(temp1);
;step1b[29][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 15, 9, 23
DO_BUTTERFLY_STD cospi_23_64, cospi_9_64, d0, d1, d4, d5
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[25 * 32] * cospi_7_64 - input[7 * 32] * cospi_25_64;
;temp2 = input[25 * 32] * cospi_25_64 + input[7 * 32] * cospi_7_64;
;step1b[19][i] = dct_const_round_shift(temp1);
;step1b[28][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 23, 25, 7
DO_BUTTERFLY_STD cospi_7_64, cospi_25_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; part of stage 2
;step2[18] = -step1b[18][i] + step1b[19][i];
;step2[19] = step1b[18][i] + step1b[19][i];
;step2[28] = step1b[28][i] + step1b[29][i];
;step2[29] = step1b[28][i] - step1b[29][i];
vsub.s16 q13, q3, q2
vadd.s16 q3, q3, q2
vsub.s16 q14, q1, q0
vadd.s16 q2, q1, q0
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = step1b[18][i] * (-cospi_4_64) - step1b[29][i] * (-cospi_28_64);
;temp2 = step1b[18][i] * (-cospi_28_64) + step1b[29][i] * (-cospi_4_64);
;step3[29] = dct_const_round_shift(temp1);
;step3[18] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD (-cospi_4_64), (-cospi_28_64), d2, d3, d0, d1
; --------------------------------------------------------------------------
; combine 16-19,28-31
; --------------------------------------------------------------------------
; part of stage 4
;step1[16] = step1b[16][i] + step1b[19][i];
;step1[17] = step1b[17][i] + step1b[18][i];
;step1[18] = step1b[17][i] - step1b[18][i];
;step1[29] = step1b[30][i] - step1b[29][i];
;step1[30] = step1b[30][i] + step1b[29][i];
;step1[31] = step1b[31][i] + step1b[28][i];
vadd.s16 q8, q4, q2
vadd.s16 q9, q5, q0
vadd.s16 q10, q7, q1
vadd.s16 q15, q6, q3
vsub.s16 q13, q5, q0
vsub.s16 q14, q7, q1
STORE_IN_OUTPUT 0, 16, 31, q8, q15
STORE_IN_OUTPUT 31, 17, 30, q9, q10
; --------------------------------------------------------------------------
; part of stage 5
;temp1 = step1b[29][i] * cospi_24_64 - step1b[18][i] * cospi_8_64;
;temp2 = step1b[29][i] * cospi_8_64 + step1b[18][i] * cospi_24_64;
;step2[18] = dct_const_round_shift(temp1);
;step2[29] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d0, d1, d2, d3
STORE_IN_OUTPUT 30, 29, 18, q1, q0
; --------------------------------------------------------------------------
; part of stage 4
;step1[19] = step1b[16][i] - step1b[19][i];
;step1[28] = step1b[31][i] - step1b[28][i];
vsub.s16 q13, q4, q2
vsub.s16 q14, q6, q3
; --------------------------------------------------------------------------
; part of stage 5
;temp1 = step1b[28][i] * cospi_24_64 - step1b[19][i] * cospi_8_64;
;temp2 = step1b[28][i] * cospi_8_64 + step1b[19][i] * cospi_24_64;
;step2[19] = dct_const_round_shift(temp1);
;step2[28] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d8, d9, d12, d13
STORE_IN_OUTPUT 18, 19, 28, q4, q6
; --------------------------------------------------------------------------
; --------------------------------------------------------------------------
; BLOCK B: 20-23,24-27
; --------------------------------------------------------------------------
; generate 20,21,26,27
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[5 * 32] * cospi_27_64 - input[27 * 32] * cospi_5_64;
;temp2 = input[5 * 32] * cospi_5_64 + input[27 * 32] * cospi_27_64;
;step1b[20][i] = dct_const_round_shift(temp1);
;step1b[27][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 7, 5, 27
DO_BUTTERFLY_STD cospi_27_64, cospi_5_64, d0, d1, d4, d5
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[21 * 32] * cospi_11_64 - input[11 * 32] * cospi_21_64;
;temp2 = input[21 * 32] * cospi_21_64 + input[11 * 32] * cospi_11_64;
;step1b[21][i] = dct_const_round_shift(temp1);
;step1b[26][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 27, 21, 11
DO_BUTTERFLY_STD cospi_11_64, cospi_21_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; part of stage 2
;step2[20] = step1b[20][i] + step1b[21][i];
;step2[21] = step1b[20][i] - step1b[21][i];
;step2[26] = -step1b[26][i] + step1b[27][i];
;step2[27] = step1b[26][i] + step1b[27][i];
vsub.s16 q13, q0, q1
vadd.s16 q0, q0, q1
vsub.s16 q14, q2, q3
vadd.s16 q2, q2, q3
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = step1b[26][i] * cospi_12_64 - step1b[21][i] * cospi_20_64;
;temp2 = step1b[26][i] * cospi_20_64 + step1b[21][i] * cospi_12_64;
;step3[21] = dct_const_round_shift(temp1);
;step3[26] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_12_64, cospi_20_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; generate 22,23,24,25
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[13 * 32] * cospi_19_64 - input[19 * 32] * cospi_13_64;
;temp2 = input[13 * 32] * cospi_13_64 + input[19 * 32] * cospi_19_64;
;step1b[22][i] = dct_const_round_shift(temp1);
;step1b[25][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 11, 13, 19
DO_BUTTERFLY_STD cospi_19_64, cospi_13_64, d10, d11, d14, d15
; --------------------------------------------------------------------------
; part of stage 1
;temp1 = input[29 * 32] * cospi_3_64 - input[3 * 32] * cospi_29_64;
;temp2 = input[29 * 32] * cospi_29_64 + input[3 * 32] * cospi_3_64;
;step1b[23][i] = dct_const_round_shift(temp1);
;step1b[24][i] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 19, 29, 3
DO_BUTTERFLY_STD cospi_3_64, cospi_29_64, d8, d9, d12, d13
; --------------------------------------------------------------------------
; part of stage 2
;step2[22] = -step1b[22][i] + step1b[23][i];
;step2[23] = step1b[22][i] + step1b[23][i];
;step2[24] = step1b[24][i] + step1b[25][i];
;step2[25] = step1b[24][i] - step1b[25][i];
vsub.s16 q14, q4, q5
vadd.s16 q5, q4, q5
vsub.s16 q13, q6, q7
vadd.s16 q6, q6, q7
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = step1b[22][i] * (-cospi_20_64) - step1b[25][i] * (-cospi_12_64);
;temp2 = step1b[22][i] * (-cospi_12_64) + step1b[25][i] * (-cospi_20_64);
;step3[25] = dct_const_round_shift(temp1);
;step3[22] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD (-cospi_20_64), (-cospi_12_64), d8, d9, d14, d15
; --------------------------------------------------------------------------
; combine 20-23,24-27
; --------------------------------------------------------------------------
; part of stage 4
;step1[22] = step1b[22][i] + step1b[21][i];
;step1[23] = step1b[23][i] + step1b[20][i];
vadd.s16 q10, q7, q1
vadd.s16 q11, q5, q0
;step1[24] = step1b[24][i] + step1b[27][i];
;step1[25] = step1b[25][i] + step1b[26][i];
vadd.s16 q12, q6, q2
vadd.s16 q15, q4, q3
; --------------------------------------------------------------------------
; part of stage 6
;step3[16] = step1b[16][i] + step1b[23][i];
;step3[17] = step1b[17][i] + step1b[22][i];
;step3[22] = step1b[17][i] - step1b[22][i];
;step3[23] = step1b[16][i] - step1b[23][i];
LOAD_FROM_OUTPUT 28, 16, 17, q14, q13
vadd.s16 q8, q14, q11
vadd.s16 q9, q13, q10
vsub.s16 q13, q13, q10
vsub.s16 q11, q14, q11
STORE_IN_OUTPUT 17, 17, 16, q9, q8
; --------------------------------------------------------------------------
; part of stage 6
;step3[24] = step1b[31][i] - step1b[24][i];
;step3[25] = step1b[30][i] - step1b[25][i];
;step3[30] = step1b[30][i] + step1b[25][i];
;step3[31] = step1b[31][i] + step1b[24][i];
LOAD_FROM_OUTPUT 16, 30, 31, q14, q9
vsub.s16 q8, q9, q12
vadd.s16 q10, q14, q15
vsub.s16 q14, q14, q15
vadd.s16 q12, q9, q12
STORE_IN_OUTPUT 31, 30, 31, q10, q12
; --------------------------------------------------------------------------
; TODO(cd) do some register allocation change to remove these push/pop
vpush {q8} ; [24]
vpush {q11} ; [23]
; --------------------------------------------------------------------------
; part of stage 7
;temp1 = (step1b[25][i] - step1b[22][i]) * cospi_16_64;
;temp2 = (step1b[25][i] + step1b[22][i]) * cospi_16_64;
;step1[22] = dct_const_round_shift(temp1);
;step1[25] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
STORE_IN_OUTPUT 31, 25, 22, q14, q13
; --------------------------------------------------------------------------
; part of stage 7
;temp1 = (step1b[24][i] - step1b[23][i]) * cospi_16_64;
;temp2 = (step1b[24][i] + step1b[23][i]) * cospi_16_64;
;step1[23] = dct_const_round_shift(temp1);
;step1[24] = dct_const_round_shift(temp2);
; TODO(cd) do some register allocation change to remove these push/pop
vpop {q13} ; [23]
vpop {q14} ; [24]
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
STORE_IN_OUTPUT 22, 24, 23, q14, q13
; --------------------------------------------------------------------------
; part of stage 4
;step1[20] = step1b[23][i] - step1b[20][i];
;step1[27] = step1b[24][i] - step1b[27][i];
vsub.s16 q14, q5, q0
vsub.s16 q13, q6, q2
; --------------------------------------------------------------------------
; part of stage 5
;temp1 = step1b[20][i] * (-cospi_8_64) - step1b[27][i] * (-cospi_24_64);
;temp2 = step1b[20][i] * (-cospi_24_64) + step1b[27][i] * (-cospi_8_64);
;step2[27] = dct_const_round_shift(temp1);
;step2[20] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d10, d11, d12, d13
; --------------------------------------------------------------------------
; part of stage 4
;step1[21] = step1b[22][i] - step1b[21][i];
;step1[26] = step1b[25][i] - step1b[26][i];
vsub.s16 q14, q7, q1
vsub.s16 q13, q4, q3
; --------------------------------------------------------------------------
; part of stage 5
;temp1 = step1b[21][i] * (-cospi_8_64) - step1b[26][i] * (-cospi_24_64);
;temp2 = step1b[21][i] * (-cospi_24_64) + step1b[26][i] * (-cospi_8_64);
;step2[26] = dct_const_round_shift(temp1);
;step2[21] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d0, d1, d2, d3
; --------------------------------------------------------------------------
; part of stage 6
;step3[18] = step1b[18][i] + step1b[21][i];
;step3[19] = step1b[19][i] + step1b[20][i];
;step3[20] = step1b[19][i] - step1b[20][i];
;step3[21] = step1b[18][i] - step1b[21][i];
LOAD_FROM_OUTPUT 23, 18, 19, q14, q13
vadd.s16 q8, q14, q1
vadd.s16 q9, q13, q6
vsub.s16 q13, q13, q6
vsub.s16 q1, q14, q1
STORE_IN_OUTPUT 19, 18, 19, q8, q9
; --------------------------------------------------------------------------
; part of stage 6
;step3[27] = step1b[28][i] - step1b[27][i];
;step3[28] = step1b[28][i] + step1b[27][i];
;step3[29] = step1b[29][i] + step1b[26][i];
;step3[26] = step1b[29][i] - step1b[26][i];
LOAD_FROM_OUTPUT 19, 28, 29, q8, q9
vsub.s16 q14, q8, q5
vadd.s16 q10, q8, q5
vadd.s16 q11, q9, q0
vsub.s16 q0, q9, q0
STORE_IN_OUTPUT 29, 28, 29, q10, q11
; --------------------------------------------------------------------------
; part of stage 7
;temp1 = (step1b[27][i] - step1b[20][i]) * cospi_16_64;
;temp2 = (step1b[27][i] + step1b[20][i]) * cospi_16_64;
;step1[20] = dct_const_round_shift(temp1);
;step1[27] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d26, d27, d28, d29
STORE_IN_OUTPUT 29, 20, 27, q13, q14
; --------------------------------------------------------------------------
; part of stage 7
;temp1 = (step1b[26][i] - step1b[21][i]) * cospi_16_64;
;temp2 = (step1b[26][i] + step1b[21][i]) * cospi_16_64;
;step1[21] = dct_const_round_shift(temp1);
;step1[26] = dct_const_round_shift(temp2);
DO_BUTTERFLY d0, d1, d2, d3, cospi_16_64, cospi_16_64, d2, d3, d0, d1
STORE_IN_OUTPUT 27, 21, 26, q1, q0
; --------------------------------------------------------------------------
; --------------------------------------------------------------------------
; BLOCK C: 8-10,11-15
; --------------------------------------------------------------------------
; generate 8,9,14,15
; --------------------------------------------------------------------------
; part of stage 2
;temp1 = input[2 * 32] * cospi_30_64 - input[30 * 32] * cospi_2_64;
;temp2 = input[2 * 32] * cospi_2_64 + input[30 * 32] * cospi_30_64;
;step2[8] = dct_const_round_shift(temp1);
;step2[15] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 3, 2, 30
DO_BUTTERFLY_STD cospi_30_64, cospi_2_64, d0, d1, d4, d5
; --------------------------------------------------------------------------
; part of stage 2
;temp1 = input[18 * 32] * cospi_14_64 - input[14 * 32] * cospi_18_64;
;temp2 = input[18 * 32] * cospi_18_64 + input[14 * 32] * cospi_14_64;
;step2[9] = dct_const_round_shift(temp1);
;step2[14] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 30, 18, 14
DO_BUTTERFLY_STD cospi_14_64, cospi_18_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; part of stage 3
;step3[8] = step1b[8][i] + step1b[9][i];
;step3[9] = step1b[8][i] - step1b[9][i];
;step3[14] = step1b[15][i] - step1b[14][i];
;step3[15] = step1b[15][i] + step1b[14][i];
vsub.s16 q13, q0, q1
vadd.s16 q0, q0, q1
vsub.s16 q14, q2, q3
vadd.s16 q2, q2, q3
; --------------------------------------------------------------------------
; part of stage 4
;temp1 = step1b[14][i] * cospi_24_64 - step1b[9][i] * cospi_8_64;
;temp2 = step1b[14][i] * cospi_8_64 + step1b[9][i] * cospi_24_64;
;step1[9] = dct_const_round_shift(temp1);
;step1[14] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; generate 10,11,12,13
; --------------------------------------------------------------------------
; part of stage 2
;temp1 = input[10 * 32] * cospi_22_64 - input[22 * 32] * cospi_10_64;
;temp2 = input[10 * 32] * cospi_10_64 + input[22 * 32] * cospi_22_64;
;step2[10] = dct_const_round_shift(temp1);
;step2[13] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 14, 10, 22
DO_BUTTERFLY_STD cospi_22_64, cospi_10_64, d10, d11, d14, d15
; --------------------------------------------------------------------------
; part of stage 2
;temp1 = input[26 * 32] * cospi_6_64 - input[6 * 32] * cospi_26_64;
;temp2 = input[26 * 32] * cospi_26_64 + input[6 * 32] * cospi_6_64;
;step2[11] = dct_const_round_shift(temp1);
;step2[12] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 22, 26, 6
DO_BUTTERFLY_STD cospi_6_64, cospi_26_64, d8, d9, d12, d13
; --------------------------------------------------------------------------
; part of stage 3
;step3[10] = step1b[11][i] - step1b[10][i];
;step3[11] = step1b[11][i] + step1b[10][i];
;step3[12] = step1b[12][i] + step1b[13][i];
;step3[13] = step1b[12][i] - step1b[13][i];
vsub.s16 q14, q4, q5
vadd.s16 q5, q4, q5
vsub.s16 q13, q6, q7
vadd.s16 q6, q6, q7
; --------------------------------------------------------------------------
; part of stage 4
;temp1 = step1b[10][i] * (-cospi_8_64) - step1b[13][i] * (-cospi_24_64);
;temp2 = step1b[10][i] * (-cospi_24_64) + step1b[13][i] * (-cospi_8_64);
;step1[13] = dct_const_round_shift(temp1);
;step1[10] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD (-cospi_8_64), (-cospi_24_64), d8, d9, d14, d15
; --------------------------------------------------------------------------
; combine 8-10,11-15
; --------------------------------------------------------------------------
; part of stage 5
;step2[8] = step1b[8][i] + step1b[11][i];
;step2[9] = step1b[9][i] + step1b[10][i];
;step2[10] = step1b[9][i] - step1b[10][i];
vadd.s16 q8, q0, q5
vadd.s16 q9, q1, q7
vsub.s16 q13, q1, q7
;step2[13] = step1b[14][i] - step1b[13][i];
;step2[14] = step1b[14][i] + step1b[13][i];
;step2[15] = step1b[15][i] + step1b[12][i];
vsub.s16 q14, q3, q4
vadd.s16 q10, q3, q4
vadd.s16 q15, q2, q6
STORE_IN_OUTPUT 26, 8, 15, q8, q15
STORE_IN_OUTPUT 15, 9, 14, q9, q10
; --------------------------------------------------------------------------
; part of stage 6
;temp1 = (step1b[13][i] - step1b[10][i]) * cospi_16_64;
;temp2 = (step1b[13][i] + step1b[10][i]) * cospi_16_64;
;step3[10] = dct_const_round_shift(temp1);
;step3[13] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
STORE_IN_OUTPUT 14, 13, 10, q3, q1
; --------------------------------------------------------------------------
; part of stage 5
;step2[11] = step1b[8][i] - step1b[11][i];
;step2[12] = step1b[15][i] - step1b[12][i];
vsub.s16 q13, q0, q5
vsub.s16 q14, q2, q6
; --------------------------------------------------------------------------
; part of stage 6
;temp1 = (step1b[12][i] - step1b[11][i]) * cospi_16_64;
;temp2 = (step1b[12][i] + step1b[11][i]) * cospi_16_64;
;step3[11] = dct_const_round_shift(temp1);
;step3[12] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
STORE_IN_OUTPUT 10, 11, 12, q1, q3
; --------------------------------------------------------------------------
; --------------------------------------------------------------------------
; BLOCK D: 0-3,4-7
; --------------------------------------------------------------------------
; generate 4,5,6,7
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = input[4 * 32] * cospi_28_64 - input[28 * 32] * cospi_4_64;
;temp2 = input[4 * 32] * cospi_4_64 + input[28 * 32] * cospi_28_64;
;step3[4] = dct_const_round_shift(temp1);
;step3[7] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 6, 4, 28
DO_BUTTERFLY_STD cospi_28_64, cospi_4_64, d0, d1, d4, d5
; --------------------------------------------------------------------------
; part of stage 3
;temp1 = input[20 * 32] * cospi_12_64 - input[12 * 32] * cospi_20_64;
;temp2 = input[20 * 32] * cospi_20_64 + input[12 * 32] * cospi_12_64;
;step3[5] = dct_const_round_shift(temp1);
;step3[6] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 28, 20, 12
DO_BUTTERFLY_STD cospi_12_64, cospi_20_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; part of stage 4
;step1[4] = step1b[4][i] + step1b[5][i];
;step1[5] = step1b[4][i] - step1b[5][i];
;step1[6] = step1b[7][i] - step1b[6][i];
;step1[7] = step1b[7][i] + step1b[6][i];
vsub.s16 q13, q0, q1
vadd.s16 q0, q0, q1
vsub.s16 q14, q2, q3
vadd.s16 q2, q2, q3
; --------------------------------------------------------------------------
; part of stage 5
;temp1 = (step1b[6][i] - step1b[5][i]) * cospi_16_64;
;temp2 = (step1b[5][i] + step1b[6][i]) * cospi_16_64;
;step2[5] = dct_const_round_shift(temp1);
;step2[6] = dct_const_round_shift(temp2);
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d2, d3, d6, d7
; --------------------------------------------------------------------------
; generate 0,1,2,3
; --------------------------------------------------------------------------
; part of stage 4
;temp1 = (input[0 * 32] - input[16 * 32]) * cospi_16_64;
;temp2 = (input[0 * 32] + input[16 * 32]) * cospi_16_64;
;step1[1] = dct_const_round_shift(temp1);
;step1[0] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 12, 0, 16
DO_BUTTERFLY_STD cospi_16_64, cospi_16_64, d10, d11, d14, d15
; --------------------------------------------------------------------------
; part of stage 4
;temp1 = input[8 * 32] * cospi_24_64 - input[24 * 32] * cospi_8_64;
;temp2 = input[8 * 32] * cospi_8_64 + input[24 * 32] * cospi_24_64;
;step1[2] = dct_const_round_shift(temp1);
;step1[3] = dct_const_round_shift(temp2);
LOAD_FROM_TRANSPOSED 16, 8, 24
DO_BUTTERFLY_STD cospi_24_64, cospi_8_64, d28, d29, d12, d13
; --------------------------------------------------------------------------
; part of stage 5
;step2[0] = step1b[0][i] + step1b[3][i];
;step2[1] = step1b[1][i] + step1b[2][i];
;step2[2] = step1b[1][i] - step1b[2][i];
;step2[3] = step1b[0][i] - step1b[3][i];
vadd.s16 q4, q7, q6
vsub.s16 q7, q7, q6
vsub.s16 q6, q5, q14
vadd.s16 q5, q5, q14
; --------------------------------------------------------------------------
; combine 0-3,4-7
; --------------------------------------------------------------------------
; part of stage 6
;step3[0] = step1b[0][i] + step1b[7][i];
;step3[1] = step1b[1][i] + step1b[6][i];
;step3[2] = step1b[2][i] + step1b[5][i];
;step3[3] = step1b[3][i] + step1b[4][i];
vadd.s16 q8, q4, q2
vadd.s16 q9, q5, q3
vadd.s16 q10, q6, q1
vadd.s16 q11, q7, q0
;step3[4] = step1b[3][i] - step1b[4][i];
;step3[5] = step1b[2][i] - step1b[5][i];
;step3[6] = step1b[1][i] - step1b[6][i];
;step3[7] = step1b[0][i] - step1b[7][i];
vsub.s16 q12, q7, q0
vsub.s16 q13, q6, q1
vsub.s16 q14, q5, q3
vsub.s16 q15, q4, q2
; --------------------------------------------------------------------------
; part of stage 7
;step1[0] = step1b[0][i] + step1b[15][i];
;step1[1] = step1b[1][i] + step1b[14][i];
;step1[14] = step1b[1][i] - step1b[14][i];
;step1[15] = step1b[0][i] - step1b[15][i];
LOAD_FROM_OUTPUT 12, 14, 15, q0, q1
vadd.s16 q2, q8, q1
vadd.s16 q3, q9, q0
vsub.s16 q4, q9, q0
vsub.s16 q5, q8, q1
; --------------------------------------------------------------------------
; part of final stage
;output[14 * 32] = step1b[14][i] + step1b[17][i];
;output[15 * 32] = step1b[15][i] + step1b[16][i];
;output[16 * 32] = step1b[15][i] - step1b[16][i];
;output[17 * 32] = step1b[14][i] - step1b[17][i];
LOAD_FROM_OUTPUT 15, 16, 17, q0, q1
vadd.s16 q8, q4, q1
vadd.s16 q9, q5, q0
vsub.s16 q6, q5, q0
vsub.s16 q7, q4, q1
STORE_IN_OUTPUT 17, 17, 16, q7, q6
STORE_IN_OUTPUT 16, 15, 14, q9, q8
; --------------------------------------------------------------------------
; part of final stage
;output[ 0 * 32] = step1b[0][i] + step1b[31][i];
;output[ 1 * 32] = step1b[1][i] + step1b[30][i];
;output[30 * 32] = step1b[1][i] - step1b[30][i];
;output[31 * 32] = step1b[0][i] - step1b[31][i];
LOAD_FROM_OUTPUT 14, 30, 31, q0, q1
vadd.s16 q4, q2, q1
vadd.s16 q5, q3, q0
vsub.s16 q6, q3, q0
vsub.s16 q7, q2, q1
STORE_IN_OUTPUT 31, 31, 30, q7, q6
STORE_IN_OUTPUT 30, 0, 1, q4, q5
; --------------------------------------------------------------------------
; part of stage 7
;step1[2] = step1b[2][i] + step1b[13][i];
;step1[3] = step1b[3][i] + step1b[12][i];
;step1[12] = step1b[3][i] - step1b[12][i];
;step1[13] = step1b[2][i] - step1b[13][i];
LOAD_FROM_OUTPUT 1, 12, 13, q0, q1
vadd.s16 q2, q10, q1
vadd.s16 q3, q11, q0
vsub.s16 q4, q11, q0
vsub.s16 q5, q10, q1
; --------------------------------------------------------------------------
; part of final stage
;output[12 * 32] = step1b[12][i] + step1b[19][i];
;output[13 * 32] = step1b[13][i] + step1b[18][i];
;output[18 * 32] = step1b[13][i] - step1b[18][i];
;output[19 * 32] = step1b[12][i] - step1b[19][i];
LOAD_FROM_OUTPUT 13, 18, 19, q0, q1
vadd.s16 q6, q4, q1
vadd.s16 q7, q5, q0
vsub.s16 q8, q5, q0
vsub.s16 q9, q4, q1
STORE_IN_OUTPUT 19, 19, 18, q9, q8
STORE_IN_OUTPUT 18, 13, 12, q7, q6
; --------------------------------------------------------------------------
; part of final stage
;output[ 2 * 32] = step1b[2][i] + step1b[29][i];
;output[ 3 * 32] = step1b[3][i] + step1b[28][i];
;output[28 * 32] = step1b[3][i] - step1b[28][i];
;output[29 * 32] = step1b[2][i] - step1b[29][i];
LOAD_FROM_OUTPUT 12, 28, 29, q0, q1
vadd.s16 q4, q2, q1
vadd.s16 q5, q3, q0
vsub.s16 q6, q3, q0
vsub.s16 q7, q2, q1
STORE_IN_OUTPUT 29, 29, 28, q7, q6
STORE_IN_OUTPUT 28, 2, 3, q4, q5
; --------------------------------------------------------------------------
; part of stage 7
;step1[4] = step1b[4][i] + step1b[11][i];
;step1[5] = step1b[5][i] + step1b[10][i];
;step1[10] = step1b[5][i] - step1b[10][i];
;step1[11] = step1b[4][i] - step1b[11][i];
LOAD_FROM_OUTPUT 3, 10, 11, q0, q1
vadd.s16 q2, q12, q1
vadd.s16 q3, q13, q0
vsub.s16 q4, q13, q0
vsub.s16 q5, q12, q1
; --------------------------------------------------------------------------
; part of final stage
;output[10 * 32] = step1b[10][i] + step1b[21][i];
;output[11 * 32] = step1b[11][i] + step1b[20][i];
;output[20 * 32] = step1b[11][i] - step1b[20][i];
;output[21 * 32] = step1b[10][i] - step1b[21][i];
LOAD_FROM_OUTPUT 11, 20, 21, q0, q1
vadd.s16 q6, q4, q1
vadd.s16 q7, q5, q0
vsub.s16 q8, q5, q0
vsub.s16 q9, q4, q1
STORE_IN_OUTPUT 21, 21, 20, q9, q8
STORE_IN_OUTPUT 20, 11, 10, q7, q6
; --------------------------------------------------------------------------
; part of final stage
;output[ 4 * 32] = step1b[4][i] + step1b[27][i];
;output[ 5 * 32] = step1b[5][i] + step1b[26][i];
;output[26 * 32] = step1b[5][i] - step1b[26][i];
;output[27 * 32] = step1b[4][i] - step1b[27][i];
LOAD_FROM_OUTPUT 10, 26, 27, q0, q1
vadd.s16 q4, q2, q1
vadd.s16 q5, q3, q0
vsub.s16 q6, q3, q0
vsub.s16 q7, q2, q1
STORE_IN_OUTPUT 27, 27, 26, q7, q6
STORE_IN_OUTPUT 26, 4, 5, q4, q5
; --------------------------------------------------------------------------
; part of stage 7
;step1[6] = step1b[6][i] + step1b[9][i];
;step1[7] = step1b[7][i] + step1b[8][i];
;step1[8] = step1b[7][i] - step1b[8][i];
;step1[9] = step1b[6][i] - step1b[9][i];
LOAD_FROM_OUTPUT 5, 8, 9, q0, q1
vadd.s16 q2, q14, q1
vadd.s16 q3, q15, q0
vsub.s16 q4, q15, q0
vsub.s16 q5, q14, q1
; --------------------------------------------------------------------------
; part of final stage
;output[ 8 * 32] = step1b[8][i] + step1b[23][i];
;output[ 9 * 32] = step1b[9][i] + step1b[22][i];
;output[22 * 32] = step1b[9][i] - step1b[22][i];
;output[23 * 32] = step1b[8][i] - step1b[23][i];
LOAD_FROM_OUTPUT 9, 22, 23, q0, q1
vadd.s16 q6, q4, q1
vadd.s16 q7, q5, q0
vsub.s16 q8, q5, q0
vsub.s16 q9, q4, q1
STORE_IN_OUTPUT 23, 23, 22, q9, q8
STORE_IN_OUTPUT 22, 9, 8, q7, q6
; --------------------------------------------------------------------------
; part of final stage
;output[ 6 * 32] = step1b[6][i] + step1b[25][i];
;output[ 7 * 32] = step1b[7][i] + step1b[24][i];
;output[24 * 32] = step1b[7][i] - step1b[24][i];
;output[25 * 32] = step1b[6][i] - step1b[25][i];
LOAD_FROM_OUTPUT 8, 24, 25, q0, q1
vadd.s16 q4, q2, q1
vadd.s16 q5, q3, q0
vsub.s16 q6, q3, q0
vsub.s16 q7, q2, q1
STORE_IN_OUTPUT 25, 25, 24, q7, q6
STORE_IN_OUTPUT 24, 6, 7, q4, q5
; --------------------------------------------------------------------------
; TODO(cd) get rid of these push/pop by properly adjusting register
; content at end of loop
pop {r2}
pop {r1}
pop {r0}
add r1, r1, #8*2
add r2, r2, #8*32*2
; bands loop processing
add r4, r4, #1
cmp r4, #3
BLE idct32_bands_loop
pop {r4}
bx lr
ENDP ; |idct32_transpose_and_transform|
;void idct32_combine_add(uint8_t *dest, int16_t *out, int dest_stride);
;
; r0 uint8_t *dest
; r1 int16_t *out
; r2 int dest_stride)
|idct32_combine_add| PROC
mov r12, r0 ; dest pointer used for stores
sub r2, r2, #32 ; adjust the stride (remove the post-increments)
mov r3, #0 ; initialize loop counter
idct32_combine_add_loop
; load out[j * 32 + 0-31]
vld1.s16 {q12}, [r1]!
vld1.s16 {q13}, [r1]!
vld1.s16 {q14}, [r1]!
vld1.s16 {q15}, [r1]!
; load dest[j * dest_stride + 0-31]
vld1.s16 {q6}, [r0]!
vld1.s16 {q7}, [r0]!
; ROUND_POWER_OF_TWO
vrshr.s16 q12, q12, #6
vrshr.s16 q13, q13, #6
vrshr.s16 q14, q14, #6
vrshr.s16 q15, q15, #6
; add to dest[j * dest_stride + 0-31]
vaddw.u8 q12, q12, d12
vaddw.u8 q13, q13, d13
vaddw.u8 q14, q14, d14
vaddw.u8 q15, q15, d15
; clip pixel
vqmovun.s16 d12, q12
vqmovun.s16 d13, q13
vqmovun.s16 d14, q14
vqmovun.s16 d15, q15
; store back into dest[j * dest_stride + 0-31]
vst1.16 {q6}, [r12]!
vst1.16 {q7}, [r12]!
; increment pointers by adjusted stride (not necessary for r1/out)
add r0, r0, r2
add r12, r12, r2
; loop processing
add r3, r3, #1
cmp r3, #31
BLE idct32_combine_add_loop
bx lr
ENDP ; |idct32_transpose|
END
| huangwenjun06/libvpx_mips | vp9/common/arm/neon/vp9_short_idct32x32_add_neon.asm | Assembly | bsd-3-clause | 43,373 |
bits 64
mov rax,11223344h
mov rax,dword 11223344h
mov eax,11223344h
mov [rax],dword 11223344h ; 32-bit operation
mov qword [rax],11223344h
mov qword [rax],dword 11223344h
mov rax,0_ffffffff_8899aabbh
mov rax,dword 0_ffffffff_8899aabbh
mov eax,0_ffffffff_8899aabbh
mov [rax],dword 0_ffffffff_8899aabbh ; 32-bit operation
mov qword [rax],0_ffffffff_8899aabbh
mov qword [rax],dword 0_ffffffff_8899aabbh
mov rax,7fffffffh
mov rax,80000000h
mov rax,0_ffffffffh
mov rax,1_00000000h
mov rax,0_ffffffff_7fffffffh
mov rax,0_ffffffff_80000000h
mov rax,0_11223344_8899aabbh
mov rax,dword 0_11223344_8899aabbh
mov eax,0_11223344_8899aabbh
mov [rax],dword 0_11223344_8899aabbh ; 32-bit operation
mov qword [rax],0_11223344_8899aabbh
mov qword [rax],dword 0_11223344_8899aabbh
mov rax,strict 11223344h
mov rax,strict dword 11223344h
mov eax,strict 11223344h
mov [rax],strict dword 11223344h ; 32-bit operation
mov qword [rax],strict 11223344h
mov qword [rax],strict dword 11223344h
mov rax,strict 0_ffffffff_8899aabbh
mov rax,strict dword 0_ffffffff_8899aabbh
mov eax,strict 0_ffffffff_8899aabbh
mov [rax],strict dword 0_ffffffff_8899aabbh ; 32-bit operation
mov qword [rax],strict 0_ffffffff_8899aabbh
mov qword [rax],strict dword 0_ffffffff_8899aabbh
mov rax,strict 7fffffffh
mov rax,strict 80000000h
mov rax,strict 0_ffffffffh
mov rax,strict 1_00000000h
mov rax,strict 0_ffffffff_7fffffffh
mov rax,strict 0_ffffffff_80000000h
mov rax,strict 0_11223344_8899aabbh
mov rax,strict dword 0_11223344_8899aabbh
mov eax,strict 0_11223344_8899aabbh
mov [rax],strict dword 0_11223344_8899aabbh ; 32-bit operation
mov qword [rax],strict 0_11223344_8899aabbh
mov qword [rax],strict dword 0_11223344_8899aabbh
| techkey/nasm | travis/test/imm64.asm | Assembly | bsd-2-clause | 1,744 |
forever:
inner:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
inc r1
brne inner
inc r0
brne inner
break
| minf/avrora | src/avrora/test/bench/nop.asm | Assembly | bsd-3-clause | 352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.