text stringlengths 1 1.05M |
|---|
;
; 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 copy_mem16x16_sse2(
; unsigned char *src,
; int src_stride,
; unsigned char *dst,
; int dst_stride
; )
global sym(vp8_copy_mem16x16_sse2)
sym(vp8_copy_mem16x16_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 4
push rsi
push rdi
; end prolog
mov rsi, arg(0) ;src;
movdqu xmm0, [rsi]
movsxd rax, dword ptr arg(1) ;src_stride;
mov rdi, arg(2) ;dst;
movdqu xmm1, [rsi+rax]
movdqu xmm2, [rsi+rax*2]
movsxd rcx, dword ptr arg(3) ;dst_stride
lea rsi, [rsi+rax*2]
movdqa [rdi], xmm0
add rsi, rax
movdqa [rdi+rcx], xmm1
movdqa [rdi+rcx*2],xmm2
lea rdi, [rdi+rcx*2]
movdqu xmm3, [rsi]
add rdi, rcx
movdqu xmm4, [rsi+rax]
movdqu xmm5, [rsi+rax*2]
lea rsi, [rsi+rax*2]
movdqa [rdi], xmm3
add rsi, rax
movdqa [rdi+rcx], xmm4
movdqa [rdi+rcx*2],xmm5
lea rdi, [rdi+rcx*2]
movdqu xmm0, [rsi]
add rdi, rcx
movdqu xmm1, [rsi+rax]
movdqu xmm2, [rsi+rax*2]
lea rsi, [rsi+rax*2]
movdqa [rdi], xmm0
add rsi, rax
movdqa [rdi+rcx], xmm1
movdqa [rdi+rcx*2], xmm2
movdqu xmm3, [rsi]
movdqu xmm4, [rsi+rax]
lea rdi, [rdi+rcx*2]
add rdi, rcx
movdqu xmm5, [rsi+rax*2]
lea rsi, [rsi+rax*2]
movdqa [rdi], xmm3
add rsi, rax
movdqa [rdi+rcx], xmm4
movdqa [rdi+rcx*2],xmm5
movdqu xmm0, [rsi]
lea rdi, [rdi+rcx*2]
movdqu xmm1, [rsi+rax]
add rdi, rcx
movdqu xmm2, [rsi+rax*2]
lea rsi, [rsi+rax*2]
movdqa [rdi], xmm0
movdqa [rdi+rcx], xmm1
movdqa [rdi+rcx*2],xmm2
movdqu xmm3, [rsi+rax]
lea rdi, [rdi+rcx*2]
movdqa [rdi+rcx], xmm3
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_dc_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_uv_dc_mmx2)
sym(vp8_intra_pred_uv_dc_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
; end prolog
; from top
mov rdi, arg(2) ;above;
mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(4) ;left_stride;
pxor mm0, mm0
movq mm1, [rdi]
lea rdi, [rax*3]
psadbw mm1, mm0
; from left
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax*1]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
lea rsi, [rsi+rax*4]
add ecx, edx
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
; add up
pextrw edx, mm1, 0x0
lea edx, [edx+ecx+8]
sar edx, 4
movd mm1, edx
movsxd rcx, dword ptr arg(1) ;dst_stride
pshufw mm1, mm1, 0x0
mov rdi, arg(0) ;dst;
packuswb mm1, mm1
; write out
lea rax, [rcx*3]
lea rdx, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
movq [rdx ], mm1
movq [rdx+rcx ], mm1
movq [rdx+rcx*2], mm1
movq [rdx+rax ], mm1
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_dctop_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_uv_dctop_mmx2)
sym(vp8_intra_pred_uv_dctop_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx
push rsi
push rdi
; end prolog
;arg(3), arg(4) not used
; from top
mov rsi, arg(2) ;above;
pxor mm0, mm0
movq mm1, [rsi]
psadbw mm1, mm0
; add up
paddw mm1, [GLOBAL(dc_4)]
psraw mm1, 3
pshufw mm1, mm1, 0x0
packuswb mm1, mm1
; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_dcleft_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_uv_dcleft_mmx2)
sym(vp8_intra_pred_uv_dcleft_mmx2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
; end prolog
;arg(2) not used
; from left
mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(4) ;left_stride;
lea rdi, [rax*3]
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
lea edx, [ecx+edx+4]
; add up
shr edx, 3
movd mm1, edx
pshufw mm1, mm1, 0x0
packuswb mm1, mm1
; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4]
movq [rdi ], mm1
movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_dc128_mmx(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_uv_dc128_mmx)
sym(vp8_intra_pred_uv_dc128_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx
; end prolog
;arg(2), arg(3), arg(4) not used
; write out
movq mm1, [GLOBAL(dc_128)]
mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
lea rax, [rax+rdx*4]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
; begin epilog
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_tm_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
%macro vp8_intra_pred_uv_tm 1
global sym(vp8_intra_pred_uv_tm_%1)
sym(vp8_intra_pred_uv_tm_%1):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx
push rsi
push rdi
; end prolog
; read top row
mov edx, 4
mov rsi, arg(2) ;above
movsxd rax, dword ptr arg(4) ;left_stride;
pxor xmm0, xmm0
%ifidn %1, ssse3
movdqa xmm2, [GLOBAL(dc_1024)]
%endif
movq xmm1, [rsi]
punpcklbw xmm1, xmm0
; set up left ptrs ans subtract topleft
movd xmm3, [rsi-1]
mov rsi, arg(3) ;left;
%ifidn %1, sse2
punpcklbw xmm3, xmm0
pshuflw xmm3, xmm3, 0x0
punpcklqdq xmm3, xmm3
%else
pshufb xmm3, xmm2
%endif
psubw xmm1, xmm3
; set up dest ptrs
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
.vp8_intra_pred_uv_tm_%1_loop:
movd xmm3, [rsi]
movd xmm5, [rsi+rax]
%ifidn %1, sse2
punpcklbw xmm3, xmm0
punpcklbw xmm5, xmm0
pshuflw xmm3, xmm3, 0x0
pshuflw xmm5, xmm5, 0x0
punpcklqdq xmm3, xmm3
punpcklqdq xmm5, xmm5
%else
pshufb xmm3, xmm2
pshufb xmm5, xmm2
%endif
paddw xmm3, xmm1
paddw xmm5, xmm1
packuswb xmm3, xmm5
movq [rdi ], xmm3
movhps[rdi+rcx], xmm3
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz .vp8_intra_pred_uv_tm_%1_loop
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
%endmacro
vp8_intra_pred_uv_tm sse2
vp8_intra_pred_uv_tm ssse3
;void vp8_intra_pred_uv_ve_mmx(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_uv_ve_mmx)
sym(vp8_intra_pred_uv_ve_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
; end prolog
; arg(3), arg(4) not used
; read from top
mov rax, arg(2) ;src;
movq mm1, [rax]
; write out
mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
lea rax, [rax+rdx*4]
movq [rax ], mm1
movq [rax+rdx ], mm1
movq [rax+rdx*2], mm1
movq [rax+rcx ], mm1
; begin epilog
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_uv_ho_mmx2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
%macro vp8_intra_pred_uv_ho 1
global sym(vp8_intra_pred_uv_ho_%1)
sym(vp8_intra_pred_uv_ho_%1):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
%ifidn %1, ssse3
%ifndef GET_GOT_SAVE_ARG
push rbx
%endif
GET_GOT rbx
%endif
; end prolog
;arg(2) not used
; read from left and write out
%ifidn %1, mmx2
mov edx, 4
%endif
mov rsi, arg(3) ;left
movsxd rax, dword ptr arg(4) ;left_stride;
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
%ifidn %1, ssse3
lea rdx, [rcx*3]
movdqa xmm2, [GLOBAL(dc_00001111)]
lea rbx, [rax*3]
%endif
%ifidn %1, mmx2
.vp8_intra_pred_uv_ho_%1_loop:
movd mm0, [rsi]
movd mm1, [rsi+rax]
punpcklbw mm0, mm0
punpcklbw mm1, mm1
pshufw mm0, mm0, 0x0
pshufw mm1, mm1, 0x0
movq [rdi ], mm0
movq [rdi+rcx], mm1
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz .vp8_intra_pred_uv_ho_%1_loop
%else
movd xmm0, [rsi]
movd xmm3, [rsi+rax]
movd xmm1, [rsi+rax*2]
movd xmm4, [rsi+rbx]
punpcklbw xmm0, xmm3
punpcklbw xmm1, xmm4
pshufb xmm0, xmm2
pshufb xmm1, xmm2
movq [rdi ], xmm0
movhps [rdi+rcx], xmm0
movq [rdi+rcx*2], xmm1
movhps [rdi+rdx], xmm1
lea rsi, [rsi+rax*4]
lea rdi, [rdi+rcx*4]
movd xmm0, [rsi]
movd xmm3, [rsi+rax]
movd xmm1, [rsi+rax*2]
movd xmm4, [rsi+rbx]
punpcklbw xmm0, xmm3
punpcklbw xmm1, xmm4
pshufb xmm0, xmm2
pshufb xmm1, xmm2
movq [rdi ], xmm0
movhps [rdi+rcx], xmm0
movq [rdi+rcx*2], xmm1
movhps [rdi+rdx], xmm1
%endif
; begin epilog
%ifidn %1, ssse3
RESTORE_GOT
%ifndef GET_GOT_SAVE_ARG
pop rbx
%endif
%endif
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
%endmacro
vp8_intra_pred_uv_ho mmx2
vp8_intra_pred_uv_ho ssse3
;void vp8_intra_pred_y_dc_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
global sym(vp8_intra_pred_y_dc_sse2)
sym(vp8_intra_pred_y_dc_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
; end prolog
; from top
mov rdi, arg(2) ;above
mov rsi, arg(3) ;left
movsxd rax, dword ptr arg(4) ;left_stride;
pxor xmm0, xmm0
movdqa xmm1, [rdi]
psadbw xmm1, xmm0
movq xmm2, xmm1
punpckhqdq xmm1, xmm1
paddw xmm1, xmm2
; from left
lea rdi, [rax*3]
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
; add up
pextrw edx, xmm1, 0x0
lea edx, [edx+ecx+16]
sar edx, 5
movd xmm1, edx
; FIXME use pshufb for ssse3 version
pshuflw xmm1, xmm1, 0x0
punpcklqdq xmm1, xmm1
packuswb xmm1, xmm1
; write out
mov rsi, 2
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
.label
movdqa [rdi ], xmm1
movdqa [rdi+rcx ], xmm1
movdqa [rdi+rcx*2], xmm1
movdqa [rdi+rax ], xmm1
lea rdi, [rdi+rcx*4]
movdqa [rdi ], xmm1
movdqa [rdi+rcx ], xmm1
movdqa [rdi+rcx*2], xmm1
movdqa [rdi+rax ], xmm1
lea rdi, [rdi+rcx*4]
dec rsi
jnz .label
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_y_dctop_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
global sym(vp8_intra_pred_y_dctop_sse2)
sym(vp8_intra_pred_y_dctop_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
GET_GOT rbx
; end prolog
;arg(3), arg(4) not used
; from top
mov rcx, arg(2) ;above;
pxor xmm0, xmm0
movdqa xmm1, [rcx]
psadbw xmm1, xmm0
movdqa xmm2, xmm1
punpckhqdq xmm1, xmm1
paddw xmm1, xmm2
; add up
paddw xmm1, [GLOBAL(dc_8)]
psraw xmm1, 4
; FIXME use pshufb for ssse3 version
pshuflw xmm1, xmm1, 0x0
punpcklqdq xmm1, xmm1
packuswb xmm1, xmm1
; write out
mov rsi, 2
mov rdx, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
.label
movdqa [rdx ], xmm1
movdqa [rdx+rcx ], xmm1
movdqa [rdx+rcx*2], xmm1
movdqa [rdx+rax ], xmm1
lea rdx, [rdx+rcx*4]
movdqa [rdx ], xmm1
movdqa [rdx+rcx ], xmm1
movdqa [rdx+rcx*2], xmm1
movdqa [rdx+rax ], xmm1
lea rdx, [rdx+rcx*4]
dec rsi
jnz .label
; begin epilog
RESTORE_GOT
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_y_dcleft_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
global sym(vp8_intra_pred_y_dcleft_sse2)
sym(vp8_intra_pred_y_dcleft_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
; end prolog
;arg(2) not used
; from left
mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(4) ;left_stride;
lea rdi, [rax*3]
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
add ecx, edx
lea rsi, [rsi+rax*4]
movzx edx, byte [rsi]
add ecx, edx
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2]
add ecx, edx
movzx edx, byte [rsi+rdi]
lea edx, [ecx+edx+8]
; add up
shr edx, 4
movd xmm1, edx
; FIXME use pshufb for ssse3 version
pshuflw xmm1, xmm1, 0x0
punpcklqdq xmm1, xmm1
packuswb xmm1, xmm1
; write out
mov rsi, 2
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3]
.label
movdqa [rdi ], xmm1
movdqa [rdi+rcx ], xmm1
movdqa [rdi+rcx*2], xmm1
movdqa [rdi+rax ], xmm1
lea rdi, [rdi+rcx*4]
movdqa [rdi ], xmm1
movdqa [rdi+rcx ], xmm1
movdqa [rdi+rcx*2], xmm1
movdqa [rdi+rax ], xmm1
lea rdi, [rdi+rcx*4]
dec rsi
jnz .label
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_y_dc128_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
global sym(vp8_intra_pred_y_dc128_sse2)
sym(vp8_intra_pred_y_dc128_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
GET_GOT rbx
; end prolog
;arg(2), arg(3), arg(4) not used
; write out
mov rsi, 2
movdqa xmm1, [GLOBAL(dc_128)]
mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3]
.label
movdqa [rax ], xmm1
movdqa [rax+rdx ], xmm1
movdqa [rax+rdx*2], xmm1
movdqa [rax+rcx ], xmm1
lea rax, [rax+rdx*4]
movdqa [rax ], xmm1
movdqa [rax+rdx ], xmm1
movdqa [rax+rdx*2], xmm1
movdqa [rax+rcx ], xmm1
lea rax, [rax+rdx*4]
dec rsi
jnz .label
; begin epilog
RESTORE_GOT
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_y_tm_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
%macro vp8_intra_pred_y_tm 1
global sym(vp8_intra_pred_y_tm_%1)
sym(vp8_intra_pred_y_tm_%1):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
GET_GOT rbx
; end prolog
; read top row
mov edx, 8
mov rsi, arg(2) ;above
movsxd rax, dword ptr arg(4) ;left_stride;
pxor xmm0, xmm0
%ifidn %1, ssse3
movdqa xmm3, [GLOBAL(dc_1024)]
%endif
movdqa xmm1, [rsi]
movdqa xmm2, xmm1
punpcklbw xmm1, xmm0
punpckhbw xmm2, xmm0
; set up left ptrs ans subtract topleft
movd xmm4, [rsi-1]
mov rsi, arg(3) ;left
%ifidn %1, sse2
punpcklbw xmm4, xmm0
pshuflw xmm4, xmm4, 0x0
punpcklqdq xmm4, xmm4
%else
pshufb xmm4, xmm3
%endif
psubw xmm1, xmm4
psubw xmm2, xmm4
; set up dest ptrs
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
vp8_intra_pred_y_tm_%1_loop:
movd xmm4, [rsi]
movd xmm5, [rsi+rax]
%ifidn %1, sse2
punpcklbw xmm4, xmm0
punpcklbw xmm5, xmm0
pshuflw xmm4, xmm4, 0x0
pshuflw xmm5, xmm5, 0x0
punpcklqdq xmm4, xmm4
punpcklqdq xmm5, xmm5
%else
pshufb xmm4, xmm3
pshufb xmm5, xmm3
%endif
movdqa xmm6, xmm4
movdqa xmm7, xmm5
paddw xmm4, xmm1
paddw xmm6, xmm2
paddw xmm5, xmm1
paddw xmm7, xmm2
packuswb xmm4, xmm6
packuswb xmm5, xmm7
movdqa [rdi ], xmm4
movdqa [rdi+rcx], xmm5
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz vp8_intra_pred_y_tm_%1_loop
; begin epilog
RESTORE_GOT
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
%endmacro
vp8_intra_pred_y_tm sse2
vp8_intra_pred_y_tm ssse3
;void vp8_intra_pred_y_ve_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride
; )
global sym(vp8_intra_pred_y_ve_sse2)
sym(vp8_intra_pred_y_ve_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
; end prolog
;arg(3), arg(4) not used
mov rax, arg(2) ;above;
mov rsi, 2
movsxd rdx, dword ptr arg(1) ;dst_stride
; read from top
movdqa xmm1, [rax]
; write out
mov rax, arg(0) ;dst;
lea rcx, [rdx*3]
.label
movdqa [rax ], xmm1
movdqa [rax+rdx ], xmm1
movdqa [rax+rdx*2], xmm1
movdqa [rax+rcx ], xmm1
lea rax, [rax+rdx*4]
movdqa [rax ], xmm1
movdqa [rax+rdx ], xmm1
movdqa [rax+rdx*2], xmm1
movdqa [rax+rcx ], xmm1
lea rax, [rax+rdx*4]
dec rsi
jnz .label
; begin epilog
pop rsi
UNSHADOW_ARGS
pop rbp
ret
;void vp8_intra_pred_y_ho_sse2(
; unsigned char *dst,
; int dst_stride
; unsigned char *above,
; unsigned char *left,
; int left_stride,
; )
global sym(vp8_intra_pred_y_ho_sse2)
sym(vp8_intra_pred_y_ho_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
push rsi
push rdi
; end prolog
;arg(2) not used
; read from left and write out
mov edx, 8
mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(4) ;left_stride;
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
vp8_intra_pred_y_ho_sse2_loop:
movd xmm0, [rsi]
movd xmm1, [rsi+rax]
; FIXME use pshufb for ssse3 version
punpcklbw xmm0, xmm0
punpcklbw xmm1, xmm1
pshuflw xmm0, xmm0, 0x0
pshuflw xmm1, xmm1, 0x0
punpcklqdq xmm0, xmm0
punpcklqdq xmm1, xmm1
movdqa [rdi ], xmm0
movdqa [rdi+rcx], xmm1
lea rsi, [rsi+rax*2]
lea rdi, [rdi+rcx*2]
dec edx
jnz vp8_intra_pred_y_ho_sse2_loop
; begin epilog
pop rdi
pop rsi
UNSHADOW_ARGS
pop rbp
ret
SECTION_RODATA
align 16
dc_128:
times 16 db 128
dc_4:
times 4 dw 4
align 16
dc_8:
times 8 dw 8
align 16
dc_1024:
times 8 dw 0x400
align 16
dc_00001111:
times 8 db 0
times 8 db 1
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/tools/quic/quic_server_session_base.h"
#include <cstdint>
#include <memory>
#include "base/macros.h"
#include "net/quic/crypto/quic_crypto_server_config.h"
#include "net/quic/crypto/quic_random.h"
#include "net/quic/proto/cached_network_parameters.pb.h"
#include "net/quic/quic_connection.h"
#include "net/quic/quic_crypto_server_stream.h"
#include "net/quic/quic_utils.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/quic_config_peer.h"
#include "net/quic/test_tools/quic_connection_peer.h"
#include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
#include "net/quic/test_tools/quic_session_peer.h"
#include "net/quic/test_tools/quic_spdy_session_peer.h"
#include "net/quic/test_tools/quic_spdy_stream_peer.h"
#include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "net/test/gtest_util.h"
#include "net/tools/quic/quic_simple_server_stream.h"
#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using net::test::CryptoTestUtils;
using net::test::MockQuicConnection;
using net::test::MockQuicConnectionHelper;
using net::test::QuicConfigPeer;
using net::test::QuicConnectionPeer;
using net::test::QuicSpdyStreamPeer;
using net::test::QuicSentPacketManagerPeer;
using net::test::QuicSessionPeer;
using net::test::QuicSpdySessionPeer;
using net::test::QuicSustainedBandwidthRecorderPeer;
using net::test::SupportedVersions;
using net::test::ValueRestore;
using net::test::kClientDataStreamId1;
using net::test::kClientDataStreamId2;
using net::test::kClientDataStreamId3;
using net::test::kInitialSessionFlowControlWindowForTest;
using net::test::kInitialStreamFlowControlWindowForTest;
using std::string;
using testing::StrictMock;
using testing::_;
namespace net {
namespace test {
class QuicServerSessionBasePeer {
public:
static ReliableQuicStream* GetOrCreateDynamicStream(QuicServerSessionBase* s,
QuicStreamId id) {
return s->GetOrCreateDynamicStream(id);
}
static void SetCryptoStream(QuicServerSessionBase* s,
QuicCryptoServerStream* crypto_stream) {
s->crypto_stream_.reset(crypto_stream);
s->static_streams()[kCryptoStreamId] = crypto_stream;
}
static bool IsBandwidthResumptionEnabled(QuicServerSessionBase* s) {
return s->bandwidth_resumption_enabled_;
}
};
namespace {
class TestServerSession : public QuicServerSessionBase {
public:
TestServerSession(const QuicConfig& config,
QuicConnection* connection,
QuicServerSessionVisitor* visitor,
const QuicCryptoServerConfig* crypto_config,
QuicCompressedCertsCache* compressed_certs_cache)
: QuicServerSessionBase(config,
connection,
visitor,
crypto_config,
compressed_certs_cache) {}
~TestServerSession() override{};
protected:
QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override {
if (!ShouldCreateIncomingDynamicStream(id)) {
return nullptr;
}
QuicSpdyStream* stream = new QuicSimpleServerStream(id, this);
ActivateStream(stream);
return stream;
}
QuicSpdyStream* CreateOutgoingDynamicStream(SpdyPriority priority) override {
if (!ShouldCreateOutgoingDynamicStream()) {
return nullptr;
}
QuicSpdyStream* stream =
new QuicSimpleServerStream(GetNextOutgoingStreamId(), this);
stream->SetPriority(priority);
ActivateStream(stream);
return stream;
}
QuicCryptoServerStreamBase* CreateQuicCryptoServerStream(
const QuicCryptoServerConfig* crypto_config,
QuicCompressedCertsCache* compressed_certs_cache) override {
return new QuicCryptoServerStream(
crypto_config, compressed_certs_cache,
FLAGS_enable_quic_stateless_reject_support, this);
}
};
const size_t kMaxStreamsForTest = 10;
class QuicServerSessionBaseTest : public ::testing::TestWithParam<QuicVersion> {
protected:
QuicServerSessionBaseTest()
: crypto_config_(QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
CryptoTestUtils::ProofSourceForTesting()),
compressed_certs_cache_(
QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
FLAGS_quic_always_log_bugs_for_tests = true;
config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest);
config_.SetInitialStreamFlowControlWindowToSend(
kInitialStreamFlowControlWindowForTest);
config_.SetInitialSessionFlowControlWindowToSend(
kInitialSessionFlowControlWindowForTest);
connection_ = new StrictMock<MockQuicConnection>(
&helper_, &alarm_factory_, Perspective::IS_SERVER,
SupportedVersions(GetParam()));
session_.reset(new TestServerSession(config_, connection_, &owner_,
&crypto_config_,
&compressed_certs_cache_));
MockClock clock;
handshake_message_.reset(crypto_config_.AddDefaultConfig(
QuicRandom::GetInstance(), &clock,
QuicCryptoServerConfig::ConfigOptions()));
session_->Initialize();
visitor_ = QuicConnectionPeer::GetVisitor(connection_);
}
StrictMock<MockQuicServerSessionVisitor> owner_;
MockQuicConnectionHelper helper_;
MockAlarmFactory alarm_factory_;
StrictMock<MockQuicConnection>* connection_;
QuicConfig config_;
QuicCryptoServerConfig crypto_config_;
QuicCompressedCertsCache compressed_certs_cache_;
std::unique_ptr<TestServerSession> session_;
std::unique_ptr<CryptoHandshakeMessage> handshake_message_;
QuicConnectionVisitorInterface* visitor_;
};
// Compares CachedNetworkParameters.
MATCHER_P(EqualsProto, network_params, "") {
CachedNetworkParameters reference(network_params);
return (arg->bandwidth_estimate_bytes_per_second() ==
reference.bandwidth_estimate_bytes_per_second() &&
arg->bandwidth_estimate_bytes_per_second() ==
reference.bandwidth_estimate_bytes_per_second() &&
arg->max_bandwidth_estimate_bytes_per_second() ==
reference.max_bandwidth_estimate_bytes_per_second() &&
arg->max_bandwidth_timestamp_seconds() ==
reference.max_bandwidth_timestamp_seconds() &&
arg->min_rtt_ms() == reference.min_rtt_ms() &&
arg->previous_connection_state() ==
reference.previous_connection_state());
}
INSTANTIATE_TEST_CASE_P(Tests,
QuicServerSessionBaseTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(QuicServerSessionBaseTest, ServerPushDisabledByDefault) {
// Without the client explicitly sending kSPSH, server push will be disabled
// at the server.
EXPECT_FALSE(
session_->config()->HasReceivedConnectionOptions() &&
ContainsQuicTag(session_->config()->ReceivedConnectionOptions(), kSPSH));
session_->OnConfigNegotiated();
EXPECT_FALSE(session_->server_push_enabled());
}
TEST_P(QuicServerSessionBaseTest, CloseStreamDueToReset) {
// Open a stream, then reset it.
// Send two bytes of payload to open it.
QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT"));
session_->OnStreamFrame(data1);
EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams());
// Send a reset (and expect the peer to send a RST in response).
QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_ERROR_PROCESSING_STREAM,
0);
EXPECT_CALL(*connection_,
SendRstStream(kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT, 0));
visitor_->OnRstStream(rst1);
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
// Send the same two bytes of payload in a new packet.
visitor_->OnStreamFrame(data1);
// The stream should not be re-opened.
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
EXPECT_TRUE(connection_->connected());
}
TEST_P(QuicServerSessionBaseTest, NeverOpenStreamDueToReset) {
// Send a reset (and expect the peer to send a RST in response).
QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_ERROR_PROCESSING_STREAM,
0);
EXPECT_CALL(*connection_,
SendRstStream(kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT, 0));
visitor_->OnRstStream(rst1);
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
// Send two bytes of payload.
QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT"));
visitor_->OnStreamFrame(data1);
// The stream should never be opened, now that the reset is received.
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
EXPECT_TRUE(connection_->connected());
}
TEST_P(QuicServerSessionBaseTest, AcceptClosedStream) {
// Send (empty) compressed headers followed by two bytes of data.
QuicStreamFrame frame1(kClientDataStreamId1, false, 0,
StringPiece("\1\0\0\0\0\0\0\0HT"));
QuicStreamFrame frame2(kClientDataStreamId2, false, 0,
StringPiece("\2\0\0\0\0\0\0\0HT"));
visitor_->OnStreamFrame(frame1);
visitor_->OnStreamFrame(frame2);
EXPECT_EQ(2u, session_->GetNumOpenIncomingStreams());
// Send a reset (and expect the peer to send a RST in response).
QuicRstStreamFrame rst(kClientDataStreamId1, QUIC_ERROR_PROCESSING_STREAM, 0);
EXPECT_CALL(*connection_,
SendRstStream(kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT, 0));
visitor_->OnRstStream(rst);
// If we were tracking, we'd probably want to reject this because it's data
// past the reset point of stream 3. As it's a closed stream we just drop the
// data on the floor, but accept the packet because it has data for stream 5.
QuicStreamFrame frame3(kClientDataStreamId1, false, 2, StringPiece("TP"));
QuicStreamFrame frame4(kClientDataStreamId2, false, 2, StringPiece("TP"));
visitor_->OnStreamFrame(frame3);
visitor_->OnStreamFrame(frame4);
// The stream should never be opened, now that the reset is received.
EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams());
EXPECT_TRUE(connection_->connected());
}
TEST_P(QuicServerSessionBaseTest, MaxOpenStreams) {
// Test that the server refuses if a client attempts to open too many data
// streams. The server accepts slightly more than the negotiated stream limit
// to deal with rare cases where a client FIN/RST is lost.
// The slightly increased stream limit is set during config negotiation. It
// is either an increase of 10 over negotiated limit, or a fixed percentage
// scaling, whichever is larger. Test both before continuing.
EXPECT_EQ(kMaxStreamsForTest, session_->max_open_incoming_streams());
session_->OnConfigNegotiated();
EXPECT_LT(kMaxStreamsMultiplier * kMaxStreamsForTest,
kMaxStreamsForTest + kMaxStreamsMinimumIncrement);
EXPECT_EQ(kMaxStreamsForTest + kMaxStreamsMinimumIncrement,
session_->max_open_incoming_streams());
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
QuicStreamId stream_id = kClientDataStreamId1;
// Open the max configured number of streams, should be no problem.
for (size_t i = 0; i < kMaxStreamsForTest; ++i) {
EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), stream_id));
stream_id += 2;
}
// Open more streams: server should accept slightly more than the limit.
for (size_t i = 0; i < kMaxStreamsMinimumIncrement; ++i) {
EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), stream_id));
stream_id += 2;
}
// Now violate the server's internal stream limit.
stream_id += 2;
if (connection_->version() <= QUIC_VERSION_27) {
EXPECT_CALL(*connection_,
CloseConnection(QUIC_TOO_MANY_OPEN_STREAMS, _, _));
EXPECT_CALL(*connection_, SendRstStream(_, _, _)).Times(0);
} else {
EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(0);
EXPECT_CALL(*connection_, SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0));
}
// Even if the connection remains open, the stream creation should fail.
EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), stream_id));
}
TEST_P(QuicServerSessionBaseTest, MaxAvailableStreams) {
// Test that the server closes the connection if a client makes too many data
// streams available. The server accepts slightly more than the negotiated
// stream limit to deal with rare cases where a client FIN/RST is lost.
// The slightly increased stream limit is set during config negotiation.
EXPECT_EQ(kMaxStreamsForTest, session_->max_open_incoming_streams());
session_->OnConfigNegotiated();
const size_t kAvailableStreamLimit = session_->MaxAvailableStreams();
EXPECT_EQ(
session_->max_open_incoming_streams() * kMaxAvailableStreamsMultiplier,
session_->MaxAvailableStreams());
// The protocol specification requires that there can be at least 10 times
// as many available streams as the connection's maximum open streams.
EXPECT_LE(10 * kMaxStreamsForTest, kAvailableStreamLimit);
EXPECT_EQ(0u, session_->GetNumOpenIncomingStreams());
EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), kClientDataStreamId1));
// Establish available streams up to the server's limit.
const int kLimitingStreamId =
kClientDataStreamId1 + (kAvailableStreamLimit)*2 + 2;
EXPECT_TRUE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), kLimitingStreamId));
// A further available stream will result in connection close.
EXPECT_CALL(*connection_,
CloseConnection(QUIC_TOO_MANY_AVAILABLE_STREAMS, _, _));
// This forces stream kLimitingStreamId + 2 to become available, which
// violates the quota.
EXPECT_FALSE(QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), kLimitingStreamId + 4));
}
TEST_P(QuicServerSessionBaseTest, EnableServerPushThroughConnectionOption) {
// Assume server received server push connection option.
QuicTagVector copt;
copt.push_back(kSPSH);
QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
session_->OnConfigNegotiated();
EXPECT_TRUE(session_->server_push_enabled());
}
TEST_P(QuicServerSessionBaseTest, GetEvenIncomingError) {
// Incoming streams on the server session must be odd.
EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_STREAM_ID, _, _));
EXPECT_EQ(nullptr, QuicServerSessionBasePeer::GetOrCreateDynamicStream(
session_.get(), 4));
}
TEST_P(QuicServerSessionBaseTest, GetStreamDisconnected) {
// Don't create new streams if the connection is disconnected.
QuicConnectionPeer::TearDownLocalConnectionState(connection_);
EXPECT_DFATAL(
QuicServerSessionBasePeer::GetOrCreateDynamicStream(session_.get(), 5),
"ShouldCreateIncomingDynamicStream called when disconnected");
}
class MockQuicCryptoServerStream : public QuicCryptoServerStream {
public:
explicit MockQuicCryptoServerStream(
const QuicCryptoServerConfig* crypto_config,
QuicCompressedCertsCache* compressed_certs_cache,
QuicSession* session)
: QuicCryptoServerStream(crypto_config,
compressed_certs_cache,
FLAGS_enable_quic_stateless_reject_support,
session) {}
~MockQuicCryptoServerStream() override {}
MOCK_METHOD1(SendServerConfigUpdate,
void(const CachedNetworkParameters* cached_network_parameters));
void set_encryption_established(bool has_established) {
encryption_established_ = has_established;
}
private:
DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream);
};
TEST_P(QuicServerSessionBaseTest, BandwidthEstimates) {
// Test that bandwidth estimate updates are sent to the client, only when
// bandwidth resumption is enabled, the bandwidth estimate has changed
// sufficiently, enough time has passed,
// and we don't have any other data to write.
// Client has sent kBWRE connection option to trigger bandwidth resumption.
QuicTagVector copt;
copt.push_back(kBWRE);
QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
session_->OnConfigNegotiated();
EXPECT_TRUE(
QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
int32_t bandwidth_estimate_kbytes_per_second = 123;
int32_t max_bandwidth_estimate_kbytes_per_second = 134;
int32_t max_bandwidth_estimate_timestamp = 1122334455;
const string serving_region = "not a real region";
session_->set_serving_region(serving_region);
MockQuicCryptoServerStream* crypto_stream = new MockQuicCryptoServerStream(
&crypto_config_, &compressed_certs_cache_, session_.get());
QuicServerSessionBasePeer::SetCryptoStream(session_.get(), crypto_stream);
// Set some initial bandwidth values.
QuicSentPacketManager* sent_packet_manager =
QuicConnectionPeer::GetSentPacketManager(session_->connection());
QuicSustainedBandwidthRecorder& bandwidth_recorder =
QuicSentPacketManagerPeer::GetBandwidthRecorder(sent_packet_manager);
// Seed an rtt measurement equal to the initial default rtt.
RttStats* rtt_stats =
const_cast<RttStats*>(sent_packet_manager->GetRttStats());
rtt_stats->UpdateRtt(
QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()),
QuicTime::Delta::Zero(), QuicTime::Zero());
QuicSustainedBandwidthRecorderPeer::SetBandwidthEstimate(
&bandwidth_recorder, bandwidth_estimate_kbytes_per_second);
QuicSustainedBandwidthRecorderPeer::SetMaxBandwidthEstimate(
&bandwidth_recorder, max_bandwidth_estimate_kbytes_per_second,
max_bandwidth_estimate_timestamp);
// Queue up some pending data.
session_->MarkConnectionLevelWriteBlocked(kCryptoStreamId);
EXPECT_TRUE(session_->HasDataToWrite());
// There will be no update sent yet - not enough time has passed.
QuicTime now = QuicTime::Zero();
session_->OnCongestionWindowChange(now);
// Bandwidth estimate has now changed sufficiently but not enough time has
// passed to send a Server Config Update.
bandwidth_estimate_kbytes_per_second =
bandwidth_estimate_kbytes_per_second * 1.6;
session_->OnCongestionWindowChange(now);
// Bandwidth estimate has now changed sufficiently and enough time has passed,
// but not enough packets have been sent.
int64_t srtt_ms =
sent_packet_manager->GetRttStats()->smoothed_rtt().ToMilliseconds();
now = now.Add(QuicTime::Delta::FromMilliseconds(
kMinIntervalBetweenServerConfigUpdatesRTTs * srtt_ms));
session_->OnCongestionWindowChange(now);
// The connection no longer has pending data to be written.
session_->OnCanWrite();
EXPECT_FALSE(session_->HasDataToWrite());
session_->OnCongestionWindowChange(now);
// Bandwidth estimate has now changed sufficiently, enough time has passed,
// and enough packets have been sent.
QuicConnectionPeer::SetPacketNumberOfLastSentPacket(
session_->connection(), kMinPacketsBetweenServerConfigUpdates);
// Verify that the proto has exactly the values we expect.
CachedNetworkParameters expected_network_params;
expected_network_params.set_bandwidth_estimate_bytes_per_second(
bandwidth_recorder.BandwidthEstimate().ToBytesPerSecond());
expected_network_params.set_max_bandwidth_estimate_bytes_per_second(
bandwidth_recorder.MaxBandwidthEstimate().ToBytesPerSecond());
expected_network_params.set_max_bandwidth_timestamp_seconds(
bandwidth_recorder.MaxBandwidthTimestamp());
expected_network_params.set_min_rtt_ms(session_->connection()
->sent_packet_manager()
.GetRttStats()
->min_rtt()
.ToMilliseconds());
expected_network_params.set_previous_connection_state(
CachedNetworkParameters::CONGESTION_AVOIDANCE);
expected_network_params.set_timestamp(
session_->connection()->clock()->WallNow().ToUNIXSeconds());
expected_network_params.set_serving_region(serving_region);
EXPECT_CALL(*crypto_stream,
SendServerConfigUpdate(EqualsProto(expected_network_params)))
.Times(1);
EXPECT_CALL(*connection_, OnSendConnectionState(_)).Times(1);
session_->OnCongestionWindowChange(now);
}
TEST_P(QuicServerSessionBaseTest, BandwidthResumptionExperiment) {
// Test that if a client provides a CachedNetworkParameters with the same
// serving region as the current server, and which was made within an hour of
// now, that this data is passed down to the send algorithm.
// Client has sent kBWRE connection option to trigger bandwidth resumption.
QuicTagVector copt;
copt.push_back(kBWRE);
QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
const string kTestServingRegion = "a serving region";
session_->set_serving_region(kTestServingRegion);
// Set the time to be one hour + one second from the 0 baseline.
connection_->AdvanceTime(
QuicTime::Delta::FromSeconds(kNumSecondsPerHour + 1));
QuicCryptoServerStream* crypto_stream = static_cast<QuicCryptoServerStream*>(
QuicSessionPeer::GetCryptoStream(session_.get()));
// No effect if no CachedNetworkParameters provided.
EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0);
session_->OnConfigNegotiated();
// No effect if CachedNetworkParameters provided, but different serving
// regions.
CachedNetworkParameters cached_network_params;
cached_network_params.set_bandwidth_estimate_bytes_per_second(1);
cached_network_params.set_serving_region("different serving region");
crypto_stream->SetPreviousCachedNetworkParams(cached_network_params);
EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0);
session_->OnConfigNegotiated();
// Same serving region, but timestamp is too old, should have no effect.
cached_network_params.set_serving_region(kTestServingRegion);
cached_network_params.set_timestamp(0);
crypto_stream->SetPreviousCachedNetworkParams(cached_network_params);
EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0);
session_->OnConfigNegotiated();
// Same serving region, and timestamp is recent: estimate is stored.
cached_network_params.set_timestamp(
connection_->clock()->WallNow().ToUNIXSeconds());
crypto_stream->SetPreviousCachedNetworkParams(cached_network_params);
EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(1);
session_->OnConfigNegotiated();
}
TEST_P(QuicServerSessionBaseTest, BandwidthMaxEnablesResumption) {
EXPECT_FALSE(
QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
// Client has sent kBWMX connection option to trigger bandwidth resumption.
QuicTagVector copt;
copt.push_back(kBWMX);
QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
session_->OnConfigNegotiated();
EXPECT_TRUE(
QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
}
TEST_P(QuicServerSessionBaseTest, NoBandwidthResumptionByDefault) {
EXPECT_FALSE(
QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
session_->OnConfigNegotiated();
EXPECT_FALSE(
QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
}
} // namespace
} // namespace test
} // namespace net
|
db "MYSTIC@" ; species name
db "It is nicknamed"
next "The Desert Spirit"
next "because the"
page "flapping of its"
next "wings sounds like"
next "a woman singing.@"
|
/****************************************************************************
// Usagi Engine, Copyright © Vitei, Inc. 2013
****************************************************************************/
#include "Engine/Common/Common.h"
#include "ProtocolBufferFile.h"
namespace usg {
bool pb_istream_from_file_cb(pb_istream_t *stream, uint8_t *buf, size_t count)
{
File* f = (File*)stream->state;
size_t bytes_read = f->Read((uint32)count, buf);
return bytes_read == count;
}
bool pb_ostream_from_file_cb(pb_ostream_t *stream, const uint8_t *buf, size_t count)
{
File* f = (File*)stream->state;
size_t bytes_written = f->Write((uint32)count, (void*)buf);
return bytes_written == count;
}
pb_istream_t pb_istream_from_file(File* f)
{
size_t bytes_left = f->GetSize() - f->GetPos();
pb_istream_t out = { pb_istream_from_file_cb, f, bytes_left, NULL };
return out;
}
pb_ostream_t pb_ostream_from_file(File* f)
{
//size_t bytes_left = f->GetSize() - f->GetPos();
pb_ostream_t out = { pb_ostream_from_file_cb, f, PB_SIZE_MAX, NULL };
return out;
}
memsize ProtocolBufferFile::GetPos()
{
return BufferedFile::GetPos();
}
memsize ProtocolBufferFile::GetSize()
{
return BufferedFile::GetSize();
}
bool ProtocolBufferFile::IsOpen()
{
return BufferedFile::IsOpen();
}
void ProtocolBufferFile::AdvanceBytes(memsize uPos)
{
Inherited::AdvanceBytes(uPos);
m_istream = pb_istream_from_file(this);
m_ostream = pb_ostream_from_file(this);
}
bool ProtocolBufferFile::ReadRaw(uint8* pBuf, memsize bytes)
{
return pb_read(&m_istream, pBuf, bytes);
}
bool ProtocolBufferFile::WriteRaw(uint8* pBuf, memsize bytes)
{
return pb_write(&m_ostream, pBuf, bytes);
}
}
|
; A132354: Integers m such that 7*m + 1 is a square.
; 0,5,9,24,32,57,69,104,120,165,185,240,264,329,357,432,464,549,585,680,720,825,869,984,1032,1157,1209,1344,1400,1545,1605,1760,1824,1989,2057,2232,2304,2489,2565,2760,2840,3045,3129,3344,3432,3657,3749,3984,4080
mul $0,2
mov $2,$0
lpb $2
add $1,$0
sub $0,1
add $1,2
add $1,$0
trn $2,4
lpe
mov $0,$1
|
; A035471: Coordination sequence for lattice D*_4 (with edges defined by l_1 norm = 1).
; 1,8,48,152,352,680,1168,1848,2752,3912,5360,7128,9248,11752,14672,18040,21888,26248,31152,36632,42720,49448,56848,64952,73792,83400,93808,105048,117152,130152,144080,158968,174848,191752,209712,228760,248928,270248,292752,316472,341440,367688,395248,424152,454432,486120,519248,553848,589952,627592,666800,707608,750048,794152,839952,887480,936768,987848,1040752,1095512,1152160,1210728,1271248,1333752,1398272,1464840,1533488,1604248,1677152,1752232,1829520,1909048,1990848,2074952,2161392,2250200,2341408,2435048,2531152,2629752,2730880,2834568,2940848,3049752,3161312,3275560,3392528,3512248,3634752,3760072,3888240,4019288,4153248,4290152,4430032,4572920,4718848,4867848,5019952,5175192,5333600,5495208,5660048,5828152,5999552,6174280,6352368,6533848,6718752,6907112,7098960,7294328,7493248,7695752,7901872,8111640,8325088,8542248,8763152,8987832,9216320,9448648,9684848,9924952,10168992,10417000,10669008,10925048,11185152,11449352,11717680,11990168,12266848,12547752,12832912,13122360,13416128,13714248,14016752,14323672,14635040,14950888,15271248,15596152,15925632,16259720,16598448,16941848,17289952,17642792,18000400,18362808,18730048,19102152,19479152,19861080,20247968,20639848,21036752,21438712,21845760,22257928,22675248,23097752,23525472,23958440,24396688,24840248,25289152,25743432,26203120,26668248,27138848,27614952,28096592,28583800,29076608,29575048,30079152,30588952,31104480,31625768,32152848,32685752,33224512,33769160,34319728,34876248,35438752,36007272,36581840,37162488,37749248,38342152,38941232,39546520,40158048,40775848,41399952,42030392,42667200,43310408,43960048,44616152,45278752,45947880,46623568,47305848,47994752,48690312,49392560,50101528,50817248,51539752,52269072,53005240,53748288,54498248,55255152,56019032,56789920,57567848,58352848,59144952,59944192,60750600,61564208,62385048,63213152,64048552,64891280,65741368,66598848,67463752,68336112,69215960,70103328,70998248,71900752,72810872,73728640,74654088,75587248,76528152,77476832,78433320,79397648,80369848,81349952,82337992
mul $0,2
mov $1,1
lpb $0,1
add $3,$0
sub $0,1
mov $1,$3
mul $1,2
add $2,$0
add $3,$2
lpe
|
; A128064: Triangle T with T(n,n)=n, T(n,n-1)=-(n-1) and otherwise T(n,k)=0; 0<k<=n.
; Submitted by Simon Strandgaard
; 1,-1,2,0,-2,3,0,0,-3,4,0,0,0,-4,5,0,0,0,0,-5,6,0,0,0,0,0,-6,7,0,0,0,0,0,0,-7,8,0,0,0,0,0,0,0,-8,9,0,0,0,0,0,0,0,0,-9,10,0,0,0,0,0,0,0,0,0,-10,11,0,0,0,0,0,0,0,0,0,0,-11,12
mov $3,2
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
add $0,$3
max $0,0
seq $0,183110 ; Period-length of the ultimate periodic behavior of the orbit of a list [1,1,1,...,1] of n 1's under the mapping defined in the comments.
sub $0,1
mov $2,$3
mul $2,$0
add $1,$2
mov $5,$0
lpe
min $4,1
mul $4,$5
sub $1,$4
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1eeaf, %r15
nop
nop
nop
xor %r11, %r11
mov (%r15), %r14
nop
cmp %r10, %r10
lea addresses_WT_ht+0xfb27, %r15
nop
lfence
movb (%r15), %r14b
nop
nop
nop
nop
add $8683, %r14
lea addresses_normal_ht+0x46af, %r13
clflush (%r13)
sub %r10, %r10
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
vmovups %ymm2, (%r13)
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0x1ad46, %rsi
lea addresses_WT_ht+0x1442f, %rdi
dec %r13
mov $24, %rcx
rep movsw
cmp %rcx, %rcx
lea addresses_A_ht+0xeaf, %rsi
lea addresses_D_ht+0x970f, %rdi
nop
nop
nop
nop
cmp $48869, %r14
mov $6, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %rcx
lea addresses_D_ht+0x23af, %r13
nop
nop
nop
inc %r10
movl $0x61626364, (%r13)
nop
nop
nop
add $7173, %rbp
lea addresses_D_ht+0x124cf, %rdi
clflush (%rdi)
nop
nop
xor %rbp, %rbp
mov (%rdi), %ecx
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_WC_ht+0x1883f, %rsi
lea addresses_A_ht+0xa5af, %rdi
nop
and $59754, %r15
mov $99, %rcx
rep movsq
xor $21001, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rdi
push %rdx
// Faulty Load
lea addresses_D+0x86af, %r10
sub $57684, %r14
movb (%r10), %dl
lea oracles, %r8
and $0xff, %rdx
shlq $12, %rdx
mov (%r8,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
; A170412: Number of reduced words of length n in Coxeter group on 19 generators S_i with relations (S_i)^2 = (S_i S_j)^44 = I.
; 1,19,342,6156,110808,1994544,35901792,646232256,11632180608,209379250944,3768826516992,67838877305856,1221099791505408,21979796247097344,395636332447752192,7121453984059539456
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
div $3,$2
mul $2,18
lpe
mov $0,$2
div $0,18
|
; A059648: a(n) = [[(k^2)*n]-(k*[k*n])], where k = sqrt(2) and [] is the floor function.
; 0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0
mul $0,2
add $0,1
cal $0,289035 ; Fixed point of the mapping 00->0010, 01->010, 10->010, starting with 00.
mov $1,$0
|
; A180596: Digital root of 6n.
; 0,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3,9,6,3
mul $0,15
sub $0,1
mod $0,9
add $0,1
mov $1,$0
|
;
; Copyright (c) 2022 Phillip Stevens
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; feilipu, January 2022
;
;-------------------------------------------------------------------------
; asm_am9511_finv - am9511 floating point inverse
;-------------------------------------------------------------------------
SECTION code_clib
SECTION code_fp_am9511
IFDEF __CLASSIC
INCLUDE "../../_DEVELOPMENT/target/am9511/config_am9511_private.inc"
ELSE
INCLUDE "target/am9511/config_am9511_private.inc"
ENDIF
EXTERN asm_am9511_pushf
EXTERN asm_am9511_pushf_fastcall
EXTERN asm_am9511_popf
PUBLIC asm_am9511_finv, asm_am9511_finv_fastcall
; enter here for floating inverse, 1/x, x on stack, result in dehl
.asm_am9511_finv
ld de,03f80h
ld hl,0
call asm_am9511_pushf_fastcall ; 1
call asm_am9511_pushf ; x
ld a,__IO_APU_OP_FDIV
out (__IO_APU_CONTROL),a ; 1 / x
jp asm_am9511_popf
; enter here for floating inverse fastcall, 1/x, x in dehl, result in dehl
.asm_am9511_finv_fastcall
call asm_am9511_pushf_fastcall ; x
ld de,03f80h
ld hl,0h
call asm_am9511_pushf_fastcall ; 1
ld a,__IO_APU_OP_XCHF
out (__IO_APU_CONTROL),a ; swap
ld a,__IO_APU_OP_FDIV
out (__IO_APU_CONTROL),a ; 1 / x
jp asm_am9511_popf
|
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 00
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 01
tilecoll WALL, WALL, WALL, WALL ; 02
tilecoll WALL, WALL, WALL, WALL ; 03
tilecoll WATER, WATER, WATER, WATER ; 04
tilecoll WALL, WALL, WALL, WALL ; 05
tilecoll WALL, WALL, WALL, WALL ; 06
tilecoll WALL, WALL, WALL, WALL ; 07
tilecoll FLOOR, FLOOR, FLOOR, WALL ; 08
tilecoll WALL, WALL, WALL, WALL ; 09
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0a
tilecoll WALL, WALL, WALL, WALL ; 0b
tilecoll WALL, WALL, WALL, WALL ; 0c
tilecoll WALL, WALL, WALL, WALL ; 0d
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0e
tilecoll WALL, WALL, WALL, WALL ; 0f
tilecoll WATER, WATER, WATER, WATER ; 10
tilecoll WATER, WATER, WATER, WATER ; 11
tilecoll WATER, WATER, WATER, WATER ; 12
tilecoll FLOOR, WALL, FLOOR, WALL ; 13
tilecoll WATER, WATER, WATER, WATER ; 14
tilecoll WATER, WATER, WATER, WATER ; 15
tilecoll WALL, FLOOR, WALL, FLOOR ; 16
tilecoll WALL, WALL, WALL, WALL ; 17
tilecoll FLOOR, WALL, WALL, WALL ; 18
tilecoll FLOOR, WALL, FLOOR, FLOOR ; 19
tilecoll WALL, WALL, WALL, WALL ; 1a
tilecoll WALL, WALL, WALL, WALL ; 1b
tilecoll WALL, WALL, WALL, WALL ; 1c
tilecoll WALL, WALL, WALL, DOOR ; 1d
tilecoll WALL, WALL, DOOR, WALL ; 1e
tilecoll WALL, WALL, WALL, WALL ; 1f
tilecoll WALL, FLOOR, FLOOR, FLOOR ; 20
tilecoll WALL, WALL, WALL, WALL ; 21
tilecoll WALL, WALL, WALL, WALL ; 22
tilecoll FLOOR, WALL, FLOOR, WALL ; 23
tilecoll WALL, FLOOR, WALL, FLOOR ; 24
tilecoll FLOOR, WALL, FLOOR, WALL ; 25
tilecoll WALL, FLOOR, WALL, FLOOR ; 26
tilecoll WALL, WALL, WALL, WALL ; 27
tilecoll WALL, WALL, WALL, WALL ; 28
tilecoll FLOOR, FLOOR, WALL, FLOOR ; 29
tilecoll FLOOR, FLOOR, FLOOR, WALL ; 2a
tilecoll WALL, WALL, WALL, WALL ; 2b
tilecoll WALL, WALL, WALL, WALL ; 2c
tilecoll WALL, WALL, CAVE, WALL ; 2d
tilecoll WALL, WALL, WALL, WALL ; 2e
tilecoll WALL, WALL, WALL, WALL ; 2f
tilecoll WALL, WALL, WALL, WALL ; 30
tilecoll WALL, FLOOR, WALL, FLOOR ; 31
tilecoll FLOOR, WALL, FLOOR, WALL ; 32
tilecoll WALL, WALL, FLOOR, FLOOR ; 33
tilecoll FLOOR, FLOOR, WALL, WALL ; 34
tilecoll WALL, WALL, WALL, WALL ; 35
tilecoll WALL, WALL, WALL, WALL ; 36
tilecoll WATER, WATER, WATER, WATER ; 37
tilecoll WATER, WATER, WATER, WATER ; 38
tilecoll WALL, WALL, WALL, FLOOR ; 39
tilecoll WALL, WALL, WALL, WALL ; 3a
tilecoll WALL, WALL, WALL, WALL ; 3b
tilecoll WALL, WALL, WALL, WALL ; 3c
tilecoll WALL, WALL, WALL, WALL ; 3d
tilecoll WALL, WALL, WALL, WALL ; 3e
tilecoll WALL, WALL, WALL, WALL ; 3f
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 40
tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 41
tilecoll FLOOR, WALL, FLOOR, WALL ; 42
tilecoll WALL, FLOOR, WALL, FLOOR ; 43
tilecoll WALL, FLOOR, WALL, FLOOR ; 44
tilecoll FLOOR, WALL, FLOOR, WALL ; 45
tilecoll WATER, WATER, WALL, WATER ; 46
tilecoll WATER, WATER, WATER, WALL ; 47
tilecoll FLOOR, FLOOR, FLOOR, WALL ; 48
|
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "pxr/pxr.h"
#include "pxr/imaging/hd/mesh.h"
#include "pxr/imaging/hd/tokens.h"
PXR_NAMESPACE_OPEN_SCOPE
TF_DEFINE_PUBLIC_TOKENS(HdMeshReprDescTokens, HD_MESH_REPR_DESC_TOKENS);
HdMesh::HdMesh(SdfPath const& id)
: HdRprim(id)
{
/*NOTHING*/
}
HdMesh::~HdMesh() = default;
/* virtual */
TfTokenVector const &
HdMesh::GetBuiltinPrimvarNames() const
{
static const TfTokenVector primvarNames = {
HdTokens->points,
HdTokens->normals,
};
return primvarNames;
}
// static repr configuration
HdMesh::_MeshReprConfig HdMesh::_reprDescConfig;
/* static */
void
HdMesh::ConfigureRepr(TfToken const &reprName,
HdMeshReprDesc desc1,
HdMeshReprDesc desc2/*=HdMeshReprDesc()*/)
{
HD_TRACE_FUNCTION();
_reprDescConfig.AddOrUpdate(
reprName, _MeshReprConfig::DescArray{desc1, desc2});
}
/* static */
HdMesh::_MeshReprConfig::DescArray
HdMesh::_GetReprDesc(TfToken const &reprName)
{
return _reprDescConfig.Find(reprName);
}
PXR_NAMESPACE_CLOSE_SCOPE
|
# Program File: Program2-1.asm
# Author: Charles Kann
# Purpose: First program, Hello World
.text # Define the program instructions.
main: # Label to define the main program.
li $v0,4 # Load 4 into $v0 to indicate a print string.
la $a0, greeting # Load the address of the greeting into $a0.
syscall # Print greeting. The print is indicated by
# $v0 having a value of 4, and the string to
# print is stored at the address in $a0.
li $v0, 10 # Load a 10 (halt) into $v0.
syscall # The program ends.
.data # Define the program data.
greeting: .asciiz "Hello World" #The string to print.
|
include Irvine32.inc
include backend.inc
.data?
new_map byte 10000 DUP(?)
.code
; INPUT: pointer to array, height, width
update_board proc
Initialization:
mov ebp, esp
push ebp
mov ecx, 0
mov esi, [ebp + 12]
mov edi, offset new_map
Count_Neighbors:
push ebp
push ecx
push esi
push edi
push [ebp + 12]
push [ebp + 8]
push [ebp + 4]
push ecx
call get_neighbor_count
pop edx
pop edi
pop esi
pop ecx
pop ebp
Check_Alive:
cmp byte ptr [esi], 0
je Dead_Start
jmp Alive_Start
Dead_Start:
cmp edx, 3
jne Staying_Dead
jmp Resurrecting
Resurrecting:
mov byte ptr [edi], 1
jmp Dead_End
Staying_Dead:
mov byte ptr [edi], 0
jmp Dead_End
Dead_End:
jmp Update
Alive_Start:
cmp edx, 2
jb Dying
cmp edx, 3
ja Dying
jmp Staying_Alive
Dying:
mov byte ptr [edi], 0
jmp Alive_End
Staying_Alive:
mov byte ptr [edi], 1
jmp Alive_End
Alive_End:
jmp Update
Update:
inc edi
inc esi
inc ecx
mov eax, [ebp + 8]
mul byte ptr [ebp + 4]
cmp eax, ecx
jbe Ending
jmp Count_Neighbors
Ending:
mov ecx, eax
mov esi, offset new_map
mov edi, [ebp + 12]
Looping:
mov bl, byte ptr [esi]
mov byte ptr [edi], bl
inc esi
inc edi
loop Looping
mov esp, ebp
pop eax
add esp, 12
push eax
ret
update_board endp
.data
direction dword 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1
.code
; INPUT: pointer to array, height, width, pos
get_neighbor_count proc
Initialization:
mov ebp, esp
push ebp
mov ebx, 0
mov ecx, 8
mov esi, offset direction
Bounds_Check:
mov eax, [ebp + 4]
mov edx, 0
div dword ptr [ebp + 8]
; EAX has y-pos, EDX has x-pos
add edx, [esi]
add eax, [esi + 4]
cmp edx, 0
jl Cleanup
cmp edx, [ebp + 8]
jge Cleanup
cmp eax, 0
jl Cleanup
cmp eax, [ebp + 12]
jge Cleanup
jmp Alive_Check
Alive_Check:
push edx
mul dword ptr [ebp + 8]
pop edx
add eax, edx
mov edi, [ebp + 16]
add edi, eax
cmp byte ptr [edi], 0
je Is_Dead
jmp Is_Alive
Is_Alive:
add ebx, 1
jmp Cleanup
Is_Dead:
jmp Cleanup
Cleanup:
add esi, 8
loop Bounds_Check
Ending:
mov esp, ebp
pop eax
add esp, 16
push ebx
push eax
ret
get_neighbor_count endp
; INPUT: source, dest, size
copy_array proc
Initialization:
mov ebp, esp
push ebp
mov ecx, [ebp + 4]
mov esi, [ebp + 12]
mov edi, [ebp + 8]
My_Loop:
mov al, byte ptr [esi]
mov byte ptr [edi], al
inc esi
inc edi
loop My_Loop
Ending:
mov esp, ebp
pop eax
add esp, 12
push eax
ret
copy_array endp
end |
; A144864: a(n) = (4*16^(n-1)-1)/3.
; 1,21,341,5461,87381,1398101,22369621,357913941,5726623061,91625968981,1466015503701,23456248059221,375299968947541,6004799503160661,96076792050570581,1537228672809129301,24595658764946068821,393530540239137101141,6296488643826193618261,100743818301219097892181,1611901092819505566274901,25790417485112089060398421,412646679761793424966374741,6602346876188694799461995861,105637550019019116791391933781,1690200800304305868662270940501,27043212804868893898596335048021
mov $1,16
pow $1,$0
div $1,15
mul $1,20
add $1,1
mov $0,$1
|
#include "Geant/MaterialCuts.h"
#include "Geant/Material.h"
#include "Geant/CutConverter.h"
#include "Geant/CutConverterForGamma.h"
#include "Geant/CutConverterForElectron.h"
#include "Geant/CutConverterForPositron.h"
#include "Geant/PhysicsParameters.h"
#include "Geant/SystemOfUnits.h"
#include "Geant/Region.h"
#include <iostream>
// vecgeom GeoManager, LogicalVolume, VPlacedVolume, Material, Medium
#include "management/GeoManager.h"
#include "volumes/PlacedVolume.h"
#include "volumes/LogicalVolume.h"
namespace geantphysics {
std::vector<MaterialCuts *> MaterialCuts::gTheMaterialCutsTable;
std::vector<std::vector<MaterialCuts *>> MaterialCuts::gTheMaterialCutsPerRegion;
std::vector<std::vector<MaterialCuts *>> MaterialCuts::gTheMaterialCutsPerRegionPerMaterial;
MaterialCuts::MaterialCuts(int regionindx, const Material *mat, bool iscutinlength, double gcut, double emcut,
double epcut)
: fRegionIndex(regionindx), fIsProductionCutsGivenInLength(iscutinlength), fMaterial(mat)
{
if (iscutinlength) {
fProductionCutsInLength[0] = gcut; // for gamma in lenght
fProductionCutsInLength[1] = emcut; // for e- in lenght
fProductionCutsInLength[2] = epcut; // for e+ in lenght
// they will be set by the converter
fProductionCutsInEnergy[0] = -1.0; // for gamma in internal energy units
fProductionCutsInEnergy[1] = -1.0; // for e- in internal energy units
fProductionCutsInEnergy[2] = -1.0; // for e+ in internal energy units
} else {
// they will be set by the converter
fProductionCutsInLength[0] = -1.0; // for gamma in lenght
fProductionCutsInLength[1] = -1.0; // for e- in lenght
fProductionCutsInLength[2] = -1.0; // for e+ in lenght
fProductionCutsInEnergy[0] = gcut; // for gamma in internal energy units
fProductionCutsInEnergy[1] = emcut; // for e- in internal energy units
fProductionCutsInEnergy[2] = epcut; // for e+ in internal energy units
}
fIndex = gTheMaterialCutsTable.size();
// add the current MaterialCuts pointer to the global material cuts table
gTheMaterialCutsTable.push_back(this);
// it will be set only once to the number of regions
unsigned long numRegions = vecgeom::Region::GetTheRegionTable().size();
if (gTheMaterialCutsPerRegion.size() < numRegions) {
gTheMaterialCutsPerRegion.resize(numRegions);
}
if (gTheMaterialCutsPerRegionPerMaterial.size() < numRegions) {
gTheMaterialCutsPerRegionPerMaterial.resize(numRegions);
int numMaterials = Material::GetTheMaterialTable().size();
for (unsigned long i = 0; i < numRegions; ++i) {
gTheMaterialCutsPerRegionPerMaterial[i].resize(numMaterials, nullptr);
}
}
// add the current MatrialCuts pointer to the list per region
gTheMaterialCutsPerRegion[regionindx].push_back(this);
// add the current MatrialCuts pointer to the list per region per material
gTheMaterialCutsPerRegionPerMaterial[regionindx][mat->GetIndex()] = this;
}
void MaterialCuts::ClearAll()
{
for (unsigned long i = 0; i < gTheMaterialCutsTable.size(); ++i) {
delete gTheMaterialCutsTable[i];
}
gTheMaterialCutsTable.clear();
for (unsigned long i = 0; i < gTheMaterialCutsPerRegion.size(); ++i) {
gTheMaterialCutsPerRegion[i].clear();
}
gTheMaterialCutsPerRegion.clear();
for (unsigned long i = 0; i < gTheMaterialCutsPerRegionPerMaterial.size(); ++i) {
gTheMaterialCutsPerRegionPerMaterial[i].clear();
}
gTheMaterialCutsPerRegionPerMaterial.clear();
}
const MaterialCuts *MaterialCuts::GetMaterialCut(int indx)
{
if (indx > -1 && indx < int(gTheMaterialCutsTable.size())) {
return gTheMaterialCutsTable[indx];
} else {
std::cerr << " *** ERROR: MaterialCuts::GetMaterialCut() \n"
<< " Requested MaterialCuts by index = " << indx << " cannot be find in the table! \n"
<< " Index should be: 0 <= index < number of MaterialCuts = " << gTheMaterialCutsTable.size()
<< std::endl;
exit(-1);
}
}
// we should get rid of this
const MaterialCuts *MaterialCuts::GetMaterialCut(int regionindx, int materialindx)
{
if (regionindx > -1 && regionindx < int(gTheMaterialCutsPerRegionPerMaterial.size()) && materialindx > -1 &&
materialindx < int(gTheMaterialCutsPerRegionPerMaterial[0].size())) {
return gTheMaterialCutsPerRegionPerMaterial[regionindx][materialindx];
} else {
if (!(regionindx > -1 && regionindx < int(gTheMaterialCutsPerRegionPerMaterial.size()))) {
std::cerr << " *** ERROR: MaterialCuts::GetMaterialCut() \n"
<< " Requested MaterialCuts by Region and Material indices = " << regionindx << ", "
<< materialindx << " cannot be find in the table!"
<< "\n Region index should be : 0 <= index < region dimension of the table = "
<< gTheMaterialCutsPerRegionPerMaterial.size() << std::endl;
} else {
std::cerr << " *** ERROR: MaterialCuts::GetMaterialCut() \n"
<< " Requested MaterialCuts by Region and Material indices = " << regionindx << ", "
<< materialindx << " cannot be find in the table!"
<< "\n Region index should be : 0 <= index < region dimension of the table = "
<< gTheMaterialCutsPerRegionPerMaterial.size()
<< "\n Material index should be: 0 <= index < material dimension of the table = "
<< gTheMaterialCutsPerRegionPerMaterial[0].size() << std::endl;
}
exit(-1);
}
}
void MaterialCuts::ConvertAll()
{
CutConverter **converters = new CutConverter *[3];
// get the min/max secondary production values; they are the same in each reagion
converters[0] = new CutConverterForGamma(301, PhysicsParameters::GetMinAllowedGammaCutEnergy(),
PhysicsParameters::GetMaxAllowedGammaCutEnergy());
converters[1] = new CutConverterForElectron(301, PhysicsParameters::GetMinAllowedElectronCutEnergy(),
PhysicsParameters::GetMaxAllowedElectronCutEnergy());
converters[2] = new CutConverterForPositron(301, PhysicsParameters::GetMinAllowedPositronCutEnergy(),
PhysicsParameters::GetMaxAllowedPositronCutEnergy());
for (unsigned long i = 0; i < gTheMaterialCutsTable.size(); ++i) {
MaterialCuts *matcut = gTheMaterialCutsTable[i];
const Material *mat = matcut->GetMaterial();
if (matcut->fIsProductionCutsGivenInLength) {
for (int j = 0; j < 3; ++j) {
const double *cuts = matcut->GetProductionCutsInLength();
matcut->SetProductionCutEnergy(j, converters[j]->Convert(mat, cuts[j], true));
}
} else {
for (int j = 0; j < 3; ++j) {
const double *cuts = matcut->GetProductionCutsInEnergy();
matcut->SetProductionCutLength(j, converters[j]->Convert(mat, cuts[j], false));
}
}
}
delete converters[0];
delete converters[1];
delete converters[2];
delete[] converters;
}
// create all MaterialCuts by using the Region table; this will be the standard way of automatically creating all
// MaterialCuts in the detetector
void MaterialCuts::CreateAll()
{
// clear all if there were any created before
ClearAll();
// set all Materials used flag to false
const Vector_t<Material *> theMaterialTable = Material::GetTheMaterialTable();
for (size_t i = 0; i < theMaterialTable.size(); ++i) {
theMaterialTable[i]->SetIsUsed(false);
}
// get number of regions
int numRegions = vecgeom::Region::GetNumberOfRegions();
// get the world LogicalVolume from vecgeom: this const_cast is very dirty !!
vecgeom::LogicalVolume *logicWorld =
const_cast<vecgeom::LogicalVolume *>(vecgeom::GeoManager::Instance().GetWorld()->GetLogicalVolume());
// if there are no any regions created by the user create one, with default production cut values,
// set to the world logical volume (that should set to all logical volumes)
if (numRegions < 1) {
// create one region with default production cuts and assign all logical volumes to this
vecgeom::Region *reg0 = new vecgeom::Region("DefaultWorld");
logicWorld->SetRegion(reg0);
}
// it is still possible however, that the user defined at least one region but the world logical volume has no region;
// we create a default world region and assign the world logical volume to that;
// later all logical volumes, without region, will also assigned to this region
if (!logicWorld->GetRegion()) {
vecgeom::Region *reg0 = new vecgeom::Region("DefaultWorld");
logicWorld->SetRegion(reg0, false); // set only to this logical volume
}
// keep the world region in hand
vecgeom::Region *regionWorld = logicWorld->GetRegion();
// loop over all logical volumes, take the associated region and add the material of the given
// logical volume to the given region.
std::vector<vecgeom::LogicalVolume *> theLogicVolumes;
vecgeom::GeoManager::Instance().GetAllLogicalVolumes(theLogicVolumes);
for (size_t i = 0; i < theLogicVolumes.size(); ++i) {
Material *mat = (Material *)theLogicVolumes[i]->GetMaterialPtr();
if (!mat) {
std::cerr << " *** ERROR: MaterialCuts::CreateAll() \n"
<< " LogicalVolume with name = " << theLogicVolumes[i]->GetLabel() << " has no material! \n"
<< std::endl;
exit(-1);
}
// set the used in geometry flag of the material to true
mat->SetIsUsed(true);
vecgeom::Region *reg = theLogicVolumes[i]->GetRegion();
// region must be set for each logical volumes
// check it and assign all logical volumes without region to the world region and give warning
if (!reg) {
theLogicVolumes[i]->SetRegion(regionWorld, false); // set only for this logical volume
reg = regionWorld;
std::cerr << " *** WARNING: MaterialCuts::CreateAll() \n"
<< " LogicalVolume with name = " << theLogicVolumes[i]->GetLabel() << " was not associated to \n"
<< " any Regions. It has been assigned to the world region ( " << regionWorld->GetName() << ")\n"
<< std::endl;
}
// check if we have already created a MaterialCuts with this material in the current region
// create a new if not yet
// it returns with a pointer to the MaterialCuts that will be set into the logical volume later!
MaterialCuts *matCut = CheckMaterialForRegion(reg, mat);
// set the MaterialCuts pointer in the LogicalVolume
theLogicVolumes[i]->SetMaterialCutsPtr((void *)matCut);
}
// convert production cuts in lenght/energy to energy/lenght
ConvertAll();
}
MaterialCuts *MaterialCuts::CheckMaterialForRegion(const vecgeom::Region *region, const Material *mat)
{
// get the region index
int indxReg = region->GetIndex();
int indxMat = mat->GetIndex();
MaterialCuts *matCut = nullptr;
if (indxReg > -1 && indxReg < int(gTheMaterialCutsPerRegionPerMaterial.size()) && indxMat > -1 &&
indxMat < int(gTheMaterialCutsPerRegionPerMaterial[0].size())) {
matCut = gTheMaterialCutsPerRegionPerMaterial[indxReg][indxMat];
}
// create it if it is still nullptr (i.e. has not been created yet)
if (!matCut) {
bool iscutinlength = region->IsProductionCutInLength();
double gcut = region->GetGammaCut();
double emcut = region->GetElectronCut();
double epcut = region->GetPositronCut();
// check if the cut was given by user or we need to take default values
if (iscutinlength) {
if (gcut < 0.0) gcut = PhysicsParameters::GetDefaultGammaCutInLength();
if (emcut < 0.0) emcut = PhysicsParameters::GetDefaultElectronCutInLength();
if (epcut < 0.0) epcut = PhysicsParameters::GetDefaultPositronCutInLength();
} else {
if (gcut < 0.0) gcut = PhysicsParameters::GetDefaultGammaCutInEnergy();
if (emcut < 0.0) emcut = PhysicsParameters::GetDefaultElectronCutInEnergy();
if (epcut < 0.0) epcut = PhysicsParameters::GetDefaultPositronCutInEnergy();
}
// create the MaterialCuts object
matCut = new MaterialCuts(indxReg, mat, iscutinlength, gcut, emcut, epcut);
}
return matCut;
}
// printouts
std::ostream &operator<<(std::ostream &flux, const MaterialCuts *matcut)
{
// std::ios::fmtflags mode = flux.flags();
flux.setf(std::ios::fixed, std::ios::floatfield);
// long prec = flux.precision(6);
const double *cutslenght = matcut->GetProductionCutsInLength();
const double *cutsenergy = matcut->GetProductionCutsInEnergy();
const std::vector<vecgeom::Region *> vregions = vecgeom::Region::GetTheRegionTable();
int regionIndx = matcut->GetRegionIndex();
const std::string regionName = vregions[regionIndx]->GetName();
std::string str = " in length.";
if (!matcut->IsProductionCutsGivenInLength()) str = " in energy.";
flux << "\n Material name : " << matcut->GetMaterial()->GetName();
flux << "\n Belongs to region : "
<< "Region name = " << vregions[regionIndx]->GetName() << ", Region index = " << regionIndx;
flux << "\n Material-cut index : " << matcut->GetIndex() << ", Production cuts were given" << str;
flux << "\n Production cuts : "
<< " gamma e- e+"
<< "\n In length : " << cutslenght[0] / geant::units::mm << " [mm] "
<< cutslenght[1] / geant::units::mm << " [mm] " << cutslenght[2] / geant::units::mm << " [mm] "
<< "\n In energy : " << cutsenergy[0] / geant::units::MeV << " [MeV] "
<< cutsenergy[1] / geant::units::MeV << " [MeV] " << cutsenergy[2] / geant::units::MeV << " [MeV] "
<< "\n";
return flux;
}
std::ostream &operator<<(std::ostream &flux, const MaterialCuts &matcut)
{
flux << &matcut;
return flux;
}
std::ostream &operator<<(std::ostream &flux, std::vector<MaterialCuts *> matcuttable)
{
// Dump info for all material-cut couples
flux << "\n ========= Table: table of registered material-cuts ================="
<< "\n Number of material-cuts in the table = " << matcuttable.size() << "\n";
for (unsigned long i = 0; i < matcuttable.size(); ++i) {
flux << matcuttable[i];
if (i < matcuttable.size() - 1) flux << " --------------------------------------------------------------------\n";
}
flux << " ====================================================================\n\n";
return flux;
}
} // namespace geantphysics
|
; A169720: a(n) = (3*2^(n-1)-1)*(3*2^n-1).
; 1,10,55,253,1081,4465,18145,73153,293761,1177345,4713985,18865153,75479041,301953025,1207885825,4831690753,19327057921,77308821505,309236465665,1236948221953,4947797606401,19791199862785,79164818325505,316659311050753,1266637319700481,5066549429796865
mov $1,2
pow $1,$0
bin $1,2
mul $1,9
add $1,1
|
;
; CPC Maths Routines
;
; August 2003 **_|warp6|_** <kbaccam /at/ free.fr>
;
; $Id: dge.asm,v 1.4 2016-06-22 19:50:49 dom Exp $
;
SECTION smc_fp
INCLUDE "target/cpc/def/cpcfirm.def"
INCLUDE "target/cpc/def/cpcfp.def"
PUBLIC dge
PUBLIC dgec
EXTERN fsetup
EXTERN stkequcmp
EXTERN cmpfin
.dge call fsetup
call firmware
.dgec defw CPCFP_FLO_CMP ; comp (hl)?(de)
cp 0 ;(hl) <= (de)
jp z,cmpfin
cp 1
jp z,cmpfin
xor a
jp stkequcmp
|
; A054479: Number of sets of cycle graphs of 2n nodes where the 2-colored edges alternate colors.
; Submitted by Christian Krause
; 1,0,6,120,6300,514080,62785800,10676746080,2413521910800,700039083744000,253445583029839200,112033456760809584000,59382041886244720843200,37175286835046004765120000,27139206193305890195912400000,22852066417535931447551359680000,21984366159341876104806521930400000,23963575910509477418542728468986880000,29379981392583633602701598994301195200000,40251317123869351796050991861633360352000000,61263473877255310326718109418194151779260800000,103046571401941392676693120885308478646101632000000
mov $1,1
lpb $0
mov $2,$3
add $3,$1
mov $1,$0
sub $0,1
add $1,$0
mul $3,2
mul $3,$1
mul $1,$2
mul $3,$0
lpe
mov $0,$1
|
// Copyright (c) 2011-2018 The Readercoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/system.h>
#include <clientversion.h>
#include <primitives/transaction.h>
#include <sync.h>
#include <util/strencodings.h>
#include <util/moneystr.h>
#include <test/test_readercoin.h>
#include <stdint.h>
#include <vector>
#ifndef WIN32
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(util_criticalsection)
{
CCriticalSection cs;
do {
LOCK(cs);
break;
BOOST_ERROR("break was swallowed!");
} while(0);
do {
TRY_LOCK(cs, lockTest);
if (lockTest)
break;
BOOST_ERROR("break was swallowed!");
} while(0);
}
static const unsigned char ParseHex_expected[65] = {
0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, 0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, 0xb7,
0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, 0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, 0xde,
0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, 0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, 0x12,
0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, 0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, 0x1d,
0x5f
};
BOOST_AUTO_TEST_CASE(util_ParseHex)
{
std::vector<unsigned char> result;
std::vector<unsigned char> expected(ParseHex_expected, ParseHex_expected + sizeof(ParseHex_expected));
// Basic test vector
result = ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f");
BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end());
// Spaces between bytes must be supported
result = ParseHex("12 34 56 78");
BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78);
// Leading space must be supported (used in BerkeleyEnvironment::Salvage)
result = ParseHex(" 89 34 56 78");
BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78);
// Stop parsing at invalid value
result = ParseHex("1234 invalid 1234");
BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34);
}
BOOST_AUTO_TEST_CASE(util_HexStr)
{
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected, ParseHex_expected + sizeof(ParseHex_expected)),
"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected, ParseHex_expected + 5, true),
"04 67 8a fd b0");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected + sizeof(ParseHex_expected),
ParseHex_expected + sizeof(ParseHex_expected)),
"");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected + sizeof(ParseHex_expected),
ParseHex_expected + sizeof(ParseHex_expected), true),
"");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected, ParseHex_expected),
"");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_expected, ParseHex_expected, true),
"");
std::vector<unsigned char> ParseHex_vec(ParseHex_expected, ParseHex_expected + 5);
BOOST_CHECK_EQUAL(
HexStr(ParseHex_vec, true),
"04 67 8a fd b0");
BOOST_CHECK_EQUAL(
HexStr(ParseHex_vec.rbegin(), ParseHex_vec.rend()),
"b0fd8a6704"
);
BOOST_CHECK_EQUAL(
HexStr(ParseHex_vec.rbegin(), ParseHex_vec.rend(), true),
"b0 fd 8a 67 04"
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected),
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
""
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected),
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
""
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 1),
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
"04"
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 1),
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
"04"
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 5),
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
"b0fd8a6704"
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 5),
std::reverse_iterator<const uint8_t *>(ParseHex_expected), true),
"b0 fd 8a 67 04"
);
BOOST_CHECK_EQUAL(
HexStr(std::reverse_iterator<const uint8_t *>(ParseHex_expected + 65),
std::reverse_iterator<const uint8_t *>(ParseHex_expected)),
"5f1df16b2b704c8a578d0bbaf74d385cde12c11ee50455f3c438ef4c3fbcf649b6de611feae06279a60939e028a8d65c10b73071a6f16719274855feb0fd8a6704"
);
}
BOOST_AUTO_TEST_CASE(util_FormatISO8601DateTime)
{
BOOST_CHECK_EQUAL(FormatISO8601DateTime(1317425777), "2011-09-30T23:36:17Z");
}
BOOST_AUTO_TEST_CASE(util_FormatISO8601Date)
{
BOOST_CHECK_EQUAL(FormatISO8601Date(1317425777), "2011-09-30");
}
BOOST_AUTO_TEST_CASE(util_FormatISO8601Time)
{
BOOST_CHECK_EQUAL(FormatISO8601Time(1317425777), "23:36:17Z");
}
struct TestArgsManager : public ArgsManager
{
TestArgsManager() { m_network_only_args.clear(); }
std::map<std::string, std::vector<std::string> >& GetOverrideArgs() { return m_override_args; }
std::map<std::string, std::vector<std::string> >& GetConfigArgs() { return m_config_args; }
void ReadConfigString(const std::string str_config)
{
std::istringstream streamConfig(str_config);
{
LOCK(cs_args);
m_config_args.clear();
}
std::string error;
BOOST_REQUIRE(ReadConfigStream(streamConfig, error));
}
void SetNetworkOnlyArg(const std::string arg)
{
LOCK(cs_args);
m_network_only_args.insert(arg);
}
void SetupArgs(int argv, const char* args[])
{
for (int i = 0; i < argv; ++i) {
AddArg(args[i], "", false, OptionsCategory::OPTIONS);
}
}
};
BOOST_AUTO_TEST_CASE(util_ParseParameters)
{
TestArgsManager testArgs;
const char* avail_args[] = {"-a", "-b", "-ccc", "-d"};
const char *argv_test[] = {"-ignored", "-a", "-b", "-ccc=argument", "-ccc=multiple", "f", "-d=e"};
std::string error;
testArgs.SetupArgs(4, avail_args);
BOOST_CHECK(testArgs.ParseParameters(0, (char**)argv_test, error));
BOOST_CHECK(testArgs.GetOverrideArgs().empty() && testArgs.GetConfigArgs().empty());
BOOST_CHECK(testArgs.ParseParameters(1, (char**)argv_test, error));
BOOST_CHECK(testArgs.GetOverrideArgs().empty() && testArgs.GetConfigArgs().empty());
BOOST_CHECK(testArgs.ParseParameters(7, (char**)argv_test, error));
// expectation: -ignored is ignored (program name argument),
// -a, -b and -ccc end up in map, -d ignored because it is after
// a non-option argument (non-GNU option parsing)
BOOST_CHECK(testArgs.GetOverrideArgs().size() == 3 && testArgs.GetConfigArgs().empty());
BOOST_CHECK(testArgs.IsArgSet("-a") && testArgs.IsArgSet("-b") && testArgs.IsArgSet("-ccc")
&& !testArgs.IsArgSet("f") && !testArgs.IsArgSet("-d"));
BOOST_CHECK(testArgs.GetOverrideArgs().count("-a") && testArgs.GetOverrideArgs().count("-b") && testArgs.GetOverrideArgs().count("-ccc")
&& !testArgs.GetOverrideArgs().count("f") && !testArgs.GetOverrideArgs().count("-d"));
BOOST_CHECK(testArgs.GetOverrideArgs()["-a"].size() == 1);
BOOST_CHECK(testArgs.GetOverrideArgs()["-a"].front() == "");
BOOST_CHECK(testArgs.GetOverrideArgs()["-ccc"].size() == 2);
BOOST_CHECK(testArgs.GetOverrideArgs()["-ccc"].front() == "argument");
BOOST_CHECK(testArgs.GetOverrideArgs()["-ccc"].back() == "multiple");
BOOST_CHECK(testArgs.GetArgs("-ccc").size() == 2);
}
BOOST_AUTO_TEST_CASE(util_GetBoolArg)
{
TestArgsManager testArgs;
const char* avail_args[] = {"-a", "-b", "-c", "-d", "-e", "-f"};
const char *argv_test[] = {
"ignored", "-a", "-nob", "-c=0", "-d=1", "-e=false", "-f=true"};
std::string error;
testArgs.SetupArgs(6, avail_args);
BOOST_CHECK(testArgs.ParseParameters(7, (char**)argv_test, error));
// Each letter should be set.
for (const char opt : "abcdef")
BOOST_CHECK(testArgs.IsArgSet({'-', opt}) || !opt);
// Nothing else should be in the map
BOOST_CHECK(testArgs.GetOverrideArgs().size() == 6 &&
testArgs.GetConfigArgs().empty());
// The -no prefix should get stripped on the way in.
BOOST_CHECK(!testArgs.IsArgSet("-nob"));
// The -b option is flagged as negated, and nothing else is
BOOST_CHECK(testArgs.IsArgNegated("-b"));
BOOST_CHECK(!testArgs.IsArgNegated("-a"));
// Check expected values.
BOOST_CHECK(testArgs.GetBoolArg("-a", false) == true);
BOOST_CHECK(testArgs.GetBoolArg("-b", true) == false);
BOOST_CHECK(testArgs.GetBoolArg("-c", true) == false);
BOOST_CHECK(testArgs.GetBoolArg("-d", false) == true);
BOOST_CHECK(testArgs.GetBoolArg("-e", true) == false);
BOOST_CHECK(testArgs.GetBoolArg("-f", true) == false);
}
BOOST_AUTO_TEST_CASE(util_GetBoolArgEdgeCases)
{
// Test some awful edge cases that hopefully no user will ever exercise.
TestArgsManager testArgs;
// Params test
const char* avail_args[] = {"-foo", "-bar"};
const char *argv_test[] = {"ignored", "-nofoo", "-foo", "-nobar=0"};
testArgs.SetupArgs(2, avail_args);
std::string error;
BOOST_CHECK(testArgs.ParseParameters(4, (char**)argv_test, error));
// This was passed twice, second one overrides the negative setting.
BOOST_CHECK(!testArgs.IsArgNegated("-foo"));
BOOST_CHECK(testArgs.GetArg("-foo", "xxx") == "");
// A double negative is a positive, and not marked as negated.
BOOST_CHECK(!testArgs.IsArgNegated("-bar"));
BOOST_CHECK(testArgs.GetArg("-bar", "xxx") == "1");
// Config test
const char *conf_test = "nofoo=1\nfoo=1\nnobar=0\n";
BOOST_CHECK(testArgs.ParseParameters(1, (char**)argv_test, error));
testArgs.ReadConfigString(conf_test);
// This was passed twice, second one overrides the negative setting,
// and the value.
BOOST_CHECK(!testArgs.IsArgNegated("-foo"));
BOOST_CHECK(testArgs.GetArg("-foo", "xxx") == "1");
// A double negative is a positive, and does not count as negated.
BOOST_CHECK(!testArgs.IsArgNegated("-bar"));
BOOST_CHECK(testArgs.GetArg("-bar", "xxx") == "1");
// Combined test
const char *combo_test_args[] = {"ignored", "-nofoo", "-bar"};
const char *combo_test_conf = "foo=1\nnobar=1\n";
BOOST_CHECK(testArgs.ParseParameters(3, (char**)combo_test_args, error));
testArgs.ReadConfigString(combo_test_conf);
// Command line overrides, but doesn't erase old setting
BOOST_CHECK(testArgs.IsArgNegated("-foo"));
BOOST_CHECK(testArgs.GetArg("-foo", "xxx") == "0");
BOOST_CHECK(testArgs.GetArgs("-foo").size() == 0);
// Command line overrides, but doesn't erase old setting
BOOST_CHECK(!testArgs.IsArgNegated("-bar"));
BOOST_CHECK(testArgs.GetArg("-bar", "xxx") == "");
BOOST_CHECK(testArgs.GetArgs("-bar").size() == 1
&& testArgs.GetArgs("-bar").front() == "");
}
BOOST_AUTO_TEST_CASE(util_ReadConfigStream)
{
const char *str_config =
"a=\n"
"b=1\n"
"ccc=argument\n"
"ccc=multiple\n"
"d=e\n"
"nofff=1\n"
"noggg=0\n"
"h=1\n"
"noh=1\n"
"noi=1\n"
"i=1\n"
"sec1.ccc=extend1\n"
"\n"
"[sec1]\n"
"ccc=extend2\n"
"d=eee\n"
"h=1\n"
"[sec2]\n"
"ccc=extend3\n"
"iii=2\n";
TestArgsManager test_args;
const char* avail_args[] = {"-a", "-b", "-ccc", "-d", "-e", "-fff", "-ggg", "-h", "-i", "-iii"};
test_args.SetupArgs(10, avail_args);
test_args.ReadConfigString(str_config);
// expectation: a, b, ccc, d, fff, ggg, h, i end up in map
// so do sec1.ccc, sec1.d, sec1.h, sec2.ccc, sec2.iii
BOOST_CHECK(test_args.GetOverrideArgs().empty());
BOOST_CHECK(test_args.GetConfigArgs().size() == 13);
BOOST_CHECK(test_args.GetConfigArgs().count("-a")
&& test_args.GetConfigArgs().count("-b")
&& test_args.GetConfigArgs().count("-ccc")
&& test_args.GetConfigArgs().count("-d")
&& test_args.GetConfigArgs().count("-fff")
&& test_args.GetConfigArgs().count("-ggg")
&& test_args.GetConfigArgs().count("-h")
&& test_args.GetConfigArgs().count("-i")
);
BOOST_CHECK(test_args.GetConfigArgs().count("-sec1.ccc")
&& test_args.GetConfigArgs().count("-sec1.h")
&& test_args.GetConfigArgs().count("-sec2.ccc")
&& test_args.GetConfigArgs().count("-sec2.iii")
);
BOOST_CHECK(test_args.IsArgSet("-a")
&& test_args.IsArgSet("-b")
&& test_args.IsArgSet("-ccc")
&& test_args.IsArgSet("-d")
&& test_args.IsArgSet("-fff")
&& test_args.IsArgSet("-ggg")
&& test_args.IsArgSet("-h")
&& test_args.IsArgSet("-i")
&& !test_args.IsArgSet("-zzz")
&& !test_args.IsArgSet("-iii")
);
BOOST_CHECK(test_args.GetArg("-a", "xxx") == ""
&& test_args.GetArg("-b", "xxx") == "1"
&& test_args.GetArg("-ccc", "xxx") == "argument"
&& test_args.GetArg("-d", "xxx") == "e"
&& test_args.GetArg("-fff", "xxx") == "0"
&& test_args.GetArg("-ggg", "xxx") == "1"
&& test_args.GetArg("-h", "xxx") == "0"
&& test_args.GetArg("-i", "xxx") == "1"
&& test_args.GetArg("-zzz", "xxx") == "xxx"
&& test_args.GetArg("-iii", "xxx") == "xxx"
);
for (const bool def : {false, true}) {
BOOST_CHECK(test_args.GetBoolArg("-a", def)
&& test_args.GetBoolArg("-b", def)
&& !test_args.GetBoolArg("-ccc", def)
&& !test_args.GetBoolArg("-d", def)
&& !test_args.GetBoolArg("-fff", def)
&& test_args.GetBoolArg("-ggg", def)
&& !test_args.GetBoolArg("-h", def)
&& test_args.GetBoolArg("-i", def)
&& test_args.GetBoolArg("-zzz", def) == def
&& test_args.GetBoolArg("-iii", def) == def
);
}
BOOST_CHECK(test_args.GetArgs("-a").size() == 1
&& test_args.GetArgs("-a").front() == "");
BOOST_CHECK(test_args.GetArgs("-b").size() == 1
&& test_args.GetArgs("-b").front() == "1");
BOOST_CHECK(test_args.GetArgs("-ccc").size() == 2
&& test_args.GetArgs("-ccc").front() == "argument"
&& test_args.GetArgs("-ccc").back() == "multiple");
BOOST_CHECK(test_args.GetArgs("-fff").size() == 0);
BOOST_CHECK(test_args.GetArgs("-nofff").size() == 0);
BOOST_CHECK(test_args.GetArgs("-ggg").size() == 1
&& test_args.GetArgs("-ggg").front() == "1");
BOOST_CHECK(test_args.GetArgs("-noggg").size() == 0);
BOOST_CHECK(test_args.GetArgs("-h").size() == 0);
BOOST_CHECK(test_args.GetArgs("-noh").size() == 0);
BOOST_CHECK(test_args.GetArgs("-i").size() == 1
&& test_args.GetArgs("-i").front() == "1");
BOOST_CHECK(test_args.GetArgs("-noi").size() == 0);
BOOST_CHECK(test_args.GetArgs("-zzz").size() == 0);
BOOST_CHECK(!test_args.IsArgNegated("-a"));
BOOST_CHECK(!test_args.IsArgNegated("-b"));
BOOST_CHECK(!test_args.IsArgNegated("-ccc"));
BOOST_CHECK(!test_args.IsArgNegated("-d"));
BOOST_CHECK(test_args.IsArgNegated("-fff"));
BOOST_CHECK(!test_args.IsArgNegated("-ggg"));
BOOST_CHECK(test_args.IsArgNegated("-h")); // last setting takes precedence
BOOST_CHECK(!test_args.IsArgNegated("-i")); // last setting takes precedence
BOOST_CHECK(!test_args.IsArgNegated("-zzz"));
// Test sections work
test_args.SelectConfigNetwork("sec1");
// same as original
BOOST_CHECK(test_args.GetArg("-a", "xxx") == ""
&& test_args.GetArg("-b", "xxx") == "1"
&& test_args.GetArg("-fff", "xxx") == "0"
&& test_args.GetArg("-ggg", "xxx") == "1"
&& test_args.GetArg("-zzz", "xxx") == "xxx"
&& test_args.GetArg("-iii", "xxx") == "xxx"
);
// d is overridden
BOOST_CHECK(test_args.GetArg("-d", "xxx") == "eee");
// section-specific setting
BOOST_CHECK(test_args.GetArg("-h", "xxx") == "1");
// section takes priority for multiple values
BOOST_CHECK(test_args.GetArg("-ccc", "xxx") == "extend1");
// check multiple values works
const std::vector<std::string> sec1_ccc_expected = {"extend1","extend2","argument","multiple"};
const auto& sec1_ccc_res = test_args.GetArgs("-ccc");
BOOST_CHECK_EQUAL_COLLECTIONS(sec1_ccc_res.begin(), sec1_ccc_res.end(), sec1_ccc_expected.begin(), sec1_ccc_expected.end());
test_args.SelectConfigNetwork("sec2");
// same as original
BOOST_CHECK(test_args.GetArg("-a", "xxx") == ""
&& test_args.GetArg("-b", "xxx") == "1"
&& test_args.GetArg("-d", "xxx") == "e"
&& test_args.GetArg("-fff", "xxx") == "0"
&& test_args.GetArg("-ggg", "xxx") == "1"
&& test_args.GetArg("-zzz", "xxx") == "xxx"
&& test_args.GetArg("-h", "xxx") == "0"
);
// section-specific setting
BOOST_CHECK(test_args.GetArg("-iii", "xxx") == "2");
// section takes priority for multiple values
BOOST_CHECK(test_args.GetArg("-ccc", "xxx") == "extend3");
// check multiple values works
const std::vector<std::string> sec2_ccc_expected = {"extend3","argument","multiple"};
const auto& sec2_ccc_res = test_args.GetArgs("-ccc");
BOOST_CHECK_EQUAL_COLLECTIONS(sec2_ccc_res.begin(), sec2_ccc_res.end(), sec2_ccc_expected.begin(), sec2_ccc_expected.end());
// Test section only options
test_args.SetNetworkOnlyArg("-d");
test_args.SetNetworkOnlyArg("-ccc");
test_args.SetNetworkOnlyArg("-h");
test_args.SelectConfigNetwork(CBaseChainParams::MAIN);
BOOST_CHECK(test_args.GetArg("-d", "xxx") == "e");
BOOST_CHECK(test_args.GetArgs("-ccc").size() == 2);
BOOST_CHECK(test_args.GetArg("-h", "xxx") == "0");
test_args.SelectConfigNetwork("sec1");
BOOST_CHECK(test_args.GetArg("-d", "xxx") == "eee");
BOOST_CHECK(test_args.GetArgs("-d").size() == 1);
BOOST_CHECK(test_args.GetArgs("-ccc").size() == 2);
BOOST_CHECK(test_args.GetArg("-h", "xxx") == "1");
test_args.SelectConfigNetwork("sec2");
BOOST_CHECK(test_args.GetArg("-d", "xxx") == "xxx");
BOOST_CHECK(test_args.GetArgs("-d").size() == 0);
BOOST_CHECK(test_args.GetArgs("-ccc").size() == 1);
BOOST_CHECK(test_args.GetArg("-h", "xxx") == "0");
}
BOOST_AUTO_TEST_CASE(util_GetArg)
{
TestArgsManager testArgs;
testArgs.GetOverrideArgs().clear();
testArgs.GetOverrideArgs()["strtest1"] = {"string..."};
// strtest2 undefined on purpose
testArgs.GetOverrideArgs()["inttest1"] = {"12345"};
testArgs.GetOverrideArgs()["inttest2"] = {"81985529216486895"};
// inttest3 undefined on purpose
testArgs.GetOverrideArgs()["booltest1"] = {""};
// booltest2 undefined on purpose
testArgs.GetOverrideArgs()["booltest3"] = {"0"};
testArgs.GetOverrideArgs()["booltest4"] = {"1"};
// priorities
testArgs.GetOverrideArgs()["pritest1"] = {"a", "b"};
testArgs.GetConfigArgs()["pritest2"] = {"a", "b"};
testArgs.GetOverrideArgs()["pritest3"] = {"a"};
testArgs.GetConfigArgs()["pritest3"] = {"b"};
testArgs.GetOverrideArgs()["pritest4"] = {"a","b"};
testArgs.GetConfigArgs()["pritest4"] = {"c","d"};
BOOST_CHECK_EQUAL(testArgs.GetArg("strtest1", "default"), "string...");
BOOST_CHECK_EQUAL(testArgs.GetArg("strtest2", "default"), "default");
BOOST_CHECK_EQUAL(testArgs.GetArg("inttest1", -1), 12345);
BOOST_CHECK_EQUAL(testArgs.GetArg("inttest2", -1), 81985529216486895LL);
BOOST_CHECK_EQUAL(testArgs.GetArg("inttest3", -1), -1);
BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest1", false), true);
BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest2", false), false);
BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest3", false), false);
BOOST_CHECK_EQUAL(testArgs.GetBoolArg("booltest4", false), true);
BOOST_CHECK_EQUAL(testArgs.GetArg("pritest1", "default"), "b");
BOOST_CHECK_EQUAL(testArgs.GetArg("pritest2", "default"), "a");
BOOST_CHECK_EQUAL(testArgs.GetArg("pritest3", "default"), "a");
BOOST_CHECK_EQUAL(testArgs.GetArg("pritest4", "default"), "b");
}
BOOST_AUTO_TEST_CASE(util_GetChainName)
{
TestArgsManager test_args;
const char* avail_args[] = {"-testnet", "-regtest"};
test_args.SetupArgs(2, avail_args);
const char* argv_testnet[] = {"cmd", "-testnet"};
const char* argv_regtest[] = {"cmd", "-regtest"};
const char* argv_test_no_reg[] = {"cmd", "-testnet", "-noregtest"};
const char* argv_both[] = {"cmd", "-testnet", "-regtest"};
// equivalent to "-testnet"
// regtest in testnet section is ignored
const char* testnetconf = "testnet=1\nregtest=0\n[test]\nregtest=1";
std::string error;
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "main");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "regtest");
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_test_no_reg, error));
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_test_no_reg, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
// check setting the network to test (and thus making
// [test] regtest=1 potentially relevant) doesn't break things
test_args.SelectConfigNetwork("test");
BOOST_CHECK(test_args.ParseParameters(0, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_testnet, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_regtest, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
BOOST_CHECK(test_args.ParseParameters(2, (char**)argv_test_no_reg, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_EQUAL(test_args.GetChainName(), "test");
BOOST_CHECK(test_args.ParseParameters(3, (char**)argv_both, error));
test_args.ReadConfigString(testnetconf);
BOOST_CHECK_THROW(test_args.GetChainName(), std::runtime_error);
}
BOOST_AUTO_TEST_CASE(util_FormatMoney)
{
BOOST_CHECK_EQUAL(FormatMoney(0), "0.00");
BOOST_CHECK_EQUAL(FormatMoney((COIN/10000)*123456789), "12345.6789");
BOOST_CHECK_EQUAL(FormatMoney(-COIN), "-1.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*100000000), "100000000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*10000000), "10000000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*1000000), "1000000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*100000), "100000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*10000), "10000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*1000), "1000.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*100), "100.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN*10), "10.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN), "1.00");
BOOST_CHECK_EQUAL(FormatMoney(COIN/10), "0.10");
BOOST_CHECK_EQUAL(FormatMoney(COIN/100), "0.01");
BOOST_CHECK_EQUAL(FormatMoney(COIN/1000), "0.001");
BOOST_CHECK_EQUAL(FormatMoney(COIN/10000), "0.0001");
BOOST_CHECK_EQUAL(FormatMoney(COIN/100000), "0.00001");
BOOST_CHECK_EQUAL(FormatMoney(COIN/1000000), "0.000001");
BOOST_CHECK_EQUAL(FormatMoney(COIN/10000000), "0.0000001");
BOOST_CHECK_EQUAL(FormatMoney(COIN/100000000), "0.00000001");
}
BOOST_AUTO_TEST_CASE(util_ParseMoney)
{
CAmount ret = 0;
BOOST_CHECK(ParseMoney("0.0", ret));
BOOST_CHECK_EQUAL(ret, 0);
BOOST_CHECK(ParseMoney("12345.6789", ret));
BOOST_CHECK_EQUAL(ret, (COIN/10000)*123456789);
BOOST_CHECK(ParseMoney("100000000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*100000000);
BOOST_CHECK(ParseMoney("10000000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*10000000);
BOOST_CHECK(ParseMoney("1000000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*1000000);
BOOST_CHECK(ParseMoney("100000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*100000);
BOOST_CHECK(ParseMoney("10000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*10000);
BOOST_CHECK(ParseMoney("1000.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*1000);
BOOST_CHECK(ParseMoney("100.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*100);
BOOST_CHECK(ParseMoney("10.00", ret));
BOOST_CHECK_EQUAL(ret, COIN*10);
BOOST_CHECK(ParseMoney("1.00", ret));
BOOST_CHECK_EQUAL(ret, COIN);
BOOST_CHECK(ParseMoney("1", ret));
BOOST_CHECK_EQUAL(ret, COIN);
BOOST_CHECK(ParseMoney("0.1", ret));
BOOST_CHECK_EQUAL(ret, COIN/10);
BOOST_CHECK(ParseMoney("0.01", ret));
BOOST_CHECK_EQUAL(ret, COIN/100);
BOOST_CHECK(ParseMoney("0.001", ret));
BOOST_CHECK_EQUAL(ret, COIN/1000);
BOOST_CHECK(ParseMoney("0.0001", ret));
BOOST_CHECK_EQUAL(ret, COIN/10000);
BOOST_CHECK(ParseMoney("0.00001", ret));
BOOST_CHECK_EQUAL(ret, COIN/100000);
BOOST_CHECK(ParseMoney("0.000001", ret));
BOOST_CHECK_EQUAL(ret, COIN/1000000);
BOOST_CHECK(ParseMoney("0.0000001", ret));
BOOST_CHECK_EQUAL(ret, COIN/10000000);
BOOST_CHECK(ParseMoney("0.00000001", ret));
BOOST_CHECK_EQUAL(ret, COIN/100000000);
// Attempted 63 bit overflow should fail
BOOST_CHECK(!ParseMoney("92233720368.54775808", ret));
// Parsing negative amounts must fail
BOOST_CHECK(!ParseMoney("-1", ret));
}
BOOST_AUTO_TEST_CASE(util_IsHex)
{
BOOST_CHECK(IsHex("00"));
BOOST_CHECK(IsHex("00112233445566778899aabbccddeeffAABBCCDDEEFF"));
BOOST_CHECK(IsHex("ff"));
BOOST_CHECK(IsHex("FF"));
BOOST_CHECK(!IsHex(""));
BOOST_CHECK(!IsHex("0"));
BOOST_CHECK(!IsHex("a"));
BOOST_CHECK(!IsHex("eleven"));
BOOST_CHECK(!IsHex("00xx00"));
BOOST_CHECK(!IsHex("0x0000"));
}
BOOST_AUTO_TEST_CASE(util_IsHexNumber)
{
BOOST_CHECK(IsHexNumber("0x0"));
BOOST_CHECK(IsHexNumber("0"));
BOOST_CHECK(IsHexNumber("0x10"));
BOOST_CHECK(IsHexNumber("10"));
BOOST_CHECK(IsHexNumber("0xff"));
BOOST_CHECK(IsHexNumber("ff"));
BOOST_CHECK(IsHexNumber("0xFfa"));
BOOST_CHECK(IsHexNumber("Ffa"));
BOOST_CHECK(IsHexNumber("0x00112233445566778899aabbccddeeffAABBCCDDEEFF"));
BOOST_CHECK(IsHexNumber("00112233445566778899aabbccddeeffAABBCCDDEEFF"));
BOOST_CHECK(!IsHexNumber("")); // empty string not allowed
BOOST_CHECK(!IsHexNumber("0x")); // empty string after prefix not allowed
BOOST_CHECK(!IsHexNumber("0x0 ")); // no spaces at end,
BOOST_CHECK(!IsHexNumber(" 0x0")); // or beginning,
BOOST_CHECK(!IsHexNumber("0x 0")); // or middle,
BOOST_CHECK(!IsHexNumber(" ")); // etc.
BOOST_CHECK(!IsHexNumber("0x0ga")); // invalid character
BOOST_CHECK(!IsHexNumber("x0")); // broken prefix
BOOST_CHECK(!IsHexNumber("0x0x00")); // two prefixes not allowed
}
BOOST_AUTO_TEST_CASE(util_seed_insecure_rand)
{
SeedInsecureRand(true);
for (int mod=2;mod<11;mod++)
{
int mask = 1;
// Really rough binomial confidence approximation.
int err = 30*10000./mod*sqrt((1./mod*(1-1./mod))/10000.);
//mask is 2^ceil(log2(mod))-1
while(mask<mod-1)mask=(mask<<1)+1;
int count = 0;
//How often does it get a zero from the uniform range [0,mod)?
for (int i = 0; i < 10000; i++) {
uint32_t rval;
do{
rval=InsecureRand32()&mask;
}while(rval>=(uint32_t)mod);
count += rval==0;
}
BOOST_CHECK(count<=10000/mod+err);
BOOST_CHECK(count>=10000/mod-err);
}
}
BOOST_AUTO_TEST_CASE(util_TimingResistantEqual)
{
BOOST_CHECK(TimingResistantEqual(std::string(""), std::string("")));
BOOST_CHECK(!TimingResistantEqual(std::string("abc"), std::string("")));
BOOST_CHECK(!TimingResistantEqual(std::string(""), std::string("abc")));
BOOST_CHECK(!TimingResistantEqual(std::string("a"), std::string("aa")));
BOOST_CHECK(!TimingResistantEqual(std::string("aa"), std::string("a")));
BOOST_CHECK(TimingResistantEqual(std::string("abc"), std::string("abc")));
BOOST_CHECK(!TimingResistantEqual(std::string("abc"), std::string("aba")));
}
/* Test strprintf formatting directives.
* Put a string before and after to ensure sanity of element sizes on stack. */
#define B "check_prefix"
#define E "check_postfix"
BOOST_AUTO_TEST_CASE(strprintf_numbers)
{
int64_t s64t = -9223372036854775807LL; /* signed 64 bit test value */
uint64_t u64t = 18446744073709551615ULL; /* unsigned 64 bit test value */
BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 " E);
BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 " E);
BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff " E);
size_t st = 12345678; /* unsigned size_t test value */
ssize_t sst = -12345678; /* signed size_t test value */
BOOST_CHECK(strprintf("%s %d %s", B, sst, E) == B" -12345678 " E);
BOOST_CHECK(strprintf("%s %u %s", B, st, E) == B" 12345678 " E);
BOOST_CHECK(strprintf("%s %x %s", B, st, E) == B" bc614e " E);
ptrdiff_t pt = 87654321; /* positive ptrdiff_t test value */
ptrdiff_t spt = -87654321; /* negative ptrdiff_t test value */
BOOST_CHECK(strprintf("%s %d %s", B, spt, E) == B" -87654321 " E);
BOOST_CHECK(strprintf("%s %u %s", B, pt, E) == B" 87654321 " E);
BOOST_CHECK(strprintf("%s %x %s", B, pt, E) == B" 5397fb1 " E);
}
#undef B
#undef E
/* Check for mingw/wine issue #3494
* Remove this test before time.ctime(0xffffffff) == 'Sun Feb 7 07:28:15 2106'
*/
BOOST_AUTO_TEST_CASE(gettime)
{
BOOST_CHECK((GetTime() & ~0xFFFFFFFFLL) == 0);
}
BOOST_AUTO_TEST_CASE(test_IsDigit)
{
BOOST_CHECK_EQUAL(IsDigit('0'), true);
BOOST_CHECK_EQUAL(IsDigit('1'), true);
BOOST_CHECK_EQUAL(IsDigit('8'), true);
BOOST_CHECK_EQUAL(IsDigit('9'), true);
BOOST_CHECK_EQUAL(IsDigit('0' - 1), false);
BOOST_CHECK_EQUAL(IsDigit('9' + 1), false);
BOOST_CHECK_EQUAL(IsDigit(0), false);
BOOST_CHECK_EQUAL(IsDigit(1), false);
BOOST_CHECK_EQUAL(IsDigit(8), false);
BOOST_CHECK_EQUAL(IsDigit(9), false);
}
BOOST_AUTO_TEST_CASE(test_ParseInt32)
{
int32_t n;
// Valid values
BOOST_CHECK(ParseInt32("1234", nullptr));
BOOST_CHECK(ParseInt32("0", &n) && n == 0);
BOOST_CHECK(ParseInt32("1234", &n) && n == 1234);
BOOST_CHECK(ParseInt32("01234", &n) && n == 1234); // no octal
BOOST_CHECK(ParseInt32("2147483647", &n) && n == 2147483647);
BOOST_CHECK(ParseInt32("-2147483648", &n) && n == (-2147483647 - 1)); // (-2147483647 - 1) equals INT_MIN
BOOST_CHECK(ParseInt32("-1234", &n) && n == -1234);
// Invalid values
BOOST_CHECK(!ParseInt32("", &n));
BOOST_CHECK(!ParseInt32(" 1", &n)); // no padding inside
BOOST_CHECK(!ParseInt32("1 ", &n));
BOOST_CHECK(!ParseInt32("1a", &n));
BOOST_CHECK(!ParseInt32("aap", &n));
BOOST_CHECK(!ParseInt32("0x1", &n)); // no hex
BOOST_CHECK(!ParseInt32("0x1", &n)); // no hex
const char test_bytes[] = {'1', 0, '1'};
std::string teststr(test_bytes, sizeof(test_bytes));
BOOST_CHECK(!ParseInt32(teststr, &n)); // no embedded NULs
// Overflow and underflow
BOOST_CHECK(!ParseInt32("-2147483649", nullptr));
BOOST_CHECK(!ParseInt32("2147483648", nullptr));
BOOST_CHECK(!ParseInt32("-32482348723847471234", nullptr));
BOOST_CHECK(!ParseInt32("32482348723847471234", nullptr));
}
BOOST_AUTO_TEST_CASE(test_ParseInt64)
{
int64_t n;
// Valid values
BOOST_CHECK(ParseInt64("1234", nullptr));
BOOST_CHECK(ParseInt64("0", &n) && n == 0LL);
BOOST_CHECK(ParseInt64("1234", &n) && n == 1234LL);
BOOST_CHECK(ParseInt64("01234", &n) && n == 1234LL); // no octal
BOOST_CHECK(ParseInt64("2147483647", &n) && n == 2147483647LL);
BOOST_CHECK(ParseInt64("-2147483648", &n) && n == -2147483648LL);
BOOST_CHECK(ParseInt64("9223372036854775807", &n) && n == (int64_t)9223372036854775807);
BOOST_CHECK(ParseInt64("-9223372036854775808", &n) && n == (int64_t)-9223372036854775807-1);
BOOST_CHECK(ParseInt64("-1234", &n) && n == -1234LL);
// Invalid values
BOOST_CHECK(!ParseInt64("", &n));
BOOST_CHECK(!ParseInt64(" 1", &n)); // no padding inside
BOOST_CHECK(!ParseInt64("1 ", &n));
BOOST_CHECK(!ParseInt64("1a", &n));
BOOST_CHECK(!ParseInt64("aap", &n));
BOOST_CHECK(!ParseInt64("0x1", &n)); // no hex
const char test_bytes[] = {'1', 0, '1'};
std::string teststr(test_bytes, sizeof(test_bytes));
BOOST_CHECK(!ParseInt64(teststr, &n)); // no embedded NULs
// Overflow and underflow
BOOST_CHECK(!ParseInt64("-9223372036854775809", nullptr));
BOOST_CHECK(!ParseInt64("9223372036854775808", nullptr));
BOOST_CHECK(!ParseInt64("-32482348723847471234", nullptr));
BOOST_CHECK(!ParseInt64("32482348723847471234", nullptr));
}
BOOST_AUTO_TEST_CASE(test_ParseUInt32)
{
uint32_t n;
// Valid values
BOOST_CHECK(ParseUInt32("1234", nullptr));
BOOST_CHECK(ParseUInt32("0", &n) && n == 0);
BOOST_CHECK(ParseUInt32("1234", &n) && n == 1234);
BOOST_CHECK(ParseUInt32("01234", &n) && n == 1234); // no octal
BOOST_CHECK(ParseUInt32("2147483647", &n) && n == 2147483647);
BOOST_CHECK(ParseUInt32("2147483648", &n) && n == (uint32_t)2147483648);
BOOST_CHECK(ParseUInt32("4294967295", &n) && n == (uint32_t)4294967295);
// Invalid values
BOOST_CHECK(!ParseUInt32("", &n));
BOOST_CHECK(!ParseUInt32(" 1", &n)); // no padding inside
BOOST_CHECK(!ParseUInt32(" -1", &n));
BOOST_CHECK(!ParseUInt32("1 ", &n));
BOOST_CHECK(!ParseUInt32("1a", &n));
BOOST_CHECK(!ParseUInt32("aap", &n));
BOOST_CHECK(!ParseUInt32("0x1", &n)); // no hex
BOOST_CHECK(!ParseUInt32("0x1", &n)); // no hex
const char test_bytes[] = {'1', 0, '1'};
std::string teststr(test_bytes, sizeof(test_bytes));
BOOST_CHECK(!ParseUInt32(teststr, &n)); // no embedded NULs
// Overflow and underflow
BOOST_CHECK(!ParseUInt32("-2147483648", &n));
BOOST_CHECK(!ParseUInt32("4294967296", &n));
BOOST_CHECK(!ParseUInt32("-1234", &n));
BOOST_CHECK(!ParseUInt32("-32482348723847471234", nullptr));
BOOST_CHECK(!ParseUInt32("32482348723847471234", nullptr));
}
BOOST_AUTO_TEST_CASE(test_ParseUInt64)
{
uint64_t n;
// Valid values
BOOST_CHECK(ParseUInt64("1234", nullptr));
BOOST_CHECK(ParseUInt64("0", &n) && n == 0LL);
BOOST_CHECK(ParseUInt64("1234", &n) && n == 1234LL);
BOOST_CHECK(ParseUInt64("01234", &n) && n == 1234LL); // no octal
BOOST_CHECK(ParseUInt64("2147483647", &n) && n == 2147483647LL);
BOOST_CHECK(ParseUInt64("9223372036854775807", &n) && n == 9223372036854775807ULL);
BOOST_CHECK(ParseUInt64("9223372036854775808", &n) && n == 9223372036854775808ULL);
BOOST_CHECK(ParseUInt64("18446744073709551615", &n) && n == 18446744073709551615ULL);
// Invalid values
BOOST_CHECK(!ParseUInt64("", &n));
BOOST_CHECK(!ParseUInt64(" 1", &n)); // no padding inside
BOOST_CHECK(!ParseUInt64(" -1", &n));
BOOST_CHECK(!ParseUInt64("1 ", &n));
BOOST_CHECK(!ParseUInt64("1a", &n));
BOOST_CHECK(!ParseUInt64("aap", &n));
BOOST_CHECK(!ParseUInt64("0x1", &n)); // no hex
const char test_bytes[] = {'1', 0, '1'};
std::string teststr(test_bytes, sizeof(test_bytes));
BOOST_CHECK(!ParseUInt64(teststr, &n)); // no embedded NULs
// Overflow and underflow
BOOST_CHECK(!ParseUInt64("-9223372036854775809", nullptr));
BOOST_CHECK(!ParseUInt64("18446744073709551616", nullptr));
BOOST_CHECK(!ParseUInt64("-32482348723847471234", nullptr));
BOOST_CHECK(!ParseUInt64("-2147483648", &n));
BOOST_CHECK(!ParseUInt64("-9223372036854775808", &n));
BOOST_CHECK(!ParseUInt64("-1234", &n));
}
BOOST_AUTO_TEST_CASE(test_ParseDouble)
{
double n;
// Valid values
BOOST_CHECK(ParseDouble("1234", nullptr));
BOOST_CHECK(ParseDouble("0", &n) && n == 0.0);
BOOST_CHECK(ParseDouble("1234", &n) && n == 1234.0);
BOOST_CHECK(ParseDouble("01234", &n) && n == 1234.0); // no octal
BOOST_CHECK(ParseDouble("2147483647", &n) && n == 2147483647.0);
BOOST_CHECK(ParseDouble("-2147483648", &n) && n == -2147483648.0);
BOOST_CHECK(ParseDouble("-1234", &n) && n == -1234.0);
BOOST_CHECK(ParseDouble("1e6", &n) && n == 1e6);
BOOST_CHECK(ParseDouble("-1e6", &n) && n == -1e6);
// Invalid values
BOOST_CHECK(!ParseDouble("", &n));
BOOST_CHECK(!ParseDouble(" 1", &n)); // no padding inside
BOOST_CHECK(!ParseDouble("1 ", &n));
BOOST_CHECK(!ParseDouble("1a", &n));
BOOST_CHECK(!ParseDouble("aap", &n));
BOOST_CHECK(!ParseDouble("0x1", &n)); // no hex
const char test_bytes[] = {'1', 0, '1'};
std::string teststr(test_bytes, sizeof(test_bytes));
BOOST_CHECK(!ParseDouble(teststr, &n)); // no embedded NULs
// Overflow and underflow
BOOST_CHECK(!ParseDouble("-1e10000", nullptr));
BOOST_CHECK(!ParseDouble("1e10000", nullptr));
}
BOOST_AUTO_TEST_CASE(test_FormatParagraph)
{
BOOST_CHECK_EQUAL(FormatParagraph("", 79, 0), "");
BOOST_CHECK_EQUAL(FormatParagraph("test", 79, 0), "test");
BOOST_CHECK_EQUAL(FormatParagraph(" test", 79, 0), " test");
BOOST_CHECK_EQUAL(FormatParagraph("test test", 79, 0), "test test");
BOOST_CHECK_EQUAL(FormatParagraph("test test", 4, 0), "test\ntest");
BOOST_CHECK_EQUAL(FormatParagraph("testerde test", 4, 0), "testerde\ntest");
BOOST_CHECK_EQUAL(FormatParagraph("test test", 4, 4), "test\n test");
// Make sure we don't indent a fully-new line following a too-long line ending
BOOST_CHECK_EQUAL(FormatParagraph("test test\nabc", 4, 4), "test\n test\nabc");
BOOST_CHECK_EQUAL(FormatParagraph("This_is_a_very_long_test_string_without_any_spaces_so_it_should_just_get_returned_as_is_despite_the_length until it gets here", 79), "This_is_a_very_long_test_string_without_any_spaces_so_it_should_just_get_returned_as_is_despite_the_length\nuntil it gets here");
// Test wrap length is exact
BOOST_CHECK_EQUAL(FormatParagraph("a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p", 79), "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\nf g h i j k l m n o p");
BOOST_CHECK_EQUAL(FormatParagraph("x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p", 79), "x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\nf g h i j k l m n o p");
// Indent should be included in length of lines
BOOST_CHECK_EQUAL(FormatParagraph("x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 a b c d e fg h i j k", 79, 4), "x\na b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 a b c de\n f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 a b c d e fg\n h i j k");
BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string. This is a second sentence in the very long test string.", 79), "This is a very long test string. This is a second sentence in the very long\ntest string.");
BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string.\nThis is a second sentence in the very long test string. This is a third sentence in the very long test string.", 79), "This is a very long test string.\nThis is a second sentence in the very long test string. This is a third\nsentence in the very long test string.");
BOOST_CHECK_EQUAL(FormatParagraph("This is a very long test string.\n\nThis is a second sentence in the very long test string. This is a third sentence in the very long test string.", 79), "This is a very long test string.\n\nThis is a second sentence in the very long test string. This is a third\nsentence in the very long test string.");
BOOST_CHECK_EQUAL(FormatParagraph("Testing that normal newlines do not get indented.\nLike here.", 79), "Testing that normal newlines do not get indented.\nLike here.");
}
BOOST_AUTO_TEST_CASE(test_FormatSubVersion)
{
std::vector<std::string> comments;
comments.push_back(std::string("comment1"));
std::vector<std::string> comments2;
comments2.push_back(std::string("comment1"));
comments2.push_back(SanitizeString(std::string("Comment2; .,_?@-; !\"#$%&'()*+/<=>[]\\^`{|}~"), SAFE_CHARS_UA_COMMENT)); // Semicolon is discouraged but not forbidden by BIP-0014
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, std::vector<std::string>()),std::string("/Test:0.9.99/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments),std::string("/Test:0.9.99(comment1)/"));
BOOST_CHECK_EQUAL(FormatSubVersion("Test", 99900, comments2),std::string("/Test:0.9.99(comment1; Comment2; .,_?@-; )/"));
}
BOOST_AUTO_TEST_CASE(test_ParseFixedPoint)
{
int64_t amount = 0;
BOOST_CHECK(ParseFixedPoint("0", 8, &amount));
BOOST_CHECK_EQUAL(amount, 0LL);
BOOST_CHECK(ParseFixedPoint("1", 8, &amount));
BOOST_CHECK_EQUAL(amount, 100000000LL);
BOOST_CHECK(ParseFixedPoint("0.0", 8, &amount));
BOOST_CHECK_EQUAL(amount, 0LL);
BOOST_CHECK(ParseFixedPoint("-0.1", 8, &amount));
BOOST_CHECK_EQUAL(amount, -10000000LL);
BOOST_CHECK(ParseFixedPoint("1.1", 8, &amount));
BOOST_CHECK_EQUAL(amount, 110000000LL);
BOOST_CHECK(ParseFixedPoint("1.10000000000000000", 8, &amount));
BOOST_CHECK_EQUAL(amount, 110000000LL);
BOOST_CHECK(ParseFixedPoint("1.1e1", 8, &amount));
BOOST_CHECK_EQUAL(amount, 1100000000LL);
BOOST_CHECK(ParseFixedPoint("1.1e-1", 8, &amount));
BOOST_CHECK_EQUAL(amount, 11000000LL);
BOOST_CHECK(ParseFixedPoint("1000", 8, &amount));
BOOST_CHECK_EQUAL(amount, 100000000000LL);
BOOST_CHECK(ParseFixedPoint("-1000", 8, &amount));
BOOST_CHECK_EQUAL(amount, -100000000000LL);
BOOST_CHECK(ParseFixedPoint("0.00000001", 8, &amount));
BOOST_CHECK_EQUAL(amount, 1LL);
BOOST_CHECK(ParseFixedPoint("0.0000000100000000", 8, &amount));
BOOST_CHECK_EQUAL(amount, 1LL);
BOOST_CHECK(ParseFixedPoint("-0.00000001", 8, &amount));
BOOST_CHECK_EQUAL(amount, -1LL);
BOOST_CHECK(ParseFixedPoint("1000000000.00000001", 8, &amount));
BOOST_CHECK_EQUAL(amount, 100000000000000001LL);
BOOST_CHECK(ParseFixedPoint("9999999999.99999999", 8, &amount));
BOOST_CHECK_EQUAL(amount, 999999999999999999LL);
BOOST_CHECK(ParseFixedPoint("-9999999999.99999999", 8, &amount));
BOOST_CHECK_EQUAL(amount, -999999999999999999LL);
BOOST_CHECK(!ParseFixedPoint("", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("a-1000", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-a1000", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-1000a", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-01000", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("00.1", 8, &amount));
BOOST_CHECK(!ParseFixedPoint(".1", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("--0.1", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("0.000000001", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-0.000000001", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("0.00000001000000001", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-10000000000.00000000", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("10000000000.00000000", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-10000000000.00000001", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("10000000000.00000001", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-10000000000.00000009", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("10000000000.00000009", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-99999999999.99999999", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("99999909999.09999999", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("92233720368.54775807", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("92233720368.54775808", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-92233720368.54775808", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("-92233720368.54775809", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("1.1e", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("1.1e-", 8, &amount));
BOOST_CHECK(!ParseFixedPoint("1.", 8, &amount));
}
static void TestOtherThread(fs::path dirname, std::string lockname, bool *result)
{
*result = LockDirectory(dirname, lockname);
}
#ifndef WIN32 // Cannot do this test on WIN32 due to lack of fork()
static constexpr char LockCommand = 'L';
static constexpr char UnlockCommand = 'U';
static constexpr char ExitCommand = 'X';
static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
{
char ch;
while (true) {
int rv = read(fd, &ch, 1); // Wait for command
assert(rv == 1);
switch(ch) {
case LockCommand:
ch = LockDirectory(dirname, lockname);
rv = write(fd, &ch, 1);
assert(rv == 1);
break;
case UnlockCommand:
ReleaseDirectoryLocks();
ch = true; // Always succeeds
rv = write(fd, &ch, 1);
assert(rv == 1);
break;
case ExitCommand:
close(fd);
exit(0);
default:
assert(0);
}
}
}
#endif
BOOST_AUTO_TEST_CASE(test_LockDirectory)
{
fs::path dirname = SetDataDir("test_LockDirectory") / fs::unique_path();
const std::string lockname = ".lock";
#ifndef WIN32
// Revert SIGCHLD to default, otherwise boost.test will catch and fail on
// it: there is BOOST_TEST_IGNORE_SIGCHLD but that only works when defined
// at build-time of the boost library
void (*old_handler)(int) = signal(SIGCHLD, SIG_DFL);
// Fork another process for testing before creating the lock, so that we
// won't fork while holding the lock (which might be undefined, and is not
// relevant as test case as that is avoided with -daemonize).
int fd[2];
BOOST_CHECK_EQUAL(socketpair(AF_UNIX, SOCK_STREAM, 0, fd), 0);
pid_t pid = fork();
if (!pid) {
BOOST_CHECK_EQUAL(close(fd[1]), 0); // Child: close parent end
TestOtherProcess(dirname, lockname, fd[0]);
}
BOOST_CHECK_EQUAL(close(fd[0]), 0); // Parent: close child end
#endif
// Lock on non-existent directory should fail
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname), false);
fs::create_directories(dirname);
// Probing lock on new directory should succeed
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname, true), true);
// Persistent lock on new directory should succeed
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname), true);
// Another lock on the directory from the same thread should succeed
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname), true);
// Another lock on the directory from a different thread within the same process should succeed
bool threadresult;
std::thread thr(TestOtherThread, dirname, lockname, &threadresult);
thr.join();
BOOST_CHECK_EQUAL(threadresult, true);
#ifndef WIN32
// Try to acquire lock in child process while we're holding it, this should fail.
char ch;
BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1);
BOOST_CHECK_EQUAL(read(fd[1], &ch, 1), 1);
BOOST_CHECK_EQUAL((bool)ch, false);
// Give up our lock
ReleaseDirectoryLocks();
// Probing lock from our side now should succeed, but not hold on to the lock.
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname, true), true);
// Try to acquire the lock in the child process, this should be successful.
BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1);
BOOST_CHECK_EQUAL(read(fd[1], &ch, 1), 1);
BOOST_CHECK_EQUAL((bool)ch, true);
// When we try to probe the lock now, it should fail.
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname, true), false);
// Unlock the lock in the child process
BOOST_CHECK_EQUAL(write(fd[1], &UnlockCommand, 1), 1);
BOOST_CHECK_EQUAL(read(fd[1], &ch, 1), 1);
BOOST_CHECK_EQUAL((bool)ch, true);
// When we try to probe the lock now, it should succeed.
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname, true), true);
// Re-lock the lock in the child process, then wait for it to exit, check
// successful return. After that, we check that exiting the process
// has released the lock as we would expect by probing it.
int processstatus;
BOOST_CHECK_EQUAL(write(fd[1], &LockCommand, 1), 1);
BOOST_CHECK_EQUAL(write(fd[1], &ExitCommand, 1), 1);
BOOST_CHECK_EQUAL(waitpid(pid, &processstatus, 0), pid);
BOOST_CHECK_EQUAL(processstatus, 0);
BOOST_CHECK_EQUAL(LockDirectory(dirname, lockname, true), true);
// Restore SIGCHLD
signal(SIGCHLD, old_handler);
BOOST_CHECK_EQUAL(close(fd[1]), 0); // Close our side of the socketpair
#endif
// Clean up
ReleaseDirectoryLocks();
fs::remove_all(dirname);
}
BOOST_AUTO_TEST_CASE(test_DirIsWritable)
{
// Should be able to write to the data dir.
fs::path tmpdirname = SetDataDir("test_DirIsWritable");
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true);
// Should not be able to write to a non-existent dir.
tmpdirname = tmpdirname / fs::unique_path();
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), false);
fs::create_directory(tmpdirname);
// Should be able to write to it now.
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true);
fs::remove(tmpdirname);
}
BOOST_AUTO_TEST_CASE(test_ToLower)
{
BOOST_CHECK_EQUAL(ToLower('@'), '@');
BOOST_CHECK_EQUAL(ToLower('A'), 'a');
BOOST_CHECK_EQUAL(ToLower('Z'), 'z');
BOOST_CHECK_EQUAL(ToLower('['), '[');
BOOST_CHECK_EQUAL(ToLower(0), 0);
BOOST_CHECK_EQUAL(ToLower('\xff'), '\xff');
std::string testVector;
Downcase(testVector);
BOOST_CHECK_EQUAL(testVector, "");
testVector = "#HODL";
Downcase(testVector);
BOOST_CHECK_EQUAL(testVector, "#hodl");
testVector = "\x00\xfe\xff";
Downcase(testVector);
BOOST_CHECK_EQUAL(testVector, "\x00\xfe\xff");
}
BOOST_AUTO_TEST_CASE(test_ToUpper)
{
BOOST_CHECK_EQUAL(ToUpper('`'), '`');
BOOST_CHECK_EQUAL(ToUpper('a'), 'A');
BOOST_CHECK_EQUAL(ToUpper('z'), 'Z');
BOOST_CHECK_EQUAL(ToUpper('{'), '{');
BOOST_CHECK_EQUAL(ToUpper(0), 0);
BOOST_CHECK_EQUAL(ToUpper('\xff'), '\xff');
}
BOOST_AUTO_TEST_CASE(test_Capitalize)
{
BOOST_CHECK_EQUAL(Capitalize(""), "");
BOOST_CHECK_EQUAL(Capitalize("readercoin"), "Readercoin");
BOOST_CHECK_EQUAL(Capitalize("\x00\xfe\xff"), "\x00\xfe\xff");
}
BOOST_AUTO_TEST_SUITE_END()
|
; A060681: Largest difference between consecutive divisors of n (ordered by size).
; 0,1,2,2,4,3,6,4,6,5,10,6,12,7,10,8,16,9,18,10,14,11,22,12,20,13,18,14,28,15,30,16,22,17,28,18,36,19,26,20,40,21,42,22,30,23,46,24,42,25,34,26,52,27,44,28,38,29,58,30,60,31,42,32,52,33,66,34,46,35,70,36,72,37,50,38,66,39,78,40,54,41,82,42,68,43,58,44,88,45,78,46,62,47,76,48,96,49,66,50,100,51,102,52,70,53,106,54,108,55,74,56,112,57,92,58,78,59,102,60,110,61,82,62,100,63,126,64,86,65,130,66,114,67,90,68,136,69,138,70,94,71,130,72,116,73,98,74,148,75,150,76,102,77,124,78,156,79,106,80,138,81,162,82,110,83,166,84,156,85,114,86,172,87,140,88,118,89,178,90,180,91,122,92,148,93,170,94,126,95,190,96,192,97,130,98,196,99,198,100,134,101,174,102,164,103,138,104,190,105,210,106,142,107,172,108,186,109,146,110,204,111,222,112,150,113,226,114,228,115,154,116,232,117,188,118,158,119,238,120,240,121,162,122,196,123,228,124,166,125
sub $0,1
mov $1,$0
add $1,1
cal $0,89196 ; Floor(n / (smallest prime factor of n+1)).
sub $0,5
sub $1,$0
sub $1,5
|
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
#include "AsmMacros.h"
TEXTAREA
IMPORT RhpReversePInvokeBadTransition
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpWaitForSuspend -- rare path for RhpPInvoke and RhpReversePInvokeReturn
;;
;;
;; INPUT: none
;;
;; TRASHES: none
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpWaitForSuspend
PROLOG_PUSH {r0-r4,lr} ; Need to save argument registers r0-r3 and lr, r4 is just for alignment
PROLOG_VPUSH {d0-d7} ; Save float argument registers as well since they're volatile
bl RhpWaitForSuspend2
EPILOG_VPOP {d0-d7}
EPILOG_POP {r0-r4,pc}
NESTED_END RhpWaitForSuspend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpWaitForGCNoAbort
;;
;;
;; INPUT: r2: transition frame
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpWaitForGCNoAbort
PROLOG_PUSH {r0-r6,lr} ; Even number of registers to maintain 8-byte stack alignment
PROLOG_VPUSH {d0-d3} ; Save float return value registers as well
ldr r5, [r2, #OFFSETOF__PInvokeTransitionFrame__m_pThread]
ldr r0, [r5, #OFFSETOF__Thread__m_ThreadStateFlags]
tst r0, #TSF_DoNotTriggerGc
bne Done
mov r0, r2 ; passing transition frame in r0
bl RhpWaitForGC2
Done
EPILOG_VPOP {d0-d3}
EPILOG_POP {r0-r6,pc}
NESTED_END RhpWaitForGCNoAbort
EXTERN RhpThrowHwEx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpWaitForGC
;;
;;
;; INPUT: r2: transition frame
;;
;; OUTPUT:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpWaitForGC
PROLOG_PUSH {r0,lr}
ldr r0, =RhpTrapThreads
ldr r0, [r0]
tst r0, #TrapThreadsFlags_TrapThreads
beq NoWait
bl RhpWaitForGCNoAbort
NoWait
tst r0, #TrapThreadsFlags_AbortInProgress
beq NoAbort
ldr r0, [r2, #OFFSETOF__PInvokeTransitionFrame__m_Flags]
tst r0, #PTFF_THREAD_ABORT
beq NoAbort
EPILOG_POP {r0,r1} ; hijack target address as exception PC
EPILOG_NOP mov r0, #STATUS_REDHAWK_THREAD_ABORT
EPILOG_BRANCH RhpThrowHwEx
NoAbort
EPILOG_POP {r0,pc}
NESTED_END RhpWaitForGC
INLINE_GETTHREAD_CONSTANT_POOL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; RhpReversePInvokeAttachOrTrapThread -- rare path for RhpPInvoke
;;
;;
;; INPUT: r4: address of reverse pinvoke frame
;;
;; TRASHES: none
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NESTED_ENTRY RhpReversePInvokeAttachOrTrapThread
PROLOG_PUSH {r0-r4,lr} ; Need to save argument registers r0-r3 and lr, r4 is just for alignment
PROLOG_VPUSH {d0-d7} ; Save float argument registers as well since they're volatile
mov r0, r4 ; passing reverse pinvoke frame pointer in r0
bl RhpReversePInvokeAttachOrTrapThread2
EPILOG_VPOP {d0-d7}
EPILOG_POP {r0-r4,pc}
NESTED_END RhpReversePInvokeTrapThread
end
|
; * = width | BC | D | HL | IXL|IYL | IXH|IYH | Preserves
;----------------------------------------------+-----------+-----+-------------+---------+----------+--------------------------
; draw_tile[_with_mask]_* | cy,cx | | sprite_addr | height | | (IXH, IY)|(IX, IYH), ALL'
; draw_tile[_with_mask]_*_at_addr | dst_addr | | sprite_addr | height | B&~7 | (IXH, IY)|(IX, IYH), ALL'
; draw_preshifted_sprite[_with_mask]_* | cy,cx | dy | sprite_addr | height | | IY|IX, ALL'
; draw_preshifted_sprite[_with_mask]_*_at_addr | dst_addr | dy | sprite_addr | height | B&~7 | IY|IX, ALL'
;----------------------------------------------+-----------+-----+-------------+---------+----------+--------------------------
; where (cx,cy) - character coords and dy - offset inside character (0-7).
; * = width | code size | data size | time (+[dT + [dT]] - time to cross screen 1/3 and 2/3)
;--------------------------------------------+-----------------------+-----------+-------------------------------------------------------
; draw_tile_*_at_addr | 36 + 20*width | | 61 + 36*height + 128*width*height + [29 + [29]]
; draw_tile_* | +14 | | +54
; draw_tile_with_mask_*_at_addr | 36 + 48*width | | 61 + 36*height + 288*width*height + [29 + [29]]
; draw_tile_with_mask_* | +14 | | +54
; draw_preshifted_sprite_*_at_addr | 65 + 20*width + | 16 | 250 + 70*height + 128*width*height + [39 + [39]] +
; | + {16 once for all} + | | + [(5 + height) if width > 5]
; | + [2 if width > 5] | |
; draw_preshifted_sprite_* | +17 | | +66
; draw_preshifted_sprite_with_mask_*_at_addr | 50 + 48*width + | 16 | 205 + 51*height + 288*width*height + [43 + [43]]
; | + {18 once for all} | |
; draw_preshifted_sprite_with_mask_* | +17 | | +66
IFNDEF PRESERVE_IX
DEFINE IZ! IX
DEFINE IZL! IXL
DEFINE IZH! IXH
DEFINE IZ_PREFIX! #DD ; IX opcodes prefix
ELSE
DEFINE IZ! IY
DEFINE IZL! IYL
DEFINE IZH! IYH
DEFINE IZ_PREFIX! #FD ; IY opcodes prefix
ENDIF
; Size = 5
; Time = 32
MACRO _init_tile_read
LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD SP,HL
ENDM
; Size = 2.5*width - 1 + [+/-0.5]
; Time = 16*width - 4 + [+/-5]
MACRO _draw_line_into_HL WIDTH, DIR
.i = 0
DUP WIDTH
IF (.i%2) == ((DIR<0) & (WIDTH%2))
POP DE
LD (HL),E
ELSE
LD (HL),D
ENDIF
IF .i != (WIDTH-1)
if_then_else DIR>0, INC L, DEC L
ENDIF
.i = .i+1
EDUP
ENDM
; Size = 6*width - 1
; Time = 36*width - 4
MACRO _draw_line_with_mask_into_BC WIDTH, DIR
.i = 0
DUP WIDTH
POP DE
LD A,(BC)
AND D
OR E
LD (BC),A
IF .i != (WIDTH-1)
if_then_else DIR>0, INC C, DEC C
ENDIF
.i = .i+1
EDUP
ENDM
; Size = 36 + 20*width
; Time = 61 + 36*height + 128*width*height + [29 + [29]]
MACRO _draw_tile WIDTH
LD (.old_sp),SP
_init_tile_read
LD H,B
LD L,C
LD C,IZL!
CP 0
ORG $-1
.loop
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
DEC C
JR Z,.break
; H -= 7
; L += 32
LD H,B
LD A,L
ADD 32
LD L,A
JP NC,.loop
; H += 8
LD A,H
ADD 8
LD H,A
LD B,H
JP .loop
.break
LD SP,0
.old_sp EQU $-2
RET
ENDM
; Size = 36 + 48*width
; Time = 61 + 36*height + 288*width*height + [29 + [29]]
MACRO _draw_tile_with_mask WIDTH
LD (.old_sp),SP
_init_tile_read
LD H,B
LD A,IZL!
LD L,A
CP 0
ORG $-1
.loop
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
DEC L
JR Z,.break
; B -= 7
; C += 32
LD B,H
LD A,C
ADD 32
LD C,A
JP NC,.loop
; B += 8
LD A,B
ADD 8
LD B,A
LD H,B
JP .loop
.break
LD SP,0
.old_sp EQU $-2
RET
ENDM
; Size = 16
; Time = 29 + [39]
_draw_sprite_HL_next_char
IFUSED
; H -= 7
; L += 32
LD H,C
LD A,L
ADD 32
LD L,A
.exit JP NC,0
.ret_addr EQU $-2
; H += 8
LD A,H
ADD 8
LD H,A
LD C,H
JP .exit
ENDIF
; Size = 18
; Time = 33 + [43]
_draw_sprite_BC_next_char
IFUSED
; B -= 7
; C += 32
LD B,IZH!
LD A,C
ADD 32
LD C,A
.exit JP NC,0
.ret_addr EQU $-2
; B += 8
LD A,B
ADD 8
LD B,A
LD IZH!,B
JP .exit
ENDIF
; Size = 65 + 20*width + [2 if width > 5] + {16 for patch table} + {16 once for all}
; Time = 250 + 70*height + 128*width*height + [(5 + height) if width > 5] + [39 + [39]]
MACRO _draw_preshifted_sprite WIDTH
DEFINE PROC_NAME! draw_preshifted_sprite_WIDTH
LD A,D
ADD A
JP Z,draw_tile_WIDTH_at_addr
LD (.old_sp),SP
_init_tile_read
LD HL,_PROC_NAME!_table ; defined separately
ADD L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD (.restore_addr),HL
LD (HL),IZ_PREFIX!
INC HL
LD (HL),#E9 ; JP (IX|IY)
INC HL
LD (_draw_sprite_HL_next_char.ret_addr),HL
LD H,B
LD L,C
LD B,IZL!
LD C,IZH!
LD IZ!,_draw_sprite_HL_next_char
CP 0
ORG $-1
.loop
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_1 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_2 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_3 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_4 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_5 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_6 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_7 INC H : NOP
_draw_line_into_HL WIDTH, -1
INC H
IF WIDTH <= 5
DJNZ .loop
ELSE
DEC B
JP NZ,.loop
ENDIF
.break
LD HL,#0024 ; INC H : NOP
LD (0),HL
.restore_addr EQU $-2
LD SP,0
.old_sp EQU $-2
RET
UNDEFINE PROC_NAME!
ENDM
; Size = 50 + 48*width + {16 for patch table} + {18 once for all}
; Time = 205 + 51*height + 288*width*height + [43 + [43]]
MACRO _draw_preshifted_sprite_with_mask WIDTH
DEFINE PROC_NAME! draw_preshifted_sprite_with_mask_WIDTH
LD A,D
ADD A
JP Z,draw_tile_with_mask_WIDTH_at_addr
LD (.old_sp),SP
_init_tile_read
LD HL,_PROC_NAME!_table ; defined separately
ADD L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD (.restore_addr),HL
LD (HL),#E9 ; JP (HL)
INC HL
LD (_draw_sprite_BC_next_char.ret_addr),HL
LD HL,_draw_sprite_BC_next_char
CP 0
ORG $-1
.loop
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_1 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_2 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_3 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_4 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_5 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_6 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_7 INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
DEC IZL!
JP NZ,.loop
.break
LD A,#04 ; INC B
LD (0),A
.restore_addr EQU $-2
LD SP,0
.old_sp EQU $-2
RET
UNDEFINE PROC_NAME!
ENDM
MACRO _define_draw_proc TYPE, WIDTH
DEFINE DRAW_PROC_NAME! draw_TYPE_WIDTH
IFUSED DRAW_PROC_NAME!
DRAW_PROC_NAME! _get_TYPE_screen_addr
; fake call to mark label as used
JP DRAW_PROC_NAME!_at_addr
ORG $-3
ENDIF
IFUSED DRAW_PROC_NAME!_at_addr
DRAW_PROC_NAME!_at_addr _draw_TYPE WIDTH
ENDIF
UNDEFINE DRAW_PROC_NAME!
ENDM
DEFINE _get_tile_screen_addr get_screen_char_addr_inline
DEFINE _get_tile_with_mask_screen_addr get_screen_char_addr_inline
DEFINE _get_preshifted_sprite_screen_addr get_screen_byte_addr_inline
DEFINE _get_preshifted_sprite_with_mask_screen_addr get_screen_byte_addr_inline
_i = 1
DUP 32
_define_draw_proc tile, NUMBERS[_i]
_define_draw_proc tile_with_mask, NUMBERS[_i]
_define_draw_proc preshifted_sprite, NUMBERS[_i]
_define_draw_proc preshifted_sprite_with_mask, NUMBERS[_i]
_i = _i + 1
EDUP
UNDEFINE IZ!
UNDEFINE IZL!
UNDEFINE IZH!
UNDEFINE IZ_PREFIX!
|
; A132738: Row sums of triangle A132737.
; 1,2,7,16,33,66,131,260,517,1030,2055,4104,8201,16394,32779,65548,131085,262158,524303,1048592,2097169,4194322,8388627,16777236,33554453,67108886,134217751,268435480,536870937,1073741850,2147483675,4294967324,8589934621,17179869214,34359738399,68719476768,137438953505,274877906978,549755813923,1099511627812,2199023255589,4398046511142,8796093022247,17592186044456,35184372088873,70368744177706,140737488355371,281474976710700,562949953421357,1125899906842670,2251799813685295,4503599627370544,9007199254741041
add $0,1
mov $2,2
pow $2,$0
sub $2,2
add $0,$2
mov $1,$0
sub $1,2
lpb $0,1
add $0,$1
mov $1,1
lpe
|
; A269908: Partial sums of the number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 1", based on the 5-celled von Neumann neighborhood.
; 1,5,6,50,51,167,168,388,389,745,746,1270,1271,1995,1996,2952,2953,4173,4174,5690,5691,7535,7536,9740,9741,12337,12338,15358,15359,18835,18836,22800,22801,27285,27286,32322,32323,37943,37944,44180,44181,51065,51066,58630,58631,66907,66908,75928,75929,85725,85726,96330,96331,107775,107776,120092,120093,133313,133314,147470,147471,162595,162596,178720,178721,195877,195878,214098,214099,233415,233416,253860,253861,275465,275466,298262,298263,322283,322284,347560,347561,374125,374126,402010,402011
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,269906 ; Number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 1", based on the 5-celled von Neumann neighborhood.
add $1,$0
lpe
mov $0,$1
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; SetMem64.Asm
;
; Abstract:
;
; SetMem64 function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; VOID *
; InternalMemSetMem64 (
; IN VOID *Buffer,
; IN UINTN Count,
; IN UINT64 Value
; )
;------------------------------------------------------------------------------
global ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64):
push rdi
mov rdi, rcx
mov rax, r8
xchg rcx, rdx
rep stosq
mov rax, rdx
pop rdi
ret
|
; A092898: Expansion of (1 - 4*x + 4*x^2 - 4*x^3)/(1 - 4*x).
; 1,0,4,12,48,192,768,3072,12288,49152,196608,786432,3145728,12582912,50331648,201326592,805306368,3221225472,12884901888,51539607552,206158430208,824633720832,3298534883328,13194139533312,52776558133248
mov $4,$0
mov $6,2
lpb $6,1
mov $0,$4
sub $6,1
add $0,$6
trn $0,2
mov $2,$6
mov $3,$0
mul $3,2
mov $5,2
trn $5,$3
cmp $5,0
mov $7,2
pow $7,$3
add $5,$7
mov $7,$5
lpb $2,1
mov $1,$7
sub $2,1
lpe
lpe
lpb $4,1
sub $1,$7
mov $4,0
lpe
|
Total: 5.45s
ROUTINE ======================== main.(*Graph).buildAdjList
600ms 1.90s (flat, cum) 34.86% of Total
. . 10ca6a0: MOVQ GS:0x30, CX ;graph.go:102
. . 10ca6a9: LEAQ -0x60(SP), AX
. . 10ca6ae: CMPQ 0x10(CX), AX
. . 10ca6b2: JBE 0x10cab5e
. . 10ca6b8: SUBQ $0xe0, SP
. . 10ca6bf: MOVQ BP, 0xd8(SP)
. . 10ca6c7: LEAQ 0xd8(SP), BP
. . 10ca6cf: XORL AX, AX
. . 10ca6d1: XORL CX, CX
. . 10ca6d3: JMP 0x10ca97f ;graph.go:104
. . 10ca6d8: MOVQ 0x88(SP), R10 ;graph.go:110
. . 10ca6e0: LEAQ 0x1(R10), R9
. . 10ca6e4: MOVQ 0x78(SP), R10
. . 10ca6e9: MOVQ 0x70(SP), R11
. . 10ca6ee: MOVQ 0x98(SP), R12
. . 10ca6f6: MOVQ 0x68(SP), R13
. . 10ca6fb: MOVQ 0xc0(SP), R14
. . 10ca703: MOVQ R10, AX
10ms 10ms 10ca706: MOVQ 0x50(SP), CX ;main.(*Graph).buildAdjList graph.go:107
. . 10ca70b: MOVQ R11, DX ;graph.go:111
. . 10ca70e: MOVQ 0xe8(SP), BX
. . 10ca716: MOVQ R12, SI
. . 10ca719: MOVQ R13, DI
. . 10ca71c: MOVQ R14, R8 ;graph.go:110
. . 10ca71f: CMPQ AX, R9
. . 10ca722: JGE 0x10ca976
450ms 450ms 10ca728: MOVQ 0(R8)(R9*8), R10 ;main.(*Graph).buildAdjList graph.go:110
20ms 20ms 10ca72c: MOVQ 0x8(BX), R11 ;main.(*Graph).buildAdjList graph.go:111
. . 10ca730: MOVQ 0(BX), R12 ;graph.go:111
. . 10ca733: CMPQ R11, R10
. . 10ca736: JAE 0x10cab52
. . 10ca73c: MOVQ R9, 0x88(SP) ;graph.go:110
. . 10ca744: MOVQ R10, 0x58(SP)
. . 10ca749: LEAQ 0(R10)(R10*2), AX ;graph.go:111
. . 10ca74d: MOVQ AX, 0x80(SP)
. . 10ca755: MOVQ 0(R12)(AX*8), CX
90ms 90ms 10ca759: MOVQ 0x10(R12)(AX*8), BX ;main.(*Graph).buildAdjList graph.go:111
20ms 20ms 10ca75e: MOVQ 0x8(R12)(AX*8), R8
. . 10ca763: MOVQ SI, 0(SP) ;graph.go:111
. . 10ca767: MOVQ DI, 0x8(SP)
. . 10ca76c: MOVQ DX, 0x10(SP)
. . 10ca771: MOVQ CX, 0x18(SP)
. . 10ca776: MOVQ R8, 0x20(SP)
. . 10ca77b: MOVQ BX, 0x28(SP)
. 120ms 10ca780: CALL main.distance(SB) ;main.(*Graph).buildAdjList graph.go:111
. . 10ca785: CMPQ $0x1, 0x30(SP) ;graph.go:111
. . 10ca78b: JNE 0x10ca95c
. . 10ca791: MOVQ 0xe8(SP), DX ;graph.go:112
. . 10ca799: MOVQ 0x18(DX), BX
. . 10ca79d: MOVQ 0x20(DX), CX
. . 10ca7a1: MOVQ 0x60(SP), AX
. . 10ca7a6: CMPQ CX, AX
. . 10ca7a9: JAE 0x10cab4d
. . 10ca7af: MOVQ 0x90(SP), SI
. . 10ca7b7: MOVQ 0x10(BX)(SI*8), DI
. . 10ca7bc: MOVQ 0x8(BX)(SI*8), R8
. . 10ca7c1: MOVQ 0(BX)(SI*8), R9
. . 10ca7c5: LEAQ 0x1(R8), R10
. . 10ca7c9: LEAQ 0(BX)(SI*8), R11
. . 10ca7cd: CMPQ DI, R10
. . 10ca7d0: JA 0x10ca8c5
. . 10ca7d6: LEAQ 0x1(R8), DI
. . 10ca7da: MOVQ DI, 0x8(BX)(SI*8)
. . 10ca7df: MOVQ 0x58(SP), BX
. . 10ca7e4: MOVQ BX, 0(R9)(R8*8)
10ms 10ms 10ca7e8: MOVQ 0x20(DX), CX ;main.(*Graph).buildAdjList graph.go:113
. . 10ca7ec: MOVQ 0x18(DX), DI ;graph.go:113
. . 10ca7f0: CMPQ CX, BX
. . 10ca7f3: JAE 0x10cab45
. . 10ca7f9: MOVQ 0x80(SP), BX
. . 10ca801: MOVQ 0(DI)(BX*8), R8
. . 10ca805: MOVQ 0x10(DI)(BX*8), R9
. . 10ca80a: MOVQ 0x8(DI)(BX*8), R10
. . 10ca80f: LEAQ 0x1(R10), R11
. . 10ca813: LEAQ 0(DI)(BX*8), R12
. . 10ca817: CMPQ R9, R11
. . 10ca81a: JA 0x10ca82e
. . 10ca81c: LEAQ 0x1(R10), R9
. . 10ca820: MOVQ R9, 0x8(DI)(BX*8)
. . 10ca825: MOVQ AX, 0(R8)(R10*8)
. . 10ca829: JMP 0x10ca6d8
. . 10ca82e: MOVQ R12, 0xb8(SP)
. . 10ca836: MOVQ DI, 0xb0(SP)
. . 10ca83e: LEAQ runtime.types+86176(SB), AX
. . 10ca845: MOVQ AX, 0(SP)
. . 10ca849: MOVQ R8, 0x8(SP)
. . 10ca84e: MOVQ R10, 0x10(SP)
. . 10ca853: MOVQ R9, 0x18(SP)
. . 10ca858: MOVQ R11, 0x20(SP)
. 140ms 10ca85d: CALL runtime.growslice(SB) ;main.(*Graph).buildAdjList graph.go:113
. . 10ca862: MOVQ 0x28(SP), AX ;graph.go:113
. . 10ca867: MOVQ 0x30(SP), CX
. . 10ca86c: MOVQ 0x38(SP), DX
. . 10ca871: MOVQ 0x80(SP), BX
. . 10ca879: MOVQ 0xb0(SP), SI
. . 10ca881: MOVQ DX, 0x10(SI)(BX*8)
. . 10ca886: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca88d: JNE 0x10ca8b6
. . 10ca88f: MOVQ AX, 0(SI)(BX*8)
. . 10ca893: MOVQ 0xe8(SP), DX ;graph.go:111
. . 10ca89b: MOVQ SI, DI ;graph.go:113
. . 10ca89e: MOVQ CX, R10
. . 10ca8a1: MOVQ AX, R8
. . 10ca8a4: MOVQ 0x60(SP), AX
. . 10ca8a9: MOVQ 0x90(SP), SI ;graph.go:112
. . 10ca8b1: JMP 0x10ca81c ;graph.go:113
. . 10ca8b6: MOVQ 0xb8(SP), DI
. . 10ca8be: CALL runtime.gcWriteBarrier(SB)
. . 10ca8c3: JMP 0x10ca893
. . 10ca8c5: MOVQ BX, 0xa8(SP) ;graph.go:112
. . 10ca8cd: MOVQ R11, 0xa0(SP)
. . 10ca8d5: LEAQ runtime.types+86176(SB), AX
. . 10ca8dc: MOVQ AX, 0(SP)
. . 10ca8e0: MOVQ R9, 0x8(SP)
. . 10ca8e5: MOVQ R8, 0x10(SP)
. . 10ca8ea: MOVQ DI, 0x18(SP)
. . 10ca8ef: MOVQ R10, 0x20(SP)
. 210ms 10ca8f4: CALL runtime.growslice(SB) ;main.(*Graph).buildAdjList graph.go:112
. . 10ca8f9: MOVQ 0x28(SP), AX ;graph.go:112
. . 10ca8fe: MOVQ 0x30(SP), CX
. . 10ca903: MOVQ 0x38(SP), DX
. . 10ca908: MOVQ 0x90(SP), BX
. . 10ca910: MOVQ 0xa8(SP), SI
. . 10ca918: MOVQ DX, 0x10(SI)(BX*8)
. . 10ca91d: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca924: JNE 0x10ca94d
. . 10ca926: MOVQ AX, 0(SI)(BX*8)
. . 10ca92a: MOVQ 0xe8(SP), DX ;graph.go:113
. . 10ca932: MOVQ SI, BX ;graph.go:112
. . 10ca935: MOVQ 0x90(SP), SI
. . 10ca93d: MOVQ CX, R8
. . 10ca940: MOVQ AX, R9
. . 10ca943: MOVQ 0x60(SP), AX ;graph.go:113
. . 10ca948: JMP 0x10ca7d6 ;graph.go:112
. . 10ca94d: MOVQ 0xa0(SP), DI
. . 10ca955: CALL runtime.gcWriteBarrier(SB)
. . 10ca95a: JMP 0x10ca92a
. . 10ca95c: MOVQ 0x60(SP), AX ;graph.go:104
. . 10ca961: MOVQ 0xe8(SP), DX ;graph.go:111
. . 10ca969: MOVQ 0x90(SP), SI ;graph.go:112
. . 10ca971: JMP 0x10ca6d8 ;graph.go:110
. . 10ca976: MOVQ 0x60(SP), DX ;graph.go:104
. . 10ca97b: LEAQ 0x1(DX), AX
. . 10ca97f: MOVQ 0xe8(SP), DX
. . 10ca987: MOVQ 0x8(DX), BX
. . 10ca98b: MOVQ 0(DX), SI
. . 10ca98e: CMPQ BX, AX
. . 10ca991: JGE 0x10caaa0
. . 10ca997: MOVQ AX, 0x60(SP)
. . 10ca99c: MOVQ CX, 0x50(SP) ;graph.go:107
. . 10ca9a1: LEAQ 0(AX)(AX*2), CX ;graph.go:105
. . 10ca9a5: MOVQ CX, 0x90(SP)
. . 10ca9ad: MOVQ 0x10(SI)(CX*8), DX
. . 10ca9b2: MOVQ DX, 0x70(SP)
. . 10ca9b7: MOVQ 0x8(SI)(CX*8), BX
. . 10ca9bc: MOVQ BX, 0x68(SP)
. . 10ca9c1: MOVQ 0(SI)(CX*8), SI
. . 10ca9c5: MOVQ SI, 0x98(SP)
. . 10ca9cd: MOVQ 0xf0(SP), DI ;graph.go:106
. . 10ca9d5: MOVQ DI, 0(SP)
. . 10ca9d9: MOVQ SI, 0x8(SP)
. . 10ca9de: MOVQ BX, 0x10(SP)
. . 10ca9e3: MOVQ DX, 0x18(SP)
. 140ms 10ca9e8: CALL main.(*index).nearCount(SB) ;main.(*Graph).buildAdjList graph.go:106
. . 10ca9ed: MOVQ 0x20(SP), AX ;graph.go:106
. . 10ca9f2: MOVQ AX, 0x78(SP)
. . 10ca9f7: LEAQ runtime.types+86176(SB), CX ;graph.go:108
. . 10ca9fe: MOVQ CX, 0(SP)
. . 10caa02: MOVQ AX, 0x8(SP)
. . 10caa07: MOVQ AX, 0x10(SP)
. 170ms 10caa0c: CALL runtime.makeslice(SB) ;main.(*Graph).buildAdjList graph.go:108
. . 10caa11: MOVQ 0x18(SP), AX ;graph.go:108
. . 10caa16: MOVQ AX, 0xc0(SP)
. . 10caa1e: MOVQ 0xf0(SP), CX ;graph.go:109
. . 10caa26: MOVQ CX, 0(SP)
. . 10caa2a: MOVQ 0x98(SP), DX
. . 10caa32: MOVQ DX, 0x8(SP)
. . 10caa37: MOVQ 0x68(SP), BX
. . 10caa3c: MOVQ BX, 0x10(SP)
. . 10caa41: MOVQ 0x70(SP), SI
. . 10caa46: MOVQ SI, 0x18(SP)
. . 10caa4b: MOVQ AX, 0x20(SP)
. . 10caa50: MOVQ 0x78(SP), DI
. . 10caa55: MOVQ DI, 0x28(SP)
. . 10caa5a: MOVQ DI, 0x30(SP)
. 520ms 10caa5f: CALL main.(*index).near(SB) ;main.(*Graph).buildAdjList graph.go:109
. . 10caa64: MOVQ 0x78(SP), AX ;graph.go:107
. . 10caa69: MOVQ 0x50(SP), CX
. . 10caa6e: ADDQ AX, CX
. . 10caa71: MOVQ CX, 0x50(SP)
. . 10caa76: MOVQ 0x70(SP), DX ;graph.go:110
. . 10caa7b: MOVQ 0xe8(SP), BX
. . 10caa83: MOVQ 0x98(SP), SI
. . 10caa8b: MOVQ 0x68(SP), DI
. . 10caa90: MOVQ 0xc0(SP), R8
. . 10caa98: XORL R9, R9
. . 10caa9b: JMP 0x10ca71f
. . 10caaa0: XORPS X0, X0 ;graph.go:117
. . 10caaa3: CVTSI2SDQ CX, X0
. . 10caaa8: XORPS X1, X1
. . 10caaab: CVTSI2SDQ BX, X1
. . 10caab0: DIVSD X1, X0
. . 10caab4: MOVSD_XMM X0, 0(SP)
. . 10caab9: CALL runtime.convT64(SB)
. . 10caabe: MOVQ 0x8(SP), AX
. . 10caac3: XORPS X0, X0
. . 10caac6: MOVUPS X0, 0xc8(SP)
. . 10caace: LEAQ runtime.types+84448(SB), CX
. . 10caad5: MOVQ CX, 0xc8(SP)
. . 10caadd: MOVQ AX, 0xd0(SP)
. . 10caae5: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10caaec: LEAQ go.itab.*os.File,io.Writer(SB), CX
. . 10caaf3: MOVQ CX, 0(SP)
. . 10caaf7: MOVQ AX, 0x8(SP)
. . 10caafc: LEAQ go.string.*+3298(SB), AX
. . 10cab03: MOVQ AX, 0x10(SP)
. . 10cab08: MOVQ $0xa, 0x18(SP)
. . 10cab11: LEAQ 0xc8(SP), AX
. . 10cab19: MOVQ AX, 0x20(SP)
. . 10cab1e: MOVQ $0x1, 0x28(SP)
. . 10cab27: MOVQ $0x1, 0x30(SP)
. . 10cab30: CALL fmt.Fprintf(SB)
. . 10cab35: MOVQ 0xd8(SP), BP
. . 10cab3d: ADDQ $0xe0, SP
. . 10cab44: RET
. . 10cab45: MOVQ BX, AX ;graph.go:113
. . 10cab48: CALL runtime.panicIndex(SB)
. . 10cab4d: CALL runtime.panicIndex(SB) ;graph.go:112
. . 10cab52: MOVQ R10, AX ;graph.go:111
. . 10cab55: MOVQ R11, CX
. . 10cab58: CALL runtime.panicIndex(SB)
. . 10cab5d: NOPL
. . 10cab5e: CALL runtime.morestack_noctxt(SB) ;graph.go:102
. . 10cab63: JMP main.(*Graph).buildAdjList(SB)
. . 10cab68: INT $0x3
. . 10cab69: INT $0x3
. . 10cab6a: INT $0x3
. . 10cab6b: INT $0x3
. . 10cab6c: INT $0x3
. . 10cab6d: INT $0x3
. . 10cab6e: INT $0x3
ROUTINE ======================== main.(*index).add
40ms 490ms (flat, cum) 8.99% of Total
. . 10cc260: MOVQ GS:0x30, CX ;index.go:35
. . 10cc269: LEAQ -0x18(SP), AX
. . 10cc26e: CMPQ 0x10(CX), AX
. . 10cc272: JBE 0x10cc566
. . 10cc278: SUBQ $0x98, SP
. . 10cc27f: MOVQ BP, 0x90(SP)
. . 10cc287: LEAQ 0x90(SP), BP
. . 10cc28f: MOVQ 0xa0(SP), BX ;index.go:38
. . 10cc297: MOVQ 0x38(BX), DX
. . 10cc29b: MOVQ 0x28(BX), SI
. . 10cc29f: MOVQ 0xb8(SP), DI
. . 10cc2a7: LEAQ -0x1(DI), CX
. . 10cc2ab: CMPQ DX, CX
. . 10cc2ae: JA 0x10cc560
. . 10cc2b4: MOVQ CX, 0x58(SP)
. . 10cc2b9: MOVQ DX, 0x50(SP)
. . 10cc2be: MOVQ SI, 0x78(SP)
. . 10cc2c3: MOVQ 0xb0(SP), R8 ;index.go:39
. . 10cc2cb: XORL AX, AX
. . 10cc2cd: JMP 0x10cc322
. . 10cc2cf: LEAQ 0x1(R8), R10 ;index.go:45
. . 10cc2d3: MOVQ R10, 0x8(BX)(SI*8)
. . 10cc2d8: MOVQ 0xa8(SP), R10
. . 10cc2e0: MOVQ R10, 0(R9)(R8*8)
. . 10cc2e4: MOVQ 0x78(SP), R9 ;index.go:39
. . 10cc2e9: MOVQ 0x50(SP), R11
. . 10cc2ee: MOVQ 0x58(SP), R12
. . 10cc2f3: MOVQ 0xb8(SP), R13
. . 10cc2fb: MOVQ 0xb0(SP), R14
. . 10cc303: MOVQ 0x68(SP), R15
. . 10cc308: MOVQ R12, CX ;index.go:129
. . 10cc30b: MOVQ R11, DX ;index.go:128
. . 10cc30e: MOVQ 0xa0(SP), BX ;index.go:42
. . 10cc316: MOVQ R9, SI ;index.go:129
. . 10cc319: MOVQ R13, DI ;index.go:39
. . 10cc31c: MOVQ R14, R8 ;index.go:130
. . 10cc31f: MOVQ R15, AX ;index.go:39
. . 10cc322: CMPQ DI, AX
. . 10cc325: JGE 0x10cc533
. . 10cc32b: NOPL ;index.go:40
. . 10cc32c: CMPQ DX, AX ;index.go:128
. . 10cc32f: JA 0x10cc558
. . 10cc335: CMPQ CX, AX ;index.go:129
. . 10cc338: JA 0x10cc553
. . 10cc33e: MOVQ AX, 0x48(SP) ;index.go:39
. . 10cc343: SUBQ AX, CX ;index.go:129
. . 10cc346: MOVQ CX, 0x40(SP)
. . 10cc34b: SUBQ AX, DX
. . 10cc34e: NEGQ DX
. . 10cc351: SARQ $0x3f, DX
. . 10cc355: ANDQ AX, DX
. . 10cc358: ADDQ SI, DX
. . 10cc35b: MOVQ DX, 0x70(SP)
. . 10cc360: CMPQ R8, SI ;index.go:130
. . 10cc363: JE 0x10cc378
. . 10cc365: MOVQ SI, 0(SP)
. . 10cc369: MOVQ R8, 0x8(SP)
. . 10cc36e: MOVQ AX, 0x10(SP)
. . 10cc373: CALL runtime.memmove(SB)
. . 10cc378: MOVQ 0x48(SP), AX ;index.go:131
. . 10cc37d: INCQ AX
. . 10cc380: MOVQ AX, 0x68(SP)
. . 10cc385: MOVQ 0xb8(SP), CX
. . 10cc38d: SUBQ AX, CX
. . 10cc390: MOVQ 0x40(SP), BX
. . 10cc395: CMPQ CX, BX
. . 10cc398: CMOVG CX, BX
. . 10cc39c: MOVQ 0xc0(SP), CX
. . 10cc3a4: SUBQ AX, CX
. . 10cc3a7: NEGQ CX
. . 10cc3aa: SARQ $0x3f, CX
. . 10cc3ae: ANDQ AX, CX
. . 10cc3b1: MOVQ 0xb0(SP), DI
. . 10cc3b9: ADDQ DI, CX
. . 10cc3bc: MOVQ 0x70(SP), R8
. . 10cc3c1: CMPQ R8, CX
. . 10cc3c4: JNE 0x10cc51b
. . 10cc3ca: MOVQ 0xa0(SP), AX ;index.go:42
. . 10cc3d2: MOVQ 0(AX), CX
. . 10cc3d5: MOVQ 0x8(AX), DX
. . 10cc3d9: MOVQ 0x20(CX), CX
. . 10cc3dd: MOVQ DX, 0(SP)
. . 10cc3e1: CALL CX
. . 10cc3e3: MOVQ 0xa0(SP), AX ;index.go:43
. . 10cc3eb: MOVQ 0(AX), CX
. . 10cc3ee: MOVQ 0x8(AX), DX
. . 10cc3f2: MOVQ 0x40(CX), CX
. . 10cc3f6: MOVQ DX, 0(SP)
. . 10cc3fa: MOVQ 0x78(SP), DX
. . 10cc3ff: MOVQ DX, 0x8(SP)
. . 10cc404: MOVQ 0x58(SP), BX
. . 10cc409: MOVQ BX, 0x10(SP)
. . 10cc40e: MOVQ 0x50(SP), SI
. . 10cc413: MOVQ SI, 0x18(SP)
. . 10cc418: CALL CX
. . 10cc41a: MOVQ 0xa0(SP), AX ;index.go:44
. . 10cc422: MOVQ 0(AX), CX
. . 10cc425: MOVQ 0x8(AX), DX
. . 10cc429: MOVQ 0x38(CX), CX
. . 10cc42d: MOVQ DX, 0(SP)
. . 10cc431: CALL CX
. . 10cc433: MOVQ 0x8(SP), AX
. . 10cc438: MOVQ 0xa0(SP), CX
. . 10cc440: MOVQ 0x40(CX), DX
. . 10cc444: TESTQ DX, DX
. . 10cc447: JE 0x10cc54e
. . 10cc44d: MOVQ DX, BX
. . 10cc450: XORL DX, DX
. . 10cc452: DIVQ BX
. . 10cc455: MOVQ 0x10(CX), BX ;index.go:45
. . 10cc459: MOVQ 0x18(CX), SI
. . 10cc45d: CMPQ SI, DX
. . 10cc460: JAE 0x10cc543
. . 10cc466: LEAQ 0(DX)(DX*2), SI
. . 10cc46a: MOVQ 0x10(BX)(SI*8), DI
40ms 40ms 10cc46f: MOVQ 0x8(BX)(SI*8), R8 ;main.(*index).add index.go:45
. . 10cc474: MOVQ 0(BX)(SI*8), R9 ;index.go:45
. . 10cc478: LEAQ 0x1(R8), R10
. . 10cc47c: LEAQ 0(BX)(SI*8), R11
. . 10cc480: CMPQ DI, R10
. . 10cc483: JBE 0x10cc2cf
. . 10cc489: MOVQ BX, 0x88(SP)
. . 10cc491: MOVQ SI, 0x60(SP)
. . 10cc496: MOVQ R11, 0x80(SP)
. . 10cc49e: LEAQ runtime.types+86176(SB), AX
. . 10cc4a5: MOVQ AX, 0(SP)
. . 10cc4a9: MOVQ R9, 0x8(SP)
. . 10cc4ae: MOVQ R8, 0x10(SP)
. . 10cc4b3: MOVQ DI, 0x18(SP)
. . 10cc4b8: MOVQ R10, 0x20(SP)
. 450ms 10cc4bd: CALL runtime.growslice(SB) ;main.(*index).add index.go:45
. . 10cc4c2: MOVQ 0x28(SP), AX ;index.go:45
. . 10cc4c7: MOVQ 0x30(SP), CX
. . 10cc4cc: MOVQ 0x38(SP), DX
. . 10cc4d1: MOVQ 0x60(SP), BX
. . 10cc4d6: MOVQ 0x88(SP), SI
. . 10cc4de: MOVQ DX, 0x10(SI)(BX*8)
. . 10cc4e3: CMPL $0x0, runtime.writeBarrier(SB)
. . 10cc4ea: JNE 0x10cc50c
. . 10cc4ec: MOVQ AX, 0(SI)(BX*8)
. . 10cc4f0: MOVQ CX, R8
. . 10cc4f3: MOVQ AX, R9
. . 10cc4f6: MOVQ 0xa0(SP), CX ;index.go:42
. . 10cc4fe: MOVQ BX, DX ;index.go:45
. . 10cc501: MOVQ SI, BX
. . 10cc504: MOVQ DX, SI
. . 10cc507: JMP 0x10cc2cf
. . 10cc50c: MOVQ 0x80(SP), DI
. . 10cc514: CALL runtime.gcWriteBarrier(SB)
. . 10cc519: JMP 0x10cc4f0
. . 10cc51b: MOVQ R8, 0(SP) ;index.go:131
. . 10cc51f: MOVQ CX, 0x8(SP)
. . 10cc524: MOVQ BX, 0x10(SP)
. . 10cc529: CALL runtime.memmove(SB)
. . 10cc52e: JMP 0x10cc3ca
. . 10cc533: MOVQ 0x90(SP), BP
. . 10cc53b: ADDQ $0x98, SP
. . 10cc542: RET
. . 10cc543: MOVQ DX, AX ;index.go:45
. . 10cc546: MOVQ SI, CX
. . 10cc549: CALL runtime.panicIndexU(SB)
. . 10cc54e: CALL runtime.panicdivide(SB) ;index.go:44
. . 10cc553: CALL runtime.panicSliceB(SB) ;index.go:129
. . 10cc558: MOVQ AX, CX ;index.go:128
. . 10cc55b: CALL runtime.panicSliceAcap(SB)
. . 10cc560: CALL runtime.panicSliceAcap(SB) ;index.go:38
. . 10cc565: NOPL
. . 10cc566: CALL runtime.morestack_noctxt(SB) ;index.go:35
. . 10cc56b: ?
. . 10cc56c: LOCK CLD
. . 10cc56e: ?
ROUTINE ======================== main.(*index).near
30ms 530ms (flat, cum) 9.72% of Total
. . 10cc900: MOVQ GS:0x30, CX ;index.go:101
. . 10cc909: LEAQ 0xfffffe70(SP), AX
. . 10cc911: CMPQ 0x10(CX), AX
. . 10cc915: JBE 0x10ccd3a
. . 10cc91b: SUBQ $0x210, SP
. . 10cc922: MOVQ BP, 0x208(SP)
. . 10cc92a: LEAQ 0x208(SP), BP
. . 10cc932: LEAQ 0x78(SP), DI ;index.go:102
. . 10cc937: XORPS X0, X0
. . 10cc93a: MOVQ BP, -0x10(SP)
. . 10cc93f: LEAQ -0x10(SP), BP
. . 10cc944: CALL 0x105866e
. . 10cc949: MOVQ 0(BP), BP
. . 10cc94d: MOVQ 0x228(SP), AX ;index.go:103
. . 10cc955: LEAQ 0x1(AX), CX
. . 10cc959: CMPQ $0x30, CX
. . 10cc95d: JA 0x10ccd2f
. . 10cc963: MOVQ CX, 0x60(SP)
. . 10cc968: MOVQ 0x218(SP), AX ;index.go:104
. . 10cc970: MOVQ 0(AX), CX
. . 10cc973: MOVQ 0x8(AX), DX
. . 10cc977: MOVQ 0x20(CX), CX
. . 10cc97b: MOVQ DX, 0(SP)
. 20ms 10cc97f: CALL CX ;main.(*index).near index.go:104
. . 10cc981: MOVQ 0x218(SP), AX ;index.go:105
. . 10cc989: MOVQ 0(AX), CX
. . 10cc98c: MOVQ 0x8(AX), DX
. . 10cc990: MOVQ 0x40(CX), CX
. . 10cc994: MOVQ DX, 0(SP)
. . 10cc998: MOVQ 0x220(SP), DX
. . 10cc9a0: MOVQ DX, 0x8(SP)
. . 10cc9a5: MOVQ 0x228(SP), BX
. . 10cc9ad: MOVQ BX, 0x10(SP)
. . 10cc9b2: MOVQ 0x230(SP), SI
. . 10cc9ba: MOVQ SI, 0x18(SP)
. . 10cc9bf: CALL CX
. . 10cc9c1: MOVQ 0x218(SP), AX ;index.go:106
. . 10cc9c9: MOVQ 0(AX), CX
. . 10cc9cc: MOVQ 0x8(AX), DX
. . 10cc9d0: MOVQ 0x38(CX), CX
. . 10cc9d4: MOVQ DX, 0(SP)
. 10ms 10cc9d8: CALL CX ;main.(*index).near index.go:106
. . 10cc9da: MOVQ 0x8(SP), AX ;index.go:106
. . 10cc9df: MOVQ 0x218(SP), CX
. . 10cc9e7: MOVQ 0x40(CX), DX
. . 10cc9eb: TESTQ DX, DX
. . 10cc9ee: JE 0x10ccd2a
. . 10cc9f4: MOVQ DX, BX
. . 10cc9f7: XORL DX, DX
. . 10cc9f9: DIVQ BX
. . 10cc9fc: MOVQ 0x60(SP), BX
. . 10cca01: TESTQ BX, BX
. . 10cca04: JBE 0x10ccd20
. . 10cca0a: MOVQ DX, 0x78(SP)
. . 10cca0f: MOVQ 0x28(CX), SI ;index.go:107
. . 10cca13: MOVQ 0x38(CX), DX
. . 10cca17: MOVQ 0x228(SP), DI
. . 10cca1f: LEAQ -0x1(DI), R8
. . 10cca23: CMPQ DX, R8
. . 10cca26: JA 0x10ccd18
. . 10cca2c: MOVQ R8, 0x68(SP)
. . 10cca31: MOVQ SI, 0x200(SP)
. . 10cca39: MOVQ DX, 0x48(SP)
. . 10cca3e: MOVQ 0x220(SP), R9 ;index.go:108
. . 10cca46: XORL AX, AX
. . 10cca48: JMP 0x10cca8a
. . 10cca4a: MOVQ AX, R10 ;index.go:113
. . 10cca4d: SHLQ $0x3, AX
. . 10cca51: MOVQ DX, 0x78(SP)(AX*1)
. . 10cca56: MOVQ 0x228(SP), R11 ;index.go:108
. . 10cca5e: MOVQ 0x200(SP), R12
. . 10cca66: MOVQ 0x48(SP), R13
. . 10cca6b: MOVQ 0x68(SP), R14
. . 10cca70: MOVQ 0x220(SP), R15
. . 10cca78: MOVQ R13, DX ;index.go:128
. . 10cca7b: MOVQ R12, SI ;index.go:129
. . 10cca7e: MOVQ R11, DI ;index.go:108
. . 10cca81: MOVQ R14, R8 ;index.go:129
. . 10cca84: MOVQ R15, R9 ;index.go:130
. . 10cca87: MOVQ R10, AX ;index.go:108
. . 10cca8a: CMPQ DI, AX
. . 10cca8d: JGE 0x10ccbf6
. 10ms 10cca93: NOPL ;main.(*index).near index.go:109
. . 10cca94: CMPQ DX, AX ;index.go:128
. . 10cca97: JA 0x10ccd10
. . 10cca9d: CMPQ R8, AX ;index.go:129
. . 10ccaa0: JA 0x10ccd08
. . 10ccaa6: MOVQ AX, 0x40(SP) ;index.go:108
. . 10ccaab: SUBQ AX, R8 ;index.go:129
. . 10ccaae: MOVQ R8, 0x38(SP)
. . 10ccab3: SUBQ AX, DX
. . 10ccab6: NEGQ DX
. . 10ccab9: SARQ $0x3f, DX
. . 10ccabd: ANDQ AX, DX
. . 10ccac0: ADDQ SI, DX
. . 10ccac3: MOVQ DX, 0x1f8(SP)
. . 10ccacb: CMPQ R9, SI ;index.go:130
. . 10ccace: JE 0x10ccae3
. . 10ccad0: MOVQ SI, 0(SP)
. . 10ccad4: MOVQ R9, 0x8(SP)
. . 10ccad9: MOVQ AX, 0x10(SP)
. . 10ccade: CALL runtime.memmove(SB)
. . 10ccae3: MOVQ 0x40(SP), AX ;index.go:131
. . 10ccae8: INCQ AX
. . 10ccaeb: MOVQ AX, 0x70(SP)
. . 10ccaf0: MOVQ 0x228(SP), CX
. . 10ccaf8: SUBQ AX, CX
. . 10ccafb: MOVQ 0x38(SP), BX
. . 10ccb00: CMPQ CX, BX
. . 10ccb03: CMOVG CX, BX
. . 10ccb07: MOVQ 0x230(SP), CX
. . 10ccb0f: SUBQ AX, CX
. . 10ccb12: NEGQ CX
. . 10ccb15: SARQ $0x3f, CX
. . 10ccb19: ANDQ AX, CX
. . 10ccb1c: MOVQ 0x220(SP), DI
. . 10ccb24: ADDQ DI, CX
. . 10ccb27: MOVQ 0x1f8(SP), R8
. . 10ccb2f: CMPQ R8, CX
. . 10ccb32: JNE 0x10ccbde
. . 10ccb38: MOVQ 0x218(SP), AX ;index.go:111
. . 10ccb40: MOVQ 0(AX), CX
. . 10ccb43: MOVQ 0x8(AX), DX
. . 10ccb47: MOVQ 0x20(CX), CX
. . 10ccb4b: MOVQ DX, 0(SP)
. . 10ccb4f: CALL CX
. . 10ccb51: MOVQ 0x218(SP), AX ;index.go:112
. . 10ccb59: MOVQ 0(AX), CX
. . 10ccb5c: MOVQ 0x8(AX), DX
. . 10ccb60: MOVQ 0x40(CX), CX
. . 10ccb64: MOVQ DX, 0(SP)
. . 10ccb68: MOVQ 0x200(SP), DX
. . 10ccb70: MOVQ DX, 0x8(SP)
. . 10ccb75: MOVQ 0x68(SP), BX
. . 10ccb7a: MOVQ BX, 0x10(SP)
. . 10ccb7f: MOVQ 0x48(SP), SI
. . 10ccb84: MOVQ SI, 0x18(SP)
. 10ms 10ccb89: CALL CX ;main.(*index).near index.go:112
. . 10ccb8b: MOVQ 0x218(SP), AX ;index.go:113
. . 10ccb93: MOVQ 0(AX), CX
. . 10ccb96: MOVQ 0x8(AX), DX
. . 10ccb9a: MOVQ 0x38(CX), CX
. . 10ccb9e: MOVQ DX, 0(SP)
. 40ms 10ccba2: CALL CX ;main.(*index).near index.go:113
. . 10ccba4: MOVQ 0x8(SP), AX ;index.go:113
. . 10ccba9: MOVQ 0x218(SP), CX
. . 10ccbb1: MOVQ 0x40(CX), DX
. . 10ccbb5: TESTQ DX, DX
. . 10ccbb8: JE 0x10ccd03
. . 10ccbbe: MOVQ DX, BX
. . 10ccbc1: XORL DX, DX
. . 10ccbc3: DIVQ BX
10ms 10ms 10ccbc6: MOVQ 0x70(SP), AX ;main.(*index).near index.go:113
. . 10ccbcb: MOVQ 0x60(SP), BX ;index.go:113
. . 10ccbd0: CMPQ BX, AX
. . 10ccbd3: JB 0x10cca4a
. . 10ccbd9: JMP 0x10cccfb
. . 10ccbde: MOVQ R8, 0(SP) ;index.go:131
10ms 10ms 10ccbe2: MOVQ CX, 0x8(SP) ;main.skipOneCopy index.go:131
. . 10ccbe7: MOVQ BX, 0x10(SP) ;index.go:131
. . 10ccbec: CALL runtime.memmove(SB)
. . 10ccbf1: JMP 0x10ccb38
. . 10ccbf6: MOVQ 0x248(SP), DX ;index.go:117
. . 10ccbfe: MOVQ 0x240(SP), SI
. . 10ccc06: MOVQ 0x238(SP), DI
. . 10ccc0e: XORL AX, AX
. . 10ccc10: XORL R8, R8
. . 10ccc13: JMP 0x10ccc21
. . 10ccc15: INCQ AX
. . 10ccc18: MOVQ R11, DX ;index.go:121
. . 10ccc1b: MOVQ SI, R8
. . 10ccc1e: MOVQ R10, SI
. . 10ccc21: CMPQ BX, AX ;index.go:117
. . 10ccc24: JGE 0x10cccd5
. . 10ccc2a: MOVQ 0x78(SP)(AX*8), R9 ;index.go:118
. . 10ccc2f: MOVQ 0x10(CX), R10 ;index.go:119
. . 10ccc33: MOVQ 0x18(CX), R11
. . 10ccc37: CMPQ R11, R9
. . 10ccc3a: JAE 0x10cccf0
. . 10ccc40: LEAQ 0(R9)(R9*2), R9
. . 10ccc44: MOVQ 0x8(R10)(R9*8), R11
. . 10ccc49: MOVQ 0(R10)(R9*8), R9
10ms 10ms 10ccc4d: CMPQ SI, R8 ;main.(*index).near index.go:121
. . 10ccc50: JA 0x10ccce5 ;index.go:121
. . 10ccc56: MOVQ SI, R10
. . 10ccc59: SUBQ R8, SI
. . 10ccc5c: CMPQ R11, SI
. . 10ccc5f: CMOVG R11, SI
. . 10ccc63: MOVQ DX, R11
. . 10ccc66: SUBQ R8, DX
. . 10ccc69: NEGQ DX
. . 10ccc6c: SHLQ $0x3, R8
. . 10ccc70: SARQ $0x3f, DX
. . 10ccc74: ANDQ DX, R8
. . 10ccc77: LEAQ 0(DI)(R8*1), DX
. . 10ccc7b: CMPQ R9, DX
. . 10ccc7e: JE 0x10ccc15
. . 10ccc80: MOVQ AX, 0x58(SP) ;index.go:117
. . 10ccc85: MOVQ SI, 0x50(SP) ;index.go:121
. . 10ccc8a: MOVQ DX, 0(SP)
. . 10ccc8e: MOVQ R9, 0x8(SP)
. . 10ccc93: SHLQ $0x3, SI
. . 10ccc97: MOVQ SI, 0x10(SP)
. 410ms 10ccc9c: CALL runtime.memmove(SB) ;main.(*index).near index.go:121
. . 10ccca1: MOVQ 0x58(SP), AX ;index.go:117
. . 10ccca6: MOVQ 0x218(SP), CX ;index.go:119
. . 10cccae: MOVQ 0x60(SP), BX ;index.go:117
. . 10cccb3: MOVQ 0x50(SP), SI ;index.go:121
. . 10cccb8: MOVQ 0x238(SP), DI
. . 10cccc0: MOVQ 0x240(SP), R10
. . 10cccc8: MOVQ 0x248(SP), R11
. . 10cccd0: JMP 0x10ccc15
. . 10cccd5: MOVQ 0x208(SP), BP
. . 10cccdd: ADDQ $0x210, SP
. . 10ccce4: RET
. . 10ccce5: MOVQ R8, AX
. . 10ccce8: MOVQ SI, CX
. . 10ccceb: CALL runtime.panicSliceB(SB)
. . 10cccf0: MOVQ R9, AX ;index.go:119
. . 10cccf3: MOVQ R11, CX
. . 10cccf6: CALL runtime.panicIndexU(SB)
. . 10cccfb: MOVQ BX, CX ;index.go:113
. . 10cccfe: CALL runtime.panicIndex(SB)
. . 10ccd03: CALL runtime.panicdivide(SB)
. . 10ccd08: MOVQ R8, CX ;index.go:129
. . 10ccd0b: CALL runtime.panicSliceB(SB)
. . 10ccd10: MOVQ AX, CX ;index.go:128
. . 10ccd13: CALL runtime.panicSliceAcap(SB)
. . 10ccd18: MOVQ R8, CX ;index.go:107
. . 10ccd1b: CALL runtime.panicSliceAcap(SB)
. . 10ccd20: XORL AX, AX ;index.go:106
. . 10ccd22: MOVQ BX, CX
. . 10ccd25: CALL runtime.panicIndex(SB)
. . 10ccd2a: CALL runtime.panicdivide(SB)
. . 10ccd2f: MOVL $0x30, DX ;index.go:103
. . 10ccd34: CALL runtime.panicSliceAlen(SB)
. . 10ccd39: NOPL
. . 10ccd3a: CALL runtime.morestack_noctxt(SB) ;index.go:101
. . 10ccd3f: JMP main.(*index).near(SB)
. . 10ccd44: INT $0x3
. . 10ccd45: INT $0x3
. . 10ccd46: INT $0x3
. . 10ccd47: INT $0x3
. . 10ccd48: INT $0x3
. . 10ccd49: INT $0x3
. . 10ccd4a: INT $0x3
. . 10ccd4b: INT $0x3
. . 10ccd4c: INT $0x3
. . 10ccd4d: INT $0x3
. . 10ccd4e: INT $0x3
ROUTINE ======================== main.(*index).nearCount
80ms 140ms (flat, cum) 2.57% of Total
. . 10cc570: MOVQ GS:0x30, CX ;index.go:63
. . 10cc579: LEAQ 0xfffffe80(SP), AX
. . 10cc581: CMPQ 0x10(CX), AX
. . 10cc585: JBE 0x10cc8f3
. . 10cc58b: SUBQ $0x200, SP
. . 10cc592: MOVQ BP, 0x1f8(SP)
. . 10cc59a: LEAQ 0x1f8(SP), BP
. . 10cc5a2: LEAQ 0x68(SP), DI ;index.go:64
. . 10cc5a7: XORPS X0, X0
. . 10cc5aa: MOVQ BP, -0x10(SP)
. . 10cc5af: LEAQ -0x10(SP), BP
. . 10cc5b4: CALL 0x105866e
. . 10cc5b9: MOVQ 0(BP), BP
. . 10cc5bd: MOVQ 0x218(SP), AX ;index.go:65
. . 10cc5c5: LEAQ 0x1(AX), CX
. . 10cc5c9: CMPQ $0x30, CX
. . 10cc5cd: JA 0x10cc8e8
. . 10cc5d3: MOVQ CX, 0x50(SP)
. . 10cc5d8: MOVQ 0x208(SP), AX ;index.go:66
. . 10cc5e0: MOVQ 0(AX), CX
. . 10cc5e3: MOVQ 0x8(AX), DX
. . 10cc5e7: MOVQ 0x20(CX), CX
. . 10cc5eb: MOVQ DX, 0(SP)
. . 10cc5ef: CALL CX
. . 10cc5f1: MOVQ 0x208(SP), AX ;index.go:67
. . 10cc5f9: MOVQ 0(AX), CX
. . 10cc5fc: MOVQ 0x8(AX), DX
. . 10cc600: MOVQ 0x40(CX), CX
. . 10cc604: MOVQ DX, 0(SP)
. . 10cc608: MOVQ 0x210(SP), DX
. . 10cc610: MOVQ DX, 0x8(SP)
. . 10cc615: MOVQ 0x218(SP), BX
. . 10cc61d: MOVQ BX, 0x10(SP)
. . 10cc622: MOVQ 0x220(SP), SI
. . 10cc62a: MOVQ SI, 0x18(SP)
. 10ms 10cc62f: CALL CX ;main.(*index).nearCount index.go:67
. . 10cc631: MOVQ 0x208(SP), AX ;index.go:68
. . 10cc639: MOVQ 0(AX), CX
. . 10cc63c: MOVQ 0x8(AX), DX
. . 10cc640: MOVQ 0x38(CX), CX
. . 10cc644: MOVQ DX, 0(SP)
. . 10cc648: CALL CX
. . 10cc64a: MOVQ 0x8(SP), AX
. . 10cc64f: MOVQ 0x208(SP), CX
. . 10cc657: MOVQ 0x40(CX), DX
. . 10cc65b: TESTQ DX, DX
. . 10cc65e: JE 0x10cc8e3
. . 10cc664: MOVQ DX, BX
. . 10cc667: XORL DX, DX
. . 10cc669: DIVQ BX
. . 10cc66c: MOVQ 0x50(SP), BX
. . 10cc671: TESTQ BX, BX
. . 10cc674: JBE 0x10cc8d9
. . 10cc67a: MOVQ DX, 0x68(SP)
. . 10cc67f: MOVQ 0x38(CX), DX ;index.go:69
. . 10cc683: MOVQ 0x28(CX), SI
. . 10cc687: MOVQ 0x218(SP), DI
. . 10cc68f: LEAQ -0x1(DI), R8
. . 10cc693: CMPQ DX, R8
. . 10cc696: JA 0x10cc8d1
. . 10cc69c: MOVQ R8, 0x58(SP)
. . 10cc6a1: MOVQ DX, 0x48(SP)
. . 10cc6a6: MOVQ SI, 0x1f0(SP)
. . 10cc6ae: MOVQ 0x210(SP), R9 ;index.go:70
. . 10cc6b6: XORL AX, AX
. . 10cc6b8: JMP 0x10cc6fa
. . 10cc6ba: MOVQ AX, R10 ;index.go:75
. . 10cc6bd: SHLQ $0x3, AX
. . 10cc6c1: MOVQ DX, 0x68(SP)(AX*1)
. . 10cc6c6: MOVQ 0x218(SP), R11 ;index.go:70
. . 10cc6ce: MOVQ 0x1f0(SP), R12
. . 10cc6d6: MOVQ 0x48(SP), R13
. . 10cc6db: MOVQ 0x58(SP), R14
. . 10cc6e0: MOVQ 0x210(SP), R15
. . 10cc6e8: MOVQ R13, DX ;index.go:128
. . 10cc6eb: MOVQ R12, SI ;index.go:129
. . 10cc6ee: MOVQ R11, DI ;index.go:70
. . 10cc6f1: MOVQ R14, R8 ;index.go:129
. . 10cc6f4: MOVQ R15, R9 ;index.go:130
. . 10cc6f7: MOVQ R10, AX ;index.go:70
. . 10cc6fa: CMPQ DI, AX
. . 10cc6fd: JGE 0x10cc863
. . 10cc703: NOPL ;index.go:71
. . 10cc704: CMPQ DX, AX ;index.go:128
. . 10cc707: JA 0x10cc8c9
. . 10cc70d: CMPQ R8, AX ;index.go:129
. . 10cc710: JA 0x10cc8c1
. . 10cc716: MOVQ AX, 0x40(SP) ;index.go:70
. . 10cc71b: SUBQ AX, R8 ;index.go:129
. . 10cc71e: MOVQ R8, 0x38(SP)
. . 10cc723: SUBQ AX, DX
. . 10cc726: NEGQ DX
. . 10cc729: SARQ $0x3f, DX
. . 10cc72d: ANDQ AX, DX
. . 10cc730: ADDQ SI, DX
. . 10cc733: MOVQ DX, 0x1e8(SP)
. . 10cc73b: CMPQ R9, SI ;index.go:130
. . 10cc73e: JE 0x10cc753
. . 10cc740: MOVQ SI, 0(SP)
. . 10cc744: MOVQ R9, 0x8(SP)
. . 10cc749: MOVQ AX, 0x10(SP)
. . 10cc74e: CALL runtime.memmove(SB)
. . 10cc753: MOVQ 0x40(SP), AX ;index.go:131
. . 10cc758: INCQ AX
. . 10cc75b: MOVQ AX, 0x60(SP)
. . 10cc760: MOVQ 0x218(SP), CX
. . 10cc768: SUBQ AX, CX
. . 10cc76b: MOVQ 0x38(SP), BX
. . 10cc770: CMPQ CX, BX
. . 10cc773: CMOVG CX, BX
. . 10cc777: MOVQ 0x220(SP), CX
. . 10cc77f: SUBQ AX, CX
. . 10cc782: NEGQ CX
. . 10cc785: SARQ $0x3f, CX
. . 10cc789: ANDQ AX, CX
. . 10cc78c: MOVQ 0x210(SP), DI
. . 10cc794: ADDQ DI, CX
. . 10cc797: MOVQ 0x1e8(SP), R8
. . 10cc79f: CMPQ R8, CX
. . 10cc7a2: JNE 0x10cc84b
. . 10cc7a8: MOVQ 0x208(SP), AX ;index.go:73
. . 10cc7b0: MOVQ 0(AX), CX
. . 10cc7b3: MOVQ 0x8(AX), DX
. . 10cc7b7: MOVQ 0x20(CX), CX
. . 10cc7bb: MOVQ DX, 0(SP)
. 10ms 10cc7bf: CALL CX ;main.(*index).nearCount index.go:73
. . 10cc7c1: MOVQ 0x208(SP), AX ;index.go:74
. . 10cc7c9: MOVQ 0(AX), CX
. . 10cc7cc: MOVQ 0x8(AX), DX
. . 10cc7d0: MOVQ 0x40(CX), CX
. . 10cc7d4: MOVQ DX, 0(SP)
10ms 10ms 10cc7d8: MOVQ 0x1f0(SP), DX ;main.(*index).nearCount index.go:74
. . 10cc7e0: MOVQ DX, 0x8(SP) ;index.go:74
. . 10cc7e5: MOVQ 0x58(SP), BX
. . 10cc7ea: MOVQ BX, 0x10(SP)
. . 10cc7ef: MOVQ 0x48(SP), SI
. . 10cc7f4: MOVQ SI, 0x18(SP)
. 30ms 10cc7f9: CALL CX ;main.(*index).nearCount index.go:74
. . 10cc7fb: MOVQ 0x208(SP), AX ;index.go:75
. . 10cc803: MOVQ 0(AX), CX
. . 10cc806: MOVQ 0x8(AX), DX
. . 10cc80a: MOVQ 0x38(CX), CX
. . 10cc80e: MOVQ DX, 0(SP)
. 10ms 10cc812: CALL CX ;main.(*index).nearCount index.go:75
. . 10cc814: MOVQ 0x8(SP), AX ;index.go:75
. . 10cc819: MOVQ 0x208(SP), CX
. . 10cc821: MOVQ 0x40(CX), DX
. . 10cc825: TESTQ DX, DX
. . 10cc828: JE 0x10cc8bc
. . 10cc82e: MOVQ DX, BX
. . 10cc831: XORL DX, DX
. . 10cc833: DIVQ BX
10ms 10ms 10cc836: MOVQ 0x60(SP), AX ;main.(*index).nearCount index.go:75
. . 10cc83b: MOVQ 0x50(SP), BX ;index.go:75
. . 10cc840: CMPQ BX, AX
. . 10cc843: JB 0x10cc6ba
. . 10cc849: JMP 0x10cc8b4
. . 10cc84b: MOVQ R8, 0(SP) ;index.go:131
. . 10cc84f: MOVQ CX, 0x8(SP)
. . 10cc854: MOVQ BX, 0x10(SP)
. . 10cc859: CALL runtime.memmove(SB)
. . 10cc85e: JMP 0x10cc7a8
. . 10cc863: XORL AX, AX
. . 10cc865: XORL DX, DX
. . 10cc867: JMP 0x10cc878 ;index.go:79
. . 10cc869: INCQ AX
. . 10cc86c: LEAQ 0(R8)(R8*2), SI ;index.go:80
. . 10cc870: MOVQ 0x8(DI)(SI*8), SI
60ms 60ms 10cc875: ADDQ SI, DX ;main.(*index).nearCount index.go:81
. . 10cc878: CMPQ BX, AX ;index.go:79
. . 10cc87b: JGE 0x10cc891
. . 10cc87d: MOVQ 0x18(CX), SI ;index.go:80
. . 10cc881: MOVQ 0x10(CX), DI
. . 10cc885: MOVQ 0x68(SP)(AX*8), R8
. . 10cc88a: CMPQ SI, R8
. . 10cc88d: JB 0x10cc869
. . 10cc88f: JMP 0x10cc8a9
. . 10cc891: MOVQ DX, 0x228(SP) ;index.go:84
. . 10cc899: MOVQ 0x1f8(SP), BP
. . 10cc8a1: ADDQ $0x200, SP
. . 10cc8a8: RET
. . 10cc8a9: MOVQ R8, AX ;index.go:80
. . 10cc8ac: MOVQ SI, CX
. . 10cc8af: CALL runtime.panicIndexU(SB)
. . 10cc8b4: MOVQ BX, CX ;index.go:75
. . 10cc8b7: CALL runtime.panicIndex(SB)
. . 10cc8bc: CALL runtime.panicdivide(SB)
. . 10cc8c1: MOVQ R8, CX ;index.go:129
. . 10cc8c4: CALL runtime.panicSliceB(SB)
. . 10cc8c9: MOVQ AX, CX ;index.go:128
. . 10cc8cc: CALL runtime.panicSliceAcap(SB)
. . 10cc8d1: MOVQ R8, CX ;index.go:69
. . 10cc8d4: CALL runtime.panicSliceAcap(SB)
. . 10cc8d9: XORL AX, AX ;index.go:68
. . 10cc8db: MOVQ BX, CX
. . 10cc8de: CALL runtime.panicIndex(SB)
. . 10cc8e3: CALL runtime.panicdivide(SB)
. . 10cc8e8: MOVL $0x30, DX ;index.go:65
. . 10cc8ed: CALL runtime.panicSliceAlen(SB)
. . 10cc8f2: NOPL
. . 10cc8f3: CALL runtime.morestack_noctxt(SB) ;index.go:63
. . 10cc8f8: JMP main.(*index).nearCount(SB)
. . 10cc8fd: INT $0x3
. . 10cc8fe: INT $0x3
ROUTINE ======================== main.LoadDictionary
30ms 2.63s (flat, cum) 48.26% of Total
. . 10c9e10: MOVQ GS:0x30, CX ;graph.go:39
. . 10c9e19: LEAQ 0xfffffec0(SP), AX
. . 10c9e21: CMPQ 0x10(CX), AX
. . 10c9e25: JBE 0x10ca691
. . 10c9e2b: SUBQ $0x1c0, SP
. . 10c9e32: MOVQ BP, 0x1b8(SP)
. . 10c9e3a: LEAQ 0x1b8(SP), BP
. . 10c9e42: MOVQ $0x0, 0x1f8(SP)
. . 10c9e4e: NOPL ;graph.go:40
. . 10c9e4f: MOVQ 0x1d8(SP), AX ;stats.go:42
. . 10c9e57: MOVQ AX, 0(SP)
. . 10c9e5b: CALL runtime.convT64(SB)
. . 10c9e60: MOVQ main.stats+8(SB), AX
. . 10c9e67: MOVQ main.stats(SB), CX
. . 10c9e6e: LEAQ 0x1(AX), DX
. . 10c9e72: MOVQ main.stats+16(SB), BX
. . 10c9e79: MOVQ 0x8(SP), SI
. . 10c9e7e: CMPQ BX, DX
. . 10c9e81: JA 0x10ca612
. . 10c9e87: LEAQ 0x1(AX), DX
. . 10c9e8b: MOVQ DX, main.stats+8(SB)
. . 10c9e92: SHLQ $0x5, AX
. . 10c9e96: MOVQ $0xb, 0x8(CX)(AX*1)
. . 10c9e9f: LEAQ go.itab.main.intStat,main.statValue(SB), DX
. . 10c9ea6: MOVQ DX, 0x10(CX)(AX*1)
. . 10c9eab: LEAQ 0(CX)(AX*1), DI
. . 10c9eaf: LEAQ 0(CX)(AX*1), DX
. . 10c9eb3: LEAQ 0x18(DX), DX
. . 10c9eb7: CMPL $0x0, runtime.writeBarrier(SB)
. . 10c9ebe: JNE 0x10ca5f6
. . 10c9ec4: LEAQ go.string.*+3958(SB), DX
. . 10c9ecb: MOVQ DX, 0(CX)(AX*1)
. . 10c9ecf: MOVQ SI, 0x18(CX)(AX*1)
. . 10c9ed4: LEAQ go.string.*+6121(SB), AX ;graph.go:41
. . 10c9edb: MOVQ AX, 0(SP)
. . 10c9edf: MOVQ $0xe, 0x8(SP)
. . 10c9ee8: CALL main.newTimer(SB)
. . 10c9eed: MOVQ 0x10(SP), AX
. . 10c9ef2: MOVL $0x0, 0x68(SP)
. . 10c9efa: MOVQ AX, 0x80(SP)
. . 10c9f02: LEAQ 0x68(SP), AX
. . 10c9f07: MOVQ AX, 0(SP)
. . 10c9f0b: CALL runtime.deferprocStack(SB)
. . 10c9f10: TESTL AX, AX
. . 10c9f12: JNE 0x10ca5e0
. . 10c9f18: NOPL ;graph.go:42
. . 10c9f19: MOVQ 0x1c8(SP), AX ;file.go:280
. . 10c9f21: MOVQ AX, 0(SP)
. . 10c9f25: MOVQ 0x1d0(SP), AX
. . 10c9f2d: MOVQ AX, 0x8(SP)
. . 10c9f32: MOVQ $0x0, 0x10(SP)
. . 10c9f3b: MOVL $0x0, 0x18(SP)
. . 10c9f43: CALL os.OpenFile(SB)
. . 10c9f48: MOVQ 0x20(SP), AX
. . 10c9f4d: MOVQ AX, 0x118(SP)
. . 10c9f55: MOVQ 0x30(SP), CX
. . 10c9f5a: MOVQ 0x28(SP), DX
. . 10c9f5f: TESTQ DX, DX ;graph.go:43
. . 10c9f62: JE 0x10c9fa8
. . 10c9f64: JE 0x10c9f6a ;graph.go:44
. . 10c9f66: MOVQ 0x8(DX), DX
. . 10c9f6a: XORPS X0, X0
. . 10c9f6d: MOVUPS X0, 0x128(SP)
. . 10c9f75: MOVQ DX, 0x128(SP)
. . 10c9f7d: MOVQ CX, 0x130(SP)
. . 10c9f85: LEAQ 0x128(SP), AX
. . 10c9f8d: MOVQ AX, 0(SP)
. . 10c9f91: MOVQ $0x1, 0x8(SP)
. . 10c9f9a: MOVQ $0x1, 0x10(SP)
. . 10c9fa3: CALL log.Fatal(SB)
. . 10c9fa8: MOVL $0x18, 0xa0(SP) ;graph.go:46
. . 10c9fb3: LEAQ go.func.*+300(SB), AX
. . 10c9fba: MOVQ AX, 0xb8(SP)
. . 10c9fc2: MOVQ 0x118(SP), AX
. . 10c9fca: MOVQ AX, 0xd0(SP)
. . 10c9fd2: LEAQ 0xa0(SP), CX
. . 10c9fda: MOVQ CX, 0(SP)
. . 10c9fde: CALL runtime.deferprocStack(SB)
. . 10c9fe3: TESTL AX, AX
. . 10c9fe5: JNE 0x10ca5ca
. . 10c9feb: LEAQ runtime.types+158240(SB), AX ;graph.go:48
. . 10c9ff2: MOVQ AX, 0(SP)
. . 10c9ff6: CALL runtime.newobject(SB)
. . 10c9ffb: MOVQ 0x8(SP), AX
. . 10ca000: MOVQ AX, 0x120(SP)
. . 10ca008: LEAQ runtime.types+142368(SB), CX ;graph.go:49
. . 10ca00f: MOVQ CX, 0(SP)
. . 10ca013: XORPS X0, X0
. . 10ca016: MOVUPS X0, 0x8(SP)
. . 10ca01b: CALL runtime.makeslice(SB)
. . 10ca020: MOVQ 0x18(SP), AX
. . 10ca025: CMPL $0x0, runtime.writeBarrier(SB) ;graph.go:48
. . 10ca02c: JNE 0x10ca585
. . 10ca032: XORPS X0, X0
. . 10ca035: MOVQ 0x120(SP), CX
. . 10ca03d: MOVUPS X0, 0(CX)
. . 10ca040: MOVUPS X0, 0x10(CX)
. . 10ca044: MOVUPS X0, 0x20(CX)
. . 10ca048: MOVQ AX, 0(CX)
. . 10ca04b: NOPL ;graph.go:54
. . 10ca04c: LEAQ 0x138(SP), DI ;scan.go:87
. . 10ca054: MOVQ BP, -0x10(SP)
. . 10ca059: LEAQ -0x10(SP), BP
. . 10ca05e: CALL 0x10586ba
. . 10ca063: MOVQ 0(BP), BP
. . 10ca067: LEAQ 0x138(SP), DI
. . 10ca06f: MOVQ BP, -0x10(SP)
. . 10ca074: LEAQ -0x10(SP), BP
. . 10ca079: CALL 0x10586ba
. . 10ca07e: MOVQ 0(BP), BP
. . 10ca082: LEAQ go.itab.*os.File,io.Reader(SB), AX
. . 10ca089: MOVQ AX, 0x138(SP)
. . 10ca091: MOVQ 0x118(SP), AX
. . 10ca099: MOVQ AX, 0x140(SP)
. . 10ca0a1: LEAQ go.func.*+4(SB), AX
. . 10ca0a8: MOVQ AX, 0x148(SP)
. . 10ca0b0: MOVQ $0x10000, 0x150(SP)
. . 10ca0bc: XORL AX, AX
. . 10ca0be: JMP 0x10ca0c3 ;graph.go:55
. . 10ca0c0: MOVQ SI, AX ;graph.go:75
. . 10ca0c3: MOVQ AX, 0x48(SP)
. . 10ca0c8: LEAQ 0x138(SP), CX ;graph.go:55
. . 10ca0d0: MOVQ CX, 0(SP)
. . 10ca0d4: CALL bufio.(*Scanner).Scan(SB)
. . 10ca0d9: CMPB $0x0, 0x8(SP)
. . 10ca0de: JE 0x10ca221
. . 10ca0e4: NOPL ;graph.go:56
. . 10ca0e5: MOVQ 0x160(SP), AX ;scan.go:106
. . 10ca0ed: MOVQ AX, 0x40(SP)
. . 10ca0f2: MOVQ 0x158(SP), CX
. . 10ca0fa: MOVQ CX, 0x100(SP)
. . 10ca102: LEAQ runtime.types+89184(SB), DX ;graph.go:57
. . 10ca109: MOVQ DX, 0(SP)
. . 10ca10d: MOVQ AX, 0x8(SP)
. . 10ca112: MOVQ AX, 0x10(SP)
. . 10ca117: CALL runtime.makeslice(SB)
. . 10ca11c: MOVQ 0x18(SP), AX
. . 10ca121: MOVQ AX, 0x110(SP)
. . 10ca129: MOVQ 0x100(SP), CX ;graph.go:58
. . 10ca131: CMPQ CX, AX
. . 10ca134: JE 0x10ca14e
. . 10ca136: MOVQ AX, 0(SP)
. . 10ca13a: MOVQ CX, 0x8(SP)
. . 10ca13f: MOVQ 0x40(SP), CX
. . 10ca144: MOVQ CX, 0x10(SP)
. . 10ca149: CALL runtime.memmove(SB)
. . 10ca14e: MOVQ 0x120(SP), CX ;graph.go:59
. . 10ca156: MOVQ 0x10(CX), DX
. . 10ca15a: MOVQ 0x8(CX), BX
. . 10ca15e: LEAQ 0x1(BX), SI
. . 10ca162: MOVQ 0(CX), R8
. . 10ca165: CMPQ DX, SI
. . 10ca168: JA 0x10ca1c1
. . 10ca16a: LEAQ 0x1(BX), DX
. . 10ca16e: MOVQ DX, 0x8(CX)
. . 10ca172: LEAQ 0(BX)(BX*2), DX
. . 10ca176: MOVQ 0x40(SP), BX
20ms 20ms 10ca17b: MOVQ BX, 0x8(R8)(DX*8) ;main.LoadDictionary graph.go:59
10ms 10ms 10ca180: MOVQ BX, 0x10(R8)(DX*8)
. . 10ca185: MOVQ 0x48(SP), SI ;graph.go:60
. . 10ca18a: CMPQ SI, BX
. . 10ca18d: CMOVG BX, SI ;graph.go:75
. . 10ca191: LEAQ 0(R8)(DX*8), DI ;graph.go:59
. . 10ca195: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca19c: JNE 0x10ca1af
. . 10ca19e: MOVQ 0x110(SP), AX
. . 10ca1a6: MOVQ AX, 0(R8)(DX*8)
. . 10ca1aa: JMP 0x10ca0c0
. . 10ca1af: MOVQ 0x110(SP), AX
. . 10ca1b7: CALL runtime.gcWriteBarrier(SB)
. . 10ca1bc: JMP 0x10ca0c0
. . 10ca1c1: LEAQ runtime.types+142368(SB), AX
. . 10ca1c8: MOVQ AX, 0(SP)
. . 10ca1cc: MOVQ R8, 0x8(SP)
. . 10ca1d1: MOVQ BX, 0x10(SP)
. . 10ca1d6: MOVQ DX, 0x18(SP)
. . 10ca1db: MOVQ SI, 0x20(SP)
. 80ms 10ca1e0: CALL runtime.growslice(SB) ;main.LoadDictionary graph.go:59
. . 10ca1e5: MOVQ 0x28(SP), AX ;graph.go:59
. . 10ca1ea: MOVQ 0x30(SP), CX
. . 10ca1ef: MOVQ 0x38(SP), DX
. . 10ca1f4: MOVQ 0x120(SP), DI
. . 10ca1fc: MOVQ DX, 0x10(DI)
. . 10ca200: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca207: JNE 0x10ca21a
. . 10ca209: MOVQ AX, 0(DI)
. . 10ca20c: MOVQ CX, BX
. . 10ca20f: MOVQ AX, R8
. . 10ca212: MOVQ DI, CX
. . 10ca215: JMP 0x10ca16a
. . 10ca21a: CALL runtime.gcWriteBarrier(SB)
. . 10ca21f: JMP 0x10ca20c
. . 10ca221: MOVQ 0x1f0(SP), AX ;graph.go:65
. . 10ca229: TESTQ AX, AX
. . 10ca22c: JNE 0x10ca527
. . 10ca232: MOVQ 0x120(SP), AX ;graph.go:69
. . 10ca23a: MOVQ 0x8(AX), CX
. . 10ca23e: MOVQ CX, 0x60(SP)
. . 10ca243: LEAQ runtime.types+77472(SB), DX
. . 10ca24a: MOVQ DX, 0(SP)
. . 10ca24e: MOVQ CX, 0x8(SP)
. . 10ca253: MOVQ CX, 0x10(SP)
. 10ms 10ca258: CALL runtime.makeslice(SB) ;main.LoadDictionary graph.go:69
. . 10ca25d: MOVQ 0x18(SP), AX ;graph.go:69
. . 10ca262: MOVQ 0x60(SP), CX
. . 10ca267: MOVQ 0x120(SP), DX
. . 10ca26f: MOVQ CX, 0x20(DX)
. . 10ca273: MOVQ CX, 0x28(DX)
. . 10ca277: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca27e: JNE 0x10ca519
. . 10ca284: MOVQ AX, 0x18(DX)
. . 10ca288: XORL AX, AX
. . 10ca28a: JMP 0x10ca29b ;graph.go:70
. . 10ca28c: LEAQ 0x1(SI), BX
. . 10ca290: MOVQ 0x60(SP), CX
. . 10ca295: MOVQ AX, DX ;graph.go:71
. . 10ca298: MOVQ BX, AX ;graph.go:70
. . 10ca29b: CMPQ CX, AX
. . 10ca29e: JGE 0x10ca31c
. . 10ca2a0: MOVQ AX, 0x58(SP)
. . 10ca2a5: LEAQ runtime.types+86176(SB), AX ;graph.go:71
. . 10ca2ac: MOVQ AX, 0(SP)
. . 10ca2b0: XORPS X0, X0
. . 10ca2b3: MOVUPS X0, 0x8(SP)
. . 10ca2b8: CALL runtime.makeslice(SB)
. . 10ca2bd: MOVQ 0x120(SP), AX
. . 10ca2c5: MOVQ 0x20(AX), CX
. . 10ca2c9: MOVQ 0x18(AX), DX
. . 10ca2cd: MOVQ 0x18(SP), BX
. . 10ca2d2: MOVQ 0x58(SP), SI
. . 10ca2d7: CMPQ CX, SI
. . 10ca2da: JAE 0x10ca688
. . 10ca2e0: LEAQ 0(SI)(SI*2), CX
. . 10ca2e4: MOVQ $0x0, 0x8(DX)(CX*8)
. . 10ca2ed: MOVQ $0x0, 0x10(DX)(CX*8)
. . 10ca2f6: LEAQ 0(DX)(CX*8), DI
. . 10ca2fa: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca301: JNE 0x10ca309
. . 10ca303: MOVQ BX, 0(DX)(CX*8)
. . 10ca307: JMP 0x10ca28c
. . 10ca309: MOVQ AX, CX ;graph.go:48
. . 10ca30c: MOVQ BX, AX ;graph.go:71
. 10ms 10ca30f: CALL runtime.gcWriteBarrier(SB) ;main.LoadDictionary graph.go:71
. . 10ca314: MOVQ CX, AX ;graph.go:71
. . 10ca317: JMP 0x10ca28c
. . 10ca31c: LEAQ go.string.*+3468(SB), AX ;graph.go:74
. . 10ca323: MOVQ AX, 0(SP)
. . 10ca327: MOVQ $0xa, 0x8(SP)
. . 10ca330: CALL main.newTimer(SB)
. . 10ca335: MOVQ 0x10(SP), AX
. . 10ca33a: MOVQ AX, 0xe8(SP)
. . 10ca342: MOVQ 0x1d8(SP), CX ;graph.go:75
. . 10ca34a: MOVQ CX, 0(SP)
. . 10ca34e: MOVQ 0x48(SP), CX
. . 10ca353: MOVQ CX, 0x8(SP)
. 110ms 10ca358: CALL main.newIndex(SB) ;main.LoadDictionary graph.go:75
. . 10ca35d: MOVQ 0x10(SP), AX ;graph.go:75
. . 10ca362: MOVQ AX, 0xf8(SP)
. . 10ca36a: MOVQ 0x120(SP), CX ;graph.go:76
. . 10ca372: MOVQ 0x8(CX), DX
. . 10ca376: MOVQ 0(CX), BX
. . 10ca379: TESTQ DX, DX
. . 10ca37c: JLE 0x10ca3e5
. . 10ca37e: MOVQ DX, 0x60(SP)
. . 10ca383: XORL SI, SI
. . 10ca385: JMP 0x10ca39e
. . 10ca387: MOVQ 0x108(SP), DX
. . 10ca38f: LEAQ 0x18(DX), BX
. . 10ca393: MOVQ AX, SI
. . 10ca396: MOVQ 0xf8(SP), AX ;graph.go:77
. . 10ca39e: MOVQ BX, 0x108(SP) ;graph.go:76
. . 10ca3a6: MOVQ SI, 0x50(SP)
. . 10ca3ab: MOVQ 0x8(BX), CX
. . 10ca3af: MOVQ 0(BX), DX
. . 10ca3b2: MOVQ 0x10(BX), DI
. . 10ca3b6: MOVQ AX, 0(SP) ;graph.go:77
. . 10ca3ba: MOVQ SI, 0x8(SP)
. . 10ca3bf: MOVQ DX, 0x10(SP)
. . 10ca3c4: MOVQ CX, 0x18(SP)
. . 10ca3c9: MOVQ DI, 0x20(SP)
. 490ms 10ca3ce: CALL main.(*index).add(SB) ;main.LoadDictionary graph.go:77
. . 10ca3d3: MOVQ 0x50(SP), AX ;graph.go:76
. . 10ca3d8: INCQ AX
. . 10ca3db: MOVQ 0x60(SP), CX
. . 10ca3e0: CMPQ CX, AX
. . 10ca3e3: JL 0x10ca387
. . 10ca3e5: MOVQ 0xe8(SP), DX ;graph.go:79
. . 10ca3ed: MOVQ 0(DX), AX
. . 10ca3f0: CALL AX
. . 10ca3f2: MOVZX 0x1e0(SP), AX ;graph.go:39
. . 10ca3fa: TESTL AL, AL
. . 10ca3fc: JNE 0x10ca503 ;graph.go:81
. . 10ca402: LEAQ go.string.*+4830(SB), AX ;graph.go:87
. . 10ca409: MOVQ AX, 0(SP)
. . 10ca40d: MOVQ $0xc, 0x8(SP)
. . 10ca416: CALL main.newTimer(SB)
. . 10ca41b: MOVQ 0x10(SP), AX
. . 10ca420: MOVQ AX, 0xf0(SP)
. . 10ca428: MOVQ 0x120(SP), CX ;graph.go:88
. . 10ca430: MOVQ CX, 0(SP)
. . 10ca434: MOVQ 0xf8(SP), DX
. . 10ca43c: MOVQ DX, 0x8(SP)
. 1.90s 10ca441: CALL main.(*Graph).buildAdjList(SB) ;main.LoadDictionary graph.go:88
. . 10ca446: MOVQ 0xf0(SP), DX ;graph.go:89
. . 10ca44e: MOVQ 0(DX), AX
. . 10ca451: CALL AX
. . 10ca453: MOVQ 0x1f0(SP), AX ;graph.go:65
. . 10ca45b: TESTQ AX, AX
. . 10ca45e: JNE 0x10ca4a5 ;graph.go:91
. . 10ca460: MOVZX 0x1e1(SP), AX ;graph.go:39
. . 10ca468: TESTL AL, AL
. . 10ca46a: JNE 0x10ca492 ;graph.go:95
. . 10ca46c: MOVQ 0x120(SP), AX ;graph.go:99
. . 10ca474: MOVQ AX, 0x1f8(SP)
. . 10ca47c: NOPL
. . 10ca47d: CALL runtime.deferreturn(SB)
. . 10ca482: MOVQ 0x1b8(SP), BP
. . 10ca48a: ADDQ $0x1c0, SP
. . 10ca491: RET
. . 10ca492: MOVQ 0x120(SP), AX ;graph.go:96
. . 10ca49a: MOVQ AX, 0(SP)
. . 10ca49e: CALL main.adjListStats(SB)
. . 10ca4a3: JMP 0x10ca46c
. . 10ca4a5: MOVQ $0x0, 0(SP) ;graph.go:92
. . 10ca4ad: MOVQ 0x1e8(SP), CX
. . 10ca4b5: MOVQ CX, 0x8(SP)
. . 10ca4ba: MOVQ AX, 0x10(SP)
. . 10ca4bf: LEAQ go.string.*+2074(SB), AX
. . 10ca4c6: MOVQ AX, 0x18(SP)
. . 10ca4cb: MOVQ $0x8, 0x20(SP)
. . 10ca4d4: CALL runtime.concatstring2(SB)
. . 10ca4d9: MOVQ 0x30(SP), AX
. . 10ca4de: MOVQ 0x28(SP), CX
. . 10ca4e3: MOVQ 0x120(SP), DX
. . 10ca4eb: MOVQ DX, 0(SP)
. . 10ca4ef: MOVQ CX, 0x8(SP)
. . 10ca4f4: MOVQ AX, 0x10(SP)
. . 10ca4f9: CALL main.(*Graph).dumpAdjList(SB)
. . 10ca4fe: JMP 0x10ca460
. . 10ca503: MOVQ 0xf8(SP), AX ;graph.go:82
. . 10ca50b: MOVQ AX, 0(SP)
. . 10ca50f: CALL main.(*index).printStats(SB)
. . 10ca514: JMP 0x10ca402
. . 10ca519: LEAQ 0x18(DX), DI ;graph.go:69
. . 10ca51d: CALL runtime.gcWriteBarrier(SB)
. . 10ca522: JMP 0x10ca288
. . 10ca527: MOVQ $0x0, 0(SP) ;graph.go:66
. . 10ca52f: MOVQ 0x1e8(SP), CX
. . 10ca537: MOVQ CX, 0x8(SP)
. . 10ca53c: MOVQ AX, 0x10(SP)
. . 10ca541: LEAQ go.string.*+5483(SB), DX
. . 10ca548: MOVQ DX, 0x18(SP)
. . 10ca54d: MOVQ $0xd, 0x20(SP)
. . 10ca556: CALL runtime.concatstring2(SB)
. . 10ca55b: MOVQ 0x30(SP), AX
. . 10ca560: MOVQ 0x28(SP), CX
. . 10ca565: MOVQ 0x120(SP), DX
. . 10ca56d: MOVQ DX, 0(SP)
. . 10ca571: MOVQ CX, 0x8(SP)
. . 10ca576: MOVQ AX, 0x10(SP)
. . 10ca57b: CALL main.(*Graph).dumpVertices(SB)
. . 10ca580: JMP 0x10ca232
. . 10ca585: MOVQ AX, 0x110(SP) ;graph.go:49
. . 10ca58d: LEAQ runtime.types+158240(SB), AX ;graph.go:48
. . 10ca594: MOVQ AX, 0(SP)
. . 10ca598: MOVQ 0x120(SP), AX
. . 10ca5a0: MOVQ AX, 0x8(SP)
. . 10ca5a5: CALL runtime.typedmemclr(SB)
. . 10ca5aa: MOVQ 0x120(SP), DI
. . 10ca5b2: MOVQ 0x110(SP), AX
. . 10ca5ba: CALL runtime.gcWriteBarrier(SB)
. . 10ca5bf: MOVQ DI, CX ;graph.go:69
. . 10ca5c2: XORPS X0, X0 ;graph.go:49
. . 10ca5c5: JMP 0x10ca04b ;graph.go:48
. . 10ca5ca: NOPL ;graph.go:46
. . 10ca5cb: CALL runtime.deferreturn(SB)
. . 10ca5d0: MOVQ 0x1b8(SP), BP
. . 10ca5d8: ADDQ $0x1c0, SP
. . 10ca5df: RET
. . 10ca5e0: NOPL ;graph.go:41
. . 10ca5e1: CALL runtime.deferreturn(SB)
. . 10ca5e6: MOVQ 0x1b8(SP), BP
. . 10ca5ee: ADDQ $0x1c0, SP
. . 10ca5f5: RET
. . 10ca5f6: LEAQ go.string.*+3958(SB), AX ;stats.go:42
. . 10ca5fd: CALL runtime.gcWriteBarrier(SB)
. . 10ca602: MOVQ DX, DI
. . 10ca605: MOVQ SI, AX
. . 10ca608: CALL runtime.gcWriteBarrier(SB)
. . 10ca60d: JMP 0x10c9ed4
. . 10ca612: MOVQ SI, 0x110(SP)
. . 10ca61a: LEAQ runtime.types+158400(SB), SI
. . 10ca621: MOVQ SI, 0(SP)
. . 10ca625: MOVQ CX, 0x8(SP)
. . 10ca62a: MOVQ AX, 0x10(SP)
. . 10ca62f: MOVQ BX, 0x18(SP)
. . 10ca634: MOVQ DX, 0x20(SP)
. . 10ca639: CALL runtime.growslice(SB)
. . 10ca63e: MOVQ 0x28(SP), AX
. . 10ca643: MOVQ 0x30(SP), CX
. . 10ca648: MOVQ 0x38(SP), DX
. . 10ca64d: MOVQ DX, main.stats+16(SB)
. . 10ca654: CMPL $0x0, runtime.writeBarrier(SB)
. . 10ca65b: JNE 0x10ca67a
. . 10ca65d: MOVQ AX, main.stats(SB)
. . 10ca664: MOVQ 0x110(SP), SI
. . 10ca66c: MOVQ AX, DX
. . 10ca66f: MOVQ CX, AX
. . 10ca672: MOVQ DX, CX
. . 10ca675: JMP 0x10c9e87
. . 10ca67a: LEAQ main.stats(SB), DI
. . 10ca681: CALL runtime.gcWriteBarrier(SB)
. . 10ca686: JMP 0x10ca664
. . 10ca688: MOVQ SI, AX ;graph.go:71
. . 10ca68b: CALL runtime.panicIndex(SB)
. . 10ca690: NOPL
. . 10ca691: CALL runtime.morestack_noctxt(SB) ;graph.go:39
. . 10ca696: JMP main.LoadDictionary(SB)
. . 10ca69b: INT $0x3
. . 10ca69c: INT $0x3
. . 10ca69d: INT $0x3
. . 10ca69e: INT $0x3
ROUTINE ======================== main.distance
120ms 120ms (flat, cum) 2.20% of Total
. . 10cb300: SUBQ $0x18, SP ;graph.go:284
. . 10cb304: MOVQ BP, 0x10(SP)
. . 10cb309: LEAQ 0x10(SP), BP
. . 10cb30e: MOVQ 0x28(SP), CX ;graph.go:290
. . 10cb313: MOVQ 0x40(SP), DX
. . 10cb318: CMPQ DX, CX
. . 10cb31b: MOVQ CX, BX ;graph.go:293
. . 10cb31e: CMOVG DX, CX
10ms 10ms 10cb322: MOVQ BX, SI ;main.distance graph.go:285
. . 10cb325: SUBQ DX, BX ;graph.go:285
. . 10cb328: MOVQ DX, DI ;graph.go:287
. . 10cb32b: SUBQ SI, DX
. . 10cb32e: TESTQ BX, BX ;graph.go:286
. . 10cb331: CMOVL DX, BX ;graph.go:295
. . 10cb335: MOVQ 0x38(SP), DX ;graph.go:286
. . 10cb33a: MOVQ 0x20(SP), R8
. . 10cb33f: XORL AX, AX
. . 10cb341: JMP 0x10cb356
. . 10cb343: MOVZX 0(DX)(AX*1), R10 ;graph.go:294
80ms 80ms 10cb348: LEAQ 0x1(BX), R11 ;main.distance graph.go:295
. . 10cb34c: CMPL R10, R9 ;graph.go:294
10ms 10ms 10cb34f: CMOVNE R11, BX ;main.distance graph.go:295
10ms 10ms 10cb353: INCQ AX ;main.distance graph.go:293
. . 10cb356: CMPQ CX, AX ;graph.go:293
. . 10cb359: JGE 0x10cb36c
. . 10cb35b: CMPQ SI, AX ;graph.go:294
. . 10cb35e: JAE 0x10cb383
10ms 10ms 10cb360: MOVZX 0(R8)(AX*1), R9 ;main.distance graph.go:294
. . 10cb365: CMPQ DI, AX ;graph.go:294
. . 10cb368: JB 0x10cb343
. . 10cb36a: JMP 0x10cb37b
. . 10cb36c: MOVQ BX, 0x50(SP) ;graph.go:299
. . 10cb371: MOVQ 0x10(SP), BP
. . 10cb376: ADDQ $0x18, SP
. . 10cb37a: RET
. . 10cb37b: MOVQ DI, CX ;graph.go:294
. . 10cb37e: CALL runtime.panicIndex(SB)
. . 10cb383: MOVQ SI, CX
. . 10cb386: CALL runtime.panicIndex(SB)
. . 10cb38b: NOPL
. . 10cb38c: INT $0x3
. . 10cb38d: INT $0x3
. . 10cb38e: INT $0x3
ROUTINE ======================== main.main
0 2.63s (flat, cum) 48.26% of Total
. . 10cda30: MOVQ GS:0x30, CX ;main.go:27
. . 10cda39: LEAQ 0xfffffd98(SP), AX
. . 10cda41: CMPQ 0x10(CX), AX
. . 10cda45: JBE 0x10ce76a
. . 10cda4b: SUBQ $0x2e8, SP
. . 10cda52: MOVQ BP, 0x2e0(SP)
. . 10cda5a: LEAQ 0x2e0(SP), BP
. . 10cda62: MOVQ os.Args+8(SB), CX ;main.go:28
. . 10cda69: MOVQ os.Args(SB), DX ;flag.go:996
. . 10cda70: MOVQ os.Args+16(SB), BX
. . 10cda77: CMPQ $0x1, CX
. . 10cda7b: JB 0x10ce75f
. . 10cda81: MOVQ flag.CommandLine(SB), AX
. . 10cda88: MOVQ AX, 0(SP)
. . 10cda8c: LEAQ -0x1(BX), AX
. . 10cda90: MOVQ AX, BX
. . 10cda93: NEGQ AX
. . 10cda96: SARQ $0x3f, AX
. . 10cda9a: ANDQ $0x10, AX
. . 10cda9e: ADDQ DX, AX
. . 10cdaa1: MOVQ AX, 0x8(SP)
. . 10cdaa6: LEAQ -0x1(CX), AX
. . 10cdaaa: MOVQ AX, 0x10(SP)
. . 10cdaaf: MOVQ BX, 0x18(SP)
. . 10cdab4: CALL flag.(*FlagSet).Parse(SB)
. . 10cdab9: MOVQ main.cpuprofile(SB), AX ;main.go:30
. . 10cdac0: MOVQ 0(AX), CX
. . 10cdac3: MOVQ 0x8(AX), AX
. . 10cdac7: TESTQ AX, AX
. . 10cdaca: JNE 0x10ce602
. . 10cdad0: MOVQ main.traceprofile(SB), AX ;main.go:40
. . 10cdad7: MOVQ 0(AX), CX
. . 10cdada: MOVQ 0x8(AX), AX
. . 10cdade: TESTQ AX, AX
. . 10cdae1: JNE 0x10ce4a0
. . 10cdae7: MOVQ main.dump(SB), AX ;main.go:50
. . 10cdaee: MOVQ 0x8(AX), CX
. . 10cdaf2: MOVQ 0(AX), AX
. . 10cdaf5: TESTQ CX, CX
. . 10cdaf8: JNE 0x10ce48d
. . 10cdafe: XORPS X0, X0 ;main.go:54
. . 10cdb01: MOVUPS X0, 0x250(SP)
. . 10cdb09: LEAQ runtime.types+88864(SB), AX
. . 10cdb10: MOVQ AX, 0x250(SP)
. . 10cdb18: LEAQ internal/bytealg.IndexString.args_stackmap+640(SB), CX
. . 10cdb1f: MOVQ CX, 0x258(SP)
. . 10cdb27: MOVQ os.Stdout(SB), CX ;print.go:274
. . 10cdb2e: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10cdb35: MOVQ DX, 0(SP)
. . 10cdb39: MOVQ CX, 0x8(SP)
. . 10cdb3e: LEAQ 0x250(SP), CX
. . 10cdb46: MOVQ CX, 0x10(SP)
. . 10cdb4b: MOVQ $0x1, 0x18(SP)
. . 10cdb54: MOVQ $0x1, 0x20(SP)
. . 10cdb5d: CALL fmt.Fprintln(SB)
. . 10cdb62: MOVQ main.dict(SB), AX ;main.go:55
. . 10cdb69: MOVQ main.numBuckets(SB), CX
. . 10cdb70: MOVQ main.indexStats(SB), DX
. . 10cdb77: MOVQ main.perfStats(SB), BX
. . 10cdb7e: MOVQ main.dump(SB), SI
. . 10cdb85: MOVQ 0x8(AX), DI
. . 10cdb89: MOVQ 0(AX), AX
. . 10cdb8c: MOVQ 0(CX), CX
. . 10cdb8f: MOVZX 0(DX), DX
. . 10cdb92: MOVZX 0(BX), BX
. . 10cdb95: MOVQ 0(SI), R8
. . 10cdb98: MOVQ 0x8(SI), SI
. . 10cdb9c: MOVQ AX, 0(SP)
. . 10cdba0: MOVQ DI, 0x8(SP)
. . 10cdba5: MOVQ CX, 0x10(SP)
. . 10cdbaa: MOVB DL, 0x18(SP)
. . 10cdbae: MOVB BL, 0x19(SP)
. . 10cdbb2: MOVQ R8, 0x20(SP)
. . 10cdbb7: MOVQ SI, 0x28(SP)
. 2.63s 10cdbbc: CALL main.LoadDictionary(SB) ;main.main main.go:55
. . 10cdbc1: MOVQ 0x30(SP), AX ;main.go:55
. . 10cdbc6: MOVQ AX, 0x1d0(SP)
. . 10cdbce: MOVQ 0x8(AX), CX ;graph.go:304
. . 10cdbd2: MOVQ CX, 0x78(SP)
. . 10cdbd7: MOVQ AX, 0(SP) ;main.go:56
. . 10cdbdb: CALL main.(*Graph).EdgeCount(SB)
. . 10cdbe0: MOVQ 0x8(SP), AX
. . 10cdbe5: MOVQ AX, 0x70(SP)
. . 10cdbea: MOVQ 0x78(SP), CX
. . 10cdbef: MOVQ CX, 0(SP)
. . 10cdbf3: CALL runtime.convT64(SB)
. . 10cdbf8: MOVQ 0x8(SP), AX
. . 10cdbfd: MOVQ AX, 0x1f8(SP)
. . 10cdc05: MOVQ 0x70(SP), CX
. . 10cdc0a: MOVQ CX, 0(SP)
. . 10cdc0e: CALL runtime.convT64(SB)
. . 10cdc13: MOVQ 0x8(SP), AX
. . 10cdc18: XORPS X0, X0
. . 10cdc1b: MOVUPS X0, 0x2c0(SP)
. . 10cdc23: MOVUPS X0, 0x2d0(SP)
. . 10cdc2b: LEAQ runtime.types+86176(SB), CX
. . 10cdc32: MOVQ CX, 0x2c0(SP)
. . 10cdc3a: MOVQ 0x1f8(SP), DX
. . 10cdc42: MOVQ DX, 0x2c8(SP)
. . 10cdc4a: MOVQ CX, 0x2d0(SP)
. . 10cdc52: MOVQ AX, 0x2d8(SP)
. . 10cdc5a: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10cdc61: LEAQ go.itab.*os.File,io.Writer(SB), CX
. . 10cdc68: MOVQ CX, 0(SP)
. . 10cdc6c: MOVQ AX, 0x8(SP)
. . 10cdc71: LEAQ go.string.*+11078(SB), AX
. . 10cdc78: MOVQ AX, 0x10(SP)
. . 10cdc7d: MOVQ $0x14, 0x18(SP)
. . 10cdc86: LEAQ 0x2c0(SP), AX
. . 10cdc8e: MOVQ AX, 0x20(SP)
. . 10cdc93: MOVQ $0x2, 0x28(SP)
. . 10cdc9c: MOVQ $0x2, 0x30(SP)
. . 10cdca5: CALL fmt.Fprintf(SB)
. . 10cdcaa: MOVQ main.dictStats(SB), AX ;main.go:58
. . 10cdcb1: CMPB $0x0, 0(AX)
. . 10cdcb4: JNE 0x10ce46c
. . 10cdcba: MOVQ main.src(SB), AX ;main.go:62
. . 10cdcc1: MOVQ 0(AX), CX
. . 10cdcc4: MOVQ 0x8(AX), AX
. . 10cdcc8: TESTQ AX, AX
. . 10cdccb: JE 0x10cdcdf
. . 10cdccd: MOVQ main.dest(SB), DX
. . 10cdcd4: CMPQ $0x0, 0x8(DX)
. . 10cdcd9: JNE 0x10cdf0e
. . 10cdcdf: MOVQ main.printGraph(SB), AX ;main.go:86
. . 10cdce6: CMPB $0x0, 0(AX)
. . 10cdce9: JNE 0x10cdef8
. . 10cdcef: MOVQ main.csv(SB), AX ;main.go:90
. . 10cdcf6: CMPB $0x0, 0(AX)
. . 10cdcf9: JE 0x10cdeee
. . 10cdcff: MOVB $0x1, 0(SP) ;main.go:91
. . 10cdd03: CALL main.PrintStatsCSV(SB)
. . 10cdd08: MOVQ main.memprofile(SB), AX ;main.go:96
. . 10cdd0f: CMPQ $0x0, 0x8(AX)
. . 10cdd14: JNE 0x10cdd2c
. . 10cdd16: NOPL ;main.go:107
. . 10cdd17: CALL runtime.deferreturn(SB)
. . 10cdd1c: MOVQ 0x2e0(SP), BP
. . 10cdd24: ADDQ $0x2e8, SP
. . 10cdd2b: RET
. . 10cdd2c: CALL runtime.GC(SB) ;main.go:97
. . 10cdd31: MOVQ main.memprofile(SB), AX ;main.go:98
. . 10cdd38: MOVQ 0(AX), CX
. . 10cdd3b: MOVQ 0x8(AX), AX
. . 10cdd3f: MOVQ CX, 0(SP) ;file.go:289
. . 10cdd43: MOVQ AX, 0x8(SP)
. . 10cdd48: MOVQ $0x602, 0x10(SP)
. . 10cdd51: MOVL $0x1b6, 0x18(SP)
. . 10cdd59: CALL os.OpenFile(SB)
. . 10cdd5e: MOVQ 0x20(SP), AX
. . 10cdd63: MOVQ AX, 0x1f0(SP)
. . 10cdd6b: MOVQ 0x28(SP), CX
. . 10cdd70: MOVQ 0x30(SP), DX
. . 10cdd75: TESTQ CX, CX ;main.go:99
. . 10cdd78: JE 0x10cdde4
. . 10cdd7a: JE 0x10cdd80 ;main.go:100
. . 10cdd7c: MOVQ 0x8(CX), CX
. . 10cdd80: XORPS X0, X0
. . 10cdd83: MOVUPS X0, 0x260(SP)
. . 10cdd8b: MOVUPS X0, 0x270(SP)
. . 10cdd93: LEAQ runtime.types+88864(SB), AX
. . 10cdd9a: MOVQ AX, 0x260(SP)
. . 10cdda2: LEAQ internal/bytealg.IndexString.args_stackmap+672(SB), BX
. . 10cdda9: MOVQ BX, 0x268(SP)
. . 10cddb1: MOVQ CX, 0x270(SP)
. . 10cddb9: MOVQ DX, 0x278(SP)
. . 10cddc1: LEAQ 0x260(SP), CX
. . 10cddc9: MOVQ CX, 0(SP)
. . 10cddcd: MOVQ $0x2, 0x8(SP)
. . 10cddd6: MOVQ $0x2, 0x10(SP)
. . 10cdddf: CALL log.Fatal(SB)
. . 10cdde4: MOVL $0x18, 0xf0(SP) ;main.go:102
. . 10cddef: LEAQ go.func.*+300(SB), AX
. . 10cddf6: MOVQ AX, 0x108(SP)
. . 10cddfe: MOVQ 0x1f0(SP), AX
. . 10cde06: MOVQ AX, 0x120(SP)
. . 10cde0e: LEAQ 0xf0(SP), CX
. . 10cde16: MOVQ CX, 0(SP)
. . 10cde1a: CALL runtime.deferprocStack(SB)
. . 10cde1f: TESTL AX, AX
. . 10cde21: JNE 0x10cded8
. . 10cde27: NOPL ;pprof.go:522
. . 10cde28: LEAQ go.itab.*os.File,io.Writer(SB), AX ;pprof.go:533
. . 10cde2f: MOVQ AX, 0(SP)
. . 10cde33: MOVQ 0x1f0(SP), AX
. . 10cde3b: MOVQ AX, 0x8(SP)
. . 10cde40: MOVQ $0x0, 0x10(SP)
. . 10cde49: XORPS X0, X0
. . 10cde4c: MOVUPS X0, 0x18(SP)
. . 10cde51: CALL runtime/pprof.writeHeapInternal(SB)
. . 10cde56: MOVQ 0x28(SP), AX
. . 10cde5b: MOVQ 0x30(SP), CX
. . 10cde60: TESTQ AX, AX ;main.go:103
. . 10cde63: JE 0x10cdd16
. . 10cde69: JE 0x10cde6f ;main.go:104
. . 10cde6b: MOVQ 0x8(AX), AX
. . 10cde6f: XORPS X0, X0
. . 10cde72: MOVUPS X0, 0x260(SP)
. . 10cde7a: MOVUPS X0, 0x270(SP)
. . 10cde82: LEAQ runtime.types+88864(SB), DX
. . 10cde89: MOVQ DX, 0x260(SP)
. . 10cde91: LEAQ internal/bytealg.IndexString.args_stackmap+688(SB), DX
. . 10cde98: MOVQ DX, 0x268(SP)
. . 10cdea0: MOVQ AX, 0x270(SP)
. . 10cdea8: MOVQ CX, 0x278(SP)
. . 10cdeb0: LEAQ 0x260(SP), AX
. . 10cdeb8: MOVQ AX, 0(SP)
. . 10cdebc: MOVQ $0x2, 0x8(SP)
. . 10cdec5: MOVQ $0x2, 0x10(SP)
. . 10cdece: CALL log.Fatal(SB)
. . 10cded3: JMP 0x10cdd16
. . 10cded8: NOPL ;main.go:102
. . 10cded9: CALL runtime.deferreturn(SB)
. . 10cdede: MOVQ 0x2e0(SP), BP
. . 10cdee6: ADDQ $0x2e8, SP
. . 10cdeed: RET
. . 10cdeee: CALL main.PrintStats(SB) ;main.go:93
. . 10cdef3: JMP 0x10cdd08
. . 10cdef8: MOVQ 0x1d0(SP), AX ;main.go:87
. . 10cdf00: MOVQ AX, 0(SP)
. . 10cdf04: CALL main.(*Graph).PrintAdjList(SB)
. . 10cdf09: JMP 0x10cdcef
. . 10cdf0e: MOVQ CX, 0(SP) ;main.go:63
. . 10cdf12: MOVQ AX, 0x8(SP)
. . 10cdf17: CALL runtime.convTstring(SB)
. . 10cdf1c: MOVQ main.dest(SB), AX
. . 10cdf23: MOVQ 0x10(SP), CX
. . 10cdf28: MOVQ CX, 0x1f8(SP)
. . 10cdf30: MOVQ 0x8(AX), DX
. . 10cdf34: MOVQ 0(AX), AX
. . 10cdf37: MOVQ AX, 0(SP)
. . 10cdf3b: MOVQ DX, 0x8(SP)
. . 10cdf40: CALL runtime.convTstring(SB)
. . 10cdf45: MOVQ 0x10(SP), AX
. . 10cdf4a: XORPS X0, X0
. . 10cdf4d: MOVUPS X0, 0x2a0(SP)
. . 10cdf55: MOVUPS X0, 0x2b0(SP)
. . 10cdf5d: LEAQ runtime.types+88864(SB), CX
. . 10cdf64: MOVQ CX, 0x2a0(SP)
. . 10cdf6c: MOVQ 0x1f8(SP), DX
. . 10cdf74: MOVQ DX, 0x2a8(SP)
. . 10cdf7c: MOVQ CX, 0x2b0(SP)
. . 10cdf84: MOVQ AX, 0x2b8(SP)
. . 10cdf8c: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10cdf93: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10cdf9a: MOVQ DX, 0(SP)
. . 10cdf9e: MOVQ AX, 0x8(SP)
. . 10cdfa3: LEAQ go.string.*+16367(SB), AX
. . 10cdfaa: MOVQ AX, 0x10(SP)
. . 10cdfaf: MOVQ $0x1b, 0x18(SP)
. . 10cdfb8: LEAQ 0x2a0(SP), AX
. . 10cdfc0: MOVQ AX, 0x20(SP)
. . 10cdfc5: MOVQ $0x2, 0x28(SP)
. . 10cdfce: MOVQ $0x2, 0x30(SP)
. . 10cdfd7: CALL fmt.Fprintf(SB)
. . 10cdfdc: MOVQ main.src(SB), AX ;main.go:64
. . 10cdfe3: MOVQ 0x8(AX), CX
. . 10cdfe7: MOVQ 0(AX), AX
. . 10cdfea: MOVQ 0x1d0(SP), DX
. . 10cdff2: MOVQ DX, 0(SP)
. . 10cdff6: MOVQ AX, 0x8(SP)
. . 10cdffb: MOVQ CX, 0x10(SP)
. . 10ce000: CALL main.(*Graph).Find(SB)
. . 10ce005: MOVQ main.dest(SB), AX ;main.go:65
. . 10ce00c: MOVQ 0x18(SP), CX ;main.go:64
. . 10ce011: MOVQ CX, 0x58(SP)
. . 10ce016: MOVQ 0x8(AX), DX ;main.go:65
. . 10ce01a: MOVQ 0(AX), AX
. . 10ce01d: MOVQ 0x1d0(SP), BX
. . 10ce025: MOVQ BX, 0(SP)
. . 10ce029: MOVQ AX, 0x8(SP)
. . 10ce02e: MOVQ DX, 0x10(SP)
. . 10ce033: CALL main.(*Graph).Find(SB)
. . 10ce038: MOVQ 0x18(SP), AX
. . 10ce03d: MOVQ 0x58(SP), CX ;main.go:67
. . 10ce042: TESTQ CX, CX
. . 10ce045: JL 0x10ce311
. . 10ce04b: TESTQ AX, AX
. . 10ce04e: JL 0x10ce30e
. . 10ce054: XORPS X0, X0 ;main.go:77
. . 10ce057: MOVUPS X0, 0x220(SP)
. . 10ce05f: LEAQ runtime.types+88864(SB), AX
. . 10ce066: MOVQ AX, 0x220(SP)
. . 10ce06e: LEAQ internal/bytealg.IndexString.args_stackmap+656(SB), CX
. . 10ce075: MOVQ CX, 0x228(SP)
. . 10ce07d: MOVQ os.Stdout(SB), CX ;print.go:274
. . 10ce084: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10ce08b: MOVQ DX, 0(SP)
. . 10ce08f: MOVQ CX, 0x8(SP)
. . 10ce094: LEAQ 0x220(SP), CX
. . 10ce09c: MOVQ CX, 0x10(SP)
. . 10ce0a1: MOVQ $0x1, 0x18(SP)
. . 10ce0aa: MOVQ $0x1, 0x20(SP)
. . 10ce0b3: CALL fmt.Fprintln(SB)
. . 10ce0b8: MOVQ 0x1d0(SP), AX ;main.go:78
. . 10ce0c0: MOVQ AX, 0(SP)
. . 10ce0c4: MOVQ 0x58(SP), CX
. . 10ce0c9: MOVQ CX, 0x8(SP)
. . 10ce0ce: CALL main.(*Graph).AllPaths(SB)
. . 10ce0d3: MOVQ main.dest(SB), AX ;main.go:79
. . 10ce0da: MOVQ 0x10(SP), CX ;main.go:78
. . 10ce0df: MOVQ 0(AX), DX ;main.go:79
. . 10ce0e2: MOVQ 0x8(AX), AX
. . 10ce0e6: MOVQ CX, 0(SP)
. . 10ce0ea: MOVQ DX, 0x8(SP)
. . 10ce0ef: MOVQ AX, 0x10(SP)
. . 10ce0f4: CALL main.(*Paths).To(SB)
. . 10ce0f9: MOVQ 0x20(SP), AX
. . 10ce0fe: MOVQ AX, 0x60(SP)
. . 10ce103: MOVQ 0x18(SP), CX
. . 10ce108: MOVQ CX, 0x1c8(SP)
. . 10ce110: TESTQ AX, AX ;main.go:80
. . 10ce113: JE 0x10ce220
. . 10ce119: MOVQ 0x1d0(SP), DX ;main.go:83
. . 10ce121: XORL BX, BX
. . 10ce123: JMP 0x10ce1fe
. . 10ce128: MOVQ BX, 0x78(SP)
. . 10ce12d: LEAQ 0(SI)(SI*2), AX ;main.go:84
. . 10ce131: MOVQ 0x10(R8)(AX*8), CX
. . 10ce136: MOVQ 0x8(R8)(AX*8), DX
. . 10ce13b: MOVQ 0(R8)(AX*8), AX
. . 10ce13f: MOVQ $0x0, 0(SP)
. . 10ce147: MOVQ AX, 0x8(SP)
. . 10ce14c: MOVQ DX, 0x10(SP)
. . 10ce151: MOVQ CX, 0x18(SP)
. . 10ce156: CALL runtime.slicebytetostring(SB)
. . 10ce15b: MOVQ 0x20(SP), AX
. . 10ce160: MOVQ 0x28(SP), CX
. . 10ce165: MOVQ AX, 0(SP)
. . 10ce169: MOVQ CX, 0x8(SP)
. . 10ce16e: CALL runtime.convTstring(SB)
. . 10ce173: MOVQ 0x10(SP), AX
. . 10ce178: XORPS X0, X0
. . 10ce17b: MOVUPS X0, 0x210(SP)
. . 10ce183: LEAQ runtime.types+88864(SB), CX
. . 10ce18a: MOVQ CX, 0x210(SP)
. . 10ce192: MOVQ AX, 0x218(SP)
. . 10ce19a: MOVQ os.Stdout(SB), AX ;print.go:274
. . 10ce1a1: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10ce1a8: MOVQ DX, 0(SP)
. . 10ce1ac: MOVQ AX, 0x8(SP)
. . 10ce1b1: LEAQ 0x210(SP), AX
. . 10ce1b9: MOVQ AX, 0x10(SP)
. . 10ce1be: MOVQ $0x1, 0x18(SP)
. . 10ce1c7: MOVQ $0x1, 0x20(SP)
. . 10ce1d0: CALL fmt.Fprintln(SB)
. . 10ce1d5: MOVQ 0x78(SP), AX ;main.go:83
. . 10ce1da: LEAQ 0x1(AX), BX
. . 10ce1de: MOVQ 0x60(SP), AX
. . 10ce1e3: MOVQ 0x1d0(SP), CX
. . 10ce1eb: MOVQ 0x1c8(SP), DX
. . 10ce1f3: MOVQ DX, CX
. . 10ce1f6: MOVQ 0x1d0(SP), DX ;main.go:84
. . 10ce1fe: CMPQ AX, BX ;main.go:83
. . 10ce201: JGE 0x10cdcef
. . 10ce207: MOVQ 0(CX)(BX*8), SI
. . 10ce20b: MOVQ 0x8(DX), DI ;main.go:84
. . 10ce20f: MOVQ 0(DX), R8
. . 10ce212: CMPQ DI, SI
. . 10ce215: JB 0x10ce128
. . 10ce21b: JMP 0x10ce754
. . 10ce220: MOVQ main.src(SB), AX ;main.go:81
. . 10ce227: MOVQ 0(AX), CX
. . 10ce22a: MOVQ 0x8(AX), AX
. . 10ce22e: MOVQ CX, 0(SP)
. . 10ce232: MOVQ AX, 0x8(SP)
. . 10ce237: CALL runtime.convTstring(SB)
. . 10ce23c: MOVQ main.dest(SB), AX
. . 10ce243: MOVQ 0x10(SP), CX
. . 10ce248: MOVQ CX, 0x1f8(SP)
. . 10ce250: MOVQ 0x8(AX), DX
. . 10ce254: MOVQ 0(AX), AX
. . 10ce257: MOVQ AX, 0(SP)
. . 10ce25b: MOVQ DX, 0x8(SP)
. . 10ce260: CALL runtime.convTstring(SB)
. . 10ce265: MOVQ 0x10(SP), AX
. . 10ce26a: XORPS X0, X0
. . 10ce26d: MOVUPS X0, 0x280(SP)
. . 10ce275: MOVUPS X0, 0x290(SP)
. . 10ce27d: LEAQ runtime.types+88864(SB), CX
. . 10ce284: MOVQ CX, 0x280(SP)
. . 10ce28c: MOVQ 0x1f8(SP), DX
. . 10ce294: MOVQ DX, 0x288(SP)
. . 10ce29c: MOVQ CX, 0x290(SP)
. . 10ce2a4: MOVQ AX, 0x298(SP)
. . 10ce2ac: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10ce2b3: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10ce2ba: MOVQ DX, 0(SP)
. . 10ce2be: MOVQ AX, 0x8(SP)
. . 10ce2c3: LEAQ go.string.*+20133(SB), AX
. . 10ce2ca: MOVQ AX, 0x10(SP)
. . 10ce2cf: MOVQ $0x1f, 0x18(SP)
. . 10ce2d8: LEAQ 0x280(SP), AX
. . 10ce2e0: MOVQ AX, 0x20(SP)
. . 10ce2e5: MOVQ $0x2, 0x28(SP)
. . 10ce2ee: MOVQ $0x2, 0x30(SP)
. . 10ce2f7: CALL fmt.Fprintf(SB)
. . 10ce2fc: MOVQ 0x60(SP), AX ;main.go:83
. . 10ce301: MOVQ 0x1c8(SP), CX
. . 10ce309: JMP 0x10ce119
. . 10ce30e: TESTQ CX, CX ;main.go:67
. . 10ce311: JL 0x10ce3ca ;main.go:68
. . 10ce317: TESTQ AX, AX ;main.go:71
. . 10ce31a: JL 0x10ce332
. . 10ce31c: NOPL ;main.go:74
. . 10ce31d: CALL runtime.deferreturn(SB)
. . 10ce322: MOVQ 0x2e0(SP), BP
. . 10ce32a: ADDQ $0x2e8, SP
. . 10ce331: RET
. . 10ce332: MOVQ main.dest(SB), AX ;main.go:72
. . 10ce339: MOVQ 0x8(AX), CX
. . 10ce33d: MOVQ 0(AX), AX
. . 10ce340: MOVQ AX, 0(SP)
. . 10ce344: MOVQ CX, 0x8(SP)
. . 10ce349: CALL runtime.convTstring(SB)
. . 10ce34e: MOVQ 0x10(SP), AX
. . 10ce353: XORPS X0, X0
. . 10ce356: MOVUPS X0, 0x230(SP)
. . 10ce35e: LEAQ runtime.types+88864(SB), CX
. . 10ce365: MOVQ CX, 0x230(SP)
. . 10ce36d: MOVQ AX, 0x238(SP)
. . 10ce375: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10ce37c: LEAQ go.itab.*os.File,io.Writer(SB), CX
. . 10ce383: MOVQ CX, 0(SP)
. . 10ce387: MOVQ AX, 0x8(SP)
. . 10ce38c: LEAQ go.string.*+7974(SB), AX
. . 10ce393: MOVQ AX, 0x10(SP)
. . 10ce398: MOVQ $0x11, 0x18(SP)
. . 10ce3a1: LEAQ 0x230(SP), AX
. . 10ce3a9: MOVQ AX, 0x20(SP)
. . 10ce3ae: MOVQ $0x1, 0x28(SP)
. . 10ce3b7: MOVQ $0x1, 0x30(SP)
. . 10ce3c0: CALL fmt.Fprintf(SB)
. . 10ce3c5: JMP 0x10ce31c ;main.go:74
. . 10ce3ca: MOVQ AX, 0x50(SP) ;main.go:65
. . 10ce3cf: MOVQ main.src(SB), AX ;main.go:69
. . 10ce3d6: MOVQ 0x8(AX), CX
. . 10ce3da: MOVQ 0(AX), AX
. . 10ce3dd: MOVQ AX, 0(SP)
. . 10ce3e1: MOVQ CX, 0x8(SP)
. . 10ce3e6: CALL runtime.convTstring(SB)
. . 10ce3eb: MOVQ 0x10(SP), AX
. . 10ce3f0: XORPS X0, X0
. . 10ce3f3: MOVUPS X0, 0x240(SP)
. . 10ce3fb: LEAQ runtime.types+88864(SB), CX
. . 10ce402: MOVQ CX, 0x240(SP)
. . 10ce40a: MOVQ AX, 0x248(SP)
. . 10ce412: MOVQ os.Stdout(SB), AX ;print.go:213
. . 10ce419: LEAQ go.itab.*os.File,io.Writer(SB), DX
. . 10ce420: MOVQ DX, 0(SP)
. . 10ce424: MOVQ AX, 0x8(SP)
. . 10ce429: LEAQ go.string.*+7974(SB), AX
. . 10ce430: MOVQ AX, 0x10(SP)
. . 10ce435: MOVQ $0x11, 0x18(SP)
. . 10ce43e: LEAQ 0x240(SP), BX
. . 10ce446: MOVQ BX, 0x20(SP)
. . 10ce44b: MOVQ $0x1, 0x28(SP)
. . 10ce454: MOVQ $0x1, 0x30(SP)
. . 10ce45d: CALL fmt.Fprintf(SB)
. . 10ce462: MOVQ 0x50(SP), AX ;main.go:71
. . 10ce467: JMP 0x10ce317
. . 10ce46c: MOVQ main.dict(SB), AX ;main.go:59
. . 10ce473: MOVQ 0x8(AX), CX
. . 10ce477: MOVQ 0(AX), AX
. . 10ce47a: MOVQ AX, 0(SP)
. . 10ce47e: MOVQ CX, 0x8(SP)
. . 10ce483: CALL main.dictionaryStats(SB)
. . 10ce488: JMP 0x10cdcba
. . 10ce48d: MOVQ AX, 0(SP) ;main.go:51
. . 10ce491: MOVQ CX, 0x8(SP)
. . 10ce496: CALL main.createPathIfNotExists(SB)
. . 10ce49b: JMP 0x10cdafe
. . 10ce4a0: NOPL ;main.go:41
. . 10ce4a1: MOVQ CX, 0(SP) ;file.go:289
. . 10ce4a5: MOVQ AX, 0x8(SP)
. . 10ce4aa: MOVQ $0x602, 0x10(SP)
. . 10ce4b3: MOVL $0x1b6, 0x18(SP)
. . 10ce4bb: CALL os.OpenFile(SB)
. . 10ce4c0: MOVQ 0x20(SP), AX
. . 10ce4c5: MOVQ AX, 0x1d8(SP)
. . 10ce4cd: MOVQ 0x28(SP), CX
. . 10ce4d2: MOVQ 0x30(SP), DX
. . 10ce4d7: TESTQ CX, CX ;main.go:42
. . 10ce4da: JE 0x10ce546
. . 10ce4dc: JE 0x10ce4e2 ;main.go:43
. . 10ce4de: MOVQ 0x8(CX), CX
. . 10ce4e2: XORPS X0, X0
. . 10ce4e5: MOVUPS X0, 0x260(SP)
. . 10ce4ed: MOVUPS X0, 0x270(SP)
. . 10ce4f5: LEAQ runtime.types+88864(SB), AX
. . 10ce4fc: MOVQ AX, 0x260(SP)
. . 10ce504: LEAQ internal/bytealg.IndexString.args_stackmap+624(SB), BX
. . 10ce50b: MOVQ BX, 0x268(SP)
. . 10ce513: MOVQ CX, 0x270(SP)
. . 10ce51b: MOVQ DX, 0x278(SP)
. . 10ce523: LEAQ 0x260(SP), CX
. . 10ce52b: MOVQ CX, 0(SP)
. . 10ce52f: MOVQ $0x2, 0x8(SP)
. . 10ce538: MOVQ $0x2, 0x10(SP)
. . 10ce541: CALL log.Fatal(SB)
. . 10ce546: MOVL $0x18, 0x138(SP) ;main.go:45
. . 10ce551: LEAQ go.func.*+300(SB), AX
. . 10ce558: MOVQ AX, 0x150(SP)
. . 10ce560: MOVQ 0x1d8(SP), CX
. . 10ce568: MOVQ CX, 0x168(SP)
. . 10ce570: LEAQ 0x138(SP), DX
. . 10ce578: MOVQ DX, 0(SP)
. . 10ce57c: CALL runtime.deferprocStack(SB)
. . 10ce581: TESTL AX, AX
. . 10ce583: JNE 0x10ce5ec
. . 10ce585: LEAQ go.itab.*os.File,io.Writer(SB), AX ;main.go:46
. . 10ce58c: MOVQ AX, 0(SP)
. . 10ce590: MOVQ 0x1d8(SP), CX
. . 10ce598: MOVQ CX, 0x8(SP)
. . 10ce59d: CALL runtime/trace.Start(SB)
. . 10ce5a2: MOVL $0x0, 0x80(SP) ;main.go:47
. . 10ce5ad: LEAQ go.func.*+1604(SB), AX
. . 10ce5b4: MOVQ AX, 0x98(SP)
. . 10ce5bc: LEAQ 0x80(SP), AX
. . 10ce5c4: MOVQ AX, 0(SP)
. . 10ce5c8: CALL runtime.deferprocStack(SB)
. . 10ce5cd: TESTL AX, AX
. . 10ce5cf: JNE 0x10ce5d6
. . 10ce5d1: JMP 0x10cdae7
. . 10ce5d6: NOPL
. . 10ce5d7: CALL runtime.deferreturn(SB)
. . 10ce5dc: MOVQ 0x2e0(SP), BP
. . 10ce5e4: ADDQ $0x2e8, SP
. . 10ce5eb: RET
. . 10ce5ec: NOPL ;main.go:45
. . 10ce5ed: CALL runtime.deferreturn(SB)
. . 10ce5f2: MOVQ 0x2e0(SP), BP
. . 10ce5fa: ADDQ $0x2e8, SP
. . 10ce601: RET
. . 10ce602: NOPL ;main.go:31
. . 10ce603: MOVQ CX, 0(SP) ;file.go:289
. . 10ce607: MOVQ AX, 0x8(SP)
. . 10ce60c: MOVQ $0x602, 0x10(SP)
. . 10ce615: MOVL $0x1b6, 0x18(SP)
. . 10ce61d: CALL os.OpenFile(SB)
. . 10ce622: MOVQ 0x20(SP), AX
. . 10ce627: MOVQ AX, 0x1e0(SP)
. . 10ce62f: MOVQ 0x28(SP), CX
. . 10ce634: MOVQ CX, 0x68(SP)
. . 10ce639: MOVQ 0x30(SP), DX
. . 10ce63e: MOVQ DX, 0x1e8(SP)
. . 10ce646: MOVL $0x18, 0x180(SP) ;main.go:32
. . 10ce651: LEAQ go.func.*+300(SB), BX
. . 10ce658: MOVQ BX, 0x198(SP)
. . 10ce660: MOVQ AX, 0x1b0(SP)
. . 10ce668: LEAQ 0x180(SP), SI
. . 10ce670: MOVQ SI, 0(SP)
. . 10ce674: CALL runtime.deferprocStack(SB)
. . 10ce679: TESTL AX, AX
. . 10ce67b: JNE 0x10ce73e
. . 10ce681: MOVQ 0x68(SP), AX ;main.go:33
. . 10ce686: TESTQ AX, AX
. . 10ce689: JE 0x10ce6d7
. . 10ce68b: JE 0x10ce691 ;main.go:34
. . 10ce68d: MOVQ 0x8(AX), AX
. . 10ce691: XORPS X0, X0
. . 10ce694: MOVUPS X0, 0x200(SP)
. . 10ce69c: MOVQ AX, 0x200(SP)
. . 10ce6a4: MOVQ 0x1e8(SP), AX
. . 10ce6ac: MOVQ AX, 0x208(SP)
. . 10ce6b4: LEAQ 0x200(SP), AX
. . 10ce6bc: MOVQ AX, 0(SP)
. . 10ce6c0: MOVQ $0x1, 0x8(SP)
. . 10ce6c9: MOVQ $0x1, 0x10(SP)
. . 10ce6d2: CALL log.Fatal(SB)
. . 10ce6d7: LEAQ go.itab.*os.File,io.Writer(SB), AX ;main.go:36
. . 10ce6de: MOVQ AX, 0(SP)
. . 10ce6e2: MOVQ 0x1e0(SP), CX
. . 10ce6ea: MOVQ CX, 0x8(SP)
. . 10ce6ef: CALL runtime/pprof.StartCPUProfile(SB)
. . 10ce6f4: MOVL $0x0, 0xb8(SP) ;main.go:37
. . 10ce6ff: LEAQ go.func.*+1572(SB), AX
. . 10ce706: MOVQ AX, 0xd0(SP)
. . 10ce70e: LEAQ 0xb8(SP), AX
. . 10ce716: MOVQ AX, 0(SP)
. . 10ce71a: CALL runtime.deferprocStack(SB)
. . 10ce71f: TESTL AX, AX
. . 10ce721: JNE 0x10ce728
. . 10ce723: JMP 0x10cdad0
. . 10ce728: NOPL
. . 10ce729: CALL runtime.deferreturn(SB)
. . 10ce72e: MOVQ 0x2e0(SP), BP
. . 10ce736: ADDQ $0x2e8, SP
. . 10ce73d: RET
. . 10ce73e: NOPL ;main.go:32
. . 10ce73f: CALL runtime.deferreturn(SB)
. . 10ce744: MOVQ 0x2e0(SP), BP
. . 10ce74c: ADDQ $0x2e8, SP
. . 10ce753: RET
. . 10ce754: MOVQ SI, AX ;main.go:84
. . 10ce757: MOVQ DI, CX
. . 10ce75a: CALL runtime.panicIndex(SB)
. . 10ce75f: MOVL $0x1, AX ;flag.go:996
. . 10ce764: CALL runtime.panicSliceB(SB)
. . 10ce769: NOPL
. . 10ce76a: CALL runtime.morestack_noctxt(SB) ;main.go:27
. . 10ce76f: JMP main.main(SB)
. . 10ce774: INT $0x3
. . 10ce775: INT $0x3
. . 10ce776: INT $0x3
. . 10ce777: INT $0x3
. . 10ce778: INT $0x3
. . 10ce779: INT $0x3
. . 10ce77a: INT $0x3
. . 10ce77b: INT $0x3
. . 10ce77c: INT $0x3
. . 10ce77d: INT $0x3
. . 10ce77e: INT $0x3
ROUTINE ======================== main.newIndex
50ms 110ms (flat, cum) 2.02% of Total
. . 10cc040: MOVQ GS:0x30, CX ;index.go:22
. . 10cc049: CMPQ 0x10(CX), SP
. . 10cc04d: JBE 0x10cc24e
. . 10cc053: SUBQ $0x48, SP
. . 10cc057: MOVQ BP, 0x40(SP)
. . 10cc05c: LEAQ 0x40(SP), BP
. . 10cc061: LEAQ runtime.types+77472(SB), AX ;index.go:23
. . 10cc068: MOVQ AX, 0(SP)
. . 10cc06c: MOVQ 0x50(SP), AX
. . 10cc071: MOVQ AX, 0x8(SP)
. . 10cc076: MOVQ AX, 0x10(SP)
. 20ms 10cc07b: CALL runtime.makeslice(SB) ;main.newIndex index.go:23
. . 10cc080: MOVQ 0x18(SP), AX ;index.go:23
. . 10cc085: MOVQ AX, 0x38(SP)
. . 10cc08a: XORL CX, CX
. . 10cc08c: JMP 0x10cc095 ;index.go:24
. . 10cc08e: LEAQ 0x1(AX), CX
. . 10cc092: MOVQ BX, AX ;index.go:25
. . 10cc095: MOVQ 0x50(SP), DX ;index.go:24
. . 10cc09a: CMPQ DX, CX
. . 10cc09d: JGE 0x10cc104
. . 10cc09f: MOVQ CX, 0x20(SP)
. . 10cc0a4: LEAQ runtime.types+86176(SB), AX ;index.go:25
. . 10cc0ab: MOVQ AX, 0(SP)
. . 10cc0af: XORPS X0, X0
. . 10cc0b2: MOVUPS X0, 0x8(SP)
. 20ms 10cc0b7: CALL runtime.makeslice(SB) ;main.newIndex index.go:25
. . 10cc0bc: MOVQ 0x20(SP), AX ;index.go:25
. . 10cc0c1: LEAQ 0(AX)(AX*2), CX
. . 10cc0c5: MOVQ 0x18(SP), DX
. . 10cc0ca: MOVQ 0x38(SP), BX
20ms 20ms 10cc0cf: MOVQ $0x0, 0x8(BX)(CX*8) ;main.newIndex index.go:25
10ms 10ms 10cc0d8: MOVQ $0x0, 0x10(BX)(CX*8)
10ms 10ms 10cc0e1: LEAQ 0(BX)(CX*8), DI
. . 10cc0e5: CMPL $0x0, runtime.writeBarrier(SB) ;index.go:25
. . 10cc0ec: JNE 0x10cc0f4
10ms 10ms 10cc0ee: MOVQ DX, 0(BX)(CX*8) ;main.newIndex index.go:25
. . 10cc0f2: JMP 0x10cc08e ;index.go:25
. . 10cc0f4: MOVQ AX, CX ;index.go:24
. . 10cc0f7: MOVQ DX, AX ;index.go:25
. 20ms 10cc0fa: CALL runtime.gcWriteBarrier(SB) ;main.newIndex index.go:25
. . 10cc0ff: MOVQ CX, AX ;index.go:24
. . 10cc102: JMP 0x10cc08e ;index.go:25
. . 10cc104: NOPL ;murmur64.go:18
. . 10cc105: MOVL $0x0, 0(SP) ;murmur64.go:22
. . 10cc10c: CALL erichgess/wordladder/vendor/github.com/spaolacci/murmur3.New128WithSeed(SB)
. . 10cc111: MOVQ 0x10(SP), AX
. . 10cc116: MOVQ 0x8(SP), CX
. . 10cc11b: LEAQ go.itab.*erichgess/wordladder/vendor/github.com/spaolacci/murmur3.digest128,erichgess/wordladder/vendor/github.com/spaolacci/murmur3.Hash128(SB), DX
. . 10cc122: CMPQ DX, CX
. . 10cc125: JNE 0x10cc22c
. . 10cc12b: MOVQ AX, 0x28(SP)
. . 10cc130: LEAQ runtime.types+89184(SB), AX ;index.go:29
. . 10cc137: MOVQ AX, 0(SP)
. . 10cc13b: MOVQ $0x0, 0x8(SP)
. . 10cc144: MOVQ 0x58(SP), AX
. . 10cc149: MOVQ AX, 0x10(SP)
. . 10cc14e: CALL runtime.makeslice(SB)
. . 10cc153: MOVQ 0x18(SP), AX
. . 10cc158: MOVQ AX, 0x30(SP)
. . 10cc15d: LEAQ runtime.types+196608(SB), CX ;index.go:31
. . 10cc164: MOVQ CX, 0(SP)
. . 10cc168: CALL runtime.newobject(SB)
. . 10cc16d: MOVQ 0x8(SP), AX
;index.go:28
. . 10cc172: LEAQ go.itab.*erichgess/wordladder/vendor/github.com/spaolacci/murmur3.digest64,hash.Hash64(SB), CX
. . 10cc179: MOVQ CX, 0(AX)
. . 10cc17c: CMPL $0x0, runtime.writeBarrier(SB)
. . 10cc183: JNE 0x10cc213
. . 10cc189: MOVQ 0x28(SP), CX
. . 10cc18e: MOVQ CX, 0x8(AX)
. . 10cc192: MOVQ $0x0, 0x30(AX) ;index.go:29
. . 10cc19a: MOVQ 0x58(SP), CX
. . 10cc19f: MOVQ CX, 0x38(AX)
. . 10cc1a3: CMPL $0x0, runtime.writeBarrier(SB)
. . 10cc1aa: JNE 0x10cc1fd
. . 10cc1ac: MOVQ 0x30(SP), CX
. . 10cc1b1: MOVQ CX, 0x28(AX)
. . 10cc1b5: MOVQ 0x50(SP), CX ;index.go:30
. . 10cc1ba: MOVQ CX, 0x18(AX)
. . 10cc1be: MOVQ CX, 0x20(AX)
. . 10cc1c2: CMPL $0x0, runtime.writeBarrier(SB)
. . 10cc1c9: JNE 0x10cc1e7
. . 10cc1cb: MOVQ 0x38(SP), DX
. . 10cc1d0: MOVQ DX, 0x10(AX)
. . 10cc1d4: MOVQ CX, 0x40(AX) ;index.go:31
. . 10cc1d8: MOVQ AX, 0x60(SP) ;index.go:27
. . 10cc1dd: MOVQ 0x40(SP), BP
. . 10cc1e2: ADDQ $0x48, SP
. . 10cc1e6: RET
. . 10cc1e7: LEAQ 0x10(AX), DI ;index.go:30
. . 10cc1eb: MOVQ AX, DX ;index.go:31
. . 10cc1ee: MOVQ 0x38(SP), AX ;index.go:30
. . 10cc1f3: CALL runtime.gcWriteBarrier(SB)
. . 10cc1f8: MOVQ DX, AX ;index.go:31
. . 10cc1fb: JMP 0x10cc1d4 ;index.go:30
. . 10cc1fd: LEAQ 0x28(AX), DI ;index.go:29
. . 10cc201: MOVQ AX, CX ;index.go:31
. . 10cc204: MOVQ 0x30(SP), AX ;index.go:29
. . 10cc209: CALL runtime.gcWriteBarrier(SB)
. . 10cc20e: MOVQ CX, AX ;index.go:30
. . 10cc211: JMP 0x10cc1b5 ;index.go:29
. . 10cc213: LEAQ 0x8(AX), DI ;index.go:28
. . 10cc217: MOVQ AX, CX ;index.go:31
. . 10cc21a: MOVQ 0x28(SP), AX ;index.go:28
. . 10cc21f: CALL runtime.gcWriteBarrier(SB)
. . 10cc224: MOVQ CX, AX ;index.go:29
. . 10cc227: JMP 0x10cc192 ;index.go:28
. . 10cc22c: MOVQ CX, 0(SP) ;murmur64.go:22
. . 10cc230: LEAQ runtime.types+201504(SB), AX
. . 10cc237: MOVQ AX, 0x8(SP)
. . 10cc23c: LEAQ runtime.types+157120(SB), AX
. . 10cc243: MOVQ AX, 0x10(SP)
. . 10cc248: CALL runtime.panicdottypeI(SB)
. . 10cc24d: NOPL
. . 10cc24e: CALL runtime.morestack_noctxt(SB) ;index.go:22
. . 10cc253: JMP main.newIndex(SB)
. . 10cc258: INT $0x3
. . 10cc259: INT $0x3
. . 10cc25a: INT $0x3
. . 10cc25b: INT $0x3
. . 10cc25c: INT $0x3
. . 10cc25d: INT $0x3
. . 10cc25e: INT $0x3
ROUTINE ======================== runtime.main
0 2.63s (flat, cum) 48.26% of Total
. . 102caf0: MOVQ GS:0x30, CX ;proc.go:113
. . 102caf9: CMPQ 0x10(CX), SP
. . 102cafd: JBE 0x102ce70
. . 102cb03: SUBQ $0x78, SP
. . 102cb07: MOVQ BP, 0x70(SP)
. . 102cb0c: LEAQ 0x70(SP), BP
. . 102cb11: MOVQ GS:0x30, AX ;proc.go:114
. . 102cb1a: MOVQ AX, 0x68(SP)
. . 102cb1f: MOVQ 0x30(AX), CX ;proc.go:118
. . 102cb23: MOVQ 0(CX), CX
. . 102cb26: MOVQ $0x0, 0x130(CX)
;proc.go:124
. . 102cb31: MOVQ $0x3b9aca00, runtime.maxstacksize(SB)
. . 102cb3c: MOVB $0x1, runtime.mainStarted(SB) ;proc.go:130
. . 102cb43: LEAQ go.func.*+956(SB), CX ;proc.go:133
. . 102cb4a: MOVQ CX, 0(SP)
. . 102cb4e: CALL runtime.systemstack(SB)
. . 102cb53: MOVQ GS:0x30, AX ;proc.go:3550
. . 102cb5c: MOVQ 0x30(AX), AX
. . 102cb60: NOPL ;proc.go:144
. . 102cb61: INCL 0x274(AX) ;proc.go:3550
. . 102cb67: MOVQ GS:0x30, AX ;proc.go:3511
. . 102cb70: MOVQ 0x30(AX), CX ;proc.go:3512
. . 102cb74: NOPL ;proc.go:3551
. . 102cb75: MOVQ AX, DX ;runtime2.go:254
. . 102cb78: MOVQ AX, 0x168(CX)
. . 102cb7f: MOVQ 0x30(DX), AX ;proc.go:3513
. . 102cb83: MOVQ AX, 0xd8(DX) ;runtime2.go:292
. . 102cb8a: MOVQ 0x68(SP), AX ;proc.go:146
. . 102cb8f: MOVQ 0x30(AX), AX
. . 102cb93: LEAQ runtime.m0(SB), CX
. . 102cb9a: CMPQ CX, AX
. . 102cb9d: JNE 0x102ce56
. . 102cba3: LEAQ runtime..inittask(SB), AX ;proc.go:150
. . 102cbaa: MOVQ AX, 0(SP)
. . 102cbae: CALL runtime.doInit(SB)
. . 102cbb3: CALL runtime.nanotime(SB) ;proc.go:151
. . 102cbb8: CMPQ $0x0, 0(SP)
. . 102cbbd: JE 0x102ce3d
. . 102cbc3: MOVB $0x1, 0x27(SP) ;proc.go:156
. . 102cbc8: MOVL $0x8, 0x30(SP) ;proc.go:157
. . 102cbd0: LEAQ go.func.*+964(SB), AX
. . 102cbd7: MOVQ AX, 0x48(SP)
. . 102cbdc: LEAQ 0x27(SP), AX
. . 102cbe1: MOVQ AX, 0x60(SP)
. . 102cbe6: LEAQ 0x30(SP), AX
. . 102cbeb: MOVQ AX, 0(SP)
. . 102cbef: CALL runtime.deferprocStack(SB)
. . 102cbf4: TESTL AX, AX
. . 102cbf6: JNE 0x102cdc9
. . 102cbfc: CALL runtime.nanotime(SB) ;proc.go:164
. . 102cc01: MOVQ 0(SP), AX
. . 102cc05: MOVQ AX, runtime.runtimeInitTime(SB)
. . 102cc0c: CALL runtime.gcenable(SB) ;proc.go:166
. . 102cc11: LEAQ runtime.types+83424(SB), AX ;proc.go:168
. . 102cc18: MOVQ AX, 0(SP)
. . 102cc1c: MOVQ $0x0, 0x8(SP)
. . 102cc25: CALL runtime.makechan(SB)
. . 102cc2a: MOVQ 0x10(SP), AX
. . 102cc2f: CMPL $0x0, runtime.writeBarrier(SB)
. . 102cc36: JNE 0x102cdb8
. . 102cc3c: MOVQ AX, runtime.main_init_done(SB)
. . 102cc43: CMPB $0x0, runtime.iscgo(SB) ;proc.go:169
. . 102cc4a: JE 0x102ccba
. . 102cc4c: CMPQ $0x0, __cgo_thread_start(SB) ;proc.go:170
. . 102cc54: JE 0x102ce24
. . 102cc5a: CMPQ $0x0, runtime._cgo_setenv(SB) ;proc.go:174
. . 102cc62: JE 0x102ce0b
. . 102cc68: CMPQ $0x0, runtime._cgo_unsetenv(SB) ;proc.go:177
. . 102cc70: JE 0x102cdf2
;proc.go:181
. . 102cc76: CMPQ $0x0, __cgo_notify_runtime_init_done(SB)
. . 102cc7e: JE 0x102cdd9
. . 102cc84: XORL AX, AX ;proc.go:1865
. . 102cc86: LEAQ runtime.newmHandoff+32(SB), CX
. . 102cc8d: MOVL $0x1, DX
. . 102cc92: LOCK CMPXCHGL DX, 0(CX)
. . 102cc96: SETE CL
. . 102cc99: TESTL CL, CL
. . 102cc9b: JNE 0x102cd9a
;proc.go:187
. . 102cca1: MOVQ __cgo_notify_runtime_init_done(SB), AX
. . 102cca8: MOVQ AX, 0(SP)
. . 102ccac: MOVQ $0x0, 0x8(SP)
. . 102ccb5: CALL runtime.cgocall(SB)
. . 102ccba: LEAQ main..inittask(SB), AX ;proc.go:190
. . 102ccc1: MOVQ AX, 0(SP)
. . 102ccc5: CALL runtime.doInit(SB)
. . 102ccca: MOVQ runtime.main_init_done(SB), AX ;proc.go:192
. . 102ccd1: MOVQ AX, 0(SP)
. . 102ccd5: CALL runtime.closechan(SB)
. . 102ccda: MOVB $0x0, 0x27(SP) ;proc.go:194
. . 102ccdf: CALL runtime.unlockOSThread(SB) ;proc.go:195
. . 102cce4: CMPB $0x0, runtime.isarchive(SB) ;proc.go:197
. . 102cceb: JNE 0x102cd8a
. . 102ccf1: CMPB $0x0, runtime.islibrary(SB)
. . 102ccf8: JNE 0x102cd8a
. . 102ccfe: MOVQ go.func.*+972(SB), AX ;proc.go:203
. . 102cd05: LEAQ go.func.*+972(SB), DX
. 2.63s 102cd0c: CALL AX ;runtime.main proc.go:203
. . 102cd0e: MOVL runtime.runningPanicDefers(SB), AX ;proc.go:212
. . 102cd14: TESTL AX, AX
. . 102cd16: JE 0x102cd4c
. . 102cd18: XORL AX, AX
. . 102cd1a: JMP 0x102cd3a ;proc.go:214
. . 102cd1c: MOVQ AX, 0x28(SP)
. . 102cd21: NOPL ;proc.go:218
. . 102cd22: LEAQ go.func.*+900(SB), AX ;proc.go:269
. . 102cd29: MOVQ AX, 0(SP)
. . 102cd2d: CALL runtime.mcall(SB)
. . 102cd32: MOVQ 0x28(SP), AX ;proc.go:214
. . 102cd37: INCQ AX
. . 102cd3a: CMPQ $0x3e8, AX
. . 102cd40: JGE 0x102cd4c
. . 102cd42: MOVL runtime.runningPanicDefers(SB), CX ;proc.go:215
. . 102cd48: TESTL CX, CX
. . 102cd4a: JNE 0x102cd1c
. . 102cd4c: MOVL runtime.panicking(SB), AX ;proc.go:221
. . 102cd52: TESTL AX, AX
. . 102cd54: JNE 0x102cd6c
. . 102cd56: MOVL $0x0, 0(SP) ;proc.go:225
. . 102cd5d: CALL runtime.exit(SB)
. . 102cd62: XORL AX, AX ;proc.go:228
. . 102cd64: MOVL $0x0, 0(AX)
. . 102cd6a: JMP 0x102cd62
. . 102cd6c: XORPS X0, X0 ;proc.go:222
. . 102cd6f: MOVUPS X0, 0(SP)
. . 102cd73: MOVW $0x1008, 0x10(SP)
. . 102cd7a: MOVQ $0x1, 0x18(SP)
. . 102cd83: CALL runtime.gopark(SB)
. . 102cd88: JMP 0x102cd56
. . 102cd8a: NOPL ;proc.go:200
. . 102cd8b: CALL runtime.deferreturn(SB)
. . 102cd90: MOVQ 0x70(SP), BP
. . 102cd95: ADDQ $0x78, SP
. . 102cd99: RET
. . 102cd9a: LEAQ go.func.*+1516(SB), AX ;proc.go:1868
. . 102cda1: MOVQ AX, 0(SP)
. . 102cda5: MOVQ $0x0, 0x8(SP)
. . 102cdae: CALL runtime.newm(SB)
. . 102cdb3: JMP 0x102cca1 ;proc.go:186
. . 102cdb8: LEAQ runtime.main_init_done(SB), DI ;proc.go:168
. . 102cdbf: CALL runtime.gcWriteBarrier(SB)
. . 102cdc4: JMP 0x102cc43
. . 102cdc9: NOPL ;proc.go:157
. . 102cdca: CALL runtime.deferreturn(SB)
. . 102cdcf: MOVQ 0x70(SP), BP
. . 102cdd4: ADDQ $0x78, SP
. . 102cdd8: RET
. . 102cdd9: LEAQ go.string.*+25332(SB), AX ;proc.go:182
. . 102cde0: MOVQ AX, 0(SP)
. . 102cde4: MOVQ $0x25, 0x8(SP)
. . 102cded: CALL runtime.throw(SB)
. . 102cdf2: LEAQ go.string.*+11989(SB), AX ;proc.go:178
. . 102cdf9: MOVQ AX, 0(SP)
. . 102cdfd: MOVQ $0x15, 0x8(SP)
. . 102ce06: CALL runtime.throw(SB)
. . 102ce0b: LEAQ go.string.*+9904(SB), AX ;proc.go:175
. . 102ce12: MOVQ AX, 0(SP)
. . 102ce16: MOVQ $0x13, 0x8(SP)
. . 102ce1f: CALL runtime.throw(SB)
. . 102ce24: LEAQ go.string.*+15120(SB), AX ;proc.go:171
. . 102ce2b: MOVQ AX, 0(SP)
. . 102ce2f: MOVQ $0x19, 0x8(SP)
. . 102ce38: CALL runtime.throw(SB)
. . 102ce3d: LEAQ go.string.*+13965(SB), AX ;proc.go:152
. . 102ce44: MOVQ AX, 0(SP)
. . 102ce48: MOVQ $0x17, 0x8(SP)
. . 102ce51: CALL runtime.throw(SB)
. . 102ce56: LEAQ go.string.*+13084(SB), AX ;proc.go:147
. . 102ce5d: MOVQ AX, 0(SP)
. . 102ce61: MOVQ $0x16, 0x8(SP)
. . 102ce6a: CALL runtime.throw(SB)
. . 102ce6f: NOPL
. . 102ce70: CALL runtime.morestack_noctxt(SB) ;proc.go:113
. . 102ce75: JMP runtime.main(SB)
. . 102ce7a: INT $0x3
. . 102ce7b: INT $0x3
. . 102ce7c: INT $0x3
. . 102ce7d: INT $0x3
. . 102ce7e: INT $0x3
|
;----------------------------------------------------------------------
; remove.asm - user-callable entry point to _unlink() function.
;----------------------------------------------------------------------
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.0 $
include rules.asi
include entry.inc
Entry@ remove, _unlink, _RTLENTRYF, 4
Entry@ _wremove, _wunlink, _RTLENTRYF, 4
end
|
; A265100: a(n) = 9*A005836(n) + 5, n >= 1.
; 5,14,32,41,86,95,113,122,248,257,275,284,329,338,356,365,734,743,761,770,815,824,842,851,977,986,1004,1013,1058,1067,1085,1094,2192,2201,2219,2228,2273,2282,2300,2309,2435,2444,2462,2471,2516,2525
mov $2,$0
div $0,2
seq $0,240400 ; Numbers n having a partition into distinct parts of form 3^k-2^k.
add $0,$2
mul $0,9
add $0,5
|
; void __CALLEE__ *HeapAlloc_callee(void *heap, unsigned int size)
; 12.2006 aralbrec
SECTION code_clib
PUBLIC HeapAlloc_callee
PUBLIC _HeapAlloc_callee
PUBLIC asm_HeapAlloc
.HeapAlloc_callee
._HeapAlloc_callee
pop hl
pop bc
ex (sp),hl
.asm_HeapAlloc
; Allocate memory from the indicated heap. First fit algorithm.
;
; Each block in list of free blocks formatted like this:
;
; +----------------------+
; | |
; +-- size (2 bytes) --+
; | |
; +----------------------+
; | |
; +-- next (2 bytes) --+
; | |
; +----------------------+
; | |
; | available bytes |
; | |
; +----------------------+
;
; size includes the two bytes used for the next pointer but not
; the two bytes used for size. The allocated block will begin
; at the address of the next pointer, leaving the two bytes for
; size as overhead for each block.
;
; enter : hl = & heap pointer
; bc = request size in bytes
; exit : hl = address of memory block and carry set if successful
; else 0 and no carry if failed
; uses : af, bc, de, hl
.MAHeapAlloc
inc hl
inc hl
ld a,b ; requests must be at least 2 bytes
or a
jp nz, loop
ld a,c
cp 2
jp nc, loop
ld c,2
.loop
; hl = & last block's next pointer
; bc = size
ld a,(hl)
inc hl
push hl ; save & lagger's next + 1b
ld h,(hl)
ld l,a ; hl = & next block
or h
jr z, exit0 ; if no next block, return with hl=0 and nc for fail
; hl = & block
; bc = size
; stack = & lagger->next + 1b
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl ; hl = block's size, de = & block + 1b
IF __CPU_INTEL__ || __CPU_GBZ80__
ld a,l
sub c
ld l,a
ld a,h
sbc b
ld h,a
ELSE
sbc hl,bc ; is block size at least as big as requested?
ENDIF
jr nc, foundblk ; if so branch to foundblk
pop hl ; junk lagger on stack
ex de,hl
inc hl ; hl = & block->next
jp loop ; try again with next block
.foundblk
; bc = size
; de = & block + 1b
; hl = block's excess size
; stack = & lagger->next + 1b
push bc
ld bc,4
IF __CPU_INTEL__ || __CPU_GBZ80__
ld a,l
sub c
ld l,a
ld a,h
sbc b
ld h,a
ELSE
sbc hl,bc
ENDIF
pop bc
jr c, usewholeblk ; if too small to split, use whole block
.splitblk
; bc = size
; de = & block + 1b
; hl = size remaining of block after allocation satisfied - 2
; stack = & lagger->next + 1b
inc hl
inc hl
ex de,hl ; de = size of remaining part of block
dec hl ; hl = & block
ld (hl),e ; write new block size
inc hl
ld (hl),d
inc hl ; hl = & block->next
add hl,de ; skip over part of block we're leaving behind
ld (hl),c ; write the allocated block's size
inc hl
ld (hl),b
inc hl ; hl = & allocated memory block
pop de ; junk lagger
scf ; indicate success
ret
.usewholeblk
; bc = size
; de = & block + 1b
; stack = & lagger->next + 1b
inc de
inc de ; de = & block->next + 1b
pop hl ; hl = & lagger->next + 1b
ex de,hl
IF __CPU_INTEL__ || __CPU_GBZ80__
ld a,(hl)
ld (de),a
inc hl
inc de
dec bc
ELSE
ldd ; write next block after this one into lagger's pointer
ENDIF
ld a,(hl) ; hl = & allocated memory block = & block->next
ld (de),a
scf ; indicate success
ret
.exit0
pop de ; junk lagger on stack
ret
|
;*****************************************************************************
;* deblock-a.asm: x86 deblocking
;*****************************************************************************
;* Copyright (C) 2005-2018 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 64
load_bytes_zmm_shuf: dd 0x50404032, 0x70606053, 0xd0c0c0b4, 0xf0e0e0d5
dd 0x50404036, 0x70606057, 0xd0c0c0b8, 0xf0e0e0d9
dd 0x50104001, 0x70306023, 0xd090c083, 0xf0b0e0a5
dd 0x50104005, 0x70306027, 0xd090c087, 0xf0b0e0a9
load_bytes_ymm_shuf: dd 0x06050403, 0x0e0d0c1b, 0x07060544, 0x0f0e0d5c
dd 0x06050473, 0x0e0d0c2b, 0x07060534, 0x0f0e0d6c
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
%ifnum sizeof%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
punpckhdq m2, m0, m1
punpckldq m0, m1
movq m4, %5
movq m6, %6
movq m5, %7
movq m7, %8
punpcklwd m4, m6
punpcklwd m5, m7
punpckhdq m6, m4, m5
punpckldq m4, 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_XMM 2 ; src, aligned
%if %2
mova m2, [%1-4]
mova m1, [%1+12]
%else
movu m2, [%1-4]
movu m1, [%1+12]
%endif
psllq m0, m2, 8
shufps m2, m1, q3131 ; cur nnz, all rows
psllq m1, 8
shufps m0, m1, q3131 ; left neighbors
%if cpuflag(avx) || (%2 && cpuflag(ssse3))
palignr m1, m2, [%1-20], 12
%else
pslldq m1, m2, 4
movd m3, [%1-8]
por m1, m3 ; top neighbors
%endif
%endmacro
%if UNIX64
DECLARE_REG_TMP 5
%else
DECLARE_REG_TMP 4
%endif
%macro DEBLOCK_STRENGTH_XMM 0
cglobal deblock_strength, 5,5,7
; Prepare mv comparison register
shl r4d, 8
add r4d, 3 - (1<<8)
movd m6, r4d
movifnidn t0d, r5m
SPLATW m6, m6
pxor m4, m4 ; bs0
pxor m5, m5 ; bs1
.lists:
; Check refs
LOAD_BYTES_XMM ref, 0
pxor m0, m2
pxor m1, m2
por m4, m0
por m5, m1
; Check mvs
%if cpuflag(ssse3) && notcpuflag(avx)
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 t0d
jge .lists
; Check nnz
LOAD_BYTES_XMM nnz, 1
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, m6 ; EFGH JKLM FGHI KLMN OPQR TUVW PQRS UVWX
vpermq m1, m0, q3131 ; FGHI KLMN PQRS UVWX x2
vpbroadcastd m2, [%1-8] ; ABCD ....
vpblendd m0, m0, m2, 0x80
vpermd m0, m7, m0 ; EFGH JKLM OPQR TUVW ABCD FGHI KLMN PQRS
%endmacro
INIT_YMM avx2
cglobal deblock_strength, 5,5,8
mova m6, [load_bytes_ymm_shuf]
; Prepare mv comparison register
shl r4d, 8
add r4d, 3 - (1<<8)
movd xm5, r4d
movifnidn t0d, r5m
vpbroadcastw m5, xm5
psrld m7, m6, 4
pxor m4, m4 ; bs0,bs1
.lists:
; Check refs
LOAD_BYTES_YMM ref
pxor m0, m1
por m4, m0
; Check mvs
movu xm0, [mv+0*4*8-4]
vinserti128 m0, m0, [mv-1*4*8 ], 1
vbroadcasti128 m2, [mv+0*4*8 ]
vinserti128 m1, m2, [mv+1*4*8-4], 0
psubw m0, m2
vbroadcasti128 m2, [mv+1*4*8 ]
psubw m1, m2
packsswb m0, m1
vinserti128 m1, m2, [mv+2*4*8-4], 0
vbroadcasti128 m3, [mv+2*4*8 ]
vinserti128 m2, m3, [mv+3*4*8-4], 0
psubw m1, m3
vbroadcasti128 m3, [mv+3*4*8 ]
psubw m2, m3
packsswb m1, m2
pabsb m0, m0
pabsb m1, m1
psubusb m0, m5
psubusb m1, m5
packsswb m0, m1
por m4, m0
add r1, 40
add r2, 4*8*5
dec t0d
jge .lists
; Check nnz
LOAD_BYTES_YMM nnz
mova m2, [pb_1]
por m0, m1
pminub m0, m2
pminub m4, m2 ; mv ? 1 : 0
paddb m0, m0 ; nnz ? 2 : 0
pmaxub m0, m4
vextracti128 [bs1], m0, 1
pshufb xm0, [transpose_shuf]
mova [bs0], xm0
RET
%macro LOAD_BYTES_ZMM 1
vpermd m1, m6, [%1-12]
pshufb m1, m7 ; EF FG GH HI JK KL LM MN OP PQ QR RS TU UV VW WX
%endmacro ; AF BG CH DI FK GL HM IN KP LQ MR NS PU QV RW SX
INIT_ZMM avx512
cglobal deblock_strength, 5,5
mova m6, [load_bytes_zmm_shuf]
shl r4d, 8
add r4d, 3 - (1<<8)
vpbroadcastw m5, r4d
mov r4d, 0x34cc34cc ; {1,-1} * 11001100b
kmovb k1, r4d
vpbroadcastd m4, r4d
movifnidn t0d, r5m
psrld m7, m6, 4
pxor xm3, xm3
.lists:
vbroadcasti64x2 m2, [mv+32]
vinserti64x2 m0, m2, [mv-32], 2
vbroadcasti64x2 m1, [mv+ 0]
vinserti64x2 m0, m0, [mv- 4], 0
vbroadcasti64x2 m1 {k1}, [mv+64]
vinserti64x2 m0, m0, [mv+60], 1
psubw m0, m1
vinserti64x2 m1, m1, [mv+28], 0
vbroadcasti64x2 m2 {k1}, [mv+96]
vinserti64x2 m1, m1, [mv+92], 1
psubw m1, m2
packsswb m0, m1
pabsb m0, m0
psubusb m0, m5
LOAD_BYTES_ZMM ref
pmaddubsw m1, m4 ; E-F F-G G-H H-I ...
vpternlogd m3, m0, m1, 0xfe ; m3 | m0 | m1
add r1, 40
add r2, 4*8*5
dec t0d
jge .lists
LOAD_BYTES_ZMM nnz
mova ym2, [pb_1]
vptestmw k1, m1, m1
vptestmw k2, m3, m3
vpaddb ym0 {k1}{z}, ym2, ym2 ; nnz ? 2 : 0
vpmaxub ym0 {k2}, ym2 ; mv ? 1 : 0
vextracti128 [bs1], ym0, 1
pshufb xm0, [transpose_shuf]
mova [bs0], xm0
RET
|
#ifndef __SVRG_HXX__
#define __SVRG_HXX__
#include "random.hxx"
#include "ifunction.hxx"
#include "ioptimizer.hxx"
namespace Optimastic {
template <typename Function>
class SVRG : public IOptimizer<Function> {
public:
// typedefs
static const int Dimension = Function::Dimension;
typedef typename Function::Domain Domain;
SVRG(Function f, Domain initial_condition,
double step_size, double decay_offset,
size_t mb_size, random_int<Dimension> *prng_ptr)
: _current_min(initial_condition)
, _step_size(step_size)
, _decay(decay_offset)
, _mb_size(mb_size)
, _mb_nsteps(0)
, _prng_ptr(prng_ptr)
{
this->_current_step = 1; // actual step, not zero indexed, since we divide by this
}
void run_single_batch() {
size_t steps_left = _mb_size;
_mb_lru_gradient = this->_f.full_gradient(_current_min);
// mb_accum will serve as w_t in Algortihm 1 from the paper
//
// "Accelerating Stochastic Gradient Descent using Predictive Variance Reduction"
// Johnson, Zhang, NIPS, 2014
//
Domain mb_accum = _current_min;
while (steps_left > 0) {
// Setup loop constants
double prefactor = -_step_size / (_decay + this->_current_step);
int i = _prng_ptr->generate();
// Compute partial gradient diff
Domain grad_diff;
for (int i=0; i<Dimension; i++)
grad_diff[i] = 0;
// SVRG performs the following iterate:
//
// w[t] = w[t-1] - step * ( grad_f(w[t-1]) - grad_f[_current_min] + _mb_lru_gradient )
//
this->_f.accum_partial_gradient(i, mb_accum, mb_accum, prefactor);
this->_f.accum_partial_gradient(i, _current_min, mb_accum, -prefactor);
mb_accum += prefactor * _mb_lru_gradient;
// Step update
this->_current_step++;
steps_left--;
}
_current_min = mb_accum;
_mb_nsteps++;
}
void run_optimizer(size_t k) {
for (int i=0; i<k; i++) {
run_single_batch();
}
}
const Domain& argmin() const {
return _current_min;
}
const double min() const {
return this->_f(_current_min);
}
void print_step_state() const {
std::cout << "SVRG has complete a total of " << _mb_nsteps << " minibatch steps and " << this->_current_step << " total steps\n";
}
private:
// N.B. No momentum, because variance accelerated SGD w/ momentum is Katyusha
Domain _current_min;
// Generic SGD parameters
double _step_size;
double _decay;
// minibatch parameters
Domain _mb_lru_gradient;
size_t _mb_size;
size_t _mb_nsteps;
random_int<Dimension> *_prng_ptr;
};
} // namespace Optimastic
#endif
|
;
; m328-GPS-clock.asm
;
; Created: 7/16/2016 12:31:18 PM
; Author : lynf
;
;
;######################################################################################
; This software is Copyright by Francis Lyn and is issued under the following license:
;
; Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
;
;######################################################################################
;
;
; This file is used as a folder for all versions of m328-GPS-clock.asm to
; assemble, link and test the program.
;
; Notes:
; ======
;
; Must have TWI pull-up termination resistors installed else
; interface will not work!
;
.include "m328-GPS-clock(testing).asm"
;
;
.exit
;
|
; A078039: Expansion of (1-x)/(1+x-2*x^2+x^3).
; Submitted by Christian Krause
; 1,-2,4,-9,19,-41,88,-189,406,-872,1873,-4023,8641,-18560,39865,-85626,183916,-395033,848491,-1822473,3914488,-8407925,18059374,-38789712,83316385,-178955183,384377665,-825604416,1773314929,-3808901426,8181135700,-17572253481,37743426307,-81069068969
mov $3,1
lpb $0
sub $0,1
add $1,$3
add $2,$1
add $3,$2
mov $4,$1
sub $4,1
add $3,$4
mul $3,-1
lpe
mov $0,$3
|
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG,DS:CODE_SEG,ES:CODE_SEG
ORG 100H ;Start off right for a .COM file
ENTRY: JMP LOCATE ;Skip over Data area
COPY_RIGHT DB '(C)1985 S.Holzner' ;Author's Mark
FOUND_MSG DB 13,10,13,10,'FOUND IN $' ;Like it says
LEN DW 1 ;The file length (low word)
PATH_LEN DW 0 ;Length of Path.Dat
NUMBER DW 0 ;Number of bytes read from file
EXTRA_PATHS DB 0 ;=1 if we open & use Path.Dat
OLD_BX DW 0 ;Save pointer to path at CS:DBH
OLD_SI DW 0 ;Save SI as pointer also
START_FLAG DB 0 ;For searches in Path.Dat
PATH_DAT DB "\PATH.DAT",0 ;ASCIIZ string of Path.Dat
LOCATE PROC NEAR ;Here we go
MOV DX,0B0H ;Move Disk Transfer Area to CS:0B0H
MOV AH,1AH ;Matched file information goes there
INT 21H
MOV DI,5CH ;Use CS:5CH to put '*.*'0 at for search
CALL PUT ; in current directory
MOV DX,5CH ;Point to '*.*'0 for search
MOV AH,4EH ; and find first matching file
INT 21H ;Match now at DTA, 0B0H
LOOP: ;Loop over matches now
MOV BX,0CAH ;Get file length, came from match
MOV DX,[BX]
MOV LEN,DX ;Store in Len
CMP DX,60*1024 ;Don't write over stack, allow < 64K files
JB NOT_BIG ;Range extender (Find > 127 bytes ahead)
JMP FIND
NOT_BIG:CMP DX,0 ;Was this a 0 length file (disk dir or label)?
JA FILE_OK ;No, go on and read it
JMP FIND ;Yes, find next file and skip this one
FILE_OK:CALL READ_FILE ;Get the file into memory
MOV CX,NUMBER ;Prepare to loop over all read bytes
MOV DI,OFFSET PATHS+300 ;File starts at Offset Paths+300
SEARCH: ;Use Repne Scasb & DI to search for the
MOV BX,82H ;first letter of the string, which is at CS:82H
MOV AL,BYTE PTR [BX] ;Load into AL for Repne Scasb
REPNE SCASB ;Find first letter
JCXZ FIND ;If out of file to search, find next file
MOV BX,80H ;How many chars in string? Get from CS:80H
XOR DX,DX ;Set DX to zero
MOV DL,[BX] ;Get # of chars in string
DEC DX ;Get rid of space typed after 'Locate'
MOV SI,83H ;Search from second typed letter (1st matched)
CPLOOP: DEC DX ;Loop counter
CMPSB ;See how far we get until no match
JZ CPLOOP
DEC DI ;At end, reset DI (Scasb increments 1 too much)
CMP DX,0 ;If DX is not zero, all letters did not match
JA SEARCH ;If not a match, go back and get next one
LEA DX,FOUND_MSG ;FILE HAS BEEN FOUND, so say so.
MOV AH,9 ;Request string search
INT 21H
MOV AH,2 ;Now to print filename. Without Path.Dat, at
MOV BX,0DBH ; CS:CEH, with Path.Dat at CS:DBH
CMP EXTRA_PATHS,1 ; Using Path.Dat yet?
JE PRINT ;Yes, print
MOV BX,0CEH ;No, reset BX to point to CS:CEH
PRINT: MOV DL,[BX] ;Print out the filename until 0 found
CMP DL,0 ;Is it 0?
JE MORE ;If yes,print out sample at More:
INT 21H ;Print filename character
INC BX ;Point to next character
JMP PRINT ;Go back relentlessly until done
MORE: PUSH DI ;Save DI,BX,CX
PUSH BX
PUSH CX
MOV CX,40 ;Prepare to type out total of 40 characters
MOV AH,2 ;With Int 21H service 2
MOV DL,':' ;But first, add ':' to filename
INT 21H ;And a carriage return linefeed
MOV DL,13
INT 21H
MOV DL,10
INT 21H
SUB DI,20 ;DI points to end of found string, move back
MOV BX,OFFSET PATHS+300 ;Beginning of file
CMP DI,BX ;If before beginning, start at beginning
JA GO
MOV DI,BX
GO: ADD BX,LEN ;Now BX=end of file (to check if we're past it)
SHOW: MOV DL,[DI] ;Get character from file
INC DI ;And point to next one
CMP DI,BX ;Past end?
JA SHOWS_OVER ;Yes, jump out, look for next match
CMP DL,30 ;Unprintable character?
JA POK ;No, OK
MOV DL,' ' ;Yes, make it a space
POK: INT 21H ;Print Character
LOOP SHOW ;And return for the next one
SHOWS_OVER: ;End of printout
POP CX ;Restore the registers used above
POP BX
POP DI
JMP SEARCH ;Return to search more of the file
FIND: CALL FIND_FILE ;This file done, find next match
CMP AL,18 ;AL=18 --> no match
JE OUT ;And so we leave
JMP LOOP ;If match found, go back once again
OUT: INT 20H ;End of Main Program
LOCATE ENDP
PUT PROC NEAR ;This little gem puts a '*.*'0
MOV BYTE PTR [DI],'*' ;Wherever you want it--just send
MOV BYTE PTR [DI+1],'.' ; it a value in DI. '*.*'0 is used as
MOV BYTE PTR [DI+2],'*' ; a universal wilcard in searches
MOV BYTE PTR [DI+3],0
RET
PUT ENDP
WS PROC NEAR ;Strip the bits for WordStar
CMP CX,0 ;If there is a length of 0, e.g.
JE FIN ;Directory entries, etc. do nothing.
WSLOOP: AND BYTE PTR [BX],127 ;Set top bit to zero
INC BX ;Point to next unsuspecting byte
LOOP WSLOOP ;And get it too.
FIN: RET ;To use, send this program BX and CX
WS ENDP
FIND_FILE PROC NEAR ;The file finder
MOV AH,4FH ;Try service 4FH, find next match, first
INT 21H
CMP AL,18 ;AL = 18 --> no match
JE CHECK ;Range extender.
JMP NEW
CHECK: CMP EXTRA_PATHS,1 ;Have we used path.Dat?
JE NEXT_PATH ;Yes, get next path, this one's used up
INC EXTRA_PATHS ;No, set it to 1
MOV AX,3D00H ;Request file opening for Path.Dat
LEA DX,PATH_DAT ;Point to '\PATH.DAT'0
INT 21H
JNC READ ;If there was a carry, Path.Dat not found
DONE: MOV AL,18 ;And so we exit with AL=18
JMP END
READ: MOV CX,300 ;Assume the max length for Path.Dat, 300.
MOV BX,AX ;Move found file handle into BX for read
MOV AH,3FH ;Set up for file read
LEA DX,PATHS ;Put the file at location Paths (at end)
INT 21H ;Read in the file
ADD AX,OFFSET PATHS ;Full offset of end of Path.Dat
MOV PATH_LEN,AX ;Get Path.Dat end point for loop
MOV AH,3EH ;Now close the file
INT 21H ;Close file
MOV OLD_SI,OFFSET PATHS ;Save for future path-readings
MOV CX,300 ;Get ready to Un-WordStar
MOV BX,OFFSET PATHS ;300 bytes at location Paths
CALL WS ;Strip high bit for WS
NEXT_PATH: ;Come here to find next path to search for files
MOV SI,OLD_SI ;Point to start of next path
MOV DI,5CH ;Move will be to CS:5CH for '\path\*.*0' file find
MOV BX,0DBH ;Also to CS:DBH; will assemble full path & filename
MOV START_FLAG,0 ;Start the path search
CHAR: CMP SI,PATH_LEN ;Past end of possible path names?
JGE DONE ;Yes, we're done. Leave with AL=18
CMP BYTE PTR [SI],30 ;Carriage return or linefeed?
JB NEXT ;Yes, get next char
MOV START_FLAG,1 ;First char, stop skipping chars
MOV AL,[SI] ;Get char from Path.Dat
MOV [BX],AL ;Move char to DBH
INC BX ;And increment to next location there
MOVSB ;Also move to 5CH area
JMP CHAR ;And go back for more
NEXT: CMP START_FLAG,1 ;Bad char, have we been reading a real pathname?
JE PDONE ;Yes, we've reached the end of it.
INC SI ;No, keep skipping chars to find pathname
JMP CHAR
PDONE: MOV OLD_SI,SI ;Save SI for the next path.
MOV BYTE PTR [DI],'\' ;Add '\' to both paths
MOV BYTE PTR [BX],'\'
INC BX ;Move BX on for next time
MOV OLD_BX,BX ;And save it.
INC DI ;Move to next location at 5CH and
CALL PUT ;Put '*.*'0 there to find all files.
MOV DX,5CH ;Start the search for all files in
MOV AH,4EH ; the new path.
MOV CX,0 ;Set the file attribute to 0
INT 21H
CMP AL,18 ;Did we find any new files in new path?
JE NEXT_PATH ;No, get the next path.
NEW: CMP EXTRA_PATHS,1 ;Yes,Move found filename to DBH area to
JNE END ; read it in-only if DBH area is active
MOV BX,OLD_BX ; (i.e. Extra_Paths=1). Restore BX
MOV SI,0CDH ;And point to found filename in DTA
CLOOP: INC SI ;Next letter from found filename
MOV AH,[SI] ;Move it to the DBH area so we can read
MOV [BX],AH ; in the file (needs pathname\filename)
INC BX ;Next character in 5CH area.
CMP BYTE PTR [SI],0 ;Is this the last character?
JNE CLOOP ;Nope, get next one
END: RET ;After path & filename assembled, return
FIND_FILE ENDP
READ_FILE PROC NEAR ;Looks for filename at CEH or DBH & reads it
PUSH AX ;Push everything to save it.
PUSH BX
PUSH CX
PUSH DX
MOV DX,0DBH ;Try the DBH area
CMP EXTRA_PATHS,1 ;Has it been used?
JE OK ;Yes
MOV DX,0CEH ;No, not using paths yet, use filename only, at CEH
OK: MOV AX,3D00H ;Prepare for file reading
INT 21H ;And do so.
MOV BX,AX ;Move file handle into BX to read
MOV DX,OFFSET PATHS+300 ;Read into data area at Paths+300 bytes
MOV CX,LEN ;Read the full file's length in bytes
MOV AH,3FH ;Read it in at last
INT 21H
MOV NUMBER,AX ;Number of bytes actually read.
MOV AH,3EH ;Close file
INT 21H
MOV BX,OFFSET PATHS+300 ;Clean up the Word Star high bit.
MOV CX,LEN ;For the full file
CALL WS ;Strip high bit for ws
POP DX ;Pop evrything and return
POP CX
POP BX
POP AX
RET ;Fin of Read_File
READ_FILE ENDP
PATHS: ;Here's the end of program marker
CODE_SEG ENDS
END ENTRY ;End 'Entry' so DOS starts at 'Entry'
|
;; Helpers for working with strings
%ifndef STRING_ASM
%define STRING_ASM
;-------------------------------------------------------------------------------
; Macros
;-------------------------------------------------------------------------------
; Prepend a wstring length header to arbitrary assembly.
; Example usage:
;
; foo:
; begin_wstring .size, .content
; ; Arbitrary assembly...
; end_wstring
;
; This example defines the following values:
; - foo points to a wstring containing the assembled bytes
; - foo.size is an integer constant that is the length of the string
; - foo.content points to the raw bytes inside the wstring
; Note that these labels are optional. You could omit .size and .content from
; the above example, and foo would still point to a valid wstring.
%macro begin_wstring 0-2
%push fragment
%if %0 >= 1
%1 equ %$fragment_size
%endif
%if %0 >= 2
%2 equ %$fragment_start
%endif
dw %$fragment_size
%$fragment_start:
%endmacro
%macro end_wstring 0
%$fragment_size equ $ - %$fragment_start
%pop fragment
%endmacro
; Like db, but adds a two-byte length prefix before the given string.
; Example: 'db_wstring "ABC"' is equivalent to 'db 3, 0, "ABC"'
%macro db_wstring 1
%strlen %%n %1
dw %%n
db %1
%endmacro
; Advance a register to point to the next wstring in a list.
; Usage: next_wstring si
; Does not stop at end of list; caller is responsible for checking [reg] == 0.
%macro next_wstring 1
add %1, [%1] ; Advance pointer by the number of bytes in the wstring
add %1, 2 ; plus the number of bytes in the length header
%endmacro
;-------------------------------------------------------------------------------
; Functions
;-------------------------------------------------------------------------------
section .text
; Appends a single byte onto the wstring DI.
;
; Takes AL = the byte to copy.
concat_byte_wstring:
push di
; Increment length header
mov cx, [di]
inc cx
mov [di], cx
; Write byte to end of string
inc cx ; CX = old length + 2
add di, cx ; Skip past length header and all old characters
mov [di], al
pop di
ret
; Copies bytes from SI onto the end of DI.
;
; Assumes that the bytes following the end of DI are safe to overwrite.
concat_wstring:
push di
push si
; Copy SI's bytes to end of DI
mov cx, [si] ; CX = number of bytes to append
add si, 2 ; SI = first byte to copy
next_wstring di ; DI = first byte to write to
rep movsb
; Restore original wstring pointers
pop si
pop di
; Update DI's size
mov cx, [si]
add [di], cx
ret
; Copies a wstring from SI to DI.
copy_wstring:
push di
push si
mov cx, [si]
mov [di], cx
add si, 2
add di, 2
rep movsb
pop si
pop di
ret
; Performs a case-sensitive comparison of SI and DI.
;
; Sets ZF if the two strings are equal.
cmp_wstring:
push di
push si
; Compare sizes
mov cx, [si]
cmp cx, [di]
jne .ret
; Compare the next CX characters
repe cmpsb
.ret:
pop si
pop di
ret
; Performs a case-insensitive comparison of SI and DI.
;
; Sets ZF if the two strings are equal.
icmp_wstring:
push di
push si
; Make sure the two strings are the same size
mov cx, [si]
cmp cx, [di] ; Compare the two sizes,
jne .ret ; returning ZF = 0 if they are different
; Advance to the contents of each string
add si, 2
add di, 2
; Compare the next CX characters
.loop:
lodsb ; Load character from SI
call tolower_accumulator ; and lower-case it
mov ah, al
mov al, [di] ; Load character from DI
inc di ; and lower-case it
call tolower_accumulator
cmp al, ah ; Compare the two characters,
jne .ret ; returning ZF = 0 if different.
loop .loop
; If the above loop finishes, then our final comparison set ZF = 1,
; which we reuse as our return value when we return below.
.ret:
pop si
pop di
ret
; Make the character in AL lowercase.
;
; Clobbers no registers!
tolower_accumulator:
cmp al, 'A'
jb .ret
cmp al, 'Z'
ja .ret
add al, ('a' - 'A')
.ret:
ret
; STRING_ASM
%endif
|
#include "Debug.hpp"
#include <string>
#include <iostream>
#ifdef DEBUG
#include "Timer.hpp"
#include <cassert>
//TMP SOLUTION, THIS SHOULDNT BE HERE, for gl_error_print
#include <GL/glew.h>
#include <SFML/OpenGL.hpp>
void debug_print(const std::string& _msg, const std::string& _func,const std::string& _file,int _line)
{
std::cerr << "DEBUG: " << _func << " " << _file << " " << _line << std::endl;
std::cerr << " " << _msg << std::endl << std::endl;
}
void stimer(const std::string& _name)
{
Timer::start(_name);
}
void etimer(const std::string& _name)
{
Timer::end(_name);
}
void gl_error_print(const std::string& _func,const std::string& _file,int _line)
{
GLenum glErr;
glErr = glGetError();
if (glErr != GL_NO_ERROR)
{
std::cerr << "GLError: " << _func << " " << _file << " " << _line << std::endl;
std::cerr << " " << gluErrorString(glErr) << std::endl << std::endl;
}
}
#else
void debug_print(const std::string& _msg, const std::string& _func,const std::string& _file,int _line) { }
void stimer(const std::string& _name) { }
void etimer(const std::string& _name) { }
void gl_error_print(const std::string& _func,const std::string& _file,int _line) { }
#endif
void error_print(const std::string& _msg, const std::string& _func,const std::string& _file,int _line)
{
std::cerr << "Error: " << _func << " " << _file << " " << _line << std::endl;
std::cerr << " " << _msg << std::endl << std::endl;
}
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D38 move.l D0, (A4)+
004D3A move.l D0, (A4)+
02471C tst.w ($b0,A6)
024720 beq $24762 [item+B0]
024766 move.w #$1, ($b0,A6)
02476C moveq #$12, D0 [item+B0]
024FC6 move.w D0, ($b0,A6)
024FCA move.w #$3, ($b2,A6)
024FEC move.w #$1, ($b0,A6) [item+ 2]
024FF2 move.w #$1, ($b2,A6) [item+B0]
0250A4 move.b D0, ($b0,A6)
0250A8 move.b D0, ($b1,A6)
02544C move.b ($c4,A0), ($b0,A6) [item+49]
025452 tst.b ($81,A6) [item+B0]
025548 move.b D1, ($b0,A6) [123p+ 2C]
02554C eor.b D1, D0 [item+B0]
025974 move.b ($b0,A6), D1
025978 eor.b D1, D0 [item+B0]
025A72 move.b D0, ($b0,A6)
025A76 move.b ($c4,A0), ($b0,A6)
025A7C jmp $49ca.l [item+B0]
025AD4 move.b ($c4,A0), ($b0,A6)
025ADA jmp $49ca.l
025BC0 move.b ($c4,A0), ($b0,A6)
025BC6 jmp $49ca.l [item+B0]
025BD8 move.b ($b0,A6), D1
025BDC eor.b D1, D0 [item+B0]
025C54 move.b ($c4,A0), ($b0,A6)
025C5A jmp $49ca.l [item+B0]
026162 move.b D0, ($b0,A6)
026166 jsr $3140c.l
028D60 move.b D0, ($b0,A6)
028D64 move.b D0, ($b6,A6)
02901E move.b #$2, ($b0,A6)
029024 clr.b ($25,A6) [item+B0]
029138 move.b D0, ($b0,A6)
02913C move.b #$1, ($81,A6)
02A3AE move.w ($8,A6), ($b0,A6)
02A3B4 moveq #$0, D0 [item+B0]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
; A116788: Number of permutations of length n which avoid the patterns 1234, 3142, 4132.
; Submitted by Christian Krause
; 1,2,6,21,73,240,746,2217,6371,17864,49202,133759,360175,963044,2561604,6787167,17930815,47267250,124395032,326966211,858600521,2253029402,5908876016,15490375561,40595804773,106364147270,278630854386
mov $3,1
lpb $0
sub $0,1
add $4,$2
add $2,$5
add $3,$2
add $4,$3
add $1,$4
mul $4,2
add $5,$2
add $5,1
lpe
mov $0,$1
add $0,1
|
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI=acos(-1.0);
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define SZ(c) (int)c.size()
#define PB(x) push_back(x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FF(i,L,R) for (int i = L; i <= R; i++)
#define FR(i,L,R) for (int i = L; i > R; i--)
#define FRF(i,L,R) for (int i = L; i >= R; i--)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ALL(p) p.begin(),p.end()
#define ALLR(p) p.rbegin(),p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define MEM(p, v) memset(p, v, sizeof(p))
#define CPY(d, s) memcpy(d, s, sizeof(s))
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define getC(n) scanf("%c",&n)
#define getL(n) scanf("%lld",&n)
#define getF(n) scanf("%lf",&n)
#define getS(n) scanf("%s",n)
#define vi vector < int >
#define vii vector < vector < int > >
#define pii pair< int, int >
#define psi pair< string, int >
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define ld long double
#define debug(a) { cout << a <<endl; }
#define debugI() { cout << "*" <<endl; }
#define debugII() { cout << "**" <<endl; }
#define debugIII() { cout << "***" <<endl; }
template< class T > inline T _abs(T n) { return ((n) < 0 ? -(n) : (n)); }
template< class T > inline T _max(T a, T b) { return (!((a)<(b))?(a):(b)); }
template< class T > inline T _min(T a, T b) { return (((a)<(b))?(a):(b)); }
template< class T > inline T _swap(T &a, T &b) { a=a^b;b=a^b;a=a^b;}
template< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); }
template< class T > inline T lcm(T a, T b) { return ((a) / gcd((a), (b)) * (b)); }
int main() {
//READ("in.txt");
//WRITE("out.txt");
int t;
getI(t);
for(int ci=1;ci<=t;ci++)
{
int a[3];
getIII(a[0],a[1],a[2]);
sort(a,a+3);
ll s=(ll)a[0]*(ll)a[0];
ll s1=(ll)a[1]*(ll)a[1];
ll s2=s+s1;
ll s3=(ll)a[2]*(ll)a[2];
if(s2==s3) printf("Case %d: yes\n",ci);
else printf("Case %d: no\n",ci);
}
return 0;
}
|
; A052206: Partial sums of A050405.
; 1,16,100,408,1290,3432,8052,17160,33891,62920,110968,187408,304980,480624,736440,1100784,1609509,2307360,3249532,4503400,6150430,8288280,11033100,14522040,18915975
lpb $0
mov $2,$0
sub $0,1
seq $2,50405 ; Partial sums of A051879.
add $1,$2
lpe
add $1,1
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1d880, %r14
add $33179, %r11
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
xor $54390, %r14
lea addresses_D_ht+0x177e0, %rsi
xor $42851, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, (%rsi)
nop
add %r14, %r14
lea addresses_WT_ht+0x14f80, %r13
nop
nop
nop
nop
nop
and $64679, %rbp
mov $0x6162636465666768, %rsi
movq %rsi, (%r13)
cmp %r11, %r11
lea addresses_D_ht+0x1b0c0, %rsi
lea addresses_normal_ht+0x440, %rdi
nop
nop
sub $27887, %rax
mov $30, %rcx
rep movsl
nop
nop
nop
xor %r11, %r11
lea addresses_WT_ht+0x28a, %rsi
lea addresses_normal_ht+0x1ddd8, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
sub %r13, %r13
mov $19, %rcx
rep movsq
nop
cmp $14839, %rsi
lea addresses_D_ht+0x16b20, %rsi
lea addresses_normal_ht+0x16a30, %rdi
nop
nop
nop
add %rax, %rax
mov $73, %rcx
rep movsb
nop
and %r13, %r13
lea addresses_A_ht+0x1d838, %r13
clflush (%r13)
nop
and %rbp, %rbp
movl $0x61626364, (%r13)
nop
nop
nop
xor %r13, %r13
lea addresses_UC_ht+0x1c940, %rsi
lea addresses_A_ht+0x19f80, %rdi
nop
nop
nop
nop
dec %r11
mov $108, %rcx
rep movsq
nop
nop
nop
inc %r14
lea addresses_WC_ht+0x1e380, %rsi
lea addresses_WT_ht+0x30c4, %rdi
nop
add $8116, %r14
mov $59, %rcx
rep movsl
nop
cmp $6077, %r11
lea addresses_WT_ht+0x3998, %r11
nop
nop
nop
nop
nop
cmp $63007, %rdi
mov (%r11), %r13d
nop
nop
and $30755, %rax
lea addresses_WT_ht+0x18080, %rdi
nop
nop
nop
dec %rcx
movl $0x61626364, (%rdi)
nop
nop
nop
cmp $62715, %r14
lea addresses_WT_ht+0x1ea84, %rsi
lea addresses_WC_ht+0x4380, %rdi
nop
nop
and %rbp, %rbp
mov $104, %rcx
rep movsq
nop
nop
nop
cmp $35821, %rax
lea addresses_UC_ht+0x1b4a8, %rcx
clflush (%rcx)
nop
and %rax, %rax
movw $0x6162, (%rcx)
nop
nop
nop
nop
xor $40865, %rbp
lea addresses_WT_ht+0x9bd1, %r11
clflush (%r11)
nop
nop
nop
nop
nop
dec %r14
movb (%r11), %r13b
nop
xor $44678, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %r9
push %rax
push %rbx
push %rdi
push %rdx
// Store
lea addresses_RW+0xfb40, %rdx
nop
nop
nop
nop
inc %rdi
mov $0x5152535455565758, %r10
movq %r10, %xmm1
movups %xmm1, (%rdx)
nop
nop
nop
nop
and $17312, %r8
// Store
lea addresses_PSE+0x980, %r8
nop
nop
nop
nop
nop
cmp $25984, %rbx
mov $0x5152535455565758, %r10
movq %r10, %xmm2
vmovups %ymm2, (%r8)
xor $35655, %rdx
// Store
lea addresses_UC+0x146a6, %rdx
nop
nop
nop
nop
nop
xor $44508, %rbx
mov $0x5152535455565758, %rax
movq %rax, (%rdx)
// Exception!!!
mov (0), %r8
nop
xor %r9, %r9
// Store
lea addresses_normal+0x1b240, %r10
nop
cmp $56877, %r8
mov $0x5152535455565758, %rdi
movq %rdi, %xmm4
movups %xmm4, (%r10)
nop
nop
cmp %r10, %r10
// Store
lea addresses_D+0x2310, %rbx
nop
inc %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm1
vmovups %ymm1, (%rbx)
sub %r9, %r9
// Faulty Load
lea addresses_D+0x7b80, %rbx
nop
nop
nop
nop
add %r8, %r8
mov (%rbx), %di
lea oracles, %rax
and $0xff, %rdi
shlq $12, %rdi
mov (%rax,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
dc.w byte_185BC-Ani_LightningShield
dc.w byte_185E8-Ani_LightningShield
byte_185BC: dc.b 1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7
dc.b 7, 8, 8, 9, $A, $B, $16, $16, $15, $15, $14, $14, $13, $13, $12, $12
dc.b $11, $11, $10, $10, $F, $F, $E, $E, 9, $A, $B, $FF
byte_185E8: dc.b 0, $C, $D, $17, $C, $D, $17, $C, $D, $17, $C, $D, $17, $C, $D, $17
dc.b $C, $D, $17, $C, $D, $FC, $FF
even
|
#include "scene/empty_scene.hpp"
#include "scene.hpp"
#include "global.hpp"
#include "app.hpp"
#include "stb_image.hpp"
using namespace px;
scene::EmptyScene::EmptyScene()
: BaseScene(),
gravity(0.f, -5.f, 0.f), resistance(.5f), width(50), height(50),
vao{0}, vbo{0}, texture{0},
floor_v{
// coordinates texture norm tangent
// x y z u v x y z x y z
0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
1.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
1.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
1.f, 0.f, 1.f, 1.f, 1.f, 0.f, 1.f, 0.f, 1.f, 0.f, 0.f,
}, skybox(nullptr), need_upload(false)
{}
scene::EmptyScene::~EmptyScene()
{
glDeleteVertexArrays(1, vao);
glDeleteBuffers(1, vbo);
glDeleteTextures(4, texture);
delete skybox;
}
void scene::EmptyScene::init(Scene &scene)
{
if (skybox == nullptr)
{
skybox = new SkyBox(ASSET_PATH "/texture/skybox/right.jpg",
ASSET_PATH "/texture/skybox/left.jpg",
ASSET_PATH "/texture/skybox/top.jpg",
ASSET_PATH "/texture/skybox/bottom.jpg",
ASSET_PATH "/texture/skybox/back.jpg",
ASSET_PATH "/texture/skybox/front.jpg");
glGenVertexArrays(1, vao);
glGenBuffers(1, vbo);
glGenTextures(4, texture);
int w, h, ch;
auto ptr = stbi_load(ASSET_PATH "/texture/floor6_d.png", &w, &h, &ch, 3);
TEXTURE_LOAD_HELPER(texture[0], GL_RGB, GL_REPEAT, GL_LINEAR, w, h, ptr);
stbi_image_free(ptr);
ptr = stbi_load(ASSET_PATH "/texture/floor6_n.png", &w, &h, &ch, 3);
TEXTURE_LOAD_HELPER(texture[1], GL_RGB, GL_REPEAT, GL_LINEAR, w, h, ptr);
stbi_image_free(ptr);
ptr = stbi_load(ASSET_PATH "/texture/floor6_s.png", &w, &h, &ch, 3);
TEXTURE_LOAD_HELPER(texture[2], GL_RGB, GL_REPEAT, GL_LINEAR, w, h, ptr);
stbi_image_free(ptr);
ptr = stbi_load(ASSET_PATH "/texture/floor6_h.png", &w, &h, &ch, 3);
TEXTURE_LOAD_HELPER(texture[3], GL_RGB, GL_REPEAT, GL_LINEAR, w, h, ptr);
stbi_image_free(ptr);
}
glBindVertexArray(vao[0]);
glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(floor_v), nullptr, GL_STATIC_DRAW);
ATTRIB_BIND_HELPER_WITH_TANGENT
}
void scene::EmptyScene::restart(Scene &scene)
{
auto u = std::max(1, static_cast<int>(width / 2));
auto v = std::max(1, static_cast<int>(height / 2));
floor_v[25] = u; floor_v[47] = u; floor_v[58] = u;
floor_v[4] = v; floor_v[37] = v; floor_v[59] = v;
floor_v[22] = width; floor_v[44] = width; floor_v[55] = width;
floor_v[2] = height; floor_v[35] = height; floor_v[57] = height;
scene.character.reset(0.f, scene.character.characterHeight(), 0.f, 135.f, 15.f);
scene.character.setFloating(false);
scene.opt->gravity() = gravity;
scene.opt->resistance() = resistance;
need_upload = true;
}
void scene::EmptyScene::upload(Shader &scene_shader)
{
if (!need_upload) return;
glBindVertexArray(vao[0]);
glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(floor_v), floor_v);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
scene_shader.activate();
scene_shader.set("headlight.ambient", glm::vec3(.6f, .5f, .3f));
scene_shader.set("headlight.diffuse", glm::vec3(.25f, .2f, .125f));
scene_shader.set("headlight.specular", glm::vec3(.5f, .5f, .5f));
scene_shader.set("headlight.coef_a0", 1.f);
scene_shader.set("headlight.coef_a1", .09f);
scene_shader.set("headlight.coef_a2", .032f);
scene_shader.set("global_ambient", glm::vec3(.3f, .3f, .3f));
scene_shader.activate(false);
need_upload = false;
}
void scene::EmptyScene::render(Shader &scene_shader)
{
scene_shader.activate();
scene_shader.set("use_tangent", 1);
scene_shader.set("material.parallel_height", 0.f);
scene_shader.set("material.shininess", 32.f);
scene_shader.set("material.ambient", glm::vec3(1.f, 1.f, 1.f));
scene_shader.set("material.displace_amp", 0.f);
scene_shader.set("material.displace_mid", 0.5f);
glBindVertexArray(vao[0]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture[1]);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, texture[2]);
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, texture[3]);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindVertexArray(0);
glBindTexture(GL_TEXTURE_2D, 0);
scene_shader.activate(false);
}
void scene::EmptyScene::render()
{
skybox->render();
App::instance()->text("Single Click to shoot bounce ball",
App::instance()->frameWidth() - 10, App::instance()->frameHeight() - 25, .4f,
glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
Anchor::RightTop);
}
|
; A283969: a(n) = n + 1 + Sum_({k=0..n} floor((n-k)/r, where r = (3+sqrt(5))/2).
; 1,4,10,18,29,43,59,78,99,123,150,179,211,246,283,323,365,410,458,508,561,616,674,735,798,864,933,1004,1078,1154,1233,1315,1399,1486,1576,1668,1763,1860,1960,2063,2168,2276,2386,2499,2615,2733,2854,2978,3104,3233,3364,3498,3635,3774,3916,4060,4207,4357,4509,4664,4822,4982,5145,5310,5478,5649,5822,5998,6177,6358,6542,6728,6917,7109,7303,7500,7699,7901,8106,8313,8523,8736,8951,9169,9389,9612,9838,10066,10297,10531,10767,11006,11247,11491,11738,11987,12239,12493,12750,13010,13272,13537,13805,14075,14348,14623,14901,15182,15465,15751,16039,16330,16624,16920,17219,17521,17825,18132,18441,18753,19068,19385,19705,20028,20353,20681,21011,21344,21680,22018,22359,22702,23048,23397,23748,24102,24459,24818,25180,25544,25911,26281,26653,27028,27405,27785,28168,28553,28941,29332,29725,30121,30519,30920,31324,31730,32139,32551,32965,33382,33801,34223,34648,35075,35505,35937,36372,36810,37250,37693,38139,38587,39038,39491,39947,40406,40867,41331,41798,42267,42739,43213,43690,44170,44652,45137,45624,46114,46607,47102,47600,48101,48604,49110,49618,50129,50643,51159,51678,52199,52723,53250,53779,54311,54846,55383,55923,56465,57010,57558,58108,58661,59217,59775,60336,60899,61465,62034,62605,63179,63755,64334,64916,65500,66087,66677,67269,67864,68461,69061,69664,70269,70877,71488,72101,72717,73335,73956,74580,75206,75835,76466,77100,77737,78376,79018,79663,80310,80960,81612
mov $2,$0
sub $2,1
mov $3,$2
cal $3,183136 ; a(n) = [1/r]+[2/r]+...+[n/r], where r = golden ratio = (1+sqrt(5))/2 and []=floor.
add $3,1
mov $1,$3
mov $4,$0
mul $4,2
add $1,$4
mov $5,$0
mul $5,$0
add $1,$5
|
; these macro simulate the avx instructions with lower ones
; might be confusing
macro _vaddsd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vaddsd a,b,c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
addsd a, c
else if a eq c
addsd a, b
else
movaps a, b
addsd a, c
end if
; \}
end macro
macro _vaddsd a,b,c
if CPU_HAS_AVX1
vaddsd a, b, c
else
if a eq b
addsd a, c
else
match size[addr], c
movaps a, b
addsd a, c
else
if a eq c
addsd a, b
else
movaps a, b
addsd a, c
end if
end match
end if
end if
end macro
macro _vsubsd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vsubsd a,b,c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
subsd a, c
else if a eq c
display 'arguments of vsubsd are strange for no avx1'
display 13,10
err
else
movaps a, b
subsd a, c
end if
; \}
end macro
macro _vsubpd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vsubpd a,b,c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
subpd a, c
else if a eq c
display 'arguments of vsubpd are strange for no avx1'
display 13,10
err
else
movaps a, b
subpd a, c
end if
; \}
end macro
macro _vmulsd a,b,c
if CPU_HAS_AVX1
vmulsd a, b, c
else
if a eq b
mulsd a, c
else
match size[addr], c
movaps a, b
mulsd a, c
else
if a eq c
mulsd a, b
else
movaps a, b
mulsd a, c
end if
end match
end if
end if
end macro
macro _vmulps a,b,c
if a eq b
mulps a, c
else
match size[addr], c
movaps a, b
mulps a, c
else
if a eq c
mulsd a, b
else
movaps a, b
mulps a, c
end if
end match
end if
end macro
macro _vaddps a,b,c
if a eq b
addps a, c
else
match size[addr], c
movaps a, b
addps a, c
else
if a eq c
addsd a, b
else
movaps a, b
addps a, c
end if
end match
end if
end macro
macro _vmaxps a,b,c
if a eq b
maxps a, c
else
match size[addr], c
movaps a, b
maxps a, c
else
if a eq c
maxsd a, b
else
movaps a, b
maxps a, c
end if
end match
end if
end macro
macro _vpunpckldq a,b,c
if a eq b
punpckldq a, c
else if a eq c
display 'arguments of vdivsd are strange for no avx1'
display 13,10
err
else
movaps a, b
punpckldq a, c
end if
end macro
; a = b*c+d
macro _vfmaddsd a,b,c,d
; match =1, CPU_HAS_AVX2 \{
; if a equ b
; vfmadd213sd a, c, d
; else if a equ c
; vfmadd213sd a, b, d
; else if a equ d
; vfmadd231sd a, b, c
; else
; vmovaps a, b
; vfmadd213sd a, c, d
; end if
;
; \}
; match =0, CPU_HAS_AVX2 \{
if a eq d
err 'arguments of vfmaddpd are strange for no avx2'
end if
_vmulsd a, b, c
_vaddsd a, a, d
; \}
end macro
macro _vcvtsi2sd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vcvtsi2sd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
cvtsi2sd a, c
else
movaps a, b
cvtsi2sd a, c
end if
; \}
end macro
macro _vcvtsi2ss a,b,c
; match =1, CPU_HAS_AVX1 \{
; vcvtsi2sd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
cvtsi2ss a, c
else
movaps a, b
cvtsi2ss a, c
end if
; \}
end macro
macro _vcvttsd2si a,b
; match =1, CPU_HAS_AVX1 \{
; vcvttsd2si a, b
; \}
; match =0, CPU_HAS_AVX1 \{
cvttsd2si a, b
; \}
end macro
macro _vcvttss2si a,b
; match =1, CPU_HAS_AVX1 \{
; vcvttsd2si a, b
; \}
; match =0, CPU_HAS_AVX1 \{
cvttss2si a, b
; \}
end macro
macro _vdivsd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vdivsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
divsd a, c
else if a eq c
display 'arguments of vdivsd are strange for no avx1'
display 13,10
err
else
movaps a, b
divsd a, c
end if
; \}
end macro
macro _vdivps a,b,c
; match =1, CPU_HAS_AVX1 \{
; vdivsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
divps a, c
else if a eq c
display 'arguments of vdivsd are strange for no avx1'
display 13,10
err
else
movaps a, b
divps a, c
end if
; \}
end macro
macro _vhaddps a,b,c
; match =1, CPU_HAS_AVX1 \{
; vdivsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
haddps a, c
else if a eq c
display 'arguments of vdivsd are strange for no avx1'
display 13,10
err
else
movaps a, b
haddps a, c
end if
; \}
end macro
macro _vhsubps a,b,c
; match =1, CPU_HAS_AVX1 \{
; vdivsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
hsubps a, c
else if a eq c
display 'arguments of vdivsd are strange for no avx1'
display 13,10
err
else
movaps a, b
hsubps a, c
end if
; \}
end macro
macro _vcomisd a,b
; match =1, CPU_HAS_AVX1 \{
; vcomisd a, b
; \}
; match =0, CPU_HAS_AVX1 \{
comisd a, b
; \}
end macro
macro _vmovaps a,b
; match =1, CPU_HAS_AVX1 \{
; vmovaps a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movaps a, b
; \}
end macro
macro _vmovups a,b
; match =1, CPU_HAS_AVX1 \{
; vmovups a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movups a, b
; \}
end macro
macro _vmovapd a,b
; match =1, CPU_HAS_AVX1 \{
; vmovapd a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movapd a, b
; \}
end macro
macro _vmovsd a, b, c
; match =1, CPU_HAS_AVX1 \{
; if c eq
; vmovsd a, b
; else
; vmovsd a, b, c
; end if
; \}
; match =0, CPU_HAS_AVX1 \{
match , c
SSE.movsd a, b
else
if a eq b
SSE.movsd a, c
else
movaps a, b
SSE.movsd a, c
end if
end match
; \}
end macro
macro _vmovq a,b
; match =1, CPU_HAS_AVX1 \{
; vmovq a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movq a, b
; \}
end macro
macro _vpand a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpand a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
pand a, c
else
movdqa a, b
pand a, c
end if
; \}
end macro
macro _vpsrlq a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpsrlq a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
psrlq a, c
else
movdqa a, b
psrlq a, c
end if
; \}
end macro
macro _vpunpcklbw a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpunpcklbw a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
punpcklbw a, c
else
movdqa a, b
punpcklbw a, c
end if
; \}
end macro
macro _vpaddb a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpaddb a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
paddb a, c
else
movdqa a, b
paddb a, c
end if
; \}
end macro
macro _vpcmpgtb a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpcmpgtb a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
pcmpgtb a, c
else
movdqa a, b
pcmpgtb a, c
end if
; \}
end macro
macro _vmovdqa a,b
; match =1, CPU_HAS_AVX1 \{
; vmovdqa a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movdqa a, b
; \}
end macro
macro _vmovdqu a,b
; match =1, CPU_HAS_AVX1 \{
; vmovdqu a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movdqu a, b
; \}
end macro
macro _vpxor a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpxor a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
pxor a, c
else
movdqa a, b
pxor a, c
end if
; \}
end macro
macro _vmovd a,b
; match =1, CPU_HAS_AVX1 \{
; vmovd a, b
; \}
; match =0, CPU_HAS_AVX1 \{
movd a, b
; \}
end macro
macro _vpaddd a, b, c
; match =1, CPU_HAS_AVX1 \{
; vpaddd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
paddd a, c
else
movdqa a, b
paddd a, c
end if
; \}
end macro
macro _vminsd a, b, c
; match =1, CPU_HAS_AVX1 \{
; vminsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
minsd a, c
else
movaps a, b
minsd a, c
end if
; \}
end macro
macro _vmaxsd a, b, c
; match =1, CPU_HAS_AVX1 \{
; vmaxsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
maxsd a, c
else
movaps a, b
maxsd a, c
end if
; \}
end macro
macro _vxorps a, b, c
; match =1, CPU_HAS_AVX1 \{
; vxorps a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
xorps a, c
else
movaps a, b
xorps a, c
end if
; \}
end macro
macro _vpsubd a, b, c
; match =1, CPU_HAS_AVX1 \{
; vpsubd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
psubd a, c
else
movdqa a, b
psubd a, c
end if
; \}
end macro
macro vpsrlq a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpsrlq a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
psrlq a, c
else
movdqa a, b
psrlq a, c
end if
; \}
end macro
macro vpsubw a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpsubw a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
psubw a, c
else
movdqa a, b
psubw a, c
end if
; \}
end macro
macro vpslldq a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpslldq a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
pslldq a, c
else
movdqa a, b
pslldq a, c
end if
; \}
end macro
macro vpsrldq a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpsrldq a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
psrldq a, c
else
movdqa a, b
psrldq a, c
end if
; \}
end macro
macro _vmovhlps a,b,c
; match =1, CPU_HAS_AVX1 \{
; vmovhlps a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
movhlps a, c
else
movaps a, b
movhlps a, c
end if
; \}
end macro
macro _vsqrtsd a,b,c
; match =1, CPU_HAS_AVX1 \{
; vsqrtsd a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
sqrtsd a, c
else
movaps a, b
sqrtsd a, c
end if
; \}
end macro
macro _vcvtsd2si a, b
; match =1, CPU_HAS_AVX1 \{
; vcvtsd2si a, b
; \}
; match =0, CPU_HAS_AVX1 \{
cvtsd2si a, b
; \}
end macro
macro _vpaddw a,b,c
; match =1, CPU_HAS_AVX1 \{
; vpaddw a, b, c
; \}
; match =0, CPU_HAS_AVX1 \{
if a eq b
paddw a, c
else
movdqa a, b
paddw a, c
end if
; \}
end macro
|
copyright zengfr site:http://github.com/zengfr/romhack
033954 move.b #$ff, ($a5,A6)
03395A move.b #$14, ($a9,A6) [enemy+A5]
035420 cmp.b ($a5,A6), D0
035424 bne $3542a [enemy+A5]
03542A move.b D0, ($a5,A6)
03542E jsr $119c.l [enemy+A5]
03543E move.b ($a5,A6), D0 [enemy+80]
035442 bne $3547a [enemy+A5]
036836 move.b D0, ($a5,A6)
03683A jsr $119c.l [enemy+A5]
036848 move.b ($a5,A6), D2
03684C add.w D2, D0 [enemy+A5]
0368A2 add.b ($a5,A6), D0
0368A6 lea $72954.l, A0 [enemy+A5]
0368E8 move.b D0, ($a5,A6)
0368EC jsr $119c.l [enemy+A5]
0368FA move.b ($a5,A6), D2
0368FE add.w D2, D0 [enemy+A5]
04007C move.b D0, ($a5,A6)
040080 move.b ($6,A6), ($a0,A6) [enemy+A5]
040094 move.b ($a5,A6), D2
040098 add.w D2, D0 [enemy+A5]
040136 add.b ($a5,A6), D0
04013A lea $72d94.l, A0 [enemy+A5]
040176 move.b D0, ($a5,A6)
04017A jsr $119c.l [enemy+A5]
040186 move.b ($a5,A6), D2
04018A add.w D2, D0 [enemy+A5]
040850 cmpi.b #$1, ($a5,A6)
040856 bgt $40876 [enemy+A5]
040E1E cmpi.b #$3, ($a5,A6)
040E24 bgt $41be8
041C02 move.b D0, ($a5,A6)
041C06 jsr $119c.l [enemy+A5]
041C14 move.b ($a5,A6), D2
041C18 add.w D2, D0 [enemy+A5]
041C5E add.b ($a5,A6), D0
041C62 moveq #$0, D2
041CA6 add.b ($a5,A6), D0
041CAA moveq #$0, D2 [enemy+A5]
041CE6 move.b D0, ($a5,A6)
041CEA bsr $41c46 [enemy+A5]
041CFE move.b ($a5,A6), D2
041D02 add.w D2, D0 [enemy+A5]
045856 move.b D0, ($a5,A6) [enemy+72]
04585A move.b D0, ($b6,A6)
045EEA clr.b ($a5,A6)
045EEE move.b #$1, ($a6,A6)
045F64 clr.b ($a5,A6)
045F68 jsr $119c.l
0460CE cmp.b ($a5,A6), D1
0460D2 beq $460bc [enemy+A5]
0460D4 move.b D1, ($a5,A6)
0460D8 move.b #$1, ($a6,A6) [enemy+A5]
0460E6 move.b ($a5,A6), D0
0460EA move.w ($6,PC,D0.w), D0 [enemy+A5]
0493F2 move.b #$8, ($a5,A6) [enemy+A7]
0493F8 move.b ($a4,A6), ($a6,A6) [enemy+A5]
049400 subq.b #1, ($a5,A6)
049404 bcc $49446 [enemy+A5]
04940C move.b ($3a,PC,D0.w), ($a5,A6) [enemy+A7]
049412 move.b ($a6,A6), D0 [enemy+A5]
04F456 move.b #$8, ($a5,A6) [enemy+A7]
04F45C move.b ($a4,A6), ($a6,A6) [enemy+A5]
04F468 subq.b #1, ($a5,A6)
04F46C bcc $4f4c6 [enemy+A5]
04F474 move.b ($52,PC,D0.w), ($a5,A6) [enemy+A7]
04F47A move.b ($a6,A6), D0 [enemy+A5]
0512F2 move.b D0, ($a5,A6) [enemy+25]
0512F6 jsr $12cb4.l
053900 move.b #$f, ($a5,A6)
053906 move.b #$8, ($a6,A6) [enemy+A5]
05391C move.b ($a5,A6), D0
053920 move.b ($34,PC,D0.w), ($a6,A6) [enemy+A5]
05394A subq.b #1, ($a5,A6) [enemy+23]
05394E bpl $53954 [enemy+A5]
0572CE move.b D0, ($a5,A6) [enemy+25]
0572D2 move.b #$ff, ($7d,A6)
05731C move.b #$0, ($a5,A6)
057322 moveq #$0, D0
05732E tst.b ($a5,A6) [enemy+24]
057332 bne $57340
057352 move.b #$1, ($a5,A6)
057358 bra $57340 [enemy+A5]
058120 move.b D0, ($a5,A6) [enemy+25]
058124 move.b D0, ($59,A6)
058B64 cmpi.b #$2, ($a5,A6)
058B6A bgt $58b88 [enemy+A5]
05A19A move.b D0, ($a5,A6)
05A19E tst.b ($ba,A6) [enemy+A5]
05A1CA add.b ($a5,A6), D0
05A1CE lea $73e94.l, A0 [enemy+A5]
05A1FC move.b D0, ($a5,A6)
05A200 clr.b ($ab,A6) [enemy+A5]
05A212 move.b ($a5,A6), D2
05A216 add.w D2, D0 [enemy+A5]
05A4B2 move.b D0, ($a5,A6) [enemy+25]
05A4B6 move.b D0, ($b2,A6)
05A5DC move.b #$0, ($a5,A6)
05A5E2 moveq #$0, D0
05A5EE tst.b ($a5,A6) [enemy+24]
05A5F2 bne $5a600
05A61C move.b #$1, ($a5,A6)
05A622 moveq #$1, D0 [enemy+A5]
05C38A move.b D0, ($a5,A6) [enemy+24]
05C38E jsr $3140c.l [enemy+A5]
copyright zengfr site:http://github.com/zengfr/romhack
|
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.1.4 #12246 (Mac OS X x86_64)
;--------------------------------------------------------
.module scene_0
.optsdcc -mgbz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _scene_0
.globl ___bank_scene_0
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE_255
.area _CODE_255
___bank_scene_0 = 0x00ff
_scene_0:
.db #0x14 ; 20
.db #0x12 ; 18
.db #0x00 ; 0
.db #0x06 ; 6
.db #0x01 ; 1
.db #0x00 ; 0
.db #0x04 ; 4
.byte ___bank_spritesheet_9
.dw _spritesheet_9
.byte ___bank_background_0
.dw _background_0
.byte ___bank_scene_0_collisions
.dw _scene_0_collisions
.byte ___bank_palette_2
.dw _palette_2
.byte ___bank_palette_3
.dw _palette_3
.byte #0x00
.dw #0x0000
.byte #0x00
.dw #0x0000
.byte #0x00
.dw #0x0000
.byte #0x00
.dw #0x0000
.byte ___bank_scene_0_sprites
.dw _scene_0_sprites
.byte ___bank_scene_0_actors
.dw _scene_0_actors
.byte ___bank_scene_0_triggers
.dw _scene_0_triggers
.byte #0x00
.dw #0x0000
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x00 ; 0
.db #0x14 ; 20
.db #0x00 ; 0
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.db 0x00
.area _INITIALIZER
.area _CABS (ABS)
|
; A021388: Decimal expansion of 1/384.
; 0,0,2,6,0,4,1,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
add $0,1
mov $1,10
pow $1,$0
mul $1,2
div $1,768
mod $1,10
mov $0,$1
|
cpu 8080
; note: CHARSET also acts on arguments of CHARSET itself,
; so 'charset 'a','z',1 | charset 'd',255 won't work as expected.
charset 'a','c',1
charset 'd',255
charset 'e','z',5
db "drei droege drachen drehen durch"
; alternate way of doing it: 100 is ASCII code of 'd'
charset
charset 'a','z',1
charset 100,255
db "drei droege drachen drehen durch"
; back to normality:
charset
db "drei droege drachen drehen durch"
|
#pragma once
#include "config.hpp"
#include "file_reader.hpp"
#include <string>
#include <cassert>
#include <cstdint>
#include <vector>
namespace standard_encoder
{
namespace readers
{
class csv_reader
{
public:
csv_reader() {}
csv_reader(std::string config_path) : m_config_path(config_path)
{
assert(is_file_supported(config_path) && "File is not supported");
}
void set_config_path(std::string config_path)
{
assert(is_file_supported(config_path) && "File is not supported");
m_config_path = config_path;
}
std::vector<config> read()
{
// Check if the config path is set
// if it is not terminate program execition
assert(!m_config_path.empty() && "empty config path");
auto reader = file_reader(m_config_path);
// A file can contain multiple configurations
// It is unknown how many configurations a file contain
// therefore the space in the vector is not preallocated
std::vector<config> configs;
std::string line = "";
while(line.compare("EOF") != 0)
{
line = reader.next_line();
if (line.compare("EOF") != 0)
{
configs.push_back(csv_string_to_config(line));
}
}
return configs;
}
private:
std::vector<std::string> split(std::string str,
std::string delim)
{
std::vector<std::string> tokens;
size_t prev = 0;
size_t pos = 0;
do
{
pos = str.find(delim, prev);
if (pos == std::string::npos)
{
pos = str.length();
}
std::string token = str.substr(prev, pos - prev);
if (!token.empty())
{
tokens.push_back(token);
}
prev = pos + delim.length();
}
while (pos < str.length() && prev < str.length());
return tokens;
}
config csv_string_to_config(std::string csv_line)
{
auto config_as_string = split(csv_line, ",");
std::vector<uint32_t> config_as_int;
std::string::size_type sz;
for (auto element : config_as_string)
{
auto as_int = std::stoi(element, &sz);
config_as_int.push_back((uint32_t) as_int);
}
return config(config_as_int);
}
bool is_file_supported(std::string config_path)
{
// If file ends with .CSV it is supported
// TODO: Add support for files with out file extension
// As it is legal for CSV files to not have a file extension
return (config_path.substr(config_path.find_last_of(".") + 1) == "csv" ||
config_path.substr(config_path.find_last_of(".") + 1) == "CSV" );
}
private:
std::string m_config_path;
};
}
}
|
; int bv_stack_pop(bv_stack_t *s)
SECTION code_clib
SECTION code_adt_bv_stack
PUBLIC bv_stack_pop
EXTERN asm_bv_stack_pop
defc bv_stack_pop = asm_bv_stack_pop
|
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
p192r1_data:
_prime192r1:
.long 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
.p2align 5, 0x90
.globl h9_add_192
.type h9_add_192, @function
h9_add_192:
movl (%esi), %eax
addl (%ebx), %eax
movl %eax, (%edi)
movl (4)(%esi), %eax
adcl (4)(%ebx), %eax
movl %eax, (4)(%edi)
movl (8)(%esi), %eax
adcl (8)(%ebx), %eax
movl %eax, (8)(%edi)
movl (12)(%esi), %eax
adcl (12)(%ebx), %eax
movl %eax, (12)(%edi)
movl (16)(%esi), %eax
adcl (16)(%ebx), %eax
movl %eax, (16)(%edi)
movl (20)(%esi), %eax
adcl (20)(%ebx), %eax
movl %eax, (20)(%edi)
mov $(0), %eax
adc $(0), %eax
ret
.Lfe1:
.size h9_add_192, .Lfe1-(h9_add_192)
.p2align 5, 0x90
.globl h9_sub_192
.type h9_sub_192, @function
h9_sub_192:
movl (%esi), %eax
subl (%ebx), %eax
movl %eax, (%edi)
movl (4)(%esi), %eax
sbbl (4)(%ebx), %eax
movl %eax, (4)(%edi)
movl (8)(%esi), %eax
sbbl (8)(%ebx), %eax
movl %eax, (8)(%edi)
movl (12)(%esi), %eax
sbbl (12)(%ebx), %eax
movl %eax, (12)(%edi)
movl (16)(%esi), %eax
sbbl (16)(%ebx), %eax
movl %eax, (16)(%edi)
movl (20)(%esi), %eax
sbbl (20)(%ebx), %eax
movl %eax, (20)(%edi)
mov $(0), %eax
adc $(0), %eax
ret
.Lfe2:
.size h9_sub_192, .Lfe2-(h9_sub_192)
.p2align 5, 0x90
.globl h9_shl_192
.type h9_shl_192, @function
h9_shl_192:
movl (20)(%esi), %eax
movq (16)(%esi), %xmm2
movdqu (%esi), %xmm1
movdqa %xmm2, %xmm3
palignr $(8), %xmm1, %xmm3
psllq $(1), %xmm2
psrlq $(63), %xmm3
por %xmm3, %xmm2
movq %xmm2, (16)(%edi)
movdqa %xmm1, %xmm3
pslldq $(8), %xmm3
psllq $(1), %xmm1
psrlq $(63), %xmm3
por %xmm3, %xmm1
movdqu %xmm1, (%edi)
shr $(31), %eax
ret
.Lfe3:
.size h9_shl_192, .Lfe3-(h9_shl_192)
.p2align 5, 0x90
.globl h9_shr_192
.type h9_shr_192, @function
h9_shr_192:
movdqu (%esi), %xmm2
movq (16)(%esi), %xmm1
movdqa %xmm1, %xmm3
palignr $(8), %xmm2, %xmm3
psrlq $(1), %xmm2
psllq $(63), %xmm3
por %xmm3, %xmm2
movdqu %xmm2, (%edi)
movdqa %xmm0, %xmm3
psrlq $(1), %xmm1
psllq $(63), %xmm3
por %xmm3, %xmm1
movq %xmm1, (16)(%edi)
ret
.Lfe4:
.size h9_shr_192, .Lfe4-(h9_shr_192)
.p2align 5, 0x90
.globl h9_p192r1_add
.type h9_p192r1_add, @function
h9_p192r1_add:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebx
call h9_add_192
mov %eax, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
call .L__0000gas_5
.L__0000gas_5:
pop %ebx
sub $(.L__0000gas_5-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
lea (%esp), %esi
movl (8)(%ebp), %edi
sub %eax, %edx
cmovne %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe5:
.size h9_p192r1_add, .Lfe5-(h9_p192r1_add)
.p2align 5, 0x90
.globl h9_p192r1_sub
.type h9_p192r1_sub, @function
h9_p192r1_sub:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebx
call h9_sub_192
mov %eax, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
call .L__0001gas_6
.L__0001gas_6:
pop %ebx
sub $(.L__0001gas_6-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
lea (%esp), %esi
movl (8)(%ebp), %edi
test %edx, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe6:
.size h9_p192r1_sub, .Lfe6-(h9_p192r1_sub)
.p2align 5, 0x90
.globl h9_p192r1_neg
.type h9_p192r1_neg, @function
h9_p192r1_neg:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
mov $(0), %eax
subl (%esi), %eax
movl %eax, (%edi)
mov $(0), %eax
sbbl (4)(%esi), %eax
movl %eax, (4)(%edi)
mov $(0), %eax
sbbl (8)(%esi), %eax
movl %eax, (8)(%edi)
mov $(0), %eax
sbbl (12)(%esi), %eax
movl %eax, (12)(%edi)
mov $(0), %eax
sbbl (16)(%esi), %eax
movl %eax, (16)(%edi)
mov $(0), %eax
sbbl (20)(%esi), %eax
movl %eax, (20)(%edi)
sbb %edx, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
call .L__0002gas_7
.L__0002gas_7:
pop %ebx
sub $(.L__0002gas_7-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
lea (%esp), %esi
movl (8)(%ebp), %edi
test %edx, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe7:
.size h9_p192r1_neg, .Lfe7-(h9_p192r1_neg)
.p2align 5, 0x90
.globl h9_p192r1_mul_by_2
.type h9_p192r1_mul_by_2, @function
h9_p192r1_mul_by_2:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
call h9_shl_192
mov %eax, %edx
mov %edi, %esi
movl (8)(%ebp), %edi
call .L__0003gas_8
.L__0003gas_8:
pop %ebx
sub $(.L__0003gas_8-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe8:
.size h9_p192r1_mul_by_2, .Lfe8-(h9_p192r1_mul_by_2)
.p2align 5, 0x90
.globl h9_p192r1_mul_by_3
.type h9_p192r1_mul_by_3, @function
h9_p192r1_mul_by_3:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(56), %esp
and $(-16), %esp
movl %eax, (52)(%esp)
call .L__0004gas_9
.L__0004gas_9:
pop %eax
sub $(.L__0004gas_9-p192r1_data), %eax
lea ((_prime192r1-p192r1_data))(%eax), %eax
movl %eax, (48)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
call h9_shl_192
mov %eax, %edx
mov %edi, %esi
lea (24)(%esp), %edi
mov (48)(%esp), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov %edi, %esi
movl (12)(%ebp), %ebx
call h9_add_192
mov %eax, %edx
movl (8)(%ebp), %edi
mov (48)(%esp), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (52)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe9:
.size h9_p192r1_mul_by_3, .Lfe9-(h9_p192r1_mul_by_3)
.p2align 5, 0x90
.globl h9_p192r1_div_by_2
.type h9_p192r1_div_by_2, @function
h9_p192r1_div_by_2:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
call .L__0005gas_10
.L__0005gas_10:
pop %ebx
sub $(.L__0005gas_10-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
mov $(0), %edx
movl (%esi), %ecx
and $(1), %ecx
cmovne %edi, %esi
cmove %edx, %eax
movd %eax, %xmm0
movl (8)(%ebp), %edi
call h9_shr_192
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe10:
.size h9_p192r1_div_by_2, .Lfe10-(h9_p192r1_div_by_2)
.p2align 5, 0x90
.globl h9_p192r1_mul_mont_slm
.type h9_p192r1_mul_mont_slm, @function
h9_p192r1_mul_mont_slm:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
push %ebp
mov %esp, %eax
sub $(44), %esp
and $(-16), %esp
movl %eax, (40)(%esp)
pxor %mm0, %mm0
movq %mm0, (%esp)
movq %mm0, (8)(%esp)
movq %mm0, (16)(%esp)
movq %mm0, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebp
movl %edi, (28)(%esp)
movl %esi, (32)(%esp)
movl %ebp, (36)(%esp)
mov $(6), %edi
movd (4)(%esi), %mm1
movd (8)(%esi), %mm2
.p2align 5, 0x90
.Lmmul_loopgas_11:
movd %edi, %mm7
movl (%ebp), %edx
movl (%esi), %eax
movd %edx, %mm0
add $(4), %ebp
movl %ebp, (36)(%esp)
pmuludq %mm0, %mm1
mul %edx
addl (%esp), %eax
adc $(0), %edx
pmuludq %mm0, %mm2
movd %mm1, %ecx
psrlq $(32), %mm1
add %edx, %ecx
movd %mm1, %edx
adc $(0), %edx
addl (4)(%esp), %ecx
movd (12)(%esi), %mm1
adc $(0), %edx
movd %mm2, %ebx
psrlq $(32), %mm2
add %edx, %ebx
movd %mm2, %edx
adc $(0), %edx
addl (8)(%esp), %ebx
movd (16)(%esi), %mm2
movd (20)(%esi), %mm3
adc $(0), %edx
pmuludq %mm0, %mm1
pmuludq %mm0, %mm2
pmuludq %mm0, %mm3
movl %ecx, (%esp)
sub %eax, %ebx
mov $(0), %edi
movl %ebx, (4)(%esp)
adc $(0), %edi
movd %mm1, %ecx
psrlq $(32), %mm1
add %edx, %ecx
movd %mm1, %edx
adc $(0), %edx
addl (12)(%esp), %ecx
adc $(0), %edx
movd %mm2, %ebx
psrlq $(32), %mm2
add %edx, %ebx
movd %mm2, %edx
adc $(0), %edx
addl (16)(%esp), %ebx
adc $(0), %edx
movd %mm3, %ebp
psrlq $(32), %mm3
add %edx, %ebp
movd %mm3, %edx
adc $(0), %edx
addl (20)(%esp), %ebp
adc $(0), %edx
sub %edi, %ecx
movl %ecx, (8)(%esp)
sbb $(0), %ebx
movl %ebx, (12)(%esp)
sbb $(0), %ebp
movl %ebp, (16)(%esp)
movd %mm7, %edi
sbb $(0), %eax
mov $(0), %ebx
addl (24)(%esp), %edx
adc $(0), %ebx
add %eax, %edx
adc $(0), %ebx
movl %edx, (20)(%esp)
movl %ebx, (24)(%esp)
sub $(1), %edi
movd (4)(%esi), %mm1
movd (8)(%esi), %mm2
jz .Lexit_mmul_loopgas_11
movl (36)(%esp), %ebp
jmp .Lmmul_loopgas_11
.Lexit_mmul_loopgas_11:
emms
mov (28)(%esp), %edi
lea (%esp), %esi
call .L__0006gas_11
.L__0006gas_11:
pop %ebx
sub $(.L__0006gas_11-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
movl (24)(%esp), %edx
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (40)(%esp), %esp
pop %ebp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe11:
.size h9_p192r1_mul_mont_slm, .Lfe11-(h9_p192r1_mul_mont_slm)
.p2align 5, 0x90
.globl h9_p192r1_sqr_mont_slm
.type h9_p192r1_sqr_mont_slm, @function
h9_p192r1_sqr_mont_slm:
push %ebp
mov %esp, %ebp
push %esi
push %edi
movl (12)(%ebp), %esi
movl (8)(%ebp), %edi
push %esi
push %esi
push %edi
call h9_p192r1_mul_mont_slm
add $(12), %esp
pop %edi
pop %esi
pop %ebp
ret
.Lfe12:
.size h9_p192r1_sqr_mont_slm, .Lfe12-(h9_p192r1_sqr_mont_slm)
.p2align 5, 0x90
.globl h9_p192r1_mred
.type h9_p192r1_mred, @function
h9_p192r1_mred:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
movl (12)(%ebp), %esi
mov $(6), %ecx
xor %edx, %edx
.p2align 5, 0x90
.Lmred_loopgas_13:
movl (%esi), %eax
mov $(0), %ebx
movl %ebx, (%esi)
movl (4)(%esi), %ebx
movl %ebx, (4)(%esi)
movl (8)(%esi), %ebx
sub %eax, %ebx
movl %ebx, (8)(%esi)
movl (12)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (12)(%esi)
movl (16)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (16)(%esi)
movl (20)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (20)(%esi)
movl (24)(%esi), %ebx
sbb $(0), %eax
add %edx, %eax
mov $(0), %edx
adc $(0), %edx
add %eax, %ebx
movl %ebx, (24)(%esi)
adc $(0), %edx
lea (4)(%esi), %esi
sub $(1), %ecx
jnz .Lmred_loopgas_13
movl (8)(%ebp), %edi
call .L__0007gas_13
.L__0007gas_13:
pop %ebx
sub $(.L__0007gas_13-p192r1_data), %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe13:
.size h9_p192r1_mred, .Lfe13-(h9_p192r1_mred)
.p2align 5, 0x90
.globl h9_p192r1_select_pp_w5
.type h9_p192r1_select_pp_w5, @function
h9_p192r1_select_pp_w5:
push %ebp
mov %esp, %ebp
push %esi
push %edi
pxor %xmm0, %xmm0
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %eax
movd %eax, %xmm7
pshufd $(0), %xmm7, %xmm7
mov $(1), %edx
movd %edx, %xmm6
pshufd $(0), %xmm6, %xmm6
movdqa %xmm0, (%edi)
movdqa %xmm0, (16)(%edi)
movdqa %xmm0, (32)(%edi)
movdqa %xmm0, (48)(%edi)
movq %xmm0, (64)(%edi)
movdqa %xmm6, %xmm5
mov $(16), %ecx
.p2align 5, 0x90
.Lselect_loopgas_14:
movdqa %xmm5, %xmm4
pcmpeqd %xmm7, %xmm4
movdqu (%esi), %xmm0
pand %xmm4, %xmm0
por (%edi), %xmm0
movdqa %xmm0, (%edi)
movdqu (16)(%esi), %xmm1
pand %xmm4, %xmm1
por (16)(%edi), %xmm1
movdqa %xmm1, (16)(%edi)
movdqu (32)(%esi), %xmm2
pand %xmm4, %xmm2
por (32)(%edi), %xmm2
movdqa %xmm2, (32)(%edi)
movdqu (48)(%esi), %xmm3
pand %xmm4, %xmm3
por (48)(%edi), %xmm3
movdqa %xmm3, (48)(%edi)
movq (64)(%esi), %xmm0
movq (64)(%edi), %xmm1
pand %xmm4, %xmm0
por %xmm1, %xmm0
movq %xmm0, (64)(%edi)
paddd %xmm6, %xmm5
add $(72), %esi
sub $(1), %ecx
jnz .Lselect_loopgas_14
pop %edi
pop %esi
pop %ebp
ret
.Lfe14:
.size h9_p192r1_select_pp_w5, .Lfe14-(h9_p192r1_select_pp_w5)
|
; Special sections
extern main
; This section is always before other sections in the kernel
section .entry
; --- Entry --- ;
jmp entry
; Ensure that we are 16 bytes after the begining of the file
align 16
; --- Variables --- ;
; !!! Do NOT reorder these variables
; . = KERNEL + 16
; The first sector after the kernel
; This variable is set
global FS_SECTOR
FS_SECTOR:
dd 0
entry:
call main
; This section is after other sections
section .end
; --- End Of Kernel --- ;
; TODO : Avoid fill with 0
times 508 db 0
; End Of Kernel magic number
db 'CORE'
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbp
push %rcx
push %rdx
push %rsi
lea addresses_UC_ht+0xe4b9, %rsi
nop
nop
and %rbp, %rbp
mov (%rsi), %r10d
nop
nop
nop
add $7347, %r15
lea addresses_WT_ht+0x82b9, %rdx
nop
nop
sub %rcx, %rcx
mov (%rdx), %r10
nop
nop
cmp %rbp, %rbp
lea addresses_WC_ht+0x1acb9, %rdx
nop
nop
nop
sub %r12, %r12
mov $0x6162636465666768, %r10
movq %r10, (%rdx)
nop
add %rcx, %rcx
lea addresses_D_ht+0x174b9, %rdx
nop
xor $47952, %r10
movb (%rdx), %cl
nop
nop
nop
nop
inc %r10
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %rax
push %rbp
push %rcx
push %rdx
// Load
mov $0xbf9, %rcx
clflush (%rcx)
nop
nop
add $17624, %rdx
vmovups (%rcx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rax
nop
nop
nop
nop
xor %rdx, %rdx
// Faulty Load
lea addresses_A+0xbcb9, %r11
cmp %rbp, %rbp
vmovaps (%r11), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'00': 1122}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/video_detector.h"
#include <memory>
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/test_window_builder.h"
#include "ash/wm/window_state.h"
#include "ash/wm/wm_event.h"
#include "base/compiler_specific.h"
#include "base/containers/circular_deque.h"
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/gfx/geometry/rect.h"
namespace ash {
// Implementation that just records video state changes.
class TestObserver : public VideoDetector::Observer {
public:
TestObserver() = default;
TestObserver(const TestObserver&) = delete;
TestObserver& operator=(const TestObserver&) = delete;
bool empty() const { return states_.empty(); }
void reset() { states_.clear(); }
// Pops and returns the earliest-received state.
VideoDetector::State PopState() {
CHECK(!states_.empty());
VideoDetector::State first_state = states_.front();
states_.pop_front();
return first_state;
}
// VideoDetector::Observer implementation.
void OnVideoStateChanged(VideoDetector::State state) override {
states_.push_back(state);
}
private:
// States in the order they were received.
base::circular_deque<VideoDetector::State> states_;
};
class VideoDetectorTest : public AshTestBase {
public:
VideoDetectorTest() = default;
VideoDetectorTest(const VideoDetectorTest&) = delete;
VideoDetectorTest& operator=(const VideoDetectorTest&) = delete;
~VideoDetectorTest() override = default;
void SetUp() override {
AshTestBase::SetUp();
observer_ = std::make_unique<TestObserver>();
detector_ = Shell::Get()->video_detector();
detector_->AddObserver(observer_.get());
}
void TearDown() override {
detector_->RemoveObserver(observer_.get());
AshTestBase::TearDown();
}
protected:
// Creates and returns a new window with |bounds|.
std::unique_ptr<aura::Window> CreateTestWindow(const gfx::Rect& bounds) {
return TestWindowBuilder()
.SetColorWindowDelegate(SK_ColorRED)
.SetBounds(bounds)
.AllowAllWindowStates()
.Build();
}
VideoDetector* detector_; // not owned
std::unique_ptr<TestObserver> observer_;
};
// Verify that the video detector can distinguish fullscreen and windowed video
// activity.
TEST_F(VideoDetectorTest, ReportFullscreen) {
UpdateDisplay("1024x768,1024x768");
std::unique_ptr<aura::Window> window =
CreateTestWindow(gfx::Rect(0, 0, 1024, 768));
WindowState* window_state = WindowState::Get(window.get());
const WMEvent toggle_fullscreen_event(WM_EVENT_TOGGLE_FULLSCREEN);
window_state->OnWMEvent(&toggle_fullscreen_event);
ASSERT_TRUE(window_state->IsFullscreen());
window->Focus();
detector_->OnVideoActivityStarted();
EXPECT_EQ(VideoDetector::State::PLAYING_FULLSCREEN, observer_->PopState());
EXPECT_TRUE(observer_->empty());
// Make the window non-fullscreen.
observer_->reset();
window_state->OnWMEvent(&toggle_fullscreen_event);
ASSERT_FALSE(window_state->IsFullscreen());
EXPECT_EQ(VideoDetector::State::PLAYING_WINDOWED, observer_->PopState());
EXPECT_TRUE(observer_->empty());
// Open a second, fullscreen window. Fullscreen video should still be reported
// due to the second window being fullscreen. This avoids situations where
// non-fullscreen video could be reported when multiple videos are playing in
// fullscreen and non-fullscreen windows.
observer_->reset();
std::unique_ptr<aura::Window> other_window =
CreateTestWindow(gfx::Rect(1024, 0, 1024, 768));
WindowState* other_window_state = WindowState::Get(other_window.get());
other_window_state->OnWMEvent(&toggle_fullscreen_event);
ASSERT_TRUE(other_window_state->IsFullscreen());
EXPECT_EQ(VideoDetector::State::PLAYING_FULLSCREEN, observer_->PopState());
EXPECT_TRUE(observer_->empty());
// Make the second window non-fullscreen and check that the observer is
// immediately notified about windowed video.
observer_->reset();
other_window_state->OnWMEvent(&toggle_fullscreen_event);
ASSERT_FALSE(other_window_state->IsFullscreen());
EXPECT_EQ(VideoDetector::State::PLAYING_WINDOWED, observer_->PopState());
EXPECT_TRUE(observer_->empty());
}
} // namespace ash
|
int dep5() { return 5; }
|
/*
* @lc app=leetcode id=160 lang=cpp
*
* [160] Intersection of Two Linked Lists
*/
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
// @lc code=start
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
auto calLength = [](ListNode *node) {
int length = 0;
while (node != nullptr) {
node = node->next;
length++;
}
return length;
};
const auto lengthA = calLength(headA);
const auto lengthB = calLength(headB);
auto ha = headA;
auto hb = headB;
if (lengthA > lengthB) {
for (int i = 0; i < lengthA - lengthB; i++) {
ha = ha->next;
}
} else {
for (int i = 0; i < lengthB - lengthA; i++) {
hb = hb->next;
}
}
while (ha != nullptr) {
if (ha == hb) {
break;
}
ha = ha->next;
hb = hb->next;
}
return ha;
}
};
// @lc code=end
|
; A041183: Denominators of continued fraction convergents to sqrt(102).
; Submitted by Jamie Morken(s2)
; 1,10,201,2020,40601,408030,8201201,82420040,1656602001,16648440050,334625403001,3362902470060,67592674804201,679289650512070,13653385685045601,137213146500968080,2757916315704407201,27716376303545040090,557085442386605209001,5598570800169597130100,112528501445778547811001,1130883585257955075240110,22730200206604880052613201,228432885651306755601372120,4591387913232739992080055601,46142312017978706676401928130,927437628272806873520118618201,9320518594746047441877588110140
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,2
mul $2,20
lpe
mov $0,$2
div $0,20
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "base/sha1.h"
#include "crypto/rsa_private_key.h"
#include "crypto/sha2.h"
#include "crypto/signature_creator.h"
#include "crypto/signature_verifier.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(SignatureCreatorTest, BasicTest) {
// Do a verify round trip.
scoped_ptr<crypto::RSAPrivateKey> key_original(
crypto::RSAPrivateKey::Create(1024));
ASSERT_TRUE(key_original.get());
std::vector<uint8_t> key_info;
key_original->ExportPrivateKey(&key_info);
scoped_ptr<crypto::RSAPrivateKey> key(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_info));
ASSERT_TRUE(key.get());
scoped_ptr<crypto::SignatureCreator> signer(
crypto::SignatureCreator::Create(key.get(),
crypto::SignatureCreator::SHA1));
ASSERT_TRUE(signer.get());
std::string data("Hello, World!");
ASSERT_TRUE(signer->Update(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size()));
std::vector<uint8_t> signature;
ASSERT_TRUE(signer->Final(&signature));
std::vector<uint8_t> public_key_info;
ASSERT_TRUE(key_original->ExportPublicKey(&public_key_info));
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
crypto::SignatureVerifier::RSA_PKCS1_SHA1, &signature.front(),
signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
ASSERT_TRUE(verifier.VerifyFinal());
}
TEST(SignatureCreatorTest, SignDigestTest) {
// Do a verify round trip.
scoped_ptr<crypto::RSAPrivateKey> key_original(
crypto::RSAPrivateKey::Create(1024));
ASSERT_TRUE(key_original.get());
std::vector<uint8_t> key_info;
key_original->ExportPrivateKey(&key_info);
scoped_ptr<crypto::RSAPrivateKey> key(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_info));
ASSERT_TRUE(key.get());
std::string data("Hello, World!");
std::string sha1 = base::SHA1HashString(data);
// Sign sha1 of the input data.
std::vector<uint8_t> signature;
ASSERT_TRUE(crypto::SignatureCreator::Sign(
key.get(), crypto::SignatureCreator::SHA1,
reinterpret_cast<const uint8_t*>(sha1.c_str()), sha1.size(), &signature));
std::vector<uint8_t> public_key_info;
ASSERT_TRUE(key_original->ExportPublicKey(&public_key_info));
// Verify the input data.
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
crypto::SignatureVerifier::RSA_PKCS1_SHA1, &signature.front(),
signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
ASSERT_TRUE(verifier.VerifyFinal());
}
TEST(SignatureCreatorTest, SignSHA256DigestTest) {
// Do a verify round trip.
scoped_ptr<crypto::RSAPrivateKey> key_original(
crypto::RSAPrivateKey::Create(1024));
ASSERT_TRUE(key_original.get());
std::vector<uint8_t> key_info;
key_original->ExportPrivateKey(&key_info);
scoped_ptr<crypto::RSAPrivateKey> key(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_info));
ASSERT_TRUE(key.get());
std::string data("Hello, World!");
std::string sha256 = crypto::SHA256HashString(data);
// Sign sha256 of the input data.
std::vector<uint8_t> signature;
ASSERT_TRUE(crypto::SignatureCreator::Sign(
key.get(), crypto::SignatureCreator::HashAlgorithm::SHA256,
reinterpret_cast<const uint8_t*>(sha256.c_str()), sha256.size(),
&signature));
std::vector<uint8_t> public_key_info;
ASSERT_TRUE(key_original->ExportPublicKey(&public_key_info));
// Verify the input data.
crypto::SignatureVerifier verifier;
ASSERT_TRUE(verifier.VerifyInit(
crypto::SignatureVerifier::RSA_PKCS1_SHA256, &signature.front(),
signature.size(), &public_key_info.front(), public_key_info.size()));
verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.c_str()),
data.size());
ASSERT_TRUE(verifier.VerifyFinal());
}
|
; A087076: Sums of the squares of the elements in the subsets of the integers 1 to n.
; 0,1,10,56,240,880,2912,8960,26112,72960,197120,518144,1331200,3354624,8314880,20316160,49020928,116981760,276430848,647495680,1504706560,3471835136,7958691840,18136170496,41104179200,92694118400,208071032832,465064427520,1035355553792,2296465326080,5076114472960,11184094838784,24567212933120,53811645251584,117553254891520,256151849533440,556833919991808,1207744803635200,2613951456083968,5645992208629760
mov $2,$0
lpb $2,1
lpb $0,1
add $3,$0
sub $0,1
add $4,$3
lpe
mov $1,$4
sub $2,1
mul $4,2
lpe
|
; A032923: Numbers whose set of base-16 digits is {1,3}.
; Submitted by Christian Krause
; 1,3,17,19,49,51,273,275,305,307,785,787,817,819,4369,4371,4401,4403,4881,4883,4913,4915,12561,12563,12593,12595,13073,13075,13105,13107,69905,69907,69937,69939,70417,70419,70449,70451,78097,78099,78129,78131,78609,78611,78641,78643,200977,200979,201009,201011,201489,201491,201521,201523,209169,209171,209201,209203,209681,209683,209713,209715,1118481,1118483,1118513,1118515,1118993,1118995,1119025,1119027,1126673,1126675,1126705,1126707,1127185,1127187,1127217,1127219,1249553,1249555,1249585
add $0,1
mov $2,1
lpb $0
mul $0,2
sub $0,1
mov $3,$0
div $0,4
mod $3,4
mul $3,$2
add $1,$3
mul $2,16
lpe
mov $0,$1
|
; A117768: Number of Lucas numbers with n digits.
; 4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5,4,5,5,5,5,4,5,5,5,4,5,5,5,5
mov $9,$0
mov $11,2
lpb $11,1
clr $0,9
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mov $2,$0
mov $3,10
mov $5,10
lpb $2,1
sub $0,2
div $0,5
mul $2,$5
add $0,$2
div $5,2
mul $5,3
add $8,$3
lpb $5,1
add $0,$8
mov $4,$5
sub $4,2
sub $5,$5
add $6,4
lpe
lpb $6,1
add $0,1
div $0,$4
mov $2,3
mov $5,5
sub $6,5
lpe
lpe
mov $1,$0
mov $12,$11
lpb $12,1
mov $10,$1
sub $12,1
lpe
lpe
lpb $9,1
mov $9,0
sub $10,$1
lpe
mov $1,$10
add $1,4
|
; A158399: 784n - 1.
; 783,1567,2351,3135,3919,4703,5487,6271,7055,7839,8623,9407,10191,10975,11759,12543,13327,14111,14895,15679,16463,17247,18031,18815,19599,20383,21167,21951,22735,23519,24303,25087,25871,26655,27439,28223,29007,29791,30575,31359,32143,32927,33711,34495,35279,36063,36847,37631,38415,39199,39983,40767,41551,42335,43119,43903,44687,45471,46255,47039,47823,48607,49391,50175,50959,51743,52527,53311,54095,54879,55663,56447,57231,58015,58799,59583,60367,61151,61935,62719,63503,64287,65071,65855,66639,67423,68207,68991,69775,70559,71343,72127,72911,73695,74479,75263,76047,76831,77615,78399,79183,79967,80751,81535,82319,83103,83887,84671,85455,86239,87023,87807,88591,89375,90159,90943,91727,92511,93295,94079,94863,95647,96431,97215,97999,98783,99567,100351,101135,101919,102703,103487,104271,105055,105839,106623,107407,108191,108975,109759,110543,111327,112111,112895,113679,114463,115247,116031,116815,117599,118383,119167,119951,120735,121519,122303,123087,123871,124655,125439,126223,127007,127791,128575,129359,130143,130927,131711,132495,133279,134063,134847,135631,136415,137199,137983,138767,139551,140335,141119,141903,142687,143471,144255,145039,145823,146607,147391,148175,148959,149743,150527,151311,152095,152879,153663,154447,155231,156015,156799,157583,158367,159151,159935,160719,161503,162287,163071,163855,164639,165423,166207,166991,167775,168559,169343,170127,170911,171695,172479,173263,174047,174831,175615,176399,177183,177967,178751,179535,180319,181103,181887,182671,183455,184239,185023,185807,186591,187375,188159,188943,189727,190511,191295,192079,192863,193647,194431,195215,195999
mov $1,$0
mul $1,784
add $1,783
|
.386
.XMM
.model flat, c
.code
movdqa_test PROC xmm_reg_ptr:DWORD
mov eax, xmm_reg_ptr
movdqa xmm0, [eax]
movdqa xmm0, [eax+1]
RET
movdqa_test ENDP
end
|
; **************************************************
; SMSlib - C programming library for the SMS/GG
; ( part of devkitSMS - github.com/sverx/devkitSMS )
; **************************************************
INCLUDE "SMSlib_private.inc"
SECTION code_clib
SECTION code_SMSlib
PUBLIC asm_SMSlib_getKeysStatus
EXTERN __SMSlib_KeysStatus
asm_SMSlib_getKeysStatus:
; unsigned int SMS_getKeysStatus (void)
;
; exit : hl = (_KeysStatus)
;
; uses : hl
ld hl,(__SMSlib_KeysStatus)
ret
|
/****************************************************************************/
// This software is released under the 2-Clause BSD license, included
// below.
//
// Copyright (c) 2019, Aous Naman
// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
// Copyright (c) 2019, The University of New South Wales, Australia
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// 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.
/****************************************************************************/
// This file is part of the OpenJPH software implementation.
// File: ojph_file.cpp
// Author: Aous Naman
// Date: 28 August 2019
/****************************************************************************/
#include <cassert>
#include "ojph_file.h"
#include "ojph_message.h"
namespace ojph {
////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
void j2c_outfile::open(const char *filename)
{
assert(fh == 0);
fh = fopen(filename, "wb");
if (fh == NULL)
OJPH_ERROR(0x00060001, "failed to open %s for writing", filename);
}
////////////////////////////////////////////////////////////////////////////
size_t j2c_outfile::write(const void *ptr, size_t size)
{
assert(fh);
return fwrite(ptr, 1, size, fh);
}
////////////////////////////////////////////////////////////////////////////
void j2c_outfile::flush()
{
assert(fh);
fflush(fh);
}
////////////////////////////////////////////////////////////////////////////
void j2c_outfile::close()
{
assert(fh);
fclose(fh);
fh = NULL;
}
////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
void j2c_infile::open(const char *filename)
{
assert(fh == NULL);
fh = fopen(filename, "rb");
if (fh == NULL)
OJPH_ERROR(0x00060002, "failed to open %s for reading", filename);
}
////////////////////////////////////////////////////////////////////////////
size_t j2c_infile::read(void *ptr, size_t size)
{
assert(fh);
return fread(ptr, 1, size, fh);
}
////////////////////////////////////////////////////////////////////////////
int j2c_infile::seek(long int offset, enum seek origin)
{
assert(fh);
return fseek(fh, offset, origin);
}
////////////////////////////////////////////////////////////////////////////
long j2c_infile::tell()
{
assert(fh);
return ftell(fh);
}
////////////////////////////////////////////////////////////////////////////
void j2c_infile::close()
{
assert(fh);
fclose(fh);
fh = NULL;
}
////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
void mem_infile::open(const ui8* data, size_t size)
{
assert(this->data == NULL);
cur_ptr = this->data = data;
this->size = size;
}
////////////////////////////////////////////////////////////////////////////
size_t mem_infile::read(void *ptr, size_t size)
{
size_t num_bytes = ojph_min(size, data + this->size - cur_ptr);
memcpy(ptr, cur_ptr, num_bytes);
cur_ptr += num_bytes;
return num_bytes;
}
////////////////////////////////////////////////////////////////////////////
int mem_infile::seek(long int offset, enum seek origin)
{
int result = -1;
if (origin == OJPH_SEEK_SET)
{
if (offset >= 0 && offset <= size)
{
cur_ptr = data + offset;
result = 0;
}
}
else if (origin == OJPH_SEEK_CUR)
{
size_t bytes_off = cur_ptr - data + offset;
if (bytes_off >= 0 && bytes_off <= size)
{
cur_ptr = data + bytes_off;
result = 0;
}
}
else if (origin == OJPH_SEEK_END)
{
if (offset <= 0 && size + offset >= 0)
{
cur_ptr = data + size + offset;
result = 0;
}
}
else
assert(0);
return result;
}
}
|
//
// Copyright (c) 2008-2016 the Urho3D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include <Urho3D/Core/CoreEvents.h>
#include <Urho3D/Engine/Engine.h>
#include <Urho3D/Graphics/BillboardSet.h>
#include <Urho3D/Graphics/Camera.h>
#include <Urho3D/Graphics/DebugRenderer.h>
#include <Urho3D/Graphics/Graphics.h>
#include <Urho3D/Graphics/Light.h>
#include <Urho3D/Graphics/Material.h>
#include <Urho3D/Graphics/Model.h>
#include <Urho3D/Graphics/Octree.h>
#include <Urho3D/Graphics/Renderer.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Zone.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Resource/ResourceCache.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/UI/Font.h>
#include <Urho3D/UI/Text.h>
#include <Urho3D/UI/UI.h>
#include "Billboards.h"
#include <Urho3D/DebugNew.h>
URHO3D_DEFINE_APPLICATION_MAIN(Billboards)
Billboards::Billboards(Context* context) :
Sample(context),
drawDebug_(false)
{
}
void Billboards::Start()
{
// Execute base class startup
Sample::Start();
// Create the scene content
CreateScene();
// Create the UI content
CreateInstructions();
// Setup the viewport for displaying the scene
SetupViewport();
// Hook up to the frame update and render post-update events
SubscribeToEvents();
// Set the mouse mode to use in the sample
Sample::InitMouseMode(MM_ABSOLUTE);
}
void Billboards::CreateScene()
{
ResourceCache* cache = GetSubsystem<ResourceCache>();
scene_ = new Scene(context_);
// Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
// Also create a DebugRenderer component so that we can draw debug geometry
scene_->CreateComponent<Octree>();
scene_->CreateComponent<DebugRenderer>();
// Create a Zone component for ambient lighting & fog control
Node* zoneNode = scene_->CreateChild("Zone");
Zone* zone = zoneNode->CreateComponent<Zone>();
zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
zone->SetFogStart(100.0f);
zone->SetFogEnd(300.0f);
// Create a directional light without shadows
Node* lightNode = scene_->CreateChild("DirectionalLight");
lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
Light* light = lightNode->CreateComponent<Light>();
light->SetLightType(LIGHT_DIRECTIONAL);
light->SetColor(Color(0.2f, 0.2f, 0.2f));
light->SetSpecularIntensity(1.0f);
// Create a "floor" consisting of several tiles
for (int y = -5; y <= 5; ++y)
{
for (int x = -5; x <= 5; ++x)
{
Node* floorNode = scene_->CreateChild("FloorTile");
floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
}
}
// Create groups of mushrooms, which act as shadow casters
const unsigned NUM_MUSHROOMGROUPS = 25;
const unsigned NUM_MUSHROOMS = 25;
for (unsigned i = 0; i < NUM_MUSHROOMGROUPS; ++i)
{
// First create a scene node for the group. The individual mushrooms nodes will be created as children
Node* groupNode = scene_->CreateChild("MushroomGroup");
groupNode->SetPosition(Vector3(Random(190.0f) - 95.0f, 0.0f, Random(190.0f) - 95.0f));
for (unsigned j = 0; j < NUM_MUSHROOMS; ++j)
{
Node* mushroomNode = groupNode->CreateChild("Mushroom");
mushroomNode->SetPosition(Vector3(Random(25.0f) - 12.5f, 0.0f, Random(25.0f) - 12.5f));
mushroomNode->SetRotation(Quaternion(0.0f, Random() * 360.0f, 0.0f));
mushroomNode->SetScale(1.0f + Random() * 4.0f);
StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
mushroomObject->SetCastShadows(true);
}
}
// Create billboard sets (floating smoke)
const unsigned NUM_BILLBOARDNODES = 25;
const unsigned NUM_BILLBOARDS = 10;
for (unsigned i = 0; i < NUM_BILLBOARDNODES; ++i)
{
Node* smokeNode = scene_->CreateChild("Smoke");
smokeNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(20.0f) + 10.0f, Random(200.0f) - 100.0f));
BillboardSet* billboardObject = smokeNode->CreateComponent<BillboardSet>();
billboardObject->SetNumBillboards(NUM_BILLBOARDS);
billboardObject->SetMaterial(cache->GetResource<Material>("Materials/LitSmoke.xml"));
billboardObject->SetSorted(true);
for (unsigned j = 0; j < NUM_BILLBOARDS; ++j)
{
Billboard* bb = billboardObject->GetBillboard(j);
bb->position_ = Vector3(Random(12.0f) - 6.0f, Random(8.0f) - 4.0f, Random(12.0f) - 6.0f);
bb->size_ = Vector2(Random(2.0f) + 3.0f, Random(2.0f) + 3.0f);
bb->rotation_ = Random() * 360.0f;
bb->enabled_ = true;
}
// After modifying the billboards, they need to be "commited" so that the BillboardSet updates its internals
billboardObject->Commit();
}
// Create shadow casting spotlights
const unsigned NUM_LIGHTS = 9;
for (unsigned i = 0; i < NUM_LIGHTS; ++i)
{
Node* lightNode = scene_->CreateChild("SpotLight");
Light* light = lightNode->CreateComponent<Light>();
float angle = 0.0f;
Vector3 position((i % 3) * 60.0f - 60.0f, 45.0f, (i / 3) * 60.0f - 60.0f);
Color color(((i + 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 2) & 1) * 0.5f + 0.5f);
lightNode->SetPosition(position);
lightNode->SetDirection(Vector3(Sin(angle), -1.5f, Cos(angle)));
light->SetLightType(LIGHT_SPOT);
light->SetRange(90.0f);
light->SetRampTexture(cache->GetResource<Texture2D>("Textures/RampExtreme.png"));
light->SetFov(45.0f);
light->SetColor(color);
light->SetSpecularIntensity(1.0f);
light->SetCastShadows(true);
light->SetShadowBias(BiasParameters(0.00002f, 0.0f));
// Configure shadow fading for the lights. When they are far away enough, the lights eventually become unshadowed for
// better GPU performance. Note that we could also set the maximum distance for each object to cast shadows
light->SetShadowFadeDistance(100.0f); // Fade start distance
light->SetShadowDistance(125.0f); // Fade end distance, shadows are disabled
// Set half resolution for the shadow maps for increased performance
light->SetShadowResolution(0.5f);
// The spot lights will not have anything near them, so move the near plane of the shadow camera farther
// for better shadow depth resolution
light->SetShadowNearFarRatio(0.01f);
}
// Create the camera. Limit far clip distance to match the fog
cameraNode_ = scene_->CreateChild("Camera");
Camera* camera = cameraNode_->CreateComponent<Camera>();
camera->SetFarClip(300.0f);
// Set an initial position for the camera scene node above the plane
cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
}
void Billboards::CreateInstructions()
{
ResourceCache* cache = GetSubsystem<ResourceCache>();
UI* ui = GetSubsystem<UI>();
// Construct new Text object, set string to display and font to use
Text* instructionText = ui->GetRoot()->CreateChild<Text>();
instructionText->SetText(
"Use WASD keys and mouse/touch to move\n"
"Space to toggle debug geometry"
);
instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
// The text has multiple rows. Center them in relation to each other
instructionText->SetTextAlignment(HA_CENTER);
// Position the text relative to the screen center
instructionText->SetHorizontalAlignment(HA_CENTER);
instructionText->SetVerticalAlignment(VA_CENTER);
instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
}
void Billboards::SetupViewport()
{
Renderer* renderer = GetSubsystem<Renderer>();
// Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
renderer->SetViewport(0, viewport);
}
void Billboards::SubscribeToEvents()
{
// Subscribe HandleUpdate() function for processing update events
SubscribeToEvent(E_UPDATE, URHO3D_HANDLER(Billboards, HandleUpdate));
// Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
// debug geometry
SubscribeToEvent(E_POSTRENDERUPDATE, URHO3D_HANDLER(Billboards, HandlePostRenderUpdate));
}
void Billboards::MoveCamera(float timeStep)
{
// Do not move if the UI has a focused element (the console)
if (GetSubsystem<UI>()->GetFocusElement())
return;
Input* input = GetSubsystem<Input>();
// Movement speed as world units per second
const float MOVE_SPEED = 20.0f;
// Mouse sensitivity as degrees per pixel
const float MOUSE_SENSITIVITY = 0.1f;
// Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
IntVector2 mouseMove = input->GetMouseMove();
yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
pitch_ = Clamp(pitch_, -90.0f, 90.0f);
// Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
// Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
if (input->GetKeyDown('W'))
cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
if (input->GetKeyDown('S'))
cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
if (input->GetKeyDown('A'))
cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
if (input->GetKeyDown('D'))
cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
// Toggle debug geometry with space
if (input->GetKeyPress(KEY_SPACE))
drawDebug_ = !drawDebug_;
}
void Billboards::AnimateScene(float timeStep)
{
// Get the light and billboard scene nodes
PODVector<Node*> lightNodes;
PODVector<Node*> billboardNodes;
scene_->GetChildrenWithComponent<Light>(lightNodes);
scene_->GetChildrenWithComponent<BillboardSet>(billboardNodes);
const float LIGHT_ROTATION_SPEED = 20.0f;
const float BILLBOARD_ROTATION_SPEED = 50.0f;
// Rotate the lights around the world Y-axis
for (unsigned i = 0; i < lightNodes.Size(); ++i)
lightNodes[i]->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
// Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
for (unsigned i = 0; i < billboardNodes.Size(); ++i)
{
BillboardSet* billboardObject = billboardNodes[i]->GetComponent<BillboardSet>();
for (unsigned j = 0; j < billboardObject->GetNumBillboards(); ++j)
{
Billboard* bb = billboardObject->GetBillboard(j);
bb->rotation_ += BILLBOARD_ROTATION_SPEED * timeStep;
}
billboardObject->Commit();
}
}
void Billboards::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
using namespace Update;
// Take the frame time step, which is stored as a float
float timeStep = eventData[P_TIMESTEP].GetFloat();
// Move the camera and animate the scene, scale movement with time step
MoveCamera(timeStep);
AnimateScene(timeStep);
}
void Billboards::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
{
// If draw debug mode is enabled, draw viewport debug geometry. This time use depth test, as otherwise the result becomes
// hard to interpret due to large object count
if (drawDebug_)
GetSubsystem<Renderer>()->DrawDebugGeometry(true);
}
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: User interface.
FILE: textInstance.asm
AUTHOR: Tony
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 5/22/89 Initial revision
DESCRIPTION:
Low level utility routines for implementing the methods defined on
VisTextClass.
$Id: textInstance.asm,v 1.1 97/04/07 11:18:07 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextInstance segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextInitialize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initializes an object.
CALLED BY: External.
PASS: es = segment containing VisTextClass.
ds:*si = pointer to instance.
ax = MSG_META_INITIALIZE.
RETURN: nothing of use.
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 12-Jun-89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextInitialize method VisTextClass, MSG_META_INITIALIZE
; First, to parent class initialization
mov di, offset VisTextClass
CallSuper MSG_META_INITIALIZE
; Initialize our own data. Assume enabled.
mov di, ds:[si]
add di, ds:[di].Vis_offset
or ds:[di].VI_attrs, mask VA_FULLY_ENABLED
or ds:[di].VI_geoAttrs, mask VGA_NOTIFY_GEOMETRY_VALID
mov ds:[di].VTI_state, mask VTS_EDITABLE or mask VTS_SELECTABLE
mov ds:[di].VTI_intFlags, 0
; Create and initialize a text-stream and line structures.
; Currently only one byte is allocated for the text, and one
; line-info structure is allocated. This is to reduce the size
; associated with a one line text-edit object.
mov ds:[di].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR \
or mask VTSF_DEFAULT_PARA_ATTR
mov ds:[di].VTI_paraAttrRuns, VIS_TEXT_INITIAL_PARA_ATTR
;
; Create text stream and regions.
;
call TS_SmallCreateTextStorage
;
; no need to set things to zero (since they already are):
; lrMargin, tbMargin
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].VTI_maxLength, -1
mov ds:[di].VTI_leftOffset, INITIAL_LEFT_OFFSET
mov ds:[di].VTI_washColor.low, CF_INDEX or C_WHITE
; Let's get the specific UI's default font and size and use it.
mov al, mask OCF_IGNORE_DIRTY ; ObjChunkFlags => AL
call TextGetSystemCharAttrRun
pushf
mov di, ds:[si] ; point to instance
add di, ds:[di].Vis_offset ; ds:[di] -- VisInstance
mov ds:[di].VTI_charAttrRuns, ax ; store charAttr
popf
jc 10$ ; simple charAttr, branch
andnf ds:[di].VTI_storageFlags, not mask VTSF_DEFAULT_CHAR_ATTR
10$:
ret
VisTextInitialize endm
COMMENT @----------------------------------------------------------------------
ROUTINE: TextGetSystemCharAttrRun
SYNOPSIS: Returns the system charAttr run for this object's specific UI.
CALLED BY: EXTERNAL
PASS: *ds:si -- object to get charAttr run for
al - flags or allocate lmem chunk with (if any)
RETURN: carry -- clear if chunk allocated, set if default returned
ax -- new chunk or constant (allocated in passed ds block)
ds - updated to point at segment of same block as on entry
Chunk handles in ds may have moved, be sure to dereference them
DESTROYED: nothing
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
to them.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/25/90 Initial version
------------------------------------------------------------------------------@
TextGetSystemCharAttrRun proc far uses cx, di, bp, es
objFlags local word push ax
systemCharAttr local VisTextCharAttr
.enter
push bp
lea bp, systemCharAttr
call T_GetSystemCharAttr
; try to map it back
call TextFindDefaultCharAttr ; default charAttr => AX
pop bp ; restore local vars pointer
jc done ; default charAttr found, branch
; Else create an LMem chunk, and copy the system charAttr into it
mov ax, objFlags
mov cx, size VisTextCharAttr ; bytes to allocate => CX
call LMemAlloc ; chunk => AX
push si, di, ds
mov si, ax
mov di, ds:[si] ;es:di = dest
push ds
push ss
pop ds
pop es
lea si, systemCharAttr ;ds:si = source
mov cx, (size VisTextCharAttr)/2
rep movsw
pop si, di, ds
clc ;default charAttr not found
done:
.leave
ret
TextGetSystemCharAttrRun endp
COMMENT @----------------------------------------------------------------------
FUNCTION: T_GetSystemCharAttr
DESCRIPTION: Get the system VisTextCharAttr structure
CALLED BY: INTERNAL
PASS:
ss:bp - buffer
RETURN:
buffer - filled
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/ 2/92 Initial version
------------------------------------------------------------------------------@
T_GetSystemCharAttr proc far uses ax, bx, cx, dx
.enter
;
; Let's get the specific UI's default font and size and use it.
;
clr bx
call GeodeGetUIData ; bx = specific UI
mov ax, SPIR_GET_DISPLAY_SCHEME
call ProcGetLibraryEntry
call ProcCallFixedOrMovable ; cx = font, dx = point size
; get structure for default charAttr
mov ax, VIS_TEXT_INITIAL_CHAR_ATTR
call TextMapDefaultCharAttr
; stuff in our things
mov ss:[bp].VTCA_pointSize.WBF_int, dx
mov ss:[bp].VTCA_fontID, cx
mov ss:[bp].VTCA_color.CQ_redOrIndex, C_BLACK
.leave
ret
T_GetSystemCharAttr endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextReloc -- Relocation for VisTextClass
DESCRIPTION: Relocate a stored text object
PASS:
*ds:si - instance data
es - segment of VisTextClass
ax - MSG_META_RELOCATE/MSG_META_UNRELOCATE
cx - handle of block containing relocation
dx - VMRelocType:
VMRT_UNRELOCATE_BEFORE_WRITE
VMRT_RELOCATE_AFTER_READ
VMRT_RELOCATE_AFTER_WRITE
bp - data to pass to ObjRelocOrUnRelocSuper
RETURN:
carry - set if error
bp - unchanged
DESTROYED:
bx, di, es (special method handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/89 Initial version
------------------------------------------------------------------------------@
VisTextReloc method VisTextClass, reloc
cmp dx, VMRT_RELOCATE_AFTER_READ
jnz done
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].VTI_output.handle, 0
mov ds:[di].VTI_gstate, 0
mov ds:[di].VTI_gsRefCount, 0
mov ds:[di].VTI_timerHandle, 0
andnf ds:[di].VTI_intSelFlags, not (mask VTISF_IS_FOCUS or \
mask VTISF_IS_TARGET)
.assert ASST_NOTHING_ACTIVE eq 0
andnf ds:[di].VTI_intFlags, not (mask VTIF_UPDATE_PENDING or \
mask VTIF_ACTIVE_SEARCH_SPELL)
; Nuke the various temp vardata items
mov ax, TEMP_VIS_TEXT_SYS_TARGET
call ObjVarDeleteData
mov ax, TEMP_VIS_TEXT_CACHED_UNDO_INFO
call ObjVarFindData
jnc 10$
movdw ds:[bx].VTCUI_vmChain, 0
mov ds:[bx].VTCUI_file, 0
10$:
done:
mov di, offset VisTextClass
call ObjRelocOrUnRelocSuper
ret
VisTextReloc endm
COMMENT @----------------------------------------------------------------------
METHOD: VisTextObjFree -- MSG_META_OBJ_FREE for VisTextClass
Destroy the cursor time if it is still around.
DESCRIPTION: -
PASS:
*ds:si - instance data
es - segment of VisTextClass
ax - MSG_META_OBJ_FREE
RETURN:
*ds:si - same
DESTROYED:
bx, di, es (special method handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/93 Initial version
------------------------------------------------------------------------------@
if (0) ; We now kill the timer when we lose sys focus. - Joon (12/8/94)
VisTextObjFree method VisTextClass, MSG_META_OBJ_FREE
clr bx
xchg bx, ds:[di].VTI_timerHandle
tst bx
jz afterTimer
mov ax, ds:[di].VTI_timerID
call TimerStop
afterTimer:
mov ax, TEMP_VIS_TEXT_NOTIFY_CURSOR_POSITION_INFO
call ObjVarFindData
jnc callSuper
mov ax, ds:[bx].TVTNCPID_id
clr dx
xchg dx, ds:[bx].TVTNCPID_handle
tst dx
jz deleteVarData
mov bx, dx
call TimerStop
deleteVarData:
mov ax, TEMP_VIS_TEXT_NOTIFY_CURSOR_POSITION_INFO
call ObjVarDeleteData
callSuper:
mov ax, MSG_META_OBJ_FREE
mov di, offset VisTextClass
GOTO ObjCallSuperNoLock
VisTextObjFree endm
endif
COMMENT @----------------------------------------------------------------------
METHOD: VisTextFinalObjFree -- MSG_META_FINAL_OBJ_FREE for VisTextClass
DESCRIPTION: -
PASS:
*ds:si - instance data
es - segment of VisTextClass
ax - MSG_META_FINAL_OBJ_FREE
RETURN:
*ds:si - same
DESTROYED:
bx, di, es (special method handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/89 Initial version
Doug 8/90 Changed to be handler of FINAL_OBJ_FREE from
OBJ_FREE, so that chunks are freed AFTER
methods have been flushed through to this object
------------------------------------------------------------------------------@
VisTextFinalObjFree method VisTextClass, MSG_META_FINAL_OBJ_FREE
tst ds:[di].VTI_text ;is there any text?
jz callSuper ;nope, Tony says it's cool to
; skip this stuff...
mov ax, TEMP_VIS_TEXT_FREEING_OBJECT
clr cx ;don't free elements
call ObjVarAddData
clr dx ;don't delete text (no need)
mov ax, MSG_VIS_TEXT_FREE_STORAGE
call ObjCallInstanceNoLock
mov bx, offset VTI_text
call FreeStruct
call TL_LineStorageDestroy
callSuper:
mov ax, MSG_META_FINAL_OBJ_FREE
mov di, offset VisTextClass
GOTO ObjCallSuperNoLock
VisTextFinalObjFree endm
;---
FreeStruct proc near
class VisTextClass
mov di, ds:[si]
add di, ds:[di].Vis_offset
clr ax
xchg ax, ds:[di][bx] ;*ds:di = run
tst ax
jz done
test ds:[di].VTI_storageFlags, mask VTSF_LARGE
jnz vm
call ObjFreeChunk
ret
vm:
clr bp
call T_GetVMFile ;bx = VM file
call VMFreeVMChain
done:
ret
FreeStruct endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextFreeAllStorage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: superset of MSG_VIS_TEXT_FREE_STORAGE
CALLED BY: MSG_VIS_TEXT_FREE_ALL_STORAGE
PASS: *ds:si = VisTextClass object
ds:di = VisTextClass instance data
es = segment of VisTextClass
ax = MSG_VIS_TEXT_FREE_ALL_STORAGE
cx = non-zero to remove element arrays also
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/17/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextFreeAllStorage method dynamic VisTextClass, MSG_VIS_TEXT_FREE_ALL_STORAGE
tst ds:[di].VTI_text ;is there any text?
jz done ;nope, Tony says it's cool to
; skip this stuff...
mov ax, MSG_VIS_TEXT_FREE_STORAGE
call ObjCallInstanceNoLock
mov bx, offset VTI_text
call FreeStruct
call TL_LineStorageDestroy
done:
ret
VisTextFreeAllStorage endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextSetFilter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the text filter.
CALLED BY: GLOBAL
PASS: CL - VisTextFilters
RETURN: nada
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextSetFilter method VisTextClass, MSG_VIS_TEXT_SET_FILTER
.enter
mov ds:[di].VTI_filters, cl
Destroy ax, cx, dx, bp
.leave
ret
VisTextSetFilter endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextGetFilter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Gets the text filter.
CALLED BY: GLOBAL
PASS: CL - VisTextFilters
RETURN: nada
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextGetFilter method VisTextClass, MSG_VIS_TEXT_GET_FILTER
.enter
mov cl, ds:[di].VTI_filters
.leave
ret
VisTextGetFilter endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextSetOutput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the output for the text object
CALLED BY: GLOBAL
PASS: CX:DX <- OD
RETURN: nada
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextSetOutput method VisTextClass, MSG_VIS_TEXT_SET_OUTPUT
.enter
movdw ds:[di].VTI_output, cxdx
Destroy ax, cx, dx, bp
.leave
ret
VisTextSetOutput endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextGetOutput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Gets the output for the text object
CALLED BY: GLOBAL
PASS: nada
RETURN: CX:DX <- OD
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextGetOutput method VisTextClass, MSG_VIS_TEXT_GET_OUTPUT
.enter
movdw cxdx, ds:[di].VTI_output
.leave
ret
VisTextGetOutput endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextSetLRMargin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the left/right margin for the text object
CALLED BY: GLOBAL
PASS: CL - left/right margin
RETURN: nada
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextSetLRMargin method VisTextClass, MSG_VIS_TEXT_SET_LR_MARGIN
.enter
mov ds:[di].VTI_lrMargin, cl
Destroy ax, cx, dx, bp
.leave
ret
VisTextSetLRMargin endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextGetLRMargin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Gets the left/right margin for the text object
CALLED BY: GLOBAL
PASS: nada
RETURN: CL - lr margin
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextGetLRMargin method VisTextClass, MSG_VIS_TEXT_GET_LR_MARGIN
.enter
mov cl, ds:[di].VTI_lrMargin
.leave
ret
VisTextGetLRMargin endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextSetTBMargin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the top/bottom margin for the text object
CALLED BY: GLOBAL
PASS: CL - top/bottom margin
RETURN: nada
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextSetTBMargin method VisTextClass, MSG_VIS_TEXT_SET_TB_MARGIN
.enter
mov ds:[di].VTI_tbMargin, cl
Destroy ax, cx, dx, bp
.leave
ret
VisTextSetTBMargin endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextGetTBMargin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Gets the top/bottom margin for the text object
CALLED BY: GLOBAL
PASS: nada
RETURN: CL - tb margin
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextGetTBMargin method VisTextClass, MSG_VIS_TEXT_GET_TB_MARGIN
.enter
mov cl, ds:[di].VTI_tbMargin
.leave
ret
VisTextGetTBMargin endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextNavigationQuery
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle kbd navigation
CALLED BY: MSG_SPEC_NAVIGATION_QUERY
PASS: *ds:si = class object
ds:di = class instance data
es = segment of class
ax = message #
^lcx:dx = object which originated navigation
bp = NavigateFlags
RETURN: ^lcx:dx = replying object
bp = NavigateFlags (in reply)
carry set if found the next/previous navigation object
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/5/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextNavigationQuery method dynamic VisTextClass, MSG_SPEC_NAVIGATION_QUERY
clr bl ;default: not root-level node, is
;not composite node, is not focusable
;not menu-related
test ds:[di].VTI_state, mask VTS_EDITABLE
jz haveFlags ;not editable, not focusable
test ds:[di].VI_attrs, mask VA_FULLY_ENABLED
jz haveFlags ;not fully enabled, not focusable
ornf bl, mask NCF_IS_FOCUSABLE
haveFlags:
clr di ;no Generic object to check hints for
;normal text objects will intercept
;MSG_SPEC_NAVIGATION_QUERY at
;OLTextClass, which will handle a
;Generic object. This handler is for
;direct uses of VisTextClass.
call VisNavigateCommon
ret
VisTextNavigationQuery endm
TextInstance ends
|
#ifndef IMAGE_HPP
#define IMAGE_HPP
#include <fstream>
#include <vector>
#include <sstream>
#include "color.hpp"
using namespace std;
// Returns tokens after splitting input string with delimiter
vector<string> split(const string &input, const string &delimiter) {
string inputCopy = input;
vector<string> ans;
int pos = 0;
string token;
while ((pos = inputCopy.find(delimiter)) != string::npos) {
token = inputCopy.substr(0, pos);
ans.emplace_back(token);
inputCopy.erase(0, pos + delimiter.length());
}
ans.emplace_back(inputCopy);
return ans;
}
class Texture {
string filename;
int width;
int height;
int pixelMax;
// this is to easily print a given object to std for debugging
friend std::ostream &operator<<(std::ostream &, const Texture &);
public:
vector<vector<Color>> pixels;
Texture() : filename(""), width(0), height(0), pixelMax(0) {};
Texture(const string &filename) : filename(filename), width(0), height(0), pixelMax(0) {}
bool isValid() const {
return width > 0 && height > 0;
}
bool parse() {
// Opening texture file
ifstream texturePPM(filename.c_str());
if (texturePPM.fail()) {
// Error handling: if file could not be opened
cerr << "Texture file named \"" << filename
<< "\" could not be opened. Maybe it doesn't exist or has insufficient permissions." << endl;
return false;
}
cout << "Parsing texture file: " << filename << endl;
string line;
getline(texturePPM, line);
istringstream heading(line);
string temp;
heading >> temp >> width >> height >> pixelMax;
if (width <= 0 || height <= 0) {
cerr << "Texture file named \"" << filename << "\" is invalid. Zero dimension image." << endl;
return false;
}
// Initialize pixel array for output image
for (int i = 0; i < width; i++) {
vector<Color> col;
col.resize(height);
pixels.push_back(col);
}
vector<float> numbers;
while (getline(texturePPM, line)) {
string keyword;
vector<string> lineSplit = split(line, " ");
for (auto &token: lineSplit) {
if (token.empty()) { continue; }
try {
float floatToken = stof(token);
numbers.push_back(floatToken / pixelMax);
} catch (exception &e) {
continue;
}
}
}
// Insufficient color information
if (numbers.size() % 3 != 0) {
cerr << "Texture file named \"" << filename << "\" is invalid. Insufficient color information." << endl;
return false;
}
for (int j = 0; j < height; ++j) {
for (int i = 0; i < width; ++i) {
pixels[i][j] = Color(numbers[j * width * 3 + i * 3], numbers[j * width * 3 + i * 3 + 1],
numbers[j * width * 3 + i * 3 + 2]);
}
}
return true;
}
Color colorAt(const TextureCoordinates &textureCoordinates) const {
int i = round(textureCoordinates.u * (width - 1));
int j = round(textureCoordinates.v * (height - 1));
return pixels[i][j];
}
};
std::ostream &operator<<(std::ostream &out, const Texture &i) {
out << "Texture:" << "\t" << i.width << "\t" << i.height << "\t" << i.pixelMax;
return out;
}
#endif
|
0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x2920- f:00024 d: 288 | OR[288] = A
0x0002 (0x000004) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0003 (0x000006) 0x2927- f:00024 d: 295 | OR[295] = A
0x0004 (0x000008) 0x1042- f:00010 d: 66 | A = 66 (0x0042)
0x0005 (0x00000A) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0006 (0x00000C) 0x2928- f:00024 d: 296 | OR[296] = A
0x0007 (0x00000E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0008 (0x000010) 0x2929- f:00024 d: 297 | OR[297] = A
0x0009 (0x000012) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000A (0x000014) 0x292A- f:00024 d: 298 | OR[298] = A
0x000B (0x000016) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000C (0x000018) 0x292B- f:00024 d: 299 | OR[299] = A
0x000D (0x00001A) 0x1120- f:00010 d: 288 | A = 288 (0x0120)
0x000E (0x00001C) 0x292C- f:00024 d: 300 | OR[300] = A
0x000F (0x00001E) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0010 (0x000020) 0x5800- f:00054 d: 0 | B = A
0x0011 (0x000022) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0012 (0x000024) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0013 (0x000026) 0x8602- f:00103 d: 2 | P = P + 2 (0x0015), A # 0
0x0014 (0x000028) 0x7004- f:00070 d: 4 | P = P + 4 (0x0018)
0x0015 (0x00002A) 0x1023- f:00010 d: 35 | A = 35 (0x0023)
0x0016 (0x00002C) 0x291E- f:00024 d: 286 | OR[286] = A
0x0017 (0x00002E) 0x7101- f:00070 d: 257 | P = P + 257 (0x0118)
0x0018 (0x000030) 0x2120- f:00020 d: 288 | A = OR[288]
0x0019 (0x000032) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x001A (0x000034) 0x2921- f:00024 d: 289 | OR[289] = A
0x001B (0x000036) 0x211A- f:00020 d: 282 | A = OR[282]
0x001C (0x000038) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x001D (0x00003A) 0x8007- f:00100 d: 7 | P = P + 7 (0x0024), C = 0
0x001E (0x00003C) 0x211A- f:00020 d: 282 | A = OR[282]
0x001F (0x00003E) 0x167F- f:00013 d: 127 | A = A - 127 (0x007F)
0x0020 (0x000040) 0x8003- f:00100 d: 3 | P = P + 3 (0x0023), C = 0
0x0021 (0x000042) 0x8402- f:00102 d: 2 | P = P + 2 (0x0023), A = 0
0x0022 (0x000044) 0x7002- f:00070 d: 2 | P = P + 2 (0x0024)
0x0023 (0x000046) 0x7003- f:00070 d: 3 | P = P + 3 (0x0026)
0x0024 (0x000048) 0x1020- f:00010 d: 32 | A = 32 (0x0020)
0x0025 (0x00004A) 0x291A- f:00024 d: 282 | OR[282] = A
0x0026 (0x00004C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0027 (0x00004E) 0x291D- f:00024 d: 285 | OR[285] = A
0x0028 (0x000050) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0029 (0x000052) 0x2926- f:00024 d: 294 | OR[294] = A
0x002A (0x000054) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x002B (0x000056) 0x2925- f:00024 d: 293 | OR[293] = A
0x002C (0x000058) 0x1032- f:00010 d: 50 | A = 50 (0x0032)
0x002D (0x00005A) 0x3920- f:00034 d: 288 | (OR[288]) = A
0x002E (0x00005C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x002F (0x00005E) 0x2922- f:00024 d: 290 | OR[290] = A
0x0030 (0x000060) 0x2125- f:00020 d: 293 | A = OR[293]
0x0031 (0x000062) 0x8444- f:00102 d: 68 | P = P + 68 (0x0075), A = 0
0x0032 (0x000064) 0x2124- f:00020 d: 292 | A = OR[292]
0x0033 (0x000066) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0034 (0x000068) 0x2523- f:00022 d: 291 | A = A + OR[291]
0x0035 (0x00006A) 0x290D- f:00024 d: 269 | OR[269] = A
0x0036 (0x00006C) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0037 (0x00006E) 0x290D- f:00024 d: 269 | OR[269] = A
0x0038 (0x000070) 0x2124- f:00020 d: 292 | A = OR[292]
0x0039 (0x000072) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x003A (0x000074) 0x2908- f:00024 d: 264 | OR[264] = A
0x003B (0x000076) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x003C (0x000078) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x003D (0x00007A) 0x8604- f:00103 d: 4 | P = P + 4 (0x0041), A # 0
0x003E (0x00007C) 0x210D- f:00020 d: 269 | A = OR[269]
0x003F (0x00007E) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0040 (0x000080) 0x290D- f:00024 d: 269 | OR[269] = A
0x0041 (0x000082) 0x210D- f:00020 d: 269 | A = OR[269]
0x0042 (0x000084) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0043 (0x000086) 0x291F- f:00024 d: 287 | OR[287] = A
0x0044 (0x000088) 0x2D24- f:00026 d: 292 | OR[292] = OR[292] + 1
0x0045 (0x00008A) 0x2F25- f:00027 d: 293 | OR[293] = OR[293] - 1
0x0046 (0x00008C) 0x211F- f:00020 d: 287 | A = OR[287]
0x0047 (0x00008E) 0x160C- f:00013 d: 12 | A = A - 12 (0x000C)
0x0048 (0x000090) 0x8402- f:00102 d: 2 | P = P + 2 (0x004A), A = 0
0x0049 (0x000092) 0x7006- f:00070 d: 6 | P = P + 6 (0x004F)
0x004A (0x000094) 0x2122- f:00020 d: 290 | A = OR[290]
0x004B (0x000096) 0x9701- f:00113 d: 257 | R = P + 257 (0x014C), A # 0
0x004C (0x000098) 0x1031- f:00010 d: 49 | A = 49 (0x0031)
0x004D (0x00009A) 0x3920- f:00034 d: 288 | (OR[288]) = A
0x004E (0x00009C) 0x7026- f:00070 d: 38 | P = P + 38 (0x0074)
0x004F (0x00009E) 0x211F- f:00020 d: 287 | A = OR[287]
0x0050 (0x0000A0) 0x160D- f:00013 d: 13 | A = A - 13 (0x000D)
0x0051 (0x0000A2) 0x8405- f:00102 d: 5 | P = P + 5 (0x0056), A = 0
0x0052 (0x0000A4) 0x211F- f:00020 d: 287 | A = OR[287]
0x0053 (0x0000A6) 0x160A- f:00013 d: 10 | A = A - 10 (0x000A)
0x0054 (0x0000A8) 0x8402- f:00102 d: 2 | P = P + 2 (0x0056), A = 0
0x0055 (0x0000AA) 0x7003- f:00070 d: 3 | P = P + 3 (0x0058)
0x0056 (0x0000AC) 0x74F6- f:00072 d: 246 | R = P + 246 (0x014C)
0x0057 (0x0000AE) 0x701D- f:00070 d: 29 | P = P + 29 (0x0074)
0x0058 (0x0000B0) 0x211F- f:00020 d: 287 | A = OR[287]
0x0059 (0x0000B2) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x005A (0x0000B4) 0x8402- f:00102 d: 2 | P = P + 2 (0x005C), A = 0
0x005B (0x0000B6) 0x7005- f:00070 d: 5 | P = P + 5 (0x0060)
0x005C (0x0000B8) 0x2122- f:00020 d: 290 | A = OR[290]
0x005D (0x0000BA) 0x8402- f:00102 d: 2 | P = P + 2 (0x005F), A = 0
0x005E (0x0000BC) 0x2F22- f:00027 d: 290 | OR[290] = OR[290] - 1
0x005F (0x0000BE) 0x7015- f:00070 d: 21 | P = P + 21 (0x0074)
0x0060 (0x0000C0) 0x211F- f:00020 d: 287 | A = OR[287]
0x0061 (0x0000C2) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x0062 (0x0000C4) 0x8007- f:00100 d: 7 | P = P + 7 (0x0069), C = 0
0x0063 (0x0000C6) 0x211F- f:00020 d: 287 | A = OR[287]
0x0064 (0x0000C8) 0x167F- f:00013 d: 127 | A = A - 127 (0x007F)
0x0065 (0x0000CA) 0x8003- f:00100 d: 3 | P = P + 3 (0x0068), C = 0
0x0066 (0x0000CC) 0x8402- f:00102 d: 2 | P = P + 2 (0x0068), A = 0
0x0067 (0x0000CE) 0x7002- f:00070 d: 2 | P = P + 2 (0x0069)
0x0068 (0x0000D0) 0x7003- f:00070 d: 3 | P = P + 3 (0x006B)
0x0069 (0x0000D2) 0x211A- f:00020 d: 282 | A = OR[282]
0x006A (0x0000D4) 0x291F- f:00024 d: 287 | OR[287] = A
0x006B (0x0000D6) 0x2122- f:00020 d: 290 | A = OR[290]
0x006C (0x0000D8) 0x1684- f:00013 d: 132 | A = A - 132 (0x0084)
0x006D (0x0000DA) 0x8402- f:00102 d: 2 | P = P + 2 (0x006F), A = 0
0x006E (0x0000DC) 0x7005- f:00070 d: 5 | P = P + 5 (0x0073)
0x006F (0x0000DE) 0x211B- f:00020 d: 283 | A = OR[283]
0x0070 (0x0000E0) 0x8602- f:00103 d: 2 | P = P + 2 (0x0072), A # 0
0x0071 (0x0000E2) 0x7002- f:00070 d: 2 | P = P + 2 (0x0073)
0x0072 (0x0000E4) 0x74DA- f:00072 d: 218 | R = P + 218 (0x014C)
0x0073 (0x0000E6) 0x74BB- f:00072 d: 187 | R = P + 187 (0x012E)
0x0074 (0x0000E8) 0x7244- f:00071 d: 68 | P = P - 68 (0x0030)
0x0075 (0x0000EA) 0x2118- f:00020 d: 280 | A = OR[280]
0x0076 (0x0000EC) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x0077 (0x0000EE) 0x290D- f:00024 d: 269 | OR[269] = A
0x0078 (0x0000F0) 0x211D- f:00020 d: 285 | A = OR[285]
0x0079 (0x0000F2) 0x390D- f:00034 d: 269 | (OR[269]) = A
0x007A (0x0000F4) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x007B (0x0000F6) 0x310D- f:00030 d: 269 | A = (OR[269])
0x007C (0x0000F8) 0x840B- f:00102 d: 11 | P = P + 11 (0x0087), A = 0
0x007D (0x0000FA) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x007E (0x0000FC) 0x2927- f:00024 d: 295 | OR[295] = A
0x007F (0x0000FE) 0x210D- f:00020 d: 269 | A = OR[269]
0x0080 (0x000100) 0x2928- f:00024 d: 296 | OR[296] = A
0x0081 (0x000102) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0082 (0x000104) 0x2929- f:00024 d: 297 | OR[297] = A
0x0083 (0x000106) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0084 (0x000108) 0x5800- f:00054 d: 0 | B = A
0x0085 (0x00010A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0086 (0x00010C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0087 (0x00010E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0088 (0x000110) 0x290D- f:00024 d: 269 | OR[269] = A
0x0089 (0x000112) 0x2118- f:00020 d: 280 | A = OR[280]
0x008A (0x000114) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x008B (0x000116) 0x2908- f:00024 d: 264 | OR[264] = A
0x008C (0x000118) 0x3108- f:00030 d: 264 | A = (OR[264])
0x008D (0x00011A) 0x8613- f:00103 d: 19 | P = P + 19 (0x00A0), A # 0
0x008E (0x00011C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x008F (0x00011E) 0x2927- f:00024 d: 295 | OR[295] = A
0x0090 (0x000120) 0x2118- f:00020 d: 280 | A = OR[280]
0x0091 (0x000122) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0092 (0x000124) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0093 (0x000126) 0x2928- f:00024 d: 296 | OR[296] = A
0x0094 (0x000128) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0095 (0x00012A) 0x2929- f:00024 d: 297 | OR[297] = A
0x0096 (0x00012C) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0097 (0x00012E) 0x5800- f:00054 d: 0 | B = A
0x0098 (0x000130) 0x1800-0x1F18 f:00014 d: 0 | A = 7960 (0x1F18)
0x009A (0x000134) 0x7C09- f:00076 d: 9 | R = OR[9]
0x009B (0x000136) 0x2006- f:00020 d: 6 | A = OR[6]
0x009C (0x000138) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x009D (0x00013A) 0x2908- f:00024 d: 264 | OR[264] = A
0x009E (0x00013C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x009F (0x00013E) 0x290D- f:00024 d: 269 | OR[269] = A
0x00A0 (0x000140) 0x2118- f:00020 d: 280 | A = OR[280]
0x00A1 (0x000142) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00A2 (0x000144) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A3 (0x000146) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00A4 (0x000148) 0x291C- f:00024 d: 284 | OR[284] = A
0x00A5 (0x00014A) 0x2118- f:00020 d: 280 | A = OR[280]
0x00A6 (0x00014C) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00A7 (0x00014E) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A8 (0x000150) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00A9 (0x000152) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00AA (0x000154) 0x210D- f:00020 d: 269 | A = OR[269]
0x00AB (0x000156) 0x211C- f:00020 d: 284 | A = OR[284]
0x00AC (0x000158) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x00AD (0x00015A) 0x8405- f:00102 d: 5 | P = P + 5 (0x00B2), A = 0
0x00AE (0x00015C) 0x211C- f:00020 d: 284 | A = OR[284]
0x00AF (0x00015E) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x00B0 (0x000160) 0x8402- f:00102 d: 2 | P = P + 2 (0x00B2), A = 0
0x00B1 (0x000162) 0x702B- f:00070 d: 43 | P = P + 43 (0x00DC)
0x00B2 (0x000164) 0x211C- f:00020 d: 284 | A = OR[284]
0x00B3 (0x000166) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x00B4 (0x000168) 0x8402- f:00102 d: 2 | P = P + 2 (0x00B6), A = 0
0x00B5 (0x00016A) 0x7004- f:00070 d: 4 | P = P + 4 (0x00B9)
0x00B6 (0x00016C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00B7 (0x00016E) 0x291D- f:00024 d: 285 | OR[285] = A
0x00B8 (0x000170) 0x7003- f:00070 d: 3 | P = P + 3 (0x00BB)
0x00B9 (0x000172) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00BA (0x000174) 0x291D- f:00024 d: 285 | OR[285] = A
0x00BB (0x000176) 0x2118- f:00020 d: 280 | A = OR[280]
0x00BC (0x000178) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017)
0x00BD (0x00017A) 0x2908- f:00024 d: 264 | OR[264] = A
0x00BE (0x00017C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00BF (0x00017E) 0x2923- f:00024 d: 291 | OR[291] = A
0x00C0 (0x000180) 0x2118- f:00020 d: 280 | A = OR[280]
0x00C1 (0x000182) 0x141F- f:00012 d: 31 | A = A + 31 (0x001F)
0x00C2 (0x000184) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C3 (0x000186) 0x2123- f:00020 d: 291 | A = OR[291]
0x00C4 (0x000188) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00C5 (0x00018A) 0x2118- f:00020 d: 280 | A = OR[280]
0x00C6 (0x00018C) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017)
0x00C7 (0x00018E) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C8 (0x000190) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00C9 (0x000192) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00CA (0x000194) 0x2118- f:00020 d: 280 | A = OR[280]
0x00CB (0x000196) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x00CC (0x000198) 0x2908- f:00024 d: 264 | OR[264] = A
0x00CD (0x00019A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00CE (0x00019C) 0x2925- f:00024 d: 293 | OR[293] = A
0x00CF (0x00019E) 0x2118- f:00020 d: 280 | A = OR[280]
0x00D0 (0x0001A0) 0x1420- f:00012 d: 32 | A = A + 32 (0x0020)
0x00D1 (0x0001A2) 0x2908- f:00024 d: 264 | OR[264] = A
0x00D2 (0x0001A4) 0x2125- f:00020 d: 293 | A = OR[293]
0x00D3 (0x0001A6) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00D4 (0x0001A8) 0x2118- f:00020 d: 280 | A = OR[280]
0x00D5 (0x0001AA) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x00D6 (0x0001AC) 0x2908- f:00024 d: 264 | OR[264] = A
0x00D7 (0x0001AE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00D8 (0x0001B0) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00D9 (0x0001B2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00DA (0x0001B4) 0x2924- f:00024 d: 292 | OR[292] = A
0x00DB (0x0001B6) 0x72AB- f:00071 d: 171 | P = P - 171 (0x0030)
0x00DC (0x0001B8) 0x2118- f:00020 d: 280 | A = OR[280]
0x00DD (0x0001BA) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00DE (0x0001BC) 0x2908- f:00024 d: 264 | OR[264] = A
0x00DF (0x0001BE) 0x211C- f:00020 d: 284 | A = OR[284]
0x00E0 (0x0001C0) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00E1 (0x0001C2) 0x2122- f:00020 d: 290 | A = OR[290]
0x00E2 (0x0001C4) 0x966A- f:00113 d: 106 | R = P + 106 (0x014C), A # 0
0x00E3 (0x0001C6) 0x2126- f:00020 d: 294 | A = OR[294]
0x00E4 (0x0001C8) 0x8602- f:00103 d: 2 | P = P + 2 (0x00E6), A # 0
0x00E5 (0x0001CA) 0x7031- f:00070 d: 49 | P = P + 49 (0x0116)
0x00E6 (0x0001CC) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x00E7 (0x0001CE) 0x290D- f:00024 d: 269 | OR[269] = A
0x00E8 (0x0001D0) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00E9 (0x0001D2) 0x2927- f:00024 d: 295 | OR[295] = A
0x00EA (0x0001D4) 0x1800-0x00A5 f:00014 d: 0 | A = 165 (0x00A5)
0x00EC (0x0001D8) 0x2928- f:00024 d: 296 | OR[296] = A
0x00ED (0x0001DA) 0x2119- f:00020 d: 281 | A = OR[281]
0x00EE (0x0001DC) 0x2929- f:00024 d: 297 | OR[297] = A
0x00EF (0x0001DE) 0x210D- f:00020 d: 269 | A = OR[269]
0x00F0 (0x0001E0) 0x292A- f:00024 d: 298 | OR[298] = A
0x00F1 (0x0001E2) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x00F2 (0x0001E4) 0x5800- f:00054 d: 0 | B = A
0x00F3 (0x0001E6) 0x1800-0x1F18 f:00014 d: 0 | A = 7960 (0x1F18)
0x00F5 (0x0001EA) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00F6 (0x0001EC) 0x1800-0xFFFF f:00014 d: 0 | A = 65535 (0xFFFF)
0x00F8 (0x0001F0) 0x290D- f:00024 d: 269 | OR[269] = A
0x00F9 (0x0001F2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00FA (0x0001F4) 0x290E- f:00024 d: 270 | OR[270] = A
0x00FB (0x0001F6) 0x2006- f:00020 d: 6 | A = OR[6]
0x00FC (0x0001F8) 0x2910- f:00024 d: 272 | OR[272] = A
0x00FD (0x0001FA) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00FE (0x0001FC) 0x2927- f:00024 d: 295 | OR[295] = A
0x00FF (0x0001FE) 0x1800-0x00A9 f:00014 d: 0 | A = 169 (0x00A9)
0x0101 (0x000202) 0x2928- f:00024 d: 296 | OR[296] = A
0x0102 (0x000204) 0x1800-0x5052 f:00014 d: 0 | A = 20562 (0x5052)
0x0104 (0x000208) 0x2929- f:00024 d: 297 | OR[297] = A
0x0105 (0x00020A) 0x210D- f:00020 d: 269 | A = OR[269]
0x0106 (0x00020C) 0x292A- f:00024 d: 298 | OR[298] = A
0x0107 (0x00020E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0108 (0x000210) 0x292B- f:00024 d: 299 | OR[299] = A
0x0109 (0x000212) 0x210E- f:00020 d: 270 | A = OR[270]
0x010A (0x000214) 0x292C- f:00024 d: 300 | OR[300] = A
0x010B (0x000216) 0x210F- f:00020 d: 271 | A = OR[271]
0x010C (0x000218) 0x292D- f:00024 d: 301 | OR[301] = A
0x010D (0x00021A) 0x2110- f:00020 d: 272 | A = OR[272]
0x010E (0x00021C) 0x292E- f:00024 d: 302 | OR[302] = A
0x010F (0x00021E) 0x100D- f:00010 d: 13 | A = 13 (0x000D)
0x0110 (0x000220) 0x292F- f:00024 d: 303 | OR[303] = A
0x0111 (0x000222) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0112 (0x000224) 0x5800- f:00054 d: 0 | B = A
0x0113 (0x000226) 0x1800-0x1F18 f:00014 d: 0 | A = 7960 (0x1F18)
0x0115 (0x00022A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0116 (0x00022C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0117 (0x00022E) 0x291E- f:00024 d: 286 | OR[286] = A
0x0118 (0x000230) 0x2120- f:00020 d: 288 | A = OR[288]
0x0119 (0x000232) 0x8602- f:00103 d: 2 | P = P + 2 (0x011B), A # 0
0x011A (0x000234) 0x7009- f:00070 d: 9 | P = P + 9 (0x0123)
0x011B (0x000236) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x011C (0x000238) 0x2927- f:00024 d: 295 | OR[295] = A
0x011D (0x00023A) 0x2120- f:00020 d: 288 | A = OR[288]
0x011E (0x00023C) 0x2928- f:00024 d: 296 | OR[296] = A
0x011F (0x00023E) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0120 (0x000240) 0x5800- f:00054 d: 0 | B = A
0x0121 (0x000242) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0122 (0x000244) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0123 (0x000246) 0x2005- f:00020 d: 5 | A = OR[5]
0x0124 (0x000248) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x0125 (0x00024A) 0x2908- f:00024 d: 264 | OR[264] = A
0x0126 (0x00024C) 0x211E- f:00020 d: 286 | A = OR[286]
0x0127 (0x00024E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0128 (0x000250) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0129 (0x000252) 0x2927- f:00024 d: 295 | OR[295] = A
0x012A (0x000254) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x012B (0x000256) 0x5800- f:00054 d: 0 | B = A
0x012C (0x000258) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x012D (0x00025A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x012E (0x00025C) 0x2122- f:00020 d: 290 | A = OR[290]
0x012F (0x00025E) 0x1684- f:00013 d: 132 | A = A - 132 (0x0084)
0x0130 (0x000260) 0x8002- f:00100 d: 2 | P = P + 2 (0x0132), C = 0
0x0131 (0x000262) 0x7019- f:00070 d: 25 | P = P + 25 (0x014A)
0x0132 (0x000264) 0x211F- f:00020 d: 287 | A = OR[287]
0x0133 (0x000266) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0134 (0x000268) 0x290D- f:00024 d: 269 | OR[269] = A
0x0135 (0x00026A) 0x2122- f:00020 d: 290 | A = OR[290]
0x0136 (0x00026C) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0137 (0x00026E) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x0138 (0x000270) 0x290E- f:00024 d: 270 | OR[270] = A
0x0139 (0x000272) 0x2122- f:00020 d: 290 | A = OR[290]
0x013A (0x000274) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x013B (0x000276) 0x2908- f:00024 d: 264 | OR[264] = A
0x013C (0x000278) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x013D (0x00027A) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x013E (0x00027C) 0x8607- f:00103 d: 7 | P = P + 7 (0x0145), A # 0
0x013F (0x00027E) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0140 (0x000280) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0141 (0x000282) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0142 (0x000284) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0143 (0x000286) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0144 (0x000288) 0x7006- f:00070 d: 6 | P = P + 6 (0x014A)
0x0145 (0x00028A) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0146 (0x00028C) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x0148 (0x000290) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0149 (0x000292) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x014A (0x000294) 0x2D22- f:00026 d: 290 | OR[290] = OR[290] + 1
0x014B (0x000296) 0x0200- f:00001 d: 0 | EXIT
0x014C (0x000298) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x014D (0x00029A) 0x2926- f:00024 d: 294 | OR[294] = A
0x014E (0x00029C) 0x2122- f:00020 d: 290 | A = OR[290]
0x014F (0x00029E) 0x1684- f:00013 d: 132 | A = A - 132 (0x0084)
0x0150 (0x0002A0) 0x8002- f:00100 d: 2 | P = P + 2 (0x0152), C = 0
0x0151 (0x0002A2) 0x7005- f:00070 d: 5 | P = P + 5 (0x0156)
0x0152 (0x0002A4) 0x1020- f:00010 d: 32 | A = 32 (0x0020)
0x0153 (0x0002A6) 0x291F- f:00024 d: 287 | OR[287] = A
0x0154 (0x0002A8) 0x7626- f:00073 d: 38 | R = P - 38 (0x012E)
0x0155 (0x0002AA) 0x700D- f:00070 d: 13 | P = P + 13 (0x0162)
0x0156 (0x0002AC) 0x2122- f:00020 d: 290 | A = OR[290]
0x0157 (0x0002AE) 0x1684- f:00013 d: 132 | A = A - 132 (0x0084)
0x0158 (0x0002B0) 0x8003- f:00100 d: 3 | P = P + 3 (0x015B), C = 0
0x0159 (0x0002B2) 0x8402- f:00102 d: 2 | P = P + 2 (0x015B), A = 0
0x015A (0x0002B4) 0x7002- f:00070 d: 2 | P = P + 2 (0x015C)
0x015B (0x0002B6) 0x7007- f:00070 d: 7 | P = P + 7 (0x0162)
0x015C (0x0002B8) 0x1084- f:00010 d: 132 | A = 132 (0x0084)
0x015D (0x0002BA) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x015E (0x0002BC) 0x2922- f:00024 d: 290 | OR[290] = A
0x015F (0x0002BE) 0x107F- f:00010 d: 127 | A = 127 (0x007F)
0x0160 (0x0002C0) 0x291F- f:00024 d: 287 | OR[287] = A
0x0161 (0x0002C2) 0x7633- f:00073 d: 51 | R = P - 51 (0x012E)
0x0162 (0x0002C4) 0x2119- f:00020 d: 281 | A = OR[281]
0x0163 (0x0002C6) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0164 (0x0002C8) 0x2908- f:00024 d: 264 | OR[264] = A
0x0165 (0x0002CA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0166 (0x0002CC) 0x290D- f:00024 d: 269 | OR[269] = A
0x0167 (0x0002CE) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0168 (0x0002D0) 0x2927- f:00024 d: 295 | OR[295] = A
0x0169 (0x0002D2) 0x210D- f:00020 d: 269 | A = OR[269]
0x016A (0x0002D4) 0x2928- f:00024 d: 296 | OR[296] = A
0x016B (0x0002D6) 0x2119- f:00020 d: 281 | A = OR[281]
0x016C (0x0002D8) 0x2929- f:00024 d: 297 | OR[297] = A
0x016D (0x0002DA) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x016E (0x0002DC) 0x292A- f:00024 d: 298 | OR[298] = A
0x016F (0x0002DE) 0x2120- f:00020 d: 288 | A = OR[288]
0x0170 (0x0002E0) 0x292B- f:00024 d: 299 | OR[299] = A
0x0171 (0x0002E2) 0x2122- f:00020 d: 290 | A = OR[290]
0x0172 (0x0002E4) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0173 (0x0002E6) 0x292C- f:00024 d: 300 | OR[300] = A
0x0174 (0x0002E8) 0x1127- f:00010 d: 295 | A = 295 (0x0127)
0x0175 (0x0002EA) 0x5800- f:00054 d: 0 | B = A
0x0176 (0x0002EC) 0x1800-0x1F18 f:00014 d: 0 | A = 7960 (0x1F18)
0x0178 (0x0002F0) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0179 (0x0002F2) 0x2913- f:00024 d: 275 | OR[275] = A
0x017A (0x0002F4) 0x8602- f:00103 d: 2 | P = P + 2 (0x017C), A # 0
0x017B (0x0002F6) 0x700B- f:00070 d: 11 | P = P + 11 (0x0186)
0x017C (0x0002F8) 0x2113- f:00020 d: 275 | A = OR[275]
0x017D (0x0002FA) 0x1602- f:00013 d: 2 | A = A - 2 (0x0002)
0x017E (0x0002FC) 0x8402- f:00102 d: 2 | P = P + 2 (0x0180), A = 0
0x017F (0x0002FE) 0x7004- f:00070 d: 4 | P = P + 4 (0x0183)
0x0180 (0x000300) 0x1021- f:00010 d: 33 | A = 33 (0x0021)
0x0181 (0x000302) 0x291E- f:00024 d: 286 | OR[286] = A
0x0182 (0x000304) 0x7003- f:00070 d: 3 | P = P + 3 (0x0185)
0x0183 (0x000306) 0x1022- f:00010 d: 34 | A = 34 (0x0022)
0x0184 (0x000308) 0x291E- f:00024 d: 286 | OR[286] = A
0x0185 (0x00030A) 0x726D- f:00071 d: 109 | P = P - 109 (0x0118)
0x0186 (0x00030C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0187 (0x00030E) 0x2922- f:00024 d: 290 | OR[290] = A
0x0188 (0x000310) 0x1032- f:00010 d: 50 | A = 50 (0x0032)
0x0189 (0x000312) 0x3920- f:00034 d: 288 | (OR[288]) = A
0x018A (0x000314) 0x0200- f:00001 d: 0 | EXIT
0x018B (0x000316) 0x0000- f:00000 d: 0 | PASS
0x018C (0x000318) 0x0000- f:00000 d: 0 | PASS
0x018D (0x00031A) 0x0000- f:00000 d: 0 | PASS
0x018E (0x00031C) 0x0000- f:00000 d: 0 | PASS
0x018F (0x00031E) 0x0000- f:00000 d: 0 | PASS
|
.8086
PUBLIC gis_cHugeShift
PUBLIC gis_uchMajorVersion
PUBLIC gis_uchMinorVersion
PUBLIC gis_chRevisionLetter
PUBLIC gis_bootdrive
_GINFOSEG SEGMENT PARA PUBLIC 'GDATA' USE16
gis_time dd ? ;time in seconds
gis_msecs dd ? ;milliseconds
gis_hour db ? ;hours
gis_minutes db ? ;minutes
gis_seconds db ? ;seconds
gis_hundredths db ? ;hundredths
gis_timezone dw ? ;minutes from UTC
gis_cusecTimerInterval dw ? ;timer interval (units = 0.0001 seconds)
gis_day db ? ;day
gis_month db ? ;month
gis_year dw ? ;year
gis_weekday db ? ;day of week
gis_uchMajorVersion db ? ;major version number
gis_uchMinorVersion db ? ;minor version number
gis_chRevisionLetter db ? ;revision letter
gis_sgCurrent db 1 ;current foreground session
gis_sgMax db 1 ;maximum number of sessions
gis_cHugeShift db 12 ;shift count for huge elements
gis_fProtectModeOnly db 0 ;protect mode only indicator
gis_pidForeground dw ? ;pid of last process in foreground session
gis_fDynamicSched db ? ;dynamic variation flag
gis_csecMaxWait db ? ;max wait in seconds
gis_cmsecMinSlice dw ? ;minimum timeslice (milliseconds)
gis_cmsecMaxSlice dw ? ;maximum timeslice (milliseconds)
gis_bootdrive dw 1 ;drive from which the system was booted
gis_amecRAS db 32 dup (?) ;system trace major code flag bits
gis_csgWindowableVioMax db 0 ;maximum number of VIO windowable sessions
gis_csgPMMax db 0 ;maximum number of pres. services sessions
_GINFOSEG ends
end
|
; A017356: a(n) = (10*n+7)^4.
; 2401,83521,531441,1874161,4879681,10556001,20151121,35153041,57289761,88529281,131079601,187388721,260144641,352275361,466948881,607573201,777796321,981506241,1222830961,1506138481,1836036801,2217373921,2655237841,3154956561,3722098081,4362470401,5082121521,5887339441,6784652161,7780827681,8882874001,10098039121,11433811041,12897917761,14498327281,16243247601,18141126721,20200652641,22430753361,24840596881,27439591201,30237384321,33243864241,36469158961,39923636481,43617904801,47562811921
mul $0,10
add $0,7
pow $0,4
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: Desktop
FILE: Main
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/24/92 Initial version
dlitwin 3/18/92 grabbed from CDManager, ported, modified
ROUTINES:
MakeDOSLauncher - calls other routines to manage creation
LoadLauncherDataFromUI - loads LauncherData lmem heap from UI objects
LauncherGrabFlagsFromUI - loads LauncherData flags from UI objects
LauncherGrabTokenFromUI - loads idata's LauncherToken field from UI
LauncherReadEntryTables - reads the header and entry tables of launcher
LauncherReadResources - reads all the resources of the launcher
LauncherReadFileSectionIntoBlock- allocates a block and reads n bytes into it
LauncherModifyResources - modifies the launcher's resources to customize
LauncherModifyLauncherStrings - replace LauncherStrings with LauncherData
LauncherModifyMonikers - modifies the icon moniker resources (new icon)
LauncherLockResource - locks a resource and converts it to an lmem
LauncherUnlockResource - unlocks a resource and converts it back
LauncherPrepForWriting - opens a new file or resets the FilePos to 0
LauncherWriteFile - calls other routines to manage writing of file
LauncherWriteResources - writes out the resources
LauncherWriteBlockToFile - writes a mem block to the file and frees it
DOSLauncherCancelEditBox - frees launcherData, tokenList and closes file
STRUCTURE:
- MakeDOSLauncher
- LoadLauncherDataFromUI
- LauncherGrabFlagsFromUI
- LauncherGrabTokenFromUI
- LauncherReadEntryTables
- LauncherReadResources
- LauncherReadFileSectionIntoBlock
- LauncherModifyResources
- LauncherModifyLauncherStrings
- LauncherModifyMonikers
- LauncherLockResource
- LauncherUnlockResource
- LauncherPrepForWriting
- LauncherWriteFile
- LauncherWriteResources
- LauncherWriteBlockToFile
- DOSLauncherCancelEditBox
DESCRIPTION:
The basic launcher strategy is thus:
1.) User Selects Create or Edit launcher.
2.) From this selection we open default launcher
or a selected existing launcher to edit.
3.) We load the UI dialog box with info from the 3rd resourse of
this file. This resource is fixed, and is the LauncherStrings
resource (launcherData inside of GeoManager).
4.) User edits/changes this info and clicks "OK".
5.) The new state of the launcher is written into our
"launcherData" block.
6.) We read in the Entry table, resources and resource table.
7.) Modify moniker resources, swap our launcherData lmem block with
the third resource and then recalculate the resource table.
8.) If creating, we close the default launcher and open the new
launcher in the DOS Room directory, if editing we leave the
edited file open but reset to the beginning of the file.
9.) We put new token in header and write out all resources and
tables.
10.) Close up and quit.
** The first half of this process (1-4) is handled in mainLauncher.asm,
and second half (5-10) is handled in mainCreateLauncher.asm
RCS STAMP:
$Id: cmainCreateLauncher.asm,v 1.1 97/04/04 15:00:24 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ifndef GEOLAUNCHER
CreateLauncherCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MakeDOSLauncher
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Create a launcher using
CALLED BY: UI (OK button in Edit Launcher Box)
PASS: *ds:si = instance data
es = segment of DesktopClass
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/4/92 rewrote (started from CDMCreateLauncher)
dlitwin 6/30/92 minor mods to
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MakeDOSLauncher method DesktopClass, MSG_MAKE_DOS_LAUNCHER
.enter
call FileBatchChangeNotifications
NOFXIP< segmov es, dgroup, bx ; es = dgroup >
FXIP < GetResourceSegmentNS dgroup, es, TRASH_BX >
;
; if we haven't done proper setup, bail
;
tst es:[launcherData]
LONG jz exit
tst es:[launcherFileHandle]
LONG jz exit
call LoadLauncherDataFromUI
mov al, FILE_POS_START
mov bx, es:[launcherFileHandle] ;restore file handle
clr cx ; beginning of file
clr dx
call FilePos
call LauncherReadEntryTables
jc closeLauncher ; exit if error
call LauncherReadResources
jc closeLauncher ; exit if error
call LauncherModifyResources
jc closeLauncher ; exit if error
call LauncherPrepForWriting
jc closeLauncher ; exit if error
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
mov bx, handle EditLauncherBox
mov si, offset EditLauncherBox
mov di, mask MF_CALL
call ObjMessage ; close dialog
call LauncherWriteFile
pushf
jmp closeFile
closeLauncher:
pushf ; save error state
jnc closeFile
cmp ax, ERROR_FILE_EXISTS
je tryAgain ; let them try a new filename
closeFile:
clr bx
xchg bx, es:[launcherFileHandle]
tst bx
jz noFH
push ax ; save error code
clr ax
call FileClose ; close created file
pop ax ; restore error code
noFH:
; jmp freeOldMemoryBlocks
; must close dialog also as we closed the file. The file is not re-opened
; unless we re-open the dialog - brianc 4/7/93
jmp closeAndFree
tryAgain: ; no created file to close
call GetDefaultLauncherName
mov al, FILE_ACCESS_R or FILE_DENY_W
call FileOpen ; open default file up again
mov bx, ax
mov es:[launcherFileHandle], ax ; save this handle
mov ax, ERROR_FILE_EXISTS ; restore error again
jnc freeOldMemoryBlocks
mov ax, bx ; ax = FileOpen Error code
closeAndFree:
push ax ; save error code
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
mov bx, handle EditLauncherBox
mov si, offset EditLauncherBox
mov di, mask MF_CALL
call ObjMessage ; close dialog
pop ax ; restore error code
freeOldMemoryBlocks:
call LauncherFreeAllMem ; free all used memory blocks
popf ; restore error state
jnc launcherMadeNoErrors ; continue if no errors
call DesktopOKError ; handle error that occured
jmp exit ; exit after error handled
launcherMadeNoErrors:
clr bx
xchg bx, es:[tokenList]
tst bx
jz noTL
call MemFree ; free list of tokens
noTL:
clr bx
xchg bx, es:[launcherData]
tst bx
jz noLD
call MemFree ; free up launcherData
noLD:
tst es:[creatingLauncher]
jnz updateCommon
mov bx, es:[launchFilePathHandle]
call MemLock
push bx
mov es, ax
mov cx, es:[GFP_disk]
mov bx, offset GFP_path
mov bx, es:[GFP_disk]
segmov ds, es, dx
mov dx, offset GFP_path
call FileSetCurrentPath ; set to current path
pop bx
call MemUnlock
segmov es, ss, di ; restore dgroup to es
call LauncherHandleRename
jmp updateCommon
updateCommon:
clr bx
xchg bx, es:[launchFilePathHandle]
tst bx
jz noFPH
call MemFree
noFPH:
call UpdateMarkedWindows
exit:
call FileFlushChangeNotifications
.leave
ret
MakeDOSLauncher endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherHandleRename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: This routine renames an edited file and informs the user if
the new name is already taken.
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: nothing
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 4/22/92 Initial Version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherHandleRename proc near
.enter
EC < ECCheckDGroup es >
clr ax ; looking for null
mov cx, FILE_LONGNAME_LENGTH
mov di, offset launcherGeosName ; put new name in es:di
mov si, di ; put start of string in si
SBCS < repnz scasb ; getting length of string>
DBCS < repnz scasw ; getting length of string>
sub di, si ; size is difference
mov bx, di ; save in bx
clr ax ; looking for null
mov cx, FILE_LONGNAME_LENGTH
mov di, offset oldLauncherName
mov si, di ; put start of string in si
SBCS < repnz scasb ; getting length of string>
DBCS < repnz scasw ; getting length of string>
sub di, si ; size is difference
mov cx, di ; put default smaller in cx
cmp bx, di
jg diIsSmaller
mov cx, bx ; put smaller size in cx
diIsSmaller:
segmov ds, es, di ; put dgroup in ds
mov di, offset launcherGeosName ; put new name in es:di
mov si, offset oldLauncherName ; put current name in ds:si
repz cmpsb ; check for equality
jz exit ; exit if the names are same
mov si, offset launcherGeosName ; point ds:si to geos name
mov di, offset fileOperationInfoEntryBuffer + FOIE_name
mov cx, FILE_LONGNAME_LENGTH
SBCS < rep movsb ; set up fileOperationInf...>
DBCS < rep movsw ; set up fileOperationInf...>
mov es:[fileOperationInfoEntryBuffer].FOIE_type, GFT_EXECUTABLE
clr es:[fileOperationInfoEntryBuffer].FOIE_attrs
mov dx, offset oldLauncherName ; current name in ds:dx
mov di, offset launcherGeosName ; new name in es:di
call FileRename
jnc exit ; exit if rename went OK
cmp ax, ERROR_ACCESS_DENIED
jne regularError
mov ax, ERROR_LAUNCHER_NAME_CONFLICT
regularError:
call DesktopOKError
exit:
.leave
ret
LauncherHandleRename endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LoadLauncherDataFromUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: This routine fills the launcherData block with Info from the UI
CALLED BY: LoadLauncherDataFromUI
PASS: es = dgroup
RETURN: nothing
DESTROYED: all but es (remains dgroup)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/23/92 Initial Version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LoadLauncherDataFromUI proc near
.enter
EC < ECCheckDGroup es >
mov bx, es:[launcherData]
call MemLock
mov ds, ax ; lock down launcherData to ds
call LauncherGrabFlagsFromUI
call LauncherGrabTokenFromUI
; launch file is already in launcherData
; Geos Name
mov dx, es ; put dgroup in dx
mov bp, offset launcherGeosName ; put Geos Name in idata
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov bx, handle EditLauncherGeosName
mov si, offset EditLauncherGeosName
mov di, mask MF_CALL
call ObjMessage
; Arguments
; make sure this lmem chunk is large enough
mov ax, ds:[LMBH_offset]
add ax, LDC_ARGUMENTS
mov cx, PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE
call LMemReAlloc
mov dx, ds ; put launcherData block into dx
mov si, ds:[LMBH_offset]
mov bp, ds:[si][LDC_ARGUMENTS] ; put arguments chunk in dx:bp
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov bx, handle EditLauncherArgumentText
mov si, offset EditLauncherArgumentText
mov di, mask MF_CALL
call ObjMessage
mov bx, es:[launcherData]
call MemUnlock ; unlock launcherData
.leave
ret
LoadLauncherDataFromUI endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherGrabFlagsFromUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: This routine looks at what list items are set in the UI and
sets the launcherData flags accordingly
CALLED BY: LoadLauncherDataFromUI
PASS: ds = locked down launcherData block
es = dgroup
RETURN: nothing
DESTROYED: all but ds, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/23/92 Initial Version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherGrabFlagsFromUI proc near
.enter
EC < ECCheckDGroup es >
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherPromptReturnList
mov si, offset EditLauncherPromptReturnList
mov di, mask MF_CALL
call ObjMessage
push ax ; save prompt return flag
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherPromptFileList
mov si, offset EditLauncherPromptFileList
mov di, mask MF_CALL
call ObjMessage
push ax ; save prompt file flag
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherConfirmList
mov si, offset EditLauncherConfirmList
mov di, mask MF_CALL
call ObjMessage
push ax ; save confirm flag
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherUserSuppliedArgsList
mov si, offset EditLauncherUserSuppliedArgsList
mov di, mask MF_CALL
call ObjMessage
pop bx ; restore confirm flag
or ax, bx ; combine with arg flag
pop bx ; restore prompt file flag
or ax, bx ; combine these flags
pop bx ; restore prompt return flag
or ax, bx ; combine these flags
push ax
mov ax, MSG_VIS_TEXT_GET_ALL_BLOCK
mov bx, handle EditLauncherDocFile
mov si, offset EditLauncherDocFile
clr dx ; alloc a block
mov di, mask MF_CALL
call ObjMessage
push cx ; handle
clr bp ; use to hold flags
tst ax
jz noDocFile
push ds
mov bx, cx
call MemLock
mov ds, ax
clr si ; ds:si = text block
call FolderGetNonGEOSTokenOfCreator
pop ds
jc noDocFile ; no token => no doc file
mov di, ds:[LMBH_offset]
mov di, ds:[di][LDC_DOCREADERTOKEN]
mov {word}ds:[di].GT_chars, ax
mov {word}ds:[di].GT_chars+2, bx
mov ds:[di].GT_manufID, si
mov bp, mask LDF_PROMPT_DOC ; set DOC flag
noDocFile:
pop bx
call MemFree ; free up docfile string
pop ax
or ax, bp
mov si, ds:[LMBH_offset]
mov si, ds:[si][LDC_LAUNCHER_FLAGS] ; put flags chunk in ds:si
mov ds:[si], al ; set flags
.leave
ret
LauncherGrabFlagsFromUI endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherGrabTokenFromUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: This routine copies the token chars into launcherData.
CALLED BY: LoadLauncherDataFromUI
PASS: ds = locked down launcherData block
es = dgroup
RETURN: nothing
DESTROYED: all but es, ds
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/23/92 Initial Version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherGrabTokenFromUI proc near
.enter
EC < ECCheckDGroup es >
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherChooseIconList
mov si, offset EditLauncherChooseIconList
mov di, mask MF_CALL
call ObjMessage
EC < cmp ax, es:[tokenListSize] >
EC < ERROR_GE BOGUS_ICON_CHOSEN >
mov cx, ax ; put item # in cx
shl cx ; double item #
add cx, ax ; triple item #
shl cx ; six times item #
push ds ; save launcherData block
mov bx, es:[tokenList] ; put list handle in bx
call MemLock ; lock it down
mov ds, ax ; put in ds
mov si, cx ; point ds:si to token
mov di, offset launcherMonikerToken ; point es:di to monikerToken
movsw ; copy token chars 1 & 2
movsw ; copy token chars 3 & 4
movsw ; copy manufacturer's ID
call MemUnlock ; unlock tokenList
; See if the option to override the token for the geode header
; and file header is set to YES.
;
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherOptionTokenManual
mov si, offset EditLauncherOptionTokenManual
call ObjMessageCall
tst ax
jz copyToToken ; nope, use same token
; Make sure we have 4 chars in the token chars field.
;
mov ax, MSG_VIS_TEXT_GET_ALL_BLOCK
EC < cmp bx, handle EditLauncherOptionTokenChars >
EC < ERROR_NE ILLEGAL_VALUE >
mov si, offset EditLauncherOptionTokenChars
clr dx ; allocate block
call ObjMessageCall
jcxz copyToToken ; no block returned?
cmp ax, size TokenChars ; have 4 chars?
mov bx, cx ; handle to BX
jne freeBXCopyToken
call MemLock ; lock down the block
mov ds, ax ; ds:si = token field
clr si
mov di, offset launcherToken ; es:di = launcher token
.assert (offset GT_chars) eq 0
movsw
movsw
call MemFree ; bye bye block
push di ; es:di points to manufID
mov ax, MSG_GEN_VALUE_GET_VALUE
mov bx, handle EditLauncherOptionTokenManufID
mov si, offset EditLauncherOptionTokenManufID
call ObjMessageCall ; get manufID
pop di ; es:di -> manufID
mov ax, dx
stosw ; stuff It
jmp doneCopying
freeBXCopyToken:
call MemFree
copyToToken:
segmov ds, es, cx ; make tokens the same
mov si, offset launcherMonikerToken
mov di, offset launcherToken
movsw
movsw
movsw
doneCopying:
pop ds ; restore launcherData block
.leave
ret
LauncherGrabTokenFromUI endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherReadEntryTables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Read the Imported Library Entries and Exported Routine Tables
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: Nothing
DESTROYED: all but es
PSEUDO CODE/STRATEGY:
Figure out the size of the tables
multiply the size of ILEs by their number
multiply the size of ERTs by their numner
read the tables from the master launcher
write them to the new launcher
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/29/92 Initial version
dlitwin 4/2/92 Split this up into this routine and new
function LauncherWriteEntryTables.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherReadEntryTables proc near
uses ds
.enter
EC < ECCheckDGroup es >
; lock out a block large enough for the info
CheckHack <(offset GFH_coreBlock + size GFH_coreBlock) eq \
size GeodeFileHeader>
mov ax, offset GFH_coreBlock.GH_geoHandle ; all core block
; vars from here on
; aren't in the file
mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE
;allocate as HF_SWAPABLE and HAF_LOCK
call MemAlloc
; FIX this error condition
mov es:[launcherHeaderHandle], bx ; save header handle
; now read in the launcher info
; bx = file handle, ds:dx = buffer, al = 0, cx = length
mov bx, es:[launcherFileHandle] ;restore file handle
mov ds, ax ;ds:dx = buffer
clr dx
clr al
mov cx, offset GFH_coreBlock.GH_geoHandle
call FileRead
jc exit
; get the size of the imported library table
mov ax, ds:[GFH_execHeader.EFH_importLibraryCount]
mov dl, size ImportedLibraryEntry
mul dl
mov di, ax ;save size
;get the size of the exported routine table
mov ax, ds:[GFH_execHeader.EFH_exportEntryCount]
mov dl, 4 ;size of export Entry
mul dl
add di, ax ;we have the size
mov bx, es:[launcherHeaderHandle] ; restore header block handle
call MemUnlock
;allocate a locked block large enough for the lib and routine tables
mov ax, di ;block size
mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE
call MemAlloc
; fix this error condition
mov es:[launcherEntryTable], bx ;save table handle
;read the tables from the master launcher
mov bx, es:[launcherFileHandle]
mov ds, ax ; ds <= block
clr al ; no flags
mov cx, di ; bytes to read
clr dx
call FileRead
jc exit
mov es:[launcherEntryTableSize], cx ; save the size for writing
mov bx, es:[launcherEntryTable] ; restore handle
call MemUnlock
clc ; no error
exit:
.leave
ret
LauncherReadEntryTables endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherReadResources
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Read the launcher resource table and resources
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: Nothing
DESTROYED: all but es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/31/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherReadResources proc near
.enter
EC < ECCheckDGroup es >
;calc the size of the resource table
mov cx, LAUNCHER_RESOURCE_TABLE_SIZE
;read in the resource table into bx and save the handle
mov dx, es:[launcherFileHandle]
call LauncherReadFileSectionIntoBlock
LONG jc exit
mov es:[resourceTableHandle], bx
;use ds for the resource table
call MemLock
mov ds, ax
;Now loop through the resources, reading the resource into a block and then
;the reallocation info into another block.
;si is the index to the arrays. Since the arrays are of words the
;index is points to every two bytes. That is why we inc twice.
;read from the master launcher file
mov dx, es:[launcherFileHandle] ;dx stays preserved
;get the size of the resource block
clr si
nextResource: ;start of loop
mov cx, ds:[si]
tst cx
jz doneResource
;
; data resources are paragraph sized in the file
;
test cx, 15
jz 30$
andnf cx, not 15
add cx, 16
30$:
;
; verify file position for resource
;
if ERROR_CHECK
push cx, dx ; save size, file handle
mov bx, dx ; bx = file handle
mov al, FILE_POS_RELATIVE
clr cx ; no movement, please
clr dx
call FilePos ; dx:ax = current position
shl si, 1 ; TEMP convert to dword offset
cmp dx, ({dword} ds:[FILE_POS_INFO_OFFSET][si]).high
ERROR_NE DESKTOP_FATAL_ERROR
cmp ax, ({dword} ds:[FILE_POS_INFO_OFFSET][si]).low
ERROR_NE DESKTOP_FATAL_ERROR
shr si, 1 ; TEMP convert back word offset
pop cx, dx ; restore size, file handle
endif
;read in the resource to bx and save the handle
;if the resource size is zero then just skip it and the handle should
;be null.
call LauncherReadFileSectionIntoBlock
jc exit
mov es:[resourceHandleList][si], bx
doneResource:
;now read in the reallocation info
;get the size of the resource block
mov cx, ds:[si][REALLOCATION_INFO_OFFSET] ;use realloc info array
tst cx
jz doneRealloc
;read in the resource to bx and save the handle
mov dx, es:[launcherFileHandle]
call LauncherReadFileSectionIntoBlock
jc exit
mov es:[resourceReallocHandleList][si], bx
doneRealloc:
;go to the next resource
inc si ;si is by words
inc si ;so inc twice
cmp si, LAUNCHER_RESOURCE_COUNT * 2
jl nextResource
;now unlock the resource table block
mov bx, es:[resourceTableHandle]
call MemUnlock
exit:
.leave
ret
LauncherReadResources endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherReadFileSectionIntoBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Read the next n bytes from a file and return a block handle
CALLED BY:
PASS: cx = bytes to read from file
dx = file handle
RETURN: bx = block handle
carry = set if error, ax is error code (FileErrors)
DESTROYED: ax
ds unless ds is a fixed block
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/30/92 Initial version
dlitwin 4/22/92 revised to not take block and free it before
allocating a new block. Now we just allocate.
Added memory error check.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherReadFileSectionIntoBlock proc near
uses dx, ds
.enter
mov ax, cx
push ax ; save block size
mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE
call MemAlloc
mov ds, ax
mov ax, ERROR_INSUFFICIENT_MEMORY
pop cx ; restore block size
jc exit
push bx ; save block handle
;read the block from the passed file
;al - flags, bx - file handle, cx - bytes, ds:dx - buffer
clr al ; no flags
mov bx, dx
clr dx ; start at byte pos 0
call FileRead ; (carry set if error)
pop bx ; restore handle
call MemUnlock ; unlock the block
; (preserves flags)
exit:
.leave
ret
LauncherReadFileSectionIntoBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherModifyResources
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Modify the resources and recalc the resource table
CALLED BY: MakeDOSCreateLauncher
PASS: es = dgroup
RETURN: ???
DESTROYED: ???
PSEUDO CODE/STRATEGY:
make all calls to modify resources
recalculate the reallocation table
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 2/10/92 Initial version
dlitwin 4/30/92 Changed modification of monikers to go
through the moniker list.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherModifyResources proc near
.enter
EC < ECCheckDGroup es >
segmov ds, es, di ; put dgroup in ds
mov bx, es:[launcherHeaderHandle]
mov si, offset launcherToken
call MemLock
mov es, ax ; lock down header into es
mov di, offset GFH_coreBlock.GH_geodeToken
movsw
movsw ; copy token to header
movsw
call MemUnlock
segmov es, ds, di ; restore dgroup to es
call LauncherModifyLauncherStrings
; If we are editing a launcher, check to see if the user
; really wants to modify the moniker already in the launcher.
;
tst es:[creatingLauncher]
jnz modMonikers
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherChangeMonikerList
mov si, offset EditLauncherChangeMonikerList
call ObjMessageCall
jc modMonikers ; just in case none selected.
tst ax
jz skipMonikers
modMonikers:
call LauncherModifyMonikers
jc exit
skipMonikers:
;lock the resource table into ds
mov bx, es:[resourceTableHandle]
call MemLock
mov ds, ax
; we must fix up the resource table by recalculating the resources.
; Loop through the resources, updating the sizes of the resources
; and updating the file position
; si is the index to the arrays. Since the arrays are of words the
; index is points to every two bytes. That is why we inc twice.
; we don't start at the first few resources becausethey aren't data
mov bp, FIRST_MODIFIABLE_RESOURCE * 2 ;start of loop
nextResource:
;get the size of the block point by the resource handle
mov bx, es:[resourceHandleList][bp]
mov ax, MGIT_SIZE
call MemGetInfo
mov ds:[bp], ax ;update the size
;now calculate the file position for the resource
mov bx, bp ;save index
sub bp, 2 ;look back an entry
mov ax, ds:[bp] ;resource size
;
; data resources are paragraph sized in the file
;
test ax, 15
jz 30$
andnf ax, not 15
add ax, 16
30$:
add ax, ds:[bp][REALLOCATION_INFO_OFFSET] ;plus realloc size
shl bp, 1 ;index by dwords
add ax, ds:[bp][FILE_POS_INFO_OFFSET] ;plus file position
add bp, 4 ;inc one entry (dword)
mov ds:[bp][FILE_POS_INFO_OFFSET], ax ;makes new file position
mov bp, bx ;restore index to cur.
;go to the next resource
inc bp ;bp is by words
inc bp ;bp is by words
cmp bp, LAUNCHER_RESOURCE_COUNT * 2
jl nextResource
;now free the resource table block
mov bx, es:[resourceTableHandle]
call MemUnlock
exit:
.leave
ret
LauncherModifyResources endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherModifyLauncherStrings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Make the resource handle table point to us, and free the
old LauncherStrings
CALLED BY: LauncherModifyResources
PASS: es = dgroup
RETURN: nothing
DESTROYED: all but es (remains dgroup)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 2/10/92 Initial version
dlitwin 3/26/92 Modified to resize lmem chunk and write directly
to them from launcherData fields, stored in the
LauncherInfoTable.
dlitwin 4/2/92 changed to take existing lmem block and swap
with the third resource instead of copying.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherModifyLauncherStrings proc near
.enter
EC < ECCheckDGroup es >
;
; free old LauncherStrings resource (launcherData resource)
;
mov bx, es:[resourceHandleList+(2*LAUNCHERSTRINGS_RESID)]
tst bx
jz noOldLauncherStrings ; launcherData resource
call MemFree
;
; lock down launcherData into ds
;
noOldLauncherStrings: ; launcherData resource
mov bx, es:[launcherData]
call MemLock
mov ds, ax
;
; restore resID
;
mov ds:[LMBH_handle], LAUNCHERSTRINGS_RESID
;
; point LauncherStrings resource handle to us
;
mov es:[resourceHandleList+(2*LAUNCHERSTRINGS_RESID)], bx
mov ax, (mask HF_LMEM) shl 8 ; clear only LMEM flag
call MemModifyFlags ; make it a resource again
call MemUnlock
.leave
ret
LauncherModifyLauncherStrings endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherModifyMonikers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Go down the moniker list and replace each moniker with the
new moniker. We do this by calling TokenLoadMoniker and
having it give us a new chunk. We then swap chunk pointers
and free the old moniker.
CALLED BY: LauncherModifyResources
PASS: es = dgroup
RETURN: nothing
DESTROYED: all but es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 4/30/92 Initial Version
JimG 9/15/99 Fixed up this mess.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherModifyMonikers proc near
.enter
EC < ECCheckDGroup es >
mov bx, LAUNCHER_APPUI_RESID
call LauncherLockResource
call getPtrToMonikerList ; ds:si = VisMonikerEntryList
; ds:cx = end of table
replaceMonikerLoop:
cmp si, cx ; are we at the end of the list?
jne notDoneWithMonikerList
jmp doneWithMonikerList
notDoneWithMonikerList:
mov ax, ds:[si].VMLE_moniker.handle ; get the ObjRelocationID
mov bx, ax ; put in bx also
and ax, mask RID_SOURCE ; mask off all but RID_SOURCE
xor ax, (ORS_OWNING_GEODE shl offset RID_SOURCE)
jz notLocalMoniker ; not a local text moniker
mov bp, cx ; figure out what table entry
sub bp, si ; we were at and save it
push bp ; since we have to rederef
call LauncherModifyTextMoniker ; stuff launcher name into text
; "rederef" our moniker list since it may have moved.
call getPtrToMonikerList ; ds:si = VisMonikerEntryList
pop bp
mov si, cx ; restore our position in
sub si, bp ; the list and continue
jmp nextListEntry
notLocalMoniker:
mov bp, ds:[si].VMLE_type ; put moniker type struct in bp
test bp, mask VMLET_GSTRING ; skip if this is not a gstring
LONG jz nextListEntry
and bx, mask RID_INDEX ; mask off all but res. id
push ds ; save moniker list segment
push bx ; push resource id number
call LauncherLockResource
mov ax, bp ; copy moniker type to ax
andnf ax, mask VMLET_GS_ASPECT_RATIO ; mask off all but aspect ratio
.assert (offset VMLET_GS_ASPECT_RATIO) eq (offset DT_DISP_ASPECT_RATIO)
mov dh, al ; use as DT_DISP_ASPECT_RATIO
push cx, si ; position in & end of table
mov ax, bp ; copy moniker type into ax
and ax, mask VMLET_GS_COLOR ; mask off all but display class
.assert (offset VMLET_GS_COLOR) eq (offset DT_DISP_CLASS)
or dh, al ; put into dh
push bx ; save moniker rsrc handle
mov bx, bp ; bx = VMLET
andnf bp, mask VMLET_STYLE ; bp = VMStyle << VMLET_STYLE
if (offset VMLET_STYLE) gt (offset VMSF_STYLE)
mov cl, (offset VMLET_STYLE - offset VMSF_STYLE)
shr bp, cl
elseif (offset VMSF_STYLE) gt (offset VMLET_STYLE)
mov cl, (offset VMSF_STYLE - offset VMLET_STYLE)
shl bp, cl
endif
test bx, mask VMLET_GSTRING ; is it a gstring?
jz notGString ; no, don't search for gstring
ornf bp, mask VMSF_GSTRING ; else, search for gstring
notGString:
pop cx ; moniker rsrc (lmem) handle
mov ax, {word} es:[launcherMonikerToken]
mov bx, {word} es:[launcherMonikerToken+2] ; load token chars
mov si, {word} es:[launcherMonikerToken+4]
clr di ; di = 0 means alloc lmem chunk
push ds:[LMBH_handle] ; save lmem block handle
push bp ; pass VisMonikerSearchFlags
push di ; pass unused buffer size
call TokenLoadMoniker ; di = new chunk handle
jc tokenError
pop bx ; restore lmem block handle
call MemDerefDS
push di
mov di, ds:[di] ; ds:di = new vis moniker
.assert (offset DT_DISP_ASPECT_RATIO) eq (offset VMT_GS_ASPECT_RATIO)
.assert (offset DT_DISP_CLASS) eq (offset VMT_GS_COLOR)
.assert (offset DT_DISP_CLASS) eq 0
mov al, ds:[di].VM_type
andnf al, mask VMT_GS_ASPECT_RATIO
mov ah, dh ; value passed to TokLoadMon
andnf ah, mask DT_DISP_ASPECT_RATIO
cmp al, ah
jne nukeThisMoniker ; must be same aspect ratio
mov al, ds:[di].VM_type
andnf al, mask VMT_GS_COLOR
mov ah, dh ; value passed to TokLoadMon
andnf ah, mask DT_DISP_CLASS
.assert DC_TEXT lt DC_GRAY_1
.assert DC_GRAY_1 lt DC_GRAY_8
.assert DC_GRAY_8 lt DC_COLOR_2
cmp al, DC_TEXT
je nukeThisMoniker ; must not be text
cmp al, DC_GRAY_8
ja notGray
cmp ah, DC_GRAY_8
ja nukeThisMoniker ; not both gray
jmp monikerOK
notGray:
cmp ah, DC_GRAY_8
jbe nukeThisMoniker ; not both color
monikerOK:
pop di ; di = chunk of new moniker
; swap chunk handle pointers so that new moniker is in old
; chunk handle
;
mov si, ds:[LMBH_offset] ; first handle (old moniker)
mov ax, ds:[si] ; put old in ax
mov bx, ds:[di] ; put new in bx
mov ds:[si], bx ; swap (new into old place)
mov ds:[di], ax ; swap (old into new place)
; Free the old moniker. This will get compacted when the block
; is unlocked.
;
mov ax, di
call LMemFree ; free old moniker
resumeMonikerChange:
pop cx, si ; position in & end of table
pop bx ; restore resource id number
call LauncherUnlockResource
pop ds ; restore moniker list segment
nextListEntry:
add si, size VisMonikerListEntry ; go to next moniker in list
jmp replaceMonikerLoop
tokenError:
pop bx ; pop off moniker handle
pop cx, si ; pop off position & end-o-table
pop bx ; pop off moniker handle (again)
pushf ; save flags
call MemUnlock ; unlock it
popf ; restore flags
pop ds ; pop moniker list segment
doneWithMonikerList:
pushf ; save flags
mov bx, LAUNCHER_APPUI_RESID
call LauncherUnlockResource
popf ; restore flags
mov ax, ERROR_LAUNCHER_FAILED ; if an error did occur...
.leave
ret
nukeThisMoniker:
; We want to effectively get rid of this moniker.. so nuke the
; new one returned by TokenLoadMoniker and made the old one
; simply a null gstring and resize it.
;
pop ax ; ax = chunk of new moniker
call LMemFree ; kill new moniker
mov si, ds:[LMBH_offset] ; first chunk (old moniker)
mov di, ds:[si] ; ds:di -> VisMoniker (gstring)
add di, size VisMoniker + size VisMonikerGString
mov {byte}ds:[di], GR_END_GSTRING
mov ax, si
mov cx, size VisMoniker + size VisMonikerGString + 1
call LMemReAlloc
jmp resumeMonikerChange
; Broke this out since we have to do it at least twice.
; Pass: ds - app block
; Return: ds:si - VisMonikerListEntry table
; ds:cx - end of said table
getPtrToMonikerList:
mov si, ds:[LMBH_offset]
add si, MONIKER_LIST_HANDLE_POS * 2 ; * 2 because handles are words
ChunkSizeHandle ds, si, cx ; get table size into cx
mov si, ds:[si] ; dereference moniker list
add cx, si ; have cx point to end of table
retn
LauncherModifyMonikers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherModifyTextMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Stuff the launcher's name into the text moniker of the launcher
CALLED BY: LauncherModifyMonikers
PASS: ds:si - VisMonikerListEntry of the text Moniker
es - dgroup
bx - ObjRelocationID (ds:[si].VMLE_moniker.handle)
RETURN: ds - fixed up
DESTROYED: si, ax
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
May move block pointed to by ds. ds will be fixed up.
Caller needs to rederefernce chunk pointer.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 5/6/92 Initial Version
JimG 9/15/99 Fixed up this mess.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherModifyTextMoniker proc near
uses es, di, cx, bx
.enter
EC < ECCheckDGroup es >
mov ax, bx ; put ObjRelocationID in ax
xor ax, (ORS_CURRENT_BLOCK shl offset RID_SOURCE)
jnz exit ; exit if resource not in block
mov ax, ds:[si].VMLE_moniker.chunk ; Get moniker chunk
mov cx, FILE_LONGNAME_BUFFER_SIZE + size VisMoniker + \
size VisMonikerText
call LMemReAlloc
; WARNING: ds most likely moved. si may also be invalid.
; We can no longer refer to the VisMonikerListEntry from
; this point forward.
; -- JimG 9/15/99
mov si, ds
mov di, es ; swap so chunk is destination
mov ds, di
mov es, si ; this swaps ds, es via si, di
mov di, ax ; put moniker chunk handle in di
mov di, es:[di] ; dereference into es:di
add di, size VisMoniker + size VisMonikerText ; point to string!
mov si, offset launcherGeosName ; put launcherGeosName in ds:si
mov cx, FILE_LONGNAME_BUFFER_SIZE/2 ; divide length by 2 (words)
rep movsw
mov si, ds
mov di, es ; swap back
mov ds, di
mov es, si ; this swaps ds, es via si, di
exit:
.leave
ret
LauncherModifyTextMoniker endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherLockResource
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Lock the resource and declare it an LMem.
CALLED BY: LauncherModifyMonikers
PASS: bx = resource id
es = dgroup
RETURN: ds = resource segment as LMemBlock
bx = resource handle
NOTE! The resource id must be written back to the first word of the block
when finished.
DESTROYED: ax, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 3/13/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherLockResource proc near
.enter
EC < ECCheckDGroup es >
;lock the resource to a block
shl bx, 1 ;by words
mov bx, es:[resourceHandleList][bx] ;get resource handle
call MemLock
mov ds, ax
;change the block to a LMemBlock so we can rearrange the contents
;and rely on the abilities of LMems to organize the chunks.
mov ds:[LMBH_handle], bx ;set handle to itself
mov ax, mask HF_LMEM ;only set LMEM
call MemModifyFlags
.leave
ret
LauncherLockResource endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherUnlockResource
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Restore a resource block and unlock it.
CALLED BY:
PASS: ds = resource segment made into an LMem Heap
bx = resource id
RETURN: nothing
DESTROYED: ax, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 3/13/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherUnlockResource proc near
.enter
mov bp, bx ; put res id in bp
;some callers do some funky LMem juggling so its safest to
;recompact the lmem heap
call LMemContract
mov bx, ds:[LMBH_handle] ;set handle
mov ax, (mask HF_LMEM) shl 8 ;only clear LMEM
call MemModifyFlags
mov ds:[LMBH_handle], bp ;restore resource id
call MemUnlock
.leave
ret
LauncherUnlockResource endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherPrepForWriting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: If we are creating, close the default launcher file and open
the new file in the DOS Room or World directory, if we are
editing we keep the same file open, but reset the file
position to zero so we will overwrite the new data.
(Truncate the old file, however, in case it shrinks.
--JimG 9/16/99)
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: carry flag - set if error
DESTROYED: all but es (remains dgroup)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 4/2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherPrepForWriting proc near
.enter
EC < ECCheckDGroup es >
mov bx, es:[launcherFileHandle] ; put file handle in bx
tst es:[creatingLauncher]
jz editingLauncher
clr al ; no flags
call FileClose ; close default launcher
clr es:[launcherFileHandle]
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx, handle EditLauncherDestinationList
mov si, offset EditLauncherDestinationList
call ObjMessageCall ; gets item's identifer into ax
; identifiers for this list
; are SP_APPLICATION,SP_DOS_ROOM
call FileSetStandardPath
segmov ds, es, dx ; put dgroup in ds
mov si, offset launcherGeosName ; point ds:si to geos name
mov di, offset fileOperationInfoEntryBuffer + FOIE_name
mov cx, FILE_LONGNAME_LENGTH
SBCS < rep movsb ; set up fileOperationInf...>
DBCS < rep movsw ; set up fileOperationInf...>
mov es:[fileOperationInfoEntryBuffer].FOIE_type, GFT_EXECUTABLE
clr es:[fileOperationInfoEntryBuffer].FOIE_attrs
mov al, FILE_DENY_RW or FILE_ACCESS_RW
mov ah, FILE_CREATE_ONLY shl offset FCF_MODE
mov cx, FILE_ATTR_NORMAL
mov dx, offset launcherGeosName ; point ds:dx to Geos Name
call FileCreate
jc exit ; exit on error
mov bx, ax ; put file handle in bx
mov es:[launcherFileHandle], bx ; store new file handle
editingLauncher: ; bx is set to new file's handle
mov al, FILE_POS_START
clr cx ; beginning of file
clr dx
call FilePos ; returns dx:ax, should be 0
EC < tst dx >
EC < ERROR_NZ ILLEGAL_VALUE >
EC < tst ax >
EC < ERROR_NZ ILLEGAL_VALUE >
mov al, FILE_NO_ERRORS
call FileTruncate ; nuke the file, cx:dx=0 len
clc ; no error
exit:
.leave
ret
LauncherPrepForWriting endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherWriteFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Write the launcher's Entry tables, resources and token.
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: nothing
DESTROYED: everyting but es (remains dgroup)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 4/2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherWriteFile proc near
.enter
EC < ECCheckDGroup es >
; write the Entry tables to the new launcher
mov bx, es:[launcherHeaderHandle] ; restore header block handle
call MemLock
mov ds, ax ; lock into ds
clr dx ; ds:dx points to buffer
mov bx, es:[launcherFileHandle]
CheckHack <(offset GFH_coreBlock + size GFH_coreBlock) eq \
size GeodeFileHeader>
mov cx, offset GFH_coreBlock.GH_geoHandle ; all core block
; vars from here on
; aren't in the file
clr al ; no flags
call FileWrite
mov bx, es:[launcherHeaderHandle]
call MemUnlock ; flags reserved
jnc fileWriteNoError
jmp exit ; exit on error
fileWriteNoError:
mov bx, es:[launcherEntryTable]
mov bp, bx ; save this block handle
call MemLock
mov ds, ax ; point ds to entry table block
clr dx ; ds:dx is start of table block
clr al ; no flags
mov cx, es:[launcherEntryTableSize]
mov bx, es:[launcherFileHandle]
call FileWrite
jnc fileWriteNoError2
jmp exit ; exit on error
fileWriteNoError2:
mov bx, bp
call MemUnlock ; unlock Entry Table block
; write resources
call LauncherWriteResources
LONG jc exit
; Write protocol number to file header - read from geode header
mov cx, size ProtocolNumber
sub sp, cx
mov di, sp
mov bx, es:[launcherHeaderHandle]
call MemLock
mov ds, ax
mov si, offset GFH_coreBlock.GH_geodeProtocol
movsw
movsw
call MemUnlock
mov bx, es:[launcherFileHandle] ; file handle in bx
mov ax, FEA_PROTOCOL
mov di, sp
call FileSetHandleExtAttributes
mov_tr di, ax ; save error code
lahf ; save flags
add sp, cx ; restore stack
sahf ; restore flags
mov_tr di, ax ; restore error code
jc exit
; write tokens
mov ax, FEA_TOKEN
mov di, offset launcherToken ; es:di is launcherToken
mov cx, size GeodeToken
call FileSetHandleExtAttributes ; set token
jc exit
mov bx, handle DeskStringsCommon
call MemLock ; lock down DeskStrings
mov ds, ax ; put DeskStrings in ds
assume ds:DeskStringsCommon
mov si, ds:[DefaultLauncherToken] ; point ds:si to default token
assume ds:dgroup
mov bp, es ; put dgroup temporarily in bp
mov ax, MANUFACTURER_ID_GEOWORKS
push ax
push {word} ds:[si+2]
push {word} ds:[si] ; push token on stack
call MemUnlock
mov ds, bp ; put dgroup in ds for now
segmov es, ss, di ; make es point to stack
mov di, sp ; point es:di to stack
mov bx, ds:[launcherFileHandle] ; file handle in bx
mov ax, FEA_CREATOR ; setting Creator token
mov cx, size GeodeToken
call FileSetHandleExtAttributes
pop ax, ax, ax ; pop token off stack
mov es, bp ; restore dgroup
jc exit
mov bx, es:[launcherFileHandle]
mov ax, FEA_FILE_TYPE
mov cx, GFT_EXECUTABLE
push cx ; put this constant in mem
mov cx, size GeosFileType
mov bp, es ; save dgroup in bp
segmov es, ss, di ; put stack seg in es
mov di, sp ; point es:di to stack
call FileSetHandleExtAttributes
mov es, bp ; restore dgroup to es
pop ax ; pop constant off stack
exit:
.leave
ret
LauncherWriteFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherWriteResources
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Write the launcher resource table and resources
It is assumed that the resource table is up to date.
CALLED BY: LauncherWriteFile
PASS: es = dgroup
RETURN: ???
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/31/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherWriteResources proc near
.enter
EC < ECCheckDGroup es >
;lock the resource table into ds
mov bx, es:[resourceTableHandle]
call MemLock
mov ds, ax
;write the block to the passed file
;al - flags, bx - file handle, cx - bytes, ds:dx - buffer
clr al ;no flags
mov bx, es:[launcherFileHandle]
mov cx, LAUNCHER_RESOURCE_TABLE_SIZE
clr dx ;start at byte pos 0
call FileWrite
jc error
;Now loop through the resources, write the resource and then the
;reallocation info, freeing both.
;si is the index to the arrays. Since the arrays are of words the
;index is points to every two bytes. That is why why inc twice.
;write to the new launcher file
mov dx, es:[launcherFileHandle] ;dx stays preserved
;get the size of the resource block
clr si
nextResource: ;start of loop
;write the resource at bx and free
mov cx, ds:[si]
tst cx
jz doneResource
;
; data resources are paragraph sized in the file
;
test cx, 15
jz 30$
andnf cx, not 15
add cx, 16
30$:
;
; verify file position for resource
;
if ERROR_CHECK
push cx, dx ; save size, file handle
mov bx, dx ; bx = file handle
mov al, FILE_POS_RELATIVE
clr cx ; no movement, please
clr dx
call FilePos ; dx:ax = current position
shl si, 1 ; TEMP convert to dword offset
cmp dx, ({dword} ds:[FILE_POS_INFO_OFFSET][si]).high
ERROR_NE DESKTOP_FATAL_ERROR
cmp ax, ({dword} ds:[FILE_POS_INFO_OFFSET][si]).low
ERROR_NE DESKTOP_FATAL_ERROR
shr si, 1 ; TEMP convert back word offset
pop cx, dx ; restore size, file handle
endif
mov bx, es:[resourceHandleList][si]
call LauncherWriteBlockToFile
jc error
doneResource:
;now read in the reallocation info
;get the size of the resource block
mov cx, ds:[si][REALLOCATION_INFO_OFFSET] ;use realloc info array
tst cx
jz doneRealloc
;read in the resource to bx and save the handle
mov bx, es:[resourceReallocHandleList][si]
call LauncherWriteBlockToFile
jc error
doneRealloc:
;go to the next resource
inc si ;si is by words
inc si ;so inc twice
cmp si, LAUNCHER_RESOURCE_COUNT * 2
jl nextResource
;now unlock the resource table block
mov bx, es:[resourceTableHandle]
call MemUnlock
clc ;no error
error:
.leave
ret
LauncherWriteResources endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherWriteBlockToFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Write n bytes from a block to a file and free the block.
CALLED BY:
PASS: bx = block handle (to be freed if not null)
cx = bytes to write to the file
dx = file handle
RETURN: carry = set if error
DESTROYED: ax
ds unless ds is a fixed block
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
rsf 1/30/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherWriteBlockToFile proc near
uses dx, ds
.enter
push bx ; save block handle
;lock the block
call MemLock
mov ds, ax
;write the block to the passed file
;al - flags, bx - file handle, cx - bytes, ds:dx - buffer
clr al ;no flags
mov bx, dx
clr dx ;start at byte pos 0
call FileWrite
;free the block
pop bx ;restore block handle
pushf ; save flags
call MemUnlock
popf ; restore flags
.leave
ret
LauncherWriteBlockToFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherFreeAllMem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: This routine free's up all the memory blocks used in creating
the launcher.
CALLED BY: MakeDOSLauncher
PASS: es = dgroup
RETURN: ax same as passed
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 4/22/92 Initial Version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherFreeAllMem proc near
uses ax
.enter
EC < ECCheckDGroup es >
clr bx
xchg bx, es:[launcherHeaderHandle]
tst bx ; don't free it if null
jz doneFreeingHeader
call MemFree ; free header
doneFreeingHeader:
clr bx
xchg bx, es:[launcherEntryTable]
tst bx ; don't free it if null
jz doneFreeingEntryTable
call MemFree ; free Entry Table
doneFreeingEntryTable:
clr bx
xchg bx, es:[resourceTableHandle]
tst bx ; don't free it if null
jz doneFreeingResourceTable
call MemFree
doneFreeingResourceTable:
mov bx, es:[launcherData]
call MemLock
mov ds, ax
mov ds:[LMBH_handle], bx ; make an lmem heap again
mov ax, mask HF_LMEM ;only set LMEM
call MemModifyFlags
call MemUnlock
mov di, offset resourceHandleList ; set to beginning of table
mov si, di ; si will point to end of table
add si, LAUNCHER_RESOURCE_COUNT * 4 ; word size table (both)
dec di
dec di ; prep for initial increments
resourceAndReallocLoop:
inc di ; go to next table entry
inc di
cmp di, si ; are we at end of table?
je doneFreeingResources ; if so, exit loop
mov bx, es:[di]
tst bx
jz resourceAndReallocLoop ; if handle doesn't exist
cmp bx, es:[launcherData] ; if this the the replaced
je resourceAndReallocLoop ; LauncherStrings resource,
; don't free it
call MemFree
mov {word} es:[di], 0 ; mark as freed
jmp resourceAndReallocLoop
doneFreeingResources:
.leave
ret
LauncherFreeAllMem endp
if 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LauncherChangeIcon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine sets the current picture glyph to have the same
moniker as the currently selected moniker in the OK box.
CALLED BY: GLOBAL
PASS: nada
RETURN: nada
DESTROYED: various important but undocumented things
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/ 9/90 Initial version
dlitwin 5/4/92 revised to work with new lists and GeoManager
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LauncherChangeIcon method DesktopClass, MSG_WELCOME_DOS_CHANGE_PICTURE
.enter
mov ax, MSG_GEN_APPLY ;Apply user changes
mov bx, handle ChoosePictureList
mov si, offset ChoosePictureList
mov di, mask MF_FORCE_QUEUE
call ObjMessage
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION ;Get entry with current
mov bx, handle ChoosePictureList ; exclusive.
mov si, offset ChoosePictureList
mov di,mask MF_CALL
call ObjMessage ; Returns current item in ax
mov dx, ax ; put item # in dx
mov ax, MSG_WGLYPH_DISPLAY_SET_PICTURE
mov bx, handle CurrentPictureGlyph ; bx:si is glyph to display
mov si, offset CurrentPictureGlyph ; current picture
mov di, mask MF_FORCE_QUEUE
call ObjMessage
.leave
ret
LauncherChangeIcon endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSLauncherCancelEditBox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This is called when the user is done with the edit DOS Launcher
dialog box and the user hits cancel. We free the token list,
launcherData and close the opened file.
CALLED BY: UI (EditLauncherCancel)
PASS: ds:si - handle of DesktopClass object
es = segment of DesktopClass
RETURN: none
DESTROYED: lots of stuff (but it doesn't matter)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/14/92 Initial version
dlitwin 6/1/92 fixed to close the open file (oops!)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSLauncherCancelEditBox method DesktopClass,
MSG_DOS_LAUNCHER_CANCEL_EDIT_BOX
.enter
NOFXIP< segmov es, dgroup, bx ; es = dgroup >
FXIP < GetResourceSegmentNS dgroup, es, TRASH_BX >
clr bx
xchg bx, es:[launcherData]
tst bx
jz noLD
call MemFree
noLD:
clr bx
xchg bx, es:[launchFilePathHandle]
tst bx
jz noFPH
call MemFree
noFPH:
clr bx
xchg bx, es:[tokenList] ; put list handle in bx
tst bx
jz noTL
call MemFree ; free it
noTL:
clr bx
xchg bx, es:[launcherFileHandle]
tst bx
jz noFile
clr ax
call FileClose ; close the opened file
noFile:
.leave
ret
DOSLauncherCancelEditBox endm
CreateLauncherCode ends
endif ; ifndef GEOLAUNCHER
|
; A183295: Complement of A115067.
; 1,2,3,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86
mov $1,$0
add $0,1
lpb $0,1
add $1,1
add $2,3
trn $0,$2
lpe
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: sound.asm
AUTHOR: Jennifer Wu, Feb 3, 1993
ROUTINES:
Name Description
---- -----------
SoundSetupSounds Allocate all sounds.
SoundPlaySound Plays the specified sound.
SoundShutOffSounds Stops all sounds and frees them.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 2/ 3/93 Initial revision
mkh 7/16/93 Modified for FreeCell
DESCRIPTION:
$Id: freecellSound.asm,v 1.1 97/04/04 15:02:51 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TWICE_NUM_SOUNDS equ 4
DEAL_CARDS_TEMPO equ 16
WINNER_TEMPO equ 16
;
; Need a couple extra low notes for the Entertainer theme.
;
VERY_LOW_G = 196
VERY_LOW_A_b = 207
VERY_LOW_A = 220
VERY_LOW_B = 247
FreeCellSounds etype word, 0, 2
FCS_DEAL_CARDS enum FreeCellSounds
FCS_WINNER enum FreeCellSounds
;---------------------------------
; idata
;---------------------------------
idata segment
dealCardsSound label word ; beginning of Entertainer.
ChangeEnvelope 0, IP_VIOLIN
General GE_SET_TEMPO
word DEAL_CARDS_TEMPO
Staccato 0, HIGH_D, EIGHTH, FORTE
Staccato 0, HIGH_E, EIGHTH, FORTE
Staccato 0, HIGH_C, EIGHTH, FORTE
Staccato 0, MIDDLE_A, QUARTER, FORTE
Staccato 0, MIDDLE_B, EIGHTH, FORTE
Staccato 0, MIDDLE_G, EIGHTH, FORTE
Rest EIGHTH
Staccato 0, MIDDLE_D, EIGHTH, FORTE
Staccato 0, MIDDLE_E, EIGHTH, FORTE
Staccato 0, MIDDLE_C, EIGHTH, FORTE
Staccato 0, LOW_A, QUARTER, FORTE
Staccato 0, LOW_B, EIGHTH, FORTE
Staccato 0, LOW_G, EIGHTH, FORTE
Rest EIGHTH
Staccato 0, LOW_D, EIGHTH, FORTE
Staccato 0, LOW_E, EIGHTH, FORTE
Staccato 0, LOW_C, EIGHTH, FORTE
Staccato 0, VERY_LOW_A, QUARTER, FORTE
Staccato 0, VERY_LOW_B, EIGHTH, FORTE
Staccato 0, VERY_LOW_A, EIGHTH, FORTE
Staccato 0, VERY_LOW_A_b, EIGHTH, FORTE
Staccato 0, VERY_LOW_G, QUARTER, FORTE
Rest QUARTER
Staccato 0, LOW_G, QUARTER, FORTE
General GE_END_OF_SONG
winnerSound label word ; Fanfare
ChangeEnvelope 0, IP_TUBULAR_BELLS
General GE_SET_TEMPO
word WINNER_TEMPO
Staccato 0, MIDDLE_G, EIGHTH, FORTE
Rest EIGHTH
Staccato 0, MIDDLE_G, EIGHTH, FORTE
Staccato 0, MIDDLE_G, EIGHTH, FORTE
Natural 0, HIGH_C, HALF, FORTE
General GE_END_OF_SONG
idata ends
;----------------------------------
; udata
;----------------------------------
udata segment
dealCardsSoundHandle word ; sound handles for all the
winnerSoundHandle word ; sounds in Concentration
udata ends
SoundCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SoundSetupSounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate all sounds and save all sound handles.
CALLED BY: GLOBAL
PASS: es = idata
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 2/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SoundSetupSounds proc far
uses bx,cx,bp,si,di
.enter
clr bp
soundLoop:
mov bx, es
mov si, cs:soundOffsetTable[bp]
mov cx, cs:soundNumVoicesTable[bp]
call SoundAllocMusic ; allocate the sound
; handle returned in bx
mov di, cs:soundHandleTable[bp]
mov es:[di], bx ; save the handle
add bp, 2
cmp bp, TWICE_NUM_SOUNDS ; are we done?
jl soundLoop
.leave
ret
soundOffsetTable word \
offset dealCardsSound,
offset winnerSound
soundNumVoicesTable word \
1, ; dealCards
1 ; winnerSound
soundHandleTable word \
dealCardsSoundHandle,
winnerSoundHandle
SoundSetupSounds endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SoundPlaySound
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Plays the specified sound.
CALLED BY: GLOBAL
PASS: cx = ConcenSounds type
es = idata
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 2/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SoundPlaySound proc far
uses ax,bx,cx,dx,bp,di
.enter
mov bp, cx
mov di, cs:soundTypeToHandleTable[bp]
mov bx, es:[di]
mov dl, mask EOSF_UNLOCK
mov ax, cs:soundPriorityTable[bp]
mov cx, 16
call SoundPlayMusic
.leave
ret
soundTypeToHandleTable word \
dealCardsSoundHandle, ; FCS_DEAL_CARDS
winnerSoundHandle ; FCS_WINNER
soundPriorityTable word \
SP_BACKGROUND, ; deal cards
SP_BACKGROUND ; winner
SoundPlaySound endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SoundShutOffSounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Stops all sounds and frees them.
CALLED BY: GLOBAL
PASS: es = idata
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 2/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SoundShutOffSounds proc far
uses bx,bp,di
.enter
clr bp
shutoffLoop:
mov di, cs:soundHandleToStopTable[bp]
mov bx, es:[di]
call SoundStopMusic
call SoundFreeMusic
add bp, 2
cmp bp, TWICE_NUM_SOUNDS
jl shutoffLoop
.leave
ret
soundHandleToStopTable word \
dealCardsSoundHandle,
winnerSoundHandle
SoundShutOffSounds endp
SoundCode ends
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x2e53, %rsi
lea addresses_WC_ht+0x2fd3, %rdi
nop
add %r8, %r8
mov $52, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %r11
lea addresses_D_ht+0x11b53, %rsi
lea addresses_WC_ht+0x187db, %rdi
nop
nop
nop
dec %r13
mov $4, %rcx
rep movsq
nop
nop
nop
nop
dec %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rax
push %rcx
push %rdx
push %rsi
// Store
lea addresses_US+0x3e6d, %r8
nop
nop
nop
nop
sub $35242, %rax
movb $0x51, (%r8)
nop
add $52586, %rax
// Store
mov $0x1922910000000553, %r11
nop
nop
nop
nop
sub %rsi, %rsi
movl $0x51525354, (%r11)
nop
nop
nop
sub %rax, %rax
// Store
lea addresses_US+0x21f3, %r8
nop
nop
nop
nop
nop
xor %rax, %rax
movw $0x5152, (%r8)
add %r8, %r8
// Faulty Load
mov $0x1922910000000553, %r11
clflush (%r11)
nop
nop
nop
nop
xor $41583, %rcx
movups (%r11), %xmm0
vpextrq $0, %xmm0, %r8
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'54': 1}
54
*/
|
; A331321: a(n) = [x^n] ((x^2 - 1)*(x^2 + x - 1))/(x^2 + 2*x - 1)^2.
; 1,3,8,23,64,175,472,1259,3328,8731,22760,59007,152256,391239,1001656,2556115,6503936,16505651,41788616,105571303,266181440,669923039,1683255448,4222878651,10579130112,26467818315,66138242984,165077936207,411584855488,1025162759287,2551031338360,6342382476707,15755231337472,39106872283747,96996465214856,240408808465335,595459582959168,1473927981762831,3646161062056792,9014541144399499
mov $5,2
mov $7,$0
lpb $5,1
mov $0,$7
sub $5,1
add $0,$5
sub $0,1
mov $2,$0
mov $3,4
lpb $2,1
mov $6,$0
add $6,$3
mov $3,$0
add $6,$0
mov $0,$6
sub $2,1
add $3,4
lpe
mov $4,$5
mov $6,$0
div $6,2
add $6,1
lpb $4,1
mov $1,$6
sub $4,1
lpe
lpe
lpb $7,1
sub $1,$6
mov $7,0
lpe
|
;;
;; Title: VDC Functions.
;;
;;
;; function: vdc_set_read
;; Set VDC VRAM read pointer.
;;
;; Parameters:
;; _di - VRAM location.
;;
vdc_set_read:
vdc_reg #VDC_MARR
vdc_data <_di
vdc_reg #VDC_DATA
rts
;;
;; function: vdc_set_write
;; Set VDC VRAM write pointer.
;;
;; Parameters:
;; _di - VRAM location.
;;
vdc_set_write:
vdc_reg #VDC_MAWR
vdc_data <_di
vdc_reg #VDC_DATA
rts
;;
;; function: vdc_set_bat_size
;; Set background map virtual size.
;;
;; Parameters:
;; A - BAT size (see <Background Map Virtual Size>)
;;
vdc_set_bat_size:
and #%01110000
pha
vdc_reg #VDC_MWR
pla
vdc_data_l
; compute BAT dimensions
lsr A
lsr A
lsr A
lsr A
tax
; -- width
lda bat_width_array, X
sta vdc_bat_width
stz vdc_bat_width+1
dec A
sta vdc_bat_hmask
; -- height
lda bat_height_array, X
sta vdc_bat_height
dec A
sta vdc_bat_vmask
rts
; BAT width
bat_width_array: .byte $20,$40,$80,$80,$20,$40,$80,$80
; BAT height
bat_height_array: .byte $20,$20,$20,$20,$40,$40,$40,$40
;;
;; function: vdc_calc_addr
;; Compute VRAM address for a given tile in BAT.
;;
;; Parameters:
;; X - BAT x coordinate.
;; A - BAT y coordinate.
;;
;; Return:
;; _di - VRAM location
;;
vdc_calc_addr:
; BAT address formula :
; addr = (bat_y * bat_width) + bat_x
; the multiplication can be safely replaced by bit shifts as bat_width
; is either 32, 64 or 128.
phx
and vdc_bat_vmask
stz <_di
ldx vdc_bat_width
cpx #64
beq @w_64
cpx #128
beq @w_128
@w_32:
lsr A
ror <_di
@w_64:
lsr A
ror <_di
@w_128:
lsr A
ror <_di
sta <_di+1
; bat_x can be added with a simple bit OR.
pla
and vdc_bat_hmask
ora <_di
sta <_di
rts
;;
;; function: vdc_load_tiles
;; Load 8x8 tiles data to VRAM.
;;
;; Parameters:
;; _bl - Tile data bank.
;; _si - Tile data address.
;; _cx - Tile count.
;; _di - VRAM destination.
vdc_load_tiles:
; word count = tile count * 16
lda <_ch
asl <_cl
rol A
asl <_cl
rol A
asl <_cl
rol A
asl <_cl
rol A
sta <_cx
; Warning! Do not put anything between vdc_load_tiles and vdc_load_data.
; If for any reason you will have to do it, uncomment the following line and
; remove this comment.
; jmp vdc_load_data
;;
;; function: vdc_load_data
;; Copy data to VRAM.
;;
;; Parameters:
;; _di - VRAM address where the data will be copied.
;; _bl - first bank of the source data.
;; _si - data address.
;; _cx - number of words to copy.
;;
vdc_load_data:
jsr map_data
jsr vdc_set_write
ldx <_cl
beq @l2
cly
@l0:
lda [_si], Y
vdc_data_l
iny
lda [_si], Y
vdc_data_h
iny
bne @l1
inc <_si+1
@l1:
dex
bne @l0
jsr remap_data
@l2:
dec <_ch
bpl @l0
jsr unmap_data
rts
;;
;; function: vdc_fill_bat
;; Set an area in BAT to a given tile and palette.
;;
;; Parameters:
;; X - BAT x position.
;; A - BAT y position.
;; _al - BAT area width.
;; _ah - BAT area height.
;; _si - Tile offset
;; _bl - Palette index
;;
vdc_fill_bat:
jsr vdc_calc_addr
lda <_si
; bat_data = (_bl<<12) | (_si>>4)
lsr <_bl
ror <_si+1
ror A
lsr <_bl
ror <_si+1
ror A
lsr <_bl
ror <_si+1
ror A
lsr <_bl
ror <_si+1
ror A
sta <_si
vdc_fill_bat_ex:
ldy <_ah
@l0:
jsr vdc_set_write
addw vdc_bat_width, <_di
lda <_si
vdc_data_l
ldx <_al
@l1:
lda <_si+1
vdc_data_h
dex
bne @l1
dey
bne @l0
rts
;;
;; function: vdc_init
;; Initialize VDC.
;;
;; Details:
;; Initialize VDC registers, and setup BAT.
;;
;; Parameters:
;; *none*
;;
vdc_init:
cly
@l0:
lda @vdc_init_table, Y
vdc_setreg
iny
lda @vdc_init_table, Y
vdc_data_l
iny
lda @vdc_init_table, Y
vdc_data_h
iny
cpy #36
bne @l0
; set BAT size
lda #VDC_DEFAULT_BG_SIZE
jsr vdc_set_bat_size
; make BAT point to a blank tile
; we choose a tile that will not cross bat (even for 128x128)
st0 #VDC_MAWR
st1 #$00
st2 #$00
.if (VDC_DEFAULT_BG_SIZE = VDC_BG_32x32)
@tile_addr = (32*32*2)
.else
.if ((VDC_DEFAULT_BG_SIZE = VDC_BG_64x32) | (VDC_DEFAULT_BG_SIZE = VDC_BG_32x64))
@tile_addr = (64*32*2)
.else
.if ((VDC_DEFAULT_BG_SIZE = VDC_BG_64x64) | (VDC_DEFAULT_BG_SIZE = VDC_BG_128x32))
@tile_addr = (64*64*2)
.else
@tile_addr = (128*128*2)
.endif
.endif
.endif
st0 #VDC_DATA
ldy #high(@tile_addr)
@l1:
clx
@l2:
st1 #low(@tile_addr>>4)
st2 #high(@tile_addr>>4)
inx
bne @l2
dey
bne @l1
; clear tile
st0 #VDC_MAWR
st1 #low(@tile_addr)
st2 #high(@tile_addr)
st0 #VDC_DATA
st1 #$00
ldx #$10
@l3:
st2 #$00
dex
bne @l3
rts
; Default VDC initialization table.
@vdc_init_table:
.byte $05, $00, $00 ; CR control register
.byte $06, $00, $00 ; RCR scanline interrupt counter
.byte $07, $00, $00 ; BXR background horizontal scroll offset
.byte $08, $00, $00 ; BYR " vertical " "
.byte $09, VDC_DEFAULT_BG_SIZE ; MWR backgroup map virtual size
.byte $00 ;
.byte $0A ; HSR +
VDC_HSR_db VDC_DEFAULT_XRES ; |
.byte $0B ; HDR |
VDC_HDR_db VDC_DEFAULT_XRES ; | display size and synchro
.byte $0C, $02, $17 ; VPR |
.byte $0D, $DF, $00 ; VDW |
.byte $0E, $0C, $00 ; VCR +
.byte $0F, $10, $00 ; DCR DMA control register
.byte $13 ; SATB adddress
.byte low(VDC_DEFAULT_SATB_ADDR)
.byte high(VDC_DEFAULT_SATB_ADDR)
;;
;; function: vdc_yres_192
;; Set vertical (y) resolution to 192 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_yres_192:
st0 #VDC_VSR
; vertical synchro width
st1 #$02
; vertical display start
st2 #$25
st0 #VDC_VDR
; vertical display width
st1 #$bf
st2 #$00
st0 #VDC_VCR
st1 #$0c
st2 #$00
rts
;;
;; function: vdc_yres_224
;; Set vertical (y) resolution to 224 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_yres_224:
st0 #VDC_VSR
; vertical synchro width
st1 #$02
; vertical display start
;st2 #$17
st2 #$0f
st0 #VDC_VDR
; vertical display width
;st1 #$df
st1 #$ef
st2 #$00
st0 #VDC_VCR
;st1 #$0c
st1 #$04
st2 #$00
rts
;;
;; function: vdc_yres_240
;; Set vertical (y) resolution to 240 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_yres_240:
st0 #VDC_VSR
; vertical synchro width
st1 #$02
; vertical display start
st2 #$0f
st0 #VDC_VDR
; vertical display width
st1 #$ef
st2 #$00
st0 #VDC_VCR
st1 #$0c
st2 #$00
rts
;;
;; function: vdc_xres_256
;; Set horizontal (x) resolution to 256 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_xres_256:
st0 #VDC_HSR
; horizontal sync width
st1 #$02
; horizontal display start
st2 #$02
st0 #VDC_HDR
; horizontal display width
st1 #$1f
; horizontal display end
st2 #$04
; enable edge blur and set dot clock to 5MHz
lda #(VCE_BLUR_ON | VCE_DOT_CLOCK_5MHZ)
sta color_ctrl
rts
;;
;; function: vdc_xres_320
;; Set horizontal (x) resolution to 320 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_xres_320:
st0 #VDC_HSR
; horizontal sync width
st1 #$02
; horizontal display start
st2 #$04
st0 #VDC_HDR
; horizontal display width
st1 #$29
; horizontal display end
st2 #$04
; enable edge blur and set dot clock to 7MHz
lda #(VCE_BLUR_ON | VCE_DOT_CLOCK_7MHZ)
sta color_ctrl
rts
;;
;; function: vdc_xres_512
;; Set horizontal (x) resolution to 512 pixels.
;;
;; Parameters:
;; *none*
;;
vdc_xres_512:
st0 #VDC_HSR
; horizontal sync width
st1 #$02
; horizontal display start
st2 #$0b
st0 #VDC_HDR
; horizontal display width
st1 #$3f
; horizontal display end
st2 #$04
; enable edge blur and set dot clock to 10MHz
lda #(VCE_BLUR_ON | VCE_DOT_CLOCK_10MHZ)
sta color_ctrl
rts
|
#include "Wire.h"
|
; A254378: Run lengths of A228495 (Characteristic function of the odd odious numbers).
; 1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,3,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,3,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,3,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,3,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,3,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,3,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,3,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,3,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,3,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,5,1,1,1,3,1,5,1,1,1,5,1,3,1,1,1,3,1,5,1,3,1,1,1,5,1
mov $3,2
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
add $0,$3
sub $0,1
div $0,2
cal $0,93505 ; a(n) = floor(A001969(n)/2 + 1/2).
mov $2,$3
mov $5,$0
lpb $2
mov $1,$5
sub $2,1
lpe
lpe
lpb $4
sub $1,$5
mov $4,0
lpe
mul $1,2
add $1,1
|
include 'format/format.inc'
format PE GUI
entry start
section '.text' code readable executable
start:
push 0
push _caption
push _message
push 0
call [MessageBoxA]
push 0
call [ExitProcess]
section '.data' data readable writeable
_caption db 'Win32 assembly program',0
_message db 'Hello World!',0
section '.idata' import data readable writeable
dd 0,0,0,RVA kernel_name,RVA kernel_table
dd 0,0,0,RVA user_name,RVA user_table
dd 0,0,0,0,0
kernel_table:
ExitProcess dd RVA _ExitProcess
dd 0
user_table:
MessageBoxA dd RVA _MessageBoxA
dd 0
kernel_name db 'KERNEL32.DLL',0
user_name db 'USER32.DLL',0
_ExitProcess dw 0
db 'ExitProcess',0
_MessageBoxA dw 0
db 'MessageBoxA',0
section '.reloc' fixups data readable discardable ; needed for Win32s
|
; BSD
; void *rawmemchr(const void *mem, int c)
SECTION code_clib
SECTION code_string
PUBLIC _rawmemchr
EXTERN l0_rawmemchr_callee
_rawmemchr:
pop af
pop hl
pop bc
push bc
push hl
push af
jp l0_rawmemchr_callee
|
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2021 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* IOException.cc (C) 2000-2018 */
/* */
/* Exception lorsqu'une erreur d'entrée/sortie est détectée. */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#include "arcane/utils/ArcanePrecomp.h"
#include "arcane/utils/Iostream.h"
#include "arcane/utils/IOException.h"
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
ARCANE_BEGIN_NAMESPACE
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
IOException::
IOException(const String& where)
: Exception("IOException",where)
{
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
IOException::
IOException(const String& where,const String& message)
: Exception("IOException",where)
, m_message(message)
{
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
IOException::
IOException(const TraceInfo& where)
: Exception("IOException",where)
{
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
IOException::
IOException(const TraceInfo& where,const String& message)
: Exception("IOException",where)
, m_message(message)
{
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
IOException::
IOException(const IOException& ex)
: Exception(ex)
, m_message(ex.m_message)
{
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
void IOException::
explain(std::ostream& m) const
{
if (!m_message.null())
m << "Message: " << m_message << '\n';
}
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
ARCANE_END_NAMESPACE
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
|
/*
发布 static_transform_publsiher 有三种方法:
一。 自定义
可以自由实现功能,如四元数转换之类的
ros2 run learning_tf2_cpp static_turtle_tf2_broadcaster mystaticturtle 0 0 1 0 0 0 (定义了parent frame 是world)
二。使用自带的tf2_ros包
旋转表示:
ros2 run tf2_ros static_transform_publisher x y z yaw pitch roll frame_id child_frame_id
四元数表达:
ros2 run tf2_ros static_transform_publisher x y z qx qy qz qw frame_id child_frame_id
三。ros2 launch
```
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='tf2_ros',
executable='static_transform_publisher',
arguments = ['0', '0', '1', '0', '0', '0', 'world', 'mystaticturtle']
),
])
```
*/
// 保函要发布的数据类型
#include <geometry_msgs/msg/transform_stamped.hpp>
//用到rclcpp里面的节点类
#include <rclcpp/rclcpp.hpp>
// 欧拉角和四元数之间的转换
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/static_transform_broadcaster.h>
#include <memory>
using std::placeholders::_1;
class StaticFramePublisher : public rclcpp::Node
{
public:
explicit StaticFramePublisher(char * transformation[])
: Node("static_turtle_tf2_broadcaster")
{
tf_publisher_ = std::make_shared<tf2_ros::StaticTransformBroadcaster>(this);
// Publish static transforms once at startup
this->make_transforms(transformation);
}
private:
void make_transforms(char * transformation[])
{
rclcpp::Time now = this->get_clock()->now();
geometry_msgs::msg::TransformStamped t;
t.header.stamp = now;
t.header.frame_id = "world";
t.child_frame_id = transformation[1];
t.transform.translation.x = atof(transformation[2]);
t.transform.translation.y = atof(transformation[3]);
t.transform.translation.z = atof(transformation[4]);
tf2::Quaternion q;
q.setRPY(
atof(transformation[5]),
atof(transformation[6]),
atof(transformation[7]));
t.transform.rotation.x = q.x();
t.transform.rotation.y = q.y();
t.transform.rotation.z = q.z();
t.transform.rotation.w = q.w();
tf_publisher_->sendTransform(t);
}
std::shared_ptr<tf2_ros::StaticTransformBroadcaster> tf_publisher_;
};
int main(int argc, char * argv[])
{
auto logger = rclcpp::get_logger("logger");
// Obtain parameters from command line arguments
if (argc != 8) {
RCLCPP_INFO(
logger, "Invalid number of parameters\nusage: "
"ros2 run learning_tf2_cpp static_turtle_tf2_broadcaster "
"child_frame_name x y z roll pitch yaw");
return 1;
}
// As the parent frame of the transform is `world`, it is
// necessary to check that the frame name passed is different
if (strcmp(argv[1], "world") == 0) {
RCLCPP_INFO(logger, "Your static turtle name cannot be 'world'");
return 1;
}
// Pass parameters and initialize node
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<StaticFramePublisher>(argv));
rclcpp::shutdown();
return 0;
}
|
; A213839: Principal diagonal of the convolution array A213838.
; 1,20,89,240,505,916,1505,2304,3345,4660,6281,8240,10569,13300,16465,20096,24225,28884,34105,39920,46361,53460,61249,69760,79025,89076,99945,111664,124265,137780,152241,167680,184129,201620,220185,239856,260665,282644,305825,330240,355921,382900,411209,440880,471945,504436,538385,573824,610785,649300,689401,731120,774489,819540,866305,914816,965105,1017204,1071145,1126960,1184681,1244340,1305969,1369600,1435265,1502996,1572825,1644784,1718905,1795220,1873761,1954560,2037649,2123060,2210825,2300976,2393545,2488564,2586065,2686080,2788641,2893780,3001529,3111920,3224985,3340756,3459265,3580544,3704625,3831540,3961321,4094000,4229609,4368180,4509745,4654336,4801985,4952724,5106585,5263600
lpb $0
add $1,$0
add $1,1
add $2,$1
add $2,$1
add $1,$0
sub $0,1
lpe
add $1,1
mul $2,4
add $2,1
add $1,$2
sub $1,1
mov $0,$1
|
; A003988: Triangle with subscripts (1,1),(2,1),(1,2),(3,1),(2,2),(1,3), etc. in which entry (i,j) is [ i/j ].
; Submitted by Jamie Morken(s2)
; 1,2,0,3,1,0,4,1,0,0,5,2,1,0,0,6,2,1,0,0,0,7,3,1,1,0,0,0,8,3,2,1,0,0,0,0,9,4,2,1,1,0,0,0,0,10,4,2,1,1,0,0,0,0,0,11,5,3,2,1,1,0,0,0,0,0,12,5,3,2,1,1,0,0,0,0,0,0,13,6,3,2,1,1,1,0,0,0,0,0,0,14,6,4,2,2,1,1,0,0
add $0,1
lpb $0
add $1,1
mov $2,$0
trn $0,$1
lpe
mov $0,1
add $0,$1
div $0,$2
sub $0,1
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D3E move.l D0, (A4)+
004D40 dbra D1, $4d38
033960 move.b #$5a, ($ac,A6) [enemy+A9]
033966 move.b D0, ($ba,A6) [enemy+AC]
0356A2 subq.b #1, ($ac,A6)
0356A6 bcc $356f2 [enemy+AC]
0356A8 move.b #$1e, ($ac,A6)
0356AE movea.w ($76,A6), A0 [enemy+AC]
038E2C clr.b ($ac,A6) [enemy+A0]
038E30 move.b #$9e, ($23,A6)
038F38 move.b #$1, ($ac,A6)
038F3E moveq #$c, D0 [enemy+AC]
038FA4 clr.b ($ac,A6)
038FA8 moveq #$e, D0 [enemy+AC]
03C60E move.w ($ac,A6), D0
03C612 move.w ($6,PC,D0.w), D0
03C626 move.w #$0, ($ac,A6) [enemy+ 4, enemy+ 6]
03C62C moveq #$0, D0
03C85E move.w #$2, ($ac,A6) [enemy+ 4, enemy+ 6]
03C864 moveq #$0, D0 [enemy+AC]
03DEB6 move.w #$14, ($ac,A6) [enemy+72]
03DEBC move.b D0, ($be,A6) [enemy+AC]
03E532 move.w #$14, ($ac,A6) [enemy+76]
03E538 move.b #$0, ($a1,A6) [enemy+AC]
03E576 subq.w #1, ($ac,A6)
03E57A beq $4005c [enemy+AC]
03E602 subq.w #1, ($ac,A6)
03E606 beq $3f464 [enemy+AC]
03E6B4 subq.w #1, ($ac,A6)
03E6B8 bne $3e6c0 [enemy+AC]
03E790 subq.w #1, ($ac,A6)
03E794 bne $3e79c [enemy+AC]
03E79C move.w ($ac,A6), D0
03E7A0 andi.w #$3, D0 [enemy+AC]
03E82E subq.w #1, ($ac,A6)
03E832 bne $3e83a [enemy+AC]
03E83A move.w ($ac,A6), D0
03E83E andi.w #$3, D0 [enemy+AC]
03E8C6 subq.w #1, ($ac,A6)
03E8CA bne $3e8d2 [enemy+AC]
03E98A subq.w #1, ($ac,A6)
03E98E bne $3e996 [enemy+AC]
03E996 cmpi.w #$3c, ($ac,A6)
03E99C bgt $3e9a6 [enemy+AC]
03EB30 subq.w #1, ($ac,A6)
03EB34 bne $3eb3c [enemy+AC]
03EB7E subq.w #1, ($ac,A6)
03EB82 beq $3ee82 [enemy+AC]
03EB8C subq.w #1, ($ac,A6)
03EB90 bne $3eb9e [enemy+AC]
03EBA4 subq.w #1, ($ac,A6)
03EBA8 bne $3ebb0 [enemy+AC]
03EC22 subq.w #1, ($ac,A6)
03EC26 beq $3ec42 [enemy+AC]
03EC70 move.w #$10, ($ac,A6) [enemy+1A]
03EC76 move.b #$1e, ($6,A6) [enemy+AC]
03ECA8 subq.w #1, ($ac,A6)
03ECAC bne $3ecd6 [enemy+AC]
03ECBE move.w D0, ($ac,A6)
03ECC2 move.b #$1, ($a1,A6) [enemy+AC]
03EEAE move.w #$3c, ($ac,A6) [enemy+ 6]
03EEB4 jsr $32a58.l [enemy+AC]
03F038 subq.w #1, ($ac,A6)
03F03C bne $3f044 [enemy+AC]
03F0A4 subq.w #1, ($ac,A6)
03F0A8 cmpi.w #$24, ($ac,A6) [enemy+AC]
03F0AE bgt $3f0dc [enemy+AC]
03F0CA tst.w ($ac,A6)
03F0CE bne $3f0dc [enemy+AC]
03F134 move.w (A0,D0.w), ($ac,A6)
03F13A move.w ($5ee,A5), D1 [enemy+AC]
03F14A add.w D0, ($ac,A6)
03F14E beq $3f156 [enemy+AC]
03F164 move.w #$b4, ($ac,A6) [enemy+ 6]
03F16A move.b #$1e, ($a8,A6) [enemy+AC]
03F1F2 move.w #$78, ($ac,A6) [enemy+A8]
03F1F8 move.b #$c, ($6,A6) [enemy+AC]
03F22E move.w #$78, ($ac,A6) [enemy+A8]
03F234 move.b #$2a, ($6,A6) [enemy+AC]
03F37A move.w #$3c, ($ac,A6)
03F380 move.b #$a, ($6,A6) [enemy+AC]
03F3E8 move.w #$64, ($ac,A6) [enemy+ 6]
03F3EE move.b #$1e, ($a8,A6) [enemy+AC]
03F4D8 move.w #$78, ($ac,A6)
03F4DE move.b #$6, ($6,A6) [enemy+AC]
03F576 move.w #$78, ($ac,A6)
03F57C move.b #$8, ($6,A6) [enemy+AC]
03F5B4 move.w #$1e, ($ac,A6) [enemy+A1]
03F5BA move.b #$14, ($6,A6) [enemy+AC]
03F616 move.w D3, ($ac,A6)
03F61A move.b #$1, ($a1,A6) [enemy+AC]
03F676 move.w #$1e, ($ac,A6) [enemy+A1]
03F67C move.b #$3c, ($6,A6) [enemy+AC]
03F6C8 move.w #$3c, ($ac,A6) [enemy+A1]
03F6CE move.b #$10, ($6,A6) [enemy+AC]
03F880 move.w #$1e, ($ac,A6) [enemy+ 6]
03F886 moveq #$1a, D0 [enemy+AC]
03F8B8 move.w #$37, ($ac,A6) [enemy+ 6]
03F8BE moveq #$d, D0 [enemy+AC]
03F9C6 move.w #$3c, ($ac,A6) [enemy+ 6]
03F9CC jsr $32a58.l [enemy+AC]
03FC44 move.w #$4b0, ($ac,A6) [enemy+A1]
03FC4A move.b #$34, ($6,A6) [enemy+AC]
03FC70 move.w ($12,PC,D0.w), ($ac,A6)
03FC76 move.b #$46, ($6,A6) [enemy+AC]
03FE6C move.w #$3c, ($ac,A6) [enemy+AF]
03FE72 move.b #$1, ($51,A6) [enemy+AC]
040022 move.w #$24, ($ac,A6) [enemy+ 6]
040028 move.b #$1e, ($a8,A6) [enemy+AC]
04061E move.b (A0,D1.w), ($ac,A6)
040624 move.b #$0, ($ad,A6) [enemy+AC]
040A2C tst.b ($ac,A6) [enemy+B4, enemy+B6]
040A30 beq $40a3a [enemy+AC]
040A34 subq.b #1, ($ac,A6)
040A38 rts [enemy+AC]
040A82 tst.b ($ac,A6)
040A86 bne $40a98 [enemy+AC]
040AD2 tst.b ($ac,A6) [enemy+B0, enemy+B2]
040AD6 beq $40ae0 [enemy+AC]
040ADA subq.b #1, ($ac,A6)
040ADE rts [enemy+AC]
040AFA tst.b ($ac,A6)
040AFE bne $40b2a [enemy+AC]
040B64 tst.b ($ac,A6) [enemy+B4, enemy+B6]
040B68 beq $40b72 [enemy+AC]
040B6C subq.b #1, ($ac,A6)
040B70 rts [enemy+AC]
040B8C tst.b ($ac,A6)
040B90 bne $40bbc
040EF4 tst.b ($ac,A6)
040EF8 beq $40f02 [enemy+AC]
040EFC subq.b #1, ($ac,A6)
040F00 rts [enemy+AC]
040F5E move.b #$0, ($ac,A6) [enemy+AD]
040F64 rts
041F8E move.b (A0), ($ac,A6)
041F92 cmpi.b #$0, ($ac,A6)
041F98 beq $41fc0
041FEC cmpi.b #$0, ($ac,A6) [enemy+10, enemy+12]
041FF2 beq $41ffc
0426D4 move.w A0, ($ac,A6)
0426D8 move.b #$1, ($0,A0) [enemy+AC]
0426F4 movea.w ($ac,A6), A0
0426F8 tst.b ($0,A0) [enemy+AC]
046368 move.w D0, ($ac,A6)
04636C move.b #$1, ($7d,A6) [enemy+AC]
0463D4 move.w ($ac,A6), D0
0463D8 move.b ($1c,PC,D0.w), D1 [enemy+AC]
0463E0 addq.w #1, ($ac,A6)
0463E4 move.w ($68,PC,D1.w), D0 [enemy+AC]
0464D0 move.w ($ac,A6), D0
0464D4 lea (-$e0,PC) ; ($463f6), A0 [enemy+AC]
046516 move.w ($ac,A6), D0
04651A lea (-$126,PC) ; ($463f6), A0 [enemy+AC]
04841C move.b D0, ($ac,A6)
048420 move.b D0, ($ad,A6)
048524 move.b D0, ($ac,A6)
048528 move.w #$0, ($a8,A6)
04877C move.b D0, ($ac,A6)
048780 move.b D0, ($c0,A6)
04DD9C move.b D0, ($ac,A6)
04DDA0 move.b D0, ($ad,A6)
04E5AC move.b D0, ($ac,A6)
04E5B0 move.w D0, ($b4,A6)
0500EE clr.w ($ac,A6) [enemy+AA]
0500F2 bsr $509c6 [enemy+AC]
05592E move.l ($aa,A6), D0
055932 add.l D0, ($8,A6) [enemy+AA, enemy+AC]
055992 move.l #$60000, ($aa,A6) [enemy+10]
05599A tst.b ($24,A6) [enemy+AA, enemy+AC]
05599E bne $559a6 [enemy+24]
0559A6 move.b #$19, ($58,A6) [enemy+AA, enemy+AC]
05665E move.w D0, ($ac,A6)
056662 jsr $119c.l [enemy+AC]
0566CA subi.w #$1, ($ac,A6)
0566D0 bne $566d8 [enemy+AC]
0569A6 move.w #$0, ($ac,A6) [enemy+ 5]
0569AC jsr $119c.l
056A06 addi.w #$1, ($ac,A6) [enemy+ 8]
056A0C move.w ($aa,A6), D0 [enemy+AC]
056A14 move.w ($ac,A6), D0 [enemy+ C]
056A18 cmp.w ($a8,A6), D0 [enemy+AC]
056A2C move.w #$0, ($ac,A6) [enemy+AE]
056A32 jsr $119c.l
056D2E move.l #$10000, ($aa,A6) [enemy+AE, enemy+B0]
056D36 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC]
056D96 move.l #$ffff0000, ($aa,A6) [enemy+AE, enemy+B0]
056D9E move.l #$0, ($a6,A6)
056DEA move.l #$fffb0000, ($aa,A6) [enemy+AE, enemy+B0]
056DF2 jsr $119c.l [enemy+AA, enemy+AC]
056DFE sub.l D0, ($aa,A6)
056E02 move.l #$100, ($a6,A6) [enemy+AA, enemy+AC]
056E5C move.l #$80000, ($aa,A6) [enemy+AE, enemy+B0]
056E64 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC]
056EBE move.l #$fff80000, ($aa,A6) [enemy+AE, enemy+B0]
056EC6 move.l #$0, ($a6,A6) [enemy+AA, enemy+AC]
056F00 move.l #$80000, ($aa,A6) [enemy+10]
056F08 bra $56f36 [enemy+AA, enemy+AC]
056F2E move.l #$c0000, ($aa,A6) [enemy+10]
056F36 move.l #$0, ($b2,A6) [enemy+AA, enemy+AC]
056FB0 add.l D0, ($aa,A6)
056FB4 move.l ($aa,A6), D0 [enemy+AA, enemy+AC]
056FB8 add.l D0, ($8,A6) [enemy+AA, enemy+AC]
057000 add.l D0, ($aa,A6) [enemy+A6, enemy+A8]
057004 move.l ($aa,A6), D0 [enemy+AA, enemy+AC]
057008 add.l D0, ($8,A6) [enemy+AA, enemy+AC]
05702C add.l D0, ($aa,A6)
057030 move.l ($aa,A6), D0 [enemy+AA, enemy+AC]
057034 add.l D0, ($8,A6) [enemy+AA, enemy+AC]
057068 add.l D0, ($aa,A6)
05706C move.l ($aa,A6), D0 [enemy+AA, enemy+AC]
057070 add.l D0, ($8,A6) [enemy+AA, enemy+AC]
057920 move.w ($34,PC,D0.w), ($ac,A6) [enemy+AA]
057926 jsr $12cb4.l [enemy+AC]
057A98 move.w ($ac,A6), D0
057A9C add.w D0, ($10,A6) [enemy+AC]
057EA6 tst.b ($ac,A3) [enemy+A2]
057EAA beq $57f0c [enemy+AC]
058532 move.b D0, ($ac,A6)
058536 move.b D0, ($ba,A6)
058712 tst.b ($ac,A6)
058716 bne $58750 [enemy+AC]
05873C move.b #$1, ($ac,A6) [enemy+B6]
058742 move.b #$8, ($5,A1) [enemy+AC]
05874A move.b #$0, ($ac,A6)
058750 rts
05A6C0 move.l #$80000, ($aa,A6) [enemy+ C]
05A6C8 tst.b ($24,A6) [enemy+AA, enemy+AC]
05A6D0 neg.l ($aa,A6)
05A6D4 jsr $119c.l [enemy+AA, enemy+AC]
05A722 neg.l ($aa,A6) [enemy+B0]
05A726 move.w #$50, ($b6,A6) [enemy+AA, enemy+AC]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
include mpcp.inc
;; declaracoes de dados (variaveis globais)
.data
msg BYTE "isto EXEMplo teste nao sei ARroz MuStArDa", 13,10,0
;; seccao de codigo principal
.code
LCASE PROTO C pointer: ptr BYTE, len: DWORD
main PROC C
;; (parte principal)
invoke LCASE, OFFSET msg, LENGTHOF msg
invoke printf, OFFSET msg
;; Terminar o programa
invoke ExitProcess, 0
main ENDP
;; -----------------------------
;; codigo de outras rotinas
LCASE PROC C USES EDI pointer: ptr BYTE, len: DWORD
; ASCII a = 97 -> z = 122
; ASCII A = 65 -> Z = 90
mov ECX, len
mov EDI, pointer
@@:
mov AL, [EDI]
cmp AL, 97
jl isUpper
cmp AL, 122
jg isUpper
sub AL, 32
mov [EDI], AL
isUpper:
inc EDI
loop @B
ret
LCASE ENDP
end |
;********************************************************************************************************
; uC/OS-II
; The Real-Time Kernel
;
; Copyright 1992-2021 Silicon Laboratories Inc. www.silabs.com
;
; SPDX-License-Identifier: APACHE-2.0
;
; This software is subject to an open source license and is distributed by
; Silicon Laboratories Inc. pursuant to the terms of the Apache License,
; Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
;
;********************************************************************************************************
;********************************************************************************************************
;
; ARMv7-A Port
;
; Filename : os_cpu_a_vfp-none.asm
; Version : V2.93.01
;********************************************************************************************************
; For : ARMv7-A Cortex-A
; Mode : ARM or Thumb
; Toolchain : TI TMS470 COMPILER
;********************************************************************************************************
; Note(s) : (1) See Note #2 of os_cpu.h for important information about this file.
;********************************************************************************************************
;********************************************************************************************************
; EXTERNAL REFERENCE
;********************************************************************************************************
; External references.
.global OSRunning
.global OSPrioCur
.global OSPrioHighRdy
.global OSTCBCur
.global OSTCBHighRdy
.global OSIntNesting
.global OSIntExit
.global OSTaskSwHook
.global OS_CPU_ExceptStkBase
.global OS_CPU_ExceptStkPtr
.global OS_CPU_ExceptHndlr ; Chip Support/BSP specific exception handler.
OSRunningAddr .word OSRunning
OSPrioCurAddr .word OSPrioCur
OSPrioHighRdyAddr .word OSPrioHighRdy
OSTCBCurAddr .word OSTCBCur
OSTCBHighRdyAddr .word OSTCBHighRdy
OSIntNestingAddr .word OSIntNesting
OSIntExitAddr .word OSIntExit
OSTaskSwHookAddr .word OSTaskSwHook
OS_CPU_ExceptStkBaseAddr .word OS_CPU_ExceptStkBase
OS_CPU_ExceptStkPtrAddr .word OS_CPU_ExceptStkPtr
OS_CPU_ExceptHndlrAddr .word OS_CPU_ExceptHndlr
;********************************************************************************************************
; FUNCTIONS
;********************************************************************************************************
; Functions declared in this file.
.global OS_CPU_SR_Save
.global OS_CPU_SR_Restore
.global OSStartHighRdy
.global OSCtxSw
.global OSIntCtxSw
; Functions related to exception handling.
.global OS_CPU_ARM_ExceptUndefInstrHndlr
.global OS_CPU_ARM_ExceptSwiHndlr
.global OS_CPU_ARM_ExceptPrefetchAbortHndlr
.global OS_CPU_ARM_ExceptDataAbortHndlr
.global OS_CPU_ARM_ExceptIrqHndlr
.global OS_CPU_ARM_ExceptFiqHndlr
.global OS_CPU_SR_INT_Dis
.global OS_CPU_SR_INT_En
.global OS_CPU_SR_FIQ_Dis
.global OS_CPU_SR_FIQ_En
.global OS_CPU_SR_IRQ_Dis
.global OS_CPU_SR_IRQ_En
.global OS_CPU_ARM_DRegCntGet
;********************************************************************************************************
; EQUATES
;********************************************************************************************************
OS_CPU_ARM_CONTROL_INT_DIS .equ 0xC0 ; Disable both FIQ and IRQ.
OS_CPU_ARM_CONTROL_FIQ_DIS .equ 0x40 ; Disable FIQ.
OS_CPU_ARM_CONTROL_IRQ_DIS .equ 0x80 ; Disable IRQ.
OS_CPU_ARM_CONTROL_THUMB .equ 0x20 ; Set THUMB mode.
OS_CPU_ARM_CONTROL_ARM .equ 0x00 ; Set ARM mode.
OS_CPU_ARM_MODE_MASK .equ 0x1F
OS_CPU_ARM_MODE_USR .equ 0x10
OS_CPU_ARM_MODE_FIQ .equ 0x11
OS_CPU_ARM_MODE_IRQ .equ 0x12
OS_CPU_ARM_MODE_SVC .equ 0x13
OS_CPU_ARM_MODE_ABT .equ 0x17
OS_CPU_ARM_MODE_UND .equ 0x1B
OS_CPU_ARM_MODE_SYS .equ 0x1F
OS_CPU_ARM_EXCEPT_RESET .equ 0x00
OS_CPU_ARM_EXCEPT_UNDEF_INSTR .equ 0x01
OS_CPU_ARM_EXCEPT_SWI .equ 0x02
OS_CPU_ARM_EXCEPT_PREFETCH_ABORT .equ 0x03
OS_CPU_ARM_EXCEPT_DATA_ABORT .equ 0x04
OS_CPU_ARM_EXCEPT_ADDR_ABORT .equ 0x05
OS_CPU_ARM_EXCEPT_IRQ .equ 0x06
OS_CPU_ARM_EXCEPT_FIQ .equ 0x07
OS_CPU_ARM_FPEXC_EN .equ 0x40000000
;********************************************************************************************************
; CODE GENERATION DIRECTIVES
;********************************************************************************************************
.text
.state32
;********************************************************************************************************
; CRITICAL SECTION METHOD 3 FUNCTIONS
;
; Description: Disable/Enable interrupts by preserving the state of interrupts. Generally speaking you
; would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then
; disable interrupts. 'cpu_sr' is allocated in all of uC/OS-II's functions that need to
; disable interrupts. You would restore the interrupt disable state by copying back 'cpu_sr'
; into the CPU's status register.
;
; Prototypes : OS_CPU_SR OS_CPU_SR_Save (void);
; void OS_CPU_SR_Restore (OS_CPU_SR os_cpu_sr);
;
;
; Note(s) : (1) These functions are used in general like this:
;
; void Task (void *p_arg)
; {
; /* Allocate storage for CPU status register. */
; #if (OS_CRITICAL_METHOD == 3)
; OS_CPU_SR os_cpu_sr;
; #endif
;
; :
; :
; OS_ENTER_CRITICAL(); /* os_cpu_sr = OS_CPU_SR_Save(); */
; :
; :
; OS_EXIT_CRITICAL(); /* OS_CPU_SR_Restore(cpu_sr); */
; :
; :
; }
;********************************************************************************************************
OS_CPU_SR_Save
MRS R0, CPSR
CPSID IF ; Set IRQ & FIQ bits in CPSR to DISABLE all interrupts
DSB
BX LR ; DISABLED, return the original CPSR contents in R0
OS_CPU_SR_Restore ; See Note #2
DSB
MSR CPSR_c, R0
BX LR
;********************************************************************************************************
; START MULTITASKING
; void OSStartHighRdy(void)
;
; Note(s) : 1) OSStartHighRdy() MUST:
; a) Call OSTaskSwHook() then,
; b) Set OSRunning to OS_STATE_OS_RUNNING,
; c) Switch to the highest priority task.
;********************************************************************************************************
OSStartHighRdy
; Change to SVC mode.
MSR CPSR_c, #(OS_CPU_ARM_CONTROL_INT_DIS | OS_CPU_ARM_MODE_SVC)
CLREX ; Clear exclusive monitor.
BL OSTaskSwHook ; OSTaskSwHook();
LDR R0, OSRunningAddr ; OSRunning = TRUE;
MOV R1, #1
STRB R1, [R0]
; SWITCH TO HIGHEST PRIORITY TASK:
LDR R0, OSTCBHighRdyAddr ; Get highest priority task TCB address,
LDR R0, [R0] ; Get stack pointer,
LDR SP, [R0] ; Switch to the new stack,
LDR R0, [SP], #4 ; Pop new task's CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pop new task's context.
;********************************************************************************************************
; PERFORM A CONTEXT SWITCH (From task level) - OSCtxSw()
;
; Note(s) : 1) OSCtxSw() is called in SVC mode with BOTH FIQ and IRQ interrupts DISABLED.
;
; 2) The pseudo-code for OSCtxSw() is:
; a) Save the current task's context onto the current task's stack,
; b) OSTCBCur->StkPtr = SP;
; c) OSTaskSwHook();
; d) OSPrioCur = OSPrioHighRdy;
; e) OSTCBCurPtr = OSTCBHighRdy;
; f) SP = OSTCBHighRdy->StkPtr;
; g) Restore the new task's context from the new task's stack,
; h) Return to new task's code.
;
; 3) Upon entry:
; OSTCBCurPtr points to the OS_TCB of the task to suspend,
; OSTCBHighRdyPtr points to the OS_TCB of the task to resume.
;********************************************************************************************************
OSCtxSw
; SAVE CURRENT TASK'S CONTEXT:
STMFD SP!, {LR} ; Push return address,
STMFD SP!, {LR}
STMFD SP!, {R0-R12} ; Push registers,
MRS R0, CPSR ; Push current CPSR,
TST LR, #1 ; See if called from Thumb mode,
ORRNE R0, R0, #OS_CPU_ARM_CONTROL_THUMB ; If yes, set the T-bit.
STMFD SP!, {R0}
CLREX ; Clear exclusive monitor.
LDR R0, OSTCBCurAddr ; OSTCBCur->StkPtr = SP;
LDR R1, [R0]
STR SP, [R1]
BL OSTaskSwHook ; OSTaskSwHook();
LDR R0, OSPrioCurAddr ; OSPrioCur = OSPrioHighRdy;
LDR R1, OSPrioHighRdyAddr
LDRB R2, [R1]
STRB R2, [R0]
LDR R0, OSTCBCurAddr ; OSTCBCur = OSTCBHighRdy;
LDR R1, OSTCBHighRdyAddr
LDR R2, [R1]
STR R2, [R0]
LDR SP, [R2] ; SP = OSTCBHighRdy->OSTCBStkPtr;
; RESTORE NEW TASK'S CONTEXT:
LDMFD SP!, {R0} ; Pop new task's CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pop new task's context.
;********************************************************************************************************
; PERFORM A CONTEXT SWITCH (From interrupt level) - OSIntCtxSw()
;
; Note(s) : 1) OSIntCtxSw() is called in SVC mode with BOTH FIQ and IRQ interrupts DISABLED.
;
; 2) The pseudo-code for OSCtxSw() is:
; a) OSTaskSwHook();
; b) OSPrioCur = OSPrioHighRdy;
; c) OSTCBCurPtr = OSTCBHighRdyPtr;
; d) SP = OSTCBHighRdyPtr->OSTCBStkPtr;
; e) Restore the new task's context from the new task's stack,
; f) Return to new task's code.
;
; 3) Upon entry:
; OSTCBCurPtr points to the OS_TCB of the task to suspend,
; OSTCBHighRdyPtr points to the OS_TCB of the task to resume.
;********************************************************************************************************
OSIntCtxSw
BL OSTaskSwHook ; OSTaskSwHook();
LDR R0, OSPrioCurAddr ; OSPrioCur = OSPrioHighRdy;
LDR R1, OSPrioHighRdyAddr
LDRB R2, [R1]
STRB R2, [R0]
LDR R0, OSTCBCurAddr ; OSTCBCurPtr = OSTCBHighRdy;
LDR R1, OSTCBHighRdyAddr
LDR R2, [R1]
STR R2, [R0]
LDR SP, [R2] ; SP = OSTCBHighRdyPtr->OSTCBStkPtr;
; RESTORE NEW TASK'S CONTEXT:
LDMFD SP!, {R0} ; Pop new task's CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pop new task's context.
;********************************************************************************************************
; UNDEFINED INSTRUCTION EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptUndefInstrHndlr
; LR offset to return from this exception: 0.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_UNDEF_INSTR ; Set exception ID to OS_CPU_ARM_EXCEPT_UNDEF_INSTR.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; SOFTWARE INTERRUPT EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptSwiHndlr
; LR offset to return from this exception: 0.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_SWI ; Set exception ID to OS_CPU_ARM_EXCEPT_SWI.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; PREFETCH ABORT EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptPrefetchAbortHndlr
SUB LR, LR, #4 ; LR offset to return from this exception: -4.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_PREFETCH_ABORT ; Set exception ID to OS_CPU_ARM_EXCEPT_PREFETCH_ABORT.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; DATA ABORT EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptDataAbortHndlr
SUB LR, LR, #8 ; LR offset to return from this exception: -8.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_DATA_ABORT ; Set exception ID to OS_CPU_ARM_EXCEPT_DATA_ABORT.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; ADDRESS ABORT EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptAddrAbortHndlr
SUB LR, LR, #8 ; LR offset to return from this exception: -8.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_ADDR_ABORT ; Set exception ID to OS_CPU_ARM_EXCEPT_ADDR_ABORT.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; INTERRUPT REQUEST EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptIrqHndlr
SUB LR, LR, #4 ; LR offset to return from this exception: -4.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_IRQ ; Set exception ID to OS_CPU_ARM_EXCEPT_IRQ.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; FAST INTERRUPT REQUEST EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1
; R2 Return PC
;********************************************************************************************************
OS_CPU_ARM_ExceptFiqHndlr
SUB LR, LR, #4 ; LR offset to return from this exception: -4.
STMFD SP!, {R0-R3} ; Push working registers.
MOV R2, LR ; Save link register.
MOV R0, #OS_CPU_ARM_EXCEPT_FIQ ; Set exception ID to OS_CPU_ARM_EXCEPT_FIQ.
B OS_CPU_ARM_ExceptHndlr ; Branch to global exception handler.
;********************************************************************************************************
; GLOBAL EXCEPTION HANDLER
;
; Register Usage: R0 Exception Type
; R1 Exception's SPSR
; R2 Return PC
; R3 Exception's SP
;
; Note(s) : 1) An exception can occur in three different circumstances; in each of these, the
; SVC stack pointer will point to a different entity :
;
; a) CONDITION: An exception occurs before the OS has been fully initialized.
; SVC STACK: Should point to a stack initialized by the application's startup code.
; STK USAGE: Interrupted context -- SVC stack.
; Exception -- SVC stack.
; Nested exceptions -- SVC stack.
;
; b) CONDITION: An exception interrupts a task.
; SVC STACK: Should point to task stack.
; STK USAGE: Interrupted context -- Task stack.
; Exception -- Exception stack 'OS_CPU_ExceptStk[]'.
; Nested exceptions -- Exception stack 'OS_CPU_ExceptStk[]'.
;
; c) CONDITION: An exception interrupts another exception.
; SVC STACK: Should point to location in exception stack, 'OS_CPU_ExceptStk[]'.
; STK USAGE: Interrupted context -- Exception stack 'OS_CPU_ExceptStk[]'.
; Exception -- Exception stack 'OS_CPU_ExceptStk[]'.
; Nested exceptions -- Exception stack 'OS_CPU_ExceptStk[]'.
;********************************************************************************************************
OS_CPU_ARM_ExceptHndlr
MRS R1, SPSR ; Save CPSR (i.e. exception's SPSR).
MOV R3, SP ; Save exception's stack pointer.
; Adjust exception stack pointer. This is needed because
; exception stack is not used when restoring task context.
ADD SP, SP, #(4 * 4)
; Change to SVC mode & disable interruptions.
MSR CPSR_c, #(OS_CPU_ARM_CONTROL_INT_DIS | OS_CPU_ARM_MODE_SVC)
CLREX ; Clear exclusive monitor.
STMFD SP!, {R2} ; Push task's PC,
STMFD SP!, {LR} ; Push task's LR,
STMFD SP!, {R4-R12} ; Push task's R12-R4,
LDMFD R3!, {R5-R8} ; Move task's R3-R0 from exception stack to task's stack.
STMFD SP!, {R5-R8}
STMFD SP!, {R1} ; Push task's CPSR (i.e. exception SPSR).
; if (OSRunning == 1)
LDR R3, OSRunningAddr
LDRB R4, [R3]
CMP R4, #1
BNE OS_CPU_ARM_ExceptHndlr_BreakNothing
; HANDLE NESTING COUNTER:
LDR R3, OSIntNestingAddr ; OSIntNesting++;
LDRB R4, [R3]
ADD R4, R4, #1
STRB R4, [R3]
CMP R4, #1 ; if (OSIntNesting == 1)
BNE OS_CPU_ARM_ExceptHndlr_BreakExcept
;********************************************************************************************************
; EXCEPTION HANDLER: TASK INTERRUPTED
;
; Register Usage: R0 Exception Type
; R1
; R2
; R3
;********************************************************************************************************
OS_CPU_ARM_ExceptHndlr_BreakTask
LDR R3, OSTCBCurAddr ; OSTCBCurPtr->StkPtr = SP;
LDR R4, [R3]
STR SP, [R4]
LDR R3, OS_CPU_ExceptStkBaseAddr ; Switch to exception stack.
LDR SP, [R3]
; EXECUTE EXCEPTION HANDLER:
BL OS_CPU_ExceptHndlr ; OS_CPU_ExceptHndlr(except_type = R0)
; Change to SVC mode & disable interruptions.
MSR CPSR_c, #(OS_CPU_ARM_CONTROL_INT_DIS | OS_CPU_ARM_MODE_SVC)
; Call OSIntExit(). This call MAY never return if a ready
; task with higher priority than the interrupted one is
; found.
BL OSIntExit
LDR R3, OSTCBCurAddr ; SP = OSTCBCurPtr->StkPtr;
LDR R4, [R3]
LDR SP, [R4]
; RESTORE NEW TASK'S CONTEXT:
LDMFD SP!, {R0} ; Pop new task's CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pop new task's context.
;********************************************************************************************************
; EXCEPTION HANDLER: EXCEPTION INTERRUPTED
;
; Register Usage: R0 Exception Type
; R1
; R2
; R3
;********************************************************************************************************
OS_CPU_ARM_ExceptHndlr_BreakExcept
MOV R1, SP
AND R1, R1, #4
SUB SP, SP, R1
STMFD SP!, {R1, LR}
; EXECUTE EXCEPTION HANDLER:
BL OS_CPU_ExceptHndlr ; OS_CPU_ExceptHndlr(except_type = R0)
LDMIA SP!, {R1, LR}
ADD SP, SP, R1
; Change to SVC mode & disable interruptions.
MSR CPSR_c, #(OS_CPU_ARM_CONTROL_INT_DIS | OS_CPU_ARM_MODE_SVC)
; HANDLE NESTING COUNTER:
LDR R3, OSIntNestingAddr ; OSIntNestingCtr--;
LDRB R4, [R3]
SUB R4, R4, #1
STRB R4, [R3]
; RESTORE OLD CONTEXT:
LDMFD SP!, {R0} ; Pop old CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pull working registers and return from exception.
;********************************************************************************************************
; EXCEPTION HANDLER: 'NOTHING' INTERRUPTED
;
; Register Usage: R0 Exception Type
; R1
; R2
; R3
;********************************************************************************************************
OS_CPU_ARM_ExceptHndlr_BreakNothing
MOV R1, SP
AND R1, R1, #4
SUB SP, SP, R1
STMFD SP!, {R1, LR}
; EXECUTE EXCEPTION HANDLER:
BL OS_CPU_ExceptHndlr ; OS_CPU_ExceptHndlr(except_type = R0)
LDMIA SP!, {R1, LR}
ADD SP, SP, R1
; Change to SVC mode & disable interruptions.
MSR CPSR_c, #(OS_CPU_ARM_CONTROL_INT_DIS | OS_CPU_ARM_MODE_SVC)
; RESTORE OLD CONTEXT:
LDMFD SP!, {R0} ; Pop old CPSR,
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12, LR, PC}^ ; Pull working registers and return from exception.
;********************************************************************************************************
;********************************************************************************************************
; ENABLE & DISABLE INTERRUPTS, IRQs, FIQs
;********************************************************************************************************
;********************************************************************************************************
;********************************************************************************************************
; ENABLE & DISABLE INTERRUPTS
;
; Note(s) : 1) OS_CPU_SR_INT_En() can be called by OS_CPU_ExceptHndlr() AFTER the external
; interrupt source has been cleared. This function will enable IRQs and FIQs so that
; nesting can occur.
;
; 2) OS_CPU_ARM_INT_Dis() can be called to disable IRQs and FIQs so that nesting will not occur.
;********************************************************************************************************
OS_CPU_SR_INT_En
DSB
MRS R0, CPSR
BIC R0, R0, #OS_CPU_ARM_CONTROL_INT_DIS ; Clear IRQ and FIQ bits in CPSR to enable all interrupts.
MSR CPSR_c, R0
BX LR
OS_CPU_SR_INT_Dis
MRS R0, CPSR
ORR R0, R0, #OS_CPU_ARM_CONTROL_INT_DIS ; Set IRQ and FIQ bits in CPSR to disable all interrupts.
MSR CPSR_c, R0
DSB
BX LR
;********************************************************************************************************
; ENABLE & DISABLE IRQs
;
; Note(s) : 1) OS_CPU_SR_IRQ_En() can be called by OS_CPU_ExceptHndlr() AFTER the external
; interrupt source has been cleared. This function will enable IRQs so that IRQ nesting
; can occur.
;
; 2) OS_CPU_ARM_IRQ_Dis() can be called to disable IRQs so that IRQ nesting will not occur.
;********************************************************************************************************
OS_CPU_SR_IRQ_En
DSB
MRS R0, CPSR
BIC R0, R0, #OS_CPU_ARM_CONTROL_IRQ_DIS ; Clear IRQ bit in CPSR to enable IRQs.
MSR CPSR_c, R0
BX LR
OS_CPU_SR_IRQ_Dis
MRS R0, CPSR
ORR R0, R0, #OS_CPU_ARM_CONTROL_IRQ_DIS ; Set IRQ bit in CPSR to disable IRQs.
MSR CPSR_c, R0
DSB
BX LR
;********************************************************************************************************
; ENABLE & DISABLE FIQs
;
; Note(s) : 1) OS_CPU_SR_FIQ_En() can be called by OS_CPU_ExceptHndlr() AFTER the external
; interrupt source has been cleared. This function will enable FIQs so that FIQ nesting
; can occur.
;
; 2) OS_CPU_ARM_FIQ_Dis() can be called to disable FIQs so that FIQ nesting will not occur.
;********************************************************************************************************
OS_CPU_SR_FIQ_En
DSB
MRS R0, CPSR
BIC R0, R0, #OS_CPU_ARM_CONTROL_FIQ_DIS ; Clear FIQ bit in CPSR to enable FIQs.
MSR CPSR_c, R0
BX LR
OS_CPU_SR_FIQ_Dis
MRS R0, CPSR
ORR R0, R0, #OS_CPU_ARM_CONTROL_FIQ_DIS ; Set FIQ bit in CPSR to disable FIQs.
MSR CPSR_c, R0
DSB
BX LR
;********************************************************************************************************
; VFP/NEON REGISTER COUNT
;
; Register Usage: R0 Double Register Count
;********************************************************************************************************
OS_CPU_ARM_DRegCntGet
MOV R0, #0
BX LR
|
/*
* ProbeHullRenderTasks.cpp
*
* Copyright (C) 2020 by Universitaet Stuttgart (VISUS).
* All rights reserved.
*/
#include "stdafx.h"
#include "mmcore/EventCall.h"
#include "mmcore/param/ColorParam.h"
#include "mmcore/param/EnumParam.h"
#include "ProbeEvents.h"
#include "ProbeGlCalls.h"
#include "ProbeHUllRenderTasks.h"
#include "probe/ProbeCalls.h"
#include "mesh/MeshCalls.h"
bool megamol::probe_gl::ProbeHullRenderTasks::create() {
m_rendertask_collection.first = std::make_shared<mesh_gl::GPURenderTaskCollection>();
struct PerFrameData {
int shading_mode;
};
std::array<PerFrameData, 1> per_frame_data;
per_frame_data[0].shading_mode = m_shading_mode_slot.Param<core::param::EnumParam>()->Value();
m_rendertask_collection.first->addPerFrameDataBuffer("", per_frame_data, 1);
m_material_collection = std::make_shared<mesh_gl::GPUMaterialCollection>();
m_material_collection->addMaterial(this->instance(), "ProbeHull", "ProbeHull");
m_material_collection->addMaterial(this->instance(), "ProbeTriangleHull", "ProbeTriangleHull");
//TODO add other shader for e.g. triangle-based meshes ? switch automatically of course
return true;
}
megamol::probe_gl::ProbeHullRenderTasks::ProbeHullRenderTasks()
: m_version(0)
, m_show_hull(true)
//, m_probes_slot("probes","")
, m_event_slot("GetEvents", "")
, m_shading_mode_slot("ShadingMode", "")
, m_hull_color_slot("HullColor", "") {
//this->m_probes_slot.SetCompatibleCall<megamol::probe::CallProbesDescription>();
//this->MakeSlotAvailable(&this->m_probes_slot);
this->m_event_slot.SetCompatibleCall<core::CallEventDescription>();
this->MakeSlotAvailable(&this->m_event_slot);
this->m_shading_mode_slot << new megamol::core::param::EnumParam(0);
this->m_shading_mode_slot.Param<megamol::core::param::EnumParam>()->SetTypePair(0, "Grey");
this->m_shading_mode_slot.Param<megamol::core::param::EnumParam>()->SetTypePair(1, "ClusterID");
this->MakeSlotAvailable(&this->m_shading_mode_slot);
this->m_hull_color_slot << new megamol::core::param::ColorParam(
this->m_hull_color[0], this->m_hull_color[1], this->m_hull_color[2], 1.0f);
this->MakeSlotAvailable(&this->m_hull_color_slot);
}
megamol::probe_gl::ProbeHullRenderTasks::~ProbeHullRenderTasks() {}
bool megamol::probe_gl::ProbeHullRenderTasks::getDataCallback(core::Call& caller) {
mesh_gl::CallGPURenderTaskData* lhs_rtc = dynamic_cast<mesh_gl::CallGPURenderTaskData*>(&caller);
if (lhs_rtc == NULL)
return false;
mesh_gl::CallGPURenderTaskData* rhs_rtc = this->m_renderTask_rhs_slot.CallAs<mesh_gl::CallGPURenderTaskData>();
std::vector<std::shared_ptr<mesh_gl::GPURenderTaskCollection>> gpu_render_tasks;
if (rhs_rtc != nullptr) {
if (!(*rhs_rtc)(0)) {
return false;
}
if (rhs_rtc->hasUpdate()) {
++m_version;
}
gpu_render_tasks = rhs_rtc->getData();
}
gpu_render_tasks.push_back(m_rendertask_collection.first);
mesh_gl::CallGPUMeshData* mc = this->m_mesh_slot.CallAs<mesh_gl::CallGPUMeshData>();
if (mc != nullptr) {
if (!(*mc)(0))
return false;
if (m_shading_mode_slot.IsDirty()) {
m_shading_mode_slot.ResetDirty();
struct PerFrameData {
int shading_mode;
};
std::array<PerFrameData, 1> per_frame_data;
per_frame_data[0].shading_mode = m_shading_mode_slot.Param<core::param::EnumParam>()->Value();
m_rendertask_collection.first->updatePerFrameDataBuffer("", per_frame_data, 1);
}
if (m_hull_color_slot.IsDirty()) {
m_hull_color_slot.ResetDirty();
std::array<float, 4> obj_color = this->m_hull_color_slot.Param<core::param::ColorParam>()->Value();
for (auto& batch : m_per_object_data) {
for (auto& data : batch) {
data.color = obj_color;
}
}
for (int i = 0; i < m_batch_meshes.size(); ++i) {
for (int j = 0; j < m_identifiers[i].size(); ++j) {
m_rendertask_collection.first->updatePerDrawData(
m_identifiers[i][j], std::vector<PerObjectData>{m_per_object_data[i][j]});
}
}
}
bool something_has_changed = mc->hasUpdate();
if (something_has_changed) {
++m_version;
for (auto& identifier : m_rendertask_collection.second) {
m_rendertask_collection.first->deleteRenderTask(identifier);
}
m_rendertask_collection.second.clear();
m_identifiers.clear();
m_draw_commands.clear();
m_per_object_data.clear();
m_batch_meshes.clear();
auto gpu_mesh_storage = mc->getData();
for (auto& mesh_collection : gpu_mesh_storage) {
std::shared_ptr<glowl::Mesh> prev_mesh(nullptr);
int counter = 0;
for (auto& sub_mesh : mesh_collection->getSubMeshData()) {
auto const& gpu_batch_mesh = sub_mesh.second.mesh->mesh;
//counter++;
//if (counter == 4) {
// continue;
//}
if (gpu_batch_mesh != prev_mesh) {
m_identifiers.emplace_back(std::vector<std::string>());
m_draw_commands.emplace_back(std::vector<glowl::DrawElementsCommand>());
m_per_object_data.emplace_back(std::vector<PerObjectData>());
m_batch_meshes.push_back(gpu_batch_mesh);
prev_mesh = gpu_batch_mesh;
}
float scale = 1.0f;
std::array<float, 16> obj_xform = {scale, 0.0f, 0.0f, 0.0f, 0.0f, scale, 0.0f, 0.0f, 0.0f, 0.0f,
scale, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
std::array<float, 4> obj_color = this->m_hull_color_slot.Param<core::param::ColorParam>()->Value();
m_identifiers.back().emplace_back(std::string(FullName()) + "_" + sub_mesh.first);
m_draw_commands.back().push_back(sub_mesh.second.sub_mesh_draw_command);
m_per_object_data.back().push_back(PerObjectData{obj_xform, obj_color});
}
}
if (m_show_hull) {
auto patch_shader = m_material_collection->getMaterial("ProbeHull").shader_program;
auto tri_shader = m_material_collection->getMaterial("ProbeTriangleHull").shader_program;
for (int i = 0; i < m_batch_meshes.size(); ++i) {
if (m_batch_meshes[i]->getPrimitiveType() == GL_TRIANGLES) {
m_rendertask_collection.first->addRenderTasks(
m_identifiers[i], tri_shader, m_batch_meshes[i], m_draw_commands[i], m_per_object_data[i]);
m_rendertask_collection.second.insert(
m_rendertask_collection.second.end(), m_identifiers[i].begin(), m_identifiers[i].end());
} else if (m_batch_meshes[i]->getPrimitiveType() == GL_PATCHES) {
m_rendertask_collection.first->addRenderTasks(m_identifiers[i], patch_shader, m_batch_meshes[i],
m_draw_commands[i], m_per_object_data[i]);
m_rendertask_collection.second.insert(
m_rendertask_collection.second.end(), m_identifiers[i].begin(), m_identifiers[i].end());
} else {
//TODO print warning
}
}
}
}
// check for pending events
auto call_event_storage = this->m_event_slot.CallAs<core::CallEvent>();
if (call_event_storage != NULL) {
if ((!(*call_event_storage)(0)))
return false;
auto event_collection = call_event_storage->getData();
// process toggle show glyph events
{
auto pending_deselect_events = event_collection->get<ToggleShowHull>();
for (auto& evt : pending_deselect_events) {
m_show_hull = !m_show_hull;
if (m_show_hull) {
//TODO get rid of code copy-pasting...
auto patch_shader = m_material_collection->getMaterial("ProbeHull").shader_program;
auto tri_shader = m_material_collection->getMaterial("ProbeTriangleHull").shader_program;
for (int i = 0; i < m_batch_meshes.size(); ++i) {
if (m_batch_meshes[i]->getPrimitiveType() == GL_TRIANGLES) {
m_rendertask_collection.first->addRenderTasks(m_identifiers[i], tri_shader,
m_batch_meshes[i], m_draw_commands[i], m_per_object_data[i]);
m_rendertask_collection.second.insert(m_rendertask_collection.second.end(),
m_identifiers[i].begin(), m_identifiers[i].end());
} else if (m_batch_meshes[i]->getPrimitiveType() == GL_PATCHES) {
m_rendertask_collection.first->addRenderTasks(m_identifiers[i], patch_shader,
m_batch_meshes[i], m_draw_commands[i], m_per_object_data[i]);
m_rendertask_collection.second.insert(m_rendertask_collection.second.end(),
m_identifiers[i].begin(), m_identifiers[i].end());
} else {
// TODO print warning
}
}
} else {
for (auto& identifier : m_rendertask_collection.second) {
m_rendertask_collection.first->deleteRenderTask(identifier);
}
m_rendertask_collection.second.clear();
}
}
}
}
// TODO merge meta data stuff, i.e. bounding box
auto mesh_meta_data = mc->getMetaData();
}
// set data if necessary
lhs_rtc->setData(gpu_render_tasks, m_version);
return true;
}
bool megamol::probe_gl::ProbeHullRenderTasks::getMetaDataCallback(core::Call& caller) {
if (!AbstractGPURenderTaskDataSource::getMetaDataCallback(caller))
return false;
mesh_gl::CallGPURenderTaskData* lhs_rt_call = dynamic_cast<mesh_gl::CallGPURenderTaskData*>(&caller);
mesh_gl::CallGPUMeshData* mesh_call = this->m_mesh_slot.CallAs<mesh_gl::CallGPUMeshData>();
auto lhs_meta_data = lhs_rt_call->getMetaData();
if (mesh_call != NULL) {
auto mesh_meta_data = mesh_call->getMetaData();
mesh_meta_data.m_frame_ID = lhs_meta_data.m_frame_ID;
mesh_call->setMetaData(mesh_meta_data);
if (!(*mesh_call)(1))
return false;
mesh_meta_data = mesh_call->getMetaData();
auto bbox = lhs_meta_data.m_bboxs.BoundingBox();
auto cbbox = lhs_meta_data.m_bboxs.ClipBox();
auto mesh_bbox = mesh_meta_data.m_bboxs.BoundingBox();
auto mesh_cbbox = mesh_meta_data.m_bboxs.ClipBox();
// mesh_bbox.SetSize(vislib::math::Dimension<float, 3>(
// 2.1f * mesh_bbox.GetSize()[0], 2.1f * mesh_bbox.GetSize()[1], 2.1f * mesh_bbox.GetSize()[2]));
mesh_cbbox.SetSize(vislib::math::Dimension<float, 3>(
2.1f * mesh_cbbox.GetSize()[0], 2.1f * mesh_cbbox.GetSize()[1], 2.1f * mesh_cbbox.GetSize()[2]));
bbox.Union(mesh_bbox);
cbbox.Union(mesh_cbbox);
lhs_meta_data.m_bboxs.SetBoundingBox(bbox);
lhs_meta_data.m_bboxs.SetClipBox(cbbox);
}
lhs_rt_call->setMetaData(lhs_meta_data);
return true;
}
|
\ ******************************************************************************
\
\ DISC ELITE SHIP BLUEPRINTS FILE P
\
\ Elite was written by Ian Bell and David Braben and is copyright Acornsoft 1984
\
\ The code on this site has been disassembled from the version released on Ian
\ Bell's personal website at http://www.elitehomepage.org/
\
\ The commentary is copyright Mark Moxon, and any misunderstandings or mistakes
\ in the documentation are entirely my fault
\
\ The terminology and notations used in this commentary are explained at
\ https://www.bbcelite.com/about_site/terminology_used_in_this_commentary.html
\
\ The deep dive articles referred to in this commentary can be found at
\ https://www.bbcelite.com/deep_dives
\
\ ------------------------------------------------------------------------------
\
\ This source file produces the following binary file:
\
\ * D.MOP.bin
\
\ ******************************************************************************
INCLUDE "1-source-files/main-sources/elite-header.h.asm"
GUARD &6000 \ Guard against assembling over screen memory
\ ******************************************************************************
\
\ Configuration variables
\
\ ******************************************************************************
SHIP_MISSILE = &7F00 \ The address of the missile ship blueprint
CODE% = &5600 \ The flight code loads this file at address &5600, at
LOAD% = &5600 \ label XX21
ORG CODE%
\ ******************************************************************************
\
\ Name: XX21
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprints lookup table for the D.MOP file
\ Deep dive: Ship blueprints in the disc version
\
\ ******************************************************************************
.XX21
EQUW SHIP_MISSILE \ MSL = 1 = Missile
EQUW SHIP_DODO \ SST = 2 = Dodo space station
EQUW SHIP_ESCAPE_POD \ ESC = 3 = Escape pod
EQUW SHIP_PLATE \ PLT = 4 = Alloy plate
EQUW SHIP_CANISTER \ OIL = 5 = Cargo canister
EQUW SHIP_BOULDER \ 6 = Boulder
EQUW SHIP_ASTEROID \ AST = 7 = Asteroid
EQUW SHIP_SPLINTER \ SPL = 8 = Splinter
EQUW 0
EQUW 0
EQUW SHIP_COBRA_MK_3 \ CYL = 11 = Cobra Mk III
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW SHIP_VIPER \ COPS = 16 = Viper
EQUW SHIP_SIDEWINDER \ SH3 = 17 = Sidewinder
EQUW 0
EQUW SHIP_KRAIT \ KRA = 19 = Krait
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW SHIP_ASP_MK_2 \ ASP = 25 = Asp Mk II
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
EQUW 0
\ ******************************************************************************
\
\ Name: E%
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprints default NEWB flags for the D.MOP file
\ Deep dive: Ship blueprints in the disc version
\ Advanced tactics with the NEWB flags
\
\ ******************************************************************************
.E%
EQUB %00000000 \ Missile
EQUB %00000000 \ Dodo space station
EQUB %00000001 \ Escape pod Trader
EQUB %00000000 \ Alloy plate
EQUB %00000000 \ Cargo canister
EQUB %00000000 \ Boulder
EQUB %00000000 \ Asteroid
EQUB %00000000 \ Splinter
EQUB 0
EQUB 0
EQUB %10100000 \ Cobra Mk III Innocent, escape pod
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB %11000010 \ Viper Bounty hunter, cop, escape pod
EQUB %00001100 \ Sidewinder Hostile, pirate
EQUB 0
EQUB %10001100 \ Krait Hostile, pirate, escape pod
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB %10001100 \ Asp Mk II Hostile, pirate, escape pod
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
EQUB 0
\ ******************************************************************************
\
\ Name: VERTEX
\ Type: Macro
\ Category: Drawing ships
\ Summary: Macro definition for adding vertices to ship blueprints
\ Deep dive: Ship blueprints
\
\ ------------------------------------------------------------------------------
\
\ The following macro is used to build the ship blueprints:
\
\ VERTEX x, y, z, face1, face2, face3, face4, visibility
\
\ See the deep dive on "Ship blueprints" for details of how vertices are stored
\ in the ship blueprints, and the deep dive on "Drawing ships" for information
\ on how vertices are used to draw 3D wiremesh ships.
\
\ Arguments:
\
\ x The vertex's x-coordinate
\
\ y The vertex's y-coordinate
\
\ z The vertex's z-coordinate
\
\ face1 The number of face 1 associated with this vertex
\
\ face2 The number of face 2 associated with this vertex
\
\ face3 The number of face 3 associated with this vertex
\
\ face4 The number of face 4 associated with this vertex
\
\ visibility The visibility distance, beyond which the vertex is not
\ shown
\
\ ******************************************************************************
MACRO VERTEX x, y, z, face1, face2, face3, face4, visibility
IF x < 0
s_x = 1 << 7
ELSE
s_x = 0
ENDIF
IF y < 0
s_y = 1 << 6
ELSE
s_y = 0
ENDIF
IF z < 0
s_z = 1 << 5
ELSE
s_z = 0
ENDIF
s = s_x + s_y + s_z + visibility
f1 = face1 + (face2 << 4)
f2 = face3 + (face4 << 4)
ax = ABS(x)
ay = ABS(y)
az = ABS(z)
EQUB ax, ay, az, s, f1, f2
ENDMACRO
\ ******************************************************************************
\
\ Name: EDGE
\ Type: Macro
\ Category: Drawing ships
\ Summary: Macro definition for adding edges to ship blueprints
\ Deep dive: Ship blueprints
\
\ ------------------------------------------------------------------------------
\
\ The following macro is used to build the ship blueprints:
\
\ EDGE vertex1, vertex2, face1, face2, visibility
\
\ See the deep dive on "Ship blueprints" for details of how edges are stored
\ in the ship blueprints, and the deep dive on "Drawing ships" for information
\ on how edges are used to draw 3D wiremesh ships.
\
\ Arguments:
\
\ vertex1 The number of the vertex at the start of the edge
\
\ vertex1 The number of the vertex at the end of the edge
\
\ face1 The number of face 1 associated with this edge
\
\ face2 The number of face 2 associated with this edge
\
\ visibility The visibility distance, beyond which the edge is not
\ shown
\
\ ******************************************************************************
MACRO EDGE vertex1, vertex2, face1, face2, visibility
f = face1 + (face2 << 4)
EQUB visibility, f, vertex1 << 2, vertex2 << 2
ENDMACRO
\ ******************************************************************************
\
\ Name: FACE
\ Type: Macro
\ Category: Drawing ships
\ Summary: Macro definition for adding faces to ship blueprints
\ Deep dive: Ship blueprints
\
\ ------------------------------------------------------------------------------
\
\ The following macro is used to build the ship blueprints:
\
\ FACE normal_x, normal_y, normal_z, visibility
\
\ See the deep dive on "Ship blueprints" for details of how faces are stored
\ in the ship blueprints, and the deep dive on "Drawing ships" for information
\ on how faces are used to draw 3D wiremesh ships.
\
\ Arguments:
\
\ normal_x The face normal's x-coordinate
\
\ normal_y The face normal's y-coordinate
\
\ normal_z The face normal's z-coordinate
\
\ visibility The visibility distance, beyond which the edge is always
\ shown
\
\ ******************************************************************************
MACRO FACE normal_x, normal_y, normal_z, visibility
IF normal_x < 0
s_x = 1 << 7
ELSE
s_x = 0
ENDIF
IF normal_y < 0
s_y = 1 << 6
ELSE
s_y = 0
ENDIF
IF normal_z < 0
s_z = 1 << 5
ELSE
s_z = 0
ENDIF
s = s_x + s_y + s_z + visibility
ax = ABS(normal_x)
ay = ABS(normal_y)
az = ABS(normal_z)
EQUB s, ax, ay, az
ENDMACRO
\ ******************************************************************************
\
\ Name: SHIP_DODO
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Dodecahedron ("Dodo") space station
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_DODO
EQUB 0 \ Max. canisters on demise = 0
EQUW 180 * 180 \ Targetable area = 180 * 180
EQUB LO(SHIP_DODO_EDGES - SHIP_DODO) \ Edges data offset (low)
EQUB LO(SHIP_DODO_FACES - SHIP_DODO) \ Faces data offset (low)
EQUB 97 \ Max. edge count = (97 - 1) / 4 = 24
EQUB 0 \ Gun vertex = 0
EQUB 54 \ Explosion count = 12, as (4 * n) + 6 = 54
EQUB 144 \ Number of vertices = 144 / 6 = 24
EQUB 34 \ Number of edges = 34
EQUW 0 \ Bounty = 0
EQUB 48 \ Number of faces = 48 / 4 = 12
EQUB 125 \ Visibility distance = 125
EQUB 240 \ Max. energy = 240
EQUB 0 \ Max. speed = 0
EQUB HI(SHIP_DODO_EDGES - SHIP_DODO) \ Edges data offset (high)
EQUB HI(SHIP_DODO_FACES - SHIP_DODO) \ Faces data offset (high)
EQUB 0 \ Normals are scaled by = 2^0 = 1
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 150, 196, 1, 0, 5, 5, 31 \ Vertex 0
VERTEX 143, 46, 196, 1, 0, 2, 2, 31 \ Vertex 1
VERTEX 88, -121, 196, 2, 0, 3, 3, 31 \ Vertex 2
VERTEX -88, -121, 196, 3, 0, 4, 4, 31 \ Vertex 3
VERTEX -143, 46, 196, 4, 0, 5, 5, 31 \ Vertex 4
VERTEX 0, 243, 46, 5, 1, 6, 6, 31 \ Vertex 5
VERTEX 231, 75, 46, 2, 1, 7, 7, 31 \ Vertex 6
VERTEX 143, -196, 46, 3, 2, 8, 8, 31 \ Vertex 7
VERTEX -143, -196, 46, 4, 3, 9, 9, 31 \ Vertex 8
VERTEX -231, 75, 46, 5, 4, 10, 10, 31 \ Vertex 9
VERTEX 143, 196, -46, 6, 1, 7, 7, 31 \ Vertex 10
VERTEX 231, -75, -46, 7, 2, 8, 8, 31 \ Vertex 11
VERTEX 0, -243, -46, 8, 3, 9, 9, 31 \ Vertex 12
VERTEX -231, -75, -46, 9, 4, 10, 10, 31 \ Vertex 13
VERTEX -143, 196, -46, 6, 5, 10, 10, 31 \ Vertex 14
VERTEX 88, 121, -196, 7, 6, 11, 11, 31 \ Vertex 15
VERTEX 143, -46, -196, 8, 7, 11, 11, 31 \ Vertex 16
VERTEX 0, -150, -196, 9, 8, 11, 11, 31 \ Vertex 17
VERTEX -143, -46, -196, 10, 9, 11, 11, 31 \ Vertex 18
VERTEX -88, 121, -196, 10, 6, 11, 11, 31 \ Vertex 19
VERTEX -16, 32, 196, 0, 0, 0, 0, 30 \ Vertex 20
VERTEX -16, -32, 196, 0, 0, 0, 0, 30 \ Vertex 21
VERTEX 16, 32, 196, 0, 0, 0, 0, 23 \ Vertex 22
VERTEX 16, -32, 196, 0, 0, 0, 0, 23 \ Vertex 23
.SHIP_DODO_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 1, 0, 31 \ Edge 0
EDGE 1, 2, 2, 0, 31 \ Edge 1
EDGE 2, 3, 3, 0, 31 \ Edge 2
EDGE 3, 4, 4, 0, 31 \ Edge 3
EDGE 4, 0, 5, 0, 31 \ Edge 4
EDGE 5, 10, 6, 1, 31 \ Edge 5
EDGE 10, 6, 7, 1, 31 \ Edge 6
EDGE 6, 11, 7, 2, 31 \ Edge 7
EDGE 11, 7, 8, 2, 31 \ Edge 8
EDGE 7, 12, 8, 3, 31 \ Edge 9
EDGE 12, 8, 9, 3, 31 \ Edge 10
EDGE 8, 13, 9, 4, 31 \ Edge 11
EDGE 13, 9, 10, 4, 31 \ Edge 12
EDGE 9, 14, 10, 5, 31 \ Edge 13
EDGE 14, 5, 6, 5, 31 \ Edge 14
EDGE 15, 16, 11, 7, 31 \ Edge 15
EDGE 16, 17, 11, 8, 31 \ Edge 16
EDGE 17, 18, 11, 9, 31 \ Edge 17
EDGE 18, 19, 11, 10, 31 \ Edge 18
EDGE 19, 15, 11, 6, 31 \ Edge 19
EDGE 0, 5, 5, 1, 31 \ Edge 20
EDGE 1, 6, 2, 1, 31 \ Edge 21
EDGE 2, 7, 3, 2, 31 \ Edge 22
EDGE 3, 8, 4, 3, 31 \ Edge 23
EDGE 4, 9, 5, 4, 31 \ Edge 24
EDGE 10, 15, 7, 6, 31 \ Edge 25
EDGE 11, 16, 8, 7, 31 \ Edge 26
EDGE 12, 17, 9, 8, 31 \ Edge 27
EDGE 13, 18, 10, 9, 31 \ Edge 28
EDGE 14, 19, 10, 6, 31 \ Edge 29
EDGE 20, 21, 0, 0, 30 \ Edge 30
EDGE 21, 23, 0, 0, 20 \ Edge 31
EDGE 23, 22, 0, 0, 23 \ Edge 32
EDGE 22, 20, 0, 0, 20 \ Edge 33
.SHIP_DODO_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 0, 196, 31 \ Face 0
FACE 103, 142, 88, 31 \ Face 1
FACE 169, -55, 89, 31 \ Face 2
FACE 0, -176, 88, 31 \ Face 3
FACE -169, -55, 89, 31 \ Face 4
FACE -103, 142, 88, 31 \ Face 5
FACE 0, 176, -88, 31 \ Face 6
FACE 169, 55, -89, 31 \ Face 7
FACE 103, -142, -88, 31 \ Face 8
FACE -103, -142, -88, 31 \ Face 9
FACE -169, 55, -89, 31 \ Face 10
FACE 0, 0, -196, 31 \ Face 11
\ ******************************************************************************
\
\ Name: SHIP_ESCAPE_POD
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an escape pod
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_ESCAPE_POD
EQUB 0 + (2 << 4) \ Max. canisters on demise = 0
\ Market item when scooped = 2 + 1 = 3 (slaves)
EQUW 16 * 16 \ Targetable area = 16 * 16
EQUB LO(SHIP_ESCAPE_POD_EDGES - SHIP_ESCAPE_POD) \ Edges data offset (low)
EQUB LO(SHIP_ESCAPE_POD_FACES - SHIP_ESCAPE_POD) \ Faces data offset (low)
EQUB 25 \ Max. edge count = (25 - 1) / 4 = 6
EQUB 0 \ Gun vertex = 0
EQUB 22 \ Explosion count = 4, as (4 * n) + 6 = 22
EQUB 24 \ Number of vertices = 24 / 6 = 4
EQUB 6 \ Number of edges = 6
EQUW 0 \ Bounty = 0
EQUB 16 \ Number of faces = 16 / 4 = 4
EQUB 8 \ Visibility distance = 8
EQUB 17 \ Max. energy = 17
EQUB 8 \ Max. speed = 8
EQUB HI(SHIP_ESCAPE_POD_EDGES - SHIP_ESCAPE_POD) \ Edges data offset (high)
EQUB HI(SHIP_ESCAPE_POD_FACES - SHIP_ESCAPE_POD) \ Faces data offset (high)
EQUB 4 \ Normals are scaled by = 2^4 = 16
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -7, 0, 36, 2, 1, 3, 3, 31 \ Vertex 0
VERTEX -7, -14, -12, 2, 0, 3, 3, 31 \ Vertex 1
VERTEX -7, 14, -12, 1, 0, 3, 3, 31 \ Vertex 2
VERTEX 21, 0, 0, 1, 0, 2, 2, 31 \ Vertex 3
.SHIP_ESCAPE_POD_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 3, 2, 31 \ Edge 0
EDGE 1, 2, 3, 0, 31 \ Edge 1
EDGE 2, 3, 1, 0, 31 \ Edge 2
EDGE 3, 0, 2, 1, 31 \ Edge 3
EDGE 0, 2, 3, 1, 31 \ Edge 4
EDGE 3, 1, 2, 0, 31 \ Edge 5
.SHIP_ESCAPE_POD_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 52, 0, -122, 31 \ Face 0
FACE 39, 103, 30, 31 \ Face 1
FACE 39, -103, 30, 31 \ Face 2
FACE -112, 0, 0, 31 \ Face 3
\ ******************************************************************************
\
\ Name: SHIP_PLATE
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an alloy plate
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_PLATE
EQUB 0 + (8 << 4) \ Max. canisters on demise = 0
\ Market item when scooped = 8 + 1 = 9 (Alloys)
EQUW 10 * 10 \ Targetable area = 10 * 10
EQUB LO(SHIP_PLATE_EDGES - SHIP_PLATE) \ Edges data offset (low)
EQUB LO(SHIP_PLATE_FACES - SHIP_PLATE) \ Faces data offset (low)
EQUB 17 \ Max. edge count = (17 - 1) / 4 = 4
EQUB 0 \ Gun vertex = 0
EQUB 10 \ Explosion count = 1, as (4 * n) + 6 = 10
EQUB 24 \ Number of vertices = 24 / 6 = 4
EQUB 4 \ Number of edges = 4
EQUW 0 \ Bounty = 0
EQUB 4 \ Number of faces = 4 / 4 = 1
EQUB 5 \ Visibility distance = 5
EQUB 16 \ Max. energy = 16
EQUB 16 \ Max. speed = 16
EQUB HI(SHIP_PLATE_EDGES - SHIP_PLATE) \ Edges data offset (high)
EQUB HI(SHIP_PLATE_FACES - SHIP_PLATE) \ Faces data offset (high)
EQUB 3 \ Normals are scaled by = 2^3 = 8
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -15, -22, -9, 15, 15, 15, 15, 31 \ Vertex 0
VERTEX -15, 38, -9, 15, 15, 15, 15, 31 \ Vertex 1
VERTEX 19, 32, 11, 15, 15, 15, 15, 20 \ Vertex 2
VERTEX 10, -46, 6, 15, 15, 15, 15, 20 \ Vertex 3
.SHIP_PLATE_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 15, 15, 31 \ Edge 0
EDGE 1, 2, 15, 15, 16 \ Edge 1
EDGE 2, 3, 15, 15, 20 \ Edge 2
EDGE 3, 0, 15, 15, 16 \ Edge 3
.SHIP_PLATE_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 0, 0, 0 \ Face 0
\ ******************************************************************************
\
\ Name: SHIP_CANISTER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a cargo canister
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_CANISTER
EQUB 0 \ Max. canisters on demise = 0
EQUW 20 * 20 \ Targetable area = 20 * 20
EQUB LO(SHIP_CANISTER_EDGES - SHIP_CANISTER) \ Edges data offset (low)
EQUB LO(SHIP_CANISTER_FACES - SHIP_CANISTER) \ Faces data offset (low)
EQUB 49 \ Max. edge count = (49 - 1) / 4 = 12
EQUB 0 \ Gun vertex = 0
EQUB 18 \ Explosion count = 3, as (4 * n) + 6 = 18
EQUB 60 \ Number of vertices = 60 / 6 = 10
EQUB 15 \ Number of edges = 15
EQUW 0 \ Bounty = 0
EQUB 28 \ Number of faces = 28 / 4 = 7
EQUB 12 \ Visibility distance = 12
EQUB 17 \ Max. energy = 17
EQUB 15 \ Max. speed = 15
EQUB HI(SHIP_CANISTER_EDGES - SHIP_CANISTER) \ Edges data offset (high)
EQUB HI(SHIP_CANISTER_FACES - SHIP_CANISTER) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 24, 16, 0, 0, 1, 5, 5, 31 \ Vertex 0
VERTEX 24, 5, 15, 0, 1, 2, 2, 31 \ Vertex 1
VERTEX 24, -13, 9, 0, 2, 3, 3, 31 \ Vertex 2
VERTEX 24, -13, -9, 0, 3, 4, 4, 31 \ Vertex 3
VERTEX 24, 5, -15, 0, 4, 5, 5, 31 \ Vertex 4
VERTEX -24, 16, 0, 1, 5, 6, 6, 31 \ Vertex 5
VERTEX -24, 5, 15, 1, 2, 6, 6, 31 \ Vertex 6
VERTEX -24, -13, 9, 2, 3, 6, 6, 31 \ Vertex 7
VERTEX -24, -13, -9, 3, 4, 6, 6, 31 \ Vertex 8
VERTEX -24, 5, -15, 4, 5, 6, 6, 31 \ Vertex 9
.SHIP_CANISTER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 1, 31 \ Edge 0
EDGE 1, 2, 0, 2, 31 \ Edge 1
EDGE 2, 3, 0, 3, 31 \ Edge 2
EDGE 3, 4, 0, 4, 31 \ Edge 3
EDGE 0, 4, 0, 5, 31 \ Edge 4
EDGE 0, 5, 1, 5, 31 \ Edge 5
EDGE 1, 6, 1, 2, 31 \ Edge 6
EDGE 2, 7, 2, 3, 31 \ Edge 7
EDGE 3, 8, 3, 4, 31 \ Edge 8
EDGE 4, 9, 4, 5, 31 \ Edge 9
EDGE 5, 6, 1, 6, 31 \ Edge 10
EDGE 6, 7, 2, 6, 31 \ Edge 11
EDGE 7, 8, 3, 6, 31 \ Edge 12
EDGE 8, 9, 4, 6, 31 \ Edge 13
EDGE 9, 5, 5, 6, 31 \ Edge 14
.SHIP_CANISTER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 96, 0, 0, 31 \ Face 0
FACE 0, 41, 30, 31 \ Face 1
FACE 0, -18, 48, 31 \ Face 2
FACE 0, -51, 0, 31 \ Face 3
FACE 0, -18, -48, 31 \ Face 4
FACE 0, 41, -30, 31 \ Face 5
FACE -96, 0, 0, 31 \ Face 6
\ ******************************************************************************
\
\ Name: SHIP_BOULDER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a boulder
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_BOULDER
EQUB 0 \ Max. canisters on demise = 0
EQUW 30 * 30 \ Targetable area = 30 * 30
EQUB LO(SHIP_BOULDER_EDGES - SHIP_BOULDER) \ Edges data offset (low)
EQUB LO(SHIP_BOULDER_FACES - SHIP_BOULDER) \ Faces data offset (low)
EQUB 45 \ Max. edge count = (45 - 1) / 4 = 11
EQUB 0 \ Gun vertex = 0
EQUB 14 \ Explosion count = 2, as (4 * n) + 6 = 14
EQUB 42 \ Number of vertices = 42 / 6 = 7
EQUB 15 \ Number of edges = 15
EQUW 1 \ Bounty = 1
EQUB 40 \ Number of faces = 40 / 4 = 10
EQUB 20 \ Visibility distance = 20
EQUB 20 \ Max. energy = 20
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_BOULDER_EDGES - SHIP_BOULDER) \ Edges data offset (high)
EQUB HI(SHIP_BOULDER_FACES - SHIP_BOULDER) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -18, 37, -11, 1, 0, 9, 5, 31 \ Vertex 0
VERTEX 30, 7, 12, 2, 1, 6, 5, 31 \ Vertex 1
VERTEX 28, -7, -12, 3, 2, 7, 6, 31 \ Vertex 2
VERTEX 2, 0, -39, 4, 3, 8, 7, 31 \ Vertex 3
VERTEX -28, 34, -30, 4, 0, 9, 8, 31 \ Vertex 4
VERTEX 5, -10, 13, 15, 15, 15, 15, 31 \ Vertex 5
VERTEX 20, 17, -30, 15, 15, 15, 15, 31 \ Vertex 6
.SHIP_BOULDER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 5, 1, 31 \ Edge 0
EDGE 1, 2, 6, 2, 31 \ Edge 1
EDGE 2, 3, 7, 3, 31 \ Edge 2
EDGE 3, 4, 8, 4, 31 \ Edge 3
EDGE 4, 0, 9, 0, 31 \ Edge 4
EDGE 0, 5, 1, 0, 31 \ Edge 5
EDGE 1, 5, 2, 1, 31 \ Edge 6
EDGE 2, 5, 3, 2, 31 \ Edge 7
EDGE 3, 5, 4, 3, 31 \ Edge 8
EDGE 4, 5, 4, 0, 31 \ Edge 9
EDGE 0, 6, 9, 5, 31 \ Edge 10
EDGE 1, 6, 6, 5, 31 \ Edge 11
EDGE 2, 6, 7, 6, 31 \ Edge 12
EDGE 3, 6, 8, 7, 31 \ Edge 13
EDGE 4, 6, 9, 8, 31 \ Edge 14
.SHIP_BOULDER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE -15, -3, 8, 31 \ Face 0
FACE -7, 12, 30, 31 \ Face 1
FACE 32, -47, 24, 31 \ Face 2
FACE -3, -39, -7, 31 \ Face 3
FACE -5, -4, -1, 31 \ Face 4
FACE 49, 84, 8, 31 \ Face 5
FACE 112, 21, -21, 31 \ Face 6
FACE 76, -35, -82, 31 \ Face 7
FACE 22, 56, -137, 31 \ Face 8
FACE 40, 110, -38, 31 \ Face 9
\ ******************************************************************************
\
\ Name: SHIP_ASTEROID
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an asteroid
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_ASTEROID
EQUB 0 \ Max. canisters on demise = 0
EQUW 80 * 80 \ Targetable area = 80 * 80
EQUB LO(SHIP_ASTEROID_EDGES - SHIP_ASTEROID) \ Edges data offset (low)
EQUB LO(SHIP_ASTEROID_FACES - SHIP_ASTEROID) \ Faces data offset (low)
EQUB 65 \ Max. edge count = (65 - 1) / 4 = 16
EQUB 0 \ Gun vertex = 0
EQUB 34 \ Explosion count = 7, as (4 * n) + 6 = 34
EQUB 54 \ Number of vertices = 54 / 6 = 9
EQUB 21 \ Number of edges = 21
EQUW 5 \ Bounty = 5
EQUB 56 \ Number of faces = 56 / 4 = 14
EQUB 50 \ Visibility distance = 50
EQUB 60 \ Max. energy = 60
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_ASTEROID_EDGES - SHIP_ASTEROID) \ Edges data offset (high)
EQUB HI(SHIP_ASTEROID_FACES - SHIP_ASTEROID) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 80, 0, 15, 15, 15, 15, 31 \ Vertex 0
VERTEX -80, -10, 0, 15, 15, 15, 15, 31 \ Vertex 1
VERTEX 0, -80, 0, 15, 15, 15, 15, 31 \ Vertex 2
VERTEX 70, -40, 0, 15, 15, 15, 15, 31 \ Vertex 3
VERTEX 60, 50, 0, 5, 6, 12, 13, 31 \ Vertex 4
VERTEX 50, 0, 60, 15, 15, 15, 15, 31 \ Vertex 5
VERTEX -40, 0, 70, 0, 1, 2, 3, 31 \ Vertex 6
VERTEX 0, 30, -75, 15, 15, 15, 15, 31 \ Vertex 7
VERTEX 0, -50, -60, 8, 9, 10, 11, 31 \ Vertex 8
.SHIP_ASTEROID_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 2, 7, 31 \ Edge 0
EDGE 0, 4, 6, 13, 31 \ Edge 1
EDGE 3, 4, 5, 12, 31 \ Edge 2
EDGE 2, 3, 4, 11, 31 \ Edge 3
EDGE 1, 2, 3, 10, 31 \ Edge 4
EDGE 1, 6, 2, 3, 31 \ Edge 5
EDGE 2, 6, 1, 3, 31 \ Edge 6
EDGE 2, 5, 1, 4, 31 \ Edge 7
EDGE 5, 6, 0, 1, 31 \ Edge 8
EDGE 0, 5, 0, 6, 31 \ Edge 9
EDGE 3, 5, 4, 5, 31 \ Edge 10
EDGE 0, 6, 0, 2, 31 \ Edge 11
EDGE 4, 5, 5, 6, 31 \ Edge 12
EDGE 1, 8, 8, 10, 31 \ Edge 13
EDGE 1, 7, 7, 8, 31 \ Edge 14
EDGE 0, 7, 7, 13, 31 \ Edge 15
EDGE 4, 7, 12, 13, 31 \ Edge 16
EDGE 3, 7, 9, 12, 31 \ Edge 17
EDGE 3, 8, 9, 11, 31 \ Edge 18
EDGE 2, 8, 10, 11, 31 \ Edge 19
EDGE 7, 8, 8, 9, 31 \ Edge 20
.SHIP_ASTEROID_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 9, 66, 81, 31 \ Face 0
FACE 9, -66, 81, 31 \ Face 1
FACE -72, 64, 31, 31 \ Face 2
FACE -64, -73, 47, 31 \ Face 3
FACE 45, -79, 65, 31 \ Face 4
FACE 135, 15, 35, 31 \ Face 5
FACE 38, 76, 70, 31 \ Face 6
FACE -66, 59, -39, 31 \ Face 7
FACE -67, -15, -80, 31 \ Face 8
FACE 66, -14, -75, 31 \ Face 9
FACE -70, -80, -40, 31 \ Face 10
FACE 58, -102, -51, 31 \ Face 11
FACE 81, 9, -67, 31 \ Face 12
FACE 47, 94, -63, 31 \ Face 13
\ ******************************************************************************
\
\ Name: SHIP_SPLINTER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a splinter
\ Deep dive: Ship blueprints
\
\ ------------------------------------------------------------------------------
\
\ The ship blueprint for the splinter reuses the edges data from the escape pod,
\ so the edges data offset is negative.
\
\ ******************************************************************************
.SHIP_SPLINTER
EQUB 0 + (11 << 4) \ Max. canisters on demise = 0
\ Market item when scooped = 11 + 1 = 12 (Minerals)
EQUW 16 * 16 \ Targetable area = 16 * 16
EQUB LO(SHIP_ESCAPE_POD_EDGES - SHIP_SPLINTER) \ Edges from escape pod
EQUB LO(SHIP_SPLINTER_FACES - SHIP_SPLINTER) + 24 \ Faces data offset (low)
EQUB 25 \ Max. edge count = (25 - 1) / 4 = 6
EQUB 0 \ Gun vertex = 0
EQUB 22 \ Explosion count = 4, as (4 * n) + 6 = 22
EQUB 24 \ Number of vertices = 24 / 6 = 4
EQUB 6 \ Number of edges = 6
EQUW 0 \ Bounty = 0
EQUB 16 \ Number of faces = 16 / 4 = 4
EQUB 8 \ Visibility distance = 8
EQUB 20 \ Max. energy = 20
EQUB 10 \ Max. speed = 10
EQUB HI(SHIP_ESCAPE_POD_EDGES - SHIP_SPLINTER) \ Edges from escape pod
EQUB HI(SHIP_SPLINTER_FACES - SHIP_SPLINTER) \ Faces data offset (low)
EQUB 5 \ Normals are scaled by = 2^5 = 32
EQUB %00000000 \ Laser power = 0
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -24, -25, 16, 2, 1, 3, 3, 31 \ Vertex 0
VERTEX 0, 12, -10, 2, 0, 3, 3, 31 \ Vertex 1
VERTEX 11, -6, 2, 1, 0, 3, 3, 31 \ Vertex 2
VERTEX 12, 42, 7, 1, 0, 2, 2, 31 \ Vertex 3
.SHIP_SPLINTER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 35, 0, 4, 31 \ Face 0
FACE 3, 4, 8, 31 \ Face 1
FACE 1, 8, 12, 31 \ Face 2
FACE 18, 12, 0, 31 \ Face 3
\ ******************************************************************************
\
\ Name: SHIP_COBRA_MK_3
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Cobra Mk III
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_COBRA_MK_3
EQUB 3 \ Max. canisters on demise = 3
EQUW 95 * 95 \ Targetable area = 95 * 95
EQUB LO(SHIP_COBRA_MK_3_EDGES - SHIP_COBRA_MK_3) \ Edges data offset (low)
EQUB LO(SHIP_COBRA_MK_3_FACES - SHIP_COBRA_MK_3) \ Faces data offset (low)
EQUB 153 \ Max. edge count = (153 - 1) / 4 = 38
EQUB 84 \ Gun vertex = 84 / 4 = 21
EQUB 42 \ Explosion count = 9, as (4 * n) + 6 = 42
EQUB 168 \ Number of vertices = 168 / 6 = 28
EQUB 38 \ Number of edges = 38
EQUW 0 \ Bounty = 0
EQUB 52 \ Number of faces = 52 / 4 = 13
EQUB 50 \ Visibility distance = 50
EQUB 150 \ Max. energy = 150
EQUB 28 \ Max. speed = 28
EQUB HI(SHIP_COBRA_MK_3_EDGES - SHIP_COBRA_MK_3) \ Edges data offset (low)
EQUB HI(SHIP_COBRA_MK_3_FACES - SHIP_COBRA_MK_3) \ Faces data offset (low)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010011 \ Laser power = 2
\ Missiles = 3
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 32, 0, 76, 15, 15, 15, 15, 31 \ Vertex 0
VERTEX -32, 0, 76, 15, 15, 15, 15, 31 \ Vertex 1
VERTEX 0, 26, 24, 15, 15, 15, 15, 31 \ Vertex 2
VERTEX -120, -3, -8, 3, 7, 10, 10, 31 \ Vertex 3
VERTEX 120, -3, -8, 4, 8, 12, 12, 31 \ Vertex 4
VERTEX -88, 16, -40, 15, 15, 15, 15, 31 \ Vertex 5
VERTEX 88, 16, -40, 15, 15, 15, 15, 31 \ Vertex 6
VERTEX 128, -8, -40, 8, 9, 12, 12, 31 \ Vertex 7
VERTEX -128, -8, -40, 7, 9, 10, 10, 31 \ Vertex 8
VERTEX 0, 26, -40, 5, 6, 9, 9, 31 \ Vertex 9
VERTEX -32, -24, -40, 9, 10, 11, 11, 31 \ Vertex 10
VERTEX 32, -24, -40, 9, 11, 12, 12, 31 \ Vertex 11
VERTEX -36, 8, -40, 9, 9, 9, 9, 20 \ Vertex 12
VERTEX -8, 12, -40, 9, 9, 9, 9, 20 \ Vertex 13
VERTEX 8, 12, -40, 9, 9, 9, 9, 20 \ Vertex 14
VERTEX 36, 8, -40, 9, 9, 9, 9, 20 \ Vertex 15
VERTEX 36, -12, -40, 9, 9, 9, 9, 20 \ Vertex 16
VERTEX 8, -16, -40, 9, 9, 9, 9, 20 \ Vertex 17
VERTEX -8, -16, -40, 9, 9, 9, 9, 20 \ Vertex 18
VERTEX -36, -12, -40, 9, 9, 9, 9, 20 \ Vertex 19
VERTEX 0, 0, 76, 0, 11, 11, 11, 6 \ Vertex 20
VERTEX 0, 0, 90, 0, 11, 11, 11, 31 \ Vertex 21
VERTEX -80, -6, -40, 9, 9, 9, 9, 8 \ Vertex 22
VERTEX -80, 6, -40, 9, 9, 9, 9, 8 \ Vertex 23
VERTEX -88, 0, -40, 9, 9, 9, 9, 6 \ Vertex 24
VERTEX 80, 6, -40, 9, 9, 9, 9, 8 \ Vertex 25
VERTEX 88, 0, -40, 9, 9, 9, 9, 6 \ Vertex 26
VERTEX 80, -6, -40, 9, 9, 9, 9, 8 \ Vertex 27
.SHIP_COBRA_MK_3_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 11, 31 \ Edge 0
EDGE 0, 4, 4, 12, 31 \ Edge 1
EDGE 1, 3, 3, 10, 31 \ Edge 2
EDGE 3, 8, 7, 10, 31 \ Edge 3
EDGE 4, 7, 8, 12, 31 \ Edge 4
EDGE 6, 7, 8, 9, 31 \ Edge 5
EDGE 6, 9, 6, 9, 31 \ Edge 6
EDGE 5, 9, 5, 9, 31 \ Edge 7
EDGE 5, 8, 7, 9, 31 \ Edge 8
EDGE 2, 5, 1, 5, 31 \ Edge 9
EDGE 2, 6, 2, 6, 31 \ Edge 10
EDGE 3, 5, 3, 7, 31 \ Edge 11
EDGE 4, 6, 4, 8, 31 \ Edge 12
EDGE 1, 2, 0, 1, 31 \ Edge 13
EDGE 0, 2, 0, 2, 31 \ Edge 14
EDGE 8, 10, 9, 10, 31 \ Edge 15
EDGE 10, 11, 9, 11, 31 \ Edge 16
EDGE 7, 11, 9, 12, 31 \ Edge 17
EDGE 1, 10, 10, 11, 31 \ Edge 18
EDGE 0, 11, 11, 12, 31 \ Edge 19
EDGE 1, 5, 1, 3, 29 \ Edge 20
EDGE 0, 6, 2, 4, 29 \ Edge 21
EDGE 20, 21, 0, 11, 6 \ Edge 22
EDGE 12, 13, 9, 9, 20 \ Edge 23
EDGE 18, 19, 9, 9, 20 \ Edge 24
EDGE 14, 15, 9, 9, 20 \ Edge 25
EDGE 16, 17, 9, 9, 20 \ Edge 26
EDGE 15, 16, 9, 9, 19 \ Edge 27
EDGE 14, 17, 9, 9, 17 \ Edge 28
EDGE 13, 18, 9, 9, 19 \ Edge 29
EDGE 12, 19, 9, 9, 19 \ Edge 30
EDGE 2, 9, 5, 6, 30 \ Edge 31
EDGE 22, 24, 9, 9, 6 \ Edge 32
EDGE 23, 24, 9, 9, 6 \ Edge 33
EDGE 22, 23, 9, 9, 8 \ Edge 34
EDGE 25, 26, 9, 9, 6 \ Edge 35
EDGE 26, 27, 9, 9, 6 \ Edge 36
EDGE 25, 27, 9, 9, 8 \ Edge 37
.SHIP_COBRA_MK_3_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 62, 31, 31 \ Face 0
FACE -18, 55, 16, 31 \ Face 1
FACE 18, 55, 16, 31 \ Face 2
FACE -16, 52, 14, 31 \ Face 3
FACE 16, 52, 14, 31 \ Face 4
FACE -14, 47, 0, 31 \ Face 5
FACE 14, 47, 0, 31 \ Face 6
FACE -61, 102, 0, 31 \ Face 7
FACE 61, 102, 0, 31 \ Face 8
FACE 0, 0, -80, 31 \ Face 9
FACE -7, -42, 9, 31 \ Face 10
FACE 0, -30, 6, 31 \ Face 11
FACE 7, -42, 9, 31 \ Face 12
\ ******************************************************************************
\
\ Name: SHIP_VIPER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Viper
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_VIPER
EQUB 0 \ Max. canisters on demise = 0
EQUW 75 * 75 \ Targetable area = 75 * 75
EQUB LO(SHIP_VIPER_EDGES - SHIP_VIPER) \ Edges data offset (low)
EQUB LO(SHIP_VIPER_FACES - SHIP_VIPER) \ Faces data offset (low)
EQUB 77 \ Max. edge count = (77 - 1) / 4 = 19
EQUB 0 \ Gun vertex = 0
EQUB 42 \ Explosion count = 9, as (4 * n) + 6 = 42
EQUB 90 \ Number of vertices = 90 / 6 = 15
EQUB 20 \ Number of edges = 20
EQUW 0 \ Bounty = 0
EQUB 28 \ Number of faces = 28 / 4 = 7
EQUB 23 \ Visibility distance = 23
EQUB 100 \ Max. energy = 100
EQUB 32 \ Max. speed = 32
EQUB HI(SHIP_VIPER_EDGES - SHIP_VIPER) \ Edges data offset (high)
EQUB HI(SHIP_VIPER_FACES - SHIP_VIPER) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010001 \ Laser power = 2
\ Missiles = 1
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 0, 72, 1, 2, 3, 4, 31 \ Vertex 0
VERTEX 0, 16, 24, 0, 1, 2, 2, 30 \ Vertex 1
VERTEX 0, -16, 24, 3, 4, 5, 5, 30 \ Vertex 2
VERTEX 48, 0, -24, 2, 4, 6, 6, 31 \ Vertex 3
VERTEX -48, 0, -24, 1, 3, 6, 6, 31 \ Vertex 4
VERTEX 24, -16, -24, 4, 5, 6, 6, 30 \ Vertex 5
VERTEX -24, -16, -24, 5, 3, 6, 6, 30 \ Vertex 6
VERTEX 24, 16, -24, 0, 2, 6, 6, 31 \ Vertex 7
VERTEX -24, 16, -24, 0, 1, 6, 6, 31 \ Vertex 8
VERTEX -32, 0, -24, 6, 6, 6, 6, 19 \ Vertex 9
VERTEX 32, 0, -24, 6, 6, 6, 6, 19 \ Vertex 10
VERTEX 8, 8, -24, 6, 6, 6, 6, 19 \ Vertex 11
VERTEX -8, 8, -24, 6, 6, 6, 6, 19 \ Vertex 12
VERTEX -8, -8, -24, 6, 6, 6, 6, 18 \ Vertex 13
VERTEX 8, -8, -24, 6, 6, 6, 6, 18 \ Vertex 14
.SHIP_VIPER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 3, 2, 4, 31 \ Edge 0
EDGE 0, 1, 1, 2, 30 \ Edge 1
EDGE 0, 2, 3, 4, 30 \ Edge 2
EDGE 0, 4, 1, 3, 31 \ Edge 3
EDGE 1, 7, 0, 2, 30 \ Edge 4
EDGE 1, 8, 0, 1, 30 \ Edge 5
EDGE 2, 5, 4, 5, 30 \ Edge 6
EDGE 2, 6, 3, 5, 30 \ Edge 7
EDGE 7, 8, 0, 6, 31 \ Edge 8
EDGE 5, 6, 5, 6, 30 \ Edge 9
EDGE 4, 8, 1, 6, 31 \ Edge 10
EDGE 4, 6, 3, 6, 30 \ Edge 11
EDGE 3, 7, 2, 6, 31 \ Edge 12
EDGE 3, 5, 6, 4, 30 \ Edge 13
EDGE 9, 12, 6, 6, 19 \ Edge 14
EDGE 9, 13, 6, 6, 18 \ Edge 15
EDGE 10, 11, 6, 6, 19 \ Edge 16
EDGE 10, 14, 6, 6, 18 \ Edge 17
EDGE 11, 14, 6, 6, 16 \ Edge 18
EDGE 12, 13, 6, 6, 16 \ Edge 19
.SHIP_VIPER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 32, 0, 31 \ Face 0
FACE -22, 33, 11, 31 \ Face 1
FACE 22, 33, 11, 31 \ Face 2
FACE -22, -33, 11, 31 \ Face 3
FACE 22, -33, 11, 31 \ Face 4
FACE 0, -32, 0, 31 \ Face 5
FACE 0, 0, -48, 31 \ Face 6
\ ******************************************************************************
\
\ Name: SHIP_SIDEWINDER
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Sidewinder
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_SIDEWINDER
EQUB 0 \ Max. canisters on demise = 0
EQUW 65 * 65 \ Targetable area = 65 * 65
EQUB LO(SHIP_SIDEWINDER_EDGES - SHIP_SIDEWINDER) \ Edges data offset (low)
EQUB LO(SHIP_SIDEWINDER_FACES - SHIP_SIDEWINDER) \ Faces data offset (low)
EQUB 61 \ Max. edge count = (61 - 1) / 4 = 15
EQUB 0 \ Gun vertex = 0
EQUB 30 \ Explosion count = 6, as (4 * n) + 6 = 30
EQUB 60 \ Number of vertices = 60 / 6 = 10
EQUB 15 \ Number of edges = 15
EQUW 50 \ Bounty = 50
EQUB 28 \ Number of faces = 28 / 4 = 7
EQUB 20 \ Visibility distance = 20
EQUB 70 \ Max. energy = 70
EQUB 37 \ Max. speed = 37
EQUB HI(SHIP_SIDEWINDER_EDGES - SHIP_SIDEWINDER) \ Edges data offset (high)
EQUB HI(SHIP_SIDEWINDER_FACES - SHIP_SIDEWINDER) \ Faces data offset (high)
EQUB 2 \ Normals are scaled by = 2^2 = 4
EQUB %00010000 \ Laser power = 2
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX -32, 0, 36, 0, 1, 4, 5, 31 \ Vertex 0
VERTEX 32, 0, 36, 0, 2, 5, 6, 31 \ Vertex 1
VERTEX 64, 0, -28, 2, 3, 6, 6, 31 \ Vertex 2
VERTEX -64, 0, -28, 1, 3, 4, 4, 31 \ Vertex 3
VERTEX 0, 16, -28, 0, 1, 2, 3, 31 \ Vertex 4
VERTEX 0, -16, -28, 3, 4, 5, 6, 31 \ Vertex 5
VERTEX -12, 6, -28, 3, 3, 3, 3, 15 \ Vertex 6
VERTEX 12, 6, -28, 3, 3, 3, 3, 15 \ Vertex 7
VERTEX 12, -6, -28, 3, 3, 3, 3, 12 \ Vertex 8
VERTEX -12, -6, -28, 3, 3, 3, 3, 12 \ Vertex 9
.SHIP_SIDEWINDER_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 0, 5, 31 \ Edge 0
EDGE 1, 2, 2, 6, 31 \ Edge 1
EDGE 1, 4, 0, 2, 31 \ Edge 2
EDGE 0, 4, 0, 1, 31 \ Edge 3
EDGE 0, 3, 1, 4, 31 \ Edge 4
EDGE 3, 4, 1, 3, 31 \ Edge 5
EDGE 2, 4, 2, 3, 31 \ Edge 6
EDGE 3, 5, 3, 4, 31 \ Edge 7
EDGE 2, 5, 3, 6, 31 \ Edge 8
EDGE 1, 5, 5, 6, 31 \ Edge 9
EDGE 0, 5, 4, 5, 31 \ Edge 10
EDGE 6, 7, 3, 3, 15 \ Edge 11
EDGE 7, 8, 3, 3, 12 \ Edge 12
EDGE 6, 9, 3, 3, 12 \ Edge 13
EDGE 8, 9, 3, 3, 12 \ Edge 14
.SHIP_SIDEWINDER_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, 32, 8, 31 \ Face 0
FACE -12, 47, 6, 31 \ Face 1
FACE 12, 47, 6, 31 \ Face 2
FACE 0, 0, -112, 31 \ Face 3
FACE -12, -47, 6, 31 \ Face 4
FACE 0, -32, 8, 31 \ Face 5
FACE 12, -47, 6, 31 \ Face 6
\ ******************************************************************************
\
\ Name: SHIP_KRAIT
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for a Krait
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_KRAIT
EQUB 1 \ Max. canisters on demise = 1
EQUW 60 * 60 \ Targetable area = 60 * 60
EQUB LO(SHIP_KRAIT_EDGES - SHIP_KRAIT) \ Edges data offset (low)
EQUB LO(SHIP_KRAIT_FACES - SHIP_KRAIT) \ Faces data offset (low)
EQUB 85 \ Max. edge count = (85 - 1) / 4 = 21
EQUB 0 \ Gun vertex = 0
EQUB 18 \ Explosion count = 3, as (4 * n) + 6 = 18
EQUB 102 \ Number of vertices = 102 / 6 = 17
EQUB 21 \ Number of edges = 21
EQUW 100 \ Bounty = 100
EQUB 24 \ Number of faces = 24 / 4 = 6
EQUB 25 \ Visibility distance = 25
EQUB 80 \ Max. energy = 80
EQUB 30 \ Max. speed = 30
EQUB HI(SHIP_KRAIT_EDGES - SHIP_KRAIT) \ Edges data offset (high)
EQUB HI(SHIP_KRAIT_FACES - SHIP_KRAIT) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00010000 \ Laser power = 2
\ Missiles = 0
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, 0, 96, 1, 0, 3, 2, 31 \ Vertex 0
VERTEX 0, 18, -48, 3, 0, 5, 4, 31 \ Vertex 1
VERTEX 0, -18, -48, 2, 1, 5, 4, 31 \ Vertex 2
VERTEX 90, 0, -3, 1, 0, 4, 4, 31 \ Vertex 3
VERTEX -90, 0, -3, 3, 2, 5, 5, 31 \ Vertex 4
VERTEX 90, 0, 87, 1, 0, 1, 1, 30 \ Vertex 5
VERTEX -90, 0, 87, 3, 2, 3, 3, 30 \ Vertex 6
VERTEX 0, 5, 53, 0, 0, 3, 3, 9 \ Vertex 7
VERTEX 0, 7, 38, 0, 0, 3, 3, 6 \ Vertex 8
VERTEX -18, 7, 19, 3, 3, 3, 3, 9 \ Vertex 9
VERTEX 18, 7, 19, 0, 0, 0, 0, 9 \ Vertex 10
VERTEX 18, 11, -39, 4, 4, 4, 4, 8 \ Vertex 11
VERTEX 18, -11, -39, 4, 4, 4, 4, 8 \ Vertex 12
VERTEX 36, 0, -30, 4, 4, 4, 4, 8 \ Vertex 13
VERTEX -18, 11, -39, 5, 5, 5, 5, 8 \ Vertex 14
VERTEX -18, -11, -39, 5, 5, 5, 5, 8 \ Vertex 15
VERTEX -36, 0, -30, 5, 5, 5, 5, 8 \ Vertex 16
.SHIP_KRAIT_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 3, 0, 31 \ Edge 0
EDGE 0, 2, 2, 1, 31 \ Edge 1
EDGE 0, 3, 1, 0, 31 \ Edge 2
EDGE 0, 4, 3, 2, 31 \ Edge 3
EDGE 1, 4, 5, 3, 31 \ Edge 4
EDGE 4, 2, 5, 2, 31 \ Edge 5
EDGE 2, 3, 4, 1, 31 \ Edge 6
EDGE 3, 1, 4, 0, 31 \ Edge 7
EDGE 3, 5, 1, 0, 30 \ Edge 8
EDGE 4, 6, 3, 2, 30 \ Edge 9
EDGE 1, 2, 5, 4, 8 \ Edge 10
EDGE 7, 10, 0, 0, 9 \ Edge 11
EDGE 8, 10, 0, 0, 6 \ Edge 12
EDGE 7, 9, 3, 3, 9 \ Edge 13
EDGE 8, 9, 3, 3, 6 \ Edge 14
EDGE 11, 13, 4, 4, 8 \ Edge 15
EDGE 13, 12, 4, 4, 8 \ Edge 16
EDGE 12, 11, 4, 4, 7 \ Edge 17
EDGE 14, 15, 5, 5, 7 \ Edge 18
EDGE 15, 16, 5, 5, 8 \ Edge 19
EDGE 16, 14, 5, 5, 8 \ Edge 20
.SHIP_KRAIT_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 3, 24, 3, 31 \ Face 0
FACE 3, -24, 3, 31 \ Face 1
FACE -3, -24, 3, 31 \ Face 2
FACE -3, 24, 3, 31 \ Face 3
FACE 38, 0, -77, 31 \ Face 4
FACE -38, 0, -77, 31 \ Face 5
\ ******************************************************************************
\
\ Name: SHIP_ASP_MK_2
\ Type: Variable
\ Category: Drawing ships
\ Summary: Ship blueprint for an Asp Mk II
\ Deep dive: Ship blueprints
\
\ ******************************************************************************
.SHIP_ASP_MK_2
EQUB 0 \ Max. canisters on demise = 0
EQUW 60 * 60 \ Targetable area = 60 * 60
EQUB LO(SHIP_ASP_MK_2_EDGES - SHIP_ASP_MK_2) \ Edges data offset (low)
EQUB LO(SHIP_ASP_MK_2_FACES - SHIP_ASP_MK_2) \ Faces data offset (low)
EQUB 101 \ Max. edge count = (101 - 1) / 4 = 25
EQUB 32 \ Gun vertex = 32
EQUB 26 \ Explosion count = 5, as (4 * n) + 6 = 26
EQUB 114 \ Number of vertices = 114 / 6 = 19
EQUB 28 \ Number of edges = 28
EQUW 200 \ Bounty = 200
EQUB 48 \ Number of faces = 48 / 4 = 12
EQUB 40 \ Visibility distance = 40
EQUB 150 \ Max. energy = 150
EQUB 40 \ Max. speed = 40
EQUB HI(SHIP_ASP_MK_2_EDGES - SHIP_ASP_MK_2) \ Edges data offset (high)
EQUB HI(SHIP_ASP_MK_2_FACES - SHIP_ASP_MK_2) \ Faces data offset (high)
EQUB 1 \ Normals are scaled by = 2^1 = 2
EQUB %00101001 \ Laser power = 5
\ Missiles = 1
\VERTEX x, y, z, face1, face2, face3, face4, visibility
VERTEX 0, -18, 0, 1, 0, 2, 2, 22 \ Vertex 0
VERTEX 0, -9, -45, 2, 1, 11, 11, 31 \ Vertex 1
VERTEX 43, 0, -45, 6, 1, 11, 11, 31 \ Vertex 2
VERTEX 69, -3, 0, 6, 1, 9, 7, 31 \ Vertex 3
VERTEX 43, -14, 28, 1, 0, 7, 7, 31 \ Vertex 4
VERTEX -43, 0, -45, 5, 2, 11, 11, 31 \ Vertex 5
VERTEX -69, -3, 0, 5, 2, 10, 8, 31 \ Vertex 6
VERTEX -43, -14, 28, 2, 0, 8, 8, 31 \ Vertex 7
VERTEX 26, -7, 73, 4, 0, 9, 7, 31 \ Vertex 8
VERTEX -26, -7, 73, 4, 0, 10, 8, 31 \ Vertex 9
VERTEX 43, 14, 28, 4, 3, 9, 6, 31 \ Vertex 10
VERTEX -43, 14, 28, 4, 3, 10, 5, 31 \ Vertex 11
VERTEX 0, 9, -45, 5, 3, 11, 6, 31 \ Vertex 12
VERTEX -17, 0, -45, 11, 11, 11, 11, 10 \ Vertex 13
VERTEX 17, 0, -45, 11, 11, 11, 11, 9 \ Vertex 14
VERTEX 0, -4, -45, 11, 11, 11, 11, 10 \ Vertex 15
VERTEX 0, 4, -45, 11, 11, 11, 11, 8 \ Vertex 16
VERTEX 0, -7, 73, 4, 0, 4, 0, 10 \ Vertex 17
VERTEX 0, -7, 83, 4, 0, 4, 0, 10 \ Vertex 18
.SHIP_ASP_MK_2_EDGES
\EDGE vertex1, vertex2, face1, face2, visibility
EDGE 0, 1, 2, 1, 22 \ Edge 0
EDGE 0, 4, 1, 0, 22 \ Edge 1
EDGE 0, 7, 2, 0, 22 \ Edge 2
EDGE 1, 2, 11, 1, 31 \ Edge 3
EDGE 2, 3, 6, 1, 31 \ Edge 4
EDGE 3, 8, 9, 7, 16 \ Edge 5
EDGE 8, 9, 4, 0, 31 \ Edge 6
EDGE 6, 9, 10, 8, 16 \ Edge 7
EDGE 5, 6, 5, 2, 31 \ Edge 8
EDGE 1, 5, 11, 2, 31 \ Edge 9
EDGE 3, 4, 7, 1, 31 \ Edge 10
EDGE 4, 8, 7, 0, 31 \ Edge 11
EDGE 6, 7, 8, 2, 31 \ Edge 12
EDGE 7, 9, 8, 0, 31 \ Edge 13
EDGE 2, 12, 11, 6, 31 \ Edge 14
EDGE 5, 12, 11, 5, 31 \ Edge 15
EDGE 10, 12, 6, 3, 22 \ Edge 16
EDGE 11, 12, 5, 3, 22 \ Edge 17
EDGE 10, 11, 4, 3, 22 \ Edge 18
EDGE 6, 11, 10, 5, 31 \ Edge 19
EDGE 9, 11, 10, 4, 31 \ Edge 20
EDGE 3, 10, 9, 6, 31 \ Edge 21
EDGE 8, 10, 9, 4, 31 \ Edge 22
EDGE 13, 15, 11, 11, 10 \ Edge 23
EDGE 15, 14, 11, 11, 9 \ Edge 24
EDGE 14, 16, 11, 11, 8 \ Edge 25
EDGE 16, 13, 11, 11, 8 \ Edge 26
EDGE 18, 17, 4, 0, 10 \ Edge 27
.SHIP_ASP_MK_2_FACES
\FACE normal_x, normal_y, normal_z, visibility
FACE 0, -35, 5, 31 \ Face 0
FACE 8, -38, -7, 31 \ Face 1
FACE -8, -38, -7, 31 \ Face 2
FACE 0, 24, -1, 22 \ Face 3
FACE 0, 43, 19, 31 \ Face 4
FACE -6, 28, -2, 31 \ Face 5
FACE 6, 28, -2, 31 \ Face 6
FACE 59, -64, 31, 31 \ Face 7
FACE -59, -64, 31, 31 \ Face 8
FACE 80, 46, 50, 31 \ Face 9
FACE -80, 46, 50, 31 \ Face 10
FACE 0, 0, -90, 31 \ Face 11
\ ******************************************************************************
\
\ Save D.MOP.bin
\
\ ******************************************************************************
PRINT "S.D.MOP ", ~CODE%, " ", ~P%, " ", ~LOAD%, " ", ~LOAD%
SAVE "3-assembled-output/D.MOP.bin", CODE%, CODE% + &0A00
|
#include "MutexLock.hh"
#include <stdio.h>
#include <errno.h>
namespace wd
{
MutexLock::MutexLock()
{
if (pthread_mutex_init(&_mutex, nullptr))
perror("pthread_mutex_init");
}
MutexLock::~MutexLock()
{
if (pthread_mutex_destroy(&_mutex))
perror("pthread_mutex_destory");
}
void MutexLock::lock()
{
if (pthread_mutex_lock(&_mutex))
perror("pthread_mutex_lock");
}
void MutexLock::unlock()
{
if (pthread_mutex_unlock(&_mutex))
perror("pthread_mutex_unlock");
}
pthread_mutex_t *MutexLock::getMutexPtr()
{
return &_mutex;
}
MutexLockGuard::MutexLockGuard(MutexLock &mutex)
: _mutex(mutex)
{
_mutex.lock();
}
MutexLockGuard::~MutexLockGuard()
{
_mutex.unlock();
}
} // end of namespace wd |
#include <stdlib.h>
#include <unistd.h>
#include <QThread>
#include "controller.hpp"
#include "cliparameters.hpp"
Controller::Controller(CliParameters *cliParameters, QObject *parent)
{
fprintf(stderr, "Starting...\n");
conn = new CPConnection(parent);
if (cliParameters->proxyHostname != nullptr)
{
conn->setProxy(cliParameters->proxyHostname, cliParameters->proxyPort);
}
this->cliParameters = cliParameters;
connectionWrapper = new ConnectionWrapper(parent, conn, this->cliParameters);
QObject::connect(connectionWrapper, &ConnectionWrapper::connectionCompleted, this, &Controller::startCLI);
connectionWrapper->startConnection();
QObject::connect(conn, &CPConnection::playerNameReceived, this, &Controller::receivePlayerName);
}
Controller::~Controller()
{
}
// Running the connection object in the same thread as the CLI is probably no good:
// while getline() is blocking this thread, the connection object isn't handling incoming messages...
// this might be okay for the initial connection when the CLI isn't accepting commands, but I probably
// have to moveToThread() the connection after login.
void Controller::startCLI(quint32 playerId)
{
fprintf(stderr, "startCLI()\n");
thisPlayerId = playerId;
QThread::sleep(5);
fprintf(stderr, "Finished sleeping.\n");
stdinNotifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read, this);
QObject::connect(this, &Controller::sendMessageToGiko, conn, &CPConnection::sendClientMessage);
QObject::connect(this, &Controller::sendNewPositionToGiko, conn, &CPConnection::sendPosition);
QObject::connect(this, &Controller::sendNewDirectionToGiko, conn, &CPConnection::sendDirection);
QObject::connect(conn, &CPConnection::playerMessageReceived, this, &Controller::receiveMessageFromGiko);
QObject::connect(conn, &CPConnection::playerPositionChanged, this, &Controller::receivePlayerPosition);
QObject::connect(conn, &CPConnection::playerDirectionChanged, this, &Controller::receivePlayerDirection);
QObject::connect(conn, &CPConnection::stageLoginInfoReceived, this, &Controller::receiveStageLoginInfo);
QObject::connect(stdinNotifier, &QSocketNotifier::activated, this, &Controller::readCommand);
}
void trimWhiteSpaceEnd(char *str, int length)
{
for (int i = length - 1; i >= 0; i--)
{
switch (str[i])
{
case '\n':
str[i] = '\0';
break;
case '\r':
str[i] = '\0';
break;
case ' ':
str[i] = '\0';
break;
default:
return;
}
}
}
void Controller::readCommand()
{
// TODO: I can use QTextStream instead.
// Maybe this should be able to read more than one line, if there's more than one available?
char *line = nullptr;
size_t n = 0;
ssize_t lineLength = getline(&line, &n, stdin);
if (lineLength == -1)
{
fprintf(stderr, "Reached EOF, logging out.\n");
emit quit(); // Yeah, I know this is leaving memory leaks, I don't give a shit.
return;
}
trimWhiteSpaceEnd(line, lineLength);
if (!strncmp(line, "msg ", 4))
{
char *message = line + 4;
fprintf(stderr, "Sending message '%s'.\n", message);
emit sendMessageToGiko(QString::fromUtf8(message));
}
else if (!strncmp(line, "msg\0", 4))
{
fprintf(stderr, "Sending empty message.\n");
emit sendMessageToGiko(QString());
}
else if (!strncmp(line, "move ", 5))
{
if (!canMove)
{
fprintf(stderr, "Still need to finish the previous movement.\n");
goto END;
}
char *direction = line + 5;
int x = playerInfoMap[thisPlayerId].x;
int y = playerInfoMap[thisPlayerId].y;
fprintf(stderr, "moving %s (current pos %d %d.\n", direction, x, y);
fprintf(stderr, "setting canMove to false.\n");
canMove = false;
fprintf(stderr, "set canMove to false.\n");
CPSharedObject::Direction dir;
if (!strcmp(direction, "up"))
dir = CPSharedObject::Up;
else if (!strcmp(direction, "down"))
dir = CPSharedObject::Down;
else if (!strcmp(direction, "left"))
dir = CPSharedObject::Left;
else if (!strcmp(direction, "right"))
dir = CPSharedObject::Right;
else
fprintf(stderr, "Unrecognized command, sorry.\n");
emit sendNewPositionToGiko(x, y, dir);
}
else if (!strncmp(line, "face ", 5))
{
char *direction = line + 5;
int x = playerInfoMap[thisPlayerId].x;
int y = playerInfoMap[thisPlayerId].y;
fprintf(stderr, "facing %s (current pos %d %d.\n", direction, x, y);
CPSharedObject::Direction dir;
if (!strcmp(direction, "up"))
dir = CPSharedObject::Up;
else if (!strcmp(direction, "down"))
dir = CPSharedObject::Down;
else if (!strcmp(direction, "left"))
dir = CPSharedObject::Left;
else if (!strcmp(direction, "right"))
dir = CPSharedObject::Right;
else
fprintf(stderr, "Unrecognized command, sorry.\n");
emit sendNewDirectionToGiko(x, y, dir);
}
else if (!strncmp(line, "list\0", 5))
{
conn->requestStageLoginInfo();
}
else if (!strncmp(line, "help\0", 5))
{
fprintf(stderr, "Commands: msg, move, face.\n");
}
else
fprintf(stderr, "Unrecognized command, sorry.\n");
END:
free(line);
}
void Controller::receiveMessageFromGiko(quint32 playerId, const QString &message)
{
//Prints username and message in JSON
QByteArray msgToPrint = QString::asprintf("MSG {\"playerId\": %d, \"playerName\": \"%s\", \"message\": \"%s\"}\n",
playerId,
playerInfoMap[playerId].username.replace("\"", "\\\"").replace("\n", "").toUtf8().constData(),
QString(message).replace("\"", "\\\"").replace("\n", "").toUtf8().constData())
.toUtf8();
// Directly using write() because for reasons I don't understand, printf() doesn't work (won't even call
// write() as I could see from strace) when this program is run as a child_process from node.js...
write(1, msgToPrint.constData(), msgToPrint.length());
}
void Controller::receivePlayerName(quint32 playerId, const QString &playerName)
{
QByteArray msgToPrint = QString::asprintf("PLAYER_NAME {\"playerId\": %d, \"playerName\": \"%s\"}\n",
playerId,
QString(playerName).replace("\"", "\\\"").replace("\n", "").toUtf8().constData())
.toUtf8();
write(1, msgToPrint.constData(), msgToPrint.length());
if (playerInfoMap.count(playerId) == 0)
{
playerInfoMap[playerId] = PlayerInfo(QString(playerName), 0, 0);
}
else
playerInfoMap[playerId].username = QString(playerName);
}
void Controller::receivePlayerPosition(quint32 playerId, int xPos, int yPos)
{
QByteArray msgToPrint = QString::asprintf("PLAYER_POSITION {\"playerId\": %d, \"x\": %d, \"y\": %d}\n",
playerId,
xPos,
yPos)
.toUtf8();
write(1, msgToPrint.constData(), msgToPrint.length());
if (playerInfoMap.count(playerId) == 0)
{
playerInfoMap[playerId] = PlayerInfo(QString(""), xPos, yPos);
}
else
{
playerInfoMap[playerId].x = xPos;
playerInfoMap[playerId].y = yPos;
}
if (playerId == thisPlayerId)
{
fprintf(stderr, "setting canMove to true.\n");
canMove = true;
fprintf(stderr, "set canMove to true.\n");
}
}
void Controller::receivePlayerDirection(quint32 playerId, CPSharedObject::Direction direction)
{
QByteArray msgToPrint = QString::asprintf("PLAYER_DIRECTION {\"playerId\": %d, \"dir\": \"%s\"}\n",
playerId,
direction == CPSharedObject::Up ? "up" : direction == CPSharedObject::Left ? "left" : direction == CPSharedObject::Right ? "right" : direction == CPSharedObject::Down ? "down" : "???")
.toUtf8();
write(1, msgToPrint.constData(), msgToPrint.length());
}
void Controller::receiveStageLoginInfo(const QStringList &stages, const QStringList &broadcasters, const QVector<int> &loginCounts)
{
write(1, "#LIST [", 7);
for (int i = 0; i < stages.count(); i++)
{
QByteArray msgToPrint = QString::asprintf("{\"stageName\": \"%s\", \"count\": %d}",
QString(stages[i]).replace("\"", "\\\"").toUtf8().constData(),
loginCounts[i])
.toUtf8();
write(1, msgToPrint.constData(), msgToPrint.length());
if (i < stages.count() - 1)
write(1, ",", 1);
}
write(1, "]\n", 2);
} |
; A158011: a(n) = 512n - 1.
; 511,1023,1535,2047,2559,3071,3583,4095,4607,5119,5631,6143,6655,7167,7679,8191,8703,9215,9727,10239,10751,11263,11775,12287,12799,13311,13823,14335,14847,15359,15871,16383,16895,17407,17919,18431,18943,19455,19967,20479,20991,21503,22015,22527,23039,23551,24063,24575,25087,25599,26111,26623,27135,27647,28159,28671,29183,29695,30207,30719,31231,31743,32255,32767,33279,33791,34303,34815,35327,35839,36351,36863,37375,37887,38399,38911,39423,39935,40447,40959,41471,41983,42495,43007,43519,44031
mul $0,512
add $0,511
|
include "constants.asm"
IF LANGUAGE = 2
include "autogenerated/text-constants-ptbr.asm"
ELSE
IF LANGUAGE = 1
include "autogenerated/text-constants-es.asm"
ELSE
include "autogenerated/text-constants.asm"
ENDIF
ENDIF
; the first time this is compiled, we need a few symbols to be defined
; to bootstrap the process. Comment the inclusion of trition.sym and Uncomment these
; constant definition lines:
include "../isometric.sym"
; ending variables:
ending_trigger_map: equ ram_to_clear_at_game_start+7 ; 0/1: map 1 triggered/loaded 2/3: map 2; 4/5: map 3
ending_roll_step: equ ram_to_clear_at_game_start+8 ; from 3-21: unrolling, from 103-121: rolling, 128: reset
ending_text_page_line_state: equ ram_to_clear_at_game_start+9 ; 0: we still need to draw it, > 0 we are displaying it
ending_text_page: equ ram_to_clear_at_game_start+10 ; 0 (text 1), 1 (wait), 2 (text 2), 3 (wait), 4 (the end)
ending_text_page_line: equ ram_to_clear_at_game_start+11
org ENDING_COMPRESSED_CODE_START
include "compressed-state-ending.asm"
|
#include <stan/math/prim/scal.hpp>
#include <gtest/gtest.h>
TEST(ProbPareto, log_matches_lpdf) {
double y = 2.0;
double y_min = 1.1;
double alpha = 2.3;
EXPECT_FLOAT_EQ((stan::math::pareto_lpdf(y, y_min, alpha)),
(stan::math::pareto_log(y, y_min, alpha)));
EXPECT_FLOAT_EQ((stan::math::pareto_lpdf<true>(y, y_min, alpha)),
(stan::math::pareto_log<true>(y, y_min, alpha)));
EXPECT_FLOAT_EQ((stan::math::pareto_lpdf<false>(y, y_min, alpha)),
(stan::math::pareto_log<false>(y, y_min, alpha)));
EXPECT_FLOAT_EQ(
(stan::math::pareto_lpdf<true, double, double, double>(y, y_min, alpha)),
(stan::math::pareto_log<true, double, double, double>(y, y_min, alpha)));
EXPECT_FLOAT_EQ(
(stan::math::pareto_lpdf<false, double, double, double>(y, y_min, alpha)),
(stan::math::pareto_log<false, double, double, double>(y, y_min, alpha)));
EXPECT_FLOAT_EQ(
(stan::math::pareto_lpdf<double, double, double>(y, y_min, alpha)),
(stan::math::pareto_log<double, double, double>(y, y_min, alpha)));
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.